diff --git a/Jenkinsfile2 b/Jenkinsfile2
index dd15807308c9cd753fc525b0a6da706793ce2576..5a0e7972c6081a3ff1c5e01a932c24709bc153a9 100644
--- a/Jenkinsfile2
+++ b/Jenkinsfile2
@@ -387,7 +387,7 @@ pipeline {
}
steps {
catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
- timeout(time: 55, unit: 'MINUTES'){
+ timeout(time: 75, unit: 'MINUTES'){
pre_test_win()
pre_test_build_win()
run_win_ctest()
diff --git a/README-CN.md b/README-CN.md
index a5d239a53296b5a7d96a3e1624879386ab57bf13..b5a2564f9101593335933b8ab2bdffd88e67014d 100644
--- a/README-CN.md
+++ b/README-CN.md
@@ -276,7 +276,7 @@ sudo make install
安装成功后,可以在应用程序中双击 TDengine 图标启动服务,或者在终端中启动 TDengine 服务:
```bash
-launchctl start com.tdengine.taosd
+sudo launchctl start com.tdengine.taosd
```
用户可以使用 TDengine CLI 来连接 TDengine 服务,在终端中,输入:
diff --git a/README.md b/README.md
index 05c1c075f0c3b3894c93d0aa2e126a9dc6340758..3f7208dfb96d857c22f3b7fa83df6d25b4c46246 100644
--- a/README.md
+++ b/README.md
@@ -14,6 +14,12 @@
[](https://ci.appveyor.com/project/sangshuduo/tdengine-2n8ge/branch/master)
[](https://coveralls.io/github/taosdata/TDengine?branch=develop)
[](https://bestpractices.coreinfrastructure.org/projects/4201)
+
+[](https://twitter.com/tdenginedb)
+[](https://www.youtube.com/@tdengine)
+[](https://discord.com/invite/VZdSuUg4pS)
+[](https://www.linkedin.com/company/tdengine)
+[](https://stackoverflow.com/questions/tagged/tdengine)
English | [简体中文](README-CN.md) | [TDengine Cloud](https://cloud.tdengine.com) | [Learn more about TSDB](https://tdengine.com/tsdb/)
@@ -280,7 +286,7 @@ Installing from source code will also configure service management for TDengine.
To start the service after installation, double-click the /applications/TDengine to start the program, or in a terminal, use:
```bash
-launchctl start com.tdengine.taosd
+sudo launchctl start com.tdengine.taosd
```
Then users can use the TDengine CLI to connect the TDengine server. In a terminal, use:
diff --git a/cmake/cmake.version b/cmake/cmake.version
index a4c783b6c8cfa4c3c1bea4eb7f4ac40b165efe87..a30618157b94a8fb361aa20ae87af00f8a1c3852 100644
--- a/cmake/cmake.version
+++ b/cmake/cmake.version
@@ -2,7 +2,7 @@
IF (DEFINED VERNUMBER)
SET(TD_VER_NUMBER ${VERNUMBER})
ELSE ()
- SET(TD_VER_NUMBER "3.0.2.4")
+ SET(TD_VER_NUMBER "3.0.2.5")
ENDIF ()
IF (DEFINED VERCOMPATIBLE)
diff --git a/cmake/taosadapter_CMakeLists.txt.in b/cmake/taosadapter_CMakeLists.txt.in
index d1560574593f613d2f9cf5f486a22d24c32764f9..8df50af03c38eae13b143d6a5af7608d045860bb 100644
--- a/cmake/taosadapter_CMakeLists.txt.in
+++ b/cmake/taosadapter_CMakeLists.txt.in
@@ -2,7 +2,7 @@
# taosadapter
ExternalProject_Add(taosadapter
GIT_REPOSITORY https://github.com/taosdata/taosadapter.git
- GIT_TAG 3e08996
+ GIT_TAG db6c843
SOURCE_DIR "${TD_SOURCE_DIR}/tools/taosadapter"
BINARY_DIR ""
#BUILD_IN_SOURCE TRUE
diff --git a/cmake/taostools_CMakeLists.txt.in b/cmake/taostools_CMakeLists.txt.in
index 4da2d80fbb21f0b1d132a52d86c29bf3b8c09cd3..ae3b626f8854c4e246a23df12779b49e7220179c 100644
--- a/cmake/taostools_CMakeLists.txt.in
+++ b/cmake/taostools_CMakeLists.txt.in
@@ -2,7 +2,7 @@
# taos-tools
ExternalProject_Add(taos-tools
GIT_REPOSITORY https://github.com/taosdata/taos-tools.git
- GIT_TAG c4a567b
+ GIT_TAG 61cbfd2
SOURCE_DIR "${TD_SOURCE_DIR}/tools/taos-tools"
BINARY_DIR ""
#BUILD_IN_SOURCE TRUE
diff --git a/docs/en/12-taos-sql/06-select.md b/docs/en/12-taos-sql/06-select.md
index c087a9e9fb2f0af921aa031d41d124c66fbb0ae7..485779f55f292f04ecebfc75dd82ddfa240d98bf 100644
--- a/docs/en/12-taos-sql/06-select.md
+++ b/docs/en/12-taos-sql/06-select.md
@@ -12,6 +12,7 @@ SELECT [DISTINCT] select_list
from_clause
[WHERE condition]
[partition_by_clause]
+ [interp_clause]
[window_clause]
[group_by_clause]
[order_by_clasue]
@@ -52,8 +53,11 @@ window_clause: {
| STATE_WINDOW(col)
| INTERVAL(interval_val [, interval_offset]) [SLIDING (sliding_val)] [WATERMARK(watermark_val)] [FILL(fill_mod_and_val)]
+interp_clause:
+ RANGE(ts_val, ts_val), EVERY(every_val), FILL(fill_mod_and_val)
+
partition_by_clause:
- PARTITION BY expr [, expr] ...
+ PARTITION BY expr [, expr] ...
group_by_clause:
GROUP BY expr [, expr] ... HAVING condition
diff --git a/docs/en/12-taos-sql/10-function.md b/docs/en/12-taos-sql/10-function.md
index f0daf4b82a2fdc9d519d151451a1bbd10fd93e31..8ab5176aab0a3cd9a2dc4395febbf6ddc8f595f3 100644
--- a/docs/en/12-taos-sql/10-function.md
+++ b/docs/en/12-taos-sql/10-function.md
@@ -872,9 +872,9 @@ INTERP(expr)
- `INTERP` is used to get the value that matches the specified time slice from a column. If no such value exists an interpolation value will be returned based on `FILL` parameter.
- The input data of `INTERP` is the value of the specified column and a `where` clause can be used to filter the original data. If no `where` condition is specified then all original data is the input.
- `INTERP` must be used along with `RANGE`, `EVERY`, `FILL` keywords.
-- The output time range of `INTERP` is specified by `RANGE(timestamp1,timestamp2)` parameter, with timestamp1<=timestamp2. timestamp1 is the starting point of the output time range and must be specified. timestamp2 is the ending point of the output time range and must be specified.
-- The number of rows in the result set of `INTERP` is determined by the parameter `EVERY`. Starting from timestamp1, one interpolation is performed for every time interval specified `EVERY` parameter. The parameter `EVERY` must be an integer, with no quotes, with a time unit of: b(nanosecond), u(microsecond), a(millisecond)), s(second), m(minute), h(hour), d(day), or w(week). For example, `EVERY(500a)` will interpolate every 500 milliseconds.
-- Interpolation is performed based on `FILL` parameter.
+- The output time range of `INTERP` is specified by `RANGE(timestamp1,timestamp2)` parameter, with timestamp1 <= timestamp2. timestamp1 is the starting point of the output time range and must be specified. timestamp2 is the ending point of the output time range and must be specified.
+- The number of rows in the result set of `INTERP` is determined by the parameter `EVERY(time_unit)`. Starting from timestamp1, one interpolation is performed for every time interval specified `time_unit` parameter. The parameter `time_unit` must be an integer, with no quotes, with a time unit of: a(millisecond)), s(second), m(minute), h(hour), d(day), or w(week). For example, `EVERY(500a)` will interpolate every 500 milliseconds.
+- Interpolation is performed based on `FILL` parameter. For more information about FILL clause, see [FILL Clause](../distinguished/#fill-clause).
- `INTERP` can only be used to interpolate in single timeline. So it must be used with `partition by tbname` when it's used on a STable.
- Pseudo column `_irowts` can be used along with `INTERP` to return the timestamps associated with interpolation points(support after version 3.0.1.4).
diff --git a/docs/examples/go/go.mod b/docs/examples/go/go.mod
new file mode 100644
index 0000000000000000000000000000000000000000..716a0ef5dc91b4d3598c8af304204edb99e9b584
--- /dev/null
+++ b/docs/examples/go/go.mod
@@ -0,0 +1,6 @@
+module goexample
+
+go 1.17
+
+require github.com/taosdata/driver-go/v3 v3.1.0
+
diff --git a/docs/zh/12-taos-sql/06-select.md b/docs/zh/12-taos-sql/06-select.md
index 3b681f401c826a8b93ba446ad2804cb37c8c7bf7..b9b26279e623f2f9f167c3c7f305f5921501f7b4 100644
--- a/docs/zh/12-taos-sql/06-select.md
+++ b/docs/zh/12-taos-sql/06-select.md
@@ -13,6 +13,7 @@ SELECT [DISTINCT] select_list
from_clause
[WHERE condition]
[partition_by_clause]
+ [interp_clause]
[window_clause]
[group_by_clause]
[order_by_clasue]
@@ -53,8 +54,11 @@ window_clause: {
| STATE_WINDOW(col)
| INTERVAL(interval_val [, interval_offset]) [SLIDING (sliding_val)] [WATERMARK(watermark_val)] [FILL(fill_mod_and_val)]
+interp_clause:
+ RANGE(ts_val, ts_val), EVERY(every_val), FILL(fill_mod_and_val)
+
partition_by_clause:
- PARTITION BY expr [, expr] ...
+ PARTITION BY expr [, expr] ...
group_by_clause:
GROUP BY expr [, expr] ... HAVING condition
diff --git a/docs/zh/12-taos-sql/10-function.md b/docs/zh/12-taos-sql/10-function.md
index afe90b8a93f5ef6f7b36d43619fb5ba222180ca3..c44c09d10c115a41efd22048d4fdafdc85370ac2 100644
--- a/docs/zh/12-taos-sql/10-function.md
+++ b/docs/zh/12-taos-sql/10-function.md
@@ -875,9 +875,9 @@ INTERP(expr)
- INTERP 用于在指定时间断面获取指定列的记录值,如果该时间断面不存在符合条件的行数据,那么会根据 FILL 参数的设定进行插值。
- INTERP 的输入数据为指定列的数据,可以通过条件语句(where 子句)来对原始列数据进行过滤,如果没有指定过滤条件则输入为全部数据。
- INTERP 需要同时与 RANGE,EVERY 和 FILL 关键字一起使用。
-- INTERP 的输出时间范围根据 RANGE(timestamp1,timestamp2)字段来指定,需满足 timestamp1<=timestamp2。其中 timestamp1(必选值)为输出时间范围的起始值,即如果 timestamp1 时刻符合插值条件则 timestamp1 为输出的第一条记录,timestamp2(必选值)为输出时间范围的结束值,即输出的最后一条记录的 timestamp 不能大于 timestamp2。
-- INTERP 根据 EVERY 字段来确定输出时间范围内的结果条数,即从 timestamp1 开始每隔固定长度的时间(EVERY 值)进行插值。
-- INTERP 根据 FILL 字段来决定在每个符合输出条件的时刻如何进行插值。
+- INTERP 的输出时间范围根据 RANGE(timestamp1,timestamp2)字段来指定,需满足 timestamp1 <= timestamp2。其中 timestamp1(必选值)为输出时间范围的起始值,即如果 timestamp1 时刻符合插值条件则 timestamp1 为输出的第一条记录,timestamp2(必选值)为输出时间范围的结束值,即输出的最后一条记录的 timestamp 不能大于 timestamp2。
+- INTERP 根据 EVERY(time_unit) 字段来确定输出时间范围内的结果条数,即从 timestamp1 开始每隔固定长度的时间(time_unit 值)进行插值,time_unit 可取值时间单位:1a(毫秒),1s(秒),1m(分),1h(小时),1d(天),1w(周)。例如 EVERY(500a) 将对于指定数据每500毫秒间隔进行一次插值.
+- INTERP 根据 FILL 字段来决定在每个符合输出条件的时刻如何进行插值。关于 FILL 子句如何使用请参考 [FILL 子句](../distinguished/#fill-子句)
- INTERP 只能在一个时间序列内进行插值,因此当作用于超级表时必须跟 partition by tbname 一起使用。
- INTERP 可以与伪列 _irowts 一起使用,返回插值点所对应的时间戳(3.0.1.4版本以后支持)。
diff --git a/examples/JDBC/readme.md b/examples/JDBC/readme.md
index c7d7875308d248c1abef8d47bc69a69e91374dbb..c5588a5b255970b1e509abc5b0a8410dcbf52a43 100644
--- a/examples/JDBC/readme.md
+++ b/examples/JDBC/readme.md
@@ -10,4 +10,4 @@
| 6 | taosdemo | This is an internal tool for testing Our JDBC-JNI, JDBC-RESTful, RESTful interfaces |
-more detail: https://docs.taosdata.com/reference/connector/java/
\ No newline at end of file
+more detail: https://docs.taosdata.com/connector/java/
diff --git a/examples/c/tmq.c b/examples/c/tmq.c
index eb41ad039a1852bb265165837d69edc3a2835684..8a2112fbccf313d64ac21431af0a1ab005889fcd 100644
--- a/examples/c/tmq.c
+++ b/examples/c/tmq.c
@@ -189,27 +189,46 @@ void tmq_commit_cb_print(tmq_t* tmq, int32_t code, void* param) {
tmq_t* build_consumer() {
tmq_conf_res_t code;
+ tmq_t* tmq = NULL;
+
tmq_conf_t* conf = tmq_conf_new();
code = tmq_conf_set(conf, "enable.auto.commit", "true");
- if (TMQ_CONF_OK != code) return NULL;
+ if (TMQ_CONF_OK != code) {
+ goto _end;
+ }
code = tmq_conf_set(conf, "auto.commit.interval.ms", "1000");
- if (TMQ_CONF_OK != code) return NULL;
+ if (TMQ_CONF_OK != code) {
+ goto _end;
+ }
code = tmq_conf_set(conf, "group.id", "cgrpName");
- if (TMQ_CONF_OK != code) return NULL;
+ if (TMQ_CONF_OK != code) {
+ goto _end;
+ }
code = tmq_conf_set(conf, "client.id", "user defined name");
- if (TMQ_CONF_OK != code) return NULL;
+ if (TMQ_CONF_OK != code) {
+ goto _end;
+ }
code = tmq_conf_set(conf, "td.connect.user", "root");
- if (TMQ_CONF_OK != code) return NULL;
+ if (TMQ_CONF_OK != code) {
+ goto _end;
+ }
code = tmq_conf_set(conf, "td.connect.pass", "taosdata");
- if (TMQ_CONF_OK != code) return NULL;
+ if (TMQ_CONF_OK != code) {
+ goto _end;
+ }
code = tmq_conf_set(conf, "auto.offset.reset", "earliest");
- if (TMQ_CONF_OK != code) return NULL;
+ if (TMQ_CONF_OK != code) {
+ goto _end;
+ }
code = tmq_conf_set(conf, "experimental.snapshot.enable", "false");
- if (TMQ_CONF_OK != code) return NULL;
+ if (TMQ_CONF_OK != code) {
+ goto _end;
+ }
tmq_conf_set_auto_commit_cb(conf, tmq_commit_cb_print, NULL);
+ tmq = tmq_consumer_new(conf, NULL, 0);
- tmq_t* tmq = tmq_consumer_new(conf, NULL, 0);
+ _end:
tmq_conf_destroy(conf);
return tmq;
}
diff --git a/include/common/tcommon.h b/include/common/tcommon.h
index f74795a250e66298ff08a1a1aa97d37f740a1942..72d969a0d54be5c547d984e5b80750093180fcd7 100644
--- a/include/common/tcommon.h
+++ b/include/common/tcommon.h
@@ -195,7 +195,7 @@ typedef struct SDataBlockInfo {
uint32_t capacity;
SBlockID id;
int16_t hasVarCol;
- int16_t dataLoad; // denote if the data is loaded or not
+ int16_t dataLoad; // denote if the data is loaded or not
// TODO: optimize and remove following
int64_t version; // used for stream, and need serialization
@@ -204,8 +204,8 @@ typedef struct SDataBlockInfo {
STimeWindow calWin; // used for stream, do not serialize
TSKEY watermark; // used for stream
- char parTbName[TSDB_TABLE_NAME_LEN]; // used for stream partition
- STag* pTag; // used for stream partition
+ char parTbName[TSDB_TABLE_NAME_LEN]; // used for stream partition
+ STag* pTag; // used for stream partition
} SDataBlockInfo;
typedef struct SSDataBlock {
@@ -239,22 +239,22 @@ typedef struct SVarColAttr {
// pBlockAgg->numOfNull == info.rows, all data are null
// pBlockAgg->numOfNull == 0, no data are null.
typedef struct SColumnInfoData {
- char* pData; // the corresponding block data in memory
+ char* pData; // the corresponding block data in memory
union {
char* nullbitmap; // bitmap, one bit for each item in the list
SVarColAttr varmeta;
};
- SColumnInfo info; // column info
- bool hasNull; // if current column data has null value.
+ SColumnInfo info; // column info
+ bool hasNull; // if current column data has null value.
} SColumnInfoData;
typedef struct SQueryTableDataCond {
uint64_t suid;
- int32_t order; // desc|asc order to iterate the data block
+ int32_t order; // desc|asc order to iterate the data block
int32_t numOfCols;
SColumnInfo* colList;
- int32_t* pSlotList; // the column output destation slot, and it may be null
- int32_t type; // data block load type:
+ int32_t* pSlotList; // the column output destation slot, and it may be null
+ int32_t type; // data block load type:
STimeWindow twindows;
int64_t startVersion;
int64_t endVersion;
@@ -300,6 +300,7 @@ typedef struct STableBlockDistInfo {
int32_t firstSeekTimeUs;
uint32_t numOfInmemRows;
uint32_t numOfSmallBlocks;
+ uint32_t numOfVgroups;
int32_t blockRowsHisto[20];
} STableBlockDistInfo;
@@ -367,6 +368,12 @@ typedef struct SSortExecInfo {
int32_t readBytes; // read io bytes
} SSortExecInfo;
+typedef struct STUidTagInfo {
+ char* name;
+ uint64_t uid;
+ void* pTagVal;
+} STUidTagInfo;
+
// stream special block column
#define START_TS_COLUMN_INDEX 0
diff --git a/include/common/tglobal.h b/include/common/tglobal.h
index 2331f0b23c52d6b826796549a1964d4eb970a9fd..e92afc22221a4f647bf6ee5a2a4e5c089e856bfd 100644
--- a/include/common/tglobal.h
+++ b/include/common/tglobal.h
@@ -49,6 +49,7 @@ extern int32_t tsTagFilterResCacheSize;
// queue & threads
extern int32_t tsNumOfRpcThreads;
+extern int32_t tsNumOfRpcSessions;
extern int32_t tsNumOfCommitThreads;
extern int32_t tsNumOfTaskQueueThreads;
extern int32_t tsNumOfMnodeQueryThreads;
@@ -86,9 +87,9 @@ extern int32_t tsTelemInterval;
extern char tsTelemServer[];
extern uint16_t tsTelemPort;
extern bool tsEnableCrashReport;
-extern char* tsTelemUri;
-extern char* tsClientCrashReportUri;
-extern char* tsSvrCrashReportUri;
+extern char *tsTelemUri;
+extern char *tsClientCrashReportUri;
+extern char *tsSvrCrashReportUri;
// query buffer management
extern int32_t tsQueryBufferSize; // maximum allowed usage buffer size in MB for each data node during query processing
@@ -159,6 +160,8 @@ extern int32_t tsUptimeInterval;
extern int32_t tsRpcRetryLimit;
extern int32_t tsRpcRetryInterval;
+extern bool tsDisableStream;
+
// #define NEEDTO_COMPRESSS_MSG(size) (tsCompressMsgSize != -1 && (size) > tsCompressMsgSize)
int32_t taosCreateLog(const char *logname, int32_t logFileNum, const char *cfgDir, const char **envCmd,
diff --git a/include/common/tmisce.h b/include/common/tmisce.h
index b9f5cf5b91f55a8f9ca14194b41673c8506bb3fa..bc6558900c2f370c1e29ed09d430587c7bcf531d 100644
--- a/include/common/tmisce.h
+++ b/include/common/tmisce.h
@@ -27,13 +27,14 @@ typedef struct SCorEpSet {
SEpSet epSet;
} SCorEpSet;
+#define GET_ACTIVE_EP(_eps) (&((_eps)->eps[(_eps)->inUse]))
int32_t taosGetFqdnPortFromEp(const char* ep, SEp* pEp);
void addEpIntoEpSet(SEpSet* pEpSet, const char* fqdn, uint16_t port);
-bool isEpsetEqual(const SEpSet* s1, const SEpSet* s2);
-
-void updateEpSet_s(SCorEpSet* pEpSet, SEpSet* pNewEpSet);
-SEpSet getEpSet_s(SCorEpSet* pEpSet);
+bool isEpsetEqual(const SEpSet* s1, const SEpSet* s2);
+void epsetAssign(SEpSet* dst, const SEpSet* pSrc);
+void updateEpSet_s(SCorEpSet* pEpSet, SEpSet* pNewEpSet);
+SEpSet getEpSet_s(SCorEpSet* pEpSet);
#ifdef __cplusplus
}
diff --git a/include/common/tmsg.h b/include/common/tmsg.h
index 0cc9fb8619172eaa47bd70580acdd7520ab30d40..335c57afd36af2ce7a46a89e3a4cfdc479c9af76 100644
--- a/include/common/tmsg.h
+++ b/include/common/tmsg.h
@@ -58,7 +58,7 @@ extern int32_t tMsgDict[];
#define TMSG_INFO(TYPE) \
((TYPE) < TDMT_DND_MAX_MSG || (TYPE) < TDMT_MND_MAX_MSG || (TYPE) < TDMT_VND_MAX_MSG || (TYPE) < TDMT_SCH_MAX_MSG || \
(TYPE) < TDMT_STREAM_MAX_MSG || (TYPE) < TDMT_MON_MAX_MSG || (TYPE) < TDMT_SYNC_MAX_MSG) || \
- (TYPE) < TDMT_VND_STREAM_MSG || (TYPE) < TDMT_VND_TMQ_MSG \
+ (TYPE) < TDMT_VND_STREAM_MSG || (TYPE) < TDMT_VND_TMQ_MSG || (TYPE) < TDMT_VND_TMQ_MAX_MSG \
? tMsgInfo[tMsgDict[TMSG_SEG_CODE(TYPE)] + TMSG_SEG_SEQ(TYPE)] \
: 0
@@ -144,12 +144,14 @@ typedef enum _mgmt_table {
#define TSDB_ALTER_TABLE_UPDATE_OPTIONS 9
#define TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME 10
-#define TSDB_FILL_NONE 0
-#define TSDB_FILL_NULL 1
-#define TSDB_FILL_SET_VALUE 2
-#define TSDB_FILL_LINEAR 3
-#define TSDB_FILL_PREV 4
-#define TSDB_FILL_NEXT 5
+#define TSDB_FILL_NONE 0
+#define TSDB_FILL_NULL 1
+#define TSDB_FILL_NULL_F 2
+#define TSDB_FILL_SET_VALUE 3
+#define TSDB_FILL_SET_VALUE_F 4
+#define TSDB_FILL_LINEAR 5
+#define TSDB_FILL_PREV 6
+#define TSDB_FILL_NEXT 7
#define TSDB_ALTER_USER_PASSWD 0x1
#define TSDB_ALTER_USER_SUPERUSER 0x2
@@ -1752,6 +1754,7 @@ typedef struct {
#define STREAM_FILL_HISTORY_ON 1
#define STREAM_FILL_HISTORY_OFF 0
#define STREAM_DEFAULT_FILL_HISTORY STREAM_FILL_HISTORY_OFF
+#define STREAM_DEFAULT_IGNORE_UPDATE 0
typedef struct {
char name[TSDB_STREAM_FNAME_LEN];
@@ -1769,6 +1772,8 @@ typedef struct {
SArray* pTags; // array of SField
// 3.0.20
int64_t checkpointFreq; // ms
+ int64_t deleteMark;
+ int8_t igUpdate;
} SCMCreateStreamReq;
typedef struct {
@@ -1825,10 +1830,10 @@ typedef struct {
} SMqConsumerLostMsg, SMqConsumerRecoverMsg, SMqConsumerClearMsg;
typedef struct {
- int64_t consumerId;
- char cgroup[TSDB_CGROUP_LEN];
- char clientId[256];
- SArray* topicNames; // SArray
+ int64_t consumerId;
+ char cgroup[TSDB_CGROUP_LEN];
+ char clientId[256];
+ SArray* topicNames; // SArray
} SCMSubscribeReq;
static FORCE_INLINE int32_t tSerializeSCMSubscribeReq(void** buf, const SCMSubscribeReq* pReq) {
diff --git a/include/common/ttokendef.h b/include/common/ttokendef.h
index 0192bbf486270d81de097ff64eb3877b88172e18..1d69e129f4110d4f461ed1b0d65cce578551b2e4 100644
--- a/include/common/ttokendef.h
+++ b/include/common/ttokendef.h
@@ -209,134 +209,136 @@
#define TK_IGNORE 191
#define TK_EXPIRED 192
#define TK_FILL_HISTORY 193
-#define TK_SUBTABLE 194
-#define TK_KILL 195
-#define TK_CONNECTION 196
-#define TK_TRANSACTION 197
-#define TK_BALANCE 198
-#define TK_VGROUP 199
-#define TK_MERGE 200
-#define TK_REDISTRIBUTE 201
-#define TK_SPLIT 202
-#define TK_DELETE 203
-#define TK_INSERT 204
-#define TK_NULL 205
-#define TK_NK_QUESTION 206
-#define TK_NK_ARROW 207
-#define TK_ROWTS 208
-#define TK_QSTART 209
-#define TK_QEND 210
-#define TK_QDURATION 211
-#define TK_WSTART 212
-#define TK_WEND 213
-#define TK_WDURATION 214
-#define TK_IROWTS 215
-#define TK_CAST 216
-#define TK_NOW 217
-#define TK_TODAY 218
-#define TK_TIMEZONE 219
-#define TK_CLIENT_VERSION 220
-#define TK_SERVER_VERSION 221
-#define TK_SERVER_STATUS 222
-#define TK_CURRENT_USER 223
-#define TK_COUNT 224
-#define TK_LAST_ROW 225
-#define TK_CASE 226
-#define TK_END 227
-#define TK_WHEN 228
-#define TK_THEN 229
-#define TK_ELSE 230
-#define TK_BETWEEN 231
-#define TK_IS 232
-#define TK_NK_LT 233
-#define TK_NK_GT 234
-#define TK_NK_LE 235
-#define TK_NK_GE 236
-#define TK_NK_NE 237
-#define TK_MATCH 238
-#define TK_NMATCH 239
-#define TK_CONTAINS 240
-#define TK_IN 241
-#define TK_JOIN 242
-#define TK_INNER 243
-#define TK_SELECT 244
-#define TK_DISTINCT 245
-#define TK_WHERE 246
-#define TK_PARTITION 247
-#define TK_BY 248
-#define TK_SESSION 249
-#define TK_STATE_WINDOW 250
-#define TK_SLIDING 251
-#define TK_FILL 252
-#define TK_VALUE 253
-#define TK_NONE 254
-#define TK_PREV 255
-#define TK_LINEAR 256
-#define TK_NEXT 257
-#define TK_HAVING 258
-#define TK_RANGE 259
-#define TK_EVERY 260
-#define TK_ORDER 261
-#define TK_SLIMIT 262
-#define TK_SOFFSET 263
-#define TK_LIMIT 264
-#define TK_OFFSET 265
-#define TK_ASC 266
-#define TK_NULLS 267
-#define TK_ABORT 268
-#define TK_AFTER 269
-#define TK_ATTACH 270
-#define TK_BEFORE 271
-#define TK_BEGIN 272
-#define TK_BITAND 273
-#define TK_BITNOT 274
-#define TK_BITOR 275
-#define TK_BLOCKS 276
-#define TK_CHANGE 277
-#define TK_COMMA 278
-#define TK_COMPACT 279
-#define TK_CONCAT 280
-#define TK_CONFLICT 281
-#define TK_COPY 282
-#define TK_DEFERRED 283
-#define TK_DELIMITERS 284
-#define TK_DETACH 285
-#define TK_DIVIDE 286
-#define TK_DOT 287
-#define TK_EACH 288
-#define TK_FAIL 289
-#define TK_FILE 290
-#define TK_FOR 291
-#define TK_GLOB 292
-#define TK_ID 293
-#define TK_IMMEDIATE 294
-#define TK_IMPORT 295
-#define TK_INITIALLY 296
-#define TK_INSTEAD 297
-#define TK_ISNULL 298
-#define TK_KEY 299
-#define TK_MODULES 300
-#define TK_NK_BITNOT 301
-#define TK_NK_SEMI 302
-#define TK_NOTNULL 303
-#define TK_OF 304
-#define TK_PLUS 305
-#define TK_PRIVILEGE 306
-#define TK_RAISE 307
-#define TK_REPLACE 308
-#define TK_RESTRICT 309
-#define TK_ROW 310
-#define TK_SEMI 311
-#define TK_STAR 312
-#define TK_STATEMENT 313
-#define TK_STRICT 314
-#define TK_STRING 315
-#define TK_TIMES 316
-#define TK_UPDATE 317
-#define TK_VALUES 318
-#define TK_VARIABLE 319
-#define TK_VIEW 320
-#define TK_WAL 321
+#define TK_UPDATE 194
+#define TK_SUBTABLE 195
+#define TK_KILL 196
+#define TK_CONNECTION 197
+#define TK_TRANSACTION 198
+#define TK_BALANCE 199
+#define TK_VGROUP 200
+#define TK_MERGE 201
+#define TK_REDISTRIBUTE 202
+#define TK_SPLIT 203
+#define TK_DELETE 204
+#define TK_INSERT 205
+#define TK_NULL 206
+#define TK_NK_QUESTION 207
+#define TK_NK_ARROW 208
+#define TK_ROWTS 209
+#define TK_QSTART 210
+#define TK_QEND 211
+#define TK_QDURATION 212
+#define TK_WSTART 213
+#define TK_WEND 214
+#define TK_WDURATION 215
+#define TK_IROWTS 216
+#define TK_CAST 217
+#define TK_NOW 218
+#define TK_TODAY 219
+#define TK_TIMEZONE 220
+#define TK_CLIENT_VERSION 221
+#define TK_SERVER_VERSION 222
+#define TK_SERVER_STATUS 223
+#define TK_CURRENT_USER 224
+#define TK_COUNT 225
+#define TK_LAST_ROW 226
+#define TK_CASE 227
+#define TK_END 228
+#define TK_WHEN 229
+#define TK_THEN 230
+#define TK_ELSE 231
+#define TK_BETWEEN 232
+#define TK_IS 233
+#define TK_NK_LT 234
+#define TK_NK_GT 235
+#define TK_NK_LE 236
+#define TK_NK_GE 237
+#define TK_NK_NE 238
+#define TK_MATCH 239
+#define TK_NMATCH 240
+#define TK_CONTAINS 241
+#define TK_IN 242
+#define TK_JOIN 243
+#define TK_INNER 244
+#define TK_SELECT 245
+#define TK_DISTINCT 246
+#define TK_WHERE 247
+#define TK_PARTITION 248
+#define TK_BY 249
+#define TK_SESSION 250
+#define TK_STATE_WINDOW 251
+#define TK_SLIDING 252
+#define TK_FILL 253
+#define TK_VALUE 254
+#define TK_VALUE_F 255
+#define TK_NONE 256
+#define TK_PREV 257
+#define TK_NULL_F 258
+#define TK_LINEAR 259
+#define TK_NEXT 260
+#define TK_HAVING 261
+#define TK_RANGE 262
+#define TK_EVERY 263
+#define TK_ORDER 264
+#define TK_SLIMIT 265
+#define TK_SOFFSET 266
+#define TK_LIMIT 267
+#define TK_OFFSET 268
+#define TK_ASC 269
+#define TK_NULLS 270
+#define TK_ABORT 271
+#define TK_AFTER 272
+#define TK_ATTACH 273
+#define TK_BEFORE 274
+#define TK_BEGIN 275
+#define TK_BITAND 276
+#define TK_BITNOT 277
+#define TK_BITOR 278
+#define TK_BLOCKS 279
+#define TK_CHANGE 280
+#define TK_COMMA 281
+#define TK_COMPACT 282
+#define TK_CONCAT 283
+#define TK_CONFLICT 284
+#define TK_COPY 285
+#define TK_DEFERRED 286
+#define TK_DELIMITERS 287
+#define TK_DETACH 288
+#define TK_DIVIDE 289
+#define TK_DOT 290
+#define TK_EACH 291
+#define TK_FAIL 292
+#define TK_FILE 293
+#define TK_FOR 294
+#define TK_GLOB 295
+#define TK_ID 296
+#define TK_IMMEDIATE 297
+#define TK_IMPORT 298
+#define TK_INITIALLY 299
+#define TK_INSTEAD 300
+#define TK_ISNULL 301
+#define TK_KEY 302
+#define TK_MODULES 303
+#define TK_NK_BITNOT 304
+#define TK_NK_SEMI 305
+#define TK_NOTNULL 306
+#define TK_OF 307
+#define TK_PLUS 308
+#define TK_PRIVILEGE 309
+#define TK_RAISE 310
+#define TK_REPLACE 311
+#define TK_RESTRICT 312
+#define TK_ROW 313
+#define TK_SEMI 314
+#define TK_STAR 315
+#define TK_STATEMENT 316
+#define TK_STRICT 317
+#define TK_STRING 318
+#define TK_TIMES 319
+#define TK_VALUES 320
+#define TK_VARIABLE 321
+#define TK_VIEW 322
+#define TK_WAL 323
#define TK_NK_SPACE 600
#define TK_NK_COMMENT 601
diff --git a/include/libs/function/function.h b/include/libs/function/function.h
index 32db6773e07ce61ad1ef100713b3bb696a36f09d..c44ad12759aa636260a46befaeaa43ce0ed13872 100644
--- a/include/libs/function/function.h
+++ b/include/libs/function/function.h
@@ -132,14 +132,16 @@ typedef struct SqlFunctionCtx {
SInputColumnInfoData input;
SResultDataInfo resDataInfo;
uint32_t order; // data block scanner order: asc|desc
+ uint8_t isPseudoFunc;// denote current function is pseudo function or not [added for perf reason]
+ uint8_t isNotNullFunc;// not return null value.
uint8_t scanFlag; // record current running step, default: 0
int16_t functionId; // function id
char *pOutput; // final result output buffer, point to sdata->data
- int32_t numOfParams;
// input parameter, e.g., top(k, 20), the number of results of top query is kept in param
SFunctParam *param;
// corresponding output buffer for timestamp of each result, e.g., diff/csum
SColumnInfoData *pTsOutput;
+ int32_t numOfParams;
int32_t offset;
SResultRowEntryInfo *resultInfo;
SSubsidiaryResInfo subsidiaries;
@@ -152,7 +154,7 @@ typedef struct SqlFunctionCtx {
struct SSDataBlock *pDstBlock; // used by indefinite rows function to set selectivity
SSerializeDataHandle saveHandle;
int32_t exprIdx;
- char udfName[TSDB_FUNC_NAME_LEN];
+ char *udfName;
} SqlFunctionCtx;
typedef struct tExprNode {
diff --git a/include/libs/function/functionMgt.h b/include/libs/function/functionMgt.h
index 9ca6a7a9fafe464f1f82682b9e3599d15b6dff79..411c7d5e8b22640f4fd67651b3de8f7a86bb171e 100644
--- a/include/libs/function/functionMgt.h
+++ b/include/libs/function/functionMgt.h
@@ -218,6 +218,7 @@ bool fmIsKeepOrderFunc(int32_t funcId);
bool fmIsCumulativeFunc(int32_t funcId);
bool fmIsInterpPseudoColumnFunc(int32_t funcId);
bool fmIsGroupKeyFunc(int32_t funcId);
+bool fmIsBlockDistFunc(int32_t funcId);
void getLastCacheDataType(SDataType* pType);
diff --git a/include/libs/nodes/cmdnodes.h b/include/libs/nodes/cmdnodes.h
index b1054e7b859c8ba9231ee1c942f12d7c1ec6b97c..de2780691291fb2028e8f8a684f71195140a7d26 100644
--- a/include/libs/nodes/cmdnodes.h
+++ b/include/libs/nodes/cmdnodes.h
@@ -389,6 +389,7 @@ typedef struct SStreamOptions {
SNode* pDeleteMark;
int8_t fillHistory;
int8_t ignoreExpired;
+ int8_t ignoreUpdate;
} SStreamOptions;
typedef struct SCreateStreamStmt {
diff --git a/include/libs/nodes/plannodes.h b/include/libs/nodes/plannodes.h
index d8856651174662b6de6fbf3c05543200a00033a1..80fa0d3e78211464b4a327a32c8c374ba66c4953 100644
--- a/include/libs/nodes/plannodes.h
+++ b/include/libs/nodes/plannodes.h
@@ -93,6 +93,7 @@ typedef struct SScanLogicNode {
int64_t watermark;
int64_t deleteMark;
int8_t igExpired;
+ int8_t igCheckUpdate;
SArray* pSmaIndexes;
SNodeList* pGroupTags;
bool groupSort;
@@ -217,6 +218,7 @@ typedef struct SWindowLogicNode {
int64_t watermark;
int64_t deleteMark;
int8_t igExpired;
+ int8_t igCheckUpdate;
EWindowAlgorithm windowAlgo;
EOrder inputTsOrder;
EOrder outputTsOrder;
@@ -357,6 +359,7 @@ typedef struct STableScanPhysiNode {
int64_t watermark;
int8_t igExpired;
bool assignBlockUid;
+ int8_t igCheckUpdate;
} STableScanPhysiNode;
typedef STableScanPhysiNode STableSeqScanPhysiNode;
diff --git a/include/libs/nodes/querynodes.h b/include/libs/nodes/querynodes.h
index 48b98fcf3373ad6afec153bfd8845e171c42600d..e291051351b433e92ee0271166a581f08fb4abfe 100644
--- a/include/libs/nodes/querynodes.h
+++ b/include/libs/nodes/querynodes.h
@@ -226,8 +226,10 @@ typedef struct SIntervalWindowNode {
typedef enum EFillMode {
FILL_MODE_NONE = 1,
FILL_MODE_VALUE,
+ FILL_MODE_VALUE_F,
FILL_MODE_PREV,
FILL_MODE_NULL,
+ FILL_MODE_NULL_F,
FILL_MODE_LINEAR,
FILL_MODE_NEXT
} EFillMode;
diff --git a/include/libs/planner/planner.h b/include/libs/planner/planner.h
index f7bd68393e67b6c5a92587bc3fad56a20891b4fd..41c0e98084a95f34d3ef6fffb094d47c6a9976dc 100644
--- a/include/libs/planner/planner.h
+++ b/include/libs/planner/planner.h
@@ -36,6 +36,7 @@ typedef struct SPlanContext {
int64_t watermark;
int64_t deleteMark;
int8_t igExpired;
+ int8_t igCheckUpdate;
char* pMsg;
int32_t msgLen;
const char* pUser;
diff --git a/include/libs/stream/streamState.h b/include/libs/stream/streamState.h
index 8fdac0da7fe3758a7ba335ee11c0709f2cf56e83..912c09a0fb53f1c9075adaa2a57a1f5c72361965 100644
--- a/include/libs/stream/streamState.h
+++ b/include/libs/stream/streamState.h
@@ -110,6 +110,7 @@ int32_t streamStateGetParName(SStreamState* pState, int64_t groupId, void** pVal
#if 0
char* streamStateSessionDump(SStreamState* pState);
+char* streamStateIntervalDump(SStreamState* pState);
#endif
#ifdef __cplusplus
diff --git a/include/libs/stream/tstream.h b/include/libs/stream/tstream.h
index c5352eee468bfd41af16c6e93707b525203677e2..ac09d5dfde555629ee819bba690e5ea7c25f9f9d 100644
--- a/include/libs/stream/tstream.h
+++ b/include/libs/stream/tstream.h
@@ -616,6 +616,7 @@ typedef struct SStreamMeta {
SStreamMeta* streamMetaOpen(const char* path, void* ahandle, FTaskExpand expandFunc, int32_t vgId);
void streamMetaClose(SStreamMeta* streamMeta);
+int32_t streamMetaSaveTask(SStreamMeta* pMeta, SStreamTask* pTask);
int32_t streamMetaAddTask(SStreamMeta* pMeta, int64_t ver, SStreamTask* pTask);
int32_t streamMetaAddSerializedTask(SStreamMeta* pMeta, int64_t startVer, char* msg, int32_t msgLen);
SStreamTask* streamMetaGetTask(SStreamMeta* pMeta, int32_t taskId);
@@ -627,7 +628,7 @@ void streamMetaRemoveTask(SStreamMeta* pMeta, int32_t taskId);
int32_t streamMetaBegin(SStreamMeta* pMeta);
int32_t streamMetaCommit(SStreamMeta* pMeta);
int32_t streamMetaRollBack(SStreamMeta* pMeta);
-int32_t streamLoadTasks(SStreamMeta* pMeta);
+int32_t streamLoadTasks(SStreamMeta* pMeta, int64_t ver);
// checkpoint
int32_t streamProcessCheckpointSourceReq(SStreamMeta* pMeta, SStreamTask* pTask, SStreamCheckpointSourceReq* pReq);
diff --git a/include/libs/sync/sync.h b/include/libs/sync/sync.h
index defafce30eb14e8c2cf6aaa4408199340a9d2adf..5e37da4f3f57a57c8ebab0fb7537786ea6a642b9 100644
--- a/include/libs/sync/sync.h
+++ b/include/libs/sync/sync.h
@@ -36,7 +36,7 @@ extern "C" {
#define SYNC_DEL_WAL_MS (1000 * 60)
#define SYNC_ADD_QUORUM_COUNT 3
#define SYNC_MNODE_LOG_RETENTION 10000
-#define SYNC_VNODE_LOG_RETENTION 20
+#define SYNC_VNODE_LOG_RETENTION (TSDB_SYNC_LOG_BUFFER_RETENTION + 1)
#define SNAPSHOT_MAX_CLOCK_SKEW_MS 1000 * 10
#define SNAPSHOT_WAIT_MS 1000 * 30
diff --git a/include/libs/transport/trpc.h b/include/libs/transport/trpc.h
index de3c2a9f52f7f7743ae58f57c0bc53d1cc0d2991..0cc0ab64eff68ff00e25213eb8ed57ba04916988 100644
--- a/include/libs/transport/trpc.h
+++ b/include/libs/transport/trpc.h
@@ -112,7 +112,12 @@ typedef struct SRpcInit {
// fail fast fp
RpcFFfp ffp;
- void *parent;
+ int32_t connLimitNum;
+ int32_t connLimitLock;
+
+ int8_t supportBatch; // 0: no batch, 1. batch
+ int32_t batchSize;
+ void *parent;
} SRpcInit;
typedef struct {
diff --git a/include/libs/wal/wal.h b/include/libs/wal/wal.h
index a0f421212a56603402c61c9bb2763a3d1e7cee1c..1eed342f8ca496006fc5fa00150cad4cc5dea9a6 100644
--- a/include/libs/wal/wal.h
+++ b/include/libs/wal/wal.h
@@ -191,6 +191,7 @@ int32_t walApplyVer(SWal *, int64_t ver);
// read
SWalReader *walOpenReader(SWal *, SWalFilterCond *pCond);
void walCloseReader(SWalReader *pRead);
+void walReadReset(SWalReader *pReader);
int32_t walReadVer(SWalReader *pRead, int64_t ver);
int32_t walReadSeekVer(SWalReader *pRead, int64_t ver);
int32_t walNextValidMsg(SWalReader *pRead);
diff --git a/include/os/osEnv.h b/include/os/osEnv.h
index 533d989ffc40c2aae35adc02bde6080da52ac219..bc65da47a9d106c67064bdb07f85ace7332952c9 100644
--- a/include/os/osEnv.h
+++ b/include/os/osEnv.h
@@ -41,6 +41,7 @@ extern char tsSSE42Enable;
extern char tsAVXEnable;
extern char tsAVX2Enable;
extern char tsFMAEnable;
+extern char tsTagFilterCache;
extern char configDir[];
extern char tsDataDir[];
diff --git a/include/os/osFile.h b/include/os/osFile.h
index ae77e0f27a26adf679f72be92c235e61b6ed0655..0e930027066dbd3f5a0e90810a8a3f5c134637b6 100644
--- a/include/os/osFile.h
+++ b/include/os/osFile.h
@@ -110,6 +110,8 @@ bool taosValidFile(TdFilePtr pFile);
int32_t taosGetErrorFile(TdFilePtr pFile);
+int32_t taosCompressFile(char *srcFileName, char *destFileName);
+
#ifdef __cplusplus
}
#endif
diff --git a/include/util/taoserror.h b/include/util/taoserror.h
index 51f336c3aa174c0dfd311826d5bd340c319a6b8d..75bdf81a2750f2fc6c8a9fad42c568299197b666 100644
--- a/include/util/taoserror.h
+++ b/include/util/taoserror.h
@@ -67,6 +67,10 @@ int32_t* taosGetErrno();
#define TSDB_CODE_RPC_TIMEOUT TAOS_DEF_ERROR_CODE(0, 0x0019) //
#define TSDB_CODE_RPC_SOMENODE_NOT_CONNECTED TAOS_DEF_ERROR_CODE(0, 0x0020) // "Vgroup could not be connected"
#define TSDB_CODE_RPC_SOMENODE_BROKEN_LINK TAOS_DEF_ERROR_CODE(0, 0x0021) //
+#define TSDB_CODE_RPC_MAX_SESSIONS TAOS_DEF_ERROR_CODE(0, 0x0022) //
+
+
+
//common & util
#define TSDB_CODE_OPS_NOT_SUPPORT TAOS_DEF_ERROR_CODE(0, 0x0100) //
@@ -111,6 +115,7 @@ int32_t* taosGetErrno();
#define TSDB_CODE_NOT_FOUND TAOS_DEF_ERROR_CODE(0, 0x012A)
#define TSDB_CODE_NO_DISKSPACE TAOS_DEF_ERROR_CODE(0, 0x012B)
#define TSDB_CODE_TIMEOUT_ERROR TAOS_DEF_ERROR_CODE(0, 0x012C)
+#define TSDB_CODE_MSG_ENCODE_ERROR TAOS_DEF_ERROR_CODE(0, 0x012D)
#define TSDB_CODE_APP_IS_STARTING TAOS_DEF_ERROR_CODE(0, 0x0130) //
#define TSDB_CODE_APP_IS_STOPPING TAOS_DEF_ERROR_CODE(0, 0x0131) //
@@ -355,6 +360,7 @@ int32_t* taosGetErrno();
#define TSDB_CODE_MND_STREAM_MUST_BE_DELETED TAOS_DEF_ERROR_CODE(0, 0x03F3)
#define TSDB_CODE_MND_STREAM_TASK_DROPPED TAOS_DEF_ERROR_CODE(0, 0x03F4)
#define TSDB_CODE_MND_MULTI_REPLICA_SOURCE_DB TAOS_DEF_ERROR_CODE(0, 0x03F5)
+#define TSDB_CODE_MND_TOO_MANY_STREAMS TAOS_DEF_ERROR_CODE(0, 0x03F6)
// mnode-sma
#define TSDB_CODE_MND_SMA_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x0480)
diff --git a/include/util/tarray.h b/include/util/tarray.h
index 0e78397ecb7c35d75211e06170ea5cdb99030e34..af9cf5fde1a4b17bcc628854f97011e2a1b893c7 100644
--- a/include/util/tarray.h
+++ b/include/util/tarray.h
@@ -53,6 +53,7 @@ typedef struct SArray {
* @return
*/
SArray* taosArrayInit(size_t size, size_t elemSize);
+SArray* taosArrayInit_s(size_t size, size_t elemSize, size_t initialSize);
/**
*
@@ -149,14 +150,6 @@ void* taosArrayGetLast(const SArray* pArray);
*/
size_t taosArrayGetSize(const SArray* pArray);
-/**
- * set the size of array
- * @param pArray
- * @param size size of the array
- * @return
- */
-void taosArraySetSize(SArray* pArray, size_t size);
-
/**
* insert data into array
* @param pArray
diff --git a/include/util/tdef.h b/include/util/tdef.h
index 3a152a36a15c06941e2aa9e0931ff055028587b1..aeb8d08936d4de875fc2c5754d562dc57cb5333c 100644
--- a/include/util/tdef.h
+++ b/include/util/tdef.h
@@ -281,8 +281,9 @@ typedef enum ELogicConditionType {
#define TSDB_DNODE_ROLE_MGMT 1
#define TSDB_DNODE_ROLE_VNODE 2
-#define TSDB_MAX_REPLICA 5
-#define TSDB_SYNC_LOG_BUFFER_SIZE 4096
+#define TSDB_MAX_REPLICA 5
+#define TSDB_SYNC_LOG_BUFFER_SIZE 4096
+#define TSDB_SYNC_LOG_BUFFER_RETENTION (TSDB_SYNC_LOG_BUFFER_SIZE >> 4)
#define TSDB_TBNAME_COLUMN_INDEX (-1)
#define TSDB_MULTI_TABLEMETA_MAX_NUM 100000 // maximum batch size allowed to load table meta
@@ -412,7 +413,7 @@ typedef enum ELogicConditionType {
#ifdef WINDOWS
#define TSDB_MAX_RPC_THREADS 4 // windows pipe only support 4 connections.
#else
-#define TSDB_MAX_RPC_THREADS 20
+#define TSDB_MAX_RPC_THREADS 10
#endif
#define TSDB_QUERY_TYPE_NON_TYPE 0x00u // none type
diff --git a/include/util/tlog.h b/include/util/tlog.h
index 808377fa772893c7e25ce9c03c749b81fef49092..4311719ca575e2ccc69d3281d8f49d1e006d24aa 100644
--- a/include/util/tlog.h
+++ b/include/util/tlog.h
@@ -89,7 +89,7 @@ bool taosAssertRelease(bool condition);
// Disable all asserts that may compromise the performance.
#if defined DISABLE_ASSERT
#define ASSERT(condition)
-#define ASSERTS(condition, ...)
+#define ASSERTS(condition, ...) (0)
#else
#define ASSERTS(condition, ...) taosAssertDebug(condition, __FILE__, __LINE__, __VA_ARGS__)
#ifdef NDEBUG
diff --git a/source/libs/executor/inc/tsimplehash.h b/include/util/tsimplehash.h
similarity index 98%
rename from source/libs/executor/inc/tsimplehash.h
rename to include/util/tsimplehash.h
index 7344c3426133758aac51d94e4678bc9367163580..c9df9114763549da1b88c551f9efcc421e0e5c14 100644
--- a/source/libs/executor/inc/tsimplehash.h
+++ b/include/util/tsimplehash.h
@@ -116,6 +116,7 @@ typedef struct SHNode {
struct SHNode *next;
uint32_t keyLen : 20;
uint32_t dataLen : 12;
+ uint32_t hashVal;
char data[];
} SHNode;
#pragma pack(pop)
diff --git a/include/util/ttrace.h b/include/util/ttrace.h
index 579768228a6086fda8656b0dca1430e7da06f9a6..5cdb1eecaaa249f27bccd108072e803f771d2517 100644
--- a/include/util/ttrace.h
+++ b/include/util/ttrace.h
@@ -45,11 +45,25 @@ typedef struct STraceId {
#define TRACE_GET_MSGID(traceId) (traceId)->msgId
-#define TRACE_TO_STR(traceId, buf) \
- do { \
- int64_t rootId = (traceId) != NULL ? (traceId)->rootId : 0; \
- int64_t msgId = (traceId) != NULL ? (traceId)->msgId : 0; \
- sprintf(buf, "0x%" PRIx64 ":0x%" PRIx64 "", rootId, msgId); \
+//#define TRACE_TO_STR(traceId, buf) \
+// do { \
+// int64_t rootId = (traceId) != NULL ? (traceId)->rootId : 0; \
+// int64_t msgId = (traceId) != NULL ? (traceId)->msgId : 0; \
+// sprintf(buf, "0x%" PRIx64 ":0x%" PRIx64 "", rootId, msgId); \
+// } while (0)
+
+#define TRACE_TO_STR(_traceId, _buf) \
+ do { \
+ int64_t rootId = (_traceId) != NULL ? (_traceId)->rootId : 0; \
+ int64_t msgId = (_traceId) != NULL ? (_traceId)->msgId : 0; \
+ char* _t = _buf; \
+ _t[0] = '0'; \
+ _t[1] = 'x'; \
+ _t += titoa(rootId, 16, &_t[2]); \
+ _t[0] = ':'; \
+ _t[1] = '0'; \
+ _t[2] = 'x'; \
+ _t += titoa(msgId, 16, &_t[3]); \
} while (0)
#ifdef __cplusplus
diff --git a/include/util/tutil.h b/include/util/tutil.h
index 9fb68aebdc2943b37cb082f758deca40a8feab6b..e0801e529507bd3152037e646895f66c6eefa35c 100644
--- a/include/util/tutil.h
+++ b/include/util/tutil.h
@@ -46,6 +46,9 @@ char *paGetToken(char *src, char **token, int32_t *tokenLen);
int32_t taosByteArrayToHexStr(char bytes[], int32_t len, char hexstr[]);
int32_t taosHexStrToByteArray(char hexstr[], char bytes[]);
+int32_t tintToHex(uint64_t val, char hex[]);
+int32_t titoa(uint64_t val, size_t radix, char str[]);
+
char *taosIpStr(uint32_t ipInt);
uint32_t ip2uint(const char *const ip_addr);
void taosIp2String(uint32_t ip, char *str);
diff --git a/include/util/tworker.h b/include/util/tworker.h
index 0636f16dbbd50b709de18ce556d8a9dcbdcfba8d..8508adf052bf8eb368dd9846d0a5e1ada1bb6e6e 100644
--- a/include/util/tworker.h
+++ b/include/util/tworker.h
@@ -26,12 +26,12 @@ extern "C" {
typedef struct SQWorkerPool SQWorkerPool;
typedef struct SWWorkerPool SWWorkerPool;
-typedef struct SQWorker {
+typedef struct SQueueWorker {
int32_t id; // worker id
int64_t pid; // thread pid
TdThread thread; // thread id
void *pool;
-} SQWorker;
+} SQueueWorker;
typedef struct SQWorkerPool {
int32_t max; // max number of workers
@@ -39,7 +39,7 @@ typedef struct SQWorkerPool {
int32_t num; // current number of workers
STaosQset *qset;
const char *name;
- SQWorker *workers;
+ SQueueWorker *workers;
TdThreadMutex mutex;
} SQWorkerPool;
diff --git a/packaging/tools/make_install.bat b/packaging/tools/make_install.bat
index c19519f9a1fc4c014c01496ca32925ba1eb19516..993a8a19ee2862addc68304ff36359062846145b 100644
--- a/packaging/tools/make_install.bat
+++ b/packaging/tools/make_install.bat
@@ -2,12 +2,20 @@
for /F %%a in ('echo prompt $E ^| cmd') do set "ESC=%%a"
-goto %1
+if "%1" NEQ "" goto %1
+
:needAdmin
if exist C:\\TDengine\\data\\dnode\\dnodeCfg.json (
echo The default data directory C:/TDengine/data contains old data of tdengine 2.x, please clear it before installing!
)
+
+rem // stop and delete service
+mshta vbscript:createobject("shell.application").shellexecute("%~s0",":stop_delete","","runas",1)(window.close)
+echo This might take a few moment to accomplish deleting service taosd/taosadapter ...
+call :check_svc taosd
+call :check_svc taosadapter
+
set source_dir=%2
set source_dir=%source_dir:/=\\%
set binary_dir=%3
@@ -60,7 +68,6 @@ if exist %binary_dir%\\build\\bin\\taosdump.exe (
copy %binary_dir%\\build\\bin\\taosd.exe %target_dir% > nul
copy %binary_dir%\\build\\bin\\udfd.exe %target_dir% > nul
-
if exist %binary_dir%\\build\\bin\\taosadapter.exe (
copy %binary_dir%\\build\\bin\\taosadapter.exe %target_dir% > nul
)
@@ -80,22 +87,23 @@ goto :eof
:hasAdmin
-sc query "taosd" && sc stop taosd && sc delete taosd
-sc query "taosadapter" && sc stop taosadapter && sc delete taosd
+call :stop_delete
+call :check_svc taosd
+call :check_svc taosadapter
copy /y C:\\TDengine\\driver\\taos.dll C:\\Windows\\System32 > nul
if exist C:\\TDengine\\driver\\taosws.dll (
copy /y C:\\TDengine\\driver\\taosws.dll C:\\Windows\\System32 > nul
)
-sc query "taosd" >nul || sc create "taosd" binPath= "C:\\TDengine\\taosd.exe --win_service" start= DEMAND
-sc query "taosadapter" >nul || sc create "taosadapter" binPath= "C:\\TDengine\\taosadapter.exe" start= DEMAND
+rem // create services
+sc create "taosd" binPath= "C:\\TDengine\\taosd.exe --win_service" start= DEMAND
+sc create "taosadapter" binPath= "C:\\TDengine\\taosadapter.exe" start= DEMAND
set "env=HKLM\System\CurrentControlSet\Control\Session Manager\Environment"
for /f "tokens=2*" %%I in ('reg query "%env%" /v Path ^| findstr /i "\"') do (
- rem // make addition persistent through reboots
- reg add "%env%" /f /v Path /t REG_EXPAND_SZ /d "%%J;C:\TDengine"
+ call :append_if_not_exists %%J
rem // apply change to the current process
for %%a in ("%%J;C:\TDengine") do path %%~a
@@ -105,3 +113,36 @@ rem // use setx to set a temporary throwaway value to trigger a WM_SETTINGCHANGE
rem // applies change to new console windows without requiring a reboot
(setx /m foo bar & reg delete "%env%" /f /v foo) >NUL 2>NUL
+goto :end
+
+:append_if_not_exists
+set "_origin_paths=%*"
+set "_paths=%*"
+set "_found=0"
+:loop
+for /f "tokens=1* delims=;" %%x in ("%_paths%") do (
+ if "%%x" EQU "C:\TDengine" (
+ set "_found=1"
+ ) else (
+ set "_paths=%%y"
+ goto :loop
+ )
+)
+if "%_found%" == "0" (
+ rem // make addition persistent through reboots
+ reg add "%env%" /f /v Path /t REG_EXPAND_SZ /d "%_origin_paths%;C:\TDengine"
+)
+exit /B 0
+
+:stop_delete
+sc stop taosd
+sc delete taosd
+sc stop taosadapter
+sc delete taosadapter
+exit /B 0
+
+:check_svc
+sc query %1 >nul 2>nul && goto :check_svc %1
+exit /B 0
+
+:end
diff --git a/packaging/tools/make_install.sh b/packaging/tools/make_install.sh
index 9034fd85f5cee9841ebdbe8907e7256c87b6601f..aae3c3b593ba9281929f793145b4598b15f46c95 100755
--- a/packaging/tools/make_install.sh
+++ b/packaging/tools/make_install.sh
@@ -531,13 +531,13 @@ function install_taosadapter_service() {
}
function install_service_on_launchctl() {
- ${csudouser}launchctl unload -w /Library/LaunchDaemons/com.taosdata.taosd.plist > /dev/null 2>&1 || :
+ ${csudo}launchctl unload -w /Library/LaunchDaemons/com.taosdata.taosd.plist > /dev/null 2>&1 || :
${csudo}cp ${script_dir}/com.taosdata.taosd.plist /Library/LaunchDaemons/com.taosdata.taosd.plist
- ${csudouser}launchctl load -w /Library/LaunchDaemons/com.taosdata.taosd.plist > /dev/null 2>&1 || :
+ ${csudo}launchctl load -w /Library/LaunchDaemons/com.taosdata.taosd.plist > /dev/null 2>&1 || :
- ${csudouser}launchctl unload -w /Library/LaunchDaemons/com.taosdata.taosadapter.plist > /dev/null 2>&1 || :
+ ${csudo}launchctl unload -w /Library/LaunchDaemons/com.taosdata.taosadapter.plist > /dev/null 2>&1 || :
${csudo}cp ${script_dir}/com.taosdata.taosadapter.plist /Library/LaunchDaemons/com.taosdata.taosadapter.plist
- ${csudouser}launchctl load -w /Library/LaunchDaemons/com.taosdata.taosadapter.plist > /dev/null 2>&1 || :
+ ${csudo}launchctl load -w /Library/LaunchDaemons/com.taosdata.taosadapter.plist > /dev/null 2>&1 || :
}
function install_service() {
diff --git a/packaging/tools/post.sh b/packaging/tools/post.sh
index 482345dcd819dce683d3aa68438e6fa9fd5a4a9f..4441e0ba1f54e61ab4a276eed33a7001c0845a22 100755
--- a/packaging/tools/post.sh
+++ b/packaging/tools/post.sh
@@ -512,14 +512,14 @@ function install_service_on_systemd() {
function install_service_on_launchctl() {
if [ -f ${install_main_dir}/service/com.taosdata.taosd.plist ]; then
- ${csudouser}launchctl unload -w /Library/LaunchDaemons/com.taosdata.taosd.plist > /dev/null 2>&1 || :
+ ${csudo}launchctl unload -w /Library/LaunchDaemons/com.taosdata.taosd.plist > /dev/null 2>&1 || :
${csudo}cp ${install_main_dir}/service/com.taosdata.taosd.plist /Library/LaunchDaemons/com.taosdata.taosd.plist || :
- ${csudouser}launchctl load -w /Library/LaunchDaemons/com.taosdata.taosd.plist || :
+ ${csudo}launchctl load -w /Library/LaunchDaemons/com.taosdata.taosd.plist || :
fi
if [ -f ${install_main_dir}/service/com.taosdata.taosadapter.plist ]; then
- ${csudouser}launchctl unload -w /Library/LaunchDaemons/com.taosdata.taosadapter.plist > /dev/null 2>&1 || :
+ ${csudo}launchctl unload -w /Library/LaunchDaemons/com.taosdata.taosadapter.plist > /dev/null 2>&1 || :
${csudo}cp ${install_main_dir}/service/com.taosdata.taosadapter.plist /Library/LaunchDaemons/com.taosdata.taosadapter.plist || :
- ${csudouser}launchctl load -w /Library/LaunchDaemons/com.taosdata.taosadapter.plist || :
+ ${csudo}launchctl load -w /Library/LaunchDaemons/com.taosdata.taosadapter.plist || :
fi
}
diff --git a/source/client/CMakeLists.txt b/source/client/CMakeLists.txt
index 0c445c7fbfa01b6432259bd20e7e481966aee7a7..d0cfd38fb97789543357396590afc30dc3f8ef9a 100644
--- a/source/client/CMakeLists.txt
+++ b/source/client/CMakeLists.txt
@@ -62,4 +62,4 @@ target_link_libraries(
if(${BUILD_TEST})
ADD_SUBDIRECTORY(test)
-endif(${BUILD_TEST})
\ No newline at end of file
+endif(${BUILD_TEST})
diff --git a/source/client/inc/clientInt.h b/source/client/inc/clientInt.h
index 903a6a22cac05c7c921ed6287ae38b2498b064fe..fb011ce3e4ae3ac3eeef3709fa397e2065e536a1 100644
--- a/source/client/inc/clientInt.h
+++ b/source/client/inc/clientInt.h
@@ -97,16 +97,14 @@ typedef struct {
typedef struct SQueryExecMetric {
int64_t start; // start timestamp, us
- int64_t syntaxStart; // start to parse, us
- int64_t syntaxEnd; // end to parse, us
int64_t ctgStart; // start to parse, us
- int64_t ctgEnd; // end to parse, us
- int64_t semanticEnd;
- int64_t planEnd;
- int64_t resultReady;
- int64_t execEnd;
- int64_t send; // start to send to server, us
- int64_t rsp; // receive response from server, us
+ int64_t execStart; // start to parse, us
+
+ int64_t parseCostUs;
+ int64_t ctgCostUs;
+ int64_t analyseCostUs;
+ int64_t planCostUs;
+ int64_t execCostUs;
} SQueryExecMetric;
struct SAppInstInfo {
diff --git a/source/client/src/clientEnv.c b/source/client/src/clientEnv.c
index 593a8fd20a88591255a3b0a5aba4507f91a56569..06ef7b7c9c702c3b3517efbfbf026a970305ea36 100644
--- a/source/client/src/clientEnv.c
+++ b/source/client/src/clientEnv.c
@@ -79,22 +79,21 @@ static void deregisterRequest(SRequestObj *pRequest) {
"current:%d, app current:%d",
pRequest->self, pTscObj->id, pRequest->requestId, duration / 1000.0, num, currentInst);
- if (QUERY_NODE_VNODE_MODIF_STMT == pRequest->stmtType) {
- // tscPerf("insert duration %" PRId64 "us: syntax:%" PRId64 "us, ctg:%" PRId64 "us, semantic:%" PRId64
- // "us, exec:%" PRId64 "us",
- // duration, pRequest->metric.syntaxEnd - pRequest->metric.syntaxStart,
- // pRequest->metric.ctgEnd - pRequest->metric.ctgStart, pRequest->metric.semanticEnd -
- // pRequest->metric.ctgEnd, pRequest->metric.execEnd - pRequest->metric.semanticEnd);
- atomic_add_fetch_64((int64_t *)&pActivity->insertElapsedTime, duration);
- } else if (QUERY_NODE_SELECT_STMT == pRequest->stmtType) {
- // tscPerf("select duration %" PRId64 "us: syntax:%" PRId64 "us, ctg:%" PRId64 "us, semantic:%" PRId64
- // "us, planner:%" PRId64 "us, exec:%" PRId64 "us, reqId:0x%" PRIx64,
- // duration, pRequest->metric.syntaxEnd - pRequest->metric.syntaxStart,
- // pRequest->metric.ctgEnd - pRequest->metric.ctgStart, pRequest->metric.semanticEnd -
- // pRequest->metric.ctgEnd, pRequest->metric.planEnd - pRequest->metric.semanticEnd,
- // pRequest->metric.resultReady - pRequest->metric.planEnd, pRequest->requestId);
-
- atomic_add_fetch_64((int64_t *)&pActivity->queryElapsedTime, duration);
+ if (pRequest->pQuery && pRequest->pQuery->pRoot) {
+ if (QUERY_NODE_VNODE_MODIF_STMT == pRequest->pQuery->pRoot->type && (0 == ((SVnodeModifOpStmt*)pRequest->pQuery->pRoot)->sqlNodeType)) {
+ tscDebug("insert duration %" PRId64 "us: parseCost:%" PRId64 "us, ctgCost:%" PRId64 "us, analyseCost:%" PRId64
+ "us, planCost:%" PRId64 "us, exec:%" PRId64 "us",
+ duration, pRequest->metric.parseCostUs, pRequest->metric.ctgCostUs, pRequest->metric.analyseCostUs,
+ pRequest->metric.planCostUs, pRequest->metric.execCostUs);
+ atomic_add_fetch_64((int64_t *)&pActivity->insertElapsedTime, duration);
+ } else if (QUERY_NODE_SELECT_STMT == pRequest->stmtType) {
+ tscDebug("query duration %" PRId64 "us: parseCost:%" PRId64 "us, ctgCost:%" PRId64 "us, analyseCost:%" PRId64
+ "us, planCost:%" PRId64 "us, exec:%" PRId64 "us",
+ duration, pRequest->metric.parseCostUs, pRequest->metric.ctgCostUs, pRequest->metric.analyseCostUs,
+ pRequest->metric.planCostUs, pRequest->metric.execCostUs);
+
+ atomic_add_fetch_64((int64_t *)&pActivity->queryElapsedTime, duration);
+ }
}
if (duration >= SLOW_QUERY_INTERVAL) {
@@ -362,8 +361,6 @@ void doDestroyRequest(void *p) {
taosArrayDestroy(pRequest->tableList);
taosArrayDestroy(pRequest->dbList);
taosArrayDestroy(pRequest->targetTableList);
- qDestroyQuery(pRequest->pQuery);
- nodesDestroyAllocator(pRequest->allocatorRefId);
destroyQueryExecRes(&pRequest->body.resInfo.execRes);
@@ -378,6 +375,9 @@ void doDestroyRequest(void *p) {
taosMemoryFree(pRequest->body.param);
}
+ qDestroyQuery(pRequest->pQuery);
+ nodesDestroyAllocator(pRequest->allocatorRefId);
+
taosMemoryFreeClear(pRequest->sqlstr);
taosMemoryFree(pRequest);
tscTrace("end to destroy request %" PRIx64 " p:%p", reqId, pRequest);
diff --git a/source/client/src/clientHb.c b/source/client/src/clientHb.c
index 47ed2cf035a13314b81f2208718d2c466efb5c68..b01a8717027a06481168759200a89a4adea7fc0a 100644
--- a/source/client/src/clientHb.c
+++ b/source/client/src/clientHb.c
@@ -347,7 +347,7 @@ int32_t hbBuildQueryDesc(SQueryHbReqBasic *hbBasic, STscObj *pObj) {
continue;
}
- if (pRequest->killed) {
+ if (pRequest->killed || 0 == pRequest->body.queryJob) {
releaseRequest(*rid);
pIter = taosHashIterate(pObj->pRequests, pIter);
continue;
diff --git a/source/client/src/clientImpl.c b/source/client/src/clientImpl.c
index b5b99e92b07b155ab69a6d41f3d793ed697dab7f..079edcd6671bfc1afabd2aaabe1f6c03c48dbff7 100644
--- a/source/client/src/clientImpl.c
+++ b/source/client/src/clientImpl.c
@@ -138,6 +138,12 @@ STscObj* taos_connect_internal(const char* ip, const char* user, const char* pas
p->mgmtEp = epSet;
taosThreadMutexInit(&p->qnodeMutex, NULL);
p->pTransporter = openTransporter(user, secretEncrypt, tsNumOfCores / 2);
+ if (p->pTransporter == NULL) {
+ taosThreadMutexUnlock(&appInfo.mutex);
+ taosMemoryFreeClear(key);
+ taosMemoryFree(p);
+ return NULL;
+ }
p->pAppHbMgr = appHbMgrInit(p, key);
if (NULL == p->pAppHbMgr) {
destroyAppInst(p);
@@ -940,7 +946,7 @@ void schedulerExecCb(SExecResult* pResult, void* param, int32_t code) {
removeMeta(pTscObj, pRequest->targetTableList);
}
- pRequest->metric.execEnd = taosGetTimestampUs();
+ pRequest->metric.execCostUs = taosGetTimestampUs() - pRequest->metric.execStart;
int32_t code1 = handleQueryExecRsp(pRequest);
if (pRequest->code == TSDB_CODE_SUCCESS && pRequest->code != code1) {
pRequest->code = code1;
@@ -1066,11 +1072,10 @@ static int32_t asyncExecSchQuery(SRequestObj* pRequest, SQuery* pQuery, SMetaDat
pRequest->body.subplanNum = pDag->numOfSubplans;
}
- pRequest->metric.planEnd = taosGetTimestampUs();
- if (code == TSDB_CODE_SUCCESS) {
- tscDebug("0x%" PRIx64 " create query plan success, elapsed time:%.2f ms, 0x%" PRIx64, pRequest->self,
- (pRequest->metric.planEnd - st) / 1000.0, pRequest->requestId);
- }
+ pRequest->metric.execStart = taosGetTimestampUs();
+
+ pRequest->metric.planCostUs = pRequest->metric.execStart - st;
+
if (TSDB_CODE_SUCCESS == code && !pRequest->validateOnly) {
SArray* pNodeList = NULL;
if (QUERY_NODE_VNODE_MODIF_STMT != nodeType(pQuery->pRoot)) {
@@ -1118,6 +1123,16 @@ void launchAsyncQuery(SRequestObj* pRequest, SQuery* pQuery, SMetaData* pResultM
destorySqlCallbackWrapper(pWrapper);
}
+ if (pQuery->pRoot && !pRequest->inRetry) {
+ STscObj* pTscObj = pRequest->pTscObj;
+ SAppClusterSummary* pActivity = &pTscObj->pAppInfo->summary;
+ if (QUERY_NODE_VNODE_MODIF_STMT == pQuery->pRoot->type && (0 == ((SVnodeModifOpStmt*)pQuery->pRoot)->sqlNodeType)) {
+ atomic_add_fetch_64((int64_t*)&pActivity->numOfInsertsReq, 1);
+ } else if (QUERY_NODE_SELECT_STMT == pQuery->pRoot->type) {
+ atomic_add_fetch_64((int64_t*)&pActivity->numOfQueryReq, 1);
+ }
+ }
+
switch (pQuery->execMode) {
case QUERY_EXEC_MODE_LOCAL:
asyncExecLocalCmd(pRequest, pQuery);
@@ -1387,23 +1402,7 @@ int32_t doProcessMsgFromServer(void* param) {
SRequestObj* pRequest = (SRequestObj*)taosAcquireRef(clientReqRefPool, pSendInfo->requestObjRefId);
if (pRequest) {
assert(pRequest->self == pSendInfo->requestObjRefId);
-
- pRequest->metric.rsp = taosGetTimestampUs();
pTscObj = pRequest->pTscObj;
- /*
- * There is not response callback function for submit response.
- * The actual inserted number of points is the first number.
- */
- int32_t elapsed = pRequest->metric.rsp - pRequest->metric.start;
- if (pMsg->code == TSDB_CODE_SUCCESS) {
- tscDebug("0x%" PRIx64 " rsp msg:%s, code:%s rspLen:%d, elapsed:%d ms, reqId:0x%" PRIx64, pRequest->self,
- TMSG_INFO(pMsg->msgType), tstrerror(pMsg->code), pMsg->contLen, elapsed / 1000, pRequest->requestId);
- } else {
- tscError("0x%" PRIx64 " rsp msg:%s, code:%s rspLen:%d, elapsed time:%d ms, reqId:0x%" PRIx64, pRequest->self,
- TMSG_INFO(pMsg->msgType), tstrerror(pMsg->code), pMsg->contLen, elapsed / 1000, pRequest->requestId);
- }
-
- taosReleaseRef(clientReqRefPool, pSendInfo->requestObjRefId);
}
}
@@ -1423,6 +1422,11 @@ int32_t doProcessMsgFromServer(void* param) {
}
pSendInfo->fp(pSendInfo->param, &buf, pMsg->code);
+
+ if (pTscObj) {
+ taosReleaseRef(clientReqRefPool, pSendInfo->requestObjRefId);
+ }
+
rpcFreeCont(pMsg->pCont);
destroySendMsgInfo(pSendInfo);
@@ -1460,6 +1464,7 @@ void processMsgFromServer(void* parent, SRpcMsg* pMsg, SEpSet* pEpSet) {
tscError("failed to sched msg to tsc, tsc ready to quit");
rpcFreeCont(pMsg->pCont);
taosMemoryFree(arg->pEpset);
+ destroySendMsgInfo(pMsg->info.ahandle);
taosMemoryFree(arg);
}
}
diff --git a/source/client/src/clientMain.c b/source/client/src/clientMain.c
index e5f677637ecf039b98a9d4b214f669c5470b59df..53efff023db587cdf565b4a3dadc9acb54c03533 100644
--- a/source/client/src/clientMain.c
+++ b/source/client/src/clientMain.c
@@ -707,7 +707,8 @@ static void doAsyncQueryFromAnalyse(SMetaData *pResultMeta, void *param, int32_t
SRequestObj *pRequest = pWrapper->pRequest;
SQuery *pQuery = pRequest->pQuery;
- pRequest->metric.ctgEnd = taosGetTimestampUs();
+ int64_t analyseStart = taosGetTimestampUs();
+ pRequest->metric.ctgCostUs = analyseStart - pRequest->metric.ctgStart;
qDebug("0x%" PRIx64 " start to semantic analysis, reqId:0x%" PRIx64, pRequest->self, pRequest->requestId);
if (code == TSDB_CODE_SUCCESS) {
@@ -718,7 +719,7 @@ static void doAsyncQueryFromAnalyse(SMetaData *pResultMeta, void *param, int32_t
}
}
- pRequest->metric.semanticEnd = taosGetTimestampUs();
+ pRequest->metric.analyseCostUs = taosGetTimestampUs() - analyseStart;
if (code == TSDB_CODE_SUCCESS) {
if (pQuery->haveResultSet) {
@@ -730,10 +731,6 @@ static void doAsyncQueryFromAnalyse(SMetaData *pResultMeta, void *param, int32_t
TSWAP(pRequest->tableList, (pQuery)->pTableList);
TSWAP(pRequest->targetTableList, (pQuery)->pTargetTableList);
- double el = (pRequest->metric.semanticEnd - pRequest->metric.ctgEnd) / 1000.0;
- tscDebug("0x%" PRIx64 " analysis semantics completed, start async query, elapsed time:%.2f ms, reqId:0x%" PRIx64,
- pRequest->self, el, pRequest->requestId);
-
launchAsyncQuery(pRequest, pQuery, pResultMeta, pWrapper);
} else {
destorySqlCallbackWrapper(pWrapper);
@@ -798,7 +795,7 @@ static void doAsyncQueryFromParse(SMetaData *pResultMeta, void *param, int32_t c
SRequestObj *pRequest = pWrapper->pRequest;
SQuery *pQuery = pRequest->pQuery;
- pRequest->metric.ctgEnd = taosGetTimestampUs();
+ pRequest->metric.ctgCostUs += taosGetTimestampUs() - pRequest->metric.ctgStart;
qDebug("0x%" PRIx64 " start to continue parse, reqId:0x%" PRIx64 ", code:%s", pRequest->self, pRequest->requestId,
tstrerror(code));
@@ -910,7 +907,7 @@ void doAsyncQuery(SRequestObj *pRequest, bool updateMetaForce) {
}
if (TSDB_CODE_SUCCESS == code) {
- pRequest->metric.syntaxStart = taosGetTimestampUs();
+ int64_t syntaxStart = taosGetTimestampUs();
pWrapper->pCatalogReq = taosMemoryCalloc(1, sizeof(SCatalogReq));
if (pWrapper->pCatalogReq == NULL) {
@@ -921,19 +918,11 @@ void doAsyncQuery(SRequestObj *pRequest, bool updateMetaForce) {
code = qParseSqlSyntax(pWrapper->pParseCtx, &pRequest->pQuery, pWrapper->pCatalogReq);
}
- pRequest->metric.syntaxEnd = taosGetTimestampUs();
- }
-
- if (TSDB_CODE_SUCCESS == code && !updateMetaForce) {
- SAppClusterSummary *pActivity = &pTscObj->pAppInfo->summary;
- if (QUERY_NODE_INSERT_STMT == nodeType(pRequest->pQuery->pRoot)) {
- atomic_add_fetch_64((int64_t *)&pActivity->numOfInsertsReq, 1);
- } else if (QUERY_NODE_SELECT_STMT == nodeType(pRequest->pQuery->pRoot)) {
- atomic_add_fetch_64((int64_t *)&pActivity->numOfQueryReq, 1);
- }
+ pRequest->metric.parseCostUs += taosGetTimestampUs() - syntaxStart;
}
if (TSDB_CODE_SUCCESS == code) {
+ pRequest->stmtType = pRequest->pQuery->pRoot->type;
phaseAsyncQuery(pWrapper);
} else {
tscError("0x%" PRIx64 " error happens, code:%d - %s, reqId:0x%" PRIx64, pRequest->self, code, tstrerror(code),
@@ -960,7 +949,6 @@ static void fetchCallback(void *pResult, void *param, int32_t code) {
SRequestObj *pRequest = (SRequestObj *)param;
SReqResultInfo *pResultInfo = &pRequest->body.resInfo;
- pRequest->metric.resultReady = taosGetTimestampUs();
tscDebug("0x%" PRIx64 " enter scheduler fetch cb, code:%d - %s, reqId:0x%" PRIx64, pRequest->self, code,
tstrerror(code), pRequest->requestId);
diff --git a/source/client/src/clientRawBlockWrite.c b/source/client/src/clientRawBlockWrite.c
index 9a3838a6b42a492b4242d1077b54de71856c2b53..8c91eacf1eefcdbfffb9ce72a7dec80a86e92e3e 100644
--- a/source/client/src/clientRawBlockWrite.c
+++ b/source/client/src/clientRawBlockWrite.c
@@ -25,6 +25,10 @@
#include "tref.h"
#include "ttimer.h"
+static tb_uid_t processSuid(tb_uid_t suid, char* db){
+ return suid + MurmurHash3_32(db, strlen(db));
+}
+
static char* buildCreateTableJson(SSchemaWrapper* schemaRow, SSchemaWrapper* schemaTag, char* name, int64_t id,
int8_t t) {
char* string = NULL;
@@ -681,7 +685,7 @@ static int32_t taosCreateStb(TAOS* taos, void* meta, int32_t metaLen) {
pReq.numOfColumns = req.schemaRow.nCols;
pReq.numOfTags = req.schemaTag.nCols;
pReq.commentLen = -1;
- pReq.suid = req.suid;
+ pReq.suid = processSuid(req.suid, pRequest->pDb);
pReq.source = TD_REQ_FROM_TAOX;
pReq.igExists = true;
@@ -753,7 +757,7 @@ static int32_t taosDropStb(TAOS* taos, void* meta, int32_t metaLen) {
// build drop stable
pReq.igNotExists = true;
pReq.source = TD_REQ_FROM_TAOX;
- pReq.suid = req.suid;
+ pReq.suid = processSuid(req.suid, pRequest->pDb);
STscObj* pTscObj = pRequest->pTscObj;
SName tableName = {0};
@@ -871,6 +875,7 @@ static int32_t taosCreateTable(TAOS* taos, void* meta, int32_t metaLen) {
if (pCreateReq->type == TSDB_CHILD_TABLE) {
STableMeta* pTableMeta = NULL;
SName sName = {0};
+ pCreateReq->ctb.suid = processSuid(pCreateReq->ctb.suid, pRequest->pDb);
toName(pTscObj->acctId, pRequest->pDb, pCreateReq->ctb.stbName, &sName);
code = catalogGetTableMeta(pCatalog, &conn, &sName, &pTableMeta);
if (code != TSDB_CODE_SUCCESS) {
@@ -1008,6 +1013,7 @@ static int32_t taosDropTable(TAOS* taos, void* meta, int32_t metaLen) {
for (int32_t iReq = 0; iReq < req.nReqs; iReq++) {
pDropReq = req.pReqs + iReq;
pDropReq->igNotExists = true;
+ pDropReq->suid = processSuid(pDropReq->suid, pRequest->pDb);
SVgroupInfo pInfo = {0};
SName pName = {0};
@@ -1922,6 +1928,7 @@ static int32_t tmqWriteRawMetaDataImpl(TAOS* taos, void* data, int32_t dataLen)
SMqTaosxRspObj rspObj = {0};
SDecoder decoder = {0};
STableMeta* pTableMeta = NULL;
+ void* schemaContent = NULL;
terrno = TSDB_CODE_SUCCESS;
SRequestObj* pRequest = (SRequestObj*)createRequest(*(int64_t*)taos, TSDB_SQL_INSERT, 0);
@@ -2008,27 +2015,49 @@ static int32_t tmqWriteRawMetaDataImpl(TAOS* taos, void* data, int32_t dataLen)
SDecoder decoderTmp = {0};
SVCreateTbReq pCreateReq = {0};
- tDecoderInit(&decoderTmp, *dataTmp, *lenTmp);
- if (tDecodeSVCreateTbReq(&decoderTmp, &pCreateReq) < 0) {
- tDecoderClear(&decoderTmp);
- taosMemoryFreeClear(pCreateReq.comment);
- taosArrayDestroy(pCreateReq.ctb.tagName);
- goto end;
- }
+ do{
+ tDecoderInit(&decoderTmp, *dataTmp, *lenTmp);
+ if (tDecodeSVCreateTbReq(&decoderTmp, &pCreateReq) < 0) {
+ code = TSDB_CODE_MSG_DECODE_ERROR;
+ break;
+ }
+
+ if (strcmp(tbName, pCreateReq.name) != 0) {
+ break;
+ }
+
+ pCreateReq.ctb.suid = processSuid(pCreateReq.ctb.suid, pRequest->pDb);
- ASSERT(pCreateReq.type == TSDB_CHILD_TABLE);
- if (strcmp(tbName, pCreateReq.name) == 0) {
- schemaLen = *lenTmp;
- schemaData = *dataTmp;
+ int32_t len = 0;
+ tEncodeSize(tEncodeSVCreateTbReq, &pCreateReq, len, code);
+ if(code != 0) {
+ code = TSDB_CODE_MSG_ENCODE_ERROR;
+ break;
+ }
+ taosMemoryFree(schemaContent);
+ schemaContent = taosMemoryMalloc(len);
+ if(!schemaContent) {
+ code = TSDB_CODE_OUT_OF_MEMORY;
+ break;
+ }
+ SEncoder encoder = {0};
+ tEncoderInit(&encoder, schemaContent, len);
+ code = tEncodeSVCreateTbReq(&encoder, &pCreateReq);
+ if (code != 0) {
+ tEncoderClear(&encoder);
+ code = TSDB_CODE_MSG_ENCODE_ERROR;
+ break;
+ }
+ schemaLen = len;
+ schemaData = schemaContent;
strcpy(pName.tname, pCreateReq.ctb.stbName);
- tDecoderClear(&decoderTmp);
- taosMemoryFreeClear(pCreateReq.comment);
- taosArrayDestroy(pCreateReq.ctb.tagName);
- break;
- }
+ tEncoderClear(&encoder);
+ }while(0);
tDecoderClear(&decoderTmp);
taosMemoryFreeClear(pCreateReq.comment);
taosArrayDestroy(pCreateReq.ctb.tagName);
+ if(code != 0) goto end;
+ if(schemaLen != 0) break;
}
code = catalogGetTableMeta(pCatalog, &conn, &pName, &pTableMeta);
@@ -2217,6 +2246,7 @@ static int32_t tmqWriteRawMetaDataImpl(TAOS* taos, void* data, int32_t dataLen)
destroyRequest(pRequest);
taosHashCleanup(pVgHash);
taosMemoryFreeClear(pTableMeta);
+ taosMemoryFree(schemaContent);
return code;
}
diff --git a/source/client/src/clientSml.c b/source/client/src/clientSml.c
index c24aa536c217e34027a3407bef43cba82911fa7a..0694f4c457294ad66028184e7e685d8fab7f517c 100644
--- a/source/client/src/clientSml.c
+++ b/source/client/src/clientSml.c
@@ -149,17 +149,8 @@ typedef struct {
int64_t endTime;
} SSmlCostInfo;
-typedef struct {
- SRequestObj *request;
- tsem_t sem;
- int32_t cnt;
- int32_t total;
- TdThreadSpinlock lock;
-} Params;
-
typedef struct {
int64_t id;
- Params *params;
SMLProtocolType protocol;
int8_t precision;
@@ -178,7 +169,6 @@ typedef struct {
SQuery *pQuery;
SSmlCostInfo cost;
- int32_t affectedRows;
SSmlMsgBuf msgBuf;
SHashObj *dumplicateKey; // for dumplicate key
SArray *colsContainer; // for cols parse, if dataFormat == false
@@ -1513,7 +1503,6 @@ static void smlDestroyInfo(SSmlHandle *info) {
if (!info->dataFormat) {
taosArrayDestroy(info->colsContainer);
}
- destroyRequest(info->pRequest);
cJSON_Delete(info->root);
taosMemoryFreeClear(info);
@@ -2351,20 +2340,11 @@ static int32_t smlInsertData(SSmlHandle *info) {
}
info->cost.insertRpcTime = taosGetTimestampUs();
- // launchQueryImpl(info->pRequest, info->pQuery, false, NULL);
- // info->affectedRows = taos_affected_rows(info->pRequest);
- // return info->pRequest->code;
-
SAppClusterSummary *pActivity = &info->taos->pAppInfo->summary;
atomic_add_fetch_64((int64_t *)&pActivity->numOfInsertsReq, 1);
- SSqlCallbackWrapper *pWrapper = (SSqlCallbackWrapper *)taosMemoryCalloc(1, sizeof(SSqlCallbackWrapper));
- if (pWrapper == NULL) {
- return TSDB_CODE_OUT_OF_MEMORY;
- }
- pWrapper->pRequest = info->pRequest;
- launchAsyncQuery(info->pRequest, info->pQuery, NULL, pWrapper);
- return TSDB_CODE_SUCCESS;
+ launchQueryImpl(info->pRequest, info->pQuery, true, NULL);
+ return info->pRequest->code;
}
static void smlPrintStatisticInfo(SSmlHandle *info) {
@@ -2498,48 +2478,13 @@ static int32_t isSchemalessDb(STscObj *taos, SRequestObj *request) {
return TSDB_CODE_SUCCESS;
}
-static void smlInsertCallback(void *param, void *res, int32_t code) {
- SRequestObj *pRequest = (SRequestObj *)res;
- SSmlHandle *info = (SSmlHandle *)param;
- int32_t rows = taos_affected_rows(pRequest);
-
- uDebug("SML:0x%" PRIx64 " result. code:%d, msg:%s", info->id, pRequest->code, pRequest->msgBuf);
- Params *pParam = info->params;
- // lock
- taosThreadSpinLock(&pParam->lock);
- pParam->cnt++;
- if (code != TSDB_CODE_SUCCESS) {
- pParam->request->code = code;
- pParam->request->body.resInfo.numOfRows += rows;
- } else {
- pParam->request->body.resInfo.numOfRows += info->affectedRows;
- }
- // unlock
- taosThreadSpinUnlock(&pParam->lock);
-
- if (pParam->cnt == pParam->total) {
- tsem_post(&pParam->sem);
- }
- uDebug("SML:0x%" PRIx64 " insert finished, code: %d, rows: %d, total: %d", info->id, code, rows, info->affectedRows);
- info->cost.endTime = taosGetTimestampUs();
- info->cost.code = code;
- smlPrintStatisticInfo(info);
- smlDestroyInfo(info);
-}
-
TAOS_RES *taos_schemaless_insert_inner(SRequestObj *request, char *lines[], char *rawLine, char *rawLineEnd,
int numLines, int protocol, int precision, int32_t ttl) {
- int batchs = 0;
STscObj *pTscObj = request->pTscObj;
-
+ SSmlHandle *info = NULL;
pTscObj->schemalessType = 1;
SSmlMsgBuf msg = {ERROR_MSG_BUF_DEFAULT_SIZE, request->msgBuf};
- Params params = {0};
- params.request = request;
- tsem_init(¶ms.sem, 0, 0);
- taosThreadSpinInit(&(params.lock), 0);
-
if (request->pDb == NULL) {
request->code = TSDB_CODE_PAR_DB_NOT_SPECIFIED;
smlBuildInvalidDataMsg(&msg, "Database not specified", NULL);
@@ -2573,65 +2518,24 @@ TAOS_RES *taos_schemaless_insert_inner(SRequestObj *request, char *lines[], char
goto end;
}
- batchs = ceil(((double)numLines) / tsSmlBatchSize);
- params.total = batchs;
- for (int i = 0; i < batchs; ++i) {
- SRequestObj *req = (SRequestObj *)createRequest(pTscObj->id, TSDB_SQL_INSERT, 0);
- if (!req) {
- request->code = TSDB_CODE_OUT_OF_MEMORY;
- uError("SML:taos_schemaless_insert error request is null");
- goto end;
- }
- SSmlHandle *info = smlBuildSmlInfo(pTscObj, req, (SMLProtocolType)protocol, precision);
- if (!info) {
- request->code = TSDB_CODE_OUT_OF_MEMORY;
- uError("SML:taos_schemaless_insert error SSmlHandle is null");
- goto end;
- }
-
- info->isRawLine = (rawLine == NULL);
- info->ttl = ttl;
-
- int32_t perBatch = tsSmlBatchSize;
-
- if (numLines > perBatch) {
- numLines -= perBatch;
- } else {
- perBatch = numLines;
- numLines = 0;
- }
-
- info->params = ¶ms;
- info->affectedRows = perBatch;
- info->pRequest->body.queryFp = smlInsertCallback;
- info->pRequest->body.param = info;
- int32_t code = smlProcess(info, lines, rawLine, rawLineEnd, perBatch);
- if (lines) {
- lines += perBatch;
- }
- if (rawLine) {
- int num = 0;
- while (rawLine < rawLineEnd) {
- if (*(rawLine++) == '\n') {
- num++;
- }
- if (num == perBatch) {
- break;
- }
- }
- }
- if (code != TSDB_CODE_SUCCESS) {
- info->pRequest->body.queryFp(info, req, code);
- }
+ info = smlBuildSmlInfo(pTscObj, request, (SMLProtocolType)protocol, precision);
+ if (!info) {
+ request->code = TSDB_CODE_OUT_OF_MEMORY;
+ uError("SML:taos_schemaless_insert error SSmlHandle is null");
+ goto end;
}
- tsem_wait(¶ms.sem);
+
+ info->isRawLine = (rawLine == NULL);
+ info->ttl = ttl;
+ request->code = smlProcess(info, lines, rawLine, rawLineEnd, numLines);
end:
- taosThreadSpinDestroy(¶ms.lock);
- tsem_destroy(¶ms.sem);
- // ((STscObj *)taos)->schemalessType = 0;
- pTscObj->schemalessType = 1;
- uDebug("resultend:%s", request->msgBuf);
+ uDebug("SML:0x%" PRIx64 " insert finished, code: %d", info->id, request->code);
+ info->cost.endTime = taosGetTimestampUs();
+ info->cost.code = request->code;
+ smlPrintStatisticInfo(info);
+ smlDestroyInfo(info);
+
return (TAOS_RES *)request;
}
diff --git a/source/client/src/clientTmq.c b/source/client/src/clientTmq.c
index 22739108e2078f9a2c3a51ba8f769e86f2417439..69e10bd649a1f2b8df904a7f4bf908d36bb2b39b 100644
--- a/source/client/src/clientTmq.c
+++ b/source/client/src/clientTmq.c
@@ -32,15 +32,15 @@
sem_post(x)
#endif
-int32_t tmqAskEp(tmq_t* tmq, bool async);
-
-typedef struct {
+struct SMqMgmt{
int8_t inited;
tmr_h timer;
int32_t rsetId;
-} SMqMgmt;
+};
-static SMqMgmt tmqMgmt = {0};
+static TdThreadOnce tmqInit = PTHREAD_ONCE_INIT; // initialize only once
+volatile int32_t tmqInitRes = 0; // initialize rsp code
+static struct SMqMgmt tmqMgmt = {0};
typedef struct {
int8_t tmqRspType;
@@ -58,16 +58,14 @@ struct tmq_list_t {
};
struct tmq_conf_t {
- char clientId[256];
- char groupId[TSDB_CGROUP_LEN];
- int8_t autoCommit;
- int8_t resetOffset;
- int8_t withTbName;
- int8_t snapEnable;
- int32_t snapBatchSize;
-
- bool hbBgEnable;
-
+ char clientId[256];
+ char groupId[TSDB_CGROUP_LEN];
+ int8_t autoCommit;
+ int8_t resetOffset;
+ int8_t withTbName;
+ int8_t snapEnable;
+ int32_t snapBatchSize;
+ bool hbBgEnable;
uint16_t port;
int32_t autoCommitInterval;
char* ip;
@@ -78,18 +76,17 @@ struct tmq_conf_t {
};
struct tmq_t {
- int64_t refId;
+ int64_t refId;
// conf
- char groupId[TSDB_CGROUP_LEN];
- char clientId[256];
- int8_t withTbName;
- int8_t useSnapshot;
- int8_t autoCommit;
- int32_t autoCommitInterval;
- int32_t resetOffsetCfg;
- int64_t consumerId;
-
- bool hbBgEnable;
+ char groupId[TSDB_CGROUP_LEN];
+ char clientId[256];
+ int8_t withTbName;
+ int8_t useSnapshot;
+ int8_t autoCommit;
+ int32_t autoCommitInterval;
+ int32_t resetOffsetCfg;
+ uint64_t consumerId;
+ bool hbBgEnable;
tmq_commit_cb* commitCb;
void* commitCbUserParam;
@@ -155,11 +152,9 @@ typedef struct {
typedef struct {
// subscribe info
- char topicName[TSDB_TOPIC_FNAME_LEN];
- char db[TSDB_DB_FNAME_LEN];
-
- SArray* vgs; // SArray
-
+ char topicName[TSDB_TOPIC_FNAME_LEN];
+ char db[TSDB_DB_FNAME_LEN];
+ SArray* vgs; // SArray
SSchemaWrapper schema;
} SMqClientTopic;
@@ -217,17 +212,26 @@ typedef struct {
typedef struct {
SMqCommitCbParamSet* params;
STqOffset* pOffset;
+ SMqClientVg* pMqVg;
/*char topicName[TSDB_TOPIC_FNAME_LEN];*/
/*int32_t vgId;*/
} SMqCommitCbParam;
+static int32_t tmqAskEp(tmq_t* tmq, bool async);
+
tmq_conf_t* tmq_conf_new() {
tmq_conf_t* conf = taosMemoryCalloc(1, sizeof(tmq_conf_t));
+ if (conf == NULL) {
+ terrno = TSDB_CODE_OUT_OF_MEMORY;
+ return conf;
+ }
+
conf->withTbName = false;
conf->autoCommit = true;
conf->autoCommitInterval = 5000;
conf->resetOffset = TMQ_CONF__RESET_OFFSET__EARLIEAST;
conf->hbBgEnable = true;
+
return conf;
}
@@ -418,7 +422,6 @@ int32_t tmqCommitDone(SMqCommitCbParamSet* pParamSet) {
static void tmqCommitRspCountDown(SMqCommitCbParamSet* pParamSet) {
int32_t waitingRspNum = atomic_sub_fetch_32(&pParamSet->waitingRspNum, 1);
- ASSERT(waitingRspNum >= 0);
if (waitingRspNum == 0) {
tmqCommitDone(pParamSet);
}
@@ -436,6 +439,17 @@ int32_t tmqCommitCb(void* param, SDataBuf* pBuf, int32_t code) {
}
#endif
+ // there may be race condition. fix it
+ if (pBuf->pEpSet != NULL && pParam->pMqVg != NULL) {
+ SMqClientVg* pMqVg = pParam->pMqVg;
+
+ SEp* pEp = GET_ACTIVE_EP(pBuf->pEpSet);
+ SEp* pOld = GET_ACTIVE_EP(&(pMqVg->epSet));
+ uDebug("subKey:%s update the epset vgId:%d, ep:%s:%d, old ep:%s:%d", pParam->pOffset->subKey, pMqVg->vgId,
+ pEp->fqdn, pEp->port, pOld->fqdn, pOld->port);
+ pParam->pMqVg->epSet = *pBuf->pEpSet;
+ }
+
taosMemoryFree(pParam->pOffset);
taosMemoryFree(pBuf->pData);
taosMemoryFree(pBuf->pEpSet);
@@ -444,7 +458,6 @@ int32_t tmqCommitCb(void* param, SDataBuf* pBuf, int32_t code) {
* pOffset->version);*/
tmqCommitRspCountDown(pParamSet);
-
return 0;
}
@@ -454,6 +467,7 @@ static int32_t tmqSendCommitReq(tmq_t* tmq, SMqClientVg* pVg, SMqClientTopic* pT
terrno = TSDB_CODE_OUT_OF_MEMORY;
return -1;
}
+
pOffset->val = pVg->currentOffset;
int32_t groupLen = strlen(tmq->groupId);
@@ -467,11 +481,13 @@ static int32_t tmqSendCommitReq(tmq_t* tmq, SMqClientVg* pVg, SMqClientTopic* pT
if (code < 0) {
return -1;
}
+
void* buf = taosMemoryCalloc(1, sizeof(SMsgHead) + len);
if (buf == NULL) {
taosMemoryFree(pOffset);
return -1;
}
+
((SMsgHead*)buf)->vgId = htonl(pVg->vgId);
void* abuf = POINTER_SHIFT(buf, sizeof(SMsgHead));
@@ -488,8 +504,10 @@ static int32_t tmqSendCommitReq(tmq_t* tmq, SMqClientVg* pVg, SMqClientTopic* pT
taosMemoryFree(buf);
return -1;
}
+
pParam->params = pParamSet;
pParam->pOffset = pOffset;
+ pParam->pMqVg = pVg; // there may be an race condition
// build send info
SMsgSendInfo* pMsgSendInfo = taosMemoryCalloc(1, sizeof(SMsgSendInfo));
@@ -499,16 +517,18 @@ static int32_t tmqSendCommitReq(tmq_t* tmq, SMqClientVg* pVg, SMqClientTopic* pT
taosMemoryFree(pParam);
return -1;
}
+
pMsgSendInfo->msgInfo = (SDataBuf){
.pData = buf,
.len = sizeof(SMsgHead) + len,
.handle = NULL,
};
- tscDebug("consumer:%" PRId64 ", commit offset of %s on vgId:%d, offset is %" PRId64, tmq->consumerId, pOffset->subKey,
- pVg->vgId, pOffset->val.version);
+ SEp* pEp = &pVg->epSet.eps[pVg->epSet.inUse];
+ tscDebug("consumer:0x%" PRIx64 " topic:%s on vgId:%d offset:%" PRId64" prev:%"PRId64", ep:%s:%d", tmq->consumerId, pOffset->subKey,
+ pVg->vgId, pOffset->val.version, pVg->committedOffset.version, pEp->fqdn, pEp->port);
- // TODO: put into cb
+ // TODO: put into cb, the commit offset should be move to the callback function
pVg->committedOffset = pVg->currentOffset;
pMsgSendInfo->requestId = generateRequestId();
@@ -530,7 +550,7 @@ static int32_t tmqSendCommitReq(tmq_t* tmq, SMqClientVg* pVg, SMqClientTopic* pT
int32_t tmqCommitMsgImpl(tmq_t* tmq, const TAOS_RES* msg, int8_t async, tmq_commit_cb* userCb, void* userParam) {
char* topic;
int32_t vgId;
- ASSERT(msg != NULL);
+
if (TD_RES_TMQ(msg)) {
SMqRspObj* pRspObj = (SMqRspObj*)msg;
topic = pRspObj->topic;
@@ -633,24 +653,22 @@ static int32_t tmqCommitConsumerImpl(tmq_t* tmq, int8_t automatic, int8_t async,
// init as 1 to prevent concurrency issue
pParamSet->waitingRspNum = 1;
- for (int32_t i = 0; i < taosArrayGetSize(tmq->clientTopics); i++) {
- SMqClientTopic* pTopic = taosArrayGet(tmq->clientTopics, i);
+ int32_t numOfTopics = taosArrayGetSize(tmq->clientTopics);
+ tscDebug("consumer:0x%"PRIx64" start to commit offset for %d topics", tmq->consumerId, numOfTopics);
- tscDebug("consumer:%" PRId64 ", begin commit for topic %s, vgNum %d", tmq->consumerId, pTopic->topicName,
- (int32_t)taosArrayGetSize(pTopic->vgs));
+ for (int32_t i = 0; i < numOfTopics; i++) {
+ SMqClientTopic* pTopic = taosArrayGet(tmq->clientTopics, i);
- for (int32_t j = 0; j < taosArrayGetSize(pTopic->vgs); j++) {
+ int32_t numOfVgroups = taosArrayGetSize(pTopic->vgs);
+ for (int32_t j = 0; j < numOfVgroups; j++) {
SMqClientVg* pVg = taosArrayGet(pTopic->vgs, j);
-
- tscDebug("consumer:%" PRId64 ", begin commit for topic %s, vgId:%d", tmq->consumerId, pTopic->topicName,
- pVg->vgId);
-
if (pVg->currentOffset.type > 0 && !tOffsetEqual(&pVg->currentOffset, &pVg->committedOffset)) {
- tscDebug("consumer: %" PRId64 ", vg:%d, current %" PRId64 ", committed %" PRId64 "", tmq->consumerId, pVg->vgId,
- pVg->currentOffset.version, pVg->committedOffset.version);
if (tmqSendCommitReq(tmq, pVg, pTopic, pParamSet) < 0) {
continue;
}
+ } else {
+ tscDebug("consumer:0x%" PRIx64 " topic:%s vgId:%d, not commit, current:%" PRId64 ", ordinal:%d/%d",
+ tmq->consumerId, pTopic->topicName, pVg->vgId, pVg->currentOffset.version, j + 1, numOfVgroups);
}
}
}
@@ -786,34 +804,46 @@ OVER:
taosTmrReset(tmqSendHbReq, 1000, param, tmqMgmt.timer, &tmq->hbLiveTimer);
}
-int32_t tmqHandleAllDelayedTask(tmq_t* tmq) {
+int32_t tmqHandleAllDelayedTask(tmq_t* pTmq) {
STaosQall* qall = taosAllocateQall();
- taosReadAllQitems(tmq->delayedTask, qall);
- while (1) {
- int8_t* pTaskType = NULL;
- taosGetQitem(qall, (void**)&pTaskType);
- if (pTaskType == NULL) break;
+ taosReadAllQitems(pTmq->delayedTask, qall);
+
+ if (qall->numOfItems == 0) {
+ taosFreeQall(qall);
+ return TSDB_CODE_SUCCESS;
+ }
+ tscDebug("consumer:0x%"PRIx64" handle delayed %d tasks before poll data", pTmq->consumerId, qall->numOfItems);
+ int8_t* pTaskType = NULL;
+ taosGetQitem(qall, (void**)&pTaskType);
+
+ while (pTaskType != NULL) {
if (*pTaskType == TMQ_DELAYED_TASK__ASK_EP) {
- tmqAskEp(tmq, true);
+ tmqAskEp(pTmq, true);
int64_t* pRefId = taosMemoryMalloc(sizeof(int64_t));
- *pRefId = tmq->refId;
+ *pRefId = pTmq->refId;
- taosTmrReset(tmqAssignAskEpTask, 1000, pRefId, tmqMgmt.timer, &tmq->epTimer);
+ tscDebug("consumer:0x%"PRIx64" next retrieve ep from mnode in 1s", pTmq->consumerId);
+ taosTmrReset(tmqAssignAskEpTask, 1000, pRefId, tmqMgmt.timer, &pTmq->epTimer);
} else if (*pTaskType == TMQ_DELAYED_TASK__COMMIT) {
- tmqCommitInner(tmq, NULL, 1, 1, tmq->commitCb, tmq->commitCbUserParam);
+ tmqCommitInner(pTmq, NULL, 1, 1, pTmq->commitCb, pTmq->commitCbUserParam);
int64_t* pRefId = taosMemoryMalloc(sizeof(int64_t));
- *pRefId = tmq->refId;
+ *pRefId = pTmq->refId;
- taosTmrReset(tmqAssignDelayedCommitTask, tmq->autoCommitInterval, pRefId, tmqMgmt.timer, &tmq->commitTimer);
+ tscDebug("consumer:0x%"PRIx64" next commit to mnode in %.2fs", pTmq->consumerId, pTmq->autoCommitInterval/1000.0);
+ taosTmrReset(tmqAssignDelayedCommitTask, pTmq->autoCommitInterval, pRefId, tmqMgmt.timer, &pTmq->commitTimer);
} else if (*pTaskType == TMQ_DELAYED_TASK__REPORT) {
+ // do nothing
} else {
ASSERT(0);
}
+
taosFreeQitem(pTaskType);
+ taosGetQitem(qall, (void**)&pTaskType);
}
+
taosFreeQall(qall);
return 0;
}
@@ -932,41 +962,45 @@ void tmqFreeImpl(void* handle) {
taosMemoryFree(tmq);
}
+static void tmqMgmtInit(void) {
+ tmqInitRes = 0;
+ tmqMgmt.timer = taosTmrInit(1000, 100, 360000, "TMQ");
+
+ if (tmqMgmt.timer == NULL) {
+ tmqInitRes = TSDB_CODE_OUT_OF_MEMORY;
+ }
+
+ tmqMgmt.rsetId = taosOpenRef(10000, tmqFreeImpl);
+ if (tmqMgmt.rsetId < 0) {
+ tmqInitRes = terrno;
+ }
+}
+
tmq_t* tmq_consumer_new(tmq_conf_t* conf, char* errstr, int32_t errstrLen) {
- // init timer
- int8_t inited = atomic_val_compare_exchange_8(&tmqMgmt.inited, 0, 1);
- if (inited == 0) {
- tmqMgmt.timer = taosTmrInit(1000, 100, 360000, "TMQ");
- if (tmqMgmt.timer == NULL) {
- atomic_store_8(&tmqMgmt.inited, 0);
- terrno = TSDB_CODE_OUT_OF_MEMORY;
- return NULL;
- }
- tmqMgmt.rsetId = taosOpenRef(10000, tmqFreeImpl);
+ taosThreadOnce(&tmqInit, tmqMgmtInit);
+ if (tmqInitRes != 0) {
+ terrno = tmqInitRes;
+ return NULL;
}
tmq_t* pTmq = taosMemoryCalloc(1, sizeof(tmq_t));
if (pTmq == NULL) {
terrno = TSDB_CODE_OUT_OF_MEMORY;
- tscError("setting up new consumer failed since %s, consumer group %s", terrstr(), conf->groupId);
+ tscError("failed to create consumer, consumer group %s, code:%s", conf->groupId, terrstr());
return NULL;
}
const char* user = conf->user == NULL ? TSDB_DEFAULT_USER : conf->user;
const char* pass = conf->pass == NULL ? TSDB_DEFAULT_PASS : conf->pass;
- ASSERT(user);
- ASSERT(pass);
- ASSERT(conf->groupId[0]);
-
pTmq->clientTopics = taosArrayInit(0, sizeof(SMqClientTopic));
pTmq->mqueue = taosOpenQueue();
pTmq->qall = taosAllocateQall();
pTmq->delayedTask = taosOpenQueue();
- if (pTmq->clientTopics == NULL || pTmq->mqueue == NULL || pTmq->qall == NULL || pTmq->delayedTask == NULL) {
+ if (pTmq->clientTopics == NULL || pTmq->mqueue == NULL || pTmq->qall == NULL || pTmq->delayedTask == NULL || conf->groupId[0] == 0) {
terrno = TSDB_CODE_OUT_OF_MEMORY;
- tscError("consumer %" PRId64 " setup failed since %s, consumer group %s", pTmq->consumerId, terrstr(),
+ tscError("consumer:0x%" PRIx64 " setup failed since %s, consumer group %s", pTmq->consumerId, terrstr(),
pTmq->groupId);
goto FAIL;
}
@@ -996,7 +1030,7 @@ tmq_t* tmq_consumer_new(tmq_conf_t* conf, char* errstr, int32_t errstrLen) {
// init semaphore
if (tsem_init(&pTmq->rspSem, 0, 0) != 0) {
- tscError("consumer %" PRId64 " setup failed since %s, consumer group %s", pTmq->consumerId, terrstr(),
+ tscError("consumer:0x %" PRIx64 " setup failed since %s, consumer group %s", pTmq->consumerId, terrstr(),
pTmq->groupId);
goto FAIL;
}
@@ -1004,7 +1038,7 @@ tmq_t* tmq_consumer_new(tmq_conf_t* conf, char* errstr, int32_t errstrLen) {
// init connection
pTmq->pTscObj = taos_connect_internal(conf->ip, user, pass, NULL, NULL, conf->port, CONN_TYPE__TMQ);
if (pTmq->pTscObj == NULL) {
- tscError("consumer %" PRId64 " setup failed since %s, consumer group %s", pTmq->consumerId, terrstr(),
+ tscError("consumer:0x %" PRIx64 " setup failed since %s, consumer group %s", pTmq->consumerId, terrstr(),
pTmq->groupId);
tsem_destroy(&pTmq->rspSem);
goto FAIL;
@@ -1022,8 +1056,7 @@ tmq_t* tmq_consumer_new(tmq_conf_t* conf, char* errstr, int32_t errstrLen) {
pTmq->hbLiveTimer = taosTmrStart(tmqSendHbReq, 1000, pRefId, tmqMgmt.timer);
}
- tscInfo("consumer %" PRId64 " is setup, consumer group %s", pTmq->consumerId, pTmq->groupId);
-
+ tscInfo("consumer:0x%" PRIx64 " is setup, consumer groupId %s", pTmq->consumerId, pTmq->groupId);
return pTmq;
FAIL:
@@ -1032,6 +1065,7 @@ FAIL:
if (pTmq->delayedTask) taosCloseQueue(pTmq->delayedTask);
if (pTmq->qall) taosFreeQall(pTmq->qall);
taosMemoryFree(pTmq);
+
return NULL;
}
@@ -1041,44 +1075,52 @@ int32_t tmq_subscribe(tmq_t* tmq, const tmq_list_t* topic_list) {
void* buf = NULL;
SMsgSendInfo* sendInfo = NULL;
SCMSubscribeReq req = {0};
- int32_t code = -1;
+ int32_t code = 0;
- tscDebug("tmq subscribe, consumer: %" PRId64 ", topic num %d", tmq->consumerId, sz);
+ tscDebug("consumer:0x%"PRIx64" subscribe %d topics", tmq->consumerId, sz);
req.consumerId = tmq->consumerId;
tstrncpy(req.clientId, tmq->clientId, 256);
tstrncpy(req.cgroup, tmq->groupId, TSDB_CGROUP_LEN);
req.topicNames = taosArrayInit(sz, sizeof(void*));
- if (req.topicNames == NULL) goto FAIL;
- tscDebug("tmq subscribe, consumer: %" PRId64 ", topic num %d", tmq->consumerId, sz);
+ if (req.topicNames == NULL) {
+ code = TSDB_CODE_OUT_OF_MEMORY;
+ goto FAIL;
+ }
for (int32_t i = 0; i < sz; i++) {
char* topic = taosArrayGetP(container, i);
SName name = {0};
tNameSetDbName(&name, tmq->pTscObj->acctId, topic, strlen(topic));
-
char* topicFName = taosMemoryCalloc(1, TSDB_TOPIC_FNAME_LEN);
if (topicFName == NULL) {
goto FAIL;
}
- tNameExtractFullName(&name, topicFName);
- tscDebug("subscribe topic: %s", topicFName);
+ tNameExtractFullName(&name, topicFName);
+ tscDebug("consumer:0x%"PRIx64" subscribe topic:%s", tmq->consumerId, topicFName);
taosArrayPush(req.topicNames, &topicFName);
}
int32_t tlen = tSerializeSCMSubscribeReq(NULL, &req);
+
buf = taosMemoryMalloc(tlen);
- if (buf == NULL) goto FAIL;
+ if (buf == NULL) {
+ code = TSDB_CODE_OUT_OF_MEMORY;
+ goto FAIL;
+ }
void* abuf = buf;
tSerializeSCMSubscribeReq(&abuf, &req);
sendInfo = taosMemoryCalloc(1, sizeof(SMsgSendInfo));
- if (sendInfo == NULL) goto FAIL;
+ if (sendInfo == NULL) {
+ code = TSDB_CODE_OUT_OF_MEMORY;
+ goto FAIL;
+ }
SMqSubscribeCbParam param = {
.rspErr = 0,
@@ -1086,7 +1128,9 @@ int32_t tmq_subscribe(tmq_t* tmq, const tmq_list_t* topic_list) {
.epoch = tmq->epoch,
};
- if (tsem_init(¶m.rspSem, 0, 0) != 0) goto FAIL;
+ if (tsem_init(¶m.rspSem, 0, 0) != 0) {
+ goto FAIL;
+ }
sendInfo->msgInfo = (SDataBuf){
.pData = buf,
@@ -1112,15 +1156,18 @@ int32_t tmq_subscribe(tmq_t* tmq, const tmq_list_t* topic_list) {
tsem_wait(¶m.rspSem);
tsem_destroy(¶m.rspSem);
- code = param.rspErr;
- if (code != 0) goto FAIL;
+ if (param.rspErr != 0) {
+ code = param.rspErr;
+ goto FAIL;
+ }
int32_t retryCnt = 0;
while (TSDB_CODE_MND_CONSUMER_NOT_READY == tmqAskEp(tmq, false)) {
if (retryCnt++ > 10) {
goto FAIL;
}
- tscDebug("consumer not ready, retry");
+
+ tscDebug("consumer:0x%"PRIx64", mnd not ready for subscribe, retry:%d in 500ms", tmq->consumerId, retryCnt);
taosMsleep(500);
}
@@ -1138,7 +1185,6 @@ int32_t tmq_subscribe(tmq_t* tmq, const tmq_list_t* topic_list) {
tmq->commitTimer = taosTmrStart(tmqAssignDelayedCommitTask, tmq->autoCommitInterval, pRefId2, tmqMgmt.timer);
}
- code = 0;
FAIL:
taosArrayDestroyP(req.topicNames, taosMemoryFree);
taosMemoryFree(buf);
@@ -1233,7 +1279,7 @@ int32_t tmqPollCb(void* param, SDataBuf* pMsg, int32_t code) {
tDecoderClear(&decoder);
memcpy(&pRspWrapper->dataRsp, pMsg->pData, sizeof(SMqRspHead));
- tscDebug("consumer:%" PRId64 ", recv poll: vgId:%d, req offset %" PRId64 ", rsp offset %" PRId64 " type %d",
+ tscDebug("consumer:0x%" PRIx64 ", recv poll: vgId:%d, req offset %" PRId64 ", rsp offset %" PRId64 " type %d",
tmq->consumerId, pVg->vgId, pRspWrapper->dataRsp.reqOffset.version, pRspWrapper->dataRsp.rspOffset.version,
rspType);
@@ -1256,7 +1302,7 @@ int32_t tmqPollCb(void* param, SDataBuf* pMsg, int32_t code) {
taosMemoryFree(pMsg->pData);
taosMemoryFree(pMsg->pEpSet);
- tscDebug("consumer:%" PRId64 ", put poll res into mqueue %p", tmq->consumerId, pRspWrapper);
+ tscDebug("consumer:0x%" PRIx64 ", put poll res into mqueue %p", tmq->consumerId, pRspWrapper);
taosWriteQitem(tmq->mqueue, pRspWrapper);
tsem_post(&tmq->rspSem);
@@ -1273,10 +1319,12 @@ CREATE_MSG_FAIL:
bool tmqUpdateEp(tmq_t* tmq, int32_t epoch, const SMqAskEpRsp* pRsp) {
bool set = false;
+ int32_t topicNumCur = taosArrayGetSize(tmq->clientTopics);
int32_t topicNumGet = taosArrayGetSize(pRsp->topics);
+
char vgKey[TSDB_TOPIC_FNAME_LEN + 22];
- tscDebug("consumer:%" PRId64 ", update ep epoch %d to epoch %d, topic num:%d", tmq->consumerId, tmq->epoch, epoch,
- topicNumGet);
+ tscDebug("consumer:0x%" PRIx64" update ep epoch from %d to epoch %d, incoming topics:%d, existed topics:%d",
+ tmq->consumerId, tmq->epoch, epoch, topicNumGet, topicNumCur);
SArray* newTopics = taosArrayInit(topicNumGet, sizeof(SMqClientTopic));
if (newTopics == NULL) {
@@ -1288,19 +1336,19 @@ bool tmqUpdateEp(tmq_t* tmq, int32_t epoch, const SMqAskEpRsp* pRsp) {
taosArrayDestroy(newTopics);
return false;
}
- int32_t topicNumCur = taosArrayGetSize(tmq->clientTopics);
+
for (int32_t i = 0; i < topicNumCur; i++) {
// find old topic
SMqClientTopic* pTopicCur = taosArrayGet(tmq->clientTopics, i);
if (pTopicCur->vgs) {
int32_t vgNumCur = taosArrayGetSize(pTopicCur->vgs);
- tscDebug("consumer:%" PRId64 ", new vg num: %d", tmq->consumerId, vgNumCur);
+ tscDebug("consumer:0x%" PRIx64 ", new vg num: %d", tmq->consumerId, vgNumCur);
for (int32_t j = 0; j < vgNumCur; j++) {
SMqClientVg* pVgCur = taosArrayGet(pTopicCur->vgs, j);
sprintf(vgKey, "%s:%d", pTopicCur->topicName, pVgCur->vgId);
char buf[80];
tFormatOffset(buf, 80, &pVgCur->currentOffset);
- tscDebug("consumer:%" PRId64 ", epoch %d vgId:%d vgKey is %s, offset is %s", tmq->consumerId, epoch,
+ tscDebug("consumer:0x%" PRIx64 ", epoch %d vgId:%d vgKey is %s, offset is %s", tmq->consumerId, epoch,
pVgCur->vgId, vgKey, buf);
taosHashPut(pHash, vgKey, strlen(vgKey), &pVgCur->currentOffset, sizeof(STqOffsetVal));
}
@@ -1316,7 +1364,7 @@ bool tmqUpdateEp(tmq_t* tmq, int32_t epoch, const SMqAskEpRsp* pRsp) {
tstrncpy(topic.topicName, pTopicEp->topic, TSDB_TOPIC_FNAME_LEN);
tstrncpy(topic.db, pTopicEp->db, TSDB_DB_FNAME_LEN);
- tscDebug("consumer:%" PRId64 ", update topic: %s", tmq->consumerId, topic.topicName);
+ tscDebug("consumer:0x%" PRIx64 ", update topic: %s", tmq->consumerId, topic.topicName);
int32_t vgNumGet = taosArrayGetSize(pTopicEp->vgs);
topic.vgs = taosArrayInit(vgNumGet, sizeof(SMqClientVg));
@@ -1342,6 +1390,8 @@ bool tmqUpdateEp(tmq_t* tmq, int32_t epoch, const SMqAskEpRsp* pRsp) {
}
taosArrayPush(newTopics, &topic);
}
+
+ // destroy current buffered existed topics info
if (tmq->clientTopics) {
int32_t sz = taosArrayGetSize(tmq->clientTopics);
for (int32_t i = 0; i < sz; i++) {
@@ -1349,17 +1399,21 @@ bool tmqUpdateEp(tmq_t* tmq, int32_t epoch, const SMqAskEpRsp* pRsp) {
if (pTopic->schema.nCols) taosMemoryFreeClear(pTopic->schema.pSchema);
taosArrayDestroy(pTopic->vgs);
}
+
taosArrayDestroy(tmq->clientTopics);
}
+
taosHashCleanup(pHash);
tmq->clientTopics = newTopics;
- if (taosArrayGetSize(tmq->clientTopics) == 0)
+ if (taosArrayGetSize(tmq->clientTopics) == 0) {
atomic_store_8(&tmq->status, TMQ_CONSUMER_STATUS__NO_TOPIC);
- else
+ } else {
atomic_store_8(&tmq->status, TMQ_CONSUMER_STATUS__READY);
+ }
atomic_store_32(&tmq->epoch, epoch);
+ tscDebug("consumer:0x%" PRIx64 " update topic info completed", tmq->consumerId);
return set;
}
@@ -1382,8 +1436,8 @@ int32_t tmqAskEpCb(void* param, SDataBuf* pMsg, int32_t code) {
pParam->code = code;
if (code != 0) {
- tscError("consumer:%" PRId64 ", get topic endpoint error, not ready, wait:%d, code %x", tmq->consumerId,
- pParam->async, code);
+ tscError("consumer:0x%" PRIx64 ", get topic endpoint error, async:%d, code:%s", tmq->consumerId,
+ pParam->async, tstrerror(code));
goto END;
}
@@ -1392,11 +1446,15 @@ int32_t tmqAskEpCb(void* param, SDataBuf* pMsg, int32_t code) {
// Epoch will only increase when received newer epoch ep msg
SMqRspHead* head = pMsg->pData;
int32_t epoch = atomic_load_32(&tmq->epoch);
- tscDebug("consumer:%" PRId64 ", recv ep, msg epoch %d, current epoch %d", tmq->consumerId, head->epoch, epoch);
if (head->epoch <= epoch) {
+ tscDebug("consumer:0x%" PRIx64 ", recv ep, msg epoch %d, current epoch %d, no need to update local ep",
+ tmq->consumerId, head->epoch, epoch);
goto END;
}
+ tscDebug("consumer:0x%" PRIx64 ", recv ep, msg epoch %d, current epoch %d, update local ep", tmq->consumerId,
+ head->epoch, epoch);
+
if (!async) {
SMqAskEpRsp rsp;
tDecodeSMqAskEpRsp(POINTER_SHIFT(pMsg->pData, sizeof(SMqRspHead)), &rsp);
@@ -1411,6 +1469,7 @@ int32_t tmqAskEpCb(void* param, SDataBuf* pMsg, int32_t code) {
code = -1;
goto END;
}
+
pWrapper->tmqRspType = TMQ_MSG_TYPE__EP_RSP;
pWrapper->epoch = head->epoch;
memcpy(&pWrapper->msg, pMsg->pData, sizeof(SMqRspHead));
@@ -1434,16 +1493,17 @@ END:
}
int32_t tmqAskEp(tmq_t* tmq, bool async) {
- int32_t code = 0;
+ int32_t code = TSDB_CODE_SUCCESS;
#if 0
int8_t epStatus = atomic_val_compare_exchange_8(&tmq->epStatus, 0, 1);
if (epStatus == 1) {
int32_t epSkipCnt = atomic_add_fetch_32(&tmq->epSkipCnt, 1);
- tscTrace("consumer:%" PRId64 ", skip ask ep cnt %d", tmq->consumerId, epSkipCnt);
+ tscTrace("consumer:0x%" PRIx64 ", skip ask ep cnt %d", tmq->consumerId, epSkipCnt);
if (epSkipCnt < 5000) return 0;
}
atomic_store_32(&tmq->epSkipCnt, 0);
#endif
+
SMqAskEpReq req = {0};
req.consumerId = tmq->consumerId;
req.epoch = tmq->epoch;
@@ -1451,27 +1511,31 @@ int32_t tmqAskEp(tmq_t* tmq, bool async) {
int32_t tlen = tSerializeSMqAskEpReq(NULL, 0, &req);
if (tlen < 0) {
- tscError("tSerializeSMqAskEpReq failed");
+ tscError("consumer:0x%"PRIx64", tSerializeSMqAskEpReq failed", tmq->consumerId);
return -1;
}
+
void* pReq = taosMemoryCalloc(1, tlen);
if (pReq == NULL) {
- tscError("failed to malloc askEpReq msg, size:%d", tlen);
+ tscError("consumer:0x%"PRIx64", failed to malloc askEpReq msg, size:%d", tmq->consumerId, tlen);
+ terrno = TSDB_CODE_OUT_OF_MEMORY;
return -1;
}
+
if (tSerializeSMqAskEpReq(pReq, tlen, &req) < 0) {
- tscError("tSerializeSMqAskEpReq %d failed", tlen);
+ tscError("consumer:0x%"PRIx64", tSerializeSMqAskEpReq %d failed", tmq->consumerId, tlen);
taosMemoryFree(pReq);
return -1;
}
SMqAskEpCbParam* pParam = taosMemoryCalloc(1, sizeof(SMqAskEpCbParam));
if (pParam == NULL) {
- tscError("failed to malloc subscribe param");
+ tscError("consumer:0x%"PRIx64", failed to malloc subscribe param", tmq->consumerId);
taosMemoryFree(pReq);
/*atomic_store_8(&tmq->epStatus, 0);*/
return -1;
}
+
pParam->refId = tmq->refId;
pParam->epoch = tmq->epoch;
pParam->async = async;
@@ -1492,15 +1556,14 @@ int32_t tmqAskEp(tmq_t* tmq, bool async) {
.handle = NULL,
};
- sendInfo->requestId = generateRequestId();
+ sendInfo->requestId = tmq->consumerId;
sendInfo->requestObjRefId = 0;
sendInfo->param = pParam;
sendInfo->fp = tmqAskEpCb;
sendInfo->msgType = TDMT_MND_TMQ_ASK_EP;
SEpSet epSet = getEpSet_s(&tmq->pTscObj->pAppInfo->mgmtEp);
-
- tscDebug("consumer:%" PRId64 ", ask ep", tmq->consumerId);
+ tscDebug("consumer:0x%" PRIx64 " ask ep from mnode, async:%d, reqId:0x%"PRIx64, tmq->consumerId, async, tmq->consumerId);
int64_t transporterId = 0;
asyncSendMsgToServer(tmq->pTscObj->pAppInfo->pTransporter, &epSet, &transporterId, sendInfo);
@@ -1510,6 +1573,7 @@ int32_t tmqAskEp(tmq_t* tmq, bool async) {
code = pParam->code;
taosMemoryFree(pParam);
}
+
return code;
}
@@ -1582,15 +1646,20 @@ SMqTaosxRspObj* tmqBuildTaosxRspFromWrapper(SMqPollRspWrapper* pWrapper) {
return pRspObj;
}
+// broadcast the poll request to all related vnodes
int32_t tmqPollImpl(tmq_t* tmq, int64_t timeout) {
- for (int i = 0; i < taosArrayGetSize(tmq->clientTopics); i++) {
+ int32_t numOfTopics = taosArrayGetSize(tmq->clientTopics);
+ tscDebug("consumer:0x%" PRIx64" start to poll data, numOfTopics:%d", tmq->consumerId, numOfTopics);
+
+ for (int i = 0; i < numOfTopics; i++) {
+
SMqClientTopic* pTopic = taosArrayGet(tmq->clientTopics, i);
for (int j = 0; j < taosArrayGetSize(pTopic->vgs); j++) {
SMqClientVg* pVg = taosArrayGet(pTopic->vgs, j);
int32_t vgStatus = atomic_val_compare_exchange_32(&pVg->vgStatus, TMQ_VG_STATUS__IDLE, TMQ_VG_STATUS__WAIT);
- if (vgStatus != TMQ_VG_STATUS__IDLE) {
+ if (vgStatus == TMQ_VG_STATUS__WAIT) {
int32_t vgSkipCnt = atomic_add_fetch_32(&pVg->vgSkipCnt, 1);
- tscTrace("consumer:%" PRId64 ", epoch %d skip vgId:%d skip cnt %d", tmq->consumerId, tmq->epoch, pVg->vgId,
+ tscDebug("consumer:0x%" PRIx64 " epoch %d wait poll-rsp, skip vgId:%d skip cnt %d", tmq->consumerId, tmq->epoch, pVg->vgId,
vgSkipCnt);
continue;
/*if (vgSkipCnt < 10000) continue;*/
@@ -1598,10 +1667,11 @@ int32_t tmqPollImpl(tmq_t* tmq, int64_t timeout) {
if (skipCnt < 30000) {
continue;
} else {
- tscDebug("consumer:%" PRId64 ",skip vgId:%d skip too much reset", tmq->consumerId, pVg->vgId);
+ tscDebug("consumer:0x%" PRIx64 ",skip vgId:%d skip too much reset", tmq->consumerId, pVg->vgId);
}
#endif
}
+
atomic_store_32(&pVg->vgSkipCnt, 0);
SMqPollReq req = {0};
@@ -1612,6 +1682,7 @@ int32_t tmqPollImpl(tmq_t* tmq, int64_t timeout) {
tsem_post(&tmq->rspSem);
return -1;
}
+
char* msg = taosMemoryCalloc(1, msgSize);
if (NULL == msg) {
atomic_store_32(&pVg->vgStatus, TMQ_VG_STATUS__IDLE);
@@ -1633,6 +1704,7 @@ int32_t tmqPollImpl(tmq_t* tmq, int64_t timeout) {
tsem_post(&tmq->rspSem);
return -1;
}
+
pParam->refId = tmq->refId;
pParam->epoch = tmq->epoch;
@@ -1654,6 +1726,7 @@ int32_t tmqPollImpl(tmq_t* tmq, int64_t timeout) {
.len = msgSize,
.handle = NULL,
};
+
sendInfo->requestId = req.reqId;
sendInfo->requestObjRefId = 0;
sendInfo->param = pParam;
@@ -1661,18 +1734,19 @@ int32_t tmqPollImpl(tmq_t* tmq, int64_t timeout) {
sendInfo->msgType = TDMT_VND_TMQ_CONSUME;
int64_t transporterId = 0;
- /*printf("send poll\n");*/
char offsetFormatBuf[80];
tFormatOffset(offsetFormatBuf, 80, &pVg->currentOffset);
- tscDebug("consumer:%" PRId64 ", send poll to %s vgId:%d, epoch %d, req offset:%s, reqId:%" PRIu64,
+
+ tscDebug("consumer:0x%" PRIx64 ", send poll to %s vgId:%d, epoch %d, req offset:%s, reqId:0x%" PRIx64,
tmq->consumerId, pTopic->topicName, pVg->vgId, tmq->epoch, offsetFormatBuf, req.reqId);
- /*printf("send vgId:%d %" PRId64 "\n", pVg->vgId, pVg->currentOffset);*/
asyncSendMsgToServer(tmq->pTscObj->pAppInfo->pTransporter, &pVg->epSet, &transporterId, sendInfo);
+
pVg->pollCnt++;
tmq->pollCnt++;
}
}
+
return 0;
}
@@ -1697,28 +1771,28 @@ int32_t tmqHandleNoPollRsp(tmq_t* tmq, SMqRspWrapper* rspWrapper, bool* pReset)
}
void* tmqHandleAllRsp(tmq_t* tmq, int64_t timeout, bool pollIfReset) {
+ tscDebug("consumer:0x%"PRIx64" start to handle the rsp", tmq->consumerId);
+
while (1) {
SMqRspWrapper* rspWrapper = NULL;
taosGetQitem(tmq->qall, (void**)&rspWrapper);
+
if (rspWrapper == NULL) {
taosReadAllQitems(tmq->mqueue, tmq->qall);
taosGetQitem(tmq->qall, (void**)&rspWrapper);
if (rspWrapper == NULL) {
- /*tscDebug("consumer %" PRId64 " mqueue empty", tmq->consumerId);*/
return NULL;
}
}
- tscDebug("consumer:%" PRId64 " handle rsp %p", tmq->consumerId, rspWrapper);
-
if (rspWrapper->tmqRspType == TMQ_MSG_TYPE__END_RSP) {
taosFreeQitem(rspWrapper);
terrno = TSDB_CODE_TQ_NO_COMMITTED_OFFSET;
return NULL;
} else if (rspWrapper->tmqRspType == TMQ_MSG_TYPE__POLL_RSP) {
SMqPollRspWrapper* pollRspWrapper = (SMqPollRspWrapper*)rspWrapper;
- tscDebug("consumer %" PRId64 " actual process poll rsp", tmq->consumerId);
+ tscDebug("consumer:0x%" PRIx64 " process poll rsp", tmq->consumerId);
/*atomic_sub_fetch_32(&tmq->readyRequest, 1);*/
int32_t consumerEpoch = atomic_load_32(&tmq->epoch);
if (pollRspWrapper->dataRsp.head.epoch == consumerEpoch) {
@@ -1737,14 +1811,17 @@ void* tmqHandleAllRsp(tmq_t* tmq, int64_t timeout, bool pollIfReset) {
taosFreeQitem(pollRspWrapper);
return pRsp;
} else {
- tscDebug("msg discard since epoch mismatch: msg epoch %d, consumer epoch %d",
- pollRspWrapper->dataRsp.head.epoch, consumerEpoch);
+ tscDebug("consumer:0x%"PRIx64" msg discard since epoch mismatch: msg epoch %d, consumer epoch %d",
+ tmq->consumerId, pollRspWrapper->dataRsp.head.epoch, consumerEpoch);
tmqFreeRspWrapper(rspWrapper);
taosFreeQitem(pollRspWrapper);
}
} else if (rspWrapper->tmqRspType == TMQ_MSG_TYPE__POLL_META_RSP) {
SMqPollRspWrapper* pollRspWrapper = (SMqPollRspWrapper*)rspWrapper;
int32_t consumerEpoch = atomic_load_32(&tmq->epoch);
+
+ tscDebug("consumer:0x%" PRIx64 " process meta rsp", tmq->consumerId);
+
if (pollRspWrapper->metaRsp.head.epoch == consumerEpoch) {
SMqClientVg* pVg = pollRspWrapper->vgHandle;
/*printf("vgId:%d, offset %" PRId64 " up to %" PRId64 "\n", pVg->vgId, pVg->currentOffset,
@@ -1756,8 +1833,8 @@ void* tmqHandleAllRsp(tmq_t* tmq, int64_t timeout, bool pollIfReset) {
taosFreeQitem(pollRspWrapper);
return pRsp;
} else {
- tscDebug("msg discard since epoch mismatch: msg epoch %d, consumer epoch %d",
- pollRspWrapper->metaRsp.head.epoch, consumerEpoch);
+ tscDebug("consumer:0x%"PRIx64" msg discard since epoch mismatch: msg epoch %d, consumer epoch %d",
+ tmq->consumerId, pollRspWrapper->metaRsp.head.epoch, consumerEpoch);
tmqFreeRspWrapper(rspWrapper);
taosFreeQitem(pollRspWrapper);
}
@@ -1787,8 +1864,8 @@ void* tmqHandleAllRsp(tmq_t* tmq, int64_t timeout, bool pollIfReset) {
taosFreeQitem(pollRspWrapper);
return pRsp;
} else {
- tscDebug("msg discard since epoch mismatch: msg epoch %d, consumer epoch %d",
- pollRspWrapper->taosxRsp.head.epoch, consumerEpoch);
+ tscDebug("consumer:0x%"PRIx64" msg discard since epoch mismatch: msg epoch %d, consumer epoch %d",
+ tmq->consumerId, pollRspWrapper->taosxRsp.head.epoch, consumerEpoch);
tmqFreeRspWrapper(rspWrapper);
taosFreeQitem(pollRspWrapper);
}
@@ -1798,7 +1875,7 @@ void* tmqHandleAllRsp(tmq_t* tmq, int64_t timeout, bool pollIfReset) {
tmqHandleNoPollRsp(tmq, rspWrapper, &reset);
taosFreeQitem(rspWrapper);
if (pollIfReset && reset) {
- tscDebug("consumer:%" PRId64 ", reset and repoll", tmq->consumerId);
+ tscDebug("consumer:0x%" PRIx64 ", reset and repoll", tmq->consumerId);
tmqPollImpl(tmq, timeout);
}
}
@@ -1809,7 +1886,7 @@ TAOS_RES* tmq_consumer_poll(tmq_t* tmq, int64_t timeout) {
void* rspObj;
int64_t startTime = taosGetTimestampMs();
- tscDebug("consumer:%" PRId64 ", start poll at %" PRId64, tmq->consumerId, startTime);
+ tscDebug("consumer:0x%" PRIx64 " start to poll at %" PRId64, tmq->consumerId, startTime);
#if 0
tmqHandleAllDelayedTask(tmq);
@@ -1822,7 +1899,7 @@ TAOS_RES* tmq_consumer_poll(tmq_t* tmq, int64_t timeout) {
// in no topic status, delayed task also need to be processed
if (atomic_load_8(&tmq->status) == TMQ_CONSUMER_STATUS__INIT) {
- tscDebug("consumer:%" PRId64 ", poll return since consumer status is init", tmq->consumerId);
+ tscDebug("consumer:0x%" PRIx64 " poll return since consumer is init", tmq->consumerId);
return NULL;
}
@@ -1832,38 +1909,41 @@ TAOS_RES* tmq_consumer_poll(tmq_t* tmq, int64_t timeout) {
if (retryCnt++ > 10) {
return NULL;
}
- tscDebug("consumer not ready, retry");
+
+ tscDebug("consumer:0x%"PRIx64" not ready, retry:%d/10 in 500ms", tmq->consumerId, retryCnt);
taosMsleep(500);
}
}
while (1) {
tmqHandleAllDelayedTask(tmq);
+
if (tmqPollImpl(tmq, timeout) < 0) {
- tscDebug("consumer:%" PRId64 " return since poll err", tmq->consumerId);
+ tscDebug("consumer:0x%" PRIx64 " return due to poll error", tmq->consumerId);
/*return NULL;*/
}
rspObj = tmqHandleAllRsp(tmq, timeout, false);
if (rspObj) {
- tscDebug("consumer:%" PRId64 ", return rsp %p", tmq->consumerId, rspObj);
+ tscDebug("consumer:0x%" PRIx64 " return rsp %p", tmq->consumerId, rspObj);
return (TAOS_RES*)rspObj;
} else if (terrno == TSDB_CODE_TQ_NO_COMMITTED_OFFSET) {
- tscDebug("consumer:%" PRId64 ", return null since no committed offset", tmq->consumerId);
+ tscDebug("consumer:0x%" PRIx64 " return null since no committed offset", tmq->consumerId);
return NULL;
}
+
if (timeout != -1) {
int64_t currentTime = taosGetTimestampMs();
- int64_t passedTime = currentTime - startTime;
- if (passedTime > timeout) {
- tscDebug("consumer:%" PRId64 ", (epoch %d) timeout, no rsp, start time %" PRId64 ", current time %" PRId64,
+ int64_t elapsedTime = currentTime - startTime;
+ if (elapsedTime > timeout) {
+ tscDebug("consumer:0x%" PRIx64 " (epoch %d) timeout, no rsp, start time %" PRId64 ", current time %" PRId64,
tmq->consumerId, tmq->epoch, startTime, currentTime);
return NULL;
}
- /*tscInfo("consumer:%" PRId64 ", (epoch %d) wait, start time %" PRId64 ", current time %" PRId64*/
+ /*tscInfo("consumer:0x%" PRIx64 ", (epoch %d) wait, start time %" PRId64 ", current time %" PRId64*/
/*", left time %" PRId64,*/
- /*tmq->consumerId, tmq->epoch, startTime, currentTime, (timeout - passedTime));*/
- tsem_timewait(&tmq->rspSem, (timeout - passedTime));
+ /*tmq->consumerId, tmq->epoch, startTime, currentTime, (timeout - elapsedTime));*/
+ tsem_timewait(&tmq->rspSem, (timeout - elapsedTime));
} else {
// use tsem_timewait instead of tsem_wait to avoid unexpected stuck
tsem_timewait(&tmq->rspSem, 1000);
diff --git a/source/client/test/clientTests.cpp b/source/client/test/clientTests.cpp
index 82202b8820212fddfe401c769b77003fde2982fc..a3b1c4f7791879361630566cc2aead282b0e63a2 100644
--- a/source/client/test/clientTests.cpp
+++ b/source/client/test/clientTests.cpp
@@ -112,7 +112,7 @@ void createNewTable(TAOS* pConn, int32_t index) {
}
taos_free_result(pRes);
- for(int32_t i = 0; i < 20; i += 20) {
+ for(int32_t i = 0; i < 2000; i += 20) {
char sql[1024] = {0};
sprintf(sql,
"insert into tu%d values(now+%da, %d)(now+%da, %d)(now+%da, %d)(now+%da, %d)"
@@ -162,6 +162,11 @@ void *queryThread(void *arg) {
}
static int32_t numOfThreads = 1;
+
+void tmq_commit_cb_print(tmq_t *pTmq, int32_t code, void *param) {
+ printf("success, code:%d\n", code);
+}
+
} // namespace
int main(int argc, char** argv) {
@@ -176,12 +181,12 @@ int main(int argc, char** argv) {
return RUN_ALL_TESTS();
}
-TEST(testCase, driverInit_Test) {
+TEST(clientCase, driverInit_Test) {
// taosInitGlobalCfg();
// taos_init();
}
-TEST(testCase, connect_Test) {
+TEST(clientCase, connect_Test) {
taos_options(TSDB_OPTION_CONFIGDIR, "~/first/cfg");
TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0);
@@ -190,8 +195,8 @@ TEST(testCase, connect_Test) {
}
taos_close(pConn);
}
-#if 0
-TEST(testCase, create_user_Test) {
+
+TEST(clientCase, create_user_Test) {
TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0);
assert(pConn != NULL);
@@ -204,7 +209,7 @@ TEST(testCase, create_user_Test) {
taos_close(pConn);
}
-TEST(testCase, create_account_Test) {
+TEST(clientCase, create_account_Test) {
TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0);
assert(pConn != NULL);
@@ -217,7 +222,7 @@ TEST(testCase, create_account_Test) {
taos_close(pConn);
}
-TEST(testCase, drop_account_Test) {
+TEST(clientCase, drop_account_Test) {
TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0);
assert(pConn != NULL);
@@ -230,7 +235,7 @@ TEST(testCase, drop_account_Test) {
taos_close(pConn);
}
-TEST(testCase, show_user_Test) {
+TEST(clientCase, show_user_Test) {
TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0);
assert(pConn != NULL);
@@ -250,7 +255,7 @@ TEST(testCase, show_user_Test) {
taos_close(pConn);
}
-TEST(testCase, drop_user_Test) {
+TEST(clientCase, drop_user_Test) {
TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0);
assert(pConn != NULL);
@@ -263,7 +268,7 @@ TEST(testCase, drop_user_Test) {
taos_close(pConn);
}
-TEST(testCase, show_db_Test) {
+TEST(clientCase, show_db_Test) {
TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0);
assert(pConn != NULL);
@@ -282,7 +287,7 @@ TEST(testCase, show_db_Test) {
taos_close(pConn);
}
-TEST(testCase, create_db_Test) {
+TEST(clientCase, create_db_Test) {
TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0);
assert(pConn != NULL);
@@ -306,7 +311,7 @@ TEST(testCase, create_db_Test) {
taos_close(pConn);
}
-TEST(testCase, create_dnode_Test) {
+TEST(clientCase, create_dnode_Test) {
TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0);
assert(pConn != NULL);
@@ -325,7 +330,7 @@ TEST(testCase, create_dnode_Test) {
taos_close(pConn);
}
-TEST(testCase, drop_dnode_Test) {
+TEST(clientCase, drop_dnode_Test) {
TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0);
assert(pConn != NULL);
@@ -349,7 +354,7 @@ TEST(testCase, drop_dnode_Test) {
taos_close(pConn);
}
-TEST(testCase, use_db_test) {
+TEST(clientCase, use_db_test) {
TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0);
assert(pConn != NULL);
@@ -367,7 +372,7 @@ TEST(testCase, use_db_test) {
taos_close(pConn);
}
-// TEST(testCase, drop_db_test) {
+// TEST(clientCase, drop_db_test) {
// TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0);
// assert(pConn != NULL);
//
@@ -389,7 +394,7 @@ TEST(testCase, use_db_test) {
// taos_close(pConn);
//}
-TEST(testCase, create_stable_Test) {
+TEST(clientCase, create_stable_Test) {
TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0);
assert(pConn != NULL);
@@ -428,7 +433,7 @@ TEST(testCase, create_stable_Test) {
taos_close(pConn);
}
-TEST(testCase, create_table_Test) {
+TEST(clientCase, create_table_Test) {
TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0);
assert(pConn != NULL);
@@ -447,7 +452,7 @@ TEST(testCase, create_table_Test) {
taos_close(pConn);
}
-TEST(testCase, create_ctable_Test) {
+TEST(clientCase, create_ctable_Test) {
TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0);
assert(pConn != NULL);
@@ -472,7 +477,7 @@ TEST(testCase, create_ctable_Test) {
taos_close(pConn);
}
-TEST(testCase, show_stable_Test) {
+TEST(clientCase, show_stable_Test) {
TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0);
assert(pConn != nullptr);
@@ -497,7 +502,7 @@ TEST(testCase, show_stable_Test) {
taos_close(pConn);
}
-TEST(testCase, show_vgroup_Test) {
+TEST(clientCase, show_vgroup_Test) {
TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0);
assert(pConn != NULL);
@@ -529,7 +534,7 @@ TEST(testCase, show_vgroup_Test) {
taos_close(pConn);
}
-TEST(testCase, create_multiple_tables) {
+TEST(clientCase, create_multiple_tables) {
TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0);
ASSERT_NE(pConn, nullptr);
@@ -600,7 +605,7 @@ TEST(testCase, create_multiple_tables) {
taos_close(pConn);
}
-TEST(testCase, show_table_Test) {
+TEST(clientCase, show_table_Test) {
TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0);
assert(pConn != NULL);
@@ -634,7 +639,7 @@ TEST(testCase, show_table_Test) {
taos_close(pConn);
}
-//TEST(testCase, drop_stable_Test) {
+//TEST(clientCase, drop_stable_Test) {
// TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0);
// assert(pConn != nullptr);
//
@@ -659,14 +664,14 @@ TEST(testCase, show_table_Test) {
// taos_close(pConn);
//}
-TEST(testCase, generated_request_id_test) {
+TEST(clientCase, generated_request_id_test) {
SHashObj* phash = taosHashInit(10000, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), false, HASH_ENTRY_LOCK);
for (int32_t i = 0; i < 50000; ++i) {
uint64_t v = generateRequestId();
void* result = taosHashGet(phash, &v, sizeof(v));
if (result != nullptr) {
- printf("0x%lx, index:%d\n", v, i);
+// printf("0x%llx, index:%d\n", v, i);
}
assert(result == nullptr);
taosHashPut(phash, &v, sizeof(v), NULL, 0);
@@ -675,7 +680,7 @@ TEST(testCase, generated_request_id_test) {
taosHashCleanup(phash);
}
-TEST(testCase, insert_test) {
+TEST(clientCase, insert_test) {
TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0);
ASSERT_NE(pConn, nullptr);
@@ -693,7 +698,7 @@ TEST(testCase, insert_test) {
taos_close(pConn);
}
-TEST(testCase, projection_query_tables) {
+TEST(clientCase, projection_query_tables) {
TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0);
ASSERT_NE(pConn, nullptr);
@@ -725,7 +730,7 @@ TEST(testCase, projection_query_tables) {
}
taos_free_result(pRes);
- for (int32_t i = 0; i < 200000; ++i) {
+ for (int32_t i = 0; i < 2; ++i) {
printf("create table :%d\n", i);
createNewTable(pConn, i);
}
@@ -751,7 +756,7 @@ TEST(testCase, projection_query_tables) {
taos_close(pConn);
}
-TEST(testCase, tsbs_perf_test) {
+TEST(clientCase, tsbs_perf_test) {
TdThread qid[20] = {0};
for(int32_t i = 0; i < numOfThreads; ++i) {
@@ -760,9 +765,7 @@ TEST(testCase, tsbs_perf_test) {
getchar();
}
-#endif
-
-TEST(testCase, projection_query_stables) {
+TEST(clientCase, projection_query_stables) {
TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0);
ASSERT_NE(pConn, nullptr);
@@ -790,8 +793,7 @@ TEST(testCase, projection_query_stables) {
taos_close(pConn);
}
-#if 0
-TEST(testCase, agg_query_tables) {
+TEST(clientCase, agg_query_tables) {
TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0);
ASSERT_NE(pConn, nullptr);
@@ -826,12 +828,12 @@ create table tm1 using m1 tags(2);
insert into tm0 values('2021-1-1 1:1:1.120', 1) ('2021-1-1 1:1:2.9', 2) tm1 values('2021-1-1 1:1:1.120', 11) ('2021-1-1 1:1:2.99', 22);
*/
-TEST(testCase, async_api_test) {
+TEST(clientCase, async_api_test) {
TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0);
ASSERT_NE(pConn, nullptr);
taos_query(pConn, "use abc1");
-#if 0
+
TAOS_RES* pRes = taos_query(pConn, "insert into tu(ts) values('2022-02-27 12:12:61')");
if (taos_errno(pRes) != 0) {
printf("failed, reason:%s\n", taos_errstr(pRes));
@@ -854,14 +856,13 @@ TEST(testCase, async_api_test) {
printf("%s\n", str);
memset(str, 0, sizeof(str));
}
-#endif
taos_query_a(pConn, "select count(*) from tu", queryCallback, pConn);
getchar();
taos_close(pConn);
}
-TEST(testCase, update_test) {
+TEST(clientCase, update_test) {
TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0);
ASSERT_NE(pConn, nullptr);
@@ -897,6 +898,76 @@ TEST(testCase, update_test) {
}
}
-#endif
+TEST(clientCase, subscription_test) {
+ TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0);
+ ASSERT_NE(pConn, nullptr);
+
+ // TAOS_RES* pRes = taos_query(pConn, "create topic topic_t1 as select * from t1");
+ // if (taos_errno(pRes) != TSDB_CODE_SUCCESS) {
+ // printf("failed to create topic, code:%s", taos_errstr(pRes));
+ // taos_free_result(pRes);
+ // return;
+ // }
+
+ tmq_conf_t* conf = tmq_conf_new();
+ tmq_conf_set(conf, "enable.auto.commit", "true");
+ tmq_conf_set(conf, "auto.commit.interval.ms", "1000");
+ tmq_conf_set(conf, "group.id", "consumer_group");
+ tmq_conf_set(conf, "td.connect.user", "root");
+ tmq_conf_set(conf, "td.connect.pass", "taosdata");
+ tmq_conf_set(conf, "auto.offset.reset", "earliest");
+ tmq_conf_set(conf, "experimental.snapshot.enable", "true");
+ tmq_conf_set(conf, "msg.with.table.name", "true");
+ tmq_conf_set_auto_commit_cb(conf, tmq_commit_cb_print, NULL);
+
+ tmq_t* tmq = tmq_consumer_new(conf, NULL, 0);
+ tmq_conf_destroy(conf);
+
+ // 创建订阅 topics 列表
+ tmq_list_t* topicList = tmq_list_new();
+ tmq_list_append(topicList, "topic_t1");
+
+ // 启动订阅
+ tmq_subscribe(tmq, topicList);
+ tmq_list_destroy(topicList);
+
+ TAOS_FIELD* fields = NULL;
+ int32_t numOfFields = 0;
+ int32_t precision = 0;
+ int32_t totalRows = 0;
+ int32_t msgCnt = 0;
+ int32_t timeout = 5000;
+
+ while (1) {
+ TAOS_RES* pRes = tmq_consumer_poll(tmq, timeout);
+ if (pRes) {
+ char buf[1024];
+ int32_t rows = 0;
+
+ const char* topicName = tmq_get_topic_name(pRes);
+ const char* dbName = tmq_get_db_name(pRes);
+ int32_t vgroupId = tmq_get_vgroup_id(pRes);
+
+ printf("topic: %s\n", topicName);
+ printf("db: %s\n", dbName);
+ printf("vgroup id: %d\n", vgroupId);
+
+ while (1) {
+ TAOS_ROW row = taos_fetch_row(pRes);
+ if (row == NULL) break;
+
+ fields = taos_fetch_fields(pRes);
+ numOfFields = taos_field_count(pRes);
+ precision = taos_result_precision(pRes);
+ rows++;
+ taos_print_row(buf, row, fields, numOfFields);
+ printf("precision: %d, row content: %s\n", precision, buf);
+ }
+ }
+// return rows;
+ }
+
+ fprintf(stderr, "%d msg consumed, include %d rows\n", msgCnt, totalRows);
+}
#pragma GCC diagnostic pop
diff --git a/source/common/src/tdatablock.c b/source/common/src/tdatablock.c
index f41eb1adaf0ea5b830ff2181073c9f5193704392..86dcd1eceb9e26dbf0da4ed02481287e851ceb79 100644
--- a/source/common/src/tdatablock.c
+++ b/source/common/src/tdatablock.c
@@ -1546,7 +1546,10 @@ size_t blockDataGetCapacityInRow(const SSDataBlock* pBlock, size_t pageSize) {
}
void colDataDestroy(SColumnInfoData* pColData) {
- if (!pColData) return;
+ if (!pColData) {
+ return;
+ }
+
if (IS_VAR_DATA_TYPE(pColData->info.type)) {
taosMemoryFreeClear(pColData->varmeta.offset);
} else {
@@ -2353,8 +2356,7 @@ const char* blockDecode(SSDataBlock* pBlock, const char* pData) {
pStart += sizeof(uint64_t);
if (pBlock->pDataBlock == NULL) {
- pBlock->pDataBlock = taosArrayInit(numOfCols, sizeof(SColumnInfoData));
- taosArraySetSize(pBlock->pDataBlock, numOfCols);
+ pBlock->pDataBlock = taosArrayInit_s(numOfCols, sizeof(SColumnInfoData), numOfCols);
}
for (int32_t i = 0; i < numOfCols; ++i) {
diff --git a/source/common/src/tglobal.c b/source/common/src/tglobal.c
index 037c8a45419353864c4e6b962beb641daf3b35c1..e3f08e912ab3bf955f5e1905439a317c4464e214 100644
--- a/source/common/src/tglobal.c
+++ b/source/common/src/tglobal.c
@@ -41,6 +41,7 @@ bool tsPrintAuth = false;
// queue & threads
int32_t tsNumOfRpcThreads = 1;
+int32_t tsNumOfRpcSessions = 2000;
int32_t tsNumOfCommitThreads = 2;
int32_t tsNumOfTaskQueueThreads = 4;
int32_t tsNumOfMnodeQueryThreads = 4;
@@ -54,7 +55,6 @@ int32_t tsNumOfQnodeQueryThreads = 4;
int32_t tsNumOfQnodeFetchThreads = 1;
int32_t tsNumOfSnodeStreamThreads = 4;
int32_t tsNumOfSnodeWriteThreads = 1;
-
// sync raft
int32_t tsElectInterval = 25 * 1000;
int32_t tsHeartbeatInterval = 1000;
@@ -76,11 +76,11 @@ bool tsEnableTelem = true;
int32_t tsTelemInterval = 43200;
char tsTelemServer[TSDB_FQDN_LEN] = "telemetry.taosdata.com";
uint16_t tsTelemPort = 80;
-char* tsTelemUri = "/report";
+char *tsTelemUri = "/report";
-bool tsEnableCrashReport = true;
-char* tsClientCrashReportUri = "/ccrashreport";
-char* tsSvrCrashReportUri = "/dcrashreport";
+bool tsEnableCrashReport = true;
+char *tsClientCrashReportUri = "/ccrashreport";
+char *tsSvrCrashReportUri = "/dcrashreport";
// schemaless
char tsSmlTagName[TSDB_COL_NAME_LEN] = "_tag_null";
@@ -140,6 +140,7 @@ int32_t tsMaxMemUsedByInsert = 1024;
float tsSelectivityRatio = 1.0;
int32_t tsTagFilterResCacheSize = 1024 * 10;
+char tsTagFilterCache = 0;
// the maximum allowed query buffer size during query processing for each data node.
// -1 no limit (default)
@@ -188,6 +189,7 @@ int32_t tsGrantHBInterval = 60;
int32_t tsUptimeInterval = 300; // seconds
char tsUdfdResFuncs[512] = ""; // udfd resident funcs that teardown when udfd exits
char tsUdfdLdLibPath[512] = "";
+bool tsDisableStream = false;
#ifndef _STORAGE
int32_t taosSetTfsCfg(SConfig *pCfg) {
@@ -210,9 +212,7 @@ int32_t taosSetTfsCfg(SConfig *pCfg) {
int32_t taosSetTfsCfg(SConfig *pCfg);
#endif
-struct SConfig *taosGetCfg() {
- return tsCfg;
-}
+struct SConfig *taosGetCfg() { return tsCfg; }
static int32_t taosLoadCfg(SConfig *pCfg, const char **envCmd, const char *inputCfgDir, const char *envFile,
char *apolloUrl) {
@@ -351,6 +351,7 @@ static int32_t taosAddSystemCfg(SConfig *pCfg) {
if (cfgAddBool(pCfg, "AVX2", tsAVX2Enable, 0) != 0) return -1;
if (cfgAddBool(pCfg, "FMA", tsFMAEnable, 0) != 0) return -1;
if (cfgAddBool(pCfg, "SIMD-builtins", tsSIMDBuiltins, 0) != 0) return -1;
+ if (cfgAddBool(pCfg, "tagFilterCache", tsTagFilterCache, 0) != 0) return -1;
if (cfgAddInt64(pCfg, "openMax", tsOpenMax, 0, INT64_MAX, 1) != 0) return -1;
if (cfgAddInt64(pCfg, "streamMax", tsStreamMax, 0, INT64_MAX, 1) != 0) return -1;
@@ -388,9 +389,12 @@ static int32_t taosAddServerCfg(SConfig *pCfg) {
if (cfgAddInt32(pCfg, "queryRspPolicy", tsQueryRspPolicy, 0, 1, 0) != 0) return -1;
tsNumOfRpcThreads = tsNumOfCores / 2;
- tsNumOfRpcThreads = TRANGE(tsNumOfRpcThreads, 1, TSDB_MAX_RPC_THREADS);
+ tsNumOfRpcThreads = TRANGE(tsNumOfRpcThreads, 2, TSDB_MAX_RPC_THREADS);
if (cfgAddInt32(pCfg, "numOfRpcThreads", tsNumOfRpcThreads, 1, 1024, 0) != 0) return -1;
+ tsNumOfRpcSessions = TRANGE(tsNumOfRpcSessions, 100, 10000);
+ if (cfgAddInt32(pCfg, "numOfRpcSessions", tsNumOfRpcSessions, 1, 100000, 0) != 0) return -1;
+
tsNumOfCommitThreads = tsNumOfCores / 2;
tsNumOfCommitThreads = TRANGE(tsNumOfCommitThreads, 2, 4);
if (cfgAddInt32(pCfg, "numOfCommitThreads", tsNumOfCommitThreads, 1, 1024, 0) != 0) return -1;
@@ -467,6 +471,8 @@ static int32_t taosAddServerCfg(SConfig *pCfg) {
if (cfgAddString(pCfg, "udfdResFuncs", tsUdfdResFuncs, 0) != 0) return -1;
if (cfgAddString(pCfg, "udfdLdLibPath", tsUdfdLdLibPath, 0) != 0) return -1;
+ if (cfgAddBool(pCfg, "disableStream", tsDisableStream, 0) != 0) return -1;
+
GRANT_CFG_ADD;
return 0;
}
@@ -496,11 +502,19 @@ static int32_t taosUpdateServerCfg(SConfig *pCfg) {
pItem = cfgGetItem(tsCfg, "numOfRpcThreads");
if (pItem != NULL && pItem->stype == CFG_STYPE_DEFAULT) {
tsNumOfRpcThreads = numOfCores / 2;
- tsNumOfRpcThreads = TRANGE(tsNumOfRpcThreads, 1, 4);
+ tsNumOfRpcThreads = TRANGE(tsNumOfRpcThreads, 2, TSDB_MAX_RPC_THREADS);
pItem->i32 = tsNumOfRpcThreads;
pItem->stype = stype;
}
+ pItem = cfgGetItem(tsCfg, "numOfRpcSessions");
+ if (pItem != NULL && pItem->stype == CFG_STYPE_DEFAULT) {
+ tsNumOfRpcSessions = 2000;
+ tsNumOfRpcSessions = TRANGE(tsNumOfRpcSessions, 100, 10000);
+ pItem->i32 = tsNumOfRpcSessions;
+ pItem->stype = stype;
+ }
+
pItem = cfgGetItem(tsCfg, "numOfCommitThreads");
if (pItem != NULL && pItem->stype == CFG_STYPE_DEFAULT) {
tsNumOfCommitThreads = numOfCores / 2;
@@ -718,6 +732,7 @@ static int32_t taosSetServerCfg(SConfig *pCfg) {
tsPrintAuth = cfgGetItem(pCfg, "printAuth")->bval;
tsNumOfRpcThreads = cfgGetItem(pCfg, "numOfRpcThreads")->i32;
+ tsNumOfRpcSessions = cfgGetItem(pCfg, "numOfRpcSessions")->i32;
tsNumOfCommitThreads = cfgGetItem(pCfg, "numOfCommitThreads")->i32;
tsNumOfMnodeReadThreads = cfgGetItem(pCfg, "numOfMnodeReadThreads")->i32;
tsNumOfVnodeQueryThreads = cfgGetItem(pCfg, "numOfVnodeQueryThreads")->i32;
@@ -731,6 +746,7 @@ static int32_t taosSetServerCfg(SConfig *pCfg) {
tsRpcQueueMemoryAllowed = cfgGetItem(pCfg, "rpcQueueMemoryAllowed")->i64;
tsSIMDBuiltins = (bool)cfgGetItem(pCfg, "SIMD-builtins")->bval;
+ tsTagFilterCache = (bool)cfgGetItem(pCfg, "tagFilterCache")->bval;
tsEnableMonitor = cfgGetItem(pCfg, "monitor")->bval;
tsMonitorInterval = cfgGetItem(pCfg, "monitorInterval")->i32;
@@ -767,6 +783,9 @@ static int32_t taosSetServerCfg(SConfig *pCfg) {
if (tsQueryBufferSize >= 0) {
tsQueryBufferSizeBytes = tsQueryBufferSize * 1048576UL;
}
+
+ tsDisableStream = cfgGetItem(pCfg, "disableStream")->bval;
+
GRANT_CFG_GET;
return 0;
}
@@ -973,6 +992,8 @@ int32_t taosSetCfg(SConfig *pCfg, char *name) {
tsNumOfTaskQueueThreads = cfgGetItem(pCfg, "numOfTaskQueueThreads")->i32;
} else if (strcasecmp("numOfRpcThreads", name) == 0) {
tsNumOfRpcThreads = cfgGetItem(pCfg, "numOfRpcThreads")->i32;
+ } else if (strcasecmp("numOfRpcSessions", name) == 0) {
+ tsNumOfRpcSessions = cfgGetItem(pCfg, "numOfRpcSessions")->i32;
} else if (strcasecmp("numOfCommitThreads", name) == 0) {
tsNumOfCommitThreads = cfgGetItem(pCfg, "numOfCommitThreads")->i32;
} else if (strcasecmp("numOfMnodeReadThreads", name) == 0) {
diff --git a/source/common/src/tmisce.c b/source/common/src/tmisce.c
index dfb1917fcfbeddf5814a6689bba8864be44c180e..59afce1bbbf342ac61392c8e26dd44628c9505de 100644
--- a/source/common/src/tmisce.c
+++ b/source/common/src/tmisce.c
@@ -60,6 +60,19 @@ bool isEpsetEqual(const SEpSet* s1, const SEpSet* s2) {
return true;
}
+void epsetAssign(SEpSet* pDst, const SEpSet* pSrc) {
+ if (pSrc == NULL || pDst == NULL) {
+ return;
+ }
+
+ pDst->inUse = pSrc->inUse;
+ pDst->numOfEps = pSrc->numOfEps;
+ for (int32_t i = 0; i < pSrc->numOfEps; ++i) {
+ pDst->eps[i].port = pSrc->eps[i].port;
+ tstrncpy(pDst->eps[i].fqdn, pSrc->eps[i].fqdn, tListLen(pSrc->eps[i].fqdn));
+ }
+}
+
void updateEpSet_s(SCorEpSet* pEpSet, SEpSet* pNewEpSet) {
taosCorBeginWrite(&pEpSet->version);
pEpSet->epSet = *pNewEpSet;
diff --git a/source/common/src/tmsg.c b/source/common/src/tmsg.c
index 891f5e21ab44e88acebf3adbd5da95e668e23ecd..44d3f7be25d5ee9eea280b1e089973ff459a11e7 100644
--- a/source/common/src/tmsg.c
+++ b/source/common/src/tmsg.c
@@ -5425,6 +5425,8 @@ int32_t tSerializeSCMCreateStreamReq(void *buf, int32_t bufLen, const SCMCreateS
if (tEncodeI32(&encoder, pField->bytes) < 0) return -1;
if (tEncodeCStr(&encoder, pField->name) < 0) return -1;
}
+ if (tEncodeI64(&encoder, pReq->deleteMark) < 0) return -1;
+ if (tEncodeI8(&encoder, pReq->igUpdate) < 0) return -1;
tEndEncode(&encoder);
@@ -5486,6 +5488,9 @@ int32_t tDeserializeSCMCreateStreamReq(void *buf, int32_t bufLen, SCMCreateStrea
}
}
+ if (tDecodeI64(&decoder, &pReq->deleteMark) < 0) return -1;
+ if (tDecodeI8(&decoder, &pReq->igUpdate) < 0) return -1;
+
tEndDecode(&decoder);
tDecoderClear(&decoder);
diff --git a/source/dnode/mgmt/mgmt_mnode/src/mmWorker.c b/source/dnode/mgmt/mgmt_mnode/src/mmWorker.c
index 095857825d3e02753a9be3a257af54815dabc973..b0810d528f761d6362b27a818636d52e8421429c 100644
--- a/source/dnode/mgmt/mgmt_mnode/src/mmWorker.c
+++ b/source/dnode/mgmt/mgmt_mnode/src/mmWorker.c
@@ -49,7 +49,7 @@ static void mmProcessRpcMsg(SQueueInfo *pInfo, SRpcMsg *pMsg) {
pMsg->info.node = pMgmt->pMnode;
const STraceId *trace = &pMsg->info.traceId;
- dGTrace("msg:%p, get from mnode queue", pMsg);
+ dGTrace("msg:%p, get from mnode queue, type:%s", pMsg, TMSG_INFO(pMsg->msgType));
int32_t code = mndProcessRpcMsg(pMsg);
diff --git a/source/dnode/mgmt/node_mgmt/src/dmTransport.c b/source/dnode/mgmt/node_mgmt/src/dmTransport.c
index dcb63f65246cfc103790c2e46b2ca4c8bd4beafe..3a1ca161a994ebd65a0471a13f49837eaeab48d4 100644
--- a/source/dnode/mgmt/node_mgmt/src/dmTransport.c
+++ b/source/dnode/mgmt/node_mgmt/src/dmTransport.c
@@ -280,10 +280,19 @@ int32_t dmInitClient(SDnode *pDnode) {
rpcInit.retryMaxInterval = tsRedirectMaxPeriod;
rpcInit.retryMaxTimouet = tsMaxRetryWaitTime;
- rpcInit.failFastInterval = 1000; // interval threshold(ms)
+ rpcInit.failFastInterval = 5000; // interval threshold(ms)
rpcInit.failFastThreshold = 3; // failed threshold
rpcInit.ffp = dmFailFastFp;
+ int32_t connLimitNum = tsNumOfRpcSessions / (tsNumOfRpcThreads * 3);
+ connLimitNum = TMAX(connLimitNum, 10);
+ connLimitNum = TMIN(connLimitNum, 500);
+
+ rpcInit.connLimitNum = connLimitNum;
+ rpcInit.connLimitLock = 1;
+ rpcInit.supportBatch = 1;
+ rpcInit.batchSize = 8 * 1024;
+
pTrans->clientRpc = rpcOpen(&rpcInit);
if (pTrans->clientRpc == NULL) {
dError("failed to init dnode rpc client");
diff --git a/source/dnode/mnode/impl/inc/mndDef.h b/source/dnode/mnode/impl/inc/mndDef.h
index 2f824b48b4b22eb6c758d05ee30787099278a9f2..6f6f801c39a6e8d292d3adf4b52840b0f747ed66 100644
--- a/source/dnode/mnode/impl/inc/mndDef.h
+++ b/source/dnode/mnode/impl/inc/mndDef.h
@@ -648,6 +648,7 @@ typedef struct {
int64_t checkpointFreq; // ms
int64_t currentTick; // do not serialize
int64_t deleteMark;
+ int8_t igCheckUpdate;
} SStreamObj;
int32_t tEncodeSStreamObj(SEncoder* pEncoder, const SStreamObj* pObj);
diff --git a/source/dnode/mnode/impl/inc/mndInt.h b/source/dnode/mnode/impl/inc/mndInt.h
index 785ecc2bf502ca5f2a1e1203f1dc5fbe29b60a21..d851578a744f740cf0e211ee6928b2ec3f0dd705 100644
--- a/source/dnode/mnode/impl/inc/mndInt.h
+++ b/source/dnode/mnode/impl/inc/mndInt.h
@@ -58,7 +58,7 @@ typedef int32_t (*MndInitFp)(SMnode *pMnode);
typedef void (*MndCleanupFp)(SMnode *pMnode);
typedef int32_t (*ShowRetrieveFp)(SRpcMsg *pMsg, SShowObj *pShow, SSDataBlock *pBlock, int32_t rows);
typedef void (*ShowFreeIterFp)(SMnode *pMnode, void *pIter);
-typedef struct SQWorker SQHandle;
+typedef struct SQueueWorker SQHandle;
typedef struct {
const char *name;
diff --git a/source/dnode/mnode/impl/inc/mndTrans.h b/source/dnode/mnode/impl/inc/mndTrans.h
index 07066d2251235d325aa9f64f2751c8248e8c7e54..d6e5d322baf28dbad41d0ea13124e1ec21588f0b 100644
--- a/source/dnode/mnode/impl/inc/mndTrans.h
+++ b/source/dnode/mnode/impl/inc/mndTrans.h
@@ -81,7 +81,7 @@ int32_t mndTransPrepare(SMnode *pMnode, STrans *pTrans);
int32_t mndTransProcessRsp(SRpcMsg *pRsp);
void mndTransPullup(SMnode *pMnode);
int32_t mndKillTrans(SMnode *pMnode, STrans *pTrans);
-void mndTransExecute(SMnode *pMnode, STrans *pTrans);
+void mndTransExecute(SMnode *pMnode, STrans *pTrans, bool isLeader);
int32_t mndSetRpcInfoForDbTrans(SMnode *pMnode, SRpcMsg *pMsg, EOperType oper, const char *dbname);
#ifdef __cplusplus
diff --git a/source/dnode/mnode/impl/src/mndConsumer.c b/source/dnode/mnode/impl/src/mndConsumer.c
index 1aa2fa997b684221e1d1cd61b85cdf5f1c6cc669..d167c9c09ade88c6e2692bae07858a9591e3ac88 100644
--- a/source/dnode/mnode/impl/src/mndConsumer.c
+++ b/source/dnode/mnode/impl/src/mndConsumer.c
@@ -238,7 +238,9 @@ static int32_t mndProcessMqTimerMsg(SRpcMsg *pMsg) {
// iterate all consumers, find all modification
while (1) {
pIter = sdbFetch(pSdb, SDB_CONSUMER, pIter, (void **)&pConsumer);
- if (pIter == NULL) break;
+ if (pIter == NULL) {
+ break;
+ }
int32_t hbStatus = atomic_add_fetch_32(&pConsumer->hbStatus, 1);
int32_t status = atomic_load_32(&pConsumer->status);
@@ -335,7 +337,7 @@ static int32_t mndProcessMqHbReq(SRpcMsg *pMsg) {
int64_t consumerId = req.consumerId;
SMqConsumerObj *pConsumer = mndAcquireConsumer(pMnode, consumerId);
if (pConsumer == NULL) {
- mError("consumer %" PRId64 " not exist", consumerId);
+ mError("consumer:0x%"PRIx64 " not exist", consumerId);
terrno = TSDB_CODE_MND_CONSUMER_NOT_EXIST;
return -1;
}
@@ -345,7 +347,7 @@ static int32_t mndProcessMqHbReq(SRpcMsg *pMsg) {
int32_t status = atomic_load_32(&pConsumer->status);
if (status == MQ_CONSUMER_STATUS__LOST_REBD) {
- mInfo("try to recover consumer %" PRId64 "", consumerId);
+ mInfo("try to recover consumer:0x%"PRIx64 "", consumerId);
SMqConsumerRecoverMsg *pRecoverMsg = rpcMallocCont(sizeof(SMqConsumerRecoverMsg));
pRecoverMsg->consumerId = consumerId;
@@ -390,7 +392,7 @@ static int32_t mndProcessAskEpReq(SRpcMsg *pMsg) {
#if 1
if (status == MQ_CONSUMER_STATUS__LOST_REBD) {
- mInfo("try to recover consumer %" PRId64 "", consumerId);
+ mInfo("try to recover consumer:0x%"PRIx64 "", consumerId);
SMqConsumerRecoverMsg *pRecoverMsg = rpcMallocCont(sizeof(SMqConsumerRecoverMsg));
pRecoverMsg->consumerId = consumerId;
@@ -404,14 +406,14 @@ static int32_t mndProcessAskEpReq(SRpcMsg *pMsg) {
#endif
if (status != MQ_CONSUMER_STATUS__READY) {
- mInfo("consumer %" PRId64 " not ready, status: %s", consumerId, mndConsumerStatusName(status));
+ mInfo("consumer:0x%"PRIx64 " not ready, status: %s", consumerId, mndConsumerStatusName(status));
terrno = TSDB_CODE_MND_CONSUMER_NOT_READY;
return -1;
}
int32_t serverEpoch = atomic_load_32(&pConsumer->epoch);
- // 2. check epoch, only send ep info when epoches do not match
+ // 2. check epoch, only send ep info when epochs do not match
if (epoch != serverEpoch) {
taosRLockLatch(&pConsumer->lock);
mInfo("process ask ep, consumer:%" PRId64 "(epoch %d), server epoch %d", consumerId, epoch, serverEpoch);
@@ -526,12 +528,14 @@ int32_t mndSetConsumerCommitLogs(SMnode *pMnode, STrans *pTrans, SMqConsumerObj
return 0;
}
-static int32_t mndProcessSubscribeReq(SRpcMsg *pMsg) {
- SMnode *pMnode = pMsg->info.node;
- char *msgStr = pMsg->pCont;
+int32_t mndProcessSubscribeReq(SRpcMsg *pMsg) {
+ SMnode *pMnode = pMsg->info.node;
+ char *msgStr = pMsg->pCont;
+
SCMSubscribeReq subscribe = {0};
tDeserializeSCMSubscribeReq(msgStr, &subscribe);
- int64_t consumerId = subscribe.consumerId;
+
+ uint64_t consumerId = subscribe.consumerId;
char *cgroup = subscribe.cgroup;
SMqConsumerObj *pConsumerOld = NULL;
SMqConsumerObj *pConsumerNew = NULL;
@@ -542,21 +546,23 @@ static int32_t mndProcessSubscribeReq(SRpcMsg *pMsg) {
taosArrayRemoveDuplicateP(newSub, taosArrayCompareString, taosMemoryFree);
int32_t newTopicNum = taosArrayGetSize(newSub);
+
// check topic existance
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_NOTHING, pMsg, "subscribe");
- if (pTrans == NULL) goto SUBSCRIBE_OVER;
+ if (pTrans == NULL) {
+ goto _over;
+ }
for (int32_t i = 0; i < newTopicNum; i++) {
char *topic = taosArrayGetP(newSub, i);
SMqTopicObj *pTopic = mndAcquireTopic(pMnode, topic);
- if (pTopic == NULL) {
- terrno = TSDB_CODE_MND_TOPIC_NOT_EXIST;
- goto SUBSCRIBE_OVER;
+ if (pTopic == NULL) { // terrno has been set by callee function
+ goto _over;
}
if (mndCheckTopicPrivilege(pMnode, pMsg->info.conn.user, MND_OPER_SUBSCRIBE, pTopic) != 0) {
mndReleaseTopic(pMnode, pTopic);
- goto SUBSCRIBE_OVER;
+ goto _over;
}
mndReleaseTopic(pMnode, pTopic);
@@ -578,8 +584,8 @@ static int32_t mndProcessSubscribeReq(SRpcMsg *pMsg) {
taosArrayPush(pConsumerNew->assignedTopics, &newTopicCopy);
}
- if (mndSetConsumerCommitLogs(pMnode, pTrans, pConsumerNew) != 0) goto SUBSCRIBE_OVER;
- if (mndTransPrepare(pMnode, pTrans) != 0) goto SUBSCRIBE_OVER;
+ if (mndSetConsumerCommitLogs(pMnode, pTrans, pConsumerNew) != 0) goto _over;
+ if (mndTransPrepare(pMnode, pTrans) != 0) goto _over;
} else {
/*taosRLockLatch(&pConsumerOld->lock);*/
@@ -591,13 +597,13 @@ static int32_t mndProcessSubscribeReq(SRpcMsg *pMsg) {
if (status != MQ_CONSUMER_STATUS__READY) {
terrno = TSDB_CODE_MND_CONSUMER_NOT_READY;
- goto SUBSCRIBE_OVER;
+ goto _over;
}
pConsumerNew = tNewSMqConsumerObj(consumerId, cgroup);
if (pConsumerNew == NULL) {
terrno = TSDB_CODE_OUT_OF_MEMORY;
- goto SUBSCRIBE_OVER;
+ goto _over;
}
pConsumerNew->updateType = CONSUMER_UPDATE__MODIFY;
@@ -650,16 +656,16 @@ static int32_t mndProcessSubscribeReq(SRpcMsg *pMsg) {
/*if (taosArrayGetSize(pConsumerNew->assignedTopics) == 0) {*/
/*pConsumerNew->updateType = */
/*}*/
- goto SUBSCRIBE_OVER;
+ goto _over;
}
- if (mndSetConsumerCommitLogs(pMnode, pTrans, pConsumerNew) != 0) goto SUBSCRIBE_OVER;
- if (mndTransPrepare(pMnode, pTrans) != 0) goto SUBSCRIBE_OVER;
+ if (mndSetConsumerCommitLogs(pMnode, pTrans, pConsumerNew) != 0) goto _over;
+ if (mndTransPrepare(pMnode, pTrans) != 0) goto _over;
}
code = TSDB_CODE_ACTION_IN_PROGRESS;
-SUBSCRIBE_OVER:
+_over:
mndTransDrop(pTrans);
if (pConsumerOld) {
@@ -971,16 +977,19 @@ static int32_t mndRetrieveConsumer(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *
while (numOfRows < rowsCapacity) {
pShow->pIter = sdbFetch(pSdb, SDB_CONSUMER, pShow->pIter, (void **)&pConsumer);
- if (pShow->pIter == NULL) break;
+ if (pShow->pIter == NULL) {
+ break;
+ }
+
if (taosArrayGetSize(pConsumer->assignedTopics) == 0) {
- mDebug("showing consumer %" PRId64 " no assigned topic, skip", pConsumer->consumerId);
+ mDebug("showing consumer:0x%"PRIx64 " no assigned topic, skip", pConsumer->consumerId);
sdbRelease(pSdb, pConsumer);
continue;
}
taosRLockLatch(&pConsumer->lock);
- mDebug("showing consumer %" PRId64, pConsumer->consumerId);
+ mDebug("showing consumer:0x%"PRIx64, pConsumer->consumerId);
int32_t topicSz = taosArrayGetSize(pConsumer->assignedTopics);
bool hasTopic = true;
diff --git a/source/dnode/mnode/impl/src/mndDef.c b/source/dnode/mnode/impl/src/mndDef.c
index a5f77513de9f6de359acf129612136af1762fa68..c033c3eea9cc1e992216f633912425efad7b616a 100644
--- a/source/dnode/mnode/impl/src/mndDef.c
+++ b/source/dnode/mnode/impl/src/mndDef.c
@@ -78,6 +78,7 @@ int32_t tEncodeSStreamObj(SEncoder *pEncoder, const SStreamObj *pObj) {
// 3.0.20
if (tEncodeI64(pEncoder, pObj->checkpointFreq) < 0) return -1;
+ if (tEncodeI8(pEncoder, pObj->igCheckUpdate) < 0) return -1;
tEndEncode(pEncoder);
return pEncoder->pos;
@@ -145,6 +146,9 @@ int32_t tDecodeSStreamObj(SDecoder *pDecoder, SStreamObj *pObj, int32_t sver) {
// 3.0.20
if (sver >= 2) {
if (tDecodeI64(pDecoder, &pObj->checkpointFreq) < 0) return -1;
+ if (!tDecodeIsEnd(pDecoder)) {
+ if (tDecodeI8(pDecoder, &pObj->igCheckUpdate) < 0) return -1;
+ }
}
tEndDecode(pDecoder);
return 0;
@@ -409,19 +413,21 @@ void *tDecodeSMqConsumerEp(const void *buf, SMqConsumerEp *pConsumerEp) {
return (void *)buf;
}
-SMqSubscribeObj *tNewSubscribeObj(const char key[TSDB_SUBSCRIBE_KEY_LEN]) {
- SMqSubscribeObj *pSubNew = taosMemoryCalloc(1, sizeof(SMqSubscribeObj));
- if (pSubNew == NULL) return NULL;
- memcpy(pSubNew->key, key, TSDB_SUBSCRIBE_KEY_LEN);
- taosInitRWLatch(&pSubNew->lock);
- pSubNew->vgNum = 0;
- pSubNew->consumerHash = taosHashInit(64, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), false, HASH_NO_LOCK);
- // TODO set hash free fp
- /*taosHashSetFreeFp(pSubNew->consumerHash, tDeleteSMqConsumerEp);*/
+SMqSubscribeObj *tNewSubscribeObj(const char* key) {
+ SMqSubscribeObj *pSubObj = taosMemoryCalloc(1, sizeof(SMqSubscribeObj));
+ if (pSubObj == NULL) {
+ return NULL;
+ }
- pSubNew->unassignedVgs = taosArrayInit(0, sizeof(void *));
+ memcpy(pSubObj->key, key, TSDB_SUBSCRIBE_KEY_LEN);
+ taosInitRWLatch(&pSubObj->lock);
+ pSubObj->vgNum = 0;
+ pSubObj->consumerHash = taosHashInit(64, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), false, HASH_NO_LOCK);
- return pSubNew;
+ // TODO set hash free fp
+ /*taosHashSetFreeFp(pSubObj->consumerHash, tDeleteSMqConsumerEp);*/
+ pSubObj->unassignedVgs = taosArrayInit(0, POINTER_BYTES);
+ return pSubObj;
}
SMqSubscribeObj *tCloneSubscribeObj(const SMqSubscribeObj *pSub) {
@@ -489,7 +495,7 @@ int32_t tEncodeSubscribeObj(void **buf, const SMqSubscribeObj *pSub) {
tlen += tEncodeSMqConsumerEp(buf, pConsumerEp);
cnt++;
}
- if(cnt != sz) return -1;
+ if (cnt != sz) return -1;
tlen += taosEncodeArray(buf, pSub->unassignedVgs, (FEncode)tEncodeSMqVgEp);
tlen += taosEncodeString(buf, pSub->dbName);
return tlen;
diff --git a/source/dnode/mnode/impl/src/mndDnode.c b/source/dnode/mnode/impl/src/mndDnode.c
index f4e6aad7a72f6514183b5e0bb83d77ee831a5ee3..b8bafff104216edfb9e129ca3107438c94842842 100644
--- a/source/dnode/mnode/impl/src/mndDnode.c
+++ b/source/dnode/mnode/impl/src/mndDnode.c
@@ -880,6 +880,12 @@ static int32_t mndProcessConfigDnodeReq(SRpcMsg *pReq) {
if (strcasecmp(cfgReq.config, "resetlog") == 0) {
strcpy(dcfgReq.config, "resetlog");
} else if (strncasecmp(cfgReq.config, "monitor", 7) == 0) {
+ if (' ' != cfgReq.config[7] && 0 != cfgReq.config[7]) {
+ mError("dnode:%d, failed to config monitor since invalid conf:%s", cfgReq.dnodeId, cfgReq.config);
+ terrno = TSDB_CODE_INVALID_CFG;
+ return -1;
+ }
+
const char *value = cfgReq.value;
int32_t flag = atoi(value);
if (flag <= 0) {
@@ -900,12 +906,18 @@ static int32_t mndProcessConfigDnodeReq(SRpcMsg *pReq) {
int32_t optLen = strlen(optName);
if (strncasecmp(cfgReq.config, optName, optLen) != 0) continue;
+ if (' ' != cfgReq.config[optLen] && 0 != cfgReq.config[optLen]) {
+ mError("dnode:%d, failed to config since invalid conf:%s", cfgReq.dnodeId, cfgReq.config);
+ terrno = TSDB_CODE_INVALID_CFG;
+ return -1;
+ }
+
const char *value = cfgReq.value;
int32_t flag = atoi(value);
if (flag <= 0) {
flag = atoi(cfgReq.config + optLen + 1);
}
- if (flag <= 0 || flag > 255) {
+ if (flag < 0 || flag > 255) {
mError("dnode:%d, failed to config %s since value:%d", cfgReq.dnodeId, optName, flag);
terrno = TSDB_CODE_INVALID_CFG;
return -1;
diff --git a/source/dnode/mnode/impl/src/mndScheduler.c b/source/dnode/mnode/impl/src/mndScheduler.c
index af1a29def08eae42072fffc889cd494a95dea239..ca79b8e12223810f7df779db7be731d29796d613 100644
--- a/source/dnode/mnode/impl/src/mndScheduler.c
+++ b/source/dnode/mnode/impl/src/mndScheduler.c
@@ -523,7 +523,7 @@ int32_t mndSchedInitSubEp(SMnode* pMnode, const SMqTopicObj* pTopic, SMqSubscrib
SSdb* pSdb = pMnode->pSdb;
SVgObj* pVgroup = NULL;
SQueryPlan* pPlan = NULL;
- SSubplan* plan = NULL;
+ SSubplan* pSubplan = NULL;
if (pTopic->subType == TOPIC_SUB_TYPE__COLUMN) {
pPlan = qStringToQueryPlan(pTopic->physicalPlan);
@@ -539,24 +539,27 @@ int32_t mndSchedInitSubEp(SMnode* pMnode, const SMqTopicObj* pTopic, SMqSubscrib
return -1;
}
- SNodeListNode* inner = (SNodeListNode*)nodesListGetNode(pPlan->pSubplans, 0);
+ SNodeListNode* pNodeListNode = (SNodeListNode*)nodesListGetNode(pPlan->pSubplans, 0);
- int32_t opNum = LIST_LENGTH(inner->pNodeList);
+ int32_t opNum = LIST_LENGTH(pNodeListNode->pNodeList);
if (opNum != 1) {
qDestroyQueryPlan(pPlan);
terrno = TSDB_CODE_MND_INVALID_TOPIC_QUERY;
return -1;
}
- plan = (SSubplan*)nodesListGetNode(inner->pNodeList, 0);
+
+ pSubplan = (SSubplan*)nodesListGetNode(pNodeListNode->pNodeList, 0);
}
ASSERT(pSub->unassignedVgs);
- ASSERT(taosHashGetSize(pSub->consumerHash) == 0);
void* pIter = NULL;
while (1) {
pIter = sdbFetch(pSdb, SDB_VGROUP, pIter, (void**)&pVgroup);
- if (pIter == NULL) break;
+ if (pIter == NULL) {
+ break;
+ }
+
if (!mndVgroupInDb(pVgroup, pTopic->dbUid)) {
sdbRelease(pSdb, pVgroup);
continue;
@@ -569,15 +572,15 @@ int32_t mndSchedInitSubEp(SMnode* pMnode, const SMqTopicObj* pTopic, SMqSubscrib
pVgEp->vgId = pVgroup->vgId;
taosArrayPush(pSub->unassignedVgs, &pVgEp);
- mDebug("init subscription %s, assign vg: %d", pSub->key, pVgEp->vgId);
+ mDebug("init subscription %s for topic:%s assign vgId:%d", pSub->key, pTopic->name, pVgEp->vgId);
if (pTopic->subType == TOPIC_SUB_TYPE__COLUMN) {
int32_t msgLen;
- plan->execNode.epSet = pVgEp->epSet;
- plan->execNode.nodeId = pVgEp->vgId;
+ pSubplan->execNode.epSet = pVgEp->epSet;
+ pSubplan->execNode.nodeId = pVgEp->vgId;
- if (qSubPlanToString(plan, &pVgEp->qmsg, &msgLen) < 0) {
+ if (qSubPlanToString(pSubplan, &pVgEp->qmsg, &msgLen) < 0) {
sdbRelease(pSdb, pVgroup);
qDestroyQueryPlan(pPlan);
terrno = TSDB_CODE_QRY_INVALID_INPUT;
@@ -590,11 +593,7 @@ int32_t mndSchedInitSubEp(SMnode* pMnode, const SMqTopicObj* pTopic, SMqSubscrib
sdbRelease(pSdb, pVgroup);
}
- ASSERT(pSub->unassignedVgs->size > 0);
-
- ASSERT(taosHashGetSize(pSub->consumerHash) == 0);
-
+ ASSERT(taosArrayGetSize(pSub->unassignedVgs) > 0);
qDestroyQueryPlan(pPlan);
-
return 0;
}
diff --git a/source/dnode/mnode/impl/src/mndStream.c b/source/dnode/mnode/impl/src/mndStream.c
index 83ed6eea78531eb0749aa98b97b759af5fc829d6..fc53fca27cb87efde05cf507272ce3773857b34c 100644
--- a/source/dnode/mnode/impl/src/mndStream.c
+++ b/source/dnode/mnode/impl/src/mndStream.c
@@ -31,6 +31,8 @@
#define MND_STREAM_VER_NUMBER 2
#define MND_STREAM_RESERVE_SIZE 64
+#define MND_STREAM_MAX_NUM 10
+
static int32_t mndStreamActionInsert(SSdb *pSdb, SStreamObj *pStream);
static int32_t mndStreamActionDelete(SSdb *pSdb, SStreamObj *pStream);
static int32_t mndStreamActionUpdate(SSdb *pSdb, SStreamObj *pStream, SStreamObj *pNewStream);
@@ -295,6 +297,8 @@ static int32_t mndBuildStreamObjFromCreateReq(SMnode *pMnode, SStreamObj *pObj,
pObj->triggerParam = pCreate->maxDelay;
pObj->watermark = pCreate->watermark;
pObj->fillHistory = pCreate->fillHistory;
+ pObj->deleteMark = pCreate->deleteMark;
+ pObj->igCheckUpdate = pCreate->igUpdate;
memcpy(pObj->sourceDb, pCreate->sourceDB, TSDB_DB_FNAME_LEN);
SDbObj *pSourceDb = mndAcquireDb(pMnode, pCreate->sourceDB);
@@ -343,6 +347,8 @@ static int32_t mndBuildStreamObjFromCreateReq(SMnode *pMnode, SStreamObj *pObj,
.triggerType = pObj->trigger == STREAM_TRIGGER_MAX_DELAY ? STREAM_TRIGGER_WINDOW_CLOSE : pObj->trigger,
.watermark = pObj->watermark,
.igExpired = pObj->igExpired,
+ .deleteMark = pObj->deleteMark,
+ .igCheckUpdate = pObj->igCheckUpdate,
};
// using ast and param to build physical plan
@@ -473,9 +479,8 @@ static int32_t mndCreateStbForStream(SMnode *pMnode, STrans *pTrans, const SStre
tstrncpy(createReq.name, pStream->targetSTbName, TSDB_TABLE_FNAME_LEN);
createReq.numOfColumns = pStream->outputSchema.nCols;
createReq.numOfTags = 1; // group id
- createReq.pColumns = taosArrayInit(createReq.numOfColumns, sizeof(SField));
+ createReq.pColumns = taosArrayInit_s(createReq.numOfColumns, sizeof(SField), createReq.numOfColumns);
// build fields
- taosArraySetSize(createReq.pColumns, createReq.numOfColumns);
for (int32_t i = 0; i < createReq.numOfColumns; i++) {
SField *pField = taosArrayGet(createReq.pColumns, i);
tstrncpy(pField->name, pStream->outputSchema.pSchema[i].name, TSDB_COL_NAME_LEN);
@@ -483,8 +488,8 @@ static int32_t mndCreateStbForStream(SMnode *pMnode, STrans *pTrans, const SStre
pField->type = pStream->outputSchema.pSchema[i].type;
pField->bytes = pStream->outputSchema.pSchema[i].bytes;
}
- createReq.pTags = taosArrayInit(createReq.numOfTags, sizeof(SField));
- taosArraySetSize(createReq.pTags, 1);
+ createReq.pTags = taosArrayInit_s(createReq.numOfTags, sizeof(SField), 1);
+
// build tags
SField *pField = taosArrayGet(createReq.pTags, 0);
strcpy(pField->name, "group_id");
@@ -625,6 +630,35 @@ static int32_t mndProcessCreateStreamReq(SRpcMsg *pReq) {
goto _OVER;
}
+ {
+ int32_t numOfStream = 0;
+
+ SStreamObj *pStream = NULL;
+ void *pIter = NULL;
+
+ while (1) {
+ pIter = sdbFetch(pMnode->pSdb, SDB_STREAM, pIter, (void **)&pStream);
+ if (pIter == NULL) {
+ if (numOfStream > MND_STREAM_MAX_NUM) {
+ mError("too many streams, no more than 10 for each database");
+ terrno = TSDB_CODE_MND_TOO_MANY_STREAMS;
+ goto _OVER;
+ }
+ break;
+ }
+
+ if (pStream->sourceDbUid == streamObj.sourceDbUid) {
+ ++numOfStream;
+ }
+ sdbRelease(pMnode->pSdb, pStream);
+ if (numOfStream > MND_STREAM_MAX_NUM) {
+ mError("too many streams, no more than 10 for each database");
+ terrno = TSDB_CODE_MND_TOO_MANY_STREAMS;
+ goto _OVER;
+ }
+ }
+ }
+
pDb = mndAcquireDb(pMnode, streamObj.sourceDb);
if (pDb->cfg.replications != 1) {
mError("stream source db must have only 1 replica, but %s has %d", pDb->name, pDb->cfg.replications);
diff --git a/source/dnode/mnode/impl/src/mndSubscribe.c b/source/dnode/mnode/impl/src/mndSubscribe.c
index 153bb8bd04b73bf3c025851a0f2d00b1f6908eac..0d805b04fc26089b7c719d99c1b6c832af13fdd1 100644
--- a/source/dnode/mnode/impl/src/mndSubscribe.c
+++ b/source/dnode/mnode/impl/src/mndSubscribe.c
@@ -39,12 +39,10 @@ static SSdbRow *mndSubActionDecode(SSdbRaw *pRaw);
static int32_t mndSubActionInsert(SSdb *pSdb, SMqSubscribeObj *);
static int32_t mndSubActionDelete(SSdb *pSdb, SMqSubscribeObj *);
static int32_t mndSubActionUpdate(SSdb *pSdb, SMqSubscribeObj *pOldSub, SMqSubscribeObj *pNewSub);
-
-static int32_t mndProcessRebalanceReq(SRpcMsg *pMsg);
-static int32_t mndProcessDropCgroupReq(SRpcMsg *pMsg);
-
-static int32_t mndRetrieveSubscribe(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock, int32_t rows);
-static void mndCancelGetNextSubscribe(SMnode *pMnode, void *pIter);
+static int32_t mndProcessRebalanceReq(SRpcMsg *pMsg);
+static int32_t mndProcessDropCgroupReq(SRpcMsg *pMsg);
+static int32_t mndRetrieveSubscribe(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock, int32_t rows);
+static void mndCancelGetNextSubscribe(SMnode *pMnode, void *pIter);
static int32_t mndSetSubRedoLogs(SMnode *pMnode, STrans *pTrans, SMqSubscribeObj *pSub) {
SSdbRaw *pRedoRaw = mndSubActionEncode(pSub);
@@ -85,12 +83,13 @@ int32_t mndInitSubscribe(SMnode *pMnode) {
return sdbSetTable(pMnode->pSdb, table);
}
-static SMqSubscribeObj *mndCreateSub(SMnode *pMnode, const SMqTopicObj *pTopic, const char *subKey) {
+static SMqSubscribeObj *mndCreateSubscription(SMnode *pMnode, const SMqTopicObj *pTopic, const char *subKey) {
SMqSubscribeObj *pSub = tNewSubscribeObj(subKey);
if (pSub == NULL) {
terrno = TSDB_CODE_OUT_OF_MEMORY;
return NULL;
}
+
pSub->dbUid = pTopic->dbUid;
pSub->stbUid = pTopic->stbUid;
pSub->subType = pTopic->subType;
@@ -205,7 +204,7 @@ static SMqRebInfo *mndGetOrCreateRebSub(SHashObj *pHash, const char *key) {
static int32_t mndDoRebalance(SMnode *pMnode, const SMqRebInputObj *pInput, SMqRebOutputObj *pOutput) {
int32_t totalVgNum = pOutput->pSub->vgNum;
const char *sub = pOutput->pSub->key;
- mInfo("sub:%s, mq rebalance vgNum:%d", sub, pOutput->pSub->vgNum);
+ mInfo("sub:%s mq re-balance %d vgroups", sub, pOutput->pSub->vgNum);
// 1. build temporary hash(vgId -> SMqRebOutputVg) to store modified vg
SHashObj *pHash = taosHashInit(64, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT), false, HASH_NO_LOCK);
@@ -214,7 +213,7 @@ static int32_t mndDoRebalance(SMnode *pMnode, const SMqRebInputObj *pInput, SMqR
int32_t removedNum = taosArrayGetSize(pInput->pRebInfo->removedConsumers);
int32_t actualRemoved = 0;
for (int32_t i = 0; i < removedNum; i++) {
- int64_t consumerId = *(int64_t *)taosArrayGet(pInput->pRebInfo->removedConsumers, i);
+ uint64_t consumerId = *(uint64_t *)taosArrayGet(pInput->pRebInfo->removedConsumers, i);
SMqConsumerEp *pConsumerEp = taosHashGet(pOutput->pSub->consumerHash, &consumerId, sizeof(int64_t));
@@ -229,7 +228,7 @@ static int32_t mndDoRebalance(SMnode *pMnode, const SMqRebInputObj *pInput, SMqR
.pVgEp = pVgEp,
};
taosHashPut(pHash, &pVgEp->vgId, sizeof(int32_t), &outputVg, sizeof(SMqRebOutputVg));
- mInfo("sub:%s, mq rebalance remove vgId:%d from consumer:%" PRId64, sub, pVgEp->vgId, consumerId);
+ mInfo("sub:%s mq re-balance remove vgId:%d from consumer:%" PRId64, sub, pVgEp->vgId, consumerId);
}
taosArrayDestroy(pConsumerEp->vgs);
taosHashRemove(pOutput->pSub->consumerHash, &consumerId, sizeof(int64_t));
@@ -239,7 +238,7 @@ static int32_t mndDoRebalance(SMnode *pMnode, const SMqRebInputObj *pInput, SMqR
}
if (removedNum != actualRemoved) {
- mError("sub:%s, mq rebalance removedNum:%d not matched with actual:%d", sub, removedNum, actualRemoved);
+ mError("sub:%s mq re-balance removedNum:%d not matched with actual:%d", sub, removedNum, actualRemoved);
}
// if previously no consumer, there are vgs not assigned
@@ -253,7 +252,7 @@ static int32_t mndDoRebalance(SMnode *pMnode, const SMqRebInputObj *pInput, SMqR
.pVgEp = pVgEp,
};
taosHashPut(pHash, &pVgEp->vgId, sizeof(int32_t), &rebOutput, sizeof(SMqRebOutputVg));
- mInfo("sub:%s, mq rebalance remove vgId:%d from unassigned", sub, pVgEp->vgId);
+ mInfo("sub:%s mq re-balance remove vgId:%d from unassigned", sub, pVgEp->vgId);
}
}
@@ -267,7 +266,8 @@ static int32_t mndDoRebalance(SMnode *pMnode, const SMqRebInputObj *pInput, SMqR
minVgCnt = totalVgNum / afterRebConsumerNum;
imbConsumerNum = totalVgNum % afterRebConsumerNum;
}
- mInfo("sub:%s, mq rebalance %d consumer after rebalance, at least %d vg each, %d consumer has more vg", sub,
+
+ mInfo("sub:%s mq re-balance %d consumers: at least %d vg each, %d consumer has more vg", sub,
afterRebConsumerNum, minVgCnt, imbConsumerNum);
// 4. first scan: remove consumer more than wanted, put to remove hash
@@ -275,7 +275,10 @@ static int32_t mndDoRebalance(SMnode *pMnode, const SMqRebInputObj *pInput, SMqR
void *pIter = NULL;
while (1) {
pIter = taosHashIterate(pOutput->pSub->consumerHash, pIter);
- if (pIter == NULL) break;
+ if (pIter == NULL) {
+ break;
+ }
+
SMqConsumerEp *pConsumerEp = (SMqConsumerEp *)pIter;
int32_t consumerVgNum = taosArrayGetSize(pConsumerEp->vgs);
@@ -297,7 +300,7 @@ static int32_t mndDoRebalance(SMnode *pMnode, const SMqRebInputObj *pInput, SMqR
.pVgEp = pVgEp,
};
taosHashPut(pHash, &pVgEp->vgId, sizeof(int32_t), &outputVg, sizeof(SMqRebOutputVg));
- mInfo("sub:%s, mq rebalance remove vgId:%d from consumer:%" PRId64 ",(first scan)", sub, pVgEp->vgId,
+ mInfo("sub:%s mq rebalance remove vgId:%d from consumer:%" PRId64 ",(first scan)", sub, pVgEp->vgId,
pConsumerEp->consumerId);
}
imbCnt++;
@@ -312,7 +315,7 @@ static int32_t mndDoRebalance(SMnode *pMnode, const SMqRebInputObj *pInput, SMqR
.pVgEp = pVgEp,
};
taosHashPut(pHash, &pVgEp->vgId, sizeof(int32_t), &outputVg, sizeof(SMqRebOutputVg));
- mInfo("sub:%s, mq rebalance remove vgId:%d from consumer:%" PRId64 ",(first scan)", sub, pVgEp->vgId,
+ mInfo("sub:%s mq rebalance remove vgId:%d from consumer:%" PRId64 ",(first scan)", sub, pVgEp->vgId,
pConsumerEp->consumerId);
}
}
@@ -330,7 +333,7 @@ static int32_t mndDoRebalance(SMnode *pMnode, const SMqRebInputObj *pInput, SMqR
newConsumerEp.vgs = taosArrayInit(0, sizeof(void *));
taosHashPut(pOutput->pSub->consumerHash, &consumerId, sizeof(int64_t), &newConsumerEp, sizeof(SMqConsumerEp));
taosArrayPush(pOutput->newConsumers, &consumerId);
- mInfo("sub:%s, mq rebalance add new consumer:%" PRId64, sub, consumerId);
+ mInfo("sub:%s mq rebalance add new consumer:%" PRId64, sub, consumerId);
}
}
@@ -349,7 +352,7 @@ static int32_t mndDoRebalance(SMnode *pMnode, const SMqRebInputObj *pInput, SMqR
// iter hash and find one vg
pRemovedIter = taosHashIterate(pHash, pRemovedIter);
if (pRemovedIter == NULL) {
- mError("sub:%s, removed iter is null", sub);
+ mError("sub:%s removed iter is null", sub);
continue;
}
@@ -402,33 +405,36 @@ static int32_t mndDoRebalance(SMnode *pMnode, const SMqRebInputObj *pInput, SMqR
SMqRebOutputVg *pRebOutput = NULL;
while (1) {
pIter = taosHashIterate(pHash, pIter);
- if (pIter == NULL) break;
+ if (pIter == NULL) {
+ break;
+ }
+
pRebOutput = (SMqRebOutputVg *)pIter;
taosArrayPush(pOutput->pSub->unassignedVgs, &pRebOutput->pVgEp);
taosArrayPush(pOutput->rebVgs, pRebOutput);
- mInfo("sub:%s, mq rebalance unassign vgId:%d (second scan)", sub, pRebOutput->pVgEp->vgId);
+ mInfo("sub:%s mq re-balance unassign vgId:%d (second scan)", sub, pRebOutput->pVgEp->vgId);
}
}
// 8. generate logs
- mInfo("sub:%s, mq rebalance calculation completed, rebalanced vg", sub);
+ mInfo("sub:%s mq re-balance calculation completed, re-balanced vg", sub);
for (int32_t i = 0; i < taosArrayGetSize(pOutput->rebVgs); i++) {
SMqRebOutputVg *pOutputRebVg = taosArrayGet(pOutput->rebVgs, i);
- mInfo("sub:%s, mq rebalance vgId:%d, moved from consumer:%" PRId64 ", to consumer:%" PRId64, sub,
+ mInfo("sub:%s mq re-balance vgId:%d, moved from consumer:0x%" PRIx64 ", to consumer:0x%" PRIx64, sub,
pOutputRebVg->pVgEp->vgId, pOutputRebVg->oldConsumerId, pOutputRebVg->newConsumerId);
}
{
- void *pIter = NULL;
+ pIter = NULL;
while (1) {
pIter = taosHashIterate(pOutput->pSub->consumerHash, pIter);
if (pIter == NULL) break;
SMqConsumerEp *pConsumerEp = (SMqConsumerEp *)pIter;
int32_t sz = taosArrayGetSize(pConsumerEp->vgs);
- mInfo("sub:%s, mq rebalance final cfg: consumer %" PRId64 " has %d vg", sub, pConsumerEp->consumerId, sz);
+ mInfo("sub:%s mq re-balance final cfg: consumer:0x%" PRId64 " has %d vg", sub, pConsumerEp->consumerId, sz);
for (int32_t i = 0; i < sz; i++) {
SMqVgEp *pVgEp = taosArrayGetP(pConsumerEp->vgs, i);
- mInfo("sub:%s, mq rebalance final cfg: vg %d to consumer %" PRId64 "", sub, pVgEp->vgId,
+ mInfo("sub:%s mq re-balance final cfg: vg %d to consumer:0x%" PRId64, sub, pVgEp->vgId,
pConsumerEp->consumerId);
}
}
@@ -552,11 +558,14 @@ static int32_t mndProcessRebalanceReq(SRpcMsg *pMsg) {
SMqDoRebalanceMsg *pReq = pMsg->pCont;
void *pIter = NULL;
- mInfo("mq rebalance start");
+ mInfo("mq re-balance start");
while (1) {
pIter = taosHashIterate(pReq->rebSubHash, pIter);
- if (pIter == NULL) break;
+ if (pIter == NULL) {
+ break;
+ }
+
SMqRebInputObj rebInput = {0};
SMqRebOutputObj rebOutput = {0};
@@ -577,12 +586,13 @@ static int32_t mndProcessRebalanceReq(SRpcMsg *pMsg) {
mndSplitSubscribeKey(pRebInfo->key, topic, cgroup, true);
SMqTopicObj *pTopic = mndAcquireTopic(pMnode, topic);
if (pTopic == NULL) {
- mError("mq rebalance %s failed since topic %s not exist, abort", pRebInfo->key, topic);
+ mError("mq re-balance %s ignored since topic %s not exist", pRebInfo->key, topic);
continue;
}
+
taosRLockLatch(&pTopic->lock);
- rebOutput.pSub = mndCreateSub(pMnode, pTopic, pRebInfo->key);
+ rebOutput.pSub = mndCreateSubscription(pMnode, pTopic, pRebInfo->key);
if (rebOutput.pSub == NULL) {
mError("mq rebalance %s failed create sub since %s, abort", pRebInfo->key, terrstr());
@@ -605,15 +615,16 @@ static int32_t mndProcessRebalanceReq(SRpcMsg *pMsg) {
}
if (mndDoRebalance(pMnode, &rebInput, &rebOutput) < 0) {
- mError("mq rebalance internal error");
+ mError("mq re-balance internal error");
}
// if add more consumer to balanced subscribe,
// possibly no vg is changed
if (mndPersistRebResult(pMnode, pMsg, &rebOutput) < 0) {
- mError("mq rebalance persist rebalance output error, possibly vnode splitted or dropped");
+ mError("mq re-balance persist re-balance output error, possibly vnode splitted or dropped");
}
+
taosArrayDestroy(pRebInfo->lostConsumers);
taosArrayDestroy(pRebInfo->newConsumers);
taosArrayDestroy(pRebInfo->removedConsumers);
@@ -627,19 +638,18 @@ static int32_t mndProcessRebalanceReq(SRpcMsg *pMsg) {
}
// reset flag
- mInfo("mq rebalance completed successfully");
+ mInfo("mq re-balance completed successfully");
taosHashCleanup(pReq->rebSubHash);
mndRebEnd();
return 0;
}
-static int32_t mndProcessDropCgroupReq(SRpcMsg *pReq) {
- SMnode *pMnode = pReq->info.node;
- SSdb *pSdb = pMnode->pSdb;
+static int32_t mndProcessDropCgroupReq(SRpcMsg *pMsg) {
+ SMnode *pMnode = pMsg->info.node;
SMDropCgroupReq dropReq = {0};
- if (tDeserializeSMDropCgroupReq(pReq->pCont, pReq->contLen, &dropReq) != 0) {
+ if (tDeserializeSMDropCgroupReq(pMsg->pCont, pMsg->contLen, &dropReq) != 0) {
terrno = TSDB_CODE_INVALID_MSG;
return -1;
}
@@ -663,7 +673,7 @@ static int32_t mndProcessDropCgroupReq(SRpcMsg *pReq) {
return -1;
}
- STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_NOTHING, pReq, "drop-cgroup");
+ STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_NOTHING, pMsg, "drop-cgroup");
if (pTrans == NULL) {
mError("cgroup: %s on topic:%s, failed to drop since %s", dropReq.cgroup, dropReq.topic, terrstr());
mndReleaseSubscribe(pMnode, pSub);
@@ -956,7 +966,7 @@ END:
return code;
}
-static int32_t mndRetrieveSubscribe(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock, int32_t rowsCapacity) {
+int32_t mndRetrieveSubscribe(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock, int32_t rowsCapacity) {
SMnode *pMnode = pReq->info.node;
SSdb *pSdb = pMnode->pSdb;
int32_t numOfRows = 0;
@@ -966,7 +976,9 @@ static int32_t mndRetrieveSubscribe(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock
while (numOfRows < rowsCapacity) {
pShow->pIter = sdbFetch(pSdb, SDB_SUBSCRIBE, pShow->pIter, (void **)&pSub);
- if (pShow->pIter == NULL) break;
+ if (pShow->pIter == NULL) {
+ break;
+ }
taosRLockLatch(&pSub->lock);
@@ -1075,6 +1087,9 @@ static int32_t mndRetrieveSubscribe(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock
}
#endif
+
+ pBlock->info.rows = numOfRows;
+
taosRUnLockLatch(&pSub->lock);
sdbRelease(pSdb, pSub);
}
@@ -1085,7 +1100,7 @@ static int32_t mndRetrieveSubscribe(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock
return numOfRows;
}
-static void mndCancelGetNextSubscribe(SMnode *pMnode, void *pIter) {
+void mndCancelGetNextSubscribe(SMnode *pMnode, void *pIter) {
SSdb *pSdb = pMnode->pSdb;
sdbCancelFetch(pSdb, pIter);
}
diff --git a/source/dnode/mnode/impl/src/mndSync.c b/source/dnode/mnode/impl/src/mndSync.c
index 6b675586e47a9116c9043991c17fa58984d0a44f..1dc9ae9c4ba0ebd689da8757dd3aa11eb330a2c8 100644
--- a/source/dnode/mnode/impl/src/mndSync.c
+++ b/source/dnode/mnode/impl/src/mndSync.c
@@ -85,7 +85,11 @@ int32_t mndProcessWriteMsg(const SSyncFSM *pFsm, SRpcMsg *pMsg, const SFsmCbMeta
pRaw, pMgmt->transSec, pMgmt->transSeq);
if (pMeta->code == 0) {
- sdbWriteWithoutFree(pMnode->pSdb, pRaw);
+ int32_t code = sdbWriteWithoutFree(pMnode->pSdb, pRaw);
+ if (code != 0) {
+ mError("trans:%d, failed to write to sdb since %s", transId, terrstr());
+ return 0;
+ }
sdbSetApplyInfo(pMnode->pSdb, pMeta->index, pMeta->term, pMeta->lastConfigIndex);
}
@@ -110,8 +114,9 @@ int32_t mndProcessWriteMsg(const SSyncFSM *pFsm, SRpcMsg *pMsg, const SFsmCbMeta
taosThreadMutexUnlock(&pMgmt->lock);
STrans *pTrans = mndAcquireTrans(pMnode, transId);
if (pTrans != NULL) {
- mInfo("trans:%d, execute in mnode which not leader or sync timeout", transId);
- mndTransExecute(pMnode, pTrans);
+ mInfo("trans:%d, execute in mnode which not leader or sync timeout, createTime:%" PRId64 " saved trans:%d",
+ transId, pTrans->createdTime, pMgmt->transId);
+ mndTransExecute(pMnode, pTrans, false);
mndReleaseTrans(pMnode, pTrans);
// sdbWriteFile(pMnode->pSdb, SDB_WRITE_DELTA);
} else {
@@ -368,7 +373,7 @@ int32_t mndSyncPropose(SMnode *pMnode, SSdbRaw *pRaw, int32_t transId) {
taosThreadMutexLock(&pMgmt->lock);
pMgmt->errCode = 0;
- if (pMgmt->transId != 0) {
+ if (pMgmt->transId != 0 /* && pMgmt->transId != transId*/) {
mError("trans:%d, can't be proposed since trans:%d already waiting for confirm", transId, pMgmt->transId);
taosThreadMutexUnlock(&pMgmt->lock);
rpcFreeCont(req.pCont);
diff --git a/source/dnode/mnode/impl/src/mndTopic.c b/source/dnode/mnode/impl/src/mndTopic.c
index 48c35f3f0704780b73e9d3af9b3ab31e0c58da63..f712825b222e8b5e0864f2d14988905adbd73bd5 100644
--- a/source/dnode/mnode/impl/src/mndTopic.c
+++ b/source/dnode/mnode/impl/src/mndTopic.c
@@ -33,7 +33,7 @@
static int32_t mndTopicActionInsert(SSdb *pSdb, SMqTopicObj *pTopic);
static int32_t mndTopicActionDelete(SSdb *pSdb, SMqTopicObj *pTopic);
-static int32_t mndTopicActionUpdate(SSdb *pSdb, SMqTopicObj *pTopic, SMqTopicObj *pNewTopic);
+static int32_t mndTopicActionUpdate(SSdb *pSdb, SMqTopicObj *pOldTopic, SMqTopicObj *pNewTopic);
static int32_t mndProcessCreateTopicReq(SRpcMsg *pReq);
static int32_t mndProcessDropTopicReq(SRpcMsg *pReq);
diff --git a/source/dnode/mnode/impl/src/mndTrans.c b/source/dnode/mnode/impl/src/mndTrans.c
index dfcd55bcba7ca6a46a79cac2351df18a135218db..6bb286cd6f379aea8d39f9b88e0f110698474ebb 100644
--- a/source/dnode/mnode/impl/src/mndTrans.c
+++ b/source/dnode/mnode/impl/src/mndTrans.c
@@ -572,8 +572,20 @@ static void mndTransUpdateActions(SArray *pOldArray, SArray *pNewArray) {
}
static int32_t mndTransActionUpdate(SSdb *pSdb, STrans *pOld, STrans *pNew) {
- mTrace("trans:%d, perform update action, old row:%p stage:%s, new row:%p stage:%s", pOld->id, pOld,
- mndTransStr(pOld->stage), pNew, mndTransStr(pNew->stage));
+ mTrace("trans:%d, perform update action, old row:%p stage:%s create:%" PRId64 ", new row:%p stage:%s create:%" PRId64,
+ pOld->id, pOld, mndTransStr(pOld->stage), pOld->createdTime, pNew, mndTransStr(pNew->stage),
+ pNew->createdTime);
+
+ if (pOld->createdTime != pNew->createdTime) {
+ mError("trans:%d, failed to perform update action since createTime not match, old row:%p stage:%s create:%" PRId64
+ ", new row:%p stage:%s create:%" PRId64,
+ pOld->id, pOld, mndTransStr(pOld->stage), pOld->createdTime, pNew, mndTransStr(pNew->stage),
+ pNew->createdTime);
+ // only occured while sync timeout
+ terrno = TSDB_CODE_MND_TRNAS_SYNC_TIMEOUT;
+ return -1;
+ }
+
mndTransUpdateActions(pOld->redoActions, pNew->redoActions);
mndTransUpdateActions(pOld->undoActions, pNew->undoActions);
mndTransUpdateActions(pOld->commitActions, pNew->commitActions);
@@ -779,16 +791,18 @@ static int32_t mndTransSync(SMnode *pMnode, STrans *pTrans) {
}
(void)sdbSetRawStatus(pRaw, SDB_STATUS_READY);
- mInfo("trans:%d, sync to other mnodes, stage:%s", pTrans->id, mndTransStr(pTrans->stage));
+ mInfo("trans:%d, sync to other mnodes, stage:%s createTime:%" PRId64, pTrans->id, mndTransStr(pTrans->stage),
+ pTrans->createdTime);
int32_t code = mndSyncPropose(pMnode, pRaw, pTrans->id);
if (code != 0) {
- mError("trans:%d, failed to sync, errno:%s code:%s", pTrans->id, terrstr(), tstrerror(code));
+ mError("trans:%d, failed to sync, errno:%s code:%s createTime:%" PRId64 " saved trans:%d", pTrans->id, terrstr(),
+ tstrerror(code), pTrans->createdTime, pMnode->syncMgmt.transId);
sdbFreeRaw(pRaw);
return -1;
}
sdbFreeRaw(pRaw);
- mInfo("trans:%d, sync finished", pTrans->id);
+ mInfo("trans:%d, sync finished, createTime:%" PRId64, pTrans->id, pTrans->createdTime);
return 0;
}
@@ -891,7 +905,7 @@ int32_t mndTransPrepare(SMnode *pMnode, STrans *pTrans) {
pTrans->rpcRsp = NULL;
pTrans->rpcRspLen = 0;
- mndTransExecute(pMnode, pNew);
+ mndTransExecute(pMnode, pNew, true);
mndReleaseTrans(pMnode, pNew);
return 0;
}
@@ -1054,7 +1068,7 @@ int32_t mndTransProcessRsp(SRpcMsg *pRsp) {
mInfo("trans:%d, %s:%d response is received, code:0x%x, accept:0x%x retry:0x%x", transId, mndTransStr(pAction->stage),
action, pRsp->code, pAction->acceptableCode, pAction->retryCode);
- mndTransExecute(pMnode, pTrans);
+ mndTransExecute(pMnode, pTrans, true);
_OVER:
mndReleaseTrans(pMnode, pTrans);
@@ -1483,15 +1497,17 @@ static bool mndTransPerfromFinishedStage(SMnode *pMnode, STrans *pTrans) {
mError("trans:%d, failed to write sdb since %s", pTrans->id, terrstr());
}
- mInfo("trans:%d, execute finished, code:0x%x, failedTimes:%d", pTrans->id, pTrans->code, pTrans->failedTimes);
+ mInfo("trans:%d, execute finished, code:0x%x, failedTimes:%d createTime:%" PRId64, pTrans->id, pTrans->code,
+ pTrans->failedTimes, pTrans->createdTime);
return continueExec;
}
-void mndTransExecute(SMnode *pMnode, STrans *pTrans) {
+void mndTransExecute(SMnode *pMnode, STrans *pTrans, bool isLeader) {
bool continueExec = true;
while (continueExec) {
- mInfo("trans:%d, continue to execute, stage:%s", pTrans->id, mndTransStr(pTrans->stage));
+ mInfo("trans:%d, continue to execute, stage:%s createTime:%" PRId64 " leader:%d", pTrans->id,
+ mndTransStr(pTrans->stage), pTrans->createdTime, isLeader);
pTrans->lastExecTime = taosGetTimestampMs();
switch (pTrans->stage) {
case TRN_STAGE_PREPARE:
@@ -1501,13 +1517,23 @@ void mndTransExecute(SMnode *pMnode, STrans *pTrans) {
continueExec = mndTransPerformRedoActionStage(pMnode, pTrans);
break;
case TRN_STAGE_COMMIT:
- continueExec = mndTransPerformCommitStage(pMnode, pTrans);
+ if (isLeader) {
+ continueExec = mndTransPerformCommitStage(pMnode, pTrans);
+ } else {
+ mInfo("trans:%d, can not commit since not leader", pTrans->id);
+ continueExec = false;
+ }
break;
case TRN_STAGE_COMMIT_ACTION:
continueExec = mndTransPerformCommitActionStage(pMnode, pTrans);
break;
case TRN_STAGE_ROLLBACK:
- continueExec = mndTransPerformRollbackStage(pMnode, pTrans);
+ if (isLeader) {
+ continueExec = mndTransPerformRollbackStage(pMnode, pTrans);
+ } else {
+ mInfo("trans:%d, can not rollback since not leader", pTrans->id);
+ continueExec = false;
+ }
break;
case TRN_STAGE_UNDO_ACTION:
continueExec = mndTransPerformUndoActionStage(pMnode, pTrans);
@@ -1550,7 +1576,7 @@ int32_t mndKillTrans(SMnode *pMnode, STrans *pTrans) {
pAction->errCode = 0;
}
- mndTransExecute(pMnode, pTrans);
+ mndTransExecute(pMnode, pTrans, true);
return 0;
}
@@ -1608,7 +1634,7 @@ void mndTransPullup(SMnode *pMnode) {
int32_t *pTransId = taosArrayGet(pArray, i);
STrans *pTrans = mndAcquireTrans(pMnode, *pTransId);
if (pTrans != NULL) {
- mndTransExecute(pMnode, pTrans);
+ mndTransExecute(pMnode, pTrans, true);
}
mndReleaseTrans(pMnode, pTrans);
}
diff --git a/source/dnode/qnode/inc/qndInt.h b/source/dnode/qnode/inc/qndInt.h
index e8ccb75040cbc54ab080e7887a877ce9ff67006b..86deda52ad242e371ab59542532234778e26864d 100644
--- a/source/dnode/qnode/inc/qndInt.h
+++ b/source/dnode/qnode/inc/qndInt.h
@@ -29,7 +29,7 @@
extern "C" {
#endif
-typedef struct SQWorker SQHandle;
+typedef struct SQueueWorker SQHandle;
typedef struct SQnode {
int32_t qndId;
diff --git a/source/dnode/vnode/inc/vnode.h b/source/dnode/vnode/inc/vnode.h
index a4cbfe60f705dda7671351beb6056318d083a362..a9652fb2ff05767f439bfe3385633813ecdf73ed 100644
--- a/source/dnode/vnode/inc/vnode.h
+++ b/source/dnode/vnode/inc/vnode.h
@@ -104,8 +104,8 @@ void metaReaderClear(SMetaReader *pReader);
int32_t metaGetTableEntryByUid(SMetaReader *pReader, tb_uid_t uid);
int32_t metaGetTableEntryByUidCache(SMetaReader *pReader, tb_uid_t uid);
int metaGetTableEntryByName(SMetaReader *pReader, const char *name);
-int32_t metaGetTableTags(SMeta *pMeta, uint64_t suid, SArray *uidList, SHashObj *tags);
-int32_t metaGetTableTagsByUids(SMeta *pMeta, int64_t suid, SArray *uidList, SHashObj *tags);
+int32_t metaGetTableTags(SMeta *pMeta, uint64_t suid, SArray *uidList);
+int32_t metaGetTableTagsByUids(SMeta *pMeta, int64_t suid, SArray *uidList);
int32_t metaReadNext(SMetaReader *pReader);
const void *metaGetTableTagVal(void *tag, int16_t type, STagVal *tagVal);
int metaGetTableNameByUid(void *meta, uint64_t uid, char *tbName);
@@ -178,7 +178,6 @@ int32_t tsdbReaderOpen(SVnode *pVnode, SQueryTableDataCond *pCond, void *pTableL
void tsdbReaderClose(STsdbReader *pReader);
bool tsdbNextDataBlock(STsdbReader *pReader);
-void tsdbRetrieveDataBlockInfo(const STsdbReader *pReader, int32_t *rows, uint64_t *uid, STimeWindow *pWindow);
int32_t tsdbRetrieveDatablockSMA(STsdbReader *pReader, SSDataBlock *pDataBlock, bool *allHave);
SSDataBlock *tsdbRetrieveDataBlock(STsdbReader *pTsdbReadHandle, SArray *pColumnIdList);
int32_t tsdbReaderReset(STsdbReader *pReader, SQueryTableDataCond *pCond);
diff --git a/source/dnode/vnode/src/inc/tsdb.h b/source/dnode/vnode/src/inc/tsdb.h
index 2efb00ae32c510211a0ac0d6c44450fa1b48464f..702cbea3334e4170f474a3da1435ec646481a57e 100644
--- a/source/dnode/vnode/src/inc/tsdb.h
+++ b/source/dnode/vnode/src/inc/tsdb.h
@@ -236,6 +236,7 @@ void tsdbHeadFileName(STsdb *pTsdb, SDiskID did, int32_t fid, SHeadFile *pHeadF,
void tsdbDataFileName(STsdb *pTsdb, SDiskID did, int32_t fid, SDataFile *pDataF, char fname[]);
void tsdbSttFileName(STsdb *pTsdb, SDiskID did, int32_t fid, SSttFile *pSttF, char fname[]);
void tsdbSmaFileName(STsdb *pTsdb, SDiskID did, int32_t fid, SSmaFile *pSmaF, char fname[]);
+
// SDelFile
void tsdbDelFileName(STsdb *pTsdb, SDelFile *pFile, char fname[]);
// tsdbFS.c ==============================================================================================
@@ -321,6 +322,8 @@ struct STsdb {
STsdbFS fs;
SLRUCache *lruCache;
TdThreadMutex lruMutex;
+ SLRUCache *biCache;
+ TdThreadMutex biMutex;
};
struct TSDBKEY {
@@ -644,6 +647,7 @@ typedef struct SSttBlockLoadInfo {
int16_t *colIds;
int32_t numOfCols;
bool sttBlockLoaded;
+ int32_t numOfStt;
// keep the last access position, this position may be used to reduce the binary times for
// starting last block data for a new table
@@ -709,7 +713,7 @@ bool tMergeTreeNext(SMergeTree *pMTree);
TSDBROW tMergeTreeGetRow(SMergeTree *pMTree);
void tMergeTreeClose(SMergeTree *pMTree);
-SSttBlockLoadInfo *tCreateLastBlockLoadInfo(STSchema *pSchema, int16_t *colList, int32_t numOfCols);
+SSttBlockLoadInfo *tCreateLastBlockLoadInfo(STSchema *pSchema, int16_t *colList, int32_t numOfCols, int32_t numOfStt);
void resetLastBlockLoadInfo(SSttBlockLoadInfo *pLoadInfo);
void getLastBlockLoadInfo(SSttBlockLoadInfo *pLoadInfo, int64_t *blocks, double *el);
void *destroyLastBlockLoadInfo(SSttBlockLoadInfo *pLoadInfo);
@@ -746,6 +750,9 @@ int32_t tsdbCacheGetLastH(SLRUCache *pCache, tb_uid_t uid, SCacheRowsReader *pr,
int32_t tsdbCacheGetLastrowH(SLRUCache *pCache, tb_uid_t uid, SCacheRowsReader *pr, LRUHandle **h);
int32_t tsdbCacheRelease(SLRUCache *pCache, LRUHandle *h);
+int32_t tsdbCacheGetBlockIdx(SLRUCache *pCache, SDataFReader *pFileReader, LRUHandle **handle);
+int32_t tsdbBICacheRelease(SLRUCache *pCache, LRUHandle *h);
+
int32_t tsdbCacheDeleteLastrow(SLRUCache *pCache, tb_uid_t uid, TSKEY eKey);
int32_t tsdbCacheDeleteLast(SLRUCache *pCache, tb_uid_t uid, TSKEY eKey);
int32_t tsdbCacheDelete(SLRUCache *pCache, tb_uid_t uid, TSKEY eKey);
diff --git a/source/dnode/vnode/src/inc/vnodeInt.h b/source/dnode/vnode/src/inc/vnodeInt.h
index 2501af7f04203f895513cc22aacbe63d0fb64b8d..adec0272840870a0498adccd7c67036754752772 100644
--- a/source/dnode/vnode/src/inc/vnodeInt.h
+++ b/source/dnode/vnode/src/inc/vnodeInt.h
@@ -58,7 +58,7 @@ typedef struct STQ STQ;
typedef struct SVState SVState;
typedef struct SVStatis SVStatis;
typedef struct SVBufPool SVBufPool;
-typedef struct SQWorker SQHandle;
+typedef struct SQueueWorker SQHandle;
typedef struct STsdbKeepCfg STsdbKeepCfg;
typedef struct SMetaSnapReader SMetaSnapReader;
typedef struct SMetaSnapWriter SMetaSnapWriter;
@@ -107,7 +107,7 @@ typedef struct STbUidStore STbUidStore;
#define META_BEGIN_HEAP_NIL 2
int metaOpen(SVnode* pVnode, SMeta** ppMeta, int8_t rollback);
-int metaClose(SMeta* pMeta);
+int metaClose(SMeta** pMeta);
int metaBegin(SMeta* pMeta, int8_t fromSys);
TXN* metaGetTxn(SMeta* pMeta);
int metaCommit(SMeta* pMeta, TXN* txn);
diff --git a/source/dnode/vnode/src/meta/metaCache.c b/source/dnode/vnode/src/meta/metaCache.c
index d68658b0d9489bae47ad8787cd8ce0d4de1f3438..366c072b6f83cf40e404408843504257b2b107f5 100644
--- a/source/dnode/vnode/src/meta/metaCache.c
+++ b/source/dnode/vnode/src/meta/metaCache.c
@@ -32,9 +32,9 @@ typedef struct SMetaStbStatsEntry {
} SMetaStbStatsEntry;
typedef struct STagFilterResEntry {
- uint64_t suid; // uid for super table
SList list; // the linked list of md5 digest, extracted from the serialized tag query condition
- uint32_t qTimes; // queried times for current super table
+ uint32_t hitTimes; // queried times for current super table
+ uint32_t accTime;
} STagFilterResEntry;
struct SMetaCache {
@@ -55,6 +55,7 @@ struct SMetaCache {
// query cache
struct STagFilterResCache {
TdThreadMutex lock;
+ uint32_t accTimes;
SHashObj* pTableEntry;
SLRUCache* pUidResCache;
} sTagFilterResCache;
@@ -132,6 +133,7 @@ int32_t metaCacheOpen(SMeta* pMeta) {
goto _err2;
}
+ pCache->sTagFilterResCache.accTimes = 0;
pCache->sTagFilterResCache.pTableEntry =
taosHashInit(1024, taosGetDefaultHashFunction(TSDB_DATA_TYPE_VARCHAR), false, HASH_NO_LOCK);
if (pCache->sTagFilterResCache.pTableEntry == NULL) {
@@ -159,9 +161,9 @@ void metaCacheClose(SMeta* pMeta) {
entryCacheClose(pMeta);
statsCacheClose(pMeta);
- taosHashCleanup(pMeta->pCache->sTagFilterResCache.pTableEntry);
taosLRUCacheCleanup(pMeta->pCache->sTagFilterResCache.pUidResCache);
taosThreadMutexDestroy(&pMeta->pCache->sTagFilterResCache.lock);
+ taosHashCleanup(pMeta->pCache->sTagFilterResCache.pTableEntry);
taosMemoryFree(pMeta->pCache);
pMeta->pCache = NULL;
@@ -424,6 +426,31 @@ int32_t metaStatsCacheGet(SMeta* pMeta, int64_t uid, SMetaStbStats* pInfo) {
return code;
}
+static int checkAllEntriesInCache(const STagFilterResEntry* pEntry, SArray* pInvalidRes, int32_t keyLen, SLRUCache* pCache, uint64_t suid) {
+ SListIter iter = {0};
+ tdListInitIter((SList*)&(pEntry->list), &iter, TD_LIST_FORWARD);
+
+ SListNode* pNode = NULL;
+ uint64_t buf[3];
+ buf[0] = suid;
+
+ int32_t len = sizeof(uint64_t) * tListLen(buf);
+
+ while ((pNode = tdListNext(&iter)) != NULL) {
+ memcpy(&buf[1], pNode->data, keyLen);
+
+ // check whether it is existed in LRU cache, and remove it from linked list if not.
+ LRUHandle* pRes = taosLRUCacheLookup(pCache, buf, len);
+ if (pRes == NULL) { // remove the item in the linked list
+ taosArrayPush(pInvalidRes, &pNode);
+ } else {
+ taosLRUCacheRelease(pCache, pRes, false);
+ }
+ }
+
+ return 0;
+}
+
int32_t metaGetCachedTableUidList(SMeta* pMeta, tb_uid_t suid, const uint8_t* pKey, int32_t keyLen, SArray* pList1,
bool* acquireRes) {
// generate the composed key for LRU cache
@@ -431,16 +458,18 @@ int32_t metaGetCachedTableUidList(SMeta* pMeta, tb_uid_t suid, const uint8_t* pK
SHashObj* pTableMap = pMeta->pCache->sTagFilterResCache.pTableEntry;
TdThreadMutex* pLock = &pMeta->pCache->sTagFilterResCache.lock;
- uint64_t buf[3] = {0};
- uint32_t times = 0;
+ uint64_t buf[4];
*acquireRes = 0;
- buf[0] = suid;
- memcpy(&buf[1], pKey, keyLen);
+
+ buf[0] = (uint64_t) pTableMap;
+ buf[1] = suid;
+ memcpy(&buf[2], pKey, keyLen);
taosThreadMutexLock(pLock);
+ pMeta->pCache->sTagFilterResCache.accTimes += 1;
- int32_t len = keyLen + sizeof(uint64_t);
+ int32_t len = keyLen + sizeof(uint64_t) * 2;
LRUHandle* pHandle = taosLRUCacheLookup(pCache, buf, len);
if (pHandle == NULL) {
taosThreadMutexUnlock(pLock);
@@ -458,56 +487,69 @@ int32_t metaGetCachedTableUidList(SMeta* pMeta, tb_uid_t suid, const uint8_t* pK
// set the result into the buffer
taosArrayAddBatch(pList1, p + sizeof(int32_t), size);
- times = atomic_add_fetch_32(&(*pEntry)->qTimes, 1);
+ (*pEntry)->hitTimes += 1;
+
+ uint32_t acc = pMeta->pCache->sTagFilterResCache.accTimes;
+ if ((*pEntry)->hitTimes % 5000 == 0 && (*pEntry)->hitTimes > 0) {
+ metaInfo("cache hit:%d, total acc:%d, rate:%.2f", (*pEntry)->hitTimes, acc, ((double)(*pEntry)->hitTimes) / acc);
+ }
+
taosLRUCacheRelease(pCache, pHandle, false);
// unlock meta
taosThreadMutexUnlock(pLock);
+ return TSDB_CODE_SUCCESS;
+}
+
+static void freePayload(const void* key, size_t keyLen, void* value) {
+ if (value == NULL) {
+ return;
+ }
+
+ const uint64_t* p = key;
+ if (keyLen != sizeof(int64_t) * 4) {
+ metaError("key length is invalid, length:%d, expect:%d", (int32_t)keyLen, (int32_t)sizeof(uint64_t) * 2);
+ return;
+ }
- // check if scanning all items are necessary or not
- if (times >= 5000 && TD_DLIST_NELES(&(*pEntry)->list) > 10) {
- taosThreadMutexLock(pLock);
+ SHashObj* pHashObj = (SHashObj*)p[0];
+ STagFilterResEntry** pEntry = taosHashGet(pHashObj, &p[1], sizeof(uint64_t));
- SArray* pInvalidRes = taosArrayInit(64, POINTER_BYTES);
+ {
+ int64_t st = taosGetTimestampUs();
SListIter iter = {0};
- tdListInitIter(&(*pEntry)->list, &iter, TD_LIST_FORWARD);
+ tdListInitIter((SList*)&((*pEntry)->list), &iter, TD_LIST_FORWARD);
SListNode* pNode = NULL;
while ((pNode = tdListNext(&iter)) != NULL) {
- memcpy(&buf[1], pNode->data, keyLen);
-
- // check whether it is existed in LRU cache, and remove it from linked list if not.
- LRUHandle* pRes = taosLRUCacheLookup(pCache, buf, len);
- if (pRes == NULL) { // remove the item in the linked list
- taosArrayPush(pInvalidRes, &pNode);
- } else {
- taosLRUCacheRelease(pCache, pRes, false);
+ uint64_t* digest = (uint64_t*)pNode->data;
+ if (digest[0] == p[2] && digest[1] == p[3]) {
+ void* tmp = tdListPopNode(&((*pEntry)->list), pNode);
+ taosMemoryFree(tmp);
+
+ int64_t et = taosGetTimestampUs();
+ metaInfo("clear items in cache, remain cached item:%d, elapsed time:%.2fms", listNEles(&((*pEntry)->list)),
+ (et - st) / 1000.0);
+ break;
}
}
-
- // remove the keys, of which query uid lists have been replaced already.
- size_t s = taosArrayGetSize(pInvalidRes);
- for (int32_t i = 0; i < s; ++i) {
- SListNode** p1 = taosArrayGet(pInvalidRes, i);
- tdListPopNode(&(*pEntry)->list, *p1);
- taosMemoryFree(*p1);
- }
-
- atomic_store_32(&(*pEntry)->qTimes, 0); // reset the query times
- taosArrayDestroy(pInvalidRes);
-
- taosThreadMutexUnlock(pLock);
}
- return TSDB_CODE_SUCCESS;
+ taosMemoryFree(value);
}
-static void freePayload(const void* key, size_t keyLen, void* value) {
- if (value == NULL) {
- return;
+static int32_t addNewEntry(SHashObj* pTableEntry, const void* pKey, int32_t keyLen, uint64_t suid) {
+ STagFilterResEntry* p = taosMemoryMalloc(sizeof(STagFilterResEntry));
+ if (p == NULL) {
+ return TSDB_CODE_OUT_OF_MEMORY;
}
- taosMemoryFree(value);
+
+ p->hitTimes = 0;
+ tdListInit(&p->list, keyLen);
+ taosHashPut(pTableEntry, &suid, sizeof(uint64_t), &p, POINTER_BYTES);
+ tdListAppend(&p->list, pKey);
+ return 0;
}
// check both the payload size and selectivity ratio
@@ -533,42 +575,61 @@ int32_t metaUidFilterCachePut(SMeta* pMeta, uint64_t suid, const void* pKey, int
SHashObj* pTableEntry = pMeta->pCache->sTagFilterResCache.pTableEntry;
TdThreadMutex* pLock = &pMeta->pCache->sTagFilterResCache.lock;
+ // the format of key:
+ // hash table address(8bytes) + suid(8bytes) + MD5 digest(16bytes)
+
+ uint64_t buf[4] = {0};
+ buf[0] = (uint64_t) pTableEntry;
+ buf[1] = suid;
+ memcpy(&buf[2], pKey, keyLen);
+ ASSERT(keyLen == 16);
+
+ int32_t code = 0;
taosThreadMutexLock(pLock);
STagFilterResEntry** pEntry = taosHashGet(pTableEntry, &suid, sizeof(uint64_t));
if (pEntry == NULL) {
- STagFilterResEntry* p = taosMemoryMalloc(sizeof(STagFilterResEntry));
- p->qTimes = 0;
- tdListInit(&p->list, keyLen);
- taosHashPut(pTableEntry, &suid, sizeof(uint64_t), &p, POINTER_BYTES);
- tdListAppend(&p->list, pKey);
+ code = addNewEntry(pTableEntry, pKey, keyLen, suid);
+ if (code != TSDB_CODE_SUCCESS) {
+ goto _end;
+ }
} else {
- tdListAppend(&(*pEntry)->list, pKey);
+ // check if it exists or not
+ size_t size = listNEles(&(*pEntry)->list);
+ if (size == 0) {
+ tdListAppend(&(*pEntry)->list, pKey);
+ } else {
+ SListNode* pNode = listHead(&(*pEntry)->list);
+ uint64_t* p = (uint64_t*)pNode->data;
+ if (p[1] == ((uint64_t*)pKey)[1] && p[0] == ((uint64_t*)pKey)[0]) {
+ // we have already found the existed items, no need to added to cache anymore.
+ taosThreadMutexUnlock(pLock);
+ return TSDB_CODE_SUCCESS;
+ } else { // not equal, append it
+ tdListAppend(&(*pEntry)->list, pKey);
+ }
+ }
}
- uint64_t buf[3] = {0};
- buf[0] = suid;
-
- memcpy(&buf[1], pKey, keyLen);
- ASSERT(sizeof(uint64_t) + keyLen == 24);
-
// add to cache.
- taosLRUCacheInsert(pCache, buf, sizeof(uint64_t) + keyLen, pPayload, payloadLen, freePayload, NULL,
+ taosLRUCacheInsert(pCache, buf, sizeof(uint64_t)*2 + keyLen, pPayload, payloadLen, freePayload, NULL,
TAOS_LRU_PRIORITY_LOW);
-
+ _end:
taosThreadMutexUnlock(pLock);
metaDebug("vgId:%d, suid:%" PRIu64 " list cache added into cache, total:%d, tables:%d", TD_VID(pMeta->pVnode), suid,
(int32_t)taosLRUCacheGetUsage(pCache), taosHashGetSize(pTableEntry));
- return TSDB_CODE_SUCCESS;
+ return code;
}
// remove the lru cache that are expired due to the tags value update, or creating, or dropping, of child tables
int32_t metaUidCacheClear(SMeta* pMeta, uint64_t suid) {
int32_t keyLen = sizeof(uint64_t) * 3;
- uint64_t p[3] = {0};
- p[0] = suid;
+ uint64_t p[4] = {0};
+
+ p[0] = (uint64_t) pMeta->pCache->sTagFilterResCache.pTableEntry;
+ p[1] = suid;
TdThreadMutex* pLock = &pMeta->pCache->sTagFilterResCache.lock;
@@ -584,11 +645,11 @@ int32_t metaUidCacheClear(SMeta* pMeta, uint64_t suid) {
SListNode* pNode = NULL;
while ((pNode = tdListNext(&iter)) != NULL) {
- memcpy(&p[1], pNode->data, 16);
+ memcpy(&p[2], pNode->data, 16);
taosLRUCacheErase(pMeta->pCache->sTagFilterResCache.pUidResCache, p, keyLen);
}
- (*pEntry)->qTimes = 0;
+ (*pEntry)->hitTimes = 0;
tdListEmpty(&(*pEntry)->list);
taosThreadMutexUnlock(pLock);
diff --git a/source/dnode/vnode/src/meta/metaOpen.c b/source/dnode/vnode/src/meta/metaOpen.c
index 35677d6f07e615b814ac42c7d6f9b84fece96a41..550d7b587cd94c132cad65d6d84540395b0c01e9 100644
--- a/source/dnode/vnode/src/meta/metaOpen.c
+++ b/source/dnode/vnode/src/meta/metaOpen.c
@@ -201,7 +201,8 @@ _err:
return -1;
}
-int metaClose(SMeta *pMeta) {
+int metaClose(SMeta **ppMeta) {
+ SMeta *pMeta = *ppMeta;
if (pMeta) {
if (pMeta->pEnv) metaAbort(pMeta);
if (pMeta->pCache) metaCacheClose(pMeta);
@@ -221,7 +222,8 @@ int metaClose(SMeta *pMeta) {
if (pMeta->pTbDb) tdbTbClose(pMeta->pTbDb);
if (pMeta->pEnv) tdbClose(pMeta->pEnv);
metaDestroyLock(pMeta);
- taosMemoryFree(pMeta);
+
+ taosMemoryFreeClear(*ppMeta);
}
return 0;
diff --git a/source/dnode/vnode/src/meta/metaQuery.c b/source/dnode/vnode/src/meta/metaQuery.c
index 28bac3e8d0077399c89c8689ec7299ad2c1a9596..20f789b348f9b731f050c54ae89cb9d1a422b47f 100644
--- a/source/dnode/vnode/src/meta/metaQuery.c
+++ b/source/dnode/vnode/src/meta/metaQuery.c
@@ -1371,13 +1371,14 @@ static int32_t metaGetTableTagByUid(SMeta *pMeta, int64_t suid, int64_t uid, voi
return ret;
}
-int32_t metaGetTableTagsByUids(SMeta *pMeta, int64_t suid, SArray *uidList, SHashObj *tags) {
+
+int32_t metaGetTableTagsByUids(SMeta *pMeta, int64_t suid, SArray *uidList) {
const int32_t LIMIT = 128;
int32_t isLock = false;
int32_t sz = uidList ? taosArrayGetSize(uidList) : 0;
for (int i = 0; i < sz; i++) {
- tb_uid_t *id = taosArrayGet(uidList, i);
+ STUidTagInfo *p = taosArrayGet(uidList, i);
if (i % LIMIT == 0) {
if (isLock) metaULock(pMeta);
@@ -1386,51 +1387,72 @@ int32_t metaGetTableTagsByUids(SMeta *pMeta, int64_t suid, SArray *uidList, SHas
isLock = true;
}
- if (taosHashGet(tags, id, sizeof(tb_uid_t)) == NULL) {
+// if (taosHashGet(tags, &p->uid, sizeof(tb_uid_t)) == NULL) {
void *val = NULL;
int32_t len = 0;
- if (metaGetTableTagByUid(pMeta, suid, *id, &val, &len, false) == 0) {
- taosHashPut(tags, id, sizeof(tb_uid_t), val, len);
+ if (metaGetTableTagByUid(pMeta, suid, p->uid, &val, &len, false) == 0) {
+ p->pTagVal = taosMemoryMalloc(len);
+ memcpy(p->pTagVal, val, len);
tdbFree(val);
} else {
- metaError("vgId:%d, failed to table IDs, suid: %" PRId64 ", uid: %" PRId64 "", TD_VID(pMeta->pVnode), suid,
- *id);
+ metaError("vgId:%d, failed to table tags, suid: %" PRId64 ", uid: %" PRId64 "", TD_VID(pMeta->pVnode), suid,
+ p->uid);
}
}
- }
+// }
if (isLock) metaULock(pMeta);
-
return 0;
}
-int32_t metaGetTableTags(SMeta *pMeta, uint64_t suid, SArray *uidList, SHashObj *tags) {
+int32_t metaGetTableTags(SMeta *pMeta, uint64_t suid, SArray *pUidTagInfo) {
SMCtbCursor *pCur = metaOpenCtbCursor(pMeta, suid, 1);
- SHashObj *uHash = NULL;
- size_t len = taosArrayGetSize(uidList); // len > 0 means there already have uids
- if (len > 0) {
- uHash = taosHashInit(32, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), false, HASH_NO_LOCK);
- for (int i = 0; i < len; i++) {
- int64_t *uid = taosArrayGet(uidList, i);
- taosHashPut(uHash, uid, sizeof(int64_t), &i, sizeof(i));
+ // If len > 0 means there already have uids, and we only want the
+ // tags of the specified tables, of which uid in the uid list. Otherwise, all table tags are retrieved and kept
+ // in the hash map, that may require a lot of memory
+ SHashObj *pSepecifiedUidMap = NULL;
+ size_t numOfElems = taosArrayGetSize(pUidTagInfo);
+ if (numOfElems > 0) {
+ pSepecifiedUidMap = taosHashInit(numOfElems / 0.7, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), false, HASH_NO_LOCK);
+ for (int i = 0; i < numOfElems; i++) {
+ STUidTagInfo *pTagInfo = taosArrayGet(pUidTagInfo, i);
+ taosHashPut(pSepecifiedUidMap, &pTagInfo->uid, sizeof(uint64_t), &i, sizeof(int32_t));
}
}
- while (1) {
- tb_uid_t id = metaCtbCursorNext(pCur);
- if (id == 0) {
- break;
- }
- if (len > 0 && taosHashGet(uHash, &id, sizeof(int64_t)) == NULL) {
- continue;
- } else if (len == 0) {
- taosArrayPush(uidList, &id);
+ if (numOfElems == 0) { // all data needs to be added into the pUidTagInfo list
+ while (1) {
+ tb_uid_t uid = metaCtbCursorNext(pCur);
+ if (uid == 0) {
+ break;
+ }
+
+ STUidTagInfo info = {.uid = uid, .pTagVal = pCur->pVal};
+ info.pTagVal = taosMemoryMalloc(pCur->vLen);
+ memcpy(info.pTagVal, pCur->pVal, pCur->vLen);
+ taosArrayPush(pUidTagInfo, &info);
}
+ } else { // only the specified tables need to be added
+ while (1) {
+ tb_uid_t uid = metaCtbCursorNext(pCur);
+ if (uid == 0) {
+ break;
+ }
- taosHashPut(tags, &id, sizeof(int64_t), pCur->pVal, pCur->vLen);
+ int32_t *index = taosHashGet(pSepecifiedUidMap, &uid, sizeof(uint64_t));
+ if (index == NULL) {
+ continue;
+ }
+
+ STUidTagInfo *pTagInfo = taosArrayGet(pUidTagInfo, *index);
+ if (pTagInfo->pTagVal == NULL) {
+ pTagInfo->pTagVal = taosMemoryMalloc(pCur->vLen);
+ memcpy(pTagInfo->pTagVal, pCur->pVal, pCur->vLen);
+ }
+ }
}
- taosHashCleanup(uHash);
+ taosHashCleanup(pSepecifiedUidMap);
metaCloseCtbCursor(pCur, 1);
return TSDB_CODE_SUCCESS;
}
diff --git a/source/dnode/vnode/src/meta/metaTable.c b/source/dnode/vnode/src/meta/metaTable.c
index 60a27bec102d78983747aa89fa1dd11c9f0c10f3..7406f51d4ba06643af9aa8ce563645c7f8636fb2 100644
--- a/source/dnode/vnode/src/meta/metaTable.c
+++ b/source/dnode/vnode/src/meta/metaTable.c
@@ -1343,6 +1343,9 @@ static int metaUpdateTagIdx(SMeta *pMeta, const SMetaEntry *pCtbEntry) {
int32_t ret = 0;
// get super table
if (tdbTbGet(pMeta->pUidIdx, &pCtbEntry->ctbEntry.suid, sizeof(tb_uid_t), &pData, &nData) != 0) {
+ metaError("vgId:%d, failed to get stable suid for update. version:%" PRId64, TD_VID(pMeta->pVnode),
+ pCtbEntry->version);
+ terrno = TSDB_CODE_TDB_INVALID_TABLE_ID;
ret = -1;
goto end;
}
diff --git a/source/dnode/vnode/src/sma/smaEnv.c b/source/dnode/vnode/src/sma/smaEnv.c
index a272f5fc97883943e95d8ee7feb1c60ec90d49cb..886f8d5c07104aae4533116e348c3f0a9d367f86 100644
--- a/source/dnode/vnode/src/sma/smaEnv.c
+++ b/source/dnode/vnode/src/sma/smaEnv.c
@@ -279,10 +279,7 @@ static void tdDestroyRSmaStat(void *pRSmaStat) {
// step 1: set rsma trigger stat cancelled
atomic_store_8(RSMA_TRIGGER_STAT(pStat), TASK_TRIGGER_STAT_CANCELLED);
- // step 2: destroy the rsma info and associated fetch tasks
- taosHashCleanup(RSMA_INFO_HASH(pStat));
-
- // step 3: wait for all triggered fetch tasks to finish
+ // step 2: wait for all triggered fetch tasks to finish
int32_t nLoops = 0;
while (1) {
if (T_REF_VAL_GET((SSmaStat *)pStat) == 0) {
@@ -298,9 +295,12 @@ static void tdDestroyRSmaStat(void *pRSmaStat) {
}
}
- // step 4:
+ // step 3:
tdRsmaStopExecutor(pSma);
+ // step 4: destroy the rsma info and associated fetch tasks
+ taosHashCleanup(RSMA_INFO_HASH(pStat));
+
// step 5:
tdRSmaFSClose(RSMA_FS(pStat));
diff --git a/source/dnode/vnode/src/tq/tq.c b/source/dnode/vnode/src/tq/tq.c
index cca241a1cf7926b9df4e19aaad884ffa081382ee..276de64bbdc8ef77c4fafb0f9837ce3aff882154 100644
--- a/source/dnode/vnode/src/tq/tq.c
+++ b/source/dnode/vnode/src/tq/tq.c
@@ -106,7 +106,7 @@ STQ* tqOpen(const char* path, SVnode* pVnode) {
return NULL;
}
- if (streamLoadTasks(pTq->pStreamMeta) < 0) {
+ if (streamLoadTasks(pTq->pStreamMeta, walGetCommittedVer(pVnode->pWal)) < 0) {
return NULL;
}
@@ -816,7 +816,6 @@ int32_t tqProcessSubscribeReq(STQ* pTq, int64_t version, char* msg, int32_t msgL
// TODO version should be assigned and refed during preprocess
SWalRef* pRef = walRefCommittedVer(pTq->pVnode->pWal);
if (pRef == NULL) {
- ASSERT(0);
return -1;
}
int64_t ver = pRef->refVer;
@@ -837,12 +836,9 @@ int32_t tqProcessSubscribeReq(STQ* pTq, int64_t version, char* msg, int32_t msgL
pHandle->execHandle.task =
qCreateQueueExecTaskInfo(pHandle->execHandle.execCol.qmsg, &handle, &pHandle->execHandle.numOfCols, NULL);
- ASSERT(pHandle->execHandle.task);
void* scanner = NULL;
qExtractStreamScanner(pHandle->execHandle.task, &scanner);
- ASSERT(scanner);
pHandle->execHandle.pExecReader = qExtractReaderFromStreamScanner(scanner);
- ASSERT(pHandle->execHandle.pExecReader);
} else if (pHandle->execHandle.subType == TOPIC_SUB_TYPE__DB) {
pHandle->pWalReader = walOpenReader(pTq->pVnode->pWal, NULL);
pHandle->execHandle.pExecReader = tqOpenReader(pTq->pVnode);
@@ -875,8 +871,7 @@ int32_t tqProcessSubscribeReq(STQ* pTq, int64_t version, char* msg, int32_t msgL
taosHashPut(pTq->pHandle, req.subKey, strlen(req.subKey), pHandle, sizeof(STqHandle));
tqDebug("try to persist handle %s consumer %" PRId64, req.subKey, pHandle->consumerId);
if (tqMetaSaveHandle(pTq, req.subKey, pHandle) < 0) {
- // TODO
- ASSERT(0);
+ return -1;
}
} else {
/*ASSERT(pExec->consumerId == req.oldConsumerId);*/
@@ -886,8 +881,7 @@ int32_t tqProcessSubscribeReq(STQ* pTq, int64_t version, char* msg, int32_t msgL
atomic_add_fetch_32(&pHandle->epoch, 1);
taosMemoryFree(req.qmsg);
if (tqMetaSaveHandle(pTq, req.subKey, pHandle) < 0) {
- // TODO
- ASSERT(0);
+ return -1;
}
// close handle
}
@@ -1202,6 +1196,9 @@ int32_t tqProcessTaskRecover2Req(STQ* pTq, int64_t version, char* msg, int32_t m
return -1;
}
+ atomic_store_8(&pTask->fillHistory, 0);
+ streamMetaSaveTask(pTq->pStreamMeta, pTask);
+
streamMetaReleaseTask(pTq->pStreamMeta, pTask);
return 0;
diff --git a/source/dnode/vnode/src/tq/tqMeta.c b/source/dnode/vnode/src/tq/tqMeta.c
index 3ad01e2370bae65d474d06c0f4dde37c1df96f48..34f57bc697a2e6ad0fb80f8a437b12bb9070dea0 100644
--- a/source/dnode/vnode/src/tq/tqMeta.c
+++ b/source/dnode/vnode/src/tq/tqMeta.c
@@ -71,17 +71,14 @@ int32_t tDecodeSTqHandle(SDecoder* pDecoder, STqHandle* pHandle) {
int32_t tqMetaOpen(STQ* pTq) {
if (tdbOpen(pTq->path, 16 * 1024, 1, &pTq->pMetaDB, 0) < 0) {
- ASSERT(0);
return -1;
}
if (tdbTbOpen("tq.db", -1, -1, NULL, pTq->pMetaDB, &pTq->pExecStore, 0) < 0) {
- ASSERT(0);
return -1;
}
if (tdbTbOpen("tq.check.db", -1, -1, NULL, pTq->pMetaDB, &pTq->pCheckStore, 0) < 0) {
- ASSERT(0);
return -1;
}
@@ -197,40 +194,49 @@ int32_t tqMetaSaveHandle(STQ* pTq, const char* key, const STqHandle* pHandle) {
int32_t code;
int32_t vlen;
tEncodeSize(tEncodeSTqHandle, pHandle, vlen, code);
- ASSERT(code == 0);
tqDebug("tq save %s(%d) consumer %" PRId64 " vgId:%d", pHandle->subKey, (int32_t)strlen(pHandle->subKey),
pHandle->consumerId, TD_VID(pTq->pVnode));
void* buf = taosMemoryCalloc(1, vlen);
if (buf == NULL) {
- ASSERT(0);
+ return -1;
}
SEncoder encoder;
tEncoderInit(&encoder, buf, vlen);
if (tEncodeSTqHandle(&encoder, pHandle) < 0) {
- ASSERT(0);
+ tEncoderClear(&encoder);
+ taosMemoryFree(buf);
+ return -1;
}
TXN* txn;
if (tdbBegin(pTq->pMetaDB, &txn, tdbDefaultMalloc, tdbDefaultFree, NULL, TDB_TXN_WRITE | TDB_TXN_READ_UNCOMMITTED) <
0) {
- ASSERT(0);
+ tEncoderClear(&encoder);
+ taosMemoryFree(buf);
+ return -1;
}
if (tdbTbUpsert(pTq->pExecStore, key, (int)strlen(key), buf, vlen, txn) < 0) {
- ASSERT(0);
+ tEncoderClear(&encoder);
+ taosMemoryFree(buf);
+ return -1;
}
if (tdbCommit(pTq->pMetaDB, txn) < 0) {
- ASSERT(0);
+ tEncoderClear(&encoder);
+ taosMemoryFree(buf);
+ return -1;
}
if (tdbPostCommit(pTq->pMetaDB, txn) < 0) {
- ASSERT(0);
+ tEncoderClear(&encoder);
+ taosMemoryFree(buf);
+ return -1;
}
tEncoderClear(&encoder);
diff --git a/source/dnode/vnode/src/tq/tqOffset.c b/source/dnode/vnode/src/tq/tqOffset.c
index 9e04b70f41d7041a9c8d72a5c63be5a4b59105bb..338f9d6c2424d65e4dd289c728b72c01f0c971d7 100644
--- a/source/dnode/vnode/src/tq/tqOffset.c
+++ b/source/dnode/vnode/src/tq/tqOffset.c
@@ -101,7 +101,8 @@ STqOffsetStore* tqOffsetOpen(STQ* pTq) {
}
char* fname = tqOffsetBuildFName(pStore->pTq->path, 0);
if (tqOffsetRestoreFromFile(pStore, fname) < 0) {
- ASSERT(0);
+ taosMemoryFree(fname);
+ return NULL;
}
taosMemoryFree(fname);
return pStore;
diff --git a/source/dnode/vnode/src/tq/tqPush.c b/source/dnode/vnode/src/tq/tqPush.c
index f89bc2036252961ff10d81774a9c6f756fdebf43..b9df3e58266528810f894750fe12be43b9e44003 100644
--- a/source/dnode/vnode/src/tq/tqPush.c
+++ b/source/dnode/vnode/src/tq/tqPush.c
@@ -307,7 +307,7 @@ int tqPushMsg(STQ* pTq, void* msg, int32_t msgLen, tmsg_t msgType, int64_t ver)
taosWUnLockLatch(&pTq->pushLock);
}
- if (vnodeIsRoleLeader(pTq->pVnode)) {
+ if (!tsDisableStream && vnodeIsRoleLeader(pTq->pVnode)) {
if (taosHashGetSize(pTq->pStreamMeta->pTasks) == 0) return 0;
if (msgType == TDMT_VND_SUBMIT) {
void* data = taosMemoryMalloc(msgLen);
diff --git a/source/dnode/vnode/src/tsdb/tsdbCache.c b/source/dnode/vnode/src/tsdb/tsdbCache.c
index 0fc5b617bbb83e514ff8e00295d68295f70d1bb1..0b671e2bf5c54318b7447c7d02f2126dad3ab6ca 100644
--- a/source/dnode/vnode/src/tsdb/tsdbCache.c
+++ b/source/dnode/vnode/src/tsdb/tsdbCache.c
@@ -15,17 +15,51 @@
#include "tsdb.h"
+static int32_t tsdbOpenBICache(STsdb *pTsdb) {
+ int32_t code = 0;
+ SLRUCache *pCache = taosLRUCacheInit(10 * 1024 * 1024, 0, .5);
+ if (pCache == NULL) {
+ code = TSDB_CODE_OUT_OF_MEMORY;
+ goto _err;
+ }
+
+ taosLRUCacheSetStrictCapacity(pCache, false);
+
+ taosThreadMutexInit(&pTsdb->biMutex, NULL);
+
+_err:
+ pTsdb->biCache = pCache;
+ return code;
+}
+
+static void tsdbCloseBICache(STsdb *pTsdb) {
+ SLRUCache *pCache = pTsdb->biCache;
+ if (pCache) {
+ taosLRUCacheEraseUnrefEntries(pCache);
+
+ taosLRUCacheCleanup(pCache);
+
+ taosThreadMutexDestroy(&pTsdb->biMutex);
+ }
+}
+
int32_t tsdbOpenCache(STsdb *pTsdb) {
int32_t code = 0;
SLRUCache *pCache = NULL;
size_t cfgCapacity = pTsdb->pVnode->config.cacheLastSize * 1024 * 1024;
- pCache = taosLRUCacheInit(cfgCapacity, -1, .5);
+ pCache = taosLRUCacheInit(cfgCapacity, 1, .5);
if (pCache == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY;
goto _err;
}
+ code = tsdbOpenBICache(pTsdb);
+ if (code != TSDB_CODE_SUCCESS) {
+ code = TSDB_CODE_OUT_OF_MEMORY;
+ goto _err;
+ }
+
taosLRUCacheSetStrictCapacity(pCache, false);
taosThreadMutexInit(&pTsdb->lruMutex, NULL);
@@ -44,6 +78,8 @@ void tsdbCloseCache(STsdb *pTsdb) {
taosThreadMutexDestroy(&pTsdb->lruMutex);
}
+
+ tsdbCloseBICache(pTsdb);
}
static void getTableCacheKey(tb_uid_t uid, int cacheType, char *key, int *len) {
@@ -208,6 +244,11 @@ int32_t tsdbCacheInsertLastrow(SLRUCache *pCache, STsdb *pTsdb, tb_uid_t uid, ST
int16_t nCol = taosArrayGetSize(pLast);
int16_t iCol = 0;
+ if (nCol != pTSchema->numOfCols) {
+ invalidate = true;
+ goto _invalidate;
+ }
+
SLastCol *tTsVal = (SLastCol *)taosArrayGet(pLast, iCol);
if (keyTs > tTsVal->ts) {
STColumn *pTColumn = &pTSchema->columns[0];
@@ -223,6 +264,12 @@ int32_t tsdbCacheInsertLastrow(SLRUCache *pCache, STsdb *pTsdb, tb_uid_t uid, ST
SColVal colVal = {0};
tTSRowGetVal(row, pTSchema, iCol, &colVal);
+
+ if (colVal.cid != tColVal->cid) {
+ invalidate = true;
+ goto _invalidate;
+ }
+
if (!COL_VAL_IS_NONE(&colVal)) {
if (keyTs == tTsVal1->ts && !COL_VAL_IS_NONE(tColVal)) {
invalidate = true;
@@ -232,7 +279,8 @@ int32_t tsdbCacheInsertLastrow(SLRUCache *pCache, STsdb *pTsdb, tb_uid_t uid, ST
SLastCol lastCol = {.ts = keyTs, .colVal = colVal};
if (IS_VAR_DATA_TYPE(colVal.type) && colVal.value.nData > 0) {
SLastCol *pLastCol = (SLastCol *)taosArrayGet(pLast, iCol);
- taosMemoryFree(pLastCol->colVal.value.pData);
+ if (pLastCol->colVal.value.nData > 0 && NULL != pLastCol->colVal.value.pData)
+ taosMemoryFree(pLastCol->colVal.value.pData);
lastCol.colVal.value.pData = taosMemoryMalloc(colVal.value.nData);
if (lastCol.colVal.value.pData == NULL) {
@@ -279,6 +327,11 @@ int32_t tsdbCacheInsertLast(SLRUCache *pCache, tb_uid_t uid, STSRow *row, STsdb
int16_t nCol = taosArrayGetSize(pLast);
int16_t iCol = 0;
+ if (nCol != pTSchema->numOfCols) {
+ invalidate = true;
+ goto _invalidate;
+ }
+
SLastCol *tTsVal = (SLastCol *)taosArrayGet(pLast, iCol);
if (keyTs > tTsVal->ts) {
STColumn *pTColumn = &pTSchema->columns[0];
@@ -294,6 +347,12 @@ int32_t tsdbCacheInsertLast(SLRUCache *pCache, tb_uid_t uid, STSRow *row, STsdb
SColVal colVal = {0};
tTSRowGetVal(row, pTSchema, iCol, &colVal);
+
+ if (colVal.cid != tColVal->cid) {
+ invalidate = true;
+ goto _invalidate;
+ }
+
if (COL_VAL_IS_VALUE(&colVal)) {
if (keyTs == tTsVal1->ts && COL_VAL_IS_VALUE(tColVal)) {
invalidate = true;
@@ -303,7 +362,8 @@ int32_t tsdbCacheInsertLast(SLRUCache *pCache, tb_uid_t uid, STSRow *row, STsdb
SLastCol lastCol = {.ts = keyTs, .colVal = colVal};
if (IS_VAR_DATA_TYPE(colVal.type) && colVal.value.nData > 0) {
SLastCol *pLastCol = (SLastCol *)taosArrayGet(pLast, iCol);
- taosMemoryFree(pLastCol->colVal.value.pData);
+ if (pLastCol->colVal.value.nData > 0 && NULL != pLastCol->colVal.value.pData)
+ taosMemoryFree(pLastCol->colVal.value.pData);
lastCol.colVal.value.pData = taosMemoryMalloc(colVal.value.nData);
if (lastCol.colVal.value.pData == NULL) {
@@ -584,6 +644,7 @@ typedef struct SFSNextRowIter {
SArray *aDFileSet;
SDataFReader **pDataFReader;
SArray *aBlockIdx;
+ LRUHandle *aBlockIdxHandle;
SBlockIdx *pBlockIdx;
SMapData blockMap;
int32_t nBlock;
@@ -637,6 +698,7 @@ static int32_t getNextRowFromFS(void *iter, TSDBROW **ppRow) {
}
// tMapDataReset(&state->blockIdxMap);
+ /*
if (!state->aBlockIdx) {
state->aBlockIdx = taosArrayInit(0, sizeof(SBlockIdx));
} else {
@@ -644,6 +706,13 @@ static int32_t getNextRowFromFS(void *iter, TSDBROW **ppRow) {
}
code = tsdbReadBlockIdx(*state->pDataFReader, state->aBlockIdx);
if (code) goto _err;
+ */
+ int32_t code =
+ tsdbCacheGetBlockIdx((*state->pDataFReader)->pTsdb->biCache, *state->pDataFReader, &state->aBlockIdxHandle);
+ if (code != TSDB_CODE_SUCCESS || state->aBlockIdxHandle == NULL) {
+ goto _err;
+ }
+ state->aBlockIdx = (SArray *)taosLRUCacheValue((*state->pDataFReader)->pTsdb->biCache, state->aBlockIdxHandle);
/* if (state->pBlockIdx) { */
/* } */
@@ -712,7 +781,10 @@ static int32_t getNextRowFromFS(void *iter, TSDBROW **ppRow) {
// resetLastBlockLoadInfo(state->pLoadInfo);
if (state->aBlockIdx) {
- taosArrayDestroy(state->aBlockIdx);
+ // taosArrayDestroy(state->aBlockIdx);
+ tsdbBICacheRelease((*state->pDataFReader)->pTsdb->biCache, state->aBlockIdxHandle);
+
+ state->aBlockIdxHandle = NULL;
state->aBlockIdx = NULL;
}
@@ -735,7 +807,10 @@ _err:
resetLastBlockLoadInfo(state->pLoadInfo);
}*/
if (state->aBlockIdx) {
- taosArrayDestroy(state->aBlockIdx);
+ // taosArrayDestroy(state->aBlockIdx);
+ tsdbBICacheRelease((*state->pDataFReader)->pTsdb->biCache, state->aBlockIdxHandle);
+
+ state->aBlockIdxHandle = NULL;
state->aBlockIdx = NULL;
}
if (state->pBlockData) {
@@ -761,7 +836,10 @@ int32_t clearNextRowFromFS(void *iter) {
state->pDataFReader = NULL;
}*/
if (state->aBlockIdx) {
- taosArrayDestroy(state->aBlockIdx);
+ // taosArrayDestroy(state->aBlockIdx);
+ tsdbBICacheRelease((*state->pDataFReader)->pTsdb->biCache, state->aBlockIdxHandle);
+
+ state->aBlockIdxHandle = NULL;
state->aBlockIdx = NULL;
}
if (state->pBlockData) {
@@ -1475,3 +1553,84 @@ size_t tsdbCacheGetUsage(SVnode *pVnode) {
return usage;
}
+
+static void getBICacheKey(int32_t fid, int64_t commitID, char *key, int *len) {
+ struct {
+ int32_t fid;
+ int64_t commitID;
+ } biKey = {0};
+
+ biKey.fid = fid;
+ biKey.commitID = commitID;
+
+ *len = sizeof(biKey);
+ memcpy(key, &biKey, *len);
+}
+
+static int32_t tsdbCacheLoadBlockIdx(SDataFReader *pFileReader, SArray **aBlockIdx) {
+ SArray *pArray = taosArrayInit(8, sizeof(SBlockIdx));
+ int32_t code = tsdbReadBlockIdx(pFileReader, pArray);
+
+ if (code != TSDB_CODE_SUCCESS) {
+ taosArrayDestroy(pArray);
+ code = TSDB_CODE_OUT_OF_MEMORY;
+ return code;
+ }
+
+ *aBlockIdx = pArray;
+
+ return code;
+}
+
+static void deleteBICache(const void *key, size_t keyLen, void *value) {
+ SArray *pArray = (SArray *)value;
+
+ taosArrayDestroy(pArray);
+}
+
+int32_t tsdbCacheGetBlockIdx(SLRUCache *pCache, SDataFReader *pFileReader, LRUHandle **handle) {
+ int32_t code = 0;
+ char key[128] = {0};
+ int keyLen = 0;
+
+ getBICacheKey(pFileReader->pSet->fid, pFileReader->pSet->pHeadF->commitID, key, &keyLen);
+ LRUHandle *h = taosLRUCacheLookup(pCache, key, keyLen);
+ if (!h) {
+ STsdb *pTsdb = pFileReader->pTsdb;
+ taosThreadMutexLock(&pTsdb->biMutex);
+
+ h = taosLRUCacheLookup(pCache, key, keyLen);
+ if (!h) {
+ SArray *pArray = NULL;
+ code = tsdbCacheLoadBlockIdx(pFileReader, &pArray);
+ // if table's empty or error, return code of -1
+ if (code != TSDB_CODE_SUCCESS || pArray == NULL) {
+ taosThreadMutexUnlock(&pTsdb->biMutex);
+
+ *handle = NULL;
+ return 0;
+ }
+
+ size_t charge = pArray->capacity * pArray->elemSize + sizeof(*pArray);
+ _taos_lru_deleter_t deleter = deleteBICache;
+ LRUStatus status = taosLRUCacheInsert(pCache, key, keyLen, pArray, charge, deleter, &h, TAOS_LRU_PRIORITY_LOW);
+ if (status != TAOS_LRU_STATUS_OK) {
+ code = -1;
+ }
+ }
+
+ taosThreadMutexUnlock(&pTsdb->biMutex);
+ }
+
+ *handle = h;
+
+ return code;
+}
+
+int32_t tsdbBICacheRelease(SLRUCache *pCache, LRUHandle *h) {
+ int32_t code = 0;
+
+ taosLRUCacheRelease(pCache, h, false);
+
+ return code;
+}
diff --git a/source/dnode/vnode/src/tsdb/tsdbCacheRead.c b/source/dnode/vnode/src/tsdb/tsdbCacheRead.c
index a837543e622ff652f91e1c51df26330298d23f0f..c94d2130c5c1939d5c8b9b7769292d19c0a732df 100644
--- a/source/dnode/vnode/src/tsdb/tsdbCacheRead.c
+++ b/source/dnode/vnode/src/tsdb/tsdbCacheRead.c
@@ -41,6 +41,13 @@ static int32_t saveOneRow(SArray* pRow, SSDataBlock* pBlock, SCacheRowsReader* p
int32_t slotId = slotIds[i];
SLastCol* pColVal = (SLastCol*)taosArrayGet(pRow, slotId);
+ // add check for null value, caused by the modification of table schema (new column added).
+ if (pColVal == NULL) {
+ p->ts = 0;
+ p->isNull = true;
+ continue;
+ }
+
p->ts = pColVal->ts;
p->isNull = !COL_VAL_IS_VALUE(&pColVal->colVal);
allNullRow = p->isNull & allNullRow;
@@ -99,6 +106,38 @@ static int32_t saveOneRow(SArray* pRow, SSDataBlock* pBlock, SCacheRowsReader* p
return TSDB_CODE_SUCCESS;
}
+static int32_t setTableSchema(SCacheRowsReader* p, uint64_t suid, const char* idstr) {
+ int32_t numOfTables = p->numOfTables;
+
+ if (suid != 0) {
+ p->pSchema = metaGetTbTSchema(p->pVnode->pMeta, suid, -1, 1);
+ if (p->pSchema == NULL) {
+ taosMemoryFree(p);
+ tsdbWarn("stable:%" PRIu64 " has been dropped, failed to retrieve cached rows, %s", suid, idstr);
+ return TSDB_CODE_PAR_TABLE_NOT_EXIST;
+ }
+ } else {
+ for (int32_t i = 0; i < numOfTables; ++i) {
+ uint64_t uid = p->pTableList[i].uid;
+ p->pSchema = metaGetTbTSchema(p->pVnode->pMeta, uid, -1, 1);
+ if (p->pSchema != NULL) {
+ break;
+ }
+
+ tsdbWarn("table:%" PRIu64 " has been dropped, failed to retrieve cached rows, %s", uid, idstr);
+ }
+
+ // all queried tables have been dropped already, return immediately.
+ if (p->pSchema == NULL) {
+ taosMemoryFree(p);
+ tsdbWarn("all queried tables has been dropped, try next group, %s", idstr);
+ return TSDB_CODE_PAR_TABLE_NOT_EXIST;
+ }
+ }
+
+ return TSDB_CODE_SUCCESS;
+}
+
int32_t tsdbCacherowsReaderOpen(void* pVnode, int32_t type, void* pTableIdList, int32_t numOfTables, int32_t numOfCols,
uint64_t suid, void** pReader, const char* idstr) {
*pReader = NULL;
@@ -117,11 +156,15 @@ int32_t tsdbCacherowsReaderOpen(void* pVnode, int32_t type, void* pTableIdList,
return TSDB_CODE_SUCCESS;
}
- STableKeyInfo* pKeyInfo = &((STableKeyInfo*)pTableIdList)[0];
- p->pSchema = metaGetTbTSchema(p->pVnode->pMeta, pKeyInfo->uid, -1, 1);
p->pTableList = pTableIdList;
p->numOfTables = numOfTables;
+ int32_t code = setTableSchema(p, suid, idstr);
+ if (code != TSDB_CODE_SUCCESS) {
+ tsdbCacherowsReaderClose(p);
+ return code;
+ }
+
p->transferBuf = taosMemoryCalloc(p->pSchema->numOfCols, POINTER_BYTES);
if (p->transferBuf == NULL) {
tsdbCacherowsReaderClose(p);
@@ -138,7 +181,8 @@ int32_t tsdbCacherowsReaderOpen(void* pVnode, int32_t type, void* pTableIdList,
}
}
- p->pLoadInfo = tCreateLastBlockLoadInfo(p->pSchema, NULL, 0);
+ int32_t numOfStt = ((SVnode*)pVnode)->config.sttTrigger;
+ p->pLoadInfo = tCreateLastBlockLoadInfo(p->pSchema, NULL, 0, numOfStt);
if (p->pLoadInfo == NULL) {
tsdbCacherowsReaderClose(p);
return TSDB_CODE_OUT_OF_MEMORY;
diff --git a/source/dnode/vnode/src/tsdb/tsdbFile.c b/source/dnode/vnode/src/tsdb/tsdbFile.c
index 3c944584de7ae10b21cb75913d1f920198288fe4..9b3dbcd8ea0d8709b1fabe39bc55ed4278eb1585 100644
--- a/source/dnode/vnode/src/tsdb/tsdbFile.c
+++ b/source/dnode/vnode/src/tsdb/tsdbFile.c
@@ -92,31 +92,63 @@ static int32_t tGetSmaFile(uint8_t *p, SSmaFile *pSmaFile) {
}
// EXPOSED APIS ==================================================
+static char* getFileNamePrefix(STsdb *pTsdb, SDiskID did, int32_t fid, uint64_t commitId, char fname[]) {
+ const char* p1 = tfsGetDiskPath(pTsdb->pVnode->pTfs, did);
+ int32_t len = strlen(p1);
+
+ char* p = memcpy(fname, p1, len);
+ p += len;
+
+ *(p++) = TD_DIRSEP[0];
+ len = strlen(pTsdb->path);
+
+ memcpy(p, pTsdb->path, len);
+ p += len;
+
+ *(p++) = TD_DIRSEP[0];
+ *(p++) = 'v';
+
+ p += titoa(TD_VID(pTsdb->pVnode), 10, p);
+ *(p++) = 'f';
+
+ p += titoa(fid, 10, p);
+
+ memcpy(p, "ver", 3);
+ p += 3;
+
+ p += titoa(commitId, 10, p);
+ return p;
+}
+
void tsdbHeadFileName(STsdb *pTsdb, SDiskID did, int32_t fid, SHeadFile *pHeadF, char fname[]) {
- snprintf(fname, TSDB_FILENAME_LEN - 1, "%s%s%s%sv%df%dver%" PRId64 "%s", tfsGetDiskPath(pTsdb->pVnode->pTfs, did),
- TD_DIRSEP, pTsdb->path, TD_DIRSEP, TD_VID(pTsdb->pVnode), fid, pHeadF->commitID, ".head");
+ char* p = getFileNamePrefix(pTsdb, did, fid, pHeadF->commitID, fname);
+ memcpy(p, ".head", 5);
+ p[5] = 0;
}
void tsdbDataFileName(STsdb *pTsdb, SDiskID did, int32_t fid, SDataFile *pDataF, char fname[]) {
- snprintf(fname, TSDB_FILENAME_LEN - 1, "%s%s%s%sv%df%dver%" PRId64 "%s", tfsGetDiskPath(pTsdb->pVnode->pTfs, did),
- TD_DIRSEP, pTsdb->path, TD_DIRSEP, TD_VID(pTsdb->pVnode), fid, pDataF->commitID, ".data");
+ char* p = getFileNamePrefix(pTsdb, did, fid, pDataF->commitID, fname);
+ memcpy(p, ".data", 5);
+ p[5] = 0;
}
void tsdbSttFileName(STsdb *pTsdb, SDiskID did, int32_t fid, SSttFile *pSttF, char fname[]) {
- snprintf(fname, TSDB_FILENAME_LEN - 1, "%s%s%s%sv%df%dver%" PRId64 "%s", tfsGetDiskPath(pTsdb->pVnode->pTfs, did),
- TD_DIRSEP, pTsdb->path, TD_DIRSEP, TD_VID(pTsdb->pVnode), fid, pSttF->commitID, ".stt");
+ char* p = getFileNamePrefix(pTsdb, did, fid, pSttF->commitID, fname);
+ memcpy(p, ".stt", 4);
+ p[4] = 0;
}
void tsdbSmaFileName(STsdb *pTsdb, SDiskID did, int32_t fid, SSmaFile *pSmaF, char fname[]) {
- snprintf(fname, TSDB_FILENAME_LEN - 1, "%s%s%s%sv%df%dver%" PRId64 "%s", tfsGetDiskPath(pTsdb->pVnode->pTfs, did),
- TD_DIRSEP, pTsdb->path, TD_DIRSEP, TD_VID(pTsdb->pVnode), fid, pSmaF->commitID, ".sma");
+ char* p = getFileNamePrefix(pTsdb, did, fid, pSmaF->commitID, fname);
+ memcpy(p, ".sma", 4);
+ p[4] = 0;
}
bool tsdbDelFileIsSame(SDelFile *pDelFile1, SDelFile *pDelFile2) { return pDelFile1->commitID == pDelFile2->commitID; }
int32_t tsdbDFileRollback(STsdb *pTsdb, SDFileSet *pSet, EDataFileT ftype) {
int32_t code = 0;
- int64_t size;
+ int64_t size = 0;
int64_t n;
TdFilePtr pFD;
char fname[TSDB_FILENAME_LEN];
@@ -135,7 +167,7 @@ int32_t tsdbDFileRollback(STsdb *pTsdb, SDFileSet *pSet, EDataFileT ftype) {
tPutSmaFile(hdr, pSet->pSmaF);
break;
default:
- ASSERT(0);
+ goto _err; // make the coverity scan happy
}
taosCalcChecksumAppend(0, hdr, TSDB_FHDR_SIZE);
diff --git a/source/dnode/vnode/src/tsdb/tsdbMergeTree.c b/source/dnode/vnode/src/tsdb/tsdbMergeTree.c
index af1a42d018919b81dac90a8a27124f5eb9a15b65..91152574d222983bbb4156314f4a6adb868281fa 100644
--- a/source/dnode/vnode/src/tsdb/tsdbMergeTree.c
+++ b/source/dnode/vnode/src/tsdb/tsdbMergeTree.c
@@ -31,14 +31,16 @@ struct SLDataIter {
SSttBlockLoadInfo *pBlockLoadInfo;
};
-SSttBlockLoadInfo *tCreateLastBlockLoadInfo(STSchema *pSchema, int16_t *colList, int32_t numOfCols) {
- SSttBlockLoadInfo *pLoadInfo = taosMemoryCalloc(TSDB_MAX_STT_TRIGGER, sizeof(SSttBlockLoadInfo));
+SSttBlockLoadInfo *tCreateLastBlockLoadInfo(STSchema *pSchema, int16_t *colList, int32_t numOfCols, int32_t numOfSttTrigger) {
+ SSttBlockLoadInfo *pLoadInfo = taosMemoryCalloc(numOfSttTrigger, sizeof(SSttBlockLoadInfo));
if (pLoadInfo == NULL) {
terrno = TSDB_CODE_OUT_OF_MEMORY;
return NULL;
}
- for (int32_t i = 0; i < TSDB_MAX_STT_TRIGGER; ++i) {
+ pLoadInfo->numOfStt = numOfSttTrigger;
+
+ for (int32_t i = 0; i < numOfSttTrigger; ++i) {
pLoadInfo[i].blockIndex[0] = -1;
pLoadInfo[i].blockIndex[1] = -1;
pLoadInfo[i].currentLoadBlockIndex = 1;
@@ -63,7 +65,7 @@ SSttBlockLoadInfo *tCreateLastBlockLoadInfo(STSchema *pSchema, int16_t *colList,
}
void resetLastBlockLoadInfo(SSttBlockLoadInfo *pLoadInfo) {
- for (int32_t i = 0; i < TSDB_MAX_STT_TRIGGER; ++i) {
+ for (int32_t i = 0; i < pLoadInfo->numOfStt; ++i) {
pLoadInfo[i].currentLoadBlockIndex = 1;
pLoadInfo[i].blockIndex[0] = -1;
pLoadInfo[i].blockIndex[1] = -1;
@@ -77,14 +79,14 @@ void resetLastBlockLoadInfo(SSttBlockLoadInfo *pLoadInfo) {
}
void getLastBlockLoadInfo(SSttBlockLoadInfo *pLoadInfo, int64_t *blocks, double *el) {
- for (int32_t i = 0; i < TSDB_MAX_STT_TRIGGER; ++i) {
+ for (int32_t i = 0; i < pLoadInfo->numOfStt; ++i) {
*el += pLoadInfo[i].elapsedTime;
*blocks += pLoadInfo[i].loadBlocks;
}
}
void *destroyLastBlockLoadInfo(SSttBlockLoadInfo *pLoadInfo) {
- for (int32_t i = 0; i < TSDB_MAX_STT_TRIGGER; ++i) {
+ for (int32_t i = 0; i < pLoadInfo->numOfStt; ++i) {
pLoadInfo[i].currentLoadBlockIndex = 1;
pLoadInfo[i].blockIndex[0] = -1;
pLoadInfo[i].blockIndex[1] = -1;
@@ -515,7 +517,7 @@ bool tLDataIterNextRow(SLDataIter *pIter, const char *idStr) {
pIter->rInfo.row = tsdbRowFromBlockData(pBlockData, pIter->iRow);
_exit:
- return (terrno == TSDB_CODE_SUCCESS) && (pIter->pSttBlk != NULL);
+ return (terrno == TSDB_CODE_SUCCESS) && (pIter->pSttBlk != NULL) && (pBlockData != NULL);
}
SRowInfo *tLDataIterGet(SLDataIter *pIter) { return &pIter->rInfo; }
diff --git a/source/dnode/vnode/src/tsdb/tsdbRead.c b/source/dnode/vnode/src/tsdb/tsdbRead.c
index db52d7604ff89194f4d085805cac4c4bd82ef2ee..78793e6a957622761969b0fcffeba280c86b8644 100644
--- a/source/dnode/vnode/src/tsdb/tsdbRead.c
+++ b/source/dnode/vnode/src/tsdb/tsdbRead.c
@@ -79,16 +79,19 @@ typedef struct SIOCostSummary {
int64_t composedBlocks;
double buildComposedBlockTime;
double createScanInfoList;
+// double getTbFromMemTime;
+// double getTbFromIMemTime;
+ double initDelSkylineIterTime;
} SIOCostSummary;
typedef struct SBlockLoadSuppInfo {
- SArray* pColAgg;
- SColumnDataAgg tsColAgg;
- int16_t* colId;
- int16_t* slotId;
- int32_t numOfCols;
- char** buildBuf; // build string tmp buffer, todo remove it later after all string format being updated.
- bool smaValid; // the sma on all queried columns are activated
+ SArray* pColAgg;
+ SColumnDataAgg tsColAgg;
+ int16_t* colId;
+ int16_t* slotId;
+ int32_t numOfCols;
+ char** buildBuf; // build string tmp buffer, todo remove it later after all string format being updated.
+ bool smaValid; // the sma on all queried columns are activated
} SBlockLoadSuppInfo;
typedef struct SLastBlockReader {
@@ -130,17 +133,17 @@ typedef struct SFileBlockDumpInfo {
bool allDumped;
} SFileBlockDumpInfo;
-typedef struct SUidOrderCheckInfo {
+typedef struct STableUidList {
uint64_t* tableUidList; // access table uid list in uid ascending order list
int32_t currentIndex; // index in table uid list
-} SUidOrderCheckInfo;
+} STableUidList;
typedef struct SReaderStatus {
bool loadFromFile; // check file stage
bool composedDataBlock; // the returned data block is a composed block or not
SHashObj* pTableMap; // SHash
STableBlockScanInfo** pTableIter; // table iterator used in building in-memory buffer data blocks.
- SUidOrderCheckInfo uidCheckInfo; // check all table in uid order
+ STableUidList uidList; // check tables in uid order, to avoid the repeatly load of blocks in STT.
SFileBlockDumpInfo fBlockDumpInfo;
SDFileSet* pCurrentFileset; // current opened file set
SBlockData fileBlockData;
@@ -168,11 +171,11 @@ struct STsdbReader {
SBlockLoadSuppInfo suppInfo;
STsdbReadSnap* pReadSnap;
SIOCostSummary cost;
- STSchema* pSchema; // the newest version schema
- STSchema* pMemSchema; // the previous schema for in-memory data, to avoid load schema too many times
- SDataFReader* pFileReader; // the file reader
- SDelFReader* pDelFReader; // the del file reader
- SArray* pDelIdx; // del file block index;
+ STSchema* pSchema; // the newest version schema
+ STSchema* pMemSchema; // the previous schema for in-memory data, to avoid load schema too many times
+ SDataFReader* pFileReader; // the file reader
+ SDelFReader* pDelFReader; // the del file reader
+ SArray* pDelIdx; // del file block index;
SVersionRange verRange;
SBlockInfoBuf blockInfoBuf;
int32_t step;
@@ -217,19 +220,24 @@ static bool hasDataInFileBlock(const SBlockData* pBlockData, const SFil
static void initBlockDumpInfo(STsdbReader* pReader, SDataBlockIter* pBlockIter);
static int32_t getInitialDelIndex(const SArray* pDelSkyline, int32_t order);
+static STableBlockScanInfo* getTableBlockScanInfo(SHashObj* pTableMap, uint64_t uid, const char* id);
+
+static FORCE_INLINE STSchema* getLatestTableSchema(STsdbReader* pReader, uint64_t uid);
+
static bool outOfTimeWindow(int64_t ts, STimeWindow* pWindow) { return (ts > pWindow->ekey) || (ts < pWindow->skey); }
-static int32_t setColumnIdSlotList(SBlockLoadSuppInfo* pSupInfo, SColumnInfo* pCols, const int32_t* pSlotIdList, int32_t numOfCols) {
+static int32_t setColumnIdSlotList(SBlockLoadSuppInfo* pSupInfo, SColumnInfo* pCols, const int32_t* pSlotIdList,
+ int32_t numOfCols) {
pSupInfo->smaValid = true;
pSupInfo->numOfCols = numOfCols;
- pSupInfo->colId = taosMemoryMalloc(numOfCols * (sizeof(int16_t)*2 + POINTER_BYTES));
+ pSupInfo->colId = taosMemoryMalloc(numOfCols * (sizeof(int16_t) * 2 + POINTER_BYTES));
if (pSupInfo->colId == NULL) {
taosMemoryFree(pSupInfo->colId);
return TSDB_CODE_OUT_OF_MEMORY;
}
pSupInfo->slotId = (int16_t*)((char*)pSupInfo->colId + (sizeof(int16_t) * numOfCols));
- pSupInfo->buildBuf = (char**) ((char*)pSupInfo->slotId + (sizeof(int16_t) * numOfCols));
+ pSupInfo->buildBuf = (char**)((char*)pSupInfo->slotId + (sizeof(int16_t) * numOfCols));
for (int32_t i = 0; i < numOfCols; ++i) {
pSupInfo->colId[i] = pCols[i].colId;
pSupInfo->slotId[i] = pSlotIdList[i];
@@ -247,7 +255,7 @@ static int32_t setColumnIdSlotList(SBlockLoadSuppInfo* pSupInfo, SColumnInfo* pC
static int32_t updateBlockSMAInfo(STSchema* pSchema, SBlockLoadSuppInfo* pSupInfo) {
int32_t i = 0, j = 0;
- while(i < pSchema->numOfCols && j < pSupInfo->numOfCols) {
+ while (i < pSchema->numOfCols && j < pSupInfo->numOfCols) {
STColumn* pTCol = &pSchema->columns[i];
if (pTCol->colId == pSupInfo->colId[j]) {
if (!IS_BSMA_ON(pTCol)) {
@@ -311,8 +319,19 @@ static void* getPosInBlockInfoBuf(SBlockInfoBuf* pBuf, int32_t index) {
return (*pBucket) + (index % pBuf->numPerBucket) * sizeof(STableBlockScanInfo);
}
+static int32_t uidComparFunc(const void* p1, const void* p2) {
+ uint64_t pu1 = *(uint64_t*)p1;
+ uint64_t pu2 = *(uint64_t*)p2;
+ if (pu1 == pu2) {
+ return 0;
+ } else {
+ return (pu1 < pu2) ? -1 : 1;
+ }
+}
+
// NOTE: speedup the whole processing by preparing the buffer for STableBlockScanInfo in batch model
-static SHashObj* createDataBlockScanInfo(STsdbReader* pTsdbReader, SBlockInfoBuf* pBuf, const STableKeyInfo* idList, int32_t numOfTables) {
+static SHashObj* createDataBlockScanInfo(STsdbReader* pTsdbReader, SBlockInfoBuf* pBuf, const STableKeyInfo* idList,
+ STableUidList *pUidList, int32_t numOfTables) {
// allocate buffer in order to load data blocks from file
// todo use simple hash instead, optimize the memory consumption
SHashObj* pTableMap =
@@ -324,9 +343,18 @@ static SHashObj* createDataBlockScanInfo(STsdbReader* pTsdbReader, SBlockInfoBuf
int64_t st = taosGetTimestampUs();
initBlockScanInfoBuf(pBuf, numOfTables);
+ pUidList->tableUidList = taosMemoryMalloc(numOfTables * sizeof(uint64_t));
+ if (pUidList->tableUidList == NULL) {
+ return NULL;
+ }
+ pUidList->currentIndex = 0;
+
for (int32_t j = 0; j < numOfTables; ++j) {
STableBlockScanInfo* pScanInfo = getPosInBlockInfoBuf(pBuf, j);
+
pScanInfo->uid = idList[j].uid;
+ pUidList->tableUidList[j] = idList[j].uid;
+
if (ASCENDING_TRAVERSE(pTsdbReader->order)) {
int64_t skey = pTsdbReader->window.skey;
pScanInfo->lastKey = (skey > INT64_MIN) ? (skey - 1) : skey;
@@ -340,6 +368,8 @@ static SHashObj* createDataBlockScanInfo(STsdbReader* pTsdbReader, SBlockInfoBuf
pScanInfo->lastKey, pTsdbReader->idStr);
}
+ taosSort(pUidList->tableUidList, numOfTables, sizeof(uint64_t), uidComparFunc);
+
pTsdbReader->cost.createScanInfoList = (taosGetTimestampUs() - st) / 1000.0;
tsdbDebug("%p create %d tables scan-info, size:%.2f Kb, elapsed time:%.2f ms, %s", pTsdbReader, numOfTables,
(sizeof(STableBlockScanInfo) * numOfTables) / 1024.0, pTsdbReader->cost.createScanInfoList,
@@ -398,9 +428,7 @@ static void destroyAllBlockScanInfo(SHashObj* pTableMap) {
taosHashCleanup(pTableMap);
}
-static bool isEmptyQueryTimeWindow(STimeWindow* pWindow) {
- return pWindow->skey > pWindow->ekey;
-}
+static bool isEmptyQueryTimeWindow(STimeWindow* pWindow) { return pWindow->skey > pWindow->ekey; }
// Update the query time window according to the data time to live(TTL) information, in order to avoid to return
// the expired data to client, even it is queried already.
@@ -418,19 +446,6 @@ static STimeWindow updateQueryTimeWindow(STsdb* pTsdb, STimeWindow* pWindow) {
return win;
}
-static void limitOutputBufferSize(const SQueryTableDataCond* pCond, int32_t* capacity) {
- int32_t rowLen = 0;
- for (int32_t i = 0; i < pCond->numOfCols; ++i) {
- rowLen += pCond->colList[i].bytes;
- }
-
- // make sure the output SSDataBlock size be less than 2MB.
- const int32_t TWOMB = 2 * 1024 * 1024;
- if ((*capacity) * rowLen > TWOMB) {
- (*capacity) = TWOMB / rowLen;
- }
-}
-
// init file iterator
static int32_t initFilesetIterator(SFilesetIter* pIter, SArray* aDFileSet, STsdbReader* pReader) {
size_t numOfFileset = taosArrayGetSize(aDFileSet);
@@ -459,8 +474,11 @@ static int32_t initFilesetIterator(SFilesetIter* pIter, SArray* aDFileSet, STsdb
if (pLReader->pInfo == NULL) {
// here we ignore the first column, which is always be the primary timestamp column
+ SBlockLoadSuppInfo* pInfo = &pReader->suppInfo;
+
+ int32_t numOfStt = pReader->pTsdb->pVnode->config.sttTrigger;
pLReader->pInfo =
- tCreateLastBlockLoadInfo(pReader->pSchema, &pReader->suppInfo.colId[1], pReader->suppInfo.numOfCols - 1);
+ tCreateLastBlockLoadInfo(pReader->pSchema, &pInfo->colId[1], pInfo->numOfCols - 1, numOfStt);
if (pLReader->pInfo == NULL) {
tsdbDebug("init fileset iterator failed, code:%s %s", tstrerror(terrno), pReader->idStr);
return terrno;
@@ -613,9 +631,6 @@ static int32_t tsdbReaderCreate(SVnode* pVnode, SQueryTableDataCond* pCond, STsd
goto _end;
}
- // todo refactor.
- limitOutputBufferSize(pCond, &pReader->capacity);
-
// allocate buffer in order to load data blocks from file
SBlockLoadSuppInfo* pSup = &pReader->suppInfo;
pSup->pColAgg = taosArrayInit(pCond->numOfCols, sizeof(SColumnDataAgg));
@@ -632,7 +647,7 @@ static int32_t tsdbReaderCreate(SVnode* pVnode, SQueryTableDataCond* pCond, STsd
goto _end;
}
- setColumnIdSlotList(&pReader->suppInfo, pCond->colList, pCond->pSlotList, pCond->numOfCols);
+ setColumnIdSlotList(pSup, pCond->colList, pCond->pSlotList, pCond->numOfCols);
*ppReader = pReader;
return code;
@@ -644,53 +659,73 @@ _end:
}
static int32_t doLoadBlockIndex(STsdbReader* pReader, SDataFReader* pFileReader, SArray* pIndexList) {
- SArray* aBlockIdx = taosArrayInit(8, sizeof(SBlockIdx));
-
int64_t st = taosGetTimestampUs();
- int32_t code = tsdbReadBlockIdx(pFileReader, aBlockIdx);
- if (code != TSDB_CODE_SUCCESS) {
+ LRUHandle* handle = NULL;
+ int32_t code = tsdbCacheGetBlockIdx(pFileReader->pTsdb->biCache, pFileReader, &handle);
+ if (code != TSDB_CODE_SUCCESS || handle == NULL) {
goto _end;
}
- size_t num = taosArrayGetSize(aBlockIdx);
+ int32_t numOfTables = taosHashGetSize(pReader->status.pTableMap);
+
+ SArray* aBlockIdx = (SArray*)taosLRUCacheValue(pFileReader->pTsdb->biCache, handle);
+ size_t num = taosArrayGetSize(aBlockIdx);
if (num == 0) {
- taosArrayDestroy(aBlockIdx);
+ tsdbBICacheRelease(pFileReader->pTsdb->biCache, handle);
return TSDB_CODE_SUCCESS;
}
+ // todo binary search to the start position
int64_t et1 = taosGetTimestampUs();
SBlockIdx* pBlockIdx = NULL;
- for (int32_t i = 0; i < num; ++i) {
- pBlockIdx = (SBlockIdx*)taosArrayGet(aBlockIdx, i);
+ STableUidList* pList = &pReader->status.uidList;
- // uid check
+ int32_t i = 0, j = 0;
+ while(i < num && j < numOfTables) {
+ pBlockIdx = (SBlockIdx*)taosArrayGet(aBlockIdx, i);
if (pBlockIdx->suid != pReader->suid) {
+ i += 1;
continue;
}
- // this block belongs to a table that is not queried.
- void* p = taosHashGet(pReader->status.pTableMap, &pBlockIdx->uid, sizeof(uint64_t));
- if (p == NULL) {
+ if (pBlockIdx->uid < pList->tableUidList[j]) {
+ i += 1;
continue;
}
- STableBlockScanInfo* pScanInfo = *(STableBlockScanInfo**)p;
- if (pScanInfo->pBlockList == NULL) {
- pScanInfo->pBlockList = taosArrayInit(4, sizeof(SBlockIndex));
+ if (pBlockIdx->uid > pList->tableUidList[j]) {
+ j += 1;
+ continue;
}
- taosArrayPush(pIndexList, pBlockIdx);
+ if (pBlockIdx->uid == pList->tableUidList[j]) {
+ // this block belongs to a table that is not queried.
+ STableBlockScanInfo* pScanInfo = getTableBlockScanInfo(pReader->status.pTableMap, pBlockIdx->uid, pReader->idStr);
+ if (pScanInfo == NULL) {
+ return terrno;
+ }
+
+ if (pScanInfo->pBlockList == NULL) {
+ pScanInfo->pBlockList = taosArrayInit(4, sizeof(SBlockIndex));
+ }
+
+ taosArrayPush(pIndexList, pBlockIdx);
+
+ i += 1;
+ j += 1;
+ }
}
int64_t et2 = taosGetTimestampUs();
- tsdbDebug("load block index for %d tables completed, elapsed time:%.2f ms, set blockIdx:%.2f ms, size:%.2f Kb %s",
- (int32_t)num, (et1 - st) / 1000.0, (et2 - et1) / 1000.0, num * sizeof(SBlockIdx) / 1024.0, pReader->idStr);
+ tsdbDebug("load block index for %d/%d tables completed, elapsed time:%.2f ms, set blockIdx:%.2f ms, size:%.2f Kb %s",
+ numOfTables, (int32_t)num, (et1 - st) / 1000.0, (et2 - et1) / 1000.0, num * sizeof(SBlockIdx) / 1024.0,
+ pReader->idStr);
pReader->cost.headFileLoadTime += (et1 - st) / 1000.0;
_end:
- taosArrayDestroy(aBlockIdx);
+ tsdbBICacheRelease(pFileReader->pTsdb->biCache, handle);
return code;
}
@@ -718,9 +753,10 @@ static int32_t doLoadFileBlock(STsdbReader* pReader, SArray* pIndexList, SBlockN
for (int32_t i = 0; i < numOfTables; ++i) {
SBlockIdx* pBlockIdx = taosArrayGet(pIndexList, i);
-
- STableBlockScanInfo* pScanInfo =
- *(STableBlockScanInfo**)taosHashGet(pReader->status.pTableMap, &pBlockIdx->uid, sizeof(int64_t));
+ STableBlockScanInfo* pScanInfo = getTableBlockScanInfo(pReader->status.pTableMap, pBlockIdx->uid, pReader->idStr);
+ if (pScanInfo == NULL) {
+ return terrno;
+ }
tMapDataReset(&pScanInfo->mapData);
tsdbReadDataBlk(pReader->pFileReader, pBlockIdx, &pScanInfo->mapData);
@@ -769,7 +805,6 @@ static int32_t doLoadFileBlock(STsdbReader* pReader, SArray* pIndexList, SBlockN
numOfTables, pBlockNum->numOfBlocks, numOfQTable, pBlockNum->numOfLastFiles, sizeInDisk / 1000.0, el,
pReader->idStr);
-
pReader->cost.numOfBlocks += total;
pReader->cost.headFileLoadTime += el;
@@ -820,9 +855,7 @@ static int doBinarySearchKey(TSKEY* keyList, int num, int pos, TSKEY key, int or
s = pos;
// check
- assert(pos >= 0 && pos < num);
- assert(num > 0);
-
+ ASSERT(pos >= 0 && pos < num && num > 0);
if (order == TSDB_ORDER_ASC) {
// find the first position which is smaller than the key
e = num - 1;
@@ -903,7 +936,7 @@ static void copyPrimaryTsCol(const SBlockData* pBlockData, SFileBlockDumpInfo* p
// a faster version of copy procedure.
static void copyNumericCols(const SColData* pData, SFileBlockDumpInfo* pDumpInfo, SColumnInfoData* pColData,
- int32_t dumpedRows, bool asc) {
+ int32_t dumpedRows, bool asc) {
uint8_t* p = NULL;
if (asc) {
p = pData->pData + tDataTypes[pData->type].bytes * pDumpInfo->rowIndex;
@@ -912,22 +945,21 @@ static void copyNumericCols(const SColData* pData, SFileBlockDumpInfo* pDumpInfo
p = pData->pData + tDataTypes[pData->type].bytes * startIndex;
}
- int32_t step = asc? 1:-1;
+ int32_t step = asc ? 1 : -1;
// make sure it is aligned to 8bit, the allocated memory address is aligned to 256bit
-// ASSERT((((uint64_t)pColData->pData) & (0x8 - 1)) == 0);
+ // ASSERT((((uint64_t)pColData->pData) & (0x8 - 1)) == 0);
// 1. copy data in a batch model
memcpy(pColData->pData, p, dumpedRows * tDataTypes[pData->type].bytes);
// 2. reverse the array list in case of descending order scan data block
if (!asc) {
- switch(pColData->info.type) {
+ switch (pColData->info.type) {
case TSDB_DATA_TYPE_TIMESTAMP:
case TSDB_DATA_TYPE_DOUBLE:
case TSDB_DATA_TYPE_BIGINT:
- case TSDB_DATA_TYPE_UBIGINT:
- {
+ case TSDB_DATA_TYPE_UBIGINT: {
int32_t mid = dumpedRows >> 1u;
int64_t* pts = (int64_t*)pColData->pData;
for (int32_t j = 0; j < mid; ++j) {
@@ -941,7 +973,7 @@ static void copyNumericCols(const SColData* pData, SFileBlockDumpInfo* pDumpInfo
case TSDB_DATA_TYPE_BOOL:
case TSDB_DATA_TYPE_TINYINT:
case TSDB_DATA_TYPE_UTINYINT: {
- int32_t mid = dumpedRows >> 1u;
+ int32_t mid = dumpedRows >> 1u;
int8_t* pts = (int8_t*)pColData->pData;
for (int32_t j = 0; j < mid; ++j) {
int8_t t = pts[j];
@@ -992,7 +1024,7 @@ static void copyNumericCols(const SColData* pData, SFileBlockDumpInfo* pDumpInfo
}
}
-static int32_t copyBlockDataToSDataBlock(STsdbReader* pReader, STableBlockScanInfo* pBlockScanInfo) {
+static int32_t copyBlockDataToSDataBlock(STsdbReader* pReader) {
SReaderStatus* pStatus = &pReader->status;
SDataBlockIter* pBlockIter = &pStatus->blockIter;
SBlockLoadSuppInfo* pSupInfo = &pReader->suppInfo;
@@ -1009,6 +1041,14 @@ static int32_t copyBlockDataToSDataBlock(STsdbReader* pReader, STableBlockScanIn
bool asc = ASCENDING_TRAVERSE(pReader->order);
int32_t step = asc ? 1 : -1;
+ // no data exists, return directly.
+ if (pBlockData->nRow == 0 || pBlockData->aTSKEY == 0) {
+ tsdbWarn("%p no need to copy since no data in blockData, table uid:%" PRIu64 " has been dropped, %s", pReader, pBlockInfo->uid,
+ pReader->idStr);
+ pResBlock->info.rows = 0;
+ return 0;
+ }
+
if ((pDumpInfo->rowIndex == 0 && asc) || (pDumpInfo->rowIndex == pBlock->nRow - 1 && (!asc))) {
if (asc && pReader->window.skey <= pBlock->minKey.ts) {
// pDumpInfo->rowIndex = 0;
@@ -1113,7 +1153,7 @@ static int32_t copyBlockDataToSDataBlock(STsdbReader* pReader, STableBlockScanIn
int32_t unDumpedRows = asc ? pBlock->nRow - pDumpInfo->rowIndex : pDumpInfo->rowIndex + 1;
tsdbDebug("%p copy file block to sdatablock, global index:%d, table index:%d, brange:%" PRId64 "-%" PRId64
- ", rows:%d, remain:%d, minVer:%" PRId64 ", maxVer:%" PRId64 ", uid:%"PRIu64" elapsed time:%.2f ms, %s",
+ ", rows:%d, remain:%d, minVer:%" PRId64 ", maxVer:%" PRId64 ", uid:%" PRIu64 " elapsed time:%.2f ms, %s",
pReader, pBlockIter->index, pBlockInfo->tbBlockIdx, pBlock->minKey.ts, pBlock->maxKey.ts, dumpedRows,
unDumpedRows, pBlock->minVer, pBlock->maxVer, pBlockInfo->uid, elapsedTime, pReader->idStr);
@@ -1122,12 +1162,19 @@ static int32_t copyBlockDataToSDataBlock(STsdbReader* pReader, STableBlockScanIn
static int32_t doLoadFileBlockData(STsdbReader* pReader, SDataBlockIter* pBlockIter, SBlockData* pBlockData,
uint64_t uid) {
+ int32_t code = 0;
int64_t st = taosGetTimestampUs();
tBlockDataReset(pBlockData);
+ STSchema* pSchema = getLatestTableSchema(pReader, uid);
+ if (pSchema == NULL) {
+ tsdbDebug("%p table uid:%"PRIu64" has been dropped, no data existed, %s", pReader, uid, pReader->idStr);
+ return code;
+ }
+
+ SBlockLoadSuppInfo* pSup = &pReader->suppInfo;
TABLEID tid = {.suid = pReader->suid, .uid = uid};
- int32_t code =
- tBlockDataInit(pBlockData, &tid, pReader->pSchema, &pReader->suppInfo.colId[1], pReader->suppInfo.numOfCols - 1);
+ code = tBlockDataInit(pBlockData, &tid, pSchema, &pSup->colId[1], pSup->numOfCols - 1);
if (code != TSDB_CODE_SUCCESS) {
return code;
}
@@ -1209,14 +1256,13 @@ static int32_t fileDataBlockOrderCompar(const void* pLeft, const void* pRight, v
static int32_t doSetCurrentBlock(SDataBlockIter* pBlockIter, const char* idStr) {
SFileDataBlockInfo* pBlockInfo = getCurrentBlockInfo(pBlockIter);
if (pBlockInfo != NULL) {
- STableBlockScanInfo** pScanInfo = taosHashGet(pBlockIter->pTableMap, &pBlockInfo->uid, sizeof(pBlockInfo->uid));
+ STableBlockScanInfo* pScanInfo = getTableBlockScanInfo(pBlockIter->pTableMap, pBlockInfo->uid, idStr);
if (pScanInfo == NULL) {
- tsdbError("failed to locate the uid:%" PRIu64 " in query table uid list, %s", pBlockInfo->uid, idStr);
- return TSDB_CODE_INVALID_PARA;
+ return terrno;
}
- SBlockIndex* pIndex = taosArrayGet((*pScanInfo)->pBlockList, pBlockInfo->tbBlockIdx);
- tMapDataGetItemByIdx(&(*pScanInfo)->mapData, pIndex->ordinalIndex, &pBlockIter->block, tGetDataBlk);
+ SBlockIndex* pIndex = taosArrayGet(pScanInfo->pBlockList, pBlockInfo->tbBlockIdx);
+ tMapDataGetItemByIdx(&pScanInfo->mapData, pIndex->ordinalIndex, &pBlockIter->block, tGetDataBlk);
}
#if 0
@@ -1552,8 +1598,7 @@ static bool fileBlockShouldLoad(STsdbReader* pReader, SFileDataBlockInfo* pBlock
// log the reason why load the datablock for profile
if (loadDataBlock) {
- tsdbDebug("%p uid:%" PRIu64
- " need to load the datablock, overlapwithneighborblock:%d, hasDup:%d, partiallyRequired:%d, "
+ tsdbDebug("%p uid:%" PRIu64 " need to load the datablock, overlapneighbor:%d, hasDup:%d, partiallyRequired:%d, "
"overlapWithKey:%d, greaterThanBuf:%d, overlapWithDel:%d, overlapWithlastBlock:%d, %s",
pReader, pBlockInfo->uid, info.overlapWithNeighborBlock, info.hasDupTs, info.partiallyRequired,
info.overlapWithKeyInBuf, info.moreThanCapcity, info.overlapWithDelInfo, info.overlapWithLastBlock,
@@ -1589,9 +1634,9 @@ static int32_t buildDataBlockFromBuf(STsdbReader* pReader, STableBlockScanInfo*
double elapsedTime = (taosGetTimestampUs() - st) / 1000.0;
tsdbDebug("%p build data block from cache completed, elapsed time:%.2f ms, numOfRows:%d, brange:%" PRId64
- " - %" PRId64 " %s",
+ " - %" PRId64 ", uid:%"PRIu64", %s",
pReader, elapsedTime, pBlock->info.rows, pBlock->info.window.skey, pBlock->info.window.ekey,
- pReader->idStr);
+ pBlockScanInfo->uid, pReader->idStr);
pReader->cost.buildmemBlock += elapsedTime;
return code;
@@ -1617,8 +1662,10 @@ static bool tryCopyDistinctRowFromFileBlock(STsdbReader* pReader, SBlockData* pB
return false;
}
-static bool nextRowFromLastBlocks(SLastBlockReader* pLastBlockReader, STableBlockScanInfo* pBlockScanInfo,
+static bool nextRowFromLastBlocks(SLastBlockReader* pLastBlockReader, STableBlockScanInfo* pScanInfo,
SVersionRange* pVerRange) {
+ int32_t step = ASCENDING_TRAVERSE(pLastBlockReader->order)? 1:-1;
+
while (1) {
bool hasVal = tMergeTreeNext(&pLastBlockReader->mergeTree);
if (!hasVal) {
@@ -1627,8 +1674,15 @@ static bool nextRowFromLastBlocks(SLastBlockReader* pLastBlockReader, STableBloc
TSDBROW row = tMergeTreeGetRow(&pLastBlockReader->mergeTree);
TSDBKEY k = TSDBROW_KEY(&row);
- if (!hasBeenDropped(pBlockScanInfo->delSkyline, &pBlockScanInfo->lastBlockDelIndex, &k, pLastBlockReader->order,
- pVerRange)) {
+ if (hasBeenDropped(pScanInfo->delSkyline, &pScanInfo->lastBlockDelIndex, &k, pLastBlockReader->order, pVerRange)) {
+ pScanInfo->lastKey = k.ts;
+ } else {
+ // the qualifed ts may equal to k.ts, only a greater version one.
+ // here we need to fallback one step.
+ if (pScanInfo->lastKey == k.ts) {
+ pScanInfo->lastKey -= step;
+ }
+
return true;
}
}
@@ -1651,6 +1705,19 @@ static bool tryCopyDistinctRowFromSttBlock(TSDBROW* fRow, SLastBlockReader* pLas
return false;
}
+static FORCE_INLINE STSchema* getLatestTableSchema(STsdbReader* pReader, uint64_t uid) {
+ if (pReader->pSchema != NULL) {
+ return pReader->pSchema;
+ }
+
+ pReader->pSchema = metaGetTbTSchema(pReader->pTsdb->pVnode->pMeta, uid, -1, 1);
+ if (pReader->pSchema == NULL) {
+ tsdbError("failed to get table schema, uid:%" PRIu64 ", it may have been dropped, ver:-1, %s", uid, pReader->idStr);
+ }
+
+ return pReader->pSchema;
+}
+
static FORCE_INLINE STSchema* doGetSchemaForTSRow(int32_t sversion, STsdbReader* pReader, uint64_t uid) {
// always set the newest schema version in pReader->pSchema
if (pReader->pSchema == NULL) {
@@ -1767,7 +1834,7 @@ static int32_t doMergeBufAndFileRows(STsdbReader* pReader, STableBlockScanInfo*
tRowMergerAdd(&merge, pRow, pSchema);
} else {
init = true;
- int32_t code = tRowMergerInit(&merge, pRow, pSchema);
+ int32_t code = tRowMergerInit(&merge, pRow, pSchema);
if (code != TSDB_CODE_SUCCESS) {
return code;
}
@@ -2178,6 +2245,7 @@ static int32_t initMemDataIterator(STableBlockScanInfo* pBlockScanInfo, STsdbRea
}
int32_t backward = (!ASCENDING_TRAVERSE(pReader->order));
+ int64_t st = 0;
STbData* d = NULL;
if (pReader->pReadSnap->pMem != NULL) {
@@ -2221,7 +2289,9 @@ static int32_t initMemDataIterator(STableBlockScanInfo* pBlockScanInfo, STsdbRea
tsdbDebug("%p uid:%" PRIu64 ", no data in imem, %s", pReader, pBlockScanInfo->uid, pReader->idStr);
}
+ st = taosGetTimestampUs();
initDelSkylineIterator(pBlockScanInfo, pReader, d, di);
+ pReader->cost.initDelSkylineIterTime += (taosGetTimestampUs() - st) / 1000.0;
pBlockScanInfo->iterInit = true;
return TSDB_CODE_SUCCESS;
@@ -2278,6 +2348,7 @@ static bool initLastBlockReader(SLastBlockReader* pLBlockReader, STableBlockScan
w.ekey = pScanInfo->lastKey + step;
}
+ tsdbDebug("init last block reader, window:%"PRId64"-%"PRId64", uid:%"PRIu64", %s", w.skey, w.ekey, pScanInfo->uid, pReader->idStr);
int32_t code = tMergeTreeOpen(&pLBlockReader->mergeTree, (pLBlockReader->order == TSDB_ORDER_DESC),
pReader->pFileReader, pReader->suid, pScanInfo->uid, &w, &pLBlockReader->verRange,
pLBlockReader->pInfo, false, pReader->idStr);
@@ -2297,7 +2368,7 @@ static bool hasDataInLastBlock(SLastBlockReader* pLastBlockReader) { return pLas
bool hasDataInFileBlock(const SBlockData* pBlockData, const SFileBlockDumpInfo* pDumpInfo) {
if ((pBlockData->nRow > 0) && (pBlockData->nRow != pDumpInfo->totalRows)) {
- return false; // this is an invalid result.
+ return false; // this is an invalid result.
}
return pBlockData->nRow > 0 && (!pDumpInfo->allDumped);
}
@@ -2434,24 +2505,19 @@ static int32_t buildComposedDataBlock(STsdbReader* pReader) {
STableBlockScanInfo* pBlockScanInfo = NULL;
if (pBlockInfo != NULL) {
- void* p = taosHashGet(pReader->status.pTableMap, &pBlockInfo->uid, sizeof(pBlockInfo->uid));
- if (p == NULL) {
- code = TSDB_CODE_INVALID_PARA;
- tsdbError("failed to locate the uid:%" PRIu64 " in query table uid list, total tables:%d, %s", pBlockInfo->uid,
- taosHashGetSize(pReader->status.pTableMap), pReader->idStr);
+ pBlockScanInfo = getTableBlockScanInfo(pReader->status.pTableMap, pBlockInfo->uid, pReader->idStr);
+ if (pBlockScanInfo == NULL) {
goto _end;
}
- pBlockScanInfo = *(STableBlockScanInfo**)p;
-
SDataBlk* pBlock = getCurrentBlock(&pReader->status.blockIter);
TSDBKEY keyInBuf = getCurrentKeyInBuf(pBlockScanInfo, pReader);
// it is a clean block, load it directly
- if (isCleanFileDataBlock(pReader, pBlockInfo, pBlock, pBlockScanInfo, keyInBuf, pLastBlockReader) &&
+ if (isCleanFileDataBlock(pReader, pBlockInfo, pBlock, pBlockScanInfo, keyInBuf, pLastBlockReader) &&
pBlock->nRow <= pReader->capacity) {
if (asc || ((!asc) && (!hasDataInLastBlock(pLastBlockReader)))) {
- copyBlockDataToSDataBlock(pReader, pBlockScanInfo);
+ copyBlockDataToSDataBlock(pReader);
// record the last key value
pBlockScanInfo->lastKey = asc ? pBlock->maxKey.ts : pBlock->minKey.ts;
@@ -2595,21 +2661,39 @@ _err:
}
TSDBKEY getCurrentKeyInBuf(STableBlockScanInfo* pScanInfo, STsdbReader* pReader) {
- TSDBKEY key = {.ts = TSKEY_INITIAL_VAL};
+ bool asc = ASCENDING_TRAVERSE(pReader->order);
+// TSKEY initialVal = asc? TSKEY_MIN:TSKEY_MAX;
+
+ TSDBKEY key = {.ts = TSKEY_INITIAL_VAL}, ikey = {.ts = TSKEY_INITIAL_VAL};
+
+ bool hasKey = false, hasIKey = false;
TSDBROW* pRow = getValidMemRow(&pScanInfo->iter, pScanInfo->delSkyline, pReader);
if (pRow != NULL) {
+ hasKey = true;
key = TSDBROW_KEY(pRow);
}
- pRow = getValidMemRow(&pScanInfo->iiter, pScanInfo->delSkyline, pReader);
- if (pRow != NULL) {
- TSDBKEY k = TSDBROW_KEY(pRow);
- if (key.ts > k.ts) {
- key = k;
- }
+ TSDBROW* pIRow = getValidMemRow(&pScanInfo->iiter, pScanInfo->delSkyline, pReader);
+ if (pIRow != NULL) {
+ hasIKey = true;
+ ikey = TSDBROW_KEY(pIRow);
}
- return key;
+ if (hasKey) {
+ if (hasIKey) { // has data in mem & imem
+ if (asc) {
+ return key.ts <= ikey.ts ? key : ikey;
+ } else {
+ return key.ts <= ikey.ts ? ikey: key;
+ }
+ } else { // no data in imem
+ return key;
+ }
+ } else {
+ // no data in mem & imem, return the initial value
+ // only imem has data, return ikey
+ return ikey;
+ }
}
static int32_t moveToNextFile(STsdbReader* pReader, SBlockNumber* pBlockNum) {
@@ -2651,7 +2735,6 @@ static int32_t moveToNextFile(STsdbReader* pReader, SBlockNumber* pBlockNum) {
taosArrayDestroy(pIndexList);
if (pReader->pReadSnap != NULL) {
-
SDelFile* pDelFile = pReader->pReadSnap->fs.pDelFile;
if (pReader->pDelFReader == NULL && pDelFile != NULL) {
int32_t code = tsdbDelFReaderOpen(&pReader->pDelFReader, pDelFile, pReader->pTsdb);
@@ -2676,86 +2759,15 @@ static int32_t moveToNextFile(STsdbReader* pReader, SBlockNumber* pBlockNum) {
return TSDB_CODE_SUCCESS;
}
-static int32_t uidComparFunc(const void* p1, const void* p2) {
- uint64_t pu1 = *(uint64_t*)p1;
- uint64_t pu2 = *(uint64_t*)p2;
- if (pu1 == pu2) {
- return 0;
- } else {
- return (pu1 < pu2) ? -1 : 1;
- }
-}
-
-static void extractOrderedTableUidList(SUidOrderCheckInfo* pOrderCheckInfo, SReaderStatus* pStatus, int32_t order) {
- int32_t index = 0;
- int32_t total = taosHashGetSize(pStatus->pTableMap);
+static void resetTableListIndex(SReaderStatus *pStatus) {
+ STableUidList* pList = &pStatus->uidList;
- void* p = taosHashIterate(pStatus->pTableMap, NULL);
- while (p != NULL) {
- STableBlockScanInfo* pScanInfo = *(STableBlockScanInfo**)p;
- pOrderCheckInfo->tableUidList[index++] = pScanInfo->uid;
- p = taosHashIterate(pStatus->pTableMap, p);
- }
-
- taosSort(pOrderCheckInfo->tableUidList, total, sizeof(uint64_t), uidComparFunc);
-}
-
-// reset the last del file index
-static void resetScanBlockLastBlockDelIndex(SReaderStatus* pStatus, int32_t order) {
- void* p = taosHashIterate(pStatus->pTableMap, NULL);
- while (p != NULL) {
- STableBlockScanInfo* pScanInfo = *(STableBlockScanInfo**)p;
-
- // reset the last del file index
- pScanInfo->lastBlockDelIndex = getInitialDelIndex(pScanInfo->delSkyline, order);
- p = taosHashIterate(pStatus->pTableMap, p);
- }
-}
-
-static int32_t initOrderCheckInfo(SUidOrderCheckInfo* pOrderCheckInfo, STsdbReader* pReader) {
- SReaderStatus* pStatus = &pReader->status;
-
- int32_t total = taosHashGetSize(pStatus->pTableMap);
- if (total == 0) {
- return TSDB_CODE_SUCCESS;
- }
-
- if (pOrderCheckInfo->tableUidList == NULL) {
- pOrderCheckInfo->currentIndex = 0;
- pOrderCheckInfo->tableUidList = taosMemoryMalloc(total * sizeof(uint64_t));
- if (pOrderCheckInfo->tableUidList == NULL) {
- return TSDB_CODE_OUT_OF_MEMORY;
- }
-
- extractOrderedTableUidList(pOrderCheckInfo, pStatus, pReader->order);
- uint64_t uid = pOrderCheckInfo->tableUidList[0];
- pStatus->pTableIter = taosHashGet(pStatus->pTableMap, &uid, sizeof(uid));
- } else {
- if (pStatus->pTableIter == NULL) { // it is the last block of a new file
- pOrderCheckInfo->currentIndex = 0;
- uint64_t uid = pOrderCheckInfo->tableUidList[pOrderCheckInfo->currentIndex];
- pStatus->pTableIter = taosHashGet(pStatus->pTableMap, &uid, sizeof(uid));
-
- // the tableMap has already updated
- if (pStatus->pTableIter == NULL) {
- void* p = taosMemoryRealloc(pOrderCheckInfo->tableUidList, total * sizeof(uint64_t));
- if (p == NULL) {
- return TSDB_CODE_OUT_OF_MEMORY;
- }
-
- pOrderCheckInfo->tableUidList = p;
- extractOrderedTableUidList(pOrderCheckInfo, pStatus, pReader->order);
-
- uid = pOrderCheckInfo->tableUidList[0];
- pStatus->pTableIter = taosHashGet(pStatus->pTableMap, &uid, sizeof(uid));
- }
- }
- }
-
- return TSDB_CODE_SUCCESS;
+ pList->currentIndex = 0;
+ uint64_t uid = pList->tableUidList[0];
+ pStatus->pTableIter = taosHashGet(pStatus->pTableMap, &uid, sizeof(uid));
}
-static bool moveToNextTable(SUidOrderCheckInfo* pOrderedCheckInfo, SReaderStatus* pStatus) {
+static bool moveToNextTable(STableUidList* pOrderedCheckInfo, SReaderStatus* pStatus) {
pOrderedCheckInfo->currentIndex += 1;
if (pOrderedCheckInfo->currentIndex >= taosHashGetSize(pStatus->pTableMap)) {
pStatus->pTableIter = NULL;
@@ -2770,11 +2782,10 @@ static bool moveToNextTable(SUidOrderCheckInfo* pOrderedCheckInfo, SReaderStatus
static int32_t doLoadLastBlockSequentially(STsdbReader* pReader) {
SReaderStatus* pStatus = &pReader->status;
SLastBlockReader* pLastBlockReader = pStatus->fileIter.pLastBlockReader;
+ STableUidList* pUidList = &pStatus->uidList;
- SUidOrderCheckInfo* pOrderedCheckInfo = &pStatus->uidCheckInfo;
- int32_t code = initOrderCheckInfo(pOrderedCheckInfo, pReader);
- if (code != TSDB_CODE_SUCCESS || (taosHashGetSize(pStatus->pTableMap) == 0)) {
- return code;
+ if (taosHashGetSize(pStatus->pTableMap) == 0) {
+ return TSDB_CODE_SUCCESS;
}
SSDataBlock* pResBlock = pReader->pResBlock;
@@ -2785,7 +2796,7 @@ static int32_t doLoadLastBlockSequentially(STsdbReader* pReader) {
bool hasVal = initLastBlockReader(pLastBlockReader, pScanInfo, pReader);
if (!hasVal) {
- bool hasNexTable = moveToNextTable(pOrderedCheckInfo, pStatus);
+ bool hasNexTable = moveToNextTable(pUidList, pStatus);
if (!hasNexTable) {
return TSDB_CODE_SUCCESS;
}
@@ -2820,7 +2831,7 @@ static int32_t doLoadLastBlockSequentially(STsdbReader* pReader) {
}
// current table is exhausted, let's try next table
- bool hasNexTable = moveToNextTable(pOrderedCheckInfo, pStatus);
+ bool hasNexTable = moveToNextTable(pUidList, pStatus);
if (!hasNexTable) {
return TSDB_CODE_SUCCESS;
}
@@ -2837,61 +2848,17 @@ static int32_t doBuildDataBlock(STsdbReader* pReader) {
SFileDataBlockInfo* pBlockInfo = getCurrentBlockInfo(pBlockIter);
SLastBlockReader* pLastBlockReader = pReader->status.fileIter.pLastBlockReader;
- ASSERT(pBlockInfo != NULL);
-
- if (pBlockInfo != NULL) {
- pScanInfo =
- *(STableBlockScanInfo**)taosHashGet(pReader->status.pTableMap, &pBlockInfo->uid, sizeof(pBlockInfo->uid));
- } else {
- pScanInfo = *pReader->status.pTableIter;
- }
-
+ pScanInfo = getTableBlockScanInfo(pReader->status.pTableMap, pBlockInfo->uid, pReader->idStr);
if (pScanInfo == NULL) {
- tsdbError("failed to get table scan-info, %s", pReader->idStr);
- code = TSDB_CODE_INVALID_PARA;
- return code;
+ return terrno;
}
- if (pBlockInfo != NULL) {
- pBlock = getCurrentBlock(pBlockIter);
- }
+ pBlock = getCurrentBlock(pBlockIter);
initLastBlockReader(pLastBlockReader, pScanInfo, pReader);
TSDBKEY keyInBuf = getCurrentKeyInBuf(pScanInfo, pReader);
- /*if (pBlockInfo == NULL) { // build data block from last data file
- SBlockData* pBData = &pReader->status.fileBlockData;
- tBlockDataReset(pBData);
-
- SSDataBlock* pResBlock = pReader->pResBlock;
- tsdbDebug("load data in last block firstly, due to desc scan data, %s", pReader->idStr);
-
- int64_t st = taosGetTimestampUs();
-
- while (1) {
- bool hasBlockLData = hasDataInLastBlock(pLastBlockReader);
-
- // no data in last block and block, no need to proceed.
- if (hasBlockLData == false) {
- break;
- }
-
- buildComposedDataBlockImpl(pReader, pScanInfo, &pReader->status.fileBlockData, pLastBlockReader);
- if (pResBlock->info.rows >= pReader->capacity) {
- break;
- }
- }
-
- double el = (taosGetTimestampUs() - st) / 1000.0;
- updateComposedBlockInfo(pReader, el, pScanInfo);
-
- if (pResBlock->info.rows > 0) {
- tsdbDebug("%p uid:%" PRIu64 ", composed data block created, brange:%" PRIu64 "-%" PRIu64
- " rows:%d, elapsed time:%.2f ms %s",
- pReader, pResBlock->info.id.uid, pResBlock->info.window.skey, pResBlock->info.window.ekey,
- pResBlock->info.rows, el, pReader->idStr);
- }
- } else*/ if (fileBlockShouldLoad(pReader, pBlockInfo, pBlock, pScanInfo, keyInBuf, pLastBlockReader)) {
+ if (fileBlockShouldLoad(pReader, pBlockInfo, pBlock, pScanInfo, keyInBuf, pLastBlockReader)) {
code = doLoadFileBlockData(pReader, pBlockIter, &pStatus->fileBlockData, pScanInfo->uid);
if (code != TSDB_CODE_SUCCESS) {
return code;
@@ -2937,7 +2904,7 @@ static int32_t doBuildDataBlock(STsdbReader* pReader) {
if (pResBlock->info.rows > 0) {
tsdbDebug("%p uid:%" PRIu64 ", composed data block created, brange:%" PRIu64 "-%" PRIu64
- " rows:%d, elapsed time:%.2f ms %s",
+ " rows:%d, elapsed time:%.2f ms %s",
pReader, pResBlock->info.id.uid, pResBlock->info.window.skey, pResBlock->info.window.ekey,
pResBlock->info.rows, el, pReader->idStr);
}
@@ -2945,12 +2912,17 @@ static int32_t doBuildDataBlock(STsdbReader* pReader) {
SDataBlockInfo* pInfo = &pReader->pResBlock->info;
pInfo->rows = pBlock->nRow;
pInfo->id.uid = pScanInfo->uid;
+ pInfo->dataLoad = 0;
pInfo->window = (STimeWindow){.skey = pBlock->minKey.ts, .ekey = pBlock->maxKey.ts};
setComposedBlockFlag(pReader, false);
setBlockAllDumped(&pStatus->fBlockDumpInfo, pBlock->maxKey.ts, pReader->order);
// update the last key for the corresponding table
pScanInfo->lastKey = ASCENDING_TRAVERSE(pReader->order) ? pInfo->window.ekey : pInfo->window.skey;
+ tsdbDebug("%p uid:%" PRIu64 " clean file block retrieved from file, global index:%d, "
+ "table index:%d, rows:%d, brange:%" PRId64 "-%" PRId64 ", %s",
+ pReader, pScanInfo->uid, pBlockIter->index, pBlockInfo->tbBlockIdx, pBlock->nRow, pBlock->minKey.ts,
+ pBlock->maxKey.ts, pReader->idStr);
}
}
@@ -2959,14 +2931,15 @@ static int32_t doBuildDataBlock(STsdbReader* pReader) {
static int32_t buildBlockFromBufferSequentially(STsdbReader* pReader) {
SReaderStatus* pStatus = &pReader->status;
+ STableUidList* pUidList = &pStatus->uidList;
while (1) {
- if (pStatus->pTableIter == NULL) {
- pStatus->pTableIter = taosHashIterate(pStatus->pTableMap, NULL);
- if (pStatus->pTableIter == NULL) {
- return TSDB_CODE_SUCCESS;
- }
- }
+// if (pStatus->pTableIter == NULL) {
+// pStatus->pTableIter = taosHashIterate(pStatus->pTableMap, NULL);
+// if (pStatus->pTableIter == NULL) {
+// return TSDB_CODE_SUCCESS;
+// }
+// }
STableBlockScanInfo** pBlockScanInfo = pStatus->pTableIter;
initMemDataIterator(*pBlockScanInfo, pReader);
@@ -2981,9 +2954,9 @@ static int32_t buildBlockFromBufferSequentially(STsdbReader* pReader) {
return TSDB_CODE_SUCCESS;
}
- // current table is exhausted, let's try the next table
- pStatus->pTableIter = taosHashIterate(pStatus->pTableMap, pStatus->pTableIter);
- if (pStatus->pTableIter == NULL) {
+ // current table is exhausted, let's try next table
+ bool hasNexTable = moveToNextTable(pUidList, pStatus);
+ if (!hasNexTable) {
return TSDB_CODE_SUCCESS;
}
}
@@ -3004,7 +2977,6 @@ void initBlockDumpInfo(STsdbReader* pReader, SDataBlockIter* pBlockIter) {
static int32_t initForFirstBlockInFile(STsdbReader* pReader, SDataBlockIter* pBlockIter) {
SBlockNumber num = {0};
-
int32_t code = moveToNextFile(pReader, &num);
if (code != TSDB_CODE_SUCCESS) {
return code;
@@ -3022,6 +2994,7 @@ static int32_t initForFirstBlockInFile(STsdbReader* pReader, SDataBlockIter* pBl
} else { // no block data, only last block exists
tBlockDataReset(&pReader->status.fileBlockData);
resetDataBlockIterator(pBlockIter, pReader->order);
+ resetTableListIndex(&pReader->status);
}
// set the correct start position according to the query time window
@@ -3062,7 +3035,7 @@ static int32_t buildBlockFromFiles(STsdbReader* pReader) {
// this file does not have data files, let's start check the last block file if exists
if (pBlockIter->numOfBlocks == 0) {
- resetScanBlockLastBlockDelIndex(&pReader->status, pReader->order);
+ resetTableListIndex(&pReader->status);
goto _begin;
}
}
@@ -3094,7 +3067,7 @@ static int32_t buildBlockFromFiles(STsdbReader* pReader) {
// data blocks in current file are exhausted, let's try the next file now
tBlockDataReset(&pReader->status.fileBlockData);
resetDataBlockIterator(pBlockIter, pReader->order);
- resetScanBlockLastBlockDelIndex(&pReader->status, pReader->order);
+ resetTableListIndex(&pReader->status);
goto _begin;
} else {
code = initForFirstBlockInFile(pReader, pBlockIter);
@@ -3106,7 +3079,7 @@ static int32_t buildBlockFromFiles(STsdbReader* pReader) {
// this file does not have blocks, let's start check the last block file
if (pBlockIter->numOfBlocks == 0) {
- resetScanBlockLastBlockDelIndex(&pReader->status, pReader->order);
+ resetTableListIndex(&pReader->status);
goto _begin;
}
}
@@ -3202,7 +3175,8 @@ bool hasBeenDropped(const SArray* pDelList, int32_t* index, TSDBKEY* pKey, int32
return false;
} else if (pKey->ts == last->ts) {
TSDBKEY* prev = taosArrayGet(pDelList, num - 2);
- return (prev->version >= pKey->version && prev->version <= pVerRange->maxVer && prev->version >= pVerRange->minVer);
+ return (prev->version >= pKey->version && prev->version <= pVerRange->maxVer &&
+ prev->version >= pVerRange->minVer);
}
} else {
TSDBKEY* pCurrent = taosArrayGet(pDelList, *index);
@@ -3386,7 +3360,7 @@ static int32_t checkForNeighborFileBlock(STsdbReader* pReader, STableBlockScanIn
*state = CHECK_FILEBLOCK_QUIT;
int32_t step = ASCENDING_TRAVERSE(pReader->order) ? 1 : -1;
- bool loadNeighbor = true;
+ bool loadNeighbor = true;
int32_t code = loadNeighborIfOverlap(pFBlock, pScanInfo, pReader, &loadNeighbor);
if (loadNeighbor && (code == TSDB_CODE_SUCCESS)) {
@@ -3638,7 +3612,7 @@ int32_t doAppendRowFromTSRow(SSDataBlock* pBlock, STsdbReader* pReader, STSRow*
SColVal colVal = {0};
int32_t i = 0, j = 0;
- if (pSupInfo->colId[i]== PRIMARYKEY_TIMESTAMP_COL_ID) {
+ if (pSupInfo->colId[i] == PRIMARYKEY_TIMESTAMP_COL_ID) {
SColumnInfoData* pColData = taosArrayGet(pBlock->pDataBlock, pSupInfo->slotId[i]);
((int64_t*)pColData->pData)[outputRowIndex] = pTSRow->ts;
i += 1;
@@ -3683,7 +3657,7 @@ int32_t doAppendRowFromFileBlock(SSDataBlock* pResBlock, STsdbReader* pReader, S
int32_t outputRowIndex = pResBlock->info.rows;
SBlockLoadSuppInfo* pSupInfo = &pReader->suppInfo;
- if (pReader->suppInfo.colId[i]== PRIMARYKEY_TIMESTAMP_COL_ID) {
+ if (pReader->suppInfo.colId[i] == PRIMARYKEY_TIMESTAMP_COL_ID) {
SColumnInfoData* pColData = taosArrayGet(pResBlock->pDataBlock, pSupInfo->slotId[i]);
((int64_t*)pColData->pData)[outputRowIndex] = pBlockData->aTSKEY[rowIndex];
i += 1;
@@ -3768,11 +3742,15 @@ int32_t tsdbSetTableList(STsdbReader* pReader, const void* pTableList, int32_t n
ASSERT(size >= num);
taosHashClear(pReader->status.pTableMap);
+ STableUidList* pUidList = &pReader->status.uidList;
+ pUidList->currentIndex = 0;
STableKeyInfo* pList = (STableKeyInfo*)pTableList;
for (int32_t i = 0; i < num; ++i) {
STableBlockScanInfo* pInfo = getPosInBlockInfoBuf(&pReader->blockInfoBuf, i);
pInfo->uid = pList[i].uid;
+ pUidList->tableUidList[i] = pList[i].uid;
+
taosHashPut(pReader->status.pTableMap, &pInfo->uid, sizeof(uint64_t), &pInfo, POINTER_BYTES);
}
@@ -3796,18 +3774,24 @@ void* tsdbGetIvtIdx(SMeta* pMeta) {
uint64_t getReaderMaxVersion(STsdbReader* pReader) { return pReader->verRange.maxVer; }
static int32_t doOpenReaderImpl(STsdbReader* pReader) {
- SDataBlockIter* pBlockIter = &pReader->status.blockIter;
+ SReaderStatus* pStatus = &pReader->status;
+ SDataBlockIter* pBlockIter = &pStatus->blockIter;
- initFilesetIterator(&pReader->status.fileIter, pReader->pReadSnap->fs.aDFileSet, pReader);
- resetDataBlockIterator(&pReader->status.blockIter, pReader->order);
+ initFilesetIterator(&pStatus->fileIter, pReader->pReadSnap->fs.aDFileSet, pReader);
+ resetDataBlockIterator(&pStatus->blockIter, pReader->order);
- // no data in files, let's try buffer in memory
- if (pReader->status.fileIter.numOfFiles == 0) {
- pReader->status.loadFromFile = false;
- return TSDB_CODE_SUCCESS;
+ int32_t code = TSDB_CODE_SUCCESS;
+ if (pStatus->fileIter.numOfFiles == 0) {
+ pStatus->loadFromFile = false;
} else {
- return initForFirstBlockInFile(pReader, pBlockIter);
+ code = initForFirstBlockInFile(pReader, pBlockIter);
}
+
+ if (!pStatus->loadFromFile) {
+ resetTableListIndex(pStatus);
+ }
+
+ return code;
}
// ====================================== EXPOSED APIs ======================================
@@ -3819,11 +3803,9 @@ int32_t tsdbReaderOpen(SVnode* pVnode, SQueryTableDataCond* pCond, void* pTableL
pCond->twindows.ekey -= 1;
}
- int32_t capacity = 0;
- if (pResBlock == NULL) {
- capacity = 4096;
- } else {
- capacity = pResBlock->info.capacity;
+ int32_t capacity = pVnode->config.tsdbCfg.maxRows;
+ if (pResBlock != NULL) {
+ blockDataEnsureCapacity(pResBlock, capacity);
}
int32_t code = tsdbReaderCreate(pVnode, pCond, ppReader, capacity, pResBlock, idstr);
@@ -3896,7 +3878,7 @@ int32_t tsdbReaderOpen(SVnode* pVnode, SQueryTableDataCond* pCond, void* pTableL
}
STsdbReader* p = (pReader->innerReader[0] != NULL) ? pReader->innerReader[0] : pReader;
- pReader->status.pTableMap = createDataBlockScanInfo(p, &pReader->blockInfoBuf, pTableList, numOfTables);
+ pReader->status.pTableMap = createDataBlockScanInfo(p, &pReader->blockInfoBuf, pTableList, &pReader->status.uidList, numOfTables);
if (pReader->status.pTableMap == NULL) {
*ppReader = NULL;
code = TSDB_CODE_OUT_OF_MEMORY;
@@ -3921,12 +3903,14 @@ int32_t tsdbReaderOpen(SVnode* pVnode, SQueryTableDataCond* pCond, void* pTableL
// we need only one row
pPrevReader->capacity = 1;
pPrevReader->status.pTableMap = pReader->status.pTableMap;
+ pPrevReader->status.uidList = pReader->status.uidList;
pPrevReader->pSchema = pReader->pSchema;
pPrevReader->pMemSchema = pReader->pMemSchema;
pPrevReader->pReadSnap = pReader->pReadSnap;
pNextReader->capacity = 1;
pNextReader->status.pTableMap = pReader->status.pTableMap;
+ pNextReader->status.uidList = pReader->status.uidList;
pNextReader->pSchema = pReader->pSchema;
pNextReader->pMemSchema = pReader->pMemSchema;
pNextReader->pReadSnap = pReader->pReadSnap;
@@ -3944,6 +3928,7 @@ int32_t tsdbReaderOpen(SVnode* pVnode, SQueryTableDataCond* pCond, void* pTableL
_err:
tsdbError("failed to create data reader, code:%s %s", tstrerror(code), idstr);
tsdbReaderClose(pReader);
+ *ppReader = NULL; // reset the pointer value.
return code;
}
@@ -3957,6 +3942,7 @@ void tsdbReaderClose(STsdbReader* pReader) {
STsdbReader* p = pReader->innerReader[0];
p->status.pTableMap = NULL;
+ p->status.uidList.tableUidList = NULL;
p->pReadSnap = NULL;
p->pSchema = NULL;
p->pMemSchema = NULL;
@@ -3964,6 +3950,7 @@ void tsdbReaderClose(STsdbReader* pReader) {
p = pReader->innerReader[1];
p->status.pTableMap = NULL;
+ p->status.uidList.tableUidList = NULL;
p->pReadSnap = NULL;
p->pSchema = NULL;
p->pMemSchema = NULL;
@@ -4011,7 +3998,7 @@ void tsdbReaderClose(STsdbReader* pReader) {
tsdbUntakeReadSnap(pReader->pTsdb, pReader->pReadSnap, pReader->idStr);
- taosMemoryFree(pReader->status.uidCheckInfo.tableUidList);
+ taosMemoryFree(pReader->status.uidList.tableUidList);
SIOCostSummary* pCost = &pReader->cost;
SFilesetIter* pFilesetIter = &pReader->status.fileIter;
@@ -4025,22 +4012,24 @@ void tsdbReaderClose(STsdbReader* pReader) {
taosMemoryFree(pLReader);
}
- tsdbDebug("%p :io-cost summary: head-file:%" PRIu64 ", head-file time:%.2f ms, SMA:%" PRId64
- " SMA-time:%.2f ms, fileBlocks:%" PRId64
- ", fileBlocks-load-time:%.2f ms, "
- "build in-memory-block-time:%.2f ms, lastBlocks:%" PRId64
- ", lastBlocks-time:%.2f ms, composed-blocks:%" PRId64
- ", composed-blocks-time:%.2fms, STableBlockScanInfo size:%.2f Kb, creatTime:%.2f ms, %s",
- pReader, pCost->headFileLoad, pCost->headFileLoadTime, pCost->smaDataLoad, pCost->smaLoadTime,
- pCost->numOfBlocks, pCost->blockLoadTime, pCost->buildmemBlock, pCost->lastBlockLoad,
- pCost->lastBlockLoadTime, pCost->composedBlocks, pCost->buildComposedBlockTime,
- numOfTables * sizeof(STableBlockScanInfo) / 1000.0, pCost->createScanInfoList, pReader->idStr);
+ tsdbDebug(
+ "%p :io-cost summary: head-file:%" PRIu64 ", head-file time:%.2f ms, SMA:%" PRId64
+ " SMA-time:%.2f ms, fileBlocks:%" PRId64
+ ", fileBlocks-load-time:%.2f ms, "
+ "build in-memory-block-time:%.2f ms, lastBlocks:%" PRId64 ", lastBlocks-time:%.2f ms, composed-blocks:%" PRId64
+ ", composed-blocks-time:%.2fms, STableBlockScanInfo size:%.2f Kb, createTime:%.2f ms,initDelSkylineIterTime:%.2f ms, %s",
+ pReader, pCost->headFileLoad, pCost->headFileLoadTime, pCost->smaDataLoad, pCost->smaLoadTime, pCost->numOfBlocks,
+ pCost->blockLoadTime, pCost->buildmemBlock, pCost->lastBlockLoad, pCost->lastBlockLoadTime, pCost->composedBlocks,
+ pCost->buildComposedBlockTime, numOfTables * sizeof(STableBlockScanInfo) / 1000.0, pCost->createScanInfoList,
+ pCost->initDelSkylineIterTime, pReader->idStr);
taosMemoryFree(pReader->idStr);
taosMemoryFree(pReader->pSchema);
+
if (pReader->pMemSchema != pReader->pSchema) {
taosMemoryFree(pReader->pMemSchema);
}
+
taosMemoryFreeClear(pReader);
}
@@ -4050,7 +4039,7 @@ static bool doTsdbNextDataBlock(STsdbReader* pReader) {
blockDataCleanup(pBlock);
SReaderStatus* pStatus = &pReader->status;
- if (taosHashGetSize(pStatus->pTableMap) == 0){
+ if (taosHashGetSize(pStatus->pTableMap) == 0) {
return false;
}
@@ -4063,6 +4052,7 @@ static bool doTsdbNextDataBlock(STsdbReader* pReader) {
if (pBlock->info.rows > 0) {
return true;
} else {
+ resetTableListIndex(&pReader->status);
buildBlockFromBufferSequentially(pReader);
return pBlock->info.rows > 0;
}
@@ -4073,11 +4063,11 @@ static bool doTsdbNextDataBlock(STsdbReader* pReader) {
}
bool tsdbNextDataBlock(STsdbReader* pReader) {
- if (isEmptyQueryTimeWindow(&pReader->window)) {
+ if (isEmptyQueryTimeWindow(&pReader->window) || pReader->step == EXTERNAL_ROWS_NEXT) {
return false;
}
- if (pReader->innerReader[0] != NULL && pReader->step == 0) {
+ if (pReader->step == 0 && pReader->innerReader[0] != NULL) {
bool ret = doTsdbNextDataBlock(pReader->innerReader[0]);
pReader->step = EXTERNAL_ROWS_PREV;
if (ret) {
@@ -4102,7 +4092,7 @@ bool tsdbNextDataBlock(STsdbReader* pReader) {
return ret;
}
- if (pReader->innerReader[1] != NULL && pReader->step == EXTERNAL_ROWS_MAIN) {
+ if (pReader->step == EXTERNAL_ROWS_MAIN && pReader->innerReader[1] != NULL) {
// prepare for the next row scan
int32_t code = doOpenReaderImpl(pReader->innerReader[1]);
resetAllDataBlockScanInfo(pReader->innerReader[1]->status.pTableMap, pReader->window.ekey);
@@ -4110,42 +4100,20 @@ bool tsdbNextDataBlock(STsdbReader* pReader) {
return code;
}
- bool ret1 = doTsdbNextDataBlock(pReader->innerReader[1]);
+ ret = doTsdbNextDataBlock(pReader->innerReader[1]);
pReader->step = EXTERNAL_ROWS_NEXT;
- if (ret1) {
- return ret1;
+ if (ret) {
+ return ret;
}
}
return false;
}
-static void setBlockInfo(const STsdbReader* pReader, int32_t* rows, uint64_t* uid, STimeWindow* pWindow) {
- *rows = pReader->pResBlock->info.rows;
- *uid = pReader->pResBlock->info.id.uid;
- *pWindow = pReader->pResBlock->info.window;
-}
-
-void tsdbRetrieveDataBlockInfo(const STsdbReader* pReader, int32_t* rows, uint64_t* uid, STimeWindow* pWindow) {
- if (pReader->type == TIMEWINDOW_RANGE_EXTERNAL) {
- if (pReader->step == EXTERNAL_ROWS_MAIN) {
- setBlockInfo(pReader, rows, uid, pWindow);
- } else if (pReader->step == EXTERNAL_ROWS_PREV) {
- setBlockInfo(pReader->innerReader[0], rows, uid, pWindow);
- } else {
- setBlockInfo(pReader->innerReader[1], rows, uid, pWindow);
- }
- } else {
- setBlockInfo(pReader, rows, uid, pWindow);
- }
-}
-
-
-static void doFillNullColSMA(SBlockLoadSuppInfo* pSup, int32_t numOfRows, int32_t numOfCols,
- SColumnDataAgg* pTsAgg) {
+static void doFillNullColSMA(SBlockLoadSuppInfo* pSup, int32_t numOfRows, int32_t numOfCols, SColumnDataAgg* pTsAgg) {
// do fill all null column value SMA info
int32_t i = 0, j = 0;
- int32_t size = (int32_t) taosArrayGetSize(pSup->pColAgg);
+ int32_t size = (int32_t)taosArrayGetSize(pSup->pColAgg);
taosArrayInsert(pSup->pColAgg, 0, pTsAgg);
while (j < numOfCols && i < size) {
@@ -4158,7 +4126,7 @@ static void doFillNullColSMA(SBlockLoadSuppInfo* pSup, int32_t numOfRows, int32_
} else if (pSup->colId[j] < pAgg->colId) {
if (pSup->colId[j] != PRIMARYKEY_TIMESTAMP_COL_ID) {
SColumnDataAgg nullColAgg = {.colId = pSup->colId[j], .numOfNull = numOfRows};
- taosArrayInsert(pSup->pColAgg, i ,&nullColAgg);
+ taosArrayInsert(pSup->pColAgg, i, &nullColAgg);
}
j += 1;
}
@@ -4223,7 +4191,7 @@ int32_t tsdbRetrieveDatablockSMA(STsdbReader* pReader, SSDataBlock* pDataBlock,
SSDataBlock* pResBlock = pReader->pResBlock;
if (pResBlock->pBlockAgg == NULL) {
size_t num = taosArrayGetSize(pResBlock->pDataBlock);
- pResBlock->pBlockAgg = taosMemoryCalloc(num, sizeof(SColumnDataAgg));
+ pResBlock->pBlockAgg = taosMemoryCalloc(num, POINTER_BYTES);
}
// do fill all null column value SMA info
@@ -4253,6 +4221,18 @@ int32_t tsdbRetrieveDatablockSMA(STsdbReader* pReader, SSDataBlock* pDataBlock,
return code;
}
+STableBlockScanInfo* getTableBlockScanInfo(SHashObj* pTableMap, uint64_t uid, const char* id) {
+ STableBlockScanInfo** p = taosHashGet(pTableMap, &uid, sizeof(uid));
+ if (p == NULL || *p == NULL) {
+ terrno = TSDB_CODE_INVALID_PARA;
+ int32_t size = taosHashGetSize(pTableMap);
+ tsdbError("failed to locate the uid:%" PRIu64 " in query table uid list, total tables:%d, %s", uid, size, id);
+ return NULL;
+ }
+
+ return *p;
+}
+
static SSDataBlock* doRetrieveDataBlock(STsdbReader* pReader) {
SReaderStatus* pStatus = &pReader->status;
@@ -4261,12 +4241,8 @@ static SSDataBlock* doRetrieveDataBlock(STsdbReader* pReader) {
}
SFileDataBlockInfo* pBlockInfo = getCurrentBlockInfo(&pStatus->blockIter);
- STableBlockScanInfo* pBlockScanInfo =
- *(STableBlockScanInfo**)taosHashGet(pStatus->pTableMap, &pBlockInfo->uid, sizeof(pBlockInfo->uid));
+ STableBlockScanInfo* pBlockScanInfo = getTableBlockScanInfo(pStatus->pTableMap, pBlockInfo->uid, pReader->idStr);
if (pBlockScanInfo == NULL) {
- terrno = TSDB_CODE_INVALID_PARA;
- tsdbError("failed to locate the uid:%" PRIu64 " in query table uid list, total tables:%d, %s", pBlockInfo->uid,
- taosHashGetSize(pReader->status.pTableMap), pReader->idStr);
return NULL;
}
@@ -4277,7 +4253,7 @@ static SSDataBlock* doRetrieveDataBlock(STsdbReader* pReader) {
return NULL;
}
- copyBlockDataToSDataBlock(pReader, pBlockScanInfo);
+ copyBlockDataToSDataBlock(pReader);
return pReader->pResBlock;
}
@@ -4298,12 +4274,14 @@ int32_t tsdbReaderReset(STsdbReader* pReader, SQueryTableDataCond* pCond) {
return TSDB_CODE_SUCCESS;
}
- SDataBlockIter* pBlockIter = &pReader->status.blockIter;
+ SReaderStatus* pStatus = &pReader->status;
+
+ SDataBlockIter* pBlockIter = &pStatus->blockIter;
pReader->order = pCond->order;
pReader->type = TIMEWINDOW_RANGE_CONTAINED;
- pReader->status.loadFromFile = true;
- pReader->status.pTableIter = NULL;
+ pStatus->loadFromFile = true;
+ pStatus->pTableIter = NULL;
pReader->window = updateQueryTimeWindow(pReader->pTsdb, &pCond->twindows);
// allocate buffer in order to load data blocks from file
@@ -4312,19 +4290,21 @@ int32_t tsdbReaderReset(STsdbReader* pReader, SQueryTableDataCond* pCond) {
pReader->suppInfo.tsColAgg.colId = PRIMARYKEY_TIMESTAMP_COL_ID;
tsdbDataFReaderClose(&pReader->pFileReader);
- int32_t numOfTables = taosHashGetSize(pReader->status.pTableMap);
+ int32_t numOfTables = taosHashGetSize(pStatus->pTableMap);
- initFilesetIterator(&pReader->status.fileIter, pReader->pReadSnap->fs.aDFileSet, pReader);
+ initFilesetIterator(&pStatus->fileIter, pReader->pReadSnap->fs.aDFileSet, pReader);
resetDataBlockIterator(pBlockIter, pReader->order);
+ resetTableListIndex(&pReader->status);
int64_t ts = ASCENDING_TRAVERSE(pReader->order) ? pReader->window.skey - 1 : pReader->window.ekey + 1;
- resetAllDataBlockScanInfo(pReader->status.pTableMap, ts);
+ resetAllDataBlockScanInfo(pStatus->pTableMap, ts);
int32_t code = 0;
// no data in files, let's try buffer in memory
- if (pReader->status.fileIter.numOfFiles == 0) {
- pReader->status.loadFromFile = false;
+ if (pStatus->fileIter.numOfFiles == 0) {
+ pStatus->loadFromFile = false;
+ resetTableListIndex(pStatus);
} else {
code = initForFirstBlockInFile(pReader, pBlockIter);
if (code != TSDB_CODE_SUCCESS) {
@@ -4402,7 +4382,7 @@ int32_t tsdbGetFileBlocksDistInfo(STsdbReader* pReader, STableBlockDistInfo* pTa
hasNext = blockIteratorNext(&pStatus->blockIter, pReader->idStr);
} else {
code = initForFirstBlockInFile(pReader, pBlockIter);
- if ((code != TSDB_CODE_SUCCESS) || (pReader->status.loadFromFile == false)) {
+ if ((code != TSDB_CODE_SUCCESS) || (pStatus->loadFromFile == false)) {
break;
}
@@ -4427,7 +4407,7 @@ int64_t tsdbGetNumOfRowsInMemTable(STsdbReader* pReader) {
STableBlockScanInfo* pBlockScanInfo = *(STableBlockScanInfo**)pStatus->pTableIter;
STbData* d = NULL;
- if (pReader->pTsdb->mem != NULL) {
+ if (pReader->pReadSnap->pMem != NULL) {
d = tsdbGetTbDataFromMemTable(pReader->pReadSnap->pMem, pReader->suid, pBlockScanInfo->uid);
if (d != NULL) {
rows += tsdbGetNRowsInTbData(d);
@@ -4435,7 +4415,7 @@ int64_t tsdbGetNumOfRowsInMemTable(STsdbReader* pReader) {
}
STbData* di = NULL;
- if (pReader->pTsdb->imem != NULL) {
+ if (pReader->pReadSnap->pIMem != NULL) {
di = tsdbGetTbDataFromMemTable(pReader->pReadSnap->pIMem, pReader->suid, pBlockScanInfo->uid);
if (di != NULL) {
rows += tsdbGetNRowsInTbData(di);
diff --git a/source/dnode/vnode/src/tsdb/tsdbReaderWriter.c b/source/dnode/vnode/src/tsdb/tsdbReaderWriter.c
index c7bce6182a380bd278a8e272eae22773350a630c..50fd9d7aa7035adbfe8d17fde078b301483fe015 100644
--- a/source/dnode/vnode/src/tsdb/tsdbReaderWriter.c
+++ b/source/dnode/vnode/src/tsdb/tsdbReaderWriter.c
@@ -47,15 +47,21 @@ static int32_t tsdbOpenFile(const char *path, int32_t szPage, int32_t flag, STsd
taosMemoryFree(pFD);
goto _exit;
}
- if (taosStatFile(path, &pFD->szFile, NULL) < 0) {
- code = TAOS_SYSTEM_ERROR(errno);
- taosMemoryFree(pFD->pBuf);
- taosCloseFile(&pFD->pFD);
- taosMemoryFree(pFD);
- goto _exit;
+
+ // not check file size when reading data files.
+ if (flag != TD_FILE_READ) {
+ if (taosStatFile(path, &pFD->szFile, NULL) < 0) {
+ code = TAOS_SYSTEM_ERROR(errno);
+ taosMemoryFree(pFD->pBuf);
+ taosCloseFile(&pFD->pFD);
+ taosMemoryFree(pFD);
+ goto _exit;
+ }
+
+ ASSERT(pFD->szFile % szPage == 0);
+ pFD->szFile = pFD->szFile / szPage;
}
- ASSERT(pFD->szFile % szPage == 0);
- pFD->szFile = pFD->szFile / szPage;
+
*ppFD = pFD;
_exit:
@@ -103,7 +109,7 @@ _exit:
static int32_t tsdbReadFilePage(STsdbFD *pFD, int64_t pgno) {
int32_t code = 0;
- ASSERT(pgno <= pFD->szFile);
+ // ASSERT(pgno <= pFD->szFile);
// seek
int64_t offset = PAGE_OFFSET(pgno, pFD->szPage);
@@ -175,7 +181,7 @@ static int32_t tsdbReadFile(STsdbFD *pFD, int64_t offset, uint8_t *pBuf, int64_t
int32_t szPgCont = PAGE_CONTENT_SIZE(pFD->szPage);
int64_t bOffset = fOffset % pFD->szPage;
- ASSERT(pgno && pgno <= pFD->szFile);
+ // ASSERT(pgno && pgno <= pFD->szFile);
ASSERT(bOffset < szPgCont);
while (n < size) {
diff --git a/source/dnode/vnode/src/tsdb/tsdbUtil.c b/source/dnode/vnode/src/tsdb/tsdbUtil.c
index e2d4b92836d8f6c25cdd4eb5838553fdef167ba5..853f0bcc2129e1a3aad964f8436d8b46a8f7a9c7 100644
--- a/source/dnode/vnode/src/tsdb/tsdbUtil.c
+++ b/source/dnode/vnode/src/tsdb/tsdbUtil.c
@@ -929,8 +929,9 @@ int32_t tRowMergerGetRow(SRowMerger *pMerger, STSRow **ppRow) {
return code;
}
+/*
// delete skyline ======================================================
-static int32_t tsdbMergeSkyline(SArray *aSkyline1, SArray *aSkyline2, SArray *aSkyline) {
+static int32_t tsdbMergeSkyline2(SArray *aSkyline1, SArray *aSkyline2, SArray *aSkyline) {
int32_t code = 0;
int32_t i1 = 0;
int32_t n1 = taosArrayGetSize(aSkyline1);
@@ -996,7 +997,139 @@ static int32_t tsdbMergeSkyline(SArray *aSkyline1, SArray *aSkyline2, SArray *aS
_exit:
return code;
}
+*/
+
+// delete skyline ======================================================
+static int32_t tsdbMergeSkyline(SArray *pSkyline1, SArray *pSkyline2, SArray *pSkyline) {
+ int32_t code = 0;
+ int32_t i1 = 0;
+ int32_t n1 = taosArrayGetSize(pSkyline1);
+ int32_t i2 = 0;
+ int32_t n2 = taosArrayGetSize(pSkyline2);
+ TSDBKEY *pKey1;
+ TSDBKEY *pKey2;
+ int64_t version1 = 0;
+ int64_t version2 = 0;
+
+ ASSERT(n1 > 0 && n2 > 0);
+
+ taosArrayClear(pSkyline);
+ TSDBKEY **pItem = TARRAY_GET_ELEM(pSkyline, 0);
+
+ while (i1 < n1 && i2 < n2) {
+ pKey1 = (TSDBKEY *)taosArrayGetP(pSkyline1, i1);
+ pKey2 = (TSDBKEY *)taosArrayGetP(pSkyline2, i2);
+
+ if (pKey1->ts < pKey2->ts) {
+ version1 = pKey1->version;
+ *pItem = pKey1;
+ i1++;
+ } else if (pKey1->ts > pKey2->ts) {
+ version2 = pKey2->version;
+ *pItem = pKey2;
+ i2++;
+ } else {
+ version1 = pKey1->version;
+ version2 = pKey2->version;
+ *pItem = pKey1;
+ i1++;
+ i2++;
+ }
+
+ (*pItem)->version = TMAX(version1, version2);
+ pItem++;
+ }
+
+ while (i1 < n1) {
+ pKey1 = (TSDBKEY *)taosArrayGetP(pSkyline1, i1);
+ *pItem = pKey1;
+ pItem++;
+ i1++;
+ }
+
+ while (i2 < n2) {
+ pKey2 = (TSDBKEY *)taosArrayGetP(pSkyline2, i2);
+ *pItem = pKey2;
+ pItem++;
+ i2++;
+ }
+
+ pSkyline->size = TARRAY_ELEM_IDX(pSkyline, pItem);
+ return code;
+}
+
+
+int32_t tsdbBuildDeleteSkylineImpl(SArray *aSkyline, int32_t sidx, int32_t eidx, SArray *pSkyline) {
+ int32_t code = 0;
+ SDelData *pDelData;
+ int32_t midx;
+
+ taosArrayClear(pSkyline);
+ if (sidx == eidx) {
+ TSDBKEY *pItem1 = taosArrayGet(aSkyline, sidx * 2);
+ TSDBKEY *pItem2 = taosArrayGet(aSkyline, sidx * 2 + 1);
+ taosArrayPush(pSkyline, &pItem1);
+ taosArrayPush(pSkyline, &pItem2);
+ } else {
+ SArray *pSkyline1 = NULL;
+ SArray *pSkyline2 = NULL;
+ midx = (sidx + eidx) / 2;
+
+ pSkyline1 = taosArrayInit((midx - sidx + 1) * 2, POINTER_BYTES);
+ pSkyline2 = taosArrayInit((eidx - midx) * 2, POINTER_BYTES);
+ if (pSkyline1 == NULL || pSkyline1 == NULL) {
+ code = TSDB_CODE_OUT_OF_MEMORY;
+ goto _clear;
+ }
+
+ code = tsdbBuildDeleteSkylineImpl(aSkyline, sidx, midx, pSkyline1);
+ if (code) goto _clear;
+
+ code = tsdbBuildDeleteSkylineImpl(aSkyline, midx + 1, eidx, pSkyline2);
+ if (code) goto _clear;
+
+ code = tsdbMergeSkyline(pSkyline1, pSkyline2, pSkyline);
+
+ _clear:
+ taosArrayDestroy(pSkyline1);
+ taosArrayDestroy(pSkyline2);
+ }
+
+ return code;
+}
+
+
int32_t tsdbBuildDeleteSkyline(SArray *aDelData, int32_t sidx, int32_t eidx, SArray *aSkyline) {
+ SDelData *pDelData;
+ int32_t code = 0;
+ int32_t dataNum = eidx - sidx + 1;
+ SArray *aTmpSkyline = taosArrayInit(dataNum * 2, sizeof(TSDBKEY));
+ SArray *pSkyline = taosArrayInit(dataNum * 2, POINTER_BYTES);
+
+ for (int32_t i = sidx; i <= eidx; ++i) {
+ pDelData = (SDelData *)taosArrayGet(aDelData, i);
+ taosArrayPush(aTmpSkyline, &(TSDBKEY){.ts = pDelData->sKey, .version = pDelData->version});
+ taosArrayPush(aTmpSkyline, &(TSDBKEY){.ts = pDelData->eKey, .version = 0});
+ }
+
+ code = tsdbBuildDeleteSkylineImpl(aTmpSkyline, sidx, eidx, pSkyline);
+ if (code) goto _clear;
+
+ int32_t skylineNum = taosArrayGetSize(pSkyline);
+ for (int32_t i = 0; i < skylineNum; ++i) {
+ TSDBKEY *p = taosArrayGetP(pSkyline, i);
+ taosArrayPush(aSkyline, p);
+ }
+
+_clear:
+ taosArrayDestroy(aTmpSkyline);
+ taosArrayDestroy(pSkyline);
+
+ return code;
+}
+
+/*
+int32_t tsdbBuildDeleteSkyline2(SArray *aDelData, int32_t sidx, int32_t eidx, SArray *aSkyline) {
int32_t code = 0;
SDelData *pDelData;
int32_t midx;
@@ -1033,6 +1166,7 @@ int32_t tsdbBuildDeleteSkyline(SArray *aDelData, int32_t sidx, int32_t eidx, SAr
return code;
}
+*/
// SBlockData ======================================================
int32_t tBlockDataCreate(SBlockData *pBlockData) {
diff --git a/source/dnode/vnode/src/vnd/vnodeCommit.c b/source/dnode/vnode/src/vnd/vnodeCommit.c
index b94d44eb7da10202dc816dbfb37a2fa58eae2db3..cefa9e675562bf0b96d2e107b73f2beac4ebb8eb 100644
--- a/source/dnode/vnode/src/vnd/vnodeCommit.c
+++ b/source/dnode/vnode/src/vnd/vnodeCommit.c
@@ -21,12 +21,34 @@
static int vnodeEncodeInfo(const SVnodeInfo *pInfo, char **ppData);
static int vnodeCommitImpl(SCommitInfo *pInfo);
+#define WAIT_TIME_MILI_SEC 50
+
int vnodeBegin(SVnode *pVnode) {
// alloc buffer pool
+ int32_t nTry = 0;
+
taosThreadMutexLock(&pVnode->mutex);
while (pVnode->pPool == NULL) {
- taosThreadCondWait(&pVnode->poolNotEmpty, &pVnode->mutex);
+ vInfo("vgId:%d no free buffer pool on %d try, wait %d ms...", TD_VID(pVnode), ++nTry, WAIT_TIME_MILI_SEC);
+
+ struct timeval tv;
+ struct timespec ts;
+ taosGetTimeOfDay(&tv);
+ ts.tv_nsec = tv.tv_usec * 1000 + WAIT_TIME_MILI_SEC * 1000000;
+ if (ts.tv_nsec > 999999999l) {
+ ts.tv_sec = tv.tv_sec + 1;
+ ts.tv_nsec -= 1000000000l;
+ } else {
+ ts.tv_sec = tv.tv_sec;
+ }
+
+ int32_t rc = taosThreadCondTimedWait(&pVnode->poolNotEmpty, &pVnode->mutex, &ts);
+ if (rc && rc != ETIMEDOUT) {
+ terrno = TAOS_SYSTEM_ERROR(rc);
+ taosThreadMutexUnlock(&pVnode->mutex);
+ return -1;
+ }
}
pVnode->inUse = pVnode->pPool;
@@ -70,7 +92,7 @@ int vnodeShouldCommit(SVnode *pVnode) {
}
SVCommitSched *pSched = &pVnode->commitSched;
- int64_t nowMs = taosGetMonoTimestampMs();
+ int64_t nowMs = taosGetMonoTimestampMs();
return (((pVnode->inUse->size > pVnode->inUse->node.size) && (pSched->commitMs + SYNC_VND_COMMIT_MIN_MS < nowMs)) ||
(pVnode->inUse->size > 0 && pSched->commitMs + pSched->maxWaitMs < nowMs));
diff --git a/source/dnode/vnode/src/vnd/vnodeOpen.c b/source/dnode/vnode/src/vnd/vnodeOpen.c
index 58d9f1a0499b90a463fed10b65497a0a41b47098..97ee2e4a89597aa6021b08ee35bc1dd27684a353 100644
--- a/source/dnode/vnode/src/vnd/vnodeOpen.c
+++ b/source/dnode/vnode/src/vnd/vnodeOpen.c
@@ -239,7 +239,7 @@ _err:
if (pVnode->pWal) walClose(pVnode->pWal);
if (pVnode->pTsdb) tsdbClose(&pVnode->pTsdb);
if (pVnode->pSma) smaClose(pVnode->pSma);
- if (pVnode->pMeta) metaClose(pVnode->pMeta);
+ if (pVnode->pMeta) metaClose(&pVnode->pMeta);
if (pVnode->pPool) vnodeCloseBufPool(pVnode);
tsem_destroy(&(pVnode->canCommit));
@@ -263,7 +263,7 @@ void vnodeClose(SVnode *pVnode) {
tqClose(pVnode->pTq);
if (pVnode->pTsdb) tsdbClose(&pVnode->pTsdb);
smaClose(pVnode->pSma);
- metaClose(pVnode->pMeta);
+ if (pVnode->pMeta) metaClose(&pVnode->pMeta);
vnodeCloseBufPool(pVnode);
tsem_post(&pVnode->canCommit);
diff --git a/source/dnode/vnode/src/vnd/vnodeSnapshot.c b/source/dnode/vnode/src/vnd/vnodeSnapshot.c
index 43f903dc4867178919e3d3b519b899afcca6d835..448726161710cddabed9231554af47f4332b22db 100644
--- a/source/dnode/vnode/src/vnd/vnodeSnapshot.c
+++ b/source/dnode/vnode/src/vnd/vnodeSnapshot.c
@@ -426,7 +426,13 @@ int32_t vnodeSnapWrite(SVSnapWriter *pWriter, uint8_t *pData, uint32_t nData) {
SVnode *pVnode = pWriter->pVnode;
ASSERT(pHdr->size + sizeof(SSnapDataHdr) == nData);
- ASSERT(pHdr->index == pWriter->index + 1);
+
+ if (pHdr->index != pWriter->index + 1) {
+ vError("vgId:%d, unexpected vnode snapshot msg. index:%" PRId64 ", expected index:%" PRId64, TD_VID(pVnode),
+ pHdr->index, pWriter->index + 1);
+ return -1;
+ }
+
pWriter->index = pHdr->index;
vDebug("vgId:%d, vnode snapshot write data, index:%" PRId64 " type:%d blockLen:%d", TD_VID(pVnode), pHdr->index,
diff --git a/source/dnode/vnode/src/vnd/vnodeSvr.c b/source/dnode/vnode/src/vnd/vnodeSvr.c
index 4cf6c4e55c7b8126cd4b999af58289625a9cad9b..500e174421eacba6fc3c9ea203b945afb809f571 100644
--- a/source/dnode/vnode/src/vnd/vnodeSvr.c
+++ b/source/dnode/vnode/src/vnd/vnodeSvr.c
@@ -312,10 +312,13 @@ int32_t vnodeProcessWriteMsg(SVnode *pVnode, SRpcMsg *pMsg, int64_t version, SRp
walApplyVer(pVnode->pWal, version);
+ /*vInfo("vgId:%d, push msg begin", pVnode->config.vgId);*/
if (tqPushMsg(pVnode->pTq, pMsg->pCont, pMsg->contLen, pMsg->msgType, version) < 0) {
+ /*vInfo("vgId:%d, push msg end", pVnode->config.vgId);*/
vError("vgId:%d, failed to push msg to TQ since %s", TD_VID(pVnode), tstrerror(terrno));
return -1;
}
+ /*vInfo("vgId:%d, push msg end", pVnode->config.vgId);*/
// commit if need
if (needCommit) {
@@ -348,7 +351,6 @@ int32_t vnodePreprocessQueryMsg(SVnode *pVnode, SRpcMsg *pMsg) {
int32_t vnodeProcessQueryMsg(SVnode *pVnode, SRpcMsg *pMsg) {
vTrace("message in vnode query queue is processing");
- // if ((pMsg->msgType == TDMT_SCH_QUERY) && !vnodeIsLeader(pVnode)) {
if ((pMsg->msgType == TDMT_SCH_QUERY) && !syncIsReadyForRead(pVnode->sync)) {
vnodeRedirectRpcMsg(pVnode, pMsg, terrno);
return 0;
@@ -372,7 +374,6 @@ int32_t vnodeProcessFetchMsg(SVnode *pVnode, SRpcMsg *pMsg, SQueueInfo *pInfo) {
if ((pMsg->msgType == TDMT_SCH_FETCH || pMsg->msgType == TDMT_VND_TABLE_META || pMsg->msgType == TDMT_VND_TABLE_CFG ||
pMsg->msgType == TDMT_VND_BATCH_META) &&
!syncIsReadyForRead(pVnode->sync)) {
- // !vnodeIsLeader(pVnode)) {
vnodeRedirectRpcMsg(pVnode, pMsg, terrno);
return 0;
}
@@ -1019,7 +1020,7 @@ _exit:
atomic_add_fetch_64(&pVnode->statis.nBatchInsert, statis.nBatchInsert);
atomic_add_fetch_64(&pVnode->statis.nBatchInsertSuccess, statis.nBatchInsertSuccess);
- vDebug("vgId:%d, submit success, index:%" PRId64, pVnode->config.vgId, version);
+ vDebug("vgId:%d %s done, index:%" PRId64, TD_VID(pVnode), __func__, version);
return 0;
}
@@ -1185,7 +1186,7 @@ static int32_t vnodeProcessBatchDeleteReq(SVnode *pVnode, int64_t version, void
tDecodeSBatchDeleteReq(&decoder, &deleteReq);
SMetaReader mr = {0};
- metaReaderInit(&mr, pVnode->pMeta, 0);
+ metaReaderInit(&mr, pVnode->pMeta, META_READER_NOLOCK);
int32_t sz = taosArrayGetSize(deleteReq.deleteReqs);
for (int32_t i = 0; i < sz; i++) {
diff --git a/source/dnode/vnode/test/tsdbSmaTest.cpp b/source/dnode/vnode/test/tsdbSmaTest.cpp
index be101059f26e8aabd451f39843ce45aecd960850..43eaacfff9b6a3afe82391b072ef3a22f50901fb 100644
--- a/source/dnode/vnode/test/tsdbSmaTest.cpp
+++ b/source/dnode/vnode/test/tsdbSmaTest.cpp
@@ -283,7 +283,7 @@ TEST(testCase, tSma_metaDB_Put_Get_Del_Test) {
metaRemoveSmaFromDb(pMeta, indexUid2);
tDestroyTSma(&tSma);
- metaClose(pMeta);
+ metaClose(&pMeta);
}
#endif
@@ -577,9 +577,9 @@ TEST(testCase, tSma_Data_Insert_Query_Test) {
tDestroyTSma(&tSma);
tfsClose(pTsdb->pTfs);
tsdbClose(pTsdb);
- metaClose(pMeta);
+ metaClose(&pMeta);
}
#endif
-#pragma GCC diagnostic pop
\ No newline at end of file
+#pragma GCC diagnostic pop
diff --git a/source/libs/catalog/inc/catalogInt.h b/source/libs/catalog/inc/catalogInt.h
index 30593fbaabb3ce6f76d12b0c0d2016ecf33c6f34..41c7eca7f09ad01c59f694c64f6b554f0a705157 100644
--- a/source/libs/catalog/inc/catalogInt.h
+++ b/source/libs/catalog/inc/catalogInt.h
@@ -300,7 +300,7 @@ typedef struct SCtgSubRes {
ctgSubTaskCbFp fp;
} SCtgSubRes;
-typedef struct SCtgTask {
+struct SCtgTask {
CTG_TASK_TYPE type;
int32_t taskId;
SCtgJob* pJob;
@@ -313,7 +313,7 @@ typedef struct SCtgTask {
SRWLatch lock;
SArray* pParents;
SCtgSubRes subRes;
-} SCtgTask;
+};
typedef struct SCtgTaskReq {
SCtgTask* pTask;
diff --git a/source/libs/catalog/src/ctgAsync.c b/source/libs/catalog/src/ctgAsync.c
index f84f8e2917e6190e592826bf5eb52bc38af3dd28..1276f2796f7eecf7f670292fbcc9bfa24de98e00 100644
--- a/source/libs/catalog/src/ctgAsync.c
+++ b/source/libs/catalog/src/ctgAsync.c
@@ -1712,9 +1712,7 @@ int32_t ctgLaunchGetTbMetasTask(SCtgTask* pTask) {
return TSDB_CODE_SUCCESS;
}
- pTask->msgCtxs = taosArrayInit(pCtx->fetchNum, sizeof(SCtgMsgCtx));
- taosArraySetSize(pTask->msgCtxs, pCtx->fetchNum);
-
+ pTask->msgCtxs = taosArrayInit_s(pCtx->fetchNum, sizeof(SCtgMsgCtx), pCtx->fetchNum);
for (int32_t i = 0; i < pCtx->fetchNum; ++i) {
SCtgFetch* pFetch = taosArrayGet(pCtx->pFetchs, i);
SName* pName = ctgGetFetchName(pCtx->pNames, pFetch);
@@ -1849,7 +1847,10 @@ int32_t ctgLaunchGetTbHashsTask(SCtgTask* pTask) {
ctgAddFetch(&pCtx->pFetchs, i, -1, &fetchIdx, baseResIdx, 0);
baseResIdx += taosArrayGetSize(pReq->pTables);
- taosArraySetSize(pCtx->pResList, baseResIdx);
+ int32_t inc = baseResIdx - taosArrayGetSize(pCtx->pResList);
+ for(int32_t j = 0; j < inc; ++j) {
+ taosArrayPush(pCtx->pResList, &(SMetaRes){0});
+ }
}
}
@@ -1861,8 +1862,7 @@ int32_t ctgLaunchGetTbHashsTask(SCtgTask* pTask) {
return TSDB_CODE_SUCCESS;
}
- pTask->msgCtxs = taosArrayInit(pCtx->fetchNum, sizeof(SCtgMsgCtx));
- taosArraySetSize(pTask->msgCtxs, pCtx->fetchNum);
+ pTask->msgCtxs = taosArrayInit_s(pCtx->fetchNum, sizeof(SCtgMsgCtx), pCtx->fetchNum);
for (int32_t i = 0; i < pCtx->fetchNum; ++i) {
SCtgFetch* pFetch = taosArrayGet(pCtx->pFetchs, i);
diff --git a/source/libs/catalog/src/ctgCache.c b/source/libs/catalog/src/ctgCache.c
index 6e4077eae05aa8cead28111f13f9600bb4e3244d..06db2c3268a298c71d33586eead38643cae40d58 100644
--- a/source/libs/catalog/src/ctgCache.c
+++ b/source/libs/catalog/src/ctgCache.c
@@ -2480,20 +2480,20 @@ int32_t ctgGetTbMetasFromCache(SCatalog *pCtg, SRequestConnInfo *pConn, SCtgTbMe
ctgDebug("db %s not in cache", dbFName);
for (int32_t i = 0; i < tbNum; ++i) {
ctgAddFetch(&ctx->pFetchs, dbIdx, i, fetchIdx, baseResIdx + i, flag);
- taosArraySetSize(ctx->pResList, taosArrayGetSize(ctx->pResList) + 1);
+ taosArrayPush(ctx->pResList, &(SMetaData){0});
}
return TSDB_CODE_SUCCESS;
}
for (int32_t i = 0; i < tbNum; ++i) {
- SName *pName = taosArrayGet(pList, i);
+ pName = taosArrayGet(pList, i);
pCache = taosHashAcquire(dbCache->tbCache, pName->tname, strlen(pName->tname));
if (NULL == pCache) {
ctgDebug("tb %s not in cache, dbFName:%s", pName->tname, dbFName);
ctgAddFetch(&ctx->pFetchs, dbIdx, i, fetchIdx, baseResIdx + i, flag);
- taosArraySetSize(ctx->pResList, taosArrayGetSize(ctx->pResList) + 1);
+ taosArrayPush(ctx->pResList, &(SMetaRes){0});
continue;
}
@@ -2503,7 +2503,7 @@ int32_t ctgGetTbMetasFromCache(SCatalog *pCtg, SRequestConnInfo *pConn, SCtgTbMe
CTG_UNLOCK(CTG_READ, &pCache->metaLock);
ctgDebug("tb %s meta not in cache, dbFName:%s", pName->tname, dbFName);
ctgAddFetch(&ctx->pFetchs, dbIdx, i, fetchIdx, baseResIdx + i, flag);
- taosArraySetSize(ctx->pResList, taosArrayGetSize(ctx->pResList) + 1);
+ taosArrayPush(ctx->pResList, &(SMetaRes){0});
continue;
}
@@ -2576,7 +2576,7 @@ int32_t ctgGetTbMetasFromCache(SCatalog *pCtg, SRequestConnInfo *pConn, SCtgTbMe
if (NULL == stName) {
ctgDebug("stb 0x%" PRIx64 " not in cache, dbFName:%s", pTableMeta->suid, dbFName);
ctgAddFetch(&ctx->pFetchs, dbIdx, i, fetchIdx, baseResIdx + i, flag);
- taosArraySetSize(ctx->pResList, taosArrayGetSize(ctx->pResList) + 1);
+ taosArrayPush(ctx->pResList, &(SMetaRes){0});
taosMemoryFreeClear(pTableMeta);
continue;
@@ -2588,7 +2588,7 @@ int32_t ctgGetTbMetasFromCache(SCatalog *pCtg, SRequestConnInfo *pConn, SCtgTbMe
taosHashRelease(dbCache->stbCache, stName);
ctgAddFetch(&ctx->pFetchs, dbIdx, i, fetchIdx, baseResIdx + i, flag);
- taosArraySetSize(ctx->pResList, taosArrayGetSize(ctx->pResList) + 1);
+ taosArrayPush(ctx->pResList, &(SMetaRes){0});
taosMemoryFreeClear(pTableMeta);
continue;
@@ -2603,7 +2603,7 @@ int32_t ctgGetTbMetasFromCache(SCatalog *pCtg, SRequestConnInfo *pConn, SCtgTbMe
taosHashRelease(dbCache->tbCache, pCache);
ctgAddFetch(&ctx->pFetchs, dbIdx, i, fetchIdx, baseResIdx + i, flag);
- taosArraySetSize(ctx->pResList, taosArrayGetSize(ctx->pResList) + 1);
+ taosArrayPush(ctx->pResList, &(SMetaRes){0});
taosMemoryFreeClear(pTableMeta);
@@ -2619,7 +2619,7 @@ int32_t ctgGetTbMetasFromCache(SCatalog *pCtg, SRequestConnInfo *pConn, SCtgTbMe
nctx.tbInfo.suid);
ctgAddFetch(&ctx->pFetchs, dbIdx, i, fetchIdx, baseResIdx + i, flag);
- taosArraySetSize(ctx->pResList, taosArrayGetSize(ctx->pResList) + 1);
+ taosArrayPush(ctx->pResList, &(SMetaRes){0});
taosMemoryFreeClear(pTableMeta);
diff --git a/source/libs/executor/inc/executil.h b/source/libs/executor/inc/executil.h
index e0d2276e6fceed6aa31bdf22cd551e73a58dc4dc..f99c7de93d95fa99de90a13eb2af8d527b876e0a 100644
--- a/source/libs/executor/inc/executil.h
+++ b/source/libs/executor/inc/executil.h
@@ -44,6 +44,8 @@
typedef struct SGroupResInfo {
int32_t index;
SArray* pRows; // SArray
+ char* pBuf;
+ bool freeItem;
} SGroupResInfo;
typedef struct SResultRow {
@@ -115,10 +117,6 @@ struct SResultRowEntryInfo* getResultEntryInfo(const SResultRow* pRow, int32_t i
static FORCE_INLINE SResultRow* getResultRowByPos(SDiskbasedBuf* pBuf, SResultRowPosition* pos, bool forUpdate) {
SFilePage* bufPage = (SFilePage*)getBufPage(pBuf, pos->pageId);
- if (NULL == bufPage) {
- return NULL;
- }
-
if (forUpdate) {
setBufPageDirty(bufPage, true);
}
diff --git a/source/libs/executor/inc/executorimpl.h b/source/libs/executor/inc/executorimpl.h
index 4ae178d508bc31c89a0defe027998d430ee5ba0e..999a7965fb69b44cf80740e229cc546a38a32af6 100644
--- a/source/libs/executor/inc/executorimpl.h
+++ b/source/libs/executor/inc/executorimpl.h
@@ -474,6 +474,8 @@ typedef struct SStreamScanInfo {
int32_t blockRecoverContiCnt;
int32_t blockRecoverTotCnt;
+ int8_t igCheckUpdate;
+ int8_t igExpired;
} SStreamScanInfo;
typedef struct {
diff --git a/source/libs/executor/src/cachescanoperator.c b/source/libs/executor/src/cachescanoperator.c
index 294424746aee7f02f30275c4bc7a6898c577d397..60e4e85fb8a79ae280875484a1875a6f77bddf36 100644
--- a/source/libs/executor/src/cachescanoperator.c
+++ b/source/libs/executor/src/cachescanoperator.c
@@ -149,6 +149,10 @@ SSDataBlock* doScanCache(SOperatorInfo* pOperator) {
// check if it is a group by tbname
if ((pInfo->retrieveType & CACHESCAN_RETRIEVE_TYPE_ALL) == CACHESCAN_RETRIEVE_TYPE_ALL) {
+ if (isTaskKilled(pTaskInfo)) {
+ T_LONG_JMP(pTaskInfo->env, pTaskInfo->code);
+ }
+
if (pInfo->indexOfBufferedRes >= pInfo->pBufferredRes->info.rows) {
blockDataCleanup(pInfo->pBufferredRes);
taosArrayClear(pInfo->pUidList);
@@ -207,6 +211,10 @@ SSDataBlock* doScanCache(SOperatorInfo* pOperator) {
size_t totalGroups = tableListGetOutputGroups(pTableList);
while (pInfo->currentGroupIndex < totalGroups) {
+ if (isTaskKilled(pTaskInfo)) {
+ T_LONG_JMP(pTaskInfo->env, pTaskInfo->code);
+ }
+
STableKeyInfo* pList = NULL;
int32_t num = 0;
@@ -215,8 +223,15 @@ SSDataBlock* doScanCache(SOperatorInfo* pOperator) {
T_LONG_JMP(pTaskInfo->env, code);
}
- tsdbCacherowsReaderOpen(pInfo->readHandle.vnode, pInfo->retrieveType, pList, num,
- taosArrayGetSize(pInfo->matchInfo.pList), suid, &pInfo->pLastrowReader, pTaskInfo->id.str);
+ code = tsdbCacherowsReaderOpen(pInfo->readHandle.vnode, pInfo->retrieveType, pList, num,
+ taosArrayGetSize(pInfo->matchInfo.pList), suid, &pInfo->pLastrowReader,
+ pTaskInfo->id.str);
+ if (code != TSDB_CODE_SUCCESS) {
+ pInfo->currentGroupIndex += 1;
+ taosArrayClear(pInfo->pUidList);
+ continue;
+ }
+
taosArrayClear(pInfo->pUidList);
code = tsdbRetrieveCacheRows(pInfo->pLastrowReader, pInfo->pRes, pInfo->pSlotIds, pInfo->pUidList);
diff --git a/source/libs/executor/src/dataDeleter.c b/source/libs/executor/src/dataDeleter.c
index a8051ea7c3eb294e7beb9ce6b5a23be601e635ef..2366d0c2f1bffd287f57414a9f484908c56b3113 100644
--- a/source/libs/executor/src/dataDeleter.c
+++ b/source/libs/executor/src/dataDeleter.c
@@ -62,9 +62,6 @@ static void toDataCacheEntry(SDataDeleterHandle* pHandle, const SInputData* pInp
pEntry->numOfCols = taosArrayGetSize(pInput->pData->pDataBlock);
pEntry->dataLen = sizeof(SDeleterRes);
-// ASSERT(1 == pEntry->numOfRows);
-// ASSERT(3 == pEntry->numOfCols);
-
pBuf->useSize = sizeof(SDataCacheEntry);
SColumnInfoData* pColRes = (SColumnInfoData*)taosArrayGet(pInput->pData->pDataBlock, 0);
diff --git a/source/libs/executor/src/executil.c b/source/libs/executor/src/executil.c
index 92d52fbb0a6bcf0d32cef634e41fc81973d99a60..de6cd1a2b335dc825688f42f7081b9d8ed30d68b 100644
--- a/source/libs/executor/src/executil.c
+++ b/source/libs/executor/src/executil.c
@@ -43,11 +43,12 @@ typedef struct tagFilterAssist {
SArray* cInfoList;
} tagFilterAssist;
-static int32_t removeInvalidTable(SArray* uids, SHashObj* tags);
-static int32_t optimizeTbnameInCond(void* metaHandle, int64_t suid, SArray* list, SNode* pTagCond, SHashObj* tags);
-static int32_t optimizeTbnameInCondImpl(void* metaHandle, int64_t suid, SArray* list, SNode* pTagCond);
+static int32_t removeInvalidUid(SArray* uids, SHashObj* tags);
+static int32_t optimizeTbnameInCond(void* metaHandle, int64_t suid, SArray* pRes, SNode* pTagCond);
+static int32_t optimizeTbnameInCondImpl(void* metaHandle, SArray* pExistedUidList, SNode* pTagCond);
static int32_t getTableList(void* metaHandle, void* pVnode, SScanPhysiNode* pScanNode, SNode* pTagCond,
- SNode* pTagIndexCond, STableListInfo* pListInfo);
+ SNode* pTagIndexCond, STableListInfo* pListInfo, const char* idstr);
+static SSDataBlock* createTagValBlockForFilter(SArray* pColList, int32_t numOfTables, SArray* pUidTagList, void* metaHandle);
static int64_t getLimit(const SNode* pLimit) { return NULL == pLimit ? -1 : ((SLimitNode*)pLimit)->limit; }
static int64_t getOffset(const SNode* pLimit) { return NULL == pLimit ? -1 : ((SLimitNode*)pLimit)->offset; }
@@ -88,15 +89,20 @@ size_t getResultRowSize(SqlFunctionCtx* pCtx, int32_t numOfOutput) {
return rowSize;
}
-void cleanupGroupResInfo(SGroupResInfo* pGroupResInfo) {
- assert(pGroupResInfo != NULL);
+static void freeEx(void* p) {
+ taosMemoryFree(*(void**)p);
+}
- for (int32_t i = 0; i < taosArrayGetSize(pGroupResInfo->pRows); ++i) {
- SResKeyPos* pRes = taosArrayGetP(pGroupResInfo->pRows, i);
- taosMemoryFree(pRes);
+void cleanupGroupResInfo(SGroupResInfo* pGroupResInfo) {
+ taosMemoryFreeClear(pGroupResInfo->pBuf);
+ if (pGroupResInfo->freeItem) {
+// taosArrayDestroy(pGroupResInfo->pRows);
+ taosArrayDestroyEx(pGroupResInfo->pRows, freeEx);
+ pGroupResInfo->freeItem = false;
+ pGroupResInfo->pRows = NULL;
+ } else {
+ pGroupResInfo->pRows = taosArrayDestroy(pGroupResInfo->pRows);
}
-
- pGroupResInfo->pRows = taosArrayDestroy(pGroupResInfo->pRows);
pGroupResInfo->index = 0;
}
@@ -126,31 +132,44 @@ void initGroupedResultInfo(SGroupResInfo* pGroupResInfo, SSHashObj* pHashmap, in
}
// extract the result rows information from the hash map
+ int32_t size = tSimpleHashGetSize(pHashmap);
+
void* pData = NULL;
- pGroupResInfo->pRows = taosArrayInit(10, POINTER_BYTES);
+ pGroupResInfo->pRows = taosArrayInit(size, POINTER_BYTES);
- // todo avoid repeated malloc memory
size_t keyLen = 0;
int32_t iter = 0;
+ int32_t bufLen = 0, offset = 0;
+
+ // todo move away and record this during create window
+ while ((pData = tSimpleHashIterate(pHashmap, pData, &iter)) != NULL) {
+ /*void* key = */tSimpleHashGetKey(pData, &keyLen);
+ bufLen += keyLen + sizeof(SResultRowPosition);
+ }
+
+ pGroupResInfo->pBuf = taosMemoryMalloc(bufLen);
+
+ iter = 0;
while ((pData = tSimpleHashIterate(pHashmap, pData, &iter)) != NULL) {
void* key = tSimpleHashGetKey(pData, &keyLen);
- SResKeyPos* p = taosMemoryMalloc(keyLen + sizeof(SResultRowPosition));
+ SResKeyPos* p = (SResKeyPos*) (pGroupResInfo->pBuf + offset);
p->groupId = *(uint64_t*)key;
p->pos = *(SResultRowPosition*)pData;
memcpy(p->key, (char*)key + sizeof(uint64_t), keyLen - sizeof(uint64_t));
taosArrayPush(pGroupResInfo->pRows, &p);
+
+ offset += keyLen + sizeof(struct SResultRowPosition);
}
if (order == TSDB_ORDER_ASC || order == TSDB_ORDER_DESC) {
__compar_fn_t fn = (order == TSDB_ORDER_ASC) ? resultrowComparAsc : resultrowComparDesc;
- int32_t size = POINTER_BYTES;
+ size = POINTER_BYTES;
taosSort(pGroupResInfo->pRows->pData, taosArrayGetSize(pGroupResInfo->pRows), size, fn);
}
pGroupResInfo->index = 0;
- assert(pGroupResInfo->index <= getNumOfTotalRes(pGroupResInfo));
}
void initMultiResInfoFromArrayList(SGroupResInfo* pGroupResInfo, SArray* pArrayList) {
@@ -158,6 +177,7 @@ void initMultiResInfoFromArrayList(SGroupResInfo* pGroupResInfo, SArray* pArrayL
taosArrayDestroyP(pGroupResInfo->pRows, taosMemoryFree);
}
+ pGroupResInfo->freeItem = true;
pGroupResInfo->pRows = pArrayList;
pGroupResInfo->index = 0;
ASSERT(pGroupResInfo->index <= getNumOfTotalRes(pGroupResInfo));
@@ -172,7 +192,6 @@ bool hasRemainResults(SGroupResInfo* pGroupResInfo) {
}
int32_t getNumOfTotalRes(SGroupResInfo* pGroupResInfo) {
- assert(pGroupResInfo != NULL);
if (pGroupResInfo->pRows == 0) {
return 0;
}
@@ -314,10 +333,7 @@ int32_t isQualifiedTable(STableKeyInfo* info, SNode* pTagCond, void* metaHandle,
return code;
}
- ASSERT(nodeType(pNew) == QUERY_NODE_VALUE);
SValueNode* pValue = (SValueNode*)pNew;
-
- ASSERT(pValue->node.resType.type == TSDB_DATA_TYPE_BOOL);
*pQualified = pValue->datum.b;
nodesDestroyNode(pNew);
@@ -392,150 +408,6 @@ static int32_t createResultData(SDataType* pType, int32_t numOfRows, SScalarPara
return TSDB_CODE_SUCCESS;
}
-static SColumnInfoData* getColInfoResult(void* metaHandle, int64_t suid, SArray* uidList, SNode* pTagCond) {
- int32_t code = TSDB_CODE_SUCCESS;
- SArray* pBlockList = NULL;
- SSDataBlock* pResBlock = NULL;
- SHashObj* tags = NULL;
- SScalarParam output = {0};
-
- tagFilterAssist ctx = {0};
-
- ctx.colHash = taosHashInit(4, taosGetDefaultHashFunction(TSDB_DATA_TYPE_SMALLINT), false, HASH_NO_LOCK);
- if (ctx.colHash == NULL) {
- terrno = TSDB_CODE_OUT_OF_MEMORY;
- goto end;
- }
-
- ctx.cInfoList = taosArrayInit(4, sizeof(SColumnInfo));
- if (ctx.cInfoList == NULL) {
- terrno = TSDB_CODE_OUT_OF_MEMORY;
- goto end;
- }
-
- nodesRewriteExprPostOrder(&pTagCond, getColumn, (void*)&ctx);
-
- pResBlock = createDataBlock();
- if (pResBlock == NULL) {
- terrno = TSDB_CODE_OUT_OF_MEMORY;
- goto end;
- }
-
- for (int32_t i = 0; i < taosArrayGetSize(ctx.cInfoList); ++i) {
- SColumnInfoData colInfo = {0};
- colInfo.info = *(SColumnInfo*)taosArrayGet(ctx.cInfoList, i);
- blockDataAppendColInfo(pResBlock, &colInfo);
- }
-
- // int64_t stt = taosGetTimestampUs();
- tags = taosHashInit(32, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), false, HASH_NO_LOCK);
-
- int32_t filter = optimizeTbnameInCond(metaHandle, suid, uidList, pTagCond, tags);
- if (filter == -1) {
- code = metaGetTableTags(metaHandle, suid, uidList, tags);
- if (code != TSDB_CODE_SUCCESS) {
- qError("failed to get table tags from meta, reason:%s, suid:%" PRIu64, tstrerror(code), suid);
- terrno = code;
- goto end;
- }
- }
- if (suid != 0) {
- removeInvalidTable(uidList, tags);
- }
-
- int32_t rows = taosArrayGetSize(uidList);
- if (rows == 0) {
- goto end;
- }
-
- code = blockDataEnsureCapacity(pResBlock, rows);
- if (code != TSDB_CODE_SUCCESS) {
- terrno = code;
- goto end;
- }
-
- for (int32_t i = 0; i < rows; i++) {
- int64_t* uid = taosArrayGet(uidList, i);
- for (int32_t j = 0; j < taosArrayGetSize(pResBlock->pDataBlock); j++) {
- SColumnInfoData* pColInfo = (SColumnInfoData*)taosArrayGet(pResBlock->pDataBlock, j);
-
- if (pColInfo->info.colId == -1) { // tbname
- char str[TSDB_TABLE_FNAME_LEN + VARSTR_HEADER_SIZE] = {0};
- metaGetTableNameByUid(metaHandle, *uid, str);
- colDataAppend(pColInfo, i, str, false);
-#if TAG_FILTER_DEBUG
- qDebug("tagfilter uid:%ld, tbname:%s", *uid, str + 2);
-#endif
- } else {
- void* tag = taosHashGet(tags, uid, sizeof(int64_t));
- if (tag == NULL) {
- continue;
- }
- STagVal tagVal = {0};
- tagVal.cid = pColInfo->info.colId;
- const char* p = metaGetTableTagVal(tag, pColInfo->info.type, &tagVal);
-
- if (p == NULL || (pColInfo->info.type == TSDB_DATA_TYPE_JSON && ((STag*)p)->nTag == 0)) {
- colDataAppend(pColInfo, i, p, true);
- } else if (pColInfo->info.type == TSDB_DATA_TYPE_JSON) {
- colDataAppend(pColInfo, i, p, false);
- } else if (IS_VAR_DATA_TYPE(pColInfo->info.type)) {
- char* tmp = taosMemoryCalloc(tagVal.nData + VARSTR_HEADER_SIZE + 1, 1);
- varDataSetLen(tmp, tagVal.nData);
- memcpy(tmp + VARSTR_HEADER_SIZE, tagVal.pData, tagVal.nData);
- colDataAppend(pColInfo, i, tmp, false);
-#if TAG_FILTER_DEBUG
- qDebug("tagfilter varch:%s", tmp + 2);
-#endif
- taosMemoryFree(tmp);
- } else {
- colDataAppend(pColInfo, i, (const char*)&tagVal.i64, false);
-#if TAG_FILTER_DEBUG
- if (pColInfo->info.type == TSDB_DATA_TYPE_INT) {
- qDebug("tagfilter int:%d", *(int*)(&tagVal.i64));
- } else if (pColInfo->info.type == TSDB_DATA_TYPE_DOUBLE) {
- qDebug("tagfilter double:%f", *(double*)(&tagVal.i64));
- }
-#endif
- }
- }
- }
- }
-
- pResBlock->info.rows = rows;
-
- // int64_t st1 = taosGetTimestampUs();
- // qDebug("generate tag block rows:%d, cost:%ld us", rows, st1-st);
-
- pBlockList = taosArrayInit(2, POINTER_BYTES);
- taosArrayPush(pBlockList, &pResBlock);
-
- SDataType type = {.type = TSDB_DATA_TYPE_BOOL, .bytes = sizeof(bool)};
- code = createResultData(&type, rows, &output);
- if (code != TSDB_CODE_SUCCESS) {
- terrno = code;
- qError("failed to create result, reason:%s", tstrerror(code));
- goto end;
- }
-
- code = scalarCalculate(pTagCond, pBlockList, &output);
- if (code != TSDB_CODE_SUCCESS) {
- qError("failed to calculate scalar, reason:%s", tstrerror(code));
- terrno = code;
- goto end;
- }
- // int64_t st2 = taosGetTimestampUs();
- // qDebug("calculate tag block rows:%d, cost:%ld us", rows, st2-st1);
-
-end:
- taosHashCleanup(tags);
- taosHashCleanup(ctx.colHash);
- taosArrayDestroy(ctx.cInfoList);
- blockDataDestroy(pResBlock);
- taosArrayDestroy(pBlockList);
- return output.columnData;
-}
-
static void releaseColInfoData(void* pCol) {
if (pCol) {
SColumnInfoData* col = (SColumnInfoData*)pCol;
@@ -544,12 +416,17 @@ static void releaseColInfoData(void* pCol) {
}
}
+void freeItem(void* p) {
+ STUidTagInfo *pInfo = p;
+ if (pInfo->pTagVal != NULL) {
+ taosMemoryFree(pInfo->pTagVal);
+ }
+}
+
int32_t getColInfoResultForGroupby(void* metaHandle, SNodeList* group, STableListInfo* pTableListInfo) {
int32_t code = TSDB_CODE_SUCCESS;
SArray* pBlockList = NULL;
SSDataBlock* pResBlock = NULL;
- SHashObj* tags = NULL;
- SArray* uidList = NULL;
void* keyBuf = NULL;
SArray* groupData = NULL;
@@ -578,89 +455,26 @@ int32_t getColInfoResultForGroupby(void* metaHandle, SNodeList* group, STableLis
REPLACE_NODE(pNode);
}
- pResBlock = createDataBlock();
- if (pResBlock == NULL) {
- code = TSDB_CODE_OUT_OF_MEMORY;
- goto end;
- }
-
- for (int32_t i = 0; i < taosArrayGetSize(ctx.cInfoList); ++i) {
- SColumnInfoData colInfo = {0};
- colInfo.info = *(SColumnInfo*)taosArrayGet(ctx.cInfoList, i);
- blockDataAppendColInfo(pResBlock, &colInfo);
- }
-
- uidList = taosArrayInit(rows, sizeof(uint64_t));
+ SArray* pUidTagList = taosArrayInit(8, sizeof(STUidTagInfo));
for (int32_t i = 0; i < rows; ++i) {
STableKeyInfo* pkeyInfo = taosArrayGet(pTableListInfo->pTableList, i);
- taosArrayPush(uidList, &pkeyInfo->uid);
+ STUidTagInfo info = {.uid = pkeyInfo->uid};
+ taosArrayPush(pUidTagList, &info);
}
// int64_t stt = taosGetTimestampUs();
- tags = taosHashInit(32, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), false, HASH_NO_LOCK);
- code = metaGetTableTags(metaHandle, pTableListInfo->suid, uidList, tags);
+ code = metaGetTableTags(metaHandle, pTableListInfo->suid, pUidTagList);
if (code != TSDB_CODE_SUCCESS) {
goto end;
}
- // int64_t stt1 = taosGetTimestampUs();
- // qDebug("generate tag meta rows:%d, cost:%ld us", rows, stt1-stt);
-
- code = blockDataEnsureCapacity(pResBlock, rows);
- if (code != TSDB_CODE_SUCCESS) {
+ int32_t numOfTables = taosArrayGetSize(pUidTagList);
+ pResBlock = createTagValBlockForFilter(ctx.cInfoList, numOfTables, pUidTagList, metaHandle);
+ if (pResBlock == NULL) {
+ code = terrno;
goto end;
}
- // int64_t st = taosGetTimestampUs();
- for (int32_t i = 0; i < rows; i++) {
- int64_t* uid = taosArrayGet(uidList, i);
- for (int32_t j = 0; j < taosArrayGetSize(pResBlock->pDataBlock); j++) {
- SColumnInfoData* pColInfo = (SColumnInfoData*)taosArrayGet(pResBlock->pDataBlock, j);
-
- if (pColInfo->info.colId == -1) { // tbname
- char str[TSDB_TABLE_FNAME_LEN + VARSTR_HEADER_SIZE] = {0};
- metaGetTableNameByUid(metaHandle, *uid, str);
- colDataAppend(pColInfo, i, str, false);
-#if TAG_FILTER_DEBUG
- qDebug("tagfilter uid:%ld, tbname:%s", *uid, str + 2);
-#endif
- } else {
- void* tag = taosHashGet(tags, uid, sizeof(int64_t));
- ASSERT(tag);
-
- STagVal tagVal = {0};
- tagVal.cid = pColInfo->info.colId;
- const char* p = metaGetTableTagVal(tag, pColInfo->info.type, &tagVal);
-
- if (p == NULL || (pColInfo->info.type == TSDB_DATA_TYPE_JSON && ((STag*)p)->nTag == 0)) {
- colDataAppend(pColInfo, i, p, true);
- } else if (pColInfo->info.type == TSDB_DATA_TYPE_JSON) {
- colDataAppend(pColInfo, i, p, false);
- } else if (IS_VAR_DATA_TYPE(pColInfo->info.type)) {
- char* tmp = taosMemoryCalloc(tagVal.nData + VARSTR_HEADER_SIZE + 1, 1);
- varDataSetLen(tmp, tagVal.nData);
- memcpy(tmp + VARSTR_HEADER_SIZE, tagVal.pData, tagVal.nData);
- colDataAppend(pColInfo, i, tmp, false);
-#if TAG_FILTER_DEBUG
- qDebug("tagfilter varch:%s", tmp + 2);
-#endif
- taosMemoryFree(tmp);
- } else {
- colDataAppend(pColInfo, i, (const char*)&tagVal.i64, false);
-#if TAG_FILTER_DEBUG
- if (pColInfo->info.type == TSDB_DATA_TYPE_INT) {
- qDebug("tagfilter int:%d", *(int*)(&tagVal.i64));
- } else if (pColInfo->info.type == TSDB_DATA_TYPE_DOUBLE) {
- qDebug("tagfilter double:%f", *(double*)(&tagVal.i64));
- }
-#endif
- }
- }
- }
- }
-
- pResBlock->info.rows = rows;
-
// int64_t st1 = taosGetTimestampUs();
// qDebug("generate tag block rows:%d, cost:%ld us", rows, st1-st);
@@ -768,12 +582,11 @@ int32_t getColInfoResultForGroupby(void* metaHandle, SNodeList* group, STableLis
end:
taosMemoryFreeClear(keyBuf);
- taosHashCleanup(tags);
taosHashCleanup(ctx.colHash);
taosArrayDestroy(ctx.cInfoList);
blockDataDestroy(pResBlock);
taosArrayDestroy(pBlockList);
- taosArrayDestroy(uidList);
+ taosArrayDestroyEx(pUidTagList, freeItem);
taosArrayDestroyP(groupData, releaseColInfoData);
return code;
}
@@ -842,17 +655,26 @@ static int tableUidCompare(const void* a, const void* b) {
return u1 < u2 ? -1 : 1;
}
-static int32_t optimizeTbnameInCond(void* metaHandle, int64_t suid, SArray* list, SNode* cond, SHashObj* tags) {
+static int32_t filterTableInfoCompare(const void* a, const void* b) {
+ STUidTagInfo* p1 = (STUidTagInfo*) a;
+ STUidTagInfo* p2 = (STUidTagInfo*) b;
+
+ if (p1->uid == p2->uid) {
+ return 0;
+ }
+
+ return p1->uid < p2->uid? -1:1;
+}
+
+static int32_t optimizeTbnameInCond(void* metaHandle, int64_t suid, SArray* pRes, SNode* cond) {
int32_t ret = -1;
- if (nodeType(cond) == QUERY_NODE_OPERATOR) {
- ret = optimizeTbnameInCondImpl(metaHandle, suid, list, cond);
- if (ret != -1) {
- metaGetTableTagsByUids(metaHandle, suid, list, tags);
- removeInvalidTable(list, tags);
- }
+ int32_t ntype = nodeType(cond);
+
+ if (ntype == QUERY_NODE_OPERATOR) {
+ ret = optimizeTbnameInCondImpl(metaHandle, pRes, cond);
}
- if (nodeType(cond) != QUERY_NODE_LOGIC_CONDITION || ((SLogicConditionNode*)cond)->condType != LOGIC_COND_TYPE_AND) {
+ if (ntype != QUERY_NODE_LOGIC_CONDITION || ((SLogicConditionNode*)cond)->condType != LOGIC_COND_TYPE_AND) {
return ret;
}
@@ -868,36 +690,40 @@ static int32_t optimizeTbnameInCond(void* metaHandle, int64_t suid, SArray* list
SListCell* cell = pList->pHead;
for (int i = 0; i < len; i++) {
if (cell == NULL) break;
- if (optimizeTbnameInCondImpl(metaHandle, suid, list, cell->pNode) == 0) {
+ if (optimizeTbnameInCondImpl(metaHandle, pRes, cell->pNode) == 0) {
hasTbnameCond = true;
break;
}
cell = cell->pNext;
}
- taosArraySort(list, tableUidCompare);
- taosArrayRemoveDuplicate(list, tableUidCompare, NULL);
+ taosArraySort(pRes, filterTableInfoCompare);
+ taosArrayRemoveDuplicate(pRes, filterTableInfoCompare, NULL);
if (hasTbnameCond) {
- ret = metaGetTableTagsByUids(metaHandle, suid, list, tags);
- removeInvalidTable(list, tags);
+ ret = metaGetTableTagsByUids(metaHandle, suid, pRes);
+// removeInvalidUid(pRes, tags);
}
return ret;
}
+#if 0
/*
* handle invalid uid
*/
-static int32_t removeInvalidTable(SArray* uids, SHashObj* tags) {
- if (taosArrayGetSize(uids) <= 0) return 0;
+static int32_t removeInvalidUid(SArray* uids, SHashObj* tags) {
+ int32_t size = taosArrayGetSize(uids);
+ if (size <= 0) {
+ return 0;
+ }
- SArray* validUid = taosArrayInit(taosArrayGetSize(uids), sizeof(int64_t));
+ SArray* validUid = taosArrayInit(size, sizeof(STUidTagInfo));
- for (int32_t i = 0; i < taosArrayGetSize(uids); i++) {
- int64_t* uid = taosArrayGet(uids, i);
- if (taosHashGet(tags, uid, sizeof(int64_t)) != NULL) {
- taosArrayPush(validUid, uid);
+ for (int32_t i = 0; i < size; i++) {
+ STUidTagInfo* p = taosArrayGet(uids, i);
+ if (taosHashGet(tags, &p->uid, sizeof(int64_t)) != NULL) {
+ taosArrayPush(validUid, p);
}
}
@@ -906,7 +732,10 @@ static int32_t removeInvalidTable(SArray* uids, SHashObj* tags) {
return 0;
}
-static int32_t optimizeTbnameInCondImpl(void* metaHandle, int64_t suid, SArray* list, SNode* pTagCond) {
+#endif
+
+// only return uid that does not contained in pExistedUidList
+static int32_t optimizeTbnameInCondImpl(void* metaHandle, SArray* pExistedUidList, SNode* pTagCond) {
if (nodeType(pTagCond) != QUERY_NODE_OPERATOR) {
return -1;
}
@@ -929,12 +758,13 @@ static int32_t optimizeTbnameInCondImpl(void* metaHandle, int64_t suid, SArray*
SArray* pTbList = getTableNameList(pList);
int32_t numOfTables = taosArrayGetSize(pTbList);
SHashObj* uHash = NULL;
- size_t listlen = taosArrayGetSize(list); // len > 0 means there already have uids
- if (listlen > 0) {
- uHash = taosHashInit(32, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), false, HASH_NO_LOCK);
- for (int i = 0; i < listlen; i++) {
- int64_t* uid = taosArrayGet(list, i);
- taosHashPut(uHash, uid, sizeof(int64_t), &i, sizeof(i));
+
+ size_t numOfExisted = taosArrayGetSize(pExistedUidList); // len > 0 means there already have uids
+ if (numOfExisted > 0) {
+ uHash = taosHashInit(numOfExisted / 0.7, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), false, HASH_NO_LOCK);
+ for (int i = 0; i < numOfExisted; i++) {
+ STUidTagInfo* pTInfo = taosArrayGet(pExistedUidList, i);
+ taosHashPut(uHash, &pTInfo->uid, sizeof(uint64_t), &i, sizeof(i));
}
}
@@ -946,7 +776,8 @@ static int32_t optimizeTbnameInCondImpl(void* metaHandle, int64_t suid, SArray*
ETableType tbType = TSDB_TABLE_MAX;
if (metaGetTableTypeByName(metaHandle, name, &tbType) == 0 && tbType == TSDB_CHILD_TABLE) {
if (NULL == uHash || taosHashGet(uHash, &uid, sizeof(uid)) == NULL) {
- taosArrayPush(list, &uid);
+ STUidTagInfo s = {.uid = uid, .name = name, .pTagVal = NULL};
+ taosArrayPush(pExistedUidList, &s);
}
} else {
taosArrayDestroy(pTbList);
@@ -983,129 +814,297 @@ static void genTagFilterDigest(const SNode* pTagCond, T_MD5_CTX* pContext) {
taosMemoryFree(payload);
}
-static int32_t doFilterByTagCond(STableListInfo* pListInfo, SArray* res, SNode* pTagCond, void* metaHandle) {
+static SSDataBlock* createTagValBlockForFilter(SArray* pColList, int32_t numOfTables, SArray* pUidTagList, void* metaHandle) {
+ SSDataBlock* pResBlock = createDataBlock();
+ if (pResBlock == NULL) {
+ terrno = TSDB_CODE_OUT_OF_MEMORY;
+ return NULL;
+ }
+
+ for (int32_t i = 0; i < taosArrayGetSize(pColList); ++i) {
+ SColumnInfoData colInfo = {0};
+ colInfo.info = *(SColumnInfo*)taosArrayGet(pColList, i);
+ blockDataAppendColInfo(pResBlock, &colInfo);
+ }
+
+ int32_t code = blockDataEnsureCapacity(pResBlock, numOfTables);
+ if (code != TSDB_CODE_SUCCESS) {
+ terrno = code;
+ return NULL;
+ }
+
+ pResBlock->info.rows = numOfTables;
+
+ int32_t numOfCols = taosArrayGetSize(pResBlock->pDataBlock);
+
+ for (int32_t i = 0; i < numOfTables; i++) {
+ STUidTagInfo* p1 = taosArrayGet(pUidTagList, i);
+
+ for (int32_t j = 0; j < numOfCols; j++) {
+ SColumnInfoData* pColInfo = (SColumnInfoData*)taosArrayGet(pResBlock->pDataBlock, j);
+
+ if (pColInfo->info.colId == -1) { // tbname
+ char str[TSDB_TABLE_FNAME_LEN + VARSTR_HEADER_SIZE] = {0};
+ if (p1->name != NULL) {
+ STR_TO_VARSTR(str, p1->name);
+ } else { // name is not retrieved during filter
+ metaGetTableNameByUid(metaHandle, p1->uid, str);
+ }
+
+ colDataAppend(pColInfo, i, str, false);
+#if TAG_FILTER_DEBUG
+ qDebug("tagfilter uid:%ld, tbname:%s", *uid, str + 2);
+#endif
+ } else {
+ STagVal tagVal = {0};
+ tagVal.cid = pColInfo->info.colId;
+ if (p1->pTagVal == NULL) {
+ colDataAppendNULL(pColInfo, i);
+ }
+
+ const char* p = metaGetTableTagVal(p1->pTagVal, pColInfo->info.type, &tagVal);
+
+ if (p == NULL || (pColInfo->info.type == TSDB_DATA_TYPE_JSON && ((STag*)p)->nTag == 0)) {
+ colDataAppendNULL(pColInfo, i);
+ } else if (pColInfo->info.type == TSDB_DATA_TYPE_JSON) {
+ colDataAppend(pColInfo, i, p, false);
+ } else if (IS_VAR_DATA_TYPE(pColInfo->info.type)) {
+ char* tmp = alloca(tagVal.nData + VARSTR_HEADER_SIZE + 1);
+ varDataSetLen(tmp, tagVal.nData);
+ memcpy(tmp + VARSTR_HEADER_SIZE, tagVal.pData, tagVal.nData);
+ colDataAppend(pColInfo, i, tmp, false);
+#if TAG_FILTER_DEBUG
+ qDebug("tagfilter varch:%s", tmp + 2);
+#endif
+ } else {
+ colDataAppend(pColInfo, i, (const char*)&tagVal.i64, false);
+#if TAG_FILTER_DEBUG
+ if (pColInfo->info.type == TSDB_DATA_TYPE_INT) {
+ qDebug("tagfilter int:%d", *(int*)(&tagVal.i64));
+ } else if (pColInfo->info.type == TSDB_DATA_TYPE_DOUBLE) {
+ qDebug("tagfilter double:%f", *(double*)(&tagVal.i64));
+ }
+#endif
+ }
+ }
+ }
+ }
+
+ return pResBlock;
+}
+
+static void doSetQualifiedUid(SArray* pUidList, const SArray* pUidTagList, bool* pResultList) {
+ taosArrayClear(pUidList);
+
+ int32_t numOfTables = taosArrayGetSize(pUidTagList);
+ for(int32_t i = 0; i < numOfTables; ++i) {
+ uint64_t uid = ((STUidTagInfo*)taosArrayGet(pUidTagList, i))->uid;
+ qDebug("tagfilter get uid:%" PRId64 ", res:%d", uid, pResultList[i]);
+
+ if (pResultList[i]) {
+ taosArrayPush(pUidList, &uid);
+ }
+ }
+}
+
+static void copyExistedUids(SArray* pUidTagList, const SArray* pUidList) {
+ int32_t numOfExisted = taosArrayGetSize(pUidList);
+ if (numOfExisted == 0) {
+ return;
+ }
+
+ for(int32_t i = 0; i < numOfExisted; ++i) {
+ uint64_t* uid = taosArrayGet(pUidList, i);
+ STUidTagInfo info = {.uid = *uid};
+ taosArrayPush(pUidTagList, &info);
+ }
+}
+
+static int32_t doFilterByTagCond(STableListInfo* pListInfo, SArray* pUidList, SNode* pTagCond, void* metaHandle) {
if (pTagCond == NULL) {
return TSDB_CODE_SUCCESS;
}
terrno = TDB_CODE_SUCCESS;
- SColumnInfoData* pColInfoData = getColInfoResult(metaHandle, pListInfo->suid, res, pTagCond);
- if (terrno != TDB_CODE_SUCCESS) {
- colDataDestroy(pColInfoData);
- taosMemoryFreeClear(pColInfoData);
- taosArrayDestroy(res);
- qError("failed to getColInfoResult, code: %s", tstrerror(terrno));
- return terrno;
+
+ int32_t code = TSDB_CODE_SUCCESS;
+ SArray* pBlockList = NULL;
+ SSDataBlock* pResBlock = NULL;
+ SScalarParam output = {0};
+
+ tagFilterAssist ctx = {0};
+ ctx.colHash = taosHashInit(4, taosGetDefaultHashFunction(TSDB_DATA_TYPE_SMALLINT), false, HASH_NO_LOCK);
+ if (ctx.colHash == NULL) {
+ terrno = TSDB_CODE_OUT_OF_MEMORY;
+ goto end;
}
- int32_t i = 0;
- int32_t len = taosArrayGetSize(res);
+ ctx.cInfoList = taosArrayInit(4, sizeof(SColumnInfo));
+ if (ctx.cInfoList == NULL) {
+ terrno = TSDB_CODE_OUT_OF_MEMORY;
+ goto end;
+ }
- if (pColInfoData != NULL) {
- bool* pResult = (bool*)pColInfoData->pData;
- SArray* p = taosArrayInit(taosArrayGetSize(res), sizeof(uint64_t));
+ nodesRewriteExprPostOrder(&pTagCond, getColumn, (void*)&ctx);
- while (i < len && pColInfoData) {
- int64_t* uid = taosArrayGet(res, i);
- qDebug("tagfilter get uid:%" PRId64 ", res:%d", *uid, pResult[i]);
+ SDataType type = {.type = TSDB_DATA_TYPE_BOOL, .bytes = sizeof(bool)};
- if (pResult[i]) {
- taosArrayPush(p, uid);
- }
- i += 1;
+ // int64_t stt = taosGetTimestampUs();
+ SArray* pUidTagList = taosArrayInit(10, sizeof(STUidTagInfo));
+ copyExistedUids(pUidTagList, pUidList);
+
+ int32_t filter = optimizeTbnameInCond(metaHandle, pListInfo->suid, pUidTagList, pTagCond);
+ if (filter == 0) { // tbname in filter is activated, do nothing and return
+ taosArrayClear(pUidList);
+
+ int32_t numOfRows = taosArrayGetSize(pUidTagList);
+ taosArrayEnsureCap(pUidList, numOfRows);
+ for(int32_t i = 0; i < numOfRows; ++i) {
+ STUidTagInfo* pInfo = taosArrayGet(pUidTagList, i);
+ taosArrayPush(pUidList, &pInfo->uid);
}
- taosArraySwap(res, p);
- taosArrayDestroy(p);
+ terrno = 0;
+ goto end;
+ } else {
+ // here we retrieve all tags from the vnode table-meta store
+ code = metaGetTableTags(metaHandle, pListInfo->suid, pUidTagList);
+ if (code != TSDB_CODE_SUCCESS) {
+ qError("failed to get table tags from meta, reason:%s, suid:%" PRIu64, tstrerror(code), pListInfo->suid);
+ terrno = code;
+ goto end;
+ }
}
- colDataDestroy(pColInfoData);
- taosMemoryFreeClear(pColInfoData);
+ int32_t numOfTables = taosArrayGetSize(pUidTagList);
+ if (numOfTables == 0) {
+ goto end;
+ }
- return TSDB_CODE_SUCCESS;
+ pResBlock = createTagValBlockForFilter(ctx.cInfoList, numOfTables, pUidTagList, metaHandle);
+ if (pResBlock == NULL) {
+ code = terrno;
+ goto end;
+ }
+
+ // int64_t st1 = taosGetTimestampUs();
+ // qDebug("generate tag block rows:%d, cost:%ld us", rows, st1-st);
+ pBlockList = taosArrayInit(2, POINTER_BYTES);
+ taosArrayPush(pBlockList, &pResBlock);
+
+ code = createResultData(&type, numOfTables, &output);
+ if (code != TSDB_CODE_SUCCESS) {
+ terrno = code;
+ goto end;
+ }
+
+ code = scalarCalculate(pTagCond, pBlockList, &output);
+ if (code != TSDB_CODE_SUCCESS) {
+ qError("failed to calculate scalar, reason:%s", tstrerror(code));
+ terrno = code;
+ goto end;
+ }
+
+ doSetQualifiedUid(pUidList, pUidTagList, (bool*) output.columnData->pData);
+
+ end:
+ taosHashCleanup(ctx.colHash);
+ taosArrayDestroy(ctx.cInfoList);
+ blockDataDestroy(pResBlock);
+ taosArrayDestroy(pBlockList);
+ taosArrayDestroyEx(pUidTagList, freeItem);
+
+ colDataDestroy(output.columnData);
+ taosMemoryFreeClear(output.columnData);
+ return code;
}
int32_t getTableList(void* metaHandle, void* pVnode, SScanPhysiNode* pScanNode, SNode* pTagCond, SNode* pTagIndexCond,
- STableListInfo* pListInfo) {
+ STableListInfo* pListInfo, const char* idstr) {
int32_t code = TSDB_CODE_SUCCESS;
size_t numOfTables = 0;
- uint64_t tableUid = pScanNode->uid;
pListInfo->suid = pScanNode->suid;
- SArray* res = taosArrayInit(8, sizeof(uint64_t));
+ SArray* pUidList = taosArrayInit(8, sizeof(uint64_t));
if (pScanNode->tableType != TSDB_SUPER_TABLE) {
- if (metaIsTableExist(metaHandle, tableUid)) {
- taosArrayPush(res, &tableUid);
+ if (metaIsTableExist(metaHandle, pScanNode->uid)) {
+ taosArrayPush(pUidList, &pScanNode->uid);
}
- code = doFilterByTagCond(pListInfo, res, pTagCond, metaHandle);
+ code = doFilterByTagCond(pListInfo, pUidList, pTagCond, metaHandle);
if (code != TSDB_CODE_SUCCESS) {
- return code;
+ goto _end;
}
} else {
- // try to retrieve the result from meta cache
T_MD5_CTX context = {0};
- genTagFilterDigest(pTagCond, &context);
- bool acquired = false;
- metaGetCachedTableUidList(metaHandle, pScanNode->suid, context.digest, tListLen(context.digest), res, &acquired);
- if (acquired) {
- qDebug("retrieve table uid list from cache, numOfTables:%d", (int32_t)taosArrayGetSize(res));
- goto _end;
+ if (tsTagFilterCache) {
+ // try to retrieve the result from meta cache
+ genTagFilterDigest(pTagCond, &context);
+
+ bool acquired = false;
+ metaGetCachedTableUidList(metaHandle, pScanNode->suid, context.digest, tListLen(context.digest), pUidList, &acquired);
+ if (acquired) {
+ qDebug("retrieve table uid list from cache, numOfTables:%d", (int32_t)taosArrayGetSize(pUidList));
+ goto _end;
+ }
}
- if (!pTagCond) { // no tag condition exists, let's fetch all tables of this super table
- ASSERT(pTagIndexCond == NULL);
- vnodeGetCtbIdList(pVnode, pScanNode->suid, res);
+ if (!pTagCond) { // no tag filter condition exists, let's fetch all tables of this super table
+ vnodeGetCtbIdList(pVnode, pScanNode->suid, pUidList);
} else {
// failed to find the result in the cache, let try to calculate the results
if (pTagIndexCond) {
+ void* pIndex = tsdbGetIvtIdx(metaHandle);
SIndexMetaArg metaArg = {
- .metaEx = metaHandle, .idx = tsdbGetIdx(metaHandle), .ivtIdx = tsdbGetIvtIdx(metaHandle), .suid = tableUid};
+ .metaEx = metaHandle, .idx = tsdbGetIdx(metaHandle), .ivtIdx = pIndex, .suid = pScanNode->uid};
SIdxFltStatus status = SFLT_NOT_INDEX;
- code = doFilterTag(pTagIndexCond, &metaArg, res, &status);
- if (code != 0 || status == SFLT_NOT_INDEX) {
- qError("failed to get tableIds from index, reason:%s, suid:%" PRIu64, tstrerror(code), tableUid);
+ code = doFilterTag(pTagIndexCond, &metaArg, pUidList, &status);
+ if (code != 0 || status == SFLT_NOT_INDEX) { // temporarily disable it for performance sake
+// qError("failed to get tableIds from index, reason:%s, suid:%" PRIu64, tstrerror(code), tableUid);
code = TDB_CODE_SUCCESS;
}
}
}
- code = doFilterByTagCond(pListInfo, res, pTagCond, metaHandle);
+ code = doFilterByTagCond(pListInfo, pUidList, pTagCond, metaHandle);
if (code != TSDB_CODE_SUCCESS) {
- return code;
+ goto _end;
}
// let's add the filter results into meta-cache
- numOfTables = taosArrayGetSize(res);
- size_t size = numOfTables * sizeof(uint64_t) + sizeof(int32_t);
- char* pPayload = taosMemoryMalloc(size);
- *(int32_t*)pPayload = numOfTables;
+ numOfTables = taosArrayGetSize(pUidList);
- if (numOfTables > 0) {
- memcpy(pPayload + sizeof(int32_t), taosArrayGet(res, 0), numOfTables * sizeof(uint64_t));
- }
+ if (tsTagFilterCache) {
+ size_t size = numOfTables * sizeof(uint64_t) + sizeof(int32_t);
+ char* pPayload = taosMemoryMalloc(size);
+
+ *(int32_t*)pPayload = numOfTables;
+ if (numOfTables > 0) {
+ memcpy(pPayload + sizeof(int32_t), taosArrayGet(pUidList, 0), numOfTables * sizeof(uint64_t));
+ }
- metaUidFilterCachePut(metaHandle, pScanNode->suid, context.digest, tListLen(context.digest), pPayload, size, 1);
+ metaUidFilterCachePut(metaHandle, pScanNode->suid, context.digest, tListLen(context.digest), pPayload, size, 1);
+ }
}
_end:
- numOfTables = taosArrayGetSize(res);
+ numOfTables = taosArrayGetSize(pUidList);
for (int i = 0; i < numOfTables; i++) {
- STableKeyInfo info = {.uid = *(uint64_t*)taosArrayGet(res, i), .groupId = 0};
+ STableKeyInfo info = {.uid = *(uint64_t*)taosArrayGet(pUidList, i), .groupId = 0};
void* p = taosArrayPush(pListInfo->pTableList, &info);
if (p == NULL) {
- taosArrayDestroy(res);
+ taosArrayDestroy(pUidList);
return TSDB_CODE_OUT_OF_MEMORY;
}
- qTrace("tagfilter get uid:%" PRIu64 "", info.uid);
+ qTrace("tagfilter get uid:%" PRIu64", %s", info.uid, idstr);
}
- taosArrayDestroy(res);
+ taosArrayDestroy(pUidList);
return code;
}
@@ -1144,7 +1143,6 @@ int32_t getGroupIdFromTagsVal(void* pMeta, uint64_t uid, SNodeList* pGroupNode,
if (TSDB_CODE_SUCCESS == code) {
REPLACE_NODE(pNew);
} else {
- taosMemoryFree(keyBuf);
nodesDestroyList(groupNew);
metaReaderClear(&mr);
return code;
@@ -1162,7 +1160,6 @@ int32_t getGroupIdFromTagsVal(void* pMeta, uint64_t uid, SNodeList* pGroupNode,
if (pValue->node.resType.type == TSDB_DATA_TYPE_JSON) {
if (tTagIsJson(data)) {
terrno = TSDB_CODE_QRY_JSON_IN_GROUP_ERROR;
- taosMemoryFree(keyBuf);
nodesDestroyList(groupNew);
metaReaderClear(&mr);
return terrno;
@@ -1364,7 +1361,6 @@ void createExprFromOneNode(SExprInfo* pExp, SNode* pNode, int16_t slotId) {
if (!pFuncNode->pParameterList && (memcmp(pExprNode->_function.functionName, name, len) == 0) &&
pExprNode->_function.functionName[len] == 0) {
pFuncNode->pParameterList = nodesMakeList();
- ASSERT(LIST_LENGTH(pFuncNode->pParameterList) == 0);
SValueNode* res = (SValueNode*)nodesMakeNode(QUERY_NODE_VALUE);
if (NULL == res) { // todo handle error
} else {
@@ -1506,6 +1502,8 @@ SqlFunctionCtx* createSqlFunctionCtx(SExprInfo* pExprInfo, int32_t numOfOutput,
if (pExpr->pExpr->nodeType == QUERY_NODE_FUNCTION) {
SFuncExecEnv env = {0};
pCtx->functionId = pExpr->pExpr->_function.pFunctNode->funcId;
+ pCtx->isPseudoFunc = fmIsWindowPseudoColumnFunc(pCtx->functionId);
+ pCtx->isNotNullFunc = fmIsNotNullOutputFunc(pCtx->functionId);
if (fmIsAggFunc(pCtx->functionId) || fmIsIndefiniteRowsFunc(pCtx->functionId)) {
bool isUdaf = fmIsUserDefinedFunc(pCtx->functionId);
@@ -1513,7 +1511,7 @@ SqlFunctionCtx* createSqlFunctionCtx(SExprInfo* pExprInfo, int32_t numOfOutput,
fmGetFuncExecFuncs(pCtx->functionId, &pCtx->fpSet);
} else {
char* udfName = pExpr->pExpr->_function.pFunctNode->functionName;
- tstrncpy(pCtx->udfName, udfName, TSDB_FUNC_NAME_LEN);
+ pCtx->udfName = strdup(udfName);
fmGetUdafExecFuncs(pCtx->functionId, &pCtx->fpSet);
}
pCtx->fpSet.getEnv(pExpr->pExpr->_function.pFunctNode, &env);
@@ -1658,12 +1656,18 @@ int32_t convertFillType(int32_t mode) {
case FILL_MODE_NULL:
type = TSDB_FILL_NULL;
break;
+ case FILL_MODE_NULL_F:
+ type = TSDB_FILL_NULL_F;
+ break;
case FILL_MODE_NEXT:
type = TSDB_FILL_NEXT;
break;
case FILL_MODE_VALUE:
type = TSDB_FILL_SET_VALUE;
break;
+ case FILL_MODE_VALUE_F:
+ type = TSDB_FILL_SET_VALUE_F;
+ break;
case FILL_MODE_LINEAR:
type = TSDB_FILL_LINEAR;
break;
@@ -1684,7 +1688,7 @@ static void getInitialStartTimeWindow(SInterval* pInterval, TSKEY ts, STimeWindo
int64_t key = w->skey;
while (key < ts) { // moving towards end
key = taosTimeAdd(key, pInterval->sliding, pInterval->slidingUnit, pInterval->precision);
- if (key >= ts) {
+ if (key > ts) {
break;
}
@@ -1796,7 +1800,6 @@ uint64_t getTableGroupId(const STableListInfo* pTableList, uint64_t tableUid) {
// TODO handle the group offset info, fix it, the rule of group output will be broken by this function
int32_t tableListAddTableInfo(STableListInfo* pTableList, uint64_t uid, uint64_t gid) {
if (pTableList->map == NULL) {
- ASSERT(taosArrayGetSize(pTableList->pTableList) == 0);
pTableList->map = taosHashInit(32, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), false, HASH_ENTRY_LOCK);
}
@@ -1812,28 +1815,30 @@ int32_t tableListAddTableInfo(STableListInfo* pTableList, uint64_t uid, uint64_t
int32_t tableListGetGroupList(const STableListInfo* pTableList, int32_t ordinalGroupIndex, STableKeyInfo** pKeyInfo,
int32_t* size) {
- int32_t total = tableListGetOutputGroups(pTableList);
- if (ordinalGroupIndex < 0 || ordinalGroupIndex >= total) {
+ int32_t totalGroups = tableListGetOutputGroups(pTableList);
+ int32_t numOfTables = tableListGetSize(pTableList);
+
+ if (ordinalGroupIndex < 0 || ordinalGroupIndex >= totalGroups) {
return TSDB_CODE_INVALID_PARA;
}
// here handle two special cases:
// 1. only one group exists, and 2. one table exists for each group.
- if (total == 1) {
- *size = tableListGetSize(pTableList);
+ if (totalGroups == 1) {
+ *size = numOfTables;
*pKeyInfo = (*size == 0) ? NULL : taosArrayGet(pTableList->pTableList, 0);
return TSDB_CODE_SUCCESS;
- } else if (total == tableListGetSize(pTableList)) {
+ } else if (totalGroups == numOfTables) {
*size = 1;
*pKeyInfo = taosArrayGet(pTableList->pTableList, ordinalGroupIndex);
return TSDB_CODE_SUCCESS;
}
int32_t offset = pTableList->groupOffset[ordinalGroupIndex];
- if (ordinalGroupIndex < total - 1) {
- *size = pTableList->groupOffset[offset + 1] - pTableList->groupOffset[offset];
+ if (ordinalGroupIndex < totalGroups - 1) {
+ *size = pTableList->groupOffset[ordinalGroupIndex + 1] - offset;
} else {
- *size = total - pTableList->groupOffset[offset] - 1;
+ *size = numOfTables - offset;
}
*pKeyInfo = taosArrayGet(pTableList->pTableList, offset);
@@ -1944,7 +1949,6 @@ static int32_t sortTableGroup(STableListInfo* pTableListInfo) {
int32_t buildGroupIdMapForAllTables(STableListInfo* pTableListInfo, SReadHandle* pHandle, SNodeList* group,
bool groupSort) {
int32_t code = TSDB_CODE_SUCCESS;
- ASSERT(pTableListInfo->map != NULL);
bool groupByTbname = groupbyTbname(group);
size_t numOfTables = taosArrayGetSize(pTableListInfo->pTableList);
@@ -1994,14 +1998,13 @@ int32_t createScanTableListInfo(SScanPhysiNode* pScanNode, SNodeList* pGroupTags
return TSDB_CODE_INVALID_PARA;
}
- int32_t code = getTableList(pHandle->meta, pHandle->vnode, pScanNode, pTagCond, pTagIndexCond, pTableListInfo);
+ int32_t code = getTableList(pHandle->meta, pHandle->vnode, pScanNode, pTagCond, pTagIndexCond, pTableListInfo, idStr);
if (code != TSDB_CODE_SUCCESS) {
qError("failed to getTableList, code: %s", tstrerror(code));
return code;
}
int32_t numOfTables = taosArrayGetSize(pTableListInfo->pTableList);
- ASSERT(pTableListInfo->numOfOuputGroups == 1);
int64_t st1 = taosGetTimestampUs();
pTaskInfo->cost.extractListTime = (st1 - st) / 1000.0;
diff --git a/source/libs/executor/src/executor.c b/source/libs/executor/src/executor.c
index 6c354c3d6161aa0ec8fe63b4d99edabbf75030d5..8f8b32ff07f83f92475d72712dfe7b015a72b6a7 100644
--- a/source/libs/executor/src/executor.c
+++ b/source/libs/executor/src/executor.c
@@ -35,7 +35,6 @@ static void initRefPool() {
}
static int32_t doSetSMABlock(SOperatorInfo* pOperator, void* input, size_t numOfBlocks, int32_t type, char* id) {
- ASSERT(pOperator != NULL);
if (pOperator->operatorType != QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN) {
if (pOperator->numOfDownstream == 0) {
qError("failed to find stream scan operator to set the input data block, %s" PRIx64, id);
@@ -75,27 +74,23 @@ static int32_t doSetSMABlock(SOperatorInfo* pOperator, void* input, size_t numOf
}
static int32_t doSetStreamOpOpen(SOperatorInfo* pOperator, char* id) {
- {
- ASSERT(pOperator != NULL);
- if (pOperator->operatorType != QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN) {
- if (pOperator->numOfDownstream == 0) {
- qError("failed to find stream scan operator to set the input data block, %s" PRIx64, id);
- return TSDB_CODE_APP_ERROR;
- }
+ if (pOperator->operatorType != QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN) {
+ if (pOperator->numOfDownstream == 0) {
+ qError("failed to find stream scan operator to set the input data block, %s" PRIx64, id);
+ return TSDB_CODE_APP_ERROR;
+ }
- if (pOperator->numOfDownstream > 1) { // not handle this in join query
- qError("join not supported for stream block scan, %s" PRIx64, id);
- return TSDB_CODE_APP_ERROR;
- }
- pOperator->status = OP_NOT_OPENED;
- return doSetStreamOpOpen(pOperator->pDownstream[0], id);
+ if (pOperator->numOfDownstream > 1) { // not handle this in join query
+ qError("join not supported for stream block scan, %s" PRIx64, id);
+ return TSDB_CODE_APP_ERROR;
}
+ pOperator->status = OP_NOT_OPENED;
+ return doSetStreamOpOpen(pOperator->pDownstream[0], id);
}
return 0;
}
static int32_t doSetStreamBlock(SOperatorInfo* pOperator, void* input, size_t numOfBlocks, int32_t type, char* id) {
- ASSERT(pOperator != NULL);
if (pOperator->operatorType != QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN) {
if (pOperator->numOfDownstream == 0) {
qError("failed to find stream scan operator to set the input data block, %s" PRIx64, id);
@@ -353,7 +348,6 @@ int32_t qUpdateQualifiedTableId(qTaskInfo_t tinfo, const SArray* tableIdList, bo
return code;
}
- // todo refactor STableList
bool assignUid = false;
size_t bufLen = (pScanInfo->pGroupTags != NULL) ? getTableTagsBufLen(pScanInfo->pGroupTags) : 0;
char* keyBuf = NULL;
diff --git a/source/libs/executor/src/executorimpl.c b/source/libs/executor/src/executorimpl.c
index 448e2b0a9164dad96e71e69160f5a73a9d031904..35c884c1a17ea09715494210b8275b2b0d10aecc 100644
--- a/source/libs/executor/src/executorimpl.c
+++ b/source/libs/executor/src/executorimpl.c
@@ -176,10 +176,12 @@ SResultRow* getNewResultRow(SDiskbasedBuf* pResultBuf, int32_t* currentPageId, i
// set the number of rows in current disk page
SResultRow* pResultRow = (SResultRow*)((char*)pData + pData->num);
+
+ memset((char*) pResultRow, 0, interBufSize);
pResultRow->pageId = pageId;
pResultRow->offset = (int32_t)pData->num;
- *currentPageId = pageId;
+ *currentPageId = pageId;
pData->num += interBufSize;
return pResultRow;
}
@@ -238,7 +240,6 @@ SResultRow* doSetResultOutBufByKey(SDiskbasedBuf* pResultBuf, SResultRowInfo* pR
// allocate a new buffer page
if (pResult == NULL) {
- ASSERT(pSup->resultRowSize > 0);
pResult = getNewResultRow(pResultBuf, &pSup->currentPageId, pSup->resultRowSize);
if (pResult == NULL) {
T_LONG_JMP(pTaskInfo->env, terrno);
@@ -308,7 +309,6 @@ static int32_t addNewWindowResultBuf(SResultRow* pWindowRes, SDiskbasedBuf* pRes
pWindowRes->offset = (int32_t)pData->num;
pData->num += size;
- assert(pWindowRes->pageId >= 0);
}
return 0;
@@ -363,7 +363,7 @@ void applyAggFunctionOnPartialTuples(SExecTaskInfo* taskInfo, SqlFunctionCtx* pC
pCtx[k].input.colDataSMAIsSet = false;
}
- if (fmIsWindowPseudoColumnFunc(pCtx[k].functionId)) {
+ if (pCtx[k].isPseudoFunc) {
SResultRowEntryInfo* pEntryInfo = GET_RES_INFO(&pCtx[k]);
char* p = GET_ROWCELL_INTERBUF(pEntryInfo);
@@ -486,7 +486,6 @@ static int32_t doSetInputDataBlock(SExprSupp* pExprSup, SSDataBlock* pBlock, int
// todo: refactor this
if (fmIsImplicitTsFunc(pCtx[i].functionId) && (j == pOneExpr->base.numOfParams - 1)) {
pInput->pPTS = pInput->pData[j]; // in case of merge function, this is not always the ts column data.
- // ASSERT(pInput->pPTS->info.type == TSDB_DATA_TYPE_TIMESTAMP);
}
ASSERT(pInput->pData[j] != NULL);
} else if (pFuncParam->type == FUNC_PARAM_TYPE_VALUE) {
@@ -817,7 +816,7 @@ void setResultRowInitCtx(SResultRow* pResult, SqlFunctionCtx* pCtx, int32_t numO
continue;
}
- if (fmIsWindowPseudoColumnFunc(pCtx[i].functionId)) {
+ if (pCtx[i].isPseudoFunc) {
continue;
}
@@ -1022,8 +1021,6 @@ void doSetTableGroupOutputBuf(SOperatorInfo* pOperator, int32_t numOfOutput, uin
SResultRow* pResultRow = doSetResultOutBufByKey(pAggInfo->aggSup.pResultBuf, pResultRowInfo, (char*)&groupId,
sizeof(groupId), true, groupId, pTaskInfo, false, &pAggInfo->aggSup);
- assert(pResultRow != NULL);
-
/*
* not assign result buffer yet, add new result buffer
* all group belong to one result set, and each group result has different group id so set the id to be one
@@ -1063,7 +1060,7 @@ static void doUpdateNumOfRows(SqlFunctionCtx* pCtx, SResultRow* pRow, int32_t nu
pRow->numOfRows = pResInfo->numOfRes;
}
- if (fmIsNotNullOutputFunc(pCtx[j].functionId)) {
+ if (pCtx[j].isNotNullFunc) {
returnNotNull = true;
}
}
@@ -1187,9 +1184,15 @@ int32_t doCopyToSDataBlock(SExecTaskInfo* pTaskInfo, SSDataBlock* pBlock, SExprS
}
if (pBlock->info.rows + pRow->numOfRows > pBlock->info.capacity) {
- ASSERT(pBlock->info.rows > 0);
releaseBufPage(pBuf, page);
- break;
+
+ if (pBlock->info.rows <= 0 || pRow->numOfRows > pBlock->info.capacity) {
+ qError("error in copy data to ssdatablock, existed rows in block:%d, rows in pRow:%d, capacity:%d, %s",
+ pBlock->info.rows, pRow->numOfRows, pBlock->info.capacity, GET_TASKID(pTaskInfo));
+ T_LONG_JMP(pTaskInfo->env, TSDB_CODE_APP_ERROR);
+ } else {
+ break;
+ }
}
pGroupResInfo->index += 1;
@@ -1271,7 +1274,6 @@ void doBuildResultDatablock(SOperatorInfo* pOperator, SOptrBasicInfo* pbInfo, SG
// STaskAttr *pQueryAttr = pRuntimeEnv->pQueryAttr;
// SResultRowInfo *pWindowResInfo = &pRuntimeEnv->resultRowInfo;
//
-// assert(pQueryAttr->limit.offset == 0);
// STimeWindow tw = *win;
// getNextTimeWindow(pQueryAttr, &tw);
//
@@ -1286,7 +1288,6 @@ void doBuildResultDatablock(SOperatorInfo* pOperator, SOptrBasicInfo* pbInfo, SG
// tw = *win;
// int32_t startPos =
// getNextQualifiedWindow(pQueryAttr, &tw, pBlockInfo, pColInfoData->pData, binarySearchForKey, -1);
-// assert(startPos >= 0);
//
// // set the abort info
// pQueryAttr->pos = startPos;
@@ -1321,11 +1322,6 @@ void doBuildResultDatablock(SOperatorInfo* pOperator, SOptrBasicInfo* pbInfo, SG
// static bool skipTimeInterval(STaskRuntimeEnv *pRuntimeEnv, TSKEY* start) {
// STaskAttr *pQueryAttr = pRuntimeEnv->pQueryAttr;
-// if (QUERY_IS_ASC_QUERY(pQueryAttr)) {
-// assert(*start <= pRuntimeEnv->current->lastKey);
-// } else {
-// assert(*start >= pRuntimeEnv->current->lastKey);
-// }
//
// // if queried with value filter, do NOT forward query start position
// if (pQueryAttr->limit.offset <= 0 || pQueryAttr->numOfFilterCols > 0 || pRuntimeEnv->pTsBuf != NULL ||
@@ -1339,8 +1335,6 @@ void doBuildResultDatablock(SOperatorInfo* pOperator, SOptrBasicInfo* pbInfo, SG
// value is
// * not valid. otherwise, we only forward pQueryAttr->limit.offset number of points
// */
-// assert(pRuntimeEnv->resultRowInfo.prevSKey == TSKEY_INITIAL_VAL);
-//
// STimeWindow w = TSWINDOW_INITIALIZER;
// bool ascQuery = QUERY_IS_ASC_QUERY(pQueryAttr);
//
@@ -1410,8 +1404,6 @@ void doBuildResultDatablock(SOperatorInfo* pOperator, SOptrBasicInfo* pbInfo, SG
// tw = win;
// int32_t startPos =
// getNextQualifiedWindow(pQueryAttr, &tw, &blockInfo, pColInfoData->pData, binarySearchForKey, -1);
-// assert(startPos >= 0);
-//
// // set the abort info
// pQueryAttr->pos = startPos;
// pTableQueryInfo->lastKey = ((TSKEY *)pColInfoData->pData)[startPos];
@@ -1433,10 +1425,6 @@ void doBuildResultDatablock(SOperatorInfo* pOperator, SOptrBasicInfo* pbInfo, SG
// }
int32_t appendDownstream(SOperatorInfo* p, SOperatorInfo** pDownstream, int32_t num) {
- if (p->pDownstream == NULL) {
- assert(p->numOfDownstream == 0);
- }
-
p->pDownstream = taosMemoryCalloc(1, num * POINTER_BYTES);
if (p->pDownstream == NULL) {
return TSDB_CODE_OUT_OF_MEMORY;
@@ -1730,12 +1718,12 @@ int32_t getBufferPgSize(int32_t rowSize, uint32_t* defaultPgsz, uint32_t* defaul
int32_t doInitAggInfoSup(SAggSupporter* pAggSup, SqlFunctionCtx* pCtx, int32_t numOfOutput, size_t keyBufSize,
const char* pKey) {
int32_t code = 0;
- _hash_fn_t hashFn = taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY);
+// _hash_fn_t hashFn = taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY);
pAggSup->currentPageId = -1;
pAggSup->resultRowSize = getResultRowSize(pCtx, numOfOutput);
pAggSup->keyBuf = taosMemoryCalloc(1, keyBufSize + POINTER_BYTES + sizeof(int64_t));
- pAggSup->pResultRowHashTable = tSimpleHashInit(100, hashFn);
+ pAggSup->pResultRowHashTable = tSimpleHashInit(100, taosFastHash);
if (pAggSup->keyBuf == NULL || pAggSup->pResultRowHashTable == NULL) {
return TSDB_CODE_OUT_OF_MEMORY;
@@ -1792,7 +1780,10 @@ int32_t initAggSup(SExprSupp* pSup, SAggSupporter* pAggSup, SExprInfo* pExprInfo
}
void initResultSizeInfo(SResultInfo* pResultInfo, int32_t numOfRows) {
- ASSERT(numOfRows != 0);
+ if (numOfRows == 0) {
+ numOfRows = 4096;
+ }
+
pResultInfo->capacity = numOfRows;
pResultInfo->threshold = numOfRows * 0.75;
@@ -1820,6 +1811,10 @@ void* destroySqlFunctionCtx(SqlFunctionCtx* pCtx, int32_t numOfOutput) {
taosMemoryFreeClear(pCtx[i].subsidiaries.buf);
taosMemoryFree(pCtx[i].input.pData);
taosMemoryFree(pCtx[i].input.pColumnDataAgg);
+
+ if (pCtx[i].udfName != NULL) {
+ taosMemoryFree(pCtx[i].udfName);
+ }
}
taosMemoryFreeClear(pCtx);
@@ -1929,7 +1924,6 @@ _error:
}
void cleanupBasicInfo(SOptrBasicInfo* pInfo) {
- assert(pInfo != NULL);
pInfo->pRes = blockDataDestroy(pInfo->pRes);
}
@@ -1950,6 +1944,22 @@ void destroyAggOperatorInfo(void* param) {
taosMemoryFreeClear(param);
}
+static char* buildTaskId(uint64_t taskId, uint64_t queryId) {
+ char* p = taosMemoryMalloc(64);
+
+ int32_t offset = 6;
+ memcpy(p, "TID:0x", offset);
+ offset += tintToHex(taskId, &p[offset]);
+
+ memcpy(&p[offset], " QID:0x", 7);
+ offset += 7;
+ offset += tintToHex(queryId, &p[offset]);
+
+ p[offset] = 0;
+
+ return p;
+}
+
static SExecTaskInfo* createExecTaskInfo(uint64_t queryId, uint64_t taskId, EOPTR_EXEC_MODEL model, char* dbFName) {
SExecTaskInfo* pTaskInfo = taosMemoryCalloc(1, sizeof(SExecTaskInfo));
if (pTaskInfo == NULL) {
@@ -1960,16 +1970,13 @@ static SExecTaskInfo* createExecTaskInfo(uint64_t queryId, uint64_t taskId, EOPT
setTaskStatus(pTaskInfo, TASK_NOT_COMPLETED);
pTaskInfo->schemaInfo.dbname = strdup(dbFName);
- pTaskInfo->id.queryId = queryId;
pTaskInfo->execModel = model;
pTaskInfo->pTableInfoList = tableListCreate();
pTaskInfo->stopInfo.pStopInfo = taosArrayInit(4, sizeof(SExchangeOpStopInfo));
pTaskInfo->pResultBlockList = taosArrayInit(128, POINTER_BYTES);
- char* p = taosMemoryCalloc(1, 128);
- snprintf(p, 128, "TID:0x%" PRIx64 " QID:0x%" PRIx64, taskId, queryId);
- pTaskInfo->id.str = p;
-
+ pTaskInfo->id.queryId = queryId;
+ pTaskInfo->id.str = buildTaskId(taskId, queryId);
return pTaskInfo;
}
@@ -1997,7 +2004,12 @@ int32_t extractTableSchemaInfo(SReadHandle* pHandle, SScanPhysiNode* pScanNode,
tDecoderClear(&mr.coder);
tb_uid_t suid = mr.me.ctbEntry.suid;
- metaGetTableEntryByUidCache(&mr, suid);
+ code = metaGetTableEntryByUidCache(&mr, suid);
+ if (code != TSDB_CODE_SUCCESS) {
+ metaReaderClear(&mr);
+ return terrno;
+ }
+
pSchemaInfo->sw = tCloneSSchemaWrapper(&mr.me.stbEntry.schemaRow);
pSchemaInfo->tversion = mr.me.stbEntry.schemaTag.version;
} else {
@@ -2223,7 +2235,8 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo
} else if (QUERY_NODE_PHYSICAL_PLAN_PROJECT == type) {
pOperator = createProjectOperatorInfo(NULL, (SProjectPhysiNode*)pPhyNode, pTaskInfo);
} else {
- ASSERT(0);
+ terrno = TSDB_CODE_INVALID_PARA;
+ return NULL;
}
if (pOperator != NULL) {
@@ -2315,7 +2328,8 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo
} else if (QUERY_NODE_PHYSICAL_PLAN_INTERP_FUNC == type) {
pOptr = createTimeSliceOperatorInfo(ops[0], pPhyNode, pTaskInfo);
} else {
- ASSERT(0);
+ terrno = TSDB_CODE_INVALID_PARA;
+ return NULL;
}
taosMemoryFree(ops);
@@ -2553,7 +2567,6 @@ int32_t setOutputBuf(SStreamState* pState, STimeWindow* win, SResultRow** pResul
return TSDB_CODE_OUT_OF_MEMORY;
}
*pResult = (SResultRow*)value;
- ASSERT(*pResult);
// set time window for current result
(*pResult)->win = (*win);
setResultRowInitCtx(*pResult, pCtx, numOfOutput, rowEntryInfoOffset);
diff --git a/source/libs/executor/src/filloperator.c b/source/libs/executor/src/filloperator.c
index 187c8f582afc56e2b8eb9293fd44bafd307a6151..f7de84d085c7215c7d0ae545220c8ea835618310 100644
--- a/source/libs/executor/src/filloperator.c
+++ b/source/libs/executor/src/filloperator.c
@@ -140,7 +140,7 @@ static SSDataBlock* doFillImpl(SOperatorInfo* pOperator) {
while (1) {
SSDataBlock* pBlock = pDownstream->fpSet.getNextFn(pDownstream);
if (pBlock == NULL) {
- if (pInfo->totalInputRows == 0) {
+ if (pInfo->totalInputRows == 0 && (pInfo->pFillInfo->type != TSDB_FILL_NULL_F && pInfo->pFillInfo->type != TSDB_FILL_SET_VALUE_F)) {
setOperatorCompleted(pOperator);
return NULL;
}
@@ -193,8 +193,6 @@ static SSDataBlock* doFillImpl(SOperatorInfo* pOperator) {
return pResBlock;
}
} else if (pInfo->existNewGroupBlock) { // try next group
- assert(pBlock != NULL);
-
blockDataCleanup(pResBlock);
doHandleRemainBlockForNewGroupImpl(pOperator, pInfo, pResultInfo, pTaskInfo);
@@ -456,7 +454,8 @@ void* destroyStreamFillLinearInfo(SStreamFillLinearInfo* pFillLinear) {
return NULL;
}
void* destroyStreamFillInfo(SStreamFillInfo* pFillInfo) {
- if (pFillInfo->type == TSDB_FILL_SET_VALUE || pFillInfo->type == TSDB_FILL_NULL) {
+ if (pFillInfo->type == TSDB_FILL_SET_VALUE || pFillInfo->type == TSDB_FILL_SET_VALUE_F ||
+ pFillInfo->type == TSDB_FILL_NULL || pFillInfo->type == TSDB_FILL_NULL_F) {
taosMemoryFreeClear(pFillInfo->pResRow->pRowVal);
taosMemoryFreeClear(pFillInfo->pResRow);
}
@@ -661,7 +660,9 @@ void setDeleteFillValueInfo(TSKEY start, TSKEY end, SStreamFillSupporter* pFillS
pFillInfo->pos = FILL_POS_INVALID;
switch (pFillInfo->type) {
case TSDB_FILL_NULL:
+ case TSDB_FILL_NULL_F:
case TSDB_FILL_SET_VALUE:
+ case TSDB_FILL_SET_VALUE_F:
break;
case TSDB_FILL_PREV:
pFillInfo->pResRow = &pFillSup->prev;
@@ -720,7 +721,9 @@ void setFillValueInfo(SSDataBlock* pBlock, TSKEY ts, int32_t rowId, SStreamFillS
pFillInfo->pos = FILL_POS_INVALID;
switch (pFillInfo->type) {
case TSDB_FILL_NULL:
- case TSDB_FILL_SET_VALUE: {
+ case TSDB_FILL_NULL_F:
+ case TSDB_FILL_SET_VALUE:
+ case TSDB_FILL_SET_VALUE_F: {
if (pFillSup->prev.key == pFillInfo->preRowKey) {
resetFillWindow(&pFillSup->prev);
}
@@ -827,10 +830,13 @@ static bool checkResult(SStreamFillSupporter* pFillSup, TSKEY ts, uint64_t group
return true;
}
-static void buildFillResult(SResultRowData* pResRow, SStreamFillSupporter* pFillSup, TSKEY ts, SSDataBlock* pBlock) {
+static bool buildFillResult(SResultRowData* pResRow, SStreamFillSupporter* pFillSup, TSKEY ts, SSDataBlock* pBlock) {
+ if (pBlock->info.rows >= pBlock->info.capacity) {
+ return false;
+ }
uint64_t groupId = pBlock->info.id.groupId;
if (pFillSup->hasDelete && !checkResult(pFillSup, ts, groupId)) {
- return;
+ return true;
}
for (int32_t i = 0; i < pFillSup->numOfAllCols; ++i) {
SFillColInfo* pFillCol = pFillSup->pAllColInfo + i;
@@ -848,6 +854,7 @@ static void buildFillResult(SResultRowData* pResRow, SStreamFillSupporter* pFill
}
}
pBlock->info.rows++;
+ return true;
}
static bool hasRemainCalc(SStreamFillInfo* pFillInfo) {
@@ -927,7 +934,9 @@ static void doStreamFillRange(SStreamFillInfo* pFillInfo, SStreamFillSupporter*
}
if (pFillInfo->pos == FILL_POS_START) {
- buildFillResult(&pFillSup->cur, pFillSup, pFillSup->cur.key, pRes);
+ if (buildFillResult(&pFillSup->cur, pFillSup, pFillSup->cur.key, pRes)) {
+ pFillInfo->pos = FILL_POS_INVALID;
+ }
}
if (pFillInfo->type != TSDB_FILL_LINEAR) {
doStreamFillNormal(pFillSup, pFillInfo, pRes);
@@ -935,7 +944,9 @@ static void doStreamFillRange(SStreamFillInfo* pFillInfo, SStreamFillSupporter*
doStreamFillLinear(pFillSup, pFillInfo, pRes);
if (pFillInfo->pos == FILL_POS_MID) {
- buildFillResult(&pFillSup->cur, pFillSup, pFillSup->cur.key, pRes);
+ if (buildFillResult(&pFillSup->cur, pFillSup, pFillSup->cur.key, pRes)) {
+ pFillInfo->pos = FILL_POS_INVALID;
+ }
}
if (pFillInfo->current > pFillInfo->end && pFillInfo->pLinearInfo->hasNext) {
@@ -949,7 +960,9 @@ static void doStreamFillRange(SStreamFillInfo* pFillInfo, SStreamFillSupporter*
}
}
if (pFillInfo->pos == FILL_POS_END) {
- buildFillResult(&pFillSup->cur, pFillSup, pFillSup->cur.key, pRes);
+ if (buildFillResult(&pFillSup->cur, pFillSup, pFillSup->cur.key, pRes)) {
+ pFillInfo->pos = FILL_POS_INVALID;
+ }
}
}
@@ -984,10 +997,6 @@ static void doStreamFillImpl(SOperatorInfo* pOperator) {
uint64_t groupId = pBlock->info.id.groupId;
SSDataBlock* pRes = pInfo->pRes;
pRes->info.id.groupId = groupId;
- if (hasRemainCalc(pFillInfo)) {
- doStreamFillRange(pFillInfo, pFillSup, pRes);
- }
-
SColumnInfoData* pTsCol = taosArrayGet(pInfo->pSrcBlock->pDataBlock, pInfo->primaryTsCol);
TSKEY* tsCol = (TSKEY*)pTsCol->pData;
@@ -1199,13 +1208,14 @@ static SSDataBlock* doStreamFill(SOperatorInfo* pOperator) {
return NULL;
}
blockDataCleanup(pInfo->pRes);
- if (pOperator->status == OP_RES_TO_RETURN) {
- if (hasRemainCalc(pInfo->pFillInfo)) {
- doStreamFillRange(pInfo->pFillInfo, pInfo->pFillSup, pInfo->pRes);
- if (pInfo->pRes->info.rows > 0) {
- return pInfo->pRes;
- }
+ if (hasRemainCalc(pInfo->pFillInfo) || (pInfo->pFillInfo->pos != FILL_POS_INVALID && pInfo->pFillInfo->needFill == true )) {
+ doStreamFillRange(pInfo->pFillInfo, pInfo->pFillSup, pInfo->pRes);
+ if (pInfo->pRes->info.rows > 0) {
+ printDataBlock(pInfo->pRes, "stream fill");
+ return pInfo->pRes;
}
+ }
+ if (pOperator->status == OP_RES_TO_RETURN) {
doDeleteFillFinalize(pOperator);
if (pInfo->pRes->info.rows > 0) {
printDataBlock(pInfo->pRes, "stream fill");
@@ -1360,7 +1370,8 @@ SStreamFillInfo* initStreamFillInfo(SStreamFillSupporter* pFillSup, SSDataBlock*
pFillInfo->pLinearInfo->winIndex = 0;
pFillInfo->pResRow = NULL;
- if (pFillSup->type == TSDB_FILL_SET_VALUE || pFillSup->type == TSDB_FILL_NULL) {
+ if (pFillSup->type == TSDB_FILL_SET_VALUE || pFillSup->type == TSDB_FILL_SET_VALUE_F
+ || pFillSup->type == TSDB_FILL_NULL || pFillSup->type == TSDB_FILL_NULL_F) {
pFillInfo->pResRow = taosMemoryCalloc(1, sizeof(SResultRowData));
pFillInfo->pResRow->key = INT64_MIN;
pFillInfo->pResRow->pRowVal = taosMemoryCalloc(1, pFillSup->rowSize);
@@ -1405,7 +1416,7 @@ SOperatorInfo* createStreamFillOperatorInfo(SOperatorInfo* downstream, SStreamFi
goto _error;
}
- if (pInfo->pFillInfo->type == TSDB_FILL_SET_VALUE) {
+ if (pInfo->pFillInfo->type == TSDB_FILL_SET_VALUE || pInfo->pFillInfo->type == TSDB_FILL_SET_VALUE_F) {
for (int32_t i = 0; i < pInfo->pFillSup->numOfAllCols; ++i) {
SFillColInfo* pFillCol = pInfo->pFillSup->pAllColInfo + i;
int32_t slotId = GET_DEST_SLOT_ID(pFillCol);
@@ -1427,7 +1438,7 @@ SOperatorInfo* createStreamFillOperatorInfo(SOperatorInfo* downstream, SStreamFi
pCell->isNull = true;
}
}
- } else if (pInfo->pFillInfo->type == TSDB_FILL_NULL) {
+ } else if (pInfo->pFillInfo->type == TSDB_FILL_NULL || pInfo->pFillInfo->type == TSDB_FILL_NULL_F) {
for (int32_t i = 0; i < pInfo->pFillSup->numOfAllCols; ++i) {
SFillColInfo* pFillCol = pInfo->pFillSup->pAllColInfo + i;
int32_t slotId = GET_DEST_SLOT_ID(pFillCol);
diff --git a/source/libs/executor/src/groupoperator.c b/source/libs/executor/src/groupoperator.c
index bf4b9a2599ca6db1e5d1a2e9daeadd9169856e35..4e17e1a3f28d1cc7726a5f0715e558580a999142 100644
--- a/source/libs/executor/src/groupoperator.c
+++ b/source/libs/executor/src/groupoperator.c
@@ -204,7 +204,6 @@ static void recordNewGroupKeys(SArray* pGroupCols, SArray* pGroupColVals, SSData
}
static int32_t buildGroupKeys(void* pKey, const SArray* pGroupColVals) {
- ASSERT(pKey != NULL);
size_t numOfGroupCols = taosArrayGetSize(pGroupColVals);
char* isNull = (char*)pKey;
@@ -492,8 +491,8 @@ _error:
static void doHashPartition(SOperatorInfo* pOperator, SSDataBlock* pBlock) {
SPartitionOperatorInfo* pInfo = pOperator->info;
- SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo;
-
+ SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo;
+
for (int32_t j = 0; j < pBlock->info.rows; ++j) {
recordNewGroupKeys(pInfo->pGroupCols, pInfo->pGroupColVals, pBlock, j);
int32_t len = buildGroupKeys(pInfo->keyBuf, pInfo->pGroupColVals);
@@ -570,7 +569,6 @@ static void doHashPartition(SOperatorInfo* pOperator, SSDataBlock* pBlock) {
}
(*columnLen) += contentLen;
- ASSERT(*columnLen >= 0);
}
(*rows) += 1;
@@ -681,7 +679,6 @@ static int compareDataGroupInfo(const void* group1, const void* group2) {
const SDataGroupInfo* pGroupInfo2 = group2;
if (pGroupInfo1->groupId == pGroupInfo2->groupId) {
- ASSERT(0);
return 0;
}
@@ -690,8 +687,8 @@ static int compareDataGroupInfo(const void* group1, const void* group2) {
static SSDataBlock* buildPartitionResult(SOperatorInfo* pOperator) {
SPartitionOperatorInfo* pInfo = pOperator->info;
- SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo;
-
+ SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo;
+
SDataGroupInfo* pGroupInfo =
(pInfo->groupIndex != -1) ? taosArrayGet(pInfo->sortedGroupArray, pInfo->groupIndex) : NULL;
if (pInfo->groupIndex == -1 || pInfo->pageIndex >= taosArrayGetSize(pGroupInfo->pPageList)) {
@@ -713,7 +710,7 @@ static SSDataBlock* buildPartitionResult(SOperatorInfo* pOperator) {
qError("failed to get buffer, code:%s, %s", tstrerror(terrno), GET_TASKID(pTaskInfo));
T_LONG_JMP(pTaskInfo->env, terrno);
}
-
+
blockDataEnsureCapacity(pInfo->binfo.pRes, pInfo->rowCapacity);
blockDataFromBuf1(pInfo->binfo.pRes, page, pInfo->rowCapacity);
@@ -829,6 +826,8 @@ SOperatorInfo* createPartitionOperatorInfo(SOperatorInfo* downstream, SPartition
SPartitionOperatorInfo* pInfo = taosMemoryCalloc(1, sizeof(SPartitionOperatorInfo));
SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo));
if (pInfo == NULL || pOperator == NULL) {
+ terrno = TSDB_CODE_OUT_OF_MEMORY;
+ pTaskInfo->code = terrno;
goto _error;
}
@@ -841,6 +840,8 @@ SOperatorInfo* createPartitionOperatorInfo(SOperatorInfo* downstream, SPartition
SExprInfo* pExprInfo1 = createExprInfo(pPartNode->pExprs, NULL, &num);
int32_t code = initExprSupp(&pInfo->scalarSup, pExprInfo1, num);
if (code != TSDB_CODE_SUCCESS) {
+ terrno = code;
+ pTaskInfo->code = terrno;
goto _error;
}
}
@@ -848,6 +849,8 @@ SOperatorInfo* createPartitionOperatorInfo(SOperatorInfo* downstream, SPartition
_hash_fn_t hashFn = taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY);
pInfo->pGroupSet = taosHashInit(100, hashFn, false, HASH_NO_LOCK);
if (pInfo->pGroupSet == NULL) {
+ terrno = TSDB_CODE_OUT_OF_MEMORY;
+ pTaskInfo->code = terrno;
goto _error;
}
@@ -866,6 +869,8 @@ SOperatorInfo* createPartitionOperatorInfo(SOperatorInfo* downstream, SPartition
int32_t code = createDiskbasedBuf(&pInfo->pBuf, defaultPgsz, defaultBufsz, pTaskInfo->id.str, tsTempDir);
if (code != TSDB_CODE_SUCCESS) {
+ terrno = code;
+ pTaskInfo->code = code;
goto _error;
}
@@ -873,6 +878,8 @@ SOperatorInfo* createPartitionOperatorInfo(SOperatorInfo* downstream, SPartition
pInfo->columnOffset = setupColumnOffset(pInfo->binfo.pRes, pInfo->rowCapacity);
code = initGroupOptrInfo(&pInfo->pGroupColVals, &pInfo->groupKeyLen, &pInfo->keyBuf, pInfo->pGroupCols);
if (code != TSDB_CODE_SUCCESS) {
+ terrno = code;
+ pTaskInfo->code = code;
goto _error;
}
@@ -885,10 +892,15 @@ SOperatorInfo* createPartitionOperatorInfo(SOperatorInfo* downstream, SPartition
createOperatorFpSet(optrDummyOpenFn, hashPartition, NULL, destroyPartitionOperatorInfo, optrDefaultBufFn, NULL);
code = appendDownstream(pOperator, &downstream, 1);
+ if (code != TSDB_CODE_SUCCESS) {
+ terrno = code;
+ pTaskInfo->code = code;
+ goto _error;
+ }
+
return pOperator;
_error:
- pTaskInfo->code = TSDB_CODE_OUT_OF_MEMORY;
if (pInfo != NULL) {
destroyPartitionOperatorInfo(pInfo);
}
@@ -1094,7 +1106,7 @@ void initParDownStream(SOperatorInfo* downstream, SPartitionBySupporter* pParSup
SStreamScanInfo* pScanInfo = downstream->info;
pScanInfo->partitionSup = *pParSup;
pScanInfo->pPartScalarSup = pExpr;
- if (!pScanInfo->pUpdateInfo) {
+ if (!pScanInfo->igCheckUpdate && !pScanInfo->pUpdateInfo) {
pScanInfo->pUpdateInfo = updateInfoInit(60000, TSDB_TIME_PRECISION_MILLI, 0);
}
}
diff --git a/source/libs/executor/src/projectoperator.c b/source/libs/executor/src/projectoperator.c
index d641810ceee2fc860a8b201a0bff5d85dc8eb2f5..4a3a3f4de41a756f972547583bbb1ea186067c15 100644
--- a/source/libs/executor/src/projectoperator.c
+++ b/source/libs/executor/src/projectoperator.c
@@ -190,6 +190,7 @@ static int32_t setInfoForNewGroup(SSDataBlock* pBlock, SLimitInfo* pLimitInfo, S
return PROJECT_RETRIEVE_DONE;
}
+// todo refactor
static int32_t doIngroupLimitOffset(SLimitInfo* pLimitInfo, uint64_t groupId, SSDataBlock* pBlock,
SOperatorInfo* pOperator) {
// set current group id
diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c
index d54f5bec5a620ece9cd8df797060ac456744fb64..1c3dafd0e1fb6f98b5606b31fea55d62a1ca729d 100644
--- a/source/libs/executor/src/scanoperator.c
+++ b/source/libs/executor/src/scanoperator.c
@@ -311,8 +311,8 @@ static int32_t loadDataBlock(SOperatorInfo* pOperator, STableScanBase* pTableSca
pCost->totalRows += pBlock->info.rows;
return TSDB_CODE_SUCCESS;
} else if (*status == FUNC_DATA_REQUIRED_NOT_LOAD) {
- qDebug("%s data block skipped, brange:%" PRId64 "-%" PRId64 ", rows:%d", GET_TASKID(pTaskInfo),
- pBlockInfo->window.skey, pBlockInfo->window.ekey, pBlockInfo->rows);
+ qDebug("%s data block skipped, brange:%" PRId64 "-%" PRId64 ", rows:%d, uid:%"PRIu64, GET_TASKID(pTaskInfo),
+ pBlockInfo->window.skey, pBlockInfo->window.ekey, pBlockInfo->rows, pBlockInfo->id.uid);
doSetTagColumnData(pTableScanInfo, pBlock, pTaskInfo, 1);
pCost->skipBlocks += 1;
return TSDB_CODE_SUCCESS;
@@ -446,6 +446,16 @@ static STableCachedVal* createTableCacheVal(const SMetaReader* pMetaReader) {
// const void *key, size_t keyLen, void *value
static void freeCachedMetaItem(const void* key, size_t keyLen, void* value) { freeTableCachedVal(value); }
+
+static void doSetNullValue(SSDataBlock* pBlock, const SExprInfo* pExpr, int32_t numOfExpr) {
+ for (int32_t j = 0; j < numOfExpr; ++j) {
+ int32_t dstSlotId = pExpr[j].base.resSchema.slotId;
+
+ SColumnInfoData* pColInfoData = taosArrayGet(pBlock->pDataBlock, dstSlotId);
+ colDataAppendNNULL(pColInfoData, 0, pBlock->info.rows);
+ }
+}
+
int32_t addTagPseudoColumnData(SReadHandle* pHandle, const SExprInfo* pExpr, int32_t numOfExpr, SSDataBlock* pBlock,
int32_t rows, const char* idStr, STableMetaCacheInfo* pCache) {
// currently only the tbname pseudo column
@@ -465,14 +475,22 @@ int32_t addTagPseudoColumnData(SReadHandle* pHandle, const SExprInfo* pExpr, int
SMetaReader mr = {0};
LRUHandle* h = NULL;
+ // todo refactor: extract method
+ // the handling of the null data should be packed in the extracted method
+
// 1. check if it is existed in meta cache
if (pCache == NULL) {
metaReaderInit(&mr, pHandle->meta, 0);
code = metaGetTableEntryByUidCache(&mr, pBlock->info.id.uid);
if (code != TSDB_CODE_SUCCESS) {
+
+ // when encounter the TSDB_CODE_PAR_TABLE_NOT_EXIST error, we proceed.
if (terrno == TSDB_CODE_PAR_TABLE_NOT_EXIST) {
qWarn("failed to get table meta, table may have been dropped, uid:0x%" PRIx64 ", code:%s, %s",
pBlock->info.id.uid, tstrerror(terrno), idStr);
+
+ // append null value before return to caller, since the caller will ignore this error code and proceed
+ doSetNullValue(pBlock, pExpr, numOfExpr);
} else {
qError("failed to get table meta, uid:0x%" PRIx64 ", code:%s, %s", pBlock->info.id.uid, tstrerror(terrno),
idStr);
@@ -498,6 +516,8 @@ int32_t addTagPseudoColumnData(SReadHandle* pHandle, const SExprInfo* pExpr, int
if (terrno == TSDB_CODE_PAR_TABLE_NOT_EXIST) {
qWarn("failed to get table meta, table may have been dropped, uid:0x%" PRIx64 ", code:%s, %s",
pBlock->info.id.uid, tstrerror(terrno), idStr);
+ // append null value before return to caller, since the caller will ignore this error code and proceed
+ doSetNullValue(pBlock, pExpr, numOfExpr);
} else {
qError("failed to get table meta, uid:0x%" PRIx64 ", code:%s, %s", pBlock->info.id.uid, tstrerror(terrno),
idStr);
@@ -617,6 +637,10 @@ static SSDataBlock* doTableScanImpl(SOperatorInfo* pOperator) {
T_LONG_JMP(pTaskInfo->env, pTaskInfo->code);
}
+ if (pOperator->status == OP_EXEC_DONE) {
+ break;
+ }
+
// process this data block based on the probabilities
bool processThisBlock = processBlockWithProbability(&pTableScanInfo->sample);
if (!processThisBlock) {
@@ -628,9 +652,8 @@ static SSDataBlock* doTableScanImpl(SOperatorInfo* pOperator) {
uint32_t status = 0;
int32_t code = loadDataBlock(pOperator, &pTableScanInfo->base, pBlock, &status);
- // int32_t code = loadDataBlockOnDemand(pOperator->pRuntimeEnv, pTableScanInfo, pBlock, &status);
if (code != TSDB_CODE_SUCCESS) {
- T_LONG_JMP(pOperator->pTaskInfo->env, code);
+ T_LONG_JMP(pTaskInfo->env, code);
}
// current block is filter out according to filter condition, continue load the next block
@@ -758,6 +781,10 @@ static SSDataBlock* doTableScan(SOperatorInfo* pOperator) {
if (code != TSDB_CODE_SUCCESS) {
T_LONG_JMP(pTaskInfo->env, code);
}
+
+ if (pInfo->pResBlock->info.capacity > pOperator->resultInfo.capacity) {
+ pOperator->resultInfo.capacity = pInfo->pResBlock->info.capacity;
+ }
}
SSDataBlock* result = doGroupedTableScan(pOperator);
@@ -861,7 +888,7 @@ SOperatorInfo* createTableScanOperatorInfo(STableScanPhysiNode* pTableScanNode,
initResultSizeInfo(&pOperator->resultInfo, 4096);
pInfo->pResBlock = createDataBlockFromDescNode(pDescNode);
- blockDataEnsureCapacity(pInfo->pResBlock, pOperator->resultInfo.capacity);
+// blockDataEnsureCapacity(pInfo->pResBlock, pOperator->resultInfo.capacity);
code = filterInitFromNode((SNode*)pTableScanNode->scan.node.pConditions, &pOperator->exprSupp.pFilterInfo, 0);
if (code != TSDB_CODE_SUCCESS) {
@@ -1148,6 +1175,20 @@ static SSDataBlock* doRangeScan(SStreamScanInfo* pInfo, SSDataBlock* pSDB, int32
}
}
+static int32_t getPreSessionWindow(SStreamAggSupporter* pAggSup, TSKEY startTs, TSKEY endTs, uint64_t groupId,
+ SSessionKey* pKey) {
+ pKey->win.skey = startTs;
+ pKey->win.ekey = endTs;
+ pKey->groupId = groupId;
+
+ SStreamStateCur* pCur = streamStateSessionSeekKeyCurrentPrev(pAggSup->pState, pKey);
+ int32_t code = streamStateSessionGetKVByCur(pCur, pKey, NULL, 0);
+ if (code != TSDB_CODE_SUCCESS) {
+ SET_SESSION_WIN_KEY_INVALID(pKey);
+ }
+ return code;
+}
+
static int32_t generateSessionScanRange(SStreamScanInfo* pInfo, SSDataBlock* pSrcBlock, SSDataBlock* pDestBlock) {
blockDataCleanup(pDestBlock);
if (pSrcBlock->info.rows == 0) {
@@ -1183,7 +1224,14 @@ static int32_t generateSessionScanRange(SStreamScanInfo* pInfo, SSDataBlock* pSr
}
SSessionKey endWin = {0};
getCurSessionWindow(pInfo->windowSup.pStreamAggSup, endData[i], endData[i], groupId, &endWin);
- ASSERT(!IS_INVALID_SESSION_WIN_KEY(endWin));
+ if(IS_INVALID_SESSION_WIN_KEY(endWin)) {
+ getPreSessionWindow(pInfo->windowSup.pStreamAggSup, endData[i], endData[i], groupId, &endWin);
+ }
+ if (IS_INVALID_SESSION_WIN_KEY(startWin)) {
+ // window has been closed.
+ qError("generate session scan range failed. rang start:%" PRIx64 ", end:%" PRIx64 , startData[i], endData[i]);
+ continue;
+ }
colDataAppend(pDestStartCol, i, (const char*)&startWin.win.skey, false);
colDataAppend(pDestEndCol, i, (const char*)&endWin.win.ekey, false);
@@ -1412,7 +1460,12 @@ static void checkUpdateData(SStreamScanInfo* pInfo, bool invertible, SSDataBlock
dumyInfo.cur.pageId = -1;
bool isClosed = false;
STimeWindow win = {.skey = INT64_MIN, .ekey = INT64_MAX};
- if (tableInserted && isOverdue(tsCol[rowId], &pInfo->twAggSup)) {
+ bool overDue = isOverdue(tsCol[rowId], &pInfo->twAggSup);
+ if (pInfo->igExpired && overDue) {
+ continue;
+ }
+
+ if (tableInserted && overDue) {
win = getActiveTimeWindow(NULL, &dumyInfo, tsCol[rowId], &pInfo->interval, TSDB_ORDER_ASC);
isClosed = isCloseWindow(&win, &pInfo->twAggSup);
}
@@ -1520,7 +1573,7 @@ static SSDataBlock* doQueueScan(SOperatorInfo* pOperator) {
qError("submit msg messed up when initing stream submit block %p", pSubmit);
pInfo->tqReader->pMsg = NULL;
pTaskInfo->streamInfo.pReq = NULL;
- ASSERT(0);
+ return NULL;
}
}
@@ -1575,19 +1628,20 @@ static SSDataBlock* doQueueScan(SOperatorInfo* pOperator) {
if (pTaskInfo->streamInfo.prepareStatus.type == TMQ_OFFSET__LOG) {
while (1) {
SFetchRet ret = {0};
- tqNextBlock(pInfo->tqReader, &ret);
+ if (tqNextBlock(pInfo->tqReader, &ret) < 0) {
+ qError("failed to get next log block since %s", terrstr());
+ }
if (ret.fetchType == FETCH_TYPE__DATA) {
blockDataCleanup(pInfo->pRes);
- if (setBlockIntoRes(pInfo, &ret.data, true) < 0) {
- ASSERT(0);
- }
+ setBlockIntoRes(pInfo, &ret.data, true);
if (pInfo->pRes->info.rows > 0) {
pOperator->status = OP_EXEC_RECV;
qDebug("queue scan log return %d rows", pInfo->pRes->info.rows);
return pInfo->pRes;
}
} else if (ret.fetchType == FETCH_TYPE__META) {
- ASSERT(0);
+ qError("unexpected ret.fetchType:%d", ret.fetchType);
+ continue;
// pTaskInfo->streamInfo.lastStatus = ret.offset;
// pTaskInfo->streamInfo.metaBlk = ret.meta;
// return NULL;
@@ -1614,7 +1668,7 @@ static SSDataBlock* doQueueScan(SOperatorInfo* pOperator) {
return NULL;
#endif
} else {
- ASSERT(0);
+ qError("unexpected streamInfo prepare type: %d", pTaskInfo->streamInfo.prepareStatus.type);
return NULL;
}
}
@@ -1678,41 +1732,6 @@ static SSDataBlock* doStreamScan(SOperatorInfo* pOperator) {
SStreamScanInfo* pInfo = pOperator->info;
qDebug("stream scan called");
-#if 0
- SStreamState* pState = pTaskInfo->streamInfo.pState;
- if (pState) {
- printf(">>>>>>>> stream write backend\n");
- SWinKey key = {
- .ts = 1,
- .groupId = 2,
- };
- char tmp[100] = "abcdefg1";
- if (streamStatePut(pState, &key, &tmp, strlen(tmp) + 1) < 0) {
- ASSERT(0);
- }
-
- key.ts = 2;
- char tmp2[100] = "abcdefg2";
- if (streamStatePut(pState, &key, &tmp2, strlen(tmp2) + 1) < 0) {
- ASSERT(0);
- }
-
- key.groupId = 5;
- key.ts = 1;
- char tmp3[100] = "abcdefg3";
- if (streamStatePut(pState, &key, &tmp3, strlen(tmp3) + 1) < 0) {
- ASSERT(0);
- }
-
- char* val2 = NULL;
- int32_t sz;
- if (streamStateGet(pState, &key, (void**)&val2, &sz) < 0) {
- ASSERT(0);
- }
- printf("stream read %s %d\n", val2, sz);
- streamFreeVal(val2);
- }
-#endif
if (pTaskInfo->streamInfo.recoverStep == STREAM_RECOVER_STEP__PREPARE1 ||
pTaskInfo->streamInfo.recoverStep == STREAM_RECOVER_STEP__PREPARE2) {
@@ -2279,13 +2298,14 @@ SOperatorInfo* createStreamScanOperatorInfo(SReadHandle* pHandle, STableScanPhys
if (pHandle->initTableReader) {
pTSInfo->scanMode = TABLE_SCAN__TABLE_ORDER;
pTSInfo->base.dataReader = NULL;
- code = tsdbReaderOpen(pHandle->vnode, &pTSInfo->base.cond, pList, num, pTSInfo->pResBlock,
- &pTSInfo->base.dataReader, NULL);
- if (code != 0) {
- terrno = code;
- destroyTableScanOperatorInfo(pTableScanOp);
- goto _error;
- }
+ pTaskInfo->streamInfo.lastStatus.uid = -1;
+// code = tsdbReaderOpen(pHandle->vnode, &pTSInfo->base.cond, pList, num, pTSInfo->pResBlock,
+// &pTSInfo->base.dataReader, NULL);
+// if (code != 0) {
+// terrno = code;
+// destroyTableScanOperatorInfo(pTableScanOp);
+// goto _error;
+// }
}
if (pHandle->initTqReader) {
@@ -2345,6 +2365,9 @@ SOperatorInfo* createStreamScanOperatorInfo(SReadHandle* pHandle, STableScanPhys
pInfo->pUpdateDataRes = createSpecialDataBlock(STREAM_CLEAR);
pInfo->assignBlockUid = pTableScanNode->assignBlockUid;
pInfo->partitionSup.needCalc = false;
+ pInfo->igCheckUpdate = pTableScanNode->igCheckUpdate;
+ pInfo->igExpired = pTableScanNode->igExpired;
+ pInfo->twAggSup.maxTs = INT64_MIN;
setOperatorInfo(pOperator, "StreamScanOperator", QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN, false, OP_NOT_OPENED, pInfo,
pTaskInfo);
@@ -2540,7 +2563,7 @@ static SSDataBlock* getTableDataBlockImpl(void* param) {
}
uint32_t status = 0;
- loadDataBlock(pOperator, &pInfo->base, pBlock, &status);
+ code = loadDataBlock(pOperator, &pInfo->base, pBlock, &status);
// code = loadDataBlockFromOneTable(pOperator, pTableScanInfo, pBlock, &status);
if (code != TSDB_CODE_SUCCESS) {
T_LONG_JMP(pTaskInfo->env, code);
@@ -2714,10 +2737,13 @@ SSDataBlock* getSortedTableMergeScanBlockData(SSortHandle* pHandle, SSDataBlock*
}
}
- applyLimitOffset(&pInfo->limitInfo, pResBlock, pTaskInfo);
+ bool limitReached = applyLimitOffset(&pInfo->limitInfo, pResBlock, pTaskInfo);
qDebug("%s get sorted row block, rows:%d, limit:%"PRId64, GET_TASKID(pTaskInfo), pResBlock->info.rows,
- pInfo->limitInfo.numOfOutputRows);
+ pInfo->limitInfo.numOfOutputRows);
+ if (limitReached) {
+ resetLimitInfoForNextGroup(&pInfo->limitInfo);
+ }
return (pResBlock->info.rows > 0) ? pResBlock : NULL;
}
@@ -2749,6 +2775,10 @@ SSDataBlock* doTableMergeScan(SOperatorInfo* pOperator) {
SSDataBlock* pBlock = NULL;
while (pInfo->tableStartIndex < tableListSize) {
+ if (isTaskKilled(pTaskInfo)) {
+ T_LONG_JMP(pTaskInfo->env, pTaskInfo->code);
+ }
+
pBlock = getSortedTableMergeScanBlockData(pInfo->pSortHandle, pInfo->pResBlock, pOperator->resultInfo.capacity,
pOperator);
if (pBlock != NULL) {
@@ -2989,8 +3019,8 @@ int32_t tblCountScanGetInputs(SNodeList* groupTags, SName* tableName, STableCoun
}
}
} else {
- strncpy(supp->dbNameFilter, tNameGetDbNameP(tableName), TSDB_DB_NAME_LEN);
- strncpy(supp->stbNameFilter, tNameGetTableName(tableName), TSDB_TABLE_NAME_LEN);
+ tstrncpy(supp->dbNameFilter, tNameGetDbNameP(tableName), TSDB_DB_NAME_LEN);
+ tstrncpy(supp->stbNameFilter, tNameGetTableName(tableName), TSDB_TABLE_NAME_LEN);
}
return TSDB_CODE_SUCCESS;
}
diff --git a/source/libs/executor/src/sortoperator.c b/source/libs/executor/src/sortoperator.c
index 98ef6b8a3621abb1560d9f04924f92cff84b4935..3db29f40fd2e1c7e63767e197c71f85e963f3c41 100644
--- a/source/libs/executor/src/sortoperator.c
+++ b/source/libs/executor/src/sortoperator.c
@@ -768,8 +768,6 @@ SOperatorInfo* createMultiwayMergeOperatorInfo(SOperatorInfo** downStreams, size
pInfo->binfo.pRes = createDataBlockFromDescNode(pDescNode);
int32_t rowSize = pInfo->binfo.pRes->info.rowSize;
- ASSERT(rowSize < 100 * 1024 * 1024);
-
int32_t numOfOutputCols = 0;
code = extractColMatchInfo(pMergePhyNode->pTargets, pDescNode, &numOfOutputCols, COL_MATCH_FROM_SLOT_ID,
&pInfo->matchInfo);
diff --git a/source/libs/executor/src/sysscanoperator.c b/source/libs/executor/src/sysscanoperator.c
index b4da3ae7100aade86fb584b3dc5fbf50696b3457..6516c2c920f702b352c4161ff423571e3a7059a8 100644
--- a/source/libs/executor/src/sysscanoperator.c
+++ b/source/libs/executor/src/sysscanoperator.c
@@ -65,7 +65,7 @@ typedef struct SSysTableScanInfo {
SSDataBlock* pRes;
int64_t numOfBlocks; // extract basic running information.
SLoadRemoteDataInfo loadInfo;
-
+ SLimitInfo limitInfo;
int32_t tbnameSlotId;
} SSysTableScanInfo;
@@ -81,10 +81,10 @@ typedef struct MergeIndex {
} MergeIndex;
typedef struct SBlockDistInfo {
- SSDataBlock* pResBlock;
- STsdbReader* pHandle;
- SReadHandle readHandle;
- uint64_t uid; // table uid
+ SSDataBlock* pResBlock;
+ STsdbReader* pHandle;
+ SReadHandle readHandle;
+ uint64_t uid; // table uid
} SBlockDistInfo;
static int32_t sysChkFilter__Comm(SNode* pNode);
@@ -129,11 +129,10 @@ static char* SYSTABLE_IDX_COLUMN[] = {"table_name", "db_name", "create_time"
static char* SYSTABLE_SPECIAL_COL[] = {"db_name", "vgroup_id"};
-static int32_t buildSysDbTableInfo(const SSysTableScanInfo* pInfo, int32_t capacity);
-static SSDataBlock* buildInfoSchemaTableMetaBlock(char* tableName);
-static void destroySysScanOperator(void* param);
-static int32_t loadSysTableCallback(void* param, SDataBuf* pMsg, int32_t code);
-static SSDataBlock* doFilterResult(SSDataBlock* pDataBlock, SFilterInfo* pFilterInfo);
+static int32_t buildSysDbTableInfo(const SSysTableScanInfo* pInfo, int32_t capacity);
+static SSDataBlock* buildInfoSchemaTableMetaBlock(char* tableName);
+static void destroySysScanOperator(void* param);
+static int32_t loadSysTableCallback(void* param, SDataBuf* pMsg, int32_t code);
static __optSysFilter optSysGetFilterFunc(int32_t ctype, bool* reverse);
static int32_t sysTableUserTagsFillOneTableTags(const SSysTableScanInfo* pInfo, SMetaReader* smrSuperTable,
@@ -200,11 +199,11 @@ int32_t sysFilte__TableName(void* arg, SNode* pNode, SArray* result) {
if (func == NULL) return -1;
SMetaFltParam param = {.suid = 0,
- .cid = 0,
- .type = TSDB_DATA_TYPE_VARCHAR,
- .val = pVal->datum.p,
- .reverse = reverse,
- .filterFunc = func};
+ .cid = 0,
+ .type = TSDB_DATA_TYPE_VARCHAR,
+ .val = pVal->datum.p,
+ .reverse = reverse,
+ .filterFunc = func};
return -1;
}
@@ -219,11 +218,11 @@ int32_t sysFilte__CreateTime(void* arg, SNode* pNode, SArray* result) {
if (func == NULL) return -1;
SMetaFltParam param = {.suid = 0,
- .cid = 0,
- .type = TSDB_DATA_TYPE_BIGINT,
- .val = &pVal->datum.i,
- .reverse = reverse,
- .filterFunc = func};
+ .cid = 0,
+ .type = TSDB_DATA_TYPE_BIGINT,
+ .val = &pVal->datum.i,
+ .reverse = reverse,
+ .filterFunc = func};
int32_t ret = metaFilterCreateTime(pMeta, ¶m, result);
return ret;
@@ -351,9 +350,9 @@ static int32_t optSysMergeRslt(SArray* mRslt, SArray* rslt);
static SSDataBlock* sysTableScanFromMNode(SOperatorInfo* pOperator, SSysTableScanInfo* pInfo, const char* name,
SExecTaskInfo* pTaskInfo);
void extractTbnameSlotId(SSysTableScanInfo* pInfo, const SScanPhysiNode* pScanNode);
-static SSDataBlock* sysTableScanFillTbName(SOperatorInfo* pOperator, const SSysTableScanInfo* pInfo,
- const char* name, SSDataBlock* pBlock);
-__optSysFilter optSysGetFilterFunc(int32_t ctype, bool* reverse) {
+static void sysTableScanFillTbName(SOperatorInfo* pOperator, const SSysTableScanInfo* pInfo, const char* name,
+ SSDataBlock* pBlock);
+__optSysFilter optSysGetFilterFunc(int32_t ctype, bool* reverse) {
if (ctype == OP_TYPE_LOWER_EQUAL || ctype == OP_TYPE_LOWER_THAN) {
*reverse = true;
}
@@ -517,9 +516,10 @@ static SSDataBlock* sysTableScanUserTags(SOperatorInfo* pOperator) {
metaTbCursorPrev(pInfo->pCur);
blockFull = true;
} else {
- sysTableUserTagsFillOneTableTags(pInfo, &smrSuperTable, &pInfo->pCur->mr, dbname, tableName, &numOfRows, dataBlock);
+ sysTableUserTagsFillOneTableTags(pInfo, &smrSuperTable, &pInfo->pCur->mr, dbname, tableName, &numOfRows,
+ dataBlock);
}
-
+
metaReaderClear(&smrSuperTable);
if (blockFull || numOfRows >= pOperator->resultInfo.capacity) {
@@ -556,7 +556,7 @@ void relocateAndFilterSysTagsScanResult(SSysTableScanInfo* pInfo, int32_t numOfR
pInfo->pRes->info.rows = numOfRows;
relocateColumnData(pInfo->pRes, pInfo->matchInfo.pList, dataBlock->pDataBlock, false);
- doFilterResult(pInfo->pRes, pFilterInfo);
+ doFilter(pInfo->pRes, pFilterInfo, NULL);
blockDataCleanup(dataBlock);
}
@@ -975,7 +975,7 @@ static SSDataBlock* sysTableBuildUserTablesByUids(SOperatorInfo* pOperator) {
pInfo->pRes->info.rows = numOfRows;
relocateColumnData(pInfo->pRes, pInfo->matchInfo.pList, p->pDataBlock, false);
- doFilterResult(pInfo->pRes, pOperator->exprSupp.pFilterInfo);
+ doFilter(pInfo->pRes, pOperator->exprSupp.pFilterInfo, NULL);
blockDataCleanup(p);
numOfRows = 0;
@@ -991,7 +991,7 @@ static SSDataBlock* sysTableBuildUserTablesByUids(SOperatorInfo* pOperator) {
pInfo->pRes->info.rows = numOfRows;
relocateColumnData(pInfo->pRes, pInfo->matchInfo.pList, p->pDataBlock, false);
- doFilterResult(pInfo->pRes, pOperator->exprSupp.pFilterInfo);
+ doFilter(pInfo->pRes, pOperator->exprSupp.pFilterInfo, NULL);
blockDataCleanup(p);
numOfRows = 0;
@@ -1152,7 +1152,7 @@ static SSDataBlock* sysTableBuildUserTables(SOperatorInfo* pOperator) {
pInfo->pRes->info.rows = numOfRows;
relocateColumnData(pInfo->pRes, pInfo->matchInfo.pList, p->pDataBlock, false);
- doFilterResult(pInfo->pRes, pOperator->exprSupp.pFilterInfo);
+ doFilter(pInfo->pRes, pOperator->exprSupp.pFilterInfo, NULL);
blockDataCleanup(p);
numOfRows = 0;
@@ -1168,7 +1168,7 @@ static SSDataBlock* sysTableBuildUserTables(SOperatorInfo* pOperator) {
pInfo->pRes->info.rows = numOfRows;
relocateColumnData(pInfo->pRes, pInfo->matchInfo.pList, p->pDataBlock, false);
- doFilterResult(pInfo->pRes, pOperator->exprSupp.pFilterInfo);
+ doFilter(pInfo->pRes, pOperator->exprSupp.pFilterInfo, NULL);
blockDataCleanup(p);
numOfRows = 0;
@@ -1199,7 +1199,7 @@ static SSDataBlock* sysTableScanUserTables(SOperatorInfo* pOperator) {
// the retrieve is executed on the mnode, so return tables that belongs to the information schema database.
if (pInfo->readHandle.mnd != NULL) {
buildSysDbTableInfo(pInfo, pOperator->resultInfo.capacity);
- doFilterResult(pInfo->pRes, pOperator->exprSupp.pFilterInfo);
+ doFilter(pInfo->pRes, pOperator->exprSupp.pFilterInfo, NULL);
pInfo->loadInfo.totalRows += pInfo->pRes->info.rows;
setOperatorCompleted(pOperator);
@@ -1324,6 +1324,7 @@ static SSDataBlock* doSysTableScan(SOperatorInfo* pOperator) {
getDBNameFromCondition(pInfo->pCondition, dbName);
sprintf(pInfo->req.db, "%d.%s", pInfo->accountId, dbName);
}
+
SSDataBlock* pBlock = NULL;
if (strncasecmp(name, TSDB_INS_TABLE_TABLES, TSDB_TABLE_FNAME_LEN) == 0) {
pBlock = sysTableScanUserTables(pOperator);
@@ -1336,30 +1337,37 @@ static SSDataBlock* doSysTableScan(SOperatorInfo* pOperator) {
pBlock = sysTableScanFromMNode(pOperator, pInfo, name, pTaskInfo);
}
- return sysTableScanFillTbName(pOperator, pInfo, name, pBlock);
-}
-
-static SSDataBlock* sysTableScanFillTbName(SOperatorInfo* pOperator, const SSysTableScanInfo* pInfo,
- const char* name, SSDataBlock* pBlock) {
+ sysTableScanFillTbName(pOperator, pInfo, name, pBlock);
if (pBlock != NULL) {
- if (pInfo->tbnameSlotId != -1) {
- SColumnInfoData* pColumnInfoData = (SColumnInfoData*)taosArrayGet(pBlock->pDataBlock, pInfo->tbnameSlotId);
- char varTbName[TSDB_TABLE_FNAME_LEN - 1 + VARSTR_HEADER_SIZE] = {0};
- memcpy(varDataVal(varTbName), name, strlen(name));
- varDataSetLen(varTbName, strlen(name));
- for (int i = 0; i < pBlock->info.rows; ++i) {
- colDataAppend(pColumnInfoData, i, varTbName, NULL);
- }
- doFilterResult(pBlock, pOperator->exprSupp.pFilterInfo);
+ bool limitReached = applyLimitOffset(&pInfo->limitInfo, pBlock, pTaskInfo);
+ if (limitReached) {
+ setOperatorCompleted(pOperator);
}
- }
- if (pBlock && pBlock->info.rows != 0) {
- return pBlock;
+
+ return pBlock->info.rows > 0 ? pBlock : NULL;
} else {
return NULL;
}
}
+static void sysTableScanFillTbName(SOperatorInfo* pOperator, const SSysTableScanInfo* pInfo, const char* name,
+ SSDataBlock* pBlock) {
+ if (pBlock == NULL) {
+ return;
+ }
+
+ if (pInfo->tbnameSlotId != -1) {
+ SColumnInfoData* pColumnInfoData = (SColumnInfoData*)taosArrayGet(pBlock->pDataBlock, pInfo->tbnameSlotId);
+ char varTbName[TSDB_TABLE_FNAME_LEN - 1 + VARSTR_HEADER_SIZE] = {0};
+ memcpy(varDataVal(varTbName), name, strlen(name));
+ varDataSetLen(varTbName, strlen(name));
+
+ colDataAppendNItems(pColumnInfoData, 0, varTbName, pBlock->info.rows);
+ }
+
+ doFilter(pBlock, pOperator->exprSupp.pFilterInfo, NULL);
+}
+
static SSDataBlock* sysTableScanFromMNode(SOperatorInfo* pOperator, SSysTableScanInfo* pInfo, const char* name,
SExecTaskInfo* pTaskInfo) {
if (pOperator->status == OP_EXEC_DONE) {
@@ -1423,7 +1431,7 @@ static SSDataBlock* sysTableScanFromMNode(SOperatorInfo* pOperator, SSysTableSca
updateLoadRemoteInfo(&pInfo->loadInfo, pRsp->numOfRows, pRsp->compLen, startTs, pOperator);
// todo log the filter info
- doFilterResult(pInfo->pRes, pOperator->exprSupp.pFilterInfo);
+ doFilter(pInfo->pRes, pOperator->exprSupp.pFilterInfo, NULL);
taosMemoryFree(pRsp);
if (pInfo->pRes->info.rows > 0) {
return pInfo->pRes;
@@ -1457,13 +1465,13 @@ SOperatorInfo* createSysTableScanOperatorInfo(void* readHandle, SSystemTableScan
pInfo->sysInfo = pScanPhyNode->sysInfo;
pInfo->showRewrite = pScanPhyNode->showRewrite;
pInfo->pRes = createDataBlockFromDescNode(pDescNode);
-
pInfo->pCondition = pScanNode->node.pConditions;
code = filterInitFromNode(pScanNode->node.pConditions, &pOperator->exprSupp.pFilterInfo, 0);
if (code != TSDB_CODE_SUCCESS) {
goto _error;
}
+ initLimitInfo(pScanPhyNode->scan.node.pLimit, pScanPhyNode->scan.node.pSlimit, &pInfo->limitInfo);
initResultSizeInfo(&pOperator->resultInfo, 4096);
blockDataEnsureCapacity(pInfo->pRes, pOperator->resultInfo.capacity);
@@ -1482,10 +1490,11 @@ SOperatorInfo* createSysTableScanOperatorInfo(void* readHandle, SSystemTableScan
setOperatorInfo(pOperator, "SysTableScanOperator", QUERY_NODE_PHYSICAL_PLAN_SYSTABLE_SCAN, false, OP_NOT_OPENED,
pInfo, pTaskInfo);
pOperator->exprSupp.numOfExprs = taosArrayGetSize(pInfo->pRes->pDataBlock);
- pOperator->fpSet = createOperatorFpSet(optrDummyOpenFn, doSysTableScan, NULL, destroySysScanOperator, optrDefaultBufFn, NULL);
+ pOperator->fpSet =
+ createOperatorFpSet(optrDummyOpenFn, doSysTableScan, NULL, destroySysScanOperator, optrDefaultBufFn, NULL);
return pOperator;
- _error:
+_error:
if (pInfo != NULL) {
destroySysScanOperator(pInfo);
}
@@ -1556,15 +1565,6 @@ int32_t loadSysTableCallback(void* param, SDataBuf* pMsg, int32_t code) {
return TSDB_CODE_SUCCESS;
}
-SSDataBlock* doFilterResult(SSDataBlock* pDataBlock, SFilterInfo* pFilterInfo) {
- if (pFilterInfo == NULL) {
- return pDataBlock->info.rows == 0 ? NULL : pDataBlock;
- }
-
- doFilter(pDataBlock, pFilterInfo, NULL);
- return pDataBlock->info.rows == 0 ? NULL : pDataBlock;
-}
-
static int32_t sysChkFilter__Comm(SNode* pNode) {
// impl
SOperatorNode* pOper = (SOperatorNode*)pNode;
@@ -1929,7 +1929,7 @@ static SSDataBlock* doBlockInfoScan(SOperatorInfo* pOperator) {
// make the valgrind happy that all memory buffer has been initialized already.
if (slotId != 0) {
SColumnInfoData* p1 = taosArrayGet(pBlock->pDataBlock, 0);
- int64_t v = 0;
+ int64_t v = 0;
colDataAppendInt64(p1, 0, &v);
}
@@ -1939,10 +1939,10 @@ static SSDataBlock* doBlockInfoScan(SOperatorInfo* pOperator) {
}
static void destroyBlockDistScanOperatorInfo(void* param) {
- SBlockDistInfo* pDistInfo = (SBlockDistInfo*)param;
- blockDataDestroy(pDistInfo->pResBlock);
- tsdbReaderClose(pDistInfo->pHandle);
- taosMemoryFreeClear(param);
+ SBlockDistInfo* pDistInfo = (SBlockDistInfo*)param;
+ blockDataDestroy(pDistInfo->pResBlock);
+ tsdbReaderClose(pDistInfo->pHandle);
+ taosMemoryFreeClear(param);
}
static int32_t initTableblockDistQueryCond(uint64_t uid, SQueryTableDataCond* pCond) {
@@ -2003,7 +2003,7 @@ SOperatorInfo* createDataBlockInfoScanOperator(SReadHandle* readHandle, SBlockDi
}
pInfo->readHandle = *readHandle;
- pInfo->uid = pBlockScanNode->suid;
+ pInfo->uid = (pBlockScanNode->suid != 0) ? pBlockScanNode->suid : pBlockScanNode->uid;
int32_t numOfCols = 0;
SExprInfo* pExprInfo = createExprInfo(pBlockScanNode->pScanPseudoCols, NULL, &numOfCols);
@@ -2014,8 +2014,8 @@ SOperatorInfo* createDataBlockInfoScanOperator(SReadHandle* readHandle, SBlockDi
setOperatorInfo(pOperator, "DataBlockDistScanOperator", QUERY_NODE_PHYSICAL_PLAN_BLOCK_DIST_SCAN, false,
OP_NOT_OPENED, pInfo, pTaskInfo);
- pOperator->fpSet =
- createOperatorFpSet(optrDummyOpenFn, doBlockInfoScan, NULL, destroyBlockDistScanOperatorInfo, optrDefaultBufFn, NULL);
+ pOperator->fpSet = createOperatorFpSet(optrDummyOpenFn, doBlockInfoScan, NULL, destroyBlockDistScanOperatorInfo,
+ optrDefaultBufFn, NULL);
return pOperator;
_error:
diff --git a/source/libs/executor/src/tfill.c b/source/libs/executor/src/tfill.c
index 2d921d43d34726b64b0be3dde97a52a95cf19f61..778281f9b42a3db59a53b20cbbe47bf213c409cb 100644
--- a/source/libs/executor/src/tfill.c
+++ b/source/libs/executor/src/tfill.c
@@ -186,7 +186,7 @@ static void doFillOneRow(SFillInfo* pFillInfo, SSDataBlock* pBlock, SSDataBlock*
}
}
}
- } else if (pFillInfo->type == TSDB_FILL_NULL) { // fill with NULL
+ } else if (pFillInfo->type == TSDB_FILL_NULL || pFillInfo->type == TSDB_FILL_NULL_F) { // fill with NULL
setNullRow(pBlock, pFillInfo, index);
} else { // fill with user specified value for each column
for (int32_t i = 0; i < pFillInfo->numOfCols; ++i) {
@@ -349,7 +349,7 @@ static int32_t fillResultImpl(SFillInfo* pFillInfo, SSDataBlock* pBlock, int32_t
bool isNull = colDataIsNull_s(pSrc, pFillInfo->index);
colDataAppend(pDst, index, src, isNull);
saveColData(pFillInfo->prev.pRowVal, i, src, isNull); // todo:
- } else if (pFillInfo->type == TSDB_FILL_NULL) {
+ } else if (pFillInfo->type == TSDB_FILL_NULL || pFillInfo->type == TSDB_FILL_NULL_F) {
colDataAppendNULL(pDst, index);
} else if (pFillInfo->type == TSDB_FILL_NEXT) {
SArray* p = FILL_IS_ASC_FILL(pFillInfo) ? pFillInfo->next.pRowVal : pFillInfo->prev.pRowVal;
@@ -447,32 +447,6 @@ struct SFillInfo* taosCreateFillInfo(TSKEY skey, int32_t numOfFillCols, int32_t
taosResetFillInfo(pFillInfo, skey);
- switch (fillType) {
- case FILL_MODE_NONE:
- pFillInfo->type = TSDB_FILL_NONE;
- break;
- case FILL_MODE_PREV:
- pFillInfo->type = TSDB_FILL_PREV;
- break;
- case FILL_MODE_NULL:
- pFillInfo->type = TSDB_FILL_NULL;
- break;
- case FILL_MODE_LINEAR:
- pFillInfo->type = TSDB_FILL_LINEAR;
- break;
- case FILL_MODE_NEXT:
- pFillInfo->type = TSDB_FILL_NEXT;
- break;
- case FILL_MODE_VALUE:
- pFillInfo->type = TSDB_FILL_SET_VALUE;
- break;
- default: {
- taosMemoryFree(pFillInfo);
- terrno = TSDB_CODE_INVALID_PARA;
- return NULL;
- }
- }
-
pFillInfo->type = fillType;
pFillInfo->pFillCol = pCol;
pFillInfo->numOfCols = numOfFillCols + numOfNotFillCols;
@@ -572,15 +546,14 @@ bool taosFillHasMoreResults(SFillInfo* pFillInfo) {
}
int64_t getNumOfResultsAfterFillGap(SFillInfo* pFillInfo, TSKEY ekey, int32_t maxNumOfRows) {
- SColumnInfoData* pCol = taosArrayGet(pFillInfo->pSrcBlock->pDataBlock, pFillInfo->srcTsSlotId);
-
- int64_t* tsList = (int64_t*)pCol->pData;
int32_t numOfRows = taosNumOfRemainRows(pFillInfo);
TSKEY ekey1 = ekey;
int64_t numOfRes = -1;
if (numOfRows > 0) { // still fill gap within current data block, not generating data after the result set.
+ SColumnInfoData* pCol = taosArrayGet(pFillInfo->pSrcBlock->pDataBlock, pFillInfo->srcTsSlotId);
+ int64_t* tsList = (int64_t*)pCol->pData;
TSKEY lastKey = tsList[pFillInfo->numOfRows - 1];
numOfRes = taosTimeCountInterval(lastKey, pFillInfo->currentKey, pFillInfo->interval.sliding,
pFillInfo->interval.slidingUnit, pFillInfo->interval.precision);
diff --git a/source/libs/executor/src/timesliceoperator.c b/source/libs/executor/src/timesliceoperator.c
index bca87079ec52a53e16fab4994de808056fc91c21..3bf597f3b398c972233ff3edb307ac25cc7201ce 100644
--- a/source/libs/executor/src/timesliceoperator.c
+++ b/source/libs/executor/src/timesliceoperator.c
@@ -181,12 +181,14 @@ static bool genInterpolationResult(STimeSliceOperatorInfo* pSliceInfo, SExprSupp
int32_t srcSlot = pExprInfo->base.pParam[0].pCol->slotId;
switch (pSliceInfo->fillType) {
- case TSDB_FILL_NULL: {
+ case TSDB_FILL_NULL:
+ case TSDB_FILL_NULL_F: {
colDataAppendNULL(pDst, rows);
break;
}
- case TSDB_FILL_SET_VALUE: {
+ case TSDB_FILL_SET_VALUE:
+ case TSDB_FILL_SET_VALUE_F: {
SVariant* pVar = &pSliceInfo->pFillColInfo[j].fillVal;
if (pDst->info.type == TSDB_DATA_TYPE_FLOAT) {
diff --git a/source/libs/executor/src/timewindowoperator.c b/source/libs/executor/src/timewindowoperator.c
index d320ef6e9e1cd4525886bda90f5dd764b5e91488..c5dc927bd1ba79bb7c4e961f53bbad842f655aea 100644
--- a/source/libs/executor/src/timewindowoperator.c
+++ b/source/libs/executor/src/timewindowoperator.c
@@ -119,8 +119,8 @@ static void doKeepNewWindowStartInfo(SWindowRowsSup* pRowSup, const int64_t* tsL
pRowSup->groupId = groupId;
}
-FORCE_INLINE int32_t getForwardStepsInBlock(int32_t numOfRows, __block_search_fn_t searchFn, TSKEY ekey,
- int32_t pos, int32_t order, int64_t* pData) {
+FORCE_INLINE int32_t getForwardStepsInBlock(int32_t numOfRows, __block_search_fn_t searchFn, TSKEY ekey, int32_t pos,
+ int32_t order, int64_t* pData) {
int32_t forwardRows = 0;
if (order == TSDB_ORDER_ASC) {
@@ -639,7 +639,7 @@ static void doInterpUnclosedTimeWindow(SOperatorInfo* pOperatorInfo, int32_t num
if (NULL == pr) {
T_LONG_JMP(pTaskInfo->env, terrno);
}
-
+
ASSERT(pr->offset == p1->offset && pr->pageId == p1->pageId);
if (pr->closed) {
@@ -847,6 +847,7 @@ static int32_t saveWinResult(int64_t ts, int32_t pageId, int32_t offset, uint64_
if (newPos == NULL) {
return TSDB_CODE_OUT_OF_MEMORY;
}
+
newPos->groupId = groupId;
newPos->pos = (SResultRowPosition){.pageId = pageId, .offset = offset};
*(int64_t*)newPos->key = ts;
@@ -854,6 +855,7 @@ static int32_t saveWinResult(int64_t ts, int32_t pageId, int32_t offset, uint64_
if (taosHashPut(pUpdatedMap, &key, sizeof(SWinKey), &newPos, sizeof(void*)) != TSDB_CODE_SUCCESS) {
taosMemoryFree(newPos);
}
+
return TSDB_CODE_SUCCESS;
}
@@ -1318,11 +1320,11 @@ static void setInverFunction(SqlFunctionCtx* pCtx, int32_t num, EStreamType type
}
static void doClearWindowImpl(SResultRowPosition* p1, SDiskbasedBuf* pResultBuf, SExprSupp* pSup, int32_t numOfOutput) {
- SResultRow* pResult = getResultRowByPos(pResultBuf, p1, false);
+ SResultRow* pResult = getResultRowByPos(pResultBuf, p1, false);
if (NULL == pResult) {
return;
}
-
+
SqlFunctionCtx* pCtx = pSup->pCtx;
for (int32_t i = 0; i < numOfOutput; ++i) {
pCtx[i].resultInfo = getResultEntryInfo(pResult, i, pSup->rowEntryInfoOffset);
@@ -1726,7 +1728,7 @@ void initIntervalDownStream(SOperatorInfo* downstream, uint16_t type, SAggSuppor
SStreamScanInfo* pScanInfo = downstream->info;
pScanInfo->windowSup.parentType = type;
pScanInfo->windowSup.pIntervalAggSup = pSup;
- if (!pScanInfo->pUpdateInfo) {
+ if (!pScanInfo->igCheckUpdate && !pScanInfo->pUpdateInfo) {
pScanInfo->pUpdateInfo = updateInfoInitP(pInterval, pTwSup->waterMark);
}
pScanInfo->interval = *pInterval;
@@ -2567,6 +2569,7 @@ static SSDataBlock* doStreamFinalIntervalAgg(SOperatorInfo* pOperator) {
}
SArray* pUpdated = taosArrayInit(4, POINTER_BYTES);
+
_hash_fn_t hashFn = taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY);
SHashObj* pUpdatedMap = taosHashInit(1024, hashFn, false, HASH_NO_LOCK);
while (1) {
@@ -2877,6 +2880,8 @@ int32_t initBasicInfoEx(SOptrBasicInfo* pBasicInfo, SExprSupp* pSup, SExprInfo*
void initDummyFunction(SqlFunctionCtx* pDummy, SqlFunctionCtx* pCtx, int32_t nums) {
for (int i = 0; i < nums; i++) {
pDummy[i].functionId = pCtx[i].functionId;
+ pDummy[i].isNotNullFunc = pCtx[i].isNotNullFunc;
+ pDummy[i].isPseudoFunc = pCtx[i].isPseudoFunc;
}
}
@@ -2893,7 +2898,7 @@ void initDownStream(SOperatorInfo* downstream, SStreamAggSupporter* pAggSup, uin
}
SStreamScanInfo* pScanInfo = downstream->info;
pScanInfo->windowSup = (SWindowSupporter){.pStreamAggSup = pAggSup, .gap = pAggSup->gap, .parentType = type};
- if (!pScanInfo->pUpdateInfo) {
+ if (!pScanInfo->igCheckUpdate && !pScanInfo->pUpdateInfo) {
pScanInfo->pUpdateInfo = updateInfoInit(60000, TSDB_TIME_PRECISION_MILLI, pTwSup->waterMark);
}
pScanInfo->twAggSup = *pTwSup;
@@ -3404,9 +3409,11 @@ static void copyDeleteWindowInfo(SArray* pResWins, SSHashObj* pStDeleted) {
}
}
+// the allocated memory comes from outer function.
void initGroupResInfoFromArrayList(SGroupResInfo* pGroupResInfo, SArray* pArrayList) {
pGroupResInfo->pRows = pArrayList;
pGroupResInfo->index = 0;
+ pGroupResInfo->pBuf = NULL;
}
void doBuildSessionResult(SOperatorInfo* pOperator, SStreamState* pState, SGroupResInfo* pGroupResInfo,
@@ -3417,8 +3424,7 @@ void doBuildSessionResult(SOperatorInfo* pOperator, SStreamState* pState, SGroup
blockDataCleanup(pBlock);
if (!hasRemainResults(pGroupResInfo)) {
- taosArrayDestroy(pGroupResInfo->pRows);
- pGroupResInfo->pRows = NULL;
+ cleanupGroupResInfo(pGroupResInfo);
return;
}
@@ -4753,6 +4759,7 @@ static SSDataBlock* doStreamIntervalAgg(SOperatorInfo* pOperator) {
SOperatorInfo* downstream = pOperator->pDownstream[0];
SArray* pUpdated = taosArrayInit(4, POINTER_BYTES); // SResKeyPos
+
_hash_fn_t hashFn = taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY);
SHashObj* pUpdatedMap = taosHashInit(1024, hashFn, false, HASH_NO_LOCK);
@@ -4812,9 +4819,16 @@ static SSDataBlock* doStreamIntervalAgg(SOperatorInfo* pOperator) {
taosArraySort(pUpdated, resultrowComparAsc);
initMultiResInfoFromArrayList(&pInfo->groupResInfo, pUpdated);
+
blockDataEnsureCapacity(pInfo->binfo.pRes, pOperator->resultInfo.capacity);
taosHashCleanup(pUpdatedMap);
+#if 0
+ char* pBuf = streamStateIntervalDump(pInfo->pState);
+ qDebug("===stream===interval state%s", pBuf);
+ taosMemoryFree(pBuf);
+#endif
+
doBuildDeleteResult(pInfo, pInfo->pDelWins, &pInfo->delIndex, pInfo->pDelRes);
if (pInfo->pDelRes->info.rows > 0) {
printDataBlock(pInfo->pDelRes, "single interval delete");
diff --git a/source/libs/executor/src/tlinearhash.c b/source/libs/executor/src/tlinearhash.c
index d97f81c9946db6928f87a83d0a12896c85b6054a..2cba3855c71a39dae10625393fcfd52662860b1f 100644
--- a/source/libs/executor/src/tlinearhash.c
+++ b/source/libs/executor/src/tlinearhash.c
@@ -123,8 +123,6 @@ static int32_t doAddToBucket(SLHashObj* pHashObj, SLHashBucket* pBucket, int32_t
}
static void doRemoveFromBucket(SFilePage* pPage, SLHashNode* pNode, SLHashBucket* pBucket) {
- ASSERT(pPage != NULL && pNode != NULL && pBucket->size >= 1);
-
int32_t len = GET_LHASH_NODE_LEN(pNode);
char* p = (char*)pNode + len;
@@ -301,8 +299,6 @@ void* tHashCleanup(SLHashObj* pHashObj) {
}
int32_t tHashPut(SLHashObj* pHashObj, const void* key, size_t keyLen, void* data, size_t size) {
- ASSERT(pHashObj != NULL && key != NULL);
-
if (pHashObj->bits == 0) {
SLHashBucket* pBucket = pHashObj->pBucket[0];
doAddToBucket(pHashObj, pBucket, 0, key, keyLen, data, size);
@@ -363,14 +359,12 @@ int32_t tHashPut(SLHashObj* pHashObj, const void* key, size_t keyLen, void* data
if (v1 != splitBucketId) { // place it into the new bucket
ASSERT(v1 == newBucketId);
// printf("move key:%d to 0x%x bucket, remain items:%d\n", *(int32_t*)k, v1, pBucket->size - 1);
-
SLHashBucket* pNewBucket = pHashObj->pBucket[newBucketId];
doAddToBucket(pHashObj, pNewBucket, newBucketId, (void*)GET_LHASH_NODE_KEY(pNode), pNode->keyLen,
GET_LHASH_NODE_KEY(pNode), pNode->dataLen);
doRemoveFromBucket(p, pNode, pBucket);
} else {
// printf("check key:%d, located into: %d, skip it\n", *(int*) k, v1);
-
int32_t nodeSize = GET_LHASH_NODE_LEN(pStart);
pStart += nodeSize;
}
@@ -385,7 +379,6 @@ int32_t tHashPut(SLHashObj* pHashObj, const void* key, size_t keyLen, void* data
}
char* tHashGet(SLHashObj* pHashObj, const void* key, size_t keyLen) {
- ASSERT(pHashObj != NULL && key != NULL && keyLen > 0);
int32_t hashv = pHashObj->hashFn(key, keyLen);
int32_t bucketId = doGetBucketIdFromHashVal(hashv, pHashObj->bits);
diff --git a/source/libs/executor/src/tsort.c b/source/libs/executor/src/tsort.c
index 661e9f97b74e33fd4f372a7eba51ccb42df385d2..a656b8e3fd270a07753b9664cedddd3da07ea32a 100644
--- a/source/libs/executor/src/tsort.c
+++ b/source/libs/executor/src/tsort.c
@@ -190,8 +190,9 @@ static int32_t doAddToBuf(SSDataBlock* pDataBlock, SSortHandle* pHandle) {
qError("Add to buf failed since %s", terrstr(terrno));
return terrno;
}
+
int32_t code = createDiskbasedBuf(&pHandle->pBuf, pHandle->pageSize, pHandle->numOfPages * pHandle->pageSize,
- "doAddToBuf", tsTempDir);
+ "sortExternalBuf", tsTempDir);
dBufSetPrintInfo(pHandle->pBuf);
if (code != TSDB_CODE_SUCCESS) {
return code;
@@ -212,6 +213,7 @@ static int32_t doAddToBuf(SSDataBlock* pDataBlock, SSortHandle* pHandle) {
void* pPage = getNewBufPage(pHandle->pBuf, &pageId);
if (pPage == NULL) {
blockDataDestroy(p);
+ taosArrayDestroy(pPageIdList);
return terrno;
}
@@ -635,6 +637,7 @@ int32_t getProperSortPageSize(size_t rowSize, uint32_t numOfCols) {
static int32_t createInitialSources(SSortHandle* pHandle) {
size_t sortBufSize = pHandle->numOfPages * pHandle->pageSize;
+ int32_t code = 0;
if (pHandle->type == SORT_SINGLESOURCE_SORT) {
SSortSource** pSource = taosArrayGet(pHandle->pOrderedSource, 0);
@@ -663,8 +666,8 @@ static int32_t createInitialSources(SSortHandle* pHandle) {
pHandle->beforeFp(pBlock, pHandle->param);
}
- int32_t code = blockDataMerge(pHandle->pDataBlock, pBlock);
- if (code != 0) {
+ code = blockDataMerge(pHandle->pDataBlock, pBlock);
+ if (code != TSDB_CODE_SUCCESS) {
if (source->param && !source->onlyRef) {
taosMemoryFree(source->param);
}
@@ -689,6 +692,7 @@ static int32_t createInitialSources(SSortHandle* pHandle) {
blockDataDestroy(source->src.pBlock);
source->src.pBlock = NULL;
}
+
taosMemoryFree(source);
return code;
}
@@ -696,13 +700,17 @@ static int32_t createInitialSources(SSortHandle* pHandle) {
int64_t el = taosGetTimestampUs() - p;
pHandle->sortElapsed += el;
- doAddToBuf(pHandle->pDataBlock, pHandle);
+ code = doAddToBuf(pHandle->pDataBlock, pHandle);
+ if (code != TSDB_CODE_SUCCESS) {
+ return code;
+ }
}
}
if (source->param && !source->onlyRef) {
taosMemoryFree(source->param);
}
+
taosMemoryFree(source);
if (pHandle->pDataBlock != NULL && pHandle->pDataBlock->info.rows > 0) {
@@ -711,7 +719,7 @@ static int32_t createInitialSources(SSortHandle* pHandle) {
// Perform the in-memory sort and then flush data in the buffer into disk.
int64_t p = taosGetTimestampUs();
- int32_t code = blockDataSort(pHandle->pDataBlock, pHandle->pSortInfo);
+ code = blockDataSort(pHandle->pDataBlock, pHandle->pSortInfo);
if (code != 0) {
return code;
}
@@ -729,12 +737,12 @@ static int32_t createInitialSources(SSortHandle* pHandle) {
pHandle->tupleHandle.pBlock = pHandle->pDataBlock;
return 0;
} else {
- doAddToBuf(pHandle->pDataBlock, pHandle);
+ code = doAddToBuf(pHandle->pDataBlock, pHandle);
}
}
}
- return TSDB_CODE_SUCCESS;
+ return code;
}
int32_t tsortOpen(SSortHandle* pHandle) {
diff --git a/source/libs/function/src/builtinsimpl.c b/source/libs/function/src/builtinsimpl.c
index e4081ddf0d985b039fafe8c3ef8882f90872f7c8..e42812db56f0faf96673b2d6d066d4c20f8c9416 100644
--- a/source/libs/function/src/builtinsimpl.c
+++ b/source/libs/function/src/builtinsimpl.c
@@ -775,13 +775,13 @@ int32_t maxFunction(SqlFunctionCtx* pCtx) {
static int32_t setNullSelectivityValue(SqlFunctionCtx* pCtx, SSDataBlock* pBlock, int32_t rowIndex);
static int32_t setSelectivityValue(SqlFunctionCtx* pCtx, SSDataBlock* pBlock, const STuplePos* pTuplePos,
- int32_t rowIndex);
+ int32_t rowIndex);
int32_t minmaxFunctionFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) {
int32_t code = TSDB_CODE_SUCCESS;
SResultRowEntryInfo* pEntryInfo = GET_RES_INFO(pCtx);
- SMinmaxResInfo* pRes = GET_ROWCELL_INTERBUF(pEntryInfo);
+ SMinmaxResInfo* pRes = GET_ROWCELL_INTERBUF(pEntryInfo);
int32_t slotId = pCtx->pExpr->base.resSchema.slotId;
int32_t currentRow = pBlock->info.rows;
@@ -789,17 +789,46 @@ int32_t minmaxFunctionFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) {
SColumnInfoData* pCol = taosArrayGet(pBlock->pDataBlock, slotId);
pEntryInfo->isNullRes = (pEntryInfo->numOfRes == 0) ? 1 : 0;
- if (pCol->info.type == TSDB_DATA_TYPE_FLOAT) {
- float v = GET_FLOAT_VAL(&pRes->v);
- colDataAppend(pCol, currentRow, (const char*)&v, pEntryInfo->isNullRes);
+ // NOTE: do nothing change it, for performance issue
+ if (!pEntryInfo->isNullRes) {
+ switch (pCol->info.type) {
+ case TSDB_DATA_TYPE_UBIGINT:
+ case TSDB_DATA_TYPE_BIGINT:
+ ((int64_t*)pCol->pData)[currentRow] = pRes->v;
+ // colDataAppendInt64(pCol, currentRow, &pRes->v);
+ break;
+ case TSDB_DATA_TYPE_UINT:
+ case TSDB_DATA_TYPE_INT:
+ colDataAppendInt32(pCol, currentRow, (int32_t*)&pRes->v);
+ break;
+ case TSDB_DATA_TYPE_USMALLINT:
+ case TSDB_DATA_TYPE_SMALLINT:
+ colDataAppendInt16(pCol, currentRow, (int16_t*)&pRes->v);
+ break;
+ case TSDB_DATA_TYPE_BOOL:
+ case TSDB_DATA_TYPE_UTINYINT:
+ case TSDB_DATA_TYPE_TINYINT:
+ colDataAppendInt8(pCol, currentRow, (int8_t*)&pRes->v);
+ break;
+ case TSDB_DATA_TYPE_DOUBLE:
+ colDataAppendDouble(pCol, currentRow, (double*)&pRes->v);
+ break;
+ case TSDB_DATA_TYPE_FLOAT: {
+ float v = GET_FLOAT_VAL(&pRes->v);
+ colDataAppendFloat(pCol, currentRow, &v);
+ break;
+ }
+ }
} else {
- colDataAppend(pCol, currentRow, (const char*)&pRes->v, pEntryInfo->isNullRes);
+ colDataAppendNULL(pCol, currentRow);
}
- if (pEntryInfo->numOfRes > 0) {
- code = setSelectivityValue(pCtx, pBlock, &pRes->tuplePos, currentRow);
- } else {
- code = setSelectivityValue(pCtx, pBlock, &pRes->nullTuplePos, currentRow);
+ if (pCtx->subsidiaries.num > 0) {
+ if (pEntryInfo->numOfRes > 0) {
+ code = setSelectivityValue(pCtx, pBlock, &pRes->tuplePos, currentRow);
+ } else {
+ code = setSelectivityValue(pCtx, pBlock, &pRes->nullTuplePos, currentRow);
+ }
}
return code;
@@ -1662,7 +1691,7 @@ int32_t percentileFunction(SqlFunctionCtx* pCtx) {
int32_t percentileFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) {
SVariant* pVal = &pCtx->param[1].param;
- int32_t code = 0;
+ int32_t code = 0;
double v = 0;
GET_TYPED_DATA(v, double, pVal->nType, &pVal->i);
@@ -2041,7 +2070,7 @@ static void prepareBuf(SqlFunctionCtx* pCtx) {
}
static int32_t firstlastSaveTupleData(const SSDataBlock* pSrcBlock, int32_t rowIndex, SqlFunctionCtx* pCtx,
- SFirstLastRes* pInfo) {
+ SFirstLastRes* pInfo) {
int32_t code = TSDB_CODE_SUCCESS;
if (pCtx->subsidiaries.num <= 0) {
@@ -2094,7 +2123,8 @@ int32_t firstFunction(SqlFunctionCtx* pCtx) {
}
// All null data column, return directly.
- if (pInput->colDataSMAIsSet && (pInput->pColumnDataAgg[0]->numOfNull == pInput->totalRows) && pInputCol->hasNull == true) {
+ if (pInput->colDataSMAIsSet && (pInput->pColumnDataAgg[0]->numOfNull == pInput->totalRows) &&
+ pInputCol->hasNull == true) {
// save selectivity value for column consisted of all null values
int32_t code = firstlastSaveTupleData(pCtx->pSrcBlock, pInput->startRowIndex, pCtx, pInfo);
if (code != TSDB_CODE_SUCCESS) {
@@ -2210,7 +2240,8 @@ int32_t lastFunction(SqlFunctionCtx* pCtx) {
}
// All null data column, return directly.
- if (pInput->colDataSMAIsSet && (pInput->pColumnDataAgg[0]->numOfNull == pInput->totalRows) && pInputCol->hasNull == true) {
+ if (pInput->colDataSMAIsSet && (pInput->pColumnDataAgg[0]->numOfNull == pInput->totalRows) &&
+ pInputCol->hasNull == true) {
// save selectivity value for column consisted of all null values
int32_t code = firstlastSaveTupleData(pCtx->pSrcBlock, pInput->startRowIndex, pCtx, pInfo);
if (code != TSDB_CODE_SUCCESS) {
@@ -2304,7 +2335,7 @@ int32_t lastFunction(SqlFunctionCtx* pCtx) {
}
if (pResInfo->numOfRes == 0 || pInfo->ts < cts) {
- char* data = colDataGetData(pInputCol, chosen);
+ char* data = colDataGetData(pInputCol, chosen);
int32_t code = doSaveCurrentVal(pCtx, i, cts, type, data);
if (code != TSDB_CODE_SUCCESS) {
return code;
@@ -2315,7 +2346,7 @@ int32_t lastFunction(SqlFunctionCtx* pCtx) {
for (int32_t i = pInput->startRowIndex + round * 4; i < pInput->startRowIndex + pInput->numOfRows; ++i) {
if (pResInfo->numOfRes == 0 || pInfo->ts < pts[i]) {
- char* data = colDataGetData(pInputCol, i);
+ char* data = colDataGetData(pInputCol, i);
int32_t code = doSaveCurrentVal(pCtx, i, pts[i], type, data);
if (code != TSDB_CODE_SUCCESS) {
return code;
@@ -2332,7 +2363,7 @@ int32_t lastFunction(SqlFunctionCtx* pCtx) {
numOfElems++;
if (pResInfo->numOfRes == 0 || pInfo->ts < pts[i]) {
- char* data = colDataGetData(pInputCol, i);
+ char* data = colDataGetData(pInputCol, i);
int32_t code = doSaveCurrentVal(pCtx, i, pts[i], type, data);
if (code != TSDB_CODE_SUCCESS) {
return code;
@@ -2379,7 +2410,7 @@ static int32_t firstLastTransferInfoImpl(SFirstLastRes* pInput, SFirstLastRes* p
}
static int32_t firstLastTransferInfo(SqlFunctionCtx* pCtx, SFirstLastRes* pInput, SFirstLastRes* pOutput, bool isFirst,
- int32_t rowIndex) {
+ int32_t rowIndex) {
if (TSDB_CODE_SUCCESS == firstLastTransferInfoImpl(pInput, pOutput, isFirst)) {
int32_t code = firstlastSaveTupleData(pCtx->pSrcBlock, rowIndex, pCtx, pOutput);
if (code != TSDB_CODE_SUCCESS) {
@@ -2406,7 +2437,7 @@ static int32_t firstLastFunctionMergeImpl(SqlFunctionCtx* pCtx, bool isFirstQuer
for (int32_t i = start; i < start + pInput->numOfRows; ++i) {
char* data = colDataGetData(pCol, i);
SFirstLastRes* pInputInfo = (SFirstLastRes*)varDataVal(data);
- int32_t code = firstLastTransferInfo(pCtx, pInputInfo, pInfo, isFirstQuery, i);
+ int32_t code = firstLastTransferInfo(pCtx, pInputInfo, pInfo, isFirstQuery, i);
if (code != TSDB_CODE_SUCCESS) {
return code;
}
@@ -2638,7 +2669,7 @@ static int32_t doSetPrevVal(SDiffInfo* pDiffInfo, int32_t type, const char* pv,
}
static int32_t doHandleDiff(SDiffInfo* pDiffInfo, int32_t type, const char* pv, SColumnInfoData* pOutput, int32_t pos,
- int32_t order, int64_t ts) {
+ int32_t order, int64_t ts) {
int32_t factor = (order == TSDB_ORDER_ASC) ? 1 : -1;
pDiffInfo->prevTs = ts;
switch (type) {
@@ -2846,8 +2877,8 @@ static STopBotRes* getTopBotOutputInfo(SqlFunctionCtx* pCtx) {
return pRes;
}
-static int32_t doAddIntoResult(SqlFunctionCtx* pCtx, void* pData, int32_t rowIndex, SSDataBlock* pSrcBlock, uint16_t type,
- uint64_t uid, SResultRowEntryInfo* pEntryInfo, bool isTopQuery);
+static int32_t doAddIntoResult(SqlFunctionCtx* pCtx, void* pData, int32_t rowIndex, SSDataBlock* pSrcBlock,
+ uint16_t type, uint64_t uid, SResultRowEntryInfo* pEntryInfo, bool isTopQuery);
static void addResult(SqlFunctionCtx* pCtx, STopBotResItem* pSourceItem, int16_t type, bool isTopQuery);
@@ -2868,7 +2899,7 @@ int32_t topFunction(SqlFunctionCtx* pCtx) {
}
numOfElems++;
- char* data = colDataGetData(pCol, i);
+ char* data = colDataGetData(pCol, i);
int32_t code = doAddIntoResult(pCtx, data, i, pCtx->pSrcBlock, pRes->type, pInput->uid, pResInfo, true);
if (code != TSDB_CODE_SUCCESS) {
return code;
@@ -2902,7 +2933,7 @@ int32_t bottomFunction(SqlFunctionCtx* pCtx) {
}
numOfElems++;
- char* data = colDataGetData(pCol, i);
+ char* data = colDataGetData(pCol, i);
int32_t code = doAddIntoResult(pCtx, data, i, pCtx->pSrcBlock, pRes->type, pInput->uid, pResInfo, false);
if (code != TSDB_CODE_SUCCESS) {
return code;
@@ -2954,7 +2985,7 @@ static int32_t topBotResComparFn(const void* p1, const void* p2, const void* par
}
int32_t doAddIntoResult(SqlFunctionCtx* pCtx, void* pData, int32_t rowIndex, SSDataBlock* pSrcBlock, uint16_t type,
- uint64_t uid, SResultRowEntryInfo* pEntryInfo, bool isTopQuery) {
+ uint64_t uid, SResultRowEntryInfo* pEntryInfo, bool isTopQuery) {
STopBotRes* pRes = getTopBotOutputInfo(pCtx);
SVariant val = {0};
@@ -3145,7 +3176,7 @@ static char* doLoadTupleData(SSerializeDataHandle* pHandle, const STuplePos* pPo
if (pPage == NULL) {
return NULL;
}
- char* p = pPage->data + pPos->offset;
+ char* p = pPage->data + pPos->offset;
releaseBufPage(pHandle->pBuf, pPage);
return p;
} else {
@@ -4606,7 +4637,7 @@ int32_t sampleFunction(SqlFunctionCtx* pCtx) {
continue;
}
- char* data = colDataGetData(pInputCol, i);
+ char* data = colDataGetData(pInputCol, i);
int32_t code = doReservoirSample(pCtx, pInfo, data, i);
if (code != TSDB_CODE_SUCCESS) {
return code;
@@ -4626,7 +4657,7 @@ int32_t sampleFunction(SqlFunctionCtx* pCtx) {
}
int32_t sampleFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) {
- int32_t code = TSDB_CODE_SUCCESS;
+ int32_t code = TSDB_CODE_SUCCESS;
SResultRowEntryInfo* pEntryInfo = GET_RES_INFO(pCtx);
SSampleInfo* pInfo = getSampleOutputInfo(pCtx);
@@ -4960,7 +4991,7 @@ int32_t modeFunction(SqlFunctionCtx* pCtx) {
}
numOfElems++;
- char* data = colDataGetData(pInputCol, i);
+ char* data = colDataGetData(pInputCol, i);
int32_t code = doModeAdd(pInfo, i, pCtx, data);
if (code != TSDB_CODE_SUCCESS) {
return code;
@@ -5381,6 +5412,7 @@ int32_t blockDistFunction(SqlFunctionCtx* pCtx) {
if (pDistInfo->maxRows < p1.maxRows) {
pDistInfo->maxRows = p1.maxRows;
}
+ pDistInfo->numOfVgroups += (p1.numOfTables != 0 ? 1 : 0);
for (int32_t i = 0; i < tListLen(pDistInfo->blockRowsHisto); ++i) {
pDistInfo->blockRowsHisto[i] += p1.blockRowsHisto[i];
@@ -5409,6 +5441,7 @@ int32_t tSerializeBlockDistInfo(void* buf, int32_t bufLen, const STableBlockDist
if (tEncodeI32(&encoder, pInfo->defMinRows) < 0) return -1;
if (tEncodeU32(&encoder, pInfo->numOfInmemRows) < 0) return -1;
if (tEncodeU32(&encoder, pInfo->numOfSmallBlocks) < 0) return -1;
+ if (tEncodeU32(&encoder, pInfo->numOfVgroups) < 0) return -1;
for (int32_t i = 0; i < tListLen(pInfo->blockRowsHisto); ++i) {
if (tEncodeI32(&encoder, pInfo->blockRowsHisto[i]) < 0) return -1;
@@ -5440,6 +5473,7 @@ int32_t tDeserializeBlockDistInfo(void* buf, int32_t bufLen, STableBlockDistInfo
if (tDecodeI32(&decoder, &pInfo->defMinRows) < 0) return -1;
if (tDecodeU32(&decoder, &pInfo->numOfInmemRows) < 0) return -1;
if (tDecodeU32(&decoder, &pInfo->numOfSmallBlocks) < 0) return -1;
+ if (tDecodeU32(&decoder, &pInfo->numOfVgroups) < 0) return -1;
for (int32_t i = 0; i < tListLen(pInfo->blockRowsHisto); ++i) {
if (tDecodeI32(&decoder, &pInfo->blockRowsHisto[i]) < 0) return -1;
@@ -5491,7 +5525,7 @@ int32_t blockDistFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) {
colDataAppend(pColInfo, row++, st, false);
len = sprintf(st + VARSTR_HEADER_SIZE, "Total_Tables=[%d] Total_Files=[%d] Total_Vgroups=[%d]", pData->numOfTables,
- pData->numOfFiles, 0);
+ pData->numOfFiles, pData->numOfVgroups);
varDataSetLen(st, len);
colDataAppend(pColInfo, row++, st, false);
diff --git a/source/libs/function/src/detail/tminmax.c b/source/libs/function/src/detail/tminmax.c
index 847c7386550c13cc93e2e9e118fa0b8045804702..3ca1c06303e7af362849e3422828f85546115380 100644
--- a/source/libs/function/src/detail/tminmax.c
+++ b/source/libs/function/src/detail/tminmax.c
@@ -61,6 +61,8 @@
} \
}
+#define GET_INVOKE_INTRINSIC_THRESHOLD(_bits, _bytes) ((_bits) / ((_bytes) << 3u))
+
static void calculateRounds(int32_t numOfRows, int32_t bytes, int32_t* remainder, int32_t* rounds, int32_t* width) {
const int32_t bitWidth = 256;
@@ -372,7 +374,7 @@ static void handleInt8Col(const void* data, int32_t start, int32_t numOfRows, SM
pBuf->v = i8VectorCmpAVX2(data, numOfRows, isMinFunc, signVal);
} else {
if (!pBuf->assign) {
- pBuf->v = ((int8_t*)data)[0];
+ pBuf->v = ((int8_t*)data)[start];
}
if (signVal) {
@@ -406,7 +408,7 @@ static void handleInt16Col(const void* data, int32_t start, int32_t numOfRows, S
pBuf->v = i16VectorCmpAVX2(data, numOfRows, isMinFunc, signVal);
} else {
if (!pBuf->assign) {
- pBuf->v = ((int16_t*)data)[0];
+ pBuf->v = ((int16_t*)data)[start];
}
if (signVal) {
@@ -440,7 +442,7 @@ static void handleInt32Col(const void* data, int32_t start, int32_t numOfRows, S
pBuf->v = i32VectorCmpAVX2(data, numOfRows, isMinFunc, signVal);
} else {
if (!pBuf->assign) {
- pBuf->v = ((int32_t*)data)[0];
+ pBuf->v = ((int32_t*)data)[start];
}
if (signVal) {
@@ -470,7 +472,7 @@ static void handleInt32Col(const void* data, int32_t start, int32_t numOfRows, S
static void handleInt64Col(const void* data, int32_t start, int32_t numOfRows, SMinmaxResInfo* pBuf, bool isMinFunc,
bool signVal) {
if (!pBuf->assign) {
- pBuf->v = ((int64_t*)data)[0];
+ pBuf->v = ((int64_t*)data)[start];
}
if (signVal) {
@@ -504,7 +506,7 @@ static void handleFloatCol(SColumnInfoData* pCol, int32_t start, int32_t numOfRo
*val = floatVectorCmpAVX(pData, numOfRows, isMinFunc);
} else {
if (!pBuf->assign) {
- *val = pData[0];
+ *val = pData[start];
}
if (isMinFunc) { // min
@@ -535,7 +537,7 @@ static void handleDoubleCol(SColumnInfoData* pCol, int32_t start, int32_t numOfR
*val = (double)doubleVectorCmpAVX(pData, numOfRows, isMinFunc);
} else {
if (!pBuf->assign) {
- *val = pData[0];
+ *val = pData[start];
}
if (isMinFunc) { // min
@@ -700,8 +702,29 @@ static void doExtractVal(SColumnInfoData* pCol, int32_t i, int32_t end, SqlFunct
}
}
+static int32_t saveRelatedTuple(SqlFunctionCtx* pCtx, SInputColumnInfoData* pInput, int32_t index, void* tval) {
+ SColumnInfoData* pCol = pInput->pData[0];
+
+ SResultRowEntryInfo* pResInfo = GET_RES_INFO(pCtx);
+ SMinmaxResInfo* pBuf = GET_ROWCELL_INTERBUF(pResInfo);
+
+ int32_t code = 0;
+ if (pCtx->subsidiaries.num > 0) {
+ index = findRowIndex(pInput->startRowIndex, pInput->numOfRows, pCol, tval);
+ if (index >= 0) {
+ code = saveTupleData(pCtx, index, pCtx->pSrcBlock, &pBuf->tuplePos);
+ if (code != TSDB_CODE_SUCCESS) {
+ return code;
+ }
+ }
+ }
+
+ return code;
+}
+
int32_t doMinMaxHelper(SqlFunctionCtx* pCtx, int32_t isMinFunc, int32_t* nElems) {
int32_t numOfElems = 0;
+ int32_t code = TSDB_CODE_SUCCESS;
SInputColumnInfoData* pInput = &pCtx->input;
SColumnDataAgg* pAgg = pInput->pColumnDataAgg[0];
@@ -714,26 +737,19 @@ int32_t doMinMaxHelper(SqlFunctionCtx* pCtx, int32_t isMinFunc, int32_t* nElems)
pBuf->type = type;
if (IS_NULL_TYPE(type)) {
- numOfElems = 0;
goto _over;
}
// data in current data block are qualified to the query
if (pInput->colDataSMAIsSet) {
- numOfElems = pInput->numOfRows - pAgg->numOfNull;
+ numOfElems = pInput->numOfRows - pAgg->numOfNull;
if (numOfElems == 0) {
goto _over;
}
- void* tval = NULL;
int16_t index = 0;
-
- if (isMinFunc) {
- tval = &pInput->pColumnDataAgg[0]->min;
- } else {
- tval = &pInput->pColumnDataAgg[0]->max;
- }
+ void* tval = (isMinFunc) ? &pInput->pColumnDataAgg[0]->min : &pInput->pColumnDataAgg[0]->max;
if (!pBuf->assign) {
if (type == TSDB_DATA_TYPE_FLOAT) {
@@ -742,15 +758,7 @@ int32_t doMinMaxHelper(SqlFunctionCtx* pCtx, int32_t isMinFunc, int32_t* nElems)
pBuf->v = GET_INT64_VAL(tval);
}
- if (pCtx->subsidiaries.num > 0) {
- index = findRowIndex(pInput->startRowIndex, pInput->numOfRows, pCol, tval);
- if (index >= 0) {
- int32_t code = saveTupleData(pCtx, index, pCtx->pSrcBlock, &pBuf->tuplePos);
- if (code != TSDB_CODE_SUCCESS) {
- return code;
- }
- }
- }
+ code = saveRelatedTuple(pCtx, pInput, index, tval);
} else {
if (IS_SIGNED_NUMERIC_TYPE(type)) {
int64_t prev = 0;
@@ -759,15 +767,7 @@ int32_t doMinMaxHelper(SqlFunctionCtx* pCtx, int32_t isMinFunc, int32_t* nElems)
int64_t val = GET_INT64_VAL(tval);
if ((prev < val) ^ isMinFunc) {
GET_INT64_VAL(&pBuf->v) = val;
- if (pCtx->subsidiaries.num > 0) {
- index = findRowIndex(pInput->startRowIndex, pInput->numOfRows, pCol, tval);
- if (index >= 0) {
- int32_t code = saveTupleData(pCtx, index, pCtx->pSrcBlock, &pBuf->tuplePos);
- if (code != TSDB_CODE_SUCCESS) {
- return code;
- }
- }
- }
+ code = saveRelatedTuple(pCtx, pInput, index, tval);
}
} else if (IS_UNSIGNED_NUMERIC_TYPE(type)) {
uint64_t prev = 0;
@@ -776,15 +776,7 @@ int32_t doMinMaxHelper(SqlFunctionCtx* pCtx, int32_t isMinFunc, int32_t* nElems)
uint64_t val = GET_UINT64_VAL(tval);
if ((prev < val) ^ isMinFunc) {
GET_UINT64_VAL(&pBuf->v) = val;
- if (pCtx->subsidiaries.num > 0) {
- index = findRowIndex(pInput->startRowIndex, pInput->numOfRows, pCol, tval);
- if (index >= 0) {
- int32_t code = saveTupleData(pCtx, index, pCtx->pSrcBlock, &pBuf->tuplePos);
- if (code != TSDB_CODE_SUCCESS) {
- return code;
- }
- }
- }
+ code = saveRelatedTuple(pCtx, pInput, index, tval);
}
} else if (type == TSDB_DATA_TYPE_DOUBLE) {
double prev = 0;
@@ -793,15 +785,7 @@ int32_t doMinMaxHelper(SqlFunctionCtx* pCtx, int32_t isMinFunc, int32_t* nElems)
double val = GET_DOUBLE_VAL(tval);
if ((prev < val) ^ isMinFunc) {
GET_DOUBLE_VAL(&pBuf->v) = val;
- if (pCtx->subsidiaries.num > 0) {
- index = findRowIndex(pInput->startRowIndex, pInput->numOfRows, pCol, tval);
- if (index >= 0) {
- int32_t code = saveTupleData(pCtx, index, pCtx->pSrcBlock, &pBuf->tuplePos);
- if (code != TSDB_CODE_SUCCESS) {
- return code;
- }
- }
- }
+ code = saveRelatedTuple(pCtx, pInput, index, tval);
}
} else if (type == TSDB_DATA_TYPE_FLOAT) {
float prev = 0;
@@ -810,36 +794,65 @@ int32_t doMinMaxHelper(SqlFunctionCtx* pCtx, int32_t isMinFunc, int32_t* nElems)
float val = GET_DOUBLE_VAL(tval);
if ((prev < val) ^ isMinFunc) {
GET_FLOAT_VAL(&pBuf->v) = val;
- }
-
- if (pCtx->subsidiaries.num > 0) {
- index = findRowIndex(pInput->startRowIndex, pInput->numOfRows, pCol, tval);
- if (index >= 0) {
- int32_t code = saveTupleData(pCtx, index, pCtx->pSrcBlock, &pBuf->tuplePos);
- if (code != TSDB_CODE_SUCCESS) {
- return code;
- }
- }
+ code = saveRelatedTuple(pCtx, pInput, index, tval);
}
}
}
+ numOfElems = 1;
pBuf->assign = true;
- return TSDB_CODE_SUCCESS;
+ goto _over;
}
int32_t start = pInput->startRowIndex;
int32_t numOfRows = pInput->numOfRows;
int32_t end = start + numOfRows;
- if (pCol->hasNull || numOfRows < 32 || pCtx->subsidiaries.num > 0) {
+ // clang-format off
+ int32_t threshold[] = {
+ //NULL, BOOL, TINYINT, SMALLINT, INT, BIGINT, FLOAT, DOUBLE, VARCHAR, TIMESTAMP, NCHAR,
+ INT32_MAX, INT32_MAX, 32, 16, 8, 4, 8, 4, INT32_MAX, INT32_MAX, INT32_MAX,
+ // UTINYINT,USMALLINT, UINT, UBIGINT, JSON, VARBINARY, DECIMAL, BLOB, MEDIUMBLOB, BINARY
+ 32, 16, 8, 4, INT32_MAX, INT32_MAX, INT32_MAX, INT32_MAX, INT32_MAX, INT32_MAX,
+ };
+ // clang-format on
+
+ if (pCol->hasNull || numOfRows < threshold[pCol->info.type] || pCtx->subsidiaries.num > 0) {
int32_t i = findFirstValPosition(pCol, start, numOfRows);
if ((i < end) && (!pBuf->assign)) {
- memcpy(&pBuf->v, pCol->pData + (pCol->info.bytes * i), pCol->info.bytes);
+ char* p = pCol->pData + pCol->info.bytes * i;
+
+ switch (type) {
+ case TSDB_DATA_TYPE_DOUBLE:
+ case TSDB_DATA_TYPE_UBIGINT:
+ case TSDB_DATA_TYPE_BIGINT:
+ pBuf->v = *(int64_t*)p;
+ break;
+ case TSDB_DATA_TYPE_UINT:
+ case TSDB_DATA_TYPE_INT:
+ pBuf->v = *(int32_t*)p;
+ break;
+ case TSDB_DATA_TYPE_USMALLINT:
+ case TSDB_DATA_TYPE_SMALLINT:
+ pBuf->v = *(int16_t*)p;
+ break;
+ case TSDB_DATA_TYPE_BOOL:
+ case TSDB_DATA_TYPE_UTINYINT:
+ case TSDB_DATA_TYPE_TINYINT:
+ pBuf->v = *(int8_t*)p;
+ break;
+ case TSDB_DATA_TYPE_FLOAT: {
+ *(float*)&pBuf->v = *(float*)p;
+ break;
+ }
+ default:
+ memcpy(&pBuf->v, p, pCol->info.bytes);
+ break;
+ }
if (pCtx->subsidiaries.num > 0) {
- int32_t code = saveTupleData(pCtx, i, pCtx->pSrcBlock, &pBuf->tuplePos);
+ code = saveTupleData(pCtx, i, pCtx->pSrcBlock, &pBuf->tuplePos);
if (code != TSDB_CODE_SUCCESS) {
return code;
}
@@ -856,7 +869,7 @@ int32_t doMinMaxHelper(SqlFunctionCtx* pCtx, int32_t isMinFunc, int32_t* nElems)
} else {
numOfElems = numOfRows;
- switch (pCol->info.type) {
+ switch (type) {
case TSDB_DATA_TYPE_BOOL:
case TSDB_DATA_TYPE_TINYINT: {
handleInt8Col(pCol->pData, start, numOfRows, pBuf, isMinFunc, true);
@@ -905,13 +918,14 @@ int32_t doMinMaxHelper(SqlFunctionCtx* pCtx, int32_t isMinFunc, int32_t* nElems)
_over:
if (numOfElems == 0 && pCtx->subsidiaries.num > 0 && !pBuf->nullTupleSaved) {
- int32_t code = saveTupleData(pCtx, pInput->startRowIndex, pCtx->pSrcBlock, &pBuf->nullTuplePos);
+ code = saveTupleData(pCtx, pInput->startRowIndex, pCtx->pSrcBlock, &pBuf->nullTuplePos);
if (code != TSDB_CODE_SUCCESS) {
return code;
}
+
pBuf->nullTupleSaved = true;
}
*nElems = numOfElems;
- return TSDB_CODE_SUCCESS;
+ return code;
}
diff --git a/source/libs/function/src/functionMgt.c b/source/libs/function/src/functionMgt.c
index 6ab91a4483eeaf0dabf5968c6f0cd424cb80fb96..e3127fcd7ba233d478c58cc16b7543587b5eaf90 100644
--- a/source/libs/function/src/functionMgt.c
+++ b/source/libs/function/src/functionMgt.c
@@ -262,6 +262,13 @@ bool fmIsGroupKeyFunc(int32_t funcId) {
return FUNCTION_TYPE_GROUP_KEY == funcMgtBuiltins[funcId].type;
}
+bool fmIsBlockDistFunc(int32_t funcId) {
+ if (funcId < 0 || funcId >= funcMgtBuiltinsNum) {
+ return false;
+ }
+ return FUNCTION_TYPE_BLOCK_DIST == funcMgtBuiltins[funcId].type;
+}
+
void fmFuncMgtDestroy() {
void* m = gFunMgtService.pFuncNameHashTable;
if (m != NULL && atomic_val_compare_exchange_ptr((void**)&gFunMgtService.pFuncNameHashTable, m, 0) == m) {
diff --git a/source/libs/function/src/tpercentile.c b/source/libs/function/src/tpercentile.c
index 6b85155486d431f40519098f514f5668f561fae4..1734b535f13dfe33f391187efe8ec59e86b94992 100644
--- a/source/libs/function/src/tpercentile.c
+++ b/source/libs/function/src/tpercentile.c
@@ -347,8 +347,6 @@ void tMemBucketUpdateBoundingBox(MinMaxEntry *r, const char *data, int32_t dataT
* in memory bucket, we only accept data array list
*/
int32_t tMemBucketPut(tMemBucket *pBucket, const void *data, size_t size) {
- ASSERT(pBucket != NULL && data != NULL && size > 0);
-
int32_t count = 0;
int32_t bytes = pBucket->bytes;
for (int32_t i = 0; i < size; ++i) {
diff --git a/source/libs/function/src/tudf.c b/source/libs/function/src/tudf.c
index c9fa70ff11a6909022623affd3a0ebf1850837f5..b9e72847a16a5abc5f82e8cce60842254028d759 100644
--- a/source/libs/function/src/tudf.c
+++ b/source/libs/function/src/tudf.c
@@ -812,7 +812,7 @@ int32_t convertUdfColumnToDataBlock(SUdfColumn *udfCol, SSDataBlock *block) {
block->info.hasVarCol = IS_VAR_DATA_TYPE(udfCol->colMeta.type);
block->pDataBlock = taosArrayInit(1, sizeof(SColumnInfoData));
- taosArraySetSize(block->pDataBlock, 1);
+ taosArrayPush(block->pDataBlock, &(SColumnInfoData){0});
SColumnInfoData *col = taosArrayGet(block->pDataBlock, 0);
SUdfColumnMeta *meta = &udfCol->colMeta;
col->info.precision = meta->precision;
diff --git a/source/libs/nodes/src/nodesCloneFuncs.c b/source/libs/nodes/src/nodesCloneFuncs.c
index 7b9c54ab2c122f126fed799ac650915691803796..2b1819d5c0d8cd27dc70e0adfe8e44192835608d 100644
--- a/source/libs/nodes/src/nodesCloneFuncs.c
+++ b/source/libs/nodes/src/nodesCloneFuncs.c
@@ -380,6 +380,7 @@ static int32_t logicScanCopy(const SScanLogicNode* pSrc, SScanLogicNode* pDst) {
COPY_SCALAR_FIELD(watermark);
COPY_SCALAR_FIELD(deleteMark);
COPY_SCALAR_FIELD(igExpired);
+ COPY_SCALAR_FIELD(igCheckUpdate);
CLONE_NODE_LIST_FIELD(pGroupTags);
COPY_SCALAR_FIELD(groupSort);
CLONE_NODE_LIST_FIELD(pTags);
@@ -467,6 +468,7 @@ static int32_t logicWindowCopy(const SWindowLogicNode* pSrc, SWindowLogicNode* p
COPY_SCALAR_FIELD(watermark);
COPY_SCALAR_FIELD(deleteMark);
COPY_SCALAR_FIELD(igExpired);
+ COPY_SCALAR_FIELD(igCheckUpdate);
COPY_SCALAR_FIELD(windowAlgo);
COPY_SCALAR_FIELD(inputTsOrder);
COPY_SCALAR_FIELD(outputTsOrder);
diff --git a/source/libs/nodes/src/nodesCodeFuncs.c b/source/libs/nodes/src/nodesCodeFuncs.c
index 1a4ba8e43ef6d876a42631f6564b83aac1a69265..c19f64bb3a0051afc72d8e821c2c0962b363148d 100644
--- a/source/libs/nodes/src/nodesCodeFuncs.c
+++ b/source/libs/nodes/src/nodesCodeFuncs.c
@@ -1553,6 +1553,7 @@ static const char* jkTableScanPhysiPlanGroupSort = "GroupSort";
static const char* jkTableScanPhysiPlanTags = "Tags";
static const char* jkTableScanPhysiPlanSubtable = "Subtable";
static const char* jkTableScanPhysiPlanAssignBlockUid = "AssignBlockUid";
+static const char* jkTableScanPhysiPlanIgnoreUpdate = "IgnoreUpdate";
static int32_t physiTableScanNodeToJson(const void* pObj, SJson* pJson) {
const STableScanPhysiNode* pNode = (const STableScanPhysiNode*)pObj;
@@ -1618,6 +1619,9 @@ static int32_t physiTableScanNodeToJson(const void* pObj, SJson* pJson) {
if (TSDB_CODE_SUCCESS == code) {
code = tjsonAddBoolToObject(pJson, jkTableScanPhysiPlanAssignBlockUid, pNode->assignBlockUid);
}
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonAddIntegerToObject(pJson, jkTableScanPhysiPlanIgnoreUpdate, pNode->igCheckUpdate);
+ }
return code;
}
@@ -1686,6 +1690,9 @@ static int32_t jsonToPhysiTableScanNode(const SJson* pJson, void* pObj) {
if (TSDB_CODE_SUCCESS == code) {
code = tjsonGetBoolValue(pJson, jkTableScanPhysiPlanAssignBlockUid, &pNode->assignBlockUid);
}
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonGetTinyIntValue(pJson, jkTableScanPhysiPlanIgnoreUpdate, &pNode->igCheckUpdate);
+ }
return code;
}
diff --git a/source/libs/nodes/src/nodesMsgFuncs.c b/source/libs/nodes/src/nodesMsgFuncs.c
index dfe2f6c8b9b78651551f6a6c7341c1e80ddb71bd..104f066fa945572bdc8add88452d133668a39b3e 100644
--- a/source/libs/nodes/src/nodesMsgFuncs.c
+++ b/source/libs/nodes/src/nodesMsgFuncs.c
@@ -315,6 +315,11 @@ static int32_t tlvDecodeImpl(STlv* pTlv, void* pValue, int32_t len) {
}
static int32_t tlvDecodeValueImpl(STlvDecoder* pDecoder, void* pValue, int32_t len) {
+ // compatible with lower version messages
+ if (pDecoder->bufSize == pDecoder->offset) {
+ memset(pValue, 0, len);
+ return TSDB_CODE_SUCCESS;
+ }
if (len > pDecoder->bufSize - pDecoder->offset) {
return TSDB_CODE_FAILED;
}
@@ -2078,6 +2083,9 @@ static int32_t physiTableScanNodeInlineToMsg(const void* pObj, STlvEncoder* pEnc
if (TSDB_CODE_SUCCESS == code) {
code = tlvEncodeValueBool(pEncoder, pNode->assignBlockUid);
}
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeValueI8(pEncoder, pNode->igCheckUpdate);
+ }
return code;
}
@@ -2154,6 +2162,9 @@ static int32_t msgToPhysiTableScanNodeInline(STlvDecoder* pDecoder, void* pObj)
if (TSDB_CODE_SUCCESS == code) {
code = tlvDecodeValueBool(pDecoder, &pNode->assignBlockUid);
}
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvDecodeValueI8(pDecoder, &pNode->igCheckUpdate);
+ }
return code;
}
diff --git a/source/libs/nodes/src/nodesUtilFuncs.c b/source/libs/nodes/src/nodesUtilFuncs.c
index cd5ae7ad6e2b1e917b5b2842172b95b09ec49d20..e28486e0b63c9c44e9ea766b5c497b836ba4fdf1 100644
--- a/source/libs/nodes/src/nodesUtilFuncs.c
+++ b/source/libs/nodes/src/nodesUtilFuncs.c
@@ -1990,10 +1990,14 @@ char* nodesGetFillModeString(EFillMode mode) {
return "none";
case FILL_MODE_VALUE:
return "value";
+ case FILL_MODE_VALUE_F:
+ return "value_f";
case FILL_MODE_PREV:
return "prev";
case FILL_MODE_NULL:
return "null";
+ case FILL_MODE_NULL_F:
+ return "null_f";
case FILL_MODE_LINEAR:
return "linear";
case FILL_MODE_NEXT:
diff --git a/source/libs/parser/inc/parInsertUtil.h b/source/libs/parser/inc/parInsertUtil.h
index 5cc72f86923762454c8cae66ef9bbc7828b9ef05..9dd4daec3b3905740aa8ee2d25bcbd7751279aec 100644
--- a/source/libs/parser/inc/parInsertUtil.h
+++ b/source/libs/parser/inc/parInsertUtil.h
@@ -22,11 +22,11 @@ struct SToken;
#define IS_DATA_COL_ORDERED(spd) ((spd->orderStatus) == (int8_t)ORDER_STATUS_ORDERED)
-#define NEXT_TOKEN(pSql, sToken) \
- do { \
- int32_t index = 0; \
- sToken = tStrGetToken(pSql, &index, false); \
- pSql += index; \
+#define NEXT_TOKEN(pSql, sToken) \
+ do { \
+ int32_t index = 0; \
+ sToken = tStrGetToken(pSql, &index, false, NULL); \
+ pSql += index; \
} while (0)
#define CHECK_CODE(expr) \
diff --git a/source/libs/parser/inc/parToken.h b/source/libs/parser/inc/parToken.h
index fb4b46aa35094fd3ac65171c5499c038eb92d233..d539e8b37bfbab8cd0995f2f77c8228809b07f7e 100644
--- a/source/libs/parser/inc/parToken.h
+++ b/source/libs/parser/inc/parToken.h
@@ -55,7 +55,7 @@ uint32_t tGetToken(const char *z, uint32_t *tokenType);
* @param isPrevOptr
* @return
*/
-SToken tStrGetToken(const char *str, int32_t *i, bool isPrevOptr);
+SToken tStrGetToken(const char *str, int32_t *i, bool isPrevOptr, bool *pIgnoreComma);
/**
* check if it is a keyword or not
diff --git a/source/libs/parser/inc/sql.y b/source/libs/parser/inc/sql.y
index 7136a555cd79852d2cb03dfa1174dc10db25deda..faa908021e0123998362d6e19ded991cf97ead5a 100644
--- a/source/libs/parser/inc/sql.y
+++ b/source/libs/parser/inc/sql.y
@@ -544,6 +544,8 @@ stream_options(A) ::= stream_options(B) TRIGGER MAX_DELAY duration_literal(C).
stream_options(A) ::= stream_options(B) WATERMARK duration_literal(C). { ((SStreamOptions*)B)->pWatermark = releaseRawExprNode(pCxt, C); A = B; }
stream_options(A) ::= stream_options(B) IGNORE EXPIRED NK_INTEGER(C). { ((SStreamOptions*)B)->ignoreExpired = taosStr2Int8(C.z, NULL, 10); A = B; }
stream_options(A) ::= stream_options(B) FILL_HISTORY NK_INTEGER(C). { ((SStreamOptions*)B)->fillHistory = taosStr2Int8(C.z, NULL, 10); A = B; }
+stream_options(A) ::= stream_options(B) DELETE_MARK duration_literal(C). { ((SStreamOptions*)B)->pDeleteMark = releaseRawExprNode(pCxt, C); A = B; }
+stream_options(A) ::= stream_options(B) IGNORE UPDATE NK_INTEGER(C). { ((SStreamOptions*)B)->ignoreUpdate = taosStr2Int8(C.z, NULL, 10); A = B; }
subtable_opt(A) ::= . { A = NULL; }
subtable_opt(A) ::= SUBTABLE NK_LP expression(B) NK_RP. { A = releaseRawExprNode(pCxt, B); }
@@ -978,12 +980,14 @@ sliding_opt(A) ::= SLIDING NK_LP duration_literal(B) NK_RP.
fill_opt(A) ::= . { A = NULL; }
fill_opt(A) ::= FILL NK_LP fill_mode(B) NK_RP. { A = createFillNode(pCxt, B, NULL); }
fill_opt(A) ::= FILL NK_LP VALUE NK_COMMA literal_list(B) NK_RP. { A = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, B)); }
+fill_opt(A) ::= FILL NK_LP VALUE_F NK_COMMA literal_list(B) NK_RP. { A = createFillNode(pCxt, FILL_MODE_VALUE_F, createNodeListNode(pCxt, B)); }
%type fill_mode { EFillMode }
%destructor fill_mode { }
fill_mode(A) ::= NONE. { A = FILL_MODE_NONE; }
fill_mode(A) ::= PREV. { A = FILL_MODE_PREV; }
fill_mode(A) ::= NULL. { A = FILL_MODE_NULL; }
+fill_mode(A) ::= NULL_F. { A = FILL_MODE_NULL_F; }
fill_mode(A) ::= LINEAR. { A = FILL_MODE_LINEAR; }
fill_mode(A) ::= NEXT. { A = FILL_MODE_NEXT; }
@@ -1075,4 +1079,4 @@ null_ordering_opt(A) ::= NULLS LAST.
%fallback ABORT AFTER ATTACH BEFORE BEGIN BITAND BITNOT BITOR BLOCKS CHANGE COMMA COMPACT CONCAT CONFLICT COPY DEFERRED DELIMITERS DETACH DIVIDE DOT EACH END FAIL
FILE FOR GLOB ID IMMEDIATE IMPORT INITIALLY INSTEAD ISNULL KEY MODULES NK_BITNOT NK_SEMI NOTNULL OF PLUS PRIVILEGE RAISE REPLACE RESTRICT ROW SEMI STAR STATEMENT
- STRICT STRING TIMES UPDATE VALUES VARIABLE VIEW WAL.
+ STRICT STRING TIMES VALUES VARIABLE VIEW WAL.
diff --git a/source/libs/parser/src/parAstCreater.c b/source/libs/parser/src/parAstCreater.c
index eaa72b137751e5fbc40e94a7ec7b28468c7b5c9d..d1f861a5fc160fa06af8a57b18e26402c91cbecf 100644
--- a/source/libs/parser/src/parAstCreater.c
+++ b/source/libs/parser/src/parAstCreater.c
@@ -1763,6 +1763,7 @@ SNode* createStreamOptions(SAstCreateContext* pCxt) {
pOptions->triggerType = STREAM_TRIGGER_AT_ONCE;
pOptions->fillHistory = STREAM_DEFAULT_FILL_HISTORY;
pOptions->ignoreExpired = STREAM_DEFAULT_IGNORE_EXPIRED;
+ pOptions->ignoreUpdate = STREAM_DEFAULT_IGNORE_UPDATE;
return (SNode*)pOptions;
}
diff --git a/source/libs/parser/src/parInsertSql.c b/source/libs/parser/src/parInsertSql.c
index 1e1821842fb39139d961fae78b9dfad6f294a5d4..abee9416faf733d437a34f089f74ec1b1f20e7ed 100644
--- a/source/libs/parser/src/parInsertSql.c
+++ b/source/libs/parser/src/parInsertSql.c
@@ -18,16 +18,23 @@
#include "tglobal.h"
#include "ttime.h"
-#define NEXT_TOKEN_WITH_PREV(pSql, token) \
- do { \
- int32_t index = 0; \
- token = tStrGetToken(pSql, &index, true); \
- pSql += index; \
+#define NEXT_TOKEN_WITH_PREV(pSql, token) \
+ do { \
+ int32_t index = 0; \
+ token = tStrGetToken(pSql, &index, true, NULL); \
+ pSql += index; \
} while (0)
-#define NEXT_TOKEN_KEEP_SQL(pSql, token, index) \
- do { \
- token = tStrGetToken(pSql, &index, false); \
+#define NEXT_TOKEN_WITH_PREV_EXT(pSql, token, pIgnoreComma) \
+ do { \
+ int32_t index = 0; \
+ token = tStrGetToken(pSql, &index, true, pIgnoreComma); \
+ pSql += index; \
+ } while (0)
+
+#define NEXT_TOKEN_KEEP_SQL(pSql, token, index) \
+ do { \
+ token = tStrGetToken(pSql, &index, false, NULL); \
} while (0)
#define NEXT_VALID_TOKEN(pSql, token) \
@@ -302,12 +309,12 @@ static int parseTime(const char** end, SToken* pToken, int16_t timePrec, int64_t
* e.g., now+12a, now-5h
*/
index = 0;
- SToken token = tStrGetToken(pTokenEnd, &index, false);
+ SToken token = tStrGetToken(pTokenEnd, &index, false, NULL);
pTokenEnd += index;
if (token.type == TK_NK_MINUS || token.type == TK_NK_PLUS) {
index = 0;
- SToken valueToken = tStrGetToken(pTokenEnd, &index, false);
+ SToken valueToken = tStrGetToken(pTokenEnd, &index, false, NULL);
pTokenEnd += index;
if (valueToken.n < 2) {
@@ -1240,30 +1247,35 @@ static int parseOneRow(SInsertParseContext* pCxt, const char** pSql, STableDataB
int32_t code = tdSRowResetBuf(pBuilder, row);
// 1. set the parsed value from sql string
for (int i = 0; i < pCols->numOfBound && TSDB_CODE_SUCCESS == code; ++i) {
- NEXT_TOKEN_WITH_PREV(*pSql, *pToken);
- SSchema* pSchema = &pSchemas[pCols->boundColumns[i]];
+ const char* pOrigSql = *pSql;
+ bool ignoreComma = false;
+ NEXT_TOKEN_WITH_PREV_EXT(*pSql, *pToken, &ignoreComma);
+ if (ignoreComma) {
+ code = buildSyntaxErrMsg(&pCxt->msg, "invalid data or symbol", pOrigSql);
+ break;
+ }
if (pToken->type == TK_NK_QUESTION) {
isParseBindParam = true;
if (NULL == pCxt->pComCxt->pStmtCb) {
code = buildSyntaxErrMsg(&pCxt->msg, "? only used in stmt", pToken->z);
+ break;
+ }
+ } else {
+ if (TK_NK_RP == pToken->type) {
+ code = generateSyntaxErrMsg(&pCxt->msg, TSDB_CODE_PAR_INVALID_COLUMNS_NUM);
+ break;
}
- continue;
- }
-
- if (TSDB_CODE_SUCCESS == code && TK_NK_RP == pToken->type) {
- code = generateSyntaxErrMsg(&pCxt->msg, TSDB_CODE_PAR_INVALID_COLUMNS_NUM);
- }
- if (TSDB_CODE_SUCCESS == code && isParseBindParam) {
- code = buildInvalidOperationMsg(&pCxt->msg, "no mix usage for ? and values");
- }
+ if (isParseBindParam) {
+ code = buildInvalidOperationMsg(&pCxt->msg, "no mix usage for ? and values");
+ break;
+ }
- if (TSDB_CODE_SUCCESS == code) {
- param.schema = pSchema;
+ param.schema = &pSchemas[pCols->boundColumns[i]];
insGetSTSRowAppendInfo(pBuilder->rowType, pCols, i, ¶m.toffset, ¶m.colIdx);
- code = parseValueToken(pCxt, pSql, pToken, pSchema, getTableInfo(pDataBuf->pTableMeta).precision, insMemRowAppend,
- ¶m);
+ code = parseValueToken(pCxt, pSql, pToken, param.schema, getTableInfo(pDataBuf->pTableMeta).precision,
+ insMemRowAppend, ¶m);
}
if (TSDB_CODE_SUCCESS == code && i < pCols->numOfBound - 1) {
diff --git a/source/libs/parser/src/parTokenizer.c b/source/libs/parser/src/parTokenizer.c
index e62b2f0f5ab2db843d41009bb21e68a60f19cd67..b248efee59584156bace88e5dd0f001003216bc0 100644
--- a/source/libs/parser/src/parTokenizer.c
+++ b/source/libs/parser/src/parTokenizer.c
@@ -148,6 +148,7 @@ static SKeyword keywordTable[] = {
{"NOT", TK_NOT},
{"NOW", TK_NOW},
{"NULL", TK_NULL},
+ {"NULL_F", TK_NULL_F},
{"NULLS", TK_NULLS},
{"OFFSET", TK_OFFSET},
{"ON", TK_ON},
@@ -232,11 +233,13 @@ static SKeyword keywordTable[] = {
{"TTL", TK_TTL},
{"UNION", TK_UNION},
{"UNSIGNED", TK_UNSIGNED},
+ {"UPDATE", TK_UPDATE},
{"USE", TK_USE},
{"USER", TK_USER},
{"USERS", TK_USERS},
{"USING", TK_USING},
{"VALUE", TK_VALUE},
+ {"VALUE_F", TK_VALUE_F},
{"VALUES", TK_VALUES},
{"VARCHAR", TK_VARCHAR},
{"VARIABLES", TK_VARIABLES},
@@ -620,7 +623,7 @@ uint32_t tGetToken(const char* z, uint32_t* tokenId) {
return 0;
}
-SToken tStrGetToken(const char* str, int32_t* i, bool isPrevOptr) {
+SToken tStrGetToken(const char* str, int32_t* i, bool isPrevOptr, bool* pIgnoreComma) {
SToken t0 = {0};
// here we reach the end of sql string, null-terminated string
@@ -641,6 +644,10 @@ SToken tStrGetToken(const char* str, int32_t* i, bool isPrevOptr) {
return t0;
}
+ if (NULL != pIgnoreComma && t == ',') {
+ *pIgnoreComma = true;
+ }
+
t = str[++(*i)];
}
diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c
index 183d1b0c6ef0300bcad5045c4822191077e8fc90..0d052846f737b9735df3aca75cddb6583bdc7eab 100644
--- a/source/libs/parser/src/parTranslater.c
+++ b/source/libs/parser/src/parTranslater.c
@@ -666,6 +666,9 @@ static uint8_t getPrecisionFromCurrStmt(SNode* pCurrStmt, uint8_t defaultVal) {
if (isSetOperator(pCurrStmt)) {
return ((SSetOperator*)pCurrStmt)->precision;
}
+ if (NULL != pCurrStmt && QUERY_NODE_CREATE_STREAM_STMT == nodeType(pCurrStmt)) {
+ return getPrecisionFromCurrStmt(((SCreateStreamStmt*)pCurrStmt)->pQuery, defaultVal);
+ }
return defaultVal;
}
@@ -1464,6 +1467,15 @@ static int32_t translateInterpFunc(STranslateContext* pCxt, SFunctionNode* pFunc
return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_NOT_ALLOWED_FUNC);
}
SSelectStmt* pSelect = (SSelectStmt*)pCxt->pCurrStmt;
+ SNode* pTable = pSelect->pFromTable;
+
+ if ((NULL != pTable && (QUERY_NODE_REAL_TABLE != nodeType(pTable) ||
+ (TSDB_CHILD_TABLE != ((SRealTableNode*)pTable)->pMeta->tableType &&
+ TSDB_NORMAL_TABLE != ((SRealTableNode*)pTable)->pMeta->tableType)))) {
+ return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_ONLY_SUPPORT_SINGLE_TABLE,
+ "%s is only supported in single table query", pFunc->functionName);
+ }
+
if (pSelect->hasAggFuncs || pSelect->hasMultiRowsFunc || pSelect->hasIndefiniteRowsFunc) {
return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_NOT_ALLOWED_FUNC);
}
@@ -1561,6 +1573,27 @@ static int32_t translateRepeatScanFunc(STranslateContext* pCxt, SFunctionNode* p
return TSDB_CODE_SUCCESS;
}
+static int32_t translateBlockDistFunc(STranslateContext* pCtx, SFunctionNode* pFunc) {
+ if (!fmIsBlockDistFunc(pFunc->funcId)) {
+ return TSDB_CODE_SUCCESS;
+ }
+ if (!isSelectStmt(pCtx->pCurrStmt)) {
+ return generateSyntaxErrMsgExt(&pCtx->msgBuf, TSDB_CODE_PAR_ONLY_SUPPORT_SINGLE_TABLE,
+ "%s is only supported in single table query", pFunc->functionName);
+ }
+ SSelectStmt* pSelect = (SSelectStmt*)pCtx->pCurrStmt;
+ SNode* pTable = pSelect->pFromTable;
+ if (NULL != pTable && (QUERY_NODE_REAL_TABLE != nodeType(pTable) ||
+ (TSDB_SUPER_TABLE != ((SRealTableNode*)pTable)->pMeta->tableType &&
+ TSDB_CHILD_TABLE != ((SRealTableNode*)pTable)->pMeta->tableType &&
+ TSDB_NORMAL_TABLE != ((SRealTableNode*)pTable)->pMeta->tableType))) {
+ return generateSyntaxErrMsgExt(&pCtx->msgBuf, TSDB_CODE_PAR_NOT_ALLOWED_FUNC,
+ "%s is only supported on super table, child table or normal table",
+ pFunc->functionName);
+ }
+ return TSDB_CODE_SUCCESS;
+}
+
static bool isStar(SNode* pNode) {
return (QUERY_NODE_COLUMN == nodeType(pNode)) && ('\0' == ((SColumnNode*)pNode)->tableAlias[0]) &&
(0 == strcmp(((SColumnNode*)pNode)->colName, "*"));
@@ -1584,6 +1617,7 @@ static int32_t translateMultiResFunc(STranslateContext* pCxt, SFunctionNode* pFu
}
if (tsKeepColumnName && 1 == LIST_LENGTH(pFunc->pParameterList) && !pFunc->node.asAlias) {
strcpy(pFunc->node.userAlias, ((SExprNode*)nodesListGetNode(pFunc->pParameterList, 0))->userAlias);
+ strcpy(pFunc->node.aliasName, pFunc->node.userAlias);
}
return TSDB_CODE_SUCCESS;
}
@@ -1720,7 +1754,7 @@ static int32_t rewriteSystemInfoFunc(STranslateContext* pCxt, SNode** pNode) {
return TSDB_CODE_PAR_INTERNAL_ERROR;
}
-static int32_t translateNoramlFunction(STranslateContext* pCxt, SFunctionNode* pFunc) {
+static int32_t translateNormalFunction(STranslateContext* pCxt, SFunctionNode* pFunc) {
int32_t code = translateAggFunc(pCxt, pFunc);
if (TSDB_CODE_SUCCESS == code) {
code = translateScanPseudoColumnFunc(pCxt, pFunc);
@@ -1752,6 +1786,9 @@ static int32_t translateNoramlFunction(STranslateContext* pCxt, SFunctionNode* p
if (TSDB_CODE_SUCCESS == code) {
code = translateTimelineFunc(pCxt, pFunc);
}
+ if (TSDB_CODE_SUCCESS == code) {
+ code = translateBlockDistFunc(pCxt, pFunc);
+ }
if (TSDB_CODE_SUCCESS == code) {
setFuncClassification(pCxt->pCurrStmt, pFunc);
}
@@ -1812,7 +1849,7 @@ static int32_t translateFunctionImpl(STranslateContext* pCxt, SFunctionNode** pF
if (fmIsClientPseudoColumnFunc((*pFunc)->funcId)) {
return rewriteClientPseudoColumnFunc(pCxt, (SNode**)pFunc);
}
- return translateNoramlFunction(pCxt, *pFunc);
+ return translateNormalFunction(pCxt, *pFunc);
}
static EDealRes translateFunction(STranslateContext* pCxt, SFunctionNode** pFunc) {
@@ -2523,11 +2560,12 @@ static SNode* createMultiResFunc(SFunctionNode* pSrcFunc, SExprNode* pExpr) {
int32_t len = 0;
if (QUERY_NODE_COLUMN == nodeType(pExpr)) {
SColumnNode* pCol = (SColumnNode*)pExpr;
- len = snprintf(buf, sizeof(buf), "%s(%s.%s)", pSrcFunc->functionName, pCol->tableAlias, pCol->colName);
- strncpy(pFunc->node.aliasName, buf, TMIN(len, sizeof(pFunc->node.aliasName) - 1));
if (tsKeepColumnName) {
strcpy(pFunc->node.userAlias, pCol->colName);
+ strcpy(pFunc->node.aliasName, pCol->colName);
} else {
+ len = snprintf(buf, sizeof(buf), "%s(%s.%s)", pSrcFunc->functionName, pCol->tableAlias, pCol->colName);
+ strncpy(pFunc->node.aliasName, buf, TMIN(len, sizeof(pFunc->node.aliasName) - 1));
len = snprintf(buf, sizeof(buf), "%s(%s)", pSrcFunc->functionName, pCol->colName);
strncpy(pFunc->node.userAlias, buf, TMIN(len, sizeof(pFunc->node.userAlias) - 1));
}
@@ -2794,7 +2832,7 @@ static int32_t convertFillValue(STranslateContext* pCxt, SDataType dt, SNodeList
}
static int32_t checkFillValues(STranslateContext* pCxt, SFillNode* pFill, SNodeList* pProjectionList) {
- if (FILL_MODE_VALUE != pFill->mode) {
+ if (FILL_MODE_VALUE != pFill->mode && FILL_MODE_VALUE_F != pFill->mode) {
return TSDB_CODE_SUCCESS;
}
@@ -5486,16 +5524,6 @@ static bool crossTableWithUdaf(SSelectStmt* pSelect) {
}
static int32_t checkCreateStream(STranslateContext* pCxt, SCreateStreamStmt* pStmt) {
- if (NULL != pStmt->pOptions->pWatermark &&
- (DEAL_RES_ERROR == translateValue(pCxt, (SValueNode*)pStmt->pOptions->pWatermark))) {
- return pCxt->errCode;
- }
-
- if (NULL != pStmt->pOptions->pDelay &&
- (DEAL_RES_ERROR == translateValue(pCxt, (SValueNode*)pStmt->pOptions->pDelay))) {
- return pCxt->errCode;
- }
-
if (NULL == pStmt->pQuery) {
return TSDB_CODE_SUCCESS;
}
@@ -5688,6 +5716,17 @@ static int32_t buildCreateStreamQuery(STranslateContext* pCxt, SCreateStreamStmt
return code;
}
+static int32_t translateStreamOptions(STranslateContext* pCxt, SCreateStreamStmt* pStmt) {
+ pCxt->pCurrStmt = (SNode*)pStmt;
+ SStreamOptions* pOptions = pStmt->pOptions;
+ if ((NULL != pOptions->pWatermark && (DEAL_RES_ERROR == translateValue(pCxt, (SValueNode*)pOptions->pWatermark))) ||
+ (NULL != pOptions->pDeleteMark && (DEAL_RES_ERROR == translateValue(pCxt, (SValueNode*)pOptions->pDeleteMark))) ||
+ (NULL != pOptions->pDelay && (DEAL_RES_ERROR == translateValue(pCxt, (SValueNode*)pOptions->pDelay)))) {
+ return pCxt->errCode;
+ }
+ return TSDB_CODE_SUCCESS;
+}
+
static int32_t buildCreateStreamReq(STranslateContext* pCxt, SCreateStreamStmt* pStmt, SCMCreateStreamReq* pReq) {
pReq->igExists = pStmt->ignoreExists;
@@ -5709,12 +5748,19 @@ static int32_t buildCreateStreamReq(STranslateContext* pCxt, SCreateStreamStmt*
}
}
+ if (TSDB_CODE_SUCCESS == code) {
+ code = translateStreamOptions(pCxt, pStmt);
+ }
+
if (TSDB_CODE_SUCCESS == code) {
pReq->triggerType = pStmt->pOptions->triggerType;
pReq->maxDelay = (NULL != pStmt->pOptions->pDelay ? ((SValueNode*)pStmt->pOptions->pDelay)->datum.i : 0);
pReq->watermark = (NULL != pStmt->pOptions->pWatermark ? ((SValueNode*)pStmt->pOptions->pWatermark)->datum.i : 0);
+ pReq->deleteMark =
+ (NULL != pStmt->pOptions->pDeleteMark ? ((SValueNode*)pStmt->pOptions->pDeleteMark)->datum.i : 0);
pReq->fillHistory = pStmt->pOptions->fillHistory;
pReq->igExpired = pStmt->pOptions->ignoreExpired;
+ pReq->igUpdate = pStmt->pOptions->ignoreUpdate;
columnDefNodeToField(pStmt->pTags, &pReq->pTags);
pReq->numOfTags = LIST_LENGTH(pStmt->pTags);
}
diff --git a/source/libs/parser/src/parser.c b/source/libs/parser/src/parser.c
index cf338d63ff43182330d2f1e229aa2a03070feb6a..47482db7400f98c839c112d93e503b20d25f8073 100644
--- a/source/libs/parser/src/parser.c
+++ b/source/libs/parser/src/parser.c
@@ -27,7 +27,7 @@ bool qIsInsertValuesSql(const char* pStr, size_t length) {
const char* pSql = pStr;
int32_t index = 0;
- SToken t = tStrGetToken((char*)pStr, &index, false);
+ SToken t = tStrGetToken((char*)pStr, &index, false, NULL);
if (TK_INSERT != t.type && TK_IMPORT != t.type) {
return false;
}
@@ -35,7 +35,7 @@ bool qIsInsertValuesSql(const char* pStr, size_t length) {
do {
pStr += index;
index = 0;
- t = tStrGetToken((char*)pStr, &index, false);
+ t = tStrGetToken((char*)pStr, &index, false, NULL);
if (TK_USING == t.type || TK_VALUES == t.type || TK_FILE == t.type) {
return true;
} else if (TK_SELECT == t.type) {
diff --git a/source/libs/parser/src/sql.c b/source/libs/parser/src/sql.c
index d3b9bf069b08f65e4cada7b22530326347f772e7..98368d38063671eb741b2183dd1daea4c601aa4a 100644
--- a/source/libs/parser/src/sql.c
+++ b/source/libs/parser/src/sql.c
@@ -104,26 +104,26 @@
#endif
/************* Begin control #defines *****************************************/
#define YYCODETYPE unsigned short int
-#define YYNOCODE 459
+#define YYNOCODE 461
#define YYACTIONTYPE unsigned short int
#define ParseTOKENTYPE SToken
typedef union {
int yyinit;
ParseTOKENTYPE yy0;
- EOperatorType yy20;
- SNode* yy74;
- ENullOrder yy109;
- SToken yy317;
- EOrder yy326;
- bool yy335;
- int8_t yy449;
- int64_t yy531;
- EJoinType yy630;
- SAlterOption yy767;
- EFillMode yy828;
- int32_t yy856;
- SNodeList* yy874;
- SDataType yy898;
+ EOrder yy32;
+ SToken yy77;
+ int32_t yy248;
+ int8_t yy287;
+ ENullOrder yy385;
+ EJoinType yy560;
+ SNode* yy600;
+ SNodeList* yy601;
+ SAlterOption yy661;
+ EOperatorType yy666;
+ int64_t yy717;
+ EFillMode yy798;
+ bool yy841;
+ SDataType yy888;
} YYMINORTYPE;
#ifndef YYSTACKDEPTH
#define YYSTACKDEPTH 100
@@ -139,17 +139,17 @@ typedef union {
#define ParseCTX_FETCH
#define ParseCTX_STORE
#define YYFALLBACK 1
-#define YYNSTATE 711
-#define YYNRULE 541
-#define YYNTOKEN 322
-#define YY_MAX_SHIFT 710
-#define YY_MIN_SHIFTREDUCE 1054
-#define YY_MAX_SHIFTREDUCE 1594
-#define YY_ERROR_ACTION 1595
-#define YY_ACCEPT_ACTION 1596
-#define YY_NO_ACTION 1597
-#define YY_MIN_REDUCE 1598
-#define YY_MAX_REDUCE 2138
+#define YYNSTATE 716
+#define YYNRULE 545
+#define YYNTOKEN 324
+#define YY_MAX_SHIFT 715
+#define YY_MIN_SHIFTREDUCE 1063
+#define YY_MAX_SHIFTREDUCE 1607
+#define YY_ERROR_ACTION 1608
+#define YY_ACCEPT_ACTION 1609
+#define YY_NO_ACTION 1610
+#define YY_MIN_REDUCE 1611
+#define YY_MAX_REDUCE 2155
/************* End control #defines *******************************************/
#define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0])))
@@ -216,742 +216,744 @@ typedef union {
** yy_default[] Default action for each state.
**
*********** Begin parsing tables **********************************************/
-#define YY_ACTTAB_COUNT (2723)
+#define YY_ACTTAB_COUNT (2733)
static const YYACTIONTYPE yy_action[] = {
- /* 0 */ 459, 353, 460, 1634, 566, 600, 578, 2114, 2109, 155,
- /* 10 */ 1940, 2109, 43, 41, 1525, 39, 38, 37, 1753, 123,
- /* 20 */ 361, 1936, 1375, 565, 173, 599, 498, 2113, 2110, 567,
- /* 30 */ 1954, 2110, 2112, 1455, 1400, 1373, 1751, 131, 468, 406,
- /* 40 */ 460, 1634, 36, 35, 1940, 586, 42, 40, 39, 38,
- /* 50 */ 37, 1932, 1938, 344, 541, 1936, 167, 578, 1450, 465,
- /* 60 */ 585, 1972, 610, 16, 366, 461, 1804, 1797, 1799, 581,
- /* 70 */ 1381, 599, 1401, 330, 1922, 158, 616, 333, 1851, 319,
- /* 80 */ 1705, 1972, 1802, 43, 41, 1932, 1938, 356, 131, 560,
- /* 90 */ 477, 361, 475, 1375, 1860, 12, 610, 326, 172, 2049,
- /* 100 */ 2050, 1953, 129, 2054, 1455, 1988, 1373, 2113, 100, 1955,
- /* 110 */ 620, 1957, 1958, 615, 600, 610, 1106, 707, 1105, 654,
- /* 120 */ 170, 458, 2041, 599, 463, 1640, 355, 2037, 123, 1450,
- /* 130 */ 559, 210, 1457, 1458, 16, 503, 33, 275, 1484, 566,
- /* 140 */ 175, 1381, 157, 2109, 1610, 1751, 46, 1107, 2067, 255,
- /* 150 */ 2049, 577, 578, 124, 576, 1621, 1954, 2109, 565, 173,
- /* 160 */ 600, 1431, 1440, 2110, 567, 578, 12, 42, 40, 39,
- /* 170 */ 38, 37, 565, 173, 52, 1309, 1310, 2110, 567, 97,
- /* 180 */ 1376, 586, 1374, 131, 1256, 1257, 467, 1972, 707, 463,
- /* 190 */ 1640, 1751, 1402, 132, 1485, 614, 131, 561, 46, 1922,
- /* 200 */ 1922, 1743, 616, 1457, 1458, 1379, 1380, 62, 1430, 1433,
- /* 210 */ 1434, 1435, 1436, 1437, 1438, 1439, 612, 608, 1448, 1449,
- /* 220 */ 1451, 1452, 1453, 1454, 1456, 1459, 2, 1953, 595, 58,
- /* 230 */ 1860, 1988, 1431, 1440, 311, 1955, 620, 1957, 1958, 615,
- /* 240 */ 613, 610, 601, 2006, 174, 2049, 2050, 1400, 129, 2054,
- /* 250 */ 338, 1376, 2056, 1374, 1798, 1799, 580, 171, 2049, 2050,
- /* 260 */ 556, 129, 2054, 1620, 58, 32, 359, 1479, 1480, 1481,
- /* 270 */ 1482, 1483, 1487, 1488, 1489, 1490, 1379, 1380, 2053, 1430,
- /* 280 */ 1433, 1434, 1435, 1436, 1437, 1438, 1439, 612, 608, 1448,
- /* 290 */ 1449, 1451, 1452, 1453, 1454, 1456, 1459, 2, 58, 9,
- /* 300 */ 43, 41, 1667, 47, 1551, 1596, 1847, 1922, 361, 1529,
- /* 310 */ 1375, 339, 1729, 337, 336, 1400, 500, 181, 1954, 1619,
- /* 320 */ 502, 1455, 58, 1373, 1213, 642, 641, 640, 1217, 639,
- /* 330 */ 1219, 1220, 638, 1222, 635, 257, 1228, 632, 1230, 1231,
- /* 340 */ 629, 626, 501, 562, 557, 258, 1450, 176, 399, 1972,
- /* 350 */ 398, 16, 553, 1549, 1550, 1552, 1553, 617, 1381, 1106,
- /* 360 */ 1173, 1105, 1922, 1922, 616, 569, 395, 513, 512, 511,
- /* 370 */ 376, 43, 41, 1460, 477, 128, 507, 400, 176, 361,
- /* 380 */ 506, 1375, 58, 12, 85, 505, 510, 397, 393, 1953,
- /* 390 */ 1107, 504, 1455, 1988, 1373, 1175, 100, 1955, 620, 1957,
- /* 400 */ 1958, 615, 1954, 610, 80, 707, 134, 1618, 141, 2012,
- /* 410 */ 2041, 600, 546, 176, 355, 2037, 2109, 1450, 127, 546,
- /* 420 */ 1457, 1458, 169, 2109, 1401, 178, 226, 1746, 573, 1381,
- /* 430 */ 1617, 2115, 173, 1972, 1599, 1791, 2110, 567, 2115, 173,
- /* 440 */ 1375, 617, 1751, 2110, 567, 167, 1922, 176, 616, 1431,
- /* 450 */ 1440, 1922, 176, 1373, 44, 113, 1432, 587, 112, 111,
- /* 460 */ 110, 109, 108, 107, 106, 105, 104, 1852, 1376, 352,
- /* 470 */ 1374, 176, 1864, 1953, 1922, 227, 707, 1988, 1781, 1804,
- /* 480 */ 160, 1955, 620, 1957, 1958, 615, 354, 610, 1381, 1352,
- /* 490 */ 1353, 1457, 1458, 1379, 1380, 1802, 1430, 1433, 1434, 1435,
- /* 500 */ 1436, 1437, 1438, 1439, 612, 608, 1448, 1449, 1451, 1452,
- /* 510 */ 1453, 1454, 1456, 1459, 2, 509, 508, 678, 676, 113,
- /* 520 */ 1431, 1440, 112, 111, 110, 109, 108, 107, 106, 105,
- /* 530 */ 104, 176, 568, 2130, 364, 707, 513, 512, 511, 1376,
- /* 540 */ 367, 1374, 155, 1804, 128, 507, 1465, 1909, 155, 506,
- /* 550 */ 365, 1753, 1400, 1403, 505, 510, 1728, 1753, 1954, 1802,
- /* 560 */ 504, 266, 267, 1400, 1379, 1380, 265, 1430, 1433, 1434,
- /* 570 */ 1435, 1436, 1437, 1438, 1439, 612, 608, 1448, 1449, 1451,
- /* 580 */ 1452, 1453, 1454, 1456, 1459, 2, 43, 41, 1598, 1972,
- /* 590 */ 1616, 600, 185, 527, 361, 383, 1375, 581, 1376, 1727,
- /* 600 */ 1374, 1615, 1922, 1399, 616, 404, 525, 1455, 523, 1373,
- /* 610 */ 1742, 600, 122, 121, 120, 119, 118, 117, 116, 115,
- /* 620 */ 114, 1936, 1751, 1379, 1380, 405, 11, 10, 77, 1953,
- /* 630 */ 1614, 76, 1450, 1988, 1922, 1613, 100, 1955, 620, 1957,
- /* 640 */ 1958, 615, 1751, 610, 1381, 1922, 91, 80, 170, 574,
- /* 650 */ 2041, 1932, 1938, 133, 355, 2037, 2012, 43, 41, 600,
- /* 660 */ 518, 654, 610, 652, 2114, 361, 1954, 1375, 1744, 44,
- /* 670 */ 1747, 442, 1612, 414, 1922, 528, 2068, 587, 1455, 1922,
- /* 680 */ 1373, 1402, 146, 145, 649, 648, 647, 143, 29, 224,
- /* 690 */ 1751, 707, 1865, 1432, 36, 35, 182, 1972, 42, 40,
- /* 700 */ 39, 38, 37, 1450, 521, 617, 1457, 1458, 1609, 515,
- /* 710 */ 1922, 1608, 616, 2056, 223, 1381, 1922, 1607, 2114, 36,
- /* 720 */ 35, 1498, 2109, 42, 40, 39, 38, 37, 1522, 189,
- /* 730 */ 188, 1403, 1641, 1486, 2056, 1431, 1440, 1953, 2113, 2052,
- /* 740 */ 12, 1988, 2110, 2111, 101, 1955, 620, 1957, 1958, 615,
- /* 750 */ 64, 610, 1922, 63, 1376, 1922, 1374, 1584, 2041, 31,
- /* 760 */ 2051, 1922, 707, 2038, 1606, 36, 35, 1605, 225, 42,
- /* 770 */ 40, 39, 38, 37, 9, 1604, 1087, 1457, 1458, 1379,
- /* 780 */ 1380, 702, 1430, 1433, 1434, 1435, 1436, 1437, 1438, 1439,
- /* 790 */ 612, 608, 1448, 1449, 1451, 1452, 1453, 1454, 1456, 1459,
- /* 800 */ 2, 318, 1384, 1398, 30, 1603, 1431, 1440, 1922, 710,
- /* 810 */ 436, 1922, 155, 449, 1491, 1089, 448, 1092, 1093, 1922,
- /* 820 */ 602, 1754, 2013, 282, 257, 1376, 1664, 1374, 82, 321,
- /* 830 */ 1847, 420, 531, 450, 529, 9, 422, 7, 166, 1834,
- /* 840 */ 604, 183, 2013, 6, 700, 696, 692, 688, 280, 1922,
- /* 850 */ 1379, 1380, 1726, 1430, 1433, 1434, 1435, 1436, 1437, 1438,
- /* 860 */ 1439, 612, 608, 1448, 1449, 1451, 1452, 1453, 1454, 1456,
- /* 870 */ 1459, 2, 1804, 1403, 235, 36, 35, 334, 1400, 42,
- /* 880 */ 40, 39, 38, 37, 98, 1847, 607, 273, 1803, 410,
- /* 890 */ 645, 684, 683, 682, 681, 371, 187, 680, 679, 135,
- /* 900 */ 674, 673, 672, 671, 670, 669, 668, 148, 664, 663,
- /* 910 */ 662, 370, 369, 659, 658, 657, 656, 655, 646, 446,
- /* 920 */ 596, 1795, 441, 440, 439, 438, 435, 434, 433, 432,
- /* 930 */ 431, 427, 426, 425, 424, 335, 417, 416, 415, 1381,
- /* 940 */ 412, 411, 332, 156, 1092, 1093, 36, 35, 295, 1387,
- /* 950 */ 42, 40, 39, 38, 37, 1602, 1601, 260, 1954, 652,
- /* 960 */ 666, 650, 293, 66, 1795, 289, 65, 651, 1781, 1521,
- /* 970 */ 1795, 667, 1740, 1721, 1346, 48, 229, 3, 146, 145,
- /* 980 */ 649, 648, 647, 143, 193, 455, 453, 36, 35, 1972,
- /* 990 */ 423, 42, 40, 39, 38, 37, 502, 617, 1943, 1922,
- /* 1000 */ 1922, 600, 1922, 652, 616, 1736, 36, 35, 2061, 1518,
- /* 1010 */ 42, 40, 39, 38, 37, 428, 234, 233, 501, 1432,
- /* 1020 */ 58, 600, 146, 145, 649, 648, 647, 143, 1476, 1953,
- /* 1030 */ 154, 600, 1751, 1988, 1561, 429, 100, 1955, 620, 1957,
- /* 1040 */ 1958, 615, 25, 610, 144, 476, 1945, 1518, 2129, 137,
- /* 1050 */ 2041, 125, 1751, 407, 355, 2037, 83, 1738, 67, 99,
- /* 1060 */ 600, 1954, 1751, 36, 35, 2075, 408, 42, 40, 39,
- /* 1070 */ 38, 37, 36, 35, 1748, 1734, 42, 40, 39, 38,
- /* 1080 */ 37, 600, 216, 218, 570, 214, 217, 600, 1654, 1383,
- /* 1090 */ 220, 1751, 1972, 219, 1647, 139, 51, 74, 73, 403,
- /* 1100 */ 617, 542, 180, 600, 60, 1922, 1954, 616, 75, 1645,
- /* 1110 */ 514, 222, 1751, 1941, 221, 239, 516, 582, 1751, 45,
- /* 1120 */ 317, 1593, 1594, 391, 1936, 389, 385, 381, 378, 375,
- /* 1130 */ 263, 519, 1953, 600, 1751, 600, 1988, 1972, 1611, 100,
- /* 1140 */ 1955, 620, 1957, 1958, 615, 617, 610, 270, 140, 597,
- /* 1150 */ 1922, 2129, 616, 2041, 1932, 1938, 1548, 355, 2037, 1706,
- /* 1160 */ 1541, 600, 600, 230, 1751, 610, 1751, 241, 2103, 176,
- /* 1170 */ 142, 1322, 611, 50, 144, 598, 276, 1953, 545, 1954,
- /* 1180 */ 60, 1988, 268, 252, 100, 1955, 620, 1957, 1958, 615,
- /* 1190 */ 660, 610, 1751, 1751, 358, 357, 2129, 600, 2041, 45,
- /* 1200 */ 592, 45, 355, 2037, 1389, 11, 10, 661, 644, 96,
- /* 1210 */ 1972, 368, 1154, 2060, 2081, 1455, 624, 1382, 617, 93,
- /* 1220 */ 211, 584, 272, 1922, 374, 616, 1206, 1591, 1751, 1152,
- /* 1230 */ 209, 554, 1492, 246, 1954, 162, 1386, 142, 1973, 372,
- /* 1240 */ 1450, 494, 490, 486, 482, 208, 144, 1856, 1635, 126,
- /* 1250 */ 1953, 1441, 1381, 288, 1988, 1792, 142, 100, 1955, 620,
- /* 1260 */ 1957, 1958, 615, 546, 610, 1972, 546, 2109, 1234, 2016,
- /* 1270 */ 2109, 2041, 1135, 617, 579, 355, 2037, 2071, 1922, 251,
- /* 1280 */ 616, 81, 2115, 173, 206, 2115, 173, 2110, 567, 1238,
- /* 1290 */ 2110, 567, 254, 1, 373, 4, 382, 331, 1245, 606,
- /* 1300 */ 377, 1243, 1339, 571, 283, 1953, 186, 1136, 147, 1988,
- /* 1310 */ 409, 1403, 100, 1955, 620, 1957, 1958, 615, 1857, 610,
- /* 1320 */ 413, 1590, 444, 418, 2014, 1398, 2041, 430, 1849, 437,
- /* 1330 */ 355, 2037, 443, 451, 452, 445, 546, 190, 454, 456,
- /* 1340 */ 2109, 1404, 457, 466, 1406, 470, 1954, 534, 469, 1405,
- /* 1350 */ 196, 205, 199, 198, 204, 2115, 173, 473, 471, 1407,
- /* 1360 */ 2110, 567, 1390, 472, 1385, 201, 474, 203, 78, 79,
- /* 1370 */ 478, 1109, 207, 197, 495, 496, 1954, 1972, 499, 497,
- /* 1380 */ 103, 1741, 1899, 213, 320, 617, 1898, 1393, 1395, 546,
- /* 1390 */ 1922, 1737, 616, 2109, 533, 284, 535, 215, 149, 608,
- /* 1400 */ 1448, 1449, 1451, 1452, 1453, 1454, 150, 1972, 2115, 173,
- /* 1410 */ 228, 536, 1739, 2110, 567, 617, 540, 1953, 1735, 151,
- /* 1420 */ 1922, 1988, 616, 152, 100, 1955, 620, 1957, 1958, 615,
- /* 1430 */ 231, 610, 1954, 543, 550, 537, 603, 2072, 2041, 590,
- /* 1440 */ 2082, 555, 355, 2037, 5, 552, 345, 1953, 2087, 558,
- /* 1450 */ 237, 1988, 1954, 240, 101, 1955, 620, 1957, 1958, 615,
- /* 1460 */ 2063, 610, 2086, 1972, 564, 548, 551, 549, 2041, 572,
- /* 1470 */ 250, 617, 2040, 2037, 247, 245, 1922, 346, 616, 575,
- /* 1480 */ 130, 248, 1518, 1972, 249, 163, 1402, 2057, 349, 583,
- /* 1490 */ 259, 617, 1408, 1861, 285, 593, 1922, 588, 616, 286,
- /* 1500 */ 589, 1870, 1869, 1953, 1868, 2108, 351, 1988, 88, 1752,
- /* 1510 */ 101, 1955, 620, 1957, 1958, 615, 287, 610, 90, 594,
- /* 1520 */ 1954, 253, 57, 618, 2041, 2022, 2132, 1988, 605, 2037,
- /* 1530 */ 101, 1955, 620, 1957, 1958, 615, 1954, 610, 92, 622,
- /* 1540 */ 279, 703, 1796, 1722, 2041, 704, 290, 706, 325, 2037,
- /* 1550 */ 49, 1972, 314, 322, 323, 294, 1916, 1915, 71, 617,
- /* 1560 */ 72, 292, 1914, 1913, 1922, 1910, 616, 1972, 379, 299,
- /* 1570 */ 1367, 313, 303, 380, 1368, 617, 179, 1908, 384, 386,
- /* 1580 */ 1922, 387, 616, 388, 1907, 390, 1906, 392, 1905, 394,
- /* 1590 */ 1904, 1953, 1342, 396, 1341, 1988, 1881, 1954, 159, 1955,
- /* 1600 */ 620, 1957, 1958, 615, 1880, 610, 401, 1953, 402, 1879,
- /* 1610 */ 1878, 1988, 1842, 1300, 159, 1955, 620, 1957, 1958, 615,
- /* 1620 */ 1841, 610, 1839, 136, 1838, 1837, 1840, 1836, 1972, 184,
- /* 1630 */ 419, 1830, 421, 1829, 1828, 1827, 617, 1835, 1833, 547,
- /* 1640 */ 2078, 1922, 1954, 616, 1832, 1831, 1826, 1825, 1824, 1823,
- /* 1650 */ 1822, 1821, 1820, 1819, 1818, 1817, 2079, 1816, 1815, 138,
- /* 1660 */ 1814, 1813, 1812, 1811, 1810, 1302, 1809, 1808, 1953, 1807,
- /* 1670 */ 1806, 447, 1988, 1972, 1181, 305, 1955, 620, 1957, 1958,
- /* 1680 */ 615, 617, 610, 1805, 1669, 1668, 1922, 1666, 616, 1630,
- /* 1690 */ 191, 1095, 1094, 1629, 192, 1894, 1888, 1877, 194, 202,
- /* 1700 */ 1876, 1859, 1730, 1954, 69, 1128, 1942, 1665, 1663, 1661,
- /* 1710 */ 1659, 70, 168, 1953, 479, 195, 1657, 1988, 462, 563,
- /* 1720 */ 160, 1955, 620, 1957, 1958, 615, 1954, 610, 464, 200,
- /* 1730 */ 480, 481, 1644, 483, 1972, 1643, 484, 1626, 485, 350,
- /* 1740 */ 487, 491, 617, 489, 1732, 1249, 59, 1922, 1731, 616,
- /* 1750 */ 1250, 488, 493, 1172, 1171, 1170, 1169, 1972, 675, 492,
- /* 1760 */ 1166, 677, 1164, 1165, 1163, 614, 1655, 340, 1648, 341,
- /* 1770 */ 1922, 1646, 616, 2131, 1953, 212, 517, 342, 1988, 1625,
- /* 1780 */ 1624, 312, 1955, 620, 1957, 1958, 615, 1954, 610, 520,
- /* 1790 */ 1623, 522, 524, 102, 526, 1357, 1356, 1953, 530, 1893,
- /* 1800 */ 1348, 1988, 1887, 53, 311, 1955, 620, 1957, 1958, 615,
- /* 1810 */ 1875, 610, 1873, 2007, 538, 1874, 2114, 1954, 1972, 17,
- /* 1820 */ 1359, 14, 56, 360, 244, 24, 617, 1563, 26, 236,
- /* 1830 */ 243, 1922, 238, 616, 1547, 1540, 161, 242, 1943, 28,
- /* 1840 */ 1954, 27, 18, 539, 84, 61, 1583, 1584, 1972, 19,
- /* 1850 */ 15, 232, 1578, 362, 343, 1577, 617, 347, 1953, 153,
- /* 1860 */ 1582, 1922, 1988, 616, 1581, 312, 1955, 620, 1957, 1958,
- /* 1870 */ 615, 1972, 610, 348, 256, 55, 1872, 1515, 1514, 617,
- /* 1880 */ 164, 544, 1871, 261, 1922, 1954, 616, 1858, 1953, 20,
- /* 1890 */ 87, 264, 1988, 262, 1545, 312, 1955, 620, 1957, 1958,
- /* 1900 */ 615, 1954, 610, 269, 86, 93, 89, 274, 21, 10,
- /* 1910 */ 1391, 532, 1445, 1991, 609, 1988, 1972, 271, 307, 1955,
- /* 1920 */ 620, 1957, 1958, 615, 617, 610, 1443, 34, 591, 1922,
- /* 1930 */ 1442, 616, 1972, 165, 13, 22, 54, 177, 1423, 1415,
- /* 1940 */ 617, 23, 625, 621, 1235, 1922, 623, 616, 363, 1467,
- /* 1950 */ 1232, 628, 627, 630, 1954, 1229, 1953, 1477, 631, 633,
- /* 1960 */ 1988, 1223, 634, 296, 1955, 620, 1957, 1958, 615, 1221,
- /* 1970 */ 610, 619, 1953, 636, 637, 1212, 1988, 1227, 643, 297,
- /* 1980 */ 1955, 620, 1957, 1958, 615, 1972, 610, 8, 1226, 1225,
- /* 1990 */ 1466, 1224, 94, 617, 277, 95, 1244, 1240, 1922, 1954,
- /* 2000 */ 616, 68, 1160, 1126, 653, 1159, 1158, 1157, 1156, 1155,
- /* 2010 */ 1179, 1153, 1151, 1150, 1149, 665, 1147, 1146, 1145, 1144,
- /* 2020 */ 1143, 1142, 1141, 1174, 278, 1953, 1176, 1138, 1137, 1988,
- /* 2030 */ 1972, 1134, 298, 1955, 620, 1957, 1958, 615, 617, 610,
- /* 2040 */ 1133, 1132, 1131, 1922, 1662, 616, 685, 686, 687, 1660,
- /* 2050 */ 689, 690, 1954, 691, 1658, 693, 694, 695, 1656, 697,
- /* 2060 */ 698, 699, 1642, 701, 1084, 1622, 709, 281, 1954, 705,
- /* 2070 */ 1953, 1597, 1377, 291, 1988, 1597, 708, 304, 1955, 620,
- /* 2080 */ 1957, 1958, 615, 1972, 610, 1597, 1597, 1597, 1597, 1597,
- /* 2090 */ 1597, 617, 1597, 1597, 1597, 1597, 1922, 1597, 616, 1972,
- /* 2100 */ 1597, 1597, 1597, 1597, 1597, 1597, 1597, 617, 1597, 1597,
- /* 2110 */ 1597, 1597, 1922, 1954, 616, 1597, 1597, 1597, 1597, 1597,
- /* 2120 */ 1597, 1597, 1597, 1953, 1597, 1597, 1597, 1988, 1597, 1597,
- /* 2130 */ 308, 1955, 620, 1957, 1958, 615, 1597, 610, 1597, 1953,
- /* 2140 */ 1597, 1597, 1597, 1988, 1972, 1597, 300, 1955, 620, 1957,
- /* 2150 */ 1958, 615, 617, 610, 1597, 1597, 1597, 1922, 1597, 616,
- /* 2160 */ 1597, 1597, 1597, 1597, 1597, 1597, 1954, 1597, 1597, 1597,
- /* 2170 */ 1597, 1597, 1597, 1597, 1597, 1597, 1597, 1597, 1597, 1597,
- /* 2180 */ 1597, 1597, 1954, 1597, 1953, 1597, 1597, 1597, 1988, 1597,
- /* 2190 */ 1597, 309, 1955, 620, 1957, 1958, 615, 1972, 610, 1597,
- /* 2200 */ 1597, 1597, 1597, 1597, 1597, 617, 1597, 1597, 1597, 1597,
- /* 2210 */ 1922, 1597, 616, 1972, 1597, 1597, 1597, 1597, 1597, 1597,
- /* 2220 */ 1597, 617, 1597, 1597, 1597, 1597, 1922, 1954, 616, 1597,
- /* 2230 */ 1597, 1597, 1597, 1597, 1597, 1597, 1597, 1953, 1597, 1597,
- /* 2240 */ 1597, 1988, 1597, 1597, 301, 1955, 620, 1957, 1958, 615,
- /* 2250 */ 1954, 610, 1597, 1953, 1597, 1597, 1597, 1988, 1972, 1597,
- /* 2260 */ 310, 1955, 620, 1957, 1958, 615, 617, 610, 1597, 1597,
- /* 2270 */ 1597, 1922, 1597, 616, 1597, 1597, 1597, 1597, 1597, 1597,
- /* 2280 */ 1954, 1972, 1597, 1597, 1597, 1597, 1597, 1597, 1597, 617,
- /* 2290 */ 1597, 1597, 1597, 1597, 1922, 1597, 616, 1597, 1953, 1597,
- /* 2300 */ 1597, 1597, 1988, 1597, 1597, 302, 1955, 620, 1957, 1958,
- /* 2310 */ 615, 1972, 610, 1597, 1597, 1597, 1597, 1597, 1597, 617,
- /* 2320 */ 1597, 1953, 1597, 1597, 1922, 1988, 616, 1597, 315, 1955,
- /* 2330 */ 620, 1957, 1958, 615, 1597, 610, 1597, 1597, 1597, 1597,
- /* 2340 */ 1597, 1597, 1597, 1597, 1597, 1597, 1597, 1597, 1597, 1597,
- /* 2350 */ 1597, 1953, 1597, 1597, 1597, 1988, 1954, 1597, 316, 1955,
- /* 2360 */ 620, 1957, 1958, 615, 1597, 610, 1597, 1597, 1597, 1597,
- /* 2370 */ 1597, 1597, 1597, 1597, 1597, 1597, 1597, 1597, 1954, 1597,
- /* 2380 */ 1597, 1597, 1597, 1597, 1597, 1597, 1597, 1972, 1597, 1597,
- /* 2390 */ 1597, 1597, 1597, 1597, 1597, 617, 1597, 1597, 1597, 1597,
- /* 2400 */ 1922, 1597, 616, 1597, 1597, 1597, 1597, 1597, 1597, 1972,
- /* 2410 */ 1597, 1597, 1597, 1597, 1597, 1597, 1597, 617, 1597, 1597,
- /* 2420 */ 1597, 1597, 1922, 1597, 616, 1597, 1597, 1953, 1597, 1597,
- /* 2430 */ 1597, 1988, 1597, 1954, 1966, 1955, 620, 1957, 1958, 615,
- /* 2440 */ 1597, 610, 1597, 1597, 1597, 1597, 1597, 1597, 1597, 1953,
- /* 2450 */ 1597, 1597, 1597, 1988, 1597, 1597, 1965, 1955, 620, 1957,
- /* 2460 */ 1958, 615, 1597, 610, 1972, 1597, 1597, 1597, 1597, 1597,
- /* 2470 */ 1597, 1597, 617, 1597, 1597, 1597, 1597, 1922, 1954, 616,
- /* 2480 */ 1597, 1597, 1597, 1597, 1597, 1597, 1597, 1597, 1597, 1597,
- /* 2490 */ 1597, 1597, 1597, 1597, 1597, 1597, 1597, 1597, 1597, 1597,
- /* 2500 */ 1597, 1597, 1597, 1597, 1953, 1597, 1597, 1597, 1988, 1972,
- /* 2510 */ 1597, 1964, 1955, 620, 1957, 1958, 615, 617, 610, 1597,
- /* 2520 */ 1597, 1597, 1922, 1954, 616, 1597, 1597, 1597, 1597, 1597,
- /* 2530 */ 1597, 1597, 1597, 1597, 1597, 1597, 1597, 1597, 1597, 1954,
- /* 2540 */ 1597, 1597, 1597, 1597, 1597, 1597, 1597, 1597, 1597, 1953,
- /* 2550 */ 1597, 1597, 1597, 1988, 1972, 1597, 327, 1955, 620, 1957,
- /* 2560 */ 1958, 615, 617, 610, 1597, 1597, 1597, 1922, 1597, 616,
- /* 2570 */ 1972, 1597, 1597, 1597, 1597, 1597, 1597, 1597, 617, 1597,
- /* 2580 */ 1597, 1597, 1597, 1922, 1954, 616, 1597, 1597, 1597, 1597,
- /* 2590 */ 1597, 1597, 1597, 1597, 1953, 1597, 1597, 1597, 1988, 1597,
- /* 2600 */ 1597, 328, 1955, 620, 1957, 1958, 615, 1954, 610, 1597,
- /* 2610 */ 1953, 1597, 1597, 1597, 1988, 1972, 1597, 324, 1955, 620,
- /* 2620 */ 1957, 1958, 615, 617, 610, 1597, 1597, 1597, 1922, 1597,
- /* 2630 */ 616, 1597, 1597, 1597, 1597, 1597, 1597, 1954, 1972, 1597,
- /* 2640 */ 1597, 1597, 1597, 1597, 1597, 1597, 617, 1597, 1597, 1597,
- /* 2650 */ 1597, 1922, 1597, 616, 1597, 1953, 1597, 1597, 1597, 1988,
- /* 2660 */ 1597, 1597, 329, 1955, 620, 1957, 1958, 615, 1972, 610,
- /* 2670 */ 1597, 1597, 1597, 1597, 1597, 1597, 617, 1597, 618, 1597,
- /* 2680 */ 1597, 1922, 1988, 616, 1597, 307, 1955, 620, 1957, 1958,
- /* 2690 */ 615, 1597, 610, 1597, 1597, 1597, 1597, 1597, 1597, 1597,
- /* 2700 */ 1597, 1597, 1597, 1597, 1597, 1597, 1597, 1597, 1953, 1597,
- /* 2710 */ 1597, 1597, 1988, 1597, 1597, 306, 1955, 620, 1957, 1958,
- /* 2720 */ 615, 1597, 610,
+ /* 0 */ 463, 370, 464, 1647, 1810, 1812, 404, 1969, 1755, 33,
+ /* 10 */ 277, 170, 43, 41, 1536, 1634, 1753, 571, 168, 1951,
+ /* 20 */ 365, 2126, 1386, 1955, 1804, 42, 40, 39, 38, 37,
+ /* 30 */ 1969, 605, 1609, 1466, 1951, 1384, 570, 174, 1987, 335,
+ /* 40 */ 1864, 2127, 572, 1811, 1812, 52, 622, 591, 550, 1947,
+ /* 50 */ 1953, 1937, 2126, 621, 11, 10, 1411, 589, 1461, 1937,
+ /* 60 */ 615, 1987, 1764, 16, 1947, 1953, 347, 2132, 174, 586,
+ /* 70 */ 1392, 1412, 2127, 572, 1937, 615, 621, 462, 1968, 604,
+ /* 80 */ 467, 1653, 2003, 43, 41, 161, 1970, 625, 1972, 1973,
+ /* 90 */ 620, 365, 615, 1386, 479, 12, 1873, 380, 604, 550,
+ /* 100 */ 605, 1968, 159, 2126, 1466, 2003, 1384, 1718, 101, 1970,
+ /* 110 */ 625, 1972, 1973, 620, 124, 615, 260, 712, 2132, 174,
+ /* 120 */ 171, 502, 2056, 2127, 572, 229, 359, 2052, 1794, 1461,
+ /* 130 */ 604, 1764, 1468, 1469, 16, 97, 605, 573, 2147, 550,
+ /* 140 */ 176, 1392, 583, 2126, 472, 94, 464, 1647, 2082, 1509,
+ /* 150 */ 124, 157, 1182, 59, 46, 86, 297, 507, 2132, 174,
+ /* 160 */ 592, 1442, 1451, 2127, 572, 471, 12, 1764, 467, 1653,
+ /* 170 */ 295, 67, 356, 132, 66, 1877, 2071, 517, 516, 515,
+ /* 180 */ 1387, 1680, 1385, 1265, 1266, 129, 511, 1184, 712, 1956,
+ /* 190 */ 510, 357, 194, 459, 457, 509, 514, 1318, 1319, 156,
+ /* 200 */ 1951, 508, 2068, 1468, 1469, 46, 1390, 1391, 1766, 1441,
+ /* 210 */ 1444, 1445, 1446, 1447, 1448, 1449, 1450, 617, 613, 1459,
+ /* 220 */ 1460, 1462, 1463, 1464, 1465, 1467, 1470, 2, 59, 605,
+ /* 230 */ 1947, 1953, 1442, 1451, 257, 2064, 582, 590, 125, 581,
+ /* 240 */ 1413, 615, 2126, 179, 469, 1411, 517, 516, 515, 168,
+ /* 250 */ 465, 1387, 227, 1385, 129, 511, 226, 570, 174, 510,
+ /* 260 */ 1764, 50, 2127, 572, 509, 514, 549, 100, 36, 35,
+ /* 270 */ 508, 1865, 42, 40, 39, 38, 37, 1390, 1391, 378,
+ /* 280 */ 1441, 1444, 1445, 1446, 1447, 1448, 1449, 1450, 617, 613,
+ /* 290 */ 1459, 1460, 1462, 1463, 1464, 1465, 1467, 1470, 2, 522,
+ /* 300 */ 9, 43, 41, 177, 177, 75, 74, 407, 92, 365,
+ /* 310 */ 181, 1386, 83, 323, 532, 1987, 345, 98, 533, 1969,
+ /* 320 */ 59, 550, 1466, 565, 1384, 2126, 1817, 145, 225, 319,
+ /* 330 */ 1757, 133, 395, 358, 393, 389, 385, 382, 379, 1756,
+ /* 340 */ 2132, 174, 1815, 525, 1955, 2127, 572, 1461, 519, 368,
+ /* 350 */ 1987, 63, 16, 224, 371, 1951, 1574, 156, 622, 1392,
+ /* 360 */ 2131, 481, 156, 1937, 564, 621, 1766, 39, 38, 37,
+ /* 370 */ 591, 1766, 43, 41, 1471, 566, 59, 1413, 177, 51,
+ /* 380 */ 365, 1969, 1386, 259, 12, 1947, 1953, 348, 59, 65,
+ /* 390 */ 1968, 81, 64, 1466, 2003, 1384, 615, 101, 1970, 625,
+ /* 400 */ 1972, 1973, 620, 9, 615, 128, 712, 135, 1497, 142,
+ /* 410 */ 2027, 2056, 1987, 1742, 1759, 359, 2052, 600, 1461, 1873,
+ /* 420 */ 622, 1468, 1469, 268, 269, 1937, 1096, 621, 267, 1740,
+ /* 430 */ 1392, 1222, 647, 646, 645, 1226, 644, 1228, 1229, 643,
+ /* 440 */ 1231, 640, 59, 1237, 637, 1239, 1240, 634, 631, 650,
+ /* 450 */ 1442, 1451, 1968, 1597, 1412, 44, 2003, 1611, 186, 102,
+ /* 460 */ 1970, 625, 1972, 1973, 620, 1098, 615, 1101, 1102, 1387,
+ /* 470 */ 177, 1385, 403, 2056, 402, 481, 1411, 712, 2053, 410,
+ /* 480 */ 30, 123, 122, 121, 120, 119, 118, 117, 116, 115,
+ /* 490 */ 1502, 659, 1468, 1469, 78, 1390, 1391, 77, 1441, 1444,
+ /* 500 */ 1445, 1446, 1447, 1448, 1449, 1450, 617, 613, 1459, 1460,
+ /* 510 */ 1462, 1463, 1464, 1465, 1467, 1470, 2, 513, 512, 321,
+ /* 520 */ 259, 1442, 1451, 1612, 114, 605, 177, 113, 112, 111,
+ /* 530 */ 110, 109, 108, 107, 106, 105, 81, 659, 177, 408,
+ /* 540 */ 1387, 158, 1385, 1623, 114, 1410, 1633, 113, 112, 111,
+ /* 550 */ 110, 109, 108, 107, 106, 105, 1764, 36, 35, 1760,
+ /* 560 */ 1969, 42, 40, 39, 38, 37, 1390, 1391, 47, 1441,
+ /* 570 */ 1444, 1445, 1446, 1447, 1448, 1449, 1450, 617, 613, 1459,
+ /* 580 */ 1460, 1462, 1463, 1464, 1465, 1467, 1470, 2, 43, 41,
+ /* 590 */ 1937, 1987, 177, 25, 411, 446, 365, 592, 1386, 586,
+ /* 600 */ 340, 1115, 1392, 1114, 1937, 561, 621, 412, 9, 1466,
+ /* 610 */ 7, 1384, 1878, 1817, 1817, 607, 211, 2028, 36, 35,
+ /* 620 */ 369, 332, 42, 40, 39, 38, 37, 6, 1632, 1815,
+ /* 630 */ 1815, 1968, 1116, 1955, 1461, 2003, 531, 583, 101, 1970,
+ /* 640 */ 625, 1972, 1973, 620, 1951, 615, 1392, 1563, 605, 529,
+ /* 650 */ 171, 527, 2056, 190, 189, 583, 359, 2052, 2071, 43,
+ /* 660 */ 41, 341, 409, 339, 338, 671, 504, 365, 132, 1386,
+ /* 670 */ 506, 44, 1937, 328, 1947, 1953, 360, 1749, 2083, 1764,
+ /* 680 */ 1466, 399, 1384, 1414, 2067, 615, 132, 571, 1540, 567,
+ /* 690 */ 562, 2126, 505, 712, 1411, 558, 557, 1561, 1562, 1564,
+ /* 700 */ 1565, 1566, 545, 401, 397, 1461, 570, 174, 1468, 1469,
+ /* 710 */ 1631, 2127, 572, 228, 1495, 2131, 1630, 1392, 177, 2126,
+ /* 720 */ 36, 35, 605, 1751, 42, 40, 39, 38, 37, 173,
+ /* 730 */ 2064, 2065, 1414, 130, 2069, 2130, 418, 1442, 1451, 2127,
+ /* 740 */ 2129, 2131, 12, 2071, 1476, 2126, 585, 172, 2064, 2065,
+ /* 750 */ 1411, 130, 2069, 1764, 1937, 1747, 1387, 609, 1385, 2028,
+ /* 760 */ 1937, 2130, 506, 1629, 712, 2127, 2128, 36, 35, 2066,
+ /* 770 */ 1496, 42, 40, 39, 38, 37, 1361, 1362, 134, 1468,
+ /* 780 */ 1469, 2027, 1390, 1391, 505, 1441, 1444, 1445, 1446, 1447,
+ /* 790 */ 1448, 1449, 1450, 617, 613, 1459, 1460, 1462, 1463, 1464,
+ /* 800 */ 1465, 1467, 1470, 2, 320, 2130, 1409, 1937, 1442, 1451,
+ /* 810 */ 1115, 232, 1114, 440, 683, 681, 453, 36, 35, 452,
+ /* 820 */ 1860, 42, 40, 39, 38, 37, 183, 1387, 1677, 1385,
+ /* 830 */ 651, 182, 1529, 1808, 424, 1443, 454, 1628, 1533, 426,
+ /* 840 */ 1627, 1116, 32, 363, 1490, 1491, 1492, 1493, 1494, 1498,
+ /* 850 */ 1499, 1500, 1501, 1390, 1391, 1552, 1441, 1444, 1445, 1446,
+ /* 860 */ 1447, 1448, 1449, 1450, 617, 613, 1459, 1460, 1462, 1463,
+ /* 870 */ 1464, 1465, 1467, 1470, 2, 237, 29, 1626, 616, 1625,
+ /* 880 */ 336, 1937, 36, 35, 1937, 649, 42, 40, 39, 38,
+ /* 890 */ 37, 1443, 414, 689, 688, 687, 686, 375, 1622, 685,
+ /* 900 */ 684, 136, 679, 678, 677, 676, 675, 674, 673, 149,
+ /* 910 */ 669, 668, 667, 374, 373, 664, 663, 662, 661, 660,
+ /* 920 */ 1621, 1937, 450, 1937, 1969, 445, 444, 443, 442, 439,
+ /* 930 */ 438, 437, 436, 435, 431, 430, 429, 428, 337, 421,
+ /* 940 */ 420, 419, 1937, 416, 415, 334, 1620, 1969, 1619, 1860,
+ /* 950 */ 1860, 291, 362, 361, 1794, 1987, 1618, 605, 605, 1414,
+ /* 960 */ 184, 188, 1400, 622, 1937, 605, 605, 1617, 1937, 1741,
+ /* 970 */ 621, 432, 433, 1466, 156, 1393, 1411, 583, 1987, 372,
+ /* 980 */ 480, 1604, 672, 1767, 1734, 1817, 622, 1624, 1764, 1764,
+ /* 990 */ 1937, 1937, 1937, 621, 377, 1968, 1764, 1764, 1461, 2003,
+ /* 1000 */ 1937, 1816, 101, 1970, 625, 1972, 1973, 620, 132, 615,
+ /* 1010 */ 1392, 1937, 1101, 1102, 2146, 1616, 2056, 1719, 1968, 1615,
+ /* 1020 */ 359, 2052, 2003, 1847, 1614, 101, 1970, 625, 1972, 1973,
+ /* 1030 */ 620, 2090, 615, 1969, 575, 31, 550, 2146, 2096, 2056,
+ /* 1040 */ 2126, 36, 35, 359, 2052, 42, 40, 39, 38, 37,
+ /* 1050 */ 655, 2076, 1529, 1808, 2120, 2132, 174, 611, 1924, 1937,
+ /* 1060 */ 2127, 572, 656, 1937, 1987, 1808, 574, 212, 1937, 175,
+ /* 1070 */ 2064, 2065, 622, 130, 2069, 210, 657, 1937, 1603, 621,
+ /* 1080 */ 1532, 1667, 163, 1660, 48, 138, 3, 126, 498, 494,
+ /* 1090 */ 490, 486, 209, 68, 254, 147, 146, 654, 653, 652,
+ /* 1100 */ 144, 578, 236, 518, 1968, 520, 387, 535, 2003, 534,
+ /* 1110 */ 1969, 101, 1970, 625, 1972, 1973, 620, 1443, 615, 605,
+ /* 1120 */ 1401, 217, 1396, 2146, 215, 2056, 1606, 1607, 82, 359,
+ /* 1130 */ 2052, 207, 1395, 1761, 1969, 665, 219, 235, 1386, 218,
+ /* 1140 */ 2075, 1987, 61, 76, 61, 241, 1404, 1406, 657, 622,
+ /* 1150 */ 1764, 1384, 605, 1658, 1937, 1394, 621, 1163, 613, 1459,
+ /* 1160 */ 1460, 1462, 1463, 1464, 1465, 1987, 140, 147, 146, 654,
+ /* 1170 */ 653, 652, 144, 622, 427, 523, 84, 612, 1937, 1969,
+ /* 1180 */ 621, 1968, 559, 1764, 221, 2003, 1392, 220, 101, 1970,
+ /* 1190 */ 625, 1972, 1973, 620, 1560, 615, 1559, 243, 206, 200,
+ /* 1200 */ 2031, 205, 2056, 45, 477, 1968, 359, 2052, 248, 2003,
+ /* 1210 */ 1987, 1739, 101, 1970, 625, 1972, 1973, 620, 622, 615,
+ /* 1220 */ 198, 11, 10, 1937, 2029, 621, 2056, 1988, 376, 265,
+ /* 1230 */ 359, 2052, 605, 712, 1969, 36, 35, 605, 1869, 42,
+ /* 1240 */ 40, 39, 38, 37, 1648, 141, 546, 143, 145, 61,
+ /* 1250 */ 1968, 587, 605, 605, 2003, 1331, 576, 101, 1970, 625,
+ /* 1260 */ 1972, 1973, 620, 1764, 615, 1987, 272, 602, 1764, 608,
+ /* 1270 */ 1805, 2056, 605, 622, 223, 359, 2052, 222, 1937, 1398,
+ /* 1280 */ 621, 270, 538, 1764, 1764, 2086, 603, 36, 35, 584,
+ /* 1290 */ 1969, 42, 40, 39, 38, 37, 1387, 597, 1385, 274,
+ /* 1300 */ 1215, 1503, 1397, 1764, 45, 1968, 1958, 45, 629, 2003,
+ /* 1310 */ 143, 145, 102, 1970, 625, 1972, 1973, 620, 657, 615,
+ /* 1320 */ 1487, 1987, 1390, 1391, 550, 579, 2056, 1654, 2126, 622,
+ /* 1330 */ 2055, 2052, 127, 605, 1937, 1969, 621, 147, 146, 654,
+ /* 1340 */ 653, 652, 144, 2132, 174, 666, 143, 278, 2127, 572,
+ /* 1350 */ 1144, 256, 253, 4, 1960, 1, 1452, 381, 1969, 290,
+ /* 1360 */ 1243, 1968, 1247, 1254, 1764, 2003, 1987, 1161, 102, 1970,
+ /* 1370 */ 625, 1972, 1973, 620, 622, 615, 707, 386, 333, 1937,
+ /* 1380 */ 1348, 621, 2056, 285, 1252, 1145, 610, 2052, 187, 1987,
+ /* 1390 */ 155, 413, 1414, 1870, 417, 448, 422, 619, 148, 1409,
+ /* 1400 */ 434, 1862, 1937, 441, 621, 447, 623, 455, 449, 191,
+ /* 1410 */ 2003, 456, 458, 102, 1970, 625, 1972, 1973, 620, 460,
+ /* 1420 */ 615, 1415, 461, 470, 1417, 473, 474, 2056, 197, 1968,
+ /* 1430 */ 199, 327, 2052, 2003, 1416, 475, 313, 1970, 625, 1972,
+ /* 1440 */ 1973, 620, 618, 615, 606, 2021, 1969, 1418, 202, 476,
+ /* 1450 */ 204, 478, 79, 80, 208, 1118, 482, 501, 539, 1915,
+ /* 1460 */ 503, 499, 1969, 500, 537, 322, 1754, 104, 214, 540,
+ /* 1470 */ 286, 2087, 541, 230, 1912, 1750, 216, 1987, 544, 233,
+ /* 1480 */ 547, 560, 150, 595, 151, 622, 2102, 1752, 1748, 152,
+ /* 1490 */ 1937, 153, 621, 1987, 5, 2101, 2078, 569, 1911, 247,
+ /* 1500 */ 555, 622, 553, 164, 249, 552, 1937, 251, 621, 250,
+ /* 1510 */ 554, 350, 556, 349, 563, 2149, 580, 1968, 1969, 2097,
+ /* 1520 */ 577, 2003, 1529, 239, 160, 1970, 625, 1972, 1973, 620,
+ /* 1530 */ 242, 615, 131, 1968, 2125, 255, 1413, 2003, 261, 1419,
+ /* 1540 */ 160, 1970, 625, 1972, 1973, 620, 1969, 615, 252, 1987,
+ /* 1550 */ 2072, 588, 1874, 353, 593, 287, 288, 622, 594, 1883,
+ /* 1560 */ 1882, 1881, 1937, 355, 621, 551, 2093, 598, 89, 599,
+ /* 1570 */ 58, 91, 289, 1765, 2037, 93, 627, 1987, 1735, 1809,
+ /* 1580 */ 292, 281, 2094, 709, 708, 622, 49, 711, 301, 1968,
+ /* 1590 */ 1937, 316, 621, 2003, 294, 315, 307, 1970, 625, 1972,
+ /* 1600 */ 1973, 620, 324, 615, 305, 296, 1931, 1930, 1969, 325,
+ /* 1610 */ 72, 1929, 1928, 73, 1925, 383, 384, 1968, 1378, 1379,
+ /* 1620 */ 715, 2003, 180, 1923, 161, 1970, 625, 1972, 1973, 620,
+ /* 1630 */ 388, 615, 390, 391, 284, 392, 1922, 394, 1921, 1987,
+ /* 1640 */ 568, 1920, 398, 396, 354, 1919, 1351, 622, 400, 167,
+ /* 1650 */ 1350, 1894, 1937, 1893, 621, 705, 701, 697, 693, 282,
+ /* 1660 */ 405, 1892, 406, 1969, 1309, 1855, 1854, 1852, 137, 1851,
+ /* 1670 */ 1850, 1853, 1849, 1848, 1846, 1845, 1844, 2148, 1891, 1968,
+ /* 1680 */ 185, 423, 1843, 2003, 425, 1842, 314, 1970, 625, 1972,
+ /* 1690 */ 1973, 620, 1841, 615, 1987, 99, 1840, 1839, 275, 1838,
+ /* 1700 */ 1837, 1836, 619, 1835, 1834, 1833, 1832, 1937, 1831, 621,
+ /* 1710 */ 1830, 1829, 1828, 1827, 1826, 1825, 1824, 1823, 1822, 139,
+ /* 1720 */ 1311, 1821, 1820, 451, 1819, 1969, 1190, 1682, 1681, 1679,
+ /* 1730 */ 1643, 601, 1818, 70, 1968, 195, 1957, 192, 2003, 193,
+ /* 1740 */ 1642, 313, 1970, 625, 1972, 1973, 620, 1104, 615, 466,
+ /* 1750 */ 2022, 169, 1103, 1907, 1901, 1969, 1987, 1890, 1889, 1872,
+ /* 1760 */ 196, 364, 71, 203, 622, 1743, 468, 1678, 262, 1937,
+ /* 1770 */ 201, 621, 1676, 1137, 483, 485, 1674, 487, 1672, 491,
+ /* 1780 */ 489, 1670, 484, 488, 1657, 1355, 1987, 231, 493, 497,
+ /* 1790 */ 495, 366, 1656, 492, 622, 496, 1968, 1639, 1745, 1937,
+ /* 1800 */ 2003, 621, 1258, 314, 1970, 625, 1972, 1973, 620, 1259,
+ /* 1810 */ 615, 1744, 1181, 1969, 1180, 680, 1173, 1179, 1178, 682,
+ /* 1820 */ 1175, 1174, 1172, 1668, 342, 1661, 1968, 213, 343, 1969,
+ /* 1830 */ 2003, 1659, 344, 314, 1970, 625, 1972, 1973, 620, 521,
+ /* 1840 */ 615, 60, 524, 1638, 1987, 1637, 1636, 526, 528, 530,
+ /* 1850 */ 1366, 1368, 622, 103, 1365, 1906, 1370, 1937, 24, 621,
+ /* 1860 */ 1987, 1357, 1900, 154, 542, 1888, 1886, 2131, 622, 1576,
+ /* 1870 */ 14, 18, 17, 1937, 1969, 621, 56, 62, 57, 245,
+ /* 1880 */ 15, 28, 19, 26, 536, 238, 246, 240, 2003, 1558,
+ /* 1890 */ 1969, 309, 1970, 625, 1972, 1973, 620, 1551, 615, 162,
+ /* 1900 */ 1968, 1958, 1591, 244, 2003, 1987, 53, 298, 1970, 625,
+ /* 1910 */ 1972, 1973, 620, 622, 615, 543, 234, 548, 1937, 27,
+ /* 1920 */ 621, 1987, 1590, 351, 346, 1596, 258, 1595, 1594, 622,
+ /* 1930 */ 352, 85, 165, 54, 1937, 1887, 621, 1597, 55, 1885,
+ /* 1940 */ 1526, 1884, 1871, 1525, 263, 1968, 20, 88, 264, 2003,
+ /* 1950 */ 276, 266, 299, 1970, 625, 1972, 1973, 620, 271, 615,
+ /* 1960 */ 21, 1968, 596, 273, 1556, 2003, 87, 1969, 300, 1970,
+ /* 1970 */ 625, 1972, 1973, 620, 94, 615, 90, 10, 1402, 2006,
+ /* 1980 */ 166, 178, 1456, 1434, 614, 628, 1454, 367, 626, 632,
+ /* 1990 */ 1478, 1969, 1453, 34, 8, 13, 1477, 22, 1987, 635,
+ /* 2000 */ 1426, 1488, 23, 1221, 638, 1244, 622, 630, 624, 1241,
+ /* 2010 */ 633, 1937, 636, 621, 1238, 1232, 639, 641, 1230, 642,
+ /* 2020 */ 1236, 648, 1987, 95, 1235, 1234, 96, 279, 1253, 1233,
+ /* 2030 */ 622, 69, 1249, 1169, 1135, 1937, 658, 621, 1968, 1168,
+ /* 2040 */ 1167, 1166, 2003, 1165, 1164, 306, 1970, 625, 1972, 1973,
+ /* 2050 */ 620, 1162, 615, 1969, 1160, 1159, 1158, 1188, 670, 280,
+ /* 2060 */ 1156, 1155, 1968, 1154, 1153, 1152, 2003, 1151, 1150, 310,
+ /* 2070 */ 1970, 625, 1972, 1973, 620, 1183, 615, 1185, 1147, 1146,
+ /* 2080 */ 1143, 1142, 1141, 1969, 1987, 1140, 1675, 690, 692, 691,
+ /* 2090 */ 1673, 694, 622, 1671, 696, 695, 698, 1937, 700, 621,
+ /* 2100 */ 1669, 699, 702, 704, 1655, 703, 706, 1093, 1635, 283,
+ /* 2110 */ 710, 1610, 714, 1388, 1987, 1610, 293, 713, 1610, 1610,
+ /* 2120 */ 1610, 1610, 622, 1610, 1968, 1610, 1610, 1937, 2003, 621,
+ /* 2130 */ 1610, 302, 1970, 625, 1972, 1973, 620, 1610, 615, 1610,
+ /* 2140 */ 1610, 1969, 1610, 1610, 1610, 1610, 1610, 1610, 1610, 1610,
+ /* 2150 */ 1610, 1610, 1610, 1610, 1968, 1610, 1610, 1969, 2003, 1610,
+ /* 2160 */ 1610, 311, 1970, 625, 1972, 1973, 620, 1610, 615, 1610,
+ /* 2170 */ 1610, 1610, 1987, 1610, 1610, 1610, 1610, 1610, 1610, 1610,
+ /* 2180 */ 622, 1610, 1610, 1610, 1610, 1937, 1610, 621, 1987, 1610,
+ /* 2190 */ 1610, 1610, 1610, 1610, 1610, 1610, 622, 1610, 1610, 1610,
+ /* 2200 */ 1610, 1937, 1969, 621, 1610, 1610, 1610, 1610, 1610, 1610,
+ /* 2210 */ 1610, 1610, 1968, 1610, 1610, 1610, 2003, 1610, 1969, 303,
+ /* 2220 */ 1970, 625, 1972, 1973, 620, 1610, 615, 1610, 1968, 1610,
+ /* 2230 */ 1610, 1610, 2003, 1987, 1610, 312, 1970, 625, 1972, 1973,
+ /* 2240 */ 620, 622, 615, 1610, 1610, 1610, 1937, 1610, 621, 1987,
+ /* 2250 */ 1610, 1610, 1610, 1610, 1610, 1610, 1610, 622, 1610, 1610,
+ /* 2260 */ 1610, 1610, 1937, 1610, 621, 1610, 1610, 1610, 1610, 1610,
+ /* 2270 */ 1610, 1610, 1610, 1968, 1610, 1610, 1610, 2003, 1610, 1610,
+ /* 2280 */ 304, 1970, 625, 1972, 1973, 620, 1610, 615, 1610, 1968,
+ /* 2290 */ 1610, 1610, 1610, 2003, 1610, 1969, 317, 1970, 625, 1972,
+ /* 2300 */ 1973, 620, 1610, 615, 1610, 1610, 1610, 1610, 1610, 1610,
+ /* 2310 */ 1610, 1610, 1610, 1610, 1610, 1610, 1610, 1610, 1610, 1969,
+ /* 2320 */ 1610, 1610, 1610, 1610, 1610, 1610, 1987, 1610, 1610, 1610,
+ /* 2330 */ 1610, 1610, 1610, 1610, 622, 1610, 1610, 1610, 1610, 1937,
+ /* 2340 */ 1610, 621, 1610, 1610, 1610, 1610, 1610, 1610, 1610, 1610,
+ /* 2350 */ 1987, 1610, 1610, 1610, 1610, 1610, 1610, 1610, 622, 1610,
+ /* 2360 */ 1610, 1610, 1610, 1937, 1610, 621, 1968, 1610, 1610, 1610,
+ /* 2370 */ 2003, 1610, 1610, 318, 1970, 625, 1972, 1973, 620, 1610,
+ /* 2380 */ 615, 1969, 1610, 1610, 1610, 1610, 1610, 1610, 1610, 1610,
+ /* 2390 */ 1968, 1610, 1610, 1610, 2003, 1610, 1610, 1981, 1970, 625,
+ /* 2400 */ 1972, 1973, 620, 1610, 615, 1610, 1610, 1610, 1610, 1610,
+ /* 2410 */ 1610, 1969, 1987, 1610, 1610, 1610, 1610, 1610, 1610, 1610,
+ /* 2420 */ 622, 1610, 1610, 1610, 1610, 1937, 1610, 621, 1610, 1610,
+ /* 2430 */ 1610, 1610, 1610, 1610, 1610, 1610, 1610, 1610, 1610, 1610,
+ /* 2440 */ 1610, 1610, 1987, 1610, 1610, 1610, 1610, 1610, 1610, 1610,
+ /* 2450 */ 622, 1610, 1968, 1610, 1610, 1937, 2003, 621, 1610, 1980,
+ /* 2460 */ 1970, 625, 1972, 1973, 620, 1610, 615, 1610, 1610, 1969,
+ /* 2470 */ 1610, 1610, 1610, 1610, 1610, 1610, 1610, 1610, 1610, 1610,
+ /* 2480 */ 1610, 1610, 1968, 1610, 1610, 1969, 2003, 1610, 1610, 1979,
+ /* 2490 */ 1970, 625, 1972, 1973, 620, 1610, 615, 1610, 1610, 1610,
+ /* 2500 */ 1987, 1610, 1610, 1610, 1610, 1610, 1610, 1610, 622, 1610,
+ /* 2510 */ 1610, 1610, 1610, 1937, 1610, 621, 1987, 1610, 1610, 1610,
+ /* 2520 */ 1610, 1610, 1610, 1610, 622, 1610, 1610, 1610, 1610, 1937,
+ /* 2530 */ 1969, 621, 1610, 1610, 1610, 1610, 1610, 1610, 1610, 1610,
+ /* 2540 */ 1968, 1610, 1610, 1610, 2003, 1610, 1969, 329, 1970, 625,
+ /* 2550 */ 1972, 1973, 620, 1610, 615, 1610, 1968, 1610, 1610, 1610,
+ /* 2560 */ 2003, 1987, 1610, 330, 1970, 625, 1972, 1973, 620, 622,
+ /* 2570 */ 615, 1610, 1610, 1610, 1937, 1610, 621, 1987, 1610, 1610,
+ /* 2580 */ 1610, 1610, 1610, 1610, 1610, 622, 1610, 1610, 1610, 1610,
+ /* 2590 */ 1937, 1610, 621, 1610, 1610, 1610, 1610, 1610, 1610, 1610,
+ /* 2600 */ 1610, 1968, 1610, 1610, 1610, 2003, 1610, 1610, 326, 1970,
+ /* 2610 */ 625, 1972, 1973, 620, 1610, 615, 1610, 1968, 1610, 1610,
+ /* 2620 */ 1610, 2003, 1610, 1969, 331, 1970, 625, 1972, 1973, 620,
+ /* 2630 */ 1610, 615, 1610, 1610, 1610, 1610, 1610, 1610, 1610, 1610,
+ /* 2640 */ 1610, 1610, 1610, 1610, 1610, 1610, 1610, 1969, 1610, 1610,
+ /* 2650 */ 1610, 1610, 1610, 1610, 1987, 1610, 1610, 1610, 1610, 1610,
+ /* 2660 */ 1610, 1610, 622, 1610, 1610, 1610, 1610, 1937, 1610, 621,
+ /* 2670 */ 1610, 1610, 1610, 1610, 1610, 1610, 1610, 1610, 1987, 1610,
+ /* 2680 */ 1610, 1610, 1610, 1610, 1610, 1610, 622, 1610, 1610, 1610,
+ /* 2690 */ 1610, 1937, 1610, 621, 623, 1610, 1610, 1610, 2003, 1610,
+ /* 2700 */ 1610, 309, 1970, 625, 1972, 1973, 620, 1610, 615, 1610,
+ /* 2710 */ 1610, 1610, 1610, 1610, 1610, 1610, 1610, 1610, 1968, 1610,
+ /* 2720 */ 1610, 1610, 2003, 1610, 1610, 308, 1970, 625, 1972, 1973,
+ /* 2730 */ 620, 1610, 615,
};
static const YYCODETYPE yy_lookahead[] = {
- /* 0 */ 329, 348, 331, 332, 429, 333, 333, 429, 433, 356,
- /* 10 */ 358, 433, 12, 13, 14, 14, 15, 16, 365, 347,
- /* 20 */ 20, 369, 22, 448, 449, 20, 354, 449, 453, 454,
- /* 30 */ 325, 453, 454, 33, 20, 35, 364, 364, 329, 333,
- /* 40 */ 331, 332, 8, 9, 358, 333, 12, 13, 14, 15,
- /* 50 */ 16, 399, 400, 401, 391, 369, 356, 333, 58, 14,
- /* 60 */ 20, 356, 410, 63, 367, 20, 356, 370, 371, 364,
- /* 70 */ 70, 20, 20, 363, 369, 340, 371, 377, 378, 373,
- /* 80 */ 345, 356, 372, 12, 13, 399, 400, 401, 364, 364,
- /* 90 */ 62, 20, 380, 22, 382, 95, 410, 63, 425, 426,
- /* 100 */ 427, 396, 429, 430, 33, 400, 35, 3, 403, 404,
- /* 110 */ 405, 406, 407, 408, 333, 410, 20, 117, 22, 62,
- /* 120 */ 415, 330, 417, 20, 333, 334, 421, 422, 347, 58,
- /* 130 */ 405, 35, 132, 133, 63, 354, 418, 419, 104, 429,
- /* 140 */ 435, 70, 324, 433, 326, 364, 95, 51, 443, 425,
- /* 150 */ 426, 427, 333, 429, 430, 325, 325, 433, 448, 449,
- /* 160 */ 333, 161, 162, 453, 454, 333, 95, 12, 13, 14,
- /* 170 */ 15, 16, 448, 449, 347, 161, 162, 453, 454, 337,
- /* 180 */ 180, 333, 182, 364, 132, 133, 330, 356, 117, 333,
- /* 190 */ 334, 364, 20, 351, 160, 364, 364, 20, 95, 369,
- /* 200 */ 369, 359, 371, 132, 133, 205, 206, 4, 208, 209,
+ /* 0 */ 331, 369, 333, 334, 372, 373, 389, 327, 360, 420,
+ /* 10 */ 421, 357, 12, 13, 14, 327, 359, 431, 358, 371,
+ /* 20 */ 20, 435, 22, 360, 370, 12, 13, 14, 15, 16,
+ /* 30 */ 327, 335, 324, 33, 371, 35, 450, 451, 358, 379,
+ /* 40 */ 380, 455, 456, 372, 373, 349, 366, 335, 431, 401,
+ /* 50 */ 402, 371, 435, 373, 1, 2, 20, 389, 58, 371,
+ /* 60 */ 412, 358, 366, 63, 401, 402, 403, 450, 451, 366,
+ /* 70 */ 70, 20, 455, 456, 371, 412, 373, 332, 398, 20,
+ /* 80 */ 335, 336, 402, 12, 13, 405, 406, 407, 408, 409,
+ /* 90 */ 410, 20, 412, 22, 382, 95, 384, 389, 20, 431,
+ /* 100 */ 335, 398, 342, 435, 33, 402, 35, 347, 405, 406,
+ /* 110 */ 407, 408, 409, 410, 349, 412, 58, 117, 450, 451,
+ /* 120 */ 417, 356, 419, 455, 456, 351, 423, 424, 354, 58,
+ /* 130 */ 20, 366, 132, 133, 63, 95, 335, 457, 458, 431,
+ /* 140 */ 437, 70, 335, 435, 331, 105, 333, 334, 445, 96,
+ /* 150 */ 349, 18, 35, 95, 95, 97, 23, 356, 450, 451,
+ /* 160 */ 373, 161, 162, 455, 456, 332, 95, 366, 335, 336,
+ /* 170 */ 37, 38, 385, 366, 41, 388, 404, 65, 66, 67,
+ /* 180 */ 180, 0, 182, 132, 133, 73, 74, 70, 117, 360,
+ /* 190 */ 78, 350, 59, 60, 61, 83, 84, 161, 162, 358,
+ /* 200 */ 371, 89, 430, 132, 133, 95, 206, 207, 367, 209,
/* 210 */ 210, 211, 212, 213, 214, 215, 216, 217, 218, 219,
- /* 220 */ 220, 221, 222, 223, 224, 225, 226, 396, 380, 95,
- /* 230 */ 382, 400, 161, 162, 403, 404, 405, 406, 407, 408,
- /* 240 */ 409, 410, 411, 412, 425, 426, 427, 20, 429, 430,
- /* 250 */ 37, 180, 402, 182, 370, 371, 424, 425, 426, 427,
- /* 260 */ 166, 429, 430, 325, 95, 231, 232, 233, 234, 235,
- /* 270 */ 236, 237, 238, 239, 240, 241, 205, 206, 428, 208,
+ /* 220 */ 220, 221, 222, 223, 224, 225, 226, 227, 95, 335,
+ /* 230 */ 401, 402, 161, 162, 427, 428, 429, 20, 431, 432,
+ /* 240 */ 20, 412, 435, 349, 14, 20, 65, 66, 67, 358,
+ /* 250 */ 20, 180, 127, 182, 73, 74, 131, 450, 451, 78,
+ /* 260 */ 366, 163, 455, 456, 83, 84, 168, 134, 8, 9,
+ /* 270 */ 89, 380, 12, 13, 14, 15, 16, 206, 207, 389,
/* 280 */ 209, 210, 211, 212, 213, 214, 215, 216, 217, 218,
- /* 290 */ 219, 220, 221, 222, 223, 224, 225, 226, 95, 228,
- /* 300 */ 12, 13, 0, 95, 205, 322, 364, 369, 20, 14,
- /* 310 */ 22, 98, 0, 100, 101, 20, 103, 375, 325, 325,
- /* 320 */ 107, 33, 95, 35, 108, 109, 110, 111, 112, 113,
- /* 330 */ 114, 115, 116, 117, 118, 163, 120, 121, 122, 123,
- /* 340 */ 124, 125, 129, 249, 250, 58, 58, 244, 179, 356,
- /* 350 */ 181, 63, 253, 254, 255, 256, 257, 364, 70, 20,
- /* 360 */ 35, 22, 369, 369, 371, 261, 175, 65, 66, 67,
- /* 370 */ 387, 12, 13, 14, 62, 73, 74, 387, 244, 20,
- /* 380 */ 78, 22, 95, 95, 97, 83, 84, 196, 197, 396,
- /* 390 */ 51, 89, 33, 400, 35, 70, 403, 404, 405, 406,
- /* 400 */ 407, 408, 325, 410, 339, 117, 413, 325, 415, 416,
- /* 410 */ 417, 333, 429, 244, 421, 422, 433, 58, 353, 429,
- /* 420 */ 132, 133, 355, 433, 20, 347, 126, 362, 44, 70,
- /* 430 */ 325, 448, 449, 356, 0, 368, 453, 454, 448, 449,
- /* 440 */ 22, 364, 364, 453, 454, 356, 369, 244, 371, 161,
- /* 450 */ 162, 369, 244, 35, 95, 21, 161, 371, 24, 25,
- /* 460 */ 26, 27, 28, 29, 30, 31, 32, 378, 180, 383,
- /* 470 */ 182, 244, 386, 396, 369, 349, 117, 400, 352, 356,
- /* 480 */ 403, 404, 405, 406, 407, 408, 363, 410, 70, 189,
- /* 490 */ 190, 132, 133, 205, 206, 372, 208, 209, 210, 211,
- /* 500 */ 212, 213, 214, 215, 216, 217, 218, 219, 220, 221,
- /* 510 */ 222, 223, 224, 225, 226, 342, 343, 342, 343, 21,
- /* 520 */ 161, 162, 24, 25, 26, 27, 28, 29, 30, 31,
- /* 530 */ 32, 244, 455, 456, 348, 117, 65, 66, 67, 180,
- /* 540 */ 348, 182, 356, 356, 73, 74, 14, 0, 356, 78,
- /* 550 */ 363, 365, 20, 20, 83, 84, 0, 365, 325, 372,
- /* 560 */ 89, 126, 127, 20, 205, 206, 131, 208, 209, 210,
- /* 570 */ 211, 212, 213, 214, 215, 216, 217, 218, 219, 220,
- /* 580 */ 221, 222, 223, 224, 225, 226, 12, 13, 0, 356,
- /* 590 */ 325, 333, 58, 21, 20, 48, 22, 364, 180, 0,
- /* 600 */ 182, 325, 369, 20, 371, 347, 34, 33, 36, 35,
- /* 610 */ 358, 333, 24, 25, 26, 27, 28, 29, 30, 31,
- /* 620 */ 32, 369, 364, 205, 206, 347, 1, 2, 94, 396,
- /* 630 */ 325, 97, 58, 400, 369, 325, 403, 404, 405, 406,
- /* 640 */ 407, 408, 364, 410, 70, 369, 337, 339, 415, 265,
- /* 650 */ 417, 399, 400, 413, 421, 422, 416, 12, 13, 333,
- /* 660 */ 4, 62, 410, 107, 3, 20, 325, 22, 359, 95,
- /* 670 */ 362, 79, 325, 347, 369, 19, 443, 371, 33, 369,
- /* 680 */ 35, 20, 126, 127, 128, 129, 130, 131, 2, 33,
- /* 690 */ 364, 117, 386, 161, 8, 9, 163, 356, 12, 13,
- /* 700 */ 14, 15, 16, 58, 48, 364, 132, 133, 325, 53,
- /* 710 */ 369, 325, 371, 402, 58, 70, 369, 325, 429, 8,
- /* 720 */ 9, 96, 433, 12, 13, 14, 15, 16, 4, 137,
- /* 730 */ 138, 20, 0, 160, 402, 161, 162, 396, 449, 428,
- /* 740 */ 95, 400, 453, 454, 403, 404, 405, 406, 407, 408,
- /* 750 */ 94, 410, 369, 97, 180, 369, 182, 96, 417, 2,
- /* 760 */ 428, 369, 117, 422, 325, 8, 9, 325, 127, 12,
- /* 770 */ 13, 14, 15, 16, 228, 325, 4, 132, 133, 205,
- /* 780 */ 206, 49, 208, 209, 210, 211, 212, 213, 214, 215,
- /* 790 */ 216, 217, 218, 219, 220, 221, 222, 223, 224, 225,
- /* 800 */ 226, 18, 35, 20, 231, 325, 161, 162, 369, 19,
- /* 810 */ 27, 369, 356, 30, 241, 43, 33, 45, 46, 369,
- /* 820 */ 414, 365, 416, 33, 163, 180, 0, 182, 187, 188,
- /* 830 */ 364, 48, 191, 50, 193, 228, 53, 230, 48, 0,
- /* 840 */ 414, 375, 416, 39, 54, 55, 56, 57, 58, 369,
- /* 850 */ 205, 206, 0, 208, 209, 210, 211, 212, 213, 214,
- /* 860 */ 215, 216, 217, 218, 219, 220, 221, 222, 223, 224,
- /* 870 */ 225, 226, 356, 20, 163, 8, 9, 94, 20, 12,
- /* 880 */ 13, 14, 15, 16, 94, 364, 63, 97, 372, 106,
- /* 890 */ 106, 65, 66, 67, 68, 69, 375, 71, 72, 73,
- /* 900 */ 74, 75, 76, 77, 78, 79, 80, 81, 82, 83,
- /* 910 */ 84, 85, 86, 87, 88, 89, 90, 91, 366, 136,
- /* 920 */ 130, 369, 139, 140, 141, 142, 143, 144, 145, 146,
- /* 930 */ 147, 148, 149, 150, 151, 152, 153, 154, 155, 70,
- /* 940 */ 157, 158, 159, 18, 45, 46, 8, 9, 23, 182,
- /* 950 */ 12, 13, 14, 15, 16, 325, 325, 167, 325, 107,
- /* 960 */ 70, 366, 37, 38, 369, 349, 41, 366, 352, 245,
- /* 970 */ 369, 344, 357, 346, 184, 42, 186, 44, 126, 127,
- /* 980 */ 128, 129, 130, 131, 59, 60, 61, 8, 9, 356,
- /* 990 */ 151, 12, 13, 14, 15, 16, 107, 364, 47, 369,
- /* 1000 */ 369, 333, 369, 107, 371, 357, 8, 9, 242, 243,
- /* 1010 */ 12, 13, 14, 15, 16, 347, 163, 58, 129, 161,
- /* 1020 */ 95, 333, 126, 127, 128, 129, 130, 131, 205, 396,
- /* 1030 */ 163, 333, 364, 400, 96, 347, 403, 404, 405, 406,
- /* 1040 */ 407, 408, 44, 410, 44, 347, 95, 243, 415, 42,
- /* 1050 */ 417, 44, 364, 22, 421, 422, 97, 357, 106, 134,
- /* 1060 */ 333, 325, 364, 8, 9, 432, 35, 12, 13, 14,
- /* 1070 */ 15, 16, 8, 9, 347, 357, 12, 13, 14, 15,
- /* 1080 */ 16, 333, 99, 99, 44, 102, 102, 333, 0, 35,
- /* 1090 */ 99, 364, 356, 102, 0, 347, 96, 172, 173, 174,
- /* 1100 */ 364, 347, 177, 333, 44, 369, 325, 371, 156, 0,
- /* 1110 */ 22, 99, 364, 358, 102, 44, 22, 347, 364, 44,
- /* 1120 */ 195, 132, 133, 198, 369, 200, 201, 202, 203, 204,
- /* 1130 */ 44, 22, 396, 333, 364, 333, 400, 356, 326, 403,
- /* 1140 */ 404, 405, 406, 407, 408, 364, 410, 347, 44, 347,
- /* 1150 */ 369, 415, 371, 417, 399, 400, 96, 421, 422, 345,
- /* 1160 */ 96, 333, 333, 357, 364, 410, 364, 96, 432, 244,
- /* 1170 */ 44, 96, 357, 163, 44, 347, 347, 396, 168, 325,
- /* 1180 */ 44, 400, 96, 457, 403, 404, 405, 406, 407, 408,
- /* 1190 */ 13, 410, 364, 364, 12, 13, 415, 333, 417, 44,
- /* 1200 */ 96, 44, 421, 422, 22, 1, 2, 13, 357, 95,
- /* 1210 */ 356, 347, 35, 432, 379, 33, 44, 35, 364, 105,
- /* 1220 */ 33, 387, 96, 369, 387, 371, 96, 172, 364, 35,
- /* 1230 */ 335, 446, 96, 440, 325, 48, 182, 44, 356, 335,
- /* 1240 */ 58, 54, 55, 56, 57, 58, 44, 379, 332, 44,
- /* 1250 */ 396, 96, 70, 96, 400, 368, 44, 403, 404, 405,
- /* 1260 */ 406, 407, 408, 429, 410, 356, 429, 433, 96, 415,
- /* 1270 */ 433, 417, 35, 364, 431, 421, 422, 379, 369, 423,
- /* 1280 */ 371, 94, 448, 449, 97, 448, 449, 453, 454, 96,
- /* 1290 */ 453, 454, 450, 434, 387, 246, 48, 397, 96, 117,
- /* 1300 */ 398, 96, 178, 263, 389, 396, 42, 70, 96, 400,
- /* 1310 */ 376, 20, 403, 404, 405, 406, 407, 408, 379, 410,
- /* 1320 */ 376, 266, 160, 374, 415, 20, 417, 333, 333, 376,
- /* 1330 */ 421, 422, 374, 93, 341, 374, 429, 333, 333, 333,
- /* 1340 */ 433, 20, 327, 327, 20, 371, 325, 387, 393, 20,
- /* 1350 */ 339, 164, 165, 339, 167, 448, 449, 170, 334, 20,
- /* 1360 */ 453, 454, 180, 388, 182, 339, 334, 339, 339, 339,
- /* 1370 */ 333, 52, 339, 186, 336, 336, 325, 356, 356, 327,
- /* 1380 */ 333, 356, 369, 356, 327, 364, 369, 205, 206, 429,
- /* 1390 */ 369, 356, 371, 433, 194, 393, 395, 356, 356, 217,
- /* 1400 */ 218, 219, 220, 221, 222, 223, 356, 356, 448, 449,
- /* 1410 */ 337, 185, 356, 453, 454, 364, 371, 396, 356, 356,
- /* 1420 */ 369, 400, 371, 356, 403, 404, 405, 406, 407, 408,
- /* 1430 */ 337, 410, 325, 333, 369, 392, 415, 379, 417, 251,
- /* 1440 */ 379, 252, 421, 422, 258, 369, 369, 396, 439, 369,
- /* 1450 */ 384, 400, 325, 384, 403, 404, 405, 406, 407, 408,
- /* 1460 */ 442, 410, 439, 356, 171, 247, 260, 259, 417, 262,
- /* 1470 */ 398, 364, 421, 422, 438, 441, 369, 267, 371, 264,
- /* 1480 */ 364, 437, 243, 356, 436, 439, 20, 402, 334, 333,
- /* 1490 */ 337, 364, 20, 382, 384, 165, 369, 369, 371, 384,
- /* 1500 */ 369, 369, 369, 396, 369, 452, 369, 400, 337, 364,
- /* 1510 */ 403, 404, 405, 406, 407, 408, 352, 410, 337, 381,
- /* 1520 */ 325, 451, 95, 396, 417, 420, 458, 400, 421, 422,
- /* 1530 */ 403, 404, 405, 406, 407, 408, 325, 410, 95, 360,
- /* 1540 */ 337, 36, 369, 346, 417, 328, 333, 327, 421, 422,
- /* 1550 */ 390, 356, 394, 385, 385, 323, 0, 0, 187, 364,
- /* 1560 */ 42, 338, 0, 0, 369, 0, 371, 356, 35, 350,
- /* 1570 */ 35, 350, 350, 199, 35, 364, 35, 0, 199, 35,
- /* 1580 */ 369, 35, 371, 199, 0, 199, 0, 35, 0, 22,
- /* 1590 */ 0, 396, 182, 35, 180, 400, 0, 325, 403, 404,
- /* 1600 */ 405, 406, 407, 408, 0, 410, 176, 396, 175, 0,
- /* 1610 */ 0, 400, 0, 47, 403, 404, 405, 406, 407, 408,
- /* 1620 */ 0, 410, 0, 42, 0, 0, 0, 0, 356, 151,
- /* 1630 */ 35, 0, 151, 0, 0, 0, 364, 0, 0, 444,
- /* 1640 */ 445, 369, 325, 371, 0, 0, 0, 0, 0, 0,
- /* 1650 */ 0, 0, 0, 0, 0, 0, 445, 0, 0, 42,
- /* 1660 */ 0, 0, 0, 0, 0, 22, 0, 0, 396, 0,
- /* 1670 */ 0, 135, 400, 356, 35, 403, 404, 405, 406, 407,
- /* 1680 */ 408, 364, 410, 0, 0, 0, 369, 0, 371, 0,
- /* 1690 */ 58, 14, 14, 0, 58, 0, 0, 0, 42, 171,
- /* 1700 */ 0, 0, 0, 325, 39, 64, 47, 0, 0, 0,
- /* 1710 */ 0, 39, 44, 396, 35, 40, 0, 400, 47, 447,
- /* 1720 */ 403, 404, 405, 406, 407, 408, 325, 410, 47, 39,
- /* 1730 */ 48, 39, 0, 35, 356, 0, 48, 0, 39, 361,
- /* 1740 */ 35, 35, 364, 39, 0, 22, 104, 369, 0, 371,
- /* 1750 */ 35, 48, 39, 35, 35, 35, 35, 356, 44, 48,
- /* 1760 */ 35, 44, 22, 35, 35, 364, 0, 22, 0, 22,
- /* 1770 */ 369, 0, 371, 456, 396, 102, 50, 22, 400, 0,
- /* 1780 */ 0, 403, 404, 405, 406, 407, 408, 325, 410, 35,
- /* 1790 */ 0, 35, 35, 20, 22, 35, 35, 396, 192, 0,
- /* 1800 */ 35, 400, 0, 163, 403, 404, 405, 406, 407, 408,
- /* 1810 */ 0, 410, 0, 412, 22, 0, 3, 325, 356, 44,
- /* 1820 */ 96, 248, 44, 361, 47, 95, 364, 96, 95, 95,
- /* 1830 */ 44, 369, 96, 371, 96, 96, 95, 95, 47, 44,
- /* 1840 */ 325, 95, 248, 163, 95, 3, 96, 96, 356, 44,
- /* 1850 */ 248, 165, 35, 361, 163, 35, 364, 35, 396, 183,
- /* 1860 */ 35, 369, 400, 371, 35, 403, 404, 405, 406, 407,
- /* 1870 */ 408, 356, 410, 35, 47, 44, 0, 96, 96, 364,
- /* 1880 */ 47, 169, 0, 47, 369, 325, 371, 0, 396, 95,
- /* 1890 */ 39, 95, 400, 96, 96, 403, 404, 405, 406, 407,
- /* 1900 */ 408, 325, 410, 95, 95, 105, 95, 47, 44, 2,
- /* 1910 */ 22, 396, 96, 95, 95, 400, 356, 164, 403, 404,
- /* 1920 */ 405, 406, 407, 408, 364, 410, 96, 95, 166, 369,
- /* 1930 */ 96, 371, 356, 47, 95, 95, 242, 47, 22, 96,
- /* 1940 */ 364, 95, 95, 106, 96, 369, 35, 371, 35, 227,
- /* 1950 */ 96, 95, 35, 35, 325, 96, 396, 205, 95, 35,
- /* 1960 */ 400, 96, 95, 403, 404, 405, 406, 407, 408, 96,
- /* 1970 */ 410, 207, 396, 35, 95, 22, 400, 119, 107, 403,
- /* 1980 */ 404, 405, 406, 407, 408, 356, 410, 229, 119, 119,
- /* 1990 */ 227, 119, 95, 364, 44, 95, 35, 22, 369, 325,
- /* 2000 */ 371, 95, 35, 64, 63, 35, 35, 35, 35, 35,
- /* 2010 */ 70, 35, 35, 35, 35, 92, 35, 35, 35, 22,
- /* 2020 */ 35, 35, 35, 35, 44, 396, 70, 35, 35, 400,
- /* 2030 */ 356, 35, 403, 404, 405, 406, 407, 408, 364, 410,
- /* 2040 */ 35, 22, 35, 369, 0, 371, 35, 48, 39, 0,
- /* 2050 */ 35, 48, 325, 39, 0, 35, 48, 39, 0, 35,
- /* 2060 */ 48, 39, 0, 35, 35, 0, 20, 22, 325, 21,
- /* 2070 */ 396, 459, 22, 22, 400, 459, 21, 403, 404, 405,
- /* 2080 */ 406, 407, 408, 356, 410, 459, 459, 459, 459, 459,
- /* 2090 */ 459, 364, 459, 459, 459, 459, 369, 459, 371, 356,
- /* 2100 */ 459, 459, 459, 459, 459, 459, 459, 364, 459, 459,
- /* 2110 */ 459, 459, 369, 325, 371, 459, 459, 459, 459, 459,
- /* 2120 */ 459, 459, 459, 396, 459, 459, 459, 400, 459, 459,
- /* 2130 */ 403, 404, 405, 406, 407, 408, 459, 410, 459, 396,
- /* 2140 */ 459, 459, 459, 400, 356, 459, 403, 404, 405, 406,
- /* 2150 */ 407, 408, 364, 410, 459, 459, 459, 369, 459, 371,
- /* 2160 */ 459, 459, 459, 459, 459, 459, 325, 459, 459, 459,
- /* 2170 */ 459, 459, 459, 459, 459, 459, 459, 459, 459, 459,
- /* 2180 */ 459, 459, 325, 459, 396, 459, 459, 459, 400, 459,
- /* 2190 */ 459, 403, 404, 405, 406, 407, 408, 356, 410, 459,
- /* 2200 */ 459, 459, 459, 459, 459, 364, 459, 459, 459, 459,
- /* 2210 */ 369, 459, 371, 356, 459, 459, 459, 459, 459, 459,
- /* 2220 */ 459, 364, 459, 459, 459, 459, 369, 325, 371, 459,
- /* 2230 */ 459, 459, 459, 459, 459, 459, 459, 396, 459, 459,
- /* 2240 */ 459, 400, 459, 459, 403, 404, 405, 406, 407, 408,
- /* 2250 */ 325, 410, 459, 396, 459, 459, 459, 400, 356, 459,
- /* 2260 */ 403, 404, 405, 406, 407, 408, 364, 410, 459, 459,
- /* 2270 */ 459, 369, 459, 371, 459, 459, 459, 459, 459, 459,
- /* 2280 */ 325, 356, 459, 459, 459, 459, 459, 459, 459, 364,
- /* 2290 */ 459, 459, 459, 459, 369, 459, 371, 459, 396, 459,
- /* 2300 */ 459, 459, 400, 459, 459, 403, 404, 405, 406, 407,
- /* 2310 */ 408, 356, 410, 459, 459, 459, 459, 459, 459, 364,
- /* 2320 */ 459, 396, 459, 459, 369, 400, 371, 459, 403, 404,
- /* 2330 */ 405, 406, 407, 408, 459, 410, 459, 459, 459, 459,
- /* 2340 */ 459, 459, 459, 459, 459, 459, 459, 459, 459, 459,
- /* 2350 */ 459, 396, 459, 459, 459, 400, 325, 459, 403, 404,
- /* 2360 */ 405, 406, 407, 408, 459, 410, 459, 459, 459, 459,
- /* 2370 */ 459, 459, 459, 459, 459, 459, 459, 459, 325, 459,
- /* 2380 */ 459, 459, 459, 459, 459, 459, 459, 356, 459, 459,
- /* 2390 */ 459, 459, 459, 459, 459, 364, 459, 459, 459, 459,
- /* 2400 */ 369, 459, 371, 459, 459, 459, 459, 459, 459, 356,
- /* 2410 */ 459, 459, 459, 459, 459, 459, 459, 364, 459, 459,
- /* 2420 */ 459, 459, 369, 459, 371, 459, 459, 396, 459, 459,
- /* 2430 */ 459, 400, 459, 325, 403, 404, 405, 406, 407, 408,
- /* 2440 */ 459, 410, 459, 459, 459, 459, 459, 459, 459, 396,
- /* 2450 */ 459, 459, 459, 400, 459, 459, 403, 404, 405, 406,
- /* 2460 */ 407, 408, 459, 410, 356, 459, 459, 459, 459, 459,
- /* 2470 */ 459, 459, 364, 459, 459, 459, 459, 369, 325, 371,
- /* 2480 */ 459, 459, 459, 459, 459, 459, 459, 459, 459, 459,
- /* 2490 */ 459, 459, 459, 459, 459, 459, 459, 459, 459, 459,
- /* 2500 */ 459, 459, 459, 459, 396, 459, 459, 459, 400, 356,
- /* 2510 */ 459, 403, 404, 405, 406, 407, 408, 364, 410, 459,
- /* 2520 */ 459, 459, 369, 325, 371, 459, 459, 459, 459, 459,
- /* 2530 */ 459, 459, 459, 459, 459, 459, 459, 459, 459, 325,
- /* 2540 */ 459, 459, 459, 459, 459, 459, 459, 459, 459, 396,
- /* 2550 */ 459, 459, 459, 400, 356, 459, 403, 404, 405, 406,
- /* 2560 */ 407, 408, 364, 410, 459, 459, 459, 369, 459, 371,
- /* 2570 */ 356, 459, 459, 459, 459, 459, 459, 459, 364, 459,
- /* 2580 */ 459, 459, 459, 369, 325, 371, 459, 459, 459, 459,
- /* 2590 */ 459, 459, 459, 459, 396, 459, 459, 459, 400, 459,
- /* 2600 */ 459, 403, 404, 405, 406, 407, 408, 325, 410, 459,
- /* 2610 */ 396, 459, 459, 459, 400, 356, 459, 403, 404, 405,
- /* 2620 */ 406, 407, 408, 364, 410, 459, 459, 459, 369, 459,
- /* 2630 */ 371, 459, 459, 459, 459, 459, 459, 325, 356, 459,
- /* 2640 */ 459, 459, 459, 459, 459, 459, 364, 459, 459, 459,
- /* 2650 */ 459, 369, 459, 371, 459, 396, 459, 459, 459, 400,
- /* 2660 */ 459, 459, 403, 404, 405, 406, 407, 408, 356, 410,
- /* 2670 */ 459, 459, 459, 459, 459, 459, 364, 459, 396, 459,
- /* 2680 */ 459, 369, 400, 371, 459, 403, 404, 405, 406, 407,
- /* 2690 */ 408, 459, 410, 459, 459, 459, 459, 459, 459, 459,
- /* 2700 */ 459, 459, 459, 459, 459, 459, 459, 459, 396, 459,
- /* 2710 */ 459, 459, 400, 459, 459, 403, 404, 405, 406, 407,
- /* 2720 */ 408, 459, 410,
+ /* 290 */ 219, 220, 221, 222, 223, 224, 225, 226, 227, 4,
+ /* 300 */ 229, 12, 13, 245, 245, 172, 173, 174, 339, 20,
+ /* 310 */ 177, 22, 187, 188, 19, 358, 191, 339, 193, 327,
+ /* 320 */ 95, 431, 33, 366, 35, 435, 358, 44, 33, 196,
+ /* 330 */ 361, 353, 199, 365, 201, 202, 203, 204, 205, 361,
+ /* 340 */ 450, 451, 374, 48, 360, 455, 456, 58, 53, 350,
+ /* 350 */ 358, 4, 63, 58, 350, 371, 96, 358, 366, 70,
+ /* 360 */ 3, 62, 358, 371, 407, 373, 367, 14, 15, 16,
+ /* 370 */ 335, 367, 12, 13, 14, 20, 95, 20, 245, 96,
+ /* 380 */ 20, 327, 22, 163, 95, 401, 402, 403, 95, 94,
+ /* 390 */ 398, 341, 97, 33, 402, 35, 412, 405, 406, 407,
+ /* 400 */ 408, 409, 410, 229, 412, 355, 117, 415, 160, 417,
+ /* 410 */ 418, 419, 358, 0, 364, 423, 424, 382, 58, 384,
+ /* 420 */ 366, 132, 133, 126, 127, 371, 4, 373, 131, 0,
+ /* 430 */ 70, 108, 109, 110, 111, 112, 113, 114, 115, 116,
+ /* 440 */ 117, 118, 95, 120, 121, 122, 123, 124, 125, 106,
+ /* 450 */ 161, 162, 398, 96, 20, 95, 402, 0, 58, 405,
+ /* 460 */ 406, 407, 408, 409, 410, 43, 412, 45, 46, 180,
+ /* 470 */ 245, 182, 179, 419, 181, 62, 20, 117, 424, 335,
+ /* 480 */ 232, 24, 25, 26, 27, 28, 29, 30, 31, 32,
+ /* 490 */ 242, 62, 132, 133, 94, 206, 207, 97, 209, 210,
+ /* 500 */ 211, 212, 213, 214, 215, 216, 217, 218, 219, 220,
+ /* 510 */ 221, 222, 223, 224, 225, 226, 227, 344, 345, 375,
+ /* 520 */ 163, 161, 162, 0, 21, 335, 245, 24, 25, 26,
+ /* 530 */ 27, 28, 29, 30, 31, 32, 341, 62, 245, 349,
+ /* 540 */ 180, 326, 182, 328, 21, 20, 327, 24, 25, 26,
+ /* 550 */ 27, 28, 29, 30, 31, 32, 366, 8, 9, 364,
+ /* 560 */ 327, 12, 13, 14, 15, 16, 206, 207, 95, 209,
+ /* 570 */ 210, 211, 212, 213, 214, 215, 216, 217, 218, 219,
+ /* 580 */ 220, 221, 222, 223, 224, 225, 226, 227, 12, 13,
+ /* 590 */ 371, 358, 245, 44, 22, 79, 20, 373, 22, 366,
+ /* 600 */ 37, 20, 70, 22, 371, 166, 373, 35, 229, 33,
+ /* 610 */ 231, 35, 388, 358, 358, 416, 35, 418, 8, 9,
+ /* 620 */ 365, 365, 12, 13, 14, 15, 16, 39, 327, 374,
+ /* 630 */ 374, 398, 51, 360, 58, 402, 21, 335, 405, 406,
+ /* 640 */ 407, 408, 409, 410, 371, 412, 70, 206, 335, 34,
+ /* 650 */ 417, 36, 419, 137, 138, 335, 423, 424, 404, 12,
+ /* 660 */ 13, 98, 349, 100, 101, 70, 103, 20, 366, 22,
+ /* 670 */ 107, 95, 371, 63, 401, 402, 403, 359, 445, 366,
+ /* 680 */ 33, 175, 35, 20, 430, 412, 366, 431, 14, 250,
+ /* 690 */ 251, 435, 129, 117, 20, 254, 255, 256, 257, 258,
+ /* 700 */ 259, 260, 393, 197, 198, 58, 450, 451, 132, 133,
+ /* 710 */ 327, 455, 456, 126, 104, 431, 327, 70, 245, 435,
+ /* 720 */ 8, 9, 335, 359, 12, 13, 14, 15, 16, 427,
+ /* 730 */ 428, 429, 20, 431, 432, 451, 349, 161, 162, 455,
+ /* 740 */ 456, 431, 95, 404, 14, 435, 426, 427, 428, 429,
+ /* 750 */ 20, 431, 432, 366, 371, 359, 180, 416, 182, 418,
+ /* 760 */ 371, 451, 107, 327, 117, 455, 456, 8, 9, 430,
+ /* 770 */ 160, 12, 13, 14, 15, 16, 189, 190, 415, 132,
+ /* 780 */ 133, 418, 206, 207, 129, 209, 210, 211, 212, 213,
+ /* 790 */ 214, 215, 216, 217, 218, 219, 220, 221, 222, 223,
+ /* 800 */ 224, 225, 226, 227, 18, 3, 20, 371, 161, 162,
+ /* 810 */ 20, 359, 22, 27, 344, 345, 30, 8, 9, 33,
+ /* 820 */ 366, 12, 13, 14, 15, 16, 163, 180, 0, 182,
+ /* 830 */ 368, 377, 244, 371, 48, 161, 50, 327, 4, 53,
+ /* 840 */ 327, 51, 232, 233, 234, 235, 236, 237, 238, 239,
+ /* 850 */ 240, 241, 242, 206, 207, 96, 209, 210, 211, 212,
+ /* 860 */ 213, 214, 215, 216, 217, 218, 219, 220, 221, 222,
+ /* 870 */ 223, 224, 225, 226, 227, 163, 2, 327, 359, 327,
+ /* 880 */ 94, 371, 8, 9, 371, 359, 12, 13, 14, 15,
+ /* 890 */ 16, 161, 106, 65, 66, 67, 68, 69, 327, 71,
+ /* 900 */ 72, 73, 74, 75, 76, 77, 78, 79, 80, 81,
+ /* 910 */ 82, 83, 84, 85, 86, 87, 88, 89, 90, 91,
+ /* 920 */ 327, 371, 136, 371, 327, 139, 140, 141, 142, 143,
+ /* 930 */ 144, 145, 146, 147, 148, 149, 150, 151, 152, 153,
+ /* 940 */ 154, 155, 371, 157, 158, 159, 327, 327, 327, 366,
+ /* 950 */ 366, 351, 12, 13, 354, 358, 327, 335, 335, 20,
+ /* 960 */ 377, 377, 22, 366, 371, 335, 335, 327, 371, 0,
+ /* 970 */ 373, 349, 349, 33, 358, 35, 20, 335, 358, 349,
+ /* 980 */ 349, 172, 346, 367, 348, 358, 366, 328, 366, 366,
+ /* 990 */ 371, 371, 371, 373, 389, 398, 366, 366, 58, 402,
+ /* 1000 */ 371, 374, 405, 406, 407, 408, 409, 410, 366, 412,
+ /* 1010 */ 70, 371, 45, 46, 417, 327, 419, 347, 398, 327,
+ /* 1020 */ 423, 424, 402, 0, 327, 405, 406, 407, 408, 409,
+ /* 1030 */ 410, 434, 412, 327, 44, 2, 431, 417, 381, 419,
+ /* 1040 */ 435, 8, 9, 423, 424, 12, 13, 14, 15, 16,
+ /* 1050 */ 368, 243, 244, 371, 434, 450, 451, 117, 0, 371,
+ /* 1060 */ 455, 456, 368, 371, 358, 371, 264, 33, 371, 427,
+ /* 1070 */ 428, 429, 366, 431, 432, 337, 107, 371, 269, 373,
+ /* 1080 */ 246, 0, 48, 0, 42, 42, 44, 44, 54, 55,
+ /* 1090 */ 56, 57, 58, 106, 459, 126, 127, 128, 129, 130,
+ /* 1100 */ 131, 44, 163, 22, 398, 22, 48, 192, 402, 194,
+ /* 1110 */ 327, 405, 406, 407, 408, 409, 410, 161, 412, 335,
+ /* 1120 */ 180, 99, 182, 417, 102, 419, 132, 133, 94, 423,
+ /* 1130 */ 424, 97, 35, 349, 327, 13, 99, 58, 22, 102,
+ /* 1140 */ 434, 358, 44, 156, 44, 44, 206, 207, 107, 366,
+ /* 1150 */ 366, 35, 335, 0, 371, 35, 373, 35, 218, 219,
+ /* 1160 */ 220, 221, 222, 223, 224, 358, 349, 126, 127, 128,
+ /* 1170 */ 129, 130, 131, 366, 151, 22, 97, 63, 371, 327,
+ /* 1180 */ 373, 398, 448, 366, 99, 402, 70, 102, 405, 406,
+ /* 1190 */ 407, 408, 409, 410, 96, 412, 96, 96, 164, 165,
+ /* 1200 */ 417, 167, 419, 44, 170, 398, 423, 424, 442, 402,
+ /* 1210 */ 358, 0, 405, 406, 407, 408, 409, 410, 366, 412,
+ /* 1220 */ 186, 1, 2, 371, 417, 373, 419, 358, 337, 44,
+ /* 1230 */ 423, 424, 335, 117, 327, 8, 9, 335, 381, 12,
+ /* 1240 */ 13, 14, 15, 16, 334, 44, 349, 44, 44, 44,
+ /* 1250 */ 398, 349, 335, 335, 402, 96, 266, 405, 406, 407,
+ /* 1260 */ 408, 409, 410, 366, 412, 358, 349, 349, 366, 417,
+ /* 1270 */ 370, 419, 335, 366, 99, 423, 424, 102, 371, 182,
+ /* 1280 */ 373, 96, 389, 366, 366, 381, 349, 8, 9, 433,
+ /* 1290 */ 327, 12, 13, 14, 15, 16, 180, 96, 182, 96,
+ /* 1300 */ 96, 96, 182, 366, 44, 398, 47, 44, 44, 402,
+ /* 1310 */ 44, 44, 405, 406, 407, 408, 409, 410, 107, 412,
+ /* 1320 */ 206, 358, 206, 207, 431, 268, 419, 0, 435, 366,
+ /* 1330 */ 423, 424, 44, 335, 371, 327, 373, 126, 127, 128,
+ /* 1340 */ 129, 130, 131, 450, 451, 13, 44, 349, 455, 456,
+ /* 1350 */ 35, 452, 425, 247, 95, 436, 96, 400, 327, 96,
+ /* 1360 */ 96, 398, 96, 96, 366, 402, 358, 35, 405, 406,
+ /* 1370 */ 407, 408, 409, 410, 366, 412, 49, 48, 399, 371,
+ /* 1380 */ 178, 373, 419, 391, 96, 70, 423, 424, 42, 358,
+ /* 1390 */ 163, 378, 20, 381, 378, 160, 376, 366, 96, 20,
+ /* 1400 */ 335, 335, 371, 378, 373, 376, 398, 93, 376, 335,
+ /* 1410 */ 402, 343, 335, 405, 406, 407, 408, 409, 410, 335,
+ /* 1420 */ 412, 20, 329, 329, 20, 395, 373, 419, 341, 398,
+ /* 1430 */ 341, 423, 424, 402, 20, 336, 405, 406, 407, 408,
+ /* 1440 */ 409, 410, 411, 412, 413, 414, 327, 20, 341, 390,
+ /* 1450 */ 341, 336, 341, 341, 341, 52, 335, 329, 397, 371,
+ /* 1460 */ 358, 338, 327, 338, 195, 329, 358, 335, 358, 185,
+ /* 1470 */ 395, 381, 394, 339, 371, 358, 358, 358, 373, 339,
+ /* 1480 */ 335, 253, 358, 252, 358, 366, 441, 358, 358, 358,
+ /* 1490 */ 371, 358, 373, 358, 261, 441, 444, 171, 371, 443,
+ /* 1500 */ 263, 366, 262, 441, 440, 248, 371, 438, 373, 439,
+ /* 1510 */ 371, 270, 371, 371, 371, 460, 267, 398, 327, 381,
+ /* 1520 */ 265, 402, 244, 386, 405, 406, 407, 408, 409, 410,
+ /* 1530 */ 386, 412, 366, 398, 454, 453, 20, 402, 339, 20,
+ /* 1540 */ 405, 406, 407, 408, 409, 410, 327, 412, 400, 358,
+ /* 1550 */ 404, 335, 384, 336, 371, 386, 386, 366, 371, 371,
+ /* 1560 */ 371, 371, 371, 371, 373, 446, 447, 165, 339, 383,
+ /* 1570 */ 95, 339, 354, 366, 422, 95, 362, 358, 348, 371,
+ /* 1580 */ 335, 339, 447, 330, 36, 366, 392, 329, 352, 398,
+ /* 1590 */ 371, 396, 373, 402, 340, 352, 405, 406, 407, 408,
+ /* 1600 */ 409, 410, 387, 412, 352, 325, 0, 0, 327, 387,
+ /* 1610 */ 187, 0, 0, 42, 0, 35, 200, 398, 35, 35,
+ /* 1620 */ 19, 402, 35, 0, 405, 406, 407, 408, 409, 410,
+ /* 1630 */ 200, 412, 35, 35, 33, 200, 0, 200, 0, 358,
+ /* 1640 */ 449, 0, 22, 35, 363, 0, 182, 366, 35, 48,
+ /* 1650 */ 180, 0, 371, 0, 373, 54, 55, 56, 57, 58,
+ /* 1660 */ 176, 0, 175, 327, 47, 0, 0, 0, 42, 0,
+ /* 1670 */ 0, 0, 0, 0, 0, 0, 0, 458, 0, 398,
+ /* 1680 */ 151, 35, 0, 402, 151, 0, 405, 406, 407, 408,
+ /* 1690 */ 409, 410, 0, 412, 358, 94, 0, 0, 97, 0,
+ /* 1700 */ 0, 0, 366, 0, 0, 0, 0, 371, 0, 373,
+ /* 1710 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 42,
+ /* 1720 */ 22, 0, 0, 135, 0, 327, 35, 0, 0, 0,
+ /* 1730 */ 0, 130, 0, 39, 398, 42, 47, 58, 402, 58,
+ /* 1740 */ 0, 405, 406, 407, 408, 409, 410, 14, 412, 47,
+ /* 1750 */ 414, 44, 14, 0, 0, 327, 358, 0, 0, 0,
+ /* 1760 */ 40, 363, 39, 171, 366, 0, 47, 0, 167, 371,
+ /* 1770 */ 39, 373, 0, 64, 35, 39, 0, 35, 0, 35,
+ /* 1780 */ 39, 0, 48, 48, 0, 184, 358, 186, 39, 39,
+ /* 1790 */ 35, 363, 0, 48, 366, 48, 398, 0, 0, 371,
+ /* 1800 */ 402, 373, 22, 405, 406, 407, 408, 409, 410, 35,
+ /* 1810 */ 412, 0, 35, 327, 35, 44, 22, 35, 35, 44,
+ /* 1820 */ 35, 35, 35, 0, 22, 0, 398, 102, 22, 327,
+ /* 1830 */ 402, 0, 22, 405, 406, 407, 408, 409, 410, 50,
+ /* 1840 */ 412, 104, 35, 0, 358, 0, 0, 35, 35, 22,
+ /* 1850 */ 35, 35, 366, 20, 35, 0, 96, 371, 95, 373,
+ /* 1860 */ 358, 35, 0, 183, 22, 0, 0, 3, 366, 96,
+ /* 1870 */ 249, 249, 44, 371, 327, 373, 44, 3, 44, 44,
+ /* 1880 */ 249, 44, 44, 95, 398, 95, 47, 96, 402, 96,
+ /* 1890 */ 327, 405, 406, 407, 408, 409, 410, 96, 412, 95,
+ /* 1900 */ 398, 47, 35, 95, 402, 358, 163, 405, 406, 407,
+ /* 1910 */ 408, 409, 410, 366, 412, 163, 165, 169, 371, 95,
+ /* 1920 */ 373, 358, 35, 35, 163, 96, 47, 35, 35, 366,
+ /* 1930 */ 35, 95, 47, 243, 371, 0, 373, 96, 44, 0,
+ /* 1940 */ 96, 0, 0, 96, 47, 398, 95, 39, 96, 402,
+ /* 1950 */ 47, 95, 405, 406, 407, 408, 409, 410, 95, 412,
+ /* 1960 */ 44, 398, 166, 164, 96, 402, 95, 327, 405, 406,
+ /* 1970 */ 407, 408, 409, 410, 105, 412, 95, 2, 22, 95,
+ /* 1980 */ 47, 47, 96, 22, 95, 35, 96, 35, 106, 35,
+ /* 1990 */ 228, 327, 96, 95, 230, 95, 228, 95, 358, 35,
+ /* 2000 */ 96, 206, 95, 22, 35, 96, 366, 95, 208, 96,
+ /* 2010 */ 95, 371, 95, 373, 96, 96, 95, 35, 96, 95,
+ /* 2020 */ 119, 107, 358, 95, 119, 119, 95, 44, 35, 119,
+ /* 2030 */ 366, 95, 22, 35, 64, 371, 63, 373, 398, 35,
+ /* 2040 */ 35, 35, 402, 35, 35, 405, 406, 407, 408, 409,
+ /* 2050 */ 410, 35, 412, 327, 35, 35, 35, 70, 92, 44,
+ /* 2060 */ 35, 35, 398, 35, 22, 35, 402, 35, 35, 405,
+ /* 2070 */ 406, 407, 408, 409, 410, 35, 412, 70, 35, 35,
+ /* 2080 */ 35, 35, 22, 327, 358, 35, 0, 35, 39, 48,
+ /* 2090 */ 0, 35, 366, 0, 39, 48, 35, 371, 39, 373,
+ /* 2100 */ 0, 48, 35, 39, 0, 48, 35, 35, 0, 22,
+ /* 2110 */ 21, 461, 20, 22, 358, 461, 22, 21, 461, 461,
+ /* 2120 */ 461, 461, 366, 461, 398, 461, 461, 371, 402, 373,
+ /* 2130 */ 461, 405, 406, 407, 408, 409, 410, 461, 412, 461,
+ /* 2140 */ 461, 327, 461, 461, 461, 461, 461, 461, 461, 461,
+ /* 2150 */ 461, 461, 461, 461, 398, 461, 461, 327, 402, 461,
+ /* 2160 */ 461, 405, 406, 407, 408, 409, 410, 461, 412, 461,
+ /* 2170 */ 461, 461, 358, 461, 461, 461, 461, 461, 461, 461,
+ /* 2180 */ 366, 461, 461, 461, 461, 371, 461, 373, 358, 461,
+ /* 2190 */ 461, 461, 461, 461, 461, 461, 366, 461, 461, 461,
+ /* 2200 */ 461, 371, 327, 373, 461, 461, 461, 461, 461, 461,
+ /* 2210 */ 461, 461, 398, 461, 461, 461, 402, 461, 327, 405,
+ /* 2220 */ 406, 407, 408, 409, 410, 461, 412, 461, 398, 461,
+ /* 2230 */ 461, 461, 402, 358, 461, 405, 406, 407, 408, 409,
+ /* 2240 */ 410, 366, 412, 461, 461, 461, 371, 461, 373, 358,
+ /* 2250 */ 461, 461, 461, 461, 461, 461, 461, 366, 461, 461,
+ /* 2260 */ 461, 461, 371, 461, 373, 461, 461, 461, 461, 461,
+ /* 2270 */ 461, 461, 461, 398, 461, 461, 461, 402, 461, 461,
+ /* 2280 */ 405, 406, 407, 408, 409, 410, 461, 412, 461, 398,
+ /* 2290 */ 461, 461, 461, 402, 461, 327, 405, 406, 407, 408,
+ /* 2300 */ 409, 410, 461, 412, 461, 461, 461, 461, 461, 461,
+ /* 2310 */ 461, 461, 461, 461, 461, 461, 461, 461, 461, 327,
+ /* 2320 */ 461, 461, 461, 461, 461, 461, 358, 461, 461, 461,
+ /* 2330 */ 461, 461, 461, 461, 366, 461, 461, 461, 461, 371,
+ /* 2340 */ 461, 373, 461, 461, 461, 461, 461, 461, 461, 461,
+ /* 2350 */ 358, 461, 461, 461, 461, 461, 461, 461, 366, 461,
+ /* 2360 */ 461, 461, 461, 371, 461, 373, 398, 461, 461, 461,
+ /* 2370 */ 402, 461, 461, 405, 406, 407, 408, 409, 410, 461,
+ /* 2380 */ 412, 327, 461, 461, 461, 461, 461, 461, 461, 461,
+ /* 2390 */ 398, 461, 461, 461, 402, 461, 461, 405, 406, 407,
+ /* 2400 */ 408, 409, 410, 461, 412, 461, 461, 461, 461, 461,
+ /* 2410 */ 461, 327, 358, 461, 461, 461, 461, 461, 461, 461,
+ /* 2420 */ 366, 461, 461, 461, 461, 371, 461, 373, 461, 461,
+ /* 2430 */ 461, 461, 461, 461, 461, 461, 461, 461, 461, 461,
+ /* 2440 */ 461, 461, 358, 461, 461, 461, 461, 461, 461, 461,
+ /* 2450 */ 366, 461, 398, 461, 461, 371, 402, 373, 461, 405,
+ /* 2460 */ 406, 407, 408, 409, 410, 461, 412, 461, 461, 327,
+ /* 2470 */ 461, 461, 461, 461, 461, 461, 461, 461, 461, 461,
+ /* 2480 */ 461, 461, 398, 461, 461, 327, 402, 461, 461, 405,
+ /* 2490 */ 406, 407, 408, 409, 410, 461, 412, 461, 461, 461,
+ /* 2500 */ 358, 461, 461, 461, 461, 461, 461, 461, 366, 461,
+ /* 2510 */ 461, 461, 461, 371, 461, 373, 358, 461, 461, 461,
+ /* 2520 */ 461, 461, 461, 461, 366, 461, 461, 461, 461, 371,
+ /* 2530 */ 327, 373, 461, 461, 461, 461, 461, 461, 461, 461,
+ /* 2540 */ 398, 461, 461, 461, 402, 461, 327, 405, 406, 407,
+ /* 2550 */ 408, 409, 410, 461, 412, 461, 398, 461, 461, 461,
+ /* 2560 */ 402, 358, 461, 405, 406, 407, 408, 409, 410, 366,
+ /* 2570 */ 412, 461, 461, 461, 371, 461, 373, 358, 461, 461,
+ /* 2580 */ 461, 461, 461, 461, 461, 366, 461, 461, 461, 461,
+ /* 2590 */ 371, 461, 373, 461, 461, 461, 461, 461, 461, 461,
+ /* 2600 */ 461, 398, 461, 461, 461, 402, 461, 461, 405, 406,
+ /* 2610 */ 407, 408, 409, 410, 461, 412, 461, 398, 461, 461,
+ /* 2620 */ 461, 402, 461, 327, 405, 406, 407, 408, 409, 410,
+ /* 2630 */ 461, 412, 461, 461, 461, 461, 461, 461, 461, 461,
+ /* 2640 */ 461, 461, 461, 461, 461, 461, 461, 327, 461, 461,
+ /* 2650 */ 461, 461, 461, 461, 358, 461, 461, 461, 461, 461,
+ /* 2660 */ 461, 461, 366, 461, 461, 461, 461, 371, 461, 373,
+ /* 2670 */ 461, 461, 461, 461, 461, 461, 461, 461, 358, 461,
+ /* 2680 */ 461, 461, 461, 461, 461, 461, 366, 461, 461, 461,
+ /* 2690 */ 461, 371, 461, 373, 398, 461, 461, 461, 402, 461,
+ /* 2700 */ 461, 405, 406, 407, 408, 409, 410, 461, 412, 461,
+ /* 2710 */ 461, 461, 461, 461, 461, 461, 461, 461, 398, 461,
+ /* 2720 */ 461, 461, 402, 461, 461, 405, 406, 407, 408, 409,
+ /* 2730 */ 410, 461, 412,
};
-#define YY_SHIFT_COUNT (710)
+#define YY_SHIFT_COUNT (715)
#define YY_SHIFT_MIN (0)
-#define YY_SHIFT_MAX (2065)
+#define YY_SHIFT_MAX (2108)
static const unsigned short int yy_shift_ofst[] = {
- /* 0 */ 925, 0, 71, 0, 288, 288, 288, 288, 288, 288,
- /* 10 */ 288, 288, 288, 359, 574, 574, 645, 574, 574, 574,
- /* 20 */ 574, 574, 574, 574, 574, 574, 574, 574, 574, 574,
- /* 30 */ 574, 574, 574, 574, 574, 574, 574, 574, 574, 574,
- /* 40 */ 574, 574, 574, 574, 574, 574, 103, 227, 51, 169,
- /* 50 */ 287, 134, 208, 134, 51, 51, 1182, 1182, 134, 1182,
- /* 60 */ 1182, 203, 134, 5, 5, 772, 772, 14, 52, 45,
- /* 70 */ 45, 5, 5, 5, 5, 5, 5, 5, 40, 5,
- /* 80 */ 5, 28, 5, 5, 177, 5, 404, 5, 40, 543,
- /* 90 */ 5, 5, 543, 5, 543, 543, 543, 5, 57, 783,
- /* 100 */ 34, 34, 498, 471, 418, 418, 418, 418, 418, 418,
- /* 110 */ 418, 418, 418, 418, 418, 418, 418, 418, 418, 418,
- /* 120 */ 418, 418, 418, 213, 661, 14, 52, 312, 325, 172,
- /* 130 */ 172, 172, 599, 607, 607, 325, 583, 583, 583, 784,
- /* 140 */ 404, 546, 543, 869, 543, 869, 869, 784, 890, 216,
- /* 150 */ 216, 216, 216, 216, 216, 216, 790, 434, 302, 711,
- /* 160 */ 1055, 99, 96, 94, 295, 532, 339, 533, 899, 889,
- /* 170 */ 853, 766, 804, 104, 766, 933, 724, 858, 1049, 1248,
- /* 180 */ 1124, 1264, 1291, 1264, 1162, 1305, 1305, 1264, 1162, 1162,
- /* 190 */ 1240, 1305, 1305, 1305, 1321, 1321, 1324, 28, 404, 28,
- /* 200 */ 1329, 1339, 28, 1329, 28, 28, 28, 1305, 28, 1319,
- /* 210 */ 1319, 1321, 543, 543, 543, 543, 543, 543, 543, 543,
- /* 220 */ 543, 543, 543, 1305, 1321, 869, 869, 1200, 1324, 57,
- /* 230 */ 1226, 404, 57, 1305, 1291, 1291, 869, 1189, 1188, 869,
- /* 240 */ 1189, 1188, 869, 869, 543, 1186, 1293, 1189, 1206, 1208,
- /* 250 */ 1218, 1049, 1210, 1215, 1207, 1239, 583, 1466, 1305, 1329,
- /* 260 */ 57, 1472, 1188, 869, 869, 869, 869, 869, 1188, 869,
- /* 270 */ 1330, 57, 784, 57, 583, 1427, 1443, 869, 890, 1305,
- /* 280 */ 57, 1505, 1321, 2723, 2723, 2723, 2723, 2723, 2723, 2723,
- /* 290 */ 2723, 2723, 826, 1187, 588, 656, 938, 998, 1064, 556,
- /* 300 */ 686, 757, 867, 852, 979, 979, 979, 979, 979, 979,
- /* 310 */ 979, 979, 979, 896, 641, 155, 155, 191, 534, 592,
- /* 320 */ 572, 300, 435, 435, 1, 625, 573, 1, 1, 1,
- /* 330 */ 1000, 547, 1031, 1007, 952, 839, 983, 984, 991, 1012,
- /* 340 */ 1088, 1094, 1109, 959, 1060, 1071, 989, 1040, 384, 1010,
- /* 350 */ 1075, 1086, 1104, 1126, 1130, 1204, 1136, 767, 1054, 823,
- /* 360 */ 1155, 951, 1157, 1172, 1193, 1202, 1205, 1212, 1114, 1177,
- /* 370 */ 1194, 1237, 732, 1556, 1557, 1371, 1562, 1563, 1518, 1565,
- /* 380 */ 1533, 1374, 1535, 1539, 1541, 1379, 1577, 1544, 1546, 1384,
- /* 390 */ 1584, 1386, 1586, 1552, 1588, 1567, 1590, 1558, 1410, 1414,
- /* 400 */ 1596, 1604, 1430, 1433, 1609, 1610, 1566, 1612, 1620, 1622,
- /* 410 */ 1581, 1624, 1625, 1626, 1627, 1637, 1638, 1644, 1645, 1478,
- /* 420 */ 1595, 1631, 1481, 1633, 1634, 1635, 1646, 1647, 1648, 1649,
- /* 430 */ 1650, 1651, 1652, 1653, 1654, 1655, 1657, 1658, 1617, 1660,
- /* 440 */ 1661, 1662, 1663, 1664, 1643, 1666, 1667, 1669, 1536, 1670,
- /* 450 */ 1683, 1639, 1684, 1632, 1685, 1636, 1687, 1689, 1656, 1665,
- /* 460 */ 1668, 1659, 1677, 1671, 1678, 1681, 1693, 1675, 1672, 1695,
- /* 470 */ 1696, 1697, 1690, 1528, 1700, 1701, 1702, 1641, 1707, 1708,
- /* 480 */ 1679, 1682, 1692, 1709, 1698, 1688, 1699, 1710, 1705, 1703,
- /* 490 */ 1704, 1716, 1706, 1711, 1713, 1732, 1735, 1737, 1744, 1642,
- /* 500 */ 1673, 1715, 1723, 1748, 1718, 1719, 1720, 1721, 1714, 1717,
- /* 510 */ 1725, 1728, 1740, 1729, 1766, 1745, 1768, 1747, 1726, 1771,
- /* 520 */ 1755, 1754, 1779, 1756, 1780, 1757, 1790, 1772, 1773, 1760,
- /* 530 */ 1761, 1606, 1724, 1730, 1799, 1640, 1765, 1802, 1676, 1792,
- /* 540 */ 1680, 1686, 1810, 1812, 1691, 1712, 1813, 1775, 1573, 1733,
- /* 550 */ 1731, 1734, 1736, 1778, 1738, 1741, 1742, 1746, 1739, 1786,
- /* 560 */ 1777, 1791, 1749, 1795, 1594, 1750, 1751, 1842, 1805, 1602,
- /* 570 */ 1817, 1820, 1822, 1825, 1829, 1838, 1781, 1782, 1827, 1694,
- /* 580 */ 1831, 1833, 1815, 1876, 1882, 1659, 1836, 1794, 1797, 1798,
- /* 590 */ 1796, 1808, 1762, 1809, 1887, 1851, 1753, 1811, 1800, 1659,
- /* 600 */ 1860, 1864, 1722, 1758, 1763, 1907, 1888, 1752, 1818, 1816,
- /* 610 */ 1819, 1830, 1832, 1834, 1886, 1839, 1840, 1890, 1843, 1916,
- /* 620 */ 1764, 1846, 1837, 1848, 1911, 1913, 1847, 1854, 1917, 1856,
- /* 630 */ 1859, 1918, 1863, 1865, 1924, 1867, 1873, 1938, 1879, 1858,
- /* 640 */ 1869, 1870, 1872, 1953, 1871, 1897, 1950, 1900, 1961, 1906,
- /* 650 */ 1950, 1950, 1975, 1939, 1941, 1967, 1970, 1971, 1972, 1973,
- /* 660 */ 1974, 1976, 1977, 1978, 1979, 1940, 1923, 1980, 1981, 1982,
- /* 670 */ 1983, 1997, 1985, 1986, 1987, 1956, 1714, 1988, 1717, 1992,
- /* 680 */ 1993, 1996, 2005, 2019, 2007, 2044, 2011, 1999, 2009, 2049,
- /* 690 */ 2015, 2003, 2014, 2054, 2020, 2008, 2018, 2058, 2024, 2012,
- /* 700 */ 2022, 2062, 2028, 2029, 2065, 2045, 2048, 2050, 2051, 2055,
- /* 710 */ 2046,
+ /* 0 */ 133, 0, 71, 0, 289, 289, 289, 289, 289, 289,
+ /* 10 */ 289, 289, 289, 360, 576, 576, 647, 576, 576, 576,
+ /* 20 */ 576, 576, 576, 576, 576, 576, 576, 576, 576, 576,
+ /* 30 */ 576, 576, 576, 576, 576, 576, 576, 576, 576, 576,
+ /* 40 */ 576, 576, 576, 576, 576, 576, 59, 225, 110, 293,
+ /* 50 */ 58, 281, 473, 281, 110, 110, 940, 940, 940, 281,
+ /* 60 */ 940, 940, 347, 281, 78, 78, 422, 422, 36, 51,
+ /* 70 */ 230, 230, 78, 78, 78, 78, 78, 78, 78, 217,
+ /* 80 */ 78, 78, 299, 78, 78, 355, 78, 434, 78, 217,
+ /* 90 */ 456, 78, 78, 456, 78, 456, 456, 456, 78, 475,
+ /* 100 */ 786, 610, 610, 503, 112, 1116, 1116, 1116, 1116, 1116,
+ /* 110 */ 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116,
+ /* 120 */ 1116, 1116, 1116, 1116, 563, 357, 36, 51, 413, 117,
+ /* 130 */ 220, 220, 220, 429, 379, 379, 117, 525, 525, 525,
+ /* 140 */ 343, 434, 174, 456, 532, 456, 532, 532, 343, 595,
+ /* 150 */ 323, 323, 323, 323, 323, 323, 323, 1601, 523, 181,
+ /* 160 */ 712, 809, 441, 581, 439, 674, 730, 790, 663, 967,
+ /* 170 */ 655, 939, 808, 588, 802, 808, 1042, 834, 956, 1106,
+ /* 180 */ 1329, 1202, 1346, 1372, 1346, 1235, 1379, 1379, 1346, 1235,
+ /* 190 */ 1235, 1314, 1379, 1379, 1379, 1401, 1401, 1404, 299, 434,
+ /* 200 */ 299, 1414, 1427, 299, 1414, 299, 299, 299, 1379, 299,
+ /* 210 */ 1403, 1403, 1401, 456, 456, 456, 456, 456, 456, 456,
+ /* 220 */ 456, 456, 456, 456, 1379, 1401, 532, 532, 532, 1269,
+ /* 230 */ 1404, 475, 1284, 434, 475, 1379, 1372, 1372, 532, 1228,
+ /* 240 */ 1231, 532, 1228, 1231, 532, 532, 456, 1233, 1326, 1228,
+ /* 250 */ 1237, 1240, 1257, 1106, 1241, 1249, 1255, 1278, 525, 1516,
+ /* 260 */ 1379, 1414, 475, 1519, 1231, 532, 532, 532, 532, 532,
+ /* 270 */ 1231, 532, 1402, 475, 343, 475, 525, 1475, 1480, 532,
+ /* 280 */ 595, 1379, 475, 1548, 1401, 2733, 2733, 2733, 2733, 2733,
+ /* 290 */ 2733, 2733, 2733, 2733, 828, 1034, 457, 295, 260, 549,
+ /* 300 */ 759, 969, 874, 1033, 1227, 1211, 1279, 1279, 1279, 1279,
+ /* 310 */ 1279, 1279, 1279, 1279, 1279, 1041, 125, 13, 13, 506,
+ /* 320 */ 400, 516, 615, 587, 297, 297, 353, 53, 248, 353,
+ /* 330 */ 353, 353, 283, 1058, 572, 1043, 987, 1023, 1022, 1037,
+ /* 340 */ 1085, 1175, 1081, 1083, 1153, 915, 1079, 1098, 1100, 1101,
+ /* 350 */ 994, 990, 1057, 98, 1159, 1185, 1201, 1203, 1204, 1220,
+ /* 360 */ 1205, 1097, 1120, 1114, 1260, 1259, 1263, 1264, 1266, 1267,
+ /* 370 */ 1288, 1302, 40, 1122, 1332, 1315, 1327, 1606, 1607, 1423,
+ /* 380 */ 1611, 1612, 1571, 1614, 1580, 1416, 1583, 1584, 1587, 1430,
+ /* 390 */ 1623, 1597, 1598, 1435, 1636, 1437, 1638, 1608, 1641, 1620,
+ /* 400 */ 1645, 1613, 1464, 1470, 1651, 1653, 1484, 1487, 1661, 1678,
+ /* 410 */ 1617, 1665, 1666, 1667, 1626, 1669, 1670, 1671, 1672, 1673,
+ /* 420 */ 1674, 1675, 1676, 1529, 1646, 1682, 1533, 1685, 1692, 1696,
+ /* 430 */ 1697, 1699, 1700, 1701, 1703, 1704, 1705, 1706, 1708, 1710,
+ /* 440 */ 1711, 1712, 1677, 1713, 1714, 1715, 1716, 1717, 1698, 1718,
+ /* 450 */ 1721, 1722, 1588, 1724, 1732, 1691, 1727, 1679, 1728, 1681,
+ /* 460 */ 1729, 1730, 1693, 1694, 1707, 1689, 1733, 1702, 1738, 1719,
+ /* 470 */ 1740, 1720, 1723, 1753, 1754, 1757, 1731, 1592, 1758, 1759,
+ /* 480 */ 1765, 1709, 1767, 1772, 1739, 1734, 1736, 1776, 1742, 1735,
+ /* 490 */ 1741, 1778, 1744, 1745, 1749, 1781, 1755, 1747, 1750, 1784,
+ /* 500 */ 1792, 1797, 1798, 1737, 1725, 1774, 1780, 1811, 1777, 1779,
+ /* 510 */ 1782, 1783, 1771, 1775, 1785, 1786, 1794, 1787, 1823, 1802,
+ /* 520 */ 1825, 1806, 1789, 1831, 1810, 1807, 1843, 1812, 1845, 1813,
+ /* 530 */ 1846, 1827, 1833, 1815, 1816, 1819, 1760, 1763, 1855, 1743,
+ /* 540 */ 1826, 1862, 1680, 1842, 1752, 1751, 1865, 1866, 1761, 1748,
+ /* 550 */ 1864, 1828, 1621, 1788, 1773, 1790, 1791, 1832, 1834, 1793,
+ /* 560 */ 1804, 1808, 1824, 1801, 1835, 1839, 1854, 1836, 1837, 1622,
+ /* 570 */ 1829, 1841, 1874, 1838, 1631, 1867, 1887, 1888, 1892, 1893,
+ /* 580 */ 1895, 1844, 1847, 1879, 1690, 1894, 1885, 1935, 1939, 1941,
+ /* 590 */ 1689, 1897, 1851, 1852, 1868, 1856, 1863, 1796, 1871, 1942,
+ /* 600 */ 1908, 1799, 1881, 1869, 1689, 1903, 1916, 1762, 1764, 1768,
+ /* 610 */ 1975, 1956, 1795, 1884, 1886, 1889, 1890, 1898, 1896, 1933,
+ /* 620 */ 1900, 1902, 1934, 1904, 1961, 1800, 1907, 1882, 1909, 1950,
+ /* 630 */ 1952, 1912, 1913, 1954, 1915, 1918, 1964, 1917, 1919, 1969,
+ /* 640 */ 1921, 1922, 1982, 1924, 1901, 1905, 1906, 1910, 1981, 1914,
+ /* 650 */ 1928, 1983, 1931, 1993, 1936, 1983, 1983, 2010, 1970, 1973,
+ /* 660 */ 1998, 2004, 2005, 2006, 2008, 2009, 2016, 2019, 2020, 2021,
+ /* 670 */ 1987, 1966, 2015, 2025, 2026, 2028, 2042, 2030, 2032, 2033,
+ /* 680 */ 2007, 1771, 2040, 1775, 2043, 2044, 2045, 2046, 2060, 2050,
+ /* 690 */ 2086, 2052, 2041, 2049, 2090, 2056, 2047, 2055, 2093, 2061,
+ /* 700 */ 2053, 2059, 2100, 2067, 2057, 2064, 2104, 2071, 2072, 2108,
+ /* 710 */ 2087, 2089, 2091, 2094, 2096, 2092,
};
-#define YY_REDUCE_COUNT (291)
-#define YY_REDUCE_MIN (-425)
-#define YY_REDUCE_MAX (2312)
+#define YY_REDUCE_COUNT (293)
+#define YY_REDUCE_MIN (-414)
+#define YY_REDUCE_MAX (2320)
static const short yy_reduce_ofst[] = {
- /* 0 */ -17, -295, -7, 233, 633, 736, 781, 854, 909, 1021,
- /* 10 */ 1051, 1107, 1127, -169, 1195, 77, 341, 1211, 1272, 1317,
- /* 20 */ 1378, 1401, 1462, 1492, 1515, 1560, 1576, 1629, 1674, 1727,
- /* 30 */ 1743, 1788, 1841, 1857, 1902, 1925, 1955, 2031, 2053, 2108,
- /* 40 */ 2153, 2198, 2214, 2259, 2282, 2312, -276, -290, -168, -10,
- /* 50 */ 834, 837, 907, 960, -327, -181, -348, -314, -425, 252,
- /* 60 */ 755, -422, 289, -328, -219, -329, -291, -300, -303, -209,
- /* 70 */ -144, -173, 78, 258, 278, 326, 668, 688, -288, 698,
- /* 80 */ 727, 65, 748, 754, -275, 770, 86, 800, -152, -347,
- /* 90 */ 802, 828, 123, 829, 186, 187, 192, 864, -158, -294,
- /* 100 */ -282, -282, -182, -265, -170, -62, -6, 82, 105, 265,
- /* 110 */ 276, 305, 310, 347, 383, 386, 392, 439, 442, 450,
- /* 120 */ 480, 630, 631, 67, -150, 89, -116, 308, 173, -150,
- /* 130 */ 311, 332, 309, 406, 426, 175, -58, 466, 521, 126,
- /* 140 */ 306, 240, 456, 552, 516, 595, 601, 616, 627, 615,
- /* 150 */ 648, 700, 718, 806, 815, 851, -337, 812, 814, 835,
- /* 160 */ 726, 785, 895, 793, 882, 882, 904, 868, 916, 887,
- /* 170 */ 898, 843, 843, 842, 843, 856, 859, 882, 902, 900,
- /* 180 */ 915, 934, 939, 944, 949, 994, 995, 953, 958, 961,
- /* 190 */ 993, 1004, 1005, 1006, 1015, 1016, 955, 1011, 974, 1014,
- /* 200 */ 1024, 975, 1026, 1032, 1028, 1029, 1030, 1037, 1033, 1038,
- /* 210 */ 1039, 1052, 1022, 1025, 1027, 1035, 1041, 1042, 1050, 1056,
- /* 220 */ 1062, 1063, 1067, 1047, 1057, 1013, 1017, 1001, 1002, 1073,
- /* 230 */ 1043, 1045, 1093, 1100, 1058, 1061, 1065, 1009, 1066, 1076,
- /* 240 */ 1023, 1069, 1077, 1080, 882, 1018, 1034, 1046, 1036, 1044,
- /* 250 */ 1048, 1072, 1068, 1053, 1070, 843, 1116, 1085, 1156, 1154,
- /* 260 */ 1153, 1111, 1110, 1128, 1131, 1132, 1133, 1135, 1115, 1137,
- /* 270 */ 1138, 1171, 1164, 1181, 1145, 1105, 1179, 1173, 1197, 1213,
- /* 280 */ 1203, 1217, 1220, 1160, 1158, 1168, 1169, 1219, 1221, 1222,
- /* 290 */ 1223, 1232,
+ /* 0 */ -292, -297, -8, 233, 597, 620, 706, 783, 807, 852,
+ /* 10 */ 907, 963, 1008, 1031, 1119, -320, 54, 1135, 1191, 1219,
+ /* 20 */ 1281, 1336, 1398, 1428, 1486, 1502, 1547, 1563, 1640, 1664,
+ /* 30 */ 1726, 1756, 1814, 1830, 1875, 1891, 1968, 1992, 2054, 2084,
+ /* 40 */ 2142, 2158, 2203, 2219, 2296, 2320, -193, 256, 320, -383,
+ /* 50 */ -332, -110, 605, 893, 302, 642, -337, -16, 273, -414,
+ /* 60 */ -352, -171, 284, 310, -235, -199, -331, -187, -340, -368,
+ /* 70 */ -255, -167, -304, -106, 190, 313, 387, 622, 623, -288,
+ /* 80 */ 631, 784, 50, 817, 897, -43, 902, -213, 917, 35,
+ /* 90 */ -159, 918, 937, -32, 998, -1, 255, 4, 630, -22,
+ /* 100 */ 144, -411, -411, 215, -240, -312, 219, 301, 383, 389,
+ /* 110 */ 436, 510, 513, 550, 552, 571, 593, 619, 621, 629,
+ /* 120 */ 640, 688, 692, 697, -346, -228, -109, -329, 195, 173,
+ /* 130 */ -228, 254, 339, -31, 199, 341, 470, 454, 583, 584,
+ /* 140 */ -226, 224, 363, 616, 462, 627, 682, 694, 600, 636,
+ /* 150 */ -343, 318, 364, 396, 452, 519, 526, 309, 659, 670,
+ /* 160 */ 657, 635, 734, 738, 766, 869, 869, 891, 857, 910,
+ /* 170 */ 900, 904, 856, 856, 899, 856, 927, 919, 869, 957,
+ /* 180 */ 979, 992, 1013, 1012, 1016, 1020, 1065, 1066, 1025, 1029,
+ /* 190 */ 1032, 1068, 1074, 1077, 1084, 1093, 1094, 1030, 1087, 1053,
+ /* 200 */ 1089, 1099, 1059, 1107, 1115, 1109, 1111, 1112, 1121, 1113,
+ /* 210 */ 1123, 1125, 1128, 1102, 1108, 1110, 1117, 1118, 1124, 1126,
+ /* 220 */ 1129, 1130, 1131, 1133, 1132, 1136, 1088, 1103, 1127, 1061,
+ /* 230 */ 1075, 1134, 1078, 1105, 1140, 1145, 1090, 1138, 1139, 1045,
+ /* 240 */ 1137, 1141, 1054, 1144, 1142, 1143, 869, 1052, 1056, 1062,
+ /* 250 */ 1064, 1070, 1069, 1148, 1055, 1080, 1082, 856, 1166, 1146,
+ /* 260 */ 1216, 1217, 1199, 1168, 1169, 1183, 1187, 1188, 1189, 1190,
+ /* 270 */ 1170, 1192, 1186, 1229, 1218, 1232, 1207, 1152, 1214, 1208,
+ /* 280 */ 1230, 1245, 1242, 1253, 1258, 1194, 1195, 1215, 1222, 1236,
+ /* 290 */ 1243, 1252, 1254, 1280,
};
static const YYACTIONTYPE yy_default[] = {
- /* 0 */ 1595, 1595, 1595, 1595, 1595, 1595, 1595, 1595, 1595, 1595,
- /* 10 */ 1595, 1595, 1595, 1595, 1595, 1595, 1595, 1595, 1595, 1595,
- /* 20 */ 1595, 1595, 1595, 1595, 1595, 1595, 1595, 1595, 1595, 1595,
- /* 30 */ 1595, 1595, 1595, 1595, 1595, 1595, 1595, 1595, 1595, 1595,
- /* 40 */ 1595, 1595, 1595, 1595, 1595, 1595, 1595, 1595, 1595, 1595,
- /* 50 */ 1595, 1595, 1595, 1595, 1595, 1595, 1595, 1595, 1595, 1595,
- /* 60 */ 1595, 1595, 1595, 1595, 1595, 1595, 1595, 1850, 1595, 1595,
- /* 70 */ 1595, 1595, 1595, 1595, 1595, 1595, 1595, 1595, 1595, 1595,
- /* 80 */ 1595, 1673, 1595, 1595, 1595, 1595, 1595, 1595, 1595, 1595,
- /* 90 */ 1595, 1595, 1595, 1595, 1595, 1595, 1595, 1595, 1671, 1843,
- /* 100 */ 2043, 1595, 1595, 1595, 1595, 1595, 1595, 1595, 1595, 1595,
- /* 110 */ 1595, 1595, 1595, 1595, 1595, 1595, 1595, 1595, 1595, 1595,
- /* 120 */ 1595, 1595, 1595, 1595, 2055, 1595, 1595, 1673, 1595, 2055,
- /* 130 */ 2055, 2055, 1671, 2015, 2015, 1595, 1595, 1595, 1595, 1780,
- /* 140 */ 1595, 1595, 1595, 1595, 1595, 1595, 1595, 1780, 1595, 1595,
- /* 150 */ 1595, 1595, 1595, 1595, 1595, 1595, 1889, 1595, 1595, 2080,
- /* 160 */ 2133, 1595, 1595, 2083, 1595, 1595, 1595, 1855, 1595, 1733,
- /* 170 */ 2070, 2047, 2061, 2117, 2048, 2045, 2064, 1595, 2074, 1595,
- /* 180 */ 1882, 1848, 1595, 1848, 1845, 1595, 1595, 1848, 1845, 1845,
- /* 190 */ 1724, 1595, 1595, 1595, 1595, 1595, 1595, 1673, 1595, 1673,
- /* 200 */ 1595, 1595, 1673, 1595, 1673, 1673, 1673, 1595, 1673, 1652,
- /* 210 */ 1652, 1595, 1595, 1595, 1595, 1595, 1595, 1595, 1595, 1595,
- /* 220 */ 1595, 1595, 1595, 1595, 1595, 1595, 1595, 1902, 1595, 1671,
- /* 230 */ 1891, 1595, 1671, 1595, 1595, 1595, 1595, 2090, 2088, 1595,
- /* 240 */ 2090, 2088, 1595, 1595, 1595, 2102, 2098, 2090, 2106, 2104,
- /* 250 */ 2076, 2074, 2136, 2123, 2119, 2061, 1595, 1595, 1595, 1595,
- /* 260 */ 1671, 1595, 2088, 1595, 1595, 1595, 1595, 1595, 2088, 1595,
- /* 270 */ 1595, 1671, 1595, 1671, 1595, 1595, 1749, 1595, 1595, 1595,
- /* 280 */ 1671, 1627, 1595, 1884, 1895, 1867, 1867, 1783, 1783, 1783,
- /* 290 */ 1674, 1600, 1595, 1595, 1595, 1595, 1595, 1595, 1595, 1595,
- /* 300 */ 1595, 1595, 1595, 1595, 2101, 2100, 1971, 1595, 2019, 2018,
- /* 310 */ 2017, 2008, 1970, 1745, 1595, 1969, 1968, 1595, 1595, 1595,
- /* 320 */ 1595, 1595, 1863, 1862, 1962, 1595, 1595, 1963, 1961, 1960,
- /* 330 */ 1595, 1595, 1595, 1595, 1595, 1595, 1595, 1595, 1595, 1595,
- /* 340 */ 1595, 1595, 1595, 1595, 1595, 1595, 1595, 2120, 2124, 1595,
- /* 350 */ 1595, 1595, 1595, 1595, 1595, 2044, 1595, 1595, 1595, 1595,
- /* 360 */ 1595, 1944, 1595, 1595, 1595, 1595, 1595, 1595, 1595, 1595,
- /* 370 */ 1595, 1595, 1595, 1595, 1595, 1595, 1595, 1595, 1595, 1595,
- /* 380 */ 1595, 1595, 1595, 1595, 1595, 1595, 1595, 1595, 1595, 1595,
- /* 390 */ 1595, 1595, 1595, 1595, 1595, 1595, 1595, 1595, 1595, 1595,
- /* 400 */ 1595, 1595, 1595, 1595, 1595, 1595, 1595, 1595, 1595, 1595,
- /* 410 */ 1595, 1595, 1595, 1595, 1595, 1595, 1595, 1595, 1595, 1595,
- /* 420 */ 1595, 1595, 1595, 1595, 1595, 1595, 1595, 1595, 1595, 1595,
- /* 430 */ 1595, 1595, 1595, 1595, 1595, 1595, 1595, 1595, 1595, 1595,
- /* 440 */ 1595, 1595, 1595, 1595, 1595, 1595, 1595, 1595, 1595, 1595,
- /* 450 */ 1595, 1595, 1595, 1595, 1595, 1595, 1595, 1595, 1595, 1595,
- /* 460 */ 1632, 1949, 1595, 1595, 1595, 1595, 1595, 1595, 1595, 1595,
- /* 470 */ 1595, 1595, 1595, 1595, 1595, 1595, 1595, 1595, 1595, 1595,
- /* 480 */ 1595, 1595, 1595, 1595, 1595, 1595, 1595, 1595, 1595, 1595,
- /* 490 */ 1595, 1595, 1595, 1595, 1595, 1595, 1595, 1595, 1595, 1595,
- /* 500 */ 1595, 1595, 1595, 1595, 1595, 1595, 1595, 1595, 1712, 1711,
- /* 510 */ 1595, 1595, 1595, 1595, 1595, 1595, 1595, 1595, 1595, 1595,
- /* 520 */ 1595, 1595, 1595, 1595, 1595, 1595, 1595, 1595, 1595, 1595,
- /* 530 */ 1595, 1595, 1953, 1595, 1595, 1595, 1595, 1595, 1595, 1595,
- /* 540 */ 1595, 1595, 1595, 1595, 1595, 1595, 2116, 2077, 1595, 1595,
- /* 550 */ 1595, 1595, 1595, 1595, 1595, 1595, 1595, 1595, 1595, 1595,
- /* 560 */ 1595, 1944, 1595, 2099, 1595, 1595, 2114, 1595, 2118, 1595,
- /* 570 */ 1595, 1595, 1595, 1595, 1595, 1595, 2054, 2050, 1595, 1595,
- /* 580 */ 2046, 1595, 1595, 1595, 1595, 1952, 1595, 1595, 1595, 1595,
- /* 590 */ 1595, 1595, 1595, 1595, 1595, 1595, 1595, 1595, 1595, 1943,
- /* 600 */ 1595, 2005, 1595, 1595, 1595, 2039, 1595, 1595, 1990, 1595,
- /* 610 */ 1595, 1595, 1595, 1595, 1595, 1595, 1595, 1595, 1953, 1595,
- /* 620 */ 1956, 1595, 1595, 1595, 1595, 1595, 1777, 1595, 1595, 1595,
- /* 630 */ 1595, 1595, 1595, 1595, 1595, 1595, 1595, 1595, 1595, 1762,
- /* 640 */ 1760, 1759, 1758, 1595, 1755, 1595, 1790, 1595, 1595, 1595,
- /* 650 */ 1786, 1785, 1595, 1595, 1595, 1595, 1595, 1595, 1595, 1595,
- /* 660 */ 1595, 1595, 1595, 1595, 1595, 1595, 1595, 1692, 1595, 1595,
- /* 670 */ 1595, 1595, 1595, 1595, 1595, 1595, 1684, 1595, 1683, 1595,
- /* 680 */ 1595, 1595, 1595, 1595, 1595, 1595, 1595, 1595, 1595, 1595,
- /* 690 */ 1595, 1595, 1595, 1595, 1595, 1595, 1595, 1595, 1595, 1595,
- /* 700 */ 1595, 1595, 1595, 1595, 1595, 1595, 1595, 1595, 1595, 1595,
- /* 710 */ 1595,
+ /* 0 */ 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608,
+ /* 10 */ 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608,
+ /* 20 */ 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608,
+ /* 30 */ 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608,
+ /* 40 */ 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608,
+ /* 50 */ 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608,
+ /* 60 */ 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1863, 1608,
+ /* 70 */ 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608,
+ /* 80 */ 1608, 1608, 1686, 1608, 1608, 1608, 1608, 1608, 1608, 1608,
+ /* 90 */ 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1684,
+ /* 100 */ 1856, 2058, 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608,
+ /* 110 */ 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608,
+ /* 120 */ 1608, 1608, 1608, 1608, 1608, 2070, 1608, 1608, 1686, 1608,
+ /* 130 */ 2070, 2070, 2070, 1684, 2030, 2030, 1608, 1608, 1608, 1608,
+ /* 140 */ 1793, 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1793, 1608,
+ /* 150 */ 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1902, 1608, 1608,
+ /* 160 */ 2095, 2150, 1608, 1608, 2098, 1608, 1608, 1608, 1868, 1608,
+ /* 170 */ 1746, 2085, 2062, 2076, 2134, 2063, 2060, 2079, 1608, 2089,
+ /* 180 */ 1608, 1895, 1861, 1608, 1861, 1858, 1608, 1608, 1861, 1858,
+ /* 190 */ 1858, 1737, 1608, 1608, 1608, 1608, 1608, 1608, 1686, 1608,
+ /* 200 */ 1686, 1608, 1608, 1686, 1608, 1686, 1686, 1686, 1608, 1686,
+ /* 210 */ 1665, 1665, 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608,
+ /* 220 */ 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1917,
+ /* 230 */ 1608, 1684, 1904, 1608, 1684, 1608, 1608, 1608, 1608, 2105,
+ /* 240 */ 2103, 1608, 2105, 2103, 1608, 1608, 1608, 2119, 2115, 2105,
+ /* 250 */ 2123, 2121, 2091, 2089, 2153, 2140, 2136, 2076, 1608, 1608,
+ /* 260 */ 1608, 1608, 1684, 1608, 2103, 1608, 1608, 1608, 1608, 1608,
+ /* 270 */ 2103, 1608, 1608, 1684, 1608, 1684, 1608, 1608, 1762, 1608,
+ /* 280 */ 1608, 1608, 1684, 1640, 1608, 1897, 1908, 1880, 1880, 1796,
+ /* 290 */ 1796, 1796, 1687, 1613, 1608, 1608, 1608, 1608, 1608, 1608,
+ /* 300 */ 1608, 1608, 1608, 1608, 1608, 1608, 2118, 2117, 1986, 1608,
+ /* 310 */ 2034, 2033, 2032, 2023, 1985, 1758, 1608, 1984, 1983, 1608,
+ /* 320 */ 1608, 1608, 1608, 1608, 1876, 1875, 1977, 1608, 1608, 1978,
+ /* 330 */ 1976, 1975, 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608,
+ /* 340 */ 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608,
+ /* 350 */ 1608, 2137, 2141, 1608, 1608, 1608, 1608, 1608, 1608, 2059,
+ /* 360 */ 1608, 1608, 1608, 1608, 1608, 1959, 1608, 1608, 1608, 1608,
+ /* 370 */ 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608,
+ /* 380 */ 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608,
+ /* 390 */ 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608,
+ /* 400 */ 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608,
+ /* 410 */ 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608,
+ /* 420 */ 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608,
+ /* 430 */ 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608,
+ /* 440 */ 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608,
+ /* 450 */ 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608,
+ /* 460 */ 1608, 1608, 1608, 1608, 1645, 1964, 1608, 1608, 1608, 1608,
+ /* 470 */ 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608,
+ /* 480 */ 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608,
+ /* 490 */ 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608,
+ /* 500 */ 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608,
+ /* 510 */ 1608, 1608, 1725, 1724, 1608, 1608, 1608, 1608, 1608, 1608,
+ /* 520 */ 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608,
+ /* 530 */ 1608, 1608, 1608, 1608, 1608, 1608, 1968, 1608, 1608, 1608,
+ /* 540 */ 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608,
+ /* 550 */ 2133, 2092, 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608,
+ /* 560 */ 1608, 1608, 1608, 1608, 1608, 1608, 1959, 1608, 2116, 1608,
+ /* 570 */ 1608, 2131, 1608, 2135, 1608, 1608, 1608, 1608, 1608, 1608,
+ /* 580 */ 1608, 2069, 2065, 1608, 1608, 2061, 1608, 1608, 1608, 1608,
+ /* 590 */ 1967, 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608,
+ /* 600 */ 1608, 1608, 1608, 1608, 1958, 1608, 2020, 1608, 1608, 1608,
+ /* 610 */ 2054, 1608, 1608, 2005, 1608, 1608, 1608, 1608, 1608, 1608,
+ /* 620 */ 1608, 1608, 1608, 1968, 1608, 1971, 1608, 1608, 1608, 1608,
+ /* 630 */ 1608, 1790, 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608,
+ /* 640 */ 1608, 1608, 1608, 1608, 1775, 1773, 1772, 1771, 1608, 1768,
+ /* 650 */ 1608, 1803, 1608, 1608, 1608, 1799, 1798, 1608, 1608, 1608,
+ /* 660 */ 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608,
+ /* 670 */ 1608, 1608, 1705, 1608, 1608, 1608, 1608, 1608, 1608, 1608,
+ /* 680 */ 1608, 1697, 1608, 1696, 1608, 1608, 1608, 1608, 1608, 1608,
+ /* 690 */ 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608,
+ /* 700 */ 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608, 1608,
+ /* 710 */ 1608, 1608, 1608, 1608, 1608, 1608,
};
/********** End of lemon-generated parsing tables *****************************/
@@ -1165,6 +1167,7 @@ static const YYCODETYPE yyFallback[] = {
0, /* IGNORE => nothing */
0, /* EXPIRED => nothing */
0, /* FILL_HISTORY => nothing */
+ 0, /* UPDATE => nothing */
0, /* SUBTABLE => nothing */
0, /* KILL => nothing */
0, /* CONNECTION => nothing */
@@ -1198,7 +1201,7 @@ static const YYCODETYPE yyFallback[] = {
0, /* COUNT => nothing */
0, /* LAST_ROW => nothing */
0, /* CASE => nothing */
- 268, /* END => ABORT */
+ 271, /* END => ABORT */
0, /* WHEN => nothing */
0, /* THEN => nothing */
0, /* ELSE => nothing */
@@ -1225,8 +1228,10 @@ static const YYCODETYPE yyFallback[] = {
0, /* SLIDING => nothing */
0, /* FILL => nothing */
0, /* VALUE => nothing */
+ 0, /* VALUE_F => nothing */
0, /* NONE => nothing */
0, /* PREV => nothing */
+ 0, /* NULL_F => nothing */
0, /* LINEAR => nothing */
0, /* NEXT => nothing */
0, /* HAVING => nothing */
@@ -1240,59 +1245,58 @@ static const YYCODETYPE yyFallback[] = {
0, /* ASC => nothing */
0, /* NULLS => nothing */
0, /* ABORT => nothing */
- 268, /* AFTER => ABORT */
- 268, /* ATTACH => ABORT */
- 268, /* BEFORE => ABORT */
- 268, /* BEGIN => ABORT */
- 268, /* BITAND => ABORT */
- 268, /* BITNOT => ABORT */
- 268, /* BITOR => ABORT */
- 268, /* BLOCKS => ABORT */
- 268, /* CHANGE => ABORT */
- 268, /* COMMA => ABORT */
- 268, /* COMPACT => ABORT */
- 268, /* CONCAT => ABORT */
- 268, /* CONFLICT => ABORT */
- 268, /* COPY => ABORT */
- 268, /* DEFERRED => ABORT */
- 268, /* DELIMITERS => ABORT */
- 268, /* DETACH => ABORT */
- 268, /* DIVIDE => ABORT */
- 268, /* DOT => ABORT */
- 268, /* EACH => ABORT */
- 268, /* FAIL => ABORT */
- 268, /* FILE => ABORT */
- 268, /* FOR => ABORT */
- 268, /* GLOB => ABORT */
- 268, /* ID => ABORT */
- 268, /* IMMEDIATE => ABORT */
- 268, /* IMPORT => ABORT */
- 268, /* INITIALLY => ABORT */
- 268, /* INSTEAD => ABORT */
- 268, /* ISNULL => ABORT */
- 268, /* KEY => ABORT */
- 268, /* MODULES => ABORT */
- 268, /* NK_BITNOT => ABORT */
- 268, /* NK_SEMI => ABORT */
- 268, /* NOTNULL => ABORT */
- 268, /* OF => ABORT */
- 268, /* PLUS => ABORT */
- 268, /* PRIVILEGE => ABORT */
- 268, /* RAISE => ABORT */
- 268, /* REPLACE => ABORT */
- 268, /* RESTRICT => ABORT */
- 268, /* ROW => ABORT */
- 268, /* SEMI => ABORT */
- 268, /* STAR => ABORT */
- 268, /* STATEMENT => ABORT */
- 268, /* STRICT => ABORT */
- 268, /* STRING => ABORT */
- 268, /* TIMES => ABORT */
- 268, /* UPDATE => ABORT */
- 268, /* VALUES => ABORT */
- 268, /* VARIABLE => ABORT */
- 268, /* VIEW => ABORT */
- 268, /* WAL => ABORT */
+ 271, /* AFTER => ABORT */
+ 271, /* ATTACH => ABORT */
+ 271, /* BEFORE => ABORT */
+ 271, /* BEGIN => ABORT */
+ 271, /* BITAND => ABORT */
+ 271, /* BITNOT => ABORT */
+ 271, /* BITOR => ABORT */
+ 271, /* BLOCKS => ABORT */
+ 271, /* CHANGE => ABORT */
+ 271, /* COMMA => ABORT */
+ 271, /* COMPACT => ABORT */
+ 271, /* CONCAT => ABORT */
+ 271, /* CONFLICT => ABORT */
+ 271, /* COPY => ABORT */
+ 271, /* DEFERRED => ABORT */
+ 271, /* DELIMITERS => ABORT */
+ 271, /* DETACH => ABORT */
+ 271, /* DIVIDE => ABORT */
+ 271, /* DOT => ABORT */
+ 271, /* EACH => ABORT */
+ 271, /* FAIL => ABORT */
+ 271, /* FILE => ABORT */
+ 271, /* FOR => ABORT */
+ 271, /* GLOB => ABORT */
+ 271, /* ID => ABORT */
+ 271, /* IMMEDIATE => ABORT */
+ 271, /* IMPORT => ABORT */
+ 271, /* INITIALLY => ABORT */
+ 271, /* INSTEAD => ABORT */
+ 271, /* ISNULL => ABORT */
+ 271, /* KEY => ABORT */
+ 271, /* MODULES => ABORT */
+ 271, /* NK_BITNOT => ABORT */
+ 271, /* NK_SEMI => ABORT */
+ 271, /* NOTNULL => ABORT */
+ 271, /* OF => ABORT */
+ 271, /* PLUS => ABORT */
+ 271, /* PRIVILEGE => ABORT */
+ 271, /* RAISE => ABORT */
+ 271, /* REPLACE => ABORT */
+ 271, /* RESTRICT => ABORT */
+ 271, /* ROW => ABORT */
+ 271, /* SEMI => ABORT */
+ 271, /* STAR => ABORT */
+ 271, /* STATEMENT => ABORT */
+ 271, /* STRICT => ABORT */
+ 271, /* STRING => ABORT */
+ 271, /* TIMES => ABORT */
+ 271, /* VALUES => ABORT */
+ 271, /* VARIABLE => ABORT */
+ 271, /* VIEW => ABORT */
+ 271, /* WAL => ABORT */
};
#endif /* YYFALLBACK */
@@ -1574,271 +1578,273 @@ static const char *const yyTokenName[] = {
/* 191 */ "IGNORE",
/* 192 */ "EXPIRED",
/* 193 */ "FILL_HISTORY",
- /* 194 */ "SUBTABLE",
- /* 195 */ "KILL",
- /* 196 */ "CONNECTION",
- /* 197 */ "TRANSACTION",
- /* 198 */ "BALANCE",
- /* 199 */ "VGROUP",
- /* 200 */ "MERGE",
- /* 201 */ "REDISTRIBUTE",
- /* 202 */ "SPLIT",
- /* 203 */ "DELETE",
- /* 204 */ "INSERT",
- /* 205 */ "NULL",
- /* 206 */ "NK_QUESTION",
- /* 207 */ "NK_ARROW",
- /* 208 */ "ROWTS",
- /* 209 */ "QSTART",
- /* 210 */ "QEND",
- /* 211 */ "QDURATION",
- /* 212 */ "WSTART",
- /* 213 */ "WEND",
- /* 214 */ "WDURATION",
- /* 215 */ "IROWTS",
- /* 216 */ "CAST",
- /* 217 */ "NOW",
- /* 218 */ "TODAY",
- /* 219 */ "TIMEZONE",
- /* 220 */ "CLIENT_VERSION",
- /* 221 */ "SERVER_VERSION",
- /* 222 */ "SERVER_STATUS",
- /* 223 */ "CURRENT_USER",
- /* 224 */ "COUNT",
- /* 225 */ "LAST_ROW",
- /* 226 */ "CASE",
- /* 227 */ "END",
- /* 228 */ "WHEN",
- /* 229 */ "THEN",
- /* 230 */ "ELSE",
- /* 231 */ "BETWEEN",
- /* 232 */ "IS",
- /* 233 */ "NK_LT",
- /* 234 */ "NK_GT",
- /* 235 */ "NK_LE",
- /* 236 */ "NK_GE",
- /* 237 */ "NK_NE",
- /* 238 */ "MATCH",
- /* 239 */ "NMATCH",
- /* 240 */ "CONTAINS",
- /* 241 */ "IN",
- /* 242 */ "JOIN",
- /* 243 */ "INNER",
- /* 244 */ "SELECT",
- /* 245 */ "DISTINCT",
- /* 246 */ "WHERE",
- /* 247 */ "PARTITION",
- /* 248 */ "BY",
- /* 249 */ "SESSION",
- /* 250 */ "STATE_WINDOW",
- /* 251 */ "SLIDING",
- /* 252 */ "FILL",
- /* 253 */ "VALUE",
- /* 254 */ "NONE",
- /* 255 */ "PREV",
- /* 256 */ "LINEAR",
- /* 257 */ "NEXT",
- /* 258 */ "HAVING",
- /* 259 */ "RANGE",
- /* 260 */ "EVERY",
- /* 261 */ "ORDER",
- /* 262 */ "SLIMIT",
- /* 263 */ "SOFFSET",
- /* 264 */ "LIMIT",
- /* 265 */ "OFFSET",
- /* 266 */ "ASC",
- /* 267 */ "NULLS",
- /* 268 */ "ABORT",
- /* 269 */ "AFTER",
- /* 270 */ "ATTACH",
- /* 271 */ "BEFORE",
- /* 272 */ "BEGIN",
- /* 273 */ "BITAND",
- /* 274 */ "BITNOT",
- /* 275 */ "BITOR",
- /* 276 */ "BLOCKS",
- /* 277 */ "CHANGE",
- /* 278 */ "COMMA",
- /* 279 */ "COMPACT",
- /* 280 */ "CONCAT",
- /* 281 */ "CONFLICT",
- /* 282 */ "COPY",
- /* 283 */ "DEFERRED",
- /* 284 */ "DELIMITERS",
- /* 285 */ "DETACH",
- /* 286 */ "DIVIDE",
- /* 287 */ "DOT",
- /* 288 */ "EACH",
- /* 289 */ "FAIL",
- /* 290 */ "FILE",
- /* 291 */ "FOR",
- /* 292 */ "GLOB",
- /* 293 */ "ID",
- /* 294 */ "IMMEDIATE",
- /* 295 */ "IMPORT",
- /* 296 */ "INITIALLY",
- /* 297 */ "INSTEAD",
- /* 298 */ "ISNULL",
- /* 299 */ "KEY",
- /* 300 */ "MODULES",
- /* 301 */ "NK_BITNOT",
- /* 302 */ "NK_SEMI",
- /* 303 */ "NOTNULL",
- /* 304 */ "OF",
- /* 305 */ "PLUS",
- /* 306 */ "PRIVILEGE",
- /* 307 */ "RAISE",
- /* 308 */ "REPLACE",
- /* 309 */ "RESTRICT",
- /* 310 */ "ROW",
- /* 311 */ "SEMI",
- /* 312 */ "STAR",
- /* 313 */ "STATEMENT",
- /* 314 */ "STRICT",
- /* 315 */ "STRING",
- /* 316 */ "TIMES",
- /* 317 */ "UPDATE",
- /* 318 */ "VALUES",
- /* 319 */ "VARIABLE",
- /* 320 */ "VIEW",
- /* 321 */ "WAL",
- /* 322 */ "cmd",
- /* 323 */ "account_options",
- /* 324 */ "alter_account_options",
- /* 325 */ "literal",
- /* 326 */ "alter_account_option",
- /* 327 */ "user_name",
- /* 328 */ "sysinfo_opt",
- /* 329 */ "privileges",
- /* 330 */ "priv_level",
- /* 331 */ "priv_type_list",
- /* 332 */ "priv_type",
- /* 333 */ "db_name",
- /* 334 */ "topic_name",
- /* 335 */ "dnode_endpoint",
- /* 336 */ "force_opt",
- /* 337 */ "not_exists_opt",
- /* 338 */ "db_options",
- /* 339 */ "exists_opt",
- /* 340 */ "alter_db_options",
- /* 341 */ "speed_opt",
- /* 342 */ "integer_list",
- /* 343 */ "variable_list",
- /* 344 */ "retention_list",
- /* 345 */ "alter_db_option",
- /* 346 */ "retention",
- /* 347 */ "full_table_name",
- /* 348 */ "column_def_list",
- /* 349 */ "tags_def_opt",
- /* 350 */ "table_options",
- /* 351 */ "multi_create_clause",
- /* 352 */ "tags_def",
- /* 353 */ "multi_drop_clause",
- /* 354 */ "alter_table_clause",
- /* 355 */ "alter_table_options",
- /* 356 */ "column_name",
- /* 357 */ "type_name",
- /* 358 */ "signed_literal",
- /* 359 */ "create_subtable_clause",
- /* 360 */ "specific_cols_opt",
- /* 361 */ "expression_list",
- /* 362 */ "drop_table_clause",
- /* 363 */ "col_name_list",
- /* 364 */ "table_name",
- /* 365 */ "column_def",
- /* 366 */ "duration_list",
- /* 367 */ "rollup_func_list",
- /* 368 */ "alter_table_option",
- /* 369 */ "duration_literal",
- /* 370 */ "rollup_func_name",
- /* 371 */ "function_name",
- /* 372 */ "col_name",
- /* 373 */ "db_name_cond_opt",
- /* 374 */ "like_pattern_opt",
- /* 375 */ "table_name_cond",
- /* 376 */ "from_db_opt",
- /* 377 */ "tag_list_opt",
- /* 378 */ "tag_item",
- /* 379 */ "column_alias",
- /* 380 */ "full_index_name",
- /* 381 */ "index_options",
- /* 382 */ "index_name",
- /* 383 */ "func_list",
- /* 384 */ "sliding_opt",
- /* 385 */ "sma_stream_opt",
- /* 386 */ "func",
- /* 387 */ "query_or_subquery",
- /* 388 */ "cgroup_name",
- /* 389 */ "analyze_opt",
- /* 390 */ "explain_options",
- /* 391 */ "agg_func_opt",
- /* 392 */ "bufsize_opt",
- /* 393 */ "stream_name",
- /* 394 */ "stream_options",
- /* 395 */ "subtable_opt",
- /* 396 */ "expression",
- /* 397 */ "dnode_list",
- /* 398 */ "where_clause_opt",
- /* 399 */ "signed",
- /* 400 */ "literal_func",
- /* 401 */ "literal_list",
- /* 402 */ "table_alias",
- /* 403 */ "expr_or_subquery",
- /* 404 */ "pseudo_column",
- /* 405 */ "column_reference",
- /* 406 */ "function_expression",
- /* 407 */ "case_when_expression",
- /* 408 */ "star_func",
- /* 409 */ "star_func_para_list",
- /* 410 */ "noarg_func",
- /* 411 */ "other_para_list",
- /* 412 */ "star_func_para",
- /* 413 */ "when_then_list",
- /* 414 */ "case_when_else_opt",
- /* 415 */ "common_expression",
- /* 416 */ "when_then_expr",
- /* 417 */ "predicate",
- /* 418 */ "compare_op",
- /* 419 */ "in_op",
- /* 420 */ "in_predicate_value",
- /* 421 */ "boolean_value_expression",
- /* 422 */ "boolean_primary",
- /* 423 */ "from_clause_opt",
- /* 424 */ "table_reference_list",
- /* 425 */ "table_reference",
- /* 426 */ "table_primary",
- /* 427 */ "joined_table",
- /* 428 */ "alias_opt",
- /* 429 */ "subquery",
- /* 430 */ "parenthesized_joined_table",
- /* 431 */ "join_type",
- /* 432 */ "search_condition",
- /* 433 */ "query_specification",
- /* 434 */ "set_quantifier_opt",
- /* 435 */ "select_list",
- /* 436 */ "partition_by_clause_opt",
- /* 437 */ "range_opt",
- /* 438 */ "every_opt",
- /* 439 */ "fill_opt",
- /* 440 */ "twindow_clause_opt",
- /* 441 */ "group_by_clause_opt",
- /* 442 */ "having_clause_opt",
- /* 443 */ "select_item",
- /* 444 */ "partition_list",
- /* 445 */ "partition_item",
- /* 446 */ "fill_mode",
- /* 447 */ "group_by_list",
- /* 448 */ "query_expression",
- /* 449 */ "query_simple",
- /* 450 */ "order_by_clause_opt",
- /* 451 */ "slimit_clause_opt",
- /* 452 */ "limit_clause_opt",
- /* 453 */ "union_query_expression",
- /* 454 */ "query_simple_or_subquery",
- /* 455 */ "sort_specification_list",
- /* 456 */ "sort_specification",
- /* 457 */ "ordering_specification_opt",
- /* 458 */ "null_ordering_opt",
+ /* 194 */ "UPDATE",
+ /* 195 */ "SUBTABLE",
+ /* 196 */ "KILL",
+ /* 197 */ "CONNECTION",
+ /* 198 */ "TRANSACTION",
+ /* 199 */ "BALANCE",
+ /* 200 */ "VGROUP",
+ /* 201 */ "MERGE",
+ /* 202 */ "REDISTRIBUTE",
+ /* 203 */ "SPLIT",
+ /* 204 */ "DELETE",
+ /* 205 */ "INSERT",
+ /* 206 */ "NULL",
+ /* 207 */ "NK_QUESTION",
+ /* 208 */ "NK_ARROW",
+ /* 209 */ "ROWTS",
+ /* 210 */ "QSTART",
+ /* 211 */ "QEND",
+ /* 212 */ "QDURATION",
+ /* 213 */ "WSTART",
+ /* 214 */ "WEND",
+ /* 215 */ "WDURATION",
+ /* 216 */ "IROWTS",
+ /* 217 */ "CAST",
+ /* 218 */ "NOW",
+ /* 219 */ "TODAY",
+ /* 220 */ "TIMEZONE",
+ /* 221 */ "CLIENT_VERSION",
+ /* 222 */ "SERVER_VERSION",
+ /* 223 */ "SERVER_STATUS",
+ /* 224 */ "CURRENT_USER",
+ /* 225 */ "COUNT",
+ /* 226 */ "LAST_ROW",
+ /* 227 */ "CASE",
+ /* 228 */ "END",
+ /* 229 */ "WHEN",
+ /* 230 */ "THEN",
+ /* 231 */ "ELSE",
+ /* 232 */ "BETWEEN",
+ /* 233 */ "IS",
+ /* 234 */ "NK_LT",
+ /* 235 */ "NK_GT",
+ /* 236 */ "NK_LE",
+ /* 237 */ "NK_GE",
+ /* 238 */ "NK_NE",
+ /* 239 */ "MATCH",
+ /* 240 */ "NMATCH",
+ /* 241 */ "CONTAINS",
+ /* 242 */ "IN",
+ /* 243 */ "JOIN",
+ /* 244 */ "INNER",
+ /* 245 */ "SELECT",
+ /* 246 */ "DISTINCT",
+ /* 247 */ "WHERE",
+ /* 248 */ "PARTITION",
+ /* 249 */ "BY",
+ /* 250 */ "SESSION",
+ /* 251 */ "STATE_WINDOW",
+ /* 252 */ "SLIDING",
+ /* 253 */ "FILL",
+ /* 254 */ "VALUE",
+ /* 255 */ "VALUE_F",
+ /* 256 */ "NONE",
+ /* 257 */ "PREV",
+ /* 258 */ "NULL_F",
+ /* 259 */ "LINEAR",
+ /* 260 */ "NEXT",
+ /* 261 */ "HAVING",
+ /* 262 */ "RANGE",
+ /* 263 */ "EVERY",
+ /* 264 */ "ORDER",
+ /* 265 */ "SLIMIT",
+ /* 266 */ "SOFFSET",
+ /* 267 */ "LIMIT",
+ /* 268 */ "OFFSET",
+ /* 269 */ "ASC",
+ /* 270 */ "NULLS",
+ /* 271 */ "ABORT",
+ /* 272 */ "AFTER",
+ /* 273 */ "ATTACH",
+ /* 274 */ "BEFORE",
+ /* 275 */ "BEGIN",
+ /* 276 */ "BITAND",
+ /* 277 */ "BITNOT",
+ /* 278 */ "BITOR",
+ /* 279 */ "BLOCKS",
+ /* 280 */ "CHANGE",
+ /* 281 */ "COMMA",
+ /* 282 */ "COMPACT",
+ /* 283 */ "CONCAT",
+ /* 284 */ "CONFLICT",
+ /* 285 */ "COPY",
+ /* 286 */ "DEFERRED",
+ /* 287 */ "DELIMITERS",
+ /* 288 */ "DETACH",
+ /* 289 */ "DIVIDE",
+ /* 290 */ "DOT",
+ /* 291 */ "EACH",
+ /* 292 */ "FAIL",
+ /* 293 */ "FILE",
+ /* 294 */ "FOR",
+ /* 295 */ "GLOB",
+ /* 296 */ "ID",
+ /* 297 */ "IMMEDIATE",
+ /* 298 */ "IMPORT",
+ /* 299 */ "INITIALLY",
+ /* 300 */ "INSTEAD",
+ /* 301 */ "ISNULL",
+ /* 302 */ "KEY",
+ /* 303 */ "MODULES",
+ /* 304 */ "NK_BITNOT",
+ /* 305 */ "NK_SEMI",
+ /* 306 */ "NOTNULL",
+ /* 307 */ "OF",
+ /* 308 */ "PLUS",
+ /* 309 */ "PRIVILEGE",
+ /* 310 */ "RAISE",
+ /* 311 */ "REPLACE",
+ /* 312 */ "RESTRICT",
+ /* 313 */ "ROW",
+ /* 314 */ "SEMI",
+ /* 315 */ "STAR",
+ /* 316 */ "STATEMENT",
+ /* 317 */ "STRICT",
+ /* 318 */ "STRING",
+ /* 319 */ "TIMES",
+ /* 320 */ "VALUES",
+ /* 321 */ "VARIABLE",
+ /* 322 */ "VIEW",
+ /* 323 */ "WAL",
+ /* 324 */ "cmd",
+ /* 325 */ "account_options",
+ /* 326 */ "alter_account_options",
+ /* 327 */ "literal",
+ /* 328 */ "alter_account_option",
+ /* 329 */ "user_name",
+ /* 330 */ "sysinfo_opt",
+ /* 331 */ "privileges",
+ /* 332 */ "priv_level",
+ /* 333 */ "priv_type_list",
+ /* 334 */ "priv_type",
+ /* 335 */ "db_name",
+ /* 336 */ "topic_name",
+ /* 337 */ "dnode_endpoint",
+ /* 338 */ "force_opt",
+ /* 339 */ "not_exists_opt",
+ /* 340 */ "db_options",
+ /* 341 */ "exists_opt",
+ /* 342 */ "alter_db_options",
+ /* 343 */ "speed_opt",
+ /* 344 */ "integer_list",
+ /* 345 */ "variable_list",
+ /* 346 */ "retention_list",
+ /* 347 */ "alter_db_option",
+ /* 348 */ "retention",
+ /* 349 */ "full_table_name",
+ /* 350 */ "column_def_list",
+ /* 351 */ "tags_def_opt",
+ /* 352 */ "table_options",
+ /* 353 */ "multi_create_clause",
+ /* 354 */ "tags_def",
+ /* 355 */ "multi_drop_clause",
+ /* 356 */ "alter_table_clause",
+ /* 357 */ "alter_table_options",
+ /* 358 */ "column_name",
+ /* 359 */ "type_name",
+ /* 360 */ "signed_literal",
+ /* 361 */ "create_subtable_clause",
+ /* 362 */ "specific_cols_opt",
+ /* 363 */ "expression_list",
+ /* 364 */ "drop_table_clause",
+ /* 365 */ "col_name_list",
+ /* 366 */ "table_name",
+ /* 367 */ "column_def",
+ /* 368 */ "duration_list",
+ /* 369 */ "rollup_func_list",
+ /* 370 */ "alter_table_option",
+ /* 371 */ "duration_literal",
+ /* 372 */ "rollup_func_name",
+ /* 373 */ "function_name",
+ /* 374 */ "col_name",
+ /* 375 */ "db_name_cond_opt",
+ /* 376 */ "like_pattern_opt",
+ /* 377 */ "table_name_cond",
+ /* 378 */ "from_db_opt",
+ /* 379 */ "tag_list_opt",
+ /* 380 */ "tag_item",
+ /* 381 */ "column_alias",
+ /* 382 */ "full_index_name",
+ /* 383 */ "index_options",
+ /* 384 */ "index_name",
+ /* 385 */ "func_list",
+ /* 386 */ "sliding_opt",
+ /* 387 */ "sma_stream_opt",
+ /* 388 */ "func",
+ /* 389 */ "query_or_subquery",
+ /* 390 */ "cgroup_name",
+ /* 391 */ "analyze_opt",
+ /* 392 */ "explain_options",
+ /* 393 */ "agg_func_opt",
+ /* 394 */ "bufsize_opt",
+ /* 395 */ "stream_name",
+ /* 396 */ "stream_options",
+ /* 397 */ "subtable_opt",
+ /* 398 */ "expression",
+ /* 399 */ "dnode_list",
+ /* 400 */ "where_clause_opt",
+ /* 401 */ "signed",
+ /* 402 */ "literal_func",
+ /* 403 */ "literal_list",
+ /* 404 */ "table_alias",
+ /* 405 */ "expr_or_subquery",
+ /* 406 */ "pseudo_column",
+ /* 407 */ "column_reference",
+ /* 408 */ "function_expression",
+ /* 409 */ "case_when_expression",
+ /* 410 */ "star_func",
+ /* 411 */ "star_func_para_list",
+ /* 412 */ "noarg_func",
+ /* 413 */ "other_para_list",
+ /* 414 */ "star_func_para",
+ /* 415 */ "when_then_list",
+ /* 416 */ "case_when_else_opt",
+ /* 417 */ "common_expression",
+ /* 418 */ "when_then_expr",
+ /* 419 */ "predicate",
+ /* 420 */ "compare_op",
+ /* 421 */ "in_op",
+ /* 422 */ "in_predicate_value",
+ /* 423 */ "boolean_value_expression",
+ /* 424 */ "boolean_primary",
+ /* 425 */ "from_clause_opt",
+ /* 426 */ "table_reference_list",
+ /* 427 */ "table_reference",
+ /* 428 */ "table_primary",
+ /* 429 */ "joined_table",
+ /* 430 */ "alias_opt",
+ /* 431 */ "subquery",
+ /* 432 */ "parenthesized_joined_table",
+ /* 433 */ "join_type",
+ /* 434 */ "search_condition",
+ /* 435 */ "query_specification",
+ /* 436 */ "set_quantifier_opt",
+ /* 437 */ "select_list",
+ /* 438 */ "partition_by_clause_opt",
+ /* 439 */ "range_opt",
+ /* 440 */ "every_opt",
+ /* 441 */ "fill_opt",
+ /* 442 */ "twindow_clause_opt",
+ /* 443 */ "group_by_clause_opt",
+ /* 444 */ "having_clause_opt",
+ /* 445 */ "select_item",
+ /* 446 */ "partition_list",
+ /* 447 */ "partition_item",
+ /* 448 */ "fill_mode",
+ /* 449 */ "group_by_list",
+ /* 450 */ "query_expression",
+ /* 451 */ "query_simple",
+ /* 452 */ "order_by_clause_opt",
+ /* 453 */ "slimit_clause_opt",
+ /* 454 */ "limit_clause_opt",
+ /* 455 */ "union_query_expression",
+ /* 456 */ "query_simple_or_subquery",
+ /* 457 */ "sort_specification_list",
+ /* 458 */ "sort_specification",
+ /* 459 */ "ordering_specification_opt",
+ /* 460 */ "null_ordering_opt",
};
#endif /* defined(YYCOVERAGE) || !defined(NDEBUG) */
@@ -2150,243 +2156,247 @@ static const char *const yyRuleName[] = {
/* 301 */ "stream_options ::= stream_options WATERMARK duration_literal",
/* 302 */ "stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER",
/* 303 */ "stream_options ::= stream_options FILL_HISTORY NK_INTEGER",
- /* 304 */ "subtable_opt ::=",
- /* 305 */ "subtable_opt ::= SUBTABLE NK_LP expression NK_RP",
- /* 306 */ "cmd ::= KILL CONNECTION NK_INTEGER",
- /* 307 */ "cmd ::= KILL QUERY NK_STRING",
- /* 308 */ "cmd ::= KILL TRANSACTION NK_INTEGER",
- /* 309 */ "cmd ::= BALANCE VGROUP",
- /* 310 */ "cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER",
- /* 311 */ "cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list",
- /* 312 */ "cmd ::= SPLIT VGROUP NK_INTEGER",
- /* 313 */ "dnode_list ::= DNODE NK_INTEGER",
- /* 314 */ "dnode_list ::= dnode_list DNODE NK_INTEGER",
- /* 315 */ "cmd ::= DELETE FROM full_table_name where_clause_opt",
- /* 316 */ "cmd ::= query_or_subquery",
- /* 317 */ "cmd ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery",
- /* 318 */ "cmd ::= INSERT INTO full_table_name query_or_subquery",
- /* 319 */ "literal ::= NK_INTEGER",
- /* 320 */ "literal ::= NK_FLOAT",
- /* 321 */ "literal ::= NK_STRING",
- /* 322 */ "literal ::= NK_BOOL",
- /* 323 */ "literal ::= TIMESTAMP NK_STRING",
- /* 324 */ "literal ::= duration_literal",
- /* 325 */ "literal ::= NULL",
- /* 326 */ "literal ::= NK_QUESTION",
- /* 327 */ "duration_literal ::= NK_VARIABLE",
- /* 328 */ "signed ::= NK_INTEGER",
- /* 329 */ "signed ::= NK_PLUS NK_INTEGER",
- /* 330 */ "signed ::= NK_MINUS NK_INTEGER",
- /* 331 */ "signed ::= NK_FLOAT",
- /* 332 */ "signed ::= NK_PLUS NK_FLOAT",
- /* 333 */ "signed ::= NK_MINUS NK_FLOAT",
- /* 334 */ "signed_literal ::= signed",
- /* 335 */ "signed_literal ::= NK_STRING",
- /* 336 */ "signed_literal ::= NK_BOOL",
- /* 337 */ "signed_literal ::= TIMESTAMP NK_STRING",
- /* 338 */ "signed_literal ::= duration_literal",
- /* 339 */ "signed_literal ::= NULL",
- /* 340 */ "signed_literal ::= literal_func",
- /* 341 */ "signed_literal ::= NK_QUESTION",
- /* 342 */ "literal_list ::= signed_literal",
- /* 343 */ "literal_list ::= literal_list NK_COMMA signed_literal",
- /* 344 */ "db_name ::= NK_ID",
- /* 345 */ "table_name ::= NK_ID",
- /* 346 */ "column_name ::= NK_ID",
- /* 347 */ "function_name ::= NK_ID",
- /* 348 */ "table_alias ::= NK_ID",
- /* 349 */ "column_alias ::= NK_ID",
- /* 350 */ "user_name ::= NK_ID",
- /* 351 */ "topic_name ::= NK_ID",
- /* 352 */ "stream_name ::= NK_ID",
- /* 353 */ "cgroup_name ::= NK_ID",
- /* 354 */ "index_name ::= NK_ID",
- /* 355 */ "expr_or_subquery ::= expression",
- /* 356 */ "expression ::= literal",
- /* 357 */ "expression ::= pseudo_column",
- /* 358 */ "expression ::= column_reference",
- /* 359 */ "expression ::= function_expression",
- /* 360 */ "expression ::= case_when_expression",
- /* 361 */ "expression ::= NK_LP expression NK_RP",
- /* 362 */ "expression ::= NK_PLUS expr_or_subquery",
- /* 363 */ "expression ::= NK_MINUS expr_or_subquery",
- /* 364 */ "expression ::= expr_or_subquery NK_PLUS expr_or_subquery",
- /* 365 */ "expression ::= expr_or_subquery NK_MINUS expr_or_subquery",
- /* 366 */ "expression ::= expr_or_subquery NK_STAR expr_or_subquery",
- /* 367 */ "expression ::= expr_or_subquery NK_SLASH expr_or_subquery",
- /* 368 */ "expression ::= expr_or_subquery NK_REM expr_or_subquery",
- /* 369 */ "expression ::= column_reference NK_ARROW NK_STRING",
- /* 370 */ "expression ::= expr_or_subquery NK_BITAND expr_or_subquery",
- /* 371 */ "expression ::= expr_or_subquery NK_BITOR expr_or_subquery",
- /* 372 */ "expression_list ::= expr_or_subquery",
- /* 373 */ "expression_list ::= expression_list NK_COMMA expr_or_subquery",
- /* 374 */ "column_reference ::= column_name",
- /* 375 */ "column_reference ::= table_name NK_DOT column_name",
- /* 376 */ "pseudo_column ::= ROWTS",
- /* 377 */ "pseudo_column ::= TBNAME",
- /* 378 */ "pseudo_column ::= table_name NK_DOT TBNAME",
- /* 379 */ "pseudo_column ::= QSTART",
- /* 380 */ "pseudo_column ::= QEND",
- /* 381 */ "pseudo_column ::= QDURATION",
- /* 382 */ "pseudo_column ::= WSTART",
- /* 383 */ "pseudo_column ::= WEND",
- /* 384 */ "pseudo_column ::= WDURATION",
- /* 385 */ "pseudo_column ::= IROWTS",
- /* 386 */ "pseudo_column ::= QTAGS",
- /* 387 */ "function_expression ::= function_name NK_LP expression_list NK_RP",
- /* 388 */ "function_expression ::= star_func NK_LP star_func_para_list NK_RP",
- /* 389 */ "function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP",
- /* 390 */ "function_expression ::= literal_func",
- /* 391 */ "literal_func ::= noarg_func NK_LP NK_RP",
- /* 392 */ "literal_func ::= NOW",
- /* 393 */ "noarg_func ::= NOW",
- /* 394 */ "noarg_func ::= TODAY",
- /* 395 */ "noarg_func ::= TIMEZONE",
- /* 396 */ "noarg_func ::= DATABASE",
- /* 397 */ "noarg_func ::= CLIENT_VERSION",
- /* 398 */ "noarg_func ::= SERVER_VERSION",
- /* 399 */ "noarg_func ::= SERVER_STATUS",
- /* 400 */ "noarg_func ::= CURRENT_USER",
- /* 401 */ "noarg_func ::= USER",
- /* 402 */ "star_func ::= COUNT",
- /* 403 */ "star_func ::= FIRST",
- /* 404 */ "star_func ::= LAST",
- /* 405 */ "star_func ::= LAST_ROW",
- /* 406 */ "star_func_para_list ::= NK_STAR",
- /* 407 */ "star_func_para_list ::= other_para_list",
- /* 408 */ "other_para_list ::= star_func_para",
- /* 409 */ "other_para_list ::= other_para_list NK_COMMA star_func_para",
- /* 410 */ "star_func_para ::= expr_or_subquery",
- /* 411 */ "star_func_para ::= table_name NK_DOT NK_STAR",
- /* 412 */ "case_when_expression ::= CASE when_then_list case_when_else_opt END",
- /* 413 */ "case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END",
- /* 414 */ "when_then_list ::= when_then_expr",
- /* 415 */ "when_then_list ::= when_then_list when_then_expr",
- /* 416 */ "when_then_expr ::= WHEN common_expression THEN common_expression",
- /* 417 */ "case_when_else_opt ::=",
- /* 418 */ "case_when_else_opt ::= ELSE common_expression",
- /* 419 */ "predicate ::= expr_or_subquery compare_op expr_or_subquery",
- /* 420 */ "predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery",
- /* 421 */ "predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery",
- /* 422 */ "predicate ::= expr_or_subquery IS NULL",
- /* 423 */ "predicate ::= expr_or_subquery IS NOT NULL",
- /* 424 */ "predicate ::= expr_or_subquery in_op in_predicate_value",
- /* 425 */ "compare_op ::= NK_LT",
- /* 426 */ "compare_op ::= NK_GT",
- /* 427 */ "compare_op ::= NK_LE",
- /* 428 */ "compare_op ::= NK_GE",
- /* 429 */ "compare_op ::= NK_NE",
- /* 430 */ "compare_op ::= NK_EQ",
- /* 431 */ "compare_op ::= LIKE",
- /* 432 */ "compare_op ::= NOT LIKE",
- /* 433 */ "compare_op ::= MATCH",
- /* 434 */ "compare_op ::= NMATCH",
- /* 435 */ "compare_op ::= CONTAINS",
- /* 436 */ "in_op ::= IN",
- /* 437 */ "in_op ::= NOT IN",
- /* 438 */ "in_predicate_value ::= NK_LP literal_list NK_RP",
- /* 439 */ "boolean_value_expression ::= boolean_primary",
- /* 440 */ "boolean_value_expression ::= NOT boolean_primary",
- /* 441 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression",
- /* 442 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression",
- /* 443 */ "boolean_primary ::= predicate",
- /* 444 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP",
- /* 445 */ "common_expression ::= expr_or_subquery",
- /* 446 */ "common_expression ::= boolean_value_expression",
- /* 447 */ "from_clause_opt ::=",
- /* 448 */ "from_clause_opt ::= FROM table_reference_list",
- /* 449 */ "table_reference_list ::= table_reference",
- /* 450 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference",
- /* 451 */ "table_reference ::= table_primary",
- /* 452 */ "table_reference ::= joined_table",
- /* 453 */ "table_primary ::= table_name alias_opt",
- /* 454 */ "table_primary ::= db_name NK_DOT table_name alias_opt",
- /* 455 */ "table_primary ::= subquery alias_opt",
- /* 456 */ "table_primary ::= parenthesized_joined_table",
- /* 457 */ "alias_opt ::=",
- /* 458 */ "alias_opt ::= table_alias",
- /* 459 */ "alias_opt ::= AS table_alias",
- /* 460 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP",
- /* 461 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP",
- /* 462 */ "joined_table ::= table_reference join_type JOIN table_reference ON search_condition",
- /* 463 */ "join_type ::=",
- /* 464 */ "join_type ::= INNER",
- /* 465 */ "query_specification ::= SELECT set_quantifier_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt",
- /* 466 */ "set_quantifier_opt ::=",
- /* 467 */ "set_quantifier_opt ::= DISTINCT",
- /* 468 */ "set_quantifier_opt ::= ALL",
- /* 469 */ "select_list ::= select_item",
- /* 470 */ "select_list ::= select_list NK_COMMA select_item",
- /* 471 */ "select_item ::= NK_STAR",
- /* 472 */ "select_item ::= common_expression",
- /* 473 */ "select_item ::= common_expression column_alias",
- /* 474 */ "select_item ::= common_expression AS column_alias",
- /* 475 */ "select_item ::= table_name NK_DOT NK_STAR",
- /* 476 */ "where_clause_opt ::=",
- /* 477 */ "where_clause_opt ::= WHERE search_condition",
- /* 478 */ "partition_by_clause_opt ::=",
- /* 479 */ "partition_by_clause_opt ::= PARTITION BY partition_list",
- /* 480 */ "partition_list ::= partition_item",
- /* 481 */ "partition_list ::= partition_list NK_COMMA partition_item",
- /* 482 */ "partition_item ::= expr_or_subquery",
- /* 483 */ "partition_item ::= expr_or_subquery column_alias",
- /* 484 */ "partition_item ::= expr_or_subquery AS column_alias",
- /* 485 */ "twindow_clause_opt ::=",
- /* 486 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP",
- /* 487 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP",
- /* 488 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt",
- /* 489 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt",
- /* 490 */ "sliding_opt ::=",
- /* 491 */ "sliding_opt ::= SLIDING NK_LP duration_literal NK_RP",
- /* 492 */ "fill_opt ::=",
- /* 493 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP",
- /* 494 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP",
- /* 495 */ "fill_mode ::= NONE",
- /* 496 */ "fill_mode ::= PREV",
- /* 497 */ "fill_mode ::= NULL",
- /* 498 */ "fill_mode ::= LINEAR",
- /* 499 */ "fill_mode ::= NEXT",
- /* 500 */ "group_by_clause_opt ::=",
- /* 501 */ "group_by_clause_opt ::= GROUP BY group_by_list",
- /* 502 */ "group_by_list ::= expr_or_subquery",
- /* 503 */ "group_by_list ::= group_by_list NK_COMMA expr_or_subquery",
- /* 504 */ "having_clause_opt ::=",
- /* 505 */ "having_clause_opt ::= HAVING search_condition",
- /* 506 */ "range_opt ::=",
- /* 507 */ "range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP",
- /* 508 */ "every_opt ::=",
- /* 509 */ "every_opt ::= EVERY NK_LP duration_literal NK_RP",
- /* 510 */ "query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt",
- /* 511 */ "query_simple ::= query_specification",
- /* 512 */ "query_simple ::= union_query_expression",
- /* 513 */ "union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery",
- /* 514 */ "union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery",
- /* 515 */ "query_simple_or_subquery ::= query_simple",
- /* 516 */ "query_simple_or_subquery ::= subquery",
- /* 517 */ "query_or_subquery ::= query_expression",
- /* 518 */ "query_or_subquery ::= subquery",
- /* 519 */ "order_by_clause_opt ::=",
- /* 520 */ "order_by_clause_opt ::= ORDER BY sort_specification_list",
- /* 521 */ "slimit_clause_opt ::=",
- /* 522 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER",
- /* 523 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER",
- /* 524 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER",
- /* 525 */ "limit_clause_opt ::=",
- /* 526 */ "limit_clause_opt ::= LIMIT NK_INTEGER",
- /* 527 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER",
- /* 528 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER",
- /* 529 */ "subquery ::= NK_LP query_expression NK_RP",
- /* 530 */ "subquery ::= NK_LP subquery NK_RP",
- /* 531 */ "search_condition ::= common_expression",
- /* 532 */ "sort_specification_list ::= sort_specification",
- /* 533 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification",
- /* 534 */ "sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt",
- /* 535 */ "ordering_specification_opt ::=",
- /* 536 */ "ordering_specification_opt ::= ASC",
- /* 537 */ "ordering_specification_opt ::= DESC",
- /* 538 */ "null_ordering_opt ::=",
- /* 539 */ "null_ordering_opt ::= NULLS FIRST",
- /* 540 */ "null_ordering_opt ::= NULLS LAST",
+ /* 304 */ "stream_options ::= stream_options DELETE_MARK duration_literal",
+ /* 305 */ "stream_options ::= stream_options IGNORE UPDATE NK_INTEGER",
+ /* 306 */ "subtable_opt ::=",
+ /* 307 */ "subtable_opt ::= SUBTABLE NK_LP expression NK_RP",
+ /* 308 */ "cmd ::= KILL CONNECTION NK_INTEGER",
+ /* 309 */ "cmd ::= KILL QUERY NK_STRING",
+ /* 310 */ "cmd ::= KILL TRANSACTION NK_INTEGER",
+ /* 311 */ "cmd ::= BALANCE VGROUP",
+ /* 312 */ "cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER",
+ /* 313 */ "cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list",
+ /* 314 */ "cmd ::= SPLIT VGROUP NK_INTEGER",
+ /* 315 */ "dnode_list ::= DNODE NK_INTEGER",
+ /* 316 */ "dnode_list ::= dnode_list DNODE NK_INTEGER",
+ /* 317 */ "cmd ::= DELETE FROM full_table_name where_clause_opt",
+ /* 318 */ "cmd ::= query_or_subquery",
+ /* 319 */ "cmd ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery",
+ /* 320 */ "cmd ::= INSERT INTO full_table_name query_or_subquery",
+ /* 321 */ "literal ::= NK_INTEGER",
+ /* 322 */ "literal ::= NK_FLOAT",
+ /* 323 */ "literal ::= NK_STRING",
+ /* 324 */ "literal ::= NK_BOOL",
+ /* 325 */ "literal ::= TIMESTAMP NK_STRING",
+ /* 326 */ "literal ::= duration_literal",
+ /* 327 */ "literal ::= NULL",
+ /* 328 */ "literal ::= NK_QUESTION",
+ /* 329 */ "duration_literal ::= NK_VARIABLE",
+ /* 330 */ "signed ::= NK_INTEGER",
+ /* 331 */ "signed ::= NK_PLUS NK_INTEGER",
+ /* 332 */ "signed ::= NK_MINUS NK_INTEGER",
+ /* 333 */ "signed ::= NK_FLOAT",
+ /* 334 */ "signed ::= NK_PLUS NK_FLOAT",
+ /* 335 */ "signed ::= NK_MINUS NK_FLOAT",
+ /* 336 */ "signed_literal ::= signed",
+ /* 337 */ "signed_literal ::= NK_STRING",
+ /* 338 */ "signed_literal ::= NK_BOOL",
+ /* 339 */ "signed_literal ::= TIMESTAMP NK_STRING",
+ /* 340 */ "signed_literal ::= duration_literal",
+ /* 341 */ "signed_literal ::= NULL",
+ /* 342 */ "signed_literal ::= literal_func",
+ /* 343 */ "signed_literal ::= NK_QUESTION",
+ /* 344 */ "literal_list ::= signed_literal",
+ /* 345 */ "literal_list ::= literal_list NK_COMMA signed_literal",
+ /* 346 */ "db_name ::= NK_ID",
+ /* 347 */ "table_name ::= NK_ID",
+ /* 348 */ "column_name ::= NK_ID",
+ /* 349 */ "function_name ::= NK_ID",
+ /* 350 */ "table_alias ::= NK_ID",
+ /* 351 */ "column_alias ::= NK_ID",
+ /* 352 */ "user_name ::= NK_ID",
+ /* 353 */ "topic_name ::= NK_ID",
+ /* 354 */ "stream_name ::= NK_ID",
+ /* 355 */ "cgroup_name ::= NK_ID",
+ /* 356 */ "index_name ::= NK_ID",
+ /* 357 */ "expr_or_subquery ::= expression",
+ /* 358 */ "expression ::= literal",
+ /* 359 */ "expression ::= pseudo_column",
+ /* 360 */ "expression ::= column_reference",
+ /* 361 */ "expression ::= function_expression",
+ /* 362 */ "expression ::= case_when_expression",
+ /* 363 */ "expression ::= NK_LP expression NK_RP",
+ /* 364 */ "expression ::= NK_PLUS expr_or_subquery",
+ /* 365 */ "expression ::= NK_MINUS expr_or_subquery",
+ /* 366 */ "expression ::= expr_or_subquery NK_PLUS expr_or_subquery",
+ /* 367 */ "expression ::= expr_or_subquery NK_MINUS expr_or_subquery",
+ /* 368 */ "expression ::= expr_or_subquery NK_STAR expr_or_subquery",
+ /* 369 */ "expression ::= expr_or_subquery NK_SLASH expr_or_subquery",
+ /* 370 */ "expression ::= expr_or_subquery NK_REM expr_or_subquery",
+ /* 371 */ "expression ::= column_reference NK_ARROW NK_STRING",
+ /* 372 */ "expression ::= expr_or_subquery NK_BITAND expr_or_subquery",
+ /* 373 */ "expression ::= expr_or_subquery NK_BITOR expr_or_subquery",
+ /* 374 */ "expression_list ::= expr_or_subquery",
+ /* 375 */ "expression_list ::= expression_list NK_COMMA expr_or_subquery",
+ /* 376 */ "column_reference ::= column_name",
+ /* 377 */ "column_reference ::= table_name NK_DOT column_name",
+ /* 378 */ "pseudo_column ::= ROWTS",
+ /* 379 */ "pseudo_column ::= TBNAME",
+ /* 380 */ "pseudo_column ::= table_name NK_DOT TBNAME",
+ /* 381 */ "pseudo_column ::= QSTART",
+ /* 382 */ "pseudo_column ::= QEND",
+ /* 383 */ "pseudo_column ::= QDURATION",
+ /* 384 */ "pseudo_column ::= WSTART",
+ /* 385 */ "pseudo_column ::= WEND",
+ /* 386 */ "pseudo_column ::= WDURATION",
+ /* 387 */ "pseudo_column ::= IROWTS",
+ /* 388 */ "pseudo_column ::= QTAGS",
+ /* 389 */ "function_expression ::= function_name NK_LP expression_list NK_RP",
+ /* 390 */ "function_expression ::= star_func NK_LP star_func_para_list NK_RP",
+ /* 391 */ "function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP",
+ /* 392 */ "function_expression ::= literal_func",
+ /* 393 */ "literal_func ::= noarg_func NK_LP NK_RP",
+ /* 394 */ "literal_func ::= NOW",
+ /* 395 */ "noarg_func ::= NOW",
+ /* 396 */ "noarg_func ::= TODAY",
+ /* 397 */ "noarg_func ::= TIMEZONE",
+ /* 398 */ "noarg_func ::= DATABASE",
+ /* 399 */ "noarg_func ::= CLIENT_VERSION",
+ /* 400 */ "noarg_func ::= SERVER_VERSION",
+ /* 401 */ "noarg_func ::= SERVER_STATUS",
+ /* 402 */ "noarg_func ::= CURRENT_USER",
+ /* 403 */ "noarg_func ::= USER",
+ /* 404 */ "star_func ::= COUNT",
+ /* 405 */ "star_func ::= FIRST",
+ /* 406 */ "star_func ::= LAST",
+ /* 407 */ "star_func ::= LAST_ROW",
+ /* 408 */ "star_func_para_list ::= NK_STAR",
+ /* 409 */ "star_func_para_list ::= other_para_list",
+ /* 410 */ "other_para_list ::= star_func_para",
+ /* 411 */ "other_para_list ::= other_para_list NK_COMMA star_func_para",
+ /* 412 */ "star_func_para ::= expr_or_subquery",
+ /* 413 */ "star_func_para ::= table_name NK_DOT NK_STAR",
+ /* 414 */ "case_when_expression ::= CASE when_then_list case_when_else_opt END",
+ /* 415 */ "case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END",
+ /* 416 */ "when_then_list ::= when_then_expr",
+ /* 417 */ "when_then_list ::= when_then_list when_then_expr",
+ /* 418 */ "when_then_expr ::= WHEN common_expression THEN common_expression",
+ /* 419 */ "case_when_else_opt ::=",
+ /* 420 */ "case_when_else_opt ::= ELSE common_expression",
+ /* 421 */ "predicate ::= expr_or_subquery compare_op expr_or_subquery",
+ /* 422 */ "predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery",
+ /* 423 */ "predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery",
+ /* 424 */ "predicate ::= expr_or_subquery IS NULL",
+ /* 425 */ "predicate ::= expr_or_subquery IS NOT NULL",
+ /* 426 */ "predicate ::= expr_or_subquery in_op in_predicate_value",
+ /* 427 */ "compare_op ::= NK_LT",
+ /* 428 */ "compare_op ::= NK_GT",
+ /* 429 */ "compare_op ::= NK_LE",
+ /* 430 */ "compare_op ::= NK_GE",
+ /* 431 */ "compare_op ::= NK_NE",
+ /* 432 */ "compare_op ::= NK_EQ",
+ /* 433 */ "compare_op ::= LIKE",
+ /* 434 */ "compare_op ::= NOT LIKE",
+ /* 435 */ "compare_op ::= MATCH",
+ /* 436 */ "compare_op ::= NMATCH",
+ /* 437 */ "compare_op ::= CONTAINS",
+ /* 438 */ "in_op ::= IN",
+ /* 439 */ "in_op ::= NOT IN",
+ /* 440 */ "in_predicate_value ::= NK_LP literal_list NK_RP",
+ /* 441 */ "boolean_value_expression ::= boolean_primary",
+ /* 442 */ "boolean_value_expression ::= NOT boolean_primary",
+ /* 443 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression",
+ /* 444 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression",
+ /* 445 */ "boolean_primary ::= predicate",
+ /* 446 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP",
+ /* 447 */ "common_expression ::= expr_or_subquery",
+ /* 448 */ "common_expression ::= boolean_value_expression",
+ /* 449 */ "from_clause_opt ::=",
+ /* 450 */ "from_clause_opt ::= FROM table_reference_list",
+ /* 451 */ "table_reference_list ::= table_reference",
+ /* 452 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference",
+ /* 453 */ "table_reference ::= table_primary",
+ /* 454 */ "table_reference ::= joined_table",
+ /* 455 */ "table_primary ::= table_name alias_opt",
+ /* 456 */ "table_primary ::= db_name NK_DOT table_name alias_opt",
+ /* 457 */ "table_primary ::= subquery alias_opt",
+ /* 458 */ "table_primary ::= parenthesized_joined_table",
+ /* 459 */ "alias_opt ::=",
+ /* 460 */ "alias_opt ::= table_alias",
+ /* 461 */ "alias_opt ::= AS table_alias",
+ /* 462 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP",
+ /* 463 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP",
+ /* 464 */ "joined_table ::= table_reference join_type JOIN table_reference ON search_condition",
+ /* 465 */ "join_type ::=",
+ /* 466 */ "join_type ::= INNER",
+ /* 467 */ "query_specification ::= SELECT set_quantifier_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt",
+ /* 468 */ "set_quantifier_opt ::=",
+ /* 469 */ "set_quantifier_opt ::= DISTINCT",
+ /* 470 */ "set_quantifier_opt ::= ALL",
+ /* 471 */ "select_list ::= select_item",
+ /* 472 */ "select_list ::= select_list NK_COMMA select_item",
+ /* 473 */ "select_item ::= NK_STAR",
+ /* 474 */ "select_item ::= common_expression",
+ /* 475 */ "select_item ::= common_expression column_alias",
+ /* 476 */ "select_item ::= common_expression AS column_alias",
+ /* 477 */ "select_item ::= table_name NK_DOT NK_STAR",
+ /* 478 */ "where_clause_opt ::=",
+ /* 479 */ "where_clause_opt ::= WHERE search_condition",
+ /* 480 */ "partition_by_clause_opt ::=",
+ /* 481 */ "partition_by_clause_opt ::= PARTITION BY partition_list",
+ /* 482 */ "partition_list ::= partition_item",
+ /* 483 */ "partition_list ::= partition_list NK_COMMA partition_item",
+ /* 484 */ "partition_item ::= expr_or_subquery",
+ /* 485 */ "partition_item ::= expr_or_subquery column_alias",
+ /* 486 */ "partition_item ::= expr_or_subquery AS column_alias",
+ /* 487 */ "twindow_clause_opt ::=",
+ /* 488 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP",
+ /* 489 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP",
+ /* 490 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt",
+ /* 491 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt",
+ /* 492 */ "sliding_opt ::=",
+ /* 493 */ "sliding_opt ::= SLIDING NK_LP duration_literal NK_RP",
+ /* 494 */ "fill_opt ::=",
+ /* 495 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP",
+ /* 496 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP",
+ /* 497 */ "fill_opt ::= FILL NK_LP VALUE_F NK_COMMA literal_list NK_RP",
+ /* 498 */ "fill_mode ::= NONE",
+ /* 499 */ "fill_mode ::= PREV",
+ /* 500 */ "fill_mode ::= NULL",
+ /* 501 */ "fill_mode ::= NULL_F",
+ /* 502 */ "fill_mode ::= LINEAR",
+ /* 503 */ "fill_mode ::= NEXT",
+ /* 504 */ "group_by_clause_opt ::=",
+ /* 505 */ "group_by_clause_opt ::= GROUP BY group_by_list",
+ /* 506 */ "group_by_list ::= expr_or_subquery",
+ /* 507 */ "group_by_list ::= group_by_list NK_COMMA expr_or_subquery",
+ /* 508 */ "having_clause_opt ::=",
+ /* 509 */ "having_clause_opt ::= HAVING search_condition",
+ /* 510 */ "range_opt ::=",
+ /* 511 */ "range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP",
+ /* 512 */ "every_opt ::=",
+ /* 513 */ "every_opt ::= EVERY NK_LP duration_literal NK_RP",
+ /* 514 */ "query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt",
+ /* 515 */ "query_simple ::= query_specification",
+ /* 516 */ "query_simple ::= union_query_expression",
+ /* 517 */ "union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery",
+ /* 518 */ "union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery",
+ /* 519 */ "query_simple_or_subquery ::= query_simple",
+ /* 520 */ "query_simple_or_subquery ::= subquery",
+ /* 521 */ "query_or_subquery ::= query_expression",
+ /* 522 */ "query_or_subquery ::= subquery",
+ /* 523 */ "order_by_clause_opt ::=",
+ /* 524 */ "order_by_clause_opt ::= ORDER BY sort_specification_list",
+ /* 525 */ "slimit_clause_opt ::=",
+ /* 526 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER",
+ /* 527 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER",
+ /* 528 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER",
+ /* 529 */ "limit_clause_opt ::=",
+ /* 530 */ "limit_clause_opt ::= LIMIT NK_INTEGER",
+ /* 531 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER",
+ /* 532 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER",
+ /* 533 */ "subquery ::= NK_LP query_expression NK_RP",
+ /* 534 */ "subquery ::= NK_LP subquery NK_RP",
+ /* 535 */ "search_condition ::= common_expression",
+ /* 536 */ "sort_specification_list ::= sort_specification",
+ /* 537 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification",
+ /* 538 */ "sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt",
+ /* 539 */ "ordering_specification_opt ::=",
+ /* 540 */ "ordering_specification_opt ::= ASC",
+ /* 541 */ "ordering_specification_opt ::= DESC",
+ /* 542 */ "null_ordering_opt ::=",
+ /* 543 */ "null_ordering_opt ::= NULLS FIRST",
+ /* 544 */ "null_ordering_opt ::= NULLS LAST",
};
#endif /* NDEBUG */
@@ -2513,195 +2523,195 @@ static void yy_destructor(
*/
/********* Begin destructor definitions ***************************************/
/* Default NON-TERMINAL Destructor */
- case 322: /* cmd */
- case 325: /* literal */
- case 338: /* db_options */
- case 340: /* alter_db_options */
- case 346: /* retention */
- case 347: /* full_table_name */
- case 350: /* table_options */
- case 354: /* alter_table_clause */
- case 355: /* alter_table_options */
- case 358: /* signed_literal */
- case 359: /* create_subtable_clause */
- case 362: /* drop_table_clause */
- case 365: /* column_def */
- case 369: /* duration_literal */
- case 370: /* rollup_func_name */
- case 372: /* col_name */
- case 373: /* db_name_cond_opt */
- case 374: /* like_pattern_opt */
- case 375: /* table_name_cond */
- case 376: /* from_db_opt */
- case 378: /* tag_item */
- case 380: /* full_index_name */
- case 381: /* index_options */
- case 384: /* sliding_opt */
- case 385: /* sma_stream_opt */
- case 386: /* func */
- case 387: /* query_or_subquery */
- case 390: /* explain_options */
- case 394: /* stream_options */
- case 395: /* subtable_opt */
- case 396: /* expression */
- case 398: /* where_clause_opt */
- case 399: /* signed */
- case 400: /* literal_func */
- case 403: /* expr_or_subquery */
- case 404: /* pseudo_column */
- case 405: /* column_reference */
- case 406: /* function_expression */
- case 407: /* case_when_expression */
- case 412: /* star_func_para */
- case 414: /* case_when_else_opt */
- case 415: /* common_expression */
- case 416: /* when_then_expr */
- case 417: /* predicate */
- case 420: /* in_predicate_value */
- case 421: /* boolean_value_expression */
- case 422: /* boolean_primary */
- case 423: /* from_clause_opt */
- case 424: /* table_reference_list */
- case 425: /* table_reference */
- case 426: /* table_primary */
- case 427: /* joined_table */
- case 429: /* subquery */
- case 430: /* parenthesized_joined_table */
- case 432: /* search_condition */
- case 433: /* query_specification */
- case 437: /* range_opt */
- case 438: /* every_opt */
- case 439: /* fill_opt */
- case 440: /* twindow_clause_opt */
- case 442: /* having_clause_opt */
- case 443: /* select_item */
- case 445: /* partition_item */
- case 448: /* query_expression */
- case 449: /* query_simple */
- case 451: /* slimit_clause_opt */
- case 452: /* limit_clause_opt */
- case 453: /* union_query_expression */
- case 454: /* query_simple_or_subquery */
- case 456: /* sort_specification */
+ case 324: /* cmd */
+ case 327: /* literal */
+ case 340: /* db_options */
+ case 342: /* alter_db_options */
+ case 348: /* retention */
+ case 349: /* full_table_name */
+ case 352: /* table_options */
+ case 356: /* alter_table_clause */
+ case 357: /* alter_table_options */
+ case 360: /* signed_literal */
+ case 361: /* create_subtable_clause */
+ case 364: /* drop_table_clause */
+ case 367: /* column_def */
+ case 371: /* duration_literal */
+ case 372: /* rollup_func_name */
+ case 374: /* col_name */
+ case 375: /* db_name_cond_opt */
+ case 376: /* like_pattern_opt */
+ case 377: /* table_name_cond */
+ case 378: /* from_db_opt */
+ case 380: /* tag_item */
+ case 382: /* full_index_name */
+ case 383: /* index_options */
+ case 386: /* sliding_opt */
+ case 387: /* sma_stream_opt */
+ case 388: /* func */
+ case 389: /* query_or_subquery */
+ case 392: /* explain_options */
+ case 396: /* stream_options */
+ case 397: /* subtable_opt */
+ case 398: /* expression */
+ case 400: /* where_clause_opt */
+ case 401: /* signed */
+ case 402: /* literal_func */
+ case 405: /* expr_or_subquery */
+ case 406: /* pseudo_column */
+ case 407: /* column_reference */
+ case 408: /* function_expression */
+ case 409: /* case_when_expression */
+ case 414: /* star_func_para */
+ case 416: /* case_when_else_opt */
+ case 417: /* common_expression */
+ case 418: /* when_then_expr */
+ case 419: /* predicate */
+ case 422: /* in_predicate_value */
+ case 423: /* boolean_value_expression */
+ case 424: /* boolean_primary */
+ case 425: /* from_clause_opt */
+ case 426: /* table_reference_list */
+ case 427: /* table_reference */
+ case 428: /* table_primary */
+ case 429: /* joined_table */
+ case 431: /* subquery */
+ case 432: /* parenthesized_joined_table */
+ case 434: /* search_condition */
+ case 435: /* query_specification */
+ case 439: /* range_opt */
+ case 440: /* every_opt */
+ case 441: /* fill_opt */
+ case 442: /* twindow_clause_opt */
+ case 444: /* having_clause_opt */
+ case 445: /* select_item */
+ case 447: /* partition_item */
+ case 450: /* query_expression */
+ case 451: /* query_simple */
+ case 453: /* slimit_clause_opt */
+ case 454: /* limit_clause_opt */
+ case 455: /* union_query_expression */
+ case 456: /* query_simple_or_subquery */
+ case 458: /* sort_specification */
{
- nodesDestroyNode((yypminor->yy74));
+ nodesDestroyNode((yypminor->yy600));
}
break;
- case 323: /* account_options */
- case 324: /* alter_account_options */
- case 326: /* alter_account_option */
- case 341: /* speed_opt */
- case 392: /* bufsize_opt */
+ case 325: /* account_options */
+ case 326: /* alter_account_options */
+ case 328: /* alter_account_option */
+ case 343: /* speed_opt */
+ case 394: /* bufsize_opt */
{
}
break;
- case 327: /* user_name */
- case 330: /* priv_level */
- case 333: /* db_name */
- case 334: /* topic_name */
- case 335: /* dnode_endpoint */
- case 356: /* column_name */
- case 364: /* table_name */
- case 371: /* function_name */
- case 379: /* column_alias */
- case 382: /* index_name */
- case 388: /* cgroup_name */
- case 393: /* stream_name */
- case 402: /* table_alias */
- case 408: /* star_func */
- case 410: /* noarg_func */
- case 428: /* alias_opt */
+ case 329: /* user_name */
+ case 332: /* priv_level */
+ case 335: /* db_name */
+ case 336: /* topic_name */
+ case 337: /* dnode_endpoint */
+ case 358: /* column_name */
+ case 366: /* table_name */
+ case 373: /* function_name */
+ case 381: /* column_alias */
+ case 384: /* index_name */
+ case 390: /* cgroup_name */
+ case 395: /* stream_name */
+ case 404: /* table_alias */
+ case 410: /* star_func */
+ case 412: /* noarg_func */
+ case 430: /* alias_opt */
{
}
break;
- case 328: /* sysinfo_opt */
+ case 330: /* sysinfo_opt */
{
}
break;
- case 329: /* privileges */
- case 331: /* priv_type_list */
- case 332: /* priv_type */
+ case 331: /* privileges */
+ case 333: /* priv_type_list */
+ case 334: /* priv_type */
{
}
break;
- case 336: /* force_opt */
- case 337: /* not_exists_opt */
- case 339: /* exists_opt */
- case 389: /* analyze_opt */
- case 391: /* agg_func_opt */
- case 434: /* set_quantifier_opt */
+ case 338: /* force_opt */
+ case 339: /* not_exists_opt */
+ case 341: /* exists_opt */
+ case 391: /* analyze_opt */
+ case 393: /* agg_func_opt */
+ case 436: /* set_quantifier_opt */
{
}
break;
- case 342: /* integer_list */
- case 343: /* variable_list */
- case 344: /* retention_list */
- case 348: /* column_def_list */
- case 349: /* tags_def_opt */
- case 351: /* multi_create_clause */
- case 352: /* tags_def */
- case 353: /* multi_drop_clause */
- case 360: /* specific_cols_opt */
- case 361: /* expression_list */
- case 363: /* col_name_list */
- case 366: /* duration_list */
- case 367: /* rollup_func_list */
- case 377: /* tag_list_opt */
- case 383: /* func_list */
- case 397: /* dnode_list */
- case 401: /* literal_list */
- case 409: /* star_func_para_list */
- case 411: /* other_para_list */
- case 413: /* when_then_list */
- case 435: /* select_list */
- case 436: /* partition_by_clause_opt */
- case 441: /* group_by_clause_opt */
- case 444: /* partition_list */
- case 447: /* group_by_list */
- case 450: /* order_by_clause_opt */
- case 455: /* sort_specification_list */
+ case 344: /* integer_list */
+ case 345: /* variable_list */
+ case 346: /* retention_list */
+ case 350: /* column_def_list */
+ case 351: /* tags_def_opt */
+ case 353: /* multi_create_clause */
+ case 354: /* tags_def */
+ case 355: /* multi_drop_clause */
+ case 362: /* specific_cols_opt */
+ case 363: /* expression_list */
+ case 365: /* col_name_list */
+ case 368: /* duration_list */
+ case 369: /* rollup_func_list */
+ case 379: /* tag_list_opt */
+ case 385: /* func_list */
+ case 399: /* dnode_list */
+ case 403: /* literal_list */
+ case 411: /* star_func_para_list */
+ case 413: /* other_para_list */
+ case 415: /* when_then_list */
+ case 437: /* select_list */
+ case 438: /* partition_by_clause_opt */
+ case 443: /* group_by_clause_opt */
+ case 446: /* partition_list */
+ case 449: /* group_by_list */
+ case 452: /* order_by_clause_opt */
+ case 457: /* sort_specification_list */
{
- nodesDestroyList((yypminor->yy874));
+ nodesDestroyList((yypminor->yy601));
}
break;
- case 345: /* alter_db_option */
- case 368: /* alter_table_option */
+ case 347: /* alter_db_option */
+ case 370: /* alter_table_option */
{
}
break;
- case 357: /* type_name */
+ case 359: /* type_name */
{
}
break;
- case 418: /* compare_op */
- case 419: /* in_op */
+ case 420: /* compare_op */
+ case 421: /* in_op */
{
}
break;
- case 431: /* join_type */
+ case 433: /* join_type */
{
}
break;
- case 446: /* fill_mode */
+ case 448: /* fill_mode */
{
}
break;
- case 457: /* ordering_specification_opt */
+ case 459: /* ordering_specification_opt */
{
}
break;
- case 458: /* null_ordering_opt */
+ case 460: /* null_ordering_opt */
{
}
@@ -3000,547 +3010,551 @@ static const struct {
YYCODETYPE lhs; /* Symbol on the left-hand side of the rule */
signed char nrhs; /* Negative of the number of RHS symbols in the rule */
} yyRuleInfo[] = {
- { 322, -6 }, /* (0) cmd ::= CREATE ACCOUNT NK_ID PASS NK_STRING account_options */
- { 322, -4 }, /* (1) cmd ::= ALTER ACCOUNT NK_ID alter_account_options */
- { 323, 0 }, /* (2) account_options ::= */
- { 323, -3 }, /* (3) account_options ::= account_options PPS literal */
- { 323, -3 }, /* (4) account_options ::= account_options TSERIES literal */
- { 323, -3 }, /* (5) account_options ::= account_options STORAGE literal */
- { 323, -3 }, /* (6) account_options ::= account_options STREAMS literal */
- { 323, -3 }, /* (7) account_options ::= account_options QTIME literal */
- { 323, -3 }, /* (8) account_options ::= account_options DBS literal */
- { 323, -3 }, /* (9) account_options ::= account_options USERS literal */
- { 323, -3 }, /* (10) account_options ::= account_options CONNS literal */
- { 323, -3 }, /* (11) account_options ::= account_options STATE literal */
- { 324, -1 }, /* (12) alter_account_options ::= alter_account_option */
- { 324, -2 }, /* (13) alter_account_options ::= alter_account_options alter_account_option */
- { 326, -2 }, /* (14) alter_account_option ::= PASS literal */
- { 326, -2 }, /* (15) alter_account_option ::= PPS literal */
- { 326, -2 }, /* (16) alter_account_option ::= TSERIES literal */
- { 326, -2 }, /* (17) alter_account_option ::= STORAGE literal */
- { 326, -2 }, /* (18) alter_account_option ::= STREAMS literal */
- { 326, -2 }, /* (19) alter_account_option ::= QTIME literal */
- { 326, -2 }, /* (20) alter_account_option ::= DBS literal */
- { 326, -2 }, /* (21) alter_account_option ::= USERS literal */
- { 326, -2 }, /* (22) alter_account_option ::= CONNS literal */
- { 326, -2 }, /* (23) alter_account_option ::= STATE literal */
- { 322, -6 }, /* (24) cmd ::= CREATE USER user_name PASS NK_STRING sysinfo_opt */
- { 322, -5 }, /* (25) cmd ::= ALTER USER user_name PASS NK_STRING */
- { 322, -5 }, /* (26) cmd ::= ALTER USER user_name ENABLE NK_INTEGER */
- { 322, -5 }, /* (27) cmd ::= ALTER USER user_name SYSINFO NK_INTEGER */
- { 322, -3 }, /* (28) cmd ::= DROP USER user_name */
- { 328, 0 }, /* (29) sysinfo_opt ::= */
- { 328, -2 }, /* (30) sysinfo_opt ::= SYSINFO NK_INTEGER */
- { 322, -6 }, /* (31) cmd ::= GRANT privileges ON priv_level TO user_name */
- { 322, -6 }, /* (32) cmd ::= REVOKE privileges ON priv_level FROM user_name */
- { 329, -1 }, /* (33) privileges ::= ALL */
- { 329, -1 }, /* (34) privileges ::= priv_type_list */
- { 329, -1 }, /* (35) privileges ::= SUBSCRIBE */
- { 331, -1 }, /* (36) priv_type_list ::= priv_type */
- { 331, -3 }, /* (37) priv_type_list ::= priv_type_list NK_COMMA priv_type */
- { 332, -1 }, /* (38) priv_type ::= READ */
- { 332, -1 }, /* (39) priv_type ::= WRITE */
- { 330, -3 }, /* (40) priv_level ::= NK_STAR NK_DOT NK_STAR */
- { 330, -3 }, /* (41) priv_level ::= db_name NK_DOT NK_STAR */
- { 330, -1 }, /* (42) priv_level ::= topic_name */
- { 322, -3 }, /* (43) cmd ::= CREATE DNODE dnode_endpoint */
- { 322, -5 }, /* (44) cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER */
- { 322, -4 }, /* (45) cmd ::= DROP DNODE NK_INTEGER force_opt */
- { 322, -4 }, /* (46) cmd ::= DROP DNODE dnode_endpoint force_opt */
- { 322, -4 }, /* (47) cmd ::= ALTER DNODE NK_INTEGER NK_STRING */
- { 322, -5 }, /* (48) cmd ::= ALTER DNODE NK_INTEGER NK_STRING NK_STRING */
- { 322, -4 }, /* (49) cmd ::= ALTER ALL DNODES NK_STRING */
- { 322, -5 }, /* (50) cmd ::= ALTER ALL DNODES NK_STRING NK_STRING */
- { 335, -1 }, /* (51) dnode_endpoint ::= NK_STRING */
- { 335, -1 }, /* (52) dnode_endpoint ::= NK_ID */
- { 335, -1 }, /* (53) dnode_endpoint ::= NK_IPTOKEN */
- { 336, 0 }, /* (54) force_opt ::= */
- { 336, -1 }, /* (55) force_opt ::= FORCE */
- { 322, -3 }, /* (56) cmd ::= ALTER LOCAL NK_STRING */
- { 322, -4 }, /* (57) cmd ::= ALTER LOCAL NK_STRING NK_STRING */
- { 322, -5 }, /* (58) cmd ::= CREATE QNODE ON DNODE NK_INTEGER */
- { 322, -5 }, /* (59) cmd ::= DROP QNODE ON DNODE NK_INTEGER */
- { 322, -5 }, /* (60) cmd ::= CREATE BNODE ON DNODE NK_INTEGER */
- { 322, -5 }, /* (61) cmd ::= DROP BNODE ON DNODE NK_INTEGER */
- { 322, -5 }, /* (62) cmd ::= CREATE SNODE ON DNODE NK_INTEGER */
- { 322, -5 }, /* (63) cmd ::= DROP SNODE ON DNODE NK_INTEGER */
- { 322, -5 }, /* (64) cmd ::= CREATE MNODE ON DNODE NK_INTEGER */
- { 322, -5 }, /* (65) cmd ::= DROP MNODE ON DNODE NK_INTEGER */
- { 322, -5 }, /* (66) cmd ::= CREATE DATABASE not_exists_opt db_name db_options */
- { 322, -4 }, /* (67) cmd ::= DROP DATABASE exists_opt db_name */
- { 322, -2 }, /* (68) cmd ::= USE db_name */
- { 322, -4 }, /* (69) cmd ::= ALTER DATABASE db_name alter_db_options */
- { 322, -3 }, /* (70) cmd ::= FLUSH DATABASE db_name */
- { 322, -4 }, /* (71) cmd ::= TRIM DATABASE db_name speed_opt */
- { 337, -3 }, /* (72) not_exists_opt ::= IF NOT EXISTS */
- { 337, 0 }, /* (73) not_exists_opt ::= */
- { 339, -2 }, /* (74) exists_opt ::= IF EXISTS */
- { 339, 0 }, /* (75) exists_opt ::= */
- { 338, 0 }, /* (76) db_options ::= */
- { 338, -3 }, /* (77) db_options ::= db_options BUFFER NK_INTEGER */
- { 338, -3 }, /* (78) db_options ::= db_options CACHEMODEL NK_STRING */
- { 338, -3 }, /* (79) db_options ::= db_options CACHESIZE NK_INTEGER */
- { 338, -3 }, /* (80) db_options ::= db_options COMP NK_INTEGER */
- { 338, -3 }, /* (81) db_options ::= db_options DURATION NK_INTEGER */
- { 338, -3 }, /* (82) db_options ::= db_options DURATION NK_VARIABLE */
- { 338, -3 }, /* (83) db_options ::= db_options MAXROWS NK_INTEGER */
- { 338, -3 }, /* (84) db_options ::= db_options MINROWS NK_INTEGER */
- { 338, -3 }, /* (85) db_options ::= db_options KEEP integer_list */
- { 338, -3 }, /* (86) db_options ::= db_options KEEP variable_list */
- { 338, -3 }, /* (87) db_options ::= db_options PAGES NK_INTEGER */
- { 338, -3 }, /* (88) db_options ::= db_options PAGESIZE NK_INTEGER */
- { 338, -3 }, /* (89) db_options ::= db_options TSDB_PAGESIZE NK_INTEGER */
- { 338, -3 }, /* (90) db_options ::= db_options PRECISION NK_STRING */
- { 338, -3 }, /* (91) db_options ::= db_options REPLICA NK_INTEGER */
- { 338, -3 }, /* (92) db_options ::= db_options VGROUPS NK_INTEGER */
- { 338, -3 }, /* (93) db_options ::= db_options SINGLE_STABLE NK_INTEGER */
- { 338, -3 }, /* (94) db_options ::= db_options RETENTIONS retention_list */
- { 338, -3 }, /* (95) db_options ::= db_options SCHEMALESS NK_INTEGER */
- { 338, -3 }, /* (96) db_options ::= db_options WAL_LEVEL NK_INTEGER */
- { 338, -3 }, /* (97) db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER */
- { 338, -3 }, /* (98) db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER */
- { 338, -4 }, /* (99) db_options ::= db_options WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */
- { 338, -3 }, /* (100) db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER */
- { 338, -4 }, /* (101) db_options ::= db_options WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */
- { 338, -3 }, /* (102) db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER */
- { 338, -3 }, /* (103) db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER */
- { 338, -3 }, /* (104) db_options ::= db_options STT_TRIGGER NK_INTEGER */
- { 338, -3 }, /* (105) db_options ::= db_options TABLE_PREFIX NK_INTEGER */
- { 338, -3 }, /* (106) db_options ::= db_options TABLE_SUFFIX NK_INTEGER */
- { 340, -1 }, /* (107) alter_db_options ::= alter_db_option */
- { 340, -2 }, /* (108) alter_db_options ::= alter_db_options alter_db_option */
- { 345, -2 }, /* (109) alter_db_option ::= BUFFER NK_INTEGER */
- { 345, -2 }, /* (110) alter_db_option ::= CACHEMODEL NK_STRING */
- { 345, -2 }, /* (111) alter_db_option ::= CACHESIZE NK_INTEGER */
- { 345, -2 }, /* (112) alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER */
- { 345, -2 }, /* (113) alter_db_option ::= KEEP integer_list */
- { 345, -2 }, /* (114) alter_db_option ::= KEEP variable_list */
- { 345, -2 }, /* (115) alter_db_option ::= PAGES NK_INTEGER */
- { 345, -2 }, /* (116) alter_db_option ::= REPLICA NK_INTEGER */
- { 345, -2 }, /* (117) alter_db_option ::= WAL_LEVEL NK_INTEGER */
- { 345, -2 }, /* (118) alter_db_option ::= STT_TRIGGER NK_INTEGER */
- { 342, -1 }, /* (119) integer_list ::= NK_INTEGER */
- { 342, -3 }, /* (120) integer_list ::= integer_list NK_COMMA NK_INTEGER */
- { 343, -1 }, /* (121) variable_list ::= NK_VARIABLE */
- { 343, -3 }, /* (122) variable_list ::= variable_list NK_COMMA NK_VARIABLE */
- { 344, -1 }, /* (123) retention_list ::= retention */
- { 344, -3 }, /* (124) retention_list ::= retention_list NK_COMMA retention */
- { 346, -3 }, /* (125) retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */
- { 341, 0 }, /* (126) speed_opt ::= */
- { 341, -2 }, /* (127) speed_opt ::= MAX_SPEED NK_INTEGER */
- { 322, -9 }, /* (128) cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */
- { 322, -3 }, /* (129) cmd ::= CREATE TABLE multi_create_clause */
- { 322, -9 }, /* (130) cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */
- { 322, -3 }, /* (131) cmd ::= DROP TABLE multi_drop_clause */
- { 322, -4 }, /* (132) cmd ::= DROP STABLE exists_opt full_table_name */
- { 322, -3 }, /* (133) cmd ::= ALTER TABLE alter_table_clause */
- { 322, -3 }, /* (134) cmd ::= ALTER STABLE alter_table_clause */
- { 354, -2 }, /* (135) alter_table_clause ::= full_table_name alter_table_options */
- { 354, -5 }, /* (136) alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */
- { 354, -4 }, /* (137) alter_table_clause ::= full_table_name DROP COLUMN column_name */
- { 354, -5 }, /* (138) alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */
- { 354, -5 }, /* (139) alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */
- { 354, -5 }, /* (140) alter_table_clause ::= full_table_name ADD TAG column_name type_name */
- { 354, -4 }, /* (141) alter_table_clause ::= full_table_name DROP TAG column_name */
- { 354, -5 }, /* (142) alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */
- { 354, -5 }, /* (143) alter_table_clause ::= full_table_name RENAME TAG column_name column_name */
- { 354, -6 }, /* (144) alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */
- { 351, -1 }, /* (145) multi_create_clause ::= create_subtable_clause */
- { 351, -2 }, /* (146) multi_create_clause ::= multi_create_clause create_subtable_clause */
- { 359, -10 }, /* (147) create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP expression_list NK_RP table_options */
- { 353, -1 }, /* (148) multi_drop_clause ::= drop_table_clause */
- { 353, -2 }, /* (149) multi_drop_clause ::= multi_drop_clause drop_table_clause */
- { 362, -2 }, /* (150) drop_table_clause ::= exists_opt full_table_name */
- { 360, 0 }, /* (151) specific_cols_opt ::= */
- { 360, -3 }, /* (152) specific_cols_opt ::= NK_LP col_name_list NK_RP */
- { 347, -1 }, /* (153) full_table_name ::= table_name */
- { 347, -3 }, /* (154) full_table_name ::= db_name NK_DOT table_name */
- { 348, -1 }, /* (155) column_def_list ::= column_def */
- { 348, -3 }, /* (156) column_def_list ::= column_def_list NK_COMMA column_def */
- { 365, -2 }, /* (157) column_def ::= column_name type_name */
- { 365, -4 }, /* (158) column_def ::= column_name type_name COMMENT NK_STRING */
- { 357, -1 }, /* (159) type_name ::= BOOL */
- { 357, -1 }, /* (160) type_name ::= TINYINT */
- { 357, -1 }, /* (161) type_name ::= SMALLINT */
- { 357, -1 }, /* (162) type_name ::= INT */
- { 357, -1 }, /* (163) type_name ::= INTEGER */
- { 357, -1 }, /* (164) type_name ::= BIGINT */
- { 357, -1 }, /* (165) type_name ::= FLOAT */
- { 357, -1 }, /* (166) type_name ::= DOUBLE */
- { 357, -4 }, /* (167) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */
- { 357, -1 }, /* (168) type_name ::= TIMESTAMP */
- { 357, -4 }, /* (169) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */
- { 357, -2 }, /* (170) type_name ::= TINYINT UNSIGNED */
- { 357, -2 }, /* (171) type_name ::= SMALLINT UNSIGNED */
- { 357, -2 }, /* (172) type_name ::= INT UNSIGNED */
- { 357, -2 }, /* (173) type_name ::= BIGINT UNSIGNED */
- { 357, -1 }, /* (174) type_name ::= JSON */
- { 357, -4 }, /* (175) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */
- { 357, -1 }, /* (176) type_name ::= MEDIUMBLOB */
- { 357, -1 }, /* (177) type_name ::= BLOB */
- { 357, -4 }, /* (178) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */
- { 357, -1 }, /* (179) type_name ::= DECIMAL */
- { 357, -4 }, /* (180) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */
- { 357, -6 }, /* (181) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */
- { 349, 0 }, /* (182) tags_def_opt ::= */
- { 349, -1 }, /* (183) tags_def_opt ::= tags_def */
- { 352, -4 }, /* (184) tags_def ::= TAGS NK_LP column_def_list NK_RP */
- { 350, 0 }, /* (185) table_options ::= */
- { 350, -3 }, /* (186) table_options ::= table_options COMMENT NK_STRING */
- { 350, -3 }, /* (187) table_options ::= table_options MAX_DELAY duration_list */
- { 350, -3 }, /* (188) table_options ::= table_options WATERMARK duration_list */
- { 350, -5 }, /* (189) table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */
- { 350, -3 }, /* (190) table_options ::= table_options TTL NK_INTEGER */
- { 350, -5 }, /* (191) table_options ::= table_options SMA NK_LP col_name_list NK_RP */
- { 350, -3 }, /* (192) table_options ::= table_options DELETE_MARK duration_list */
- { 355, -1 }, /* (193) alter_table_options ::= alter_table_option */
- { 355, -2 }, /* (194) alter_table_options ::= alter_table_options alter_table_option */
- { 368, -2 }, /* (195) alter_table_option ::= COMMENT NK_STRING */
- { 368, -2 }, /* (196) alter_table_option ::= TTL NK_INTEGER */
- { 366, -1 }, /* (197) duration_list ::= duration_literal */
- { 366, -3 }, /* (198) duration_list ::= duration_list NK_COMMA duration_literal */
- { 367, -1 }, /* (199) rollup_func_list ::= rollup_func_name */
- { 367, -3 }, /* (200) rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */
- { 370, -1 }, /* (201) rollup_func_name ::= function_name */
- { 370, -1 }, /* (202) rollup_func_name ::= FIRST */
- { 370, -1 }, /* (203) rollup_func_name ::= LAST */
- { 363, -1 }, /* (204) col_name_list ::= col_name */
- { 363, -3 }, /* (205) col_name_list ::= col_name_list NK_COMMA col_name */
- { 372, -1 }, /* (206) col_name ::= column_name */
- { 322, -2 }, /* (207) cmd ::= SHOW DNODES */
- { 322, -2 }, /* (208) cmd ::= SHOW USERS */
- { 322, -3 }, /* (209) cmd ::= SHOW USER PRIVILEGES */
- { 322, -2 }, /* (210) cmd ::= SHOW DATABASES */
- { 322, -4 }, /* (211) cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */
- { 322, -4 }, /* (212) cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */
- { 322, -3 }, /* (213) cmd ::= SHOW db_name_cond_opt VGROUPS */
- { 322, -2 }, /* (214) cmd ::= SHOW MNODES */
- { 322, -2 }, /* (215) cmd ::= SHOW QNODES */
- { 322, -2 }, /* (216) cmd ::= SHOW FUNCTIONS */
- { 322, -5 }, /* (217) cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */
- { 322, -2 }, /* (218) cmd ::= SHOW STREAMS */
- { 322, -2 }, /* (219) cmd ::= SHOW ACCOUNTS */
- { 322, -2 }, /* (220) cmd ::= SHOW APPS */
- { 322, -2 }, /* (221) cmd ::= SHOW CONNECTIONS */
- { 322, -2 }, /* (222) cmd ::= SHOW LICENCES */
- { 322, -2 }, /* (223) cmd ::= SHOW GRANTS */
- { 322, -4 }, /* (224) cmd ::= SHOW CREATE DATABASE db_name */
- { 322, -4 }, /* (225) cmd ::= SHOW CREATE TABLE full_table_name */
- { 322, -4 }, /* (226) cmd ::= SHOW CREATE STABLE full_table_name */
- { 322, -2 }, /* (227) cmd ::= SHOW QUERIES */
- { 322, -2 }, /* (228) cmd ::= SHOW SCORES */
- { 322, -2 }, /* (229) cmd ::= SHOW TOPICS */
- { 322, -2 }, /* (230) cmd ::= SHOW VARIABLES */
- { 322, -3 }, /* (231) cmd ::= SHOW CLUSTER VARIABLES */
- { 322, -3 }, /* (232) cmd ::= SHOW LOCAL VARIABLES */
- { 322, -5 }, /* (233) cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt */
- { 322, -2 }, /* (234) cmd ::= SHOW BNODES */
- { 322, -2 }, /* (235) cmd ::= SHOW SNODES */
- { 322, -2 }, /* (236) cmd ::= SHOW CLUSTER */
- { 322, -2 }, /* (237) cmd ::= SHOW TRANSACTIONS */
- { 322, -4 }, /* (238) cmd ::= SHOW TABLE DISTRIBUTED full_table_name */
- { 322, -2 }, /* (239) cmd ::= SHOW CONSUMERS */
- { 322, -2 }, /* (240) cmd ::= SHOW SUBSCRIPTIONS */
- { 322, -5 }, /* (241) cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */
- { 322, -7 }, /* (242) cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */
- { 322, -3 }, /* (243) cmd ::= SHOW VNODES NK_INTEGER */
- { 322, -3 }, /* (244) cmd ::= SHOW VNODES NK_STRING */
- { 373, 0 }, /* (245) db_name_cond_opt ::= */
- { 373, -2 }, /* (246) db_name_cond_opt ::= db_name NK_DOT */
- { 374, 0 }, /* (247) like_pattern_opt ::= */
- { 374, -2 }, /* (248) like_pattern_opt ::= LIKE NK_STRING */
- { 375, -1 }, /* (249) table_name_cond ::= table_name */
- { 376, 0 }, /* (250) from_db_opt ::= */
- { 376, -2 }, /* (251) from_db_opt ::= FROM db_name */
- { 377, 0 }, /* (252) tag_list_opt ::= */
- { 377, -1 }, /* (253) tag_list_opt ::= tag_item */
- { 377, -3 }, /* (254) tag_list_opt ::= tag_list_opt NK_COMMA tag_item */
- { 378, -1 }, /* (255) tag_item ::= TBNAME */
- { 378, -1 }, /* (256) tag_item ::= QTAGS */
- { 378, -1 }, /* (257) tag_item ::= column_name */
- { 378, -2 }, /* (258) tag_item ::= column_name column_alias */
- { 378, -3 }, /* (259) tag_item ::= column_name AS column_alias */
- { 322, -8 }, /* (260) cmd ::= CREATE SMA INDEX not_exists_opt full_index_name ON full_table_name index_options */
- { 322, -4 }, /* (261) cmd ::= DROP INDEX exists_opt full_index_name */
- { 380, -1 }, /* (262) full_index_name ::= index_name */
- { 380, -3 }, /* (263) full_index_name ::= db_name NK_DOT index_name */
- { 381, -10 }, /* (264) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */
- { 381, -12 }, /* (265) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt sma_stream_opt */
- { 383, -1 }, /* (266) func_list ::= func */
- { 383, -3 }, /* (267) func_list ::= func_list NK_COMMA func */
- { 386, -4 }, /* (268) func ::= function_name NK_LP expression_list NK_RP */
- { 385, 0 }, /* (269) sma_stream_opt ::= */
- { 385, -3 }, /* (270) sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */
- { 385, -3 }, /* (271) sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */
- { 385, -3 }, /* (272) sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */
- { 322, -6 }, /* (273) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */
- { 322, -7 }, /* (274) cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name */
- { 322, -9 }, /* (275) cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name */
- { 322, -7 }, /* (276) cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name */
- { 322, -9 }, /* (277) cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name */
- { 322, -4 }, /* (278) cmd ::= DROP TOPIC exists_opt topic_name */
- { 322, -7 }, /* (279) cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */
- { 322, -2 }, /* (280) cmd ::= DESC full_table_name */
- { 322, -2 }, /* (281) cmd ::= DESCRIBE full_table_name */
- { 322, -3 }, /* (282) cmd ::= RESET QUERY CACHE */
- { 322, -4 }, /* (283) cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */
- { 389, 0 }, /* (284) analyze_opt ::= */
- { 389, -1 }, /* (285) analyze_opt ::= ANALYZE */
- { 390, 0 }, /* (286) explain_options ::= */
- { 390, -3 }, /* (287) explain_options ::= explain_options VERBOSE NK_BOOL */
- { 390, -3 }, /* (288) explain_options ::= explain_options RATIO NK_FLOAT */
- { 322, -10 }, /* (289) cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt */
- { 322, -4 }, /* (290) cmd ::= DROP FUNCTION exists_opt function_name */
- { 391, 0 }, /* (291) agg_func_opt ::= */
- { 391, -1 }, /* (292) agg_func_opt ::= AGGREGATE */
- { 392, 0 }, /* (293) bufsize_opt ::= */
- { 392, -2 }, /* (294) bufsize_opt ::= BUFSIZE NK_INTEGER */
- { 322, -11 }, /* (295) cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name tags_def_opt subtable_opt AS query_or_subquery */
- { 322, -4 }, /* (296) cmd ::= DROP STREAM exists_opt stream_name */
- { 394, 0 }, /* (297) stream_options ::= */
- { 394, -3 }, /* (298) stream_options ::= stream_options TRIGGER AT_ONCE */
- { 394, -3 }, /* (299) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */
- { 394, -4 }, /* (300) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */
- { 394, -3 }, /* (301) stream_options ::= stream_options WATERMARK duration_literal */
- { 394, -4 }, /* (302) stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */
- { 394, -3 }, /* (303) stream_options ::= stream_options FILL_HISTORY NK_INTEGER */
- { 395, 0 }, /* (304) subtable_opt ::= */
- { 395, -4 }, /* (305) subtable_opt ::= SUBTABLE NK_LP expression NK_RP */
- { 322, -3 }, /* (306) cmd ::= KILL CONNECTION NK_INTEGER */
- { 322, -3 }, /* (307) cmd ::= KILL QUERY NK_STRING */
- { 322, -3 }, /* (308) cmd ::= KILL TRANSACTION NK_INTEGER */
- { 322, -2 }, /* (309) cmd ::= BALANCE VGROUP */
- { 322, -4 }, /* (310) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */
- { 322, -4 }, /* (311) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */
- { 322, -3 }, /* (312) cmd ::= SPLIT VGROUP NK_INTEGER */
- { 397, -2 }, /* (313) dnode_list ::= DNODE NK_INTEGER */
- { 397, -3 }, /* (314) dnode_list ::= dnode_list DNODE NK_INTEGER */
- { 322, -4 }, /* (315) cmd ::= DELETE FROM full_table_name where_clause_opt */
- { 322, -1 }, /* (316) cmd ::= query_or_subquery */
- { 322, -7 }, /* (317) cmd ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */
- { 322, -4 }, /* (318) cmd ::= INSERT INTO full_table_name query_or_subquery */
- { 325, -1 }, /* (319) literal ::= NK_INTEGER */
- { 325, -1 }, /* (320) literal ::= NK_FLOAT */
- { 325, -1 }, /* (321) literal ::= NK_STRING */
- { 325, -1 }, /* (322) literal ::= NK_BOOL */
- { 325, -2 }, /* (323) literal ::= TIMESTAMP NK_STRING */
- { 325, -1 }, /* (324) literal ::= duration_literal */
- { 325, -1 }, /* (325) literal ::= NULL */
- { 325, -1 }, /* (326) literal ::= NK_QUESTION */
- { 369, -1 }, /* (327) duration_literal ::= NK_VARIABLE */
- { 399, -1 }, /* (328) signed ::= NK_INTEGER */
- { 399, -2 }, /* (329) signed ::= NK_PLUS NK_INTEGER */
- { 399, -2 }, /* (330) signed ::= NK_MINUS NK_INTEGER */
- { 399, -1 }, /* (331) signed ::= NK_FLOAT */
- { 399, -2 }, /* (332) signed ::= NK_PLUS NK_FLOAT */
- { 399, -2 }, /* (333) signed ::= NK_MINUS NK_FLOAT */
- { 358, -1 }, /* (334) signed_literal ::= signed */
- { 358, -1 }, /* (335) signed_literal ::= NK_STRING */
- { 358, -1 }, /* (336) signed_literal ::= NK_BOOL */
- { 358, -2 }, /* (337) signed_literal ::= TIMESTAMP NK_STRING */
- { 358, -1 }, /* (338) signed_literal ::= duration_literal */
- { 358, -1 }, /* (339) signed_literal ::= NULL */
- { 358, -1 }, /* (340) signed_literal ::= literal_func */
- { 358, -1 }, /* (341) signed_literal ::= NK_QUESTION */
- { 401, -1 }, /* (342) literal_list ::= signed_literal */
- { 401, -3 }, /* (343) literal_list ::= literal_list NK_COMMA signed_literal */
- { 333, -1 }, /* (344) db_name ::= NK_ID */
- { 364, -1 }, /* (345) table_name ::= NK_ID */
- { 356, -1 }, /* (346) column_name ::= NK_ID */
- { 371, -1 }, /* (347) function_name ::= NK_ID */
- { 402, -1 }, /* (348) table_alias ::= NK_ID */
- { 379, -1 }, /* (349) column_alias ::= NK_ID */
- { 327, -1 }, /* (350) user_name ::= NK_ID */
- { 334, -1 }, /* (351) topic_name ::= NK_ID */
- { 393, -1 }, /* (352) stream_name ::= NK_ID */
- { 388, -1 }, /* (353) cgroup_name ::= NK_ID */
- { 382, -1 }, /* (354) index_name ::= NK_ID */
- { 403, -1 }, /* (355) expr_or_subquery ::= expression */
- { 396, -1 }, /* (356) expression ::= literal */
- { 396, -1 }, /* (357) expression ::= pseudo_column */
- { 396, -1 }, /* (358) expression ::= column_reference */
- { 396, -1 }, /* (359) expression ::= function_expression */
- { 396, -1 }, /* (360) expression ::= case_when_expression */
- { 396, -3 }, /* (361) expression ::= NK_LP expression NK_RP */
- { 396, -2 }, /* (362) expression ::= NK_PLUS expr_or_subquery */
- { 396, -2 }, /* (363) expression ::= NK_MINUS expr_or_subquery */
- { 396, -3 }, /* (364) expression ::= expr_or_subquery NK_PLUS expr_or_subquery */
- { 396, -3 }, /* (365) expression ::= expr_or_subquery NK_MINUS expr_or_subquery */
- { 396, -3 }, /* (366) expression ::= expr_or_subquery NK_STAR expr_or_subquery */
- { 396, -3 }, /* (367) expression ::= expr_or_subquery NK_SLASH expr_or_subquery */
- { 396, -3 }, /* (368) expression ::= expr_or_subquery NK_REM expr_or_subquery */
- { 396, -3 }, /* (369) expression ::= column_reference NK_ARROW NK_STRING */
- { 396, -3 }, /* (370) expression ::= expr_or_subquery NK_BITAND expr_or_subquery */
- { 396, -3 }, /* (371) expression ::= expr_or_subquery NK_BITOR expr_or_subquery */
- { 361, -1 }, /* (372) expression_list ::= expr_or_subquery */
- { 361, -3 }, /* (373) expression_list ::= expression_list NK_COMMA expr_or_subquery */
- { 405, -1 }, /* (374) column_reference ::= column_name */
- { 405, -3 }, /* (375) column_reference ::= table_name NK_DOT column_name */
- { 404, -1 }, /* (376) pseudo_column ::= ROWTS */
- { 404, -1 }, /* (377) pseudo_column ::= TBNAME */
- { 404, -3 }, /* (378) pseudo_column ::= table_name NK_DOT TBNAME */
- { 404, -1 }, /* (379) pseudo_column ::= QSTART */
- { 404, -1 }, /* (380) pseudo_column ::= QEND */
- { 404, -1 }, /* (381) pseudo_column ::= QDURATION */
- { 404, -1 }, /* (382) pseudo_column ::= WSTART */
- { 404, -1 }, /* (383) pseudo_column ::= WEND */
- { 404, -1 }, /* (384) pseudo_column ::= WDURATION */
- { 404, -1 }, /* (385) pseudo_column ::= IROWTS */
- { 404, -1 }, /* (386) pseudo_column ::= QTAGS */
- { 406, -4 }, /* (387) function_expression ::= function_name NK_LP expression_list NK_RP */
- { 406, -4 }, /* (388) function_expression ::= star_func NK_LP star_func_para_list NK_RP */
- { 406, -6 }, /* (389) function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */
- { 406, -1 }, /* (390) function_expression ::= literal_func */
- { 400, -3 }, /* (391) literal_func ::= noarg_func NK_LP NK_RP */
- { 400, -1 }, /* (392) literal_func ::= NOW */
- { 410, -1 }, /* (393) noarg_func ::= NOW */
- { 410, -1 }, /* (394) noarg_func ::= TODAY */
- { 410, -1 }, /* (395) noarg_func ::= TIMEZONE */
- { 410, -1 }, /* (396) noarg_func ::= DATABASE */
- { 410, -1 }, /* (397) noarg_func ::= CLIENT_VERSION */
- { 410, -1 }, /* (398) noarg_func ::= SERVER_VERSION */
- { 410, -1 }, /* (399) noarg_func ::= SERVER_STATUS */
- { 410, -1 }, /* (400) noarg_func ::= CURRENT_USER */
- { 410, -1 }, /* (401) noarg_func ::= USER */
- { 408, -1 }, /* (402) star_func ::= COUNT */
- { 408, -1 }, /* (403) star_func ::= FIRST */
- { 408, -1 }, /* (404) star_func ::= LAST */
- { 408, -1 }, /* (405) star_func ::= LAST_ROW */
- { 409, -1 }, /* (406) star_func_para_list ::= NK_STAR */
- { 409, -1 }, /* (407) star_func_para_list ::= other_para_list */
- { 411, -1 }, /* (408) other_para_list ::= star_func_para */
- { 411, -3 }, /* (409) other_para_list ::= other_para_list NK_COMMA star_func_para */
- { 412, -1 }, /* (410) star_func_para ::= expr_or_subquery */
- { 412, -3 }, /* (411) star_func_para ::= table_name NK_DOT NK_STAR */
- { 407, -4 }, /* (412) case_when_expression ::= CASE when_then_list case_when_else_opt END */
- { 407, -5 }, /* (413) case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */
- { 413, -1 }, /* (414) when_then_list ::= when_then_expr */
- { 413, -2 }, /* (415) when_then_list ::= when_then_list when_then_expr */
- { 416, -4 }, /* (416) when_then_expr ::= WHEN common_expression THEN common_expression */
- { 414, 0 }, /* (417) case_when_else_opt ::= */
- { 414, -2 }, /* (418) case_when_else_opt ::= ELSE common_expression */
- { 417, -3 }, /* (419) predicate ::= expr_or_subquery compare_op expr_or_subquery */
- { 417, -5 }, /* (420) predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */
- { 417, -6 }, /* (421) predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */
- { 417, -3 }, /* (422) predicate ::= expr_or_subquery IS NULL */
- { 417, -4 }, /* (423) predicate ::= expr_or_subquery IS NOT NULL */
- { 417, -3 }, /* (424) predicate ::= expr_or_subquery in_op in_predicate_value */
- { 418, -1 }, /* (425) compare_op ::= NK_LT */
- { 418, -1 }, /* (426) compare_op ::= NK_GT */
- { 418, -1 }, /* (427) compare_op ::= NK_LE */
- { 418, -1 }, /* (428) compare_op ::= NK_GE */
- { 418, -1 }, /* (429) compare_op ::= NK_NE */
- { 418, -1 }, /* (430) compare_op ::= NK_EQ */
- { 418, -1 }, /* (431) compare_op ::= LIKE */
- { 418, -2 }, /* (432) compare_op ::= NOT LIKE */
- { 418, -1 }, /* (433) compare_op ::= MATCH */
- { 418, -1 }, /* (434) compare_op ::= NMATCH */
- { 418, -1 }, /* (435) compare_op ::= CONTAINS */
- { 419, -1 }, /* (436) in_op ::= IN */
- { 419, -2 }, /* (437) in_op ::= NOT IN */
- { 420, -3 }, /* (438) in_predicate_value ::= NK_LP literal_list NK_RP */
- { 421, -1 }, /* (439) boolean_value_expression ::= boolean_primary */
- { 421, -2 }, /* (440) boolean_value_expression ::= NOT boolean_primary */
- { 421, -3 }, /* (441) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */
- { 421, -3 }, /* (442) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */
- { 422, -1 }, /* (443) boolean_primary ::= predicate */
- { 422, -3 }, /* (444) boolean_primary ::= NK_LP boolean_value_expression NK_RP */
- { 415, -1 }, /* (445) common_expression ::= expr_or_subquery */
- { 415, -1 }, /* (446) common_expression ::= boolean_value_expression */
- { 423, 0 }, /* (447) from_clause_opt ::= */
- { 423, -2 }, /* (448) from_clause_opt ::= FROM table_reference_list */
- { 424, -1 }, /* (449) table_reference_list ::= table_reference */
- { 424, -3 }, /* (450) table_reference_list ::= table_reference_list NK_COMMA table_reference */
- { 425, -1 }, /* (451) table_reference ::= table_primary */
- { 425, -1 }, /* (452) table_reference ::= joined_table */
- { 426, -2 }, /* (453) table_primary ::= table_name alias_opt */
- { 426, -4 }, /* (454) table_primary ::= db_name NK_DOT table_name alias_opt */
- { 426, -2 }, /* (455) table_primary ::= subquery alias_opt */
- { 426, -1 }, /* (456) table_primary ::= parenthesized_joined_table */
- { 428, 0 }, /* (457) alias_opt ::= */
- { 428, -1 }, /* (458) alias_opt ::= table_alias */
- { 428, -2 }, /* (459) alias_opt ::= AS table_alias */
- { 430, -3 }, /* (460) parenthesized_joined_table ::= NK_LP joined_table NK_RP */
- { 430, -3 }, /* (461) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */
- { 427, -6 }, /* (462) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */
- { 431, 0 }, /* (463) join_type ::= */
- { 431, -1 }, /* (464) join_type ::= INNER */
- { 433, -12 }, /* (465) query_specification ::= SELECT set_quantifier_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt */
- { 434, 0 }, /* (466) set_quantifier_opt ::= */
- { 434, -1 }, /* (467) set_quantifier_opt ::= DISTINCT */
- { 434, -1 }, /* (468) set_quantifier_opt ::= ALL */
- { 435, -1 }, /* (469) select_list ::= select_item */
- { 435, -3 }, /* (470) select_list ::= select_list NK_COMMA select_item */
- { 443, -1 }, /* (471) select_item ::= NK_STAR */
- { 443, -1 }, /* (472) select_item ::= common_expression */
- { 443, -2 }, /* (473) select_item ::= common_expression column_alias */
- { 443, -3 }, /* (474) select_item ::= common_expression AS column_alias */
- { 443, -3 }, /* (475) select_item ::= table_name NK_DOT NK_STAR */
- { 398, 0 }, /* (476) where_clause_opt ::= */
- { 398, -2 }, /* (477) where_clause_opt ::= WHERE search_condition */
- { 436, 0 }, /* (478) partition_by_clause_opt ::= */
- { 436, -3 }, /* (479) partition_by_clause_opt ::= PARTITION BY partition_list */
- { 444, -1 }, /* (480) partition_list ::= partition_item */
- { 444, -3 }, /* (481) partition_list ::= partition_list NK_COMMA partition_item */
- { 445, -1 }, /* (482) partition_item ::= expr_or_subquery */
- { 445, -2 }, /* (483) partition_item ::= expr_or_subquery column_alias */
- { 445, -3 }, /* (484) partition_item ::= expr_or_subquery AS column_alias */
- { 440, 0 }, /* (485) twindow_clause_opt ::= */
- { 440, -6 }, /* (486) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */
- { 440, -4 }, /* (487) twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */
- { 440, -6 }, /* (488) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */
- { 440, -8 }, /* (489) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */
- { 384, 0 }, /* (490) sliding_opt ::= */
- { 384, -4 }, /* (491) sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */
- { 439, 0 }, /* (492) fill_opt ::= */
- { 439, -4 }, /* (493) fill_opt ::= FILL NK_LP fill_mode NK_RP */
- { 439, -6 }, /* (494) fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */
- { 446, -1 }, /* (495) fill_mode ::= NONE */
- { 446, -1 }, /* (496) fill_mode ::= PREV */
- { 446, -1 }, /* (497) fill_mode ::= NULL */
- { 446, -1 }, /* (498) fill_mode ::= LINEAR */
- { 446, -1 }, /* (499) fill_mode ::= NEXT */
- { 441, 0 }, /* (500) group_by_clause_opt ::= */
- { 441, -3 }, /* (501) group_by_clause_opt ::= GROUP BY group_by_list */
- { 447, -1 }, /* (502) group_by_list ::= expr_or_subquery */
- { 447, -3 }, /* (503) group_by_list ::= group_by_list NK_COMMA expr_or_subquery */
- { 442, 0 }, /* (504) having_clause_opt ::= */
- { 442, -2 }, /* (505) having_clause_opt ::= HAVING search_condition */
- { 437, 0 }, /* (506) range_opt ::= */
- { 437, -6 }, /* (507) range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */
- { 438, 0 }, /* (508) every_opt ::= */
- { 438, -4 }, /* (509) every_opt ::= EVERY NK_LP duration_literal NK_RP */
- { 448, -4 }, /* (510) query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */
- { 449, -1 }, /* (511) query_simple ::= query_specification */
- { 449, -1 }, /* (512) query_simple ::= union_query_expression */
- { 453, -4 }, /* (513) union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */
- { 453, -3 }, /* (514) union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */
- { 454, -1 }, /* (515) query_simple_or_subquery ::= query_simple */
- { 454, -1 }, /* (516) query_simple_or_subquery ::= subquery */
- { 387, -1 }, /* (517) query_or_subquery ::= query_expression */
- { 387, -1 }, /* (518) query_or_subquery ::= subquery */
- { 450, 0 }, /* (519) order_by_clause_opt ::= */
- { 450, -3 }, /* (520) order_by_clause_opt ::= ORDER BY sort_specification_list */
- { 451, 0 }, /* (521) slimit_clause_opt ::= */
- { 451, -2 }, /* (522) slimit_clause_opt ::= SLIMIT NK_INTEGER */
- { 451, -4 }, /* (523) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */
- { 451, -4 }, /* (524) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */
- { 452, 0 }, /* (525) limit_clause_opt ::= */
- { 452, -2 }, /* (526) limit_clause_opt ::= LIMIT NK_INTEGER */
- { 452, -4 }, /* (527) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */
- { 452, -4 }, /* (528) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */
- { 429, -3 }, /* (529) subquery ::= NK_LP query_expression NK_RP */
- { 429, -3 }, /* (530) subquery ::= NK_LP subquery NK_RP */
- { 432, -1 }, /* (531) search_condition ::= common_expression */
- { 455, -1 }, /* (532) sort_specification_list ::= sort_specification */
- { 455, -3 }, /* (533) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */
- { 456, -3 }, /* (534) sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */
- { 457, 0 }, /* (535) ordering_specification_opt ::= */
- { 457, -1 }, /* (536) ordering_specification_opt ::= ASC */
- { 457, -1 }, /* (537) ordering_specification_opt ::= DESC */
- { 458, 0 }, /* (538) null_ordering_opt ::= */
- { 458, -2 }, /* (539) null_ordering_opt ::= NULLS FIRST */
- { 458, -2 }, /* (540) null_ordering_opt ::= NULLS LAST */
+ { 324, -6 }, /* (0) cmd ::= CREATE ACCOUNT NK_ID PASS NK_STRING account_options */
+ { 324, -4 }, /* (1) cmd ::= ALTER ACCOUNT NK_ID alter_account_options */
+ { 325, 0 }, /* (2) account_options ::= */
+ { 325, -3 }, /* (3) account_options ::= account_options PPS literal */
+ { 325, -3 }, /* (4) account_options ::= account_options TSERIES literal */
+ { 325, -3 }, /* (5) account_options ::= account_options STORAGE literal */
+ { 325, -3 }, /* (6) account_options ::= account_options STREAMS literal */
+ { 325, -3 }, /* (7) account_options ::= account_options QTIME literal */
+ { 325, -3 }, /* (8) account_options ::= account_options DBS literal */
+ { 325, -3 }, /* (9) account_options ::= account_options USERS literal */
+ { 325, -3 }, /* (10) account_options ::= account_options CONNS literal */
+ { 325, -3 }, /* (11) account_options ::= account_options STATE literal */
+ { 326, -1 }, /* (12) alter_account_options ::= alter_account_option */
+ { 326, -2 }, /* (13) alter_account_options ::= alter_account_options alter_account_option */
+ { 328, -2 }, /* (14) alter_account_option ::= PASS literal */
+ { 328, -2 }, /* (15) alter_account_option ::= PPS literal */
+ { 328, -2 }, /* (16) alter_account_option ::= TSERIES literal */
+ { 328, -2 }, /* (17) alter_account_option ::= STORAGE literal */
+ { 328, -2 }, /* (18) alter_account_option ::= STREAMS literal */
+ { 328, -2 }, /* (19) alter_account_option ::= QTIME literal */
+ { 328, -2 }, /* (20) alter_account_option ::= DBS literal */
+ { 328, -2 }, /* (21) alter_account_option ::= USERS literal */
+ { 328, -2 }, /* (22) alter_account_option ::= CONNS literal */
+ { 328, -2 }, /* (23) alter_account_option ::= STATE literal */
+ { 324, -6 }, /* (24) cmd ::= CREATE USER user_name PASS NK_STRING sysinfo_opt */
+ { 324, -5 }, /* (25) cmd ::= ALTER USER user_name PASS NK_STRING */
+ { 324, -5 }, /* (26) cmd ::= ALTER USER user_name ENABLE NK_INTEGER */
+ { 324, -5 }, /* (27) cmd ::= ALTER USER user_name SYSINFO NK_INTEGER */
+ { 324, -3 }, /* (28) cmd ::= DROP USER user_name */
+ { 330, 0 }, /* (29) sysinfo_opt ::= */
+ { 330, -2 }, /* (30) sysinfo_opt ::= SYSINFO NK_INTEGER */
+ { 324, -6 }, /* (31) cmd ::= GRANT privileges ON priv_level TO user_name */
+ { 324, -6 }, /* (32) cmd ::= REVOKE privileges ON priv_level FROM user_name */
+ { 331, -1 }, /* (33) privileges ::= ALL */
+ { 331, -1 }, /* (34) privileges ::= priv_type_list */
+ { 331, -1 }, /* (35) privileges ::= SUBSCRIBE */
+ { 333, -1 }, /* (36) priv_type_list ::= priv_type */
+ { 333, -3 }, /* (37) priv_type_list ::= priv_type_list NK_COMMA priv_type */
+ { 334, -1 }, /* (38) priv_type ::= READ */
+ { 334, -1 }, /* (39) priv_type ::= WRITE */
+ { 332, -3 }, /* (40) priv_level ::= NK_STAR NK_DOT NK_STAR */
+ { 332, -3 }, /* (41) priv_level ::= db_name NK_DOT NK_STAR */
+ { 332, -1 }, /* (42) priv_level ::= topic_name */
+ { 324, -3 }, /* (43) cmd ::= CREATE DNODE dnode_endpoint */
+ { 324, -5 }, /* (44) cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER */
+ { 324, -4 }, /* (45) cmd ::= DROP DNODE NK_INTEGER force_opt */
+ { 324, -4 }, /* (46) cmd ::= DROP DNODE dnode_endpoint force_opt */
+ { 324, -4 }, /* (47) cmd ::= ALTER DNODE NK_INTEGER NK_STRING */
+ { 324, -5 }, /* (48) cmd ::= ALTER DNODE NK_INTEGER NK_STRING NK_STRING */
+ { 324, -4 }, /* (49) cmd ::= ALTER ALL DNODES NK_STRING */
+ { 324, -5 }, /* (50) cmd ::= ALTER ALL DNODES NK_STRING NK_STRING */
+ { 337, -1 }, /* (51) dnode_endpoint ::= NK_STRING */
+ { 337, -1 }, /* (52) dnode_endpoint ::= NK_ID */
+ { 337, -1 }, /* (53) dnode_endpoint ::= NK_IPTOKEN */
+ { 338, 0 }, /* (54) force_opt ::= */
+ { 338, -1 }, /* (55) force_opt ::= FORCE */
+ { 324, -3 }, /* (56) cmd ::= ALTER LOCAL NK_STRING */
+ { 324, -4 }, /* (57) cmd ::= ALTER LOCAL NK_STRING NK_STRING */
+ { 324, -5 }, /* (58) cmd ::= CREATE QNODE ON DNODE NK_INTEGER */
+ { 324, -5 }, /* (59) cmd ::= DROP QNODE ON DNODE NK_INTEGER */
+ { 324, -5 }, /* (60) cmd ::= CREATE BNODE ON DNODE NK_INTEGER */
+ { 324, -5 }, /* (61) cmd ::= DROP BNODE ON DNODE NK_INTEGER */
+ { 324, -5 }, /* (62) cmd ::= CREATE SNODE ON DNODE NK_INTEGER */
+ { 324, -5 }, /* (63) cmd ::= DROP SNODE ON DNODE NK_INTEGER */
+ { 324, -5 }, /* (64) cmd ::= CREATE MNODE ON DNODE NK_INTEGER */
+ { 324, -5 }, /* (65) cmd ::= DROP MNODE ON DNODE NK_INTEGER */
+ { 324, -5 }, /* (66) cmd ::= CREATE DATABASE not_exists_opt db_name db_options */
+ { 324, -4 }, /* (67) cmd ::= DROP DATABASE exists_opt db_name */
+ { 324, -2 }, /* (68) cmd ::= USE db_name */
+ { 324, -4 }, /* (69) cmd ::= ALTER DATABASE db_name alter_db_options */
+ { 324, -3 }, /* (70) cmd ::= FLUSH DATABASE db_name */
+ { 324, -4 }, /* (71) cmd ::= TRIM DATABASE db_name speed_opt */
+ { 339, -3 }, /* (72) not_exists_opt ::= IF NOT EXISTS */
+ { 339, 0 }, /* (73) not_exists_opt ::= */
+ { 341, -2 }, /* (74) exists_opt ::= IF EXISTS */
+ { 341, 0 }, /* (75) exists_opt ::= */
+ { 340, 0 }, /* (76) db_options ::= */
+ { 340, -3 }, /* (77) db_options ::= db_options BUFFER NK_INTEGER */
+ { 340, -3 }, /* (78) db_options ::= db_options CACHEMODEL NK_STRING */
+ { 340, -3 }, /* (79) db_options ::= db_options CACHESIZE NK_INTEGER */
+ { 340, -3 }, /* (80) db_options ::= db_options COMP NK_INTEGER */
+ { 340, -3 }, /* (81) db_options ::= db_options DURATION NK_INTEGER */
+ { 340, -3 }, /* (82) db_options ::= db_options DURATION NK_VARIABLE */
+ { 340, -3 }, /* (83) db_options ::= db_options MAXROWS NK_INTEGER */
+ { 340, -3 }, /* (84) db_options ::= db_options MINROWS NK_INTEGER */
+ { 340, -3 }, /* (85) db_options ::= db_options KEEP integer_list */
+ { 340, -3 }, /* (86) db_options ::= db_options KEEP variable_list */
+ { 340, -3 }, /* (87) db_options ::= db_options PAGES NK_INTEGER */
+ { 340, -3 }, /* (88) db_options ::= db_options PAGESIZE NK_INTEGER */
+ { 340, -3 }, /* (89) db_options ::= db_options TSDB_PAGESIZE NK_INTEGER */
+ { 340, -3 }, /* (90) db_options ::= db_options PRECISION NK_STRING */
+ { 340, -3 }, /* (91) db_options ::= db_options REPLICA NK_INTEGER */
+ { 340, -3 }, /* (92) db_options ::= db_options VGROUPS NK_INTEGER */
+ { 340, -3 }, /* (93) db_options ::= db_options SINGLE_STABLE NK_INTEGER */
+ { 340, -3 }, /* (94) db_options ::= db_options RETENTIONS retention_list */
+ { 340, -3 }, /* (95) db_options ::= db_options SCHEMALESS NK_INTEGER */
+ { 340, -3 }, /* (96) db_options ::= db_options WAL_LEVEL NK_INTEGER */
+ { 340, -3 }, /* (97) db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER */
+ { 340, -3 }, /* (98) db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER */
+ { 340, -4 }, /* (99) db_options ::= db_options WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */
+ { 340, -3 }, /* (100) db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER */
+ { 340, -4 }, /* (101) db_options ::= db_options WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */
+ { 340, -3 }, /* (102) db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER */
+ { 340, -3 }, /* (103) db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER */
+ { 340, -3 }, /* (104) db_options ::= db_options STT_TRIGGER NK_INTEGER */
+ { 340, -3 }, /* (105) db_options ::= db_options TABLE_PREFIX NK_INTEGER */
+ { 340, -3 }, /* (106) db_options ::= db_options TABLE_SUFFIX NK_INTEGER */
+ { 342, -1 }, /* (107) alter_db_options ::= alter_db_option */
+ { 342, -2 }, /* (108) alter_db_options ::= alter_db_options alter_db_option */
+ { 347, -2 }, /* (109) alter_db_option ::= BUFFER NK_INTEGER */
+ { 347, -2 }, /* (110) alter_db_option ::= CACHEMODEL NK_STRING */
+ { 347, -2 }, /* (111) alter_db_option ::= CACHESIZE NK_INTEGER */
+ { 347, -2 }, /* (112) alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER */
+ { 347, -2 }, /* (113) alter_db_option ::= KEEP integer_list */
+ { 347, -2 }, /* (114) alter_db_option ::= KEEP variable_list */
+ { 347, -2 }, /* (115) alter_db_option ::= PAGES NK_INTEGER */
+ { 347, -2 }, /* (116) alter_db_option ::= REPLICA NK_INTEGER */
+ { 347, -2 }, /* (117) alter_db_option ::= WAL_LEVEL NK_INTEGER */
+ { 347, -2 }, /* (118) alter_db_option ::= STT_TRIGGER NK_INTEGER */
+ { 344, -1 }, /* (119) integer_list ::= NK_INTEGER */
+ { 344, -3 }, /* (120) integer_list ::= integer_list NK_COMMA NK_INTEGER */
+ { 345, -1 }, /* (121) variable_list ::= NK_VARIABLE */
+ { 345, -3 }, /* (122) variable_list ::= variable_list NK_COMMA NK_VARIABLE */
+ { 346, -1 }, /* (123) retention_list ::= retention */
+ { 346, -3 }, /* (124) retention_list ::= retention_list NK_COMMA retention */
+ { 348, -3 }, /* (125) retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */
+ { 343, 0 }, /* (126) speed_opt ::= */
+ { 343, -2 }, /* (127) speed_opt ::= MAX_SPEED NK_INTEGER */
+ { 324, -9 }, /* (128) cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */
+ { 324, -3 }, /* (129) cmd ::= CREATE TABLE multi_create_clause */
+ { 324, -9 }, /* (130) cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */
+ { 324, -3 }, /* (131) cmd ::= DROP TABLE multi_drop_clause */
+ { 324, -4 }, /* (132) cmd ::= DROP STABLE exists_opt full_table_name */
+ { 324, -3 }, /* (133) cmd ::= ALTER TABLE alter_table_clause */
+ { 324, -3 }, /* (134) cmd ::= ALTER STABLE alter_table_clause */
+ { 356, -2 }, /* (135) alter_table_clause ::= full_table_name alter_table_options */
+ { 356, -5 }, /* (136) alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */
+ { 356, -4 }, /* (137) alter_table_clause ::= full_table_name DROP COLUMN column_name */
+ { 356, -5 }, /* (138) alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */
+ { 356, -5 }, /* (139) alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */
+ { 356, -5 }, /* (140) alter_table_clause ::= full_table_name ADD TAG column_name type_name */
+ { 356, -4 }, /* (141) alter_table_clause ::= full_table_name DROP TAG column_name */
+ { 356, -5 }, /* (142) alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */
+ { 356, -5 }, /* (143) alter_table_clause ::= full_table_name RENAME TAG column_name column_name */
+ { 356, -6 }, /* (144) alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */
+ { 353, -1 }, /* (145) multi_create_clause ::= create_subtable_clause */
+ { 353, -2 }, /* (146) multi_create_clause ::= multi_create_clause create_subtable_clause */
+ { 361, -10 }, /* (147) create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP expression_list NK_RP table_options */
+ { 355, -1 }, /* (148) multi_drop_clause ::= drop_table_clause */
+ { 355, -2 }, /* (149) multi_drop_clause ::= multi_drop_clause drop_table_clause */
+ { 364, -2 }, /* (150) drop_table_clause ::= exists_opt full_table_name */
+ { 362, 0 }, /* (151) specific_cols_opt ::= */
+ { 362, -3 }, /* (152) specific_cols_opt ::= NK_LP col_name_list NK_RP */
+ { 349, -1 }, /* (153) full_table_name ::= table_name */
+ { 349, -3 }, /* (154) full_table_name ::= db_name NK_DOT table_name */
+ { 350, -1 }, /* (155) column_def_list ::= column_def */
+ { 350, -3 }, /* (156) column_def_list ::= column_def_list NK_COMMA column_def */
+ { 367, -2 }, /* (157) column_def ::= column_name type_name */
+ { 367, -4 }, /* (158) column_def ::= column_name type_name COMMENT NK_STRING */
+ { 359, -1 }, /* (159) type_name ::= BOOL */
+ { 359, -1 }, /* (160) type_name ::= TINYINT */
+ { 359, -1 }, /* (161) type_name ::= SMALLINT */
+ { 359, -1 }, /* (162) type_name ::= INT */
+ { 359, -1 }, /* (163) type_name ::= INTEGER */
+ { 359, -1 }, /* (164) type_name ::= BIGINT */
+ { 359, -1 }, /* (165) type_name ::= FLOAT */
+ { 359, -1 }, /* (166) type_name ::= DOUBLE */
+ { 359, -4 }, /* (167) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */
+ { 359, -1 }, /* (168) type_name ::= TIMESTAMP */
+ { 359, -4 }, /* (169) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */
+ { 359, -2 }, /* (170) type_name ::= TINYINT UNSIGNED */
+ { 359, -2 }, /* (171) type_name ::= SMALLINT UNSIGNED */
+ { 359, -2 }, /* (172) type_name ::= INT UNSIGNED */
+ { 359, -2 }, /* (173) type_name ::= BIGINT UNSIGNED */
+ { 359, -1 }, /* (174) type_name ::= JSON */
+ { 359, -4 }, /* (175) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */
+ { 359, -1 }, /* (176) type_name ::= MEDIUMBLOB */
+ { 359, -1 }, /* (177) type_name ::= BLOB */
+ { 359, -4 }, /* (178) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */
+ { 359, -1 }, /* (179) type_name ::= DECIMAL */
+ { 359, -4 }, /* (180) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */
+ { 359, -6 }, /* (181) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */
+ { 351, 0 }, /* (182) tags_def_opt ::= */
+ { 351, -1 }, /* (183) tags_def_opt ::= tags_def */
+ { 354, -4 }, /* (184) tags_def ::= TAGS NK_LP column_def_list NK_RP */
+ { 352, 0 }, /* (185) table_options ::= */
+ { 352, -3 }, /* (186) table_options ::= table_options COMMENT NK_STRING */
+ { 352, -3 }, /* (187) table_options ::= table_options MAX_DELAY duration_list */
+ { 352, -3 }, /* (188) table_options ::= table_options WATERMARK duration_list */
+ { 352, -5 }, /* (189) table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */
+ { 352, -3 }, /* (190) table_options ::= table_options TTL NK_INTEGER */
+ { 352, -5 }, /* (191) table_options ::= table_options SMA NK_LP col_name_list NK_RP */
+ { 352, -3 }, /* (192) table_options ::= table_options DELETE_MARK duration_list */
+ { 357, -1 }, /* (193) alter_table_options ::= alter_table_option */
+ { 357, -2 }, /* (194) alter_table_options ::= alter_table_options alter_table_option */
+ { 370, -2 }, /* (195) alter_table_option ::= COMMENT NK_STRING */
+ { 370, -2 }, /* (196) alter_table_option ::= TTL NK_INTEGER */
+ { 368, -1 }, /* (197) duration_list ::= duration_literal */
+ { 368, -3 }, /* (198) duration_list ::= duration_list NK_COMMA duration_literal */
+ { 369, -1 }, /* (199) rollup_func_list ::= rollup_func_name */
+ { 369, -3 }, /* (200) rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */
+ { 372, -1 }, /* (201) rollup_func_name ::= function_name */
+ { 372, -1 }, /* (202) rollup_func_name ::= FIRST */
+ { 372, -1 }, /* (203) rollup_func_name ::= LAST */
+ { 365, -1 }, /* (204) col_name_list ::= col_name */
+ { 365, -3 }, /* (205) col_name_list ::= col_name_list NK_COMMA col_name */
+ { 374, -1 }, /* (206) col_name ::= column_name */
+ { 324, -2 }, /* (207) cmd ::= SHOW DNODES */
+ { 324, -2 }, /* (208) cmd ::= SHOW USERS */
+ { 324, -3 }, /* (209) cmd ::= SHOW USER PRIVILEGES */
+ { 324, -2 }, /* (210) cmd ::= SHOW DATABASES */
+ { 324, -4 }, /* (211) cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */
+ { 324, -4 }, /* (212) cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */
+ { 324, -3 }, /* (213) cmd ::= SHOW db_name_cond_opt VGROUPS */
+ { 324, -2 }, /* (214) cmd ::= SHOW MNODES */
+ { 324, -2 }, /* (215) cmd ::= SHOW QNODES */
+ { 324, -2 }, /* (216) cmd ::= SHOW FUNCTIONS */
+ { 324, -5 }, /* (217) cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */
+ { 324, -2 }, /* (218) cmd ::= SHOW STREAMS */
+ { 324, -2 }, /* (219) cmd ::= SHOW ACCOUNTS */
+ { 324, -2 }, /* (220) cmd ::= SHOW APPS */
+ { 324, -2 }, /* (221) cmd ::= SHOW CONNECTIONS */
+ { 324, -2 }, /* (222) cmd ::= SHOW LICENCES */
+ { 324, -2 }, /* (223) cmd ::= SHOW GRANTS */
+ { 324, -4 }, /* (224) cmd ::= SHOW CREATE DATABASE db_name */
+ { 324, -4 }, /* (225) cmd ::= SHOW CREATE TABLE full_table_name */
+ { 324, -4 }, /* (226) cmd ::= SHOW CREATE STABLE full_table_name */
+ { 324, -2 }, /* (227) cmd ::= SHOW QUERIES */
+ { 324, -2 }, /* (228) cmd ::= SHOW SCORES */
+ { 324, -2 }, /* (229) cmd ::= SHOW TOPICS */
+ { 324, -2 }, /* (230) cmd ::= SHOW VARIABLES */
+ { 324, -3 }, /* (231) cmd ::= SHOW CLUSTER VARIABLES */
+ { 324, -3 }, /* (232) cmd ::= SHOW LOCAL VARIABLES */
+ { 324, -5 }, /* (233) cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt */
+ { 324, -2 }, /* (234) cmd ::= SHOW BNODES */
+ { 324, -2 }, /* (235) cmd ::= SHOW SNODES */
+ { 324, -2 }, /* (236) cmd ::= SHOW CLUSTER */
+ { 324, -2 }, /* (237) cmd ::= SHOW TRANSACTIONS */
+ { 324, -4 }, /* (238) cmd ::= SHOW TABLE DISTRIBUTED full_table_name */
+ { 324, -2 }, /* (239) cmd ::= SHOW CONSUMERS */
+ { 324, -2 }, /* (240) cmd ::= SHOW SUBSCRIPTIONS */
+ { 324, -5 }, /* (241) cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */
+ { 324, -7 }, /* (242) cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */
+ { 324, -3 }, /* (243) cmd ::= SHOW VNODES NK_INTEGER */
+ { 324, -3 }, /* (244) cmd ::= SHOW VNODES NK_STRING */
+ { 375, 0 }, /* (245) db_name_cond_opt ::= */
+ { 375, -2 }, /* (246) db_name_cond_opt ::= db_name NK_DOT */
+ { 376, 0 }, /* (247) like_pattern_opt ::= */
+ { 376, -2 }, /* (248) like_pattern_opt ::= LIKE NK_STRING */
+ { 377, -1 }, /* (249) table_name_cond ::= table_name */
+ { 378, 0 }, /* (250) from_db_opt ::= */
+ { 378, -2 }, /* (251) from_db_opt ::= FROM db_name */
+ { 379, 0 }, /* (252) tag_list_opt ::= */
+ { 379, -1 }, /* (253) tag_list_opt ::= tag_item */
+ { 379, -3 }, /* (254) tag_list_opt ::= tag_list_opt NK_COMMA tag_item */
+ { 380, -1 }, /* (255) tag_item ::= TBNAME */
+ { 380, -1 }, /* (256) tag_item ::= QTAGS */
+ { 380, -1 }, /* (257) tag_item ::= column_name */
+ { 380, -2 }, /* (258) tag_item ::= column_name column_alias */
+ { 380, -3 }, /* (259) tag_item ::= column_name AS column_alias */
+ { 324, -8 }, /* (260) cmd ::= CREATE SMA INDEX not_exists_opt full_index_name ON full_table_name index_options */
+ { 324, -4 }, /* (261) cmd ::= DROP INDEX exists_opt full_index_name */
+ { 382, -1 }, /* (262) full_index_name ::= index_name */
+ { 382, -3 }, /* (263) full_index_name ::= db_name NK_DOT index_name */
+ { 383, -10 }, /* (264) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */
+ { 383, -12 }, /* (265) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt sma_stream_opt */
+ { 385, -1 }, /* (266) func_list ::= func */
+ { 385, -3 }, /* (267) func_list ::= func_list NK_COMMA func */
+ { 388, -4 }, /* (268) func ::= function_name NK_LP expression_list NK_RP */
+ { 387, 0 }, /* (269) sma_stream_opt ::= */
+ { 387, -3 }, /* (270) sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */
+ { 387, -3 }, /* (271) sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */
+ { 387, -3 }, /* (272) sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */
+ { 324, -6 }, /* (273) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */
+ { 324, -7 }, /* (274) cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name */
+ { 324, -9 }, /* (275) cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name */
+ { 324, -7 }, /* (276) cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name */
+ { 324, -9 }, /* (277) cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name */
+ { 324, -4 }, /* (278) cmd ::= DROP TOPIC exists_opt topic_name */
+ { 324, -7 }, /* (279) cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */
+ { 324, -2 }, /* (280) cmd ::= DESC full_table_name */
+ { 324, -2 }, /* (281) cmd ::= DESCRIBE full_table_name */
+ { 324, -3 }, /* (282) cmd ::= RESET QUERY CACHE */
+ { 324, -4 }, /* (283) cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */
+ { 391, 0 }, /* (284) analyze_opt ::= */
+ { 391, -1 }, /* (285) analyze_opt ::= ANALYZE */
+ { 392, 0 }, /* (286) explain_options ::= */
+ { 392, -3 }, /* (287) explain_options ::= explain_options VERBOSE NK_BOOL */
+ { 392, -3 }, /* (288) explain_options ::= explain_options RATIO NK_FLOAT */
+ { 324, -10 }, /* (289) cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt */
+ { 324, -4 }, /* (290) cmd ::= DROP FUNCTION exists_opt function_name */
+ { 393, 0 }, /* (291) agg_func_opt ::= */
+ { 393, -1 }, /* (292) agg_func_opt ::= AGGREGATE */
+ { 394, 0 }, /* (293) bufsize_opt ::= */
+ { 394, -2 }, /* (294) bufsize_opt ::= BUFSIZE NK_INTEGER */
+ { 324, -11 }, /* (295) cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name tags_def_opt subtable_opt AS query_or_subquery */
+ { 324, -4 }, /* (296) cmd ::= DROP STREAM exists_opt stream_name */
+ { 396, 0 }, /* (297) stream_options ::= */
+ { 396, -3 }, /* (298) stream_options ::= stream_options TRIGGER AT_ONCE */
+ { 396, -3 }, /* (299) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */
+ { 396, -4 }, /* (300) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */
+ { 396, -3 }, /* (301) stream_options ::= stream_options WATERMARK duration_literal */
+ { 396, -4 }, /* (302) stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */
+ { 396, -3 }, /* (303) stream_options ::= stream_options FILL_HISTORY NK_INTEGER */
+ { 396, -3 }, /* (304) stream_options ::= stream_options DELETE_MARK duration_literal */
+ { 396, -4 }, /* (305) stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */
+ { 397, 0 }, /* (306) subtable_opt ::= */
+ { 397, -4 }, /* (307) subtable_opt ::= SUBTABLE NK_LP expression NK_RP */
+ { 324, -3 }, /* (308) cmd ::= KILL CONNECTION NK_INTEGER */
+ { 324, -3 }, /* (309) cmd ::= KILL QUERY NK_STRING */
+ { 324, -3 }, /* (310) cmd ::= KILL TRANSACTION NK_INTEGER */
+ { 324, -2 }, /* (311) cmd ::= BALANCE VGROUP */
+ { 324, -4 }, /* (312) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */
+ { 324, -4 }, /* (313) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */
+ { 324, -3 }, /* (314) cmd ::= SPLIT VGROUP NK_INTEGER */
+ { 399, -2 }, /* (315) dnode_list ::= DNODE NK_INTEGER */
+ { 399, -3 }, /* (316) dnode_list ::= dnode_list DNODE NK_INTEGER */
+ { 324, -4 }, /* (317) cmd ::= DELETE FROM full_table_name where_clause_opt */
+ { 324, -1 }, /* (318) cmd ::= query_or_subquery */
+ { 324, -7 }, /* (319) cmd ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */
+ { 324, -4 }, /* (320) cmd ::= INSERT INTO full_table_name query_or_subquery */
+ { 327, -1 }, /* (321) literal ::= NK_INTEGER */
+ { 327, -1 }, /* (322) literal ::= NK_FLOAT */
+ { 327, -1 }, /* (323) literal ::= NK_STRING */
+ { 327, -1 }, /* (324) literal ::= NK_BOOL */
+ { 327, -2 }, /* (325) literal ::= TIMESTAMP NK_STRING */
+ { 327, -1 }, /* (326) literal ::= duration_literal */
+ { 327, -1 }, /* (327) literal ::= NULL */
+ { 327, -1 }, /* (328) literal ::= NK_QUESTION */
+ { 371, -1 }, /* (329) duration_literal ::= NK_VARIABLE */
+ { 401, -1 }, /* (330) signed ::= NK_INTEGER */
+ { 401, -2 }, /* (331) signed ::= NK_PLUS NK_INTEGER */
+ { 401, -2 }, /* (332) signed ::= NK_MINUS NK_INTEGER */
+ { 401, -1 }, /* (333) signed ::= NK_FLOAT */
+ { 401, -2 }, /* (334) signed ::= NK_PLUS NK_FLOAT */
+ { 401, -2 }, /* (335) signed ::= NK_MINUS NK_FLOAT */
+ { 360, -1 }, /* (336) signed_literal ::= signed */
+ { 360, -1 }, /* (337) signed_literal ::= NK_STRING */
+ { 360, -1 }, /* (338) signed_literal ::= NK_BOOL */
+ { 360, -2 }, /* (339) signed_literal ::= TIMESTAMP NK_STRING */
+ { 360, -1 }, /* (340) signed_literal ::= duration_literal */
+ { 360, -1 }, /* (341) signed_literal ::= NULL */
+ { 360, -1 }, /* (342) signed_literal ::= literal_func */
+ { 360, -1 }, /* (343) signed_literal ::= NK_QUESTION */
+ { 403, -1 }, /* (344) literal_list ::= signed_literal */
+ { 403, -3 }, /* (345) literal_list ::= literal_list NK_COMMA signed_literal */
+ { 335, -1 }, /* (346) db_name ::= NK_ID */
+ { 366, -1 }, /* (347) table_name ::= NK_ID */
+ { 358, -1 }, /* (348) column_name ::= NK_ID */
+ { 373, -1 }, /* (349) function_name ::= NK_ID */
+ { 404, -1 }, /* (350) table_alias ::= NK_ID */
+ { 381, -1 }, /* (351) column_alias ::= NK_ID */
+ { 329, -1 }, /* (352) user_name ::= NK_ID */
+ { 336, -1 }, /* (353) topic_name ::= NK_ID */
+ { 395, -1 }, /* (354) stream_name ::= NK_ID */
+ { 390, -1 }, /* (355) cgroup_name ::= NK_ID */
+ { 384, -1 }, /* (356) index_name ::= NK_ID */
+ { 405, -1 }, /* (357) expr_or_subquery ::= expression */
+ { 398, -1 }, /* (358) expression ::= literal */
+ { 398, -1 }, /* (359) expression ::= pseudo_column */
+ { 398, -1 }, /* (360) expression ::= column_reference */
+ { 398, -1 }, /* (361) expression ::= function_expression */
+ { 398, -1 }, /* (362) expression ::= case_when_expression */
+ { 398, -3 }, /* (363) expression ::= NK_LP expression NK_RP */
+ { 398, -2 }, /* (364) expression ::= NK_PLUS expr_or_subquery */
+ { 398, -2 }, /* (365) expression ::= NK_MINUS expr_or_subquery */
+ { 398, -3 }, /* (366) expression ::= expr_or_subquery NK_PLUS expr_or_subquery */
+ { 398, -3 }, /* (367) expression ::= expr_or_subquery NK_MINUS expr_or_subquery */
+ { 398, -3 }, /* (368) expression ::= expr_or_subquery NK_STAR expr_or_subquery */
+ { 398, -3 }, /* (369) expression ::= expr_or_subquery NK_SLASH expr_or_subquery */
+ { 398, -3 }, /* (370) expression ::= expr_or_subquery NK_REM expr_or_subquery */
+ { 398, -3 }, /* (371) expression ::= column_reference NK_ARROW NK_STRING */
+ { 398, -3 }, /* (372) expression ::= expr_or_subquery NK_BITAND expr_or_subquery */
+ { 398, -3 }, /* (373) expression ::= expr_or_subquery NK_BITOR expr_or_subquery */
+ { 363, -1 }, /* (374) expression_list ::= expr_or_subquery */
+ { 363, -3 }, /* (375) expression_list ::= expression_list NK_COMMA expr_or_subquery */
+ { 407, -1 }, /* (376) column_reference ::= column_name */
+ { 407, -3 }, /* (377) column_reference ::= table_name NK_DOT column_name */
+ { 406, -1 }, /* (378) pseudo_column ::= ROWTS */
+ { 406, -1 }, /* (379) pseudo_column ::= TBNAME */
+ { 406, -3 }, /* (380) pseudo_column ::= table_name NK_DOT TBNAME */
+ { 406, -1 }, /* (381) pseudo_column ::= QSTART */
+ { 406, -1 }, /* (382) pseudo_column ::= QEND */
+ { 406, -1 }, /* (383) pseudo_column ::= QDURATION */
+ { 406, -1 }, /* (384) pseudo_column ::= WSTART */
+ { 406, -1 }, /* (385) pseudo_column ::= WEND */
+ { 406, -1 }, /* (386) pseudo_column ::= WDURATION */
+ { 406, -1 }, /* (387) pseudo_column ::= IROWTS */
+ { 406, -1 }, /* (388) pseudo_column ::= QTAGS */
+ { 408, -4 }, /* (389) function_expression ::= function_name NK_LP expression_list NK_RP */
+ { 408, -4 }, /* (390) function_expression ::= star_func NK_LP star_func_para_list NK_RP */
+ { 408, -6 }, /* (391) function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */
+ { 408, -1 }, /* (392) function_expression ::= literal_func */
+ { 402, -3 }, /* (393) literal_func ::= noarg_func NK_LP NK_RP */
+ { 402, -1 }, /* (394) literal_func ::= NOW */
+ { 412, -1 }, /* (395) noarg_func ::= NOW */
+ { 412, -1 }, /* (396) noarg_func ::= TODAY */
+ { 412, -1 }, /* (397) noarg_func ::= TIMEZONE */
+ { 412, -1 }, /* (398) noarg_func ::= DATABASE */
+ { 412, -1 }, /* (399) noarg_func ::= CLIENT_VERSION */
+ { 412, -1 }, /* (400) noarg_func ::= SERVER_VERSION */
+ { 412, -1 }, /* (401) noarg_func ::= SERVER_STATUS */
+ { 412, -1 }, /* (402) noarg_func ::= CURRENT_USER */
+ { 412, -1 }, /* (403) noarg_func ::= USER */
+ { 410, -1 }, /* (404) star_func ::= COUNT */
+ { 410, -1 }, /* (405) star_func ::= FIRST */
+ { 410, -1 }, /* (406) star_func ::= LAST */
+ { 410, -1 }, /* (407) star_func ::= LAST_ROW */
+ { 411, -1 }, /* (408) star_func_para_list ::= NK_STAR */
+ { 411, -1 }, /* (409) star_func_para_list ::= other_para_list */
+ { 413, -1 }, /* (410) other_para_list ::= star_func_para */
+ { 413, -3 }, /* (411) other_para_list ::= other_para_list NK_COMMA star_func_para */
+ { 414, -1 }, /* (412) star_func_para ::= expr_or_subquery */
+ { 414, -3 }, /* (413) star_func_para ::= table_name NK_DOT NK_STAR */
+ { 409, -4 }, /* (414) case_when_expression ::= CASE when_then_list case_when_else_opt END */
+ { 409, -5 }, /* (415) case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */
+ { 415, -1 }, /* (416) when_then_list ::= when_then_expr */
+ { 415, -2 }, /* (417) when_then_list ::= when_then_list when_then_expr */
+ { 418, -4 }, /* (418) when_then_expr ::= WHEN common_expression THEN common_expression */
+ { 416, 0 }, /* (419) case_when_else_opt ::= */
+ { 416, -2 }, /* (420) case_when_else_opt ::= ELSE common_expression */
+ { 419, -3 }, /* (421) predicate ::= expr_or_subquery compare_op expr_or_subquery */
+ { 419, -5 }, /* (422) predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */
+ { 419, -6 }, /* (423) predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */
+ { 419, -3 }, /* (424) predicate ::= expr_or_subquery IS NULL */
+ { 419, -4 }, /* (425) predicate ::= expr_or_subquery IS NOT NULL */
+ { 419, -3 }, /* (426) predicate ::= expr_or_subquery in_op in_predicate_value */
+ { 420, -1 }, /* (427) compare_op ::= NK_LT */
+ { 420, -1 }, /* (428) compare_op ::= NK_GT */
+ { 420, -1 }, /* (429) compare_op ::= NK_LE */
+ { 420, -1 }, /* (430) compare_op ::= NK_GE */
+ { 420, -1 }, /* (431) compare_op ::= NK_NE */
+ { 420, -1 }, /* (432) compare_op ::= NK_EQ */
+ { 420, -1 }, /* (433) compare_op ::= LIKE */
+ { 420, -2 }, /* (434) compare_op ::= NOT LIKE */
+ { 420, -1 }, /* (435) compare_op ::= MATCH */
+ { 420, -1 }, /* (436) compare_op ::= NMATCH */
+ { 420, -1 }, /* (437) compare_op ::= CONTAINS */
+ { 421, -1 }, /* (438) in_op ::= IN */
+ { 421, -2 }, /* (439) in_op ::= NOT IN */
+ { 422, -3 }, /* (440) in_predicate_value ::= NK_LP literal_list NK_RP */
+ { 423, -1 }, /* (441) boolean_value_expression ::= boolean_primary */
+ { 423, -2 }, /* (442) boolean_value_expression ::= NOT boolean_primary */
+ { 423, -3 }, /* (443) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */
+ { 423, -3 }, /* (444) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */
+ { 424, -1 }, /* (445) boolean_primary ::= predicate */
+ { 424, -3 }, /* (446) boolean_primary ::= NK_LP boolean_value_expression NK_RP */
+ { 417, -1 }, /* (447) common_expression ::= expr_or_subquery */
+ { 417, -1 }, /* (448) common_expression ::= boolean_value_expression */
+ { 425, 0 }, /* (449) from_clause_opt ::= */
+ { 425, -2 }, /* (450) from_clause_opt ::= FROM table_reference_list */
+ { 426, -1 }, /* (451) table_reference_list ::= table_reference */
+ { 426, -3 }, /* (452) table_reference_list ::= table_reference_list NK_COMMA table_reference */
+ { 427, -1 }, /* (453) table_reference ::= table_primary */
+ { 427, -1 }, /* (454) table_reference ::= joined_table */
+ { 428, -2 }, /* (455) table_primary ::= table_name alias_opt */
+ { 428, -4 }, /* (456) table_primary ::= db_name NK_DOT table_name alias_opt */
+ { 428, -2 }, /* (457) table_primary ::= subquery alias_opt */
+ { 428, -1 }, /* (458) table_primary ::= parenthesized_joined_table */
+ { 430, 0 }, /* (459) alias_opt ::= */
+ { 430, -1 }, /* (460) alias_opt ::= table_alias */
+ { 430, -2 }, /* (461) alias_opt ::= AS table_alias */
+ { 432, -3 }, /* (462) parenthesized_joined_table ::= NK_LP joined_table NK_RP */
+ { 432, -3 }, /* (463) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */
+ { 429, -6 }, /* (464) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */
+ { 433, 0 }, /* (465) join_type ::= */
+ { 433, -1 }, /* (466) join_type ::= INNER */
+ { 435, -12 }, /* (467) query_specification ::= SELECT set_quantifier_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt */
+ { 436, 0 }, /* (468) set_quantifier_opt ::= */
+ { 436, -1 }, /* (469) set_quantifier_opt ::= DISTINCT */
+ { 436, -1 }, /* (470) set_quantifier_opt ::= ALL */
+ { 437, -1 }, /* (471) select_list ::= select_item */
+ { 437, -3 }, /* (472) select_list ::= select_list NK_COMMA select_item */
+ { 445, -1 }, /* (473) select_item ::= NK_STAR */
+ { 445, -1 }, /* (474) select_item ::= common_expression */
+ { 445, -2 }, /* (475) select_item ::= common_expression column_alias */
+ { 445, -3 }, /* (476) select_item ::= common_expression AS column_alias */
+ { 445, -3 }, /* (477) select_item ::= table_name NK_DOT NK_STAR */
+ { 400, 0 }, /* (478) where_clause_opt ::= */
+ { 400, -2 }, /* (479) where_clause_opt ::= WHERE search_condition */
+ { 438, 0 }, /* (480) partition_by_clause_opt ::= */
+ { 438, -3 }, /* (481) partition_by_clause_opt ::= PARTITION BY partition_list */
+ { 446, -1 }, /* (482) partition_list ::= partition_item */
+ { 446, -3 }, /* (483) partition_list ::= partition_list NK_COMMA partition_item */
+ { 447, -1 }, /* (484) partition_item ::= expr_or_subquery */
+ { 447, -2 }, /* (485) partition_item ::= expr_or_subquery column_alias */
+ { 447, -3 }, /* (486) partition_item ::= expr_or_subquery AS column_alias */
+ { 442, 0 }, /* (487) twindow_clause_opt ::= */
+ { 442, -6 }, /* (488) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */
+ { 442, -4 }, /* (489) twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */
+ { 442, -6 }, /* (490) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */
+ { 442, -8 }, /* (491) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */
+ { 386, 0 }, /* (492) sliding_opt ::= */
+ { 386, -4 }, /* (493) sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */
+ { 441, 0 }, /* (494) fill_opt ::= */
+ { 441, -4 }, /* (495) fill_opt ::= FILL NK_LP fill_mode NK_RP */
+ { 441, -6 }, /* (496) fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */
+ { 441, -6 }, /* (497) fill_opt ::= FILL NK_LP VALUE_F NK_COMMA literal_list NK_RP */
+ { 448, -1 }, /* (498) fill_mode ::= NONE */
+ { 448, -1 }, /* (499) fill_mode ::= PREV */
+ { 448, -1 }, /* (500) fill_mode ::= NULL */
+ { 448, -1 }, /* (501) fill_mode ::= NULL_F */
+ { 448, -1 }, /* (502) fill_mode ::= LINEAR */
+ { 448, -1 }, /* (503) fill_mode ::= NEXT */
+ { 443, 0 }, /* (504) group_by_clause_opt ::= */
+ { 443, -3 }, /* (505) group_by_clause_opt ::= GROUP BY group_by_list */
+ { 449, -1 }, /* (506) group_by_list ::= expr_or_subquery */
+ { 449, -3 }, /* (507) group_by_list ::= group_by_list NK_COMMA expr_or_subquery */
+ { 444, 0 }, /* (508) having_clause_opt ::= */
+ { 444, -2 }, /* (509) having_clause_opt ::= HAVING search_condition */
+ { 439, 0 }, /* (510) range_opt ::= */
+ { 439, -6 }, /* (511) range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */
+ { 440, 0 }, /* (512) every_opt ::= */
+ { 440, -4 }, /* (513) every_opt ::= EVERY NK_LP duration_literal NK_RP */
+ { 450, -4 }, /* (514) query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */
+ { 451, -1 }, /* (515) query_simple ::= query_specification */
+ { 451, -1 }, /* (516) query_simple ::= union_query_expression */
+ { 455, -4 }, /* (517) union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */
+ { 455, -3 }, /* (518) union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */
+ { 456, -1 }, /* (519) query_simple_or_subquery ::= query_simple */
+ { 456, -1 }, /* (520) query_simple_or_subquery ::= subquery */
+ { 389, -1 }, /* (521) query_or_subquery ::= query_expression */
+ { 389, -1 }, /* (522) query_or_subquery ::= subquery */
+ { 452, 0 }, /* (523) order_by_clause_opt ::= */
+ { 452, -3 }, /* (524) order_by_clause_opt ::= ORDER BY sort_specification_list */
+ { 453, 0 }, /* (525) slimit_clause_opt ::= */
+ { 453, -2 }, /* (526) slimit_clause_opt ::= SLIMIT NK_INTEGER */
+ { 453, -4 }, /* (527) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */
+ { 453, -4 }, /* (528) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */
+ { 454, 0 }, /* (529) limit_clause_opt ::= */
+ { 454, -2 }, /* (530) limit_clause_opt ::= LIMIT NK_INTEGER */
+ { 454, -4 }, /* (531) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */
+ { 454, -4 }, /* (532) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */
+ { 431, -3 }, /* (533) subquery ::= NK_LP query_expression NK_RP */
+ { 431, -3 }, /* (534) subquery ::= NK_LP subquery NK_RP */
+ { 434, -1 }, /* (535) search_condition ::= common_expression */
+ { 457, -1 }, /* (536) sort_specification_list ::= sort_specification */
+ { 457, -3 }, /* (537) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */
+ { 458, -3 }, /* (538) sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */
+ { 459, 0 }, /* (539) ordering_specification_opt ::= */
+ { 459, -1 }, /* (540) ordering_specification_opt ::= ASC */
+ { 459, -1 }, /* (541) ordering_specification_opt ::= DESC */
+ { 460, 0 }, /* (542) null_ordering_opt ::= */
+ { 460, -2 }, /* (543) null_ordering_opt ::= NULLS FIRST */
+ { 460, -2 }, /* (544) null_ordering_opt ::= NULLS LAST */
};
static void yy_accept(yyParser*); /* Forward Declaration */
@@ -3629,11 +3643,11 @@ static YYACTIONTYPE yy_reduce(
YYMINORTYPE yylhsminor;
case 0: /* cmd ::= CREATE ACCOUNT NK_ID PASS NK_STRING account_options */
{ pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); }
- yy_destructor(yypParser,323,&yymsp[0].minor);
+ yy_destructor(yypParser,325,&yymsp[0].minor);
break;
case 1: /* cmd ::= ALTER ACCOUNT NK_ID alter_account_options */
{ pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); }
- yy_destructor(yypParser,324,&yymsp[0].minor);
+ yy_destructor(yypParser,326,&yymsp[0].minor);
break;
case 2: /* account_options ::= */
{ }
@@ -3647,20 +3661,20 @@ static YYACTIONTYPE yy_reduce(
case 9: /* account_options ::= account_options USERS literal */ yytestcase(yyruleno==9);
case 10: /* account_options ::= account_options CONNS literal */ yytestcase(yyruleno==10);
case 11: /* account_options ::= account_options STATE literal */ yytestcase(yyruleno==11);
-{ yy_destructor(yypParser,323,&yymsp[-2].minor);
+{ yy_destructor(yypParser,325,&yymsp[-2].minor);
{ }
- yy_destructor(yypParser,325,&yymsp[0].minor);
+ yy_destructor(yypParser,327,&yymsp[0].minor);
}
break;
case 12: /* alter_account_options ::= alter_account_option */
-{ yy_destructor(yypParser,326,&yymsp[0].minor);
+{ yy_destructor(yypParser,328,&yymsp[0].minor);
{ }
}
break;
case 13: /* alter_account_options ::= alter_account_options alter_account_option */
-{ yy_destructor(yypParser,324,&yymsp[-1].minor);
+{ yy_destructor(yypParser,326,&yymsp[-1].minor);
{ }
- yy_destructor(yypParser,326,&yymsp[0].minor);
+ yy_destructor(yypParser,328,&yymsp[0].minor);
}
break;
case 14: /* alter_account_option ::= PASS literal */
@@ -3674,80 +3688,80 @@ static YYACTIONTYPE yy_reduce(
case 22: /* alter_account_option ::= CONNS literal */ yytestcase(yyruleno==22);
case 23: /* alter_account_option ::= STATE literal */ yytestcase(yyruleno==23);
{ }
- yy_destructor(yypParser,325,&yymsp[0].minor);
+ yy_destructor(yypParser,327,&yymsp[0].minor);
break;
case 24: /* cmd ::= CREATE USER user_name PASS NK_STRING sysinfo_opt */
-{ pCxt->pRootNode = createCreateUserStmt(pCxt, &yymsp[-3].minor.yy317, &yymsp[-1].minor.yy0, yymsp[0].minor.yy449); }
+{ pCxt->pRootNode = createCreateUserStmt(pCxt, &yymsp[-3].minor.yy77, &yymsp[-1].minor.yy0, yymsp[0].minor.yy287); }
break;
case 25: /* cmd ::= ALTER USER user_name PASS NK_STRING */
-{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy317, TSDB_ALTER_USER_PASSWD, &yymsp[0].minor.yy0); }
+{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy77, TSDB_ALTER_USER_PASSWD, &yymsp[0].minor.yy0); }
break;
case 26: /* cmd ::= ALTER USER user_name ENABLE NK_INTEGER */
-{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy317, TSDB_ALTER_USER_ENABLE, &yymsp[0].minor.yy0); }
+{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy77, TSDB_ALTER_USER_ENABLE, &yymsp[0].minor.yy0); }
break;
case 27: /* cmd ::= ALTER USER user_name SYSINFO NK_INTEGER */
-{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy317, TSDB_ALTER_USER_SYSINFO, &yymsp[0].minor.yy0); }
+{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy77, TSDB_ALTER_USER_SYSINFO, &yymsp[0].minor.yy0); }
break;
case 28: /* cmd ::= DROP USER user_name */
-{ pCxt->pRootNode = createDropUserStmt(pCxt, &yymsp[0].minor.yy317); }
+{ pCxt->pRootNode = createDropUserStmt(pCxt, &yymsp[0].minor.yy77); }
break;
case 29: /* sysinfo_opt ::= */
-{ yymsp[1].minor.yy449 = 1; }
+{ yymsp[1].minor.yy287 = 1; }
break;
case 30: /* sysinfo_opt ::= SYSINFO NK_INTEGER */
-{ yymsp[-1].minor.yy449 = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); }
+{ yymsp[-1].minor.yy287 = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); }
break;
case 31: /* cmd ::= GRANT privileges ON priv_level TO user_name */
-{ pCxt->pRootNode = createGrantStmt(pCxt, yymsp[-4].minor.yy531, &yymsp[-2].minor.yy317, &yymsp[0].minor.yy317); }
+{ pCxt->pRootNode = createGrantStmt(pCxt, yymsp[-4].minor.yy717, &yymsp[-2].minor.yy77, &yymsp[0].minor.yy77); }
break;
case 32: /* cmd ::= REVOKE privileges ON priv_level FROM user_name */
-{ pCxt->pRootNode = createRevokeStmt(pCxt, yymsp[-4].minor.yy531, &yymsp[-2].minor.yy317, &yymsp[0].minor.yy317); }
+{ pCxt->pRootNode = createRevokeStmt(pCxt, yymsp[-4].minor.yy717, &yymsp[-2].minor.yy77, &yymsp[0].minor.yy77); }
break;
case 33: /* privileges ::= ALL */
-{ yymsp[0].minor.yy531 = PRIVILEGE_TYPE_ALL; }
+{ yymsp[0].minor.yy717 = PRIVILEGE_TYPE_ALL; }
break;
case 34: /* privileges ::= priv_type_list */
case 36: /* priv_type_list ::= priv_type */ yytestcase(yyruleno==36);
-{ yylhsminor.yy531 = yymsp[0].minor.yy531; }
- yymsp[0].minor.yy531 = yylhsminor.yy531;
+{ yylhsminor.yy717 = yymsp[0].minor.yy717; }
+ yymsp[0].minor.yy717 = yylhsminor.yy717;
break;
case 35: /* privileges ::= SUBSCRIBE */
-{ yymsp[0].minor.yy531 = PRIVILEGE_TYPE_SUBSCRIBE; }
+{ yymsp[0].minor.yy717 = PRIVILEGE_TYPE_SUBSCRIBE; }
break;
case 37: /* priv_type_list ::= priv_type_list NK_COMMA priv_type */
-{ yylhsminor.yy531 = yymsp[-2].minor.yy531 | yymsp[0].minor.yy531; }
- yymsp[-2].minor.yy531 = yylhsminor.yy531;
+{ yylhsminor.yy717 = yymsp[-2].minor.yy717 | yymsp[0].minor.yy717; }
+ yymsp[-2].minor.yy717 = yylhsminor.yy717;
break;
case 38: /* priv_type ::= READ */
-{ yymsp[0].minor.yy531 = PRIVILEGE_TYPE_READ; }
+{ yymsp[0].minor.yy717 = PRIVILEGE_TYPE_READ; }
break;
case 39: /* priv_type ::= WRITE */
-{ yymsp[0].minor.yy531 = PRIVILEGE_TYPE_WRITE; }
+{ yymsp[0].minor.yy717 = PRIVILEGE_TYPE_WRITE; }
break;
case 40: /* priv_level ::= NK_STAR NK_DOT NK_STAR */
-{ yylhsminor.yy317 = yymsp[-2].minor.yy0; }
- yymsp[-2].minor.yy317 = yylhsminor.yy317;
+{ yylhsminor.yy77 = yymsp[-2].minor.yy0; }
+ yymsp[-2].minor.yy77 = yylhsminor.yy77;
break;
case 41: /* priv_level ::= db_name NK_DOT NK_STAR */
-{ yylhsminor.yy317 = yymsp[-2].minor.yy317; }
- yymsp[-2].minor.yy317 = yylhsminor.yy317;
+{ yylhsminor.yy77 = yymsp[-2].minor.yy77; }
+ yymsp[-2].minor.yy77 = yylhsminor.yy77;
break;
case 42: /* priv_level ::= topic_name */
- case 458: /* alias_opt ::= table_alias */ yytestcase(yyruleno==458);
-{ yylhsminor.yy317 = yymsp[0].minor.yy317; }
- yymsp[0].minor.yy317 = yylhsminor.yy317;
+ case 460: /* alias_opt ::= table_alias */ yytestcase(yyruleno==460);
+{ yylhsminor.yy77 = yymsp[0].minor.yy77; }
+ yymsp[0].minor.yy77 = yylhsminor.yy77;
break;
case 43: /* cmd ::= CREATE DNODE dnode_endpoint */
-{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[0].minor.yy317, NULL); }
+{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[0].minor.yy77, NULL); }
break;
case 44: /* cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER */
-{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[-2].minor.yy317, &yymsp[0].minor.yy0); }
+{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[-2].minor.yy77, &yymsp[0].minor.yy0); }
break;
case 45: /* cmd ::= DROP DNODE NK_INTEGER force_opt */
-{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy335); }
+{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy841); }
break;
case 46: /* cmd ::= DROP DNODE dnode_endpoint force_opt */
-{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy317, yymsp[0].minor.yy335); }
+{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy77, yymsp[0].minor.yy841); }
break;
case 47: /* cmd ::= ALTER DNODE NK_INTEGER NK_STRING */
{ pCxt->pRootNode = createAlterDnodeStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, NULL); }
@@ -3764,46 +3778,46 @@ static YYACTIONTYPE yy_reduce(
case 51: /* dnode_endpoint ::= NK_STRING */
case 52: /* dnode_endpoint ::= NK_ID */ yytestcase(yyruleno==52);
case 53: /* dnode_endpoint ::= NK_IPTOKEN */ yytestcase(yyruleno==53);
- case 344: /* db_name ::= NK_ID */ yytestcase(yyruleno==344);
- case 345: /* table_name ::= NK_ID */ yytestcase(yyruleno==345);
- case 346: /* column_name ::= NK_ID */ yytestcase(yyruleno==346);
- case 347: /* function_name ::= NK_ID */ yytestcase(yyruleno==347);
- case 348: /* table_alias ::= NK_ID */ yytestcase(yyruleno==348);
- case 349: /* column_alias ::= NK_ID */ yytestcase(yyruleno==349);
- case 350: /* user_name ::= NK_ID */ yytestcase(yyruleno==350);
- case 351: /* topic_name ::= NK_ID */ yytestcase(yyruleno==351);
- case 352: /* stream_name ::= NK_ID */ yytestcase(yyruleno==352);
- case 353: /* cgroup_name ::= NK_ID */ yytestcase(yyruleno==353);
- case 354: /* index_name ::= NK_ID */ yytestcase(yyruleno==354);
- case 393: /* noarg_func ::= NOW */ yytestcase(yyruleno==393);
- case 394: /* noarg_func ::= TODAY */ yytestcase(yyruleno==394);
- case 395: /* noarg_func ::= TIMEZONE */ yytestcase(yyruleno==395);
- case 396: /* noarg_func ::= DATABASE */ yytestcase(yyruleno==396);
- case 397: /* noarg_func ::= CLIENT_VERSION */ yytestcase(yyruleno==397);
- case 398: /* noarg_func ::= SERVER_VERSION */ yytestcase(yyruleno==398);
- case 399: /* noarg_func ::= SERVER_STATUS */ yytestcase(yyruleno==399);
- case 400: /* noarg_func ::= CURRENT_USER */ yytestcase(yyruleno==400);
- case 401: /* noarg_func ::= USER */ yytestcase(yyruleno==401);
- case 402: /* star_func ::= COUNT */ yytestcase(yyruleno==402);
- case 403: /* star_func ::= FIRST */ yytestcase(yyruleno==403);
- case 404: /* star_func ::= LAST */ yytestcase(yyruleno==404);
- case 405: /* star_func ::= LAST_ROW */ yytestcase(yyruleno==405);
-{ yylhsminor.yy317 = yymsp[0].minor.yy0; }
- yymsp[0].minor.yy317 = yylhsminor.yy317;
+ case 346: /* db_name ::= NK_ID */ yytestcase(yyruleno==346);
+ case 347: /* table_name ::= NK_ID */ yytestcase(yyruleno==347);
+ case 348: /* column_name ::= NK_ID */ yytestcase(yyruleno==348);
+ case 349: /* function_name ::= NK_ID */ yytestcase(yyruleno==349);
+ case 350: /* table_alias ::= NK_ID */ yytestcase(yyruleno==350);
+ case 351: /* column_alias ::= NK_ID */ yytestcase(yyruleno==351);
+ case 352: /* user_name ::= NK_ID */ yytestcase(yyruleno==352);
+ case 353: /* topic_name ::= NK_ID */ yytestcase(yyruleno==353);
+ case 354: /* stream_name ::= NK_ID */ yytestcase(yyruleno==354);
+ case 355: /* cgroup_name ::= NK_ID */ yytestcase(yyruleno==355);
+ case 356: /* index_name ::= NK_ID */ yytestcase(yyruleno==356);
+ case 395: /* noarg_func ::= NOW */ yytestcase(yyruleno==395);
+ case 396: /* noarg_func ::= TODAY */ yytestcase(yyruleno==396);
+ case 397: /* noarg_func ::= TIMEZONE */ yytestcase(yyruleno==397);
+ case 398: /* noarg_func ::= DATABASE */ yytestcase(yyruleno==398);
+ case 399: /* noarg_func ::= CLIENT_VERSION */ yytestcase(yyruleno==399);
+ case 400: /* noarg_func ::= SERVER_VERSION */ yytestcase(yyruleno==400);
+ case 401: /* noarg_func ::= SERVER_STATUS */ yytestcase(yyruleno==401);
+ case 402: /* noarg_func ::= CURRENT_USER */ yytestcase(yyruleno==402);
+ case 403: /* noarg_func ::= USER */ yytestcase(yyruleno==403);
+ case 404: /* star_func ::= COUNT */ yytestcase(yyruleno==404);
+ case 405: /* star_func ::= FIRST */ yytestcase(yyruleno==405);
+ case 406: /* star_func ::= LAST */ yytestcase(yyruleno==406);
+ case 407: /* star_func ::= LAST_ROW */ yytestcase(yyruleno==407);
+{ yylhsminor.yy77 = yymsp[0].minor.yy0; }
+ yymsp[0].minor.yy77 = yylhsminor.yy77;
break;
case 54: /* force_opt ::= */
case 73: /* not_exists_opt ::= */ yytestcase(yyruleno==73);
case 75: /* exists_opt ::= */ yytestcase(yyruleno==75);
case 284: /* analyze_opt ::= */ yytestcase(yyruleno==284);
case 291: /* agg_func_opt ::= */ yytestcase(yyruleno==291);
- case 466: /* set_quantifier_opt ::= */ yytestcase(yyruleno==466);
-{ yymsp[1].minor.yy335 = false; }
+ case 468: /* set_quantifier_opt ::= */ yytestcase(yyruleno==468);
+{ yymsp[1].minor.yy841 = false; }
break;
case 55: /* force_opt ::= FORCE */
case 285: /* analyze_opt ::= ANALYZE */ yytestcase(yyruleno==285);
case 292: /* agg_func_opt ::= AGGREGATE */ yytestcase(yyruleno==292);
- case 467: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==467);
-{ yymsp[0].minor.yy335 = true; }
+ case 469: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==469);
+{ yymsp[0].minor.yy841 = true; }
break;
case 56: /* cmd ::= ALTER LOCAL NK_STRING */
{ pCxt->pRootNode = createAlterLocalStmt(pCxt, &yymsp[0].minor.yy0, NULL); }
@@ -3836,206 +3850,206 @@ static YYACTIONTYPE yy_reduce(
{ pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_MNODE_STMT, &yymsp[0].minor.yy0); }
break;
case 66: /* cmd ::= CREATE DATABASE not_exists_opt db_name db_options */
-{ pCxt->pRootNode = createCreateDatabaseStmt(pCxt, yymsp[-2].minor.yy335, &yymsp[-1].minor.yy317, yymsp[0].minor.yy74); }
+{ pCxt->pRootNode = createCreateDatabaseStmt(pCxt, yymsp[-2].minor.yy841, &yymsp[-1].minor.yy77, yymsp[0].minor.yy600); }
break;
case 67: /* cmd ::= DROP DATABASE exists_opt db_name */
-{ pCxt->pRootNode = createDropDatabaseStmt(pCxt, yymsp[-1].minor.yy335, &yymsp[0].minor.yy317); }
+{ pCxt->pRootNode = createDropDatabaseStmt(pCxt, yymsp[-1].minor.yy841, &yymsp[0].minor.yy77); }
break;
case 68: /* cmd ::= USE db_name */
-{ pCxt->pRootNode = createUseDatabaseStmt(pCxt, &yymsp[0].minor.yy317); }
+{ pCxt->pRootNode = createUseDatabaseStmt(pCxt, &yymsp[0].minor.yy77); }
break;
case 69: /* cmd ::= ALTER DATABASE db_name alter_db_options */
-{ pCxt->pRootNode = createAlterDatabaseStmt(pCxt, &yymsp[-1].minor.yy317, yymsp[0].minor.yy74); }
+{ pCxt->pRootNode = createAlterDatabaseStmt(pCxt, &yymsp[-1].minor.yy77, yymsp[0].minor.yy600); }
break;
case 70: /* cmd ::= FLUSH DATABASE db_name */
-{ pCxt->pRootNode = createFlushDatabaseStmt(pCxt, &yymsp[0].minor.yy317); }
+{ pCxt->pRootNode = createFlushDatabaseStmt(pCxt, &yymsp[0].minor.yy77); }
break;
case 71: /* cmd ::= TRIM DATABASE db_name speed_opt */
-{ pCxt->pRootNode = createTrimDatabaseStmt(pCxt, &yymsp[-1].minor.yy317, yymsp[0].minor.yy856); }
+{ pCxt->pRootNode = createTrimDatabaseStmt(pCxt, &yymsp[-1].minor.yy77, yymsp[0].minor.yy248); }
break;
case 72: /* not_exists_opt ::= IF NOT EXISTS */
-{ yymsp[-2].minor.yy335 = true; }
+{ yymsp[-2].minor.yy841 = true; }
break;
case 74: /* exists_opt ::= IF EXISTS */
-{ yymsp[-1].minor.yy335 = true; }
+{ yymsp[-1].minor.yy841 = true; }
break;
case 76: /* db_options ::= */
-{ yymsp[1].minor.yy74 = createDefaultDatabaseOptions(pCxt); }
+{ yymsp[1].minor.yy600 = createDefaultDatabaseOptions(pCxt); }
break;
case 77: /* db_options ::= db_options BUFFER NK_INTEGER */
-{ yylhsminor.yy74 = setDatabaseOption(pCxt, yymsp[-2].minor.yy74, DB_OPTION_BUFFER, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy74 = yylhsminor.yy74;
+{ yylhsminor.yy600 = setDatabaseOption(pCxt, yymsp[-2].minor.yy600, DB_OPTION_BUFFER, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy600 = yylhsminor.yy600;
break;
case 78: /* db_options ::= db_options CACHEMODEL NK_STRING */
-{ yylhsminor.yy74 = setDatabaseOption(pCxt, yymsp[-2].minor.yy74, DB_OPTION_CACHEMODEL, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy74 = yylhsminor.yy74;
+{ yylhsminor.yy600 = setDatabaseOption(pCxt, yymsp[-2].minor.yy600, DB_OPTION_CACHEMODEL, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy600 = yylhsminor.yy600;
break;
case 79: /* db_options ::= db_options CACHESIZE NK_INTEGER */
-{ yylhsminor.yy74 = setDatabaseOption(pCxt, yymsp[-2].minor.yy74, DB_OPTION_CACHESIZE, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy74 = yylhsminor.yy74;
+{ yylhsminor.yy600 = setDatabaseOption(pCxt, yymsp[-2].minor.yy600, DB_OPTION_CACHESIZE, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy600 = yylhsminor.yy600;
break;
case 80: /* db_options ::= db_options COMP NK_INTEGER */
-{ yylhsminor.yy74 = setDatabaseOption(pCxt, yymsp[-2].minor.yy74, DB_OPTION_COMP, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy74 = yylhsminor.yy74;
+{ yylhsminor.yy600 = setDatabaseOption(pCxt, yymsp[-2].minor.yy600, DB_OPTION_COMP, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy600 = yylhsminor.yy600;
break;
case 81: /* db_options ::= db_options DURATION NK_INTEGER */
case 82: /* db_options ::= db_options DURATION NK_VARIABLE */ yytestcase(yyruleno==82);
-{ yylhsminor.yy74 = setDatabaseOption(pCxt, yymsp[-2].minor.yy74, DB_OPTION_DAYS, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy74 = yylhsminor.yy74;
+{ yylhsminor.yy600 = setDatabaseOption(pCxt, yymsp[-2].minor.yy600, DB_OPTION_DAYS, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy600 = yylhsminor.yy600;
break;
case 83: /* db_options ::= db_options MAXROWS NK_INTEGER */
-{ yylhsminor.yy74 = setDatabaseOption(pCxt, yymsp[-2].minor.yy74, DB_OPTION_MAXROWS, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy74 = yylhsminor.yy74;
+{ yylhsminor.yy600 = setDatabaseOption(pCxt, yymsp[-2].minor.yy600, DB_OPTION_MAXROWS, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy600 = yylhsminor.yy600;
break;
case 84: /* db_options ::= db_options MINROWS NK_INTEGER */
-{ yylhsminor.yy74 = setDatabaseOption(pCxt, yymsp[-2].minor.yy74, DB_OPTION_MINROWS, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy74 = yylhsminor.yy74;
+{ yylhsminor.yy600 = setDatabaseOption(pCxt, yymsp[-2].minor.yy600, DB_OPTION_MINROWS, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy600 = yylhsminor.yy600;
break;
case 85: /* db_options ::= db_options KEEP integer_list */
case 86: /* db_options ::= db_options KEEP variable_list */ yytestcase(yyruleno==86);
-{ yylhsminor.yy74 = setDatabaseOption(pCxt, yymsp[-2].minor.yy74, DB_OPTION_KEEP, yymsp[0].minor.yy874); }
- yymsp[-2].minor.yy74 = yylhsminor.yy74;
+{ yylhsminor.yy600 = setDatabaseOption(pCxt, yymsp[-2].minor.yy600, DB_OPTION_KEEP, yymsp[0].minor.yy601); }
+ yymsp[-2].minor.yy600 = yylhsminor.yy600;
break;
case 87: /* db_options ::= db_options PAGES NK_INTEGER */
-{ yylhsminor.yy74 = setDatabaseOption(pCxt, yymsp[-2].minor.yy74, DB_OPTION_PAGES, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy74 = yylhsminor.yy74;
+{ yylhsminor.yy600 = setDatabaseOption(pCxt, yymsp[-2].minor.yy600, DB_OPTION_PAGES, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy600 = yylhsminor.yy600;
break;
case 88: /* db_options ::= db_options PAGESIZE NK_INTEGER */
-{ yylhsminor.yy74 = setDatabaseOption(pCxt, yymsp[-2].minor.yy74, DB_OPTION_PAGESIZE, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy74 = yylhsminor.yy74;
+{ yylhsminor.yy600 = setDatabaseOption(pCxt, yymsp[-2].minor.yy600, DB_OPTION_PAGESIZE, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy600 = yylhsminor.yy600;
break;
case 89: /* db_options ::= db_options TSDB_PAGESIZE NK_INTEGER */
-{ yylhsminor.yy74 = setDatabaseOption(pCxt, yymsp[-2].minor.yy74, DB_OPTION_TSDB_PAGESIZE, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy74 = yylhsminor.yy74;
+{ yylhsminor.yy600 = setDatabaseOption(pCxt, yymsp[-2].minor.yy600, DB_OPTION_TSDB_PAGESIZE, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy600 = yylhsminor.yy600;
break;
case 90: /* db_options ::= db_options PRECISION NK_STRING */
-{ yylhsminor.yy74 = setDatabaseOption(pCxt, yymsp[-2].minor.yy74, DB_OPTION_PRECISION, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy74 = yylhsminor.yy74;
+{ yylhsminor.yy600 = setDatabaseOption(pCxt, yymsp[-2].minor.yy600, DB_OPTION_PRECISION, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy600 = yylhsminor.yy600;
break;
case 91: /* db_options ::= db_options REPLICA NK_INTEGER */
-{ yylhsminor.yy74 = setDatabaseOption(pCxt, yymsp[-2].minor.yy74, DB_OPTION_REPLICA, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy74 = yylhsminor.yy74;
+{ yylhsminor.yy600 = setDatabaseOption(pCxt, yymsp[-2].minor.yy600, DB_OPTION_REPLICA, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy600 = yylhsminor.yy600;
break;
case 92: /* db_options ::= db_options VGROUPS NK_INTEGER */
-{ yylhsminor.yy74 = setDatabaseOption(pCxt, yymsp[-2].minor.yy74, DB_OPTION_VGROUPS, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy74 = yylhsminor.yy74;
+{ yylhsminor.yy600 = setDatabaseOption(pCxt, yymsp[-2].minor.yy600, DB_OPTION_VGROUPS, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy600 = yylhsminor.yy600;
break;
case 93: /* db_options ::= db_options SINGLE_STABLE NK_INTEGER */
-{ yylhsminor.yy74 = setDatabaseOption(pCxt, yymsp[-2].minor.yy74, DB_OPTION_SINGLE_STABLE, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy74 = yylhsminor.yy74;
+{ yylhsminor.yy600 = setDatabaseOption(pCxt, yymsp[-2].minor.yy600, DB_OPTION_SINGLE_STABLE, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy600 = yylhsminor.yy600;
break;
case 94: /* db_options ::= db_options RETENTIONS retention_list */
-{ yylhsminor.yy74 = setDatabaseOption(pCxt, yymsp[-2].minor.yy74, DB_OPTION_RETENTIONS, yymsp[0].minor.yy874); }
- yymsp[-2].minor.yy74 = yylhsminor.yy74;
+{ yylhsminor.yy600 = setDatabaseOption(pCxt, yymsp[-2].minor.yy600, DB_OPTION_RETENTIONS, yymsp[0].minor.yy601); }
+ yymsp[-2].minor.yy600 = yylhsminor.yy600;
break;
case 95: /* db_options ::= db_options SCHEMALESS NK_INTEGER */
-{ yylhsminor.yy74 = setDatabaseOption(pCxt, yymsp[-2].minor.yy74, DB_OPTION_SCHEMALESS, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy74 = yylhsminor.yy74;
+{ yylhsminor.yy600 = setDatabaseOption(pCxt, yymsp[-2].minor.yy600, DB_OPTION_SCHEMALESS, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy600 = yylhsminor.yy600;
break;
case 96: /* db_options ::= db_options WAL_LEVEL NK_INTEGER */
-{ yylhsminor.yy74 = setDatabaseOption(pCxt, yymsp[-2].minor.yy74, DB_OPTION_WAL, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy74 = yylhsminor.yy74;
+{ yylhsminor.yy600 = setDatabaseOption(pCxt, yymsp[-2].minor.yy600, DB_OPTION_WAL, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy600 = yylhsminor.yy600;
break;
case 97: /* db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER */
-{ yylhsminor.yy74 = setDatabaseOption(pCxt, yymsp[-2].minor.yy74, DB_OPTION_FSYNC, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy74 = yylhsminor.yy74;
+{ yylhsminor.yy600 = setDatabaseOption(pCxt, yymsp[-2].minor.yy600, DB_OPTION_FSYNC, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy600 = yylhsminor.yy600;
break;
case 98: /* db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER */
-{ yylhsminor.yy74 = setDatabaseOption(pCxt, yymsp[-2].minor.yy74, DB_OPTION_WAL_RETENTION_PERIOD, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy74 = yylhsminor.yy74;
+{ yylhsminor.yy600 = setDatabaseOption(pCxt, yymsp[-2].minor.yy600, DB_OPTION_WAL_RETENTION_PERIOD, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy600 = yylhsminor.yy600;
break;
case 99: /* db_options ::= db_options WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */
{
SToken t = yymsp[-1].minor.yy0;
t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z;
- yylhsminor.yy74 = setDatabaseOption(pCxt, yymsp[-3].minor.yy74, DB_OPTION_WAL_RETENTION_PERIOD, &t);
+ yylhsminor.yy600 = setDatabaseOption(pCxt, yymsp[-3].minor.yy600, DB_OPTION_WAL_RETENTION_PERIOD, &t);
}
- yymsp[-3].minor.yy74 = yylhsminor.yy74;
+ yymsp[-3].minor.yy600 = yylhsminor.yy600;
break;
case 100: /* db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER */
-{ yylhsminor.yy74 = setDatabaseOption(pCxt, yymsp[-2].minor.yy74, DB_OPTION_WAL_RETENTION_SIZE, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy74 = yylhsminor.yy74;
+{ yylhsminor.yy600 = setDatabaseOption(pCxt, yymsp[-2].minor.yy600, DB_OPTION_WAL_RETENTION_SIZE, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy600 = yylhsminor.yy600;
break;
case 101: /* db_options ::= db_options WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */
{
SToken t = yymsp[-1].minor.yy0;
t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z;
- yylhsminor.yy74 = setDatabaseOption(pCxt, yymsp[-3].minor.yy74, DB_OPTION_WAL_RETENTION_SIZE, &t);
+ yylhsminor.yy600 = setDatabaseOption(pCxt, yymsp[-3].minor.yy600, DB_OPTION_WAL_RETENTION_SIZE, &t);
}
- yymsp[-3].minor.yy74 = yylhsminor.yy74;
+ yymsp[-3].minor.yy600 = yylhsminor.yy600;
break;
case 102: /* db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER */
-{ yylhsminor.yy74 = setDatabaseOption(pCxt, yymsp[-2].minor.yy74, DB_OPTION_WAL_ROLL_PERIOD, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy74 = yylhsminor.yy74;
+{ yylhsminor.yy600 = setDatabaseOption(pCxt, yymsp[-2].minor.yy600, DB_OPTION_WAL_ROLL_PERIOD, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy600 = yylhsminor.yy600;
break;
case 103: /* db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER */
-{ yylhsminor.yy74 = setDatabaseOption(pCxt, yymsp[-2].minor.yy74, DB_OPTION_WAL_SEGMENT_SIZE, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy74 = yylhsminor.yy74;
+{ yylhsminor.yy600 = setDatabaseOption(pCxt, yymsp[-2].minor.yy600, DB_OPTION_WAL_SEGMENT_SIZE, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy600 = yylhsminor.yy600;
break;
case 104: /* db_options ::= db_options STT_TRIGGER NK_INTEGER */
-{ yylhsminor.yy74 = setDatabaseOption(pCxt, yymsp[-2].minor.yy74, DB_OPTION_STT_TRIGGER, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy74 = yylhsminor.yy74;
+{ yylhsminor.yy600 = setDatabaseOption(pCxt, yymsp[-2].minor.yy600, DB_OPTION_STT_TRIGGER, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy600 = yylhsminor.yy600;
break;
case 105: /* db_options ::= db_options TABLE_PREFIX NK_INTEGER */
-{ yylhsminor.yy74 = setDatabaseOption(pCxt, yymsp[-2].minor.yy74, DB_OPTION_TABLE_PREFIX, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy74 = yylhsminor.yy74;
+{ yylhsminor.yy600 = setDatabaseOption(pCxt, yymsp[-2].minor.yy600, DB_OPTION_TABLE_PREFIX, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy600 = yylhsminor.yy600;
break;
case 106: /* db_options ::= db_options TABLE_SUFFIX NK_INTEGER */
-{ yylhsminor.yy74 = setDatabaseOption(pCxt, yymsp[-2].minor.yy74, DB_OPTION_TABLE_SUFFIX, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy74 = yylhsminor.yy74;
+{ yylhsminor.yy600 = setDatabaseOption(pCxt, yymsp[-2].minor.yy600, DB_OPTION_TABLE_SUFFIX, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy600 = yylhsminor.yy600;
break;
case 107: /* alter_db_options ::= alter_db_option */
-{ yylhsminor.yy74 = createAlterDatabaseOptions(pCxt); yylhsminor.yy74 = setAlterDatabaseOption(pCxt, yylhsminor.yy74, &yymsp[0].minor.yy767); }
- yymsp[0].minor.yy74 = yylhsminor.yy74;
+{ yylhsminor.yy600 = createAlterDatabaseOptions(pCxt); yylhsminor.yy600 = setAlterDatabaseOption(pCxt, yylhsminor.yy600, &yymsp[0].minor.yy661); }
+ yymsp[0].minor.yy600 = yylhsminor.yy600;
break;
case 108: /* alter_db_options ::= alter_db_options alter_db_option */
-{ yylhsminor.yy74 = setAlterDatabaseOption(pCxt, yymsp[-1].minor.yy74, &yymsp[0].minor.yy767); }
- yymsp[-1].minor.yy74 = yylhsminor.yy74;
+{ yylhsminor.yy600 = setAlterDatabaseOption(pCxt, yymsp[-1].minor.yy600, &yymsp[0].minor.yy661); }
+ yymsp[-1].minor.yy600 = yylhsminor.yy600;
break;
case 109: /* alter_db_option ::= BUFFER NK_INTEGER */
-{ yymsp[-1].minor.yy767.type = DB_OPTION_BUFFER; yymsp[-1].minor.yy767.val = yymsp[0].minor.yy0; }
+{ yymsp[-1].minor.yy661.type = DB_OPTION_BUFFER; yymsp[-1].minor.yy661.val = yymsp[0].minor.yy0; }
break;
case 110: /* alter_db_option ::= CACHEMODEL NK_STRING */
-{ yymsp[-1].minor.yy767.type = DB_OPTION_CACHEMODEL; yymsp[-1].minor.yy767.val = yymsp[0].minor.yy0; }
+{ yymsp[-1].minor.yy661.type = DB_OPTION_CACHEMODEL; yymsp[-1].minor.yy661.val = yymsp[0].minor.yy0; }
break;
case 111: /* alter_db_option ::= CACHESIZE NK_INTEGER */
-{ yymsp[-1].minor.yy767.type = DB_OPTION_CACHESIZE; yymsp[-1].minor.yy767.val = yymsp[0].minor.yy0; }
+{ yymsp[-1].minor.yy661.type = DB_OPTION_CACHESIZE; yymsp[-1].minor.yy661.val = yymsp[0].minor.yy0; }
break;
case 112: /* alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER */
-{ yymsp[-1].minor.yy767.type = DB_OPTION_FSYNC; yymsp[-1].minor.yy767.val = yymsp[0].minor.yy0; }
+{ yymsp[-1].minor.yy661.type = DB_OPTION_FSYNC; yymsp[-1].minor.yy661.val = yymsp[0].minor.yy0; }
break;
case 113: /* alter_db_option ::= KEEP integer_list */
case 114: /* alter_db_option ::= KEEP variable_list */ yytestcase(yyruleno==114);
-{ yymsp[-1].minor.yy767.type = DB_OPTION_KEEP; yymsp[-1].minor.yy767.pList = yymsp[0].minor.yy874; }
+{ yymsp[-1].minor.yy661.type = DB_OPTION_KEEP; yymsp[-1].minor.yy661.pList = yymsp[0].minor.yy601; }
break;
case 115: /* alter_db_option ::= PAGES NK_INTEGER */
-{ yymsp[-1].minor.yy767.type = DB_OPTION_PAGES; yymsp[-1].minor.yy767.val = yymsp[0].minor.yy0; }
+{ yymsp[-1].minor.yy661.type = DB_OPTION_PAGES; yymsp[-1].minor.yy661.val = yymsp[0].minor.yy0; }
break;
case 116: /* alter_db_option ::= REPLICA NK_INTEGER */
-{ yymsp[-1].minor.yy767.type = DB_OPTION_REPLICA; yymsp[-1].minor.yy767.val = yymsp[0].minor.yy0; }
+{ yymsp[-1].minor.yy661.type = DB_OPTION_REPLICA; yymsp[-1].minor.yy661.val = yymsp[0].minor.yy0; }
break;
case 117: /* alter_db_option ::= WAL_LEVEL NK_INTEGER */
-{ yymsp[-1].minor.yy767.type = DB_OPTION_WAL; yymsp[-1].minor.yy767.val = yymsp[0].minor.yy0; }
+{ yymsp[-1].minor.yy661.type = DB_OPTION_WAL; yymsp[-1].minor.yy661.val = yymsp[0].minor.yy0; }
break;
case 118: /* alter_db_option ::= STT_TRIGGER NK_INTEGER */
-{ yymsp[-1].minor.yy767.type = DB_OPTION_STT_TRIGGER; yymsp[-1].minor.yy767.val = yymsp[0].minor.yy0; }
+{ yymsp[-1].minor.yy661.type = DB_OPTION_STT_TRIGGER; yymsp[-1].minor.yy661.val = yymsp[0].minor.yy0; }
break;
case 119: /* integer_list ::= NK_INTEGER */
-{ yylhsminor.yy874 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); }
- yymsp[0].minor.yy874 = yylhsminor.yy874;
+{ yylhsminor.yy601 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy601 = yylhsminor.yy601;
break;
case 120: /* integer_list ::= integer_list NK_COMMA NK_INTEGER */
- case 314: /* dnode_list ::= dnode_list DNODE NK_INTEGER */ yytestcase(yyruleno==314);
-{ yylhsminor.yy874 = addNodeToList(pCxt, yymsp[-2].minor.yy874, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); }
- yymsp[-2].minor.yy874 = yylhsminor.yy874;
+ case 316: /* dnode_list ::= dnode_list DNODE NK_INTEGER */ yytestcase(yyruleno==316);
+{ yylhsminor.yy601 = addNodeToList(pCxt, yymsp[-2].minor.yy601, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); }
+ yymsp[-2].minor.yy601 = yylhsminor.yy601;
break;
case 121: /* variable_list ::= NK_VARIABLE */
-{ yylhsminor.yy874 = createNodeList(pCxt, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); }
- yymsp[0].minor.yy874 = yylhsminor.yy874;
+{ yylhsminor.yy601 = createNodeList(pCxt, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy601 = yylhsminor.yy601;
break;
case 122: /* variable_list ::= variable_list NK_COMMA NK_VARIABLE */
-{ yylhsminor.yy874 = addNodeToList(pCxt, yymsp[-2].minor.yy874, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); }
- yymsp[-2].minor.yy874 = yylhsminor.yy874;
+{ yylhsminor.yy601 = addNodeToList(pCxt, yymsp[-2].minor.yy601, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); }
+ yymsp[-2].minor.yy601 = yylhsminor.yy601;
break;
case 123: /* retention_list ::= retention */
case 145: /* multi_create_clause ::= create_subtable_clause */ yytestcase(yyruleno==145);
@@ -4045,14 +4059,14 @@ static YYACTIONTYPE yy_reduce(
case 204: /* col_name_list ::= col_name */ yytestcase(yyruleno==204);
case 253: /* tag_list_opt ::= tag_item */ yytestcase(yyruleno==253);
case 266: /* func_list ::= func */ yytestcase(yyruleno==266);
- case 342: /* literal_list ::= signed_literal */ yytestcase(yyruleno==342);
- case 408: /* other_para_list ::= star_func_para */ yytestcase(yyruleno==408);
- case 414: /* when_then_list ::= when_then_expr */ yytestcase(yyruleno==414);
- case 469: /* select_list ::= select_item */ yytestcase(yyruleno==469);
- case 480: /* partition_list ::= partition_item */ yytestcase(yyruleno==480);
- case 532: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==532);
-{ yylhsminor.yy874 = createNodeList(pCxt, yymsp[0].minor.yy74); }
- yymsp[0].minor.yy874 = yylhsminor.yy874;
+ case 344: /* literal_list ::= signed_literal */ yytestcase(yyruleno==344);
+ case 410: /* other_para_list ::= star_func_para */ yytestcase(yyruleno==410);
+ case 416: /* when_then_list ::= when_then_expr */ yytestcase(yyruleno==416);
+ case 471: /* select_list ::= select_item */ yytestcase(yyruleno==471);
+ case 482: /* partition_list ::= partition_item */ yytestcase(yyruleno==482);
+ case 536: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==536);
+{ yylhsminor.yy601 = createNodeList(pCxt, yymsp[0].minor.yy600); }
+ yymsp[0].minor.yy601 = yylhsminor.yy601;
break;
case 124: /* retention_list ::= retention_list NK_COMMA retention */
case 156: /* column_def_list ::= column_def_list NK_COMMA column_def */ yytestcase(yyruleno==156);
@@ -4060,271 +4074,271 @@ static YYACTIONTYPE yy_reduce(
case 205: /* col_name_list ::= col_name_list NK_COMMA col_name */ yytestcase(yyruleno==205);
case 254: /* tag_list_opt ::= tag_list_opt NK_COMMA tag_item */ yytestcase(yyruleno==254);
case 267: /* func_list ::= func_list NK_COMMA func */ yytestcase(yyruleno==267);
- case 343: /* literal_list ::= literal_list NK_COMMA signed_literal */ yytestcase(yyruleno==343);
- case 409: /* other_para_list ::= other_para_list NK_COMMA star_func_para */ yytestcase(yyruleno==409);
- case 470: /* select_list ::= select_list NK_COMMA select_item */ yytestcase(yyruleno==470);
- case 481: /* partition_list ::= partition_list NK_COMMA partition_item */ yytestcase(yyruleno==481);
- case 533: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==533);
-{ yylhsminor.yy874 = addNodeToList(pCxt, yymsp[-2].minor.yy874, yymsp[0].minor.yy74); }
- yymsp[-2].minor.yy874 = yylhsminor.yy874;
+ case 345: /* literal_list ::= literal_list NK_COMMA signed_literal */ yytestcase(yyruleno==345);
+ case 411: /* other_para_list ::= other_para_list NK_COMMA star_func_para */ yytestcase(yyruleno==411);
+ case 472: /* select_list ::= select_list NK_COMMA select_item */ yytestcase(yyruleno==472);
+ case 483: /* partition_list ::= partition_list NK_COMMA partition_item */ yytestcase(yyruleno==483);
+ case 537: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==537);
+{ yylhsminor.yy601 = addNodeToList(pCxt, yymsp[-2].minor.yy601, yymsp[0].minor.yy600); }
+ yymsp[-2].minor.yy601 = yylhsminor.yy601;
break;
case 125: /* retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */
-{ yylhsminor.yy74 = createNodeListNodeEx(pCxt, createDurationValueNode(pCxt, &yymsp[-2].minor.yy0), createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); }
- yymsp[-2].minor.yy74 = yylhsminor.yy74;
+{ yylhsminor.yy600 = createNodeListNodeEx(pCxt, createDurationValueNode(pCxt, &yymsp[-2].minor.yy0), createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); }
+ yymsp[-2].minor.yy600 = yylhsminor.yy600;
break;
case 126: /* speed_opt ::= */
case 293: /* bufsize_opt ::= */ yytestcase(yyruleno==293);
-{ yymsp[1].minor.yy856 = 0; }
+{ yymsp[1].minor.yy248 = 0; }
break;
case 127: /* speed_opt ::= MAX_SPEED NK_INTEGER */
case 294: /* bufsize_opt ::= BUFSIZE NK_INTEGER */ yytestcase(yyruleno==294);
-{ yymsp[-1].minor.yy856 = taosStr2Int32(yymsp[0].minor.yy0.z, NULL, 10); }
+{ yymsp[-1].minor.yy248 = taosStr2Int32(yymsp[0].minor.yy0.z, NULL, 10); }
break;
case 128: /* cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */
case 130: /* cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ yytestcase(yyruleno==130);
-{ pCxt->pRootNode = createCreateTableStmt(pCxt, yymsp[-6].minor.yy335, yymsp[-5].minor.yy74, yymsp[-3].minor.yy874, yymsp[-1].minor.yy874, yymsp[0].minor.yy74); }
+{ pCxt->pRootNode = createCreateTableStmt(pCxt, yymsp[-6].minor.yy841, yymsp[-5].minor.yy600, yymsp[-3].minor.yy601, yymsp[-1].minor.yy601, yymsp[0].minor.yy600); }
break;
case 129: /* cmd ::= CREATE TABLE multi_create_clause */
-{ pCxt->pRootNode = createCreateMultiTableStmt(pCxt, yymsp[0].minor.yy874); }
+{ pCxt->pRootNode = createCreateMultiTableStmt(pCxt, yymsp[0].minor.yy601); }
break;
case 131: /* cmd ::= DROP TABLE multi_drop_clause */
-{ pCxt->pRootNode = createDropTableStmt(pCxt, yymsp[0].minor.yy874); }
+{ pCxt->pRootNode = createDropTableStmt(pCxt, yymsp[0].minor.yy601); }
break;
case 132: /* cmd ::= DROP STABLE exists_opt full_table_name */
-{ pCxt->pRootNode = createDropSuperTableStmt(pCxt, yymsp[-1].minor.yy335, yymsp[0].minor.yy74); }
+{ pCxt->pRootNode = createDropSuperTableStmt(pCxt, yymsp[-1].minor.yy841, yymsp[0].minor.yy600); }
break;
case 133: /* cmd ::= ALTER TABLE alter_table_clause */
- case 316: /* cmd ::= query_or_subquery */ yytestcase(yyruleno==316);
-{ pCxt->pRootNode = yymsp[0].minor.yy74; }
+ case 318: /* cmd ::= query_or_subquery */ yytestcase(yyruleno==318);
+{ pCxt->pRootNode = yymsp[0].minor.yy600; }
break;
case 134: /* cmd ::= ALTER STABLE alter_table_clause */
-{ pCxt->pRootNode = setAlterSuperTableType(yymsp[0].minor.yy74); }
+{ pCxt->pRootNode = setAlterSuperTableType(yymsp[0].minor.yy600); }
break;
case 135: /* alter_table_clause ::= full_table_name alter_table_options */
-{ yylhsminor.yy74 = createAlterTableModifyOptions(pCxt, yymsp[-1].minor.yy74, yymsp[0].minor.yy74); }
- yymsp[-1].minor.yy74 = yylhsminor.yy74;
+{ yylhsminor.yy600 = createAlterTableModifyOptions(pCxt, yymsp[-1].minor.yy600, yymsp[0].minor.yy600); }
+ yymsp[-1].minor.yy600 = yylhsminor.yy600;
break;
case 136: /* alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */
-{ yylhsminor.yy74 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy74, TSDB_ALTER_TABLE_ADD_COLUMN, &yymsp[-1].minor.yy317, yymsp[0].minor.yy898); }
- yymsp[-4].minor.yy74 = yylhsminor.yy74;
+{ yylhsminor.yy600 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy600, TSDB_ALTER_TABLE_ADD_COLUMN, &yymsp[-1].minor.yy77, yymsp[0].minor.yy888); }
+ yymsp[-4].minor.yy600 = yylhsminor.yy600;
break;
case 137: /* alter_table_clause ::= full_table_name DROP COLUMN column_name */
-{ yylhsminor.yy74 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy74, TSDB_ALTER_TABLE_DROP_COLUMN, &yymsp[0].minor.yy317); }
- yymsp[-3].minor.yy74 = yylhsminor.yy74;
+{ yylhsminor.yy600 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy600, TSDB_ALTER_TABLE_DROP_COLUMN, &yymsp[0].minor.yy77); }
+ yymsp[-3].minor.yy600 = yylhsminor.yy600;
break;
case 138: /* alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */
-{ yylhsminor.yy74 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy74, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, &yymsp[-1].minor.yy317, yymsp[0].minor.yy898); }
- yymsp[-4].minor.yy74 = yylhsminor.yy74;
+{ yylhsminor.yy600 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy600, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, &yymsp[-1].minor.yy77, yymsp[0].minor.yy888); }
+ yymsp[-4].minor.yy600 = yylhsminor.yy600;
break;
case 139: /* alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */
-{ yylhsminor.yy74 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy74, TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, &yymsp[-1].minor.yy317, &yymsp[0].minor.yy317); }
- yymsp[-4].minor.yy74 = yylhsminor.yy74;
+{ yylhsminor.yy600 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy600, TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, &yymsp[-1].minor.yy77, &yymsp[0].minor.yy77); }
+ yymsp[-4].minor.yy600 = yylhsminor.yy600;
break;
case 140: /* alter_table_clause ::= full_table_name ADD TAG column_name type_name */
-{ yylhsminor.yy74 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy74, TSDB_ALTER_TABLE_ADD_TAG, &yymsp[-1].minor.yy317, yymsp[0].minor.yy898); }
- yymsp[-4].minor.yy74 = yylhsminor.yy74;
+{ yylhsminor.yy600 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy600, TSDB_ALTER_TABLE_ADD_TAG, &yymsp[-1].minor.yy77, yymsp[0].minor.yy888); }
+ yymsp[-4].minor.yy600 = yylhsminor.yy600;
break;
case 141: /* alter_table_clause ::= full_table_name DROP TAG column_name */
-{ yylhsminor.yy74 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy74, TSDB_ALTER_TABLE_DROP_TAG, &yymsp[0].minor.yy317); }
- yymsp[-3].minor.yy74 = yylhsminor.yy74;
+{ yylhsminor.yy600 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy600, TSDB_ALTER_TABLE_DROP_TAG, &yymsp[0].minor.yy77); }
+ yymsp[-3].minor.yy600 = yylhsminor.yy600;
break;
case 142: /* alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */
-{ yylhsminor.yy74 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy74, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, &yymsp[-1].minor.yy317, yymsp[0].minor.yy898); }
- yymsp[-4].minor.yy74 = yylhsminor.yy74;
+{ yylhsminor.yy600 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy600, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, &yymsp[-1].minor.yy77, yymsp[0].minor.yy888); }
+ yymsp[-4].minor.yy600 = yylhsminor.yy600;
break;
case 143: /* alter_table_clause ::= full_table_name RENAME TAG column_name column_name */
-{ yylhsminor.yy74 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy74, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &yymsp[-1].minor.yy317, &yymsp[0].minor.yy317); }
- yymsp[-4].minor.yy74 = yylhsminor.yy74;
+{ yylhsminor.yy600 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy600, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &yymsp[-1].minor.yy77, &yymsp[0].minor.yy77); }
+ yymsp[-4].minor.yy600 = yylhsminor.yy600;
break;
case 144: /* alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */
-{ yylhsminor.yy74 = createAlterTableSetTag(pCxt, yymsp[-5].minor.yy74, &yymsp[-2].minor.yy317, yymsp[0].minor.yy74); }
- yymsp[-5].minor.yy74 = yylhsminor.yy74;
+{ yylhsminor.yy600 = createAlterTableSetTag(pCxt, yymsp[-5].minor.yy600, &yymsp[-2].minor.yy77, yymsp[0].minor.yy600); }
+ yymsp[-5].minor.yy600 = yylhsminor.yy600;
break;
case 146: /* multi_create_clause ::= multi_create_clause create_subtable_clause */
case 149: /* multi_drop_clause ::= multi_drop_clause drop_table_clause */ yytestcase(yyruleno==149);
- case 415: /* when_then_list ::= when_then_list when_then_expr */ yytestcase(yyruleno==415);
-{ yylhsminor.yy874 = addNodeToList(pCxt, yymsp[-1].minor.yy874, yymsp[0].minor.yy74); }
- yymsp[-1].minor.yy874 = yylhsminor.yy874;
+ case 417: /* when_then_list ::= when_then_list when_then_expr */ yytestcase(yyruleno==417);
+{ yylhsminor.yy601 = addNodeToList(pCxt, yymsp[-1].minor.yy601, yymsp[0].minor.yy600); }
+ yymsp[-1].minor.yy601 = yylhsminor.yy601;
break;
case 147: /* create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP expression_list NK_RP table_options */
-{ yylhsminor.yy74 = createCreateSubTableClause(pCxt, yymsp[-9].minor.yy335, yymsp[-8].minor.yy74, yymsp[-6].minor.yy74, yymsp[-5].minor.yy874, yymsp[-2].minor.yy874, yymsp[0].minor.yy74); }
- yymsp[-9].minor.yy74 = yylhsminor.yy74;
+{ yylhsminor.yy600 = createCreateSubTableClause(pCxt, yymsp[-9].minor.yy841, yymsp[-8].minor.yy600, yymsp[-6].minor.yy600, yymsp[-5].minor.yy601, yymsp[-2].minor.yy601, yymsp[0].minor.yy600); }
+ yymsp[-9].minor.yy600 = yylhsminor.yy600;
break;
case 150: /* drop_table_clause ::= exists_opt full_table_name */
-{ yylhsminor.yy74 = createDropTableClause(pCxt, yymsp[-1].minor.yy335, yymsp[0].minor.yy74); }
- yymsp[-1].minor.yy74 = yylhsminor.yy74;
+{ yylhsminor.yy600 = createDropTableClause(pCxt, yymsp[-1].minor.yy841, yymsp[0].minor.yy600); }
+ yymsp[-1].minor.yy600 = yylhsminor.yy600;
break;
case 151: /* specific_cols_opt ::= */
case 182: /* tags_def_opt ::= */ yytestcase(yyruleno==182);
case 252: /* tag_list_opt ::= */ yytestcase(yyruleno==252);
- case 478: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==478);
- case 500: /* group_by_clause_opt ::= */ yytestcase(yyruleno==500);
- case 519: /* order_by_clause_opt ::= */ yytestcase(yyruleno==519);
-{ yymsp[1].minor.yy874 = NULL; }
+ case 480: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==480);
+ case 504: /* group_by_clause_opt ::= */ yytestcase(yyruleno==504);
+ case 523: /* order_by_clause_opt ::= */ yytestcase(yyruleno==523);
+{ yymsp[1].minor.yy601 = NULL; }
break;
case 152: /* specific_cols_opt ::= NK_LP col_name_list NK_RP */
-{ yymsp[-2].minor.yy874 = yymsp[-1].minor.yy874; }
+{ yymsp[-2].minor.yy601 = yymsp[-1].minor.yy601; }
break;
case 153: /* full_table_name ::= table_name */
-{ yylhsminor.yy74 = createRealTableNode(pCxt, NULL, &yymsp[0].minor.yy317, NULL); }
- yymsp[0].minor.yy74 = yylhsminor.yy74;
+{ yylhsminor.yy600 = createRealTableNode(pCxt, NULL, &yymsp[0].minor.yy77, NULL); }
+ yymsp[0].minor.yy600 = yylhsminor.yy600;
break;
case 154: /* full_table_name ::= db_name NK_DOT table_name */
-{ yylhsminor.yy74 = createRealTableNode(pCxt, &yymsp[-2].minor.yy317, &yymsp[0].minor.yy317, NULL); }
- yymsp[-2].minor.yy74 = yylhsminor.yy74;
+{ yylhsminor.yy600 = createRealTableNode(pCxt, &yymsp[-2].minor.yy77, &yymsp[0].minor.yy77, NULL); }
+ yymsp[-2].minor.yy600 = yylhsminor.yy600;
break;
case 157: /* column_def ::= column_name type_name */
-{ yylhsminor.yy74 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy317, yymsp[0].minor.yy898, NULL); }
- yymsp[-1].minor.yy74 = yylhsminor.yy74;
+{ yylhsminor.yy600 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy77, yymsp[0].minor.yy888, NULL); }
+ yymsp[-1].minor.yy600 = yylhsminor.yy600;
break;
case 158: /* column_def ::= column_name type_name COMMENT NK_STRING */
-{ yylhsminor.yy74 = createColumnDefNode(pCxt, &yymsp[-3].minor.yy317, yymsp[-2].minor.yy898, &yymsp[0].minor.yy0); }
- yymsp[-3].minor.yy74 = yylhsminor.yy74;
+{ yylhsminor.yy600 = createColumnDefNode(pCxt, &yymsp[-3].minor.yy77, yymsp[-2].minor.yy888, &yymsp[0].minor.yy0); }
+ yymsp[-3].minor.yy600 = yylhsminor.yy600;
break;
case 159: /* type_name ::= BOOL */
-{ yymsp[0].minor.yy898 = createDataType(TSDB_DATA_TYPE_BOOL); }
+{ yymsp[0].minor.yy888 = createDataType(TSDB_DATA_TYPE_BOOL); }
break;
case 160: /* type_name ::= TINYINT */
-{ yymsp[0].minor.yy898 = createDataType(TSDB_DATA_TYPE_TINYINT); }
+{ yymsp[0].minor.yy888 = createDataType(TSDB_DATA_TYPE_TINYINT); }
break;
case 161: /* type_name ::= SMALLINT */
-{ yymsp[0].minor.yy898 = createDataType(TSDB_DATA_TYPE_SMALLINT); }
+{ yymsp[0].minor.yy888 = createDataType(TSDB_DATA_TYPE_SMALLINT); }
break;
case 162: /* type_name ::= INT */
case 163: /* type_name ::= INTEGER */ yytestcase(yyruleno==163);
-{ yymsp[0].minor.yy898 = createDataType(TSDB_DATA_TYPE_INT); }
+{ yymsp[0].minor.yy888 = createDataType(TSDB_DATA_TYPE_INT); }
break;
case 164: /* type_name ::= BIGINT */
-{ yymsp[0].minor.yy898 = createDataType(TSDB_DATA_TYPE_BIGINT); }
+{ yymsp[0].minor.yy888 = createDataType(TSDB_DATA_TYPE_BIGINT); }
break;
case 165: /* type_name ::= FLOAT */
-{ yymsp[0].minor.yy898 = createDataType(TSDB_DATA_TYPE_FLOAT); }
+{ yymsp[0].minor.yy888 = createDataType(TSDB_DATA_TYPE_FLOAT); }
break;
case 166: /* type_name ::= DOUBLE */
-{ yymsp[0].minor.yy898 = createDataType(TSDB_DATA_TYPE_DOUBLE); }
+{ yymsp[0].minor.yy888 = createDataType(TSDB_DATA_TYPE_DOUBLE); }
break;
case 167: /* type_name ::= BINARY NK_LP NK_INTEGER NK_RP */
-{ yymsp[-3].minor.yy898 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); }
+{ yymsp[-3].minor.yy888 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); }
break;
case 168: /* type_name ::= TIMESTAMP */
-{ yymsp[0].minor.yy898 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); }
+{ yymsp[0].minor.yy888 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); }
break;
case 169: /* type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */
-{ yymsp[-3].minor.yy898 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); }
+{ yymsp[-3].minor.yy888 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); }
break;
case 170: /* type_name ::= TINYINT UNSIGNED */
-{ yymsp[-1].minor.yy898 = createDataType(TSDB_DATA_TYPE_UTINYINT); }
+{ yymsp[-1].minor.yy888 = createDataType(TSDB_DATA_TYPE_UTINYINT); }
break;
case 171: /* type_name ::= SMALLINT UNSIGNED */
-{ yymsp[-1].minor.yy898 = createDataType(TSDB_DATA_TYPE_USMALLINT); }
+{ yymsp[-1].minor.yy888 = createDataType(TSDB_DATA_TYPE_USMALLINT); }
break;
case 172: /* type_name ::= INT UNSIGNED */
-{ yymsp[-1].minor.yy898 = createDataType(TSDB_DATA_TYPE_UINT); }
+{ yymsp[-1].minor.yy888 = createDataType(TSDB_DATA_TYPE_UINT); }
break;
case 173: /* type_name ::= BIGINT UNSIGNED */
-{ yymsp[-1].minor.yy898 = createDataType(TSDB_DATA_TYPE_UBIGINT); }
+{ yymsp[-1].minor.yy888 = createDataType(TSDB_DATA_TYPE_UBIGINT); }
break;
case 174: /* type_name ::= JSON */
-{ yymsp[0].minor.yy898 = createDataType(TSDB_DATA_TYPE_JSON); }
+{ yymsp[0].minor.yy888 = createDataType(TSDB_DATA_TYPE_JSON); }
break;
case 175: /* type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */
-{ yymsp[-3].minor.yy898 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); }
+{ yymsp[-3].minor.yy888 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); }
break;
case 176: /* type_name ::= MEDIUMBLOB */
-{ yymsp[0].minor.yy898 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); }
+{ yymsp[0].minor.yy888 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); }
break;
case 177: /* type_name ::= BLOB */
-{ yymsp[0].minor.yy898 = createDataType(TSDB_DATA_TYPE_BLOB); }
+{ yymsp[0].minor.yy888 = createDataType(TSDB_DATA_TYPE_BLOB); }
break;
case 178: /* type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */
-{ yymsp[-3].minor.yy898 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &yymsp[-1].minor.yy0); }
+{ yymsp[-3].minor.yy888 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &yymsp[-1].minor.yy0); }
break;
case 179: /* type_name ::= DECIMAL */
-{ yymsp[0].minor.yy898 = createDataType(TSDB_DATA_TYPE_DECIMAL); }
+{ yymsp[0].minor.yy888 = createDataType(TSDB_DATA_TYPE_DECIMAL); }
break;
case 180: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */
-{ yymsp[-3].minor.yy898 = createDataType(TSDB_DATA_TYPE_DECIMAL); }
+{ yymsp[-3].minor.yy888 = createDataType(TSDB_DATA_TYPE_DECIMAL); }
break;
case 181: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */
-{ yymsp[-5].minor.yy898 = createDataType(TSDB_DATA_TYPE_DECIMAL); }
+{ yymsp[-5].minor.yy888 = createDataType(TSDB_DATA_TYPE_DECIMAL); }
break;
case 183: /* tags_def_opt ::= tags_def */
- case 407: /* star_func_para_list ::= other_para_list */ yytestcase(yyruleno==407);
-{ yylhsminor.yy874 = yymsp[0].minor.yy874; }
- yymsp[0].minor.yy874 = yylhsminor.yy874;
+ case 409: /* star_func_para_list ::= other_para_list */ yytestcase(yyruleno==409);
+{ yylhsminor.yy601 = yymsp[0].minor.yy601; }
+ yymsp[0].minor.yy601 = yylhsminor.yy601;
break;
case 184: /* tags_def ::= TAGS NK_LP column_def_list NK_RP */
-{ yymsp[-3].minor.yy874 = yymsp[-1].minor.yy874; }
+{ yymsp[-3].minor.yy601 = yymsp[-1].minor.yy601; }
break;
case 185: /* table_options ::= */
-{ yymsp[1].minor.yy74 = createDefaultTableOptions(pCxt); }
+{ yymsp[1].minor.yy600 = createDefaultTableOptions(pCxt); }
break;
case 186: /* table_options ::= table_options COMMENT NK_STRING */
-{ yylhsminor.yy74 = setTableOption(pCxt, yymsp[-2].minor.yy74, TABLE_OPTION_COMMENT, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy74 = yylhsminor.yy74;
+{ yylhsminor.yy600 = setTableOption(pCxt, yymsp[-2].minor.yy600, TABLE_OPTION_COMMENT, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy600 = yylhsminor.yy600;
break;
case 187: /* table_options ::= table_options MAX_DELAY duration_list */
-{ yylhsminor.yy74 = setTableOption(pCxt, yymsp[-2].minor.yy74, TABLE_OPTION_MAXDELAY, yymsp[0].minor.yy874); }
- yymsp[-2].minor.yy74 = yylhsminor.yy74;
+{ yylhsminor.yy600 = setTableOption(pCxt, yymsp[-2].minor.yy600, TABLE_OPTION_MAXDELAY, yymsp[0].minor.yy601); }
+ yymsp[-2].minor.yy600 = yylhsminor.yy600;
break;
case 188: /* table_options ::= table_options WATERMARK duration_list */
-{ yylhsminor.yy74 = setTableOption(pCxt, yymsp[-2].minor.yy74, TABLE_OPTION_WATERMARK, yymsp[0].minor.yy874); }
- yymsp[-2].minor.yy74 = yylhsminor.yy74;
+{ yylhsminor.yy600 = setTableOption(pCxt, yymsp[-2].minor.yy600, TABLE_OPTION_WATERMARK, yymsp[0].minor.yy601); }
+ yymsp[-2].minor.yy600 = yylhsminor.yy600;
break;
case 189: /* table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */
-{ yylhsminor.yy74 = setTableOption(pCxt, yymsp[-4].minor.yy74, TABLE_OPTION_ROLLUP, yymsp[-1].minor.yy874); }
- yymsp[-4].minor.yy74 = yylhsminor.yy74;
+{ yylhsminor.yy600 = setTableOption(pCxt, yymsp[-4].minor.yy600, TABLE_OPTION_ROLLUP, yymsp[-1].minor.yy601); }
+ yymsp[-4].minor.yy600 = yylhsminor.yy600;
break;
case 190: /* table_options ::= table_options TTL NK_INTEGER */
-{ yylhsminor.yy74 = setTableOption(pCxt, yymsp[-2].minor.yy74, TABLE_OPTION_TTL, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy74 = yylhsminor.yy74;
+{ yylhsminor.yy600 = setTableOption(pCxt, yymsp[-2].minor.yy600, TABLE_OPTION_TTL, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy600 = yylhsminor.yy600;
break;
case 191: /* table_options ::= table_options SMA NK_LP col_name_list NK_RP */
-{ yylhsminor.yy74 = setTableOption(pCxt, yymsp[-4].minor.yy74, TABLE_OPTION_SMA, yymsp[-1].minor.yy874); }
- yymsp[-4].minor.yy74 = yylhsminor.yy74;
+{ yylhsminor.yy600 = setTableOption(pCxt, yymsp[-4].minor.yy600, TABLE_OPTION_SMA, yymsp[-1].minor.yy601); }
+ yymsp[-4].minor.yy600 = yylhsminor.yy600;
break;
case 192: /* table_options ::= table_options DELETE_MARK duration_list */
-{ yylhsminor.yy74 = setTableOption(pCxt, yymsp[-2].minor.yy74, TABLE_OPTION_DELETE_MARK, yymsp[0].minor.yy874); }
- yymsp[-2].minor.yy74 = yylhsminor.yy74;
+{ yylhsminor.yy600 = setTableOption(pCxt, yymsp[-2].minor.yy600, TABLE_OPTION_DELETE_MARK, yymsp[0].minor.yy601); }
+ yymsp[-2].minor.yy600 = yylhsminor.yy600;
break;
case 193: /* alter_table_options ::= alter_table_option */
-{ yylhsminor.yy74 = createAlterTableOptions(pCxt); yylhsminor.yy74 = setTableOption(pCxt, yylhsminor.yy74, yymsp[0].minor.yy767.type, &yymsp[0].minor.yy767.val); }
- yymsp[0].minor.yy74 = yylhsminor.yy74;
+{ yylhsminor.yy600 = createAlterTableOptions(pCxt); yylhsminor.yy600 = setTableOption(pCxt, yylhsminor.yy600, yymsp[0].minor.yy661.type, &yymsp[0].minor.yy661.val); }
+ yymsp[0].minor.yy600 = yylhsminor.yy600;
break;
case 194: /* alter_table_options ::= alter_table_options alter_table_option */
-{ yylhsminor.yy74 = setTableOption(pCxt, yymsp[-1].minor.yy74, yymsp[0].minor.yy767.type, &yymsp[0].minor.yy767.val); }
- yymsp[-1].minor.yy74 = yylhsminor.yy74;
+{ yylhsminor.yy600 = setTableOption(pCxt, yymsp[-1].minor.yy600, yymsp[0].minor.yy661.type, &yymsp[0].minor.yy661.val); }
+ yymsp[-1].minor.yy600 = yylhsminor.yy600;
break;
case 195: /* alter_table_option ::= COMMENT NK_STRING */
-{ yymsp[-1].minor.yy767.type = TABLE_OPTION_COMMENT; yymsp[-1].minor.yy767.val = yymsp[0].minor.yy0; }
+{ yymsp[-1].minor.yy661.type = TABLE_OPTION_COMMENT; yymsp[-1].minor.yy661.val = yymsp[0].minor.yy0; }
break;
case 196: /* alter_table_option ::= TTL NK_INTEGER */
-{ yymsp[-1].minor.yy767.type = TABLE_OPTION_TTL; yymsp[-1].minor.yy767.val = yymsp[0].minor.yy0; }
+{ yymsp[-1].minor.yy661.type = TABLE_OPTION_TTL; yymsp[-1].minor.yy661.val = yymsp[0].minor.yy0; }
break;
case 197: /* duration_list ::= duration_literal */
- case 372: /* expression_list ::= expr_or_subquery */ yytestcase(yyruleno==372);
-{ yylhsminor.yy874 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy74)); }
- yymsp[0].minor.yy874 = yylhsminor.yy874;
+ case 374: /* expression_list ::= expr_or_subquery */ yytestcase(yyruleno==374);
+{ yylhsminor.yy601 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy600)); }
+ yymsp[0].minor.yy601 = yylhsminor.yy601;
break;
case 198: /* duration_list ::= duration_list NK_COMMA duration_literal */
- case 373: /* expression_list ::= expression_list NK_COMMA expr_or_subquery */ yytestcase(yyruleno==373);
-{ yylhsminor.yy874 = addNodeToList(pCxt, yymsp[-2].minor.yy874, releaseRawExprNode(pCxt, yymsp[0].minor.yy74)); }
- yymsp[-2].minor.yy874 = yylhsminor.yy874;
+ case 375: /* expression_list ::= expression_list NK_COMMA expr_or_subquery */ yytestcase(yyruleno==375);
+{ yylhsminor.yy601 = addNodeToList(pCxt, yymsp[-2].minor.yy601, releaseRawExprNode(pCxt, yymsp[0].minor.yy600)); }
+ yymsp[-2].minor.yy601 = yylhsminor.yy601;
break;
case 201: /* rollup_func_name ::= function_name */
-{ yylhsminor.yy74 = createFunctionNode(pCxt, &yymsp[0].minor.yy317, NULL); }
- yymsp[0].minor.yy74 = yylhsminor.yy74;
+{ yylhsminor.yy600 = createFunctionNode(pCxt, &yymsp[0].minor.yy77, NULL); }
+ yymsp[0].minor.yy600 = yylhsminor.yy600;
break;
case 202: /* rollup_func_name ::= FIRST */
case 203: /* rollup_func_name ::= LAST */ yytestcase(yyruleno==203);
case 256: /* tag_item ::= QTAGS */ yytestcase(yyruleno==256);
-{ yylhsminor.yy74 = createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL); }
- yymsp[0].minor.yy74 = yylhsminor.yy74;
+{ yylhsminor.yy600 = createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL); }
+ yymsp[0].minor.yy600 = yylhsminor.yy600;
break;
case 206: /* col_name ::= column_name */
case 257: /* tag_item ::= column_name */ yytestcase(yyruleno==257);
-{ yylhsminor.yy74 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy317); }
- yymsp[0].minor.yy74 = yylhsminor.yy74;
+{ yylhsminor.yy600 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy77); }
+ yymsp[0].minor.yy600 = yylhsminor.yy600;
break;
case 207: /* cmd ::= SHOW DNODES */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DNODES_STMT); }
@@ -4339,13 +4353,13 @@ static YYACTIONTYPE yy_reduce(
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DATABASES_STMT); }
break;
case 211: /* cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */
-{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TABLES_STMT, yymsp[-2].minor.yy74, yymsp[0].minor.yy74, OP_TYPE_LIKE); }
+{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TABLES_STMT, yymsp[-2].minor.yy600, yymsp[0].minor.yy600, OP_TYPE_LIKE); }
break;
case 212: /* cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */
-{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_STABLES_STMT, yymsp[-2].minor.yy74, yymsp[0].minor.yy74, OP_TYPE_LIKE); }
+{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_STABLES_STMT, yymsp[-2].minor.yy600, yymsp[0].minor.yy600, OP_TYPE_LIKE); }
break;
case 213: /* cmd ::= SHOW db_name_cond_opt VGROUPS */
-{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VGROUPS_STMT, yymsp[-1].minor.yy74, NULL, OP_TYPE_LIKE); }
+{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VGROUPS_STMT, yymsp[-1].minor.yy600, NULL, OP_TYPE_LIKE); }
break;
case 214: /* cmd ::= SHOW MNODES */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_MNODES_STMT); }
@@ -4357,7 +4371,7 @@ static YYACTIONTYPE yy_reduce(
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_FUNCTIONS_STMT); }
break;
case 217: /* cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */
-{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, yymsp[0].minor.yy74, yymsp[-1].minor.yy74, OP_TYPE_EQUAL); }
+{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, yymsp[0].minor.yy600, yymsp[-1].minor.yy600, OP_TYPE_EQUAL); }
break;
case 218: /* cmd ::= SHOW STREAMS */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_STREAMS_STMT); }
@@ -4376,13 +4390,13 @@ static YYACTIONTYPE yy_reduce(
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_LICENCES_STMT); }
break;
case 224: /* cmd ::= SHOW CREATE DATABASE db_name */
-{ pCxt->pRootNode = createShowCreateDatabaseStmt(pCxt, &yymsp[0].minor.yy317); }
+{ pCxt->pRootNode = createShowCreateDatabaseStmt(pCxt, &yymsp[0].minor.yy77); }
break;
case 225: /* cmd ::= SHOW CREATE TABLE full_table_name */
-{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_TABLE_STMT, yymsp[0].minor.yy74); }
+{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_TABLE_STMT, yymsp[0].minor.yy600); }
break;
case 226: /* cmd ::= SHOW CREATE STABLE full_table_name */
-{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_STABLE_STMT, yymsp[0].minor.yy74); }
+{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_STABLE_STMT, yymsp[0].minor.yy600); }
break;
case 227: /* cmd ::= SHOW QUERIES */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_QUERIES_STMT); }
@@ -4401,7 +4415,7 @@ static YYACTIONTYPE yy_reduce(
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_LOCAL_VARIABLES_STMT); }
break;
case 233: /* cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt */
-{ pCxt->pRootNode = createShowDnodeVariablesStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[-2].minor.yy0), yymsp[0].minor.yy74); }
+{ pCxt->pRootNode = createShowDnodeVariablesStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[-2].minor.yy0), yymsp[0].minor.yy600); }
break;
case 234: /* cmd ::= SHOW BNODES */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_BNODES_STMT); }
@@ -4416,7 +4430,7 @@ static YYACTIONTYPE yy_reduce(
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TRANSACTIONS_STMT); }
break;
case 238: /* cmd ::= SHOW TABLE DISTRIBUTED full_table_name */
-{ pCxt->pRootNode = createShowTableDistributedStmt(pCxt, yymsp[0].minor.yy74); }
+{ pCxt->pRootNode = createShowTableDistributedStmt(pCxt, yymsp[0].minor.yy600); }
break;
case 239: /* cmd ::= SHOW CONSUMERS */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CONSUMERS_STMT); }
@@ -4425,10 +4439,10 @@ static YYACTIONTYPE yy_reduce(
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SUBSCRIPTIONS_STMT); }
break;
case 241: /* cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */
-{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, yymsp[0].minor.yy74, yymsp[-1].minor.yy74, OP_TYPE_EQUAL); }
+{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, yymsp[0].minor.yy600, yymsp[-1].minor.yy600, OP_TYPE_EQUAL); }
break;
case 242: /* cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */
-{ pCxt->pRootNode = createShowTableTagsStmt(pCxt, yymsp[-1].minor.yy74, yymsp[0].minor.yy74, yymsp[-3].minor.yy874); }
+{ pCxt->pRootNode = createShowTableTagsStmt(pCxt, yymsp[-1].minor.yy600, yymsp[0].minor.yy600, yymsp[-3].minor.yy601); }
break;
case 243: /* cmd ::= SHOW VNODES NK_INTEGER */
{ pCxt->pRootNode = createShowVnodesStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0), NULL); }
@@ -4438,741 +4452,752 @@ static YYACTIONTYPE yy_reduce(
break;
case 245: /* db_name_cond_opt ::= */
case 250: /* from_db_opt ::= */ yytestcase(yyruleno==250);
-{ yymsp[1].minor.yy74 = createDefaultDatabaseCondValue(pCxt); }
+{ yymsp[1].minor.yy600 = createDefaultDatabaseCondValue(pCxt); }
break;
case 246: /* db_name_cond_opt ::= db_name NK_DOT */
-{ yylhsminor.yy74 = createIdentifierValueNode(pCxt, &yymsp[-1].minor.yy317); }
- yymsp[-1].minor.yy74 = yylhsminor.yy74;
+{ yylhsminor.yy600 = createIdentifierValueNode(pCxt, &yymsp[-1].minor.yy77); }
+ yymsp[-1].minor.yy600 = yylhsminor.yy600;
break;
case 247: /* like_pattern_opt ::= */
- case 304: /* subtable_opt ::= */ yytestcase(yyruleno==304);
- case 417: /* case_when_else_opt ::= */ yytestcase(yyruleno==417);
- case 447: /* from_clause_opt ::= */ yytestcase(yyruleno==447);
- case 476: /* where_clause_opt ::= */ yytestcase(yyruleno==476);
- case 485: /* twindow_clause_opt ::= */ yytestcase(yyruleno==485);
- case 490: /* sliding_opt ::= */ yytestcase(yyruleno==490);
- case 492: /* fill_opt ::= */ yytestcase(yyruleno==492);
- case 504: /* having_clause_opt ::= */ yytestcase(yyruleno==504);
- case 506: /* range_opt ::= */ yytestcase(yyruleno==506);
- case 508: /* every_opt ::= */ yytestcase(yyruleno==508);
- case 521: /* slimit_clause_opt ::= */ yytestcase(yyruleno==521);
- case 525: /* limit_clause_opt ::= */ yytestcase(yyruleno==525);
-{ yymsp[1].minor.yy74 = NULL; }
+ case 306: /* subtable_opt ::= */ yytestcase(yyruleno==306);
+ case 419: /* case_when_else_opt ::= */ yytestcase(yyruleno==419);
+ case 449: /* from_clause_opt ::= */ yytestcase(yyruleno==449);
+ case 478: /* where_clause_opt ::= */ yytestcase(yyruleno==478);
+ case 487: /* twindow_clause_opt ::= */ yytestcase(yyruleno==487);
+ case 492: /* sliding_opt ::= */ yytestcase(yyruleno==492);
+ case 494: /* fill_opt ::= */ yytestcase(yyruleno==494);
+ case 508: /* having_clause_opt ::= */ yytestcase(yyruleno==508);
+ case 510: /* range_opt ::= */ yytestcase(yyruleno==510);
+ case 512: /* every_opt ::= */ yytestcase(yyruleno==512);
+ case 525: /* slimit_clause_opt ::= */ yytestcase(yyruleno==525);
+ case 529: /* limit_clause_opt ::= */ yytestcase(yyruleno==529);
+{ yymsp[1].minor.yy600 = NULL; }
break;
case 248: /* like_pattern_opt ::= LIKE NK_STRING */
-{ yymsp[-1].minor.yy74 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); }
+{ yymsp[-1].minor.yy600 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); }
break;
case 249: /* table_name_cond ::= table_name */
-{ yylhsminor.yy74 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy317); }
- yymsp[0].minor.yy74 = yylhsminor.yy74;
+{ yylhsminor.yy600 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy77); }
+ yymsp[0].minor.yy600 = yylhsminor.yy600;
break;
case 251: /* from_db_opt ::= FROM db_name */
-{ yymsp[-1].minor.yy74 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy317); }
+{ yymsp[-1].minor.yy600 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy77); }
break;
case 255: /* tag_item ::= TBNAME */
-{ yylhsminor.yy74 = setProjectionAlias(pCxt, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL), &yymsp[0].minor.yy0); }
- yymsp[0].minor.yy74 = yylhsminor.yy74;
+{ yylhsminor.yy600 = setProjectionAlias(pCxt, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL), &yymsp[0].minor.yy0); }
+ yymsp[0].minor.yy600 = yylhsminor.yy600;
break;
case 258: /* tag_item ::= column_name column_alias */
-{ yylhsminor.yy74 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-1].minor.yy317), &yymsp[0].minor.yy317); }
- yymsp[-1].minor.yy74 = yylhsminor.yy74;
+{ yylhsminor.yy600 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-1].minor.yy77), &yymsp[0].minor.yy77); }
+ yymsp[-1].minor.yy600 = yylhsminor.yy600;
break;
case 259: /* tag_item ::= column_name AS column_alias */
-{ yylhsminor.yy74 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-2].minor.yy317), &yymsp[0].minor.yy317); }
- yymsp[-2].minor.yy74 = yylhsminor.yy74;
+{ yylhsminor.yy600 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-2].minor.yy77), &yymsp[0].minor.yy77); }
+ yymsp[-2].minor.yy600 = yylhsminor.yy600;
break;
case 260: /* cmd ::= CREATE SMA INDEX not_exists_opt full_index_name ON full_table_name index_options */
-{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, yymsp[-4].minor.yy335, yymsp[-3].minor.yy74, yymsp[-1].minor.yy74, NULL, yymsp[0].minor.yy74); }
+{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, yymsp[-4].minor.yy841, yymsp[-3].minor.yy600, yymsp[-1].minor.yy600, NULL, yymsp[0].minor.yy600); }
break;
case 261: /* cmd ::= DROP INDEX exists_opt full_index_name */
-{ pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-1].minor.yy335, yymsp[0].minor.yy74); }
+{ pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-1].minor.yy841, yymsp[0].minor.yy600); }
break;
case 262: /* full_index_name ::= index_name */
-{ yylhsminor.yy74 = createRealTableNodeForIndexName(pCxt, NULL, &yymsp[0].minor.yy317); }
- yymsp[0].minor.yy74 = yylhsminor.yy74;
+{ yylhsminor.yy600 = createRealTableNodeForIndexName(pCxt, NULL, &yymsp[0].minor.yy77); }
+ yymsp[0].minor.yy600 = yylhsminor.yy600;
break;
case 263: /* full_index_name ::= db_name NK_DOT index_name */
-{ yylhsminor.yy74 = createRealTableNodeForIndexName(pCxt, &yymsp[-2].minor.yy317, &yymsp[0].minor.yy317); }
- yymsp[-2].minor.yy74 = yylhsminor.yy74;
+{ yylhsminor.yy600 = createRealTableNodeForIndexName(pCxt, &yymsp[-2].minor.yy77, &yymsp[0].minor.yy77); }
+ yymsp[-2].minor.yy600 = yylhsminor.yy600;
break;
case 264: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */
-{ yymsp[-9].minor.yy74 = createIndexOption(pCxt, yymsp[-7].minor.yy874, releaseRawExprNode(pCxt, yymsp[-3].minor.yy74), NULL, yymsp[-1].minor.yy74, yymsp[0].minor.yy74); }
+{ yymsp[-9].minor.yy600 = createIndexOption(pCxt, yymsp[-7].minor.yy601, releaseRawExprNode(pCxt, yymsp[-3].minor.yy600), NULL, yymsp[-1].minor.yy600, yymsp[0].minor.yy600); }
break;
case 265: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt sma_stream_opt */
-{ yymsp[-11].minor.yy74 = createIndexOption(pCxt, yymsp[-9].minor.yy874, releaseRawExprNode(pCxt, yymsp[-5].minor.yy74), releaseRawExprNode(pCxt, yymsp[-3].minor.yy74), yymsp[-1].minor.yy74, yymsp[0].minor.yy74); }
+{ yymsp[-11].minor.yy600 = createIndexOption(pCxt, yymsp[-9].minor.yy601, releaseRawExprNode(pCxt, yymsp[-5].minor.yy600), releaseRawExprNode(pCxt, yymsp[-3].minor.yy600), yymsp[-1].minor.yy600, yymsp[0].minor.yy600); }
break;
case 268: /* func ::= function_name NK_LP expression_list NK_RP */
-{ yylhsminor.yy74 = createFunctionNode(pCxt, &yymsp[-3].minor.yy317, yymsp[-1].minor.yy874); }
- yymsp[-3].minor.yy74 = yylhsminor.yy74;
+{ yylhsminor.yy600 = createFunctionNode(pCxt, &yymsp[-3].minor.yy77, yymsp[-1].minor.yy601); }
+ yymsp[-3].minor.yy600 = yylhsminor.yy600;
break;
case 269: /* sma_stream_opt ::= */
case 297: /* stream_options ::= */ yytestcase(yyruleno==297);
-{ yymsp[1].minor.yy74 = createStreamOptions(pCxt); }
+{ yymsp[1].minor.yy600 = createStreamOptions(pCxt); }
break;
case 270: /* sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */
case 301: /* stream_options ::= stream_options WATERMARK duration_literal */ yytestcase(yyruleno==301);
-{ ((SStreamOptions*)yymsp[-2].minor.yy74)->pWatermark = releaseRawExprNode(pCxt, yymsp[0].minor.yy74); yylhsminor.yy74 = yymsp[-2].minor.yy74; }
- yymsp[-2].minor.yy74 = yylhsminor.yy74;
+{ ((SStreamOptions*)yymsp[-2].minor.yy600)->pWatermark = releaseRawExprNode(pCxt, yymsp[0].minor.yy600); yylhsminor.yy600 = yymsp[-2].minor.yy600; }
+ yymsp[-2].minor.yy600 = yylhsminor.yy600;
break;
case 271: /* sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */
-{ ((SStreamOptions*)yymsp[-2].minor.yy74)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy74); yylhsminor.yy74 = yymsp[-2].minor.yy74; }
- yymsp[-2].minor.yy74 = yylhsminor.yy74;
+{ ((SStreamOptions*)yymsp[-2].minor.yy600)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy600); yylhsminor.yy600 = yymsp[-2].minor.yy600; }
+ yymsp[-2].minor.yy600 = yylhsminor.yy600;
break;
case 272: /* sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */
-{ ((SStreamOptions*)yymsp[-2].minor.yy74)->pDeleteMark = releaseRawExprNode(pCxt, yymsp[0].minor.yy74); yylhsminor.yy74 = yymsp[-2].minor.yy74; }
- yymsp[-2].minor.yy74 = yylhsminor.yy74;
+ case 304: /* stream_options ::= stream_options DELETE_MARK duration_literal */ yytestcase(yyruleno==304);
+{ ((SStreamOptions*)yymsp[-2].minor.yy600)->pDeleteMark = releaseRawExprNode(pCxt, yymsp[0].minor.yy600); yylhsminor.yy600 = yymsp[-2].minor.yy600; }
+ yymsp[-2].minor.yy600 = yylhsminor.yy600;
break;
case 273: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */
-{ pCxt->pRootNode = createCreateTopicStmtUseQuery(pCxt, yymsp[-3].minor.yy335, &yymsp[-2].minor.yy317, yymsp[0].minor.yy74); }
+{ pCxt->pRootNode = createCreateTopicStmtUseQuery(pCxt, yymsp[-3].minor.yy841, &yymsp[-2].minor.yy77, yymsp[0].minor.yy600); }
break;
case 274: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name */
-{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-4].minor.yy335, &yymsp[-3].minor.yy317, &yymsp[0].minor.yy317, false); }
+{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-4].minor.yy841, &yymsp[-3].minor.yy77, &yymsp[0].minor.yy77, false); }
break;
case 275: /* cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name */
-{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-6].minor.yy335, &yymsp[-5].minor.yy317, &yymsp[0].minor.yy317, true); }
+{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-6].minor.yy841, &yymsp[-5].minor.yy77, &yymsp[0].minor.yy77, true); }
break;
case 276: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name */
-{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-4].minor.yy335, &yymsp[-3].minor.yy317, yymsp[0].minor.yy74, false); }
+{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-4].minor.yy841, &yymsp[-3].minor.yy77, yymsp[0].minor.yy600, false); }
break;
case 277: /* cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name */
-{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-6].minor.yy335, &yymsp[-5].minor.yy317, yymsp[0].minor.yy74, true); }
+{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-6].minor.yy841, &yymsp[-5].minor.yy77, yymsp[0].minor.yy600, true); }
break;
case 278: /* cmd ::= DROP TOPIC exists_opt topic_name */
-{ pCxt->pRootNode = createDropTopicStmt(pCxt, yymsp[-1].minor.yy335, &yymsp[0].minor.yy317); }
+{ pCxt->pRootNode = createDropTopicStmt(pCxt, yymsp[-1].minor.yy841, &yymsp[0].minor.yy77); }
break;
case 279: /* cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */
-{ pCxt->pRootNode = createDropCGroupStmt(pCxt, yymsp[-3].minor.yy335, &yymsp[-2].minor.yy317, &yymsp[0].minor.yy317); }
+{ pCxt->pRootNode = createDropCGroupStmt(pCxt, yymsp[-3].minor.yy841, &yymsp[-2].minor.yy77, &yymsp[0].minor.yy77); }
break;
case 280: /* cmd ::= DESC full_table_name */
case 281: /* cmd ::= DESCRIBE full_table_name */ yytestcase(yyruleno==281);
-{ pCxt->pRootNode = createDescribeStmt(pCxt, yymsp[0].minor.yy74); }
+{ pCxt->pRootNode = createDescribeStmt(pCxt, yymsp[0].minor.yy600); }
break;
case 282: /* cmd ::= RESET QUERY CACHE */
{ pCxt->pRootNode = createResetQueryCacheStmt(pCxt); }
break;
case 283: /* cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */
-{ pCxt->pRootNode = createExplainStmt(pCxt, yymsp[-2].minor.yy335, yymsp[-1].minor.yy74, yymsp[0].minor.yy74); }
+{ pCxt->pRootNode = createExplainStmt(pCxt, yymsp[-2].minor.yy841, yymsp[-1].minor.yy600, yymsp[0].minor.yy600); }
break;
case 286: /* explain_options ::= */
-{ yymsp[1].minor.yy74 = createDefaultExplainOptions(pCxt); }
+{ yymsp[1].minor.yy600 = createDefaultExplainOptions(pCxt); }
break;
case 287: /* explain_options ::= explain_options VERBOSE NK_BOOL */
-{ yylhsminor.yy74 = setExplainVerbose(pCxt, yymsp[-2].minor.yy74, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy74 = yylhsminor.yy74;
+{ yylhsminor.yy600 = setExplainVerbose(pCxt, yymsp[-2].minor.yy600, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy600 = yylhsminor.yy600;
break;
case 288: /* explain_options ::= explain_options RATIO NK_FLOAT */
-{ yylhsminor.yy74 = setExplainRatio(pCxt, yymsp[-2].minor.yy74, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy74 = yylhsminor.yy74;
+{ yylhsminor.yy600 = setExplainRatio(pCxt, yymsp[-2].minor.yy600, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy600 = yylhsminor.yy600;
break;
case 289: /* cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt */
-{ pCxt->pRootNode = createCreateFunctionStmt(pCxt, yymsp[-6].minor.yy335, yymsp[-8].minor.yy335, &yymsp[-5].minor.yy317, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy898, yymsp[0].minor.yy856); }
+{ pCxt->pRootNode = createCreateFunctionStmt(pCxt, yymsp[-6].minor.yy841, yymsp[-8].minor.yy841, &yymsp[-5].minor.yy77, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy888, yymsp[0].minor.yy248); }
break;
case 290: /* cmd ::= DROP FUNCTION exists_opt function_name */
-{ pCxt->pRootNode = createDropFunctionStmt(pCxt, yymsp[-1].minor.yy335, &yymsp[0].minor.yy317); }
+{ pCxt->pRootNode = createDropFunctionStmt(pCxt, yymsp[-1].minor.yy841, &yymsp[0].minor.yy77); }
break;
case 295: /* cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name tags_def_opt subtable_opt AS query_or_subquery */
-{ pCxt->pRootNode = createCreateStreamStmt(pCxt, yymsp[-8].minor.yy335, &yymsp[-7].minor.yy317, yymsp[-4].minor.yy74, yymsp[-6].minor.yy74, yymsp[-3].minor.yy874, yymsp[-2].minor.yy74, yymsp[0].minor.yy74); }
+{ pCxt->pRootNode = createCreateStreamStmt(pCxt, yymsp[-8].minor.yy841, &yymsp[-7].minor.yy77, yymsp[-4].minor.yy600, yymsp[-6].minor.yy600, yymsp[-3].minor.yy601, yymsp[-2].minor.yy600, yymsp[0].minor.yy600); }
break;
case 296: /* cmd ::= DROP STREAM exists_opt stream_name */
-{ pCxt->pRootNode = createDropStreamStmt(pCxt, yymsp[-1].minor.yy335, &yymsp[0].minor.yy317); }
+{ pCxt->pRootNode = createDropStreamStmt(pCxt, yymsp[-1].minor.yy841, &yymsp[0].minor.yy77); }
break;
case 298: /* stream_options ::= stream_options TRIGGER AT_ONCE */
-{ ((SStreamOptions*)yymsp[-2].minor.yy74)->triggerType = STREAM_TRIGGER_AT_ONCE; yylhsminor.yy74 = yymsp[-2].minor.yy74; }
- yymsp[-2].minor.yy74 = yylhsminor.yy74;
+{ ((SStreamOptions*)yymsp[-2].minor.yy600)->triggerType = STREAM_TRIGGER_AT_ONCE; yylhsminor.yy600 = yymsp[-2].minor.yy600; }
+ yymsp[-2].minor.yy600 = yylhsminor.yy600;
break;
case 299: /* stream_options ::= stream_options TRIGGER WINDOW_CLOSE */
-{ ((SStreamOptions*)yymsp[-2].minor.yy74)->triggerType = STREAM_TRIGGER_WINDOW_CLOSE; yylhsminor.yy74 = yymsp[-2].minor.yy74; }
- yymsp[-2].minor.yy74 = yylhsminor.yy74;
+{ ((SStreamOptions*)yymsp[-2].minor.yy600)->triggerType = STREAM_TRIGGER_WINDOW_CLOSE; yylhsminor.yy600 = yymsp[-2].minor.yy600; }
+ yymsp[-2].minor.yy600 = yylhsminor.yy600;
break;
case 300: /* stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */
-{ ((SStreamOptions*)yymsp[-3].minor.yy74)->triggerType = STREAM_TRIGGER_MAX_DELAY; ((SStreamOptions*)yymsp[-3].minor.yy74)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy74); yylhsminor.yy74 = yymsp[-3].minor.yy74; }
- yymsp[-3].minor.yy74 = yylhsminor.yy74;
+{ ((SStreamOptions*)yymsp[-3].minor.yy600)->triggerType = STREAM_TRIGGER_MAX_DELAY; ((SStreamOptions*)yymsp[-3].minor.yy600)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy600); yylhsminor.yy600 = yymsp[-3].minor.yy600; }
+ yymsp[-3].minor.yy600 = yylhsminor.yy600;
break;
case 302: /* stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */
-{ ((SStreamOptions*)yymsp[-3].minor.yy74)->ignoreExpired = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); yylhsminor.yy74 = yymsp[-3].minor.yy74; }
- yymsp[-3].minor.yy74 = yylhsminor.yy74;
+{ ((SStreamOptions*)yymsp[-3].minor.yy600)->ignoreExpired = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); yylhsminor.yy600 = yymsp[-3].minor.yy600; }
+ yymsp[-3].minor.yy600 = yylhsminor.yy600;
break;
case 303: /* stream_options ::= stream_options FILL_HISTORY NK_INTEGER */
-{ ((SStreamOptions*)yymsp[-2].minor.yy74)->fillHistory = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); yylhsminor.yy74 = yymsp[-2].minor.yy74; }
- yymsp[-2].minor.yy74 = yylhsminor.yy74;
+{ ((SStreamOptions*)yymsp[-2].minor.yy600)->fillHistory = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); yylhsminor.yy600 = yymsp[-2].minor.yy600; }
+ yymsp[-2].minor.yy600 = yylhsminor.yy600;
+ break;
+ case 305: /* stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */
+{ ((SStreamOptions*)yymsp[-3].minor.yy600)->ignoreUpdate = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); yylhsminor.yy600 = yymsp[-3].minor.yy600; }
+ yymsp[-3].minor.yy600 = yylhsminor.yy600;
break;
- case 305: /* subtable_opt ::= SUBTABLE NK_LP expression NK_RP */
- case 491: /* sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ yytestcase(yyruleno==491);
- case 509: /* every_opt ::= EVERY NK_LP duration_literal NK_RP */ yytestcase(yyruleno==509);
-{ yymsp[-3].minor.yy74 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy74); }
+ case 307: /* subtable_opt ::= SUBTABLE NK_LP expression NK_RP */
+ case 493: /* sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ yytestcase(yyruleno==493);
+ case 513: /* every_opt ::= EVERY NK_LP duration_literal NK_RP */ yytestcase(yyruleno==513);
+{ yymsp[-3].minor.yy600 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy600); }
break;
- case 306: /* cmd ::= KILL CONNECTION NK_INTEGER */
+ case 308: /* cmd ::= KILL CONNECTION NK_INTEGER */
{ pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_CONNECTION_STMT, &yymsp[0].minor.yy0); }
break;
- case 307: /* cmd ::= KILL QUERY NK_STRING */
+ case 309: /* cmd ::= KILL QUERY NK_STRING */
{ pCxt->pRootNode = createKillQueryStmt(pCxt, &yymsp[0].minor.yy0); }
break;
- case 308: /* cmd ::= KILL TRANSACTION NK_INTEGER */
+ case 310: /* cmd ::= KILL TRANSACTION NK_INTEGER */
{ pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_TRANSACTION_STMT, &yymsp[0].minor.yy0); }
break;
- case 309: /* cmd ::= BALANCE VGROUP */
+ case 311: /* cmd ::= BALANCE VGROUP */
{ pCxt->pRootNode = createBalanceVgroupStmt(pCxt); }
break;
- case 310: /* cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */
+ case 312: /* cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */
{ pCxt->pRootNode = createMergeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); }
break;
- case 311: /* cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */
-{ pCxt->pRootNode = createRedistributeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy874); }
+ case 313: /* cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */
+{ pCxt->pRootNode = createRedistributeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy601); }
break;
- case 312: /* cmd ::= SPLIT VGROUP NK_INTEGER */
+ case 314: /* cmd ::= SPLIT VGROUP NK_INTEGER */
{ pCxt->pRootNode = createSplitVgroupStmt(pCxt, &yymsp[0].minor.yy0); }
break;
- case 313: /* dnode_list ::= DNODE NK_INTEGER */
-{ yymsp[-1].minor.yy874 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); }
- break;
- case 315: /* cmd ::= DELETE FROM full_table_name where_clause_opt */
-{ pCxt->pRootNode = createDeleteStmt(pCxt, yymsp[-1].minor.yy74, yymsp[0].minor.yy74); }
- break;
- case 317: /* cmd ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */
-{ pCxt->pRootNode = createInsertStmt(pCxt, yymsp[-4].minor.yy74, yymsp[-2].minor.yy874, yymsp[0].minor.yy74); }
- break;
- case 318: /* cmd ::= INSERT INTO full_table_name query_or_subquery */
-{ pCxt->pRootNode = createInsertStmt(pCxt, yymsp[-1].minor.yy74, NULL, yymsp[0].minor.yy74); }
- break;
- case 319: /* literal ::= NK_INTEGER */
-{ yylhsminor.yy74 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0)); }
- yymsp[0].minor.yy74 = yylhsminor.yy74;
- break;
- case 320: /* literal ::= NK_FLOAT */
-{ yylhsminor.yy74 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); }
- yymsp[0].minor.yy74 = yylhsminor.yy74;
- break;
- case 321: /* literal ::= NK_STRING */
-{ yylhsminor.yy74 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); }
- yymsp[0].minor.yy74 = yylhsminor.yy74;
- break;
- case 322: /* literal ::= NK_BOOL */
-{ yylhsminor.yy74 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); }
- yymsp[0].minor.yy74 = yylhsminor.yy74;
- break;
- case 323: /* literal ::= TIMESTAMP NK_STRING */
-{ yylhsminor.yy74 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); }
- yymsp[-1].minor.yy74 = yylhsminor.yy74;
- break;
- case 324: /* literal ::= duration_literal */
- case 334: /* signed_literal ::= signed */ yytestcase(yyruleno==334);
- case 355: /* expr_or_subquery ::= expression */ yytestcase(yyruleno==355);
- case 356: /* expression ::= literal */ yytestcase(yyruleno==356);
- case 357: /* expression ::= pseudo_column */ yytestcase(yyruleno==357);
- case 358: /* expression ::= column_reference */ yytestcase(yyruleno==358);
- case 359: /* expression ::= function_expression */ yytestcase(yyruleno==359);
- case 360: /* expression ::= case_when_expression */ yytestcase(yyruleno==360);
- case 390: /* function_expression ::= literal_func */ yytestcase(yyruleno==390);
- case 439: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==439);
- case 443: /* boolean_primary ::= predicate */ yytestcase(yyruleno==443);
- case 445: /* common_expression ::= expr_or_subquery */ yytestcase(yyruleno==445);
- case 446: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==446);
- case 449: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==449);
- case 451: /* table_reference ::= table_primary */ yytestcase(yyruleno==451);
- case 452: /* table_reference ::= joined_table */ yytestcase(yyruleno==452);
- case 456: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==456);
- case 511: /* query_simple ::= query_specification */ yytestcase(yyruleno==511);
- case 512: /* query_simple ::= union_query_expression */ yytestcase(yyruleno==512);
- case 515: /* query_simple_or_subquery ::= query_simple */ yytestcase(yyruleno==515);
- case 517: /* query_or_subquery ::= query_expression */ yytestcase(yyruleno==517);
-{ yylhsminor.yy74 = yymsp[0].minor.yy74; }
- yymsp[0].minor.yy74 = yylhsminor.yy74;
- break;
- case 325: /* literal ::= NULL */
-{ yylhsminor.yy74 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0)); }
- yymsp[0].minor.yy74 = yylhsminor.yy74;
- break;
- case 326: /* literal ::= NK_QUESTION */
-{ yylhsminor.yy74 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0)); }
- yymsp[0].minor.yy74 = yylhsminor.yy74;
- break;
- case 327: /* duration_literal ::= NK_VARIABLE */
-{ yylhsminor.yy74 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); }
- yymsp[0].minor.yy74 = yylhsminor.yy74;
- break;
- case 328: /* signed ::= NK_INTEGER */
-{ yylhsminor.yy74 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); }
- yymsp[0].minor.yy74 = yylhsminor.yy74;
- break;
- case 329: /* signed ::= NK_PLUS NK_INTEGER */
-{ yymsp[-1].minor.yy74 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); }
- break;
- case 330: /* signed ::= NK_MINUS NK_INTEGER */
+ case 315: /* dnode_list ::= DNODE NK_INTEGER */
+{ yymsp[-1].minor.yy601 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); }
+ break;
+ case 317: /* cmd ::= DELETE FROM full_table_name where_clause_opt */
+{ pCxt->pRootNode = createDeleteStmt(pCxt, yymsp[-1].minor.yy600, yymsp[0].minor.yy600); }
+ break;
+ case 319: /* cmd ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */
+{ pCxt->pRootNode = createInsertStmt(pCxt, yymsp[-4].minor.yy600, yymsp[-2].minor.yy601, yymsp[0].minor.yy600); }
+ break;
+ case 320: /* cmd ::= INSERT INTO full_table_name query_or_subquery */
+{ pCxt->pRootNode = createInsertStmt(pCxt, yymsp[-1].minor.yy600, NULL, yymsp[0].minor.yy600); }
+ break;
+ case 321: /* literal ::= NK_INTEGER */
+{ yylhsminor.yy600 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy600 = yylhsminor.yy600;
+ break;
+ case 322: /* literal ::= NK_FLOAT */
+{ yylhsminor.yy600 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy600 = yylhsminor.yy600;
+ break;
+ case 323: /* literal ::= NK_STRING */
+{ yylhsminor.yy600 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy600 = yylhsminor.yy600;
+ break;
+ case 324: /* literal ::= NK_BOOL */
+{ yylhsminor.yy600 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy600 = yylhsminor.yy600;
+ break;
+ case 325: /* literal ::= TIMESTAMP NK_STRING */
+{ yylhsminor.yy600 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); }
+ yymsp[-1].minor.yy600 = yylhsminor.yy600;
+ break;
+ case 326: /* literal ::= duration_literal */
+ case 336: /* signed_literal ::= signed */ yytestcase(yyruleno==336);
+ case 357: /* expr_or_subquery ::= expression */ yytestcase(yyruleno==357);
+ case 358: /* expression ::= literal */ yytestcase(yyruleno==358);
+ case 359: /* expression ::= pseudo_column */ yytestcase(yyruleno==359);
+ case 360: /* expression ::= column_reference */ yytestcase(yyruleno==360);
+ case 361: /* expression ::= function_expression */ yytestcase(yyruleno==361);
+ case 362: /* expression ::= case_when_expression */ yytestcase(yyruleno==362);
+ case 392: /* function_expression ::= literal_func */ yytestcase(yyruleno==392);
+ case 441: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==441);
+ case 445: /* boolean_primary ::= predicate */ yytestcase(yyruleno==445);
+ case 447: /* common_expression ::= expr_or_subquery */ yytestcase(yyruleno==447);
+ case 448: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==448);
+ case 451: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==451);
+ case 453: /* table_reference ::= table_primary */ yytestcase(yyruleno==453);
+ case 454: /* table_reference ::= joined_table */ yytestcase(yyruleno==454);
+ case 458: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==458);
+ case 515: /* query_simple ::= query_specification */ yytestcase(yyruleno==515);
+ case 516: /* query_simple ::= union_query_expression */ yytestcase(yyruleno==516);
+ case 519: /* query_simple_or_subquery ::= query_simple */ yytestcase(yyruleno==519);
+ case 521: /* query_or_subquery ::= query_expression */ yytestcase(yyruleno==521);
+{ yylhsminor.yy600 = yymsp[0].minor.yy600; }
+ yymsp[0].minor.yy600 = yylhsminor.yy600;
+ break;
+ case 327: /* literal ::= NULL */
+{ yylhsminor.yy600 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy600 = yylhsminor.yy600;
+ break;
+ case 328: /* literal ::= NK_QUESTION */
+{ yylhsminor.yy600 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy600 = yylhsminor.yy600;
+ break;
+ case 329: /* duration_literal ::= NK_VARIABLE */
+{ yylhsminor.yy600 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy600 = yylhsminor.yy600;
+ break;
+ case 330: /* signed ::= NK_INTEGER */
+{ yylhsminor.yy600 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); }
+ yymsp[0].minor.yy600 = yylhsminor.yy600;
+ break;
+ case 331: /* signed ::= NK_PLUS NK_INTEGER */
+{ yymsp[-1].minor.yy600 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); }
+ break;
+ case 332: /* signed ::= NK_MINUS NK_INTEGER */
{
SToken t = yymsp[-1].minor.yy0;
t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z;
- yylhsminor.yy74 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &t);
+ yylhsminor.yy600 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &t);
}
- yymsp[-1].minor.yy74 = yylhsminor.yy74;
+ yymsp[-1].minor.yy600 = yylhsminor.yy600;
break;
- case 331: /* signed ::= NK_FLOAT */
-{ yylhsminor.yy74 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); }
- yymsp[0].minor.yy74 = yylhsminor.yy74;
+ case 333: /* signed ::= NK_FLOAT */
+{ yylhsminor.yy600 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); }
+ yymsp[0].minor.yy600 = yylhsminor.yy600;
break;
- case 332: /* signed ::= NK_PLUS NK_FLOAT */
-{ yymsp[-1].minor.yy74 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); }
+ case 334: /* signed ::= NK_PLUS NK_FLOAT */
+{ yymsp[-1].minor.yy600 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); }
break;
- case 333: /* signed ::= NK_MINUS NK_FLOAT */
+ case 335: /* signed ::= NK_MINUS NK_FLOAT */
{
SToken t = yymsp[-1].minor.yy0;
t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z;
- yylhsminor.yy74 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t);
+ yylhsminor.yy600 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t);
}
- yymsp[-1].minor.yy74 = yylhsminor.yy74;
- break;
- case 335: /* signed_literal ::= NK_STRING */
-{ yylhsminor.yy74 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); }
- yymsp[0].minor.yy74 = yylhsminor.yy74;
- break;
- case 336: /* signed_literal ::= NK_BOOL */
-{ yylhsminor.yy74 = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0); }
- yymsp[0].minor.yy74 = yylhsminor.yy74;
- break;
- case 337: /* signed_literal ::= TIMESTAMP NK_STRING */
-{ yymsp[-1].minor.yy74 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); }
- break;
- case 338: /* signed_literal ::= duration_literal */
- case 340: /* signed_literal ::= literal_func */ yytestcase(yyruleno==340);
- case 410: /* star_func_para ::= expr_or_subquery */ yytestcase(yyruleno==410);
- case 472: /* select_item ::= common_expression */ yytestcase(yyruleno==472);
- case 482: /* partition_item ::= expr_or_subquery */ yytestcase(yyruleno==482);
- case 516: /* query_simple_or_subquery ::= subquery */ yytestcase(yyruleno==516);
- case 518: /* query_or_subquery ::= subquery */ yytestcase(yyruleno==518);
- case 531: /* search_condition ::= common_expression */ yytestcase(yyruleno==531);
-{ yylhsminor.yy74 = releaseRawExprNode(pCxt, yymsp[0].minor.yy74); }
- yymsp[0].minor.yy74 = yylhsminor.yy74;
- break;
- case 339: /* signed_literal ::= NULL */
-{ yylhsminor.yy74 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0); }
- yymsp[0].minor.yy74 = yylhsminor.yy74;
- break;
- case 341: /* signed_literal ::= NK_QUESTION */
-{ yylhsminor.yy74 = createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0); }
- yymsp[0].minor.yy74 = yylhsminor.yy74;
- break;
- case 361: /* expression ::= NK_LP expression NK_RP */
- case 444: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==444);
- case 530: /* subquery ::= NK_LP subquery NK_RP */ yytestcase(yyruleno==530);
-{ yylhsminor.yy74 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy74)); }
- yymsp[-2].minor.yy74 = yylhsminor.yy74;
- break;
- case 362: /* expression ::= NK_PLUS expr_or_subquery */
+ yymsp[-1].minor.yy600 = yylhsminor.yy600;
+ break;
+ case 337: /* signed_literal ::= NK_STRING */
+{ yylhsminor.yy600 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); }
+ yymsp[0].minor.yy600 = yylhsminor.yy600;
+ break;
+ case 338: /* signed_literal ::= NK_BOOL */
+{ yylhsminor.yy600 = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0); }
+ yymsp[0].minor.yy600 = yylhsminor.yy600;
+ break;
+ case 339: /* signed_literal ::= TIMESTAMP NK_STRING */
+{ yymsp[-1].minor.yy600 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); }
+ break;
+ case 340: /* signed_literal ::= duration_literal */
+ case 342: /* signed_literal ::= literal_func */ yytestcase(yyruleno==342);
+ case 412: /* star_func_para ::= expr_or_subquery */ yytestcase(yyruleno==412);
+ case 474: /* select_item ::= common_expression */ yytestcase(yyruleno==474);
+ case 484: /* partition_item ::= expr_or_subquery */ yytestcase(yyruleno==484);
+ case 520: /* query_simple_or_subquery ::= subquery */ yytestcase(yyruleno==520);
+ case 522: /* query_or_subquery ::= subquery */ yytestcase(yyruleno==522);
+ case 535: /* search_condition ::= common_expression */ yytestcase(yyruleno==535);
+{ yylhsminor.yy600 = releaseRawExprNode(pCxt, yymsp[0].minor.yy600); }
+ yymsp[0].minor.yy600 = yylhsminor.yy600;
+ break;
+ case 341: /* signed_literal ::= NULL */
+{ yylhsminor.yy600 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0); }
+ yymsp[0].minor.yy600 = yylhsminor.yy600;
+ break;
+ case 343: /* signed_literal ::= NK_QUESTION */
+{ yylhsminor.yy600 = createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0); }
+ yymsp[0].minor.yy600 = yylhsminor.yy600;
+ break;
+ case 363: /* expression ::= NK_LP expression NK_RP */
+ case 446: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==446);
+ case 534: /* subquery ::= NK_LP subquery NK_RP */ yytestcase(yyruleno==534);
+{ yylhsminor.yy600 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy600)); }
+ yymsp[-2].minor.yy600 = yylhsminor.yy600;
+ break;
+ case 364: /* expression ::= NK_PLUS expr_or_subquery */
{
- SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy74);
- yylhsminor.yy74 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy74));
+ SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy600);
+ yylhsminor.yy600 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy600));
}
- yymsp[-1].minor.yy74 = yylhsminor.yy74;
+ yymsp[-1].minor.yy600 = yylhsminor.yy600;
break;
- case 363: /* expression ::= NK_MINUS expr_or_subquery */
+ case 365: /* expression ::= NK_MINUS expr_or_subquery */
{
- SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy74);
- yylhsminor.yy74 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_MINUS, releaseRawExprNode(pCxt, yymsp[0].minor.yy74), NULL));
+ SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy600);
+ yylhsminor.yy600 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_MINUS, releaseRawExprNode(pCxt, yymsp[0].minor.yy600), NULL));
}
- yymsp[-1].minor.yy74 = yylhsminor.yy74;
+ yymsp[-1].minor.yy600 = yylhsminor.yy600;
break;
- case 364: /* expression ::= expr_or_subquery NK_PLUS expr_or_subquery */
+ case 366: /* expression ::= expr_or_subquery NK_PLUS expr_or_subquery */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy74);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy74);
- yylhsminor.yy74 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_ADD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy74), releaseRawExprNode(pCxt, yymsp[0].minor.yy74)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy600);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy600);
+ yylhsminor.yy600 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_ADD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy600), releaseRawExprNode(pCxt, yymsp[0].minor.yy600)));
}
- yymsp[-2].minor.yy74 = yylhsminor.yy74;
+ yymsp[-2].minor.yy600 = yylhsminor.yy600;
break;
- case 365: /* expression ::= expr_or_subquery NK_MINUS expr_or_subquery */
+ case 367: /* expression ::= expr_or_subquery NK_MINUS expr_or_subquery */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy74);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy74);
- yylhsminor.yy74 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[-2].minor.yy74), releaseRawExprNode(pCxt, yymsp[0].minor.yy74)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy600);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy600);
+ yylhsminor.yy600 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[-2].minor.yy600), releaseRawExprNode(pCxt, yymsp[0].minor.yy600)));
}
- yymsp[-2].minor.yy74 = yylhsminor.yy74;
+ yymsp[-2].minor.yy600 = yylhsminor.yy600;
break;
- case 366: /* expression ::= expr_or_subquery NK_STAR expr_or_subquery */
+ case 368: /* expression ::= expr_or_subquery NK_STAR expr_or_subquery */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy74);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy74);
- yylhsminor.yy74 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MULTI, releaseRawExprNode(pCxt, yymsp[-2].minor.yy74), releaseRawExprNode(pCxt, yymsp[0].minor.yy74)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy600);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy600);
+ yylhsminor.yy600 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MULTI, releaseRawExprNode(pCxt, yymsp[-2].minor.yy600), releaseRawExprNode(pCxt, yymsp[0].minor.yy600)));
}
- yymsp[-2].minor.yy74 = yylhsminor.yy74;
+ yymsp[-2].minor.yy600 = yylhsminor.yy600;
break;
- case 367: /* expression ::= expr_or_subquery NK_SLASH expr_or_subquery */
+ case 369: /* expression ::= expr_or_subquery NK_SLASH expr_or_subquery */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy74);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy74);
- yylhsminor.yy74 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_DIV, releaseRawExprNode(pCxt, yymsp[-2].minor.yy74), releaseRawExprNode(pCxt, yymsp[0].minor.yy74)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy600);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy600);
+ yylhsminor.yy600 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_DIV, releaseRawExprNode(pCxt, yymsp[-2].minor.yy600), releaseRawExprNode(pCxt, yymsp[0].minor.yy600)));
}
- yymsp[-2].minor.yy74 = yylhsminor.yy74;
+ yymsp[-2].minor.yy600 = yylhsminor.yy600;
break;
- case 368: /* expression ::= expr_or_subquery NK_REM expr_or_subquery */
+ case 370: /* expression ::= expr_or_subquery NK_REM expr_or_subquery */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy74);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy74);
- yylhsminor.yy74 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_REM, releaseRawExprNode(pCxt, yymsp[-2].minor.yy74), releaseRawExprNode(pCxt, yymsp[0].minor.yy74)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy600);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy600);
+ yylhsminor.yy600 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_REM, releaseRawExprNode(pCxt, yymsp[-2].minor.yy600), releaseRawExprNode(pCxt, yymsp[0].minor.yy600)));
}
- yymsp[-2].minor.yy74 = yylhsminor.yy74;
+ yymsp[-2].minor.yy600 = yylhsminor.yy600;
break;
- case 369: /* expression ::= column_reference NK_ARROW NK_STRING */
+ case 371: /* expression ::= column_reference NK_ARROW NK_STRING */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy74);
- yylhsminor.yy74 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_JSON_GET_VALUE, releaseRawExprNode(pCxt, yymsp[-2].minor.yy74), createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy600);
+ yylhsminor.yy600 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_JSON_GET_VALUE, releaseRawExprNode(pCxt, yymsp[-2].minor.yy600), createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)));
}
- yymsp[-2].minor.yy74 = yylhsminor.yy74;
+ yymsp[-2].minor.yy600 = yylhsminor.yy600;
break;
- case 370: /* expression ::= expr_or_subquery NK_BITAND expr_or_subquery */
+ case 372: /* expression ::= expr_or_subquery NK_BITAND expr_or_subquery */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy74);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy74);
- yylhsminor.yy74 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy74), releaseRawExprNode(pCxt, yymsp[0].minor.yy74)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy600);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy600);
+ yylhsminor.yy600 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy600), releaseRawExprNode(pCxt, yymsp[0].minor.yy600)));
}
- yymsp[-2].minor.yy74 = yylhsminor.yy74;
+ yymsp[-2].minor.yy600 = yylhsminor.yy600;
break;
- case 371: /* expression ::= expr_or_subquery NK_BITOR expr_or_subquery */
+ case 373: /* expression ::= expr_or_subquery NK_BITOR expr_or_subquery */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy74);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy74);
- yylhsminor.yy74 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy74), releaseRawExprNode(pCxt, yymsp[0].minor.yy74)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy600);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy600);
+ yylhsminor.yy600 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy600), releaseRawExprNode(pCxt, yymsp[0].minor.yy600)));
}
- yymsp[-2].minor.yy74 = yylhsminor.yy74;
- break;
- case 374: /* column_reference ::= column_name */
-{ yylhsminor.yy74 = createRawExprNode(pCxt, &yymsp[0].minor.yy317, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy317)); }
- yymsp[0].minor.yy74 = yylhsminor.yy74;
- break;
- case 375: /* column_reference ::= table_name NK_DOT column_name */
-{ yylhsminor.yy74 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy317, &yymsp[0].minor.yy317, createColumnNode(pCxt, &yymsp[-2].minor.yy317, &yymsp[0].minor.yy317)); }
- yymsp[-2].minor.yy74 = yylhsminor.yy74;
- break;
- case 376: /* pseudo_column ::= ROWTS */
- case 377: /* pseudo_column ::= TBNAME */ yytestcase(yyruleno==377);
- case 379: /* pseudo_column ::= QSTART */ yytestcase(yyruleno==379);
- case 380: /* pseudo_column ::= QEND */ yytestcase(yyruleno==380);
- case 381: /* pseudo_column ::= QDURATION */ yytestcase(yyruleno==381);
- case 382: /* pseudo_column ::= WSTART */ yytestcase(yyruleno==382);
- case 383: /* pseudo_column ::= WEND */ yytestcase(yyruleno==383);
- case 384: /* pseudo_column ::= WDURATION */ yytestcase(yyruleno==384);
- case 385: /* pseudo_column ::= IROWTS */ yytestcase(yyruleno==385);
- case 386: /* pseudo_column ::= QTAGS */ yytestcase(yyruleno==386);
- case 392: /* literal_func ::= NOW */ yytestcase(yyruleno==392);
-{ yylhsminor.yy74 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); }
- yymsp[0].minor.yy74 = yylhsminor.yy74;
- break;
- case 378: /* pseudo_column ::= table_name NK_DOT TBNAME */
-{ yylhsminor.yy74 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy317, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-2].minor.yy317)))); }
- yymsp[-2].minor.yy74 = yylhsminor.yy74;
- break;
- case 387: /* function_expression ::= function_name NK_LP expression_list NK_RP */
- case 388: /* function_expression ::= star_func NK_LP star_func_para_list NK_RP */ yytestcase(yyruleno==388);
-{ yylhsminor.yy74 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy317, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy317, yymsp[-1].minor.yy874)); }
- yymsp[-3].minor.yy74 = yylhsminor.yy74;
- break;
- case 389: /* function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */
-{ yylhsminor.yy74 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createCastFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy74), yymsp[-1].minor.yy898)); }
- yymsp[-5].minor.yy74 = yylhsminor.yy74;
- break;
- case 391: /* literal_func ::= noarg_func NK_LP NK_RP */
-{ yylhsminor.yy74 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy317, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-2].minor.yy317, NULL)); }
- yymsp[-2].minor.yy74 = yylhsminor.yy74;
- break;
- case 406: /* star_func_para_list ::= NK_STAR */
-{ yylhsminor.yy874 = createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); }
- yymsp[0].minor.yy874 = yylhsminor.yy874;
- break;
- case 411: /* star_func_para ::= table_name NK_DOT NK_STAR */
- case 475: /* select_item ::= table_name NK_DOT NK_STAR */ yytestcase(yyruleno==475);
-{ yylhsminor.yy74 = createColumnNode(pCxt, &yymsp[-2].minor.yy317, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy74 = yylhsminor.yy74;
- break;
- case 412: /* case_when_expression ::= CASE when_then_list case_when_else_opt END */
-{ yylhsminor.yy74 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, NULL, yymsp[-2].minor.yy874, yymsp[-1].minor.yy74)); }
- yymsp[-3].minor.yy74 = yylhsminor.yy74;
- break;
- case 413: /* case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */
-{ yylhsminor.yy74 = createRawExprNodeExt(pCxt, &yymsp[-4].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy74), yymsp[-2].minor.yy874, yymsp[-1].minor.yy74)); }
- yymsp[-4].minor.yy74 = yylhsminor.yy74;
- break;
- case 416: /* when_then_expr ::= WHEN common_expression THEN common_expression */
-{ yymsp[-3].minor.yy74 = createWhenThenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy74), releaseRawExprNode(pCxt, yymsp[0].minor.yy74)); }
- break;
- case 418: /* case_when_else_opt ::= ELSE common_expression */
-{ yymsp[-1].minor.yy74 = releaseRawExprNode(pCxt, yymsp[0].minor.yy74); }
- break;
- case 419: /* predicate ::= expr_or_subquery compare_op expr_or_subquery */
- case 424: /* predicate ::= expr_or_subquery in_op in_predicate_value */ yytestcase(yyruleno==424);
+ yymsp[-2].minor.yy600 = yylhsminor.yy600;
+ break;
+ case 376: /* column_reference ::= column_name */
+{ yylhsminor.yy600 = createRawExprNode(pCxt, &yymsp[0].minor.yy77, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy77)); }
+ yymsp[0].minor.yy600 = yylhsminor.yy600;
+ break;
+ case 377: /* column_reference ::= table_name NK_DOT column_name */
+{ yylhsminor.yy600 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy77, &yymsp[0].minor.yy77, createColumnNode(pCxt, &yymsp[-2].minor.yy77, &yymsp[0].minor.yy77)); }
+ yymsp[-2].minor.yy600 = yylhsminor.yy600;
+ break;
+ case 378: /* pseudo_column ::= ROWTS */
+ case 379: /* pseudo_column ::= TBNAME */ yytestcase(yyruleno==379);
+ case 381: /* pseudo_column ::= QSTART */ yytestcase(yyruleno==381);
+ case 382: /* pseudo_column ::= QEND */ yytestcase(yyruleno==382);
+ case 383: /* pseudo_column ::= QDURATION */ yytestcase(yyruleno==383);
+ case 384: /* pseudo_column ::= WSTART */ yytestcase(yyruleno==384);
+ case 385: /* pseudo_column ::= WEND */ yytestcase(yyruleno==385);
+ case 386: /* pseudo_column ::= WDURATION */ yytestcase(yyruleno==386);
+ case 387: /* pseudo_column ::= IROWTS */ yytestcase(yyruleno==387);
+ case 388: /* pseudo_column ::= QTAGS */ yytestcase(yyruleno==388);
+ case 394: /* literal_func ::= NOW */ yytestcase(yyruleno==394);
+{ yylhsminor.yy600 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); }
+ yymsp[0].minor.yy600 = yylhsminor.yy600;
+ break;
+ case 380: /* pseudo_column ::= table_name NK_DOT TBNAME */
+{ yylhsminor.yy600 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy77, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-2].minor.yy77)))); }
+ yymsp[-2].minor.yy600 = yylhsminor.yy600;
+ break;
+ case 389: /* function_expression ::= function_name NK_LP expression_list NK_RP */
+ case 390: /* function_expression ::= star_func NK_LP star_func_para_list NK_RP */ yytestcase(yyruleno==390);
+{ yylhsminor.yy600 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy77, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy77, yymsp[-1].minor.yy601)); }
+ yymsp[-3].minor.yy600 = yylhsminor.yy600;
+ break;
+ case 391: /* function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */
+{ yylhsminor.yy600 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createCastFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy600), yymsp[-1].minor.yy888)); }
+ yymsp[-5].minor.yy600 = yylhsminor.yy600;
+ break;
+ case 393: /* literal_func ::= noarg_func NK_LP NK_RP */
+{ yylhsminor.yy600 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy77, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-2].minor.yy77, NULL)); }
+ yymsp[-2].minor.yy600 = yylhsminor.yy600;
+ break;
+ case 408: /* star_func_para_list ::= NK_STAR */
+{ yylhsminor.yy601 = createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy601 = yylhsminor.yy601;
+ break;
+ case 413: /* star_func_para ::= table_name NK_DOT NK_STAR */
+ case 477: /* select_item ::= table_name NK_DOT NK_STAR */ yytestcase(yyruleno==477);
+{ yylhsminor.yy600 = createColumnNode(pCxt, &yymsp[-2].minor.yy77, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy600 = yylhsminor.yy600;
+ break;
+ case 414: /* case_when_expression ::= CASE when_then_list case_when_else_opt END */
+{ yylhsminor.yy600 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, NULL, yymsp[-2].minor.yy601, yymsp[-1].minor.yy600)); }
+ yymsp[-3].minor.yy600 = yylhsminor.yy600;
+ break;
+ case 415: /* case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */
+{ yylhsminor.yy600 = createRawExprNodeExt(pCxt, &yymsp[-4].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy600), yymsp[-2].minor.yy601, yymsp[-1].minor.yy600)); }
+ yymsp[-4].minor.yy600 = yylhsminor.yy600;
+ break;
+ case 418: /* when_then_expr ::= WHEN common_expression THEN common_expression */
+{ yymsp[-3].minor.yy600 = createWhenThenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy600), releaseRawExprNode(pCxt, yymsp[0].minor.yy600)); }
+ break;
+ case 420: /* case_when_else_opt ::= ELSE common_expression */
+{ yymsp[-1].minor.yy600 = releaseRawExprNode(pCxt, yymsp[0].minor.yy600); }
+ break;
+ case 421: /* predicate ::= expr_or_subquery compare_op expr_or_subquery */
+ case 426: /* predicate ::= expr_or_subquery in_op in_predicate_value */ yytestcase(yyruleno==426);
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy74);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy74);
- yylhsminor.yy74 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, yymsp[-1].minor.yy20, releaseRawExprNode(pCxt, yymsp[-2].minor.yy74), releaseRawExprNode(pCxt, yymsp[0].minor.yy74)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy600);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy600);
+ yylhsminor.yy600 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, yymsp[-1].minor.yy666, releaseRawExprNode(pCxt, yymsp[-2].minor.yy600), releaseRawExprNode(pCxt, yymsp[0].minor.yy600)));
}
- yymsp[-2].minor.yy74 = yylhsminor.yy74;
+ yymsp[-2].minor.yy600 = yylhsminor.yy600;
break;
- case 420: /* predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */
+ case 422: /* predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy74);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy74);
- yylhsminor.yy74 = createRawExprNodeExt(pCxt, &s, &e, createBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-4].minor.yy74), releaseRawExprNode(pCxt, yymsp[-2].minor.yy74), releaseRawExprNode(pCxt, yymsp[0].minor.yy74)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy600);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy600);
+ yylhsminor.yy600 = createRawExprNodeExt(pCxt, &s, &e, createBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-4].minor.yy600), releaseRawExprNode(pCxt, yymsp[-2].minor.yy600), releaseRawExprNode(pCxt, yymsp[0].minor.yy600)));
}
- yymsp[-4].minor.yy74 = yylhsminor.yy74;
+ yymsp[-4].minor.yy600 = yylhsminor.yy600;
break;
- case 421: /* predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */
+ case 423: /* predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy74);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy74);
- yylhsminor.yy74 = createRawExprNodeExt(pCxt, &s, &e, createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy74), releaseRawExprNode(pCxt, yymsp[-2].minor.yy74), releaseRawExprNode(pCxt, yymsp[0].minor.yy74)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy600);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy600);
+ yylhsminor.yy600 = createRawExprNodeExt(pCxt, &s, &e, createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy600), releaseRawExprNode(pCxt, yymsp[-2].minor.yy600), releaseRawExprNode(pCxt, yymsp[0].minor.yy600)));
}
- yymsp[-5].minor.yy74 = yylhsminor.yy74;
+ yymsp[-5].minor.yy600 = yylhsminor.yy600;
break;
- case 422: /* predicate ::= expr_or_subquery IS NULL */
+ case 424: /* predicate ::= expr_or_subquery IS NULL */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy74);
- yylhsminor.yy74 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy74), NULL));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy600);
+ yylhsminor.yy600 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy600), NULL));
}
- yymsp[-2].minor.yy74 = yylhsminor.yy74;
+ yymsp[-2].minor.yy600 = yylhsminor.yy600;
break;
- case 423: /* predicate ::= expr_or_subquery IS NOT NULL */
+ case 425: /* predicate ::= expr_or_subquery IS NOT NULL */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy74);
- yylhsminor.yy74 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy74), NULL));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy600);
+ yylhsminor.yy600 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy600), NULL));
}
- yymsp[-3].minor.yy74 = yylhsminor.yy74;
+ yymsp[-3].minor.yy600 = yylhsminor.yy600;
break;
- case 425: /* compare_op ::= NK_LT */
-{ yymsp[0].minor.yy20 = OP_TYPE_LOWER_THAN; }
+ case 427: /* compare_op ::= NK_LT */
+{ yymsp[0].minor.yy666 = OP_TYPE_LOWER_THAN; }
break;
- case 426: /* compare_op ::= NK_GT */
-{ yymsp[0].minor.yy20 = OP_TYPE_GREATER_THAN; }
+ case 428: /* compare_op ::= NK_GT */
+{ yymsp[0].minor.yy666 = OP_TYPE_GREATER_THAN; }
break;
- case 427: /* compare_op ::= NK_LE */
-{ yymsp[0].minor.yy20 = OP_TYPE_LOWER_EQUAL; }
+ case 429: /* compare_op ::= NK_LE */
+{ yymsp[0].minor.yy666 = OP_TYPE_LOWER_EQUAL; }
break;
- case 428: /* compare_op ::= NK_GE */
-{ yymsp[0].minor.yy20 = OP_TYPE_GREATER_EQUAL; }
+ case 430: /* compare_op ::= NK_GE */
+{ yymsp[0].minor.yy666 = OP_TYPE_GREATER_EQUAL; }
break;
- case 429: /* compare_op ::= NK_NE */
-{ yymsp[0].minor.yy20 = OP_TYPE_NOT_EQUAL; }
+ case 431: /* compare_op ::= NK_NE */
+{ yymsp[0].minor.yy666 = OP_TYPE_NOT_EQUAL; }
break;
- case 430: /* compare_op ::= NK_EQ */
-{ yymsp[0].minor.yy20 = OP_TYPE_EQUAL; }
+ case 432: /* compare_op ::= NK_EQ */
+{ yymsp[0].minor.yy666 = OP_TYPE_EQUAL; }
break;
- case 431: /* compare_op ::= LIKE */
-{ yymsp[0].minor.yy20 = OP_TYPE_LIKE; }
+ case 433: /* compare_op ::= LIKE */
+{ yymsp[0].minor.yy666 = OP_TYPE_LIKE; }
break;
- case 432: /* compare_op ::= NOT LIKE */
-{ yymsp[-1].minor.yy20 = OP_TYPE_NOT_LIKE; }
+ case 434: /* compare_op ::= NOT LIKE */
+{ yymsp[-1].minor.yy666 = OP_TYPE_NOT_LIKE; }
break;
- case 433: /* compare_op ::= MATCH */
-{ yymsp[0].minor.yy20 = OP_TYPE_MATCH; }
+ case 435: /* compare_op ::= MATCH */
+{ yymsp[0].minor.yy666 = OP_TYPE_MATCH; }
break;
- case 434: /* compare_op ::= NMATCH */
-{ yymsp[0].minor.yy20 = OP_TYPE_NMATCH; }
+ case 436: /* compare_op ::= NMATCH */
+{ yymsp[0].minor.yy666 = OP_TYPE_NMATCH; }
break;
- case 435: /* compare_op ::= CONTAINS */
-{ yymsp[0].minor.yy20 = OP_TYPE_JSON_CONTAINS; }
+ case 437: /* compare_op ::= CONTAINS */
+{ yymsp[0].minor.yy666 = OP_TYPE_JSON_CONTAINS; }
break;
- case 436: /* in_op ::= IN */
-{ yymsp[0].minor.yy20 = OP_TYPE_IN; }
+ case 438: /* in_op ::= IN */
+{ yymsp[0].minor.yy666 = OP_TYPE_IN; }
break;
- case 437: /* in_op ::= NOT IN */
-{ yymsp[-1].minor.yy20 = OP_TYPE_NOT_IN; }
+ case 439: /* in_op ::= NOT IN */
+{ yymsp[-1].minor.yy666 = OP_TYPE_NOT_IN; }
break;
- case 438: /* in_predicate_value ::= NK_LP literal_list NK_RP */
-{ yylhsminor.yy74 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy874)); }
- yymsp[-2].minor.yy74 = yylhsminor.yy74;
+ case 440: /* in_predicate_value ::= NK_LP literal_list NK_RP */
+{ yylhsminor.yy600 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy601)); }
+ yymsp[-2].minor.yy600 = yylhsminor.yy600;
break;
- case 440: /* boolean_value_expression ::= NOT boolean_primary */
+ case 442: /* boolean_value_expression ::= NOT boolean_primary */
{
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy74);
- yylhsminor.yy74 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy74), NULL));
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy600);
+ yylhsminor.yy600 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy600), NULL));
}
- yymsp[-1].minor.yy74 = yylhsminor.yy74;
+ yymsp[-1].minor.yy600 = yylhsminor.yy600;
break;
- case 441: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */
+ case 443: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy74);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy74);
- yylhsminor.yy74 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy74), releaseRawExprNode(pCxt, yymsp[0].minor.yy74)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy600);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy600);
+ yylhsminor.yy600 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy600), releaseRawExprNode(pCxt, yymsp[0].minor.yy600)));
}
- yymsp[-2].minor.yy74 = yylhsminor.yy74;
+ yymsp[-2].minor.yy600 = yylhsminor.yy600;
break;
- case 442: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */
+ case 444: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy74);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy74);
- yylhsminor.yy74 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy74), releaseRawExprNode(pCxt, yymsp[0].minor.yy74)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy600);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy600);
+ yylhsminor.yy600 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy600), releaseRawExprNode(pCxt, yymsp[0].minor.yy600)));
}
- yymsp[-2].minor.yy74 = yylhsminor.yy74;
+ yymsp[-2].minor.yy600 = yylhsminor.yy600;
break;
- case 448: /* from_clause_opt ::= FROM table_reference_list */
- case 477: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==477);
- case 505: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==505);
-{ yymsp[-1].minor.yy74 = yymsp[0].minor.yy74; }
+ case 450: /* from_clause_opt ::= FROM table_reference_list */
+ case 479: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==479);
+ case 509: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==509);
+{ yymsp[-1].minor.yy600 = yymsp[0].minor.yy600; }
break;
- case 450: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */
-{ yylhsminor.yy74 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, yymsp[-2].minor.yy74, yymsp[0].minor.yy74, NULL); }
- yymsp[-2].minor.yy74 = yylhsminor.yy74;
+ case 452: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */
+{ yylhsminor.yy600 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, yymsp[-2].minor.yy600, yymsp[0].minor.yy600, NULL); }
+ yymsp[-2].minor.yy600 = yylhsminor.yy600;
break;
- case 453: /* table_primary ::= table_name alias_opt */
-{ yylhsminor.yy74 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy317, &yymsp[0].minor.yy317); }
- yymsp[-1].minor.yy74 = yylhsminor.yy74;
+ case 455: /* table_primary ::= table_name alias_opt */
+{ yylhsminor.yy600 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy77, &yymsp[0].minor.yy77); }
+ yymsp[-1].minor.yy600 = yylhsminor.yy600;
break;
- case 454: /* table_primary ::= db_name NK_DOT table_name alias_opt */
-{ yylhsminor.yy74 = createRealTableNode(pCxt, &yymsp[-3].minor.yy317, &yymsp[-1].minor.yy317, &yymsp[0].minor.yy317); }
- yymsp[-3].minor.yy74 = yylhsminor.yy74;
+ case 456: /* table_primary ::= db_name NK_DOT table_name alias_opt */
+{ yylhsminor.yy600 = createRealTableNode(pCxt, &yymsp[-3].minor.yy77, &yymsp[-1].minor.yy77, &yymsp[0].minor.yy77); }
+ yymsp[-3].minor.yy600 = yylhsminor.yy600;
break;
- case 455: /* table_primary ::= subquery alias_opt */
-{ yylhsminor.yy74 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy74), &yymsp[0].minor.yy317); }
- yymsp[-1].minor.yy74 = yylhsminor.yy74;
+ case 457: /* table_primary ::= subquery alias_opt */
+{ yylhsminor.yy600 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy600), &yymsp[0].minor.yy77); }
+ yymsp[-1].minor.yy600 = yylhsminor.yy600;
break;
- case 457: /* alias_opt ::= */
-{ yymsp[1].minor.yy317 = nil_token; }
+ case 459: /* alias_opt ::= */
+{ yymsp[1].minor.yy77 = nil_token; }
break;
- case 459: /* alias_opt ::= AS table_alias */
-{ yymsp[-1].minor.yy317 = yymsp[0].minor.yy317; }
+ case 461: /* alias_opt ::= AS table_alias */
+{ yymsp[-1].minor.yy77 = yymsp[0].minor.yy77; }
break;
- case 460: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */
- case 461: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==461);
-{ yymsp[-2].minor.yy74 = yymsp[-1].minor.yy74; }
+ case 462: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */
+ case 463: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==463);
+{ yymsp[-2].minor.yy600 = yymsp[-1].minor.yy600; }
break;
- case 462: /* joined_table ::= table_reference join_type JOIN table_reference ON search_condition */
-{ yylhsminor.yy74 = createJoinTableNode(pCxt, yymsp[-4].minor.yy630, yymsp[-5].minor.yy74, yymsp[-2].minor.yy74, yymsp[0].minor.yy74); }
- yymsp[-5].minor.yy74 = yylhsminor.yy74;
+ case 464: /* joined_table ::= table_reference join_type JOIN table_reference ON search_condition */
+{ yylhsminor.yy600 = createJoinTableNode(pCxt, yymsp[-4].minor.yy560, yymsp[-5].minor.yy600, yymsp[-2].minor.yy600, yymsp[0].minor.yy600); }
+ yymsp[-5].minor.yy600 = yylhsminor.yy600;
break;
- case 463: /* join_type ::= */
-{ yymsp[1].minor.yy630 = JOIN_TYPE_INNER; }
+ case 465: /* join_type ::= */
+{ yymsp[1].minor.yy560 = JOIN_TYPE_INNER; }
break;
- case 464: /* join_type ::= INNER */
-{ yymsp[0].minor.yy630 = JOIN_TYPE_INNER; }
+ case 466: /* join_type ::= INNER */
+{ yymsp[0].minor.yy560 = JOIN_TYPE_INNER; }
break;
- case 465: /* query_specification ::= SELECT set_quantifier_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt */
+ case 467: /* query_specification ::= SELECT set_quantifier_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt */
{
- yymsp[-11].minor.yy74 = createSelectStmt(pCxt, yymsp[-10].minor.yy335, yymsp[-9].minor.yy874, yymsp[-8].minor.yy74);
- yymsp[-11].minor.yy74 = addWhereClause(pCxt, yymsp[-11].minor.yy74, yymsp[-7].minor.yy74);
- yymsp[-11].minor.yy74 = addPartitionByClause(pCxt, yymsp[-11].minor.yy74, yymsp[-6].minor.yy874);
- yymsp[-11].minor.yy74 = addWindowClauseClause(pCxt, yymsp[-11].minor.yy74, yymsp[-2].minor.yy74);
- yymsp[-11].minor.yy74 = addGroupByClause(pCxt, yymsp[-11].minor.yy74, yymsp[-1].minor.yy874);
- yymsp[-11].minor.yy74 = addHavingClause(pCxt, yymsp[-11].minor.yy74, yymsp[0].minor.yy74);
- yymsp[-11].minor.yy74 = addRangeClause(pCxt, yymsp[-11].minor.yy74, yymsp[-5].minor.yy74);
- yymsp[-11].minor.yy74 = addEveryClause(pCxt, yymsp[-11].minor.yy74, yymsp[-4].minor.yy74);
- yymsp[-11].minor.yy74 = addFillClause(pCxt, yymsp[-11].minor.yy74, yymsp[-3].minor.yy74);
+ yymsp[-11].minor.yy600 = createSelectStmt(pCxt, yymsp[-10].minor.yy841, yymsp[-9].minor.yy601, yymsp[-8].minor.yy600);
+ yymsp[-11].minor.yy600 = addWhereClause(pCxt, yymsp[-11].minor.yy600, yymsp[-7].minor.yy600);
+ yymsp[-11].minor.yy600 = addPartitionByClause(pCxt, yymsp[-11].minor.yy600, yymsp[-6].minor.yy601);
+ yymsp[-11].minor.yy600 = addWindowClauseClause(pCxt, yymsp[-11].minor.yy600, yymsp[-2].minor.yy600);
+ yymsp[-11].minor.yy600 = addGroupByClause(pCxt, yymsp[-11].minor.yy600, yymsp[-1].minor.yy601);
+ yymsp[-11].minor.yy600 = addHavingClause(pCxt, yymsp[-11].minor.yy600, yymsp[0].minor.yy600);
+ yymsp[-11].minor.yy600 = addRangeClause(pCxt, yymsp[-11].minor.yy600, yymsp[-5].minor.yy600);
+ yymsp[-11].minor.yy600 = addEveryClause(pCxt, yymsp[-11].minor.yy600, yymsp[-4].minor.yy600);
+ yymsp[-11].minor.yy600 = addFillClause(pCxt, yymsp[-11].minor.yy600, yymsp[-3].minor.yy600);
}
break;
- case 468: /* set_quantifier_opt ::= ALL */
-{ yymsp[0].minor.yy335 = false; }
+ case 470: /* set_quantifier_opt ::= ALL */
+{ yymsp[0].minor.yy841 = false; }
+ break;
+ case 473: /* select_item ::= NK_STAR */
+{ yylhsminor.yy600 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0); }
+ yymsp[0].minor.yy600 = yylhsminor.yy600;
+ break;
+ case 475: /* select_item ::= common_expression column_alias */
+ case 485: /* partition_item ::= expr_or_subquery column_alias */ yytestcase(yyruleno==485);
+{ yylhsminor.yy600 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy600), &yymsp[0].minor.yy77); }
+ yymsp[-1].minor.yy600 = yylhsminor.yy600;
break;
- case 471: /* select_item ::= NK_STAR */
-{ yylhsminor.yy74 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0); }
- yymsp[0].minor.yy74 = yylhsminor.yy74;
+ case 476: /* select_item ::= common_expression AS column_alias */
+ case 486: /* partition_item ::= expr_or_subquery AS column_alias */ yytestcase(yyruleno==486);
+{ yylhsminor.yy600 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy600), &yymsp[0].minor.yy77); }
+ yymsp[-2].minor.yy600 = yylhsminor.yy600;
break;
- case 473: /* select_item ::= common_expression column_alias */
- case 483: /* partition_item ::= expr_or_subquery column_alias */ yytestcase(yyruleno==483);
-{ yylhsminor.yy74 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy74), &yymsp[0].minor.yy317); }
- yymsp[-1].minor.yy74 = yylhsminor.yy74;
+ case 481: /* partition_by_clause_opt ::= PARTITION BY partition_list */
+ case 505: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==505);
+ case 524: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==524);
+{ yymsp[-2].minor.yy601 = yymsp[0].minor.yy601; }
break;
- case 474: /* select_item ::= common_expression AS column_alias */
- case 484: /* partition_item ::= expr_or_subquery AS column_alias */ yytestcase(yyruleno==484);
-{ yylhsminor.yy74 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy74), &yymsp[0].minor.yy317); }
- yymsp[-2].minor.yy74 = yylhsminor.yy74;
+ case 488: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */
+{ yymsp[-5].minor.yy600 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy600), releaseRawExprNode(pCxt, yymsp[-1].minor.yy600)); }
break;
- case 479: /* partition_by_clause_opt ::= PARTITION BY partition_list */
- case 501: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==501);
- case 520: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==520);
-{ yymsp[-2].minor.yy874 = yymsp[0].minor.yy874; }
+ case 489: /* twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */
+{ yymsp[-3].minor.yy600 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy600)); }
break;
- case 486: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */
-{ yymsp[-5].minor.yy74 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy74), releaseRawExprNode(pCxt, yymsp[-1].minor.yy74)); }
+ case 490: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */
+{ yymsp[-5].minor.yy600 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy600), NULL, yymsp[-1].minor.yy600, yymsp[0].minor.yy600); }
break;
- case 487: /* twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */
-{ yymsp[-3].minor.yy74 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy74)); }
+ case 491: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */
+{ yymsp[-7].minor.yy600 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy600), releaseRawExprNode(pCxt, yymsp[-3].minor.yy600), yymsp[-1].minor.yy600, yymsp[0].minor.yy600); }
break;
- case 488: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */
-{ yymsp[-5].minor.yy74 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy74), NULL, yymsp[-1].minor.yy74, yymsp[0].minor.yy74); }
+ case 495: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */
+{ yymsp[-3].minor.yy600 = createFillNode(pCxt, yymsp[-1].minor.yy798, NULL); }
break;
- case 489: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */
-{ yymsp[-7].minor.yy74 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy74), releaseRawExprNode(pCxt, yymsp[-3].minor.yy74), yymsp[-1].minor.yy74, yymsp[0].minor.yy74); }
+ case 496: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */
+{ yymsp[-5].minor.yy600 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy601)); }
break;
- case 493: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */
-{ yymsp[-3].minor.yy74 = createFillNode(pCxt, yymsp[-1].minor.yy828, NULL); }
+ case 497: /* fill_opt ::= FILL NK_LP VALUE_F NK_COMMA literal_list NK_RP */
+{ yymsp[-5].minor.yy600 = createFillNode(pCxt, FILL_MODE_VALUE_F, createNodeListNode(pCxt, yymsp[-1].minor.yy601)); }
break;
- case 494: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */
-{ yymsp[-5].minor.yy74 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy874)); }
+ case 498: /* fill_mode ::= NONE */
+{ yymsp[0].minor.yy798 = FILL_MODE_NONE; }
break;
- case 495: /* fill_mode ::= NONE */
-{ yymsp[0].minor.yy828 = FILL_MODE_NONE; }
+ case 499: /* fill_mode ::= PREV */
+{ yymsp[0].minor.yy798 = FILL_MODE_PREV; }
break;
- case 496: /* fill_mode ::= PREV */
-{ yymsp[0].minor.yy828 = FILL_MODE_PREV; }
+ case 500: /* fill_mode ::= NULL */
+{ yymsp[0].minor.yy798 = FILL_MODE_NULL; }
break;
- case 497: /* fill_mode ::= NULL */
-{ yymsp[0].minor.yy828 = FILL_MODE_NULL; }
+ case 501: /* fill_mode ::= NULL_F */
+{ yymsp[0].minor.yy798 = FILL_MODE_NULL_F; }
break;
- case 498: /* fill_mode ::= LINEAR */
-{ yymsp[0].minor.yy828 = FILL_MODE_LINEAR; }
+ case 502: /* fill_mode ::= LINEAR */
+{ yymsp[0].minor.yy798 = FILL_MODE_LINEAR; }
break;
- case 499: /* fill_mode ::= NEXT */
-{ yymsp[0].minor.yy828 = FILL_MODE_NEXT; }
+ case 503: /* fill_mode ::= NEXT */
+{ yymsp[0].minor.yy798 = FILL_MODE_NEXT; }
break;
- case 502: /* group_by_list ::= expr_or_subquery */
-{ yylhsminor.yy874 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy74))); }
- yymsp[0].minor.yy874 = yylhsminor.yy874;
+ case 506: /* group_by_list ::= expr_or_subquery */
+{ yylhsminor.yy601 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy600))); }
+ yymsp[0].minor.yy601 = yylhsminor.yy601;
break;
- case 503: /* group_by_list ::= group_by_list NK_COMMA expr_or_subquery */
-{ yylhsminor.yy874 = addNodeToList(pCxt, yymsp[-2].minor.yy874, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy74))); }
- yymsp[-2].minor.yy874 = yylhsminor.yy874;
+ case 507: /* group_by_list ::= group_by_list NK_COMMA expr_or_subquery */
+{ yylhsminor.yy601 = addNodeToList(pCxt, yymsp[-2].minor.yy601, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy600))); }
+ yymsp[-2].minor.yy601 = yylhsminor.yy601;
break;
- case 507: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */
-{ yymsp[-5].minor.yy74 = createInterpTimeRange(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy74), releaseRawExprNode(pCxt, yymsp[-1].minor.yy74)); }
+ case 511: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */
+{ yymsp[-5].minor.yy600 = createInterpTimeRange(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy600), releaseRawExprNode(pCxt, yymsp[-1].minor.yy600)); }
break;
- case 510: /* query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */
+ case 514: /* query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */
{
- yylhsminor.yy74 = addOrderByClause(pCxt, yymsp[-3].minor.yy74, yymsp[-2].minor.yy874);
- yylhsminor.yy74 = addSlimitClause(pCxt, yylhsminor.yy74, yymsp[-1].minor.yy74);
- yylhsminor.yy74 = addLimitClause(pCxt, yylhsminor.yy74, yymsp[0].minor.yy74);
+ yylhsminor.yy600 = addOrderByClause(pCxt, yymsp[-3].minor.yy600, yymsp[-2].minor.yy601);
+ yylhsminor.yy600 = addSlimitClause(pCxt, yylhsminor.yy600, yymsp[-1].minor.yy600);
+ yylhsminor.yy600 = addLimitClause(pCxt, yylhsminor.yy600, yymsp[0].minor.yy600);
}
- yymsp[-3].minor.yy74 = yylhsminor.yy74;
+ yymsp[-3].minor.yy600 = yylhsminor.yy600;
break;
- case 513: /* union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */
-{ yylhsminor.yy74 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy74, yymsp[0].minor.yy74); }
- yymsp[-3].minor.yy74 = yylhsminor.yy74;
+ case 517: /* union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */
+{ yylhsminor.yy600 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy600, yymsp[0].minor.yy600); }
+ yymsp[-3].minor.yy600 = yylhsminor.yy600;
break;
- case 514: /* union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */
-{ yylhsminor.yy74 = createSetOperator(pCxt, SET_OP_TYPE_UNION, yymsp[-2].minor.yy74, yymsp[0].minor.yy74); }
- yymsp[-2].minor.yy74 = yylhsminor.yy74;
+ case 518: /* union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */
+{ yylhsminor.yy600 = createSetOperator(pCxt, SET_OP_TYPE_UNION, yymsp[-2].minor.yy600, yymsp[0].minor.yy600); }
+ yymsp[-2].minor.yy600 = yylhsminor.yy600;
break;
- case 522: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */
- case 526: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==526);
-{ yymsp[-1].minor.yy74 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); }
+ case 526: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */
+ case 530: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==530);
+{ yymsp[-1].minor.yy600 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); }
break;
- case 523: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */
- case 527: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==527);
-{ yymsp[-3].minor.yy74 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); }
+ case 527: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */
+ case 531: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==531);
+{ yymsp[-3].minor.yy600 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); }
break;
- case 524: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */
- case 528: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==528);
-{ yymsp[-3].minor.yy74 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); }
+ case 528: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */
+ case 532: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==532);
+{ yymsp[-3].minor.yy600 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); }
break;
- case 529: /* subquery ::= NK_LP query_expression NK_RP */
-{ yylhsminor.yy74 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy74); }
- yymsp[-2].minor.yy74 = yylhsminor.yy74;
+ case 533: /* subquery ::= NK_LP query_expression NK_RP */
+{ yylhsminor.yy600 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy600); }
+ yymsp[-2].minor.yy600 = yylhsminor.yy600;
break;
- case 534: /* sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */
-{ yylhsminor.yy74 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy74), yymsp[-1].minor.yy326, yymsp[0].minor.yy109); }
- yymsp[-2].minor.yy74 = yylhsminor.yy74;
+ case 538: /* sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */
+{ yylhsminor.yy600 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy600), yymsp[-1].minor.yy32, yymsp[0].minor.yy385); }
+ yymsp[-2].minor.yy600 = yylhsminor.yy600;
break;
- case 535: /* ordering_specification_opt ::= */
-{ yymsp[1].minor.yy326 = ORDER_ASC; }
+ case 539: /* ordering_specification_opt ::= */
+{ yymsp[1].minor.yy32 = ORDER_ASC; }
break;
- case 536: /* ordering_specification_opt ::= ASC */
-{ yymsp[0].minor.yy326 = ORDER_ASC; }
+ case 540: /* ordering_specification_opt ::= ASC */
+{ yymsp[0].minor.yy32 = ORDER_ASC; }
break;
- case 537: /* ordering_specification_opt ::= DESC */
-{ yymsp[0].minor.yy326 = ORDER_DESC; }
+ case 541: /* ordering_specification_opt ::= DESC */
+{ yymsp[0].minor.yy32 = ORDER_DESC; }
break;
- case 538: /* null_ordering_opt ::= */
-{ yymsp[1].minor.yy109 = NULL_ORDER_DEFAULT; }
+ case 542: /* null_ordering_opt ::= */
+{ yymsp[1].minor.yy385 = NULL_ORDER_DEFAULT; }
break;
- case 539: /* null_ordering_opt ::= NULLS FIRST */
-{ yymsp[-1].minor.yy109 = NULL_ORDER_FIRST; }
+ case 543: /* null_ordering_opt ::= NULLS FIRST */
+{ yymsp[-1].minor.yy385 = NULL_ORDER_FIRST; }
break;
- case 540: /* null_ordering_opt ::= NULLS LAST */
-{ yymsp[-1].minor.yy109 = NULL_ORDER_LAST; }
+ case 544: /* null_ordering_opt ::= NULLS LAST */
+{ yymsp[-1].minor.yy385 = NULL_ORDER_LAST; }
break;
default:
break;
diff --git a/source/libs/parser/test/parInitialCTest.cpp b/source/libs/parser/test/parInitialCTest.cpp
index 17d02c1cce7084c99d025d89b36c69e223083069..eb264687f12ee4f5fc4777478d7b199eef9dc25b 100644
--- a/source/libs/parser/test/parInitialCTest.cpp
+++ b/source/libs/parser/test/parInitialCTest.cpp
@@ -643,7 +643,8 @@ TEST_F(ParserInitialCTest, createStream) {
auto setCreateStreamReq = [&](const char* pStream, const char* pSrcDb, const char* pSql, const char* pDstStb,
int8_t igExists = 0, int8_t triggerType = STREAM_TRIGGER_AT_ONCE, int64_t maxDelay = 0,
int64_t watermark = 0, int8_t igExpired = STREAM_DEFAULT_IGNORE_EXPIRED,
- int8_t fillHistory = STREAM_DEFAULT_FILL_HISTORY) {
+ int8_t fillHistory = STREAM_DEFAULT_FILL_HISTORY,
+ int8_t igUpdate = STREAM_DEFAULT_IGNORE_UPDATE) {
snprintf(expect.name, sizeof(expect.name), "0.%s", pStream);
snprintf(expect.sourceDB, sizeof(expect.sourceDB), "0.%s", pSrcDb);
snprintf(expect.targetStbFullName, sizeof(expect.targetStbFullName), "0.test.%s", pDstStb);
@@ -654,6 +655,7 @@ TEST_F(ParserInitialCTest, createStream) {
expect.watermark = watermark;
expect.fillHistory = fillHistory;
expect.igExpired = igExpired;
+ expect.igUpdate = igUpdate;
};
auto addTag = [&](const char* pFieldName, uint8_t type, int32_t bytes = 0) {
@@ -699,6 +701,7 @@ TEST_F(ParserInitialCTest, createStream) {
ASSERT_EQ(pField->flags, pExpectField->flags);
}
}
+ ASSERT_EQ(req.igUpdate, expect.igUpdate);
tFreeSCMCreateStreamReq(&req);
});
@@ -708,12 +711,11 @@ TEST_F(ParserInitialCTest, createStream) {
setCreateStreamReq(
"s1", "test",
- "create stream if not exists s1 trigger max_delay 20s watermark 10s ignore expired 0 fill_history 1 into st1 "
- "as select count(*) from t1 interval(10s)",
- "st1", 1, STREAM_TRIGGER_MAX_DELAY, 20 * MILLISECOND_PER_SECOND, 10 * MILLISECOND_PER_SECOND, 0, 1);
- run("CREATE STREAM IF NOT EXISTS s1 TRIGGER MAX_DELAY 20s WATERMARK 10s IGNORE EXPIRED 0 FILL_HISTORY 1 INTO st1 AS "
- "SELECT COUNT(*) "
- "FROM t1 INTERVAL(10S)");
+ "create stream if not exists s1 trigger max_delay 20s watermark 10s ignore expired 0 fill_history 1 ignore "
+ "update 1 into st1 as select count(*) from t1 interval(10s)",
+ "st1", 1, STREAM_TRIGGER_MAX_DELAY, 20 * MILLISECOND_PER_SECOND, 10 * MILLISECOND_PER_SECOND, 0, 1, 1);
+ run("CREATE STREAM IF NOT EXISTS s1 TRIGGER MAX_DELAY 20s WATERMARK 10s IGNORE EXPIRED 0 FILL_HISTORY 1 IGNORE "
+ "UPDATE 1 INTO st1 AS SELECT COUNT(*) FROM t1 INTERVAL(10S)");
clearCreateStreamReq();
setCreateStreamReq("s1", "test",
diff --git a/source/libs/planner/src/planLogicCreater.c b/source/libs/planner/src/planLogicCreater.c
index bd1823a770ca6b9d171834be2133b9c59bc7b9d8..bfde50761ae3995a56af5719c2953eb90cb48d74 100644
--- a/source/libs/planner/src/planLogicCreater.c
+++ b/source/libs/planner/src/planLogicCreater.c
@@ -343,6 +343,13 @@ static int32_t createScanLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pSelect
pScan->node.groupAction = GROUP_ACTION_NONE;
pScan->node.resultDataOrder = DATA_ORDER_LEVEL_IN_BLOCK;
+ if (pCxt->pPlanCxt->streamQuery) {
+ pScan->triggerType = pCxt->pPlanCxt->triggerType;
+ pScan->watermark = pCxt->pPlanCxt->watermark;
+ pScan->deleteMark = pCxt->pPlanCxt->deleteMark;
+ pScan->igExpired = pCxt->pPlanCxt->igExpired;
+ pScan->igCheckUpdate = pCxt->pPlanCxt->igCheckUpdate;
+ }
// set columns to scan
if (TSDB_CODE_SUCCESS == code) {
@@ -705,6 +712,7 @@ static int32_t createWindowLogicNodeFinalize(SLogicPlanContext* pCxt, SSelectStm
pWindow->watermark = pCxt->pPlanCxt->watermark;
pWindow->deleteMark = pCxt->pPlanCxt->deleteMark;
pWindow->igExpired = pCxt->pPlanCxt->igExpired;
+ pWindow->igCheckUpdate = pCxt->pPlanCxt->igCheckUpdate;
}
pWindow->inputTsOrder = ORDER_ASC;
pWindow->outputTsOrder = ORDER_ASC;
diff --git a/source/libs/planner/src/planOptimizer.c b/source/libs/planner/src/planOptimizer.c
index e901297f4d83626eed5504fca3fe586bd387e2be..90a72610745fa5d42dbd61cc9868d7776bbb262b 100644
--- a/source/libs/planner/src/planOptimizer.c
+++ b/source/libs/planner/src/planOptimizer.c
@@ -328,10 +328,6 @@ static void scanPathOptSetScanWin(SScanLogicNode* pScan) {
pScan->sliding = ((SWindowLogicNode*)pParent)->sliding;
pScan->intervalUnit = ((SWindowLogicNode*)pParent)->intervalUnit;
pScan->slidingUnit = ((SWindowLogicNode*)pParent)->slidingUnit;
- pScan->triggerType = ((SWindowLogicNode*)pParent)->triggerType;
- pScan->watermark = ((SWindowLogicNode*)pParent)->watermark;
- pScan->deleteMark = ((SWindowLogicNode*)pParent)->deleteMark;
- pScan->igExpired = ((SWindowLogicNode*)pParent)->igExpired;
}
}
diff --git a/source/libs/planner/src/planPhysiCreater.c b/source/libs/planner/src/planPhysiCreater.c
index df10fe8ee33e29f1153cecadb58228e18dcb66c9..f016ca165b8c26f851a27d68e24f27004c21ac61 100644
--- a/source/libs/planner/src/planPhysiCreater.c
+++ b/source/libs/planner/src/planPhysiCreater.c
@@ -582,6 +582,7 @@ static int32_t createTableScanPhysiNode(SPhysiPlanContext* pCxt, SSubplan* pSubp
pTableScan->triggerType = pScanLogicNode->triggerType;
pTableScan->watermark = pScanLogicNode->watermark;
pTableScan->igExpired = pScanLogicNode->igExpired;
+ pTableScan->igCheckUpdate = pScanLogicNode->igCheckUpdate;
pTableScan->assignBlockUid = pCxt->pPlanCxt->rSmaQuery ? true : false;
int32_t code = createScanPhysiNodeFinalize(pCxt, pSubplan, pScanLogicNode, (SScanPhysiNode*)pTableScan, pPhyNode);
diff --git a/source/libs/qworker/inc/qwInt.h b/source/libs/qworker/inc/qwInt.h
index bde05d41164c0ed36fc662f21e145a8967052ab0..283fc7aa10884d408aa3daeaeeab9ff0007f46df 100644
--- a/source/libs/qworker/inc/qwInt.h
+++ b/source/libs/qworker/inc/qwInt.h
@@ -76,6 +76,7 @@ typedef struct SQWDebug {
bool lockEnable;
bool statusEnable;
bool dumpEnable;
+ bool forceStop;
bool sleepSimulate;
bool deadSimulate;
bool redirectSimulate;
@@ -206,6 +207,8 @@ typedef struct SQWorkerMgmt {
int32_t paramIdx;
} SQWorkerMgmt;
+#define QW_CTX_NOT_EXISTS_ERR_CODE(mgmt) (atomic_load_8(&(mgmt)->nodeStopped) ? TSDB_CODE_VND_STOPPED : TSDB_CODE_QRY_TASK_CTX_NOT_EXIST)
+
#define QW_FPARAMS_DEF SQWorker *mgmt, uint64_t sId, uint64_t qId, uint64_t tId, int64_t rId, int32_t eId
#define QW_IDS() sId, qId, tId, rId, eId
#define QW_FPARAMS() mgmt, QW_IDS()
@@ -246,6 +249,7 @@ typedef struct SQWorkerMgmt {
#define QW_QUERY_RUNNING(ctx) (QW_GET_PHASE(ctx) == QW_PHASE_PRE_QUERY || QW_GET_PHASE(ctx) == QW_PHASE_PRE_CQUERY)
#define QW_FETCH_RUNNING(ctx) ((ctx)->inFetch)
+#define QW_QUERY_NOT_STARTED(ctx) (QW_GET_PHASE(ctx) == -1)
#define QW_SET_QTID(id, qId, tId, eId) \
do { \
diff --git a/source/libs/qworker/src/qwDbg.c b/source/libs/qworker/src/qwDbg.c
index 7a755cd36f46f87674096bae5b970a137c4e4655..0ab501ddd5abe806f62ef611900df1455b716e9f 100644
--- a/source/libs/qworker/src/qwDbg.c
+++ b/source/libs/qworker/src/qwDbg.c
@@ -9,11 +9,13 @@
#include "tmsg.h"
#include "tname.h"
-SQWDebug gQWDebug = {.statusEnable = true,
+SQWDebug gQWDebug = {.lockEnable = false,
+ .statusEnable = true,
.dumpEnable = false,
.redirectSimulate = false,
.deadSimulate = false,
- .sleepSimulate = false};
+ .sleepSimulate = false,
+ .forceStop = false};
int32_t qwDbgValidateStatus(QW_FPARAMS_DEF, int8_t oriStatus, int8_t newStatus, bool *ignore) {
if (!gQWDebug.statusEnable) {
@@ -306,6 +308,12 @@ int32_t qwDbgEnableDebug(char *option) {
return TSDB_CODE_SUCCESS;
}
+ if (0 == strcasecmp(option, "forceStop")) {
+ gQWDebug.forceStop = true;
+ qError("qw forceStop debug enabled");
+ return TSDB_CODE_SUCCESS;
+ }
+
qError("invalid qw debug option:%s", option);
return TSDB_CODE_APP_ERROR;
diff --git a/source/libs/qworker/src/qwUtil.c b/source/libs/qworker/src/qwUtil.c
index 7ee7c50c9687d26f94825a5b0888caba9371f66d..a342e48cc196df512aa1c91193c6afa5ab7c11cc 100644
--- a/source/libs/qworker/src/qwUtil.c
+++ b/source/libs/qworker/src/qwUtil.c
@@ -213,15 +213,9 @@ int32_t qwAcquireTaskCtx(QW_FPARAMS_DEF, SQWTaskCtx **ctx) {
QW_SET_QTID(id, qId, tId, eId);
*ctx = taosHashAcquire(mgmt->ctxHash, id, sizeof(id));
- int8_t nodeStopped = atomic_load_8(&mgmt->nodeStopped);
if (NULL == (*ctx)) {
- if (!nodeStopped) {
- QW_TASK_DLOG_E("task ctx not exist, may be dropped");
- QW_ERR_RET(TSDB_CODE_QRY_TASK_CTX_NOT_EXIST);
- } else {
- QW_TASK_DLOG_E("node stopped");
- QW_ERR_RET(TSDB_CODE_VND_STOPPED);
- }
+ QW_TASK_DLOG_E("acquired task ctx not exist, may be dropped");
+ QW_ERR_RET(QW_CTX_NOT_EXISTS_ERR_CODE(mgmt));
}
return TSDB_CODE_SUCCESS;
@@ -232,16 +226,9 @@ int32_t qwGetTaskCtx(QW_FPARAMS_DEF, SQWTaskCtx **ctx) {
QW_SET_QTID(id, qId, tId, eId);
*ctx = taosHashGet(mgmt->ctxHash, id, sizeof(id));
- int8_t nodeStopped = atomic_load_8(&mgmt->nodeStopped);
-
if (NULL == (*ctx)) {
- if (!nodeStopped) {
- QW_TASK_DLOG_E("task ctx not exist, may be dropped");
- QW_ERR_RET(TSDB_CODE_QRY_TASK_CTX_NOT_EXIST);
- } else {
- QW_TASK_DLOG_E("node stopped");
- QW_ERR_RET(TSDB_CODE_VND_STOPPED);
- }
+ QW_TASK_DLOG_E("get task ctx not exist, may be dropped");
+ QW_ERR_RET(QW_CTX_NOT_EXISTS_ERR_CODE(mgmt));
}
return TSDB_CODE_SUCCESS;
@@ -334,7 +321,8 @@ int32_t qwDropTaskCtx(QW_FPARAMS_DEF) {
SQWTaskCtx *ctx = taosHashGet(mgmt->ctxHash, id, sizeof(id));
if (NULL == ctx) {
- QW_ERR_RET(TSDB_CODE_QRY_TASK_CTX_NOT_EXIST);
+ QW_TASK_DLOG_E("drop task ctx not exist, may be dropped");
+ QW_ERR_RET(QW_CTX_NOT_EXISTS_ERR_CODE(mgmt));
}
octx = *ctx;
@@ -346,7 +334,7 @@ int32_t qwDropTaskCtx(QW_FPARAMS_DEF) {
if (taosHashRemove(mgmt->ctxHash, id, sizeof(id))) {
QW_TASK_ELOG_E("taosHashRemove from ctx hash failed");
- QW_ERR_RET(TSDB_CODE_QRY_TASK_CTX_NOT_EXIST);
+ QW_ERR_RET(QW_CTX_NOT_EXISTS_ERR_CODE(mgmt));
}
qwFreeTaskCtx(&octx);
diff --git a/source/libs/qworker/src/qworker.c b/source/libs/qworker/src/qworker.c
index fedaa96ed9b0d91eb8b67a7f2656f813ee1f2acb..e2db0b8319e1db910c3e1d84e9c5663a772b9c6b 100644
--- a/source/libs/qworker/src/qworker.c
+++ b/source/libs/qworker/src/qworker.c
@@ -18,6 +18,51 @@ SQWorkerMgmt gQwMgmt = {
.qwNum = 0,
};
+
+int32_t qwStopAllTasks(SQWorker *mgmt) {
+ uint64_t qId, tId, sId;
+ int32_t eId;
+ int64_t rId = 0;
+
+ void *pIter = taosHashIterate(mgmt->ctxHash, NULL);
+ while (pIter) {
+ SQWTaskCtx *ctx = (SQWTaskCtx *)pIter;
+ void *key = taosHashGetKey(pIter, NULL);
+ QW_GET_QTID(key, qId, tId, eId);
+
+ QW_LOCK(QW_WRITE, &ctx->lock);
+
+ sId = ctx->sId;
+
+ QW_TASK_DLOG_E("start to force stop task");
+
+ if (QW_EVENT_RECEIVED(ctx, QW_EVENT_DROP) || QW_EVENT_PROCESSED(ctx, QW_EVENT_DROP)) {
+ QW_TASK_WLOG_E("task already dropping");
+ QW_UNLOCK(QW_WRITE, &ctx->lock);
+
+ pIter = taosHashIterate(mgmt->ctxHash, pIter);
+ continue;
+ }
+
+ if (QW_QUERY_RUNNING(ctx)) {
+ qwKillTaskHandle(ctx, TSDB_CODE_VND_STOPPED);
+ QW_TASK_DLOG_E("task running, async killed");
+ } else if (QW_FETCH_RUNNING(ctx)) {
+ QW_UPDATE_RSP_CODE(ctx, TSDB_CODE_VND_STOPPED);
+ QW_SET_EVENT_RECEIVED(ctx, QW_EVENT_DROP);
+ QW_TASK_DLOG_E("task fetching, update drop received");
+ } else {
+ qwDropTask(QW_FPARAMS());
+ }
+
+ QW_UNLOCK(QW_WRITE, &ctx->lock);
+
+ pIter = taosHashIterate(mgmt->ctxHash, pIter);
+ }
+
+ return TSDB_CODE_SUCCESS;
+}
+
int32_t qwProcessHbLinkBroken(SQWorker *mgmt, SQWMsg *qwMsg, SSchedulerHbReq *req) {
int32_t code = 0;
SSchedulerHbRsp rsp = {0};
@@ -263,6 +308,7 @@ int32_t qwGetQueryResFromSink(QW_FPARAMS_DEF, SQWTaskCtx *ctx, int32_t *dataLen,
SOutputData output = {0};
if (NULL == ctx->sinkHandle) {
+ pOutput->queryEnd = true;
return TSDB_CODE_SUCCESS;
}
@@ -517,7 +563,7 @@ int32_t qwHandlePostPhaseEvents(QW_FPARAMS_DEF, int8_t phase, SQWPhaseInput *inp
}
if (QW_EVENT_RECEIVED(ctx, QW_EVENT_DROP)) {
- if (QW_PHASE_POST_FETCH != phase || qwTaskNotInExec(ctx)) {
+ if (QW_PHASE_POST_FETCH != phase || ((!QW_QUERY_RUNNING(ctx)) && qwTaskNotInExec(ctx))) {
QW_ERR_JRET(qwDropTask(QW_FPARAMS()));
QW_ERR_JRET(ctx->rspCode);
}
@@ -758,7 +804,7 @@ int32_t qwProcessCQuery(QW_FPARAMS_DEF, SQWMsg *qwMsg) {
}
QW_LOCK(QW_WRITE, &ctx->lock);
- if (qComplete || (queryStop && (0 == atomic_load_8((int8_t *)&ctx->queryContinue))) || code) {
+ if (atomic_load_8((int8_t*)&ctx->queryEnd) || (queryStop && (0 == atomic_load_8((int8_t *)&ctx->queryContinue))) || code) {
// Note: query is not running anymore
QW_SET_PHASE(ctx, QW_PHASE_POST_CQUERY);
QW_UNLOCK(QW_WRITE, &ctx->lock);
@@ -972,6 +1018,10 @@ void qwProcessHbTimerEvent(void *param, void *tmrId) {
qwDbgDumpMgmtInfo(mgmt);
+ if (gQWDebug.forceStop) {
+ (void)qwStopAllTasks(mgmt);
+ }
+
QW_LOCK(QW_READ, &mgmt->schLock);
int32_t schNum = taosHashGetSize(mgmt->schHash);
@@ -1086,6 +1136,7 @@ _return:
QW_RET(TSDB_CODE_SUCCESS);
}
+
int32_t qWorkerInit(int8_t nodeType, int32_t nodeId, void **qWorkerMgmt, const SMsgCb *pMsgCb) {
if (NULL == qWorkerMgmt || (pMsgCb && pMsgCb->mgmt == NULL)) {
qError("invalid param to init qworker");
@@ -1184,46 +1235,10 @@ void qWorkerStopAllTasks(void *qWorkerMgmt) {
SQWorker *mgmt = (SQWorker *)qWorkerMgmt;
QW_DLOG("start to stop all tasks, taskNum:%d", taosHashGetSize(mgmt->ctxHash));
-
- uint64_t qId, tId, sId;
- int32_t eId;
- int64_t rId = 0;
-
+
atomic_store_8(&mgmt->nodeStopped, 1);
- void *pIter = taosHashIterate(mgmt->ctxHash, NULL);
- while (pIter) {
- SQWTaskCtx *ctx = (SQWTaskCtx *)pIter;
- void *key = taosHashGetKey(pIter, NULL);
- QW_GET_QTID(key, qId, tId, eId);
-
- QW_LOCK(QW_WRITE, &ctx->lock);
-
- sId = ctx->sId;
-
- QW_TASK_DLOG_E("start to force stop task");
-
- if (QW_EVENT_RECEIVED(ctx, QW_EVENT_DROP) || QW_EVENT_PROCESSED(ctx, QW_EVENT_DROP)) {
- QW_TASK_WLOG_E("task already dropping");
- QW_UNLOCK(QW_WRITE, &ctx->lock);
-
- pIter = taosHashIterate(mgmt->ctxHash, pIter);
- continue;
- }
-
- if (QW_QUERY_RUNNING(ctx)) {
- qwKillTaskHandle(ctx, TSDB_CODE_VND_STOPPED);
- } else if (QW_FETCH_RUNNING(ctx)) {
- QW_UPDATE_RSP_CODE(ctx, TSDB_CODE_VND_STOPPED);
- QW_SET_EVENT_RECEIVED(ctx, QW_EVENT_DROP);
- } else {
- qwDropTask(QW_FPARAMS());
- }
-
- QW_UNLOCK(QW_WRITE, &ctx->lock);
-
- pIter = taosHashIterate(mgmt->ctxHash, pIter);
- }
+ (void)qwStopAllTasks(mgmt);
}
void qWorkerDestroy(void **qWorkerMgmt) {
diff --git a/source/libs/scalar/src/filter.c b/source/libs/scalar/src/filter.c
index 74d555af7773cf10d7e542ac2df277bce476bac6..25e65d25885c8b3ee8e1f1f8f55d5ecdef1e669c 100644
--- a/source/libs/scalar/src/filter.c
+++ b/source/libs/scalar/src/filter.c
@@ -1057,7 +1057,7 @@ static FORCE_INLINE int32_t filterAddColFieldFromField(SFilterInfo *info, SFilte
int32_t filterAddFieldFromNode(SFilterInfo *info, SNode *node, SFilterFieldId *fid) {
if (node == NULL) {
- fltError("empty node");
+ fltDebug("empty node");
FLT_ERR_RET(TSDB_CODE_APP_ERROR);
}
diff --git a/source/libs/scheduler/inc/schInt.h b/source/libs/scheduler/inc/schInt.h
index e8216fcd7c7d6f50981218ae8c27531390903382..14eb21565bcdaa7131c58d1fb8a09728802df616 100644
--- a/source/libs/scheduler/inc/schInt.h
+++ b/source/libs/scheduler/inc/schInt.h
@@ -230,6 +230,7 @@ typedef struct SSchTask {
SSchRedirectCtx redirectCtx; // task redirect context
bool waitRetry; // wait for retry
int32_t execId; // task current execute index
+ int32_t failedExecId; // last failed task execute index
SSchLevel *level; // level
SRWLatch planLock; // task update plan lock
SSubplan *plan; // subplan
diff --git a/source/libs/scheduler/src/schRemote.c b/source/libs/scheduler/src/schRemote.c
index b6de9383d7a6e59ac7453227ead12fb4ba095edc..9c4ed65dd205f859b71ed3b0a56001bd5b542e4a 100644
--- a/source/libs/scheduler/src/schRemote.c
+++ b/source/libs/scheduler/src/schRemote.c
@@ -34,12 +34,12 @@ int32_t schValidateRspMsgType(SSchJob *pJob, SSchTask *pTask, int32_t msgType) {
if (lastMsgType != reqMsgType) {
SCH_TASK_ELOG("rsp msg type mis-match, last sent msgType:%s, rspType:%s", TMSG_INFO(lastMsgType),
TMSG_INFO(msgType));
- SCH_ERR_RET(TSDB_CODE_SCH_STATUS_ERROR);
+ SCH_ERR_RET(TSDB_CODE_QW_MSG_ERROR);
}
if (taskStatus != JOB_TASK_STATUS_PART_SUCC) {
SCH_TASK_ELOG("rsp msg conflicted with task status, status:%s, rspType:%s", jobTaskStatusStr(taskStatus),
TMSG_INFO(msgType));
- SCH_ERR_RET(TSDB_CODE_SCH_STATUS_ERROR);
+ SCH_ERR_RET(TSDB_CODE_QW_MSG_ERROR);
}
return TSDB_CODE_SUCCESS;
@@ -60,13 +60,13 @@ int32_t schValidateRspMsgType(SSchJob *pJob, SSchTask *pTask, int32_t msgType) {
if (lastMsgType != reqMsgType) {
SCH_TASK_ELOG("rsp msg type mis-match, last sent msgType:%s, rspType:%s", TMSG_INFO(lastMsgType),
TMSG_INFO(msgType));
- SCH_ERR_RET(TSDB_CODE_SCH_STATUS_ERROR);
+ SCH_ERR_RET(TSDB_CODE_QW_MSG_ERROR);
}
if (taskStatus != JOB_TASK_STATUS_EXEC) {
SCH_TASK_ELOG("rsp msg conflicted with task status, status:%s, rspType:%s", jobTaskStatusStr(taskStatus),
TMSG_INFO(msgType));
- SCH_ERR_RET(TSDB_CODE_SCH_STATUS_ERROR);
+ SCH_ERR_RET(TSDB_CODE_QW_MSG_ERROR);
}
return TSDB_CODE_SUCCESS;
diff --git a/source/libs/scheduler/src/schTask.c b/source/libs/scheduler/src/schTask.c
index 8e60222ca6d4d53b189cffaf05fbae8c7f5dcdde..bdab7393277617afa8dbd183700d54efa2caf4a7 100644
--- a/source/libs/scheduler/src/schTask.c
+++ b/source/libs/scheduler/src/schTask.c
@@ -64,6 +64,7 @@ int32_t schInitTask(SSchJob *pJob, SSchTask *pTask, SSubplan *pPlan, SSchLevel *
pTask->plan = pPlan;
pTask->level = pLevel;
pTask->execId = -1;
+ pTask->failedExecId = -2;
pTask->timeoutUsec = SCH_DEFAULT_TASK_TIMEOUT_USEC;
pTask->taskId = schGenTaskId();
@@ -166,7 +167,7 @@ int32_t schUpdateTaskHandle(SSchJob *pJob, SSchTask *pTask, bool dropExecNode, v
schUpdateTaskExecNode(pJob, pTask, handle, execId);
- if ((execId != pTask->execId) || pTask->waitRetry) { // ignore it
+ if ((execId != pTask->execId || execId <= pTask->failedExecId) || pTask->waitRetry) { // ignore it
SCH_TASK_DLOG("handle not updated since execId %d is already not current execId %d, waitRetry %d", execId,
pTask->execId, pTask->waitRetry);
SCH_ERR_RET(TSDB_CODE_SCH_IGNORE_ERROR);
@@ -182,6 +183,8 @@ int32_t schProcessOnTaskFailure(SSchJob *pJob, SSchTask *pTask, int32_t errCode)
return TSDB_CODE_SCH_IGNORE_ERROR;
}
+ pTask->failedExecId = pTask->execId;
+
int8_t jobStatus = 0;
if (schJobNeedToStop(pJob, &jobStatus)) {
SCH_TASK_DLOG("no more task failure processing cause of job status %s", jobTaskStatusStr(jobStatus));
diff --git a/source/libs/stream/src/streamData.c b/source/libs/stream/src/streamData.c
index 6cc684dddf88c6d635f3299e4bd6f81ed811fb9e..8b869cc59f669d3de6a1bc49ca874b75a4189645 100644
--- a/source/libs/stream/src/streamData.c
+++ b/source/libs/stream/src/streamData.c
@@ -17,11 +17,10 @@
int32_t streamDispatchReqToData(const SStreamDispatchReq* pReq, SStreamDataBlock* pData) {
int32_t blockNum = pReq->blockNum;
- SArray* pArray = taosArrayInit(blockNum, sizeof(SSDataBlock));
+ SArray* pArray = taosArrayInit_s(blockNum, sizeof(SSDataBlock), blockNum);
if (pArray == NULL) {
return -1;
}
- taosArraySetSize(pArray, blockNum);
ASSERT(pReq->blockNum == taosArrayGetSize(pReq->data));
ASSERT(pReq->blockNum == taosArrayGetSize(pReq->dataLen));
@@ -49,7 +48,7 @@ int32_t streamRetrieveReqToData(const SStreamRetrieveReq* pReq, SStreamDataBlock
if (pArray == NULL) {
return -1;
}
- taosArraySetSize(pArray, 1);
+ taosArrayPush(pArray, &(SSDataBlock){0});
SRetrieveTableRsp* pRetrieve = pReq->pRetrieve;
SSDataBlock* pDataBlock = taosArrayGet(pArray, 0);
blockDecode(pDataBlock, pRetrieve->data);
diff --git a/source/libs/stream/src/streamExec.c b/source/libs/stream/src/streamExec.c
index 786ee9d079a229eb78e1c04ae3eba20bf5393351..7bf19cec63f89c7c17e79cc6af3a76566cbcaf51 100644
--- a/source/libs/stream/src/streamExec.c
+++ b/source/libs/stream/src/streamExec.c
@@ -15,6 +15,8 @@
#include "streamInc.h"
+#define STREAM_EXEC_MAX_BATCH_NUM 100
+
static int32_t streamTaskExecImpl(SStreamTask* pTask, const void* data, SArray* pRes) {
int32_t code;
void* exec = pTask->exec.executor;
@@ -221,6 +223,9 @@ int32_t streamExecForAll(SStreamTask* pTask) {
batchCnt++;
input = newRet;
streamQueueProcessSuccess(pTask->inputQueue);
+ if (batchCnt > STREAM_EXEC_MAX_BATCH_NUM) {
+ break;
+ }
}
}
}
diff --git a/source/libs/stream/src/streamMeta.c b/source/libs/stream/src/streamMeta.c
index 2f991288ffd0201be79ed3392befcd5da669294e..63527e2b1c55af8814eed0551088fa1026ff55f2 100644
--- a/source/libs/stream/src/streamMeta.c
+++ b/source/libs/stream/src/streamMeta.c
@@ -44,7 +44,7 @@ SStreamMeta* streamMetaOpen(const char* path, void* ahandle, FTaskExpand expandF
goto _err;
}
- pMeta->pTasks = taosHashInit(64, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT), true, HASH_NO_LOCK);
+ pMeta->pTasks = taosHashInit(64, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT), true, HASH_ENTRY_LOCK);
if (pMeta->pTasks == NULL) {
goto _err;
}
@@ -129,13 +129,8 @@ FAIL:
}
#endif
-#if 1
-int32_t streamMetaAddTask(SStreamMeta* pMeta, int64_t ver, SStreamTask* pTask) {
- void* buf = NULL;
- if (pMeta->expandFunc(pMeta->ahandle, pTask, ver) < 0) {
- return -1;
- }
-
+int32_t streamMetaSaveTask(SStreamMeta* pMeta, SStreamTask* pTask) {
+ void* buf = NULL;
int32_t len;
int32_t code;
tEncodeSize(tEncodeSStreamTask, pTask, len, code);
@@ -153,11 +148,23 @@ int32_t streamMetaAddTask(SStreamMeta* pMeta, int64_t ver, SStreamTask* pTask) {
tEncoderClear(&encoder);
if (tdbTbUpsert(pMeta->pTaskDb, &pTask->taskId, sizeof(int32_t), buf, len, pMeta->txn) < 0) {
- ASSERT(0);
return -1;
}
taosMemoryFree(buf);
+ return 0;
+}
+
+#if 1
+int32_t streamMetaAddTask(SStreamMeta* pMeta, int64_t ver, SStreamTask* pTask) {
+ if (pMeta->expandFunc(pMeta->ahandle, pTask, ver) < 0) {
+ return -1;
+ }
+
+ if (streamMetaSaveTask(pMeta, pTask) < 0) {
+ return -1;
+ }
+
taosHashPut(pMeta->pTasks, &pTask->taskId, sizeof(int32_t), &pTask, sizeof(void*));
return 0;
@@ -255,10 +262,9 @@ int32_t streamMetaAbort(SStreamMeta* pMeta) {
return 0;
}
-int32_t streamLoadTasks(SStreamMeta* pMeta) {
+int32_t streamLoadTasks(SStreamMeta* pMeta, int64_t ver) {
TBC* pCur = NULL;
if (tdbTbcOpen(pMeta->pTaskDb, &pCur, NULL) < 0) {
- ASSERT(0);
return -1;
}
@@ -295,7 +301,11 @@ int32_t streamLoadTasks(SStreamMeta* pMeta) {
tdbTbcClose(pCur);
return -1;
}
- pTask->taskStatus = TASK_STATUS__NORMAL;
+ /*pTask->taskStatus = TASK_STATUS__NORMAL;*/
+ if (pTask->fillHistory) {
+ pTask->taskStatus = TASK_STATUS__WAIT_DOWNSTREAM;
+ streamTaskCheckDownstream(pTask, ver);
+ }
}
tdbFree(pKey);
diff --git a/source/libs/stream/src/streamState.c b/source/libs/stream/src/streamState.c
index 2460da25f43b59ba669c711487ec7a294ab5711c..b4e44cc5b7009d91e93011ee9f8cdcd79238d1c1 100644
--- a/source/libs/stream/src/streamState.c
+++ b/source/libs/stream/src/streamState.c
@@ -107,8 +107,6 @@ static inline int stateKeyCmpr(const void* pKey1, int kLen1, const void* pKey2,
}
SStreamState* streamStateOpen(char* path, SStreamTask* pTask, bool specPath, int32_t szPage, int32_t pages) {
- szPage = szPage < 0 ? 4096 : szPage;
- pages = pages < 0 ? 256 : pages;
SStreamState* pState = taosMemoryCalloc(1, sizeof(SStreamState));
if (pState == NULL) {
terrno = TSDB_CODE_OUT_OF_MEMORY;
@@ -128,7 +126,29 @@ SStreamState* streamStateOpen(char* path, SStreamTask* pTask, bool specPath, int
memset(statePath, 0, 1024);
tstrncpy(statePath, path, 1024);
}
- if (tdbOpen(statePath, szPage, pages, &pState->pTdbState->db, 0) < 0) {
+
+ char cfgPath[1030];
+ sprintf(cfgPath, "%s/cfg", statePath);
+
+ char cfg[1024];
+ memset(cfg, 0, 1024);
+ TdFilePtr pCfgFile = taosOpenFile(cfgPath, TD_FILE_READ);
+ if (pCfgFile != NULL) {
+ int64_t size;
+ taosFStatFile(pCfgFile, &size, NULL);
+ taosReadFile(pCfgFile, cfg, size);
+ sscanf(cfg, "%d\n%d\n", &szPage, &pages);
+ } else {
+ taosMulModeMkDir(statePath, 0755);
+ pCfgFile = taosOpenFile(cfgPath, TD_FILE_WRITE | TD_FILE_CREATE);
+ szPage = szPage < 0 ? 4096 : szPage;
+ pages = pages < 0 ? 256 : pages;
+ sprintf(cfg, "%d\n%d\n", szPage, pages);
+ taosWriteFile(pCfgFile, cfg, strlen(cfg));
+ }
+ taosCloseFile(&pCfgFile);
+
+ if (tdbOpen(statePath, szPage, pages, &pState->pTdbState->db, 1) < 0) {
goto _err;
}
@@ -879,4 +899,47 @@ char* streamStateSessionDump(SStreamState* pState) {
streamStateFreeCur(pCur);
return dumpBuf;
}
+
+char* streamStateIntervalDump(SStreamState* pState) {
+ SStreamStateCur* pCur = taosMemoryCalloc(1, sizeof(SStreamStateCur));
+ if (pCur == NULL) {
+ return NULL;
+ }
+ pCur->number = pState->number;
+ if (tdbTbcOpen(pState->pTdbState->pStateDb, &pCur->pCur, NULL) < 0) {
+ streamStateFreeCur(pCur);
+ return NULL;
+ }
+ tdbTbcMoveToFirst(pCur->pCur);
+
+ SWinKey key = {0};
+ void* buf = NULL;
+ int32_t bufSize = 0;
+ int32_t code = streamStateGetKVByCur(pCur, &key, (const void **)&buf, &bufSize);
+ if (code != 0) {
+ streamStateFreeCur(pCur);
+ return NULL;
+ }
+
+ int32_t size = 2048;
+ char* dumpBuf = taosMemoryCalloc(size, 1);
+ int64_t len = 0;
+ len += snprintf(dumpBuf + len, size - len, "||s:%15" PRId64 ",", key.ts);
+ // len += snprintf(dumpBuf + len, size - len, "e:%15" PRId64 ",", key.win.ekey);
+ len += snprintf(dumpBuf + len, size - len, "g:%15" PRId64 "||", key.groupId);
+ while (1) {
+ tdbTbcMoveToNext(pCur->pCur);
+ key = (SWinKey){0};
+ code = streamStateGetKVByCur(pCur, &key, NULL, 0);
+ if (code != 0) {
+ streamStateFreeCur(pCur);
+ return dumpBuf;
+ }
+ len += snprintf(dumpBuf + len, size - len, "||s:%15" PRId64 ",", key.ts);
+ // len += snprintf(dumpBuf + len, size - len, "e:%15" PRId64 ",", key.win.ekey);
+ len += snprintf(dumpBuf + len, size - len, "g:%15" PRId64 "||", key.groupId);
+ }
+ streamStateFreeCur(pCur);
+ return dumpBuf;
+}
#endif
diff --git a/source/libs/sync/inc/syncInt.h b/source/libs/sync/inc/syncInt.h
index 7e08e195c1d255783da14967a26a4386b31e0b6b..6f2c1a1ad0e76d233d516e36ee419cae43fcc409 100644
--- a/source/libs/sync/inc/syncInt.h
+++ b/source/libs/sync/inc/syncInt.h
@@ -71,6 +71,7 @@ typedef struct SRaftId {
typedef struct SRaftStore {
SyncTerm currentTerm;
SRaftId voteFor;
+ TdThreadMutex mutex;
} SRaftStore;
typedef struct SSyncHbTimerData {
@@ -282,7 +283,7 @@ void syncNodeCandidate2Follower(SSyncNode* pSyncNode);
// raft vote --------------
void syncNodeVoteForTerm(SSyncNode* pSyncNode, SyncTerm term, SRaftId* pRaftId);
-void syncNodeVoteForSelf(SSyncNode* pSyncNode);
+void syncNodeVoteForSelf(SSyncNode* pSyncNode, SyncTerm term);
// log replication
SSyncLogReplMgr* syncNodeGetLogReplMgr(SSyncNode* pNode, SRaftId* pDestId);
diff --git a/source/libs/sync/inc/syncRaftStore.h b/source/libs/sync/inc/syncRaftStore.h
index 21a8fc64a811a832bc3893223b4c1940a6638f54..38a8ed234b8dcfa04454230b6224ff2b838b3fb6 100644
--- a/source/libs/sync/inc/syncRaftStore.h
+++ b/source/libs/sync/inc/syncRaftStore.h
@@ -26,14 +26,15 @@ extern "C" {
#define RAFT_STORE_PATH_LEN (TSDB_FILENAME_LEN * 2)
#define EMPTY_RAFT_ID ((SRaftId){.addr = 0, .vgId = 0})
-int32_t raftStoreReadFile(SSyncNode *pNode);
-int32_t raftStoreWriteFile(SSyncNode *pNode);
+int32_t raftStoreOpen(SSyncNode *pNode);
+void raftStoreClose(SSyncNode *pNode);
bool raftStoreHasVoted(SSyncNode *pNode);
void raftStoreVote(SSyncNode *pNode, SRaftId *pRaftId);
void raftStoreClearVote(SSyncNode *pNode);
void raftStoreNextTerm(SSyncNode *pNode);
void raftStoreSetTerm(SSyncNode *pNode, SyncTerm term);
+SyncTerm raftStoreGetTerm(SSyncNode *pNode);
#ifdef __cplusplus
}
diff --git a/source/libs/sync/src/syncAppendEntries.c b/source/libs/sync/src/syncAppendEntries.c
index 835e5d248e345cbbb3206e35d67ddd20717009db..b04bcb86c69de5088e53f2852d24430a722979a0 100644
--- a/source/libs/sync/src/syncAppendEntries.c
+++ b/source/libs/sync/src/syncAppendEntries.c
@@ -120,17 +120,17 @@ int32_t syncNodeOnAppendEntries(SSyncNode* ths, const SRpcMsg* pRpcMsg) {
// prepare response msg
pReply->srcId = ths->myRaftId;
pReply->destId = pMsg->srcId;
- pReply->term = ths->raftStore.currentTerm;
+ pReply->term = raftStoreGetTerm(ths);
pReply->success = false;
pReply->matchIndex = SYNC_INDEX_INVALID;
pReply->lastSendIndex = pMsg->prevLogIndex + 1;
pReply->startTime = ths->startTime;
- if (pMsg->term < ths->raftStore.currentTerm) {
+ if (pMsg->term < raftStoreGetTerm(ths)) {
goto _SEND_RESPONSE;
}
- if (pMsg->term > ths->raftStore.currentTerm) {
+ if (pMsg->term > raftStoreGetTerm(ths)) {
pReply->term = pMsg->term;
}
diff --git a/source/libs/sync/src/syncAppendEntriesReply.c b/source/libs/sync/src/syncAppendEntriesReply.c
index 44a29da3ea0e54d4e9932183a67d298a9c6239ed..f81699b9f6de4f0d7881cee7d42c6dfefd7acd71 100644
--- a/source/libs/sync/src/syncAppendEntriesReply.c
+++ b/source/libs/sync/src/syncAppendEntriesReply.c
@@ -50,19 +50,19 @@ int32_t syncNodeOnAppendEntriesReply(SSyncNode* ths, const SRpcMsg* pRpcMsg) {
}
// drop stale response
- if (pMsg->term < ths->raftStore.currentTerm) {
+ if (pMsg->term < raftStoreGetTerm(ths)) {
syncLogRecvAppendEntriesReply(ths, pMsg, "drop stale response");
return 0;
}
if (ths->state == TAOS_SYNC_STATE_LEADER) {
- if (pMsg->term > ths->raftStore.currentTerm) {
+ if (pMsg->term > raftStoreGetTerm(ths)) {
syncLogRecvAppendEntriesReply(ths, pMsg, "error term");
syncNodeStepDown(ths, pMsg->term);
return -1;
}
- ASSERT(pMsg->term == ths->raftStore.currentTerm);
+ ASSERT(pMsg->term == raftStoreGetTerm(ths));
sTrace("vgId:%d, received append entries reply. srcId:0x%016" PRIx64 ", term:%" PRId64 ", matchIndex:%" PRId64 "",
pMsg->vgId, pMsg->srcId.addr, pMsg->term, pMsg->matchIndex);
diff --git a/source/libs/sync/src/syncCommit.c b/source/libs/sync/src/syncCommit.c
index 67ed1e0701eebefff06870af66611acdbd3bb681..2501b4df8b813f438a4724097fff8eb15228b5e6 100644
--- a/source/libs/sync/src/syncCommit.c
+++ b/source/libs/sync/src/syncCommit.c
@@ -110,8 +110,8 @@ int64_t syncNodeCheckCommitIndex(SSyncNode* ths, SyncIndex indexLikely) {
if (indexLikely > ths->commitIndex && syncNodeAgreedUpon(ths, indexLikely)) {
SyncIndex commitIndex = indexLikely;
syncNodeUpdateCommitIndex(ths, commitIndex);
- sTrace("vgId:%d, agreed upon. role:%d, term:%" PRId64 ", index: %" PRId64 "", ths->vgId, ths->state,
- ths->raftStore.currentTerm, commitIndex);
+ sTrace("vgId:%d, agreed upon. role:%d, term:%" PRId64 ", index:%" PRId64 "", ths->vgId, ths->state,
+ raftStoreGetTerm(ths), commitIndex);
}
return ths->commitIndex;
}
diff --git a/source/libs/sync/src/syncElection.c b/source/libs/sync/src/syncElection.c
index 682ace83ecfa99e4781f70915048cf62a5e2d76f..e53b8ade1ca71281f4ec2536195456def7882781 100644
--- a/source/libs/sync/src/syncElection.c
+++ b/source/libs/sync/src/syncElection.c
@@ -51,7 +51,7 @@ static int32_t syncNodeRequestVotePeers(SSyncNode* pNode) {
SyncRequestVote* pMsg = rpcMsg.pCont;
pMsg->srcId = pNode->myRaftId;
pMsg->destId = pNode->peersId[i];
- pMsg->term = pNode->raftStore.currentTerm;
+ pMsg->term = raftStoreGetTerm(pNode);
ret = syncNodeGetLastIndexTerm(pNode, &pMsg->lastLogIndex, &pMsg->lastLogTerm);
if (ret < 0) {
@@ -85,10 +85,12 @@ int32_t syncNodeElect(SSyncNode* pSyncNode) {
// start election
raftStoreNextTerm(pSyncNode);
raftStoreClearVote(pSyncNode);
- voteGrantedReset(pSyncNode->pVotesGranted, pSyncNode->raftStore.currentTerm);
- votesRespondReset(pSyncNode->pVotesRespond, pSyncNode->raftStore.currentTerm);
- syncNodeVoteForSelf(pSyncNode);
+ SyncTerm currentTerm = raftStoreGetTerm(pSyncNode);
+ voteGrantedReset(pSyncNode->pVotesGranted, currentTerm);
+ votesRespondReset(pSyncNode->pVotesRespond, currentTerm);
+ syncNodeVoteForSelf(pSyncNode, currentTerm);
+
if (voteGrantedMajority(pSyncNode->pVotesGranted)) {
// only myself, to leader
ASSERT(!pSyncNode->pVotesGranted->toLeader);
diff --git a/source/libs/sync/src/syncMain.c b/source/libs/sync/src/syncMain.c
index ea22ac7bb57deda837bdb4eee295cd07536cc8f1..3f0432d9980bf1f774606f77cc1b48cec8078b74 100644
--- a/source/libs/sync/src/syncMain.c
+++ b/source/libs/sync/src/syncMain.c
@@ -41,7 +41,6 @@
static void syncNodeEqPingTimer(void* param, void* tmrId);
static void syncNodeEqElectTimer(void* param, void* tmrId);
static void syncNodeEqHeartbeatTimer(void* param, void* tmrId);
-static int32_t syncNodeEqNoop(SSyncNode* ths);
static int32_t syncNodeAppendNoop(SSyncNode* ths);
static void syncNodeEqPeerHeartbeatTimer(void* param, void* tmrId);
static bool syncIsConfigChanged(const SSyncCfg* pOldCfg, const SSyncCfg* pNewCfg);
@@ -85,7 +84,7 @@ int64_t syncOpen(SSyncInfo* pSyncInfo) {
int32_t syncStart(int64_t rid) {
SSyncNode* pSyncNode = syncNodeAcquire(rid);
if (pSyncNode == NULL) {
- sError("failed to acquire rid: %" PRId64 " of tsNodeReftId for pSyncNode", rid);
+ sError("failed to acquire rid:%" PRId64 " of tsNodeReftId for pSyncNode", rid);
return -1;
}
@@ -437,55 +436,12 @@ bool syncNodeIsReadyForRead(SSyncNode* pSyncNode) {
return false;
}
- if (pSyncNode->restoreFinish) {
- return true;
- }
-
- bool ready = false;
- if (!pSyncNode->pFsm->FpApplyQueueEmptyCb(pSyncNode->pFsm)) {
- // apply queue not empty
- ready = false;
-
- } else {
- if (!pSyncNode->pLogStore->syncLogIsEmpty(pSyncNode->pLogStore)) {
- SyncIndex lastIndex = pSyncNode->pLogStore->syncLogLastIndex(pSyncNode->pLogStore);
- SSyncRaftEntry* pEntry = NULL;
- SLRUCache* pCache = pSyncNode->pLogStore->pCache;
- LRUHandle* h = taosLRUCacheLookup(pCache, &lastIndex, sizeof(lastIndex));
- int32_t code = 0;
- if (h) {
- pEntry = (SSyncRaftEntry*)taosLRUCacheValue(pCache, h);
- code = 0;
-
- pSyncNode->pLogStore->cacheHit++;
- sNTrace(pSyncNode, "hit cache index:%" PRId64 ", bytes:%u, %p", lastIndex, pEntry->bytes, pEntry);
-
- } else {
- pSyncNode->pLogStore->cacheMiss++;
- sNTrace(pSyncNode, "miss cache index:%" PRId64, lastIndex);
-
- code = pSyncNode->pLogStore->syncLogGetEntry(pSyncNode->pLogStore, lastIndex, &pEntry);
- }
-
- if (code == 0 && pEntry != NULL) {
- if (pEntry->originalRpcType == TDMT_SYNC_NOOP && pEntry->term == pSyncNode->raftStore.currentTerm) {
- ready = true;
- }
-
- if (h) {
- taosLRUCacheRelease(pCache, h, false);
- } else {
- syncEntryDestroy(pEntry);
- }
- }
- }
- }
-
- if (!ready) {
+ if (!pSyncNode->restoreFinish) {
terrno = TSDB_CODE_SYN_RESTORING;
+ return false;
}
- return ready;
+ return true;
}
bool syncIsReadyForRead(int64_t rid) {
@@ -664,7 +620,7 @@ int32_t syncNodePropose(SSyncNode* pSyncNode, SRpcMsg* pMsg, bool isWeak, int64_
int32_t code = syncNodeOnClientRequest(pSyncNode, pMsg, &retIndex);
if (code == 0) {
pMsg->info.conn.applyIndex = retIndex;
- pMsg->info.conn.applyTerm = pSyncNode->raftStore.currentTerm;
+ pMsg->info.conn.applyTerm = raftStoreGetTerm(pSyncNode);
sTrace("vgId:%d, propose optimized msg, index:%" PRId64 " type:%s", pSyncNode->vgId, retIndex,
TMSG_INFO(pMsg->msgType));
return 1;
@@ -756,7 +712,7 @@ int32_t syncNodeLogStoreRestoreOnNeed(SSyncNode* pNode) {
SyncIndex lastVer = pNode->pLogStore->syncLogLastIndex(pNode->pLogStore);
if (lastVer < commitIndex || firstVer > commitIndex + 1) {
if (pNode->pLogStore->syncLogRestoreFromSnapshot(pNode->pLogStore, commitIndex)) {
- sError("vgId:%d, failed to restore log store from snapshot since %s. lastVer: %" PRId64 ", snapshotVer: %" PRId64,
+ sError("vgId:%d, failed to restore log store from snapshot since %s. lastVer:%" PRId64 ", snapshotVer:%" PRId64,
pNode->vgId, terrstr(), lastVer, commitIndex);
return -1;
}
@@ -911,7 +867,7 @@ SSyncNode* syncNodeOpen(SSyncInfo* pSyncInfo) {
// init TLA+ server vars
pSyncNode->state = TAOS_SYNC_STATE_FOLLOWER;
- if (raftStoreReadFile(pSyncNode) != 0) {
+ if (raftStoreOpen(pSyncNode) != 0) {
sError("vgId:%d, failed to open raft store at path %s", pSyncNode->vgId, pSyncNode->raftStorePath);
goto _error;
}
@@ -1101,7 +1057,7 @@ int32_t syncNodeRestore(SSyncNode* pSyncNode) {
SyncIndex endIndex = pSyncNode->pLogBuf->endIndex;
if (lastVer != -1 && endIndex != lastVer + 1) {
terrno = TSDB_CODE_WAL_LOG_INCOMPLETE;
- sError("vgId:%d, failed to restore sync node since %s. expected lastLogIndex: %" PRId64 ", lastVer: %" PRId64 "",
+ sError("vgId:%d, failed to restore sync node since %s. expected lastLogIndex:%" PRId64 ", lastVer:%" PRId64 "",
pSyncNode->vgId, terrstr(), endIndex - 1, lastVer);
return -1;
}
@@ -1212,7 +1168,12 @@ void syncNodeClose(SSyncNode* pSyncNode) {
if (pSyncNode == NULL) return;
sNInfo(pSyncNode, "sync close, node:%p", pSyncNode);
+ syncNodeStopPingTimer(pSyncNode);
+ syncNodeStopElectTimer(pSyncNode);
+ syncNodeStopHeartbeatTimer(pSyncNode);
+
syncNodeLogReplMgrDestroy(pSyncNode);
+
syncRespMgrDestroy(pSyncNode->pSyncRespMgr);
pSyncNode->pSyncRespMgr = NULL;
voteGrantedDestroy(pSyncNode->pVotesGranted);
@@ -1228,10 +1189,6 @@ void syncNodeClose(SSyncNode* pSyncNode) {
syncLogBufferDestroy(pSyncNode->pLogBuf);
pSyncNode->pLogBuf = NULL;
- syncNodeStopPingTimer(pSyncNode);
- syncNodeStopElectTimer(pSyncNode);
- syncNodeStopHeartbeatTimer(pSyncNode);
-
for (int32_t i = 0; i < TSDB_MAX_REPLICA; ++i) {
if (pSyncNode->senders[i] != NULL) {
sDebug("vgId:%d, snapshot sender destroy while close, data:%p", pSyncNode->vgId, pSyncNode->senders[i]);
@@ -1259,6 +1216,8 @@ void syncNodeClose(SSyncNode* pSyncNode) {
taosMemoryFree(pSyncNode->pFsm);
}
+ raftStoreClose(pSyncNode);
+
taosMemoryFree(pSyncNode);
}
@@ -1633,7 +1592,7 @@ _END:
// raft state change --------------
void syncNodeUpdateTerm(SSyncNode* pSyncNode, SyncTerm term) {
- if (term > pSyncNode->raftStore.currentTerm) {
+ if (term > raftStoreGetTerm(pSyncNode)) {
raftStoreSetTerm(pSyncNode, term);
char tmpBuf[64];
snprintf(tmpBuf, sizeof(tmpBuf), "update term to %" PRId64, term);
@@ -1643,24 +1602,23 @@ void syncNodeUpdateTerm(SSyncNode* pSyncNode, SyncTerm term) {
}
void syncNodeUpdateTermWithoutStepDown(SSyncNode* pSyncNode, SyncTerm term) {
- if (term > pSyncNode->raftStore.currentTerm) {
+ if (term > raftStoreGetTerm(pSyncNode)) {
raftStoreSetTerm(pSyncNode, term);
}
}
void syncNodeStepDown(SSyncNode* pSyncNode, SyncTerm newTerm) {
- if (pSyncNode->raftStore.currentTerm > newTerm) {
- sNTrace(pSyncNode, "step down, ignore, new-term:%" PRId64 ", current-term:%" PRId64, newTerm,
- pSyncNode->raftStore.currentTerm);
+ SyncTerm currentTerm = raftStoreGetTerm(pSyncNode);
+ if (currentTerm > newTerm) {
+ sNTrace(pSyncNode, "step down, ignore, new-term:%" PRId64 ", current-term:%" PRId64, newTerm, currentTerm);
return;
}
do {
- sNTrace(pSyncNode, "step down, new-term:%" PRId64 ", current-term:%" PRId64, newTerm,
- pSyncNode->raftStore.currentTerm);
+ sNTrace(pSyncNode, "step down, new-term:%" PRId64 ", current-term:%" PRId64, newTerm, currentTerm);
} while (0);
- if (pSyncNode->raftStore.currentTerm < newTerm) {
+ if (currentTerm < newTerm) {
raftStoreSetTerm(pSyncNode, newTerm);
char tmpBuf[64];
snprintf(tmpBuf, sizeof(tmpBuf), "step down, update term to %" PRId64, newTerm);
@@ -1820,8 +1778,8 @@ void syncNodeCandidate2Leader(SSyncNode* pSyncNode) {
SyncIndex lastIndex = pSyncNode->pLogStore->syncLogLastIndex(pSyncNode->pLogStore);
ASSERT(lastIndex >= 0);
- sInfo("vgId:%d, become leader. term: %" PRId64 ", commit index: %" PRId64 ", last index: %" PRId64 "",
- pSyncNode->vgId, pSyncNode->raftStore.currentTerm, pSyncNode->commitIndex, lastIndex);
+ sInfo("vgId:%d, become leader. term:%" PRId64 ", commit index:%" PRId64 ", last index:%" PRId64 "", pSyncNode->vgId,
+ raftStoreGetTerm(pSyncNode), pSyncNode->commitIndex, lastIndex);
}
bool syncNodeIsMnode(SSyncNode* pSyncNode) { return (pSyncNode->vgId == 1); }
@@ -1839,8 +1797,8 @@ void syncNodeFollower2Candidate(SSyncNode* pSyncNode) {
ASSERT(pSyncNode->state == TAOS_SYNC_STATE_FOLLOWER);
pSyncNode->state = TAOS_SYNC_STATE_CANDIDATE;
SyncIndex lastIndex = pSyncNode->pLogStore->syncLogLastIndex(pSyncNode->pLogStore);
- sInfo("vgId:%d, become candidate from follower. term: %" PRId64 ", commit index: %" PRId64 ", last index: %" PRId64,
- pSyncNode->vgId, pSyncNode->raftStore.currentTerm, pSyncNode->commitIndex, lastIndex);
+ sInfo("vgId:%d, become candidate from follower. term:%" PRId64 ", commit index:%" PRId64 ", last index:%" PRId64,
+ pSyncNode->vgId, raftStoreGetTerm(pSyncNode), pSyncNode->commitIndex, lastIndex);
sNTrace(pSyncNode, "follower to candidate");
}
@@ -1849,8 +1807,8 @@ void syncNodeLeader2Follower(SSyncNode* pSyncNode) {
ASSERT(pSyncNode->state == TAOS_SYNC_STATE_LEADER);
syncNodeBecomeFollower(pSyncNode, "leader to follower");
SyncIndex lastIndex = pSyncNode->pLogStore->syncLogLastIndex(pSyncNode->pLogStore);
- sInfo("vgId:%d, become follower from leader. term: %" PRId64 ", commit index: %" PRId64 ", last index: %" PRId64,
- pSyncNode->vgId, pSyncNode->raftStore.currentTerm, pSyncNode->commitIndex, lastIndex);
+ sInfo("vgId:%d, become follower from leader. term:%" PRId64 ", commit index:%" PRId64 ", last index:%" PRId64,
+ pSyncNode->vgId, raftStoreGetTerm(pSyncNode), pSyncNode->commitIndex, lastIndex);
sNTrace(pSyncNode, "leader to follower");
}
@@ -1859,8 +1817,8 @@ void syncNodeCandidate2Follower(SSyncNode* pSyncNode) {
ASSERT(pSyncNode->state == TAOS_SYNC_STATE_CANDIDATE);
syncNodeBecomeFollower(pSyncNode, "candidate to follower");
SyncIndex lastIndex = pSyncNode->pLogStore->syncLogLastIndex(pSyncNode->pLogStore);
- sInfo("vgId:%d, become follower from candidate. term: %" PRId64 ", commit index: %" PRId64 ", last index: %" PRId64,
- pSyncNode->vgId, pSyncNode->raftStore.currentTerm, pSyncNode->commitIndex, lastIndex);
+ sInfo("vgId:%d, become follower from candidate. term:%" PRId64 ", commit index:%" PRId64 ", last index:%" PRId64,
+ pSyncNode->vgId, raftStoreGetTerm(pSyncNode), pSyncNode->commitIndex, lastIndex);
sNTrace(pSyncNode, "candidate to follower");
}
@@ -1868,7 +1826,7 @@ void syncNodeCandidate2Follower(SSyncNode* pSyncNode) {
// just called by syncNodeVoteForSelf
// need assert
void syncNodeVoteForTerm(SSyncNode* pSyncNode, SyncTerm term, SRaftId* pRaftId) {
- ASSERT(term == pSyncNode->raftStore.currentTerm);
+ ASSERT(term == raftStoreGetTerm(pSyncNode));
bool voted = raftStoreHasVoted(pSyncNode);
ASSERT(!voted);
@@ -1876,8 +1834,8 @@ void syncNodeVoteForTerm(SSyncNode* pSyncNode, SyncTerm term, SRaftId* pRaftId)
}
// simulate get vote from outside
-void syncNodeVoteForSelf(SSyncNode* pSyncNode) {
- syncNodeVoteForTerm(pSyncNode, pSyncNode->raftStore.currentTerm, &pSyncNode->myRaftId);
+void syncNodeVoteForSelf(SSyncNode* pSyncNode, SyncTerm currentTerm) {
+ syncNodeVoteForTerm(pSyncNode, currentTerm, &pSyncNode->myRaftId);
SRpcMsg rpcMsg = {0};
int32_t ret = syncBuildRequestVoteReply(&rpcMsg, pSyncNode->vgId);
@@ -1886,7 +1844,7 @@ void syncNodeVoteForSelf(SSyncNode* pSyncNode) {
SyncRequestVoteReply* pMsg = rpcMsg.pCont;
pMsg->srcId = pSyncNode->myRaftId;
pMsg->destId = pSyncNode->myRaftId;
- pMsg->term = pSyncNode->raftStore.currentTerm;
+ pMsg->term = currentTerm;
pMsg->voteGranted = true;
voteGrantedVote(pSyncNode->pVotesGranted, pMsg);
@@ -2199,7 +2157,7 @@ static void syncNodeEqPeerHeartbeatTimer(void* param, void* tmrId) {
SyncHeartbeat* pSyncMsg = rpcMsg.pCont;
pSyncMsg->srcId = pSyncNode->myRaftId;
pSyncMsg->destId = pData->destId;
- pSyncMsg->term = pSyncNode->raftStore.currentTerm;
+ pSyncMsg->term = raftStoreGetTerm(pSyncNode);
pSyncMsg->commitIndex = pSyncNode->commitIndex;
pSyncMsg->minMatchIndex = syncMinMatchIndex(pSyncNode);
pSyncMsg->privateTerm = 0;
@@ -2238,30 +2196,6 @@ static void syncNodeEqPeerHeartbeatTimer(void* param, void* tmrId) {
syncNodeRelease(pSyncNode);
}
-static int32_t syncNodeEqNoop(SSyncNode* pNode) {
- if (pNode->state == TAOS_SYNC_STATE_LEADER) {
- terrno = TSDB_CODE_SYN_NOT_LEADER;
- return -1;
- }
-
- SyncIndex index = pNode->pLogStore->syncLogWriteIndex(pNode->pLogStore);
- SyncTerm term = pNode->raftStore.currentTerm;
- SSyncRaftEntry* pEntry = syncEntryBuildNoop(term, index, pNode->vgId);
- if (pEntry == NULL) return -1;
-
- SRpcMsg rpcMsg = {0};
- int32_t code = syncBuildClientRequestFromNoopEntry(&rpcMsg, pEntry, pNode->vgId);
- syncEntryDestroy(pEntry);
-
- sNTrace(pNode, "propose msg, type:noop");
- code = (*pNode->syncEqMsg)(pNode->msgcb, &rpcMsg);
- if (code != 0) {
- sError("failed to propose noop msg while enqueue since %s", terrstr());
- }
-
- return code;
-}
-
static void deleteCacheEntry(const void* key, size_t keyLen, void* value) { taosMemoryFree(value); }
int32_t syncCacheEntry(SSyncLogStore* pLogStore, SSyncRaftEntry* pEntry, LRUHandle** h) {
@@ -2291,7 +2225,7 @@ int32_t syncNodeAppend(SSyncNode* ths, SSyncRaftEntry* pEntry) {
if (syncLogBufferAppend(ths->pLogBuf, ths, pEntry) < 0) {
sError("vgId:%d, failed to enqueue sync log buffer, index:%" PRId64, ths->vgId, pEntry->index);
terrno = TSDB_CODE_SYN_BUFFER_FULL;
- (void)syncLogFsmExecute(ths, ths->pFsm, ths->state, ths->raftStore.currentTerm, pEntry, TSDB_CODE_SYN_BUFFER_FULL);
+ (void)syncLogFsmExecute(ths, ths->pFsm, ths->state, raftStoreGetTerm(ths), pEntry, TSDB_CODE_SYN_BUFFER_FULL);
syncEntryDestroy(pEntry);
return -1;
}
@@ -2299,7 +2233,7 @@ int32_t syncNodeAppend(SSyncNode* ths, SSyncRaftEntry* pEntry) {
// proceed match index, with replicating on needed
SyncIndex matchIndex = syncLogBufferProceed(ths->pLogBuf, ths, NULL);
- sTrace("vgId:%d, append raft entry. index: %" PRId64 ", term: %" PRId64 " pBuf: [%" PRId64 " %" PRId64 " %" PRId64
+ sTrace("vgId:%d, append raft entry. index:%" PRId64 ", term:%" PRId64 " pBuf: [%" PRId64 " %" PRId64 " %" PRId64
", %" PRId64 ")",
ths->vgId, pEntry->index, pEntry->term, ths->pLogBuf->startIndex, ths->pLogBuf->commitIndex,
ths->pLogBuf->matchIndex, ths->pLogBuf->endIndex);
@@ -2364,7 +2298,7 @@ bool syncNodeSnapshotRecving(SSyncNode* pSyncNode) {
static int32_t syncNodeAppendNoop(SSyncNode* ths) {
SyncIndex index = syncLogBufferGetEndIndex(ths->pLogBuf);
- SyncTerm term = ths->raftStore.currentTerm;
+ SyncTerm term = raftStoreGetTerm(ths);
SSyncRaftEntry* pEntry = syncEntryBuildNoop(term, index, ths->vgId);
if (pEntry == NULL) {
@@ -2380,7 +2314,7 @@ static int32_t syncNodeAppendNoopOld(SSyncNode* ths) {
int32_t ret = 0;
SyncIndex index = ths->pLogStore->syncLogWriteIndex(ths->pLogStore);
- SyncTerm term = ths->raftStore.currentTerm;
+ SyncTerm term = raftStoreGetTerm(ths);
SSyncRaftEntry* pEntry = syncEntryBuildNoop(term, index, ths->vgId);
ASSERT(pEntry != NULL);
@@ -2418,16 +2352,17 @@ int32_t syncNodeOnHeartbeat(SSyncNode* ths, const SRpcMsg* pRpcMsg) {
SRpcMsg rpcMsg = {0};
(void)syncBuildHeartbeatReply(&rpcMsg, ths->vgId);
+ SyncTerm currentTerm = raftStoreGetTerm(ths);
SyncHeartbeatReply* pMsgReply = rpcMsg.pCont;
pMsgReply->destId = pMsg->srcId;
pMsgReply->srcId = ths->myRaftId;
- pMsgReply->term = ths->raftStore.currentTerm;
+ pMsgReply->term = currentTerm;
pMsgReply->privateTerm = 8864; // magic number
pMsgReply->startTime = ths->startTime;
pMsgReply->timeStamp = tsMs;
- if (pMsg->term == ths->raftStore.currentTerm && ths->state != TAOS_SYNC_STATE_LEADER) {
+ if (pMsg->term == currentTerm && ths->state != TAOS_SYNC_STATE_LEADER) {
syncIndexMgrSetRecvTime(ths->pNextIndex, &(pMsg->srcId), tsMs);
syncNodeResetElectTimer(ths);
@@ -2456,7 +2391,7 @@ int32_t syncNodeOnHeartbeat(SSyncNode* ths, const SRpcMsg* pRpcMsg) {
}
}
- if (pMsg->term >= ths->raftStore.currentTerm && ths->state != TAOS_SYNC_STATE_FOLLOWER) {
+ if (pMsg->term >= currentTerm && ths->state != TAOS_SYNC_STATE_FOLLOWER) {
// syncNodeStepDown(ths, pMsg->term);
SRpcMsg rpcMsgLocalCmd = {0};
(void)syncBuildLocalCmd(&rpcMsgLocalCmd, ths->vgId);
@@ -2472,7 +2407,7 @@ int32_t syncNodeOnHeartbeat(SSyncNode* ths, const SRpcMsg* pRpcMsg) {
sError("vgId:%d, sync enqueue step-down msg error, code:%d", ths->vgId, code);
rpcFreeCont(rpcMsgLocalCmd.pCont);
} else {
- sTrace("vgId:%d, sync enqueue step-down msg, new-term: %" PRId64, ths->vgId, pSyncMsg->currentTerm);
+ sTrace("vgId:%d, sync enqueue step-down msg, new-term:%" PRId64, ths->vgId, pSyncMsg->currentTerm);
}
}
}
@@ -2538,7 +2473,7 @@ int32_t syncNodeOnLocalCmd(SSyncNode* ths, const SRpcMsg* pRpcMsg) {
(void)syncNodeUpdateCommitIndex(ths, pMsg->commitIndex);
}
if (syncLogBufferCommit(ths->pLogBuf, ths, ths->commitIndex) < 0) {
- sError("vgId:%d, failed to commit raft log since %s. commit index: %" PRId64 "", ths->vgId, terrstr(),
+ sError("vgId:%d, failed to commit raft log since %s. commit index:%" PRId64 "", ths->vgId, terrstr(),
ths->commitIndex);
}
} else {
@@ -2565,7 +2500,7 @@ int32_t syncNodeOnClientRequest(SSyncNode* ths, SRpcMsg* pMsg, SyncIndex* pRetIn
int32_t code = 0;
SyncIndex index = syncLogBufferGetEndIndex(ths->pLogBuf);
- SyncTerm term = ths->raftStore.currentTerm;
+ SyncTerm term = raftStoreGetTerm(ths);
SSyncRaftEntry* pEntry = NULL;
if (pMsg->msgType == TDMT_SYNC_CLIENT_REQUEST) {
pEntry = syncEntryBuildFromClientRequest(pMsg->pCont, term, index);
@@ -2609,73 +2544,6 @@ const char* syncStr(ESyncState state) {
}
}
-#if 0
-int32_t syncDoLeaderTransfer(SSyncNode* ths, SRpcMsg* pRpcMsg, SSyncRaftEntry* pEntry) {
- if (ths->state != TAOS_SYNC_STATE_FOLLOWER) {
- sNTrace(ths, "I am not follower, can not do leader transfer");
- return 0;
- }
-
- if (!ths->restoreFinish) {
- sNTrace(ths, "restore not finish, can not do leader transfer");
- return 0;
- }
-
- if (pEntry->term < ths->raftStore.currentTerm) {
- sNTrace(ths, "little term:%" PRId64 ", can not do leader transfer", pEntry->term);
- return 0;
- }
-
- if (pEntry->index < syncNodeGetLastIndex(ths)) {
- sNTrace(ths, "little index:%" PRId64 ", can not do leader transfer", pEntry->index);
- return 0;
- }
-
- /*
- if (ths->vgId > 1) {
- sNTrace(ths, "I am vnode, can not do leader transfer");
- return 0;
- }
- */
-
- SyncLeaderTransfer* pSyncLeaderTransfer = pRpcMsg->pCont;
- sNTrace(ths, "do leader transfer, index:%" PRId64, pEntry->index);
-
- bool sameId = syncUtilSameId(&(pSyncLeaderTransfer->newLeaderId), &(ths->myRaftId));
- bool sameNodeInfo = strcmp(pSyncLeaderTransfer->newNodeInfo.nodeFqdn, ths->myNodeInfo.nodeFqdn) == 0 &&
- pSyncLeaderTransfer->newNodeInfo.nodePort == ths->myNodeInfo.nodePort;
-
- bool same = sameId || sameNodeInfo;
- if (same) {
- // reset elect timer now!
- int32_t electMS = 1;
- int32_t ret = syncNodeRestartElectTimer(ths, electMS);
- ASSERT(ret == 0);
-
- sNTrace(ths, "maybe leader transfer to %s:%d %" PRId64, pSyncLeaderTransfer->newNodeInfo.nodeFqdn,
- pSyncLeaderTransfer->newNodeInfo.nodePort, pSyncLeaderTransfer->newLeaderId.addr);
- }
-
- if (ths->pFsm->FpLeaderTransferCb != NULL) {
- SFsmCbMeta cbMeta = {
- .code = 0,
- .currentTerm = ths->raftStore.currentTerm,
- .flag = 0,
- .index = pEntry->index,
- .lastConfigIndex = syncNodeGetSnapshotConfigIndex(ths, pEntry->index),
- .isWeak = pEntry->isWeak,
- .seqNum = pEntry->seqNum,
- .state = ths->state,
- .term = pEntry->term,
- };
- ths->pFsm->FpLeaderTransferCb(ths->pFsm, pRpcMsg, &cbMeta);
- }
-
- return 0;
-}
-
-#endif
-
int32_t syncNodeUpdateNewConfigIndex(SSyncNode* ths, SSyncCfg* pNewCfg) {
for (int32_t i = 0; i < pNewCfg->replicaNum; ++i) {
SRaftId raftId = {
diff --git a/source/libs/sync/src/syncMessage.c b/source/libs/sync/src/syncMessage.c
index 7d534c671e6c80453f8a3b47fffebcf8028e062e..2a44588eefc2287bce3cfc310907c081f32338fb 100644
--- a/source/libs/sync/src/syncMessage.c
+++ b/source/libs/sync/src/syncMessage.c
@@ -176,7 +176,7 @@ int32_t syncBuildAppendEntriesFromRaftEntry(SSyncNode* pNode, SSyncRaftEntry* pE
pMsg->prevLogTerm = prevLogTerm;
pMsg->vgId = pNode->vgId;
pMsg->srcId = pNode->myRaftId;
- pMsg->term = pNode->raftStore.currentTerm;
+ pMsg->term = raftStoreGetTerm(pNode);
pMsg->commitIndex = pNode->commitIndex;
pMsg->privateTerm = 0;
return 0;
diff --git a/source/libs/sync/src/syncPipeline.c b/source/libs/sync/src/syncPipeline.c
index bb3bb0d6a45c37c5770f39361afc81d697763fc7..c9ff2d2dcc341569787d17b42fb9a167aa6eebfd 100644
--- a/source/libs/sync/src/syncPipeline.c
+++ b/source/libs/sync/src/syncPipeline.c
@@ -61,6 +61,7 @@ int32_t syncLogBufferAppend(SSyncLogBuffer* pBuf, SSyncNode* pNode, SSyncRaftEnt
SSyncRaftEntry* pMatch = pBuf->entries[(index - 1 + pBuf->size) % pBuf->size].pItem;
ASSERTS(pMatch != NULL, "no matched log entry");
ASSERT(pMatch->index + 1 == index);
+ ASSERT(pMatch->term <= pEntry->term);
SSyncLogBufEntry tmp = {.pItem = pEntry, .prevLogIndex = pMatch->index, .prevLogTerm = pMatch->term};
pBuf->entries[index % pBuf->size] = tmp;
@@ -132,16 +133,16 @@ SSyncRaftEntry* syncEntryBuildDummy(SyncTerm term, SyncIndex index, int32_t vgId
int32_t syncLogValidateAlignmentOfCommit(SSyncNode* pNode, SyncIndex commitIndex) {
SyncIndex firstVer = pNode->pLogStore->syncLogBeginIndex(pNode->pLogStore);
if (firstVer > commitIndex + 1) {
- sError("vgId:%d, firstVer of WAL log greater than tsdb commit version + 1. firstVer: %" PRId64
- ", tsdb commit version: %" PRId64 "",
+ sError("vgId:%d, firstVer of WAL log greater than tsdb commit version + 1. firstVer:%" PRId64
+ ", tsdb commit version:%" PRId64 "",
pNode->vgId, firstVer, commitIndex);
return -1;
}
SyncIndex lastVer = pNode->pLogStore->syncLogLastIndex(pNode->pLogStore);
if (lastVer < commitIndex) {
- sError("vgId:%d, lastVer of WAL log less than tsdb commit version. lastVer: %" PRId64
- ", tsdb commit version: %" PRId64 "",
+ sError("vgId:%d, lastVer of WAL log less than tsdb commit version. lastVer:%" PRId64
+ ", tsdb commit version:%" PRId64 "",
pNode->vgId, lastVer, commitIndex);
return -1;
}
@@ -293,7 +294,7 @@ int32_t syncLogBufferAccept(SSyncLogBuffer* pBuf, SSyncNode* pNode, SSyncRaftEnt
bool inBuf = true;
if (index <= pBuf->commitIndex) {
- sTrace("vgId:%d, already committed. index: %" PRId64 ", term: %" PRId64 ". log buffer: [%" PRId64 " %" PRId64
+ sTrace("vgId:%d, already committed. index:%" PRId64 ", term:%" PRId64 ". log buffer: [%" PRId64 " %" PRId64
" %" PRId64 ", %" PRId64 ")",
pNode->vgId, pEntry->index, pEntry->term, pBuf->startIndex, pBuf->commitIndex, pBuf->matchIndex,
pBuf->endIndex);
@@ -306,7 +307,7 @@ int32_t syncLogBufferAccept(SSyncLogBuffer* pBuf, SSyncNode* pNode, SSyncRaftEnt
}
if (index - pBuf->startIndex >= pBuf->size) {
- sWarn("vgId:%d, out of buffer range. index: %" PRId64 ", term: %" PRId64 ". log buffer: [%" PRId64 " %" PRId64
+ sWarn("vgId:%d, out of buffer range. index:%" PRId64 ", term:%" PRId64 ". log buffer: [%" PRId64 " %" PRId64
" %" PRId64 ", %" PRId64 ")",
pNode->vgId, pEntry->index, pEntry->term, pBuf->startIndex, pBuf->commitIndex, pBuf->matchIndex,
pBuf->endIndex);
@@ -314,8 +315,8 @@ int32_t syncLogBufferAccept(SSyncLogBuffer* pBuf, SSyncNode* pNode, SSyncRaftEnt
}
if (index > pBuf->matchIndex && lastMatchTerm != prevTerm) {
- sWarn("vgId:%d, not ready to accept. index: %" PRId64 ", term: %" PRId64 ": prevterm: %" PRId64
- " != lastmatch: %" PRId64 ". log buffer: [%" PRId64 " %" PRId64 " %" PRId64 ", %" PRId64 ")",
+ sWarn("vgId:%d, not ready to accept. index:%" PRId64 ", term:%" PRId64 ": prevterm:%" PRId64
+ " != lastmatch:%" PRId64 ". log buffer: [%" PRId64 " %" PRId64 " %" PRId64 ", %" PRId64 ")",
pNode->vgId, pEntry->index, pEntry->term, prevTerm, lastMatchTerm, pBuf->startIndex, pBuf->commitIndex,
pBuf->matchIndex, pBuf->endIndex);
goto _out;
@@ -328,7 +329,7 @@ int32_t syncLogBufferAccept(SSyncLogBuffer* pBuf, SSyncNode* pNode, SSyncRaftEnt
if (pEntry->term != pExist->term) {
(void)syncLogBufferRollback(pBuf, pNode, index);
} else {
- sTrace("vgId:%d, duplicate log entry received. index: %" PRId64 ", term: %" PRId64 ". log buffer: [%" PRId64
+ sTrace("vgId:%d, duplicate log entry received. index:%" PRId64 ", term:%" PRId64 ". log buffer: [%" PRId64
" %" PRId64 " %" PRId64 ", %" PRId64 ")",
pNode->vgId, pEntry->index, pEntry->term, pBuf->startIndex, pBuf->commitIndex, pBuf->matchIndex,
pBuf->endIndex);
@@ -434,7 +435,7 @@ int64_t syncLogBufferProceed(SSyncLogBuffer* pBuf, SSyncNode* pNode, SyncTerm* p
// increase match index
pBuf->matchIndex = index;
- sTrace("vgId:%d, log buffer proceed. start index: %" PRId64 ", match index: %" PRId64 ", end index: %" PRId64,
+ sTrace("vgId:%d, log buffer proceed. start index:%" PRId64 ", match index:%" PRId64 ", end index:%" PRId64,
pNode->vgId, pBuf->startIndex, pBuf->matchIndex, pBuf->endIndex);
// replicate on demand
@@ -475,7 +476,7 @@ int32_t syncLogFsmExecute(SSyncNode* pNode, SSyncFSM* pFsm, ESyncState role, Syn
}
if (pEntry->originalRpcType == TDMT_VND_COMMIT) {
- sInfo("vgId:%d, fsm execute vnode commit. index: %" PRId64 ", term: %" PRId64 "", pNode->vgId, pEntry->index,
+ sInfo("vgId:%d, fsm execute vnode commit. index:%" PRId64 ", term:%" PRId64 "", pNode->vgId, pEntry->index,
pEntry->term);
}
@@ -514,7 +515,7 @@ int32_t syncLogBufferCommit(SSyncLogBuffer* pBuf, SSyncNode* pNode, int64_t comm
SSyncLogStore* pLogStore = pNode->pLogStore;
SSyncFSM* pFsm = pNode->pFsm;
ESyncState role = pNode->state;
- SyncTerm term = pNode->raftStore.currentTerm;
+ SyncTerm currentTerm = raftStoreGetTerm(pNode);
SyncGroupId vgId = pNode->vgId;
int32_t ret = -1;
int64_t upperIndex = TMIN(commitIndex, pBuf->matchIndex);
@@ -528,8 +529,8 @@ int32_t syncLogBufferCommit(SSyncLogBuffer* pBuf, SSyncNode* pNode, int64_t comm
goto _out;
}
- sTrace("vgId:%d, commit. log buffer: [%" PRId64 " %" PRId64 " %" PRId64 ", %" PRId64 "), role: %d, term: %" PRId64,
- pNode->vgId, pBuf->startIndex, pBuf->commitIndex, pBuf->matchIndex, pBuf->endIndex, role, term);
+ sTrace("vgId:%d, commit. log buffer: [%" PRId64 " %" PRId64 " %" PRId64 ", %" PRId64 "), role:%d, term:%" PRId64,
+ pNode->vgId, pBuf->startIndex, pBuf->commitIndex, pBuf->matchIndex, pBuf->endIndex, role, currentTerm);
// execute in fsm
for (int64_t index = pBuf->commitIndex + 1; index <= upperIndex; index++) {
@@ -541,20 +542,20 @@ int32_t syncLogBufferCommit(SSyncLogBuffer* pBuf, SSyncNode* pNode, int64_t comm
// execute it
if (!syncUtilUserCommit(pEntry->originalRpcType)) {
- sInfo("vgId:%d, commit sync barrier. index: %" PRId64 ", term:%" PRId64 ", type: %s", vgId, pEntry->index,
+ sInfo("vgId:%d, commit sync barrier. index:%" PRId64 ", term:%" PRId64 ", type:%s", vgId, pEntry->index,
pEntry->term, TMSG_INFO(pEntry->originalRpcType));
}
- if (syncLogFsmExecute(pNode, pFsm, role, term, pEntry, 0) != 0) {
+ if (syncLogFsmExecute(pNode, pFsm, role, currentTerm, pEntry, 0) != 0) {
sError("vgId:%d, failed to execute sync log entry. index:%" PRId64 ", term:%" PRId64
- ", role: %d, current term: %" PRId64,
- vgId, pEntry->index, pEntry->term, role, term);
+ ", role:%d, current term:%" PRId64,
+ vgId, pEntry->index, pEntry->term, role, currentTerm);
goto _out;
}
pBuf->commitIndex = index;
- sTrace("vgId:%d, committed index: %" PRId64 ", term: %" PRId64 ", role: %d, current term: %" PRId64 "", pNode->vgId,
- pEntry->index, pEntry->term, role, term);
+ sTrace("vgId:%d, committed index:%" PRId64 ", term:%" PRId64 ", role:%d, current term:%" PRId64 "", pNode->vgId,
+ pEntry->index, pEntry->term, role, currentTerm);
if (!inBuf) {
syncEntryDestroy(pEntry);
@@ -563,7 +564,7 @@ int32_t syncLogBufferCommit(SSyncLogBuffer* pBuf, SSyncNode* pNode, int64_t comm
}
// recycle
- SyncIndex until = pBuf->commitIndex - (pBuf->size >> 4);
+ SyncIndex until = pBuf->commitIndex - TSDB_SYNC_LOG_BUFFER_RETENTION;
for (SyncIndex index = pBuf->startIndex; index < until; index++) {
SSyncRaftEntry* pEntry = pBuf->entries[(index + pBuf->size) % pBuf->size].pItem;
ASSERT(pEntry != NULL);
@@ -576,7 +577,7 @@ int32_t syncLogBufferCommit(SSyncLogBuffer* pBuf, SSyncNode* pNode, int64_t comm
_out:
// mark as restored if needed
if (!pNode->restoreFinish && pBuf->commitIndex >= pNode->commitIndex && pEntry != NULL &&
- pNode->raftStore.currentTerm <= pEntry->term) {
+ currentTerm <= pEntry->term) {
pNode->pFsm->FpRestoreFinishCb(pNode->pFsm);
pNode->restoreFinish = true;
sInfo("vgId:%d, restore finished. log buffer: [%" PRId64 " %" PRId64 " %" PRId64 ", %" PRId64 ")", pNode->vgId,
@@ -614,7 +615,7 @@ int32_t syncLogReplMgrRetryOnNeed(SSyncLogReplMgr* pMgr, SSyncNode* pNode) {
SRaftId* pDestId = &pNode->replicasId[pMgr->peerId];
if (pMgr->retryBackoff == SYNC_MAX_RETRY_BACKOFF) {
syncLogReplMgrReset(pMgr);
- sWarn("vgId:%d, reset sync log repl mgr since retry backoff exceeding limit. peer: %" PRIx64, pNode->vgId,
+ sWarn("vgId:%d, reset sync log repl mgr since retry backoff exceeding limit. peer:%" PRIx64, pNode->vgId,
pDestId->addr);
return -1;
}
@@ -639,7 +640,7 @@ int32_t syncLogReplMgrRetryOnNeed(SSyncLogReplMgr* pMgr, SSyncNode* pNode) {
if (pMgr->states[pos].acked) {
if (pMgr->matchIndex < index && pMgr->states[pos].timeMs + (syncGetRetryMaxWaitMs() << 3) < nowMs) {
syncLogReplMgrReset(pMgr);
- sWarn("vgId:%d, reset sync log repl mgr since stagnation. index: %" PRId64 ", peer: %" PRIx64, pNode->vgId,
+ sWarn("vgId:%d, reset sync log repl mgr since stagnation. index:%" PRId64 ", peer:%" PRIx64, pNode->vgId,
index, pDestId->addr);
goto _out;
}
@@ -648,7 +649,7 @@ int32_t syncLogReplMgrRetryOnNeed(SSyncLogReplMgr* pMgr, SSyncNode* pNode) {
bool barrier = false;
if (syncLogReplMgrReplicateOneTo(pMgr, pNode, index, &term, pDestId, &barrier) < 0) {
- sError("vgId:%d, failed to replicate sync log entry since %s. index: %" PRId64 ", dest: %" PRIx64 "", pNode->vgId,
+ sError("vgId:%d, failed to replicate sync log entry since %s. index:%" PRId64 ", dest:%" PRIx64 "", pNode->vgId,
terrstr(), index, pDestId->addr);
goto _out;
}
@@ -670,8 +671,8 @@ _out:
if (retried) {
pMgr->retryBackoff = syncLogGetNextRetryBackoff(pMgr);
SSyncLogBuffer* pBuf = pNode->pLogBuf;
- sInfo("vgId:%d, resend %d sync log entries. dest: %" PRIx64 ", indexes: %" PRId64 " ..., terms: ... %" PRId64
- ", retryWaitMs: %" PRId64 ", mgr: [%" PRId64 " %" PRId64 ", %" PRId64 "), buffer: [%" PRId64 " %" PRId64
+ sInfo("vgId:%d, resend %d sync log entries. dest:%" PRIx64 ", indexes:%" PRId64 " ..., terms: ... %" PRId64
+ ", retryWaitMs:%" PRId64 ", mgr: [%" PRId64 " %" PRId64 ", %" PRId64 "), buffer: [%" PRId64 " %" PRId64
" %" PRId64 ", %" PRId64 ")",
pNode->vgId, count, pDestId->addr, firstIndex, term, retryWaitMs, pMgr->startIndex, pMgr->matchIndex,
pMgr->endIndex, pBuf->startIndex, pBuf->commitIndex, pBuf->matchIndex, pBuf->endIndex);
@@ -714,7 +715,7 @@ int32_t syncLogReplMgrProcessReplyAsRecovery(SSyncLogReplMgr* pMgr, SSyncNode* p
}
if (pMsg->success == false && pMsg->matchIndex >= pMsg->lastSendIndex) {
- sWarn("vgId:%d, failed to rollback match index. peer: dnode:%d, match index: %" PRId64 ", last sent: %" PRId64,
+ sWarn("vgId:%d, failed to rollback match index. peer: dnode:%d, match index:%" PRId64 ", last sent:%" PRId64,
pNode->vgId, DID(&destId), pMsg->matchIndex, pMsg->lastSendIndex);
if (syncNodeStartSnapshot(pNode, &destId) < 0) {
sError("vgId:%d, failed to start snapshot for peer dnode:%d", pNode->vgId, DID(&destId));
@@ -761,7 +762,7 @@ int32_t syncLogReplMgrProcessHeartbeatReply(SSyncLogReplMgr* pMgr, SSyncNode* pN
SSyncLogBuffer* pBuf = pNode->pLogBuf;
taosThreadMutexLock(&pBuf->mutex);
if (pMsg->startTime != 0 && pMsg->startTime != pMgr->peerStartTime) {
- sInfo("vgId:%d, reset sync log repl mgr in heartbeat. peer: %" PRIx64 ", start time:%" PRId64 ", old:%" PRId64 "",
+ sInfo("vgId:%d, reset sync log repl mgr in heartbeat. peer:%" PRIx64 ", start time:%" PRId64 ", old:%" PRId64 "",
pNode->vgId, pMsg->srcId.addr, pMsg->startTime, pMgr->peerStartTime);
syncLogReplMgrReset(pMgr);
pMgr->peerStartTime = pMsg->startTime;
@@ -774,7 +775,7 @@ int32_t syncLogReplMgrProcessReply(SSyncLogReplMgr* pMgr, SSyncNode* pNode, Sync
SSyncLogBuffer* pBuf = pNode->pLogBuf;
taosThreadMutexLock(&pBuf->mutex);
if (pMsg->startTime != pMgr->peerStartTime) {
- sInfo("vgId:%d, reset sync log repl mgr in appendlog reply. peer: %" PRIx64 ", start time:%" PRId64
+ sInfo("vgId:%d, reset sync log repl mgr in appendlog reply. peer:%" PRIx64 ", start time:%" PRId64
", old:%" PRId64,
pNode->vgId, pMsg->srcId.addr, pMsg->startTime, pMgr->peerStartTime);
syncLogReplMgrReset(pMgr);
@@ -815,7 +816,7 @@ int32_t syncLogReplMgrReplicateProbe(SSyncLogReplMgr* pMgr, SSyncNode* pNode, Sy
bool barrier = false;
SyncTerm term = -1;
if (syncLogReplMgrReplicateOneTo(pMgr, pNode, index, &term, pDestId, &barrier) < 0) {
- sError("vgId:%d, failed to replicate log entry since %s. index: %" PRId64 ", dest: 0x%016" PRIx64 "", pNode->vgId,
+ sError("vgId:%d, failed to replicate log entry since %s. index:%" PRId64 ", dest: 0x%016" PRIx64 "", pNode->vgId,
terrstr(), index, pDestId->addr);
return -1;
}
@@ -830,7 +831,7 @@ int32_t syncLogReplMgrReplicateProbe(SSyncLogReplMgr* pMgr, SSyncNode* pNode, Sy
pMgr->endIndex = index + 1;
SSyncLogBuffer* pBuf = pNode->pLogBuf;
- sTrace("vgId:%d, probe peer:%" PRIx64 " with msg of index:%" PRId64 " term: %" PRId64 ". mgr (rs:%d): [%" PRId64
+ sTrace("vgId:%d, probe peer:%" PRIx64 " with msg of index:%" PRId64 " term:%" PRId64 ". mgr (rs:%d): [%" PRId64
" %" PRId64 ", %" PRId64 "), buffer: [%" PRId64 " %" PRId64 " %" PRId64 ", %" PRId64 ")",
pNode->vgId, pDestId->addr, index, term, pMgr->restored, pMgr->startIndex, pMgr->matchIndex, pMgr->endIndex,
pBuf->startIndex, pBuf->commitIndex, pBuf->matchIndex, pBuf->endIndex);
@@ -860,7 +861,7 @@ int32_t syncLogReplMgrReplicateAttempt(SSyncLogReplMgr* pMgr, SSyncNode* pNode)
bool barrier = false;
SyncTerm term = -1;
if (syncLogReplMgrReplicateOneTo(pMgr, pNode, index, &term, pDestId, &barrier) < 0) {
- sError("vgId:%d, failed to replicate log entry since %s. index: %" PRId64 ", dest: 0x%016" PRIx64 "", pNode->vgId,
+ sError("vgId:%d, failed to replicate log entry since %s. index:%" PRId64 ", dest: 0x%016" PRIx64 "", pNode->vgId,
terrstr(), index, pDestId->addr);
return -1;
}
@@ -874,7 +875,7 @@ int32_t syncLogReplMgrReplicateAttempt(SSyncLogReplMgr* pMgr, SSyncNode* pNode)
pMgr->endIndex = index + 1;
if (barrier) {
- sInfo("vgId:%d, replicated sync barrier to dest: %" PRIx64 ". index: %" PRId64 ", term: %" PRId64
+ sInfo("vgId:%d, replicated sync barrier to dest:%" PRIx64 ". index:%" PRId64 ", term:%" PRId64
", repl mgr: rs(%d) [%" PRId64 " %" PRId64 ", %" PRId64 ")",
pNode->vgId, pDestId->addr, index, term, pMgr->restored, pMgr->startIndex, pMgr->matchIndex,
pMgr->endIndex);
@@ -885,7 +886,7 @@ int32_t syncLogReplMgrReplicateAttempt(SSyncLogReplMgr* pMgr, SSyncNode* pNode)
syncLogReplMgrRetryOnNeed(pMgr, pNode);
SSyncLogBuffer* pBuf = pNode->pLogBuf;
- sTrace("vgId:%d, replicated %d msgs to peer: %" PRIx64 ". indexes: %" PRId64 "..., terms: ...%" PRId64
+ sTrace("vgId:%d, replicated %d msgs to peer:%" PRIx64 ". indexes:%" PRId64 "..., terms: ...%" PRId64
", mgr: (rs:%d) [%" PRId64 " %" PRId64 ", %" PRId64 "), buffer: [%" PRId64 " %" PRId64 " %" PRId64 ", %" PRId64
")",
pNode->vgId, count, pDestId->addr, firstIndex, term, pMgr->restored, pMgr->startIndex, pMgr->matchIndex,
@@ -1028,7 +1029,7 @@ int32_t syncLogBufferRollback(SSyncLogBuffer* pBuf, SSyncNode* pNode, SyncIndex
return 0;
}
- sInfo("vgId:%d, rollback sync log buffer. toindex: %" PRId64 ", buffer: [%" PRId64 " %" PRId64 " %" PRId64
+ sInfo("vgId:%d, rollback sync log buffer. toindex:%" PRId64 ", buffer: [%" PRId64 " %" PRId64 " %" PRId64
", %" PRId64 ")",
pNode->vgId, toIndex, pBuf->startIndex, pBuf->commitIndex, pBuf->matchIndex, pBuf->endIndex);
@@ -1119,11 +1120,11 @@ int32_t syncLogReplMgrReplicateOneTo(SSyncLogReplMgr* pMgr, SSyncNode* pNode, Sy
pEntry = syncLogBufferGetOneEntry(pBuf, pNode, index, &inBuf);
if (pEntry == NULL) {
- sError("vgId:%d, failed to get raft entry for index: %" PRId64 "", pNode->vgId, index);
+ sError("vgId:%d, failed to get raft entry for index:%" PRId64 "", pNode->vgId, index);
if (terrno == TSDB_CODE_WAL_LOG_NOT_EXIST) {
SSyncLogReplMgr* pMgr = syncNodeGetLogReplMgr(pNode, pDestId);
if (pMgr) {
- sInfo("vgId:%d, reset sync log repl mgr of peer: %" PRIx64 " since %s. index: %" PRId64, pNode->vgId,
+ sInfo("vgId:%d, reset sync log repl mgr of peer:%" PRIx64 " since %s. index:%" PRId64, pNode->vgId,
pDestId->addr, terrstr(), index);
(void)syncLogReplMgrReset(pMgr);
}
@@ -1134,7 +1135,7 @@ int32_t syncLogReplMgrReplicateOneTo(SSyncLogReplMgr* pMgr, SSyncNode* pNode, Sy
prevLogTerm = syncLogReplMgrGetPrevLogTerm(pMgr, pNode, index);
if (prevLogTerm < 0) {
- sError("vgId:%d, failed to get prev log term since %s. index: %" PRId64 "", pNode->vgId, terrstr(), index);
+ sError("vgId:%d, failed to get prev log term since %s. index:%" PRId64 "", pNode->vgId, terrstr(), index);
goto _err;
}
if (pTerm) *pTerm = pEntry->term;
@@ -1147,7 +1148,7 @@ int32_t syncLogReplMgrReplicateOneTo(SSyncLogReplMgr* pMgr, SSyncNode* pNode, Sy
(void)syncNodeSendAppendEntries(pNode, pDestId, &msgOut);
- sTrace("vgId:%d, replicate one msg index: %" PRId64 " term: %" PRId64 " prevterm: %" PRId64 " to dest: 0x%016" PRIx64,
+ sTrace("vgId:%d, replicate one msg index:%" PRId64 " term:%" PRId64 " prevterm:%" PRId64 " to dest: 0x%016" PRIx64,
pNode->vgId, pEntry->index, pEntry->term, prevLogTerm, pDestId->addr);
if (!inBuf) {
diff --git a/source/libs/sync/src/syncRaftEntry.c b/source/libs/sync/src/syncRaftEntry.c
index 988a86cc67eaad387a1657396e8eaa3859e8e20d..623f1b77a428806a859c4ba5ffc42404ad9d0c84 100644
--- a/source/libs/sync/src/syncRaftEntry.c
+++ b/source/libs/sync/src/syncRaftEntry.c
@@ -91,7 +91,7 @@ SSyncRaftEntry* syncEntryBuildNoop(SyncTerm term, SyncIndex index, int32_t vgId)
void syncEntryDestroy(SSyncRaftEntry* pEntry) {
if (pEntry != NULL) {
- sTrace("free entry: %p", pEntry);
+ sTrace("free entry:%p", pEntry);
taosMemoryFree(pEntry);
}
}
diff --git a/source/libs/sync/src/syncRaftLog.c b/source/libs/sync/src/syncRaftLog.c
index e6569d99741f762c593c557751e800f11b6c150e..92996519991619ccebad62865a36a62dd5bd7d34 100644
--- a/source/libs/sync/src/syncRaftLog.c
+++ b/source/libs/sync/src/syncRaftLog.c
@@ -249,6 +249,7 @@ int32_t raftLogGetEntry(struct SSyncLogStore* pLogStore, SyncIndex index, SSyncR
int64_t ts2 = taosGetTimestampNs();
code = walReadVer(pWalHandle, index);
+ walReadReset(pWalHandle);
int64_t ts3 = taosGetTimestampNs();
// code = walReadVerCached(pWalHandle, index);
diff --git a/source/libs/sync/src/syncRaftStore.c b/source/libs/sync/src/syncRaftStore.c
index 197d1463fd80791403425adaed75ab31d380e4bb..68e735cf0d7e6689d4724d2439804a1379330f61 100644
--- a/source/libs/sync/src/syncRaftStore.c
+++ b/source/libs/sync/src/syncRaftStore.c
@@ -18,6 +18,9 @@
#include "syncUtil.h"
#include "tjson.h"
+int32_t raftStoreReadFile(SSyncNode *pNode);
+int32_t raftStoreWriteFile(SSyncNode *pNode);
+
static int32_t raftStoreDecode(const SJson *pJson, SRaftStore *pStore) {
int32_t code = 0;
@@ -150,27 +153,53 @@ _OVER:
return code;
}
+int32_t raftStoreOpen(SSyncNode *pNode) {
+ taosThreadMutexInit(&pNode->raftStore.mutex, NULL);
+ return raftStoreReadFile(pNode);
+}
+
+void raftStoreClose(SSyncNode *pNode) { taosThreadMutexDestroy(&pNode->raftStore.mutex); }
+
bool raftStoreHasVoted(SSyncNode *pNode) {
+ taosThreadMutexLock(&pNode->raftStore.mutex);
bool b = syncUtilEmptyId(&pNode->raftStore.voteFor);
+ taosThreadMutexUnlock(&pNode->raftStore.mutex);
return (!b);
}
void raftStoreVote(SSyncNode *pNode, SRaftId *pRaftId) {
+ taosThreadMutexLock(&pNode->raftStore.mutex);
pNode->raftStore.voteFor = *pRaftId;
(void)raftStoreWriteFile(pNode);
+ taosThreadMutexUnlock(&pNode->raftStore.mutex);
}
void raftStoreClearVote(SSyncNode *pNode) {
+ taosThreadMutexLock(&pNode->raftStore.mutex);
pNode->raftStore.voteFor = EMPTY_RAFT_ID;
(void)raftStoreWriteFile(pNode);
+ taosThreadMutexUnlock(&pNode->raftStore.mutex);
}
void raftStoreNextTerm(SSyncNode *pNode) {
+ taosThreadMutexLock(&pNode->raftStore.mutex);
pNode->raftStore.currentTerm++;
(void)raftStoreWriteFile(pNode);
+ taosThreadMutexUnlock(&pNode->raftStore.mutex);
}
void raftStoreSetTerm(SSyncNode *pNode, SyncTerm term) {
- pNode->raftStore.currentTerm = term;
- (void)raftStoreWriteFile(pNode);
+ taosThreadMutexLock(&pNode->raftStore.mutex);
+ if (pNode->raftStore.currentTerm < term) {
+ pNode->raftStore.currentTerm = term;
+ (void)raftStoreWriteFile(pNode);
+ }
+ taosThreadMutexUnlock(&pNode->raftStore.mutex);
+}
+
+SyncTerm raftStoreGetTerm(SSyncNode *pNode) {
+ taosThreadMutexLock(&pNode->raftStore.mutex);
+ SyncTerm term = pNode->raftStore.currentTerm;
+ taosThreadMutexUnlock(&pNode->raftStore.mutex);
+ return term;
}
diff --git a/source/libs/sync/src/syncReplication.c b/source/libs/sync/src/syncReplication.c
index 3df203221b88bbd0b9d804613e2ea50e881be149..8cdf821cffa1d76a9985b8d2515a439a7f93cdf7 100644
--- a/source/libs/sync/src/syncReplication.c
+++ b/source/libs/sync/src/syncReplication.c
@@ -107,7 +107,7 @@ int32_t syncNodeHeartbeatPeers(SSyncNode* pSyncNode) {
SyncHeartbeat* pSyncMsg = rpcMsg.pCont;
pSyncMsg->srcId = pSyncNode->myRaftId;
pSyncMsg->destId = pSyncNode->peersId[i];
- pSyncMsg->term = pSyncNode->raftStore.currentTerm;
+ pSyncMsg->term = raftStoreGetTerm(pSyncNode);
pSyncMsg->commitIndex = pSyncNode->commitIndex;
pSyncMsg->minMatchIndex = syncMinMatchIndex(pSyncNode);
pSyncMsg->privateTerm = 0;
diff --git a/source/libs/sync/src/syncRequestVote.c b/source/libs/sync/src/syncRequestVote.c
index 069ea2ea88b85c91846b975513dcd681944c7ace..2fda2a19b8dad08a49d35e8d0492f7e3259fbffe 100644
--- a/source/libs/sync/src/syncRequestVote.c
+++ b/source/libs/sync/src/syncRequestVote.c
@@ -97,15 +97,14 @@ int32_t syncNodeOnRequestVote(SSyncNode* ths, const SRpcMsg* pRpcMsg) {
}
bool logOK = syncNodeOnRequestVoteLogOK(ths, pMsg);
-
// maybe update term
- if (pMsg->term > ths->raftStore.currentTerm) {
+ if (pMsg->term > raftStoreGetTerm(ths)) {
syncNodeStepDown(ths, pMsg->term);
- // syncNodeUpdateTerm(ths, pMsg->term);
}
- ASSERT(pMsg->term <= ths->raftStore.currentTerm);
+ SyncTerm currentTerm = raftStoreGetTerm(ths);
+ ASSERT(pMsg->term <= currentTerm);
- bool grant = (pMsg->term == ths->raftStore.currentTerm) && logOK &&
+ bool grant = (pMsg->term == currentTerm) && logOK &&
((!raftStoreHasVoted(ths)) || (syncUtilSameId(&ths->raftStore.voteFor, &pMsg->srcId)));
if (grant) {
// maybe has already voted for pMsg->srcId
@@ -113,7 +112,7 @@ int32_t syncNodeOnRequestVote(SSyncNode* ths, const SRpcMsg* pRpcMsg) {
raftStoreVote(ths, &(pMsg->srcId));
// candidate ?
- syncNodeStepDown(ths, ths->raftStore.currentTerm);
+ syncNodeStepDown(ths, currentTerm);
// forbid elect for this round
syncNodeResetElectTimer(ths);
@@ -127,8 +126,9 @@ int32_t syncNodeOnRequestVote(SSyncNode* ths, const SRpcMsg* pRpcMsg) {
SyncRequestVoteReply* pReply = rpcMsg.pCont;
pReply->srcId = ths->myRaftId;
pReply->destId = pMsg->srcId;
- pReply->term = ths->raftStore.currentTerm;
+ pReply->term = currentTerm;
pReply->voteGranted = grant;
+ ASSERT(!grant || pMsg->term == pReply->term);
// trace log
syncLogRecvRequestVote(ths, pMsg, pReply->voteGranted, "");
diff --git a/source/libs/sync/src/syncRequestVoteReply.c b/source/libs/sync/src/syncRequestVoteReply.c
index a0d6cbf597bb95c9d0e73b9cb9cde9f7c94d4a98..25c9f813a6fe6dc173569dfed194085a903fabf4 100644
--- a/source/libs/sync/src/syncRequestVoteReply.c
+++ b/source/libs/sync/src/syncRequestVoteReply.c
@@ -47,27 +47,21 @@ int32_t syncNodeOnRequestVoteReply(SSyncNode* ths, const SRpcMsg* pRpcMsg) {
syncLogRecvRequestVoteReply(ths, pMsg, "not in my config");
return -1;
}
-
+ SyncTerm currentTerm = raftStoreGetTerm(ths);
// drop stale response
- if (pMsg->term < ths->raftStore.currentTerm) {
+ if (pMsg->term < currentTerm) {
syncLogRecvRequestVoteReply(ths, pMsg, "drop stale response");
return -1;
}
- // ASSERT(!(pMsg->term > ths->raftStore.currentTerm));
- // no need this code, because if I receive reply.term, then I must have sent for that term.
- // if (pMsg->term > ths->raftStore.currentTerm) {
- // syncNodeUpdateTerm(ths, pMsg->term);
- // }
-
- if (pMsg->term > ths->raftStore.currentTerm) {
+ if (pMsg->term > currentTerm) {
syncLogRecvRequestVoteReply(ths, pMsg, "error term");
syncNodeStepDown(ths, pMsg->term);
return -1;
}
syncLogRecvRequestVoteReply(ths, pMsg, "");
- ASSERT(pMsg->term == ths->raftStore.currentTerm);
+ ASSERT(pMsg->term == currentTerm);
// This tallies votes even when the current state is not Candidate,
// but they won't be looked at, so it doesn't matter.
diff --git a/source/libs/sync/src/syncRespMgr.c b/source/libs/sync/src/syncRespMgr.c
index 9373eccaef6b27fd451fa77b360972e47cbea3d7..f9f14c2e00816817da17eb954bd6ee4278d8b51d 100644
--- a/source/libs/sync/src/syncRespMgr.c
+++ b/source/libs/sync/src/syncRespMgr.c
@@ -143,7 +143,7 @@ static void syncRespCleanByTTL(SSyncRespMgr *pObj, int64_t ttl, bool rsp) {
.state = pNode->state,
.seqNum = *pSeqNum,
.term = SYNC_TERM_INVALID,
- .currentTerm = pNode->raftStore.currentTerm,
+ .currentTerm = SYNC_TERM_INVALID,
.flag = 0,
};
diff --git a/source/libs/sync/src/syncSnapshot.c b/source/libs/sync/src/syncSnapshot.c
index e61bcc9ffc0c9627ac8d8e845fb0092cca2a6f3b..a83a19928e0a38bdbdd56e9ffc9fdb1927a9ac77 100644
--- a/source/libs/sync/src/syncSnapshot.c
+++ b/source/libs/sync/src/syncSnapshot.c
@@ -43,7 +43,7 @@ SSyncSnapshotSender *snapshotSenderCreate(SSyncNode *pSyncNode, int32_t replicaI
pSender->sendingMS = SYNC_SNAPSHOT_RETRY_MS;
pSender->pSyncNode = pSyncNode;
pSender->replicaIndex = replicaIndex;
- pSender->term = pSyncNode->raftStore.currentTerm;
+ pSender->term = raftStoreGetTerm(pSyncNode);
pSender->startTime = 0;
pSender->endTime = 0;
pSender->pSyncNode->pFsm->FpGetSnapshotInfo(pSender->pSyncNode->pFsm, &pSender->snapshot);
@@ -90,7 +90,7 @@ int32_t snapshotSenderStart(SSyncSnapshotSender *pSender) {
memset(&pSender->lastConfig, 0, sizeof(pSender->lastConfig));
pSender->sendingMS = 0;
- pSender->term = pSender->pSyncNode->raftStore.currentTerm;
+ pSender->term = raftStoreGetTerm(pSender->pSyncNode);
pSender->startTime = taosGetTimestampMs();
pSender->lastSendTime = pSender->startTime;
pSender->finish = false;
@@ -105,7 +105,7 @@ int32_t snapshotSenderStart(SSyncSnapshotSender *pSender) {
SyncSnapshotSend *pMsg = rpcMsg.pCont;
pMsg->srcId = pSender->pSyncNode->myRaftId;
pMsg->destId = pSender->pSyncNode->replicasId[pSender->replicaIndex];
- pMsg->term = pSender->pSyncNode->raftStore.currentTerm;
+ pMsg->term = raftStoreGetTerm(pSender->pSyncNode);
pMsg->beginIndex = pSender->snapshotParam.start;
pMsg->lastIndex = pSender->snapshot.lastApplyIndex;
pMsg->lastTerm = pSender->snapshot.lastApplyTerm;
@@ -185,7 +185,7 @@ static int32_t snapshotSend(SSyncSnapshotSender *pSender) {
SyncSnapshotSend *pMsg = rpcMsg.pCont;
pMsg->srcId = pSender->pSyncNode->myRaftId;
pMsg->destId = pSender->pSyncNode->replicasId[pSender->replicaIndex];
- pMsg->term = pSender->pSyncNode->raftStore.currentTerm;
+ pMsg->term = raftStoreGetTerm(pSender->pSyncNode);
pMsg->beginIndex = pSender->snapshotParam.start;
pMsg->lastIndex = pSender->snapshot.lastApplyIndex;
pMsg->lastTerm = pSender->snapshot.lastApplyTerm;
@@ -226,7 +226,7 @@ int32_t snapshotReSend(SSyncSnapshotSender *pSender) {
SyncSnapshotSend *pMsg = rpcMsg.pCont;
pMsg->srcId = pSender->pSyncNode->myRaftId;
pMsg->destId = pSender->pSyncNode->replicasId[pSender->replicaIndex];
- pMsg->term = pSender->pSyncNode->raftStore.currentTerm;
+ pMsg->term = raftStoreGetTerm(pSender->pSyncNode);
pMsg->beginIndex = pSender->snapshotParam.start;
pMsg->lastIndex = pSender->snapshot.lastApplyIndex;
pMsg->lastTerm = pSender->snapshot.lastApplyTerm;
@@ -314,7 +314,7 @@ SSyncSnapshotReceiver *snapshotReceiverCreate(SSyncNode *pSyncNode, SRaftId from
pReceiver->pWriter = NULL;
pReceiver->pSyncNode = pSyncNode;
pReceiver->fromId = fromId;
- pReceiver->term = pSyncNode->raftStore.currentTerm;
+ pReceiver->term = raftStoreGetTerm(pSyncNode);
pReceiver->snapshot.data = NULL;
pReceiver->snapshot.lastApplyIndex = SYNC_INDEX_INVALID;
pReceiver->snapshot.lastApplyTerm = 0;
@@ -380,7 +380,7 @@ void snapshotReceiverStart(SSyncSnapshotReceiver *pReceiver, SyncSnapshotSend *p
pReceiver->start = true;
pReceiver->ack = SYNC_SNAPSHOT_SEQ_PREP_SNAPSHOT;
- pReceiver->term = pReceiver->pSyncNode->raftStore.currentTerm;
+ pReceiver->term = raftStoreGetTerm(pReceiver->pSyncNode);
pReceiver->fromId = pPreMsg->srcId;
pReceiver->startTime = pPreMsg->startTime;
@@ -437,9 +437,8 @@ static int32_t snapshotReceiverFinish(SSyncSnapshotReceiver *pReceiver, SyncSnap
}
// maybe update term
- if (pReceiver->snapshot.lastApplyTerm > pReceiver->pSyncNode->raftStore.currentTerm) {
- pReceiver->pSyncNode->raftStore.currentTerm = pReceiver->snapshot.lastApplyTerm;
- (void)raftStoreWriteFile(pReceiver->pSyncNode);
+ if (pReceiver->snapshot.lastApplyTerm > raftStoreGetTerm(pReceiver->pSyncNode)) {
+ raftStoreSetTerm(pReceiver->pSyncNode, pReceiver->snapshot.lastApplyTerm);
}
// stop writer, apply data
@@ -510,16 +509,8 @@ SyncIndex syncNodeGetSnapBeginIndex(SSyncNode *ths) {
SSyncLogStoreData *pData = ths->pLogStore->data;
SWal *pWal = pData->pWal;
- bool isEmpty = ths->pLogStore->syncLogIsEmpty(ths->pLogStore);
int64_t walCommitVer = walGetCommittedVer(pWal);
-
- if (!isEmpty && ths->commitIndex != walCommitVer) {
- sNError(ths, "commit not same, wal-commit:%" PRId64 ", commit:%" PRId64 ", ignore", walCommitVer,
- ths->commitIndex);
- snapStart = walCommitVer + 1;
- } else {
- snapStart = ths->commitIndex + 1;
- }
+ snapStart = TMAX(ths->commitIndex, walCommitVer) + 1;
sNInfo(ths, "snapshot begin index is %" PRId64, snapStart);
}
@@ -592,7 +583,7 @@ _SEND_REPLY:
SyncSnapshotRsp *pRspMsg = rpcMsg.pCont;
pRspMsg->srcId = pSyncNode->myRaftId;
pRspMsg->destId = pMsg->srcId;
- pRspMsg->term = pSyncNode->raftStore.currentTerm;
+ pRspMsg->term = raftStoreGetTerm(pSyncNode);
pRspMsg->lastIndex = pMsg->lastIndex;
pRspMsg->lastTerm = pMsg->lastTerm;
pRspMsg->startTime = pReceiver->startTime;
@@ -648,7 +639,7 @@ _SEND_REPLY:
SyncSnapshotRsp *pRspMsg = rpcMsg.pCont;
pRspMsg->srcId = pSyncNode->myRaftId;
pRspMsg->destId = pMsg->srcId;
- pRspMsg->term = pSyncNode->raftStore.currentTerm;
+ pRspMsg->term = raftStoreGetTerm(pSyncNode);
pRspMsg->lastIndex = pMsg->lastIndex;
pRspMsg->lastTerm = pMsg->lastTerm;
pRspMsg->startTime = pReceiver->startTime;
@@ -698,7 +689,7 @@ static int32_t syncNodeOnSnapshotReceive(SSyncNode *pSyncNode, SyncSnapshotSend
SyncSnapshotRsp *pRspMsg = rpcMsg.pCont;
pRspMsg->srcId = pSyncNode->myRaftId;
pRspMsg->destId = pMsg->srcId;
- pRspMsg->term = pSyncNode->raftStore.currentTerm;
+ pRspMsg->term = raftStoreGetTerm(pSyncNode);
pRspMsg->lastIndex = pMsg->lastIndex;
pRspMsg->lastTerm = pMsg->lastTerm;
pRspMsg->startTime = pReceiver->startTime;
@@ -745,7 +736,7 @@ static int32_t syncNodeOnSnapshotEnd(SSyncNode *pSyncNode, SyncSnapshotSend *pMs
SyncSnapshotRsp *pRspMsg = rpcMsg.pCont;
pRspMsg->srcId = pSyncNode->myRaftId;
pRspMsg->destId = pMsg->srcId;
- pRspMsg->term = pSyncNode->raftStore.currentTerm;
+ pRspMsg->term = raftStoreGetTerm(pSyncNode);
pRspMsg->lastIndex = pMsg->lastIndex;
pRspMsg->lastTerm = pMsg->lastTerm;
pRspMsg->startTime = pReceiver->startTime;
@@ -794,13 +785,13 @@ int32_t syncNodeOnSnapshot(SSyncNode *pSyncNode, const SRpcMsg *pRpcMsg) {
return -1;
}
- if (pMsg->term < pSyncNode->raftStore.currentTerm) {
+ if (pMsg->term < raftStoreGetTerm(pSyncNode)) {
syncLogRecvSyncSnapshotSend(pSyncNode, pMsg, "reject since small term");
terrno = TSDB_CODE_SYN_INTERNAL_ERROR;
return -1;
}
- if (pMsg->term > pSyncNode->raftStore.currentTerm) {
+ if (pMsg->term > raftStoreGetTerm(pSyncNode)) {
syncNodeStepDown(pSyncNode, pMsg->term);
}
syncNodeResetElectTimer(pSyncNode);
@@ -808,7 +799,7 @@ int32_t syncNodeOnSnapshot(SSyncNode *pSyncNode, const SRpcMsg *pRpcMsg) {
// state, term, seq/ack
int32_t code = 0;
if (pSyncNode->state == TAOS_SYNC_STATE_FOLLOWER) {
- if (pMsg->term == pSyncNode->raftStore.currentTerm) {
+ if (pMsg->term == raftStoreGetTerm(pSyncNode)) {
if (pMsg->seq == SYNC_SNAPSHOT_SEQ_PREP_SNAPSHOT) {
syncLogRecvSyncSnapshotSend(pSyncNode, pMsg, "process seq pre-snapshot");
code = syncNodeOnSnapshotPrep(pSyncNode, pMsg);
@@ -892,7 +883,7 @@ static int32_t syncNodeOnSnapshotPrepRsp(SSyncNode *pSyncNode, SSyncSnapshotSend
SyncSnapshotSend *pSendMsg = rpcMsg.pCont;
pSendMsg->srcId = pSender->pSyncNode->myRaftId;
pSendMsg->destId = pSender->pSyncNode->replicasId[pSender->replicaIndex];
- pSendMsg->term = pSender->pSyncNode->raftStore.currentTerm;
+ pSendMsg->term = raftStoreGetTerm(pSender->pSyncNode);
pSendMsg->beginIndex = pSender->snapshotParam.start;
pSendMsg->lastIndex = pSender->snapshot.lastApplyIndex;
pSendMsg->lastTerm = pSender->snapshot.lastApplyTerm;
@@ -951,10 +942,11 @@ int32_t syncNodeOnSnapshotRsp(SSyncNode *pSyncNode, const SRpcMsg *pRpcMsg) {
goto _ERROR;
}
- if (pMsg->term != pSyncNode->raftStore.currentTerm) {
+ SyncTerm currentTerm = raftStoreGetTerm(pSyncNode);
+ if (pMsg->term != currentTerm) {
syncLogRecvSyncSnapshotRsp(pSyncNode, pMsg, "snapshot sender and receiver term not match");
sSError(pSender, "snapshot sender term not equal, msg term:%" PRId64 " currentTerm:%" PRId64, pMsg->term,
- pSyncNode->raftStore.currentTerm);
+ currentTerm);
terrno = TSDB_CODE_SYN_INTERNAL_ERROR;
goto _ERROR;
}
diff --git a/source/libs/sync/src/syncUtil.c b/source/libs/sync/src/syncUtil.c
index 6a50572cba999e7936513beabe551ea60f6536d4..a519c76cda53a5f66faeaefa17f56053c5d083e6 100644
--- a/source/libs/sync/src/syncUtil.c
+++ b/source/libs/sync/src/syncUtil.c
@@ -43,7 +43,7 @@ void syncUtilNodeInfo2EpSet(const SNodeInfo* pInfo, SEpSet* pEpSet) {
bool syncUtilNodeInfo2RaftId(const SNodeInfo* pInfo, SyncGroupId vgId, SRaftId* raftId) {
uint32_t ipv4 = taosGetIpv4FromFqdn(pInfo->nodeFqdn);
if (ipv4 == 0xFFFFFFFF || ipv4 == 1) {
- sError("failed to resolve ipv4 addr, fqdn: %s", pInfo->nodeFqdn);
+ sError("failed to resolve ipv4 addr, fqdn:%s", pInfo->nodeFqdn);
terrno = TSDB_CODE_TSC_INVALID_FQDN;
return false;
}
@@ -154,7 +154,7 @@ static void syncPeerState2Str(SSyncNode* pSyncNode, char* buf, int32_t bufLen) {
void syncPrintNodeLog(const char* flags, ELogLevel level, int32_t dflag, SSyncNode* pNode, const char* format, ...) {
if (pNode == NULL || pNode->pLogStore == NULL) return;
- int64_t currentTerm = pNode->raftStore.currentTerm;
+ int64_t currentTerm = raftStoreGetTerm(pNode);
// save error code, otherwise it will be overwritten
int32_t errCode = terrno;
@@ -260,7 +260,7 @@ void syncPrintSnapshotSenderLog(const char* flags, ELogLevel level, int32_t dfla
pNode->vgId, eventLog, syncStr(pNode->state), pSender, pSender->snapshotParam.start,
pSender->snapshotParam.end, pSender->snapshot.lastApplyIndex, pSender->snapshot.lastApplyTerm,
pSender->snapshot.lastConfigIndex, pSender->seq, pSender->ack, pSender->finish, pSender->replicaIndex,
- DID(&pNode->replicasId[pSender->replicaIndex]), pNode->raftStore.currentTerm, pNode->commitIndex,
+ DID(&pNode->replicasId[pSender->replicaIndex]), raftStoreGetTerm(pNode), pNode->commitIndex,
logBeginIndex, logLastIndex, pNode->minMatchIndex, snapshot.lastApplyIndex, snapshot.lastApplyTerm,
pNode->raftCfg.isStandBy, pNode->raftCfg.batchSize, pNode->replicaNum, pNode->raftCfg.lastConfigIndex,
pNode->changing, pNode->restoreFinish, syncNodeDynamicQuorum(pNode), pNode->electTimerLogicClock,
@@ -308,7 +308,7 @@ void syncPrintSnapshotReceiverLog(const char* flags, ELogLevel level, int32_t df
pNode->vgId, eventLog, syncStr(pNode->state), pReceiver, pReceiver->start, pReceiver->ack, pReceiver->term,
pReceiver->startTime, DID(&pReceiver->fromId), pReceiver->snapshotParam.start, pReceiver->snapshotParam.end,
pReceiver->snapshot.lastApplyIndex, pReceiver->snapshot.lastApplyTerm, pReceiver->snapshot.lastConfigIndex,
- pNode->raftStore.currentTerm, pNode->commitIndex, logBeginIndex, logLastIndex, pNode->minMatchIndex,
+ raftStoreGetTerm(pNode), pNode->commitIndex, logBeginIndex, logLastIndex, pNode->minMatchIndex,
snapshot.lastApplyIndex, snapshot.lastApplyTerm, pNode->raftCfg.isStandBy, pNode->raftCfg.batchSize,
pNode->replicaNum, pNode->raftCfg.lastConfigIndex, pNode->changing, pNode->restoreFinish,
syncNodeDynamicQuorum(pNode), pNode->electTimerLogicClock, pNode->heartbeatTimerLogicClockUser, peerStr, cfgStr);
diff --git a/source/libs/sync/test/sync_test_lib/src/syncMainDebug.c b/source/libs/sync/test/sync_test_lib/src/syncMainDebug.c
index 1dbf4fb4fb70333d6a0cf0cb0a61138e58877504..18a75934fd6e5a5d96f63fad7d66b85f9c739932 100644
--- a/source/libs/sync/test/sync_test_lib/src/syncMainDebug.c
+++ b/source/libs/sync/test/sync_test_lib/src/syncMainDebug.c
@@ -199,7 +199,7 @@ inline char* syncNode2SimpleStr(const SSyncNode* pSyncNode) {
", sby:%d, "
"r-num:%d, "
"lcfg:%" PRId64 ", chging:%d, rsto:%d",
- pSyncNode->vgId, syncStr(pSyncNode->state), pSyncNode->raftStore.currentTerm, pSyncNode->commitIndex,
+ pSyncNode->vgId, syncStr(pSyncNode->state), raftStoreGetTerm(pSyncNode), pSyncNode->commitIndex,
logBeginIndex, logLastIndex, snapshot.lastApplyIndex, pSyncNode->raftCfg.isStandBy, pSyncNode->replicaNum,
pSyncNode->raftCfg.lastConfigIndex, pSyncNode->changing, pSyncNode->restoreFinish);
diff --git a/source/libs/sync/test/sync_test_lib/src/syncSnapshotDebug.c b/source/libs/sync/test/sync_test_lib/src/syncSnapshotDebug.c
index d8740de16ae46214c8c5ed2ab2e1d622c003c300..2edcb0ad4dc4c8e593f842ee967a863b1b3019dd 100644
--- a/source/libs/sync/test/sync_test_lib/src/syncSnapshotDebug.c
+++ b/source/libs/sync/test/sync_test_lib/src/syncSnapshotDebug.c
@@ -137,7 +137,7 @@ int32_t syncNodeOnPreSnapshot(SSyncNode *ths, SyncPreSnapshot *pMsg) {
SyncPreSnapshotReply *pMsgReply = syncPreSnapshotReplyBuild(ths->vgId);
pMsgReply->srcId = ths->myRaftId;
pMsgReply->destId = pMsg->srcId;
- pMsgReply->term = ths->raftStore.currentTerm;
+ pMsgReply->term = raftStoreGetTerm(ths);
SSyncLogStoreData *pData = ths->pLogStore->data;
SWal *pWal = pData->pWal;
diff --git a/source/libs/tdb/src/db/tdbPage.c b/source/libs/tdb/src/db/tdbPage.c
index 50dc8e0a6506abf40cd85b33acdd0e50f737168b..dc448c986e628b4c7af9dd03aa84706c8053da71 100644
--- a/source/libs/tdb/src/db/tdbPage.c
+++ b/source/libs/tdb/src/db/tdbPage.c
@@ -404,62 +404,50 @@ static int tdbPageFree(SPage *pPage, int idx, SCell *pCell, int szCell) {
return 0;
}
+typedef struct {
+ int32_t iCell;
+ int32_t offset;
+} SCellIdx;
+static int32_t tCellIdxCmprFn(const void *p1, const void *p2) {
+ if (((SCellIdx *)p1)->offset < ((SCellIdx *)p2)->offset) {
+ return -1;
+ } else if (((SCellIdx *)p1)->offset > ((SCellIdx *)p2)->offset) {
+ return 1;
+ } else {
+ return 0;
+ }
+}
static int tdbPageDefragment(SPage *pPage) {
- int nFree;
- int nCells;
- SCell *pCell;
- SCell *pNextCell;
- SCell *pTCell;
- int szCell;
- int idx;
- int iCell;
-
- nFree = TDB_PAGE_NFREE(pPage);
- nCells = TDB_PAGE_NCELLS(pPage);
-
- ASSERT(pPage->pFreeEnd - pPage->pFreeStart < nFree);
-
- // Loop to compact the page content
- // Here we use an O(n^2) algorithm to do the job since
- // this is a low frequency job.
- pNextCell = (u8 *)pPage->pPageFtr;
- pCell = NULL;
- for (iCell = 0;; iCell++) {
- // compact over
- if (iCell == nCells) {
- pPage->pFreeEnd = pNextCell;
- break;
- }
-
- for (int i = 0; i < nCells; i++) {
- if (TDB_PAGE_CELL_OFFSET_AT(pPage, i) < pNextCell - pPage->pData) {
- pTCell = TDB_PAGE_CELL_AT(pPage, i);
- if (pCell == NULL || pCell < pTCell) {
- pCell = pTCell;
- idx = i;
- }
- } else {
- continue;
- }
- }
+ int32_t nFree = TDB_PAGE_NFREE(pPage);
+ int32_t nCell = TDB_PAGE_NCELLS(pPage);
+
+ SCellIdx *aCellIdx = (SCellIdx *)tdbOsMalloc(sizeof(SCellIdx) * nCell);
+ if (aCellIdx == NULL) return -1;
+ for (int32_t iCell = 0; iCell < nCell; iCell++) {
+ aCellIdx[iCell].iCell = iCell;
+ aCellIdx[iCell].offset = TDB_PAGE_CELL_OFFSET_AT(pPage, iCell);
+ }
+ taosSort(aCellIdx, nCell, sizeof(SCellIdx), tCellIdxCmprFn);
- ASSERT(pCell != NULL);
+ SCell *pNextCell = (u8 *)pPage->pPageFtr;
+ for (int32_t iCell = nCell - 1; iCell >= 0; iCell--) {
+ SCell *pCell = TDB_PAGE_CELL_AT(pPage, aCellIdx[iCell].iCell);
+ int32_t szCell = pPage->xCellSize(pPage, pCell, 0, NULL, NULL);
- szCell = (*pPage->xCellSize)(pPage, pCell, 0, NULL, NULL);
+ ASSERT(pNextCell - szCell >= pCell);
- ASSERT(pCell + szCell <= pNextCell);
- if (pCell + szCell < pNextCell) {
- memmove(pNextCell - szCell, pCell, szCell);
+ pNextCell -= szCell;
+ if (pNextCell > pCell) {
+ memmove(pNextCell, pCell, szCell);
+ TDB_PAGE_CELL_OFFSET_AT_SET(pPage, aCellIdx[iCell].iCell, pNextCell - pPage->pData);
}
-
- pCell = NULL;
- pNextCell = pNextCell - szCell;
- TDB_PAGE_CELL_OFFSET_AT_SET(pPage, idx, pNextCell - pPage->pData);
}
-
- ASSERT(pPage->pFreeEnd - pPage->pFreeStart == nFree);
+ pPage->pFreeEnd = pNextCell;
TDB_PAGE_CCELLS_SET(pPage, pPage->pFreeEnd - pPage->pData);
TDB_PAGE_FCELL_SET(pPage, 0);
+ tdbOsFree(aCellIdx);
+
+ ASSERT(pPage->pFreeEnd - pPage->pFreeStart == nFree);
return 0;
}
diff --git a/source/libs/tdb/test/CMakeLists.txt b/source/libs/tdb/test/CMakeLists.txt
index 2621e02b02b9a9a28ec29c58b657202f8522a894..fd4d7c101d06ce73de37678e858716326e83feee 100644
--- a/source/libs/tdb/test/CMakeLists.txt
+++ b/source/libs/tdb/test/CMakeLists.txt
@@ -6,7 +6,11 @@ target_link_libraries(tdbTest tdb gtest gtest_main)
add_executable(tdbUtilTest "tdbUtilTest.cpp")
target_link_libraries(tdbUtilTest tdb gtest gtest_main)
-# tdbUtilTest
+# overflow pages testing
add_executable(tdbExOVFLTest "tdbExOVFLTest.cpp")
target_link_libraries(tdbExOVFLTest tdb gtest gtest_main)
+# page defragment testing
+add_executable(tdbPageDefragmentTest "tdbPageDefragmentTest.cpp")
+target_link_libraries(tdbPageDefragmentTest tdb gtest gtest_main)
+
diff --git a/source/libs/tdb/test/tdbPageDefragmentTest.cpp b/source/libs/tdb/test/tdbPageDefragmentTest.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..7aeef94d14bb0a4b8441de3421185beaf45caf1a
--- /dev/null
+++ b/source/libs/tdb/test/tdbPageDefragmentTest.cpp
@@ -0,0 +1,722 @@
+#include
+
+#define ALLOW_FORBID_FUNC
+#include "os.h"
+#include "tdb.h"
+
+#include
+#include
+#include
+#include
+#include "tlog.h"
+
+typedef struct SPoolMem {
+ int64_t size;
+ struct SPoolMem *prev;
+ struct SPoolMem *next;
+} SPoolMem;
+
+static SPoolMem *openPool() {
+ SPoolMem *pPool = (SPoolMem *)taosMemoryMalloc(sizeof(*pPool));
+
+ pPool->prev = pPool->next = pPool;
+ pPool->size = 0;
+
+ return pPool;
+}
+
+static void clearPool(SPoolMem *pPool) {
+ SPoolMem *pMem;
+
+ do {
+ pMem = pPool->next;
+
+ if (pMem == pPool) break;
+
+ pMem->next->prev = pMem->prev;
+ pMem->prev->next = pMem->next;
+ pPool->size -= pMem->size;
+
+ taosMemoryFree(pMem);
+ } while (1);
+
+ assert(pPool->size == 0);
+}
+
+static void closePool(SPoolMem *pPool) {
+ clearPool(pPool);
+ taosMemoryFree(pPool);
+}
+
+static void *poolMalloc(void *arg, size_t size) {
+ void *ptr = NULL;
+ SPoolMem *pPool = (SPoolMem *)arg;
+ SPoolMem *pMem;
+
+ pMem = (SPoolMem *)taosMemoryMalloc(sizeof(*pMem) + size);
+ if (pMem == NULL) {
+ assert(0);
+ }
+
+ pMem->size = sizeof(*pMem) + size;
+ pMem->next = pPool->next;
+ pMem->prev = pPool;
+
+ pPool->next->prev = pMem;
+ pPool->next = pMem;
+ pPool->size += pMem->size;
+
+ ptr = (void *)(&pMem[1]);
+ return ptr;
+}
+
+static void poolFree(void *arg, void *ptr) {
+ SPoolMem *pPool = (SPoolMem *)arg;
+ SPoolMem *pMem;
+
+ pMem = &(((SPoolMem *)ptr)[-1]);
+
+ pMem->next->prev = pMem->prev;
+ pMem->prev->next = pMem->next;
+ pPool->size -= pMem->size;
+
+ taosMemoryFree(pMem);
+}
+
+static int tKeyCmpr(const void *pKey1, int kLen1, const void *pKey2, int kLen2) {
+ int k1, k2;
+
+ std::string s1((char *)pKey1 + 3, kLen1 - 3);
+ std::string s2((char *)pKey2 + 3, kLen2 - 3);
+ k1 = stoi(s1);
+ k2 = stoi(s2);
+
+ if (k1 < k2) {
+ return -1;
+ } else if (k1 > k2) {
+ return 1;
+ } else {
+ return 0;
+ }
+}
+
+static int tDefaultKeyCmpr(const void *pKey1, int keyLen1, const void *pKey2, int keyLen2) {
+ int mlen;
+ int cret;
+
+ ASSERT(keyLen1 > 0 && keyLen2 > 0 && pKey1 != NULL && pKey2 != NULL);
+
+ mlen = keyLen1 < keyLen2 ? keyLen1 : keyLen2;
+ cret = memcmp(pKey1, pKey2, mlen);
+ if (cret == 0) {
+ if (keyLen1 < keyLen2) {
+ cret = -1;
+ } else if (keyLen1 > keyLen2) {
+ cret = 1;
+ } else {
+ cret = 0;
+ }
+ }
+ return cret;
+}
+
+// TEST(TdbPageDefragmentTest, DISABLED_TbUpsertTest) {
+// TEST(TdbPageDefragmentTest, TbUpsertTest) {
+//}
+
+// TEST(TdbPageDefragmentTest, DISABLED_TbPGetTest) {
+// TEST(TdbPageDefragmentTest, TbPGetTest) {
+//}
+
+static void generateBigVal(char *val, int valLen) {
+ for (int i = 0; i < valLen; ++i) {
+ char c = char(i & 0xff);
+ if (c == 0) {
+ c = 1;
+ }
+ val[i] = c;
+ }
+}
+
+static TDB *openEnv(char const *envName, int const pageSize, int const pageNum) {
+ TDB *pEnv = NULL;
+
+ int ret = tdbOpen(envName, pageSize, pageNum, &pEnv, 0);
+ if (ret) {
+ pEnv = NULL;
+ }
+
+ return pEnv;
+}
+
+static void insertOfp(void) {
+ int ret = 0;
+
+ taosRemoveDir("tdb");
+
+ // open Env
+ int const pageSize = 4096;
+ int const pageNum = 64;
+ TDB *pEnv = openEnv("tdb", pageSize, pageNum);
+ GTEST_ASSERT_NE(pEnv, nullptr);
+
+ // open db
+ TTB *pDb = NULL;
+ tdb_cmpr_fn_t compFunc = tKeyCmpr;
+ // ret = tdbTbOpen("ofp_insert.db", -1, -1, compFunc, pEnv, &pDb, 0);
+ ret = tdbTbOpen("ofp_insert.db", 12, -1, compFunc, pEnv, &pDb, 0);
+ GTEST_ASSERT_EQ(ret, 0);
+
+ // open the pool
+ SPoolMem *pPool = openPool();
+
+ // start a transaction
+ TXN *txn = NULL;
+
+ tdbBegin(pEnv, &txn, poolMalloc, poolFree, pPool, TDB_TXN_WRITE | TDB_TXN_READ_UNCOMMITTED);
+
+ // generate value payload
+ // char val[((4083 - 4 - 3 - 2) + 1) * 100]; // pSize(4096) - amSize(1) - pageHdr(8) - footerSize(4)
+ char val[32605];
+ int valLen = sizeof(val) / sizeof(val[0]);
+ generateBigVal(val, valLen);
+
+ // insert the generated big data
+ // char const *key = "key1";
+ char const *key = "key123456789";
+ ret = tdbTbInsert(pDb, key, strlen(key), val, valLen, txn);
+ GTEST_ASSERT_EQ(ret, 0);
+
+ // commit current transaction
+ tdbCommit(pEnv, txn);
+ tdbPostCommit(pEnv, txn);
+}
+
+TEST(TdbPageDefragmentTest, DISABLED_TbInsertTest) {
+ // TEST(TdbPageDefragmentTest, TbInsertTest) {
+ // ofp inserting
+ insertOfp();
+}
+
+TEST(TdbPageDefragmentTest, DISABLED_TbGetTest) {
+ // TEST(TdbPageDefragmentTest, TbGetTest) {
+ insertOfp();
+
+ // open Env
+ int const pageSize = 4096;
+ int const pageNum = 64;
+ TDB *pEnv = openEnv("tdb", pageSize, pageNum);
+ GTEST_ASSERT_NE(pEnv, nullptr);
+
+ // open db
+ TTB *pDb = NULL;
+ tdb_cmpr_fn_t compFunc = tKeyCmpr;
+ // int ret = tdbTbOpen("ofp_insert.db", -1, -1, compFunc, pEnv, &pDb, 0);
+ int ret = tdbTbOpen("ofp_insert.db", 12, -1, compFunc, pEnv, &pDb, 0);
+ GTEST_ASSERT_EQ(ret, 0);
+
+ // generate value payload
+ // char val[((4083 - 4 - 3 - 2) + 1) * 100]; // pSize(4096) - amSize(1) - pageHdr(8) - footerSize(4)
+ char val[32605];
+ int valLen = sizeof(val) / sizeof(val[0]);
+ generateBigVal(val, valLen);
+
+ { // Query the data
+ void *pVal = NULL;
+ int vLen;
+
+ // char const *key = "key1";
+ char const *key = "key123456789";
+ ret = tdbTbGet(pDb, key, strlen(key), &pVal, &vLen);
+ ASSERT(ret == 0);
+ GTEST_ASSERT_EQ(ret, 0);
+
+ GTEST_ASSERT_EQ(vLen, valLen);
+ GTEST_ASSERT_EQ(memcmp(val, pVal, vLen), 0);
+
+ tdbFree(pVal);
+ }
+}
+
+TEST(TdbPageDefragmentTest, DISABLED_TbDeleteTest) {
+ // TEST(TdbPageDefragmentTest, TbDeleteTest) {
+ int ret = 0;
+
+ taosRemoveDir("tdb");
+
+ // open Env
+ int const pageSize = 4096;
+ int const pageNum = 64;
+ TDB *pEnv = openEnv("tdb", pageSize, pageNum);
+ GTEST_ASSERT_NE(pEnv, nullptr);
+
+ // open db
+ TTB *pDb = NULL;
+ tdb_cmpr_fn_t compFunc = tKeyCmpr;
+ ret = tdbTbOpen("ofp_insert.db", -1, -1, compFunc, pEnv, &pDb, 0);
+ GTEST_ASSERT_EQ(ret, 0);
+
+ // open the pool
+ SPoolMem *pPool = openPool();
+
+ // start a transaction
+ TXN *txn;
+
+ tdbBegin(pEnv, &txn, poolMalloc, poolFree, pPool, TDB_TXN_WRITE | TDB_TXN_READ_UNCOMMITTED);
+
+ // generate value payload
+ // char val[((4083 - 4 - 3 - 2) + 1) * 100]; // pSize(4096) - amSize(1) - pageHdr(8) - footerSize(4)
+ char val[((4083 - 4 - 3 - 2) + 1) * 2]; // pSize(4096) - amSize(1) - pageHdr(8) - footerSize(4)
+ int valLen = sizeof(val) / sizeof(val[0]);
+ generateBigVal(val, valLen);
+
+ { // insert the generated big data
+ ret = tdbTbInsert(pDb, "key1", strlen("key1"), val, valLen, txn);
+ GTEST_ASSERT_EQ(ret, 0);
+ }
+
+ { // query the data
+ void *pVal = NULL;
+ int vLen;
+
+ ret = tdbTbGet(pDb, "key1", strlen("key1"), &pVal, &vLen);
+ ASSERT(ret == 0);
+ GTEST_ASSERT_EQ(ret, 0);
+
+ GTEST_ASSERT_EQ(vLen, valLen);
+ GTEST_ASSERT_EQ(memcmp(val, pVal, vLen), 0);
+
+ tdbFree(pVal);
+ }
+ /* open to debug committed file
+tdbCommit(pEnv, &txn);
+tdbTxnClose(&txn);
+
+++txnid;
+tdbTxnOpen(&txn, txnid, poolMalloc, poolFree, pPool, TDB_TXN_WRITE | TDB_TXN_READ_UNCOMMITTED);
+tdbBegin(pEnv, &txn);
+ */
+ { // upsert the data
+ ret = tdbTbUpsert(pDb, "key1", strlen("key1"), "value1", strlen("value1"), txn);
+ GTEST_ASSERT_EQ(ret, 0);
+ }
+
+ { // query the upserted data
+ void *pVal = NULL;
+ int vLen;
+
+ ret = tdbTbGet(pDb, "key1", strlen("key1"), &pVal, &vLen);
+ ASSERT(ret == 0);
+ GTEST_ASSERT_EQ(ret, 0);
+
+ GTEST_ASSERT_EQ(vLen, strlen("value1"));
+ GTEST_ASSERT_EQ(memcmp("value1", pVal, vLen), 0);
+
+ tdbFree(pVal);
+ }
+
+ { // delete the data
+ ret = tdbTbDelete(pDb, "key1", strlen("key1"), txn);
+ GTEST_ASSERT_EQ(ret, 0);
+ }
+
+ { // query the deleted data
+ void *pVal = NULL;
+ int vLen = -1;
+
+ ret = tdbTbGet(pDb, "key1", strlen("key1"), &pVal, &vLen);
+ ASSERT(ret == -1);
+ GTEST_ASSERT_EQ(ret, -1);
+
+ GTEST_ASSERT_EQ(vLen, -1);
+ GTEST_ASSERT_EQ(pVal, nullptr);
+
+ tdbFree(pVal);
+ }
+
+ // commit current transaction
+ tdbCommit(pEnv, txn);
+ tdbPostCommit(pEnv, txn);
+}
+
+TEST(TdbPageDefragmentTest, DISABLED_simple_insert1) {
+ // TEST(TdbPageDefragmentTest, simple_insert1) {
+ int ret;
+ TDB *pEnv;
+ TTB *pDb;
+ tdb_cmpr_fn_t compFunc;
+ int nData = 1;
+ TXN *txn;
+ int const pageSize = 4096;
+
+ taosRemoveDir("tdb");
+
+ // Open Env
+ ret = tdbOpen("tdb", pageSize, 64, &pEnv, 0);
+ GTEST_ASSERT_EQ(ret, 0);
+
+ // Create a database
+ compFunc = tKeyCmpr;
+ ret = tdbTbOpen("db.db", -1, -1, compFunc, pEnv, &pDb, 0);
+ GTEST_ASSERT_EQ(ret, 0);
+
+ {
+ char key[64];
+ // char val[(4083 - 4 - 3 - 2)]; // pSize(4096) - amSize(1) - pageHdr(8) - footerSize(4)
+ char val[(4083 - 4 - 3 - 2) + 1]; // pSize(4096) - amSize(1) - pageHdr(8) - footerSize(4)
+ int64_t poolLimit = 4096; // 1M pool limit
+ SPoolMem *pPool;
+
+ // open the pool
+ pPool = openPool();
+
+ // start a transaction
+ tdbBegin(pEnv, &txn, poolMalloc, poolFree, pPool, TDB_TXN_WRITE | TDB_TXN_READ_UNCOMMITTED);
+
+ for (int iData = 1; iData <= nData; iData++) {
+ sprintf(key, "key0");
+ sprintf(val, "value%d", iData);
+
+ // ret = tdbTbInsert(pDb, key, strlen(key), val, strlen(val), &txn);
+ // GTEST_ASSERT_EQ(ret, 0);
+
+ // generate value payload
+ int valLen = sizeof(val) / sizeof(val[0]);
+ for (int i = 6; i < valLen; ++i) {
+ char c = char(i & 0xff);
+ if (c == 0) {
+ c = 1;
+ }
+ val[i] = c;
+ }
+
+ ret = tdbTbInsert(pDb, "key1", strlen("key1"), val, valLen, txn);
+ GTEST_ASSERT_EQ(ret, 0);
+
+ // if pool is full, commit the transaction and start a new one
+ if (pPool->size >= poolLimit) {
+ // commit current transaction
+ tdbCommit(pEnv, txn);
+ tdbPostCommit(pEnv, txn);
+
+ // start a new transaction
+ clearPool(pPool);
+
+ tdbBegin(pEnv, &txn, poolMalloc, poolFree, pPool, TDB_TXN_WRITE | TDB_TXN_READ_UNCOMMITTED);
+ }
+ }
+
+ // commit the transaction
+ tdbCommit(pEnv, txn);
+ tdbPostCommit(pEnv, txn);
+
+ { // Query the data
+ void *pVal = NULL;
+ int vLen;
+
+ for (int i = 1; i <= nData; i++) {
+ sprintf(key, "key%d", i);
+ // sprintf(val, "value%d", i);
+
+ ret = tdbTbGet(pDb, key, strlen(key), &pVal, &vLen);
+ ASSERT(ret == 0);
+ GTEST_ASSERT_EQ(ret, 0);
+
+ GTEST_ASSERT_EQ(vLen, sizeof(val) / sizeof(val[0]));
+ GTEST_ASSERT_EQ(memcmp(val, pVal, vLen), 0);
+ }
+
+ tdbFree(pVal);
+ }
+
+ { // Iterate to query the DB data
+ TBC *pDBC;
+ void *pKey = NULL;
+ void *pVal = NULL;
+ int vLen, kLen;
+ int count = 0;
+
+ ret = tdbTbcOpen(pDb, &pDBC, NULL);
+ GTEST_ASSERT_EQ(ret, 0);
+
+ tdbTbcMoveToFirst(pDBC);
+
+ for (;;) {
+ ret = tdbTbcNext(pDBC, &pKey, &kLen, &pVal, &vLen);
+ if (ret < 0) break;
+
+ // std::cout.write((char *)pKey, kLen) /* << " " << kLen */ << " ";
+ // std::cout.write((char *)pVal, vLen) /* << " " << vLen */;
+ // std::cout << std::endl;
+
+ count++;
+ }
+
+ GTEST_ASSERT_EQ(count, nData);
+
+ tdbTbcClose(pDBC);
+
+ tdbFree(pKey);
+ tdbFree(pVal);
+ }
+ }
+
+ ret = tdbTbDrop(pDb);
+ GTEST_ASSERT_EQ(ret, 0);
+
+ // Close a database
+ tdbTbClose(pDb);
+
+ // Close Env
+ ret = tdbClose(pEnv);
+ GTEST_ASSERT_EQ(ret, 0);
+}
+
+// TEST(TdbPageDefragmentTest, DISABLED_seq_insert) {
+TEST(TdbPageDefragmentTest, seq_insert) {
+ int ret = 0;
+ TDB *pEnv = NULL;
+ TTB *pDb = NULL;
+ tdb_cmpr_fn_t compFunc;
+ int nData = 64 * 1024;
+ TXN *txn = NULL;
+ int const pageSize = 1 * 1024 * 1024;
+
+ taosRemoveDir("tdb");
+
+ // Open Env
+ ret = tdbOpen("tdb", pageSize, 64, &pEnv, 0);
+ GTEST_ASSERT_EQ(ret, 0);
+
+ // Create a database
+ compFunc = tKeyCmpr;
+ ret = tdbTbOpen("db.db", -1, -1, compFunc, pEnv, &pDb, 0);
+ GTEST_ASSERT_EQ(ret, 0);
+
+ // 1, insert nData kv
+ {
+ char key[64];
+ // char val[(4083 - 4 - 3 - 2)]; // pSize(4096) - amSize(1) - pageHdr(8) - footerSize(4)
+ char val[(4083 - 4 - 3 - 2) + 1]; // pSize(4096) - amSize(1) - pageHdr(8) - footerSize(4)
+ int64_t poolLimit = 4096; // 1M pool limit
+ SPoolMem *pPool;
+
+ // open the pool
+ pPool = openPool();
+
+ // start a transaction
+ tdbBegin(pEnv, &txn, poolMalloc, poolFree, pPool, TDB_TXN_WRITE | TDB_TXN_READ_UNCOMMITTED);
+
+ for (int iData = 0; iData < nData; ++iData) {
+ sprintf(key, "key%d", iData);
+ sprintf(val, "value%d", iData);
+
+ ret = tdbTbInsert(pDb, key, strlen(key), val, strlen(val), txn);
+ GTEST_ASSERT_EQ(ret, 0);
+ /*
+ // generate value payload
+ int valLen = sizeof(val) / sizeof(val[0]);
+ for (int i = 6; i < valLen; ++i) {
+ char c = char(i & 0xff);
+ if (c == 0) {
+ c = 1;
+ }
+ val[i] = c;
+ }
+
+ ret = tdbTbInsert(pDb, key, strlen(key), val, valLen, txn);
+ GTEST_ASSERT_EQ(ret, 0);
+ */
+ // if pool is full, commit the transaction and start a new one
+ if (pPool->size >= poolLimit) {
+ // commit current transaction
+ tdbCommit(pEnv, txn);
+ tdbPostCommit(pEnv, txn);
+
+ // start a new transaction
+ clearPool(pPool);
+
+ tdbBegin(pEnv, &txn, poolMalloc, poolFree, pPool, TDB_TXN_WRITE | TDB_TXN_READ_UNCOMMITTED);
+ }
+ }
+
+ // commit the transaction
+ tdbCommit(pEnv, txn);
+ tdbPostCommit(pEnv, txn);
+
+ // 2, delete nData/2 records
+ }
+
+ // Close a database
+ tdbTbClose(pDb);
+
+ // Close Env
+ ret = tdbClose(pEnv);
+ GTEST_ASSERT_EQ(ret, 0);
+}
+
+// TEST(TdbPageDefragmentTest, DISABLED_seq_delete) {
+TEST(TdbPageDefragmentTest, seq_delete) {
+ int ret = 0;
+ TDB *pEnv = NULL;
+ TTB *pDb = NULL;
+ tdb_cmpr_fn_t compFunc;
+ int nData = 64 * 1024;
+ TXN *txn = NULL;
+ int const pageSize = 1 * 1024 * 1024;
+
+ // Open Env
+ ret = tdbOpen("tdb", pageSize, 64, &pEnv, 0);
+ GTEST_ASSERT_EQ(ret, 0);
+
+ // Create a database
+ compFunc = tKeyCmpr;
+ ret = tdbTbOpen("db.db", -1, -1, compFunc, pEnv, &pDb, 0);
+ GTEST_ASSERT_EQ(ret, 0);
+
+ // 2, delete nData/2 records
+ {
+ char key[64];
+ // char val[(4083 - 4 - 3 - 2)]; // pSize(4096) - amSize(1) - pageHdr(8) - footerSize(4)
+ char val[(4083 - 4 - 3 - 2) + 1]; // pSize(4096) - amSize(1) - pageHdr(8) - footerSize(4)
+ int64_t poolLimit = 4096; // 1M pool limit
+ SPoolMem *pPool;
+
+ // open the pool
+ pPool = openPool();
+
+ // start a transaction
+ tdbBegin(pEnv, &txn, poolMalloc, poolFree, pPool, TDB_TXN_WRITE | TDB_TXN_READ_UNCOMMITTED);
+
+ for (int iData = 1; iData <= nData; iData++) {
+ if (iData % 2 == 0) continue;
+
+ sprintf(key, "key%d", iData);
+ sprintf(val, "value%d", iData);
+
+ { // delete the data
+ ret = tdbTbDelete(pDb, key, strlen(key), txn);
+ GTEST_ASSERT_EQ(ret, 0);
+ }
+
+ /*
+ // generate value payload
+ int valLen = sizeof(val) / sizeof(val[0]);
+ for (int i = 6; i < valLen; ++i) {
+ char c = char(i & 0xff);
+ if (c == 0) {
+ c = 1;
+ }
+ val[i] = c;
+ }
+
+ ret = tdbTbInsert(pDb, key, strlen(key), val, valLen, txn);
+ GTEST_ASSERT_EQ(ret, 0);
+ */
+ // if pool is full, commit the transaction and start a new one
+ if (pPool->size >= poolLimit) {
+ // commit current transaction
+ tdbCommit(pEnv, txn);
+ tdbPostCommit(pEnv, txn);
+
+ // start a new transaction
+ clearPool(pPool);
+
+ tdbBegin(pEnv, &txn, poolMalloc, poolFree, pPool, TDB_TXN_WRITE | TDB_TXN_READ_UNCOMMITTED);
+ }
+ }
+
+ // commit the transaction
+ tdbCommit(pEnv, txn);
+ tdbPostCommit(pEnv, txn);
+ }
+
+ // Close a database
+ tdbTbClose(pDb);
+
+ // Close Env
+ ret = tdbClose(pEnv);
+ GTEST_ASSERT_EQ(ret, 0);
+}
+
+// TEST(TdbPageDefragmentTest, DISABLED_defragment_insert) {
+TEST(TdbPageDefragmentTest, defragment_insert) {
+ int ret = 0;
+ TDB *pEnv = NULL;
+ TTB *pDb = NULL;
+ tdb_cmpr_fn_t compFunc;
+ int nData = 64 * 1024;
+ TXN *txn = NULL;
+ int const pageSize = 1 * 1024 * 1024;
+
+ // Open Env
+ ret = tdbOpen("tdb", pageSize, 64, &pEnv, 0);
+ GTEST_ASSERT_EQ(ret, 0);
+
+ // Create a database
+ compFunc = tKeyCmpr;
+ ret = tdbTbOpen("db.db", -1, -1, compFunc, pEnv, &pDb, 0);
+ GTEST_ASSERT_EQ(ret, 0);
+
+ // 3, insert 32k records
+ {
+ char key[64];
+ // char val[(4083 - 4 - 3 - 2)]; // pSize(4096) - amSize(1) - pageHdr(8) - footerSize(4)
+ char val[(4083 - 4 - 3 - 2) + 1]; // pSize(4096) - amSize(1) - pageHdr(8) - footerSize(4)
+ int64_t poolLimit = 4096; // 1M pool limit
+ SPoolMem *pPool;
+
+ // open the pool
+ pPool = openPool();
+
+ // start a transaction
+ tdbBegin(pEnv, &txn, poolMalloc, poolFree, pPool, TDB_TXN_WRITE | TDB_TXN_READ_UNCOMMITTED);
+
+ for (int iData = nData + 1; iData <= nData * 2; iData++) {
+ // if (iData % 2 == 0) continue;
+ sprintf(key, "key%d", iData);
+ sprintf(val, "value%d", iData);
+
+ ret = tdbTbInsert(pDb, key, strlen(key), val, strlen(val), txn);
+ GTEST_ASSERT_EQ(ret, 0);
+ /*
+ // generate value payload
+ int valLen = sizeof(val) / sizeof(val[0]);
+ for (int i = 6; i < valLen; ++i) {
+ char c = char(i & 0xff);
+ if (c == 0) {
+ c = 1;
+ }
+ val[i] = c;
+ }
+
+ ret = tdbTbInsert(pDb, key, strlen(key), val, valLen, txn);
+ GTEST_ASSERT_EQ(ret, 0);
+ */
+ // if pool is full, commit the transaction and start a new one
+ if (pPool->size >= poolLimit) {
+ // commit current transaction
+ tdbCommit(pEnv, txn);
+ tdbPostCommit(pEnv, txn);
+
+ // start a new transaction
+ clearPool(pPool);
+
+ tdbBegin(pEnv, &txn, poolMalloc, poolFree, pPool, TDB_TXN_WRITE | TDB_TXN_READ_UNCOMMITTED);
+ }
+ }
+
+ // commit the transaction
+ tdbCommit(pEnv, txn);
+ tdbPostCommit(pEnv, txn);
+
+ // 2, delete nData/2 records
+ }
+
+ // Close a database
+ tdbTbClose(pDb);
+
+ // Close Env
+ ret = tdbClose(pEnv);
+ GTEST_ASSERT_EQ(ret, 0);
+}
diff --git a/source/libs/tfs/src/tfs.c b/source/libs/tfs/src/tfs.c
index 943611ee27c6f1d6bfa51dfff211bf723764f88f..6c96bd1dcb44c62073ab37a7725cfc83932167cd 100644
--- a/source/libs/tfs/src/tfs.c
+++ b/source/libs/tfs/src/tfs.c
@@ -80,7 +80,7 @@ STfs *tfsOpen(SDiskCfg *pCfg, int32_t ndisk) {
void tfsClose(STfs *pTfs) {
if (pTfs == NULL) return;
- for (int32_t level = 0; level < TFS_MAX_LEVEL; level++) {
+ for (int32_t level = 0; level <= TFS_MAX_LEVEL; level++) {
tfsDestroyTier(&pTfs->tiers[level]);
}
diff --git a/source/libs/transport/inc/transComm.h b/source/libs/transport/inc/transComm.h
index 5f964f6b1ab0e7145f61b25e2e51a1a1d1c86a9e..a41cc0068c3e906ffba65f4bad0feb8847665a55 100644
--- a/source/libs/transport/inc/transComm.h
+++ b/source/libs/transport/inc/transComm.h
@@ -94,8 +94,8 @@ typedef void* queue[2];
/* Return the structure holding the given element. */
#define QUEUE_DATA(e, type, field) ((type*)((void*)((char*)(e)-offsetof(type, field))))
-//#define TRANS_RETRY_COUNT_LIMIT 100 // retry count limit
-//#define TRANS_RETRY_INTERVAL 15 // retry interval (ms)
+// #define TRANS_RETRY_COUNT_LIMIT 100 // retry count limit
+// #define TRANS_RETRY_INTERVAL 15 // retry interval (ms)
#define TRANS_CONN_TIMEOUT 3000 // connect timeout (ms)
#define TRANS_READ_TIMEOUT 3000 // read timeout (ms)
#define TRANS_PACKET_LIMIT 1024 * 1024 * 512
diff --git a/source/libs/transport/inc/transportInt.h b/source/libs/transport/inc/transportInt.h
index 2db4a72795566d3a52d55650d275fe9c65c54ae5..1f3c98ad7283c3f1594a67499d6fad8c0f886f47 100644
--- a/source/libs/transport/inc/transportInt.h
+++ b/source/libs/transport/inc/transportInt.h
@@ -64,6 +64,11 @@ typedef struct {
void (*destroyFp)(void* ahandle);
bool (*failFastFp)(tmsg_t msgType);
+ int32_t connLimitNum;
+ int8_t connLimitLock; // 0: no lock. 1. lock
+ int8_t supportBatch; // 0: no batch, 1: support batch
+ int32_t batchSize;
+
int index;
void* parent;
void* tcphandle; // returned handle from TCP initialization
diff --git a/source/libs/transport/src/thttp.c b/source/libs/transport/src/thttp.c
index cd508f6fe9e71ef90fc5c156685e95f5972931e3..8e5f79137fd5f693e012849ce468fffed2870fa9 100644
--- a/source/libs/transport/src/thttp.c
+++ b/source/libs/transport/src/thttp.c
@@ -420,7 +420,13 @@ static void transHttpEnvInit() {
uv_loop_init(http->loop);
http->asyncPool = transAsyncPoolCreate(http->loop, 1, http, httpAsyncCb);
-
+ if (NULL == http->asyncPool) {
+ taosMemoryFree(http->loop);
+ taosMemoryFree(http);
+ http = NULL;
+ return;
+ }
+
int err = taosThreadCreate(&http->thread, NULL, httpThread, (void*)http);
if (err != 0) {
taosMemoryFree(http->loop);
diff --git a/source/libs/transport/src/trans.c b/source/libs/transport/src/trans.c
index 47b1ac5ca7c8a46d435ea7c412b2c7adf25d5081..16ea25a41abb70bb1a60c8a84cd3536d054779eb 100644
--- a/source/libs/transport/src/trans.c
+++ b/source/libs/transport/src/trans.c
@@ -67,6 +67,10 @@ void* rpcOpen(const SRpcInit* pInit) {
pRpc->startTimer = pInit->tfp;
pRpc->destroyFp = pInit->dfp;
pRpc->failFastFp = pInit->ffp;
+ pRpc->connLimitNum = pInit->connLimitNum;
+ pRpc->connLimitLock = pInit->connLimitLock;
+ pRpc->supportBatch = pInit->supportBatch;
+ pRpc->batchSize = pInit->batchSize;
pRpc->numOfThreads = pInit->numOfThreads > TSDB_MAX_RPC_THREADS ? TSDB_MAX_RPC_THREADS : pInit->numOfThreads;
if (pRpc->numOfThreads <= 0) {
diff --git a/source/libs/transport/src/transCli.c b/source/libs/transport/src/transCli.c
index 1a99db5f992d51f5e01ba5120e2099f1d53a307f..829db74d3f204c5c440ee50e4f9d373ca8101258 100644
--- a/source/libs/transport/src/transCli.c
+++ b/source/libs/transport/src/transCli.c
@@ -12,7 +12,6 @@
* along with this program. If not, see .
*/
-#ifdef USE_UV
#include "transComm.h"
typedef struct SConnList {
@@ -20,6 +19,30 @@ typedef struct SConnList {
int32_t size;
} SConnList;
+typedef struct {
+ queue wq;
+ int32_t len;
+
+ int connMax;
+ int connCnt;
+ int batchLenLimit;
+ int sending;
+
+ char* dst;
+ char* ip;
+ uint16_t port;
+
+} SCliBatchList;
+
+typedef struct {
+ queue wq;
+ queue listq;
+ int32_t wLen;
+ int32_t batchSize; //
+ int32_t batch;
+ SCliBatchList* pList;
+} SCliBatch;
+
typedef struct SCliConn {
T_REF_DECLARE()
uv_connect_t connReq;
@@ -40,9 +63,10 @@ typedef struct SCliConn {
bool broken; // link broken or not
ConnStatus status; //
- int64_t refId;
- char* ip;
- uint32_t port;
+ SCliBatch* pBatch;
+
+ int64_t refId;
+ char* ip;
SDelayTask* task;
@@ -80,11 +104,14 @@ typedef struct SCliThrd {
uint64_t nextTimeout; // next timeout
void* pTransInst; //
+ int connCount;
void (*destroyAhandleFp)(void* ahandle);
SHashObj* fqdn2ipCache;
SCvtAddr cvtAddr;
SHashObj* failFastCache;
+ SHashObj* connLimitCache;
+ SHashObj* batchCache;
SCliMsg* stopMsg;
@@ -131,6 +158,11 @@ static void cliAsyncCb(uv_async_t* handle);
static void cliIdleCb(uv_idle_t* handle);
static void cliPrepareCb(uv_prepare_t* handle);
+static void cliHandleBatchReq(SCliBatch* pBatch, SCliThrd* pThrd);
+static void cliSendBatchCb(uv_write_t* req, int status);
+
+SCliBatch* cliGetHeadFromList(SCliBatchList* pList);
+
static bool cliRecvReleaseReq(SCliConn* conn, STransMsgHead* pHead);
static int32_t allocConnRef(SCliConn* conn, bool update);
@@ -141,8 +173,11 @@ static SCliConn* cliCreateConn(SCliThrd* thrd);
static void cliDestroyConn(SCliConn* pConn, bool clear /*clear tcp handle or not*/);
static void cliDestroy(uv_handle_t* handle);
static void cliSend(SCliConn* pConn);
+static void cliSendBatch(SCliConn* pConn);
static void cliDestroyConnMsgs(SCliConn* conn, bool destroy);
+static int32_t cliPreCheckSessionLimit(SCliThrd* pThrd, char* ip, uint16_t port);
+
// cli util func
static FORCE_INLINE bool cliIsEpsetUpdated(int32_t code, STransConnCtx* pCtx);
static FORCE_INLINE void cliMayCvtFqdnToIp(SEpSet* pEpSet, SCvtAddr* pCvtAddr);
@@ -157,6 +192,7 @@ static void cliHandleResp(SCliConn* conn);
// handle except about conn
static void cliHandleExcept(SCliConn* conn);
static void cliReleaseUnfinishedMsg(SCliConn* conn);
+static void cliHandleFastFail(SCliConn* pConn, int status);
// handle req from app
static void cliHandleReq(SCliMsg* pMsg, SCliThrd* pThrd);
@@ -165,6 +201,8 @@ static void cliHandleRelease(SCliMsg* pMsg, SCliThrd* pThrd);
static void cliHandleUpdate(SCliMsg* pMsg, SCliThrd* pThrd);
static void (*cliAsyncHandle[])(SCliMsg* pMsg, SCliThrd* pThrd) = {cliHandleReq, cliHandleQuit, cliHandleRelease, NULL,
cliHandleUpdate};
+/// static void (*cliAsyncHandle[])(SCliMsg* pMsg, SCliThrd* pThrd) = {cliHandleReq, cliHandleQuit, cliHandleRelease,
+/// NULL,cliHandleUpdate};
static FORCE_INLINE void destroyUserdata(STransMsg* userdata);
static FORCE_INLINE void destroyCmsg(void* cmsg);
@@ -285,6 +323,7 @@ static void cliReleaseUnfinishedMsg(SCliConn* conn) {
}
destroyCmsg(msg);
}
+ transQueueClear(&conn->cliMsgs);
memset(&conn->ctx, 0, sizeof(conn->ctx));
}
bool cliMaySendCachedMsg(SCliConn* conn) {
@@ -487,9 +526,9 @@ void cliConnTimeout(uv_timer_t* handle) {
uv_timer_stop(handle);
handle->data = NULL;
taosArrayPush(pThrd->timerList, &conn->timer);
-
conn->timer = NULL;
- cliHandleExceptImpl(conn, -1);
+
+ cliHandleFastFail(conn, UV_ECANCELED);
}
void cliReadTimeoutCb(uv_timer_t* handle) {
// set up timeout cb
@@ -569,17 +608,15 @@ static void addConnToPool(void* pool, SCliConn* conn) {
conn->status = ConnInPool;
if (conn->list == NULL) {
- char key[TSDB_FQDN_LEN + 64] = {0};
- CONN_CONSTRUCT_HASH_KEY(key, conn->ip, conn->port);
tTrace("%s conn %p added to conn pool, read buf cap:%d", CONN_GET_INST_LABEL(conn), conn, conn->readBuf.cap);
- conn->list = taosHashGet((SHashObj*)pool, key, strlen(key));
+ conn->list = taosHashGet((SHashObj*)pool, conn->ip, strlen(conn->ip));
} else {
tTrace("%s conn %p added to conn pool, read buf cap:%d", CONN_GET_INST_LABEL(conn), conn, conn->readBuf.cap);
}
QUEUE_PUSH(&conn->list->conns, &conn->q);
conn->list->size += 1;
- if (conn->list->size >= 50) {
+ if (conn->list->size >= 250) {
STaskArg* arg = taosMemoryCalloc(1, sizeof(STaskArg));
arg->param1 = conn;
arg->param2 = thrd;
@@ -671,7 +708,6 @@ static SCliConn* cliCreateConn(SCliThrd* pThrd) {
conn->stream = (uv_stream_t*)taosMemoryMalloc(sizeof(uv_tcp_t));
uv_tcp_init(pThrd->loop, (uv_tcp_t*)(conn->stream));
conn->stream->data = conn;
- transSetConnOption((uv_tcp_t*)conn->stream);
uv_timer_t* timer = taosArrayGetSize(pThrd->timerList) > 0 ? *(uv_timer_t**)taosArrayPop(pThrd->timerList) : NULL;
if (timer == NULL) {
@@ -691,9 +727,10 @@ static SCliConn* cliCreateConn(SCliThrd* pThrd) {
QUEUE_INIT(&conn->q);
conn->hostThrd = pThrd;
conn->status = ConnNormal;
- conn->broken = 0;
+ conn->broken = false;
transRefCliHandle(conn);
+ atomic_add_fetch_32(&pThrd->connCount, 1);
allocConnRef(conn, false);
return conn;
@@ -737,6 +774,11 @@ static void cliDestroy(uv_handle_t* handle) {
conn->timer->data = NULL;
conn->timer = NULL;
}
+ int32_t* oVal = taosHashGet(pThrd->connLimitCache, conn->ip, strlen(conn->ip));
+ int32_t nVal = oVal == NULL ? 0 : (*oVal) - 1;
+ taosHashPut(pThrd->connLimitCache, conn->ip, strlen(conn->ip), &nVal, sizeof(nVal));
+
+ atomic_sub_fetch_32(&pThrd->connCount, 1);
transReleaseExHandle(transGetRefMgt(), conn->refId);
transRemoveExHandle(transGetRefMgt(), conn->refId);
@@ -748,6 +790,7 @@ static void cliDestroy(uv_handle_t* handle) {
tTrace("%s conn %p destroy successfully", CONN_GET_INST_LABEL(conn), conn);
transReqQueueClear(&conn->wreqQueue);
transDestroyBuffer(&conn->readBuf);
+
taosMemoryFree(conn);
}
static bool cliHandleNoResp(SCliConn* conn) {
@@ -778,7 +821,7 @@ static void cliSendCb(uv_write_t* req, int status) {
SCliMsg* pMsg = !transQueueEmpty(&pConn->cliMsgs) ? transQueueGet(&pConn->cliMsgs, 0) : NULL;
if (pMsg != NULL) {
int64_t cost = taosGetTimestampUs() - pMsg->st;
- if (cost > 1000) {
+ if (cost > 1000 * 20) {
tWarn("%s conn %p send cost:%dus, send exception", CONN_GET_INST_LABEL(pConn), pConn, (int)cost);
}
}
@@ -798,11 +841,72 @@ static void cliSendCb(uv_write_t* req, int status) {
}
uv_read_start((uv_stream_t*)pConn->stream, cliAllocRecvBufferCb, cliRecvCb);
}
+void cliSendBatch(SCliConn* pConn) {
+ SCliThrd* pThrd = pConn->hostThrd;
+ STrans* pTransInst = pThrd->pTransInst;
+
+ SCliBatch* pBatch = pConn->pBatch;
+ SCliBatchList* pList = pBatch->pList;
+ pList->connCnt += 1;
+
+ int32_t wLen = pBatch->wLen;
+
+ uv_buf_t* wb = taosMemoryCalloc(wLen, sizeof(uv_buf_t));
+ int i = 0;
+
+ queue* h = NULL;
+ QUEUE_FOREACH(h, &pBatch->wq) {
+ SCliMsg* pCliMsg = QUEUE_DATA(h, SCliMsg, q);
+
+ STransConnCtx* pCtx = pCliMsg->ctx;
+
+ STransMsg* pMsg = (STransMsg*)(&pCliMsg->msg);
+ if (pMsg->pCont == 0) {
+ pMsg->pCont = (void*)rpcMallocCont(0);
+ pMsg->contLen = 0;
+ }
+
+ int msgLen = transMsgLenFromCont(pMsg->contLen);
+ STransMsgHead* pHead = transHeadFromCont(pMsg->pCont);
+
+ if (pHead->comp == 0) {
+ pHead->ahandle = pCtx != NULL ? (uint64_t)pCtx->ahandle : 0;
+ pHead->noResp = REQUEST_NO_RESP(pMsg) ? 1 : 0;
+ pHead->persist = REQUEST_PERSIS_HANDLE(pMsg) ? 1 : 0;
+ pHead->msgType = pMsg->msgType;
+ pHead->msgLen = (int32_t)htonl((uint32_t)msgLen);
+ pHead->release = REQUEST_RELEASE_HANDLE(pCliMsg) ? 1 : 0;
+ memcpy(pHead->user, pTransInst->user, strlen(pTransInst->user));
+ pHead->traceId = pMsg->info.traceId;
+ pHead->magicNum = htonl(TRANS_MAGIC_NUM);
+ }
+ pHead->timestamp = taosHton64(taosGetTimestampUs());
+
+ if (pHead->comp == 0) {
+ if (pTransInst->compressSize != -1 && pTransInst->compressSize < pMsg->contLen) {
+ msgLen = transCompressMsg(pMsg->pCont, pMsg->contLen) + sizeof(STransMsgHead);
+ pHead->msgLen = (int32_t)htonl((uint32_t)msgLen);
+ }
+ } else {
+ msgLen = (int32_t)ntohl((uint32_t)(pHead->msgLen));
+ }
+ wb[i++] = uv_buf_init((char*)pHead, msgLen);
+ }
+ uv_write_t* req = taosMemoryCalloc(1, sizeof(uv_write_t));
+ req->data = pConn;
+ tDebug("%s conn %p start to send batch msg, batch size:%d, msgLen:%d", CONN_GET_INST_LABEL(pConn), pConn,
+ pBatch->wLen, pBatch->batchSize);
+ uv_write(req, (uv_stream_t*)pConn->stream, wb, wLen, cliSendBatchCb);
+ taosMemoryFree(wb);
+}
void cliSend(SCliConn* pConn) {
- bool empty = transQueueEmpty(&pConn->cliMsgs);
- ASSERTS(empty == false, "trans-cli get invalid msg");
- if (empty == true) {
+ SCliThrd* pThrd = pConn->hostThrd;
+ STrans* pTransInst = pThrd->pTransInst;
+
+ if (transQueueEmpty(&pConn->cliMsgs)) {
+ tError("%s conn %p not msg to send", pTransInst->label, pConn);
+ cliHandleExcept(pConn);
return;
}
@@ -812,9 +916,6 @@ void cliSend(SCliConn* pConn) {
STransConnCtx* pCtx = pCliMsg->ctx;
- SCliThrd* pThrd = pConn->hostThrd;
- STrans* pTransInst = pThrd->pTransInst;
-
STransMsg* pMsg = (STransMsg*)(&pCliMsg->msg);
if (pMsg->pCont == 0) {
pMsg->pCont = (void*)rpcMallocCont(0);
@@ -883,31 +984,148 @@ _RETURN:
return;
}
-void cliConnCb(uv_connect_t* req, int status) {
- SCliConn* pConn = req->data;
- SCliThrd* pThrd = pConn->hostThrd;
+static void cliDestroyBatch(SCliBatch* pBatch) {
+ while (!QUEUE_IS_EMPTY(&pBatch->wq)) {
+ queue* h = QUEUE_HEAD(&pBatch->wq);
+ QUEUE_REMOVE(h);
- if (pConn->timer != NULL) {
- uv_timer_stop(pConn->timer);
- pConn->timer->data = NULL;
- taosArrayPush(pThrd->timerList, &pConn->timer);
- pConn->timer = NULL;
+ SCliMsg* p = QUEUE_DATA(h, SCliMsg, q);
+ destroyCmsg(p);
+ }
+ SCliBatchList* p = pBatch->pList;
+ p->sending -= 1;
+ taosMemoryFree(pBatch);
+}
+static void cliHandleBatchReq(SCliBatch* pBatch, SCliThrd* pThrd) {
+ if (pThrd->quit == true) {
+ cliDestroyBatch(pBatch);
+ return;
+ }
+
+ if (pBatch == NULL || pBatch->wLen == 0 || QUEUE_IS_EMPTY(&pBatch->wq)) {
+ return;
+ }
+ STrans* pTransInst = pThrd->pTransInst;
+ SCliBatchList* pList = pBatch->pList;
+
+ SCliConn* conn = getConnFromPool(pThrd->pool, pList->ip, pList->port);
+
+ if (conn == NULL && 0 != cliPreCheckSessionLimit(pThrd, pList->ip, pList->port)) {
+ tError("%s failed to send batch msg, batch size:%d, msgLen: %d", pTransInst->label, pBatch->wLen,
+ pBatch->batchSize);
+ cliDestroyBatch(pBatch);
+ return;
+ }
+ if (conn == NULL) {
+ conn = cliCreateConn(pThrd);
+ conn->pBatch = pBatch;
+ conn->ip = strdup(pList->dst);
+
+ uint32_t ipaddr = cliGetIpFromFqdnCache(pThrd->fqdn2ipCache, pList->ip);
+ if (ipaddr == 0xffffffff) {
+ uv_timer_stop(conn->timer);
+ conn->timer->data = NULL;
+ taosArrayPush(pThrd->timerList, &conn->timer);
+ conn->timer = NULL;
+
+ cliHandleFastFail(conn, -1);
+ return;
+ }
+ struct sockaddr_in addr;
+ addr.sin_family = AF_INET;
+ addr.sin_addr.s_addr = ipaddr;
+ addr.sin_port = (uint16_t)htons(pList->port);
+
+ tTrace("%s conn %p try to connect to %s", pTransInst->label, conn, pList->dst);
+ int32_t fd = taosCreateSocketWithTimeout(TRANS_CONN_TIMEOUT * 4);
+ if (fd == -1) {
+ tError("%s conn %p failed to create socket, reason:%s", transLabel(pTransInst), conn,
+ tstrerror(TAOS_SYSTEM_ERROR(errno)));
+ cliHandleFastFail(conn, -1);
+ return;
+ }
+ int ret = uv_tcp_open((uv_tcp_t*)conn->stream, fd);
+ if (ret != 0) {
+ tError("%s conn %p failed to set stream, reason:%s", transLabel(pTransInst), conn, uv_err_name(ret));
+ cliHandleFastFail(conn, -1);
+ return;
+ }
+ ret = transSetConnOption((uv_tcp_t*)conn->stream);
+ if (ret != 0) {
+ tError("%s conn %p failed to set socket opt, reason:%s", transLabel(pTransInst), conn, uv_err_name(ret));
+ cliHandleFastFail(conn, -1);
+ return;
+ }
+
+ ret = uv_tcp_connect(&conn->connReq, (uv_tcp_t*)(conn->stream), (const struct sockaddr*)&addr, cliConnCb);
+ if (ret != 0) {
+ uv_timer_stop(conn->timer);
+ conn->timer->data = NULL;
+ taosArrayPush(pThrd->timerList, &conn->timer);
+ conn->timer = NULL;
+ cliHandleFastFail(conn, -1);
+ return;
+ }
+ uv_timer_start(conn->timer, cliConnTimeout, TRANS_CONN_TIMEOUT, 0);
+ return;
}
+ conn->pBatch = pBatch;
+ cliSendBatch(conn);
+}
+static void cliSendBatchCb(uv_write_t* req, int status) {
+ SCliConn* conn = req->data;
+ SCliThrd* thrd = conn->hostThrd;
+ SCliBatch* p = conn->pBatch;
+
+ SCliBatchList* pBatchList = p->pList;
+ SCliBatch* nxtBatch = cliGetHeadFromList(pBatchList);
+ pBatchList->connCnt -= 1;
+
+ conn->pBatch = NULL;
+
if (status != 0) {
+ tDebug("%s conn %p failed to send batch msg, batch size:%d, msgLen:%d, reason:%s", CONN_GET_INST_LABEL(conn), conn,
+ p->wLen, p->batchSize, uv_err_name(status));
+
+ if (!uv_is_closing((uv_handle_t*)&conn->stream)) cliHandleExcept(conn);
+
+ cliHandleBatchReq(nxtBatch, thrd);
+ } else {
+ tDebug("%s conn %p succ to send batch msg, batch size:%d, msgLen:%d", CONN_GET_INST_LABEL(conn), conn, p->wLen,
+ p->batchSize);
+ if (!uv_is_closing((uv_handle_t*)&conn->stream)) {
+ if (nxtBatch != NULL) {
+ conn->pBatch = nxtBatch;
+ cliSendBatch(conn);
+ } else {
+ addConnToPool(thrd->pool, conn);
+ }
+ } else {
+ cliDestroyBatch(nxtBatch);
+ // conn release by other callback
+ }
+ }
+
+ cliDestroyBatch(p);
+ taosMemoryFree(req);
+}
+static void cliHandleFastFail(SCliConn* pConn, int status) {
+ SCliThrd* pThrd = pConn->hostThrd;
+ STrans* pTransInst = pThrd->pTransInst;
+
+ if (status == -1) status = ENETUNREACH;
+
+ if (pConn->pBatch == NULL) {
SCliMsg* pMsg = transQueueGet(&pConn->cliMsgs, 0);
- STrans* pTransInst = pThrd->pTransInst;
- tError("%s msg %s failed to send, conn %p failed to connect to %s:%d, reason: %s", CONN_GET_INST_LABEL(pConn),
- pMsg ? TMSG_INFO(pMsg->msg.msgType) : 0, pConn, pConn->ip, pConn->port, uv_strerror(status));
+ STraceId* trace = &pMsg->msg.info.traceId;
+ tGError("%s msg %s failed to send, conn %p failed to connect to %s, reason: %s", CONN_GET_INST_LABEL(pConn),
+ TMSG_INFO(pMsg->msg.msgType), pConn, pConn->ip, uv_strerror(status));
+
if (pMsg != NULL && REQUEST_NO_RESP(&pMsg->msg) &&
(pTransInst->failFastFp != NULL && pTransInst->failFastFp(pMsg->msg.msgType))) {
- char* ip = pConn->ip;
- uint32_t port = pConn->port;
- char key[TSDB_FQDN_LEN + 64] = {0};
- CONN_CONSTRUCT_HASH_KEY(key, ip, port);
-
- SFailFastItem* item = taosHashGet(pThrd->failFastCache, key, strlen(key));
+ SFailFastItem* item = taosHashGet(pThrd->failFastCache, pConn->ip, strlen(pConn->ip));
int64_t cTimestamp = taosGetTimestampMs();
if (item != NULL) {
int32_t elapse = cTimestamp - item->timestamp;
@@ -919,15 +1137,47 @@ void cliConnCb(uv_connect_t* req, int status) {
}
} else {
SFailFastItem item = {.count = 1, .timestamp = cTimestamp};
- taosHashPut(pThrd->failFastCache, key, strlen(key), &item, sizeof(SFailFastItem));
+ taosHashPut(pThrd->failFastCache, pConn->ip, strlen(pConn->ip), &item, sizeof(SFailFastItem));
}
}
- cliHandleExcept(pConn);
+ } else {
+ tError("%s batch msg failed to send, conn %p failed to connect to %s, reason: %s", CONN_GET_INST_LABEL(pConn),
+ pConn, pConn->ip, uv_strerror(status));
+ cliDestroyBatch(pConn->pBatch);
+ pConn->pBatch = NULL;
+ }
+ cliHandleExcept(pConn);
+}
+
+void cliConnCb(uv_connect_t* req, int status) {
+ SCliConn* pConn = req->data;
+ SCliThrd* pThrd = pConn->hostThrd;
+ bool timeout = false;
+
+ if (pConn->timer == NULL) {
+ timeout = true;
+ } else {
+ uv_timer_stop(pConn->timer);
+ pConn->timer->data = NULL;
+ taosArrayPush(pThrd->timerList, &pConn->timer);
+ pConn->timer = NULL;
+ }
+
+ if (status != 0) {
+ if (timeout == false) {
+ cliHandleFastFail(pConn, status);
+ } else if (timeout == true) {
+ // already deal by timeout
+ }
return;
}
- struct sockaddr peername, sockname;
- int addrlen = sizeof(peername);
+ int32_t* oVal = taosHashGet(pThrd->connLimitCache, pConn->ip, strlen(pConn->ip));
+ int32_t nVal = oVal == NULL ? 0 : (*oVal) + 1;
+ taosHashPut(pThrd->connLimitCache, pConn->ip, strlen(pConn->ip), &nVal, sizeof(nVal));
+
+ struct sockaddr peername, sockname;
+ int addrlen = sizeof(peername);
uv_tcp_getpeername((uv_tcp_t*)pConn->stream, &peername, &addrlen);
transSockInfo2Str(&peername, pConn->dst);
@@ -936,8 +1186,11 @@ void cliConnCb(uv_connect_t* req, int status) {
transSockInfo2Str(&sockname, pConn->src);
tTrace("%s conn %p connect to server successfully", CONN_GET_INST_LABEL(pConn), pConn);
-
- cliSend(pConn);
+ if (pConn->pBatch != NULL) {
+ cliSendBatch(pConn);
+ } else {
+ cliSend(pConn);
+ }
}
static void cliHandleQuit(SCliMsg* pMsg, SCliThrd* pThrd) {
@@ -1045,6 +1298,12 @@ static FORCE_INLINE uint32_t cliGetIpFromFqdnCache(SHashObj* cache, char* fqdn)
uint32_t* v = taosHashGet(cache, fqdn, strlen(fqdn));
if (v == NULL) {
addr = taosGetIpv4FromFqdn(fqdn);
+ if (addr == 0xffffffff) {
+ terrno = TAOS_SYSTEM_ERROR(errno);
+ tError("failed to get ip from fqdn:%s since %s", fqdn, terrstr());
+ return addr;
+ }
+
taosHashPut(cache, fqdn, strlen(fqdn), &addr, sizeof(addr));
} else {
addr = *v;
@@ -1056,29 +1315,47 @@ static FORCE_INLINE void cliUpdateFqdnCache(SHashObj* cache, char* fqdn) {
return;
}
+static int32_t cliPreCheckSessionLimit(SCliThrd* pThrd, char* ip, uint16_t port) {
+ STrans* pTransInst = pThrd->pTransInst;
+
+ // STransConnCtx* pCtx = pMsg->ctx;
+ // char* ip = EPSET_GET_INUSE_IP(&pCtx->epSet);
+ // int32_t port = EPSET_GET_INUSE_PORT(&pCtx->epSet);
+
+ char key[TSDB_FQDN_LEN + 64] = {0};
+ CONN_CONSTRUCT_HASH_KEY(key, ip, port);
+
+ int32_t* val = taosHashGet(pThrd->connLimitCache, key, strlen(key));
+ if (val == NULL) return 0;
+
+ if (*val >= pTransInst->connLimitNum) {
+ return -1;
+ }
+ return 0;
+}
void cliHandleReq(SCliMsg* pMsg, SCliThrd* pThrd) {
STrans* pTransInst = pThrd->pTransInst;
STransConnCtx* pCtx = pMsg->ctx;
cliMayCvtFqdnToIp(&pCtx->epSet, &pThrd->cvtAddr);
+ STraceId* trace = &pMsg->msg.info.traceId;
+ char* ip = EPSET_GET_INUSE_IP(&pCtx->epSet);
+ uint16_t port = EPSET_GET_INUSE_PORT(&pCtx->epSet);
if (!EPSET_IS_VALID(&pCtx->epSet)) {
- tError("invalid epset");
+ tGError("%s, msg %s sent with invalid epset", pTransInst->label, TMSG_INFO(pMsg->msg.msgType));
destroyCmsg(pMsg);
return;
}
if (REQUEST_NO_RESP(&pMsg->msg) && (pTransInst->failFastFp != NULL && pTransInst->failFastFp(pMsg->msg.msgType))) {
- char* ip = EPSET_GET_INUSE_IP(&pCtx->epSet);
- uint32_t port = EPSET_GET_INUSE_PORT(&pCtx->epSet);
- char key[TSDB_FQDN_LEN + 64] = {0};
+ char key[TSDB_FQDN_LEN + 64] = {0};
CONN_CONSTRUCT_HASH_KEY(key, ip, port);
SFailFastItem* item = taosHashGet(pThrd->failFastCache, key, strlen(key));
if (item != NULL) {
int32_t elapse = (int32_t)(taosGetTimestampMs() - item->timestamp);
if (item->count >= pTransInst->failFastThreshold && (elapse >= 0 && elapse <= pTransInst->failFastInterval)) {
- STraceId* trace = &(pMsg->msg.info.traceId);
tGTrace("%s, msg %s cancel to send, reason: failed to connect %s:%d: count: %d, at %d", pTransInst->label,
TMSG_INFO(pMsg->msg.msgType), ip, port, item->count, elapse);
destroyCmsg(pMsg);
@@ -1100,6 +1377,13 @@ void cliHandleReq(SCliMsg* pMsg, SCliThrd* pThrd) {
return;
}
+ if (conn == NULL && REQUEST_NO_RESP(&pMsg->msg) && 0 != cliPreCheckSessionLimit(pThrd, ip, port)) {
+ tGTrace("%s, msg %s cancel to send, reason: %s", pTransInst->label, TMSG_INFO(pMsg->msg.msgType),
+ tstrerror(TSDB_CODE_RPC_MAX_SESSIONS));
+ destroyCmsg(pMsg);
+ return;
+ }
+
if (conn != NULL) {
transCtxMerge(&conn->ctx, &pCtx->appCtx);
transQueuePush(&conn->cliMsgs, pMsg);
@@ -1113,59 +1397,225 @@ void cliHandleReq(SCliMsg* pMsg, SCliThrd* pThrd) {
transCtxMerge(&conn->ctx, &pCtx->appCtx);
transQueuePush(&conn->cliMsgs, pMsg);
- conn->ip = strdup(EPSET_GET_INUSE_IP(&pCtx->epSet));
- conn->port = EPSET_GET_INUSE_PORT(&pCtx->epSet);
+ char key[TSDB_FQDN_LEN + 64] = {0};
+ char* fqdn = EPSET_GET_INUSE_IP(&pCtx->epSet);
+ uint16_t port = EPSET_GET_INUSE_PORT(&pCtx->epSet);
+ CONN_CONSTRUCT_HASH_KEY(key, fqdn, port);
- struct sockaddr_in addr;
- addr.sin_family = AF_INET;
- addr.sin_addr.s_addr = cliGetIpFromFqdnCache(pThrd->fqdn2ipCache, conn->ip);
- addr.sin_port = (uint16_t)htons((uint16_t)conn->port);
+ conn->ip = strdup(key);
- STraceId* trace = &(pMsg->msg.info.traceId);
- tGTrace("%s conn %p try to connect to %s:%d", pTransInst->label, conn, conn->ip, conn->port);
+ uint32_t ipaddr = cliGetIpFromFqdnCache(pThrd->fqdn2ipCache, fqdn);
+ if (ipaddr == 0xffffffff) {
+ uv_timer_stop(conn->timer);
+ conn->timer->data = NULL;
+ taosArrayPush(pThrd->timerList, &conn->timer);
+ conn->timer = NULL;
+
+ cliHandleExcept(conn);
+ return;
+ }
- int ret = uv_tcp_connect(&conn->connReq, (uv_tcp_t*)(conn->stream), (const struct sockaddr*)&addr, cliConnCb);
+ struct sockaddr_in addr;
+ addr.sin_family = AF_INET;
+ addr.sin_addr.s_addr = ipaddr;
+ addr.sin_port = (uint16_t)htons(port);
+
+ tGTrace("%s conn %p try to connect to %s", pTransInst->label, conn, conn->ip);
+ int32_t fd = taosCreateSocketWithTimeout(TRANS_CONN_TIMEOUT * 4);
+ if (fd == -1) {
+ tGError("%s conn %p failed to create socket, reason:%s", transLabel(pTransInst), conn,
+ tstrerror(TAOS_SYSTEM_ERROR(errno)));
+ cliHandleExcept(conn);
+ errno = 0;
+ return;
+ }
+ int ret = uv_tcp_open((uv_tcp_t*)conn->stream, fd);
if (ret != 0) {
- tGError("%s conn %p failed to connect to %s:%d, reason:%s", pTransInst->label, conn, conn->ip, conn->port,
- uv_err_name(ret));
+ tGError("%s conn %p failed to set stream, reason:%s", transLabel(pTransInst), conn, uv_err_name(ret));
+ cliHandleExcept(conn);
+ return;
+ }
+ ret = transSetConnOption((uv_tcp_t*)conn->stream);
+ if (ret != 0) {
+ tGError("%s conn %p failed to set socket opt, reason:%s", transLabel(pTransInst), conn, uv_err_name(ret));
+ cliHandleExcept(conn);
+ return;
+ }
+ ret = uv_tcp_connect(&conn->connReq, (uv_tcp_t*)(conn->stream), (const struct sockaddr*)&addr, cliConnCb);
+ if (ret != 0) {
uv_timer_stop(conn->timer);
conn->timer->data = NULL;
taosArrayPush(pThrd->timerList, &conn->timer);
conn->timer = NULL;
- cliHandleExcept(conn);
+ cliHandleFastFail(conn, ret);
return;
}
uv_timer_start(conn->timer, cliConnTimeout, TRANS_CONN_TIMEOUT, 0);
}
- STraceId* trace = &pMsg->msg.info.traceId;
tGTrace("%s conn %p ready", pTransInst->label, conn);
}
-static void cliAsyncCb(uv_async_t* handle) {
- SAsyncItem* item = handle->data;
- SCliThrd* pThrd = item->pThrd;
- SCliMsg* pMsg = NULL;
- // batch process to avoid to lock/unlock frequently
- queue wq;
- taosThreadMutexLock(&item->mtx);
- QUEUE_MOVE(&item->qmsg, &wq);
- taosThreadMutexUnlock(&item->mtx);
+static void cliNoBatchDealReq(queue* wq, SCliThrd* pThrd) {
+ int count = 0;
+
+ while (!QUEUE_IS_EMPTY(wq)) {
+ queue* h = QUEUE_HEAD(wq);
+ QUEUE_REMOVE(h);
+
+ SCliMsg* pMsg = QUEUE_DATA(h, SCliMsg, q);
+
+ if (pMsg->type == Quit) {
+ pThrd->stopMsg = pMsg;
+ continue;
+ }
+ (*cliAsyncHandle[pMsg->type])(pMsg, pThrd);
+
+ count++;
+ }
+ if (count >= 2) {
+ tTrace("cli process batch size:%d", count);
+ }
+}
+SCliBatch* cliGetHeadFromList(SCliBatchList* pList) {
+ if (QUEUE_IS_EMPTY(&pList->wq) || pList->connCnt > pList->connMax || pList->sending > pList->connMax) {
+ return NULL;
+ }
+ queue* hr = QUEUE_HEAD(&pList->wq);
+ QUEUE_REMOVE(hr);
+ pList->sending += 1;
+
+ pList->len -= 1;
+
+ SCliBatch* batch = QUEUE_DATA(hr, SCliBatch, listq);
+ return batch;
+}
+
+static void cliBatchDealReq(queue* wq, SCliThrd* pThrd) {
+ STrans* pInst = pThrd->pTransInst;
int count = 0;
- while (!QUEUE_IS_EMPTY(&wq)) {
- queue* h = QUEUE_HEAD(&wq);
+ while (!QUEUE_IS_EMPTY(wq)) {
+ queue* h = QUEUE_HEAD(wq);
QUEUE_REMOVE(h);
SCliMsg* pMsg = QUEUE_DATA(h, SCliMsg, q);
+
+ if (pMsg->type == Quit) {
+ pThrd->stopMsg = pMsg;
+ continue;
+ }
+
+ if (pMsg->type == Normal && REQUEST_NO_RESP(&pMsg->msg)) {
+ STransConnCtx* pCtx = pMsg->ctx;
+
+ char* ip = EPSET_GET_INUSE_IP(&pCtx->epSet);
+ uint32_t port = EPSET_GET_INUSE_PORT(&pCtx->epSet);
+ char key[TSDB_FQDN_LEN + 64] = {0};
+ CONN_CONSTRUCT_HASH_KEY(key, ip, port);
+
+ // SCliBatch** ppBatch = taosHashGet(pThrd->batchCache, key, sizeof(key));
+ SCliBatchList** ppBatchList = taosHashGet(pThrd->batchCache, key, sizeof(key));
+ if (ppBatchList == NULL || *ppBatchList == NULL) {
+ SCliBatchList* pBatchList = taosMemoryCalloc(1, sizeof(SCliBatchList));
+ QUEUE_INIT(&pBatchList->wq);
+ pBatchList->connMax = pInst->connLimitNum;
+ pBatchList->connCnt = 0;
+ pBatchList->batchLenLimit = pInst->batchSize;
+ pBatchList->len += 1;
+
+ pBatchList->ip = strdup(ip);
+ pBatchList->dst = strdup(key);
+ pBatchList->port = port;
+
+ SCliBatch* pBatch = taosMemoryCalloc(1, sizeof(SCliBatch));
+ QUEUE_INIT(&pBatch->wq);
+ QUEUE_INIT(&pBatch->listq);
+
+ QUEUE_PUSH(&pBatch->wq, h);
+ pBatch->wLen += 1;
+ pBatch->batchSize += pMsg->msg.contLen;
+ pBatch->pList = pBatchList;
+
+ QUEUE_PUSH(&pBatchList->wq, &pBatch->listq);
+
+ taosHashPut(pThrd->batchCache, key, sizeof(key), &pBatchList, sizeof(void*));
+ } else {
+ if (QUEUE_IS_EMPTY(&(*ppBatchList)->wq)) {
+ SCliBatch* pBatch = taosMemoryCalloc(1, sizeof(SCliBatch));
+ QUEUE_INIT(&pBatch->wq);
+ QUEUE_INIT(&pBatch->listq);
+
+ QUEUE_PUSH(&pBatch->wq, h);
+ pBatch->wLen += 1;
+ pBatch->batchSize = pMsg->msg.contLen;
+ pBatch->pList = *ppBatchList;
+
+ QUEUE_PUSH(&((*ppBatchList)->wq), &pBatch->listq);
+ (*ppBatchList)->len += 1;
+
+ continue;
+ }
+
+ queue* hdr = QUEUE_TAIL(&((*ppBatchList)->wq));
+ SCliBatch* pBatch = QUEUE_DATA(hdr, SCliBatch, listq);
+ if ((pBatch->batchSize + pMsg->msg.contLen) < (*ppBatchList)->batchLenLimit) {
+ QUEUE_PUSH(&pBatch->wq, h);
+ pBatch->batchSize += pMsg->msg.contLen;
+ pBatch->wLen += 1;
+ } else {
+ SCliBatch* pBatch = taosMemoryCalloc(1, sizeof(SCliBatch));
+ QUEUE_INIT(&pBatch->wq);
+ QUEUE_INIT(&pBatch->listq);
+
+ QUEUE_PUSH(&pBatch->wq, h);
+ pBatch->wLen += 1;
+ pBatch->batchSize += pMsg->msg.contLen;
+ pBatch->pList = *ppBatchList;
+
+ QUEUE_PUSH(&((*ppBatchList)->wq), &pBatch->listq);
+ (*ppBatchList)->len += 1;
+ }
+ }
+ continue;
+ }
(*cliAsyncHandle[pMsg->type])(pMsg, pThrd);
count++;
}
+
+ void** pIter = taosHashIterate(pThrd->batchCache, NULL);
+ while (pIter != NULL) {
+ SCliBatchList* batchList = (SCliBatchList*)(*pIter);
+ SCliBatch* batch = cliGetHeadFromList(batchList);
+ if (batch != NULL) {
+ cliHandleBatchReq(batch, pThrd);
+ }
+ pIter = (void**)taosHashIterate(pThrd->batchCache, pIter);
+ }
+
if (count >= 2) {
tTrace("cli process batch size:%d", count);
}
- // if (!uv_is_active((uv_handle_t*)pThrd->prepare)) uv_prepare_start(pThrd->prepare, cliPrepareCb);
+}
+
+static void cliAsyncCb(uv_async_t* handle) {
+ SAsyncItem* item = handle->data;
+ SCliThrd* pThrd = item->pThrd;
+ STrans* pTransInst = pThrd->pTransInst;
+
+ // batch process to avoid to lock/unlock frequently
+ queue wq;
+ taosThreadMutexLock(&item->mtx);
+ QUEUE_MOVE(&item->qmsg, &wq);
+ taosThreadMutexUnlock(&item->mtx);
+
+ int8_t supportBatch = pTransInst->supportBatch;
+ if (supportBatch == 0) {
+ cliNoBatchDealReq(&wq, pThrd);
+ } else if (supportBatch == 1) {
+ cliBatchDealReq(&wq, pThrd);
+ }
if (pThrd->stopMsg != NULL) cliHandleQuit(pThrd->stopMsg, pThrd);
}
@@ -1275,7 +1725,11 @@ void* transInitClient(uint32_t ip, uint32_t port, char* label, int numOfThreads,
for (int i = 0; i < cli->numOfThreads; i++) {
SCliThrd* pThrd = createThrdObj(shandle);
- int err = taosThreadCreate(&pThrd->thread, NULL, cliWorkThread, (void*)(pThrd));
+ if (pThrd == NULL) {
+ return NULL;
+ }
+
+ int err = taosThreadCreate(&pThrd->thread, NULL, cliWorkThread, (void*)(pThrd));
if (err == 0) {
tDebug("success to create tranport-cli thread:%d", i);
}
@@ -1332,9 +1786,27 @@ static SCliThrd* createThrdObj(void* trans) {
taosThreadMutexInit(&pThrd->msgMtx, NULL);
pThrd->loop = (uv_loop_t*)taosMemoryMalloc(sizeof(uv_loop_t));
- uv_loop_init(pThrd->loop);
-
- pThrd->asyncPool = transAsyncPoolCreate(pThrd->loop, 8, pThrd, cliAsyncCb);
+ int err = uv_loop_init(pThrd->loop);
+ if (err != 0) {
+ tError("failed to init uv_loop, reason:%s", uv_err_name(err));
+ taosMemoryFree(pThrd->loop);
+ taosThreadMutexDestroy(&pThrd->msgMtx);
+ taosMemoryFree(pThrd);
+ return NULL;
+ }
+ if (pTransInst->supportBatch) {
+ pThrd->asyncPool = transAsyncPoolCreate(pThrd->loop, 4, pThrd, cliAsyncCb);
+ } else {
+ pThrd->asyncPool = transAsyncPoolCreate(pThrd->loop, 8, pThrd, cliAsyncCb);
+ }
+ if (pThrd->asyncPool == NULL) {
+ tError("failed to init async pool");
+ uv_loop_close(pThrd->loop);
+ taosMemoryFree(pThrd->loop);
+ taosThreadMutexDestroy(&pThrd->msgMtx);
+ taosMemoryFree(pThrd);
+ return NULL;
+ }
pThrd->prepare = taosMemoryCalloc(1, sizeof(uv_prepare_t));
uv_prepare_init(pThrd->loop, pThrd->prepare);
@@ -1360,6 +1832,10 @@ static SCliThrd* createThrdObj(void* trans) {
pThrd->destroyAhandleFp = pTransInst->destroyFp;
pThrd->fqdn2ipCache = taosHashInit(4, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_NO_LOCK);
pThrd->failFastCache = taosHashInit(8, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_NO_LOCK);
+ pThrd->connLimitCache = taosHashInit(8, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true,
+ pTransInst->connLimitLock == 0 ? HASH_NO_LOCK : HASH_ENTRY_LOCK);
+
+ pThrd->batchCache = taosHashInit(8, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_NO_LOCK);
pThrd->quit = false;
return pThrd;
@@ -1388,6 +1864,25 @@ static void destroyThrdObj(SCliThrd* pThrd) {
taosMemoryFree(pThrd->loop);
taosHashCleanup(pThrd->fqdn2ipCache);
taosHashCleanup(pThrd->failFastCache);
+ taosHashCleanup(pThrd->connLimitCache);
+
+ void** pIter = taosHashIterate(pThrd->batchCache, NULL);
+ while (pIter != NULL) {
+ SCliBatchList* pBatchList = (SCliBatchList*)(*pIter);
+ while (!QUEUE_IS_EMPTY(&pBatchList->wq)) {
+ queue* h = QUEUE_HEAD(&pBatchList->wq);
+ QUEUE_REMOVE(h);
+
+ SCliBatch* pBatch = QUEUE_DATA(h, SCliBatch, listq);
+ cliDestroyBatch(pBatch);
+ }
+ taosMemoryFree(pBatchList->ip);
+ taosMemoryFree(pBatchList->dst);
+ taosMemoryFree(pBatchList);
+
+ pIter = (void**)taosHashIterate(pThrd->batchCache, pIter);
+ }
+ taosHashCleanup(pThrd->batchCache);
taosMemoryFree(pThrd);
}
@@ -1813,9 +2308,9 @@ int transSendRequest(void* shandle, const SEpSet* pEpSet, STransMsg* pReq, STran
}
TRACE_SET_MSGID(&pReq->info.traceId, tGenIdPI64());
-
STransConnCtx* pCtx = taosMemoryCalloc(1, sizeof(STransConnCtx));
pCtx->epSet = *pEpSet;
+ pCtx->origEpSet = *pEpSet;
pCtx->ahandle = pReq->info.ahandle;
pCtx->msgType = pReq->msgType;
@@ -1935,4 +2430,3 @@ int64_t transAllocHandle() {
return exh->refId;
}
-#endif
diff --git a/source/libs/transport/src/transComm.c b/source/libs/transport/src/transComm.c
index 1161ed7c00408a9559146ba532c74055813f5c5d..4c107a88f18d39fb4bebb2f45237a9de669e5db4 100644
--- a/source/libs/transport/src/transComm.c
+++ b/source/libs/transport/src/transComm.c
@@ -205,6 +205,10 @@ bool transReadComplete(SConnBuffer* connBuf) {
}
int transSetConnOption(uv_tcp_t* stream) {
+#if defined(WINDOWS) || defined(DARWIN)
+#else
+ uv_tcp_keepalive(stream, 1, 20);
+#endif
return uv_tcp_nodelay(stream, 1);
// int ret = uv_tcp_keepalive(stream, 5, 60);
}
@@ -214,24 +218,37 @@ SAsyncPool* transAsyncPoolCreate(uv_loop_t* loop, int sz, void* arg, AsyncCB cb)
pool->nAsync = sz;
pool->asyncs = taosMemoryCalloc(1, sizeof(uv_async_t) * pool->nAsync);
- for (int i = 0; i < pool->nAsync; i++) {
+ int i = 0, err = 0;
+ for (i = 0; i < pool->nAsync; i++) {
+ uv_async_t* async = &(pool->asyncs[i]);
+
SAsyncItem* item = taosMemoryCalloc(1, sizeof(SAsyncItem));
item->pThrd = arg;
QUEUE_INIT(&item->qmsg);
taosThreadMutexInit(&item->mtx, NULL);
- uv_async_t* async = &(pool->asyncs[i]);
- uv_async_init(loop, async, cb);
async->data = item;
+ err = uv_async_init(loop, async, cb);
+ if (err != 0) {
+ tError("failed to init async, reason:%s", uv_err_name(err));
+ break;
+ }
+ }
+
+ if (i != pool->nAsync) {
+ transAsyncPoolDestroy(pool);
+ pool = NULL;
}
+
return pool;
}
void transAsyncPoolDestroy(SAsyncPool* pool) {
for (int i = 0; i < pool->nAsync; i++) {
uv_async_t* async = &(pool->asyncs[i]);
-
SAsyncItem* item = async->data;
+ if (item == NULL) continue;
+
taosThreadMutexDestroy(&item->mtx);
taosMemoryFree(item);
}
diff --git a/source/libs/transport/src/transSvr.c b/source/libs/transport/src/transSvr.c
index fa8929f7d954fd42a04f3b8bade2cb084d79c981..04e094ae9a8dc48781b56a59a3693f798aa531c7 100644
--- a/source/libs/transport/src/transSvr.c
+++ b/source/libs/transport/src/transSvr.c
@@ -12,8 +12,6 @@
* along with this program. If not, see .
*/
-#ifdef USE_UV
-
#include "transComm.h"
static TdThreadOnce transModuleInit = PTHREAD_ONCE_INIT;
@@ -246,11 +244,11 @@ static bool uvHandleReq(SSvrConn* pConn) {
}
} else {
if (cost >= EXCEPTION_LIMIT_US) {
- tGWarn("%s conn %p %s received from %s, local info:%s, len:%d, resp:%d, code:%d, cost:%dus, recv exception",
+ tGWarn("%s conn %p %s received from %s, local info:%s, len:%d, noResp:%d, code:%d, cost:%dus, recv exception",
transLabel(pTransInst), pConn, TMSG_INFO(transMsg.msgType), pConn->dst, pConn->src, msgLen, pHead->noResp,
transMsg.code, (int)(cost));
} else {
- tGDebug("%s conn %p %s received from %s, local info:%s, len:%d, resp:%d, code:%d, cost:%dus",
+ tGDebug("%s conn %p %s received from %s, local info:%s, len:%d, noResp:%d, code:%d, cost:%dus",
transLabel(pTransInst), pConn, TMSG_INFO(transMsg.msgType), pConn->dst, pConn->src, msgLen, pHead->noResp,
transMsg.code, (int)(cost));
}
@@ -1347,5 +1345,3 @@ _return2:
}
int transGetConnInfo(void* thandle, STransHandleInfo* pConnInfo) { return -1; }
-
-#endif
diff --git a/source/libs/transport/test/cliBench.c b/source/libs/transport/test/cliBench.c
index 01e88b99888080ab3162669b8d8ee0083fbf2edd..aaee162cd754eb1e209fc21d8568fd703c57d303 100644
--- a/source/libs/transport/test/cliBench.c
+++ b/source/libs/transport/test/cliBench.c
@@ -32,22 +32,21 @@ typedef struct {
void *pRpc;
} SInfo;
-
void initLogEnv() {
- const char *logDir = "/tmp/trans_cli";
- const char* defaultLogFileNamePrefix = "taoslog";
+ const char *logDir = "/tmp/trans_cli";
+ const char *defaultLogFileNamePrefix = "taoslog";
const int32_t maxLogFileNum = 10000;
tsAsyncLog = 0;
- //idxDebugFlag = 143;
+ // idxDebugFlag = 143;
strcpy(tsLogDir, (char *)logDir);
taosRemoveDir(tsLogDir);
- taosMkDir(tsLogDir);
-
+ taosMkDir(tsLogDir);
+
if (taosInitLog(defaultLogFileNamePrefix, maxLogFileNum) < 0) {
- printf("failed to open log file in directory:%s\n", tsLogDir);
+ printf("failed to open log file in directory:%s\n", tsLogDir);
}
}
-
+
static void processResponse(void *parent, SRpcMsg *pMsg, SEpSet *pEpSet) {
SInfo *pInfo = (SInfo *)pMsg->info.ahandle;
tDebug("thread:%d, response is received, type:%d contLen:%d code:0x%x", pInfo->index, pMsg->msgType, pMsg->contLen,
@@ -72,11 +71,12 @@ static void *sendRequest(void *param) {
rpcMsg.pCont = rpcMallocCont(pInfo->msgSize);
rpcMsg.contLen = pInfo->msgSize;
rpcMsg.info.ahandle = pInfo;
+ rpcMsg.info.noResp = 1;
rpcMsg.msgType = 1;
tDebug("thread:%d, send request, contLen:%d num:%d", pInfo->index, pInfo->msgSize, pInfo->num);
rpcSendRequest(pInfo->pRpc, &pInfo->epSet, &rpcMsg, NULL);
if (pInfo->num % 20000 == 0) tInfo("thread:%d, %d requests have been sent", pInfo->index, pInfo->num);
- tsem_wait(&pInfo->rspSem);
+ // tsem_wait(&pInfo->rspSem);
}
tDebug("thread:%d, it is over", pInfo->index);
@@ -112,7 +112,12 @@ int main(int argc, char *argv[]) {
rpcInit.sessions = 100;
rpcInit.idleTime = tsShellActivityTimer * 1000;
rpcInit.user = "michael";
+
rpcInit.connType = TAOS_CONN_CLIENT;
+ rpcInit.connLimitNum = 10;
+ rpcInit.connLimitLock = 1;
+ rpcInit.batchSize = 16 * 1024;
+ rpcInit.supportBatch = 1;
rpcDebugFlag = 135;
for (int i = 1; i < argc; ++i) {
@@ -148,7 +153,6 @@ int main(int argc, char *argv[]) {
exit(0);
}
}
-
initLogEnv();
diff --git a/source/libs/wal/src/walMeta.c b/source/libs/wal/src/walMeta.c
index a5473789670f47ca9e562f624a1d6c2dd6bd350a..707c47f6b17b479b731b2481100fefc66671fbea 100644
--- a/source/libs/wal/src/walMeta.c
+++ b/source/libs/wal/src/walMeta.c
@@ -759,28 +759,30 @@ int walMetaDeserialize(SWal* pWal, const char* bytes) {
// deserialize
SArray* pArray = pWal->fileInfoSet;
taosArrayEnsureCap(pArray, sz);
- SWalFileInfo* pData = pArray->pData;
+
for (int i = 0; i < sz; i++) {
- cJSON* pInfoJson = cJSON_GetArrayItem(pFiles, i);
+ pInfoJson = cJSON_GetArrayItem(pFiles, i);
if (!pInfoJson) goto _err;
- SWalFileInfo* pInfo = &pData[i];
+
+ SWalFileInfo info = {0};
+
pField = cJSON_GetObjectItem(pInfoJson, "firstVer");
if (!pField) goto _err;
- pInfo->firstVer = atoll(cJSON_GetStringValue(pField));
+ info.firstVer = atoll(cJSON_GetStringValue(pField));
pField = cJSON_GetObjectItem(pInfoJson, "lastVer");
if (!pField) goto _err;
- pInfo->lastVer = atoll(cJSON_GetStringValue(pField));
+ info.lastVer = atoll(cJSON_GetStringValue(pField));
pField = cJSON_GetObjectItem(pInfoJson, "createTs");
if (!pField) goto _err;
- pInfo->createTs = atoll(cJSON_GetStringValue(pField));
+ info.createTs = atoll(cJSON_GetStringValue(pField));
pField = cJSON_GetObjectItem(pInfoJson, "closeTs");
if (!pField) goto _err;
- pInfo->closeTs = atoll(cJSON_GetStringValue(pField));
+ info.closeTs = atoll(cJSON_GetStringValue(pField));
pField = cJSON_GetObjectItem(pInfoJson, "fileSize");
if (!pField) goto _err;
- pInfo->fileSize = atoll(cJSON_GetStringValue(pField));
+ info.fileSize = atoll(cJSON_GetStringValue(pField));
+ taosArrayPush(pArray, &info);
}
- taosArraySetSize(pArray, sz);
pWal->fileInfoSet = pArray;
pWal->writeCur = sz - 1;
cJSON_Delete(pRoot);
diff --git a/source/libs/wal/src/walRead.c b/source/libs/wal/src/walRead.c
index 07228bddd82ee6711627e38a2fd497495752251d..5e09af5b2e9e8e5c55eb8e3f4414ecd48582f6b9 100644
--- a/source/libs/wal/src/walRead.c
+++ b/source/libs/wal/src/walRead.c
@@ -241,7 +241,6 @@ static int32_t walFetchHeadNew(SWalReader *pRead, int64_t fetchVer) {
if (pRead->curInvalid || pRead->curVersion != fetchVer) {
if (walReadSeekVer(pRead, fetchVer) < 0) {
- ASSERT(0);
pRead->curVersion = fetchVer;
pRead->curInvalid = 1;
return -1;
@@ -262,7 +261,6 @@ static int32_t walFetchHeadNew(SWalReader *pRead, int64_t fetchVer) {
} else {
terrno = TSDB_CODE_WAL_FILE_CORRUPTED;
}
- ASSERT(0);
pRead->curInvalid = 1;
return -1;
}
@@ -299,7 +297,6 @@ static int32_t walFetchBodyNew(SWalReader *pRead) {
terrno = TSDB_CODE_WAL_FILE_CORRUPTED;
}
pRead->curInvalid = 1;
- ASSERT(0);
return -1;
}
@@ -308,7 +305,6 @@ static int32_t walFetchBodyNew(SWalReader *pRead) {
pRead->pHead->head.version, ver);
pRead->curInvalid = 1;
terrno = TSDB_CODE_WAL_FILE_CORRUPTED;
- ASSERT(0);
return -1;
}
@@ -316,7 +312,6 @@ static int32_t walFetchBodyNew(SWalReader *pRead) {
wError("vgId:%d, wal fetch body error:%" PRId64 ", since body checksum not passed", pRead->pWal->cfg.vgId, ver);
pRead->curInvalid = 1;
terrno = TSDB_CODE_WAL_FILE_CORRUPTED;
- ASSERT(0);
return -1;
}
@@ -335,7 +330,6 @@ static int32_t walSkipFetchBodyNew(SWalReader *pRead) {
if (code < 0) {
terrno = TAOS_SYSTEM_ERROR(errno);
pRead->curInvalid = 1;
- ASSERT(0);
return -1;
}
@@ -384,7 +378,6 @@ int32_t walFetchHead(SWalReader *pRead, int64_t ver, SWalCkHead *pHead) {
} else {
terrno = TSDB_CODE_WAL_FILE_CORRUPTED;
}
- ASSERT(0);
pRead->curInvalid = 1;
return -1;
}
@@ -447,7 +440,6 @@ int32_t walFetchBody(SWalReader *pRead, SWalCkHead **ppHead) {
if (pReadHead->bodyLen != taosReadFile(pRead->pLogFile, pReadHead->body, pReadHead->bodyLen)) {
if (pReadHead->bodyLen < 0) {
- ASSERT(0);
terrno = TAOS_SYSTEM_ERROR(errno);
wError("vgId:%d, wal fetch body error:%" PRId64 ", read request index:%" PRId64 ", since %s",
pRead->pWal->cfg.vgId, pReadHead->version, ver, tstrerror(terrno));
@@ -457,12 +449,10 @@ int32_t walFetchBody(SWalReader *pRead, SWalCkHead **ppHead) {
terrno = TSDB_CODE_WAL_FILE_CORRUPTED;
}
pRead->curInvalid = 1;
- ASSERT(0);
return -1;
}
if (pReadHead->version != ver) {
- ASSERT(0);
wError("vgId:%d, wal fetch body error, index:%" PRId64 ", read request index:%" PRId64, pRead->pWal->cfg.vgId,
pReadHead->version, ver);
pRead->curInvalid = 1;
@@ -471,7 +461,6 @@ int32_t walFetchBody(SWalReader *pRead, SWalCkHead **ppHead) {
}
if (walValidBodyCksum(*ppHead) != 0) {
- ASSERT(0);
wError("vgId:%d, wal fetch body error, index:%" PRId64 ", since body checksum not passed", pRead->pWal->cfg.vgId,
ver);
pRead->curInvalid = 1;
@@ -594,3 +583,12 @@ int32_t walReadVer(SWalReader *pReader, int64_t ver) {
return 0;
}
+
+void walReadReset(SWalReader *pReader) {
+ taosThreadMutexLock(&pReader->mutex);
+ taosCloseFile(&pReader->pIdxFile);
+ taosCloseFile(&pReader->pLogFile);
+ pReader->curInvalid = 1;
+ pReader->curFileFirstVer = -1;
+ taosThreadMutexUnlock(&pReader->mutex);
+}
diff --git a/source/libs/wal/src/walWrite.c b/source/libs/wal/src/walWrite.c
index d4ea526b7839193a8bebac5e5f4205ba688900d9..96c77d09717df50920252b311c90607db5ab4dc8 100644
--- a/source/libs/wal/src/walWrite.c
+++ b/source/libs/wal/src/walWrite.c
@@ -87,8 +87,6 @@ int32_t walApplyVer(SWal *pWal, int64_t ver) {
}
int32_t walCommit(SWal *pWal, int64_t ver) {
- ASSERT(pWal->vers.commitVer >= pWal->vers.snapshotVer);
- ASSERT(pWal->vers.commitVer <= pWal->vers.lastVer);
if (ver < pWal->vers.commitVer) {
return 0;
}
@@ -122,41 +120,37 @@ int32_t walRollback(SWal *pWal, int64_t ver) {
// delete files in descending order
int fileSetSize = taosArrayGetSize(pWal->fileInfoSet);
- for (int i = fileSetSize - 1; i >= pWal->writeCur + 1; i--) {
- walBuildLogName(pWal, ((SWalFileInfo *)taosArrayGet(pWal->fileInfoSet, i))->firstVer, fnameStr);
+ for (int i = pWal->writeCur + 1; i < fileSetSize; i++) {
+ SWalFileInfo* pInfo = taosArrayPop(pWal->fileInfoSet);
+
+ walBuildLogName(pWal, pInfo->firstVer, fnameStr);
wDebug("vgId:%d, wal remove file %s for rollback", pWal->cfg.vgId, fnameStr);
taosRemoveFile(fnameStr);
- walBuildIdxName(pWal, ((SWalFileInfo *)taosArrayGet(pWal->fileInfoSet, i))->firstVer, fnameStr);
+ walBuildIdxName(pWal, pInfo->firstVer, fnameStr);
wDebug("vgId:%d, wal remove file %s for rollback", pWal->cfg.vgId, fnameStr);
taosRemoveFile(fnameStr);
}
- // pop from fileInfoSet
- taosArraySetSize(pWal->fileInfoSet, pWal->writeCur + 1);
}
walBuildIdxName(pWal, walGetCurFileFirstVer(pWal), fnameStr);
TdFilePtr pIdxFile = taosOpenFile(fnameStr, TD_FILE_WRITE | TD_FILE_READ | TD_FILE_APPEND);
if (pIdxFile == NULL) {
- ASSERT(0);
taosThreadMutexUnlock(&pWal->mutex);
return -1;
}
int64_t idxOff = walGetVerIdxOffset(pWal, ver);
code = taosLSeekFile(pIdxFile, idxOff, SEEK_SET);
if (code < 0) {
- ASSERT(0);
taosThreadMutexUnlock(&pWal->mutex);
return -1;
}
// read idx file and get log file pos
SWalIdxEntry entry;
if (taosReadFile(pIdxFile, &entry, sizeof(SWalIdxEntry)) != sizeof(SWalIdxEntry)) {
- ASSERT(0);
taosThreadMutexUnlock(&pWal->mutex);
return -1;
}
- ASSERT(entry.ver == ver);
walBuildLogName(pWal, walGetCurFileFirstVer(pWal), fnameStr);
TdFilePtr pLogFile = taosOpenFile(fnameStr, TD_FILE_WRITE | TD_FILE_READ | TD_FILE_APPEND);
@@ -176,24 +170,19 @@ int32_t walRollback(SWal *pWal, int64_t ver) {
}
// validate offset
SWalCkHead head;
- ASSERT(taosValidFile(pLogFile));
- int64_t size = taosReadFile(pLogFile, &head, sizeof(SWalCkHead));
+ int64_t size = taosReadFile(pLogFile, &head, sizeof(SWalCkHead));
if (size != sizeof(SWalCkHead)) {
- ASSERT(0);
taosThreadMutexUnlock(&pWal->mutex);
return -1;
}
code = walValidHeadCksum(&head);
- ASSERT(code == 0);
if (code != 0) {
terrno = TSDB_CODE_WAL_FILE_CORRUPTED;
- ASSERT(0);
taosThreadMutexUnlock(&pWal->mutex);
return -1;
}
if (head.head.version != ver) {
- ASSERT(0);
terrno = TSDB_CODE_WAL_FILE_CORRUPTED;
taosThreadMutexUnlock(&pWal->mutex);
return -1;
@@ -202,22 +191,17 @@ int32_t walRollback(SWal *pWal, int64_t ver) {
// truncate old files
code = taosFtruncateFile(pLogFile, entry.offset);
if (code < 0) {
- ASSERT(0);
terrno = TAOS_SYSTEM_ERROR(errno);
taosThreadMutexUnlock(&pWal->mutex);
return -1;
}
code = taosFtruncateFile(pIdxFile, idxOff);
if (code < 0) {
- ASSERT(0);
terrno = TAOS_SYSTEM_ERROR(errno);
taosThreadMutexUnlock(&pWal->mutex);
return -1;
}
pWal->vers.lastVer = ver - 1;
- if (pWal->vers.lastVer < pWal->vers.firstVer) {
- ASSERT(pWal->vers.lastVer == pWal->vers.firstVer - 1);
- }
((SWalFileInfo *)taosArrayGetLast(pWal->fileInfoSet))->lastVer = ver - 1;
((SWalFileInfo *)taosArrayGetLast(pWal->fileInfoSet))->fileSize = entry.offset;
taosCloseFile(&pIdxFile);
@@ -386,7 +370,7 @@ int32_t walEndSnapshot(SWal *pWal) {
walBuildIdxName(pWal, pInfo->firstVer, fnameStr);
wDebug("vgId:%d, wal remove file %s", pWal->cfg.vgId, fnameStr);
if (taosRemoveFile(fnameStr) < 0 && errno != ENOENT) {
- ASSERT(0);
+ goto END;
}
}
taosArrayClear(pWal->toDeleteFiles);
@@ -441,7 +425,6 @@ int32_t walRollImpl(SWal *pWal) {
pWal->pIdxFile = pIdxFile;
pWal->pLogFile = pLogFile;
pWal->writeCur = taosArrayGetSize(pWal->fileInfoSet) - 1;
- ASSERT(pWal->writeCur >= 0);
pWal->lastRollSeq = walGetSeq();
@@ -458,9 +441,7 @@ END:
static int32_t walWriteIndex(SWal *pWal, int64_t ver, int64_t offset) {
SWalIdxEntry entry = {.ver = ver, .offset = offset};
SWalFileInfo *pFileInfo = walGetCurFileInfo(pWal);
- ASSERT(pFileInfo != NULL);
- ASSERT(pFileInfo->firstVer >= 0);
- int64_t idxOffset = (entry.ver - pFileInfo->firstVer) * sizeof(SWalIdxEntry);
+ int64_t idxOffset = (entry.ver - pFileInfo->firstVer) * sizeof(SWalIdxEntry);
wDebug("vgId:%d, write index, index:%" PRId64 ", offset:%" PRId64 ", at %" PRId64, pWal->cfg.vgId, ver, offset,
idxOffset);
@@ -476,7 +457,6 @@ static int32_t walWriteIndex(SWal *pWal, int64_t ver, int64_t offset) {
if (endOffset < 0) {
wFatal("vgId:%d, failed to seek end of idxfile due to %s. ver:%" PRId64 "", pWal->cfg.vgId, strerror(errno), ver);
}
- ASSERT(endOffset == idxOffset + sizeof(SWalIdxEntry) && "Offset of idx entries misaligned");
return 0;
}
@@ -486,9 +466,7 @@ static FORCE_INLINE int32_t walWriteImpl(SWal *pWal, int64_t index, tmsg_t msgTy
int64_t offset = walGetCurFileOffset(pWal);
SWalFileInfo *pFileInfo = walGetCurFileInfo(pWal);
- ASSERT(pFileInfo != NULL);
- ASSERT(pFileInfo->firstVer != -1);
pWal->writeHead.head.version = index;
pWal->writeHead.head.bodyLen = bodyLen;
pWal->writeHead.head.msgType = msgType;
@@ -525,7 +503,6 @@ static FORCE_INLINE int32_t walWriteImpl(SWal *pWal, int64_t index, tmsg_t msgTy
// set status
if (pWal->vers.firstVer == -1) {
- ASSERT(index == 0);
pWal->vers.firstVer = 0;
}
pWal->vers.lastVer = index;
@@ -541,7 +518,6 @@ END:
wFatal("vgId:%d, failed to ftruncate logfile to offset:%" PRId64 " during recovery due to %s", pWal->cfg.vgId,
offset, strerror(errno));
terrno = TAOS_SYSTEM_ERROR(errno);
- ASSERT(0 && "failed to recover from error");
}
int64_t idxOffset = (index - pFileInfo->firstVer) * sizeof(SWalIdxEntry);
@@ -549,7 +525,6 @@ END:
wFatal("vgId:%d, failed to ftruncate idxfile to offset:%" PRId64 "during recovery due to %s", pWal->cfg.vgId,
idxOffset, strerror(errno));
terrno = TAOS_SYSTEM_ERROR(errno);
- ASSERT(0 && "failed to recover from error");
}
return -1;
}
@@ -576,8 +551,6 @@ int64_t walAppendLog(SWal *pWal, int64_t index, tmsg_t msgType, SWalSyncInfo syn
}
}
- ASSERT(pWal->pLogFile != NULL && pWal->pIdxFile != NULL && pWal->writeCur >= 0);
-
if (walWriteImpl(pWal, index, msgType, syncMeta, body, bodyLen) < 0) {
taosThreadMutexUnlock(&pWal->mutex);
return -1;
@@ -614,8 +587,6 @@ int32_t walWriteWithSyncInfo(SWal *pWal, int64_t index, tmsg_t msgType, SWalSync
}
}
- ASSERT(pWal->pIdxFile != NULL && pWal->pLogFile != NULL && pWal->writeCur >= 0);
-
if (walWriteImpl(pWal, index, msgType, syncMeta, body, bodyLen) < 0) {
taosThreadMutexUnlock(&pWal->mutex);
return -1;
diff --git a/source/os/CMakeLists.txt b/source/os/CMakeLists.txt
index 3aac5e97751295be13956283c2e8dae46f4c453e..bc554c48a341f51ff4cf51306a7e5b45299f4282 100644
--- a/source/os/CMakeLists.txt
+++ b/source/os/CMakeLists.txt
@@ -37,7 +37,9 @@ if(CHECK_STR2INT_ERROR)
add_definitions(-DTD_CHECK_STR_TO_INT_ERROR)
endif()
target_link_libraries(
- os PUBLIC pthread
+ os
+ PUBLIC pthread
+ PUBLIC zlibstatic
)
if(TD_WINDOWS)
target_link_libraries(
@@ -63,4 +65,4 @@ ENDIF ()
if(${BUILD_TEST})
add_subdirectory(test)
-endif(${BUILD_TEST})
\ No newline at end of file
+endif(${BUILD_TEST})
diff --git a/source/os/src/osFile.c b/source/os/src/osFile.c
index 3f527e913025af968753a47a77e713ac165874fc..4cdf4cbdbc512fec2d774a442afe00a68f450bd2 100644
--- a/source/os/src/osFile.c
+++ b/source/os/src/osFile.c
@@ -15,6 +15,7 @@
#define ALLOW_FORBID_FUNC
#include "os.h"
#include "osSemaphore.h"
+#include "zlib.h"
#ifdef WINDOWS
#include
@@ -830,3 +831,48 @@ bool taosCheckAccessFile(const char *pathname, int32_t tdFileAccessOptions) {
}
bool taosCheckExistFile(const char *pathname) { return taosCheckAccessFile(pathname, TD_FILE_ACCESS_EXIST_OK); };
+
+int32_t taosCompressFile(char *srcFileName, char *destFileName) {
+ int32_t compressSize = 163840;
+ int32_t ret = 0;
+ int32_t len = 0;
+ char *data = taosMemoryMalloc(compressSize);
+ gzFile dstFp = NULL;
+
+ TdFilePtr pSrcFile = taosOpenFile(srcFileName, TD_FILE_READ | TD_FILE_STREAM);
+ if (pSrcFile == NULL) {
+ ret = -1;
+ goto cmp_end;
+ }
+
+ TdFilePtr pFile = taosOpenFile(destFileName, TD_FILE_CREATE | TD_FILE_WRITE | TD_FILE_TRUNC);
+ if (pFile == NULL) {
+ ret = -2;
+ goto cmp_end;
+ }
+
+ dstFp = gzdopen(pFile->fd, "wb6f");
+ if (dstFp == NULL) {
+ ret = -3;
+ taosCloseFile(&pFile);
+ goto cmp_end;
+ }
+
+ while (!feof(pSrcFile->fp)) {
+ len = (int32_t)fread(data, 1, compressSize, pSrcFile->fp);
+ (void)gzwrite(dstFp, data, len);
+ }
+
+cmp_end:
+ if (pSrcFile) {
+ taosCloseFile(&pSrcFile);
+ }
+
+ if (dstFp) {
+ gzclose(dstFp);
+ }
+
+ taosMemoryFree(data);
+
+ return ret;
+}
diff --git a/source/os/src/osSocket.c b/source/os/src/osSocket.c
index 6611a937f2486693e5cf82eff7d9d1c7ec1394a1..3a93a26b8576976a96d6a523575413ee854fa683 100644
--- a/source/os/src/osSocket.c
+++ b/source/os/src/osSocket.c
@@ -55,7 +55,7 @@ typedef struct TdSocket {
#endif
int refId;
SocketFd fd;
-} * TdSocketPtr, TdSocket;
+} *TdSocketPtr, TdSocket;
typedef struct TdSocketServer {
#if SOCKET_WITH_LOCK
@@ -63,7 +63,7 @@ typedef struct TdSocketServer {
#endif
int refId;
SocketFd fd;
-} * TdSocketServerPtr, TdSocketServer;
+} *TdSocketServerPtr, TdSocketServer;
typedef struct TdEpoll {
#if SOCKET_WITH_LOCK
@@ -71,7 +71,7 @@ typedef struct TdEpoll {
#endif
int refId;
EpollFd fd;
-} * TdEpollPtr, TdEpoll;
+} *TdEpollPtr, TdEpoll;
#if 0
int32_t taosSendto(TdSocketPtr pSocket, void *buf, int len, unsigned int flags, const struct sockaddr *dest_addr,
@@ -944,7 +944,7 @@ uint32_t taosGetIpv4FromFqdn(const char *fqdn) {
iResult = WSAStartup(MAKEWORD(2, 2), &wsaData);
if (iResult != 0) {
// printf("WSAStartup failed: %d\n", iResult);
- return 1;
+ return 0xFFFFFFFF;
}
#endif
struct addrinfo hints = {0};
@@ -1005,7 +1005,7 @@ int32_t taosGetFqdn(char *fqdn) {
// immediately
// hints.ai_family = AF_INET;
strcpy(fqdn, hostname);
- strcpy(fqdn+strlen(hostname), ".local");
+ strcpy(fqdn + strlen(hostname), ".local");
#else // __APPLE__
struct addrinfo hints = {0};
struct addrinfo *result = NULL;
@@ -1060,7 +1060,7 @@ int32_t taosCreateSocketWithTimeout(uint32_t timeout) {
#if defined(WINDOWS)
SOCKET fd;
#else
- int fd;
+ int fd;
#endif
if ((fd = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP)) == INVALID_SOCKET) {
return -1;
@@ -1071,13 +1071,14 @@ int32_t taosCreateSocketWithTimeout(uint32_t timeout) {
return -1;
}
#elif defined(_TD_DARWIN_64)
- uint32_t conn_timeout_ms = timeout * 1000;
- if (0 != setsockopt(fd, IPPROTO_TCP, TCP_CONNECTIONTIMEOUT, (char *)&conn_timeout_ms, sizeof(conn_timeout_ms))) {
- taosCloseSocketNoCheck1(fd);
- return -1;
- }
+ // invalid config
+ // uint32_t conn_timeout_ms = timeout * 1000;
+ // if (0 != setsockopt(fd, IPPROTO_TCP, TCP_CONNECTIONTIMEOUT, (char *)&conn_timeout_ms, sizeof(conn_timeout_ms))) {
+ // taosCloseSocketNoCheck1(fd);
+ // return -1;
+ //}
#else // Linux like systems
- uint32_t conn_timeout_ms = timeout * 1000;
+ uint32_t conn_timeout_ms = timeout;
if (0 != setsockopt(fd, IPPROTO_TCP, TCP_USER_TIMEOUT, (char *)&conn_timeout_ms, sizeof(conn_timeout_ms))) {
taosCloseSocketNoCheck1(fd);
return -1;
diff --git a/source/os/src/osSysinfo.c b/source/os/src/osSysinfo.c
index aeaa4fcafd1d2bd609b134368beee1c0c656227b..897e68a12687e3ae713f685a2898a4061bb78f81 100644
--- a/source/os/src/osSysinfo.c
+++ b/source/os/src/osSysinfo.c
@@ -18,6 +18,7 @@
#include "taoserror.h"
#define PROCESS_ITEM 12
+#define UUIDLEN37 37
typedef struct {
uint64_t user;
@@ -830,7 +831,8 @@ int32_t taosGetSystemUUID(char *uid, int32_t uidlen) {
return 0;
#elif defined(_TD_DARWIN_64)
uuid_t uuid = {0};
- char buf[37] = {0};
+ char buf[UUIDLEN37];
+ memset(buf, 0, UUIDLEN37);
uuid_generate(uuid);
// it's caller's responsibility to make enough space for `uid`, that's 36-char + 1-null
uuid_unparse_lower(uuid, buf);
diff --git a/source/util/src/tarray.c b/source/util/src/tarray.c
index 237edfdeb269ded87e2f2d191095a4bc92eb6b95..64701574bb030a6353474c85008f934c2841defc 100644
--- a/source/util/src/tarray.c
+++ b/source/util/src/tarray.c
@@ -48,6 +48,26 @@ SArray* taosArrayInit(size_t size, size_t elemSize) {
return pArray;
}
+SArray* taosArrayInit_s(size_t size, size_t elemSize, size_t initialSize) {
+ SArray* pArray = taosMemoryMalloc(sizeof(SArray));
+ if (pArray == NULL) {
+ terrno = TSDB_CODE_OUT_OF_MEMORY;
+ return NULL;
+ }
+
+ pArray->size = initialSize;
+ pArray->pData = taosMemoryCalloc(initialSize, elemSize);
+ if (pArray->pData == NULL) {
+ terrno = TSDB_CODE_OUT_OF_MEMORY;
+ taosMemoryFree(pArray);
+ return NULL;
+ }
+
+ pArray->capacity = initialSize;
+ pArray->elemSize = elemSize;
+ return pArray;
+}
+
static int32_t taosArrayResize(SArray* pArray) {
assert(pArray->size >= pArray->capacity);
@@ -223,7 +243,13 @@ void* taosArrayGetP(const SArray* pArray, size_t index) {
return *p;
}
-void* taosArrayGetLast(const SArray* pArray) { return TARRAY_GET_ELEM(pArray, pArray->size - 1); }
+void* taosArrayGetLast(const SArray* pArray) {
+ if (pArray->size == 0) {
+ return NULL;
+ }
+
+ return TARRAY_GET_ELEM(pArray, pArray->size - 1);
+}
size_t taosArrayGetSize(const SArray* pArray) {
if (pArray == NULL) {
@@ -232,11 +258,6 @@ size_t taosArrayGetSize(const SArray* pArray) {
return pArray->size;
}
-void taosArraySetSize(SArray* pArray, size_t size) {
- assert(size <= pArray->capacity);
- pArray->size = size;
-}
-
void* taosArrayInsert(SArray* pArray, size_t index, void* pData) {
if (pArray == NULL || pData == NULL) {
return NULL;
diff --git a/source/util/src/tcompression.c b/source/util/src/tcompression.c
index 64d550e874f8a7f22b54a3f5ac27e59c317f8025..7631da1b568406f03e520bb7153c59aee3e4f343 100644
--- a/source/util/src/tcompression.c
+++ b/source/util/src/tcompression.c
@@ -228,6 +228,7 @@ int32_t tsCompressINTImp(const char *const input, const int32_t nelements, char
}
int32_t tsDecompressINTImp(const char *const input, const int32_t nelements, char *const output, const char type) {
+
int32_t word_length = 0;
switch (type) {
case TSDB_DATA_TYPE_BIGINT:
@@ -263,8 +264,9 @@ int32_t tsDecompressINTImp(const char *const input, const int32_t nelements, cha
int32_t _pos = 0;
int64_t prev_value = 0;
+#if __AVX2__
while (1) {
- if (count == nelements) break;
+ if (_pos == nelements) break;
uint64_t w = 0;
memcpy(&w, ip, LONG_BYTES);
@@ -274,85 +276,163 @@ int32_t tsDecompressINTImp(const char *const input, const int32_t nelements, cha
int32_t elems = selector_to_elems[(int32_t)selector];
// Optimize the performance, by remove the constantly switch operation.
- int32_t v = 0;
- uint64_t zigzag_value;
+ int32_t v = 4;
+ uint64_t zigzag_value = 0;
+ uint64_t mask = INT64MASK(bit);
switch (type) {
case TSDB_DATA_TYPE_BIGINT: {
- for (int32_t i = 0; i < elems; i++) {
- if (selector == 0 || selector == 1) {
- zigzag_value = 0;
+ int64_t* p = (int64_t*) output;
+
+ int32_t gRemainder = (nelements - _pos);
+ int32_t num = (gRemainder > elems)? elems:gRemainder;
+
+ int32_t batch = num >> 2;
+ int32_t remain = num & 0x03;
+ if (selector == 0 || selector == 1) {
+ if (tsAVX2Enable && tsSIMDBuiltins) {
+ for (int32_t i = 0; i < batch; ++i) {
+ __m256i prev = _mm256_set1_epi64x(prev_value);
+ _mm256_storeu_si256((__m256i *)&p[_pos], prev);
+ _pos += 4;
+ }
+
+ for (int32_t i = 0; i < remain; ++i) {
+ p[_pos++] = prev_value;
+ }
} else {
- zigzag_value = ((w >> (4 + v)) & INT64MASK(bit));
+ for (int32_t i = 0; i < elems && count < nelements; i++, count++) {
+ p[_pos++] = prev_value;
+ v += bit;
+ }
}
+ } else {
+ if (tsAVX2Enable && tsSIMDBuiltins) {
+ __m256i base = _mm256_set1_epi64x(w);
+ __m256i maskVal = _mm256_set1_epi64x(mask);
+
+ __m256i shiftBits = _mm256_set_epi64x(bit * 3 + 4, bit * 2 + 4, bit + 4, 4);
+ __m256i inc = _mm256_set1_epi64x(bit << 2);
+
+ for (int32_t i = 0; i < batch; ++i) {
+ __m256i after = _mm256_srlv_epi64(base, shiftBits);
+ __m256i zigzagVal = _mm256_and_si256(after, maskVal);
+
+ // ZIGZAG_DECODE(T, v) (((v) >> 1) ^ -((T)((v)&1)))
+ __m256i signmask = _mm256_and_si256(_mm256_set1_epi64x(1), zigzagVal);
+ signmask = _mm256_sub_epi64(_mm256_setzero_si256(), signmask);
+ // get the four zigzag values here
+ __m256i delta = _mm256_xor_si256(_mm256_srli_epi64(zigzagVal, 1), signmask);
+
+ // calculate the cumulative sum (prefix sum) for each number
+ // decode[0] = prev_value + final[0]
+ // decode[1] = decode[0] + final[1] -----> prev_value + final[0] + final[1]
+ // decode[2] = decode[1] + final[2] -----> prev_value + final[0] + final[1] + final[2]
+ // decode[3] = decode[2] + final[3] -----> prev_value + final[0] + final[1] + final[2] + final[3]
+
+ // 1, 2, 3, 4
+ //+ 0, 1, 0, 3
+ // 1, 3, 3, 7
+ // shift and add for the first round
+ __m128i prev = _mm_set1_epi64x(prev_value);
+ __m256i x = _mm256_slli_si256(delta, 8);
+
+ delta = _mm256_add_epi64(delta, x);
+ _mm256_storeu_si256((__m256i *)&p[_pos], delta);
+
+ // 1, 3, 3, 7
+ //+ 0, 0, 3, 3
+ // 1, 3, 6, 10
+ // shift and add operation for the second round
+ __m128i firstPart = _mm_loadu_si128((__m128i *)&p[_pos]);
+ __m128i secondItem = _mm_set1_epi64x(p[_pos + 1]);
+ __m128i secPart = _mm_add_epi64(_mm_loadu_si128((__m128i *)&p[_pos + 2]), secondItem);
+ firstPart = _mm_add_epi64(firstPart, prev);
+ secPart = _mm_add_epi64(secPart, prev);
+
+ // save it in the memory
+ _mm_storeu_si128((__m128i *)&p[_pos], firstPart);
+ _mm_storeu_si128((__m128i *)&p[_pos + 2], secPart);
+
+ shiftBits = _mm256_add_epi64(shiftBits, inc);
+ prev_value = p[_pos + 3];
+// uDebug("_pos:%d %"PRId64", %"PRId64", %"PRId64", %"PRId64, _pos, p[_pos], p[_pos+1], p[_pos+2], p[_pos+3]);
+ _pos += 4;
+ }
- int64_t diff = ZIGZAG_DECODE(int64_t, zigzag_value);
- int64_t curr_value = diff + prev_value;
- prev_value = curr_value;
+ // handle the remain value
+ for (int32_t i = 0; i < remain; i++) {
+ zigzag_value = ((w >> (v + (batch * bit * 4))) & mask);
+ prev_value += ZIGZAG_DECODE(int64_t, zigzag_value);
- *((int64_t *)output + _pos) = (int64_t)curr_value;
- _pos++;
+ p[_pos++] = prev_value;
+// uDebug("_pos:%d %"PRId64, _pos-1, p[_pos-1]);
- v += bit;
- if ((++count) == nelements) break;
+ v += bit;
+ }
+ } else {
+ for (int32_t i = 0; i < elems && count < nelements; i++, count++) {
+ zigzag_value = ((w >> v) & mask);
+ prev_value += ZIGZAG_DECODE(int64_t, zigzag_value);
+
+ p[_pos++] = prev_value;
+// uDebug("_pos:%d %"PRId64, _pos-1, p[_pos-1]);
+
+ v += bit;
+ }
+ }
}
} break;
case TSDB_DATA_TYPE_INT: {
- for (int32_t i = 0; i < elems; i++) {
- if (selector == 0 || selector == 1) {
- zigzag_value = 0;
- } else {
- zigzag_value = ((w >> (4 + v)) & INT64MASK(bit));
- }
+ int32_t* p = (int32_t*) output;
- int64_t diff = ZIGZAG_DECODE(int64_t, zigzag_value);
- int64_t curr_value = diff + prev_value;
- prev_value = curr_value;
-
- *((int32_t *)output + _pos) = (int32_t)curr_value;
- _pos++;
+ if (selector == 0 || selector == 1) {
+ for (int32_t i = 0; i < elems && count < nelements; i++, count++) {
+ p[_pos++] = (int32_t)prev_value;
+ }
+ } else {
+ for (int32_t i = 0; i < elems && count < nelements; i++, count++) {
+ zigzag_value = ((w >> v) & mask);
+ prev_value += ZIGZAG_DECODE(int64_t, zigzag_value);
- v += bit;
- if ((++count) == nelements) break;
+ p[_pos++] = (int32_t)prev_value;
+ v += bit;
+ }
}
} break;
case TSDB_DATA_TYPE_SMALLINT: {
- for (int32_t i = 0; i < elems; i++) {
- if (selector == 0 || selector == 1) {
- zigzag_value = 0;
- } else {
- zigzag_value = ((w >> (4 + v)) & INT64MASK(bit));
- }
-
- int64_t diff = ZIGZAG_DECODE(int64_t, zigzag_value);
- int64_t curr_value = diff + prev_value;
- prev_value = curr_value;
+ int16_t* p = (int16_t*) output;
- *((int16_t *)output + _pos) = (int16_t)curr_value;
- _pos++;
+ if (selector == 0 || selector == 1) {
+ for (int32_t i = 0; i < elems && count < nelements; i++, count++) {
+ p[_pos++] = (int16_t)prev_value;
+ }
+ } else {
+ for (int32_t i = 0; i < elems && count < nelements; i++, count++) {
+ zigzag_value = ((w >> v) & mask);
+ prev_value += ZIGZAG_DECODE(int64_t, zigzag_value);
- v += bit;
- if ((++count) == nelements) break;
+ p[_pos++] = (int16_t)prev_value;
+ v += bit;
+ }
}
} break;
case TSDB_DATA_TYPE_TINYINT: {
- for (int32_t i = 0; i < elems; i++) {
- if (selector == 0 || selector == 1) {
- zigzag_value = 0;
- } else {
- zigzag_value = ((w >> (4 + v)) & INT64MASK(bit));
- }
-
- int64_t diff = ZIGZAG_DECODE(int64_t, zigzag_value);
- int64_t curr_value = diff + prev_value;
- prev_value = curr_value;
+ int8_t *p = (int8_t *)output;
- *((int8_t *)output + _pos) = (int8_t)curr_value;
- _pos++;
+ if (selector == 0 || selector == 1) {
+ for (int32_t i = 0; i < elems && count < nelements; i++, count++) {
+ p[_pos++] = (int8_t)prev_value;
+ }
+ } else {
+ for (int32_t i = 0; i < elems && count < nelements; i++, count++) {
+ zigzag_value = ((w >> v) & mask);
+ prev_value += ZIGZAG_DECODE(int64_t, zigzag_value);
- v += bit;
- if ((++count) == nelements) break;
+ p[_pos++] = (int8_t)prev_value;
+ v += bit;
+ }
}
} break;
}
@@ -361,6 +441,59 @@ int32_t tsDecompressINTImp(const char *const input, const int32_t nelements, cha
}
return nelements * word_length;
+#else
+
+ while (1) {
+ if (count == nelements) break;
+
+ uint64_t w = 0;
+ memcpy(&w, ip, LONG_BYTES);
+
+ char selector = (char)(w & INT64MASK(4)); // selector = 4
+ char bit = bit_per_integer[(int32_t)selector]; // bit = 3
+ int32_t elems = selector_to_elems[(int32_t)selector];
+
+ for (int32_t i = 0; i < elems; i++) {
+ uint64_t zigzag_value;
+
+ if (selector == 0 || selector == 1) {
+ zigzag_value = 0;
+ } else {
+ zigzag_value = ((w >> (4 + bit * i)) & INT64MASK(bit));
+ }
+ int64_t diff = ZIGZAG_DECODE(int64_t, zigzag_value);
+ int64_t curr_value = diff + prev_value;
+ prev_value = curr_value;
+
+ switch (type) {
+ case TSDB_DATA_TYPE_BIGINT:
+ *((int64_t *)output + _pos) = (int64_t)curr_value;
+ _pos++;
+ break;
+ case TSDB_DATA_TYPE_INT:
+ *((int32_t *)output + _pos) = (int32_t)curr_value;
+ _pos++;
+ break;
+ case TSDB_DATA_TYPE_SMALLINT:
+ *((int16_t *)output + _pos) = (int16_t)curr_value;
+ _pos++;
+ break;
+ case TSDB_DATA_TYPE_TINYINT:
+ *((int8_t *)output + _pos) = (int8_t)curr_value;
+ _pos++;
+ break;
+ default:
+ perror("Wrong integer types.\n");
+ return -1;
+ }
+ count++;
+ if (count == nelements) break;
+ }
+ ip += LONG_BYTES;
+ }
+
+ return nelements * word_length;
+#endif
}
/* ----------------------------------------------Bool Compression
diff --git a/source/util/src/terror.c b/source/util/src/terror.c
index 14c3df38a7583f9e38acf936cebce78d7d6f77aa..c07fa88af5b6bf9b0c63efcac1c1c189d3f45f3d 100644
--- a/source/util/src/terror.c
+++ b/source/util/src/terror.c
@@ -52,6 +52,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_RPC_PORT_EADDRINUSE, "Port already in use")
TAOS_DEFINE_ERROR(TSDB_CODE_RPC_BROKEN_LINK, "Conn is broken")
TAOS_DEFINE_ERROR(TSDB_CODE_RPC_TIMEOUT, "Conn read timeout")
TAOS_DEFINE_ERROR(TSDB_CODE_RPC_SOMENODE_NOT_CONNECTED, "some vnode/qnode/mnode(s) out of service")
+TAOS_DEFINE_ERROR(TSDB_CODE_RPC_MAX_SESSIONS, "rpc open too many session")
//common & util
TAOS_DEFINE_ERROR(TSDB_CODE_TIME_UNSYNCED, "Client and server's time is not synchronized")
@@ -88,6 +89,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_NEED_RETRY, "Retry needed")
TAOS_DEFINE_ERROR(TSDB_CODE_OUT_OF_RPC_MEMORY_QUEUE, "Out of memory in rpc queue")
TAOS_DEFINE_ERROR(TSDB_CODE_INVALID_TIMESTAMP, "Invalid timestamp format")
TAOS_DEFINE_ERROR(TSDB_CODE_MSG_DECODE_ERROR, "Msg decode error")
+TAOS_DEFINE_ERROR(TSDB_CODE_MSG_ENCODE_ERROR, "Msg encode error")
TAOS_DEFINE_ERROR(TSDB_CODE_NO_AVAIL_DISK, "No available disk")
TAOS_DEFINE_ERROR(TSDB_CODE_NOT_FOUND, "Not found")
TAOS_DEFINE_ERROR(TSDB_CODE_NO_DISKSPACE, "Out of disk space")
@@ -287,6 +289,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_MND_STREAM_NOT_EXIST, "Stream not exist")
TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_STREAM_OPTION, "Invalid stream option")
TAOS_DEFINE_ERROR(TSDB_CODE_MND_STREAM_MUST_BE_DELETED, "Stream must be dropped first")
TAOS_DEFINE_ERROR(TSDB_CODE_MND_MULTI_REPLICA_SOURCE_DB, "Stream temporarily does not support source db having replica > 1")
+TAOS_DEFINE_ERROR(TSDB_CODE_MND_TOO_MANY_STREAMS, "Too many streams")
// mnode-sma
TAOS_DEFINE_ERROR(TSDB_CODE_MND_SMA_ALREADY_EXIST, "SMA already exists")
diff --git a/source/util/src/thash.c b/source/util/src/thash.c
index e9548613aa9b3ce2edc4f00db8b1662202a03b38..926dc304a47caebdb0bd5c215bfc73cfefe87d5a 100644
--- a/source/util/src/thash.c
+++ b/source/util/src/thash.c
@@ -421,7 +421,11 @@ int32_t taosHashGetDup_m(SHashObj *pHashObj, const void *key, size_t keyLen, voi
}
void *taosHashGetImpl(SHashObj *pHashObj, const void *key, size_t keyLen, void **d, int32_t *size, bool addRef) {
- if (pHashObj == NULL || taosHashTableEmpty(pHashObj) || keyLen == 0 || key == NULL) {
+ if (pHashObj == NULL || keyLen == 0 || key == NULL) {
+ return NULL;
+ }
+
+ if ((atomic_load_64((int64_t *)&pHashObj->size) == 0)) {
return NULL;
}
diff --git a/source/util/src/thashutil.c b/source/util/src/thashutil.c
index 59f7d389c263a72aa11c2521bc546e268cf74f2b..21b9359076078900196769046b54ff31fd88b0e4 100644
--- a/source/util/src/thashutil.c
+++ b/source/util/src/thashutil.c
@@ -17,6 +17,7 @@
#include "tcompare.h"
#include "thash.h"
#include "types.h"
+#include "xxhash.h"
#define ROTL32(x, r) ((x) << (r) | (x) >> (32u - (r)))
@@ -49,6 +50,11 @@ uint32_t taosDJB2Hash(const char *key, uint32_t len) {
return hash;
}
+uint32_t xxHash(const char *key, uint32_t len) {
+ int32_t seed = 0xcc9e2d51;
+ return XXH32(key, len, seed);
+}
+
uint32_t MurmurHash3_32(const char *key, uint32_t len) {
const uint8_t *data = (const uint8_t *)key;
const int32_t nblocks = len >> 2u;
@@ -192,8 +198,6 @@ _hash_fn_t taosGetDefaultHashFunction(int32_t type) {
fn = taosIntHash_64;
break;
case TSDB_DATA_TYPE_BINARY:
- fn = MurmurHash3_32;
- break;
case TSDB_DATA_TYPE_NCHAR:
fn = MurmurHash3_32;
break;
diff --git a/source/util/src/tjson.c b/source/util/src/tjson.c
index 48638af8d59e2fa326db88e3c10c7fa85be8e741..27d14d05b10185a4ca3d5d162b4b15dbd28faa3d 100644
--- a/source/util/src/tjson.c
+++ b/source/util/src/tjson.c
@@ -325,11 +325,10 @@ int32_t tjsonToTArray(const SJson* pJson, const char* pName, FToObject func, SAr
const cJSON* jArray = tjsonGetObjectItem(pJson, pName);
int32_t size = tjsonGetArraySize(jArray);
if (size > 0) {
- *pArray = taosArrayInit(size, itemSize);
+ *pArray = taosArrayInit_s(size, itemSize, size);
if (NULL == *pArray) {
return TSDB_CODE_OUT_OF_MEMORY;
}
- taosArraySetSize(*pArray, size);
for (int32_t i = 0; i < size; ++i) {
int32_t code = func(tjsonGetArrayItem(jArray, i), taosArrayGet(*pArray, i));
if (TSDB_CODE_SUCCESS != code) {
diff --git a/source/util/src/tlog.c b/source/util/src/tlog.c
index 62f074db5b9e28ffe71ca7ec3f4506b619ad20b1..89dd51a8924b3a24e70a665a3ae76e14541f6081 100644
--- a/source/util/src/tlog.c
+++ b/source/util/src/tlog.c
@@ -115,7 +115,6 @@ static int32_t taosPushLogBuffer(SLogBuff *pLogBuf, const char *msg, int32_t m
static SLogBuff *taosLogBuffNew(int32_t bufSize);
static void taosCloseLogByFd(TdFilePtr pFile);
static int32_t taosOpenLogFile(char *fn, int32_t maxLines, int32_t maxFileNum);
-static int32_t taosCompressFile(char *srcFileName, char *destFileName);
static FORCE_INLINE void taosUpdateDaylight() {
struct tm Tm, *ptm;
@@ -748,50 +747,6 @@ static void *taosAsyncOutputLog(void *param) {
return NULL;
}
-int32_t taosCompressFile(char *srcFileName, char *destFileName) {
- int32_t compressSize = 163840;
- int32_t ret = 0;
- int32_t len = 0;
- char *data = taosMemoryMalloc(compressSize);
- // gzFile dstFp = NULL;
-
- // srcFp = fopen(srcFileName, "r");
- TdFilePtr pSrcFile = taosOpenFile(srcFileName, TD_FILE_READ);
- if (pSrcFile == NULL) {
- ret = -1;
- goto cmp_end;
- }
-
- TdFilePtr pFile = taosOpenFile(destFileName, TD_FILE_CREATE | TD_FILE_WRITE | TD_FILE_TRUNC);
- if (pFile == NULL) {
- ret = -2;
- goto cmp_end;
- }
-
- // dstFp = gzdopen(fd, "wb6f");
- // if (dstFp == NULL) {
- // ret = -3;
- // close(fd);
- // goto cmp_end;
- // }
- //
- // while (!feof(srcFp)) {
- // len = (int32_t)fread(data, 1, compressSize, srcFp);
- // (void)gzwrite(dstFp, data, len);
- // }
-
-cmp_end:
- if (pSrcFile) {
- taosCloseFile(&pSrcFile);
- }
- // if (dstFp) {
- // gzclose(dstFp);
- // }
- taosMemoryFree(data);
-
- return ret;
-}
-
bool taosAssertDebug(bool condition, const char *file, int32_t line, const char *format, ...) {
if (condition) return false;
diff --git a/source/util/src/tpagedbuf.c b/source/util/src/tpagedbuf.c
index 7c60862c56b8544dc815723aa5427dc604a0fff5..6bcf4ad39b729786e2d562d7a928b0a4965dc03d 100644
--- a/source/util/src/tpagedbuf.c
+++ b/source/util/src/tpagedbuf.c
@@ -2,14 +2,14 @@
#include "tpagedbuf.h"
#include "taoserror.h"
#include "tcompression.h"
-#include "thash.h"
+#include "tsimplehash.h"
#include "tlog.h"
-#define GET_PAYLOAD_DATA(_p) ((char*)(_p)->pData + POINTER_BYTES)
-#define BUF_PAGE_IN_MEM(_p) ((_p)->pData != NULL)
+#define GET_PAYLOAD_DATA(_p) ((char*)(_p)->pData + POINTER_BYTES)
+#define BUF_PAGE_IN_MEM(_p) ((_p)->pData != NULL)
#define CLEAR_BUF_PAGE_IN_MEM_FLAG(_p) ((_p)->pData = NULL)
-#define HAS_DATA_IN_DISK(_p) ((_p)->offset >= 0)
-#define NO_IN_MEM_AVAILABLE_PAGES(_b) (listNEles((_b)->lruList) >= (_b)->inMemPages)
+#define HAS_DATA_IN_DISK(_p) ((_p)->offset >= 0)
+#define NO_IN_MEM_AVAILABLE_PAGES(_b) (listNEles((_b)->lruList) >= (_b)->inMemPages)
typedef struct SPageDiskInfo {
int64_t offset;
@@ -17,7 +17,7 @@ typedef struct SPageDiskInfo {
} SPageDiskInfo, SFreeListItem;
struct SPageInfo {
- SListNode* pn; // point to list node struct. it is NULL when the page is evicted from the in-memory buffer
+ SListNode* pn; // point to list node struct. it is NULL when the page is evicted from the in-memory buffer
void* pData;
int64_t offset;
int32_t pageId;
@@ -38,7 +38,7 @@ struct SDiskbasedBuf {
int32_t inMemPages; // numOfPages that are allocated in memory
SList* freePgList; // free page list
SArray* pIdList; // page id list
- SHashObj* all;
+ SSHashObj*all;
SList* lruList;
void* emptyDummyIdList; // dummy id list
void* assistBuf; // assistant buffer for compress/decompress data
@@ -52,10 +52,13 @@ struct SDiskbasedBuf {
};
static int32_t createDiskFile(SDiskbasedBuf* pBuf) {
- if (pBuf->path == NULL) { // prepare the file name when needed it
+ if (pBuf->path == NULL) { // prepare the file name when needed it
char path[PATH_MAX] = {0};
taosGetTmpfilePath(pBuf->prefix, "paged-buf", path);
pBuf->path = taosMemoryStrDup(path);
+ if (pBuf->path == NULL) {
+ return TSDB_CODE_OUT_OF_MEMORY;
+ }
}
pBuf->pFile =
@@ -126,6 +129,30 @@ static uint64_t allocateNewPositionInFile(SDiskbasedBuf* pBuf, size_t size) {
static FORCE_INLINE size_t getAllocPageSize(int32_t pageSize) { return pageSize + POINTER_BYTES + sizeof(SFilePage); }
+static int32_t doFlushBufPageImpl(SDiskbasedBuf* pBuf, int64_t offset, const char* pData, int32_t size) {
+ int32_t ret = taosLSeekFile(pBuf->pFile, offset, SEEK_SET);
+ if (ret == -1) {
+ terrno = TAOS_SYSTEM_ERROR(errno);
+ return terrno;
+ }
+
+ ret = (int32_t)taosWriteFile(pBuf->pFile, pData, size);
+ if (ret != size) {
+ terrno = TAOS_SYSTEM_ERROR(errno);
+ return terrno;
+ }
+
+ // extend the file
+ if (pBuf->fileSize < offset + size) {
+ pBuf->fileSize = offset + size;
+ }
+
+ pBuf->statis.flushBytes += size;
+ pBuf->statis.flushPages += 1;
+
+ return TSDB_CODE_SUCCESS;
+}
+
static char* doFlushBufPage(SDiskbasedBuf* pBuf, SPageInfo* pg) {
if (pg->pData == NULL || pg->used) {
uError("invalid params in paged buffer process when flushing buf to disk, %s", pBuf->id);
@@ -134,12 +161,15 @@ static char* doFlushBufPage(SDiskbasedBuf* pBuf, SPageInfo* pg) {
}
int32_t size = pBuf->pageSize;
- char* t = NULL;
+ int64_t offset = pg->offset;
+
+ char* t = NULL;
if ((!HAS_DATA_IN_DISK(pg)) || pg->dirty) {
void* payload = GET_PAYLOAD_DATA(pg);
t = doCompressData(payload, pBuf->pageSize, &size, pBuf);
if (size < 0) {
uError("failed to compress data when flushing data to disk, %s", pBuf->id);
+ terrno = TSDB_CODE_INVALID_PARA;
return NULL;
}
}
@@ -147,59 +177,29 @@ static char* doFlushBufPage(SDiskbasedBuf* pBuf, SPageInfo* pg) {
// this page is flushed to disk for the first time
if (pg->dirty) {
if (!HAS_DATA_IN_DISK(pg)) {
- pg->offset = allocateNewPositionInFile(pBuf, size);
+ offset = allocateNewPositionInFile(pBuf, size);
pBuf->nextPos += size;
- int32_t ret = taosLSeekFile(pBuf->pFile, pg->offset, SEEK_SET);
- if (ret == -1) {
- terrno = TAOS_SYSTEM_ERROR(errno);
+ int32_t code = doFlushBufPageImpl(pBuf, offset, t, size);
+ if (code != TSDB_CODE_SUCCESS) {
return NULL;
}
-
- ret = (int32_t)taosWriteFile(pBuf->pFile, t, size);
- if (ret != size) {
- terrno = TAOS_SYSTEM_ERROR(errno);
- return NULL;
- }
-
- // extend the file size
- if (pBuf->fileSize < pg->offset + size) {
- pBuf->fileSize = pg->offset + size;
- }
-
- pBuf->statis.flushBytes += size;
- pBuf->statis.flushPages += 1;
} else {
// length becomes greater, current space is not enough, allocate new place, otherwise, do nothing
if (pg->length < size) {
// 1. add current space to free list
- SPageDiskInfo dinfo = {.length = pg->length, .offset = pg->offset};
+ SPageDiskInfo dinfo = {.length = pg->length, .offset = offset};
taosArrayPush(pBuf->pFree, &dinfo);
// 2. allocate new position, and update the info
- pg->offset = allocateNewPositionInFile(pBuf, size);
+ offset = allocateNewPositionInFile(pBuf, size);
pBuf->nextPos += size;
}
- // 3. write to disk.
- int32_t ret = taosLSeekFile(pBuf->pFile, pg->offset, SEEK_SET);
- if (ret == -1) {
- terrno = TAOS_SYSTEM_ERROR(errno);
- return NULL;
- }
-
- ret = (int32_t)taosWriteFile(pBuf->pFile, t, size);
- if (ret != size) {
- terrno = TAOS_SYSTEM_ERROR(errno);
+ int32_t code = doFlushBufPageImpl(pBuf, offset, t, size);
+ if (code != TSDB_CODE_SUCCESS) {
return NULL;
}
-
- if (pBuf->fileSize < pg->offset + size) {
- pBuf->fileSize = pg->offset + size;
- }
-
- pBuf->statis.flushBytes += size;
- pBuf->statis.flushPages += 1;
}
} else { // NOTE: the size may be -1, the this recycle page has not been flushed to disk yet.
size = pg->length;
@@ -209,9 +209,10 @@ static char* doFlushBufPage(SDiskbasedBuf* pBuf, SPageInfo* pg) {
memset(pDataBuf, 0, getAllocPageSize(pBuf->pageSize));
#ifdef BUF_PAGE_DEBUG
- uDebug("page_flush %p, pageId:%d, offset:%d", pDataBuf, pg->pageId, pg->offset);
+ uDebug("page_flush %p, pageId:%d, offset:%d", pDataBuf, pg->pageId, offset);
#endif
+ pg->offset = offset;
pg->length = size; // on disk size
return pDataBuf;
}
@@ -236,7 +237,7 @@ static char* flushBufPage(SDiskbasedBuf* pBuf, SPageInfo* pg) {
// load file block data in disk
static int32_t loadPageFromDisk(SDiskbasedBuf* pBuf, SPageInfo* pg) {
if (pg->offset < 0 || pg->length <= 0) {
- uError("failed to load buf page from disk, offset:%"PRId64", length:%d, %s", pg->offset, pg->length, pBuf->id);
+ uError("failed to load buf page from disk, offset:%" PRId64 ", length:%d, %s", pg->offset, pg->length, pBuf->id);
return TSDB_CODE_INVALID_PARA;
}
@@ -303,6 +304,7 @@ static SListNode* getEldestUnrefedPage(SDiskbasedBuf* pBuf) {
static char* evictBufPage(SDiskbasedBuf* pBuf) {
SListNode* pn = getEldestUnrefedPage(pBuf);
if (pn == NULL) { // no available buffer pages now, return.
+ terrno = TSDB_CODE_OUT_OF_MEMORY;
return NULL;
}
@@ -372,24 +374,19 @@ int32_t createDiskbasedBuf(SDiskbasedBuf** pBuf, int32_t pagesize, int32_t inMem
goto _error;
}
- pPBuf->assistBuf = taosMemoryMalloc(pPBuf->pageSize + 2); // EXTRA BYTES
- if (pPBuf->assistBuf == NULL) {
- goto _error;
- }
-
- pPBuf->all = taosHashInit(10, fn, true, false);
+ pPBuf->all = tSimpleHashInit(64, fn);
if (pPBuf->all == NULL) {
goto _error;
}
- pPBuf->prefix = (char*) dir;
+ pPBuf->prefix = (char*)dir;
pPBuf->emptyDummyIdList = taosArrayInit(1, sizeof(int32_t));
// qDebug("QInfo:0x%"PRIx64" create resBuf for output, page size:%d, inmem buf pages:%d, file:%s", qId,
// pPBuf->pageSize, pPBuf->inMemPages, pPBuf->path);
return TSDB_CODE_SUCCESS;
- _error:
+_error:
destroyDiskbasedBuf(pPBuf);
return TSDB_CODE_OUT_OF_MEMORY;
}
@@ -399,11 +396,12 @@ static char* doExtractPage(SDiskbasedBuf* pBuf) {
if (NO_IN_MEM_AVAILABLE_PAGES(pBuf)) {
availablePage = evictBufPage(pBuf);
if (availablePage == NULL) {
- terrno = TSDB_CODE_OUT_OF_MEMORY;
- uWarn("no available buf pages, current:%d, max:%d", listNEles(pBuf->lruList), pBuf->inMemPages)
+ uWarn("no available buf pages, current:%d, max:%d, reason: %s, %s", listNEles(pBuf->lruList), pBuf->inMemPages,
+ terrstr(), pBuf->id)
}
} else {
- availablePage = taosMemoryCalloc(1, getAllocPageSize(pBuf->pageSize)); // add extract bytes in case of zipped buffer increased.
+ availablePage =
+ taosMemoryCalloc(1, getAllocPageSize(pBuf->pageSize)); // add extract bytes in case of zipped buffer increased.
if (availablePage == NULL) {
terrno = TSDB_CODE_OUT_OF_MEMORY;
}
@@ -438,7 +436,7 @@ void* getNewBufPage(SDiskbasedBuf* pBuf, int32_t* pageId) {
}
// add to hash map
- taosHashPut(pBuf->all, pageId, sizeof(int32_t), &pi, POINTER_BYTES);
+ tSimpleHashPut(pBuf->all, pageId, sizeof(int32_t), &pi, POINTER_BYTES);
pBuf->totalBufSize += pBuf->pageSize;
}
@@ -463,7 +461,7 @@ void* getBufPage(SDiskbasedBuf* pBuf, int32_t id) {
pBuf->statis.getPages += 1;
- SPageInfo** pi = taosHashGet(pBuf->all, &id, sizeof(int32_t));
+ SPageInfo** pi = tSimpleHashGet(pBuf->all, &id, sizeof(int32_t));
if (pi == NULL || *pi == NULL) {
uError("failed to locate the buffer page:%d, %s", id, pBuf->id);
terrno = TSDB_CODE_INVALID_PARA;
@@ -551,9 +549,7 @@ void releaseBufPageInfo(SDiskbasedBuf* pBuf, SPageInfo* pi) {
size_t getTotalBufSize(const SDiskbasedBuf* pBuf) { return (size_t)pBuf->totalBufSize; }
-SArray* getDataBufPagesIdList(SDiskbasedBuf* pBuf) {
- return pBuf->pIdList;
-}
+SArray* getDataBufPagesIdList(SDiskbasedBuf* pBuf) { return pBuf->pIdList; }
void destroyDiskbasedBuf(SDiskbasedBuf* pBuf) {
if (pBuf == NULL) {
@@ -567,7 +563,7 @@ void destroyDiskbasedBuf(SDiskbasedBuf* pBuf) {
needRemoveFile = true;
uDebug(
"Paged buffer closed, total:%.2f Kb (%d Pages), inmem size:%.2f Kb (%d Pages), file size:%.2f Kb, page "
- "size:%.2f Kb, %s\n",
+ "size:%.2f Kb, %s",
pBuf->totalBufSize / 1024.0, pBuf->numOfPages, listNEles(pBuf->lruList) * pBuf->pageSize / 1024.0,
listNEles(pBuf->lruList), pBuf->fileSize / 1024.0, pBuf->pageSize / 1024.0f, pBuf->id);
@@ -584,8 +580,7 @@ void destroyDiskbasedBuf(SDiskbasedBuf* pBuf) {
ps->releasePages, ps->flushBytes / 1024.0f, ps->flushPages, ps->loadBytes / 1024.0f, ps->loadPages);
} else {
uDebug(
- "Get/Release pages:%d/%d, flushToDisk:%.2f Kb (%d Pages), loadFromDisk:%.2f Kb (%d Pages), avgPageSize:%.2f "
- "Kb",
+ "Get/Release pages:%d/%d, flushToDisk:%.2f Kb (%d Pages), loadFromDisk:%.2f Kb (%d Pages), avgPgSize:%.2f Kb",
ps->getPages, ps->releasePages, ps->flushBytes / 1024.0f, ps->flushPages, ps->loadBytes / 1024.0f,
ps->loadPages, ps->loadBytes / (1024.0 * ps->loadPages));
}
@@ -615,7 +610,7 @@ void destroyDiskbasedBuf(SDiskbasedBuf* pBuf) {
taosArrayDestroy(pBuf->emptyDummyIdList);
taosArrayDestroy(pBuf->pFree);
- taosHashCleanup(pBuf->all);
+ tSimpleHashCleanup(pBuf->all);
taosMemoryFreeClear(pBuf->id);
taosMemoryFreeClear(pBuf->assistBuf);
@@ -628,9 +623,7 @@ SPageInfo* getLastPageInfo(SArray* pList) {
return pPgInfo;
}
-int32_t getPageId(const SPageInfo* pPgInfo) {
- return pPgInfo->pageId;
-}
+int32_t getPageId(const SPageInfo* pPgInfo) { return pPgInfo->pageId; }
int32_t getBufPageSize(const SDiskbasedBuf* pBuf) { return pBuf->pageSize; }
@@ -643,7 +636,12 @@ void setBufPageDirty(void* pPage, bool dirty) {
ppi->dirty = dirty;
}
-void setBufPageCompressOnDisk(SDiskbasedBuf* pBuf, bool comp) { pBuf->comp = comp; }
+void setBufPageCompressOnDisk(SDiskbasedBuf* pBuf, bool comp) {
+ pBuf->comp = comp;
+ if (comp && (pBuf->assistBuf == NULL)) {
+ pBuf->assistBuf = taosMemoryMalloc(pBuf->pageSize + 2); // EXTRA BYTES
+ }
+}
void dBufSetBufPageRecycled(SDiskbasedBuf* pBuf, void* pPage) {
SPageInfo* ppi = getPageInfoFromPayload(pPage);
@@ -686,7 +684,7 @@ void dBufPrintStatis(const SDiskbasedBuf* pBuf) {
ps->getPages, ps->releasePages, ps->flushBytes / 1024.0f, ps->flushPages, ps->loadBytes / 1024.0f,
ps->loadPages, ps->loadBytes / (1024.0 * ps->loadPages));
} else {
- //printf("no page loaded\n");
+ // printf("no page loaded\n");
}
}
@@ -706,7 +704,7 @@ void clearDiskbasedBuf(SDiskbasedBuf* pBuf) {
taosArrayClear(pBuf->emptyDummyIdList);
taosArrayClear(pBuf->pFree);
- taosHashClear(pBuf->all);
+ tSimpleHashClear(pBuf->all);
pBuf->numOfPages = 0; // all pages are in buffer in the first place
pBuf->totalBufSize = 0;
diff --git a/source/libs/executor/src/tsimplehash.c b/source/util/src/tsimplehash.c
similarity index 79%
rename from source/libs/executor/src/tsimplehash.c
rename to source/util/src/tsimplehash.c
index fd6215e3a1a5b8b7b99ab3f2a94416fda9c8adff..70acffed5d62fb0b13fd02ff719b0aab577ae76c 100644
--- a/source/libs/executor/src/tsimplehash.c
+++ b/source/util/src/tsimplehash.c
@@ -18,12 +18,13 @@
#include "tlog.h"
#include "tdef.h"
+#define DEFAULT_BUF_PAGE_SIZE 1024
#define SHASH_DEFAULT_LOAD_FACTOR 0.75
#define HASH_MAX_CAPACITY (1024 * 1024 * 16L)
#define SHASH_NEED_RESIZE(_h) ((_h)->size >= (_h)->capacity * SHASH_DEFAULT_LOAD_FACTOR)
-#define GET_SHASH_NODE_KEY(_n, _dl) ((char *)(_n) + sizeof(SHNode) + (_dl))
-#define GET_SHASH_NODE_DATA(_n) ((char *)(_n) + sizeof(SHNode))
+#define GET_SHASH_NODE_DATA(_n) (((SHNode*)_n)->data)
+#define GET_SHASH_NODE_KEY(_n, _dl) ((char*)GET_SHASH_NODE_DATA(_n) + (_dl))
#define HASH_INDEX(v, c) ((v) & ((c)-1))
@@ -38,6 +39,8 @@ struct SSHashObj {
int64_t size; // number of elements in hash table
_hash_fn_t hashFp; // hash function
_equal_fn_t equalFp; // equal function
+ SArray* pHashNodeBuf;// hash node allocation buffer, 1k size of each page by default
+ int32_t offset; // allocation offset in current page
};
static FORCE_INLINE int32_t taosHashCapacity(int32_t length) {
@@ -57,24 +60,28 @@ SSHashObj *tSimpleHashInit(size_t capacity, _hash_fn_t fn) {
capacity = 4;
}
- SSHashObj *pHashObj = (SSHashObj *)taosMemoryCalloc(1, sizeof(SSHashObj));
+ SSHashObj *pHashObj = (SSHashObj *)taosMemoryMalloc(sizeof(SSHashObj));
if (!pHashObj) {
terrno = TSDB_CODE_OUT_OF_MEMORY;
return NULL;
}
// the max slots is not defined by user
+ pHashObj->hashFp = fn;
pHashObj->capacity = taosHashCapacity((int32_t)capacity);
-
pHashObj->equalFp = memcmp;
- pHashObj->hashFp = fn;
+ pHashObj->pHashNodeBuf = taosArrayInit(10, sizeof(void*));
+ pHashObj->offset = 0;
+ pHashObj->size = 0;
+
pHashObj->hashList = (SHNode **)taosMemoryCalloc(pHashObj->capacity, sizeof(void *));
if (!pHashObj->hashList) {
taosMemoryFree(pHashObj);
terrno = TSDB_CODE_OUT_OF_MEMORY;
return NULL;
}
+
return pHashObj;
}
@@ -82,19 +89,53 @@ int32_t tSimpleHashGetSize(const SSHashObj *pHashObj) {
if (!pHashObj) {
return 0;
}
- return (int32_t)atomic_load_64((int64_t *)&pHashObj->size);
+ return (int32_t) pHashObj->size;
+}
+
+static void* doInternalAlloc(SSHashObj* pHashObj, int32_t size) {
+#if 0
+ void** p = taosArrayGetLast(pHashObj->pHashNodeBuf);
+ if (p == NULL || (pHashObj->offset + size) > DEFAULT_BUF_PAGE_SIZE) {
+ // let's allocate one new page
+ int32_t allocSize = TMAX(size, DEFAULT_BUF_PAGE_SIZE);
+ void* pNewPage = taosMemoryMalloc(allocSize);
+ if (pNewPage == NULL) {
+ return NULL;
+ }
+
+ // if the allocate the buffer page is greater than the DFFAULT_BUF_PAGE_SIZE,
+ // pHashObj->offset will always be greater than DEFAULT_BUF_PAGE_SIZE, which means that
+ // current buffer page is full. And a new buffer page needs to be allocated.
+ pHashObj->offset = size;
+ taosArrayPush(pHashObj->pHashNodeBuf, &pNewPage);
+ return pNewPage;
+ } else {
+ void* pPos = (char*)(*p) + pHashObj->offset;
+ pHashObj->offset += size;
+ return pPos;
+ }
+#else
+ return taosMemoryMalloc(size);
+#endif
}
-static SHNode *doCreateHashNode(const void *key, size_t keyLen, const void *data, size_t dataLen, uint32_t hashVal) {
- SHNode *pNewNode = taosMemoryMalloc(sizeof(SHNode) + keyLen + dataLen);
+static SHNode *doCreateHashNode(SSHashObj *pHashObj, const void *key, size_t keyLen, const void *data, size_t dataLen,
+ uint32_t hashVal) {
+ SHNode *pNewNode = doInternalAlloc(pHashObj, sizeof(SHNode) + keyLen + dataLen);
if (!pNewNode) {
terrno = TSDB_CODE_OUT_OF_MEMORY;
return NULL;
}
+
pNewNode->keyLen = keyLen;
pNewNode->dataLen = dataLen;
pNewNode->next = NULL;
- if (data) memcpy(GET_SHASH_NODE_DATA(pNewNode), data, dataLen);
+ pNewNode->hashVal = hashVal;
+
+ if (data) {
+ memcpy(GET_SHASH_NODE_DATA(pNewNode), data, dataLen);
+ }
+
memcpy(GET_SHASH_NODE_KEY(pNewNode, dataLen), key, keyLen);
return pNewNode;
}
@@ -111,7 +152,7 @@ static void tSimpleHashTableResize(SSHashObj *pHashObj) {
return;
}
- int64_t st = taosGetTimestampUs();
+// int64_t st = taosGetTimestampUs();
void *pNewEntryList = taosMemoryRealloc(pHashObj->hashList, POINTER_BYTES * newCapacity);
if (!pNewEntryList) {
uWarn("hash resize failed due to out of memory, capacity remain:%zu", pHashObj->capacity);
@@ -134,10 +175,7 @@ static void tSimpleHashTableResize(SSHashObj *pHashObj) {
SHNode *pPrev = NULL;
while (pNode != NULL) {
- void *key = GET_SHASH_NODE_KEY(pNode, pNode->dataLen);
- uint32_t hashVal = (*pHashObj->hashFp)(key, (uint32_t)pNode->keyLen);
-
- int32_t newIdx = HASH_INDEX(hashVal, pHashObj->capacity);
+ int32_t newIdx = HASH_INDEX(pNode->hashVal, pHashObj->capacity);
pNext = pNode->next;
if (newIdx != idx) {
if (!pPrev) {
@@ -156,8 +194,7 @@ static void tSimpleHashTableResize(SSHashObj *pHashObj) {
}
}
- int64_t et = taosGetTimestampUs();
-
+// int64_t et = taosGetTimestampUs();
// uDebug("hash table resize completed, new capacity:%d, load factor:%f, elapsed time:%fms",
// (int32_t)pHashObj->capacity,
// ((double)pHashObj->size) / pHashObj->capacity, (et - st) / 1000.0);
@@ -179,13 +216,13 @@ int32_t tSimpleHashPut(SSHashObj *pHashObj, const void *key, size_t keyLen, cons
SHNode *pNode = pHashObj->hashList[slot];
if (!pNode) {
- SHNode *pNewNode = doCreateHashNode(key, keyLen, data, dataLen, hashVal);
+ SHNode *pNewNode = doCreateHashNode(pHashObj, key, keyLen, data, dataLen, hashVal);
if (!pNewNode) {
return -1;
}
pHashObj->hashList[slot] = pNewNode;
- atomic_add_fetch_64(&pHashObj->size, 1);
+ pHashObj->size += 1;
return 0;
}
@@ -197,13 +234,13 @@ int32_t tSimpleHashPut(SSHashObj *pHashObj, const void *key, size_t keyLen, cons
}
if (!pNode) {
- SHNode *pNewNode = doCreateHashNode(key, keyLen, data, dataLen, hashVal);
+ SHNode *pNewNode = doCreateHashNode(pHashObj, key, keyLen, data, dataLen, hashVal);
if (!pNewNode) {
return -1;
}
pNewNode->next = pHashObj->hashList[slot];
pHashObj->hashList[slot] = pNewNode;
- atomic_add_fetch_64(&pHashObj->size, 1);
+ pHashObj->size += 1;
} else if (data) { // update data
memcpy(GET_SHASH_NODE_DATA(pNode), data, dataLen);
}
@@ -270,7 +307,7 @@ int32_t tSimpleHashRemove(SSHashObj *pHashObj, const void *key, size_t keyLen) {
pPrev->next = pNode->next;
}
FREE_HASH_NODE(pNode);
- atomic_sub_fetch_64(&pHashObj->size, 1);
+ pHashObj->size -= 1;
code = TSDB_CODE_SUCCESS;
break;
}
@@ -305,7 +342,7 @@ int32_t tSimpleHashIterateRemove(SSHashObj *pHashObj, const void *key, size_t ke
}
FREE_HASH_NODE(pNode);
- atomic_sub_fetch_64(&pHashObj->size, 1);
+ pHashObj->size -= 1;
break;
}
pPrev = pNode;
@@ -315,6 +352,10 @@ int32_t tSimpleHashIterateRemove(SSHashObj *pHashObj, const void *key, size_t ke
return TSDB_CODE_SUCCESS;
}
+static void destroyItems(void* pItem) {
+ taosMemoryFree(*(void**)pItem);
+}
+
void tSimpleHashClear(SSHashObj *pHashObj) {
if (!pHashObj || taosHashTableEmpty(pHashObj)) {
return;
@@ -332,9 +373,13 @@ void tSimpleHashClear(SSHashObj *pHashObj) {
FREE_HASH_NODE(pNode);
pNode = pNext;
}
+
pHashObj->hashList[i] = NULL;
}
- atomic_store_64(&pHashObj->size, 0);
+
+ taosArrayClearEx(pHashObj->pHashNodeBuf, destroyItems);
+ pHashObj->offset = 0;
+ pHashObj->size = 0;
}
void tSimpleHashCleanup(SSHashObj *pHashObj) {
@@ -343,6 +388,7 @@ void tSimpleHashCleanup(SSHashObj *pHashObj) {
}
tSimpleHashClear(pHashObj);
+ taosArrayDestroy(pHashObj->pHashNodeBuf);
taosMemoryFreeClear(pHashObj->hashList);
taosMemoryFree(pHashObj);
}
diff --git a/source/util/src/tutil.c b/source/util/src/tutil.c
index e94f94a00dcdd3b625b9bf705bf19a5febae43a9..1f9ca7407e51240680466f736cb1cf4d3914b531 100644
--- a/source/util/src/tutil.c
+++ b/source/util/src/tutil.c
@@ -118,7 +118,7 @@ char **strsplit(char *z, const char *delim, int32_t *num) {
if ((*num) >= size) {
size = (size << 1);
split = taosMemoryRealloc(split, POINTER_BYTES * size);
- ASSERTS(NULL != split, "realloc memory failed. size=%d", POINTER_BYTES * size);
+ ASSERTS(NULL != split, "realloc memory failed. size=%d", (int32_t) POINTER_BYTES * size);
}
}
@@ -159,10 +159,6 @@ char *strtolower(char *dst, const char *src) {
int32_t esc = 0;
char quote = 0, *p = dst, c;
- if (ASSERTS(dst != NULL, "dst is NULL")) {
- return NULL;
- }
-
for (c = *src++; c; c = *src++) {
if (esc) {
esc = 0;
@@ -188,10 +184,6 @@ char *strntolower(char *dst, const char *src, int32_t n) {
int32_t esc = 0;
char quote = 0, *p = dst, c;
- if (ASSERTS(dst != NULL, "dst is NULL")) {
- return NULL;
- }
-
if (n == 0) {
*p = 0;
return dst;
@@ -219,11 +211,6 @@ char *strntolower(char *dst, const char *src, int32_t n) {
char *strntolower_s(char *dst, const char *src, int32_t n) {
char *p = dst, c;
-
- if (ASSERTS(dst != NULL, "dst is NULL")) {
- return NULL;
- }
-
if (n == 0) {
return NULL;
}
@@ -333,6 +320,50 @@ char *strbetween(char *string, char *begin, char *end) {
return result;
}
+int32_t tintToHex(uint64_t val, char hex[]) {
+ const char hexstr[16] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};
+
+ int32_t j = 0, k = 0;
+ if (val == 0) {
+ hex[j++] = hexstr[0];
+ return j;
+ }
+
+ // ignore the initial 0
+ while((val & (((uint64_t)0xfL) << ((15 - k) * 4))) == 0) {
+ k += 1;
+ }
+
+ for (j = 0; k < 16; ++k, ++j) {
+ hex[j] = hexstr[(val & (((uint64_t)0xfL) << ((15 - k) * 4))) >> (15 - k) * 4];
+ }
+
+ return j;
+}
+
+int32_t titoa(uint64_t val, size_t radix, char str[]) {
+ if (radix < 2 || radix > 16) {
+ return 0;
+ }
+
+ const char* s = "0123456789abcdef";
+ char buf[65] = {0};
+
+ int32_t i = 0;
+ uint64_t v = val;
+ while(v > 0) {
+ buf[i++] = s[v % radix];
+ v /= radix;
+ }
+
+ // reverse order
+ for(int32_t j = 0; j < i; ++j) {
+ str[j] = buf[i - j - 1];
+ }
+
+ return i;
+}
+
int32_t taosByteArrayToHexStr(char bytes[], int32_t len, char hexstr[]) {
int32_t i;
char hexval[16] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};
diff --git a/source/util/src/tworker.c b/source/util/src/tworker.c
index 5581931178486ba05f36640edcf7500477cbc96c..631bcb443ebecdc89ab3338d5dd5254964232093 100644
--- a/source/util/src/tworker.c
+++ b/source/util/src/tworker.c
@@ -22,7 +22,7 @@ typedef void *(*ThreadFp)(void *param);
int32_t tQWorkerInit(SQWorkerPool *pool) {
pool->qset = taosOpenQset();
- pool->workers = taosMemoryCalloc(pool->max, sizeof(SQWorker));
+ pool->workers = taosMemoryCalloc(pool->max, sizeof(SQueueWorker));
if (pool->workers == NULL) {
terrno = TSDB_CODE_OUT_OF_MEMORY;
return -1;
@@ -31,7 +31,7 @@ int32_t tQWorkerInit(SQWorkerPool *pool) {
(void)taosThreadMutexInit(&pool->mutex, NULL);
for (int32_t i = 0; i < pool->max; ++i) {
- SQWorker *worker = pool->workers + i;
+ SQueueWorker *worker = pool->workers + i;
worker->id = i;
worker->pool = pool;
}
@@ -42,14 +42,14 @@ int32_t tQWorkerInit(SQWorkerPool *pool) {
void tQWorkerCleanup(SQWorkerPool *pool) {
for (int32_t i = 0; i < pool->max; ++i) {
- SQWorker *worker = pool->workers + i;
+ SQueueWorker *worker = pool->workers + i;
if (taosCheckPthreadValid(worker->thread)) {
taosQsetThreadResume(pool->qset);
}
}
for (int32_t i = 0; i < pool->max; ++i) {
- SQWorker *worker = pool->workers + i;
+ SQueueWorker *worker = pool->workers + i;
if (taosCheckPthreadValid(worker->thread)) {
uInfo("worker:%s:%d is stopping", pool->name, worker->id);
taosThreadJoin(worker->thread, NULL);
@@ -65,7 +65,7 @@ void tQWorkerCleanup(SQWorkerPool *pool) {
uInfo("worker:%s is closed", pool->name);
}
-static void *tQWorkerThreadFp(SQWorker *worker) {
+static void *tQWorkerThreadFp(SQueueWorker *worker) {
SQWorkerPool *pool = worker->pool;
SQueueInfo qinfo = {0};
void *msg = NULL;
@@ -106,7 +106,7 @@ STaosQueue *tQWorkerAllocQueue(SQWorkerPool *pool, void *ahandle, FItem fp) {
// spawn a thread to process queue
if (pool->num < pool->max) {
do {
- SQWorker *worker = pool->workers + pool->num;
+ SQueueWorker *worker = pool->workers + pool->num;
TdThreadAttr thAttr;
taosThreadAttrInit(&thAttr);
@@ -138,7 +138,7 @@ void tQWorkerFreeQueue(SQWorkerPool *pool, STaosQueue *queue) {
int32_t tAutoQWorkerInit(SAutoQWorkerPool *pool) {
pool->qset = taosOpenQset();
- pool->workers = taosArrayInit(2, sizeof(SQWorker *));
+ pool->workers = taosArrayInit(2, sizeof(SQueueWorker *));
if (pool->workers == NULL) {
terrno = TSDB_CODE_OUT_OF_MEMORY;
return -1;
@@ -153,14 +153,14 @@ int32_t tAutoQWorkerInit(SAutoQWorkerPool *pool) {
void tAutoQWorkerCleanup(SAutoQWorkerPool *pool) {
int32_t size = taosArrayGetSize(pool->workers);
for (int32_t i = 0; i < size; ++i) {
- SQWorker *worker = taosArrayGetP(pool->workers, i);
+ SQueueWorker *worker = taosArrayGetP(pool->workers, i);
if (taosCheckPthreadValid(worker->thread)) {
taosQsetThreadResume(pool->qset);
}
}
for (int32_t i = 0; i < size; ++i) {
- SQWorker *worker = taosArrayGetP(pool->workers, i);
+ SQueueWorker *worker = taosArrayGetP(pool->workers, i);
if (taosCheckPthreadValid(worker->thread)) {
uInfo("worker:%s:%d is stopping", pool->name, worker->id);
taosThreadJoin(worker->thread, NULL);
@@ -177,7 +177,7 @@ void tAutoQWorkerCleanup(SAutoQWorkerPool *pool) {
uInfo("worker:%s is closed", pool->name);
}
-static void *tAutoQWorkerThreadFp(SQWorker *worker) {
+static void *tAutoQWorkerThreadFp(SQueueWorker *worker) {
SAutoQWorkerPool *pool = worker->pool;
SQueueInfo qinfo = {0};
void *msg = NULL;
@@ -222,7 +222,7 @@ STaosQueue *tAutoQWorkerAllocQueue(SAutoQWorkerPool *pool, void *ahandle, FItem
// spawn a thread to process queue
while (curWorkerNum < dstWorkerNum) {
- SQWorker *worker = taosMemoryCalloc(1, sizeof(SQWorker));
+ SQueueWorker *worker = taosMemoryCalloc(1, sizeof(SQueueWorker));
if (worker == NULL || taosArrayPush(pool->workers, &worker) == NULL) {
uError("worker:%s:%d failed to create", pool->name, curWorkerNum);
taosMemoryFree(worker);
diff --git a/source/util/test/utilTests.cpp b/source/util/test/utilTests.cpp
index c56ef348cc3754499a15a84fad3cd93603901077..a35512541089863b66bb69dc95f8ad95504b847e 100644
--- a/source/util/test/utilTests.cpp
+++ b/source/util/test/utilTests.cpp
@@ -294,4 +294,32 @@ TEST(utilTest, tstrncspn) {
const char* reject5 = "911";
v = tstrncspn(p2, strlen(p2), reject5, 0);
ASSERT_EQ(v, 14);
+}
+
+TEST(utilTest, intToHextStr) {
+ char buf[64] = {0};
+
+ int64_t v = 0;
+ tintToHex(0, buf);
+ ASSERT_STREQ(buf, "0");
+
+ v = 100000000;
+ tintToHex(v, buf);
+
+ char destBuf[128];
+ sprintf(destBuf, "%" PRIx64, v);
+ ASSERT_STREQ(buf, destBuf);
+
+ taosSeedRand(taosGetTimestampSec());
+
+ for(int32_t i = 0; i < 100000; ++i) {
+ memset(buf, 0, tListLen(buf));
+ memset(destBuf, 0, tListLen(destBuf));
+
+ v = taosRand();
+ tintToHex(v, buf);
+
+ sprintf(destBuf, "%" PRIx64, v);
+ ASSERT_STREQ(buf, destBuf);
+ }
}
\ No newline at end of file
diff --git a/tests/develop-test/2-query/table_count_scan.py b/tests/develop-test/2-query/table_count_scan.py
index 1ef65bfc67083719afbdbe499ab9a2d6ec3d3ead..5bdc915cdde07e513c9a65fbbcd7cd35e2a93a42 100644
--- a/tests/develop-test/2-query/table_count_scan.py
+++ b/tests/develop-test/2-query/table_count_scan.py
@@ -75,7 +75,7 @@ class TDTestCase:
tdSql.checkData(2, 1, 'performance_schema')
tdSql.checkData(2, 2, None)
- tdSql.query('select count(1),db_name, stable_name from information_schema.ins_tables group by db_name, stable_name;')
+ tdSql.query('select count(1) v,db_name, stable_name from information_schema.ins_tables group by db_name, stable_name order by v desc;')
tdSql.checkRows(3)
tdSql.checkData(0, 0, 23)
tdSql.checkData(0, 1, 'information_schema')
@@ -87,12 +87,12 @@ class TDTestCase:
tdSql.checkData(2, 1, 'tbl_count')
tdSql.checkData(2, 2, 'stb1')
- tdSql.query('select count(1),db_name from information_schema.ins_tables group by db_name')
+ tdSql.query('select count(1) v,db_name from information_schema.ins_tables group by db_name order by v asc')
tdSql.checkRows(3)
- tdSql.checkData(0, 0, 5)
- tdSql.checkData(0, 1, 'performance_schema')
- tdSql.checkData(1, 0, 3)
- tdSql.checkData(1, 1, 'tbl_count')
+ tdSql.checkData(1, 0, 5)
+ tdSql.checkData(1, 1, 'performance_schema')
+ tdSql.checkData(0, 0, 3)
+ tdSql.checkData(0, 1, 'tbl_count')
tdSql.checkData(2, 0, 23)
tdSql.checkData(2, 1, 'information_schema')
@@ -177,42 +177,44 @@ class TDTestCase:
tdSql.execute('insert into tba1 values (\'2021-11-11 09:00:29\',true, 0,0,0,0,0,0,"000","0000",0,0,0,0);')
- tdSql.query('select count(*),db_name, stable_name from information_schema.ins_tables group by db_name, stable_name;')
+ tdSql.query('select count(*) v,db_name, stable_name from information_schema.ins_tables group by db_name, stable_name order by v;')
tdSql.checkRows(4)
tdSql.checkData(0, 0, 1)
tdSql.checkData(0, 1, 'tbl_count')
tdSql.checkData(0, 2, 'stba')
- tdSql.checkData(1, 0, 23)
- tdSql.checkData(1, 1, 'information_schema')
- tdSql.checkData(1, 2, None)
- tdSql.checkData(2, 0, 3)
- tdSql.checkData(2, 1, 'tbl_count')
- tdSql.checkData(2, 2, 'stb1')
- tdSql.checkData(3, 0, 5)
- tdSql.checkData(3, 1, 'performance_schema')
+
+ tdSql.checkData(1, 0, 3)
+ tdSql.checkData(1, 1, 'tbl_count')
+ tdSql.checkData(1, 2, 'stb1')
+ tdSql.checkData(2, 0, 5)
+ tdSql.checkData(2, 1, 'performance_schema')
+ tdSql.checkData(2, 2, None)
+ tdSql.checkData(3, 0, 23)
+ tdSql.checkData(3, 1, 'information_schema')
tdSql.checkData(3, 2, None)
- tdSql.query('select count(1),db_name, stable_name from information_schema.ins_tables group by db_name, stable_name;')
+ tdSql.query('select count(1) v,db_name, stable_name from information_schema.ins_tables group by db_name, stable_name order by v;')
tdSql.checkRows(4)
- tdSql.checkData(0, 0, 23)
- tdSql.checkData(0, 1, 'information_schema')
- tdSql.checkData(0, 2, None)
- tdSql.checkData(1, 0, 5)
- tdSql.checkData(1, 1, 'performance_schema')
- tdSql.checkData(1, 2, None)
- tdSql.checkData(2, 0, 1)
- tdSql.checkData(2, 1, 'tbl_count')
- tdSql.checkData(2, 2, 'stba')
- tdSql.checkData(3, 0, 3)
- tdSql.checkData(3, 1, 'tbl_count')
- tdSql.checkData(3, 2, 'stb1')
+ tdSql.checkData(0, 0, 1)
+ tdSql.checkData(0, 1, 'tbl_count')
+ tdSql.checkData(0, 2, 'stba')
+ tdSql.checkData(1, 0, 3)
+ tdSql.checkData(1, 1, 'tbl_count')
+ tdSql.checkData(1, 2, 'stb1')
+ tdSql.checkData(2, 0, 5)
+ tdSql.checkData(2, 1, 'performance_schema')
+ tdSql.checkData(2, 2, None)
+ tdSql.checkData(3, 0, 23)
+ tdSql.checkData(3, 1, 'information_schema')
+ tdSql.checkData(3, 2, None)
- tdSql.query('select count(1),db_name from information_schema.ins_tables group by db_name')
+ tdSql.query('select count(1) v,db_name from information_schema.ins_tables group by db_name order by v')
tdSql.checkRows(3)
- tdSql.checkData(0, 0, 5)
- tdSql.checkData(0, 1, 'performance_schema')
- tdSql.checkData(1, 0, 4)
- tdSql.checkData(1, 1, 'tbl_count')
+
+ tdSql.checkData(0, 0, 4)
+ tdSql.checkData(0, 1, 'tbl_count')
+ tdSql.checkData(1, 0, 5)
+ tdSql.checkData(1, 1, 'performance_schema')
tdSql.checkData(2, 0, 23)
tdSql.checkData(2, 1, 'information_schema')
diff --git a/tests/parallel_test/cases.task b/tests/parallel_test/cases.task
index df4cc5f4680fa85babd4b94870c566cfe2fe10b5..16751423b173b82601f4f490cead5eb62b94623a 100644
--- a/tests/parallel_test/cases.task
+++ b/tests/parallel_test/cases.task
@@ -178,6 +178,7 @@
,,y,script,./test.sh -f tsim/query/udf_with_const.sim
,,y,script,./test.sh -f tsim/query/sys_tbname.sim
,,y,script,./test.sh -f tsim/query/groupby.sim
+,,y,script,./test.sh -f tsim/query/forceFill.sim
,,y,script,./test.sh -f tsim/qnode/basic1.sim
,,y,script,./test.sh -f tsim/snode/basic1.sim
,,y,script,./test.sh -f tsim/mnode/basic1.sim
@@ -300,7 +301,7 @@
,,y,script,./test.sh -f tsim/vnode/replica3_repeat.sim
,,y,script,./test.sh -f tsim/vnode/replica3_vgroup.sim
,,y,script,./test.sh -f tsim/vnode/replica3_many.sim
-,,y,script,./test.sh -f tsim/vnode/replica3_import.sim
+#,,y,script,./test.sh -f tsim/vnode/replica3_import.sim
,,y,script,./test.sh -f tsim/vnode/stable_balance_replica1.sim
,,y,script,./test.sh -f tsim/vnode/stable_dnode2_stop.sim
,,y,script,./test.sh -f tsim/vnode/stable_dnode2.sim
@@ -405,7 +406,7 @@
,,y,script,./test.sh -f tmp/monitor.sim
#system test
-
+,,y,system-test,./pytest.sh python3 ./test.py -f 0-others/balance_vgroups_r1.py -N 6
,,y,system-test,./pytest.sh python3 ./test.py -f 0-others/taosShell.py
,,y,system-test,./pytest.sh python3 ./test.py -f 0-others/taosShellError.py
,,y,system-test,./pytest.sh python3 ./test.py -f 0-others/taosShellNetChk.py
@@ -548,6 +549,7 @@
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/mavg.py -R
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/max_partition.py
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/max_partition.py -R
+,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/max_min_last_interval.py
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/max.py
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/max.py -R
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/min.py
@@ -833,6 +835,7 @@
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/function_null.py -Q 2
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/count_partition.py -Q 2
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/max_partition.py -Q 2
+,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/max_min_last_interval.py -Q 2
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/last_row.py -Q 2
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/tsbsQuery.py -Q 2
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/sml.py -Q 2
@@ -929,6 +932,7 @@
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/function_null.py -Q 3
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/count_partition.py -Q 3
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/max_partition.py -Q 3
+,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/max_min_last_interval.py -Q 3
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/last_row.py -Q 3
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/tsbsQuery.py -Q 3
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/sml.py -Q 3
@@ -1026,6 +1030,7 @@
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/function_null.py -Q 4
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/count_partition.py -Q 4
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/max_partition.py -Q 4
+,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/max_min_last_interval.py -Q 4
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/last_row.py -Q 4
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/tsbsQuery.py -Q 4
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/sml.py -Q 4
@@ -1046,6 +1051,11 @@
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/out_of_order.py -Q 2
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/out_of_order.py -Q 3
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/out_of_order.py -Q 4
+,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/max_min_data.py
+,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/max_min_data.py -R
+,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/max_min_data.py -Q 2
+,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/max_min_data.py -Q 3
+,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/max_min_data.py -Q 4
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/blockSMA.py -Q 4
,,y,system-test,./pytest.sh python3 ./test.py -f 99-TDcase/TD-21561.py -Q 4
,,y,system-test,./pytest.sh python3 ./test.py -f 99-TDcase/TD-20582.py
diff --git a/tests/parallel_test/container_build.sh b/tests/parallel_test/container_build.sh
index ff854449bb913bea8bf5dd1b6477d7d9c7a7b70e..8b88a8007d640e6e762b204d4f2a2bde8206d27a 100755
--- a/tests/parallel_test/container_build.sh
+++ b/tests/parallel_test/container_build.sh
@@ -55,7 +55,7 @@ fi
date
docker run \
-v $REP_MOUNT_PARAM \
- --rm --ulimit core=-1 taos_test:v1.0 sh -c "cd $REP_DIR;rm -rf debug;mkdir -p debug;cd debug;cmake .. -DBUILD_HTTP=false -DBUILD_TOOLS=true -DBUILD_TEST=true -DWEBSOCKET=true -DBUILD_TAOSX=true;make -j || exit 1"
+ --rm --ulimit core=-1 taos_test:v1.0 sh -c "pip uninstall taospy -y;pip3 install taospy==2.7.2;cd $REP_DIR;rm -rf debug;mkdir -p debug;cd debug;cmake .. -DBUILD_HTTP=false -DBUILD_TOOLS=true -DBUILD_TEST=true -DWEBSOCKET=true -DBUILD_TAOSX=true;make -j || exit 1"
if [[ -d ${WORKDIR}/debugNoSan ]] ;then
echo "delete ${WORKDIR}/debugNoSan"
@@ -70,7 +70,7 @@ mv ${REP_REAL_PATH}/debug ${WORKDIR}/debugNoSan
date
docker run \
-v $REP_MOUNT_PARAM \
- --rm --ulimit core=-1 taos_test:v1.0 sh -c "cd $REP_DIR;rm -rf debug;mkdir -p debug;cd debug;cmake .. -DBUILD_HTTP=false -DBUILD_TOOLS=true -DBUILD_TEST=true -DWEBSOCKET=true -DBUILD_SANITIZER=1 -DTOOLS_SANITIZE=true -DTOOLS_BUILD_TYPE=Debug -DBUILD_TAOSX=true;make -j || exit 1 "
+ --rm --ulimit core=-1 taos_test:v1.0 sh -c "pip uninstall taospy -y;pip3 install taospy==2.7.2;cd $REP_DIR;rm -rf debug;mkdir -p debug;cd debug;cmake .. -DBUILD_HTTP=false -DBUILD_TOOLS=true -DBUILD_TEST=true -DWEBSOCKET=true -DBUILD_SANITIZER=1 -DTOOLS_SANITIZE=true -DTOOLS_BUILD_TYPE=Debug -DBUILD_TAOSX=true;make -j || exit 1"
mv ${REP_REAL_PATH}/debug ${WORKDIR}/debugSan
diff --git a/tests/pytest/crash_gen/crash_gen_main.py b/tests/pytest/crash_gen/crash_gen_main.py
index 3c39b05e699b0f90898eed9363f7e3770f8c51ce..ec588659e93ffc30d21355b970e595d08f04a9f7 100755
--- a/tests/pytest/crash_gen/crash_gen_main.py
+++ b/tests/pytest/crash_gen/crash_gen_main.py
@@ -18,7 +18,8 @@ from __future__ import annotations
from typing import Any, Set, Tuple
from typing import Dict
from typing import List
-from typing import Optional # Type hinting, ref: https://stackoverflow.com/questions/19202633/python-3-type-hinting-for-none
+from typing import \
+ Optional # Type hinting, ref: https://stackoverflow.com/questions/19202633/python-3-type-hinting-for-none
import textwrap
import time
@@ -39,7 +40,6 @@ import gc
import taos
from taos.tmq import *
-
from .shared.types import TdColumns, TdTags
# from crash_gen import ServiceManager, TdeInstance, TdeSubProcess
@@ -65,10 +65,11 @@ if sys.version_info[0] < 3:
# Command-line/Environment Configurations, will set a bit later
# ConfigNameSpace = argparse.Namespace
# gConfig: argparse.Namespace
-gSvcMgr: Optional[ServiceManager] # TODO: refactor this hack, use dep injection
+gSvcMgr: Optional[ServiceManager] # TODO: refactor this hack, use dep injection
# logger: logging.Logger
gContainer: Container
+
# def runThread(wt: WorkerThread):
# wt.run()
@@ -77,7 +78,7 @@ class WorkerThread:
def __init__(self, pool: ThreadPool, tid, tc: ThreadCoordinator):
"""
Note: this runs in the main thread context
- """
+ """
# self._curStep = -1
self._pool = pool
self._tid = tid
@@ -91,15 +92,15 @@ class WorkerThread:
if (Config.getConfig().per_thread_db_connection): # type: ignore
# print("connector_type = {}".format(gConfig.connector_type))
tInst = gContainer.defTdeInstance
- if Config.getConfig().connector_type == 'native':
- self._dbConn = DbConn.createNative(tInst.getDbTarget())
+ if Config.getConfig().connector_type == 'native':
+ self._dbConn = DbConn.createNative(tInst.getDbTarget())
elif Config.getConfig().connector_type == 'rest':
- self._dbConn = DbConn.createRest(tInst.getDbTarget())
+ self._dbConn = DbConn.createRest(tInst.getDbTarget())
elif Config.getConfig().connector_type == 'mixed':
- if Dice.throw(2) == 0: # 1/2 chance
- self._dbConn = DbConn.createNative(tInst.getDbTarget())
+ if Dice.throw(2) == 0: # 1/2 chance
+ self._dbConn = DbConn.createNative(tInst.getDbTarget())
else:
- self._dbConn = DbConn.createRest(tInst.getDbTarget())
+ self._dbConn = DbConn.createRest(tInst.getDbTarget())
else:
raise RuntimeError("Unexpected connector type: {}".format(Config.getConfig().connector_type))
@@ -138,7 +139,7 @@ class WorkerThread:
# clean up
if (Config.getConfig().per_thread_db_connection): # type: ignore
- if self._dbConn.isOpen: #sometimes it is not open
+ if self._dbConn.isOpen: # sometimes it is not open
self._dbConn.close()
else:
Logging.warning("Cleaning up worker thread, dbConn already closed")
@@ -150,20 +151,19 @@ class WorkerThread:
tc = self._tc # Thread Coordinator, the overall master
try:
tc.crossStepBarrier() # shared barrier first, INCLUDING the last one
- except threading.BrokenBarrierError as err: # main thread timed out
+ except threading.BrokenBarrierError as err: # main thread timed out
print("_bto", end="")
Logging.debug("[TRD] Worker thread exiting due to main thread barrier time-out")
break
Logging.debug("[TRD] Worker thread [{}] exited barrier...".format(self._tid))
- self.crossStepGate() # then per-thread gate, after being tapped
+ self.crossStepGate() # then per-thread gate, after being tapped
Logging.debug("[TRD] Worker thread [{}] exited step gate...".format(self._tid))
if not self._tc.isRunning():
print("_wts", end="")
Logging.debug("[TRD] Thread Coordinator not running any more, worker thread now stopping...")
break
-
# Before we fetch the task and run it, let's ensure we properly "use" the database (not needed any more)
try:
if (Config.getConfig().per_thread_db_connection): # most likely TRUE
@@ -172,7 +172,8 @@ class WorkerThread:
# self.useDb() # might encounter exceptions. TODO: catch
except taos.error.ProgrammingError as err:
errno = Helper.convertErrno(err.errno)
- if errno in [0x383, 0x386, 0x00B, 0x014] : # invalid database, dropping, Unable to establish connection, Database not ready
+ if errno in [0x383, 0x386, 0x00B,
+ 0x014]: # invalid database, dropping, Unable to establish connection, Database not ready
# ignore
dummy = 0
else:
@@ -180,12 +181,12 @@ class WorkerThread:
raise
# Fetch a task from the Thread Coordinator
- Logging.debug( "[TRD] Worker thread [{}] about to fetch task".format(self._tid))
+ Logging.debug("[TRD] Worker thread [{}] about to fetch task".format(self._tid))
task = tc.fetchTask()
# Execute such a task
Logging.debug("[TRD] Worker thread [{}] about to execute task: {}".format(
- self._tid, task.__class__.__name__))
+ self._tid, task.__class__.__name__))
task.execute(self)
tc.saveExecutedTask(task)
Logging.debug("[TRD] Worker thread [{}] finished executing task".format(self._tid))
@@ -228,7 +229,7 @@ class WorkerThread:
self._stepGate.set() # wake up!
time.sleep(0) # let the released thread run a bit
else:
- print("_tad", end="") # Thread already dead
+ print("_tad", end="") # Thread already dead
def execSql(self, sql): # TODO: expose DbConn directly
return self.getDbConn().execute(sql)
@@ -239,7 +240,7 @@ class WorkerThread:
def getQueryResult(self):
return self.getDbConn().getQueryResult()
- def getDbConn(self) -> DbConn :
+ def getDbConn(self) -> DbConn:
if (Config.getConfig().per_thread_db_connection):
return self._dbConn
else:
@@ -251,6 +252,7 @@ class WorkerThread:
# else:
# return self._tc.getDbState().getDbConn().query(sql)
+
# The coordinator of all worker threads, mostly running in main thread
@@ -262,7 +264,7 @@ class ThreadCoordinator:
self._pool = pool
# self._wd = wd
self._te = None # prepare for every new step
- self._dbManager = dbManager # type: Optional[DbManager] # may be freed
+ self._dbManager = dbManager # type: Optional[DbManager] # may be freed
self._executedTasks: List[Task] = [] # in a given step
self._lock = threading.RLock() # sync access for a few things
@@ -284,7 +286,7 @@ class ThreadCoordinator:
return self._dbManager
def crossStepBarrier(self, timeout=None):
- self._stepBarrier.wait(timeout)
+ self._stepBarrier.wait(timeout)
def requestToStop(self):
self._runStatus = Status.STATUS_STOPPING
@@ -292,7 +294,7 @@ class ThreadCoordinator:
def _runShouldEnd(self, transitionFailed, hasAbortedTask, workerTimeout):
maxSteps = Config.getConfig().max_steps # type: ignore
- if self._curStep >= (maxSteps - 1): # maxStep==10, last curStep should be 9
+ if self._curStep >= (maxSteps - 1): # maxStep==10, last curStep should be 9
return True
if self._runStatus != Status.STATUS_RUNNING:
return True
@@ -304,7 +306,7 @@ class ThreadCoordinator:
return True
return False
- def _hasAbortedTask(self): # from execution of previous step
+ def _hasAbortedTask(self): # from execution of previous step
for task in self._executedTasks:
if task.isAborted():
# print("Task aborted: {}".format(task))
@@ -319,17 +321,17 @@ class ThreadCoordinator:
"--\r\n\n--> Step {} starts with main thread waking up".format(self._curStep))
# A new TE for the new step
- self._te = None # set to empty first, to signal worker thread to stop
+ self._te = None # set to empty first, to signal worker thread to stop
if not transitionFailed: # only if not failed
self._te = TaskExecutor(self._curStep)
Logging.debug("[TRD] Main thread waking up at step {}, tapping worker threads".format(
- self._curStep)) # Now not all threads had time to go to sleep
+ self._curStep)) # Now not all threads had time to go to sleep
# Worker threads will wake up at this point, and each execute it's own task
- self.tapAllThreads() # release all worker thread from their "gates"
+ self.tapAllThreads() # release all worker thread from their "gates"
def _syncAtBarrier(self):
- # Now main thread (that's us) is ready to enter a step
+ # Now main thread (that's us) is ready to enter a step
# let other threads go past the pool barrier, but wait at the
# thread gate
Logging.debug("[TRD] Main thread about to cross the barrier")
@@ -341,7 +343,7 @@ class ThreadCoordinator:
transitionFailed = False
try:
for x in self._dbs:
- db = x # type: Database
+ db = x # type: Database
sm = db.getStateMachine()
Logging.debug("[STT] starting transitions for DB: {}".format(db.getName()))
# at end of step, transiton the DB state
@@ -357,8 +359,8 @@ class ThreadCoordinator:
# for t in self._pool.threadList:
# Logging.debug("[DB] use db for all worker threads")
# t.useDb()
- # t.execSql("use db") # main thread executing "use
- # db" on behalf of every worker thread
+ # t.execSql("use db") # main thread executing "use
+ # db" on behalf of every worker thread
except taos.error.ProgrammingError as err:
if (err.msg == 'network unavailable'): # broken DB connection
@@ -369,12 +371,13 @@ class ThreadCoordinator:
self._execStats.registerFailure("Broken DB Connection")
# continue # don't do that, need to tap all threads at
# end, and maybe signal them to stop
- if isinstance(err, CrashGenError): # our own transition failure
+ if isinstance(err, CrashGenError): # our own transition failure
Logging.info("State transition error")
# TODO: saw an error here once, let's print out stack info for err?
- traceback.print_stack() # Stack frame to here.
+ traceback.print_stack() # Stack frame to here.
Logging.info("Caused by:")
- traceback.print_exception(*sys.exc_info()) # Ref: https://www.geeksforgeeks.org/how-to-print-exception-stack-trace-in-python/
+ traceback.print_exception(
+ *sys.exc_info()) # Ref: https://www.geeksforgeeks.org/how-to-print-exception-stack-trace-in-python/
transitionFailed = True
self._te = None # Not running any more
self._execStats.registerFailure("State transition error: {}".format(err))
@@ -392,14 +395,14 @@ class ThreadCoordinator:
# Coordinate all threads step by step
self._curStep = -1 # not started yet
-
+
self._execStats.startExec() # start the stop watch
transitionFailed = False
hasAbortedTask = False
workerTimeout = False
while not self._runShouldEnd(transitionFailed, hasAbortedTask, workerTimeout):
- if not Config.getConfig().debug: # print this only if we are not in debug mode
- Progress.emit(Progress.STEP_BOUNDARY)
+ if not Config.getConfig().debug: # print this only if we are not in debug mode
+ Progress.emit(Progress.STEP_BOUNDARY)
# print(".", end="", flush=True)
# if (self._curStep % 2) == 0: # print memory usage once every 10 steps
# memUsage = resource.getrusage(resource.RUSAGE_SELF).ru_maxrss
@@ -408,15 +411,14 @@ class ThreadCoordinator:
# h = hpy()
# print("\n")
# print(h.heap())
-
-
+
try:
- self._syncAtBarrier() # For now just cross the barrier
+ self._syncAtBarrier() # For now just cross the barrier
Progress.emit(Progress.END_THREAD_STEP)
- if self._stepStartTime :
+ if self._stepStartTime:
stepExecTime = time.time() - self._stepStartTime
Progress.emitStr('{:.3f}s/{}'.format(stepExecTime, DbConnNative.totalRequests))
- DbConnNative.resetTotalRequests() # reset to zero
+ DbConnNative.resetTotalRequests() # reset to zero
except threading.BrokenBarrierError as err:
self._execStats.registerFailure("Aborted due to worker thread timeout")
Logging.error("\n")
@@ -439,15 +441,15 @@ class ThreadCoordinator:
# At this point, all threads should be pass the overall "barrier" and before the per-thread "gate"
# We use this period to do house keeping work, when all worker
# threads are QUIET.
- hasAbortedTask = self._hasAbortedTask() # from previous step
- if hasAbortedTask:
+ hasAbortedTask = self._hasAbortedTask() # from previous step
+ if hasAbortedTask:
Logging.info("Aborted task encountered, exiting test program")
self._execStats.registerFailure("Aborted Task Encountered")
- break # do transition only if tasks are error free
+ break # do transition only if tasks are error free
# Ending previous step
try:
- transitionFailed = self._doTransition() # To start, we end step -1 first
+ transitionFailed = self._doTransition() # To start, we end step -1 first
except taos.error.ProgrammingError as err:
transitionFailed = True
errno2 = Helper.convertErrno(err.errno) # correct error scheme
@@ -459,32 +461,32 @@ class ThreadCoordinator:
# Then we move on to the next step
Progress.emit(Progress.BEGIN_THREAD_STEP)
self._stepStartTime = time.time()
- self._releaseAllWorkerThreads(transitionFailed)
+ self._releaseAllWorkerThreads(transitionFailed)
- if hasAbortedTask or transitionFailed : # abnormal ending, workers waiting at "gate"
+ if hasAbortedTask or transitionFailed: # abnormal ending, workers waiting at "gate"
Logging.debug("Abnormal ending of main thraed")
elif workerTimeout:
Logging.debug("Abnormal ending of main thread, due to worker timeout")
- else: # regular ending, workers waiting at "barrier"
+ else: # regular ending, workers waiting at "barrier"
Logging.debug("Regular ending, main thread waiting for all worker threads to stop...")
self._syncAtBarrier()
self._te = None # No more executor, time to end
Logging.debug("Main thread tapping all threads one last time...")
self.tapAllThreads() # Let the threads run one last time
- #TODO: looks like we are not capturing the failures for the last step yet (i.e. calling registerFailure if neccessary)
+ # TODO: looks like we are not capturing the failures for the last step yet (i.e. calling registerFailure if neccessary)
Logging.debug("\r\n\n--> Main thread ready to finish up...")
Logging.debug("Main thread joining all threads")
self._pool.joinAll() # Get all threads to finish
- Logging.info(". . . All worker threads finished") # No CR/LF before
+ Logging.info(". . . All worker threads finished") # No CR/LF before
self._execStats.endExec()
- def cleanup(self): # free resources
+ def cleanup(self): # free resources
self._pool.cleanup()
self._pool = None
- self._te = None
+ self._te = None
self._dbManager = None
self._executedTasks = []
self._lock = None
@@ -492,7 +494,6 @@ class ThreadCoordinator:
self._execStats = None
self._runStatus = None
-
def printStats(self):
self._execStats.printStats()
@@ -523,21 +524,21 @@ class ThreadCoordinator:
def _initDbs(self):
''' Initialize multiple databases, invoked at __ini__() time '''
- self._dbs = [] # type: List[Database]
+ self._dbs = [] # type: List[Database]
dbc = self.getDbManager().getDbConn()
if Config.getConfig().max_dbs == 0:
self._dbs.append(Database(0, dbc))
- else:
- baseDbNumber = int(datetime.datetime.now().timestamp( # Don't use Dice/random, as they are deterministic
- )*333) % 888 if Config.getConfig().dynamic_db_table_names else 0
+ else:
+ baseDbNumber = int(datetime.datetime.now().timestamp( # Don't use Dice/random, as they are deterministic
+ ) * 333) % 888 if Config.getConfig().dynamic_db_table_names else 0
for i in range(Config.getConfig().max_dbs):
self._dbs.append(Database(baseDbNumber + i, dbc))
def pickDatabase(self):
idxDb = 0
- if Config.getConfig().max_dbs != 0 :
- idxDb = Dice.throw(Config.getConfig().max_dbs) # 0 to N-1
- db = self._dbs[idxDb] # type: Database
+ if Config.getConfig().max_dbs != 0:
+ idxDb = Dice.throw(Config.getConfig().max_dbs) # 0 to N-1
+ db = self._dbs[idxDb] # type: Database
return db
def fetchTask(self) -> Task:
@@ -549,12 +550,12 @@ class ThreadCoordinator:
# pick a task type for current state
db = self.pickDatabase()
- if Dice.throw(2)==1:
- taskType = db.getStateMachine().pickTaskType() # dynamic name of class
+ if Dice.throw(2) == 1:
+ taskType = db.getStateMachine().pickTaskType() # dynamic name of class
else:
- taskType = db.getStateMachine().balance_pickTaskType() # and an method can get balance task types
+ taskType = db.getStateMachine().balance_pickTaskType() # and an method can get balance task types
pass
-
+
return taskType(self._execStats, db) # create a task from it
def resetExecutedTasks(self):
@@ -564,6 +565,7 @@ class ThreadCoordinator:
with self._lock:
self._executedTasks.append(task)
+
class ThreadPool:
def __init__(self, numThreads, maxSteps):
self.numThreads = numThreads
@@ -585,7 +587,8 @@ class ThreadPool:
workerThread._thread.join()
def cleanup(self):
- self.threadList = [] # maybe clean up each?
+ self.threadList = [] # maybe clean up each?
+
# A queue of continguous POSITIVE integers, used by DbManager to generate continuous numbers
# for new table names
@@ -680,11 +683,11 @@ class AnyState:
CAN_CREATE_DB = 1
# For below, if we can "drop the DB", but strictly speaking
# only "under normal circumstances", as we may override it with the -b option
- CAN_DROP_DB = 2
+ CAN_DROP_DB = 2
CAN_CREATE_FIXED_SUPER_TABLE = 3
CAN_CREATE_STREAM = 3 # super table must exists
CAN_CREATE_TOPIC = 3 # super table must exists
- CAN_CREATE_CONSUMERS = 3
+ CAN_CREATE_CONSUMERS = 3
CAN_DROP_FIXED_SUPER_TABLE = 4
CAN_DROP_TOPIC = 4
CAN_DROP_STREAM = 4
@@ -729,7 +732,7 @@ class AnyState:
def canDropDb(self):
# If user requests to run up to a number of DBs,
# we'd then not do drop_db operations any more
- if Config.getConfig().max_dbs > 0 or Config.getConfig().use_shadow_db :
+ if Config.getConfig().max_dbs > 0 or Config.getConfig().use_shadow_db:
return False
return self._info[self.CAN_DROP_DB]
@@ -737,19 +740,19 @@ class AnyState:
return self._info[self.CAN_CREATE_FIXED_SUPER_TABLE]
def canDropFixedSuperTable(self):
- if Config.getConfig().use_shadow_db: # duplicate writes to shaddow DB, in which case let's disable dropping s-table
+ if Config.getConfig().use_shadow_db: # duplicate writes to shaddow DB, in which case let's disable dropping s-table
return False
return self._info[self.CAN_DROP_FIXED_SUPER_TABLE]
def canCreateTopic(self):
return self._info[self.CAN_CREATE_TOPIC]
-
+
def canDropTopic(self):
return self._info[self.CAN_DROP_TOPIC]
def canCreateConsumers(self):
return self._info[self.CAN_CREATE_CONSUMERS]
-
+
def canCreateStreams(self):
return self._info[self.CAN_CREATE_STREAM]
@@ -777,7 +780,7 @@ class AnyState:
raise CrashGenError(
"Unexpected more than 1 success at state: {}, with task: {}, in task set: {}".format(
self.__class__.__name__,
- cls.__name__, # verified just now that isinstance(task, cls)
+ cls.__name__, # verified just now that isinstance(task, cls)
[c.__class__.__name__ for c in tasks]
))
@@ -792,16 +795,17 @@ class AnyState:
sCnt += 1
if (exists and sCnt <= 0):
raise CrashGenError("Unexpected zero success at state: {}, with task: {}, in task set: {}".format(
- self.__class__.__name__,
- cls.__name__, # verified just now that isinstance(task, cls)
- [c.__class__.__name__ for c in tasks]
- ))
+ self.__class__.__name__,
+ cls.__name__, # verified just now that isinstance(task, cls)
+ [c.__class__.__name__ for c in tasks]
+ ))
def assertNoTask(self, tasks, cls):
for task in tasks:
if isinstance(task, cls):
raise CrashGenError(
- "This task: {}, is not expected to be present, given the success/failure of others".format(cls.__name__))
+ "This task: {}, is not expected to be present, given the success/failure of others".format(
+ cls.__name__))
def assertNoSuccess(self, tasks, cls):
for task in tasks:
@@ -848,7 +852,7 @@ class StateEmpty(AnyState):
def verifyTasksToState(self, tasks, newState):
if (self.hasSuccess(tasks, TaskCreateDb)
- ): # at EMPTY, if there's succes in creating DB
+ ): # at EMPTY, if there's succes in creating DB
if (not self.hasTask(tasks, TaskDropDb)): # and no drop_db tasks
# we must have at most one. TODO: compare numbers
self.assertAtMostOneSuccess(tasks, TaskCreateDb)
@@ -885,19 +889,19 @@ class StateSuperTableOnly(AnyState):
def verifyTasksToState(self, tasks, newState):
if (self.hasSuccess(tasks, TaskDropSuperTable)
- ): # we are able to drop the table
- #self.assertAtMostOneSuccess(tasks, TaskDropSuperTable)
+ ): # we are able to drop the table
+ # self.assertAtMostOneSuccess(tasks, TaskDropSuperTable)
# we must have had recreted it
self.hasSuccess(tasks, TaskCreateSuperTable)
# self._state = self.STATE_DB_ONLY
# elif ( self.hasSuccess(tasks, AddFixedDataTask) ): # no success dropping the table, but added data
# self.assertNoTask(tasks, DropFixedTableTask) # not true in massively parrallel cases
- # self._state = self.STATE_HAS_DATA
+ # self._state = self.STATE_HAS_DATA
# elif ( self.hasSuccess(tasks, ReadFixedDataTask) ): # no success in prev cases, but was able to read data
- # self.assertNoTask(tasks, DropFixedTableTask)
- # self.assertNoTask(tasks, AddFixedDataTask)
- # self._state = self.STATE_TABLE_ONLY # no change
+ # self.assertNoTask(tasks, DropFixedTableTask)
+ # self.assertNoTask(tasks, AddFixedDataTask)
+ # self._state = self.STATE_TABLE_ONLY # no change
# else: # did not drop table, did not insert data, did not read successfully, that is impossible
# raise RuntimeError("Unexpected no-success scenarios")
# TODO: need to revamp!!
@@ -919,41 +923,41 @@ class StateHasData(AnyState):
self.assertAtMostOneSuccess(tasks, TaskDropDb) # TODO: dicy
elif (newState.equals(AnyState.STATE_DB_ONLY)): # in DB only
if (not self.hasTask(tasks, TaskCreateDb)
- ): # without a create_db task
+ ): # without a create_db task
# we must have drop_db task
self.assertNoTask(tasks, TaskDropDb)
self.hasSuccess(tasks, TaskDropSuperTable)
# self.assertAtMostOneSuccess(tasks, DropFixedSuperTableTask) # TODO: dicy
# elif ( newState.equals(AnyState.STATE_TABLE_ONLY) ): # data deleted
- # self.assertNoTask(tasks, TaskDropDb)
- # self.assertNoTask(tasks, TaskDropSuperTable)
- # self.assertNoTask(tasks, TaskAddData)
- # self.hasSuccess(tasks, DeleteDataTasks)
+ # self.assertNoTask(tasks, TaskDropDb)
+ # self.assertNoTask(tasks, TaskDropSuperTable)
+ # self.assertNoTask(tasks, TaskAddData)
+ # self.hasSuccess(tasks, DeleteDataTasks)
else: # should be STATE_HAS_DATA
if (not self.hasTask(tasks, TaskCreateDb)
- ): # only if we didn't create one
+ ): # only if we didn't create one
# we shouldn't have dropped it
self.assertNoTask(tasks, TaskDropDb)
- if not( self.hasTask(tasks, TaskCreateSuperTable)
- ): # if we didn't create the table
+ if not (self.hasTask(tasks, TaskCreateSuperTable)
+ ): # if we didn't create the table
# we should not have a task that drops it
self.assertNoTask(tasks, TaskDropSuperTable)
# self.assertIfExistThenSuccess(tasks, ReadFixedDataTask)
class StateMechine:
- def __init__(self, db: Database):
+ def __init__(self, db: Database):
self._db = db
# transitition target probabilities, indexed with value of STATE_EMPTY, STATE_DB_ONLY, etc.
self._stateWeights = [1, 2, 10, 40]
- def init(self, dbc: DbConn): # late initailization, don't save the dbConn
+ def init(self, dbc: DbConn): # late initailization, don't save the dbConn
try:
self._curState = self._findCurrentState(dbc) # starting state
- except taos.error.ProgrammingError as err:
+ except taos.error.ProgrammingError as err:
Logging.error("Failed to initialized state machine, cannot find current state: {}".format(err))
traceback.print_stack()
- raise # re-throw
+ raise # re-throw
# TODO: seems no lnoger used, remove?
def getCurrentState(self):
@@ -999,28 +1003,27 @@ class StateMechine:
def _findCurrentState(self, dbc: DbConn):
ts = time.time() # we use this to debug how fast/slow it is to do the various queries to find the current DB state
- dbName =self._db.getName()
- if not dbc.existsDatabase(dbName): # dbc.hasDatabases(): # no database?!
- Logging.debug( "[STT] empty database found, between {} and {}".format(ts, time.time()))
+ dbName = self._db.getName()
+ if not dbc.existsDatabase(dbName): # dbc.hasDatabases(): # no database?!
+ Logging.debug("[STT] empty database found, between {} and {}".format(ts, time.time()))
return StateEmpty()
# did not do this when openning connection, and this is NOT the worker
# thread, which does this on their own
dbc.use(dbName)
-
+
if not dbc.hasTables(): # no tables
-
+
Logging.debug("[STT] DB_ONLY found, between {} and {}".format(ts, time.time()))
return StateDbOnly()
# For sure we have tables, which means we must have the super table. # TODO: are we sure?
-
+
sTable = self._db.getFixedSuperTable()
-
if sTable.hasRegTables(dbc): # no regular tables
# print("debug=====*\n"*100)
Logging.debug("[STT] SUPER_TABLE_ONLY found, between {} and {}".format(ts, time.time()))
-
+
return StateSuperTableOnly()
else: # has actual tables
Logging.debug("[STT] HAS_DATA found, between {} and {}".format(ts, time.time()))
@@ -1029,7 +1032,7 @@ class StateMechine:
# We transition the system to a new state by examining the current state itself
def transition(self, tasks, dbc: DbConn):
global gSvcMgr
-
+
if (len(tasks) == 0): # before 1st step, or otherwise empty
Logging.debug("[STT] Starting State: {}".format(self._curState))
return # do nothing
@@ -1038,39 +1041,39 @@ class StateMechine:
dbc.execute("select * from information_schema.ins_dnodes")
# Generic Checks, first based on the start state
- if not Config.getConfig().ignore_errors: # verify state, only if we are asked not to ignore certain errors.
+ if not Config.getConfig().ignore_errors: # verify state, only if we are asked not to ignore certain errors.
if self._curState.canCreateDb():
self._curState.assertIfExistThenSuccess(tasks, TaskCreateDb)
# self.assertAtMostOneSuccess(tasks, CreateDbTask) # not really, in
# case of multiple creation and drops
if self._curState.canDropDb():
- if gSvcMgr == None: # only if we are running as client-only
+ if gSvcMgr == None: # only if we are running as client-only
self._curState.assertIfExistThenSuccess(tasks, TaskDropDb)
# self.assertAtMostOneSuccess(tasks, DropDbTask) # not really in
# case of drop-create-drop
# if self._state.canCreateFixedTable():
- # self.assertIfExistThenSuccess(tasks, CreateFixedTableTask) # Not true, DB may be dropped
- # self.assertAtMostOneSuccess(tasks, CreateFixedTableTask) # not
- # really, in case of create-drop-create
+ # self.assertIfExistThenSuccess(tasks, CreateFixedTableTask) # Not true, DB may be dropped
+ # self.assertAtMostOneSuccess(tasks, CreateFixedTableTask) # not
+ # really, in case of create-drop-create
# if self._state.canDropFixedTable():
- # self.assertIfExistThenSuccess(tasks, DropFixedTableTask) # Not True, the whole DB may be dropped
- # self.assertAtMostOneSuccess(tasks, DropFixedTableTask) # not
- # really in case of drop-create-drop
+ # self.assertIfExistThenSuccess(tasks, DropFixedTableTask) # Not True, the whole DB may be dropped
+ # self.assertAtMostOneSuccess(tasks, DropFixedTableTask) # not
+ # really in case of drop-create-drop
# if self._state.canAddData():
# self.assertIfExistThenSuccess(tasks, AddFixedDataTask) # not true
# actually
# if self._state.canReadData():
- # Nothing for sure
+ # Nothing for sure
newState = self._findCurrentState(dbc)
Logging.debug("[STT] New DB state determined: {}".format(newState))
# can old state move to new state through the tasks?
- if not Config.getConfig().ignore_errors: # verify state, only if we are asked not to ignore certain errors.
+ if not Config.getConfig().ignore_errors: # verify state, only if we are asked not to ignore certain errors.
self._curState.verifyTasksToState(tasks, newState)
self._curState = newState
@@ -1096,22 +1099,24 @@ class StateMechine:
weightsTypes = BasicTypes.copy()
# this matrixs can balance the Frequency of TaskTypes
- balance_TaskType_matrixs = {'TaskDropDb': 5 , 'TaskDropTopics': 20 , 'TaskDropStreams':10 , 'TaskDropStreamTables':10 ,
- 'TaskReadData':50 , 'TaskDropSuperTable':5 , 'TaskAlterTags':3 , 'TaskAddData':10,
- 'TaskDeleteData':10 , 'TaskCreateDb':10 , 'TaskCreateStream': 3, 'TaskCreateTopic' :3,
- 'TaskCreateConsumers':10, 'TaskCreateSuperTable': 10 } # TaskType : balance_matrixs of task
-
- for task , weights in balance_TaskType_matrixs.items():
-
+ balance_TaskType_matrixs = {'TaskDropDb': 5, 'TaskDropTopics': 20, 'TaskDropStreams': 10,
+ 'TaskDropStreamTables': 10,
+ 'TaskReadData': 50, 'TaskDropSuperTable': 5, 'TaskAlterTags': 3, 'TaskAddData': 10,
+ 'TaskDeleteData': 10, 'TaskCreateDb': 10, 'TaskCreateStream': 3,
+ 'TaskCreateTopic': 3,
+ 'TaskCreateConsumers': 10,
+ 'TaskCreateSuperTable': 10} # TaskType : balance_matrixs of task
+
+ for task, weights in balance_TaskType_matrixs.items():
+
for basicType in BasicTypes:
if basicType.__name__ == task:
for _ in range(weights):
weightsTypes.append(basicType)
- task = random.sample(weightsTypes,1)
+ task = random.sample(weightsTypes, 1)
return task[0]
-
# ref:
# https://eli.thegreenplace.net/2010/01/22/weighted-random-generation-in-python/
def _weighted_choice_sub(self, weights) -> int:
@@ -1123,6 +1128,7 @@ class StateMechine:
return i
raise CrashGenError("Unexpected no choice")
+
class Database:
''' We use this to represent an actual TDengine database inside a service instance,
possibly in a cluster environment.
@@ -1131,16 +1137,16 @@ class Database:
TODO: consider moving, but keep in mind it contains "StateMachine"
'''
- _clsLock = threading.Lock() # class wide lock
+ _clsLock = threading.Lock() # class wide lock
_lastInt = 101 # next one is initial integer
- _lastTick = None # Optional[datetime]
- _lastLaggingTick = None # Optional[datetime] # lagging tick, for out-of-sequence (oos) data insertions
+ _lastTick = None # Optional[datetime]
+ _lastLaggingTick = None # Optional[datetime] # lagging tick, for out-of-sequence (oos) data insertions
- def __init__(self, dbNum: int, dbc: DbConn): # TODO: remove dbc
- self._dbNum = dbNum # we assign a number to databases, for our testing purpose
+ def __init__(self, dbNum: int, dbc: DbConn): # TODO: remove dbc
+ self._dbNum = dbNum # we assign a number to databases, for our testing purpose
self._stateMachine = StateMechine(self)
self._stateMachine.init(dbc)
-
+
self._lock = threading.RLock()
def getStateMachine(self) -> StateMechine:
@@ -1152,7 +1158,7 @@ class Database:
def getName(self):
return "db_{}".format(self._dbNum)
- def filterTasks(self, inTasks: List[Task]): # Pick out those belonging to us
+ def filterTasks(self, inTasks: List[Task]): # Pick out those belonging to us
outTasks = []
for task in inTasks:
if task.getDb().isSame(self):
@@ -1184,38 +1190,42 @@ class Database:
# start time will be auto generated , start at 10 years ago local time
local_time = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S.%f')[:-16]
local_epoch_time = [int(i) for i in local_time.split("-")]
- #local_epoch_time will be such as : [2022, 7, 18]
+ # local_epoch_time will be such as : [2022, 7, 18]
- t1 = datetime.datetime(local_epoch_time[0]-5, local_epoch_time[1], local_epoch_time[2])
+ t1 = datetime.datetime(local_epoch_time[0] - 5, local_epoch_time[1], local_epoch_time[2])
t2 = datetime.datetime.now()
# maybe a very large number, takes 69 years to exceed Python int range
elSec = int(t2.timestamp() - t1.timestamp())
elSec2 = (elSec % (8 * 12 * 30 * 24 * 60 * 60 / 500)) * \
- 500 # a number representing seconds within 10 years
+ 500 # a number representing seconds within 10 years
# print("elSec = {}".format(elSec))
- t3 = datetime.datetime(local_epoch_time[0]-10, local_epoch_time[1], local_epoch_time[2]) # default "keep" is 10 years
+ t3 = datetime.datetime(local_epoch_time[0] - 10, local_epoch_time[1],
+ local_epoch_time[2]) # default "keep" is 10 years
t4 = datetime.datetime.fromtimestamp(
t3.timestamp() + elSec2) # see explanation above
Logging.debug("Setting up TICKS to start from: {}".format(t4))
return t4
@classmethod
- def getNextTick(cls):
+ def getNextTick(cls):
'''
Fetch a timestamp tick, with some random factor, may not be unique.
- '''
+ '''
with cls._clsLock: # prevent duplicate tick
- if cls._lastLaggingTick is None or cls._lastTick is None : # not initialized
+ if cls._lastLaggingTick is None or cls._lastTick is None: # not initialized
# 10k at 1/20 chance, should be enough to avoid overlaps
tick = cls.setupLastTick()
cls._lastTick = tick
- cls._lastLaggingTick = tick + datetime.timedelta(0, -60*2) # lagging behind 2 minutes, should catch up fast
+ cls._lastLaggingTick = tick + datetime.timedelta(0,
+ -60 * 2) # lagging behind 2 minutes, should catch up fast
# if : # should be quite a bit into the future
- if Config.isSet('mix_oos_data') and Dice.throw(20) == 0: # if asked to do so, and 1 in 20 chance, return lagging tick
- cls._lastLaggingTick += datetime.timedelta(0, 1) # pick the next sequence from the lagging tick sequence
- return cls._lastLaggingTick
+ if Config.isSet('mix_oos_data') and Dice.throw(
+ 20) == 0: # if asked to do so, and 1 in 20 chance, return lagging tick
+ cls._lastLaggingTick += datetime.timedelta(0,
+ 1) # pick the next sequence from the lagging tick sequence
+ return cls._lastLaggingTick
else: # regular
# add one second to it
cls._lastTick += datetime.timedelta(0, 1)
@@ -1332,9 +1342,7 @@ class Task():
# Logging.debug("Creating new task {}...".format(self._taskNum))
self._execStats = execStats
- self._db = db # A task is always associated/for a specific DB
-
-
+ self._db = db # A task is always associated/for a specific DB
def isSuccess(self):
return self._err is None
@@ -1367,82 +1375,78 @@ class Task():
def _isServiceStable(self):
if not gSvcMgr:
return True # we don't run service, so let's assume it's stable
- return gSvcMgr.isStable() # otherwise let's examine the service
+ return gSvcMgr.isStable() # otherwise let's examine the service
def _isErrAcceptable(self, errno, msg):
if errno in [
- # TDengine 2.x Error Codes:
- 0x05, # TSDB_CODE_RPC_NOT_READY
- 0x0B, # Unable to establish connection, more details in TD-1648
- # 0x200, # invalid SQL, TODO: re-examine with TD-934
- 0x20F, # query terminated, possibly due to vnoding being dropped, see TD-1776
- 0x213, # "Disconnected from service", result of "kill connection ???"
- 0x217, # "db not selected", client side defined error code
- # 0x218, # "Table does not exist" client side defined error code
- 0x360, # Table already exists
- 0x362,
- # 0x369, # tag already exists
- 0x36A, 0x36B, 0x36D,
- 0x381,
- 0x380, # "db not selected"
- 0x383,
- 0x386, # DB is being dropped?!
- 0x503,
- 0x510, # vnode not in ready state
- 0x14, # db not ready, errno changed
- 0x600, # Invalid table ID, why?
- 0x218, # Table does not exist
-
- # TDengine 3.0 Error Codes:
- 0x0333, # Object is creating # TODO: this really is NOT an acceptable error
- 0x0369, # Tag already exists
- 0x0388, # Database not exist
- 0x03A0, # STable already exists
- 0x03A1, # STable [does] not exist
- 0x03AA, # Tag already exists
- 0x0603, # Table already exists
- 0x2603, # Table does not exist, replaced by 2662 below
- 0x260d, # Tags number not matched
- 0x2662, # Table does not exist #TODO: what about 2603 above?
- 0x2600, # database not specified, SQL: show stables , database droped , and show tables
- 0x032C, # Object is creating
- 0x032D, # Object is dropping
- 0x03D3, # Conflict transaction not completed
- 0x0707, # Query not ready , it always occur at replica 3
- 0x707, # Query not ready
- 0x396, # Database in creating status
- 0x386, # Database in droping status
- 0x03E1, # failed on tmq_subscribe ,topic not exist
- 0x03ed , # Topic must be dropped first, SQL: drop database db_0
- 0x0203 , # Invalid value
- 0x03f0 , # Stream already exist , topic already exists
-
-
-
-
- 1000 # REST catch-all error
- ]:
- return True # These are the ALWAYS-ACCEPTABLE ones
+ # TDengine 2.x Error Codes:
+ 0x05, # TSDB_CODE_RPC_NOT_READY
+ 0x0B, # Unable to establish connection, more details in TD-1648
+ # 0x200, # invalid SQL, TODO: re-examine with TD-934
+ 0x20F, # query terminated, possibly due to vnoding being dropped, see TD-1776
+ 0x213, # "Disconnected from service", result of "kill connection ???"
+ 0x217, # "db not selected", client side defined error code
+ # 0x218, # "Table does not exist" client side defined error code
+ 0x360, # Table already exists
+ 0x362,
+ # 0x369, # tag already exists
+ 0x36A, 0x36B, 0x36D,
+ 0x381,
+ 0x380, # "db not selected"
+ 0x383,
+ 0x386, # DB is being dropped?!
+ 0x503,
+ 0x510, # vnode not in ready state
+ 0x14, # db not ready, errno changed
+ 0x600, # Invalid table ID, why?
+ 0x218, # Table does not exist
+
+ # TDengine 3.0 Error Codes:
+ 0x0333, # Object is creating # TODO: this really is NOT an acceptable error
+ 0x0369, # Tag already exists
+ 0x0388, # Database not exist
+ 0x03A0, # STable already exists
+ 0x03A1, # STable [does] not exist
+ 0x03AA, # Tag already exists
+ 0x0603, # Table already exists
+ 0x2603, # Table does not exist, replaced by 2662 below
+ 0x260d, # Tags number not matched
+ 0x2662, # Table does not exist #TODO: what about 2603 above?
+ 0x2600, # database not specified, SQL: show stables , database droped , and show tables
+ 0x032C, # Object is creating
+ 0x032D, # Object is dropping
+ 0x03D3, # Conflict transaction not completed
+ 0x0707, # Query not ready , it always occur at replica 3
+ 0x707, # Query not ready
+ 0x396, # Database in creating status
+ 0x386, # Database in droping status
+ 0x03E1, # failed on tmq_subscribe ,topic not exist
+ 0x03ed, # Topic must be dropped first, SQL: drop database db_0
+ 0x0203, # Invalid value
+ 0x03f0, # Stream already exist , topic already exists
+
+ 1000 # REST catch-all error
+ ]:
+ return True # These are the ALWAYS-ACCEPTABLE ones
# This case handled below already.
# elif (errno in [ 0x0B ]) and Settings.getConfig().auto_start_service:
# return True # We may get "network unavilable" when restarting service
- elif Config.getConfig().ignore_errors: # something is specified on command line
+ elif Config.getConfig().ignore_errors: # something is specified on command line
moreErrnos = [int(v, 0) for v in Config.getConfig().ignore_errors.split(',')]
if errno in moreErrnos:
return True
- elif errno == 0x200 : # invalid SQL, we need to div in a bit more
+ elif errno == 0x200: # invalid SQL, we need to div in a bit more
if msg.find("invalid column name") != -1:
- return True
- elif msg.find("tags number not matched") != -1: # mismatched tags after modification
return True
- elif msg.find("duplicated column names") != -1: # also alter table tag issues
+ elif msg.find("tags number not matched") != -1: # mismatched tags after modification
return True
- elif not self._isServiceStable(): # We are managing service, and ...
+ elif msg.find("duplicated column names") != -1: # also alter table tag issues
+ return True
+ elif not self._isServiceStable(): # We are managing service, and ...
Logging.info("Ignoring error when service starting/stopping: errno = {}, msg = {}".format(errno, msg))
return True
-
- return False # Not an acceptable error
+ return False # Not an acceptable error
def execute(self, wt: WorkerThread):
wt.verifyThreadSelf()
@@ -1453,7 +1457,7 @@ class Task():
self.logDebug(
"[-] executing task {}...".format(self.__class__.__name__))
- self._err = None # TODO: type hint mess up?
+ self._err = None # TODO: type hint mess up?
self._execStats.beginTaskType(self.__class__.__name__) # mark beginning
errno2 = None
@@ -1465,19 +1469,19 @@ class Task():
errno2 = Helper.convertErrno(err.errno)
if (Config.getConfig().continue_on_exception): # user choose to continue
self.logDebug("[=] Continue after TAOS exception: errno=0x{:X}, msg: {}, SQL: {}".format(
- errno2, err, wt.getDbConn().getLastSql()))
+ errno2, err, wt.getDbConn().getLastSql()))
self._err = err
elif self._isErrAcceptable(errno2, err.__str__()):
self.logDebug("[=] Acceptable Taos library exception: errno=0x{:X}, msg: {}, SQL: {}".format(
- errno2, err, wt.getDbConn().getLastSql()))
+ errno2, err, wt.getDbConn().getLastSql()))
# print("_", end="", flush=True)
Progress.emit(Progress.ACCEPTABLE_ERROR)
self._err = err
- else: # not an acceptable error
+ else: # not an acceptable error
shortTid = threading.get_ident() % 10000
errMsg = "[=] Unexpected Taos library exception ({}): errno=0x{:X}, thread={}, msg: {}, SQL: {}".format(
self.__class__.__name__,
- errno2,
+ errno2,
shortTid,
err, wt.getDbConn().getLastSql())
self.logDebug(errMsg)
@@ -1485,7 +1489,8 @@ class Task():
# raise # so that we see full stack
traceback.print_exc()
print(
- "\n\n----------------------------\nProgram ABORTED Due to Unexpected TAOS Error: \n\n{}\n".format(errMsg) +
+ "\n\n----------------------------\nProgram ABORTED Due to Unexpected TAOS Error: \n\n{}\n".format(
+ errMsg) +
"----------------------------\n")
# sys.exit(-1)
self._err = err
@@ -1502,10 +1507,10 @@ class Task():
traceback.print_exc()
# except BaseException: # TODO: what is this again??!!
# raise RuntimeError("Punt")
- # self.logDebug(
- # "[=] Unexpected exception, SQL: {}".format(
- # wt.getDbConn().getLastSql()))
- # raise
+ # self.logDebug(
+ # "[=] Unexpected exception, SQL: {}".format(
+ # wt.getDbConn().getLastSql()))
+ # raise
self._execStats.endTaskType(self.__class__.__name__, self.isSuccess())
self.logDebug("[X] task execution completed, {}, status: {}".format(
@@ -1524,12 +1529,12 @@ class Task():
def getQueryResult(self, wt: WorkerThread): # execute an SQL on the worker thread
return wt.getQueryResult()
- def lockTable(self, ftName): # full table name
+ def lockTable(self, ftName): # full table name
# print(" <<" + ftName + '_', end="", flush=True)
- with Task._lock: # SHORT lock! so we only protect lock creation
- if not ftName in Task._tableLocks: # Create new lock and add to list, if needed
+ with Task._lock: # SHORT lock! so we only protect lock creation
+ if not ftName in Task._tableLocks: # Create new lock and add to list, if needed
Task._tableLocks[ftName] = threading.Lock()
-
+
# No lock protection, anybody can do this any time
lock = Task._tableLocks[ftName]
# Logging.info("Acquiring lock: {}, {}".format(ftName, lock))
@@ -1538,7 +1543,7 @@ class Task():
def unlockTable(self, ftName):
# print('_' + ftName + ">> ", end="", flush=True)
- with Task._lock:
+ with Task._lock:
if not ftName in self._tableLocks:
raise RuntimeError("Corrupt state, no such lock")
lock = Task._tableLocks[ftName]
@@ -1588,11 +1593,11 @@ class ExecutionStats:
t[0] += 1 # index 0 has the "total" execution times
if isSuccess:
t[1] += 1 # index 1 has the "success" execution times
- if eno != None:
+ if eno != None:
if klassName not in self._errors:
self._errors[klassName] = {}
errors = self._errors[klassName]
- errors[eno] = errors[eno]+1 if eno in errors else 1
+ errors[eno] = errors[eno] + 1 if eno in errors else 1
def beginTaskType(self, klassName):
with self._lock:
@@ -1615,7 +1620,7 @@ class ExecutionStats:
Logging.info(
"----------------------------------------------------------------------")
Logging.info(
- "| Crash_Gen test {}, with the following stats:". format(
+ "| Crash_Gen test {}, with the following stats:".format(
"FAILED (reason: {})".format(
self._failureReason) if self._failed else "SUCCEEDED"))
Logging.info("| Task Execution Times (success/total):")
@@ -1628,7 +1633,7 @@ class ExecutionStats:
# print("errors = {}".format(errors))
errStrs = ["0x{:X}:{}".format(eno, n) for (eno, n) in errors.items()]
# print("error strings = {}".format(errStrs))
- errStr = ", ".join(errStrs)
+ errStr = ", ".join(errStrs)
Logging.info("| {0:<24}: {1}/{2} (Errors: {3})".format(k, n[1], n[0], errStr))
Logging.info(
@@ -1647,8 +1652,8 @@ class ExecutionStats:
Logging.info("| Top numbers written: {}".format(TaskExecutor.getBoundedList()))
Logging.info("| Active DB Native Connections (now): {}".format(DbConnNative.totalConnections))
Logging.info("| Longest native query time: {:.3f} seconds, started: {}".
- format(MyTDSql.longestQueryTime,
- time.strftime("%x %X", time.localtime(MyTDSql.lqStartTime))) )
+ format(MyTDSql.longestQueryTime,
+ time.strftime("%x %X", time.localtime(MyTDSql.lqStartTime))))
Logging.info("| Longest native query: {}".format(MyTDSql.longestQuery))
Logging.info(
"----------------------------------------------------------------------")
@@ -1662,12 +1667,12 @@ class StateTransitionTask(Task):
_baseTableNumber = None
- _endState = None # TODO: no longter used?
+ _endState = None # TODO: no longter used?
@classmethod
def getInfo(cls): # each sub class should supply their own information
raise RuntimeError("Overriding method expected")
-
+
@classmethod
def getEndState(cls): # TODO: optimize by calling it fewer times
raise RuntimeError("Overriding method expected")
@@ -1687,7 +1692,7 @@ class StateTransitionTask(Task):
@classmethod
def getRegTableName(cls, i):
- if ( StateTransitionTask._baseTableNumber is None): # Set it one time
+ if (StateTransitionTask._baseTableNumber is None): # Set it one time
StateTransitionTask._baseTableNumber = Dice.throw(
999) if Config.getConfig().dynamic_db_table_names else 0
return "reg_table_{}".format(StateTransitionTask._baseTableNumber + i)
@@ -1711,16 +1716,21 @@ class TaskCreateDb(StateTransitionTask):
repStr = ""
if Config.getConfig().num_replicas != 1:
# numReplica = Dice.throw(Settings.getConfig().max_replicas) + 1 # 1,2 ... N
- numReplica = Config.getConfig().num_replicas # fixed, always
+ numReplica = Config.getConfig().num_replicas # fixed, always
repStr = "replica {}".format(numReplica)
- updatePostfix = "" if Config.getConfig().verify_data else "" # allow update only when "verify data" is active , 3.0 version default is update 1
- vg_nums = random.randint(1,8)
- cache_model = Dice.choice(['none' , 'last_row' , 'last_value' , 'both'])
- buffer = random.randint(3,128)
+ updatePostfix = "" if Config.getConfig().verify_data else "" # allow update only when "verify data" is active , 3.0 version default is update 1
+ vg_nums = random.randint(1, 8)
+ cache_model = Dice.choice(['none', 'last_row', 'last_value', 'both'])
+ buffer = random.randint(3, 128)
dbName = self._db.getName()
- self.execWtSql(wt, "create database {} {} {} vgroups {} cachemodel '{}' buffer {} ".format(dbName, repStr, updatePostfix, vg_nums, cache_model,buffer ) )
+ self.execWtSql(wt, "create database {} {} {} vgroups {} cachemodel '{}' buffer {} ".format(dbName, repStr,
+ updatePostfix,
+ vg_nums,
+ cache_model,
+ buffer))
if dbName == "db_0" and Config.getConfig().use_shadow_db:
- self.execWtSql(wt, "create database {} {} {} ".format("db_s", repStr, updatePostfix ) )
+ self.execWtSql(wt, "create database {} {} {} ".format("db_s", repStr, updatePostfix))
+
class TaskDropDb(StateTransitionTask):
@classmethod
@@ -1732,19 +1742,20 @@ class TaskDropDb(StateTransitionTask):
return state.canDropDb()
def _executeInternal(self, te: TaskExecutor, wt: WorkerThread):
-
+
try:
- self.queryWtSql(wt, "drop database {}".format(self._db.getName())) # drop database maybe failed ,because topic exists
+ self.queryWtSql(wt, "drop database {}".format(
+ self._db.getName())) # drop database maybe failed ,because topic exists
except taos.error.ProgrammingError as err:
errno = Helper.convertErrno(err.errno)
- if errno in [0x0203]: # drop maybe failed
+ if errno in [0x0203]: # drop maybe failed
pass
Logging.debug("[OPS] database dropped at {}".format(time.time()))
class TaskCreateStream(StateTransitionTask):
-
+
@classmethod
def getEndState(cls):
return StateHasData()
@@ -1755,39 +1766,40 @@ class TaskCreateStream(StateTransitionTask):
def _executeInternal(self, te: TaskExecutor, wt: WorkerThread):
dbname = self._db.getName()
-
- sub_stream_name = dbname+ '_sub_stream'
+
+ sub_stream_name = dbname + '_sub_stream'
sub_stream_tb_name = 'stream_tb_sub'
- super_stream_name = dbname+ '_super_stream'
+ super_stream_name = dbname + '_super_stream'
super_stream_tb_name = 'stream_tb_super'
if not self._db.exists(wt.getDbConn()):
Logging.debug("Skipping task, no DB yet")
return
- sTable = self._db.getFixedSuperTable() # type: TdSuperTable
+ sTable = self._db.getFixedSuperTable() # type: TdSuperTable
# wt.execSql("use db") # should always be in place
- stbname =sTable.getName()
+ stbname = sTable.getName()
sub_tables = sTable.getRegTables(wt.getDbConn())
- aggExpr = Dice.choice([
- 'count(*)', 'avg(speed)', 'sum(speed)', 'stddev(speed)','min(speed)', 'max(speed)', 'first(speed)', 'last(speed)',
- 'apercentile(speed, 10)', 'last_row(*)', 'twa(speed)'])
-
- stream_sql = '' # set default value
+ aggExpr = Dice.choice([
+ 'count(*)', 'avg(speed)', 'sum(speed)', 'stddev(speed)', 'min(speed)', 'max(speed)', 'first(speed)',
+ 'last(speed)',
+ 'apercentile(speed, 10)', 'last_row(*)', 'twa(speed)'])
+
+ stream_sql = '' # set default value
if sub_tables:
sub_tbname = sub_tables[0]
# create stream with query above sub_table
- stream_sql = 'create stream {} into {}.{} as select {}, avg(speed) FROM {}.{} PARTITION BY tbname INTERVAL(5s) SLIDING(3s) '.\
- format(sub_stream_name,dbname,sub_stream_tb_name ,aggExpr,dbname,sub_tbname)
+ stream_sql = 'create stream {} into {}.{} as select {}, avg(speed) FROM {}.{} PARTITION BY tbname INTERVAL(5s) SLIDING(3s) '. \
+ format(sub_stream_name, dbname, sub_stream_tb_name, aggExpr, dbname, sub_tbname)
else:
- stream_sql = 'create stream {} into {}.{} as select {}, avg(speed) FROM {}.{} PARTITION BY tbname INTERVAL(5s) SLIDING(3s) '.\
- format(super_stream_name,dbname,super_stream_tb_name,aggExpr, dbname,stbname)
+ stream_sql = 'create stream {} into {}.{} as select {}, avg(speed) FROM {}.{} PARTITION BY tbname INTERVAL(5s) SLIDING(3s) '. \
+ format(super_stream_name, dbname, super_stream_tb_name, aggExpr, dbname, stbname)
self.execWtSql(wt, stream_sql)
Logging.debug("[OPS] stream is creating at {}".format(time.time()))
class TaskCreateTopic(StateTransitionTask):
-
+
@classmethod
def getEndState(cls):
return StateHasData()
@@ -1798,40 +1810,46 @@ class TaskCreateTopic(StateTransitionTask):
def _executeInternal(self, te: TaskExecutor, wt: WorkerThread):
dbname = self._db.getName()
-
- sub_topic_name = dbname+ '_sub_topic'
- super_topic_name = dbname+ '_super_topic'
- stable_topic = dbname+ '_stable_topic'
- db_topic = 'database_' + dbname+ '_topics'
+
+ sub_topic_name = dbname + '_sub_topic'
+ super_topic_name = dbname + '_super_topic'
+ stable_topic = dbname + '_stable_topic'
+ db_topic = 'database_' + dbname + '_topics'
if not self._db.exists(wt.getDbConn()):
Logging.debug("Skipping task, no DB yet")
return
- sTable = self._db.getFixedSuperTable() # type: TdSuperTable
+ sTable = self._db.getFixedSuperTable() # type: TdSuperTable
# wt.execSql("use db") # should always be in place
# create topic if not exists topic_ctb_column as select ts, c1, c2, c3 from stb1;
- stbname =sTable.getName()
+ stbname = sTable.getName()
sub_tables = sTable.getRegTables(wt.getDbConn())
- scalarExpr = Dice.choice([ '*','speed','color','abs(speed)','acos(speed)','asin(speed)','atan(speed)','ceil(speed)','cos(speed)','cos(speed)',
- 'floor(speed)','log(speed,2)','pow(speed,2)','round(speed)','sin(speed)','sqrt(speed)','char_length(color)','concat(color,color)',
- 'concat_ws(" ", color,color," ")','length(color)', 'lower(color)', 'ltrim(color)','substr(color , 2)','upper(color)','cast(speed as double)',
- 'cast(ts as bigint)'])
+ scalarExpr = Dice.choice(
+ ['*', 'speed', 'color', 'abs(speed)', 'acos(speed)', 'asin(speed)', 'atan(speed)', 'ceil(speed)',
+ 'cos(speed)', 'cos(speed)',
+ 'floor(speed)', 'log(speed,2)', 'pow(speed,2)', 'round(speed)', 'sin(speed)', 'sqrt(speed)',
+ 'char_length(color)', 'concat(color,color)',
+ 'concat_ws(" ", color,color," ")', 'length(color)', 'lower(color)', 'ltrim(color)', 'substr(color , 2)',
+ 'upper(color)', 'cast(speed as double)',
+ 'cast(ts as bigint)'])
topic_sql = '' # set default value
- if Dice.throw(3)==0: # create topic : source data from sub query
- if sub_tables: # if not empty
+ if Dice.throw(3) == 0: # create topic : source data from sub query
+ if sub_tables: # if not empty
sub_tbname = sub_tables[0]
# create topic : source data from sub query of sub stable
- topic_sql = 'create topic {} as select {} FROM {}.{} ; '.format(sub_topic_name,scalarExpr,dbname,sub_tbname)
-
+ topic_sql = 'create topic {} as select {} FROM {}.{} ; '.format(sub_topic_name, scalarExpr, dbname,
+ sub_tbname)
+
else: # create topic : source data from sub query of stable
- topic_sql = 'create topic {} as select {} FROM {}.{} '.format(super_topic_name,scalarExpr, dbname,stbname)
- elif Dice.throw(3)==1: # create topic : source data from super table
- topic_sql = 'create topic {} AS STABLE {}.{} '.format(stable_topic,dbname,stbname)
-
- elif Dice.throw(3)==2: # create topic : source data from whole database
- topic_sql = 'create topic {} AS DATABASE {} '.format(db_topic,dbname)
+ topic_sql = 'create topic {} as select {} FROM {}.{} '.format(super_topic_name, scalarExpr, dbname,
+ stbname)
+ elif Dice.throw(3) == 1: # create topic : source data from super table
+ topic_sql = 'create topic {} AS STABLE {}.{} '.format(stable_topic, dbname, stbname)
+
+ elif Dice.throw(3) == 2: # create topic : source data from whole database
+ topic_sql = 'create topic {} AS DATABASE {} '.format(db_topic, dbname)
else:
pass
@@ -1840,8 +1858,9 @@ class TaskCreateTopic(StateTransitionTask):
self.execWtSql(wt, topic_sql)
Logging.debug("[OPS] db topic is creating at {}".format(time.time()))
+
class TaskDropTopics(StateTransitionTask):
-
+
@classmethod
def getEndState(cls):
return StateHasData()
@@ -1852,21 +1871,21 @@ class TaskDropTopics(StateTransitionTask):
def _executeInternal(self, te: TaskExecutor, wt: WorkerThread):
dbname = self._db.getName()
-
if not self._db.exists(wt.getDbConn()):
Logging.debug("Skipping task, no DB yet")
return
- sTable = self._db.getFixedSuperTable() # type: TdSuperTable
+ sTable = self._db.getFixedSuperTable() # type: TdSuperTable
# wt.execSql("use db") # should always be in place
tblName = sTable.getName()
if sTable.hasTopics(wt.getDbConn()):
- sTable.dropTopics(wt.getDbConn(),dbname,None) # drop topics of database
- sTable.dropTopics(wt.getDbConn(),dbname,tblName) # drop topics of stable
+ sTable.dropTopics(wt.getDbConn(), dbname, None) # drop topics of database
+ sTable.dropTopics(wt.getDbConn(), dbname, tblName) # drop topics of stable
+
class TaskDropStreams(StateTransitionTask):
-
+
@classmethod
def getEndState(cls):
return StateHasData()
@@ -1877,20 +1896,20 @@ class TaskDropStreams(StateTransitionTask):
def _executeInternal(self, te: TaskExecutor, wt: WorkerThread):
# dbname = self._db.getName()
-
if not self._db.exists(wt.getDbConn()):
Logging.debug("Skipping task, no DB yet")
return
- sTable = self._db.getFixedSuperTable() # type: TdSuperTable
+ sTable = self._db.getFixedSuperTable() # type: TdSuperTable
# wt.execSql("use db") # should always be in place
# tblName = sTable.getName()
if sTable.hasStreams(wt.getDbConn()):
sTable.dropStreams(wt.getDbConn()) # drop stream of database
+
class TaskDropStreamTables(StateTransitionTask):
-
+
@classmethod
def getEndState(cls):
return StateHasData()
@@ -1901,42 +1920,42 @@ class TaskDropStreamTables(StateTransitionTask):
def _executeInternal(self, te: TaskExecutor, wt: WorkerThread):
# dbname = self._db.getName()
-
if not self._db.exists(wt.getDbConn()):
Logging.debug("Skipping task, no DB yet")
return
- sTable = self._db.getFixedSuperTable() # type: TdSuperTable
- wt.execSql("use db") # should always be in place
+ sTable = self._db.getFixedSuperTable() # type: TdSuperTable
+ wt.execSql("use db") # should always be in place
# tblName = sTable.getName()
if sTable.hasStreamTables(wt.getDbConn()):
- sTable.dropStreamTables(wt.getDbConn()) # drop stream tables
+ sTable.dropStreamTables(wt.getDbConn()) # drop stream tables
+
class TaskCreateConsumers(StateTransitionTask):
-
+
@classmethod
def getEndState(cls):
return StateHasData()
@classmethod
def canBeginFrom(cls, state: AnyState):
- return state.canCreateConsumers()
+ return state.canCreateConsumers()
def _executeInternal(self, te: TaskExecutor, wt: WorkerThread):
- if Config.getConfig().connector_type == 'native':
-
- sTable = self._db.getFixedSuperTable() # type: TdSuperTable
+ if Config.getConfig().connector_type == 'native':
+
+ sTable = self._db.getFixedSuperTable() # type: TdSuperTable
# wt.execSql("use db") # should always be in place
if sTable.hasTopics(wt.getDbConn()):
- sTable.createConsumer(wt.getDbConn(),random.randint(1,10))
+ sTable.createConsumer(wt.getDbConn(), random.randint(1, 10))
pass
else:
print(" restful not support tmq consumers")
- return
+ return
+
-
class TaskCreateSuperTable(StateTransitionTask):
@classmethod
def getEndState(cls):
@@ -1951,9 +1970,9 @@ class TaskCreateSuperTable(StateTransitionTask):
Logging.debug("Skipping task, no DB yet")
return
- sTable = self._db.getFixedSuperTable() # type: TdSuperTable
+ sTable = self._db.getFixedSuperTable() # type: TdSuperTable
# wt.execSql("use db") # should always be in place
-
+
sTable.create(wt.getDbConn(),
{'ts': TdDataType.TIMESTAMP, 'speed': TdDataType.INT, 'color': TdDataType.BINARY16}, {
'b': TdDataType.BINARY200, 'f': TdDataType.FLOAT},
@@ -1974,11 +1993,10 @@ class TdSuperTable:
def getName(self):
return self._stName
-
- def drop(self, dbc, skipCheck = False):
+ def drop(self, dbc, skipCheck=False):
dbName = self._dbName
- if self.exists(dbc) : # if myself exists
- fullTableName = dbName + '.' + self._stName
+ if self.exists(dbc): # if myself exists
+ fullTableName = dbName + '.' + self._stName
dbc.execute("DROP TABLE {}".format(fullTableName))
else:
if not skipCheck:
@@ -1989,64 +2007,55 @@ class TdSuperTable:
return dbc.existsSuperTable(self._stName)
# TODO: odd semantic, create() method is usually static?
- def create(self, dbc, cols: TdColumns, tags: TdTags, dropIfExists = False):
+ def create(self, dbc, cols: TdColumns, tags: TdTags, dropIfExists=False):
'''Creating a super table'''
dbName = self._dbName
dbc.execute("USE " + dbName)
- fullTableName = dbName + '.' + self._stName
+ fullTableName = dbName + '.' + self._stName
if dbc.existsSuperTable(self._stName):
- if dropIfExists:
- dbc.execute("DROP TABLE {}".format(fullTableName))
-
- else: # error
+ if dropIfExists:
+ dbc.execute("DROP TABLE {}".format(fullTableName))
+
+ else: # error
raise CrashGenError("Cannot create super table, already exists: {}".format(self._stName))
# Now let's create
sql = "CREATE TABLE {} ({})".format(
fullTableName,
- ",".join(['%s %s'%(k,v.value) for (k,v) in cols.items()]))
- if tags :
+ ",".join(['%s %s' % (k, v.value) for (k, v) in cols.items()]))
+ if tags:
sql += " TAGS ({})".format(
- ",".join(['%s %s'%(k,v.value) for (k,v) in tags.items()])
- )
+ ",".join(['%s %s' % (k, v.value) for (k, v) in tags.items()])
+ )
else:
sql += " TAGS (dummy int) "
- dbc.execute(sql)
+ dbc.execute(sql)
+
+ def createConsumer(self, dbc, Consumer_nums):
- def createConsumer(self, dbc,Consumer_nums):
-
def generateConsumer(current_topic_list):
- conf = TaosTmqConf()
- conf.set("group.id", "tg2")
- conf.set("td.connect.user", "root")
- conf.set("td.connect.pass", "taosdata")
-# conf.set("enable.auto.commit", "true")
-# def tmq_commit_cb_print(tmq, resp, offset, param=None):
-# print(f"commit: {resp}, tmq: {tmq}, offset: {offset}, param: {param}")
-# conf.set_auto_commit_cb(tmq_commit_cb_print, None)
- consumer = conf.new_consumer()
- topic_list = TaosTmqList()
+ consumer = Consumer({"group.id": "tg2", "td.connect.user": "root", "td.connect.pass": "taosdata"})
+ topic_list = []
for topic in current_topic_list:
topic_list.append(topic)
- try:
- consumer.subscribe(topic_list)
- except TmqError as e :
- pass
+
+ consumer.subscribe(topic_list)
# consumer with random work life
time_start = time.time()
while 1:
- res = consumer.poll(1000)
- if time.time() - time_start >random.randint(5,50) :
+ res = consumer.poll(1)
+ consumer.commit(res)
+ if time.time() - time_start > random.randint(5, 50):
break
try:
consumer.unsubscribe()
- except TmqError as e :
+ except TmqError as e:
pass
return
-
+
# mulit Consumer
current_topic_list = self.getTopicLists(dbc)
for i in range(Consumer_nums):
@@ -2067,84 +2076,86 @@ class TdSuperTable:
def getRegTables(self, dbc: DbConn):
dbName = self._dbName
try:
- dbc.query("select distinct TBNAME from {}.{}".format(dbName, self._stName)) # TODO: analyze result set later
- except taos.error.ProgrammingError as err:
- errno2 = Helper.convertErrno(err.errno)
+ dbc.query("select distinct TBNAME from {}.{}".format(dbName,
+ self._stName)) # TODO: analyze result set later
+ except taos.error.ProgrammingError as err:
+ errno2 = Helper.convertErrno(err.errno)
Logging.debug("[=] Failed to get tables from super table: errno=0x{:X}, msg: {}".format(errno2, err))
raise
qr = dbc.getQueryResult()
- return [v[0] for v in qr] # list transformation, ref: https://stackoverflow.com/questions/643823/python-list-transformation
+ return [v[0] for v in
+ qr] # list transformation, ref: https://stackoverflow.com/questions/643823/python-list-transformation
def hasRegTables(self, dbc: DbConn):
-
+
if dbc.existsSuperTable(self._stName):
return dbc.query("SELECT * FROM {}.{}".format(self._dbName, self._stName)) > 0
else:
return False
- def hasStreamTables(self,dbc: DbConn):
-
+ def hasStreamTables(self, dbc: DbConn):
+
return dbc.query("show {}.stables like 'stream_tb%'".format(self._dbName)) > 0
- def hasStreams(self,dbc: DbConn):
+ def hasStreams(self, dbc: DbConn):
return dbc.query("show streams") > 0
- def hasTopics(self,dbc: DbConn):
-
+ def hasTopics(self, dbc: DbConn):
+
return dbc.query("show topics") > 0
- def dropTopics(self,dbc: DbConn , dbname=None,stb_name=None):
+ def dropTopics(self, dbc: DbConn, dbname=None, stb_name=None):
dbc.query("show topics ")
topics = dbc.getQueryResult()
- if dbname !=None and stb_name == None :
-
+ if dbname != None and stb_name == None:
+
for topic in topics:
if dbname in topic[0] and topic[0].startswith("database"):
try:
dbc.execute('drop topic {}'.format(topic[0]))
- Logging.debug("[OPS] topic {} is droping at {}".format(topic,time.time()))
- except taos.error.ProgrammingError as err:
+ Logging.debug("[OPS] topic {} is droping at {}".format(topic, time.time()))
+ except taos.error.ProgrammingError as err:
errno = Helper.convertErrno(err.errno)
- if errno in [0x03EB]: # Topic subscribed cannot be dropped
- pass
+ if errno in [0x03EB]: # Topic subscribed cannot be dropped
+ pass
# for subsript in subscriptions:
-
+
else:
pass
pass
return True
- elif dbname !=None and stb_name!= None:
+ elif dbname != None and stb_name != None:
for topic in topics:
if topic[0].startswith(self._dbName) and topic[0].endswith('topic'):
dbc.execute('drop topic {}'.format(topic[0]))
- Logging.debug("[OPS] topic {} is droping at {}".format(topic,time.time()))
+ Logging.debug("[OPS] topic {} is droping at {}".format(topic, time.time()))
return True
else:
return True
pass
- def dropStreams(self,dbc:DbConn):
+ def dropStreams(self, dbc: DbConn):
dbc.query("show streams ")
Streams = dbc.getQueryResult()
for Stream in Streams:
if Stream[0].startswith(self._dbName):
dbc.execute('drop stream {}'.format(Stream[0]))
-
+
return not dbc.query("show streams ") > 0
def dropStreamTables(self, dbc: DbConn):
dbc.query("show {}.stables like 'stream_tb%'".format(self._dbName))
-
+
StreamTables = dbc.getQueryResult()
- for StreamTable in StreamTables:
+ for StreamTable in StreamTables:
if self.dropStreams(dbc):
- dbc.execute('drop table {}.{}'.format(self._dbName,StreamTable[0]))
-
+ dbc.execute('drop table {}.{}'.format(self._dbName, StreamTable[0]))
+
return not dbc.query("show {}.stables like 'stream_tb%'".format(self._dbName))
def ensureRegTable(self, task: Optional[Task], dbc: DbConn, regTableName: str):
@@ -2155,16 +2166,16 @@ class TdSuperTable:
'''
dbName = self._dbName
sql = "select tbname from {}.{} where tbname in ('{}')".format(dbName, self._stName, regTableName)
- if dbc.query(sql) >= 1 : # reg table exists already
+ if dbc.query(sql) >= 1: # reg table exists already
return
# acquire a lock first, so as to be able to *verify*. More details in TD-1471
- fullTableName = dbName + '.' + regTableName
+ fullTableName = dbName + '.' + regTableName
if task is not None: # Somethime thie operation is requested on behalf of a "task"
# Logging.info("Locking table for creation: {}".format(fullTableName))
- task.lockTable(fullTableName) # in which case we'll lock this table to ensure serialized access
+ task.lockTable(fullTableName) # in which case we'll lock this table to ensure serialized access
# Logging.info("Table locked for creation".format(fullTableName))
- Progress.emit(Progress.CREATE_TABLE_ATTEMPT) # ATTEMPT to create a new table
+ Progress.emit(Progress.CREATE_TABLE_ATTEMPT) # ATTEMPT to create a new table
# print("(" + fullTableName[-3:] + ")", end="", flush=True)
try:
sql = "CREATE TABLE {} USING {}.{} tags ({})".format(
@@ -2176,17 +2187,17 @@ class TdSuperTable:
finally:
if task is not None:
# Logging.info("Unlocking table after creation: {}".format(fullTableName))
- task.unlockTable(fullTableName) # no matter what
+ task.unlockTable(fullTableName) # no matter what
# Logging.info("Table unlocked after creation: {}".format(fullTableName))
- def _getTagStrForSql(self, dbc) :
+ def _getTagStrForSql(self, dbc):
tags = self._getTags(dbc)
tagStrs = []
- for tagName in tags:
+ for tagName in tags:
tagType = tags[tagName]
if tagType == 'BINARY':
tagStrs.append("'Beijing-Shanghai-LosAngeles'")
- elif tagType== 'VARCHAR':
+ elif tagType == 'VARCHAR':
tagStrs.append("'London-Paris-Berlin'")
elif tagType == 'FLOAT':
tagStrs.append('9.9')
@@ -2200,12 +2211,12 @@ class TdSuperTable:
dbc.query("DESCRIBE {}.{}".format(self._dbName, self._stName))
stCols = dbc.getQueryResult()
# print(stCols)
- ret = {row[0]:row[1] for row in stCols if row[3]=='TAG'} # name:type
+ ret = {row[0]: row[1] for row in stCols if row[3] == 'TAG'} # name:type
# print("Tags retrieved: {}".format(ret))
return ret
def addTag(self, dbc, tagName, tagType):
- if tagName in self._getTags(dbc): # already
+ if tagName in self._getTags(dbc): # already
return
# sTable.addTag("extraTag", "int")
sql = "alter table {}.{} add tag {} {}".format(
@@ -2213,33 +2224,33 @@ class TdSuperTable:
dbc.execute(sql)
def dropTag(self, dbc, tagName):
- if not tagName in self._getTags(dbc): # don't have this tag
+ if not tagName in self._getTags(dbc): # don't have this tag
return
sql = "alter table {}.{} drop tag {}".format(self._dbName, self._stName, tagName)
dbc.execute(sql)
def changeTag(self, dbc, oldTag, newTag):
tags = self._getTags(dbc)
- if not oldTag in tags: # don't have this tag
+ if not oldTag in tags: # don't have this tag
return
- if newTag in tags: # already have this tag
+ if newTag in tags: # already have this tag
return
sql = "alter table {}.{} change tag {} {}".format(self._dbName, self._stName, oldTag, newTag)
dbc.execute(sql)
def generateQueries(self, dbc: DbConn) -> List[SqlQuery]:
''' Generate queries to test/exercise this super table '''
- ret = [] # type: List[SqlQuery]
+ ret = [] # type: List[SqlQuery]
for rTbName in self.getRegTables(dbc): # regular tables
-
- filterExpr = Dice.choice([ # TODO: add various kind of WHERE conditions
+
+ filterExpr = Dice.choice([ # TODO: add various kind of WHERE conditions
None
])
# Run the query against the regular table first
- doAggr = (Dice.throw(2) == 0) # 1 in 2 chance
- if not doAggr: # don't do aggregate query, just simple one
+ doAggr = (Dice.throw(2) == 0) # 1 in 2 chance
+ if not doAggr: # don't do aggregate query, just simple one
commonExpr = Dice.choice([
'*',
'abs(speed)',
@@ -2256,7 +2267,7 @@ class TdSuperTable:
'sin(speed)',
'sqrt(speed)',
'char_length(color)',
- 'concat(color,color)',
+ 'concat(color,color)',
'concat_ws(" ", color,color," ")',
'length(color)',
'lower(color)',
@@ -2276,26 +2287,26 @@ class TdSuperTable:
'distinct(color)'
]
)
- ret.append(SqlQuery( # reg table
+ ret.append(SqlQuery( # reg table
"select {} from {}.{}".format(commonExpr, self._dbName, rTbName)))
- ret.append(SqlQuery( # super table
+ ret.append(SqlQuery( # super table
"select {} from {}.{}".format(commonExpr, self._dbName, self.getName())))
- else: # Aggregate query
- aggExpr = Dice.choice([
+ else: # Aggregate query
+ aggExpr = Dice.choice([
'count(*)',
'avg(speed)',
# 'twa(speed)', # TODO: this one REQUIRES a where statement, not reasonable
- 'sum(speed)',
- 'stddev(speed)',
+ 'sum(speed)',
+ 'stddev(speed)',
# SELECTOR functions
- 'min(speed)',
- 'max(speed)',
- 'first(speed)',
+ 'min(speed)',
+ 'max(speed)',
+ 'first(speed)',
'last(speed)',
- 'top(speed, 50)', # TODO: not supported?
- 'bottom(speed, 50)', # TODO: not supported?
- 'apercentile(speed, 10)', # TODO: TD-1316
- 'last_row(*)', # TODO: commented out per TD-3231, we should re-create
+ 'top(speed, 50)', # TODO: not supported?
+ 'bottom(speed, 50)', # TODO: not supported?
+ 'apercentile(speed, 10)', # TODO: TD-1316
+ 'last_row(*)', # TODO: commented out per TD-3231, we should re-create
# Transformation Functions
# 'diff(speed)', # TODO: no supported?!
'spread(speed)',
@@ -2313,21 +2324,21 @@ class TdSuperTable:
'sample(speed,5)',
'STATECOUNT(speed,"LT",1)',
'STATEDURATION(speed,"LT",1)',
- 'twa(speed)'
-
- ]) # TODO: add more from 'top'
+ 'twa(speed)'
+
+ ]) # TODO: add more from 'top'
-
# if aggExpr not in ['stddev(speed)']: # STDDEV not valid for super tables?! (Done in TD-1049)
sql = "select {} from {}.{}".format(aggExpr, self._dbName, self.getName())
- if Dice.throw(3) == 0: # 1 in X chance
- partion_expr = Dice.choice(['color','tbname'])
+ if Dice.throw(3) == 0: # 1 in X chance
+ partion_expr = Dice.choice(['color', 'tbname'])
sql = sql + ' partition BY ' + partion_expr + ' order by ' + partion_expr
Progress.emit(Progress.QUERY_GROUP_BY)
# Logging.info("Executing GROUP-BY query: " + sql)
ret.append(SqlQuery(sql))
- return ret
+ return ret
+
class TaskReadData(StateTransitionTask):
@classmethod
@@ -2345,60 +2356,61 @@ class TaskReadData(StateTransitionTask):
def _reconnectIfNeeded(self, wt):
# 1 in 20 chance, simulate a broken connection, only if service stable (not restarting)
- if random.randrange(20)==0: # and self._canRestartService(): # TODO: break connection in all situations
+ if random.randrange(20) == 0: # and self._canRestartService(): # TODO: break connection in all situations
# Logging.info("Attempting to reconnect to server") # TODO: change to DEBUG
- Progress.emit(Progress.SERVICE_RECONNECT_START)
+ Progress.emit(Progress.SERVICE_RECONNECT_START)
try:
wt.getDbConn().close()
wt.getDbConn().open()
- except ConnectionError as err: # may fail
+ except ConnectionError as err: # may fail
if not gSvcMgr:
Logging.error("Failed to reconnect in client-only mode")
- raise # Not OK if we are running in client-only mode
- if gSvcMgr.isRunning(): # may have race conditon, but low prob, due to
+ raise # Not OK if we are running in client-only mode
+ if gSvcMgr.isRunning(): # may have race conditon, but low prob, due to
Logging.error("Failed to reconnect when managed server is running")
- raise # Not OK if we are running normally
+ raise # Not OK if we are running normally
- Progress.emit(Progress.SERVICE_RECONNECT_FAILURE)
+ Progress.emit(Progress.SERVICE_RECONNECT_FAILURE)
# Logging.info("Ignoring DB reconnect error")
# print("_r", end="", flush=True)
- Progress.emit(Progress.SERVICE_RECONNECT_SUCCESS)
+ Progress.emit(Progress.SERVICE_RECONNECT_SUCCESS)
# The above might have taken a lot of time, service might be running
# by now, causing error below to be incorrectly handled due to timing issue
- return # TODO: fix server restart status race condtion
-
+ return # TODO: fix server restart status race condtion
def _executeInternal(self, te: TaskExecutor, wt: WorkerThread):
self._reconnectIfNeeded(wt)
dbc = wt.getDbConn()
sTable = self._db.getFixedSuperTable()
-
+
for q in sTable.generateQueries(dbc): # regular tables
try:
sql = q.getSql()
# if 'GROUP BY' in sql:
# Logging.info("Executing GROUP-BY query: " + sql)
dbc.execute(sql)
- except taos.error.ProgrammingError as err:
+ except taos.error.ProgrammingError as err:
errno2 = Helper.convertErrno(err.errno)
Logging.debug("[=] Read Failure: errno=0x{:X}, msg: {}, SQL: {}".format(errno2, err, dbc.getLastSql()))
raise
+
class SqlQuery:
@classmethod
def buildRandom(cls, db: Database):
'''Build a random query against a certain database'''
-
+
dbName = db.getName()
- def __init__(self, sql:str = None):
+ def __init__(self, sql: str = None):
self._sql = sql
def getSql(self):
return self._sql
-
+
+
class TaskDropSuperTable(StateTransitionTask):
@classmethod
def getEndState(cls):
@@ -2421,7 +2433,7 @@ class TaskDropSuperTable(StateTransitionTask):
regTableName = self.getRegTableName(i) # "db.reg_table_{}".format(i)
try:
self.execWtSql(wt, "drop table {}.{}".
- format(self._db.getName(), regTableName)) # nRows always 0, like MySQL
+ format(self._db.getName(), regTableName)) # nRows always 0, like MySQL
except taos.error.ProgrammingError as err:
# correcting for strange error number scheme
errno2 = Helper.convertErrno(err.errno)
@@ -2429,7 +2441,6 @@ class TaskDropSuperTable(StateTransitionTask):
isSuccess = False
Logging.debug("[DB] Acceptable error when dropping a table")
continue # try to delete next regular table
-
if (not tickOutput):
tickOutput = True # Print only one time
@@ -2441,8 +2452,6 @@ class TaskDropSuperTable(StateTransitionTask):
# Drop the super table itself
tblName = self._db.getFixedSuperTableName()
self.execWtSql(wt, "drop table {}.{}".format(self._db.getName(), tblName))
-
-
class TaskAlterTags(StateTransitionTask):
@@ -2472,6 +2481,7 @@ class TaskAlterTags(StateTransitionTask):
sTable.changeTag(dbc, "extraTag", "newTag")
# sql = "alter table db.{} change tag extraTag newTag".format(tblName)
+
class TaskRestartService(StateTransitionTask):
_isRunning = False
_classLock = threading.Lock()
@@ -2484,11 +2494,12 @@ class TaskRestartService(StateTransitionTask):
def canBeginFrom(cls, state: AnyState):
if Config.getConfig().auto_start_service:
return state.canDropFixedSuperTable() # Basicallly when we have the super table
- return False # don't run this otherwise
+ return False # don't run this otherwise
CHANCE_TO_RESTART_SERVICE = 200
+
def _executeInternal(self, te: TaskExecutor, wt: WorkerThread):
- if not Config.getConfig().auto_start_service: # only execute when we are in -a mode
+ if not Config.getConfig().auto_start_service: # only execute when we are in -a mode
print("_a", end="", flush=True)
return
@@ -2498,20 +2509,22 @@ class TaskRestartService(StateTransitionTask):
return
self._isRunning = True
- if Dice.throw(self.CHANCE_TO_RESTART_SERVICE) == 0: # 1 in N chance
+ if Dice.throw(self.CHANCE_TO_RESTART_SERVICE) == 0: # 1 in N chance
dbc = wt.getDbConn()
- dbc.execute("select * from information_schema.ins_databases") # simple delay, align timing with other workers
+ dbc.execute(
+ "select * from information_schema.ins_databases") # simple delay, align timing with other workers
gSvcMgr.restart()
self._isRunning = False
+
class TaskAddData(StateTransitionTask):
# Track which table is being actively worked on
activeTable: Set[int] = set()
# We use these two files to record operations to DB, useful for power-off tests
- fAddLogReady = None # type: Optional[io.TextIOWrapper]
- fAddLogDone = None # type: Optional[io.TextIOWrapper]
+ fAddLogReady = None # type: Optional[io.TextIOWrapper]
+ fAddLogDone = None # type: Optional[io.TextIOWrapper]
@classmethod
def prepToRecordOps(cls):
@@ -2532,12 +2545,12 @@ class TaskAddData(StateTransitionTask):
def canBeginFrom(cls, state: AnyState):
return state.canAddData()
- def _lockTableIfNeeded(self, fullTableName, extraMsg = ''):
+ def _lockTableIfNeeded(self, fullTableName, extraMsg=''):
if Config.getConfig().verify_data:
# Logging.info("Locking table: {}".format(fullTableName))
- self.lockTable(fullTableName)
+ self.lockTable(fullTableName)
# Logging.info("Table locked {}: {}".format(extraMsg, fullTableName))
- # print("_w" + str(nextInt % 100), end="", flush=True) # Trace what was written
+ # print("_w" + str(nextInt % 100), end="", flush=True) # Trace what was written
else:
# Logging.info("Skipping locking table")
pass
@@ -2545,15 +2558,15 @@ class TaskAddData(StateTransitionTask):
def _unlockTableIfNeeded(self, fullTableName):
if Config.getConfig().verify_data:
# Logging.info("Unlocking table: {}".format(fullTableName))
- self.unlockTable(fullTableName)
+ self.unlockTable(fullTableName)
# Logging.info("Table unlocked: {}".format(fullTableName))
else:
pass
# Logging.info("Skipping unlocking table")
- def _addDataInBatch(self, db, dbc, regTableName, te: TaskExecutor):
- numRecords = self.LARGE_NUMBER_OF_RECORDS if Config.getConfig().larger_data else self.SMALL_NUMBER_OF_RECORDS
-
+ def _addDataInBatch(self, db, dbc, regTableName, te: TaskExecutor):
+ numRecords = self.LARGE_NUMBER_OF_RECORDS if Config.getConfig().larger_data else self.SMALL_NUMBER_OF_RECORDS
+
fullTableName = db.getName() + '.' + regTableName
self._lockTableIfNeeded(fullTableName, 'batch')
@@ -2571,10 +2584,8 @@ class TaskAddData(StateTransitionTask):
# Logging.info("Data added in batch: {}".format(sql))
self._unlockTableIfNeeded(fullTableName)
-
-
- def _addData(self, db: Database, dbc, regTableName, te: TaskExecutor): # implied: NOT in batches
- numRecords = self.LARGE_NUMBER_OF_RECORDS if Config.getConfig().larger_data else self.SMALL_NUMBER_OF_RECORDS
+ def _addData(self, db: Database, dbc, regTableName, te: TaskExecutor): # implied: NOT in batches
+ numRecords = self.LARGE_NUMBER_OF_RECORDS if Config.getConfig().larger_data else self.SMALL_NUMBER_OF_RECORDS
for j in range(numRecords): # number of records per table
intToWrite = db.getNextInt()
@@ -2587,13 +2598,14 @@ class TaskAddData(StateTransitionTask):
self.fAddLogReady.write("Ready to write {} to {}\n".format(intToWrite, regTableName))
self.fAddLogReady.flush()
os.fsync(self.fAddLogReady.fileno())
-
+
# TODO: too ugly trying to lock the table reliably, refactor...
fullTableName = db.getName() + '.' + regTableName
- self._lockTableIfNeeded(fullTableName) # so that we are verify read-back. TODO: deal with exceptions before unlock
-
+ self._lockTableIfNeeded(
+ fullTableName) # so that we are verify read-back. TODO: deal with exceptions before unlock
+
try:
- sql = "INSERT INTO {} VALUES ('{}', {}, '{}');".format( # removed: tags ('{}', {})
+ sql = "INSERT INTO {} VALUES ('{}', {}, '{}');".format( # removed: tags ('{}', {})
fullTableName,
# ds.getFixedSuperTableName(),
# ds.getNextBinary(), ds.getNextFloat(),
@@ -2604,55 +2616,56 @@ class TaskAddData(StateTransitionTask):
intWrote = intToWrite
# Quick hack, attach an update statement here. TODO: create an "update" task
- if (not Config.getConfig().use_shadow_db) and Dice.throw(5) == 0: # 1 in N chance, plus not using shaddow DB
- intToUpdate = db.getNextInt() # Updated, but should not succeed
+ if (not Config.getConfig().use_shadow_db) and Dice.throw(
+ 5) == 0: # 1 in N chance, plus not using shaddow DB
+ intToUpdate = db.getNextInt() # Updated, but should not succeed
nextColor = db.getNextColor()
- sql = "INSERt INTO {} VALUES ('{}', {}, '{}');".format( # "INSERt" means "update" here
- fullTableName,
- nextTick, intToUpdate, nextColor)
+ sql = "INSERt INTO {} VALUES ('{}', {}, '{}');".format( # "INSERt" means "update" here
+ fullTableName,
+ nextTick, intToUpdate, nextColor)
# sql = "UPDATE {} set speed={}, color='{}' WHERE ts='{}'".format(
# fullTableName, db.getNextInt(), db.getNextColor(), nextTick)
dbc.execute(sql)
- intWrote = intToUpdate # We updated, seems TDengine non-cluster accepts this.
+ intWrote = intToUpdate # We updated, seems TDengine non-cluster accepts this.
- except: # Any exception at all
- self._unlockTableIfNeeded(fullTableName)
+ except: # Any exception at all
+ self._unlockTableIfNeeded(fullTableName)
raise
# Now read it back and verify, we might encounter an error if table is dropped
- if Config.getConfig().verify_data: # only if command line asks for it
+ if Config.getConfig().verify_data: # only if command line asks for it
try:
readBack = dbc.queryScalar("SELECT speed from {}.{} WHERE ts='{}'".
- format(db.getName(), regTableName, nextTick))
- if readBack != intWrote :
+ format(db.getName(), regTableName, nextTick))
+ if readBack != intWrote:
raise taos.error.ProgrammingError(
"Failed to read back same data, wrote: {}, read: {}"
.format(intWrote, readBack), 0x999)
except taos.error.ProgrammingError as err:
errno = Helper.convertErrno(err.errno)
- if errno == CrashGenError.INVALID_EMPTY_RESULT: # empty result
+ if errno == CrashGenError.INVALID_EMPTY_RESULT: # empty result
raise taos.error.ProgrammingError(
"Failed to read back same data for tick: {}, wrote: {}, read: EMPTY"
.format(nextTick, intWrote),
errno)
- elif errno == CrashGenError.INVALID_MULTIPLE_RESULT : # multiple results
+ elif errno == CrashGenError.INVALID_MULTIPLE_RESULT: # multiple results
raise taos.error.ProgrammingError(
"Failed to read back same data for tick: {}, wrote: {}, read: MULTIPLE RESULTS"
.format(nextTick, intWrote),
errno)
- elif errno in [0x218, 0x362]: # table doesn't exist
+ elif errno in [0x218, 0x362]: # table doesn't exist
# do nothing
pass
else:
# Re-throw otherwise
raise
finally:
- self._unlockTableIfNeeded(fullTableName) # Quite ugly, refactor lock/unlock
+ self._unlockTableIfNeeded(fullTableName) # Quite ugly, refactor lock/unlock
# Done with read-back verification, unlock the table now
else:
- self._unlockTableIfNeeded(fullTableName)
+ self._unlockTableIfNeeded(fullTableName)
- # Successfully wrote the data into the DB, let's record it somehow
+ # Successfully wrote the data into the DB, let's record it somehow
te.recordDataMark(intWrote)
if Config.getConfig().record_ops:
@@ -2666,17 +2679,17 @@ class TaskAddData(StateTransitionTask):
# ds = self._dbManager # Quite DANGEROUS here, may result in multi-thread client access
db = self._db
dbc = wt.getDbConn()
- numTables = self.LARGE_NUMBER_OF_TABLES if Config.getConfig().larger_data else self.SMALL_NUMBER_OF_TABLES
+ numTables = self.LARGE_NUMBER_OF_TABLES if Config.getConfig().larger_data else self.SMALL_NUMBER_OF_TABLES
numRecords = self.LARGE_NUMBER_OF_RECORDS if Config.getConfig().larger_data else self.SMALL_NUMBER_OF_RECORDS
- tblSeq = list(range(numTables ))
- random.shuffle(tblSeq) # now we have random sequence
+ tblSeq = list(range(numTables))
+ random.shuffle(tblSeq) # now we have random sequence
for i in tblSeq:
if (i in self.activeTable): # wow already active
# print("x", end="", flush=True) # concurrent insertion
Progress.emit(Progress.CONCURRENT_INSERTION)
else:
self.activeTable.add(i) # marking it active
-
+
dbName = db.getName()
sTable = db.getFixedSuperTable()
regTableName = self.getRegTableName(i) # "db.reg_table_{}".format(i)
@@ -2684,21 +2697,22 @@ class TaskAddData(StateTransitionTask):
# self._lockTable(fullTableName) # "create table" below. Stop it if the table is "locked"
sTable.ensureRegTable(self, wt.getDbConn(), regTableName) # Ensure the table exists
# self._unlockTable(fullTableName)
-
- if Dice.throw(1) == 0: # 1 in 2 chance
+
+ if Dice.throw(1) == 0: # 1 in 2 chance
self._addData(db, dbc, regTableName, te)
else:
self._addDataInBatch(db, dbc, regTableName, te)
self.activeTable.discard(i) # not raising an error, unlike remove
+
class TaskDeleteData(StateTransitionTask):
# Track which table is being actively worked on
activeTable: Set[int] = set()
# We use these two files to record operations to DB, useful for power-off tests
- fAddLogReady = None # type: Optional[io.TextIOWrapper]
- fAddLogDone = None # type: Optional[io.TextIOWrapper]
+ fAddLogReady = None # type: Optional[io.TextIOWrapper]
+ fAddLogDone = None # type: Optional[io.TextIOWrapper]
@classmethod
def prepToRecordOps(cls):
@@ -2719,12 +2733,12 @@ class TaskDeleteData(StateTransitionTask):
def canBeginFrom(cls, state: AnyState):
return state.canDeleteData()
- def _lockTableIfNeeded(self, fullTableName, extraMsg = ''):
+ def _lockTableIfNeeded(self, fullTableName, extraMsg=''):
if Config.getConfig().verify_data:
# Logging.info("Locking table: {}".format(fullTableName))
- self.lockTable(fullTableName)
+ self.lockTable(fullTableName)
# Logging.info("Table locked {}: {}".format(extraMsg, fullTableName))
- # print("_w" + str(nextInt % 100), end="", flush=True) # Trace what was written
+ # print("_w" + str(nextInt % 100), end="", flush=True) # Trace what was written
else:
# Logging.info("Skipping locking table")
pass
@@ -2732,15 +2746,15 @@ class TaskDeleteData(StateTransitionTask):
def _unlockTableIfNeeded(self, fullTableName):
if Config.getConfig().verify_data:
# Logging.info("Unlocking table: {}".format(fullTableName))
- self.unlockTable(fullTableName)
+ self.unlockTable(fullTableName)
# Logging.info("Table unlocked: {}".format(fullTableName))
else:
pass
# Logging.info("Skipping unlocking table")
- def _deleteData(self, db: Database, dbc, regTableName, te: TaskExecutor): # implied: NOT in batches
- numRecords = self.LARGE_NUMBER_OF_RECORDS if Config.getConfig().larger_data else self.SMALL_NUMBER_OF_RECORDS
- del_Records = int(numRecords/5)
+ def _deleteData(self, db: Database, dbc, regTableName, te: TaskExecutor): # implied: NOT in batches
+ numRecords = self.LARGE_NUMBER_OF_RECORDS if Config.getConfig().larger_data else self.SMALL_NUMBER_OF_RECORDS
+ del_Records = int(numRecords / 5)
if Dice.throw(2) == 0:
for j in range(del_Records): # number of records per table
intToWrite = db.getNextInt()
@@ -2753,13 +2767,14 @@ class TaskDeleteData(StateTransitionTask):
self.fAddLogReady.write("Ready to delete {} to {}\n".format(intToWrite, regTableName))
self.fAddLogReady.flush()
os.fsync(self.fAddLogReady.fileno())
-
+
# TODO: too ugly trying to lock the table reliably, refactor...
fullTableName = db.getName() + '.' + regTableName
- self._lockTableIfNeeded(fullTableName) # so that we are verify read-back. TODO: deal with exceptions before unlock
-
+ self._lockTableIfNeeded(
+ fullTableName) # so that we are verify read-back. TODO: deal with exceptions before unlock
+
try:
- sql = "delete from {} where ts = '{}' ;".format( # removed: tags ('{}', {})
+ sql = "delete from {} where ts = '{}' ;".format( # removed: tags ('{}', {})
fullTableName,
# ds.getFixedSuperTableName(),
# ds.getNextBinary(), ds.getNextFloat(),
@@ -2772,45 +2787,46 @@ class TaskDeleteData(StateTransitionTask):
intWrote = intToWrite
# Quick hack, attach an update statement here. TODO: create an "update" task
- if (not Config.getConfig().use_shadow_db) and Dice.throw(5) == 0: # 1 in N chance, plus not using shaddow DB
- intToUpdate = db.getNextInt() # Updated, but should not succeed
+ if (not Config.getConfig().use_shadow_db) and Dice.throw(
+ 5) == 0: # 1 in N chance, plus not using shaddow DB
+ intToUpdate = db.getNextInt() # Updated, but should not succeed
# nextColor = db.getNextColor()
- sql = "delete from {} where ts = '{}' ;".format( # "INSERt" means "update" here
- fullTableName,
- nextTick)
+ sql = "delete from {} where ts = '{}' ;".format( # "INSERt" means "update" here
+ fullTableName,
+ nextTick)
# sql = "UPDATE {} set speed={}, color='{}' WHERE ts='{}'".format(
# fullTableName, db.getNextInt(), db.getNextColor(), nextTick)
dbc.execute(sql)
- intWrote = intToUpdate # We updated, seems TDengine non-cluster accepts this.
+ intWrote = intToUpdate # We updated, seems TDengine non-cluster accepts this.
- except: # Any exception at all
- self._unlockTableIfNeeded(fullTableName)
+ except: # Any exception at all
+ self._unlockTableIfNeeded(fullTableName)
raise
# Now read it back and verify, we might encounter an error if table is dropped
- if Config.getConfig().verify_data: # only if command line asks for it
+ if Config.getConfig().verify_data: # only if command line asks for it
try:
dbc.query("SELECT * from {}.{} WHERE ts='{}'".
- format(db.getName(), regTableName, nextTick))
+ format(db.getName(), regTableName, nextTick))
result = dbc.getQueryResult()
- if len(result)==0:
+ if len(result) == 0:
# means data has been delete
- print("D1",end="") # DF means delete failed
+ print("D1", end="") # DF means delete failed
else:
- print("DF",end="") # DF means delete failed
+ print("DF", end="") # DF means delete failed
except taos.error.ProgrammingError as err:
errno = Helper.convertErrno(err.errno)
# if errno == CrashGenError.INVALID_EMPTY_RESULT: # empty result
# print("D1",end="") # D1 means delete data success and only 1 record
- if errno in [0x218, 0x362,0x2662]: # table doesn't exist
+ if errno in [0x218, 0x362, 0x2662]: # table doesn't exist
# do nothing
pass
else:
# Re-throw otherwise
raise
finally:
- self._unlockTableIfNeeded(fullTableName) # Quite ugly, refactor lock/unlock
+ self._unlockTableIfNeeded(fullTableName) # Quite ugly, refactor lock/unlock
# Done with read-back verification, unlock the table now
# Successfully wrote the data into the DB, let's record it somehow
te.recordDataMark(intWrote)
@@ -2824,52 +2840,54 @@ class TaskDeleteData(StateTransitionTask):
self.fAddLogReady.write("Ready to delete {} to {}\n".format(intToWrite, regTableName))
self.fAddLogReady.flush()
os.fsync(self.fAddLogReady.fileno())
-
+
# TODO: too ugly trying to lock the table reliably, refactor...
fullTableName = db.getName() + '.' + regTableName
- self._lockTableIfNeeded(fullTableName) # so that we are verify read-back. TODO: deal with exceptions before unlock
-
+ self._lockTableIfNeeded(
+ fullTableName) # so that we are verify read-back. TODO: deal with exceptions before unlock
+
try:
- sql = "delete from {} ;".format( # removed: tags ('{}', {})
+ sql = "delete from {} ;".format( # removed: tags ('{}', {})
fullTableName)
# Logging.info("Adding data: {}".format(sql))
dbc.execute(sql)
# Logging.info("Data added: {}".format(sql))
-
+
# Quick hack, attach an update statement here. TODO: create an "update" task
- if (not Config.getConfig().use_shadow_db) and Dice.throw(5) == 0: # 1 in N chance, plus not using shaddow DB
- sql = "delete from {} ;".format( # "INSERt" means "update" here
- fullTableName)
+ if (not Config.getConfig().use_shadow_db) and Dice.throw(
+ 5) == 0: # 1 in N chance, plus not using shaddow DB
+ sql = "delete from {} ;".format( # "INSERt" means "update" here
+ fullTableName)
dbc.execute(sql)
- except: # Any exception at all
- self._unlockTableIfNeeded(fullTableName)
+ except: # Any exception at all
+ self._unlockTableIfNeeded(fullTableName)
raise
# Now read it back and verify, we might encounter an error if table is dropped
- if Config.getConfig().verify_data: # only if command line asks for it
+ if Config.getConfig().verify_data: # only if command line asks for it
try:
dbc.query("SELECT * from {}.{} WHERE ts='{}'".
- format(db.getName(), regTableName, nextTick))
+ format(db.getName(), regTableName, nextTick))
result = dbc.getQueryResult()
- if len(result)==0:
+ if len(result) == 0:
# means data has been delete
- print("DA",end="")
+ print("DA", end="")
else:
- print("DF",end="") # DF means delete failed
+ print("DF", end="") # DF means delete failed
except taos.error.ProgrammingError as err:
errno = Helper.convertErrno(err.errno)
# if errno == CrashGenError.INVALID_EMPTY_RESULT: # empty result
# print("Da",end="") # Da means delete data success and for all datas
- if errno in [0x218, 0x362,0x2662]: # table doesn't exist
+ if errno in [0x218, 0x362, 0x2662]: # table doesn't exist
# do nothing
pass
else:
# Re-throw otherwise
raise
finally:
- self._unlockTableIfNeeded(fullTableName) # Quite ugly, refactor lock/unlock
+ self._unlockTableIfNeeded(fullTableName) # Quite ugly, refactor lock/unlock
# Done with read-back verification, unlock the table now
if Config.getConfig().record_ops:
@@ -2883,17 +2901,17 @@ class TaskDeleteData(StateTransitionTask):
# ds = self._dbManager # Quite DANGEROUS here, may result in multi-thread client access
db = self._db
dbc = wt.getDbConn()
- numTables = self.LARGE_NUMBER_OF_TABLES if Config.getConfig().larger_data else self.SMALL_NUMBER_OF_TABLES
+ numTables = self.LARGE_NUMBER_OF_TABLES if Config.getConfig().larger_data else self.SMALL_NUMBER_OF_TABLES
numRecords = self.LARGE_NUMBER_OF_RECORDS if Config.getConfig().larger_data else self.SMALL_NUMBER_OF_RECORDS
- tblSeq = list(range(numTables ))
- random.shuffle(tblSeq) # now we have random sequence
+ tblSeq = list(range(numTables))
+ random.shuffle(tblSeq) # now we have random sequence
for i in tblSeq:
if (i in self.activeTable): # wow already active
# print("x", end="", flush=True) # concurrent insertion
Progress.emit(Progress.CONCURRENT_INSERTION)
else:
self.activeTable.add(i) # marking it active
-
+
dbName = db.getName()
sTable = db.getFixedSuperTable()
regTableName = self.getRegTableName(i) # "db.reg_table_{}".format(i)
@@ -2901,54 +2919,57 @@ class TaskDeleteData(StateTransitionTask):
# self._lockTable(fullTableName) # "create table" below. Stop it if the table is "locked"
sTable.ensureRegTable(self, wt.getDbConn(), regTableName) # Ensure the table exists
# self._unlockTable(fullTableName)
-
+
self._deleteData(db, dbc, regTableName, te)
-
+
self.activeTable.discard(i) # not raising an error, unlike remove
-class ThreadStacks: # stack info for all threads
+class ThreadStacks: # stack info for all threads
def __init__(self):
self._allStacks = {}
- allFrames = sys._current_frames() # All current stack frames, keyed with "ident"
+ allFrames = sys._current_frames() # All current stack frames, keyed with "ident"
for th in threading.enumerate(): # For each thread
- stack = traceback.extract_stack(allFrames[th.ident]) #type: ignore # Get stack for a thread
- shortTid = th.native_id % 10000 #type: ignore
- self._allStacks[shortTid] = stack # Was using th.native_id
+ stack = traceback.extract_stack(allFrames[th.ident]) # type: ignore # Get stack for a thread
+ shortTid = th.native_id % 10000 # type: ignore
+ self._allStacks[shortTid] = stack # Was using th.native_id
- def record_current_time(self,current_time):
+ def record_current_time(self, current_time):
self.current_time = current_time
- def print(self, filteredEndName = None, filterInternal = False):
- for shortTid, stack in self._allStacks.items(): # for each thread, stack frames top to bottom
+ def print(self, filteredEndName=None, filterInternal=False):
+ for shortTid, stack in self._allStacks.items(): # for each thread, stack frames top to bottom
lastFrame = stack[-1]
- if filteredEndName: # we need to filter out stacks that match this name
- if lastFrame.name == filteredEndName : # end did not match
+ if filteredEndName: # we need to filter out stacks that match this name
+ if lastFrame.name == filteredEndName: # end did not match
continue
if filterInternal:
- if lastFrame.name in ['wait', 'invoke_excepthook',
- '_wait', # The Barrier exception
- 'svcOutputReader', # the svcMgr thread
- '__init__']: # the thread that extracted the stack
- continue # ignore
+ if lastFrame.name in ['wait', 'invoke_excepthook',
+ '_wait', # The Barrier exception
+ 'svcOutputReader', # the svcMgr thread
+ '__init__']: # the thread that extracted the stack
+ continue # ignore
# Now print
print("\n<----- Thread Info for LWP/ID: {} (most recent call last) <-----".format(shortTid))
-
+
lastSqlForThread = DbConn.fetchSqlForThread(shortTid)
last_sql_commit_time = DbConn.get_save_sql_time(shortTid)
# time_cost = DbConn.get_time_cost()
- print("Last SQL statement attempted from thread {} ({:.4f} sec ago) is: {}".format(shortTid, self.current_time-last_sql_commit_time ,lastSqlForThread))
+ print("Last SQL statement attempted from thread {} ({:.4f} sec ago) is: {}".format(shortTid,
+ self.current_time - last_sql_commit_time,
+ lastSqlForThread))
stackFrame = 0
- for frame in stack: # was using: reversed(stack)
+ for frame in stack: # was using: reversed(stack)
# print(frame)
print("[{sf}] File {filename}, line {lineno}, in {name}".format(
sf=stackFrame, filename=frame.filename, lineno=frame.lineno, name=frame.name))
print(" {}".format(frame.line))
stackFrame += 1
print("-----> End of Thread Info ----->\n")
- if self.current_time-last_sql_commit_time >100: # dead lock occured
+ if self.current_time - last_sql_commit_time > 100: # dead lock occured
print("maybe dead locked of thread {} ".format(shortTid))
+
class ClientManager:
def __init__(self):
Logging.info("Starting service manager")
@@ -3041,36 +3062,35 @@ class ClientManager:
# time.sleep(2.0)
# dbManager = None # release?
- def run(self, svcMgr):
+ def run(self, svcMgr):
# self._printLastNumbers()
# global gConfig
# Prepare Tde Instance
global gContainer
- tInst = gContainer.defTdeInstance = TdeInstance() # "subdir to hold the instance"
+ tInst = gContainer.defTdeInstance = TdeInstance() # "subdir to hold the instance"
cfg = Config.getConfig()
dbManager = DbManager(cfg.connector_type, tInst.getDbTarget()) # Regular function
thPool = ThreadPool(cfg.num_threads, cfg.max_steps)
self.tc = ThreadCoordinator(thPool, dbManager)
-
+
Logging.info("Starting client instance: {}".format(tInst))
self.tc.run()
# print("exec stats: {}".format(self.tc.getExecStats()))
# print("TC failed = {}".format(self.tc.isFailed()))
- if svcMgr: # gConfig.auto_start_service:
+ if svcMgr: # gConfig.auto_start_service:
svcMgr.stopTaosServices()
svcMgr = None
-
# Release global variables
# gConfig = None
Config.clearConfig()
gSvcMgr = None
logger = None
-
+
thPool = None
- dbManager.cleanUp() # destructor wouldn't run in time
+ dbManager.cleanUp() # destructor wouldn't run in time
dbManager = None
# Print exec status, etc., AFTER showing messages from the server
@@ -3082,7 +3102,7 @@ class ClientManager:
# Release variables here
self.tc = None
- gc.collect() # force garbage collection
+ gc.collect() # force garbage collection
# h = hpy()
# print("\n----- Final Python Heap -----\n")
# print(h.heap())
@@ -3093,37 +3113,38 @@ class ClientManager:
# self.tc.getDbManager().cleanUp() # clean up first, so we can show ZERO db connections
self.tc.printStats()
+
class MainExec:
- def __init__(self):
+ def __init__(self):
self._clientMgr = None
- self._svcMgr = None # type: Optional[ServiceManager]
+ self._svcMgr = None # type: Optional[ServiceManager]
signal.signal(signal.SIGTERM, self.sigIntHandler)
- signal.signal(signal.SIGINT, self.sigIntHandler)
+ signal.signal(signal.SIGINT, self.sigIntHandler)
signal.signal(signal.SIGUSR1, self.sigUsrHandler) # different handler!
def sigUsrHandler(self, signalNumber, frame):
if self._clientMgr:
self._clientMgr.sigUsrHandler(signalNumber, frame)
- elif self._svcMgr: # Only if no client mgr, we are running alone
+ elif self._svcMgr: # Only if no client mgr, we are running alone
self._svcMgr.sigUsrHandler(signalNumber, frame)
-
+
def sigIntHandler(self, signalNumber, frame):
- if self._svcMgr:
+ if self._svcMgr:
self._svcMgr.sigIntHandler(signalNumber, frame)
- if self._clientMgr:
+ if self._clientMgr:
self._clientMgr.sigIntHandler(signalNumber, frame)
def runClient(self):
global gSvcMgr
if Config.getConfig().auto_start_service:
- gSvcMgr = self._svcMgr = ServiceManager(1) # hack alert
- gSvcMgr.startTaosServices() # we start, don't run
-
+ gSvcMgr = self._svcMgr = ServiceManager(1) # hack alert
+ gSvcMgr.startTaosServices() # we start, don't run
+
self._clientMgr = ClientManager()
ret = None
- try:
- ret = self._clientMgr.run(self._svcMgr) # stop TAOS service inside
+ try:
+ ret = self._clientMgr.run(self._svcMgr) # stop TAOS service inside
except requests.exceptions.ConnectionError as err:
Logging.warning("Failed to open REST connection to DB: {}".format(err))
# don't raise
@@ -3131,10 +3152,11 @@ class MainExec:
def runService(self):
global gSvcMgr
- gSvcMgr = self._svcMgr = ServiceManager(Config.getConfig().num_dnodes) # save it in a global variable TODO: hack alert
+ gSvcMgr = self._svcMgr = ServiceManager(
+ Config.getConfig().num_dnodes) # save it in a global variable TODO: hack alert
- gSvcMgr.run() # run to some end state
- gSvcMgr = self._svcMgr = None
+ gSvcMgr.run() # run to some end state
+ gSvcMgr = self._svcMgr = None
def _buildCmdLineParser(self):
parser = argparse.ArgumentParser(
@@ -3145,7 +3167,7 @@ class MainExec:
1. You build TDengine in the top level ./build directory, as described in offical docs
2. You run the server there before this script: ./build/bin/taosd -c test/cfg
- '''))
+ '''))
parser.add_argument(
'-a',
@@ -3209,7 +3231,7 @@ class MainExec:
'-n',
'--dynamic-db-table-names',
action='store_true',
- help='Use non-fixed names for dbs/tables, for -b, useful for multi-instance executions (default: false)')
+ help='Use non-fixed names for dbs/tables, for -b, useful for multi-instance executions (default: false)')
parser.add_argument(
'-o',
'--num-dnodes',
@@ -3259,19 +3281,18 @@ class MainExec:
return parser
-
- def init(self): # TODO: refactor
+ def init(self): # TODO: refactor
global gContainer
- gContainer = Container() # micky-mouse DI
+ gContainer = Container() # micky-mouse DI
- global gSvcMgr # TODO: refactor away
+ global gSvcMgr # TODO: refactor away
gSvcMgr = None
parser = self._buildCmdLineParser()
Config.init(parser)
# Sanity check for arguments
- if Config.getConfig().use_shadow_db and Config.getConfig().max_dbs>1 :
+ if Config.getConfig().use_shadow_db and Config.getConfig().max_dbs > 1:
raise CrashGenError("Cannot combine use-shadow-db with max-dbs of more than 1")
Logging.clsInit(Config.getConfig().debug)
@@ -3282,10 +3303,10 @@ class MainExec:
if Config.getConfig().run_tdengine: # run server
try:
self.runService()
- return 0 # success
+ return 0 # success
except ConnectionError as err:
Logging.error("Failed to make DB connection, please check DB instance manually")
- return -1 # failure
+ return -1 # failure
else:
return self.runClient()
@@ -3294,7 +3315,7 @@ class Container():
_propertyList = {'defTdeInstance'}
def __init__(self):
- self._cargo = {} # No cargo at the beginning
+ self._cargo = {} # No cargo at the beginning
def _verifyValidProperty(self, name):
if not name in self._propertyList:
@@ -3303,10 +3324,10 @@ class Container():
# Called for an attribute, when other mechanisms fail (compare to __getattribute__)
def __getattr__(self, name):
self._verifyValidProperty(name)
- return self._cargo[name] # just a simple lookup
+ return self._cargo[name] # just a simple lookup
def __setattr__(self, name, value):
- if name == '_cargo' : # reserved vars
+ if name == '_cargo': # reserved vars
super().__setattr__(name, value)
return
self._verifyValidProperty(name)
diff --git a/tests/pytest/util/dnodes.py b/tests/pytest/util/dnodes.py
index 6c71c5cea7a3ea67e21a520933d66b3508607b45..a1682f47b3e229e24a9b7bdd750b8cbe4890dea5 100644
--- a/tests/pytest/util/dnodes.py
+++ b/tests/pytest/util/dnodes.py
@@ -29,6 +29,7 @@ class TDSimClient:
self.testCluster = False
self.path = path
self.cfgDict = {
+ "fqdn": "localhost",
"numOfLogLines": "100000000",
"locale": "en_US.UTF-8",
"charset": "UTF-8",
@@ -119,6 +120,7 @@ class TDDnode:
self.asan = False
self.remoteIP = ""
self.cfgDict = {
+ "fqdn": "localhost",
"monitor": "0",
"maxShellConns": "30000",
"locale": "en_US.UTF-8",
diff --git a/tests/script/sh/checkAsan.sh b/tests/script/sh/checkAsan.sh
index 72257227916785de3d174349d4c83d3302064295..5c7976a9fcdf250fd98028bebe8c632d1f490e23 100755
--- a/tests/script/sh/checkAsan.sh
+++ b/tests/script/sh/checkAsan.sh
@@ -38,8 +38,9 @@ python_error=`cat ${LOG_DIR}/*.info | grep -w "stack" | wc -l`
# /root/TDengine/source/libs/function/src/builtinsimpl.c:856:29: runtime error: signed integer overflow: 9223372036854775806 + 9223372036854775805 cannot be represented in type 'long int'
# /root/TDengine/source/libs/scalar/src/sclvector.c:1075:66: runtime error: signed integer overflow: 9223372034707292160 + 1668838476672 cannot be represented in type 'long int'
# /root/TDengine/source/common/src/tdataformat.c:1876:7: runtime error: signed integer overflow: 8252423483843671206 + 2406154664059062870 cannot be represented in type 'long int'
+# /home/chr/TDengine/source/libs/scalar/src/filter.c:3149:14: runtime error: applying non-zero offset 18446744073709551615 to null pointer
-runtime_error=`cat ${LOG_DIR}/*.asan | grep "runtime error" | grep -v "trees.c:873" | grep -v "sclfunc.c.*outside the range of representable values of type"| grep -v "signed integer overflow" |grep -v "strerror.c"| grep -v "asan_malloc_linux.cc" |wc -l`
+runtime_error=`cat ${LOG_DIR}/*.asan | grep "runtime error" | grep -v "trees.c:873" | grep -v "sclfunc.c.*outside the range of representable values of type"| grep -v "signed integer overflow" |grep -v "strerror.c"| grep -v "asan_malloc_linux.cc" |grep -v "filter.c:3149:14"|wc -l`
echo -e "\033[44;32;1m"asan error_num: $error_num"\033[0m"
echo -e "\033[44;32;1m"asan memory_leak: $memory_leak"\033[0m"
diff --git a/tests/script/tsim/alter/dnode.sim b/tests/script/tsim/alter/dnode.sim
index 8cfa86a88a50c55b6ba85a199ba09237c8e06795..f9b794924b0a23367fc26cf83d77a08721d10c7b 100644
--- a/tests/script/tsim/alter/dnode.sim
+++ b/tests/script/tsim/alter/dnode.sim
@@ -58,6 +58,8 @@ sql_error alter dnode 1 'monDebugFlag 131'
sql_error alter dnode 1 'cqDebugFlag 131'
sql_error alter dnode 1 'httpDebugFlag 131'
sql_error alter dnode 1 'mqttDebugFlag 131'
+sql_error alter dnode 1 'qDebugFlaga 131'
+sql_error alter all dnodes 'qDebugFlaga 131'
sql_error alter dnode 2 'wDebugFlag' '135'
sql_error alter dnode 2 'tmrDebugFlag' '135'
@@ -65,6 +67,8 @@ sql_error alter dnode 1 'monDebugFlag' '131'
sql_error alter dnode 1 'cqDebugFlag' '131'
sql_error alter dnode 1 'httpDebugFlag' '131'
sql_error alter dnode 1 'mqttDebugFlag' '131'
+sql_error alter dnode 1 'qDebugFlaga' '131'
+sql_error alter all dnodes 'qDebugFlaga' '131'
print ======== step3
sql_error alter $hostname1 debugFlag 135
diff --git a/tests/script/tsim/compute/block_dist.sim b/tests/script/tsim/compute/block_dist.sim
index 2d0a4e890267af3520e8c99f21a4d87c5bc1ceef..772959644eb271e1119984d502ba336b8af2754b 100644
--- a/tests/script/tsim/compute/block_dist.sim
+++ b/tests/script/tsim/compute/block_dist.sim
@@ -81,7 +81,6 @@ $nt = $ntPrefix . $i
#sql select _block_dist() from $nt
print show table distributed $nt
-sql_error show table distributed $nt
#if $rows == 0 then
# return -1
@@ -91,6 +90,10 @@ print ============== TD-5998
sql_error select _block_dist() from (select * from $nt)
sql_error select _block_dist() from (select * from $mt)
+print ============== TD-22140 & TD-22165
+sql_error show table distributed information_schema.ins_databases
+sql_error show table distributed performance_schema.perf_apps
+
print =============== clear
sql drop database $db
sql select * from information_schema.ins_databases
diff --git a/tests/script/tsim/parser/nestquery.sim b/tests/script/tsim/parser/nestquery.sim
index 494c3de99f473f1b72eab3e465e1d506d5470152..2a363de43df0f774cbbd6b163c3bfd550f10ea1d 100644
--- a/tests/script/tsim/parser/nestquery.sim
+++ b/tests/script/tsim/parser/nestquery.sim
@@ -351,7 +351,7 @@ sql_error select last_row(*) from (select * from nest_tb0) having c1 > 0
print ===========>td-4805
sql_error select tbname, i from (select * from nest_tb0) group by i;
-sql select count(*),c1 from (select * from nest_tb0) where c1 < 2 group by c1;
+sql select count(*),c1 from (select * from nest_tb0) where c1 < 2 group by c1 order by c1;
if $rows != 2 then
return -1
endi
diff --git a/tests/script/tsim/parser/regressiontest.sim b/tests/script/tsim/parser/regressiontest.sim
index 3ce2b47b443a0d80decfef268cdbe3d08bab6f3f..fe388a611e257f34ce00c13784d3dc28c6880690 100644
--- a/tests/script/tsim/parser/regressiontest.sim
+++ b/tests/script/tsim/parser/regressiontest.sim
@@ -15,7 +15,7 @@ $db = $dbPrefix . $i
sql drop database if exists $db -x step1
step1:
-sql create database $db vgroups 1;
+sql create database $db vgroups 1 cachemodel 'last_row'
sql use $db
sql create table $tb (ts timestamp, c1 int)
@@ -31,13 +31,8 @@ sql insert into $tb values ( $ts , $x )
$x = $x + 1
endw
-print ================== restart server to commit data into disk
-system sh/exec.sh -n dnode1 -s stop -x SIGINT
-system sh/exec.sh -n dnode1 -s start
-print ================== server restart completed
-sql connect
+sql flush database $db
-sql use $db
sql delete from $tb where ts=1537146000000
sql delete from $tb where ts=1537146409500
@@ -63,7 +58,6 @@ if $rows != 8198 then
return -1
endi
-print ===========================> TD-22077 && TD-21877
sql drop database if exists $db -x step1
sql create database $db vgroups 1;
@@ -88,6 +82,8 @@ endw
sql flush database $db
+print ===========================> TD-22077 && TD-21877
+
sql insert into t1 values('2018-09-17 09:00:26', 26);
sql insert into t2 values('2018-09-17 09:00:25', 25);
@@ -97,4 +93,105 @@ sql flush database reg_db0;
sql delete from st1 where ts<='2018-9-17 09:00:26';
sql select * from st1;
+sql drop table t1
+sql drop table t2
+
+print =========================================>TD-22196
+sql create table t1 using st1 tags(1);
+
+$i = 0
+$ts = 1674977959000
+$rowNum = 200
+
+$x = 0
+while $x < $rowNum
+$xs = $x * $delta
+$ts = $ts0 + $xs
+sql insert into t1 values ( $ts , $x )
+$x = $x + 1
+$ts = $ts + 1000
+endw
+
+sql flush database $db
+sql select min(c),max(c) from t1
+if $data00 != 0 then
+ return -1
+endi
+
+if $data01 != 199 then
+ return -1
+endi
+
+sql drop table t1
+
+$rowNum = 8200
+$ts0 = 1537146000000
+sql create table t1 (ts timestamp, c1 int)
+
+$i = 0
+$ts = $ts0
+
+$x = 0
+while $x < $rowNum
+$xs = $x * $delta
+$ts = $ts0 + $xs
+sql insert into t1 values ( $ts , $x )
+$x = $x + 1
+endw
+
+sql delete from t1 where ts<=1537146409500
+
+sql flush database $db
+
+print ======================================>TS-2639
+sql show table distributed t1;
+
+print =====================================>TD-22007
+sql select count(*) from t1 interval(10a)
+sql drop table t1
+
+sql create table st1 (ts timestamp, k int) tags(a int);
+sql insert into t1 using st1 tags(1) values('2020-1-1 10:10:10', 0);
+sql insert into t2 using st1 tags(1) values('2020-1-1 10:10:11', 1);
+sql insert into t3 using st1 tags(1) values('2020-1-1 10:10:12', 2);
+sql insert into t4 using st1 tags(1) values('2020-1-1 10:10:13', 3);
+sql insert into t5 using st1 tags(1) values('2020-1-1 10:10:14', 4);
+sql insert into t6 using st1 tags(2) values('2020-1-1 10:10:15', 5);
+sql insert into t7 using st1 tags(2) values('2020-1-1 10:10:16', 6);
+sql insert into t8 using st1 tags(2) values('2020-1-1 10:10:17', 7);
+sql insert into t9 using st1 tags(2) values('2020-1-1 10:10:18', 8);
+sql insert into t10 using st1 tags(2) values('2020-1-1 10:10:19', 9);
+
+sql select count(*) from st1
+if $data00 != 10 then
+ return -1
+endi
+
+sql select last_row(*) from st1 group by a order by a desc
+if $rows != 2 then
+ return -1
+endi
+
+if $data00 != @20-01-01 10:10:19.000@ then
+ return -1
+endi
+
+if $data01 != 9 then
+ return -1
+endi
+
+if $data10 != @20-01-01 10:10:14.000@ then
+ return -1
+endi
+
+if $data11 != 4 then
+ return -1
+endi
+
+print ===============================================> TS-2613
+sql select * from information_schema.ins_databases limit 1 offset 1;
+if $rows != 1 then
+ return -1
+endi
+
system sh/exec.sh -n dnode1 -s stop -x SIGINT
diff --git a/tests/script/tsim/query/forceFill.sim b/tests/script/tsim/query/forceFill.sim
new file mode 100644
index 0000000000000000000000000000000000000000..37eb85baaa550a05180174cf73c2fa86d6e1c1f2
--- /dev/null
+++ b/tests/script/tsim/query/forceFill.sim
@@ -0,0 +1,367 @@
+system sh/stop_dnodes.sh
+system sh/deploy.sh -n dnode1 -i 1
+system sh/exec.sh -n dnode1 -s start
+sql connect
+
+sql drop database if exists db1;
+sql create database db1 vgroups 10;
+sql use db1;
+sql create stable sta (ts timestamp, f1 double, f2 binary(200)) tags(t1 int);
+sql create table tba1 using sta tags(1);
+sql insert into tba1 values ('2022-04-26 15:15:01', 1.0, "a");
+sql insert into tba1 values ('2022-04-26 15:15:02', 2.0, "b");
+sql insert into tba1 values ('2022-04-26 15:15:04', 4.0, "b");
+sql insert into tba1 values ('2022-04-26 15:15:05', 5.0, "b");
+
+sql select avg(f1) from tba1 where ts >= '2022-04-26 15:15:00' and ts <= '2022-04-26 15:15:06' interval(1s) fill(value_f, 8.8);
+if $rows != 7 then
+ return -1
+endi
+if $data00 != 8.800000000 then
+ return -1
+endi
+if $data10 != 1.000000000 then
+ return -1
+endi
+if $data20 != 2.000000000 then
+ return -1
+endi
+if $data30 != 8.800000000 then
+ return -1
+endi
+if $data40 != 4.000000000 then
+ return -1
+endi
+if $data50 != 5.000000000 then
+ return -1
+endi
+if $data60 != 8.800000000 then
+ return -1
+endi
+sql select avg(f1) from tba1 where ts >= '2022-04-26 15:15:00' and ts <= '2022-04-26 15:15:06' interval(1s) fill(value, 8.8);
+if $rows != 7 then
+ return -1
+endi
+if $data00 != 8.800000000 then
+ return -1
+endi
+if $data10 != 1.000000000 then
+ return -1
+endi
+if $data20 != 2.000000000 then
+ return -1
+endi
+if $data30 != 8.800000000 then
+ return -1
+endi
+if $data40 != 4.000000000 then
+ return -1
+endi
+if $data50 != 5.000000000 then
+ return -1
+endi
+if $data60 != 8.800000000 then
+ return -1
+endi
+sql select avg(f1) from tba1 where ts >= '2022-04-26 15:15:00' and ts <= '2022-04-26 15:15:06' interval(1s) fill(null);
+if $rows != 7 then
+ return -1
+endi
+if $data00 != NULL then
+ return -1
+endi
+if $data10 != 1.000000000 then
+ return -1
+endi
+if $data20 != 2.000000000 then
+ return -1
+endi
+if $data30 != NULL then
+ return -1
+endi
+if $data40 != 4.000000000 then
+ return -1
+endi
+if $data50 != 5.000000000 then
+ return -1
+endi
+if $data60 != NULL then
+ return -1
+endi
+sql select avg(f1) from tba1 where ts >= '2022-04-26 15:15:00' and ts <= '2022-04-26 15:15:06' interval(1s) fill(null_f);
+if $rows != 7 then
+ return -1
+endi
+if $data00 != NULL then
+ return -1
+endi
+if $data10 != 1.000000000 then
+ return -1
+endi
+if $data20 != 2.000000000 then
+ return -1
+endi
+if $data30 != NULL then
+ return -1
+endi
+if $data40 != 4.000000000 then
+ return -1
+endi
+if $data50 != 5.000000000 then
+ return -1
+endi
+if $data60 != NULL then
+ return -1
+endi
+sql select avg(f1) from tba1 where ts >= '2022-04-26 15:15:06' and ts <= '2022-04-26 15:15:10' interval(1s) fill(value, 8.8);
+if $rows != 0 then
+ return -1
+endi
+sql select avg(f1) from tba1 where ts >= '2022-04-26 15:15:06' and ts <= '2022-04-26 15:15:10' interval(1s) fill(value_f, 8.8);
+if $rows != 5 then
+ return -1
+endi
+if $data00 != 8.800000000 then
+ return -1
+endi
+if $data10 != 8.800000000 then
+ return -1
+endi
+if $data20 != 8.800000000 then
+ return -1
+endi
+if $data30 != 8.800000000 then
+ return -1
+endi
+if $data40 != 8.800000000 then
+ return -1
+endi
+sql select avg(f1) from tba1 where ts >= '2022-04-26 15:15:06' and ts <= '2022-04-26 15:15:10' interval(1s) fill(null);
+if $rows != 0 then
+ return -1
+endi
+sql select avg(f1) from tba1 where ts >= '2022-04-26 15:15:06' and ts <= '2022-04-26 15:15:10' interval(1s) fill(null_f);
+if $rows != 5 then
+ return -1
+endi
+if $data00 != NULL then
+ return -1
+endi
+if $data10 != NULL then
+ return -1
+endi
+if $data20 != NULL then
+ return -1
+endi
+if $data30 != NULL then
+ return -1
+endi
+if $data40 != NULL then
+ return -1
+endi
+sql select avg(f1) from tba1 where ts >= '2022-04-26 15:16:00' and ts <= '2022-04-26 19:15:59' interval(1s) fill(value_f, 8.8);
+if $rows != 14400 then
+ return -1
+endi
+if $data00 != 8.800000000 then
+ return -1
+endi
+sql select avg(f1) from tba1 where ts >= '2022-04-26 15:16:00' and ts <= '2022-04-26 19:15:59' interval(1s) fill(null_f);
+if $rows != 14400 then
+ return -1
+endi
+if $data00 != NULL then
+ return -1
+endi
+sql select interp(f1) from tba1 range('2022-04-26 15:15:00','2022-04-26 15:15:06') every(1s) fill(value_f, 8.8);
+if $rows != 7 then
+ return -1
+endi
+if $data00 != 8.800000000 then
+ return -1
+endi
+if $data10 != 1.000000000 then
+ return -1
+endi
+if $data20 != 2.000000000 then
+ return -1
+endi
+if $data30 != 8.800000000 then
+ return -1
+endi
+if $data40 != 4.000000000 then
+ return -1
+endi
+if $data50 != 5.000000000 then
+ return -1
+endi
+if $data60 != 8.800000000 then
+ return -1
+endi
+sql select interp(f1) from tba1 range('2022-04-26 15:15:00','2022-04-26 15:15:06') every(1s) fill(value, 8.8);
+if $rows != 7 then
+ return -1
+endi
+if $data00 != 8.800000000 then
+ return -1
+endi
+if $data10 != 1.000000000 then
+ return -1
+endi
+if $data20 != 2.000000000 then
+ return -1
+endi
+if $data30 != 8.800000000 then
+ return -1
+endi
+if $data40 != 4.000000000 then
+ return -1
+endi
+if $data50 != 5.000000000 then
+ return -1
+endi
+if $data60 != 8.800000000 then
+ return -1
+endi
+sql select interp(f1) from tba1 range('2022-04-26 15:15:00','2022-04-26 15:15:06') every(1s) fill(null);
+if $rows != 7 then
+ return -1
+endi
+if $data00 != NULL then
+ return -1
+endi
+if $data10 != 1.000000000 then
+ return -1
+endi
+if $data20 != 2.000000000 then
+ return -1
+endi
+if $data30 != NULL then
+ return -1
+endi
+if $data40 != 4.000000000 then
+ return -1
+endi
+if $data50 != 5.000000000 then
+ return -1
+endi
+if $data60 != NULL then
+ return -1
+endi
+sql select interp(f1) from tba1 range('2022-04-26 15:15:00','2022-04-26 15:15:06') every(1s) fill(null_f);
+if $rows != 7 then
+ return -1
+endi
+if $data00 != NULL then
+ return -1
+endi
+if $data10 != 1.000000000 then
+ return -1
+endi
+if $data20 != 2.000000000 then
+ return -1
+endi
+if $data30 != NULL then
+ return -1
+endi
+if $data40 != 4.000000000 then
+ return -1
+endi
+if $data50 != 5.000000000 then
+ return -1
+endi
+if $data60 != NULL then
+ return -1
+endi
+sql select interp(f1) from tba1 range('2022-04-26 15:15:06','2022-04-26 15:15:10') every(1s) fill(value, 8.8);
+if $rows != 5 then
+ return -1
+endi
+if $data00 != 8.800000000 then
+ return -1
+endi
+if $data10 != 8.800000000 then
+ return -1
+endi
+if $data20 != 8.800000000 then
+ return -1
+endi
+if $data30 != 8.800000000 then
+ return -1
+endi
+if $data40 != 8.800000000 then
+ return -1
+endi
+sql select interp(f1) from tba1 range('2022-04-26 15:15:06','2022-04-26 15:15:10') every(1s) fill(value_f, 8.8);
+if $rows != 5 then
+ return -1
+endi
+if $data00 != 8.800000000 then
+ return -1
+endi
+if $data10 != 8.800000000 then
+ return -1
+endi
+if $data20 != 8.800000000 then
+ return -1
+endi
+if $data30 != 8.800000000 then
+ return -1
+endi
+if $data40 != 8.800000000 then
+ return -1
+endi
+sql select interp(f1) from tba1 range('2022-04-26 15:15:06','2022-04-26 15:15:10') every(1s) fill(null);
+if $rows != 5 then
+ return -1
+endi
+if $data00 != NULL then
+ return -1
+endi
+if $data10 != NULL then
+ return -1
+endi
+if $data20 != NULL then
+ return -1
+endi
+if $data30 != NULL then
+ return -1
+endi
+if $data40 != NULL then
+ return -1
+endi
+sql select interp(f1) from tba1 range('2022-04-26 15:15:06','2022-04-26 15:15:10') every(1s) fill(null_f);
+if $rows != 5 then
+ return -1
+endi
+if $data00 != NULL then
+ return -1
+endi
+if $data10 != NULL then
+ return -1
+endi
+if $data20 != NULL then
+ return -1
+endi
+if $data30 != NULL then
+ return -1
+endi
+if $data40 != NULL then
+ return -1
+endi
+sql select interp(f1) from tba1 range('2022-04-26 15:16:00','2022-04-26 19:15:59') every(1s) fill(value_f, 8.8);
+if $rows != 14400 then
+ return -1
+endi
+if $data00 != 8.800000000 then
+ return -1
+endi
+sql select interp(f1) from tba1 range('2022-04-26 15:16:00','2022-04-26 19:15:59') every(1s) fill(null_f);
+if $rows != 14400 then
+ return -1
+endi
+if $data00 != NULL then
+ return -1
+endi
+
+system sh/exec.sh -n dnode1 -s stop -x SIGINT
diff --git a/tests/script/tsim/scalar/caseWhen.sim b/tests/script/tsim/scalar/caseWhen.sim
index f6b9c3ff081a69a16851b2f9fee6cd0d5c3935c3..c10413f23c7bb3075695086e40462a43da3694ba 100644
--- a/tests/script/tsim/scalar/caseWhen.sim
+++ b/tests/script/tsim/scalar/caseWhen.sim
@@ -519,7 +519,7 @@ if $rows != 0 then
return -1
endi
-sql select sum(f1),count(f1) from tba1 partition by case when f1 then f1 when 1 then 1 end;
+sql select sum(f1) v,count(f1) from tba1 partition by case when f1 then f1 when 1 then 1 end order by v;
if $rows != 2 then
return -1
endi
diff --git a/tests/script/tsim/stream/basic3.sim b/tests/script/tsim/stream/basic3.sim
index e598919e34b60d22478de67cce5df9c0c976216d..2df33541b461b1f2fe1c772cb80550e421fe56aa 100644
--- a/tests/script/tsim/stream/basic3.sim
+++ b/tests/script/tsim/stream/basic3.sim
@@ -81,6 +81,15 @@ if $rows == 0 then
return -1
endi
+sleep 3000
+
+sql drop stream if exists streamd1;
+sql drop stream if exists streamd2;
+sql drop stream if exists streamd3;
+sql drop stream if exists streamd4;
+sql drop stream if exists streamd5;
+sql drop stream if exists streamd6;
+
sql create stream streamd10 into streamd10 as select _wstart, _wend, count(*), first(ca), last(cb) as c2 from t1 interval(10s);
sql desc streamd10;
@@ -100,15 +109,6 @@ if $rows == 0 then
return -1
endi
-sleep 3000
-
-sql drop stream if exists streamd1;
-sql drop stream if exists streamd2;
-sql drop stream if exists streamd3;
-sql drop stream if exists streamd4;
-sql drop stream if exists streamd5;
-sql drop stream if exists streamd6;
-
_OVER:
system sh/exec.sh -n dnode1 -s stop -x SIGINT
diff --git a/tests/script/tsim/stream/deleteSession.sim b/tests/script/tsim/stream/deleteSession.sim
index 541609633b023611815252cde0109cdc01094198..c3c64a597774c490a1491816e0e2175be739828d 100644
--- a/tests/script/tsim/stream/deleteSession.sim
+++ b/tests/script/tsim/stream/deleteSession.sim
@@ -524,6 +524,112 @@ if $data42 != 14 then
goto loop20
endi
+sql drop database if exists test4;
+sql drop stream if exists streams4;
+sql create database test4 vgroups 1;
+sql use test4;
+sql create stable st(ts timestamp,a int,b int,c int) tags(ta int,tb int,tc int);
+sql create table t1 using st tags(1,1,1);
+sql create table t2 using st tags(2,2,2);
+
+print create stream streams4 trigger at_once into streamt4 as select _wstart, count(*) c1 from st partition by tbname session(ts, 2s);
+sql create stream streams4 trigger at_once into streamt4 as select _wstart, count(*) c1 from st partition by tbname session(ts, 2s);
+
+sql insert into t1 values(1648791210000,1,2,3);
+sql insert into t1 values(1648791220000,2,2,3);
+sql insert into t1 values(1648791221000,2,2,3);
+sql insert into t1 values(1648791222000,2,2,3);
+sql insert into t1 values(1648791223000,2,2,3);
+sql insert into t1 values(1648791231000,2,2,3);
+
+sql insert into t2 values(1648791210000,1,2,3);
+sql insert into t2 values(1648791220000,2,2,3);
+sql insert into t2 values(1648791221000,2,2,3);
+sql insert into t2 values(1648791231000,2,2,3);
+
+$loop_count = 0
+
+loop21:
+sleep 200
+sql select * from streamt4 order by c1 desc;;
+
+$loop_count = $loop_count + 1
+if $loop_count == 10 then
+ return -1
+endi
+
+if $rows != 6 then
+ print =====rows=$rows
+ goto loop21
+endi
+
+if $data01 != 4 then
+ print =====data01=$data01
+ goto loop21
+endi
+
+if $data11 != 2 then
+ print =====data11=$data11
+ goto loop21
+endi
+
+if $data21 != 1 then
+ print =====data21=$data21
+ goto loop21
+endi
+
+if $data31 != 1 then
+ print =====data31=$data31
+ goto loop21
+endi
+
+if $data41 != 1 then
+ print =====data41=$data41
+ goto loop21
+endi
+
+if $data51 != 1 then
+ print =====data51=$data51
+ goto loop21
+endi
+
+print delete from st where ts >= 1648791220000 and ts <=1648791223000;
+sql delete from st where ts >= 1648791220000 and ts <=1648791223000;
+
+loop22:
+sleep 200
+sql select * from streamt4 order by c1 desc;;
+
+$loop_count = $loop_count + 1
+if $loop_count == 10 then
+ return -1
+endi
+
+if $rows != 4 then
+ print =====rows=$rows
+ goto loop22
+endi
+
+if $data01 != 1 then
+ print =====data01=$data01
+ goto loop22
+endi
+
+if $data11 != 1 then
+ print =====data11=$data11
+ goto loop22
+endi
+
+if $data21 != 1 then
+ print =====data21=$data21
+ goto loop22
+endi
+
+if $data31 != 1 then
+ print =====data31=$data31
+ goto loop22
+endi
+
$loop_all = $loop_all + 1
print ============loop_all=$loop_all
diff --git a/tests/script/tsim/stream/deleteState.sim b/tests/script/tsim/stream/deleteState.sim
index ecd9f55340edbc79265255848f5240f0c02fd737..45d9bc3e39e926c459fb210345ba5713a6528867 100644
--- a/tests/script/tsim/stream/deleteState.sim
+++ b/tests/script/tsim/stream/deleteState.sim
@@ -189,6 +189,112 @@ if $data12 != 4 then
goto loop6
endi
+sql drop database if exists test4;
+sql drop stream if exists streams4;
+sql create database test4 vgroups 1;
+sql use test4;
+sql create stable st(ts timestamp,a int,b int,c int) tags(ta int,tb int,tc int);
+sql create table t1 using st tags(1,1,1);
+sql create table t2 using st tags(2,2,2);
+
+print create stream streams4 trigger at_once into streamt4 as select _wstart, count(*) c1 from st partition by tbname state_window(c);
+sql create stream streams4 trigger at_once into streamt4 as select _wstart, count(*) c1 from st partition by tbname state_window(c);
+
+sql insert into t1 values(1648791210000,1,2,1);
+sql insert into t1 values(1648791220000,2,2,2);
+sql insert into t1 values(1648791221000,2,2,2);
+sql insert into t1 values(1648791222000,2,2,2);
+sql insert into t1 values(1648791223000,2,2,2);
+sql insert into t1 values(1648791231000,2,2,3);
+
+sql insert into t2 values(1648791210000,1,2,1);
+sql insert into t2 values(1648791220000,2,2,2);
+sql insert into t2 values(1648791221000,2,2,2);
+sql insert into t2 values(1648791231000,2,2,3);
+
+$loop_count = 0
+
+loop21:
+sleep 200
+sql select * from streamt4 order by c1 desc;;
+
+$loop_count = $loop_count + 1
+if $loop_count == 10 then
+ return -1
+endi
+
+if $rows != 6 then
+ print =====rows=$rows
+ goto loop21
+endi
+
+if $data01 != 4 then
+ print =====data01=$data01
+ goto loop21
+endi
+
+if $data11 != 2 then
+ print =====data11=$data11
+ goto loop21
+endi
+
+if $data21 != 1 then
+ print =====data21=$data21
+ goto loop21
+endi
+
+if $data31 != 1 then
+ print =====data31=$data31
+ goto loop21
+endi
+
+if $data41 != 1 then
+ print =====data41=$data41
+ goto loop21
+endi
+
+if $data51 != 1 then
+ print =====data51=$data51
+ goto loop21
+endi
+
+print delete from st where ts >= 1648791220000 and ts <=1648791223000;
+sql delete from st where ts >= 1648791220000 and ts <=1648791223000;
+
+loop22:
+sleep 200
+sql select * from streamt4 order by c1 desc;;
+
+$loop_count = $loop_count + 1
+if $loop_count == 10 then
+ return -1
+endi
+
+if $rows != 4 then
+ print =====rows=$rows
+ goto loop22
+endi
+
+if $data01 != 1 then
+ print =====data01=$data01
+ goto loop22
+endi
+
+if $data11 != 1 then
+ print =====data11=$data11
+ goto loop22
+endi
+
+if $data21 != 1 then
+ print =====data21=$data21
+ goto loop22
+endi
+
+if $data31 != 1 then
+ print =====data31=$data31
+ goto loop22
+endi
+
$loop_all = $loop_all + 1
print ============loop_all=$loop_all
diff --git a/tests/script/tsim/stream/drop_stream.sim b/tests/script/tsim/stream/drop_stream.sim
index 1a474bd9aeca6f7f241f108ff14a0872a2eddf86..7ff9632a3e2b95f37e4b88bda2373dcfbad9aaa4 100644
--- a/tests/script/tsim/stream/drop_stream.sim
+++ b/tests/script/tsim/stream/drop_stream.sim
@@ -55,62 +55,62 @@ sql create stream stb_asin_stream trigger at_once into output_asin_stb as select
sql create stream ctb_asin_stream trigger at_once into output_asin_ctb as select ts, asin(c1), asin(c2), c3 from scalar_ct1;
sql create stream tb_asin_stream trigger at_once into output_asin_tb as select ts, asin(c1), asin(c2), c3 from scalar_tb;
sql create stream stb_atan_stream trigger at_once into output_atan_stb as select ts, atan(c1), atan(c2), c3 from scalar_stb partition by tbname;
-sql create stream ctb_atan_stream trigger at_once into output_atan_ctb as select ts, atan(c1), atan(c2), c3 from scalar_ct1;
-sql create stream tb_atan_stream trigger at_once into output_atan_tb as select ts, atan(c1), atan(c2), c3 from scalar_tb;
-sql create stream stb_ceil_stream trigger at_once into output_ceil_stb as select ts, ceil(c1), ceil(c2), c3 from scalar_stb partition by tbname;
-sql create stream ctb_ceil_stream trigger at_once into output_ceil_ctb as select ts, ceil(c1), ceil(c2), c3 from scalar_ct1;
-sql create stream tb_ceil_stream trigger at_once into output_ceil_tb as select ts, ceil(c1), ceil(c2), c3 from scalar_tb;
-sql create stream stb_cos_stream trigger at_once into output_cos_stb as select ts, cos(c1), cos(c2), c3 from scalar_stb partition by tbname;
-sql create stream ctb_cos_stream trigger at_once into output_cos_ctb as select ts, cos(c1), cos(c2), c3 from scalar_ct1;
-sql create stream tb_cos_stream trigger at_once into output_cos_tb as select ts, cos(c1), cos(c2), c3 from scalar_tb;
-sql create stream stb_floor_stream trigger at_once into output_floor_stb as select ts, floor(c1), floor(c2), c3 from scalar_stb partition by tbname;
-sql create stream ctb_floor_stream trigger at_once into output_floor_ctb as select ts, floor(c1), floor(c2), c3 from scalar_ct1;
-sql create stream tb_floor_stream trigger at_once into output_floor_tb as select ts, floor(c1), floor(c2), c3 from scalar_tb;
-sql create stream stb_log_stream trigger at_once into output_log_stb as select ts, log(c1, 2), log(c2, 2), c3 from scalar_stb partition by tbname;
-sql create stream ctb_log_stream trigger at_once into output_log_ctb as select ts, log(c1, 2), log(c2, 2), c3 from scalar_ct1;
-sql create stream tb_log_stream trigger at_once into output_log_tb as select ts, log(c1, 2), log(c2, 2), c3 from scalar_tb;
-sql create stream stb_pow_stream trigger at_once into output_pow_stb as select ts, pow(c1, 2), pow(c2, 2), c3 from scalar_stb partition by tbname;
-sql create stream ctb_pow_stream trigger at_once into output_pow_ctb as select ts, pow(c1, 2), pow(c2, 2), c3 from scalar_ct1;
-sql create stream tb_pow_stream trigger at_once into output_pow_tb as select ts, pow(c1, 2), pow(c2, 2), c3 from scalar_tb;
-sql create stream stb_round_stream trigger at_once into output_round_stb as select ts, round(c1), round(c2), c3 from scalar_stb partition by tbname;
-sql create stream ctb_round_stream trigger at_once into output_round_ctb as select ts, round(c1), round(c2), c3 from scalar_ct1;
-sql create stream tb_round_stream trigger at_once into output_round_tb as select ts, round(c1), round(c2), c3 from scalar_tb;
-sql create stream stb_sin_stream trigger at_once into output_sin_stb as select ts, sin(c1), sin(c2), c3 from scalar_stb partition by tbname;
-sql create stream ctb_sin_stream trigger at_once into output_sin_ctb as select ts, sin(c1), sin(c2), c3 from scalar_ct1;
-sql create stream tb_sin_stream trigger at_once into output_sin_tb as select ts, sin(c1), sin(c2), c3 from scalar_tb;
-sql create stream stb_sqrt_stream trigger at_once into output_sqrt_stb as select ts, sqrt(c1), sqrt(c2), c3 from scalar_stb partition by tbname;
-sql create stream ctb_sqrt_stream trigger at_once into output_sqrt_ctb as select ts, sqrt(c1), sqrt(c2), c3 from scalar_ct1;
-sql create stream tb_sqrt_stream trigger at_once into output_sqrt_tb as select ts, sqrt(c1), sqrt(c2), c3 from scalar_tb;
-sql create stream stb_tan_stream trigger at_once into output_tan_stb as select ts, tan(c1), tan(c2), c3 from scalar_stb partition by tbname;
-sql create stream ctb_tan_stream trigger at_once into output_tan_ctb as select ts, tan(c1), tan(c2), c3 from scalar_ct1;
-sql create stream tb_tan_stream trigger at_once into output_tan_tb as select ts, tan(c1), tan(c2), c3 from scalar_tb;
-sql create stream stb_char_length_stream into output_char_length_stb as select ts, char_length(c3), char_length(c4), char_length(c5) from scalar_stb partition by tbname;
-sql create stream ctb_char_length_stream into output_char_length_ctb as select ts, char_length(c3), char_length(c4), char_length(c5) from scalar_ct1;
-sql create stream tb_char_length_stream into output_char_length_tb as select ts, char_length(c3), char_length(c4), char_length(c5) from scalar_tb;
-sql create stream stb_concat_stream into output_concat_stb as select ts, concat(c3, c4), concat(c3, c5), concat(c4, c5), concat(c3, c4, c5) from scalar_stb partition by tbname;
-sql create stream ctb_concat_stream into output_concat_ctb as select ts, concat(c3, c4), concat(c3, c5), concat(c4, c5), concat(c3, c4, c5) from scalar_ct1;
-sql create stream tb_concat_stream into output_concat_tb as select ts, concat(c3, c4), concat(c3, c5), concat(c4, c5), concat(c3, c4, c5) from scalar_tb;
-sql create stream stb_concat_ws_stream into output_concat_ws_stb as select ts, concat_ws("aND", c3, c4), concat_ws("and", c3, c5), concat_ws("And", c4, c5), concat_ws("AND", c3, c4, c5) from scalar_stb partition by tbname;
-sql create stream ctb_concat_ws_stream into output_concat_ws_ctb as select ts, concat_ws("aND", c3, c4), concat_ws("and", c3, c5), concat_ws("And", c4, c5), concat_ws("AND", c3, c4, c5) from scalar_ct1;
-sql create stream tb_concat_ws_stream into output_concat_ws_tb as select ts, concat_ws("aND", c3, c4), concat_ws("and", c3, c5), concat_ws("And", c4, c5), concat_ws("AND", c3, c4, c5) from scalar_tb;
-sql create stream stb_length_stream into output_length_stb as select ts, length(c3), length(c4), length(c5) from scalar_stb partition by tbname;
-sql create stream ctb_length_stream into output_length_ctb as select ts, length(c3), length(c4), length(c5) from scalar_ct1;
-sql create stream tb_length_stream into output_length_tb as select ts, length(c3), length(c4), length(c5) from scalar_tb;
-sql create stream stb_lower_stream into output_lower_stb as select ts, lower(c3), lower(c4), lower(c5) from scalar_stb partition by tbname;
-sql create stream ctb_lower_stream into output_lower_ctb as select ts, lower(c3), lower(c4), lower(c5) from scalar_ct1;
-sql create stream tb_lower_stream into output_lower_tb as select ts, lower(c3), lower(c4), lower(c5) from scalar_tb;
-sql create stream stb_ltrim_stream into output_ltrim_stb as select ts, ltrim(c3), ltrim(c4), ltrim(c5) from scalar_stb partition by tbname;
-sql create stream ctb_ltrim_stream into output_ltrim_ctb as select ts, ltrim(c3), ltrim(c4), ltrim(c5) from scalar_ct1;
-sql create stream tb_ltrim_stream into output_ltrim_tb as select ts, ltrim(c3), ltrim(c4), ltrim(c5) from scalar_tb;
-sql create stream stb_rtrim_stream into output_rtrim_stb as select ts, rtrim(c3), rtrim(c4), rtrim(c5) from scalar_stb partition by tbname;
-sql create stream ctb_rtrim_stream into output_rtrim_ctb as select ts, rtrim(c3), rtrim(c4), rtrim(c5) from scalar_ct1;
-sql create stream tb_rtrim_stream into output_rtrim_tb as select ts, rtrim(c3), rtrim(c4), rtrim(c5) from scalar_tb;
-sql create stream stb_substr_stream into output_substr_stb as select ts, substr(c3, 2), substr(c3, 2, 2), substr(c4, 5, 1), substr(c5, 3, 4) from scalar_stb partition by tbname;
-sql create stream ctb_substr_stream into output_substr_ctb as select ts, substr(c3, 2), substr(c3, 2, 2), substr(c4, 5, 1), substr(c5, 3, 4) from scalar_ct1;
-sql create stream tb_substr_stream into output_substr_tb as select ts, substr(c3, 2), substr(c3, 2, 2), substr(c4, 5, 1), substr(c5, 3, 4) from scalar_tb;
-sql create stream stb_upper_stream into output_upper_stb as select ts, upper(c3), upper(c4), upper(c5) from scalar_stb partition by tbname;
-sql create stream ctb_upper_stream into output_upper_ctb as select ts, upper(c3), upper(c4), upper(c5) from scalar_ct1;
-sql create stream tb_upper_stream into output_upper_tb as select ts, upper(c3), upper(c4), upper(c5) from scalar_tb;
+# sql create stream ctb_atan_stream trigger at_once into output_atan_ctb as select ts, atan(c1), atan(c2), c3 from scalar_ct1;
+# sql create stream tb_atan_stream trigger at_once into output_atan_tb as select ts, atan(c1), atan(c2), c3 from scalar_tb;
+# sql create stream stb_ceil_stream trigger at_once into output_ceil_stb as select ts, ceil(c1), ceil(c2), c3 from scalar_stb partition by tbname;
+# sql create stream ctb_ceil_stream trigger at_once into output_ceil_ctb as select ts, ceil(c1), ceil(c2), c3 from scalar_ct1;
+# sql create stream tb_ceil_stream trigger at_once into output_ceil_tb as select ts, ceil(c1), ceil(c2), c3 from scalar_tb;
+# sql create stream stb_cos_stream trigger at_once into output_cos_stb as select ts, cos(c1), cos(c2), c3 from scalar_stb partition by tbname;
+# sql create stream ctb_cos_stream trigger at_once into output_cos_ctb as select ts, cos(c1), cos(c2), c3 from scalar_ct1;
+# sql create stream tb_cos_stream trigger at_once into output_cos_tb as select ts, cos(c1), cos(c2), c3 from scalar_tb;
+# sql create stream stb_floor_stream trigger at_once into output_floor_stb as select ts, floor(c1), floor(c2), c3 from scalar_stb partition by tbname;
+# sql create stream ctb_floor_stream trigger at_once into output_floor_ctb as select ts, floor(c1), floor(c2), c3 from scalar_ct1;
+# sql create stream tb_floor_stream trigger at_once into output_floor_tb as select ts, floor(c1), floor(c2), c3 from scalar_tb;
+# sql create stream stb_log_stream trigger at_once into output_log_stb as select ts, log(c1, 2), log(c2, 2), c3 from scalar_stb partition by tbname;
+# sql create stream ctb_log_stream trigger at_once into output_log_ctb as select ts, log(c1, 2), log(c2, 2), c3 from scalar_ct1;
+# sql create stream tb_log_stream trigger at_once into output_log_tb as select ts, log(c1, 2), log(c2, 2), c3 from scalar_tb;
+# sql create stream stb_pow_stream trigger at_once into output_pow_stb as select ts, pow(c1, 2), pow(c2, 2), c3 from scalar_stb partition by tbname;
+# sql create stream ctb_pow_stream trigger at_once into output_pow_ctb as select ts, pow(c1, 2), pow(c2, 2), c3 from scalar_ct1;
+# sql create stream tb_pow_stream trigger at_once into output_pow_tb as select ts, pow(c1, 2), pow(c2, 2), c3 from scalar_tb;
+# sql create stream stb_round_stream trigger at_once into output_round_stb as select ts, round(c1), round(c2), c3 from scalar_stb partition by tbname;
+# sql create stream ctb_round_stream trigger at_once into output_round_ctb as select ts, round(c1), round(c2), c3 from scalar_ct1;
+# sql create stream tb_round_stream trigger at_once into output_round_tb as select ts, round(c1), round(c2), c3 from scalar_tb;
+# sql create stream stb_sin_stream trigger at_once into output_sin_stb as select ts, sin(c1), sin(c2), c3 from scalar_stb partition by tbname;
+# sql create stream ctb_sin_stream trigger at_once into output_sin_ctb as select ts, sin(c1), sin(c2), c3 from scalar_ct1;
+# sql create stream tb_sin_stream trigger at_once into output_sin_tb as select ts, sin(c1), sin(c2), c3 from scalar_tb;
+# sql create stream stb_sqrt_stream trigger at_once into output_sqrt_stb as select ts, sqrt(c1), sqrt(c2), c3 from scalar_stb partition by tbname;
+# sql create stream ctb_sqrt_stream trigger at_once into output_sqrt_ctb as select ts, sqrt(c1), sqrt(c2), c3 from scalar_ct1;
+# sql create stream tb_sqrt_stream trigger at_once into output_sqrt_tb as select ts, sqrt(c1), sqrt(c2), c3 from scalar_tb;
+# sql create stream stb_tan_stream trigger at_once into output_tan_stb as select ts, tan(c1), tan(c2), c3 from scalar_stb partition by tbname;
+# sql create stream ctb_tan_stream trigger at_once into output_tan_ctb as select ts, tan(c1), tan(c2), c3 from scalar_ct1;
+# sql create stream tb_tan_stream trigger at_once into output_tan_tb as select ts, tan(c1), tan(c2), c3 from scalar_tb;
+# sql create stream stb_char_length_stream into output_char_length_stb as select ts, char_length(c3), char_length(c4), char_length(c5) from scalar_stb partition by tbname;
+# sql create stream ctb_char_length_stream into output_char_length_ctb as select ts, char_length(c3), char_length(c4), char_length(c5) from scalar_ct1;
+# sql create stream tb_char_length_stream into output_char_length_tb as select ts, char_length(c3), char_length(c4), char_length(c5) from scalar_tb;
+# sql create stream stb_concat_stream into output_concat_stb as select ts, concat(c3, c4), concat(c3, c5), concat(c4, c5), concat(c3, c4, c5) from scalar_stb partition by tbname;
+# sql create stream ctb_concat_stream into output_concat_ctb as select ts, concat(c3, c4), concat(c3, c5), concat(c4, c5), concat(c3, c4, c5) from scalar_ct1;
+# sql create stream tb_concat_stream into output_concat_tb as select ts, concat(c3, c4), concat(c3, c5), concat(c4, c5), concat(c3, c4, c5) from scalar_tb;
+# sql create stream stb_concat_ws_stream into output_concat_ws_stb as select ts, concat_ws("aND", c3, c4), concat_ws("and", c3, c5), concat_ws("And", c4, c5), concat_ws("AND", c3, c4, c5) from scalar_stb partition by tbname;
+# sql create stream ctb_concat_ws_stream into output_concat_ws_ctb as select ts, concat_ws("aND", c3, c4), concat_ws("and", c3, c5), concat_ws("And", c4, c5), concat_ws("AND", c3, c4, c5) from scalar_ct1;
+# sql create stream tb_concat_ws_stream into output_concat_ws_tb as select ts, concat_ws("aND", c3, c4), concat_ws("and", c3, c5), concat_ws("And", c4, c5), concat_ws("AND", c3, c4, c5) from scalar_tb;
+# sql create stream stb_length_stream into output_length_stb as select ts, length(c3), length(c4), length(c5) from scalar_stb partition by tbname;
+# sql create stream ctb_length_stream into output_length_ctb as select ts, length(c3), length(c4), length(c5) from scalar_ct1;
+# sql create stream tb_length_stream into output_length_tb as select ts, length(c3), length(c4), length(c5) from scalar_tb;
+# sql create stream stb_lower_stream into output_lower_stb as select ts, lower(c3), lower(c4), lower(c5) from scalar_stb partition by tbname;
+# sql create stream ctb_lower_stream into output_lower_ctb as select ts, lower(c3), lower(c4), lower(c5) from scalar_ct1;
+# sql create stream tb_lower_stream into output_lower_tb as select ts, lower(c3), lower(c4), lower(c5) from scalar_tb;
+# sql create stream stb_ltrim_stream into output_ltrim_stb as select ts, ltrim(c3), ltrim(c4), ltrim(c5) from scalar_stb partition by tbname;
+# sql create stream ctb_ltrim_stream into output_ltrim_ctb as select ts, ltrim(c3), ltrim(c4), ltrim(c5) from scalar_ct1;
+# sql create stream tb_ltrim_stream into output_ltrim_tb as select ts, ltrim(c3), ltrim(c4), ltrim(c5) from scalar_tb;
+# sql create stream stb_rtrim_stream into output_rtrim_stb as select ts, rtrim(c3), rtrim(c4), rtrim(c5) from scalar_stb partition by tbname;
+# sql create stream ctb_rtrim_stream into output_rtrim_ctb as select ts, rtrim(c3), rtrim(c4), rtrim(c5) from scalar_ct1;
+# sql create stream tb_rtrim_stream into output_rtrim_tb as select ts, rtrim(c3), rtrim(c4), rtrim(c5) from scalar_tb;
+# sql create stream stb_substr_stream into output_substr_stb as select ts, substr(c3, 2), substr(c3, 2, 2), substr(c4, 5, 1), substr(c5, 3, 4) from scalar_stb partition by tbname;
+# sql create stream ctb_substr_stream into output_substr_ctb as select ts, substr(c3, 2), substr(c3, 2, 2), substr(c4, 5, 1), substr(c5, 3, 4) from scalar_ct1;
+# sql create stream tb_substr_stream into output_substr_tb as select ts, substr(c3, 2), substr(c3, 2, 2), substr(c4, 5, 1), substr(c5, 3, 4) from scalar_tb;
+# sql create stream stb_upper_stream into output_upper_stb as select ts, upper(c3), upper(c4), upper(c5) from scalar_stb partition by tbname;
+# sql create stream ctb_upper_stream into output_upper_ctb as select ts, upper(c3), upper(c4), upper(c5) from scalar_ct1;
+# sql create stream tb_upper_stream into output_upper_tb as select ts, upper(c3), upper(c4), upper(c5) from scalar_tb;
sql insert into scalar_ct1 values (1656668180503, 100, 100.1, "beijing", "taos", "Taos");
sql insert into scalar_ct1 values (1656668180503+1s, -50, -50.1, "tianjin", "taosdata", "Taosdata");
sql insert into scalar_ct1 values (1656668180503+2s, 0, Null, "hebei", "TDengine", Null);
@@ -146,62 +146,62 @@ sql create stream stb_asin_stream trigger at_once into output_asin_stb as select
sql create stream ctb_asin_stream trigger at_once into output_asin_ctb as select ts, asin(c1), asin(c2), c3 from scalar_ct1;
sql create stream tb_asin_stream trigger at_once into output_asin_tb as select ts, asin(c1), asin(c2), c3 from scalar_tb;
sql create stream stb_atan_stream trigger at_once into output_atan_stb as select ts, atan(c1), atan(c2), c3 from scalar_stb partition by tbname;
-sql create stream ctb_atan_stream trigger at_once into output_atan_ctb as select ts, atan(c1), atan(c2), c3 from scalar_ct1;
-sql create stream tb_atan_stream trigger at_once into output_atan_tb as select ts, atan(c1), atan(c2), c3 from scalar_tb;
-sql create stream stb_ceil_stream trigger at_once into output_ceil_stb as select ts, ceil(c1), ceil(c2), c3 from scalar_stb partition by tbname;
-sql create stream ctb_ceil_stream trigger at_once into output_ceil_ctb as select ts, ceil(c1), ceil(c2), c3 from scalar_ct1;
-sql create stream tb_ceil_stream trigger at_once into output_ceil_tb as select ts, ceil(c1), ceil(c2), c3 from scalar_tb;
-sql create stream stb_cos_stream trigger at_once into output_cos_stb as select ts, cos(c1), cos(c2), c3 from scalar_stb partition by tbname;
-sql create stream ctb_cos_stream trigger at_once into output_cos_ctb as select ts, cos(c1), cos(c2), c3 from scalar_ct1;
-sql create stream tb_cos_stream trigger at_once into output_cos_tb as select ts, cos(c1), cos(c2), c3 from scalar_tb;
-sql create stream stb_floor_stream trigger at_once into output_floor_stb as select ts, floor(c1), floor(c2), c3 from scalar_stb partition by tbname;
-sql create stream ctb_floor_stream trigger at_once into output_floor_ctb as select ts, floor(c1), floor(c2), c3 from scalar_ct1;
-sql create stream tb_floor_stream trigger at_once into output_floor_tb as select ts, floor(c1), floor(c2), c3 from scalar_tb;
-sql create stream stb_log_stream trigger at_once into output_log_stb as select ts, log(c1, 2), log(c2, 2), c3 from scalar_stb partition by tbname;
-sql create stream ctb_log_stream trigger at_once into output_log_ctb as select ts, log(c1, 2), log(c2, 2), c3 from scalar_ct1;
-sql create stream tb_log_stream trigger at_once into output_log_tb as select ts, log(c1, 2), log(c2, 2), c3 from scalar_tb;
-sql create stream stb_pow_stream trigger at_once into output_pow_stb as select ts, pow(c1, 2), pow(c2, 2), c3 from scalar_stb partition by tbname;
-sql create stream ctb_pow_stream trigger at_once into output_pow_ctb as select ts, pow(c1, 2), pow(c2, 2), c3 from scalar_ct1;
-sql create stream tb_pow_stream trigger at_once into output_pow_tb as select ts, pow(c1, 2), pow(c2, 2), c3 from scalar_tb;
-sql create stream stb_round_stream trigger at_once into output_round_stb as select ts, round(c1), round(c2), c3 from scalar_stb partition by tbname;
-sql create stream ctb_round_stream trigger at_once into output_round_ctb as select ts, round(c1), round(c2), c3 from scalar_ct1;
-sql create stream tb_round_stream trigger at_once into output_round_tb as select ts, round(c1), round(c2), c3 from scalar_tb;
-sql create stream stb_sin_stream trigger at_once into output_sin_stb as select ts, sin(c1), sin(c2), c3 from scalar_stb partition by tbname;
-sql create stream ctb_sin_stream trigger at_once into output_sin_ctb as select ts, sin(c1), sin(c2), c3 from scalar_ct1;
-sql create stream tb_sin_stream trigger at_once into output_sin_tb as select ts, sin(c1), sin(c2), c3 from scalar_tb;
-sql create stream stb_sqrt_stream trigger at_once into output_sqrt_stb as select ts, sqrt(c1), sqrt(c2), c3 from scalar_stb partition by tbname;
-sql create stream ctb_sqrt_stream trigger at_once into output_sqrt_ctb as select ts, sqrt(c1), sqrt(c2), c3 from scalar_ct1;
-sql create stream tb_sqrt_stream trigger at_once into output_sqrt_tb as select ts, sqrt(c1), sqrt(c2), c3 from scalar_tb;
-sql create stream stb_tan_stream trigger at_once into output_tan_stb as select ts, tan(c1), tan(c2), c3 from scalar_stb partition by tbname;
-sql create stream ctb_tan_stream trigger at_once into output_tan_ctb as select ts, tan(c1), tan(c2), c3 from scalar_ct1;
-sql create stream tb_tan_stream trigger at_once into output_tan_tb as select ts, tan(c1), tan(c2), c3 from scalar_tb;
-sql create stream stb_char_length_stream into output_char_length_stb as select ts, char_length(c3), char_length(c4), char_length(c5) from scalar_stb partition by tbname;
-sql create stream ctb_char_length_stream into output_char_length_ctb as select ts, char_length(c3), char_length(c4), char_length(c5) from scalar_ct1;
-sql create stream tb_char_length_stream into output_char_length_tb as select ts, char_length(c3), char_length(c4), char_length(c5) from scalar_tb;
-sql create stream stb_concat_stream into output_concat_stb as select ts, concat(c3, c4), concat(c3, c5), concat(c4, c5), concat(c3, c4, c5) from scalar_stb partition by tbname;
-sql create stream ctb_concat_stream into output_concat_ctb as select ts, concat(c3, c4), concat(c3, c5), concat(c4, c5), concat(c3, c4, c5) from scalar_ct1;
-sql create stream tb_concat_stream into output_concat_tb as select ts, concat(c3, c4), concat(c3, c5), concat(c4, c5), concat(c3, c4, c5) from scalar_tb;
-sql create stream stb_concat_ws_stream into output_concat_ws_stb as select ts, concat_ws("aND", c3, c4), concat_ws("and", c3, c5), concat_ws("And", c4, c5), concat_ws("AND", c3, c4, c5) from scalar_stb partition by tbname;
-sql create stream ctb_concat_ws_stream into output_concat_ws_ctb as select ts, concat_ws("aND", c3, c4), concat_ws("and", c3, c5), concat_ws("And", c4, c5), concat_ws("AND", c3, c4, c5) from scalar_ct1;
-sql create stream tb_concat_ws_stream into output_concat_ws_tb as select ts, concat_ws("aND", c3, c4), concat_ws("and", c3, c5), concat_ws("And", c4, c5), concat_ws("AND", c3, c4, c5) from scalar_tb;
-sql create stream stb_length_stream into output_length_stb as select ts, length(c3), length(c4), length(c5) from scalar_stb partition by tbname;
-sql create stream ctb_length_stream into output_length_ctb as select ts, length(c3), length(c4), length(c5) from scalar_ct1;
-sql create stream tb_length_stream into output_length_tb as select ts, length(c3), length(c4), length(c5) from scalar_tb;
-sql create stream stb_lower_stream into output_lower_stb as select ts, lower(c3), lower(c4), lower(c5) from scalar_stb partition by tbname;
-sql create stream ctb_lower_stream into output_lower_ctb as select ts, lower(c3), lower(c4), lower(c5) from scalar_ct1;
-sql create stream tb_lower_stream into output_lower_tb as select ts, lower(c3), lower(c4), lower(c5) from scalar_tb;
-sql create stream stb_ltrim_stream into output_ltrim_stb as select ts, ltrim(c3), ltrim(c4), ltrim(c5) from scalar_stb partition by tbname;
-sql create stream ctb_ltrim_stream into output_ltrim_ctb as select ts, ltrim(c3), ltrim(c4), ltrim(c5) from scalar_ct1;
-sql create stream tb_ltrim_stream into output_ltrim_tb as select ts, ltrim(c3), ltrim(c4), ltrim(c5) from scalar_tb;
-sql create stream stb_rtrim_stream into output_rtrim_stb as select ts, rtrim(c3), rtrim(c4), rtrim(c5) from scalar_stb partition by tbname;
-sql create stream ctb_rtrim_stream into output_rtrim_ctb as select ts, rtrim(c3), rtrim(c4), rtrim(c5) from scalar_ct1;
-sql create stream tb_rtrim_stream into output_rtrim_tb as select ts, rtrim(c3), rtrim(c4), rtrim(c5) from scalar_tb;
-sql create stream stb_substr_stream into output_substr_stb as select ts, substr(c3, 2), substr(c3, 2, 2), substr(c4, 5, 1), substr(c5, 3, 4) from scalar_stb partition by tbname;
-sql create stream ctb_substr_stream into output_substr_ctb as select ts, substr(c3, 2), substr(c3, 2, 2), substr(c4, 5, 1), substr(c5, 3, 4) from scalar_ct1;
-sql create stream tb_substr_stream into output_substr_tb as select ts, substr(c3, 2), substr(c3, 2, 2), substr(c4, 5, 1), substr(c5, 3, 4) from scalar_tb;
-sql create stream stb_upper_stream into output_upper_stb as select ts, upper(c3), upper(c4), upper(c5) from scalar_stb partition by tbname;
-sql create stream ctb_upper_stream into output_upper_ctb as select ts, upper(c3), upper(c4), upper(c5) from scalar_ct1;
-sql create stream tb_upper_stream into output_upper_tb as select ts, upper(c3), upper(c4), upper(c5) from scalar_tb;
+# sql create stream ctb_atan_stream trigger at_once into output_atan_ctb as select ts, atan(c1), atan(c2), c3 from scalar_ct1;
+# sql create stream tb_atan_stream trigger at_once into output_atan_tb as select ts, atan(c1), atan(c2), c3 from scalar_tb;
+# sql create stream stb_ceil_stream trigger at_once into output_ceil_stb as select ts, ceil(c1), ceil(c2), c3 from scalar_stb partition by tbname;
+# sql create stream ctb_ceil_stream trigger at_once into output_ceil_ctb as select ts, ceil(c1), ceil(c2), c3 from scalar_ct1;
+# sql create stream tb_ceil_stream trigger at_once into output_ceil_tb as select ts, ceil(c1), ceil(c2), c3 from scalar_tb;
+# sql create stream stb_cos_stream trigger at_once into output_cos_stb as select ts, cos(c1), cos(c2), c3 from scalar_stb partition by tbname;
+# sql create stream ctb_cos_stream trigger at_once into output_cos_ctb as select ts, cos(c1), cos(c2), c3 from scalar_ct1;
+# sql create stream tb_cos_stream trigger at_once into output_cos_tb as select ts, cos(c1), cos(c2), c3 from scalar_tb;
+# sql create stream stb_floor_stream trigger at_once into output_floor_stb as select ts, floor(c1), floor(c2), c3 from scalar_stb partition by tbname;
+# sql create stream ctb_floor_stream trigger at_once into output_floor_ctb as select ts, floor(c1), floor(c2), c3 from scalar_ct1;
+# sql create stream tb_floor_stream trigger at_once into output_floor_tb as select ts, floor(c1), floor(c2), c3 from scalar_tb;
+# sql create stream stb_log_stream trigger at_once into output_log_stb as select ts, log(c1, 2), log(c2, 2), c3 from scalar_stb partition by tbname;
+# sql create stream ctb_log_stream trigger at_once into output_log_ctb as select ts, log(c1, 2), log(c2, 2), c3 from scalar_ct1;
+# sql create stream tb_log_stream trigger at_once into output_log_tb as select ts, log(c1, 2), log(c2, 2), c3 from scalar_tb;
+# sql create stream stb_pow_stream trigger at_once into output_pow_stb as select ts, pow(c1, 2), pow(c2, 2), c3 from scalar_stb partition by tbname;
+# sql create stream ctb_pow_stream trigger at_once into output_pow_ctb as select ts, pow(c1, 2), pow(c2, 2), c3 from scalar_ct1;
+# sql create stream tb_pow_stream trigger at_once into output_pow_tb as select ts, pow(c1, 2), pow(c2, 2), c3 from scalar_tb;
+# sql create stream stb_round_stream trigger at_once into output_round_stb as select ts, round(c1), round(c2), c3 from scalar_stb partition by tbname;
+# sql create stream ctb_round_stream trigger at_once into output_round_ctb as select ts, round(c1), round(c2), c3 from scalar_ct1;
+# sql create stream tb_round_stream trigger at_once into output_round_tb as select ts, round(c1), round(c2), c3 from scalar_tb;
+# sql create stream stb_sin_stream trigger at_once into output_sin_stb as select ts, sin(c1), sin(c2), c3 from scalar_stb partition by tbname;
+# sql create stream ctb_sin_stream trigger at_once into output_sin_ctb as select ts, sin(c1), sin(c2), c3 from scalar_ct1;
+# sql create stream tb_sin_stream trigger at_once into output_sin_tb as select ts, sin(c1), sin(c2), c3 from scalar_tb;
+# sql create stream stb_sqrt_stream trigger at_once into output_sqrt_stb as select ts, sqrt(c1), sqrt(c2), c3 from scalar_stb partition by tbname;
+# sql create stream ctb_sqrt_stream trigger at_once into output_sqrt_ctb as select ts, sqrt(c1), sqrt(c2), c3 from scalar_ct1;
+# sql create stream tb_sqrt_stream trigger at_once into output_sqrt_tb as select ts, sqrt(c1), sqrt(c2), c3 from scalar_tb;
+# sql create stream stb_tan_stream trigger at_once into output_tan_stb as select ts, tan(c1), tan(c2), c3 from scalar_stb partition by tbname;
+# sql create stream ctb_tan_stream trigger at_once into output_tan_ctb as select ts, tan(c1), tan(c2), c3 from scalar_ct1;
+# sql create stream tb_tan_stream trigger at_once into output_tan_tb as select ts, tan(c1), tan(c2), c3 from scalar_tb;
+# sql create stream stb_char_length_stream into output_char_length_stb as select ts, char_length(c3), char_length(c4), char_length(c5) from scalar_stb partition by tbname;
+# sql create stream ctb_char_length_stream into output_char_length_ctb as select ts, char_length(c3), char_length(c4), char_length(c5) from scalar_ct1;
+# sql create stream tb_char_length_stream into output_char_length_tb as select ts, char_length(c3), char_length(c4), char_length(c5) from scalar_tb;
+# sql create stream stb_concat_stream into output_concat_stb as select ts, concat(c3, c4), concat(c3, c5), concat(c4, c5), concat(c3, c4, c5) from scalar_stb partition by tbname;
+# sql create stream ctb_concat_stream into output_concat_ctb as select ts, concat(c3, c4), concat(c3, c5), concat(c4, c5), concat(c3, c4, c5) from scalar_ct1;
+# sql create stream tb_concat_stream into output_concat_tb as select ts, concat(c3, c4), concat(c3, c5), concat(c4, c5), concat(c3, c4, c5) from scalar_tb;
+# sql create stream stb_concat_ws_stream into output_concat_ws_stb as select ts, concat_ws("aND", c3, c4), concat_ws("and", c3, c5), concat_ws("And", c4, c5), concat_ws("AND", c3, c4, c5) from scalar_stb partition by tbname;
+# sql create stream ctb_concat_ws_stream into output_concat_ws_ctb as select ts, concat_ws("aND", c3, c4), concat_ws("and", c3, c5), concat_ws("And", c4, c5), concat_ws("AND", c3, c4, c5) from scalar_ct1;
+# sql create stream tb_concat_ws_stream into output_concat_ws_tb as select ts, concat_ws("aND", c3, c4), concat_ws("and", c3, c5), concat_ws("And", c4, c5), concat_ws("AND", c3, c4, c5) from scalar_tb;
+# sql create stream stb_length_stream into output_length_stb as select ts, length(c3), length(c4), length(c5) from scalar_stb partition by tbname;
+# sql create stream ctb_length_stream into output_length_ctb as select ts, length(c3), length(c4), length(c5) from scalar_ct1;
+# sql create stream tb_length_stream into output_length_tb as select ts, length(c3), length(c4), length(c5) from scalar_tb;
+# sql create stream stb_lower_stream into output_lower_stb as select ts, lower(c3), lower(c4), lower(c5) from scalar_stb partition by tbname;
+# sql create stream ctb_lower_stream into output_lower_ctb as select ts, lower(c3), lower(c4), lower(c5) from scalar_ct1;
+# sql create stream tb_lower_stream into output_lower_tb as select ts, lower(c3), lower(c4), lower(c5) from scalar_tb;
+# sql create stream stb_ltrim_stream into output_ltrim_stb as select ts, ltrim(c3), ltrim(c4), ltrim(c5) from scalar_stb partition by tbname;
+# sql create stream ctb_ltrim_stream into output_ltrim_ctb as select ts, ltrim(c3), ltrim(c4), ltrim(c5) from scalar_ct1;
+# sql create stream tb_ltrim_stream into output_ltrim_tb as select ts, ltrim(c3), ltrim(c4), ltrim(c5) from scalar_tb;
+# sql create stream stb_rtrim_stream into output_rtrim_stb as select ts, rtrim(c3), rtrim(c4), rtrim(c5) from scalar_stb partition by tbname;
+# sql create stream ctb_rtrim_stream into output_rtrim_ctb as select ts, rtrim(c3), rtrim(c4), rtrim(c5) from scalar_ct1;
+# sql create stream tb_rtrim_stream into output_rtrim_tb as select ts, rtrim(c3), rtrim(c4), rtrim(c5) from scalar_tb;
+# sql create stream stb_substr_stream into output_substr_stb as select ts, substr(c3, 2), substr(c3, 2, 2), substr(c4, 5, 1), substr(c5, 3, 4) from scalar_stb partition by tbname;
+# sql create stream ctb_substr_stream into output_substr_ctb as select ts, substr(c3, 2), substr(c3, 2, 2), substr(c4, 5, 1), substr(c5, 3, 4) from scalar_ct1;
+# sql create stream tb_substr_stream into output_substr_tb as select ts, substr(c3, 2), substr(c3, 2, 2), substr(c4, 5, 1), substr(c5, 3, 4) from scalar_tb;
+# sql create stream stb_upper_stream into output_upper_stb as select ts, upper(c3), upper(c4), upper(c5) from scalar_stb partition by tbname;
+# sql create stream ctb_upper_stream into output_upper_ctb as select ts, upper(c3), upper(c4), upper(c5) from scalar_ct1;
+# sql create stream tb_upper_stream into output_upper_tb as select ts, upper(c3), upper(c4), upper(c5) from scalar_tb;
sql insert into scalar_ct1 values (1656668180503, 100, 100.1, "beijing", "taos", "Taos");
sql insert into scalar_ct1 values (1656668180503+1s, -50, -50.1, "tianjin", "taosdata", "Taosdata");
sql insert into scalar_ct1 values (1656668180503+2s, 0, Null, "hebei", "TDengine", Null);
@@ -273,4 +273,4 @@ print ========== step7
system sh/exec.sh -n dnode1 -s stop -x SIGINT
system sh/exec.sh -n dnode2 -s stop -x SIGINT
system sh/exec.sh -n dnode3 -s stop -x SIGINT
-system sh/exec.sh -n dnode4 -s stop -x SIGINT
\ No newline at end of file
+system sh/exec.sh -n dnode4 -s stop -x SIGINT
diff --git a/tests/script/tsim/stream/fillIntervalRange.sim b/tests/script/tsim/stream/fillIntervalRange.sim
new file mode 100644
index 0000000000000000000000000000000000000000..a0905141f2bed1230abd3f51acc867aed19d1c45
--- /dev/null
+++ b/tests/script/tsim/stream/fillIntervalRange.sim
@@ -0,0 +1,225 @@
+$loop_all = 0
+looptest:
+
+system sh/stop_dnodes.sh
+system sh/deploy.sh -n dnode1 -i 1
+system sh/exec.sh -n dnode1 -s start
+
+sleep 500
+sql connect
+
+sql drop database if exists test;
+sql create database test vgroups 1;
+sql use test;
+
+sql create table t1(ts timestamp, a int, b int , c int, d double, s varchar(20));;
+sql create stream streams1 trigger at_once into streamt as select _wstart ts, count(*) c1 from t1 interval(1s) fill(NULL);
+sql insert into t1 values(1648791211000,1,2,3,1.0,'aaa');
+sleep 100
+sql insert into t1 values(1648795308000,1,2,3,1.0,'aaa');
+
+$loop_count = 0
+
+loop0:
+
+$loop_count = $loop_count + 1
+if $loop_count == 10 then
+ return -1
+endi
+
+sleep 500
+sql select * from streamt where c1 > 0;
+
+if $rows != 2 then
+ print =====rows=$rows
+ goto loop0
+endi
+
+sql select count(*) from streamt;
+
+if $data00 != 4098 then
+ print =====data00=$data00
+ goto loop0
+endi
+
+sql insert into t1 values(1648800308000,1,1,1,1.0,'aaa');
+
+
+$loop_count = 0
+
+loop1:
+$loop_count = $loop_count + 1
+if $loop_count == 10 then
+ return -1
+endi
+
+sleep 500
+sql select * from streamt where c1 > 0;
+
+if $rows != 3 then
+ print =====rows=$rows
+ goto loop1
+endi
+
+sql select count(*) from streamt;
+
+if $data00 != 9098 then
+ print =====rows=$rows
+ goto loop1
+endi
+
+sql insert into t1 values(1648786211000,1,1,1,1.0,'aaa');
+
+
+$loop_count = 0
+
+loop2:
+$loop_count = $loop_count + 1
+if $loop_count == 10 then
+ return -1
+endi
+
+sleep 500
+sql select * from streamt where c1 > 0;
+
+if $rows != 4 then
+ print =====rows=$rows
+ goto loop2
+endi
+
+sql select count(*) from streamt;
+
+if $data00 != 14098 then
+ print =====rows=$rows
+ goto loop2
+endi
+
+sql insert into t1 values(1648801308000,1,1,1,1.0,'aaa') (1648802308000,1,1,1,1.0,'aaa') (1648803308000,1,1,1,1.0,'aaa') (1648804308000,1,1,1,1.0,'aaa') (1648805308000,1,1,1,1.0,'aaa');
+
+
+$loop_count = 0
+
+loop21:
+$loop_count = $loop_count + 1
+if $loop_count == 10 then
+ return -1
+endi
+
+sleep 500
+sql select * from streamt where c1 > 0;
+
+if $rows != 9 then
+ print =====rows=$rows
+ goto loop21
+endi
+
+sql select count(*) from streamt;
+
+if $data00 != 19098 then
+ print =====rows=$rows
+ goto loop21
+endi
+
+sql drop database if exists test;
+sql create database test vgroups 1;
+sql use test;
+
+sql create table t1(ts timestamp, a int, b int , c int, d double, s varchar(20));
+print create stream streams1 trigger at_once into streamt as select _wstart ts, max(a) c1 from t1 interval(1s) fill(linear);
+sql create stream streams1 trigger at_once into streamt as select _wstart ts, max(a) c1 from t1 interval(1s) fill(linear);
+
+print create stream streams2 trigger at_once into streamt2 as select _wstart ts, max(a) c1 from t1 interval(1s) fill(prev);
+sql create stream streams2 trigger at_once into streamt2 as select _wstart ts, max(a) c1 from t1 interval(1s) fill(prev);
+
+sql insert into t1 values(1648791211000,1,2,3,1.0,'aaa');
+sleep 100
+sql insert into t1 values(1648795308000,1,2,3,1.0,'aaa');
+
+$loop_count = 0
+
+loop3:
+
+$loop_count = $loop_count + 1
+if $loop_count == 10 then
+ return -1
+endi
+
+sleep 500
+
+print select count(*) from streamt;
+sql select count(*) from streamt;
+
+if $data00 != 4098 then
+ print =====data00=$data00
+ goto loop3
+endi
+
+print select count(*) from streamt2;
+sql select count(*) from streamt2;
+
+if $data00 != 4098 then
+ print =====data00=$data00
+ goto loop3
+endi
+
+sql insert into t1 values(1648800308000,1,1,1,1.0,'aaa');
+
+
+$loop_count = 0
+
+loop4:
+$loop_count = $loop_count + 1
+if $loop_count == 10 then
+ return -1
+endi
+
+sleep 500
+
+print select count(*) from streamt;
+sql select count(*) from streamt;
+
+if $data00 != 9098 then
+ print =====rows=$rows
+ goto loop4
+endi
+
+print select count(*) from streamt2;
+sql select count(*) from streamt2;
+
+if $data00 != 9098 then
+ print =====rows=$rows
+ goto loop4
+endi
+
+sql insert into t1 values(1648786211000,1,1,1,1.0,'aaa');
+
+
+$loop_count = 0
+
+loop5:
+$loop_count = $loop_count + 1
+if $loop_count == 10 then
+ return -1
+endi
+
+sleep 500
+
+print select count(*) from streamt;
+sql select count(*) from streamt;
+
+if $data00 != 14098 then
+ print =====rows=$rows
+ goto loop5
+endi
+
+print select count(*) from streamt2;
+sql select count(*) from streamt2;
+
+if $data00 != 14098 then
+ print =====rows=$rows
+ goto loop5
+endi
+
+system sh/stop_dnodes.sh
+
+#goto looptest
diff --git a/tests/script/tsim/stream/fillIntervalValue.sim b/tests/script/tsim/stream/fillIntervalValue.sim
index fe4ec759eb2fa9ea0520c3c03766a83eacd5fe6f..2cd419397fdb0230aacd8983c2c5b238e82ab673 100644
--- a/tests/script/tsim/stream/fillIntervalValue.sim
+++ b/tests/script/tsim/stream/fillIntervalValue.sim
@@ -14,6 +14,7 @@ sql use test;
sql create table t1(ts timestamp, a int, b int , c int, d double, s varchar(20));;
sql create stream streams1 trigger at_once into streamt as select _wstart ts, count(*) c1 from t1 where ts > 1648791210000 and ts < 1648791413000 interval(10s) fill(value, 100);
+sql create stream streams1a trigger at_once into streamta as select _wstart ts, count(*) c1 from t1 where ts > 1648791210000 and ts < 1648791413000 interval(10s) fill(value_f, 100);
sql insert into t1 values(1648791213000,1,2,3,1.0,'aaa');
sleep 100
sql insert into t1 values(1648791233000,1,2,3,1.0,'aaa');
@@ -77,6 +78,69 @@ if $data71 != 1 then
goto loop0
endi
+
+print "force fill vaule"
+
+$loop_count = 0
+
+loop0a:
+sleep 200
+sql select * from streamta order by ts;
+
+$loop_count = $loop_count + 1
+if $loop_count == 10 then
+ return -1
+endi
+
+if $rows != 8 then
+ print =====rows=$rows
+ goto loop0a
+endi
+
+if $data01 != 1 then
+ print =====data01=$data01
+ goto loop0a
+endi
+
+if $data11 != 1 then
+ print =====data11=$data11
+ goto loop0a
+endi
+
+if $data21 != 1 then
+ print =====data21=$data21
+ goto loop0a
+endi
+
+if $data31 != 100 then
+ print =====data31=$data31
+ goto loop0a
+endi
+
+if $data41 != 1 then
+ print =====data41=$data41
+ goto loop0a
+endi
+
+if $data51 != 100 then
+ print =====data01=$data01
+ goto loop0a
+endi
+
+if $data61 != 100 then
+ print =====data61=$data61
+ goto loop0a
+endi
+
+if $data71 != 1 then
+ print =====data71=$data71
+ goto loop0a
+endi
+
+
+
+
+
sql drop stream if exists streams2;
sql drop database if exists test2;
sql create database test2 vgroups 1;
@@ -408,6 +472,7 @@ sql create table t1 using st tags(1,1,1);
sql create table t2 using st tags(2,2,2);
sql create stream streams4 trigger at_once into streamt4 as select _wstart ts, count(*) c1, concat(tbname, 'aaa') as pname, timezone() from st where ts > 1648791000000 and ts < 1648793000000 partition by tbname interval(10s) fill(NULL);
+sql create stream streams4a trigger at_once into streamt4a as select _wstart ts, count(*) c1, concat(tbname, 'aaa') as pname, timezone() from st where ts > 1648791000000 and ts < 1648793000000 partition by tbname interval(10s) fill(NULL_F);
sql insert into t1 values(1648791213000,1,2,3,1.0,'aaa');
sql insert into t1 values(1648791233000,1,2,3,1.0,'aaa');
sql insert into t1 values(1648791273000,1,2,3,1.0,'aaa');
@@ -512,32 +577,104 @@ if $data[12][3] == NULL then
goto loop4
endi
+print "force fill null"
+$loop_count = 0
+loop4a:
+sleep 200
+sql select * from streamt4a order by pname, ts;
+print ===> $data[0][0] , $data[0][1] , $data[0][2] , $data[0][3]
+print ===> $data[1][0] , $data[1][1] , $data[1][2] , $data[1][3]
+print ===> $data[2][0] , $data[2][1] , $data[2][2] , $data[2][3]
+print ===> $data[3][0] , $data[3][1] , $data[3][2] , $data[3][3]
+print ===> $data[4][0] , $data[4][1] , $data[4][2] , $data[4][3]
+print ===> $data[5][0] , $data[5][1] , $data[5][2] , $data[5][3]
+print ===> $data[6][0] , $data[6][1] , $data[6][2] , $data[6][3]
+print ===> $data[7][0] , $data[7][1] , $data[7][2] , $data[7][3]
+print ===> $data[8][0] , $data[8][1] , $data[8][2] , $data[8][3]
+print ===> $data[9][0] , $data[9][1] , $data[9][2] , $data[9][3]
+print ===> $data[10][0] , $data[10][1] , $data[10][2] , $data[10][3]
+print ===> $data[11][0] , $data[11][1] , $data[11][2] , $data[11][3]
+print ===> $data[12][0] , $data[12][1] , $data[12][2] , $data[12][3]
+print ===> $data[13][0] , $data[13][1] , $data[13][2] , $data[13][3]
+$loop_count = $loop_count + 1
+if $loop_count == 10 then
+ return -1
+endi
+if $rows != 14 then
+ print =====rows=$rows
+ goto loop4a
+endi
+if $data11 != NULL then
+ print =====data11=$data11
+ goto loop4a
+endi
+if $data12 != t1aaa then
+ print =====data12=$data12
+ goto loop4a
+endi
+if $data13 == NULL then
+ print =====data13=$data13
+ goto loop4a
+endi
+if $data32 != t1aaa then
+ print =====data32=$data32
+ goto loop4a
+endi
+if $data42 != t1aaa then
+ print =====data42=$data42
+ goto loop4a
+endi
+if $data52 != t1aaa then
+ print =====data52=$data52
+ goto loop4a
+endi
+if $data81 != NULL then
+ print =====data81=$data81
+ goto loop4a
+endi
+if $data82 != t2aaa then
+ print =====data82=$data82
+ goto loop4a
+endi
+if $data83 == NULL then
+ print =====data83=$data83
+ goto loop4a
+endi
+if $data[10][2] != t2aaa then
+ print =====data[10][2]=$data[10][2]
+ goto loop4a
+endi
+if $data[11][2] != t2aaa then
+ print =====data[11][2]=$data[11][2]
+ goto loop4a
+endi
+if $data[12][2] != t2aaa then
+ print =====data[12][2]=$data[12][2]
+ goto loop4a
+endi
-
-
-
-
-
-
-
+if $data[12][3] == NULL then
+ print =====data[12][3]=$data[12][3]
+ goto loop4a
+endi
@@ -584,4 +721,4 @@ print ============loop_all=$loop_all
system sh/stop_dnodes.sh
-#goto looptest
\ No newline at end of file
+#goto looptest
diff --git a/tests/script/tsim/stream/ignoreCheckUpdate.sim b/tests/script/tsim/stream/ignoreCheckUpdate.sim
new file mode 100644
index 0000000000000000000000000000000000000000..7f99c534c8d5ffca96f9a394e330c33bf7500afb
--- /dev/null
+++ b/tests/script/tsim/stream/ignoreCheckUpdate.sim
@@ -0,0 +1,285 @@
+system sh/stop_dnodes.sh
+system sh/deploy.sh -n dnode1 -i 1
+system sh/exec.sh -n dnode1 -s start
+sleep 50
+sql connect
+
+print step 1 start
+
+sql drop stream if exists streams0;
+sql drop database if exists test;
+sql create database test vgroups 1;
+sql use test;
+sql create table t1(ts timestamp, a int, b int , c int);
+
+print create stream streams0 trigger at_once ignore update 1 into streamt as select _wstart c1, count(*) c2, max(b) c3 from t1 interval(10s);
+
+sql create stream streams0 trigger at_once ignore update 1 into streamt as select _wstart c1, count(*) c2, max(b) c3 from t1 interval(10s);
+
+sql insert into t1 values(1648791213000,1,1,1);
+sql insert into t1 values(1648791213000,2,2,2);
+
+$loop_count = 0
+
+loop0:
+sleep 300
+sql select * from streamt order by 1,2,3;
+
+$loop_count = $loop_count + 1
+if $loop_count == 10 then
+ return -1
+endi
+
+if $data01 != 2 then
+ print =====data01=$data01
+ goto loop0
+endi
+
+if $data02 != 2 then
+ print =====data02=$data02
+ goto loop0
+endi
+
+
+sql insert into t1 values(1648791213000,3,3,3);
+
+$loop_count = 0
+
+loop1:
+sleep 300
+sql select * from streamt order by 1,2,3;
+
+$loop_count = $loop_count + 1
+if $loop_count == 10 then
+ return -1
+endi
+
+if $data01 != 3 then
+ print =====data01=$data01
+ goto loop1
+endi
+
+if $data02 != 3 then
+ print =====data02=$data02
+ goto loop1
+endi
+
+print step 1 end
+
+print step 2 start
+
+sql drop stream if exists streams1;
+sql drop database if exists test1;
+sql create database test1 vgroups 1;
+sql use test1;
+sql create table t1(ts timestamp, a int, b int , c int);
+
+print create stream streams1 trigger at_once ignore update 1 into streamt1 as select _wstart c1, count(*) c2, max(b) c3 from t1 session(ts, 10s);
+
+sql create stream streams1 trigger at_once ignore update 1 into streamt1 as select _wstart c1, count(*) c2, max(b) c3 from t1 session(ts, 10s);
+
+sql insert into t1 values(1648791213000,1,1,1);
+sql insert into t1 values(1648791213000,2,2,2);
+
+$loop_count = 0
+
+loop2:
+sleep 300
+sql select * from streamt1 order by 1,2,3;
+
+$loop_count = $loop_count + 1
+if $loop_count == 10 then
+ return -1
+endi
+
+if $data01 != 2 then
+ print =====data01=$data01
+ goto loop2
+endi
+
+if $data02 != 2 then
+ print =====data02=$data02
+ goto loop2
+endi
+
+
+sql insert into t1 values(1648791213000,3,3,3);
+
+$loop_count = 0
+
+loop3:
+
+sleep 300
+sql select * from streamt1 order by 1,2,3;
+
+$loop_count = $loop_count + 1
+if $loop_count == 10 then
+ return -1
+endi
+
+if $data01 != 3 then
+ print =====data01=$data01
+ goto loop3
+endi
+
+if $data02 != 3 then
+ print =====data02=$data02
+ goto loop3
+endi
+
+print step 2 end
+
+print step 3 start
+
+sql drop stream if exists streams2;
+sql drop database if exists test2;
+sql create database test2 vgroups 1;
+sql use test2;
+sql create table t1(ts timestamp, a int, b int , c int);
+
+print create stream streams2 trigger at_once ignore update 1 into streamt2 as select _wstart c1, count(*) c2, max(b) c3 from t1 state_window(c);
+
+sql create stream streams2 trigger at_once ignore update 1 into streamt2 as select _wstart c1, count(*) c2, max(b) c3 from t1 state_window(c);
+
+sql insert into t1 values(1648791213000,1,1,1);
+sql insert into t1 values(1648791213000,2,2,1);
+
+$loop_count = 0
+
+loop2:
+sleep 300
+sql select * from streamt2 order by 1,2,3;
+
+$loop_count = $loop_count + 1
+if $loop_count == 10 then
+ return -1
+endi
+
+if $data01 != 2 then
+ print =====data01=$data01
+ goto loop2
+endi
+
+if $data02 != 2 then
+ print =====data02=$data02
+ goto loop2
+endi
+
+
+sql insert into t1 values(1648791213000,3,3,1);
+
+$loop_count = 0
+
+loop3:
+
+sleep 300
+sql select * from streamt2 order by 1,2,3;
+
+$loop_count = $loop_count + 1
+if $loop_count == 10 then
+ return -1
+endi
+
+if $data01 != 3 then
+ print =====data01=$data01
+ goto loop3
+endi
+
+if $data02 != 3 then
+ print =====data02=$data02
+ goto loop3
+endi
+
+print step 3 end
+
+print step 4 start
+
+sql drop stream if exists streams3;
+sql drop database if exists test3;
+sql create database test3 vgroups 4;
+sql use test3;
+sql create stable st(ts timestamp,a int,b int,c int) tags(ta int,tb int,tc int);
+sql create table t1 using st tags(1,1,1);
+sql create table t2 using st tags(2,2,2);
+
+print create stream streams3 trigger at_once ignore update 1 into streamt3 as select _wstart c1, count(*) c2, max(b) c3 from st interval(10s);
+
+sql create stream streams3 trigger at_once ignore update 1 into streamt3 as select _wstart c1, count(*) c2, max(b) c3 from st interval(10s);
+
+sql insert into t1 values(1648791213000,1,1,1);
+sql insert into t1 values(1648791213000,2,2,2);
+
+sql insert into t2 values(1648791213000,1,1,1);
+sql insert into t2 values(1648791213000,2,2,2);
+
+$loop_count = 0
+
+loop0:
+sleep 300
+sql select * from streamt3 order by 1,2,3;
+
+$loop_count = $loop_count + 1
+if $loop_count == 10 then
+ return -1
+endi
+
+if $data01 != 4 then
+ print =====data01=$data01
+ goto loop0
+endi
+
+if $data02 != 2 then
+ print =====data02=$data02
+ goto loop0
+endi
+
+
+sql insert into t1 values(1648791213000,3,3,3);
+
+$loop_count = 0
+
+loop1:
+sleep 300
+sql select * from streamt3 order by 1,2,3;
+
+$loop_count = $loop_count + 1
+if $loop_count == 10 then
+ return -1
+endi
+
+if $data01 != 5 then
+ print =====data01=$data01
+ goto loop1
+endi
+
+if $data02 != 3 then
+ print =====data02=$data02
+ goto loop1
+endi
+
+sql insert into t2 values(1648791213000,4,4,4);
+
+$loop_count = 0
+
+loop1:
+sleep 300
+sql select * from streamt3 order by 1,2,3;
+
+$loop_count = $loop_count + 1
+if $loop_count == 10 then
+ return -1
+endi
+
+if $data01 != 6 then
+ print =====data01=$data01
+ goto loop1
+endi
+
+if $data02 != 4 then
+ print =====data02=$data02
+ goto loop1
+endi
+
+print step 4 end
+
+system sh/stop_dnodes.sh
diff --git a/tests/script/tsim/stream/ignoreExpiredData.sim b/tests/script/tsim/stream/ignoreExpiredData.sim
index 03f574bc529356f0d2ab60a9ffdaf89e0e8be083..b143b7977fe6e1de9e716ba32d153d076830478a 100644
--- a/tests/script/tsim/stream/ignoreExpiredData.sim
+++ b/tests/script/tsim/stream/ignoreExpiredData.sim
@@ -52,6 +52,7 @@ sql insert into t1 values(1648791213000,1,2,3,1.0);
sql insert into t1 values(1648791223001,1,2,3,1.1);
sql insert into t1 values(1648791233002,2,2,3,2.1);
sql insert into t1 values(1648791243003,2,2,3,3.1);
+sleep 300
sql insert into t1 values(1648791200000,4,2,3,4.1);
$loop_count = 0
@@ -115,6 +116,7 @@ sql create stream stream_t1 trigger at_once IGNORE EXPIRED 1 into streamtST1 as
sql create stream stream_t2 trigger at_once IGNORE EXPIRED 1 into streamtST2 as select _wstart, count(*) c1, count(a) c2 , sum(a) c3 , max(b) c5, min(c) c6 from st session(ts, 10s) ;
sql insert into ts1 values(1648791211000,1,2,3);
sql insert into ts1 values(1648791222001,2,2,3);
+sleep 300
sql insert into ts2 values(1648791211000,1,2,3);
sql insert into ts2 values(1648791222001,2,2,3);
diff --git a/tests/script/tsim/stream/state0.sim b/tests/script/tsim/stream/state0.sim
index 7c922658c91cd3c6529b981208b31754226db71d..07abdc0040d962bc6c6b6b0f15996cdf973ab450 100644
--- a/tests/script/tsim/stream/state0.sim
+++ b/tests/script/tsim/stream/state0.sim
@@ -16,6 +16,9 @@ print $data00 $data01 $data02
sql use test;
sql create table t1(ts timestamp, a int, b int , c int, d double, id int);
+
+print create stream streams1 trigger at_once into streamt1 as select _wstart, count(*) c1, count(d) c2 , sum(a) c3 , max(a) c4, min(c) c5, max(id) c from t1 state_window(a);
+
sql create stream streams1 trigger at_once into streamt1 as select _wstart, count(*) c1, count(d) c2 , sum(a) c3 , max(a) c4, min(c) c5, max(id) c from t1 state_window(a);
sql insert into t1 values(1648791213000,1,2,3,1.0,1);
@@ -79,86 +82,88 @@ endi
if $data03 != 1 then
print ======$data03
- return -1
+ goto loop1
endi
if $data04 != 1 then
print ======$data04
- return -1
+ goto loop1
endi
if $data05 != 3 then
print ======$data05
- return -1
+ goto loop1
endi
if $data06 != 5 then
print ======$data06
- return -1
+ goto loop1
endi
# row 1
if $data11 != 1 then
print ======$data11
- return -1
+ goto loop1
endi
if $data12 != 1 then
print ======$data12
- return -1
+ goto loop1
endi
if $data13 != 2 then
print ======$data13
- return -1
+ goto loop1
endi
if $data14 != 2 then
print ======$data14
- return -1
+ goto loop1
endi
if $data15 != 3 then
print ======$data15
- return -1
+ goto loop1
endi
if $data16 != 4 then
print ======$data16
- return -1
+ goto loop1
endi
# row 2
if $data21 != 1 then
print ======$data21
- return -1
+ goto loop1
endi
if $data22 != 1 then
print ======$data22
- return -1
+ goto loop1
endi
if $data23 != 1 then
print ======$data23
- return -1
+ goto loop1
endi
if $data24 != 1 then
print ======$data24
- return -1
+ goto loop1
endi
if $data25 != 3 then
print ======$data25
- return -1
+ goto loop1
endi
if $data26 != 6 then
print ======$data26
- return -1
+ goto loop1
endi
+print loop1 end
+
sql insert into t1 values(1648791213011,1,2,3,1.0,7);
$loop_count = 0
@@ -174,33 +179,31 @@ endi
if $data21 != 2 then
print =====data21=$data21
goto loop2
- return -1
endi
if $data22 != 2 then
print =====data22=$data22
goto loop2
- return -1
endi
if $data23 != 2 then
print ======$data23
- return -1
+ goto loop2
endi
if $data24 != 1 then
print ======$data24
- return -1
+ goto loop2
endi
if $data25 != 3 then
print ======$data25
- return -1
+ goto loop2
endi
if $data26 != 7 then
print ======$data26
- return -1
+ goto loop2
endi
sql insert into t1 values(1648791213011,1,2,3,1.0,8);
@@ -238,99 +241,93 @@ endi
if $data21 != 1 then
print =====data21=$data21
goto loop3
- return -1
endi
if $data22 != 1 then
print =====data22=$data22
goto loop3
- return -1
endi
if $data23 != 10 then
print ======$data23
- return -1
+ goto loop3
endi
if $data24 != 10 then
print ======$data24
- return -1
+ goto loop3
endi
if $data25 != 10 then
print ======$data25
- return -1
+ goto loop3
endi
if $data26 != 12 then
print ======$data26
- return -1
+ goto loop3
endi
# row 3
if $data31 != 1 then
print =====data31=$data31
goto loop3
- return -1
endi
if $data32 != 1 then
print =====data32=$data32
goto loop3
- return -1
endi
if $data33 != 3 then
print ======$data33
- return -1
+ goto loop3
endi
if $data34 != 3 then
print ======$data34
- return -1
+ goto loop3
endi
if $data35 != 3 then
print ======$data35
- return -1
+ goto loop3
endi
if $data36 != 10 then
print ======$data36
- return -1
+ goto loop3
endi
# row 4
if $data41 != 1 then
print =====data41=$data41
goto loop3
- return -1
endi
if $data42 != 1 then
print =====data42=$data42
goto loop3
- return -1
endi
if $data43 != 1 then
print ======$data43
- return -1
+ goto loop3
endi
if $data44 != 1 then
print ======$data44
- return -1
+ goto loop3
endi
if $data45 != 3 then
print ======$data45
- return -1
+ goto loop3
endi
if $data46 != 11 then
print ======$data46
- return -1
+ goto loop3
endi
sql insert into t1 values(1648791213030,3,12,12,12.0,13);
@@ -360,95 +357,93 @@ endi
if $data02 != 2 then
print ======$data02
- return -1
+ goto loop4
endi
if $data03 != 6 then
print ======$data03
- return -1
+ goto loop4
endi
if $data04 != 3 then
print ======$data04
- return -1
+ goto loop4
endi
if $data05 != 3 then
print ======$data05
- return -1
+ goto loop4
endi
if $data06 != 15 then
print ======$data06
- return -1
+ goto loop4
endi
# row 1
if $data11 != 1 then
print =====data11=$data11
goto loop4
- return -1
endi
if $data12 != 1 then
print =====data12=$data12
goto loop4
- return -1
endi
if $data13 != 15 then
print ======$data13
- return -1
+ goto loop4
endi
if $data14 != 15 then
print ======$data14
- return -1
+ goto loop4
endi
if $data15 != 15 then
print ======$data15
- return -1
+ goto loop4
endi
if $data16 != 16 then
print ======$data16
- return -1
+ goto loop4
endi
# row 2
if $data21 != 1 then
print =====data21=$data21
goto loop4
- return -1
endi
if $data22 != 1 then
print =====data22=$data22
goto loop4
- return -1
endi
if $data23 != 1 then
print ======$data23
- return -1
+ goto loop4
endi
if $data24 != 1 then
print ======$data24
- return -1
+ goto loop4
endi
if $data25 != 13 then
print ======$data25
- return -1
+ goto loop4
endi
if $data26 != 14 then
print ======$data26
- return -1
+ goto loop4
endi
+print loop4 end
+
sql create database test1 vgroups 1;
sql select * from information_schema.ins_databases;
@@ -457,6 +452,9 @@ print $data00 $data01 $data02
sql use test1;
sql create table t1(ts timestamp, a int, b int , c int, d double, id int);
+
+print create stream streams2 trigger at_once into streamt1 as select _wstart, count(*) c1, count(d) c2 , sum(a) c3 , max(a) c4, min(c) c5, max(id) c from t1 state_window(a);
+
sql create stream streams2 trigger at_once into streamt1 as select _wstart, count(*) c1, count(d) c2 , sum(a) c3 , max(a) c4, min(c) c5, max(id) c from t1 state_window(a);
sql insert into t1 values(1648791212000,2,2,3,1.0,1);
@@ -502,6 +500,9 @@ sql create database test3 vgroups 1;
sql use test3;
sql create table t1(ts timestamp, a int, b int , c int, d double, id int);
+
+print create stream streams3 trigger at_once into streamt3 as select _wstart, count(*) c1, sum(b) c3 from t1 state_window(a);
+
sql create stream streams3 trigger at_once into streamt3 as select _wstart, count(*) c1, sum(b) c3 from t1 state_window(a);
sql insert into t1 values(1648791212000,1,2,3,1.0,1);
sql insert into t1 values(1648791213000,2,2,3,1.0,1);
@@ -543,7 +544,6 @@ if $rows != 10 then
goto loop6
endi
-
sql drop stream if exists streams4;
sql drop database if exists test4;
sql drop stable if exists streamt4;
@@ -552,7 +552,10 @@ sql use test4;
sql create table st (ts timestamp, c1 tinyint, c2 smallint) tags (t1 tinyint) ;
sql create table t1 using st tags (-81) ;
sql create table t2 using st tags (-81) ;
-sql create stream if not exists streams4 trigger window_close into streamt4 as select _wstart AS start, min(c1),count(c1) from t1 state_window(c1);
+
+print create stream if not exists streams4 trigger window_close into streamt4 as select _wstart AS startts, min(c1),count(c1) from t1 state_window(c1);
+
+sql create stream if not exists streams4 trigger window_close into streamt4 as select _wstart AS startts, min(c1),count(c1) from t1 state_window(c1);
sql insert into t1 (ts, c1) values (1668073288209, 11);
sql insert into t1 (ts, c1) values (1668073288210, 11);
@@ -567,7 +570,7 @@ loop7:
sleep 200
-sql select * from streamt4 order by start;
+sql select * from streamt4 order by startts;
$loop_count = $loop_count + 1
if $loop_count == 20 then
@@ -606,7 +609,7 @@ loop8:
sleep 200
-sql select * from streamt4 order by start;
+sql select * from streamt4 order by startts;
$loop_count = $loop_count + 1
if $loop_count == 20 then
@@ -636,11 +639,11 @@ sql insert into t1 (ts, c1) values (1668073288225, 65);
sql insert into t1 (ts, c1) values (1668073288226, 65);
$loop_count = 0
-loop8:
+loop81:
sleep 200
-sql select * from streamt4 order by start;
+sql select * from streamt4 order by startts;
$loop_count = $loop_count + 1
if $loop_count == 20 then
@@ -649,27 +652,27 @@ endi
if $rows != 2 then
print =====rows=$rows
- goto loop8
+ goto loop81
endi
if $data01 != 11 then
print =====data01=$data01
- goto loop8
+ goto loop81
endi
if $data02 != 5 then
print =====data02=$data02
- goto loop8
+ goto loop81
endi
if $data11 != 29 then
print =====data11=$data11
- goto loop8
+ goto loop81
endi
if $data12 != 1 then
print =====data12=$data12
- goto loop8
+ goto loop81
endi
sql insert into t1 (ts, c1) values (1668073288224, 64);
@@ -679,7 +682,7 @@ loop9:
sleep 200
-sql select * from streamt4 order by start;
+sql select * from streamt4 order by startts;
$loop_count = $loop_count + 1
if $loop_count == 20 then
@@ -738,6 +741,9 @@ sql use test5;
sql create table tb (ts timestamp, a int);
sql insert into tb values (now + 1m , 1 );
sql create table b (c timestamp, d int, e int , f int, g double);
+
+print create stream streams0 trigger at_once into streamt as select _wstart c1, count(*) c2, max(a) c3 from tb state_window(a);
+
sql create stream streams0 trigger at_once into streamt as select _wstart c1, count(*) c2, max(a) c3 from tb state_window(a);
sql insert into b values(1648791213000,NULL,NULL,NULL,NULL);
sql select * from streamt order by c1, c2, c3;
@@ -792,4 +798,6 @@ if $data00 != 2 then
goto loop10
endi
+print state0 end
+
system sh/exec.sh -n dnode1 -s stop -x SIGINT
diff --git a/tests/system-test/0-others/balance_vgroups_r1.py b/tests/system-test/0-others/balance_vgroups_r1.py
new file mode 100644
index 0000000000000000000000000000000000000000..ae504cbab11e1bddf7b4d4a6f14ab41342d9d2be
--- /dev/null
+++ b/tests/system-test/0-others/balance_vgroups_r1.py
@@ -0,0 +1,99 @@
+###################################################################
+# 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 -*-
+
+
+from util import constant
+from util.log import *
+from util.cases import *
+from util.sql import *
+from util.common import *
+from util.sqlset import *
+from util.cluster import *
+class TDTestCase:
+ def init(self, conn, logSql, replicaVar=1):
+ self.replicaVar = int(replicaVar)
+ tdLog.debug("start to execute %s" % __file__)
+ tdSql.init(conn.cursor())
+ self.dnode_num=len(cluster.dnodes)
+ self.dbname = 'db_test'
+ self.setsql = TDSetSql()
+ self.stbname = f'{self.dbname}.stb'
+ self.rowNum = 5
+ self.tbnum = 10
+ self.ts = 1537146000000
+ self.binary_str = 'taosdata'
+ self.nchar_str = '涛思数据'
+ self.column_dict = {
+ 'ts' : 'timestamp',
+ 'col1': 'tinyint',
+ 'col2': 'smallint',
+ 'col3': 'int',
+ 'col4': 'bigint',
+ 'col5': 'tinyint unsigned',
+ 'col6': 'smallint unsigned',
+ 'col7': 'int unsigned',
+ 'col8': 'bigint unsigned',
+ 'col9': 'float',
+ 'col10': 'double',
+ 'col11': 'bool',
+ 'col12': 'binary(20)',
+ 'col13': 'nchar(20)'
+ }
+ self.replica = [1,3]
+
+ def insert_data(self,column_dict,tbname,row_num):
+ insert_sql = self.setsql.set_insertsql(column_dict,tbname,self.binary_str,self.nchar_str)
+ for i in range(row_num):
+ insert_list = []
+ self.setsql.insert_values(column_dict,i,insert_sql,insert_list,self.ts)
+ def prepare_data(self,dbname,stbname,column_dict,tbnum,rowNum,replica):
+ tag_dict = {
+ 't0':'int'
+ }
+ tag_values = [
+ f'1'
+ ]
+ tdSql.execute(f"create database if not exists {dbname} vgroups 1 replica {replica} ")
+ tdSql.execute(f'use {dbname}')
+ tdSql.execute(self.setsql.set_create_stable_sql(stbname,column_dict,tag_dict))
+ for i in range(tbnum):
+ tdSql.execute(f"create table {stbname}_{i} using {stbname} tags({tag_values[0]})")
+ self.insert_data(self.column_dict,f'{stbname}_{i}',rowNum)
+ def redistribute_vgroups(self,replica,stbname,tbnum,rownum):
+ tdSql.query('show vgroups')
+ vnode_id = tdSql.queryResult[0][0]
+ if replica == 1:
+ for dnode_id in range(1,self.dnode_num+1) :
+ tdSql.execute(f'redistribute vgroup {vnode_id} dnode {dnode_id}')
+ tdSql.query(f'select count(*) from {stbname}')
+ tdSql.checkEqual(tdSql.queryResult[0][0],tbnum*rownum)
+ elif replica == 3:
+ for dnode_id in range(1,self.dnode_num-1):
+ tdSql.execute(f'redistribute vgroup {vnode_id} dnode {dnode_id} dnode {dnode_id+1} dnode {dnode_id+2}')
+ tdSql.query(f'select count(*) from {stbname}')
+ tdSql.checkEqual(tdSql.queryResult[0][0],tbnum*rownum)
+
+ def run(self):
+ for replica in self.replica:
+ self.prepare_data(self.dbname,self.stbname,self.column_dict,self.tbnum,self.rowNum,replica)
+ self.redistribute_vgroups(replica,self.stbname,self.tbnum,self.rowNum)
+ tdSql.execute(f'drop database {self.dbname}')
+
+
+
+ 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/system-test/0-others/user_manage.py b/tests/system-test/0-others/user_manage.py
index 5148e26b396355389a605b42058ddcbdb8524bb2..6f90a2873afa4e08c1ec4b72457b6cba9f232d48 100644
--- a/tests/system-test/0-others/user_manage.py
+++ b/tests/system-test/0-others/user_manage.py
@@ -12,12 +12,13 @@
# -*- coding: utf-8 -*-
import taos
-from util.log import *
+from taos.tmq import *
from util.cases import *
-from util.sql import *
from util.common import *
+from util.log import *
+from util.sql import *
from util.sqlset import *
-from taos.tmq import *
+
class TDTestCase:
def init(self, conn, logSql, replicaVar=1):
@@ -26,10 +27,10 @@ class TDTestCase:
tdSql.init(conn.cursor())
self.setsql = TDSetSql()
self.stbname = 'stb'
- self.binary_length = 20 # the length of binary for column_dict
+ self.binary_length = 20 # the length of binary for column_dict
self.nchar_length = 20 # the length of nchar for column_dict
self.column_dict = {
- 'ts' : 'timestamp',
+ 'ts': 'timestamp',
'col1': 'tinyint',
'col2': 'smallint',
'col3': 'int',
@@ -45,7 +46,7 @@ class TDTestCase:
'col13': f'nchar({self.nchar_length})'
}
self.tag_dict = {
- 'ts_tag' : 'timestamp',
+ 'ts_tag': 'timestamp',
't1': 'tinyint',
't2': 'smallint',
't3': 'int',
@@ -67,25 +68,28 @@ class TDTestCase:
f'now,1,2,3,4,5,6,7,8,9.9,10.1,true,"abcd","涛思数据"'
]
self.tbnum = 1
+
def prepare_data(self):
- tdSql.execute(self.setsql.set_create_stable_sql(self.stbname,self.column_dict,self.tag_dict))
+ tdSql.execute(self.setsql.set_create_stable_sql(self.stbname, self.column_dict, self.tag_dict))
for i in range(self.tbnum):
tdSql.execute(f'create table {self.stbname}_{i} using {self.stbname} tags({self.tag_list[i]})')
for j in self.values_list:
tdSql.execute(f'insert into {self.stbname}_{i} values({j})')
+
def create_user(self):
- for user_name in ['jiacy1_all','jiacy1_read','jiacy1_write','jiacy1_none','jiacy0_all','jiacy0_read','jiacy0_write','jiacy0_none']:
+ for user_name in ['jiacy1_all', 'jiacy1_read', 'jiacy1_write', 'jiacy1_none', 'jiacy0_all', 'jiacy0_read',
+ 'jiacy0_write', 'jiacy0_none']:
if 'jiacy1' in user_name.lower():
tdSql.execute(f'create user {user_name} pass "123" sysinfo 1')
elif 'jiacy0' in user_name.lower():
tdSql.execute(f'create user {user_name} pass "123" sysinfo 0')
- for user_name in ['jiacy1_all','jiacy1_read','jiacy0_all','jiacy0_read']:
+ for user_name in ['jiacy1_all', 'jiacy1_read', 'jiacy0_all', 'jiacy0_read']:
tdSql.execute(f'grant read on db to {user_name}')
- for user_name in ['jiacy1_all','jiacy1_write','jiacy0_all','jiacy0_write']:
+ for user_name in ['jiacy1_all', 'jiacy1_write', 'jiacy0_all', 'jiacy0_write']:
tdSql.execute(f'grant write on db to {user_name}')
def user_privilege_check(self):
- jiacy1_read_conn = taos.connect(user='jiacy1_read',password='123')
+ jiacy1_read_conn = taos.connect(user='jiacy1_read', password='123')
sql = "create table ntb (ts timestamp,c0 int)"
expectErrNotOccured = True
try:
@@ -94,32 +98,34 @@ class TDTestCase:
expectErrNotOccured = False
if expectErrNotOccured:
caller = inspect.getframeinfo(inspect.stack()[1][0])
- tdLog.exit(f"{caller.filename}({caller.lineno}) failed: sql:{sql}, expect error not occured" )
+ tdLog.exit(f"{caller.filename}({caller.lineno}) failed: sql:{sql}, expect error not occured")
else:
self.queryRows = 0
self.queryCols = 0
self.queryResult = None
tdLog.info(f"sql:{sql}, expect error occured")
pass
+
def drop_topic(self):
- jiacy1_all_conn = taos.connect(user='jiacy1_all',password='123')
- jiacy1_read_conn = taos.connect(user='jiacy1_read',password='123')
- jiacy1_write_conn = taos.connect(user='jiacy1_write',password='123')
- jiacy1_none_conn = taos.connect(user='jiacy1_none',password='123')
- jiacy0_all_conn = taos.connect(user='jiacy0_all',password='123')
- jiacy0_read_conn = taos.connect(user='jiacy0_read',password='123')
- jiacy0_write_conn = taos.connect(user='jiacy0_write',password='123')
- jiacy0_none_conn = taos.connect(user='jiacy0_none',password='123')
+ jiacy1_all_conn = taos.connect(user='jiacy1_all', password='123')
+ jiacy1_read_conn = taos.connect(user='jiacy1_read', password='123')
+ jiacy1_write_conn = taos.connect(user='jiacy1_write', password='123')
+ jiacy1_none_conn = taos.connect(user='jiacy1_none', password='123')
+ jiacy0_all_conn = taos.connect(user='jiacy0_all', password='123')
+ jiacy0_read_conn = taos.connect(user='jiacy0_read', password='123')
+ jiacy0_write_conn = taos.connect(user='jiacy0_write', password='123')
+ jiacy0_none_conn = taos.connect(user='jiacy0_none', password='123')
tdSql.execute('create topic root_db as select * from db.stb')
- for user in [jiacy1_all_conn,jiacy1_read_conn,jiacy0_all_conn,jiacy0_read_conn]:
+ for user in [jiacy1_all_conn, jiacy1_read_conn, jiacy0_all_conn, jiacy0_read_conn]:
user.execute(f'create topic db_jiacy as select * from db.stb')
user.execute('drop topic db_jiacy')
- for user in [jiacy1_write_conn,jiacy1_none_conn,jiacy0_write_conn,jiacy0_none_conn,jiacy1_all_conn,jiacy1_read_conn,jiacy0_all_conn,jiacy0_read_conn]:
+ for user in [jiacy1_write_conn, jiacy1_none_conn, jiacy0_write_conn, jiacy0_none_conn, jiacy1_all_conn,
+ jiacy1_read_conn, jiacy0_all_conn, jiacy0_read_conn]:
sql_list = []
- if user in [jiacy1_all_conn,jiacy1_read_conn,jiacy0_all_conn,jiacy0_read_conn]:
+ if user in [jiacy1_all_conn, jiacy1_read_conn, jiacy0_all_conn, jiacy0_read_conn]:
sql_list = ['drop topic root_db']
- elif user in [jiacy1_write_conn,jiacy1_none_conn,jiacy0_write_conn,jiacy0_none_conn]:
- sql_list = ['drop topic root_db','create topic db_jiacy as select * from db.stb']
+ elif user in [jiacy1_write_conn, jiacy1_none_conn, jiacy0_write_conn, jiacy0_none_conn]:
+ sql_list = ['drop topic root_db', 'create topic db_jiacy as select * from db.stb']
for sql in sql_list:
expectErrNotOccured = True
try:
@@ -128,33 +134,26 @@ class TDTestCase:
expectErrNotOccured = False
if expectErrNotOccured:
caller = inspect.getframeinfo(inspect.stack()[1][0])
- tdLog.exit(f"{caller.filename}({caller.lineno}) failed: sql:{sql}, expect error not occured" )
+ tdLog.exit(f"{caller.filename}({caller.lineno}) failed: sql:{sql}, expect error not occured")
else:
self.queryRows = 0
self.queryCols = 0
self.queryResult = None
tdLog.info(f"sql:{sql}, expect error occured")
+
def tmq_commit_cb_print(tmq, resp, param=None):
print(f"commit: {resp}, tmq: {tmq}, param: {param}")
+
def subscribe_topic(self):
print("create topic")
tdSql.execute('create topic db_topic as select * from db.stb')
tdSql.execute('grant subscribe on db_topic to jiacy1_all')
print("build consumer")
- conf = TaosTmqConf()
- conf.set("group.id", "tg2")
- conf.set("td.connect.user", "jiacy1_all")
- conf.set("td.connect.pass", "123")
- conf.set("enable.auto.commit", "true")
- conf.set_auto_commit_cb(self.tmq_commit_cb_print, None)
- tmq = conf.new_consumer()
+ tmq = Consumer({"group.id": "tg2", "td.connect.user": "jiacy1_all", "td.connect.pass": "123",
+ "enable.auto.commit": "true"})
print("build topic list")
- topic_list = TaosTmqList()
- topic_list.append("db_topic")
+ tmq.subscribe(["db_topic"])
print("basic consume loop")
- tmq.subscribe(topic_list)
- sub_list = tmq.subscription()
- print("subscribed topics: ", sub_list)
c = 0
l = 0
for i in range(10):
@@ -163,20 +162,23 @@ class TDTestCase:
res = tmq.poll(10)
print(f"loop {l}")
l += 1
- if res:
- c += 1
- topic = res.get_topic_name()
- vg = res.get_vgroup_id()
- db = res.get_db_name()
- print(f"topic: {topic}\nvgroup id: {vg}\ndb: {db}")
- for row in res:
- print(row)
- print("* committed")
- tmq.commit(res)
- else:
+ if not res:
print(f"received empty message at loop {l} (committed {c})")
- pass
-
+ continue
+ if res.error():
+ print(f"consumer error at loop {l} (committed {c}) {res.error()}")
+ continue
+
+ c += 1
+ topic = res.topic()
+ db = res.database()
+ print(f"topic: {topic}\ndb: {db}")
+
+ for row in res:
+ print(row.fetchall())
+ print("* committed")
+ tmq.commit(res)
+
def run(self):
tdSql.prepare()
self.create_user()
@@ -184,9 +186,11 @@ class TDTestCase:
self.drop_topic()
self.user_privilege_check()
self.subscribe_topic()
+
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
+tdCases.addLinux(__file__, TDTestCase())
diff --git a/tests/system-test/1-insert/insert_drop.py b/tests/system-test/1-insert/insert_drop.py
index 029d013d5bd82a00511df1fcef9755b9dee99259..930c65d90ef00cf318e03d49e4ff4afd4c1d41f3 100644
--- a/tests/system-test/1-insert/insert_drop.py
+++ b/tests/system-test/1-insert/insert_drop.py
@@ -31,6 +31,10 @@ class TDTestCase:
tdSql.execute('create database if not exists test;')
tdSql.execute('create table test.stb (ts timestamp, c11 int, c12 float ) TAGS(t11 int, t12 int );')
tdSql.execute('create table test.tb using test.stb TAGS (1, 1);')
+
+ # double comma insert check error
+ tdSql.error("insert into test.tb(ts, c11) values(now,,100)")
+
sql_list = list()
for i in range(5):
sql = f'insert into test.tb values (now-{i}m, {i}, {i});'
diff --git a/tests/system-test/2-query/case_when.py b/tests/system-test/2-query/case_when.py
index cfe03995538abcbd436e7ee3b4ed3fb714555a49..eebbcc3fa36fe2181f814f3a75a4f65e732a1e1f 100755
--- a/tests/system-test/2-query/case_when.py
+++ b/tests/system-test/2-query/case_when.py
@@ -111,6 +111,17 @@ class TDTestCase:
sql2 = "select (case when sum(q_smallint)=0 then null else sum(q_smallint) end) from %s.stable_1_1 limit 100;" %database
self.constant_check(database,sql1,sql2,0)
+ #TD-20257
+ sql1 = "select tbname,first(ts),q_int,q_smallint,q_bigint,case when q_int <0 then 1 else 0 end from %s.stable_1 where tbname = 'stable_1_1' and ts < now partition by tbname state_window(case when q_int <0 then 1 else 0 end);" %database
+ sql2 = "select tbname,first(ts),q_int,q_smallint,q_bigint,case when q_int <0 then 1 else 0 end from %s.stable_1_1 where ts < now partition by tbname state_window(case when q_int <0 then 1 else 0 end);" %database
+ self.constant_check(database,sql1,sql2,0)
+ self.constant_check(database,sql1,sql2,1)
+ self.constant_check(database,sql1,sql2,2)
+ self.constant_check(database,sql1,sql2,3)
+ self.constant_check(database,sql1,sql2,4)
+ self.constant_check(database,sql1,sql2,5)
+
+ #TD-20260
sql1 = "select _wstart,avg(q_int),min(q_smallint) from %s.stable_1 where tbname = 'stable_1_1' and ts < now state_window(case when q_smallint <0 then 1 else 0 end);" %database
sql2 = "select _wstart,avg(q_int),min(q_smallint) from %s.stable_1_1 where ts < now state_window(case when q_smallint <0 then 1 else 0 end);" %database
self.constant_check(database,sql1,sql2,0)
diff --git a/tests/system-test/2-query/interp.py b/tests/system-test/2-query/interp.py
index ce57357abda6564238362bcb861abab5e92f3947..d30575aaa3561e2c141b5f99768d8b7b6fd6c4a0 100644
--- a/tests/system-test/2-query/interp.py
+++ b/tests/system-test/2-query/interp.py
@@ -1850,15 +1850,16 @@ class TDTestCase:
tdSql.error(f"select interp('abcd') from {dbname}.{tbname} range('2020-02-10 00:00:05', '2020-02-15 00:00:05') every(1d) fill(null)")
tdSql.error(f"select interp('中文字符') from {dbname}.{tbname} range('2020-02-10 00:00:05', '2020-02-15 00:00:05') every(1d) fill(null)")
+
tdLog.printNoPrefix("==========step13:stable cases")
- #tdSql.query(f"select interp(c0) from {dbname}.{stbname} range('2020-02-01 00:00:04', '2020-02-01 00:00:16') every(1s) fill(null)")
+ tdSql.error(f"select interp(c0) from {dbname}.{stbname} range('2020-02-01 00:00:04', '2020-02-01 00:00:16') every(1s) fill(null)")
#tdSql.checkRows(13)
#tdSql.query(f"select interp(c0) from {dbname}.{ctbname1} range('2020-02-01 00:00:04', '2020-02-01 00:00:16') every(1s) fill(null)")
#tdSql.checkRows(13)
- #tdSql.query(f"select interp(c0) from {dbname}.{stbname} partition by tbname range('2020-02-01 00:00:04', '2020-02-02 00:00:16') every(1s) fill(null)")
+ tdSql.error(f"select interp(c0) from {dbname}.{stbname} partition by tbname range('2020-02-01 00:00:04', '2020-02-02 00:00:16') every(1s) fill(null)")
#tdSql.checkRows(13)
#tdSql.query(f"select _irowts,interp(c0) from {dbname}.{stbname} partition by tbname range('2020-02-01 00:00:04', '2020-02-02 00:00:16') every(1h) fill(prev)")
diff --git a/tests/system-test/2-query/max_min_data.py b/tests/system-test/2-query/max_min_data.py
new file mode 100755
index 0000000000000000000000000000000000000000..e3dff5da7854c595343f08b0990b4e436ea97a1c
--- /dev/null
+++ b/tests/system-test/2-query/max_min_data.py
@@ -0,0 +1,159 @@
+###################################################################
+# 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 random
+import os
+import time
+import taos
+import subprocess
+from faker import Faker
+from util.log import tdLog
+from util.cases import tdCases
+from util.sql import tdSql
+from util.dnodes import tdDnodes
+from util.dnodes import *
+
+class TDTestCase:
+ updatecfgDict = {'maxSQLLength':1048576,'debugFlag': 131 ,"querySmaOptimize":1}
+
+ def init(self, conn, logSql, replicaVar):
+ tdLog.debug("start to execute %s" % __file__)
+ tdSql.init(conn.cursor(), logSql)
+
+ self.testcasePath = os.path.split(__file__)[0]
+ self.testcaseFilename = os.path.split(__file__)[-1]
+ os.system("rm -rf %s/%s.sql" % (self.testcasePath,self.testcaseFilename))
+
+ self.db = "max_min"
+
+ def dropandcreateDB_random(self,database,n):
+ ts = 1630000000000
+ num_random = 5
+ fake = Faker('zh_CN')
+ tdSql.execute('''drop database if exists %s ;''' %database)
+ tdSql.execute('''create database %s keep 36500 ;'''%(database))
+ tdSql.execute('''use %s;'''%database)
+
+ tdSql.execute('''create stable %s.stable_1 (ts timestamp , q_int int , q_bigint bigint , q_smallint smallint , q_tinyint tinyint , q_float float , q_double double , q_bool bool , q_binary binary(100) , q_nchar nchar(100) , q_ts timestamp , \
+ q_int_null int , q_bigint_null bigint , q_smallint_null smallint , q_tinyint_null tinyint, q_float_null float , q_double_null double , q_bool_null bool , q_binary_null binary(20) , q_nchar_null nchar(20) , q_ts_null timestamp) \
+ tags(loc nchar(100) , t_int int , t_bigint bigint , t_smallint smallint , t_tinyint tinyint, t_bool bool , t_binary binary(100) , t_nchar nchar(100) ,t_float float , t_double double , t_ts timestamp);'''%database)
+
+ for i in range(num_random):
+ tdSql.execute('''create table %s.stable_1_%d using %s.stable_1 tags('stable_1_%d', '%d' , '%d', '%d' , '%d' , 1 , 'binary1.%s' , 'nchar1.%s' , '%f', '%f' ,'%d') ;'''
+ %(database,i,database,i,fake.random_int(min=-2147483647, max=2147483647, step=1), fake.random_int(min=-9223372036854775807, max=9223372036854775807, step=1),
+ fake.random_int(min=-32767, max=32767, step=1) , fake.random_int(min=-127, max=127, step=1) ,
+ fake.pystr() ,fake.pystr() ,fake.pyfloat(),fake.pyfloat(),fake.random_int(min=-2147483647, max=2147483647, step=1)))
+
+ # insert data
+ for i in range(num_random):
+ for j in range(n):
+ tdSql.execute('''insert into %s.stable_1_%d (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts)\
+ values(%d, %d, %d, %d, %d, %f, %f, 0, 'binary.%s', 'nchar.%s', %d) ;'''
+ % (database,i,ts + i*1000 + j, fake.random_int(min=-2147483647, max=2147483647, step=1),
+ fake.random_int(min=-9223372036854775807, max=9223372036854775807, step=1),
+ fake.random_int(min=-32767, max=32767, step=1) , fake.random_int(min=-127, max=127, step=1) ,
+ fake.pyfloat() , fake.pyfloat() , fake.pystr() , fake.pystr() , ts + i))
+
+ tdSql.query("select count(*) from %s.stable_1;" %database)
+ tdSql.checkData(0,0,num_random*n)
+ tdSql.query("select count(*) from %s.stable_1_1;"%database)
+ tdSql.checkData(0,0,n)
+
+
+ def TD_22219_max(self,database):
+
+ sql3 = "select count(*) from (select max(q_int) from %s.stable_1 group by tbname); ;" %database
+ tdSql.query(sql3)
+ sql_value = tdSql.getData(0,0)
+ self.value_check(sql_value,5)
+
+ sql1 = "select max(q_int) from %s.stable_1_1 ;" %database
+ sql2 = "select max(q_int) from %s.stable_1 where tbname = 'stable_1_1' ;" %database
+ self.constant_check(database,sql1,sql2,0)
+
+ sql3 = "select count(*) from (select max(q_int) from %s.stable_1 group by tbname); ;" %database
+ tdSql.query(sql3)
+ sql_value = tdSql.getData(0,0)
+ self.value_check(sql_value,5)
+
+ def TD_22219_min(self,database):
+
+ sql3 = "select count(*) from (select min(q_int) from %s.stable_1 group by tbname); ;" %database
+ tdSql.query(sql3)
+ sql_value = tdSql.getData(0,0)
+ self.value_check(sql_value,5)
+
+ sql1 = "select min(q_int) from %s.stable_1_1 ;" %database
+ sql2 = "select min(q_int) from %s.stable_1 where tbname = 'stable_1_1' ;" %database
+ self.constant_check(database,sql1,sql2,0)
+
+ sql3 = "select count(*) from (select min(q_int) from %s.stable_1 group by tbname); ;" %database
+ tdSql.query(sql3)
+ sql_value = tdSql.getData(0,0)
+ self.value_check(sql_value,5)
+
+ def constant_check(self,database,sql1,sql2,column):
+ #column =0 代表0列, column = n代表n-1列
+ tdLog.info("\n=============sql1:(%s)___sql2:(%s) ====================\n" %(sql1,sql2))
+
+ tdSql.query(sql1)
+ sql1_value = tdSql.getData(0,column)
+ tdSql.query(sql2)
+ sql2_value = tdSql.getData(0,column)
+ self.value_check(sql1_value,sql2_value)
+
+ tdSql.execute(" flush database %s;" %database)
+
+ time.sleep(3)
+
+ tdSql.query(sql1)
+ sql1_flush_value = tdSql.getData(0,column)
+ tdSql.query(sql2)
+ sql2_flush_value = tdSql.getData(0,column)
+ self.value_check(sql1_flush_value,sql2_flush_value)
+
+ self.value_check(sql1_value,sql1_flush_value)
+ self.value_check(sql2_value,sql2_flush_value)
+
+ def value_check(self,base_value,check_value):
+ if base_value==check_value:
+ tdLog.info(f"checkEqual success, base_value={base_value},check_value={check_value}")
+ else :
+ tdLog.exit(f"checkEqual error, base_value=={base_value},check_value={check_value}")
+
+ def run(self):
+
+ startTime = time.time()
+
+ os.system("rm -rf %s/%s.sql" % (self.testcasePath,self.testcaseFilename))
+
+ self.dropandcreateDB_random("%s" %self.db, 2000)
+
+ self.TD_22219_max("%s" %self.db)
+
+ self.dropandcreateDB_random("%s" %self.db, 2000)
+
+ self.TD_22219_min("%s" %self.db)
+
+ endTime = time.time()
+ print("total time %ds" % (endTime - startTime))
+
+
+
+ def stop(self):
+ tdSql.close()
+ tdLog.success("%s successfully executed" % __file__)
+
+
+tdCases.addWindows(__file__, TDTestCase())
+tdCases.addLinux(__file__, TDTestCase())
diff --git a/tests/system-test/2-query/max_min_last_interval.py b/tests/system-test/2-query/max_min_last_interval.py
new file mode 100644
index 0000000000000000000000000000000000000000..553060fd4c54b83b3a390ed954121d2ea155b91f
--- /dev/null
+++ b/tests/system-test/2-query/max_min_last_interval.py
@@ -0,0 +1,1711 @@
+# author : wenzhouwww
+from util.log import *
+from util.sql import *
+from util.cases import *
+
+class TDTestCase:
+ def init(self, conn, logSql, replicaVar=1):
+ self.replicaVar = int(replicaVar)
+ tdLog.debug("start to execute %s" % __file__)
+ tdSql.init(conn.cursor(), True)
+
+ def prepare_data(self):
+ tdSql.execute(f" CREATE TABLE `tb` (`ts` TIMESTAMP, `open` DOUBLE, `close` DOUBLE, `high` DOUBLE, `low` DOUBLE, `vol` DOUBLE, `amount` DOUBLE, `preclose` DOUBLE) ")
+
+ tdSql.execute(f"insert into tb values ('2020-01-02 09:31:00',11.2,11.08,11.24,11.06,907000.0,10149188.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 09:32:00',11.08,10.99,11.08,10.96,301000.0,3323031.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 09:33:00',10.99,11.05,11.08,10.95,269300.0,2966591.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 09:34:00',11.08,11.0,11.08,10.99,239100.0,2635055.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 09:35:00',10.99,10.94,10.99,10.93,267200.0,2926850.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 09:36:00',10.95,10.97,10.98,10.93,202300.0,2216126.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 09:37:00',10.98,10.96,10.99,10.96,206400.0,2263399.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 09:38:00',10.96,10.96,10.97,10.95,197900.0,2168095.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 09:39:00',10.96,10.94,10.98,10.93,133100.0,1457263.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 09:40:00',10.93,10.95,10.97,10.93,102400.0,1120751.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 09:41:00',10.93,10.93,10.95,10.91,175000.0,1912470.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 09:42:00',10.92,10.92,10.96,10.92,128000.0,1399009.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 09:43:00',10.95,10.92,10.97,10.92,201500.0,2202114.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 09:44:00',10.91,10.9,10.92,10.9,198300.0,2162914.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 09:45:00',10.9,10.86,10.9,10.84,319100.0,3468665.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 09:46:00',10.87,10.9,10.9,10.86,222700.0,2420930.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 09:47:00',10.9,10.89,10.93,10.88,126500.0,1379156.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 09:48:00',10.91,10.95,10.96,10.91,44600.0,487778.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 09:49:00',10.96,10.96,10.98,10.95,95300.0,1045077.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 09:50:00',10.94,10.97,10.99,10.93,161900.0,1775641.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 09:51:00',10.97,11.05,11.05,10.97,156300.0,1722227.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 09:52:00',11.05,11.06,11.08,11.04,194200.0,2146643.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 09:53:00',11.06,11.03,11.06,11.02,187000.0,2062967.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 09:54:00',11.02,11.01,11.03,11.0,60800.0,670041.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 09:55:00',11.01,11.07,11.07,11.01,186400.0,2056238.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 09:56:00',11.08,11.03,11.08,11.03,107100.0,1185077.5799999982,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 09:57:00',11.03,11.04,11.06,11.02,118700.0,1308724.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 09:58:00',11.03,11.05,11.06,11.03,23600.0,260707.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 09:59:00',11.05,11.03,11.05,11.03,38200.0,421723.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 10:00:00',11.03,11.04,11.05,11.03,77600.0,856134.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 10:01:00',11.04,11.03,11.04,11.03,34000.0,375159.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 10:02:00',11.04,11.04,11.05,11.03,67900.0,749782.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 10:03:00',11.05,11.04,11.06,11.04,67822.0,749311.8800000027,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 10:04:00',11.04,11.04,11.05,11.03,39878.0,440388.8999999985,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 10:05:00',11.04,11.04,11.04,11.03,10000.0,110358.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 10:06:00',11.04,11.02,11.04,11.02,71200.0,785535.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 10:07:00',11.02,11.04,11.04,11.02,41500.0,457611.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 10:08:00',11.03,11.04,11.05,11.03,11700.0,129195.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 10:09:00',11.04,11.03,11.05,11.02,173300.0,1913275.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 10:10:00',11.03,11.04,11.04,11.02,70000.0,771276.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 10:11:00',11.03,11.06,11.06,11.02,169200.0,1869131.1400000006,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 10:12:00',11.06,11.07,11.07,11.05,64800.0,716812.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 10:13:00',11.06,11.06,11.07,11.06,16400.0,181433.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 10:14:00',11.06,11.11,11.11,11.06,298500.0,3307379.5,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 10:15:00',11.11,11.11,11.14,11.11,95000.0,1056803.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 10:16:00',11.14,11.12,11.15,11.12,196300.0,2186954.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 10:17:00',11.12,11.12,11.15,11.12,169000.0,1881848.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 10:18:00',11.13,11.15,11.15,11.13,58700.0,653823.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 10:19:00',11.15,11.13,11.15,11.13,183100.0,2040752.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 10:20:00',11.13,11.13,11.14,11.12,57600.0,641102.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 10:21:00',11.13,11.14,11.14,11.13,89700.0,998969.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 10:22:00',11.14,11.11,11.14,11.11,50500.0,561017.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 10:23:00',11.1,11.12,11.12,11.1,83300.0,925194.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 10:24:00',11.12,11.09,11.12,11.09,15100.0,167627.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 10:25:00',11.1,11.1,11.11,11.1,8600.0,95462.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 10:26:00',11.09,11.12,11.17,11.09,270300.0,3011716.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 10:27:00',11.12,11.18,11.18,11.12,69600.0,777739.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 10:28:00',11.17,11.19,11.2,11.17,237400.0,2655762.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 10:29:00',11.19,11.21,11.21,11.18,103400.0,1157957.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 10:30:00',11.21,11.18,11.21,11.16,58000.0,649227.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 10:31:00',11.17,11.2,11.2,11.17,187000.0,2093130.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 10:32:00',11.21,11.23,11.25,11.2,212000.0,2378486.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 10:33:00',11.24,11.34,11.34,11.23,501637.0,5661866.099999994,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 10:34:00',11.33,11.41,11.42,11.31,612000.0,6956284.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 10:35:00',11.41,11.38,11.45,11.38,575600.0,6575579.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 10:36:00',11.38,11.39,11.39,11.35,328800.0,3738689.4900000095,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 10:37:00',11.35,11.41,11.41,11.35,230516.0,2626204.4399999976,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 10:38:00',11.4,11.36,11.4,11.35,137497.0,1562526.9200000018,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 10:39:00',11.36,11.37,11.39,11.33,249100.0,2828453.7099999934,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 10:40:00',11.35,11.35,11.37,11.34,205987.0,2340070.950000003,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 10:41:00',11.35,11.4,11.4,11.35,149496.0,1702321.1899999976,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 10:42:00',11.38,11.41,11.42,11.38,342971.0,3909339.100000009,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 10:43:00',11.41,11.4,11.42,11.39,291326.0,3322693.9799999893,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 10:44:00',11.4,11.48,11.48,11.4,443425.0,5075111.1400000155,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 10:45:00',11.46,11.44,11.46,11.44,125734.0,1439362.2999999821,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 10:46:00',11.44,11.44,11.45,11.44,152887.0,1750929.900000006,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 10:47:00',11.45,11.44,11.46,11.44,81013.0,927533.7199999988,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 10:48:00',11.43,11.4,11.44,11.4,79475.0,907338.5,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 10:49:00',11.4,11.4,11.43,11.36,167652.0,1911327.0600000024,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 10:50:00',11.41,11.39,11.41,11.38,23800.0,271169.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 10:51:00',11.38,11.37,11.39,11.37,36761.0,418027.56999999285,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 10:52:00',11.38,11.38,11.39,11.37,109039.0,1240554.9900000095,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 10:53:00',11.37,11.37,11.4,11.37,189396.0,2156768.5200000107,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 10:54:00',11.39,11.37,11.39,11.37,104404.0,1187164.4799999893,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 10:55:00',11.37,11.35,11.37,11.35,86980.0,988150.8000000119,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 10:56:00',11.35,11.37,11.37,11.34,96736.0,1097808.599999994,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 10:57:00',11.36,11.36,11.38,11.36,62323.0,708217.2800000012,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 10:58:00',11.37,11.34,11.37,11.34,135782.0,1541601.1499999762,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 10:59:00',11.35,11.34,11.35,11.34,38379.0,435287.8600000143,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 11:00:00',11.34,11.36,11.36,11.34,56176.0,637639.8400000036,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 11:01:00',11.36,11.36,11.37,11.35,56000.0,636169.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 11:02:00',11.35,11.38,11.38,11.35,120151.0,1365796.3599999845,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 11:03:00',11.38,11.4,11.4,11.37,91258.0,1039128.0400000215,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 11:04:00',11.4,11.39,11.4,11.38,86994.0,991647.6599999964,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 11:05:00',11.39,11.38,11.4,11.38,75903.0,864927.2199999988,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 11:06:00',11.4,11.4,11.4,11.39,37100.0,422815.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 11:07:00',11.4,11.39,11.4,11.39,64900.0,739346.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 11:08:00',11.39,11.38,11.39,11.38,58600.0,666998.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 11:09:00',11.38,11.4,11.4,11.36,144417.0,1644390.650000006,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 11:10:00',11.37,11.4,11.4,11.35,59152.0,673655.7599999905,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 11:11:00',11.41,11.4,11.41,11.39,48700.0,555351.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 11:12:00',11.4,11.42,11.42,11.39,79800.0,910197.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 11:13:00',11.41,11.43,11.44,11.41,49000.0,559999.3400000036,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 11:14:00',11.43,11.44,11.44,11.43,65900.0,753786.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 11:15:00',11.44,11.43,11.44,11.43,21200.0,242402.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 11:16:00',11.43,11.43,11.44,11.43,77900.0,890539.0499999821,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 11:17:00',11.42,11.42,11.43,11.41,72600.0,828962.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 11:18:00',11.42,11.38,11.42,11.38,127200.0,1451263.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 11:19:00',11.38,11.41,11.41,11.38,35700.0,406927.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 11:20:00',11.4,11.41,11.41,11.4,17900.0,204224.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 11:21:00',11.41,11.41,11.41,11.4,44400.0,506283.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 11:22:00',11.41,11.4,11.41,11.4,101700.0,1159426.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 11:23:00',11.4,11.38,11.4,11.36,61548.0,700285.2400000095,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 11:24:00',11.36,11.38,11.38,11.35,20852.0,237018.75999999046,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 11:25:00',11.37,11.36,11.37,11.36,36548.0,415406.24000000954,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 11:26:00',11.35,11.36,11.37,11.35,52800.0,599478.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 11:27:00',11.36,11.35,11.36,11.35,51200.0,581300.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 11:28:00',11.35,11.34,11.36,11.34,45700.0,518665.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 11:29:00',11.34,11.32,11.34,11.32,47883.0,542748.2199999988,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 11:30:00',11.32,11.33,11.33,11.32,37000.0,419126.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 13:01:00',11.33,11.33,11.35,11.33,82917.0,939614.2800000012,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 13:02:00',11.33,11.31,11.34,11.31,58750.0,665362.5,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 13:03:00',11.31,11.31,11.32,11.31,90400.0,1022443.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 13:04:00',11.32,11.31,11.32,11.3,120900.0,1366511.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 13:05:00',11.31,11.32,11.32,11.3,106400.0,1203291.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 13:06:00',11.32,11.36,11.36,11.32,67000.0,759965.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 13:07:00',11.36,11.36,11.37,11.34,95400.0,1083468.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 13:08:00',11.36,11.33,11.37,11.33,93900.0,1066666.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 13:09:00',11.33,11.34,11.34,11.32,37900.0,429351.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 13:10:00',11.33,11.33,11.33,11.32,26300.0,297964.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 13:11:00',11.33,11.28,11.33,11.28,90600.0,1024723.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 13:12:00',11.29,11.28,11.3,11.27,114839.0,1295492.9200000167,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 13:13:00',11.28,11.28,11.29,11.28,48300.0,544981.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 13:14:00',11.28,11.28,11.29,11.27,68561.0,773163.0799999833,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 13:15:00',11.28,11.27,11.29,11.27,84300.0,950882.6100000143,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 13:16:00',11.27,11.27,11.28,11.27,32000.0,360755.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 13:17:00',11.27,11.26,11.27,11.26,42220.0,475777.1999999881,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 13:18:00',11.26,11.25,11.26,11.25,37480.0,421951.8000000119,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 13:19:00',11.25,11.26,11.26,11.25,8800.0,99066.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 13:20:00',11.26,11.26,11.26,11.25,36400.0,409669.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 13:21:00',11.26,11.24,11.26,11.24,43500.0,489525.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 13:22:00',11.24,11.24,11.25,11.24,42500.0,477967.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 13:23:00',11.25,11.25,11.25,11.24,27500.0,309368.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 13:24:00',11.25,11.25,11.26,11.25,14800.0,166644.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 13:25:00',11.25,11.25,11.26,11.25,6300.0,70906.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 13:26:00',11.25,11.26,11.26,11.25,31500.0,354602.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 13:27:00',11.25,11.27,11.27,11.25,34500.0,388590.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 13:28:00',11.26,11.26,11.27,11.26,42700.0,481092.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 13:29:00',11.27,11.27,11.27,11.25,86020.0,968959.3999999762,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 13:30:00',11.27,11.26,11.28,11.26,28180.0,317608.60000002384,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 13:31:00',11.26,11.26,11.27,11.26,10620.0,119642.19999998808,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 13:32:00',11.26,11.26,11.27,11.26,72200.0,813073.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 13:33:00',11.26,11.26,11.27,11.26,29400.0,331219.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 13:34:00',11.26,11.27,11.27,11.26,14400.0,162189.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 13:35:00',11.27,11.25,11.27,11.25,22480.0,253073.80000001192,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 13:36:00',11.25,11.25,11.26,11.25,26600.0,299455.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 13:37:00',11.25,11.26,11.26,11.25,80520.0,906359.1999999881,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 13:38:00',11.27,11.25,11.27,11.25,16180.0,182079.80000001192,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 13:39:00',11.25,11.23,11.26,11.23,106000.0,1191411.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 13:40:00',11.23,11.23,11.24,11.23,91100.0,1023446.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 13:41:00',11.23,11.22,11.24,11.22,35400.0,397556.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 13:42:00',11.23,11.2,11.23,11.2,172700.0,1936596.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 13:43:00',11.21,11.19,11.21,11.19,89700.0,1004799.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 13:44:00',11.2,11.19,11.2,11.18,57100.0,639239.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 13:45:00',11.19,11.2,11.2,11.19,67595.0,756911.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 13:46:00',11.2,11.2,11.21,11.2,115000.0,1288434.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 13:47:00',11.19,11.2,11.2,11.19,27200.0,304467.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 13:48:00',11.19,11.19,11.19,11.18,43700.0,488802.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 13:49:00',11.19,11.19,11.19,11.18,48700.0,544675.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 13:50:00',11.19,11.19,11.22,11.18,98500.0,1103443.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 13:51:00',11.19,11.2,11.21,11.19,67500.0,756052.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 13:52:00',11.2,11.2,11.22,11.19,43600.0,488300.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 13:53:00',11.2,11.2,11.2,11.19,52600.0,589105.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 13:54:00',11.2,11.2,11.2,11.19,60300.0,675155.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 13:55:00',11.2,11.19,11.2,11.18,59100.0,661067.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 13:56:00',11.19,11.2,11.21,11.18,68700.0,768996.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 13:57:00',11.2,11.21,11.22,11.19,74900.0,839752.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 13:58:00',11.22,11.21,11.22,11.21,9600.0,107664.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 13:59:00',11.21,11.21,11.22,11.21,20900.0,234373.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 14:00:00',11.22,11.23,11.24,11.21,68500.0,768957.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 14:01:00',11.23,11.24,11.24,11.23,30200.0,339429.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 14:02:00',11.25,11.22,11.25,11.22,38700.0,434942.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 14:03:00',11.22,11.24,11.25,11.22,58720.0,660538.3999999762,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 14:04:00',11.24,11.24,11.25,11.24,19400.0,218099.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 14:05:00',11.25,11.24,11.25,11.23,31100.0,349744.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 14:06:00',11.24,11.24,11.24,11.23,6500.0,73064.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 14:07:00',11.24,11.23,11.24,11.22,21200.0,238054.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 14:08:00',11.22,11.22,11.24,11.22,6300.0,70731.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 14:09:00',11.22,11.22,11.24,11.22,5600.0,62878.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 14:10:00',11.22,11.23,11.23,11.22,5600.0,62866.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 14:11:00',11.23,11.24,11.24,11.22,36000.0,404370.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 14:12:00',11.24,11.24,11.25,11.22,55300.0,622032.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 14:13:00',11.25,11.23,11.25,11.23,32600.0,366576.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 14:14:00',11.23,11.24,11.25,11.23,21000.0,236082.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 14:15:00',11.24,11.26,11.26,11.24,64500.0,725876.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 14:16:00',11.26,11.27,11.28,11.26,82200.0,926583.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 14:17:00',11.27,11.26,11.28,11.26,45600.0,514013.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 14:18:00',11.27,11.26,11.27,11.26,17400.0,195986.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 14:19:00',11.27,11.27,11.29,11.27,273200.0,3082769.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 14:20:00',11.27,11.3,11.3,11.27,175039.0,1977112.3100000024,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 14:21:00',11.31,11.33,11.34,11.31,128300.0,1453462.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 14:22:00',11.33,11.35,11.35,11.32,66700.0,756208.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 14:23:00',11.34,11.35,11.36,11.34,121700.0,1381218.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 14:24:00',11.36,11.35,11.37,11.35,66600.0,756737.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 14:25:00',11.35,11.36,11.38,11.35,132600.0,1507997.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 14:26:00',11.38,11.39,11.4,11.37,149180.0,1699236.400000006,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 14:27:00',11.39,11.37,11.39,11.36,35820.0,407303.59999999404,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 14:28:00',11.37,11.35,11.38,11.35,47900.0,544627.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 14:29:00',11.35,11.37,11.37,11.35,17400.0,197656.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 14:30:00',11.36,11.35,11.36,11.35,87300.0,991027.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 14:31:00',11.35,11.39,11.4,11.35,138680.0,1578201.400000006,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 14:32:00',11.39,11.4,11.4,11.39,180200.0,2054110.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 14:33:00',11.4,11.41,11.41,11.39,114300.0,1303708.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 14:34:00',11.42,11.4,11.42,11.4,160600.0,1833388.1299999952,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 14:35:00',11.41,11.41,11.42,11.4,97538.0,1112477.580000013,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 14:36:00',11.41,11.43,11.43,11.41,192487.0,2198982.5399999917,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 14:37:00',11.43,11.44,11.45,11.43,389100.0,4451469.3900000155,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 14:38:00',11.44,11.44,11.44,11.43,62400.0,713725.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 14:39:00',11.44,11.43,11.44,11.43,41100.0,469907.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 14:40:00',11.43,11.43,11.44,11.43,180100.0,2058619.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 14:41:00',11.43,11.41,11.44,11.41,83900.0,959046.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 14:42:00',11.41,11.39,11.41,11.39,53100.0,605290.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 14:43:00',11.39,11.38,11.39,11.38,97700.0,1112686.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 14:44:00',11.38,11.37,11.39,11.37,57500.0,654477.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 14:45:00',11.37,11.4,11.4,11.37,312900.0,3565077.99999997,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 14:46:00',11.4,11.41,11.41,11.4,98500.0,1123762.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 14:47:00',11.41,11.42,11.43,11.41,159600.0,1822511.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 14:48:00',11.42,11.42,11.42,11.41,123400.0,1409109.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 14:49:00',11.42,11.41,11.43,11.41,154100.0,1760238.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 14:50:00',11.41,11.42,11.44,11.41,361300.0,4130568.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 14:51:00',11.42,11.45,11.45,11.42,231257.0,2645775.370000005,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 14:52:00',11.44,11.44,11.45,11.43,295700.0,3384133.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 14:53:00',11.41,11.41,11.44,11.41,97500.0,1114794.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 14:54:00',11.42,11.43,11.44,11.41,145700.0,1665211.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 14:55:00',11.41,11.39,11.42,11.36,110743.0,1260564.6299999952,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 14:56:00',11.36,11.37,11.38,11.35,110700.0,1257857.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 14:57:00',11.37,11.39,11.39,11.37,91600.0,1042258.4300000072,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-02 15:00:00',11.35,11.35,11.35,11.35,648000.0,7354800.0,11.02)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 09:31:00',11.27,11.35,11.35,11.27,194597.0,2194477.45,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 09:32:00',11.31,11.31,11.36,11.3,97600.0,1104836.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 09:33:00',11.31,11.25,11.33,11.25,142700.0,1610769.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 09:34:00',11.28,11.28,11.3,11.26,89100.0,1004739.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 09:35:00',11.28,11.27,11.28,11.26,65300.0,735698.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 09:36:00',11.27,11.25,11.27,11.23,198700.0,2235096.999999999,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 09:37:00',11.23,11.26,11.26,11.23,153800.0,1728714.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 09:38:00',11.26,11.32,11.32,11.26,59500.0,672484.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 09:39:00',11.33,11.39,11.4,11.33,250800.0,2849183.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 09:40:00',11.41,11.38,11.41,11.37,108200.0,1231972.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 09:41:00',11.39,11.33,11.41,11.33,146000.0,1662606.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 09:42:00',11.34,11.36,11.37,11.34,132600.0,1506245.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 09:43:00',11.35,11.44,11.44,11.35,422058.0,4811030.879999999,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 09:44:00',11.42,11.42,11.44,11.42,106200.0,1213679.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 09:45:00',11.42,11.39,11.42,11.36,102300.0,1166319.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 09:46:00',11.39,11.39,11.41,11.38,88100.0,1003877.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 09:47:00',11.39,11.35,11.4,11.35,132700.0,1508598.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 09:48:00',11.35,11.33,11.36,11.31,120300.0,1363681.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 09:49:00',11.32,11.32,11.33,11.3,118200.0,1337038.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 09:50:00',11.32,11.34,11.34,11.31,154300.0,1747209.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 09:51:00',11.34,11.34,11.35,11.31,192000.0,2176691.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 09:52:00',11.33,11.34,11.35,11.33,159100.0,1804359.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 09:53:00',11.34,11.35,11.35,11.31,245200.0,2779151.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 09:54:00',11.36,11.38,11.39,11.36,119800.0,1361758.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 09:55:00',11.37,11.37,11.38,11.36,41000.0,466342.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 09:56:00',11.36,11.35,11.37,11.35,35000.0,397418.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 09:57:00',11.36,11.34,11.36,11.3,160300.0,1814162.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 09:58:00',11.34,11.34,11.35,11.32,22300.0,252845.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 09:59:00',11.34,11.35,11.35,11.34,112600.0,1277749.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 10:00:00',11.34,11.34,11.35,11.34,65800.0,746178.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 10:01:00',11.34,11.32,11.34,11.3,226400.0,2561501.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 10:02:00',11.32,11.34,11.35,11.28,138200.0,1563277.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 10:03:00',11.34,11.34,11.34,11.3,63800.0,722991.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 10:04:00',11.34,11.34,11.35,11.34,39100.0,443617.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 10:05:00',11.35,11.35,11.35,11.33,81200.0,921373.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 10:06:00',11.35,11.35,11.36,11.35,85200.0,967050.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 10:07:00',11.36,11.37,11.37,11.35,135300.0,1537200.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 10:08:00',11.35,11.36,11.38,11.35,69700.0,791922.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 10:09:00',11.36,11.41,11.41,11.36,296500.0,3376310.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 10:10:00',11.41,11.41,11.42,11.4,163800.0,1869800.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 10:11:00',11.42,11.42,11.43,11.41,61900.0,706871.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 10:12:00',11.42,11.4,11.42,11.4,21600.0,246423.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 10:13:00',11.4,11.38,11.4,11.37,43000.0,489339.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 10:14:00',11.38,11.39,11.39,11.37,31200.0,355056.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 10:15:00',11.38,11.38,11.39,11.37,71400.0,812399.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 10:16:00',11.38,11.37,11.38,11.37,18300.0,208100.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 10:17:00',11.37,11.31,11.37,11.31,211200.0,2394958.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 10:18:00',11.32,11.35,11.36,11.3,146900.0,1661582.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 10:19:00',11.35,11.34,11.35,11.32,28600.0,324130.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 10:20:00',11.34,11.35,11.35,11.34,61900.0,701699.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 10:21:00',11.35,11.34,11.35,11.34,46900.0,531869.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 10:22:00',11.34,11.35,11.35,11.34,23600.0,267713.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 10:23:00',11.35,11.35,11.35,11.34,32200.0,365336.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 10:24:00',11.34,11.34,11.35,11.3,285800.0,3234866.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 10:25:00',11.34,11.31,11.35,11.3,45600.0,515771.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 10:26:00',11.34,11.34,11.34,11.32,72300.0,820048.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 10:27:00',11.34,11.34,11.35,11.34,41900.0,475051.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 10:28:00',11.34,11.35,11.35,11.34,46800.0,530896.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 10:29:00',11.35,11.34,11.35,11.33,118000.0,1338109.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 10:30:00',11.34,11.33,11.35,11.33,61300.0,695369.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 10:31:00',11.33,11.34,11.35,11.33,24500.0,277860.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 10:32:00',11.34,11.34,11.35,11.33,27800.0,315082.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 10:33:00',11.34,11.34,11.35,11.33,48500.0,549676.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 10:34:00',11.34,11.35,11.35,11.34,10400.0,117943.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 10:35:00',11.35,11.34,11.35,11.34,13600.0,154225.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 10:36:00',11.34,11.34,11.35,11.34,13700.0,155372.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 10:37:00',11.34,11.34,11.34,11.34,83600.0,947807.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 10:38:00',11.32,11.34,11.35,11.32,130300.0,1475481.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 10:39:00',11.34,11.33,11.35,11.32,41700.0,473008.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 10:40:00',11.33,11.33,11.35,11.33,60200.0,682238.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 10:41:00',11.34,11.35,11.35,11.33,36200.0,410228.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 10:42:00',11.34,11.33,11.35,11.32,122600.0,1389382.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 10:43:00',11.33,11.32,11.34,11.3,107600.0,1217485.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 10:44:00',11.32,11.33,11.34,11.32,52700.0,597355.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 10:45:00',11.34,11.31,11.34,11.31,30100.0,340572.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 10:46:00',11.31,11.3,11.32,11.29,57600.0,651033.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 10:47:00',11.3,11.29,11.3,11.29,13200.0,149081.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 10:48:00',11.29,11.29,11.3,11.29,25600.0,289111.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 10:49:00',11.29,11.29,11.3,11.29,25600.0,289165.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 10:50:00',11.29,11.27,11.3,11.27,115900.0,1308000.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 10:51:00',11.25,11.27,11.27,11.25,153300.0,1725374.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 10:52:00',11.28,11.27,11.28,11.27,32400.0,365219.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 10:53:00',11.27,11.25,11.28,11.25,81000.0,912142.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 10:54:00',11.25,11.27,11.27,11.24,99400.0,1118078.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 10:55:00',11.27,11.27,11.27,11.26,27800.0,313174.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 10:56:00',11.27,11.28,11.28,11.27,12000.0,135354.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 10:57:00',11.27,11.27,11.28,11.27,15600.0,175857.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 10:58:00',11.27,11.26,11.28,11.26,75400.0,849417.799999997,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 10:59:00',11.26,11.29,11.29,11.25,114481.0,1289693.8700000048,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 11:00:00',11.29,11.28,11.29,11.28,23200.0,261798.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 11:01:00',11.29,11.31,11.31,11.28,52900.0,597503.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 11:02:00',11.31,11.33,11.33,11.3,52800.0,597613.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 11:03:00',11.32,11.33,11.33,11.3,57400.0,648994.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 11:04:00',11.31,11.3,11.32,11.29,55500.0,627200.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 11:05:00',11.29,11.3,11.3,11.29,4600.0,51942.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 11:06:00',11.3,11.29,11.3,11.26,92600.0,1043860.1899999976,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 11:07:00',11.29,11.27,11.29,11.26,51100.0,575911.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 11:08:00',11.29,11.27,11.29,11.26,46100.0,519247.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 11:09:00',11.27,11.28,11.29,11.27,17700.0,199690.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 11:10:00',11.28,11.28,11.29,11.28,28400.0,320413.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 11:11:00',11.28,11.26,11.28,11.26,31400.0,353981.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 11:12:00',11.26,11.21,11.26,11.21,177800.0,1996944.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 11:13:00',11.22,11.23,11.24,11.22,119200.0,1337770.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 11:14:00',11.23,11.21,11.23,11.19,375600.0,4207714.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 11:15:00',11.21,11.21,11.22,11.21,88300.0,990017.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 11:16:00',11.21,11.2,11.22,11.2,125300.0,1403274.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 11:17:00',11.19,11.19,11.21,11.19,101800.0,1139480.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 11:18:00',11.2,11.2,11.21,11.19,99900.0,1118379.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 11:19:00',11.21,11.2,11.21,11.2,33800.0,378602.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 11:20:00',11.2,11.18,11.2,11.18,136400.0,1525650.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 11:21:00',11.18,11.22,11.22,11.18,114100.0,1278375.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 11:22:00',11.22,11.29,11.3,11.22,155400.0,1750586.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 11:23:00',11.3,11.26,11.3,11.26,32500.0,366525.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 11:24:00',11.27,11.32,11.32,11.27,105400.0,1190886.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 11:25:00',11.32,11.33,11.34,11.32,94200.0,1067788.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 11:26:00',11.34,11.34,11.35,11.33,97700.0,1107909.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 11:27:00',11.34,11.32,11.35,11.3,45900.0,519877.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 11:28:00',11.31,11.34,11.34,11.3,67100.0,760368.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 11:29:00',11.34,11.35,11.36,11.33,107300.0,1217725.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 11:30:00',11.34,11.33,11.35,11.33,31900.0,361717.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 13:01:00',11.33,11.3,11.33,11.3,163800.0,1854874.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 13:02:00',11.32,11.28,11.32,11.28,18800.0,212606.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 13:03:00',11.3,11.3,11.32,11.29,15100.0,170797.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 13:04:00',11.32,11.33,11.33,11.31,32500.0,367922.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 13:05:00',11.33,11.32,11.33,11.32,45900.0,520010.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 13:06:00',11.33,11.32,11.34,11.32,47500.0,538081.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 13:07:00',11.33,11.32,11.33,11.32,11000.0,124532.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 13:08:00',11.32,11.33,11.33,11.32,6900.0,78146.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 13:09:00',11.33,11.29,11.33,11.29,48500.0,548417.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 13:10:00',11.28,11.3,11.3,11.28,57300.0,647167.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 13:11:00',11.29,11.31,11.32,11.29,105600.0,1193513.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 13:12:00',11.31,11.3,11.31,11.3,37300.0,421730.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 13:13:00',11.3,11.29,11.3,11.29,15300.0,172751.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 13:14:00',11.29,11.3,11.3,11.29,11900.0,134382.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 13:15:00',11.3,11.25,11.3,11.25,86300.0,972690.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 13:16:00',11.25,11.26,11.27,11.25,40600.0,457406.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 13:17:00',11.26,11.26,11.28,11.26,33900.0,381866.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 13:18:00',11.26,11.26,11.26,11.24,77400.0,870776.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 13:19:00',11.26,11.27,11.27,11.26,45800.0,516044.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 13:20:00',11.27,11.25,11.27,11.25,48500.0,545868.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 13:21:00',11.25,11.28,11.28,11.25,36000.0,405597.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 13:22:00',11.27,11.26,11.28,11.26,39300.0,442846.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 13:23:00',11.26,11.28,11.29,11.26,53800.0,606769.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 13:24:00',11.29,11.29,11.3,11.28,40600.0,458601.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 13:25:00',11.29,11.3,11.3,11.29,47200.0,533344.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 13:26:00',11.3,11.29,11.3,11.29,83200.0,940090.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 13:27:00',11.3,11.32,11.32,11.29,46000.0,520109.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 13:28:00',11.32,11.29,11.32,11.29,31300.0,353497.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 13:29:00',11.29,11.28,11.3,11.27,83600.0,943134.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 13:30:00',11.28,11.3,11.31,11.27,114800.0,1296517.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 13:31:00',11.3,11.28,11.3,11.28,36500.0,411963.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 13:32:00',11.28,11.3,11.3,11.27,86600.0,976856.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 13:33:00',11.3,11.31,11.32,11.3,84400.0,954039.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 13:34:00',11.32,11.33,11.33,11.32,65600.0,742678.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 13:35:00',11.33,11.31,11.33,11.3,69500.0,786158.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 13:36:00',11.32,11.35,11.35,11.31,113900.0,1290451.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 13:37:00',11.34,11.33,11.34,11.32,28800.0,326397.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 13:38:00',11.33,11.34,11.34,11.32,57900.0,656048.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 13:39:00',11.34,11.35,11.35,11.34,56300.0,638545.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 13:40:00',11.35,11.35,11.35,11.31,167700.0,1902036.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 13:41:00',11.35,11.32,11.35,11.31,30300.0,343412.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 13:42:00',11.32,11.33,11.33,11.32,37600.0,425811.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 13:43:00',11.33,11.33,11.33,11.32,30500.0,345472.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 13:44:00',11.33,11.34,11.34,11.32,101700.0,1152481.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 13:45:00',11.34,11.34,11.35,11.33,95600.0,1084045.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 13:46:00',11.34,11.35,11.35,11.33,136400.0,1547277.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 13:47:00',11.34,11.34,11.35,11.33,78900.0,894651.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 13:48:00',11.34,11.35,11.35,11.34,121000.0,1372921.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 13:49:00',11.35,11.35,11.35,11.34,155300.0,1762140.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 13:50:00',11.35,11.34,11.35,11.33,87200.0,988809.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 13:51:00',11.33,11.34,11.34,11.32,67500.0,764699.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 13:52:00',11.34,11.34,11.34,11.33,31000.0,351343.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 13:53:00',11.34,11.33,11.34,11.32,76700.0,869290.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 13:54:00',11.34,11.34,11.34,11.33,72000.0,816172.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 13:55:00',11.34,11.33,11.34,11.32,42700.0,484008.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 13:56:00',11.33,11.35,11.35,11.33,97800.0,1109167.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 13:57:00',11.35,11.34,11.35,11.34,86000.0,975752.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 13:58:00',11.34,11.35,11.35,11.34,79900.0,906431.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 13:59:00',11.35,11.35,11.36,11.33,136400.0,1548251.6100000143,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 14:00:00',11.36,11.35,11.36,11.35,102100.0,1159249.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 14:01:00',11.35,11.36,11.36,11.35,89500.0,1016304.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 14:02:00',11.36,11.34,11.36,11.33,74400.0,844382.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 14:03:00',11.34,11.36,11.36,11.33,230300.0,2613617.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 14:04:00',11.35,11.36,11.36,11.35,164200.0,1864718.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 14:05:00',11.36,11.35,11.36,11.35,38500.0,437274.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 14:06:00',11.36,11.35,11.36,11.35,169800.0,1928068.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 14:07:00',11.36,11.4,11.4,11.36,536539.0,6100661.039999992,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 14:08:00',11.4,11.41,11.42,11.39,389800.0,4444539.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 14:09:00',11.4,11.41,11.41,11.4,204300.0,2331075.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 14:10:00',11.4,11.41,11.41,11.4,129400.0,1475937.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 14:11:00',11.41,11.43,11.43,11.41,218700.0,2497043.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 14:12:00',11.42,11.44,11.44,11.42,136100.0,1555541.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 14:13:00',11.44,11.54,11.54,11.43,1018100.0,11692577.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 14:14:00',11.52,11.51,11.53,11.5,422400.0,4866632.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 14:15:00',11.51,11.48,11.52,11.47,227100.0,2612523.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 14:16:00',11.49,11.49,11.5,11.48,198900.0,2285029.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 14:17:00',11.49,11.5,11.51,11.49,334700.0,3849974.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 14:18:00',11.5,11.5,11.5,11.48,253100.0,2910151.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 14:19:00',11.5,11.5,11.51,11.5,115400.0,1327508.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 14:20:00',11.5,11.54,11.54,11.5,832200.0,9587661.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 14:21:00',11.53,11.54,11.54,11.52,247600.0,2856077.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 14:22:00',11.54,11.53,11.54,11.52,69100.0,796877.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 14:23:00',11.52,11.52,11.53,11.51,106400.0,1226086.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 14:24:00',11.52,11.52,11.52,11.51,37100.0,427228.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 14:25:00',11.52,11.52,11.53,11.51,86500.0,996272.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 14:26:00',11.52,11.52,11.52,11.51,39400.0,453704.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 14:27:00',11.52,11.52,11.53,11.51,116597.0,1343284.4399999976,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 14:28:00',11.52,11.51,11.53,11.51,57400.0,660893.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 14:29:00',11.51,11.51,11.52,11.5,100600.0,1157549.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 14:30:00',11.51,11.5,11.51,11.5,32600.0,374987.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 14:31:00',11.5,11.45,11.51,11.45,92900.0,1067509.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 14:32:00',11.45,11.47,11.47,11.45,62700.0,719896.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 14:33:00',11.45,11.5,11.51,11.45,65100.0,747497.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 14:34:00',11.5,11.5,11.5,11.48,116900.0,1344482.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 14:35:00',11.5,11.5,11.5,11.49,67500.0,776201.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 14:36:00',11.5,11.49,11.51,11.46,112000.0,1287819.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 14:37:00',11.49,11.45,11.49,11.45,51000.0,584774.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 14:38:00',11.45,11.45,11.45,11.43,48300.0,552505.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 14:39:00',11.44,11.45,11.46,11.43,99100.0,1133866.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 14:40:00',11.42,11.43,11.45,11.4,188100.0,2148202.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 14:41:00',11.43,11.45,11.45,11.42,203400.0,2325646.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 14:42:00',11.45,11.44,11.45,11.43,232900.0,2664436.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 14:43:00',11.44,11.45,11.45,11.44,207700.0,2377790.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 14:44:00',11.44,11.47,11.47,11.44,313400.0,3590603.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 14:45:00',11.47,11.46,11.47,11.46,256700.0,2944280.99999997,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 14:46:00',11.45,11.48,11.48,11.45,220754.0,2531230.380000055,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 14:47:00',11.48,11.48,11.48,11.47,262500.0,3013403.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 14:48:00',11.48,11.47,11.48,11.46,55146.0,632740.6199999452,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 14:49:00',11.46,11.43,11.46,11.43,44500.0,509405.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 14:50:00',11.44,11.4,11.44,11.4,138000.0,1575039.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 14:51:00',11.4,11.42,11.43,11.4,27700.0,316131.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 14:52:00',11.42,11.43,11.44,11.41,84700.0,968231.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 14:53:00',11.43,11.44,11.45,11.43,30000.0,343186.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 14:54:00',11.43,11.43,11.44,11.43,64517.0,737698.3100000024,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 14:55:00',11.43,11.42,11.44,11.42,84600.0,967217.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 14:56:00',11.42,11.43,11.43,11.41,92300.0,1053894.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 14:57:00',11.42,11.42,11.42,11.41,39200.0,447526.0,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-03 15:00:00',11.42,11.42,11.42,11.42,172054.0,1964856.6800000072,11.35)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 09:31:00',11.55,11.6,11.65,11.55,907400.0,10511377.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 09:32:00',11.6,11.63,11.64,11.59,551900.0,6414024.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 09:33:00',11.64,11.7,11.71,11.64,591300.0,6900202.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 09:34:00',11.7,11.76,11.76,11.7,626000.0,7350773.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 09:35:00',11.77,11.73,11.78,11.73,551600.0,6482611.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 09:36:00',11.73,11.73,11.74,11.71,376500.0,4414561.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 09:37:00',11.72,11.68,11.73,11.68,307100.0,3594829.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 09:38:00',11.66,11.62,11.7,11.61,441200.0,5139836.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 09:39:00',11.61,11.62,11.64,11.6,335900.0,3902614.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 09:40:00',11.63,11.58,11.64,11.55,530800.0,6161605.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 09:41:00',11.55,11.54,11.58,11.53,223000.0,2577635.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 09:42:00',11.55,11.56,11.57,11.52,244400.0,2821957.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 09:43:00',11.55,11.58,11.58,11.55,346300.0,4006971.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 09:44:00',11.57,11.56,11.57,11.55,199700.0,2307770.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 09:45:00',11.56,11.56,11.58,11.56,188200.0,2177986.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 09:46:00',11.57,11.54,11.57,11.54,188500.0,2179350.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 09:47:00',11.54,11.53,11.56,11.53,140500.0,1622212.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 09:48:00',11.54,11.49,11.54,11.49,274100.0,3157452.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 09:49:00',11.49,11.52,11.52,11.48,249800.0,2872306.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 09:50:00',11.52,11.53,11.53,11.52,354000.0,4081214.620000005,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 09:51:00',11.53,11.53,11.54,11.52,143158.0,1650281.7399999946,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 09:52:00',11.54,11.53,11.54,11.51,308400.0,3556988.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 09:53:00',11.55,11.59,11.6,11.54,418100.0,4838869.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 09:54:00',11.59,11.58,11.6,11.58,134600.0,1559841.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 09:55:00',11.58,11.54,11.58,11.54,86000.0,993791.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 09:56:00',11.54,11.55,11.55,11.52,31900.0,367830.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 09:57:00',11.54,11.54,11.55,11.54,27500.0,317423.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 09:58:00',11.54,11.53,11.55,11.53,45100.0,520180.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 09:59:00',11.53,11.52,11.54,11.52,52000.0,599342.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 10:00:00',11.52,11.53,11.53,11.51,31100.0,358222.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 10:01:00',11.52,11.5,11.52,11.5,116100.0,1336027.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 10:02:00',11.5,11.5,11.5,11.49,67600.0,776937.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 10:03:00',11.49,11.48,11.5,11.48,94900.0,1090210.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 10:04:00',11.49,11.46,11.49,11.45,159660.0,1830713.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 10:05:00',11.45,11.44,11.47,11.44,447140.0,5118904.799999997,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 10:06:00',11.44,11.5,11.5,11.44,329660.0,3781580.600000009,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 10:07:00',11.5,11.5,11.5,11.49,140100.0,1610940.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 10:08:00',11.5,11.5,11.5,11.49,59900.0,688429.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 10:09:00',11.5,11.5,11.5,11.48,73200.0,841193.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 10:10:00',11.5,11.49,11.5,11.48,112700.0,1295175.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 10:11:00',11.48,11.48,11.49,11.47,104400.0,1198557.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 10:12:00',11.48,11.49,11.49,11.47,46200.0,530456.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 10:13:00',11.49,11.47,11.49,11.47,51300.0,588862.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 10:14:00',11.47,11.48,11.48,11.47,39200.0,449688.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 10:15:00',11.48,11.46,11.48,11.46,40800.0,468080.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 10:16:00',11.47,11.46,11.47,11.46,97300.0,1115636.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 10:17:00',11.46,11.47,11.47,11.46,45300.0,519462.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 10:18:00',11.47,11.46,11.47,11.46,30600.0,350741.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 10:19:00',11.46,11.46,11.47,11.46,41900.0,480414.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 10:20:00',11.47,11.46,11.47,11.46,82800.0,949611.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 10:21:00',11.46,11.47,11.47,11.46,89300.0,1024060.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 10:22:00',11.47,11.47,11.48,11.47,14800.0,169762.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 10:23:00',11.47,11.47,11.48,11.47,49700.0,570458.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 10:24:00',11.47,11.48,11.48,11.47,140600.0,1613876.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 10:25:00',11.48,11.49,11.49,11.47,117100.0,1344288.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 10:26:00',11.48,11.48,11.49,11.47,45000.0,516889.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 10:27:00',11.48,11.47,11.48,11.47,24900.0,285679.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 10:28:00',11.47,11.46,11.47,11.46,14200.0,162770.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 10:29:00',11.46,11.46,11.47,11.46,62300.0,714038.9999999851,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 10:30:00',11.46,11.45,11.46,11.45,45600.0,522439.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 10:31:00',11.45,11.44,11.46,11.44,78100.0,894275.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 10:32:00',11.44,11.44,11.45,11.43,117000.0,1338227.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 10:33:00',11.43,11.43,11.44,11.42,133125.0,1521295.5,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 10:34:00',11.43,11.41,11.43,11.4,159775.0,1823829.25,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 10:35:00',11.41,11.42,11.42,11.4,35500.0,405026.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 10:36:00',11.41,11.41,11.42,11.41,50300.0,574030.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 10:37:00',11.41,11.41,11.42,11.41,96300.0,1099034.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 10:38:00',11.41,11.41,11.41,11.41,74300.0,848177.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 10:39:00',11.41,11.42,11.42,11.41,39800.0,454243.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 10:40:00',11.41,11.42,11.42,11.41,45800.0,522904.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 10:41:00',11.42,11.42,11.42,11.41,38700.0,441801.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 10:42:00',11.42,11.41,11.42,11.41,193100.0,2203593.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 10:43:00',11.41,11.42,11.42,11.41,90200.0,1030064.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 10:44:00',11.42,11.42,11.43,11.42,51000.0,582499.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 10:45:00',11.42,11.42,11.43,11.42,46800.0,534543.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 10:46:00',11.42,11.42,11.43,11.41,70000.0,799187.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 10:47:00',11.41,11.41,11.42,11.41,17800.0,203125.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 10:48:00',11.41,11.41,11.42,11.41,108200.0,1235494.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 10:49:00',11.41,11.41,11.42,11.41,12700.0,144949.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 10:50:00',11.41,11.41,11.42,11.41,13400.0,152967.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 10:51:00',11.42,11.42,11.42,11.41,23200.0,264790.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 10:52:00',11.42,11.42,11.42,11.41,20000.0,228277.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 10:53:00',11.42,11.41,11.42,11.41,45600.0,520600.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 10:54:00',11.41,11.41,11.42,11.41,57700.0,658434.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 10:55:00',11.41,11.43,11.43,11.41,95100.0,1086338.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 10:56:00',11.42,11.43,11.44,11.42,194200.0,2219316.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 10:57:00',11.44,11.44,11.44,11.43,10600.0,121253.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 10:58:00',11.44,11.44,11.44,11.43,21900.0,250530.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 10:59:00',11.44,11.43,11.44,11.43,20400.0,233338.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 11:00:00',11.43,11.43,11.44,11.43,21900.0,250432.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 11:01:00',11.43,11.44,11.45,11.43,84600.0,967784.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 11:02:00',11.44,11.44,11.45,11.44,84400.0,966311.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 11:03:00',11.45,11.45,11.46,11.44,20100.0,230191.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 11:04:00',11.45,11.45,11.46,11.45,9400.0,107641.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 11:05:00',11.45,11.45,11.46,11.45,11000.0,126014.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 11:06:00',11.45,11.46,11.46,11.45,9400.0,107655.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 11:07:00',11.46,11.45,11.46,11.45,16900.0,193589.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 11:08:00',11.45,11.45,11.46,11.45,15400.0,176385.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 11:09:00',11.46,11.45,11.46,11.45,11600.0,132837.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 11:10:00',11.45,11.45,11.46,11.45,9600.0,109943.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 11:11:00',11.45,11.45,11.46,11.45,7500.0,85935.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 11:12:00',11.45,11.45,11.46,11.45,36500.0,418061.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 11:13:00',11.45,11.46,11.46,11.45,23100.0,264636.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 11:14:00',11.45,11.45,11.46,11.45,31100.0,356124.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 11:15:00',11.45,11.46,11.46,11.44,43000.0,492335.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 11:16:00',11.44,11.45,11.45,11.44,13500.0,154609.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 11:17:00',11.44,11.44,11.45,11.44,14900.0,170494.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 11:18:00',11.44,11.43,11.44,11.43,25200.0,288287.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 11:19:00',11.44,11.44,11.45,11.43,25800.0,295068.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 11:20:00',11.44,11.44,11.45,11.43,15000.0,171581.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 11:21:00',11.44,11.45,11.47,11.44,135600.0,1553718.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 11:22:00',11.47,11.49,11.49,11.44,211800.0,2430527.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 11:23:00',11.5,11.47,11.52,11.47,467537.0,5376870.129999995,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 11:24:00',11.47,11.49,11.5,11.47,70700.0,812462.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 11:25:00',11.49,11.49,11.51,11.49,119800.0,1377527.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 11:26:00',11.49,11.51,11.52,11.49,101800.0,1171902.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 11:27:00',11.52,11.51,11.52,11.51,23800.0,274100.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 11:28:00',11.52,11.52,11.52,11.51,109000.0,1255624.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 11:29:00',11.52,11.53,11.53,11.52,94100.0,1084933.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 11:30:00',11.53,11.53,11.54,11.53,46900.0,540799.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 13:01:00',11.53,11.56,11.56,11.53,225500.0,2604097.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 13:02:00',11.56,11.6,11.6,11.56,282100.0,3268939.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 13:03:00',11.6,11.63,11.64,11.59,247500.0,2874935.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 13:04:00',11.63,11.64,11.66,11.62,214100.0,2493356.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 13:05:00',11.66,11.67,11.69,11.63,243700.0,2842458.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 13:06:00',11.66,11.62,11.66,11.6,155300.0,1803920.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 13:07:00',11.62,11.63,11.63,11.6,35666.0,414469.9200000167,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 13:08:00',11.63,11.62,11.63,11.58,73800.0,856028.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 13:09:00',11.62,11.64,11.65,11.62,182200.0,2120971.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 13:10:00',11.64,11.64,11.65,11.6,186800.0,2172908.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 13:11:00',11.61,11.61,11.65,11.6,99200.0,1152563.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 13:12:00',11.62,11.6,11.63,11.59,223000.0,2587443.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 13:13:00',11.6,11.62,11.64,11.6,80000.0,929742.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 13:14:00',11.61,11.64,11.64,11.61,27922.0,324605.4199999869,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 13:15:00',11.64,11.63,11.64,11.62,66900.0,778431.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 13:16:00',11.63,11.62,11.65,11.62,122700.0,1428421.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 13:17:00',11.62,11.61,11.63,11.61,41600.0,483220.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 13:18:00',11.61,11.59,11.61,11.58,27678.0,321095.5800000131,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 13:19:00',11.59,11.58,11.59,11.56,47800.0,553382.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 13:20:00',11.58,11.59,11.6,11.56,42500.0,492765.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 13:21:00',11.6,11.58,11.6,11.58,43000.0,498714.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 13:22:00',11.59,11.59,11.59,11.58,31800.0,368312.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 13:23:00',11.59,11.58,11.59,11.57,21400.0,247778.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 13:24:00',11.58,11.57,11.58,11.56,32900.0,380588.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 13:25:00',11.56,11.59,11.59,11.56,42500.0,492084.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 13:26:00',11.58,11.6,11.6,11.58,83800.0,971768.5600000024,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 13:27:00',11.61,11.6,11.61,11.59,8300.0,96299.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 13:28:00',11.59,11.59,11.6,11.58,28900.0,334873.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 13:29:00',11.59,11.56,11.59,11.56,39500.0,457397.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 13:30:00',11.56,11.56,11.57,11.56,74200.0,858157.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 13:31:00',11.56,11.57,11.58,11.55,54800.0,633943.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 13:32:00',11.58,11.62,11.62,11.57,108600.0,1259501.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 13:33:00',11.62,11.6,11.62,11.6,126200.0,1466016.7800000012,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 13:34:00',11.6,11.6,11.63,11.6,218481.0,2536886.599999994,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 13:35:00',11.59,11.59,11.6,11.59,104619.0,1212764.400000006,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 13:36:00',11.6,11.58,11.6,11.56,97200.0,1126019.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 13:37:00',11.58,11.6,11.61,11.58,44700.0,518282.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 13:38:00',11.6,11.62,11.63,11.6,79400.0,922199.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 13:39:00',11.64,11.65,11.66,11.62,123692.0,1440583.6599999964,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 13:40:00',11.65,11.66,11.67,11.65,118500.0,1381623.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 13:41:00',11.65,11.65,11.66,11.64,51600.0,601051.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 13:42:00',11.65,11.66,11.67,11.65,85032.0,991095.4799999893,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 13:43:00',11.66,11.65,11.67,11.65,53900.0,628537.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 13:44:00',11.66,11.65,11.67,11.64,75600.0,881482.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 13:45:00',11.65,11.74,11.74,11.65,556691.0,6512344.060000002,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 13:46:00',11.74,11.72,11.74,11.71,158700.0,1861696.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 13:47:00',11.71,11.68,11.72,11.68,106100.0,1241840.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 13:48:00',11.69,11.68,11.69,11.67,128300.0,1498924.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 13:49:00',11.67,11.65,11.67,11.65,97709.0,1139307.9399999976,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 13:50:00',11.65,11.66,11.67,11.64,112791.0,1314383.0600000024,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 13:51:00',11.67,11.66,11.67,11.65,28600.0,333553.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 13:52:00',11.65,11.65,11.67,11.65,102700.0,1198039.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 13:53:00',11.66,11.65,11.67,11.65,92900.0,1082923.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 13:54:00',11.65,11.67,11.67,11.65,93217.0,1087300.3900000155,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 13:55:00',11.67,11.67,11.68,11.66,42483.0,495909.6099999845,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 13:56:00',11.66,11.69,11.69,11.66,72317.0,844650.2199999988,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 13:57:00',11.69,11.69,11.7,11.67,47000.0,549292.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 13:58:00',11.68,11.68,11.69,11.67,52500.0,613395.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 13:59:00',11.67,11.67,11.68,11.66,32900.0,384062.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 14:00:00',11.66,11.68,11.68,11.66,42400.0,494808.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 14:01:00',11.67,11.66,11.68,11.65,39983.0,466337.7800000012,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 14:02:00',11.66,11.65,11.66,11.65,59200.0,690117.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 14:03:00',11.65,11.65,11.66,11.64,41500.0,483686.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 14:04:00',11.65,11.67,11.67,11.65,55000.0,641485.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 14:05:00',11.65,11.66,11.67,11.65,52900.0,616666.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 14:06:00',11.65,11.64,11.66,11.64,73200.0,852847.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 14:07:00',11.64,11.63,11.64,11.62,84500.0,983285.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 14:08:00',11.63,11.64,11.64,11.62,67000.0,779341.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 14:09:00',11.63,11.59,11.63,11.59,90900.0,1055733.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 14:10:00',11.59,11.58,11.6,11.57,119300.0,1382200.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 14:11:00',11.57,11.6,11.6,11.56,66800.0,773697.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 14:12:00',11.58,11.57,11.6,11.56,106500.0,1233529.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 14:13:00',11.56,11.57,11.57,11.55,179100.0,2070229.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 14:14:00',11.57,11.58,11.58,11.56,122573.0,1418386.8799999952,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 14:15:00',11.58,11.6,11.6,11.57,71800.0,832365.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 14:16:00',11.59,11.59,11.6,11.57,84100.0,975112.5400000215,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 14:17:00',11.6,11.54,11.6,11.54,131527.0,1520418.3899999857,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 14:18:00',11.54,11.54,11.54,11.53,252300.0,2911447.00000003,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 14:19:00',11.55,11.55,11.55,11.53,106700.0,1232067.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 14:20:00',11.54,11.57,11.57,11.54,97473.0,1126292.1499999762,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 14:21:00',11.55,11.57,11.57,11.55,35800.0,414117.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 14:22:00',11.57,11.58,11.58,11.56,70900.0,820610.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 14:23:00',11.57,11.56,11.58,11.56,69300.0,801902.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 14:24:00',11.57,11.59,11.59,11.55,72700.0,841462.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 14:25:00',11.59,11.6,11.61,11.58,68500.0,794432.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 14:26:00',11.6,11.64,11.65,11.6,271400.0,3158497.0799999833,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 14:27:00',11.64,11.63,11.64,11.6,76700.0,891695.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 14:28:00',11.63,11.66,11.66,11.61,179698.0,2092381.699999988,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 14:29:00',11.66,11.69,11.7,11.66,287400.0,3357436.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 14:30:00',11.66,11.69,11.7,11.66,76200.0,890817.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 14:31:00',11.69,11.68,11.69,11.67,73300.0,856869.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 14:32:00',11.68,11.69,11.7,11.68,159200.0,1861908.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 14:33:00',11.71,11.7,11.71,11.69,107600.0,1258925.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 14:34:00',11.71,11.73,11.73,11.7,123200.0,1443006.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 14:35:00',11.73,11.71,11.73,11.71,72400.0,848655.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 14:36:00',11.71,11.71,11.72,11.71,89600.0,1049816.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 14:37:00',11.71,11.7,11.72,11.7,49500.0,579364.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 14:38:00',11.7,11.7,11.71,11.7,49890.0,583867.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 14:39:00',11.7,11.7,11.71,11.7,69100.0,808827.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 14:40:00',11.71,11.7,11.71,11.69,273000.0,3194146.100000024,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 14:41:00',11.7,11.71,11.71,11.69,335100.0,3921236.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 14:42:00',11.71,11.7,11.71,11.69,225400.0,2637167.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 14:43:00',11.7,11.7,11.71,11.69,45200.0,528885.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 14:44:00',11.71,11.7,11.71,11.69,48276.0,564936.1999999881,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 14:45:00',11.7,11.68,11.7,11.67,24500.0,286204.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 14:46:00',11.67,11.7,11.71,11.67,109654.0,1282759.2599999905,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 14:47:00',11.71,11.72,11.72,11.71,165489.0,1938800.1899999976,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 14:48:00',11.72,11.73,11.73,11.72,75900.0,889822.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 14:49:00',11.73,11.72,11.73,11.72,80500.0,943968.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 14:50:00',11.72,11.73,11.73,11.72,124200.0,1456271.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 14:51:00',11.73,11.75,11.75,11.73,390600.0,4586597.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 14:52:00',11.74,11.78,11.78,11.74,563135.0,6625838.950000048,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 14:53:00',11.78,11.78,11.78,11.76,270700.0,3188454.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 14:54:00',11.79,11.81,11.82,11.78,688760.0,8125004.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 14:55:00',11.81,11.8,11.81,11.78,284500.0,3357734.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 14:56:00',11.8,11.77,11.8,11.73,431600.0,5073451.199999988,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 14:57:00',11.76,11.78,11.78,11.76,108700.0,1279095.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-06 15:00:00',11.78,11.78,11.78,11.78,229300.0,2701154.0,11.42)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 09:31:00',11.56,11.59,11.65,11.56,357700.0,4145450.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 09:32:00',11.6,11.61,11.63,11.59,169200.0,1964288.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 09:33:00',11.6,11.62,11.62,11.6,159000.0,1846577.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 09:34:00',11.62,11.6,11.63,11.6,252705.0,2934441.9000000004,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 09:35:00',11.61,11.59,11.61,11.53,461495.0,5341009.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 09:36:00',11.58,11.64,11.64,11.58,161200.0,1871636.9999999981,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 09:37:00',11.64,11.7,11.7,11.63,364400.0,4250718.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 09:38:00',11.7,11.72,11.72,11.66,282400.0,3301811.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 09:39:00',11.69,11.72,11.74,11.69,239200.0,2804372.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 09:40:00',11.73,11.78,11.8,11.73,247800.0,2915690.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 09:41:00',11.78,11.81,11.82,11.78,283837.0,3347461.490000002,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 09:42:00',11.8,11.77,11.8,11.76,119463.0,1407704.7699999958,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 09:43:00',11.75,11.77,11.78,11.74,170600.0,2005333.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 09:44:00',11.77,11.77,11.78,11.71,238900.0,2811370.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 09:45:00',11.77,11.75,11.77,11.73,57500.0,675187.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 09:46:00',11.72,11.7,11.72,11.7,53500.0,626781.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 09:47:00',11.7,11.72,11.72,11.68,100000.0,1168537.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 09:48:00',11.72,11.7,11.72,11.7,50800.0,594895.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 09:49:00',11.69,11.69,11.7,11.67,173900.0,2032259.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 09:50:00',11.66,11.68,11.69,11.66,92000.0,1074240.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 09:51:00',11.68,11.69,11.69,11.68,51300.0,599440.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 09:52:00',11.69,11.72,11.72,11.69,86600.0,1013644.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 09:53:00',11.72,11.74,11.75,11.71,86292.0,1012255.1600000039,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 09:54:00',11.74,11.71,11.74,11.69,86508.0,1013349.9200000018,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 09:55:00',11.7,11.72,11.73,11.68,58300.0,682105.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 09:56:00',11.72,11.68,11.72,11.67,75700.0,885433.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 09:57:00',11.68,11.69,11.7,11.67,87200.0,1018693.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 09:58:00',11.69,11.68,11.69,11.67,33900.0,395908.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 09:59:00',11.68,11.68,11.69,11.67,51300.0,599246.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 10:00:00',11.67,11.67,11.67,11.65,79500.0,927279.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 10:01:00',11.68,11.65,11.68,11.64,100200.0,1167971.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 10:02:00',11.65,11.64,11.65,11.62,132400.0,1540544.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 10:03:00',11.64,11.66,11.66,11.62,101000.0,1175748.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 10:04:00',11.66,11.67,11.67,11.65,45900.0,535318.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 10:05:00',11.67,11.64,11.67,11.62,100900.0,1174982.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 10:06:00',11.64,11.7,11.71,11.62,270600.0,3159453.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 10:07:00',11.7,11.72,11.76,11.65,305700.0,3587904.9999999925,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 10:08:00',11.72,11.72,11.75,11.7,19300.0,225823.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 10:09:00',11.72,11.73,11.74,11.72,46000.0,539458.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 10:10:00',11.73,11.74,11.75,11.73,29100.0,341638.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 10:11:00',11.74,11.71,11.75,11.71,61000.0,715473.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 10:12:00',11.72,11.72,11.74,11.7,76400.0,894294.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 10:13:00',11.72,11.75,11.82,11.72,271300.0,3196803.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 10:14:00',11.8,11.84,11.85,11.8,210500.0,2489891.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 10:15:00',11.84,11.84,11.84,11.81,155800.0,1843780.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 10:16:00',11.84,11.94,11.95,11.84,355200.0,4231674.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 10:17:00',11.94,11.92,11.96,11.9,476500.0,5683660.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 10:18:00',11.92,11.91,11.93,11.9,213100.0,2538189.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 10:19:00',11.9,11.89,11.92,11.89,165800.0,1974602.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 10:20:00',11.89,11.91,11.91,11.89,168289.0,2003160.5900000036,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 10:21:00',11.91,11.9,11.91,11.88,212451.0,2528443.4099999964,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 10:22:00',11.89,11.92,11.93,11.89,180864.0,2153663.0900000036,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 10:23:00',11.92,11.95,11.96,11.92,137700.0,1644217.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 10:24:00',11.95,12.0,12.0,11.95,535700.0,6420378.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 10:25:00',12.0,12.04,12.04,12.0,297600.0,3578211.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 10:26:00',12.02,12.0,12.02,11.98,253100.0,3038148.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 10:27:00',12.0,12.0,12.01,11.98,194400.0,2332786.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 10:28:00',12.0,12.0,12.0,11.95,379000.0,4543717.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 10:29:00',12.0,12.04,12.04,12.0,198400.0,2385253.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 10:30:00',12.03,12.01,12.05,12.01,166000.0,1996865.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 10:31:00',12.0,11.97,12.01,11.97,181000.0,2169715.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 10:32:00',11.97,11.99,11.99,11.96,140900.0,1688177.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 10:33:00',11.98,11.95,11.98,11.94,111332.0,1331464.7600000054,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 10:34:00',11.96,12.0,12.01,11.94,167800.0,2009925.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 10:35:00',12.01,12.01,12.01,11.99,126400.0,1517584.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 10:36:00',11.99,12.0,12.01,11.98,212000.0,2543336.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 10:37:00',12.0,12.0,12.0,11.99,116900.0,1402478.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 10:38:00',12.0,12.0,12.0,11.98,129600.0,1555010.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 10:39:00',11.99,12.0,12.01,11.98,80900.0,970864.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 10:40:00',12.0,12.0,12.01,11.99,126700.0,1521066.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 10:41:00',12.0,12.0,12.01,11.99,76600.0,919096.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 10:42:00',12.0,12.0,12.01,11.99,74000.0,887990.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 10:43:00',12.0,12.0,12.02,12.0,83000.0,996610.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 10:44:00',12.0,12.02,12.03,12.0,58700.0,705384.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 10:45:00',12.02,12.0,12.03,12.0,52500.0,631011.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 10:46:00',12.0,11.95,12.0,11.95,130100.0,1559162.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 10:47:00',11.95,11.92,11.95,11.92,126168.0,1506029.2400000095,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 10:48:00',11.92,11.93,11.93,11.9,203532.0,2424166.799999982,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 10:49:00',11.93,11.93,11.96,11.93,101990.0,1216607.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 10:50:00',11.91,11.9,11.95,11.9,127800.0,1521916.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 10:51:00',11.91,11.91,11.94,11.9,25900.0,308867.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 10:52:00',11.91,11.95,11.95,11.91,53500.0,639014.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 10:53:00',11.94,11.96,11.97,11.93,51400.0,614166.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 10:54:00',11.97,11.95,11.97,11.95,58500.0,699540.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 10:55:00',11.95,11.97,11.98,11.95,38200.0,457136.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 10:56:00',11.98,11.97,11.99,11.95,158300.0,1894970.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 10:57:00',11.97,11.97,11.98,11.95,40600.0,485976.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 10:58:00',11.97,11.99,12.0,11.96,161300.0,1932126.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 10:59:00',11.99,12.01,12.01,11.99,51900.0,622760.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 11:00:00',12.0,11.98,12.01,11.98,47800.0,573467.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 11:01:00',11.98,11.99,12.0,11.98,27600.0,330951.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 11:02:00',11.99,11.99,11.99,11.98,18100.0,216966.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 11:03:00',11.99,11.98,11.99,11.98,35800.0,429223.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 11:04:00',11.98,11.98,11.99,11.98,68300.0,818610.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 11:05:00',11.98,11.97,11.99,11.97,42500.0,509153.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 11:06:00',11.97,11.99,11.99,11.96,34700.0,415733.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 11:07:00',11.99,11.97,12.0,11.96,21100.0,252874.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 11:08:00',11.97,11.96,11.99,11.96,24800.0,296937.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 11:09:00',11.96,11.95,11.98,11.95,29500.0,353064.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 11:10:00',11.95,11.95,11.96,11.95,33700.0,402950.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 11:11:00',11.96,11.96,11.97,11.95,36200.0,433011.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 11:12:00',11.96,11.96,11.97,11.96,16400.0,196199.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 11:13:00',11.96,11.97,11.98,11.96,10500.0,125645.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 11:14:00',11.97,11.97,11.98,11.97,15300.0,183249.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 11:15:00',11.98,11.99,11.99,11.98,45500.0,545452.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 11:16:00',11.99,12.01,12.02,11.99,151560.0,1819663.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 11:17:00',12.01,12.03,12.03,12.01,88900.0,1068800.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 11:18:00',12.02,12.03,12.03,12.01,145800.0,1754099.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 11:19:00',12.03,12.06,12.06,12.03,265200.0,3196467.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 11:20:00',12.06,12.08,12.08,12.06,94200.0,1136842.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 11:21:00',12.08,12.08,12.09,12.07,215467.0,2602713.0200000107,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 11:22:00',12.08,12.12,12.13,12.08,189310.0,2291281.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 11:23:00',12.13,12.09,12.14,12.09,150000.0,1818077.900000006,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 11:24:00',12.09,12.1,12.12,12.09,64300.0,778390.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 11:25:00',12.1,12.1,12.1,12.09,68500.0,828968.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 11:26:00',12.11,12.09,12.12,12.09,120700.0,1460715.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 11:27:00',12.09,12.08,12.1,12.08,109690.0,1326097.099999994,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 11:28:00',12.08,12.06,12.09,12.06,92400.0,1116280.900000006,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 11:29:00',12.06,12.06,12.08,12.06,57600.0,695067.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 11:30:00',12.07,12.09,12.09,12.06,26500.0,319971.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 13:01:00',12.09,12.07,12.1,12.07,129400.0,1564192.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 13:02:00',12.07,12.05,12.07,12.05,113333.0,1367652.9799999893,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 13:03:00',12.06,12.04,12.06,12.04,61400.0,739896.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 13:04:00',12.04,12.02,12.05,12.02,89300.0,1074425.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 13:05:00',12.02,12.01,12.03,12.01,106200.0,1276014.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 13:06:00',12.01,11.99,12.02,11.99,86840.0,1042156.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 13:07:00',11.99,12.0,12.02,11.99,92660.0,1111983.400000006,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 13:08:00',12.01,12.0,12.01,12.0,85900.0,1031328.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 13:09:00',12.0,11.98,12.0,11.97,57240.0,685716.599999994,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 13:10:00',11.97,11.96,11.97,11.96,68800.0,823265.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 13:11:00',11.96,11.95,11.96,11.93,97000.0,1158998.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 13:12:00',11.96,11.96,11.96,11.93,42860.0,512292.59999999404,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 13:13:00',11.96,11.98,11.98,11.96,59000.0,706154.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 13:14:00',11.98,11.98,12.0,11.97,73140.0,876933.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 13:15:00',11.97,11.95,11.98,11.95,73500.0,879475.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 13:16:00',11.96,11.96,11.98,11.95,44400.0,530969.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 13:17:00',11.96,11.94,11.96,11.94,36100.0,431383.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 13:18:00',11.94,11.93,11.95,11.93,46900.0,559719.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 13:19:00',11.93,11.89,11.93,11.89,145900.0,1737848.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 13:20:00',11.89,11.91,11.93,11.88,65300.0,777135.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 13:21:00',11.93,11.92,11.93,11.9,72100.0,858756.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 13:22:00',11.91,11.92,11.92,11.91,43400.0,517449.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 13:23:00',11.92,11.92,11.93,11.92,76200.0,908618.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 13:24:00',11.9,11.9,11.91,11.89,77600.0,923978.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 13:25:00',11.9,11.89,11.91,11.89,77400.0,921197.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 13:26:00',11.89,11.89,11.91,11.89,52500.0,624914.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 13:27:00',11.9,11.92,11.92,11.9,73200.0,871577.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 13:28:00',11.92,11.94,11.94,11.92,68900.0,821981.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 13:29:00',11.94,11.92,11.94,11.91,34500.0,411353.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 13:30:00',11.92,11.91,11.92,11.91,23300.0,277678.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 13:31:00',11.91,11.91,11.92,11.91,57000.0,679335.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 13:32:00',11.91,11.89,11.91,11.89,83400.0,992819.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 13:33:00',11.89,11.87,11.89,11.86,210600.0,2501788.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 13:34:00',11.88,11.81,11.88,11.81,260200.0,3078808.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 13:35:00',11.8,11.86,11.86,11.8,162200.0,1920478.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 13:36:00',11.86,11.84,11.87,11.83,69900.0,828699.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 13:37:00',11.84,11.82,11.85,11.82,51600.0,610763.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 13:38:00',11.83,11.8,11.83,11.79,141300.0,1668275.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 13:39:00',11.8,11.8,11.8,11.77,165800.0,1954307.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 13:40:00',11.8,11.8,11.8,11.78,82800.0,976549.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 13:41:00',11.8,11.81,11.83,11.79,79800.0,942170.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 13:42:00',11.81,11.81,11.83,11.8,50600.0,597531.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 13:43:00',11.8,11.79,11.81,11.79,109500.0,1292148.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 13:44:00',11.79,11.78,11.79,11.78,79300.0,934697.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 13:45:00',11.78,11.8,11.81,11.78,82700.0,975597.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 13:46:00',11.81,11.82,11.82,11.8,40800.0,481780.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 13:47:00',11.81,11.81,11.82,11.8,80500.0,950273.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 13:48:00',11.79,11.79,11.81,11.78,94900.0,1119019.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 13:49:00',11.78,11.78,11.79,11.78,99700.0,1174646.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 13:50:00',11.78,11.76,11.78,11.75,90300.0,1061993.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 13:51:00',11.75,11.73,11.75,11.72,185300.0,2172829.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 13:52:00',11.73,11.73,11.76,11.71,97700.0,1145413.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 13:53:00',11.73,11.77,11.77,11.73,37800.0,444156.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 13:54:00',11.77,11.78,11.78,11.77,43000.0,506361.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 13:55:00',11.78,11.77,11.78,11.77,81200.0,955961.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 13:56:00',11.77,11.77,11.78,11.76,36400.0,428338.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 13:57:00',11.77,11.77,11.77,11.76,59800.0,703499.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 13:58:00',11.76,11.79,11.79,11.76,52300.0,616201.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 13:59:00',11.79,11.79,11.79,11.78,58100.0,684769.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 14:00:00',11.8,11.78,11.8,11.78,48100.0,567104.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 14:01:00',11.78,11.78,11.79,11.77,43800.0,515912.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 14:02:00',11.78,11.77,11.78,11.76,34500.0,406061.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 14:03:00',11.77,11.77,11.77,11.76,27700.0,326032.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 14:04:00',11.77,11.76,11.77,11.75,80000.0,940777.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 14:05:00',11.76,11.75,11.76,11.75,66500.0,781523.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 14:06:00',11.75,11.74,11.76,11.74,196900.0,2312718.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 14:07:00',11.75,11.75,11.76,11.73,153100.0,1797798.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 14:08:00',11.75,11.76,11.76,11.74,106600.0,1252299.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 14:09:00',11.74,11.76,11.76,11.74,84500.0,992785.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 14:10:00',11.76,11.76,11.77,11.76,47700.0,561058.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 14:11:00',11.76,11.77,11.78,11.76,47100.0,554192.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 14:12:00',11.76,11.77,11.78,11.76,27800.0,327194.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 14:13:00',11.77,11.78,11.78,11.75,51100.0,601394.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 14:14:00',11.76,11.8,11.8,11.75,135000.0,1588455.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 14:15:00',11.8,11.79,11.8,11.78,36100.0,425523.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 14:16:00',11.8,11.79,11.8,11.78,113500.0,1338296.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 14:17:00',11.79,11.79,11.8,11.78,45000.0,530429.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 14:18:00',11.79,11.8,11.8,11.78,49200.0,580234.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 14:19:00',11.8,11.82,11.82,11.8,43200.0,510430.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 14:20:00',11.83,11.86,11.86,11.83,58900.0,697146.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 14:21:00',11.85,11.81,11.86,11.81,78300.0,926567.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 14:22:00',11.82,11.82,11.82,11.81,37700.0,445321.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 14:23:00',11.8,11.8,11.82,11.8,27600.0,325903.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 14:24:00',11.82,11.78,11.82,11.78,33300.0,393267.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 14:25:00',11.79,11.8,11.8,11.78,38800.0,457648.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 14:26:00',11.8,11.8,11.8,11.79,11900.0,140406.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 14:27:00',11.81,11.83,11.83,11.8,62500.0,738130.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 14:28:00',11.83,11.87,11.87,11.83,61064.0,723757.1200000048,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 14:29:00',11.86,11.85,11.87,11.85,23400.0,277705.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 14:30:00',11.86,11.86,11.87,11.8,75100.0,888528.0799999833,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 14:31:00',11.86,11.87,11.87,11.82,45621.0,539986.2200000286,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 14:32:00',11.84,11.86,11.87,11.83,43600.0,516837.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 14:33:00',11.85,11.81,11.86,11.81,40200.0,475623.78999996185,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 14:34:00',11.83,11.85,11.85,11.81,41579.0,491491.15000003576,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 14:35:00',11.81,11.84,11.85,11.81,18100.0,214370.78999996185,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 14:36:00',11.83,11.83,11.85,11.83,20300.0,240353.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 14:37:00',11.83,11.85,11.86,11.83,59200.0,701452.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 14:38:00',11.85,11.86,11.86,11.82,101300.0,1200326.7900000215,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 14:39:00',11.85,11.86,11.87,11.84,23600.0,279738.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 14:40:00',11.87,11.84,11.87,11.84,45900.0,544341.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 14:41:00',11.85,11.83,11.86,11.83,48600.0,575773.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 14:42:00',11.86,11.84,11.86,11.82,77400.0,915829.6200000048,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 14:43:00',11.83,11.83,11.84,11.81,44300.0,523969.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 14:44:00',11.83,11.81,11.83,11.81,68900.0,814555.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 14:45:00',11.81,11.81,11.82,11.81,79100.0,934546.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 14:46:00',11.81,11.82,11.82,11.81,53900.0,636811.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 14:47:00',11.82,11.81,11.82,11.8,131100.0,1547666.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 14:48:00',11.8,11.81,11.81,11.8,38800.0,457967.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 14:49:00',11.8,11.82,11.82,11.8,58400.0,689759.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 14:50:00',11.82,11.81,11.82,11.81,66100.0,780881.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 14:51:00',11.81,11.81,11.82,11.81,13391.0,158199.70999997854,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 14:52:00',11.82,11.81,11.82,11.79,152600.0,1801575.9900000095,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 14:53:00',11.82,11.81,11.82,11.8,104300.0,1231667.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 14:54:00',11.8,11.81,11.82,11.8,141260.0,1667581.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 14:55:00',11.81,11.8,11.82,11.8,126740.0,1496139.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 14:56:00',11.79,11.76,11.8,11.76,191345.0,2255231.949999988,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 14:57:00',11.78,11.78,11.78,11.76,99500.0,1171310.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-07 15:00:00',11.77,11.77,11.77,11.77,210600.0,2478762.0,11.78)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 09:31:00',11.86,11.99,11.99,11.86,969300.0,11544577.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 09:32:00',12.0,12.06,12.08,12.0,732300.0,8812888.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 09:33:00',12.06,11.93,12.06,11.9,1186100.0,14202394.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 09:34:00',11.94,11.88,11.95,11.88,725800.0,8640879.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 09:35:00',11.87,11.92,11.92,11.85,331400.0,3940248.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 09:36:00',11.91,11.82,11.91,11.82,333300.0,3952700.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 09:37:00',11.82,11.86,11.86,11.8,269600.0,3190195.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 09:38:00',11.86,11.8,11.86,11.8,500000.0,5915343.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 09:39:00',11.83,11.82,11.83,11.78,268300.0,3166061.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 09:40:00',11.82,11.88,11.88,11.77,246265.0,2911120.8999999985,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 09:41:00',11.89,11.9,11.94,11.89,207700.0,2475814.0000000075,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 09:42:00',11.93,11.92,11.93,11.89,149700.0,1782699.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 09:43:00',11.92,12.01,12.01,11.92,582907.0,6970150.439999998,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 09:44:00',12.01,11.97,12.01,11.97,283000.0,3392985.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 09:45:00',11.98,11.98,11.99,11.97,545200.0,6532243.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 09:46:00',11.98,12.02,12.02,11.97,668400.0,8014970.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 09:47:00',12.05,12.01,12.05,12.01,337700.0,4061646.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 09:48:00',12.01,12.02,12.02,12.0,139000.0,1669695.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 09:49:00',12.01,12.01,12.02,12.01,178100.0,2139348.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 09:50:00',12.0,12.0,12.01,12.0,121500.0,1458754.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 09:51:00',12.01,11.99,12.01,11.99,208800.0,2505681.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 09:52:00',12.0,11.98,12.0,11.98,140400.0,1682153.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 09:53:00',11.98,12.02,12.02,11.98,275800.0,3308836.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 09:54:00',12.02,12.02,12.03,12.01,140100.0,1684206.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 09:55:00',12.03,12.04,12.05,12.03,170400.0,2050992.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 09:56:00',12.05,12.09,12.09,12.03,317900.0,3833499.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 09:57:00',12.08,12.08,12.09,12.08,345800.0,4179299.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 09:58:00',12.06,12.03,12.07,12.03,130900.0,1577011.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 09:59:00',12.01,12.04,12.04,12.01,77900.0,937076.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 10:00:00',12.04,12.03,12.04,12.02,48800.0,587197.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 10:01:00',12.03,12.01,12.03,12.0,84900.0,1020105.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 10:02:00',12.01,12.02,12.02,12.0,143300.0,1723109.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 10:03:00',12.02,12.05,12.07,12.02,156300.0,1883042.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 10:04:00',12.07,12.13,12.13,12.06,248800.0,3009978.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 10:05:00',12.13,12.13,12.13,12.11,227700.0,2759920.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 10:06:00',12.14,12.11,12.14,12.1,212300.0,2572077.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 10:07:00',12.1,12.14,12.14,12.1,304500.0,3689113.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 10:08:00',12.15,12.13,12.15,12.11,215100.0,2610990.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 10:09:00',12.13,12.12,12.13,12.12,44400.0,538354.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 10:10:00',12.12,12.12,12.13,12.11,72300.0,876546.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 10:11:00',12.12,12.08,12.12,12.08,220200.0,2665568.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 10:12:00',12.08,12.1,12.1,12.08,101600.0,1228260.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 10:13:00',12.11,12.11,12.12,12.1,63800.0,772511.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 10:14:00',12.12,12.11,12.12,12.1,83600.0,1012696.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 10:15:00',12.11,12.08,12.11,12.08,120500.0,1458134.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 10:16:00',12.1,12.05,12.1,12.05,103800.0,1253430.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 10:17:00',12.05,12.03,12.07,12.03,145000.0,1747767.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 10:18:00',12.04,12.02,12.04,12.01,164600.0,1979260.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 10:19:00',12.01,11.99,12.02,11.99,162400.0,1949130.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 10:20:00',11.98,11.98,12.0,11.97,110500.0,1324680.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 10:21:00',11.99,11.98,11.99,11.97,31700.0,379668.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 10:22:00',11.98,11.99,11.99,11.97,76700.0,919152.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 10:23:00',11.98,11.96,11.99,11.96,114800.0,1375071.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 10:24:00',11.96,11.93,11.98,11.91,163000.0,1945281.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 10:25:00',11.93,11.95,11.98,11.93,34500.0,411824.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 10:26:00',11.93,11.94,11.94,11.93,45800.0,546620.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 10:27:00',11.93,11.93,11.94,11.93,72200.0,861402.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 10:28:00',11.94,11.93,11.94,11.93,83900.0,1001456.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 10:29:00',11.94,11.95,11.96,11.93,31200.0,372555.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 10:30:00',11.96,11.98,11.98,11.96,20100.0,240573.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 10:31:00',11.97,11.96,11.98,11.96,22000.0,263405.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 10:32:00',11.96,11.98,12.0,11.96,30700.0,368045.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 10:33:00',12.0,11.97,12.0,11.97,38200.0,457647.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 10:34:00',11.97,12.0,12.0,11.97,17900.0,214645.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 10:35:00',12.0,11.96,12.0,11.96,102000.0,1221077.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 10:36:00',11.96,11.95,11.98,11.95,34100.0,407809.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 10:37:00',11.95,11.94,11.95,11.94,17100.0,204271.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 10:38:00',11.94,11.94,11.95,11.93,10700.0,127751.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 10:39:00',11.93,11.93,11.95,11.93,47100.0,562049.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 10:40:00',11.94,11.94,11.94,11.93,31900.0,380739.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 10:41:00',11.93,11.94,11.95,11.93,17200.0,205353.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 10:42:00',11.94,11.96,11.97,11.94,19800.0,236641.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 10:43:00',11.96,11.95,11.97,11.95,48200.0,576622.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 10:44:00',11.98,11.95,11.98,11.95,8200.0,98105.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 10:45:00',11.96,11.97,11.97,11.95,23900.0,285778.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 10:46:00',11.97,11.97,11.98,11.95,33200.0,397359.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 10:47:00',11.97,11.97,11.98,11.95,30500.0,365205.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 10:48:00',11.96,11.94,11.97,11.94,41200.0,492462.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 10:49:00',11.94,11.93,11.94,11.92,104700.0,1248368.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 10:50:00',11.94,11.93,11.94,11.92,25200.0,300656.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 10:51:00',11.93,11.91,11.93,11.91,170200.0,2028315.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 10:52:00',11.91,11.91,11.91,11.9,65400.0,778657.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 10:53:00',11.9,11.88,11.9,11.88,86800.0,1032232.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 10:54:00',11.89,11.89,11.89,11.88,34400.0,408873.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 10:55:00',11.88,11.89,11.89,11.88,51000.0,606105.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 10:56:00',11.89,11.92,11.92,11.89,82400.0,980813.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 10:57:00',11.92,11.95,11.95,11.92,79600.0,950668.4300000072,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 10:58:00',11.95,11.95,11.95,11.92,80900.0,965951.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 10:59:00',11.95,11.95,11.96,11.94,68300.0,816046.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 11:00:00',11.95,11.96,11.96,11.95,19100.0,228402.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 11:01:00',11.96,11.93,11.96,11.93,58700.0,701503.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 11:02:00',11.93,11.89,11.95,11.89,71800.0,855173.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 11:03:00',11.89,11.89,11.9,11.88,28300.0,336423.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 11:04:00',11.89,11.88,11.9,11.88,55900.0,664750.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 11:05:00',11.89,11.9,11.92,11.88,35100.0,417661.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 11:06:00',11.91,11.92,11.92,11.91,21600.0,257313.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 11:07:00',11.92,11.91,11.92,11.9,28000.0,333443.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 11:08:00',11.91,11.91,11.91,11.9,15500.0,184557.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 11:09:00',11.91,11.93,11.93,11.9,77500.0,923605.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 11:10:00',11.93,11.93,11.93,11.92,35200.0,419758.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 11:11:00',11.93,11.92,11.93,11.91,35200.0,419427.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 11:12:00',11.91,11.89,11.92,11.89,20400.0,242863.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 11:13:00',11.89,11.9,11.9,11.89,18400.0,218869.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 11:14:00',11.9,11.9,11.9,11.89,29800.0,354472.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 11:15:00',11.9,11.88,11.9,11.88,59500.0,707013.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 11:16:00',11.87,11.84,11.88,11.84,106200.0,1259777.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 11:17:00',11.84,11.82,11.84,11.81,62500.0,738601.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 11:18:00',11.82,11.81,11.82,11.8,130500.0,1541133.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 11:19:00',11.81,11.81,11.82,11.8,53200.0,628256.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 11:20:00',11.82,11.83,11.83,11.81,89400.0,1056532.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 11:21:00',11.83,11.9,11.9,11.82,294500.0,3497211.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 11:22:00',11.88,11.86,11.89,11.86,110100.0,1307920.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 11:23:00',11.86,11.86,11.87,11.86,23800.0,282433.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 11:24:00',11.87,11.86,11.87,11.84,22100.0,261970.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 11:25:00',11.86,11.85,11.87,11.85,78200.0,927491.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 11:26:00',11.86,11.86,11.86,11.85,38200.0,452428.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 11:27:00',11.85,11.86,11.86,11.84,9400.0,111425.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 11:28:00',11.87,11.86,11.87,11.85,6500.0,77089.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 11:29:00',11.86,11.85,11.86,11.85,8300.0,98418.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 11:30:00',11.85,11.84,11.86,11.83,9400.0,111329.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 13:01:00',11.84,11.81,11.84,11.81,227900.0,2694345.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 13:02:00',11.82,11.82,11.82,11.8,30600.0,361511.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 13:03:00',11.81,11.81,11.82,11.81,13600.0,160657.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 13:04:00',11.85,11.81,11.85,11.8,77900.0,920352.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 13:05:00',11.81,11.81,11.84,11.8,62800.0,742590.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 13:06:00',11.81,11.83,11.85,11.81,202900.0,2402548.419999987,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 13:07:00',11.82,11.9,11.9,11.82,50058.0,593918.3000000119,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 13:08:00',11.89,11.93,11.93,11.86,117800.0,1402898.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 13:09:00',11.93,11.93,11.94,11.9,111100.0,1324350.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 13:10:00',11.93,11.9,11.96,11.9,135900.0,1622071.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 13:11:00',11.9,11.94,11.95,11.9,82900.0,988800.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 13:12:00',11.94,11.97,11.97,11.93,62600.0,748523.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 13:13:00',11.98,12.0,12.0,11.97,105800.0,1268615.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 13:14:00',11.99,11.99,12.0,11.98,70600.0,846399.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 13:15:00',11.99,12.02,12.02,11.97,455658.0,5471984.159999996,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 13:16:00',12.03,12.08,12.09,12.01,190300.0,2294897.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 13:17:00',12.08,12.11,12.12,12.07,397000.0,4803242.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 13:18:00',12.1,12.1,12.17,12.01,924900.0,11236227.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 13:19:00',12.1,12.19,12.19,12.1,367100.0,4472429.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 13:20:00',12.19,12.16,12.19,12.16,200100.0,2437388.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 13:21:00',12.15,12.09,12.15,12.08,127600.0,1544602.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 13:22:00',12.1,12.12,12.13,12.08,113900.0,1378052.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 13:23:00',12.12,12.1,12.12,12.09,107600.0,1301942.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 13:24:00',12.11,12.08,12.11,12.08,109200.0,1319868.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 13:25:00',12.09,12.1,12.1,12.07,99300.0,1200979.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 13:26:00',12.09,12.09,12.1,12.08,48600.0,587562.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 13:27:00',12.09,12.05,12.09,12.05,90300.0,1089928.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 13:28:00',12.05,12.02,12.06,12.02,84500.0,1016340.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 13:29:00',12.03,12.04,12.04,12.02,64700.0,778018.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 13:30:00',12.04,12.05,12.05,12.03,52400.0,631005.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 13:31:00',12.05,12.09,12.1,12.05,53800.0,649968.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 13:32:00',12.09,12.12,12.12,12.08,262500.0,3176698.99999997,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 13:33:00',12.13,12.17,12.18,12.12,118900.0,1444982.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 13:34:00',12.17,12.13,12.18,12.13,122300.0,1487613.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 13:35:00',12.13,12.14,12.16,12.13,193400.0,2348903.1100000143,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 13:36:00',12.13,12.13,12.15,12.12,108900.0,1321690.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 13:37:00',12.12,12.1,12.15,12.1,113600.0,1376982.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 13:38:00',12.1,12.08,12.12,12.08,178300.0,2157748.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 13:39:00',12.07,12.08,12.08,12.06,55200.0,666637.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 13:40:00',12.09,12.12,12.12,12.08,86000.0,1040562.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 13:41:00',12.11,12.11,12.12,12.11,85800.0,1039755.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 13:42:00',12.11,12.11,12.13,12.1,243900.0,2952943.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 13:43:00',12.11,12.1,12.11,12.09,128700.0,1557646.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 13:44:00',12.09,12.06,12.09,12.06,93100.0,1124181.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 13:45:00',12.08,12.04,12.09,12.04,87000.0,1049309.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 13:46:00',12.05,12.08,12.08,12.05,114151.0,1375917.550000012,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 13:47:00',12.07,12.07,12.08,12.06,84200.0,1016780.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 13:48:00',12.07,12.06,12.08,12.05,146700.0,1770253.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 13:49:00',12.07,12.06,12.08,12.06,217800.0,2625084.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 13:50:00',12.07,12.07,12.08,12.06,102400.0,1236308.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 13:51:00',12.07,12.07,12.08,12.07,51900.0,626728.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 13:52:00',12.06,12.08,12.08,12.06,61712.0,744801.8399999738,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 13:53:00',12.07,12.08,12.08,12.07,76000.0,917855.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 13:54:00',12.07,12.07,12.08,12.06,100800.0,1216622.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 13:55:00',12.08,12.04,12.08,12.04,75888.0,915106.1600000262,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 13:56:00',12.04,12.01,12.04,12.01,49700.0,597576.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 13:57:00',12.02,12.02,12.02,12.0,117400.0,1409872.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 13:58:00',12.01,11.99,12.01,11.99,88500.0,1061844.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 13:59:00',11.99,11.99,11.99,11.97,459400.0,5500281.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 14:00:00',11.97,11.98,11.99,11.97,65400.0,783356.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 14:01:00',11.99,12.02,12.02,11.98,95100.0,1140802.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 14:02:00',12.01,12.04,12.05,12.01,89100.0,1072340.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 14:03:00',12.05,12.04,12.07,12.03,122500.0,1477145.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 14:04:00',12.04,12.05,12.05,12.04,64300.0,774569.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 14:05:00',12.04,12.04,12.04,12.02,67900.0,817021.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 14:06:00',12.04,12.05,12.05,12.02,46200.0,555942.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 14:07:00',12.03,12.03,12.04,12.02,45500.0,547352.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 14:08:00',12.02,12.01,12.03,12.0,102300.0,1229247.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 14:09:00',12.0,12.01,12.02,12.0,31500.0,378402.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 14:10:00',12.01,12.0,12.01,12.0,41200.0,494819.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 14:11:00',12.0,11.99,12.02,11.99,56600.0,679339.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 14:12:00',12.0,11.99,12.0,11.98,48000.0,575773.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 14:13:00',11.98,11.99,12.0,11.98,25900.0,310571.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 14:14:00',11.99,11.99,11.99,11.98,26800.0,321210.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 14:15:00',11.98,11.98,11.99,11.97,22800.0,273152.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 14:16:00',11.98,11.95,11.98,11.95,99900.0,1195754.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 14:17:00',11.95,11.92,11.95,11.92,96600.0,1152911.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 14:18:00',11.91,11.91,11.92,11.9,79900.0,952248.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 14:19:00',11.92,11.91,11.93,11.91,34800.0,414584.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 14:20:00',11.91,11.9,11.91,11.9,41500.0,493898.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 14:21:00',11.89,11.89,11.89,11.88,21500.0,255622.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 14:22:00',11.88,11.87,11.89,11.87,33500.0,397937.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 14:23:00',11.88,11.85,11.88,11.85,74600.0,884573.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 14:24:00',11.84,11.84,11.86,11.83,113600.0,1345079.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 14:25:00',11.84,11.89,11.89,11.84,147000.0,1742627.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 14:26:00',11.89,11.9,11.9,11.86,28500.0,338871.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 14:27:00',11.9,11.92,11.93,11.89,55100.0,656600.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 14:28:00',11.93,11.9,11.93,11.9,31300.0,372966.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 14:29:00',11.9,11.92,11.92,11.9,15200.0,180980.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 14:30:00',11.92,11.92,11.93,11.9,36900.0,439541.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 14:31:00',11.92,11.93,11.93,11.92,31100.0,370979.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 14:32:00',11.93,11.97,11.98,11.93,47228.0,564658.0400000215,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 14:33:00',11.96,12.0,12.0,11.96,56100.0,672112.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 14:34:00',11.99,11.99,11.99,11.98,27700.0,331967.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 14:35:00',11.99,11.99,12.0,11.99,43400.0,520416.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 14:36:00',12.0,12.0,12.0,11.98,34000.0,407703.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 14:37:00',11.99,11.99,12.0,11.99,33500.0,401682.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 14:38:00',11.99,11.98,11.99,11.98,15100.0,181016.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 14:39:00',11.98,11.99,11.99,11.98,20700.0,248105.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 14:40:00',11.98,11.96,11.99,11.96,22400.0,268301.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 14:41:00',11.96,11.97,11.97,11.94,24300.0,290581.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 14:42:00',11.97,11.97,11.97,11.95,35300.0,422383.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 14:43:00',11.96,11.95,11.97,11.9,174600.0,2082936.1599999666,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 14:44:00',11.95,11.94,11.95,11.91,5500.0,65679.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 14:45:00',11.94,11.94,11.96,11.92,95400.0,1139203.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 14:46:00',11.94,11.94,11.97,11.92,31400.0,375225.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 14:47:00',11.97,11.99,11.99,11.94,66957.0,802030.8600000143,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 14:48:00',11.98,11.99,12.0,11.98,30300.0,363151.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 14:49:00',11.99,11.98,12.0,11.98,90000.0,1079313.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 14:50:00',12.0,12.0,12.0,11.99,118883.0,1426176.1700000167,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 14:51:00',12.0,12.0,12.0,11.99,133000.0,1595759.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 14:52:00',12.0,11.99,12.0,11.98,122217.0,1465572.8299999833,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 14:53:00',11.99,11.99,12.0,11.98,210200.0,2520826.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 14:54:00',12.0,12.01,12.01,12.0,127800.0,1533947.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 14:55:00',12.02,12.05,12.05,12.01,123300.0,1482774.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 14:56:00',12.04,12.07,12.08,12.04,154483.0,1863283.3199999928,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 14:57:00',12.07,12.08,12.09,12.07,232000.0,2802836.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-08 15:00:00',12.09,12.09,12.09,12.09,293500.0,3548415.0,11.77)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 09:31:00',11.8,11.96,11.96,11.79,1181452.0,13952825.2,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 09:32:00',11.93,11.87,11.94,11.84,348500.0,4140560.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 09:33:00',11.87,11.89,11.92,11.87,277900.0,3304930.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 09:34:00',11.89,11.84,11.89,11.8,336600.0,3985417.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 09:35:00',11.85,11.84,11.87,11.81,303800.0,3595813.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 09:36:00',11.84,11.83,11.84,11.82,180000.0,2129381.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 09:37:00',11.84,11.84,11.85,11.83,117800.0,1394355.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 09:38:00',11.83,11.74,11.83,11.74,1094600.0,12901723.000000004,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 09:39:00',11.73,11.68,11.75,11.66,564800.0,6611564.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 09:40:00',11.69,11.76,11.8,11.69,269000.0,3151298.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 09:41:00',11.76,11.78,11.78,11.74,213500.0,2509286.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 09:42:00',11.78,11.8,11.8,11.77,155500.0,1832592.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 09:43:00',11.79,11.76,11.79,11.76,252800.0,2975994.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 09:44:00',11.77,11.77,11.79,11.75,269400.0,3170422.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 09:45:00',11.77,11.79,11.8,11.77,140400.0,1654537.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 09:46:00',11.79,11.8,11.8,11.78,110900.0,1307492.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 09:47:00',11.8,11.83,11.83,11.8,148400.0,1752863.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 09:48:00',11.83,11.82,11.83,11.8,169200.0,2000161.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 09:49:00',11.8,11.82,11.83,11.8,91600.0,1082658.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 09:50:00',11.83,11.82,11.84,11.81,126000.0,1489754.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 09:51:00',11.82,11.79,11.82,11.79,111300.0,1313866.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 09:52:00',11.79,11.76,11.79,11.76,282300.0,3323827.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 09:53:00',11.76,11.76,11.77,11.75,170500.0,2005499.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 09:54:00',11.76,11.79,11.79,11.75,130100.0,1531191.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 09:55:00',11.79,11.8,11.8,11.78,122400.0,1443704.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 09:56:00',11.8,11.81,11.82,11.79,86300.0,1019182.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 09:57:00',11.81,11.82,11.83,11.81,57800.0,683367.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 09:58:00',11.83,11.83,11.83,11.81,84100.0,994313.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 09:59:00',11.83,11.81,11.83,11.81,96600.0,1141702.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 10:00:00',11.81,11.84,11.84,11.81,71600.0,846272.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 10:01:00',11.82,11.82,11.83,11.81,65800.0,777777.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 10:02:00',11.81,11.83,11.83,11.81,71500.0,845057.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 10:03:00',11.83,11.86,11.86,11.83,63496.0,752347.6799999923,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 10:04:00',11.86,11.87,11.89,11.86,122300.0,1451942.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 10:05:00',11.86,11.87,11.88,11.86,79700.0,945965.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 10:06:00',11.88,11.88,11.88,11.86,65200.0,774223.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 10:07:00',11.87,11.89,11.9,11.86,114800.0,1364045.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 10:08:00',11.88,11.86,11.9,11.86,64400.0,764960.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 10:09:00',11.87,11.86,11.88,11.84,119900.0,1421962.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 10:10:00',11.84,11.85,11.86,11.82,73300.0,867638.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 10:11:00',11.83,11.82,11.84,11.82,53200.0,629552.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 10:12:00',11.82,11.83,11.85,11.82,133900.0,1584264.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 10:13:00',11.83,11.85,11.85,11.83,54500.0,645483.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 10:14:00',11.85,11.88,11.88,11.84,183000.0,2170850.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 10:15:00',11.88,11.89,11.9,11.86,74100.0,880572.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 10:16:00',11.9,11.9,11.92,11.89,78200.0,930818.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 10:17:00',11.92,11.89,11.92,11.88,125600.0,1494664.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 10:18:00',11.88,11.88,11.9,11.88,64100.0,761948.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 10:19:00',11.87,11.88,11.91,11.87,54500.0,647863.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 10:20:00',11.89,11.9,11.92,11.89,77000.0,916637.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 10:21:00',11.93,11.9,11.93,11.88,206800.0,2458801.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 10:22:00',11.88,11.85,11.88,11.84,106000.0,1256595.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 10:23:00',11.85,11.83,11.86,11.83,159200.0,1885375.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 10:24:00',11.83,11.84,11.86,11.83,148800.0,1761022.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 10:25:00',11.83,11.82,11.83,11.81,215200.0,2543641.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 10:26:00',11.82,11.82,11.84,11.81,225200.0,2662189.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 10:27:00',11.82,11.82,11.83,11.81,129000.0,1524894.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 10:28:00',11.82,11.82,11.83,11.82,114600.0,1354650.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 10:29:00',11.83,11.84,11.87,11.83,112600.0,1332867.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 10:30:00',11.84,11.85,11.85,11.82,110800.0,1311207.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 10:31:00',11.83,11.82,11.85,11.82,81500.0,964412.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 10:32:00',11.84,11.84,11.84,11.82,76700.0,907196.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 10:33:00',11.84,11.85,11.85,11.82,61500.0,728081.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 10:34:00',11.85,11.85,11.86,11.84,27500.0,325729.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 10:35:00',11.85,11.87,11.87,11.85,89300.0,1059118.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 10:36:00',11.85,11.87,11.88,11.82,92400.0,1096264.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 10:37:00',11.87,11.86,11.87,11.84,58700.0,696401.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 10:38:00',11.85,11.86,11.88,11.85,68100.0,808058.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 10:39:00',11.86,11.88,11.89,11.86,50500.0,599803.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 10:40:00',11.88,11.88,11.89,11.86,34200.0,406103.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 10:41:00',11.88,11.88,11.89,11.87,13200.0,156802.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 10:42:00',11.88,11.91,11.93,11.88,144500.0,1719635.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 10:43:00',11.91,11.94,11.95,11.91,158800.0,1894595.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 10:44:00',11.94,11.96,11.96,11.91,115300.0,1377235.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 10:45:00',11.95,11.91,11.95,11.91,66100.0,788861.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 10:46:00',11.92,11.93,11.94,11.92,75500.0,900353.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 10:47:00',11.94,11.95,11.96,11.93,89500.0,1069684.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 10:48:00',11.95,11.96,11.97,11.95,72000.0,861053.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 10:49:00',11.95,11.97,11.98,11.95,147200.0,1762197.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 10:50:00',11.97,11.99,11.99,11.97,161500.0,1935869.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 10:51:00',11.99,12.0,12.01,11.99,76500.0,917906.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 10:52:00',12.0,12.0,12.0,11.99,78300.0,939684.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 10:53:00',12.0,11.95,12.01,11.95,106000.0,1269869.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 10:54:00',11.95,12.0,12.0,11.95,89700.0,1074745.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 10:55:00',12.0,11.98,12.0,11.96,44900.0,538166.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 10:56:00',11.96,11.95,11.97,11.95,15200.0,181801.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 10:57:00',11.95,11.94,11.95,11.91,86600.0,1033371.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 10:58:00',11.94,11.94,11.95,11.94,12100.0,144526.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 10:59:00',11.94,11.95,11.96,11.94,35000.0,418281.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 11:00:00',11.96,11.97,11.97,11.96,21700.0,259540.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 11:01:00',11.96,11.97,11.97,11.96,8700.0,104090.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 11:02:00',11.97,11.95,11.97,11.95,36700.0,439063.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 11:03:00',11.96,11.96,11.96,11.95,22000.0,263109.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 11:04:00',11.96,11.96,11.97,11.96,22300.0,266865.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 11:05:00',11.96,11.95,11.96,11.95,13200.0,157878.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 11:06:00',11.95,11.99,11.99,11.95,20000.0,239539.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 11:07:00',11.99,11.99,12.0,11.99,31886.0,382583.1400000155,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 11:08:00',12.0,11.99,12.0,11.98,31500.0,377722.1399999857,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 11:09:00',11.99,11.99,11.99,11.98,27900.0,334285.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 11:10:00',11.99,11.97,11.99,11.97,11414.0,136729.7199999988,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 11:11:00',11.97,11.98,11.98,11.97,26100.0,312661.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 11:12:00',11.98,11.99,11.99,11.97,36500.0,437536.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 11:13:00',12.0,12.0,12.0,11.99,39400.0,472703.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 11:14:00',12.0,11.99,12.02,11.99,27400.0,329000.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 11:15:00',11.99,11.99,12.0,11.99,2000.0,23981.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 11:16:00',11.99,12.0,12.0,11.99,67000.0,803868.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 11:17:00',11.99,12.0,12.01,11.99,26000.0,312084.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 11:18:00',12.0,11.97,12.0,11.97,58600.0,702840.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 11:19:00',11.97,11.98,11.99,11.97,35100.0,420603.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 11:20:00',11.97,11.96,11.98,11.96,36200.0,433314.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 11:21:00',11.96,11.97,11.97,11.96,25200.0,301540.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 11:22:00',11.98,11.98,11.99,11.97,74700.0,895397.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 11:23:00',11.98,11.99,11.99,11.96,74100.0,888127.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 11:24:00',11.99,11.96,11.99,11.96,33800.0,404807.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 11:25:00',11.96,11.95,11.97,11.95,24500.0,292918.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 11:26:00',11.95,11.95,11.95,11.94,24500.0,292679.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 11:27:00',11.94,11.96,11.96,11.94,40900.0,488751.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 11:28:00',11.95,11.95,11.96,11.95,12400.0,148204.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 11:29:00',11.95,11.95,11.96,11.94,64457.0,770570.150000006,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 11:30:00',11.95,11.96,11.96,11.93,42743.0,510538.84999999404,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 13:01:00',11.97,11.96,11.98,11.96,70600.0,844816.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 13:02:00',11.96,11.98,11.98,11.96,18500.0,221566.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 13:03:00',11.97,11.98,11.98,11.97,29500.0,353483.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 13:04:00',11.98,11.98,12.0,11.98,54600.0,655162.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 13:05:00',11.98,12.0,12.01,11.98,88200.0,1057428.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 13:06:00',11.99,12.0,12.0,11.96,23700.0,284382.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 13:07:00',12.0,12.02,12.02,11.96,53800.0,646060.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 13:08:00',12.02,11.98,12.02,11.98,20800.0,249202.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 13:09:00',11.98,12.0,12.0,11.98,27700.0,332378.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 13:10:00',12.0,12.0,12.0,11.98,12200.0,146372.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 13:11:00',12.0,11.98,12.0,11.98,4400.0,52724.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 13:12:00',11.98,11.93,11.98,11.93,108700.0,1299979.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 13:13:00',11.93,11.91,11.95,11.9,82900.0,987624.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 13:14:00',11.93,11.93,11.98,11.92,103700.0,1240948.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 13:15:00',11.93,11.96,11.97,11.93,3900.0,46668.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 13:16:00',11.96,11.95,11.98,11.95,62600.0,749326.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 13:17:00',11.95,11.96,11.98,11.95,10700.0,128102.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 13:18:00',11.96,12.02,12.02,11.96,118400.0,1420798.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 13:19:00',12.01,12.01,12.02,12.0,35700.0,429016.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 13:20:00',12.01,12.02,12.02,12.01,19200.0,230699.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 13:21:00',12.02,12.01,12.02,12.01,14600.0,175379.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 13:22:00',12.01,12.0,12.04,12.0,103600.0,1245267.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 13:23:00',12.0,11.97,12.01,11.97,9600.0,115115.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 13:24:00',11.97,11.96,11.98,11.96,9100.0,108942.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 13:25:00',11.97,11.99,11.99,11.96,18800.0,225218.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 13:26:00',11.99,11.99,12.0,11.99,9000.0,107915.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 13:27:00',11.99,12.01,12.01,11.99,31500.0,378045.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 13:28:00',12.01,12.03,12.03,12.01,31100.0,373794.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 13:29:00',12.03,12.02,12.04,12.02,21300.0,256204.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 13:30:00',12.02,12.02,12.03,12.0,90000.0,1080841.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 13:31:00',12.02,12.02,12.03,12.02,24100.0,289965.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 13:32:00',12.02,12.03,12.03,12.02,25700.0,309124.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 13:33:00',12.03,12.02,12.04,12.02,23200.0,279098.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 13:34:00',12.02,12.06,12.06,12.02,79100.0,953326.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 13:35:00',12.06,12.11,12.12,12.06,298800.0,3612764.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 13:36:00',12.12,12.12,12.13,12.11,105900.0,1283501.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 13:37:00',12.11,12.13,12.13,12.11,92900.0,1126259.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 13:38:00',12.13,12.13,12.15,12.13,96400.0,1169894.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 13:39:00',12.12,12.11,12.13,12.1,42300.0,512549.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 13:40:00',12.1,12.1,12.1,12.09,22700.0,274581.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 13:41:00',12.1,12.11,12.13,12.1,46800.0,567083.099999994,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 13:42:00',12.11,12.13,12.14,12.11,104390.0,1265925.7000000179,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 13:43:00',12.13,12.1,12.13,12.09,129600.0,1569111.2999999821,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 13:44:00',12.1,12.1,12.12,12.1,35300.0,427724.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 13:45:00',12.11,12.1,12.13,12.1,27200.0,329237.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 13:46:00',12.1,12.11,12.12,12.1,25501.0,308947.10000002384,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 13:47:00',12.12,12.13,12.13,12.11,70300.0,852342.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 13:48:00',12.13,12.11,12.13,12.1,11400.0,138103.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 13:49:00',12.11,12.1,12.12,12.1,13300.0,161070.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 13:50:00',12.1,12.11,12.12,12.1,46438.0,562392.1799999774,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 13:51:00',12.11,12.11,12.13,12.1,83862.0,1015883.0600000024,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 13:52:00',12.11,12.13,12.13,12.11,59838.0,725375.9399999976,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 13:53:00',12.14,12.15,12.15,12.13,86000.0,1044086.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 13:54:00',12.14,12.15,12.15,12.14,42000.0,510247.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 13:55:00',12.13,12.13,12.14,12.13,82600.0,1002290.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 13:56:00',12.13,12.12,12.14,12.11,71162.0,863430.6299999952,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 13:57:00',12.12,12.12,12.15,12.11,45200.0,548489.8000000119,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 13:58:00',12.15,12.12,12.15,12.12,13400.0,162586.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 13:59:00',12.12,12.12,12.14,12.12,38900.0,471704.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 14:00:00',12.14,12.12,12.14,12.12,26300.0,318796.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 14:01:00',12.12,12.13,12.13,12.11,66328.0,804196.3600000143,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 14:02:00',12.13,12.11,12.14,12.11,33672.0,408110.0799999833,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 14:03:00',12.11,12.1,12.13,12.1,47100.0,570431.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 14:04:00',12.1,12.11,12.11,12.1,19369.0,234477.59000000358,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 14:05:00',12.12,12.12,12.12,12.11,15400.0,186643.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 14:06:00',12.12,12.11,12.13,12.11,15400.0,186660.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 14:07:00',12.11,12.12,12.12,12.11,20600.0,249528.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 14:08:00',12.12,12.1,12.12,12.1,31531.0,381865.7199999988,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 14:09:00',12.11,12.1,12.11,12.1,23900.0,289493.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 14:10:00',12.1,12.1,12.11,12.09,53000.0,641330.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 14:11:00',12.1,12.09,12.1,12.08,49500.0,598315.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 14:12:00',12.07,12.04,12.07,12.04,61300.0,739610.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 14:13:00',12.04,12.01,12.04,12.01,164900.0,1981477.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 14:14:00',12.01,12.05,12.05,12.01,22100.0,265748.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 14:15:00',12.05,11.97,12.05,11.97,67800.0,813874.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 14:16:00',11.97,11.95,11.97,11.94,112800.0,1348763.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 14:17:00',11.95,11.95,11.96,11.95,26900.0,321502.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 14:18:00',11.96,11.97,11.99,11.96,33100.0,396230.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 14:19:00',11.98,11.96,11.98,11.96,27100.0,324405.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 14:20:00',11.96,11.99,11.99,11.96,17200.0,205815.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 14:21:00',11.98,12.0,12.0,11.98,19500.0,233949.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 14:22:00',12.0,11.98,12.0,11.98,5900.0,70682.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 14:23:00',11.98,11.98,11.98,11.97,23100.0,276745.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 14:24:00',11.98,11.97,11.98,11.95,59500.0,711852.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 14:25:00',11.97,11.96,11.97,11.95,36300.0,434076.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 14:26:00',11.95,11.95,11.95,11.94,51700.0,617761.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 14:27:00',11.96,11.97,11.97,11.95,102800.0,1229707.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 14:28:00',11.97,11.97,11.99,11.97,44100.0,528334.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 14:29:00',11.97,11.99,11.99,11.97,28800.0,345015.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 14:30:00',11.96,11.99,11.99,11.96,7500.0,89804.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 14:31:00',11.99,12.0,12.0,11.98,55100.0,661147.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 14:32:00',12.0,12.0,12.05,12.0,24500.0,294675.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 14:33:00',12.01,12.02,12.02,12.0,49100.0,589928.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 14:34:00',12.02,12.02,12.03,12.02,8200.0,98583.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 14:35:00',12.03,12.05,12.05,12.03,58200.0,700387.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 14:36:00',12.05,12.06,12.06,12.05,31500.0,379668.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 14:37:00',12.07,12.08,12.08,12.05,32900.0,396865.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 14:38:00',12.08,12.07,12.09,12.07,124200.0,1499433.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 14:39:00',12.06,12.05,12.06,12.04,29100.0,350621.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 14:40:00',12.05,12.02,12.05,12.02,35700.0,429752.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 14:41:00',12.03,12.03,12.04,12.02,107600.0,1294053.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 14:42:00',12.04,12.06,12.08,12.04,62900.0,757692.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 14:43:00',12.08,12.08,12.09,12.06,33400.0,403474.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 14:44:00',12.08,12.08,12.09,12.08,36700.0,443528.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 14:45:00',12.08,12.08,12.09,12.07,30900.0,373291.56999999285,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 14:46:00',12.08,12.06,12.08,12.06,57900.0,698897.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 14:47:00',12.06,12.05,12.07,12.05,11400.0,137457.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 14:48:00',12.06,12.07,12.08,12.05,112900.0,1362505.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 14:49:00',12.08,12.06,12.08,12.06,33669.0,406603.1400000155,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 14:50:00',12.07,12.08,12.09,12.07,97100.0,1172659.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 14:51:00',12.08,12.06,12.09,12.06,77131.0,931442.8599999845,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 14:52:00',12.06,12.08,12.09,12.06,47400.0,572668.25,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 14:53:00',12.07,12.06,12.08,12.05,44900.0,541687.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 14:54:00',12.05,12.08,12.08,12.05,117400.0,1417946.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 14:55:00',12.08,12.08,12.09,12.08,76200.0,920693.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 14:56:00',12.08,12.07,12.09,12.07,49800.0,601680.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 14:57:00',12.08,12.08,12.08,12.06,62000.0,748534.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-09 15:00:00',12.08,12.08,12.08,12.08,130900.0,1581272.0,12.09)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 09:31:00',12.06,12.1,12.1,12.02,316526.0,3816146.3,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 09:32:00',12.08,12.08,12.15,12.07,131200.0,1589154.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 09:33:00',12.06,12.05,12.08,12.05,49400.0,596016.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 09:34:00',12.05,12.08,12.08,12.05,75200.0,907711.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 09:35:00',12.07,12.12,12.12,12.07,86500.0,1045399.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 09:36:00',12.12,12.08,12.14,12.06,88100.0,1065477.000000001,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 09:37:00',12.08,12.09,12.09,12.06,22400.0,270362.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 09:38:00',12.07,12.05,12.07,12.0,113400.0,1364445.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 09:39:00',12.05,12.01,12.05,12.01,30400.0,365468.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 09:40:00',12.01,11.95,12.01,11.95,136200.0,1630108.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 09:41:00',11.95,12.0,12.04,11.95,169752.0,2035382.039999999,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 09:42:00',12.02,12.01,12.04,12.01,68700.0,825444.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 09:43:00',12.01,11.98,12.01,11.98,44900.0,538684.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 09:44:00',11.98,11.97,11.98,11.96,78000.0,933675.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 09:45:00',11.97,11.96,11.97,11.96,66000.0,789435.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 09:46:00',11.96,11.95,11.97,11.95,81400.0,973556.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 09:47:00',11.95,11.95,11.96,11.94,108600.0,1297634.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 09:48:00',11.95,11.95,11.96,11.94,46600.0,556907.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 09:49:00',11.95,11.95,11.96,11.95,51400.0,614276.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 09:50:00',11.95,11.98,11.98,11.95,104200.0,1246640.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 09:51:00',12.0,11.99,12.0,11.97,147700.0,1769823.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 09:52:00',11.98,11.99,11.99,11.96,102000.0,1221748.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 09:53:00',11.99,11.97,12.0,11.97,11600.0,138885.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 09:54:00',11.97,11.97,11.99,11.96,31600.0,378161.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 09:55:00',11.97,11.96,11.99,11.96,54300.0,649568.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 09:56:00',11.96,11.95,11.97,11.95,47200.0,564310.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 09:57:00',11.96,11.93,11.96,11.93,116800.0,1395667.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 09:58:00',11.93,11.91,11.93,11.91,89600.0,1067691.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 09:59:00',11.9,11.92,11.94,11.9,88398.0,1053290.1999999993,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 10:00:00',11.94,11.92,11.94,11.91,80500.0,960517.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 10:01:00',11.92,11.9,11.92,11.9,78400.0,933755.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 10:02:00',11.9,11.93,11.93,11.9,187100.0,2230130.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 10:03:00',11.93,11.95,11.95,11.91,172600.0,2055217.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 10:04:00',11.93,11.91,11.93,11.91,36300.0,432817.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 10:05:00',11.91,11.92,11.92,11.91,42600.0,507551.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 10:06:00',11.92,11.91,11.93,11.9,151400.0,1802617.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 10:07:00',11.9,11.9,11.91,11.9,74200.0,883104.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 10:08:00',11.9,11.9,11.91,11.9,112500.0,1339359.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 10:09:00',11.9,11.91,11.92,11.9,28500.0,339459.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 10:10:00',11.91,11.91,11.92,11.91,49700.0,591928.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 10:11:00',11.91,11.91,11.92,11.9,51100.0,608953.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 10:12:00',11.91,11.92,11.95,11.91,64600.0,770182.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 10:13:00',11.92,11.93,11.95,11.92,64400.0,767805.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 10:14:00',11.93,11.93,11.93,11.92,33100.0,394730.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 10:15:00',11.93,11.92,11.94,11.91,38000.0,453054.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 10:16:00',11.92,11.91,11.92,11.91,65200.0,776615.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 10:17:00',11.91,11.9,11.92,11.9,87300.0,1039071.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 10:18:00',11.9,11.88,11.91,11.88,369000.0,4390167.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 10:19:00',11.9,11.89,11.91,11.88,69500.0,826864.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 10:20:00',11.89,11.89,11.9,11.89,63000.0,749152.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 10:21:00',11.89,11.88,11.89,11.88,95890.0,1140070.200000003,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 10:22:00',11.88,11.88,11.89,11.87,26100.0,310042.1000000015,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 10:23:00',11.88,11.87,11.89,11.86,70900.0,841972.099999994,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 10:24:00',11.87,11.88,11.88,11.86,45100.0,535246.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 10:25:00',11.86,11.86,11.88,11.86,120900.0,1434415.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 10:26:00',11.86,11.87,11.87,11.85,62700.0,743781.1000000015,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 10:27:00',11.87,11.86,11.87,11.86,91400.0,1084428.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 10:28:00',11.87,11.88,11.89,11.87,79000.0,938308.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 10:29:00',11.88,11.88,11.89,11.88,20400.0,242424.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 10:30:00',11.88,11.9,11.9,11.88,57000.0,677808.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 10:31:00',11.9,11.89,11.91,11.88,37100.0,441204.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 10:32:00',11.9,11.91,11.91,11.89,23800.0,283159.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 10:33:00',11.91,11.91,11.91,11.9,22600.0,269057.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 10:34:00',11.91,11.92,11.92,11.9,12000.0,142938.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 10:35:00',11.92,11.9,11.93,11.9,29500.0,351508.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 10:36:00',11.9,11.9,11.9,11.9,16700.0,198730.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 10:37:00',11.9,11.91,11.93,11.89,9000.0,107172.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 10:38:00',11.91,11.93,11.93,11.91,9600.0,114429.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 10:39:00',11.93,11.93,11.94,11.92,10800.0,128874.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 10:40:00',11.92,11.94,11.94,11.92,17100.0,204038.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 10:41:00',11.94,11.97,11.97,11.93,52700.0,629486.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 10:42:00',11.97,11.94,11.97,11.93,36500.0,436116.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 10:43:00',11.94,11.94,11.94,11.94,13100.0,156482.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 10:44:00',11.94,11.94,11.96,11.94,8900.0,106304.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 10:45:00',11.94,11.96,11.96,11.92,24700.0,294770.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 10:46:00',11.93,11.93,11.94,11.93,20300.0,242182.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 10:47:00',11.93,11.95,11.96,11.93,20800.0,248404.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 10:48:00',11.94,11.94,11.95,11.94,38800.0,463298.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 10:49:00',11.94,11.94,11.94,11.93,41400.0,494259.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 10:50:00',11.94,11.95,11.96,11.94,83000.0,991746.0000000075,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 10:51:00',11.96,11.96,11.96,11.95,12100.0,144703.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 10:52:00',11.96,11.95,11.96,11.95,5100.0,60978.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 10:53:00',11.95,11.97,11.97,11.95,9900.0,118432.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 10:54:00',11.97,11.96,11.97,11.95,28700.0,343045.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 10:55:00',11.96,11.95,11.96,11.95,24600.0,294016.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 10:56:00',11.95,11.94,11.95,11.94,23700.0,283225.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 10:57:00',11.94,11.93,11.95,11.93,31000.0,370132.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 10:58:00',11.93,11.95,11.95,11.93,17500.0,208955.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 10:59:00',11.95,11.93,11.95,11.92,32900.0,392361.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 11:00:00',11.93,11.94,11.94,11.92,13200.0,157433.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 11:01:00',11.94,11.95,11.95,11.93,13500.0,161150.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 11:02:00',11.93,11.95,11.95,11.93,11900.0,142081.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 11:03:00',11.95,11.95,11.95,11.94,7700.0,92001.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 11:04:00',11.95,11.95,11.95,11.95,8700.0,103965.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 11:05:00',11.95,11.94,11.95,11.94,5900.0,70494.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 11:06:00',11.95,11.95,11.96,11.94,10700.0,127840.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 11:07:00',11.93,11.96,11.96,11.93,6400.0,76470.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 11:08:00',11.95,11.97,11.97,11.94,15300.0,183070.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 11:09:00',11.97,11.96,11.97,11.95,19000.0,227279.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 11:10:00',11.96,11.96,11.97,11.95,4900.0,58625.25,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 11:11:00',11.96,11.96,11.97,11.96,12300.0,147188.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 11:12:00',11.97,11.97,11.98,11.95,5900.0,70631.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 11:13:00',11.97,11.97,11.97,11.96,9600.0,114856.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 11:14:00',11.97,11.96,11.97,11.96,14900.0,178237.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 11:15:00',11.97,11.97,11.97,11.97,3500.0,41895.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 11:16:00',11.97,11.97,11.97,11.97,6500.0,77777.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 11:17:00',11.97,11.97,11.97,11.97,15600.0,186732.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 11:18:00',11.97,11.98,11.98,11.97,38900.0,465951.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 11:19:00',11.98,11.99,11.99,11.98,3500.0,41934.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 11:20:00',11.99,11.99,12.0,11.98,55500.0,665383.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 11:21:00',11.99,11.99,11.99,11.97,35200.0,421620.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 11:22:00',11.99,12.0,12.0,11.97,41000.0,491893.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 11:23:00',11.99,11.99,12.0,11.99,4700.0,56370.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 11:24:00',12.0,11.99,12.0,11.99,18200.0,218234.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 11:25:00',11.98,11.99,11.99,11.98,7800.0,93504.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 11:26:00',11.99,12.0,12.0,11.99,7400.0,88708.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 11:27:00',12.0,11.98,12.0,11.98,17100.0,204902.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 11:28:00',11.98,11.97,11.98,11.97,17500.0,209492.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 11:29:00',11.97,11.97,11.98,11.97,28200.0,337559.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 11:30:00',11.97,11.98,11.98,11.97,1800.0,21554.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 13:01:00',11.98,11.98,11.98,11.97,72300.0,865768.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 13:02:00',11.98,11.97,11.98,11.96,32400.0,387625.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 13:03:00',11.96,11.95,11.97,11.94,21600.0,258199.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 13:04:00',11.96,11.95,11.96,11.95,32600.0,389777.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 13:05:00',11.96,11.96,11.97,11.95,7900.0,94441.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 13:06:00',11.96,11.96,11.97,11.96,2400.0,28708.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 13:07:00',11.96,11.95,11.96,11.95,3100.0,37050.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 13:08:00',11.96,11.96,11.96,11.95,3500.0,41832.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 13:09:00',11.96,11.96,11.97,11.95,12500.0,149502.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 13:10:00',11.96,11.97,11.97,11.95,1600.0,19136.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 13:11:00',11.96,11.96,11.96,11.95,17300.0,206748.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 13:12:00',11.96,11.97,11.97,11.95,47600.0,568842.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 13:13:00',11.97,11.95,11.97,11.94,19100.0,228067.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 13:14:00',11.95,11.93,11.96,11.93,10700.0,127777.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 13:15:00',11.95,11.95,11.96,11.93,42300.0,505124.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 13:16:00',11.96,11.95,11.96,11.94,8800.0,105194.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 13:17:00',11.96,11.95,11.96,11.93,34000.0,405679.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 13:18:00',11.95,11.93,11.95,11.93,24800.0,295882.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 13:19:00',11.94,11.94,11.94,11.93,20900.0,249431.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 13:20:00',11.93,11.94,11.94,11.93,1200.0,14324.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 13:21:00',11.94,11.95,11.95,11.93,41100.0,490779.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 13:22:00',11.94,11.94,11.96,11.94,10000.0,119503.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 13:23:00',11.94,11.94,11.96,11.94,8800.0,105179.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 13:24:00',11.95,11.95,11.95,11.94,4500.0,53747.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 13:25:00',11.95,11.93,11.95,11.93,7700.0,91918.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 13:26:00',11.93,11.94,11.94,11.92,8600.0,102590.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 13:27:00',11.94,11.93,11.94,11.92,11600.0,138370.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 13:28:00',11.93,11.95,11.95,11.92,37200.0,443933.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 13:29:00',11.94,11.95,11.96,11.94,31301.0,374046.9499999881,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 13:30:00',11.95,11.96,11.96,11.94,41700.0,498496.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 13:31:00',11.96,11.99,11.99,11.96,127800.0,1530479.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 13:32:00',11.99,11.97,11.99,11.97,15900.0,190415.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 13:33:00',11.98,11.98,11.98,11.96,41400.0,495799.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 13:34:00',11.98,12.01,12.01,11.98,104700.0,1255640.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 13:35:00',12.01,11.98,12.03,11.98,141400.0,1695886.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 13:36:00',11.98,11.99,12.02,11.97,117300.0,1405537.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 13:37:00',12.0,12.01,12.02,12.0,37700.0,453031.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 13:38:00',12.01,12.06,12.07,12.0,237200.0,2857519.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 13:39:00',12.07,12.06,12.08,12.05,128500.0,1550267.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 13:40:00',12.06,12.04,12.07,12.04,36100.0,435110.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 13:41:00',12.04,12.04,12.05,12.02,18000.0,216603.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 13:42:00',12.04,12.03,12.04,12.02,36900.0,443792.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 13:43:00',12.04,12.04,12.04,12.03,29900.0,359889.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 13:44:00',12.04,12.04,12.04,12.03,53800.0,647334.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 13:45:00',12.04,12.03,12.04,12.02,17000.0,204427.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 13:46:00',12.03,12.03,12.03,12.02,22700.0,272989.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 13:47:00',12.03,12.03,12.03,12.02,70200.0,844460.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 13:48:00',12.03,12.01,12.03,12.01,34300.0,412246.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 13:49:00',12.03,12.02,12.03,12.01,34100.0,409855.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 13:50:00',12.02,12.01,12.03,12.01,21200.0,254718.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 13:51:00',12.02,12.02,12.03,12.01,48500.0,582911.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 13:52:00',12.02,12.01,12.03,12.01,21300.0,255961.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 13:53:00',12.02,12.0,12.02,12.0,37987.0,456280.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 13:54:00',12.0,11.99,12.01,11.99,34913.0,418955.13000001013,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 13:55:00',11.99,12.01,12.01,11.99,32600.0,391159.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 13:56:00',12.0,12.0,12.01,12.0,14000.0,168017.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 13:57:00',12.0,12.0,12.01,12.0,20900.0,250812.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 13:58:00',12.01,12.01,12.01,12.0,24300.0,291781.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 13:59:00',12.0,12.0,12.02,11.99,18487.0,221915.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 14:00:00',12.01,12.02,12.02,12.0,15300.0,183768.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 14:01:00',12.02,12.02,12.02,12.01,2300.0,27645.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 14:02:00',12.02,12.02,12.02,12.02,1900.0,22837.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 14:03:00',12.02,12.01,12.02,12.01,14500.0,174166.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 14:04:00',12.01,12.0,12.02,12.0,16700.0,200511.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 14:05:00',12.0,12.01,12.02,12.0,14100.0,169334.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 14:06:00',12.01,12.01,12.01,12.0,21100.0,253376.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 14:07:00',12.02,12.01,12.02,12.01,4400.0,52854.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 14:08:00',12.0,12.0,12.01,12.0,26513.0,318184.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 14:09:00',12.0,12.01,12.01,12.0,25687.0,308279.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 14:10:00',12.0,12.0,12.01,11.99,20200.0,242234.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 14:11:00',12.0,11.99,12.0,11.99,15500.0,185871.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 14:12:00',11.99,12.0,12.0,11.99,28100.0,336946.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 14:13:00',12.0,11.99,12.0,11.98,28800.0,345236.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 14:14:00',11.99,11.98,11.99,11.98,17400.0,208541.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 14:15:00',11.99,12.0,12.0,11.99,33300.0,399287.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 14:16:00',12.0,12.0,12.0,11.99,32200.0,386236.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 14:17:00',12.0,12.0,12.0,11.99,21159.0,253877.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 14:18:00',12.0,12.01,12.01,12.0,4200.0,50427.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 14:19:00',12.01,12.01,12.01,12.0,4100.0,49227.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 14:20:00',12.01,12.01,12.01,11.98,47200.0,566171.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 14:21:00',12.0,12.0,12.01,12.0,24800.0,297639.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 14:22:00',12.0,12.0,12.02,12.0,64500.0,774303.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 14:23:00',12.02,12.02,12.03,12.0,17100.0,205518.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 14:24:00',12.02,12.02,12.03,12.01,33200.0,399297.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 14:25:00',12.02,12.02,12.03,12.02,17600.0,211601.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 14:26:00',12.02,12.01,12.02,12.01,16200.0,194668.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 14:27:00',12.01,12.01,12.02,12.0,83700.0,1005081.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 14:28:00',12.01,12.01,12.01,11.99,49300.0,591313.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 14:29:00',12.01,12.01,12.02,12.0,14200.0,170574.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 14:30:00',12.01,12.02,12.02,12.0,65800.0,789746.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 14:31:00',12.0,11.98,12.02,11.98,42900.0,514641.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 14:32:00',12.0,12.0,12.01,11.99,20100.0,241232.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 14:33:00',12.0,12.0,12.0,11.99,64400.0,772180.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 14:34:00',12.0,12.0,12.01,11.98,77800.0,932959.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 14:35:00',12.0,11.99,12.01,11.99,19600.0,235230.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 14:36:00',11.99,12.0,12.01,11.98,35200.0,422031.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 14:37:00',12.0,12.01,12.01,12.0,20000.0,240035.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 14:38:00',12.0,11.99,12.01,11.99,38900.0,466642.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 14:39:00',12.0,11.99,12.01,11.99,48500.0,581947.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 14:40:00',12.0,12.0,12.0,11.97,76600.0,918304.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 14:41:00',12.0,12.0,12.0,11.97,38500.0,461387.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 14:42:00',12.0,11.98,12.0,11.96,65200.0,781070.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 14:43:00',11.98,11.95,11.98,11.95,185896.0,2222256.199999988,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 14:44:00',11.99,11.99,12.0,11.95,82800.0,991636.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 14:45:00',11.98,11.98,11.99,11.94,45600.0,545571.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 14:46:00',11.94,11.95,11.99,11.94,75200.0,899330.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 14:47:00',11.95,11.97,11.98,11.94,93700.0,1119454.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 14:48:00',11.97,11.93,11.97,11.93,45200.0,539657.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 14:49:00',11.93,11.92,11.94,11.9,245600.0,2926711.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 14:50:00',11.91,11.9,11.91,11.89,162800.0,1937561.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 14:51:00',11.9,11.9,11.91,11.88,168604.0,2004458.600000009,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 14:52:00',11.9,11.89,11.91,11.88,169296.0,2010980.399999991,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 14:53:00',11.89,11.88,11.9,11.86,179600.0,2131752.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 14:54:00',11.86,11.84,11.88,11.84,366700.0,4348833.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 14:55:00',11.85,11.85,11.86,11.84,169100.0,2002880.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 14:56:00',11.86,11.9,11.98,11.86,164200.0,1952380.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 14:57:00',11.9,11.89,11.94,11.88,59500.0,708274.0,12.08)")
+ tdSql.execute(f"insert into tb values ('2020-01-10 15:00:00',11.89,11.89,11.89,11.89,137000.0,1628930.0,12.08)")
+
+ def check_max_min_results(self):
+ max_results = [11.48, 11.54, 11.82, 12.14, 12.19, 12.15, 12.15]
+ min_results = [10.90, 11.20, 11.41, 11.61, 11.82, 11.75, 11.86]
+
+ for i in range(len(max_results)):
+ tdSql.checkData(i, 1, max_results[i])
+ tdSql.checkData(i, 2, min_results[i])
+
+ def basic_query(self):
+ tdSql.query(f"select first(ts), max(high), min(high) from tb interval(1d)")
+ self.check_max_min_results()
+
+ tdSql.query(f"select last(ts), max(high), min(high) from tb interval(1d)")
+ self.check_max_min_results()
+
+
+ def run(self):
+ dbname = "db"
+ tdSql.prepare()
+ self.prepare_data()
+ self.basic_query()
+
+
+ def stop(self):
+ tdSql.close()
+ tdLog.success("%s successfully executed" % __file__)
+
+
+tdCases.addWindows(__file__, TDTestCase())
+tdCases.addLinux(__file__, TDTestCase())
diff --git a/tests/system-test/2-query/unique.py b/tests/system-test/2-query/unique.py
index 6af9b130ef7b36c493e7bb1edc41fa2f391bf2e0..9b5da50e1f84e41d24a671e2b6efcb854268087c 100644
--- a/tests/system-test/2-query/unique.py
+++ b/tests/system-test/2-query/unique.py
@@ -433,7 +433,7 @@ class TDTestCase:
tdSql.checkRows(11)
tdSql.checkData(1,0,0)
tdSql.checkData(10,0,9)
- tdSql.query(f"select unique(t1) from (select _rowts , t1 , tbname from {dbname}.stb1 )")
+ tdSql.query(f"select unique(t1) v from (select _rowts , t1 , tbname from {dbname}.stb1 ) order by v desc")
tdSql.checkRows(2)
tdSql.checkData(0,0,4)
tdSql.checkData(1,0,1)
diff --git a/tests/system-test/7-tmq/tmq_taosx.py b/tests/system-test/7-tmq/tmq_taosx.py
index f2fbd8486570e385332be5280f58f25af7ae4d75..0596241ce1f6c892313ccca219c131476246770c 100644
--- a/tests/system-test/7-tmq/tmq_taosx.py
+++ b/tests/system-test/7-tmq/tmq_taosx.py
@@ -194,6 +194,11 @@ class TDTestCase:
tdSql.checkData(0, 2, None)
tdSql.checkData(1, 1, 1)
tdSql.checkData(1, 2, '{"k1":1,"k2":"hello"}')
+
+ tdSql.query("select * from information_schema.ins_tables where table_name = 'stt4'")
+ uid1 = tdSql.getData(0, 5)
+ uid2 = tdSql.getData(1, 5)
+ tdSql.checkNotEqual(uid1, uid2)
return
def checkWal1Vgroup(self):
diff --git a/tools/shell/inc/shellAuto.h b/tools/shell/inc/shellAuto.h
index b7bf5fa1019502acbeaefc8884d4553704f58702..151f6da8c6555118699eedbf791da32e47e4283e 100644
--- a/tools/shell/inc/shellAuto.h
+++ b/tools/shell/inc/shellAuto.h
@@ -28,7 +28,7 @@ void pressOtherKey(char c);
bool shellAutoInit();
// set conn
-void shellSetConn(TAOS* conn);
+void shellSetConn(TAOS* conn, bool runOnce);
// exit shell auto funciton, shell exit call once
void shellAutoExit();
diff --git a/tools/shell/src/shellAuto.c b/tools/shell/src/shellAuto.c
index b391d59725938295fcffba13dfac81821a40a0cb..480421b5c014fae2b71bfd93ee3e4fd683b408dd 100644
--- a/tools/shell/src/shellAuto.c
+++ b/tools/shell/src/shellAuto.c
@@ -32,6 +32,8 @@ void shellShowOnScreen(SShellCmd* cmd);
void shellInsertChar(SShellCmd* cmd, char* c, int size);
void shellInsertStr(SShellCmd* cmd, char* str, int size);
bool appendAfterSelect(TAOS* con, SShellCmd* cmd, char* p, int32_t len);
+char* tireSearchWord(int type, char* pre);
+bool updateTireValue(int type, bool autoFill) ;
typedef struct SAutoPtr {
STire* p;
@@ -60,23 +62,22 @@ SWords shellCommands[] = {
{"alter database "
" ;",
0, 0, NULL},
- {"alter dnode balance ", 0, 0, NULL},
- {"alter dnode resetlog;", 0, 0, NULL},
- {"alter dnode debugFlag 141;", 0, 0, NULL},
- {"alter dnode monitor 1;", 0, 0, NULL},
- {"alter all dnodes monitor ", 0, 0, NULL},
- {"alter alldnodes balance ", 0, 0, NULL},
- {"alter alldnodes resetlog;", 0, 0, NULL},
- {"alter alldnodes debugFlag 141;", 0, 0, NULL},
- {"alter alldnodes monitor 1;", 0, 0, NULL},
+ {"alter dnode \"resetlog\";", 0, 0, NULL},
+ {"alter dnode \"debugFlag\" \"141\";", 0, 0, NULL},
+ {"alter dnode \"monitor\" \"0\";", 0, 0, NULL},
+ {"alter dnode \"monitor\" \"1\";", 0, 0, NULL},
+ {"alter all dnodes \"resetlog\";", 0, 0, NULL},
+ {"alter all dnodes \"debugFlag\" \"141\";", 0, 0, NULL},
+ {"alter all dnodes \"monitor\" \"0\";", 0, 0, NULL},
+ {"alter all dnodes \"monitor\" \"1\";", 0, 0, NULL},
{"alter table ;", 0, 0, NULL},
{"alter table modify column", 0, 0, NULL},
- {"alter local resetlog;", 0, 0, NULL},
- {"alter local DebugFlag 143;", 0, 0, NULL},
- {"alter local cDebugFlag 143;", 0, 0, NULL},
- {"alter local uDebugFlag 143;", 0, 0, NULL},
- {"alter local rpcDebugFlag 143;", 0, 0, NULL},
- {"alter local tmrDebugFlag 143;", 0, 0, NULL},
+ {"alter local \"resetlog\";", 0, 0, NULL},
+ {"alter local \"DebugFlag\" \"143\";", 0, 0, NULL},
+ {"alter local \"cDebugFlag\" \"143\";", 0, 0, NULL},
+ {"alter local \"uDebugFlag\" \"143\";", 0, 0, NULL},
+ {"alter local \"rpcDebugFlag\" \"143\";", 0, 0, NULL},
+ {"alter local \"tmrDebugFlag\" \"143\";", 0, 0, NULL},
{"alter topic", 0, 0, NULL},
{"alter user ;", 0, 0, NULL},
// 20
@@ -108,6 +109,7 @@ SWords shellCommands[] = {
{"drop topic ;", 0, 0, NULL},
{"drop stream ;", 0, 0, NULL},
{"explain select", 0, 0, NULL}, // 44 append sub sql
+ {"flush database ;", 0, 0, NULL},
{"help;", 0, 0, NULL},
{"grant all on to ;", 0, 0, NULL},
{"grant read on to ;", 0, 0, NULL},
@@ -121,7 +123,6 @@ SWords shellCommands[] = {
{"revoke read on from ;", 0, 0, NULL},
{"revoke write on from ;", 0, 0, NULL},
{"select * from ", 0, 0, NULL},
- {"select _block_dist() from \\G;", 0, 0, NULL},
{"select client_version();", 0, 0, NULL},
// 60
{"select current_user();", 0, 0, NULL},
@@ -247,7 +248,7 @@ char* db_options[] = {"keep ",
"wal_retention_size ",
"wal_segment_size "};
-char* alter_db_options[] = {"keep ", "cachemodel ", "cachesize ", "wal_fsync_period ", "wal_level "};
+char* alter_db_options[] = {"cachemodel ", "replica ", "keep ", "cachesize ", "wal_fsync_period ", "wal_level "};
char* data_types[] = {"timestamp", "int",
"int unsigned", "varchar(16)",
@@ -262,6 +263,14 @@ char* key_tags[] = {"tags("};
char* key_select[] = {"select "};
+char* key_systable[] = {
+ "ins_dnodes", "ins_mnodes", "ins_modules", "ins_qnodes", "ins_snodes", "ins_cluster",
+ "ins_databases", "ins_functions", "ins_indexes", "ins_stables", "ins_tables", "ins_tags",
+ "ins_users", "ins_grants", "ins_vgroups", "ins_configs", "ins_dnode_variables", "ins_topics",
+ "ins_subscriptions", "ins_streams", "ins_stream_tasks", "ins_vnodes", "ins_user_privileges", "perf_connections",
+ "perf_queries", "perf_consumers", "perf_trans", "perf_apps"};
+
+
//
// ------- gobal variant define ---------
//
@@ -293,8 +302,9 @@ bool waitAutoFill = false;
#define WT_VAR_TBOPTION 16
#define WT_VAR_USERACTION 17
#define WT_VAR_KEYSELECT 18
+#define WT_VAR_SYSTABLE 19
-#define WT_VAR_CNT 19
+#define WT_VAR_CNT 20
#define WT_FROM_DB_MAX 6 // max get content from db
#define WT_FROM_DB_CNT (WT_FROM_DB_MAX + 1)
@@ -322,24 +332,25 @@ bool varMode = false; // enter var names list mode
TAOS* varCon = NULL;
SShellCmd* varCmd = NULL;
+bool varRunOnce = false;
SMatch* lastMatch = NULL; // save last match result
int cntDel = 0; // delete byte count after next press tab
// show auto tab introduction
void printfIntroduction() {
- printf(" ****************************** Tab Completion **********************************\n");
- printf(" * The TDengine CLI supports tab completion for a variety of items, *\n");
- printf(" * including database names, table names, function names and keywords. *\n");
- printf(" * The full list of shortcut keys is as follows: *\n");
- printf(" * [ TAB ] ...... complete the current word *\n");
- printf(" * ...... if used on a blank line, display all valid commands *\n");
- printf(" * [ Ctrl + A ] ...... move cursor to the st[A]rt of the line *\n");
- printf(" * [ Ctrl + E ] ...... move cursor to the [E]nd of the line *\n");
- printf(" * [ Ctrl + W ] ...... move cursor to the middle of the line *\n");
- printf(" * [ Ctrl + L ] ...... clear the entire screen *\n");
- printf(" * [ Ctrl + K ] ...... clear the screen after the cursor *\n");
- printf(" * [ Ctrl + U ] ...... clear the screen before the cursor *\n");
- printf(" **********************************************************************************\n\n");
+ printf(" ****************************** Tab Completion *************************************\n");
+ printf(" * The TDengine CLI supports tab completion for a variety of items, *\n");
+ printf(" * including database names, table names, function names and keywords. *\n");
+ printf(" * The full list of shortcut keys is as follows: *\n");
+ printf(" * [ TAB ] ...... complete the current word *\n");
+ printf(" * ...... if used on a blank line, display all supported commands *\n");
+ printf(" * [ Ctrl + A ] ...... move cursor to the st[A]rt of the line *\n");
+ printf(" * [ Ctrl + E ] ...... move cursor to the [E]nd of the line *\n");
+ printf(" * [ Ctrl + W ] ...... move cursor to the middle of the line *\n");
+ printf(" * [ Ctrl + L ] ...... clear the entire screen *\n");
+ printf(" * [ Ctrl + K ] ...... clear the screen after the cursor *\n");
+ printf(" * [ Ctrl + U ] ...... clear the screen before the cursor *\n");
+ printf(" *************************************************************************************\n\n");
}
void showHelp() {
@@ -348,23 +359,24 @@ void showHelp() {
"\n\
----- A ----- \n\
alter database \n\
- alter dnode balance \n\
- alter dnode resetlog;\n\
- alter all dnodes monitor \n\
- alter alldnodes balance \n\
- alter alldnodes resetlog;\n\
- alter alldnodes debugFlag \n\
- alter alldnodes monitor \n\
+ alter dnode 'resetlog';\n\
+ alter dnode 'monitor' '0';\n\
+ alter dnode 'monitor' \"1\";\n\
+ alter dnode \"debugflag\" \"143\";\n\
+ alter all dnodes \"monitor\" \"0\";\n\
+ alter all dnodes \"monitor\" \"1\";\n\
+ alter all dnodes \"resetlog\";\n\
+ alter all dnodes \"debugFlag\" \n\
alter table ;\n\
alter table modify column\n\
- alter local resetlog;\n\
- alter local DebugFlag 143;\n\
+ alter local \"resetlog\";\n\
+ alter local \"DebugFlag\" \"143\";\n\
alter topic\n\
alter user ...\n\
----- C ----- \n\
create table using tags ...\n\
create database ...\n\
- create dnode ...\n\
+ create dnode \"fqdn:port\" ...\n\
create index ...\n\
create mnode on dnode ;\n\
create qnode on dnode ;\n\
@@ -387,6 +399,8 @@ void showHelp() {
drop stream ;\n\
----- E ----- \n\
explain select clause ...\n\
+ ----- F ----- \n\
+ flush database ;\n\
----- H ----- \n\
help;\n\
----- I ----- \n\
@@ -409,7 +423,6 @@ void showHelp() {
revoke write on from ;\n\
----- S ----- \n\
select * from where ... \n\
- select _block_dist() from ;\n\
select client_version();\n\
select current_user();\n\
select database();\n\
@@ -619,12 +632,18 @@ bool shellAutoInit() {
GenerateVarType(WT_VAR_TBOPTION, tb_options, sizeof(tb_options) / sizeof(char*));
GenerateVarType(WT_VAR_USERACTION, user_actions, sizeof(user_actions) / sizeof(char*));
GenerateVarType(WT_VAR_KEYSELECT, key_select, sizeof(key_select) / sizeof(char*));
+ GenerateVarType(WT_VAR_SYSTABLE, key_systable, sizeof(key_systable) / sizeof(char*));
return true;
}
// set conn
-void shellSetConn(TAOS* conn) { varCon = conn; }
+void shellSetConn(TAOS* conn, bool runOnce) {
+ varCon = conn;
+ varRunOnce = runOnce;
+ // init database and stable
+ if (!runOnce) updateTireValue(WT_VAR_DBNAME, false);
+}
// exit shell auto funciton, shell exit call once
void shellAutoExit() {
@@ -767,6 +786,15 @@ int writeVarNames(int type, TAOS_RES* tres) {
return numOfRows;
}
+void setThreadNull(int type) {
+ taosThreadMutexLock(&tiresMutex);
+ if(threads[type]) {
+ taosMemoryFree(threads[type]);
+ }
+ threads[type] = NULL;
+ taosThreadMutexUnlock(&tiresMutex);
+}
+
bool firstMatchCommand(TAOS* con, SShellCmd* cmd);
//
// thread obtain var thread from db server
@@ -782,6 +810,7 @@ void* varObtainThread(void* param) {
TAOS_RES* pSql = taos_query(varCon, varSqls[type]);
if (taos_errno(pSql)) {
taos_free_result(pSql);
+ setThreadNull(type);
return NULL;
}
@@ -797,12 +826,46 @@ void* varObtainThread(void* param) {
firstMatchCommand(varCon, varCmd);
}
+ setThreadNull(type);
return NULL;
}
+// return true is need update value by async
+bool updateTireValue(int type, bool autoFill) {
+ // TYPE CONTEXT GET FROM DB
+ taosThreadMutexLock(&tiresMutex);
+
+ // check need obtain from server
+ if (tires[type] == NULL) {
+ waitAutoFill = autoFill;
+ // need async obtain var names from db sever
+ if (threads[type] != NULL) {
+ if (taosThreadRunning(threads[type])) {
+ // thread running , need not obtain again, return
+ taosThreadMutexUnlock(&tiresMutex);
+ return NULL;
+ }
+ // destroy previous thread handle for new create thread handle
+ taosDestroyThread(threads[type]);
+ threads[type] = NULL;
+ }
+
+ // create new
+ void* param = taosMemoryMalloc(sizeof(int));
+ *((int*)param) = type;
+ threads[type] = taosCreateThread(varObtainThread, param);
+ taosThreadMutexUnlock(&tiresMutex);
+ return true;
+ }
+ taosThreadMutexUnlock(&tiresMutex);
+
+ return false;
+}
+
// only match next one word from all match words, return valuue must free by caller
char* matchNextPrefix(STire* tire, char* pre) {
SMatch* match = NULL;
+ if(tire == NULL) return NULL;
// re-use last result
if (lastMatch) {
@@ -888,32 +951,9 @@ char* tireSearchWord(int type, char* pre) {
return matchNextPrefix(tire, pre);
}
- // TYPE CONTEXT GET FROM DB
- taosThreadMutexLock(&tiresMutex);
-
- // check need obtain from server
- if (tires[type] == NULL) {
- waitAutoFill = true;
- // need async obtain var names from db sever
- if (threads[type] != NULL) {
- if (taosThreadRunning(threads[type])) {
- // thread running , need not obtain again, return
- taosThreadMutexUnlock(&tiresMutex);
- return NULL;
- }
- // destroy previous thread handle for new create thread handle
- taosDestroyThread(threads[type]);
- threads[type] = NULL;
- }
-
- // create new
- void* param = taosMemoryMalloc(sizeof(int));
- *((int*)param) = type;
- threads[type] = taosCreateThread(varObtainThread, param);
- taosThreadMutexUnlock(&tiresMutex);
+ if(updateTireValue(type, true)) {
return NULL;
}
- taosThreadMutexUnlock(&tiresMutex);
// can obtain var names from local
STire* tire = getAutoPtr(type);
@@ -1116,6 +1156,7 @@ void printScreen(TAOS* con, SShellCmd* cmd, SWords* match) {
// main key press tab , matched return true else false
bool firstMatchCommand(TAOS* con, SShellCmd* cmd) {
+ if(con == NULL || cmd == NULL) return false;
// parse command
SWords* input = (SWords*)taosMemoryMalloc(sizeof(SWords));
memset(input, 0, sizeof(SWords));
@@ -1660,12 +1701,49 @@ bool matchOther(TAOS* con, SShellCmd* cmd) {
return false;
}
+// last match if nothing matched
+bool matchEnd(TAOS* con, SShellCmd* cmd) {
+ // str dump
+ bool ret = false;
+ char* ps = strndup(cmd->command, cmd->commandSize);
+ char* last = lastWord(ps);
+ char* elast = strrchr(last, '.'); // find end last
+ if(elast) {
+ last = elast + 1;
+ }
+
+ // less one char can match
+ if(strlen(last) == 0 ) {
+ goto _return;
+ }
+
+ // match database
+ if(elast == NULL) {
+ // dot need not completed with dbname
+ if (fillWithType(con, cmd, last, WT_VAR_DBNAME)) {
+ ret = true;
+ goto _return;
+ }
+ }
+
+ if (fillWithType(con, cmd, last, WT_VAR_SYSTABLE)) {
+ ret = true;
+ goto _return;
+ }
+
+_return:
+ taosMemoryFree(ps);
+ return ret;
+}
+
// main key press tab
void pressTabKey(SShellCmd* cmd) {
- // check
+ // check empty tab key
if (cmd->commandSize == 0) {
- // empty
- showHelp();
+ // have multi line tab key
+ if(cmd->bufferSize == 0) {
+ showHelp();
+ }
shellShowOnScreen(cmd);
return;
}
@@ -1695,6 +1773,9 @@ void pressTabKey(SShellCmd* cmd) {
matched = matchSelectQuery(varCon, cmd);
if (matched) return;
+ // match end
+ matched = matchEnd(varCon, cmd);
+
return;
}
@@ -1911,6 +1992,7 @@ void callbackAutoTab(char* sqlstr, TAOS* pSql, bool usedb) {
if (dealUseDB(sql)) {
// change to new db
+ if (!varRunOnce) updateTireValue(WT_VAR_STABLE, false);
return;
}
diff --git a/tools/shell/src/shellEngine.c b/tools/shell/src/shellEngine.c
index 479c2cf39a30fdeb2bed0a855445eac240d56c9f..9b842a9e6f0ba38e90804ff853bc9cad07cfcd52 100644
--- a/tools/shell/src/shellEngine.c
+++ b/tools/shell/src/shellEngine.c
@@ -1097,10 +1097,11 @@ int32_t shellExecute() {
}
#endif
- shellSetConn(shell.conn);
+ bool runOnce = pArgs->commands != NULL || pArgs->file[0] != 0;
+ shellSetConn(shell.conn, runOnce);
shellReadHistory();
- if (pArgs->commands != NULL || pArgs->file[0] != 0) {
+ if (runOnce) {
if (pArgs->commands != NULL) {
printf("%s%s\r\n", shell.info.promptHeader, pArgs->commands);
char *cmd = strdup(pArgs->commands);
@@ -1160,5 +1161,8 @@ int32_t shellExecute() {
taosThreadJoin(spid, NULL);
shellCleanupHistory();
+ taos_kill_query(shell.conn);
+ taos_close(shell.conn);
+
return 0;
}
diff --git a/tools/shell/src/shellWebsocket.c b/tools/shell/src/shellWebsocket.c
index add3ccc51f730d9398c7f339f8e3a645cc5a0b0e..e848c07b666fb24cb876b4637e0fe7e3a3c44f4d 100644
--- a/tools/shell/src/shellWebsocket.c
+++ b/tools/shell/src/shellWebsocket.c
@@ -218,8 +218,13 @@ void shellRunSingleCommandWebsocketImp(char *command) {
res = ws_query_timeout(shell.ws_conn, command, shell.args.timeout);
int code = ws_errno(res);
if (code != 0 && !shell.stop_query) {
- et = taosGetTimestampUs();
- fprintf(stderr, "\nDB: error: %s (%.6fs)\n", ws_errstr(res), (et - st)/1E6);
+ // if it's not a ws connection error
+ if (TSDB_CODE_WS_DSN_ERROR != (code&TSDB_CODE_WS_DSN_ERROR)) {
+ et = taosGetTimestampUs();
+ fprintf(stderr, "\nDB: error: %s (%.6fs)\n", ws_errstr(res), (et - st)/1E6);
+ ws_free_result(res);
+ return;
+ }
if (code == TSDB_CODE_WS_SEND_TIMEOUT || code == TSDB_CODE_WS_RECV_TIMEOUT) {
fprintf(stderr, "Hint: use -t to increase the timeout in seconds\n");
} else if (code == TSDB_CODE_WS_INTERNAL_ERRO || code == TSDB_CODE_WS_CLOSED) {
diff --git a/utils/test/c/tmqSim.c b/utils/test/c/tmqSim.c
index 9c1dc2e063ee96e7e593154fcc602c6b3be9073f..1acf50a7d84a7bb7370915e2c6269dc51d8b066b 100644
--- a/utils/test/c/tmqSim.c
+++ b/utils/test/c/tmqSim.c
@@ -400,7 +400,7 @@ TAOS* createNewTaosConnect() {
int32_t retryCnt = 10;
while (retryCnt--) {
- TAOS* taos = taos_connect(NULL, "root", "taosdata", NULL, 0);
+ taos = taos_connect(NULL, "root", "taosdata", NULL, 0);
if (NULL != taos) {
return taos;
}
@@ -780,7 +780,8 @@ void loop_consume(SThreadInfo* pInfo) {
if (pInfo->ifCheckData) {
char filename[256] = {0};
- char tmpString[128];
+ memset(tmpString, 0, tListLen(tmpString));
+
// sprintf(filename, "%s/../log/consumerid_%d_%s.txt", configDir, pInfo->consumerId,
// getCurrentTimeString(tmpString));
sprintf(filename, "%s/../log/consumerid_%d.txt", configDir, pInfo->consumerId);
@@ -834,12 +835,12 @@ void loop_consume(SThreadInfo* pInfo) {
}
if ((totalRows >= pInfo->expectMsgCnt) || (totalMsgs >= pInfo->expectMsgCnt)) {
- char tmpString[128];
+ memset(tmpString, 0, tListLen(tmpString));
taosFprintfFile(g_fp, "%s over than expect rows, so break consume\n", getCurrentTimeString(tmpString));
break;
}
} else {
- char tmpString[128];
+ memset(tmpString, 0, tListLen(tmpString));
taosFprintfFile(g_fp, "%s no poll more msg when time over, break consume\n", getCurrentTimeString(tmpString));
break;
}
@@ -1113,7 +1114,7 @@ void omb_loop_consume(SThreadInfo* pInfo) {
lastTotalLenOfMsg = totalLenOfMsg;
}
} else {
- char tmpString[128];
+ memset(tmpString, 0, tListLen(tmpString));
taosFprintfFile(g_fp, "%s no poll more msg when time over, break consume\n", getCurrentTimeString(tmpString));
printf("%s no poll more msg when time over, break consume\n", getCurrentTimeString(tmpString));
int64_t currentPrintTime = taosGetTimestampMs();
@@ -1381,7 +1382,7 @@ void startOmbConsume() {
printf("SQL: %s\n", sql);
queryDbExec(taos, sql, NO_INSERT_TYPE);
- int32_t producerRate = ceil(g_stConfInfo.producerRate / g_stConfInfo.producers);
+ int32_t producerRate = ceil(((double)g_stConfInfo.producerRate) / g_stConfInfo.producers);
printf("==== create %d produce thread ====\n", g_stConfInfo.producers);
for (int32_t i = 0; i < g_stConfInfo.producers; ++i) {