diff --git a/Jenkinsfile2 b/Jenkinsfile2
index e25be162e8..9e89e5a2f8 100644
--- a/Jenkinsfile2
+++ b/Jenkinsfile2
@@ -175,6 +175,7 @@ def pre_test_build_mac() {
cd ${WK}/debug
cmake .. -DBUILD_TEST=true -DBUILD_HTTPS=false
make -j10
+ ctest -j10 || exit 7
'''
sh '''
date
diff --git a/cmake/cmake.version b/cmake/cmake.version
index 1a83126cd7..92f7f8b895 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.1.5")
+ SET(TD_VER_NUMBER "3.0.1.6")
ENDIF ()
IF (DEFINED VERCOMPATIBLE)
diff --git a/cmake/taostools_CMakeLists.txt.in b/cmake/taostools_CMakeLists.txt.in
index 2b5994e95c..83b7ade407 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 7321fbb
+ GIT_TAG 16eb34f
SOURCE_DIR "${TD_SOURCE_DIR}/tools/taos-tools"
BINARY_DIR ""
#BUILD_IN_SOURCE TRUE
diff --git a/docs/en/07-develop/09-udf.md b/docs/en/07-develop/09-udf.md
index deb9c4cdb5..253f1270f5 100644
--- a/docs/en/07-develop/09-udf.md
+++ b/docs/en/07-develop/09-udf.md
@@ -218,9 +218,9 @@ After compiling your function into a DLL, you add it to TDengine. For more infor
## Sample Code
-### Sample scalar function: [bit_and](https://github.com/taosdata/TDengine/blob/develop/tests/script/sh/bit_and.c)
+### Sample scalar function: [bit_and](https://github.com/taosdata/TDengine/blob/3.0/tests/script/sh/bit_and.c)
-The bit_add function implements bitwise addition for multiple columns. If there is only one column, the column is returned. The bit_add function ignores null values.
+The bit_and function implements bitwise addition for multiple columns. If there is only one column, the column is returned. The bit_and function ignores null values.
bit_and.c
@@ -231,7 +231,7 @@ The bit_add function implements bitwise addition for multiple columns. If there
-### Sample aggregate function: [l2norm](https://github.com/taosdata/TDengine/blob/develop/tests/script/sh/l2norm.c)
+### Sample aggregate function: [l2norm](https://github.com/taosdata/TDengine/blob/3.0/tests/script/sh/l2norm.c)
The l2norm function finds the second-order norm for all data in the input column. This squares the values, takes a cumulative sum, and finds the square root.
diff --git a/docs/en/12-taos-sql/03-table.md b/docs/en/12-taos-sql/03-table.md
index 5a2c8ed6ee..6d12b8c730 100644
--- a/docs/en/12-taos-sql/03-table.md
+++ b/docs/en/12-taos-sql/03-table.md
@@ -7,12 +7,12 @@ title: Table
You create standard tables and subtables with the `CREATE TABLE` statement.
```sql
-CREATE TABLE [IF NOT EXISTS] [db_name.]tb_name (create_definition [, create_definitionn] ...) [table_options]
+CREATE TABLE [IF NOT EXISTS] [db_name.]tb_name (create_definition [, create_definition] ...) [table_options]
CREATE TABLE create_subtable_clause
-CREATE TABLE [IF NOT EXISTS] [db_name.]tb_name (create_definition [, create_definitionn] ...)
- [TAGS (create_definition [, create_definitionn] ...)]
+CREATE TABLE [IF NOT EXISTS] [db_name.]tb_name (create_definition [, create_definition] ...)
+ [TAGS (create_definition [, create_definition] ...)]
[table_options]
create_subtable_clause: {
@@ -195,4 +195,4 @@ This command is useful in migrating data from one TDengine cluster to another be
```
DESCRIBE [db_name.]tb_name;
-```
\ No newline at end of file
+```
diff --git a/docs/en/12-taos-sql/04-stable.md b/docs/en/12-taos-sql/04-stable.md
index a20e33163b..8a7c713f8c 100644
--- a/docs/en/12-taos-sql/04-stable.md
+++ b/docs/en/12-taos-sql/04-stable.md
@@ -6,7 +6,7 @@ title: Supertable
## Create a Supertable
```sql
-CREATE STABLE [IF NOT EXISTS] stb_name (create_definition [, create_definitionn] ...) TAGS (create_definition [, create_definition] ...) [table_options]
+CREATE STABLE [IF NOT EXISTS] stb_name (create_definition [, create_definition] ...) TAGS (create_definition [, create_definition] ...) [table_options]
create_definition:
col_name column_definition
diff --git a/docs/en/14-reference/05-taosbenchmark.md b/docs/en/14-reference/05-taosbenchmark.md
index b114f92a41..d21f1829b0 100644
--- a/docs/en/14-reference/05-taosbenchmark.md
+++ b/docs/en/14-reference/05-taosbenchmark.md
@@ -374,7 +374,11 @@ The configuration parameters for specifying super table tag columns and data col
### Query scenario configuration parameters
-`filetype` must be set to `query` in the query scenario. See [General Configuration Parameters](#General Configuration Parameters) for details of this parameter and other general parameters
+`filetype` must be set to `query` in the query scenario.
+
+To control the query scenario by setting `kill_slow_query_threshold` and `kill_slow_query_interval` parameters to kill the execution of slow query statements. Threshold controls exec_usec of query command will be killed by taosBenchmark after the specified time, in seconds; interval controls sleep time to avoid continuous querying of slow queries consuming CPU in seconds.
+
+See [General Configuration Parameters](#General Configuration Parameters) for details of other general parameters.
#### Configuration parameters for executing the specified query statement
diff --git a/docs/en/14-reference/12-config/index.md b/docs/en/14-reference/12-config/index.md
index 8053c4d25d..769d19e7f9 100644
--- a/docs/en/14-reference/12-config/index.md
+++ b/docs/en/14-reference/12-config/index.md
@@ -106,7 +106,7 @@ The parameters described in this document by the effect that they have on the sy
| Applicable | Server only |
| Meaning | The switch for monitoring inside server. The main object of monitoring is to collect information about load on physical nodes, including CPU usage, memory usage, disk usage, and network bandwidth. Monitoring information is sent over HTTP to the taosKeeper service specified by `monitorFqdn` and `monitorProt`.
| Value Range | 0: monitoring disabled, 1: monitoring enabled |
-| Default | 1 |
+| Default | 0 |
### monitorFqdn
diff --git a/docs/zh/12-taos-sql/03-table.md b/docs/zh/12-taos-sql/03-table.md
index f6790e3c69..045abcde95 100644
--- a/docs/zh/12-taos-sql/03-table.md
+++ b/docs/zh/12-taos-sql/03-table.md
@@ -9,12 +9,12 @@ description: 对表的各种管理操作
`CREATE TABLE` 语句用于创建普通表和以超级表为模板创建子表。
```sql
-CREATE TABLE [IF NOT EXISTS] [db_name.]tb_name (create_definition [, create_definitionn] ...) [table_options]
+CREATE TABLE [IF NOT EXISTS] [db_name.]tb_name (create_definition [, create_definition] ...) [table_options]
CREATE TABLE create_subtable_clause
-CREATE TABLE [IF NOT EXISTS] [db_name.]tb_name (create_definition [, create_definitionn] ...)
- [TAGS (create_definition [, create_definitionn] ...)]
+CREATE TABLE [IF NOT EXISTS] [db_name.]tb_name (create_definition [, create_definition] ...)
+ [TAGS (create_definition [, create_definition] ...)]
[table_options]
create_subtable_clause: {
diff --git a/docs/zh/12-taos-sql/04-stable.md b/docs/zh/12-taos-sql/04-stable.md
index 7dff30e443..bd32da68ae 100644
--- a/docs/zh/12-taos-sql/04-stable.md
+++ b/docs/zh/12-taos-sql/04-stable.md
@@ -7,7 +7,7 @@ description: 对超级表的各种管理操作
## 创建超级表
```sql
-CREATE STABLE [IF NOT EXISTS] stb_name (create_definition [, create_definitionn] ...) TAGS (create_definition [, create_definition] ...) [table_options]
+CREATE STABLE [IF NOT EXISTS] stb_name (create_definition [, create_definition] ...) TAGS (create_definition [, create_definition] ...) [table_options]
create_definition:
col_name column_definition
diff --git a/docs/zh/12-taos-sql/06-select.md b/docs/zh/12-taos-sql/06-select.md
index 3ffc081cd7..3cd68e9b95 100644
--- a/docs/zh/12-taos-sql/06-select.md
+++ b/docs/zh/12-taos-sql/06-select.md
@@ -224,7 +224,7 @@ GROUP BY 子句中的表达式可以包含表或视图中的任何列,这些
该子句对行进行分组,但不保证结果集的顺序。若要对分组进行排序,请使用 ORDER BY 子句
-## PARTITON BY
+## PARTITION BY
PARTITION BY 子句是 TDengine 特色语法,按 part_list 对数据进行切分,在每个切分的分片中进行计算。
diff --git a/docs/zh/12-taos-sql/24-show.md b/docs/zh/12-taos-sql/24-show.md
index db9e3fd136..4bd1e52284 100644
--- a/docs/zh/12-taos-sql/24-show.md
+++ b/docs/zh/12-taos-sql/24-show.md
@@ -211,10 +211,10 @@ SHOW USERS;
显示当前系统中所有用户的信息。包括用户自定义的用户和系统默认用户。
-## SHOW VARIABLES
+## SHOW CLUSTER VARIABLES(3.0.1.6 之前为 SHOW VARIABLES)
```sql
-SHOW VARIABLES;
+SHOW CLUSTER VARIABLES;
SHOW DNODE dnode_id VARIABLES;
```
diff --git a/docs/zh/14-reference/05-taosbenchmark.md b/docs/zh/14-reference/05-taosbenchmark.md
index afc050298f..13530923b8 100644
--- a/docs/zh/14-reference/05-taosbenchmark.md
+++ b/docs/zh/14-reference/05-taosbenchmark.md
@@ -374,7 +374,11 @@ taosBenchmark -A INT,DOUBLE,NCHAR,BINARY\(16\)
### 查询场景配置参数
-查询场景下 `filetype` 必须设置为 `query`,该参数及其它通用参数详见[通用配置参数](#通用配置参数)
+查询场景下 `filetype` 必须设置为 `query`。
+
+查询场景可以通过设置 `kill_slow_query_threshold` 和 `kill_slow_query_interval` 参数来控制杀掉慢查询语句的执行,threshold 控制如果 exec_usec 超过指定时间的查询将被 taosBenchmark 杀掉,单位为秒;interval 控制休眠时间,避免持续查询慢查询消耗 CPU ,单位为秒。
+
+其它通用参数详见[通用配置参数](#通用配置参数)。
#### 执行指定查询语句的配置参数
diff --git a/docs/zh/14-reference/12-config/index.md b/docs/zh/14-reference/12-config/index.md
index 74af793f9f..d587dd2f2c 100644
--- a/docs/zh/14-reference/12-config/index.md
+++ b/docs/zh/14-reference/12-config/index.md
@@ -106,7 +106,7 @@ taos --dump-config
| 适用范围 | 仅服务端适用 |
| 含义 | 服务器内部的系统监控开关。监控主要负责收集物理节点的负载状况,包括 CPU、内存、硬盘、网络带宽的监控记录,监控信息将通过 HTTP 协议发送给由 `monitorFqdn` 和 `monitorProt` 指定的 TaosKeeper 监控服务 |
| 取值范围 | 0:关闭监控服务, 1:激活监控服务。 |
-| 缺省值 | 1 |
+| 缺省值 | 0 |
### monitorFqdn
diff --git a/include/common/tglobal.h b/include/common/tglobal.h
index cb4426f8a9..99bbfde3e1 100644
--- a/include/common/tglobal.h
+++ b/include/common/tglobal.h
@@ -119,12 +119,16 @@ extern SDiskCfg tsDiskCfg[];
// udf
extern bool tsStartUdfd;
extern char tsUdfdResFuncs[];
+extern char tsUdfdLdLibPath[];
// schemaless
extern char tsSmlChildTableName[];
extern char tsSmlTagName[];
extern bool tsSmlDataFormat;
+// wal
+extern int64_t tsWalFsyncDataSizeLimit;
+
// internal
extern int32_t tsTransPullupInterval;
extern int32_t tsMqRebalanceInterval;
diff --git a/include/common/tmsg.h b/include/common/tmsg.h
index b445aed244..7bc56daab0 100644
--- a/include/common/tmsg.h
+++ b/include/common/tmsg.h
@@ -57,9 +57,11 @@ extern int32_t tMsgDict[];
#define TMSG_SEG_SEQ(TYPE) ((TYPE)&0xff)
#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_STREAM_MAX_MSG || (TYPE) < TDMT_MON_MAX_MSG || (TYPE) < TDMT_SYNC_MAX_MSG) || \
+ (TYPE) < TDMT_VND_STREAM_MSG || (TYPE) < TDMT_VND_TMQ_MSG \
? tMsgInfo[tMsgDict[TMSG_SEG_CODE(TYPE)] + TMSG_SEG_SEQ(TYPE)] \
: 0
+
#define TMSG_INDEX(TYPE) (tMsgDict[TMSG_SEG_CODE(TYPE)] + TMSG_SEG_SEQ(TYPE))
typedef uint16_t tmsg_t;
@@ -295,7 +297,6 @@ typedef struct {
typedef struct {
int32_t code;
- int8_t hashMeta;
int64_t uid;
char* tblFName;
int32_t numOfRows;
@@ -1126,6 +1127,7 @@ typedef struct {
SQnodeLoad qload;
SClusterCfg clusterCfg;
SArray* pVloads; // array of SVnodeLoad
+ int32_t statusSeq;
} SStatusReq;
int32_t tSerializeSStatusReq(void* buf, int32_t bufLen, SStatusReq* pReq);
@@ -1147,6 +1149,7 @@ typedef struct {
int64_t dnodeVer;
SDnodeCfg dnodeCfg;
SArray* pDnodeEps; // Array of SDnodeEp
+ int32_t statusSeq;
} SStatusRsp;
int32_t tSerializeSStatusRsp(void* buf, int32_t bufLen, SStatusRsp* pRsp);
@@ -1478,6 +1481,7 @@ typedef struct {
int32_t dnodeId;
char fqdn[TSDB_FQDN_LEN];
int32_t port;
+ int8_t force;
} SDropDnodeReq;
int32_t tSerializeSDropDnodeReq(void* buf, int32_t bufLen, SDropDnodeReq* pReq);
diff --git a/include/common/tmsgdef.h b/include/common/tmsgdef.h
index 571d14fe3c..58e7b71bec 100644
--- a/include/common/tmsgdef.h
+++ b/include/common/tmsgdef.h
@@ -138,18 +138,18 @@ enum {
TD_DEF_MSG_TYPE(TDMT_MND_GET_TABLE_INDEX, "get-table-index", NULL, NULL)
TD_DEF_MSG_TYPE(TDMT_MND_BATCH_META, "batch-meta", NULL, NULL)
TD_DEF_MSG_TYPE(TDMT_MND_TABLE_CFG, "table-cfg", NULL, NULL)
- TD_DEF_MSG_TYPE(TDMT_MND_CREATE_TOPIC, "create-topic", SMCreateTopicReq, SMCreateTopicRsp)
- TD_DEF_MSG_TYPE(TDMT_MND_ALTER_TOPIC, "alter-topic", NULL, NULL)
- TD_DEF_MSG_TYPE(TDMT_MND_DROP_TOPIC, "drop-topic", NULL, NULL)
- TD_DEF_MSG_TYPE(TDMT_MND_SUBSCRIBE, "subscribe", SCMSubscribeReq, SCMSubscribeRsp)
- TD_DEF_MSG_TYPE(TDMT_MND_MQ_ASK_EP, "ask-ep", SMqAskEpReq, SMqAskEpRsp)
- TD_DEF_MSG_TYPE(TDMT_MND_MQ_CONSUMER_LOST, "consumer-lost", SMqConsumerLostMsg, NULL)
- TD_DEF_MSG_TYPE(TDMT_MND_MQ_CONSUMER_RECOVER, "consumer-recover", SMqConsumerRecoverMsg, NULL)
- TD_DEF_MSG_TYPE(TDMT_MND_MQ_HB, "consumer-hb", NULL, NULL)
- TD_DEF_MSG_TYPE(TDMT_MND_MQ_DO_REBALANCE, "do-rebalance", SMqDoRebalanceMsg, NULL)
- TD_DEF_MSG_TYPE(TDMT_MND_MQ_DROP_CGROUP, "drop-cgroup", SMqDropCGroupReq, SMqDropCGroupRsp)
- TD_DEF_MSG_TYPE(TDMT_MND_MQ_COMMIT_OFFSET, "mnode-commit-offset", SMqCMCommitOffsetReq, SMqCMCommitOffsetRsp)
- TD_DEF_MSG_TYPE(TDMT_MND_MQ_TIMER, "mq-tmr", SMTimerReq, NULL)
+ TD_DEF_MSG_TYPE(TDMT_MND_TMQ_CREATE_TOPIC, "create-topic", SMCreateTopicReq, SMCreateTopicRsp)
+ TD_DEF_MSG_TYPE(TDMT_MND_UNUSED1, "unused", NULL, NULL)
+ TD_DEF_MSG_TYPE(TDMT_MND_TMQ_DROP_TOPIC, "drop-topic", NULL, NULL)
+ TD_DEF_MSG_TYPE(TDMT_MND_TMQ_SUBSCRIBE, "subscribe", SCMSubscribeReq, SCMSubscribeRsp)
+ TD_DEF_MSG_TYPE(TDMT_MND_TMQ_ASK_EP, "ask-ep", SMqAskEpReq, SMqAskEpRsp)
+ TD_DEF_MSG_TYPE(TDMT_MND_TMQ_CONSUMER_LOST, "consumer-lost", SMqConsumerLostMsg, NULL)
+ TD_DEF_MSG_TYPE(TDMT_MND_TMQ_CONSUMER_RECOVER, "consumer-recover", SMqConsumerRecoverMsg, NULL)
+ TD_DEF_MSG_TYPE(TDMT_MND_TMQ_HB, "consumer-hb", NULL, NULL)
+ TD_DEF_MSG_TYPE(TDMT_MND_TMQ_DO_REBALANCE, "do-rebalance", SMqDoRebalanceMsg, NULL)
+ TD_DEF_MSG_TYPE(TDMT_MND_TMQ_DROP_CGROUP, "drop-cgroup", SMqDropCGroupReq, SMqDropCGroupRsp)
+ TD_DEF_MSG_TYPE(TDMT_MND_UNUSED2, "unused2", NULL, NULL)
+ TD_DEF_MSG_TYPE(TDMT_MND_TMQ_TIMER, "mq-tmr", SMTimerReq, NULL)
TD_DEF_MSG_TYPE(TDMT_MND_TELEM_TIMER, "telem-tmr", SMTimerReq, SMTimerReq)
TD_DEF_MSG_TYPE(TDMT_MND_TRANS_TIMER, "trans-tmr", NULL, NULL)
TD_DEF_MSG_TYPE(TDMT_MND_TTL_TIMER, "ttl-tmr", NULL, NULL)
@@ -186,21 +186,21 @@ enum {
TD_DEF_MSG_TYPE(TDMT_VND_CREATE_STB, "vnode-create-stb", SVCreateStbReq, NULL)
TD_DEF_MSG_TYPE(TDMT_VND_ALTER_STB, "vnode-alter-stb", NULL, NULL)
TD_DEF_MSG_TYPE(TDMT_VND_DROP_STB, "vnode-drop-stb", SVDropStbReq, NULL)
- TD_DEF_MSG_TYPE(TDMT_VND_MQ_VG_CHANGE, "vnode-mq-vg-change", SMqRebVgReq, SMqRebVgRsp)
- TD_DEF_MSG_TYPE(TDMT_VND_MQ_VG_DELETE, "vnode-mq-vg-delete", SMqVDeleteReq, SMqVDeleteRsp)
- TD_DEF_MSG_TYPE(TDMT_VND_MQ_COMMIT_OFFSET, "vnode-commit-offset", STqOffset, STqOffset)
- TD_DEF_MSG_TYPE(TDMT_VND_ADD_CHECK_INFO, "vnode-add-check-info", NULL, NULL)
- TD_DEF_MSG_TYPE(TDMT_VND_DELETE_CHECK_INFO, "vnode-delete-check-info", NULL, NULL)
- TD_DEF_MSG_TYPE(TDMT_VND_CREATE_TOPIC, "vnode-create-topic", NULL, NULL)
- TD_DEF_MSG_TYPE(TDMT_VND_ALTER_TOPIC, "vnode-alter-topic", NULL, NULL)
- TD_DEF_MSG_TYPE(TDMT_VND_DROP_TOPIC, "vnode-drop-topic", NULL, NULL)
- TD_DEF_MSG_TYPE(TDMT_VND_SUBSCRIBE, "vnode-subscribe", SMVSubscribeReq, SMVSubscribeRsp)
- TD_DEF_MSG_TYPE(TDMT_VND_CONSUME, "vnode-consume", SMqPollReq, SMqDataBlkRsp)
- TD_DEF_MSG_TYPE(TDMT_VND_STREAM_TRIGGER, "vnode-stream-trigger", NULL, NULL)
- TD_DEF_MSG_TYPE(TDMT_VND_STREAM_DISPATCH_WRITE, "vnode-stream-task-dispatch-write", NULL, NULL)
- TD_DEF_MSG_TYPE(TDMT_VND_STREAM_RECOVER_STEP1, "vnode-stream-recover1", NULL, NULL)
- TD_DEF_MSG_TYPE(TDMT_VND_STREAM_RECOVER_STEP2, "vnode-stream-recover2", NULL, NULL)
- TD_DEF_MSG_TYPE(TDMT_VND_STREAM_RECOVER_FINISH, "vnode-stream-finish", NULL, NULL)
+ TD_DEF_MSG_TYPE(TDMT_VND_UNUSED1, "vnode-unused1", NULL, NULL)
+ TD_DEF_MSG_TYPE(TDMT_VND_UNUSED2, "vnode-unused2", NULL, NULL)
+ TD_DEF_MSG_TYPE(TDMT_VND_UNUSED3, "vnode-unused3", NULL, NULL)
+ TD_DEF_MSG_TYPE(TDMT_VND_UNUSED4, "vnode-unused4", NULL, NULL)
+ TD_DEF_MSG_TYPE(TDMT_VND_UNUSED5, "vnode-unused5", NULL, NULL)
+ TD_DEF_MSG_TYPE(TDMT_VND_UNUSED6, "vnode-unused6", NULL, NULL)
+ TD_DEF_MSG_TYPE(TDMT_VND_UNUSED7, "vnode-unused7", NULL, NULL)
+ TD_DEF_MSG_TYPE(TDMT_VND_UNUSED8, "vnode-unused8", NULL, NULL)
+ TD_DEF_MSG_TYPE(TDMT_VND_UNUSED9, "vnode-unused9", NULL, NULL)
+ TD_DEF_MSG_TYPE(TDMT_VND_UNUSED10, "vnode-unused10", NULL, NULL)
+ TD_DEF_MSG_TYPE(TDMT_VND_UNUSED11, "vnode-unused11", NULL, NULL)
+ TD_DEF_MSG_TYPE(TDMT_VND_UNUSED12, "vnode-unused12", NULL, NULL)
+ TD_DEF_MSG_TYPE(TDMT_VND_UNUSED13, "vnode-unused13", NULL, NULL)
+ TD_DEF_MSG_TYPE(TDMT_VND_UNUSED14, "vnode-unused14", NULL, NULL)
+ TD_DEF_MSG_TYPE(TDMT_VND_UNUSED15, "vnode-unused15", NULL, NULL)
TD_DEF_MSG_TYPE(TDMT_VND_CREATE_SMA, "vnode-create-sma", NULL, NULL)
TD_DEF_MSG_TYPE(TDMT_VND_CANCEL_SMA, "vnode-cancel-sma", NULL, NULL)
TD_DEF_MSG_TYPE(TDMT_VND_DROP_SMA, "vnode-drop-sma", NULL, NULL)
@@ -232,13 +232,16 @@ enum {
TD_DEF_MSG_TYPE(TDMT_SCH_LINK_BROKEN, "link-broken", NULL, NULL)
TD_DEF_MSG_TYPE(TDMT_SCH_MAX_MSG, "sch-max", NULL, NULL)
+
TD_NEW_MSG_SEG(TDMT_STREAM_MSG)
TD_DEF_MSG_TYPE(TDMT_STREAM_TASK_DEPLOY, "stream-task-deploy", SStreamTaskDeployReq, SStreamTaskDeployRsp)
TD_DEF_MSG_TYPE(TDMT_STREAM_TASK_DROP, "stream-task-drop", NULL, NULL)
TD_DEF_MSG_TYPE(TDMT_STREAM_TASK_RUN, "stream-task-run", NULL, NULL)
TD_DEF_MSG_TYPE(TDMT_STREAM_TASK_DISPATCH, "stream-task-dispatch", NULL, NULL)
- TD_DEF_MSG_TYPE(TDMT_STREAM_TASK_RECOVER, "stream-task-recover", NULL, NULL)
+ TD_DEF_MSG_TYPE(TDMT_STREAM_UNUSED1, "stream-unused1", NULL, NULL)
TD_DEF_MSG_TYPE(TDMT_STREAM_RETRIEVE, "stream-retrieve", NULL, NULL)
+ TD_DEF_MSG_TYPE(TDMT_STREAM_RECOVER_FINISH, "vnode-stream-finish", NULL, NULL)
+ TD_DEF_MSG_TYPE(TDMT_STREAM_TASK_CHECK, "vnode-stream-task-check", NULL, NULL)
TD_DEF_MSG_TYPE(TDMT_STREAM_MAX_MSG, "stream-max", NULL, NULL)
TD_NEW_MSG_SEG(TDMT_MON_MSG)
@@ -270,8 +273,26 @@ enum {
TD_DEF_MSG_TYPE(TDMT_SYNC_HEARTBEAT, "sync-heartbeat", NULL, NULL)
TD_DEF_MSG_TYPE(TDMT_SYNC_HEARTBEAT_REPLY, "sync-heartbeat-reply", NULL, NULL)
TD_DEF_MSG_TYPE(TDMT_SYNC_LOCAL_CMD, "sync-local-cmd", NULL, NULL)
+ TD_DEF_MSG_TYPE(TDMT_SYNC_PRE_SNAPSHOT, "sync-pre-snapshot", NULL, NULL)
+ TD_DEF_MSG_TYPE(TDMT_SYNC_PRE_SNAPSHOT_REPLY, "sync-pre-snapshot-reply", NULL, NULL)
TD_DEF_MSG_TYPE(TDMT_SYNC_MAX_MSG, "sync-max", NULL, NULL)
+ TD_NEW_MSG_SEG(TDMT_VND_STREAM_MSG)
+ TD_DEF_MSG_TYPE(TDMT_VND_STREAM_TRIGGER, "vnode-stream-trigger", NULL, NULL)
+ TD_DEF_MSG_TYPE(TDMT_VND_STREAM_RECOVER_STEP1, "vnode-stream-recover1", NULL, NULL)
+ TD_DEF_MSG_TYPE(TDMT_VND_STREAM_RECOVER_STEP2, "vnode-stream-recover2", NULL, NULL)
+ TD_DEF_MSG_TYPE(TDMT_VND_STREAM_MAX_MSG, "vnd-stream-max", NULL, NULL)
+
+ TD_NEW_MSG_SEG(TDMT_VND_TMQ_MSG)
+ TD_DEF_MSG_TYPE(TDMT_VND_TMQ_SUBSCRIBE, "vnode-tmq-subscribe", SMqRebVgReq, SMqRebVgRsp)
+ TD_DEF_MSG_TYPE(TDMT_VND_TMQ_DELETE_SUB, "vnode-tmq-delete-sub", SMqVDeleteReq, SMqVDeleteRsp)
+ TD_DEF_MSG_TYPE(TDMT_VND_TMQ_COMMIT_OFFSET, "vnode-tmq-commit-offset", STqOffset, STqOffset)
+ TD_DEF_MSG_TYPE(TDMT_VND_TMQ_ADD_CHECKINFO, "vnode-tmq-add-checkinfo", NULL, NULL)
+ TD_DEF_MSG_TYPE(TDMT_VND_TMQ_DEL_CHECKINFO, "vnode-del-checkinfo", NULL, NULL)
+ TD_DEF_MSG_TYPE(TDMT_VND_TMQ_CONSUME, "vnode-tmq-consume", SMqPollReq, SMqDataBlkRsp)
+ TD_DEF_MSG_TYPE(TDMT_VND_TMQ_MAX_MSG, "vnd-tmq-max", NULL, NULL)
+
+
#if defined(TD_MSG_NUMBER_)
TDMT_MAX
#endif
diff --git a/include/common/tname.h b/include/common/tname.h
index 8c594a2b5e..666a25303e 100644
--- a/include/common/tname.h
+++ b/include/common/tname.h
@@ -72,13 +72,13 @@ bool tNameTbNameEqual(SName* left, SName* right);
typedef struct {
// input
- SArray* tags; // element is SSmlKv
- const char* sTableName; // super table name
- uint8_t sTableNameLen; // the length of super table name
+ SArray* tags; // element is SSmlKv
+ const char* stbFullName; // super table name
+ uint8_t stbFullNameLen; // the length of super table name
// output
- char* childTableName; // must have size of TSDB_TABLE_NAME_LEN;
- uint64_t uid; // child table uid, may be useful
+ char* ctbShortName; // must have size of TSDB_TABLE_NAME_LEN;
+ uint64_t uid; // child table uid, may be useful
} RandTableName;
void buildChildTableName(RandTableName* rName);
diff --git a/include/common/ttokendef.h b/include/common/ttokendef.h
index dcd060205b..f5c99fcae7 100644
--- a/include/common/ttokendef.h
+++ b/include/common/ttokendef.h
@@ -66,280 +66,281 @@
#define TK_PORT 48
#define TK_DNODES 49
#define TK_NK_IPTOKEN 50
-#define TK_LOCAL 51
-#define TK_QNODE 52
-#define TK_BNODE 53
-#define TK_SNODE 54
-#define TK_MNODE 55
-#define TK_DATABASE 56
-#define TK_USE 57
-#define TK_FLUSH 58
-#define TK_TRIM 59
-#define TK_IF 60
-#define TK_NOT 61
-#define TK_EXISTS 62
-#define TK_BUFFER 63
-#define TK_CACHEMODEL 64
-#define TK_CACHESIZE 65
-#define TK_COMP 66
-#define TK_DURATION 67
-#define TK_NK_VARIABLE 68
-#define TK_MAXROWS 69
-#define TK_MINROWS 70
-#define TK_KEEP 71
-#define TK_PAGES 72
-#define TK_PAGESIZE 73
-#define TK_TSDB_PAGESIZE 74
-#define TK_PRECISION 75
-#define TK_REPLICA 76
-#define TK_STRICT 77
-#define TK_VGROUPS 78
-#define TK_SINGLE_STABLE 79
-#define TK_RETENTIONS 80
-#define TK_SCHEMALESS 81
-#define TK_WAL_LEVEL 82
-#define TK_WAL_FSYNC_PERIOD 83
-#define TK_WAL_RETENTION_PERIOD 84
-#define TK_WAL_RETENTION_SIZE 85
-#define TK_WAL_ROLL_PERIOD 86
-#define TK_WAL_SEGMENT_SIZE 87
-#define TK_STT_TRIGGER 88
-#define TK_TABLE_PREFIX 89
-#define TK_TABLE_SUFFIX 90
-#define TK_NK_COLON 91
-#define TK_MAX_SPEED 92
-#define TK_TABLE 93
-#define TK_NK_LP 94
-#define TK_NK_RP 95
-#define TK_STABLE 96
-#define TK_ADD 97
-#define TK_COLUMN 98
-#define TK_MODIFY 99
-#define TK_RENAME 100
-#define TK_TAG 101
-#define TK_SET 102
-#define TK_NK_EQ 103
-#define TK_USING 104
-#define TK_TAGS 105
-#define TK_COMMENT 106
-#define TK_BOOL 107
-#define TK_TINYINT 108
-#define TK_SMALLINT 109
-#define TK_INT 110
-#define TK_INTEGER 111
-#define TK_BIGINT 112
-#define TK_FLOAT 113
-#define TK_DOUBLE 114
-#define TK_BINARY 115
-#define TK_TIMESTAMP 116
-#define TK_NCHAR 117
-#define TK_UNSIGNED 118
-#define TK_JSON 119
-#define TK_VARCHAR 120
-#define TK_MEDIUMBLOB 121
-#define TK_BLOB 122
-#define TK_VARBINARY 123
-#define TK_DECIMAL 124
-#define TK_MAX_DELAY 125
-#define TK_WATERMARK 126
-#define TK_ROLLUP 127
-#define TK_TTL 128
-#define TK_SMA 129
-#define TK_FIRST 130
-#define TK_LAST 131
-#define TK_SHOW 132
-#define TK_DATABASES 133
-#define TK_TABLES 134
-#define TK_STABLES 135
-#define TK_MNODES 136
-#define TK_QNODES 137
-#define TK_FUNCTIONS 138
-#define TK_INDEXES 139
-#define TK_ACCOUNTS 140
-#define TK_APPS 141
-#define TK_CONNECTIONS 142
-#define TK_LICENCES 143
-#define TK_GRANTS 144
-#define TK_QUERIES 145
-#define TK_SCORES 146
-#define TK_TOPICS 147
-#define TK_VARIABLES 148
-#define TK_CLUSTER 149
-#define TK_BNODES 150
-#define TK_SNODES 151
-#define TK_TRANSACTIONS 152
-#define TK_DISTRIBUTED 153
-#define TK_CONSUMERS 154
-#define TK_SUBSCRIPTIONS 155
-#define TK_VNODES 156
-#define TK_LIKE 157
-#define TK_INDEX 158
-#define TK_FUNCTION 159
-#define TK_INTERVAL 160
-#define TK_TOPIC 161
-#define TK_AS 162
-#define TK_WITH 163
-#define TK_META 164
-#define TK_CONSUMER 165
-#define TK_GROUP 166
-#define TK_DESC 167
-#define TK_DESCRIBE 168
-#define TK_RESET 169
-#define TK_QUERY 170
-#define TK_CACHE 171
-#define TK_EXPLAIN 172
-#define TK_ANALYZE 173
-#define TK_VERBOSE 174
-#define TK_NK_BOOL 175
-#define TK_RATIO 176
-#define TK_NK_FLOAT 177
-#define TK_OUTPUTTYPE 178
-#define TK_AGGREGATE 179
-#define TK_BUFSIZE 180
-#define TK_STREAM 181
-#define TK_INTO 182
-#define TK_TRIGGER 183
-#define TK_AT_ONCE 184
-#define TK_WINDOW_CLOSE 185
-#define TK_IGNORE 186
-#define TK_EXPIRED 187
-#define TK_FILL_HISTORY 188
-#define TK_SUBTABLE 189
-#define TK_KILL 190
-#define TK_CONNECTION 191
-#define TK_TRANSACTION 192
-#define TK_BALANCE 193
-#define TK_VGROUP 194
-#define TK_MERGE 195
-#define TK_REDISTRIBUTE 196
-#define TK_SPLIT 197
-#define TK_DELETE 198
-#define TK_INSERT 199
-#define TK_NULL 200
-#define TK_NK_QUESTION 201
-#define TK_NK_ARROW 202
-#define TK_ROWTS 203
-#define TK_TBNAME 204
-#define TK_QSTART 205
-#define TK_QEND 206
-#define TK_QDURATION 207
-#define TK_WSTART 208
-#define TK_WEND 209
-#define TK_WDURATION 210
-#define TK_IROWTS 211
-#define TK_QTAGS 212
-#define TK_CAST 213
-#define TK_NOW 214
-#define TK_TODAY 215
-#define TK_TIMEZONE 216
-#define TK_CLIENT_VERSION 217
-#define TK_SERVER_VERSION 218
-#define TK_SERVER_STATUS 219
-#define TK_CURRENT_USER 220
-#define TK_COUNT 221
-#define TK_LAST_ROW 222
-#define TK_CASE 223
-#define TK_END 224
-#define TK_WHEN 225
-#define TK_THEN 226
-#define TK_ELSE 227
-#define TK_BETWEEN 228
-#define TK_IS 229
-#define TK_NK_LT 230
-#define TK_NK_GT 231
-#define TK_NK_LE 232
-#define TK_NK_GE 233
-#define TK_NK_NE 234
-#define TK_MATCH 235
-#define TK_NMATCH 236
-#define TK_CONTAINS 237
-#define TK_IN 238
-#define TK_JOIN 239
-#define TK_INNER 240
-#define TK_SELECT 241
-#define TK_DISTINCT 242
-#define TK_WHERE 243
-#define TK_PARTITION 244
-#define TK_BY 245
-#define TK_SESSION 246
-#define TK_STATE_WINDOW 247
-#define TK_SLIDING 248
-#define TK_FILL 249
-#define TK_VALUE 250
-#define TK_NONE 251
-#define TK_PREV 252
-#define TK_LINEAR 253
-#define TK_NEXT 254
-#define TK_HAVING 255
-#define TK_RANGE 256
-#define TK_EVERY 257
-#define TK_ORDER 258
-#define TK_SLIMIT 259
-#define TK_SOFFSET 260
-#define TK_LIMIT 261
-#define TK_OFFSET 262
-#define TK_ASC 263
-#define TK_NULLS 264
-#define TK_ABORT 265
-#define TK_AFTER 266
-#define TK_ATTACH 267
-#define TK_BEFORE 268
-#define TK_BEGIN 269
-#define TK_BITAND 270
-#define TK_BITNOT 271
-#define TK_BITOR 272
-#define TK_BLOCKS 273
-#define TK_CHANGE 274
-#define TK_COMMA 275
-#define TK_COMPACT 276
-#define TK_CONCAT 277
-#define TK_CONFLICT 278
-#define TK_COPY 279
-#define TK_DEFERRED 280
-#define TK_DELIMITERS 281
-#define TK_DETACH 282
-#define TK_DIVIDE 283
-#define TK_DOT 284
-#define TK_EACH 285
-#define TK_FAIL 286
-#define TK_FILE 287
-#define TK_FOR 288
-#define TK_GLOB 289
-#define TK_ID 290
-#define TK_IMMEDIATE 291
-#define TK_IMPORT 292
-#define TK_INITIALLY 293
-#define TK_INSTEAD 294
-#define TK_ISNULL 295
-#define TK_KEY 296
-#define TK_MODULES 297
-#define TK_NK_BITNOT 298
-#define TK_NK_SEMI 299
-#define TK_NOTNULL 300
-#define TK_OF 301
-#define TK_PLUS 302
-#define TK_PRIVILEGE 303
-#define TK_RAISE 304
-#define TK_REPLACE 305
-#define TK_RESTRICT 306
-#define TK_ROW 307
-#define TK_SEMI 308
-#define TK_STAR 309
-#define TK_STATEMENT 310
-#define TK_STRING 311
-#define TK_TIMES 312
-#define TK_UPDATE 313
-#define TK_VALUES 314
-#define TK_VARIABLE 315
-#define TK_VIEW 316
-#define TK_WAL 317
+#define TK_FORCE 51
+#define TK_LOCAL 52
+#define TK_QNODE 53
+#define TK_BNODE 54
+#define TK_SNODE 55
+#define TK_MNODE 56
+#define TK_DATABASE 57
+#define TK_USE 58
+#define TK_FLUSH 59
+#define TK_TRIM 60
+#define TK_IF 61
+#define TK_NOT 62
+#define TK_EXISTS 63
+#define TK_BUFFER 64
+#define TK_CACHEMODEL 65
+#define TK_CACHESIZE 66
+#define TK_COMP 67
+#define TK_DURATION 68
+#define TK_NK_VARIABLE 69
+#define TK_MAXROWS 70
+#define TK_MINROWS 71
+#define TK_KEEP 72
+#define TK_PAGES 73
+#define TK_PAGESIZE 74
+#define TK_TSDB_PAGESIZE 75
+#define TK_PRECISION 76
+#define TK_REPLICA 77
+#define TK_STRICT 78
+#define TK_VGROUPS 79
+#define TK_SINGLE_STABLE 80
+#define TK_RETENTIONS 81
+#define TK_SCHEMALESS 82
+#define TK_WAL_LEVEL 83
+#define TK_WAL_FSYNC_PERIOD 84
+#define TK_WAL_RETENTION_PERIOD 85
+#define TK_WAL_RETENTION_SIZE 86
+#define TK_WAL_ROLL_PERIOD 87
+#define TK_WAL_SEGMENT_SIZE 88
+#define TK_STT_TRIGGER 89
+#define TK_TABLE_PREFIX 90
+#define TK_TABLE_SUFFIX 91
+#define TK_NK_COLON 92
+#define TK_MAX_SPEED 93
+#define TK_TABLE 94
+#define TK_NK_LP 95
+#define TK_NK_RP 96
+#define TK_STABLE 97
+#define TK_ADD 98
+#define TK_COLUMN 99
+#define TK_MODIFY 100
+#define TK_RENAME 101
+#define TK_TAG 102
+#define TK_SET 103
+#define TK_NK_EQ 104
+#define TK_USING 105
+#define TK_TAGS 106
+#define TK_COMMENT 107
+#define TK_BOOL 108
+#define TK_TINYINT 109
+#define TK_SMALLINT 110
+#define TK_INT 111
+#define TK_INTEGER 112
+#define TK_BIGINT 113
+#define TK_FLOAT 114
+#define TK_DOUBLE 115
+#define TK_BINARY 116
+#define TK_TIMESTAMP 117
+#define TK_NCHAR 118
+#define TK_UNSIGNED 119
+#define TK_JSON 120
+#define TK_VARCHAR 121
+#define TK_MEDIUMBLOB 122
+#define TK_BLOB 123
+#define TK_VARBINARY 124
+#define TK_DECIMAL 125
+#define TK_MAX_DELAY 126
+#define TK_WATERMARK 127
+#define TK_ROLLUP 128
+#define TK_TTL 129
+#define TK_SMA 130
+#define TK_FIRST 131
+#define TK_LAST 132
+#define TK_SHOW 133
+#define TK_DATABASES 134
+#define TK_TABLES 135
+#define TK_STABLES 136
+#define TK_MNODES 137
+#define TK_QNODES 138
+#define TK_FUNCTIONS 139
+#define TK_INDEXES 140
+#define TK_ACCOUNTS 141
+#define TK_APPS 142
+#define TK_CONNECTIONS 143
+#define TK_LICENCES 144
+#define TK_GRANTS 145
+#define TK_QUERIES 146
+#define TK_SCORES 147
+#define TK_TOPICS 148
+#define TK_VARIABLES 149
+#define TK_CLUSTER 150
+#define TK_BNODES 151
+#define TK_SNODES 152
+#define TK_TRANSACTIONS 153
+#define TK_DISTRIBUTED 154
+#define TK_CONSUMERS 155
+#define TK_SUBSCRIPTIONS 156
+#define TK_VNODES 157
+#define TK_LIKE 158
+#define TK_INDEX 159
+#define TK_FUNCTION 160
+#define TK_INTERVAL 161
+#define TK_TOPIC 162
+#define TK_AS 163
+#define TK_WITH 164
+#define TK_META 165
+#define TK_CONSUMER 166
+#define TK_GROUP 167
+#define TK_DESC 168
+#define TK_DESCRIBE 169
+#define TK_RESET 170
+#define TK_QUERY 171
+#define TK_CACHE 172
+#define TK_EXPLAIN 173
+#define TK_ANALYZE 174
+#define TK_VERBOSE 175
+#define TK_NK_BOOL 176
+#define TK_RATIO 177
+#define TK_NK_FLOAT 178
+#define TK_OUTPUTTYPE 179
+#define TK_AGGREGATE 180
+#define TK_BUFSIZE 181
+#define TK_STREAM 182
+#define TK_INTO 183
+#define TK_TRIGGER 184
+#define TK_AT_ONCE 185
+#define TK_WINDOW_CLOSE 186
+#define TK_IGNORE 187
+#define TK_EXPIRED 188
+#define TK_FILL_HISTORY 189
+#define TK_SUBTABLE 190
+#define TK_KILL 191
+#define TK_CONNECTION 192
+#define TK_TRANSACTION 193
+#define TK_BALANCE 194
+#define TK_VGROUP 195
+#define TK_MERGE 196
+#define TK_REDISTRIBUTE 197
+#define TK_SPLIT 198
+#define TK_DELETE 199
+#define TK_INSERT 200
+#define TK_NULL 201
+#define TK_NK_QUESTION 202
+#define TK_NK_ARROW 203
+#define TK_ROWTS 204
+#define TK_TBNAME 205
+#define TK_QSTART 206
+#define TK_QEND 207
+#define TK_QDURATION 208
+#define TK_WSTART 209
+#define TK_WEND 210
+#define TK_WDURATION 211
+#define TK_IROWTS 212
+#define TK_QTAGS 213
+#define TK_CAST 214
+#define TK_NOW 215
+#define TK_TODAY 216
+#define TK_TIMEZONE 217
+#define TK_CLIENT_VERSION 218
+#define TK_SERVER_VERSION 219
+#define TK_SERVER_STATUS 220
+#define TK_CURRENT_USER 221
+#define TK_COUNT 222
+#define TK_LAST_ROW 223
+#define TK_CASE 224
+#define TK_END 225
+#define TK_WHEN 226
+#define TK_THEN 227
+#define TK_ELSE 228
+#define TK_BETWEEN 229
+#define TK_IS 230
+#define TK_NK_LT 231
+#define TK_NK_GT 232
+#define TK_NK_LE 233
+#define TK_NK_GE 234
+#define TK_NK_NE 235
+#define TK_MATCH 236
+#define TK_NMATCH 237
+#define TK_CONTAINS 238
+#define TK_IN 239
+#define TK_JOIN 240
+#define TK_INNER 241
+#define TK_SELECT 242
+#define TK_DISTINCT 243
+#define TK_WHERE 244
+#define TK_PARTITION 245
+#define TK_BY 246
+#define TK_SESSION 247
+#define TK_STATE_WINDOW 248
+#define TK_SLIDING 249
+#define TK_FILL 250
+#define TK_VALUE 251
+#define TK_NONE 252
+#define TK_PREV 253
+#define TK_LINEAR 254
+#define TK_NEXT 255
+#define TK_HAVING 256
+#define TK_RANGE 257
+#define TK_EVERY 258
+#define TK_ORDER 259
+#define TK_SLIMIT 260
+#define TK_SOFFSET 261
+#define TK_LIMIT 262
+#define TK_OFFSET 263
+#define TK_ASC 264
+#define TK_NULLS 265
+#define TK_ABORT 266
+#define TK_AFTER 267
+#define TK_ATTACH 268
+#define TK_BEFORE 269
+#define TK_BEGIN 270
+#define TK_BITAND 271
+#define TK_BITNOT 272
+#define TK_BITOR 273
+#define TK_BLOCKS 274
+#define TK_CHANGE 275
+#define TK_COMMA 276
+#define TK_COMPACT 277
+#define TK_CONCAT 278
+#define TK_CONFLICT 279
+#define TK_COPY 280
+#define TK_DEFERRED 281
+#define TK_DELIMITERS 282
+#define TK_DETACH 283
+#define TK_DIVIDE 284
+#define TK_DOT 285
+#define TK_EACH 286
+#define TK_FAIL 287
+#define TK_FILE 288
+#define TK_FOR 289
+#define TK_GLOB 290
+#define TK_ID 291
+#define TK_IMMEDIATE 292
+#define TK_IMPORT 293
+#define TK_INITIALLY 294
+#define TK_INSTEAD 295
+#define TK_ISNULL 296
+#define TK_KEY 297
+#define TK_MODULES 298
+#define TK_NK_BITNOT 299
+#define TK_NK_SEMI 300
+#define TK_NOTNULL 301
+#define TK_OF 302
+#define TK_PLUS 303
+#define TK_PRIVILEGE 304
+#define TK_RAISE 305
+#define TK_REPLACE 306
+#define TK_RESTRICT 307
+#define TK_ROW 308
+#define TK_SEMI 309
+#define TK_STAR 310
+#define TK_STATEMENT 311
+#define TK_STRING 312
+#define TK_TIMES 313
+#define TK_UPDATE 314
+#define TK_VALUES 315
+#define TK_VARIABLE 316
+#define TK_VIEW 317
+#define TK_WAL 318
-#define TK_NK_SPACE 300
-#define TK_NK_COMMENT 301
-#define TK_NK_ILLEGAL 302
-#define TK_NK_HEX 303 // hex number 0x123
-#define TK_NK_OCT 304 // oct number
-#define TK_NK_BIN 305 // bin format data 0b111
+#define TK_NK_SPACE 600
+#define TK_NK_COMMENT 601
+#define TK_NK_ILLEGAL 602
+#define TK_NK_HEX 603 // hex number 0x123
+#define TK_NK_OCT 604 // oct number
+#define TK_NK_BIN 605 // bin format data 0b111
#define TK_NK_NIL 65535
diff --git a/include/dnode/mnode/mnode.h b/include/dnode/mnode/mnode.h
index c9e47c25b7..cdb1642a5c 100644
--- a/include/dnode/mnode/mnode.h
+++ b/include/dnode/mnode/mnode.h
@@ -99,7 +99,6 @@ int32_t mndGetLoad(SMnode *pMnode, SMnodeLoad *pLoad);
*/
int32_t mndProcessRpcMsg(SRpcMsg *pMsg);
int32_t mndProcessSyncMsg(SRpcMsg *pMsg);
-int32_t mndProcessSyncCtrlMsg(SRpcMsg *pMsg);
int32_t mndPreProcessQueryMsg(SRpcMsg *pMsg);
void mndPostProcessQueryMsg(SRpcMsg *pMsg);
diff --git a/include/libs/catalog/catalog.h b/include/libs/catalog/catalog.h
index dfeb68ce43..b310ec8080 100644
--- a/include/libs/catalog/catalog.h
+++ b/include/libs/catalog/catalog.h
@@ -203,13 +203,11 @@ int32_t catalogUpdateTableMeta(SCatalog* pCatalog, STableMetaRsp* rspMsg);
int32_t catalogUpdateTableMeta(SCatalog* pCatalog, STableMetaRsp* rspMsg);
-int32_t catalogGetCachedTableMeta(SCatalog* pCtg, SRequestConnInfo* pConn, const SName* pTableName, STableMeta** pTableMeta);
+int32_t catalogGetCachedTableMeta(SCatalog* pCtg, const SName* pTableName, STableMeta** pTableMeta);
-int32_t catalogGetCachedSTableMeta(SCatalog* pCtg, SRequestConnInfo* pConn, const SName* pTableName,
- STableMeta** pTableMeta);
+int32_t catalogGetCachedSTableMeta(SCatalog* pCtg, const SName* pTableName, STableMeta** pTableMeta);
-int32_t catalogGetCachedTableHashVgroup(SCatalog* pCtg, SRequestConnInfo* pConn, const SName* pTableName,
- SVgroupInfo* pVgroup, bool* exists);
+int32_t catalogGetCachedTableHashVgroup(SCatalog* pCtg, const SName* pTableName, SVgroupInfo* pVgroup, bool* exists);
/**
* Force refresh DB's local cached vgroup info.
@@ -309,6 +307,9 @@ int32_t catalogGetUdfInfo(SCatalog* pCtg, SRequestConnInfo* pConn, const char* f
int32_t catalogChkAuth(SCatalog* pCtg, SRequestConnInfo* pConn, const char* user, const char* dbFName, AUTH_TYPE type,
bool* pass);
+int32_t catalogChkAuthFromCache(SCatalog* pCtg, const char* user, const char* dbFName, AUTH_TYPE type,
+ bool* pass, bool* exists);
+
int32_t catalogUpdateUserAuthInfo(SCatalog* pCtg, SGetUserAuthRsp* pAuth);
int32_t catalogUpdateVgEpSet(SCatalog* pCtg, const char* dbFName, int32_t vgId, SEpSet* epSet);
@@ -323,6 +324,10 @@ SMetaData* catalogCloneMetaData(SMetaData* pData);
void catalogFreeMetaData(SMetaData* pData);
+int32_t ctgdEnableDebug(char *option, bool enable);
+
+int32_t ctgdHandleDbgCommand(char *command);
+
/**
* Destroy catalog and relase all resources
*/
diff --git a/include/libs/executor/executor.h b/include/libs/executor/executor.h
index 3b1b63496f..1fe30a2d66 100644
--- a/include/libs/executor/executor.h
+++ b/include/libs/executor/executor.h
@@ -79,6 +79,7 @@ qTaskInfo_t qCreateStreamExecTaskInfo(void* msg, SReadHandle* readers);
*/
qTaskInfo_t qCreateQueueExecTaskInfo(void* msg, SReadHandle* readers, int32_t* numOfCols, SSchemaWrapper** pSchema);
+int32_t qSetStreamOpOpen(qTaskInfo_t tinfo);
/**
* Set multiple input data blocks for the stream scan.
* @param tinfo
diff --git a/include/libs/function/functionMgt.h b/include/libs/function/functionMgt.h
index 6968f1712c..a50af18b44 100644
--- a/include/libs/function/functionMgt.h
+++ b/include/libs/function/functionMgt.h
@@ -216,6 +216,7 @@ bool fmIsMultiRowsFunc(int32_t funcId);
bool fmIsKeepOrderFunc(int32_t funcId);
bool fmIsCumulativeFunc(int32_t funcId);
bool fmIsInterpPseudoColumnFunc(int32_t funcId);
+bool fmIsGroupKeyFunc(int32_t funcId);
void getLastCacheDataType(SDataType* pType);
diff --git a/include/libs/nodes/cmdnodes.h b/include/libs/nodes/cmdnodes.h
index 43746630f9..59f64f1863 100644
--- a/include/libs/nodes/cmdnodes.h
+++ b/include/libs/nodes/cmdnodes.h
@@ -235,6 +235,7 @@ typedef struct SDropDnodeStmt {
int32_t dnodeId;
char fqdn[TSDB_FQDN_LEN];
int32_t port;
+ bool force;
} SDropDnodeStmt;
typedef struct SAlterDnodeStmt {
diff --git a/include/libs/qcom/query.h b/include/libs/qcom/query.h
index 7d95e840e9..651b379851 100644
--- a/include/libs/qcom/query.h
+++ b/include/libs/qcom/query.h
@@ -242,13 +242,13 @@ extern int32_t (*queryProcessMsgRsp[TDMT_MAX])(void* output, char* msg, int32_t
#define SET_META_TYPE_BOTH_TABLE(t) (t) = META_TYPE_BOTH_TABLE
#define NEED_CLIENT_RM_TBLMETA_ERROR(_code) \
- ((_code) == TSDB_CODE_PAR_TABLE_NOT_EXIST || (_code) == TSDB_CODE_VND_TB_NOT_EXIST || \
+ ((_code) == TSDB_CODE_PAR_TABLE_NOT_EXIST || (_code) == TSDB_CODE_TDB_TABLE_NOT_EXIST || \
(_code) == TSDB_CODE_PAR_INVALID_COLUMNS_NUM || (_code) == TSDB_CODE_PAR_INVALID_COLUMN || \
(_code) == TSDB_CODE_PAR_TAGS_NOT_MATCHED || (_code) == TSDB_CODE_PAR_VALUE_TOO_LONG || \
(_code) == TSDB_CODE_PAR_INVALID_DROP_COL || ((_code) == TSDB_CODE_TDB_INVALID_TABLE_ID))
#define NEED_CLIENT_REFRESH_VG_ERROR(_code) \
((_code) == TSDB_CODE_VND_HASH_MISMATCH || (_code) == TSDB_CODE_VND_INVALID_VGROUP_ID)
-#define NEED_CLIENT_REFRESH_TBLMETA_ERROR(_code) ((_code) == TSDB_CODE_TDB_TABLE_RECREATED)
+#define NEED_CLIENT_REFRESH_TBLMETA_ERROR(_code) ((_code) == TSDB_CODE_TDB_INVALID_TABLE_SCHEMA_VER)
#define NEED_CLIENT_HANDLE_ERROR(_code) \
(NEED_CLIENT_RM_TBLMETA_ERROR(_code) || NEED_CLIENT_REFRESH_VG_ERROR(_code) || \
NEED_CLIENT_REFRESH_TBLMETA_ERROR(_code))
diff --git a/include/libs/stream/tstream.h b/include/libs/stream/tstream.h
index 534d86b1f1..1c3f905e23 100644
--- a/include/libs/stream/tstream.h
+++ b/include/libs/stream/tstream.h
@@ -46,7 +46,7 @@ enum {
TASK_STATUS__DROPPING,
TASK_STATUS__FAIL,
TASK_STATUS__STOP,
- TASK_STATUS__RECOVER_DOWNSTREAM,
+ TASK_STATUS__WAIT_DOWNSTREAM,
TASK_STATUS__RECOVER_PREPARE,
TASK_STATUS__RECOVER1,
TASK_STATUS__RECOVER2,
@@ -332,7 +332,10 @@ typedef struct SStreamTask {
SStreamState* pState;
// do not serialize
- int32_t recoverWaitingChild;
+ int32_t recoverTryingDownstream;
+ int32_t recoverWaitingUpstream;
+ int64_t checkReqId;
+ SArray* checkReqIds; // shuffle
} SStreamTask;
@@ -418,7 +421,10 @@ typedef struct {
typedef struct {
int64_t streamId;
- int32_t taskId;
+ int32_t upstreamNodeId;
+ int32_t upstreamTaskId;
+ int32_t downstreamNodeId;
+ int32_t downstreamTaskId;
int8_t inputStatus;
} SStreamDispatchRsp;
@@ -441,8 +447,30 @@ typedef struct {
} SStreamRetrieveRsp;
typedef struct {
+ int64_t reqId;
int64_t streamId;
- int32_t taskId;
+ int32_t upstreamNodeId;
+ int32_t upstreamTaskId;
+ int32_t downstreamNodeId;
+ int32_t downstreamTaskId;
+ int32_t childId;
+} SStreamTaskCheckReq;
+
+typedef struct {
+ int64_t reqId;
+ int64_t streamId;
+ int32_t upstreamNodeId;
+ int32_t upstreamTaskId;
+ int32_t downstreamNodeId;
+ int32_t downstreamTaskId;
+ int32_t childId;
+ int8_t status;
+} SStreamTaskCheckRsp;
+
+typedef struct {
+ SMsgHead msgHead;
+ int64_t streamId;
+ int32_t taskId;
} SStreamRecoverStep1Req, SStreamRecoverStep2Req;
typedef struct {
@@ -454,47 +482,6 @@ typedef struct {
int32_t tEncodeSStreamRecoverFinishReq(SEncoder* pEncoder, const SStreamRecoverFinishReq* pReq);
int32_t tDecodeSStreamRecoverFinishReq(SDecoder* pDecoder, SStreamRecoverFinishReq* pReq);
-#if 0
-typedef struct {
- int64_t streamId;
- int32_t taskId;
- int32_t upstreamTaskId;
- int32_t upstreamNodeId;
-} SStreamTaskRecoverReq;
-
-typedef struct {
- int64_t streamId;
- int32_t rspTaskId;
- int32_t reqTaskId;
- int8_t inputStatus;
-} SStreamTaskRecoverRsp;
-
-int32_t tEncodeStreamTaskRecoverReq(SEncoder* pEncoder, const SStreamTaskRecoverReq* pReq);
-int32_t tDecodeStreamTaskRecoverReq(SDecoder* pDecoder, SStreamTaskRecoverReq* pReq);
-
-int32_t tEncodeStreamTaskRecoverRsp(SEncoder* pEncoder, const SStreamTaskRecoverRsp* pRsp);
-int32_t tDecodeStreamTaskRecoverRsp(SDecoder* pDecoder, SStreamTaskRecoverRsp* pRsp);
-
-typedef struct {
- int64_t streamId;
- int32_t taskId;
-} SMStreamTaskRecoverReq;
-
-typedef struct {
- int64_t streamId;
- int32_t taskId;
-} SMStreamTaskRecoverRsp;
-
-int32_t tEncodeSMStreamTaskRecoverReq(SEncoder* pEncoder, const SMStreamTaskRecoverReq* pReq);
-int32_t tDecodeSMStreamTaskRecoverReq(SDecoder* pDecoder, SMStreamTaskRecoverReq* pReq);
-
-int32_t tEncodeSMStreamTaskRecoverRsp(SEncoder* pEncoder, const SMStreamTaskRecoverRsp* pRsp);
-int32_t tDecodeSMStreamTaskRecoverRsp(SDecoder* pDecoder, SMStreamTaskRecoverRsp* pRsp);
-
-int32_t streamProcessRecoverReq(SStreamTask* pTask, SStreamTaskRecoverReq* pReq, SRpcMsg* pMsg);
-int32_t streamProcessRecoverRsp(SStreamTask* pTask, SStreamTaskRecoverRsp* pRsp);
-#endif
-
typedef struct {
int64_t streamId;
int32_t downstreamTaskId;
@@ -508,20 +495,18 @@ typedef struct {
SArray* checkpointVer; // SArray
} SStreamRecoverDownstreamRsp;
+int32_t tEncodeSStreamTaskCheckReq(SEncoder* pEncoder, const SStreamTaskCheckReq* pReq);
+int32_t tDecodeSStreamTaskCheckReq(SDecoder* pDecoder, SStreamTaskCheckReq* pReq);
+
+int32_t tEncodeSStreamTaskCheckRsp(SEncoder* pEncoder, const SStreamTaskCheckRsp* pRsp);
+int32_t tDecodeSStreamTaskCheckRsp(SDecoder* pDecoder, SStreamTaskCheckRsp* pRsp);
+
int32_t tEncodeSStreamTaskRecoverReq(SEncoder* pEncoder, const SStreamRecoverDownstreamReq* pReq);
int32_t tDecodeSStreamTaskRecoverReq(SDecoder* pDecoder, SStreamRecoverDownstreamReq* pReq);
int32_t tEncodeSStreamTaskRecoverRsp(SEncoder* pEncoder, const SStreamRecoverDownstreamRsp* pRsp);
int32_t tDecodeSStreamTaskRecoverRsp(SDecoder* pDecoder, SStreamRecoverDownstreamRsp* pRsp);
-typedef struct {
- int64_t streamId;
- int32_t taskId;
- int32_t waitingRspCnt;
- int32_t totReq;
- SArray* info; // SArray*>
-} SStreamRecoverStatus;
-
int32_t tDecodeStreamDispatchReq(SDecoder* pDecoder, SStreamDispatchReq* pReq);
int32_t tDecodeStreamRetrieveReq(SDecoder* pDecoder, SStreamRetrieveReq* pReq);
void tDeleteStreamRetrieveReq(SStreamRetrieveReq* pReq);
@@ -532,7 +517,7 @@ int32_t streamSetupTrigger(SStreamTask* pTask);
int32_t streamProcessRunReq(SStreamTask* pTask);
int32_t streamProcessDispatchReq(SStreamTask* pTask, SStreamDispatchReq* pReq, SRpcMsg* pMsg, bool exec);
-int32_t streamProcessDispatchRsp(SStreamTask* pTask, SStreamDispatchRsp* pRsp);
+int32_t streamProcessDispatchRsp(SStreamTask* pTask, SStreamDispatchRsp* pRsp, int32_t code);
int32_t streamProcessRetrieveReq(SStreamTask* pTask, SStreamRetrieveReq* pReq, SRpcMsg* pMsg);
int32_t streamProcessRetrieveRsp(SStreamTask* pTask, SStreamRetrieveRsp* pRsp);
@@ -543,6 +528,10 @@ int32_t streamSchedExec(SStreamTask* pTask);
int32_t streamScanExec(SStreamTask* pTask, int32_t batchSz);
// recover and fill history
+int32_t streamTaskCheckDownstream(SStreamTask* pTask, int64_t version);
+int32_t streamTaskLaunchRecover(SStreamTask* pTask, int64_t version);
+int32_t streamProcessTaskCheckReq(SStreamTask* pTask, const SStreamTaskCheckReq* pReq);
+int32_t streamProcessTaskCheckRsp(SStreamTask* pTask, const SStreamTaskCheckRsp* pRsp, int64_t version);
// common
int32_t streamSetParamForRecover(SStreamTask* pTask);
int32_t streamRestoreParam(SStreamTask* pTask);
diff --git a/include/libs/sync/sync.h b/include/libs/sync/sync.h
index b6c4a58150..8db3d89e39 100644
--- a/include/libs/sync/sync.h
+++ b/include/libs/sync/sync.h
@@ -25,8 +25,6 @@ extern "C" {
#include "tlrucache.h"
#include "tmsgcb.h"
-extern bool gRaftDetailLog;
-
#define SYNC_RESP_TTL_MS 10000000
#define SYNC_SPEED_UP_HB_TIMER 400
#define SYNC_SPEED_UP_AFTER_MS (1000 * 20)
@@ -39,6 +37,7 @@ extern bool gRaftDetailLog;
#define SYNC_ADD_QUORUM_COUNT 3
#define SYNC_MNODE_LOG_RETENTION 10000
#define SYNC_VNODE_LOG_RETENTION 100
+#define SNAPSHOT_MAX_CLOCK_SKEW_MS 1000 * 10
#define SYNC_APPEND_ENTRIES_TIMEOUT_MS 10000
@@ -132,27 +131,27 @@ typedef struct SSnapshotMeta {
typedef struct SSyncFSM {
void* data;
- void (*FpCommitCb)(struct SSyncFSM* pFsm, const SRpcMsg* pMsg, SFsmCbMeta cbMeta);
- void (*FpPreCommitCb)(struct SSyncFSM* pFsm, const SRpcMsg* pMsg, SFsmCbMeta cbMeta);
- void (*FpRollBackCb)(struct SSyncFSM* pFsm, const SRpcMsg* pMsg, SFsmCbMeta cbMeta);
+ void (*FpCommitCb)(const struct SSyncFSM* pFsm, const SRpcMsg* pMsg, const SFsmCbMeta* pMeta);
+ void (*FpPreCommitCb)(const struct SSyncFSM* pFsm, const SRpcMsg* pMsg, const SFsmCbMeta* pMeta);
+ void (*FpRollBackCb)(const struct SSyncFSM* pFsm, const SRpcMsg* pMsg, const SFsmCbMeta* pMeta);
- void (*FpRestoreFinishCb)(struct SSyncFSM* pFsm);
- void (*FpReConfigCb)(struct SSyncFSM* pFsm, const SRpcMsg* pMsg, SReConfigCbMeta* cbMeta);
- void (*FpLeaderTransferCb)(struct SSyncFSM* pFsm, const SRpcMsg* pMsg, SFsmCbMeta cbMeta);
+ void (*FpRestoreFinishCb)(const struct SSyncFSM* pFsm);
+ void (*FpReConfigCb)(const struct SSyncFSM* pFsm, const SRpcMsg* pMsg, const SReConfigCbMeta* pMeta);
+ void (*FpLeaderTransferCb)(const struct SSyncFSM* pFsm, const SRpcMsg* pMsg, const SFsmCbMeta* pMeta);
- void (*FpBecomeLeaderCb)(struct SSyncFSM* pFsm);
- void (*FpBecomeFollowerCb)(struct SSyncFSM* pFsm);
+ void (*FpBecomeLeaderCb)(const struct SSyncFSM* pFsm);
+ void (*FpBecomeFollowerCb)(const struct SSyncFSM* pFsm);
- int32_t (*FpGetSnapshot)(struct SSyncFSM* pFsm, SSnapshot* pSnapshot, void* pReaderParam, void** ppReader);
- int32_t (*FpGetSnapshotInfo)(struct SSyncFSM* pFsm, SSnapshot* pSnapshot);
+ int32_t (*FpGetSnapshot)(const struct SSyncFSM* pFsm, SSnapshot* pSnapshot, void* pReaderParam, void** ppReader);
+ int32_t (*FpGetSnapshotInfo)(const struct SSyncFSM* pFsm, SSnapshot* pSnapshot);
- int32_t (*FpSnapshotStartRead)(struct SSyncFSM* pFsm, void* pReaderParam, void** ppReader);
- int32_t (*FpSnapshotStopRead)(struct SSyncFSM* pFsm, void* pReader);
- int32_t (*FpSnapshotDoRead)(struct SSyncFSM* pFsm, void* pReader, void** ppBuf, int32_t* len);
+ int32_t (*FpSnapshotStartRead)(const struct SSyncFSM* pFsm, void* pReaderParam, void** ppReader);
+ int32_t (*FpSnapshotStopRead)(const struct SSyncFSM* pFsm, void* pReader);
+ int32_t (*FpSnapshotDoRead)(const struct SSyncFSM* pFsm, void* pReader, void** ppBuf, int32_t* len);
- int32_t (*FpSnapshotStartWrite)(struct SSyncFSM* pFsm, void* pWriterParam, void** ppWriter);
- int32_t (*FpSnapshotStopWrite)(struct SSyncFSM* pFsm, void* pWriter, bool isApply, SSnapshot* pSnapshot);
- int32_t (*FpSnapshotDoWrite)(struct SSyncFSM* pFsm, void* pWriter, void* pBuf, int32_t len);
+ int32_t (*FpSnapshotStartWrite)(const struct SSyncFSM* pFsm, void* pWriterParam, void** ppWriter);
+ int32_t (*FpSnapshotStopWrite)(const struct SSyncFSM* pFsm, void* pWriter, bool isApply, SSnapshot* pSnapshot);
+ int32_t (*FpSnapshotDoWrite)(const struct SSyncFSM* pFsm, void* pWriter, void* pBuf, int32_t len);
} SSyncFSM;
@@ -193,44 +192,38 @@ typedef struct SSyncInfo {
SWal* pWal;
SSyncFSM* pFsm;
SMsgCb* msgcb;
- int32_t (*FpSendMsg)(const SEpSet* pEpSet, SRpcMsg* pMsg);
- int32_t (*FpEqMsg)(const SMsgCb* msgcb, SRpcMsg* pMsg);
- int32_t (*FpEqCtrlMsg)(const SMsgCb* msgcb, SRpcMsg* pMsg);
+ int32_t pingMs;
+ int32_t electMs;
+ int32_t heartbeatMs;
+
+ int32_t (*syncSendMSg)(const SEpSet* pEpSet, SRpcMsg* pMsg);
+ int32_t (*syncEqMsg)(const SMsgCb* msgcb, SRpcMsg* pMsg);
+ int32_t (*syncEqCtrlMsg)(const SMsgCb* msgcb, SRpcMsg* pMsg);
} SSyncInfo;
-int32_t syncInit();
-void syncCleanUp();
-int64_t syncOpen(SSyncInfo* pSyncInfo);
-void syncStart(int64_t rid);
-void syncStop(int64_t rid);
-int32_t syncSetStandby(int64_t rid);
-ESyncState syncGetMyRole(int64_t rid);
-bool syncIsReady(int64_t rid);
-const char* syncGetMyRoleStr(int64_t rid);
-bool syncRestoreFinish(int64_t rid);
-SyncTerm syncGetMyTerm(int64_t rid);
-SyncIndex syncGetLastIndex(int64_t rid);
-SyncIndex syncGetCommitIndex(int64_t rid);
-SyncGroupId syncGetVgId(int64_t rid);
-void syncGetEpSet(int64_t rid, SEpSet* pEpSet);
-void syncGetRetryEpSet(int64_t rid, SEpSet* pEpSet);
-int32_t syncPropose(int64_t rid, SRpcMsg* pMsg, bool isWeak);
-// int32_t syncProposeBatch(int64_t rid, SRpcMsg** pMsgPArr, bool* pIsWeakArr, int32_t arrSize);
-bool syncEnvIsStart();
-const char* syncStr(ESyncState state);
-bool syncIsRestoreFinish(int64_t rid);
-int32_t syncGetSnapshotByIndex(int64_t rid, SyncIndex index, SSnapshot* pSnapshot);
-
-int32_t syncReconfig(int64_t rid, SSyncCfg* pNewCfg);
-
-// build SRpcMsg, need to call syncPropose with SRpcMsg
-int32_t syncReconfigBuild(int64_t rid, const SSyncCfg* pNewCfg, SRpcMsg* pRpcMsg);
-
-int32_t syncLeaderTransfer(int64_t rid);
-int32_t syncLeaderTransferTo(int64_t rid, SNodeInfo newLeader);
+typedef struct SSyncState {
+ ESyncState state;
+ bool restored;
+} SSyncState;
+int32_t syncInit();
+void syncCleanUp();
+int64_t syncOpen(SSyncInfo* pSyncInfo);
+void syncStart(int64_t rid);
+void syncStop(int64_t rid);
+void syncPreStop(int64_t rid);
+int32_t syncPropose(int64_t rid, SRpcMsg* pMsg, bool isWeak);
+int32_t syncProcessMsg(int64_t rid, SRpcMsg* pMsg);
+int32_t syncReconfig(int64_t rid, SSyncCfg* pCfg);
int32_t syncBeginSnapshot(int64_t rid, int64_t lastApplyIndex);
int32_t syncEndSnapshot(int64_t rid);
+int32_t syncLeaderTransfer(int64_t rid);
+int32_t syncStepDown(int64_t rid, SyncTerm newTerm);
+bool syncIsReadyForRead(int64_t rid);
+
+SSyncState syncGetState(int64_t rid);
+void syncGetRetryEpSet(int64_t rid, SEpSet* pEpSet);
+const char* syncStr(ESyncState state);
#ifdef __cplusplus
}
diff --git a/include/libs/wal/wal.h b/include/libs/wal/wal.h
index 08dba5d50d..ed85fd3517 100644
--- a/include/libs/wal/wal.h
+++ b/include/libs/wal/wal.h
@@ -43,7 +43,6 @@ extern "C" {
#define WAL_FILE_LEN (WAL_PATH_LEN + 32)
#define WAL_MAGIC 0xFAFBFCFDF4F3F2F1ULL
#define WAL_SCAN_BUF_SIZE (1024 * 1024 * 3)
-#define WAL_RECOV_SIZE_LIMIT (100 * WAL_SCAN_BUF_SIZE)
typedef enum {
TAOS_WAL_WRITE = 1,
@@ -159,6 +158,7 @@ void walCleanUp();
// handle open and ctl
SWal *walOpen(const char *path, SWalCfg *pCfg);
int32_t walAlter(SWal *, SWalCfg *pCfg);
+int32_t walPersist(SWal *);
void walClose(SWal *);
// write interfaces
diff --git a/include/os/osDef.h b/include/os/osDef.h
index 297d19e21a..07cd197ad7 100644
--- a/include/os/osDef.h
+++ b/include/os/osDef.h
@@ -244,6 +244,16 @@ void syslog(int unused, const char *format, ...);
#define TD_CHARSET_LEN 64
#define TD_TIMEZONE_LEN 96
+#ifdef WINDOWS
+#define TD_PATH_MAX 260
+#elif defined(PATH_MAX)
+#define TD_PATH_MAX PATH_MAX
+#elif defined(_XOPEN_PATH_MAX)
+#define TD_PATH_MAX _XOPEN_PATH_MAX
+#else
+#define TD_PATH_MAX _POSIX_PATH_MAX
+#endif
+
#ifdef __cplusplus
}
#endif
diff --git a/include/os/osMemory.h b/include/os/osMemory.h
index 7ec8366ee4..14d53a7a06 100644
--- a/include/os/osMemory.h
+++ b/include/os/osMemory.h
@@ -36,6 +36,7 @@ void *taosMemoryStrDup(const char *ptr);
void taosMemoryFree(void *ptr);
int64_t taosMemorySize(void *ptr);
void taosPrintBackTrace();
+void taosMemoryTrim(int32_t size);
#define taosMemoryFreeClear(ptr) \
do { \
diff --git a/include/util/taoserror.h b/include/util/taoserror.h
index bbddb539c6..092ede2281 100644
--- a/include/util/taoserror.h
+++ b/include/util/taoserror.h
@@ -91,6 +91,7 @@ int32_t* taosGetErrno();
#define TSDB_CODE_MSG_DECODE_ERROR TAOS_DEF_ERROR_CODE(0, 0x0128)
#define TSDB_CODE_NO_AVAIL_DISK TAOS_DEF_ERROR_CODE(0, 0x0129)
#define TSDB_CODE_NOT_FOUND TAOS_DEF_ERROR_CODE(0, 0x012A)
+#define TSDB_CODE_NO_DISKSPACE TAOS_DEF_ERROR_CODE(0, 0x012B)
//client
#define TSDB_CODE_TSC_INVALID_OPERATION TAOS_DEF_ERROR_CODE(0, 0x0200)
@@ -106,7 +107,6 @@ int32_t* taosGetErrno();
#define TSDB_CODE_TSC_INVALID_TABLE_ID_LENGTH TAOS_DEF_ERROR_CODE(0, 0x020A)
#define TSDB_CODE_TSC_INVALID_CONNECTION TAOS_DEF_ERROR_CODE(0, 0x020B)
#define TSDB_CODE_TSC_OUT_OF_MEMORY TAOS_DEF_ERROR_CODE(0, 0x020C)
-#define TSDB_CODE_TSC_NO_DISKSPACE TAOS_DEF_ERROR_CODE(0, 0x020D)
#define TSDB_CODE_TSC_QUERY_CACHE_ERASED TAOS_DEF_ERROR_CODE(0, 0x020E)
#define TSDB_CODE_TSC_QUERY_CANCELLED TAOS_DEF_ERROR_CODE(0, 0x020F)
#define TSDB_CODE_TSC_SORTED_RES_TOO_MANY TAOS_DEF_ERROR_CODE(0, 0x0210)
@@ -305,34 +305,14 @@ int32_t* taosGetErrno();
#define TSDB_CODE_NODE_NOT_DEPLOYED TAOS_DEF_ERROR_CODE(0, 0x040A)
// vnode
-#define TSDB_CODE_VND_ACTION_IN_PROGRESS TAOS_DEF_ERROR_CODE(0, 0x0500)
-#define TSDB_CODE_VND_MSG_NOT_PROCESSED TAOS_DEF_ERROR_CODE(0, 0x0501)
-#define TSDB_CODE_VND_ACTION_NEED_REPROCESSED TAOS_DEF_ERROR_CODE(0, 0x0502)
#define TSDB_CODE_VND_INVALID_VGROUP_ID TAOS_DEF_ERROR_CODE(0, 0x0503)
-#define TSDB_CODE_VND_INIT_FAILED TAOS_DEF_ERROR_CODE(0, 0x0504)
-#define TSDB_CODE_VND_NO_DISKSPACE TAOS_DEF_ERROR_CODE(0, 0x0505)
-#define TSDB_CODE_VND_NO_DISK_PERMISSIONS TAOS_DEF_ERROR_CODE(0, 0x0506)
-#define TSDB_CODE_VND_NO_SUCH_FILE_OR_DIR TAOS_DEF_ERROR_CODE(0, 0x0507)
-#define TSDB_CODE_VND_OUT_OF_MEMORY TAOS_DEF_ERROR_CODE(0, 0x0508)
-#define TSDB_CODE_VND_APP_ERROR TAOS_DEF_ERROR_CODE(0, 0x0509)
-#define TSDB_CODE_VND_IS_FLOWCTRL TAOS_DEF_ERROR_CODE(0, 0x050C)
-#define TSDB_CODE_VND_IS_DROPPING TAOS_DEF_ERROR_CODE(0, 0x050D)
-#define TSDB_CODE_VND_IS_UPDATING TAOS_DEF_ERROR_CODE(0, 0x050E)
-#define TSDB_CODE_VND_IS_CLOSING TAOS_DEF_ERROR_CODE(0, 0x0510)
-#define TSDB_CODE_VND_NOT_SYNCED TAOS_DEF_ERROR_CODE(0, 0x0511)
#define TSDB_CODE_VND_NO_WRITE_AUTH TAOS_DEF_ERROR_CODE(0, 0x0512)
-#define TSDB_CODE_VND_IS_SYNCING TAOS_DEF_ERROR_CODE(0, 0x0513)
-#define TSDB_CODE_VND_INVALID_TSDB_STATE TAOS_DEF_ERROR_CODE(0, 0x0514)
-#define TSDB_CODE_VND_TB_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x0520)
-#define TSDB_CODE_VND_SMA_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x0521)
#define TSDB_CODE_VND_HASH_MISMATCH TAOS_DEF_ERROR_CODE(0, 0x0522)
-#define TSDB_CODE_VND_TABLE_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x0523)
#define TSDB_CODE_VND_INVALID_TABLE_ACTION TAOS_DEF_ERROR_CODE(0, 0x0524)
#define TSDB_CODE_VND_COL_ALREADY_EXISTS TAOS_DEF_ERROR_CODE(0, 0x0525)
-#define TSDB_CODE_VND_TABLE_COL_NOT_EXISTS TAOS_DEF_ERROR_CODE(0, 0x0526)
+#define TSDB_CODE_VND_COL_NOT_EXISTS TAOS_DEF_ERROR_CODE(0, 0x0526)
#define TSDB_CODE_VND_COL_SUBSCRIBED TAOS_DEF_ERROR_CODE(0, 0x0527)
-#define TSDB_CODE_VND_INVALID_CFG_FILE TAOS_DEF_ERROR_CODE(0, 0x0528)
-#define TSDB_CODE_VND_INVALID_TERM_FILE TAOS_DEF_ERROR_CODE(0, 0x0529)
+#define TSDB_CODE_VND_NO_AVAIL_BUFPOOL TAOS_DEF_ERROR_CODE(0, 0x0528)
// tsdb
#define TSDB_CODE_TDB_INVALID_TABLE_ID TAOS_DEF_ERROR_CODE(0, 0x0600)
@@ -341,7 +321,6 @@ int32_t* taosGetErrno();
#define TSDB_CODE_TDB_TABLE_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x0603)
#define TSDB_CODE_TDB_INVALID_CONFIG TAOS_DEF_ERROR_CODE(0, 0x0604)
#define TSDB_CODE_TDB_INIT_FAILED TAOS_DEF_ERROR_CODE(0, 0x0605)
-#define TSDB_CODE_TDB_NO_DISKSPACE TAOS_DEF_ERROR_CODE(0, 0x0606)
#define TSDB_CODE_TDB_NO_DISK_PERMISSIONS TAOS_DEF_ERROR_CODE(0, 0x0607)
#define TSDB_CODE_TDB_FILE_CORRUPTED TAOS_DEF_ERROR_CODE(0, 0x0608)
#define TSDB_CODE_TDB_OUT_OF_MEMORY TAOS_DEF_ERROR_CODE(0, 0x0609)
@@ -361,13 +340,12 @@ int32_t* taosGetErrno();
#define TSDB_CODE_TDB_TABLE_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x0618)
#define TSDB_CODE_TDB_STB_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x0619)
#define TSDB_CODE_TDB_STB_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x061A)
-#define TSDB_CODE_TDB_TABLE_RECREATED TAOS_DEF_ERROR_CODE(0, 0x061B)
+#define TSDB_CODE_TDB_INVALID_TABLE_SCHEMA_VER TAOS_DEF_ERROR_CODE(0, 0x061B)
#define TSDB_CODE_TDB_TDB_ENV_OPEN_ERROR TAOS_DEF_ERROR_CODE(0, 0x061C)
// query
#define TSDB_CODE_QRY_INVALID_QHANDLE TAOS_DEF_ERROR_CODE(0, 0x0700)
#define TSDB_CODE_QRY_INVALID_MSG TAOS_DEF_ERROR_CODE(0, 0x0701)
-#define TSDB_CODE_QRY_NO_DISKSPACE TAOS_DEF_ERROR_CODE(0, 0x0702)
#define TSDB_CODE_QRY_OUT_OF_MEMORY TAOS_DEF_ERROR_CODE(0, 0x0703)
#define TSDB_CODE_QRY_APP_ERROR TAOS_DEF_ERROR_CODE(0, 0x0704)
#define TSDB_CODE_QRY_DUP_JOIN_KEY TAOS_DEF_ERROR_CODE(0, 0x0705)
@@ -430,7 +408,6 @@ int32_t* taosGetErrno();
// tq
#define TSDB_CODE_TQ_INVALID_CONFIG TAOS_DEF_ERROR_CODE(0, 0x0A00)
#define TSDB_CODE_TQ_INIT_FAILED TAOS_DEF_ERROR_CODE(0, 0x0A01)
-#define TSDB_CODE_TQ_NO_DISKSPACE TAOS_DEF_ERROR_CODE(0, 0x0A02)
#define TSDB_CODE_TQ_NO_DISK_PERMISSIONS TAOS_DEF_ERROR_CODE(0, 0x0A03)
#define TSDB_CODE_TQ_FILE_CORRUPTED TAOS_DEF_ERROR_CODE(0, 0x0A04)
#define TSDB_CODE_TQ_OUT_OF_MEMORY TAOS_DEF_ERROR_CODE(0, 0x0A05)
@@ -451,6 +428,7 @@ int32_t* taosGetErrno();
#define TSDB_CODE_WAL_OUT_OF_MEMORY TAOS_DEF_ERROR_CODE(0, 0x1004)
#define TSDB_CODE_WAL_LOG_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x1005)
#define TSDB_CODE_WAL_CHKSUM_MISMATCH TAOS_DEF_ERROR_CODE(0, 0x1006)
+#define TSDB_CODE_WAL_LOG_INCOMPLETE TAOS_DEF_ERROR_CODE(0, 0x1007)
// tfs
#define TSDB_CODE_FS_INVLD_CFG TAOS_DEF_ERROR_CODE(0, 0x2201)
@@ -634,9 +612,12 @@ int32_t* taosGetErrno();
#define TSDB_CODE_TMQ_CONSUMER_MISMATCH TAOS_DEF_ERROR_CODE(0, 0x4001)
#define TSDB_CODE_TMQ_CONSUMER_CLOSED TAOS_DEF_ERROR_CODE(0, 0x4002)
+// stream
+#define TSDB_CODE_STREAM_TASK_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x4100)
+
// TDLite
-#define TSDB_CODE_TDLITE_IVLD_OPEN_FLAGS TAOS_DEF_ERROR_CODE(0, 0x4100)
-#define TSDB_CODE_TDLITE_IVLD_OPEN_DIR TAOS_DEF_ERROR_CODE(0, 0x4101)
+#define TSDB_CODE_TDLITE_IVLD_OPEN_FLAGS TAOS_DEF_ERROR_CODE(0, 0x5100)
+#define TSDB_CODE_TDLITE_IVLD_OPEN_DIR TAOS_DEF_ERROR_CODE(0, 0x5101)
#ifdef __cplusplus
}
diff --git a/include/util/tref.h b/include/util/tref.h
index c2cc54cb07..c4b2ec8fa7 100644
--- a/include/util/tref.h
+++ b/include/util/tref.h
@@ -25,7 +25,8 @@ extern "C" {
// open a reference set, max is the mod used by hash, fp is the pointer to free resource function
// return rsetId which will be used by other APIs. On error, -1 is returned, and terrno is set appropriately
-int32_t taosOpenRef(int32_t max, void (*fp)(void *));
+typedef void (*RefFp)(void *);
+int32_t taosOpenRef(int32_t max, RefFp fp);
// close the reference set, refId is the return value by taosOpenRef
// return 0 if success. On error, -1 is returned, and terrno is set appropriately
diff --git a/packaging/release.bat b/packaging/release.bat
index b87ae68e2b..4c82c5ead5 100644
--- a/packaging/release.bat
+++ b/packaging/release.bat
@@ -40,7 +40,7 @@ if not exist %work_dir%\debug\ver-%2-x86 (
)
cd %work_dir%\debug\ver-%2-x64
call vcvarsall.bat x64
-cmake ../../ -G "NMake Makefiles JOM" -DCMAKE_MAKE_PROGRAM=jom -DBUILD_TOOLS=true -DBUILD_HTTP=false -DBUILD_TEST=false -DVERNUMBER=%2 -DCPUTYPE=x64
+cmake ../../ -G "NMake Makefiles JOM" -DCMAKE_MAKE_PROGRAM=jom -DBUILD_TOOLS=true -DWEBSOCKET=true -DBUILD_HTTP=false -DBUILD_TEST=false -DVERNUMBER=%2 -DCPUTYPE=x64
cmake --build .
rd /s /Q C:\TDengine
cmake --install .
@@ -63,4 +63,4 @@ exit /b
:RUNFAILED
echo %*
cd %package_dir%
-goto :eof
\ No newline at end of file
+goto :eof
diff --git a/packaging/tools/makepkg.sh b/packaging/tools/makepkg.sh
index e9546ba103..2776683a24 100755
--- a/packaging/tools/makepkg.sh
+++ b/packaging/tools/makepkg.sh
@@ -285,10 +285,14 @@ if [[ $dbName == "taos" ]]; then
fi
# Add web files
- if [ -d "${web_dir}/admin" ]; then
- mkdir -p ${install_dir}/share/
- cp ${web_dir}/admin ${install_dir}/share/ -r
- cp ${web_dir}/png/taos.png ${install_dir}/share/admin/images/taos.png
+ if [ "$verMode" == "cluster" ] || [ "$verMode" == "cloud" ]; then
+ if [ -d "${web_dir}/admin" ] ; then
+ mkdir -p ${install_dir}/share/
+ cp ${web_dir}/admin ${install_dir}/share/ -r
+ cp ${web_dir}/png/taos.png ${install_dir}/share/admin/images/taos.png
+ else
+ echo "directory not found for enterprise release: ${web_dir}/admin"
+ fi
fi
fi
@@ -375,4 +379,4 @@ if [ -n "${taostools_bin_files}" ]; then
fi
fi
-cd ${curr_dir}
+cd ${curr_dir}
\ No newline at end of file
diff --git a/source/client/inc/clientInt.h b/source/client/inc/clientInt.h
index cf8b0babdd..33af862528 100644
--- a/source/client/inc/clientInt.h
+++ b/source/client/inc/clientInt.h
@@ -318,6 +318,7 @@ void* createTscObj(const char* user, const char* auth, const char* db, int32_
void destroyTscObj(void* pObj);
STscObj* acquireTscObj(int64_t rid);
int32_t releaseTscObj(int64_t rid);
+void destroyAppInst(SAppInstInfo *pAppInfo);
uint64_t generateRequestId();
diff --git a/source/client/inc/clientStmt.h b/source/client/inc/clientStmt.h
index 2261a6becb..ef4c05afae 100644
--- a/source/client/inc/clientStmt.h
+++ b/source/client/inc/clientStmt.h
@@ -39,6 +39,7 @@ typedef enum {
STMT_BIND_COL,
STMT_ADD_BATCH,
STMT_EXECUTE,
+ STMT_MAX,
} STMT_STATUS;
typedef struct SStmtTableCache {
@@ -94,12 +95,18 @@ typedef struct STscStmt {
STscObj *taos;
SCatalog *pCatalog;
int32_t affectedRows;
+ uint32_t seqId;
+ uint32_t seqIds[STMT_MAX];
SStmtSQLInfo sql;
SStmtExecInfo exec;
SStmtBindInfo bInfo;
} STscStmt;
+extern char *gStmtStatusStr[];
+
+#define STMT_LOG_SEQ(n) do { (pStmt)->seqId++; (pStmt)->seqIds[n]++; STMT_DLOG("the %dth:%d %s", (pStmt)->seqIds[n], (pStmt)->seqId, gStmtStatusStr[n]); } while (0)
+
#define STMT_STATUS_NE(S) (pStmt->sql.status != STMT_##S)
#define STMT_STATUS_EQ(S) (pStmt->sql.status == STMT_##S)
@@ -128,6 +135,12 @@ typedef struct STscStmt {
} \
} while (0)
+#define STMT_ELOG(param, ...) qError("stmt:%p " param, pStmt, __VA_ARGS__)
+#define STMT_DLOG(param, ...) qDebug("stmt:%p " param, pStmt, __VA_ARGS__)
+
+#define STMT_ELOG_E(param) qError("stmt:%p " param, pStmt)
+#define STMT_DLOG_E(param) qDebug("stmt:%p " param, pStmt)
+
TAOS_STMT *stmtInit(STscObj *taos);
int stmtClose(TAOS_STMT *stmt);
int stmtExec(TAOS_STMT *stmt);
diff --git a/source/client/src/clientImpl.c b/source/client/src/clientImpl.c
index 0c12d78c18..e9e30a0be2 100644
--- a/source/client/src/clientImpl.c
+++ b/source/client/src/clientImpl.c
@@ -133,6 +133,12 @@ STscObj* taos_connect_internal(const char* ip, const char* user, const char* pas
taosThreadMutexInit(&p->qnodeMutex, NULL);
p->pTransporter = openTransporter(user, secretEncrypt, tsNumOfCores);
p->pAppHbMgr = appHbMgrInit(p, key);
+ if (NULL == p->pAppHbMgr) {
+ destroyAppInst(p);
+ taosThreadMutexUnlock(&appInfo.mutex);
+ taosMemoryFreeClear(key);
+ return NULL;
+ }
taosHashPut(appInfo.pInstMap, key, strlen(key), &p, POINTER_BYTES);
p->instKey = key;
key = NULL;
@@ -1266,7 +1272,9 @@ static SMsgSendInfo* buildConnectMsg(SRequestObj* pRequest) {
pMsgSendInfo->requestObjRefId = pRequest->self;
pMsgSendInfo->requestId = pRequest->requestId;
pMsgSendInfo->fp = getMsgRspHandle(pMsgSendInfo->msgType);
- pMsgSendInfo->param = pRequest;
+ pMsgSendInfo->param = taosMemoryCalloc(1, sizeof(pRequest->self));
+
+ *(int64_t*)pMsgSendInfo->param = pRequest->self;
SConnectReq connectReq = {0};
STscObj* pObj = pRequest->pTscObj;
diff --git a/source/client/src/clientMain.c b/source/client/src/clientMain.c
index b03576ff01..a08eab3a29 100644
--- a/source/client/src/clientMain.c
+++ b/source/client/src/clientMain.c
@@ -286,7 +286,8 @@ TAOS_ROW taos_fetch_row(TAOS_RES *res) {
return NULL;
} else {
// assert to avoid un-initialization error
- ASSERT(0);
+ tscError("invalid result passed to taos_fetch_row");
+ return NULL;
}
return NULL;
}
diff --git a/source/client/src/clientMsgHandler.c b/source/client/src/clientMsgHandler.c
index e586018c19..938cc4e41d 100644
--- a/source/client/src/clientMsgHandler.c
+++ b/source/client/src/clientMsgHandler.c
@@ -45,8 +45,13 @@ int32_t genericRspCallback(void* param, SDataBuf* pMsg, int32_t code) {
}
int32_t processConnectRsp(void* param, SDataBuf* pMsg, int32_t code) {
- SRequestObj* pRequest = param;
-
+ SRequestObj *pRequest = acquireRequest(*(int64_t*)param);
+ if (NULL == pRequest) {
+ setErrno(pRequest, TSDB_CODE_TSC_DISCONNECTED);
+ tsem_post(&pRequest->body.rspSem);
+ goto End;
+ }
+
if (code != TSDB_CODE_SUCCESS) {
setErrno(pRequest, code);
tsem_post(&pRequest->body.rspSem);
@@ -55,6 +60,12 @@ int32_t processConnectRsp(void* param, SDataBuf* pMsg, int32_t code) {
STscObj* pTscObj = pRequest->pTscObj;
+ if (NULL == pTscObj->pAppInfo || NULL == pTscObj->pAppInfo->pAppHbMgr) {
+ setErrno(pRequest, TSDB_CODE_TSC_DISCONNECTED);
+ tsem_post(&pRequest->body.rspSem);
+ goto End;
+ }
+
SConnectRsp connectRsp = {0};
if (tDeserializeSConnectRsp(pMsg->pData, pMsg->len, &connectRsp) != 0) {
code = TSDB_CODE_TSC_INVALID_VERSION;
@@ -115,10 +126,15 @@ int32_t processConnectRsp(void* param, SDataBuf* pMsg, int32_t code) {
tscDebug("0x%" PRIx64 " clusterId:%" PRId64 ", totalConn:%" PRId64, pRequest->requestId, connectRsp.clusterId,
pTscObj->pAppInfo->numOfConns);
-
+
tsem_post(&pRequest->body.rspSem);
End:
+ if (pRequest) {
+ releaseRequest(pRequest->self);
+ }
+
+ taosMemoryFree(param);
taosMemoryFree(pMsg->pEpSet);
taosMemoryFree(pMsg->pData);
return code;
diff --git a/source/client/src/clientRawBlockWrite.c b/source/client/src/clientRawBlockWrite.c
index f05d37765d..4326ab3519 100644
--- a/source/client/src/clientRawBlockWrite.c
+++ b/source/client/src/clientRawBlockWrite.c
@@ -1181,7 +1181,7 @@ static int32_t taosAlterTable(TAOS* taos, void* meta, int32_t metaLen) {
pVgData = NULL;
pArray = NULL;
code = pRequest->code;
- if (code == TSDB_CODE_VND_TABLE_NOT_EXIST) {
+ if (code == TSDB_CODE_TDB_TABLE_NOT_EXIST) {
code = TSDB_CODE_SUCCESS;
}
diff --git a/source/client/src/clientStmt.c b/source/client/src/clientStmt.c
index 81d0d616c9..7f8d857a0f 100644
--- a/source/client/src/clientStmt.c
+++ b/source/client/src/clientStmt.c
@@ -5,6 +5,8 @@
#include "clientStmt.h"
+char *gStmtStatusStr[] = {"unknown", "init", "prepare", "settbname", "settags", "fetchFields", "bind", "bindCol", "addBatch", "exec"};
+
static int32_t stmtCreateRequest(STscStmt* pStmt) {
int32_t code = 0;
@@ -21,6 +23,10 @@ static int32_t stmtCreateRequest(STscStmt* pStmt) {
int32_t stmtSwitchStatus(STscStmt* pStmt, STMT_STATUS newStatus) {
int32_t code = 0;
+ if (newStatus >= STMT_INIT && newStatus < STMT_MAX) {
+ STMT_LOG_SEQ(newStatus);
+ }
+
switch (newStatus) {
case STMT_PREPARE:
break;
@@ -528,13 +534,17 @@ TAOS_STMT* stmtInit(STscObj* taos) {
pStmt->bInfo.needParse = true;
pStmt->sql.status = STMT_INIT;
+ STMT_LOG_SEQ(STMT_INIT);
+
+ tscDebug("stmt:%p initialized", pStmt);
+
return pStmt;
}
int stmtPrepare(TAOS_STMT* stmt, const char* sql, unsigned long length) {
STscStmt* pStmt = (STscStmt*)stmt;
- tscDebug("stmt start to prepare");
+ STMT_DLOG_E("start to prepare");
if (pStmt->sql.status >= STMT_PREPARE) {
STMT_ERR_RET(stmtResetStmt(pStmt));
@@ -555,7 +565,7 @@ int stmtPrepare(TAOS_STMT* stmt, const char* sql, unsigned long length) {
int stmtSetTbName(TAOS_STMT* stmt, const char* tbName) {
STscStmt* pStmt = (STscStmt*)stmt;
- tscDebug("stmt start to set tbName: %s", tbName);
+ STMT_DLOG("start to set tbName: %s", tbName);
STMT_ERR_RET(stmtSwitchStatus(pStmt, STMT_SETTBNAME));
@@ -587,7 +597,7 @@ int stmtSetTbName(TAOS_STMT* stmt, const char* tbName) {
int stmtSetTbTags(TAOS_STMT* stmt, TAOS_MULTI_BIND* tags) {
STscStmt* pStmt = (STscStmt*)stmt;
- tscDebug("stmt start to set tbTags");
+ STMT_DLOG_E("start to set tbTags");
STMT_ERR_RET(stmtSwitchStatus(pStmt, STMT_SETTAGS));
@@ -649,7 +659,7 @@ int stmtFetchColFields(STscStmt* pStmt, int32_t* fieldNum, TAOS_FIELD_E** fields
int stmtBindBatch(TAOS_STMT* stmt, TAOS_MULTI_BIND* bind, int32_t colIdx) {
STscStmt* pStmt = (STscStmt*)stmt;
- tscDebug("start to bind stmt data, colIdx: %d", colIdx);
+ STMT_DLOG("start to bind stmt data, colIdx: %d", colIdx);
STMT_ERR_RET(stmtSwitchStatus(pStmt, STMT_BIND));
@@ -743,7 +753,7 @@ int stmtBindBatch(TAOS_STMT* stmt, TAOS_MULTI_BIND* bind, int32_t colIdx) {
int stmtAddBatch(TAOS_STMT* stmt) {
STscStmt* pStmt = (STscStmt*)stmt;
- tscDebug("stmt start to add batch");
+ STMT_DLOG_E("start to add batch");
STMT_ERR_RET(stmtSwitchStatus(pStmt, STMT_ADD_BATCH));
@@ -756,8 +766,7 @@ int stmtUpdateTableUid(STscStmt* pStmt, SSubmitRsp* pRsp) {
tscDebug("stmt start to update tbUid, blockNum: %d", pRsp->nBlocks);
if (pRsp->nBlocks <= 0) {
- tscError("invalid submit resp block number %d", pRsp->nBlocks);
- STMT_ERR_RET(TSDB_CODE_TSC_APP_ERROR);
+ return TSDB_CODE_SUCCESS;
}
size_t keyLen = 0;
@@ -810,7 +819,7 @@ int stmtExec(TAOS_STMT* stmt) {
SSubmitRsp* pRsp = NULL;
bool autoCreateTbl = pStmt->exec.autoCreateTbl;
- tscDebug("stmt start to exec");
+ STMT_DLOG_E("start to exec");
STMT_ERR_RET(stmtSwitchStatus(pStmt, STMT_EXECUTE));
@@ -885,6 +894,8 @@ int stmtAffectedRowsOnce(TAOS_STMT* stmt) { return ((STscStmt*)stmt)->exec.affec
int stmtIsInsert(TAOS_STMT* stmt, int* insert) {
STscStmt* pStmt = (STscStmt*)stmt;
+ STMT_DLOG_E("start is insert");
+
if (pStmt->sql.type) {
*insert = (STMT_TYPE_INSERT == pStmt->sql.type || STMT_TYPE_MULTI_INSERT == pStmt->sql.type);
} else {
@@ -897,6 +908,8 @@ int stmtIsInsert(TAOS_STMT* stmt, int* insert) {
int stmtGetTagFields(TAOS_STMT* stmt, int* nums, TAOS_FIELD_E** fields) {
STscStmt* pStmt = (STscStmt*)stmt;
+ STMT_DLOG_E("start to get tag fields");
+
if (STMT_TYPE_QUERY == pStmt->sql.type) {
STMT_RET(TSDB_CODE_TSC_STMT_API_ERROR);
}
@@ -927,6 +940,8 @@ int stmtGetTagFields(TAOS_STMT* stmt, int* nums, TAOS_FIELD_E** fields) {
int stmtGetColFields(TAOS_STMT* stmt, int* nums, TAOS_FIELD_E** fields) {
STscStmt* pStmt = (STscStmt*)stmt;
+ STMT_DLOG_E("start to get col fields");
+
if (STMT_TYPE_QUERY == pStmt->sql.type) {
STMT_RET(TSDB_CODE_TSC_STMT_API_ERROR);
}
@@ -957,6 +972,8 @@ int stmtGetColFields(TAOS_STMT* stmt, int* nums, TAOS_FIELD_E** fields) {
int stmtGetParamNum(TAOS_STMT* stmt, int* nums) {
STscStmt* pStmt = (STscStmt*)stmt;
+ STMT_DLOG_E("start to get param num");
+
STMT_ERR_RET(stmtSwitchStatus(pStmt, STMT_FETCH_FIELDS));
if (pStmt->bInfo.needParse && pStmt->sql.runTimes && pStmt->sql.type > 0 &&
@@ -986,6 +1003,8 @@ int stmtGetParamNum(TAOS_STMT* stmt, int* nums) {
int stmtGetParam(TAOS_STMT* stmt, int idx, int* type, int* bytes) {
STscStmt* pStmt = (STscStmt*)stmt;
+ STMT_DLOG_E("start to get param");
+
if (STMT_TYPE_QUERY == pStmt->sql.type) {
STMT_RET(TSDB_CODE_TSC_STMT_API_ERROR);
}
@@ -1028,6 +1047,8 @@ int stmtGetParam(TAOS_STMT* stmt, int idx, int* type, int* bytes) {
TAOS_RES* stmtUseResult(TAOS_STMT* stmt) {
STscStmt* pStmt = (STscStmt*)stmt;
+ STMT_DLOG_E("start to use result");
+
if (STMT_TYPE_QUERY != pStmt->sql.type) {
tscError("useResult only for query statement");
return NULL;
diff --git a/source/client/src/clientTmq.c b/source/client/src/clientTmq.c
index c18e1e3e40..8e7faf48f6 100644
--- a/source/client/src/clientTmq.c
+++ b/source/client/src/clientTmq.c
@@ -508,7 +508,7 @@ static int32_t tmqSendCommitReq(tmq_t* tmq, SMqClientVg* pVg, SMqClientTopic* pT
pMsgSendInfo->param = pParam;
pMsgSendInfo->paramFreeFp = taosMemoryFree;
pMsgSendInfo->fp = tmqCommitCb;
- pMsgSendInfo->msgType = TDMT_VND_MQ_COMMIT_OFFSET;
+ pMsgSendInfo->msgType = TDMT_VND_TMQ_COMMIT_OFFSET;
// send msg
atomic_add_fetch_32(&pParamSet->waitingRspNum, 1);
@@ -750,7 +750,7 @@ void tmqSendHbReq(void* param, void* tmrId) {
sendInfo->requestObjRefId = 0;
sendInfo->param = NULL;
sendInfo->fp = tmqHbCb;
- sendInfo->msgType = TDMT_MND_MQ_HB;
+ sendInfo->msgType = TDMT_MND_TMQ_HB;
SEpSet epSet = getEpSet_s(&tmq->pTscObj->pAppInfo->mgmtEp);
@@ -1038,7 +1038,7 @@ int32_t tmq_subscribe(tmq_t* tmq, const tmq_list_t* topic_list) {
sendInfo->requestObjRefId = 0;
sendInfo->param = ¶m;
sendInfo->fp = tmqSubscribeCb;
- sendInfo->msgType = TDMT_MND_SUBSCRIBE;
+ sendInfo->msgType = TDMT_MND_TMQ_SUBSCRIBE;
SEpSet epSet = getEpSet_s(&tmq->pTscObj->pAppInfo->mgmtEp);
@@ -1420,7 +1420,7 @@ int32_t tmqAskEp(tmq_t* tmq, bool async) {
sendInfo->requestObjRefId = 0;
sendInfo->param = pParam;
sendInfo->fp = tmqAskEpCb;
- sendInfo->msgType = TDMT_MND_MQ_ASK_EP;
+ sendInfo->msgType = TDMT_MND_TMQ_ASK_EP;
SEpSet epSet = getEpSet_s(&tmq->pTscObj->pAppInfo->mgmtEp);
@@ -1573,7 +1573,7 @@ int32_t tmqPollImpl(tmq_t* tmq, int64_t timeout) {
sendInfo->requestObjRefId = 0;
sendInfo->param = pParam;
sendInfo->fp = tmqPollCb;
- sendInfo->msgType = TDMT_VND_CONSUME;
+ sendInfo->msgType = TDMT_VND_TMQ_CONSUME;
int64_t transporterId = 0;
/*printf("send poll\n");*/
@@ -1756,7 +1756,7 @@ TAOS_RES* tmq_consumer_poll(tmq_t* tmq, int64_t timeout) {
rspObj = tmqHandleAllRsp(tmq, timeout, false);
if (rspObj) {
- tscDebug("consumer:%" PRId64 ", return rsp", tmq->consumerId);
+ tscDebug("consumer:%" PRId64 ", 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);
diff --git a/source/common/src/tdatablock.c b/source/common/src/tdatablock.c
index 0c38d43543..0b27d9b527 100644
--- a/source/common/src/tdatablock.c
+++ b/source/common/src/tdatablock.c
@@ -285,7 +285,7 @@ int32_t colDataMergeCol(SColumnInfoData* pColumnInfoData, int32_t numOfRow1, int
// ASSERT(finalNumOfRows * pColumnInfoData->info.bytes);
char* tmp = taosMemoryRealloc(pColumnInfoData->pData, finalNumOfRows * pColumnInfoData->info.bytes);
if (tmp == NULL) {
- return TSDB_CODE_VND_OUT_OF_MEMORY;
+ return TSDB_CODE_OUT_OF_MEMORY;
}
pColumnInfoData->pData = tmp;
@@ -1132,6 +1132,10 @@ void blockDataCleanup(SSDataBlock* pDataBlock) {
pDataBlock->info.window.ekey = 0;
pDataBlock->info.window.skey = 0;
+ if (pDataBlock->info.capacity == 0) {
+ return;
+ }
+
size_t numOfCols = taosArrayGetSize(pDataBlock->pDataBlock);
for (int32_t i = 0; i < numOfCols; ++i) {
SColumnInfoData* p = taosArrayGet(pDataBlock->pDataBlock, i);
@@ -1186,6 +1190,7 @@ static int32_t doEnsureCapacity(SColumnInfoData* pColumn, const SDataBlockInfo*
}
void colInfoDataCleanup(SColumnInfoData* pColumn, uint32_t numOfRows) {
+ pColumn->hasNull = false;
if (IS_VAR_DATA_TYPE(pColumn->info.type)) {
pColumn->varmeta.length = 0;
if (pColumn->varmeta.offset != NULL) {
@@ -1908,6 +1913,22 @@ char* dumpBlockData(SSDataBlock* pDataBlock, const char* flag, char** pDataBuf)
len += snprintf(dumpBuf + len, size - len, " %25s |", pBuf);
if (len >= size - 1) return dumpBuf;
break;
+ case TSDB_DATA_TYPE_TINYINT:
+ len += snprintf(dumpBuf + len, size - len, " %15d |", *(int8_t*)var);
+ if (len >= size - 1) return dumpBuf;
+ break;
+ case TSDB_DATA_TYPE_UTINYINT:
+ len += snprintf(dumpBuf + len, size - len, " %15d |", *(uint8_t*)var);
+ if (len >= size - 1) return dumpBuf;
+ break;
+ case TSDB_DATA_TYPE_SMALLINT:
+ len += snprintf(dumpBuf + len, size - len, " %15d |", *(int16_t*)var);
+ if (len >= size - 1) return dumpBuf;
+ break;
+ case TSDB_DATA_TYPE_USMALLINT:
+ len += snprintf(dumpBuf + len, size - len, " %15d |", *(uint16_t*)var);
+ if (len >= size - 1) return dumpBuf;
+ break;
case TSDB_DATA_TYPE_INT:
len += snprintf(dumpBuf + len, size - len, " %15d |", *(int32_t*)var);
if (len >= size - 1) return dumpBuf;
@@ -2063,8 +2084,8 @@ int32_t buildSubmitReqFromDataBlock(SSubmitReq** pReq, const SSDataBlock* pDataB
default:
if (pColInfoData->info.type < TSDB_DATA_TYPE_MAX && pColInfoData->info.type > TSDB_DATA_TYPE_NULL) {
if (colDataIsNull_s(pColInfoData, j)) {
- tdAppendColValToRow(&rb, PRIMARYKEY_TIMESTAMP_COL_ID + k, pCol->type, TD_VTYPE_NULL, NULL, false, offset,
- k);
+ tdAppendColValToRow(&rb, PRIMARYKEY_TIMESTAMP_COL_ID + k, pCol->type, TD_VTYPE_NULL, NULL, false,
+ offset, k);
} else if (pCol->type == pColInfoData->info.type) {
tdAppendColValToRow(&rb, PRIMARYKEY_TIMESTAMP_COL_ID + k, pCol->type, TD_VTYPE_NORM, var, true, offset,
k);
@@ -2137,10 +2158,26 @@ int32_t buildSubmitReqFromDataBlock(SSubmitReq** pReq, const SSDataBlock* pDataB
return TSDB_CODE_SUCCESS;
}
-char* buildCtbNameByGroupId(const char* stbName, uint64_t groupId) {
- ASSERT(stbName[0] != 0);
+char* buildCtbNameByGroupId(const char* stbFullName, uint64_t groupId) {
+ ASSERT(stbFullName[0] != 0);
SArray* tags = taosArrayInit(0, sizeof(void*));
+ if (tags == NULL) {
+ return NULL;
+ }
+
SSmlKv* pTag = taosMemoryCalloc(1, sizeof(SSmlKv));
+ if (pTag == NULL) {
+ taosArrayDestroy(tags);
+ return NULL;
+ }
+
+ void* cname = taosMemoryCalloc(1, TSDB_TABLE_NAME_LEN + 1);
+ if (cname == NULL) {
+ taosArrayDestroy(tags);
+ taosMemoryFree(pTag);
+ return NULL;
+ }
+
pTag->key = "group_id";
pTag->keyLen = strlen(pTag->key);
pTag->type = TSDB_DATA_TYPE_UBIGINT;
@@ -2148,13 +2185,11 @@ char* buildCtbNameByGroupId(const char* stbName, uint64_t groupId) {
pTag->length = sizeof(uint64_t);
taosArrayPush(tags, &pTag);
- void* cname = taosMemoryCalloc(1, TSDB_TABLE_NAME_LEN + 1);
-
RandTableName rname = {
.tags = tags,
- .sTableName = stbName,
- .sTableNameLen = strlen(stbName),
- .childTableName = cname,
+ .stbFullName = stbFullName,
+ .stbFullNameLen = strlen(stbFullName),
+ .ctbShortName = cname,
};
buildChildTableName(&rname);
@@ -2162,8 +2197,8 @@ char* buildCtbNameByGroupId(const char* stbName, uint64_t groupId) {
taosMemoryFree(pTag);
taosArrayDestroy(tags);
- ASSERT(rname.childTableName && rname.childTableName[0]);
- return rname.childTableName;
+ ASSERT(rname.ctbShortName && rname.ctbShortName[0]);
+ return rname.ctbShortName;
}
void blockEncode(const SSDataBlock* pBlock, char* data, int32_t* dataLen, int32_t numOfCols, int8_t needCompress) {
diff --git a/source/common/src/tglobal.c b/source/common/src/tglobal.c
index fbb9e04a25..7f4a826c5e 100644
--- a/source/common/src/tglobal.c
+++ b/source/common/src/tglobal.c
@@ -156,6 +156,9 @@ char tsCompressor[32] = "ZSTD_COMPRESSOR"; // ZSTD_COMPRESSOR or GZIP_COMPR
// udf
bool tsStartUdfd = true;
+// wal
+int64_t tsWalFsyncDataSizeLimit = (100 * 1024 * 1024L);
+
// internal
int32_t tsTransPullupInterval = 2;
int32_t tsMqRebalanceInterval = 2;
@@ -163,7 +166,8 @@ int32_t tsTtlUnit = 86400;
int32_t tsTtlPushInterval = 86400;
int32_t tsGrantHBInterval = 60;
int32_t tsUptimeInterval = 300; // seconds
-char tsUdfdResFuncs[1024] = ""; // udfd resident funcs that teardown when udfd exits
+char tsUdfdResFuncs[512] = ""; // udfd resident funcs that teardown when udfd exits
+char tsUdfdLdLibPath[512] = "";
#ifndef _STORAGE
int32_t taosSetTfsCfg(SConfig *pCfg) {
@@ -422,8 +426,12 @@ static int32_t taosAddServerCfg(SConfig *pCfg) {
if (cfgAddInt32(pCfg, "uptimeInterval", tsUptimeInterval, 1, 100000, 1) != 0) return -1;
if (cfgAddInt32(pCfg, "queryRsmaTolerance", tsQueryRsmaTolerance, 0, 900000, 0) != 0) return -1;
+ if (cfgAddInt64(pCfg, "walFsyncDataSizeLimit", tsWalFsyncDataSizeLimit, 100 * 1024 * 1024, INT64_MAX, 0) != 0)
+ return -1;
+
if (cfgAddBool(pCfg, "udf", tsStartUdfd, 0) != 0) return -1;
if (cfgAddString(pCfg, "udfdResFuncs", tsUdfdResFuncs, 0) != 0) return -1;
+ if (cfgAddString(pCfg, "udfdLdLibPath", tsUdfdLdLibPath, 0) != 0) return -1;
GRANT_CFG_ADD;
return 0;
}
@@ -720,9 +728,11 @@ static int32_t taosSetServerCfg(SConfig *pCfg) {
tsUptimeInterval = cfgGetItem(pCfg, "uptimeInterval")->i32;
tsQueryRsmaTolerance = cfgGetItem(pCfg, "queryRsmaTolerance")->i32;
+ tsWalFsyncDataSizeLimit = cfgGetItem(pCfg, "walFsyncDataSizeLimit")->i64;
+
tsStartUdfd = cfgGetItem(pCfg, "udf")->bval;
tstrncpy(tsUdfdResFuncs, cfgGetItem(pCfg, "udfdResFuncs")->str, sizeof(tsUdfdResFuncs));
-
+ tstrncpy(tsUdfdLdLibPath, cfgGetItem(pCfg, "udfdLdLibPath")->str, sizeof(tsUdfdLdLibPath));
if (tsQueryBufferSize >= 0) {
tsQueryBufferSizeBytes = tsQueryBufferSize * 1048576UL;
}
diff --git a/source/common/src/tmsg.c b/source/common/src/tmsg.c
index ce9b60668e..4eaa934676 100644
--- a/source/common/src/tmsg.c
+++ b/source/common/src/tmsg.c
@@ -1020,6 +1020,7 @@ int32_t tSerializeSStatusReq(void *buf, int32_t bufLen, SStatusReq *pReq) {
if (tEncodeI64(&encoder, pReq->qload.timeInQueryQueue) < 0) return -1;
if (tEncodeI64(&encoder, pReq->qload.timeInFetchQueue) < 0) return -1;
+ if (tEncodeI32(&encoder, pReq->statusSeq) < 0) return -1;
tEndEncode(&encoder);
int32_t tlen = encoder.pos;
@@ -1095,6 +1096,7 @@ int32_t tDeserializeSStatusReq(void *buf, int32_t bufLen, SStatusReq *pReq) {
if (tDecodeI64(&decoder, &pReq->qload.timeInQueryQueue) < 0) return -1;
if (tDecodeI64(&decoder, &pReq->qload.timeInFetchQueue) < 0) return -1;
+ if (tDecodeI32(&decoder, &pReq->statusSeq) < 0) return -1;
tEndDecode(&decoder);
tDecoderClear(&decoder);
return 0;
@@ -1126,6 +1128,7 @@ int32_t tSerializeSStatusRsp(void *buf, int32_t bufLen, SStatusRsp *pRsp) {
if (tEncodeU16(&encoder, pDnodeEp->ep.port) < 0) return -1;
}
+ if (tEncodeI32(&encoder, pRsp->statusSeq) < 0) return -1;
tEndEncode(&encoder);
int32_t tlen = encoder.pos;
@@ -1167,6 +1170,7 @@ int32_t tDeserializeSStatusRsp(void *buf, int32_t bufLen, SStatusRsp *pRsp) {
}
}
+ if (tDecodeI32(&decoder, &pRsp->statusSeq) < 0) return -1;
tEndDecode(&decoder);
tDecoderClear(&decoder);
return 0;
@@ -1485,6 +1489,7 @@ int32_t tSerializeSDropDnodeReq(void *buf, int32_t bufLen, SDropDnodeReq *pReq)
if (tEncodeI32(&encoder, pReq->dnodeId) < 0) return -1;
if (tEncodeCStr(&encoder, pReq->fqdn) < 0) return -1;
if (tEncodeI32(&encoder, pReq->port) < 0) return -1;
+ if (tEncodeI8(&encoder, pReq->force) < 0) return -1;
tEndEncode(&encoder);
int32_t tlen = encoder.pos;
@@ -1500,6 +1505,7 @@ int32_t tDeserializeSDropDnodeReq(void *buf, int32_t bufLen, SDropDnodeReq *pReq
if (tDecodeI32(&decoder, &pReq->dnodeId) < 0) return -1;
if (tDecodeCStrTo(&decoder, pReq->fqdn) < 0) return -1;
if (tDecodeI32(&decoder, &pReq->port) < 0) return -1;
+ if (tDecodeI8(&decoder, &pReq->force) < 0) return -1;
tEndDecode(&decoder);
tDecoderClear(&decoder);
@@ -5430,9 +5436,12 @@ static int32_t tEncodeSSubmitBlkRsp(SEncoder *pEncoder, const SSubmitBlkRsp *pBl
if (tStartEncode(pEncoder) < 0) return -1;
if (tEncodeI32(pEncoder, pBlock->code) < 0) return -1;
- if (tEncodeI8(pEncoder, pBlock->hashMeta) < 0) return -1;
if (tEncodeI64(pEncoder, pBlock->uid) < 0) return -1;
- if (tEncodeCStr(pEncoder, pBlock->tblFName) < 0) return -1;
+ if (pBlock->tblFName) {
+ if (tEncodeCStr(pEncoder, pBlock->tblFName) < 0) return -1;
+ } else {
+ if (tEncodeCStr(pEncoder, "") < 0) return -1;
+ }
if (tEncodeI32v(pEncoder, pBlock->numOfRows) < 0) return -1;
if (tEncodeI32v(pEncoder, pBlock->affectedRows) < 0) return -1;
if (tEncodeI64v(pEncoder, pBlock->sver) < 0) return -1;
@@ -5449,7 +5458,6 @@ static int32_t tDecodeSSubmitBlkRsp(SDecoder *pDecoder, SSubmitBlkRsp *pBlock) {
if (tStartDecode(pDecoder) < 0) return -1;
if (tDecodeI32(pDecoder, &pBlock->code) < 0) return -1;
- if (tDecodeI8(pDecoder, &pBlock->hashMeta) < 0) return -1;
if (tDecodeI64(pDecoder, &pBlock->uid) < 0) return -1;
pBlock->tblFName = taosMemoryCalloc(TSDB_TABLE_FNAME_LEN, 1);
if (NULL == pBlock->tblFName) return -1;
diff --git a/source/common/src/tname.c b/source/common/src/tname.c
index 70682d6cd4..4d83b6e3d8 100644
--- a/source/common/src/tname.c
+++ b/source/common/src/tname.c
@@ -315,7 +315,7 @@ static int compareKv(const void* p1, const void* p2) {
*/
void buildChildTableName(RandTableName* rName) {
SStringBuilder sb = {0};
- taosStringBuilderAppendStringLen(&sb, rName->sTableName, rName->sTableNameLen);
+ taosStringBuilderAppendStringLen(&sb, rName->stbFullName, rName->stbFullNameLen);
taosArraySort(rName->tags, compareKv);
for (int j = 0; j < taosArrayGetSize(rName->tags); ++j) {
taosStringBuilderAppendChar(&sb, ',');
@@ -336,11 +336,11 @@ void buildChildTableName(RandTableName* rName) {
tMD5Final(&context);
char temp[8] = {0};
- rName->childTableName[0] = 't';
- rName->childTableName[1] = '_';
+ rName->ctbShortName[0] = 't';
+ rName->ctbShortName[1] = '_';
for (int i = 0; i < 16; i++) {
sprintf(temp, "%02x", context.digest[i]);
- strcat(rName->childTableName, temp);
+ strcat(rName->ctbShortName, temp);
}
taosStringBuilderDestroy(&sb);
rName->uid = *(uint64_t*)(context.digest);
diff --git a/source/common/src/ttszip.c b/source/common/src/ttszip.c
index fe5c599d53..3a6bc097c1 100644
--- a/source/common/src/ttszip.c
+++ b/source/common/src/ttszip.c
@@ -31,7 +31,7 @@ static int32_t STSBufUpdateHeader(STSBuf* pTSBuf, STSBufFileHeader* pHeader);
*/
STSBuf* tsBufCreate(bool autoDelete, int32_t order) {
if (!osTempSpaceAvailable()) {
- terrno = TSDB_CODE_TSC_NO_DISKSPACE;
+ terrno = TSDB_CODE_NO_DISKSPACE;
// tscError("tmp file created failed since %s", terrstr());
return NULL;
}
diff --git a/source/dnode/mgmt/CMakeLists.txt b/source/dnode/mgmt/CMakeLists.txt
index 423028b167..762b8fd529 100644
--- a/source/dnode/mgmt/CMakeLists.txt
+++ b/source/dnode/mgmt/CMakeLists.txt
@@ -13,4 +13,18 @@ target_include_directories(
taosd
PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/node_mgmt/inc"
)
-target_link_libraries(taosd dnode)
+
+IF (TD_LINUX_64 AND JEMALLOC_ENABLED)
+ ADD_DEFINITIONS(-DTD_JEMALLOC_ENABLED -I${CMAKE_BINARY_DIR}/build/include -L${CMAKE_BINARY_DIR}/build/lib -Wl,-rpath,${CMAKE_BINARY_DIR}/build/lib -ljemalloc)
+ SET(LINK_JEMALLOC "-L${CMAKE_BINARY_DIR}/build/lib -ljemalloc")
+ELSE ()
+ SET(LINK_JEMALLOC "")
+ENDIF ()
+
+IF (TD_LINUX_64 AND JEMALLOC_ENABLED)
+ ADD_DEPENDENCIES(taosd jemalloc)
+ target_link_libraries(taosd dnode ${LINK_JEMALLOC})
+ELSE ()
+ target_link_libraries(taosd dnode)
+ENDIF ()
+
diff --git a/source/dnode/mgmt/mgmt_dnode/inc/dmInt.h b/source/dnode/mgmt/mgmt_dnode/inc/dmInt.h
index dc4412b77b..c776beb3f0 100644
--- a/source/dnode/mgmt/mgmt_dnode/inc/dmInt.h
+++ b/source/dnode/mgmt/mgmt_dnode/inc/dmInt.h
@@ -36,6 +36,7 @@ typedef struct SDnodeMgmt {
GetVnodeLoadsFp getVnodeLoadsFp;
GetMnodeLoadsFp getMnodeLoadsFp;
GetQnodeLoadsFp getQnodeLoadsFp;
+ int32_t statusSeq;
} SDnodeMgmt;
// dmHandle.c
diff --git a/source/dnode/mgmt/mgmt_dnode/src/dmHandle.c b/source/dnode/mgmt/mgmt_dnode/src/dmHandle.c
index f12dce5149..85a09b79fd 100644
--- a/source/dnode/mgmt/mgmt_dnode/src/dmHandle.c
+++ b/source/dnode/mgmt/mgmt_dnode/src/dmHandle.c
@@ -32,9 +32,13 @@ static void dmUpdateDnodeCfg(SDnodeMgmt *pMgmt, SDnodeCfg *pCfg) {
}
static void dmProcessStatusRsp(SDnodeMgmt *pMgmt, SRpcMsg *pRsp) {
+ const STraceId *trace = &pRsp->info.traceId;
+ dGTrace("status rsp received from mnode, statusSeq:%d code:0x%x", pMgmt->statusSeq, pRsp->code);
+
if (pRsp->code != 0) {
if (pRsp->code == TSDB_CODE_MND_DNODE_NOT_EXIST && !pMgmt->pData->dropped && pMgmt->pData->dnodeId > 0) {
- dInfo("dnode:%d, set to dropped since not exist in mnode", pMgmt->pData->dnodeId);
+ dGInfo("dnode:%d, set to dropped since not exist in mnode, statusSeq:%d", pMgmt->pData->dnodeId,
+ pMgmt->statusSeq);
pMgmt->pData->dropped = 1;
dmWriteEps(pMgmt->pData);
}
@@ -42,9 +46,9 @@ static void dmProcessStatusRsp(SDnodeMgmt *pMgmt, SRpcMsg *pRsp) {
SStatusRsp statusRsp = {0};
if (pRsp->pCont != NULL && pRsp->contLen > 0 &&
tDeserializeSStatusRsp(pRsp->pCont, pRsp->contLen, &statusRsp) == 0) {
- dTrace("status msg received from mnode, dnodeVer:%" PRId64 " saved:%" PRId64, statusRsp.dnodeVer,
- pMgmt->pData->dnodeVer);
if (pMgmt->pData->dnodeVer != statusRsp.dnodeVer) {
+ dGInfo("status rsp received from mnode, statusSeq:%d:%d dnodeVer:%" PRId64 ":%" PRId64, pMgmt->statusSeq,
+ statusRsp.statusSeq, pMgmt->pData->dnodeVer, statusRsp.dnodeVer);
pMgmt->pData->dnodeVer = statusRsp.dnodeVer;
dmUpdateDnodeCfg(pMgmt, &statusRsp.dnodeCfg);
dmUpdateEps(pMgmt->pData, statusRsp.pDnodeEps);
@@ -91,6 +95,9 @@ void dmSendStatusReq(SDnodeMgmt *pMgmt) {
(*pMgmt->getQnodeLoadsFp)(&req.qload);
+ pMgmt->statusSeq++;
+ req.statusSeq = pMgmt->statusSeq;
+
int32_t contLen = tSerializeSStatusReq(NULL, 0, &req);
void *pHead = rpcMallocCont(contLen);
tSerializeSStatusReq(pHead, contLen, &req);
@@ -99,13 +106,13 @@ void dmSendStatusReq(SDnodeMgmt *pMgmt) {
SRpcMsg rpcMsg = {.pCont = pHead, .contLen = contLen, .msgType = TDMT_MND_STATUS, .info.ahandle = (void *)0x9527};
SRpcMsg rpcRsp = {0};
- dTrace("send status msg to mnode, dnodeVer:%" PRId64, req.dnodeVer);
+ dTrace("send status req to mnode, dnodeVer:%" PRId64 " statusSeq:%d", req.dnodeVer, req.statusSeq);
SEpSet epSet = {0};
dmGetMnodeEpSet(pMgmt->pData, &epSet);
rpcSendRecv(pMgmt->msgCb.clientRpc, &epSet, &rpcMsg, &rpcRsp);
if (rpcRsp.code != 0) {
- dError("failed to send status msg since %s, numOfEps:%d inUse:%d", tstrerror(rpcRsp.code), epSet.numOfEps,
+ dError("failed to send status req since %s, numOfEps:%d inUse:%d", tstrerror(rpcRsp.code), epSet.numOfEps,
epSet.inUse);
for (int32_t i = 0; i < epSet.numOfEps; ++i) {
dDebug("index:%d, mnode ep:%s:%u", i, epSet.eps[i].fqdn, epSet.eps[i].port);
diff --git a/source/dnode/mgmt/mgmt_dnode/src/dmWorker.c b/source/dnode/mgmt/mgmt_dnode/src/dmWorker.c
index ca8a434d05..07a612bb35 100644
--- a/source/dnode/mgmt/mgmt_dnode/src/dmWorker.c
+++ b/source/dnode/mgmt/mgmt_dnode/src/dmWorker.c
@@ -20,7 +20,7 @@ static void *dmStatusThreadFp(void *param) {
SDnodeMgmt *pMgmt = param;
int64_t lastTime = taosGetTimestampMs();
setThreadName("dnode-status");
-
+
while (1) {
taosMsleep(200);
if (pMgmt->pData->dropped || pMgmt->pData->stopped) break;
@@ -28,6 +28,7 @@ static void *dmStatusThreadFp(void *param) {
int64_t curTime = taosGetTimestampMs();
float interval = (curTime - lastTime) / 1000.0f;
if (interval >= tsStatusInterval) {
+ taosMemoryTrim(0);
dmSendStatusReq(pMgmt);
lastTime = curTime;
}
diff --git a/source/dnode/mgmt/mgmt_mnode/src/mmHandle.c b/source/dnode/mgmt/mgmt_mnode/src/mmHandle.c
index 12e678886d..976f2cfd8b 100644
--- a/source/dnode/mgmt/mgmt_mnode/src/mmHandle.c
+++ b/source/dnode/mgmt/mgmt_mnode/src/mmHandle.c
@@ -141,15 +141,13 @@ SArray *mmGetMsgHandles() {
if (dmSetMgmtHandle(pArray, TDMT_MND_DROP_STREAM, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
if (dmSetMgmtHandle(pArray, TDMT_MND_GET_INDEX, mmPutMsgToReadQueue, 0) == NULL) goto _OVER;
if (dmSetMgmtHandle(pArray, TDMT_MND_GET_TABLE_INDEX, mmPutMsgToReadQueue, 0) == NULL) goto _OVER;
- if (dmSetMgmtHandle(pArray, TDMT_MND_CREATE_TOPIC, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
- if (dmSetMgmtHandle(pArray, TDMT_MND_ALTER_TOPIC, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
- if (dmSetMgmtHandle(pArray, TDMT_MND_DROP_TOPIC, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
- if (dmSetMgmtHandle(pArray, TDMT_MND_SUBSCRIBE, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
- if (dmSetMgmtHandle(pArray, TDMT_MND_MQ_ASK_EP, mmPutMsgToReadQueue, 0) == NULL) goto _OVER;
- if (dmSetMgmtHandle(pArray, TDMT_MND_MQ_HB, mmPutMsgToReadQueue, 0) == NULL) goto _OVER;
- if (dmSetMgmtHandle(pArray, TDMT_MND_MQ_DROP_CGROUP, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
- if (dmSetMgmtHandle(pArray, TDMT_MND_MQ_DROP_CGROUP_RSP, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
- if (dmSetMgmtHandle(pArray, TDMT_MND_MQ_COMMIT_OFFSET, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
+ if (dmSetMgmtHandle(pArray, TDMT_MND_TMQ_CREATE_TOPIC, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
+ if (dmSetMgmtHandle(pArray, TDMT_MND_TMQ_DROP_TOPIC, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
+ if (dmSetMgmtHandle(pArray, TDMT_MND_TMQ_SUBSCRIBE, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
+ if (dmSetMgmtHandle(pArray, TDMT_MND_TMQ_ASK_EP, mmPutMsgToReadQueue, 0) == NULL) goto _OVER;
+ if (dmSetMgmtHandle(pArray, TDMT_MND_TMQ_HB, mmPutMsgToReadQueue, 0) == NULL) goto _OVER;
+ if (dmSetMgmtHandle(pArray, TDMT_MND_TMQ_DROP_CGROUP, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
+ if (dmSetMgmtHandle(pArray, TDMT_MND_TMQ_DROP_CGROUP_RSP, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
if (dmSetMgmtHandle(pArray, TDMT_MND_KILL_TRANS, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
if (dmSetMgmtHandle(pArray, TDMT_MND_KILL_QUERY, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
if (dmSetMgmtHandle(pArray, TDMT_MND_KILL_CONN, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
@@ -171,10 +169,10 @@ SArray *mmGetMsgHandles() {
if (dmSetMgmtHandle(pArray, TDMT_VND_DROP_STB_RSP, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
if (dmSetMgmtHandle(pArray, TDMT_VND_CREATE_SMA_RSP, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
if (dmSetMgmtHandle(pArray, TDMT_VND_DROP_SMA_RSP, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
- if (dmSetMgmtHandle(pArray, TDMT_VND_MQ_VG_CHANGE_RSP, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
- if (dmSetMgmtHandle(pArray, TDMT_VND_MQ_VG_DELETE_RSP, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
- if (dmSetMgmtHandle(pArray, TDMT_VND_ADD_CHECK_INFO_RSP, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
- if (dmSetMgmtHandle(pArray, TDMT_VND_DELETE_CHECK_INFO_RSP, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
+ if (dmSetMgmtHandle(pArray, TDMT_VND_TMQ_SUBSCRIBE_RSP, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
+ if (dmSetMgmtHandle(pArray, TDMT_VND_TMQ_DELETE_SUB_RSP, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
+ if (dmSetMgmtHandle(pArray, TDMT_VND_TMQ_ADD_CHECKINFO_RSP, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
+ if (dmSetMgmtHandle(pArray, TDMT_VND_TMQ_DEL_CHECKINFO_RSP, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
if (dmSetMgmtHandle(pArray, TDMT_SCH_DROP_TASK, mmPutMsgToFetchQueue, 1) == NULL) goto _OVER;
if (dmSetMgmtHandle(pArray, TDMT_STREAM_TASK_DEPLOY_RSP, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
if (dmSetMgmtHandle(pArray, TDMT_STREAM_TASK_DROP_RSP, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
@@ -197,6 +195,8 @@ SArray *mmGetMsgHandles() {
if (dmSetMgmtHandle(pArray, TDMT_SYNC_APPEND_ENTRIES_REPLY, mmPutMsgToSyncQueue, 1) == NULL) goto _OVER;
if (dmSetMgmtHandle(pArray, TDMT_SYNC_SNAPSHOT_SEND, mmPutMsgToSyncQueue, 1) == NULL) goto _OVER;
if (dmSetMgmtHandle(pArray, TDMT_SYNC_SNAPSHOT_RSP, mmPutMsgToSyncQueue, 1) == NULL) goto _OVER;
+ if (dmSetMgmtHandle(pArray, TDMT_SYNC_PRE_SNAPSHOT, mmPutMsgToSyncQueue, 1) == NULL) goto _OVER;
+ if (dmSetMgmtHandle(pArray, TDMT_SYNC_PRE_SNAPSHOT_REPLY, mmPutMsgToSyncQueue, 1) == NULL) goto _OVER;
if (dmSetMgmtHandle(pArray, TDMT_SYNC_HEARTBEAT, mmPutMsgToSyncCtrlQueue, 1) == NULL) goto _OVER;
if (dmSetMgmtHandle(pArray, TDMT_SYNC_HEARTBEAT_REPLY, mmPutMsgToSyncCtrlQueue, 1) == NULL) goto _OVER;
diff --git a/source/dnode/mgmt/mgmt_mnode/src/mmWorker.c b/source/dnode/mgmt/mgmt_mnode/src/mmWorker.c
index e0a39a6bf1..e50b527bac 100644
--- a/source/dnode/mgmt/mgmt_mnode/src/mmWorker.c
+++ b/source/dnode/mgmt/mgmt_mnode/src/mmWorker.c
@@ -67,24 +67,6 @@ static void mmProcessRpcMsg(SQueueInfo *pInfo, SRpcMsg *pMsg) {
taosFreeQitem(pMsg);
}
-static void mmProcessSyncCtrlMsg(SQueueInfo *pInfo, SRpcMsg *pMsg) {
- SMnodeMgmt *pMgmt = pInfo->ahandle;
- pMsg->info.node = pMgmt->pMnode;
-
- const STraceId *trace = &pMsg->info.traceId;
- dGTrace("msg:%p, get from mnode-sync-ctrl queue", pMsg);
-
- SMsgHead *pHead = pMsg->pCont;
- pHead->contLen = ntohl(pHead->contLen);
- pHead->vgId = ntohl(pHead->vgId);
-
- int32_t code = mndProcessSyncCtrlMsg(pMsg);
-
- dGTrace("msg:%p, is freed, code:0x%x", pMsg, code);
- rpcFreeCont(pMsg->pCont);
- taosFreeQitem(pMsg);
-}
-
static void mmProcessSyncMsg(SQueueInfo *pInfo, SRpcMsg *pMsg) {
SMnodeMgmt *pMgmt = pInfo->ahandle;
pMsg->info.node = pMgmt->pMnode;
@@ -252,7 +234,7 @@ int32_t mmStartWorker(SMnodeMgmt *pMgmt) {
.min = 1,
.max = 1,
.name = "mnode-sync-ctrl",
- .fp = (FItem)mmProcessSyncCtrlMsg,
+ .fp = (FItem)mmProcessSyncMsg,
.param = pMgmt,
};
if (tSingleWorkerInit(&pMgmt->syncCtrlWorker, &scCfg) != 0) {
diff --git a/source/dnode/mgmt/mgmt_snode/src/smHandle.c b/source/dnode/mgmt/mgmt_snode/src/smHandle.c
index 1ce7f1a84b..7ecb6fb208 100644
--- a/source/dnode/mgmt/mgmt_snode/src/smHandle.c
+++ b/source/dnode/mgmt/mgmt_snode/src/smHandle.c
@@ -72,8 +72,6 @@ SArray *smGetMsgHandles() {
if (dmSetMgmtHandle(pArray, TDMT_STREAM_TASK_RUN, smPutNodeMsgToStreamQueue, 1) == NULL) goto _OVER;
if (dmSetMgmtHandle(pArray, TDMT_STREAM_TASK_DISPATCH, smPutNodeMsgToStreamQueue, 1) == NULL) goto _OVER;
if (dmSetMgmtHandle(pArray, TDMT_STREAM_TASK_DISPATCH_RSP, smPutNodeMsgToStreamQueue, 1) == NULL) goto _OVER;
- if (dmSetMgmtHandle(pArray, TDMT_STREAM_TASK_RECOVER, smPutNodeMsgToStreamQueue, 1) == NULL) goto _OVER;
- if (dmSetMgmtHandle(pArray, TDMT_STREAM_TASK_RECOVER_RSP, smPutNodeMsgToStreamQueue, 1) == NULL) goto _OVER;
if (dmSetMgmtHandle(pArray, TDMT_STREAM_RETRIEVE, smPutNodeMsgToStreamQueue, 1) == NULL) goto _OVER;
if (dmSetMgmtHandle(pArray, TDMT_STREAM_RETRIEVE_RSP, smPutNodeMsgToStreamQueue, 1) == NULL) goto _OVER;
diff --git a/source/dnode/mgmt/mgmt_snode/src/smWorker.c b/source/dnode/mgmt/mgmt_snode/src/smWorker.c
index 6a70527541..dbd081338a 100644
--- a/source/dnode/mgmt/mgmt_snode/src/smWorker.c
+++ b/source/dnode/mgmt/mgmt_snode/src/smWorker.c
@@ -58,7 +58,11 @@ static void smProcessStreamQueue(SQueueInfo *pInfo, SRpcMsg *pMsg) {
dTrace("msg:%p, get from snode-stream queue", pMsg);
int32_t code = sndProcessStreamMsg(pMgmt->pSnode, pMsg);
if (code < 0) {
- dGError("snd, msg:%p failed to process stream since %s", pMsg, terrstr(code));
+ if (pMsg) {
+ dGError("snd, msg:%p failed to process stream msg %s since %s", pMsg, TMSG_INFO(pMsg->msgType), terrstr(code));
+ } else {
+ dGError("snd, msg:%p failed to process stream empty msg since %s", pMsg, terrstr(code));
+ }
smSendRsp(pMsg, terrno);
}
diff --git a/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c b/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c
index d682fa9cc5..51213a6ab3 100644
--- a/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c
+++ b/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c
@@ -392,27 +392,28 @@ SArray *vmGetMsgHandles() {
if (dmSetMgmtHandle(pArray, TDMT_VND_CANCEL_SMA, vmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
if (dmSetMgmtHandle(pArray, TDMT_VND_DROP_SMA, vmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
if (dmSetMgmtHandle(pArray, TDMT_VND_SUBMIT_RSMA, vmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
- if (dmSetMgmtHandle(pArray, TDMT_VND_MQ_VG_CHANGE, vmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
- if (dmSetMgmtHandle(pArray, TDMT_VND_MQ_VG_DELETE, vmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
- if (dmSetMgmtHandle(pArray, TDMT_VND_MQ_COMMIT_OFFSET, vmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
- if (dmSetMgmtHandle(pArray, TDMT_VND_ADD_CHECK_INFO, vmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
- if (dmSetMgmtHandle(pArray, TDMT_VND_DELETE_CHECK_INFO, vmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
- if (dmSetMgmtHandle(pArray, TDMT_VND_CONSUME, vmPutMsgToFetchQueue, 0) == NULL) goto _OVER;
+ if (dmSetMgmtHandle(pArray, TDMT_VND_TMQ_SUBSCRIBE, vmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
+ if (dmSetMgmtHandle(pArray, TDMT_VND_TMQ_DELETE_SUB, vmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
+ if (dmSetMgmtHandle(pArray, TDMT_VND_TMQ_COMMIT_OFFSET, vmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
+ if (dmSetMgmtHandle(pArray, TDMT_VND_TMQ_ADD_CHECKINFO, vmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
+ if (dmSetMgmtHandle(pArray, TDMT_VND_TMQ_DEL_CHECKINFO, vmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
+ if (dmSetMgmtHandle(pArray, TDMT_VND_TMQ_CONSUME, vmPutMsgToFetchQueue, 0) == NULL) goto _OVER;
if (dmSetMgmtHandle(pArray, TDMT_VND_DELETE, vmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
if (dmSetMgmtHandle(pArray, TDMT_VND_BATCH_DEL, vmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
if (dmSetMgmtHandle(pArray, TDMT_VND_COMMIT, vmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
if (dmSetMgmtHandle(pArray, TDMT_SCH_QUERY_HEARTBEAT, vmPutMsgToFetchQueue, 0) == NULL) goto _OVER;
- if (dmSetMgmtHandle(pArray, TDMT_VND_STREAM_TRIGGER, vmPutMsgToStreamQueue, 0) == NULL) goto _OVER;
if (dmSetMgmtHandle(pArray, TDMT_STREAM_TASK_DROP, vmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
if (dmSetMgmtHandle(pArray, TDMT_STREAM_TASK_DEPLOY, vmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
if (dmSetMgmtHandle(pArray, TDMT_STREAM_TASK_RUN, vmPutMsgToStreamQueue, 0) == NULL) goto _OVER;
if (dmSetMgmtHandle(pArray, TDMT_STREAM_TASK_DISPATCH, vmPutMsgToStreamQueue, 0) == NULL) goto _OVER;
if (dmSetMgmtHandle(pArray, TDMT_STREAM_TASK_DISPATCH_RSP, vmPutMsgToStreamQueue, 0) == NULL) goto _OVER;
- if (dmSetMgmtHandle(pArray, TDMT_STREAM_TASK_RECOVER, vmPutMsgToStreamQueue, 0) == NULL) goto _OVER;
- if (dmSetMgmtHandle(pArray, TDMT_STREAM_TASK_RECOVER_RSP, vmPutMsgToStreamQueue, 0) == NULL) goto _OVER;
if (dmSetMgmtHandle(pArray, TDMT_STREAM_RETRIEVE, vmPutMsgToStreamQueue, 0) == NULL) goto _OVER;
if (dmSetMgmtHandle(pArray, TDMT_STREAM_RETRIEVE_RSP, vmPutMsgToStreamQueue, 0) == NULL) goto _OVER;
+ if (dmSetMgmtHandle(pArray, TDMT_STREAM_RECOVER_FINISH, vmPutMsgToStreamQueue, 0) == NULL) goto _OVER;
+ if (dmSetMgmtHandle(pArray, TDMT_STREAM_TASK_CHECK, vmPutMsgToStreamQueue, 0) == NULL) goto _OVER;
+ if (dmSetMgmtHandle(pArray, TDMT_STREAM_TASK_CHECK_RSP, vmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
+ if (dmSetMgmtHandle(pArray, TDMT_VND_STREAM_TRIGGER, vmPutMsgToStreamQueue, 0) == NULL) goto _OVER;
if (dmSetMgmtHandle(pArray, TDMT_VND_ALTER_REPLICA, vmPutMsgToMgmtQueue, 0) == NULL) goto _OVER;
if (dmSetMgmtHandle(pArray, TDMT_VND_ALTER_CONFIG, vmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
@@ -436,6 +437,9 @@ SArray *vmGetMsgHandles() {
if (dmSetMgmtHandle(pArray, TDMT_SYNC_APPEND_ENTRIES_REPLY, vmPutMsgToSyncQueue, 0) == NULL) goto _OVER;
if (dmSetMgmtHandle(pArray, TDMT_SYNC_SNAPSHOT_SEND, vmPutMsgToSyncQueue, 0) == NULL) goto _OVER;
if (dmSetMgmtHandle(pArray, TDMT_SYNC_SNAPSHOT_RSP, vmPutMsgToSyncQueue, 0) == NULL) goto _OVER;
+ if (dmSetMgmtHandle(pArray, TDMT_SYNC_PRE_SNAPSHOT, vmPutMsgToSyncQueue, 0) == NULL) goto _OVER;
+ if (dmSetMgmtHandle(pArray, TDMT_SYNC_PRE_SNAPSHOT_REPLY, vmPutMsgToSyncQueue, 0) == NULL) goto _OVER;
+
if (dmSetMgmtHandle(pArray, TDMT_SYNC_HEARTBEAT, vmPutMsgToSyncCtrlQueue, 0) == NULL) goto _OVER;
if (dmSetMgmtHandle(pArray, TDMT_SYNC_HEARTBEAT_REPLY, vmPutMsgToSyncCtrlQueue, 0) == NULL) goto _OVER;
diff --git a/source/dnode/mgmt/mgmt_vnode/src/vmWorker.c b/source/dnode/mgmt/mgmt_vnode/src/vmWorker.c
index d5b1e18c7b..40d0e32c2b 100644
--- a/source/dnode/mgmt/mgmt_vnode/src/vmWorker.c
+++ b/source/dnode/mgmt/mgmt_vnode/src/vmWorker.c
@@ -86,7 +86,12 @@ static void vmProcessStreamQueue(SQueueInfo *pInfo, SRpcMsg *pMsg) {
int32_t code = vnodeProcessFetchMsg(pVnode->pImpl, pMsg, pInfo);
if (code != 0) {
if (terrno != 0) code = terrno;
- dGError("vgId:%d, msg:%p failed to process stream since %s", pVnode->vgId, pMsg, terrstr(code));
+ if (pMsg) {
+ dGError("vgId:%d, msg:%p failed to process stream msg %s since %s", pVnode->vgId, pMsg, TMSG_INFO(pMsg->msgType),
+ terrstr(code));
+ } else {
+ dGError("vgId:%d, msg:%p failed to process stream empty msg since %s", pVnode->vgId, pMsg, terrstr(code));
+ }
vmSendRsp(pMsg, code);
}
@@ -133,22 +138,6 @@ static void vmProcessSyncQueue(SQueueInfo *pInfo, STaosQall *qall, int32_t numOf
}
}
-static void vmProcessSyncCtrlQueue(SQueueInfo *pInfo, STaosQall *qall, int32_t numOfMsgs) {
- SVnodeObj *pVnode = pInfo->ahandle;
- SRpcMsg *pMsg = NULL;
-
- for (int32_t i = 0; i < numOfMsgs; ++i) {
- if (taosGetQitem(qall, (void **)&pMsg) == 0) continue;
- const STraceId *trace = &pMsg->info.traceId;
- dGTrace("vgId:%d, msg:%p get from vnode-sync queue", pVnode->vgId, pMsg);
-
- int32_t code = vnodeProcessSyncCtrlMsg(pVnode->pImpl, pMsg, NULL); // no response here
- dGTrace("vgId:%d, msg:%p is freed, code:0x%x", pVnode->vgId, pMsg, code);
- rpcFreeCont(pMsg->pCont);
- taosFreeQitem(pMsg);
- }
-}
-
static int32_t vmPutMsgToQueue(SVnodeMgmt *pMgmt, SRpcMsg *pMsg, EQueueType qtype) {
const STraceId *trace = &pMsg->info.traceId;
SMsgHead *pHead = pMsg->pCont;
@@ -190,7 +179,7 @@ static int32_t vmPutMsgToQueue(SVnodeMgmt *pMgmt, SRpcMsg *pMsg, EQueueType qtyp
break;
case WRITE_QUEUE:
if (!osDataSpaceAvailable()) {
- terrno = TSDB_CODE_VND_NO_DISKSPACE;
+ terrno = TSDB_CODE_NO_DISKSPACE;
code = terrno;
dError("vgId:%d, msg:%p put into vnode-write queue failed since %s", pVnode->vgId, pMsg, terrstr(code));
} else if ((pMsg->msgType == TDMT_VND_SUBMIT) && (grantCheck(TSDB_GRANT_STORAGE) != TSDB_CODE_SUCCESS)) {
@@ -234,7 +223,9 @@ static int32_t vmPutMsgToQueue(SVnodeMgmt *pMgmt, SRpcMsg *pMsg, EQueueType qtyp
return code;
}
-int32_t vmPutMsgToSyncCtrlQueue(SVnodeMgmt *pMgmt, SRpcMsg *pMsg) { return vmPutMsgToQueue(pMgmt, pMsg, SYNC_CTRL_QUEUE); }
+int32_t vmPutMsgToSyncCtrlQueue(SVnodeMgmt *pMgmt, SRpcMsg *pMsg) {
+ return vmPutMsgToQueue(pMgmt, pMsg, SYNC_CTRL_QUEUE);
+}
int32_t vmPutMsgToSyncQueue(SVnodeMgmt *pMgmt, SRpcMsg *pMsg) { return vmPutMsgToQueue(pMgmt, pMsg, SYNC_QUEUE); }
@@ -317,7 +308,7 @@ int32_t vmGetQueueSize(SVnodeMgmt *pMgmt, int32_t vgId, EQueueType qtype) {
int32_t vmAllocQueue(SVnodeMgmt *pMgmt, SVnodeObj *pVnode) {
pVnode->pWriteQ = tWWorkerAllocQueue(&pMgmt->writePool, pVnode->pImpl, (FItems)vnodeProposeWriteMsg);
pVnode->pSyncQ = tWWorkerAllocQueue(&pMgmt->syncPool, pVnode, (FItems)vmProcessSyncQueue);
- pVnode->pSyncCtrlQ = tWWorkerAllocQueue(&pMgmt->syncCtrlPool, pVnode, (FItems)vmProcessSyncCtrlQueue);
+ pVnode->pSyncCtrlQ = tWWorkerAllocQueue(&pMgmt->syncCtrlPool, pVnode, (FItems)vmProcessSyncQueue);
pVnode->pApplyQ = tWWorkerAllocQueue(&pMgmt->applyPool, pVnode->pImpl, (FItems)vnodeApplyWriteMsg);
pVnode->pQueryQ = tQWorkerAllocQueue(&pMgmt->queryPool, pVnode, (FItem)vmProcessQueryQueue);
pVnode->pStreamQ = tQWorkerAllocQueue(&pMgmt->streamPool, pVnode, (FItem)vmProcessStreamQueue);
diff --git a/source/dnode/mgmt/node_mgmt/src/dmEnv.c b/source/dnode/mgmt/node_mgmt/src/dmEnv.c
index a222ad3f7d..421d723202 100644
--- a/source/dnode/mgmt/node_mgmt/src/dmEnv.c
+++ b/source/dnode/mgmt/node_mgmt/src/dmEnv.c
@@ -71,17 +71,17 @@ static bool dmCheckDiskSpace() {
bool ret = true;
if (!osDataSpaceAvailable()) {
dError("data disk space unavailable, i.e. %s", tsDataDir);
- terrno = TSDB_CODE_VND_NO_DISKSPACE;
+ terrno = TSDB_CODE_NO_DISKSPACE;
ret = false;
}
if (!osLogSpaceAvailable()) {
dError("log disk space unavailable, i.e. %s", tsLogDir);
- terrno = TSDB_CODE_VND_NO_DISKSPACE;
+ terrno = TSDB_CODE_NO_DISKSPACE;
ret = false;
}
if (!osTempSpaceAvailable()) {
dError("temp disk space unavailable, i.e. %s", tsTempDir);
- terrno = TSDB_CODE_VND_NO_DISKSPACE;
+ terrno = TSDB_CODE_NO_DISKSPACE;
ret = false;
}
return ret;
diff --git a/source/dnode/mgmt/node_mgmt/src/dmTransport.c b/source/dnode/mgmt/node_mgmt/src/dmTransport.c
index 7ad24be258..1e5f3139aa 100644
--- a/source/dnode/mgmt/node_mgmt/src/dmTransport.c
+++ b/source/dnode/mgmt/node_mgmt/src/dmTransport.c
@@ -105,6 +105,7 @@ static void dmProcessRpcMsg(SDnode *pDnode, SRpcMsg *pRpc, SEpSet *pEpSet) {
}
if (IsReq(pRpc) && pRpc->pCont == NULL) {
+ dGError("msg:%p, type:%s pCont is NULL", pRpc, TMSG_INFO(pRpc->msgType));
terrno = TSDB_CODE_INVALID_MSG_LEN;
goto _OVER;
}
@@ -133,6 +134,7 @@ static void dmProcessRpcMsg(SDnode *pDnode, SRpcMsg *pRpc, SEpSet *pEpSet) {
break;
}
} else {
+ dGError("msg:%p, type:%s contLen is 0", pRpc, TMSG_INFO(pRpc->msgType));
terrno = TSDB_CODE_INVALID_MSG_LEN;
goto _OVER;
}
@@ -155,7 +157,11 @@ static void dmProcessRpcMsg(SDnode *pDnode, SRpcMsg *pRpc, SEpSet *pEpSet) {
_OVER:
if (code != 0) {
if (terrno != 0) code = terrno;
- dGTrace("msg:%p, failed to process since %s", pMsg, terrstr());
+ if (pMsg) {
+ dGTrace("msg:%p, failed to process %s since %s", pMsg, TMSG_INFO(pMsg->msgType), terrstr());
+ } else {
+ dGTrace("msg:%p, failed to process empty msg since %s", pMsg, terrstr());
+ }
if (IsReq(pRpc)) {
SRpcMsg rsp = {.code = code, .info = pRpc->info};
diff --git a/source/dnode/mgmt/node_util/src/dmUtil.c b/source/dnode/mgmt/node_util/src/dmUtil.c
index 80bb8debd2..648a9ab9ce 100644
--- a/source/dnode/mgmt/node_util/src/dmUtil.c
+++ b/source/dnode/mgmt/node_util/src/dmUtil.c
@@ -55,7 +55,7 @@ void *dmSetMgmtHandle(SArray *pArray, tmsg_t msgType, void *nodeMsgFp, bool need
}
void dmGetMonitorSystemInfo(SMonSysInfo *pInfo) {
- taosGetCpuUsage(&pInfo->cpu_engine, &pInfo->cpu_system);
+ taosGetCpuUsage(&pInfo->cpu_system, &pInfo->cpu_engine);
taosGetCpuCores(&pInfo->cpu_cores);
taosGetProcMemory(&pInfo->mem_engine);
taosGetSysMemory(&pInfo->mem_system);
diff --git a/source/dnode/mnode/impl/inc/mndInt.h b/source/dnode/mnode/impl/inc/mndInt.h
index ad2a3ec447..a0f3c98f83 100644
--- a/source/dnode/mnode/impl/inc/mndInt.h
+++ b/source/dnode/mnode/impl/inc/mndInt.h
@@ -20,7 +20,6 @@
#include "sdb.h"
#include "sync.h"
-#include "syncTools.h"
#include "tcache.h"
#include "tdatablock.h"
#include "tglobal.h"
@@ -90,7 +89,6 @@ typedef struct {
int32_t errCode;
int32_t transId;
SRWLatch lock;
- int8_t leaderTransferFinish;
int8_t selfIndex;
int8_t numOfReplicas;
SReplica replicas[TSDB_MAX_REPLICA];
diff --git a/source/dnode/mnode/impl/inc/mndMnode.h b/source/dnode/mnode/impl/inc/mndMnode.h
index a433af9947..320d3651f0 100644
--- a/source/dnode/mnode/impl/inc/mndMnode.h
+++ b/source/dnode/mnode/impl/inc/mndMnode.h
@@ -28,7 +28,7 @@ SMnodeObj *mndAcquireMnode(SMnode *pMnode, int32_t mnodeId);
void mndReleaseMnode(SMnode *pMnode, SMnodeObj *pObj);
bool mndIsMnode(SMnode *pMnode, int32_t dnodeId);
void mndGetMnodeEpSet(SMnode *pMnode, SEpSet *pEpSet);
-int32_t mndSetDropMnodeInfoToTrans(SMnode *pMnode, STrans *pTrans, SMnodeObj *pObj);
+int32_t mndSetDropMnodeInfoToTrans(SMnode *pMnode, STrans *pTrans, SMnodeObj *pObj, bool force);
#ifdef __cplusplus
}
diff --git a/source/dnode/mnode/impl/inc/mndQnode.h b/source/dnode/mnode/impl/inc/mndQnode.h
index 17615500c4..36eebd3157 100644
--- a/source/dnode/mnode/impl/inc/mndQnode.h
+++ b/source/dnode/mnode/impl/inc/mndQnode.h
@@ -29,7 +29,7 @@ void mndCleanupQnode(SMnode *pMnode);
SQnodeObj *mndAcquireQnode(SMnode *pMnode, int32_t qnodeId);
void mndReleaseQnode(SMnode *pMnode, SQnodeObj *pObj);
int32_t mndCreateQnodeList(SMnode *pMnode, SArray **pList, int32_t limit);
-int32_t mndSetDropQnodeInfoToTrans(SMnode *pMnode, STrans *pTrans, SQnodeObj *pObj);
+int32_t mndSetDropQnodeInfoToTrans(SMnode *pMnode, STrans *pTrans, SQnodeObj *pObj, bool force);
#ifdef __cplusplus
}
diff --git a/source/dnode/mnode/impl/inc/mndSnode.h b/source/dnode/mnode/impl/inc/mndSnode.h
index ec7bb02ca7..342bc23712 100644
--- a/source/dnode/mnode/impl/inc/mndSnode.h
+++ b/source/dnode/mnode/impl/inc/mndSnode.h
@@ -27,7 +27,7 @@ void mndCleanupSnode(SMnode *pMnode);
SSnodeObj *mndAcquireSnode(SMnode *pMnode, int32_t qnodeId);
void mndReleaseSnode(SMnode *pMnode, SSnodeObj *pObj);
SEpSet mndAcquireEpFromSnode(SMnode *pMnode, const SSnodeObj *pSnode);
-int32_t mndSetDropSnodeInfoToTrans(SMnode *pMnode, STrans *pTrans, SSnodeObj *pObj);
+int32_t mndSetDropSnodeInfoToTrans(SMnode *pMnode, STrans *pTrans, SSnodeObj *pObj, bool force);
#ifdef __cplusplus
}
diff --git a/source/dnode/mnode/impl/inc/mndVgroup.h b/source/dnode/mnode/impl/inc/mndVgroup.h
index 76c3519808..94469899fc 100644
--- a/source/dnode/mnode/impl/inc/mndVgroup.h
+++ b/source/dnode/mnode/impl/inc/mndVgroup.h
@@ -42,8 +42,7 @@ int32_t mndAddCreateVnodeAction(SMnode *, STrans *pTrans, SDbObj *pDb, SVgObj *p
int32_t mndAddAlterVnodeConfirmAction(SMnode *, STrans *pTrans, SDbObj *pDb, SVgObj *pVgroup);
int32_t mndAddAlterVnodeAction(SMnode *, STrans *pTrans, SDbObj *pDb, SVgObj *pVgroup, tmsg_t msgType);
int32_t mndAddDropVnodeAction(SMnode *, STrans *pTrans, SDbObj *pDb, SVgObj *pVgroup, SVnodeGid *pVgid, bool isRedo);
-int32_t mndSetMoveVgroupInfoToTrans(SMnode *, STrans *pTrans, SDbObj *pDb, SVgObj *pVgroup, int32_t vn, SArray *pArray);
-int32_t mndSetMoveVgroupsInfoToTrans(SMnode *, STrans *pTrans, int32_t dropDnodeId);
+int32_t mndSetMoveVgroupsInfoToTrans(SMnode *, STrans *pTrans, int32_t dropDnodeId, bool force);
int32_t mndBuildAlterVgroupAction(SMnode *pMnode, STrans *pTrans, SDbObj *pOldDb, SDbObj *pNewDb, SVgObj *pVgroup,
SArray *pArray);
diff --git a/source/dnode/mnode/impl/src/mndConsumer.c b/source/dnode/mnode/impl/src/mndConsumer.c
index fa3651c7d7..df999316eb 100644
--- a/source/dnode/mnode/impl/src/mndConsumer.c
+++ b/source/dnode/mnode/impl/src/mndConsumer.c
@@ -63,12 +63,12 @@ int32_t mndInitConsumer(SMnode *pMnode) {
.deleteFp = (SdbDeleteFp)mndConsumerActionDelete,
};
- mndSetMsgHandle(pMnode, TDMT_MND_SUBSCRIBE, mndProcessSubscribeReq);
- mndSetMsgHandle(pMnode, TDMT_MND_MQ_HB, mndProcessMqHbReq);
- mndSetMsgHandle(pMnode, TDMT_MND_MQ_ASK_EP, mndProcessAskEpReq);
- mndSetMsgHandle(pMnode, TDMT_MND_MQ_TIMER, mndProcessMqTimerMsg);
- mndSetMsgHandle(pMnode, TDMT_MND_MQ_CONSUMER_LOST, mndProcessConsumerLostMsg);
- mndSetMsgHandle(pMnode, TDMT_MND_MQ_CONSUMER_RECOVER, mndProcessConsumerRecoverMsg);
+ mndSetMsgHandle(pMnode, TDMT_MND_TMQ_SUBSCRIBE, mndProcessSubscribeReq);
+ mndSetMsgHandle(pMnode, TDMT_MND_TMQ_HB, mndProcessMqHbReq);
+ mndSetMsgHandle(pMnode, TDMT_MND_TMQ_ASK_EP, mndProcessAskEpReq);
+ mndSetMsgHandle(pMnode, TDMT_MND_TMQ_TIMER, mndProcessMqTimerMsg);
+ mndSetMsgHandle(pMnode, TDMT_MND_TMQ_CONSUMER_LOST, mndProcessConsumerLostMsg);
+ mndSetMsgHandle(pMnode, TDMT_MND_TMQ_CONSUMER_RECOVER, mndProcessConsumerRecoverMsg);
mndAddShowRetrieveHandle(pMnode, TSDB_MGMT_TABLE_CONSUMERS, mndRetrieveConsumer);
mndAddShowFreeIterHandle(pMnode, TSDB_MGMT_TABLE_CONSUMERS, mndCancelGetNextConsumer);
@@ -207,7 +207,7 @@ static int32_t mndProcessMqTimerMsg(SRpcMsg *pMsg) {
pLostMsg->consumerId = pConsumer->consumerId;
SRpcMsg pRpcMsg = {
- .msgType = TDMT_MND_MQ_CONSUMER_LOST,
+ .msgType = TDMT_MND_TMQ_CONSUMER_LOST,
.pCont = pLostMsg,
.contLen = sizeof(SMqConsumerLostMsg),
};
@@ -256,7 +256,7 @@ static int32_t mndProcessMqTimerMsg(SRpcMsg *pMsg) {
if (taosHashGetSize(pRebMsg->rebSubHash) != 0) {
mInfo("mq rebalance will be triggered");
SRpcMsg rpcMsg = {
- .msgType = TDMT_MND_MQ_DO_REBALANCE,
+ .msgType = TDMT_MND_TMQ_DO_REBALANCE,
.pCont = pRebMsg,
.contLen = sizeof(SMqDoRebalanceMsg),
};
@@ -292,7 +292,7 @@ static int32_t mndProcessMqHbReq(SRpcMsg *pMsg) {
pRecoverMsg->consumerId = consumerId;
SRpcMsg pRpcMsg = {
- .msgType = TDMT_MND_MQ_CONSUMER_RECOVER,
+ .msgType = TDMT_MND_TMQ_CONSUMER_RECOVER,
.pCont = pRecoverMsg,
.contLen = sizeof(SMqConsumerRecoverMsg),
};
@@ -331,7 +331,7 @@ static int32_t mndProcessAskEpReq(SRpcMsg *pMsg) {
pRecoverMsg->consumerId = consumerId;
SRpcMsg pRpcMsg = {
- .msgType = TDMT_MND_MQ_CONSUMER_RECOVER,
+ .msgType = TDMT_MND_TMQ_CONSUMER_RECOVER,
.pCont = pRecoverMsg,
.contLen = sizeof(SMqConsumerRecoverMsg),
};
diff --git a/source/dnode/mnode/impl/src/mndDnode.c b/source/dnode/mnode/impl/src/mndDnode.c
index 5307117533..04f340b0ff 100644
--- a/source/dnode/mnode/impl/src/mndDnode.c
+++ b/source/dnode/mnode/impl/src/mndDnode.c
@@ -345,6 +345,19 @@ static int32_t mndProcessStatusReq(SRpcMsg *pReq) {
}
}
+ int64_t dnodeVer = sdbGetTableVer(pMnode->pSdb, SDB_DNODE) + sdbGetTableVer(pMnode->pSdb, SDB_MNODE);
+ int64_t curMs = taosGetTimestampMs();
+ bool online = mndIsDnodeOnline(pDnode, curMs);
+ bool dnodeChanged = (statusReq.dnodeVer == 0) || (statusReq.dnodeVer != dnodeVer);
+ bool reboot = (pDnode->rebootTime != statusReq.rebootTime);
+ bool needCheck = !online || dnodeChanged || reboot;
+
+ pDnode->accessTimes++;
+ pDnode->lastAccessTime = curMs;
+ const STraceId *trace = &pReq->info.traceId;
+ mGTrace("dnode:%d, status received, accessTimes:%d check:%d online:%d reboot:%d changed:%d statusSeq:%d", pDnode->id,
+ pDnode->accessTimes, needCheck, online, reboot, dnodeChanged, statusReq.statusSeq);
+
for (int32_t v = 0; v < taosArrayGetSize(statusReq.pVloads); ++v) {
SVnodeLoad *pVload = taosArrayGet(statusReq.pVloads, v);
@@ -396,13 +409,6 @@ static int32_t mndProcessStatusReq(SRpcMsg *pReq) {
mndReleaseQnode(pMnode, pQnode);
}
- int64_t dnodeVer = sdbGetTableVer(pMnode->pSdb, SDB_DNODE) + sdbGetTableVer(pMnode->pSdb, SDB_MNODE);
- int64_t curMs = taosGetTimestampMs();
- bool online = mndIsDnodeOnline(pDnode, curMs);
- bool dnodeChanged = (statusReq.dnodeVer == 0) || (statusReq.dnodeVer != dnodeVer);
- bool reboot = (pDnode->rebootTime != statusReq.rebootTime);
- bool needCheck = !online || dnodeChanged || reboot;
-
if (needCheck) {
if (statusReq.sver != tsVersion) {
if (pDnode != NULL) {
@@ -424,9 +430,6 @@ static int32_t mndProcessStatusReq(SRpcMsg *pReq) {
pMnode->clusterId);
terrno = TSDB_CODE_MND_INVALID_CLUSTER_ID;
goto _OVER;
- } else {
- pDnode->accessTimes++;
- mDebug("dnode:%d, status received, access times %d", pDnode->id, pDnode->accessTimes);
}
}
@@ -453,6 +456,7 @@ static int32_t mndProcessStatusReq(SRpcMsg *pReq) {
pDnode->memTotal = statusReq.memTotal;
SStatusRsp statusRsp = {0};
+ statusRsp.statusSeq++;
statusRsp.dnodeVer = dnodeVer;
statusRsp.dnodeCfg.dnodeId = pDnode->id;
statusRsp.dnodeCfg.clusterId = pMnode->clusterId;
@@ -473,8 +477,6 @@ static int32_t mndProcessStatusReq(SRpcMsg *pReq) {
pReq->info.rsp = pHead;
}
- pDnode->lastAccessTime = curMs;
- pDnode->accessTimes++;
code = 0;
_OVER:
@@ -670,7 +672,7 @@ _OVER:
}
static int32_t mndDropDnode(SMnode *pMnode, SRpcMsg *pReq, SDnodeObj *pDnode, SMnodeObj *pMObj, SQnodeObj *pQObj,
- SSnodeObj *pSObj, int32_t numOfVnodes) {
+ SSnodeObj *pSObj, int32_t numOfVnodes, bool force) {
int32_t code = -1;
SSdbRaw *pRaw = NULL;
STrans *pTrans = NULL;
@@ -678,7 +680,7 @@ static int32_t mndDropDnode(SMnode *pMnode, SRpcMsg *pReq, SDnodeObj *pDnode, SM
pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_GLOBAL, pReq, "drop-dnode");
if (pTrans == NULL) goto _OVER;
mndTransSetSerial(pTrans);
- mInfo("trans:%d, used to drop dnode:%d", pTrans->id, pDnode->id);
+ mInfo("trans:%d, used to drop dnode:%d, force:%d", pTrans->id, pDnode->id, force);
pRaw = mndDnodeActionEncode(pDnode);
if (pRaw == NULL) goto _OVER;
@@ -694,22 +696,22 @@ static int32_t mndDropDnode(SMnode *pMnode, SRpcMsg *pReq, SDnodeObj *pDnode, SM
if (pMObj != NULL) {
mInfo("trans:%d, mnode on dnode:%d will be dropped", pTrans->id, pDnode->id);
- if (mndSetDropMnodeInfoToTrans(pMnode, pTrans, pMObj) != 0) goto _OVER;
+ if (mndSetDropMnodeInfoToTrans(pMnode, pTrans, pMObj, force) != 0) goto _OVER;
}
if (pQObj != NULL) {
mInfo("trans:%d, qnode on dnode:%d will be dropped", pTrans->id, pDnode->id);
- if (mndSetDropQnodeInfoToTrans(pMnode, pTrans, pQObj) != 0) goto _OVER;
+ if (mndSetDropQnodeInfoToTrans(pMnode, pTrans, pQObj, force) != 0) goto _OVER;
}
if (pSObj != NULL) {
mInfo("trans:%d, snode on dnode:%d will be dropped", pTrans->id, pDnode->id);
- if (mndSetDropSnodeInfoToTrans(pMnode, pTrans, pSObj) != 0) goto _OVER;
+ if (mndSetDropSnodeInfoToTrans(pMnode, pTrans, pSObj, force) != 0) goto _OVER;
}
if (numOfVnodes > 0) {
mInfo("trans:%d, %d vnodes on dnode:%d will be dropped", pTrans->id, numOfVnodes, pDnode->id);
- if (mndSetMoveVgroupsInfoToTrans(pMnode, pTrans, pDnode->id) != 0) goto _OVER;
+ if (mndSetMoveVgroupsInfoToTrans(pMnode, pTrans, pDnode->id, force) != 0) goto _OVER;
}
if (mndTransPrepare(pMnode, pTrans) != 0) goto _OVER;
@@ -767,16 +769,16 @@ static int32_t mndProcessDropDnodeReq(SRpcMsg *pReq) {
}
int32_t numOfVnodes = mndGetVnodesNum(pMnode, pDnode->id);
- if (numOfVnodes > 0 || pMObj != NULL) {
+ if ((numOfVnodes > 0 || pMObj != NULL || pSObj != NULL || pQObj != NULL) && !dropReq.force) {
if (!mndIsDnodeOnline(pDnode, taosGetTimestampMs())) {
terrno = TSDB_CODE_NODE_OFFLINE;
- mError("dnode:%d, failed to drop since %s, has_mnode:%d numOfVnodes:%d", pDnode->id, terrstr(), pMObj != NULL,
- numOfVnodes);
+ mError("dnode:%d, failed to drop since %s, vnodes:%d mnode:%d qnode:%d snode:%d", pDnode->id, terrstr(),
+ numOfVnodes, pMObj != NULL, pQObj != NULL, pSObj != NULL);
goto _OVER;
}
}
- code = mndDropDnode(pMnode, pReq, pDnode, pMObj, pQObj, pSObj, numOfVnodes);
+ code = mndDropDnode(pMnode, pReq, pDnode, pMObj, pQObj, pSObj, numOfVnodes, dropReq.force);
if (code == 0) code = TSDB_CODE_ACTION_IN_PROGRESS;
_OVER:
diff --git a/source/dnode/mnode/impl/src/mndMain.c b/source/dnode/mnode/impl/src/mndMain.c
index 7207343582..1b2d85bd29 100644
--- a/source/dnode/mnode/impl/src/mndMain.c
+++ b/source/dnode/mnode/impl/src/mndMain.c
@@ -105,7 +105,7 @@ static void mndCalMqRebalance(SMnode *pMnode) {
int32_t contLen = 0;
void *pReq = mndBuildTimerMsg(&contLen);
if (pReq != NULL) {
- SRpcMsg rpcMsg = {.msgType = TDMT_MND_MQ_TIMER, .pCont = pReq, .contLen = contLen};
+ SRpcMsg rpcMsg = {.msgType = TDMT_MND_TMQ_TIMER, .pCont = pReq, .contLen = contLen};
tmsgPutToQueue(&pMnode->msgCb, READ_QUEUE, &rpcMsg);
}
}
@@ -428,18 +428,8 @@ SMnode *mndOpen(const char *path, const SMnodeOpt *pOption) {
void mndPreClose(SMnode *pMnode) {
if (pMnode != NULL) {
- atomic_store_8(&(pMnode->syncMgmt.leaderTransferFinish), 0);
syncLeaderTransfer(pMnode->syncMgmt.sync);
-
-#if 0
- mInfo("vgId:1, mnode start leader transfer");
- // wait for leader transfer finish
- while (!atomic_load_8(&(pMnode->syncMgmt.leaderTransferFinish))) {
- taosMsleep(10);
- mInfo("vgId:1, mnode waiting for leader transfer");
- }
- mInfo("vgId:1, mnode finish leader transfer");
-#endif
+ syncPreStop(pMnode->syncMgmt.sync);
}
}
@@ -474,128 +464,18 @@ void mndStop(SMnode *pMnode) {
mndCleanupTimer(pMnode);
}
-int32_t mndProcessSyncCtrlMsg(SRpcMsg *pMsg) {
- SMnode *pMnode = pMsg->info.node;
- SSyncMgmt *pMgmt = &pMnode->syncMgmt;
- int32_t code = 0;
-
- mInfo("vgId:%d, process sync ctrl msg", 1);
-
- if (!syncEnvIsStart()) {
- mError("failed to process sync msg:%p type:%s since syncEnv stop", pMsg, TMSG_INFO(pMsg->msgType));
- terrno = TSDB_CODE_SYN_INTERNAL_ERROR;
- return -1;
- }
-
- SSyncNode *pSyncNode = syncNodeAcquire(pMgmt->sync);
- if (pSyncNode == NULL) {
- mError("failed to process sync msg:%p type:%s since syncNode is null", pMsg, TMSG_INFO(pMsg->msgType));
- terrno = TSDB_CODE_SYN_INTERNAL_ERROR;
- return -1;
- }
-
- if (pMsg->msgType == TDMT_SYNC_HEARTBEAT) {
- SyncHeartbeat *pSyncMsg = syncHeartbeatFromRpcMsg2(pMsg);
- code = syncNodeOnHeartbeat(pSyncNode, pSyncMsg);
- syncHeartbeatDestroy(pSyncMsg);
-
- } else if (pMsg->msgType == TDMT_SYNC_HEARTBEAT_REPLY) {
- SyncHeartbeatReply *pSyncMsg = syncHeartbeatReplyFromRpcMsg2(pMsg);
- code = syncNodeOnHeartbeatReply(pSyncNode, pSyncMsg);
- syncHeartbeatReplyDestroy(pSyncMsg);
- }
-
- syncNodeRelease(pSyncNode);
-
- if (code != 0) {
- terrno = TSDB_CODE_SYN_INTERNAL_ERROR;
- }
- return code;
-}
-
int32_t mndProcessSyncMsg(SRpcMsg *pMsg) {
SMnode *pMnode = pMsg->info.node;
SSyncMgmt *pMgmt = &pMnode->syncMgmt;
- int32_t code = 0;
- if (!syncEnvIsStart()) {
- mError("failed to process sync msg:%p type:%s since syncEnv stop", pMsg, TMSG_INFO(pMsg->msgType));
- terrno = TSDB_CODE_SYN_INTERNAL_ERROR;
- return -1;
- }
-
- SSyncNode *pSyncNode = syncNodeAcquire(pMgmt->sync);
- if (pSyncNode == NULL) {
- mError("failed to process sync msg:%p type:%s since syncNode is null", pMsg, TMSG_INFO(pMsg->msgType));
- terrno = TSDB_CODE_SYN_INTERNAL_ERROR;
- return -1;
- }
-
- if (pMsg->msgType == TDMT_SYNC_TIMEOUT) {
- SyncTimeout *pSyncMsg = syncTimeoutFromRpcMsg2(pMsg);
- code = syncNodeOnTimer(pSyncNode, pSyncMsg);
- syncTimeoutDestroy(pSyncMsg);
-
- } else if (pMsg->msgType == TDMT_SYNC_PING) {
- SyncPing *pSyncMsg = syncPingFromRpcMsg2(pMsg);
- code = syncNodeOnPing(pSyncNode, pSyncMsg);
- syncPingDestroy(pSyncMsg);
-
- } else if (pMsg->msgType == TDMT_SYNC_PING_REPLY) {
- SyncPingReply *pSyncMsg = syncPingReplyFromRpcMsg2(pMsg);
- code = syncNodeOnPingReply(pSyncNode, pSyncMsg);
- syncPingReplyDestroy(pSyncMsg);
-
- } else if (pMsg->msgType == TDMT_SYNC_CLIENT_REQUEST) {
- SyncClientRequest *pSyncMsg = syncClientRequestFromRpcMsg2(pMsg);
- code = syncNodeOnClientRequest(pSyncNode, pSyncMsg, NULL);
- syncClientRequestDestroy(pSyncMsg);
-
- } else if (pMsg->msgType == TDMT_SYNC_REQUEST_VOTE) {
- SyncRequestVote *pSyncMsg = syncRequestVoteFromRpcMsg2(pMsg);
- code = syncNodeOnRequestVote(pSyncNode, pSyncMsg);
- syncRequestVoteDestroy(pSyncMsg);
-
- } else if (pMsg->msgType == TDMT_SYNC_REQUEST_VOTE_REPLY) {
- SyncRequestVoteReply *pSyncMsg = syncRequestVoteReplyFromRpcMsg2(pMsg);
- code = syncNodeOnRequestVoteReply(pSyncNode, pSyncMsg);
- syncRequestVoteReplyDestroy(pSyncMsg);
-
- } else if (pMsg->msgType == TDMT_SYNC_APPEND_ENTRIES) {
- SyncAppendEntries *pSyncMsg = syncAppendEntriesFromRpcMsg2(pMsg);
- code = syncNodeOnAppendEntries(pSyncNode, pSyncMsg);
- syncAppendEntriesDestroy(pSyncMsg);
-
- } else if (pMsg->msgType == TDMT_SYNC_APPEND_ENTRIES_REPLY) {
- SyncAppendEntriesReply *pSyncMsg = syncAppendEntriesReplyFromRpcMsg2(pMsg);
- code = syncNodeOnAppendEntriesReply(pSyncNode, pSyncMsg);
- syncAppendEntriesReplyDestroy(pSyncMsg);
-
- } else if (pMsg->msgType == TDMT_SYNC_SNAPSHOT_SEND) {
- SyncSnapshotSend *pSyncMsg = syncSnapshotSendFromRpcMsg2(pMsg);
- code = syncNodeOnSnapshot(pSyncNode, pSyncMsg);
- syncSnapshotSendDestroy(pSyncMsg);
-
- } else if (pMsg->msgType == TDMT_SYNC_SNAPSHOT_RSP) {
- SyncSnapshotRsp *pSyncMsg = syncSnapshotRspFromRpcMsg2(pMsg);
- code = syncNodeOnSnapshotReply(pSyncNode, pSyncMsg);
- syncSnapshotRspDestroy(pSyncMsg);
-
- } else if (pMsg->msgType == TDMT_SYNC_SET_MNODE_STANDBY) {
- code = syncSetStandby(pMgmt->sync);
- SRpcMsg rsp = {.code = code, .info = pMsg->info};
- tmsgSendRsp(&rsp);
-
- } else {
- mError("failed to process msg:%p since invalid type:%s", pMsg, TMSG_INFO(pMsg->msgType));
- code = -1;
- }
-
- syncNodeRelease(pSyncNode);
+ const STraceId *trace = &pMsg->info.traceId;
+ mGTrace("vgId:1, sync msg:%p will be processed, type:%s", pMsg, TMSG_INFO(pMsg->msgType));
+ int32_t code = syncProcessMsg(pMgmt->sync, pMsg);
if (code != 0) {
- terrno = TSDB_CODE_SYN_INTERNAL_ERROR;
+ mGError("vgId:1, failed to process sync msg:%p type:%s since %s", pMsg, TMSG_INFO(pMsg->msgType), terrstr());
}
+
return code;
}
@@ -608,14 +488,14 @@ static int32_t mndCheckMnodeState(SRpcMsg *pMsg) {
}
if (mndAcquireRpc(pMsg->info.node) == 0) return 0;
- SMnode *pMnode = pMsg->info.node;
- const char *role = syncGetMyRoleStr(pMnode->syncMgmt.sync);
- bool restored = syncIsRestoreFinish(pMnode->syncMgmt.sync);
- if (pMsg->msgType == TDMT_MND_MQ_TIMER || pMsg->msgType == TDMT_MND_TELEM_TIMER ||
+ SMnode *pMnode = pMsg->info.node;
+ SSyncState state = syncGetState(pMnode->syncMgmt.sync);
+
+ if (pMsg->msgType == TDMT_MND_TMQ_TIMER || pMsg->msgType == TDMT_MND_TELEM_TIMER ||
pMsg->msgType == TDMT_MND_TRANS_TIMER || pMsg->msgType == TDMT_MND_TTL_TIMER ||
pMsg->msgType == TDMT_MND_UPTIME_TIMER) {
mTrace("timer not process since mnode restored:%d stopped:%d, sync restored:%d role:%s ", pMnode->restored,
- pMnode->stopped, restored, role);
+ pMnode->stopped, state.restored, syncStr(state.restored));
return -1;
}
@@ -626,8 +506,8 @@ static int32_t mndCheckMnodeState(SRpcMsg *pMsg) {
mDebug(
"msg:%p, type:%s failed to process since %s, mnode restored:%d stopped:%d, sync restored:%d "
"role:%s, redirect numOfEps:%d inUse:%d",
- pMsg, TMSG_INFO(pMsg->msgType), terrstr(), pMnode->restored, pMnode->stopped, restored, role, epSet.numOfEps,
- epSet.inUse);
+ pMsg, TMSG_INFO(pMsg->msgType), terrstr(), pMnode->restored, pMnode->stopped, state.restored,
+ syncStr(state.restored), epSet.numOfEps, epSet.inUse);
if (epSet.numOfEps > 0) {
for (int32_t i = 0; i < epSet.numOfEps; ++i) {
@@ -850,8 +730,9 @@ int32_t mndGetMonitorInfo(SMnode *pMnode, SMonClusterInfo *pClusterInfo, SMonVgr
}
int32_t mndGetLoad(SMnode *pMnode, SMnodeLoad *pLoad) {
- pLoad->syncState = syncGetMyRole(pMnode->syncMgmt.sync);
- pLoad->syncRestore = pMnode->restored;
+ SSyncState state = syncGetState(pMnode->syncMgmt.sync);
+ pLoad->syncState = state.state;
+ pLoad->syncRestore = state.restored;
mTrace("mnode current syncState is %s, syncRestore:%d", syncStr(pLoad->syncState), pLoad->syncRestore);
return 0;
}
diff --git a/source/dnode/mnode/impl/src/mndMnode.c b/source/dnode/mnode/impl/src/mndMnode.c
index 5889a162f8..563b3cd3cf 100644
--- a/source/dnode/mnode/impl/src/mndMnode.c
+++ b/source/dnode/mnode/impl/src/mndMnode.c
@@ -472,7 +472,8 @@ static int32_t mndSetDropMnodeCommitLogs(SMnode *pMnode, STrans *pTrans, SMnodeO
return 0;
}
-static int32_t mndSetDropMnodeRedoActions(SMnode *pMnode, STrans *pTrans, SDnodeObj *pDnode, SMnodeObj *pObj) {
+static int32_t mndSetDropMnodeRedoActions(SMnode *pMnode, STrans *pTrans, SDnodeObj *pDnode, SMnodeObj *pObj,
+ bool force) {
SSdb *pSdb = pMnode->pSdb;
void *pIter = NULL;
SDDropMnodeReq dropReq = {0};
@@ -485,12 +486,21 @@ static int32_t mndSetDropMnodeRedoActions(SMnode *pMnode, STrans *pTrans, SDnode
int32_t totalMnodes = sdbGetSize(pSdb, SDB_MNODE);
if (totalMnodes == 2) {
+ if (force) {
+ mError("cant't force drop dnode, since a mnode on it and replica is 2");
+ terrno = TSDB_CODE_NODE_OFFLINE;
+ return -1;
+ }
mInfo("vgId:1, has %d mnodes, exec redo log first", totalMnodes);
if (mndSetDropMnodeRedoLogs(pMnode, pTrans, pObj) != 0) return -1;
- if (mndBuildDropMnodeRedoAction(pTrans, &dropReq, &dropEpSet) != 0) return -1;
+ if (!force) {
+ if (mndBuildDropMnodeRedoAction(pTrans, &dropReq, &dropEpSet) != 0) return -1;
+ }
} else if (totalMnodes == 3) {
mInfo("vgId:1, has %d mnodes, exec redo action first", totalMnodes);
- if (mndBuildDropMnodeRedoAction(pTrans, &dropReq, &dropEpSet) != 0) return -1;
+ if (!force) {
+ if (mndBuildDropMnodeRedoAction(pTrans, &dropReq, &dropEpSet) != 0) return -1;
+ }
if (mndSetDropMnodeRedoLogs(pMnode, pTrans, pObj) != 0) return -1;
} else {
return -1;
@@ -499,9 +509,9 @@ static int32_t mndSetDropMnodeRedoActions(SMnode *pMnode, STrans *pTrans, SDnode
return 0;
}
-int32_t mndSetDropMnodeInfoToTrans(SMnode *pMnode, STrans *pTrans, SMnodeObj *pObj) {
+int32_t mndSetDropMnodeInfoToTrans(SMnode *pMnode, STrans *pTrans, SMnodeObj *pObj, bool force) {
if (pObj == NULL) return 0;
- if (mndSetDropMnodeRedoActions(pMnode, pTrans, pObj->pDnode, pObj) != 0) return -1;
+ if (mndSetDropMnodeRedoActions(pMnode, pTrans, pObj->pDnode, pObj, force) != 0) return -1;
if (mndSetDropMnodeCommitLogs(pMnode, pTrans, pObj) != 0) return -1;
return 0;
}
@@ -515,7 +525,7 @@ static int32_t mndDropMnode(SMnode *pMnode, SRpcMsg *pReq, SMnodeObj *pObj) {
mndTransSetSerial(pTrans);
mInfo("trans:%d, used to drop mnode:%d", pTrans->id, pObj->id);
- if (mndSetDropMnodeInfoToTrans(pMnode, pTrans, pObj) != 0) goto _OVER;
+ if (mndSetDropMnodeInfoToTrans(pMnode, pTrans, pObj, false) != 0) goto _OVER;
if (mndTransPrepare(pMnode, pTrans) != 0) goto _OVER;
code = 0;
@@ -743,7 +753,7 @@ static void mndReloadSyncConfig(SMnode *pMnode) {
mInfo("vgId:1, mnode sync not reconfig since readyMnodes:%d updatingMnodes:%d", readyMnodes, updatingMnodes);
return;
}
- // ASSERT(0);
+ // ASSERT(0);
if (cfg.myIndex == -1) {
#if 1
diff --git a/source/dnode/mnode/impl/src/mndQnode.c b/source/dnode/mnode/impl/src/mndQnode.c
index 70f9b35312..434e6fbc52 100644
--- a/source/dnode/mnode/impl/src/mndQnode.c
+++ b/source/dnode/mnode/impl/src/mndQnode.c
@@ -353,11 +353,13 @@ static int32_t mndSetDropQnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, SQn
return 0;
}
-int32_t mndSetDropQnodeInfoToTrans(SMnode *pMnode, STrans *pTrans, SQnodeObj *pObj) {
+int32_t mndSetDropQnodeInfoToTrans(SMnode *pMnode, STrans *pTrans, SQnodeObj *pObj, bool force) {
if (pObj == NULL) return 0;
if (mndSetDropQnodeRedoLogs(pTrans, pObj) != 0) return -1;
if (mndSetDropQnodeCommitLogs(pTrans, pObj) != 0) return -1;
- if (mndSetDropQnodeRedoActions(pTrans, pObj->pDnode, pObj) != 0) return -1;
+ if (!force) {
+ if (mndSetDropQnodeRedoActions(pTrans, pObj->pDnode, pObj) != 0) return -1;
+ }
return 0;
}
@@ -368,7 +370,7 @@ static int32_t mndDropQnode(SMnode *pMnode, SRpcMsg *pReq, SQnodeObj *pObj) {
if (pTrans == NULL) goto _OVER;
mInfo("trans:%d, used to drop qnode:%d", pTrans->id, pObj->id);
- if (mndSetDropQnodeInfoToTrans(pMnode, pTrans, pObj) != 0) goto _OVER;
+ if (mndSetDropQnodeInfoToTrans(pMnode, pTrans, pObj, false) != 0) goto _OVER;
if (mndTransPrepare(pMnode, pTrans) != 0) goto _OVER;
code = 0;
diff --git a/source/dnode/mnode/impl/src/mndQuery.c b/source/dnode/mnode/impl/src/mndQuery.c
index 3e4c8005b4..ca69d0c71c 100644
--- a/source/dnode/mnode/impl/src/mndQuery.c
+++ b/source/dnode/mnode/impl/src/mndQuery.c
@@ -55,7 +55,7 @@ int32_t mndProcessQueryMsg(SRpcMsg *pMsg) {
code = qWorkerProcessHbMsg(pMnode, pMnode->pQuery, pMsg, 0);
break;
default:
- terrno = TSDB_CODE_VND_APP_ERROR;
+ terrno = TSDB_CODE_APP_ERROR;
mError("unknown msg type:%d in query queue", pMsg->msgType);
}
@@ -92,7 +92,7 @@ int32_t mndProcessBatchMetaMsg(SRpcMsg *pMsg) {
for (int32_t i = 0; i < msgNum; ++i) {
if (offset >= pMsg->contLen) {
mError("offset %d is bigger than contLen %d", offset, pMsg->contLen);
- terrno = TSDB_CODE_MSG_NOT_PROCESSED;
+ terrno = TSDB_CODE_INVALID_MSG_LEN;
taosArrayDestroy(batchRsp);
return -1;
}
@@ -101,7 +101,7 @@ int32_t mndProcessBatchMetaMsg(SRpcMsg *pMsg) {
offset += sizeof(req.msgIdx);
if (offset >= pMsg->contLen) {
mError("offset %d is bigger than contLen %d", offset, pMsg->contLen);
- terrno = TSDB_CODE_MSG_NOT_PROCESSED;
+ terrno = TSDB_CODE_INVALID_MSG_LEN;
taosArrayDestroy(batchRsp);
return -1;
}
@@ -110,7 +110,7 @@ int32_t mndProcessBatchMetaMsg(SRpcMsg *pMsg) {
offset += sizeof(req.msgType);
if (offset >= pMsg->contLen) {
mError("offset %d is bigger than contLen %d", offset, pMsg->contLen);
- terrno = TSDB_CODE_MSG_NOT_PROCESSED;
+ terrno = TSDB_CODE_INVALID_MSG_LEN;
taosArrayDestroy(batchRsp);
return -1;
}
@@ -119,7 +119,7 @@ int32_t mndProcessBatchMetaMsg(SRpcMsg *pMsg) {
offset += sizeof(req.msgLen);
if (offset >= pMsg->contLen) {
mError("offset %d is bigger than contLen %d", offset, pMsg->contLen);
- terrno = TSDB_CODE_MSG_NOT_PROCESSED;
+ terrno = TSDB_CODE_INVALID_MSG_LEN;
taosArrayDestroy(batchRsp);
return -1;
}
diff --git a/source/dnode/mnode/impl/src/mndScheduler.c b/source/dnode/mnode/impl/src/mndScheduler.c
index 5ee4925a96..7e7c6ee0b6 100644
--- a/source/dnode/mnode/impl/src/mndScheduler.c
+++ b/source/dnode/mnode/impl/src/mndScheduler.c
@@ -487,6 +487,7 @@ int32_t mndScheduleStream(SMnode* pMnode, SStreamObj* pStream) {
qDestroyQueryPlan(pPlan);
return -1;
}
+ pTask->fillHistory = pStream->fillHistory;
mndAddTaskToTaskSet(taskOneLevel, pTask);
// source
diff --git a/source/dnode/mnode/impl/src/mndSnode.c b/source/dnode/mnode/impl/src/mndSnode.c
index bb93745aee..7753e5b127 100644
--- a/source/dnode/mnode/impl/src/mndSnode.c
+++ b/source/dnode/mnode/impl/src/mndSnode.c
@@ -360,11 +360,13 @@ static int32_t mndSetDropSnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, SSn
return 0;
}
-int32_t mndSetDropSnodeInfoToTrans(SMnode *pMnode, STrans *pTrans, SSnodeObj *pObj) {
+int32_t mndSetDropSnodeInfoToTrans(SMnode *pMnode, STrans *pTrans, SSnodeObj *pObj, bool force) {
if (pObj == NULL) return 0;
if (mndSetDropSnodeRedoLogs(pTrans, pObj) != 0) return -1;
if (mndSetDropSnodeCommitLogs(pTrans, pObj) != 0) return -1;
- if (mndSetDropSnodeRedoActions(pTrans, pObj->pDnode, pObj) != 0) return -1;
+ if (!force) {
+ if (mndSetDropSnodeRedoActions(pTrans, pObj->pDnode, pObj) != 0) return -1;
+ }
return 0;
}
@@ -375,7 +377,7 @@ static int32_t mndDropSnode(SMnode *pMnode, SRpcMsg *pReq, SSnodeObj *pObj) {
if (pTrans == NULL) goto _OVER;
mInfo("trans:%d, used to drop snode:%d", pTrans->id, pObj->id);
- if (mndSetDropSnodeInfoToTrans(pMnode, pTrans, pObj) != 0) goto _OVER;
+ if (mndSetDropSnodeInfoToTrans(pMnode, pTrans, pObj, false) != 0) goto _OVER;
if (mndTransPrepare(pMnode, pTrans) != 0) goto _OVER;
code = 0;
@@ -386,9 +388,9 @@ _OVER:
}
static int32_t mndProcessDropSnodeReq(SRpcMsg *pReq) {
- SMnode *pMnode = pReq->info.node;
- int32_t code = -1;
- SSnodeObj *pObj = NULL;
+ SMnode *pMnode = pReq->info.node;
+ int32_t code = -1;
+ SSnodeObj *pObj = NULL;
SMDropSnodeReq dropReq = {0};
if (tDeserializeSCreateDropMQSNodeReq(pReq->pCont, pReq->contLen, &dropReq) != 0) {
diff --git a/source/dnode/mnode/impl/src/mndStb.c b/source/dnode/mnode/impl/src/mndStb.c
index 4b1906ba70..641a8af437 100644
--- a/source/dnode/mnode/impl/src/mndStb.c
+++ b/source/dnode/mnode/impl/src/mndStb.c
@@ -2029,7 +2029,7 @@ static int32_t mndSetDropStbRedoActions(SMnode *pMnode, STrans *pTrans, SDbObj *
action.pCont = pReq;
action.contLen = contLen;
action.msgType = TDMT_VND_DROP_STB;
- action.acceptableCode = TSDB_CODE_VND_TB_NOT_EXIST;
+ action.acceptableCode = TSDB_CODE_TDB_STB_NOT_EXIST;
if (mndTransAppendRedoAction(pTrans, &action) != 0) {
taosMemoryFree(pReq);
sdbCancelFetch(pSdb, pIter);
diff --git a/source/dnode/mnode/impl/src/mndStream.c b/source/dnode/mnode/impl/src/mndStream.c
index 3ff989e670..36ba0aaf87 100644
--- a/source/dnode/mnode/impl/src/mndStream.c
+++ b/source/dnode/mnode/impl/src/mndStream.c
@@ -557,78 +557,6 @@ static int32_t mndPersistTaskDropReq(STrans *pTrans, SStreamTask *pTask) {
return 0;
}
-#if 0
-static int32_t mndPersistTaskRecoverReq(STrans *pTrans, SStreamTask *pTask) {
- SMStreamTaskRecoverReq *pReq = taosMemoryCalloc(1, sizeof(SMStreamTaskRecoverReq));
- if (pReq == NULL) {
- terrno = TSDB_CODE_OUT_OF_MEMORY;
- return -1;
- }
- pReq->streamId = pTask->streamId;
- pReq->taskId = pTask->taskId;
- int32_t len;
- int32_t code;
- tEncodeSize(tEncodeSMStreamTaskRecoverReq, pReq, len, code);
- if (code != 0) {
- return -1;
- }
- void *buf = taosMemoryCalloc(1, sizeof(SMsgHead) + len);
- if (buf == NULL) {
- return -1;
- }
- void *abuf = POINTER_SHIFT(buf, sizeof(SMsgHead));
- SEncoder encoder;
- tEncoderInit(&encoder, abuf, len);
- tEncodeSMStreamTaskRecoverReq(&encoder, pReq);
- ((SMsgHead *)buf)->vgId = pTask->nodeId;
-
- STransAction action = {0};
- memcpy(&action.epSet, &pTask->epSet, sizeof(SEpSet));
- action.pCont = buf;
- action.contLen = sizeof(SMsgHead) + len;
- action.msgType = TDMT_STREAM_TASK_RECOVER;
- if (mndTransAppendRedoAction(pTrans, &action) != 0) {
- taosMemoryFree(buf);
- return -1;
- }
- return 0;
-}
-
-int32_t mndRecoverStreamTasks(SMnode *pMnode, STrans *pTrans, SStreamObj *pStream) {
- if (pStream->isDistributed) {
- int32_t lv = taosArrayGetSize(pStream->tasks);
- for (int32_t i = 0; i < lv; i++) {
- SArray *pTasks = taosArrayGetP(pStream->tasks, i);
- int32_t sz = taosArrayGetSize(pTasks);
- SStreamTask *pTask = taosArrayGetP(pTasks, 0);
- if (pTask->taskLevel == TASK_LEVEL__AGG) {
- ASSERT(sz == 1);
- if (mndPersistTaskRecoverReq(pTrans, pTask) < 0) {
- return -1;
- }
- } else {
- continue;
- }
- }
- } else {
- int32_t lv = taosArrayGetSize(pStream->tasks);
- for (int32_t i = 0; i < lv; i++) {
- SArray *pTasks = taosArrayGetP(pStream->tasks, i);
- int32_t sz = taosArrayGetSize(pTasks);
- for (int32_t j = 0; j < sz; j++) {
- SStreamTask *pTask = taosArrayGetP(pTasks, j);
- if (pTask->taskLevel != TASK_LEVEL__SOURCE) break;
- ASSERT(pTask->taskLevel != TASK_LEVEL__SINK);
- if (mndPersistTaskRecoverReq(pTrans, pTask) < 0) {
- return -1;
- }
- }
- }
- }
- return 0;
-}
-#endif
-
int32_t mndDropStreamTasks(SMnode *pMnode, STrans *pTrans, SStreamObj *pStream) {
int32_t lv = taosArrayGetSize(pStream->tasks);
for (int32_t i = 0; i < lv; i++) {
@@ -777,7 +705,8 @@ static int32_t mndProcessDropStreamReq(SRpcMsg *pReq) {
return -1;
}
- STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_NOTHING, pReq, "drop-stream");
+ STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_DB_INSIDE, pReq, "drop-stream");
+ mndTransSetDbName(pTrans, pStream->sourceDb, pStream->targetDb);
if (pTrans == NULL) {
mError("stream:%s, failed to drop since %s", dropReq.name, terrstr());
sdbRelease(pMnode->pSdb, pStream);
diff --git a/source/dnode/mnode/impl/src/mndSubscribe.c b/source/dnode/mnode/impl/src/mndSubscribe.c
index a6661e73c9..a62f15f978 100644
--- a/source/dnode/mnode/impl/src/mndSubscribe.c
+++ b/source/dnode/mnode/impl/src/mndSubscribe.c
@@ -73,11 +73,11 @@ int32_t mndInitSubscribe(SMnode *pMnode) {
.deleteFp = (SdbDeleteFp)mndSubActionDelete,
};
- mndSetMsgHandle(pMnode, TDMT_VND_MQ_VG_CHANGE_RSP, mndTransProcessRsp);
- mndSetMsgHandle(pMnode, TDMT_VND_MQ_VG_DELETE_RSP, mndTransProcessRsp);
- mndSetMsgHandle(pMnode, TDMT_MND_MQ_DO_REBALANCE, mndProcessRebalanceReq);
- mndSetMsgHandle(pMnode, TDMT_MND_MQ_DROP_CGROUP, mndProcessDropCgroupReq);
- mndSetMsgHandle(pMnode, TDMT_MND_MQ_DROP_CGROUP_RSP, mndTransProcessRsp);
+ mndSetMsgHandle(pMnode, TDMT_VND_TMQ_SUBSCRIBE_RSP, mndTransProcessRsp);
+ mndSetMsgHandle(pMnode, TDMT_VND_TMQ_DELETE_SUB_RSP, mndTransProcessRsp);
+ mndSetMsgHandle(pMnode, TDMT_MND_TMQ_DO_REBALANCE, mndProcessRebalanceReq);
+ mndSetMsgHandle(pMnode, TDMT_MND_TMQ_DROP_CGROUP, mndProcessDropCgroupReq);
+ mndSetMsgHandle(pMnode, TDMT_MND_TMQ_DROP_CGROUP_RSP, mndTransProcessRsp);
mndAddShowRetrieveHandle(pMnode, TSDB_MGMT_TABLE_SUBSCRIPTIONS, mndRetrieveSubscribe);
mndAddShowFreeIterHandle(pMnode, TSDB_MGMT_TABLE_TOPICS, mndCancelGetNextSubscribe);
@@ -164,7 +164,7 @@ static int32_t mndPersistSubChangeVgReq(SMnode *pMnode, STrans *pTrans, const SM
action.epSet = mndGetVgroupEpset(pMnode, pVgObj);
action.pCont = buf;
action.contLen = tlen;
- action.msgType = TDMT_VND_MQ_VG_CHANGE;
+ action.msgType = TDMT_VND_TMQ_SUBSCRIBE;
mndReleaseVgroup(pMnode, pVgObj);
if (mndTransAppendRedoAction(pTrans, &action) != 0) {
@@ -612,14 +612,14 @@ static int32_t mndProcessRebalanceReq(SRpcMsg *pMsg) {
mndReleaseSubscribe(pMnode, pSub);
}
- // TODO replace assert with error check
- ASSERT(mndDoRebalance(pMnode, &rebInput, &rebOutput) == 0);
+ if (mndDoRebalance(pMnode, &rebInput, &rebOutput) < 0) {
+ mError("mq rebalance internal error");
+ }
// if add more consumer to balanced subscribe,
// possibly no vg is changed
/*ASSERT(taosArrayGetSize(rebOutput.rebVgs) != 0);*/
- // TODO replace assert with error check
if (mndPersistRebResult(pMnode, pMsg, &rebOutput) < 0) {
mError("mq rebalance persist rebalance output error, possibly vnode splitted or dropped");
}
@@ -920,7 +920,7 @@ int32_t mndDropSubByTopic(SMnode *pMnode, STrans *pTrans, const char *topicName)
action.epSet = pVgEp->epSet;
action.pCont = pReq;
action.contLen = sizeof(SMqVDeleteReq);
- action.msgType = TDMT_VND_MQ_VG_DELETE;
+ action.msgType = TDMT_VND_TMQ_DELETE_SUB;
if (mndTransAppendRedoAction(pTrans, &action) != 0) {
taosMemoryFree(pReq);
return -1;
diff --git a/source/dnode/mnode/impl/src/mndSync.c b/source/dnode/mnode/impl/src/mndSync.c
index df4b526775..0f50391ac5 100644
--- a/source/dnode/mnode/impl/src/mndSync.c
+++ b/source/dnode/mnode/impl/src/mndSync.c
@@ -17,11 +17,44 @@
#include "mndSync.h"
#include "mndTrans.h"
-static int32_t mndSyncEqMsg(const SMsgCb *msgcb, SRpcMsg *pMsg) {
+static int32_t mndSyncEqCtrlMsg(const SMsgCb *msgcb, SRpcMsg *pMsg) {
+ if (pMsg == NULL || pMsg->pCont == NULL) {
+ return -1;
+ }
+
SMsgHead *pHead = pMsg->pCont;
pHead->contLen = htonl(pHead->contLen);
pHead->vgId = htonl(pHead->vgId);
+ if (msgcb == NULL || msgcb->putToQueueFp == NULL) {
+ rpcFreeCont(pMsg->pCont);
+ pMsg->pCont = NULL;
+ return -1;
+ }
+
+ int32_t code = tmsgPutToQueue(msgcb, SYNC_CTRL_QUEUE, pMsg);
+ if (code != 0) {
+ rpcFreeCont(pMsg->pCont);
+ pMsg->pCont = NULL;
+ }
+ return code;
+}
+
+static int32_t mndSyncEqMsg(const SMsgCb *msgcb, SRpcMsg *pMsg) {
+ if (pMsg == NULL || pMsg->pCont == NULL) {
+ return -1;
+ }
+
+ SMsgHead *pHead = pMsg->pCont;
+ pHead->contLen = htonl(pHead->contLen);
+ pHead->vgId = htonl(pHead->vgId);
+
+ if (msgcb == NULL || msgcb->putToQueueFp == NULL) {
+ rpcFreeCont(pMsg->pCont);
+ pMsg->pCont = NULL;
+ return -1;
+ }
+
int32_t code = tmsgPutToQueue(msgcb, SYNC_QUEUE, pMsg);
if (code != 0) {
rpcFreeCont(pMsg->pCont);
@@ -39,25 +72,25 @@ static int32_t mndSyncSendMsg(const SEpSet *pEpSet, SRpcMsg *pMsg) {
return code;
}
-void mndSyncCommitMsg(struct SSyncFSM *pFsm, const SRpcMsg *pMsg, SFsmCbMeta cbMeta) {
+void mndSyncCommitMsg(const SSyncFSM *pFsm, const SRpcMsg *pMsg, const SFsmCbMeta *pMeta) {
SMnode *pMnode = pFsm->data;
SSyncMgmt *pMgmt = &pMnode->syncMgmt;
SSdbRaw *pRaw = pMsg->pCont;
// delete msg handle
SRpcMsg rpcMsg = {0};
- syncGetAndDelRespRpc(pMnode->syncMgmt.sync, cbMeta.seqNum, &rpcMsg.info);
+ rpcMsg.info = pMsg->info;
int32_t transId = sdbGetIdFromRaw(pMnode->pSdb, pRaw);
- pMgmt->errCode = cbMeta.code;
+ pMgmt->errCode = pMeta->code;
mInfo("trans:%d, is proposed, saved:%d code:0x%x, apply index:%" PRId64 " term:%" PRIu64 " config:%" PRId64
" role:%s raw:%p",
- transId, pMgmt->transId, cbMeta.code, cbMeta.index, cbMeta.term, cbMeta.lastConfigIndex, syncStr(cbMeta.state),
+ transId, pMgmt->transId, pMeta->code, pMeta->index, pMeta->term, pMeta->lastConfigIndex, syncStr(pMeta->state),
pRaw);
if (pMgmt->errCode == 0) {
sdbWriteWithoutFree(pMnode->pSdb, pRaw);
- sdbSetApplyInfo(pMnode->pSdb, cbMeta.index, cbMeta.term, cbMeta.lastConfigIndex);
+ sdbSetApplyInfo(pMnode->pSdb, pMeta->index, pMeta->term, pMeta->lastConfigIndex);
}
taosWLockLatch(&pMgmt->lock);
@@ -87,7 +120,7 @@ void mndSyncCommitMsg(struct SSyncFSM *pFsm, const SRpcMsg *pMsg, SFsmCbMeta cbM
}
}
-int32_t mndSyncGetSnapshot(struct SSyncFSM *pFsm, SSnapshot *pSnapshot, void *pReaderParam, void **ppReader) {
+int32_t mndSyncGetSnapshot(const SSyncFSM *pFsm, SSnapshot *pSnapshot, void *pReaderParam, void **ppReader) {
mInfo("start to read snapshot from sdb in atomic way");
SMnode *pMnode = pFsm->data;
return sdbStartRead(pMnode->pSdb, (SSdbIter **)ppReader, &pSnapshot->lastApplyIndex, &pSnapshot->lastApplyTerm,
@@ -95,13 +128,13 @@ int32_t mndSyncGetSnapshot(struct SSyncFSM *pFsm, SSnapshot *pSnapshot, void *pR
return 0;
}
-int32_t mndSyncGetSnapshotInfo(struct SSyncFSM *pFsm, SSnapshot *pSnapshot) {
+int32_t mndSyncGetSnapshotInfo(const SSyncFSM *pFsm, SSnapshot *pSnapshot) {
SMnode *pMnode = pFsm->data;
sdbGetCommitInfo(pMnode->pSdb, &pSnapshot->lastApplyIndex, &pSnapshot->lastApplyTerm, &pSnapshot->lastConfigIndex);
return 0;
}
-void mndRestoreFinish(struct SSyncFSM *pFsm) {
+void mndRestoreFinish(const SSyncFSM *pFsm) {
SMnode *pMnode = pFsm->data;
if (!pMnode->deploy) {
@@ -113,32 +146,30 @@ void mndRestoreFinish(struct SSyncFSM *pFsm) {
}
}
-void mndReConfig(struct SSyncFSM *pFsm, const SRpcMsg *pMsg, SReConfigCbMeta *cbMeta) {}
-
-int32_t mndSnapshotStartRead(struct SSyncFSM *pFsm, void *pParam, void **ppReader) {
+int32_t mndSnapshotStartRead(const SSyncFSM *pFsm, void *pParam, void **ppReader) {
mInfo("start to read snapshot from sdb");
SMnode *pMnode = pFsm->data;
return sdbStartRead(pMnode->pSdb, (SSdbIter **)ppReader, NULL, NULL, NULL);
}
-int32_t mndSnapshotStopRead(struct SSyncFSM *pFsm, void *pReader) {
+int32_t mndSnapshotStopRead(const SSyncFSM *pFsm, void *pReader) {
mInfo("stop to read snapshot from sdb");
SMnode *pMnode = pFsm->data;
return sdbStopRead(pMnode->pSdb, pReader);
}
-int32_t mndSnapshotDoRead(struct SSyncFSM *pFsm, void *pReader, void **ppBuf, int32_t *len) {
+int32_t mndSnapshotDoRead(const SSyncFSM *pFsm, void *pReader, void **ppBuf, int32_t *len) {
SMnode *pMnode = pFsm->data;
return sdbDoRead(pMnode->pSdb, pReader, ppBuf, len);
}
-int32_t mndSnapshotStartWrite(struct SSyncFSM *pFsm, void *pParam, void **ppWriter) {
+int32_t mndSnapshotStartWrite(const SSyncFSM *pFsm, void *pParam, void **ppWriter) {
mInfo("start to apply snapshot to sdb");
SMnode *pMnode = pFsm->data;
return sdbStartWrite(pMnode->pSdb, (SSdbIter **)ppWriter);
}
-int32_t mndSnapshotStopWrite(struct SSyncFSM *pFsm, void *pWriter, bool isApply, SSnapshot *pSnapshot) {
+int32_t mndSnapshotStopWrite(const SSyncFSM *pFsm, void *pWriter, bool isApply, SSnapshot *pSnapshot) {
mInfo("stop to apply snapshot to sdb, apply:%d, index:%" PRId64 " term:%" PRIu64 " config:%" PRId64, isApply,
pSnapshot->lastApplyIndex, pSnapshot->lastApplyTerm, pSnapshot->lastConfigIndex);
SMnode *pMnode = pFsm->data;
@@ -146,18 +177,12 @@ int32_t mndSnapshotStopWrite(struct SSyncFSM *pFsm, void *pWriter, bool isApply,
pSnapshot->lastConfigIndex);
}
-int32_t mndSnapshotDoWrite(struct SSyncFSM *pFsm, void *pWriter, void *pBuf, int32_t len) {
+int32_t mndSnapshotDoWrite(const SSyncFSM *pFsm, void *pWriter, void *pBuf, int32_t len) {
SMnode *pMnode = pFsm->data;
return sdbDoWrite(pMnode->pSdb, pWriter, pBuf, len);
}
-void mndLeaderTransfer(struct SSyncFSM *pFsm, const SRpcMsg *pMsg, SFsmCbMeta cbMeta) {
- SMnode *pMnode = pFsm->data;
- atomic_store_8(&(pMnode->syncMgmt.leaderTransferFinish), 1);
- mInfo("vgId:1, mnode leader transfer finish");
-}
-
-static void mndBecomeFollower(struct SSyncFSM *pFsm) {
+static void mndBecomeFollower(const SSyncFSM *pFsm) {
SMnode *pMnode = pFsm->data;
mInfo("vgId:1, become follower");
@@ -172,7 +197,7 @@ static void mndBecomeFollower(struct SSyncFSM *pFsm) {
taosWUnLockLatch(&pMnode->syncMgmt.lock);
}
-static void mndBecomeLeader(struct SSyncFSM *pFsm) {
+static void mndBecomeLeader(const SSyncFSM *pFsm) {
mInfo("vgId:1, become leader");
SMnode *pMnode = pFsm->data;
}
@@ -184,8 +209,8 @@ SSyncFSM *mndSyncMakeFsm(SMnode *pMnode) {
pFsm->FpPreCommitCb = NULL;
pFsm->FpRollBackCb = NULL;
pFsm->FpRestoreFinishCb = mndRestoreFinish;
- pFsm->FpLeaderTransferCb = mndLeaderTransfer;
- pFsm->FpReConfigCb = mndReConfig;
+ pFsm->FpLeaderTransferCb = NULL;
+ pFsm->FpReConfigCb = NULL;
pFsm->FpBecomeLeaderCb = mndBecomeLeader;
pFsm->FpBecomeFollowerCb = mndBecomeFollower;
pFsm->FpGetSnapshot = mndSyncGetSnapshot;
@@ -209,10 +234,13 @@ int32_t mndInitSync(SMnode *pMnode) {
.batchSize = 1,
.vgId = 1,
.pWal = pMnode->pWal,
- .msgcb = NULL,
- .FpSendMsg = mndSyncSendMsg,
- .FpEqMsg = mndSyncEqMsg,
- .FpEqCtrlMsg = NULL,
+ .msgcb = &pMnode->msgCb,
+ .syncSendMSg = mndSyncSendMsg,
+ .syncEqMsg = mndSyncEqMsg,
+ .syncEqCtrlMsg = mndSyncEqCtrlMsg,
+ .pingMs = 5000,
+ .electMs = 3000,
+ .heartbeatMs = 500,
};
snprintf(syncInfo.path, sizeof(syncInfo.path), "%s%ssync", pMnode->path, TD_DIRSEP);
@@ -236,11 +264,6 @@ int32_t mndInitSync(SMnode *pMnode) {
return -1;
}
- // decrease election timer
- setPingTimerMS(pMgmt->sync, 5000);
- setElectTimerMS(pMgmt->sync, 3000);
- setHeartbeatTimerMS(pMgmt->sync, 500);
-
mInfo("mnode-sync is opened, id:%" PRId64, pMgmt->sync);
return 0;
}
@@ -256,32 +279,26 @@ void mndCleanupSync(SMnode *pMnode) {
int32_t mndSyncPropose(SMnode *pMnode, SSdbRaw *pRaw, int32_t transId) {
SSyncMgmt *pMgmt = &pMnode->syncMgmt;
- SRpcMsg req = {.msgType = TDMT_MND_APPLY_MSG, .contLen = sdbGetRawTotalSize(pRaw)};
- if (req.contLen <= 0) {
- terrno = TSDB_CODE_APP_ERROR;
- return -1;
- }
+ pMgmt->errCode = 0;
+ SRpcMsg req = {.msgType = TDMT_MND_APPLY_MSG, .contLen = sdbGetRawTotalSize(pRaw)};
req.pCont = rpcMallocCont(req.contLen);
if (req.pCont == NULL) return -1;
memcpy(req.pCont, pRaw, req.contLen);
- pMgmt->errCode = 0;
taosWLockLatch(&pMgmt->lock);
if (pMgmt->transId != 0) {
- mError("trans:%d, can't be proposed since trans:%d alrady waiting for confirm", transId, pMgmt->transId);
+ mError("trans:%d, can't be proposed since trans:%d already waiting for confirm", transId, pMgmt->transId);
taosWUnLockLatch(&pMgmt->lock);
terrno = TSDB_CODE_APP_NOT_READY;
return -1;
- } else {
- pMgmt->transId = transId;
- mInfo("trans:%d, will be proposed", pMgmt->transId);
- taosWUnLockLatch(&pMgmt->lock);
}
- const bool isWeak = false;
- int32_t code = syncPropose(pMgmt->sync, &req, isWeak);
+ mInfo("trans:%d, will be proposed", transId);
+ pMgmt->transId = transId;
+ taosWUnLockLatch(&pMgmt->lock);
+ int32_t code = syncPropose(pMgmt->sync, &req, false);
if (code == 0) {
mInfo("trans:%d, is proposing and wait sem", pMgmt->transId);
tsem_wait(&pMgmt->syncSem);
@@ -294,8 +311,8 @@ int32_t mndSyncPropose(SMnode *pMnode, SSdbRaw *pRaw, int32_t transId) {
sdbSetApplyInfo(pMnode->pSdb, req.info.conn.applyIndex, req.info.conn.applyTerm, SYNC_INDEX_INVALID);
code = 0;
} else {
- taosWLockLatch(&pMgmt->lock);
mInfo("trans:%d, failed to proposed since %s", transId, terrstr());
+ taosWLockLatch(&pMgmt->lock);
pMgmt->transId = 0;
taosWUnLockLatch(&pMgmt->lock);
if (terrno == TSDB_CODE_SYN_NOT_LEADER) {
@@ -311,13 +328,12 @@ int32_t mndSyncPropose(SMnode *pMnode, SSdbRaw *pRaw, int32_t transId) {
return code;
}
- if (pMgmt->errCode != 0) terrno = pMgmt->errCode;
+ terrno = pMgmt->errCode;
return pMgmt->errCode;
}
void mndSyncStart(SMnode *pMnode) {
SSyncMgmt *pMgmt = &pMnode->syncMgmt;
- syncSetMsgCb(pMgmt->sync, &pMnode->msgCb);
syncStart(pMgmt->sync);
mInfo("vgId:1, sync started, id:%" PRId64, pMgmt->sync);
}
@@ -333,11 +349,15 @@ void mndSyncStop(SMnode *pMnode) {
}
bool mndIsLeader(SMnode *pMnode) {
- SSyncMgmt *pMgmt = &pMnode->syncMgmt;
+ SSyncState state = syncGetState(pMnode->syncMgmt.sync);
- if (!syncIsReady(pMgmt->sync)) {
- // get terrno from syncIsReady
- // terrno = TSDB_CODE_SYN_NOT_LEADER;
+ if (state.state != TAOS_SYNC_STATE_LEADER || !state.restored) {
+ if (state.state != TAOS_SYNC_STATE_LEADER) {
+ terrno = TSDB_CODE_SYN_NOT_LEADER;
+ } else {
+ terrno = TSDB_CODE_APP_NOT_READY;
+ }
+ mDebug("vgId:1, mnode not ready, state:%s, restore:%d", syncStr(state.state), state.restored);
return false;
}
diff --git a/source/dnode/mnode/impl/src/mndTopic.c b/source/dnode/mnode/impl/src/mndTopic.c
index 324404ce1b..e1ca1d2708 100644
--- a/source/dnode/mnode/impl/src/mndTopic.c
+++ b/source/dnode/mnode/impl/src/mndTopic.c
@@ -53,11 +53,10 @@ int32_t mndInitTopic(SMnode *pMnode) {
.deleteFp = (SdbDeleteFp)mndTopicActionDelete,
};
- mndSetMsgHandle(pMnode, TDMT_MND_CREATE_TOPIC, mndProcessCreateTopicReq);
- mndSetMsgHandle(pMnode, TDMT_MND_DROP_TOPIC, mndProcessDropTopicReq);
- mndSetMsgHandle(pMnode, TDMT_VND_DROP_TOPIC_RSP, mndTransProcessRsp);
- mndSetMsgHandle(pMnode, TDMT_VND_ADD_CHECK_INFO_RSP, mndTransProcessRsp);
- mndSetMsgHandle(pMnode, TDMT_VND_DELETE_CHECK_INFO_RSP, mndTransProcessRsp);
+ mndSetMsgHandle(pMnode, TDMT_MND_TMQ_CREATE_TOPIC, mndProcessCreateTopicReq);
+ mndSetMsgHandle(pMnode, TDMT_MND_TMQ_DROP_TOPIC, mndProcessDropTopicReq);
+ mndSetMsgHandle(pMnode, TDMT_VND_TMQ_ADD_CHECKINFO_RSP, mndTransProcessRsp);
+ mndSetMsgHandle(pMnode, TDMT_VND_TMQ_DEL_CHECKINFO_RSP, mndTransProcessRsp);
mndAddShowRetrieveHandle(pMnode, TSDB_MGMT_TABLE_TOPICS, mndRetrieveTopic);
mndAddShowFreeIterHandle(pMnode, TSDB_MGMT_TABLE_TOPICS, mndCancelGetNextTopic);
@@ -506,7 +505,7 @@ static int32_t mndCreateTopic(SMnode *pMnode, SRpcMsg *pReq, SCMCreateTopicReq *
action.epSet = mndGetVgroupEpset(pMnode, pVgroup);
action.pCont = buf;
action.contLen = sizeof(SMsgHead) + len;
- action.msgType = TDMT_VND_ADD_CHECK_INFO;
+ action.msgType = TDMT_VND_TMQ_ADD_CHECKINFO;
if (mndTransAppendRedoAction(pTrans, &action) != 0) {
taosMemoryFree(buf);
sdbRelease(pSdb, pVgroup);
@@ -715,7 +714,7 @@ static int32_t mndProcessDropTopicReq(SRpcMsg *pReq) {
action.epSet = mndGetVgroupEpset(pMnode, pVgroup);
action.pCont = buf;
action.contLen = sizeof(SMsgHead) + TSDB_TOPIC_FNAME_LEN;
- action.msgType = TDMT_VND_DELETE_CHECK_INFO;
+ action.msgType = TDMT_VND_TMQ_DEL_CHECKINFO;
if (mndTransAppendRedoAction(pTrans, &action) != 0) {
taosMemoryFree(buf);
sdbRelease(pSdb, pVgroup);
diff --git a/source/dnode/mnode/impl/src/mndVgroup.c b/source/dnode/mnode/impl/src/mndVgroup.c
index c409a57d87..72a4621eae 100644
--- a/source/dnode/mnode/impl/src/mndVgroup.c
+++ b/source/dnode/mnode/impl/src/mndVgroup.c
@@ -1071,7 +1071,7 @@ int32_t mndAddDropVnodeAction(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, SVgOb
}
int32_t mndSetMoveVgroupInfoToTrans(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, SVgObj *pVgroup, int32_t vnIndex,
- SArray *pArray) {
+ SArray *pArray, bool force) {
SVgObj newVg = {0};
memcpy(&newVg, pVgroup, sizeof(SVgObj));
@@ -1080,24 +1080,45 @@ int32_t mndSetMoveVgroupInfoToTrans(SMnode *pMnode, STrans *pTrans, SDbObj *pDb,
mInfo("vgId:%d, vnode:%d dnode:%d", newVg.vgId, i, newVg.vnodeGid[i].dnodeId);
}
- mInfo("vgId:%d, will add 1 vnodes", pVgroup->vgId);
- if (mndAddVnodeToVgroup(pMnode, &newVg, pArray) != 0) return -1;
- if (mndAddCreateVnodeAction(pMnode, pTrans, pDb, &newVg, &newVg.vnodeGid[newVg.replica - 1]) != 0) return -1;
- for (int32_t i = 0; i < newVg.replica - 1; ++i) {
- if (mndAddAlterVnodeReplicaAction(pMnode, pTrans, pDb, &newVg, newVg.vnodeGid[i].dnodeId) != 0) return -1;
- }
- if (mndAddAlterVnodeConfirmAction(pMnode, pTrans, pDb, &newVg) != 0) return -1;
+ if (!force) {
+ mInfo("vgId:%d, will add 1 vnode", pVgroup->vgId);
+ if (mndAddVnodeToVgroup(pMnode, &newVg, pArray) != 0) return -1;
+ if (mndAddCreateVnodeAction(pMnode, pTrans, pDb, &newVg, &newVg.vnodeGid[newVg.replica - 1]) != 0) return -1;
+ for (int32_t i = 0; i < newVg.replica - 1; ++i) {
+ if (mndAddAlterVnodeReplicaAction(pMnode, pTrans, pDb, &newVg, newVg.vnodeGid[i].dnodeId) != 0) return -1;
+ }
+ if (mndAddAlterVnodeConfirmAction(pMnode, pTrans, pDb, &newVg) != 0) return -1;
- mInfo("vgId:%d, will remove 1 vnodes", pVgroup->vgId);
- newVg.replica--;
- SVnodeGid del = newVg.vnodeGid[vnIndex];
- newVg.vnodeGid[vnIndex] = newVg.vnodeGid[newVg.replica];
- memset(&newVg.vnodeGid[newVg.replica], 0, sizeof(SVnodeGid));
- if (mndAddDropVnodeAction(pMnode, pTrans, pDb, &newVg, &del, true) != 0) return -1;
- for (int32_t i = 0; i < newVg.replica; ++i) {
- if (mndAddAlterVnodeReplicaAction(pMnode, pTrans, pDb, &newVg, newVg.vnodeGid[i].dnodeId) != 0) return -1;
+ mInfo("vgId:%d, will remove 1 vnode", pVgroup->vgId);
+ newVg.replica--;
+ SVnodeGid del = newVg.vnodeGid[vnIndex];
+ newVg.vnodeGid[vnIndex] = newVg.vnodeGid[newVg.replica];
+ memset(&newVg.vnodeGid[newVg.replica], 0, sizeof(SVnodeGid));
+ if (mndAddDropVnodeAction(pMnode, pTrans, pDb, &newVg, &del, true) != 0) return -1;
+ for (int32_t i = 0; i < newVg.replica; ++i) {
+ if (mndAddAlterVnodeReplicaAction(pMnode, pTrans, pDb, &newVg, newVg.vnodeGid[i].dnodeId) != 0) return -1;
+ }
+ if (mndAddAlterVnodeConfirmAction(pMnode, pTrans, pDb, &newVg) != 0) return -1;
+ } else {
+ mInfo("vgId:%d, will add 1 vnode and force remove 1 vnode", pVgroup->vgId);
+ if (mndAddVnodeToVgroup(pMnode, &newVg, pArray) != 0) return -1;
+ newVg.replica--;
+ SVnodeGid del = newVg.vnodeGid[vnIndex];
+ newVg.vnodeGid[vnIndex] = newVg.vnodeGid[newVg.replica];
+ memset(&newVg.vnodeGid[newVg.replica], 0, sizeof(SVnodeGid));
+
+ if (mndAddCreateVnodeAction(pMnode, pTrans, pDb, &newVg, &newVg.vnodeGid[vnIndex]) != 0) return -1;
+ for (int32_t i = 0; i < newVg.replica; ++i) {
+ if (i != vnIndex) {
+ if (mndAddAlterVnodeReplicaAction(pMnode, pTrans, pDb, &newVg, newVg.vnodeGid[i].dnodeId) != 0) return -1;
+ }
+ }
+ if (mndAddAlterVnodeConfirmAction(pMnode, pTrans, pDb, &newVg) != 0) return -1;
+
+ if (newVg.replica == 1) {
+ mInfo("vgId:%d, all data is dropped since replica=1", pVgroup->vgId);
+ }
}
- if (mndAddAlterVnodeConfirmAction(pMnode, pTrans, pDb, &newVg) != 0) return -1;
{
SSdbRaw *pRaw = mndVgroupActionEncode(&newVg);
@@ -1120,7 +1141,7 @@ int32_t mndSetMoveVgroupInfoToTrans(SMnode *pMnode, STrans *pTrans, SDbObj *pDb,
return 0;
}
-int32_t mndSetMoveVgroupsInfoToTrans(SMnode *pMnode, STrans *pTrans, int32_t delDnodeId) {
+int32_t mndSetMoveVgroupsInfoToTrans(SMnode *pMnode, STrans *pTrans, int32_t delDnodeId, bool force) {
int32_t code = 0;
SArray *pArray = mndBuildDnodesArray(pMnode, delDnodeId);
if (pArray == NULL) return -1;
@@ -1141,9 +1162,9 @@ int32_t mndSetMoveVgroupsInfoToTrans(SMnode *pMnode, STrans *pTrans, int32_t del
code = 0;
if (vnIndex != -1) {
- mInfo("vgId:%d, vnode:%d will be removed from dnode:%d", pVgroup->vgId, vnIndex, delDnodeId);
+ mInfo("vgId:%d, vnode:%d will be removed from dnode:%d, force:%d", pVgroup->vgId, vnIndex, delDnodeId, force);
SDbObj *pDb = mndAcquireDb(pMnode, pVgroup->dbName);
- code = mndSetMoveVgroupInfoToTrans(pMnode, pTrans, pDb, pVgroup, vnIndex, pArray);
+ code = mndSetMoveVgroupInfoToTrans(pMnode, pTrans, pDb, pVgroup, vnIndex, pArray, force);
mndReleaseDb(pMnode, pDb);
}
diff --git a/source/dnode/mnode/sdb/src/sdbFile.c b/source/dnode/mnode/sdb/src/sdbFile.c
index b33c01a962..6558a98aaa 100644
--- a/source/dnode/mnode/sdb/src/sdbFile.c
+++ b/source/dnode/mnode/sdb/src/sdbFile.c
@@ -265,34 +265,47 @@ static int32_t sdbReadFileImp(SSdb *pSdb) {
if (ret < 0) {
code = TAOS_SYSTEM_ERROR(errno);
mError("failed to read sdb file:%s since %s", file, tstrerror(code));
- break;
+ goto _OVER;
}
if (ret != readLen) {
code = TSDB_CODE_FILE_CORRUPTED;
- mError("failed to read sdb file:%s since %s", file, tstrerror(code));
- break;
+ mError("failed to read sdb file:%s since %s, ret:%" PRId64 " != readLen:%d", file, tstrerror(code), ret, readLen);
+ goto _OVER;
}
readLen = pRaw->dataLen + sizeof(int32_t);
+ if (readLen >= pRaw->dataLen) {
+ SSdbRaw *pNewRaw = taosMemoryMalloc(pRaw->dataLen + TSDB_MAX_MSG_SIZE);
+ if (pNewRaw == NULL) {
+ terrno = TSDB_CODE_OUT_OF_MEMORY;
+ mError("failed read sdb file since malloc new sdbRaw size:%d failed", pRaw->dataLen + TSDB_MAX_MSG_SIZE);
+ goto _OVER;
+ }
+ mInfo("malloc new sdbRaw size:%d, type:%d", pRaw->dataLen + TSDB_MAX_MSG_SIZE, pRaw->type);
+ memcpy(pNewRaw, pRaw, sizeof(SSdbRaw));
+ sdbFreeRaw(pRaw);
+ pRaw = pNewRaw;
+ }
+
ret = taosReadFile(pFile, pRaw->pData, readLen);
if (ret < 0) {
code = TAOS_SYSTEM_ERROR(errno);
- mError("failed to read sdb file:%s since %s", file, tstrerror(code));
- break;
+ mError("failed to read sdb file:%s since %s, ret:%" PRId64 " readLen:%d", file, tstrerror(code), ret, readLen);
+ goto _OVER;
}
if (ret != readLen) {
code = TSDB_CODE_FILE_CORRUPTED;
- mError("failed to read sdb file:%s since %s", file, tstrerror(code));
- break;
+ mError("failed to read sdb file:%s since %s, ret:%" PRId64 " != readLen:%d", file, tstrerror(code), ret, readLen);
+ goto _OVER;
}
int32_t totalLen = sizeof(SSdbRaw) + pRaw->dataLen + sizeof(int32_t);
if ((!taosCheckChecksumWhole((const uint8_t *)pRaw, totalLen)) != 0) {
code = TSDB_CODE_CHECKSUM_ERROR;
- mError("failed to read sdb file:%s since %s", file, tstrerror(code));
- break;
+ mError("failed to read sdb file:%s since %s, readLen:%d", file, tstrerror(code), readLen);
+ goto _OVER;
}
code = sdbWriteWithoutFree(pSdb, pRaw);
diff --git a/source/dnode/qnode/src/qnode.c b/source/dnode/qnode/src/qnode.c
index 8dbfc14841..289251f560 100644
--- a/source/dnode/qnode/src/qnode.c
+++ b/source/dnode/qnode/src/qnode.c
@@ -90,12 +90,12 @@ int32_t qndProcessQueryMsg(SQnode *pQnode, int64_t ts, SRpcMsg *pMsg) {
code = qWorkerProcessFetchMsg(pQnode, pQnode->pQuery, pMsg, ts);
break;
case TDMT_SCH_CANCEL_TASK:
- //code = qWorkerProcessCancelMsg(pQnode, pQnode->pQuery, pMsg, ts);
+ // code = qWorkerProcessCancelMsg(pQnode, pQnode->pQuery, pMsg, ts);
break;
case TDMT_SCH_DROP_TASK:
code = qWorkerProcessDropMsg(pQnode, pQnode->pQuery, pMsg, ts);
break;
- case TDMT_VND_CONSUME:
+ case TDMT_VND_TMQ_CONSUME:
// code = tqProcessConsumeReq(pQnode->pTq, pMsg);
// break;
case TDMT_SCH_QUERY_HEARTBEAT:
@@ -103,7 +103,7 @@ int32_t qndProcessQueryMsg(SQnode *pQnode, int64_t ts, SRpcMsg *pMsg) {
break;
default:
qError("unknown msg type:%d in qnode queue", pMsg->msgType);
- terrno = TSDB_CODE_VND_APP_ERROR;
+ terrno = TSDB_CODE_APP_ERROR;
}
if (code == 0) return TSDB_CODE_ACTION_IN_PROGRESS;
diff --git a/source/dnode/snode/src/snode.c b/source/dnode/snode/src/snode.c
index 719e2d8fad..f53350c10b 100644
--- a/source/dnode/snode/src/snode.c
+++ b/source/dnode/snode/src/snode.c
@@ -231,10 +231,10 @@ int32_t sndProcessTaskRetrieveReq(SSnode *pSnode, SRpcMsg *pMsg) {
int32_t sndProcessTaskDispatchRsp(SSnode *pSnode, SRpcMsg *pMsg) {
SStreamDispatchRsp *pRsp = POINTER_SHIFT(pMsg->pCont, sizeof(SMsgHead));
- int32_t taskId = pRsp->taskId;
+ int32_t taskId = ntohl(pRsp->upstreamTaskId);
SStreamTask *pTask = streamMetaGetTask(pSnode->pMeta, taskId);
if (pTask) {
- streamProcessDispatchRsp(pTask, pRsp);
+ streamProcessDispatchRsp(pTask, pRsp, pMsg->code);
return 0;
} else {
return -1;
@@ -261,18 +261,52 @@ int32_t sndProcessWriteMsg(SSnode *pSnode, SRpcMsg *pMsg, SRpcMsg *pRsp) {
return 0;
}
+int32_t sndProcessTaskRecoverFinishReq(SSnode *pSnode, SRpcMsg *pMsg) {
+ char *msg = POINTER_SHIFT(pMsg->pCont, sizeof(SMsgHead));
+ int32_t msgLen = pMsg->contLen - sizeof(SMsgHead);
+
+ // deserialize
+ SStreamRecoverFinishReq req;
+
+ SDecoder decoder;
+ tDecoderInit(&decoder, msg, msgLen);
+ tDecodeSStreamRecoverFinishReq(&decoder, &req);
+ tDecoderClear(&decoder);
+
+ // find task
+ SStreamTask *pTask = streamMetaGetTask(pSnode->pMeta, req.taskId);
+ if (pTask == NULL) {
+ return -1;
+ }
+ // do process request
+ if (streamProcessRecoverFinishReq(pTask, req.childId) < 0) {
+ return -1;
+ }
+
+ return 0;
+}
+
+int32_t sndProcessTaskRecoverFinishRsp(SSnode *pSnode, SRpcMsg *pMsg) {
+ //
+ return 0;
+}
+
int32_t sndProcessStreamMsg(SSnode *pSnode, SRpcMsg *pMsg) {
switch (pMsg->msgType) {
case TDMT_STREAM_TASK_RUN:
return sndProcessTaskRunReq(pSnode, pMsg);
case TDMT_STREAM_TASK_DISPATCH:
return sndProcessTaskDispatchReq(pSnode, pMsg, true);
- case TDMT_STREAM_RETRIEVE:
- return sndProcessTaskRetrieveReq(pSnode, pMsg);
case TDMT_STREAM_TASK_DISPATCH_RSP:
return sndProcessTaskDispatchRsp(pSnode, pMsg);
+ case TDMT_STREAM_RETRIEVE:
+ return sndProcessTaskRetrieveReq(pSnode, pMsg);
case TDMT_STREAM_RETRIEVE_RSP:
return sndProcessTaskRetrieveRsp(pSnode, pMsg);
+ case TDMT_STREAM_RECOVER_FINISH:
+ return sndProcessTaskRecoverFinishReq(pSnode, pMsg);
+ case TDMT_STREAM_RECOVER_FINISH_RSP:
+ return sndProcessTaskRecoverFinishRsp(pSnode, pMsg);
default:
ASSERT(0);
}
diff --git a/source/dnode/vnode/inc/vnode.h b/source/dnode/vnode/inc/vnode.h
index 6200c88d75..370103c222 100644
--- a/source/dnode/vnode/inc/vnode.h
+++ b/source/dnode/vnode/inc/vnode.h
@@ -83,7 +83,6 @@ int32_t vnodePreprocessQueryMsg(SVnode *pVnode, SRpcMsg *pMsg);
int32_t vnodeProcessWriteMsg(SVnode *pVnode, SRpcMsg *pMsg, int64_t version, SRpcMsg *pRsp);
int32_t vnodeProcessSyncMsg(SVnode *pVnode, SRpcMsg *pMsg, SRpcMsg **pRsp);
-int32_t vnodeProcessSyncCtrlMsg(SVnode *pVnode, SRpcMsg *pMsg, SRpcMsg **pRsp);
int32_t vnodeProcessQueryMsg(SVnode *pVnode, SRpcMsg *pMsg);
int32_t vnodeProcessFetchMsg(SVnode *pVnode, SRpcMsg *pMsg, SQueueInfo *pInfo);
void vnodeProposeWriteMsg(SQueueInfo *pInfo, STaosQall *qall, int32_t numOfMsgs);
@@ -159,7 +158,7 @@ int32_t tsdbReaderOpen(SVnode *pVnode, SQueryTableDataCond *pCond, void *pTableL
void tsdbReaderClose(STsdbReader *pReader);
bool tsdbNextDataBlock(STsdbReader *pReader);
bool tsdbTableNextDataBlock(STsdbReader *pReader, uint64_t uid);
-void tsdbRetrieveDataBlockInfo(STsdbReader *pReader, SDataBlockInfo *pDataBlockInfo);
+void tsdbRetrieveDataBlockInfo(const STsdbReader *pReader, int32_t *rows, uint64_t *uid, STimeWindow *pWindow);
int32_t tsdbRetrieveDatablockSMA(STsdbReader *pReader, SColumnDataAgg ***pBlockStatis, bool *allHave);
SArray *tsdbRetrieveDataBlock(STsdbReader *pTsdbReadHandle, SArray *pColumnIdList);
int32_t tsdbReaderReset(STsdbReader *pReader, SQueryTableDataCond *pCond);
@@ -241,7 +240,7 @@ bool tqNextDataBlock(STqReader *pReader);
bool tqNextDataBlockFilterOut(STqReader *pReader, SHashObj *filterOutUids);
int32_t tqRetrieveDataBlock(SSDataBlock *pBlock, STqReader *pReader);
-void vnodeEnqueueStreamMsg(SVnode *pVnode, SRpcMsg *pMsg);
+int32_t vnodeEnqueueStreamMsg(SVnode *pVnode, SRpcMsg *pMsg);
// sma
int32_t smaGetTSmaDays(SVnodeCfg *pCfg, void *pCont, uint32_t contLen, int32_t *days);
diff --git a/source/dnode/vnode/src/inc/tsdb.h b/source/dnode/vnode/src/inc/tsdb.h
index c4e7ff92b7..afd53b8dda 100644
--- a/source/dnode/vnode/src/inc/tsdb.h
+++ b/source/dnode/vnode/src/inc/tsdb.h
@@ -643,6 +643,7 @@ typedef struct SSttBlockLoadInfo {
STSchema *pSchema;
int16_t *colIds;
int32_t numOfCols;
+ bool sttBlockLoaded;
} SSttBlockLoadInfo;
typedef struct SMergeTree {
diff --git a/source/dnode/vnode/src/inc/vnd.h b/source/dnode/vnode/src/inc/vnd.h
index 988ecc5dd3..d5ad500fdb 100644
--- a/source/dnode/vnode/src/inc/vnd.h
+++ b/source/dnode/vnode/src/inc/vnd.h
@@ -17,7 +17,6 @@
#define _TD_VND_H_
#include "sync.h"
-#include "syncTools.h"
#include "ttrace.h"
#include "vnodeInt.h"
diff --git a/source/dnode/vnode/src/inc/vnodeInt.h b/source/dnode/vnode/src/inc/vnodeInt.h
index 94178727be..44ecf64419 100644
--- a/source/dnode/vnode/src/inc/vnodeInt.h
+++ b/source/dnode/vnode/src/inc/vnodeInt.h
@@ -150,19 +150,19 @@ typedef struct {
int32_t metaGetStbStats(SMeta* pMeta, int64_t uid, SMetaStbStats* pInfo);
// tsdb
-int tsdbOpen(SVnode* pVnode, STsdb** ppTsdb, const char* dir, STsdbKeepCfg* pKeepCfg, int8_t rollback);
-int tsdbClose(STsdb** pTsdb);
-int32_t tsdbBegin(STsdb* pTsdb);
-int32_t tsdbCommit(STsdb* pTsdb);
-int32_t tsdbFinishCommit(STsdb* pTsdb);
-int32_t tsdbRollbackCommit(STsdb* pTsdb);
-int32_t tsdbDoRetention(STsdb* pTsdb, int64_t now);
-int tsdbScanAndConvertSubmitMsg(STsdb* pTsdb, SSubmitReq* pMsg);
-int tsdbInsertData(STsdb* pTsdb, int64_t version, SSubmitReq* pMsg, SSubmitRsp* pRsp);
-int32_t tsdbInsertTableData(STsdb* pTsdb, int64_t version, SSubmitMsgIter* pMsgIter, SSubmitBlk* pBlock,
- SSubmitBlkRsp* pRsp);
-int32_t tsdbDeleteTableData(STsdb* pTsdb, int64_t version, tb_uid_t suid, tb_uid_t uid, TSKEY sKey, TSKEY eKey);
-int32_t tsdbSetKeepCfg(STsdb* pTsdb, STsdbCfg* pCfg);
+int tsdbOpen(SVnode* pVnode, STsdb** ppTsdb, const char* dir, STsdbKeepCfg* pKeepCfg, int8_t rollback);
+int tsdbClose(STsdb** pTsdb);
+int32_t tsdbBegin(STsdb* pTsdb);
+int32_t tsdbCommit(STsdb* pTsdb);
+int32_t tsdbFinishCommit(STsdb* pTsdb);
+int32_t tsdbRollbackCommit(STsdb* pTsdb);
+int32_t tsdbDoRetention(STsdb* pTsdb, int64_t now);
+int tsdbScanAndConvertSubmitMsg(STsdb* pTsdb, SSubmitReq* pMsg);
+int tsdbInsertData(STsdb* pTsdb, int64_t version, SSubmitReq* pMsg, SSubmitRsp* pRsp);
+int32_t tsdbInsertTableData(STsdb* pTsdb, int64_t version, SSubmitMsgIter* pMsgIter, SSubmitBlk* pBlock,
+ SSubmitBlkRsp* pRsp);
+int32_t tsdbDeleteTableData(STsdb* pTsdb, int64_t version, tb_uid_t suid, tb_uid_t uid, TSKEY sKey, TSKEY eKey);
+int32_t tsdbSetKeepCfg(STsdb* pTsdb, STsdbCfg* pCfg);
// tq
int tqInit();
@@ -176,22 +176,26 @@ int32_t tqCheckColModifiable(STQ* pTq, int64_t tbUid, int32_t colId);
// tq-mq
int32_t tqProcessAddCheckInfoReq(STQ* pTq, int64_t version, char* msg, int32_t msgLen);
int32_t tqProcessDelCheckInfoReq(STQ* pTq, int64_t version, char* msg, int32_t msgLen);
-int32_t tqProcessVgChangeReq(STQ* pTq, int64_t version, char* msg, int32_t msgLen);
-int32_t tqProcessVgDeleteReq(STQ* pTq, int64_t version, char* msg, int32_t msgLen);
+int32_t tqProcessSubscribeReq(STQ* pTq, int64_t version, char* msg, int32_t msgLen);
+int32_t tqProcessDeleteSubReq(STQ* pTq, int64_t version, char* msg, int32_t msgLen);
int32_t tqProcessOffsetCommitReq(STQ* pTq, int64_t version, char* msg, int32_t msgLen);
int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg);
// tq-stream
int32_t tqProcessTaskDeployReq(STQ* pTq, int64_t version, char* msg, int32_t msgLen);
int32_t tqProcessTaskDropReq(STQ* pTq, int64_t version, char* msg, int32_t msgLen);
+int32_t tqProcessStreamTaskCheckReq(STQ* pTq, SRpcMsg* pMsg);
+int32_t tqProcessStreamTaskCheckRsp(STQ* pTq, int64_t version, char* msg, int32_t msgLen);
int32_t tqProcessSubmitReq(STQ* pTq, SSubmitReq* data, int64_t ver);
int32_t tqProcessDelReq(STQ* pTq, void* pReq, int32_t len, int64_t ver);
int32_t tqProcessTaskRunReq(STQ* pTq, SRpcMsg* pMsg);
int32_t tqProcessTaskDispatchReq(STQ* pTq, SRpcMsg* pMsg, bool exec);
-int32_t tqProcessTaskRecoverReq(STQ* pTq, SRpcMsg* pMsg);
int32_t tqProcessTaskDispatchRsp(STQ* pTq, SRpcMsg* pMsg);
-int32_t tqProcessTaskRecoverRsp(STQ* pTq, SRpcMsg* pMsg);
int32_t tqProcessTaskRetrieveReq(STQ* pTq, SRpcMsg* pMsg);
int32_t tqProcessTaskRetrieveRsp(STQ* pTq, SRpcMsg* pMsg);
+int32_t tqProcessTaskRecover1Req(STQ* pTq, SRpcMsg* pMsg);
+int32_t tqProcessTaskRecover2Req(STQ* pTq, int64_t version, char* msg, int32_t msgLen);
+int32_t tqProcessTaskRecoverFinishReq(STQ* pTq, SRpcMsg* pMsg);
+int32_t tqProcessTaskRecoverFinishRsp(STQ* pTq, SRpcMsg* pMsg);
SSubmitReq* tqBlockToSubmit(SVnode* pVnode, const SArray* pBlocks, const STSchema* pSchema,
SSchemaWrapper* pTagSchemaWrapper, bool createTb, int64_t suid, const char* stbFullName,
diff --git a/source/dnode/vnode/src/meta/metaTable.c b/source/dnode/vnode/src/meta/metaTable.c
index 1196b512d3..6dadce80ca 100644
--- a/source/dnode/vnode/src/meta/metaTable.c
+++ b/source/dnode/vnode/src/meta/metaTable.c
@@ -53,7 +53,7 @@ static void metaGetEntryInfo(const SMetaEntry *pEntry, SMetaInfo *pInfo) {
static int metaUpdateMetaRsp(tb_uid_t uid, char *tbName, SSchemaWrapper *pSchema, STableMetaRsp *pMetaRsp) {
pMetaRsp->pSchemas = taosMemoryMalloc(pSchema->nCols * sizeof(SSchema));
if (NULL == pMetaRsp->pSchemas) {
- terrno = TSDB_CODE_VND_OUT_OF_MEMORY;
+ terrno = TSDB_CODE_OUT_OF_MEMORY;
return -1;
}
@@ -498,7 +498,7 @@ int metaDropTable(SMeta *pMeta, int64_t version, SVDropTbReq *pReq, SArray *tbUi
rc = tdbTbGet(pMeta->pNameIdx, pReq->name, strlen(pReq->name) + 1, &pData, &nData);
if (rc < 0) {
- terrno = TSDB_CODE_VND_TABLE_NOT_EXIST;
+ terrno = TSDB_CODE_TDB_TABLE_NOT_EXIST;
return -1;
}
uid = *(tb_uid_t *)pData;
@@ -743,7 +743,7 @@ static int metaAlterTableColumn(SMeta *pMeta, int64_t version, SVAlterTbReq *pAl
// search name index
ret = tdbTbGet(pMeta->pNameIdx, pAlterTbReq->tbName, strlen(pAlterTbReq->tbName) + 1, &pVal, &nVal);
if (ret < 0) {
- terrno = TSDB_CODE_VND_TABLE_NOT_EXIST;
+ terrno = TSDB_CODE_TDB_TABLE_NOT_EXIST;
return -1;
}
@@ -824,7 +824,7 @@ static int metaAlterTableColumn(SMeta *pMeta, int64_t version, SVAlterTbReq *pAl
break;
case TSDB_ALTER_TABLE_DROP_COLUMN:
if (pColumn == NULL) {
- terrno = TSDB_CODE_VND_TABLE_COL_NOT_EXISTS;
+ terrno = TSDB_CODE_VND_COL_NOT_EXISTS;
goto _err;
}
if (pColumn->colId == 0) {
@@ -846,7 +846,7 @@ static int metaAlterTableColumn(SMeta *pMeta, int64_t version, SVAlterTbReq *pAl
break;
case TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES:
if (pColumn == NULL) {
- terrno = TSDB_CODE_VND_TABLE_COL_NOT_EXISTS;
+ terrno = TSDB_CODE_VND_COL_NOT_EXISTS;
goto _err;
}
if (!IS_VAR_DATA_TYPE(pColumn->type) || pColumn->bytes > pAlterTbReq->colModBytes) {
@@ -866,7 +866,7 @@ static int metaAlterTableColumn(SMeta *pMeta, int64_t version, SVAlterTbReq *pAl
goto _err;
}
if (pColumn == NULL) {
- terrno = TSDB_CODE_VND_TABLE_COL_NOT_EXISTS;
+ terrno = TSDB_CODE_VND_COL_NOT_EXISTS;
goto _err;
}
if (tqCheckColModifiable(pMeta->pVnode->pTq, uid, pColumn->colId) != 0) {
@@ -934,7 +934,7 @@ static int metaUpdateTableTagVal(SMeta *pMeta, int64_t version, SVAlterTbReq *pA
// search name index
ret = tdbTbGet(pMeta->pNameIdx, pAlterTbReq->tbName, strlen(pAlterTbReq->tbName) + 1, &pVal, &nVal);
if (ret < 0) {
- terrno = TSDB_CODE_VND_TABLE_NOT_EXIST;
+ terrno = TSDB_CODE_TDB_TABLE_NOT_EXIST;
return -1;
}
@@ -990,7 +990,7 @@ static int metaUpdateTableTagVal(SMeta *pMeta, int64_t version, SVAlterTbReq *pA
}
if (pColumn == NULL) {
- terrno = TSDB_CODE_VND_TABLE_COL_NOT_EXISTS;
+ terrno = TSDB_CODE_VND_COL_NOT_EXISTS;
goto _err;
}
@@ -1093,7 +1093,7 @@ static int metaUpdateTableOptions(SMeta *pMeta, int64_t version, SVAlterTbReq *p
// search name index
ret = tdbTbGet(pMeta->pNameIdx, pAlterTbReq->tbName, strlen(pAlterTbReq->tbName) + 1, &pVal, &nVal);
if (ret < 0) {
- terrno = TSDB_CODE_VND_TABLE_NOT_EXIST;
+ terrno = TSDB_CODE_TDB_TABLE_NOT_EXIST;
return -1;
}
diff --git a/source/dnode/vnode/src/sma/smaTimeRange.c b/source/dnode/vnode/src/sma/smaTimeRange.c
index b0ae972635..f5ba7b5014 100644
--- a/source/dnode/vnode/src/sma/smaTimeRange.c
+++ b/source/dnode/vnode/src/sma/smaTimeRange.c
@@ -197,7 +197,7 @@ static int32_t tdProcessTSmaInsertImpl(SSma *pSma, int64_t indexUid, const char
}
if (pTsmaStat->pTSma->indexUid != indexUid) {
- terrno = TSDB_CODE_VND_APP_ERROR;
+ terrno = TSDB_CODE_APP_ERROR;
smaError("vgId:%d, tsma insert for smaIndex %" PRIi64 "(!=%" PRIi64 ") failed since %s", SMA_VID(pSma), indexUid,
pTsmaStat->pTSma->indexUid, tstrerror(terrno));
goto _err;
diff --git a/source/dnode/vnode/src/tq/tq.c b/source/dnode/vnode/src/tq/tq.c
index 2c01645389..9c377fe7f5 100644
--- a/source/dnode/vnode/src/tq/tq.c
+++ b/source/dnode/vnode/src/tq/tq.c
@@ -709,7 +709,7 @@ int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg) {
return 0;
}
-int32_t tqProcessVgDeleteReq(STQ* pTq, int64_t version, char* msg, int32_t msgLen) {
+int32_t tqProcessDeleteSubReq(STQ* pTq, int64_t version, char* msg, int32_t msgLen) {
SMqVDeleteReq* pReq = (SMqVDeleteReq*)msg;
taosWLockLatch(&pTq->pushLock);
@@ -767,7 +767,7 @@ int32_t tqProcessDelCheckInfoReq(STQ* pTq, int64_t version, char* msg, int32_t m
return 0;
}
-int32_t tqProcessVgChangeReq(STQ* pTq, int64_t version, char* msg, int32_t msgLen) {
+int32_t tqProcessSubscribeReq(STQ* pTq, int64_t version, char* msg, int32_t msgLen) {
SMqRebVgReq req = {0};
tDecodeSMqRebVgReq(msg, &req);
// todo lock
@@ -896,6 +896,10 @@ int32_t tqExpandTask(STQ* pTq, SStreamTask* pTask, int64_t ver) {
pTask->startVer = ver;
// expand executor
+ if (pTask->fillHistory) {
+ pTask->taskStatus = TASK_STATUS__WAIT_DOWNSTREAM;
+ }
+
if (pTask->taskLevel == TASK_LEVEL__SOURCE) {
pTask->pState = streamStateOpen(pTq->pStreamMeta->path, pTask, false, -1, -1);
if (pTask->pState == NULL) {
@@ -911,9 +915,6 @@ int32_t tqExpandTask(STQ* pTq, SStreamTask* pTask, int64_t ver) {
pTask->exec.executor = qCreateStreamExecTaskInfo(pTask->exec.qmsg, &handle);
ASSERT(pTask->exec.executor);
- if (pTask->fillHistory) {
- pTask->taskStatus = TASK_STATUS__RECOVER_PREPARE;
- }
} else if (pTask->taskLevel == TASK_LEVEL__AGG) {
pTask->pState = streamStateOpen(pTq->pStreamMeta->path, pTask, false, -1, -1);
if (pTask->pState == NULL) {
@@ -947,11 +948,90 @@ int32_t tqExpandTask(STQ* pTq, SStreamTask* pTask, int64_t ver) {
streamSetupTrigger(pTask);
- tqInfo("expand stream task on vg %d, task id %d, child id %d", TD_VID(pTq->pVnode), pTask->taskId,
- pTask->selfChildId);
+ tqInfo("expand stream task on vg %d, task id %d, child id %d, level %d", TD_VID(pTq->pVnode), pTask->taskId,
+ pTask->selfChildId, pTask->taskLevel);
return 0;
}
+int32_t tqProcessStreamTaskCheckReq(STQ* pTq, SRpcMsg* pMsg) {
+ char* msgStr = pMsg->pCont;
+ char* msgBody = POINTER_SHIFT(msgStr, sizeof(SMsgHead));
+ int32_t msgLen = pMsg->contLen - sizeof(SMsgHead);
+ SStreamTaskCheckReq req;
+ SDecoder decoder;
+ tDecoderInit(&decoder, msgBody, msgLen);
+ tDecodeSStreamTaskCheckReq(&decoder, &req);
+ tDecoderClear(&decoder);
+ int32_t taskId = req.downstreamTaskId;
+ SStreamTaskCheckRsp rsp = {
+ .reqId = req.reqId,
+ .streamId = req.streamId,
+ .childId = req.childId,
+ .downstreamNodeId = req.downstreamNodeId,
+ .downstreamTaskId = req.downstreamTaskId,
+ .upstreamNodeId = req.upstreamNodeId,
+ .upstreamTaskId = req.upstreamTaskId,
+ };
+ SStreamTask* pTask = streamMetaGetTask(pTq->pStreamMeta, taskId);
+ if (pTask && atomic_load_8(&pTask->taskStatus) == TASK_STATUS__NORMAL) {
+ rsp.status = 1;
+ } else {
+ rsp.status = 0;
+ }
+
+ tqDebug("tq recv task check req(reqId: %" PRId64 ") %d at node %d check req from task %d at node %d, status %d",
+ rsp.reqId, rsp.downstreamTaskId, rsp.downstreamNodeId, rsp.upstreamTaskId, rsp.upstreamNodeId, rsp.status);
+
+ SEncoder encoder;
+ int32_t code;
+ int32_t len;
+ tEncodeSize(tEncodeSStreamTaskCheckRsp, &rsp, len, code);
+ if (code < 0) {
+ ASSERT(0);
+ }
+ void* buf = rpcMallocCont(sizeof(SMsgHead) + len);
+ ((SMsgHead*)buf)->vgId = htonl(req.upstreamNodeId);
+
+ void* abuf = POINTER_SHIFT(buf, sizeof(SMsgHead));
+ tEncoderInit(&encoder, (uint8_t*)abuf, len);
+ tEncodeSStreamTaskCheckRsp(&encoder, &rsp);
+ tEncoderClear(&encoder);
+
+ SRpcMsg rspMsg = {
+ .code = 0,
+ .pCont = buf,
+ .contLen = sizeof(SMsgHead) + len,
+ .info = pMsg->info,
+ };
+
+ tmsgSendRsp(&rspMsg);
+ return 0;
+}
+
+int32_t tqProcessStreamTaskCheckRsp(STQ* pTq, int64_t version, char* msg, int32_t msgLen) {
+ int32_t code;
+ SStreamTaskCheckRsp rsp;
+
+ SDecoder decoder;
+ tDecoderInit(&decoder, (uint8_t*)msg, msgLen);
+ code = tDecodeSStreamTaskCheckRsp(&decoder, &rsp);
+ if (code < 0) {
+ tDecoderClear(&decoder);
+ return -1;
+ }
+ tDecoderClear(&decoder);
+
+ tqDebug("tq recv task check rsp(reqId: %" PRId64 ") %d at node %d check req from task %d at node %d, status %d",
+ rsp.reqId, rsp.downstreamTaskId, rsp.downstreamNodeId, rsp.upstreamTaskId, rsp.upstreamNodeId, rsp.status);
+
+ SStreamTask* pTask = streamMetaGetTask(pTq->pStreamMeta, rsp.upstreamTaskId);
+ if (pTask == NULL) {
+ return -1;
+ }
+
+ return streamProcessTaskCheckRsp(pTask, &rsp, version);
+}
+
int32_t tqProcessTaskDeployReq(STQ* pTq, int64_t version, char* msg, int32_t msgLen) {
int32_t code;
#if 0
@@ -982,36 +1062,17 @@ int32_t tqProcessTaskDeployReq(STQ* pTq, int64_t version, char* msg, int32_t msg
// 3.go through recover steps to fill history
if (pTask->fillHistory) {
- streamSetParamForRecover(pTask);
- if (pTask->taskLevel == TASK_LEVEL__SOURCE) {
- streamSourceRecoverPrepareStep1(pTask, version);
-
- SStreamRecoverStep1Req req;
- streamBuildSourceRecover1Req(pTask, &req);
-
- void* serialziedReq = (void*)&req;
- int32_t len = sizeof(SStreamRecoverStep1Req);
-
- SRpcMsg rpcMsg = {
- .contLen = len,
- .pCont = serialziedReq,
- .msgType = TDMT_VND_STREAM_RECOVER_STEP1,
- };
-
- tmsgPutToQueue(&pTq->pVnode->msgCb, STREAM_QUEUE, &rpcMsg);
-
- } else if (pTask->taskLevel == TASK_LEVEL__AGG) {
- streamAggRecoverPrepare(pTask);
- } else if (pTask->taskLevel == TASK_LEVEL__SINK) {
- // do nothing
- }
+ streamTaskCheckDownstream(pTask, version);
}
return 0;
}
-int32_t tqProcessTaskRecover1Req(STQ* pTq, char* msg, int32_t msgLen) {
- int32_t code;
+int32_t tqProcessTaskRecover1Req(STQ* pTq, SRpcMsg* pMsg) {
+ int32_t code;
+ char* msg = pMsg->pCont;
+ int32_t msgLen = pMsg->contLen;
+
SStreamRecoverStep1Req* pReq = (SStreamRecoverStep1Req*)msg;
SStreamTask* pTask = streamMetaGetTask(pTq->pStreamMeta, pReq->taskId);
if (pTask == NULL) {
@@ -1035,16 +1096,24 @@ int32_t tqProcessTaskRecover1Req(STQ* pTq, char* msg, int32_t msgLen) {
return -1;
}
+ ASSERT(pReq->taskId == pTask->taskId);
+
// serialize msg
- int32_t len = sizeof(SStreamRecoverStep2Req);
- void* serializedReq = (void*)&req;
+ int32_t len = sizeof(SStreamRecoverStep1Req);
+
+ void* serializedReq = rpcMallocCont(len);
+ if (serializedReq == NULL) {
+ return -1;
+ }
+
+ memcpy(serializedReq, &req, len);
// dispatch msg
SRpcMsg rpcMsg = {
.code = 0,
.contLen = len,
.msgType = TDMT_VND_STREAM_RECOVER_STEP2,
- .pCont = (void*)serializedReq,
+ .pCont = serializedReq,
};
tmsgPutToQueue(&pTq->pVnode->msgCb, WRITE_QUEUE, &rpcMsg);
@@ -1087,15 +1156,15 @@ int32_t tqProcessTaskRecover2Req(STQ* pTq, int64_t version, char* msg, int32_t m
return 0;
}
-int32_t tqProcessTaskRecoverFinishReq(STQ* pTq, char* msg, int32_t msgLen) {
- int32_t code;
+int32_t tqProcessTaskRecoverFinishReq(STQ* pTq, SRpcMsg* pMsg) {
+ char* msg = POINTER_SHIFT(pMsg->pCont, sizeof(SMsgHead));
+ int32_t msgLen = pMsg->contLen - sizeof(SMsgHead);
// deserialize
- int32_t len;
SStreamRecoverFinishReq req;
SDecoder decoder;
- tDecoderInit(&decoder, msg, sizeof(SStreamRecoverFinishReq));
+ tDecoderInit(&decoder, msg, msgLen);
tDecodeSStreamRecoverFinishReq(&decoder, &req);
tDecoderClear(&decoder);
@@ -1112,6 +1181,11 @@ int32_t tqProcessTaskRecoverFinishReq(STQ* pTq, char* msg, int32_t msgLen) {
return 0;
}
+int32_t tqProcessTaskRecoverFinishRsp(STQ* pTq, SRpcMsg* pMsg) {
+ //
+ return 0;
+}
+
int32_t tqProcessDelReq(STQ* pTq, void* pReq, int32_t len, int64_t ver) {
bool failed = false;
SDecoder* pCoder = &(SDecoder){0};
@@ -1235,7 +1309,7 @@ int32_t tqProcessSubmitReq(STQ* pTq, SSubmitReq* pReq, int64_t ver) {
pSubmit = streamDataSubmitNew(pReq);
if (pSubmit == NULL) {
terrno = TSDB_CODE_OUT_OF_MEMORY;
- qError("failed to create data submit for stream since out of memory");
+ tqError("failed to create data submit for stream since out of memory");
failed = true;
}
@@ -1244,18 +1318,21 @@ int32_t tqProcessSubmitReq(STQ* pTq, SSubmitReq* pReq, int64_t ver) {
if (pIter == NULL) break;
SStreamTask* pTask = *(SStreamTask**)pIter;
if (pTask->taskLevel != TASK_LEVEL__SOURCE) continue;
- if (pTask->taskStatus == TASK_STATUS__RECOVER_PREPARE || pTask->taskStatus == TASK_STATUS__RECOVER1) continue;
+ if (pTask->taskStatus == TASK_STATUS__RECOVER_PREPARE || pTask->taskStatus == TASK_STATUS__WAIT_DOWNSTREAM) {
+ tqDebug("skip push task %d, task status %d", pTask->taskId, pTask->taskStatus);
+ continue;
+ }
- qDebug("data submit enqueue stream task: %d, ver: %" PRId64, pTask->taskId, ver);
+ tqDebug("data submit enqueue stream task: %d, ver: %" PRId64, pTask->taskId, ver);
if (!failed) {
if (streamTaskInput(pTask, (SStreamQueueItem*)pSubmit) < 0) {
- qError("stream task input failed, task id %d", pTask->taskId);
+ tqError("stream task input failed, task id %d", pTask->taskId);
continue;
}
if (streamSchedExec(pTask) < 0) {
- qError("stream task launch failed, task id %d", pTask->taskId);
+ tqError("stream task launch failed, task id %d", pTask->taskId);
continue;
}
} else {
@@ -1306,39 +1383,13 @@ int32_t tqProcessTaskDispatchReq(STQ* pTq, SRpcMsg* pMsg, bool exec) {
}
}
-#if 0
-int32_t tqProcessTaskRecoverReq(STQ* pTq, SRpcMsg* pMsg) {
- SStreamTaskRecoverReq* pReq = pMsg->pCont;
- int32_t taskId = pReq->taskId;
- SStreamTask* pTask = streamMetaGetTask(pTq->pStreamMeta, taskId);
- if (pTask) {
- streamProcessRecoverReq(pTask, pReq, pMsg);
- return 0;
- } else {
- return -1;
- }
-}
-
-int32_t tqProcessTaskRecoverRsp(STQ* pTq, SRpcMsg* pMsg) {
- SStreamTaskRecoverRsp* pRsp = pMsg->pCont;
- int32_t taskId = pRsp->rspTaskId;
-
- SStreamTask* pTask = streamMetaGetTask(pTq->pStreamMeta, taskId);
- if (pTask) {
- streamProcessRecoverRsp(pTask, pRsp);
- return 0;
- } else {
- return -1;
- }
-}
-#endif
-
int32_t tqProcessTaskDispatchRsp(STQ* pTq, SRpcMsg* pMsg) {
SStreamDispatchRsp* pRsp = POINTER_SHIFT(pMsg->pCont, sizeof(SMsgHead));
- int32_t taskId = pRsp->taskId;
+ int32_t taskId = ntohl(pRsp->upstreamTaskId);
SStreamTask* pTask = streamMetaGetTask(pTq->pStreamMeta, taskId);
+ tqDebug("recv dispatch rsp, code: %x", pMsg->code);
if (pTask) {
- streamProcessDispatchRsp(pTask, pRsp);
+ streamProcessDispatchRsp(pTask, pRsp, pMsg->code);
return 0;
} else {
return -1;
@@ -1379,12 +1430,12 @@ int32_t tqProcessTaskRetrieveRsp(STQ* pTq, SRpcMsg* pMsg) {
return 0;
}
-void vnodeEnqueueStreamMsg(SVnode* pVnode, SRpcMsg* pMsg) {
- STQ* pTq = pVnode->pTq;
- char* msgStr = pMsg->pCont;
- char* msgBody = POINTER_SHIFT(msgStr, sizeof(SMsgHead));
- int32_t msgLen = pMsg->contLen - sizeof(SMsgHead);
- int32_t code = 0;
+int32_t vnodeEnqueueStreamMsg(SVnode* pVnode, SRpcMsg* pMsg) {
+ STQ* pTq = pVnode->pTq;
+ SMsgHead* msgStr = pMsg->pCont;
+ char* msgBody = POINTER_SHIFT(msgStr, sizeof(SMsgHead));
+ int32_t msgLen = pMsg->contLen - sizeof(SMsgHead);
+ int32_t code = 0;
SStreamDispatchReq req;
SDecoder decoder;
@@ -1407,16 +1458,45 @@ void vnodeEnqueueStreamMsg(SVnode* pVnode, SRpcMsg* pMsg) {
streamProcessDispatchReq(pTask, &req, &rsp, false);
rpcFreeCont(pMsg->pCont);
taosFreeQitem(pMsg);
- return;
+ return 0;
}
+ code = TSDB_CODE_STREAM_TASK_NOT_EXIST;
+
FAIL:
- if (pMsg->info.handle == NULL) return;
+ if (pMsg->info.handle == NULL) return -1;
+
+ SMsgHead* pRspHead = rpcMallocCont(sizeof(SMsgHead) + sizeof(SStreamDispatchRsp));
+ if (pRspHead == NULL) {
+ SRpcMsg rsp = {
+ .code = TSDB_CODE_OUT_OF_MEMORY,
+ .info = pMsg->info,
+ };
+ tqDebug("send dispatch error rsp, code: %x", code);
+ tmsgSendRsp(&rsp);
+ rpcFreeCont(pMsg->pCont);
+ taosFreeQitem(pMsg);
+ return -1;
+ }
+
+ pRspHead->vgId = htonl(req.upstreamNodeId);
+ SStreamDispatchRsp* pRsp = POINTER_SHIFT(pRspHead, sizeof(SMsgHead));
+ pRsp->streamId = htobe64(req.streamId);
+ pRsp->upstreamTaskId = htonl(req.upstreamTaskId);
+ pRsp->upstreamNodeId = htonl(req.upstreamNodeId);
+ pRsp->downstreamNodeId = htonl(pVnode->config.vgId);
+ pRsp->downstreamTaskId = htonl(req.taskId);
+ pRsp->inputStatus = TASK_OUTPUT_STATUS__NORMAL;
+
SRpcMsg rsp = {
.code = code,
.info = pMsg->info,
+ .contLen = sizeof(SMsgHead) + sizeof(SStreamDispatchRsp),
+ .pCont = pRspHead,
};
+ tqDebug("send dispatch error rsp, code: %x", code);
tmsgSendRsp(&rsp);
rpcFreeCont(pMsg->pCont);
taosFreeQitem(pMsg);
+ return -1;
}
diff --git a/source/dnode/vnode/src/tq/tqRead.c b/source/dnode/vnode/src/tq/tqRead.c
index 2f6ec0c39f..48e69f8f4d 100644
--- a/source/dnode/vnode/src/tq/tqRead.c
+++ b/source/dnode/vnode/src/tq/tqRead.c
@@ -199,6 +199,9 @@ int64_t tqFetchLog(STQ* pTq, STqHandle* pHandle, int64_t* fetchOffset, SWalCkHea
goto END;
}
+ tqDebug("vgId:%d, taosx get msg ver %" PRId64 ", type: %s", pTq->pVnode->config.vgId, offset,
+ TMSG_INFO((*ppCkHead)->head.msgType));
+
if ((*ppCkHead)->head.msgType == TDMT_VND_SUBMIT) {
code = walFetchBody(pHandle->pWalReader, ppCkHead);
@@ -216,17 +219,20 @@ int64_t tqFetchLog(STQ* pTq, STqHandle* pHandle, int64_t* fetchOffset, SWalCkHea
SWalCont* pHead = &((*ppCkHead)->head);
if (IS_META_MSG(pHead->msgType)) {
code = walFetchBody(pHandle->pWalReader, ppCkHead);
-
if (code < 0) {
ASSERT(0);
*fetchOffset = offset;
code = -1;
goto END;
}
+
if (isValValidForTable(pHandle, pHead)) {
*fetchOffset = offset;
code = 0;
goto END;
+ } else {
+ offset++;
+ continue;
}
}
}
@@ -586,8 +592,39 @@ int32_t tqUpdateTbUidList(STQ* pTq, const SArray* tbUidList, bool isAdd) {
taosHashPut(pExec->execHandle.execDb.pFilterOutTbUid, &tbUid, sizeof(int64_t), NULL, 0);
}
}
+ } else if (pExec->execHandle.subType == TOPIC_SUB_TYPE__TABLE) {
+ if (isAdd) {
+ SArray* qa = taosArrayInit(4, sizeof(tb_uid_t));
+ SMetaReader mr = {0};
+ metaReaderInit(&mr, pTq->pVnode->pMeta, 0);
+ for (int32_t i = 0; i < taosArrayGetSize(tbUidList); ++i) {
+ uint64_t* id = (uint64_t*)taosArrayGet(tbUidList, i);
+
+ int32_t code = metaGetTableEntryByUid(&mr, *id);
+ if (code != TSDB_CODE_SUCCESS) {
+ qError("failed to get table meta, uid:%" PRIu64 " code:%s", *id, tstrerror(terrno));
+ continue;
+ }
+
+ tDecoderClear(&mr.coder);
+
+ if (mr.me.type != TSDB_CHILD_TABLE || mr.me.ctbEntry.suid != pExec->execHandle.execTb.suid) {
+ tqDebug("table uid %" PRId64 " does not add to tq handle", *id);
+ continue;
+ }
+ tqDebug("table uid %" PRId64 " add to tq handle", *id);
+ taosArrayPush(qa, id);
+ }
+ metaReaderClear(&mr);
+ if (taosArrayGetSize(qa) > 0) {
+ tqReaderAddTbUidList(pExec->execHandle.pExecReader, qa);
+ }
+ taosArrayDestroy(qa);
+ } else {
+ // TODO handle delete table from stb
+ }
} else {
- // tq update id
+ ASSERT(0);
}
}
while (1) {
diff --git a/source/dnode/vnode/src/tsdb/tsdbCache.c b/source/dnode/vnode/src/tsdb/tsdbCache.c
index a964a46406..76236e5078 100644
--- a/source/dnode/vnode/src/tsdb/tsdbCache.c
+++ b/source/dnode/vnode/src/tsdb/tsdbCache.c
@@ -684,7 +684,7 @@ static int32_t getNextRowFromFS(void *iter, TSDBROW **ppRow) {
if (*state->pDataFReader != NULL) {
tsdbDataFReaderClose(state->pDataFReader);
- resetLastBlockLoadInfo(state->pLoadInfo);
+ // resetLastBlockLoadInfo(state->pLoadInfo);
}
code = tsdbDataFReaderOpen(state->pDataFReader, state->pTsdb, pFileSet);
@@ -764,7 +764,7 @@ static int32_t getNextRowFromFS(void *iter, TSDBROW **ppRow) {
if (--state->iBlock < 0) {
tsdbDataFReaderClose(state->pDataFReader);
*state->pDataFReader = NULL;
- resetLastBlockLoadInfo(state->pLoadInfo);
+ // resetLastBlockLoadInfo(state->pLoadInfo);
if (state->aBlockIdx) {
taosArrayDestroy(state->aBlockIdx);
diff --git a/source/dnode/vnode/src/tsdb/tsdbCacheRead.c b/source/dnode/vnode/src/tsdb/tsdbCacheRead.c
index dbc02363ea..2ae3115c0a 100644
--- a/source/dnode/vnode/src/tsdb/tsdbCacheRead.c
+++ b/source/dnode/vnode/src/tsdb/tsdbCacheRead.c
@@ -333,11 +333,12 @@ int32_t tsdbRetrieveCacheRows(void* pReader, SSDataBlock* pResBlock, const int32
code = TSDB_CODE_INVALID_PARA;
}
- _end:
+_end:
tsdbDataFReaderClose(&pr->pDataFReaderLast);
tsdbDataFReaderClose(&pr->pDataFReader);
tsdbUntakeReadSnap(pr->pVnode->pTsdb, pr->pReadSnap, "cache-l");
+ resetLastBlockLoadInfo(pr->pLoadInfo);
for (int32_t j = 0; j < pr->numOfCols; ++j) {
taosMemoryFree(pRes[j]);
diff --git a/source/dnode/vnode/src/tsdb/tsdbMemTable.c b/source/dnode/vnode/src/tsdb/tsdbMemTable.c
index 0189ced3c6..48b3e9ff77 100644
--- a/source/dnode/vnode/src/tsdb/tsdbMemTable.c
+++ b/source/dnode/vnode/src/tsdb/tsdbMemTable.c
@@ -116,6 +116,13 @@ int32_t tsdbInsertTableData(STsdb *pTsdb, int64_t version, SSubmitMsgIter *pMsgI
if (info.suid) {
metaGetInfo(pTsdb->pVnode->pMeta, info.suid, &info);
}
+ if (pMsgIter->sversion != info.skmVer) {
+ tsdbError("vgId:%d, req sver:%d, skmVer:%d suid:%" PRId64 " uid:%" PRId64,
+ TD_VID(pTsdb->pVnode), pMsgIter->sversion, info.skmVer, suid, uid);
+ code = TSDB_CODE_TDB_INVALID_TABLE_SCHEMA_VER;
+ goto _err;
+ }
+
pRsp->sver = info.skmVer;
// create/get STbData to op
@@ -133,6 +140,7 @@ int32_t tsdbInsertTableData(STsdb *pTsdb, int64_t version, SSubmitMsgIter *pMsgI
return code;
_err:
+ terrno = code;
return code;
}
diff --git a/source/dnode/vnode/src/tsdb/tsdbMergeTree.c b/source/dnode/vnode/src/tsdb/tsdbMergeTree.c
index 745b877f09..0b614fd2db 100644
--- a/source/dnode/vnode/src/tsdb/tsdbMergeTree.c
+++ b/source/dnode/vnode/src/tsdb/tsdbMergeTree.c
@@ -72,6 +72,7 @@ void resetLastBlockLoadInfo(SSttBlockLoadInfo *pLoadInfo) {
pLoadInfo[i].elapsedTime = 0;
pLoadInfo[i].loadBlocks = 0;
+ pLoadInfo[i].sttBlockLoaded = false;
}
}
@@ -278,9 +279,10 @@ int32_t tLDataIterOpen(struct SLDataIter **pIter, SDataFReader *pReader, int32_t
(*pIter)->pBlockLoadInfo = pBlockLoadInfo;
- size_t size = taosArrayGetSize(pBlockLoadInfo->aSttBlk);
- if (size == 0) {
+// size_t size = taosArrayGetSize(pBlockLoadInfo->aSttBlk);
+ if (!pBlockLoadInfo->sttBlockLoaded) {
int64_t st = taosGetTimestampUs();
+ pBlockLoadInfo->sttBlockLoaded = true;
code = tsdbReadSttBlk(pReader, iStt, pBlockLoadInfo->aSttBlk);
if (code) {
@@ -288,7 +290,7 @@ int32_t tLDataIterOpen(struct SLDataIter **pIter, SDataFReader *pReader, int32_t
}
// only apply to the child tables, ordinary tables will not incur this filter procedure.
- size = taosArrayGetSize(pBlockLoadInfo->aSttBlk);
+ size_t size = taosArrayGetSize(pBlockLoadInfo->aSttBlk);
if (size >= 1) {
SSttBlk *pStart = taosArrayGet(pBlockLoadInfo->aSttBlk, 0);
@@ -296,10 +298,10 @@ int32_t tLDataIterOpen(struct SLDataIter **pIter, SDataFReader *pReader, int32_t
// all identical
if (pStart->suid == pEnd->suid) {
- if (pStart->suid == suid) {
- // do nothing
- } else if (pStart->suid != suid) {
+ if (pStart->suid != suid) {
// no qualified stt block existed
+ taosArrayClear(pBlockLoadInfo->aSttBlk);
+
(*pIter)->iSttBlk = -1;
double el = (taosGetTimestampUs() - st) / 1000.0;
tsdbDebug("load the last file info completed, elapsed time:%.2fms, %s", el, idStr);
@@ -330,7 +332,7 @@ int32_t tLDataIterOpen(struct SLDataIter **pIter, SDataFReader *pReader, int32_t
tsdbDebug("load the last file info completed, elapsed time:%.2fms, %s", el, idStr);
}
- size = taosArrayGetSize(pBlockLoadInfo->aSttBlk);
+ size_t size = taosArrayGetSize(pBlockLoadInfo->aSttBlk);
// find the start block
(*pIter)->iSttBlk = binarySearchForStartBlock(pBlockLoadInfo->aSttBlk->pData, size, uid, backward);
diff --git a/source/dnode/vnode/src/tsdb/tsdbOpen.c b/source/dnode/vnode/src/tsdb/tsdbOpen.c
index efc74b68ba..bb20a9b012 100644
--- a/source/dnode/vnode/src/tsdb/tsdbOpen.c
+++ b/source/dnode/vnode/src/tsdb/tsdbOpen.c
@@ -48,7 +48,7 @@ int tsdbOpen(SVnode *pVnode, STsdb **ppTsdb, const char *dir, STsdbKeepCfg *pKee
}
pTsdb->path = (char *)&pTsdb[1];
- sprintf(pTsdb->path, "%s%s%s", pVnode->path, TD_DIRSEP, dir);
+ snprintf(pTsdb->path, TD_PATH_MAX, "%s%s%s", pVnode->path, TD_DIRSEP, dir);
taosRealPath(pTsdb->path, NULL, slen);
pTsdb->pVnode = pVnode;
taosThreadRwlockInit(&pTsdb->rwLock, NULL);
diff --git a/source/dnode/vnode/src/tsdb/tsdbRead.c b/source/dnode/vnode/src/tsdb/tsdbRead.c
index 5f90c567be..5dbeaa3fc7 100644
--- a/source/dnode/vnode/src/tsdb/tsdbRead.c
+++ b/source/dnode/vnode/src/tsdb/tsdbRead.c
@@ -35,11 +35,17 @@ typedef struct {
int32_t numOfLastFiles;
} SBlockNumber;
+typedef struct SBlockIndex {
+ int32_t ordinalIndex;
+ int64_t inFileOffset;
+ STimeWindow window;
+} SBlockIndex;
+
typedef struct STableBlockScanInfo {
uint64_t uid;
TSKEY lastKey;
SMapData mapData; // block info (compressed)
- SArray* pBlockList; // block data index list
+ SArray* pBlockList; // block data index list, SArray
SIterInfo iter; // mem buffer skip list iterator
SIterInfo iiter; // imem buffer skip list iterator
SArray* delSkyline; // delete info for this table
@@ -72,6 +78,7 @@ typedef struct SIOCostSummary {
double lastBlockLoadTime;
int64_t composedBlocks;
double buildComposedBlockTime;
+ double createScanInfoList;
} SIOCostSummary;
typedef struct SBlockLoadSuppInfo {
@@ -131,7 +138,7 @@ 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.
+ STableBlockScanInfo** pTableIter; // table iterator used in building in-memory buffer data blocks.
SUidOrderCheckInfo uidCheckInfo; // check all table in uid order
SFileBlockDumpInfo fBlockDumpInfo;
SDFileSet* pCurrentFileset; // current opened file set
@@ -140,6 +147,12 @@ typedef struct SReaderStatus {
SDataBlockIter blockIter;
} SReaderStatus;
+typedef struct SBlockInfoBuf {
+ int32_t currentIndex;
+ SArray* pData;
+ int32_t numPerBucket;
+} SBlockInfoBuf;
+
struct STsdbReader {
STsdb* pTsdb;
uint64_t suid;
@@ -157,9 +170,9 @@ struct STsdbReader {
STSchema* pMemSchema; // the previous schema for in-memory data, to avoid load schema too many times
SDataFReader* pFileReader;
SVersionRange verRange;
-
- int32_t step;
- STsdbReader* innerReader[2];
+ SBlockInfoBuf blockInfoBuf;
+ int32_t step;
+ STsdbReader* innerReader[2];
};
static SFileDataBlockInfo* getCurrentBlockInfo(SDataBlockIter* pBlockIter);
@@ -225,6 +238,50 @@ static int32_t setColumnIdSlotList(STsdbReader* pReader, SSDataBlock* pBlock) {
return TSDB_CODE_SUCCESS;
}
+static int32_t initBlockScanInfoBuf(SBlockInfoBuf* pBuf, int32_t numOfTables) {
+ int32_t num = numOfTables / pBuf->numPerBucket;
+ int32_t remainder = numOfTables % pBuf->numPerBucket;
+ if (pBuf->pData == NULL) {
+ pBuf->pData = taosArrayInit(num + 1, POINTER_BYTES);
+ }
+
+ for(int32_t i = 0; i < num; ++i) {
+ char* p = taosMemoryCalloc(pBuf->numPerBucket, sizeof(STableBlockScanInfo));
+ if (p == NULL) {
+ return TSDB_CODE_OUT_OF_MEMORY;
+ }
+
+ taosArrayPush(pBuf->pData, &p);
+ }
+
+ if (remainder > 0) {
+ char* p = taosMemoryCalloc(remainder, sizeof(STableBlockScanInfo));
+ if (p == NULL) {
+ return TSDB_CODE_OUT_OF_MEMORY;
+ }
+ taosArrayPush(pBuf->pData, &p);
+ }
+
+ return TSDB_CODE_SUCCESS;
+}
+
+static void clearBlockScanInfoBuf(SBlockInfoBuf* pBuf) {
+ size_t num = taosArrayGetSize(pBuf->pData);
+ for(int32_t i = 0; i < num; ++i) {
+ char** p = taosArrayGet(pBuf->pData, i);
+ taosMemoryFree(*p);
+ }
+
+ taosArrayDestroy(pBuf->pData);
+}
+
+static void* getPosInBlockInfoBuf(SBlockInfoBuf* pBuf, int32_t index) {
+ int32_t bucketIndex = index / pBuf->numPerBucket;
+ char** pBucket = taosArrayGet(pBuf->pData, bucketIndex);
+ return (*pBucket) + (index % pBuf->numPerBucket) * sizeof(STableBlockScanInfo);
+}
+
+// NOTE: speedup the whole processing by preparing the buffer for STableBlockScanInfo in batch model
static SHashObj* createDataBlockScanInfo(STsdbReader* pTsdbReader, const STableKeyInfo* idList, int32_t numOfTables) {
// allocate buffer in order to load data blocks from file
// todo use simple hash instead, optimize the memory consumption
@@ -234,8 +291,24 @@ static SHashObj* createDataBlockScanInfo(STsdbReader* pTsdbReader, const STableK
return NULL;
}
+ int64_t st = taosGetTimestampUs();
+ initBlockScanInfoBuf(&pTsdbReader->blockInfoBuf, numOfTables);
+
for (int32_t j = 0; j < numOfTables; ++j) {
- STableBlockScanInfo info = {.lastKey = 0, .uid = idList[j].uid};
+ STableBlockScanInfo* pScanInfo = getPosInBlockInfoBuf(&pTsdbReader->blockInfoBuf, j);
+ pScanInfo->uid = idList[j].uid;
+ if (ASCENDING_TRAVERSE(pTsdbReader->order)) {
+ int64_t skey = pTsdbReader->window.skey;
+ pScanInfo->lastKey = (skey > INT64_MIN) ? (skey - 1) : skey;
+ } else {
+ int64_t ekey = pTsdbReader->window.ekey;
+ pScanInfo->lastKey = (ekey < INT64_MAX) ? (ekey + 1) : ekey;
+ }
+
+ taosHashPut(pTableMap, &pScanInfo->uid, sizeof(uint64_t), &pScanInfo, POINTER_BYTES);
+
+#if 0
+// STableBlockScanInfo info = {.lastKey = 0, .uid = idList[j].uid};
if (ASCENDING_TRAVERSE(pTsdbReader->order)) {
int64_t skey = pTsdbReader->window.skey;
info.lastKey = (skey > INT64_MIN) ? (skey - 1) : skey;
@@ -245,28 +318,33 @@ static SHashObj* createDataBlockScanInfo(STsdbReader* pTsdbReader, const STableK
}
taosHashPut(pTableMap, &info.uid, sizeof(uint64_t), &info, sizeof(info));
- tsdbDebug("%p check table uid:%" PRId64 " from lastKey:%" PRId64 " %s", pTsdbReader, info.uid, info.lastKey,
+#endif
+
+ tsdbTrace("%p check table uid:%" PRId64 " from lastKey:%" PRId64 " %s", pTsdbReader, pScanInfo->uid, pScanInfo->lastKey,
pTsdbReader->idStr);
}
- tsdbDebug("%p create %d tables scan-info, size:%.2f Kb, %s", pTsdbReader, numOfTables,
- (sizeof(STableBlockScanInfo) * numOfTables) / 1024.0, pTsdbReader->idStr);
+ 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,
+ pTsdbReader->idStr);
return pTableMap;
}
-static void resetDataBlockScanInfo(SHashObj* pTableMap, int64_t ts) {
- STableBlockScanInfo* p = NULL;
-
+static void resetAllDataBlockScanInfo(SHashObj* pTableMap, int64_t ts) {
+ STableBlockScanInfo** p = NULL;
while ((p = taosHashIterate(pTableMap, p)) != NULL) {
- p->iterInit = false;
- p->iiter.hasVal = false;
- if (p->iter.iter != NULL) {
- p->iter.iter = tsdbTbDataIterDestroy(p->iter.iter);
+ STableBlockScanInfo* pInfo = *(STableBlockScanInfo**) p;
+
+ pInfo->iterInit = false;
+ pInfo->iiter.hasVal = false;
+ if (pInfo->iter.iter != NULL) {
+ pInfo->iter.iter = tsdbTbDataIterDestroy(pInfo->iter.iter);
}
- p->delSkyline = taosArrayDestroy(p->delSkyline);
- p->lastKey = ts;
+ pInfo->delSkyline = taosArrayDestroy(pInfo->delSkyline);
+ pInfo->lastKey = ts;
}
}
@@ -287,10 +365,10 @@ static void clearBlockScanInfo(STableBlockScanInfo* p) {
tMapDataClear(&p->mapData);
}
-static void destroyBlockScanInfo(SHashObj* pTableMap) {
- STableBlockScanInfo* p = NULL;
+static void destroyAllBlockScanInfo(SHashObj* pTableMap) {
+ void* p = NULL;
while ((p = taosHashIterate(pTableMap, p)) != NULL) {
- clearBlockScanInfo(p);
+ clearBlockScanInfo(*(STableBlockScanInfo**)p);
}
taosHashCleanup(pTableMap);
@@ -495,7 +573,7 @@ static int32_t tsdbReaderCreate(SVnode* pVnode, SQueryTableDataCond* pCond, STsd
pReader->verRange = getQueryVerRange(pVnode, pCond, level);
pReader->type = pCond->type;
pReader->window = updateQueryTimeWindow(pReader->pTsdb, &pCond->twindows);
-
+ pReader->blockInfoBuf.numPerBucket = 1000; // 1000 tables per bucket
ASSERT(pCond->numOfCols > 0);
limitOutputBufferSize(pCond, &pReader->capacity);
@@ -566,9 +644,9 @@ static int32_t doLoadBlockIndex(STsdbReader* pReader, SDataFReader* pFileReader,
continue;
}
- STableBlockScanInfo* pScanInfo = p;
+ STableBlockScanInfo* pScanInfo = *(STableBlockScanInfo**)p;
if (pScanInfo->pBlockList == NULL) {
- pScanInfo->pBlockList = taosArrayInit(4, sizeof(int32_t));
+ pScanInfo->pBlockList = taosArrayInit(4, sizeof(SBlockIndex));
}
taosArrayPush(pIndexList, pBlockIdx);
@@ -586,7 +664,7 @@ _end:
}
static void cleanupTableScanInfo(SHashObj* pTableMap) {
- STableBlockScanInfo* px = NULL;
+ STableBlockScanInfo** px = NULL;
while (1) {
px = taosHashIterate(pTableMap, px);
if (px == NULL) {
@@ -594,8 +672,8 @@ static void cleanupTableScanInfo(SHashObj* pTableMap) {
}
// reset the index in last block when handing a new file
- tMapDataClear(&px->mapData);
- taosArrayClear(px->pBlockList);
+ tMapDataClear(&(*px)->mapData);
+ taosArrayClear((*px)->pBlockList);
}
}
@@ -610,7 +688,8 @@ static int32_t doLoadFileBlock(STsdbReader* pReader, SArray* pIndexList, SBlockN
for (int32_t i = 0; i < numOfTables; ++i) {
SBlockIdx* pBlockIdx = taosArrayGet(pIndexList, i);
- STableBlockScanInfo* pScanInfo = taosHashGet(pReader->status.pTableMap, &pBlockIdx->uid, sizeof(int64_t));
+ STableBlockScanInfo* pScanInfo =
+ *(STableBlockScanInfo**)taosHashGet(pReader->status.pTableMap, &pBlockIdx->uid, sizeof(int64_t));
tMapDataReset(&pScanInfo->mapData);
tsdbReadDataBlk(pReader->pFileReader, pBlockIdx, &pScanInfo->mapData);
@@ -630,7 +709,10 @@ static int32_t doLoadFileBlock(STsdbReader* pReader, SArray* pIndexList, SBlockN
continue;
}
- void* p = taosArrayPush(pScanInfo->pBlockList, &j);
+ SBlockIndex bIndex = {.ordinalIndex = j, .inFileOffset = block.aSubBlock->offset};
+ bIndex.window = (STimeWindow) {.skey = block.minKey.ts, .ekey = block.maxKey.ts};
+
+ void* p = taosArrayPush(pScanInfo->pBlockList, &bIndex);
if (p == NULL) {
tMapDataClear(&pScanInfo->mapData);
return TSDB_CODE_OUT_OF_MEMORY;
@@ -821,7 +903,8 @@ int32_t getEndPosInDataBlock(STsdbReader* pReader, SBlockData* pBlockData, SData
} else if (!asc && pReader->window.skey <= pBlock->minKey.ts) {
endPos = 0;
} else {
- endPos = doBinarySearchKey(pBlockData->aTSKEY, pBlock->nRow, pos, pReader->window.ekey, pReader->order);
+ int64_t key = asc ? pReader->window.ekey : pReader->window.skey;
+ endPos = doBinarySearchKey(pBlockData->aTSKEY, pBlock->nRow, pos, key, pReader->order);
}
return endPos;
@@ -852,8 +935,9 @@ static int32_t copyBlockDataToSDataBlock(STsdbReader* pReader, STableBlockScanIn
// pDumpInfo->rowIndex = pBlock->nRow - 1;
} else {
int32_t pos = asc ? pBlock->nRow - 1 : 0;
- int32_t order = (pReader->order == TSDB_ORDER_ASC) ? TSDB_ORDER_DESC : TSDB_ORDER_ASC;
- pDumpInfo->rowIndex = doBinarySearchKey(pBlockData->aTSKEY, pBlock->nRow, pos, pReader->window.skey, order);
+ int32_t order = asc ? TSDB_ORDER_DESC : TSDB_ORDER_ASC;
+ int64_t key = asc ? pReader->window.skey : pReader->window.ekey;
+ pDumpInfo->rowIndex = doBinarySearchKey(pBlockData->aTSKEY, pBlock->nRow, pos, key, order);
}
}
@@ -1053,14 +1137,14 @@ 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 = taosHashGet(pBlockIter->pTableMap, &pBlockInfo->uid, sizeof(pBlockInfo->uid));
if (pScanInfo == NULL) {
tsdbError("failed to locate the uid:%" PRIu64 " in query table uid list, %s", pBlockInfo->uid, idStr);
return TSDB_CODE_INVALID_PARA;
}
- int32_t* mapDataIndex = taosArrayGet(pScanInfo->pBlockList, pBlockInfo->tbBlockIdx);
- tMapDataGetItemByIdx(&pScanInfo->mapData, *mapDataIndex, &pBlockIter->block, tGetDataBlk);
+ SBlockIndex* pIndex = taosArrayGet((*pScanInfo)->pBlockList, pBlockInfo->tbBlockIdx);
+ tMapDataGetItemByIdx(&(*pScanInfo)->mapData, pIndex->ordinalIndex, &pBlockIter->block, tGetDataBlk);
}
#if 0
@@ -1073,6 +1157,7 @@ static int32_t doSetCurrentBlock(SDataBlockIter* pBlockIter, const char* idStr)
static int32_t initBlockIterator(STsdbReader* pReader, SDataBlockIter* pBlockIter, int32_t numOfBlocks) {
bool asc = ASCENDING_TRAVERSE(pReader->order);
+ SBlockOrderSupporter sup = {0};
pBlockIter->numOfBlocks = numOfBlocks;
taosArrayClear(pBlockIter->blockList);
pBlockIter->pTableMap = pReader->status.pTableMap;
@@ -1081,9 +1166,7 @@ static int32_t initBlockIterator(STsdbReader* pReader, SDataBlockIter* pBlockIte
int32_t numOfTables = (int32_t)taosHashGetSize(pReader->status.pTableMap);
int64_t st = taosGetTimestampUs();
-
- SBlockOrderSupporter sup = {0};
- int32_t code = initBlockOrderSupporter(&sup, numOfTables);
+ int32_t code = initBlockOrderSupporter(&sup, numOfTables);
if (code != TSDB_CODE_SUCCESS) {
return code;
}
@@ -1096,7 +1179,7 @@ static int32_t initBlockIterator(STsdbReader* pReader, SDataBlockIter* pBlockIte
break;
}
- STableBlockScanInfo* pTableScanInfo = (STableBlockScanInfo*)ptr;
+ STableBlockScanInfo* pTableScanInfo = *(STableBlockScanInfo**)ptr;
if (pTableScanInfo->pBlockList == NULL || taosArrayGetSize(pTableScanInfo->pBlockList) == 0) {
continue;
}
@@ -1111,17 +1194,11 @@ static int32_t initBlockIterator(STsdbReader* pReader, SDataBlockIter* pBlockIte
}
sup.pDataBlockInfo[sup.numOfTables] = (SBlockOrderWrapper*)buf;
- SDataBlk block = {0};
+
for (int32_t k = 0; k < num; ++k) {
- SBlockOrderWrapper wrapper = {0};
-
- int32_t* mapDataIndex = taosArrayGet(pTableScanInfo->pBlockList, k);
- tMapDataGetItemByIdx(&pTableScanInfo->mapData, *mapDataIndex, &block, tGetDataBlk);
-
- wrapper.uid = pTableScanInfo->uid;
- wrapper.offset = block.aSubBlock[0].offset;
-
- sup.pDataBlockInfo[sup.numOfTables][k] = wrapper;
+ SBlockIndex* pIndex = taosArrayGet(pTableScanInfo->pBlockList, k);
+ sup.pDataBlockInfo[sup.numOfTables][k] =
+ (SBlockOrderWrapper){.uid = pTableScanInfo->uid, .offset = pIndex->inFileOffset};
cnt++;
}
@@ -1212,25 +1289,22 @@ static int32_t dataBlockPartiallyRequired(STimeWindow* pWindow, SVersionRange* p
(pVerRange->maxVer < pBlock->maxVer && pVerRange->maxVer >= pBlock->minVer);
}
-static SDataBlk* getNeighborBlockOfSameTable(SFileDataBlockInfo* pBlockInfo, STableBlockScanInfo* pTableBlockScanInfo,
- int32_t* nextIndex, int32_t order) {
+static bool getNeighborBlockOfSameTable(SFileDataBlockInfo* pBlockInfo, STableBlockScanInfo* pTableBlockScanInfo,
+ int32_t* nextIndex, int32_t order, SBlockIndex* pBlockIndex) {
bool asc = ASCENDING_TRAVERSE(order);
if (asc && pBlockInfo->tbBlockIdx >= taosArrayGetSize(pTableBlockScanInfo->pBlockList) - 1) {
- return NULL;
+ return false;
}
if (!asc && pBlockInfo->tbBlockIdx == 0) {
- return NULL;
+ return false;
}
int32_t step = asc ? 1 : -1;
*nextIndex = pBlockInfo->tbBlockIdx + step;
-
- SDataBlk* pBlock = taosMemoryCalloc(1, sizeof(SDataBlk));
- int32_t* indexInMapdata = taosArrayGet(pTableBlockScanInfo->pBlockList, *nextIndex);
-
- tMapDataGetItemByIdx(&pTableBlockScanInfo->mapData, *indexInMapdata, pBlock, tGetDataBlk);
- return pBlock;
+ *pBlockIndex = *(SBlockIndex*) taosArrayGet(pTableBlockScanInfo->pBlockList, *nextIndex);
+// tMapDataGetItemByIdx(&pTableBlockScanInfo->mapData, pIndex->ordinalIndex, pBlock, tGetDataBlk);
+ return true;
}
static int32_t findFileBlockInfoIndex(SDataBlockIter* pBlockIter, SFileDataBlockInfo* pFBlockInfo) {
@@ -1272,12 +1346,12 @@ static int32_t setFileBlockActiveInBlockIter(SDataBlockIter* pBlockIter, int32_t
return TSDB_CODE_SUCCESS;
}
-static bool overlapWithNeighborBlock(SDataBlk* pBlock, SDataBlk* pNeighbor, int32_t order) {
+static bool overlapWithNeighborBlock(SDataBlk* pBlock, SBlockIndex* pNeighborBlockIndex, int32_t order) {
// it is the last block in current file, no chance to overlap with neighbor blocks.
if (ASCENDING_TRAVERSE(order)) {
- return pBlock->maxKey.ts == pNeighbor->minKey.ts;
+ return pBlock->maxKey.ts == pNeighborBlockIndex->window.skey;
} else {
- return pBlock->minKey.ts == pNeighbor->maxKey.ts;
+ return pBlock->minKey.ts == pNeighborBlockIndex->window.ekey;
}
}
@@ -1293,10 +1367,10 @@ static bool keyOverlapFileBlock(TSDBKEY key, SDataBlk* pBlock, SVersionRange* pV
(pBlock->minVer <= pVerRange->maxVer);
}
-static bool doCheckforDatablockOverlap(STableBlockScanInfo* pBlockScanInfo, const SDataBlk* pBlock) {
+static bool doCheckforDatablockOverlap(STableBlockScanInfo* pBlockScanInfo, const SDataBlk* pBlock, int32_t startIndex) {
size_t num = taosArrayGetSize(pBlockScanInfo->delSkyline);
- for (int32_t i = pBlockScanInfo->fileDelIndex; i < num; i += 1) {
+ for (int32_t i = startIndex; i < num; i += 1) {
TSDBKEY* p = taosArrayGet(pBlockScanInfo->delSkyline, i);
if (p->ts >= pBlock->minKey.ts && p->ts <= pBlock->maxKey.ts) {
if (p->version >= pBlock->minVer) {
@@ -1335,7 +1409,7 @@ static bool overlapWithDelSkyline(STableBlockScanInfo* pBlockScanInfo, const SDa
// version is not overlap
if (ASCENDING_TRAVERSE(order)) {
- return doCheckforDatablockOverlap(pBlockScanInfo, pBlock);
+ return doCheckforDatablockOverlap(pBlockScanInfo, pBlock, pBlockScanInfo->fileDelIndex);
} else {
int32_t index = pBlockScanInfo->fileDelIndex;
while (1) {
@@ -1347,7 +1421,7 @@ static bool overlapWithDelSkyline(STableBlockScanInfo* pBlockScanInfo, const SDa
}
}
- return doCheckforDatablockOverlap(pBlockScanInfo, pBlock);
+ return doCheckforDatablockOverlap(pBlockScanInfo, pBlock, index);
}
}
@@ -1364,13 +1438,14 @@ typedef struct {
static void getBlockToLoadInfo(SDataBlockToLoadInfo* pInfo, SFileDataBlockInfo* pBlockInfo, SDataBlk* pBlock,
STableBlockScanInfo* pScanInfo, TSDBKEY keyInBuf, SLastBlockReader* pLastBlockReader,
STsdbReader* pReader) {
- int32_t neighborIndex = 0;
- SDataBlk* pNeighbor = getNeighborBlockOfSameTable(pBlockInfo, pScanInfo, &neighborIndex, pReader->order);
+ int32_t neighborIndex = 0;
+ SBlockIndex bIndex = {0};
+
+ bool hasNeighbor = getNeighborBlockOfSameTable(pBlockInfo, pScanInfo, &neighborIndex, pReader->order, &bIndex);
// overlap with neighbor
- if (pNeighbor) {
- pInfo->overlapWithNeighborBlock = overlapWithNeighborBlock(pBlock, pNeighbor, pReader->order);
- taosMemoryFree(pNeighbor);
+ if (hasNeighbor) {
+ pInfo->overlapWithNeighborBlock = overlapWithNeighborBlock(pBlock, &bIndex, pReader->order);
}
// has duplicated ts of different version in this block
@@ -2111,7 +2186,7 @@ static bool isValidFileBlockRow(SBlockData* pBlockData, SFileBlockDumpInfo* pDum
static bool initLastBlockReader(SLastBlockReader* pLBlockReader, STableBlockScanInfo* pScanInfo, STsdbReader* pReader) {
// the last block reader has been initialized for this table.
if (pLBlockReader->uid == pScanInfo->uid) {
- return true;
+ return hasDataInLastBlock(pLBlockReader);
}
if (pLBlockReader->uid != 0) {
@@ -2228,7 +2303,7 @@ static int32_t buildComposedDataBlock(STsdbReader* pReader) {
STableBlockScanInfo* pBlockScanInfo = NULL;
if (pBlockInfo != NULL) {
- pBlockScanInfo = taosHashGet(pReader->status.pTableMap, &pBlockInfo->uid, sizeof(pBlockInfo->uid));
+ pBlockScanInfo = *(STableBlockScanInfo**)taosHashGet(pReader->status.pTableMap, &pBlockInfo->uid, sizeof(pBlockInfo->uid));
if (pBlockScanInfo == NULL) {
code = TSDB_CODE_INVALID_PARA;
tsdbError("failed to locate the uid:%" PRIu64 " in query table uid list, total tables:%d, %s", pBlockInfo->uid,
@@ -2244,11 +2319,14 @@ static int32_t buildComposedDataBlock(STsdbReader* pReader) {
if (pReader->order == TSDB_ORDER_ASC ||
(pReader->order == TSDB_ORDER_DESC && (!hasDataInLastBlock(pLastBlockReader)))) {
copyBlockDataToSDataBlock(pReader, pBlockScanInfo);
+
+ // record the last key value
+ pBlockScanInfo->lastKey = ASCENDING_TRAVERSE(pReader->order)? pBlock->maxKey.ts:pBlock->minKey.ts;
goto _end;
}
}
} else { // file blocks not exist
- pBlockScanInfo = pReader->status.pTableIter;
+ pBlockScanInfo = *pReader->status.pTableIter;
}
SFileBlockDumpInfo* pDumpInfo = &pReader->status.fBlockDumpInfo;
@@ -2473,7 +2551,7 @@ static void extractOrderedTableUidList(SUidOrderCheckInfo* pOrderCheckInfo, SRea
void* p = taosHashIterate(pStatus->pTableMap, NULL);
while (p != NULL) {
- STableBlockScanInfo* pScanInfo = p;
+ STableBlockScanInfo* pScanInfo = *(STableBlockScanInfo**) p;
pOrderCheckInfo->tableUidList[index++] = pScanInfo->uid;
p = taosHashIterate(pStatus->pTableMap, p);
}
@@ -2547,7 +2625,7 @@ static int32_t doLoadLastBlockSequentially(STsdbReader* pReader) {
while (1) {
// load the last data block of current table
- STableBlockScanInfo* pScanInfo = pStatus->pTableIter;
+ STableBlockScanInfo* pScanInfo = *(STableBlockScanInfo**) pStatus->pTableIter;
bool hasVal = initLastBlockReader(pLastBlockReader, pScanInfo, pReader);
if (!hasVal) {
bool hasNexTable = moveToNextTable(pOrderedCheckInfo, pStatus);
@@ -2585,9 +2663,9 @@ static int32_t doBuildDataBlock(STsdbReader* pReader) {
SLastBlockReader* pLastBlockReader = pReader->status.fileIter.pLastBlockReader;
if (pBlockInfo != NULL) {
- pScanInfo = taosHashGet(pReader->status.pTableMap, &pBlockInfo->uid, sizeof(pBlockInfo->uid));
+ pScanInfo = *(STableBlockScanInfo**)taosHashGet(pReader->status.pTableMap, &pBlockInfo->uid, sizeof(pBlockInfo->uid));
} else {
- pScanInfo = pReader->status.pTableIter;
+ pScanInfo = *pReader->status.pTableIter;
}
if (pScanInfo == NULL) {
@@ -2635,6 +2713,9 @@ static int32_t doBuildDataBlock(STsdbReader* pReader) {
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;
}
}
@@ -2652,11 +2733,11 @@ static int32_t buildBlockFromBufferSequentially(STsdbReader* pReader) {
}
}
- STableBlockScanInfo* pBlockScanInfo = pStatus->pTableIter;
- initMemDataIterator(pBlockScanInfo, pReader);
+ STableBlockScanInfo** pBlockScanInfo = pStatus->pTableIter;
+ initMemDataIterator(*pBlockScanInfo, pReader);
int64_t endKey = (ASCENDING_TRAVERSE(pReader->order)) ? INT64_MAX : INT64_MIN;
- int32_t code = buildDataBlockFromBuf(pReader, pBlockScanInfo, endKey);
+ int32_t code = buildDataBlockFromBuf(pReader, *pBlockScanInfo, endKey);
if (code != TSDB_CODE_SUCCESS) {
return code;
}
@@ -3067,15 +3148,15 @@ static int32_t checkForNeighborFileBlock(STsdbReader* pReader, STableBlockScanIn
*state = CHECK_FILEBLOCK_QUIT;
int32_t step = ASCENDING_TRAVERSE(pReader->order) ? 1 : -1;
- int32_t nextIndex = -1;
- SDataBlk* pNeighborBlock = getNeighborBlockOfSameTable(pFBlock, pScanInfo, &nextIndex, pReader->order);
- if (pNeighborBlock == NULL) { // do nothing
+ int32_t nextIndex = -1;
+ SBlockIndex bIndex = {0};
+
+ bool hasNeighbor = getNeighborBlockOfSameTable(pFBlock, pScanInfo, &nextIndex, pReader->order, &bIndex);
+ if (!hasNeighbor) { // do nothing
return 0;
}
- bool overlap = overlapWithNeighborBlock(pBlock, pNeighborBlock, pReader->order);
- taosMemoryFree(pNeighborBlock);
-
+ bool overlap = overlapWithNeighborBlock(pBlock, &bIndex, pReader->order);
if (overlap) { // load next block
SReaderStatus* pStatus = &pReader->status;
SDataBlockIter* pBlockIter = &pStatus->blockIter;
@@ -3458,18 +3539,23 @@ int32_t buildDataBlockFromBufImpl(STableBlockScanInfo* pBlockScanInfo, int64_t e
// TODO refactor: with createDataBlockScanInfo
int32_t tsdbSetTableList(STsdbReader* pReader, const void* pTableList, int32_t num) {
ASSERT(pReader != NULL);
+ int32_t size = taosHashGetSize(pReader->status.pTableMap);
- STableBlockScanInfo* p = NULL;
+ STableBlockScanInfo** p = NULL;
while ((p = taosHashIterate(pReader->status.pTableMap, p)) != NULL) {
- clearBlockScanInfo(p);
+ clearBlockScanInfo(*p);
}
+ // todo handle the case where size is less than the value of num
+ ASSERT(size >= num);
+
taosHashClear(pReader->status.pTableMap);
STableKeyInfo* pList = (STableKeyInfo*) pTableList;
for(int32_t i = 0; i < num; ++i) {
- STableBlockScanInfo info = {.lastKey = 0, .uid = pList[i].uid};
- taosHashPut(pReader->status.pTableMap, &info.uid, sizeof(uint64_t), &info, sizeof(info));
+ STableBlockScanInfo* pInfo = getPosInBlockInfoBuf(&pReader->blockInfoBuf, i);
+ pInfo->uid = pList[i].uid;
+ taosHashPut(pReader->status.pTableMap, &pInfo->uid, sizeof(uint64_t), &pInfo, POINTER_BYTES);
}
return TDB_CODE_SUCCESS;
@@ -3496,7 +3582,6 @@ static int32_t doOpenReaderImpl(STsdbReader* pReader) {
initFilesetIterator(&pReader->status.fileIter, pReader->pReadSnap->fs.aDFileSet, pReader);
resetDataBlockIterator(&pReader->status.blockIter, pReader->order);
-// resetDataBlockScanInfo(pReader->status.pTableMap, pReader->window.skey);
// no data in files, let's try buffer in memory
if (pReader->status.fileIter.numOfFiles == 0) {
@@ -3674,8 +3759,9 @@ void tsdbReaderClose(STsdbReader* pReader) {
cleanupDataBlockIterator(&pReader->status.blockIter);
size_t numOfTables = taosHashGetSize(pReader->status.pTableMap);
- destroyBlockScanInfo(pReader->status.pTableMap);
+ destroyAllBlockScanInfo(pReader->status.pTableMap);
blockDataDestroy(pReader->pResBlock);
+ clearBlockScanInfoBuf(&pReader->blockInfoBuf);
if (pReader->pFileReader != NULL) {
tsdbDataFReaderClose(&pReader->pFileReader);
@@ -3697,15 +3783,16 @@ 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 %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, 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, 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);
taosMemoryFree(pReader->idStr);
taosMemoryFree(pReader->pSchema);
@@ -3758,7 +3845,7 @@ bool tsdbNextDataBlock(STsdbReader* pReader) {
if (pReader->step == EXTERNAL_ROWS_PREV) {
// prepare for the main scan
int32_t code = doOpenReaderImpl(pReader);
- resetDataBlockScanInfo(pReader->status.pTableMap, pReader->innerReader[0]->window.ekey);
+ resetAllDataBlockScanInfo(pReader->status.pTableMap, pReader->innerReader[0]->window.ekey);
if (code != TSDB_CODE_SUCCESS) {
return code;
@@ -3775,7 +3862,7 @@ bool tsdbNextDataBlock(STsdbReader* pReader) {
if (pReader->innerReader[1] != NULL && pReader->step == EXTERNAL_ROWS_MAIN) {
// prepare for the next row scan
int32_t code = doOpenReaderImpl(pReader->innerReader[1]);
- resetDataBlockScanInfo(pReader->innerReader[1]->status.pTableMap, pReader->window.ekey);
+ resetAllDataBlockScanInfo(pReader->innerReader[1]->status.pTableMap, pReader->window.ekey);
if (code != TSDB_CODE_SUCCESS) {
return code;
}
@@ -3791,7 +3878,7 @@ bool tsdbNextDataBlock(STsdbReader* pReader) {
}
bool tsdbTableNextDataBlock(STsdbReader* pReader, uint64_t uid) {
- STableBlockScanInfo* pBlockScanInfo = taosHashGet(pReader->status.pTableMap, &uid, sizeof(uid));
+ STableBlockScanInfo* pBlockScanInfo = *(STableBlockScanInfo**)taosHashGet(pReader->status.pTableMap, &uid, sizeof(uid));
if (pBlockScanInfo == NULL) { // no data block for the table of given uid
return false;
}
@@ -3799,24 +3886,24 @@ bool tsdbTableNextDataBlock(STsdbReader* pReader, uint64_t uid) {
return true;
}
-static void setBlockInfo(STsdbReader* pReader, SDataBlockInfo* pDataBlockInfo) {
- ASSERT(pDataBlockInfo != NULL && pReader != NULL);
- pDataBlockInfo->rows = pReader->pResBlock->info.rows;
- pDataBlockInfo->uid = pReader->pResBlock->info.uid;
- pDataBlockInfo->window = pReader->pResBlock->info.window;
+static void setBlockInfo(const STsdbReader* pReader, int32_t* rows, uint64_t* uid, STimeWindow* pWindow) {
+ ASSERT(pReader != NULL);
+ *rows = pReader->pResBlock->info.rows;
+ *uid = pReader->pResBlock->info.uid;
+ *pWindow = pReader->pResBlock->info.window;
}
-void tsdbRetrieveDataBlockInfo(STsdbReader* pReader, SDataBlockInfo* pDataBlockInfo) {
+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, pDataBlockInfo);
+ setBlockInfo(pReader, rows, uid, pWindow);
} else if (pReader->step == EXTERNAL_ROWS_PREV) {
- setBlockInfo(pReader->innerReader[0], pDataBlockInfo);
+ setBlockInfo(pReader->innerReader[0], rows, uid, pWindow);
} else {
- setBlockInfo(pReader->innerReader[1], pDataBlockInfo);
+ setBlockInfo(pReader->innerReader[1], rows, uid, pWindow);
}
} else {
- setBlockInfo(pReader, pDataBlockInfo);
+ setBlockInfo(pReader, rows, uid, pWindow);
}
}
@@ -3838,7 +3925,7 @@ int32_t tsdbRetrieveDatablockSMA(STsdbReader* pReader, SColumnDataAgg*** pBlockS
SFileDataBlockInfo* pFBlock = getCurrentBlockInfo(&pReader->status.blockIter);
SDataBlk* pBlock = getCurrentBlock(&pReader->status.blockIter);
- int64_t stime = taosGetTimestampUs();
+// int64_t stime = taosGetTimestampUs();
SBlockLoadSuppInfo* pSup = &pReader->suppInfo;
@@ -3869,7 +3956,9 @@ int32_t tsdbRetrieveDatablockSMA(STsdbReader* pReader, SColumnDataAgg*** pBlockS
size_t numOfCols = blockDataGetNumOfCols(pReader->pResBlock);
int32_t i = 0, j = 0;
- while (j < numOfCols && i < taosArrayGetSize(pSup->pColAgg)) {
+ size_t size = taosArrayGetSize(pSup->pColAgg);
+
+ while (j < numOfCols && i < size) {
SColumnDataAgg* pAgg = taosArrayGet(pSup->pColAgg, i);
if (pAgg->colId == pSup->colIds[j]) {
if (IS_BSMA_ON(&(pReader->pSchema->columns[i]))) {
@@ -3886,14 +3975,10 @@ int32_t tsdbRetrieveDatablockSMA(STsdbReader* pReader, SColumnDataAgg*** pBlockS
}
}
- double elapsed = (taosGetTimestampUs() - stime) / 1000.0;
- pReader->cost.smaLoadTime += elapsed;
pReader->cost.smaDataLoad += 1;
-
*pBlockStatis = pSup->plist;
- tsdbDebug("vgId:%d, succeed to load block SMA for uid %" PRIu64 ", elapsed time:%.2f ms, %s", 0, pFBlock->uid,
- elapsed, pReader->idStr);
+ tsdbDebug("vgId:%d, succeed to load block SMA for uid %" PRIu64 ", %s", 0, pFBlock->uid, pReader->idStr);
return code;
}
@@ -3906,7 +3991,7 @@ static SArray* doRetrieveDataBlock(STsdbReader* pReader) {
}
SFileDataBlockInfo* pBlockInfo = getCurrentBlockInfo(&pStatus->blockIter);
- STableBlockScanInfo* pBlockScanInfo = taosHashGet(pStatus->pTableMap, &pBlockInfo->uid, sizeof(pBlockInfo->uid));
+ STableBlockScanInfo* pBlockScanInfo = *(STableBlockScanInfo**)taosHashGet(pStatus->pTableMap, &pBlockInfo->uid, sizeof(pBlockInfo->uid));
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,
@@ -3942,6 +4027,8 @@ int32_t tsdbReaderReset(STsdbReader* pReader, SQueryTableDataCond* pCond) {
return TSDB_CODE_SUCCESS;
}
+ SDataBlockIter* pBlockIter = &pReader->status.blockIter;
+
pReader->order = pCond->order;
pReader->type = TIMEWINDOW_RANGE_CONTAINED;
pReader->status.loadFromFile = true;
@@ -3958,13 +4045,12 @@ int32_t tsdbReaderReset(STsdbReader* pReader, SQueryTableDataCond* pCond) {
int32_t numOfTables = taosHashGetSize(pReader->status.pTableMap);
initFilesetIterator(&pReader->status.fileIter, pReader->pReadSnap->fs.aDFileSet, pReader);
- resetDataBlockIterator(&pReader->status.blockIter, pReader->order);
+ resetDataBlockIterator(pBlockIter, pReader->order);
int64_t ts = ASCENDING_TRAVERSE(pReader->order) ? pReader->window.skey - 1 : pReader->window.ekey + 1;
- resetDataBlockScanInfo(pReader->status.pTableMap, ts);
+ resetAllDataBlockScanInfo(pReader->status.pTableMap, ts);
- int32_t code = 0;
- SDataBlockIter* pBlockIter = &pReader->status.blockIter;
+ int32_t code = 0;
// no data in files, let's try buffer in memory
if (pReader->status.fileIter.numOfFiles == 0) {
@@ -4066,7 +4152,7 @@ int64_t tsdbGetNumOfRowsInMemTable(STsdbReader* pReader) {
pStatus->pTableIter = taosHashIterate(pStatus->pTableMap, NULL);
while (pStatus->pTableIter != NULL) {
- STableBlockScanInfo* pBlockScanInfo = pStatus->pTableIter;
+ STableBlockScanInfo* pBlockScanInfo = *(STableBlockScanInfo**)pStatus->pTableIter;
STbData* d = NULL;
if (pReader->pTsdb->mem != NULL) {
diff --git a/source/dnode/vnode/src/vnd/vnodeCommit.c b/source/dnode/vnode/src/vnd/vnodeCommit.c
index e593bbd602..7040d2d7c8 100644
--- a/source/dnode/vnode/src/vnd/vnodeCommit.c
+++ b/source/dnode/vnode/src/vnd/vnodeCommit.c
@@ -212,6 +212,12 @@ int vnodeCommit(SVnode *pVnode) {
vInfo("vgId:%d, start to commit, commit ID:%" PRId64 " version:%" PRId64, TD_VID(pVnode), pVnode->state.commitID,
pVnode->state.applied);
+ // persist wal before starting
+ if (walPersist(pVnode->pWal) < 0) {
+ vError("vgId:%d, failed to persist wal since %s", TD_VID(pVnode), terrstr());
+ return -1;
+ }
+
pVnode->state.commitTerm = pVnode->state.applyTerm;
// save info
diff --git a/source/dnode/vnode/src/vnd/vnodeOpen.c b/source/dnode/vnode/src/vnd/vnodeOpen.c
index 0696ec0901..f7164c4ac3 100644
--- a/source/dnode/vnode/src/vnd/vnodeOpen.c
+++ b/source/dnode/vnode/src/vnd/vnodeOpen.c
@@ -245,6 +245,7 @@ _err:
void vnodePreClose(SVnode *pVnode) {
if (pVnode) {
syncLeaderTransfer(pVnode->sync);
+ syncPreStop(pVnode->sync);
}
}
diff --git a/source/dnode/vnode/src/vnd/vnodeQuery.c b/source/dnode/vnode/src/vnd/vnodeQuery.c
index f1bbb2d4b3..efedc12d80 100644
--- a/source/dnode/vnode/src/vnd/vnodeQuery.c
+++ b/source/dnode/vnode/src/vnd/vnodeQuery.c
@@ -290,7 +290,7 @@ int32_t vnodeGetBatchMeta(SVnode *pVnode, SRpcMsg *pMsg) {
for (int32_t i = 0; i < msgNum; ++i) {
if (offset >= pMsg->contLen) {
qError("vnode offset %d is bigger than contLen %d", offset, pMsg->contLen);
- terrno = TSDB_CODE_MSG_NOT_PROCESSED;
+ terrno = TSDB_CODE_INVALID_MSG_LEN;
taosArrayDestroy(batchRsp);
return -1;
}
@@ -300,7 +300,7 @@ int32_t vnodeGetBatchMeta(SVnode *pVnode, SRpcMsg *pMsg) {
if (offset >= pMsg->contLen) {
qError("vnode offset %d is bigger than contLen %d", offset, pMsg->contLen);
- terrno = TSDB_CODE_MSG_NOT_PROCESSED;
+ terrno = TSDB_CODE_INVALID_MSG_LEN;
taosArrayDestroy(batchRsp);
return -1;
}
@@ -310,7 +310,7 @@ int32_t vnodeGetBatchMeta(SVnode *pVnode, SRpcMsg *pMsg) {
if (offset >= pMsg->contLen) {
qError("vnode offset %d is bigger than contLen %d", offset, pMsg->contLen);
- terrno = TSDB_CODE_MSG_NOT_PROCESSED;
+ terrno = TSDB_CODE_INVALID_MSG_LEN;
taosArrayDestroy(batchRsp);
return -1;
}
@@ -320,7 +320,7 @@ int32_t vnodeGetBatchMeta(SVnode *pVnode, SRpcMsg *pMsg) {
if (offset >= pMsg->contLen) {
qError("vnode offset %d is bigger than contLen %d", offset, pMsg->contLen);
- terrno = TSDB_CODE_MSG_NOT_PROCESSED;
+ terrno = TSDB_CODE_INVALID_MSG_LEN;
taosArrayDestroy(batchRsp);
return -1;
}
@@ -362,6 +362,7 @@ int32_t vnodeGetBatchMeta(SVnode *pVnode, SRpcMsg *pMsg) {
offset = 0;
if (rspSize > MAX_META_BATCH_RSP_SIZE) {
+ qError("rspSize:%d overload", rspSize);
code = TSDB_CODE_INVALID_MSG_LEN;
goto _exit;
}
@@ -414,9 +415,11 @@ _exit:
}
int32_t vnodeGetLoad(SVnode *pVnode, SVnodeLoad *pLoad) {
+ SSyncState state = syncGetState(pVnode->sync);
+
pLoad->vgId = TD_VID(pVnode);
- pLoad->syncState = syncGetMyRole(pVnode->sync);
- pLoad->syncRestore = pVnode->restored;
+ pLoad->syncState = state.state;
+ pLoad->syncRestore = state.restored;
pLoad->cacheUsage = tsdbCacheGetUsage(pVnode);
pLoad->numOfTables = metaGetTbNum(pVnode->pMeta);
pLoad->numOfTimeSeries = metaGetTimeSeriesNum(pVnode->pMeta);
diff --git a/source/dnode/vnode/src/vnd/vnodeSvr.c b/source/dnode/vnode/src/vnd/vnodeSvr.c
index 4579f0c7a4..78d95cf0d7 100644
--- a/source/dnode/vnode/src/vnd/vnodeSvr.c
+++ b/source/dnode/vnode/src/vnd/vnodeSvr.c
@@ -173,7 +173,7 @@ int32_t vnodeProcessWriteMsg(SVnode *pVnode, SRpcMsg *pMsg, int64_t version, SRp
int32_t ret;
if (!pVnode->inUse) {
- terrno = TSDB_CODE_VND_NOT_SYNCED;
+ terrno = TSDB_CODE_VND_NO_AVAIL_BUFPOOL;
vError("vgId:%d, not ready to write since %s", TD_VID(pVnode), terrstr());
return -1;
}
@@ -228,38 +228,33 @@ int32_t vnodeProcessWriteMsg(SVnode *pVnode, SRpcMsg *pMsg, int64_t version, SRp
if (vnodeProcessBatchDeleteReq(pVnode, version, pReq, len, pRsp) < 0) goto _err;
break;
/* TQ */
- case TDMT_VND_MQ_VG_CHANGE:
- if (tqProcessVgChangeReq(pVnode->pTq, version, POINTER_SHIFT(pMsg->pCont, sizeof(SMsgHead)),
- pMsg->contLen - sizeof(SMsgHead)) < 0) {
+ case TDMT_VND_TMQ_SUBSCRIBE:
+ if (tqProcessSubscribeReq(pVnode->pTq, version, pReq, len) < 0) {
goto _err;
}
break;
- case TDMT_VND_MQ_VG_DELETE:
- if (tqProcessVgDeleteReq(pVnode->pTq, version, pMsg->pCont, pMsg->contLen) < 0) {
+ case TDMT_VND_TMQ_DELETE_SUB:
+ if (tqProcessDeleteSubReq(pVnode->pTq, version, pMsg->pCont, pMsg->contLen) < 0) {
goto _err;
}
break;
- case TDMT_VND_MQ_COMMIT_OFFSET:
- if (tqProcessOffsetCommitReq(pVnode->pTq, version, POINTER_SHIFT(pMsg->pCont, sizeof(SMsgHead)),
- pMsg->contLen - sizeof(SMsgHead)) < 0) {
+ case TDMT_VND_TMQ_COMMIT_OFFSET:
+ if (tqProcessOffsetCommitReq(pVnode->pTq, version, pReq, pMsg->contLen - sizeof(SMsgHead)) < 0) {
goto _err;
}
break;
- case TDMT_VND_ADD_CHECK_INFO:
- if (tqProcessAddCheckInfoReq(pVnode->pTq, version, POINTER_SHIFT(pMsg->pCont, sizeof(SMsgHead)),
- pMsg->contLen - sizeof(SMsgHead)) < 0) {
+ case TDMT_VND_TMQ_ADD_CHECKINFO:
+ if (tqProcessAddCheckInfoReq(pVnode->pTq, version, pReq, len) < 0) {
goto _err;
}
break;
- case TDMT_VND_DELETE_CHECK_INFO:
- if (tqProcessDelCheckInfoReq(pVnode->pTq, version, POINTER_SHIFT(pMsg->pCont, sizeof(SMsgHead)),
- pMsg->contLen - sizeof(SMsgHead)) < 0) {
+ case TDMT_VND_TMQ_DEL_CHECKINFO:
+ if (tqProcessDelCheckInfoReq(pVnode->pTq, version, pReq, len) < 0) {
goto _err;
}
break;
case TDMT_STREAM_TASK_DEPLOY: {
- if (tqProcessTaskDeployReq(pVnode->pTq, version, POINTER_SHIFT(pMsg->pCont, sizeof(SMsgHead)),
- pMsg->contLen - sizeof(SMsgHead)) < 0) {
+ if (tqProcessTaskDeployReq(pVnode->pTq, version, pReq, len) < 0) {
goto _err;
}
} break;
@@ -268,6 +263,16 @@ int32_t vnodeProcessWriteMsg(SVnode *pVnode, SRpcMsg *pMsg, int64_t version, SRp
goto _err;
}
} break;
+ case TDMT_VND_STREAM_RECOVER_STEP2: {
+ if (tqProcessTaskRecover2Req(pVnode->pTq, version, pMsg->pCont, pMsg->contLen) < 0) {
+ goto _err;
+ }
+ } break;
+ case TDMT_STREAM_TASK_CHECK_RSP: {
+ if (tqProcessStreamTaskCheckRsp(pVnode->pTq, version, pReq, len) < 0) {
+ goto _err;
+ }
+ } break;
case TDMT_VND_ALTER_CONFIRM:
vnodeProcessAlterConfirmReq(pVnode, version, pReq, len, pRsp);
break;
@@ -280,11 +285,12 @@ int32_t vnodeProcessWriteMsg(SVnode *pVnode, SRpcMsg *pMsg, int64_t version, SRp
case TDMT_VND_COMMIT:
goto _do_commit;
default:
- ASSERT(0);
- break;
+ vError("vgId:%d, unprocessed msg, %d", TD_VID(pVnode), pMsg->msgType);
+ return -1;
}
- vTrace("vgId:%d, process %s request success, index:%" PRId64, TD_VID(pVnode), TMSG_INFO(pMsg->msgType), version);
+ vTrace("vgId:%d, process %s request, code:0x%x index:%" PRId64, TD_VID(pVnode), TMSG_INFO(pMsg->msgType), pRsp->code,
+ version);
walApplyVer(pVnode->pWal, version);
@@ -328,7 +334,8 @@ 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) && !vnodeIsLeader(pVnode)) {
+ if ((pMsg->msgType == TDMT_SCH_QUERY) && !syncIsReadyForRead(pVnode->sync)) {
vnodeRedirectRpcMsg(pVnode, pMsg);
return 0;
}
@@ -342,7 +349,7 @@ int32_t vnodeProcessQueryMsg(SVnode *pVnode, SRpcMsg *pMsg) {
return qWorkerProcessCQueryMsg(&handle, pVnode->pQuery, pMsg, 0);
default:
vError("unknown msg type:%d in query queue", pMsg->msgType);
- return TSDB_CODE_VND_APP_ERROR;
+ return TSDB_CODE_APP_ERROR;
}
}
@@ -350,19 +357,17 @@ int32_t vnodeProcessFetchMsg(SVnode *pVnode, SRpcMsg *pMsg, SQueueInfo *pInfo) {
vTrace("vgId:%d, msg:%p in fetch queue is processing", pVnode->config.vgId, pMsg);
if ((pMsg->msgType == TDMT_SCH_FETCH || pMsg->msgType == TDMT_VND_TABLE_META || pMsg->msgType == TDMT_VND_TABLE_CFG ||
pMsg->msgType == TDMT_VND_BATCH_META) &&
- !vnodeIsLeader(pVnode)) {
+ !syncIsReadyForRead(pVnode->sync)) {
+ // !vnodeIsLeader(pVnode)) {
vnodeRedirectRpcMsg(pVnode, pMsg);
return 0;
}
- if (pMsg->msgType == TDMT_VND_CONSUME && !pVnode->restored) {
+ if (pMsg->msgType == TDMT_VND_TMQ_CONSUME && !pVnode->restored) {
vnodeRedirectRpcMsg(pVnode, pMsg);
return 0;
}
- char *msgstr = POINTER_SHIFT(pMsg->pCont, sizeof(SMsgHead));
- int32_t msgLen = pMsg->contLen - sizeof(SMsgHead);
-
switch (pMsg->msgType) {
case TDMT_SCH_FETCH:
case TDMT_SCH_MERGE_FETCH:
@@ -381,27 +386,31 @@ int32_t vnodeProcessFetchMsg(SVnode *pVnode, SRpcMsg *pMsg, SQueueInfo *pInfo) {
return vnodeGetTableCfg(pVnode, pMsg, true);
case TDMT_VND_BATCH_META:
return vnodeGetBatchMeta(pVnode, pMsg);
- case TDMT_VND_CONSUME:
+ case TDMT_VND_TMQ_CONSUME:
return tqProcessPollReq(pVnode->pTq, pMsg);
case TDMT_STREAM_TASK_RUN:
return tqProcessTaskRunReq(pVnode->pTq, pMsg);
-#if 0
+#if 1
case TDMT_STREAM_TASK_DISPATCH:
return tqProcessTaskDispatchReq(pVnode->pTq, pMsg, true);
#endif
- /*case TDMT_STREAM_TASK_RECOVER:*/
- /*return tqProcessTaskRecoverReq(pVnode->pTq, pMsg);*/
- case TDMT_STREAM_RETRIEVE:
- return tqProcessTaskRetrieveReq(pVnode->pTq, pMsg);
+ case TDMT_STREAM_TASK_CHECK:
+ return tqProcessStreamTaskCheckReq(pVnode->pTq, pMsg);
case TDMT_STREAM_TASK_DISPATCH_RSP:
return tqProcessTaskDispatchRsp(pVnode->pTq, pMsg);
- /*case TDMT_STREAM_TASK_RECOVER_RSP:*/
- /*return tqProcessTaskRecoverRsp(pVnode->pTq, pMsg);*/
+ case TDMT_STREAM_RETRIEVE:
+ return tqProcessTaskRetrieveReq(pVnode->pTq, pMsg);
case TDMT_STREAM_RETRIEVE_RSP:
return tqProcessTaskRetrieveRsp(pVnode->pTq, pMsg);
+ case TDMT_VND_STREAM_RECOVER_STEP1:
+ return tqProcessTaskRecover1Req(pVnode->pTq, pMsg);
+ case TDMT_STREAM_RECOVER_FINISH:
+ return tqProcessTaskRecoverFinishReq(pVnode->pTq, pMsg);
+ case TDMT_STREAM_RECOVER_FINISH_RSP:
+ return tqProcessTaskRecoverFinishRsp(pVnode->pTq, pMsg);
default:
vError("unknown msg type:%d in fetch queue", pMsg->msgType);
- return TSDB_CODE_VND_APP_ERROR;
+ return TSDB_CODE_APP_ERROR;
}
}
@@ -767,7 +776,7 @@ static int32_t vnodeProcessDropTbReq(SVnode *pVnode, int64_t version, void *pReq
/* code */
ret = metaDropTable(pVnode->pMeta, version, pDropTbReq, tbUids, &tbUid);
if (ret < 0) {
- if (pDropTbReq->igNotExists && terrno == TSDB_CODE_VND_TABLE_NOT_EXIST) {
+ if (pDropTbReq->igNotExists && terrno == TSDB_CODE_TDB_TABLE_NOT_EXIST) {
dropTbRsp.code = TSDB_CODE_SUCCESS;
} else {
dropTbRsp.code = terrno;
@@ -856,6 +865,7 @@ static int32_t vnodeProcessSubmitReq(SVnode *pVnode, int64_t version, void *pReq
SEncoder encoder = {0};
SArray *newTbUids = NULL;
SVStatis statis = {0};
+ bool tbCreated = false;
terrno = TSDB_CODE_SUCCESS;
pRsp->code = 0;
@@ -889,11 +899,10 @@ static int32_t vnodeProcessSubmitReq(SVnode *pVnode, int64_t version, void *pReq
if (pBlock == NULL) break;
SSubmitBlkRsp submitBlkRsp = {0};
+ tbCreated = false;
// create table for auto create table mode
if (msgIter.schemaLen > 0) {
- submitBlkRsp.hashMeta = 1;
-
tDecoderInit(&decoder, pBlock->data, msgIter.schemaLen);
if (tDecodeSVCreateTbReq(&decoder, &createTbReq) < 0) {
pRsp->code = TSDB_CODE_INVALID_MSG;
@@ -930,12 +939,13 @@ static int32_t vnodeProcessSubmitReq(SVnode *pVnode, int64_t version, void *pReq
}
taosArrayPush(newTbUids, &createTbReq.uid);
+
+ submitBlkRsp.uid = createTbReq.uid;
+ submitBlkRsp.tblFName = taosMemoryMalloc(strlen(pVnode->config.dbname) + strlen(createTbReq.name) + 2);
+ sprintf(submitBlkRsp.tblFName, "%s.%s", pVnode->config.dbname, createTbReq.name);
+ tbCreated = true;
}
-
- submitBlkRsp.uid = createTbReq.uid;
- submitBlkRsp.tblFName = taosMemoryMalloc(strlen(pVnode->config.dbname) + strlen(createTbReq.name) + 2);
- sprintf(submitBlkRsp.tblFName, "%s.%s", pVnode->config.dbname, createTbReq.name);
-
+
msgIter.uid = createTbReq.uid;
if (createTbReq.type == TSDB_CHILD_TABLE) {
msgIter.suid = createTbReq.ctb.suid;
@@ -948,10 +958,7 @@ static int32_t vnodeProcessSubmitReq(SVnode *pVnode, int64_t version, void *pReq
#endif
tDecoderClear(&decoder);
taosArrayDestroy(createTbReq.ctb.tagName);
- } else {
- submitBlkRsp.tblFName = taosMemoryMalloc(TSDB_TABLE_FNAME_LEN);
- sprintf(submitBlkRsp.tblFName, "%s.", pVnode->config.dbname);
- }
+ }
if (tsdbInsertTableData(pVnode->pTsdb, version, &msgIter, pBlock, &submitBlkRsp) < 0) {
submitBlkRsp.code = terrno;
@@ -959,7 +966,9 @@ static int32_t vnodeProcessSubmitReq(SVnode *pVnode, int64_t version, void *pReq
submitRsp.numOfRows += submitBlkRsp.numOfRows;
submitRsp.affectedRows += submitBlkRsp.affectedRows;
- taosArrayPush(submitRsp.pArray, &submitBlkRsp);
+ if (tbCreated || submitBlkRsp.code) {
+ taosArrayPush(submitRsp.pArray, &submitBlkRsp);
+ }
}
if (taosArrayGetSize(newTbUids) > 0) {
diff --git a/source/dnode/vnode/src/vnd/vnodeSync.c b/source/dnode/vnode/src/vnd/vnodeSync.c
index 7acf5b4003..e27ae07460 100644
--- a/source/dnode/vnode/src/vnd/vnodeSync.c
+++ b/source/dnode/vnode/src/vnd/vnodeSync.c
@@ -230,142 +230,27 @@ void vnodeApplyWriteMsg(SQueueInfo *pInfo, STaosQall *qall, int32_t numOfMsgs) {
}
}
-int32_t vnodeProcessSyncCtrlMsg(SVnode *pVnode, SRpcMsg *pMsg, SRpcMsg **pRsp) {
- int32_t code = 0;
- const STraceId *trace = &pMsg->info.traceId;
-
- if (!syncEnvIsStart()) {
- vGError("vgId:%d, msg:%p failed to process since sync env not start", pVnode->config.vgId, pMsg);
- terrno = TSDB_CODE_APP_ERROR;
- return -1;
- }
-
- SSyncNode *pSyncNode = syncNodeAcquire(pVnode->sync);
- if (pSyncNode == NULL) {
- vGError("vgId:%d, msg:%p failed to process since invalid sync node", pVnode->config.vgId, pMsg);
- terrno = TSDB_CODE_SYN_INTERNAL_ERROR;
- return -1;
- }
-
- vGTrace("vgId:%d, sync msg:%p will be processed, type:%s", pVnode->config.vgId, pMsg, TMSG_INFO(pMsg->msgType));
-
- if (pMsg->msgType == TDMT_SYNC_HEARTBEAT) {
- SyncHeartbeat *pSyncMsg = syncHeartbeatFromRpcMsg2(pMsg);
- code = syncNodeOnHeartbeat(pSyncNode, pSyncMsg);
- syncHeartbeatDestroy(pSyncMsg);
-
- } else if (pMsg->msgType == TDMT_SYNC_HEARTBEAT_REPLY) {
- SyncHeartbeatReply *pSyncMsg = syncHeartbeatReplyFromRpcMsg2(pMsg);
- code = syncNodeOnHeartbeatReply(pSyncNode, pSyncMsg);
- syncHeartbeatReplyDestroy(pSyncMsg);
-
- } else {
- vGError("vgId:%d, msg:%p failed to process since error msg type:%d", pVnode->config.vgId, pMsg, pMsg->msgType);
- code = -1;
- }
-
- vTrace("vgId:%d, sync msg:%p is processed, type:%s code:0x%x", pVnode->config.vgId, pMsg, TMSG_INFO(pMsg->msgType),
- code);
- syncNodeRelease(pSyncNode);
- if (code != 0 && terrno == 0) {
- terrno = TSDB_CODE_SYN_INTERNAL_ERROR;
- }
- return code;
-}
-
int32_t vnodeProcessSyncMsg(SVnode *pVnode, SRpcMsg *pMsg, SRpcMsg **pRsp) {
- int32_t code = 0;
const STraceId *trace = &pMsg->info.traceId;
-
- if (!syncEnvIsStart()) {
- vGError("vgId:%d, msg:%p failed to process since sync env not start", pVnode->config.vgId, pMsg);
- terrno = TSDB_CODE_APP_ERROR;
- return -1;
- }
-
- SSyncNode *pSyncNode = syncNodeAcquire(pVnode->sync);
- if (pSyncNode == NULL) {
- vGError("vgId:%d, msg:%p failed to process since invalid sync node", pVnode->config.vgId, pMsg);
- terrno = TSDB_CODE_SYN_INTERNAL_ERROR;
- return -1;
- }
-
vGTrace("vgId:%d, sync msg:%p will be processed, type:%s", pVnode->config.vgId, pMsg, TMSG_INFO(pMsg->msgType));
- if (pMsg->msgType == TDMT_SYNC_TIMEOUT) {
- SyncTimeout *pSyncMsg = syncTimeoutFromRpcMsg2(pMsg);
- ASSERT(pSyncMsg != NULL);
- code = syncNodeOnTimer(pSyncNode, pSyncMsg);
- syncTimeoutDestroy(pSyncMsg);
-
- } else if (pMsg->msgType == TDMT_SYNC_PING) {
- SyncPing *pSyncMsg = syncPingFromRpcMsg2(pMsg);
- ASSERT(pSyncMsg != NULL);
- code = syncNodeOnPing(pSyncNode, pSyncMsg);
- syncPingDestroy(pSyncMsg);
-
- } else if (pMsg->msgType == TDMT_SYNC_PING_REPLY) {
- SyncPingReply *pSyncMsg = syncPingReplyFromRpcMsg2(pMsg);
- ASSERT(pSyncMsg != NULL);
- code = syncNodeOnPingReply(pSyncNode, pSyncMsg);
- syncPingReplyDestroy(pSyncMsg);
-
- } else if (pMsg->msgType == TDMT_SYNC_CLIENT_REQUEST) {
- SyncClientRequest *pSyncMsg = syncClientRequestFromRpcMsg2(pMsg);
- ASSERT(pSyncMsg != NULL);
- code = syncNodeOnClientRequest(pSyncNode, pSyncMsg, NULL);
- syncClientRequestDestroy(pSyncMsg);
-
- } else if (pMsg->msgType == TDMT_SYNC_REQUEST_VOTE) {
- SyncRequestVote *pSyncMsg = syncRequestVoteFromRpcMsg2(pMsg);
- ASSERT(pSyncMsg != NULL);
- code = syncNodeOnRequestVote(pSyncNode, pSyncMsg);
- syncRequestVoteDestroy(pSyncMsg);
-
- } else if (pMsg->msgType == TDMT_SYNC_REQUEST_VOTE_REPLY) {
- SyncRequestVoteReply *pSyncMsg = syncRequestVoteReplyFromRpcMsg2(pMsg);
- ASSERT(pSyncMsg != NULL);
- code = syncNodeOnRequestVoteReply(pSyncNode, pSyncMsg);
- syncRequestVoteReplyDestroy(pSyncMsg);
-
- } else if (pMsg->msgType == TDMT_SYNC_APPEND_ENTRIES) {
- SyncAppendEntries *pSyncMsg = syncAppendEntriesFromRpcMsg2(pMsg);
- ASSERT(pSyncMsg != NULL);
- code = syncNodeOnAppendEntries(pSyncNode, pSyncMsg);
- syncAppendEntriesDestroy(pSyncMsg);
-
- } else if (pMsg->msgType == TDMT_SYNC_APPEND_ENTRIES_REPLY) {
- SyncAppendEntriesReply *pSyncMsg = syncAppendEntriesReplyFromRpcMsg2(pMsg);
- ASSERT(pSyncMsg != NULL);
- code = syncNodeOnAppendEntriesReply(pSyncNode, pSyncMsg);
- syncAppendEntriesReplyDestroy(pSyncMsg);
-
- } else if (pMsg->msgType == TDMT_SYNC_SNAPSHOT_SEND) {
- SyncSnapshotSend *pSyncMsg = syncSnapshotSendFromRpcMsg2(pMsg);
- code = syncNodeOnSnapshot(pSyncNode, pSyncMsg);
- syncSnapshotSendDestroy(pSyncMsg);
-
- } else if (pMsg->msgType == TDMT_SYNC_SNAPSHOT_RSP) {
- SyncSnapshotRsp *pSyncMsg = syncSnapshotRspFromRpcMsg2(pMsg);
- code = syncNodeOnSnapshotReply(pSyncNode, pSyncMsg);
- syncSnapshotRspDestroy(pSyncMsg);
-
- } else {
- vGError("vgId:%d, msg:%p failed to process since error msg type:%d", pVnode->config.vgId, pMsg, pMsg->msgType);
- code = -1;
+ int32_t code = syncProcessMsg(pVnode->sync, pMsg);
+ if (code != 0) {
+ vGError("vgId:%d, failed to process sync msg:%p type:%s since %s", pVnode->config.vgId, pMsg,
+ TMSG_INFO(pMsg->msgType), terrstr());
}
- vTrace("vgId:%d, sync msg:%p is processed, type:%s code:0x%x", pVnode->config.vgId, pMsg, TMSG_INFO(pMsg->msgType),
- code);
- syncNodeRelease(pSyncNode);
- if (code != 0 && terrno == 0) {
- terrno = TSDB_CODE_SYN_INTERNAL_ERROR;
- }
return code;
}
static int32_t vnodeSyncEqCtrlMsg(const SMsgCb *msgcb, SRpcMsg *pMsg) {
- if (msgcb == NULL) {
+ if (pMsg == NULL || pMsg->pCont == NULL) {
+ return -1;
+ }
+
+ if (msgcb == NULL || msgcb->putToQueueFp == NULL) {
+ rpcFreeCont(pMsg->pCont);
+ pMsg->pCont = NULL;
return -1;
}
@@ -378,7 +263,13 @@ static int32_t vnodeSyncEqCtrlMsg(const SMsgCb *msgcb, SRpcMsg *pMsg) {
}
static int32_t vnodeSyncEqMsg(const SMsgCb *msgcb, SRpcMsg *pMsg) {
- if (msgcb == NULL) {
+ if (pMsg == NULL || pMsg->pCont == NULL) {
+ return -1;
+ }
+
+ if (msgcb == NULL || msgcb->putToQueueFp == NULL) {
+ rpcFreeCont(pMsg->pCont);
+ pMsg->pCont = NULL;
return -1;
}
@@ -399,78 +290,61 @@ static int32_t vnodeSyncSendMsg(const SEpSet *pEpSet, SRpcMsg *pMsg) {
return code;
}
-static int32_t vnodeSyncGetSnapshot(SSyncFSM *pFsm, SSnapshot *pSnapshot) {
+static int32_t vnodeSyncGetSnapshot(const SSyncFSM *pFsm, SSnapshot *pSnapshot) {
vnodeGetSnapshot(pFsm->data, pSnapshot);
return 0;
}
-static void vnodeSyncReconfig(struct SSyncFSM *pFsm, const SRpcMsg *pMsg, SReConfigCbMeta *cbMeta) {}
+static void vnodeSyncApplyMsg(const SSyncFSM *pFsm, const SRpcMsg *pMsg, const SFsmCbMeta *pMeta) {
+ SVnode *pVnode = pFsm->data;
-static void vnodeSyncCommitMsg(SSyncFSM *pFsm, const SRpcMsg *pMsg, SFsmCbMeta cbMeta) {
- if (cbMeta.isWeak == 0) {
- SVnode *pVnode = pFsm->data;
+ if (pMeta->code == 0) {
+ SRpcMsg rpcMsg = {.msgType = pMsg->msgType, .contLen = pMsg->contLen};
+ rpcMsg.pCont = rpcMallocCont(rpcMsg.contLen);
+ memcpy(rpcMsg.pCont, pMsg->pCont, pMsg->contLen);
+ rpcMsg.info = pMsg->info;
+ rpcMsg.info.conn.applyIndex = pMeta->index;
+ rpcMsg.info.conn.applyTerm = pMeta->term;
- if (cbMeta.code == 0) {
- SRpcMsg rpcMsg = {.msgType = pMsg->msgType, .contLen = pMsg->contLen};
- rpcMsg.pCont = rpcMallocCont(rpcMsg.contLen);
- memcpy(rpcMsg.pCont, pMsg->pCont, pMsg->contLen);
- syncGetAndDelRespRpc(pVnode->sync, cbMeta.seqNum, &rpcMsg.info);
- rpcMsg.info.conn.applyIndex = cbMeta.index;
- rpcMsg.info.conn.applyTerm = cbMeta.term;
-
- vInfo("vgId:%d, commit-cb is excuted, fsm:%p, index:%" PRId64 ", term:%" PRIu64 ", msg-index:%" PRId64
+ const STraceId *trace = &pMsg->info.traceId;
+ vGTrace("vgId:%d, commit-cb is excuted, fsm:%p, index:%" PRId64 ", term:%" PRIu64 ", msg-index:%" PRId64
", weak:%d, code:%d, state:%d %s, type:%s",
- syncGetVgId(pVnode->sync), pFsm, cbMeta.index, cbMeta.term, rpcMsg.info.conn.applyIndex, cbMeta.isWeak,
- cbMeta.code, cbMeta.state, syncUtilState2String(cbMeta.state), TMSG_INFO(pMsg->msgType));
+ pVnode->config.vgId, pFsm, pMeta->index, pMeta->term, rpcMsg.info.conn.applyIndex, pMeta->isWeak,
+ pMeta->code, pMeta->state, syncStr(pMeta->state), TMSG_INFO(pMsg->msgType));
- tmsgPutToQueue(&pVnode->msgCb, APPLY_QUEUE, &rpcMsg);
- } else {
- SRpcMsg rsp = {.code = cbMeta.code, .info = pMsg->info};
- vError("vgId:%d, commit-cb execute error, type:%s, index:%" PRId64 ", error:0x%x %s", syncGetVgId(pVnode->sync),
- TMSG_INFO(pMsg->msgType), cbMeta.index, cbMeta.code, tstrerror(cbMeta.code));
- if (rsp.info.handle != NULL) {
- tmsgSendRsp(&rsp);
- }
+ tmsgPutToQueue(&pVnode->msgCb, APPLY_QUEUE, &rpcMsg);
+ } else {
+ SRpcMsg rsp = {.code = pMeta->code, .info = pMsg->info};
+ vError("vgId:%d, commit-cb execute error, type:%s, index:%" PRId64 ", error:0x%x %s", pVnode->config.vgId,
+ TMSG_INFO(pMsg->msgType), pMeta->index, pMeta->code, tstrerror(pMeta->code));
+ if (rsp.info.handle != NULL) {
+ tmsgSendRsp(&rsp);
}
}
}
-static void vnodeSyncPreCommitMsg(SSyncFSM *pFsm, const SRpcMsg *pMsg, SFsmCbMeta cbMeta) {
- if (cbMeta.isWeak == 1) {
- SVnode *pVnode = pFsm->data;
- vTrace("vgId:%d, pre-commit-cb is excuted, fsm:%p, index:%" PRId64 ", weak:%d, code:%d, state:%d %s, type:%s",
- syncGetVgId(pVnode->sync), pFsm, cbMeta.index, cbMeta.isWeak, cbMeta.code, cbMeta.state,
- syncUtilState2String(cbMeta.state), TMSG_INFO(pMsg->msgType));
-
- if (cbMeta.code == 0) {
- SRpcMsg rpcMsg = {.msgType = pMsg->msgType, .contLen = pMsg->contLen};
- rpcMsg.pCont = rpcMallocCont(rpcMsg.contLen);
- memcpy(rpcMsg.pCont, pMsg->pCont, pMsg->contLen);
- syncGetAndDelRespRpc(pVnode->sync, cbMeta.seqNum, &rpcMsg.info);
- rpcMsg.info.conn.applyIndex = cbMeta.index;
- rpcMsg.info.conn.applyTerm = cbMeta.term;
- tmsgPutToQueue(&pVnode->msgCb, APPLY_QUEUE, &rpcMsg);
- } else {
- SRpcMsg rsp = {.code = cbMeta.code, .info = pMsg->info};
- vError("vgId:%d, pre-commit-cb execute error, type:%s, error:0x%x %s", syncGetVgId(pVnode->sync),
- TMSG_INFO(pMsg->msgType), cbMeta.code, tstrerror(cbMeta.code));
- if (rsp.info.handle != NULL) {
- tmsgSendRsp(&rsp);
- }
- }
+static void vnodeSyncCommitMsg(const SSyncFSM *pFsm, const SRpcMsg *pMsg, const SFsmCbMeta *pMeta) {
+ if (pMeta->isWeak == 0) {
+ vnodeSyncApplyMsg(pFsm, pMsg, pMeta);
}
}
-static void vnodeSyncRollBackMsg(SSyncFSM *pFsm, const SRpcMsg *pMsg, SFsmCbMeta cbMeta) {
+static void vnodeSyncPreCommitMsg(const SSyncFSM *pFsm, const SRpcMsg *pMsg, const SFsmCbMeta *pMeta) {
+ if (pMeta->isWeak == 1) {
+ vnodeSyncApplyMsg(pFsm, pMsg, pMeta);
+ }
+}
+
+static void vnodeSyncRollBackMsg(const SSyncFSM *pFsm, const SRpcMsg *pMsg, const SFsmCbMeta *pMeta) {
SVnode *pVnode = pFsm->data;
vTrace("vgId:%d, rollback-cb is excuted, fsm:%p, index:%" PRId64 ", weak:%d, code:%d, state:%d %s, type:%s",
- syncGetVgId(pVnode->sync), pFsm, cbMeta.index, cbMeta.isWeak, cbMeta.code, cbMeta.state,
- syncUtilState2String(cbMeta.state), TMSG_INFO(pMsg->msgType));
+ pVnode->config.vgId, pFsm, pMeta->index, pMeta->isWeak, pMeta->code, pMeta->state, syncStr(pMeta->state),
+ TMSG_INFO(pMsg->msgType));
}
#define USE_TSDB_SNAPSHOT
-static int32_t vnodeSnapshotStartRead(struct SSyncFSM *pFsm, void *pParam, void **ppReader) {
+static int32_t vnodeSnapshotStartRead(const SSyncFSM *pFsm, void *pParam, void **ppReader) {
#ifdef USE_TSDB_SNAPSHOT
SVnode *pVnode = pFsm->data;
SSnapshotParam *pSnapshotParam = pParam;
@@ -482,7 +356,7 @@ static int32_t vnodeSnapshotStartRead(struct SSyncFSM *pFsm, void *pParam, void
#endif
}
-static int32_t vnodeSnapshotStopRead(struct SSyncFSM *pFsm, void *pReader) {
+static int32_t vnodeSnapshotStopRead(const SSyncFSM *pFsm, void *pReader) {
#ifdef USE_TSDB_SNAPSHOT
SVnode *pVnode = pFsm->data;
int32_t code = vnodeSnapReaderClose(pReader);
@@ -493,7 +367,7 @@ static int32_t vnodeSnapshotStopRead(struct SSyncFSM *pFsm, void *pReader) {
#endif
}
-static int32_t vnodeSnapshotDoRead(struct SSyncFSM *pFsm, void *pReader, void **ppBuf, int32_t *len) {
+static int32_t vnodeSnapshotDoRead(const SSyncFSM *pFsm, void *pReader, void **ppBuf, int32_t *len) {
#ifdef USE_TSDB_SNAPSHOT
SVnode *pVnode = pFsm->data;
int32_t code = vnodeSnapRead(pReader, (uint8_t **)ppBuf, len);
@@ -512,7 +386,7 @@ static int32_t vnodeSnapshotDoRead(struct SSyncFSM *pFsm, void *pReader, void **
#endif
}
-static int32_t vnodeSnapshotStartWrite(struct SSyncFSM *pFsm, void *pParam, void **ppWriter) {
+static int32_t vnodeSnapshotStartWrite(const SSyncFSM *pFsm, void *pParam, void **ppWriter) {
#ifdef USE_TSDB_SNAPSHOT
SVnode *pVnode = pFsm->data;
SSnapshotParam *pSnapshotParam = pParam;
@@ -536,7 +410,7 @@ static int32_t vnodeSnapshotStartWrite(struct SSyncFSM *pFsm, void *pParam, void
#endif
}
-static int32_t vnodeSnapshotStopWrite(struct SSyncFSM *pFsm, void *pWriter, bool isApply, SSnapshot *pSnapshot) {
+static int32_t vnodeSnapshotStopWrite(const SSyncFSM *pFsm, void *pWriter, bool isApply, SSnapshot *pSnapshot) {
#ifdef USE_TSDB_SNAPSHOT
SVnode *pVnode = pFsm->data;
vInfo("vgId:%d, stop write vnode snapshot, apply:%d, index:%" PRId64 " term:%" PRIu64 " config:%" PRId64,
@@ -551,7 +425,7 @@ static int32_t vnodeSnapshotStopWrite(struct SSyncFSM *pFsm, void *pWriter, bool
#endif
}
-static int32_t vnodeSnapshotDoWrite(struct SSyncFSM *pFsm, void *pWriter, void *pBuf, int32_t len) {
+static int32_t vnodeSnapshotDoWrite(const SSyncFSM *pFsm, void *pWriter, void *pBuf, int32_t len) {
#ifdef USE_TSDB_SNAPSHOT
SVnode *pVnode = pFsm->data;
vDebug("vgId:%d, continue write vnode snapshot, len:%d", pVnode->config.vgId, len);
@@ -563,9 +437,7 @@ static int32_t vnodeSnapshotDoWrite(struct SSyncFSM *pFsm, void *pWriter, void *
#endif
}
-static void vnodeLeaderTransfer(struct SSyncFSM *pFsm, const SRpcMsg *pMsg, SFsmCbMeta cbMeta) {}
-
-static void vnodeRestoreFinish(struct SSyncFSM *pFsm) {
+static void vnodeRestoreFinish(const SSyncFSM *pFsm) {
SVnode *pVnode = pFsm->data;
do {
@@ -585,7 +457,7 @@ static void vnodeRestoreFinish(struct SSyncFSM *pFsm) {
vDebug("vgId:%d, sync restore finished", pVnode->config.vgId);
}
-static void vnodeBecomeFollower(struct SSyncFSM *pFsm) {
+static void vnodeBecomeFollower(const SSyncFSM *pFsm) {
SVnode *pVnode = pFsm->data;
vDebug("vgId:%d, become follower", pVnode->config.vgId);
@@ -599,7 +471,7 @@ static void vnodeBecomeFollower(struct SSyncFSM *pFsm) {
taosThreadMutexUnlock(&pVnode->lock);
}
-static void vnodeBecomeLeader(struct SSyncFSM *pFsm) {
+static void vnodeBecomeLeader(const SSyncFSM *pFsm) {
SVnode *pVnode = pFsm->data;
vDebug("vgId:%d, become leader", pVnode->config.vgId);
@@ -621,10 +493,10 @@ static SSyncFSM *vnodeSyncMakeFsm(SVnode *pVnode) {
pFsm->FpRollBackCb = vnodeSyncRollBackMsg;
pFsm->FpGetSnapshotInfo = vnodeSyncGetSnapshot;
pFsm->FpRestoreFinishCb = vnodeRestoreFinish;
- pFsm->FpLeaderTransferCb = vnodeLeaderTransfer;
+ pFsm->FpLeaderTransferCb = NULL;
pFsm->FpBecomeLeaderCb = vnodeBecomeLeader;
pFsm->FpBecomeFollowerCb = vnodeBecomeFollower;
- pFsm->FpReConfigCb = vnodeSyncReconfig;
+ pFsm->FpReConfigCb = NULL;
pFsm->FpSnapshotStartRead = vnodeSnapshotStartRead;
pFsm->FpSnapshotStopRead = vnodeSnapshotStopRead;
pFsm->FpSnapshotDoRead = vnodeSnapshotDoRead;
@@ -642,10 +514,13 @@ int32_t vnodeSyncOpen(SVnode *pVnode, char *path) {
.vgId = pVnode->config.vgId,
.syncCfg = pVnode->config.syncCfg,
.pWal = pVnode->pWal,
- .msgcb = NULL,
- .FpSendMsg = vnodeSyncSendMsg,
- .FpEqMsg = vnodeSyncEqMsg,
- .FpEqCtrlMsg = vnodeSyncEqCtrlMsg,
+ .msgcb = &pVnode->msgCb,
+ .syncSendMSg = vnodeSyncSendMsg,
+ .syncEqMsg = vnodeSyncEqMsg,
+ .syncEqCtrlMsg = vnodeSyncEqCtrlMsg,
+ .pingMs = 5000,
+ .electMs = 4000,
+ .heartbeatMs = 700,
};
snprintf(syncInfo.path, sizeof(syncInfo.path), "%s%ssync", path, TD_DIRSEP);
@@ -664,15 +539,11 @@ int32_t vnodeSyncOpen(SVnode *pVnode, char *path) {
return -1;
}
- setPingTimerMS(pVnode->sync, 5000);
- setElectTimerMS(pVnode->sync, 4000);
- setHeartbeatTimerMS(pVnode->sync, 700);
return 0;
}
void vnodeSyncStart(SVnode *pVnode) {
vDebug("vgId:%d, start sync", pVnode->config.vgId);
- syncSetMsgCb(pVnode->sync, &pVnode->msgCb);
syncStart(pVnode->sync);
}
@@ -681,12 +552,21 @@ void vnodeSyncClose(SVnode *pVnode) {
syncStop(pVnode->sync);
}
-bool vnodeIsRoleLeader(SVnode *pVnode) { return syncGetMyRole(pVnode->sync) == TAOS_SYNC_STATE_LEADER; }
+bool vnodeIsRoleLeader(SVnode *pVnode) {
+ SSyncState state = syncGetState(pVnode->sync);
+ return state.state == TAOS_SYNC_STATE_LEADER;
+}
bool vnodeIsLeader(SVnode *pVnode) {
- if (!syncIsReady(pVnode->sync)) {
- vDebug("vgId:%d, vnode not ready, state:%s, restore:%d", pVnode->config.vgId, syncGetMyRoleStr(pVnode->sync),
- syncRestoreFinish(pVnode->sync));
+ SSyncState state = syncGetState(pVnode->sync);
+
+ if (state.state != TAOS_SYNC_STATE_LEADER || !state.restored) {
+ if (state.state != TAOS_SYNC_STATE_LEADER) {
+ terrno = TSDB_CODE_SYN_NOT_LEADER;
+ } else {
+ terrno = TSDB_CODE_APP_NOT_READY;
+ }
+ vDebug("vgId:%d, vnode not ready, state:%s, restore:%d", pVnode->config.vgId, syncStr(state.state), state.restored);
return false;
}
diff --git a/source/libs/catalog/inc/catalogInt.h b/source/libs/catalog/inc/catalogInt.h
index 0786321686..8c699bb59b 100644
--- a/source/libs/catalog/inc/catalogInt.h
+++ b/source/libs/catalog/inc/catalogInt.h
@@ -33,6 +33,7 @@ extern "C" {
#define CTG_DEFAULT_MAX_RETRY_TIMES 3
#define CTG_DEFAULT_BATCH_NUM 64
#define CTG_DEFAULT_FETCH_NUM 8
+#define CTG_MAX_COMMAND_LEN 512
#define CTG_RENT_SLOT_SECOND 1.5
@@ -223,6 +224,7 @@ typedef struct SCtgUserAuth {
typedef struct SCatalog {
uint64_t clusterId;
+ bool stopUpdate;
SHashObj* userCache; // key:user, value:SCtgUserAuth
SHashObj* dbCache; // key:dbname, value:SCtgDBCache
SCtgRentMgmt dbRent;
@@ -671,7 +673,7 @@ void ctgdShowClusterCache(SCatalog* pCtg);
int32_t ctgdShowCacheInfo(void);
int32_t ctgRemoveTbMetaFromCache(SCatalog* pCtg, SName* pTableName, bool syncReq);
-int32_t ctgGetTbMetaFromCache(SCatalog* pCtg, SRequestConnInfo* pConn, SCtgTbMetaCtx* ctx, STableMeta** pTableMeta);
+int32_t ctgGetTbMetaFromCache(SCatalog* pCtg, SCtgTbMetaCtx* ctx, STableMeta** pTableMeta);
int32_t ctgGetTbMetasFromCache(SCatalog* pCtg, SRequestConnInfo* pConn, SCtgTbMetasCtx* ctx, int32_t dbIdx,
int32_t* fetchIdx, int32_t baseResIdx, SArray* pList);
@@ -786,6 +788,7 @@ void ctgFreeTbCacheImpl(SCtgTbCache* pCache);
int32_t ctgRemoveTbMeta(SCatalog* pCtg, SName* pTableName);
int32_t ctgGetTbHashVgroup(SCatalog* pCtg, SRequestConnInfo* pConn, const SName* pTableName, SVgroupInfo* pVgroup, bool* exists);
SName* ctgGetFetchName(SArray* pNames, SCtgFetch* pFetch);
+int32_t ctgdGetOneHandle(SCatalog **pHandle);
extern SCatalogMgmt gCtgMgmt;
extern SCtgDebug gCTGDebug;
diff --git a/source/libs/catalog/src/catalog.c b/source/libs/catalog/src/catalog.c
index b6a22b5fa7..1f87066c82 100644
--- a/source/libs/catalog/src/catalog.c
+++ b/source/libs/catalog/src/catalog.c
@@ -202,7 +202,7 @@ int32_t ctgGetTbMeta(SCatalog* pCtg, SRequestConnInfo* pConn, SCtgTbMetaCtx* ctx
int32_t code = 0;
STableMetaOutput* output = NULL;
- CTG_ERR_RET(ctgGetTbMetaFromCache(pCtg, pConn, ctx, pTableMeta));
+ CTG_ERR_RET(ctgGetTbMetaFromCache(pCtg, ctx, pTableMeta));
if (*pTableMeta || (ctx->flag & CTG_FLAG_ONLY_CACHE)) {
goto _return;
}
@@ -320,7 +320,7 @@ _return:
}
int32_t ctgChkAuth(SCatalog* pCtg, SRequestConnInfo* pConn, const char* user, const char* dbFName, AUTH_TYPE type,
- bool* pass) {
+ bool* pass, bool* exists) {
bool inCache = false;
int32_t code = 0;
@@ -329,6 +329,13 @@ int32_t ctgChkAuth(SCatalog* pCtg, SRequestConnInfo* pConn, const char* user, co
CTG_ERR_RET(ctgChkAuthFromCache(pCtg, (char*)user, (char*)dbFName, type, &inCache, pass));
if (inCache) {
+ if (exists) {
+ *exists = true;
+ }
+
+ return TSDB_CODE_SUCCESS;
+ } else if (exists) {
+ *exists = false;
return TSDB_CODE_SUCCESS;
}
@@ -952,14 +959,14 @@ int32_t catalogGetTableMeta(SCatalog* pCtg, SRequestConnInfo* pConn, const SName
CTG_API_LEAVE(ctgGetTbMeta(pCtg, pConn, &ctx, pTableMeta));
}
-int32_t catalogGetCachedTableMeta(SCatalog* pCtg, SRequestConnInfo* pConn, const SName* pTableName, STableMeta** pTableMeta) {
+int32_t catalogGetCachedTableMeta(SCatalog* pCtg, const SName* pTableName, STableMeta** pTableMeta) {
CTG_API_ENTER();
SCtgTbMetaCtx ctx = {0};
ctx.pName = (SName*)pTableName;
ctx.flag = CTG_FLAG_UNKNOWN_STB | CTG_FLAG_ONLY_CACHE;
- CTG_API_LEAVE(ctgGetTbMeta(pCtg, pConn, &ctx, pTableMeta));
+ CTG_API_LEAVE(ctgGetTbMeta(pCtg, NULL, &ctx, pTableMeta));
}
@@ -974,15 +981,14 @@ int32_t catalogGetSTableMeta(SCatalog* pCtg, SRequestConnInfo* pConn, const SNam
CTG_API_LEAVE(ctgGetTbMeta(pCtg, pConn, &ctx, pTableMeta));
}
-int32_t catalogGetCachedSTableMeta(SCatalog* pCtg, SRequestConnInfo* pConn, const SName* pTableName,
- STableMeta** pTableMeta) {
+int32_t catalogGetCachedSTableMeta(SCatalog* pCtg, const SName* pTableName, STableMeta** pTableMeta) {
CTG_API_ENTER();
SCtgTbMetaCtx ctx = {0};
ctx.pName = (SName*)pTableName;
ctx.flag = CTG_FLAG_STB | CTG_FLAG_ONLY_CACHE;
- CTG_API_LEAVE(ctgGetTbMeta(pCtg, pConn, &ctx, pTableMeta));
+ CTG_API_LEAVE(ctgGetTbMeta(pCtg, NULL, &ctx, pTableMeta));
}
@@ -1032,7 +1038,7 @@ int32_t catalogChkTbMetaVersion(SCatalog* pCtg, SRequestConnInfo* pConn, SArray*
switch (tbType) {
case TSDB_CHILD_TABLE: {
SName stb = name;
- strcpy(stb.tname, stbName);
+ tstrncpy(stb.tname, stbName, sizeof(stb.tname));
ctgRemoveTbMeta(pCtg, &stb);
break;
}
@@ -1107,11 +1113,10 @@ int32_t catalogGetTableHashVgroup(SCatalog* pCtg, SRequestConnInfo* pConn, const
CTG_API_LEAVE(ctgGetTbHashVgroup(pCtg, pConn, pTableName, pVgroup, NULL));
}
-int32_t catalogGetCachedTableHashVgroup(SCatalog* pCtg, SRequestConnInfo* pConn, const SName* pTableName,
- SVgroupInfo* pVgroup, bool* exists) {
+int32_t catalogGetCachedTableHashVgroup(SCatalog* pCtg, const SName* pTableName, SVgroupInfo* pVgroup, bool* exists) {
CTG_API_ENTER();
- CTG_API_LEAVE(ctgGetTbHashVgroup(pCtg, pConn, pTableName, pVgroup, exists));
+ CTG_API_LEAVE(ctgGetTbHashVgroup(pCtg, NULL, pTableName, pVgroup, exists));
}
#if 0
@@ -1373,13 +1378,30 @@ int32_t catalogChkAuth(SCatalog* pCtg, SRequestConnInfo* pConn, const char* user
}
int32_t code = 0;
- CTG_ERR_JRET(ctgChkAuth(pCtg, pConn, user, dbFName, type, pass));
+ CTG_ERR_JRET(ctgChkAuth(pCtg, pConn, user, dbFName, type, pass, NULL));
_return:
CTG_API_LEAVE(code);
}
+int32_t catalogChkAuthFromCache(SCatalog* pCtg, const char* user, const char* dbFName, AUTH_TYPE type,
+ bool* pass, bool* exists) {
+ CTG_API_ENTER();
+
+ if (NULL == pCtg || NULL == user || NULL == dbFName || NULL == pass || NULL == exists) {
+ CTG_API_LEAVE(TSDB_CODE_CTG_INVALID_INPUT);
+ }
+
+ int32_t code = 0;
+ CTG_ERR_JRET(ctgChkAuth(pCtg, NULL, user, dbFName, type, pass, exists));
+
+_return:
+
+ CTG_API_LEAVE(code);
+}
+
+
int32_t catalogGetServerVersion(SCatalog* pCtg, SRequestConnInfo* pConn, char** pVersion) {
CTG_API_ENTER();
diff --git a/source/libs/catalog/src/ctgAsync.c b/source/libs/catalog/src/ctgAsync.c
index 1f1a210699..b601865306 100644
--- a/source/libs/catalog/src/ctgAsync.c
+++ b/source/libs/catalog/src/ctgAsync.c
@@ -1204,11 +1204,15 @@ int32_t ctgHandleGetTbMetasRsp(SCtgTaskReq* tReq, int32_t reqType, const SDataBu
stbCtx.flag = flag;
stbCtx.pName = &stbName;
- taosMemoryFreeClear(pOut->tbMeta);
- CTG_ERR_JRET(ctgReadTbMetaFromCache(pCtg, &stbCtx, &pOut->tbMeta));
- if (pOut->tbMeta) {
+ STableMeta *stbMeta = NULL;
+ ctgReadTbMetaFromCache(pCtg, &stbCtx, &stbMeta);
+ if (stbMeta && stbMeta->sversion >= pOut->tbMeta->sversion) {
ctgDebug("use cached stb meta, tbName:%s", tNameGetTableName(pName));
exist = 1;
+ } else {
+ ctgDebug("need to get/update stb meta, tbName:%s", tNameGetTableName(pName));
+ taosMemoryFreeClear(pOut->tbMeta);
+ taosMemoryFreeClear(stbMeta);
}
}
@@ -1641,7 +1645,7 @@ int32_t ctgLaunchGetTbMetaTask(SCtgTask* pTask) {
pMsgCtx->pBatchs = pJob->pBatchs;
}
- CTG_ERR_RET(ctgGetTbMetaFromCache(pCtg, pConn, (SCtgTbMetaCtx*)pTask->taskCtx, (STableMeta**)&pTask->res));
+ CTG_ERR_RET(ctgGetTbMetaFromCache(pCtg, (SCtgTbMetaCtx*)pTask->taskCtx, (STableMeta**)&pTask->res));
if (pTask->res) {
CTG_ERR_RET(ctgHandleTaskEnd(pTask, 0));
return TSDB_CODE_SUCCESS;
diff --git a/source/libs/catalog/src/ctgCache.c b/source/libs/catalog/src/ctgCache.c
index 61da0724c5..51807a145a 100644
--- a/source/libs/catalog/src/ctgCache.c
+++ b/source/libs/catalog/src/ctgCache.c
@@ -248,6 +248,8 @@ int32_t ctgAcquireStbMetaFromCache(SCatalog *pCtg, char *dbFName, uint64_t suid,
goto _return;
}
+ taosHashRelease(dbCache->stbCache, stName);
+
CTG_LOCK(CTG_READ, &pCache->metaLock);
if (NULL == pCache->pMeta) {
ctgDebug("stb 0x%" PRIx64 " meta not in cache, dbFName:%s", suid, dbFName);
@@ -1550,7 +1552,7 @@ int32_t ctgOpUpdateVgroup(SCtgCacheOperation *operation) {
char *dbFName = msg->dbFName;
SCatalog *pCtg = msg->pCtg;
- if (NULL == dbInfo->vgHash) {
+ if (pCtg->stopUpdate || NULL == dbInfo->vgHash) {
goto _return;
}
@@ -1620,6 +1622,10 @@ int32_t ctgOpDropDbCache(SCtgCacheOperation *operation) {
SCtgDropDBMsg *msg = operation->data;
SCatalog *pCtg = msg->pCtg;
+ if (pCtg->stopUpdate) {
+ goto _return;
+ }
+
SCtgDBCache *dbCache = NULL;
ctgGetDBCache(msg->pCtg, msg->dbFName, &dbCache);
if (NULL == dbCache) {
@@ -1646,6 +1652,10 @@ int32_t ctgOpDropDbVgroup(SCtgCacheOperation *operation) {
SCtgDropDbVgroupMsg *msg = operation->data;
SCatalog *pCtg = msg->pCtg;
+ if (pCtg->stopUpdate) {
+ goto _return;
+ }
+
SCtgDBCache *dbCache = NULL;
ctgGetDBCache(msg->pCtg, msg->dbFName, &dbCache);
if (NULL == dbCache) {
@@ -1675,6 +1685,10 @@ int32_t ctgOpUpdateTbMeta(SCtgCacheOperation *operation) {
STableMetaOutput *pMeta = msg->pMeta;
SCtgDBCache *dbCache = NULL;
+ if (pCtg->stopUpdate) {
+ goto _return;
+ }
+
if ((!CTG_IS_META_CTABLE(pMeta->metaType)) && NULL == pMeta->tbMeta) {
ctgError("no valid tbmeta got from meta rsp, dbFName:%s, tbName:%s", pMeta->dbFName, pMeta->tbName);
CTG_ERR_JRET(TSDB_CODE_CTG_INTERNAL_ERROR);
@@ -1723,6 +1737,10 @@ int32_t ctgOpDropStbMeta(SCtgCacheOperation *operation) {
SCtgDropStbMetaMsg *msg = operation->data;
SCatalog *pCtg = msg->pCtg;
+ if (pCtg->stopUpdate) {
+ goto _return;
+ }
+
SCtgDBCache *dbCache = NULL;
ctgGetDBCache(pCtg, msg->dbFName, &dbCache);
if (NULL == dbCache) {
@@ -1776,6 +1794,10 @@ int32_t ctgOpDropTbMeta(SCtgCacheOperation *operation) {
SCtgDropTblMetaMsg *msg = operation->data;
SCatalog *pCtg = msg->pCtg;
+ if (pCtg->stopUpdate) {
+ goto _return;
+ }
+
SCtgDBCache *dbCache = NULL;
ctgGetDBCache(pCtg, msg->dbFName, &dbCache);
if (NULL == dbCache) {
@@ -1819,6 +1841,10 @@ int32_t ctgOpUpdateUser(SCtgCacheOperation *operation) {
SCtgUpdateUserMsg *msg = operation->data;
SCatalog *pCtg = msg->pCtg;
+ if (pCtg->stopUpdate) {
+ goto _return;
+ }
+
SCtgUserAuth *pUser = (SCtgUserAuth *)taosHashGet(pCtg->userCache, msg->userAuth.user, strlen(msg->userAuth.user));
if (NULL == pUser) {
SCtgUserAuth userAuth = {0};
@@ -1872,8 +1898,12 @@ int32_t ctgOpUpdateEpset(SCtgCacheOperation *operation) {
int32_t code = 0;
SCtgUpdateEpsetMsg *msg = operation->data;
SCatalog *pCtg = msg->pCtg;
-
SCtgDBCache *dbCache = NULL;
+
+ if (pCtg->stopUpdate) {
+ goto _return;
+ }
+
CTG_ERR_JRET(ctgGetDBCache(pCtg, msg->dbFName, &dbCache));
if (NULL == dbCache) {
ctgDebug("db %s not exist, ignore epset update", msg->dbFName);
@@ -1920,6 +1950,10 @@ int32_t ctgOpUpdateTbIndex(SCtgCacheOperation *operation) {
STableIndex *pIndex = msg->pIndex;
SCtgDBCache *dbCache = NULL;
+ if (pCtg->stopUpdate) {
+ goto _return;
+ }
+
CTG_ERR_JRET(ctgGetAddDBCache(pCtg, pIndex->dbFName, 0, &dbCache));
CTG_ERR_JRET(ctgWriteTbIndexToCache(pCtg, dbCache, pIndex->dbFName, pIndex->tbName, &pIndex));
@@ -1942,6 +1976,10 @@ int32_t ctgOpDropTbIndex(SCtgCacheOperation *operation) {
SCatalog *pCtg = msg->pCtg;
SCtgDBCache *dbCache = NULL;
+ if (pCtg->stopUpdate) {
+ goto _return;
+ }
+
CTG_ERR_JRET(ctgGetDBCache(pCtg, msg->dbFName, &dbCache));
if (NULL == dbCache) {
return TSDB_CODE_SUCCESS;
@@ -2154,7 +2192,7 @@ int32_t ctgStartUpdateThread() {
return TSDB_CODE_SUCCESS;
}
-int32_t ctgGetTbMetaFromCache(SCatalog *pCtg, SRequestConnInfo *pConn, SCtgTbMetaCtx *ctx, STableMeta **pTableMeta) {
+int32_t ctgGetTbMetaFromCache(SCatalog *pCtg, SCtgTbMetaCtx *ctx, STableMeta **pTableMeta) {
if (IS_SYS_DBNAME(ctx->pName->dbname)) {
CTG_FLAG_SET_SYS_DB(ctx->flag);
}
diff --git a/source/libs/catalog/src/ctgDbg.c b/source/libs/catalog/src/ctgDbg.c
index dbca2ad977..26b5903bb0 100644
--- a/source/libs/catalog/src/ctgDbg.c
+++ b/source/libs/catalog/src/ctgDbg.c
@@ -226,28 +226,45 @@ _return:
CTG_RET(code);
}
-int32_t ctgdEnableDebug(char *option) {
+int32_t ctgdEnableDebug(char *option, bool enable) {
if (0 == strcasecmp(option, "lock")) {
- gCTGDebug.lockEnable = true;
- qDebug("lock debug enabled");
+ gCTGDebug.lockEnable = enable;
+ qDebug("catalog lock debug set to %d", enable);
return TSDB_CODE_SUCCESS;
}
if (0 == strcasecmp(option, "cache")) {
- gCTGDebug.cacheEnable = true;
- qDebug("cache debug enabled");
+ gCTGDebug.cacheEnable = enable;
+ qDebug("catalog cache debug set to %d", enable);
return TSDB_CODE_SUCCESS;
}
if (0 == strcasecmp(option, "api")) {
- gCTGDebug.apiEnable = true;
- qDebug("api debug enabled");
+ gCTGDebug.apiEnable = enable;
+ qDebug("catalog api debug set to %d", enable);
return TSDB_CODE_SUCCESS;
}
if (0 == strcasecmp(option, "meta")) {
- gCTGDebug.metaEnable = true;
- qDebug("api debug enabled");
+ gCTGDebug.metaEnable = enable;
+ qDebug("catalog meta debug set to %d", enable);
+ return TSDB_CODE_SUCCESS;
+ }
+
+ if (0 == strcasecmp(option, "stopUpdate")) {
+ SCatalog *pCtg = NULL;
+
+ void *pIter = taosHashIterate(gCtgMgmt.pCluster, NULL);
+ while (pIter) {
+ pCtg = *(SCatalog **)pIter;
+
+ pCtg->stopUpdate = enable;
+
+ pIter = taosHashIterate(gCtgMgmt.pCluster, pIter);
+ }
+
+ qDebug("catalog stopUpdate set to %d", enable);
+
return TSDB_CODE_SUCCESS;
}
@@ -256,6 +273,77 @@ int32_t ctgdEnableDebug(char *option) {
return TSDB_CODE_CTG_INTERNAL_ERROR;
}
+int32_t ctgdHandleDbgCommand(char *command) {
+ if (NULL == command) {
+ CTG_RET(TSDB_CODE_INVALID_PARA);
+ }
+
+ if (strlen(command) > CTG_MAX_COMMAND_LEN) {
+ CTG_RET(TSDB_CODE_INVALID_PARA);
+ }
+
+ char *dup = strdup(command);
+ char *option = NULL;
+ char *param = NULL;
+
+ int32_t i = 0;
+ bool newItem = true;
+ while (*(dup + i)) {
+ if (isspace(*(dup + i))) {
+ *(dup + i) = 0;
+ ++i;
+ newItem = true;
+ continue;
+ }
+
+ if (!newItem) {
+ ++i;
+ continue;
+ }
+
+ newItem = false;
+ if (NULL == option) {
+ option = dup + i;
+ ++i;
+ continue;
+ }
+
+ if (NULL == param) {
+ param = dup + i;
+ ++i;
+ continue;
+ }
+
+ taosMemoryFree(dup);
+ CTG_RET(TSDB_CODE_INVALID_PARA);
+ }
+
+ bool enable = atoi(param);
+
+ int32_t code = ctgdEnableDebug(option, enable);
+
+ taosMemoryFree(dup);
+
+ CTG_RET(code);
+}
+
+int32_t ctgdGetOneHandle(SCatalog **pHandle) {
+ SCatalog *pCtg = NULL;
+
+ void *pIter = taosHashIterate(gCtgMgmt.pCluster, NULL);
+ while (pIter) {
+ pCtg = *(SCatalog **)pIter;
+
+ taosHashCancelIterate(gCtgMgmt.pCluster, pIter);
+ break;
+ }
+
+ *pHandle = pCtg;
+
+ return TSDB_CODE_SUCCESS;
+}
+
+
int32_t ctgdGetStatNum(char *option, void *res) {
if (0 == strcasecmp(option, "runtime.numOfOpDequeue")) {
*(uint64_t *)res = atomic_load_64(&gCtgMgmt.stat.runtime.numOfOpDequeue);
diff --git a/source/libs/catalog/src/ctgUtil.c b/source/libs/catalog/src/ctgUtil.c
index 4a64a8666e..3d21bbbcd9 100644
--- a/source/libs/catalog/src/ctgUtil.c
+++ b/source/libs/catalog/src/ctgUtil.c
@@ -924,6 +924,11 @@ int32_t ctgGetVgInfosFromHashValue(SCatalog* pCtg, SCtgTaskReq* tReq, SDBVgInfo*
if (1 == vgNum) {
void* pIter = taosHashIterate(dbInfo->vgHash, NULL);
+ if (NULL == pIter) {
+ ctgError("empty vgHash, db:%s, vgroup number:%d", dbFName, vgNum);
+ CTG_ERR_RET(TSDB_CODE_CTG_INTERNAL_ERROR);
+ }
+
for (int32_t i = 0; i < tbNum; ++i) {
vgInfo = taosMemoryMalloc(sizeof(SVgroupInfo));
if (NULL == vgInfo) {
diff --git a/source/libs/catalog/test/catalogTests.cpp b/source/libs/catalog/test/catalogTests.cpp
index 0bdd9841ab..ebf7c7baeb 100644
--- a/source/libs/catalog/test/catalogTests.cpp
+++ b/source/libs/catalog/test/catalogTests.cpp
@@ -41,7 +41,6 @@
namespace {
extern "C" int32_t ctgdGetClusterCacheNum(struct SCatalog *pCatalog, int32_t type);
-extern "C" int32_t ctgdEnableDebug(char *option);
extern "C" int32_t ctgdGetStatNum(char *option, void *res);
void ctgTestSetRspTableMeta();
@@ -49,6 +48,8 @@ void ctgTestSetRspCTableMeta();
void ctgTestSetRspSTableMeta();
void ctgTestSetRspMultiSTableMeta();
+extern int32_t clientConnRefPool;
+
enum {
CTGT_RSP_VGINFO = 1,
CTGT_RSP_TBMETA,
@@ -151,10 +152,10 @@ void ctgTestInitLogFile() {
qDebugFlag = 159;
strcpy(tsLogDir, TD_LOG_DIR_PATH);
- ctgdEnableDebug("api");
- ctgdEnableDebug("meta");
- ctgdEnableDebug("cache");
- ctgdEnableDebug("lock");
+ ctgdEnableDebug("api", true);
+ ctgdEnableDebug("meta", true);
+ ctgdEnableDebug("cache", true);
+ ctgdEnableDebug("lock", true);
if (taosInitLog(defaultLogFileNamePrefix, maxLogFileNum) < 0) {
printf("failed to open log file in directory:%s\n", tsLogDir);
@@ -1204,6 +1205,34 @@ void *ctgTestSetCtableMetaThread(void *param) {
}
+void ctgTestFetchRows(TAOS_RES *result, int32_t *rows) {
+ TAOS_ROW row;
+ int num_fields = taos_num_fields(result);
+ TAOS_FIELD *fields = taos_fetch_fields(result);
+ char temp[256];
+
+ // fetch the records row by row
+ while ((row = taos_fetch_row(result))) {
+ (*rows)++;
+ memset(temp, 0, sizeof(temp));
+ taos_print_row(temp, row, fields, num_fields);
+ printf("\t[%s]\n", temp);
+ }
+}
+
+void ctgTestExecQuery(TAOS * taos, char* sql, bool fetch, int32_t *rows) {
+ TAOS_RES *result = taos_query(taos, sql);
+ int code = taos_errno(result);
+ ASSERT_EQ(code, 0);
+
+ if (fetch) {
+ ctgTestFetchRows(result, rows);
+ }
+
+ taos_free_result(result);
+}
+
+
TEST(tableMeta, normalTable) {
struct SCatalog *pCtg = NULL;
SVgroupInfo vgInfo = {0};
@@ -1245,7 +1274,7 @@ TEST(tableMeta, normalTable) {
memset(&vgInfo, 0, sizeof(vgInfo));
bool exists = false;
- code = catalogGetCachedTableHashVgroup(pCtg, mockPointer, &n, &vgInfo, &exists);
+ code = catalogGetCachedTableHashVgroup(pCtg, &n, &vgInfo, &exists);
ASSERT_EQ(code, 0);
ASSERT_EQ(vgInfo.vgId, 8);
ASSERT_EQ(vgInfo.epSet.numOfEps, 3);
@@ -1292,7 +1321,7 @@ TEST(tableMeta, normalTable) {
taosMemoryFree(tableMeta);
tableMeta = NULL;
- catalogGetCachedTableMeta(pCtg, mockPointer, &n, &tableMeta);
+ catalogGetCachedTableMeta(pCtg, &n, &tableMeta);
ASSERT_EQ(code, 0);
ASSERT_EQ(tableMeta->vgId, 8);
ASSERT_EQ(tableMeta->tableType, TSDB_NORMAL_TABLE);
@@ -1500,7 +1529,7 @@ TEST(tableMeta, superTableCase) {
}
tableMeta = NULL;
- code = catalogGetCachedSTableMeta(pCtg, mockPointer, &n, &tableMeta);
+ code = catalogGetCachedSTableMeta(pCtg, &n, &tableMeta);
ASSERT_EQ(code, 0);
ASSERT_EQ(tableMeta->vgId, 0);
ASSERT_EQ(tableMeta->tableType, TSDB_SUPER_TABLE);
@@ -2771,10 +2800,30 @@ TEST(apiTest, catalogChkAuth_test) {
ASSERT_EQ(code, 0);
bool pass = false;
+ bool exists = false;
+ code = catalogChkAuthFromCache(pCtg, ctgTestUsername, ctgTestDbname, AUTH_TYPE_READ, &pass, &exists);
+ ASSERT_EQ(code, 0);
+ ASSERT_EQ(exists, false);
+
code = catalogChkAuth(pCtg, mockPointer, ctgTestUsername, ctgTestDbname, AUTH_TYPE_READ, &pass);
ASSERT_EQ(code, 0);
ASSERT_EQ(pass, true);
+ while (true) {
+ uint64_t n = 0;
+ ctgdGetStatNum("runtime.numOfOpDequeue", (void *)&n);
+ if (n != 1) {
+ taosMsleep(50);
+ } else {
+ break;
+ }
+ }
+
+ code = catalogChkAuthFromCache(pCtg, ctgTestUsername, ctgTestDbname, AUTH_TYPE_READ, &pass, &exists);
+ ASSERT_EQ(code, 0);
+ ASSERT_EQ(pass, true);
+ ASSERT_EQ(exists, true);
+
catalogDestroy();
}
@@ -3043,6 +3092,58 @@ TEST(apiTest, catalogGetDnodeList_test) {
catalogDestroy();
}
+#ifdef INTEGRATION_TEST
+TEST(intTest, autoCreateTableTest) {
+ struct SCatalog *pCtg = NULL;
+
+ TAOS *taos = taos_connect("localhost", "root", "taosdata", NULL, 0);
+ ASSERT_TRUE(NULL != taos);
+
+ ctgdEnableDebug("api", true);
+ ctgdEnableDebug("meta", true);
+ ctgdEnableDebug("cache", true);
+ ctgdEnableDebug("lock", true);
+
+ ctgTestExecQuery(taos, "drop database if exists db1", false, NULL);
+ ctgTestExecQuery(taos, "create database db1", false, NULL);
+ ctgTestExecQuery(taos, "create stable db1.st1 (ts timestamp, f1 int) tags(tg1 int)", false, NULL);
+ ctgTestExecQuery(taos, "insert into db1.tb1 using db1.st1 tags(1) values(now, 1)", false, NULL);
+
+ ctgdGetOneHandle(&pCtg);
+
+ while (true) {
+ uint32_t n = ctgdGetClusterCacheNum(pCtg, CTG_DBG_META_NUM);
+ if (2 != n) {
+ taosMsleep(50);
+ } else {
+ break;
+ }
+ }
+
+ uint64_t n = 0, m = 0;
+ ctgdGetStatNum("runtime.numOfOpDequeue", (void *)&n);
+
+ ctgTestExecQuery(taos, "insert into db1.tb1 using db1.st1 tags(1) values(now, 2)", false, NULL);
+
+ ctgTestExecQuery(taos, "insert into db1.tb1 values(now, 3)", false, NULL);
+
+ taosMsleep(1000);
+ ctgdGetStatNum("runtime.numOfOpDequeue", (void *)&m);
+
+ ASSERT_EQ(n, m);
+
+ ctgdEnableDebug("stopUpdate", true);
+ ctgTestExecQuery(taos, "alter table db1.st1 add column f2 double", false, NULL);
+
+ ctgdEnableDebug("stopUpdate", false);
+
+ ctgTestExecQuery(taos, "insert into db1.tb1 (ts, f1) values(now, 4)", false, NULL);
+
+ taos_close(taos);
+}
+
+#endif
+
int main(int argc, char **argv) {
testing::InitGoogleTest(&argc, argv);
diff --git a/source/libs/command/inc/commandInt.h b/source/libs/command/inc/commandInt.h
index ce4c4cf09b..4d0c5389e1 100644
--- a/source/libs/command/inc/commandInt.h
+++ b/source/libs/command/inc/commandInt.h
@@ -96,6 +96,7 @@ extern "C" {
#define COMMAND_RESET_LOG "resetLog"
#define COMMAND_SCHEDULE_POLICY "schedulePolicy"
#define COMMAND_ENABLE_RESCHEDULE "enableReSchedule"
+#define COMMAND_CATALOG_DEBUG "catalogDebug"
typedef struct SExplainGroup {
int32_t nodeNum;
diff --git a/source/libs/command/src/command.c b/source/libs/command/src/command.c
index 47a904bba2..76c84b3be9 100644
--- a/source/libs/command/src/command.c
+++ b/source/libs/command/src/command.c
@@ -571,6 +571,8 @@ static int32_t execAlterCmd(char* cmd, char* value, bool* processed) {
code = schedulerUpdatePolicy(atoi(value));
} else if (0 == strcasecmp(cmd, COMMAND_ENABLE_RESCHEDULE)) {
code = schedulerEnableReSchedule(atoi(value));
+ } else if (0 == strcasecmp(cmd, COMMAND_CATALOG_DEBUG)) {
+ code = ctgdHandleDbgCommand(value);
} else {
goto _return;
}
diff --git a/source/libs/executor/inc/executil.h b/source/libs/executor/inc/executil.h
index 76a3359b5b..fd8a357a8b 100644
--- a/source/libs/executor/inc/executil.h
+++ b/source/libs/executor/inc/executil.h
@@ -96,11 +96,12 @@ typedef struct SColMatchInfo {
int32_t matchType; // determinate the source according to col id or slot id
} SColMatchInfo;
+typedef struct SExecTaskInfo SExecTaskInfo;
typedef struct STableListInfo STableListInfo;
struct SqlFunctionCtx;
int32_t createScanTableListInfo(SScanPhysiNode* pScanNode, SNodeList* pGroupTags, bool groupSort, SReadHandle* pHandle,
- STableListInfo* pTableListInfo, SNode* pTagCond, SNode* pTagIndexCond, const char* id);
+ STableListInfo* pTableListInfo, SNode* pTagCond, SNode* pTagIndexCond, SExecTaskInfo* pTaskInfo);
STableListInfo* tableListCreate();
void* tableListDestroy(STableListInfo* pTableListInfo);
diff --git a/source/libs/executor/inc/executorimpl.h b/source/libs/executor/inc/executorimpl.h
index 1191b6a485..14159c2da2 100644
--- a/source/libs/executor/inc/executorimpl.h
+++ b/source/libs/executor/inc/executorimpl.h
@@ -89,25 +89,10 @@ typedef struct STableScanAnalyzeInfo SFileBlockLoadRecorder;
typedef struct STaskCostInfo {
int64_t created;
int64_t start;
- uint64_t loadStatisTime;
- uint64_t loadFileBlockTime;
- uint64_t loadDataInCacheTime;
- uint64_t loadStatisSize;
- uint64_t loadFileBlockSize;
- uint64_t loadDataInCacheSize;
-
- uint64_t loadDataTime;
-
+ uint64_t elapsedTime;
+ double extractListTime;
+ double groupIdMapTime;
SFileBlockLoadRecorder* pRecoder;
- uint64_t elapsedTime;
-
- uint64_t winInfoSize;
- uint64_t tableInfoSize;
- uint64_t hashSize;
- uint64_t numOfTimeWindows;
-
- SArray* queryProfEvents; // SArray
- SHashObj* operatorProfResults; // map
} STaskCostInfo;
typedef struct SOperatorCostInfo {
@@ -150,18 +135,13 @@ typedef struct {
SSchemaWrapper* schema;
char tbName[TSDB_TABLE_NAME_LEN];
- SSDataBlock* pullOverBlk; // for streaming
- SWalFilterCond cond;
- int64_t lastScanUid;
int8_t recoverStep;
SQueryTableDataCond tableCond;
- int64_t recoverStartVer;
- int64_t recoverEndVer;
int64_t fillHistoryVer1;
int64_t fillHistoryVer2;
- int8_t triggerSaved;
- int64_t deleteMarkSaved;
+ // int8_t triggerSaved;
+ // int64_t deleteMarkSaved;
SStreamState* pState;
} SStreamTaskInfo;
@@ -461,8 +441,10 @@ typedef struct SPartitionDataInfo {
typedef struct STimeWindowAggSupp {
int8_t calTrigger;
- int64_t waterMark;
+ int8_t calTriggerSaved;
int64_t deleteMark;
+ int64_t deleteMarkSaved;
+ int64_t waterMark;
TSKEY maxTs;
TSKEY minTs;
SColumnInfoData timeWindowData; // query time window info for scalar function execution.
@@ -921,7 +903,7 @@ int32_t getBufferPgSize(int32_t rowSize, uint32_t* defaultPgsz, uint32_t* defaul
void doSetOperatorCompleted(SOperatorInfo* pOperator);
void doFilter(const SNode* pFilterNode, SSDataBlock* pBlock, SColMatchInfo* pColMatchInfo, SFilterInfo* pFilterInfo);
int32_t addTagPseudoColumnData(SReadHandle* pHandle, SExprInfo* pPseudoExpr, int32_t numOfPseudoExpr,
- SSDataBlock* pBlock, const char* idStr);
+ SSDataBlock* pBlock, int32_t rows, const char* idStr);
void cleanupAggSup(SAggSupporter* pAggSup);
void appendOneRowToDataBlock(SSDataBlock* pBlock, STupleHandle* pTupleHandle);
diff --git a/source/libs/executor/src/cachescanoperator.c b/source/libs/executor/src/cachescanoperator.c
index 92e98d3eab..bcd59e83f0 100644
--- a/source/libs/executor/src/cachescanoperator.c
+++ b/source/libs/executor/src/cachescanoperator.c
@@ -152,25 +152,27 @@ SSDataBlock* doScanCache(SOperatorInfo* pOperator) {
pInfo->indexOfBufferedRes = 0;
}
+ SSDataBlock* pRes = pInfo->pRes;
+
if (pInfo->indexOfBufferedRes < pInfo->pBufferredRes->info.rows) {
for (int32_t i = 0; i < taosArrayGetSize(pInfo->matchInfo.pList); ++i) {
SColMatchItem* pMatchInfo = taosArrayGet(pInfo->matchInfo.pList, i);
int32_t slotId = pMatchInfo->dstSlotId;
SColumnInfoData* pSrc = taosArrayGet(pInfo->pBufferredRes->pDataBlock, slotId);
- SColumnInfoData* pDst = taosArrayGet(pInfo->pRes->pDataBlock, slotId);
+ SColumnInfoData* pDst = taosArrayGet(pRes->pDataBlock, slotId);
char* p = colDataGetData(pSrc, pInfo->indexOfBufferedRes);
bool isNull = colDataIsNull_s(pSrc, pInfo->indexOfBufferedRes);
colDataAppend(pDst, 0, p, isNull);
}
- pInfo->pRes->info.uid = *(tb_uid_t*)taosArrayGet(pInfo->pUidList, pInfo->indexOfBufferedRes);
- pInfo->pRes->info.rows = 1;
+ pRes->info.uid = *(tb_uid_t*)taosArrayGet(pInfo->pUidList, pInfo->indexOfBufferedRes);
+ pRes->info.rows = 1;
if (pInfo->pseudoExprSup.numOfExprs > 0) {
SExprSupp* pSup = &pInfo->pseudoExprSup;
- int32_t code = addTagPseudoColumnData(&pInfo->readHandle, pSup->pExprInfo, pSup->numOfExprs, pInfo->pRes,
+ int32_t code = addTagPseudoColumnData(&pInfo->readHandle, pSup->pExprInfo, pSup->numOfExprs, pRes, pRes->info.rows,
GET_TASKID(pTaskInfo));
if (code != TSDB_CODE_SUCCESS) {
pTaskInfo->code = code;
@@ -178,10 +180,9 @@ SSDataBlock* doScanCache(SOperatorInfo* pOperator) {
}
}
- pInfo->pRes->info.groupId = getTableGroupId(pTableList, pInfo->pRes->info.uid);
-
+ pRes->info.groupId = getTableGroupId(pTableList, pRes->info.uid);
pInfo->indexOfBufferedRes += 1;
- return pInfo->pRes;
+ return pRes;
} else {
doSetOperatorCompleted(pOperator);
return NULL;
@@ -221,7 +222,7 @@ SSDataBlock* doScanCache(SOperatorInfo* pOperator) {
ASSERT((pInfo->retrieveType & CACHESCAN_RETRIEVE_LAST_ROW) == CACHESCAN_RETRIEVE_LAST_ROW);
pInfo->pRes->info.uid = *(tb_uid_t*)taosArrayGet(pInfo->pUidList, 0);
- code = addTagPseudoColumnData(&pInfo->readHandle, pSup->pExprInfo, pSup->numOfExprs, pInfo->pRes,
+ code = addTagPseudoColumnData(&pInfo->readHandle, pSup->pExprInfo, pSup->numOfExprs, pInfo->pRes, pInfo->pRes->info.rows,
GET_TASKID(pTaskInfo));
if (code != TSDB_CODE_SUCCESS) {
pTaskInfo->code = code;
diff --git a/source/libs/executor/src/executil.c b/source/libs/executor/src/executil.c
index bb87b5029a..567ced5b90 100644
--- a/source/libs/executor/src/executil.c
+++ b/source/libs/executor/src/executil.c
@@ -30,10 +30,10 @@
// The numOfOutputGroups is specified by physical plan. and will not be affect by numOfGroups
struct STableListInfo {
bool oneTableForEachGroup;
- int32_t numOfOuputGroups; // the data block will be generated one by one
- int32_t* groupOffset; // keep the offset value for each group in the tableList
+ int32_t numOfOuputGroups; // the data block will be generated one by one
+ int32_t* groupOffset; // keep the offset value for each group in the tableList
SArray* pTableList;
- SHashObj* map; // speedup acquire the tableQueryInfo by table uid
+ SHashObj* map; // speedup acquire the tableQueryInfo by table uid
uint64_t suid;
};
@@ -775,75 +775,6 @@ end:
return code;
}
-static int tableUidCompare(const void* a, const void* b) {
- int64_t u1 = *(uint64_t*)a;
- int64_t u2 = *(uint64_t*)b;
- if (u1 == u2) {
- return 0;
- }
- return u1 < u2 ? -1 : 1;
-}
-
-static int32_t optimizeTbnameInCond(void* metaHandle, int64_t suid, SArray* list, SNode* cond, SHashObj* tags) {
- 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);
- }
- }
-
- if (nodeType(cond) != QUERY_NODE_LOGIC_CONDITION || ((SLogicConditionNode*)cond)->condType != LOGIC_COND_TYPE_AND) {
- return ret;
- }
-
- bool hasTbnameCond = false;
- SLogicConditionNode* pNode = (SLogicConditionNode*)cond;
- SNodeList* pList = (SNodeList*)pNode->pParameterList;
-
- int32_t len = LIST_LENGTH(pList);
- if (len <= 0) return ret;
-
- SListCell* cell = pList->pHead;
- for (int i = 0; i < len; i++) {
- if (cell == NULL) break;
- if (optimizeTbnameInCondImpl(metaHandle, suid, list, cell->pNode) == 0) {
- hasTbnameCond = true;
- break;
- }
- cell = cell->pNext;
- }
- taosArraySort(list, tableUidCompare);
- taosArrayRemoveDuplicate(list, tableUidCompare, NULL);
-
- if (hasTbnameCond) {
- ret = metaGetTableTagsByUids(metaHandle, suid, list, tags);
- removeInvalidTable(list, tags);
- }
- return ret;
-}
-
-/*
- * handle invalid uid
- */
-static int32_t removeInvalidTable(SArray* uids, SHashObj* tags) {
- if (taosArrayGetSize(uids) <= 0) return 0;
-
- SArray* validUid = taosArrayInit(taosArrayGetSize(uids), sizeof(int64_t));
-
- 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);
- }
- }
-
- taosArraySwap(uids, validUid);
- taosArrayDestroy(validUid);
- return 0;
-}
-
static int32_t nameComparFn(const void* p1, const void* p2) {
const char* pName1 = *(const char**)p1;
const char* pName2 = *(const char**)p2;
@@ -897,6 +828,81 @@ static SArray* getTableNameList(const SNodeListNode* pList) {
return pNewList;
}
+static int tableUidCompare(const void* a, const void* b) {
+ uint64_t u1 = *(uint64_t*)a;
+ uint64_t u2 = *(uint64_t*)b;
+
+ if (u1 == u2) {
+ return 0;
+ }
+
+ return u1 < u2 ? -1 : 1;
+}
+
+static int32_t optimizeTbnameInCond(void* metaHandle, int64_t suid, SArray* list, SNode* cond, SHashObj* tags) {
+ 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);
+ }
+ }
+
+ if (nodeType(cond) != QUERY_NODE_LOGIC_CONDITION || ((SLogicConditionNode*)cond)->condType != LOGIC_COND_TYPE_AND) {
+ return ret;
+ }
+
+ bool hasTbnameCond = false;
+ SLogicConditionNode* pNode = (SLogicConditionNode*)cond;
+ SNodeList* pList = (SNodeList*)pNode->pParameterList;
+
+ int32_t len = LIST_LENGTH(pList);
+ if (len <= 0) {
+ return ret;
+ }
+
+ SListCell* cell = pList->pHead;
+ for (int i = 0; i < len; i++) {
+ if (cell == NULL) break;
+ if (optimizeTbnameInCondImpl(metaHandle, suid, list, cell->pNode) == 0) {
+ hasTbnameCond = true;
+ break;
+ }
+ cell = cell->pNext;
+ }
+
+ taosArraySort(list, tableUidCompare);
+ taosArrayRemoveDuplicate(list, tableUidCompare, NULL);
+
+ if (hasTbnameCond) {
+ ret = metaGetTableTagsByUids(metaHandle, suid, list, tags);
+ removeInvalidTable(list, tags);
+ }
+
+ return ret;
+}
+
+/*
+ * handle invalid uid
+ */
+static int32_t removeInvalidTable(SArray* uids, SHashObj* tags) {
+ if (taosArrayGetSize(uids) <= 0) return 0;
+
+ SArray* validUid = taosArrayInit(taosArrayGetSize(uids), sizeof(int64_t));
+
+ 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);
+ }
+ }
+
+ taosArraySwap(uids, validUid);
+ taosArrayDestroy(validUid);
+ return 0;
+}
+
static int32_t optimizeTbnameInCondImpl(void* metaHandle, int64_t suid, SArray* list, SNode* pTagCond) {
if (nodeType(pTagCond) != QUERY_NODE_OPERATOR) {
return -1;
@@ -919,6 +925,15 @@ 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));
+ }
+ }
for (int i = 0; i < numOfTables; i++) {
char* name = taosArrayGetP(pTbList, i);
@@ -927,9 +942,12 @@ static int32_t optimizeTbnameInCondImpl(void* metaHandle, int64_t suid, SArray*
if (metaGetTableUidByName(metaHandle, name, &uid) == 0) {
ETableType tbType = TSDB_TABLE_MAX;
if (metaGetTableTypeByName(metaHandle, name, &tbType) == 0 && tbType == TSDB_CHILD_TABLE) {
- taosArrayPush(list, &uid);
+ if (NULL == uHash || taosHashGet(uHash, &uid, sizeof(uid)) == NULL) {
+ taosArrayPush(list, &uid);
+ }
} else {
taosArrayDestroy(pTbList);
+ taosHashCleanup(uHash);
return -1;
}
} else {
@@ -938,6 +956,7 @@ static int32_t optimizeTbnameInCondImpl(void* metaHandle, int64_t suid, SArray*
}
}
+ taosHashCleanup(uHash);
taosArrayDestroy(pTbList);
return 0;
}
@@ -1672,9 +1691,7 @@ uint64_t tableListGetSize(const STableListInfo* pTableList) {
return taosArrayGetSize(pTableList->pTableList);
}
-uint64_t tableListGetSuid(const STableListInfo* pTableList) {
- return pTableList->suid;
-}
+uint64_t tableListGetSuid(const STableListInfo* pTableList) { return pTableList->suid; }
STableKeyInfo* tableListGetInfo(const STableListInfo* pTableList, int32_t index) {
if (taosArrayGetSize(pTableList->pTableList) == 0) {
@@ -1712,7 +1729,7 @@ 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* size) {
int32_t total = tableListGetOutputGroups(pTableList);
if (ordinalGroupIndex < 0 || ordinalGroupIndex >= total) {
return TSDB_CODE_INVALID_PARA;
@@ -1722,7 +1739,7 @@ int32_t tableListGetGroupList(const STableListInfo* pTableList, int32_t ordinalG
// 1. only one group exists, and 2. one table exists for each group.
if (total == 1) {
*size = tableListGetSize(pTableList);
- *pKeyInfo = (*size == 0)? NULL:taosArrayGet(pTableList->pTableList, 0);
+ *pKeyInfo = (*size == 0) ? NULL : taosArrayGet(pTableList->pTableList, 0);
return TSDB_CODE_SUCCESS;
} else if (total == tableListGetSize(pTableList)) {
*size = 1;
@@ -1757,7 +1774,7 @@ STableListInfo* tableListCreate() {
goto _error;
}
- pListInfo->map = taosHashInit(32, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), false, HASH_ENTRY_LOCK);
+ pListInfo->map = taosHashInit(32, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), false, HASH_ENTRY_LOCK);
if (pListInfo->map == NULL) {
goto _error;
}
@@ -1800,13 +1817,13 @@ void tableListClear(STableListInfo* pTableListInfo) {
}
static int32_t orderbyGroupIdComparFn(const void* p1, const void* p2) {
- STableKeyInfo* pInfo1 = (STableKeyInfo*) p1;
- STableKeyInfo* pInfo2 = (STableKeyInfo*) p2;
+ STableKeyInfo* pInfo1 = (STableKeyInfo*)p1;
+ STableKeyInfo* pInfo2 = (STableKeyInfo*)p2;
if (pInfo1->groupId == pInfo2->groupId) {
return 0;
} else {
- return pInfo1->groupId < pInfo2->groupId? -1:1;
+ return pInfo1->groupId < pInfo2->groupId ? -1 : 1;
}
}
@@ -1819,12 +1836,12 @@ static int32_t sortTableGroup(STableListInfo* pTableListInfo) {
SArray* pList = taosArrayInit(4, sizeof(int32_t));
STableKeyInfo* pInfo = taosArrayGet(pTableListInfo->pTableList, 0);
- uint64_t gid = pInfo->groupId;
+ uint64_t gid = pInfo->groupId;
int32_t start = 0;
taosArrayPush(pList, &start);
- for(int32_t i = 1; i < size; ++i) {
+ for (int32_t i = 1; i < size; ++i) {
pInfo = taosArrayGet(pTableListInfo->pTableList, i);
if (pInfo->groupId != gid) {
taosArrayPush(pList, &i);
@@ -1839,16 +1856,17 @@ static int32_t sortTableGroup(STableListInfo* pTableListInfo) {
return TDB_CODE_SUCCESS;
}
-int32_t buildGroupIdMapForAllTables(STableListInfo* pTableListInfo, SReadHandle* pHandle, SNodeList* group, bool groupSort) {
+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);
+ bool groupByTbname = groupbyTbname(group);
size_t numOfTables = taosArrayGetSize(pTableListInfo->pTableList);
if (group == NULL || groupByTbname) {
for (int32_t i = 0; i < numOfTables; i++) {
STableKeyInfo* info = taosArrayGet(pTableListInfo->pTableList, i);
- info->groupId = groupByTbname? info->uid:0;
+ info->groupId = groupByTbname ? info->uid : 0;
}
pTableListInfo->oneTableForEachGroup = groupByTbname;
@@ -1872,7 +1890,7 @@ int32_t buildGroupIdMapForAllTables(STableListInfo* pTableListInfo, SReadHandle*
// add all table entry in the hash map
size_t size = taosArrayGetSize(pTableListInfo->pTableList);
- for(int32_t i = 0; i < size; ++i) {
+ for (int32_t i = 0; i < size; ++i) {
STableKeyInfo* p = taosArrayGet(pTableListInfo->pTableList, i);
taosHashPut(pTableListInfo->map, &p->uid, sizeof(uint64_t), &i, sizeof(int32_t));
}
@@ -1882,8 +1900,9 @@ int32_t buildGroupIdMapForAllTables(STableListInfo* pTableListInfo, SReadHandle*
int32_t createScanTableListInfo(SScanPhysiNode* pScanNode, SNodeList* pGroupTags, bool groupSort, SReadHandle* pHandle,
STableListInfo* pTableListInfo, SNode* pTagCond, SNode* pTagIndexCond,
- const char* idStr) {
- int64_t st = taosGetTimestampUs();
+ struct SExecTaskInfo* pTaskInfo) {
+ int64_t st = taosGetTimestampUs();
+ const char* idStr = GET_TASKID(pTaskInfo);
if (pHandle == NULL) {
qError("invalid handle, in creating operator tree, %s", idStr);
@@ -1899,7 +1918,8 @@ int32_t createScanTableListInfo(SScanPhysiNode* pScanNode, SNodeList* pGroupTags
ASSERT(pTableListInfo->numOfOuputGroups == 1);
int64_t st1 = taosGetTimestampUs();
- qDebug("generate queried table list completed, elapsed time:%.2f ms %s", (st1 - st) / 1000.0, idStr);
+ pTaskInfo->cost.extractListTime = (st1 - st) / 1000.0;
+ qDebug("extract queried table list completed, elapsed time:%.2f ms %s", pTaskInfo->cost.extractListTime, idStr);
if (taosArrayGetSize(pTableListInfo->pTableList) == 0) {
qDebug("no table qualified for query, %s" PRIx64, idStr);
@@ -1911,8 +1931,8 @@ int32_t createScanTableListInfo(SScanPhysiNode* pScanNode, SNodeList* pGroupTags
return code;
}
- int64_t st2 = taosGetTimestampUs();
- qDebug("generate group id map completed, elapsed time:%.2f ms %s", (st2 - st1) / 1000.0, idStr);
+ pTaskInfo->cost.groupIdMapTime = (taosGetTimestampUs() - st1) / 1000.0;
+ qDebug("generate group id map completed, elapsed time:%.2f ms %s", pTaskInfo->cost.groupIdMapTime, idStr);
return TSDB_CODE_SUCCESS;
}
diff --git a/source/libs/executor/src/executor.c b/source/libs/executor/src/executor.c
index bbd62a9912..1cf01c8661 100644
--- a/source/libs/executor/src/executor.c
+++ b/source/libs/executor/src/executor.c
@@ -70,6 +70,26 @@ 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_QRY_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_QRY_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) {
@@ -117,7 +137,22 @@ static int32_t doSetStreamBlock(SOperatorInfo* pOperator, void* input, size_t nu
}
}
-static FORCE_INLINE void streamInputBlockDataDestory(void* pBlock) { blockDataDestroy((SSDataBlock*)pBlock); }
+int32_t qSetStreamOpOpen(qTaskInfo_t tinfo) {
+ if (tinfo == NULL) {
+ return TSDB_CODE_QRY_APP_ERROR;
+ }
+
+ SExecTaskInfo* pTaskInfo = (SExecTaskInfo*)tinfo;
+
+ int32_t code = doSetStreamOpOpen(pTaskInfo->pRoot, GET_TASKID(pTaskInfo));
+ if (code != TSDB_CODE_SUCCESS) {
+ qError("%s failed to set the stream block data", GET_TASKID(pTaskInfo));
+ } else {
+ qDebug("%s set the stream block successfully", GET_TASKID(pTaskInfo));
+ }
+
+ return code;
+}
int32_t qSetMultiStreamInput(qTaskInfo_t tinfo, const void* pBlocks, size_t numOfBlocks, int32_t type) {
if (tinfo == NULL) {
@@ -286,7 +321,7 @@ static SArray* filterUnqualifiedTables(const SStreamScanInfo* pScanInfo, const S
}
int32_t qUpdateQualifiedTableId(qTaskInfo_t tinfo, const SArray* tableIdList, bool isAdd) {
- SExecTaskInfo* pTaskInfo = (SExecTaskInfo*)tinfo;
+ SExecTaskInfo* pTaskInfo = (SExecTaskInfo*)tinfo;
if (isAdd) {
qDebug("add %d tables id into query list, %s", (int32_t)taosArrayGetSize(tableIdList), pTaskInfo->id.str);
@@ -438,7 +473,7 @@ int32_t qCreateExecTask(SReadHandle* readHandle, int32_t vgId, uint64_t taskId,
qDebug("subplan task create completed, TID:0x%" PRIx64 " QID:0x%" PRIx64, taskId, pSubplan->id.queryId);
- _error:
+_error:
// if failed to add ref for all tables in this query, abort current query
return code;
}
@@ -706,8 +741,7 @@ int32_t qStreamInput(qTaskInfo_t tinfo, void* pItem) {
int32_t qStreamSourceRecoverStep1(qTaskInfo_t tinfo, int64_t ver) {
SExecTaskInfo* pTaskInfo = (SExecTaskInfo*)tinfo;
ASSERT(pTaskInfo->execModel == OPTR_EXEC_MODEL_STREAM);
- pTaskInfo->streamInfo.recoverStartVer = 0;
- pTaskInfo->streamInfo.recoverEndVer = ver;
+ pTaskInfo->streamInfo.fillHistoryVer1 = ver;
pTaskInfo->streamInfo.recoverStep = STREAM_RECOVER_STEP__PREPARE1;
return 0;
}
@@ -715,8 +749,7 @@ int32_t qStreamSourceRecoverStep1(qTaskInfo_t tinfo, int64_t ver) {
int32_t qStreamSourceRecoverStep2(qTaskInfo_t tinfo, int64_t ver) {
SExecTaskInfo* pTaskInfo = (SExecTaskInfo*)tinfo;
ASSERT(pTaskInfo->execModel == OPTR_EXEC_MODEL_STREAM);
- pTaskInfo->streamInfo.recoverStartVer = pTaskInfo->streamInfo.recoverEndVer;
- pTaskInfo->streamInfo.recoverEndVer = ver;
+ pTaskInfo->streamInfo.fillHistoryVer2 = ver;
pTaskInfo->streamInfo.recoverStep = STREAM_RECOVER_STEP__PREPARE2;
return 0;
}
@@ -737,22 +770,44 @@ int32_t qStreamSetParamForRecover(qTaskInfo_t tinfo) {
pOperator->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_SEMI_INTERVAL ||
pOperator->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_FINAL_INTERVAL) {
SStreamIntervalOperatorInfo* pInfo = pOperator->info;
- pTaskInfo->streamInfo.triggerSaved = pInfo->twAggSup.calTrigger;
- pTaskInfo->streamInfo.deleteMarkSaved = pInfo->twAggSup.deleteMark;
+ ASSERT(pInfo->twAggSup.calTrigger == STREAM_TRIGGER_AT_ONCE ||
+ pInfo->twAggSup.calTrigger == STREAM_TRIGGER_WINDOW_CLOSE);
+ ASSERT(pInfo->twAggSup.calTriggerSaved == 0);
+ ASSERT(pInfo->twAggSup.deleteMarkSaved == 0);
+
+ qInfo("save stream param for interval: %d, %" PRId64, pInfo->twAggSup.calTrigger, pInfo->twAggSup.deleteMark);
+
+ pInfo->twAggSup.calTriggerSaved = pInfo->twAggSup.calTrigger;
+ pInfo->twAggSup.deleteMarkSaved = pInfo->twAggSup.deleteMark;
pInfo->twAggSup.calTrigger = STREAM_TRIGGER_AT_ONCE;
pInfo->twAggSup.deleteMark = INT64_MAX;
+
} else if (pOperator->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_SESSION ||
pOperator->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_SEMI_SESSION ||
pOperator->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_FINAL_SESSION) {
SStreamSessionAggOperatorInfo* pInfo = pOperator->info;
- pTaskInfo->streamInfo.triggerSaved = pInfo->twAggSup.calTrigger;
- pTaskInfo->streamInfo.deleteMarkSaved = pInfo->twAggSup.deleteMark;
+ ASSERT(pInfo->twAggSup.calTrigger == STREAM_TRIGGER_AT_ONCE ||
+ pInfo->twAggSup.calTrigger == STREAM_TRIGGER_WINDOW_CLOSE);
+ ASSERT(pInfo->twAggSup.calTriggerSaved == 0);
+ ASSERT(pInfo->twAggSup.deleteMarkSaved == 0);
+
+ qInfo("save stream param for session: %d, %" PRId64, pInfo->twAggSup.calTrigger, pInfo->twAggSup.deleteMark);
+
+ pInfo->twAggSup.calTriggerSaved = pInfo->twAggSup.calTrigger;
+ pInfo->twAggSup.deleteMarkSaved = pInfo->twAggSup.deleteMark;
pInfo->twAggSup.calTrigger = STREAM_TRIGGER_AT_ONCE;
pInfo->twAggSup.deleteMark = INT64_MAX;
} else if (pOperator->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_STATE) {
SStreamStateAggOperatorInfo* pInfo = pOperator->info;
- pTaskInfo->streamInfo.triggerSaved = pInfo->twAggSup.calTrigger;
- pTaskInfo->streamInfo.deleteMarkSaved = pInfo->twAggSup.deleteMark;
+ ASSERT(pInfo->twAggSup.calTrigger == STREAM_TRIGGER_AT_ONCE ||
+ pInfo->twAggSup.calTrigger == STREAM_TRIGGER_WINDOW_CLOSE);
+ ASSERT(pInfo->twAggSup.calTriggerSaved == 0);
+ ASSERT(pInfo->twAggSup.deleteMarkSaved == 0);
+
+ qInfo("save stream param for state: %d, %" PRId64, pInfo->twAggSup.calTrigger, pInfo->twAggSup.deleteMark);
+
+ pInfo->twAggSup.calTriggerSaved = pInfo->twAggSup.calTrigger;
+ pInfo->twAggSup.deleteMarkSaved = pInfo->twAggSup.deleteMark;
pInfo->twAggSup.calTrigger = STREAM_TRIGGER_AT_ONCE;
pInfo->twAggSup.deleteMark = INT64_MAX;
}
@@ -782,21 +837,36 @@ int32_t qStreamRestoreParam(qTaskInfo_t tinfo) {
pOperator->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_SEMI_INTERVAL ||
pOperator->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_FINAL_INTERVAL) {
SStreamIntervalOperatorInfo* pInfo = pOperator->info;
+ ASSERT(pInfo->twAggSup.calTrigger == STREAM_TRIGGER_AT_ONCE);
+ ASSERT(pInfo->twAggSup.deleteMark == INT64_MAX);
- pInfo->twAggSup.calTrigger = pTaskInfo->streamInfo.triggerSaved;
- pInfo->twAggSup.deleteMark = pTaskInfo->streamInfo.deleteMarkSaved;
+ pInfo->twAggSup.calTrigger = pInfo->twAggSup.calTriggerSaved;
+ pInfo->twAggSup.deleteMark = pInfo->twAggSup.deleteMarkSaved;
+ ASSERT(pInfo->twAggSup.calTrigger == STREAM_TRIGGER_AT_ONCE ||
+ pInfo->twAggSup.calTrigger == STREAM_TRIGGER_WINDOW_CLOSE);
+ qInfo("restore stream param for interval: %d, %" PRId64, pInfo->twAggSup.calTrigger, pInfo->twAggSup.deleteMark);
} else if (pOperator->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_SESSION ||
pOperator->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_SEMI_SESSION ||
pOperator->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_FINAL_SESSION) {
SStreamSessionAggOperatorInfo* pInfo = pOperator->info;
+ ASSERT(pInfo->twAggSup.calTrigger == STREAM_TRIGGER_AT_ONCE);
+ ASSERT(pInfo->twAggSup.deleteMark == INT64_MAX);
- pInfo->twAggSup.calTrigger = pTaskInfo->streamInfo.triggerSaved;
- pInfo->twAggSup.deleteMark = pTaskInfo->streamInfo.deleteMarkSaved;
+ pInfo->twAggSup.calTrigger = pInfo->twAggSup.calTriggerSaved;
+ pInfo->twAggSup.deleteMark = pInfo->twAggSup.deleteMarkSaved;
+ ASSERT(pInfo->twAggSup.calTrigger == STREAM_TRIGGER_AT_ONCE ||
+ pInfo->twAggSup.calTrigger == STREAM_TRIGGER_WINDOW_CLOSE);
+ qInfo("restore stream param for session: %d, %" PRId64, pInfo->twAggSup.calTrigger, pInfo->twAggSup.deleteMark);
} else if (pOperator->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_STATE) {
SStreamStateAggOperatorInfo* pInfo = pOperator->info;
+ ASSERT(pInfo->twAggSup.calTrigger == STREAM_TRIGGER_AT_ONCE);
+ ASSERT(pInfo->twAggSup.deleteMark == INT64_MAX);
- pInfo->twAggSup.calTrigger = pTaskInfo->streamInfo.triggerSaved;
- pInfo->twAggSup.deleteMark = pTaskInfo->streamInfo.deleteMarkSaved;
+ pInfo->twAggSup.calTrigger = pInfo->twAggSup.calTriggerSaved;
+ pInfo->twAggSup.deleteMark = pInfo->twAggSup.deleteMarkSaved;
+ ASSERT(pInfo->twAggSup.calTrigger == STREAM_TRIGGER_AT_ONCE ||
+ pInfo->twAggSup.calTrigger == STREAM_TRIGGER_WINDOW_CLOSE);
+ qInfo("restore stream param for state: %d, %" PRId64, pInfo->twAggSup.calTrigger, pInfo->twAggSup.deleteMark);
}
// iterate operator tree
@@ -957,10 +1027,11 @@ int32_t qStreamPrepareScan(qTaskInfo_t tinfo, STqOffsetVal* pOffset, int8_t subT
if (pTableScanInfo->dataReader == NULL) {
STableKeyInfo* pList = tableListGetInfo(pTaskInfo->pTableInfoList, 0);
- int32_t num = tableListGetSize(pTaskInfo->pTableInfoList);
+ int32_t num = tableListGetSize(pTaskInfo->pTableInfoList);
if (tsdbReaderOpen(pTableScanInfo->readHandle.vnode, &pTableScanInfo->cond, pList, num,
- &pTableScanInfo->dataReader, NULL) < 0 || pTableScanInfo->dataReader == NULL) {
+ &pTableScanInfo->dataReader, NULL) < 0 ||
+ pTableScanInfo->dataReader == NULL) {
ASSERT(0);
}
}
@@ -1001,14 +1072,14 @@ int32_t qStreamPrepareScan(qTaskInfo_t tinfo, STqOffsetVal* pOffset, int8_t subT
initQueryTableDataCondForTmq(&pTaskInfo->streamInfo.tableCond, sContext, &mtInfo);
pTaskInfo->streamInfo.tableCond.twindows.skey = pOffset->ts;
- if (pTaskInfo->pTableInfoList == NULL) {
+ if (pTaskInfo->pTableInfoList == NULL) {
pTaskInfo->pTableInfoList = tableListCreate();
}
tableListAddTableInfo(pTaskInfo->pTableInfoList, mtInfo.uid, 0);
STableKeyInfo* pList = tableListGetInfo(pTaskInfo->pTableInfoList, 0);
- int32_t size = tableListGetSize(pTaskInfo->pTableInfoList);
+ int32_t size = tableListGetSize(pTaskInfo->pTableInfoList);
ASSERT(size == 1);
tsdbReaderOpen(pInfo->vnode, &pTaskInfo->streamInfo.tableCond, pList, size, &pInfo->dataReader, NULL);
diff --git a/source/libs/executor/src/executorimpl.c b/source/libs/executor/src/executorimpl.c
index 0c0d5549f2..13a3712f0c 100644
--- a/source/libs/executor/src/executorimpl.c
+++ b/source/libs/executor/src/executorimpl.c
@@ -574,6 +574,9 @@ int32_t projectApplyFunctions(SExprInfo* pExpr, SSDataBlock* pResult, SSDataBloc
// if the source equals to the destination, it is to create a new column as the result of scalar
// function or some operators.
bool createNewColModel = (pResult == pSrcBlock);
+ if (createNewColModel) {
+ blockDataEnsureCapacity(pResult, pResult->info.rows);
+ }
int32_t numOfRows = 0;
@@ -623,6 +626,7 @@ int32_t projectApplyFunctions(SExprInfo* pExpr, SSDataBlock* pResult, SSDataBloc
int32_t startOffset = createNewColModel ? 0 : pResult->info.rows;
ASSERT(pResult->info.capacity > 0);
+
colDataMergeCol(pResColData, startOffset, (int32_t*)&pResult->info.capacity, &idata, dest.numOfRows);
colDataDestroy(&idata);
@@ -844,57 +848,6 @@ STimeWindow getAlignQueryTimeWindow(SInterval* pInterval, int32_t precision, int
return win;
}
-#if 0
-static bool overlapWithTimeWindow(STaskAttr* pQueryAttr, SDataBlockInfo* pBlockInfo) {
- STimeWindow w = {0};
-
- TSKEY sk = TMIN(pQueryAttr->window.skey, pQueryAttr->window.ekey);
- TSKEY ek = TMAX(pQueryAttr->window.skey, pQueryAttr->window.ekey);
-
- if (true) {
- // getAlignQueryTimeWindow(pQueryAttr, pBlockInfo->window.skey, sk, ek, &w);
- assert(w.ekey >= pBlockInfo->window.skey);
-
- if (w.ekey < pBlockInfo->window.ekey) {
- return true;
- }
-
- while (1) {
- // getNextTimeWindow(pQueryAttr, &w);
- if (w.skey > pBlockInfo->window.ekey) {
- break;
- }
-
- assert(w.ekey > pBlockInfo->window.ekey);
- if (w.skey <= pBlockInfo->window.ekey && w.skey > pBlockInfo->window.skey) {
- return true;
- }
- }
- } else {
- // getAlignQueryTimeWindow(pQueryAttr, pBlockInfo->window.ekey, sk, ek, &w);
- assert(w.skey <= pBlockInfo->window.ekey);
-
- if (w.skey > pBlockInfo->window.skey) {
- return true;
- }
-
- while (1) {
- // getNextTimeWindow(pQueryAttr, &w);
- if (w.ekey < pBlockInfo->window.skey) {
- break;
- }
-
- assert(w.skey < pBlockInfo->window.skey);
- if (w.ekey < pBlockInfo->window.ekey && w.ekey >= pBlockInfo->window.skey) {
- return true;
- }
- }
- }
-
- return false;
-}
-#endif
-
int32_t loadDataBlockOnDemand(SExecTaskInfo* pTaskInfo, STableScanInfo* pTableScanInfo, SSDataBlock* pBlock,
uint32_t* status) {
*status = BLK_DATA_NOT_LOAD;
@@ -1447,40 +1400,18 @@ void doBuildResultDatablock(SOperatorInfo* pOperator, SOptrBasicInfo* pbInfo, SG
}
}
-static int32_t compressQueryColData(SColumnInfoData* pColRes, int32_t numOfRows, char* data, int8_t compressed) {
- int32_t colSize = pColRes->info.bytes * numOfRows;
- return (*(tDataTypes[pColRes->info.type].compFunc))(pColRes->pData, colSize, numOfRows, data,
- colSize + COMP_OVERFLOW_BYTES, compressed, NULL, 0);
-}
-
void queryCostStatis(SExecTaskInfo* pTaskInfo) {
STaskCostInfo* pSummary = &pTaskInfo->cost;
- // uint64_t hashSize = taosHashGetMemSize(pQInfo->runtimeEnv.pResultRowHashTable);
- // hashSize += taosHashGetMemSize(pRuntimeEnv->tableqinfoGroupInfo.map);
- // pSummary->hashSize = hashSize;
-
- // SResultRowPool* p = pTaskInfo->pool;
- // if (p != NULL) {
- // pSummary->winInfoSize = getResultRowPoolMemSize(p);
- // pSummary->numOfTimeWindows = getNumOfAllocatedResultRows(p);
- // } else {
- // pSummary->winInfoSize = 0;
- // pSummary->numOfTimeWindows = 0;
- // }
-
SFileBlockLoadRecorder* pRecorder = pSummary->pRecoder;
if (pSummary->pRecoder != NULL) {
qDebug(
- "%s :cost summary: elapsed time:%.2f ms, total blocks:%d, load block SMA:%d, load data block:%d, total "
- "rows:%" PRId64 ", check rows:%" PRId64,
- GET_TASKID(pTaskInfo), pSummary->elapsedTime / 1000.0, pRecorder->totalBlocks, pRecorder->loadBlockStatis,
- pRecorder->loadBlocks, pRecorder->totalRows, pRecorder->totalCheckedRows);
+ "%s :cost summary: elapsed time:%.2f ms, extract tableList:%.2f ms, createGroupIdMap:%.2f ms, total blocks:%d, "
+ "load block SMA:%d, load data block:%d, total rows:%" PRId64 ", check rows:%" PRId64,
+ GET_TASKID(pTaskInfo), pSummary->elapsedTime / 1000.0, pSummary->extractListTime, pSummary->groupIdMapTime,
+ pRecorder->totalBlocks, pRecorder->loadBlockStatis, pRecorder->loadBlocks, pRecorder->totalRows,
+ pRecorder->totalCheckedRows);
}
-
- // qDebug("QInfo:0x%"PRIx64" :cost summary: winResPool size:%.2f Kb, numOfWin:%"PRId64", tableInfoSize:%.2f Kb,
- // hashTable:%.2f Kb", pQInfo->qId, pSummary->winInfoSize/1024.0,
- // pSummary->numOfTimeWindows, pSummary->tableInfoSize/1024.0, pSummary->hashSize/1024.0);
}
// static void updateOffsetVal(STaskRuntimeEnv *pRuntimeEnv, SDataBlockInfo *pBlockInfo) {
@@ -3267,6 +3198,11 @@ SOperatorInfo* createFillOperatorInfo(SOperatorInfo* downstream, SFillPhysiNode*
static SExecTaskInfo* createExecTaskInfo(uint64_t queryId, uint64_t taskId, EOPTR_EXEC_MODEL model, char* dbFName) {
SExecTaskInfo* pTaskInfo = taosMemoryCalloc(1, sizeof(SExecTaskInfo));
+ if (pTaskInfo == NULL) {
+ terrno = TSDB_CODE_OUT_OF_MEMORY;
+ return NULL;
+ }
+
setTaskStatus(pTaskInfo, TASK_NOT_COMPLETED);
pTaskInfo->schemaInfo.dbname = strdup(dbFName);
@@ -3397,7 +3333,7 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo
int32_t code =
createScanTableListInfo(&pTableScanNode->scan, pTableScanNode->pGroupTags, pTableScanNode->groupSort, pHandle,
- pTableListInfo, pTagCond, pTagIndexCond, idstr);
+ pTableListInfo, pTagCond, pTagIndexCond, pTaskInfo);
if (code) {
pTaskInfo->code = code;
qError("failed to createScanTableListInfo, code:%s, %s", tstrerror(code), idstr);
@@ -3415,9 +3351,9 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo
pTaskInfo->cost.pRecoder = &pScanInfo->readRecorder;
} else if (QUERY_NODE_PHYSICAL_PLAN_TABLE_MERGE_SCAN == type) {
STableMergeScanPhysiNode* pTableScanNode = (STableMergeScanPhysiNode*)pPhyNode;
- int32_t code =
- createScanTableListInfo(&pTableScanNode->scan, pTableScanNode->pGroupTags, /*pTableScanNode->groupSort*/true, pHandle,
- pTableListInfo, pTagCond, pTagIndexCond, idstr);
+
+ int32_t code = createScanTableListInfo(&pTableScanNode->scan, pTableScanNode->pGroupTags, true, pHandle,
+ pTableListInfo, pTagCond, pTagIndexCond, pTaskInfo);
if (code) {
pTaskInfo->code = code;
qError("failed to createScanTableListInfo, code: %s", tstrerror(code));
@@ -3442,7 +3378,7 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo
if (pHandle->vnode) {
int32_t code =
createScanTableListInfo(&pTableScanNode->scan, pTableScanNode->pGroupTags, pTableScanNode->groupSort,
- pHandle, pTableListInfo, pTagCond, pTagIndexCond, idstr);
+ pHandle, pTableListInfo, pTagCond, pTagIndexCond, pTaskInfo);
if (code) {
pTaskInfo->code = code;
qError("failed to createScanTableListInfo, code: %s", tstrerror(code));
@@ -3469,7 +3405,7 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo
STagScanPhysiNode* pScanPhyNode = (STagScanPhysiNode*)pPhyNode;
int32_t code = createScanTableListInfo(pScanPhyNode, NULL, false, pHandle, pTableListInfo, pTagCond,
- pTagIndexCond, idstr);
+ pTagIndexCond, pTaskInfo);
if (code != TSDB_CODE_SUCCESS) {
pTaskInfo->code = code;
qError("failed to getTableList, code: %s", tstrerror(code));
@@ -3502,7 +3438,7 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo
SLastRowScanPhysiNode* pScanNode = (SLastRowScanPhysiNode*)pPhyNode;
int32_t code = createScanTableListInfo(&pScanNode->scan, pScanNode->pGroupTags, true, pHandle, pTableListInfo,
- pTagCond, pTagIndexCond, idstr);
+ pTagCond, pTagIndexCond, pTaskInfo);
if (code != TSDB_CODE_SUCCESS) {
pTaskInfo->code = code;
return NULL;
@@ -3834,10 +3770,8 @@ int32_t createExecTaskInfoImpl(SSubplan* pPlan, SExecTaskInfo** pTaskInfo, SRead
char* sql, EOPTR_EXEC_MODEL model) {
uint64_t queryId = pPlan->id.queryId;
- int32_t code = TSDB_CODE_SUCCESS;
*pTaskInfo = createExecTaskInfo(queryId, taskId, model, pPlan->dbFName);
if (*pTaskInfo == NULL) {
- code = TSDB_CODE_QRY_OUT_OF_MEMORY;
goto _complete;
}
@@ -3856,17 +3790,16 @@ int32_t createExecTaskInfoImpl(SSubplan* pPlan, SExecTaskInfo** pTaskInfo, SRead
createOperatorTree(pPlan->pNode, *pTaskInfo, pHandle, pPlan->pTagCond, pPlan->pTagIndexCond, pPlan->user);
if (NULL == (*pTaskInfo)->pRoot) {
- code = (*pTaskInfo)->code;
+ terrno = (*pTaskInfo)->code;
goto _complete;
}
- return code;
+ return TSDB_CODE_SUCCESS;
- _complete:
+_complete:
taosMemoryFree(sql);
doDestroyTask(*pTaskInfo);
- terrno = code;
- return code;
+ return terrno;
}
void doDestroyTask(SExecTaskInfo* pTaskInfo) {
diff --git a/source/libs/executor/src/groupoperator.c b/source/libs/executor/src/groupoperator.c
index 644f02f60d..e07a3475e0 100644
--- a/source/libs/executor/src/groupoperator.c
+++ b/source/libs/executor/src/groupoperator.c
@@ -62,7 +62,7 @@ static int32_t initGroupOptrInfo(SArray** pGroupColVals, int32_t* keyLen, char**
int32_t numOfGroupCols = taosArrayGetSize(pGroupColList);
for (int32_t i = 0; i < numOfGroupCols; ++i) {
- SColumn* pCol = (SColumn*) taosArrayGet(pGroupColList, i);
+ SColumn* pCol = (SColumn*)taosArrayGet(pGroupColList, i);
(*keyLen) += pCol->bytes; // actual data + null_flag
SGroupKeys key = {0};
@@ -397,7 +397,7 @@ static SSDataBlock* hashGroupbyAggregate(SOperatorInfo* pOperator) {
return buildGroupResultDataBlock(pOperator);
}
-SOperatorInfo* createGroupOperatorInfo(SOperatorInfo* downstream, SAggPhysiNode *pAggNode, SExecTaskInfo* pTaskInfo) {
+SOperatorInfo* createGroupOperatorInfo(SOperatorInfo* downstream, SAggPhysiNode* pAggNode, SExecTaskInfo* pTaskInfo) {
SGroupbyOperatorInfo* pInfo = taosMemoryCalloc(1, sizeof(SGroupbyOperatorInfo));
SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo));
if (pInfo == NULL || pOperator == NULL) {
@@ -442,8 +442,8 @@ SOperatorInfo* createGroupOperatorInfo(SOperatorInfo* downstream, SAggPhysiNode
pOperator->info = pInfo;
pOperator->pTaskInfo = pTaskInfo;
- pOperator->fpSet = createOperatorFpSet(operatorDummyOpenFn, hashGroupbyAggregate, NULL, NULL,
- destroyGroupOperatorInfo, NULL);
+ pOperator->fpSet =
+ createOperatorFpSet(operatorDummyOpenFn, hashGroupbyAggregate, NULL, NULL, destroyGroupOperatorInfo, NULL);
code = appendDownstream(pOperator, &downstream, 1);
if (code != TSDB_CODE_SUCCESS) {
goto _error;
@@ -621,9 +621,10 @@ int32_t* setupColumnOffset(const SSDataBlock* pBlock, int32_t rowCapacity) {
}
static void clearPartitionOperator(SPartitionOperatorInfo* pInfo) {
- void* ite = NULL;
- while ((ite = taosHashIterate(pInfo->pGroupSet, ite)) != NULL) {
- taosArrayDestroy(((SDataGroupInfo*)ite)->pPageList);
+ int32_t size = taosArrayGetSize(pInfo->sortedGroupArray);
+ for (int32_t i = 0; i < size; i++) {
+ SDataGroupInfo* pGp = taosArrayGet(pInfo->sortedGroupArray, i);
+ taosArrayDestroy(pGp->pPageList);
}
taosArrayClear(pInfo->sortedGroupArray);
clearDiskbasedBuf(pInfo->pBuf);
@@ -749,6 +750,14 @@ static void destroyPartitionOperatorInfo(void* param) {
taosArrayDestroy(pInfo->pGroupColVals);
taosMemoryFree(pInfo->keyBuf);
taosArrayDestroy(pInfo->sortedGroupArray);
+
+ void* pGroupIter = taosHashIterate(pInfo->pGroupSet, NULL);
+ while (pGroupIter != NULL) {
+ SDataGroupInfo* pGroupInfo = pGroupIter;
+ taosArrayDestroy(pGroupInfo->pPageList);
+ pGroupIter = taosHashIterate(pInfo->pGroupSet, pGroupIter);
+ }
+
taosHashCleanup(pInfo->pGroupSet);
taosMemoryFree(pInfo->columnOffset);
@@ -765,7 +774,6 @@ SOperatorInfo* createPartitionOperatorInfo(SOperatorInfo* downstream, SPartition
goto _error;
}
-
int32_t numOfCols = 0;
SExprInfo* pExprInfo = createExprInfo(pPartNode->pTargets, NULL, &numOfCols);
pInfo->pGroupCols = extractPartitionColInfo(pPartNode->pPartitionKeys);
@@ -819,8 +827,8 @@ SOperatorInfo* createPartitionOperatorInfo(SOperatorInfo* downstream, SPartition
pOperator->info = pInfo;
pOperator->pTaskInfo = pTaskInfo;
- pOperator->fpSet = createOperatorFpSet(operatorDummyOpenFn, hashPartition, NULL, NULL, destroyPartitionOperatorInfo,
- NULL);
+ pOperator->fpSet =
+ createOperatorFpSet(operatorDummyOpenFn, hashPartition, NULL, NULL, destroyPartitionOperatorInfo, NULL);
code = appendDownstream(pOperator, &downstream, 1);
return pOperator;
@@ -965,6 +973,7 @@ static SSDataBlock* doStreamHashPartition(SOperatorInfo* pOperator) {
case STREAM_DELETE_DATA: {
copyDataBlock(pInfo->pDelRes, pBlock);
pInfo->pDelRes->info.type = STREAM_DELETE_RESULT;
+ printDataBlock(pInfo->pDelRes, "stream partitionby delete");
return pInfo->pDelRes;
} break;
default:
@@ -1014,6 +1023,9 @@ void initParDownStream(SOperatorInfo* downstream, SPartitionBySupporter* pParSup
SStreamScanInfo* pScanInfo = downstream->info;
pScanInfo->partitionSup = *pParSup;
pScanInfo->pPartScalarSup = pExpr;
+ if (!pScanInfo->pUpdateInfo) {
+ pScanInfo->pUpdateInfo = updateInfoInit(60000, TSDB_TIME_PRECISION_MILLI, 0);
+ }
}
SOperatorInfo* createStreamPartitionOperatorInfo(SOperatorInfo* downstream, SStreamPartitionPhysiNode* pPartNode,
@@ -1108,7 +1120,6 @@ _error:
return NULL;
}
-
SArray* extractColumnInfo(SNodeList* pNodeList) {
size_t numOfCols = LIST_LENGTH(pNodeList);
SArray* pList = taosArrayInit(numOfCols, sizeof(SColumn));
diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c
index b9324d0c64..3352b2685a 100644
--- a/source/libs/executor/src/scanoperator.c
+++ b/source/libs/executor/src/scanoperator.c
@@ -331,7 +331,8 @@ static bool doLoadBlockSMA(STableScanInfo* pTableScanInfo, SSDataBlock* pBlock,
}
}
- for (int32_t i = 0; i < taosArrayGetSize(pTableScanInfo->matchInfo.pList); ++i) {
+ size_t num = taosArrayGetSize(pTableScanInfo->matchInfo.pList);
+ for (int32_t i = 0; i < num; ++i) {
SColMatchItem* pColMatchInfo = taosArrayGet(pTableScanInfo->matchInfo.pList, i);
if (!pColMatchInfo->needOutput) {
continue;
@@ -343,11 +344,12 @@ static bool doLoadBlockSMA(STableScanInfo* pTableScanInfo, SSDataBlock* pBlock,
return true;
}
-static void doSetTagColumnData(STableScanInfo* pTableScanInfo, SSDataBlock* pBlock, SExecTaskInfo* pTaskInfo) {
+static void doSetTagColumnData(STableScanInfo* pTableScanInfo, SSDataBlock* pBlock, SExecTaskInfo* pTaskInfo,
+ int32_t rows) {
if (pTableScanInfo->pseudoSup.numOfExprs > 0) {
SExprSupp* pSup = &pTableScanInfo->pseudoSup;
- int32_t code = addTagPseudoColumnData(&pTableScanInfo->readHandle, pSup->pExprInfo, pSup->numOfExprs, pBlock,
+ int32_t code = addTagPseudoColumnData(&pTableScanInfo->readHandle, pSup->pExprInfo, pSup->numOfExprs, pBlock, rows,
GET_TASKID(pTaskInfo));
if (code != TSDB_CODE_SUCCESS) {
T_LONG_JMP(pTaskInfo->env, code);
@@ -363,7 +365,8 @@ void applyLimitOffset(SLimitInfo* pLimitInfo, SSDataBlock* pBlock, SExecTaskInfo
if (pLimitInfo->remainOffset >= pBlock->info.rows) {
pLimitInfo->remainOffset -= pBlock->info.rows;
pBlock->info.rows = 0;
- qDebug("current block ignore due to offset, current:%"PRId64", %s", pLimitInfo->remainOffset, GET_TASKID(pTaskInfo));
+ qDebug("current block ignore due to offset, current:%" PRId64 ", %s", pLimitInfo->remainOffset,
+ GET_TASKID(pTaskInfo));
} else {
blockDataTrimFirstNRows(pBlock, pLimitInfo->remainOffset);
pLimitInfo->remainOffset = 0;
@@ -376,11 +379,22 @@ void applyLimitOffset(SLimitInfo* pLimitInfo, SSDataBlock* pBlock, SExecTaskInfo
int32_t keep = pBlock->info.rows - overflowRows;
blockDataKeepFirstNRows(pBlock, keep);
- qDebug("output limit %"PRId64" has reached, %s", pLimit->limit, GET_TASKID(pTaskInfo));
+ qDebug("output limit %" PRId64 " has reached, %s", pLimit->limit, GET_TASKID(pTaskInfo));
pOperator->status = OP_EXEC_DONE;
}
}
+static void ensureBlockCapacity(SSDataBlock* pBlock, int32_t capacity) {
+ // keep the value of rows temporarily
+ int32_t rows = pBlock->info.rows;
+
+ pBlock->info.rows = 0;
+ blockDataEnsureCapacity(pBlock, capacity);
+
+ // restore the rows number
+ pBlock->info.rows = rows;
+}
+
static int32_t loadDataBlock(SOperatorInfo* pOperator, STableScanInfo* pTableScanInfo, SSDataBlock* pBlock,
uint32_t* status) {
SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo;
@@ -412,7 +426,10 @@ static int32_t loadDataBlock(SOperatorInfo* pOperator, STableScanInfo* pTableSca
qDebug("%s data block skipped, brange:%" PRId64 "-%" PRId64 ", rows:%d", GET_TASKID(pTaskInfo),
pBlockInfo->window.skey, pBlockInfo->window.ekey, pBlockInfo->rows);
- doSetTagColumnData(pTableScanInfo, pBlock, pTaskInfo);
+ if (pTableScanInfo->pseudoSup.numOfExprs > 0) {
+ ensureBlockCapacity(pBlock, pBlock->info.rows);
+ }
+ doSetTagColumnData(pTableScanInfo, pBlock, pTaskInfo, 1);
pCost->skipBlocks += 1;
return TSDB_CODE_SUCCESS;
} else if (*status == FUNC_DATA_REQUIRED_STATIS_LOAD) {
@@ -422,7 +439,11 @@ static int32_t loadDataBlock(SOperatorInfo* pOperator, STableScanInfo* pTableSca
if (success) { // failed to load the block sma data, data block statistics does not exist, load data block instead
qDebug("%s data block SMA loaded, brange:%" PRId64 "-%" PRId64 ", rows:%d", GET_TASKID(pTaskInfo),
pBlockInfo->window.skey, pBlockInfo->window.ekey, pBlockInfo->rows);
- doSetTagColumnData(pTableScanInfo, pBlock, pTaskInfo);
+ if (pTableScanInfo->pseudoSup.numOfExprs > 0) {
+ ensureBlockCapacity(pBlock, pBlock->info.rows);
+ }
+
+ doSetTagColumnData(pTableScanInfo, pBlock, pTaskInfo, 1);
return TSDB_CODE_SUCCESS;
} else {
qDebug("%s failed to load SMA, since not all columns have SMA", GET_TASKID(pTaskInfo));
@@ -471,8 +492,9 @@ static int32_t loadDataBlock(SOperatorInfo* pOperator, STableScanInfo* pTableSca
return terrno;
}
+ ensureBlockCapacity(pBlock, pBlock->info.rows);
relocateColumnData(pBlock, pTableScanInfo->matchInfo.pList, pCols, true);
- doSetTagColumnData(pTableScanInfo, pBlock, pTaskInfo);
+ doSetTagColumnData(pTableScanInfo, pBlock, pTaskInfo, pBlock->info.rows);
// restore the previous value
pCost->totalRows -= pBlock->info.rows;
@@ -512,27 +534,30 @@ static void prepareForDescendingScan(STableScanInfo* pTableScanInfo, SqlFunction
}
int32_t addTagPseudoColumnData(SReadHandle* pHandle, SExprInfo* pPseudoExpr, int32_t numOfPseudoExpr,
- SSDataBlock* pBlock, const char* idStr) {
+ SSDataBlock* pBlock, int32_t rows, const char* idStr) {
// currently only the tbname pseudo column
if (numOfPseudoExpr == 0) {
return TSDB_CODE_SUCCESS;
}
+ // backup the rows
+ int32_t backupRows = pBlock->info.rows;
+ pBlock->info.rows = rows;
+
SMetaReader mr = {0};
metaReaderInit(&mr, pHandle->meta, 0);
int32_t code = metaGetTableEntryByUid(&mr, pBlock->info.uid);
+ metaReaderReleaseLock(&mr);
+
if (code != TSDB_CODE_SUCCESS) {
qError("failed to get table meta, uid:0x%" PRIx64 ", code:%s, %s", pBlock->info.uid, tstrerror(terrno), idStr);
metaReaderClear(&mr);
return terrno;
}
- metaReaderReleaseLock(&mr);
-
for (int32_t j = 0; j < numOfPseudoExpr; ++j) {
SExprInfo* pExpr = &pPseudoExpr[j];
-
- int32_t dstSlotId = pExpr->base.resSchema.slotId;
+ int32_t dstSlotId = pExpr->base.resSchema.slotId;
SColumnInfoData* pColInfoData = taosArrayGet(pBlock->pDataBlock, dstSlotId);
colInfoDataCleanup(pColInfoData, pBlock->info.rows);
@@ -571,6 +596,9 @@ int32_t addTagPseudoColumnData(SReadHandle* pHandle, SExprInfo* pPseudoExpr, int
}
metaReaderClear(&mr);
+
+ // restore the rows
+ pBlock->info.rows = backupRows;
return TSDB_CODE_SUCCESS;
}
@@ -615,14 +643,10 @@ static SSDataBlock* doTableScanImpl(SOperatorInfo* pOperator) {
blockDataCleanup(pBlock);
- SDataBlockInfo binfo = pBlock->info;
- tsdbRetrieveDataBlockInfo(pTableScanInfo->dataReader, &binfo);
+ SDataBlockInfo* pBInfo = &pBlock->info;
+ tsdbRetrieveDataBlockInfo(pTableScanInfo->dataReader, &pBInfo->rows, &pBInfo->uid, &pBInfo->window);
- binfo.capacity = binfo.rows;
- blockDataEnsureCapacity(pBlock, binfo.rows);
- pBlock->info = binfo;
-
- ASSERT(binfo.uid != 0);
+ ASSERT(pBInfo->uid != 0);
pBlock->info.groupId = getTableGroupId(pTaskInfo->pTableInfoList, pBlock->info.uid);
uint32_t status = 0;
@@ -748,13 +772,13 @@ static SSDataBlock* doTableScan(SOperatorInfo* pOperator) {
return NULL;
}
- int32_t num = 0;
+ int32_t num = 0;
STableKeyInfo* pList = NULL;
tableListGetGroupList(pTaskInfo->pTableInfoList, pInfo->currentGroupId, &pList, &num);
ASSERT(pInfo->dataReader == NULL);
- int32_t code = tsdbReaderOpen(pInfo->readHandle.vnode, &pInfo->cond, pList, num, (STsdbReader**)&pInfo->dataReader,
- GET_TASKID(pTaskInfo));
+ int32_t code = tsdbReaderOpen(pInfo->readHandle.vnode, &pInfo->cond, pList, num,
+ (STsdbReader**)&pInfo->dataReader, GET_TASKID(pTaskInfo));
if (code != TSDB_CODE_SUCCESS) {
T_LONG_JMP(pTaskInfo->env, code);
}
@@ -776,7 +800,7 @@ static SSDataBlock* doTableScan(SOperatorInfo* pOperator) {
pInfo->limitInfo.numOfOutputRows = 0;
pInfo->limitInfo.remainOffset = pInfo->limitInfo.limit.offset;
- int32_t num = 0;
+ int32_t num = 0;
STableKeyInfo* pList = NULL;
tableListGetGroupList(pTaskInfo->pTableInfoList, pInfo->currentGroupId, &pList, &num);
@@ -819,8 +843,8 @@ static void destroyTableScanOperatorInfo(void* param) {
taosMemoryFreeClear(param);
}
-SOperatorInfo* createTableScanOperatorInfo(STableScanPhysiNode* pTableScanNode, SReadHandle* readHandle,
- SExecTaskInfo* pTaskInfo) {
+SOperatorInfo* createTableScanOperatorInfo(STableScanPhysiNode* pTableScanNode, SReadHandle* readHandle,
+ SExecTaskInfo* pTaskInfo) {
STableScanInfo* pInfo = taosMemoryCalloc(1, sizeof(STableScanInfo));
SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo));
if (pInfo == NULL || pOperator == NULL) {
@@ -884,7 +908,7 @@ SOperatorInfo* createTableScanOperatorInfo(STableScanPhysiNode* pTableScanNode,
pOperator->cost.openCost = 0;
return pOperator;
- _error:
+_error:
if (pInfo != NULL) {
destroyTableScanOperatorInfo(pInfo);
}
@@ -1024,7 +1048,8 @@ static int32_t initTableblockDistQueryCond(uint64_t uid, SQueryTableDataCond* pC
return TSDB_CODE_SUCCESS;
}
-SOperatorInfo* createDataBlockInfoScanOperator(SReadHandle* readHandle, SBlockDistScanPhysiNode* pBlockScanNode, SExecTaskInfo* pTaskInfo) {
+SOperatorInfo* createDataBlockInfoScanOperator(SReadHandle* readHandle, SBlockDistScanPhysiNode* pBlockScanNode,
+ SExecTaskInfo* pTaskInfo) {
SBlockDistInfo* pInfo = taosMemoryCalloc(1, sizeof(SBlockDistInfo));
SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo));
if (pInfo == NULL || pOperator == NULL) {
@@ -1037,15 +1062,18 @@ SOperatorInfo* createDataBlockInfoScanOperator(SReadHandle* readHandle, SBlockDi
int32_t code = initTableblockDistQueryCond(pBlockScanNode->suid, &cond);
if (code != TSDB_CODE_SUCCESS) {
- return NULL;
+ goto _error;
}
STableListInfo* pTableListInfo = pTaskInfo->pTableInfoList;
- size_t num = tableListGetSize(pTableListInfo);
- void* pList = tableListGetInfo(pTableListInfo, 0);
+ size_t num = tableListGetSize(pTableListInfo);
+ void* pList = tableListGetInfo(pTableListInfo, 0);
- tsdbReaderOpen(readHandle->vnode, &cond, pList, num, &pInfo->pHandle, pTaskInfo->id.str);
+ code = tsdbReaderOpen(readHandle->vnode, &cond, pList, num, &pInfo->pHandle, pTaskInfo->id.str);
cleanupQueryTableDataCond(&cond);
+ if (code != 0) {
+ goto _error;
+ }
}
pInfo->readHandle = *readHandle;
@@ -1070,7 +1098,7 @@ SOperatorInfo* createDataBlockInfoScanOperator(SReadHandle* readHandle, SBlockDi
createOperatorFpSet(operatorDummyOpenFn, doBlockInfoScan, NULL, NULL, destroyBlockDistScanOperatorInfo, NULL);
return pOperator;
- _error:
+_error:
taosMemoryFreeClear(pInfo);
taosMemoryFreeClear(pOperator);
return NULL;
@@ -1135,34 +1163,35 @@ static SSDataBlock* readPreVersionData(SOperatorInfo* pTableScanOp, uint64_t tbU
blockDataCleanup(pBlock);
STsdbReader* pReader = NULL;
- int32_t code = tsdbReaderOpen(pTableScanInfo->readHandle.vnode, &cond, &tblInfo, 1, (STsdbReader**)&pReader,
- GET_TASKID(pTaskInfo));
+ int32_t code = tsdbReaderOpen(pTableScanInfo->readHandle.vnode, &cond, &tblInfo, 1, (STsdbReader**)&pReader,
+ GET_TASKID(pTaskInfo));
if (code != TSDB_CODE_SUCCESS) {
terrno = code;
+ T_LONG_JMP(pTaskInfo->env, code);
return NULL;
}
bool hasBlock = tsdbNextDataBlock(pReader);
if (hasBlock) {
- SDataBlockInfo binfo = {0};
- tsdbRetrieveDataBlockInfo(pReader, &binfo);
+ SDataBlockInfo* pBInfo = &pBlock->info;
+
+ int32_t rows = 0;
+ tsdbRetrieveDataBlockInfo(pReader, &rows, &pBInfo->uid, &pBInfo->window);
SArray* pCols = tsdbRetrieveDataBlock(pReader, NULL);
- blockDataEnsureCapacity(pBlock, binfo.rows);
-
- pBlock->info.window = binfo.window;
- pBlock->info.uid = binfo.uid;
- pBlock->info.rows = binfo.rows;
+ blockDataEnsureCapacity(pBlock, rows);
+ pBlock->info.rows = rows;
relocateColumnData(pBlock, pTableScanInfo->matchInfo.pList, pCols, true);
- doSetTagColumnData(pTableScanInfo, pBlock, pTaskInfo);
+ doSetTagColumnData(pTableScanInfo, pBlock, pTaskInfo, rows);
- pBlock->info.groupId = getTableGroupId(pTaskInfo->pTableInfoList, binfo.uid);
+ pBlock->info.groupId = getTableGroupId(pTaskInfo->pTableInfoList, pBInfo->uid);
}
tsdbReaderClose(pReader);
qDebug("retrieve prev rows:%d, skey:%" PRId64 ", ekey:%" PRId64 " uid:%" PRIu64 ", max ver:%" PRId64
- ", suid:%" PRIu64, pBlock->info.rows, startTs, endTs, tbUid, maxVersion, cond.suid);
+ ", suid:%" PRIu64,
+ pBlock->info.rows, startTs, endTs, tbUid, maxVersion, cond.suid);
return pBlock->info.rows > 0 ? pBlock : NULL;
}
@@ -1178,12 +1207,6 @@ static uint64_t getGroupIdByCol(SStreamScanInfo* pInfo, uint64_t uid, TSKEY ts,
static uint64_t getGroupIdByUid(SStreamScanInfo* pInfo, uint64_t uid) {
return getTableGroupId(pInfo->pTableScanOp->pTaskInfo->pTableInfoList, uid);
-// SHashObj* map = pInfo->pTableScanOp->pTaskInfo->pTableInfoList.map;
-// uint64_t* groupId = taosHashGet(map, &uid, sizeof(int64_t));
-// if (groupId) {
-// return *groupId;
-// }
-// return 0;
}
static uint64_t getGroupIdByData(SStreamScanInfo* pInfo, uint64_t uid, TSKEY ts, int64_t maxVersion) {
@@ -1380,7 +1403,7 @@ static int32_t generateIntervalScanRange(SStreamScanInfo* pInfo, SSDataBlock* pS
if (rows == 0) {
return TSDB_CODE_SUCCESS;
}
- int32_t code = blockDataEnsureCapacity(pDestBlock, rows * 2);
+ int32_t code = blockDataEnsureCapacity(pDestBlock, rows);
if (code != TSDB_CODE_SUCCESS) {
return code;
}
@@ -1423,39 +1446,33 @@ static int32_t generateIntervalScanRange(SStreamScanInfo* pInfo, SSDataBlock* pS
}
static int32_t generateDeleteResultBlock(SStreamScanInfo* pInfo, SSDataBlock* pSrcBlock, SSDataBlock* pDestBlock) {
- if (pSrcBlock->info.rows == 0) {
+ blockDataCleanup(pDestBlock);
+ int32_t rows = pSrcBlock->info.rows;
+ if (rows == 0) {
return TSDB_CODE_SUCCESS;
}
- blockDataCleanup(pDestBlock);
- int32_t code = blockDataEnsureCapacity(pDestBlock, pSrcBlock->info.rows);
+ int32_t code = blockDataEnsureCapacity(pDestBlock, rows);
if (code != TSDB_CODE_SUCCESS) {
return code;
}
- ASSERT(taosArrayGetSize(pSrcBlock->pDataBlock) >= 3);
- SColumnInfoData* pStartTsCol = taosArrayGet(pSrcBlock->pDataBlock, START_TS_COLUMN_INDEX);
- TSKEY* startData = (TSKEY*)pStartTsCol->pData;
- SColumnInfoData* pEndTsCol = taosArrayGet(pSrcBlock->pDataBlock, END_TS_COLUMN_INDEX);
- TSKEY* endData = (TSKEY*)pEndTsCol->pData;
- SColumnInfoData* pUidCol = taosArrayGet(pSrcBlock->pDataBlock, UID_COLUMN_INDEX);
- uint64_t* uidCol = (uint64_t*)pUidCol->pData;
- SColumnInfoData* pDestStartCol = taosArrayGet(pDestBlock->pDataBlock, START_TS_COLUMN_INDEX);
- SColumnInfoData* pDestEndCol = taosArrayGet(pDestBlock->pDataBlock, END_TS_COLUMN_INDEX);
- SColumnInfoData* pDestUidCol = taosArrayGet(pDestBlock->pDataBlock, UID_COLUMN_INDEX);
- SColumnInfoData* pDestGpCol = taosArrayGet(pDestBlock->pDataBlock, GROUPID_COLUMN_INDEX);
- SColumnInfoData* pDestCalStartTsCol = taosArrayGet(pDestBlock->pDataBlock, CALCULATE_START_TS_COLUMN_INDEX);
- SColumnInfoData* pDestCalEndTsCol = taosArrayGet(pDestBlock->pDataBlock, CALCULATE_END_TS_COLUMN_INDEX);
- int32_t dummy = 0;
- int64_t version = pSrcBlock->info.version - 1;
+ SColumnInfoData* pSrcStartTsCol = (SColumnInfoData*)taosArrayGet(pSrcBlock->pDataBlock, START_TS_COLUMN_INDEX);
+ SColumnInfoData* pSrcEndTsCol = (SColumnInfoData*)taosArrayGet(pSrcBlock->pDataBlock, END_TS_COLUMN_INDEX);
+ SColumnInfoData* pSrcUidCol = taosArrayGet(pSrcBlock->pDataBlock, UID_COLUMN_INDEX);
+ uint64_t* srcUidData = (uint64_t*)pSrcUidCol->pData;
+ SColumnInfoData* pSrcGpCol = taosArrayGet(pSrcBlock->pDataBlock, GROUPID_COLUMN_INDEX);
+ uint64_t* srcGp = (uint64_t*)pSrcGpCol->pData;
+ ASSERT(pSrcStartTsCol->info.type == TSDB_DATA_TYPE_TIMESTAMP);
+ TSKEY* srcStartTsCol = (TSKEY*)pSrcStartTsCol->pData;
+ TSKEY* srcEndTsCol = (TSKEY*)pSrcEndTsCol->pData;
+ int64_t version = pSrcBlock->info.version - 1;
for (int32_t i = 0; i < pSrcBlock->info.rows; i++) {
- uint64_t groupId = getGroupIdByData(pInfo, uidCol[i], startData[i], version);
- colDataAppend(pDestStartCol, i, (const char*)(startData + i), false);
- colDataAppend(pDestEndCol, i, (const char*)(endData + i), false);
- colDataAppendNULL(pDestUidCol, i);
- colDataAppend(pDestGpCol, i, (const char*)&groupId, false);
- colDataAppendNULL(pDestCalStartTsCol, i);
- colDataAppendNULL(pDestCalEndTsCol, i);
- pDestBlock->info.rows++;
+ uint64_t srcUid = srcUidData[i];
+ uint64_t groupId = srcGp[i];
+ if (groupId == 0) {
+ groupId = getGroupIdByData(pInfo, srcUid, srcStartTsCol[i], version);
+ }
+ appendOneRowToStreamSpecialBlock(pDestBlock, srcStartTsCol + i, srcEndTsCol + i, srcUidData + i, &groupId, NULL);
}
return TSDB_CODE_SUCCESS;
}
@@ -1466,6 +1483,8 @@ static int32_t generateScanRange(SStreamScanInfo* pInfo, SSDataBlock* pSrcBlock,
code = generateIntervalScanRange(pInfo, pSrcBlock, pDestBlock);
} else if (isSessionWindow(pInfo) || isStateWindow(pInfo)) {
code = generateSessionScanRange(pInfo, pSrcBlock, pDestBlock);
+ } else {
+ code = generateDeleteResultBlock(pInfo, pSrcBlock, pDestBlock);
}
pDestBlock->info.type = STREAM_CLEAR;
pDestBlock->info.version = pSrcBlock->info.version;
@@ -1632,7 +1651,7 @@ static int32_t setBlockIntoRes(SStreamScanInfo* pInfo, const SSDataBlock* pBlock
// currently only the tbname pseudo column
if (pInfo->numOfPseudoExpr > 0) {
int32_t code = addTagPseudoColumnData(&pInfo->readHandle, pInfo->pPseudoExpr, pInfo->numOfPseudoExpr, pInfo->pRes,
- GET_TASKID(pTaskInfo));
+ pInfo->pRes->info.rows, GET_TASKID(pTaskInfo));
if (code != TSDB_CODE_SUCCESS) {
blockDataFreeRes((SSDataBlock*)pBlock);
T_LONG_JMP(pTaskInfo->env, code);
@@ -1642,11 +1661,11 @@ static int32_t setBlockIntoRes(SStreamScanInfo* pInfo, const SSDataBlock* pBlock
if (filter) {
doFilter(pInfo->pCondition, pInfo->pRes, NULL, NULL);
}
+
blockDataUpdateTsWindow(pInfo->pRes, pInfo->primaryTsIndex);
blockDataFreeRes((SSDataBlock*)pBlock);
calBlockTbName(&pInfo->tbnameCalSup, pInfo->pRes);
-
return 0;
}
@@ -1864,18 +1883,26 @@ static SSDataBlock* doStreamScan(SOperatorInfo* pOperator) {
}
#endif
-#if 1
if (pTaskInfo->streamInfo.recoverStep == STREAM_RECOVER_STEP__PREPARE1 ||
pTaskInfo->streamInfo.recoverStep == STREAM_RECOVER_STEP__PREPARE2) {
STableScanInfo* pTSInfo = pInfo->pTableScanOp->info;
memcpy(&pTSInfo->cond, &pTaskInfo->streamInfo.tableCond, sizeof(SQueryTableDataCond));
if (pTaskInfo->streamInfo.recoverStep == STREAM_RECOVER_STEP__PREPARE1) {
- pTSInfo->cond.startVersion = -1;
+ pTSInfo->cond.startVersion = 0;
pTSInfo->cond.endVersion = pTaskInfo->streamInfo.fillHistoryVer1;
+ qDebug("stream recover step 1, from %" PRId64 " to %" PRId64, pTSInfo->cond.startVersion,
+ pTSInfo->cond.endVersion);
} else {
pTSInfo->cond.startVersion = pTaskInfo->streamInfo.fillHistoryVer1 + 1;
pTSInfo->cond.endVersion = pTaskInfo->streamInfo.fillHistoryVer2;
+ qDebug("stream recover step 2, from %" PRId64 " to %" PRId64, pTSInfo->cond.startVersion,
+ pTSInfo->cond.endVersion);
}
+
+ /*resetTableScanInfo(pTSInfo, pWin);*/
+ tsdbReaderClose(pTSInfo->dataReader);
+ pTSInfo->dataReader = NULL;
+
pTSInfo->scanTimes = 0;
pTSInfo->currentGroupId = -1;
pTaskInfo->streamInfo.recoverStep = STREAM_RECOVER_STEP__SCAN;
@@ -1886,16 +1913,23 @@ static SSDataBlock* doStreamScan(SOperatorInfo* pOperator) {
if (pBlock != NULL) {
calBlockTbName(&pInfo->tbnameCalSup, pBlock);
updateInfoFillBlockData(pInfo->pUpdateInfo, pBlock, pInfo->primaryTsIndex);
+ qDebug("stream recover scan get block, rows %d", pBlock->info.rows);
return pBlock;
}
pTaskInfo->streamInfo.recoverStep = STREAM_RECOVER_STEP__NONE;
+ STableScanInfo* pTSInfo = pInfo->pTableScanOp->info;
+ tsdbReaderClose(pTSInfo->dataReader);
+ pTSInfo->dataReader = NULL;
+
+ pTSInfo->cond.startVersion = -1;
+ pTSInfo->cond.endVersion = -1;
+
return NULL;
}
-#endif
size_t total = taosArrayGetSize(pInfo->pBlockLists);
- // TODO: refactor
- FETCH_NEXT_BLOCK:
+// TODO: refactor
+FETCH_NEXT_BLOCK:
if (pInfo->blockType == STREAM_INPUT__DATA_BLOCK) {
if (pInfo->validBlockIndex >= total) {
doClearBufferedBlocks(pInfo);
@@ -2022,7 +2056,7 @@ static SSDataBlock* doStreamScan(SOperatorInfo* pOperator) {
int32_t totBlockNum = taosArrayGetSize(pInfo->pBlockLists);
- NEXT_SUBMIT_BLK:
+ NEXT_SUBMIT_BLK:
while (1) {
if (pInfo->tqReader->pMsg == NULL) {
if (pInfo->validBlockIndex >= totBlockNum) {
@@ -2143,7 +2177,9 @@ static SSDataBlock* doRawScan(SOperatorInfo* pOperator) {
longjmp(pTaskInfo->env, TSDB_CODE_TSC_QUERY_CANCELLED);
}
- tsdbRetrieveDataBlockInfo(pInfo->dataReader, &pBlock->info);
+ int32_t rows = 0;
+ tsdbRetrieveDataBlockInfo(pInfo->dataReader, &rows, &pBlock->info.uid, &pBlock->info.window);
+ pBlock->info.rows = rows;
SArray* pCols = tsdbRetrieveDataBlock(pInfo->dataReader, NULL);
pBlock->pDataBlock = pCols;
@@ -2271,14 +2307,14 @@ SOperatorInfo* createRawScanOperatorInfo(SReadHandle* pHandle, SExecTaskInfo* pT
pInfo->vnode = pHandle->vnode;
pInfo->sContext = pHandle->sContext;
- pOperator->name = "RawStreamScanOperator";
+ pOperator->name = "RawScanOperator";
pOperator->info = pInfo;
pOperator->pTaskInfo = pTaskInfo;
pOperator->fpSet = createOperatorFpSet(NULL, doRawScan, NULL, NULL, destroyRawScanOperatorInfo, NULL);
return pOperator;
- _end:
+_end:
taosMemoryFree(pInfo);
taosMemoryFree(pOperator);
pTaskInfo->code = code;
@@ -2388,14 +2424,15 @@ SOperatorInfo* createStreamScanOperatorInfo(SReadHandle* pHandle, STableScanPhys
}
STableKeyInfo* pList = NULL;
- int32_t num = 0;
+ int32_t num = 0;
tableListGetGroupList(pTaskInfo->pTableInfoList, 0, &pList, &num);
if (pHandle->initTableReader) {
pTSInfo->scanMode = TABLE_SCAN__TABLE_ORDER;
pTSInfo->dataReader = NULL;
- if (tsdbReaderOpen(pHandle->vnode, &pTSInfo->cond, pList, num, &pTSInfo->dataReader, NULL) < 0) {
- terrno = TSDB_CODE_OUT_OF_MEMORY;
+ int32_t code = tsdbReaderOpen(pHandle->vnode, &pTSInfo->cond, pList, num, &pTSInfo->dataReader, NULL);
+ if (code != 0) {
+ terrno = code;
destroyTableScanOperatorInfo(pTableScanOp);
goto _error;
}
@@ -2467,7 +2504,7 @@ SOperatorInfo* createStreamScanOperatorInfo(SReadHandle* pHandle, STableScanPhys
return pOperator;
- _error:
+_error:
if (pColIds != NULL) {
taosArrayDestroy(pColIds);
}
@@ -4102,7 +4139,7 @@ SOperatorInfo* createSysTableScanOperatorInfo(void* readHandle, SSystemTableScan
return pOperator;
- _error:
+_error:
taosMemoryFreeClear(pInfo);
taosMemoryFreeClear(pOperator);
terrno = TSDB_CODE_QRY_OUT_OF_MEMORY;
@@ -4241,7 +4278,7 @@ SOperatorInfo* createTagScanOperatorInfo(SReadHandle* pReadHandle, STagScanPhysi
return pOperator;
- _error:
+_error:
taosMemoryFree(pInfo);
taosMemoryFree(pOperator);
terrno = TSDB_CODE_OUT_OF_MEMORY;
@@ -4260,130 +4297,6 @@ int32_t createMultipleDataReaders(SQueryTableDataCond* pQueryCond, SReadHandle*
return TSDB_CODE_SUCCESS;
}
-int32_t createMultipleDataReaders2(SQueryTableDataCond* pQueryCond, SReadHandle* pHandle,
- STableListInfo* pTableListInfo, int32_t tableStartIdx, int32_t tableEndIdx,
- STsdbReader** ppReader, const char* idstr) {
- STsdbReader* pReader = NULL;
- void* pStart = tableListGetInfo(pTableListInfo, tableStartIdx);
- int32_t num = tableEndIdx - tableStartIdx + 1;
-
- int32_t code = tsdbReaderOpen(pHandle->vnode, pQueryCond, pStart, num, &pReader, idstr);
- if (code != 0) {
- return code;
- }
-
- *ppReader = pReader;
- return TSDB_CODE_SUCCESS;
-}
-
-static int32_t loadDataBlockFromOneTable2(SOperatorInfo* pOperator, STableMergeScanInfo* pTableScanInfo,
- SSDataBlock* pBlock, uint32_t* status) {
- SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo;
- STableMergeScanInfo* pInfo = pOperator->info;
-
- uint64_t uid = pBlock->info.uid;
-
- SFileBlockLoadRecorder* pCost = &pTableScanInfo->readRecorder;
-
- pCost->totalBlocks += 1;
- pCost->totalRows += pBlock->info.rows;
-
- *status = pInfo->dataBlockLoadFlag;
- if (pTableScanInfo->pFilterNode != NULL ||
- overlapWithTimeWindow(&pTableScanInfo->interval, &pBlock->info, pTableScanInfo->cond.order)) {
- (*status) = FUNC_DATA_REQUIRED_DATA_LOAD;
- }
-
- SDataBlockInfo* pBlockInfo = &pBlock->info;
- taosMemoryFreeClear(pBlock->pBlockAgg);
-
- if (*status == FUNC_DATA_REQUIRED_FILTEROUT) {
- qDebug("%s data block filter out, brange:%" PRId64 "-%" PRId64 ", rows:%d", GET_TASKID(pTaskInfo),
- pBlockInfo->window.skey, pBlockInfo->window.ekey, pBlockInfo->rows);
- pCost->filterOutBlocks += 1;
- 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);
- pCost->skipBlocks += 1;
-
- // clear all data in pBlock that are set when handing the previous block
- for (int32_t i = 0; i < taosArrayGetSize(pBlock->pDataBlock); ++i) {
- SColumnInfoData* pcol = taosArrayGet(pBlock->pDataBlock, i);
- pcol->pData = NULL;
- }
-
- return TSDB_CODE_SUCCESS;
- } else if (*status == FUNC_DATA_REQUIRED_STATIS_LOAD) {
- pCost->loadBlockStatis += 1;
-
- bool allColumnsHaveAgg = true;
- SColumnDataAgg** pColAgg = NULL;
- STsdbReader* reader = pTableScanInfo->pReader;
- tsdbRetrieveDatablockSMA(reader, &pColAgg, &allColumnsHaveAgg);
-
- if (allColumnsHaveAgg == true) {
- int32_t numOfCols = taosArrayGetSize(pBlock->pDataBlock);
-
- // todo create this buffer during creating operator
- if (pBlock->pBlockAgg == NULL) {
- pBlock->pBlockAgg = taosMemoryCalloc(numOfCols, POINTER_BYTES);
- }
-
- for (int32_t i = 0; i < numOfCols; ++i) {
- SColMatchItem* pColMatchInfo = taosArrayGet(pTableScanInfo->matchInfo.pList, i);
- if (!pColMatchInfo->needOutput) {
- continue;
- }
- pBlock->pBlockAgg[pColMatchInfo->dstSlotId] = pColAgg[i];
- }
-
- return TSDB_CODE_SUCCESS;
- } else { // failed to load the block sma data, data block statistics does not exist, load data block instead
- *status = FUNC_DATA_REQUIRED_DATA_LOAD;
- }
- }
-
- ASSERT(*status == FUNC_DATA_REQUIRED_DATA_LOAD);
-
- pCost->totalCheckedRows += pBlock->info.rows;
- pCost->loadBlocks += 1;
-
- STsdbReader* reader = pTableScanInfo->pReader;
- SArray* pCols = tsdbRetrieveDataBlock(reader, NULL);
- if (pCols == NULL) {
- return terrno;
- }
-
- relocateColumnData(pBlock, pTableScanInfo->matchInfo.pList, pCols, true);
-
- // currently only the tbname pseudo column
- if (pTableScanInfo->pseudoSup.numOfExprs > 0) {
- int32_t code = addTagPseudoColumnData(&pTableScanInfo->readHandle, pTableScanInfo->pseudoSup.pExprInfo,
- pTableScanInfo->pseudoSup.numOfExprs, pBlock, GET_TASKID(pTaskInfo));
- if (code != TSDB_CODE_SUCCESS) {
- T_LONG_JMP(pTaskInfo->env, code);
- }
- }
-
- if (pTableScanInfo->pFilterNode != NULL) {
- int64_t st = taosGetTimestampMs();
- doFilter(pTableScanInfo->pFilterNode, pBlock, &pTableScanInfo->matchInfo, NULL);
-
- double el = (taosGetTimestampUs() - st) / 1000.0;
- pTableScanInfo->readRecorder.filterTime += el;
-
- if (pBlock->info.rows == 0) {
- pCost->filterOutBlocks += 1;
- qDebug("%s data block filter out, brange:%" PRId64 "-%" PRId64 ", rows:%d, elapsed time:%.2f ms",
- GET_TASKID(pTaskInfo), pBlockInfo->window.skey, pBlockInfo->window.ekey, pBlockInfo->rows, el);
- } else {
- qDebug("%s data block filter applied, elapsed time:%.2f ms", GET_TASKID(pTaskInfo), el);
- }
- }
- return TSDB_CODE_SUCCESS;
-}
-
// todo refactor
static int32_t loadDataBlockFromOneTable(SOperatorInfo* pOperator, STableMergeScanInfo* pTableScanInfo,
int32_t readerIdx, SSDataBlock* pBlock, uint32_t* status) {
@@ -4426,7 +4339,7 @@ static int32_t loadDataBlockFromOneTable(SOperatorInfo* pOperator, STableMergeSc
bool allColumnsHaveAgg = true;
SColumnDataAgg** pColAgg = NULL;
-// STsdbReader* reader = pTableScanInfo->pReader; // taosArrayGetP(pTableScanInfo->dataReaders, readerIdx);
+ // STsdbReader* reader = pTableScanInfo->pReader; // taosArrayGetP(pTableScanInfo->dataReaders, readerIdx);
if (allColumnsHaveAgg == true) {
int32_t numOfCols = taosArrayGetSize(pBlock->pDataBlock);
@@ -4476,8 +4389,9 @@ static int32_t loadDataBlockFromOneTable(SOperatorInfo* pOperator, STableMergeSc
// currently only the tbname pseudo column
if (pTableScanInfo->pseudoSup.numOfExprs > 0) {
- int32_t code = addTagPseudoColumnData(&pTableScanInfo->readHandle, pTableScanInfo->pseudoSup.pExprInfo,
- pTableScanInfo->pseudoSup.numOfExprs, pBlock, GET_TASKID(pTaskInfo));
+ int32_t code =
+ addTagPseudoColumnData(&pTableScanInfo->readHandle, pTableScanInfo->pseudoSup.pExprInfo,
+ pTableScanInfo->pseudoSup.numOfExprs, pBlock, pBlock->info.rows, GET_TASKID(pTaskInfo));
if (code != TSDB_CODE_SUCCESS) {
T_LONG_JMP(pTaskInfo->env, code);
}
@@ -4509,7 +4423,7 @@ typedef struct STableMergeScanSortSourceParam {
SSDataBlock* inputBlock;
} STableMergeScanSortSourceParam;
-static SSDataBlock* getTableDataBlockTemp(void* param) {
+static SSDataBlock* getTableDataBlockImpl(void* param) {
STableMergeScanSortSourceParam* source = param;
SOperatorInfo* pOperator = source->pOperator;
STableMergeScanInfo* pInfo = pOperator->info;
@@ -4524,9 +4438,13 @@ static SSDataBlock* getTableDataBlockTemp(void* param) {
int64_t st = taosGetTimestampUs();
- void* p = tableListGetInfo(pInfo->tableListInfo, readIdx + pInfo->tableStartIndex);
+ void* p = tableListGetInfo(pInfo->tableListInfo, readIdx + pInfo->tableStartIndex);
SReadHandle* pHandle = &pInfo->readHandle;
- tsdbReaderOpen(pHandle->vnode, pQueryCond, p, 1, &pInfo->pReader, GET_TASKID(pTaskInfo));
+
+ int32_t code = tsdbReaderOpen(pHandle->vnode, pQueryCond, p, 1, &pInfo->pReader, GET_TASKID(pTaskInfo));
+ if (code != 0) {
+ T_LONG_JMP(pOperator->pTaskInfo->env, code);
+ }
STsdbReader* reader = pInfo->pReader;
while (tsdbNextDataBlock(reader)) {
@@ -4541,14 +4459,11 @@ static SSDataBlock* getTableDataBlockTemp(void* param) {
}
blockDataCleanup(pBlock);
- SDataBlockInfo binfo = pBlock->info;
- tsdbRetrieveDataBlockInfo(reader, &binfo);
- blockDataEnsureCapacity(pBlock, binfo.rows);
- pBlock->info.type = binfo.type;
- pBlock->info.uid = binfo.uid;
- pBlock->info.window = binfo.window;
- pBlock->info.rows = binfo.rows;
+ int32_t rows = 0;
+ tsdbRetrieveDataBlockInfo(reader, &rows, &pBlock->info.uid, &pBlock->info.window);
+ blockDataEnsureCapacity(pBlock, rows);
+ pBlock->info.rows = rows;
if (pQueryCond->order == TSDB_ORDER_ASC) {
pQueryCond->twindows.skey = pBlock->info.window.ekey + 1;
@@ -4580,58 +4495,6 @@ static SSDataBlock* getTableDataBlockTemp(void* param) {
pInfo->pReader = NULL;
return NULL;
}
-static SSDataBlock* getTableDataBlock2(void* param) {
- STableMergeScanSortSourceParam* source = param;
- SOperatorInfo* pOperator = source->pOperator;
- int64_t uid = source->uid;
- SSDataBlock* pBlock = source->inputBlock;
- STableMergeScanInfo* pTableScanInfo = pOperator->info;
-
- int64_t st = taosGetTimestampUs();
-
- blockDataCleanup(pBlock);
-
- STsdbReader* reader = pTableScanInfo->pReader;
- while (tsdbTableNextDataBlock(reader, uid)) {
- if (isTaskKilled(pOperator->pTaskInfo)) {
- T_LONG_JMP(pOperator->pTaskInfo->env, TSDB_CODE_TSC_QUERY_CANCELLED);
- }
-
- // process this data block based on the probabilities
- bool processThisBlock = processBlockWithProbability(&pTableScanInfo->sample);
- if (!processThisBlock) {
- continue;
- }
-
- blockDataCleanup(pBlock);
- SDataBlockInfo binfo = pBlock->info;
- tsdbRetrieveDataBlockInfo(reader, &binfo);
-
- blockDataEnsureCapacity(pBlock, binfo.rows);
- pBlock->info.type = binfo.type;
- pBlock->info.uid = binfo.uid;
- pBlock->info.window = binfo.window;
- pBlock->info.rows = binfo.rows;
-
- uint32_t status = 0;
- int32_t code = loadDataBlockFromOneTable2(pOperator, pTableScanInfo, pBlock, &status);
- if (code != TSDB_CODE_SUCCESS) {
- T_LONG_JMP(pOperator->pTaskInfo->env, code);
- }
-
- // current block is filter out according to filter condition, continue load the next block
- if (status == FUNC_DATA_REQUIRED_FILTEROUT || pBlock->info.rows == 0) {
- continue;
- }
-
- pBlock->info.groupId = getTableGroupId(pOperator->pTaskInfo->pTableInfoList, pBlock->info.uid);
- pOperator->resultInfo.totalRows = pTableScanInfo->readRecorder.totalRows;
- pTableScanInfo->readRecorder.elapsedTime += (taosGetTimestampUs() - st) / 1000.0;
-
- return pBlock;
- }
- return NULL;
-}
static SSDataBlock* getTableDataBlock(void* param) {
STableMergeScanSortSourceParam* source = param;
@@ -4657,14 +4520,11 @@ static SSDataBlock* getTableDataBlock(void* param) {
}
blockDataCleanup(pBlock);
- SDataBlockInfo binfo = pBlock->info;
- tsdbRetrieveDataBlockInfo(reader, &binfo);
- blockDataEnsureCapacity(pBlock, binfo.rows);
- pBlock->info.type = binfo.type;
- pBlock->info.uid = binfo.uid;
- pBlock->info.window = binfo.window;
- pBlock->info.rows = binfo.rows;
+ int32_t rows = 0;
+ tsdbRetrieveDataBlockInfo(reader, &rows, &pBlock->info.uid, &pBlock->info.window);
+ blockDataEnsureCapacity(pBlock, rows);
+ pBlock->info.rows = rows;
uint32_t status = 0;
int32_t code = loadDataBlockFromOneTable(pOperator, pTableScanInfo, readerIdx, pBlock, &status);
@@ -4744,7 +4604,7 @@ int32_t startGroupTableMergeScan(SOperatorInfo* pOperator) {
pInfo->pSortHandle = tsortCreateSortHandle(pInfo->pSortInfo, SORT_MULTISOURCE_MERGE, pInfo->bufPageSize, numOfBufPage,
pInfo->pSortInputBlock, pTaskInfo->id.str);
- tsortSetFetchRawDataFp(pInfo->pSortHandle, getTableDataBlockTemp, NULL, NULL);
+ tsortSetFetchRawDataFp(pInfo->pSortHandle, getTableDataBlockImpl, NULL, NULL);
// one table has one data block
int32_t numOfTable = tableEndIdx - tableStartIdx + 1;
diff --git a/source/libs/executor/src/timewindowoperator.c b/source/libs/executor/src/timewindowoperator.c
index 49a7112eba..6be9a0402f 100644
--- a/source/libs/executor/src/timewindowoperator.c
+++ b/source/libs/executor/src/timewindowoperator.c
@@ -1687,7 +1687,9 @@ void initIntervalDownStream(SOperatorInfo* downstream, uint16_t type, SAggSuppor
SStreamScanInfo* pScanInfo = downstream->info;
pScanInfo->windowSup.parentType = type;
pScanInfo->windowSup.pIntervalAggSup = pSup;
- pScanInfo->pUpdateInfo = updateInfoInitP(pInterval, pTwSup->waterMark);
+ if (!pScanInfo->pUpdateInfo) {
+ pScanInfo->pUpdateInfo = updateInfoInitP(pInterval, pTwSup->waterMark);
+ }
pScanInfo->interval = *pInterval;
pScanInfo->twAggSup = *pTwSup;
}
@@ -2453,7 +2455,6 @@ static SSDataBlock* doTimeslice(SOperatorInfo* pOperator) {
} else { // non-linear interpolation
pSliceInfo->current =
taosTimeAdd(pSliceInfo->current, pInterval->interval, pInterval->intervalUnit, pInterval->precision);
-
}
}
@@ -3302,6 +3303,8 @@ SOperatorInfo* createStreamFinalIntervalOperatorInfo(SOperatorInfo* downstream,
// for test 315360000000
.deleteMark = 1000LL * 60LL * 60LL * 24LL * 365LL * 10LL,
// .deleteMark = INT64_MAX,
+ .deleteMarkSaved = 0,
+ .calTriggerSaved = 0,
};
ASSERT(pInfo->twAggSup.calTrigger != STREAM_TRIGGER_MAX_DELAY);
pInfo->primaryTsIndex = ((SColumnNode*)pIntervalPhyNode->window.pTspk)->slotId;
diff --git a/source/libs/function/CMakeLists.txt b/source/libs/function/CMakeLists.txt
index 913dd24a49..fa241dc6ef 100644
--- a/source/libs/function/CMakeLists.txt
+++ b/source/libs/function/CMakeLists.txt
@@ -12,6 +12,17 @@ target_include_directories(
PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/inc"
)
+IF (TD_LINUX_64 AND JEMALLOC_ENABLED)
+ ADD_DEFINITIONS(-DTD_JEMALLOC_ENABLED -I${CMAKE_BINARY_DIR}/build/include -L${CMAKE_BINARY_DIR}/build/lib -Wl,-rpath,${CMAKE_BINARY_DIR}/build/lib -ljemalloc)
+ SET(LINK_JEMALLOC "-L${CMAKE_BINARY_DIR}/build/lib -ljemalloc")
+ELSE ()
+ SET(LINK_JEMALLOC "")
+ENDIF ()
+
+IF (TD_LINUX_64 AND JEMALLOC_ENABLED)
+ ADD_DEPENDENCIES(function jemalloc)
+ENDIF ()
+
target_link_libraries(
function
PRIVATE os
@@ -21,7 +32,7 @@ target_link_libraries(
PRIVATE qcom
PRIVATE scalar
PRIVATE transport
- PRIVATE stream
+ PRIVATE stream ${LINK_JEMALLOC}
PUBLIC uv_a
)
@@ -37,10 +48,15 @@ target_include_directories(
"${TD_SOURCE_DIR}/include/os"
PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/inc"
)
+
+IF (TD_LINUX_64 AND JEMALLOC_ENABLED)
+ ADD_DEPENDENCIES(runUdf jemalloc)
+ENDIF ()
+
target_link_libraries(
runUdf
PUBLIC uv_a
- PRIVATE os util common nodes function
+ PRIVATE os util common nodes function ${LINK_JEMALLOC}
)
add_library(udf1 STATIC MODULE test/udf1.c)
@@ -54,8 +70,13 @@ target_include_directories(
"${TD_SOURCE_DIR}/include/os"
PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/inc"
)
+
+IF (TD_LINUX_64 AND JEMALLOC_ENABLED)
+ ADD_DEPENDENCIES(udf1 jemalloc)
+ENDIF ()
+
target_link_libraries(
- udf1 PUBLIC os)
+ udf1 PUBLIC os ${LINK_JEMALLOC})
add_library(udf2 STATIC MODULE test/udf2.c)
target_include_directories(
@@ -68,8 +89,13 @@ target_include_directories(
"${TD_SOURCE_DIR}/include/os"
PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/inc"
)
+
+IF (TD_LINUX_64 AND JEMALLOC_ENABLED)
+ ADD_DEPENDENCIES(udf2 jemalloc)
+ENDIF ()
+
target_link_libraries(
- udf2 PUBLIC os
+ udf2 PUBLIC os ${LINK_JEMALLOC}
)
#SET(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/build/bin)
@@ -86,9 +112,13 @@ target_include_directories(
PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/inc"
)
-target_link_libraries(
- udfd
- PUBLIC uv_a
- PRIVATE os util common nodes function
-)
+IF (TD_LINUX_64 AND JEMALLOC_ENABLED)
+ ADD_DEPENDENCIES(udfd jemalloc)
+ENDIF ()
+
+target_link_libraries(
+ udfd
+ PUBLIC uv_a
+ PRIVATE os util common nodes function ${LINK_JEMALLOC}
+ )
diff --git a/source/libs/function/src/builtinsimpl.c b/source/libs/function/src/builtinsimpl.c
index 5dcef7cd17..c8f0b3d826 100644
--- a/source/libs/function/src/builtinsimpl.c
+++ b/source/libs/function/src/builtinsimpl.c
@@ -497,7 +497,7 @@ bool getCountFuncEnv(SFunctionNode* UNUSED_PARAM(pFunc), SFuncExecEnv* pEnv) {
return true;
}
-static FORCE_INLINE int32_t getNumOfElems(SqlFunctionCtx* pCtx) {
+static int32_t getNumOfElems(SqlFunctionCtx* pCtx) {
int32_t numOfElem = 0;
/*
@@ -2194,6 +2194,56 @@ int32_t leastSQRFunction(SqlFunctionCtx* pCtx) {
break;
}
+ case TSDB_DATA_TYPE_UTINYINT: {
+ uint8_t* plist = (uint8_t*)pCol->pData;
+ for (int32_t i = start; i < numOfRows + pInput->startRowIndex; ++i) {
+ if (pCol->hasNull && colDataIsNull_f(pCol->nullbitmap, i)) {
+ continue;
+ }
+ numOfElem++;
+ LEASTSQR_CAL(param, x, plist, i, pInfo->stepVal);
+ }
+ break;
+ }
+ case TSDB_DATA_TYPE_USMALLINT: {
+ uint16_t* plist = (uint16_t*)pCol->pData;
+ for (int32_t i = start; i < numOfRows + pInput->startRowIndex; ++i) {
+ if (pCol->hasNull && colDataIsNull_f(pCol->nullbitmap, i)) {
+ continue;
+ }
+
+ numOfElem++;
+ LEASTSQR_CAL(param, x, plist, i, pInfo->stepVal);
+ }
+ break;
+ }
+
+ case TSDB_DATA_TYPE_UINT: {
+ uint32_t* plist = (uint32_t*)pCol->pData;
+ for (int32_t i = start; i < numOfRows + pInput->startRowIndex; ++i) {
+ if (pCol->hasNull && colDataIsNull_f(pCol->nullbitmap, i)) {
+ continue;
+ }
+
+ numOfElem++;
+ LEASTSQR_CAL(param, x, plist, i, pInfo->stepVal);
+ }
+ break;
+ }
+
+ case TSDB_DATA_TYPE_UBIGINT: {
+ uint64_t* plist = (uint64_t*)pCol->pData;
+ for (int32_t i = start; i < numOfRows + pInput->startRowIndex; ++i) {
+ if (pCol->hasNull && colDataIsNull_f(pCol->nullbitmap, i)) {
+ continue;
+ }
+
+ numOfElem++;
+ LEASTSQR_CAL(param, x, plist, i, pInfo->stepVal);
+ }
+ break;
+ }
+
case TSDB_DATA_TYPE_FLOAT: {
float* plist = (float*)pCol->pData;
for (int32_t i = start; i < numOfRows + pInput->startRowIndex; ++i) {
@@ -2257,6 +2307,12 @@ int32_t leastSQRFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) {
double param00 = param[0][0] - param[1][0] * (param[0][1] / param[1][1]);
double param02 = param[0][2] - param[1][2] * (param[0][1] / param[1][1]);
+
+ if (0 == param00) {
+ colDataAppendNULL(pCol, currentRow);
+ return 0;
+ }
+
// param[0][1] = 0;
double param12 = param[1][2] - param02 * (param[1][0] / param00);
// param[1][0] = 0;
@@ -2657,7 +2713,9 @@ int32_t apercentileFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) {
taosMemoryFree(res);
} else { // no need to free
// setNull(pCtx->pOutput, pCtx->outputType, pCtx->outputBytes);
- return TSDB_CODE_SUCCESS;
+ // return TSDB_CODE_SUCCESS;
+ qDebug("%s get the final res, elements:%" PRId64 ", numOfEntry:%d. result is null", __FUNCTION__,
+ pInfo->pHisto->numOfElems, pInfo->pHisto->numOfEntries);
}
}
diff --git a/source/libs/function/src/functionMgt.c b/source/libs/function/src/functionMgt.c
index bae005f5c4..0de914271c 100644
--- a/source/libs/function/src/functionMgt.c
+++ b/source/libs/function/src/functionMgt.c
@@ -251,6 +251,13 @@ bool fmIsSelectValueFunc(int32_t funcId) {
return FUNCTION_TYPE_SELECT_VALUE == funcMgtBuiltins[funcId].type;
}
+bool fmIsGroupKeyFunc(int32_t funcId) {
+ if (funcId < 0 || funcId >= funcMgtBuiltinsNum) {
+ return false;
+ }
+ return FUNCTION_TYPE_GROUP_KEY == 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/tudf.c b/source/libs/function/src/tudf.c
index ea59e92e98..1dedfe8364 100644
--- a/source/libs/function/src/tudf.c
+++ b/source/libs/function/src/tudf.c
@@ -117,10 +117,32 @@ static int32_t udfSpawnUdfd(SUdfdData *pData) {
char dnodeIdEnvItem[32] = {0};
char thrdPoolSizeEnvItem[32] = {0};
snprintf(dnodeIdEnvItem, 32, "%s=%d", "DNODE_ID", pData->dnodeId);
+
float numCpuCores = 4;
taosGetCpuCores(&numCpuCores);
snprintf(thrdPoolSizeEnvItem, 32, "%s=%d", "UV_THREADPOOL_SIZE", (int)numCpuCores * 2);
- char *envUdfd[] = {dnodeIdEnvItem, thrdPoolSizeEnvItem, NULL};
+
+ char pathTaosdLdLib[512] = {0};
+ size_t taosdLdLibPathLen = sizeof(pathTaosdLdLib);
+ int ret = uv_os_getenv("LD_LIBRARY_PATH", pathTaosdLdLib, &taosdLdLibPathLen);
+ if (ret != UV_ENOBUFS) {
+ taosdLdLibPathLen = strlen(pathTaosdLdLib);
+ }
+
+ char udfdPathLdLib[1024] = {0};
+ size_t udfdLdLibPathLen = strlen(tsUdfdLdLibPath);
+ strncpy(udfdPathLdLib, tsUdfdLdLibPath, udfdLdLibPathLen);
+ udfdPathLdLib[udfdLdLibPathLen] = ':';
+ strncpy(udfdPathLdLib + udfdLdLibPathLen + 1, pathTaosdLdLib, sizeof(udfdPathLdLib) - udfdLdLibPathLen - 1);
+ if (udfdLdLibPathLen + taosdLdLibPathLen < 1024) {
+ fnInfo("udfd LD_LIBRARY_PATH: %s", udfdPathLdLib);
+ } else {
+ fnError("can not set correct udfd LD_LIBRARY_PATH");
+ }
+ char ldLibPathEnvItem[1024 + 32] = {0};
+ snprintf(ldLibPathEnvItem, 1024 + 32, "%s=%s", "LD_LIBRARY_PATH", udfdPathLdLib);
+
+ char *envUdfd[] = {dnodeIdEnvItem, thrdPoolSizeEnvItem, ldLibPathEnvItem, NULL};
options.env = envUdfd;
int err = uv_spawn(&pData->loop, &pData->process, &options);
@@ -340,7 +362,7 @@ typedef struct SUdfcProxy {
SArray *udfStubs; // SUdfcFuncStub
uv_mutex_t udfcUvMutex;
- int8_t initialized;
+ int8_t initialized;
} SUdfcProxy;
SUdfcProxy gUdfcProxy = {0};
diff --git a/source/libs/index/src/indexFstFile.c b/source/libs/index/src/indexFstFile.c
index 33960ad8c2..5538584754 100644
--- a/source/libs/index/src/indexFstFile.c
+++ b/source/libs/index/src/indexFstFile.c
@@ -152,7 +152,7 @@ IFileCtx* idxFileCtxCreate(WriterType type, const char* path, bool readOnly, int
if (ctx->type == TFILE) {
// ugly code, refactor later
ctx->file.readOnly = readOnly;
- memcpy(ctx->file.buf, path, sizeof(ctx->file.buf));
+ memcpy(ctx->file.buf, path, strlen(path));
if (readOnly == false) {
ctx->file.pFile = taosOpenFile(path, TD_FILE_CREATE | TD_FILE_WRITE | TD_FILE_APPEND);
taosFtruncateFile(ctx->file.pFile, 0);
diff --git a/source/libs/parser/inc/parAst.h b/source/libs/parser/inc/parAst.h
index 09d1a5e772..86940a9d7a 100644
--- a/source/libs/parser/inc/parAst.h
+++ b/source/libs/parser/inc/parAst.h
@@ -182,7 +182,7 @@ SNode* createCreateUserStmt(SAstCreateContext* pCxt, SToken* pUserName, const ST
SNode* createAlterUserStmt(SAstCreateContext* pCxt, SToken* pUserName, int8_t alterType, const SToken* pVal);
SNode* createDropUserStmt(SAstCreateContext* pCxt, SToken* pUserName);
SNode* createCreateDnodeStmt(SAstCreateContext* pCxt, const SToken* pFqdn, const SToken* pPort);
-SNode* createDropDnodeStmt(SAstCreateContext* pCxt, const SToken* pDnode);
+SNode* createDropDnodeStmt(SAstCreateContext* pCxt, const SToken* pDnode, bool force);
SNode* createAlterDnodeStmt(SAstCreateContext* pCxt, const SToken* pDnode, const SToken* pConfig, const SToken* pValue);
SNode* createCreateIndexStmt(SAstCreateContext* pCxt, EIndexType type, bool ignoreExists, SNode* pIndexName,
SNode* pRealTable, SNodeList* pCols, SNode* pOptions);
diff --git a/source/libs/parser/inc/sql.y b/source/libs/parser/inc/sql.y
index 00e40cfc50..b143f1624e 100644
--- a/source/libs/parser/inc/sql.y
+++ b/source/libs/parser/inc/sql.y
@@ -120,8 +120,8 @@ priv_level(A) ::= db_name(B) NK_DOT NK_STAR.
/************************************************ create/drop/alter dnode *********************************************/
cmd ::= CREATE DNODE dnode_endpoint(A). { pCxt->pRootNode = createCreateDnodeStmt(pCxt, &A, NULL); }
cmd ::= CREATE DNODE dnode_endpoint(A) PORT NK_INTEGER(B). { pCxt->pRootNode = createCreateDnodeStmt(pCxt, &A, &B); }
-cmd ::= DROP DNODE NK_INTEGER(A). { pCxt->pRootNode = createDropDnodeStmt(pCxt, &A); }
-cmd ::= DROP DNODE dnode_endpoint(A). { pCxt->pRootNode = createDropDnodeStmt(pCxt, &A); }
+cmd ::= DROP DNODE NK_INTEGER(A) force_opt(B). { pCxt->pRootNode = createDropDnodeStmt(pCxt, &A, B); }
+cmd ::= DROP DNODE dnode_endpoint(A) force_opt(B). { pCxt->pRootNode = createDropDnodeStmt(pCxt, &A, B); }
cmd ::= ALTER DNODE NK_INTEGER(A) NK_STRING(B). { pCxt->pRootNode = createAlterDnodeStmt(pCxt, &A, &B, NULL); }
cmd ::= ALTER DNODE NK_INTEGER(A) NK_STRING(B) NK_STRING(C). { pCxt->pRootNode = createAlterDnodeStmt(pCxt, &A, &B, &C); }
cmd ::= ALTER ALL DNODES NK_STRING(A). { pCxt->pRootNode = createAlterDnodeStmt(pCxt, NULL, &A, NULL); }
@@ -133,6 +133,11 @@ dnode_endpoint(A) ::= NK_STRING(B).
dnode_endpoint(A) ::= NK_ID(B). { A = B; }
dnode_endpoint(A) ::= NK_IPTOKEN(B). { A = B; }
+%type force_opt { bool }
+%destructor force_opt { }
+force_opt(A) ::= . { A = false; }
+force_opt(A) ::= FORCE. { A = true; }
+
/************************************************ alter local *********************************************************/
cmd ::= ALTER LOCAL NK_STRING(A). { pCxt->pRootNode = createAlterLocalStmt(pCxt, &A, NULL); }
cmd ::= ALTER LOCAL NK_STRING(A) NK_STRING(B). { pCxt->pRootNode = createAlterLocalStmt(pCxt, &A, &B); }
diff --git a/source/libs/parser/src/parAstCreater.c b/source/libs/parser/src/parAstCreater.c
index df8e8554a7..49685112a9 100644
--- a/source/libs/parser/src/parAstCreater.c
+++ b/source/libs/parser/src/parAstCreater.c
@@ -1457,7 +1457,7 @@ SNode* createCreateDnodeStmt(SAstCreateContext* pCxt, const SToken* pFqdn, const
return (SNode*)pStmt;
}
-SNode* createDropDnodeStmt(SAstCreateContext* pCxt, const SToken* pDnode) {
+SNode* createDropDnodeStmt(SAstCreateContext* pCxt, const SToken* pDnode, bool force) {
CHECK_PARSER_STATUS(pCxt);
SDropDnodeStmt* pStmt = (SDropDnodeStmt*)nodesMakeNode(QUERY_NODE_DROP_DNODE_STMT);
CHECK_OUT_OF_MEM(pStmt);
@@ -1469,6 +1469,7 @@ SNode* createDropDnodeStmt(SAstCreateContext* pCxt, const SToken* pDnode) {
return NULL;
}
}
+ pStmt->force = force;
return (SNode*)pStmt;
}
diff --git a/source/libs/parser/src/parTokenizer.c b/source/libs/parser/src/parTokenizer.c
index 82a4e8000b..88a1d39ff2 100644
--- a/source/libs/parser/src/parTokenizer.c
+++ b/source/libs/parser/src/parTokenizer.c
@@ -97,6 +97,7 @@ static SKeyword keywordTable[] = {
{"FLOAT", TK_FLOAT},
{"FLUSH", TK_FLUSH},
{"FROM", TK_FROM},
+ {"FORCE", TK_FORCE},
{"FUNCTION", TK_FUNCTION},
{"FUNCTIONS", TK_FUNCTIONS},
{"GRANT", TK_GRANT},
diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c
index bffeb06f7c..d3ff787f50 100644
--- a/source/libs/parser/src/parTranslater.c
+++ b/source/libs/parser/src/parTranslater.c
@@ -674,6 +674,10 @@ static bool isSelectFunc(const SNode* pNode) {
return (QUERY_NODE_FUNCTION == nodeType(pNode) && fmIsSelectFunc(((SFunctionNode*)pNode)->funcId));
}
+static bool isWindowPseudoColumnFunc(const SNode* pNode) {
+ return (QUERY_NODE_FUNCTION == nodeType(pNode) && fmIsWindowPseudoColumnFunc(((SFunctionNode*)pNode)->funcId));
+}
+
static bool isTimelineFunc(const SNode* pNode) {
return (QUERY_NODE_FUNCTION == nodeType(pNode) && fmIsTimelineFunc(((SFunctionNode*)pNode)->funcId));
}
@@ -1264,10 +1268,7 @@ static EDealRes translateOperator(STranslateContext* pCxt, SOperatorNode* pOp) {
}
static EDealRes haveVectorFunction(SNode* pNode, void* pContext) {
- if (isAggFunc(pNode)) {
- *((bool*)pContext) = true;
- return DEAL_RES_END;
- } else if (isIndefiniteRowsFunc(pNode)) {
+ if (isAggFunc(pNode) || isIndefiniteRowsFunc(pNode) || isWindowPseudoColumnFunc(pNode)) {
*((bool*)pContext) = true;
return DEAL_RES_END;
}
@@ -4995,6 +4996,7 @@ static int32_t translateDropDnode(STranslateContext* pCxt, SDropDnodeStmt* pStmt
dropReq.dnodeId = pStmt->dnodeId;
strcpy(dropReq.fqdn, pStmt->fqdn);
dropReq.port = pStmt->port;
+ dropReq.force = pStmt->force;
return buildCmdMsg(pCxt, TDMT_MND_DROP_DNODE, (FSerializeFunc)tSerializeSDropDnodeReq, &dropReq);
}
@@ -5158,7 +5160,7 @@ static int32_t translateCreateIndex(STranslateContext* pCxt, SCreateIndexStmt* p
static int32_t translateDropIndex(STranslateContext* pCxt, SDropIndexStmt* pStmt) {
SMDropSmaReq dropSmaReq = {0};
SName name;
- tNameExtractFullName(toName(pCxt->pParseCxt->acctId, pCxt->pParseCxt->db, pStmt->indexName, &name), dropSmaReq.name);
+ tNameExtractFullName(toName(pCxt->pParseCxt->acctId, pStmt->indexDbName, pStmt->indexName, &name), dropSmaReq.name);
dropSmaReq.igNotExists = pStmt->ignoreNotExists;
return buildCmdMsg(pCxt, TDMT_MND_DROP_SMA, (FSerializeFunc)tSerializeSMDropSmaReq, &dropSmaReq);
}
@@ -5279,7 +5281,7 @@ static int32_t translateCreateTopic(STranslateContext* pCxt, SCreateTopicStmt* p
code = buildCreateTopicReq(pCxt, pStmt, &createReq);
}
if (TSDB_CODE_SUCCESS == code) {
- code = buildCmdMsg(pCxt, TDMT_MND_CREATE_TOPIC, (FSerializeFunc)tSerializeSCMCreateTopicReq, &createReq);
+ code = buildCmdMsg(pCxt, TDMT_MND_TMQ_CREATE_TOPIC, (FSerializeFunc)tSerializeSCMCreateTopicReq, &createReq);
}
tFreeSCMCreateTopicReq(&createReq);
return code;
@@ -5293,7 +5295,7 @@ static int32_t translateDropTopic(STranslateContext* pCxt, SDropTopicStmt* pStmt
tNameGetFullDbName(&name, dropReq.name);
dropReq.igNotExists = pStmt->ignoreNotExists;
- return buildCmdMsg(pCxt, TDMT_MND_DROP_TOPIC, (FSerializeFunc)tSerializeSMDropTopicReq, &dropReq);
+ return buildCmdMsg(pCxt, TDMT_MND_TMQ_DROP_TOPIC, (FSerializeFunc)tSerializeSMDropTopicReq, &dropReq);
}
static int32_t translateDropCGroup(STranslateContext* pCxt, SDropCGroupStmt* pStmt) {
@@ -5305,7 +5307,7 @@ static int32_t translateDropCGroup(STranslateContext* pCxt, SDropCGroupStmt* pSt
dropReq.igNotExists = pStmt->ignoreNotExists;
strcpy(dropReq.cgroup, pStmt->cgroup);
- return buildCmdMsg(pCxt, TDMT_MND_MQ_DROP_CGROUP, (FSerializeFunc)tSerializeSMDropCgroupReq, &dropReq);
+ return buildCmdMsg(pCxt, TDMT_MND_TMQ_DROP_CGROUP, (FSerializeFunc)tSerializeSMDropCgroupReq, &dropReq);
}
static int32_t translateAlterLocal(STranslateContext* pCxt, SAlterLocalStmt* pStmt) {
diff --git a/source/libs/parser/src/sql.c b/source/libs/parser/src/sql.c
index 790bb0664c..292060515c 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 450
+#define YYNOCODE 452
#define YYACTIONTYPE unsigned short int
#define ParseTOKENTYPE SToken
typedef union {
int yyinit;
ParseTOKENTYPE yy0;
- int64_t yy9;
- SToken yy29;
- EOrder yy38;
- bool yy137;
- SAlterOption yy245;
- SNodeList* yy424;
- int32_t yy460;
- SDataType yy484;
- int8_t yy503;
- EFillMode yy594;
- EJoinType yy612;
- EOperatorType yy740;
- ENullOrder yy757;
- SNode* yy812;
+ EOperatorType yy4;
+ int64_t yy37;
+ SAlterOption yy101;
+ SNode* yy232;
+ SDataType yy264;
+ SNodeList* yy288;
+ SToken yy481;
+ int8_t yy607;
+ EFillMode yy614;
+ int32_t yy692;
+ EJoinType yy700;
+ bool yy777;
+ ENullOrder yy833;
+ EOrder yy866;
} YYMINORTYPE;
#ifndef YYSTACKDEPTH
#define YYSTACKDEPTH 100
@@ -139,17 +139,17 @@ typedef union {
#define ParseCTX_FETCH
#define ParseCTX_STORE
#define YYFALLBACK 1
-#define YYNSTATE 699
-#define YYNRULE 526
-#define YYNTOKEN 318
-#define YY_MAX_SHIFT 698
-#define YY_MIN_SHIFTREDUCE 1033
-#define YY_MAX_SHIFTREDUCE 1558
-#define YY_ERROR_ACTION 1559
-#define YY_ACCEPT_ACTION 1560
-#define YY_NO_ACTION 1561
-#define YY_MIN_REDUCE 1562
-#define YY_MAX_REDUCE 2087
+#define YYNSTATE 701
+#define YYNRULE 528
+#define YYNTOKEN 319
+#define YY_MAX_SHIFT 700
+#define YY_MIN_SHIFTREDUCE 1036
+#define YY_MAX_SHIFTREDUCE 1563
+#define YY_ERROR_ACTION 1564
+#define YY_ACCEPT_ACTION 1565
+#define YY_NO_ACTION 1566
+#define YY_MIN_REDUCE 1567
+#define YY_MAX_REDUCE 2094
/************* End control #defines *******************************************/
#define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0])))
@@ -216,753 +216,861 @@ typedef union {
** yy_default[] Default action for each state.
**
*********** Begin parsing tables **********************************************/
-#define YY_ACTTAB_COUNT (2801)
+#define YY_ACTTAB_COUNT (3333)
static const YYACTIONTYPE yy_action[] = {
- /* 0 */ 1889, 34, 268, 1889, 1702, 1066, 448, 1903, 449, 1597,
- /* 10 */ 1704, 1885, 44, 42, 1885, 456, 396, 449, 1597, 1817,
- /* 20 */ 351, 1885, 1339, 43, 41, 40, 39, 38, 1365, 40,
- /* 30 */ 39, 38, 591, 1419, 154, 1337, 1921, 1881, 1887, 339,
- /* 40 */ 1881, 1887, 345, 1716, 592, 1070, 1071, 1881, 1887, 1871,
- /* 50 */ 598, 604, 30, 598, 311, 157, 1414, 1574, 37, 36,
- /* 60 */ 598, 17, 43, 41, 40, 39, 38, 1903, 1345, 44,
- /* 70 */ 42, 1489, 1901, 1364, 1759, 1760, 1937, 351, 576, 1339,
- /* 80 */ 97, 1902, 1904, 608, 1906, 1907, 603, 1083, 598, 1082,
- /* 90 */ 1419, 77, 1337, 168, 1, 1990, 1921, 1493, 58, 344,
- /* 100 */ 1986, 77, 484, 1364, 605, 588, 46, 2058, 591, 1871,
- /* 110 */ 2062, 604, 173, 1414, 1709, 125, 695, 1084, 17, 536,
- /* 120 */ 2016, 550, 575, 171, 1708, 1345, 336, 2059, 577, 1814,
- /* 130 */ 1421, 1422, 606, 52, 132, 591, 1937, 1563, 1232, 1233,
- /* 140 */ 98, 350, 1904, 608, 1906, 1907, 603, 58, 598, 356,
- /* 150 */ 1713, 1, 1758, 1760, 1083, 1990, 1082, 1585, 110, 315,
- /* 160 */ 1986, 109, 108, 107, 106, 105, 104, 103, 102, 101,
- /* 170 */ 2058, 130, 465, 695, 58, 1340, 1365, 1338, 389, 433,
- /* 180 */ 388, 337, 46, 1584, 1084, 575, 171, 1421, 1422, 154,
- /* 190 */ 2059, 577, 590, 169, 1998, 1999, 1364, 2003, 1715, 1871,
- /* 200 */ 1343, 1344, 1583, 1394, 1395, 1397, 1398, 1399, 1400, 1401,
- /* 210 */ 1402, 1403, 1404, 600, 596, 1412, 1413, 1415, 1416, 1417,
- /* 220 */ 1418, 1420, 1423, 3, 47, 1871, 1691, 550, 1560, 502,
- /* 230 */ 501, 500, 1340, 94, 1338, 186, 185, 126, 496, 120,
- /* 240 */ 641, 174, 495, 494, 1871, 174, 486, 127, 493, 499,
- /* 250 */ 220, 1921, 228, 174, 492, 1705, 1713, 1343, 1344, 570,
- /* 260 */ 1394, 1395, 1397, 1398, 1399, 1400, 1401, 1402, 1403, 1404,
- /* 270 */ 600, 596, 1412, 1413, 1415, 1416, 1417, 1418, 1420, 1423,
- /* 280 */ 3, 44, 42, 698, 1807, 1890, 465, 1396, 366, 351,
- /* 290 */ 58, 1339, 81, 233, 174, 179, 1885, 275, 569, 1903,
- /* 300 */ 588, 11, 1419, 156, 1337, 532, 79, 313, 1666, 1582,
- /* 310 */ 540, 165, 538, 1366, 1581, 588, 688, 684, 680, 676,
- /* 320 */ 273, 174, 1881, 1887, 1765, 1414, 1765, 566, 1921, 132,
- /* 330 */ 17, 338, 516, 355, 2058, 598, 605, 1345, 44, 42,
- /* 340 */ 1763, 1871, 1763, 604, 132, 514, 351, 512, 1339, 2064,
- /* 350 */ 171, 1871, 1316, 1317, 2059, 577, 1871, 95, 1150, 1419,
- /* 360 */ 241, 1337, 385, 1, 606, 579, 121, 550, 1937, 2005,
- /* 370 */ 583, 174, 295, 350, 1904, 608, 1906, 1907, 603, 120,
- /* 380 */ 598, 130, 1414, 387, 383, 695, 491, 17, 265, 1998,
- /* 390 */ 587, 1152, 586, 547, 1345, 2058, 1713, 2002, 1515, 1421,
- /* 400 */ 1422, 571, 2058, 170, 1998, 1999, 1363, 2003, 167, 2063,
- /* 410 */ 575, 171, 62, 572, 567, 2059, 577, 575, 171, 490,
- /* 420 */ 1, 1752, 2059, 577, 110, 230, 633, 109, 108, 107,
- /* 430 */ 106, 105, 104, 103, 102, 101, 1562, 174, 2058, 498,
- /* 440 */ 497, 489, 695, 1310, 1340, 223, 1338, 1429, 563, 1513,
- /* 450 */ 1514, 1516, 1517, 1364, 2062, 267, 1421, 1422, 2059, 2061,
- /* 460 */ 119, 118, 117, 116, 115, 114, 113, 112, 111, 1343,
- /* 470 */ 1344, 595, 1394, 1395, 1397, 1398, 1399, 1400, 1401, 1402,
- /* 480 */ 1403, 1404, 600, 596, 1412, 1413, 1415, 1416, 1417, 1418,
- /* 490 */ 1420, 1423, 3, 1450, 11, 11, 1698, 9, 234, 235,
- /* 500 */ 453, 1340, 58, 1338, 1627, 1858, 1362, 1190, 630, 629,
- /* 510 */ 628, 1194, 627, 1196, 1197, 626, 1199, 623, 1689, 1205,
- /* 520 */ 620, 1207, 1208, 617, 614, 1486, 1343, 1344, 327, 1394,
- /* 530 */ 1395, 1397, 1398, 1399, 1400, 1401, 1402, 1403, 1404, 600,
- /* 540 */ 596, 1412, 1413, 1415, 1416, 1417, 1418, 1420, 1423, 3,
- /* 550 */ 44, 42, 373, 550, 1580, 2063, 313, 1579, 351, 540,
- /* 560 */ 1339, 538, 354, 447, 31, 176, 451, 502, 501, 500,
- /* 570 */ 154, 1419, 1578, 1337, 1455, 126, 496, 1667, 641, 1715,
- /* 580 */ 495, 494, 1713, 1903, 2058, 2005, 493, 499, 328, 584,
- /* 590 */ 326, 325, 492, 488, 1414, 1345, 1871, 490, 182, 1871,
- /* 600 */ 2062, 552, 1903, 1962, 2059, 2060, 1345, 44, 42, 1424,
- /* 610 */ 1440, 550, 1921, 2001, 1871, 351, 653, 1339, 588, 489,
- /* 620 */ 605, 550, 1700, 394, 1577, 1871, 357, 604, 1419, 1765,
- /* 630 */ 1337, 1921, 8, 395, 154, 74, 320, 1396, 73, 605,
- /* 640 */ 1713, 550, 1696, 1715, 1871, 1763, 604, 132, 1901, 174,
- /* 650 */ 1713, 1414, 1937, 405, 695, 390, 158, 1902, 1904, 608,
- /* 660 */ 1906, 1907, 603, 1345, 598, 1690, 1871, 1901, 1421, 1422,
- /* 670 */ 1713, 1937, 532, 550, 576, 97, 1902, 1904, 608, 1906,
- /* 680 */ 1907, 603, 2063, 598, 130, 419, 1367, 87, 2078, 8,
- /* 690 */ 1990, 666, 664, 455, 344, 1986, 451, 555, 2027, 1366,
- /* 700 */ 224, 2058, 1713, 2058, 2024, 599, 172, 1998, 1999, 1706,
- /* 710 */ 2003, 695, 554, 1340, 1962, 1338, 2064, 171, 575, 171,
- /* 720 */ 1576, 2059, 577, 2059, 577, 1421, 1422, 1573, 37, 36,
- /* 730 */ 13, 12, 43, 41, 40, 39, 38, 2005, 1343, 1344,
- /* 740 */ 1367, 1394, 1395, 1397, 1398, 1399, 1400, 1401, 1402, 1403,
- /* 750 */ 1404, 600, 596, 1412, 1413, 1415, 1416, 1417, 1418, 1420,
- /* 760 */ 1423, 3, 1871, 1485, 1813, 2000, 306, 1807, 550, 1871,
- /* 770 */ 1340, 639, 1338, 221, 1548, 1812, 1743, 306, 180, 174,
- /* 780 */ 420, 37, 36, 1364, 1572, 43, 41, 40, 39, 38,
- /* 790 */ 145, 144, 636, 635, 634, 1343, 1344, 1713, 1394, 1395,
- /* 800 */ 1397, 1398, 1399, 1400, 1401, 1402, 1403, 1404, 600, 596,
- /* 810 */ 1412, 1413, 1415, 1416, 1417, 1418, 1420, 1423, 3, 44,
- /* 820 */ 42, 536, 507, 1807, 1462, 639, 1871, 351, 243, 1339,
- /* 830 */ 1571, 1815, 580, 128, 184, 637, 1961, 517, 1756, 227,
- /* 840 */ 1419, 267, 1337, 32, 145, 144, 636, 635, 634, 37,
- /* 850 */ 36, 219, 1903, 43, 41, 40, 39, 38, 550, 404,
- /* 860 */ 1570, 550, 1569, 1414, 632, 510, 550, 1765, 1525, 504,
- /* 870 */ 463, 1903, 1871, 464, 218, 1345, 44, 42, 1710, 80,
- /* 880 */ 550, 1921, 244, 1764, 351, 638, 1339, 1713, 1756, 605,
- /* 890 */ 1713, 7, 137, 527, 1871, 1713, 604, 1419, 1794, 1337,
- /* 900 */ 1921, 8, 1871, 654, 1871, 1683, 550, 72, 605, 1713,
- /* 910 */ 550, 64, 1892, 1871, 63, 604, 280, 1901, 528, 1743,
- /* 920 */ 1414, 1937, 533, 695, 1903, 159, 1902, 1904, 608, 1906,
- /* 930 */ 1907, 603, 1345, 598, 1688, 1713, 1901, 1421, 1422, 1713,
- /* 940 */ 1937, 1568, 550, 1567, 97, 1902, 1904, 608, 1906, 1907,
- /* 950 */ 603, 1575, 598, 1921, 238, 1070, 1071, 2078, 1, 1990,
- /* 960 */ 1894, 605, 550, 344, 1986, 2063, 1871, 1396, 604, 2010,
- /* 970 */ 1482, 1713, 2030, 2052, 546, 550, 262, 578, 2079, 143,
- /* 980 */ 695, 564, 1340, 1871, 1338, 1871, 1348, 548, 483, 1901,
- /* 990 */ 1566, 1713, 1565, 1937, 1421, 1422, 397, 159, 1902, 1904,
- /* 1000 */ 608, 1906, 1907, 603, 1713, 598, 45, 1343, 1344, 398,
- /* 1010 */ 1394, 1395, 1397, 1398, 1399, 1400, 1401, 1402, 1403, 1404,
- /* 1020 */ 600, 596, 1412, 1413, 1415, 1416, 1417, 1418, 1420, 1423,
- /* 1030 */ 3, 51, 1871, 206, 1871, 48, 4, 50, 531, 1340,
- /* 1040 */ 639, 1338, 211, 13, 12, 209, 414, 161, 213, 581,
- /* 1050 */ 2080, 212, 482, 478, 474, 470, 205, 1548, 1287, 145,
- /* 1060 */ 144, 636, 635, 634, 1343, 1344, 1624, 1394, 1395, 1397,
- /* 1070 */ 1398, 1399, 1400, 1401, 1402, 1403, 1404, 600, 596, 1412,
- /* 1080 */ 1413, 1415, 1416, 1417, 1418, 1420, 1423, 3, 310, 550,
- /* 1090 */ 1362, 1614, 1482, 78, 256, 215, 203, 427, 214, 1922,
- /* 1100 */ 438, 549, 37, 36, 1609, 1607, 43, 41, 40, 39,
- /* 1110 */ 38, 217, 232, 503, 216, 93, 138, 411, 1713, 439,
- /* 1120 */ 1347, 413, 1557, 1558, 362, 90, 505, 508, 1351, 672,
- /* 1130 */ 671, 670, 669, 361, 1598, 668, 667, 133, 662, 661,
- /* 1140 */ 660, 659, 658, 657, 656, 655, 147, 651, 650, 649,
- /* 1150 */ 360, 359, 646, 645, 644, 643, 642, 155, 202, 196,
- /* 1160 */ 647, 201, 286, 323, 236, 461, 37, 36, 543, 2020,
- /* 1170 */ 43, 41, 40, 39, 38, 400, 284, 66, 1753, 142,
- /* 1180 */ 65, 194, 1130, 535, 37, 36, 143, 60, 43, 41,
- /* 1190 */ 40, 39, 38, 589, 248, 60, 190, 444, 442, 1903,
- /* 1200 */ 532, 26, 45, 437, 2, 648, 432, 431, 430, 429,
- /* 1210 */ 426, 425, 424, 423, 422, 418, 417, 416, 415, 324,
- /* 1220 */ 408, 407, 406, 264, 402, 401, 322, 1128, 1921, 2058,
- /* 1230 */ 45, 240, 1110, 58, 261, 367, 605, 316, 1183, 1512,
- /* 1240 */ 372, 1871, 5, 604, 2064, 171, 251, 1456, 1603, 2059,
- /* 1250 */ 577, 1303, 37, 36, 1405, 550, 43, 41, 40, 39,
- /* 1260 */ 38, 1555, 1350, 321, 1901, 1111, 612, 269, 1937, 142,
- /* 1270 */ 276, 96, 97, 1902, 1904, 608, 1906, 1907, 603, 1448,
- /* 1280 */ 598, 183, 279, 129, 1713, 141, 1961, 1990, 143, 399,
- /* 1290 */ 122, 344, 1986, 142, 37, 36, 690, 435, 43, 41,
- /* 1300 */ 40, 39, 38, 364, 1362, 363, 71, 70, 393, 37,
- /* 1310 */ 36, 178, 550, 43, 41, 40, 39, 38, 1211, 403,
- /* 1320 */ 532, 1215, 532, 409, 358, 421, 428, 1809, 434, 309,
- /* 1330 */ 440, 187, 381, 1449, 379, 375, 371, 368, 365, 1505,
- /* 1340 */ 1222, 1713, 1220, 436, 441, 146, 443, 445, 1368, 2058,
- /* 1350 */ 1903, 2058, 1370, 446, 454, 457, 193, 1554, 195, 458,
- /* 1360 */ 1369, 459, 1371, 462, 2064, 171, 2064, 171, 460, 2059,
- /* 1370 */ 577, 2059, 577, 198, 200, 466, 75, 76, 204, 1921,
- /* 1380 */ 174, 485, 487, 1703, 208, 1699, 210, 592, 148, 149,
- /* 1390 */ 99, 312, 1871, 1903, 604, 519, 521, 1701, 1697, 150,
- /* 1400 */ 151, 522, 222, 277, 33, 348, 1443, 1444, 1445, 1446,
- /* 1410 */ 1447, 1451, 1452, 1453, 1454, 1901, 1848, 526, 225, 1937,
- /* 1420 */ 523, 529, 1921, 97, 1902, 1904, 608, 1906, 1907, 603,
- /* 1430 */ 605, 598, 534, 333, 562, 1871, 168, 604, 1990, 229,
- /* 1440 */ 139, 544, 344, 1986, 537, 1847, 1819, 541, 153, 140,
- /* 1450 */ 545, 335, 84, 278, 1903, 86, 1714, 1367, 1901, 558,
- /* 1460 */ 565, 2012, 1937, 2017, 560, 6, 97, 1902, 1904, 608,
- /* 1470 */ 1906, 1907, 603, 2021, 598, 246, 1903, 561, 574, 2078,
- /* 1480 */ 340, 1990, 2031, 1921, 2036, 344, 1986, 2035, 250, 568,
- /* 1490 */ 559, 605, 255, 162, 257, 2009, 1871, 557, 604, 556,
- /* 1500 */ 260, 341, 258, 585, 259, 1921, 1482, 2057, 2081, 1366,
- /* 1510 */ 582, 131, 2006, 605, 57, 88, 610, 263, 1871, 1901,
- /* 1520 */ 604, 1971, 1684, 1937, 1757, 281, 520, 97, 1902, 1904,
- /* 1530 */ 608, 1906, 1907, 603, 1903, 598, 272, 691, 692, 694,
- /* 1540 */ 1965, 1901, 1990, 532, 49, 1937, 344, 1986, 305, 97,
- /* 1550 */ 1902, 1904, 608, 1906, 1907, 603, 293, 598, 1865, 304,
- /* 1560 */ 347, 346, 1963, 1921, 1990, 285, 303, 283, 344, 1986,
- /* 1570 */ 1353, 605, 2058, 1864, 68, 1863, 1871, 1862, 604, 69,
- /* 1580 */ 1859, 1419, 369, 1346, 370, 1331, 1332, 2064, 171, 177,
- /* 1590 */ 374, 1857, 2059, 577, 1903, 376, 377, 378, 1856, 1901,
- /* 1600 */ 380, 1339, 1855, 1937, 1414, 382, 1854, 97, 1902, 1904,
- /* 1610 */ 608, 1906, 1907, 603, 1337, 598, 1345, 384, 1853, 1306,
- /* 1620 */ 553, 386, 1990, 1921, 1305, 1830, 344, 1986, 1829, 391,
- /* 1630 */ 392, 605, 1828, 1827, 1275, 1802, 1871, 1801, 604, 1799,
- /* 1640 */ 1798, 134, 1797, 1800, 1796, 135, 1795, 1345, 1793, 1792,
- /* 1650 */ 1791, 181, 410, 1790, 412, 1903, 1789, 1788, 1787, 1901,
- /* 1660 */ 1786, 1785, 1784, 1937, 594, 1783, 1782, 98, 1902, 1904,
- /* 1670 */ 608, 1906, 1907, 603, 1781, 598, 1780, 1779, 1778, 1777,
- /* 1680 */ 1776, 1775, 1990, 136, 1921, 1774, 1989, 1986, 166, 334,
- /* 1690 */ 1773, 1772, 605, 1771, 1770, 695, 1769, 1871, 1768, 604,
- /* 1700 */ 1767, 1766, 1158, 1629, 1277, 1628, 1626, 188, 189, 1903,
- /* 1710 */ 1594, 191, 123, 1073, 1593, 192, 450, 452, 1072, 1843,
- /* 1720 */ 1901, 1837, 124, 1354, 1937, 1349, 1826, 1825, 302, 1902,
- /* 1730 */ 1904, 608, 1906, 1907, 603, 199, 598, 1811, 1921, 1692,
- /* 1740 */ 1625, 197, 1623, 467, 468, 1621, 605, 471, 1357, 1359,
- /* 1750 */ 469, 1871, 1903, 604, 1340, 473, 1338, 1103, 1619, 475,
- /* 1760 */ 472, 1617, 596, 1412, 1413, 1415, 1416, 1417, 1418, 476,
- /* 1770 */ 479, 477, 480, 481, 1901, 1606, 1903, 1605, 1937, 1343,
- /* 1780 */ 1344, 1921, 98, 1902, 1904, 608, 1906, 1907, 603, 602,
- /* 1790 */ 598, 1590, 1694, 1225, 1871, 59, 604, 1990, 1226, 1693,
- /* 1800 */ 1149, 593, 1986, 1148, 1147, 1921, 1140, 1146, 207, 1145,
- /* 1810 */ 663, 1142, 665, 605, 1141, 1139, 1615, 1901, 1871, 329,
- /* 1820 */ 604, 1937, 1610, 330, 1608, 301, 1902, 1904, 608, 1906,
- /* 1830 */ 1907, 603, 601, 598, 551, 1955, 506, 331, 1589, 509,
- /* 1840 */ 511, 1901, 1903, 1588, 513, 1937, 1587, 515, 100, 98,
- /* 1850 */ 1902, 1904, 608, 1906, 1907, 603, 25, 598, 1842, 1323,
- /* 1860 */ 1836, 1312, 1903, 524, 1990, 152, 1824, 1822, 226, 1987,
- /* 1870 */ 1823, 1921, 2063, 1821, 1820, 18, 539, 53, 231, 602,
- /* 1880 */ 525, 530, 332, 1321, 1871, 1320, 604, 1818, 237, 542,
- /* 1890 */ 82, 1921, 1810, 83, 239, 242, 85, 90, 19, 605,
- /* 1900 */ 20, 27, 56, 1527, 1871, 1903, 604, 1901, 1431, 15,
- /* 1910 */ 254, 1937, 10, 245, 249, 301, 1902, 1904, 608, 1906,
- /* 1920 */ 1907, 603, 247, 598, 1509, 1956, 1511, 1901, 160, 1903,
- /* 1930 */ 252, 1937, 1504, 28, 1921, 158, 1902, 1904, 608, 1906,
- /* 1940 */ 1907, 603, 605, 598, 253, 1892, 89, 1871, 1547, 604,
- /* 1950 */ 29, 1548, 1430, 61, 22, 1542, 1541, 342, 1921, 1546,
- /* 1960 */ 1545, 343, 266, 349, 1891, 163, 605, 1479, 21, 1355,
- /* 1970 */ 1901, 1871, 1478, 604, 1937, 16, 55, 2028, 297, 1902,
- /* 1980 */ 1904, 608, 1906, 1907, 603, 54, 598, 12, 1441, 1903,
- /* 1990 */ 1940, 164, 1409, 1407, 1901, 1406, 597, 35, 1937, 175,
- /* 2000 */ 14, 1387, 302, 1902, 1904, 608, 1906, 1907, 603, 1903,
- /* 2010 */ 598, 23, 607, 609, 1189, 611, 353, 24, 1921, 615,
- /* 2020 */ 631, 613, 573, 352, 1379, 1212, 605, 1209, 616, 618,
- /* 2030 */ 1206, 1871, 619, 604, 1200, 621, 622, 624, 1921, 1198,
- /* 2040 */ 625, 1221, 270, 91, 1217, 92, 605, 640, 67, 1204,
- /* 2050 */ 1101, 1871, 1903, 604, 1901, 1203, 1136, 1156, 1937, 1202,
- /* 2060 */ 1135, 1201, 302, 1902, 1904, 608, 1906, 1907, 603, 652,
- /* 2070 */ 598, 1903, 1134, 1133, 518, 1132, 1131, 1129, 1937, 1127,
- /* 2080 */ 1126, 1921, 295, 1902, 1904, 608, 1906, 1907, 603, 605,
- /* 2090 */ 598, 1125, 271, 1123, 1871, 1122, 604, 1121, 1120, 1119,
- /* 2100 */ 1921, 1118, 1117, 1116, 1153, 1151, 1113, 1112, 605, 1109,
- /* 2110 */ 1107, 1108, 1622, 1871, 1106, 604, 673, 1901, 1620, 675,
- /* 2120 */ 674, 1937, 677, 679, 1903, 287, 1902, 1904, 608, 1906,
- /* 2130 */ 1907, 603, 678, 598, 1618, 681, 1901, 682, 683, 1616,
- /* 2140 */ 1937, 685, 1903, 686, 288, 1902, 1904, 608, 1906, 1907,
- /* 2150 */ 603, 1604, 598, 1921, 687, 689, 1063, 1586, 274, 693,
- /* 2160 */ 1561, 605, 1341, 282, 696, 697, 1871, 1561, 604, 1561,
- /* 2170 */ 1561, 1921, 1561, 1561, 1561, 1561, 1561, 1561, 1561, 605,
- /* 2180 */ 1561, 1561, 1561, 1561, 1871, 1561, 604, 1561, 1561, 1901,
- /* 2190 */ 1561, 1561, 1561, 1937, 1561, 1561, 1561, 289, 1902, 1904,
- /* 2200 */ 608, 1906, 1907, 603, 1561, 598, 1903, 1901, 1561, 1561,
- /* 2210 */ 1561, 1937, 1561, 1561, 1561, 296, 1902, 1904, 608, 1906,
- /* 2220 */ 1907, 603, 1561, 598, 1561, 1561, 1903, 1561, 1561, 1561,
- /* 2230 */ 1561, 1561, 1561, 1561, 1561, 1921, 1561, 1561, 1561, 1561,
- /* 2240 */ 1561, 1561, 1561, 605, 1561, 1561, 1561, 1561, 1871, 1561,
- /* 2250 */ 604, 1561, 1561, 1561, 1561, 1921, 1561, 1561, 1561, 1561,
- /* 2260 */ 1561, 1561, 1561, 605, 1561, 1561, 1561, 1561, 1871, 1903,
- /* 2270 */ 604, 1901, 1561, 1561, 1561, 1937, 1561, 1561, 1561, 298,
- /* 2280 */ 1902, 1904, 608, 1906, 1907, 603, 1561, 598, 1903, 1561,
- /* 2290 */ 1561, 1901, 1561, 1561, 1561, 1937, 1561, 1561, 1921, 290,
- /* 2300 */ 1902, 1904, 608, 1906, 1907, 603, 605, 598, 1561, 1561,
- /* 2310 */ 1561, 1871, 1561, 604, 1561, 1561, 1561, 1921, 1561, 1561,
- /* 2320 */ 1561, 1561, 1561, 1561, 1561, 605, 1561, 1561, 1561, 1561,
- /* 2330 */ 1871, 1903, 604, 1561, 1901, 1561, 1561, 1561, 1937, 1561,
- /* 2340 */ 1561, 1561, 299, 1902, 1904, 608, 1906, 1907, 603, 1561,
- /* 2350 */ 598, 1561, 1561, 1901, 1561, 1903, 1561, 1937, 1561, 1561,
- /* 2360 */ 1921, 291, 1902, 1904, 608, 1906, 1907, 603, 605, 598,
- /* 2370 */ 1561, 1561, 1561, 1871, 1903, 604, 1561, 1561, 1561, 1561,
- /* 2380 */ 1561, 1561, 1561, 1561, 1921, 1561, 1561, 1561, 1561, 1561,
- /* 2390 */ 1561, 1561, 605, 1561, 1561, 1561, 1901, 1871, 1561, 604,
- /* 2400 */ 1937, 1561, 1561, 1921, 300, 1902, 1904, 608, 1906, 1907,
- /* 2410 */ 603, 605, 598, 1561, 1561, 1561, 1871, 1561, 604, 1561,
- /* 2420 */ 1901, 1561, 1561, 1561, 1937, 1561, 1561, 1561, 292, 1902,
- /* 2430 */ 1904, 608, 1906, 1907, 603, 1903, 598, 1561, 1561, 1901,
- /* 2440 */ 1561, 1561, 1561, 1937, 1561, 1561, 1561, 307, 1902, 1904,
- /* 2450 */ 608, 1906, 1907, 603, 1561, 598, 1561, 1561, 1561, 1561,
- /* 2460 */ 1561, 1561, 1561, 1561, 1921, 1561, 1561, 1561, 1561, 1561,
- /* 2470 */ 1561, 1561, 605, 1561, 1561, 1561, 1561, 1871, 1561, 604,
- /* 2480 */ 1561, 1561, 1561, 1561, 1561, 1561, 1561, 1561, 1903, 1561,
- /* 2490 */ 1561, 1561, 1561, 1561, 1561, 1561, 1561, 1561, 1561, 1561,
- /* 2500 */ 1901, 1561, 1561, 1561, 1937, 1561, 1903, 1561, 308, 1902,
- /* 2510 */ 1904, 608, 1906, 1907, 603, 1561, 598, 1921, 1561, 1561,
- /* 2520 */ 1561, 1561, 1561, 1561, 1561, 605, 1561, 1561, 1561, 1561,
- /* 2530 */ 1871, 1561, 604, 1561, 1561, 1921, 1561, 1561, 1561, 1561,
- /* 2540 */ 1561, 1561, 1561, 605, 1561, 1561, 1561, 1561, 1871, 1561,
- /* 2550 */ 604, 1561, 1561, 1901, 1561, 1561, 1561, 1937, 1561, 1561,
- /* 2560 */ 1561, 1915, 1902, 1904, 608, 1906, 1907, 603, 1561, 598,
- /* 2570 */ 1903, 1901, 1561, 1561, 1561, 1937, 1561, 1561, 1561, 1914,
- /* 2580 */ 1902, 1904, 608, 1906, 1907, 603, 1561, 598, 1561, 1561,
- /* 2590 */ 1903, 1561, 1561, 1561, 1561, 1561, 1561, 1561, 1561, 1921,
- /* 2600 */ 1561, 1561, 1561, 1561, 1561, 1561, 1561, 605, 1561, 1561,
- /* 2610 */ 1561, 1561, 1871, 1561, 604, 1561, 1561, 1561, 1561, 1921,
- /* 2620 */ 1561, 1561, 1561, 1561, 1561, 1561, 1561, 605, 1561, 1561,
- /* 2630 */ 1561, 1561, 1871, 1903, 604, 1901, 1561, 1561, 1561, 1937,
- /* 2640 */ 1561, 1561, 1561, 1913, 1902, 1904, 608, 1906, 1907, 603,
- /* 2650 */ 1561, 598, 1903, 1561, 1561, 1901, 1561, 1561, 1561, 1937,
- /* 2660 */ 1561, 1561, 1921, 317, 1902, 1904, 608, 1906, 1907, 603,
- /* 2670 */ 605, 598, 1561, 1561, 1561, 1871, 1561, 604, 1561, 1561,
- /* 2680 */ 1561, 1921, 1561, 1561, 1561, 1561, 1561, 1561, 1561, 605,
- /* 2690 */ 1561, 1561, 1561, 1561, 1871, 1903, 604, 1561, 1901, 1561,
- /* 2700 */ 1561, 1561, 1937, 1561, 1561, 1561, 318, 1902, 1904, 608,
- /* 2710 */ 1906, 1907, 603, 1561, 598, 1561, 1561, 1901, 1561, 1903,
- /* 2720 */ 1561, 1937, 1561, 1561, 1921, 314, 1902, 1904, 608, 1906,
- /* 2730 */ 1907, 603, 605, 598, 1561, 1561, 1561, 1871, 1561, 604,
- /* 2740 */ 1561, 1561, 1561, 1561, 1561, 1561, 1561, 1561, 1921, 1561,
- /* 2750 */ 1561, 1561, 1561, 1561, 1561, 1561, 605, 1561, 1561, 1561,
- /* 2760 */ 1901, 1871, 1561, 604, 1937, 1561, 1561, 1561, 319, 1902,
- /* 2770 */ 1904, 608, 1906, 1907, 603, 1561, 598, 1561, 1561, 1561,
- /* 2780 */ 1561, 1561, 1561, 1561, 1901, 1561, 1561, 1561, 1937, 1561,
- /* 2790 */ 1561, 1561, 294, 1902, 1904, 608, 1906, 1907, 603, 1561,
- /* 2800 */ 598,
+ /* 0 */ 450, 167, 451, 1602, 77, 458, 1711, 451, 1602, 538,
+ /* 10 */ 1824, 552, 44, 42, 1759, 339, 338, 1892, 1069, 1821,
+ /* 20 */ 353, 1568, 1344, 154, 120, 552, 1896, 1716, 593, 1897,
+ /* 30 */ 1910, 488, 1722, 1424, 156, 1342, 593, 1892, 52, 1673,
+ /* 40 */ 1892, 1720, 110, 1888, 1894, 109, 108, 107, 106, 105,
+ /* 50 */ 104, 103, 102, 101, 590, 1720, 600, 1419, 1073, 1074,
+ /* 60 */ 1928, 1370, 17, 1888, 1894, 341, 1888, 1894, 607, 1350,
+ /* 70 */ 44, 42, 1494, 1878, 449, 606, 600, 453, 353, 600,
+ /* 80 */ 1344, 467, 37, 36, 132, 1772, 43, 41, 40, 39,
+ /* 90 */ 38, 1424, 1910, 1342, 1372, 1, 608, 157, 552, 1579,
+ /* 100 */ 1944, 1771, 1896, 46, 98, 352, 1911, 610, 1913, 1914,
+ /* 110 */ 605, 176, 600, 1892, 58, 1419, 552, 697, 1910, 1997,
+ /* 120 */ 17, 130, 1928, 317, 1993, 398, 1698, 1350, 1720, 120,
+ /* 130 */ 607, 1426, 1427, 635, 2065, 1878, 493, 606, 47, 1888,
+ /* 140 */ 1894, 347, 592, 169, 2005, 2006, 1720, 2010, 1928, 577,
+ /* 150 */ 171, 455, 600, 1, 2066, 579, 607, 1367, 1908, 77,
+ /* 160 */ 1590, 1878, 1944, 606, 313, 329, 97, 1909, 1911, 610,
+ /* 170 */ 1913, 1914, 605, 125, 600, 697, 1345, 129, 1343, 141,
+ /* 180 */ 1968, 1997, 1715, 1928, 1908, 346, 1993, 467, 1944, 1426,
+ /* 190 */ 1427, 572, 159, 1909, 1911, 610, 1913, 1914, 605, 435,
+ /* 200 */ 600, 1348, 1349, 1878, 1399, 1400, 1402, 1403, 1404, 1405,
+ /* 210 */ 1406, 1407, 1408, 1409, 602, 598, 1417, 1418, 1420, 1421,
+ /* 220 */ 1422, 1423, 1425, 1428, 3, 1565, 330, 1369, 328, 327,
+ /* 230 */ 571, 490, 222, 573, 1345, 492, 1343, 246, 457, 236,
+ /* 240 */ 237, 453, 174, 110, 580, 2086, 109, 108, 107, 106,
+ /* 250 */ 105, 104, 103, 102, 101, 186, 185, 491, 182, 1348,
+ /* 260 */ 1349, 174, 1399, 1400, 1402, 1403, 1404, 1405, 1406, 1407,
+ /* 270 */ 1408, 1409, 602, 598, 1417, 1418, 1420, 1421, 1422, 1423,
+ /* 280 */ 1425, 1428, 3, 44, 42, 174, 368, 1371, 79, 315,
+ /* 290 */ 643, 353, 542, 1344, 540, 74, 1696, 315, 73, 593,
+ /* 300 */ 542, 1910, 540, 534, 1424, 2070, 1342, 1195, 632, 631,
+ /* 310 */ 630, 1199, 629, 1201, 1202, 628, 1204, 625, 230, 1210,
+ /* 320 */ 622, 1212, 1213, 619, 616, 11, 358, 9, 1419, 1765,
+ /* 330 */ 1767, 1928, 2065, 17, 2065, 2012, 62, 1498, 87, 607,
+ /* 340 */ 1350, 44, 42, 1369, 1878, 1865, 606, 2071, 171, 353,
+ /* 350 */ 2069, 1344, 2066, 579, 2066, 2068, 58, 643, 81, 700,
+ /* 360 */ 1713, 58, 1424, 2009, 1342, 1520, 1, 608, 387, 7,
+ /* 370 */ 1086, 1944, 1085, 277, 46, 297, 352, 1911, 610, 1913,
+ /* 380 */ 1914, 605, 1567, 600, 1368, 207, 1419, 165, 697, 389,
+ /* 390 */ 385, 17, 375, 690, 686, 682, 678, 275, 1350, 1491,
+ /* 400 */ 1087, 1155, 1426, 1427, 11, 2065, 119, 118, 117, 116,
+ /* 410 */ 115, 114, 113, 112, 111, 565, 1518, 1519, 1521, 1522,
+ /* 420 */ 577, 171, 1772, 1350, 1, 2066, 579, 58, 1589, 322,
+ /* 430 */ 269, 504, 503, 502, 95, 1157, 1434, 243, 1770, 126,
+ /* 440 */ 498, 391, 1369, 390, 497, 496, 697, 1345, 655, 1343,
+ /* 450 */ 495, 501, 392, 1697, 1369, 1370, 494, 1814, 37, 36,
+ /* 460 */ 1426, 1427, 43, 41, 40, 39, 38, 578, 179, 534,
+ /* 470 */ 549, 1878, 1348, 1349, 1709, 1399, 1400, 1402, 1403, 1404,
+ /* 480 */ 1405, 1406, 1407, 1408, 1409, 602, 598, 1417, 1418, 1420,
+ /* 490 */ 1421, 1422, 1423, 1425, 1428, 3, 2065, 11, 2065, 1772,
+ /* 500 */ 34, 270, 232, 174, 1705, 1345, 340, 1343, 174, 1707,
+ /* 510 */ 94, 577, 171, 2071, 171, 1770, 2066, 579, 2066, 579,
+ /* 520 */ 1315, 174, 225, 229, 127, 1766, 1767, 1910, 1401, 58,
+ /* 530 */ 1348, 1349, 1712, 1399, 1400, 1402, 1403, 1404, 1405, 1406,
+ /* 540 */ 1407, 1408, 1409, 602, 598, 1417, 1418, 1420, 1421, 1422,
+ /* 550 */ 1423, 1425, 1428, 3, 44, 42, 2070, 1928, 500, 499,
+ /* 560 */ 641, 356, 353, 80, 1344, 607, 1237, 1238, 568, 154,
+ /* 570 */ 1878, 1487, 606, 1371, 174, 1424, 1814, 1342, 1722, 145,
+ /* 580 */ 144, 638, 637, 636, 37, 36, 1910, 180, 43, 41,
+ /* 590 */ 40, 39, 38, 1908, 554, 552, 1969, 1944, 1086, 1419,
+ /* 600 */ 1085, 158, 1909, 1911, 610, 1913, 1914, 605, 396, 600,
+ /* 610 */ 1772, 1350, 44, 42, 1429, 1455, 1928, 357, 1560, 518,
+ /* 620 */ 353, 336, 1344, 552, 607, 1720, 1770, 1401, 1087, 1878,
+ /* 630 */ 1703, 606, 516, 1424, 514, 1342, 397, 8, 1490, 235,
+ /* 640 */ 37, 36, 557, 2034, 43, 41, 40, 39, 38, 1553,
+ /* 650 */ 359, 226, 1908, 1720, 574, 569, 1944, 1419, 154, 697,
+ /* 660 */ 304, 1909, 1911, 610, 1913, 1914, 605, 1722, 600, 1350,
+ /* 670 */ 349, 348, 1530, 1426, 1427, 1344, 174, 37, 36, 552,
+ /* 680 */ 1358, 43, 41, 40, 39, 38, 31, 223, 1342, 552,
+ /* 690 */ 1750, 1424, 407, 1351, 30, 8, 1460, 2012, 1321, 1322,
+ /* 700 */ 37, 36, 421, 538, 43, 41, 40, 39, 38, 1720,
+ /* 710 */ 2012, 552, 26, 1822, 1559, 1419, 269, 697, 1345, 1720,
+ /* 720 */ 1343, 2069, 1350, 32, 422, 2008, 399, 1350, 1510, 37,
+ /* 730 */ 36, 1426, 1427, 43, 41, 40, 39, 38, 2007, 400,
+ /* 740 */ 2070, 1720, 128, 1348, 1349, 1968, 1399, 1400, 1402, 1403,
+ /* 750 */ 1404, 1405, 1406, 1407, 1408, 1409, 602, 598, 1417, 1418,
+ /* 760 */ 1420, 1421, 1422, 1423, 1425, 1428, 3, 13, 12, 2065,
+ /* 770 */ 697, 40, 39, 38, 601, 596, 1345, 641, 1343, 43,
+ /* 780 */ 41, 40, 39, 38, 174, 2069, 634, 37, 36, 2066,
+ /* 790 */ 2067, 43, 41, 40, 39, 38, 145, 144, 638, 637,
+ /* 800 */ 636, 1348, 1349, 143, 1399, 1400, 1402, 1403, 1404, 1405,
+ /* 810 */ 1406, 1407, 1408, 1409, 602, 598, 1417, 1418, 1420, 1421,
+ /* 820 */ 1422, 1423, 1425, 1428, 3, 44, 42, 492, 552, 1345,
+ /* 830 */ 1820, 1343, 308, 353, 1359, 1344, 1354, 585, 556, 552,
+ /* 840 */ 1969, 465, 668, 666, 529, 1588, 1424, 1587, 1342, 491,
+ /* 850 */ 552, 537, 466, 1814, 1348, 1349, 51, 1910, 1720, 1362,
+ /* 860 */ 1364, 1369, 1467, 1717, 184, 1073, 1074, 1586, 534, 1720,
+ /* 870 */ 1419, 1585, 1674, 598, 1417, 1418, 1420, 1421, 1422, 1423,
+ /* 880 */ 1720, 552, 1350, 44, 42, 552, 552, 1928, 1878, 1580,
+ /* 890 */ 1878, 353, 366, 1344, 137, 607, 1634, 2065, 530, 535,
+ /* 900 */ 1878, 656, 606, 1690, 1424, 1584, 1342, 406, 8, 534,
+ /* 910 */ 1878, 1720, 2071, 171, 1878, 1720, 1720, 2066, 579, 1621,
+ /* 920 */ 1819, 1583, 308, 1908, 1582, 2017, 1487, 1944, 1419, 1581,
+ /* 930 */ 697, 98, 1909, 1911, 610, 1913, 1914, 605, 2065, 600,
+ /* 940 */ 1350, 505, 153, 1578, 1426, 1427, 1997, 1577, 1878, 1614,
+ /* 950 */ 1996, 1993, 552, 2071, 171, 72, 1576, 552, 2066, 579,
+ /* 960 */ 504, 503, 502, 45, 1878, 240, 1, 1878, 126, 498,
+ /* 970 */ 360, 507, 1878, 497, 496, 639, 2037, 581, 1763, 495,
+ /* 980 */ 501, 206, 1720, 1372, 208, 494, 1878, 1720, 697, 1345,
+ /* 990 */ 1878, 1343, 365, 1695, 522, 582, 1575, 264, 161, 1878,
+ /* 1000 */ 1574, 1573, 1426, 1427, 484, 480, 476, 472, 205, 534,
+ /* 1010 */ 640, 534, 234, 1763, 1348, 1349, 1292, 1399, 1400, 1402,
+ /* 1020 */ 1403, 1404, 1405, 1406, 1407, 1408, 1409, 602, 598, 1417,
+ /* 1030 */ 1418, 1420, 1421, 1422, 1423, 1425, 1428, 3, 2065, 1878,
+ /* 1040 */ 2065, 154, 566, 1878, 1878, 78, 1401, 1345, 203, 1343,
+ /* 1050 */ 1723, 48, 4, 2071, 171, 2071, 171, 586, 2066, 579,
+ /* 1060 */ 2066, 579, 37, 36, 1572, 238, 43, 41, 40, 39,
+ /* 1070 */ 38, 1571, 1348, 1349, 1631, 1399, 1400, 1402, 1403, 1404,
+ /* 1080 */ 1405, 1406, 1407, 1408, 1409, 602, 598, 1417, 1418, 1420,
+ /* 1090 */ 1421, 1422, 1423, 1425, 1428, 3, 312, 1801, 1367, 282,
+ /* 1100 */ 641, 590, 1750, 50, 533, 429, 590, 1878, 440, 213,
+ /* 1110 */ 202, 196, 211, 201, 1878, 215, 138, 463, 214, 145,
+ /* 1120 */ 144, 638, 637, 636, 1570, 413, 245, 441, 142, 217,
+ /* 1130 */ 415, 132, 216, 194, 219, 143, 132, 218, 674, 673,
+ /* 1140 */ 672, 671, 363, 258, 670, 669, 133, 664, 663, 662,
+ /* 1150 */ 661, 660, 659, 658, 657, 147, 653, 652, 651, 362,
+ /* 1160 */ 361, 648, 647, 646, 645, 644, 155, 1878, 130, 545,
+ /* 1170 */ 552, 288, 325, 130, 597, 1562, 1563, 13, 12, 60,
+ /* 1180 */ 1353, 242, 2070, 548, 402, 286, 66, 1612, 1188, 65,
+ /* 1190 */ 170, 2005, 2006, 1608, 2010, 172, 2005, 2006, 250, 2010,
+ /* 1200 */ 1720, 60, 1929, 45, 364, 45, 190, 446, 444, 510,
+ /* 1210 */ 614, 142, 439, 583, 1910, 434, 433, 432, 431, 428,
+ /* 1220 */ 427, 426, 425, 424, 420, 419, 418, 417, 326, 410,
+ /* 1230 */ 409, 408, 1517, 404, 403, 324, 1352, 1603, 1899, 1760,
+ /* 1240 */ 552, 692, 552, 58, 1928, 143, 416, 552, 2027, 122,
+ /* 1250 */ 591, 253, 594, 550, 1461, 551, 1410, 1878, 281, 606,
+ /* 1260 */ 271, 37, 36, 1216, 1220, 43, 41, 40, 39, 38,
+ /* 1270 */ 1720, 509, 1720, 93, 266, 1553, 590, 1720, 263, 2,
+ /* 1280 */ 1908, 96, 578, 90, 1944, 5, 519, 1901, 97, 1909,
+ /* 1290 */ 1911, 610, 1913, 1914, 605, 1115, 600, 142, 1227, 369,
+ /* 1300 */ 221, 168, 1225, 1997, 374, 323, 132, 346, 1993, 1308,
+ /* 1310 */ 278, 2065, 649, 1445, 512, 318, 71, 70, 395, 506,
+ /* 1320 */ 173, 178, 183, 1356, 220, 1910, 577, 171, 2023, 1116,
+ /* 1330 */ 650, 2066, 579, 401, 1135, 437, 405, 411, 1367, 311,
+ /* 1340 */ 430, 423, 383, 121, 381, 377, 373, 370, 367, 1816,
+ /* 1350 */ 146, 1910, 1133, 436, 438, 1928, 442, 1453, 443, 1373,
+ /* 1360 */ 448, 64, 187, 594, 63, 267, 2005, 589, 1878, 588,
+ /* 1370 */ 606, 456, 2065, 445, 1375, 447, 459, 193, 1374, 1355,
+ /* 1380 */ 460, 1928, 1376, 195, 461, 462, 198, 577, 171, 607,
+ /* 1390 */ 174, 1908, 2066, 579, 1878, 1944, 606, 464, 200, 97,
+ /* 1400 */ 1909, 1911, 610, 1913, 1914, 605, 75, 600, 1089, 468,
+ /* 1410 */ 76, 1454, 168, 485, 1997, 204, 486, 1908, 346, 1993,
+ /* 1420 */ 487, 1944, 489, 99, 1710, 97, 1909, 1911, 610, 1913,
+ /* 1430 */ 1914, 605, 314, 600, 210, 1706, 521, 523, 2085, 2024,
+ /* 1440 */ 1997, 212, 148, 149, 346, 1993, 1708, 1704, 279, 224,
+ /* 1450 */ 150, 151, 1855, 524, 2031, 528, 227, 531, 536, 231,
+ /* 1460 */ 564, 525, 546, 1910, 84, 335, 539, 1854, 1826, 543,
+ /* 1470 */ 280, 337, 86, 1721, 1372, 139, 560, 567, 2043, 562,
+ /* 1480 */ 140, 2042, 33, 350, 1448, 1449, 1450, 1451, 1452, 1456,
+ /* 1490 */ 1457, 1458, 1459, 1928, 547, 248, 6, 563, 342, 252,
+ /* 1500 */ 2019, 607, 2028, 570, 2038, 576, 1878, 561, 606, 559,
+ /* 1510 */ 558, 257, 343, 587, 2064, 2088, 584, 1487, 1371, 262,
+ /* 1520 */ 57, 131, 88, 1691, 2013, 612, 283, 274, 1764, 1908,
+ /* 1530 */ 1910, 693, 694, 1944, 696, 49, 295, 97, 1909, 1911,
+ /* 1540 */ 610, 1913, 1914, 605, 307, 600, 306, 162, 259, 260,
+ /* 1550 */ 2085, 1978, 1997, 285, 261, 305, 346, 1993, 287, 1872,
+ /* 1560 */ 1928, 1871, 265, 68, 1870, 1869, 2059, 69, 607, 371,
+ /* 1570 */ 372, 1336, 1337, 1878, 1866, 606, 177, 376, 1864, 378,
+ /* 1580 */ 379, 380, 1863, 382, 1910, 1862, 384, 1861, 386, 1860,
+ /* 1590 */ 388, 1311, 1310, 1837, 1836, 393, 1908, 394, 1835, 1834,
+ /* 1600 */ 1944, 1809, 1280, 1808, 97, 1909, 1911, 610, 1913, 1914,
+ /* 1610 */ 605, 1806, 600, 134, 1928, 1805, 1804, 2085, 1807, 1997,
+ /* 1620 */ 181, 135, 607, 346, 1993, 1803, 1802, 1878, 1800, 606,
+ /* 1630 */ 1799, 1798, 412, 2016, 1797, 414, 1796, 1795, 1910, 1794,
+ /* 1640 */ 1793, 1792, 1791, 1790, 1789, 1788, 1787, 1786, 1785, 1784,
+ /* 1650 */ 1908, 1783, 1782, 1781, 1944, 136, 1780, 1779, 97, 1909,
+ /* 1660 */ 1911, 610, 1913, 1914, 605, 1778, 600, 1777, 1928, 1776,
+ /* 1670 */ 1775, 1972, 1282, 1997, 188, 1635, 607, 346, 1993, 1774,
+ /* 1680 */ 1773, 1878, 1636, 606, 189, 1633, 1599, 1076, 1598, 1163,
+ /* 1690 */ 1075, 1910, 1108, 199, 1832, 1818, 1699, 191, 123, 1850,
+ /* 1700 */ 1844, 166, 192, 124, 1908, 1833, 452, 454, 1944, 1632,
+ /* 1710 */ 197, 1630, 97, 1909, 1911, 610, 1913, 1914, 605, 469,
+ /* 1720 */ 600, 1928, 471, 1628, 470, 1970, 473, 1997, 474, 607,
+ /* 1730 */ 1626, 346, 1993, 1624, 1878, 1611, 606, 475, 477, 481,
+ /* 1740 */ 478, 479, 1610, 1595, 1910, 483, 1701, 1231, 482, 1230,
+ /* 1750 */ 1700, 1154, 1153, 1152, 1151, 1150, 665, 1908, 667, 1147,
+ /* 1760 */ 1146, 1944, 1145, 1144, 1622, 97, 1909, 1911, 610, 1913,
+ /* 1770 */ 1914, 605, 59, 600, 1928, 331, 1615, 332, 555, 1613,
+ /* 1780 */ 1997, 508, 607, 333, 346, 1993, 511, 1878, 1594, 606,
+ /* 1790 */ 1593, 209, 513, 515, 1592, 517, 1849, 100, 53, 1843,
+ /* 1800 */ 1317, 152, 526, 1328, 1831, 1910, 1829, 1830, 2070, 25,
+ /* 1810 */ 1908, 1828, 1827, 18, 1944, 1825, 1326, 233, 98, 1909,
+ /* 1820 */ 1911, 610, 1913, 1914, 605, 1817, 600, 1325, 532, 1910,
+ /* 1830 */ 83, 239, 228, 1997, 82, 1928, 85, 595, 1993, 90,
+ /* 1840 */ 19, 527, 15, 604, 244, 20, 241, 27, 1878, 1436,
+ /* 1850 */ 606, 56, 1532, 334, 541, 247, 255, 1435, 544, 1928,
+ /* 1860 */ 10, 29, 249, 1514, 251, 256, 1516, 607, 1509, 160,
+ /* 1870 */ 1899, 1908, 1878, 254, 606, 1944, 61, 28, 89, 303,
+ /* 1880 */ 1909, 1911, 610, 1913, 1914, 605, 603, 600, 553, 1962,
+ /* 1890 */ 22, 1910, 1547, 1546, 344, 1908, 1552, 1553, 1551, 1944,
+ /* 1900 */ 1550, 345, 268, 98, 1909, 1911, 610, 1913, 1914, 605,
+ /* 1910 */ 1484, 600, 1483, 55, 1898, 163, 12, 1360, 1997, 1414,
+ /* 1920 */ 164, 1928, 1947, 1994, 599, 175, 35, 1446, 1412, 604,
+ /* 1930 */ 1411, 14, 23, 1392, 1878, 1384, 606, 24, 613, 611,
+ /* 1940 */ 609, 1217, 1910, 355, 615, 617, 1214, 618, 620, 1211,
+ /* 1950 */ 621, 623, 626, 1194, 21, 624, 16, 1908, 1205, 1209,
+ /* 1960 */ 1203, 1944, 54, 1208, 1226, 303, 1909, 1911, 610, 1913,
+ /* 1970 */ 1914, 605, 1928, 600, 1222, 1963, 272, 627, 91, 633,
+ /* 1980 */ 607, 92, 67, 1106, 642, 1878, 1207, 606, 1141, 1140,
+ /* 1990 */ 1206, 1139, 1138, 1137, 1136, 1134, 1910, 1132, 1131, 1130,
+ /* 2000 */ 1128, 1161, 1127, 1126, 654, 1125, 1124, 1123, 1908, 273,
+ /* 2010 */ 1122, 1121, 1944, 1158, 1910, 1156, 158, 1909, 1911, 610,
+ /* 2020 */ 1913, 1914, 605, 1118, 600, 1117, 1928, 1114, 1113, 1112,
+ /* 2030 */ 1111, 1629, 675, 677, 607, 1627, 676, 679, 680, 1878,
+ /* 2040 */ 681, 606, 1625, 683, 1928, 684, 1623, 687, 685, 689,
+ /* 2050 */ 688, 1609, 607, 691, 1066, 1591, 276, 1878, 2035, 606,
+ /* 2060 */ 695, 1566, 1908, 1346, 699, 284, 1944, 1566, 698, 1566,
+ /* 2070 */ 299, 1909, 1911, 610, 1913, 1914, 605, 1566, 600, 1566,
+ /* 2080 */ 1908, 1566, 1566, 1566, 1944, 1566, 1566, 1566, 159, 1909,
+ /* 2090 */ 1911, 610, 1913, 1914, 605, 1566, 600, 1910, 1566, 1566,
+ /* 2100 */ 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1566,
+ /* 2110 */ 1566, 1566, 1566, 1566, 575, 1566, 1566, 1566, 1566, 1566,
+ /* 2120 */ 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1928, 1566, 1566,
+ /* 2130 */ 1566, 1566, 351, 1566, 1566, 607, 1566, 1566, 1566, 1566,
+ /* 2140 */ 1878, 2087, 606, 1566, 1566, 1566, 1566, 1566, 1566, 1566,
+ /* 2150 */ 1566, 1566, 1910, 1566, 1566, 1566, 1566, 1566, 1566, 1566,
+ /* 2160 */ 1566, 1566, 1566, 1908, 1566, 1566, 1566, 1944, 1566, 1566,
+ /* 2170 */ 1566, 304, 1909, 1911, 610, 1913, 1914, 605, 1566, 600,
+ /* 2180 */ 1566, 1566, 1928, 1566, 1566, 1566, 1566, 354, 1566, 1566,
+ /* 2190 */ 607, 1566, 1566, 1566, 1566, 1878, 1566, 606, 1566, 1566,
+ /* 2200 */ 1566, 1566, 1566, 1910, 1566, 1566, 1566, 1566, 1566, 1566,
+ /* 2210 */ 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1908, 1566,
+ /* 2220 */ 1566, 1566, 1944, 1566, 1566, 1566, 304, 1909, 1911, 610,
+ /* 2230 */ 1913, 1914, 605, 1928, 600, 1566, 1566, 1566, 1566, 1566,
+ /* 2240 */ 1566, 607, 1566, 1566, 1566, 1566, 1878, 1566, 606, 1566,
+ /* 2250 */ 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1910, 1566, 1566,
+ /* 2260 */ 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1566, 520,
+ /* 2270 */ 1566, 1566, 1566, 1944, 1566, 1566, 1566, 297, 1909, 1911,
+ /* 2280 */ 610, 1913, 1914, 605, 1566, 600, 1566, 1928, 1566, 1566,
+ /* 2290 */ 1566, 1566, 1566, 1566, 1566, 607, 1566, 1566, 1566, 1566,
+ /* 2300 */ 1878, 1566, 606, 1566, 1566, 1566, 1566, 1566, 1910, 1566,
+ /* 2310 */ 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1566,
+ /* 2320 */ 1566, 1566, 1566, 1908, 1566, 1566, 1566, 1944, 1566, 1566,
+ /* 2330 */ 1566, 289, 1909, 1911, 610, 1913, 1914, 605, 1928, 600,
+ /* 2340 */ 1566, 1566, 1566, 1566, 1566, 1566, 607, 1566, 1566, 1566,
+ /* 2350 */ 1566, 1878, 1566, 606, 1566, 1566, 1566, 1566, 1566, 1566,
+ /* 2360 */ 1566, 1566, 1910, 1566, 1566, 1566, 1566, 1566, 1566, 1566,
+ /* 2370 */ 1566, 1566, 1566, 1566, 1908, 1566, 1566, 1566, 1944, 1566,
+ /* 2380 */ 1910, 1566, 290, 1909, 1911, 610, 1913, 1914, 605, 1566,
+ /* 2390 */ 600, 1566, 1928, 1566, 1566, 1566, 1566, 1566, 1566, 1566,
+ /* 2400 */ 607, 1566, 1566, 1566, 1566, 1878, 1566, 606, 1566, 1566,
+ /* 2410 */ 1928, 1566, 1566, 1566, 1566, 1566, 1566, 1566, 607, 1566,
+ /* 2420 */ 1566, 1566, 1566, 1878, 1566, 606, 1566, 1566, 1908, 1566,
+ /* 2430 */ 1566, 1566, 1944, 1566, 1566, 1566, 291, 1909, 1911, 610,
+ /* 2440 */ 1913, 1914, 605, 1566, 600, 1566, 1908, 1566, 1566, 1566,
+ /* 2450 */ 1944, 1566, 1566, 1566, 298, 1909, 1911, 610, 1913, 1914,
+ /* 2460 */ 605, 1566, 600, 1910, 1566, 1566, 1566, 1566, 1566, 1566,
+ /* 2470 */ 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1566,
+ /* 2480 */ 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1566,
+ /* 2490 */ 1566, 1566, 1566, 1928, 1566, 1566, 1566, 1566, 1566, 1566,
+ /* 2500 */ 1566, 607, 1566, 1566, 1566, 1566, 1878, 1566, 606, 1566,
+ /* 2510 */ 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1910, 1566,
+ /* 2520 */ 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1908,
+ /* 2530 */ 1566, 1566, 1566, 1944, 1566, 1566, 1566, 300, 1909, 1911,
+ /* 2540 */ 610, 1913, 1914, 605, 1566, 600, 1566, 1566, 1928, 1566,
+ /* 2550 */ 1566, 1566, 1566, 1566, 1566, 1566, 607, 1566, 1566, 1566,
+ /* 2560 */ 1566, 1878, 1566, 606, 1566, 1566, 1566, 1566, 1566, 1910,
+ /* 2570 */ 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1566,
+ /* 2580 */ 1566, 1566, 1566, 1566, 1908, 1566, 1566, 1566, 1944, 1566,
+ /* 2590 */ 1566, 1566, 292, 1909, 1911, 610, 1913, 1914, 605, 1928,
+ /* 2600 */ 600, 1566, 1566, 1566, 1566, 1566, 1566, 607, 1566, 1566,
+ /* 2610 */ 1566, 1566, 1878, 1566, 606, 1566, 1566, 1566, 1566, 1566,
+ /* 2620 */ 1566, 1566, 1566, 1910, 1566, 1566, 1566, 1566, 1566, 1566,
+ /* 2630 */ 1566, 1566, 1566, 1566, 1566, 1908, 1566, 1566, 1566, 1944,
+ /* 2640 */ 1566, 1566, 1566, 301, 1909, 1911, 610, 1913, 1914, 605,
+ /* 2650 */ 1566, 600, 1566, 1928, 1566, 1566, 1566, 1566, 1566, 1566,
+ /* 2660 */ 1566, 607, 1566, 1566, 1566, 1566, 1878, 1566, 606, 1566,
+ /* 2670 */ 1566, 1566, 1566, 1566, 1910, 1566, 1566, 1566, 1566, 1566,
+ /* 2680 */ 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1908,
+ /* 2690 */ 1566, 1566, 1566, 1944, 1566, 1566, 1566, 293, 1909, 1911,
+ /* 2700 */ 610, 1913, 1914, 605, 1928, 600, 1566, 1566, 1566, 1566,
+ /* 2710 */ 1566, 1566, 607, 1566, 1566, 1566, 1566, 1878, 1566, 606,
+ /* 2720 */ 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1910, 1566,
+ /* 2730 */ 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1566,
+ /* 2740 */ 1908, 1566, 1566, 1566, 1944, 1566, 1910, 1566, 302, 1909,
+ /* 2750 */ 1911, 610, 1913, 1914, 605, 1566, 600, 1566, 1928, 1566,
+ /* 2760 */ 1566, 1566, 1566, 1566, 1566, 1566, 607, 1566, 1566, 1566,
+ /* 2770 */ 1566, 1878, 1566, 606, 1566, 1566, 1928, 1566, 1566, 1566,
+ /* 2780 */ 1566, 1566, 1566, 1566, 607, 1566, 1566, 1566, 1566, 1878,
+ /* 2790 */ 1566, 606, 1566, 1566, 1908, 1566, 1566, 1566, 1944, 1566,
+ /* 2800 */ 1566, 1566, 294, 1909, 1911, 610, 1913, 1914, 605, 1566,
+ /* 2810 */ 600, 1566, 1908, 1566, 1566, 1566, 1944, 1566, 1566, 1566,
+ /* 2820 */ 309, 1909, 1911, 610, 1913, 1914, 605, 1566, 600, 1910,
+ /* 2830 */ 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1566,
+ /* 2840 */ 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1566,
+ /* 2850 */ 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1928,
+ /* 2860 */ 1566, 1566, 1566, 1566, 1566, 1566, 1566, 607, 1566, 1566,
+ /* 2870 */ 1566, 1566, 1878, 1566, 606, 1566, 1566, 1566, 1566, 1566,
+ /* 2880 */ 1566, 1566, 1566, 1566, 1910, 1566, 1566, 1566, 1566, 1566,
+ /* 2890 */ 1566, 1566, 1566, 1566, 1566, 1908, 1566, 1566, 1566, 1944,
+ /* 2900 */ 1566, 1566, 1566, 310, 1909, 1911, 610, 1913, 1914, 605,
+ /* 2910 */ 1566, 600, 1566, 1566, 1928, 1566, 1566, 1566, 1566, 1566,
+ /* 2920 */ 1566, 1566, 607, 1566, 1566, 1566, 1566, 1878, 1566, 606,
+ /* 2930 */ 1566, 1566, 1566, 1566, 1566, 1910, 1566, 1566, 1566, 1566,
+ /* 2940 */ 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1566,
+ /* 2950 */ 1908, 1566, 1566, 1566, 1944, 1566, 1566, 1566, 1922, 1909,
+ /* 2960 */ 1911, 610, 1913, 1914, 605, 1928, 600, 1566, 1566, 1566,
+ /* 2970 */ 1566, 1566, 1566, 607, 1566, 1566, 1566, 1566, 1878, 1566,
+ /* 2980 */ 606, 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1910,
+ /* 2990 */ 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1566,
+ /* 3000 */ 1566, 1908, 1566, 1566, 1566, 1944, 1566, 1566, 1566, 1921,
+ /* 3010 */ 1909, 1911, 610, 1913, 1914, 605, 1566, 600, 1566, 1928,
+ /* 3020 */ 1566, 1566, 1566, 1566, 1566, 1566, 1566, 607, 1566, 1566,
+ /* 3030 */ 1566, 1566, 1878, 1566, 606, 1566, 1566, 1566, 1566, 1566,
+ /* 3040 */ 1910, 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1566,
+ /* 3050 */ 1566, 1566, 1566, 1566, 1566, 1908, 1566, 1566, 1566, 1944,
+ /* 3060 */ 1566, 1566, 1566, 1920, 1909, 1911, 610, 1913, 1914, 605,
+ /* 3070 */ 1928, 600, 1566, 1566, 1566, 1566, 1566, 1566, 607, 1566,
+ /* 3080 */ 1566, 1566, 1566, 1878, 1566, 606, 1566, 1566, 1566, 1566,
+ /* 3090 */ 1566, 1566, 1566, 1566, 1910, 1566, 1566, 1566, 1566, 1566,
+ /* 3100 */ 1566, 1566, 1566, 1566, 1566, 1566, 1908, 1566, 1566, 1566,
+ /* 3110 */ 1944, 1566, 1910, 1566, 319, 1909, 1911, 610, 1913, 1914,
+ /* 3120 */ 605, 1566, 600, 1566, 1928, 1566, 1566, 1566, 1566, 1566,
+ /* 3130 */ 1566, 1566, 607, 1566, 1566, 1566, 1566, 1878, 1566, 606,
+ /* 3140 */ 1566, 1566, 1928, 1566, 1566, 1566, 1566, 1566, 1566, 1566,
+ /* 3150 */ 607, 1566, 1566, 1566, 1566, 1878, 1566, 606, 1566, 1566,
+ /* 3160 */ 1908, 1566, 1566, 1566, 1944, 1566, 1566, 1566, 320, 1909,
+ /* 3170 */ 1911, 610, 1913, 1914, 605, 1566, 600, 1566, 1908, 1566,
+ /* 3180 */ 1566, 1566, 1944, 1566, 1566, 1566, 316, 1909, 1911, 610,
+ /* 3190 */ 1913, 1914, 605, 1566, 600, 1910, 1566, 1566, 1566, 1566,
+ /* 3200 */ 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1566,
+ /* 3210 */ 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1566,
+ /* 3220 */ 1566, 1566, 1566, 1566, 1566, 1928, 1566, 1566, 1566, 1566,
+ /* 3230 */ 1566, 1566, 1566, 607, 1566, 1566, 1566, 1566, 1878, 1566,
+ /* 3240 */ 606, 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1566,
+ /* 3250 */ 1910, 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1566,
+ /* 3260 */ 1566, 1908, 1566, 1566, 1566, 1944, 1566, 1566, 1566, 321,
+ /* 3270 */ 1909, 1911, 610, 1913, 1914, 605, 1566, 600, 1566, 1566,
+ /* 3280 */ 1928, 1566, 1566, 1566, 1566, 1566, 1566, 1566, 607, 1566,
+ /* 3290 */ 1566, 1566, 1566, 1878, 1566, 606, 1566, 1566, 1566, 1566,
+ /* 3300 */ 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1566,
+ /* 3310 */ 1566, 1566, 1566, 1566, 1566, 1566, 1908, 1566, 1566, 1566,
+ /* 3320 */ 1944, 1566, 1566, 1566, 296, 1909, 1911, 610, 1913, 1914,
+ /* 3330 */ 605, 1566, 600,
};
static const YYCODETYPE yy_lookahead[] = {
- /* 0 */ 352, 410, 411, 352, 351, 4, 325, 321, 327, 328,
- /* 10 */ 352, 363, 12, 13, 363, 325, 329, 327, 328, 0,
- /* 20 */ 20, 363, 22, 12, 13, 14, 15, 16, 20, 14,
- /* 30 */ 15, 16, 20, 33, 350, 35, 350, 389, 390, 391,
- /* 40 */ 389, 390, 391, 359, 358, 44, 45, 389, 390, 363,
- /* 50 */ 402, 365, 2, 402, 367, 320, 56, 322, 8, 9,
- /* 60 */ 402, 61, 12, 13, 14, 15, 16, 321, 68, 12,
- /* 70 */ 13, 14, 386, 20, 364, 365, 390, 20, 395, 22,
- /* 80 */ 394, 395, 396, 397, 398, 399, 400, 20, 402, 22,
- /* 90 */ 33, 333, 35, 407, 94, 409, 350, 14, 94, 413,
- /* 100 */ 414, 333, 35, 20, 358, 329, 94, 424, 20, 363,
- /* 110 */ 3, 365, 426, 56, 356, 347, 116, 50, 61, 365,
- /* 120 */ 434, 329, 439, 440, 356, 68, 372, 444, 445, 375,
- /* 130 */ 130, 131, 386, 341, 358, 20, 390, 0, 130, 131,
- /* 140 */ 394, 395, 396, 397, 398, 399, 400, 94, 402, 361,
- /* 150 */ 358, 94, 364, 365, 20, 409, 22, 321, 21, 413,
- /* 160 */ 414, 24, 25, 26, 27, 28, 29, 30, 31, 32,
- /* 170 */ 424, 395, 60, 116, 94, 175, 20, 177, 174, 78,
- /* 180 */ 176, 342, 94, 321, 50, 439, 440, 130, 131, 350,
- /* 190 */ 444, 445, 416, 417, 418, 419, 20, 421, 359, 363,
- /* 200 */ 200, 201, 321, 203, 204, 205, 206, 207, 208, 209,
+ /* 0 */ 326, 351, 328, 329, 335, 326, 354, 328, 329, 367,
+ /* 10 */ 0, 330, 12, 13, 364, 344, 374, 365, 4, 377,
+ /* 20 */ 20, 0, 22, 352, 343, 330, 354, 358, 20, 354,
+ /* 30 */ 322, 350, 361, 33, 336, 35, 20, 365, 343, 341,
+ /* 40 */ 365, 360, 21, 391, 392, 24, 25, 26, 27, 28,
+ /* 50 */ 29, 30, 31, 32, 330, 360, 404, 57, 44, 45,
+ /* 60 */ 352, 20, 62, 391, 392, 393, 391, 392, 360, 69,
+ /* 70 */ 12, 13, 14, 365, 327, 367, 404, 330, 20, 404,
+ /* 80 */ 22, 61, 8, 9, 360, 352, 12, 13, 14, 15,
+ /* 90 */ 16, 33, 322, 35, 20, 95, 388, 321, 330, 323,
+ /* 100 */ 392, 368, 354, 95, 396, 397, 398, 399, 400, 401,
+ /* 110 */ 402, 343, 404, 365, 95, 57, 330, 117, 322, 411,
+ /* 120 */ 62, 397, 352, 415, 416, 330, 0, 69, 360, 343,
+ /* 130 */ 360, 131, 132, 106, 426, 365, 350, 367, 95, 391,
+ /* 140 */ 392, 393, 418, 419, 420, 421, 360, 423, 352, 441,
+ /* 150 */ 442, 14, 404, 95, 446, 447, 360, 20, 388, 335,
+ /* 160 */ 322, 365, 392, 367, 369, 37, 396, 397, 398, 399,
+ /* 170 */ 400, 401, 402, 349, 404, 117, 176, 407, 178, 409,
+ /* 180 */ 410, 411, 358, 352, 388, 415, 416, 61, 392, 131,
+ /* 190 */ 132, 360, 396, 397, 398, 399, 400, 401, 402, 79,
+ /* 200 */ 404, 201, 202, 365, 204, 205, 206, 207, 208, 209,
/* 210 */ 210, 211, 212, 213, 214, 215, 216, 217, 218, 219,
- /* 220 */ 220, 221, 222, 223, 94, 363, 0, 329, 318, 63,
- /* 230 */ 64, 65, 175, 331, 177, 134, 135, 71, 72, 341,
- /* 240 */ 60, 241, 76, 77, 363, 241, 348, 345, 82, 83,
- /* 250 */ 126, 350, 56, 241, 88, 353, 358, 200, 201, 358,
- /* 260 */ 203, 204, 205, 206, 207, 208, 209, 210, 211, 212,
- /* 270 */ 213, 214, 215, 216, 217, 218, 219, 220, 221, 222,
- /* 280 */ 223, 12, 13, 19, 358, 352, 60, 204, 378, 20,
- /* 290 */ 94, 22, 96, 125, 241, 369, 363, 33, 397, 321,
- /* 300 */ 329, 225, 33, 334, 35, 395, 182, 183, 339, 321,
- /* 310 */ 186, 47, 188, 20, 321, 329, 52, 53, 54, 55,
- /* 320 */ 56, 241, 389, 390, 350, 56, 350, 160, 350, 358,
- /* 330 */ 61, 357, 21, 357, 424, 402, 358, 68, 12, 13,
- /* 340 */ 366, 363, 366, 365, 358, 34, 20, 36, 22, 439,
- /* 350 */ 440, 363, 184, 185, 444, 445, 363, 93, 35, 33,
- /* 360 */ 96, 35, 170, 94, 386, 258, 395, 329, 390, 392,
- /* 370 */ 43, 241, 394, 395, 396, 397, 398, 399, 400, 341,
- /* 380 */ 402, 395, 56, 191, 192, 116, 348, 61, 417, 418,
- /* 390 */ 419, 68, 421, 129, 68, 424, 358, 420, 200, 130,
- /* 400 */ 131, 20, 424, 417, 418, 419, 20, 421, 349, 395,
- /* 410 */ 439, 440, 4, 246, 247, 444, 445, 439, 440, 106,
- /* 420 */ 94, 362, 444, 445, 21, 161, 105, 24, 25, 26,
- /* 430 */ 27, 28, 29, 30, 31, 32, 0, 241, 424, 336,
- /* 440 */ 337, 128, 116, 179, 175, 181, 177, 14, 250, 251,
- /* 450 */ 252, 253, 254, 20, 440, 162, 130, 131, 444, 445,
- /* 460 */ 24, 25, 26, 27, 28, 29, 30, 31, 32, 200,
- /* 470 */ 201, 61, 203, 204, 205, 206, 207, 208, 209, 210,
- /* 480 */ 211, 212, 213, 214, 215, 216, 217, 218, 219, 220,
- /* 490 */ 221, 222, 223, 157, 225, 225, 351, 227, 125, 126,
- /* 500 */ 14, 175, 94, 177, 0, 0, 20, 107, 108, 109,
- /* 510 */ 110, 111, 112, 113, 114, 115, 116, 117, 0, 119,
- /* 520 */ 120, 121, 122, 123, 124, 4, 200, 201, 37, 203,
- /* 530 */ 204, 205, 206, 207, 208, 209, 210, 211, 212, 213,
- /* 540 */ 214, 215, 216, 217, 218, 219, 220, 221, 222, 223,
- /* 550 */ 12, 13, 47, 329, 321, 395, 183, 321, 20, 186,
- /* 560 */ 22, 188, 342, 326, 228, 341, 329, 63, 64, 65,
- /* 570 */ 350, 33, 321, 35, 238, 71, 72, 339, 60, 359,
- /* 580 */ 76, 77, 358, 321, 424, 392, 82, 83, 97, 262,
- /* 590 */ 99, 100, 88, 102, 56, 68, 363, 106, 56, 363,
- /* 600 */ 440, 406, 321, 408, 444, 445, 68, 12, 13, 14,
- /* 610 */ 200, 329, 350, 420, 363, 20, 68, 22, 329, 128,
- /* 620 */ 358, 329, 351, 341, 321, 363, 342, 365, 33, 350,
- /* 630 */ 35, 350, 94, 341, 350, 93, 357, 204, 96, 358,
- /* 640 */ 358, 329, 351, 359, 363, 366, 365, 358, 386, 241,
- /* 650 */ 358, 56, 390, 341, 116, 378, 394, 395, 396, 397,
- /* 660 */ 398, 399, 400, 68, 402, 0, 363, 386, 130, 131,
- /* 670 */ 358, 390, 395, 329, 395, 394, 395, 396, 397, 398,
- /* 680 */ 399, 400, 3, 402, 395, 341, 20, 331, 407, 94,
- /* 690 */ 409, 336, 337, 326, 413, 414, 329, 435, 436, 20,
- /* 700 */ 351, 424, 358, 424, 423, 351, 417, 418, 419, 353,
- /* 710 */ 421, 116, 406, 175, 408, 177, 439, 440, 439, 440,
- /* 720 */ 321, 444, 445, 444, 445, 130, 131, 321, 8, 9,
- /* 730 */ 1, 2, 12, 13, 14, 15, 16, 392, 200, 201,
- /* 740 */ 20, 203, 204, 205, 206, 207, 208, 209, 210, 211,
- /* 750 */ 212, 213, 214, 215, 216, 217, 218, 219, 220, 221,
- /* 760 */ 222, 223, 363, 242, 374, 420, 376, 358, 329, 363,
- /* 770 */ 175, 106, 177, 343, 95, 374, 346, 376, 369, 241,
- /* 780 */ 341, 8, 9, 20, 321, 12, 13, 14, 15, 16,
- /* 790 */ 125, 126, 127, 128, 129, 200, 201, 358, 203, 204,
- /* 800 */ 205, 206, 207, 208, 209, 210, 211, 212, 213, 214,
- /* 810 */ 215, 216, 217, 218, 219, 220, 221, 222, 223, 12,
- /* 820 */ 13, 365, 4, 358, 95, 106, 363, 20, 162, 22,
- /* 830 */ 321, 375, 43, 405, 369, 360, 408, 19, 363, 56,
- /* 840 */ 33, 162, 35, 2, 125, 126, 127, 128, 129, 8,
- /* 850 */ 9, 33, 321, 12, 13, 14, 15, 16, 329, 105,
- /* 860 */ 321, 329, 321, 56, 351, 47, 329, 350, 95, 51,
- /* 870 */ 341, 321, 363, 341, 56, 68, 12, 13, 341, 96,
- /* 880 */ 329, 350, 162, 366, 20, 360, 22, 358, 363, 358,
- /* 890 */ 358, 39, 341, 382, 363, 358, 365, 33, 0, 35,
- /* 900 */ 350, 94, 363, 338, 363, 340, 329, 153, 358, 358,
- /* 910 */ 329, 93, 46, 363, 96, 365, 343, 386, 341, 346,
- /* 920 */ 56, 390, 341, 116, 321, 394, 395, 396, 397, 398,
- /* 930 */ 399, 400, 68, 402, 0, 358, 386, 130, 131, 358,
- /* 940 */ 390, 321, 329, 321, 394, 395, 396, 397, 398, 399,
- /* 950 */ 400, 322, 402, 350, 341, 44, 45, 407, 94, 409,
- /* 960 */ 94, 358, 329, 413, 414, 3, 363, 204, 365, 239,
- /* 970 */ 240, 358, 393, 423, 341, 329, 448, 446, 447, 43,
- /* 980 */ 116, 437, 175, 363, 177, 363, 35, 341, 330, 386,
- /* 990 */ 321, 358, 321, 390, 130, 131, 22, 394, 395, 396,
- /* 1000 */ 397, 398, 399, 400, 358, 402, 43, 200, 201, 35,
- /* 1010 */ 203, 204, 205, 206, 207, 208, 209, 210, 211, 212,
- /* 1020 */ 213, 214, 215, 216, 217, 218, 219, 220, 221, 222,
- /* 1030 */ 223, 95, 363, 33, 363, 42, 43, 162, 163, 175,
- /* 1040 */ 106, 177, 98, 1, 2, 101, 148, 47, 98, 260,
- /* 1050 */ 447, 101, 52, 53, 54, 55, 56, 95, 95, 125,
- /* 1060 */ 126, 127, 128, 129, 200, 201, 0, 203, 204, 205,
- /* 1070 */ 206, 207, 208, 209, 210, 211, 212, 213, 214, 215,
- /* 1080 */ 216, 217, 218, 219, 220, 221, 222, 223, 18, 329,
- /* 1090 */ 20, 0, 240, 93, 431, 98, 96, 27, 101, 350,
- /* 1100 */ 30, 341, 8, 9, 0, 0, 12, 13, 14, 15,
- /* 1110 */ 16, 98, 43, 22, 101, 94, 43, 47, 358, 49,
- /* 1120 */ 35, 51, 130, 131, 330, 104, 22, 22, 177, 63,
- /* 1130 */ 64, 65, 66, 67, 328, 69, 70, 71, 72, 73,
- /* 1140 */ 74, 75, 76, 77, 78, 79, 80, 81, 82, 83,
- /* 1150 */ 84, 85, 86, 87, 88, 89, 90, 18, 158, 159,
- /* 1160 */ 13, 161, 23, 93, 95, 165, 8, 9, 95, 393,
- /* 1170 */ 12, 13, 14, 15, 16, 105, 37, 38, 362, 43,
- /* 1180 */ 41, 181, 35, 378, 8, 9, 43, 43, 12, 13,
- /* 1190 */ 14, 15, 16, 422, 43, 43, 57, 58, 59, 321,
- /* 1200 */ 395, 43, 43, 133, 425, 13, 136, 137, 138, 139,
- /* 1210 */ 140, 141, 142, 143, 144, 145, 146, 147, 148, 149,
- /* 1220 */ 150, 151, 152, 441, 154, 155, 156, 35, 350, 424,
- /* 1230 */ 43, 95, 35, 94, 415, 388, 358, 61, 95, 95,
- /* 1240 */ 47, 363, 243, 365, 439, 440, 95, 95, 0, 444,
- /* 1250 */ 445, 173, 8, 9, 95, 329, 12, 13, 14, 15,
- /* 1260 */ 16, 167, 177, 387, 386, 68, 43, 341, 390, 43,
- /* 1270 */ 380, 132, 394, 395, 396, 397, 398, 399, 400, 103,
- /* 1280 */ 402, 42, 95, 405, 358, 407, 408, 409, 43, 370,
- /* 1290 */ 43, 413, 414, 43, 8, 9, 48, 157, 12, 13,
- /* 1300 */ 14, 15, 16, 378, 20, 378, 167, 168, 169, 8,
- /* 1310 */ 9, 172, 329, 12, 13, 14, 15, 16, 95, 370,
- /* 1320 */ 395, 95, 395, 368, 341, 329, 370, 329, 368, 190,
- /* 1330 */ 92, 329, 193, 157, 195, 196, 197, 198, 199, 95,
- /* 1340 */ 95, 358, 95, 368, 335, 95, 329, 329, 20, 424,
- /* 1350 */ 321, 424, 20, 323, 323, 384, 333, 263, 333, 365,
- /* 1360 */ 20, 377, 20, 377, 439, 440, 439, 440, 379, 444,
- /* 1370 */ 445, 444, 445, 333, 333, 329, 333, 333, 333, 350,
- /* 1380 */ 241, 323, 350, 350, 350, 350, 350, 358, 350, 350,
- /* 1390 */ 329, 323, 363, 321, 365, 189, 385, 350, 350, 350,
- /* 1400 */ 350, 180, 331, 384, 228, 229, 230, 231, 232, 233,
- /* 1410 */ 234, 235, 236, 237, 238, 386, 363, 365, 331, 390,
- /* 1420 */ 383, 329, 350, 394, 395, 396, 397, 398, 399, 400,
- /* 1430 */ 358, 402, 329, 377, 248, 363, 407, 365, 409, 331,
- /* 1440 */ 373, 159, 413, 414, 363, 363, 363, 363, 162, 373,
- /* 1450 */ 371, 363, 331, 346, 321, 331, 358, 20, 386, 363,
- /* 1460 */ 249, 433, 390, 434, 363, 255, 394, 395, 396, 397,
- /* 1470 */ 398, 399, 400, 393, 402, 373, 321, 363, 166, 407,
- /* 1480 */ 363, 409, 393, 350, 430, 413, 414, 430, 373, 363,
- /* 1490 */ 257, 358, 432, 430, 429, 423, 363, 256, 365, 244,
- /* 1500 */ 388, 264, 428, 261, 427, 350, 240, 443, 449, 20,
- /* 1510 */ 259, 358, 392, 358, 94, 94, 354, 442, 363, 386,
- /* 1520 */ 365, 412, 340, 390, 363, 329, 378, 394, 395, 396,
- /* 1530 */ 397, 398, 399, 400, 321, 402, 331, 36, 324, 323,
- /* 1540 */ 407, 386, 409, 395, 381, 390, 413, 414, 376, 394,
- /* 1550 */ 395, 396, 397, 398, 399, 400, 344, 402, 0, 344,
- /* 1560 */ 12, 13, 407, 350, 409, 319, 344, 332, 413, 414,
- /* 1570 */ 22, 358, 424, 0, 182, 0, 363, 0, 365, 42,
- /* 1580 */ 0, 33, 35, 35, 194, 35, 35, 439, 440, 35,
- /* 1590 */ 194, 0, 444, 445, 321, 35, 35, 194, 0, 386,
- /* 1600 */ 194, 22, 0, 390, 56, 35, 0, 394, 395, 396,
- /* 1610 */ 397, 398, 399, 400, 35, 402, 68, 22, 0, 177,
- /* 1620 */ 407, 35, 409, 350, 175, 0, 413, 414, 0, 171,
- /* 1630 */ 170, 358, 0, 0, 46, 0, 363, 0, 365, 0,
- /* 1640 */ 0, 42, 0, 0, 0, 42, 0, 68, 0, 0,
- /* 1650 */ 0, 148, 35, 0, 148, 321, 0, 0, 0, 386,
- /* 1660 */ 0, 0, 0, 390, 116, 0, 0, 394, 395, 396,
- /* 1670 */ 397, 398, 399, 400, 0, 402, 0, 0, 0, 0,
- /* 1680 */ 0, 0, 409, 42, 350, 0, 413, 414, 43, 355,
- /* 1690 */ 0, 0, 358, 0, 0, 116, 0, 363, 0, 365,
- /* 1700 */ 0, 0, 35, 0, 22, 0, 0, 56, 56, 321,
- /* 1710 */ 0, 42, 39, 14, 0, 40, 46, 46, 14, 0,
- /* 1720 */ 386, 0, 39, 175, 390, 177, 0, 0, 394, 395,
- /* 1730 */ 396, 397, 398, 399, 400, 166, 402, 0, 350, 0,
- /* 1740 */ 0, 39, 0, 35, 47, 0, 358, 35, 200, 201,
- /* 1750 */ 39, 363, 321, 365, 175, 39, 177, 62, 0, 35,
- /* 1760 */ 47, 0, 214, 215, 216, 217, 218, 219, 220, 47,
- /* 1770 */ 35, 39, 47, 39, 386, 0, 321, 0, 390, 200,
- /* 1780 */ 201, 350, 394, 395, 396, 397, 398, 399, 400, 358,
- /* 1790 */ 402, 0, 0, 22, 363, 103, 365, 409, 35, 0,
- /* 1800 */ 35, 413, 414, 35, 22, 350, 22, 35, 101, 35,
- /* 1810 */ 43, 35, 43, 358, 35, 35, 0, 386, 363, 22,
- /* 1820 */ 365, 390, 0, 22, 0, 394, 395, 396, 397, 398,
- /* 1830 */ 399, 400, 401, 402, 403, 404, 49, 22, 0, 35,
- /* 1840 */ 35, 386, 321, 0, 35, 390, 0, 22, 20, 394,
- /* 1850 */ 395, 396, 397, 398, 399, 400, 94, 402, 0, 95,
- /* 1860 */ 0, 35, 321, 22, 409, 178, 0, 0, 159, 414,
- /* 1870 */ 0, 350, 3, 0, 0, 94, 187, 162, 95, 358,
- /* 1880 */ 162, 164, 162, 35, 363, 35, 365, 0, 94, 160,
- /* 1890 */ 94, 350, 0, 39, 158, 46, 94, 104, 43, 358,
- /* 1900 */ 43, 94, 43, 95, 363, 321, 365, 386, 224, 245,
- /* 1910 */ 46, 390, 226, 94, 94, 394, 395, 396, 397, 398,
- /* 1920 */ 399, 400, 95, 402, 95, 404, 95, 386, 94, 321,
- /* 1930 */ 94, 390, 95, 94, 350, 394, 395, 396, 397, 398,
- /* 1940 */ 399, 400, 358, 402, 43, 46, 94, 363, 95, 365,
- /* 1950 */ 43, 95, 224, 3, 43, 35, 35, 35, 350, 35,
- /* 1960 */ 35, 35, 46, 355, 46, 46, 358, 95, 245, 22,
- /* 1970 */ 386, 363, 95, 365, 390, 245, 43, 436, 394, 395,
- /* 1980 */ 396, 397, 398, 399, 400, 239, 402, 2, 200, 321,
- /* 1990 */ 94, 46, 95, 95, 386, 95, 94, 94, 390, 46,
- /* 2000 */ 94, 22, 394, 395, 396, 397, 398, 399, 400, 321,
- /* 2010 */ 402, 94, 202, 105, 22, 35, 35, 94, 350, 35,
- /* 2020 */ 106, 94, 438, 355, 95, 95, 358, 95, 94, 35,
- /* 2030 */ 95, 363, 94, 365, 95, 35, 94, 35, 350, 95,
- /* 2040 */ 94, 35, 43, 94, 22, 94, 358, 61, 94, 118,
- /* 2050 */ 62, 363, 321, 365, 386, 118, 35, 68, 390, 118,
- /* 2060 */ 35, 118, 394, 395, 396, 397, 398, 399, 400, 91,
- /* 2070 */ 402, 321, 35, 35, 386, 35, 35, 35, 390, 35,
- /* 2080 */ 35, 350, 394, 395, 396, 397, 398, 399, 400, 358,
- /* 2090 */ 402, 35, 43, 35, 363, 35, 365, 22, 35, 22,
- /* 2100 */ 350, 35, 35, 35, 68, 35, 35, 35, 358, 35,
- /* 2110 */ 22, 35, 0, 363, 35, 365, 35, 386, 0, 39,
- /* 2120 */ 47, 390, 35, 39, 321, 394, 395, 396, 397, 398,
- /* 2130 */ 399, 400, 47, 402, 0, 35, 386, 47, 39, 0,
- /* 2140 */ 390, 35, 321, 47, 394, 395, 396, 397, 398, 399,
- /* 2150 */ 400, 0, 402, 350, 39, 35, 35, 0, 22, 21,
- /* 2160 */ 450, 358, 22, 22, 21, 20, 363, 450, 365, 450,
- /* 2170 */ 450, 350, 450, 450, 450, 450, 450, 450, 450, 358,
- /* 2180 */ 450, 450, 450, 450, 363, 450, 365, 450, 450, 386,
- /* 2190 */ 450, 450, 450, 390, 450, 450, 450, 394, 395, 396,
- /* 2200 */ 397, 398, 399, 400, 450, 402, 321, 386, 450, 450,
- /* 2210 */ 450, 390, 450, 450, 450, 394, 395, 396, 397, 398,
- /* 2220 */ 399, 400, 450, 402, 450, 450, 321, 450, 450, 450,
- /* 2230 */ 450, 450, 450, 450, 450, 350, 450, 450, 450, 450,
- /* 2240 */ 450, 450, 450, 358, 450, 450, 450, 450, 363, 450,
- /* 2250 */ 365, 450, 450, 450, 450, 350, 450, 450, 450, 450,
- /* 2260 */ 450, 450, 450, 358, 450, 450, 450, 450, 363, 321,
- /* 2270 */ 365, 386, 450, 450, 450, 390, 450, 450, 450, 394,
- /* 2280 */ 395, 396, 397, 398, 399, 400, 450, 402, 321, 450,
- /* 2290 */ 450, 386, 450, 450, 450, 390, 450, 450, 350, 394,
- /* 2300 */ 395, 396, 397, 398, 399, 400, 358, 402, 450, 450,
- /* 2310 */ 450, 363, 450, 365, 450, 450, 450, 350, 450, 450,
- /* 2320 */ 450, 450, 450, 450, 450, 358, 450, 450, 450, 450,
- /* 2330 */ 363, 321, 365, 450, 386, 450, 450, 450, 390, 450,
- /* 2340 */ 450, 450, 394, 395, 396, 397, 398, 399, 400, 450,
- /* 2350 */ 402, 450, 450, 386, 450, 321, 450, 390, 450, 450,
- /* 2360 */ 350, 394, 395, 396, 397, 398, 399, 400, 358, 402,
- /* 2370 */ 450, 450, 450, 363, 321, 365, 450, 450, 450, 450,
- /* 2380 */ 450, 450, 450, 450, 350, 450, 450, 450, 450, 450,
- /* 2390 */ 450, 450, 358, 450, 450, 450, 386, 363, 450, 365,
- /* 2400 */ 390, 450, 450, 350, 394, 395, 396, 397, 398, 399,
- /* 2410 */ 400, 358, 402, 450, 450, 450, 363, 450, 365, 450,
- /* 2420 */ 386, 450, 450, 450, 390, 450, 450, 450, 394, 395,
- /* 2430 */ 396, 397, 398, 399, 400, 321, 402, 450, 450, 386,
- /* 2440 */ 450, 450, 450, 390, 450, 450, 450, 394, 395, 396,
- /* 2450 */ 397, 398, 399, 400, 450, 402, 450, 450, 450, 450,
- /* 2460 */ 450, 450, 450, 450, 350, 450, 450, 450, 450, 450,
- /* 2470 */ 450, 450, 358, 450, 450, 450, 450, 363, 450, 365,
- /* 2480 */ 450, 450, 450, 450, 450, 450, 450, 450, 321, 450,
- /* 2490 */ 450, 450, 450, 450, 450, 450, 450, 450, 450, 450,
- /* 2500 */ 386, 450, 450, 450, 390, 450, 321, 450, 394, 395,
- /* 2510 */ 396, 397, 398, 399, 400, 450, 402, 350, 450, 450,
- /* 2520 */ 450, 450, 450, 450, 450, 358, 450, 450, 450, 450,
- /* 2530 */ 363, 450, 365, 450, 450, 350, 450, 450, 450, 450,
- /* 2540 */ 450, 450, 450, 358, 450, 450, 450, 450, 363, 450,
- /* 2550 */ 365, 450, 450, 386, 450, 450, 450, 390, 450, 450,
- /* 2560 */ 450, 394, 395, 396, 397, 398, 399, 400, 450, 402,
- /* 2570 */ 321, 386, 450, 450, 450, 390, 450, 450, 450, 394,
- /* 2580 */ 395, 396, 397, 398, 399, 400, 450, 402, 450, 450,
- /* 2590 */ 321, 450, 450, 450, 450, 450, 450, 450, 450, 350,
- /* 2600 */ 450, 450, 450, 450, 450, 450, 450, 358, 450, 450,
- /* 2610 */ 450, 450, 363, 450, 365, 450, 450, 450, 450, 350,
- /* 2620 */ 450, 450, 450, 450, 450, 450, 450, 358, 450, 450,
- /* 2630 */ 450, 450, 363, 321, 365, 386, 450, 450, 450, 390,
- /* 2640 */ 450, 450, 450, 394, 395, 396, 397, 398, 399, 400,
- /* 2650 */ 450, 402, 321, 450, 450, 386, 450, 450, 450, 390,
- /* 2660 */ 450, 450, 350, 394, 395, 396, 397, 398, 399, 400,
- /* 2670 */ 358, 402, 450, 450, 450, 363, 450, 365, 450, 450,
- /* 2680 */ 450, 350, 450, 450, 450, 450, 450, 450, 450, 358,
- /* 2690 */ 450, 450, 450, 450, 363, 321, 365, 450, 386, 450,
- /* 2700 */ 450, 450, 390, 450, 450, 450, 394, 395, 396, 397,
- /* 2710 */ 398, 399, 400, 450, 402, 450, 450, 386, 450, 321,
- /* 2720 */ 450, 390, 450, 450, 350, 394, 395, 396, 397, 398,
- /* 2730 */ 399, 400, 358, 402, 450, 450, 450, 363, 450, 365,
- /* 2740 */ 450, 450, 450, 450, 450, 450, 450, 450, 350, 450,
- /* 2750 */ 450, 450, 450, 450, 450, 450, 358, 450, 450, 450,
- /* 2760 */ 386, 363, 450, 365, 390, 450, 450, 450, 394, 395,
- /* 2770 */ 396, 397, 398, 399, 400, 450, 402, 450, 450, 450,
- /* 2780 */ 450, 450, 450, 450, 386, 450, 450, 450, 390, 450,
- /* 2790 */ 450, 450, 394, 395, 396, 397, 398, 399, 400, 450,
- /* 2800 */ 402,
+ /* 220 */ 220, 221, 222, 223, 224, 319, 98, 20, 100, 101,
+ /* 230 */ 399, 103, 127, 20, 176, 107, 178, 163, 327, 126,
+ /* 240 */ 127, 330, 242, 21, 448, 449, 24, 25, 26, 27,
+ /* 250 */ 28, 29, 30, 31, 32, 135, 136, 129, 57, 201,
+ /* 260 */ 202, 242, 204, 205, 206, 207, 208, 209, 210, 211,
+ /* 270 */ 212, 213, 214, 215, 216, 217, 218, 219, 220, 221,
+ /* 280 */ 222, 223, 224, 12, 13, 242, 380, 20, 183, 184,
+ /* 290 */ 61, 20, 187, 22, 189, 94, 0, 184, 97, 20,
+ /* 300 */ 187, 322, 189, 397, 33, 397, 35, 108, 109, 110,
+ /* 310 */ 111, 112, 113, 114, 115, 116, 117, 118, 57, 120,
+ /* 320 */ 121, 122, 123, 124, 125, 226, 363, 228, 57, 366,
+ /* 330 */ 367, 352, 426, 62, 426, 394, 4, 14, 333, 360,
+ /* 340 */ 69, 12, 13, 20, 365, 0, 367, 441, 442, 20,
+ /* 350 */ 442, 22, 446, 447, 446, 447, 95, 61, 97, 19,
+ /* 360 */ 355, 95, 33, 422, 35, 201, 95, 388, 171, 39,
+ /* 370 */ 20, 392, 22, 33, 95, 396, 397, 398, 399, 400,
+ /* 380 */ 401, 402, 0, 404, 20, 35, 57, 47, 117, 192,
+ /* 390 */ 193, 62, 47, 53, 54, 55, 56, 57, 69, 4,
+ /* 400 */ 50, 35, 131, 132, 226, 426, 24, 25, 26, 27,
+ /* 410 */ 28, 29, 30, 31, 32, 251, 252, 253, 254, 255,
+ /* 420 */ 441, 442, 352, 69, 95, 446, 447, 95, 322, 359,
+ /* 430 */ 163, 64, 65, 66, 94, 69, 14, 97, 368, 72,
+ /* 440 */ 73, 175, 20, 177, 77, 78, 117, 176, 69, 178,
+ /* 450 */ 83, 84, 380, 0, 20, 20, 89, 360, 8, 9,
+ /* 460 */ 131, 132, 12, 13, 14, 15, 16, 397, 371, 397,
+ /* 470 */ 130, 365, 201, 202, 353, 204, 205, 206, 207, 208,
+ /* 480 */ 209, 210, 211, 212, 213, 214, 215, 216, 217, 218,
+ /* 490 */ 219, 220, 221, 222, 223, 224, 426, 226, 426, 352,
+ /* 500 */ 412, 413, 162, 242, 353, 176, 359, 178, 242, 353,
+ /* 510 */ 333, 441, 442, 441, 442, 368, 446, 447, 446, 447,
+ /* 520 */ 180, 242, 182, 57, 347, 366, 367, 322, 205, 95,
+ /* 530 */ 201, 202, 355, 204, 205, 206, 207, 208, 209, 210,
+ /* 540 */ 211, 212, 213, 214, 215, 216, 217, 218, 219, 220,
+ /* 550 */ 221, 222, 223, 224, 12, 13, 3, 352, 338, 339,
+ /* 560 */ 107, 344, 20, 97, 22, 360, 131, 132, 161, 352,
+ /* 570 */ 365, 241, 367, 20, 242, 33, 360, 35, 361, 126,
+ /* 580 */ 127, 128, 129, 130, 8, 9, 322, 371, 12, 13,
+ /* 590 */ 14, 15, 16, 388, 408, 330, 410, 392, 20, 57,
+ /* 600 */ 22, 396, 397, 398, 399, 400, 401, 402, 343, 404,
+ /* 610 */ 352, 69, 12, 13, 14, 158, 352, 359, 168, 21,
+ /* 620 */ 20, 357, 22, 330, 360, 360, 368, 205, 50, 365,
+ /* 630 */ 353, 367, 34, 33, 36, 35, 343, 95, 243, 126,
+ /* 640 */ 8, 9, 437, 438, 12, 13, 14, 15, 16, 96,
+ /* 650 */ 344, 353, 388, 360, 247, 248, 392, 57, 352, 117,
+ /* 660 */ 396, 397, 398, 399, 400, 401, 402, 361, 404, 69,
+ /* 670 */ 12, 13, 96, 131, 132, 22, 242, 8, 9, 330,
+ /* 680 */ 22, 12, 13, 14, 15, 16, 229, 345, 35, 330,
+ /* 690 */ 348, 33, 343, 35, 2, 95, 239, 394, 185, 186,
+ /* 700 */ 8, 9, 343, 367, 12, 13, 14, 15, 16, 360,
+ /* 710 */ 394, 330, 43, 377, 264, 57, 163, 117, 176, 360,
+ /* 720 */ 178, 3, 69, 2, 343, 422, 22, 69, 96, 8,
+ /* 730 */ 9, 131, 132, 12, 13, 14, 15, 16, 422, 35,
+ /* 740 */ 397, 360, 407, 201, 202, 410, 204, 205, 206, 207,
+ /* 750 */ 208, 209, 210, 211, 212, 213, 214, 215, 216, 217,
+ /* 760 */ 218, 219, 220, 221, 222, 223, 224, 1, 2, 426,
+ /* 770 */ 117, 14, 15, 16, 353, 117, 176, 107, 178, 12,
+ /* 780 */ 13, 14, 15, 16, 242, 442, 353, 8, 9, 446,
+ /* 790 */ 447, 12, 13, 14, 15, 16, 126, 127, 128, 129,
+ /* 800 */ 130, 201, 202, 43, 204, 205, 206, 207, 208, 209,
+ /* 810 */ 210, 211, 212, 213, 214, 215, 216, 217, 218, 219,
+ /* 820 */ 220, 221, 222, 223, 224, 12, 13, 107, 330, 176,
+ /* 830 */ 376, 178, 378, 20, 176, 22, 178, 43, 408, 330,
+ /* 840 */ 410, 343, 338, 339, 384, 322, 33, 322, 35, 129,
+ /* 850 */ 330, 380, 343, 360, 201, 202, 96, 322, 360, 201,
+ /* 860 */ 202, 20, 96, 343, 371, 44, 45, 322, 397, 360,
+ /* 870 */ 57, 322, 341, 215, 216, 217, 218, 219, 220, 221,
+ /* 880 */ 360, 330, 69, 12, 13, 330, 330, 352, 365, 323,
+ /* 890 */ 365, 20, 380, 22, 343, 360, 0, 426, 343, 343,
+ /* 900 */ 365, 340, 367, 342, 33, 322, 35, 106, 95, 397,
+ /* 910 */ 365, 360, 441, 442, 365, 360, 360, 446, 447, 0,
+ /* 920 */ 376, 322, 378, 388, 322, 240, 241, 392, 57, 322,
+ /* 930 */ 117, 396, 397, 398, 399, 400, 401, 402, 426, 404,
+ /* 940 */ 69, 22, 163, 322, 131, 132, 411, 322, 365, 0,
+ /* 950 */ 415, 416, 330, 441, 442, 154, 322, 330, 446, 447,
+ /* 960 */ 64, 65, 66, 43, 365, 343, 95, 365, 72, 73,
+ /* 970 */ 343, 22, 365, 77, 78, 362, 395, 259, 365, 83,
+ /* 980 */ 84, 331, 360, 20, 33, 89, 365, 360, 117, 176,
+ /* 990 */ 365, 178, 380, 0, 380, 43, 322, 450, 47, 365,
+ /* 1000 */ 322, 322, 131, 132, 53, 54, 55, 56, 57, 397,
+ /* 1010 */ 362, 397, 43, 365, 201, 202, 96, 204, 205, 206,
+ /* 1020 */ 207, 208, 209, 210, 211, 212, 213, 214, 215, 216,
+ /* 1030 */ 217, 218, 219, 220, 221, 222, 223, 224, 426, 365,
+ /* 1040 */ 426, 352, 439, 365, 365, 94, 205, 176, 97, 178,
+ /* 1050 */ 361, 42, 43, 441, 442, 441, 442, 263, 446, 447,
+ /* 1060 */ 446, 447, 8, 9, 322, 96, 12, 13, 14, 15,
+ /* 1070 */ 16, 322, 201, 202, 0, 204, 205, 206, 207, 208,
+ /* 1080 */ 209, 210, 211, 212, 213, 214, 215, 216, 217, 218,
+ /* 1090 */ 219, 220, 221, 222, 223, 224, 18, 0, 20, 345,
+ /* 1100 */ 107, 330, 348, 163, 164, 27, 330, 365, 30, 99,
+ /* 1110 */ 159, 160, 102, 162, 365, 99, 43, 166, 102, 126,
+ /* 1120 */ 127, 128, 129, 130, 322, 47, 163, 49, 43, 99,
+ /* 1130 */ 52, 360, 102, 182, 99, 43, 360, 102, 64, 65,
+ /* 1140 */ 66, 67, 68, 433, 70, 71, 72, 73, 74, 75,
+ /* 1150 */ 76, 77, 78, 79, 80, 81, 82, 83, 84, 85,
+ /* 1160 */ 86, 87, 88, 89, 90, 91, 18, 365, 397, 96,
+ /* 1170 */ 330, 23, 94, 397, 62, 131, 132, 1, 2, 43,
+ /* 1180 */ 35, 96, 3, 343, 106, 37, 38, 0, 96, 41,
+ /* 1190 */ 419, 420, 421, 0, 423, 419, 420, 421, 43, 423,
+ /* 1200 */ 360, 43, 352, 43, 331, 43, 58, 59, 60, 22,
+ /* 1210 */ 43, 43, 134, 261, 322, 137, 138, 139, 140, 141,
+ /* 1220 */ 142, 143, 144, 145, 146, 147, 148, 149, 150, 151,
+ /* 1230 */ 152, 153, 96, 155, 156, 157, 35, 329, 46, 364,
+ /* 1240 */ 330, 48, 330, 95, 352, 43, 149, 330, 395, 43,
+ /* 1250 */ 424, 96, 360, 343, 96, 343, 96, 365, 96, 367,
+ /* 1260 */ 343, 8, 9, 96, 96, 12, 13, 14, 15, 16,
+ /* 1270 */ 360, 4, 360, 95, 443, 96, 330, 360, 417, 427,
+ /* 1280 */ 388, 133, 397, 105, 392, 244, 19, 95, 396, 397,
+ /* 1290 */ 398, 399, 400, 401, 402, 35, 404, 43, 96, 390,
+ /* 1300 */ 33, 409, 96, 411, 47, 389, 360, 415, 416, 174,
+ /* 1310 */ 382, 426, 13, 201, 47, 62, 168, 169, 170, 52,
+ /* 1320 */ 428, 173, 42, 178, 57, 322, 441, 442, 436, 69,
+ /* 1330 */ 13, 446, 447, 372, 35, 158, 372, 370, 20, 191,
+ /* 1340 */ 372, 330, 194, 397, 196, 197, 198, 199, 200, 330,
+ /* 1350 */ 96, 322, 35, 370, 370, 352, 93, 104, 337, 20,
+ /* 1360 */ 324, 94, 330, 360, 97, 419, 420, 421, 365, 423,
+ /* 1370 */ 367, 324, 426, 330, 20, 330, 386, 335, 20, 178,
+ /* 1380 */ 367, 352, 20, 335, 379, 381, 335, 441, 442, 360,
+ /* 1390 */ 242, 388, 446, 447, 365, 392, 367, 379, 335, 396,
+ /* 1400 */ 397, 398, 399, 400, 401, 402, 335, 404, 51, 330,
+ /* 1410 */ 335, 158, 409, 332, 411, 335, 332, 388, 415, 416,
+ /* 1420 */ 324, 392, 352, 330, 352, 396, 397, 398, 399, 400,
+ /* 1430 */ 401, 402, 324, 404, 352, 352, 190, 387, 409, 436,
+ /* 1440 */ 411, 352, 352, 352, 415, 416, 352, 352, 386, 333,
+ /* 1450 */ 352, 352, 365, 181, 425, 367, 333, 330, 330, 333,
+ /* 1460 */ 249, 385, 160, 322, 333, 379, 365, 365, 365, 365,
+ /* 1470 */ 348, 365, 333, 360, 20, 375, 365, 250, 432, 365,
+ /* 1480 */ 375, 432, 229, 230, 231, 232, 233, 234, 235, 236,
+ /* 1490 */ 237, 238, 239, 352, 373, 375, 256, 365, 365, 375,
+ /* 1500 */ 435, 360, 395, 365, 395, 167, 365, 258, 367, 257,
+ /* 1510 */ 245, 434, 265, 262, 445, 451, 260, 241, 20, 390,
+ /* 1520 */ 95, 360, 95, 342, 394, 356, 330, 333, 365, 388,
+ /* 1530 */ 322, 36, 325, 392, 324, 383, 346, 396, 397, 398,
+ /* 1540 */ 399, 400, 401, 402, 378, 404, 346, 432, 431, 430,
+ /* 1550 */ 409, 414, 411, 334, 429, 346, 415, 416, 320, 0,
+ /* 1560 */ 352, 0, 444, 183, 0, 0, 425, 42, 360, 35,
+ /* 1570 */ 195, 35, 35, 365, 0, 367, 35, 195, 0, 35,
+ /* 1580 */ 35, 195, 0, 195, 322, 0, 35, 0, 22, 0,
+ /* 1590 */ 35, 178, 176, 0, 0, 172, 388, 171, 0, 0,
+ /* 1600 */ 392, 0, 46, 0, 396, 397, 398, 399, 400, 401,
+ /* 1610 */ 402, 0, 404, 42, 352, 0, 0, 409, 0, 411,
+ /* 1620 */ 149, 42, 360, 415, 416, 0, 0, 365, 0, 367,
+ /* 1630 */ 0, 0, 35, 425, 0, 149, 0, 0, 322, 0,
+ /* 1640 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ /* 1650 */ 388, 0, 0, 0, 392, 42, 0, 0, 396, 397,
+ /* 1660 */ 398, 399, 400, 401, 402, 0, 404, 0, 352, 0,
+ /* 1670 */ 0, 409, 22, 411, 57, 0, 360, 415, 416, 0,
+ /* 1680 */ 0, 365, 0, 367, 57, 0, 0, 14, 0, 35,
+ /* 1690 */ 14, 322, 63, 167, 0, 0, 0, 42, 39, 0,
+ /* 1700 */ 0, 43, 40, 39, 388, 0, 46, 46, 392, 0,
+ /* 1710 */ 39, 0, 396, 397, 398, 399, 400, 401, 402, 35,
+ /* 1720 */ 404, 352, 39, 0, 47, 409, 35, 411, 47, 360,
+ /* 1730 */ 0, 415, 416, 0, 365, 0, 367, 39, 35, 35,
+ /* 1740 */ 47, 39, 0, 0, 322, 39, 0, 35, 47, 22,
+ /* 1750 */ 0, 35, 35, 22, 35, 35, 43, 388, 43, 35,
+ /* 1760 */ 35, 392, 22, 35, 0, 396, 397, 398, 399, 400,
+ /* 1770 */ 401, 402, 104, 404, 352, 22, 0, 22, 409, 0,
+ /* 1780 */ 411, 49, 360, 22, 415, 416, 35, 365, 0, 367,
+ /* 1790 */ 0, 102, 35, 35, 0, 22, 0, 20, 163, 0,
+ /* 1800 */ 35, 179, 22, 96, 0, 322, 0, 0, 3, 95,
+ /* 1810 */ 388, 0, 0, 95, 392, 0, 35, 96, 396, 397,
+ /* 1820 */ 398, 399, 400, 401, 402, 0, 404, 35, 165, 322,
+ /* 1830 */ 39, 95, 160, 411, 95, 352, 95, 415, 416, 105,
+ /* 1840 */ 43, 163, 246, 360, 46, 43, 159, 95, 365, 225,
+ /* 1850 */ 367, 43, 96, 163, 188, 95, 43, 225, 161, 352,
+ /* 1860 */ 227, 43, 96, 96, 95, 46, 96, 360, 96, 95,
+ /* 1870 */ 46, 388, 365, 95, 367, 392, 3, 95, 95, 396,
+ /* 1880 */ 397, 398, 399, 400, 401, 402, 403, 404, 405, 406,
+ /* 1890 */ 43, 322, 35, 35, 35, 388, 96, 96, 35, 392,
+ /* 1900 */ 35, 35, 46, 396, 397, 398, 399, 400, 401, 402,
+ /* 1910 */ 96, 404, 96, 43, 46, 46, 2, 22, 411, 96,
+ /* 1920 */ 46, 352, 95, 416, 95, 46, 95, 201, 96, 360,
+ /* 1930 */ 96, 95, 95, 22, 365, 96, 367, 95, 35, 106,
+ /* 1940 */ 203, 96, 322, 35, 95, 35, 96, 95, 35, 96,
+ /* 1950 */ 95, 35, 35, 22, 246, 95, 246, 388, 96, 119,
+ /* 1960 */ 96, 392, 240, 119, 35, 396, 397, 398, 399, 400,
+ /* 1970 */ 401, 402, 352, 404, 22, 406, 43, 95, 95, 107,
+ /* 1980 */ 360, 95, 95, 63, 62, 365, 119, 367, 35, 35,
+ /* 1990 */ 119, 35, 35, 35, 35, 35, 322, 35, 35, 35,
+ /* 2000 */ 35, 69, 35, 22, 92, 35, 22, 35, 388, 43,
+ /* 2010 */ 35, 35, 392, 69, 322, 35, 396, 397, 398, 399,
+ /* 2020 */ 400, 401, 402, 35, 404, 35, 352, 35, 35, 22,
+ /* 2030 */ 35, 0, 35, 39, 360, 0, 47, 35, 47, 365,
+ /* 2040 */ 39, 367, 0, 35, 352, 47, 0, 35, 39, 39,
+ /* 2050 */ 47, 0, 360, 35, 35, 0, 22, 365, 438, 367,
+ /* 2060 */ 21, 452, 388, 22, 20, 22, 392, 452, 21, 452,
+ /* 2070 */ 396, 397, 398, 399, 400, 401, 402, 452, 404, 452,
+ /* 2080 */ 388, 452, 452, 452, 392, 452, 452, 452, 396, 397,
+ /* 2090 */ 398, 399, 400, 401, 402, 452, 404, 322, 452, 452,
+ /* 2100 */ 452, 452, 452, 452, 452, 452, 452, 452, 452, 452,
+ /* 2110 */ 452, 452, 452, 452, 440, 452, 452, 452, 452, 452,
+ /* 2120 */ 452, 452, 452, 452, 452, 452, 452, 352, 452, 452,
+ /* 2130 */ 452, 452, 357, 452, 452, 360, 452, 452, 452, 452,
+ /* 2140 */ 365, 449, 367, 452, 452, 452, 452, 452, 452, 452,
+ /* 2150 */ 452, 452, 322, 452, 452, 452, 452, 452, 452, 452,
+ /* 2160 */ 452, 452, 452, 388, 452, 452, 452, 392, 452, 452,
+ /* 2170 */ 452, 396, 397, 398, 399, 400, 401, 402, 452, 404,
+ /* 2180 */ 452, 452, 352, 452, 452, 452, 452, 357, 452, 452,
+ /* 2190 */ 360, 452, 452, 452, 452, 365, 452, 367, 452, 452,
+ /* 2200 */ 452, 452, 452, 322, 452, 452, 452, 452, 452, 452,
+ /* 2210 */ 452, 452, 452, 452, 452, 452, 452, 452, 388, 452,
+ /* 2220 */ 452, 452, 392, 452, 452, 452, 396, 397, 398, 399,
+ /* 2230 */ 400, 401, 402, 352, 404, 452, 452, 452, 452, 452,
+ /* 2240 */ 452, 360, 452, 452, 452, 452, 365, 452, 367, 452,
+ /* 2250 */ 452, 452, 452, 452, 452, 452, 452, 322, 452, 452,
+ /* 2260 */ 452, 452, 452, 452, 452, 452, 452, 452, 452, 388,
+ /* 2270 */ 452, 452, 452, 392, 452, 452, 452, 396, 397, 398,
+ /* 2280 */ 399, 400, 401, 402, 452, 404, 452, 352, 452, 452,
+ /* 2290 */ 452, 452, 452, 452, 452, 360, 452, 452, 452, 452,
+ /* 2300 */ 365, 452, 367, 452, 452, 452, 452, 452, 322, 452,
+ /* 2310 */ 452, 452, 452, 452, 452, 452, 452, 452, 452, 452,
+ /* 2320 */ 452, 452, 452, 388, 452, 452, 452, 392, 452, 452,
+ /* 2330 */ 452, 396, 397, 398, 399, 400, 401, 402, 352, 404,
+ /* 2340 */ 452, 452, 452, 452, 452, 452, 360, 452, 452, 452,
+ /* 2350 */ 452, 365, 452, 367, 452, 452, 452, 452, 452, 452,
+ /* 2360 */ 452, 452, 322, 452, 452, 452, 452, 452, 452, 452,
+ /* 2370 */ 452, 452, 452, 452, 388, 452, 452, 452, 392, 452,
+ /* 2380 */ 322, 452, 396, 397, 398, 399, 400, 401, 402, 452,
+ /* 2390 */ 404, 452, 352, 452, 452, 452, 452, 452, 452, 452,
+ /* 2400 */ 360, 452, 452, 452, 452, 365, 452, 367, 452, 452,
+ /* 2410 */ 352, 452, 452, 452, 452, 452, 452, 452, 360, 452,
+ /* 2420 */ 452, 452, 452, 365, 452, 367, 452, 452, 388, 452,
+ /* 2430 */ 452, 452, 392, 452, 452, 452, 396, 397, 398, 399,
+ /* 2440 */ 400, 401, 402, 452, 404, 452, 388, 452, 452, 452,
+ /* 2450 */ 392, 452, 452, 452, 396, 397, 398, 399, 400, 401,
+ /* 2460 */ 402, 452, 404, 322, 452, 452, 452, 452, 452, 452,
+ /* 2470 */ 452, 452, 452, 452, 452, 452, 452, 452, 452, 452,
+ /* 2480 */ 452, 452, 452, 452, 452, 452, 452, 452, 452, 452,
+ /* 2490 */ 452, 452, 452, 352, 452, 452, 452, 452, 452, 452,
+ /* 2500 */ 452, 360, 452, 452, 452, 452, 365, 452, 367, 452,
+ /* 2510 */ 452, 452, 452, 452, 452, 452, 452, 452, 322, 452,
+ /* 2520 */ 452, 452, 452, 452, 452, 452, 452, 452, 452, 388,
+ /* 2530 */ 452, 452, 452, 392, 452, 452, 452, 396, 397, 398,
+ /* 2540 */ 399, 400, 401, 402, 452, 404, 452, 452, 352, 452,
+ /* 2550 */ 452, 452, 452, 452, 452, 452, 360, 452, 452, 452,
+ /* 2560 */ 452, 365, 452, 367, 452, 452, 452, 452, 452, 322,
+ /* 2570 */ 452, 452, 452, 452, 452, 452, 452, 452, 452, 452,
+ /* 2580 */ 452, 452, 452, 452, 388, 452, 452, 452, 392, 452,
+ /* 2590 */ 452, 452, 396, 397, 398, 399, 400, 401, 402, 352,
+ /* 2600 */ 404, 452, 452, 452, 452, 452, 452, 360, 452, 452,
+ /* 2610 */ 452, 452, 365, 452, 367, 452, 452, 452, 452, 452,
+ /* 2620 */ 452, 452, 452, 322, 452, 452, 452, 452, 452, 452,
+ /* 2630 */ 452, 452, 452, 452, 452, 388, 452, 452, 452, 392,
+ /* 2640 */ 452, 452, 452, 396, 397, 398, 399, 400, 401, 402,
+ /* 2650 */ 452, 404, 452, 352, 452, 452, 452, 452, 452, 452,
+ /* 2660 */ 452, 360, 452, 452, 452, 452, 365, 452, 367, 452,
+ /* 2670 */ 452, 452, 452, 452, 322, 452, 452, 452, 452, 452,
+ /* 2680 */ 452, 452, 452, 452, 452, 452, 452, 452, 452, 388,
+ /* 2690 */ 452, 452, 452, 392, 452, 452, 452, 396, 397, 398,
+ /* 2700 */ 399, 400, 401, 402, 352, 404, 452, 452, 452, 452,
+ /* 2710 */ 452, 452, 360, 452, 452, 452, 452, 365, 452, 367,
+ /* 2720 */ 452, 452, 452, 452, 452, 452, 452, 452, 322, 452,
+ /* 2730 */ 452, 452, 452, 452, 452, 452, 452, 452, 452, 452,
+ /* 2740 */ 388, 452, 452, 452, 392, 452, 322, 452, 396, 397,
+ /* 2750 */ 398, 399, 400, 401, 402, 452, 404, 452, 352, 452,
+ /* 2760 */ 452, 452, 452, 452, 452, 452, 360, 452, 452, 452,
+ /* 2770 */ 452, 365, 452, 367, 452, 452, 352, 452, 452, 452,
+ /* 2780 */ 452, 452, 452, 452, 360, 452, 452, 452, 452, 365,
+ /* 2790 */ 452, 367, 452, 452, 388, 452, 452, 452, 392, 452,
+ /* 2800 */ 452, 452, 396, 397, 398, 399, 400, 401, 402, 452,
+ /* 2810 */ 404, 452, 388, 452, 452, 452, 392, 452, 452, 452,
+ /* 2820 */ 396, 397, 398, 399, 400, 401, 402, 452, 404, 322,
+ /* 2830 */ 452, 452, 452, 452, 452, 452, 452, 452, 452, 452,
+ /* 2840 */ 452, 452, 452, 452, 452, 452, 452, 452, 452, 452,
+ /* 2850 */ 452, 452, 452, 452, 452, 452, 452, 452, 452, 352,
+ /* 2860 */ 452, 452, 452, 452, 452, 452, 452, 360, 452, 452,
+ /* 2870 */ 452, 452, 365, 452, 367, 452, 452, 452, 452, 452,
+ /* 2880 */ 452, 452, 452, 452, 322, 452, 452, 452, 452, 452,
+ /* 2890 */ 452, 452, 452, 452, 452, 388, 452, 452, 452, 392,
+ /* 2900 */ 452, 452, 452, 396, 397, 398, 399, 400, 401, 402,
+ /* 2910 */ 452, 404, 452, 452, 352, 452, 452, 452, 452, 452,
+ /* 2920 */ 452, 452, 360, 452, 452, 452, 452, 365, 452, 367,
+ /* 2930 */ 452, 452, 452, 452, 452, 322, 452, 452, 452, 452,
+ /* 2940 */ 452, 452, 452, 452, 452, 452, 452, 452, 452, 452,
+ /* 2950 */ 388, 452, 452, 452, 392, 452, 452, 452, 396, 397,
+ /* 2960 */ 398, 399, 400, 401, 402, 352, 404, 452, 452, 452,
+ /* 2970 */ 452, 452, 452, 360, 452, 452, 452, 452, 365, 452,
+ /* 2980 */ 367, 452, 452, 452, 452, 452, 452, 452, 452, 322,
+ /* 2990 */ 452, 452, 452, 452, 452, 452, 452, 452, 452, 452,
+ /* 3000 */ 452, 388, 452, 452, 452, 392, 452, 452, 452, 396,
+ /* 3010 */ 397, 398, 399, 400, 401, 402, 452, 404, 452, 352,
+ /* 3020 */ 452, 452, 452, 452, 452, 452, 452, 360, 452, 452,
+ /* 3030 */ 452, 452, 365, 452, 367, 452, 452, 452, 452, 452,
+ /* 3040 */ 322, 452, 452, 452, 452, 452, 452, 452, 452, 452,
+ /* 3050 */ 452, 452, 452, 452, 452, 388, 452, 452, 452, 392,
+ /* 3060 */ 452, 452, 452, 396, 397, 398, 399, 400, 401, 402,
+ /* 3070 */ 352, 404, 452, 452, 452, 452, 452, 452, 360, 452,
+ /* 3080 */ 452, 452, 452, 365, 452, 367, 452, 452, 452, 452,
+ /* 3090 */ 452, 452, 452, 452, 322, 452, 452, 452, 452, 452,
+ /* 3100 */ 452, 452, 452, 452, 452, 452, 388, 452, 452, 452,
+ /* 3110 */ 392, 452, 322, 452, 396, 397, 398, 399, 400, 401,
+ /* 3120 */ 402, 452, 404, 452, 352, 452, 452, 452, 452, 452,
+ /* 3130 */ 452, 452, 360, 452, 452, 452, 452, 365, 452, 367,
+ /* 3140 */ 452, 452, 352, 452, 452, 452, 452, 452, 452, 452,
+ /* 3150 */ 360, 452, 452, 452, 452, 365, 452, 367, 452, 452,
+ /* 3160 */ 388, 452, 452, 452, 392, 452, 452, 452, 396, 397,
+ /* 3170 */ 398, 399, 400, 401, 402, 452, 404, 452, 388, 452,
+ /* 3180 */ 452, 452, 392, 452, 452, 452, 396, 397, 398, 399,
+ /* 3190 */ 400, 401, 402, 452, 404, 322, 452, 452, 452, 452,
+ /* 3200 */ 452, 452, 452, 452, 452, 452, 452, 452, 452, 452,
+ /* 3210 */ 452, 452, 452, 452, 452, 452, 452, 452, 452, 452,
+ /* 3220 */ 452, 452, 452, 452, 452, 352, 452, 452, 452, 452,
+ /* 3230 */ 452, 452, 452, 360, 452, 452, 452, 452, 365, 452,
+ /* 3240 */ 367, 452, 452, 452, 452, 452, 452, 452, 452, 452,
+ /* 3250 */ 322, 452, 452, 452, 452, 452, 452, 452, 452, 452,
+ /* 3260 */ 452, 388, 452, 452, 452, 392, 452, 452, 452, 396,
+ /* 3270 */ 397, 398, 399, 400, 401, 402, 452, 404, 452, 452,
+ /* 3280 */ 352, 452, 452, 452, 452, 452, 452, 452, 360, 452,
+ /* 3290 */ 452, 452, 452, 365, 452, 367, 452, 452, 452, 452,
+ /* 3300 */ 452, 452, 452, 452, 452, 452, 452, 452, 452, 452,
+ /* 3310 */ 452, 452, 452, 452, 452, 452, 388, 452, 452, 452,
+ /* 3320 */ 392, 452, 452, 452, 396, 397, 398, 399, 400, 401,
+ /* 3330 */ 402, 452, 404,
};
-#define YY_SHIFT_COUNT (698)
+#define YY_SHIFT_COUNT (700)
#define YY_SHIFT_MIN (0)
-#define YY_SHIFT_MAX (2157)
+#define YY_SHIFT_MAX (2055)
static const unsigned short int yy_shift_ofst[] = {
- /* 0 */ 1139, 0, 57, 269, 57, 326, 326, 326, 538, 326,
- /* 10 */ 326, 326, 326, 326, 595, 807, 807, 864, 807, 807,
- /* 20 */ 807, 807, 807, 807, 807, 807, 807, 807, 807, 807,
- /* 30 */ 807, 807, 807, 807, 807, 807, 807, 807, 807, 807,
- /* 40 */ 807, 807, 807, 807, 807, 807, 12, 53, 88, 4,
- /* 50 */ 196, 80, 130, 80, 88, 88, 1548, 1548, 80, 1548,
- /* 60 */ 1548, 408, 80, 115, 115, 1, 1, 8, 115, 115,
- /* 70 */ 115, 115, 115, 115, 115, 115, 115, 115, 112, 115,
- /* 80 */ 115, 115, 156, 115, 115, 176, 115, 115, 176, 381,
- /* 90 */ 115, 176, 176, 176, 115, 180, 1070, 1176, 1176, 166,
- /* 100 */ 403, 1579, 1579, 1579, 1579, 1579, 1579, 1579, 1579, 1579,
- /* 110 */ 1579, 1579, 1579, 1579, 1579, 1579, 1579, 1579, 1579, 1579,
- /* 120 */ 491, 679, 8, 486, 486, 226, 323, 518, 270, 270,
- /* 130 */ 293, 293, 293, 323, 386, 386, 386, 321, 156, 19,
- /* 140 */ 19, 76, 176, 176, 527, 527, 321, 548, 400, 400,
- /* 150 */ 400, 400, 400, 400, 400, 264, 504, 137, 720, 1094,
- /* 160 */ 198, 67, 167, 83, 433, 134, 911, 313, 666, 730,
- /* 170 */ 852, 107, 730, 993, 521, 763, 999, 1193, 1078, 1239,
- /* 180 */ 1239, 1140, 1284, 1284, 1239, 1140, 1140, 1238, 1284, 1284,
- /* 190 */ 1284, 1328, 1328, 1332, 112, 156, 112, 1340, 1342, 112,
- /* 200 */ 1340, 112, 112, 112, 1284, 112, 1328, 176, 176, 176,
- /* 210 */ 176, 176, 176, 176, 176, 176, 176, 176, 1284, 1328,
- /* 220 */ 527, 1206, 1332, 180, 1221, 156, 180, 1284, 1284, 1340,
- /* 230 */ 180, 1186, 527, 527, 527, 527, 1186, 527, 1282, 180,
- /* 240 */ 321, 180, 386, 1437, 1437, 527, 1211, 1186, 527, 527,
- /* 250 */ 1211, 1186, 527, 527, 176, 1210, 1312, 1211, 1233, 1241,
- /* 260 */ 1255, 999, 1237, 1242, 1251, 1266, 386, 1489, 1420, 1421,
- /* 270 */ 527, 548, 1284, 180, 1501, 1328, 2801, 2801, 2801, 2801,
- /* 280 */ 2801, 2801, 2801, 1066, 1000, 436, 818, 773, 1158, 1244,
- /* 290 */ 50, 841, 1286, 665, 1301, 1301, 1301, 1301, 1301, 1301,
- /* 300 */ 1301, 1301, 1301, 934, 719, 124, 373, 11, 11, 192,
- /* 310 */ 542, 101, 311, 168, 15, 729, 336, 15, 15, 15,
- /* 320 */ 936, 505, 974, 754, 898, 944, 950, 997, 1013, 1091,
- /* 330 */ 1104, 1105, 783, 875, 963, 1069, 1073, 1136, 1143, 1144,
- /* 340 */ 1151, 992, 789, 327, 1042, 1152, 951, 1085, 410, 1159,
- /* 350 */ 962, 866, 1187, 1223, 1226, 1245, 1247, 1250, 1021, 1147,
- /* 360 */ 1192, 1197, 1248, 1558, 1573, 1392, 1575, 1577, 1537, 1580,
- /* 370 */ 1547, 1390, 1550, 1551, 1554, 1396, 1591, 1560, 1561, 1403,
- /* 380 */ 1598, 1406, 1602, 1570, 1606, 1595, 1618, 1586, 1442, 1449,
- /* 390 */ 1625, 1628, 1458, 1460, 1632, 1633, 1588, 1635, 1637, 1639,
- /* 400 */ 1599, 1640, 1642, 1643, 1603, 1644, 1646, 1648, 1649, 1650,
- /* 410 */ 1503, 1617, 1653, 1506, 1656, 1657, 1658, 1660, 1661, 1662,
- /* 420 */ 1665, 1666, 1674, 1676, 1677, 1678, 1679, 1680, 1681, 1641,
- /* 430 */ 1685, 1690, 1691, 1693, 1694, 1682, 1696, 1698, 1700, 1701,
- /* 440 */ 1667, 1703, 1651, 1705, 1652, 1706, 1710, 1669, 1673, 1645,
- /* 450 */ 1699, 1670, 1704, 1671, 1714, 1675, 1683, 1719, 1721, 1726,
- /* 460 */ 1702, 1569, 1727, 1737, 1739, 1695, 1740, 1742, 1708, 1697,
- /* 470 */ 1711, 1745, 1712, 1713, 1716, 1758, 1724, 1722, 1732, 1761,
- /* 480 */ 1735, 1725, 1734, 1775, 1777, 1791, 1792, 1692, 1707, 1763,
- /* 490 */ 1771, 1799, 1765, 1768, 1782, 1772, 1774, 1767, 1769, 1776,
- /* 500 */ 1779, 1784, 1780, 1816, 1797, 1822, 1801, 1787, 1824, 1815,
- /* 510 */ 1804, 1838, 1805, 1843, 1809, 1846, 1825, 1828, 1764, 1762,
- /* 520 */ 1858, 1715, 1826, 1860, 1687, 1841, 1718, 1709, 1866, 1867,
- /* 530 */ 1720, 1717, 1869, 1870, 1873, 1874, 1781, 1783, 1848, 1850,
- /* 540 */ 1689, 1887, 1794, 1729, 1796, 1892, 1854, 1736, 1802, 1793,
- /* 550 */ 1849, 1855, 1684, 1686, 1728, 1857, 1664, 1807, 1808, 1819,
- /* 560 */ 1827, 1829, 1820, 1859, 1831, 1834, 1836, 1839, 1837, 1901,
- /* 570 */ 1864, 1899, 1852, 1907, 1723, 1853, 1856, 1950, 1911, 1730,
- /* 580 */ 1920, 1921, 1922, 1924, 1925, 1926, 1872, 1877, 1916, 1746,
- /* 590 */ 1933, 1918, 1919, 1985, 1947, 1788, 1896, 1897, 1902, 1898,
- /* 600 */ 1903, 1900, 1945, 1906, 1917, 1953, 1929, 1979, 1810, 1923,
- /* 610 */ 1908, 1930, 1980, 1981, 1927, 1932, 1984, 1934, 1935, 1994,
- /* 620 */ 1938, 1939, 2000, 1942, 1944, 2002, 1946, 1931, 1937, 1941,
- /* 630 */ 1943, 1992, 1914, 1949, 1951, 2006, 1954, 1999, 1999, 2022,
- /* 640 */ 1988, 1986, 2021, 2025, 2037, 2038, 2040, 2041, 2042, 2044,
- /* 650 */ 2045, 2056, 1989, 1978, 2049, 2058, 2060, 2075, 2063, 2077,
- /* 660 */ 2066, 2067, 2068, 2036, 1767, 2070, 1769, 2071, 2072, 2074,
- /* 670 */ 2076, 2088, 2079, 2112, 2081, 2073, 2080, 2118, 2087, 2085,
- /* 680 */ 2084, 2134, 2100, 2090, 2099, 2139, 2106, 2096, 2115, 2151,
- /* 690 */ 2120, 2121, 2157, 2136, 2138, 2140, 2141, 2143, 2145,
+ /* 0 */ 1148, 0, 58, 271, 58, 329, 329, 329, 542, 329,
+ /* 10 */ 329, 329, 329, 329, 600, 813, 813, 871, 813, 813,
+ /* 20 */ 813, 813, 813, 813, 813, 813, 813, 813, 813, 813,
+ /* 30 */ 813, 813, 813, 813, 813, 813, 813, 813, 813, 813,
+ /* 40 */ 813, 813, 813, 813, 813, 813, 279, 434, 8, 266,
+ /* 50 */ 261, 19, 43, 19, 8, 8, 658, 658, 19, 658,
+ /* 60 */ 658, 332, 19, 16, 16, 14, 14, 435, 16, 16,
+ /* 70 */ 16, 16, 16, 16, 16, 16, 16, 16, 20, 16,
+ /* 80 */ 16, 16, 41, 16, 16, 207, 16, 16, 207, 213,
+ /* 90 */ 16, 207, 207, 207, 16, 229, 1078, 1253, 1253, 367,
+ /* 100 */ 222, 653, 653, 653, 653, 653, 653, 653, 653, 653,
+ /* 110 */ 653, 653, 653, 653, 653, 653, 653, 653, 653, 653,
+ /* 120 */ 128, 553, 435, 137, 137, 126, 366, 296, 99, 99,
+ /* 130 */ 267, 267, 267, 366, 364, 364, 364, 27, 41, 10,
+ /* 140 */ 10, 178, 207, 207, 354, 354, 27, 379, 199, 199,
+ /* 150 */ 199, 199, 199, 199, 199, 340, 896, 21, 74, 450,
+ /* 160 */ 164, 350, 407, 323, 422, 578, 821, 720, 963, 685,
+ /* 170 */ 330, 718, 685, 1009, 395, 841, 1041, 1257, 1135, 1280,
+ /* 180 */ 1280, 1177, 1318, 1318, 1280, 1177, 1177, 1263, 1318, 1318,
+ /* 190 */ 1318, 1339, 1339, 1354, 20, 41, 20, 1358, 1362, 20,
+ /* 200 */ 1358, 20, 20, 20, 1318, 20, 1357, 1357, 1339, 207,
+ /* 210 */ 207, 207, 207, 207, 207, 207, 207, 207, 207, 207,
+ /* 220 */ 1318, 1339, 354, 1246, 1354, 229, 1272, 41, 229, 1318,
+ /* 230 */ 1318, 1358, 229, 1211, 354, 354, 354, 354, 1211, 354,
+ /* 240 */ 1302, 229, 27, 229, 364, 1454, 1454, 354, 1227, 1211,
+ /* 250 */ 354, 354, 1227, 1211, 354, 354, 207, 1240, 1338, 1227,
+ /* 260 */ 1249, 1252, 1265, 1041, 1247, 1251, 1256, 1276, 364, 1498,
+ /* 270 */ 1425, 1427, 354, 379, 1318, 229, 1495, 1339, 3333, 3333,
+ /* 280 */ 3333, 3333, 3333, 3333, 3333, 1074, 951, 382, 1267, 576,
+ /* 290 */ 669, 632, 692, 721, 779, 453, 1054, 1054, 1054, 1054,
+ /* 300 */ 1054, 1054, 1054, 1054, 1054, 993, 670, 105, 113, 767,
+ /* 310 */ 767, 197, 201, 120, 598, 513, 757, 766, 457, 757,
+ /* 320 */ 757, 757, 760, 345, 704, 801, 1097, 1010, 1016, 1030,
+ /* 330 */ 1035, 919, 949, 1187, 466, 940, 920, 969, 1073, 1085,
+ /* 340 */ 1092, 1136, 1155, 1044, 952, 794, 1176, 1158, 1145, 1201,
+ /* 350 */ 1112, 1160, 1179, 1192, 1162, 1167, 1168, 1202, 1206, 1254,
+ /* 360 */ 1178, 1299, 1317, 1260, 1193, 1559, 1561, 1380, 1564, 1565,
+ /* 370 */ 1525, 1574, 1534, 1375, 1536, 1537, 1541, 1382, 1578, 1544,
+ /* 380 */ 1545, 1386, 1582, 1388, 1585, 1551, 1587, 1566, 1589, 1555,
+ /* 390 */ 1413, 1416, 1593, 1594, 1423, 1426, 1598, 1599, 1556, 1601,
+ /* 400 */ 1603, 1611, 1571, 1615, 1616, 1618, 1579, 1625, 1626, 1628,
+ /* 410 */ 1630, 1631, 1471, 1597, 1634, 1486, 1636, 1637, 1639, 1640,
+ /* 420 */ 1641, 1642, 1643, 1644, 1645, 1646, 1647, 1648, 1649, 1651,
+ /* 430 */ 1652, 1613, 1653, 1656, 1657, 1665, 1667, 1650, 1669, 1670,
+ /* 440 */ 1679, 1680, 1654, 1682, 1617, 1675, 1627, 1685, 1686, 1655,
+ /* 450 */ 1659, 1658, 1673, 1660, 1676, 1661, 1688, 1662, 1664, 1699,
+ /* 460 */ 1700, 1705, 1671, 1526, 1694, 1695, 1696, 1629, 1709, 1711,
+ /* 470 */ 1684, 1677, 1683, 1723, 1691, 1681, 1698, 1730, 1703, 1693,
+ /* 480 */ 1702, 1733, 1704, 1701, 1706, 1735, 1742, 1743, 1746, 1668,
+ /* 490 */ 1689, 1712, 1727, 1750, 1716, 1717, 1731, 1719, 1720, 1713,
+ /* 500 */ 1715, 1724, 1725, 1740, 1728, 1764, 1753, 1776, 1755, 1732,
+ /* 510 */ 1779, 1761, 1751, 1788, 1757, 1790, 1758, 1794, 1773, 1777,
+ /* 520 */ 1707, 1714, 1796, 1635, 1765, 1799, 1622, 1780, 1678, 1672,
+ /* 530 */ 1804, 1806, 1690, 1663, 1805, 1807, 1811, 1812, 1718, 1721,
+ /* 540 */ 1781, 1792, 1666, 1815, 1736, 1697, 1739, 1825, 1791, 1687,
+ /* 550 */ 1741, 1734, 1798, 1797, 1624, 1633, 1632, 1802, 1596, 1752,
+ /* 560 */ 1756, 1760, 1766, 1767, 1769, 1808, 1770, 1774, 1778, 1782,
+ /* 570 */ 1772, 1813, 1819, 1824, 1783, 1818, 1708, 1800, 1801, 1873,
+ /* 580 */ 1847, 1710, 1857, 1858, 1859, 1863, 1865, 1866, 1814, 1816,
+ /* 590 */ 1856, 1722, 1870, 1868, 1869, 1914, 1895, 1726, 1827, 1823,
+ /* 600 */ 1829, 1832, 1831, 1834, 1874, 1836, 1837, 1879, 1839, 1911,
+ /* 610 */ 1737, 1842, 1833, 1845, 1903, 1908, 1849, 1850, 1910, 1852,
+ /* 620 */ 1853, 1913, 1855, 1862, 1916, 1860, 1864, 1917, 1882, 1840,
+ /* 630 */ 1844, 1867, 1871, 1931, 1872, 1883, 1886, 1929, 1887, 1933,
+ /* 640 */ 1933, 1952, 1920, 1922, 1953, 1954, 1956, 1957, 1958, 1959,
+ /* 650 */ 1960, 1962, 1963, 1964, 1932, 1912, 1966, 1965, 1967, 1981,
+ /* 660 */ 1970, 1984, 1972, 1975, 1976, 1944, 1713, 1980, 1715, 1988,
+ /* 670 */ 1990, 1992, 1993, 2007, 1995, 2031, 1997, 1989, 1994, 2035,
+ /* 680 */ 2002, 1991, 2001, 2042, 2008, 1998, 2009, 2046, 2012, 2003,
+ /* 690 */ 2010, 2051, 2018, 2019, 2055, 2034, 2039, 2041, 2043, 2047,
+ /* 700 */ 2044,
};
-#define YY_REDUCE_COUNT (282)
-#define YY_REDUCE_MIN (-409)
-#define YY_REDUCE_MAX (2398)
+#define YY_REDUCE_COUNT (284)
+#define YY_REDUCE_MIN (-358)
+#define YY_REDUCE_MAX (2928)
static const short yy_reduce_ofst[] = {
- /* 0 */ -90, -254, -314, 878, 1029, 281, 550, 1072, -22, 1133,
- /* 10 */ 1155, 1213, 1273, 1388, 1431, 262, 531, 1455, 1334, 1521,
- /* 20 */ 1541, 1584, 603, 1608, 1668, 1688, 1731, 1750, 1803, 1821,
- /* 30 */ 1885, 1905, 1948, 1967, 2010, 2034, 2053, 2114, 2167, 2185,
- /* 40 */ 2249, 2269, 2312, 2331, 2374, 2398, -29, 279, -224, 277,
- /* 50 */ 805, 925, 927, 1148, -14, 289, -352, -349, -317, -342,
- /* 60 */ -67, 14, 160, -102, 38, -319, -310, -212, -208, 224,
- /* 70 */ 282, 292, 312, 344, 439, 529, 532, 537, -232, 551,
- /* 80 */ 577, 581, -246, 613, 633, -161, 646, 760, -26, -99,
- /* 90 */ 926, 220, -24, 284, 983, -98, -313, -409, -409, -31,
- /* 100 */ -265, -164, -138, -119, -12, -7, 233, 236, 251, 303,
- /* 110 */ 399, 406, 463, 509, 539, 541, 620, 622, 669, 671,
- /* 120 */ 59, -23, -290, 237, 367, -242, 103, 356, 195, 306,
- /* 130 */ -23, 193, 345, 355, -74, 409, 465, 430, 456, 390,
- /* 140 */ 401, 428, -316, 517, 475, 525, 573, 565, -347, 145,
- /* 150 */ 271, 291, 349, 354, 513, 511, 238, 629, 579, 528,
- /* 160 */ 544, 658, 663, 749, 749, 794, 806, 816, 776, 771,
- /* 170 */ 771, 782, 771, 819, 779, 749, 847, 876, 890, 919,
- /* 180 */ 949, 955, 996, 998, 956, 960, 975, 1009, 1002, 1017,
- /* 190 */ 1018, 1030, 1031, 971, 1023, 994, 1025, 984, 989, 1040,
- /* 200 */ 986, 1041, 1043, 1044, 1046, 1045, 1058, 1032, 1033, 1034,
- /* 210 */ 1035, 1036, 1038, 1039, 1047, 1048, 1049, 1050, 1061, 1068,
- /* 220 */ 1053, 1011, 1019, 1071, 1037, 1052, 1087, 1092, 1103, 1056,
- /* 230 */ 1108, 1067, 1081, 1082, 1083, 1084, 1076, 1088, 1079, 1121,
- /* 240 */ 1107, 1124, 1098, 1080, 1089, 1096, 1054, 1102, 1101, 1114,
- /* 250 */ 1057, 1115, 1117, 1126, 749, 1028, 1060, 1063, 1065, 1074,
- /* 260 */ 1077, 1112, 1059, 1064, 1075, 771, 1153, 1120, 1109, 1162,
- /* 270 */ 1161, 1182, 1196, 1205, 1214, 1216, 1163, 1172, 1212, 1215,
- /* 280 */ 1222, 1235, 1246,
+ /* 0 */ -94, -292, 892, -230, 1003, 1029, 1141, 1208, -21, 1262,
+ /* 10 */ 1316, 1369, 535, 1422, 1483, 205, -204, 1507, 264, 1569,
+ /* 20 */ 1620, 1674, 1692, 1775, 1830, 1881, 1935, 1986, 2040, 2058,
+ /* 30 */ 2141, 2196, 2247, 2301, 2352, 2406, 2424, 2507, 2562, 2613,
+ /* 40 */ 2667, 2718, 2772, 2790, 2873, 2928, 946, 70, -276, 72,
+ /* 50 */ 471, 512, 612, 614, 771, 776, -328, -252, 885, -348,
+ /* 60 */ -325, -92, 343, -319, -214, -326, -321, -37, -305, -232,
+ /* 70 */ 265, 293, 349, 359, 381, 498, 509, 520, -176, 551,
+ /* 80 */ 555, 556, -358, 622, 840, -329, 910, 912, 147, -169,
+ /* 90 */ 917, 217, 258, 306, 627, 177, -205, 88, 88, -302,
+ /* 100 */ -224, -162, 106, 523, 525, 545, 549, 583, 599, 602,
+ /* 110 */ 607, 621, 625, 634, 674, 678, 679, 742, 749, 802,
+ /* 120 */ -350, -59, 159, -253, -89, -331, 220, 5, 186, 430,
+ /* 130 */ -59, 303, 316, 504, 97, 216, 493, 342, 336, 454,
+ /* 140 */ 544, 335, 689, -267, 613, 648, 754, 561, 121, 151,
+ /* 150 */ 156, 277, 298, 421, 433, 460, 531, 566, 581, 547,
+ /* 160 */ 603, 650, 710, 850, 850, 873, 908, 875, 853, 826,
+ /* 170 */ 826, 831, 826, 861, 852, 850, 909, 916, 928, 961,
+ /* 180 */ 964, 967, 1011, 1019, 968, 983, 984, 1021, 1032, 1043,
+ /* 190 */ 1045, 1036, 1047, 990, 1042, 1013, 1048, 1005, 1004, 1051,
+ /* 200 */ 1018, 1063, 1071, 1075, 1079, 1080, 1081, 1084, 1096, 1070,
+ /* 210 */ 1072, 1082, 1083, 1089, 1090, 1091, 1094, 1095, 1098, 1099,
+ /* 220 */ 1093, 1108, 1087, 1050, 1062, 1116, 1076, 1088, 1123, 1127,
+ /* 230 */ 1128, 1086, 1126, 1100, 1101, 1102, 1103, 1104, 1105, 1106,
+ /* 240 */ 1121, 1131, 1122, 1139, 1113, 1107, 1109, 1111, 1046, 1120,
+ /* 250 */ 1114, 1132, 1049, 1124, 1133, 1138, 850, 1065, 1077, 1115,
+ /* 260 */ 1117, 1119, 1125, 1129, 1064, 1069, 1118, 826, 1161, 1130,
+ /* 270 */ 1137, 1169, 1163, 1181, 1196, 1194, 1207, 1210, 1152, 1166,
+ /* 280 */ 1190, 1200, 1209, 1219, 1238,
};
static const YYACTIONTYPE yy_default[] = {
- /* 0 */ 1559, 1559, 1559, 1559, 1559, 1559, 1559, 1559, 1559, 1559,
- /* 10 */ 1559, 1559, 1559, 1559, 1559, 1559, 1559, 1559, 1559, 1559,
- /* 20 */ 1559, 1559, 1559, 1559, 1559, 1559, 1559, 1559, 1559, 1559,
- /* 30 */ 1559, 1559, 1559, 1559, 1559, 1559, 1559, 1559, 1559, 1559,
- /* 40 */ 1559, 1559, 1559, 1559, 1559, 1559, 1559, 1559, 1559, 1559,
- /* 50 */ 1559, 1559, 1559, 1559, 1559, 1559, 1559, 1559, 1559, 1559,
- /* 60 */ 1559, 1559, 1559, 1559, 1559, 1559, 1559, 1559, 1559, 1559,
- /* 70 */ 1559, 1559, 1559, 1559, 1559, 1559, 1559, 1559, 1633, 1559,
- /* 80 */ 1559, 1559, 1559, 1559, 1559, 1559, 1559, 1559, 1559, 1559,
- /* 90 */ 1559, 1559, 1559, 1559, 1559, 1631, 1803, 1992, 1559, 1559,
- /* 100 */ 1559, 1559, 1559, 1559, 1559, 1559, 1559, 1559, 1559, 1559,
- /* 110 */ 1559, 1559, 1559, 1559, 1559, 1559, 1559, 1559, 1559, 1559,
- /* 120 */ 1559, 2004, 1559, 1559, 1559, 1633, 1559, 1631, 1964, 1964,
- /* 130 */ 2004, 2004, 2004, 1559, 1559, 1559, 1559, 1742, 1559, 1844,
- /* 140 */ 1844, 1559, 1559, 1559, 1559, 1559, 1742, 1559, 1559, 1559,
- /* 150 */ 1559, 1559, 1559, 1559, 1559, 1838, 1559, 1559, 2029, 2082,
- /* 160 */ 1559, 1559, 2032, 1559, 1559, 1559, 1559, 1695, 2019, 1996,
- /* 170 */ 2010, 2066, 1997, 1994, 2013, 1559, 2023, 1559, 1831, 1808,
- /* 180 */ 1808, 1805, 1559, 1559, 1808, 1805, 1805, 1686, 1559, 1559,
- /* 190 */ 1559, 1559, 1559, 1559, 1633, 1559, 1633, 1559, 1559, 1633,
- /* 200 */ 1559, 1633, 1633, 1633, 1559, 1633, 1559, 1559, 1559, 1559,
- /* 210 */ 1559, 1559, 1559, 1559, 1559, 1559, 1559, 1559, 1559, 1559,
- /* 220 */ 1559, 1851, 1559, 1631, 1840, 1559, 1631, 1559, 1559, 1559,
- /* 230 */ 1631, 2037, 1559, 1559, 1559, 1559, 2037, 1559, 1559, 1631,
- /* 240 */ 1559, 1631, 1559, 1559, 1559, 1559, 2039, 2037, 1559, 1559,
- /* 250 */ 2039, 2037, 1559, 1559, 1559, 2051, 2047, 2039, 2055, 2053,
- /* 260 */ 2025, 2023, 2085, 2072, 2068, 2010, 1559, 1559, 1559, 1711,
- /* 270 */ 1559, 1559, 1559, 1631, 1591, 1559, 1833, 1844, 1745, 1745,
- /* 280 */ 1745, 1634, 1564, 1559, 1559, 1559, 1559, 1559, 1559, 1559,
- /* 290 */ 1559, 1559, 1559, 1559, 1920, 1559, 2050, 2049, 1968, 1967,
- /* 300 */ 1966, 1957, 1919, 1559, 1707, 1559, 1559, 1918, 1917, 1559,
- /* 310 */ 1559, 1559, 1559, 1559, 1911, 1559, 1559, 1912, 1910, 1909,
- /* 320 */ 1559, 1559, 1559, 1559, 1559, 1559, 1559, 1559, 1559, 1559,
- /* 330 */ 1559, 1559, 1559, 1559, 1559, 1559, 1559, 1559, 1559, 1559,
- /* 340 */ 1559, 1559, 2069, 2073, 1993, 1559, 1559, 1559, 1559, 1559,
- /* 350 */ 1902, 1893, 1559, 1559, 1559, 1559, 1559, 1559, 1559, 1559,
- /* 360 */ 1559, 1559, 1559, 1559, 1559, 1559, 1559, 1559, 1559, 1559,
- /* 370 */ 1559, 1559, 1559, 1559, 1559, 1559, 1559, 1559, 1559, 1559,
- /* 380 */ 1559, 1559, 1559, 1559, 1559, 1559, 1559, 1559, 1559, 1559,
- /* 390 */ 1559, 1559, 1559, 1559, 1559, 1559, 1559, 1559, 1559, 1559,
- /* 400 */ 1559, 1559, 1559, 1559, 1559, 1559, 1559, 1559, 1559, 1559,
- /* 410 */ 1559, 1559, 1559, 1559, 1559, 1559, 1559, 1559, 1559, 1559,
- /* 420 */ 1559, 1559, 1559, 1559, 1559, 1559, 1559, 1559, 1559, 1559,
- /* 430 */ 1559, 1559, 1559, 1559, 1559, 1559, 1559, 1559, 1559, 1559,
- /* 440 */ 1559, 1559, 1559, 1559, 1559, 1559, 1559, 1559, 1559, 1596,
- /* 450 */ 1559, 1559, 1559, 1559, 1559, 1559, 1559, 1559, 1559, 1559,
- /* 460 */ 1559, 1559, 1559, 1559, 1559, 1559, 1559, 1559, 1559, 1559,
- /* 470 */ 1559, 1559, 1559, 1559, 1559, 1559, 1559, 1559, 1559, 1559,
- /* 480 */ 1559, 1559, 1559, 1559, 1559, 1559, 1559, 1559, 1559, 1559,
- /* 490 */ 1559, 1559, 1559, 1559, 1559, 1559, 1559, 1673, 1672, 1559,
- /* 500 */ 1559, 1559, 1559, 1559, 1559, 1559, 1559, 1559, 1559, 1559,
- /* 510 */ 1559, 1559, 1559, 1559, 1559, 1559, 1559, 1559, 1901, 1559,
- /* 520 */ 1559, 1559, 1559, 1559, 1559, 1559, 1559, 1559, 1559, 1559,
- /* 530 */ 1559, 1559, 2065, 1559, 1559, 1559, 1559, 1559, 1559, 1559,
- /* 540 */ 1559, 1848, 1559, 1559, 1559, 1559, 1559, 1559, 1559, 1559,
- /* 550 */ 1559, 1954, 1559, 1559, 1559, 2026, 1559, 1559, 1559, 1559,
- /* 560 */ 1559, 1559, 1559, 1559, 1559, 1559, 1559, 1559, 1559, 1559,
- /* 570 */ 1559, 1893, 1559, 2048, 1559, 1559, 2063, 1559, 2067, 1559,
- /* 580 */ 1559, 1559, 1559, 1559, 1559, 1559, 2003, 1999, 1559, 1559,
- /* 590 */ 1995, 1892, 1559, 1988, 1559, 1559, 1939, 1559, 1559, 1559,
- /* 600 */ 1559, 1559, 1559, 1559, 1559, 1559, 1901, 1559, 1905, 1559,
- /* 610 */ 1559, 1559, 1559, 1559, 1739, 1559, 1559, 1559, 1559, 1559,
- /* 620 */ 1559, 1559, 1559, 1559, 1559, 1559, 1559, 1724, 1722, 1721,
- /* 630 */ 1720, 1559, 1717, 1559, 1559, 1559, 1559, 1748, 1747, 1559,
- /* 640 */ 1559, 1559, 1559, 1559, 1559, 1559, 1559, 1559, 1559, 1559,
- /* 650 */ 1559, 1559, 1559, 1559, 1653, 1559, 1559, 1559, 1559, 1559,
- /* 660 */ 1559, 1559, 1559, 1559, 1644, 1559, 1643, 1559, 1559, 1559,
- /* 670 */ 1559, 1559, 1559, 1559, 1559, 1559, 1559, 1559, 1559, 1559,
- /* 680 */ 1559, 1559, 1559, 1559, 1559, 1559, 1559, 1559, 1559, 1559,
- /* 690 */ 1559, 1559, 1559, 1559, 1559, 1559, 1559, 1559, 1559,
+ /* 0 */ 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564,
+ /* 10 */ 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564,
+ /* 20 */ 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564,
+ /* 30 */ 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564,
+ /* 40 */ 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564,
+ /* 50 */ 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564,
+ /* 60 */ 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564,
+ /* 70 */ 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1640, 1564,
+ /* 80 */ 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564,
+ /* 90 */ 1564, 1564, 1564, 1564, 1564, 1638, 1810, 1999, 1564, 1564,
+ /* 100 */ 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564,
+ /* 110 */ 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564,
+ /* 120 */ 1564, 2011, 1564, 1564, 1564, 1640, 1564, 1638, 1971, 1971,
+ /* 130 */ 2011, 2011, 2011, 1564, 1564, 1564, 1564, 1749, 1564, 1851,
+ /* 140 */ 1851, 1564, 1564, 1564, 1564, 1564, 1749, 1564, 1564, 1564,
+ /* 150 */ 1564, 1564, 1564, 1564, 1564, 1845, 1564, 1564, 2036, 2089,
+ /* 160 */ 1564, 1564, 2039, 1564, 1564, 1564, 1564, 1702, 2026, 2003,
+ /* 170 */ 2017, 2073, 2004, 2001, 2020, 1564, 2030, 1564, 1838, 1815,
+ /* 180 */ 1815, 1812, 1564, 1564, 1815, 1812, 1812, 1693, 1564, 1564,
+ /* 190 */ 1564, 1564, 1564, 1564, 1640, 1564, 1640, 1564, 1564, 1640,
+ /* 200 */ 1564, 1640, 1640, 1640, 1564, 1640, 1619, 1619, 1564, 1564,
+ /* 210 */ 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564,
+ /* 220 */ 1564, 1564, 1564, 1858, 1564, 1638, 1847, 1564, 1638, 1564,
+ /* 230 */ 1564, 1564, 1638, 2044, 1564, 1564, 1564, 1564, 2044, 1564,
+ /* 240 */ 1564, 1638, 1564, 1638, 1564, 1564, 1564, 1564, 2046, 2044,
+ /* 250 */ 1564, 1564, 2046, 2044, 1564, 1564, 1564, 2058, 2054, 2046,
+ /* 260 */ 2062, 2060, 2032, 2030, 2092, 2079, 2075, 2017, 1564, 1564,
+ /* 270 */ 1564, 1718, 1564, 1564, 1564, 1638, 1596, 1564, 1840, 1851,
+ /* 280 */ 1752, 1752, 1752, 1641, 1569, 1564, 1564, 1564, 1564, 1564,
+ /* 290 */ 1564, 1564, 1564, 1564, 1564, 1564, 1927, 1564, 2057, 2056,
+ /* 300 */ 1975, 1974, 1973, 1964, 1926, 1564, 1714, 1564, 1564, 1925,
+ /* 310 */ 1924, 1564, 1564, 1564, 1564, 1564, 1918, 1564, 1564, 1919,
+ /* 320 */ 1917, 1916, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564,
+ /* 330 */ 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564,
+ /* 340 */ 1564, 1564, 1564, 1564, 2076, 2080, 2000, 1564, 1564, 1564,
+ /* 350 */ 1564, 1564, 1909, 1900, 1564, 1564, 1564, 1564, 1564, 1564,
+ /* 360 */ 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564,
+ /* 370 */ 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564,
+ /* 380 */ 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564,
+ /* 390 */ 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564,
+ /* 400 */ 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564,
+ /* 410 */ 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564,
+ /* 420 */ 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564,
+ /* 430 */ 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564,
+ /* 440 */ 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564,
+ /* 450 */ 1564, 1601, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564,
+ /* 460 */ 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564,
+ /* 470 */ 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564,
+ /* 480 */ 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564,
+ /* 490 */ 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1680,
+ /* 500 */ 1679, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564,
+ /* 510 */ 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564,
+ /* 520 */ 1908, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564,
+ /* 530 */ 1564, 1564, 1564, 1564, 2072, 1564, 1564, 1564, 1564, 1564,
+ /* 540 */ 1564, 1564, 1564, 1855, 1564, 1564, 1564, 1564, 1564, 1564,
+ /* 550 */ 1564, 1564, 1564, 1961, 1564, 1564, 1564, 2033, 1564, 1564,
+ /* 560 */ 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564,
+ /* 570 */ 1564, 1564, 1564, 1900, 1564, 2055, 1564, 1564, 2070, 1564,
+ /* 580 */ 2074, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 2010, 2006,
+ /* 590 */ 1564, 1564, 2002, 1899, 1564, 1995, 1564, 1564, 1946, 1564,
+ /* 600 */ 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1908, 1564,
+ /* 610 */ 1912, 1564, 1564, 1564, 1564, 1564, 1746, 1564, 1564, 1564,
+ /* 620 */ 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1731,
+ /* 630 */ 1729, 1728, 1727, 1564, 1724, 1564, 1564, 1564, 1564, 1755,
+ /* 640 */ 1754, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564,
+ /* 650 */ 1564, 1564, 1564, 1564, 1564, 1564, 1660, 1564, 1564, 1564,
+ /* 660 */ 1564, 1564, 1564, 1564, 1564, 1564, 1651, 1564, 1650, 1564,
+ /* 670 */ 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564,
+ /* 680 */ 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564,
+ /* 690 */ 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564,
+ /* 700 */ 1564,
};
/********** End of lemon-generated parsing tables *****************************/
@@ -1033,6 +1141,7 @@ static const YYCODETYPE yyFallback[] = {
0, /* PORT => nothing */
0, /* DNODES => nothing */
0, /* NK_IPTOKEN => nothing */
+ 0, /* FORCE => nothing */
0, /* LOCAL => nothing */
0, /* QNODE => nothing */
0, /* BNODE => nothing */
@@ -1206,7 +1315,7 @@ static const YYCODETYPE yyFallback[] = {
0, /* COUNT => nothing */
0, /* LAST_ROW => nothing */
0, /* CASE => nothing */
- 265, /* END => ABORT */
+ 266, /* END => ABORT */
0, /* WHEN => nothing */
0, /* THEN => nothing */
0, /* ELSE => nothing */
@@ -1248,58 +1357,58 @@ static const YYCODETYPE yyFallback[] = {
0, /* ASC => nothing */
0, /* NULLS => nothing */
0, /* ABORT => nothing */
- 265, /* AFTER => ABORT */
- 265, /* ATTACH => ABORT */
- 265, /* BEFORE => ABORT */
- 265, /* BEGIN => ABORT */
- 265, /* BITAND => ABORT */
- 265, /* BITNOT => ABORT */
- 265, /* BITOR => ABORT */
- 265, /* BLOCKS => ABORT */
- 265, /* CHANGE => ABORT */
- 265, /* COMMA => ABORT */
- 265, /* COMPACT => ABORT */
- 265, /* CONCAT => ABORT */
- 265, /* CONFLICT => ABORT */
- 265, /* COPY => ABORT */
- 265, /* DEFERRED => ABORT */
- 265, /* DELIMITERS => ABORT */
- 265, /* DETACH => ABORT */
- 265, /* DIVIDE => ABORT */
- 265, /* DOT => ABORT */
- 265, /* EACH => ABORT */
- 265, /* FAIL => ABORT */
- 265, /* FILE => ABORT */
- 265, /* FOR => ABORT */
- 265, /* GLOB => ABORT */
- 265, /* ID => ABORT */
- 265, /* IMMEDIATE => ABORT */
- 265, /* IMPORT => ABORT */
- 265, /* INITIALLY => ABORT */
- 265, /* INSTEAD => ABORT */
- 265, /* ISNULL => ABORT */
- 265, /* KEY => ABORT */
- 265, /* MODULES => ABORT */
- 265, /* NK_BITNOT => ABORT */
- 265, /* NK_SEMI => ABORT */
- 265, /* NOTNULL => ABORT */
- 265, /* OF => ABORT */
- 265, /* PLUS => ABORT */
- 265, /* PRIVILEGE => ABORT */
- 265, /* RAISE => ABORT */
- 265, /* REPLACE => ABORT */
- 265, /* RESTRICT => ABORT */
- 265, /* ROW => ABORT */
- 265, /* SEMI => ABORT */
- 265, /* STAR => ABORT */
- 265, /* STATEMENT => ABORT */
- 265, /* STRING => ABORT */
- 265, /* TIMES => ABORT */
- 265, /* UPDATE => ABORT */
- 265, /* VALUES => ABORT */
- 265, /* VARIABLE => ABORT */
- 265, /* VIEW => ABORT */
- 265, /* WAL => ABORT */
+ 266, /* AFTER => ABORT */
+ 266, /* ATTACH => ABORT */
+ 266, /* BEFORE => ABORT */
+ 266, /* BEGIN => ABORT */
+ 266, /* BITAND => ABORT */
+ 266, /* BITNOT => ABORT */
+ 266, /* BITOR => ABORT */
+ 266, /* BLOCKS => ABORT */
+ 266, /* CHANGE => ABORT */
+ 266, /* COMMA => ABORT */
+ 266, /* COMPACT => ABORT */
+ 266, /* CONCAT => ABORT */
+ 266, /* CONFLICT => ABORT */
+ 266, /* COPY => ABORT */
+ 266, /* DEFERRED => ABORT */
+ 266, /* DELIMITERS => ABORT */
+ 266, /* DETACH => ABORT */
+ 266, /* DIVIDE => ABORT */
+ 266, /* DOT => ABORT */
+ 266, /* EACH => ABORT */
+ 266, /* FAIL => ABORT */
+ 266, /* FILE => ABORT */
+ 266, /* FOR => ABORT */
+ 266, /* GLOB => ABORT */
+ 266, /* ID => ABORT */
+ 266, /* IMMEDIATE => ABORT */
+ 266, /* IMPORT => ABORT */
+ 266, /* INITIALLY => ABORT */
+ 266, /* INSTEAD => ABORT */
+ 266, /* ISNULL => ABORT */
+ 266, /* KEY => ABORT */
+ 266, /* MODULES => ABORT */
+ 266, /* NK_BITNOT => ABORT */
+ 266, /* NK_SEMI => ABORT */
+ 266, /* NOTNULL => ABORT */
+ 266, /* OF => ABORT */
+ 266, /* PLUS => ABORT */
+ 266, /* PRIVILEGE => ABORT */
+ 266, /* RAISE => ABORT */
+ 266, /* REPLACE => ABORT */
+ 266, /* RESTRICT => ABORT */
+ 266, /* ROW => ABORT */
+ 266, /* SEMI => ABORT */
+ 266, /* STAR => ABORT */
+ 266, /* STATEMENT => ABORT */
+ 266, /* STRING => ABORT */
+ 266, /* TIMES => ABORT */
+ 266, /* UPDATE => ABORT */
+ 266, /* VALUES => ABORT */
+ 266, /* VARIABLE => ABORT */
+ 266, /* VIEW => ABORT */
+ 266, /* WAL => ABORT */
};
#endif /* YYFALLBACK */
@@ -1438,405 +1547,407 @@ static const char *const yyTokenName[] = {
/* 48 */ "PORT",
/* 49 */ "DNODES",
/* 50 */ "NK_IPTOKEN",
- /* 51 */ "LOCAL",
- /* 52 */ "QNODE",
- /* 53 */ "BNODE",
- /* 54 */ "SNODE",
- /* 55 */ "MNODE",
- /* 56 */ "DATABASE",
- /* 57 */ "USE",
- /* 58 */ "FLUSH",
- /* 59 */ "TRIM",
- /* 60 */ "IF",
- /* 61 */ "NOT",
- /* 62 */ "EXISTS",
- /* 63 */ "BUFFER",
- /* 64 */ "CACHEMODEL",
- /* 65 */ "CACHESIZE",
- /* 66 */ "COMP",
- /* 67 */ "DURATION",
- /* 68 */ "NK_VARIABLE",
- /* 69 */ "MAXROWS",
- /* 70 */ "MINROWS",
- /* 71 */ "KEEP",
- /* 72 */ "PAGES",
- /* 73 */ "PAGESIZE",
- /* 74 */ "TSDB_PAGESIZE",
- /* 75 */ "PRECISION",
- /* 76 */ "REPLICA",
- /* 77 */ "STRICT",
- /* 78 */ "VGROUPS",
- /* 79 */ "SINGLE_STABLE",
- /* 80 */ "RETENTIONS",
- /* 81 */ "SCHEMALESS",
- /* 82 */ "WAL_LEVEL",
- /* 83 */ "WAL_FSYNC_PERIOD",
- /* 84 */ "WAL_RETENTION_PERIOD",
- /* 85 */ "WAL_RETENTION_SIZE",
- /* 86 */ "WAL_ROLL_PERIOD",
- /* 87 */ "WAL_SEGMENT_SIZE",
- /* 88 */ "STT_TRIGGER",
- /* 89 */ "TABLE_PREFIX",
- /* 90 */ "TABLE_SUFFIX",
- /* 91 */ "NK_COLON",
- /* 92 */ "MAX_SPEED",
- /* 93 */ "TABLE",
- /* 94 */ "NK_LP",
- /* 95 */ "NK_RP",
- /* 96 */ "STABLE",
- /* 97 */ "ADD",
- /* 98 */ "COLUMN",
- /* 99 */ "MODIFY",
- /* 100 */ "RENAME",
- /* 101 */ "TAG",
- /* 102 */ "SET",
- /* 103 */ "NK_EQ",
- /* 104 */ "USING",
- /* 105 */ "TAGS",
- /* 106 */ "COMMENT",
- /* 107 */ "BOOL",
- /* 108 */ "TINYINT",
- /* 109 */ "SMALLINT",
- /* 110 */ "INT",
- /* 111 */ "INTEGER",
- /* 112 */ "BIGINT",
- /* 113 */ "FLOAT",
- /* 114 */ "DOUBLE",
- /* 115 */ "BINARY",
- /* 116 */ "TIMESTAMP",
- /* 117 */ "NCHAR",
- /* 118 */ "UNSIGNED",
- /* 119 */ "JSON",
- /* 120 */ "VARCHAR",
- /* 121 */ "MEDIUMBLOB",
- /* 122 */ "BLOB",
- /* 123 */ "VARBINARY",
- /* 124 */ "DECIMAL",
- /* 125 */ "MAX_DELAY",
- /* 126 */ "WATERMARK",
- /* 127 */ "ROLLUP",
- /* 128 */ "TTL",
- /* 129 */ "SMA",
- /* 130 */ "FIRST",
- /* 131 */ "LAST",
- /* 132 */ "SHOW",
- /* 133 */ "DATABASES",
- /* 134 */ "TABLES",
- /* 135 */ "STABLES",
- /* 136 */ "MNODES",
- /* 137 */ "QNODES",
- /* 138 */ "FUNCTIONS",
- /* 139 */ "INDEXES",
- /* 140 */ "ACCOUNTS",
- /* 141 */ "APPS",
- /* 142 */ "CONNECTIONS",
- /* 143 */ "LICENCES",
- /* 144 */ "GRANTS",
- /* 145 */ "QUERIES",
- /* 146 */ "SCORES",
- /* 147 */ "TOPICS",
- /* 148 */ "VARIABLES",
- /* 149 */ "CLUSTER",
- /* 150 */ "BNODES",
- /* 151 */ "SNODES",
- /* 152 */ "TRANSACTIONS",
- /* 153 */ "DISTRIBUTED",
- /* 154 */ "CONSUMERS",
- /* 155 */ "SUBSCRIPTIONS",
- /* 156 */ "VNODES",
- /* 157 */ "LIKE",
- /* 158 */ "INDEX",
- /* 159 */ "FUNCTION",
- /* 160 */ "INTERVAL",
- /* 161 */ "TOPIC",
- /* 162 */ "AS",
- /* 163 */ "WITH",
- /* 164 */ "META",
- /* 165 */ "CONSUMER",
- /* 166 */ "GROUP",
- /* 167 */ "DESC",
- /* 168 */ "DESCRIBE",
- /* 169 */ "RESET",
- /* 170 */ "QUERY",
- /* 171 */ "CACHE",
- /* 172 */ "EXPLAIN",
- /* 173 */ "ANALYZE",
- /* 174 */ "VERBOSE",
- /* 175 */ "NK_BOOL",
- /* 176 */ "RATIO",
- /* 177 */ "NK_FLOAT",
- /* 178 */ "OUTPUTTYPE",
- /* 179 */ "AGGREGATE",
- /* 180 */ "BUFSIZE",
- /* 181 */ "STREAM",
- /* 182 */ "INTO",
- /* 183 */ "TRIGGER",
- /* 184 */ "AT_ONCE",
- /* 185 */ "WINDOW_CLOSE",
- /* 186 */ "IGNORE",
- /* 187 */ "EXPIRED",
- /* 188 */ "FILL_HISTORY",
- /* 189 */ "SUBTABLE",
- /* 190 */ "KILL",
- /* 191 */ "CONNECTION",
- /* 192 */ "TRANSACTION",
- /* 193 */ "BALANCE",
- /* 194 */ "VGROUP",
- /* 195 */ "MERGE",
- /* 196 */ "REDISTRIBUTE",
- /* 197 */ "SPLIT",
- /* 198 */ "DELETE",
- /* 199 */ "INSERT",
- /* 200 */ "NULL",
- /* 201 */ "NK_QUESTION",
- /* 202 */ "NK_ARROW",
- /* 203 */ "ROWTS",
- /* 204 */ "TBNAME",
- /* 205 */ "QSTART",
- /* 206 */ "QEND",
- /* 207 */ "QDURATION",
- /* 208 */ "WSTART",
- /* 209 */ "WEND",
- /* 210 */ "WDURATION",
- /* 211 */ "IROWTS",
- /* 212 */ "QTAGS",
- /* 213 */ "CAST",
- /* 214 */ "NOW",
- /* 215 */ "TODAY",
- /* 216 */ "TIMEZONE",
- /* 217 */ "CLIENT_VERSION",
- /* 218 */ "SERVER_VERSION",
- /* 219 */ "SERVER_STATUS",
- /* 220 */ "CURRENT_USER",
- /* 221 */ "COUNT",
- /* 222 */ "LAST_ROW",
- /* 223 */ "CASE",
- /* 224 */ "END",
- /* 225 */ "WHEN",
- /* 226 */ "THEN",
- /* 227 */ "ELSE",
- /* 228 */ "BETWEEN",
- /* 229 */ "IS",
- /* 230 */ "NK_LT",
- /* 231 */ "NK_GT",
- /* 232 */ "NK_LE",
- /* 233 */ "NK_GE",
- /* 234 */ "NK_NE",
- /* 235 */ "MATCH",
- /* 236 */ "NMATCH",
- /* 237 */ "CONTAINS",
- /* 238 */ "IN",
- /* 239 */ "JOIN",
- /* 240 */ "INNER",
- /* 241 */ "SELECT",
- /* 242 */ "DISTINCT",
- /* 243 */ "WHERE",
- /* 244 */ "PARTITION",
- /* 245 */ "BY",
- /* 246 */ "SESSION",
- /* 247 */ "STATE_WINDOW",
- /* 248 */ "SLIDING",
- /* 249 */ "FILL",
- /* 250 */ "VALUE",
- /* 251 */ "NONE",
- /* 252 */ "PREV",
- /* 253 */ "LINEAR",
- /* 254 */ "NEXT",
- /* 255 */ "HAVING",
- /* 256 */ "RANGE",
- /* 257 */ "EVERY",
- /* 258 */ "ORDER",
- /* 259 */ "SLIMIT",
- /* 260 */ "SOFFSET",
- /* 261 */ "LIMIT",
- /* 262 */ "OFFSET",
- /* 263 */ "ASC",
- /* 264 */ "NULLS",
- /* 265 */ "ABORT",
- /* 266 */ "AFTER",
- /* 267 */ "ATTACH",
- /* 268 */ "BEFORE",
- /* 269 */ "BEGIN",
- /* 270 */ "BITAND",
- /* 271 */ "BITNOT",
- /* 272 */ "BITOR",
- /* 273 */ "BLOCKS",
- /* 274 */ "CHANGE",
- /* 275 */ "COMMA",
- /* 276 */ "COMPACT",
- /* 277 */ "CONCAT",
- /* 278 */ "CONFLICT",
- /* 279 */ "COPY",
- /* 280 */ "DEFERRED",
- /* 281 */ "DELIMITERS",
- /* 282 */ "DETACH",
- /* 283 */ "DIVIDE",
- /* 284 */ "DOT",
- /* 285 */ "EACH",
- /* 286 */ "FAIL",
- /* 287 */ "FILE",
- /* 288 */ "FOR",
- /* 289 */ "GLOB",
- /* 290 */ "ID",
- /* 291 */ "IMMEDIATE",
- /* 292 */ "IMPORT",
- /* 293 */ "INITIALLY",
- /* 294 */ "INSTEAD",
- /* 295 */ "ISNULL",
- /* 296 */ "KEY",
- /* 297 */ "MODULES",
- /* 298 */ "NK_BITNOT",
- /* 299 */ "NK_SEMI",
- /* 300 */ "NOTNULL",
- /* 301 */ "OF",
- /* 302 */ "PLUS",
- /* 303 */ "PRIVILEGE",
- /* 304 */ "RAISE",
- /* 305 */ "REPLACE",
- /* 306 */ "RESTRICT",
- /* 307 */ "ROW",
- /* 308 */ "SEMI",
- /* 309 */ "STAR",
- /* 310 */ "STATEMENT",
- /* 311 */ "STRING",
- /* 312 */ "TIMES",
- /* 313 */ "UPDATE",
- /* 314 */ "VALUES",
- /* 315 */ "VARIABLE",
- /* 316 */ "VIEW",
- /* 317 */ "WAL",
- /* 318 */ "cmd",
- /* 319 */ "account_options",
- /* 320 */ "alter_account_options",
- /* 321 */ "literal",
- /* 322 */ "alter_account_option",
- /* 323 */ "user_name",
- /* 324 */ "sysinfo_opt",
- /* 325 */ "privileges",
- /* 326 */ "priv_level",
- /* 327 */ "priv_type_list",
- /* 328 */ "priv_type",
- /* 329 */ "db_name",
- /* 330 */ "dnode_endpoint",
- /* 331 */ "not_exists_opt",
- /* 332 */ "db_options",
- /* 333 */ "exists_opt",
- /* 334 */ "alter_db_options",
- /* 335 */ "speed_opt",
- /* 336 */ "integer_list",
- /* 337 */ "variable_list",
- /* 338 */ "retention_list",
- /* 339 */ "alter_db_option",
- /* 340 */ "retention",
- /* 341 */ "full_table_name",
- /* 342 */ "column_def_list",
- /* 343 */ "tags_def_opt",
- /* 344 */ "table_options",
- /* 345 */ "multi_create_clause",
- /* 346 */ "tags_def",
- /* 347 */ "multi_drop_clause",
- /* 348 */ "alter_table_clause",
- /* 349 */ "alter_table_options",
- /* 350 */ "column_name",
- /* 351 */ "type_name",
- /* 352 */ "signed_literal",
- /* 353 */ "create_subtable_clause",
- /* 354 */ "specific_cols_opt",
- /* 355 */ "expression_list",
- /* 356 */ "drop_table_clause",
- /* 357 */ "col_name_list",
- /* 358 */ "table_name",
- /* 359 */ "column_def",
- /* 360 */ "duration_list",
- /* 361 */ "rollup_func_list",
- /* 362 */ "alter_table_option",
- /* 363 */ "duration_literal",
- /* 364 */ "rollup_func_name",
- /* 365 */ "function_name",
- /* 366 */ "col_name",
- /* 367 */ "db_name_cond_opt",
- /* 368 */ "like_pattern_opt",
- /* 369 */ "table_name_cond",
- /* 370 */ "from_db_opt",
- /* 371 */ "index_options",
- /* 372 */ "func_list",
- /* 373 */ "sliding_opt",
- /* 374 */ "sma_stream_opt",
- /* 375 */ "func",
- /* 376 */ "stream_options",
- /* 377 */ "topic_name",
- /* 378 */ "query_or_subquery",
- /* 379 */ "cgroup_name",
- /* 380 */ "analyze_opt",
- /* 381 */ "explain_options",
- /* 382 */ "agg_func_opt",
- /* 383 */ "bufsize_opt",
- /* 384 */ "stream_name",
- /* 385 */ "subtable_opt",
- /* 386 */ "expression",
- /* 387 */ "dnode_list",
- /* 388 */ "where_clause_opt",
- /* 389 */ "signed",
- /* 390 */ "literal_func",
- /* 391 */ "literal_list",
- /* 392 */ "table_alias",
- /* 393 */ "column_alias",
- /* 394 */ "expr_or_subquery",
- /* 395 */ "subquery",
- /* 396 */ "pseudo_column",
- /* 397 */ "column_reference",
- /* 398 */ "function_expression",
- /* 399 */ "case_when_expression",
- /* 400 */ "star_func",
- /* 401 */ "star_func_para_list",
- /* 402 */ "noarg_func",
- /* 403 */ "other_para_list",
- /* 404 */ "star_func_para",
- /* 405 */ "when_then_list",
- /* 406 */ "case_when_else_opt",
- /* 407 */ "common_expression",
- /* 408 */ "when_then_expr",
- /* 409 */ "predicate",
- /* 410 */ "compare_op",
- /* 411 */ "in_op",
- /* 412 */ "in_predicate_value",
- /* 413 */ "boolean_value_expression",
- /* 414 */ "boolean_primary",
- /* 415 */ "from_clause_opt",
- /* 416 */ "table_reference_list",
- /* 417 */ "table_reference",
- /* 418 */ "table_primary",
- /* 419 */ "joined_table",
- /* 420 */ "alias_opt",
- /* 421 */ "parenthesized_joined_table",
- /* 422 */ "join_type",
- /* 423 */ "search_condition",
- /* 424 */ "query_specification",
- /* 425 */ "set_quantifier_opt",
- /* 426 */ "select_list",
- /* 427 */ "partition_by_clause_opt",
- /* 428 */ "range_opt",
- /* 429 */ "every_opt",
- /* 430 */ "fill_opt",
- /* 431 */ "twindow_clause_opt",
- /* 432 */ "group_by_clause_opt",
- /* 433 */ "having_clause_opt",
- /* 434 */ "select_item",
- /* 435 */ "partition_list",
- /* 436 */ "partition_item",
- /* 437 */ "fill_mode",
- /* 438 */ "group_by_list",
- /* 439 */ "query_expression",
- /* 440 */ "query_simple",
- /* 441 */ "order_by_clause_opt",
- /* 442 */ "slimit_clause_opt",
- /* 443 */ "limit_clause_opt",
- /* 444 */ "union_query_expression",
- /* 445 */ "query_simple_or_subquery",
- /* 446 */ "sort_specification_list",
- /* 447 */ "sort_specification",
- /* 448 */ "ordering_specification_opt",
- /* 449 */ "null_ordering_opt",
+ /* 51 */ "FORCE",
+ /* 52 */ "LOCAL",
+ /* 53 */ "QNODE",
+ /* 54 */ "BNODE",
+ /* 55 */ "SNODE",
+ /* 56 */ "MNODE",
+ /* 57 */ "DATABASE",
+ /* 58 */ "USE",
+ /* 59 */ "FLUSH",
+ /* 60 */ "TRIM",
+ /* 61 */ "IF",
+ /* 62 */ "NOT",
+ /* 63 */ "EXISTS",
+ /* 64 */ "BUFFER",
+ /* 65 */ "CACHEMODEL",
+ /* 66 */ "CACHESIZE",
+ /* 67 */ "COMP",
+ /* 68 */ "DURATION",
+ /* 69 */ "NK_VARIABLE",
+ /* 70 */ "MAXROWS",
+ /* 71 */ "MINROWS",
+ /* 72 */ "KEEP",
+ /* 73 */ "PAGES",
+ /* 74 */ "PAGESIZE",
+ /* 75 */ "TSDB_PAGESIZE",
+ /* 76 */ "PRECISION",
+ /* 77 */ "REPLICA",
+ /* 78 */ "STRICT",
+ /* 79 */ "VGROUPS",
+ /* 80 */ "SINGLE_STABLE",
+ /* 81 */ "RETENTIONS",
+ /* 82 */ "SCHEMALESS",
+ /* 83 */ "WAL_LEVEL",
+ /* 84 */ "WAL_FSYNC_PERIOD",
+ /* 85 */ "WAL_RETENTION_PERIOD",
+ /* 86 */ "WAL_RETENTION_SIZE",
+ /* 87 */ "WAL_ROLL_PERIOD",
+ /* 88 */ "WAL_SEGMENT_SIZE",
+ /* 89 */ "STT_TRIGGER",
+ /* 90 */ "TABLE_PREFIX",
+ /* 91 */ "TABLE_SUFFIX",
+ /* 92 */ "NK_COLON",
+ /* 93 */ "MAX_SPEED",
+ /* 94 */ "TABLE",
+ /* 95 */ "NK_LP",
+ /* 96 */ "NK_RP",
+ /* 97 */ "STABLE",
+ /* 98 */ "ADD",
+ /* 99 */ "COLUMN",
+ /* 100 */ "MODIFY",
+ /* 101 */ "RENAME",
+ /* 102 */ "TAG",
+ /* 103 */ "SET",
+ /* 104 */ "NK_EQ",
+ /* 105 */ "USING",
+ /* 106 */ "TAGS",
+ /* 107 */ "COMMENT",
+ /* 108 */ "BOOL",
+ /* 109 */ "TINYINT",
+ /* 110 */ "SMALLINT",
+ /* 111 */ "INT",
+ /* 112 */ "INTEGER",
+ /* 113 */ "BIGINT",
+ /* 114 */ "FLOAT",
+ /* 115 */ "DOUBLE",
+ /* 116 */ "BINARY",
+ /* 117 */ "TIMESTAMP",
+ /* 118 */ "NCHAR",
+ /* 119 */ "UNSIGNED",
+ /* 120 */ "JSON",
+ /* 121 */ "VARCHAR",
+ /* 122 */ "MEDIUMBLOB",
+ /* 123 */ "BLOB",
+ /* 124 */ "VARBINARY",
+ /* 125 */ "DECIMAL",
+ /* 126 */ "MAX_DELAY",
+ /* 127 */ "WATERMARK",
+ /* 128 */ "ROLLUP",
+ /* 129 */ "TTL",
+ /* 130 */ "SMA",
+ /* 131 */ "FIRST",
+ /* 132 */ "LAST",
+ /* 133 */ "SHOW",
+ /* 134 */ "DATABASES",
+ /* 135 */ "TABLES",
+ /* 136 */ "STABLES",
+ /* 137 */ "MNODES",
+ /* 138 */ "QNODES",
+ /* 139 */ "FUNCTIONS",
+ /* 140 */ "INDEXES",
+ /* 141 */ "ACCOUNTS",
+ /* 142 */ "APPS",
+ /* 143 */ "CONNECTIONS",
+ /* 144 */ "LICENCES",
+ /* 145 */ "GRANTS",
+ /* 146 */ "QUERIES",
+ /* 147 */ "SCORES",
+ /* 148 */ "TOPICS",
+ /* 149 */ "VARIABLES",
+ /* 150 */ "CLUSTER",
+ /* 151 */ "BNODES",
+ /* 152 */ "SNODES",
+ /* 153 */ "TRANSACTIONS",
+ /* 154 */ "DISTRIBUTED",
+ /* 155 */ "CONSUMERS",
+ /* 156 */ "SUBSCRIPTIONS",
+ /* 157 */ "VNODES",
+ /* 158 */ "LIKE",
+ /* 159 */ "INDEX",
+ /* 160 */ "FUNCTION",
+ /* 161 */ "INTERVAL",
+ /* 162 */ "TOPIC",
+ /* 163 */ "AS",
+ /* 164 */ "WITH",
+ /* 165 */ "META",
+ /* 166 */ "CONSUMER",
+ /* 167 */ "GROUP",
+ /* 168 */ "DESC",
+ /* 169 */ "DESCRIBE",
+ /* 170 */ "RESET",
+ /* 171 */ "QUERY",
+ /* 172 */ "CACHE",
+ /* 173 */ "EXPLAIN",
+ /* 174 */ "ANALYZE",
+ /* 175 */ "VERBOSE",
+ /* 176 */ "NK_BOOL",
+ /* 177 */ "RATIO",
+ /* 178 */ "NK_FLOAT",
+ /* 179 */ "OUTPUTTYPE",
+ /* 180 */ "AGGREGATE",
+ /* 181 */ "BUFSIZE",
+ /* 182 */ "STREAM",
+ /* 183 */ "INTO",
+ /* 184 */ "TRIGGER",
+ /* 185 */ "AT_ONCE",
+ /* 186 */ "WINDOW_CLOSE",
+ /* 187 */ "IGNORE",
+ /* 188 */ "EXPIRED",
+ /* 189 */ "FILL_HISTORY",
+ /* 190 */ "SUBTABLE",
+ /* 191 */ "KILL",
+ /* 192 */ "CONNECTION",
+ /* 193 */ "TRANSACTION",
+ /* 194 */ "BALANCE",
+ /* 195 */ "VGROUP",
+ /* 196 */ "MERGE",
+ /* 197 */ "REDISTRIBUTE",
+ /* 198 */ "SPLIT",
+ /* 199 */ "DELETE",
+ /* 200 */ "INSERT",
+ /* 201 */ "NULL",
+ /* 202 */ "NK_QUESTION",
+ /* 203 */ "NK_ARROW",
+ /* 204 */ "ROWTS",
+ /* 205 */ "TBNAME",
+ /* 206 */ "QSTART",
+ /* 207 */ "QEND",
+ /* 208 */ "QDURATION",
+ /* 209 */ "WSTART",
+ /* 210 */ "WEND",
+ /* 211 */ "WDURATION",
+ /* 212 */ "IROWTS",
+ /* 213 */ "QTAGS",
+ /* 214 */ "CAST",
+ /* 215 */ "NOW",
+ /* 216 */ "TODAY",
+ /* 217 */ "TIMEZONE",
+ /* 218 */ "CLIENT_VERSION",
+ /* 219 */ "SERVER_VERSION",
+ /* 220 */ "SERVER_STATUS",
+ /* 221 */ "CURRENT_USER",
+ /* 222 */ "COUNT",
+ /* 223 */ "LAST_ROW",
+ /* 224 */ "CASE",
+ /* 225 */ "END",
+ /* 226 */ "WHEN",
+ /* 227 */ "THEN",
+ /* 228 */ "ELSE",
+ /* 229 */ "BETWEEN",
+ /* 230 */ "IS",
+ /* 231 */ "NK_LT",
+ /* 232 */ "NK_GT",
+ /* 233 */ "NK_LE",
+ /* 234 */ "NK_GE",
+ /* 235 */ "NK_NE",
+ /* 236 */ "MATCH",
+ /* 237 */ "NMATCH",
+ /* 238 */ "CONTAINS",
+ /* 239 */ "IN",
+ /* 240 */ "JOIN",
+ /* 241 */ "INNER",
+ /* 242 */ "SELECT",
+ /* 243 */ "DISTINCT",
+ /* 244 */ "WHERE",
+ /* 245 */ "PARTITION",
+ /* 246 */ "BY",
+ /* 247 */ "SESSION",
+ /* 248 */ "STATE_WINDOW",
+ /* 249 */ "SLIDING",
+ /* 250 */ "FILL",
+ /* 251 */ "VALUE",
+ /* 252 */ "NONE",
+ /* 253 */ "PREV",
+ /* 254 */ "LINEAR",
+ /* 255 */ "NEXT",
+ /* 256 */ "HAVING",
+ /* 257 */ "RANGE",
+ /* 258 */ "EVERY",
+ /* 259 */ "ORDER",
+ /* 260 */ "SLIMIT",
+ /* 261 */ "SOFFSET",
+ /* 262 */ "LIMIT",
+ /* 263 */ "OFFSET",
+ /* 264 */ "ASC",
+ /* 265 */ "NULLS",
+ /* 266 */ "ABORT",
+ /* 267 */ "AFTER",
+ /* 268 */ "ATTACH",
+ /* 269 */ "BEFORE",
+ /* 270 */ "BEGIN",
+ /* 271 */ "BITAND",
+ /* 272 */ "BITNOT",
+ /* 273 */ "BITOR",
+ /* 274 */ "BLOCKS",
+ /* 275 */ "CHANGE",
+ /* 276 */ "COMMA",
+ /* 277 */ "COMPACT",
+ /* 278 */ "CONCAT",
+ /* 279 */ "CONFLICT",
+ /* 280 */ "COPY",
+ /* 281 */ "DEFERRED",
+ /* 282 */ "DELIMITERS",
+ /* 283 */ "DETACH",
+ /* 284 */ "DIVIDE",
+ /* 285 */ "DOT",
+ /* 286 */ "EACH",
+ /* 287 */ "FAIL",
+ /* 288 */ "FILE",
+ /* 289 */ "FOR",
+ /* 290 */ "GLOB",
+ /* 291 */ "ID",
+ /* 292 */ "IMMEDIATE",
+ /* 293 */ "IMPORT",
+ /* 294 */ "INITIALLY",
+ /* 295 */ "INSTEAD",
+ /* 296 */ "ISNULL",
+ /* 297 */ "KEY",
+ /* 298 */ "MODULES",
+ /* 299 */ "NK_BITNOT",
+ /* 300 */ "NK_SEMI",
+ /* 301 */ "NOTNULL",
+ /* 302 */ "OF",
+ /* 303 */ "PLUS",
+ /* 304 */ "PRIVILEGE",
+ /* 305 */ "RAISE",
+ /* 306 */ "REPLACE",
+ /* 307 */ "RESTRICT",
+ /* 308 */ "ROW",
+ /* 309 */ "SEMI",
+ /* 310 */ "STAR",
+ /* 311 */ "STATEMENT",
+ /* 312 */ "STRING",
+ /* 313 */ "TIMES",
+ /* 314 */ "UPDATE",
+ /* 315 */ "VALUES",
+ /* 316 */ "VARIABLE",
+ /* 317 */ "VIEW",
+ /* 318 */ "WAL",
+ /* 319 */ "cmd",
+ /* 320 */ "account_options",
+ /* 321 */ "alter_account_options",
+ /* 322 */ "literal",
+ /* 323 */ "alter_account_option",
+ /* 324 */ "user_name",
+ /* 325 */ "sysinfo_opt",
+ /* 326 */ "privileges",
+ /* 327 */ "priv_level",
+ /* 328 */ "priv_type_list",
+ /* 329 */ "priv_type",
+ /* 330 */ "db_name",
+ /* 331 */ "dnode_endpoint",
+ /* 332 */ "force_opt",
+ /* 333 */ "not_exists_opt",
+ /* 334 */ "db_options",
+ /* 335 */ "exists_opt",
+ /* 336 */ "alter_db_options",
+ /* 337 */ "speed_opt",
+ /* 338 */ "integer_list",
+ /* 339 */ "variable_list",
+ /* 340 */ "retention_list",
+ /* 341 */ "alter_db_option",
+ /* 342 */ "retention",
+ /* 343 */ "full_table_name",
+ /* 344 */ "column_def_list",
+ /* 345 */ "tags_def_opt",
+ /* 346 */ "table_options",
+ /* 347 */ "multi_create_clause",
+ /* 348 */ "tags_def",
+ /* 349 */ "multi_drop_clause",
+ /* 350 */ "alter_table_clause",
+ /* 351 */ "alter_table_options",
+ /* 352 */ "column_name",
+ /* 353 */ "type_name",
+ /* 354 */ "signed_literal",
+ /* 355 */ "create_subtable_clause",
+ /* 356 */ "specific_cols_opt",
+ /* 357 */ "expression_list",
+ /* 358 */ "drop_table_clause",
+ /* 359 */ "col_name_list",
+ /* 360 */ "table_name",
+ /* 361 */ "column_def",
+ /* 362 */ "duration_list",
+ /* 363 */ "rollup_func_list",
+ /* 364 */ "alter_table_option",
+ /* 365 */ "duration_literal",
+ /* 366 */ "rollup_func_name",
+ /* 367 */ "function_name",
+ /* 368 */ "col_name",
+ /* 369 */ "db_name_cond_opt",
+ /* 370 */ "like_pattern_opt",
+ /* 371 */ "table_name_cond",
+ /* 372 */ "from_db_opt",
+ /* 373 */ "index_options",
+ /* 374 */ "func_list",
+ /* 375 */ "sliding_opt",
+ /* 376 */ "sma_stream_opt",
+ /* 377 */ "func",
+ /* 378 */ "stream_options",
+ /* 379 */ "topic_name",
+ /* 380 */ "query_or_subquery",
+ /* 381 */ "cgroup_name",
+ /* 382 */ "analyze_opt",
+ /* 383 */ "explain_options",
+ /* 384 */ "agg_func_opt",
+ /* 385 */ "bufsize_opt",
+ /* 386 */ "stream_name",
+ /* 387 */ "subtable_opt",
+ /* 388 */ "expression",
+ /* 389 */ "dnode_list",
+ /* 390 */ "where_clause_opt",
+ /* 391 */ "signed",
+ /* 392 */ "literal_func",
+ /* 393 */ "literal_list",
+ /* 394 */ "table_alias",
+ /* 395 */ "column_alias",
+ /* 396 */ "expr_or_subquery",
+ /* 397 */ "subquery",
+ /* 398 */ "pseudo_column",
+ /* 399 */ "column_reference",
+ /* 400 */ "function_expression",
+ /* 401 */ "case_when_expression",
+ /* 402 */ "star_func",
+ /* 403 */ "star_func_para_list",
+ /* 404 */ "noarg_func",
+ /* 405 */ "other_para_list",
+ /* 406 */ "star_func_para",
+ /* 407 */ "when_then_list",
+ /* 408 */ "case_when_else_opt",
+ /* 409 */ "common_expression",
+ /* 410 */ "when_then_expr",
+ /* 411 */ "predicate",
+ /* 412 */ "compare_op",
+ /* 413 */ "in_op",
+ /* 414 */ "in_predicate_value",
+ /* 415 */ "boolean_value_expression",
+ /* 416 */ "boolean_primary",
+ /* 417 */ "from_clause_opt",
+ /* 418 */ "table_reference_list",
+ /* 419 */ "table_reference",
+ /* 420 */ "table_primary",
+ /* 421 */ "joined_table",
+ /* 422 */ "alias_opt",
+ /* 423 */ "parenthesized_joined_table",
+ /* 424 */ "join_type",
+ /* 425 */ "search_condition",
+ /* 426 */ "query_specification",
+ /* 427 */ "set_quantifier_opt",
+ /* 428 */ "select_list",
+ /* 429 */ "partition_by_clause_opt",
+ /* 430 */ "range_opt",
+ /* 431 */ "every_opt",
+ /* 432 */ "fill_opt",
+ /* 433 */ "twindow_clause_opt",
+ /* 434 */ "group_by_clause_opt",
+ /* 435 */ "having_clause_opt",
+ /* 436 */ "select_item",
+ /* 437 */ "partition_list",
+ /* 438 */ "partition_item",
+ /* 439 */ "fill_mode",
+ /* 440 */ "group_by_list",
+ /* 441 */ "query_expression",
+ /* 442 */ "query_simple",
+ /* 443 */ "order_by_clause_opt",
+ /* 444 */ "slimit_clause_opt",
+ /* 445 */ "limit_clause_opt",
+ /* 446 */ "union_query_expression",
+ /* 447 */ "query_simple_or_subquery",
+ /* 448 */ "sort_specification_list",
+ /* 449 */ "sort_specification",
+ /* 450 */ "ordering_specification_opt",
+ /* 451 */ "null_ordering_opt",
};
#endif /* defined(YYCOVERAGE) || !defined(NDEBUG) */
@@ -1887,8 +1998,8 @@ static const char *const yyRuleName[] = {
/* 40 */ "priv_level ::= db_name NK_DOT NK_STAR",
/* 41 */ "cmd ::= CREATE DNODE dnode_endpoint",
/* 42 */ "cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER",
- /* 43 */ "cmd ::= DROP DNODE NK_INTEGER",
- /* 44 */ "cmd ::= DROP DNODE dnode_endpoint",
+ /* 43 */ "cmd ::= DROP DNODE NK_INTEGER force_opt",
+ /* 44 */ "cmd ::= DROP DNODE dnode_endpoint force_opt",
/* 45 */ "cmd ::= ALTER DNODE NK_INTEGER NK_STRING",
/* 46 */ "cmd ::= ALTER DNODE NK_INTEGER NK_STRING NK_STRING",
/* 47 */ "cmd ::= ALTER ALL DNODES NK_STRING",
@@ -1896,480 +2007,482 @@ static const char *const yyRuleName[] = {
/* 49 */ "dnode_endpoint ::= NK_STRING",
/* 50 */ "dnode_endpoint ::= NK_ID",
/* 51 */ "dnode_endpoint ::= NK_IPTOKEN",
- /* 52 */ "cmd ::= ALTER LOCAL NK_STRING",
- /* 53 */ "cmd ::= ALTER LOCAL NK_STRING NK_STRING",
- /* 54 */ "cmd ::= CREATE QNODE ON DNODE NK_INTEGER",
- /* 55 */ "cmd ::= DROP QNODE ON DNODE NK_INTEGER",
- /* 56 */ "cmd ::= CREATE BNODE ON DNODE NK_INTEGER",
- /* 57 */ "cmd ::= DROP BNODE ON DNODE NK_INTEGER",
- /* 58 */ "cmd ::= CREATE SNODE ON DNODE NK_INTEGER",
- /* 59 */ "cmd ::= DROP SNODE ON DNODE NK_INTEGER",
- /* 60 */ "cmd ::= CREATE MNODE ON DNODE NK_INTEGER",
- /* 61 */ "cmd ::= DROP MNODE ON DNODE NK_INTEGER",
- /* 62 */ "cmd ::= CREATE DATABASE not_exists_opt db_name db_options",
- /* 63 */ "cmd ::= DROP DATABASE exists_opt db_name",
- /* 64 */ "cmd ::= USE db_name",
- /* 65 */ "cmd ::= ALTER DATABASE db_name alter_db_options",
- /* 66 */ "cmd ::= FLUSH DATABASE db_name",
- /* 67 */ "cmd ::= TRIM DATABASE db_name speed_opt",
- /* 68 */ "not_exists_opt ::= IF NOT EXISTS",
- /* 69 */ "not_exists_opt ::=",
- /* 70 */ "exists_opt ::= IF EXISTS",
- /* 71 */ "exists_opt ::=",
- /* 72 */ "db_options ::=",
- /* 73 */ "db_options ::= db_options BUFFER NK_INTEGER",
- /* 74 */ "db_options ::= db_options CACHEMODEL NK_STRING",
- /* 75 */ "db_options ::= db_options CACHESIZE NK_INTEGER",
- /* 76 */ "db_options ::= db_options COMP NK_INTEGER",
- /* 77 */ "db_options ::= db_options DURATION NK_INTEGER",
- /* 78 */ "db_options ::= db_options DURATION NK_VARIABLE",
- /* 79 */ "db_options ::= db_options MAXROWS NK_INTEGER",
- /* 80 */ "db_options ::= db_options MINROWS NK_INTEGER",
- /* 81 */ "db_options ::= db_options KEEP integer_list",
- /* 82 */ "db_options ::= db_options KEEP variable_list",
- /* 83 */ "db_options ::= db_options PAGES NK_INTEGER",
- /* 84 */ "db_options ::= db_options PAGESIZE NK_INTEGER",
- /* 85 */ "db_options ::= db_options TSDB_PAGESIZE NK_INTEGER",
- /* 86 */ "db_options ::= db_options PRECISION NK_STRING",
- /* 87 */ "db_options ::= db_options REPLICA NK_INTEGER",
- /* 88 */ "db_options ::= db_options STRICT NK_STRING",
- /* 89 */ "db_options ::= db_options VGROUPS NK_INTEGER",
- /* 90 */ "db_options ::= db_options SINGLE_STABLE NK_INTEGER",
- /* 91 */ "db_options ::= db_options RETENTIONS retention_list",
- /* 92 */ "db_options ::= db_options SCHEMALESS NK_INTEGER",
- /* 93 */ "db_options ::= db_options WAL_LEVEL NK_INTEGER",
- /* 94 */ "db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER",
- /* 95 */ "db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER",
- /* 96 */ "db_options ::= db_options WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER",
- /* 97 */ "db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER",
- /* 98 */ "db_options ::= db_options WAL_RETENTION_SIZE NK_MINUS NK_INTEGER",
- /* 99 */ "db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER",
- /* 100 */ "db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER",
- /* 101 */ "db_options ::= db_options STT_TRIGGER NK_INTEGER",
- /* 102 */ "db_options ::= db_options TABLE_PREFIX NK_INTEGER",
- /* 103 */ "db_options ::= db_options TABLE_SUFFIX NK_INTEGER",
- /* 104 */ "alter_db_options ::= alter_db_option",
- /* 105 */ "alter_db_options ::= alter_db_options alter_db_option",
- /* 106 */ "alter_db_option ::= BUFFER NK_INTEGER",
- /* 107 */ "alter_db_option ::= CACHEMODEL NK_STRING",
- /* 108 */ "alter_db_option ::= CACHESIZE NK_INTEGER",
- /* 109 */ "alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER",
- /* 110 */ "alter_db_option ::= KEEP integer_list",
- /* 111 */ "alter_db_option ::= KEEP variable_list",
- /* 112 */ "alter_db_option ::= PAGES NK_INTEGER",
- /* 113 */ "alter_db_option ::= REPLICA NK_INTEGER",
- /* 114 */ "alter_db_option ::= STRICT NK_STRING",
- /* 115 */ "alter_db_option ::= WAL_LEVEL NK_INTEGER",
- /* 116 */ "alter_db_option ::= STT_TRIGGER NK_INTEGER",
- /* 117 */ "integer_list ::= NK_INTEGER",
- /* 118 */ "integer_list ::= integer_list NK_COMMA NK_INTEGER",
- /* 119 */ "variable_list ::= NK_VARIABLE",
- /* 120 */ "variable_list ::= variable_list NK_COMMA NK_VARIABLE",
- /* 121 */ "retention_list ::= retention",
- /* 122 */ "retention_list ::= retention_list NK_COMMA retention",
- /* 123 */ "retention ::= NK_VARIABLE NK_COLON NK_VARIABLE",
- /* 124 */ "speed_opt ::=",
- /* 125 */ "speed_opt ::= MAX_SPEED NK_INTEGER",
- /* 126 */ "cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options",
- /* 127 */ "cmd ::= CREATE TABLE multi_create_clause",
- /* 128 */ "cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options",
- /* 129 */ "cmd ::= DROP TABLE multi_drop_clause",
- /* 130 */ "cmd ::= DROP STABLE exists_opt full_table_name",
- /* 131 */ "cmd ::= ALTER TABLE alter_table_clause",
- /* 132 */ "cmd ::= ALTER STABLE alter_table_clause",
- /* 133 */ "alter_table_clause ::= full_table_name alter_table_options",
- /* 134 */ "alter_table_clause ::= full_table_name ADD COLUMN column_name type_name",
- /* 135 */ "alter_table_clause ::= full_table_name DROP COLUMN column_name",
- /* 136 */ "alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name",
- /* 137 */ "alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name",
- /* 138 */ "alter_table_clause ::= full_table_name ADD TAG column_name type_name",
- /* 139 */ "alter_table_clause ::= full_table_name DROP TAG column_name",
- /* 140 */ "alter_table_clause ::= full_table_name MODIFY TAG column_name type_name",
- /* 141 */ "alter_table_clause ::= full_table_name RENAME TAG column_name column_name",
- /* 142 */ "alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal",
- /* 143 */ "multi_create_clause ::= create_subtable_clause",
- /* 144 */ "multi_create_clause ::= multi_create_clause create_subtable_clause",
- /* 145 */ "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",
- /* 146 */ "multi_drop_clause ::= drop_table_clause",
- /* 147 */ "multi_drop_clause ::= multi_drop_clause drop_table_clause",
- /* 148 */ "drop_table_clause ::= exists_opt full_table_name",
- /* 149 */ "specific_cols_opt ::=",
- /* 150 */ "specific_cols_opt ::= NK_LP col_name_list NK_RP",
- /* 151 */ "full_table_name ::= table_name",
- /* 152 */ "full_table_name ::= db_name NK_DOT table_name",
- /* 153 */ "column_def_list ::= column_def",
- /* 154 */ "column_def_list ::= column_def_list NK_COMMA column_def",
- /* 155 */ "column_def ::= column_name type_name",
- /* 156 */ "column_def ::= column_name type_name COMMENT NK_STRING",
- /* 157 */ "type_name ::= BOOL",
- /* 158 */ "type_name ::= TINYINT",
- /* 159 */ "type_name ::= SMALLINT",
- /* 160 */ "type_name ::= INT",
- /* 161 */ "type_name ::= INTEGER",
- /* 162 */ "type_name ::= BIGINT",
- /* 163 */ "type_name ::= FLOAT",
- /* 164 */ "type_name ::= DOUBLE",
- /* 165 */ "type_name ::= BINARY NK_LP NK_INTEGER NK_RP",
- /* 166 */ "type_name ::= TIMESTAMP",
- /* 167 */ "type_name ::= NCHAR NK_LP NK_INTEGER NK_RP",
- /* 168 */ "type_name ::= TINYINT UNSIGNED",
- /* 169 */ "type_name ::= SMALLINT UNSIGNED",
- /* 170 */ "type_name ::= INT UNSIGNED",
- /* 171 */ "type_name ::= BIGINT UNSIGNED",
- /* 172 */ "type_name ::= JSON",
- /* 173 */ "type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP",
- /* 174 */ "type_name ::= MEDIUMBLOB",
- /* 175 */ "type_name ::= BLOB",
- /* 176 */ "type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP",
- /* 177 */ "type_name ::= DECIMAL",
- /* 178 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP",
- /* 179 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP",
- /* 180 */ "tags_def_opt ::=",
- /* 181 */ "tags_def_opt ::= tags_def",
- /* 182 */ "tags_def ::= TAGS NK_LP column_def_list NK_RP",
- /* 183 */ "table_options ::=",
- /* 184 */ "table_options ::= table_options COMMENT NK_STRING",
- /* 185 */ "table_options ::= table_options MAX_DELAY duration_list",
- /* 186 */ "table_options ::= table_options WATERMARK duration_list",
- /* 187 */ "table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP",
- /* 188 */ "table_options ::= table_options TTL NK_INTEGER",
- /* 189 */ "table_options ::= table_options SMA NK_LP col_name_list NK_RP",
- /* 190 */ "alter_table_options ::= alter_table_option",
- /* 191 */ "alter_table_options ::= alter_table_options alter_table_option",
- /* 192 */ "alter_table_option ::= COMMENT NK_STRING",
- /* 193 */ "alter_table_option ::= TTL NK_INTEGER",
- /* 194 */ "duration_list ::= duration_literal",
- /* 195 */ "duration_list ::= duration_list NK_COMMA duration_literal",
- /* 196 */ "rollup_func_list ::= rollup_func_name",
- /* 197 */ "rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name",
- /* 198 */ "rollup_func_name ::= function_name",
- /* 199 */ "rollup_func_name ::= FIRST",
- /* 200 */ "rollup_func_name ::= LAST",
- /* 201 */ "col_name_list ::= col_name",
- /* 202 */ "col_name_list ::= col_name_list NK_COMMA col_name",
- /* 203 */ "col_name ::= column_name",
- /* 204 */ "cmd ::= SHOW DNODES",
- /* 205 */ "cmd ::= SHOW USERS",
- /* 206 */ "cmd ::= SHOW DATABASES",
- /* 207 */ "cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt",
- /* 208 */ "cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt",
- /* 209 */ "cmd ::= SHOW db_name_cond_opt VGROUPS",
- /* 210 */ "cmd ::= SHOW MNODES",
- /* 211 */ "cmd ::= SHOW QNODES",
- /* 212 */ "cmd ::= SHOW FUNCTIONS",
- /* 213 */ "cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt",
- /* 214 */ "cmd ::= SHOW STREAMS",
- /* 215 */ "cmd ::= SHOW ACCOUNTS",
- /* 216 */ "cmd ::= SHOW APPS",
- /* 217 */ "cmd ::= SHOW CONNECTIONS",
- /* 218 */ "cmd ::= SHOW LICENCES",
- /* 219 */ "cmd ::= SHOW GRANTS",
- /* 220 */ "cmd ::= SHOW CREATE DATABASE db_name",
- /* 221 */ "cmd ::= SHOW CREATE TABLE full_table_name",
- /* 222 */ "cmd ::= SHOW CREATE STABLE full_table_name",
- /* 223 */ "cmd ::= SHOW QUERIES",
- /* 224 */ "cmd ::= SHOW SCORES",
- /* 225 */ "cmd ::= SHOW TOPICS",
- /* 226 */ "cmd ::= SHOW VARIABLES",
- /* 227 */ "cmd ::= SHOW CLUSTER VARIABLES",
- /* 228 */ "cmd ::= SHOW LOCAL VARIABLES",
- /* 229 */ "cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt",
- /* 230 */ "cmd ::= SHOW BNODES",
- /* 231 */ "cmd ::= SHOW SNODES",
- /* 232 */ "cmd ::= SHOW CLUSTER",
- /* 233 */ "cmd ::= SHOW TRANSACTIONS",
- /* 234 */ "cmd ::= SHOW TABLE DISTRIBUTED full_table_name",
- /* 235 */ "cmd ::= SHOW CONSUMERS",
- /* 236 */ "cmd ::= SHOW SUBSCRIPTIONS",
- /* 237 */ "cmd ::= SHOW TAGS FROM table_name_cond from_db_opt",
- /* 238 */ "cmd ::= SHOW TABLE TAGS FROM table_name_cond from_db_opt",
- /* 239 */ "cmd ::= SHOW VNODES NK_INTEGER",
- /* 240 */ "cmd ::= SHOW VNODES NK_STRING",
- /* 241 */ "db_name_cond_opt ::=",
- /* 242 */ "db_name_cond_opt ::= db_name NK_DOT",
- /* 243 */ "like_pattern_opt ::=",
- /* 244 */ "like_pattern_opt ::= LIKE NK_STRING",
- /* 245 */ "table_name_cond ::= table_name",
- /* 246 */ "from_db_opt ::=",
- /* 247 */ "from_db_opt ::= FROM db_name",
- /* 248 */ "cmd ::= CREATE SMA INDEX not_exists_opt full_table_name ON full_table_name index_options",
- /* 249 */ "cmd ::= DROP INDEX exists_opt full_table_name",
- /* 250 */ "index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt",
- /* 251 */ "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",
- /* 252 */ "func_list ::= func",
- /* 253 */ "func_list ::= func_list NK_COMMA func",
- /* 254 */ "func ::= function_name NK_LP expression_list NK_RP",
- /* 255 */ "sma_stream_opt ::=",
- /* 256 */ "sma_stream_opt ::= stream_options WATERMARK duration_literal",
- /* 257 */ "sma_stream_opt ::= stream_options MAX_DELAY duration_literal",
- /* 258 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery",
- /* 259 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name",
- /* 260 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name",
- /* 261 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name",
- /* 262 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name",
- /* 263 */ "cmd ::= DROP TOPIC exists_opt topic_name",
- /* 264 */ "cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name",
- /* 265 */ "cmd ::= DESC full_table_name",
- /* 266 */ "cmd ::= DESCRIBE full_table_name",
- /* 267 */ "cmd ::= RESET QUERY CACHE",
- /* 268 */ "cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery",
- /* 269 */ "analyze_opt ::=",
- /* 270 */ "analyze_opt ::= ANALYZE",
- /* 271 */ "explain_options ::=",
- /* 272 */ "explain_options ::= explain_options VERBOSE NK_BOOL",
- /* 273 */ "explain_options ::= explain_options RATIO NK_FLOAT",
- /* 274 */ "cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt",
- /* 275 */ "cmd ::= DROP FUNCTION exists_opt function_name",
- /* 276 */ "agg_func_opt ::=",
- /* 277 */ "agg_func_opt ::= AGGREGATE",
- /* 278 */ "bufsize_opt ::=",
- /* 279 */ "bufsize_opt ::= BUFSIZE NK_INTEGER",
- /* 280 */ "cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name tags_def_opt subtable_opt AS query_or_subquery",
- /* 281 */ "cmd ::= DROP STREAM exists_opt stream_name",
- /* 282 */ "stream_options ::=",
- /* 283 */ "stream_options ::= stream_options TRIGGER AT_ONCE",
- /* 284 */ "stream_options ::= stream_options TRIGGER WINDOW_CLOSE",
- /* 285 */ "stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal",
- /* 286 */ "stream_options ::= stream_options WATERMARK duration_literal",
- /* 287 */ "stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER",
- /* 288 */ "stream_options ::= stream_options FILL_HISTORY NK_INTEGER",
- /* 289 */ "subtable_opt ::=",
- /* 290 */ "subtable_opt ::= SUBTABLE NK_LP expression NK_RP",
- /* 291 */ "cmd ::= KILL CONNECTION NK_INTEGER",
- /* 292 */ "cmd ::= KILL QUERY NK_STRING",
- /* 293 */ "cmd ::= KILL TRANSACTION NK_INTEGER",
- /* 294 */ "cmd ::= BALANCE VGROUP",
- /* 295 */ "cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER",
- /* 296 */ "cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list",
- /* 297 */ "cmd ::= SPLIT VGROUP NK_INTEGER",
- /* 298 */ "dnode_list ::= DNODE NK_INTEGER",
- /* 299 */ "dnode_list ::= dnode_list DNODE NK_INTEGER",
- /* 300 */ "cmd ::= DELETE FROM full_table_name where_clause_opt",
- /* 301 */ "cmd ::= query_or_subquery",
- /* 302 */ "cmd ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery",
- /* 303 */ "cmd ::= INSERT INTO full_table_name query_or_subquery",
- /* 304 */ "literal ::= NK_INTEGER",
- /* 305 */ "literal ::= NK_FLOAT",
- /* 306 */ "literal ::= NK_STRING",
- /* 307 */ "literal ::= NK_BOOL",
- /* 308 */ "literal ::= TIMESTAMP NK_STRING",
- /* 309 */ "literal ::= duration_literal",
- /* 310 */ "literal ::= NULL",
- /* 311 */ "literal ::= NK_QUESTION",
- /* 312 */ "duration_literal ::= NK_VARIABLE",
- /* 313 */ "signed ::= NK_INTEGER",
- /* 314 */ "signed ::= NK_PLUS NK_INTEGER",
- /* 315 */ "signed ::= NK_MINUS NK_INTEGER",
- /* 316 */ "signed ::= NK_FLOAT",
- /* 317 */ "signed ::= NK_PLUS NK_FLOAT",
- /* 318 */ "signed ::= NK_MINUS NK_FLOAT",
- /* 319 */ "signed_literal ::= signed",
- /* 320 */ "signed_literal ::= NK_STRING",
- /* 321 */ "signed_literal ::= NK_BOOL",
- /* 322 */ "signed_literal ::= TIMESTAMP NK_STRING",
- /* 323 */ "signed_literal ::= duration_literal",
- /* 324 */ "signed_literal ::= NULL",
- /* 325 */ "signed_literal ::= literal_func",
- /* 326 */ "signed_literal ::= NK_QUESTION",
- /* 327 */ "literal_list ::= signed_literal",
- /* 328 */ "literal_list ::= literal_list NK_COMMA signed_literal",
- /* 329 */ "db_name ::= NK_ID",
- /* 330 */ "table_name ::= NK_ID",
- /* 331 */ "column_name ::= NK_ID",
- /* 332 */ "function_name ::= NK_ID",
- /* 333 */ "table_alias ::= NK_ID",
- /* 334 */ "column_alias ::= NK_ID",
- /* 335 */ "user_name ::= NK_ID",
- /* 336 */ "topic_name ::= NK_ID",
- /* 337 */ "stream_name ::= NK_ID",
- /* 338 */ "cgroup_name ::= NK_ID",
- /* 339 */ "expr_or_subquery ::= expression",
- /* 340 */ "expr_or_subquery ::= subquery",
- /* 341 */ "expression ::= literal",
- /* 342 */ "expression ::= pseudo_column",
- /* 343 */ "expression ::= column_reference",
- /* 344 */ "expression ::= function_expression",
- /* 345 */ "expression ::= case_when_expression",
- /* 346 */ "expression ::= NK_LP expression NK_RP",
- /* 347 */ "expression ::= NK_PLUS expr_or_subquery",
- /* 348 */ "expression ::= NK_MINUS expr_or_subquery",
- /* 349 */ "expression ::= expr_or_subquery NK_PLUS expr_or_subquery",
- /* 350 */ "expression ::= expr_or_subquery NK_MINUS expr_or_subquery",
- /* 351 */ "expression ::= expr_or_subquery NK_STAR expr_or_subquery",
- /* 352 */ "expression ::= expr_or_subquery NK_SLASH expr_or_subquery",
- /* 353 */ "expression ::= expr_or_subquery NK_REM expr_or_subquery",
- /* 354 */ "expression ::= column_reference NK_ARROW NK_STRING",
- /* 355 */ "expression ::= expr_or_subquery NK_BITAND expr_or_subquery",
- /* 356 */ "expression ::= expr_or_subquery NK_BITOR expr_or_subquery",
- /* 357 */ "expression_list ::= expr_or_subquery",
- /* 358 */ "expression_list ::= expression_list NK_COMMA expr_or_subquery",
- /* 359 */ "column_reference ::= column_name",
- /* 360 */ "column_reference ::= table_name NK_DOT column_name",
- /* 361 */ "pseudo_column ::= ROWTS",
- /* 362 */ "pseudo_column ::= TBNAME",
- /* 363 */ "pseudo_column ::= table_name NK_DOT TBNAME",
- /* 364 */ "pseudo_column ::= QSTART",
- /* 365 */ "pseudo_column ::= QEND",
- /* 366 */ "pseudo_column ::= QDURATION",
- /* 367 */ "pseudo_column ::= WSTART",
- /* 368 */ "pseudo_column ::= WEND",
- /* 369 */ "pseudo_column ::= WDURATION",
- /* 370 */ "pseudo_column ::= IROWTS",
- /* 371 */ "pseudo_column ::= QTAGS",
- /* 372 */ "function_expression ::= function_name NK_LP expression_list NK_RP",
- /* 373 */ "function_expression ::= star_func NK_LP star_func_para_list NK_RP",
- /* 374 */ "function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP",
- /* 375 */ "function_expression ::= literal_func",
- /* 376 */ "literal_func ::= noarg_func NK_LP NK_RP",
- /* 377 */ "literal_func ::= NOW",
- /* 378 */ "noarg_func ::= NOW",
- /* 379 */ "noarg_func ::= TODAY",
- /* 380 */ "noarg_func ::= TIMEZONE",
- /* 381 */ "noarg_func ::= DATABASE",
- /* 382 */ "noarg_func ::= CLIENT_VERSION",
- /* 383 */ "noarg_func ::= SERVER_VERSION",
- /* 384 */ "noarg_func ::= SERVER_STATUS",
- /* 385 */ "noarg_func ::= CURRENT_USER",
- /* 386 */ "noarg_func ::= USER",
- /* 387 */ "star_func ::= COUNT",
- /* 388 */ "star_func ::= FIRST",
- /* 389 */ "star_func ::= LAST",
- /* 390 */ "star_func ::= LAST_ROW",
- /* 391 */ "star_func_para_list ::= NK_STAR",
- /* 392 */ "star_func_para_list ::= other_para_list",
- /* 393 */ "other_para_list ::= star_func_para",
- /* 394 */ "other_para_list ::= other_para_list NK_COMMA star_func_para",
- /* 395 */ "star_func_para ::= expr_or_subquery",
- /* 396 */ "star_func_para ::= table_name NK_DOT NK_STAR",
- /* 397 */ "case_when_expression ::= CASE when_then_list case_when_else_opt END",
- /* 398 */ "case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END",
- /* 399 */ "when_then_list ::= when_then_expr",
- /* 400 */ "when_then_list ::= when_then_list when_then_expr",
- /* 401 */ "when_then_expr ::= WHEN common_expression THEN common_expression",
- /* 402 */ "case_when_else_opt ::=",
- /* 403 */ "case_when_else_opt ::= ELSE common_expression",
- /* 404 */ "predicate ::= expr_or_subquery compare_op expr_or_subquery",
- /* 405 */ "predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery",
- /* 406 */ "predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery",
- /* 407 */ "predicate ::= expr_or_subquery IS NULL",
- /* 408 */ "predicate ::= expr_or_subquery IS NOT NULL",
- /* 409 */ "predicate ::= expr_or_subquery in_op in_predicate_value",
- /* 410 */ "compare_op ::= NK_LT",
- /* 411 */ "compare_op ::= NK_GT",
- /* 412 */ "compare_op ::= NK_LE",
- /* 413 */ "compare_op ::= NK_GE",
- /* 414 */ "compare_op ::= NK_NE",
- /* 415 */ "compare_op ::= NK_EQ",
- /* 416 */ "compare_op ::= LIKE",
- /* 417 */ "compare_op ::= NOT LIKE",
- /* 418 */ "compare_op ::= MATCH",
- /* 419 */ "compare_op ::= NMATCH",
- /* 420 */ "compare_op ::= CONTAINS",
- /* 421 */ "in_op ::= IN",
- /* 422 */ "in_op ::= NOT IN",
- /* 423 */ "in_predicate_value ::= NK_LP literal_list NK_RP",
- /* 424 */ "boolean_value_expression ::= boolean_primary",
- /* 425 */ "boolean_value_expression ::= NOT boolean_primary",
- /* 426 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression",
- /* 427 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression",
- /* 428 */ "boolean_primary ::= predicate",
- /* 429 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP",
- /* 430 */ "common_expression ::= expr_or_subquery",
- /* 431 */ "common_expression ::= boolean_value_expression",
- /* 432 */ "from_clause_opt ::=",
- /* 433 */ "from_clause_opt ::= FROM table_reference_list",
- /* 434 */ "table_reference_list ::= table_reference",
- /* 435 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference",
- /* 436 */ "table_reference ::= table_primary",
- /* 437 */ "table_reference ::= joined_table",
- /* 438 */ "table_primary ::= table_name alias_opt",
- /* 439 */ "table_primary ::= db_name NK_DOT table_name alias_opt",
- /* 440 */ "table_primary ::= subquery alias_opt",
- /* 441 */ "table_primary ::= parenthesized_joined_table",
- /* 442 */ "alias_opt ::=",
- /* 443 */ "alias_opt ::= table_alias",
- /* 444 */ "alias_opt ::= AS table_alias",
- /* 445 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP",
- /* 446 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP",
- /* 447 */ "joined_table ::= table_reference join_type JOIN table_reference ON search_condition",
- /* 448 */ "join_type ::=",
- /* 449 */ "join_type ::= INNER",
- /* 450 */ "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",
- /* 451 */ "set_quantifier_opt ::=",
- /* 452 */ "set_quantifier_opt ::= DISTINCT",
- /* 453 */ "set_quantifier_opt ::= ALL",
- /* 454 */ "select_list ::= select_item",
- /* 455 */ "select_list ::= select_list NK_COMMA select_item",
- /* 456 */ "select_item ::= NK_STAR",
- /* 457 */ "select_item ::= common_expression",
- /* 458 */ "select_item ::= common_expression column_alias",
- /* 459 */ "select_item ::= common_expression AS column_alias",
- /* 460 */ "select_item ::= table_name NK_DOT NK_STAR",
- /* 461 */ "where_clause_opt ::=",
- /* 462 */ "where_clause_opt ::= WHERE search_condition",
- /* 463 */ "partition_by_clause_opt ::=",
- /* 464 */ "partition_by_clause_opt ::= PARTITION BY partition_list",
- /* 465 */ "partition_list ::= partition_item",
- /* 466 */ "partition_list ::= partition_list NK_COMMA partition_item",
- /* 467 */ "partition_item ::= expr_or_subquery",
- /* 468 */ "partition_item ::= expr_or_subquery column_alias",
- /* 469 */ "partition_item ::= expr_or_subquery AS column_alias",
- /* 470 */ "twindow_clause_opt ::=",
- /* 471 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP",
- /* 472 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP",
- /* 473 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt",
- /* 474 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt",
- /* 475 */ "sliding_opt ::=",
- /* 476 */ "sliding_opt ::= SLIDING NK_LP duration_literal NK_RP",
- /* 477 */ "fill_opt ::=",
- /* 478 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP",
- /* 479 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP",
- /* 480 */ "fill_mode ::= NONE",
- /* 481 */ "fill_mode ::= PREV",
- /* 482 */ "fill_mode ::= NULL",
- /* 483 */ "fill_mode ::= LINEAR",
- /* 484 */ "fill_mode ::= NEXT",
- /* 485 */ "group_by_clause_opt ::=",
- /* 486 */ "group_by_clause_opt ::= GROUP BY group_by_list",
- /* 487 */ "group_by_list ::= expr_or_subquery",
- /* 488 */ "group_by_list ::= group_by_list NK_COMMA expr_or_subquery",
- /* 489 */ "having_clause_opt ::=",
- /* 490 */ "having_clause_opt ::= HAVING search_condition",
- /* 491 */ "range_opt ::=",
- /* 492 */ "range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP",
- /* 493 */ "every_opt ::=",
- /* 494 */ "every_opt ::= EVERY NK_LP duration_literal NK_RP",
- /* 495 */ "query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt",
- /* 496 */ "query_simple ::= query_specification",
- /* 497 */ "query_simple ::= union_query_expression",
- /* 498 */ "union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery",
- /* 499 */ "union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery",
- /* 500 */ "query_simple_or_subquery ::= query_simple",
- /* 501 */ "query_simple_or_subquery ::= subquery",
- /* 502 */ "query_or_subquery ::= query_expression",
- /* 503 */ "query_or_subquery ::= subquery",
- /* 504 */ "order_by_clause_opt ::=",
- /* 505 */ "order_by_clause_opt ::= ORDER BY sort_specification_list",
- /* 506 */ "slimit_clause_opt ::=",
- /* 507 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER",
- /* 508 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER",
- /* 509 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER",
- /* 510 */ "limit_clause_opt ::=",
- /* 511 */ "limit_clause_opt ::= LIMIT NK_INTEGER",
- /* 512 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER",
- /* 513 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER",
- /* 514 */ "subquery ::= NK_LP query_expression NK_RP",
- /* 515 */ "subquery ::= NK_LP subquery NK_RP",
- /* 516 */ "search_condition ::= common_expression",
- /* 517 */ "sort_specification_list ::= sort_specification",
- /* 518 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification",
- /* 519 */ "sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt",
- /* 520 */ "ordering_specification_opt ::=",
- /* 521 */ "ordering_specification_opt ::= ASC",
- /* 522 */ "ordering_specification_opt ::= DESC",
- /* 523 */ "null_ordering_opt ::=",
- /* 524 */ "null_ordering_opt ::= NULLS FIRST",
- /* 525 */ "null_ordering_opt ::= NULLS LAST",
+ /* 52 */ "force_opt ::=",
+ /* 53 */ "force_opt ::= FORCE",
+ /* 54 */ "cmd ::= ALTER LOCAL NK_STRING",
+ /* 55 */ "cmd ::= ALTER LOCAL NK_STRING NK_STRING",
+ /* 56 */ "cmd ::= CREATE QNODE ON DNODE NK_INTEGER",
+ /* 57 */ "cmd ::= DROP QNODE ON DNODE NK_INTEGER",
+ /* 58 */ "cmd ::= CREATE BNODE ON DNODE NK_INTEGER",
+ /* 59 */ "cmd ::= DROP BNODE ON DNODE NK_INTEGER",
+ /* 60 */ "cmd ::= CREATE SNODE ON DNODE NK_INTEGER",
+ /* 61 */ "cmd ::= DROP SNODE ON DNODE NK_INTEGER",
+ /* 62 */ "cmd ::= CREATE MNODE ON DNODE NK_INTEGER",
+ /* 63 */ "cmd ::= DROP MNODE ON DNODE NK_INTEGER",
+ /* 64 */ "cmd ::= CREATE DATABASE not_exists_opt db_name db_options",
+ /* 65 */ "cmd ::= DROP DATABASE exists_opt db_name",
+ /* 66 */ "cmd ::= USE db_name",
+ /* 67 */ "cmd ::= ALTER DATABASE db_name alter_db_options",
+ /* 68 */ "cmd ::= FLUSH DATABASE db_name",
+ /* 69 */ "cmd ::= TRIM DATABASE db_name speed_opt",
+ /* 70 */ "not_exists_opt ::= IF NOT EXISTS",
+ /* 71 */ "not_exists_opt ::=",
+ /* 72 */ "exists_opt ::= IF EXISTS",
+ /* 73 */ "exists_opt ::=",
+ /* 74 */ "db_options ::=",
+ /* 75 */ "db_options ::= db_options BUFFER NK_INTEGER",
+ /* 76 */ "db_options ::= db_options CACHEMODEL NK_STRING",
+ /* 77 */ "db_options ::= db_options CACHESIZE NK_INTEGER",
+ /* 78 */ "db_options ::= db_options COMP NK_INTEGER",
+ /* 79 */ "db_options ::= db_options DURATION NK_INTEGER",
+ /* 80 */ "db_options ::= db_options DURATION NK_VARIABLE",
+ /* 81 */ "db_options ::= db_options MAXROWS NK_INTEGER",
+ /* 82 */ "db_options ::= db_options MINROWS NK_INTEGER",
+ /* 83 */ "db_options ::= db_options KEEP integer_list",
+ /* 84 */ "db_options ::= db_options KEEP variable_list",
+ /* 85 */ "db_options ::= db_options PAGES NK_INTEGER",
+ /* 86 */ "db_options ::= db_options PAGESIZE NK_INTEGER",
+ /* 87 */ "db_options ::= db_options TSDB_PAGESIZE NK_INTEGER",
+ /* 88 */ "db_options ::= db_options PRECISION NK_STRING",
+ /* 89 */ "db_options ::= db_options REPLICA NK_INTEGER",
+ /* 90 */ "db_options ::= db_options STRICT NK_STRING",
+ /* 91 */ "db_options ::= db_options VGROUPS NK_INTEGER",
+ /* 92 */ "db_options ::= db_options SINGLE_STABLE NK_INTEGER",
+ /* 93 */ "db_options ::= db_options RETENTIONS retention_list",
+ /* 94 */ "db_options ::= db_options SCHEMALESS NK_INTEGER",
+ /* 95 */ "db_options ::= db_options WAL_LEVEL NK_INTEGER",
+ /* 96 */ "db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER",
+ /* 97 */ "db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER",
+ /* 98 */ "db_options ::= db_options WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER",
+ /* 99 */ "db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER",
+ /* 100 */ "db_options ::= db_options WAL_RETENTION_SIZE NK_MINUS NK_INTEGER",
+ /* 101 */ "db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER",
+ /* 102 */ "db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER",
+ /* 103 */ "db_options ::= db_options STT_TRIGGER NK_INTEGER",
+ /* 104 */ "db_options ::= db_options TABLE_PREFIX NK_INTEGER",
+ /* 105 */ "db_options ::= db_options TABLE_SUFFIX NK_INTEGER",
+ /* 106 */ "alter_db_options ::= alter_db_option",
+ /* 107 */ "alter_db_options ::= alter_db_options alter_db_option",
+ /* 108 */ "alter_db_option ::= BUFFER NK_INTEGER",
+ /* 109 */ "alter_db_option ::= CACHEMODEL NK_STRING",
+ /* 110 */ "alter_db_option ::= CACHESIZE NK_INTEGER",
+ /* 111 */ "alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER",
+ /* 112 */ "alter_db_option ::= KEEP integer_list",
+ /* 113 */ "alter_db_option ::= KEEP variable_list",
+ /* 114 */ "alter_db_option ::= PAGES NK_INTEGER",
+ /* 115 */ "alter_db_option ::= REPLICA NK_INTEGER",
+ /* 116 */ "alter_db_option ::= STRICT NK_STRING",
+ /* 117 */ "alter_db_option ::= WAL_LEVEL NK_INTEGER",
+ /* 118 */ "alter_db_option ::= STT_TRIGGER NK_INTEGER",
+ /* 119 */ "integer_list ::= NK_INTEGER",
+ /* 120 */ "integer_list ::= integer_list NK_COMMA NK_INTEGER",
+ /* 121 */ "variable_list ::= NK_VARIABLE",
+ /* 122 */ "variable_list ::= variable_list NK_COMMA NK_VARIABLE",
+ /* 123 */ "retention_list ::= retention",
+ /* 124 */ "retention_list ::= retention_list NK_COMMA retention",
+ /* 125 */ "retention ::= NK_VARIABLE NK_COLON NK_VARIABLE",
+ /* 126 */ "speed_opt ::=",
+ /* 127 */ "speed_opt ::= MAX_SPEED NK_INTEGER",
+ /* 128 */ "cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options",
+ /* 129 */ "cmd ::= CREATE TABLE multi_create_clause",
+ /* 130 */ "cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options",
+ /* 131 */ "cmd ::= DROP TABLE multi_drop_clause",
+ /* 132 */ "cmd ::= DROP STABLE exists_opt full_table_name",
+ /* 133 */ "cmd ::= ALTER TABLE alter_table_clause",
+ /* 134 */ "cmd ::= ALTER STABLE alter_table_clause",
+ /* 135 */ "alter_table_clause ::= full_table_name alter_table_options",
+ /* 136 */ "alter_table_clause ::= full_table_name ADD COLUMN column_name type_name",
+ /* 137 */ "alter_table_clause ::= full_table_name DROP COLUMN column_name",
+ /* 138 */ "alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name",
+ /* 139 */ "alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name",
+ /* 140 */ "alter_table_clause ::= full_table_name ADD TAG column_name type_name",
+ /* 141 */ "alter_table_clause ::= full_table_name DROP TAG column_name",
+ /* 142 */ "alter_table_clause ::= full_table_name MODIFY TAG column_name type_name",
+ /* 143 */ "alter_table_clause ::= full_table_name RENAME TAG column_name column_name",
+ /* 144 */ "alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal",
+ /* 145 */ "multi_create_clause ::= create_subtable_clause",
+ /* 146 */ "multi_create_clause ::= multi_create_clause create_subtable_clause",
+ /* 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",
+ /* 148 */ "multi_drop_clause ::= drop_table_clause",
+ /* 149 */ "multi_drop_clause ::= multi_drop_clause drop_table_clause",
+ /* 150 */ "drop_table_clause ::= exists_opt full_table_name",
+ /* 151 */ "specific_cols_opt ::=",
+ /* 152 */ "specific_cols_opt ::= NK_LP col_name_list NK_RP",
+ /* 153 */ "full_table_name ::= table_name",
+ /* 154 */ "full_table_name ::= db_name NK_DOT table_name",
+ /* 155 */ "column_def_list ::= column_def",
+ /* 156 */ "column_def_list ::= column_def_list NK_COMMA column_def",
+ /* 157 */ "column_def ::= column_name type_name",
+ /* 158 */ "column_def ::= column_name type_name COMMENT NK_STRING",
+ /* 159 */ "type_name ::= BOOL",
+ /* 160 */ "type_name ::= TINYINT",
+ /* 161 */ "type_name ::= SMALLINT",
+ /* 162 */ "type_name ::= INT",
+ /* 163 */ "type_name ::= INTEGER",
+ /* 164 */ "type_name ::= BIGINT",
+ /* 165 */ "type_name ::= FLOAT",
+ /* 166 */ "type_name ::= DOUBLE",
+ /* 167 */ "type_name ::= BINARY NK_LP NK_INTEGER NK_RP",
+ /* 168 */ "type_name ::= TIMESTAMP",
+ /* 169 */ "type_name ::= NCHAR NK_LP NK_INTEGER NK_RP",
+ /* 170 */ "type_name ::= TINYINT UNSIGNED",
+ /* 171 */ "type_name ::= SMALLINT UNSIGNED",
+ /* 172 */ "type_name ::= INT UNSIGNED",
+ /* 173 */ "type_name ::= BIGINT UNSIGNED",
+ /* 174 */ "type_name ::= JSON",
+ /* 175 */ "type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP",
+ /* 176 */ "type_name ::= MEDIUMBLOB",
+ /* 177 */ "type_name ::= BLOB",
+ /* 178 */ "type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP",
+ /* 179 */ "type_name ::= DECIMAL",
+ /* 180 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP",
+ /* 181 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP",
+ /* 182 */ "tags_def_opt ::=",
+ /* 183 */ "tags_def_opt ::= tags_def",
+ /* 184 */ "tags_def ::= TAGS NK_LP column_def_list NK_RP",
+ /* 185 */ "table_options ::=",
+ /* 186 */ "table_options ::= table_options COMMENT NK_STRING",
+ /* 187 */ "table_options ::= table_options MAX_DELAY duration_list",
+ /* 188 */ "table_options ::= table_options WATERMARK duration_list",
+ /* 189 */ "table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP",
+ /* 190 */ "table_options ::= table_options TTL NK_INTEGER",
+ /* 191 */ "table_options ::= table_options SMA NK_LP col_name_list NK_RP",
+ /* 192 */ "alter_table_options ::= alter_table_option",
+ /* 193 */ "alter_table_options ::= alter_table_options alter_table_option",
+ /* 194 */ "alter_table_option ::= COMMENT NK_STRING",
+ /* 195 */ "alter_table_option ::= TTL NK_INTEGER",
+ /* 196 */ "duration_list ::= duration_literal",
+ /* 197 */ "duration_list ::= duration_list NK_COMMA duration_literal",
+ /* 198 */ "rollup_func_list ::= rollup_func_name",
+ /* 199 */ "rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name",
+ /* 200 */ "rollup_func_name ::= function_name",
+ /* 201 */ "rollup_func_name ::= FIRST",
+ /* 202 */ "rollup_func_name ::= LAST",
+ /* 203 */ "col_name_list ::= col_name",
+ /* 204 */ "col_name_list ::= col_name_list NK_COMMA col_name",
+ /* 205 */ "col_name ::= column_name",
+ /* 206 */ "cmd ::= SHOW DNODES",
+ /* 207 */ "cmd ::= SHOW USERS",
+ /* 208 */ "cmd ::= SHOW DATABASES",
+ /* 209 */ "cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt",
+ /* 210 */ "cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt",
+ /* 211 */ "cmd ::= SHOW db_name_cond_opt VGROUPS",
+ /* 212 */ "cmd ::= SHOW MNODES",
+ /* 213 */ "cmd ::= SHOW QNODES",
+ /* 214 */ "cmd ::= SHOW FUNCTIONS",
+ /* 215 */ "cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt",
+ /* 216 */ "cmd ::= SHOW STREAMS",
+ /* 217 */ "cmd ::= SHOW ACCOUNTS",
+ /* 218 */ "cmd ::= SHOW APPS",
+ /* 219 */ "cmd ::= SHOW CONNECTIONS",
+ /* 220 */ "cmd ::= SHOW LICENCES",
+ /* 221 */ "cmd ::= SHOW GRANTS",
+ /* 222 */ "cmd ::= SHOW CREATE DATABASE db_name",
+ /* 223 */ "cmd ::= SHOW CREATE TABLE full_table_name",
+ /* 224 */ "cmd ::= SHOW CREATE STABLE full_table_name",
+ /* 225 */ "cmd ::= SHOW QUERIES",
+ /* 226 */ "cmd ::= SHOW SCORES",
+ /* 227 */ "cmd ::= SHOW TOPICS",
+ /* 228 */ "cmd ::= SHOW VARIABLES",
+ /* 229 */ "cmd ::= SHOW CLUSTER VARIABLES",
+ /* 230 */ "cmd ::= SHOW LOCAL VARIABLES",
+ /* 231 */ "cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt",
+ /* 232 */ "cmd ::= SHOW BNODES",
+ /* 233 */ "cmd ::= SHOW SNODES",
+ /* 234 */ "cmd ::= SHOW CLUSTER",
+ /* 235 */ "cmd ::= SHOW TRANSACTIONS",
+ /* 236 */ "cmd ::= SHOW TABLE DISTRIBUTED full_table_name",
+ /* 237 */ "cmd ::= SHOW CONSUMERS",
+ /* 238 */ "cmd ::= SHOW SUBSCRIPTIONS",
+ /* 239 */ "cmd ::= SHOW TAGS FROM table_name_cond from_db_opt",
+ /* 240 */ "cmd ::= SHOW TABLE TAGS FROM table_name_cond from_db_opt",
+ /* 241 */ "cmd ::= SHOW VNODES NK_INTEGER",
+ /* 242 */ "cmd ::= SHOW VNODES NK_STRING",
+ /* 243 */ "db_name_cond_opt ::=",
+ /* 244 */ "db_name_cond_opt ::= db_name NK_DOT",
+ /* 245 */ "like_pattern_opt ::=",
+ /* 246 */ "like_pattern_opt ::= LIKE NK_STRING",
+ /* 247 */ "table_name_cond ::= table_name",
+ /* 248 */ "from_db_opt ::=",
+ /* 249 */ "from_db_opt ::= FROM db_name",
+ /* 250 */ "cmd ::= CREATE SMA INDEX not_exists_opt full_table_name ON full_table_name index_options",
+ /* 251 */ "cmd ::= DROP INDEX exists_opt full_table_name",
+ /* 252 */ "index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt",
+ /* 253 */ "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",
+ /* 254 */ "func_list ::= func",
+ /* 255 */ "func_list ::= func_list NK_COMMA func",
+ /* 256 */ "func ::= function_name NK_LP expression_list NK_RP",
+ /* 257 */ "sma_stream_opt ::=",
+ /* 258 */ "sma_stream_opt ::= stream_options WATERMARK duration_literal",
+ /* 259 */ "sma_stream_opt ::= stream_options MAX_DELAY duration_literal",
+ /* 260 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery",
+ /* 261 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name",
+ /* 262 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name",
+ /* 263 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name",
+ /* 264 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name",
+ /* 265 */ "cmd ::= DROP TOPIC exists_opt topic_name",
+ /* 266 */ "cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name",
+ /* 267 */ "cmd ::= DESC full_table_name",
+ /* 268 */ "cmd ::= DESCRIBE full_table_name",
+ /* 269 */ "cmd ::= RESET QUERY CACHE",
+ /* 270 */ "cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery",
+ /* 271 */ "analyze_opt ::=",
+ /* 272 */ "analyze_opt ::= ANALYZE",
+ /* 273 */ "explain_options ::=",
+ /* 274 */ "explain_options ::= explain_options VERBOSE NK_BOOL",
+ /* 275 */ "explain_options ::= explain_options RATIO NK_FLOAT",
+ /* 276 */ "cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt",
+ /* 277 */ "cmd ::= DROP FUNCTION exists_opt function_name",
+ /* 278 */ "agg_func_opt ::=",
+ /* 279 */ "agg_func_opt ::= AGGREGATE",
+ /* 280 */ "bufsize_opt ::=",
+ /* 281 */ "bufsize_opt ::= BUFSIZE NK_INTEGER",
+ /* 282 */ "cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name tags_def_opt subtable_opt AS query_or_subquery",
+ /* 283 */ "cmd ::= DROP STREAM exists_opt stream_name",
+ /* 284 */ "stream_options ::=",
+ /* 285 */ "stream_options ::= stream_options TRIGGER AT_ONCE",
+ /* 286 */ "stream_options ::= stream_options TRIGGER WINDOW_CLOSE",
+ /* 287 */ "stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal",
+ /* 288 */ "stream_options ::= stream_options WATERMARK duration_literal",
+ /* 289 */ "stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER",
+ /* 290 */ "stream_options ::= stream_options FILL_HISTORY NK_INTEGER",
+ /* 291 */ "subtable_opt ::=",
+ /* 292 */ "subtable_opt ::= SUBTABLE NK_LP expression NK_RP",
+ /* 293 */ "cmd ::= KILL CONNECTION NK_INTEGER",
+ /* 294 */ "cmd ::= KILL QUERY NK_STRING",
+ /* 295 */ "cmd ::= KILL TRANSACTION NK_INTEGER",
+ /* 296 */ "cmd ::= BALANCE VGROUP",
+ /* 297 */ "cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER",
+ /* 298 */ "cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list",
+ /* 299 */ "cmd ::= SPLIT VGROUP NK_INTEGER",
+ /* 300 */ "dnode_list ::= DNODE NK_INTEGER",
+ /* 301 */ "dnode_list ::= dnode_list DNODE NK_INTEGER",
+ /* 302 */ "cmd ::= DELETE FROM full_table_name where_clause_opt",
+ /* 303 */ "cmd ::= query_or_subquery",
+ /* 304 */ "cmd ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery",
+ /* 305 */ "cmd ::= INSERT INTO full_table_name query_or_subquery",
+ /* 306 */ "literal ::= NK_INTEGER",
+ /* 307 */ "literal ::= NK_FLOAT",
+ /* 308 */ "literal ::= NK_STRING",
+ /* 309 */ "literal ::= NK_BOOL",
+ /* 310 */ "literal ::= TIMESTAMP NK_STRING",
+ /* 311 */ "literal ::= duration_literal",
+ /* 312 */ "literal ::= NULL",
+ /* 313 */ "literal ::= NK_QUESTION",
+ /* 314 */ "duration_literal ::= NK_VARIABLE",
+ /* 315 */ "signed ::= NK_INTEGER",
+ /* 316 */ "signed ::= NK_PLUS NK_INTEGER",
+ /* 317 */ "signed ::= NK_MINUS NK_INTEGER",
+ /* 318 */ "signed ::= NK_FLOAT",
+ /* 319 */ "signed ::= NK_PLUS NK_FLOAT",
+ /* 320 */ "signed ::= NK_MINUS NK_FLOAT",
+ /* 321 */ "signed_literal ::= signed",
+ /* 322 */ "signed_literal ::= NK_STRING",
+ /* 323 */ "signed_literal ::= NK_BOOL",
+ /* 324 */ "signed_literal ::= TIMESTAMP NK_STRING",
+ /* 325 */ "signed_literal ::= duration_literal",
+ /* 326 */ "signed_literal ::= NULL",
+ /* 327 */ "signed_literal ::= literal_func",
+ /* 328 */ "signed_literal ::= NK_QUESTION",
+ /* 329 */ "literal_list ::= signed_literal",
+ /* 330 */ "literal_list ::= literal_list NK_COMMA signed_literal",
+ /* 331 */ "db_name ::= NK_ID",
+ /* 332 */ "table_name ::= NK_ID",
+ /* 333 */ "column_name ::= NK_ID",
+ /* 334 */ "function_name ::= NK_ID",
+ /* 335 */ "table_alias ::= NK_ID",
+ /* 336 */ "column_alias ::= NK_ID",
+ /* 337 */ "user_name ::= NK_ID",
+ /* 338 */ "topic_name ::= NK_ID",
+ /* 339 */ "stream_name ::= NK_ID",
+ /* 340 */ "cgroup_name ::= NK_ID",
+ /* 341 */ "expr_or_subquery ::= expression",
+ /* 342 */ "expr_or_subquery ::= subquery",
+ /* 343 */ "expression ::= literal",
+ /* 344 */ "expression ::= pseudo_column",
+ /* 345 */ "expression ::= column_reference",
+ /* 346 */ "expression ::= function_expression",
+ /* 347 */ "expression ::= case_when_expression",
+ /* 348 */ "expression ::= NK_LP expression NK_RP",
+ /* 349 */ "expression ::= NK_PLUS expr_or_subquery",
+ /* 350 */ "expression ::= NK_MINUS expr_or_subquery",
+ /* 351 */ "expression ::= expr_or_subquery NK_PLUS expr_or_subquery",
+ /* 352 */ "expression ::= expr_or_subquery NK_MINUS expr_or_subquery",
+ /* 353 */ "expression ::= expr_or_subquery NK_STAR expr_or_subquery",
+ /* 354 */ "expression ::= expr_or_subquery NK_SLASH expr_or_subquery",
+ /* 355 */ "expression ::= expr_or_subquery NK_REM expr_or_subquery",
+ /* 356 */ "expression ::= column_reference NK_ARROW NK_STRING",
+ /* 357 */ "expression ::= expr_or_subquery NK_BITAND expr_or_subquery",
+ /* 358 */ "expression ::= expr_or_subquery NK_BITOR expr_or_subquery",
+ /* 359 */ "expression_list ::= expr_or_subquery",
+ /* 360 */ "expression_list ::= expression_list NK_COMMA expr_or_subquery",
+ /* 361 */ "column_reference ::= column_name",
+ /* 362 */ "column_reference ::= table_name NK_DOT column_name",
+ /* 363 */ "pseudo_column ::= ROWTS",
+ /* 364 */ "pseudo_column ::= TBNAME",
+ /* 365 */ "pseudo_column ::= table_name NK_DOT TBNAME",
+ /* 366 */ "pseudo_column ::= QSTART",
+ /* 367 */ "pseudo_column ::= QEND",
+ /* 368 */ "pseudo_column ::= QDURATION",
+ /* 369 */ "pseudo_column ::= WSTART",
+ /* 370 */ "pseudo_column ::= WEND",
+ /* 371 */ "pseudo_column ::= WDURATION",
+ /* 372 */ "pseudo_column ::= IROWTS",
+ /* 373 */ "pseudo_column ::= QTAGS",
+ /* 374 */ "function_expression ::= function_name NK_LP expression_list NK_RP",
+ /* 375 */ "function_expression ::= star_func NK_LP star_func_para_list NK_RP",
+ /* 376 */ "function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP",
+ /* 377 */ "function_expression ::= literal_func",
+ /* 378 */ "literal_func ::= noarg_func NK_LP NK_RP",
+ /* 379 */ "literal_func ::= NOW",
+ /* 380 */ "noarg_func ::= NOW",
+ /* 381 */ "noarg_func ::= TODAY",
+ /* 382 */ "noarg_func ::= TIMEZONE",
+ /* 383 */ "noarg_func ::= DATABASE",
+ /* 384 */ "noarg_func ::= CLIENT_VERSION",
+ /* 385 */ "noarg_func ::= SERVER_VERSION",
+ /* 386 */ "noarg_func ::= SERVER_STATUS",
+ /* 387 */ "noarg_func ::= CURRENT_USER",
+ /* 388 */ "noarg_func ::= USER",
+ /* 389 */ "star_func ::= COUNT",
+ /* 390 */ "star_func ::= FIRST",
+ /* 391 */ "star_func ::= LAST",
+ /* 392 */ "star_func ::= LAST_ROW",
+ /* 393 */ "star_func_para_list ::= NK_STAR",
+ /* 394 */ "star_func_para_list ::= other_para_list",
+ /* 395 */ "other_para_list ::= star_func_para",
+ /* 396 */ "other_para_list ::= other_para_list NK_COMMA star_func_para",
+ /* 397 */ "star_func_para ::= expr_or_subquery",
+ /* 398 */ "star_func_para ::= table_name NK_DOT NK_STAR",
+ /* 399 */ "case_when_expression ::= CASE when_then_list case_when_else_opt END",
+ /* 400 */ "case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END",
+ /* 401 */ "when_then_list ::= when_then_expr",
+ /* 402 */ "when_then_list ::= when_then_list when_then_expr",
+ /* 403 */ "when_then_expr ::= WHEN common_expression THEN common_expression",
+ /* 404 */ "case_when_else_opt ::=",
+ /* 405 */ "case_when_else_opt ::= ELSE common_expression",
+ /* 406 */ "predicate ::= expr_or_subquery compare_op expr_or_subquery",
+ /* 407 */ "predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery",
+ /* 408 */ "predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery",
+ /* 409 */ "predicate ::= expr_or_subquery IS NULL",
+ /* 410 */ "predicate ::= expr_or_subquery IS NOT NULL",
+ /* 411 */ "predicate ::= expr_or_subquery in_op in_predicate_value",
+ /* 412 */ "compare_op ::= NK_LT",
+ /* 413 */ "compare_op ::= NK_GT",
+ /* 414 */ "compare_op ::= NK_LE",
+ /* 415 */ "compare_op ::= NK_GE",
+ /* 416 */ "compare_op ::= NK_NE",
+ /* 417 */ "compare_op ::= NK_EQ",
+ /* 418 */ "compare_op ::= LIKE",
+ /* 419 */ "compare_op ::= NOT LIKE",
+ /* 420 */ "compare_op ::= MATCH",
+ /* 421 */ "compare_op ::= NMATCH",
+ /* 422 */ "compare_op ::= CONTAINS",
+ /* 423 */ "in_op ::= IN",
+ /* 424 */ "in_op ::= NOT IN",
+ /* 425 */ "in_predicate_value ::= NK_LP literal_list NK_RP",
+ /* 426 */ "boolean_value_expression ::= boolean_primary",
+ /* 427 */ "boolean_value_expression ::= NOT boolean_primary",
+ /* 428 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression",
+ /* 429 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression",
+ /* 430 */ "boolean_primary ::= predicate",
+ /* 431 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP",
+ /* 432 */ "common_expression ::= expr_or_subquery",
+ /* 433 */ "common_expression ::= boolean_value_expression",
+ /* 434 */ "from_clause_opt ::=",
+ /* 435 */ "from_clause_opt ::= FROM table_reference_list",
+ /* 436 */ "table_reference_list ::= table_reference",
+ /* 437 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference",
+ /* 438 */ "table_reference ::= table_primary",
+ /* 439 */ "table_reference ::= joined_table",
+ /* 440 */ "table_primary ::= table_name alias_opt",
+ /* 441 */ "table_primary ::= db_name NK_DOT table_name alias_opt",
+ /* 442 */ "table_primary ::= subquery alias_opt",
+ /* 443 */ "table_primary ::= parenthesized_joined_table",
+ /* 444 */ "alias_opt ::=",
+ /* 445 */ "alias_opt ::= table_alias",
+ /* 446 */ "alias_opt ::= AS table_alias",
+ /* 447 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP",
+ /* 448 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP",
+ /* 449 */ "joined_table ::= table_reference join_type JOIN table_reference ON search_condition",
+ /* 450 */ "join_type ::=",
+ /* 451 */ "join_type ::= INNER",
+ /* 452 */ "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",
+ /* 453 */ "set_quantifier_opt ::=",
+ /* 454 */ "set_quantifier_opt ::= DISTINCT",
+ /* 455 */ "set_quantifier_opt ::= ALL",
+ /* 456 */ "select_list ::= select_item",
+ /* 457 */ "select_list ::= select_list NK_COMMA select_item",
+ /* 458 */ "select_item ::= NK_STAR",
+ /* 459 */ "select_item ::= common_expression",
+ /* 460 */ "select_item ::= common_expression column_alias",
+ /* 461 */ "select_item ::= common_expression AS column_alias",
+ /* 462 */ "select_item ::= table_name NK_DOT NK_STAR",
+ /* 463 */ "where_clause_opt ::=",
+ /* 464 */ "where_clause_opt ::= WHERE search_condition",
+ /* 465 */ "partition_by_clause_opt ::=",
+ /* 466 */ "partition_by_clause_opt ::= PARTITION BY partition_list",
+ /* 467 */ "partition_list ::= partition_item",
+ /* 468 */ "partition_list ::= partition_list NK_COMMA partition_item",
+ /* 469 */ "partition_item ::= expr_or_subquery",
+ /* 470 */ "partition_item ::= expr_or_subquery column_alias",
+ /* 471 */ "partition_item ::= expr_or_subquery AS column_alias",
+ /* 472 */ "twindow_clause_opt ::=",
+ /* 473 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP",
+ /* 474 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP",
+ /* 475 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt",
+ /* 476 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt",
+ /* 477 */ "sliding_opt ::=",
+ /* 478 */ "sliding_opt ::= SLIDING NK_LP duration_literal NK_RP",
+ /* 479 */ "fill_opt ::=",
+ /* 480 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP",
+ /* 481 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP",
+ /* 482 */ "fill_mode ::= NONE",
+ /* 483 */ "fill_mode ::= PREV",
+ /* 484 */ "fill_mode ::= NULL",
+ /* 485 */ "fill_mode ::= LINEAR",
+ /* 486 */ "fill_mode ::= NEXT",
+ /* 487 */ "group_by_clause_opt ::=",
+ /* 488 */ "group_by_clause_opt ::= GROUP BY group_by_list",
+ /* 489 */ "group_by_list ::= expr_or_subquery",
+ /* 490 */ "group_by_list ::= group_by_list NK_COMMA expr_or_subquery",
+ /* 491 */ "having_clause_opt ::=",
+ /* 492 */ "having_clause_opt ::= HAVING search_condition",
+ /* 493 */ "range_opt ::=",
+ /* 494 */ "range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP",
+ /* 495 */ "every_opt ::=",
+ /* 496 */ "every_opt ::= EVERY NK_LP duration_literal NK_RP",
+ /* 497 */ "query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt",
+ /* 498 */ "query_simple ::= query_specification",
+ /* 499 */ "query_simple ::= union_query_expression",
+ /* 500 */ "union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery",
+ /* 501 */ "union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery",
+ /* 502 */ "query_simple_or_subquery ::= query_simple",
+ /* 503 */ "query_simple_or_subquery ::= subquery",
+ /* 504 */ "query_or_subquery ::= query_expression",
+ /* 505 */ "query_or_subquery ::= subquery",
+ /* 506 */ "order_by_clause_opt ::=",
+ /* 507 */ "order_by_clause_opt ::= ORDER BY sort_specification_list",
+ /* 508 */ "slimit_clause_opt ::=",
+ /* 509 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER",
+ /* 510 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER",
+ /* 511 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER",
+ /* 512 */ "limit_clause_opt ::=",
+ /* 513 */ "limit_clause_opt ::= LIMIT NK_INTEGER",
+ /* 514 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER",
+ /* 515 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER",
+ /* 516 */ "subquery ::= NK_LP query_expression NK_RP",
+ /* 517 */ "subquery ::= NK_LP subquery NK_RP",
+ /* 518 */ "search_condition ::= common_expression",
+ /* 519 */ "sort_specification_list ::= sort_specification",
+ /* 520 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification",
+ /* 521 */ "sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt",
+ /* 522 */ "ordering_specification_opt ::=",
+ /* 523 */ "ordering_specification_opt ::= ASC",
+ /* 524 */ "ordering_specification_opt ::= DESC",
+ /* 525 */ "null_ordering_opt ::=",
+ /* 526 */ "null_ordering_opt ::= NULLS FIRST",
+ /* 527 */ "null_ordering_opt ::= NULLS LAST",
};
#endif /* NDEBUG */
@@ -2496,190 +2609,191 @@ static void yy_destructor(
*/
/********* Begin destructor definitions ***************************************/
/* Default NON-TERMINAL Destructor */
- case 318: /* cmd */
- case 321: /* literal */
- case 332: /* db_options */
- case 334: /* alter_db_options */
- case 340: /* retention */
- case 341: /* full_table_name */
- case 344: /* table_options */
- case 348: /* alter_table_clause */
- case 349: /* alter_table_options */
- case 352: /* signed_literal */
- case 353: /* create_subtable_clause */
- case 356: /* drop_table_clause */
- case 359: /* column_def */
- case 363: /* duration_literal */
- case 364: /* rollup_func_name */
- case 366: /* col_name */
- case 367: /* db_name_cond_opt */
- case 368: /* like_pattern_opt */
- case 369: /* table_name_cond */
- case 370: /* from_db_opt */
- case 371: /* index_options */
- case 373: /* sliding_opt */
- case 374: /* sma_stream_opt */
- case 375: /* func */
- case 376: /* stream_options */
- case 378: /* query_or_subquery */
- case 381: /* explain_options */
- case 385: /* subtable_opt */
- case 386: /* expression */
- case 388: /* where_clause_opt */
- case 389: /* signed */
- case 390: /* literal_func */
- case 394: /* expr_or_subquery */
- case 395: /* subquery */
- case 396: /* pseudo_column */
- case 397: /* column_reference */
- case 398: /* function_expression */
- case 399: /* case_when_expression */
- case 404: /* star_func_para */
- case 406: /* case_when_else_opt */
- case 407: /* common_expression */
- case 408: /* when_then_expr */
- case 409: /* predicate */
- case 412: /* in_predicate_value */
- case 413: /* boolean_value_expression */
- case 414: /* boolean_primary */
- case 415: /* from_clause_opt */
- case 416: /* table_reference_list */
- case 417: /* table_reference */
- case 418: /* table_primary */
- case 419: /* joined_table */
- case 421: /* parenthesized_joined_table */
- case 423: /* search_condition */
- case 424: /* query_specification */
- case 428: /* range_opt */
- case 429: /* every_opt */
- case 430: /* fill_opt */
- case 431: /* twindow_clause_opt */
- case 433: /* having_clause_opt */
- case 434: /* select_item */
- case 436: /* partition_item */
- case 439: /* query_expression */
- case 440: /* query_simple */
- case 442: /* slimit_clause_opt */
- case 443: /* limit_clause_opt */
- case 444: /* union_query_expression */
- case 445: /* query_simple_or_subquery */
- case 447: /* sort_specification */
+ case 319: /* cmd */
+ case 322: /* literal */
+ case 334: /* db_options */
+ case 336: /* alter_db_options */
+ case 342: /* retention */
+ case 343: /* full_table_name */
+ case 346: /* table_options */
+ case 350: /* alter_table_clause */
+ case 351: /* alter_table_options */
+ case 354: /* signed_literal */
+ case 355: /* create_subtable_clause */
+ case 358: /* drop_table_clause */
+ case 361: /* column_def */
+ case 365: /* duration_literal */
+ case 366: /* rollup_func_name */
+ case 368: /* col_name */
+ case 369: /* db_name_cond_opt */
+ case 370: /* like_pattern_opt */
+ case 371: /* table_name_cond */
+ case 372: /* from_db_opt */
+ case 373: /* index_options */
+ case 375: /* sliding_opt */
+ case 376: /* sma_stream_opt */
+ case 377: /* func */
+ case 378: /* stream_options */
+ case 380: /* query_or_subquery */
+ case 383: /* explain_options */
+ case 387: /* subtable_opt */
+ case 388: /* expression */
+ case 390: /* where_clause_opt */
+ case 391: /* signed */
+ case 392: /* literal_func */
+ case 396: /* expr_or_subquery */
+ case 397: /* subquery */
+ case 398: /* pseudo_column */
+ case 399: /* column_reference */
+ case 400: /* function_expression */
+ case 401: /* case_when_expression */
+ case 406: /* star_func_para */
+ case 408: /* case_when_else_opt */
+ case 409: /* common_expression */
+ case 410: /* when_then_expr */
+ case 411: /* predicate */
+ case 414: /* in_predicate_value */
+ case 415: /* boolean_value_expression */
+ case 416: /* boolean_primary */
+ case 417: /* from_clause_opt */
+ case 418: /* table_reference_list */
+ case 419: /* table_reference */
+ case 420: /* table_primary */
+ case 421: /* joined_table */
+ case 423: /* parenthesized_joined_table */
+ case 425: /* search_condition */
+ case 426: /* query_specification */
+ case 430: /* range_opt */
+ case 431: /* every_opt */
+ case 432: /* fill_opt */
+ case 433: /* twindow_clause_opt */
+ case 435: /* having_clause_opt */
+ case 436: /* select_item */
+ case 438: /* partition_item */
+ case 441: /* query_expression */
+ case 442: /* query_simple */
+ case 444: /* slimit_clause_opt */
+ case 445: /* limit_clause_opt */
+ case 446: /* union_query_expression */
+ case 447: /* query_simple_or_subquery */
+ case 449: /* sort_specification */
{
- nodesDestroyNode((yypminor->yy812));
+ nodesDestroyNode((yypminor->yy232));
}
break;
- case 319: /* account_options */
- case 320: /* alter_account_options */
- case 322: /* alter_account_option */
- case 335: /* speed_opt */
- case 383: /* bufsize_opt */
+ case 320: /* account_options */
+ case 321: /* alter_account_options */
+ case 323: /* alter_account_option */
+ case 337: /* speed_opt */
+ case 385: /* bufsize_opt */
{
}
break;
- case 323: /* user_name */
- case 326: /* priv_level */
- case 329: /* db_name */
- case 330: /* dnode_endpoint */
- case 350: /* column_name */
- case 358: /* table_name */
- case 365: /* function_name */
- case 377: /* topic_name */
- case 379: /* cgroup_name */
- case 384: /* stream_name */
- case 392: /* table_alias */
- case 393: /* column_alias */
- case 400: /* star_func */
- case 402: /* noarg_func */
- case 420: /* alias_opt */
+ case 324: /* user_name */
+ case 327: /* priv_level */
+ case 330: /* db_name */
+ case 331: /* dnode_endpoint */
+ case 352: /* column_name */
+ case 360: /* table_name */
+ case 367: /* function_name */
+ case 379: /* topic_name */
+ case 381: /* cgroup_name */
+ case 386: /* stream_name */
+ case 394: /* table_alias */
+ case 395: /* column_alias */
+ case 402: /* star_func */
+ case 404: /* noarg_func */
+ case 422: /* alias_opt */
{
}
break;
- case 324: /* sysinfo_opt */
+ case 325: /* sysinfo_opt */
{
}
break;
- case 325: /* privileges */
- case 327: /* priv_type_list */
- case 328: /* priv_type */
+ case 326: /* privileges */
+ case 328: /* priv_type_list */
+ case 329: /* priv_type */
{
}
break;
- case 331: /* not_exists_opt */
- case 333: /* exists_opt */
- case 380: /* analyze_opt */
- case 382: /* agg_func_opt */
- case 425: /* set_quantifier_opt */
+ case 332: /* force_opt */
+ case 333: /* not_exists_opt */
+ case 335: /* exists_opt */
+ case 382: /* analyze_opt */
+ case 384: /* agg_func_opt */
+ case 427: /* set_quantifier_opt */
{
}
break;
- case 336: /* integer_list */
- case 337: /* variable_list */
- case 338: /* retention_list */
- case 342: /* column_def_list */
- case 343: /* tags_def_opt */
- case 345: /* multi_create_clause */
- case 346: /* tags_def */
- case 347: /* multi_drop_clause */
- case 354: /* specific_cols_opt */
- case 355: /* expression_list */
- case 357: /* col_name_list */
- case 360: /* duration_list */
- case 361: /* rollup_func_list */
- case 372: /* func_list */
- case 387: /* dnode_list */
- case 391: /* literal_list */
- case 401: /* star_func_para_list */
- case 403: /* other_para_list */
- case 405: /* when_then_list */
- case 426: /* select_list */
- case 427: /* partition_by_clause_opt */
- case 432: /* group_by_clause_opt */
- case 435: /* partition_list */
- case 438: /* group_by_list */
- case 441: /* order_by_clause_opt */
- case 446: /* sort_specification_list */
+ case 338: /* integer_list */
+ case 339: /* variable_list */
+ case 340: /* retention_list */
+ case 344: /* column_def_list */
+ case 345: /* tags_def_opt */
+ case 347: /* multi_create_clause */
+ case 348: /* tags_def */
+ case 349: /* multi_drop_clause */
+ case 356: /* specific_cols_opt */
+ case 357: /* expression_list */
+ case 359: /* col_name_list */
+ case 362: /* duration_list */
+ case 363: /* rollup_func_list */
+ case 374: /* func_list */
+ case 389: /* dnode_list */
+ case 393: /* literal_list */
+ case 403: /* star_func_para_list */
+ case 405: /* other_para_list */
+ case 407: /* when_then_list */
+ case 428: /* select_list */
+ case 429: /* partition_by_clause_opt */
+ case 434: /* group_by_clause_opt */
+ case 437: /* partition_list */
+ case 440: /* group_by_list */
+ case 443: /* order_by_clause_opt */
+ case 448: /* sort_specification_list */
{
- nodesDestroyList((yypminor->yy424));
+ nodesDestroyList((yypminor->yy288));
}
break;
- case 339: /* alter_db_option */
- case 362: /* alter_table_option */
+ case 341: /* alter_db_option */
+ case 364: /* alter_table_option */
{
}
break;
- case 351: /* type_name */
+ case 353: /* type_name */
{
}
break;
- case 410: /* compare_op */
- case 411: /* in_op */
+ case 412: /* compare_op */
+ case 413: /* in_op */
{
}
break;
- case 422: /* join_type */
+ case 424: /* join_type */
{
}
break;
- case 437: /* fill_mode */
+ case 439: /* fill_mode */
{
}
break;
- case 448: /* ordering_specification_opt */
+ case 450: /* ordering_specification_opt */
{
}
break;
- case 449: /* null_ordering_opt */
+ case 451: /* null_ordering_opt */
{
}
@@ -2978,532 +3092,534 @@ 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[] = {
- { 318, -6 }, /* (0) cmd ::= CREATE ACCOUNT NK_ID PASS NK_STRING account_options */
- { 318, -4 }, /* (1) cmd ::= ALTER ACCOUNT NK_ID alter_account_options */
- { 319, 0 }, /* (2) account_options ::= */
- { 319, -3 }, /* (3) account_options ::= account_options PPS literal */
- { 319, -3 }, /* (4) account_options ::= account_options TSERIES literal */
- { 319, -3 }, /* (5) account_options ::= account_options STORAGE literal */
- { 319, -3 }, /* (6) account_options ::= account_options STREAMS literal */
- { 319, -3 }, /* (7) account_options ::= account_options QTIME literal */
- { 319, -3 }, /* (8) account_options ::= account_options DBS literal */
- { 319, -3 }, /* (9) account_options ::= account_options USERS literal */
- { 319, -3 }, /* (10) account_options ::= account_options CONNS literal */
- { 319, -3 }, /* (11) account_options ::= account_options STATE literal */
- { 320, -1 }, /* (12) alter_account_options ::= alter_account_option */
- { 320, -2 }, /* (13) alter_account_options ::= alter_account_options alter_account_option */
- { 322, -2 }, /* (14) alter_account_option ::= PASS literal */
- { 322, -2 }, /* (15) alter_account_option ::= PPS literal */
- { 322, -2 }, /* (16) alter_account_option ::= TSERIES literal */
- { 322, -2 }, /* (17) alter_account_option ::= STORAGE literal */
- { 322, -2 }, /* (18) alter_account_option ::= STREAMS literal */
- { 322, -2 }, /* (19) alter_account_option ::= QTIME literal */
- { 322, -2 }, /* (20) alter_account_option ::= DBS literal */
- { 322, -2 }, /* (21) alter_account_option ::= USERS literal */
- { 322, -2 }, /* (22) alter_account_option ::= CONNS literal */
- { 322, -2 }, /* (23) alter_account_option ::= STATE literal */
- { 318, -6 }, /* (24) cmd ::= CREATE USER user_name PASS NK_STRING sysinfo_opt */
- { 318, -5 }, /* (25) cmd ::= ALTER USER user_name PASS NK_STRING */
- { 318, -5 }, /* (26) cmd ::= ALTER USER user_name ENABLE NK_INTEGER */
- { 318, -5 }, /* (27) cmd ::= ALTER USER user_name SYSINFO NK_INTEGER */
- { 318, -3 }, /* (28) cmd ::= DROP USER user_name */
- { 324, 0 }, /* (29) sysinfo_opt ::= */
- { 324, -2 }, /* (30) sysinfo_opt ::= SYSINFO NK_INTEGER */
- { 318, -6 }, /* (31) cmd ::= GRANT privileges ON priv_level TO user_name */
- { 318, -6 }, /* (32) cmd ::= REVOKE privileges ON priv_level FROM user_name */
- { 325, -1 }, /* (33) privileges ::= ALL */
- { 325, -1 }, /* (34) privileges ::= priv_type_list */
- { 327, -1 }, /* (35) priv_type_list ::= priv_type */
- { 327, -3 }, /* (36) priv_type_list ::= priv_type_list NK_COMMA priv_type */
- { 328, -1 }, /* (37) priv_type ::= READ */
- { 328, -1 }, /* (38) priv_type ::= WRITE */
- { 326, -3 }, /* (39) priv_level ::= NK_STAR NK_DOT NK_STAR */
- { 326, -3 }, /* (40) priv_level ::= db_name NK_DOT NK_STAR */
- { 318, -3 }, /* (41) cmd ::= CREATE DNODE dnode_endpoint */
- { 318, -5 }, /* (42) cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER */
- { 318, -3 }, /* (43) cmd ::= DROP DNODE NK_INTEGER */
- { 318, -3 }, /* (44) cmd ::= DROP DNODE dnode_endpoint */
- { 318, -4 }, /* (45) cmd ::= ALTER DNODE NK_INTEGER NK_STRING */
- { 318, -5 }, /* (46) cmd ::= ALTER DNODE NK_INTEGER NK_STRING NK_STRING */
- { 318, -4 }, /* (47) cmd ::= ALTER ALL DNODES NK_STRING */
- { 318, -5 }, /* (48) cmd ::= ALTER ALL DNODES NK_STRING NK_STRING */
- { 330, -1 }, /* (49) dnode_endpoint ::= NK_STRING */
- { 330, -1 }, /* (50) dnode_endpoint ::= NK_ID */
- { 330, -1 }, /* (51) dnode_endpoint ::= NK_IPTOKEN */
- { 318, -3 }, /* (52) cmd ::= ALTER LOCAL NK_STRING */
- { 318, -4 }, /* (53) cmd ::= ALTER LOCAL NK_STRING NK_STRING */
- { 318, -5 }, /* (54) cmd ::= CREATE QNODE ON DNODE NK_INTEGER */
- { 318, -5 }, /* (55) cmd ::= DROP QNODE ON DNODE NK_INTEGER */
- { 318, -5 }, /* (56) cmd ::= CREATE BNODE ON DNODE NK_INTEGER */
- { 318, -5 }, /* (57) cmd ::= DROP BNODE ON DNODE NK_INTEGER */
- { 318, -5 }, /* (58) cmd ::= CREATE SNODE ON DNODE NK_INTEGER */
- { 318, -5 }, /* (59) cmd ::= DROP SNODE ON DNODE NK_INTEGER */
- { 318, -5 }, /* (60) cmd ::= CREATE MNODE ON DNODE NK_INTEGER */
- { 318, -5 }, /* (61) cmd ::= DROP MNODE ON DNODE NK_INTEGER */
- { 318, -5 }, /* (62) cmd ::= CREATE DATABASE not_exists_opt db_name db_options */
- { 318, -4 }, /* (63) cmd ::= DROP DATABASE exists_opt db_name */
- { 318, -2 }, /* (64) cmd ::= USE db_name */
- { 318, -4 }, /* (65) cmd ::= ALTER DATABASE db_name alter_db_options */
- { 318, -3 }, /* (66) cmd ::= FLUSH DATABASE db_name */
- { 318, -4 }, /* (67) cmd ::= TRIM DATABASE db_name speed_opt */
- { 331, -3 }, /* (68) not_exists_opt ::= IF NOT EXISTS */
- { 331, 0 }, /* (69) not_exists_opt ::= */
- { 333, -2 }, /* (70) exists_opt ::= IF EXISTS */
- { 333, 0 }, /* (71) exists_opt ::= */
- { 332, 0 }, /* (72) db_options ::= */
- { 332, -3 }, /* (73) db_options ::= db_options BUFFER NK_INTEGER */
- { 332, -3 }, /* (74) db_options ::= db_options CACHEMODEL NK_STRING */
- { 332, -3 }, /* (75) db_options ::= db_options CACHESIZE NK_INTEGER */
- { 332, -3 }, /* (76) db_options ::= db_options COMP NK_INTEGER */
- { 332, -3 }, /* (77) db_options ::= db_options DURATION NK_INTEGER */
- { 332, -3 }, /* (78) db_options ::= db_options DURATION NK_VARIABLE */
- { 332, -3 }, /* (79) db_options ::= db_options MAXROWS NK_INTEGER */
- { 332, -3 }, /* (80) db_options ::= db_options MINROWS NK_INTEGER */
- { 332, -3 }, /* (81) db_options ::= db_options KEEP integer_list */
- { 332, -3 }, /* (82) db_options ::= db_options KEEP variable_list */
- { 332, -3 }, /* (83) db_options ::= db_options PAGES NK_INTEGER */
- { 332, -3 }, /* (84) db_options ::= db_options PAGESIZE NK_INTEGER */
- { 332, -3 }, /* (85) db_options ::= db_options TSDB_PAGESIZE NK_INTEGER */
- { 332, -3 }, /* (86) db_options ::= db_options PRECISION NK_STRING */
- { 332, -3 }, /* (87) db_options ::= db_options REPLICA NK_INTEGER */
- { 332, -3 }, /* (88) db_options ::= db_options STRICT NK_STRING */
- { 332, -3 }, /* (89) db_options ::= db_options VGROUPS NK_INTEGER */
- { 332, -3 }, /* (90) db_options ::= db_options SINGLE_STABLE NK_INTEGER */
- { 332, -3 }, /* (91) db_options ::= db_options RETENTIONS retention_list */
- { 332, -3 }, /* (92) db_options ::= db_options SCHEMALESS NK_INTEGER */
- { 332, -3 }, /* (93) db_options ::= db_options WAL_LEVEL NK_INTEGER */
- { 332, -3 }, /* (94) db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER */
- { 332, -3 }, /* (95) db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER */
- { 332, -4 }, /* (96) db_options ::= db_options WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */
- { 332, -3 }, /* (97) db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER */
- { 332, -4 }, /* (98) db_options ::= db_options WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */
- { 332, -3 }, /* (99) db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER */
- { 332, -3 }, /* (100) db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER */
- { 332, -3 }, /* (101) db_options ::= db_options STT_TRIGGER NK_INTEGER */
- { 332, -3 }, /* (102) db_options ::= db_options TABLE_PREFIX NK_INTEGER */
- { 332, -3 }, /* (103) db_options ::= db_options TABLE_SUFFIX NK_INTEGER */
- { 334, -1 }, /* (104) alter_db_options ::= alter_db_option */
- { 334, -2 }, /* (105) alter_db_options ::= alter_db_options alter_db_option */
- { 339, -2 }, /* (106) alter_db_option ::= BUFFER NK_INTEGER */
- { 339, -2 }, /* (107) alter_db_option ::= CACHEMODEL NK_STRING */
- { 339, -2 }, /* (108) alter_db_option ::= CACHESIZE NK_INTEGER */
- { 339, -2 }, /* (109) alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER */
- { 339, -2 }, /* (110) alter_db_option ::= KEEP integer_list */
- { 339, -2 }, /* (111) alter_db_option ::= KEEP variable_list */
- { 339, -2 }, /* (112) alter_db_option ::= PAGES NK_INTEGER */
- { 339, -2 }, /* (113) alter_db_option ::= REPLICA NK_INTEGER */
- { 339, -2 }, /* (114) alter_db_option ::= STRICT NK_STRING */
- { 339, -2 }, /* (115) alter_db_option ::= WAL_LEVEL NK_INTEGER */
- { 339, -2 }, /* (116) alter_db_option ::= STT_TRIGGER NK_INTEGER */
- { 336, -1 }, /* (117) integer_list ::= NK_INTEGER */
- { 336, -3 }, /* (118) integer_list ::= integer_list NK_COMMA NK_INTEGER */
- { 337, -1 }, /* (119) variable_list ::= NK_VARIABLE */
- { 337, -3 }, /* (120) variable_list ::= variable_list NK_COMMA NK_VARIABLE */
- { 338, -1 }, /* (121) retention_list ::= retention */
- { 338, -3 }, /* (122) retention_list ::= retention_list NK_COMMA retention */
- { 340, -3 }, /* (123) retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */
- { 335, 0 }, /* (124) speed_opt ::= */
- { 335, -2 }, /* (125) speed_opt ::= MAX_SPEED NK_INTEGER */
- { 318, -9 }, /* (126) cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */
- { 318, -3 }, /* (127) cmd ::= CREATE TABLE multi_create_clause */
- { 318, -9 }, /* (128) cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */
- { 318, -3 }, /* (129) cmd ::= DROP TABLE multi_drop_clause */
- { 318, -4 }, /* (130) cmd ::= DROP STABLE exists_opt full_table_name */
- { 318, -3 }, /* (131) cmd ::= ALTER TABLE alter_table_clause */
- { 318, -3 }, /* (132) cmd ::= ALTER STABLE alter_table_clause */
- { 348, -2 }, /* (133) alter_table_clause ::= full_table_name alter_table_options */
- { 348, -5 }, /* (134) alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */
- { 348, -4 }, /* (135) alter_table_clause ::= full_table_name DROP COLUMN column_name */
- { 348, -5 }, /* (136) alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */
- { 348, -5 }, /* (137) alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */
- { 348, -5 }, /* (138) alter_table_clause ::= full_table_name ADD TAG column_name type_name */
- { 348, -4 }, /* (139) alter_table_clause ::= full_table_name DROP TAG column_name */
- { 348, -5 }, /* (140) alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */
- { 348, -5 }, /* (141) alter_table_clause ::= full_table_name RENAME TAG column_name column_name */
- { 348, -6 }, /* (142) alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */
- { 345, -1 }, /* (143) multi_create_clause ::= create_subtable_clause */
- { 345, -2 }, /* (144) multi_create_clause ::= multi_create_clause create_subtable_clause */
- { 353, -10 }, /* (145) 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 */
- { 347, -1 }, /* (146) multi_drop_clause ::= drop_table_clause */
- { 347, -2 }, /* (147) multi_drop_clause ::= multi_drop_clause drop_table_clause */
- { 356, -2 }, /* (148) drop_table_clause ::= exists_opt full_table_name */
- { 354, 0 }, /* (149) specific_cols_opt ::= */
- { 354, -3 }, /* (150) specific_cols_opt ::= NK_LP col_name_list NK_RP */
- { 341, -1 }, /* (151) full_table_name ::= table_name */
- { 341, -3 }, /* (152) full_table_name ::= db_name NK_DOT table_name */
- { 342, -1 }, /* (153) column_def_list ::= column_def */
- { 342, -3 }, /* (154) column_def_list ::= column_def_list NK_COMMA column_def */
- { 359, -2 }, /* (155) column_def ::= column_name type_name */
- { 359, -4 }, /* (156) column_def ::= column_name type_name COMMENT NK_STRING */
- { 351, -1 }, /* (157) type_name ::= BOOL */
- { 351, -1 }, /* (158) type_name ::= TINYINT */
- { 351, -1 }, /* (159) type_name ::= SMALLINT */
- { 351, -1 }, /* (160) type_name ::= INT */
- { 351, -1 }, /* (161) type_name ::= INTEGER */
- { 351, -1 }, /* (162) type_name ::= BIGINT */
- { 351, -1 }, /* (163) type_name ::= FLOAT */
- { 351, -1 }, /* (164) type_name ::= DOUBLE */
- { 351, -4 }, /* (165) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */
- { 351, -1 }, /* (166) type_name ::= TIMESTAMP */
- { 351, -4 }, /* (167) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */
- { 351, -2 }, /* (168) type_name ::= TINYINT UNSIGNED */
- { 351, -2 }, /* (169) type_name ::= SMALLINT UNSIGNED */
- { 351, -2 }, /* (170) type_name ::= INT UNSIGNED */
- { 351, -2 }, /* (171) type_name ::= BIGINT UNSIGNED */
- { 351, -1 }, /* (172) type_name ::= JSON */
- { 351, -4 }, /* (173) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */
- { 351, -1 }, /* (174) type_name ::= MEDIUMBLOB */
- { 351, -1 }, /* (175) type_name ::= BLOB */
- { 351, -4 }, /* (176) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */
- { 351, -1 }, /* (177) type_name ::= DECIMAL */
- { 351, -4 }, /* (178) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */
- { 351, -6 }, /* (179) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */
- { 343, 0 }, /* (180) tags_def_opt ::= */
- { 343, -1 }, /* (181) tags_def_opt ::= tags_def */
- { 346, -4 }, /* (182) tags_def ::= TAGS NK_LP column_def_list NK_RP */
- { 344, 0 }, /* (183) table_options ::= */
- { 344, -3 }, /* (184) table_options ::= table_options COMMENT NK_STRING */
- { 344, -3 }, /* (185) table_options ::= table_options MAX_DELAY duration_list */
- { 344, -3 }, /* (186) table_options ::= table_options WATERMARK duration_list */
- { 344, -5 }, /* (187) table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */
- { 344, -3 }, /* (188) table_options ::= table_options TTL NK_INTEGER */
- { 344, -5 }, /* (189) table_options ::= table_options SMA NK_LP col_name_list NK_RP */
- { 349, -1 }, /* (190) alter_table_options ::= alter_table_option */
- { 349, -2 }, /* (191) alter_table_options ::= alter_table_options alter_table_option */
- { 362, -2 }, /* (192) alter_table_option ::= COMMENT NK_STRING */
- { 362, -2 }, /* (193) alter_table_option ::= TTL NK_INTEGER */
- { 360, -1 }, /* (194) duration_list ::= duration_literal */
- { 360, -3 }, /* (195) duration_list ::= duration_list NK_COMMA duration_literal */
- { 361, -1 }, /* (196) rollup_func_list ::= rollup_func_name */
- { 361, -3 }, /* (197) rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */
- { 364, -1 }, /* (198) rollup_func_name ::= function_name */
- { 364, -1 }, /* (199) rollup_func_name ::= FIRST */
- { 364, -1 }, /* (200) rollup_func_name ::= LAST */
- { 357, -1 }, /* (201) col_name_list ::= col_name */
- { 357, -3 }, /* (202) col_name_list ::= col_name_list NK_COMMA col_name */
- { 366, -1 }, /* (203) col_name ::= column_name */
- { 318, -2 }, /* (204) cmd ::= SHOW DNODES */
- { 318, -2 }, /* (205) cmd ::= SHOW USERS */
- { 318, -2 }, /* (206) cmd ::= SHOW DATABASES */
- { 318, -4 }, /* (207) cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */
- { 318, -4 }, /* (208) cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */
- { 318, -3 }, /* (209) cmd ::= SHOW db_name_cond_opt VGROUPS */
- { 318, -2 }, /* (210) cmd ::= SHOW MNODES */
- { 318, -2 }, /* (211) cmd ::= SHOW QNODES */
- { 318, -2 }, /* (212) cmd ::= SHOW FUNCTIONS */
- { 318, -5 }, /* (213) cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */
- { 318, -2 }, /* (214) cmd ::= SHOW STREAMS */
- { 318, -2 }, /* (215) cmd ::= SHOW ACCOUNTS */
- { 318, -2 }, /* (216) cmd ::= SHOW APPS */
- { 318, -2 }, /* (217) cmd ::= SHOW CONNECTIONS */
- { 318, -2 }, /* (218) cmd ::= SHOW LICENCES */
- { 318, -2 }, /* (219) cmd ::= SHOW GRANTS */
- { 318, -4 }, /* (220) cmd ::= SHOW CREATE DATABASE db_name */
- { 318, -4 }, /* (221) cmd ::= SHOW CREATE TABLE full_table_name */
- { 318, -4 }, /* (222) cmd ::= SHOW CREATE STABLE full_table_name */
- { 318, -2 }, /* (223) cmd ::= SHOW QUERIES */
- { 318, -2 }, /* (224) cmd ::= SHOW SCORES */
- { 318, -2 }, /* (225) cmd ::= SHOW TOPICS */
- { 318, -2 }, /* (226) cmd ::= SHOW VARIABLES */
- { 318, -3 }, /* (227) cmd ::= SHOW CLUSTER VARIABLES */
- { 318, -3 }, /* (228) cmd ::= SHOW LOCAL VARIABLES */
- { 318, -5 }, /* (229) cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt */
- { 318, -2 }, /* (230) cmd ::= SHOW BNODES */
- { 318, -2 }, /* (231) cmd ::= SHOW SNODES */
- { 318, -2 }, /* (232) cmd ::= SHOW CLUSTER */
- { 318, -2 }, /* (233) cmd ::= SHOW TRANSACTIONS */
- { 318, -4 }, /* (234) cmd ::= SHOW TABLE DISTRIBUTED full_table_name */
- { 318, -2 }, /* (235) cmd ::= SHOW CONSUMERS */
- { 318, -2 }, /* (236) cmd ::= SHOW SUBSCRIPTIONS */
- { 318, -5 }, /* (237) cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */
- { 318, -6 }, /* (238) cmd ::= SHOW TABLE TAGS FROM table_name_cond from_db_opt */
- { 318, -3 }, /* (239) cmd ::= SHOW VNODES NK_INTEGER */
- { 318, -3 }, /* (240) cmd ::= SHOW VNODES NK_STRING */
- { 367, 0 }, /* (241) db_name_cond_opt ::= */
- { 367, -2 }, /* (242) db_name_cond_opt ::= db_name NK_DOT */
- { 368, 0 }, /* (243) like_pattern_opt ::= */
- { 368, -2 }, /* (244) like_pattern_opt ::= LIKE NK_STRING */
- { 369, -1 }, /* (245) table_name_cond ::= table_name */
- { 370, 0 }, /* (246) from_db_opt ::= */
- { 370, -2 }, /* (247) from_db_opt ::= FROM db_name */
- { 318, -8 }, /* (248) cmd ::= CREATE SMA INDEX not_exists_opt full_table_name ON full_table_name index_options */
- { 318, -4 }, /* (249) cmd ::= DROP INDEX exists_opt full_table_name */
- { 371, -10 }, /* (250) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */
- { 371, -12 }, /* (251) 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 */
- { 372, -1 }, /* (252) func_list ::= func */
- { 372, -3 }, /* (253) func_list ::= func_list NK_COMMA func */
- { 375, -4 }, /* (254) func ::= function_name NK_LP expression_list NK_RP */
- { 374, 0 }, /* (255) sma_stream_opt ::= */
- { 374, -3 }, /* (256) sma_stream_opt ::= stream_options WATERMARK duration_literal */
- { 374, -3 }, /* (257) sma_stream_opt ::= stream_options MAX_DELAY duration_literal */
- { 318, -6 }, /* (258) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */
- { 318, -7 }, /* (259) cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name */
- { 318, -9 }, /* (260) cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name */
- { 318, -7 }, /* (261) cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name */
- { 318, -9 }, /* (262) cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name */
- { 318, -4 }, /* (263) cmd ::= DROP TOPIC exists_opt topic_name */
- { 318, -7 }, /* (264) cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */
- { 318, -2 }, /* (265) cmd ::= DESC full_table_name */
- { 318, -2 }, /* (266) cmd ::= DESCRIBE full_table_name */
- { 318, -3 }, /* (267) cmd ::= RESET QUERY CACHE */
- { 318, -4 }, /* (268) cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */
- { 380, 0 }, /* (269) analyze_opt ::= */
- { 380, -1 }, /* (270) analyze_opt ::= ANALYZE */
- { 381, 0 }, /* (271) explain_options ::= */
- { 381, -3 }, /* (272) explain_options ::= explain_options VERBOSE NK_BOOL */
- { 381, -3 }, /* (273) explain_options ::= explain_options RATIO NK_FLOAT */
- { 318, -10 }, /* (274) cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt */
- { 318, -4 }, /* (275) cmd ::= DROP FUNCTION exists_opt function_name */
- { 382, 0 }, /* (276) agg_func_opt ::= */
- { 382, -1 }, /* (277) agg_func_opt ::= AGGREGATE */
- { 383, 0 }, /* (278) bufsize_opt ::= */
- { 383, -2 }, /* (279) bufsize_opt ::= BUFSIZE NK_INTEGER */
- { 318, -11 }, /* (280) cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name tags_def_opt subtable_opt AS query_or_subquery */
- { 318, -4 }, /* (281) cmd ::= DROP STREAM exists_opt stream_name */
- { 376, 0 }, /* (282) stream_options ::= */
- { 376, -3 }, /* (283) stream_options ::= stream_options TRIGGER AT_ONCE */
- { 376, -3 }, /* (284) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */
- { 376, -4 }, /* (285) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */
- { 376, -3 }, /* (286) stream_options ::= stream_options WATERMARK duration_literal */
- { 376, -4 }, /* (287) stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */
- { 376, -3 }, /* (288) stream_options ::= stream_options FILL_HISTORY NK_INTEGER */
- { 385, 0 }, /* (289) subtable_opt ::= */
- { 385, -4 }, /* (290) subtable_opt ::= SUBTABLE NK_LP expression NK_RP */
- { 318, -3 }, /* (291) cmd ::= KILL CONNECTION NK_INTEGER */
- { 318, -3 }, /* (292) cmd ::= KILL QUERY NK_STRING */
- { 318, -3 }, /* (293) cmd ::= KILL TRANSACTION NK_INTEGER */
- { 318, -2 }, /* (294) cmd ::= BALANCE VGROUP */
- { 318, -4 }, /* (295) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */
- { 318, -4 }, /* (296) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */
- { 318, -3 }, /* (297) cmd ::= SPLIT VGROUP NK_INTEGER */
- { 387, -2 }, /* (298) dnode_list ::= DNODE NK_INTEGER */
- { 387, -3 }, /* (299) dnode_list ::= dnode_list DNODE NK_INTEGER */
- { 318, -4 }, /* (300) cmd ::= DELETE FROM full_table_name where_clause_opt */
- { 318, -1 }, /* (301) cmd ::= query_or_subquery */
- { 318, -7 }, /* (302) cmd ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */
- { 318, -4 }, /* (303) cmd ::= INSERT INTO full_table_name query_or_subquery */
- { 321, -1 }, /* (304) literal ::= NK_INTEGER */
- { 321, -1 }, /* (305) literal ::= NK_FLOAT */
- { 321, -1 }, /* (306) literal ::= NK_STRING */
- { 321, -1 }, /* (307) literal ::= NK_BOOL */
- { 321, -2 }, /* (308) literal ::= TIMESTAMP NK_STRING */
- { 321, -1 }, /* (309) literal ::= duration_literal */
- { 321, -1 }, /* (310) literal ::= NULL */
- { 321, -1 }, /* (311) literal ::= NK_QUESTION */
- { 363, -1 }, /* (312) duration_literal ::= NK_VARIABLE */
- { 389, -1 }, /* (313) signed ::= NK_INTEGER */
- { 389, -2 }, /* (314) signed ::= NK_PLUS NK_INTEGER */
- { 389, -2 }, /* (315) signed ::= NK_MINUS NK_INTEGER */
- { 389, -1 }, /* (316) signed ::= NK_FLOAT */
- { 389, -2 }, /* (317) signed ::= NK_PLUS NK_FLOAT */
- { 389, -2 }, /* (318) signed ::= NK_MINUS NK_FLOAT */
- { 352, -1 }, /* (319) signed_literal ::= signed */
- { 352, -1 }, /* (320) signed_literal ::= NK_STRING */
- { 352, -1 }, /* (321) signed_literal ::= NK_BOOL */
- { 352, -2 }, /* (322) signed_literal ::= TIMESTAMP NK_STRING */
- { 352, -1 }, /* (323) signed_literal ::= duration_literal */
- { 352, -1 }, /* (324) signed_literal ::= NULL */
- { 352, -1 }, /* (325) signed_literal ::= literal_func */
- { 352, -1 }, /* (326) signed_literal ::= NK_QUESTION */
- { 391, -1 }, /* (327) literal_list ::= signed_literal */
- { 391, -3 }, /* (328) literal_list ::= literal_list NK_COMMA signed_literal */
- { 329, -1 }, /* (329) db_name ::= NK_ID */
- { 358, -1 }, /* (330) table_name ::= NK_ID */
- { 350, -1 }, /* (331) column_name ::= NK_ID */
- { 365, -1 }, /* (332) function_name ::= NK_ID */
- { 392, -1 }, /* (333) table_alias ::= NK_ID */
- { 393, -1 }, /* (334) column_alias ::= NK_ID */
- { 323, -1 }, /* (335) user_name ::= NK_ID */
- { 377, -1 }, /* (336) topic_name ::= NK_ID */
- { 384, -1 }, /* (337) stream_name ::= NK_ID */
- { 379, -1 }, /* (338) cgroup_name ::= NK_ID */
- { 394, -1 }, /* (339) expr_or_subquery ::= expression */
- { 394, -1 }, /* (340) expr_or_subquery ::= subquery */
- { 386, -1 }, /* (341) expression ::= literal */
- { 386, -1 }, /* (342) expression ::= pseudo_column */
- { 386, -1 }, /* (343) expression ::= column_reference */
- { 386, -1 }, /* (344) expression ::= function_expression */
- { 386, -1 }, /* (345) expression ::= case_when_expression */
- { 386, -3 }, /* (346) expression ::= NK_LP expression NK_RP */
- { 386, -2 }, /* (347) expression ::= NK_PLUS expr_or_subquery */
- { 386, -2 }, /* (348) expression ::= NK_MINUS expr_or_subquery */
- { 386, -3 }, /* (349) expression ::= expr_or_subquery NK_PLUS expr_or_subquery */
- { 386, -3 }, /* (350) expression ::= expr_or_subquery NK_MINUS expr_or_subquery */
- { 386, -3 }, /* (351) expression ::= expr_or_subquery NK_STAR expr_or_subquery */
- { 386, -3 }, /* (352) expression ::= expr_or_subquery NK_SLASH expr_or_subquery */
- { 386, -3 }, /* (353) expression ::= expr_or_subquery NK_REM expr_or_subquery */
- { 386, -3 }, /* (354) expression ::= column_reference NK_ARROW NK_STRING */
- { 386, -3 }, /* (355) expression ::= expr_or_subquery NK_BITAND expr_or_subquery */
- { 386, -3 }, /* (356) expression ::= expr_or_subquery NK_BITOR expr_or_subquery */
- { 355, -1 }, /* (357) expression_list ::= expr_or_subquery */
- { 355, -3 }, /* (358) expression_list ::= expression_list NK_COMMA expr_or_subquery */
- { 397, -1 }, /* (359) column_reference ::= column_name */
- { 397, -3 }, /* (360) column_reference ::= table_name NK_DOT column_name */
- { 396, -1 }, /* (361) pseudo_column ::= ROWTS */
- { 396, -1 }, /* (362) pseudo_column ::= TBNAME */
- { 396, -3 }, /* (363) pseudo_column ::= table_name NK_DOT TBNAME */
- { 396, -1 }, /* (364) pseudo_column ::= QSTART */
- { 396, -1 }, /* (365) pseudo_column ::= QEND */
- { 396, -1 }, /* (366) pseudo_column ::= QDURATION */
- { 396, -1 }, /* (367) pseudo_column ::= WSTART */
- { 396, -1 }, /* (368) pseudo_column ::= WEND */
- { 396, -1 }, /* (369) pseudo_column ::= WDURATION */
- { 396, -1 }, /* (370) pseudo_column ::= IROWTS */
- { 396, -1 }, /* (371) pseudo_column ::= QTAGS */
- { 398, -4 }, /* (372) function_expression ::= function_name NK_LP expression_list NK_RP */
- { 398, -4 }, /* (373) function_expression ::= star_func NK_LP star_func_para_list NK_RP */
- { 398, -6 }, /* (374) function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */
- { 398, -1 }, /* (375) function_expression ::= literal_func */
- { 390, -3 }, /* (376) literal_func ::= noarg_func NK_LP NK_RP */
- { 390, -1 }, /* (377) literal_func ::= NOW */
- { 402, -1 }, /* (378) noarg_func ::= NOW */
- { 402, -1 }, /* (379) noarg_func ::= TODAY */
- { 402, -1 }, /* (380) noarg_func ::= TIMEZONE */
- { 402, -1 }, /* (381) noarg_func ::= DATABASE */
- { 402, -1 }, /* (382) noarg_func ::= CLIENT_VERSION */
- { 402, -1 }, /* (383) noarg_func ::= SERVER_VERSION */
- { 402, -1 }, /* (384) noarg_func ::= SERVER_STATUS */
- { 402, -1 }, /* (385) noarg_func ::= CURRENT_USER */
- { 402, -1 }, /* (386) noarg_func ::= USER */
- { 400, -1 }, /* (387) star_func ::= COUNT */
- { 400, -1 }, /* (388) star_func ::= FIRST */
- { 400, -1 }, /* (389) star_func ::= LAST */
- { 400, -1 }, /* (390) star_func ::= LAST_ROW */
- { 401, -1 }, /* (391) star_func_para_list ::= NK_STAR */
- { 401, -1 }, /* (392) star_func_para_list ::= other_para_list */
- { 403, -1 }, /* (393) other_para_list ::= star_func_para */
- { 403, -3 }, /* (394) other_para_list ::= other_para_list NK_COMMA star_func_para */
- { 404, -1 }, /* (395) star_func_para ::= expr_or_subquery */
- { 404, -3 }, /* (396) star_func_para ::= table_name NK_DOT NK_STAR */
- { 399, -4 }, /* (397) case_when_expression ::= CASE when_then_list case_when_else_opt END */
- { 399, -5 }, /* (398) case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */
- { 405, -1 }, /* (399) when_then_list ::= when_then_expr */
- { 405, -2 }, /* (400) when_then_list ::= when_then_list when_then_expr */
- { 408, -4 }, /* (401) when_then_expr ::= WHEN common_expression THEN common_expression */
- { 406, 0 }, /* (402) case_when_else_opt ::= */
- { 406, -2 }, /* (403) case_when_else_opt ::= ELSE common_expression */
- { 409, -3 }, /* (404) predicate ::= expr_or_subquery compare_op expr_or_subquery */
- { 409, -5 }, /* (405) predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */
- { 409, -6 }, /* (406) predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */
- { 409, -3 }, /* (407) predicate ::= expr_or_subquery IS NULL */
- { 409, -4 }, /* (408) predicate ::= expr_or_subquery IS NOT NULL */
- { 409, -3 }, /* (409) predicate ::= expr_or_subquery in_op in_predicate_value */
- { 410, -1 }, /* (410) compare_op ::= NK_LT */
- { 410, -1 }, /* (411) compare_op ::= NK_GT */
- { 410, -1 }, /* (412) compare_op ::= NK_LE */
- { 410, -1 }, /* (413) compare_op ::= NK_GE */
- { 410, -1 }, /* (414) compare_op ::= NK_NE */
- { 410, -1 }, /* (415) compare_op ::= NK_EQ */
- { 410, -1 }, /* (416) compare_op ::= LIKE */
- { 410, -2 }, /* (417) compare_op ::= NOT LIKE */
- { 410, -1 }, /* (418) compare_op ::= MATCH */
- { 410, -1 }, /* (419) compare_op ::= NMATCH */
- { 410, -1 }, /* (420) compare_op ::= CONTAINS */
- { 411, -1 }, /* (421) in_op ::= IN */
- { 411, -2 }, /* (422) in_op ::= NOT IN */
- { 412, -3 }, /* (423) in_predicate_value ::= NK_LP literal_list NK_RP */
- { 413, -1 }, /* (424) boolean_value_expression ::= boolean_primary */
- { 413, -2 }, /* (425) boolean_value_expression ::= NOT boolean_primary */
- { 413, -3 }, /* (426) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */
- { 413, -3 }, /* (427) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */
- { 414, -1 }, /* (428) boolean_primary ::= predicate */
- { 414, -3 }, /* (429) boolean_primary ::= NK_LP boolean_value_expression NK_RP */
- { 407, -1 }, /* (430) common_expression ::= expr_or_subquery */
- { 407, -1 }, /* (431) common_expression ::= boolean_value_expression */
- { 415, 0 }, /* (432) from_clause_opt ::= */
- { 415, -2 }, /* (433) from_clause_opt ::= FROM table_reference_list */
- { 416, -1 }, /* (434) table_reference_list ::= table_reference */
- { 416, -3 }, /* (435) table_reference_list ::= table_reference_list NK_COMMA table_reference */
- { 417, -1 }, /* (436) table_reference ::= table_primary */
- { 417, -1 }, /* (437) table_reference ::= joined_table */
- { 418, -2 }, /* (438) table_primary ::= table_name alias_opt */
- { 418, -4 }, /* (439) table_primary ::= db_name NK_DOT table_name alias_opt */
- { 418, -2 }, /* (440) table_primary ::= subquery alias_opt */
- { 418, -1 }, /* (441) table_primary ::= parenthesized_joined_table */
- { 420, 0 }, /* (442) alias_opt ::= */
- { 420, -1 }, /* (443) alias_opt ::= table_alias */
- { 420, -2 }, /* (444) alias_opt ::= AS table_alias */
- { 421, -3 }, /* (445) parenthesized_joined_table ::= NK_LP joined_table NK_RP */
- { 421, -3 }, /* (446) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */
- { 419, -6 }, /* (447) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */
- { 422, 0 }, /* (448) join_type ::= */
- { 422, -1 }, /* (449) join_type ::= INNER */
- { 424, -12 }, /* (450) 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 */
- { 425, 0 }, /* (451) set_quantifier_opt ::= */
- { 425, -1 }, /* (452) set_quantifier_opt ::= DISTINCT */
- { 425, -1 }, /* (453) set_quantifier_opt ::= ALL */
- { 426, -1 }, /* (454) select_list ::= select_item */
- { 426, -3 }, /* (455) select_list ::= select_list NK_COMMA select_item */
- { 434, -1 }, /* (456) select_item ::= NK_STAR */
- { 434, -1 }, /* (457) select_item ::= common_expression */
- { 434, -2 }, /* (458) select_item ::= common_expression column_alias */
- { 434, -3 }, /* (459) select_item ::= common_expression AS column_alias */
- { 434, -3 }, /* (460) select_item ::= table_name NK_DOT NK_STAR */
- { 388, 0 }, /* (461) where_clause_opt ::= */
- { 388, -2 }, /* (462) where_clause_opt ::= WHERE search_condition */
- { 427, 0 }, /* (463) partition_by_clause_opt ::= */
- { 427, -3 }, /* (464) partition_by_clause_opt ::= PARTITION BY partition_list */
- { 435, -1 }, /* (465) partition_list ::= partition_item */
- { 435, -3 }, /* (466) partition_list ::= partition_list NK_COMMA partition_item */
- { 436, -1 }, /* (467) partition_item ::= expr_or_subquery */
- { 436, -2 }, /* (468) partition_item ::= expr_or_subquery column_alias */
- { 436, -3 }, /* (469) partition_item ::= expr_or_subquery AS column_alias */
- { 431, 0 }, /* (470) twindow_clause_opt ::= */
- { 431, -6 }, /* (471) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */
- { 431, -4 }, /* (472) twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */
- { 431, -6 }, /* (473) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */
- { 431, -8 }, /* (474) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */
- { 373, 0 }, /* (475) sliding_opt ::= */
- { 373, -4 }, /* (476) sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */
- { 430, 0 }, /* (477) fill_opt ::= */
- { 430, -4 }, /* (478) fill_opt ::= FILL NK_LP fill_mode NK_RP */
- { 430, -6 }, /* (479) fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */
- { 437, -1 }, /* (480) fill_mode ::= NONE */
- { 437, -1 }, /* (481) fill_mode ::= PREV */
- { 437, -1 }, /* (482) fill_mode ::= NULL */
- { 437, -1 }, /* (483) fill_mode ::= LINEAR */
- { 437, -1 }, /* (484) fill_mode ::= NEXT */
- { 432, 0 }, /* (485) group_by_clause_opt ::= */
- { 432, -3 }, /* (486) group_by_clause_opt ::= GROUP BY group_by_list */
- { 438, -1 }, /* (487) group_by_list ::= expr_or_subquery */
- { 438, -3 }, /* (488) group_by_list ::= group_by_list NK_COMMA expr_or_subquery */
- { 433, 0 }, /* (489) having_clause_opt ::= */
- { 433, -2 }, /* (490) having_clause_opt ::= HAVING search_condition */
- { 428, 0 }, /* (491) range_opt ::= */
- { 428, -6 }, /* (492) range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */
- { 429, 0 }, /* (493) every_opt ::= */
- { 429, -4 }, /* (494) every_opt ::= EVERY NK_LP duration_literal NK_RP */
- { 439, -4 }, /* (495) query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */
- { 440, -1 }, /* (496) query_simple ::= query_specification */
- { 440, -1 }, /* (497) query_simple ::= union_query_expression */
- { 444, -4 }, /* (498) union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */
- { 444, -3 }, /* (499) union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */
- { 445, -1 }, /* (500) query_simple_or_subquery ::= query_simple */
- { 445, -1 }, /* (501) query_simple_or_subquery ::= subquery */
- { 378, -1 }, /* (502) query_or_subquery ::= query_expression */
- { 378, -1 }, /* (503) query_or_subquery ::= subquery */
- { 441, 0 }, /* (504) order_by_clause_opt ::= */
- { 441, -3 }, /* (505) order_by_clause_opt ::= ORDER BY sort_specification_list */
- { 442, 0 }, /* (506) slimit_clause_opt ::= */
- { 442, -2 }, /* (507) slimit_clause_opt ::= SLIMIT NK_INTEGER */
- { 442, -4 }, /* (508) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */
- { 442, -4 }, /* (509) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */
- { 443, 0 }, /* (510) limit_clause_opt ::= */
- { 443, -2 }, /* (511) limit_clause_opt ::= LIMIT NK_INTEGER */
- { 443, -4 }, /* (512) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */
- { 443, -4 }, /* (513) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */
- { 395, -3 }, /* (514) subquery ::= NK_LP query_expression NK_RP */
- { 395, -3 }, /* (515) subquery ::= NK_LP subquery NK_RP */
- { 423, -1 }, /* (516) search_condition ::= common_expression */
- { 446, -1 }, /* (517) sort_specification_list ::= sort_specification */
- { 446, -3 }, /* (518) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */
- { 447, -3 }, /* (519) sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */
- { 448, 0 }, /* (520) ordering_specification_opt ::= */
- { 448, -1 }, /* (521) ordering_specification_opt ::= ASC */
- { 448, -1 }, /* (522) ordering_specification_opt ::= DESC */
- { 449, 0 }, /* (523) null_ordering_opt ::= */
- { 449, -2 }, /* (524) null_ordering_opt ::= NULLS FIRST */
- { 449, -2 }, /* (525) null_ordering_opt ::= NULLS LAST */
+ { 319, -6 }, /* (0) cmd ::= CREATE ACCOUNT NK_ID PASS NK_STRING account_options */
+ { 319, -4 }, /* (1) cmd ::= ALTER ACCOUNT NK_ID alter_account_options */
+ { 320, 0 }, /* (2) account_options ::= */
+ { 320, -3 }, /* (3) account_options ::= account_options PPS literal */
+ { 320, -3 }, /* (4) account_options ::= account_options TSERIES literal */
+ { 320, -3 }, /* (5) account_options ::= account_options STORAGE literal */
+ { 320, -3 }, /* (6) account_options ::= account_options STREAMS literal */
+ { 320, -3 }, /* (7) account_options ::= account_options QTIME literal */
+ { 320, -3 }, /* (8) account_options ::= account_options DBS literal */
+ { 320, -3 }, /* (9) account_options ::= account_options USERS literal */
+ { 320, -3 }, /* (10) account_options ::= account_options CONNS literal */
+ { 320, -3 }, /* (11) account_options ::= account_options STATE literal */
+ { 321, -1 }, /* (12) alter_account_options ::= alter_account_option */
+ { 321, -2 }, /* (13) alter_account_options ::= alter_account_options alter_account_option */
+ { 323, -2 }, /* (14) alter_account_option ::= PASS literal */
+ { 323, -2 }, /* (15) alter_account_option ::= PPS literal */
+ { 323, -2 }, /* (16) alter_account_option ::= TSERIES literal */
+ { 323, -2 }, /* (17) alter_account_option ::= STORAGE literal */
+ { 323, -2 }, /* (18) alter_account_option ::= STREAMS literal */
+ { 323, -2 }, /* (19) alter_account_option ::= QTIME literal */
+ { 323, -2 }, /* (20) alter_account_option ::= DBS literal */
+ { 323, -2 }, /* (21) alter_account_option ::= USERS literal */
+ { 323, -2 }, /* (22) alter_account_option ::= CONNS literal */
+ { 323, -2 }, /* (23) alter_account_option ::= STATE literal */
+ { 319, -6 }, /* (24) cmd ::= CREATE USER user_name PASS NK_STRING sysinfo_opt */
+ { 319, -5 }, /* (25) cmd ::= ALTER USER user_name PASS NK_STRING */
+ { 319, -5 }, /* (26) cmd ::= ALTER USER user_name ENABLE NK_INTEGER */
+ { 319, -5 }, /* (27) cmd ::= ALTER USER user_name SYSINFO NK_INTEGER */
+ { 319, -3 }, /* (28) cmd ::= DROP USER user_name */
+ { 325, 0 }, /* (29) sysinfo_opt ::= */
+ { 325, -2 }, /* (30) sysinfo_opt ::= SYSINFO NK_INTEGER */
+ { 319, -6 }, /* (31) cmd ::= GRANT privileges ON priv_level TO user_name */
+ { 319, -6 }, /* (32) cmd ::= REVOKE privileges ON priv_level FROM user_name */
+ { 326, -1 }, /* (33) privileges ::= ALL */
+ { 326, -1 }, /* (34) privileges ::= priv_type_list */
+ { 328, -1 }, /* (35) priv_type_list ::= priv_type */
+ { 328, -3 }, /* (36) priv_type_list ::= priv_type_list NK_COMMA priv_type */
+ { 329, -1 }, /* (37) priv_type ::= READ */
+ { 329, -1 }, /* (38) priv_type ::= WRITE */
+ { 327, -3 }, /* (39) priv_level ::= NK_STAR NK_DOT NK_STAR */
+ { 327, -3 }, /* (40) priv_level ::= db_name NK_DOT NK_STAR */
+ { 319, -3 }, /* (41) cmd ::= CREATE DNODE dnode_endpoint */
+ { 319, -5 }, /* (42) cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER */
+ { 319, -4 }, /* (43) cmd ::= DROP DNODE NK_INTEGER force_opt */
+ { 319, -4 }, /* (44) cmd ::= DROP DNODE dnode_endpoint force_opt */
+ { 319, -4 }, /* (45) cmd ::= ALTER DNODE NK_INTEGER NK_STRING */
+ { 319, -5 }, /* (46) cmd ::= ALTER DNODE NK_INTEGER NK_STRING NK_STRING */
+ { 319, -4 }, /* (47) cmd ::= ALTER ALL DNODES NK_STRING */
+ { 319, -5 }, /* (48) cmd ::= ALTER ALL DNODES NK_STRING NK_STRING */
+ { 331, -1 }, /* (49) dnode_endpoint ::= NK_STRING */
+ { 331, -1 }, /* (50) dnode_endpoint ::= NK_ID */
+ { 331, -1 }, /* (51) dnode_endpoint ::= NK_IPTOKEN */
+ { 332, 0 }, /* (52) force_opt ::= */
+ { 332, -1 }, /* (53) force_opt ::= FORCE */
+ { 319, -3 }, /* (54) cmd ::= ALTER LOCAL NK_STRING */
+ { 319, -4 }, /* (55) cmd ::= ALTER LOCAL NK_STRING NK_STRING */
+ { 319, -5 }, /* (56) cmd ::= CREATE QNODE ON DNODE NK_INTEGER */
+ { 319, -5 }, /* (57) cmd ::= DROP QNODE ON DNODE NK_INTEGER */
+ { 319, -5 }, /* (58) cmd ::= CREATE BNODE ON DNODE NK_INTEGER */
+ { 319, -5 }, /* (59) cmd ::= DROP BNODE ON DNODE NK_INTEGER */
+ { 319, -5 }, /* (60) cmd ::= CREATE SNODE ON DNODE NK_INTEGER */
+ { 319, -5 }, /* (61) cmd ::= DROP SNODE ON DNODE NK_INTEGER */
+ { 319, -5 }, /* (62) cmd ::= CREATE MNODE ON DNODE NK_INTEGER */
+ { 319, -5 }, /* (63) cmd ::= DROP MNODE ON DNODE NK_INTEGER */
+ { 319, -5 }, /* (64) cmd ::= CREATE DATABASE not_exists_opt db_name db_options */
+ { 319, -4 }, /* (65) cmd ::= DROP DATABASE exists_opt db_name */
+ { 319, -2 }, /* (66) cmd ::= USE db_name */
+ { 319, -4 }, /* (67) cmd ::= ALTER DATABASE db_name alter_db_options */
+ { 319, -3 }, /* (68) cmd ::= FLUSH DATABASE db_name */
+ { 319, -4 }, /* (69) cmd ::= TRIM DATABASE db_name speed_opt */
+ { 333, -3 }, /* (70) not_exists_opt ::= IF NOT EXISTS */
+ { 333, 0 }, /* (71) not_exists_opt ::= */
+ { 335, -2 }, /* (72) exists_opt ::= IF EXISTS */
+ { 335, 0 }, /* (73) exists_opt ::= */
+ { 334, 0 }, /* (74) db_options ::= */
+ { 334, -3 }, /* (75) db_options ::= db_options BUFFER NK_INTEGER */
+ { 334, -3 }, /* (76) db_options ::= db_options CACHEMODEL NK_STRING */
+ { 334, -3 }, /* (77) db_options ::= db_options CACHESIZE NK_INTEGER */
+ { 334, -3 }, /* (78) db_options ::= db_options COMP NK_INTEGER */
+ { 334, -3 }, /* (79) db_options ::= db_options DURATION NK_INTEGER */
+ { 334, -3 }, /* (80) db_options ::= db_options DURATION NK_VARIABLE */
+ { 334, -3 }, /* (81) db_options ::= db_options MAXROWS NK_INTEGER */
+ { 334, -3 }, /* (82) db_options ::= db_options MINROWS NK_INTEGER */
+ { 334, -3 }, /* (83) db_options ::= db_options KEEP integer_list */
+ { 334, -3 }, /* (84) db_options ::= db_options KEEP variable_list */
+ { 334, -3 }, /* (85) db_options ::= db_options PAGES NK_INTEGER */
+ { 334, -3 }, /* (86) db_options ::= db_options PAGESIZE NK_INTEGER */
+ { 334, -3 }, /* (87) db_options ::= db_options TSDB_PAGESIZE NK_INTEGER */
+ { 334, -3 }, /* (88) db_options ::= db_options PRECISION NK_STRING */
+ { 334, -3 }, /* (89) db_options ::= db_options REPLICA NK_INTEGER */
+ { 334, -3 }, /* (90) db_options ::= db_options STRICT NK_STRING */
+ { 334, -3 }, /* (91) db_options ::= db_options VGROUPS NK_INTEGER */
+ { 334, -3 }, /* (92) db_options ::= db_options SINGLE_STABLE NK_INTEGER */
+ { 334, -3 }, /* (93) db_options ::= db_options RETENTIONS retention_list */
+ { 334, -3 }, /* (94) db_options ::= db_options SCHEMALESS NK_INTEGER */
+ { 334, -3 }, /* (95) db_options ::= db_options WAL_LEVEL NK_INTEGER */
+ { 334, -3 }, /* (96) db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER */
+ { 334, -3 }, /* (97) db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER */
+ { 334, -4 }, /* (98) db_options ::= db_options WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */
+ { 334, -3 }, /* (99) db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER */
+ { 334, -4 }, /* (100) db_options ::= db_options WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */
+ { 334, -3 }, /* (101) db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER */
+ { 334, -3 }, /* (102) db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER */
+ { 334, -3 }, /* (103) db_options ::= db_options STT_TRIGGER NK_INTEGER */
+ { 334, -3 }, /* (104) db_options ::= db_options TABLE_PREFIX NK_INTEGER */
+ { 334, -3 }, /* (105) db_options ::= db_options TABLE_SUFFIX NK_INTEGER */
+ { 336, -1 }, /* (106) alter_db_options ::= alter_db_option */
+ { 336, -2 }, /* (107) alter_db_options ::= alter_db_options alter_db_option */
+ { 341, -2 }, /* (108) alter_db_option ::= BUFFER NK_INTEGER */
+ { 341, -2 }, /* (109) alter_db_option ::= CACHEMODEL NK_STRING */
+ { 341, -2 }, /* (110) alter_db_option ::= CACHESIZE NK_INTEGER */
+ { 341, -2 }, /* (111) alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER */
+ { 341, -2 }, /* (112) alter_db_option ::= KEEP integer_list */
+ { 341, -2 }, /* (113) alter_db_option ::= KEEP variable_list */
+ { 341, -2 }, /* (114) alter_db_option ::= PAGES NK_INTEGER */
+ { 341, -2 }, /* (115) alter_db_option ::= REPLICA NK_INTEGER */
+ { 341, -2 }, /* (116) alter_db_option ::= STRICT NK_STRING */
+ { 341, -2 }, /* (117) alter_db_option ::= WAL_LEVEL NK_INTEGER */
+ { 341, -2 }, /* (118) alter_db_option ::= STT_TRIGGER NK_INTEGER */
+ { 338, -1 }, /* (119) integer_list ::= NK_INTEGER */
+ { 338, -3 }, /* (120) integer_list ::= integer_list NK_COMMA NK_INTEGER */
+ { 339, -1 }, /* (121) variable_list ::= NK_VARIABLE */
+ { 339, -3 }, /* (122) variable_list ::= variable_list NK_COMMA NK_VARIABLE */
+ { 340, -1 }, /* (123) retention_list ::= retention */
+ { 340, -3 }, /* (124) retention_list ::= retention_list NK_COMMA retention */
+ { 342, -3 }, /* (125) retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */
+ { 337, 0 }, /* (126) speed_opt ::= */
+ { 337, -2 }, /* (127) speed_opt ::= MAX_SPEED NK_INTEGER */
+ { 319, -9 }, /* (128) cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */
+ { 319, -3 }, /* (129) cmd ::= CREATE TABLE multi_create_clause */
+ { 319, -9 }, /* (130) cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */
+ { 319, -3 }, /* (131) cmd ::= DROP TABLE multi_drop_clause */
+ { 319, -4 }, /* (132) cmd ::= DROP STABLE exists_opt full_table_name */
+ { 319, -3 }, /* (133) cmd ::= ALTER TABLE alter_table_clause */
+ { 319, -3 }, /* (134) cmd ::= ALTER STABLE alter_table_clause */
+ { 350, -2 }, /* (135) alter_table_clause ::= full_table_name alter_table_options */
+ { 350, -5 }, /* (136) alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */
+ { 350, -4 }, /* (137) alter_table_clause ::= full_table_name DROP COLUMN column_name */
+ { 350, -5 }, /* (138) alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */
+ { 350, -5 }, /* (139) alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */
+ { 350, -5 }, /* (140) alter_table_clause ::= full_table_name ADD TAG column_name type_name */
+ { 350, -4 }, /* (141) alter_table_clause ::= full_table_name DROP TAG column_name */
+ { 350, -5 }, /* (142) alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */
+ { 350, -5 }, /* (143) alter_table_clause ::= full_table_name RENAME TAG column_name column_name */
+ { 350, -6 }, /* (144) alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */
+ { 347, -1 }, /* (145) multi_create_clause ::= create_subtable_clause */
+ { 347, -2 }, /* (146) multi_create_clause ::= multi_create_clause create_subtable_clause */
+ { 355, -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 */
+ { 349, -1 }, /* (148) multi_drop_clause ::= drop_table_clause */
+ { 349, -2 }, /* (149) multi_drop_clause ::= multi_drop_clause drop_table_clause */
+ { 358, -2 }, /* (150) drop_table_clause ::= exists_opt full_table_name */
+ { 356, 0 }, /* (151) specific_cols_opt ::= */
+ { 356, -3 }, /* (152) specific_cols_opt ::= NK_LP col_name_list NK_RP */
+ { 343, -1 }, /* (153) full_table_name ::= table_name */
+ { 343, -3 }, /* (154) full_table_name ::= db_name NK_DOT table_name */
+ { 344, -1 }, /* (155) column_def_list ::= column_def */
+ { 344, -3 }, /* (156) column_def_list ::= column_def_list NK_COMMA column_def */
+ { 361, -2 }, /* (157) column_def ::= column_name type_name */
+ { 361, -4 }, /* (158) column_def ::= column_name type_name COMMENT NK_STRING */
+ { 353, -1 }, /* (159) type_name ::= BOOL */
+ { 353, -1 }, /* (160) type_name ::= TINYINT */
+ { 353, -1 }, /* (161) type_name ::= SMALLINT */
+ { 353, -1 }, /* (162) type_name ::= INT */
+ { 353, -1 }, /* (163) type_name ::= INTEGER */
+ { 353, -1 }, /* (164) type_name ::= BIGINT */
+ { 353, -1 }, /* (165) type_name ::= FLOAT */
+ { 353, -1 }, /* (166) type_name ::= DOUBLE */
+ { 353, -4 }, /* (167) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */
+ { 353, -1 }, /* (168) type_name ::= TIMESTAMP */
+ { 353, -4 }, /* (169) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */
+ { 353, -2 }, /* (170) type_name ::= TINYINT UNSIGNED */
+ { 353, -2 }, /* (171) type_name ::= SMALLINT UNSIGNED */
+ { 353, -2 }, /* (172) type_name ::= INT UNSIGNED */
+ { 353, -2 }, /* (173) type_name ::= BIGINT UNSIGNED */
+ { 353, -1 }, /* (174) type_name ::= JSON */
+ { 353, -4 }, /* (175) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */
+ { 353, -1 }, /* (176) type_name ::= MEDIUMBLOB */
+ { 353, -1 }, /* (177) type_name ::= BLOB */
+ { 353, -4 }, /* (178) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */
+ { 353, -1 }, /* (179) type_name ::= DECIMAL */
+ { 353, -4 }, /* (180) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */
+ { 353, -6 }, /* (181) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */
+ { 345, 0 }, /* (182) tags_def_opt ::= */
+ { 345, -1 }, /* (183) tags_def_opt ::= tags_def */
+ { 348, -4 }, /* (184) tags_def ::= TAGS NK_LP column_def_list NK_RP */
+ { 346, 0 }, /* (185) table_options ::= */
+ { 346, -3 }, /* (186) table_options ::= table_options COMMENT NK_STRING */
+ { 346, -3 }, /* (187) table_options ::= table_options MAX_DELAY duration_list */
+ { 346, -3 }, /* (188) table_options ::= table_options WATERMARK duration_list */
+ { 346, -5 }, /* (189) table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */
+ { 346, -3 }, /* (190) table_options ::= table_options TTL NK_INTEGER */
+ { 346, -5 }, /* (191) table_options ::= table_options SMA NK_LP col_name_list NK_RP */
+ { 351, -1 }, /* (192) alter_table_options ::= alter_table_option */
+ { 351, -2 }, /* (193) alter_table_options ::= alter_table_options alter_table_option */
+ { 364, -2 }, /* (194) alter_table_option ::= COMMENT NK_STRING */
+ { 364, -2 }, /* (195) alter_table_option ::= TTL NK_INTEGER */
+ { 362, -1 }, /* (196) duration_list ::= duration_literal */
+ { 362, -3 }, /* (197) duration_list ::= duration_list NK_COMMA duration_literal */
+ { 363, -1 }, /* (198) rollup_func_list ::= rollup_func_name */
+ { 363, -3 }, /* (199) rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */
+ { 366, -1 }, /* (200) rollup_func_name ::= function_name */
+ { 366, -1 }, /* (201) rollup_func_name ::= FIRST */
+ { 366, -1 }, /* (202) rollup_func_name ::= LAST */
+ { 359, -1 }, /* (203) col_name_list ::= col_name */
+ { 359, -3 }, /* (204) col_name_list ::= col_name_list NK_COMMA col_name */
+ { 368, -1 }, /* (205) col_name ::= column_name */
+ { 319, -2 }, /* (206) cmd ::= SHOW DNODES */
+ { 319, -2 }, /* (207) cmd ::= SHOW USERS */
+ { 319, -2 }, /* (208) cmd ::= SHOW DATABASES */
+ { 319, -4 }, /* (209) cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */
+ { 319, -4 }, /* (210) cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */
+ { 319, -3 }, /* (211) cmd ::= SHOW db_name_cond_opt VGROUPS */
+ { 319, -2 }, /* (212) cmd ::= SHOW MNODES */
+ { 319, -2 }, /* (213) cmd ::= SHOW QNODES */
+ { 319, -2 }, /* (214) cmd ::= SHOW FUNCTIONS */
+ { 319, -5 }, /* (215) cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */
+ { 319, -2 }, /* (216) cmd ::= SHOW STREAMS */
+ { 319, -2 }, /* (217) cmd ::= SHOW ACCOUNTS */
+ { 319, -2 }, /* (218) cmd ::= SHOW APPS */
+ { 319, -2 }, /* (219) cmd ::= SHOW CONNECTIONS */
+ { 319, -2 }, /* (220) cmd ::= SHOW LICENCES */
+ { 319, -2 }, /* (221) cmd ::= SHOW GRANTS */
+ { 319, -4 }, /* (222) cmd ::= SHOW CREATE DATABASE db_name */
+ { 319, -4 }, /* (223) cmd ::= SHOW CREATE TABLE full_table_name */
+ { 319, -4 }, /* (224) cmd ::= SHOW CREATE STABLE full_table_name */
+ { 319, -2 }, /* (225) cmd ::= SHOW QUERIES */
+ { 319, -2 }, /* (226) cmd ::= SHOW SCORES */
+ { 319, -2 }, /* (227) cmd ::= SHOW TOPICS */
+ { 319, -2 }, /* (228) cmd ::= SHOW VARIABLES */
+ { 319, -3 }, /* (229) cmd ::= SHOW CLUSTER VARIABLES */
+ { 319, -3 }, /* (230) cmd ::= SHOW LOCAL VARIABLES */
+ { 319, -5 }, /* (231) cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt */
+ { 319, -2 }, /* (232) cmd ::= SHOW BNODES */
+ { 319, -2 }, /* (233) cmd ::= SHOW SNODES */
+ { 319, -2 }, /* (234) cmd ::= SHOW CLUSTER */
+ { 319, -2 }, /* (235) cmd ::= SHOW TRANSACTIONS */
+ { 319, -4 }, /* (236) cmd ::= SHOW TABLE DISTRIBUTED full_table_name */
+ { 319, -2 }, /* (237) cmd ::= SHOW CONSUMERS */
+ { 319, -2 }, /* (238) cmd ::= SHOW SUBSCRIPTIONS */
+ { 319, -5 }, /* (239) cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */
+ { 319, -6 }, /* (240) cmd ::= SHOW TABLE TAGS FROM table_name_cond from_db_opt */
+ { 319, -3 }, /* (241) cmd ::= SHOW VNODES NK_INTEGER */
+ { 319, -3 }, /* (242) cmd ::= SHOW VNODES NK_STRING */
+ { 369, 0 }, /* (243) db_name_cond_opt ::= */
+ { 369, -2 }, /* (244) db_name_cond_opt ::= db_name NK_DOT */
+ { 370, 0 }, /* (245) like_pattern_opt ::= */
+ { 370, -2 }, /* (246) like_pattern_opt ::= LIKE NK_STRING */
+ { 371, -1 }, /* (247) table_name_cond ::= table_name */
+ { 372, 0 }, /* (248) from_db_opt ::= */
+ { 372, -2 }, /* (249) from_db_opt ::= FROM db_name */
+ { 319, -8 }, /* (250) cmd ::= CREATE SMA INDEX not_exists_opt full_table_name ON full_table_name index_options */
+ { 319, -4 }, /* (251) cmd ::= DROP INDEX exists_opt full_table_name */
+ { 373, -10 }, /* (252) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */
+ { 373, -12 }, /* (253) 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 */
+ { 374, -1 }, /* (254) func_list ::= func */
+ { 374, -3 }, /* (255) func_list ::= func_list NK_COMMA func */
+ { 377, -4 }, /* (256) func ::= function_name NK_LP expression_list NK_RP */
+ { 376, 0 }, /* (257) sma_stream_opt ::= */
+ { 376, -3 }, /* (258) sma_stream_opt ::= stream_options WATERMARK duration_literal */
+ { 376, -3 }, /* (259) sma_stream_opt ::= stream_options MAX_DELAY duration_literal */
+ { 319, -6 }, /* (260) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */
+ { 319, -7 }, /* (261) cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name */
+ { 319, -9 }, /* (262) cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name */
+ { 319, -7 }, /* (263) cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name */
+ { 319, -9 }, /* (264) cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name */
+ { 319, -4 }, /* (265) cmd ::= DROP TOPIC exists_opt topic_name */
+ { 319, -7 }, /* (266) cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */
+ { 319, -2 }, /* (267) cmd ::= DESC full_table_name */
+ { 319, -2 }, /* (268) cmd ::= DESCRIBE full_table_name */
+ { 319, -3 }, /* (269) cmd ::= RESET QUERY CACHE */
+ { 319, -4 }, /* (270) cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */
+ { 382, 0 }, /* (271) analyze_opt ::= */
+ { 382, -1 }, /* (272) analyze_opt ::= ANALYZE */
+ { 383, 0 }, /* (273) explain_options ::= */
+ { 383, -3 }, /* (274) explain_options ::= explain_options VERBOSE NK_BOOL */
+ { 383, -3 }, /* (275) explain_options ::= explain_options RATIO NK_FLOAT */
+ { 319, -10 }, /* (276) cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt */
+ { 319, -4 }, /* (277) cmd ::= DROP FUNCTION exists_opt function_name */
+ { 384, 0 }, /* (278) agg_func_opt ::= */
+ { 384, -1 }, /* (279) agg_func_opt ::= AGGREGATE */
+ { 385, 0 }, /* (280) bufsize_opt ::= */
+ { 385, -2 }, /* (281) bufsize_opt ::= BUFSIZE NK_INTEGER */
+ { 319, -11 }, /* (282) cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name tags_def_opt subtable_opt AS query_or_subquery */
+ { 319, -4 }, /* (283) cmd ::= DROP STREAM exists_opt stream_name */
+ { 378, 0 }, /* (284) stream_options ::= */
+ { 378, -3 }, /* (285) stream_options ::= stream_options TRIGGER AT_ONCE */
+ { 378, -3 }, /* (286) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */
+ { 378, -4 }, /* (287) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */
+ { 378, -3 }, /* (288) stream_options ::= stream_options WATERMARK duration_literal */
+ { 378, -4 }, /* (289) stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */
+ { 378, -3 }, /* (290) stream_options ::= stream_options FILL_HISTORY NK_INTEGER */
+ { 387, 0 }, /* (291) subtable_opt ::= */
+ { 387, -4 }, /* (292) subtable_opt ::= SUBTABLE NK_LP expression NK_RP */
+ { 319, -3 }, /* (293) cmd ::= KILL CONNECTION NK_INTEGER */
+ { 319, -3 }, /* (294) cmd ::= KILL QUERY NK_STRING */
+ { 319, -3 }, /* (295) cmd ::= KILL TRANSACTION NK_INTEGER */
+ { 319, -2 }, /* (296) cmd ::= BALANCE VGROUP */
+ { 319, -4 }, /* (297) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */
+ { 319, -4 }, /* (298) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */
+ { 319, -3 }, /* (299) cmd ::= SPLIT VGROUP NK_INTEGER */
+ { 389, -2 }, /* (300) dnode_list ::= DNODE NK_INTEGER */
+ { 389, -3 }, /* (301) dnode_list ::= dnode_list DNODE NK_INTEGER */
+ { 319, -4 }, /* (302) cmd ::= DELETE FROM full_table_name where_clause_opt */
+ { 319, -1 }, /* (303) cmd ::= query_or_subquery */
+ { 319, -7 }, /* (304) cmd ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */
+ { 319, -4 }, /* (305) cmd ::= INSERT INTO full_table_name query_or_subquery */
+ { 322, -1 }, /* (306) literal ::= NK_INTEGER */
+ { 322, -1 }, /* (307) literal ::= NK_FLOAT */
+ { 322, -1 }, /* (308) literal ::= NK_STRING */
+ { 322, -1 }, /* (309) literal ::= NK_BOOL */
+ { 322, -2 }, /* (310) literal ::= TIMESTAMP NK_STRING */
+ { 322, -1 }, /* (311) literal ::= duration_literal */
+ { 322, -1 }, /* (312) literal ::= NULL */
+ { 322, -1 }, /* (313) literal ::= NK_QUESTION */
+ { 365, -1 }, /* (314) duration_literal ::= NK_VARIABLE */
+ { 391, -1 }, /* (315) signed ::= NK_INTEGER */
+ { 391, -2 }, /* (316) signed ::= NK_PLUS NK_INTEGER */
+ { 391, -2 }, /* (317) signed ::= NK_MINUS NK_INTEGER */
+ { 391, -1 }, /* (318) signed ::= NK_FLOAT */
+ { 391, -2 }, /* (319) signed ::= NK_PLUS NK_FLOAT */
+ { 391, -2 }, /* (320) signed ::= NK_MINUS NK_FLOAT */
+ { 354, -1 }, /* (321) signed_literal ::= signed */
+ { 354, -1 }, /* (322) signed_literal ::= NK_STRING */
+ { 354, -1 }, /* (323) signed_literal ::= NK_BOOL */
+ { 354, -2 }, /* (324) signed_literal ::= TIMESTAMP NK_STRING */
+ { 354, -1 }, /* (325) signed_literal ::= duration_literal */
+ { 354, -1 }, /* (326) signed_literal ::= NULL */
+ { 354, -1 }, /* (327) signed_literal ::= literal_func */
+ { 354, -1 }, /* (328) signed_literal ::= NK_QUESTION */
+ { 393, -1 }, /* (329) literal_list ::= signed_literal */
+ { 393, -3 }, /* (330) literal_list ::= literal_list NK_COMMA signed_literal */
+ { 330, -1 }, /* (331) db_name ::= NK_ID */
+ { 360, -1 }, /* (332) table_name ::= NK_ID */
+ { 352, -1 }, /* (333) column_name ::= NK_ID */
+ { 367, -1 }, /* (334) function_name ::= NK_ID */
+ { 394, -1 }, /* (335) table_alias ::= NK_ID */
+ { 395, -1 }, /* (336) column_alias ::= NK_ID */
+ { 324, -1 }, /* (337) user_name ::= NK_ID */
+ { 379, -1 }, /* (338) topic_name ::= NK_ID */
+ { 386, -1 }, /* (339) stream_name ::= NK_ID */
+ { 381, -1 }, /* (340) cgroup_name ::= NK_ID */
+ { 396, -1 }, /* (341) expr_or_subquery ::= expression */
+ { 396, -1 }, /* (342) expr_or_subquery ::= subquery */
+ { 388, -1 }, /* (343) expression ::= literal */
+ { 388, -1 }, /* (344) expression ::= pseudo_column */
+ { 388, -1 }, /* (345) expression ::= column_reference */
+ { 388, -1 }, /* (346) expression ::= function_expression */
+ { 388, -1 }, /* (347) expression ::= case_when_expression */
+ { 388, -3 }, /* (348) expression ::= NK_LP expression NK_RP */
+ { 388, -2 }, /* (349) expression ::= NK_PLUS expr_or_subquery */
+ { 388, -2 }, /* (350) expression ::= NK_MINUS expr_or_subquery */
+ { 388, -3 }, /* (351) expression ::= expr_or_subquery NK_PLUS expr_or_subquery */
+ { 388, -3 }, /* (352) expression ::= expr_or_subquery NK_MINUS expr_or_subquery */
+ { 388, -3 }, /* (353) expression ::= expr_or_subquery NK_STAR expr_or_subquery */
+ { 388, -3 }, /* (354) expression ::= expr_or_subquery NK_SLASH expr_or_subquery */
+ { 388, -3 }, /* (355) expression ::= expr_or_subquery NK_REM expr_or_subquery */
+ { 388, -3 }, /* (356) expression ::= column_reference NK_ARROW NK_STRING */
+ { 388, -3 }, /* (357) expression ::= expr_or_subquery NK_BITAND expr_or_subquery */
+ { 388, -3 }, /* (358) expression ::= expr_or_subquery NK_BITOR expr_or_subquery */
+ { 357, -1 }, /* (359) expression_list ::= expr_or_subquery */
+ { 357, -3 }, /* (360) expression_list ::= expression_list NK_COMMA expr_or_subquery */
+ { 399, -1 }, /* (361) column_reference ::= column_name */
+ { 399, -3 }, /* (362) column_reference ::= table_name NK_DOT column_name */
+ { 398, -1 }, /* (363) pseudo_column ::= ROWTS */
+ { 398, -1 }, /* (364) pseudo_column ::= TBNAME */
+ { 398, -3 }, /* (365) pseudo_column ::= table_name NK_DOT TBNAME */
+ { 398, -1 }, /* (366) pseudo_column ::= QSTART */
+ { 398, -1 }, /* (367) pseudo_column ::= QEND */
+ { 398, -1 }, /* (368) pseudo_column ::= QDURATION */
+ { 398, -1 }, /* (369) pseudo_column ::= WSTART */
+ { 398, -1 }, /* (370) pseudo_column ::= WEND */
+ { 398, -1 }, /* (371) pseudo_column ::= WDURATION */
+ { 398, -1 }, /* (372) pseudo_column ::= IROWTS */
+ { 398, -1 }, /* (373) pseudo_column ::= QTAGS */
+ { 400, -4 }, /* (374) function_expression ::= function_name NK_LP expression_list NK_RP */
+ { 400, -4 }, /* (375) function_expression ::= star_func NK_LP star_func_para_list NK_RP */
+ { 400, -6 }, /* (376) function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */
+ { 400, -1 }, /* (377) function_expression ::= literal_func */
+ { 392, -3 }, /* (378) literal_func ::= noarg_func NK_LP NK_RP */
+ { 392, -1 }, /* (379) literal_func ::= NOW */
+ { 404, -1 }, /* (380) noarg_func ::= NOW */
+ { 404, -1 }, /* (381) noarg_func ::= TODAY */
+ { 404, -1 }, /* (382) noarg_func ::= TIMEZONE */
+ { 404, -1 }, /* (383) noarg_func ::= DATABASE */
+ { 404, -1 }, /* (384) noarg_func ::= CLIENT_VERSION */
+ { 404, -1 }, /* (385) noarg_func ::= SERVER_VERSION */
+ { 404, -1 }, /* (386) noarg_func ::= SERVER_STATUS */
+ { 404, -1 }, /* (387) noarg_func ::= CURRENT_USER */
+ { 404, -1 }, /* (388) noarg_func ::= USER */
+ { 402, -1 }, /* (389) star_func ::= COUNT */
+ { 402, -1 }, /* (390) star_func ::= FIRST */
+ { 402, -1 }, /* (391) star_func ::= LAST */
+ { 402, -1 }, /* (392) star_func ::= LAST_ROW */
+ { 403, -1 }, /* (393) star_func_para_list ::= NK_STAR */
+ { 403, -1 }, /* (394) star_func_para_list ::= other_para_list */
+ { 405, -1 }, /* (395) other_para_list ::= star_func_para */
+ { 405, -3 }, /* (396) other_para_list ::= other_para_list NK_COMMA star_func_para */
+ { 406, -1 }, /* (397) star_func_para ::= expr_or_subquery */
+ { 406, -3 }, /* (398) star_func_para ::= table_name NK_DOT NK_STAR */
+ { 401, -4 }, /* (399) case_when_expression ::= CASE when_then_list case_when_else_opt END */
+ { 401, -5 }, /* (400) case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */
+ { 407, -1 }, /* (401) when_then_list ::= when_then_expr */
+ { 407, -2 }, /* (402) when_then_list ::= when_then_list when_then_expr */
+ { 410, -4 }, /* (403) when_then_expr ::= WHEN common_expression THEN common_expression */
+ { 408, 0 }, /* (404) case_when_else_opt ::= */
+ { 408, -2 }, /* (405) case_when_else_opt ::= ELSE common_expression */
+ { 411, -3 }, /* (406) predicate ::= expr_or_subquery compare_op expr_or_subquery */
+ { 411, -5 }, /* (407) predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */
+ { 411, -6 }, /* (408) predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */
+ { 411, -3 }, /* (409) predicate ::= expr_or_subquery IS NULL */
+ { 411, -4 }, /* (410) predicate ::= expr_or_subquery IS NOT NULL */
+ { 411, -3 }, /* (411) predicate ::= expr_or_subquery in_op in_predicate_value */
+ { 412, -1 }, /* (412) compare_op ::= NK_LT */
+ { 412, -1 }, /* (413) compare_op ::= NK_GT */
+ { 412, -1 }, /* (414) compare_op ::= NK_LE */
+ { 412, -1 }, /* (415) compare_op ::= NK_GE */
+ { 412, -1 }, /* (416) compare_op ::= NK_NE */
+ { 412, -1 }, /* (417) compare_op ::= NK_EQ */
+ { 412, -1 }, /* (418) compare_op ::= LIKE */
+ { 412, -2 }, /* (419) compare_op ::= NOT LIKE */
+ { 412, -1 }, /* (420) compare_op ::= MATCH */
+ { 412, -1 }, /* (421) compare_op ::= NMATCH */
+ { 412, -1 }, /* (422) compare_op ::= CONTAINS */
+ { 413, -1 }, /* (423) in_op ::= IN */
+ { 413, -2 }, /* (424) in_op ::= NOT IN */
+ { 414, -3 }, /* (425) in_predicate_value ::= NK_LP literal_list NK_RP */
+ { 415, -1 }, /* (426) boolean_value_expression ::= boolean_primary */
+ { 415, -2 }, /* (427) boolean_value_expression ::= NOT boolean_primary */
+ { 415, -3 }, /* (428) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */
+ { 415, -3 }, /* (429) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */
+ { 416, -1 }, /* (430) boolean_primary ::= predicate */
+ { 416, -3 }, /* (431) boolean_primary ::= NK_LP boolean_value_expression NK_RP */
+ { 409, -1 }, /* (432) common_expression ::= expr_or_subquery */
+ { 409, -1 }, /* (433) common_expression ::= boolean_value_expression */
+ { 417, 0 }, /* (434) from_clause_opt ::= */
+ { 417, -2 }, /* (435) from_clause_opt ::= FROM table_reference_list */
+ { 418, -1 }, /* (436) table_reference_list ::= table_reference */
+ { 418, -3 }, /* (437) table_reference_list ::= table_reference_list NK_COMMA table_reference */
+ { 419, -1 }, /* (438) table_reference ::= table_primary */
+ { 419, -1 }, /* (439) table_reference ::= joined_table */
+ { 420, -2 }, /* (440) table_primary ::= table_name alias_opt */
+ { 420, -4 }, /* (441) table_primary ::= db_name NK_DOT table_name alias_opt */
+ { 420, -2 }, /* (442) table_primary ::= subquery alias_opt */
+ { 420, -1 }, /* (443) table_primary ::= parenthesized_joined_table */
+ { 422, 0 }, /* (444) alias_opt ::= */
+ { 422, -1 }, /* (445) alias_opt ::= table_alias */
+ { 422, -2 }, /* (446) alias_opt ::= AS table_alias */
+ { 423, -3 }, /* (447) parenthesized_joined_table ::= NK_LP joined_table NK_RP */
+ { 423, -3 }, /* (448) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */
+ { 421, -6 }, /* (449) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */
+ { 424, 0 }, /* (450) join_type ::= */
+ { 424, -1 }, /* (451) join_type ::= INNER */
+ { 426, -12 }, /* (452) 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 */
+ { 427, 0 }, /* (453) set_quantifier_opt ::= */
+ { 427, -1 }, /* (454) set_quantifier_opt ::= DISTINCT */
+ { 427, -1 }, /* (455) set_quantifier_opt ::= ALL */
+ { 428, -1 }, /* (456) select_list ::= select_item */
+ { 428, -3 }, /* (457) select_list ::= select_list NK_COMMA select_item */
+ { 436, -1 }, /* (458) select_item ::= NK_STAR */
+ { 436, -1 }, /* (459) select_item ::= common_expression */
+ { 436, -2 }, /* (460) select_item ::= common_expression column_alias */
+ { 436, -3 }, /* (461) select_item ::= common_expression AS column_alias */
+ { 436, -3 }, /* (462) select_item ::= table_name NK_DOT NK_STAR */
+ { 390, 0 }, /* (463) where_clause_opt ::= */
+ { 390, -2 }, /* (464) where_clause_opt ::= WHERE search_condition */
+ { 429, 0 }, /* (465) partition_by_clause_opt ::= */
+ { 429, -3 }, /* (466) partition_by_clause_opt ::= PARTITION BY partition_list */
+ { 437, -1 }, /* (467) partition_list ::= partition_item */
+ { 437, -3 }, /* (468) partition_list ::= partition_list NK_COMMA partition_item */
+ { 438, -1 }, /* (469) partition_item ::= expr_or_subquery */
+ { 438, -2 }, /* (470) partition_item ::= expr_or_subquery column_alias */
+ { 438, -3 }, /* (471) partition_item ::= expr_or_subquery AS column_alias */
+ { 433, 0 }, /* (472) twindow_clause_opt ::= */
+ { 433, -6 }, /* (473) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */
+ { 433, -4 }, /* (474) twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */
+ { 433, -6 }, /* (475) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */
+ { 433, -8 }, /* (476) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */
+ { 375, 0 }, /* (477) sliding_opt ::= */
+ { 375, -4 }, /* (478) sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */
+ { 432, 0 }, /* (479) fill_opt ::= */
+ { 432, -4 }, /* (480) fill_opt ::= FILL NK_LP fill_mode NK_RP */
+ { 432, -6 }, /* (481) fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */
+ { 439, -1 }, /* (482) fill_mode ::= NONE */
+ { 439, -1 }, /* (483) fill_mode ::= PREV */
+ { 439, -1 }, /* (484) fill_mode ::= NULL */
+ { 439, -1 }, /* (485) fill_mode ::= LINEAR */
+ { 439, -1 }, /* (486) fill_mode ::= NEXT */
+ { 434, 0 }, /* (487) group_by_clause_opt ::= */
+ { 434, -3 }, /* (488) group_by_clause_opt ::= GROUP BY group_by_list */
+ { 440, -1 }, /* (489) group_by_list ::= expr_or_subquery */
+ { 440, -3 }, /* (490) group_by_list ::= group_by_list NK_COMMA expr_or_subquery */
+ { 435, 0 }, /* (491) having_clause_opt ::= */
+ { 435, -2 }, /* (492) having_clause_opt ::= HAVING search_condition */
+ { 430, 0 }, /* (493) range_opt ::= */
+ { 430, -6 }, /* (494) range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */
+ { 431, 0 }, /* (495) every_opt ::= */
+ { 431, -4 }, /* (496) every_opt ::= EVERY NK_LP duration_literal NK_RP */
+ { 441, -4 }, /* (497) query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */
+ { 442, -1 }, /* (498) query_simple ::= query_specification */
+ { 442, -1 }, /* (499) query_simple ::= union_query_expression */
+ { 446, -4 }, /* (500) union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */
+ { 446, -3 }, /* (501) union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */
+ { 447, -1 }, /* (502) query_simple_or_subquery ::= query_simple */
+ { 447, -1 }, /* (503) query_simple_or_subquery ::= subquery */
+ { 380, -1 }, /* (504) query_or_subquery ::= query_expression */
+ { 380, -1 }, /* (505) query_or_subquery ::= subquery */
+ { 443, 0 }, /* (506) order_by_clause_opt ::= */
+ { 443, -3 }, /* (507) order_by_clause_opt ::= ORDER BY sort_specification_list */
+ { 444, 0 }, /* (508) slimit_clause_opt ::= */
+ { 444, -2 }, /* (509) slimit_clause_opt ::= SLIMIT NK_INTEGER */
+ { 444, -4 }, /* (510) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */
+ { 444, -4 }, /* (511) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */
+ { 445, 0 }, /* (512) limit_clause_opt ::= */
+ { 445, -2 }, /* (513) limit_clause_opt ::= LIMIT NK_INTEGER */
+ { 445, -4 }, /* (514) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */
+ { 445, -4 }, /* (515) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */
+ { 397, -3 }, /* (516) subquery ::= NK_LP query_expression NK_RP */
+ { 397, -3 }, /* (517) subquery ::= NK_LP subquery NK_RP */
+ { 425, -1 }, /* (518) search_condition ::= common_expression */
+ { 448, -1 }, /* (519) sort_specification_list ::= sort_specification */
+ { 448, -3 }, /* (520) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */
+ { 449, -3 }, /* (521) sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */
+ { 450, 0 }, /* (522) ordering_specification_opt ::= */
+ { 450, -1 }, /* (523) ordering_specification_opt ::= ASC */
+ { 450, -1 }, /* (524) ordering_specification_opt ::= DESC */
+ { 451, 0 }, /* (525) null_ordering_opt ::= */
+ { 451, -2 }, /* (526) null_ordering_opt ::= NULLS FIRST */
+ { 451, -2 }, /* (527) null_ordering_opt ::= NULLS LAST */
};
static void yy_accept(yyParser*); /* Forward Declaration */
@@ -3592,11 +3708,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,319,&yymsp[0].minor);
+ yy_destructor(yypParser,320,&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,320,&yymsp[0].minor);
+ yy_destructor(yypParser,321,&yymsp[0].minor);
break;
case 2: /* account_options ::= */
{ }
@@ -3610,20 +3726,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,319,&yymsp[-2].minor);
+{ yy_destructor(yypParser,320,&yymsp[-2].minor);
{ }
- yy_destructor(yypParser,321,&yymsp[0].minor);
+ yy_destructor(yypParser,322,&yymsp[0].minor);
}
break;
case 12: /* alter_account_options ::= alter_account_option */
-{ yy_destructor(yypParser,322,&yymsp[0].minor);
+{ yy_destructor(yypParser,323,&yymsp[0].minor);
{ }
}
break;
case 13: /* alter_account_options ::= alter_account_options alter_account_option */
-{ yy_destructor(yypParser,320,&yymsp[-1].minor);
+{ yy_destructor(yypParser,321,&yymsp[-1].minor);
{ }
- yy_destructor(yypParser,322,&yymsp[0].minor);
+ yy_destructor(yypParser,323,&yymsp[0].minor);
}
break;
case 14: /* alter_account_option ::= PASS literal */
@@ -3637,72 +3753,72 @@ 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,321,&yymsp[0].minor);
+ yy_destructor(yypParser,322,&yymsp[0].minor);
break;
case 24: /* cmd ::= CREATE USER user_name PASS NK_STRING sysinfo_opt */
-{ pCxt->pRootNode = createCreateUserStmt(pCxt, &yymsp[-3].minor.yy29, &yymsp[-1].minor.yy0, yymsp[0].minor.yy503); }
+{ pCxt->pRootNode = createCreateUserStmt(pCxt, &yymsp[-3].minor.yy481, &yymsp[-1].minor.yy0, yymsp[0].minor.yy607); }
break;
case 25: /* cmd ::= ALTER USER user_name PASS NK_STRING */
-{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy29, TSDB_ALTER_USER_PASSWD, &yymsp[0].minor.yy0); }
+{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy481, 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.yy29, TSDB_ALTER_USER_ENABLE, &yymsp[0].minor.yy0); }
+{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy481, 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.yy29, TSDB_ALTER_USER_SYSINFO, &yymsp[0].minor.yy0); }
+{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy481, TSDB_ALTER_USER_SYSINFO, &yymsp[0].minor.yy0); }
break;
case 28: /* cmd ::= DROP USER user_name */
-{ pCxt->pRootNode = createDropUserStmt(pCxt, &yymsp[0].minor.yy29); }
+{ pCxt->pRootNode = createDropUserStmt(pCxt, &yymsp[0].minor.yy481); }
break;
case 29: /* sysinfo_opt ::= */
-{ yymsp[1].minor.yy503 = 1; }
+{ yymsp[1].minor.yy607 = 1; }
break;
case 30: /* sysinfo_opt ::= SYSINFO NK_INTEGER */
-{ yymsp[-1].minor.yy503 = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); }
+{ yymsp[-1].minor.yy607 = 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.yy9, &yymsp[-2].minor.yy29, &yymsp[0].minor.yy29); }
+{ pCxt->pRootNode = createGrantStmt(pCxt, yymsp[-4].minor.yy37, &yymsp[-2].minor.yy481, &yymsp[0].minor.yy481); }
break;
case 32: /* cmd ::= REVOKE privileges ON priv_level FROM user_name */
-{ pCxt->pRootNode = createRevokeStmt(pCxt, yymsp[-4].minor.yy9, &yymsp[-2].minor.yy29, &yymsp[0].minor.yy29); }
+{ pCxt->pRootNode = createRevokeStmt(pCxt, yymsp[-4].minor.yy37, &yymsp[-2].minor.yy481, &yymsp[0].minor.yy481); }
break;
case 33: /* privileges ::= ALL */
-{ yymsp[0].minor.yy9 = PRIVILEGE_TYPE_ALL; }
+{ yymsp[0].minor.yy37 = PRIVILEGE_TYPE_ALL; }
break;
case 34: /* privileges ::= priv_type_list */
case 35: /* priv_type_list ::= priv_type */ yytestcase(yyruleno==35);
-{ yylhsminor.yy9 = yymsp[0].minor.yy9; }
- yymsp[0].minor.yy9 = yylhsminor.yy9;
+{ yylhsminor.yy37 = yymsp[0].minor.yy37; }
+ yymsp[0].minor.yy37 = yylhsminor.yy37;
break;
case 36: /* priv_type_list ::= priv_type_list NK_COMMA priv_type */
-{ yylhsminor.yy9 = yymsp[-2].minor.yy9 | yymsp[0].minor.yy9; }
- yymsp[-2].minor.yy9 = yylhsminor.yy9;
+{ yylhsminor.yy37 = yymsp[-2].minor.yy37 | yymsp[0].minor.yy37; }
+ yymsp[-2].minor.yy37 = yylhsminor.yy37;
break;
case 37: /* priv_type ::= READ */
-{ yymsp[0].minor.yy9 = PRIVILEGE_TYPE_READ; }
+{ yymsp[0].minor.yy37 = PRIVILEGE_TYPE_READ; }
break;
case 38: /* priv_type ::= WRITE */
-{ yymsp[0].minor.yy9 = PRIVILEGE_TYPE_WRITE; }
+{ yymsp[0].minor.yy37 = PRIVILEGE_TYPE_WRITE; }
break;
case 39: /* priv_level ::= NK_STAR NK_DOT NK_STAR */
-{ yylhsminor.yy29 = yymsp[-2].minor.yy0; }
- yymsp[-2].minor.yy29 = yylhsminor.yy29;
+{ yylhsminor.yy481 = yymsp[-2].minor.yy0; }
+ yymsp[-2].minor.yy481 = yylhsminor.yy481;
break;
case 40: /* priv_level ::= db_name NK_DOT NK_STAR */
-{ yylhsminor.yy29 = yymsp[-2].minor.yy29; }
- yymsp[-2].minor.yy29 = yylhsminor.yy29;
+{ yylhsminor.yy481 = yymsp[-2].minor.yy481; }
+ yymsp[-2].minor.yy481 = yylhsminor.yy481;
break;
case 41: /* cmd ::= CREATE DNODE dnode_endpoint */
-{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[0].minor.yy29, NULL); }
+{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[0].minor.yy481, NULL); }
break;
case 42: /* cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER */
-{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[-2].minor.yy29, &yymsp[0].minor.yy0); }
+{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[-2].minor.yy481, &yymsp[0].minor.yy0); }
break;
- case 43: /* cmd ::= DROP DNODE NK_INTEGER */
-{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[0].minor.yy0); }
+ case 43: /* cmd ::= DROP DNODE NK_INTEGER force_opt */
+{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy777); }
break;
- case 44: /* cmd ::= DROP DNODE dnode_endpoint */
-{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[0].minor.yy29); }
+ case 44: /* cmd ::= DROP DNODE dnode_endpoint force_opt */
+{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy481, yymsp[0].minor.yy777); }
break;
case 45: /* cmd ::= ALTER DNODE NK_INTEGER NK_STRING */
{ pCxt->pRootNode = createAlterDnodeStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, NULL); }
@@ -3719,1388 +3835,1390 @@ static YYACTIONTYPE yy_reduce(
case 49: /* dnode_endpoint ::= NK_STRING */
case 50: /* dnode_endpoint ::= NK_ID */ yytestcase(yyruleno==50);
case 51: /* dnode_endpoint ::= NK_IPTOKEN */ yytestcase(yyruleno==51);
- case 329: /* db_name ::= NK_ID */ yytestcase(yyruleno==329);
- case 330: /* table_name ::= NK_ID */ yytestcase(yyruleno==330);
- case 331: /* column_name ::= NK_ID */ yytestcase(yyruleno==331);
- case 332: /* function_name ::= NK_ID */ yytestcase(yyruleno==332);
- case 333: /* table_alias ::= NK_ID */ yytestcase(yyruleno==333);
- case 334: /* column_alias ::= NK_ID */ yytestcase(yyruleno==334);
- case 335: /* user_name ::= NK_ID */ yytestcase(yyruleno==335);
- case 336: /* topic_name ::= NK_ID */ yytestcase(yyruleno==336);
- case 337: /* stream_name ::= NK_ID */ yytestcase(yyruleno==337);
- case 338: /* cgroup_name ::= NK_ID */ yytestcase(yyruleno==338);
- case 378: /* noarg_func ::= NOW */ yytestcase(yyruleno==378);
- case 379: /* noarg_func ::= TODAY */ yytestcase(yyruleno==379);
- case 380: /* noarg_func ::= TIMEZONE */ yytestcase(yyruleno==380);
- case 381: /* noarg_func ::= DATABASE */ yytestcase(yyruleno==381);
- case 382: /* noarg_func ::= CLIENT_VERSION */ yytestcase(yyruleno==382);
- case 383: /* noarg_func ::= SERVER_VERSION */ yytestcase(yyruleno==383);
- case 384: /* noarg_func ::= SERVER_STATUS */ yytestcase(yyruleno==384);
- case 385: /* noarg_func ::= CURRENT_USER */ yytestcase(yyruleno==385);
- case 386: /* noarg_func ::= USER */ yytestcase(yyruleno==386);
- case 387: /* star_func ::= COUNT */ yytestcase(yyruleno==387);
- case 388: /* star_func ::= FIRST */ yytestcase(yyruleno==388);
- case 389: /* star_func ::= LAST */ yytestcase(yyruleno==389);
- case 390: /* star_func ::= LAST_ROW */ yytestcase(yyruleno==390);
-{ yylhsminor.yy29 = yymsp[0].minor.yy0; }
- yymsp[0].minor.yy29 = yylhsminor.yy29;
+ case 331: /* db_name ::= NK_ID */ yytestcase(yyruleno==331);
+ case 332: /* table_name ::= NK_ID */ yytestcase(yyruleno==332);
+ case 333: /* column_name ::= NK_ID */ yytestcase(yyruleno==333);
+ case 334: /* function_name ::= NK_ID */ yytestcase(yyruleno==334);
+ case 335: /* table_alias ::= NK_ID */ yytestcase(yyruleno==335);
+ case 336: /* column_alias ::= NK_ID */ yytestcase(yyruleno==336);
+ case 337: /* user_name ::= NK_ID */ yytestcase(yyruleno==337);
+ case 338: /* topic_name ::= NK_ID */ yytestcase(yyruleno==338);
+ case 339: /* stream_name ::= NK_ID */ yytestcase(yyruleno==339);
+ case 340: /* cgroup_name ::= NK_ID */ yytestcase(yyruleno==340);
+ case 380: /* noarg_func ::= NOW */ yytestcase(yyruleno==380);
+ case 381: /* noarg_func ::= TODAY */ yytestcase(yyruleno==381);
+ case 382: /* noarg_func ::= TIMEZONE */ yytestcase(yyruleno==382);
+ case 383: /* noarg_func ::= DATABASE */ yytestcase(yyruleno==383);
+ case 384: /* noarg_func ::= CLIENT_VERSION */ yytestcase(yyruleno==384);
+ case 385: /* noarg_func ::= SERVER_VERSION */ yytestcase(yyruleno==385);
+ case 386: /* noarg_func ::= SERVER_STATUS */ yytestcase(yyruleno==386);
+ case 387: /* noarg_func ::= CURRENT_USER */ yytestcase(yyruleno==387);
+ case 388: /* noarg_func ::= USER */ yytestcase(yyruleno==388);
+ case 389: /* star_func ::= COUNT */ yytestcase(yyruleno==389);
+ case 390: /* star_func ::= FIRST */ yytestcase(yyruleno==390);
+ case 391: /* star_func ::= LAST */ yytestcase(yyruleno==391);
+ case 392: /* star_func ::= LAST_ROW */ yytestcase(yyruleno==392);
+{ yylhsminor.yy481 = yymsp[0].minor.yy0; }
+ yymsp[0].minor.yy481 = yylhsminor.yy481;
break;
- case 52: /* cmd ::= ALTER LOCAL NK_STRING */
+ case 52: /* force_opt ::= */
+ case 71: /* not_exists_opt ::= */ yytestcase(yyruleno==71);
+ case 73: /* exists_opt ::= */ yytestcase(yyruleno==73);
+ case 271: /* analyze_opt ::= */ yytestcase(yyruleno==271);
+ case 278: /* agg_func_opt ::= */ yytestcase(yyruleno==278);
+ case 453: /* set_quantifier_opt ::= */ yytestcase(yyruleno==453);
+{ yymsp[1].minor.yy777 = false; }
+ break;
+ case 53: /* force_opt ::= FORCE */
+ case 272: /* analyze_opt ::= ANALYZE */ yytestcase(yyruleno==272);
+ case 279: /* agg_func_opt ::= AGGREGATE */ yytestcase(yyruleno==279);
+ case 454: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==454);
+{ yymsp[0].minor.yy777 = true; }
+ break;
+ case 54: /* cmd ::= ALTER LOCAL NK_STRING */
{ pCxt->pRootNode = createAlterLocalStmt(pCxt, &yymsp[0].minor.yy0, NULL); }
break;
- case 53: /* cmd ::= ALTER LOCAL NK_STRING NK_STRING */
+ case 55: /* cmd ::= ALTER LOCAL NK_STRING NK_STRING */
{ pCxt->pRootNode = createAlterLocalStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); }
break;
- case 54: /* cmd ::= CREATE QNODE ON DNODE NK_INTEGER */
+ case 56: /* cmd ::= CREATE QNODE ON DNODE NK_INTEGER */
{ pCxt->pRootNode = createCreateComponentNodeStmt(pCxt, QUERY_NODE_CREATE_QNODE_STMT, &yymsp[0].minor.yy0); }
break;
- case 55: /* cmd ::= DROP QNODE ON DNODE NK_INTEGER */
+ case 57: /* cmd ::= DROP QNODE ON DNODE NK_INTEGER */
{ pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_QNODE_STMT, &yymsp[0].minor.yy0); }
break;
- case 56: /* cmd ::= CREATE BNODE ON DNODE NK_INTEGER */
+ case 58: /* cmd ::= CREATE BNODE ON DNODE NK_INTEGER */
{ pCxt->pRootNode = createCreateComponentNodeStmt(pCxt, QUERY_NODE_CREATE_BNODE_STMT, &yymsp[0].minor.yy0); }
break;
- case 57: /* cmd ::= DROP BNODE ON DNODE NK_INTEGER */
+ case 59: /* cmd ::= DROP BNODE ON DNODE NK_INTEGER */
{ pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_BNODE_STMT, &yymsp[0].minor.yy0); }
break;
- case 58: /* cmd ::= CREATE SNODE ON DNODE NK_INTEGER */
+ case 60: /* cmd ::= CREATE SNODE ON DNODE NK_INTEGER */
{ pCxt->pRootNode = createCreateComponentNodeStmt(pCxt, QUERY_NODE_CREATE_SNODE_STMT, &yymsp[0].minor.yy0); }
break;
- case 59: /* cmd ::= DROP SNODE ON DNODE NK_INTEGER */
+ case 61: /* cmd ::= DROP SNODE ON DNODE NK_INTEGER */
{ pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_SNODE_STMT, &yymsp[0].minor.yy0); }
break;
- case 60: /* cmd ::= CREATE MNODE ON DNODE NK_INTEGER */
+ case 62: /* cmd ::= CREATE MNODE ON DNODE NK_INTEGER */
{ pCxt->pRootNode = createCreateComponentNodeStmt(pCxt, QUERY_NODE_CREATE_MNODE_STMT, &yymsp[0].minor.yy0); }
break;
- case 61: /* cmd ::= DROP MNODE ON DNODE NK_INTEGER */
+ case 63: /* cmd ::= DROP MNODE ON DNODE NK_INTEGER */
{ pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_MNODE_STMT, &yymsp[0].minor.yy0); }
break;
- case 62: /* cmd ::= CREATE DATABASE not_exists_opt db_name db_options */
-{ pCxt->pRootNode = createCreateDatabaseStmt(pCxt, yymsp[-2].minor.yy137, &yymsp[-1].minor.yy29, yymsp[0].minor.yy812); }
+ case 64: /* cmd ::= CREATE DATABASE not_exists_opt db_name db_options */
+{ pCxt->pRootNode = createCreateDatabaseStmt(pCxt, yymsp[-2].minor.yy777, &yymsp[-1].minor.yy481, yymsp[0].minor.yy232); }
break;
- case 63: /* cmd ::= DROP DATABASE exists_opt db_name */
-{ pCxt->pRootNode = createDropDatabaseStmt(pCxt, yymsp[-1].minor.yy137, &yymsp[0].minor.yy29); }
+ case 65: /* cmd ::= DROP DATABASE exists_opt db_name */
+{ pCxt->pRootNode = createDropDatabaseStmt(pCxt, yymsp[-1].minor.yy777, &yymsp[0].minor.yy481); }
break;
- case 64: /* cmd ::= USE db_name */
-{ pCxt->pRootNode = createUseDatabaseStmt(pCxt, &yymsp[0].minor.yy29); }
+ case 66: /* cmd ::= USE db_name */
+{ pCxt->pRootNode = createUseDatabaseStmt(pCxt, &yymsp[0].minor.yy481); }
break;
- case 65: /* cmd ::= ALTER DATABASE db_name alter_db_options */
-{ pCxt->pRootNode = createAlterDatabaseStmt(pCxt, &yymsp[-1].minor.yy29, yymsp[0].minor.yy812); }
+ case 67: /* cmd ::= ALTER DATABASE db_name alter_db_options */
+{ pCxt->pRootNode = createAlterDatabaseStmt(pCxt, &yymsp[-1].minor.yy481, yymsp[0].minor.yy232); }
break;
- case 66: /* cmd ::= FLUSH DATABASE db_name */
-{ pCxt->pRootNode = createFlushDatabaseStmt(pCxt, &yymsp[0].minor.yy29); }
+ case 68: /* cmd ::= FLUSH DATABASE db_name */
+{ pCxt->pRootNode = createFlushDatabaseStmt(pCxt, &yymsp[0].minor.yy481); }
break;
- case 67: /* cmd ::= TRIM DATABASE db_name speed_opt */
-{ pCxt->pRootNode = createTrimDatabaseStmt(pCxt, &yymsp[-1].minor.yy29, yymsp[0].minor.yy460); }
+ case 69: /* cmd ::= TRIM DATABASE db_name speed_opt */
+{ pCxt->pRootNode = createTrimDatabaseStmt(pCxt, &yymsp[-1].minor.yy481, yymsp[0].minor.yy692); }
break;
- case 68: /* not_exists_opt ::= IF NOT EXISTS */
-{ yymsp[-2].minor.yy137 = true; }
+ case 70: /* not_exists_opt ::= IF NOT EXISTS */
+{ yymsp[-2].minor.yy777 = true; }
break;
- case 69: /* not_exists_opt ::= */
- case 71: /* exists_opt ::= */ yytestcase(yyruleno==71);
- case 269: /* analyze_opt ::= */ yytestcase(yyruleno==269);
- case 276: /* agg_func_opt ::= */ yytestcase(yyruleno==276);
- case 451: /* set_quantifier_opt ::= */ yytestcase(yyruleno==451);
-{ yymsp[1].minor.yy137 = false; }
+ case 72: /* exists_opt ::= IF EXISTS */
+{ yymsp[-1].minor.yy777 = true; }
break;
- case 70: /* exists_opt ::= IF EXISTS */
-{ yymsp[-1].minor.yy137 = true; }
+ case 74: /* db_options ::= */
+{ yymsp[1].minor.yy232 = createDefaultDatabaseOptions(pCxt); }
break;
- case 72: /* db_options ::= */
-{ yymsp[1].minor.yy812 = createDefaultDatabaseOptions(pCxt); }
+ case 75: /* db_options ::= db_options BUFFER NK_INTEGER */
+{ yylhsminor.yy232 = setDatabaseOption(pCxt, yymsp[-2].minor.yy232, DB_OPTION_BUFFER, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy232 = yylhsminor.yy232;
break;
- case 73: /* db_options ::= db_options BUFFER NK_INTEGER */
-{ yylhsminor.yy812 = setDatabaseOption(pCxt, yymsp[-2].minor.yy812, DB_OPTION_BUFFER, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy812 = yylhsminor.yy812;
+ case 76: /* db_options ::= db_options CACHEMODEL NK_STRING */
+{ yylhsminor.yy232 = setDatabaseOption(pCxt, yymsp[-2].minor.yy232, DB_OPTION_CACHEMODEL, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy232 = yylhsminor.yy232;
break;
- case 74: /* db_options ::= db_options CACHEMODEL NK_STRING */
-{ yylhsminor.yy812 = setDatabaseOption(pCxt, yymsp[-2].minor.yy812, DB_OPTION_CACHEMODEL, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy812 = yylhsminor.yy812;
+ case 77: /* db_options ::= db_options CACHESIZE NK_INTEGER */
+{ yylhsminor.yy232 = setDatabaseOption(pCxt, yymsp[-2].minor.yy232, DB_OPTION_CACHESIZE, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy232 = yylhsminor.yy232;
break;
- case 75: /* db_options ::= db_options CACHESIZE NK_INTEGER */
-{ yylhsminor.yy812 = setDatabaseOption(pCxt, yymsp[-2].minor.yy812, DB_OPTION_CACHESIZE, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy812 = yylhsminor.yy812;
+ case 78: /* db_options ::= db_options COMP NK_INTEGER */
+{ yylhsminor.yy232 = setDatabaseOption(pCxt, yymsp[-2].minor.yy232, DB_OPTION_COMP, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy232 = yylhsminor.yy232;
break;
- case 76: /* db_options ::= db_options COMP NK_INTEGER */
-{ yylhsminor.yy812 = setDatabaseOption(pCxt, yymsp[-2].minor.yy812, DB_OPTION_COMP, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy812 = yylhsminor.yy812;
+ case 79: /* db_options ::= db_options DURATION NK_INTEGER */
+ case 80: /* db_options ::= db_options DURATION NK_VARIABLE */ yytestcase(yyruleno==80);
+{ yylhsminor.yy232 = setDatabaseOption(pCxt, yymsp[-2].minor.yy232, DB_OPTION_DAYS, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy232 = yylhsminor.yy232;
break;
- case 77: /* db_options ::= db_options DURATION NK_INTEGER */
- case 78: /* db_options ::= db_options DURATION NK_VARIABLE */ yytestcase(yyruleno==78);
-{ yylhsminor.yy812 = setDatabaseOption(pCxt, yymsp[-2].minor.yy812, DB_OPTION_DAYS, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy812 = yylhsminor.yy812;
+ case 81: /* db_options ::= db_options MAXROWS NK_INTEGER */
+{ yylhsminor.yy232 = setDatabaseOption(pCxt, yymsp[-2].minor.yy232, DB_OPTION_MAXROWS, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy232 = yylhsminor.yy232;
break;
- case 79: /* db_options ::= db_options MAXROWS NK_INTEGER */
-{ yylhsminor.yy812 = setDatabaseOption(pCxt, yymsp[-2].minor.yy812, DB_OPTION_MAXROWS, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy812 = yylhsminor.yy812;
+ case 82: /* db_options ::= db_options MINROWS NK_INTEGER */
+{ yylhsminor.yy232 = setDatabaseOption(pCxt, yymsp[-2].minor.yy232, DB_OPTION_MINROWS, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy232 = yylhsminor.yy232;
break;
- case 80: /* db_options ::= db_options MINROWS NK_INTEGER */
-{ yylhsminor.yy812 = setDatabaseOption(pCxt, yymsp[-2].minor.yy812, DB_OPTION_MINROWS, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy812 = yylhsminor.yy812;
+ case 83: /* db_options ::= db_options KEEP integer_list */
+ case 84: /* db_options ::= db_options KEEP variable_list */ yytestcase(yyruleno==84);
+{ yylhsminor.yy232 = setDatabaseOption(pCxt, yymsp[-2].minor.yy232, DB_OPTION_KEEP, yymsp[0].minor.yy288); }
+ yymsp[-2].minor.yy232 = yylhsminor.yy232;
break;
- case 81: /* db_options ::= db_options KEEP integer_list */
- case 82: /* db_options ::= db_options KEEP variable_list */ yytestcase(yyruleno==82);
-{ yylhsminor.yy812 = setDatabaseOption(pCxt, yymsp[-2].minor.yy812, DB_OPTION_KEEP, yymsp[0].minor.yy424); }
- yymsp[-2].minor.yy812 = yylhsminor.yy812;
+ case 85: /* db_options ::= db_options PAGES NK_INTEGER */
+{ yylhsminor.yy232 = setDatabaseOption(pCxt, yymsp[-2].minor.yy232, DB_OPTION_PAGES, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy232 = yylhsminor.yy232;
break;
- case 83: /* db_options ::= db_options PAGES NK_INTEGER */
-{ yylhsminor.yy812 = setDatabaseOption(pCxt, yymsp[-2].minor.yy812, DB_OPTION_PAGES, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy812 = yylhsminor.yy812;
+ case 86: /* db_options ::= db_options PAGESIZE NK_INTEGER */
+{ yylhsminor.yy232 = setDatabaseOption(pCxt, yymsp[-2].minor.yy232, DB_OPTION_PAGESIZE, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy232 = yylhsminor.yy232;
break;
- case 84: /* db_options ::= db_options PAGESIZE NK_INTEGER */
-{ yylhsminor.yy812 = setDatabaseOption(pCxt, yymsp[-2].minor.yy812, DB_OPTION_PAGESIZE, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy812 = yylhsminor.yy812;
+ case 87: /* db_options ::= db_options TSDB_PAGESIZE NK_INTEGER */
+{ yylhsminor.yy232 = setDatabaseOption(pCxt, yymsp[-2].minor.yy232, DB_OPTION_TSDB_PAGESIZE, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy232 = yylhsminor.yy232;
break;
- case 85: /* db_options ::= db_options TSDB_PAGESIZE NK_INTEGER */
-{ yylhsminor.yy812 = setDatabaseOption(pCxt, yymsp[-2].minor.yy812, DB_OPTION_TSDB_PAGESIZE, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy812 = yylhsminor.yy812;
+ case 88: /* db_options ::= db_options PRECISION NK_STRING */
+{ yylhsminor.yy232 = setDatabaseOption(pCxt, yymsp[-2].minor.yy232, DB_OPTION_PRECISION, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy232 = yylhsminor.yy232;
break;
- case 86: /* db_options ::= db_options PRECISION NK_STRING */
-{ yylhsminor.yy812 = setDatabaseOption(pCxt, yymsp[-2].minor.yy812, DB_OPTION_PRECISION, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy812 = yylhsminor.yy812;
+ case 89: /* db_options ::= db_options REPLICA NK_INTEGER */
+{ yylhsminor.yy232 = setDatabaseOption(pCxt, yymsp[-2].minor.yy232, DB_OPTION_REPLICA, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy232 = yylhsminor.yy232;
break;
- case 87: /* db_options ::= db_options REPLICA NK_INTEGER */
-{ yylhsminor.yy812 = setDatabaseOption(pCxt, yymsp[-2].minor.yy812, DB_OPTION_REPLICA, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy812 = yylhsminor.yy812;
+ case 90: /* db_options ::= db_options STRICT NK_STRING */
+{ yylhsminor.yy232 = setDatabaseOption(pCxt, yymsp[-2].minor.yy232, DB_OPTION_STRICT, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy232 = yylhsminor.yy232;
break;
- case 88: /* db_options ::= db_options STRICT NK_STRING */
-{ yylhsminor.yy812 = setDatabaseOption(pCxt, yymsp[-2].minor.yy812, DB_OPTION_STRICT, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy812 = yylhsminor.yy812;
+ case 91: /* db_options ::= db_options VGROUPS NK_INTEGER */
+{ yylhsminor.yy232 = setDatabaseOption(pCxt, yymsp[-2].minor.yy232, DB_OPTION_VGROUPS, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy232 = yylhsminor.yy232;
break;
- case 89: /* db_options ::= db_options VGROUPS NK_INTEGER */
-{ yylhsminor.yy812 = setDatabaseOption(pCxt, yymsp[-2].minor.yy812, DB_OPTION_VGROUPS, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy812 = yylhsminor.yy812;
+ case 92: /* db_options ::= db_options SINGLE_STABLE NK_INTEGER */
+{ yylhsminor.yy232 = setDatabaseOption(pCxt, yymsp[-2].minor.yy232, DB_OPTION_SINGLE_STABLE, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy232 = yylhsminor.yy232;
break;
- case 90: /* db_options ::= db_options SINGLE_STABLE NK_INTEGER */
-{ yylhsminor.yy812 = setDatabaseOption(pCxt, yymsp[-2].minor.yy812, DB_OPTION_SINGLE_STABLE, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy812 = yylhsminor.yy812;
+ case 93: /* db_options ::= db_options RETENTIONS retention_list */
+{ yylhsminor.yy232 = setDatabaseOption(pCxt, yymsp[-2].minor.yy232, DB_OPTION_RETENTIONS, yymsp[0].minor.yy288); }
+ yymsp[-2].minor.yy232 = yylhsminor.yy232;
break;
- case 91: /* db_options ::= db_options RETENTIONS retention_list */
-{ yylhsminor.yy812 = setDatabaseOption(pCxt, yymsp[-2].minor.yy812, DB_OPTION_RETENTIONS, yymsp[0].minor.yy424); }
- yymsp[-2].minor.yy812 = yylhsminor.yy812;
+ case 94: /* db_options ::= db_options SCHEMALESS NK_INTEGER */
+{ yylhsminor.yy232 = setDatabaseOption(pCxt, yymsp[-2].minor.yy232, DB_OPTION_SCHEMALESS, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy232 = yylhsminor.yy232;
break;
- case 92: /* db_options ::= db_options SCHEMALESS NK_INTEGER */
-{ yylhsminor.yy812 = setDatabaseOption(pCxt, yymsp[-2].minor.yy812, DB_OPTION_SCHEMALESS, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy812 = yylhsminor.yy812;
+ case 95: /* db_options ::= db_options WAL_LEVEL NK_INTEGER */
+{ yylhsminor.yy232 = setDatabaseOption(pCxt, yymsp[-2].minor.yy232, DB_OPTION_WAL, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy232 = yylhsminor.yy232;
break;
- case 93: /* db_options ::= db_options WAL_LEVEL NK_INTEGER */
-{ yylhsminor.yy812 = setDatabaseOption(pCxt, yymsp[-2].minor.yy812, DB_OPTION_WAL, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy812 = yylhsminor.yy812;
+ case 96: /* db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER */
+{ yylhsminor.yy232 = setDatabaseOption(pCxt, yymsp[-2].minor.yy232, DB_OPTION_FSYNC, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy232 = yylhsminor.yy232;
break;
- case 94: /* db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER */
-{ yylhsminor.yy812 = setDatabaseOption(pCxt, yymsp[-2].minor.yy812, DB_OPTION_FSYNC, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy812 = yylhsminor.yy812;
+ case 97: /* db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER */
+{ yylhsminor.yy232 = setDatabaseOption(pCxt, yymsp[-2].minor.yy232, DB_OPTION_WAL_RETENTION_PERIOD, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy232 = yylhsminor.yy232;
break;
- case 95: /* db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER */
-{ yylhsminor.yy812 = setDatabaseOption(pCxt, yymsp[-2].minor.yy812, DB_OPTION_WAL_RETENTION_PERIOD, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy812 = yylhsminor.yy812;
- break;
- case 96: /* db_options ::= db_options WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */
+ case 98: /* 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.yy812 = setDatabaseOption(pCxt, yymsp[-3].minor.yy812, DB_OPTION_WAL_RETENTION_PERIOD, &t);
+ yylhsminor.yy232 = setDatabaseOption(pCxt, yymsp[-3].minor.yy232, DB_OPTION_WAL_RETENTION_PERIOD, &t);
}
- yymsp[-3].minor.yy812 = yylhsminor.yy812;
+ yymsp[-3].minor.yy232 = yylhsminor.yy232;
break;
- case 97: /* db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER */
-{ yylhsminor.yy812 = setDatabaseOption(pCxt, yymsp[-2].minor.yy812, DB_OPTION_WAL_RETENTION_SIZE, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy812 = yylhsminor.yy812;
+ case 99: /* db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER */
+{ yylhsminor.yy232 = setDatabaseOption(pCxt, yymsp[-2].minor.yy232, DB_OPTION_WAL_RETENTION_SIZE, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy232 = yylhsminor.yy232;
break;
- case 98: /* db_options ::= db_options WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */
+ case 100: /* 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.yy812 = setDatabaseOption(pCxt, yymsp[-3].minor.yy812, DB_OPTION_WAL_RETENTION_SIZE, &t);
+ yylhsminor.yy232 = setDatabaseOption(pCxt, yymsp[-3].minor.yy232, DB_OPTION_WAL_RETENTION_SIZE, &t);
}
- yymsp[-3].minor.yy812 = yylhsminor.yy812;
- break;
- case 99: /* db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER */
-{ yylhsminor.yy812 = setDatabaseOption(pCxt, yymsp[-2].minor.yy812, DB_OPTION_WAL_ROLL_PERIOD, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy812 = yylhsminor.yy812;
- break;
- case 100: /* db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER */
-{ yylhsminor.yy812 = setDatabaseOption(pCxt, yymsp[-2].minor.yy812, DB_OPTION_WAL_SEGMENT_SIZE, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy812 = yylhsminor.yy812;
- break;
- case 101: /* db_options ::= db_options STT_TRIGGER NK_INTEGER */
-{ yylhsminor.yy812 = setDatabaseOption(pCxt, yymsp[-2].minor.yy812, DB_OPTION_STT_TRIGGER, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy812 = yylhsminor.yy812;
- break;
- case 102: /* db_options ::= db_options TABLE_PREFIX NK_INTEGER */
-{ yylhsminor.yy812 = setDatabaseOption(pCxt, yymsp[-2].minor.yy812, DB_OPTION_TABLE_PREFIX, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy812 = yylhsminor.yy812;
- break;
- case 103: /* db_options ::= db_options TABLE_SUFFIX NK_INTEGER */
-{ yylhsminor.yy812 = setDatabaseOption(pCxt, yymsp[-2].minor.yy812, DB_OPTION_TABLE_SUFFIX, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy812 = yylhsminor.yy812;
- break;
- case 104: /* alter_db_options ::= alter_db_option */
-{ yylhsminor.yy812 = createAlterDatabaseOptions(pCxt); yylhsminor.yy812 = setAlterDatabaseOption(pCxt, yylhsminor.yy812, &yymsp[0].minor.yy245); }
- yymsp[0].minor.yy812 = yylhsminor.yy812;
- break;
- case 105: /* alter_db_options ::= alter_db_options alter_db_option */
-{ yylhsminor.yy812 = setAlterDatabaseOption(pCxt, yymsp[-1].minor.yy812, &yymsp[0].minor.yy245); }
- yymsp[-1].minor.yy812 = yylhsminor.yy812;
- break;
- case 106: /* alter_db_option ::= BUFFER NK_INTEGER */
-{ yymsp[-1].minor.yy245.type = DB_OPTION_BUFFER; yymsp[-1].minor.yy245.val = yymsp[0].minor.yy0; }
- break;
- case 107: /* alter_db_option ::= CACHEMODEL NK_STRING */
-{ yymsp[-1].minor.yy245.type = DB_OPTION_CACHEMODEL; yymsp[-1].minor.yy245.val = yymsp[0].minor.yy0; }
- break;
- case 108: /* alter_db_option ::= CACHESIZE NK_INTEGER */
-{ yymsp[-1].minor.yy245.type = DB_OPTION_CACHESIZE; yymsp[-1].minor.yy245.val = yymsp[0].minor.yy0; }
- break;
- case 109: /* alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER */
-{ yymsp[-1].minor.yy245.type = DB_OPTION_FSYNC; yymsp[-1].minor.yy245.val = yymsp[0].minor.yy0; }
- break;
- case 110: /* alter_db_option ::= KEEP integer_list */
- case 111: /* alter_db_option ::= KEEP variable_list */ yytestcase(yyruleno==111);
-{ yymsp[-1].minor.yy245.type = DB_OPTION_KEEP; yymsp[-1].minor.yy245.pList = yymsp[0].minor.yy424; }
- break;
- case 112: /* alter_db_option ::= PAGES NK_INTEGER */
-{ yymsp[-1].minor.yy245.type = DB_OPTION_PAGES; yymsp[-1].minor.yy245.val = yymsp[0].minor.yy0; }
- break;
- case 113: /* alter_db_option ::= REPLICA NK_INTEGER */
-{ yymsp[-1].minor.yy245.type = DB_OPTION_REPLICA; yymsp[-1].minor.yy245.val = yymsp[0].minor.yy0; }
- break;
- case 114: /* alter_db_option ::= STRICT NK_STRING */
-{ yymsp[-1].minor.yy245.type = DB_OPTION_STRICT; yymsp[-1].minor.yy245.val = yymsp[0].minor.yy0; }
- break;
- case 115: /* alter_db_option ::= WAL_LEVEL NK_INTEGER */
-{ yymsp[-1].minor.yy245.type = DB_OPTION_WAL; yymsp[-1].minor.yy245.val = yymsp[0].minor.yy0; }
- break;
- case 116: /* alter_db_option ::= STT_TRIGGER NK_INTEGER */
-{ yymsp[-1].minor.yy245.type = DB_OPTION_STT_TRIGGER; yymsp[-1].minor.yy245.val = yymsp[0].minor.yy0; }
- break;
- case 117: /* integer_list ::= NK_INTEGER */
-{ yylhsminor.yy424 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); }
- yymsp[0].minor.yy424 = yylhsminor.yy424;
- break;
- case 118: /* integer_list ::= integer_list NK_COMMA NK_INTEGER */
- case 299: /* dnode_list ::= dnode_list DNODE NK_INTEGER */ yytestcase(yyruleno==299);
-{ yylhsminor.yy424 = addNodeToList(pCxt, yymsp[-2].minor.yy424, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); }
- yymsp[-2].minor.yy424 = yylhsminor.yy424;
- break;
- case 119: /* variable_list ::= NK_VARIABLE */
-{ yylhsminor.yy424 = createNodeList(pCxt, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); }
- yymsp[0].minor.yy424 = yylhsminor.yy424;
- break;
- case 120: /* variable_list ::= variable_list NK_COMMA NK_VARIABLE */
-{ yylhsminor.yy424 = addNodeToList(pCxt, yymsp[-2].minor.yy424, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); }
- yymsp[-2].minor.yy424 = yylhsminor.yy424;
- break;
- case 121: /* retention_list ::= retention */
- case 143: /* multi_create_clause ::= create_subtable_clause */ yytestcase(yyruleno==143);
- case 146: /* multi_drop_clause ::= drop_table_clause */ yytestcase(yyruleno==146);
- case 153: /* column_def_list ::= column_def */ yytestcase(yyruleno==153);
- case 196: /* rollup_func_list ::= rollup_func_name */ yytestcase(yyruleno==196);
- case 201: /* col_name_list ::= col_name */ yytestcase(yyruleno==201);
- case 252: /* func_list ::= func */ yytestcase(yyruleno==252);
- case 327: /* literal_list ::= signed_literal */ yytestcase(yyruleno==327);
- case 393: /* other_para_list ::= star_func_para */ yytestcase(yyruleno==393);
- case 399: /* when_then_list ::= when_then_expr */ yytestcase(yyruleno==399);
- case 454: /* select_list ::= select_item */ yytestcase(yyruleno==454);
- case 465: /* partition_list ::= partition_item */ yytestcase(yyruleno==465);
- case 517: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==517);
-{ yylhsminor.yy424 = createNodeList(pCxt, yymsp[0].minor.yy812); }
- yymsp[0].minor.yy424 = yylhsminor.yy424;
- break;
- case 122: /* retention_list ::= retention_list NK_COMMA retention */
- case 154: /* column_def_list ::= column_def_list NK_COMMA column_def */ yytestcase(yyruleno==154);
- case 197: /* rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ yytestcase(yyruleno==197);
- case 202: /* col_name_list ::= col_name_list NK_COMMA col_name */ yytestcase(yyruleno==202);
- case 253: /* func_list ::= func_list NK_COMMA func */ yytestcase(yyruleno==253);
- case 328: /* literal_list ::= literal_list NK_COMMA signed_literal */ yytestcase(yyruleno==328);
- case 394: /* other_para_list ::= other_para_list NK_COMMA star_func_para */ yytestcase(yyruleno==394);
- case 455: /* select_list ::= select_list NK_COMMA select_item */ yytestcase(yyruleno==455);
- case 466: /* partition_list ::= partition_list NK_COMMA partition_item */ yytestcase(yyruleno==466);
- case 518: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==518);
-{ yylhsminor.yy424 = addNodeToList(pCxt, yymsp[-2].minor.yy424, yymsp[0].minor.yy812); }
- yymsp[-2].minor.yy424 = yylhsminor.yy424;
- break;
- case 123: /* retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */
-{ yylhsminor.yy812 = createNodeListNodeEx(pCxt, createDurationValueNode(pCxt, &yymsp[-2].minor.yy0), createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); }
- yymsp[-2].minor.yy812 = yylhsminor.yy812;
- break;
- case 124: /* speed_opt ::= */
- case 278: /* bufsize_opt ::= */ yytestcase(yyruleno==278);
-{ yymsp[1].minor.yy460 = 0; }
- break;
- case 125: /* speed_opt ::= MAX_SPEED NK_INTEGER */
- case 279: /* bufsize_opt ::= BUFSIZE NK_INTEGER */ yytestcase(yyruleno==279);
-{ yymsp[-1].minor.yy460 = taosStr2Int32(yymsp[0].minor.yy0.z, NULL, 10); }
- break;
- case 126: /* cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */
- case 128: /* cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ yytestcase(yyruleno==128);
-{ pCxt->pRootNode = createCreateTableStmt(pCxt, yymsp[-6].minor.yy137, yymsp[-5].minor.yy812, yymsp[-3].minor.yy424, yymsp[-1].minor.yy424, yymsp[0].minor.yy812); }
- break;
- case 127: /* cmd ::= CREATE TABLE multi_create_clause */
-{ pCxt->pRootNode = createCreateMultiTableStmt(pCxt, yymsp[0].minor.yy424); }
- break;
- case 129: /* cmd ::= DROP TABLE multi_drop_clause */
-{ pCxt->pRootNode = createDropTableStmt(pCxt, yymsp[0].minor.yy424); }
- break;
- case 130: /* cmd ::= DROP STABLE exists_opt full_table_name */
-{ pCxt->pRootNode = createDropSuperTableStmt(pCxt, yymsp[-1].minor.yy137, yymsp[0].minor.yy812); }
- break;
- case 131: /* cmd ::= ALTER TABLE alter_table_clause */
- case 301: /* cmd ::= query_or_subquery */ yytestcase(yyruleno==301);
-{ pCxt->pRootNode = yymsp[0].minor.yy812; }
- break;
- case 132: /* cmd ::= ALTER STABLE alter_table_clause */
-{ pCxt->pRootNode = setAlterSuperTableType(yymsp[0].minor.yy812); }
- break;
- case 133: /* alter_table_clause ::= full_table_name alter_table_options */
-{ yylhsminor.yy812 = createAlterTableModifyOptions(pCxt, yymsp[-1].minor.yy812, yymsp[0].minor.yy812); }
- yymsp[-1].minor.yy812 = yylhsminor.yy812;
- break;
- case 134: /* alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */
-{ yylhsminor.yy812 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy812, TSDB_ALTER_TABLE_ADD_COLUMN, &yymsp[-1].minor.yy29, yymsp[0].minor.yy484); }
- yymsp[-4].minor.yy812 = yylhsminor.yy812;
- break;
- case 135: /* alter_table_clause ::= full_table_name DROP COLUMN column_name */
-{ yylhsminor.yy812 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy812, TSDB_ALTER_TABLE_DROP_COLUMN, &yymsp[0].minor.yy29); }
- yymsp[-3].minor.yy812 = yylhsminor.yy812;
- break;
- case 136: /* alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */
-{ yylhsminor.yy812 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy812, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, &yymsp[-1].minor.yy29, yymsp[0].minor.yy484); }
- yymsp[-4].minor.yy812 = yylhsminor.yy812;
- break;
- case 137: /* alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */
-{ yylhsminor.yy812 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy812, TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, &yymsp[-1].minor.yy29, &yymsp[0].minor.yy29); }
- yymsp[-4].minor.yy812 = yylhsminor.yy812;
- break;
- case 138: /* alter_table_clause ::= full_table_name ADD TAG column_name type_name */
-{ yylhsminor.yy812 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy812, TSDB_ALTER_TABLE_ADD_TAG, &yymsp[-1].minor.yy29, yymsp[0].minor.yy484); }
- yymsp[-4].minor.yy812 = yylhsminor.yy812;
- break;
- case 139: /* alter_table_clause ::= full_table_name DROP TAG column_name */
-{ yylhsminor.yy812 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy812, TSDB_ALTER_TABLE_DROP_TAG, &yymsp[0].minor.yy29); }
- yymsp[-3].minor.yy812 = yylhsminor.yy812;
- break;
- case 140: /* alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */
-{ yylhsminor.yy812 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy812, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, &yymsp[-1].minor.yy29, yymsp[0].minor.yy484); }
- yymsp[-4].minor.yy812 = yylhsminor.yy812;
- break;
- case 141: /* alter_table_clause ::= full_table_name RENAME TAG column_name column_name */
-{ yylhsminor.yy812 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy812, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &yymsp[-1].minor.yy29, &yymsp[0].minor.yy29); }
- yymsp[-4].minor.yy812 = yylhsminor.yy812;
- break;
- case 142: /* alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */
-{ yylhsminor.yy812 = createAlterTableSetTag(pCxt, yymsp[-5].minor.yy812, &yymsp[-2].minor.yy29, yymsp[0].minor.yy812); }
- yymsp[-5].minor.yy812 = yylhsminor.yy812;
- break;
- case 144: /* multi_create_clause ::= multi_create_clause create_subtable_clause */
- case 147: /* multi_drop_clause ::= multi_drop_clause drop_table_clause */ yytestcase(yyruleno==147);
- case 400: /* when_then_list ::= when_then_list when_then_expr */ yytestcase(yyruleno==400);
-{ yylhsminor.yy424 = addNodeToList(pCxt, yymsp[-1].minor.yy424, yymsp[0].minor.yy812); }
- yymsp[-1].minor.yy424 = yylhsminor.yy424;
+ yymsp[-3].minor.yy232 = yylhsminor.yy232;
+ break;
+ case 101: /* db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER */
+{ yylhsminor.yy232 = setDatabaseOption(pCxt, yymsp[-2].minor.yy232, DB_OPTION_WAL_ROLL_PERIOD, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy232 = yylhsminor.yy232;
+ break;
+ case 102: /* db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER */
+{ yylhsminor.yy232 = setDatabaseOption(pCxt, yymsp[-2].minor.yy232, DB_OPTION_WAL_SEGMENT_SIZE, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy232 = yylhsminor.yy232;
+ break;
+ case 103: /* db_options ::= db_options STT_TRIGGER NK_INTEGER */
+{ yylhsminor.yy232 = setDatabaseOption(pCxt, yymsp[-2].minor.yy232, DB_OPTION_STT_TRIGGER, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy232 = yylhsminor.yy232;
+ break;
+ case 104: /* db_options ::= db_options TABLE_PREFIX NK_INTEGER */
+{ yylhsminor.yy232 = setDatabaseOption(pCxt, yymsp[-2].minor.yy232, DB_OPTION_TABLE_PREFIX, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy232 = yylhsminor.yy232;
+ break;
+ case 105: /* db_options ::= db_options TABLE_SUFFIX NK_INTEGER */
+{ yylhsminor.yy232 = setDatabaseOption(pCxt, yymsp[-2].minor.yy232, DB_OPTION_TABLE_SUFFIX, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy232 = yylhsminor.yy232;
+ break;
+ case 106: /* alter_db_options ::= alter_db_option */
+{ yylhsminor.yy232 = createAlterDatabaseOptions(pCxt); yylhsminor.yy232 = setAlterDatabaseOption(pCxt, yylhsminor.yy232, &yymsp[0].minor.yy101); }
+ yymsp[0].minor.yy232 = yylhsminor.yy232;
+ break;
+ case 107: /* alter_db_options ::= alter_db_options alter_db_option */
+{ yylhsminor.yy232 = setAlterDatabaseOption(pCxt, yymsp[-1].minor.yy232, &yymsp[0].minor.yy101); }
+ yymsp[-1].minor.yy232 = yylhsminor.yy232;
+ break;
+ case 108: /* alter_db_option ::= BUFFER NK_INTEGER */
+{ yymsp[-1].minor.yy101.type = DB_OPTION_BUFFER; yymsp[-1].minor.yy101.val = yymsp[0].minor.yy0; }
+ break;
+ case 109: /* alter_db_option ::= CACHEMODEL NK_STRING */
+{ yymsp[-1].minor.yy101.type = DB_OPTION_CACHEMODEL; yymsp[-1].minor.yy101.val = yymsp[0].minor.yy0; }
+ break;
+ case 110: /* alter_db_option ::= CACHESIZE NK_INTEGER */
+{ yymsp[-1].minor.yy101.type = DB_OPTION_CACHESIZE; yymsp[-1].minor.yy101.val = yymsp[0].minor.yy0; }
+ break;
+ case 111: /* alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER */
+{ yymsp[-1].minor.yy101.type = DB_OPTION_FSYNC; yymsp[-1].minor.yy101.val = yymsp[0].minor.yy0; }
+ break;
+ case 112: /* alter_db_option ::= KEEP integer_list */
+ case 113: /* alter_db_option ::= KEEP variable_list */ yytestcase(yyruleno==113);
+{ yymsp[-1].minor.yy101.type = DB_OPTION_KEEP; yymsp[-1].minor.yy101.pList = yymsp[0].minor.yy288; }
+ break;
+ case 114: /* alter_db_option ::= PAGES NK_INTEGER */
+{ yymsp[-1].minor.yy101.type = DB_OPTION_PAGES; yymsp[-1].minor.yy101.val = yymsp[0].minor.yy0; }
+ break;
+ case 115: /* alter_db_option ::= REPLICA NK_INTEGER */
+{ yymsp[-1].minor.yy101.type = DB_OPTION_REPLICA; yymsp[-1].minor.yy101.val = yymsp[0].minor.yy0; }
+ break;
+ case 116: /* alter_db_option ::= STRICT NK_STRING */
+{ yymsp[-1].minor.yy101.type = DB_OPTION_STRICT; yymsp[-1].minor.yy101.val = yymsp[0].minor.yy0; }
+ break;
+ case 117: /* alter_db_option ::= WAL_LEVEL NK_INTEGER */
+{ yymsp[-1].minor.yy101.type = DB_OPTION_WAL; yymsp[-1].minor.yy101.val = yymsp[0].minor.yy0; }
+ break;
+ case 118: /* alter_db_option ::= STT_TRIGGER NK_INTEGER */
+{ yymsp[-1].minor.yy101.type = DB_OPTION_STT_TRIGGER; yymsp[-1].minor.yy101.val = yymsp[0].minor.yy0; }
+ break;
+ case 119: /* integer_list ::= NK_INTEGER */
+{ yylhsminor.yy288 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy288 = yylhsminor.yy288;
+ break;
+ case 120: /* integer_list ::= integer_list NK_COMMA NK_INTEGER */
+ case 301: /* dnode_list ::= dnode_list DNODE NK_INTEGER */ yytestcase(yyruleno==301);
+{ yylhsminor.yy288 = addNodeToList(pCxt, yymsp[-2].minor.yy288, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); }
+ yymsp[-2].minor.yy288 = yylhsminor.yy288;
+ break;
+ case 121: /* variable_list ::= NK_VARIABLE */
+{ yylhsminor.yy288 = createNodeList(pCxt, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy288 = yylhsminor.yy288;
+ break;
+ case 122: /* variable_list ::= variable_list NK_COMMA NK_VARIABLE */
+{ yylhsminor.yy288 = addNodeToList(pCxt, yymsp[-2].minor.yy288, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); }
+ yymsp[-2].minor.yy288 = yylhsminor.yy288;
+ break;
+ case 123: /* retention_list ::= retention */
+ case 145: /* multi_create_clause ::= create_subtable_clause */ yytestcase(yyruleno==145);
+ case 148: /* multi_drop_clause ::= drop_table_clause */ yytestcase(yyruleno==148);
+ case 155: /* column_def_list ::= column_def */ yytestcase(yyruleno==155);
+ case 198: /* rollup_func_list ::= rollup_func_name */ yytestcase(yyruleno==198);
+ case 203: /* col_name_list ::= col_name */ yytestcase(yyruleno==203);
+ case 254: /* func_list ::= func */ yytestcase(yyruleno==254);
+ case 329: /* literal_list ::= signed_literal */ yytestcase(yyruleno==329);
+ case 395: /* other_para_list ::= star_func_para */ yytestcase(yyruleno==395);
+ case 401: /* when_then_list ::= when_then_expr */ yytestcase(yyruleno==401);
+ case 456: /* select_list ::= select_item */ yytestcase(yyruleno==456);
+ case 467: /* partition_list ::= partition_item */ yytestcase(yyruleno==467);
+ case 519: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==519);
+{ yylhsminor.yy288 = createNodeList(pCxt, yymsp[0].minor.yy232); }
+ yymsp[0].minor.yy288 = yylhsminor.yy288;
+ 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);
+ case 199: /* rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ yytestcase(yyruleno==199);
+ case 204: /* col_name_list ::= col_name_list NK_COMMA col_name */ yytestcase(yyruleno==204);
+ case 255: /* func_list ::= func_list NK_COMMA func */ yytestcase(yyruleno==255);
+ case 330: /* literal_list ::= literal_list NK_COMMA signed_literal */ yytestcase(yyruleno==330);
+ case 396: /* other_para_list ::= other_para_list NK_COMMA star_func_para */ yytestcase(yyruleno==396);
+ case 457: /* select_list ::= select_list NK_COMMA select_item */ yytestcase(yyruleno==457);
+ case 468: /* partition_list ::= partition_list NK_COMMA partition_item */ yytestcase(yyruleno==468);
+ case 520: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==520);
+{ yylhsminor.yy288 = addNodeToList(pCxt, yymsp[-2].minor.yy288, yymsp[0].minor.yy232); }
+ yymsp[-2].minor.yy288 = yylhsminor.yy288;
+ break;
+ case 125: /* retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */
+{ yylhsminor.yy232 = createNodeListNodeEx(pCxt, createDurationValueNode(pCxt, &yymsp[-2].minor.yy0), createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); }
+ yymsp[-2].minor.yy232 = yylhsminor.yy232;
+ break;
+ case 126: /* speed_opt ::= */
+ case 280: /* bufsize_opt ::= */ yytestcase(yyruleno==280);
+{ yymsp[1].minor.yy692 = 0; }
+ break;
+ case 127: /* speed_opt ::= MAX_SPEED NK_INTEGER */
+ case 281: /* bufsize_opt ::= BUFSIZE NK_INTEGER */ yytestcase(yyruleno==281);
+{ yymsp[-1].minor.yy692 = 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.yy777, yymsp[-5].minor.yy232, yymsp[-3].minor.yy288, yymsp[-1].minor.yy288, yymsp[0].minor.yy232); }
+ break;
+ case 129: /* cmd ::= CREATE TABLE multi_create_clause */
+{ pCxt->pRootNode = createCreateMultiTableStmt(pCxt, yymsp[0].minor.yy288); }
+ break;
+ case 131: /* cmd ::= DROP TABLE multi_drop_clause */
+{ pCxt->pRootNode = createDropTableStmt(pCxt, yymsp[0].minor.yy288); }
+ break;
+ case 132: /* cmd ::= DROP STABLE exists_opt full_table_name */
+{ pCxt->pRootNode = createDropSuperTableStmt(pCxt, yymsp[-1].minor.yy777, yymsp[0].minor.yy232); }
+ break;
+ case 133: /* cmd ::= ALTER TABLE alter_table_clause */
+ case 303: /* cmd ::= query_or_subquery */ yytestcase(yyruleno==303);
+{ pCxt->pRootNode = yymsp[0].minor.yy232; }
+ break;
+ case 134: /* cmd ::= ALTER STABLE alter_table_clause */
+{ pCxt->pRootNode = setAlterSuperTableType(yymsp[0].minor.yy232); }
+ break;
+ case 135: /* alter_table_clause ::= full_table_name alter_table_options */
+{ yylhsminor.yy232 = createAlterTableModifyOptions(pCxt, yymsp[-1].minor.yy232, yymsp[0].minor.yy232); }
+ yymsp[-1].minor.yy232 = yylhsminor.yy232;
+ break;
+ case 136: /* alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */
+{ yylhsminor.yy232 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy232, TSDB_ALTER_TABLE_ADD_COLUMN, &yymsp[-1].minor.yy481, yymsp[0].minor.yy264); }
+ yymsp[-4].minor.yy232 = yylhsminor.yy232;
+ break;
+ case 137: /* alter_table_clause ::= full_table_name DROP COLUMN column_name */
+{ yylhsminor.yy232 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy232, TSDB_ALTER_TABLE_DROP_COLUMN, &yymsp[0].minor.yy481); }
+ yymsp[-3].minor.yy232 = yylhsminor.yy232;
+ break;
+ case 138: /* alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */
+{ yylhsminor.yy232 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy232, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, &yymsp[-1].minor.yy481, yymsp[0].minor.yy264); }
+ yymsp[-4].minor.yy232 = yylhsminor.yy232;
+ break;
+ case 139: /* alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */
+{ yylhsminor.yy232 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy232, TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, &yymsp[-1].minor.yy481, &yymsp[0].minor.yy481); }
+ yymsp[-4].minor.yy232 = yylhsminor.yy232;
+ break;
+ case 140: /* alter_table_clause ::= full_table_name ADD TAG column_name type_name */
+{ yylhsminor.yy232 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy232, TSDB_ALTER_TABLE_ADD_TAG, &yymsp[-1].minor.yy481, yymsp[0].minor.yy264); }
+ yymsp[-4].minor.yy232 = yylhsminor.yy232;
+ break;
+ case 141: /* alter_table_clause ::= full_table_name DROP TAG column_name */
+{ yylhsminor.yy232 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy232, TSDB_ALTER_TABLE_DROP_TAG, &yymsp[0].minor.yy481); }
+ yymsp[-3].minor.yy232 = yylhsminor.yy232;
+ break;
+ case 142: /* alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */
+{ yylhsminor.yy232 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy232, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, &yymsp[-1].minor.yy481, yymsp[0].minor.yy264); }
+ yymsp[-4].minor.yy232 = yylhsminor.yy232;
+ break;
+ case 143: /* alter_table_clause ::= full_table_name RENAME TAG column_name column_name */
+{ yylhsminor.yy232 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy232, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &yymsp[-1].minor.yy481, &yymsp[0].minor.yy481); }
+ yymsp[-4].minor.yy232 = yylhsminor.yy232;
+ break;
+ case 144: /* alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */
+{ yylhsminor.yy232 = createAlterTableSetTag(pCxt, yymsp[-5].minor.yy232, &yymsp[-2].minor.yy481, yymsp[0].minor.yy232); }
+ yymsp[-5].minor.yy232 = yylhsminor.yy232;
+ 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 402: /* when_then_list ::= when_then_list when_then_expr */ yytestcase(yyruleno==402);
+{ yylhsminor.yy288 = addNodeToList(pCxt, yymsp[-1].minor.yy288, yymsp[0].minor.yy232); }
+ yymsp[-1].minor.yy288 = yylhsminor.yy288;
break;
- case 145: /* 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.yy812 = createCreateSubTableClause(pCxt, yymsp[-9].minor.yy137, yymsp[-8].minor.yy812, yymsp[-6].minor.yy812, yymsp[-5].minor.yy424, yymsp[-2].minor.yy424, yymsp[0].minor.yy812); }
- yymsp[-9].minor.yy812 = yylhsminor.yy812;
+ 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.yy232 = createCreateSubTableClause(pCxt, yymsp[-9].minor.yy777, yymsp[-8].minor.yy232, yymsp[-6].minor.yy232, yymsp[-5].minor.yy288, yymsp[-2].minor.yy288, yymsp[0].minor.yy232); }
+ yymsp[-9].minor.yy232 = yylhsminor.yy232;
break;
- case 148: /* drop_table_clause ::= exists_opt full_table_name */
-{ yylhsminor.yy812 = createDropTableClause(pCxt, yymsp[-1].minor.yy137, yymsp[0].minor.yy812); }
- yymsp[-1].minor.yy812 = yylhsminor.yy812;
+ case 150: /* drop_table_clause ::= exists_opt full_table_name */
+{ yylhsminor.yy232 = createDropTableClause(pCxt, yymsp[-1].minor.yy777, yymsp[0].minor.yy232); }
+ yymsp[-1].minor.yy232 = yylhsminor.yy232;
break;
- case 149: /* specific_cols_opt ::= */
- case 180: /* tags_def_opt ::= */ yytestcase(yyruleno==180);
- case 463: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==463);
- case 485: /* group_by_clause_opt ::= */ yytestcase(yyruleno==485);
- case 504: /* order_by_clause_opt ::= */ yytestcase(yyruleno==504);
-{ yymsp[1].minor.yy424 = NULL; }
+ case 151: /* specific_cols_opt ::= */
+ case 182: /* tags_def_opt ::= */ yytestcase(yyruleno==182);
+ case 465: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==465);
+ case 487: /* group_by_clause_opt ::= */ yytestcase(yyruleno==487);
+ case 506: /* order_by_clause_opt ::= */ yytestcase(yyruleno==506);
+{ yymsp[1].minor.yy288 = NULL; }
break;
- case 150: /* specific_cols_opt ::= NK_LP col_name_list NK_RP */
-{ yymsp[-2].minor.yy424 = yymsp[-1].minor.yy424; }
+ case 152: /* specific_cols_opt ::= NK_LP col_name_list NK_RP */
+{ yymsp[-2].minor.yy288 = yymsp[-1].minor.yy288; }
break;
- case 151: /* full_table_name ::= table_name */
-{ yylhsminor.yy812 = createRealTableNode(pCxt, NULL, &yymsp[0].minor.yy29, NULL); }
- yymsp[0].minor.yy812 = yylhsminor.yy812;
+ case 153: /* full_table_name ::= table_name */
+{ yylhsminor.yy232 = createRealTableNode(pCxt, NULL, &yymsp[0].minor.yy481, NULL); }
+ yymsp[0].minor.yy232 = yylhsminor.yy232;
break;
- case 152: /* full_table_name ::= db_name NK_DOT table_name */
-{ yylhsminor.yy812 = createRealTableNode(pCxt, &yymsp[-2].minor.yy29, &yymsp[0].minor.yy29, NULL); }
- yymsp[-2].minor.yy812 = yylhsminor.yy812;
+ case 154: /* full_table_name ::= db_name NK_DOT table_name */
+{ yylhsminor.yy232 = createRealTableNode(pCxt, &yymsp[-2].minor.yy481, &yymsp[0].minor.yy481, NULL); }
+ yymsp[-2].minor.yy232 = yylhsminor.yy232;
break;
- case 155: /* column_def ::= column_name type_name */
-{ yylhsminor.yy812 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy29, yymsp[0].minor.yy484, NULL); }
- yymsp[-1].minor.yy812 = yylhsminor.yy812;
+ case 157: /* column_def ::= column_name type_name */
+{ yylhsminor.yy232 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy481, yymsp[0].minor.yy264, NULL); }
+ yymsp[-1].minor.yy232 = yylhsminor.yy232;
break;
- case 156: /* column_def ::= column_name type_name COMMENT NK_STRING */
-{ yylhsminor.yy812 = createColumnDefNode(pCxt, &yymsp[-3].minor.yy29, yymsp[-2].minor.yy484, &yymsp[0].minor.yy0); }
- yymsp[-3].minor.yy812 = yylhsminor.yy812;
+ case 158: /* column_def ::= column_name type_name COMMENT NK_STRING */
+{ yylhsminor.yy232 = createColumnDefNode(pCxt, &yymsp[-3].minor.yy481, yymsp[-2].minor.yy264, &yymsp[0].minor.yy0); }
+ yymsp[-3].minor.yy232 = yylhsminor.yy232;
break;
- case 157: /* type_name ::= BOOL */
-{ yymsp[0].minor.yy484 = createDataType(TSDB_DATA_TYPE_BOOL); }
+ case 159: /* type_name ::= BOOL */
+{ yymsp[0].minor.yy264 = createDataType(TSDB_DATA_TYPE_BOOL); }
break;
- case 158: /* type_name ::= TINYINT */
-{ yymsp[0].minor.yy484 = createDataType(TSDB_DATA_TYPE_TINYINT); }
+ case 160: /* type_name ::= TINYINT */
+{ yymsp[0].minor.yy264 = createDataType(TSDB_DATA_TYPE_TINYINT); }
break;
- case 159: /* type_name ::= SMALLINT */
-{ yymsp[0].minor.yy484 = createDataType(TSDB_DATA_TYPE_SMALLINT); }
+ case 161: /* type_name ::= SMALLINT */
+{ yymsp[0].minor.yy264 = createDataType(TSDB_DATA_TYPE_SMALLINT); }
break;
- case 160: /* type_name ::= INT */
- case 161: /* type_name ::= INTEGER */ yytestcase(yyruleno==161);
-{ yymsp[0].minor.yy484 = createDataType(TSDB_DATA_TYPE_INT); }
+ case 162: /* type_name ::= INT */
+ case 163: /* type_name ::= INTEGER */ yytestcase(yyruleno==163);
+{ yymsp[0].minor.yy264 = createDataType(TSDB_DATA_TYPE_INT); }
break;
- case 162: /* type_name ::= BIGINT */
-{ yymsp[0].minor.yy484 = createDataType(TSDB_DATA_TYPE_BIGINT); }
+ case 164: /* type_name ::= BIGINT */
+{ yymsp[0].minor.yy264 = createDataType(TSDB_DATA_TYPE_BIGINT); }
break;
- case 163: /* type_name ::= FLOAT */
-{ yymsp[0].minor.yy484 = createDataType(TSDB_DATA_TYPE_FLOAT); }
+ case 165: /* type_name ::= FLOAT */
+{ yymsp[0].minor.yy264 = createDataType(TSDB_DATA_TYPE_FLOAT); }
break;
- case 164: /* type_name ::= DOUBLE */
-{ yymsp[0].minor.yy484 = createDataType(TSDB_DATA_TYPE_DOUBLE); }
+ case 166: /* type_name ::= DOUBLE */
+{ yymsp[0].minor.yy264 = createDataType(TSDB_DATA_TYPE_DOUBLE); }
break;
- case 165: /* type_name ::= BINARY NK_LP NK_INTEGER NK_RP */
-{ yymsp[-3].minor.yy484 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); }
+ case 167: /* type_name ::= BINARY NK_LP NK_INTEGER NK_RP */
+{ yymsp[-3].minor.yy264 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); }
break;
- case 166: /* type_name ::= TIMESTAMP */
-{ yymsp[0].minor.yy484 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); }
+ case 168: /* type_name ::= TIMESTAMP */
+{ yymsp[0].minor.yy264 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); }
break;
- case 167: /* type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */
-{ yymsp[-3].minor.yy484 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); }
+ case 169: /* type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */
+{ yymsp[-3].minor.yy264 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); }
break;
- case 168: /* type_name ::= TINYINT UNSIGNED */
-{ yymsp[-1].minor.yy484 = createDataType(TSDB_DATA_TYPE_UTINYINT); }
+ case 170: /* type_name ::= TINYINT UNSIGNED */
+{ yymsp[-1].minor.yy264 = createDataType(TSDB_DATA_TYPE_UTINYINT); }
break;
- case 169: /* type_name ::= SMALLINT UNSIGNED */
-{ yymsp[-1].minor.yy484 = createDataType(TSDB_DATA_TYPE_USMALLINT); }
+ case 171: /* type_name ::= SMALLINT UNSIGNED */
+{ yymsp[-1].minor.yy264 = createDataType(TSDB_DATA_TYPE_USMALLINT); }
break;
- case 170: /* type_name ::= INT UNSIGNED */
-{ yymsp[-1].minor.yy484 = createDataType(TSDB_DATA_TYPE_UINT); }
+ case 172: /* type_name ::= INT UNSIGNED */
+{ yymsp[-1].minor.yy264 = createDataType(TSDB_DATA_TYPE_UINT); }
break;
- case 171: /* type_name ::= BIGINT UNSIGNED */
-{ yymsp[-1].minor.yy484 = createDataType(TSDB_DATA_TYPE_UBIGINT); }
+ case 173: /* type_name ::= BIGINT UNSIGNED */
+{ yymsp[-1].minor.yy264 = createDataType(TSDB_DATA_TYPE_UBIGINT); }
break;
- case 172: /* type_name ::= JSON */
-{ yymsp[0].minor.yy484 = createDataType(TSDB_DATA_TYPE_JSON); }
+ case 174: /* type_name ::= JSON */
+{ yymsp[0].minor.yy264 = createDataType(TSDB_DATA_TYPE_JSON); }
break;
- case 173: /* type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */
-{ yymsp[-3].minor.yy484 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); }
+ case 175: /* type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */
+{ yymsp[-3].minor.yy264 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); }
break;
- case 174: /* type_name ::= MEDIUMBLOB */
-{ yymsp[0].minor.yy484 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); }
+ case 176: /* type_name ::= MEDIUMBLOB */
+{ yymsp[0].minor.yy264 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); }
break;
- case 175: /* type_name ::= BLOB */
-{ yymsp[0].minor.yy484 = createDataType(TSDB_DATA_TYPE_BLOB); }
+ case 177: /* type_name ::= BLOB */
+{ yymsp[0].minor.yy264 = createDataType(TSDB_DATA_TYPE_BLOB); }
break;
- case 176: /* type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */
-{ yymsp[-3].minor.yy484 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &yymsp[-1].minor.yy0); }
+ case 178: /* type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */
+{ yymsp[-3].minor.yy264 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &yymsp[-1].minor.yy0); }
break;
- case 177: /* type_name ::= DECIMAL */
-{ yymsp[0].minor.yy484 = createDataType(TSDB_DATA_TYPE_DECIMAL); }
+ case 179: /* type_name ::= DECIMAL */
+{ yymsp[0].minor.yy264 = createDataType(TSDB_DATA_TYPE_DECIMAL); }
break;
- case 178: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */
-{ yymsp[-3].minor.yy484 = createDataType(TSDB_DATA_TYPE_DECIMAL); }
+ case 180: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */
+{ yymsp[-3].minor.yy264 = createDataType(TSDB_DATA_TYPE_DECIMAL); }
break;
- case 179: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */
-{ yymsp[-5].minor.yy484 = createDataType(TSDB_DATA_TYPE_DECIMAL); }
+ case 181: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */
+{ yymsp[-5].minor.yy264 = createDataType(TSDB_DATA_TYPE_DECIMAL); }
break;
- case 181: /* tags_def_opt ::= tags_def */
- case 392: /* star_func_para_list ::= other_para_list */ yytestcase(yyruleno==392);
-{ yylhsminor.yy424 = yymsp[0].minor.yy424; }
- yymsp[0].minor.yy424 = yylhsminor.yy424;
+ case 183: /* tags_def_opt ::= tags_def */
+ case 394: /* star_func_para_list ::= other_para_list */ yytestcase(yyruleno==394);
+{ yylhsminor.yy288 = yymsp[0].minor.yy288; }
+ yymsp[0].minor.yy288 = yylhsminor.yy288;
break;
- case 182: /* tags_def ::= TAGS NK_LP column_def_list NK_RP */
-{ yymsp[-3].minor.yy424 = yymsp[-1].minor.yy424; }
+ case 184: /* tags_def ::= TAGS NK_LP column_def_list NK_RP */
+{ yymsp[-3].minor.yy288 = yymsp[-1].minor.yy288; }
break;
- case 183: /* table_options ::= */
-{ yymsp[1].minor.yy812 = createDefaultTableOptions(pCxt); }
+ case 185: /* table_options ::= */
+{ yymsp[1].minor.yy232 = createDefaultTableOptions(pCxt); }
break;
- case 184: /* table_options ::= table_options COMMENT NK_STRING */
-{ yylhsminor.yy812 = setTableOption(pCxt, yymsp[-2].minor.yy812, TABLE_OPTION_COMMENT, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy812 = yylhsminor.yy812;
+ case 186: /* table_options ::= table_options COMMENT NK_STRING */
+{ yylhsminor.yy232 = setTableOption(pCxt, yymsp[-2].minor.yy232, TABLE_OPTION_COMMENT, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy232 = yylhsminor.yy232;
break;
- case 185: /* table_options ::= table_options MAX_DELAY duration_list */
-{ yylhsminor.yy812 = setTableOption(pCxt, yymsp[-2].minor.yy812, TABLE_OPTION_MAXDELAY, yymsp[0].minor.yy424); }
- yymsp[-2].minor.yy812 = yylhsminor.yy812;
+ case 187: /* table_options ::= table_options MAX_DELAY duration_list */
+{ yylhsminor.yy232 = setTableOption(pCxt, yymsp[-2].minor.yy232, TABLE_OPTION_MAXDELAY, yymsp[0].minor.yy288); }
+ yymsp[-2].minor.yy232 = yylhsminor.yy232;
break;
- case 186: /* table_options ::= table_options WATERMARK duration_list */
-{ yylhsminor.yy812 = setTableOption(pCxt, yymsp[-2].minor.yy812, TABLE_OPTION_WATERMARK, yymsp[0].minor.yy424); }
- yymsp[-2].minor.yy812 = yylhsminor.yy812;
+ case 188: /* table_options ::= table_options WATERMARK duration_list */
+{ yylhsminor.yy232 = setTableOption(pCxt, yymsp[-2].minor.yy232, TABLE_OPTION_WATERMARK, yymsp[0].minor.yy288); }
+ yymsp[-2].minor.yy232 = yylhsminor.yy232;
break;
- case 187: /* table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */
-{ yylhsminor.yy812 = setTableOption(pCxt, yymsp[-4].minor.yy812, TABLE_OPTION_ROLLUP, yymsp[-1].minor.yy424); }
- yymsp[-4].minor.yy812 = yylhsminor.yy812;
+ case 189: /* table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */
+{ yylhsminor.yy232 = setTableOption(pCxt, yymsp[-4].minor.yy232, TABLE_OPTION_ROLLUP, yymsp[-1].minor.yy288); }
+ yymsp[-4].minor.yy232 = yylhsminor.yy232;
break;
- case 188: /* table_options ::= table_options TTL NK_INTEGER */
-{ yylhsminor.yy812 = setTableOption(pCxt, yymsp[-2].minor.yy812, TABLE_OPTION_TTL, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy812 = yylhsminor.yy812;
+ case 190: /* table_options ::= table_options TTL NK_INTEGER */
+{ yylhsminor.yy232 = setTableOption(pCxt, yymsp[-2].minor.yy232, TABLE_OPTION_TTL, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy232 = yylhsminor.yy232;
break;
- case 189: /* table_options ::= table_options SMA NK_LP col_name_list NK_RP */
-{ yylhsminor.yy812 = setTableOption(pCxt, yymsp[-4].minor.yy812, TABLE_OPTION_SMA, yymsp[-1].minor.yy424); }
- yymsp[-4].minor.yy812 = yylhsminor.yy812;
+ case 191: /* table_options ::= table_options SMA NK_LP col_name_list NK_RP */
+{ yylhsminor.yy232 = setTableOption(pCxt, yymsp[-4].minor.yy232, TABLE_OPTION_SMA, yymsp[-1].minor.yy288); }
+ yymsp[-4].minor.yy232 = yylhsminor.yy232;
break;
- case 190: /* alter_table_options ::= alter_table_option */
-{ yylhsminor.yy812 = createAlterTableOptions(pCxt); yylhsminor.yy812 = setTableOption(pCxt, yylhsminor.yy812, yymsp[0].minor.yy245.type, &yymsp[0].minor.yy245.val); }
- yymsp[0].minor.yy812 = yylhsminor.yy812;
+ case 192: /* alter_table_options ::= alter_table_option */
+{ yylhsminor.yy232 = createAlterTableOptions(pCxt); yylhsminor.yy232 = setTableOption(pCxt, yylhsminor.yy232, yymsp[0].minor.yy101.type, &yymsp[0].minor.yy101.val); }
+ yymsp[0].minor.yy232 = yylhsminor.yy232;
break;
- case 191: /* alter_table_options ::= alter_table_options alter_table_option */
-{ yylhsminor.yy812 = setTableOption(pCxt, yymsp[-1].minor.yy812, yymsp[0].minor.yy245.type, &yymsp[0].minor.yy245.val); }
- yymsp[-1].minor.yy812 = yylhsminor.yy812;
+ case 193: /* alter_table_options ::= alter_table_options alter_table_option */
+{ yylhsminor.yy232 = setTableOption(pCxt, yymsp[-1].minor.yy232, yymsp[0].minor.yy101.type, &yymsp[0].minor.yy101.val); }
+ yymsp[-1].minor.yy232 = yylhsminor.yy232;
break;
- case 192: /* alter_table_option ::= COMMENT NK_STRING */
-{ yymsp[-1].minor.yy245.type = TABLE_OPTION_COMMENT; yymsp[-1].minor.yy245.val = yymsp[0].minor.yy0; }
+ case 194: /* alter_table_option ::= COMMENT NK_STRING */
+{ yymsp[-1].minor.yy101.type = TABLE_OPTION_COMMENT; yymsp[-1].minor.yy101.val = yymsp[0].minor.yy0; }
break;
- case 193: /* alter_table_option ::= TTL NK_INTEGER */
-{ yymsp[-1].minor.yy245.type = TABLE_OPTION_TTL; yymsp[-1].minor.yy245.val = yymsp[0].minor.yy0; }
+ case 195: /* alter_table_option ::= TTL NK_INTEGER */
+{ yymsp[-1].minor.yy101.type = TABLE_OPTION_TTL; yymsp[-1].minor.yy101.val = yymsp[0].minor.yy0; }
break;
- case 194: /* duration_list ::= duration_literal */
- case 357: /* expression_list ::= expr_or_subquery */ yytestcase(yyruleno==357);
-{ yylhsminor.yy424 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy812)); }
- yymsp[0].minor.yy424 = yylhsminor.yy424;
+ case 196: /* duration_list ::= duration_literal */
+ case 359: /* expression_list ::= expr_or_subquery */ yytestcase(yyruleno==359);
+{ yylhsminor.yy288 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy232)); }
+ yymsp[0].minor.yy288 = yylhsminor.yy288;
break;
- case 195: /* duration_list ::= duration_list NK_COMMA duration_literal */
- case 358: /* expression_list ::= expression_list NK_COMMA expr_or_subquery */ yytestcase(yyruleno==358);
-{ yylhsminor.yy424 = addNodeToList(pCxt, yymsp[-2].minor.yy424, releaseRawExprNode(pCxt, yymsp[0].minor.yy812)); }
- yymsp[-2].minor.yy424 = yylhsminor.yy424;
+ case 197: /* duration_list ::= duration_list NK_COMMA duration_literal */
+ case 360: /* expression_list ::= expression_list NK_COMMA expr_or_subquery */ yytestcase(yyruleno==360);
+{ yylhsminor.yy288 = addNodeToList(pCxt, yymsp[-2].minor.yy288, releaseRawExprNode(pCxt, yymsp[0].minor.yy232)); }
+ yymsp[-2].minor.yy288 = yylhsminor.yy288;
break;
- case 198: /* rollup_func_name ::= function_name */
-{ yylhsminor.yy812 = createFunctionNode(pCxt, &yymsp[0].minor.yy29, NULL); }
- yymsp[0].minor.yy812 = yylhsminor.yy812;
+ case 200: /* rollup_func_name ::= function_name */
+{ yylhsminor.yy232 = createFunctionNode(pCxt, &yymsp[0].minor.yy481, NULL); }
+ yymsp[0].minor.yy232 = yylhsminor.yy232;
break;
- case 199: /* rollup_func_name ::= FIRST */
- case 200: /* rollup_func_name ::= LAST */ yytestcase(yyruleno==200);
-{ yylhsminor.yy812 = createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL); }
- yymsp[0].minor.yy812 = yylhsminor.yy812;
+ case 201: /* rollup_func_name ::= FIRST */
+ case 202: /* rollup_func_name ::= LAST */ yytestcase(yyruleno==202);
+{ yylhsminor.yy232 = createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL); }
+ yymsp[0].minor.yy232 = yylhsminor.yy232;
break;
- case 203: /* col_name ::= column_name */
-{ yylhsminor.yy812 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy29); }
- yymsp[0].minor.yy812 = yylhsminor.yy812;
+ case 205: /* col_name ::= column_name */
+{ yylhsminor.yy232 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy481); }
+ yymsp[0].minor.yy232 = yylhsminor.yy232;
break;
- case 204: /* cmd ::= SHOW DNODES */
+ case 206: /* cmd ::= SHOW DNODES */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DNODES_STMT); }
break;
- case 205: /* cmd ::= SHOW USERS */
+ case 207: /* cmd ::= SHOW USERS */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_USERS_STMT); }
break;
- case 206: /* cmd ::= SHOW DATABASES */
+ case 208: /* cmd ::= SHOW DATABASES */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DATABASES_STMT); }
break;
- case 207: /* cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */
-{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TABLES_STMT, yymsp[-2].minor.yy812, yymsp[0].minor.yy812, OP_TYPE_LIKE); }
+ case 209: /* cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */
+{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TABLES_STMT, yymsp[-2].minor.yy232, yymsp[0].minor.yy232, OP_TYPE_LIKE); }
break;
- case 208: /* cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */
-{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_STABLES_STMT, yymsp[-2].minor.yy812, yymsp[0].minor.yy812, OP_TYPE_LIKE); }
+ case 210: /* cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */
+{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_STABLES_STMT, yymsp[-2].minor.yy232, yymsp[0].minor.yy232, OP_TYPE_LIKE); }
break;
- case 209: /* cmd ::= SHOW db_name_cond_opt VGROUPS */
-{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VGROUPS_STMT, yymsp[-1].minor.yy812, NULL, OP_TYPE_LIKE); }
+ case 211: /* cmd ::= SHOW db_name_cond_opt VGROUPS */
+{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VGROUPS_STMT, yymsp[-1].minor.yy232, NULL, OP_TYPE_LIKE); }
break;
- case 210: /* cmd ::= SHOW MNODES */
+ case 212: /* cmd ::= SHOW MNODES */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_MNODES_STMT); }
break;
- case 211: /* cmd ::= SHOW QNODES */
+ case 213: /* cmd ::= SHOW QNODES */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_QNODES_STMT); }
break;
- case 212: /* cmd ::= SHOW FUNCTIONS */
+ case 214: /* cmd ::= SHOW FUNCTIONS */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_FUNCTIONS_STMT); }
break;
- case 213: /* cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */
-{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, yymsp[0].minor.yy812, yymsp[-1].minor.yy812, OP_TYPE_EQUAL); }
+ case 215: /* cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */
+{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, yymsp[0].minor.yy232, yymsp[-1].minor.yy232, OP_TYPE_EQUAL); }
break;
- case 214: /* cmd ::= SHOW STREAMS */
+ case 216: /* cmd ::= SHOW STREAMS */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_STREAMS_STMT); }
break;
- case 215: /* cmd ::= SHOW ACCOUNTS */
+ case 217: /* cmd ::= SHOW ACCOUNTS */
{ pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); }
break;
- case 216: /* cmd ::= SHOW APPS */
+ case 218: /* cmd ::= SHOW APPS */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_APPS_STMT); }
break;
- case 217: /* cmd ::= SHOW CONNECTIONS */
+ case 219: /* cmd ::= SHOW CONNECTIONS */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CONNECTIONS_STMT); }
break;
- case 218: /* cmd ::= SHOW LICENCES */
- case 219: /* cmd ::= SHOW GRANTS */ yytestcase(yyruleno==219);
+ case 220: /* cmd ::= SHOW LICENCES */
+ case 221: /* cmd ::= SHOW GRANTS */ yytestcase(yyruleno==221);
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_LICENCES_STMT); }
break;
- case 220: /* cmd ::= SHOW CREATE DATABASE db_name */
-{ pCxt->pRootNode = createShowCreateDatabaseStmt(pCxt, &yymsp[0].minor.yy29); }
+ case 222: /* cmd ::= SHOW CREATE DATABASE db_name */
+{ pCxt->pRootNode = createShowCreateDatabaseStmt(pCxt, &yymsp[0].minor.yy481); }
break;
- case 221: /* cmd ::= SHOW CREATE TABLE full_table_name */
-{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_TABLE_STMT, yymsp[0].minor.yy812); }
+ case 223: /* cmd ::= SHOW CREATE TABLE full_table_name */
+{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_TABLE_STMT, yymsp[0].minor.yy232); }
break;
- case 222: /* cmd ::= SHOW CREATE STABLE full_table_name */
-{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_STABLE_STMT, yymsp[0].minor.yy812); }
+ case 224: /* cmd ::= SHOW CREATE STABLE full_table_name */
+{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_STABLE_STMT, yymsp[0].minor.yy232); }
break;
- case 223: /* cmd ::= SHOW QUERIES */
+ case 225: /* cmd ::= SHOW QUERIES */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_QUERIES_STMT); }
break;
- case 224: /* cmd ::= SHOW SCORES */
+ case 226: /* cmd ::= SHOW SCORES */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SCORES_STMT); }
break;
- case 225: /* cmd ::= SHOW TOPICS */
+ case 227: /* cmd ::= SHOW TOPICS */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TOPICS_STMT); }
break;
- case 226: /* cmd ::= SHOW VARIABLES */
- case 227: /* cmd ::= SHOW CLUSTER VARIABLES */ yytestcase(yyruleno==227);
+ case 228: /* cmd ::= SHOW VARIABLES */
+ case 229: /* cmd ::= SHOW CLUSTER VARIABLES */ yytestcase(yyruleno==229);
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_VARIABLES_STMT); }
break;
- case 228: /* cmd ::= SHOW LOCAL VARIABLES */
+ case 230: /* cmd ::= SHOW LOCAL VARIABLES */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_LOCAL_VARIABLES_STMT); }
break;
- case 229: /* 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.yy812); }
+ case 231: /* 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.yy232); }
break;
- case 230: /* cmd ::= SHOW BNODES */
+ case 232: /* cmd ::= SHOW BNODES */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_BNODES_STMT); }
break;
- case 231: /* cmd ::= SHOW SNODES */
+ case 233: /* cmd ::= SHOW SNODES */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SNODES_STMT); }
break;
- case 232: /* cmd ::= SHOW CLUSTER */
+ case 234: /* cmd ::= SHOW CLUSTER */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CLUSTER_STMT); }
break;
- case 233: /* cmd ::= SHOW TRANSACTIONS */
+ case 235: /* cmd ::= SHOW TRANSACTIONS */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TRANSACTIONS_STMT); }
break;
- case 234: /* cmd ::= SHOW TABLE DISTRIBUTED full_table_name */
-{ pCxt->pRootNode = createShowTableDistributedStmt(pCxt, yymsp[0].minor.yy812); }
+ case 236: /* cmd ::= SHOW TABLE DISTRIBUTED full_table_name */
+{ pCxt->pRootNode = createShowTableDistributedStmt(pCxt, yymsp[0].minor.yy232); }
break;
- case 235: /* cmd ::= SHOW CONSUMERS */
+ case 237: /* cmd ::= SHOW CONSUMERS */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CONSUMERS_STMT); }
break;
- case 236: /* cmd ::= SHOW SUBSCRIPTIONS */
+ case 238: /* cmd ::= SHOW SUBSCRIPTIONS */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SUBSCRIPTIONS_STMT); }
break;
- case 237: /* cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */
-{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, yymsp[0].minor.yy812, yymsp[-1].minor.yy812, OP_TYPE_EQUAL); }
+ case 239: /* cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */
+{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, yymsp[0].minor.yy232, yymsp[-1].minor.yy232, OP_TYPE_EQUAL); }
break;
- case 238: /* cmd ::= SHOW TABLE TAGS FROM table_name_cond from_db_opt */
-{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TABLE_TAGS_STMT, yymsp[0].minor.yy812, yymsp[-1].minor.yy812, OP_TYPE_EQUAL); }
+ case 240: /* cmd ::= SHOW TABLE TAGS FROM table_name_cond from_db_opt */
+{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TABLE_TAGS_STMT, yymsp[0].minor.yy232, yymsp[-1].minor.yy232, OP_TYPE_EQUAL); }
break;
- case 239: /* cmd ::= SHOW VNODES NK_INTEGER */
+ case 241: /* cmd ::= SHOW VNODES NK_INTEGER */
{ pCxt->pRootNode = createShowVnodesStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0), NULL); }
break;
- case 240: /* cmd ::= SHOW VNODES NK_STRING */
+ case 242: /* cmd ::= SHOW VNODES NK_STRING */
{ pCxt->pRootNode = createShowVnodesStmt(pCxt, NULL, createValueNode(pCxt, TSDB_DATA_TYPE_VARCHAR, &yymsp[0].minor.yy0)); }
break;
- case 241: /* db_name_cond_opt ::= */
- case 246: /* from_db_opt ::= */ yytestcase(yyruleno==246);
-{ yymsp[1].minor.yy812 = createDefaultDatabaseCondValue(pCxt); }
+ case 243: /* db_name_cond_opt ::= */
+ case 248: /* from_db_opt ::= */ yytestcase(yyruleno==248);
+{ yymsp[1].minor.yy232 = createDefaultDatabaseCondValue(pCxt); }
break;
- case 242: /* db_name_cond_opt ::= db_name NK_DOT */
-{ yylhsminor.yy812 = createIdentifierValueNode(pCxt, &yymsp[-1].minor.yy29); }
- yymsp[-1].minor.yy812 = yylhsminor.yy812;
+ case 244: /* db_name_cond_opt ::= db_name NK_DOT */
+{ yylhsminor.yy232 = createIdentifierValueNode(pCxt, &yymsp[-1].minor.yy481); }
+ yymsp[-1].minor.yy232 = yylhsminor.yy232;
break;
- case 243: /* like_pattern_opt ::= */
- case 289: /* subtable_opt ::= */ yytestcase(yyruleno==289);
- case 402: /* case_when_else_opt ::= */ yytestcase(yyruleno==402);
- case 432: /* from_clause_opt ::= */ yytestcase(yyruleno==432);
- case 461: /* where_clause_opt ::= */ yytestcase(yyruleno==461);
- case 470: /* twindow_clause_opt ::= */ yytestcase(yyruleno==470);
- case 475: /* sliding_opt ::= */ yytestcase(yyruleno==475);
- case 477: /* fill_opt ::= */ yytestcase(yyruleno==477);
- case 489: /* having_clause_opt ::= */ yytestcase(yyruleno==489);
- case 491: /* range_opt ::= */ yytestcase(yyruleno==491);
- case 493: /* every_opt ::= */ yytestcase(yyruleno==493);
- case 506: /* slimit_clause_opt ::= */ yytestcase(yyruleno==506);
- case 510: /* limit_clause_opt ::= */ yytestcase(yyruleno==510);
-{ yymsp[1].minor.yy812 = NULL; }
+ case 245: /* like_pattern_opt ::= */
+ case 291: /* subtable_opt ::= */ yytestcase(yyruleno==291);
+ case 404: /* case_when_else_opt ::= */ yytestcase(yyruleno==404);
+ case 434: /* from_clause_opt ::= */ yytestcase(yyruleno==434);
+ case 463: /* where_clause_opt ::= */ yytestcase(yyruleno==463);
+ case 472: /* twindow_clause_opt ::= */ yytestcase(yyruleno==472);
+ case 477: /* sliding_opt ::= */ yytestcase(yyruleno==477);
+ case 479: /* fill_opt ::= */ yytestcase(yyruleno==479);
+ case 491: /* having_clause_opt ::= */ yytestcase(yyruleno==491);
+ case 493: /* range_opt ::= */ yytestcase(yyruleno==493);
+ case 495: /* every_opt ::= */ yytestcase(yyruleno==495);
+ case 508: /* slimit_clause_opt ::= */ yytestcase(yyruleno==508);
+ case 512: /* limit_clause_opt ::= */ yytestcase(yyruleno==512);
+{ yymsp[1].minor.yy232 = NULL; }
break;
- case 244: /* like_pattern_opt ::= LIKE NK_STRING */
-{ yymsp[-1].minor.yy812 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); }
+ case 246: /* like_pattern_opt ::= LIKE NK_STRING */
+{ yymsp[-1].minor.yy232 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); }
break;
- case 245: /* table_name_cond ::= table_name */
-{ yylhsminor.yy812 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy29); }
- yymsp[0].minor.yy812 = yylhsminor.yy812;
+ case 247: /* table_name_cond ::= table_name */
+{ yylhsminor.yy232 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy481); }
+ yymsp[0].minor.yy232 = yylhsminor.yy232;
break;
- case 247: /* from_db_opt ::= FROM db_name */
-{ yymsp[-1].minor.yy812 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy29); }
+ case 249: /* from_db_opt ::= FROM db_name */
+{ yymsp[-1].minor.yy232 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy481); }
break;
- case 248: /* cmd ::= CREATE SMA INDEX not_exists_opt full_table_name ON full_table_name index_options */
-{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, yymsp[-4].minor.yy137, yymsp[-3].minor.yy812, yymsp[-1].minor.yy812, NULL, yymsp[0].minor.yy812); }
+ case 250: /* cmd ::= CREATE SMA INDEX not_exists_opt full_table_name ON full_table_name index_options */
+{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, yymsp[-4].minor.yy777, yymsp[-3].minor.yy232, yymsp[-1].minor.yy232, NULL, yymsp[0].minor.yy232); }
break;
- case 249: /* cmd ::= DROP INDEX exists_opt full_table_name */
-{ pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-1].minor.yy137, yymsp[0].minor.yy812); }
+ case 251: /* cmd ::= DROP INDEX exists_opt full_table_name */
+{ pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-1].minor.yy777, yymsp[0].minor.yy232); }
break;
- case 250: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */
-{ yymsp[-9].minor.yy812 = createIndexOption(pCxt, yymsp[-7].minor.yy424, releaseRawExprNode(pCxt, yymsp[-3].minor.yy812), NULL, yymsp[-1].minor.yy812, yymsp[0].minor.yy812); }
+ case 252: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */
+{ yymsp[-9].minor.yy232 = createIndexOption(pCxt, yymsp[-7].minor.yy288, releaseRawExprNode(pCxt, yymsp[-3].minor.yy232), NULL, yymsp[-1].minor.yy232, yymsp[0].minor.yy232); }
break;
- case 251: /* 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.yy812 = createIndexOption(pCxt, yymsp[-9].minor.yy424, releaseRawExprNode(pCxt, yymsp[-5].minor.yy812), releaseRawExprNode(pCxt, yymsp[-3].minor.yy812), yymsp[-1].minor.yy812, yymsp[0].minor.yy812); }
+ case 253: /* 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.yy232 = createIndexOption(pCxt, yymsp[-9].minor.yy288, releaseRawExprNode(pCxt, yymsp[-5].minor.yy232), releaseRawExprNode(pCxt, yymsp[-3].minor.yy232), yymsp[-1].minor.yy232, yymsp[0].minor.yy232); }
break;
- case 254: /* func ::= function_name NK_LP expression_list NK_RP */
-{ yylhsminor.yy812 = createFunctionNode(pCxt, &yymsp[-3].minor.yy29, yymsp[-1].minor.yy424); }
- yymsp[-3].minor.yy812 = yylhsminor.yy812;
+ case 256: /* func ::= function_name NK_LP expression_list NK_RP */
+{ yylhsminor.yy232 = createFunctionNode(pCxt, &yymsp[-3].minor.yy481, yymsp[-1].minor.yy288); }
+ yymsp[-3].minor.yy232 = yylhsminor.yy232;
break;
- case 255: /* sma_stream_opt ::= */
- case 282: /* stream_options ::= */ yytestcase(yyruleno==282);
-{ yymsp[1].minor.yy812 = createStreamOptions(pCxt); }
+ case 257: /* sma_stream_opt ::= */
+ case 284: /* stream_options ::= */ yytestcase(yyruleno==284);
+{ yymsp[1].minor.yy232 = createStreamOptions(pCxt); }
break;
- case 256: /* sma_stream_opt ::= stream_options WATERMARK duration_literal */
- case 286: /* stream_options ::= stream_options WATERMARK duration_literal */ yytestcase(yyruleno==286);
-{ ((SStreamOptions*)yymsp[-2].minor.yy812)->pWatermark = releaseRawExprNode(pCxt, yymsp[0].minor.yy812); yylhsminor.yy812 = yymsp[-2].minor.yy812; }
- yymsp[-2].minor.yy812 = yylhsminor.yy812;
+ case 258: /* sma_stream_opt ::= stream_options WATERMARK duration_literal */
+ case 288: /* stream_options ::= stream_options WATERMARK duration_literal */ yytestcase(yyruleno==288);
+{ ((SStreamOptions*)yymsp[-2].minor.yy232)->pWatermark = releaseRawExprNode(pCxt, yymsp[0].minor.yy232); yylhsminor.yy232 = yymsp[-2].minor.yy232; }
+ yymsp[-2].minor.yy232 = yylhsminor.yy232;
break;
- case 257: /* sma_stream_opt ::= stream_options MAX_DELAY duration_literal */
-{ ((SStreamOptions*)yymsp[-2].minor.yy812)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy812); yylhsminor.yy812 = yymsp[-2].minor.yy812; }
- yymsp[-2].minor.yy812 = yylhsminor.yy812;
+ case 259: /* sma_stream_opt ::= stream_options MAX_DELAY duration_literal */
+{ ((SStreamOptions*)yymsp[-2].minor.yy232)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy232); yylhsminor.yy232 = yymsp[-2].minor.yy232; }
+ yymsp[-2].minor.yy232 = yylhsminor.yy232;
break;
- case 258: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */
-{ pCxt->pRootNode = createCreateTopicStmtUseQuery(pCxt, yymsp[-3].minor.yy137, &yymsp[-2].minor.yy29, yymsp[0].minor.yy812); }
+ case 260: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */
+{ pCxt->pRootNode = createCreateTopicStmtUseQuery(pCxt, yymsp[-3].minor.yy777, &yymsp[-2].minor.yy481, yymsp[0].minor.yy232); }
break;
- case 259: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name */
-{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-4].minor.yy137, &yymsp[-3].minor.yy29, &yymsp[0].minor.yy29, false); }
+ case 261: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name */
+{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-4].minor.yy777, &yymsp[-3].minor.yy481, &yymsp[0].minor.yy481, false); }
break;
- case 260: /* cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name */
-{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-6].minor.yy137, &yymsp[-5].minor.yy29, &yymsp[0].minor.yy29, true); }
+ case 262: /* cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name */
+{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-6].minor.yy777, &yymsp[-5].minor.yy481, &yymsp[0].minor.yy481, true); }
break;
- case 261: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name */
-{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-4].minor.yy137, &yymsp[-3].minor.yy29, yymsp[0].minor.yy812, false); }
+ case 263: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name */
+{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-4].minor.yy777, &yymsp[-3].minor.yy481, yymsp[0].minor.yy232, false); }
break;
- case 262: /* cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name */
-{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-6].minor.yy137, &yymsp[-5].minor.yy29, yymsp[0].minor.yy812, true); }
+ case 264: /* cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name */
+{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-6].minor.yy777, &yymsp[-5].minor.yy481, yymsp[0].minor.yy232, true); }
break;
- case 263: /* cmd ::= DROP TOPIC exists_opt topic_name */
-{ pCxt->pRootNode = createDropTopicStmt(pCxt, yymsp[-1].minor.yy137, &yymsp[0].minor.yy29); }
+ case 265: /* cmd ::= DROP TOPIC exists_opt topic_name */
+{ pCxt->pRootNode = createDropTopicStmt(pCxt, yymsp[-1].minor.yy777, &yymsp[0].minor.yy481); }
break;
- case 264: /* cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */
-{ pCxt->pRootNode = createDropCGroupStmt(pCxt, yymsp[-3].minor.yy137, &yymsp[-2].minor.yy29, &yymsp[0].minor.yy29); }
+ case 266: /* cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */
+{ pCxt->pRootNode = createDropCGroupStmt(pCxt, yymsp[-3].minor.yy777, &yymsp[-2].minor.yy481, &yymsp[0].minor.yy481); }
break;
- case 265: /* cmd ::= DESC full_table_name */
- case 266: /* cmd ::= DESCRIBE full_table_name */ yytestcase(yyruleno==266);
-{ pCxt->pRootNode = createDescribeStmt(pCxt, yymsp[0].minor.yy812); }
+ case 267: /* cmd ::= DESC full_table_name */
+ case 268: /* cmd ::= DESCRIBE full_table_name */ yytestcase(yyruleno==268);
+{ pCxt->pRootNode = createDescribeStmt(pCxt, yymsp[0].minor.yy232); }
break;
- case 267: /* cmd ::= RESET QUERY CACHE */
+ case 269: /* cmd ::= RESET QUERY CACHE */
{ pCxt->pRootNode = createResetQueryCacheStmt(pCxt); }
break;
- case 268: /* cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */
-{ pCxt->pRootNode = createExplainStmt(pCxt, yymsp[-2].minor.yy137, yymsp[-1].minor.yy812, yymsp[0].minor.yy812); }
+ case 270: /* cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */
+{ pCxt->pRootNode = createExplainStmt(pCxt, yymsp[-2].minor.yy777, yymsp[-1].minor.yy232, yymsp[0].minor.yy232); }
break;
- case 270: /* analyze_opt ::= ANALYZE */
- case 277: /* agg_func_opt ::= AGGREGATE */ yytestcase(yyruleno==277);
- case 452: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==452);
-{ yymsp[0].minor.yy137 = true; }
+ case 273: /* explain_options ::= */
+{ yymsp[1].minor.yy232 = createDefaultExplainOptions(pCxt); }
break;
- case 271: /* explain_options ::= */
-{ yymsp[1].minor.yy812 = createDefaultExplainOptions(pCxt); }
+ case 274: /* explain_options ::= explain_options VERBOSE NK_BOOL */
+{ yylhsminor.yy232 = setExplainVerbose(pCxt, yymsp[-2].minor.yy232, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy232 = yylhsminor.yy232;
break;
- case 272: /* explain_options ::= explain_options VERBOSE NK_BOOL */
-{ yylhsminor.yy812 = setExplainVerbose(pCxt, yymsp[-2].minor.yy812, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy812 = yylhsminor.yy812;
+ case 275: /* explain_options ::= explain_options RATIO NK_FLOAT */
+{ yylhsminor.yy232 = setExplainRatio(pCxt, yymsp[-2].minor.yy232, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy232 = yylhsminor.yy232;
break;
- case 273: /* explain_options ::= explain_options RATIO NK_FLOAT */
-{ yylhsminor.yy812 = setExplainRatio(pCxt, yymsp[-2].minor.yy812, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy812 = yylhsminor.yy812;
+ case 276: /* 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.yy777, yymsp[-8].minor.yy777, &yymsp[-5].minor.yy481, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy264, yymsp[0].minor.yy692); }
break;
- case 274: /* 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.yy137, yymsp[-8].minor.yy137, &yymsp[-5].minor.yy29, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy484, yymsp[0].minor.yy460); }
+ case 277: /* cmd ::= DROP FUNCTION exists_opt function_name */
+{ pCxt->pRootNode = createDropFunctionStmt(pCxt, yymsp[-1].minor.yy777, &yymsp[0].minor.yy481); }
break;
- case 275: /* cmd ::= DROP FUNCTION exists_opt function_name */
-{ pCxt->pRootNode = createDropFunctionStmt(pCxt, yymsp[-1].minor.yy137, &yymsp[0].minor.yy29); }
+ case 282: /* 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.yy777, &yymsp[-7].minor.yy481, yymsp[-4].minor.yy232, yymsp[-6].minor.yy232, yymsp[-3].minor.yy288, yymsp[-2].minor.yy232, yymsp[0].minor.yy232); }
break;
- case 280: /* 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.yy137, &yymsp[-7].minor.yy29, yymsp[-4].minor.yy812, yymsp[-6].minor.yy812, yymsp[-3].minor.yy424, yymsp[-2].minor.yy812, yymsp[0].minor.yy812); }
+ case 283: /* cmd ::= DROP STREAM exists_opt stream_name */
+{ pCxt->pRootNode = createDropStreamStmt(pCxt, yymsp[-1].minor.yy777, &yymsp[0].minor.yy481); }
break;
- case 281: /* cmd ::= DROP STREAM exists_opt stream_name */
-{ pCxt->pRootNode = createDropStreamStmt(pCxt, yymsp[-1].minor.yy137, &yymsp[0].minor.yy29); }
+ case 285: /* stream_options ::= stream_options TRIGGER AT_ONCE */
+{ ((SStreamOptions*)yymsp[-2].minor.yy232)->triggerType = STREAM_TRIGGER_AT_ONCE; yylhsminor.yy232 = yymsp[-2].minor.yy232; }
+ yymsp[-2].minor.yy232 = yylhsminor.yy232;
break;
- case 283: /* stream_options ::= stream_options TRIGGER AT_ONCE */
-{ ((SStreamOptions*)yymsp[-2].minor.yy812)->triggerType = STREAM_TRIGGER_AT_ONCE; yylhsminor.yy812 = yymsp[-2].minor.yy812; }
- yymsp[-2].minor.yy812 = yylhsminor.yy812;
+ case 286: /* stream_options ::= stream_options TRIGGER WINDOW_CLOSE */
+{ ((SStreamOptions*)yymsp[-2].minor.yy232)->triggerType = STREAM_TRIGGER_WINDOW_CLOSE; yylhsminor.yy232 = yymsp[-2].minor.yy232; }
+ yymsp[-2].minor.yy232 = yylhsminor.yy232;
break;
- case 284: /* stream_options ::= stream_options TRIGGER WINDOW_CLOSE */
-{ ((SStreamOptions*)yymsp[-2].minor.yy812)->triggerType = STREAM_TRIGGER_WINDOW_CLOSE; yylhsminor.yy812 = yymsp[-2].minor.yy812; }
- yymsp[-2].minor.yy812 = yylhsminor.yy812;
+ case 287: /* stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */
+{ ((SStreamOptions*)yymsp[-3].minor.yy232)->triggerType = STREAM_TRIGGER_MAX_DELAY; ((SStreamOptions*)yymsp[-3].minor.yy232)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy232); yylhsminor.yy232 = yymsp[-3].minor.yy232; }
+ yymsp[-3].minor.yy232 = yylhsminor.yy232;
break;
- case 285: /* stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */
-{ ((SStreamOptions*)yymsp[-3].minor.yy812)->triggerType = STREAM_TRIGGER_MAX_DELAY; ((SStreamOptions*)yymsp[-3].minor.yy812)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy812); yylhsminor.yy812 = yymsp[-3].minor.yy812; }
- yymsp[-3].minor.yy812 = yylhsminor.yy812;
+ case 289: /* stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */
+{ ((SStreamOptions*)yymsp[-3].minor.yy232)->ignoreExpired = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); yylhsminor.yy232 = yymsp[-3].minor.yy232; }
+ yymsp[-3].minor.yy232 = yylhsminor.yy232;
break;
- case 287: /* stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */
-{ ((SStreamOptions*)yymsp[-3].minor.yy812)->ignoreExpired = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); yylhsminor.yy812 = yymsp[-3].minor.yy812; }
- yymsp[-3].minor.yy812 = yylhsminor.yy812;
+ case 290: /* stream_options ::= stream_options FILL_HISTORY NK_INTEGER */
+{ ((SStreamOptions*)yymsp[-2].minor.yy232)->fillHistory = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); yylhsminor.yy232 = yymsp[-2].minor.yy232; }
+ yymsp[-2].minor.yy232 = yylhsminor.yy232;
break;
- case 288: /* stream_options ::= stream_options FILL_HISTORY NK_INTEGER */
-{ ((SStreamOptions*)yymsp[-2].minor.yy812)->fillHistory = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); yylhsminor.yy812 = yymsp[-2].minor.yy812; }
- yymsp[-2].minor.yy812 = yylhsminor.yy812;
+ case 292: /* subtable_opt ::= SUBTABLE NK_LP expression NK_RP */
+ case 478: /* sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ yytestcase(yyruleno==478);
+ case 496: /* every_opt ::= EVERY NK_LP duration_literal NK_RP */ yytestcase(yyruleno==496);
+{ yymsp[-3].minor.yy232 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy232); }
break;
- case 290: /* subtable_opt ::= SUBTABLE NK_LP expression NK_RP */
- case 476: /* sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ yytestcase(yyruleno==476);
- case 494: /* every_opt ::= EVERY NK_LP duration_literal NK_RP */ yytestcase(yyruleno==494);
-{ yymsp[-3].minor.yy812 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy812); }
- break;
- case 291: /* cmd ::= KILL CONNECTION NK_INTEGER */
+ case 293: /* cmd ::= KILL CONNECTION NK_INTEGER */
{ pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_CONNECTION_STMT, &yymsp[0].minor.yy0); }
break;
- case 292: /* cmd ::= KILL QUERY NK_STRING */
+ case 294: /* cmd ::= KILL QUERY NK_STRING */
{ pCxt->pRootNode = createKillQueryStmt(pCxt, &yymsp[0].minor.yy0); }
break;
- case 293: /* cmd ::= KILL TRANSACTION NK_INTEGER */
+ case 295: /* cmd ::= KILL TRANSACTION NK_INTEGER */
{ pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_TRANSACTION_STMT, &yymsp[0].minor.yy0); }
break;
- case 294: /* cmd ::= BALANCE VGROUP */
+ case 296: /* cmd ::= BALANCE VGROUP */
{ pCxt->pRootNode = createBalanceVgroupStmt(pCxt); }
break;
- case 295: /* cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */
+ case 297: /* cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */
{ pCxt->pRootNode = createMergeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); }
break;
- case 296: /* cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */
-{ pCxt->pRootNode = createRedistributeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy424); }
+ case 298: /* cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */
+{ pCxt->pRootNode = createRedistributeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy288); }
break;
- case 297: /* cmd ::= SPLIT VGROUP NK_INTEGER */
+ case 299: /* cmd ::= SPLIT VGROUP NK_INTEGER */
{ pCxt->pRootNode = createSplitVgroupStmt(pCxt, &yymsp[0].minor.yy0); }
break;
- case 298: /* dnode_list ::= DNODE NK_INTEGER */
-{ yymsp[-1].minor.yy424 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); }
+ case 300: /* dnode_list ::= DNODE NK_INTEGER */
+{ yymsp[-1].minor.yy288 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); }
break;
- case 300: /* cmd ::= DELETE FROM full_table_name where_clause_opt */
-{ pCxt->pRootNode = createDeleteStmt(pCxt, yymsp[-1].minor.yy812, yymsp[0].minor.yy812); }
+ case 302: /* cmd ::= DELETE FROM full_table_name where_clause_opt */
+{ pCxt->pRootNode = createDeleteStmt(pCxt, yymsp[-1].minor.yy232, yymsp[0].minor.yy232); }
break;
- case 302: /* cmd ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */
-{ pCxt->pRootNode = createInsertStmt(pCxt, yymsp[-4].minor.yy812, yymsp[-2].minor.yy424, yymsp[0].minor.yy812); }
+ case 304: /* cmd ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */
+{ pCxt->pRootNode = createInsertStmt(pCxt, yymsp[-4].minor.yy232, yymsp[-2].minor.yy288, yymsp[0].minor.yy232); }
break;
- case 303: /* cmd ::= INSERT INTO full_table_name query_or_subquery */
-{ pCxt->pRootNode = createInsertStmt(pCxt, yymsp[-1].minor.yy812, NULL, yymsp[0].minor.yy812); }
+ case 305: /* cmd ::= INSERT INTO full_table_name query_or_subquery */
+{ pCxt->pRootNode = createInsertStmt(pCxt, yymsp[-1].minor.yy232, NULL, yymsp[0].minor.yy232); }
break;
- case 304: /* literal ::= NK_INTEGER */
-{ yylhsminor.yy812 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0)); }
- yymsp[0].minor.yy812 = yylhsminor.yy812;
+ case 306: /* literal ::= NK_INTEGER */
+{ yylhsminor.yy232 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy232 = yylhsminor.yy232;
break;
- case 305: /* literal ::= NK_FLOAT */
-{ yylhsminor.yy812 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); }
- yymsp[0].minor.yy812 = yylhsminor.yy812;
+ case 307: /* literal ::= NK_FLOAT */
+{ yylhsminor.yy232 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy232 = yylhsminor.yy232;
break;
- case 306: /* literal ::= NK_STRING */
-{ yylhsminor.yy812 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); }
- yymsp[0].minor.yy812 = yylhsminor.yy812;
+ case 308: /* literal ::= NK_STRING */
+{ yylhsminor.yy232 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy232 = yylhsminor.yy232;
break;
- case 307: /* literal ::= NK_BOOL */
-{ yylhsminor.yy812 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); }
- yymsp[0].minor.yy812 = yylhsminor.yy812;
+ case 309: /* literal ::= NK_BOOL */
+{ yylhsminor.yy232 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy232 = yylhsminor.yy232;
break;
- case 308: /* literal ::= TIMESTAMP NK_STRING */
-{ yylhsminor.yy812 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); }
- yymsp[-1].minor.yy812 = yylhsminor.yy812;
+ case 310: /* literal ::= TIMESTAMP NK_STRING */
+{ yylhsminor.yy232 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); }
+ yymsp[-1].minor.yy232 = yylhsminor.yy232;
break;
- case 309: /* literal ::= duration_literal */
- case 319: /* signed_literal ::= signed */ yytestcase(yyruleno==319);
- case 339: /* expr_or_subquery ::= expression */ yytestcase(yyruleno==339);
- case 340: /* expr_or_subquery ::= subquery */ yytestcase(yyruleno==340);
- case 341: /* expression ::= literal */ yytestcase(yyruleno==341);
- case 342: /* expression ::= pseudo_column */ yytestcase(yyruleno==342);
- case 343: /* expression ::= column_reference */ yytestcase(yyruleno==343);
- case 344: /* expression ::= function_expression */ yytestcase(yyruleno==344);
- case 345: /* expression ::= case_when_expression */ yytestcase(yyruleno==345);
- case 375: /* function_expression ::= literal_func */ yytestcase(yyruleno==375);
- case 424: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==424);
- case 428: /* boolean_primary ::= predicate */ yytestcase(yyruleno==428);
- case 430: /* common_expression ::= expr_or_subquery */ yytestcase(yyruleno==430);
- case 431: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==431);
- case 434: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==434);
- case 436: /* table_reference ::= table_primary */ yytestcase(yyruleno==436);
- case 437: /* table_reference ::= joined_table */ yytestcase(yyruleno==437);
- case 441: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==441);
- case 496: /* query_simple ::= query_specification */ yytestcase(yyruleno==496);
- case 497: /* query_simple ::= union_query_expression */ yytestcase(yyruleno==497);
- case 500: /* query_simple_or_subquery ::= query_simple */ yytestcase(yyruleno==500);
- case 502: /* query_or_subquery ::= query_expression */ yytestcase(yyruleno==502);
-{ yylhsminor.yy812 = yymsp[0].minor.yy812; }
- yymsp[0].minor.yy812 = yylhsminor.yy812;
+ case 311: /* literal ::= duration_literal */
+ case 321: /* signed_literal ::= signed */ yytestcase(yyruleno==321);
+ case 341: /* expr_or_subquery ::= expression */ yytestcase(yyruleno==341);
+ case 342: /* expr_or_subquery ::= subquery */ yytestcase(yyruleno==342);
+ case 343: /* expression ::= literal */ yytestcase(yyruleno==343);
+ case 344: /* expression ::= pseudo_column */ yytestcase(yyruleno==344);
+ case 345: /* expression ::= column_reference */ yytestcase(yyruleno==345);
+ case 346: /* expression ::= function_expression */ yytestcase(yyruleno==346);
+ case 347: /* expression ::= case_when_expression */ yytestcase(yyruleno==347);
+ case 377: /* function_expression ::= literal_func */ yytestcase(yyruleno==377);
+ case 426: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==426);
+ case 430: /* boolean_primary ::= predicate */ yytestcase(yyruleno==430);
+ case 432: /* common_expression ::= expr_or_subquery */ yytestcase(yyruleno==432);
+ case 433: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==433);
+ case 436: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==436);
+ case 438: /* table_reference ::= table_primary */ yytestcase(yyruleno==438);
+ case 439: /* table_reference ::= joined_table */ yytestcase(yyruleno==439);
+ case 443: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==443);
+ case 498: /* query_simple ::= query_specification */ yytestcase(yyruleno==498);
+ case 499: /* query_simple ::= union_query_expression */ yytestcase(yyruleno==499);
+ case 502: /* query_simple_or_subquery ::= query_simple */ yytestcase(yyruleno==502);
+ case 504: /* query_or_subquery ::= query_expression */ yytestcase(yyruleno==504);
+{ yylhsminor.yy232 = yymsp[0].minor.yy232; }
+ yymsp[0].minor.yy232 = yylhsminor.yy232;
break;
- case 310: /* literal ::= NULL */
-{ yylhsminor.yy812 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0)); }
- yymsp[0].minor.yy812 = yylhsminor.yy812;
+ case 312: /* literal ::= NULL */
+{ yylhsminor.yy232 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy232 = yylhsminor.yy232;
break;
- case 311: /* literal ::= NK_QUESTION */
-{ yylhsminor.yy812 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0)); }
- yymsp[0].minor.yy812 = yylhsminor.yy812;
+ case 313: /* literal ::= NK_QUESTION */
+{ yylhsminor.yy232 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy232 = yylhsminor.yy232;
break;
- case 312: /* duration_literal ::= NK_VARIABLE */
-{ yylhsminor.yy812 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); }
- yymsp[0].minor.yy812 = yylhsminor.yy812;
+ case 314: /* duration_literal ::= NK_VARIABLE */
+{ yylhsminor.yy232 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy232 = yylhsminor.yy232;
break;
- case 313: /* signed ::= NK_INTEGER */
-{ yylhsminor.yy812 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); }
- yymsp[0].minor.yy812 = yylhsminor.yy812;
+ case 315: /* signed ::= NK_INTEGER */
+{ yylhsminor.yy232 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); }
+ yymsp[0].minor.yy232 = yylhsminor.yy232;
break;
- case 314: /* signed ::= NK_PLUS NK_INTEGER */
-{ yymsp[-1].minor.yy812 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); }
+ case 316: /* signed ::= NK_PLUS NK_INTEGER */
+{ yymsp[-1].minor.yy232 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); }
break;
- case 315: /* signed ::= NK_MINUS NK_INTEGER */
+ case 317: /* 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.yy812 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &t);
+ yylhsminor.yy232 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &t);
}
- yymsp[-1].minor.yy812 = yylhsminor.yy812;
+ yymsp[-1].minor.yy232 = yylhsminor.yy232;
break;
- case 316: /* signed ::= NK_FLOAT */
-{ yylhsminor.yy812 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); }
- yymsp[0].minor.yy812 = yylhsminor.yy812;
+ case 318: /* signed ::= NK_FLOAT */
+{ yylhsminor.yy232 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); }
+ yymsp[0].minor.yy232 = yylhsminor.yy232;
break;
- case 317: /* signed ::= NK_PLUS NK_FLOAT */
-{ yymsp[-1].minor.yy812 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); }
+ case 319: /* signed ::= NK_PLUS NK_FLOAT */
+{ yymsp[-1].minor.yy232 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); }
break;
- case 318: /* signed ::= NK_MINUS NK_FLOAT */
+ case 320: /* 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.yy812 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t);
+ yylhsminor.yy232 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t);
}
- yymsp[-1].minor.yy812 = yylhsminor.yy812;
+ yymsp[-1].minor.yy232 = yylhsminor.yy232;
break;
- case 320: /* signed_literal ::= NK_STRING */
-{ yylhsminor.yy812 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); }
- yymsp[0].minor.yy812 = yylhsminor.yy812;
+ case 322: /* signed_literal ::= NK_STRING */
+{ yylhsminor.yy232 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); }
+ yymsp[0].minor.yy232 = yylhsminor.yy232;
break;
- case 321: /* signed_literal ::= NK_BOOL */
-{ yylhsminor.yy812 = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0); }
- yymsp[0].minor.yy812 = yylhsminor.yy812;
+ case 323: /* signed_literal ::= NK_BOOL */
+{ yylhsminor.yy232 = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0); }
+ yymsp[0].minor.yy232 = yylhsminor.yy232;
break;
- case 322: /* signed_literal ::= TIMESTAMP NK_STRING */
-{ yymsp[-1].minor.yy812 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); }
+ case 324: /* signed_literal ::= TIMESTAMP NK_STRING */
+{ yymsp[-1].minor.yy232 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); }
break;
- case 323: /* signed_literal ::= duration_literal */
- case 325: /* signed_literal ::= literal_func */ yytestcase(yyruleno==325);
- case 395: /* star_func_para ::= expr_or_subquery */ yytestcase(yyruleno==395);
- case 457: /* select_item ::= common_expression */ yytestcase(yyruleno==457);
- case 467: /* partition_item ::= expr_or_subquery */ yytestcase(yyruleno==467);
- case 501: /* query_simple_or_subquery ::= subquery */ yytestcase(yyruleno==501);
- case 503: /* query_or_subquery ::= subquery */ yytestcase(yyruleno==503);
- case 516: /* search_condition ::= common_expression */ yytestcase(yyruleno==516);
-{ yylhsminor.yy812 = releaseRawExprNode(pCxt, yymsp[0].minor.yy812); }
- yymsp[0].minor.yy812 = yylhsminor.yy812;
+ case 325: /* signed_literal ::= duration_literal */
+ case 327: /* signed_literal ::= literal_func */ yytestcase(yyruleno==327);
+ case 397: /* star_func_para ::= expr_or_subquery */ yytestcase(yyruleno==397);
+ case 459: /* select_item ::= common_expression */ yytestcase(yyruleno==459);
+ case 469: /* partition_item ::= expr_or_subquery */ yytestcase(yyruleno==469);
+ case 503: /* query_simple_or_subquery ::= subquery */ yytestcase(yyruleno==503);
+ case 505: /* query_or_subquery ::= subquery */ yytestcase(yyruleno==505);
+ case 518: /* search_condition ::= common_expression */ yytestcase(yyruleno==518);
+{ yylhsminor.yy232 = releaseRawExprNode(pCxt, yymsp[0].minor.yy232); }
+ yymsp[0].minor.yy232 = yylhsminor.yy232;
break;
- case 324: /* signed_literal ::= NULL */
-{ yylhsminor.yy812 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0); }
- yymsp[0].minor.yy812 = yylhsminor.yy812;
+ case 326: /* signed_literal ::= NULL */
+{ yylhsminor.yy232 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0); }
+ yymsp[0].minor.yy232 = yylhsminor.yy232;
break;
- case 326: /* signed_literal ::= NK_QUESTION */
-{ yylhsminor.yy812 = createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0); }
- yymsp[0].minor.yy812 = yylhsminor.yy812;
+ case 328: /* signed_literal ::= NK_QUESTION */
+{ yylhsminor.yy232 = createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0); }
+ yymsp[0].minor.yy232 = yylhsminor.yy232;
break;
- case 346: /* expression ::= NK_LP expression NK_RP */
- case 429: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==429);
- case 515: /* subquery ::= NK_LP subquery NK_RP */ yytestcase(yyruleno==515);
-{ yylhsminor.yy812 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy812)); }
- yymsp[-2].minor.yy812 = yylhsminor.yy812;
+ case 348: /* expression ::= NK_LP expression NK_RP */
+ case 431: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==431);
+ case 517: /* subquery ::= NK_LP subquery NK_RP */ yytestcase(yyruleno==517);
+{ yylhsminor.yy232 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy232)); }
+ yymsp[-2].minor.yy232 = yylhsminor.yy232;
break;
- case 347: /* expression ::= NK_PLUS expr_or_subquery */
+ case 349: /* expression ::= NK_PLUS expr_or_subquery */
{
- SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy812);
- yylhsminor.yy812 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy812));
+ SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy232);
+ yylhsminor.yy232 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy232));
}
- yymsp[-1].minor.yy812 = yylhsminor.yy812;
+ yymsp[-1].minor.yy232 = yylhsminor.yy232;
break;
- case 348: /* expression ::= NK_MINUS expr_or_subquery */
+ case 350: /* expression ::= NK_MINUS expr_or_subquery */
{
- SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy812);
- yylhsminor.yy812 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_MINUS, releaseRawExprNode(pCxt, yymsp[0].minor.yy812), NULL));
+ SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy232);
+ yylhsminor.yy232 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_MINUS, releaseRawExprNode(pCxt, yymsp[0].minor.yy232), NULL));
}
- yymsp[-1].minor.yy812 = yylhsminor.yy812;
+ yymsp[-1].minor.yy232 = yylhsminor.yy232;
break;
- case 349: /* expression ::= expr_or_subquery NK_PLUS expr_or_subquery */
+ case 351: /* expression ::= expr_or_subquery NK_PLUS expr_or_subquery */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy812);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy812);
- yylhsminor.yy812 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_ADD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy812), releaseRawExprNode(pCxt, yymsp[0].minor.yy812)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy232);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy232);
+ yylhsminor.yy232 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_ADD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy232), releaseRawExprNode(pCxt, yymsp[0].minor.yy232)));
}
- yymsp[-2].minor.yy812 = yylhsminor.yy812;
+ yymsp[-2].minor.yy232 = yylhsminor.yy232;
break;
- case 350: /* expression ::= expr_or_subquery NK_MINUS expr_or_subquery */
+ case 352: /* expression ::= expr_or_subquery NK_MINUS expr_or_subquery */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy812);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy812);
- yylhsminor.yy812 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[-2].minor.yy812), releaseRawExprNode(pCxt, yymsp[0].minor.yy812)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy232);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy232);
+ yylhsminor.yy232 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[-2].minor.yy232), releaseRawExprNode(pCxt, yymsp[0].minor.yy232)));
}
- yymsp[-2].minor.yy812 = yylhsminor.yy812;
+ yymsp[-2].minor.yy232 = yylhsminor.yy232;
break;
- case 351: /* expression ::= expr_or_subquery NK_STAR expr_or_subquery */
+ case 353: /* expression ::= expr_or_subquery NK_STAR expr_or_subquery */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy812);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy812);
- yylhsminor.yy812 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MULTI, releaseRawExprNode(pCxt, yymsp[-2].minor.yy812), releaseRawExprNode(pCxt, yymsp[0].minor.yy812)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy232);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy232);
+ yylhsminor.yy232 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MULTI, releaseRawExprNode(pCxt, yymsp[-2].minor.yy232), releaseRawExprNode(pCxt, yymsp[0].minor.yy232)));
}
- yymsp[-2].minor.yy812 = yylhsminor.yy812;
+ yymsp[-2].minor.yy232 = yylhsminor.yy232;
break;
- case 352: /* expression ::= expr_or_subquery NK_SLASH expr_or_subquery */
+ case 354: /* expression ::= expr_or_subquery NK_SLASH expr_or_subquery */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy812);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy812);
- yylhsminor.yy812 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_DIV, releaseRawExprNode(pCxt, yymsp[-2].minor.yy812), releaseRawExprNode(pCxt, yymsp[0].minor.yy812)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy232);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy232);
+ yylhsminor.yy232 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_DIV, releaseRawExprNode(pCxt, yymsp[-2].minor.yy232), releaseRawExprNode(pCxt, yymsp[0].minor.yy232)));
}
- yymsp[-2].minor.yy812 = yylhsminor.yy812;
+ yymsp[-2].minor.yy232 = yylhsminor.yy232;
break;
- case 353: /* expression ::= expr_or_subquery NK_REM expr_or_subquery */
+ case 355: /* expression ::= expr_or_subquery NK_REM expr_or_subquery */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy812);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy812);
- yylhsminor.yy812 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_REM, releaseRawExprNode(pCxt, yymsp[-2].minor.yy812), releaseRawExprNode(pCxt, yymsp[0].minor.yy812)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy232);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy232);
+ yylhsminor.yy232 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_REM, releaseRawExprNode(pCxt, yymsp[-2].minor.yy232), releaseRawExprNode(pCxt, yymsp[0].minor.yy232)));
}
- yymsp[-2].minor.yy812 = yylhsminor.yy812;
+ yymsp[-2].minor.yy232 = yylhsminor.yy232;
break;
- case 354: /* expression ::= column_reference NK_ARROW NK_STRING */
+ case 356: /* expression ::= column_reference NK_ARROW NK_STRING */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy812);
- yylhsminor.yy812 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_JSON_GET_VALUE, releaseRawExprNode(pCxt, yymsp[-2].minor.yy812), createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy232);
+ yylhsminor.yy232 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_JSON_GET_VALUE, releaseRawExprNode(pCxt, yymsp[-2].minor.yy232), createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)));
}
- yymsp[-2].minor.yy812 = yylhsminor.yy812;
+ yymsp[-2].minor.yy232 = yylhsminor.yy232;
break;
- case 355: /* expression ::= expr_or_subquery NK_BITAND expr_or_subquery */
+ case 357: /* expression ::= expr_or_subquery NK_BITAND expr_or_subquery */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy812);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy812);
- yylhsminor.yy812 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy812), releaseRawExprNode(pCxt, yymsp[0].minor.yy812)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy232);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy232);
+ yylhsminor.yy232 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy232), releaseRawExprNode(pCxt, yymsp[0].minor.yy232)));
}
- yymsp[-2].minor.yy812 = yylhsminor.yy812;
+ yymsp[-2].minor.yy232 = yylhsminor.yy232;
break;
- case 356: /* expression ::= expr_or_subquery NK_BITOR expr_or_subquery */
+ case 358: /* expression ::= expr_or_subquery NK_BITOR expr_or_subquery */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy812);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy812);
- yylhsminor.yy812 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy812), releaseRawExprNode(pCxt, yymsp[0].minor.yy812)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy232);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy232);
+ yylhsminor.yy232 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy232), releaseRawExprNode(pCxt, yymsp[0].minor.yy232)));
}
- yymsp[-2].minor.yy812 = yylhsminor.yy812;
+ yymsp[-2].minor.yy232 = yylhsminor.yy232;
break;
- case 359: /* column_reference ::= column_name */
-{ yylhsminor.yy812 = createRawExprNode(pCxt, &yymsp[0].minor.yy29, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy29)); }
- yymsp[0].minor.yy812 = yylhsminor.yy812;
+ case 361: /* column_reference ::= column_name */
+{ yylhsminor.yy232 = createRawExprNode(pCxt, &yymsp[0].minor.yy481, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy481)); }
+ yymsp[0].minor.yy232 = yylhsminor.yy232;
break;
- case 360: /* column_reference ::= table_name NK_DOT column_name */
-{ yylhsminor.yy812 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy29, &yymsp[0].minor.yy29, createColumnNode(pCxt, &yymsp[-2].minor.yy29, &yymsp[0].minor.yy29)); }
- yymsp[-2].minor.yy812 = yylhsminor.yy812;
+ case 362: /* column_reference ::= table_name NK_DOT column_name */
+{ yylhsminor.yy232 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy481, &yymsp[0].minor.yy481, createColumnNode(pCxt, &yymsp[-2].minor.yy481, &yymsp[0].minor.yy481)); }
+ yymsp[-2].minor.yy232 = yylhsminor.yy232;
break;
- case 361: /* pseudo_column ::= ROWTS */
- case 362: /* pseudo_column ::= TBNAME */ yytestcase(yyruleno==362);
- case 364: /* pseudo_column ::= QSTART */ yytestcase(yyruleno==364);
- case 365: /* pseudo_column ::= QEND */ yytestcase(yyruleno==365);
- case 366: /* pseudo_column ::= QDURATION */ yytestcase(yyruleno==366);
- case 367: /* pseudo_column ::= WSTART */ yytestcase(yyruleno==367);
- case 368: /* pseudo_column ::= WEND */ yytestcase(yyruleno==368);
- case 369: /* pseudo_column ::= WDURATION */ yytestcase(yyruleno==369);
- case 370: /* pseudo_column ::= IROWTS */ yytestcase(yyruleno==370);
- case 371: /* pseudo_column ::= QTAGS */ yytestcase(yyruleno==371);
- case 377: /* literal_func ::= NOW */ yytestcase(yyruleno==377);
-{ yylhsminor.yy812 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); }
- yymsp[0].minor.yy812 = yylhsminor.yy812;
+ case 363: /* pseudo_column ::= ROWTS */
+ case 364: /* pseudo_column ::= TBNAME */ yytestcase(yyruleno==364);
+ case 366: /* pseudo_column ::= QSTART */ yytestcase(yyruleno==366);
+ case 367: /* pseudo_column ::= QEND */ yytestcase(yyruleno==367);
+ case 368: /* pseudo_column ::= QDURATION */ yytestcase(yyruleno==368);
+ case 369: /* pseudo_column ::= WSTART */ yytestcase(yyruleno==369);
+ case 370: /* pseudo_column ::= WEND */ yytestcase(yyruleno==370);
+ case 371: /* pseudo_column ::= WDURATION */ yytestcase(yyruleno==371);
+ case 372: /* pseudo_column ::= IROWTS */ yytestcase(yyruleno==372);
+ case 373: /* pseudo_column ::= QTAGS */ yytestcase(yyruleno==373);
+ case 379: /* literal_func ::= NOW */ yytestcase(yyruleno==379);
+{ yylhsminor.yy232 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); }
+ yymsp[0].minor.yy232 = yylhsminor.yy232;
break;
- case 363: /* pseudo_column ::= table_name NK_DOT TBNAME */
-{ yylhsminor.yy812 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy29, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-2].minor.yy29)))); }
- yymsp[-2].minor.yy812 = yylhsminor.yy812;
+ case 365: /* pseudo_column ::= table_name NK_DOT TBNAME */
+{ yylhsminor.yy232 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy481, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-2].minor.yy481)))); }
+ yymsp[-2].minor.yy232 = yylhsminor.yy232;
break;
- case 372: /* function_expression ::= function_name NK_LP expression_list NK_RP */
- case 373: /* function_expression ::= star_func NK_LP star_func_para_list NK_RP */ yytestcase(yyruleno==373);
-{ yylhsminor.yy812 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy29, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy29, yymsp[-1].minor.yy424)); }
- yymsp[-3].minor.yy812 = yylhsminor.yy812;
+ case 374: /* function_expression ::= function_name NK_LP expression_list NK_RP */
+ case 375: /* function_expression ::= star_func NK_LP star_func_para_list NK_RP */ yytestcase(yyruleno==375);
+{ yylhsminor.yy232 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy481, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy481, yymsp[-1].minor.yy288)); }
+ yymsp[-3].minor.yy232 = yylhsminor.yy232;
break;
- case 374: /* function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */
-{ yylhsminor.yy812 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createCastFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy812), yymsp[-1].minor.yy484)); }
- yymsp[-5].minor.yy812 = yylhsminor.yy812;
+ case 376: /* function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */
+{ yylhsminor.yy232 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createCastFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy232), yymsp[-1].minor.yy264)); }
+ yymsp[-5].minor.yy232 = yylhsminor.yy232;
break;
- case 376: /* literal_func ::= noarg_func NK_LP NK_RP */
-{ yylhsminor.yy812 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy29, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-2].minor.yy29, NULL)); }
- yymsp[-2].minor.yy812 = yylhsminor.yy812;
+ case 378: /* literal_func ::= noarg_func NK_LP NK_RP */
+{ yylhsminor.yy232 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy481, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-2].minor.yy481, NULL)); }
+ yymsp[-2].minor.yy232 = yylhsminor.yy232;
break;
- case 391: /* star_func_para_list ::= NK_STAR */
-{ yylhsminor.yy424 = createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); }
- yymsp[0].minor.yy424 = yylhsminor.yy424;
+ case 393: /* star_func_para_list ::= NK_STAR */
+{ yylhsminor.yy288 = createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy288 = yylhsminor.yy288;
break;
- case 396: /* star_func_para ::= table_name NK_DOT NK_STAR */
- case 460: /* select_item ::= table_name NK_DOT NK_STAR */ yytestcase(yyruleno==460);
-{ yylhsminor.yy812 = createColumnNode(pCxt, &yymsp[-2].minor.yy29, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy812 = yylhsminor.yy812;
+ case 398: /* star_func_para ::= table_name NK_DOT NK_STAR */
+ case 462: /* select_item ::= table_name NK_DOT NK_STAR */ yytestcase(yyruleno==462);
+{ yylhsminor.yy232 = createColumnNode(pCxt, &yymsp[-2].minor.yy481, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy232 = yylhsminor.yy232;
break;
- case 397: /* case_when_expression ::= CASE when_then_list case_when_else_opt END */
-{ yylhsminor.yy812 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, NULL, yymsp[-2].minor.yy424, yymsp[-1].minor.yy812)); }
- yymsp[-3].minor.yy812 = yylhsminor.yy812;
+ case 399: /* case_when_expression ::= CASE when_then_list case_when_else_opt END */
+{ yylhsminor.yy232 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, NULL, yymsp[-2].minor.yy288, yymsp[-1].minor.yy232)); }
+ yymsp[-3].minor.yy232 = yylhsminor.yy232;
break;
- case 398: /* case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */
-{ yylhsminor.yy812 = createRawExprNodeExt(pCxt, &yymsp[-4].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy812), yymsp[-2].minor.yy424, yymsp[-1].minor.yy812)); }
- yymsp[-4].minor.yy812 = yylhsminor.yy812;
+ case 400: /* case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */
+{ yylhsminor.yy232 = createRawExprNodeExt(pCxt, &yymsp[-4].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy232), yymsp[-2].minor.yy288, yymsp[-1].minor.yy232)); }
+ yymsp[-4].minor.yy232 = yylhsminor.yy232;
break;
- case 401: /* when_then_expr ::= WHEN common_expression THEN common_expression */
-{ yymsp[-3].minor.yy812 = createWhenThenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy812), releaseRawExprNode(pCxt, yymsp[0].minor.yy812)); }
+ case 403: /* when_then_expr ::= WHEN common_expression THEN common_expression */
+{ yymsp[-3].minor.yy232 = createWhenThenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy232), releaseRawExprNode(pCxt, yymsp[0].minor.yy232)); }
break;
- case 403: /* case_when_else_opt ::= ELSE common_expression */
-{ yymsp[-1].minor.yy812 = releaseRawExprNode(pCxt, yymsp[0].minor.yy812); }
+ case 405: /* case_when_else_opt ::= ELSE common_expression */
+{ yymsp[-1].minor.yy232 = releaseRawExprNode(pCxt, yymsp[0].minor.yy232); }
break;
- case 404: /* predicate ::= expr_or_subquery compare_op expr_or_subquery */
- case 409: /* predicate ::= expr_or_subquery in_op in_predicate_value */ yytestcase(yyruleno==409);
+ case 406: /* predicate ::= expr_or_subquery compare_op expr_or_subquery */
+ case 411: /* predicate ::= expr_or_subquery in_op in_predicate_value */ yytestcase(yyruleno==411);
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy812);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy812);
- yylhsminor.yy812 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, yymsp[-1].minor.yy740, releaseRawExprNode(pCxt, yymsp[-2].minor.yy812), releaseRawExprNode(pCxt, yymsp[0].minor.yy812)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy232);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy232);
+ yylhsminor.yy232 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, yymsp[-1].minor.yy4, releaseRawExprNode(pCxt, yymsp[-2].minor.yy232), releaseRawExprNode(pCxt, yymsp[0].minor.yy232)));
}
- yymsp[-2].minor.yy812 = yylhsminor.yy812;
+ yymsp[-2].minor.yy232 = yylhsminor.yy232;
break;
- case 405: /* predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */
+ case 407: /* predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy812);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy812);
- yylhsminor.yy812 = createRawExprNodeExt(pCxt, &s, &e, createBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-4].minor.yy812), releaseRawExprNode(pCxt, yymsp[-2].minor.yy812), releaseRawExprNode(pCxt, yymsp[0].minor.yy812)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy232);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy232);
+ yylhsminor.yy232 = createRawExprNodeExt(pCxt, &s, &e, createBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-4].minor.yy232), releaseRawExprNode(pCxt, yymsp[-2].minor.yy232), releaseRawExprNode(pCxt, yymsp[0].minor.yy232)));
}
- yymsp[-4].minor.yy812 = yylhsminor.yy812;
+ yymsp[-4].minor.yy232 = yylhsminor.yy232;
break;
- case 406: /* predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */
+ case 408: /* predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy812);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy812);
- yylhsminor.yy812 = createRawExprNodeExt(pCxt, &s, &e, createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy812), releaseRawExprNode(pCxt, yymsp[-2].minor.yy812), releaseRawExprNode(pCxt, yymsp[0].minor.yy812)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy232);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy232);
+ yylhsminor.yy232 = createRawExprNodeExt(pCxt, &s, &e, createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy232), releaseRawExprNode(pCxt, yymsp[-2].minor.yy232), releaseRawExprNode(pCxt, yymsp[0].minor.yy232)));
}
- yymsp[-5].minor.yy812 = yylhsminor.yy812;
+ yymsp[-5].minor.yy232 = yylhsminor.yy232;
break;
- case 407: /* predicate ::= expr_or_subquery IS NULL */
+ case 409: /* predicate ::= expr_or_subquery IS NULL */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy812);
- yylhsminor.yy812 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy812), NULL));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy232);
+ yylhsminor.yy232 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy232), NULL));
}
- yymsp[-2].minor.yy812 = yylhsminor.yy812;
+ yymsp[-2].minor.yy232 = yylhsminor.yy232;
break;
- case 408: /* predicate ::= expr_or_subquery IS NOT NULL */
+ case 410: /* predicate ::= expr_or_subquery IS NOT NULL */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy812);
- yylhsminor.yy812 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy812), NULL));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy232);
+ yylhsminor.yy232 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy232), NULL));
}
- yymsp[-3].minor.yy812 = yylhsminor.yy812;
+ yymsp[-3].minor.yy232 = yylhsminor.yy232;
break;
- case 410: /* compare_op ::= NK_LT */
-{ yymsp[0].minor.yy740 = OP_TYPE_LOWER_THAN; }
+ case 412: /* compare_op ::= NK_LT */
+{ yymsp[0].minor.yy4 = OP_TYPE_LOWER_THAN; }
break;
- case 411: /* compare_op ::= NK_GT */
-{ yymsp[0].minor.yy740 = OP_TYPE_GREATER_THAN; }
+ case 413: /* compare_op ::= NK_GT */
+{ yymsp[0].minor.yy4 = OP_TYPE_GREATER_THAN; }
break;
- case 412: /* compare_op ::= NK_LE */
-{ yymsp[0].minor.yy740 = OP_TYPE_LOWER_EQUAL; }
+ case 414: /* compare_op ::= NK_LE */
+{ yymsp[0].minor.yy4 = OP_TYPE_LOWER_EQUAL; }
break;
- case 413: /* compare_op ::= NK_GE */
-{ yymsp[0].minor.yy740 = OP_TYPE_GREATER_EQUAL; }
+ case 415: /* compare_op ::= NK_GE */
+{ yymsp[0].minor.yy4 = OP_TYPE_GREATER_EQUAL; }
break;
- case 414: /* compare_op ::= NK_NE */
-{ yymsp[0].minor.yy740 = OP_TYPE_NOT_EQUAL; }
+ case 416: /* compare_op ::= NK_NE */
+{ yymsp[0].minor.yy4 = OP_TYPE_NOT_EQUAL; }
break;
- case 415: /* compare_op ::= NK_EQ */
-{ yymsp[0].minor.yy740 = OP_TYPE_EQUAL; }
+ case 417: /* compare_op ::= NK_EQ */
+{ yymsp[0].minor.yy4 = OP_TYPE_EQUAL; }
break;
- case 416: /* compare_op ::= LIKE */
-{ yymsp[0].minor.yy740 = OP_TYPE_LIKE; }
+ case 418: /* compare_op ::= LIKE */
+{ yymsp[0].minor.yy4 = OP_TYPE_LIKE; }
break;
- case 417: /* compare_op ::= NOT LIKE */
-{ yymsp[-1].minor.yy740 = OP_TYPE_NOT_LIKE; }
+ case 419: /* compare_op ::= NOT LIKE */
+{ yymsp[-1].minor.yy4 = OP_TYPE_NOT_LIKE; }
break;
- case 418: /* compare_op ::= MATCH */
-{ yymsp[0].minor.yy740 = OP_TYPE_MATCH; }
+ case 420: /* compare_op ::= MATCH */
+{ yymsp[0].minor.yy4 = OP_TYPE_MATCH; }
break;
- case 419: /* compare_op ::= NMATCH */
-{ yymsp[0].minor.yy740 = OP_TYPE_NMATCH; }
+ case 421: /* compare_op ::= NMATCH */
+{ yymsp[0].minor.yy4 = OP_TYPE_NMATCH; }
break;
- case 420: /* compare_op ::= CONTAINS */
-{ yymsp[0].minor.yy740 = OP_TYPE_JSON_CONTAINS; }
+ case 422: /* compare_op ::= CONTAINS */
+{ yymsp[0].minor.yy4 = OP_TYPE_JSON_CONTAINS; }
break;
- case 421: /* in_op ::= IN */
-{ yymsp[0].minor.yy740 = OP_TYPE_IN; }
+ case 423: /* in_op ::= IN */
+{ yymsp[0].minor.yy4 = OP_TYPE_IN; }
break;
- case 422: /* in_op ::= NOT IN */
-{ yymsp[-1].minor.yy740 = OP_TYPE_NOT_IN; }
+ case 424: /* in_op ::= NOT IN */
+{ yymsp[-1].minor.yy4 = OP_TYPE_NOT_IN; }
break;
- case 423: /* in_predicate_value ::= NK_LP literal_list NK_RP */
-{ yylhsminor.yy812 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy424)); }
- yymsp[-2].minor.yy812 = yylhsminor.yy812;
+ case 425: /* in_predicate_value ::= NK_LP literal_list NK_RP */
+{ yylhsminor.yy232 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy288)); }
+ yymsp[-2].minor.yy232 = yylhsminor.yy232;
break;
- case 425: /* boolean_value_expression ::= NOT boolean_primary */
+ case 427: /* boolean_value_expression ::= NOT boolean_primary */
{
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy812);
- yylhsminor.yy812 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy812), NULL));
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy232);
+ yylhsminor.yy232 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy232), NULL));
}
- yymsp[-1].minor.yy812 = yylhsminor.yy812;
+ yymsp[-1].minor.yy232 = yylhsminor.yy232;
break;
- case 426: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */
+ case 428: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy812);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy812);
- yylhsminor.yy812 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy812), releaseRawExprNode(pCxt, yymsp[0].minor.yy812)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy232);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy232);
+ yylhsminor.yy232 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy232), releaseRawExprNode(pCxt, yymsp[0].minor.yy232)));
}
- yymsp[-2].minor.yy812 = yylhsminor.yy812;
+ yymsp[-2].minor.yy232 = yylhsminor.yy232;
break;
- case 427: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */
+ case 429: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy812);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy812);
- yylhsminor.yy812 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy812), releaseRawExprNode(pCxt, yymsp[0].minor.yy812)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy232);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy232);
+ yylhsminor.yy232 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy232), releaseRawExprNode(pCxt, yymsp[0].minor.yy232)));
}
- yymsp[-2].minor.yy812 = yylhsminor.yy812;
+ yymsp[-2].minor.yy232 = yylhsminor.yy232;
break;
- case 433: /* from_clause_opt ::= FROM table_reference_list */
- case 462: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==462);
- case 490: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==490);
-{ yymsp[-1].minor.yy812 = yymsp[0].minor.yy812; }
+ case 435: /* from_clause_opt ::= FROM table_reference_list */
+ case 464: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==464);
+ case 492: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==492);
+{ yymsp[-1].minor.yy232 = yymsp[0].minor.yy232; }
break;
- case 435: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */
-{ yylhsminor.yy812 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, yymsp[-2].minor.yy812, yymsp[0].minor.yy812, NULL); }
- yymsp[-2].minor.yy812 = yylhsminor.yy812;
+ case 437: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */
+{ yylhsminor.yy232 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, yymsp[-2].minor.yy232, yymsp[0].minor.yy232, NULL); }
+ yymsp[-2].minor.yy232 = yylhsminor.yy232;
break;
- case 438: /* table_primary ::= table_name alias_opt */
-{ yylhsminor.yy812 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy29, &yymsp[0].minor.yy29); }
- yymsp[-1].minor.yy812 = yylhsminor.yy812;
+ case 440: /* table_primary ::= table_name alias_opt */
+{ yylhsminor.yy232 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy481, &yymsp[0].minor.yy481); }
+ yymsp[-1].minor.yy232 = yylhsminor.yy232;
break;
- case 439: /* table_primary ::= db_name NK_DOT table_name alias_opt */
-{ yylhsminor.yy812 = createRealTableNode(pCxt, &yymsp[-3].minor.yy29, &yymsp[-1].minor.yy29, &yymsp[0].minor.yy29); }
- yymsp[-3].minor.yy812 = yylhsminor.yy812;
+ case 441: /* table_primary ::= db_name NK_DOT table_name alias_opt */
+{ yylhsminor.yy232 = createRealTableNode(pCxt, &yymsp[-3].minor.yy481, &yymsp[-1].minor.yy481, &yymsp[0].minor.yy481); }
+ yymsp[-3].minor.yy232 = yylhsminor.yy232;
break;
- case 440: /* table_primary ::= subquery alias_opt */
-{ yylhsminor.yy812 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy812), &yymsp[0].minor.yy29); }
- yymsp[-1].minor.yy812 = yylhsminor.yy812;
+ case 442: /* table_primary ::= subquery alias_opt */
+{ yylhsminor.yy232 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy232), &yymsp[0].minor.yy481); }
+ yymsp[-1].minor.yy232 = yylhsminor.yy232;
break;
- case 442: /* alias_opt ::= */
-{ yymsp[1].minor.yy29 = nil_token; }
+ case 444: /* alias_opt ::= */
+{ yymsp[1].minor.yy481 = nil_token; }
break;
- case 443: /* alias_opt ::= table_alias */
-{ yylhsminor.yy29 = yymsp[0].minor.yy29; }
- yymsp[0].minor.yy29 = yylhsminor.yy29;
+ case 445: /* alias_opt ::= table_alias */
+{ yylhsminor.yy481 = yymsp[0].minor.yy481; }
+ yymsp[0].minor.yy481 = yylhsminor.yy481;
break;
- case 444: /* alias_opt ::= AS table_alias */
-{ yymsp[-1].minor.yy29 = yymsp[0].minor.yy29; }
+ case 446: /* alias_opt ::= AS table_alias */
+{ yymsp[-1].minor.yy481 = yymsp[0].minor.yy481; }
break;
- case 445: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */
- case 446: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==446);
-{ yymsp[-2].minor.yy812 = yymsp[-1].minor.yy812; }
+ case 447: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */
+ case 448: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==448);
+{ yymsp[-2].minor.yy232 = yymsp[-1].minor.yy232; }
break;
- case 447: /* joined_table ::= table_reference join_type JOIN table_reference ON search_condition */
-{ yylhsminor.yy812 = createJoinTableNode(pCxt, yymsp[-4].minor.yy612, yymsp[-5].minor.yy812, yymsp[-2].minor.yy812, yymsp[0].minor.yy812); }
- yymsp[-5].minor.yy812 = yylhsminor.yy812;
+ case 449: /* joined_table ::= table_reference join_type JOIN table_reference ON search_condition */
+{ yylhsminor.yy232 = createJoinTableNode(pCxt, yymsp[-4].minor.yy700, yymsp[-5].minor.yy232, yymsp[-2].minor.yy232, yymsp[0].minor.yy232); }
+ yymsp[-5].minor.yy232 = yylhsminor.yy232;
break;
- case 448: /* join_type ::= */
-{ yymsp[1].minor.yy612 = JOIN_TYPE_INNER; }
+ case 450: /* join_type ::= */
+{ yymsp[1].minor.yy700 = JOIN_TYPE_INNER; }
break;
- case 449: /* join_type ::= INNER */
-{ yymsp[0].minor.yy612 = JOIN_TYPE_INNER; }
+ case 451: /* join_type ::= INNER */
+{ yymsp[0].minor.yy700 = JOIN_TYPE_INNER; }
break;
- case 450: /* 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 452: /* 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.yy812 = createSelectStmt(pCxt, yymsp[-10].minor.yy137, yymsp[-9].minor.yy424, yymsp[-8].minor.yy812);
- yymsp[-11].minor.yy812 = addWhereClause(pCxt, yymsp[-11].minor.yy812, yymsp[-7].minor.yy812);
- yymsp[-11].minor.yy812 = addPartitionByClause(pCxt, yymsp[-11].minor.yy812, yymsp[-6].minor.yy424);
- yymsp[-11].minor.yy812 = addWindowClauseClause(pCxt, yymsp[-11].minor.yy812, yymsp[-2].minor.yy812);
- yymsp[-11].minor.yy812 = addGroupByClause(pCxt, yymsp[-11].minor.yy812, yymsp[-1].minor.yy424);
- yymsp[-11].minor.yy812 = addHavingClause(pCxt, yymsp[-11].minor.yy812, yymsp[0].minor.yy812);
- yymsp[-11].minor.yy812 = addRangeClause(pCxt, yymsp[-11].minor.yy812, yymsp[-5].minor.yy812);
- yymsp[-11].minor.yy812 = addEveryClause(pCxt, yymsp[-11].minor.yy812, yymsp[-4].minor.yy812);
- yymsp[-11].minor.yy812 = addFillClause(pCxt, yymsp[-11].minor.yy812, yymsp[-3].minor.yy812);
+ yymsp[-11].minor.yy232 = createSelectStmt(pCxt, yymsp[-10].minor.yy777, yymsp[-9].minor.yy288, yymsp[-8].minor.yy232);
+ yymsp[-11].minor.yy232 = addWhereClause(pCxt, yymsp[-11].minor.yy232, yymsp[-7].minor.yy232);
+ yymsp[-11].minor.yy232 = addPartitionByClause(pCxt, yymsp[-11].minor.yy232, yymsp[-6].minor.yy288);
+ yymsp[-11].minor.yy232 = addWindowClauseClause(pCxt, yymsp[-11].minor.yy232, yymsp[-2].minor.yy232);
+ yymsp[-11].minor.yy232 = addGroupByClause(pCxt, yymsp[-11].minor.yy232, yymsp[-1].minor.yy288);
+ yymsp[-11].minor.yy232 = addHavingClause(pCxt, yymsp[-11].minor.yy232, yymsp[0].minor.yy232);
+ yymsp[-11].minor.yy232 = addRangeClause(pCxt, yymsp[-11].minor.yy232, yymsp[-5].minor.yy232);
+ yymsp[-11].minor.yy232 = addEveryClause(pCxt, yymsp[-11].minor.yy232, yymsp[-4].minor.yy232);
+ yymsp[-11].minor.yy232 = addFillClause(pCxt, yymsp[-11].minor.yy232, yymsp[-3].minor.yy232);
}
break;
- case 453: /* set_quantifier_opt ::= ALL */
-{ yymsp[0].minor.yy137 = false; }
+ case 455: /* set_quantifier_opt ::= ALL */
+{ yymsp[0].minor.yy777 = false; }
break;
- case 456: /* select_item ::= NK_STAR */
-{ yylhsminor.yy812 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0); }
- yymsp[0].minor.yy812 = yylhsminor.yy812;
+ case 458: /* select_item ::= NK_STAR */
+{ yylhsminor.yy232 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0); }
+ yymsp[0].minor.yy232 = yylhsminor.yy232;
break;
- case 458: /* select_item ::= common_expression column_alias */
- case 468: /* partition_item ::= expr_or_subquery column_alias */ yytestcase(yyruleno==468);
-{ yylhsminor.yy812 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy812), &yymsp[0].minor.yy29); }
- yymsp[-1].minor.yy812 = yylhsminor.yy812;
+ case 460: /* select_item ::= common_expression column_alias */
+ case 470: /* partition_item ::= expr_or_subquery column_alias */ yytestcase(yyruleno==470);
+{ yylhsminor.yy232 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy232), &yymsp[0].minor.yy481); }
+ yymsp[-1].minor.yy232 = yylhsminor.yy232;
break;
- case 459: /* select_item ::= common_expression AS column_alias */
- case 469: /* partition_item ::= expr_or_subquery AS column_alias */ yytestcase(yyruleno==469);
-{ yylhsminor.yy812 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy812), &yymsp[0].minor.yy29); }
- yymsp[-2].minor.yy812 = yylhsminor.yy812;
+ case 461: /* select_item ::= common_expression AS column_alias */
+ case 471: /* partition_item ::= expr_or_subquery AS column_alias */ yytestcase(yyruleno==471);
+{ yylhsminor.yy232 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy232), &yymsp[0].minor.yy481); }
+ yymsp[-2].minor.yy232 = yylhsminor.yy232;
break;
- case 464: /* partition_by_clause_opt ::= PARTITION BY partition_list */
- case 486: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==486);
- case 505: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==505);
-{ yymsp[-2].minor.yy424 = yymsp[0].minor.yy424; }
+ case 466: /* partition_by_clause_opt ::= PARTITION BY partition_list */
+ case 488: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==488);
+ case 507: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==507);
+{ yymsp[-2].minor.yy288 = yymsp[0].minor.yy288; }
break;
- case 471: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */
-{ yymsp[-5].minor.yy812 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy812), releaseRawExprNode(pCxt, yymsp[-1].minor.yy812)); }
+ case 473: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */
+{ yymsp[-5].minor.yy232 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy232), releaseRawExprNode(pCxt, yymsp[-1].minor.yy232)); }
break;
- case 472: /* twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */
-{ yymsp[-3].minor.yy812 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy812)); }
+ case 474: /* twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */
+{ yymsp[-3].minor.yy232 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy232)); }
break;
- case 473: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */
-{ yymsp[-5].minor.yy812 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy812), NULL, yymsp[-1].minor.yy812, yymsp[0].minor.yy812); }
+ case 475: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */
+{ yymsp[-5].minor.yy232 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy232), NULL, yymsp[-1].minor.yy232, yymsp[0].minor.yy232); }
break;
- case 474: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */
-{ yymsp[-7].minor.yy812 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy812), releaseRawExprNode(pCxt, yymsp[-3].minor.yy812), yymsp[-1].minor.yy812, yymsp[0].minor.yy812); }
+ case 476: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */
+{ yymsp[-7].minor.yy232 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy232), releaseRawExprNode(pCxt, yymsp[-3].minor.yy232), yymsp[-1].minor.yy232, yymsp[0].minor.yy232); }
break;
- case 478: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */
-{ yymsp[-3].minor.yy812 = createFillNode(pCxt, yymsp[-1].minor.yy594, NULL); }
+ case 480: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */
+{ yymsp[-3].minor.yy232 = createFillNode(pCxt, yymsp[-1].minor.yy614, NULL); }
break;
- case 479: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */
-{ yymsp[-5].minor.yy812 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy424)); }
+ case 481: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */
+{ yymsp[-5].minor.yy232 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy288)); }
break;
- case 480: /* fill_mode ::= NONE */
-{ yymsp[0].minor.yy594 = FILL_MODE_NONE; }
+ case 482: /* fill_mode ::= NONE */
+{ yymsp[0].minor.yy614 = FILL_MODE_NONE; }
break;
- case 481: /* fill_mode ::= PREV */
-{ yymsp[0].minor.yy594 = FILL_MODE_PREV; }
+ case 483: /* fill_mode ::= PREV */
+{ yymsp[0].minor.yy614 = FILL_MODE_PREV; }
break;
- case 482: /* fill_mode ::= NULL */
-{ yymsp[0].minor.yy594 = FILL_MODE_NULL; }
+ case 484: /* fill_mode ::= NULL */
+{ yymsp[0].minor.yy614 = FILL_MODE_NULL; }
break;
- case 483: /* fill_mode ::= LINEAR */
-{ yymsp[0].minor.yy594 = FILL_MODE_LINEAR; }
+ case 485: /* fill_mode ::= LINEAR */
+{ yymsp[0].minor.yy614 = FILL_MODE_LINEAR; }
break;
- case 484: /* fill_mode ::= NEXT */
-{ yymsp[0].minor.yy594 = FILL_MODE_NEXT; }
+ case 486: /* fill_mode ::= NEXT */
+{ yymsp[0].minor.yy614 = FILL_MODE_NEXT; }
break;
- case 487: /* group_by_list ::= expr_or_subquery */
-{ yylhsminor.yy424 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy812))); }
- yymsp[0].minor.yy424 = yylhsminor.yy424;
+ case 489: /* group_by_list ::= expr_or_subquery */
+{ yylhsminor.yy288 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy232))); }
+ yymsp[0].minor.yy288 = yylhsminor.yy288;
break;
- case 488: /* group_by_list ::= group_by_list NK_COMMA expr_or_subquery */
-{ yylhsminor.yy424 = addNodeToList(pCxt, yymsp[-2].minor.yy424, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy812))); }
- yymsp[-2].minor.yy424 = yylhsminor.yy424;
+ case 490: /* group_by_list ::= group_by_list NK_COMMA expr_or_subquery */
+{ yylhsminor.yy288 = addNodeToList(pCxt, yymsp[-2].minor.yy288, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy232))); }
+ yymsp[-2].minor.yy288 = yylhsminor.yy288;
break;
- case 492: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */
-{ yymsp[-5].minor.yy812 = createInterpTimeRange(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy812), releaseRawExprNode(pCxt, yymsp[-1].minor.yy812)); }
+ case 494: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */
+{ yymsp[-5].minor.yy232 = createInterpTimeRange(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy232), releaseRawExprNode(pCxt, yymsp[-1].minor.yy232)); }
break;
- case 495: /* query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */
+ case 497: /* query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */
{
- yylhsminor.yy812 = addOrderByClause(pCxt, yymsp[-3].minor.yy812, yymsp[-2].minor.yy424);
- yylhsminor.yy812 = addSlimitClause(pCxt, yylhsminor.yy812, yymsp[-1].minor.yy812);
- yylhsminor.yy812 = addLimitClause(pCxt, yylhsminor.yy812, yymsp[0].minor.yy812);
+ yylhsminor.yy232 = addOrderByClause(pCxt, yymsp[-3].minor.yy232, yymsp[-2].minor.yy288);
+ yylhsminor.yy232 = addSlimitClause(pCxt, yylhsminor.yy232, yymsp[-1].minor.yy232);
+ yylhsminor.yy232 = addLimitClause(pCxt, yylhsminor.yy232, yymsp[0].minor.yy232);
}
- yymsp[-3].minor.yy812 = yylhsminor.yy812;
+ yymsp[-3].minor.yy232 = yylhsminor.yy232;
break;
- case 498: /* union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */
-{ yylhsminor.yy812 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy812, yymsp[0].minor.yy812); }
- yymsp[-3].minor.yy812 = yylhsminor.yy812;
+ case 500: /* union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */
+{ yylhsminor.yy232 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy232, yymsp[0].minor.yy232); }
+ yymsp[-3].minor.yy232 = yylhsminor.yy232;
break;
- case 499: /* union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */
-{ yylhsminor.yy812 = createSetOperator(pCxt, SET_OP_TYPE_UNION, yymsp[-2].minor.yy812, yymsp[0].minor.yy812); }
- yymsp[-2].minor.yy812 = yylhsminor.yy812;
+ case 501: /* union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */
+{ yylhsminor.yy232 = createSetOperator(pCxt, SET_OP_TYPE_UNION, yymsp[-2].minor.yy232, yymsp[0].minor.yy232); }
+ yymsp[-2].minor.yy232 = yylhsminor.yy232;
break;
- case 507: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */
- case 511: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==511);
-{ yymsp[-1].minor.yy812 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); }
+ case 509: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */
+ case 513: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==513);
+{ yymsp[-1].minor.yy232 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); }
break;
- case 508: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */
- case 512: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==512);
-{ yymsp[-3].minor.yy812 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); }
+ case 510: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */
+ case 514: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==514);
+{ yymsp[-3].minor.yy232 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); }
break;
- case 509: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */
- case 513: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==513);
-{ yymsp[-3].minor.yy812 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); }
+ case 511: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */
+ case 515: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==515);
+{ yymsp[-3].minor.yy232 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); }
break;
- case 514: /* subquery ::= NK_LP query_expression NK_RP */
-{ yylhsminor.yy812 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy812); }
- yymsp[-2].minor.yy812 = yylhsminor.yy812;
+ case 516: /* subquery ::= NK_LP query_expression NK_RP */
+{ yylhsminor.yy232 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy232); }
+ yymsp[-2].minor.yy232 = yylhsminor.yy232;
break;
- case 519: /* sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */
-{ yylhsminor.yy812 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy812), yymsp[-1].minor.yy38, yymsp[0].minor.yy757); }
- yymsp[-2].minor.yy812 = yylhsminor.yy812;
+ case 521: /* sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */
+{ yylhsminor.yy232 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy232), yymsp[-1].minor.yy866, yymsp[0].minor.yy833); }
+ yymsp[-2].minor.yy232 = yylhsminor.yy232;
break;
- case 520: /* ordering_specification_opt ::= */
-{ yymsp[1].minor.yy38 = ORDER_ASC; }
+ case 522: /* ordering_specification_opt ::= */
+{ yymsp[1].minor.yy866 = ORDER_ASC; }
break;
- case 521: /* ordering_specification_opt ::= ASC */
-{ yymsp[0].minor.yy38 = ORDER_ASC; }
+ case 523: /* ordering_specification_opt ::= ASC */
+{ yymsp[0].minor.yy866 = ORDER_ASC; }
break;
- case 522: /* ordering_specification_opt ::= DESC */
-{ yymsp[0].minor.yy38 = ORDER_DESC; }
+ case 524: /* ordering_specification_opt ::= DESC */
+{ yymsp[0].minor.yy866 = ORDER_DESC; }
break;
- case 523: /* null_ordering_opt ::= */
-{ yymsp[1].minor.yy757 = NULL_ORDER_DEFAULT; }
+ case 525: /* null_ordering_opt ::= */
+{ yymsp[1].minor.yy833 = NULL_ORDER_DEFAULT; }
break;
- case 524: /* null_ordering_opt ::= NULLS FIRST */
-{ yymsp[-1].minor.yy757 = NULL_ORDER_FIRST; }
+ case 526: /* null_ordering_opt ::= NULLS FIRST */
+{ yymsp[-1].minor.yy833 = NULL_ORDER_FIRST; }
break;
- case 525: /* null_ordering_opt ::= NULLS LAST */
-{ yymsp[-1].minor.yy757 = NULL_ORDER_LAST; }
+ case 527: /* null_ordering_opt ::= NULLS LAST */
+{ yymsp[-1].minor.yy833 = NULL_ORDER_LAST; }
break;
default:
break;
diff --git a/source/libs/parser/test/parInitialDTest.cpp b/source/libs/parser/test/parInitialDTest.cpp
index c7865f3da3..3ded71242b 100644
--- a/source/libs/parser/test/parInitialDTest.cpp
+++ b/source/libs/parser/test/parInitialDTest.cpp
@@ -87,7 +87,6 @@ TEST_F(ParserInitialDTest, dropConsumerGroup) {
// todo DROP database
-// todo DROP dnode
TEST_F(ParserInitialDTest, dropDnode) {
useDb("root", "test");
@@ -95,11 +94,15 @@ TEST_F(ParserInitialDTest, dropDnode) {
auto clearDropDnodeReq = [&]() { memset(&expect, 0, sizeof(SDropDnodeReq)); };
- auto setDropDnodeReqById = [&](int32_t dnodeId) { expect.dnodeId = dnodeId; };
+ auto setDropDnodeReqById = [&](int32_t dnodeId, bool force = false) {
+ expect.dnodeId = dnodeId;
+ expect.force = force;
+ };
- auto setDropDnodeReqByEndpoint = [&](const char* pFqdn, int32_t port) {
+ auto setDropDnodeReqByEndpoint = [&](const char* pFqdn, int32_t port, bool force = false) {
strcpy(expect.fqdn, pFqdn);
expect.port = port;
+ expect.force = force;
};
setCheckDdlFunc([&](const SQuery* pQuery, ParserStage stage) {
@@ -110,15 +113,24 @@ TEST_F(ParserInitialDTest, dropDnode) {
ASSERT_EQ(req.dnodeId, expect.dnodeId);
ASSERT_EQ(std::string(req.fqdn), std::string(expect.fqdn));
ASSERT_EQ(req.port, expect.port);
+ ASSERT_EQ(req.force, expect.force);
});
setDropDnodeReqById(1);
run("DROP DNODE 1");
clearDropDnodeReq();
+ setDropDnodeReqById(2, true);
+ run("DROP DNODE 2 FORCE");
+ clearDropDnodeReq();
+
setDropDnodeReqByEndpoint("host1", 7030);
run("DROP DNODE 'host1:7030'");
clearDropDnodeReq();
+
+ setDropDnodeReqByEndpoint("host2", 8030, true);
+ run("DROP DNODE 'host2:8030' FORCE");
+ clearDropDnodeReq();
}
// todo DROP function
diff --git a/source/libs/planner/src/planLogicCreater.c b/source/libs/planner/src/planLogicCreater.c
index 74941d95f1..275983f869 100644
--- a/source/libs/planner/src/planLogicCreater.c
+++ b/source/libs/planner/src/planLogicCreater.c
@@ -587,6 +587,10 @@ static int32_t createIndefRowsFuncLogicNode(SLogicPlanContext* pCxt, SSelectStmt
return code;
}
+static bool isInterpFunc(int32_t funcId) {
+ return fmIsInterpFunc(funcId) || fmIsInterpPseudoColumnFunc(funcId) || fmIsGroupKeyFunc(funcId);
+}
+
static int32_t createInterpFuncLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pSelect, SLogicNode** pLogicNode) {
if (!pSelect->hasInterpFunc) {
return TSDB_CODE_SUCCESS;
@@ -602,7 +606,7 @@ static int32_t createInterpFuncLogicNode(SLogicPlanContext* pCxt, SSelectStmt* p
pInterpFunc->node.resultDataOrder = pInterpFunc->node.requireDataOrder;
// interp functions and _group_key functions
- int32_t code = nodesCollectFuncs(pSelect, SQL_CLAUSE_SELECT, fmIsVectorFunc, &pInterpFunc->pFuncs);
+ int32_t code = nodesCollectFuncs(pSelect, SQL_CLAUSE_SELECT, isInterpFunc, &pInterpFunc->pFuncs);
if (TSDB_CODE_SUCCESS == code) {
code = rewriteExprsForSelect(pInterpFunc->pFuncs, pSelect, SQL_CLAUSE_SELECT);
}
diff --git a/source/libs/qcom/src/queryUtil.c b/source/libs/qcom/src/queryUtil.c
index 1a7965397e..cf064881c2 100644
--- a/source/libs/qcom/src/queryUtil.c
+++ b/source/libs/qcom/src/queryUtil.c
@@ -456,6 +456,7 @@ int32_t cloneDbVgInfo(SDBVgInfo* pSrc, SDBVgInfo** pDst) {
(*pDst)->vgHash = taosHashInit(taosHashGetSize(pSrc->vgHash), taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT), true,
HASH_ENTRY_LOCK);
if (NULL == (*pDst)->vgHash) {
+ taosMemoryFreeClear(*pDst);
return TSDB_CODE_TSC_OUT_OF_MEMORY;
}
diff --git a/source/libs/qworker/src/qworker.c b/source/libs/qworker/src/qworker.c
index 001a1972a0..a7cd3db824 100644
--- a/source/libs/qworker/src/qworker.c
+++ b/source/libs/qworker/src/qworker.c
@@ -644,11 +644,13 @@ _return:
input.msgType = qwMsg->msgType;
code = qwHandlePostPhaseEvents(QW_FPARAMS(), QW_PHASE_POST_QUERY, &input, NULL);
- if (ctx != NULL && QW_EVENT_RECEIVED(ctx, QW_EVENT_FETCH)) {
+ if (QUERY_RSP_POLICY_QUICK == tsQueryRspPolicy && ctx != NULL && QW_EVENT_RECEIVED(ctx, QW_EVENT_FETCH)) {
void *rsp = NULL;
int32_t dataLen = 0;
SOutputData sOutput = {0};
- QW_ERR_JRET(qwGetQueryResFromSink(QW_FPARAMS(), ctx, &dataLen, &rsp, &sOutput));
+ if (qwGetQueryResFromSink(QW_FPARAMS(), ctx, &dataLen, &rsp, &sOutput)) {
+ return TSDB_CODE_SUCCESS;
+ }
if (rsp) {
bool qComplete = (DS_BUF_EMPTY == sOutput.bufStatus && sOutput.queryEnd);
diff --git a/source/libs/scalar/src/filter.c b/source/libs/scalar/src/filter.c
index 426274a20f..4738e1bbf9 100644
--- a/source/libs/scalar/src/filter.c
+++ b/source/libs/scalar/src/filter.c
@@ -1087,7 +1087,7 @@ int32_t filterAddUnitImpl(SFilterInfo *info, uint8_t optr, SFilterFieldId *left,
if (tmp == NULL) {
return TSDB_CODE_OUT_OF_MEMORY;
}
- info->units = tmp;
+ info->units = (SFilterUnit*)tmp;
memset(info->units + psize, 0, sizeof(*info->units) * FILTER_DEFAULT_UNIT_SIZE);
}
@@ -1633,12 +1633,12 @@ void filterDumpInfoToString(SFilterInfo *info, const char *msg, int32_t options)
SValueNode *var = (SValueNode *)field->desc;
SDataType *dType = &var->node.resType;
- if (dType->type == TSDB_DATA_TYPE_VALUE_ARRAY) {
- qDebug("VAL%d => [type:TS][val:[%" PRIi64 "] - [%" PRId64 "]]", i, *(int64_t *)field->data,
- *(((int64_t *)field->data) + 1));
- } else {
+ //if (dType->type == TSDB_DATA_TYPE_VALUE_ARRAY) {
+ // qDebug("VAL%d => [type:TS][val:[%" PRIi64 "] - [%" PRId64 "]]", i, *(int64_t *)field->data,
+ // *(((int64_t *)field->data) + 1));
+ //} else {
qDebug("VAL%d => [type:%d][val:%" PRIx64 "]", i, dType->type, var->datum.i); // TODO
- }
+ //}
} else if (field->data) {
qDebug("VAL%d => [type:NIL][val:NIL]", i); // TODO
}
@@ -4059,11 +4059,13 @@ bool filterExecute(SFilterInfo *info, SSDataBlock *pSrc, SColumnInfoData **p, SC
SArray *pList = taosArrayInit(1, POINTER_BYTES);
taosArrayPush(pList, &pSrc);
- FLT_ERR_RET(scalarCalculate(info->sclCtx.node, pList, &output));
- *p = output.columnData;
-
+ int32_t code = scalarCalculate(info->sclCtx.node, pList, &output);
taosArrayDestroy(pList);
+ FLT_ERR_RET(code);
+
+ *p = output.columnData;
+
if (output.numOfQualified == output.numOfRows) {
*pResultStatus = FILTER_RESULT_ALL_QUALIFIED;
} else if (output.numOfQualified == 0) {
diff --git a/source/libs/scalar/src/scalar.c b/source/libs/scalar/src/scalar.c
index 70d1bb2685..ea1ce175e3 100644
--- a/source/libs/scalar/src/scalar.c
+++ b/source/libs/scalar/src/scalar.c
@@ -896,6 +896,10 @@ int32_t sclExecCaseWhen(SCaseWhenNode *node, SScalarCtx *ctx, SScalarParam *outp
SCL_ERR_JRET(sclGetNodeRes(pWhenThen->pWhen, ctx, &pWhen));
SCL_ERR_JRET(sclGetNodeRes(pWhenThen->pThen, ctx, &pThen));
+ if (NULL == pWhen || NULL == pThen) {
+ sclError("invalid when/then in whenThen list");
+ SCL_ERR_JRET(TSDB_CODE_INVALID_PARA);
+ }
if (pCase) {
vectorCompare(pCase, pWhen, &comp, TSDB_ORDER_ASC, OP_TYPE_EQUAL);
diff --git a/source/libs/scheduler/src/schRemote.c b/source/libs/scheduler/src/schRemote.c
index d1d0680e65..47de2528fa 100644
--- a/source/libs/scheduler/src/schRemote.c
+++ b/source/libs/scheduler/src/schRemote.c
@@ -280,7 +280,7 @@ int32_t schHandleResponseMsg(SSchJob *pJob, SSchTask *pTask, int32_t execId, SDa
}
atomic_add_fetch_32(&pJob->resNumOfRows, rsp->affectedRows);
- SCH_TASK_DLOG("submit succeed, affectedRows:%d", rsp->affectedRows);
+ SCH_TASK_DLOG("submit succeed, affectedRows:%d, blocks:%d", rsp->affectedRows, rsp->nBlocks);
SCH_LOCK(SCH_WRITE, &pJob->resLock);
if (pJob->execRes.res) {
diff --git a/source/libs/stream/inc/streamInc.h b/source/libs/stream/inc/streamInc.h
index e9d4fbeaaa..6a3bdb59c9 100644
--- a/source/libs/stream/inc/streamInc.h
+++ b/source/libs/stream/inc/streamInc.h
@@ -43,6 +43,11 @@ int32_t streamBroadcastToChildren(SStreamTask* pTask, const SSDataBlock* pBlock)
int32_t tEncodeStreamRetrieveReq(SEncoder* pEncoder, const SStreamRetrieveReq* pReq);
+int32_t streamDispatchOneCheckReq(SStreamTask* pTask, const SStreamTaskCheckReq* pReq, int32_t nodeId, SEpSet* pEpSet);
+
+int32_t streamDispatchOneRecoverFinishReq(SStreamTask* pTask, const SStreamRecoverFinishReq* pReq, int32_t vgId,
+ SEpSet* pEpSet);
+
SStreamQueueItem* streamMergeQueueItem(SStreamQueueItem* dst, SStreamQueueItem* elem);
void streamFreeQitem(SStreamQueueItem* data);
diff --git a/source/libs/stream/src/stream.c b/source/libs/stream/src/stream.c
index ee317d0751..b71562cf45 100644
--- a/source/libs/stream/src/stream.c
+++ b/source/libs/stream/src/stream.c
@@ -135,8 +135,11 @@ int32_t streamTaskEnqueue(SStreamTask* pTask, const SStreamDispatchReq* pReq, SR
((SMsgHead*)buf)->vgId = htonl(pReq->upstreamNodeId);
SStreamDispatchRsp* pCont = POINTER_SHIFT(buf, sizeof(SMsgHead));
pCont->inputStatus = status;
- pCont->streamId = pReq->streamId;
- pCont->taskId = pReq->upstreamTaskId;
+ pCont->streamId = htobe64(pReq->streamId);
+ pCont->upstreamNodeId = htonl(pReq->upstreamNodeId);
+ pCont->upstreamTaskId = htonl(pReq->upstreamTaskId);
+ pCont->downstreamNodeId = htonl(pTask->nodeId);
+ pCont->downstreamTaskId = htonl(pTask->taskId);
pRsp->pCont = buf;
pRsp->contLen = sizeof(SMsgHead) + sizeof(SStreamDispatchRsp);
tmsgSendRsp(pRsp);
@@ -203,10 +206,10 @@ int32_t streamProcessDispatchReq(SStreamTask* pTask, SStreamDispatchReq* pReq, S
return 0;
}
-int32_t streamProcessDispatchRsp(SStreamTask* pTask, SStreamDispatchRsp* pRsp) {
+int32_t streamProcessDispatchRsp(SStreamTask* pTask, SStreamDispatchRsp* pRsp, int32_t code) {
ASSERT(pRsp->inputStatus == TASK_OUTPUT_STATUS__NORMAL || pRsp->inputStatus == TASK_OUTPUT_STATUS__BLOCKED);
- qDebug("task %d receive dispatch rsp", pTask->taskId);
+ qDebug("task %d receive dispatch rsp, code: %x", pTask->taskId, code);
if (pTask->outputType == TASK_OUTPUT__SHUFFLE_DISPATCH) {
int32_t leftRsp = atomic_sub_fetch_32(&pTask->shuffleDispatcher.waitingRspCnt, 1);
diff --git a/source/libs/stream/src/streamDispatch.c b/source/libs/stream/src/streamDispatch.c
index 417ddfa80d..ad342edfa0 100644
--- a/source/libs/stream/src/streamDispatch.c
+++ b/source/libs/stream/src/streamDispatch.c
@@ -210,6 +210,46 @@ static int32_t streamAddBlockToDispatchMsg(const SSDataBlock* pBlock, SStreamDis
return 0;
}
+int32_t streamDispatchOneCheckReq(SStreamTask* pTask, const SStreamTaskCheckReq* pReq, int32_t nodeId, SEpSet* pEpSet) {
+ void* buf = NULL;
+ int32_t code = -1;
+ SRpcMsg msg = {0};
+
+ int32_t tlen;
+ tEncodeSize(tEncodeSStreamTaskCheckReq, pReq, tlen, code);
+ if (code < 0) {
+ return -1;
+ }
+
+ buf = rpcMallocCont(sizeof(SMsgHead) + tlen);
+ if (buf == NULL) {
+ return -1;
+ }
+
+ ((SMsgHead*)buf)->vgId = htonl(nodeId);
+ void* abuf = POINTER_SHIFT(buf, sizeof(SMsgHead));
+
+ SEncoder encoder;
+ tEncoderInit(&encoder, abuf, tlen);
+ if ((code = tEncodeSStreamTaskCheckReq(&encoder, pReq)) < 0) {
+ goto FAIL;
+ }
+ tEncoderClear(&encoder);
+
+ msg.contLen = tlen + sizeof(SMsgHead);
+ msg.pCont = buf;
+ msg.msgType = TDMT_STREAM_TASK_CHECK;
+
+ qDebug("dispatch from task %d to task %d node %d: check msg", pTask->taskId, pReq->downstreamTaskId, nodeId);
+
+ tmsgSendReq(pEpSet, &msg);
+
+ return 0;
+FAIL:
+ if (buf) rpcFreeCont(buf);
+ return code;
+}
+
int32_t streamDispatchOneRecoverFinishReq(SStreamTask* pTask, const SStreamRecoverFinishReq* pReq, int32_t vgId,
SEpSet* pEpSet) {
void* buf = NULL;
@@ -239,18 +279,19 @@ int32_t streamDispatchOneRecoverFinishReq(SStreamTask* pTask, const SStreamRecov
msg.contLen = tlen + sizeof(SMsgHead);
msg.pCont = buf;
- msg.msgType = TDMT_VND_STREAM_RECOVER_FINISH;
+ msg.msgType = TDMT_STREAM_RECOVER_FINISH;
tmsgSendReq(pEpSet, &msg);
- code = 0;
+ qDebug("dispatch from task %d to task %d node %d: recover finish msg", pTask->taskId, pReq->taskId, vgId);
+
return 0;
FAIL:
if (buf) rpcFreeCont(buf);
return code;
}
-int32_t streamDispatchOneReq(SStreamTask* pTask, const SStreamDispatchReq* pReq, int32_t vgId, SEpSet* pEpSet) {
+int32_t streamDispatchOneDataReq(SStreamTask* pTask, const SStreamDispatchReq* pReq, int32_t vgId, SEpSet* pEpSet) {
void* buf = NULL;
int32_t code = -1;
SRpcMsg msg = {0};
@@ -279,7 +320,7 @@ int32_t streamDispatchOneReq(SStreamTask* pTask, const SStreamDispatchReq* pReq,
msg.pCont = buf;
msg.msgType = pTask->dispatchMsgType;
- qDebug("dispatch from task %d to task %d node %d", pTask->taskId, pReq->taskId, vgId);
+ qDebug("dispatch from task %d to task %d node %d: data msg", pTask->taskId, pReq->taskId, vgId);
tmsgSendReq(pEpSet, &msg);
@@ -292,13 +333,19 @@ FAIL:
int32_t streamSearchAndAddBlock(SStreamTask* pTask, SStreamDispatchReq* pReqs, SSDataBlock* pDataBlock, int32_t vgSz,
int64_t groupId) {
- char* ctbName;
+ char* ctbName = taosMemoryCalloc(1, TSDB_TABLE_FNAME_LEN);
+ if (ctbName == NULL) {
+ return -1;
+ }
+
if (pDataBlock->info.parTbName[0]) {
- ctbName = taosMemoryCalloc(1, TSDB_TABLE_NAME_LEN);
snprintf(ctbName, TSDB_TABLE_NAME_LEN, "%s.%s", pTask->shuffleDispatcher.dbInfo.db, pDataBlock->info.parTbName);
} else {
- ctbName = buildCtbNameByGroupId(pTask->shuffleDispatcher.stbFullName, groupId);
+ char* ctbShortName = buildCtbNameByGroupId(pTask->shuffleDispatcher.stbFullName, groupId);
+ snprintf(ctbName, TSDB_TABLE_NAME_LEN, "%s.%s", pTask->shuffleDispatcher.dbInfo.db, ctbShortName);
+ taosMemoryFree(ctbShortName);
}
+
SArray* vgInfo = pTask->shuffleDispatcher.dbInfo.pVgroupInfos;
/*uint32_t hashValue = MurmurHash3_32(ctbName, strlen(ctbName));*/
@@ -365,7 +412,7 @@ int32_t streamDispatchAllBlocks(SStreamTask* pTask, const SStreamDataBlock* pDat
qDebug("dispatch from task %d (child id %d) to down stream task %d in vnode %d", pTask->taskId, pTask->selfChildId,
downstreamTaskId, vgId);
- if (streamDispatchOneReq(pTask, &req, vgId, pEpSet) < 0) {
+ if (streamDispatchOneDataReq(pTask, &req, vgId, pEpSet) < 0) {
goto FAIL_FIXED_DISPATCH;
}
code = 0;
@@ -427,7 +474,7 @@ int32_t streamDispatchAllBlocks(SStreamTask* pTask, const SStreamDataBlock* pDat
if (pReqs[i].blockNum > 0) {
// send
SVgroupInfo* pVgInfo = taosArrayGet(vgInfo, i);
- if (streamDispatchOneReq(pTask, &pReqs[i], pVgInfo->vgId, &pVgInfo->epSet) < 0) {
+ if (streamDispatchOneDataReq(pTask, &pReqs[i], pVgInfo->vgId, &pVgInfo->epSet) < 0) {
goto FAIL_SHUFFLE_DISPATCH;
}
}
diff --git a/source/libs/stream/src/streamExec.c b/source/libs/stream/src/streamExec.c
index 6e37810004..46fab53659 100644
--- a/source/libs/stream/src/streamExec.c
+++ b/source/libs/stream/src/streamExec.c
@@ -90,6 +90,8 @@ int32_t streamScanExec(SStreamTask* pTask, int32_t batchSz) {
void* exec = pTask->exec.executor;
+ qSetStreamOpOpen(exec);
+
while (1) {
SArray* pRes = taosArrayInit(0, sizeof(SSDataBlock));
if (pRes == NULL) {
@@ -127,7 +129,10 @@ int32_t streamScanExec(SStreamTask* pTask, int32_t batchSz) {
qRes->type = STREAM_INPUT__DATA_BLOCK;
qRes->blocks = pRes;
streamTaskOutput(pTask, qRes);
- // TODO stream sched dispatch
+
+ if (pTask->outputType == TASK_OUTPUT__FIXED_DISPATCH || pTask->outputType == TASK_OUTPUT__SHUFFLE_DISPATCH) {
+ streamDispatch(pTask);
+ }
}
return 0;
}
@@ -197,83 +202,83 @@ int32_t streamPipelineExec(SStreamTask* pTask, int32_t batchNum, bool dispatch)
int32_t streamExecForAll(SStreamTask* pTask) {
while (1) {
int32_t batchCnt = 1;
- void* data = NULL;
+ void* input = NULL;
while (1) {
SStreamQueueItem* qItem = streamQueueNextItem(pTask->inputQueue);
if (qItem == NULL) {
qDebug("stream task exec over, queue empty, task: %d", pTask->taskId);
break;
}
- if (data == NULL) {
- data = qItem;
+ if (input == NULL) {
+ input = qItem;
streamQueueProcessSuccess(pTask->inputQueue);
if (pTask->taskLevel == TASK_LEVEL__SINK) {
break;
}
} else {
void* newRet;
- if ((newRet = streamMergeQueueItem(data, qItem)) == NULL) {
+ if ((newRet = streamMergeQueueItem(input, qItem)) == NULL) {
streamQueueProcessFail(pTask->inputQueue);
break;
} else {
batchCnt++;
- data = newRet;
+ input = newRet;
streamQueueProcessSuccess(pTask->inputQueue);
}
}
}
if (pTask->taskStatus == TASK_STATUS__DROPPING) {
- if (data) streamFreeQitem(data);
+ if (input) streamFreeQitem(input);
return 0;
}
- if (data == NULL) {
+ if (input == NULL) {
break;
}
if (pTask->taskLevel == TASK_LEVEL__SINK) {
- ASSERT(((SStreamQueueItem*)data)->type == STREAM_INPUT__DATA_BLOCK);
- streamTaskOutput(pTask, data);
+ ASSERT(((SStreamQueueItem*)input)->type == STREAM_INPUT__DATA_BLOCK);
+ streamTaskOutput(pTask, input);
continue;
}
SArray* pRes = taosArrayInit(0, sizeof(SSDataBlock));
qDebug("stream task %d exec begin, msg batch: %d", pTask->taskId, batchCnt);
- streamTaskExecImpl(pTask, data, pRes);
+ streamTaskExecImpl(pTask, input, pRes);
qDebug("stream task %d exec end", pTask->taskId);
if (taosArrayGetSize(pRes) != 0) {
SStreamDataBlock* qRes = taosAllocateQitem(sizeof(SStreamDataBlock), DEF_QITEM);
if (qRes == NULL) {
taosArrayDestroyEx(pRes, (FDelete)blockDataFreeRes);
- streamFreeQitem(data);
+ streamFreeQitem(input);
return -1;
}
qRes->type = STREAM_INPUT__DATA_BLOCK;
qRes->blocks = pRes;
- if (((SStreamQueueItem*)data)->type == STREAM_INPUT__DATA_SUBMIT) {
- SStreamDataSubmit* pSubmit = (SStreamDataSubmit*)data;
+ if (((SStreamQueueItem*)input)->type == STREAM_INPUT__DATA_SUBMIT) {
+ SStreamDataSubmit* pSubmit = (SStreamDataSubmit*)input;
qRes->childId = pTask->selfChildId;
qRes->sourceVer = pSubmit->ver;
- } else if (((SStreamQueueItem*)data)->type == STREAM_INPUT__MERGED_SUBMIT) {
- SStreamMergedSubmit* pMerged = (SStreamMergedSubmit*)data;
+ } else if (((SStreamQueueItem*)input)->type == STREAM_INPUT__MERGED_SUBMIT) {
+ SStreamMergedSubmit* pMerged = (SStreamMergedSubmit*)input;
qRes->childId = pTask->selfChildId;
qRes->sourceVer = pMerged->ver;
}
if (streamTaskOutput(pTask, qRes) < 0) {
taosArrayDestroyEx(pRes, (FDelete)blockDataFreeRes);
- streamFreeQitem(data);
+ streamFreeQitem(input);
taosFreeQitem(qRes);
return -1;
}
} else {
taosArrayDestroy(pRes);
}
- streamFreeQitem(data);
+ streamFreeQitem(input);
}
return 0;
}
diff --git a/source/libs/stream/src/streamRecover.c b/source/libs/stream/src/streamRecover.c
index 12de2fafc1..2a2784afea 100644
--- a/source/libs/stream/src/streamRecover.c
+++ b/source/libs/stream/src/streamRecover.c
@@ -15,6 +15,148 @@
#include "streamInc.h"
+int32_t streamTaskLaunchRecover(SStreamTask* pTask, int64_t version) {
+ qDebug("task %d at node %d launch recover", pTask->taskId, pTask->nodeId);
+ if (pTask->taskLevel == TASK_LEVEL__SOURCE) {
+ atomic_store_8(&pTask->taskStatus, TASK_STATUS__RECOVER_PREPARE);
+ streamSetParamForRecover(pTask);
+ streamSourceRecoverPrepareStep1(pTask, version);
+
+ SStreamRecoverStep1Req req;
+ streamBuildSourceRecover1Req(pTask, &req);
+ int32_t len = sizeof(SStreamRecoverStep1Req);
+
+ void* serializedReq = rpcMallocCont(len);
+ if (serializedReq == NULL) {
+ return -1;
+ }
+
+ memcpy(serializedReq, &req, len);
+
+ SRpcMsg rpcMsg = {
+ .contLen = len,
+ .pCont = serializedReq,
+ .msgType = TDMT_VND_STREAM_RECOVER_STEP1,
+ };
+
+ if (tmsgPutToQueue(pTask->pMsgCb, STREAM_QUEUE, &rpcMsg) < 0) {
+ /*ASSERT(0);*/
+ }
+
+ } else if (pTask->taskLevel == TASK_LEVEL__AGG) {
+ atomic_store_8(&pTask->taskStatus, TASK_STATUS__NORMAL);
+ streamSetParamForRecover(pTask);
+ streamAggRecoverPrepare(pTask);
+ } else if (pTask->taskLevel == TASK_LEVEL__SINK) {
+ atomic_store_8(&pTask->taskStatus, TASK_STATUS__NORMAL);
+ }
+ return 0;
+}
+
+// checkstatus
+int32_t streamTaskCheckDownstream(SStreamTask* pTask, int64_t version) {
+ SStreamTaskCheckReq req = {
+ .streamId = pTask->streamId,
+ .upstreamTaskId = pTask->taskId,
+ .upstreamNodeId = pTask->nodeId,
+ .childId = pTask->selfChildId,
+ };
+ // serialize
+ if (pTask->outputType == TASK_OUTPUT__FIXED_DISPATCH) {
+ req.reqId = tGenIdPI64();
+ req.downstreamNodeId = pTask->fixedEpDispatcher.nodeId;
+ req.downstreamTaskId = pTask->fixedEpDispatcher.taskId;
+ pTask->checkReqId = req.reqId;
+
+ qDebug("task %d at node %d check downstream task %d at node %d", pTask->taskId, pTask->nodeId, req.downstreamTaskId,
+ req.downstreamNodeId);
+ streamDispatchOneCheckReq(pTask, &req, pTask->fixedEpDispatcher.nodeId, &pTask->fixedEpDispatcher.epSet);
+ } else if (pTask->outputType == TASK_OUTPUT__SHUFFLE_DISPATCH) {
+ SArray* vgInfo = pTask->shuffleDispatcher.dbInfo.pVgroupInfos;
+ int32_t vgSz = taosArrayGetSize(vgInfo);
+ pTask->recoverTryingDownstream = vgSz;
+ pTask->checkReqIds = taosArrayInit(vgSz, sizeof(int64_t));
+
+ for (int32_t i = 0; i < vgSz; i++) {
+ SVgroupInfo* pVgInfo = taosArrayGet(vgInfo, i);
+ req.reqId = tGenIdPI64();
+ taosArrayPush(pTask->checkReqIds, &req.reqId);
+ req.downstreamNodeId = pVgInfo->vgId;
+ req.downstreamTaskId = pVgInfo->taskId;
+ qDebug("task %d at node %d check downstream task %d at node %d (shuffle)", pTask->taskId, pTask->nodeId,
+ req.downstreamTaskId, req.downstreamNodeId);
+ streamDispatchOneCheckReq(pTask, &req, pVgInfo->vgId, &pVgInfo->epSet);
+ }
+ } else {
+ qDebug("task %d at node %d direct launch recover since no downstream", pTask->taskId, pTask->nodeId);
+ streamTaskLaunchRecover(pTask, version);
+ }
+ return 0;
+}
+
+int32_t streamRecheckOneDownstream(SStreamTask* pTask, const SStreamTaskCheckRsp* pRsp) {
+ SStreamTaskCheckReq req = {
+ .reqId = pRsp->reqId,
+ .streamId = pRsp->streamId,
+ .upstreamTaskId = pRsp->upstreamTaskId,
+ .upstreamNodeId = pRsp->upstreamNodeId,
+ .downstreamTaskId = pRsp->downstreamTaskId,
+ .downstreamNodeId = pRsp->downstreamNodeId,
+ .childId = pRsp->childId,
+ };
+ qDebug("task %d at node %d check downstream task %d at node %d (recheck)", pTask->taskId, pTask->nodeId,
+ req.downstreamTaskId, req.downstreamNodeId);
+ if (pTask->outputType == TASK_OUTPUT__FIXED_DISPATCH) {
+ streamDispatchOneCheckReq(pTask, &req, pRsp->downstreamNodeId, &pTask->fixedEpDispatcher.epSet);
+ } else if (pTask->outputType == TASK_OUTPUT__SHUFFLE_DISPATCH) {
+ SArray* vgInfo = pTask->shuffleDispatcher.dbInfo.pVgroupInfos;
+ int32_t vgSz = taosArrayGetSize(vgInfo);
+ for (int32_t i = 0; i < vgSz; i++) {
+ SVgroupInfo* pVgInfo = taosArrayGet(vgInfo, i);
+ if (pVgInfo->taskId == req.downstreamTaskId) {
+ streamDispatchOneCheckReq(pTask, &req, pRsp->downstreamNodeId, &pVgInfo->epSet);
+ }
+ }
+ }
+ return 0;
+}
+
+int32_t streamProcessTaskCheckReq(SStreamTask* pTask, const SStreamTaskCheckReq* pReq) {
+ return atomic_load_8(&pTask->taskStatus) == TASK_STATUS__NORMAL;
+}
+
+int32_t streamProcessTaskCheckRsp(SStreamTask* pTask, const SStreamTaskCheckRsp* pRsp, int64_t version) {
+ qDebug("task %d at node %d recv check rsp from task %d at node %d: status %d", pRsp->upstreamTaskId,
+ pRsp->upstreamNodeId, pRsp->downstreamTaskId, pRsp->downstreamNodeId, pRsp->status);
+ if (pRsp->status == 1) {
+ if (pTask->outputType == TASK_OUTPUT__SHUFFLE_DISPATCH) {
+ bool found = false;
+ for (int32_t i = 0; i < taosArrayGetSize(pTask->checkReqIds); i++) {
+ int64_t reqId = *(int64_t*)taosArrayGet(pTask->checkReqIds, i);
+ if (reqId == pRsp->reqId) {
+ found = true;
+ break;
+ }
+ }
+ if (!found) return -1;
+ int32_t left = atomic_sub_fetch_32(&pTask->recoverTryingDownstream, 1);
+ ASSERT(left >= 0);
+ if (left == 0) {
+ taosArrayDestroy(pTask->checkReqIds);
+ streamTaskLaunchRecover(pTask, version);
+ }
+ } else if (pTask->outputType == TASK_OUTPUT__FIXED_DISPATCH) {
+ if (pRsp->reqId != pTask->checkReqId) return -1;
+ streamTaskLaunchRecover(pTask, version);
+ } else {
+ ASSERT(0);
+ }
+ } else {
+ streamRecheckOneDownstream(pTask, pRsp);
+ }
+ return 0;
+}
+
// common
int32_t streamSetParamForRecover(SStreamTask* pTask) {
void* exec = pTask->exec.executor;
@@ -36,6 +178,7 @@ int32_t streamSourceRecoverPrepareStep1(SStreamTask* pTask, int64_t ver) {
}
int32_t streamBuildSourceRecover1Req(SStreamTask* pTask, SStreamRecoverStep1Req* pReq) {
+ pReq->msgHead.vgId = pTask->nodeId;
pReq->streamId = pTask->streamId;
pReq->taskId = pTask->taskId;
return 0;
@@ -44,10 +187,10 @@ int32_t streamBuildSourceRecover1Req(SStreamTask* pTask, SStreamRecoverStep1Req*
int32_t streamSourceRecoverScanStep1(SStreamTask* pTask) {
//
return streamScanExec(pTask, 100);
- // TODO next: dispatch msg to launch scan step2
}
int32_t streamBuildSourceRecover2Req(SStreamTask* pTask, SStreamRecoverStep2Req* pReq) {
+ pReq->msgHead.vgId = pTask->nodeId;
pReq->streamId = pTask->streamId;
pReq->taskId = pTask->taskId;
return 0;
@@ -64,11 +207,20 @@ int32_t streamSourceRecoverScanStep2(SStreamTask* pTask, int64_t ver) {
int32_t streamDispatchRecoverFinishReq(SStreamTask* pTask) {
SStreamRecoverFinishReq req = {
.streamId = pTask->streamId,
- .taskId = pTask->taskId,
.childId = pTask->selfChildId,
};
+ // serialize
if (pTask->outputType == TASK_OUTPUT__FIXED_DISPATCH) {
+ req.taskId = pTask->fixedEpDispatcher.taskId;
+ streamDispatchOneRecoverFinishReq(pTask, &req, pTask->fixedEpDispatcher.nodeId, &pTask->fixedEpDispatcher.epSet);
} else if (pTask->outputType == TASK_OUTPUT__SHUFFLE_DISPATCH) {
+ SArray* vgInfo = pTask->shuffleDispatcher.dbInfo.pVgroupInfos;
+ int32_t vgSz = taosArrayGetSize(vgInfo);
+ for (int32_t i = 0; i < vgSz; i++) {
+ SVgroupInfo* pVgInfo = taosArrayGet(vgInfo, i);
+ req.taskId = pVgInfo->taskId;
+ streamDispatchOneRecoverFinishReq(pTask, &req, pVgInfo->vgId, &pVgInfo->epSet);
+ }
}
return 0;
}
@@ -76,10 +228,7 @@ int32_t streamDispatchRecoverFinishReq(SStreamTask* pTask) {
// agg
int32_t streamAggRecoverPrepare(SStreamTask* pTask) {
void* exec = pTask->exec.executor;
- if (qStreamSetParamForRecover(exec) < 0) {
- return -1;
- }
- pTask->recoverWaitingChild = taosArrayGetSize(pTask->childEpInfo);
+ pTask->recoverWaitingUpstream = taosArrayGetSize(pTask->childEpInfo);
return 0;
}
@@ -96,14 +245,70 @@ int32_t streamAggChildrenRecoverFinish(SStreamTask* pTask) {
}
int32_t streamProcessRecoverFinishReq(SStreamTask* pTask, int32_t childId) {
- int32_t left = atomic_sub_fetch_32(&pTask->recoverWaitingChild, 1);
- ASSERT(left >= 0);
- if (left == 0) {
- streamAggChildrenRecoverFinish(pTask);
+ if (pTask->taskLevel == TASK_LEVEL__AGG) {
+ int32_t left = atomic_sub_fetch_32(&pTask->recoverWaitingUpstream, 1);
+ ASSERT(left >= 0);
+ if (left == 0) {
+ streamAggChildrenRecoverFinish(pTask);
+ }
}
return 0;
}
+int32_t tEncodeSStreamTaskCheckReq(SEncoder* pEncoder, const SStreamTaskCheckReq* pReq) {
+ if (tStartEncode(pEncoder) < 0) return -1;
+ if (tEncodeI64(pEncoder, pReq->reqId) < 0) return -1;
+ if (tEncodeI64(pEncoder, pReq->streamId) < 0) return -1;
+ if (tEncodeI32(pEncoder, pReq->upstreamNodeId) < 0) return -1;
+ if (tEncodeI32(pEncoder, pReq->upstreamTaskId) < 0) return -1;
+ if (tEncodeI32(pEncoder, pReq->downstreamNodeId) < 0) return -1;
+ if (tEncodeI32(pEncoder, pReq->downstreamTaskId) < 0) return -1;
+ if (tEncodeI32(pEncoder, pReq->childId) < 0) return -1;
+ tEndEncode(pEncoder);
+ return pEncoder->pos;
+}
+
+int32_t tDecodeSStreamTaskCheckReq(SDecoder* pDecoder, SStreamTaskCheckReq* pReq) {
+ if (tStartDecode(pDecoder) < 0) return -1;
+ if (tDecodeI64(pDecoder, &pReq->reqId) < 0) return -1;
+ if (tDecodeI64(pDecoder, &pReq->streamId) < 0) return -1;
+ if (tDecodeI32(pDecoder, &pReq->upstreamNodeId) < 0) return -1;
+ if (tDecodeI32(pDecoder, &pReq->upstreamTaskId) < 0) return -1;
+ if (tDecodeI32(pDecoder, &pReq->downstreamNodeId) < 0) return -1;
+ if (tDecodeI32(pDecoder, &pReq->downstreamTaskId) < 0) return -1;
+ if (tDecodeI32(pDecoder, &pReq->childId) < 0) return -1;
+ tEndDecode(pDecoder);
+ return 0;
+}
+
+int32_t tEncodeSStreamTaskCheckRsp(SEncoder* pEncoder, const SStreamTaskCheckRsp* pRsp) {
+ if (tStartEncode(pEncoder) < 0) return -1;
+ if (tEncodeI64(pEncoder, pRsp->reqId) < 0) return -1;
+ if (tEncodeI64(pEncoder, pRsp->streamId) < 0) return -1;
+ if (tEncodeI32(pEncoder, pRsp->upstreamNodeId) < 0) return -1;
+ if (tEncodeI32(pEncoder, pRsp->upstreamTaskId) < 0) return -1;
+ if (tEncodeI32(pEncoder, pRsp->downstreamNodeId) < 0) return -1;
+ if (tEncodeI32(pEncoder, pRsp->downstreamTaskId) < 0) return -1;
+ if (tEncodeI32(pEncoder, pRsp->childId) < 0) return -1;
+ if (tEncodeI8(pEncoder, pRsp->status) < 0) return -1;
+ tEndEncode(pEncoder);
+ return pEncoder->pos;
+}
+
+int32_t tDecodeSStreamTaskCheckRsp(SDecoder* pDecoder, SStreamTaskCheckRsp* pRsp) {
+ if (tStartDecode(pDecoder) < 0) return -1;
+ if (tDecodeI64(pDecoder, &pRsp->reqId) < 0) return -1;
+ if (tDecodeI64(pDecoder, &pRsp->streamId) < 0) return -1;
+ if (tDecodeI32(pDecoder, &pRsp->upstreamNodeId) < 0) return -1;
+ if (tDecodeI32(pDecoder, &pRsp->upstreamTaskId) < 0) return -1;
+ if (tDecodeI32(pDecoder, &pRsp->downstreamNodeId) < 0) return -1;
+ if (tDecodeI32(pDecoder, &pRsp->downstreamTaskId) < 0) return -1;
+ if (tDecodeI32(pDecoder, &pRsp->childId) < 0) return -1;
+ if (tDecodeI8(pDecoder, &pRsp->status) < 0) return -1;
+ tEndDecode(pDecoder);
+ return 0;
+}
+
int32_t tEncodeSStreamRecoverFinishReq(SEncoder* pEncoder, const SStreamRecoverFinishReq* pReq) {
if (tStartEncode(pEncoder) < 0) return -1;
if (tEncodeI64(pEncoder, pReq->streamId) < 0) return -1;
@@ -120,79 +325,6 @@ int32_t tDecodeSStreamRecoverFinishReq(SDecoder* pDecoder, SStreamRecoverFinishR
tEndDecode(pDecoder);
return 0;
}
-#if 0
-int32_t tEncodeStreamTaskRecoverReq(SEncoder* pEncoder, const SStreamTaskRecoverReq* pReq) {
- if (tStartEncode(pEncoder) < 0) return -1;
- if (tEncodeI64(pEncoder, pReq->streamId) < 0) return -1;
- if (tEncodeI32(pEncoder, pReq->taskId) < 0) return -1;
- if (tEncodeI32(pEncoder, pReq->upstreamTaskId) < 0) return -1;
- if (tEncodeI32(pEncoder, pReq->upstreamNodeId) < 0) return -1;
- tEndEncode(pEncoder);
- return pEncoder->pos;
-}
-
-int32_t tDecodeStreamTaskRecoverReq(SDecoder* pDecoder, SStreamTaskRecoverReq* pReq) {
- if (tStartDecode(pDecoder) < 0) return -1;
- if (tDecodeI64(pDecoder, &pReq->streamId) < 0) return -1;
- if (tDecodeI32(pDecoder, &pReq->taskId) < 0) return -1;
- if (tDecodeI32(pDecoder, &pReq->upstreamTaskId) < 0) return -1;
- if (tDecodeI32(pDecoder, &pReq->upstreamNodeId) < 0) return -1;
- tEndDecode(pDecoder);
- return 0;
-}
-
-int32_t tEncodeStreamTaskRecoverRsp(SEncoder* pEncoder, const SStreamTaskRecoverRsp* pRsp) {
- if (tStartEncode(pEncoder) < 0) return -1;
- if (tEncodeI64(pEncoder, pRsp->streamId) < 0) return -1;
- if (tEncodeI32(pEncoder, pRsp->reqTaskId) < 0) return -1;
- if (tEncodeI32(pEncoder, pRsp->rspTaskId) < 0) return -1;
- if (tEncodeI8(pEncoder, pRsp->inputStatus) < 0) return -1;
- tEndEncode(pEncoder);
- return pEncoder->pos;
-}
-
-int32_t tDecodeStreamTaskRecoverRsp(SDecoder* pDecoder, SStreamTaskRecoverRsp* pReq) {
- if (tStartDecode(pDecoder) < 0) return -1;
- if (tDecodeI64(pDecoder, &pReq->streamId) < 0) return -1;
- if (tDecodeI32(pDecoder, &pReq->reqTaskId) < 0) return -1;
- if (tDecodeI32(pDecoder, &pReq->rspTaskId) < 0) return -1;
- if (tDecodeI8(pDecoder, &pReq->inputStatus) < 0) return -1;
- tEndDecode(pDecoder);
- return 0;
-}
-
-int32_t tEncodeSMStreamTaskRecoverReq(SEncoder* pEncoder, const SMStreamTaskRecoverReq* pReq) {
- if (tStartEncode(pEncoder) < 0) return -1;
- if (tEncodeI64(pEncoder, pReq->streamId) < 0) return -1;
- if (tEncodeI32(pEncoder, pReq->taskId) < 0) return -1;
- tEndEncode(pEncoder);
- return pEncoder->pos;
-}
-
-int32_t tDecodeSMStreamTaskRecoverReq(SDecoder* pDecoder, SMStreamTaskRecoverReq* pReq) {
- if (tStartDecode(pDecoder) < 0) return -1;
- if (tDecodeI64(pDecoder, &pReq->streamId) < 0) return -1;
- if (tDecodeI32(pDecoder, &pReq->taskId) < 0) return -1;
- tEndDecode(pDecoder);
- return 0;
-}
-
-int32_t tEncodeSMStreamTaskRecoverRsp(SEncoder* pEncoder, const SMStreamTaskRecoverRsp* pRsp) {
- if (tStartEncode(pEncoder) < 0) return -1;
- if (tEncodeI64(pEncoder, pRsp->streamId) < 0) return -1;
- if (tEncodeI32(pEncoder, pRsp->taskId) < 0) return -1;
- tEndEncode(pEncoder);
- return pEncoder->pos;
-}
-
-int32_t tDecodeSMStreamTaskRecoverRsp(SDecoder* pDecoder, SMStreamTaskRecoverRsp* pReq) {
- if (tStartDecode(pDecoder) < 0) return -1;
- if (tDecodeI64(pDecoder, &pReq->streamId) < 0) return -1;
- if (tDecodeI32(pDecoder, &pReq->taskId) < 0) return -1;
- tEndDecode(pDecoder);
- return 0;
-}
-#endif
int32_t tEncodeSStreamCheckpointInfo(SEncoder* pEncoder, const SStreamCheckpointInfo* pCheckpoint) {
if (tEncodeI32(pEncoder, pCheckpoint->srcNodeId) < 0) return -1;
@@ -236,308 +368,3 @@ int32_t tDecodeSStreamMultiVgCheckpointInfo(SDecoder* pDecoder, SStreamMultiVgCh
}
return 0;
}
-
-#if 0
-int32_t tEncodeSStreamTaskRecoverReq(SEncoder* pEncoder, const SStreamRecoverDownstreamReq* pReq) {
- if (tEncodeI64(pEncoder, pReq->streamId) < 0) return -1;
- if (tEncodeI32(pEncoder, pReq->downstreamTaskId) < 0) return -1;
- if (tEncodeI32(pEncoder, pReq->taskId) < 0) return -1;
- return 0;
-}
-
-int32_t tDecodeSStreamTaskRecoverReq(SDecoder* pDecoder, SStreamRecoverDownstreamReq* pReq) {
- if (tDecodeI64(pDecoder, &pReq->streamId) < 0) return -1;
- if (tDecodeI32(pDecoder, &pReq->downstreamTaskId) < 0) return -1;
- if (tDecodeI32(pDecoder, &pReq->taskId) < 0) return -1;
- return 0;
-}
-
-int32_t tEncodeSStreamTaskRecoverRsp(SEncoder* pEncoder, const SStreamRecoverDownstreamRsp* pRsp) {
- if (tEncodeI64(pEncoder, pRsp->streamId) < 0) return -1;
- if (tEncodeI32(pEncoder, pRsp->downstreamTaskId) < 0) return -1;
- if (tEncodeI32(pEncoder, pRsp->taskId) < 0) return -1;
- int32_t sz = taosArrayGetSize(pRsp->checkpointVer);
- if (tEncodeI32(pEncoder, sz) < 0) return -1;
- for (int32_t i = 0; i < sz; i++) {
- SStreamCheckpointInfo* pInfo = taosArrayGet(pRsp->checkpointVer, i);
- if (tEncodeSStreamCheckpointInfo(pEncoder, pInfo) < 0) return -1;
- }
- return 0;
-}
-
-int32_t tDecodeSStreamTaskRecoverRsp(SDecoder* pDecoder, SStreamRecoverDownstreamRsp* pRsp) {
- if (tDecodeI64(pDecoder, &pRsp->streamId) < 0) return -1;
- if (tDecodeI32(pDecoder, &pRsp->downstreamTaskId) < 0) return -1;
- if (tDecodeI32(pDecoder, &pRsp->taskId) < 0) return -1;
- int32_t sz;
- if (tDecodeI32(pDecoder, &sz) < 0) return -1;
- pRsp->checkpointVer = taosArrayInit(sz, sizeof(SStreamCheckpointInfo));
- if (pRsp->checkpointVer == NULL) return -1;
- for (int32_t i = 0; i < sz; i++) {
- SStreamCheckpointInfo info;
- if (tDecodeSStreamCheckpointInfo(pDecoder, &info) < 0) return -1;
- taosArrayPush(pRsp->checkpointVer, &info);
- }
- return 0;
-}
-#endif
-
-int32_t streamSaveStateInfo(SStreamMeta* pMeta, SStreamTask* pTask) {
-#if 0
- void* buf = NULL;
-
- ASSERT(pTask->taskLevel == TASK_LEVEL__SINK);
-
- SStreamMultiVgCheckpointInfo checkpoint;
- checkpoint.checkpointId = atomic_fetch_add_32(&pTask->nextCheckId, 1);
- checkpoint.checkTs = taosGetTimestampMs();
- checkpoint.streamId = pTask->streamId;
- checkpoint.taskId = pTask->taskId;
- checkpoint.checkpointVer = pTask->checkpointInfo;
-
- int32_t len;
- int32_t code;
- tEncodeSize(tEncodeSStreamMultiVgCheckpointInfo, &checkpoint, len, code);
- if (code < 0) {
- return -1;
- }
-
- buf = taosMemoryCalloc(1, len);
- if (buf == NULL) {
- return -1;
- }
- SEncoder encoder;
- tEncoderInit(&encoder, buf, len);
- tEncodeSStreamMultiVgCheckpointInfo(&encoder, &checkpoint);
- tEncoderClear(&encoder);
-
- SStreamCheckpointKey key = {
- .taskId = pTask->taskId,
- .checkpointId = checkpoint.checkpointId,
- };
-
- if (tdbTbUpsert(pMeta->pStateDb, &key, sizeof(SStreamCheckpointKey), buf, len, &pMeta->txn) < 0) {
- ASSERT(0);
- goto FAIL;
- }
-
- int32_t sz = taosArrayGetSize(pTask->checkpointInfo);
- for (int32_t i = 0; i < sz; i++) {
- SStreamCheckpointInfo* pCheck = taosArrayGet(pTask->checkpointInfo, i);
- pCheck->stateSaveVer = pCheck->stateProcessedVer;
- }
-
- taosMemoryFree(buf);
- return 0;
-FAIL:
- if (buf) taosMemoryFree(buf);
- return -1;
-#endif
- return 0;
-}
-
-int32_t streamLoadStateInfo(SStreamMeta* pMeta, SStreamTask* pTask) {
-#if 0
- void* pVal = NULL;
- int32_t vLen = 0;
- if (tdbTbGet(pMeta->pStateDb, &pTask->taskId, sizeof(void*), &pVal, &vLen) < 0) {
- return -1;
- }
- SDecoder decoder;
- tDecoderInit(&decoder, pVal, vLen);
- SStreamMultiVgCheckpointInfo aggCheckpoint;
- tDecodeSStreamMultiVgCheckpointInfo(&decoder, &aggCheckpoint);
- tDecoderClear(&decoder);
-
- pTask->nextCheckId = aggCheckpoint.checkpointId + 1;
- pTask->checkpointInfo = aggCheckpoint.checkpointVer;
-#endif
- return 0;
-}
-
-int32_t streamSaveSinkLevel(SStreamMeta* pMeta, SStreamTask* pTask) {
- ASSERT(pTask->taskLevel == TASK_LEVEL__SINK);
- return streamSaveStateInfo(pMeta, pTask);
-}
-
-int32_t streamRecoverSinkLevel(SStreamMeta* pMeta, SStreamTask* pTask) {
- ASSERT(pTask->taskLevel == TASK_LEVEL__SINK);
- return streamLoadStateInfo(pMeta, pTask);
-}
-
-int32_t streamSaveAggLevel(SStreamMeta* pMeta, SStreamTask* pTask) {
- ASSERT(pTask->taskLevel == TASK_LEVEL__AGG);
- // TODO save and copy state
-
- // save state info
- if (streamSaveStateInfo(pMeta, pTask) < 0) {
- return -1;
- }
- return 0;
-}
-
-#if 0
-int32_t streamFetchRecoverStatus(SStreamTask* pTask, const SVgroupInfo* pVgInfo) {
- int32_t taskId = pVgInfo->taskId;
- int32_t nodeId = pVgInfo->vgId;
- SStreamRecoverDownstreamReq req = {
- .streamId = pTask->taskId,
- .downstreamTaskId = taskId,
- .taskId = pTask->taskId,
- };
- int32_t tlen;
- int32_t code;
- tEncodeSize(tEncodeSStreamTaskRecoverReq, &req, tlen, code);
- if (code < 0) {
- return -1;
- }
- void* buf = taosMemoryCalloc(1, sizeof(SMsgHead) + tlen);
- if (buf == NULL) {
- return -1;
- }
- void* abuf = POINTER_SHIFT(buf, sizeof(SMsgHead));
- SEncoder encoder;
- tEncoderInit(&encoder, abuf, tlen);
- if (tEncodeSStreamTaskRecoverReq(&encoder, &req) < 0) {
- tEncoderClear(&encoder);
- taosMemoryFree(buf);
- return -1;
- }
- tEncoderClear(&encoder);
-
- ((SMsgHead*)buf)->vgId = htonl(nodeId);
- SRpcMsg msg = {
- .pCont = buf, .contLen = sizeof(SMsgHead) + tlen,
- /*.msgType = */
- };
- tmsgSendReq(&pVgInfo->epSet, &msg);
-
- return 0;
-}
-
-int32_t streamFetchDownstreamStatus(SStreamMeta* pMeta, SStreamTask* pTask) {
- // set self status to recover_phase1
- SStreamRecoverStatus* pRecover;
- atomic_store_8(&pTask->taskStatus, TASK_STATUS__RECOVER_DOWNSTREAM);
- pRecover = taosHashGet(pMeta->pRecoverStatus, &pTask->taskId, sizeof(int32_t));
- if (pRecover == NULL) {
- pRecover = taosMemoryCalloc(1, sizeof(SStreamRecoverStatus));
- if (pRecover == NULL) {
- return -1;
- }
- pRecover->info = taosArrayInit(0, sizeof(void*));
- if (pRecover->info == NULL) {
- taosMemoryFree(pRecover);
- return -1;
- }
- taosHashPut(pMeta->pRecoverStatus, &pTask->taskId, sizeof(int32_t), &pRecover, sizeof(void*));
- }
-
- if (pTask->outputType == TASK_OUTPUT__FIXED_DISPATCH) {
- pRecover->totReq = 1;
- } else if (pTask->outputType == TASK_OUTPUT__SHUFFLE_DISPATCH) {
- int32_t numOfDownstream = taosArrayGetSize(pTask->shuffleDispatcher.dbInfo.pVgroupInfos);
- pRecover->totReq = numOfDownstream;
- for (int32_t i = 0; i < numOfDownstream; i++) {
- SVgroupInfo* pVgInfo = taosArrayGet(pTask->shuffleDispatcher.dbInfo.pVgroupInfos, i);
- streamFetchRecoverStatus(pTask, pVgInfo);
- }
- } else {
- ASSERT(0);
- }
- return 0;
-}
-#endif
-
-#if 0
-int32_t streamProcessFetchStatusRsp(SStreamMeta* pMeta, SStreamTask* pTask, SStreamRecoverDownstreamRsp* pRsp) {
- // if failed, set timer and retry
- // if successful
- int32_t taskId = pTask->taskId;
- SStreamRecoverStatus* pRecover = taosHashGet(pMeta->pRecoverStatus, &taskId, sizeof(int32_t));
- if (pRecover == NULL) {
- return -1;
- }
-
- taosArrayPush(pRecover->info, &pRsp->checkpointVer);
-
- int32_t leftRsp = atomic_sub_fetch_32(&pRecover->waitingRspCnt, 1);
- ASSERT(leftRsp >= 0);
-
- if (leftRsp == 0) {
- ASSERT(taosArrayGetSize(pRecover->info) == pRecover->totReq);
-
- // srcNodeId -> SStreamCheckpointInfo*
- SHashObj* pFinalChecks = taosHashInit(64, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT), false, HASH_NO_LOCK);
- if (pFinalChecks == NULL) return -1;
-
- for (int32_t i = 0; i < pRecover->totReq; i++) {
- SArray* pChecks = taosArrayGetP(pRecover->info, i);
- int32_t sz = taosArrayGetSize(pChecks);
- for (int32_t j = 0; j < sz; j++) {
- SStreamCheckpointInfo* pOneCheck = taosArrayGet(pChecks, j);
- SStreamCheckpointInfo* pCheck = taosHashGet(pFinalChecks, &pOneCheck->srcNodeId, sizeof(int32_t));
- if (pCheck == NULL) {
- pCheck = taosMemoryCalloc(1, sizeof(SStreamCheckpointInfo));
- pCheck->srcNodeId = pOneCheck->srcNodeId;
- pCheck->srcChildId = pOneCheck->srcChildId;
- pCheck->stateProcessedVer = pOneCheck->stateProcessedVer;
- taosHashPut(pFinalChecks, &pCheck->srcNodeId, sizeof(int32_t), &pCheck, sizeof(void*));
- } else {
- pCheck->stateProcessedVer = TMIN(pCheck->stateProcessedVer, pOneCheck->stateProcessedVer);
- }
- }
- }
- // load local state
- //
- // recover
- //
- if (pTask->taskLevel == TASK_LEVEL__SOURCE) {
- qStreamPrepareRecover(pTask->exec.executor, pTask->startVer, pTask->recoverSnapVer);
- if (streamPipelineExec(pTask, 10000, true) < 0) {
- return -1;
- }
- }
- taosHashCleanup(pFinalChecks);
- taosHashRemove(pMeta->pRecoverStatus, &taskId, sizeof(int32_t));
- atomic_store_8(&pTask->taskStatus, TASK_STATUS__NORMAL);
- }
- return 0;
-}
-
-int32_t streamRecoverAggLevel(SStreamMeta* pMeta, SStreamTask* pTask) {
- ASSERT(pTask->taskLevel == TASK_LEVEL__AGG);
- // recover sink level
- // after all sink level recovered
- // choose suitable state to recover
- return 0;
-}
-
-int32_t streamSaveSourceLevel(SStreamMeta* pMeta, SStreamTask* pTask) {
- ASSERT(pTask->taskLevel == TASK_LEVEL__SOURCE);
- // TODO: save and copy state
- return 0;
-}
-
-int32_t streamRecoverSourceLevel(SStreamMeta* pMeta, SStreamTask* pTask) {
- ASSERT(pTask->taskLevel == TASK_LEVEL__SOURCE);
- // if totLevel == 3
- // fetch agg state
- // recover from local state to agg state, not send msg
- // recover from agg state to most recent log v1
- // enable input queue, set status recover_phase2
- // recover from v1 to queue msg v2, set status normal
-
- // if totLevel == 2
- // fetch sink state
- // recover from local state to sink state v1, send msg
- // enable input queue, set status recover_phase2
- // recover from v1 to queue msg v2, set status normal
- return 0;
-}
-
-int32_t streamRecoverTask(SStreamTask* pTask) {
- //
- return 0;
-}
-#endif
diff --git a/source/libs/sync/inc/syncEnv.h b/source/libs/sync/inc/syncEnv.h
index 06da0eb3df..cf4e3309f1 100644
--- a/source/libs/sync/inc/syncEnv.h
+++ b/source/libs/sync/inc/syncEnv.h
@@ -20,13 +20,7 @@
extern "C" {
#endif
-#include
-#include
-#include
#include "syncInt.h"
-#include "taosdef.h"
-#include "trpc.h"
-#include "ttimer.h"
#define TIMER_MAX_MS 0x7FFFFFFF
#define ENV_TICK_TIMER_MS 1000
@@ -57,12 +51,13 @@ typedef struct SSyncEnv {
} SSyncEnv;
-extern SSyncEnv* gSyncEnv;
+SSyncEnv* syncEnv();
+bool syncIsInit();
-int32_t syncEnvStart();
-int32_t syncEnvStop();
-int32_t syncEnvStartTimer();
-int32_t syncEnvStopTimer();
+int64_t syncNodeAdd(SSyncNode* pNode);
+void syncNodeRemove(int64_t rid);
+SSyncNode* syncNodeAcquire(int64_t rid);
+void syncNodeRelease(SSyncNode* pNode);
#ifdef __cplusplus
}
diff --git a/source/libs/sync/inc/syncInt.h b/source/libs/sync/inc/syncInt.h
index ae053328ab..a5ff653b69 100644
--- a/source/libs/sync/inc/syncInt.h
+++ b/source/libs/sync/inc/syncInt.h
@@ -22,7 +22,9 @@ extern "C" {
#include "sync.h"
#include "syncTools.h"
+#include "taosdef.h"
#include "tlog.h"
+#include "trpc.h"
#include "ttimer.h"
// clang-format off
@@ -105,9 +107,9 @@ typedef struct SSyncNode {
// sync io
SWal* pWal;
const SMsgCb* msgcb;
- int32_t (*FpSendMsg)(const SEpSet* pEpSet, SRpcMsg* pMsg);
- int32_t (*FpEqMsg)(const SMsgCb* msgcb, SRpcMsg* pMsg);
- int32_t (*FpEqCtrlMsg)(const SMsgCb* msgcb, SRpcMsg* pMsg);
+ int32_t (*syncSendMSg)(const SEpSet* pEpSet, SRpcMsg* pMsg);
+ int32_t (*syncEqMsg)(const SMsgCb* msgcb, SRpcMsg* pMsg);
+ int32_t (*syncEqCtrlMsg)(const SMsgCb* msgcb, SRpcMsg* pMsg);
// init internal
SNodeInfo myNodeInfo;
@@ -216,6 +218,7 @@ SSyncNode* syncNodeOpen(SSyncInfo* pSyncInfo);
void syncNodeStart(SSyncNode* pSyncNode);
void syncNodeStartStandBy(SSyncNode* pSyncNode);
void syncNodeClose(SSyncNode* pSyncNode);
+void syncNodePreClose(SSyncNode* pSyncNode);
int32_t syncNodePropose(SSyncNode* pSyncNode, SRpcMsg* pMsg, bool isWeak);
// option
@@ -255,9 +258,6 @@ void syncNodeDoConfigChange(SSyncNode* pSyncNode, SSyncCfg* newConfig, Sync
SyncIndex syncMinMatchIndex(SSyncNode* pSyncNode);
char* syncNodePeerState2Str(const SSyncNode* pSyncNode);
-SSyncNode* syncNodeAcquire(int64_t rid);
-void syncNodeRelease(SSyncNode* pNode);
-
// raft state change --------------
void syncNodeUpdateTerm(SSyncNode* pSyncNode, SyncTerm term);
void syncNodeUpdateTermWithoutStepDown(SSyncNode* pSyncNode, SyncTerm term);
@@ -302,11 +302,7 @@ bool syncNodeNeedSendAppendEntries(SSyncNode* ths, const SRaftId* pDestId, const
int32_t syncGetSnapshotMeta(int64_t rid, struct SSnapshotMeta* sMeta);
int32_t syncGetSnapshotMetaByIndex(int64_t rid, SyncIndex snapshotIndex, struct SSnapshotMeta* sMeta);
-void syncStartNormal(int64_t rid);
-void syncStartStandBy(int64_t rid);
-
bool syncNodeCanChange(SSyncNode* pSyncNode);
-bool syncNodeCheckNewConfig(SSyncNode* pSyncNode, const SSyncCfg* pNewCfg);
int32_t syncNodeLeaderTransfer(SSyncNode* pSyncNode);
int32_t syncNodeLeaderTransferTo(SSyncNode* pSyncNode, SNodeInfo newLeader);
@@ -319,6 +315,7 @@ int32_t syncNodePeerStateInit(SSyncNode* pSyncNode);
// trace log
void syncLogRecvTimer(SSyncNode* pSyncNode, const SyncTimeout* pMsg, const char* s);
+void syncLogRecvLocalCmd(SSyncNode* pSyncNode, const SyncLocalCmd* pMsg, const char* s);
void syncLogSendRequestVote(SSyncNode* pSyncNode, const SyncRequestVote* pMsg, const char* s);
void syncLogRecvRequestVote(SSyncNode* pSyncNode, const SyncRequestVote* pMsg, const char* s);
@@ -341,6 +338,18 @@ void syncLogRecvHeartbeat(SSyncNode* pSyncNode, const SyncHeartbeat* pMsg, const
void syncLogSendHeartbeatReply(SSyncNode* pSyncNode, const SyncHeartbeatReply* pMsg, const char* s);
void syncLogRecvHeartbeatReply(SSyncNode* pSyncNode, const SyncHeartbeatReply* pMsg, const char* s);
+void syncLogSendSyncPreSnapshot(SSyncNode* pSyncNode, const SyncPreSnapshot* pMsg, const char* s);
+void syncLogRecvSyncPreSnapshot(SSyncNode* pSyncNode, const SyncPreSnapshot* pMsg, const char* s);
+
+void syncLogSendSyncPreSnapshotReply(SSyncNode* pSyncNode, const SyncPreSnapshotReply* pMsg, const char* s);
+void syncLogRecvSyncPreSnapshotReply(SSyncNode* pSyncNode, const SyncPreSnapshotReply* pMsg, const char* s);
+
+void syncLogSendSyncSnapshotSend(SSyncNode* pSyncNode, const SyncSnapshotSend* pMsg, const char* s);
+void syncLogRecvSyncSnapshotSend(SSyncNode* pSyncNode, const SyncSnapshotSend* pMsg, const char* s);
+
+void syncLogSendSyncSnapshotRsp(SSyncNode* pSyncNode, const SyncSnapshotRsp* pMsg, const char* s);
+void syncLogRecvSyncSnapshotRsp(SSyncNode* pSyncNode, const SyncSnapshotRsp* pMsg, const char* s);
+
// for debug --------------
void syncNodePrint(SSyncNode* pObj);
void syncNodePrint2(char* s, SSyncNode* pObj);
diff --git a/source/libs/sync/inc/syncSnapshot.h b/source/libs/sync/inc/syncSnapshot.h
index b8b7af2dda..760fc8ac73 100644
--- a/source/libs/sync/inc/syncSnapshot.h
+++ b/source/libs/sync/inc/syncSnapshot.h
@@ -28,10 +28,11 @@ extern "C" {
#include "syncMessage.h"
#include "taosdef.h"
-#define SYNC_SNAPSHOT_SEQ_INVALID -1
-#define SYNC_SNAPSHOT_SEQ_FORCE_CLOSE -2
-#define SYNC_SNAPSHOT_SEQ_BEGIN 0
-#define SYNC_SNAPSHOT_SEQ_END 0x7FFFFFFF
+#define SYNC_SNAPSHOT_SEQ_INVALID -2
+#define SYNC_SNAPSHOT_SEQ_FORCE_CLOSE -3
+#define SYNC_SNAPSHOT_SEQ_PRE_SNAPSHOT -1
+#define SYNC_SNAPSHOT_SEQ_BEGIN 0
+#define SYNC_SNAPSHOT_SEQ_END 0x7FFFFFFF
#define SYNC_SNAPSHOT_RETRY_MS 5000
@@ -47,19 +48,19 @@ typedef struct SSyncSnapshotSender {
SSnapshot snapshot;
SSyncCfg lastConfig;
int64_t sendingMS;
- SSyncNode *pSyncNode;
- int32_t replicaIndex;
SyncTerm term;
- SyncTerm privateTerm;
int64_t startTime;
bool finish;
+
+ // init when create
+ SSyncNode *pSyncNode;
+ int32_t replicaIndex;
} SSyncSnapshotSender;
SSyncSnapshotSender *snapshotSenderCreate(SSyncNode *pSyncNode, int32_t replicaIndex);
void snapshotSenderDestroy(SSyncSnapshotSender *pSender);
bool snapshotSenderIsStart(SSyncSnapshotSender *pSender);
-int32_t snapshotSenderStart(SSyncSnapshotSender *pSender, SSnapshotParam snapshotParam, SSnapshot snapshot,
- void *pReader);
+int32_t snapshotSenderStart(SSyncSnapshotSender *pSender);
int32_t snapshotSenderStop(SSyncSnapshotSender *pSender, bool finish);
int32_t snapshotSend(SSyncSnapshotSender *pSender);
int32_t snapshotReSend(SSyncSnapshotSender *pSender);
@@ -76,11 +77,13 @@ typedef struct SSyncSnapshotReceiver {
int32_t ack;
void *pWriter;
SyncTerm term;
- SyncTerm privateTerm;
SSnapshotParam snapshotParam;
SSnapshot snapshot;
SRaftId fromId;
- SSyncNode *pSyncNode;
+ int64_t startTime;
+
+ // init when create
+ SSyncNode *pSyncNode;
} SSyncSnapshotReceiver;
diff --git a/include/libs/sync/syncTools.h b/source/libs/sync/inc/syncTools.h
similarity index 90%
rename from include/libs/sync/syncTools.h
rename to source/libs/sync/inc/syncTools.h
index eedc403493..2d87fcf7fa 100644
--- a/include/libs/sync/syncTools.h
+++ b/source/libs/sync/inc/syncTools.h
@@ -20,34 +20,17 @@
extern "C" {
#endif
-#include "trpc.h"
-
// ------------------ ds -------------------
typedef struct SRaftId {
SyncNodeId addr;
SyncGroupId vgId;
} SRaftId;
-// ------------------ control -------------------
-SSyncNode* syncNodeAcquire(int64_t rid);
-void syncNodeRelease(SSyncNode* pNode);
-
-int32_t syncGetRespRpc(int64_t rid, uint64_t index, SRpcMsg* msg);
-int32_t syncGetAndDelRespRpc(int64_t rid, uint64_t index, SRpcHandleInfo* pInfo);
-void syncSetMsgCb(int64_t rid, const SMsgCb* msgcb);
-char* sync2SimpleStr(int64_t rid);
-
-// set timer ms
-void setPingTimerMS(int64_t rid, int32_t pingTimerMS);
-void setElectTimerMS(int64_t rid, int32_t electTimerMS);
-void setHeartbeatTimerMS(int64_t rid, int32_t hbTimerMS);
+char* sync2SimpleStr(int64_t rid);
// for compatibility, the same as syncPropose
int32_t syncForwardToPeer(int64_t rid, SRpcMsg* pMsg, bool isWeak);
-// utils
-const char* syncUtilState2String(ESyncState state);
-
// ------------------ for debug -------------------
void syncRpcMsgPrint(SRpcMsg* pMsg);
void syncRpcMsgPrint2(char* s, SRpcMsg* pMsg);
@@ -513,6 +496,69 @@ void syncHeartbeatReplyPrint2(char* s, const SyncHeartbeatReply* pMsg);
void syncHeartbeatReplyLog(const SyncHeartbeatReply* pMsg);
void syncHeartbeatReplyLog2(char* s, const SyncHeartbeatReply* pMsg);
+// ---------------------------------------------
+typedef struct SyncPreSnapshot {
+ uint32_t bytes;
+ int32_t vgId;
+ uint32_t msgType;
+ SRaftId srcId;
+ SRaftId destId;
+
+ // private data
+ SyncTerm term;
+
+} SyncPreSnapshot;
+
+SyncPreSnapshot* syncPreSnapshotBuild(int32_t vgId);
+void syncPreSnapshotDestroy(SyncPreSnapshot* pMsg);
+void syncPreSnapshotSerialize(const SyncPreSnapshot* pMsg, char* buf, uint32_t bufLen);
+void syncPreSnapshotDeserialize(const char* buf, uint32_t len, SyncPreSnapshot* pMsg);
+char* syncPreSnapshotSerialize2(const SyncPreSnapshot* pMsg, uint32_t* len);
+SyncPreSnapshot* syncPreSnapshotDeserialize2(const char* buf, uint32_t len);
+void syncPreSnapshot2RpcMsg(const SyncPreSnapshot* pMsg, SRpcMsg* pRpcMsg);
+void syncPreSnapshotFromRpcMsg(const SRpcMsg* pRpcMsg, SyncPreSnapshot* pMsg);
+SyncPreSnapshot* syncPreSnapshotFromRpcMsg2(const SRpcMsg* pRpcMsg);
+cJSON* syncPreSnapshot2Json(const SyncPreSnapshot* pMsg);
+char* syncPreSnapshot2Str(const SyncPreSnapshot* pMsg);
+
+// for debug ----------------------
+void syncPreSnapshotPrint(const SyncPreSnapshot* pMsg);
+void syncPreSnapshotPrint2(char* s, const SyncPreSnapshot* pMsg);
+void syncPreSnapshotLog(const SyncPreSnapshot* pMsg);
+void syncPreSnapshotLog2(char* s, const SyncPreSnapshot* pMsg);
+
+// ---------------------------------------------
+typedef struct SyncPreSnapshotReply {
+ uint32_t bytes;
+ int32_t vgId;
+ uint32_t msgType;
+ SRaftId srcId;
+ SRaftId destId;
+
+ // private data
+ SyncTerm term;
+ SyncIndex snapStart;
+
+} SyncPreSnapshotReply;
+
+SyncPreSnapshotReply* syncPreSnapshotReplyBuild(int32_t vgId);
+void syncPreSnapshotReplyDestroy(SyncPreSnapshotReply* pMsg);
+void syncPreSnapshotReplySerialize(const SyncPreSnapshotReply* pMsg, char* buf, uint32_t bufLen);
+void syncPreSnapshotReplyDeserialize(const char* buf, uint32_t len, SyncPreSnapshotReply* pMsg);
+char* syncPreSnapshotReplySerialize2(const SyncPreSnapshotReply* pMsg, uint32_t* len);
+SyncPreSnapshotReply* syncPreSnapshotReplyDeserialize2(const char* buf, uint32_t len);
+void syncPreSnapshotReply2RpcMsg(const SyncPreSnapshotReply* pMsg, SRpcMsg* pRpcMsg);
+void syncPreSnapshotReplyFromRpcMsg(const SRpcMsg* pRpcMsg, SyncPreSnapshotReply* pMsg);
+SyncPreSnapshotReply* syncPreSnapshotReplyFromRpcMsg2(const SRpcMsg* pRpcMsg);
+cJSON* syncPreSnapshotReply2Json(const SyncPreSnapshotReply* pMsg);
+char* syncPreSnapshotReply2Str(const SyncPreSnapshotReply* pMsg);
+
+// for debug ----------------------
+void syncPreSnapshotReplyPrint(const SyncPreSnapshotReply* pMsg);
+void syncPreSnapshotReplyPrint2(char* s, const SyncPreSnapshotReply* pMsg);
+void syncPreSnapshotReplyLog(const SyncPreSnapshotReply* pMsg);
+void syncPreSnapshotReplyLog2(char* s, const SyncPreSnapshotReply* pMsg);
+
// ---------------------------------------------
typedef struct SyncApplyMsg {
uint32_t bytes;
@@ -558,7 +604,7 @@ typedef struct SyncSnapshotSend {
SyncTerm lastTerm; // snapshot.lastTerm
SyncIndex lastConfigIndex; // snapshot.lastConfigIndex
SSyncCfg lastConfig;
- SyncTerm privateTerm;
+ int64_t startTime;
int32_t seq;
uint32_t dataLen;
char data[];
@@ -593,9 +639,10 @@ typedef struct SyncSnapshotRsp {
SyncTerm term;
SyncIndex lastIndex;
SyncTerm lastTerm;
- SyncTerm privateTerm;
+ int64_t startTime;
int32_t ack;
int32_t code;
+ SyncIndex snapBeginIndex; // when ack = SYNC_SNAPSHOT_SEQ_BEGIN, it's valid
} SyncSnapshotRsp;
SyncSnapshotRsp* syncSnapshotRspBuild(int32_t vgId);
@@ -679,10 +726,14 @@ void syncReconfigFinishLog(const SyncReconfigFinish* pMsg);
void syncReconfigFinishLog2(char* s, const SyncReconfigFinish* pMsg);
// ---------------------------------------------
+
typedef enum {
SYNC_LOCAL_CMD_STEP_DOWN = 100,
+ SYNC_LOCAL_CMD_FOLLOWER_CMT,
} ESyncLocalCmd;
+const char* syncLocalCmdGetStr(int32_t cmd);
+
typedef struct SyncLocalCmd {
uint32_t bytes;
int32_t vgId;
@@ -692,6 +743,7 @@ typedef struct SyncLocalCmd {
int32_t cmd;
SyncTerm sdNewTerm; // step down new term
+ SyncIndex fcIndex;// follower commit index
} SyncLocalCmd;
@@ -723,6 +775,9 @@ int32_t syncNodeOnRequestVoteReply(SSyncNode* ths, SyncRequestVoteReply* pMsg);
int32_t syncNodeOnAppendEntries(SSyncNode* ths, SyncAppendEntries* pMsg);
int32_t syncNodeOnAppendEntriesReply(SSyncNode* ths, SyncAppendEntriesReply* pMsg);
+int32_t syncNodeOnPreSnapshot(SSyncNode* ths, SyncPreSnapshot* pMsg);
+int32_t syncNodeOnPreSnapshotReply(SSyncNode* ths, SyncPreSnapshotReply* pMsg);
+
int32_t syncNodeOnSnapshot(SSyncNode* ths, SyncSnapshotSend* pMsg);
int32_t syncNodeOnSnapshotReply(SSyncNode* ths, SyncSnapshotRsp* pMsg);
diff --git a/source/libs/sync/inc/syncUtil.h b/source/libs/sync/inc/syncUtil.h
index 96e22720e8..ac8dd0928c 100644
--- a/source/libs/sync/inc/syncUtil.h
+++ b/source/libs/sync/inc/syncUtil.h
@@ -49,7 +49,7 @@ int32_t syncUtilQuorum(int32_t replicaNum);
cJSON* syncUtilNodeInfo2Json(const SNodeInfo* p);
cJSON* syncUtilRaftId2Json(const SRaftId* p);
char* syncUtilRaftId2Str(const SRaftId* p);
-const char* syncUtilState2String(ESyncState state);
+const char* syncStr(ESyncState state);
bool syncUtilCanPrint(char c);
char* syncUtilprintBin(char* ptr, uint32_t len);
char* syncUtilprintBin2(char* ptr, uint32_t len);
diff --git a/source/libs/sync/src/syncAppendEntries.c b/source/libs/sync/src/syncAppendEntries.c
index 7dab112a51..f0e296d872 100644
--- a/source/libs/sync/src/syncAppendEntries.c
+++ b/source/libs/sync/src/syncAppendEntries.c
@@ -90,6 +90,11 @@
//
int32_t syncNodeFollowerCommit(SSyncNode* ths, SyncIndex newCommitIndex) {
+ if (ths->state != TAOS_SYNC_STATE_FOLLOWER) {
+ syncNodeEventLog(ths, "can not do follower commit");
+ return -1;
+ }
+
// maybe update commit index, leader notice me
if (newCommitIndex > ths->commitIndex) {
// has commit entry in local
@@ -142,7 +147,6 @@ int32_t syncNodeOnAppendEntries(SSyncNode* ths, SyncAppendEntries* pMsg) {
// pReply->matchIndex = ths->pLogStore->syncLogLastIndex(ths->pLogStore);
pReply->matchIndex = SYNC_INDEX_INVALID;
pReply->lastSendIndex = pMsg->prevLogIndex + 1;
- pReply->privateTerm = ths->pNewNodeReceiver->privateTerm;
pReply->startTime = ths->startTime;
if (pMsg->term < ths->pRaftStore->currentTerm) {
diff --git a/source/libs/sync/src/syncAppendEntriesReply.c b/source/libs/sync/src/syncAppendEntriesReply.c
index 5e6c9f1534..5d54db5b07 100644
--- a/source/libs/sync/src/syncAppendEntriesReply.c
+++ b/source/libs/sync/src/syncAppendEntriesReply.c
@@ -73,6 +73,7 @@ static void syncNodeStartSnapshotOnce(SSyncNode* ths, SyncIndex beginIndex, Sync
int32_t code = ths->pFsm->FpSnapshotStartRead(ths->pFsm, &readerParam, &pReader);
ASSERT(code == 0);
+#if 0
if (pMsg->privateTerm < pSender->privateTerm) {
ASSERT(pReader != NULL);
snapshotSenderStart(pSender, readerParam, snapshot, pReader);
@@ -82,6 +83,7 @@ static void syncNodeStartSnapshotOnce(SSyncNode* ths, SyncIndex beginIndex, Sync
ths->pFsm->FpSnapshotStopRead(ths->pFsm, pReader);
}
}
+#endif
}
int32_t syncNodeOnAppendEntriesReply(SSyncNode* ths, SyncAppendEntriesReply* pMsg) {
diff --git a/source/libs/sync/src/syncEnv.c b/source/libs/sync/src/syncEnv.c
index fb0bfb8bef..cf0d4d25e8 100644
--- a/source/libs/sync/src/syncEnv.c
+++ b/source/libs/sync/src/syncEnv.c
@@ -13,118 +13,112 @@
* along with this program. If not, see .
*/
+#define _DEFAULT_SOURCE
#include "syncEnv.h"
-// #include
+#include "tref.h"
-SSyncEnv *gSyncEnv = NULL;
+static SSyncEnv gSyncEnv = {0};
+static int32_t gNodeRefId = -1;
+bool gRaftDetailLog = false;
+static void syncEnvTick(void *param, void *tmrId);
-// local function -----------------
-static SSyncEnv *doSyncEnvStart();
-static int32_t doSyncEnvStop(SSyncEnv *pSyncEnv);
-static int32_t doSyncEnvStartTimer(SSyncEnv *pSyncEnv);
-static int32_t doSyncEnvStopTimer(SSyncEnv *pSyncEnv);
-static void syncEnvTick(void *param, void *tmrId);
-// --------------------------------
+SSyncEnv *syncEnv() { return &gSyncEnv; }
-bool syncEnvIsStart() {
- if (gSyncEnv == NULL) {
- return false;
- }
+bool syncIsInit() { return atomic_load_8(&gSyncEnv.isStart); }
- return atomic_load_8(&(gSyncEnv->isStart));
-}
+int32_t syncInit() {
+ if (syncIsInit()) return 0;
-int32_t syncEnvStart() {
- int32_t ret = 0;
uint32_t seed = (uint32_t)(taosGetTimestampNs() & 0x00000000FFFFFFFF);
taosSeedRand(seed);
- // gSyncEnv = doSyncEnvStart(gSyncEnv);
- gSyncEnv = doSyncEnvStart();
- ASSERT(gSyncEnv != NULL);
- sTrace("sync env start ok");
- return ret;
-}
-int32_t syncEnvStop() {
- int32_t ret = doSyncEnvStop(gSyncEnv);
- return ret;
-}
-
-int32_t syncEnvStartTimer() {
- int32_t ret = doSyncEnvStartTimer(gSyncEnv);
- return ret;
-}
-
-int32_t syncEnvStopTimer() {
- int32_t ret = doSyncEnvStopTimer(gSyncEnv);
- return ret;
-}
-
-// local function -----------------
-static void syncEnvTick(void *param, void *tmrId) {
- SSyncEnv *pSyncEnv = (SSyncEnv *)param;
- if (atomic_load_64(&pSyncEnv->envTickTimerLogicClockUser) <= atomic_load_64(&pSyncEnv->envTickTimerLogicClock)) {
- ++(pSyncEnv->envTickTimerCounter);
- sTrace("syncEnvTick do ... envTickTimerLogicClockUser:%" PRIu64 ", envTickTimerLogicClock:%" PRIu64
- ", envTickTimerCounter:%" PRIu64
- ", "
- "envTickTimerMS:%d, tmrId:%p",
- pSyncEnv->envTickTimerLogicClockUser, pSyncEnv->envTickTimerLogicClock, pSyncEnv->envTickTimerCounter,
- pSyncEnv->envTickTimerMS, tmrId);
-
- // do something, tick ...
- taosTmrReset(syncEnvTick, pSyncEnv->envTickTimerMS, pSyncEnv, pSyncEnv->pTimerManager, &pSyncEnv->pEnvTickTimer);
- } else {
- sTrace("syncEnvTick pass ... envTickTimerLogicClockUser:%" PRIu64 ", envTickTimerLogicClock:%" PRIu64
- ", envTickTimerCounter:%" PRIu64
- ", "
- "envTickTimerMS:%d, tmrId:%p",
- pSyncEnv->envTickTimerLogicClockUser, pSyncEnv->envTickTimerLogicClock, pSyncEnv->envTickTimerCounter,
- pSyncEnv->envTickTimerMS, tmrId);
- }
-}
-
-static SSyncEnv *doSyncEnvStart() {
- SSyncEnv *pSyncEnv = (SSyncEnv *)taosMemoryMalloc(sizeof(SSyncEnv));
- ASSERT(pSyncEnv != NULL);
- memset(pSyncEnv, 0, sizeof(SSyncEnv));
-
- pSyncEnv->envTickTimerCounter = 0;
- pSyncEnv->envTickTimerMS = ENV_TICK_TIMER_MS;
- pSyncEnv->FpEnvTickTimer = syncEnvTick;
- atomic_store_64(&pSyncEnv->envTickTimerLogicClock, 0);
- atomic_store_64(&pSyncEnv->envTickTimerLogicClockUser, 0);
+ memset(&gSyncEnv, 0, sizeof(SSyncEnv));
+ gSyncEnv.envTickTimerCounter = 0;
+ gSyncEnv.envTickTimerMS = ENV_TICK_TIMER_MS;
+ gSyncEnv.FpEnvTickTimer = syncEnvTick;
+ atomic_store_64(&gSyncEnv.envTickTimerLogicClock, 0);
+ atomic_store_64(&gSyncEnv.envTickTimerLogicClockUser, 0);
// start tmr thread
- pSyncEnv->pTimerManager = taosTmrInit(1000, 50, 10000, "SYNC-ENV");
+ gSyncEnv.pTimerManager = taosTmrInit(1000, 50, 10000, "SYNC-ENV");
+ atomic_store_8(&gSyncEnv.isStart, 1);
- atomic_store_8(&(pSyncEnv->isStart), 1);
- return pSyncEnv;
-}
-
-static int32_t doSyncEnvStop(SSyncEnv *pSyncEnv) {
- ASSERT(pSyncEnv == gSyncEnv);
- if (pSyncEnv != NULL) {
- atomic_store_8(&(pSyncEnv->isStart), 0);
- taosTmrCleanUp(pSyncEnv->pTimerManager);
- taosMemoryFree(pSyncEnv);
+ gNodeRefId = taosOpenRef(200, (RefFp)syncNodeClose);
+ if (gNodeRefId < 0) {
+ sError("failed to init node ref");
+ syncCleanUp();
+ return -1;
}
- gSyncEnv = NULL;
+
+ sDebug("sync rsetId:%d is open", gNodeRefId);
return 0;
}
-static int32_t doSyncEnvStartTimer(SSyncEnv *pSyncEnv) {
- int32_t ret = 0;
- taosTmrReset(pSyncEnv->FpEnvTickTimer, pSyncEnv->envTickTimerMS, pSyncEnv, pSyncEnv->pTimerManager,
- &pSyncEnv->pEnvTickTimer);
- atomic_store_64(&pSyncEnv->envTickTimerLogicClock, pSyncEnv->envTickTimerLogicClockUser);
- return ret;
+void syncCleanUp() {
+ atomic_store_8(&gSyncEnv.isStart, 0);
+ taosTmrCleanUp(gSyncEnv.pTimerManager);
+ memset(&gSyncEnv, 0, sizeof(SSyncEnv));
+
+ if (gNodeRefId != -1) {
+ sDebug("sync rsetId:%d is closed", gNodeRefId);
+ taosCloseRef(gNodeRefId);
+ gNodeRefId = -1;
+ }
}
-static int32_t doSyncEnvStopTimer(SSyncEnv *pSyncEnv) {
+int64_t syncNodeAdd(SSyncNode *pNode) {
+ pNode->rid = taosAddRef(gNodeRefId, pNode);
+ if (pNode->rid < 0) return -1;
+
+ sDebug("vgId:%d, sync rid:%" PRId64 " is added to rsetId:%d", pNode->vgId, pNode->rid, gNodeRefId);
+ return pNode->rid;
+}
+
+void syncNodeRemove(int64_t rid) { taosRemoveRef(gNodeRefId, rid); }
+
+SSyncNode *syncNodeAcquire(int64_t rid) {
+ SSyncNode *pNode = taosAcquireRef(gNodeRefId, rid);
+ if (pNode == NULL) {
+ sTrace("failed to acquire node from refId:%" PRId64, rid);
+ terrno = TSDB_CODE_SYN_INTERNAL_ERROR;
+ }
+
+ return pNode;
+}
+
+void syncNodeRelease(SSyncNode *pNode) { taosReleaseRef(gNodeRefId, pNode->rid); }
+
+#if 0
+void syncEnvStartTimer() {
+ taosTmrReset(gSyncEnv.FpEnvTickTimer, gSyncEnv.envTickTimerMS, &gSyncEnv, gSyncEnv.pTimerManager,
+ &gSyncEnv.pEnvTickTimer);
+ atomic_store_64(&gSyncEnv.envTickTimerLogicClock, gSyncEnv.envTickTimerLogicClockUser);
+}
+
+void syncEnvStopTimer() {
int32_t ret = 0;
- atomic_add_fetch_64(&pSyncEnv->envTickTimerLogicClockUser, 1);
- taosTmrStop(pSyncEnv->pEnvTickTimer);
- pSyncEnv->pEnvTickTimer = NULL;
+ atomic_add_fetch_64(&gSyncEnv.envTickTimerLogicClockUser, 1);
+ taosTmrStop(gSyncEnv.pEnvTickTimer);
+ gSyncEnv.pEnvTickTimer = NULL;
return ret;
}
+#endif
+
+static void syncEnvTick(void *param, void *tmrId) {
+ SSyncEnv *pSyncEnv = param;
+ if (atomic_load_64(&gSyncEnv.envTickTimerLogicClockUser) <= atomic_load_64(&gSyncEnv.envTickTimerLogicClock)) {
+ gSyncEnv.envTickTimerCounter++;
+ sTrace("syncEnvTick do ... envTickTimerLogicClockUser:%" PRIu64 ", envTickTimerLogicClock:%" PRIu64
+ ", envTickTimerCounter:%" PRIu64 ", envTickTimerMS:%d, tmrId:%p",
+ gSyncEnv.envTickTimerLogicClockUser, gSyncEnv.envTickTimerLogicClock, gSyncEnv.envTickTimerCounter,
+ gSyncEnv.envTickTimerMS, tmrId);
+
+ // do something, tick ...
+ taosTmrReset(syncEnvTick, gSyncEnv.envTickTimerMS, pSyncEnv, gSyncEnv.pTimerManager, &gSyncEnv.pEnvTickTimer);
+ } else {
+ sTrace("syncEnvTick pass ... envTickTimerLogicClockUser:%" PRIu64 ", envTickTimerLogicClock:%" PRIu64
+ ", envTickTimerCounter:%" PRIu64 ", envTickTimerMS:%d, tmrId:%p",
+ gSyncEnv.envTickTimerLogicClockUser, gSyncEnv.envTickTimerLogicClock, gSyncEnv.envTickTimerCounter,
+ gSyncEnv.envTickTimerMS, tmrId);
+ }
+}
diff --git a/source/libs/sync/src/syncMain.c b/source/libs/sync/src/syncMain.c
index 02e5c643a4..27f4eeedb2 100644
--- a/source/libs/sync/src/syncMain.c
+++ b/source/libs/sync/src/syncMain.c
@@ -13,6 +13,7 @@
* along with this program. If not, see .
*/
+#define _DEFAULT_SOURCE
#include "sync.h"
#include "syncAppendEntries.h"
#include "syncAppendEntriesReply.h"
@@ -33,59 +34,14 @@
#include "syncTimeout.h"
#include "syncUtil.h"
#include "syncVoteMgr.h"
-#include "tref.h"
-bool gRaftDetailLog = false;
-
-static int32_t tsNodeRefId = -1;
-
-// ------ local funciton ---------
-// enqueue message ----
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);
-
-// process message ----
-int32_t syncNodeOnPing(SSyncNode* ths, SyncPing* pMsg);
-int32_t syncNodeOnPingReply(SSyncNode* ths, SyncPingReply* pMsg);
-
-// ---------------------------------
-static void syncNodeFreeCb(void* param) {
- syncNodeClose(param);
- param = NULL;
-}
-
-int32_t syncInit() {
- int32_t ret = 0;
-
- if (!syncEnvIsStart()) {
- tsNodeRefId = taosOpenRef(200, syncNodeFreeCb);
- if (tsNodeRefId < 0) {
- sError("failed to init node ref");
- syncCleanUp();
- ret = -1;
- } else {
- sDebug("sync rsetId:%d is open", tsNodeRefId);
- ret = syncEnvStart();
- }
- }
-
- return ret;
-}
-
-void syncCleanUp() {
- int32_t ret = syncEnvStop();
- ASSERT(ret == 0);
-
- if (tsNodeRefId != -1) {
- sDebug("sync rsetId:%d is closed", tsNodeRefId);
- taosCloseRef(tsNodeRefId);
- tsNodeRefId = -1;
- }
-}
+static bool syncIsConfigChanged(const SSyncCfg* pOldCfg, const SSyncCfg* pNewCfg);
int64_t syncOpen(SSyncInfo* pSyncInfo) {
SSyncNode* pSyncNode = syncNodeOpen(pSyncInfo);
@@ -94,215 +50,154 @@ int64_t syncOpen(SSyncInfo* pSyncInfo) {
return -1;
}
- pSyncNode->rid = taosAddRef(tsNodeRefId, pSyncNode);
+ pSyncNode->rid = syncNodeAdd(pSyncNode);
if (pSyncNode->rid < 0) {
syncNodeClose(pSyncNode);
- pSyncNode = NULL;
return -1;
}
- sDebug("vgId:%d, sync rid:%" PRId64 " is added to rsetId:%d", pSyncInfo->vgId, pSyncNode->rid, tsNodeRefId);
+ pSyncNode->pingBaseLine = pSyncInfo->pingMs;
+ pSyncNode->pingTimerMS = pSyncInfo->pingMs;
+ pSyncNode->electBaseLine = pSyncInfo->electMs;
+ pSyncNode->hbBaseLine = pSyncInfo->heartbeatMs;
+ pSyncNode->heartbeatTimerMS = pSyncInfo->heartbeatMs;
+ pSyncNode->msgcb = pSyncInfo->msgcb;
return pSyncNode->rid;
}
void syncStart(int64_t rid) {
- SSyncNode* pSyncNode = taosAcquireRef(tsNodeRefId, rid);
- if (pSyncNode == NULL) {
- return;
- }
-
- if (pSyncNode->pRaftCfg->isStandBy) {
- syncNodeStartStandBy(pSyncNode);
- } else {
+ SSyncNode* pSyncNode = syncNodeAcquire(rid);
+ if (pSyncNode != NULL) {
syncNodeStart(pSyncNode);
+ syncNodeRelease(pSyncNode);
}
-
- taosReleaseRef(tsNodeRefId, pSyncNode->rid);
-}
-
-void syncStartNormal(int64_t rid) {
- SSyncNode* pSyncNode = taosAcquireRef(tsNodeRefId, rid);
- if (pSyncNode == NULL) {
- return;
- }
- syncNodeStart(pSyncNode);
-
- taosReleaseRef(tsNodeRefId, pSyncNode->rid);
-}
-
-void syncStartStandBy(int64_t rid) {
- SSyncNode* pSyncNode = taosAcquireRef(tsNodeRefId, rid);
- if (pSyncNode == NULL) {
- return;
- }
- syncNodeStartStandBy(pSyncNode);
-
- taosReleaseRef(tsNodeRefId, pSyncNode->rid);
}
void syncStop(int64_t rid) {
- SSyncNode* pSyncNode = taosAcquireRef(tsNodeRefId, rid);
+ SSyncNode* pSyncNode = syncNodeAcquire(rid);
+ if (pSyncNode != NULL) {
+ syncNodeRelease(pSyncNode);
+ syncNodeRemove(rid);
+ }
+}
+
+void syncPreStop(int64_t rid) {
+ SSyncNode* pSyncNode = syncNodeAcquire(rid);
if (pSyncNode == NULL) return;
- int32_t vgId = pSyncNode->vgId;
- taosReleaseRef(tsNodeRefId, pSyncNode->rid);
- taosRemoveRef(tsNodeRefId, rid);
- sDebug("vgId:%d, sync rid:%" PRId64 " is removed from rsetId:%d", vgId, rid, tsNodeRefId);
+ syncNodePreClose(pSyncNode);
+
+ syncNodeRelease(pSyncNode);
}
-int32_t syncSetStandby(int64_t rid) {
- SSyncNode* pSyncNode = taosAcquireRef(tsNodeRefId, rid);
- if (pSyncNode == NULL) {
- terrno = TSDB_CODE_SYN_INTERNAL_ERROR;
- sError("failed to set standby since accquire ref error, rid:%" PRId64, rid);
- return -1;
- }
-
- if (pSyncNode->state != TAOS_SYNC_STATE_FOLLOWER) {
- if (pSyncNode->state == TAOS_SYNC_STATE_LEADER) {
- terrno = TSDB_CODE_SYN_IS_LEADER;
- } else {
- terrno = TSDB_CODE_SYN_STANDBY_NOT_READY;
- }
- sError("failed to set standby since it is not follower, state:%s rid:%" PRId64, syncStr(pSyncNode->state), rid);
- taosReleaseRef(tsNodeRefId, pSyncNode->rid);
- return -1;
- }
-
- // state change
- pSyncNode->state = TAOS_SYNC_STATE_FOLLOWER;
- syncNodeStopHeartbeatTimer(pSyncNode);
-
- // reset elect timer, long enough
- int32_t electMS = TIMER_MAX_MS;
- int32_t ret = syncNodeRestartElectTimer(pSyncNode, electMS);
- ASSERT(ret == 0);
-
- pSyncNode->pRaftCfg->isStandBy = 1;
- raftCfgPersist(pSyncNode->pRaftCfg);
-
- taosReleaseRef(tsNodeRefId, pSyncNode->rid);
- sInfo("vgId:%d, set to standby", pSyncNode->vgId);
- return 0;
-}
-
-bool syncNodeCheckNewConfig(SSyncNode* pSyncNode, const SSyncCfg* pNewCfg) {
- bool IamInNew = syncNodeInConfig(pSyncNode, pNewCfg);
- if (!IamInNew) {
- return false;
- }
-
- if (pNewCfg->replicaNum > pSyncNode->replicaNum + 1) {
- return false;
- }
-
- if (pNewCfg->replicaNum < pSyncNode->replicaNum - 1) {
- return false;
- }
-
- return true;
-}
-
-int32_t syncReconfigBuild(int64_t rid, const SSyncCfg* pNewCfg, SRpcMsg* pRpcMsg) {
- SSyncNode* pSyncNode = (SSyncNode*)taosAcquireRef(tsNodeRefId, rid);
- if (pSyncNode == NULL) {
- terrno = TSDB_CODE_SYN_INTERNAL_ERROR;
- return -1;
- }
- ASSERT(rid == pSyncNode->rid);
- int32_t ret = 0;
-
- if (!syncNodeCheckNewConfig(pSyncNode, pNewCfg)) {
- taosReleaseRef(tsNodeRefId, pSyncNode->rid);
- terrno = TSDB_CODE_SYN_NEW_CONFIG_ERROR;
- sError("invalid new config. vgId:%d", pSyncNode->vgId);
- return -1;
- }
-
- char* newconfig = syncCfg2Str((SSyncCfg*)pNewCfg);
- pRpcMsg->msgType = TDMT_SYNC_CONFIG_CHANGE;
- pRpcMsg->info.noResp = 1;
- pRpcMsg->contLen = strlen(newconfig) + 1;
- pRpcMsg->pCont = rpcMallocCont(pRpcMsg->contLen);
- snprintf(pRpcMsg->pCont, pRpcMsg->contLen, "%s", newconfig);
- taosMemoryFree(newconfig);
-
- taosReleaseRef(tsNodeRefId, pSyncNode->rid);
- return ret;
+static bool syncNodeCheckNewConfig(SSyncNode* pSyncNode, const SSyncCfg* pCfg) {
+ if (!syncNodeInConfig(pSyncNode, pCfg)) return false;
+ return abs(pCfg->replicaNum - pSyncNode->replicaNum) <= 1;
}
int32_t syncReconfig(int64_t rid, SSyncCfg* pNewCfg) {
- SSyncNode* pSyncNode = (SSyncNode*)taosAcquireRef(tsNodeRefId, rid);
- if (pSyncNode == NULL) {
- terrno = TSDB_CODE_SYN_INTERNAL_ERROR;
- return -1;
- }
- ASSERT(rid == pSyncNode->rid);
+ SSyncNode* pSyncNode = syncNodeAcquire(rid);
+ if (pSyncNode == NULL) return -1;
if (!syncNodeCheckNewConfig(pSyncNode, pNewCfg)) {
- taosReleaseRef(tsNodeRefId, pSyncNode->rid);
+ syncNodeRelease(pSyncNode);
terrno = TSDB_CODE_SYN_NEW_CONFIG_ERROR;
- sError("invalid new config. vgId:%d", pSyncNode->vgId);
+ sError("vgId:%d, failed to reconfig since invalid new config", pSyncNode->vgId);
return -1;
}
-#if 0
- char* newconfig = syncCfg2Str((SSyncCfg*)pNewCfg);
- int32_t ret = 0;
-
- SRpcMsg rpcMsg = {0};
- rpcMsg.msgType = TDMT_SYNC_CONFIG_CHANGE;
- rpcMsg.info.noResp = 1;
- rpcMsg.contLen = strlen(newconfig) + 1;
- rpcMsg.pCont = rpcMallocCont(rpcMsg.contLen);
- snprintf(rpcMsg.pCont, rpcMsg.contLen, "%s", newconfig);
- taosMemoryFree(newconfig);
- ret = syncNodePropose(pSyncNode, &rpcMsg, false);
-
- taosReleaseRef(tsNodeRefId, pSyncNode->rid);
- return ret;
-#else
syncNodeUpdateNewConfigIndex(pSyncNode, pNewCfg);
syncNodeDoConfigChange(pSyncNode, pNewCfg, SYNC_INDEX_INVALID);
+
if (pSyncNode->state == TAOS_SYNC_STATE_LEADER) {
syncNodeStopHeartbeatTimer(pSyncNode);
for (int32_t i = 0; i < TSDB_MAX_REPLICA; ++i) {
- syncHbTimerInit(pSyncNode, &(pSyncNode->peerHeartbeatTimerArr[i]), (pSyncNode->replicasId)[i]);
+ syncHbTimerInit(pSyncNode, &pSyncNode->peerHeartbeatTimerArr[i], pSyncNode->replicasId[i]);
}
syncNodeStartHeartbeatTimer(pSyncNode);
-
syncNodeReplicate(pSyncNode);
}
- taosReleaseRef(tsNodeRefId, pSyncNode->rid);
+
+ syncNodeRelease(pSyncNode);
return 0;
-#endif
+}
+
+int32_t syncProcessMsg(int64_t rid, SRpcMsg* pMsg) {
+ int32_t code = -1;
+ if (!syncIsInit()) return code;
+
+ SSyncNode* pSyncNode = syncNodeAcquire(rid);
+ if (pSyncNode == NULL) return code;
+
+ if (pMsg->msgType == TDMT_SYNC_HEARTBEAT) {
+ SyncHeartbeat* pSyncMsg = syncHeartbeatFromRpcMsg2(pMsg);
+ code = syncNodeOnHeartbeat(pSyncNode, pSyncMsg);
+ syncHeartbeatDestroy(pSyncMsg);
+ } else if (pMsg->msgType == TDMT_SYNC_HEARTBEAT_REPLY) {
+ SyncHeartbeatReply* pSyncMsg = syncHeartbeatReplyFromRpcMsg2(pMsg);
+ code = syncNodeOnHeartbeatReply(pSyncNode, pSyncMsg);
+ syncHeartbeatReplyDestroy(pSyncMsg);
+ } else if (pMsg->msgType == TDMT_SYNC_TIMEOUT) {
+ SyncTimeout* pSyncMsg = syncTimeoutFromRpcMsg2(pMsg);
+ code = syncNodeOnTimer(pSyncNode, pSyncMsg);
+ syncTimeoutDestroy(pSyncMsg);
+ } else if (pMsg->msgType == TDMT_SYNC_PING) {
+ SyncPing* pSyncMsg = syncPingFromRpcMsg2(pMsg);
+ code = syncNodeOnPing(pSyncNode, pSyncMsg);
+ syncPingDestroy(pSyncMsg);
+ } else if (pMsg->msgType == TDMT_SYNC_PING_REPLY) {
+ SyncPingReply* pSyncMsg = syncPingReplyFromRpcMsg2(pMsg);
+ code = syncNodeOnPingReply(pSyncNode, pSyncMsg);
+ syncPingReplyDestroy(pSyncMsg);
+ } else if (pMsg->msgType == TDMT_SYNC_CLIENT_REQUEST) {
+ SyncClientRequest* pSyncMsg = syncClientRequestFromRpcMsg2(pMsg);
+ code = syncNodeOnClientRequest(pSyncNode, pSyncMsg, NULL);
+ syncClientRequestDestroy(pSyncMsg);
+ } else if (pMsg->msgType == TDMT_SYNC_REQUEST_VOTE) {
+ SyncRequestVote* pSyncMsg = syncRequestVoteFromRpcMsg2(pMsg);
+ code = syncNodeOnRequestVote(pSyncNode, pSyncMsg);
+ syncRequestVoteDestroy(pSyncMsg);
+ } else if (pMsg->msgType == TDMT_SYNC_REQUEST_VOTE_REPLY) {
+ SyncRequestVoteReply* pSyncMsg = syncRequestVoteReplyFromRpcMsg2(pMsg);
+ code = syncNodeOnRequestVoteReply(pSyncNode, pSyncMsg);
+ syncRequestVoteReplyDestroy(pSyncMsg);
+ } else if (pMsg->msgType == TDMT_SYNC_APPEND_ENTRIES) {
+ SyncAppendEntries* pSyncMsg = syncAppendEntriesFromRpcMsg2(pMsg);
+ code = syncNodeOnAppendEntries(pSyncNode, pSyncMsg);
+ syncAppendEntriesDestroy(pSyncMsg);
+ } else if (pMsg->msgType == TDMT_SYNC_APPEND_ENTRIES_REPLY) {
+ SyncAppendEntriesReply* pSyncMsg = syncAppendEntriesReplyFromRpcMsg2(pMsg);
+ code = syncNodeOnAppendEntriesReply(pSyncNode, pSyncMsg);
+ syncAppendEntriesReplyDestroy(pSyncMsg);
+ } else if (pMsg->msgType == TDMT_SYNC_SNAPSHOT_SEND) {
+ SyncSnapshotSend* pSyncMsg = syncSnapshotSendFromRpcMsg2(pMsg);
+ code = syncNodeOnSnapshot(pSyncNode, pSyncMsg);
+ syncSnapshotSendDestroy(pSyncMsg);
+ } else if (pMsg->msgType == TDMT_SYNC_SNAPSHOT_RSP) {
+ SyncSnapshotRsp* pSyncMsg = syncSnapshotRspFromRpcMsg2(pMsg);
+ code = syncNodeOnSnapshotReply(pSyncNode, pSyncMsg);
+ syncSnapshotRspDestroy(pSyncMsg);
+ } else if (pMsg->msgType == TDMT_SYNC_LOCAL_CMD) {
+ SyncLocalCmd* pSyncMsg = syncLocalCmdFromRpcMsg2(pMsg);
+ code = syncNodeOnLocalCmd(pSyncNode, pSyncMsg);
+ syncLocalCmdDestroy(pSyncMsg);
+ } else {
+ sError("vgId:%d, failed to process msg:%p since invalid type:%s", pSyncNode->vgId, pMsg, TMSG_INFO(pMsg->msgType));
+ code = -1;
+ }
+
+ syncNodeRelease(pSyncNode);
+ return code;
}
int32_t syncLeaderTransfer(int64_t rid) {
- SSyncNode* pSyncNode = (SSyncNode*)taosAcquireRef(tsNodeRefId, rid);
- if (pSyncNode == NULL) {
- terrno = TSDB_CODE_SYN_INTERNAL_ERROR;
- return -1;
- }
- ASSERT(rid == pSyncNode->rid);
+ SSyncNode* pSyncNode = syncNodeAcquire(rid);
+ if (pSyncNode == NULL) return -1;
int32_t ret = syncNodeLeaderTransfer(pSyncNode);
- taosReleaseRef(tsNodeRefId, pSyncNode->rid);
- return ret;
-}
-
-int32_t syncLeaderTransferTo(int64_t rid, SNodeInfo newLeader) {
- SSyncNode* pSyncNode = (SSyncNode*)taosAcquireRef(tsNodeRefId, rid);
- if (pSyncNode == NULL) {
- terrno = TSDB_CODE_SYN_INTERNAL_ERROR;
- return -1;
- }
- ASSERT(rid == pSyncNode->rid);
-
- int32_t ret = syncNodeLeaderTransferTo(pSyncNode, newLeader);
- taosReleaseRef(tsNodeRefId, pSyncNode->rid);
+ syncNodeRelease(pSyncNode);
return ret;
}
@@ -358,7 +253,7 @@ char* syncNodePeerState2Str(const SSyncNode* pSyncNode) {
}
int32_t syncBeginSnapshot(int64_t rid, int64_t lastApplyIndex) {
- SSyncNode* pSyncNode = (SSyncNode*)taosAcquireRef(tsNodeRefId, rid);
+ SSyncNode* pSyncNode = syncNodeAcquire(rid);
if (pSyncNode == NULL) {
terrno = TSDB_CODE_SYN_INTERNAL_ERROR;
return -1;
@@ -382,7 +277,7 @@ int32_t syncBeginSnapshot(int64_t rid, int64_t lastApplyIndex) {
logNum, isEmpty);
syncNodeEventLog(pSyncNode, logBuf);
- taosReleaseRef(tsNodeRefId, pSyncNode->rid);
+ syncNodeRelease(pSyncNode);
return 0;
}
@@ -411,7 +306,7 @@ int32_t syncBeginSnapshot(int64_t rid, int64_t lastApplyIndex) {
syncNodeEventLog(pSyncNode, logBuf);
} while (0);
- taosReleaseRef(tsNodeRefId, pSyncNode->rid);
+ syncNodeRelease(pSyncNode);
return 0;
}
}
@@ -424,7 +319,7 @@ int32_t syncBeginSnapshot(int64_t rid, int64_t lastApplyIndex) {
lastApplyIndex, pSyncNode->minMatchIndex);
syncNodeEventLog(pSyncNode, logBuf);
- taosReleaseRef(tsNodeRefId, pSyncNode->rid);
+ syncNodeRelease(pSyncNode);
return 0;
}
@@ -433,7 +328,7 @@ int32_t syncBeginSnapshot(int64_t rid, int64_t lastApplyIndex) {
snprintf(logBuf, sizeof(logBuf), "new-snapshot-index:%" PRId64 " candidate, do not delete wal", lastApplyIndex);
syncNodeEventLog(pSyncNode, logBuf);
- taosReleaseRef(tsNodeRefId, pSyncNode->rid);
+ syncNodeRelease(pSyncNode);
return 0;
} else {
@@ -442,7 +337,7 @@ int32_t syncBeginSnapshot(int64_t rid, int64_t lastApplyIndex) {
lastApplyIndex);
syncNodeEventLog(pSyncNode, logBuf);
- taosReleaseRef(tsNodeRefId, pSyncNode->rid);
+ syncNodeRelease(pSyncNode);
return 0;
}
@@ -491,12 +386,12 @@ _DEL_WAL:
}
} while (0);
- taosReleaseRef(tsNodeRefId, pSyncNode->rid);
+ syncNodeRelease(pSyncNode);
return code;
}
int32_t syncEndSnapshot(int64_t rid) {
- SSyncNode* pSyncNode = (SSyncNode*)taosAcquireRef(tsNodeRefId, rid);
+ SSyncNode* pSyncNode = syncNodeAcquire(rid);
if (pSyncNode == NULL) {
terrno = TSDB_CODE_SYN_INTERNAL_ERROR;
return -1;
@@ -508,9 +403,9 @@ int32_t syncEndSnapshot(int64_t rid) {
SSyncLogStoreData* pData = pSyncNode->pLogStore->data;
code = walEndSnapshot(pData->pWal);
if (code != 0) {
- sError("vgId:%d, wal snapshot end error since:%s", pSyncNode->vgId, terrstr(terrno));
+ sError("vgId:%d, wal snapshot end error since:%s", pSyncNode->vgId, terrstr());
- taosReleaseRef(tsNodeRefId, pSyncNode->rid);
+ syncNodeRelease(pSyncNode);
return -1;
} else {
do {
@@ -524,10 +419,65 @@ int32_t syncEndSnapshot(int64_t rid) {
}
}
- taosReleaseRef(tsNodeRefId, pSyncNode->rid);
+ syncNodeRelease(pSyncNode);
return code;
}
+int32_t syncStepDown(int64_t rid, SyncTerm newTerm) {
+ SSyncNode* pSyncNode = syncNodeAcquire(rid);
+ if (pSyncNode == NULL) {
+ terrno = TSDB_CODE_SYN_INTERNAL_ERROR;
+ return -1;
+ }
+ ASSERT(rid == pSyncNode->rid);
+
+ syncNodeStepDown(pSyncNode, newTerm);
+
+ syncNodeRelease(pSyncNode);
+ return 0;
+}
+
+bool syncIsReadyForRead(int64_t rid) {
+ SSyncNode* pSyncNode = syncNodeAcquire(rid);
+ if (pSyncNode == NULL) {
+ terrno = TSDB_CODE_SYN_INTERNAL_ERROR;
+ return false;
+ }
+ ASSERT(rid == pSyncNode->rid);
+
+ if (pSyncNode->state == TAOS_SYNC_STATE_LEADER && pSyncNode->restoreFinish) {
+ syncNodeRelease(pSyncNode);
+ return true;
+ }
+
+ bool ready = false;
+ if (pSyncNode->state == TAOS_SYNC_STATE_LEADER && !pSyncNode->restoreFinish) {
+ if (!pSyncNode->pLogStore->syncLogIsEmpty(pSyncNode->pLogStore)) {
+ SSyncRaftEntry* pEntry = NULL;
+ int32_t code = pSyncNode->pLogStore->syncLogGetEntry(
+ pSyncNode->pLogStore, pSyncNode->pLogStore->syncLogLastIndex(pSyncNode->pLogStore), &pEntry);
+ if (code == 0 && pEntry != NULL) {
+ if (pEntry->originalRpcType == TDMT_SYNC_NOOP && pEntry->term == pSyncNode->pRaftStore->currentTerm) {
+ ready = true;
+ }
+
+ syncEntryDestory(pEntry);
+ }
+ }
+ }
+
+ if (!ready) {
+ if (pSyncNode->state != TAOS_SYNC_STATE_LEADER) {
+ terrno = TSDB_CODE_SYN_NOT_LEADER;
+ } else {
+ terrno = TSDB_CODE_APP_NOT_READY;
+ }
+ }
+
+ syncNodeRelease(pSyncNode);
+ return ready;
+}
+
int32_t syncNodeLeaderTransfer(SSyncNode* pSyncNode) {
if (pSyncNode->peersNum == 0) {
sDebug("only one replica, cannot leader transfer");
@@ -535,8 +485,12 @@ int32_t syncNodeLeaderTransfer(SSyncNode* pSyncNode) {
return -1;
}
- SNodeInfo newLeader = (pSyncNode->peersNodeInfo)[0];
- int32_t ret = syncNodeLeaderTransferTo(pSyncNode, newLeader);
+ int32_t ret = 0;
+ if (pSyncNode->state == TAOS_SYNC_STATE_LEADER) {
+ SNodeInfo newLeader = (pSyncNode->peersNodeInfo)[0];
+ ret = syncNodeLeaderTransferTo(pSyncNode, newLeader);
+ }
+
return ret;
}
@@ -569,19 +523,19 @@ int32_t syncNodeLeaderTransferTo(SSyncNode* pSyncNode, SNodeInfo newLeader) {
}
bool syncCanLeaderTransfer(int64_t rid) {
- SSyncNode* pSyncNode = (SSyncNode*)taosAcquireRef(tsNodeRefId, rid);
+ SSyncNode* pSyncNode = syncNodeAcquire(rid);
if (pSyncNode == NULL) {
return false;
}
ASSERT(rid == pSyncNode->rid);
if (pSyncNode->replicaNum == 1) {
- taosReleaseRef(tsNodeRefId, pSyncNode->rid);
+ syncNodeRelease(pSyncNode);
return false;
}
if (pSyncNode->state == TAOS_SYNC_STATE_FOLLOWER) {
- taosReleaseRef(tsNodeRefId, pSyncNode->rid);
+ syncNodeRelease(pSyncNode);
return true;
}
@@ -596,7 +550,7 @@ bool syncCanLeaderTransfer(int64_t rid) {
}
}
- taosReleaseRef(tsNodeRefId, pSyncNode->rid);
+ syncNodeRelease(pSyncNode);
return matchOK;
}
@@ -605,56 +559,26 @@ int32_t syncForwardToPeer(int64_t rid, SRpcMsg* pMsg, bool isWeak) {
return ret;
}
-ESyncState syncGetMyRole(int64_t rid) {
- SSyncNode* pSyncNode = (SSyncNode*)taosAcquireRef(tsNodeRefId, rid);
- if (pSyncNode == NULL) {
- return TAOS_SYNC_STATE_ERROR;
- }
- ASSERT(rid == pSyncNode->rid);
- ESyncState state = pSyncNode->state;
+SSyncState syncGetState(int64_t rid) {
+ SSyncState state = {.state = TAOS_SYNC_STATE_ERROR};
+
+ SSyncNode* pSyncNode = syncNodeAcquire(rid);
+ if (pSyncNode != NULL) {
+ state.state = pSyncNode->state;
+ state.restored = pSyncNode->restoreFinish;
+ syncNodeRelease(pSyncNode);
+ }
- taosReleaseRef(tsNodeRefId, pSyncNode->rid);
return state;
}
-bool syncIsReady(int64_t rid) {
- SSyncNode* pSyncNode = (SSyncNode*)taosAcquireRef(tsNodeRefId, rid);
- if (pSyncNode == NULL) {
- return false;
- }
- ASSERT(rid == pSyncNode->rid);
- bool b = (pSyncNode->state == TAOS_SYNC_STATE_LEADER) && pSyncNode->restoreFinish;
- taosReleaseRef(tsNodeRefId, pSyncNode->rid);
-
- // if false, set error code
- if (false == b) {
- if (pSyncNode->state != TAOS_SYNC_STATE_LEADER) {
- terrno = TSDB_CODE_SYN_NOT_LEADER;
- } else {
- terrno = TSDB_CODE_APP_NOT_READY;
- }
- }
- return b;
-}
-
-bool syncIsRestoreFinish(int64_t rid) {
- SSyncNode* pSyncNode = (SSyncNode*)taosAcquireRef(tsNodeRefId, rid);
- if (pSyncNode == NULL) {
- return false;
- }
- ASSERT(rid == pSyncNode->rid);
- bool b = pSyncNode->restoreFinish;
-
- taosReleaseRef(tsNodeRefId, pSyncNode->rid);
- return b;
-}
-
+#if 0
int32_t syncGetSnapshotByIndex(int64_t rid, SyncIndex index, SSnapshot* pSnapshot) {
if (index < SYNC_INDEX_BEGIN) {
return -1;
}
- SSyncNode* pSyncNode = (SSyncNode*)taosAcquireRef(tsNodeRefId, rid);
+ SSyncNode* pSyncNode = syncNodeAcquire(rid);
if (pSyncNode == NULL) {
return -1;
}
@@ -666,7 +590,7 @@ int32_t syncGetSnapshotByIndex(int64_t rid, SyncIndex index, SSnapshot* pSnapsho
if (pEntry != NULL) {
syncEntryDestory(pEntry);
}
- taosReleaseRef(tsNodeRefId, pSyncNode->rid);
+ syncNodeRelease(pSyncNode);
return -1;
}
ASSERT(pEntry != NULL);
@@ -677,12 +601,12 @@ int32_t syncGetSnapshotByIndex(int64_t rid, SyncIndex index, SSnapshot* pSnapsho
pSnapshot->lastConfigIndex = syncNodeGetSnapshotConfigIndex(pSyncNode, index);
syncEntryDestory(pEntry);
- taosReleaseRef(tsNodeRefId, pSyncNode->rid);
+ syncNodeRelease(pSyncNode);
return 0;
}
int32_t syncGetSnapshotMeta(int64_t rid, struct SSnapshotMeta* sMeta) {
- SSyncNode* pSyncNode = (SSyncNode*)taosAcquireRef(tsNodeRefId, rid);
+ SSyncNode* pSyncNode = syncNodeAcquire(rid);
if (pSyncNode == NULL) {
return -1;
}
@@ -691,12 +615,12 @@ int32_t syncGetSnapshotMeta(int64_t rid, struct SSnapshotMeta* sMeta) {
sTrace("vgId:%d, get snapshot meta, lastConfigIndex:%" PRId64, pSyncNode->vgId, pSyncNode->pRaftCfg->lastConfigIndex);
- taosReleaseRef(tsNodeRefId, pSyncNode->rid);
+ syncNodeRelease(pSyncNode);
return 0;
}
int32_t syncGetSnapshotMetaByIndex(int64_t rid, SyncIndex snapshotIndex, struct SSnapshotMeta* sMeta) {
- SSyncNode* pSyncNode = (SSyncNode*)taosAcquireRef(tsNodeRefId, rid);
+ SSyncNode* pSyncNode = syncNodeAcquire(rid);
if (pSyncNode == NULL) {
return -1;
}
@@ -715,9 +639,10 @@ int32_t syncGetSnapshotMetaByIndex(int64_t rid, SyncIndex snapshotIndex, struct
sTrace("vgId:%d, get snapshot meta by index:%" PRId64 " lcindex:%" PRId64, pSyncNode->vgId, snapshotIndex,
sMeta->lastConfigIndex);
- taosReleaseRef(tsNodeRefId, pSyncNode->rid);
+ syncNodeRelease(pSyncNode);
return 0;
}
+#endif
SyncIndex syncNodeGetSnapshotConfigIndex(SSyncNode* pSyncNode, SyncIndex snapshotLastApplyIndex) {
ASSERT(pSyncNode->pRaftCfg->configIndexCount >= 1);
@@ -735,73 +660,57 @@ SyncIndex syncNodeGetSnapshotConfigIndex(SSyncNode* pSyncNode, SyncIndex snapsho
return lastIndex;
}
-const char* syncGetMyRoleStr(int64_t rid) {
- const char* s = syncUtilState2String(syncGetMyRole(rid));
- return s;
-}
-
-bool syncRestoreFinish(int64_t rid) {
- SSyncNode* pSyncNode = (SSyncNode*)taosAcquireRef(tsNodeRefId, rid);
- if (pSyncNode == NULL) {
- return false;
- }
- ASSERT(rid == pSyncNode->rid);
- bool restoreFinish = pSyncNode->restoreFinish;
-
- taosReleaseRef(tsNodeRefId, pSyncNode->rid);
- return restoreFinish;
-}
-
+#if 0
SyncTerm syncGetMyTerm(int64_t rid) {
- SSyncNode* pSyncNode = (SSyncNode*)taosAcquireRef(tsNodeRefId, rid);
+ SSyncNode* pSyncNode = syncNodeAcquire(rid);
if (pSyncNode == NULL) {
return TAOS_SYNC_STATE_ERROR;
}
ASSERT(rid == pSyncNode->rid);
SyncTerm term = pSyncNode->pRaftStore->currentTerm;
- taosReleaseRef(tsNodeRefId, pSyncNode->rid);
+ syncNodeRelease(pSyncNode);
return term;
}
SyncIndex syncGetLastIndex(int64_t rid) {
- SSyncNode* pSyncNode = (SSyncNode*)taosAcquireRef(tsNodeRefId, rid);
+ SSyncNode* pSyncNode = syncNodeAcquire(rid);
if (pSyncNode == NULL) {
return SYNC_INDEX_INVALID;
}
ASSERT(rid == pSyncNode->rid);
SyncIndex lastIndex = syncNodeGetLastIndex(pSyncNode);
- taosReleaseRef(tsNodeRefId, pSyncNode->rid);
+ syncNodeRelease(pSyncNode);
return lastIndex;
}
SyncIndex syncGetCommitIndex(int64_t rid) {
- SSyncNode* pSyncNode = (SSyncNode*)taosAcquireRef(tsNodeRefId, rid);
+ SSyncNode* pSyncNode = syncNodeAcquire(rid);
if (pSyncNode == NULL) {
return SYNC_INDEX_INVALID;
}
ASSERT(rid == pSyncNode->rid);
SyncIndex cmtIndex = pSyncNode->commitIndex;
- taosReleaseRef(tsNodeRefId, pSyncNode->rid);
+ syncNodeRelease(pSyncNode);
return cmtIndex;
}
SyncGroupId syncGetVgId(int64_t rid) {
- SSyncNode* pSyncNode = (SSyncNode*)taosAcquireRef(tsNodeRefId, rid);
+ SSyncNode* pSyncNode = syncNodeAcquire(rid);
if (pSyncNode == NULL) {
return TAOS_SYNC_STATE_ERROR;
}
ASSERT(rid == pSyncNode->rid);
SyncGroupId vgId = pSyncNode->vgId;
- taosReleaseRef(tsNodeRefId, pSyncNode->rid);
+ syncNodeRelease(pSyncNode);
return vgId;
}
void syncGetEpSet(int64_t rid, SEpSet* pEpSet) {
- SSyncNode* pSyncNode = (SSyncNode*)taosAcquireRef(tsNodeRefId, rid);
+ SSyncNode* pSyncNode = syncNodeAcquire(rid);
if (pSyncNode == NULL) {
memset(pEpSet, 0, sizeof(*pEpSet));
return;
@@ -817,11 +726,12 @@ void syncGetEpSet(int64_t rid, SEpSet* pEpSet) {
pEpSet->inUse = pSyncNode->pRaftCfg->cfg.myIndex;
sInfo("vgId:%d, sync get epset in-use:%d", pSyncNode->vgId, pEpSet->inUse);
- taosReleaseRef(tsNodeRefId, pSyncNode->rid);
+ syncNodeRelease(pSyncNode);
}
+#endif
void syncGetRetryEpSet(int64_t rid, SEpSet* pEpSet) {
- SSyncNode* pSyncNode = (SSyncNode*)taosAcquireRef(tsNodeRefId, rid);
+ SSyncNode* pSyncNode = syncNodeAcquire(rid);
if (pSyncNode == NULL) {
memset(pEpSet, 0, sizeof(*pEpSet));
return;
@@ -840,33 +750,9 @@ void syncGetRetryEpSet(int64_t rid, SEpSet* pEpSet) {
}
sInfo("vgId:%d, sync get retry epset in-use:%d", pSyncNode->vgId, pEpSet->inUse);
- taosReleaseRef(tsNodeRefId, pSyncNode->rid);
+ syncNodeRelease(pSyncNode);
}
-
-int32_t syncGetRespRpc(int64_t rid, uint64_t index, SRpcMsg* msg) {
- SSyncNode* pSyncNode = (SSyncNode*)taosAcquireRef(tsNodeRefId, rid);
- if (pSyncNode == NULL) {
- return TAOS_SYNC_STATE_ERROR;
- }
- ASSERT(rid == pSyncNode->rid);
-
- SRespStub stub;
- int32_t ret = syncRespMgrGet(pSyncNode->pSyncRespMgr, index, &stub);
- if (ret == 1) {
- memcpy(msg, &(stub.rpcMsg), sizeof(SRpcMsg));
- }
-
- taosReleaseRef(tsNodeRefId, pSyncNode->rid);
- return ret;
-}
-
-int32_t syncGetAndDelRespRpc(int64_t rid, uint64_t index, SRpcHandleInfo* pInfo) {
- SSyncNode* pSyncNode = (SSyncNode*)taosAcquireRef(tsNodeRefId, rid);
- if (pSyncNode == NULL) {
- return TAOS_SYNC_STATE_ERROR;
- }
- ASSERT(rid == pSyncNode->rid);
-
+static void syncGetAndDelRespRpc(SSyncNode* pSyncNode, uint64_t index, SRpcHandleInfo* pInfo) {
SRespStub stub;
int32_t ret = syncRespMgrGetAndDel(pSyncNode->pSyncRespMgr, index, &stub);
if (ret == 1) {
@@ -874,81 +760,32 @@ int32_t syncGetAndDelRespRpc(int64_t rid, uint64_t index, SRpcHandleInfo* pInfo)
}
sTrace("vgId:%d, get seq:%" PRIu64 " rpc handle:%p", pSyncNode->vgId, index, pInfo->handle);
- taosReleaseRef(tsNodeRefId, pSyncNode->rid);
- return ret;
-}
-
-void syncSetMsgCb(int64_t rid, const SMsgCb* msgcb) {
- SSyncNode* pSyncNode = (SSyncNode*)taosAcquireRef(tsNodeRefId, rid);
- if (pSyncNode == NULL) {
- sTrace("syncSetQ get pSyncNode is NULL, rid:%" PRId64, rid);
- return;
- }
- ASSERT(rid == pSyncNode->rid);
- pSyncNode->msgcb = msgcb;
-
- taosReleaseRef(tsNodeRefId, pSyncNode->rid);
}
char* sync2SimpleStr(int64_t rid) {
- SSyncNode* pSyncNode = (SSyncNode*)taosAcquireRef(tsNodeRefId, rid);
+ SSyncNode* pSyncNode = syncNodeAcquire(rid);
if (pSyncNode == NULL) {
sTrace("syncSetRpc get pSyncNode is NULL, rid:%" PRId64, rid);
return NULL;
}
ASSERT(rid == pSyncNode->rid);
char* s = syncNode2SimpleStr(pSyncNode);
- taosReleaseRef(tsNodeRefId, pSyncNode->rid);
+ syncNodeRelease(pSyncNode);
return s;
}
-void setPingTimerMS(int64_t rid, int32_t pingTimerMS) {
- SSyncNode* pSyncNode = (SSyncNode*)taosAcquireRef(tsNodeRefId, rid);
- if (pSyncNode == NULL) {
- return;
- }
- ASSERT(rid == pSyncNode->rid);
- pSyncNode->pingBaseLine = pingTimerMS;
- pSyncNode->pingTimerMS = pingTimerMS;
-
- taosReleaseRef(tsNodeRefId, pSyncNode->rid);
-}
-
-void setElectTimerMS(int64_t rid, int32_t electTimerMS) {
- SSyncNode* pSyncNode = (SSyncNode*)taosAcquireRef(tsNodeRefId, rid);
- if (pSyncNode == NULL) {
- return;
- }
- ASSERT(rid == pSyncNode->rid);
- pSyncNode->electBaseLine = electTimerMS;
-
- taosReleaseRef(tsNodeRefId, pSyncNode->rid);
-}
-
-void setHeartbeatTimerMS(int64_t rid, int32_t hbTimerMS) {
- SSyncNode* pSyncNode = (SSyncNode*)taosAcquireRef(tsNodeRefId, rid);
- if (pSyncNode == NULL) {
- return;
- }
- ASSERT(rid == pSyncNode->rid);
- pSyncNode->hbBaseLine = hbTimerMS;
- pSyncNode->heartbeatTimerMS = hbTimerMS;
-
- taosReleaseRef(tsNodeRefId, pSyncNode->rid);
-}
-
int32_t syncPropose(int64_t rid, SRpcMsg* pMsg, bool isWeak) {
- SSyncNode* pSyncNode = taosAcquireRef(tsNodeRefId, rid);
+ SSyncNode* pSyncNode = syncNodeAcquire(rid);
if (pSyncNode == NULL) {
- taosReleaseRef(tsNodeRefId, rid);
+ syncNodeRelease(pSyncNode);
terrno = TSDB_CODE_SYN_INTERNAL_ERROR;
return -1;
}
ASSERT(rid == pSyncNode->rid);
int32_t ret = syncNodePropose(pSyncNode, pMsg, isWeak);
- taosReleaseRef(tsNodeRefId, pSyncNode->rid);
+ syncNodeRelease(pSyncNode);
return ret;
}
@@ -1034,7 +871,7 @@ int32_t syncNodePropose(SSyncNode* pSyncNode, SRpcMsg* pMsg, bool isWeak) {
}
} else {
- if (pSyncNode->FpEqMsg != NULL && (*pSyncNode->FpEqMsg)(pSyncNode->msgcb, &rpcMsg) == 0) {
+ if (pSyncNode->syncEqMsg != NULL && (*pSyncNode->syncEqMsg)(pSyncNode->msgcb, &rpcMsg) == 0) {
ret = 0;
} else {
ret = -1;
@@ -1049,7 +886,7 @@ int32_t syncNodePropose(SSyncNode* pSyncNode, SRpcMsg* pMsg, bool isWeak) {
} else {
ret = -1;
terrno = TSDB_CODE_SYN_NOT_LEADER;
- sError("vgId:%d, sync propose not leader, %s, type:%s", pSyncNode->vgId, syncUtilState2String(pSyncNode->state),
+ sError("vgId:%d, sync propose not leader, %s, type:%s", pSyncNode->vgId, syncStr(pSyncNode->state),
TMSG_INFO(pMsg->msgType));
goto _END;
}
@@ -1070,7 +907,7 @@ int32_t syncHbTimerInit(SSyncNode* pSyncNode, SSyncTimer* pSyncTimer, SRaftId de
int32_t syncHbTimerStart(SSyncNode* pSyncNode, SSyncTimer* pSyncTimer) {
int32_t ret = 0;
- if (syncEnvIsStart()) {
+ if (syncIsInit()) {
SSyncHbTimerData* pData = taosMemoryMalloc(sizeof(SSyncHbTimerData));
pData->pSyncNode = pSyncNode;
pData->pTimer = pSyncTimer;
@@ -1078,7 +915,7 @@ int32_t syncHbTimerStart(SSyncNode* pSyncNode, SSyncTimer* pSyncTimer) {
pData->logicClock = pSyncTimer->logicClock;
pSyncTimer->pData = pData;
- taosTmrReset(pSyncTimer->timerCb, pSyncTimer->timerMS, pData, gSyncEnv->pTimerManager, &pSyncTimer->pTimer);
+ taosTmrReset(pSyncTimer->timerCb, pSyncTimer->timerMS, pData, syncEnv()->pTimerManager, &pSyncTimer->pTimer);
} else {
sError("vgId:%d, start ctrl hb timer error, sync env is stop", pSyncNode->vgId);
}
@@ -1132,7 +969,8 @@ SSyncNode* syncNodeOpen(SSyncInfo* pSyncInfo) {
sError("vgId:%d, failed to open raft cfg file at %s", pSyncNode->vgId, pSyncNode->configPath);
goto _error;
}
- if (pSyncInfo->syncCfg.replicaNum > 0 && pSyncInfo->syncCfg.replicaNum != pSyncNode->pRaftCfg->cfg.replicaNum) {
+
+ if (pSyncInfo->syncCfg.replicaNum > 0 && syncIsConfigChanged(&pSyncNode->pRaftCfg->cfg, &pSyncInfo->syncCfg)) {
sInfo("vgId:%d, use sync config from input options and write to cfg file", pSyncNode->vgId);
pSyncNode->pRaftCfg->cfg = pSyncInfo->syncCfg;
if (raftCfgPersist(pSyncNode->pRaftCfg) != 0) {
@@ -1164,9 +1002,9 @@ SSyncNode* syncNodeOpen(SSyncInfo* pSyncInfo) {
pSyncNode->pWal = pSyncInfo->pWal;
pSyncNode->msgcb = pSyncInfo->msgcb;
- pSyncNode->FpSendMsg = pSyncInfo->FpSendMsg;
- pSyncNode->FpEqMsg = pSyncInfo->FpEqMsg;
- pSyncNode->FpEqCtrlMsg = pSyncInfo->FpEqCtrlMsg;
+ pSyncNode->syncSendMSg = pSyncInfo->syncSendMSg;
+ pSyncNode->syncEqMsg = pSyncInfo->syncEqMsg;
+ pSyncNode->syncEqCtrlMsg = pSyncInfo->syncEqCtrlMsg;
// init raft config
pSyncNode->pRaftCfg = raftCfgOpen(pSyncNode->configPath);
@@ -1438,6 +1276,14 @@ void syncNodeStartStandBy(SSyncNode* pSyncNode) {
ASSERT(ret == 0);
}
+void syncNodePreClose(SSyncNode* pSyncNode) {
+ // stop elect timer
+ syncNodeStopElectTimer(pSyncNode);
+
+ // stop heartbeat timer
+ syncNodeStopHeartbeatTimer(pSyncNode);
+}
+
void syncNodeClose(SSyncNode* pSyncNode) {
if (pSyncNode == NULL) {
return;
@@ -1542,8 +1388,8 @@ int32_t syncNodePingAll(SSyncNode* pSyncNode) {
// timer control --------------
int32_t syncNodeStartPingTimer(SSyncNode* pSyncNode) {
int32_t ret = 0;
- if (syncEnvIsStart()) {
- taosTmrReset(pSyncNode->FpPingTimerCB, pSyncNode->pingTimerMS, pSyncNode, gSyncEnv->pTimerManager,
+ if (syncIsInit()) {
+ taosTmrReset(pSyncNode->FpPingTimerCB, pSyncNode->pingTimerMS, pSyncNode, syncEnv()->pTimerManager,
&pSyncNode->pPingTimer);
atomic_store_64(&pSyncNode->pingTimerLogicClock, pSyncNode->pingTimerLogicClockUser);
} else {
@@ -1562,7 +1408,7 @@ int32_t syncNodeStopPingTimer(SSyncNode* pSyncNode) {
int32_t syncNodeStartElectTimer(SSyncNode* pSyncNode, int32_t ms) {
int32_t ret = 0;
- if (syncEnvIsStart()) {
+ if (syncIsInit()) {
pSyncNode->electTimerMS = ms;
SElectTimer* pElectTimer = taosMemoryMalloc(sizeof(SElectTimer));
@@ -1570,7 +1416,7 @@ int32_t syncNodeStartElectTimer(SSyncNode* pSyncNode, int32_t ms) {
pElectTimer->pSyncNode = pSyncNode;
pElectTimer->pData = NULL;
- taosTmrReset(pSyncNode->FpElectTimerCB, pSyncNode->electTimerMS, pElectTimer, gSyncEnv->pTimerManager,
+ taosTmrReset(pSyncNode->FpElectTimerCB, pSyncNode->electTimerMS, pElectTimer, syncEnv()->pTimerManager,
&pSyncNode->pElectTimer);
} else {
@@ -1618,8 +1464,8 @@ int32_t syncNodeResetElectTimer(SSyncNode* pSyncNode) {
static int32_t syncNodeDoStartHeartbeatTimer(SSyncNode* pSyncNode) {
int32_t ret = 0;
- if (syncEnvIsStart()) {
- taosTmrReset(pSyncNode->FpHeartbeatTimerCB, pSyncNode->heartbeatTimerMS, pSyncNode, gSyncEnv->pTimerManager,
+ if (syncIsInit()) {
+ taosTmrReset(pSyncNode->FpHeartbeatTimerCB, pSyncNode->heartbeatTimerMS, pSyncNode, syncEnv()->pTimerManager,
&pSyncNode->pHeartbeatTimer);
atomic_store_64(&pSyncNode->heartbeatTimerLogicClock, pSyncNode->heartbeatTimerLogicClockUser);
} else {
@@ -1682,12 +1528,12 @@ int32_t syncNodeRestartHeartbeatTimer(SSyncNode* pSyncNode) {
int32_t syncNodeSendMsgById(const SRaftId* destRaftId, SSyncNode* pSyncNode, SRpcMsg* pMsg) {
SEpSet epSet;
syncUtilraftId2EpSet(destRaftId, &epSet);
- if (pSyncNode->FpSendMsg != NULL) {
+ if (pSyncNode->syncSendMSg != NULL) {
// htonl
syncUtilMsgHtoN(pMsg->pCont);
pMsg->info.noResp = 1;
- pSyncNode->FpSendMsg(&epSet, pMsg);
+ pSyncNode->syncSendMSg(&epSet, pMsg);
} else {
sError("vgId:%d, sync send msg by id error, fp-send-msg is null", pSyncNode->vgId);
return -1;
@@ -1699,12 +1545,12 @@ int32_t syncNodeSendMsgById(const SRaftId* destRaftId, SSyncNode* pSyncNode, SRp
int32_t syncNodeSendMsgByInfo(const SNodeInfo* nodeInfo, SSyncNode* pSyncNode, SRpcMsg* pMsg) {
SEpSet epSet;
syncUtilnodeInfo2EpSet(nodeInfo, &epSet);
- if (pSyncNode->FpSendMsg != NULL) {
+ if (pSyncNode->syncSendMSg != NULL) {
// htonl
syncUtilMsgHtoN(pMsg->pCont);
pMsg->info.noResp = 1;
- pSyncNode->FpSendMsg(&epSet, pMsg);
+ pSyncNode->syncSendMSg(&epSet, pMsg);
} else {
sError("vgId:%d, sync send msg by info error, fp-send-msg is null", pSyncNode->vgId);
}
@@ -1728,13 +1574,13 @@ cJSON* syncNode2Json(const SSyncNode* pSyncNode) {
snprintf(u64buf, sizeof(u64buf), "%p", pSyncNode->msgcb);
cJSON_AddStringToObject(pRoot, "rpcClient", u64buf);
- snprintf(u64buf, sizeof(u64buf), "%p", pSyncNode->FpSendMsg);
- cJSON_AddStringToObject(pRoot, "FpSendMsg", u64buf);
+ snprintf(u64buf, sizeof(u64buf), "%p", pSyncNode->syncSendMSg);
+ cJSON_AddStringToObject(pRoot, "syncSendMSg", u64buf);
snprintf(u64buf, sizeof(u64buf), "%p", pSyncNode->msgcb);
cJSON_AddStringToObject(pRoot, "queue", u64buf);
- snprintf(u64buf, sizeof(u64buf), "%p", pSyncNode->FpEqMsg);
- cJSON_AddStringToObject(pRoot, "FpEqMsg", u64buf);
+ snprintf(u64buf, sizeof(u64buf), "%p", pSyncNode->syncEqMsg);
+ cJSON_AddStringToObject(pRoot, "syncEqMsg", u64buf);
// init internal
cJSON* pMe = syncUtilNodeInfo2Json(&pSyncNode->myNodeInfo);
@@ -1774,7 +1620,7 @@ cJSON* syncNode2Json(const SSyncNode* pSyncNode) {
// tla+ server vars
cJSON_AddNumberToObject(pRoot, "state", pSyncNode->state);
- cJSON_AddStringToObject(pRoot, "state_str", syncUtilState2String(pSyncNode->state));
+ cJSON_AddStringToObject(pRoot, "state_str", syncStr(pSyncNode->state));
cJSON_AddItemToObject(pRoot, "pRaftStore", raftStore2Json(pSyncNode->pRaftStore));
// tla+ candidate vars
@@ -1914,7 +1760,7 @@ inline void syncNodeEventLog(const SSyncNode* pSyncNode, char* str) {
"stgy:%d, bch:%d, "
"r-num:%d, "
"lcfg:%" PRId64 ", chging:%d, rsto:%d, dquorum:%d, elt:%" PRId64 ", hb:%" PRId64 ", %s, %s",
- pSyncNode->vgId, syncUtilState2String(pSyncNode->state), str, pSyncNode->pRaftStore->currentTerm,
+ pSyncNode->vgId, syncStr(pSyncNode->state), str, pSyncNode->pRaftStore->currentTerm,
pSyncNode->commitIndex, logBeginIndex, logLastIndex, pSyncNode->minMatchIndex, snapshot.lastApplyIndex,
snapshot.lastApplyTerm, pSyncNode->pRaftCfg->isStandBy, pSyncNode->pRaftCfg->snapshotStrategy,
pSyncNode->pRaftCfg->batchSize, pSyncNode->replicaNum, pSyncNode->pRaftCfg->lastConfigIndex,
@@ -1938,7 +1784,7 @@ inline void syncNodeEventLog(const SSyncNode* pSyncNode, char* str) {
"stgy:%d, bch:%d, "
"r-num:%d, "
"lcfg:%" PRId64 ", chging:%d, rsto:%d, dquorum:%d, elt:%" PRId64 ", hb:%" PRId64 ", %s, %s",
- pSyncNode->vgId, syncUtilState2String(pSyncNode->state), str, pSyncNode->pRaftStore->currentTerm,
+ pSyncNode->vgId, syncStr(pSyncNode->state), str, pSyncNode->pRaftStore->currentTerm,
pSyncNode->commitIndex, logBeginIndex, logLastIndex, pSyncNode->minMatchIndex, snapshot.lastApplyIndex,
snapshot.lastApplyTerm, pSyncNode->pRaftCfg->isStandBy, pSyncNode->pRaftCfg->snapshotStrategy,
pSyncNode->pRaftCfg->batchSize, pSyncNode->replicaNum, pSyncNode->pRaftCfg->lastConfigIndex,
@@ -1992,7 +1838,7 @@ inline void syncNodeErrorLog(const SSyncNode* pSyncNode, char* str) {
"stgy:%d, bch:%d, "
"r-num:%d, "
"lcfg:%" PRId64 ", chging:%d, rsto:%d, dquorum:%d, elt:%" PRId64 ", hb:%" PRId64 ", %s",
- pSyncNode->vgId, syncUtilState2String(pSyncNode->state), str, pSyncNode->pRaftStore->currentTerm,
+ pSyncNode->vgId, syncStr(pSyncNode->state), str, pSyncNode->pRaftStore->currentTerm,
pSyncNode->commitIndex, logBeginIndex, logLastIndex, pSyncNode->minMatchIndex, snapshot.lastApplyIndex,
snapshot.lastApplyTerm, pSyncNode->pRaftCfg->isStandBy, pSyncNode->pRaftCfg->snapshotStrategy,
pSyncNode->pRaftCfg->batchSize, pSyncNode->replicaNum, pSyncNode->pRaftCfg->lastConfigIndex,
@@ -2014,7 +1860,7 @@ inline void syncNodeErrorLog(const SSyncNode* pSyncNode, char* str) {
"stgy:%d, bch:%d, "
"r-num:%d, "
"lcfg:%" PRId64 ", chging:%d, rsto:%d, dquorum:%d, elt:%" PRId64 ", hb:%" PRId64 ", %s",
- pSyncNode->vgId, syncUtilState2String(pSyncNode->state), str, pSyncNode->pRaftStore->currentTerm,
+ pSyncNode->vgId, syncStr(pSyncNode->state), str, pSyncNode->pRaftStore->currentTerm,
pSyncNode->commitIndex, logBeginIndex, logLastIndex, pSyncNode->minMatchIndex, snapshot.lastApplyIndex,
snapshot.lastApplyTerm, pSyncNode->pRaftCfg->isStandBy, pSyncNode->pRaftCfg->snapshotStrategy,
pSyncNode->pRaftCfg->batchSize, pSyncNode->replicaNum, pSyncNode->pRaftCfg->lastConfigIndex,
@@ -2046,9 +1892,9 @@ inline char* syncNode2SimpleStr(const SSyncNode* pSyncNode) {
", sby:%d, "
"r-num:%d, "
"lcfg:%" PRId64 ", chging:%d, rsto:%d",
- pSyncNode->vgId, syncUtilState2String(pSyncNode->state), pSyncNode->pRaftStore->currentTerm,
- pSyncNode->commitIndex, logBeginIndex, logLastIndex, snapshot.lastApplyIndex, pSyncNode->pRaftCfg->isStandBy,
- pSyncNode->replicaNum, pSyncNode->pRaftCfg->lastConfigIndex, pSyncNode->changing, pSyncNode->restoreFinish);
+ pSyncNode->vgId, syncStr(pSyncNode->state), pSyncNode->pRaftStore->currentTerm, pSyncNode->commitIndex,
+ logBeginIndex, logLastIndex, snapshot.lastApplyIndex, pSyncNode->pRaftCfg->isStandBy, pSyncNode->replicaNum,
+ pSyncNode->pRaftCfg->lastConfigIndex, pSyncNode->changing, pSyncNode->restoreFinish);
return s;
}
@@ -2095,12 +1941,11 @@ static bool syncIsConfigChanged(const SSyncCfg* pOldCfg, const SSyncCfg* pNewCfg
void syncNodeDoConfigChange(SSyncNode* pSyncNode, SSyncCfg* pNewConfig, SyncIndex lastConfigChangeIndex) {
SSyncCfg oldConfig = pSyncNode->pRaftCfg->cfg;
-#if 1
if (!syncIsConfigChanged(&oldConfig, pNewConfig)) {
sInfo("vgId:1, sync not reconfig since not changed");
return;
}
-#endif
+
pSyncNode->pRaftCfg->cfg = *pNewConfig;
pSyncNode->pRaftCfg->lastConfigIndex = lastConfigChangeIndex;
@@ -2311,17 +2156,6 @@ _END:
return;
}
-SSyncNode* syncNodeAcquire(int64_t rid) {
- SSyncNode* pNode = taosAcquireRef(tsNodeRefId, rid);
- if (pNode == NULL) {
- sTrace("failed to acquire node from refId:%" PRId64, rid);
- }
-
- return pNode;
-}
-
-void syncNodeRelease(SSyncNode* pNode) { taosReleaseRef(tsNodeRefId, pNode->rid); }
-
// raft state change --------------
void syncNodeUpdateTerm(SSyncNode* pSyncNode, SyncTerm term) {
if (term > pSyncNode->pRaftStore->currentTerm) {
@@ -2340,7 +2174,13 @@ void syncNodeUpdateTermWithoutStepDown(SSyncNode* pSyncNode, SyncTerm term) {
}
void syncNodeStepDown(SSyncNode* pSyncNode, SyncTerm newTerm) {
- ASSERT(pSyncNode->pRaftStore->currentTerm <= newTerm);
+ if (pSyncNode->pRaftStore->currentTerm > newTerm) {
+ char logBuf[128];
+ snprintf(logBuf, sizeof(logBuf), "step down, ignore, new-term:%" PRIu64 ", current-term:%" PRIu64, newTerm,
+ pSyncNode->pRaftStore->currentTerm);
+ syncNodeEventLog(pSyncNode, logBuf);
+ return;
+ }
do {
char logBuf[128];
@@ -2458,6 +2298,7 @@ void syncNodeBecomeLeader(SSyncNode* pSyncNode, const char* debugStr) {
// init peer mgr
syncNodePeerStateInit(pSyncNode);
+#if 0
// update sender private term
SSyncSnapshotSender* pMySender = syncNodeGetSnapshotSender(pSyncNode, &(pSyncNode->myRaftId));
if (pMySender != NULL) {
@@ -2468,6 +2309,7 @@ void syncNodeBecomeLeader(SSyncNode* pSyncNode, const char* debugStr) {
}
(pMySender->privateTerm) += 100;
}
+#endif
// close receiver
if (snapshotReceiverIsStart(pSyncNode->pNewNodeReceiver)) {
@@ -2759,8 +2601,8 @@ static void syncNodeEqPingTimer(void* param, void* tmrId) {
SRpcMsg rpcMsg;
syncTimeout2RpcMsg(pSyncMsg, &rpcMsg);
syncRpcMsgLog2((char*)"==syncNodeEqPingTimer==", &rpcMsg);
- if (pSyncNode->FpEqMsg != NULL) {
- int32_t code = pSyncNode->FpEqMsg(pSyncNode->msgcb, &rpcMsg);
+ if (pSyncNode->syncEqMsg != NULL) {
+ int32_t code = pSyncNode->syncEqMsg(pSyncNode->msgcb, &rpcMsg);
if (code != 0) {
sError("vgId:%d, sync enqueue ping msg error, code:%d", pSyncNode->vgId, code);
rpcFreeCont(rpcMsg.pCont);
@@ -2768,12 +2610,12 @@ static void syncNodeEqPingTimer(void* param, void* tmrId) {
return;
}
} else {
- sTrace("syncNodeEqPingTimer pSyncNode->FpEqMsg is NULL");
+ sTrace("syncNodeEqPingTimer pSyncNode->syncEqMsg is NULL");
}
syncTimeoutDestroy(pSyncMsg);
- if (syncEnvIsStart()) {
- taosTmrReset(syncNodeEqPingTimer, pSyncNode->pingTimerMS, pSyncNode, gSyncEnv->pTimerManager,
+ if (syncIsInit()) {
+ taosTmrReset(syncNodeEqPingTimer, pSyncNode->pingTimerMS, pSyncNode, syncEnv()->pTimerManager,
&pSyncNode->pPingTimer);
} else {
sError("sync env is stop, syncNodeEqPingTimer");
@@ -2793,8 +2635,8 @@ static void syncNodeEqElectTimer(void* param, void* tmrId) {
pSyncNode->vgId, pSyncNode);
SRpcMsg rpcMsg;
syncTimeout2RpcMsg(pSyncMsg, &rpcMsg);
- if (pSyncNode->FpEqMsg != NULL) {
- int32_t code = pSyncNode->FpEqMsg(pSyncNode->msgcb, &rpcMsg);
+ if (pSyncNode->syncEqMsg != NULL && pSyncNode->msgcb != NULL && pSyncNode->msgcb->putToQueueFp != NULL) {
+ int32_t code = pSyncNode->syncEqMsg(pSyncNode->msgcb, &rpcMsg);
if (code != 0) {
sError("vgId:%d, sync enqueue elect msg error, code:%d", pSyncNode->vgId, code);
rpcFreeCont(rpcMsg.pCont);
@@ -2810,7 +2652,7 @@ static void syncNodeEqElectTimer(void* param, void* tmrId) {
} while (0);
} else {
- sTrace("syncNodeEqElectTimer FpEqMsg is NULL");
+ sTrace("syncNodeEqElectTimer syncEqMsg is NULL");
}
syncTimeoutDestroy(pSyncMsg);
@@ -2818,9 +2660,9 @@ static void syncNodeEqElectTimer(void* param, void* tmrId) {
#if 0
// reset timer ms
- if (syncEnvIsStart() && pSyncNode->electBaseLine > 0) {
+ if (syncIsInit() && pSyncNode->electBaseLine > 0) {
pSyncNode->electTimerMS = syncUtilElectRandomMS(pSyncNode->electBaseLine, 2 * pSyncNode->electBaseLine);
- taosTmrReset(syncNodeEqElectTimer, pSyncNode->electTimerMS, pSyncNode, gSyncEnv->pTimerManager,
+ taosTmrReset(syncNodeEqElectTimer, pSyncNode->electTimerMS, pSyncNode, syncEnv()->pTimerManager,
&pSyncNode->pElectTimer);
} else {
sError("sync env is stop, syncNodeEqElectTimer");
@@ -2842,8 +2684,8 @@ static void syncNodeEqHeartbeatTimer(void* param, void* tmrId) {
SRpcMsg rpcMsg;
syncTimeout2RpcMsg(pSyncMsg, &rpcMsg);
syncRpcMsgLog2((char*)"==syncNodeEqHeartbeatTimer==", &rpcMsg);
- if (pSyncNode->FpEqMsg != NULL) {
- int32_t code = pSyncNode->FpEqMsg(pSyncNode->msgcb, &rpcMsg);
+ if (pSyncNode->syncEqMsg != NULL) {
+ int32_t code = pSyncNode->syncEqMsg(pSyncNode->msgcb, &rpcMsg);
if (code != 0) {
sError("vgId:%d, sync enqueue timer msg error, code:%d", pSyncNode->vgId, code);
rpcFreeCont(rpcMsg.pCont);
@@ -2851,12 +2693,12 @@ static void syncNodeEqHeartbeatTimer(void* param, void* tmrId) {
return;
}
} else {
- sError("vgId:%d, enqueue msg cb ptr (i.e. FpEqMsg) not set.", pSyncNode->vgId);
+ sError("vgId:%d, enqueue msg cb ptr (i.e. syncEqMsg) not set.", pSyncNode->vgId);
}
syncTimeoutDestroy(pSyncMsg);
- if (syncEnvIsStart()) {
- taosTmrReset(syncNodeEqHeartbeatTimer, pSyncNode->heartbeatTimerMS, pSyncNode, gSyncEnv->pTimerManager,
+ if (syncIsInit()) {
+ taosTmrReset(syncNodeEqHeartbeatTimer, pSyncNode->heartbeatTimerMS, pSyncNode, syncEnv()->pTimerManager,
&pSyncNode->pHeartbeatTimer);
} else {
sError("sync env is stop, syncNodeEqHeartbeatTimer");
@@ -2898,8 +2740,8 @@ static void syncNodeEqPeerHeartbeatTimer(void* param, void* tmrId) {
// eq msg
#if 0
- if (pSyncNode->FpEqCtrlMsg != NULL) {
- int32_t code = pSyncNode->FpEqCtrlMsg(pSyncNode->msgcb, &rpcMsg);
+ if (pSyncNode->syncEqCtrlMsg != NULL) {
+ int32_t code = pSyncNode->syncEqCtrlMsg(pSyncNode->msgcb, &rpcMsg);
if (code != 0) {
sError("vgId:%d, sync ctrl enqueue timer msg error, code:%d", pSyncNode->vgId, code);
rpcFreeCont(rpcMsg.pCont);
@@ -2907,7 +2749,7 @@ static void syncNodeEqPeerHeartbeatTimer(void* param, void* tmrId) {
return;
}
} else {
- sError("vgId:%d, enqueue ctrl msg cb ptr (i.e. FpEqMsg) not set.", pSyncNode->vgId);
+ sError("vgId:%d, enqueue ctrl msg cb ptr (i.e. syncEqMsg) not set.", pSyncNode->vgId);
}
#endif
@@ -2916,8 +2758,8 @@ static void syncNodeEqPeerHeartbeatTimer(void* param, void* tmrId) {
syncHeartbeatDestroy(pSyncMsg);
- if (syncEnvIsStart()) {
- taosTmrReset(syncNodeEqPeerHeartbeatTimer, pSyncTimer->timerMS, pData, gSyncEnv->pTimerManager,
+ if (syncIsInit()) {
+ taosTmrReset(syncNodeEqPeerHeartbeatTimer, pSyncTimer->timerMS, pData, syncEnv()->pTimerManager,
&pSyncTimer->pTimer);
} else {
sError("sync env is stop, syncNodeEqHeartbeatTimer");
@@ -2947,10 +2789,10 @@ static int32_t syncNodeEqNoop(SSyncNode* ths) {
SRpcMsg rpcMsg = {0};
syncClientRequest2RpcMsg(pSyncMsg, &rpcMsg);
- if (ths->FpEqMsg != NULL) {
- ths->FpEqMsg(ths->msgcb, &rpcMsg);
+ if (ths->syncEqMsg != NULL) {
+ ths->syncEqMsg(ths->msgcb, &rpcMsg);
} else {
- sTrace("syncNodeEqNoop pSyncNode->FpEqMsg is NULL");
+ sTrace("syncNodeEqNoop pSyncNode->syncEqMsg is NULL");
}
syncEntryDestory(pEntry);
@@ -3041,21 +2883,51 @@ int32_t syncNodeOnHeartbeat(SSyncNode* ths, SyncHeartbeat* pMsg) {
SRpcMsg rpcMsg;
syncHeartbeatReply2RpcMsg(pMsgReply, &rpcMsg);
-#if 1
- if (pMsg->term >= ths->pRaftStore->currentTerm && ths->state != TAOS_SYNC_STATE_FOLLOWER) {
- syncNodeStepDown(ths, pMsg->term);
- }
-#endif
-
if (pMsg->term == ths->pRaftStore->currentTerm && ths->state != TAOS_SYNC_STATE_LEADER) {
syncNodeResetElectTimer(ths);
ths->minMatchIndex = pMsg->minMatchIndex;
-#if 0
if (ths->state == TAOS_SYNC_STATE_FOLLOWER) {
- syncNodeFollowerCommit(ths, pMsg->commitIndex);
+ // syncNodeFollowerCommit(ths, pMsg->commitIndex);
+ SyncLocalCmd* pSyncMsg = syncLocalCmdBuild(ths->vgId);
+ pSyncMsg->cmd = SYNC_LOCAL_CMD_FOLLOWER_CMT;
+ pSyncMsg->fcIndex = pMsg->commitIndex;
+
+ SRpcMsg rpcMsgLocalCmd;
+ syncLocalCmd2RpcMsg(pSyncMsg, &rpcMsgLocalCmd);
+
+ if (ths->syncEqMsg != NULL && ths->msgcb != NULL) {
+ int32_t code = ths->syncEqMsg(ths->msgcb, &rpcMsgLocalCmd);
+ if (code != 0) {
+ sError("vgId:%d, sync enqueue fc-commit msg error, code:%d", ths->vgId, code);
+ rpcFreeCont(rpcMsgLocalCmd.pCont);
+ } else {
+ sTrace("vgId:%d, sync enqueue fc-commit msg, fc-index: %" PRIu64, ths->vgId, pSyncMsg->fcIndex);
+ }
+ }
}
-#endif
+ }
+
+ if (pMsg->term >= ths->pRaftStore->currentTerm && ths->state != TAOS_SYNC_STATE_FOLLOWER) {
+ // syncNodeStepDown(ths, pMsg->term);
+ SyncLocalCmd* pSyncMsg = syncLocalCmdBuild(ths->vgId);
+ pSyncMsg->cmd = SYNC_LOCAL_CMD_STEP_DOWN;
+ pSyncMsg->sdNewTerm = pMsg->term;
+
+ SRpcMsg rpcMsgLocalCmd;
+ syncLocalCmd2RpcMsg(pSyncMsg, &rpcMsgLocalCmd);
+
+ if (ths->syncEqMsg != NULL && ths->msgcb != NULL) {
+ int32_t code = ths->syncEqMsg(ths->msgcb, &rpcMsgLocalCmd);
+ if (code != 0) {
+ 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: %" PRIu64, ths->vgId, pSyncMsg->sdNewTerm);
+ }
+ }
+
+ syncLocalCmdDestroy(pSyncMsg);
}
/*
@@ -3081,6 +2953,22 @@ int32_t syncNodeOnHeartbeatReply(SSyncNode* ths, SyncHeartbeatReply* pMsg) {
return 0;
}
+int32_t syncNodeOnLocalCmd(SSyncNode* ths, SyncLocalCmd* pMsg) {
+ syncLogRecvLocalCmd(ths, pMsg, "");
+
+ if (pMsg->cmd == SYNC_LOCAL_CMD_STEP_DOWN) {
+ syncNodeStepDown(ths, pMsg->sdNewTerm);
+
+ } else if (pMsg->cmd == SYNC_LOCAL_CMD_FOLLOWER_CMT) {
+ syncNodeFollowerCommit(ths, pMsg->fcIndex);
+
+ } else {
+ syncNodeErrorLog(ths, "error local cmd");
+ }
+
+ return 0;
+}
+
// TLA+ Spec
// ClientRequest(i, v) ==
// /\ state[i] = Leader
@@ -3215,17 +3103,18 @@ int32_t syncDoLeaderTransfer(SSyncNode* ths, SRpcMsg* pRpcMsg, SSyncRaftEntry* p
}
if (ths->pFsm->FpLeaderTransferCb != NULL) {
- SFsmCbMeta cbMeta = {0};
- cbMeta.code = 0;
- cbMeta.currentTerm = ths->pRaftStore->currentTerm;
- cbMeta.flag = 0;
- cbMeta.index = pEntry->index;
- cbMeta.lastConfigIndex = syncNodeGetSnapshotConfigIndex(ths, cbMeta.index);
- cbMeta.isWeak = pEntry->isWeak;
- cbMeta.seqNum = pEntry->seqNum;
- cbMeta.state = ths->state;
- cbMeta.term = pEntry->term;
- ths->pFsm->FpLeaderTransferCb(ths->pFsm, pRpcMsg, cbMeta);
+ SFsmCbMeta cbMeta = {
+ cbMeta.code = 0,
+ cbMeta.currentTerm = ths->pRaftStore->currentTerm,
+ cbMeta.flag = 0,
+ cbMeta.index = pEntry->index,
+ cbMeta.lastConfigIndex = syncNodeGetSnapshotConfigIndex(ths, pEntry->index),
+ cbMeta.isWeak = pEntry->isWeak,
+ cbMeta.seqNum = pEntry->seqNum,
+ cbMeta.state = ths->state,
+ cbMeta.term = pEntry->term,
+ };
+ ths->pFsm->FpLeaderTransferCb(ths->pFsm, pRpcMsg, &cbMeta);
}
syncLeaderTransferDestroy(pSyncLeaderTransfer);
@@ -3379,7 +3268,8 @@ int32_t syncNodeDoCommit(SSyncNode* ths, SyncIndex beginIndex, SyncIndex endInde
// ASSERT(code == 0);
// ASSERT(pEntry != NULL);
if (code != 0 || pEntry == NULL) {
- syncNodeErrorLog(ths, "get log entry error");
+ syncNodeErrorLog(ths, "get log entry error");
+ sFatal("vgId:%d, get log entry %" PRId64 " error when commit since %s", ths->vgId, i, terrstr());
continue;
}
}
@@ -3402,18 +3292,20 @@ int32_t syncNodeDoCommit(SSyncNode* ths, SyncIndex beginIndex, SyncIndex endInde
// execute fsm in apply thread, or execute outside syncPropose
if (internalExecute) {
- SFsmCbMeta cbMeta = {0};
- cbMeta.index = pEntry->index;
- cbMeta.lastConfigIndex = syncNodeGetSnapshotConfigIndex(ths, cbMeta.index);
- cbMeta.isWeak = pEntry->isWeak;
- cbMeta.code = 0;
- cbMeta.state = ths->state;
- cbMeta.seqNum = pEntry->seqNum;
- cbMeta.term = pEntry->term;
- cbMeta.currentTerm = ths->pRaftStore->currentTerm;
- cbMeta.flag = flag;
+ SFsmCbMeta cbMeta = {
+ .index = pEntry->index,
+ .lastConfigIndex = syncNodeGetSnapshotConfigIndex(ths, pEntry->index),
+ .isWeak = pEntry->isWeak,
+ .code = 0,
+ .state = ths->state,
+ .seqNum = pEntry->seqNum,
+ .term = pEntry->term,
+ .currentTerm = ths->pRaftStore->currentTerm,
+ .flag = flag,
+ };
- ths->pFsm->FpCommitCb(ths->pFsm, &rpcMsg, cbMeta);
+ syncGetAndDelRespRpc(ths, cbMeta.seqNum, &rpcMsg.info);
+ ths->pFsm->FpCommitCb(ths->pFsm, &rpcMsg, &cbMeta);
}
}
@@ -3743,3 +3635,59 @@ void syncLogRecvHeartbeatReply(SSyncNode* pSyncNode, const SyncHeartbeatReply* p
host, port, pMsg->term, pMsg->privateTerm, s);
syncNodeEventLog(pSyncNode, logBuf);
}
+
+void syncLogRecvLocalCmd(SSyncNode* pSyncNode, const SyncLocalCmd* pMsg, const char* s) {
+ char logBuf[256];
+ snprintf(logBuf, sizeof(logBuf), "recv sync-local-cmd {cmd:%d-%s, sd-new-term:%" PRIu64 "}, %s", pMsg->cmd,
+ syncLocalCmdGetStr(pMsg->cmd), pMsg->sdNewTerm, s);
+ syncNodeEventLog(pSyncNode, logBuf);
+}
+
+void syncLogSendSyncPreSnapshot(SSyncNode* pSyncNode, const SyncPreSnapshot* pMsg, const char* s) {
+ char host[64];
+ uint16_t port;
+ syncUtilU642Addr(pMsg->destId.addr, host, sizeof(host), &port);
+ char logBuf[256];
+ snprintf(logBuf, sizeof(logBuf), "send sync-pre-snapshot to %s:%d {term:%" PRIu64 "}, %s", host, port, pMsg->term, s);
+ syncNodeEventLog(pSyncNode, logBuf);
+}
+
+void syncLogRecvSyncPreSnapshot(SSyncNode* pSyncNode, const SyncPreSnapshot* pMsg, const char* s) {
+ char host[64];
+ uint16_t port;
+ syncUtilU642Addr(pMsg->srcId.addr, host, sizeof(host), &port);
+ char logBuf[256];
+ snprintf(logBuf, sizeof(logBuf), "recv sync-pre-snapshot from %s:%d {term:%" PRIu64 "}, %s", host, port, pMsg->term,
+ s);
+ syncNodeEventLog(pSyncNode, logBuf);
+}
+
+void syncLogSendSyncPreSnapshotReply(SSyncNode* pSyncNode, const SyncPreSnapshotReply* pMsg, const char* s) {
+ char host[64];
+ uint16_t port;
+ syncUtilU642Addr(pMsg->destId.addr, host, sizeof(host), &port);
+ char logBuf[256];
+ snprintf(logBuf, sizeof(logBuf),
+ "send sync-pre-snapshot-reply to %s:%d {term:%" PRIu64 ", snap-start:%" PRId64 "}, %s", host, port,
+ pMsg->term, pMsg->snapStart, s);
+ syncNodeEventLog(pSyncNode, logBuf);
+}
+
+void syncLogRecvSyncPreSnapshotReply(SSyncNode* pSyncNode, const SyncPreSnapshotReply* pMsg, const char* s) {
+ char host[64];
+ uint16_t port;
+ syncUtilU642Addr(pMsg->srcId.addr, host, sizeof(host), &port);
+ char logBuf[256];
+ snprintf(logBuf, sizeof(logBuf),
+ "recv sync-pre-snapshot-reply from %s:%d {term:%" PRIu64 ", snap-start:%" PRId64 "}, %s", host, port,
+ pMsg->term, pMsg->snapStart, s);
+ syncNodeEventLog(pSyncNode, logBuf);
+}
+
+void syncLogSendSyncSnapshotSend(SSyncNode* pSyncNode, const SyncSnapshotSend* pMsg, const char* s) {}
+
+void syncLogRecvSyncSnapshotSend(SSyncNode* pSyncNode, const SyncSnapshotSend* pMsg, const char* s) {}
+
+void syncLogSendSyncSnapshotRsp(SSyncNode* pSyncNode, const SyncSnapshotRsp* pMsg, const char* s) {}
+
+void syncLogRecvSyncSnapshotRsp(SSyncNode* pSyncNode, const SyncSnapshotRsp* pMsg, const char* s) {}
diff --git a/source/libs/sync/src/syncMessage.c b/source/libs/sync/src/syncMessage.c
index 3c36633fe8..d0df931a88 100644
--- a/source/libs/sync/src/syncMessage.c
+++ b/source/libs/sync/src/syncMessage.c
@@ -2315,6 +2315,303 @@ void syncHeartbeatReplyLog2(char* s, const SyncHeartbeatReply* pMsg) {
}
}
+// ---- message process SyncPreSnapshot----
+SyncPreSnapshot* syncPreSnapshotBuild(int32_t vgId) {
+ uint32_t bytes = sizeof(SyncPreSnapshot);
+ SyncPreSnapshot* pMsg = taosMemoryMalloc(bytes);
+ memset(pMsg, 0, bytes);
+ pMsg->bytes = bytes;
+ pMsg->vgId = vgId;
+ pMsg->msgType = TDMT_SYNC_PRE_SNAPSHOT;
+ return pMsg;
+}
+
+void syncPreSnapshotDestroy(SyncPreSnapshot* pMsg) {
+ if (pMsg != NULL) {
+ taosMemoryFree(pMsg);
+ }
+}
+
+void syncPreSnapshotSerialize(const SyncPreSnapshot* pMsg, char* buf, uint32_t bufLen) {
+ ASSERT(pMsg->bytes <= bufLen);
+ memcpy(buf, pMsg, pMsg->bytes);
+}
+
+void syncPreSnapshotDeserialize(const char* buf, uint32_t len, SyncPreSnapshot* pMsg) {
+ memcpy(pMsg, buf, len);
+ ASSERT(len == pMsg->bytes);
+}
+
+char* syncPreSnapshotSerialize2(const SyncPreSnapshot* pMsg, uint32_t* len) {
+ char* buf = taosMemoryMalloc(pMsg->bytes);
+ ASSERT(buf != NULL);
+ syncPreSnapshotSerialize(pMsg, buf, pMsg->bytes);
+ if (len != NULL) {
+ *len = pMsg->bytes;
+ }
+ return buf;
+}
+
+SyncPreSnapshot* syncPreSnapshotDeserialize2(const char* buf, uint32_t len) {
+ uint32_t bytes = *((uint32_t*)buf);
+ SyncPreSnapshot* pMsg = taosMemoryMalloc(bytes);
+ ASSERT(pMsg != NULL);
+ syncPreSnapshotDeserialize(buf, len, pMsg);
+ ASSERT(len == pMsg->bytes);
+ return pMsg;
+}
+
+void syncPreSnapshot2RpcMsg(const SyncPreSnapshot* pMsg, SRpcMsg* pRpcMsg) {
+ memset(pRpcMsg, 0, sizeof(*pRpcMsg));
+ pRpcMsg->msgType = pMsg->msgType;
+ pRpcMsg->contLen = pMsg->bytes;
+ pRpcMsg->pCont = rpcMallocCont(pRpcMsg->contLen);
+ syncPreSnapshotSerialize(pMsg, pRpcMsg->pCont, pRpcMsg->contLen);
+}
+
+void syncPreSnapshotFromRpcMsg(const SRpcMsg* pRpcMsg, SyncPreSnapshot* pMsg) {
+ syncPreSnapshotDeserialize(pRpcMsg->pCont, pRpcMsg->contLen, pMsg);
+}
+
+SyncPreSnapshot* syncPreSnapshotFromRpcMsg2(const SRpcMsg* pRpcMsg) {
+ SyncPreSnapshot* pMsg = syncPreSnapshotDeserialize2(pRpcMsg->pCont, pRpcMsg->contLen);
+ ASSERT(pMsg != NULL);
+ return pMsg;
+}
+
+cJSON* syncPreSnapshot2Json(const SyncPreSnapshot* pMsg) {
+ char u64buf[128] = {0};
+ cJSON* pRoot = cJSON_CreateObject();
+
+ if (pMsg != NULL) {
+ cJSON_AddNumberToObject(pRoot, "bytes", pMsg->bytes);
+ cJSON_AddNumberToObject(pRoot, "vgId", pMsg->vgId);
+ cJSON_AddNumberToObject(pRoot, "msgType", pMsg->msgType);
+
+ cJSON* pSrcId = cJSON_CreateObject();
+ snprintf(u64buf, sizeof(u64buf), "%" PRIu64, pMsg->srcId.addr);
+ cJSON_AddStringToObject(pSrcId, "addr", u64buf);
+ {
+ uint64_t u64 = pMsg->srcId.addr;
+ cJSON* pTmp = pSrcId;
+ char host[128] = {0};
+ uint16_t port;
+ syncUtilU642Addr(u64, host, sizeof(host), &port);
+ cJSON_AddStringToObject(pTmp, "addr_host", host);
+ cJSON_AddNumberToObject(pTmp, "addr_port", port);
+ }
+ cJSON_AddNumberToObject(pSrcId, "vgId", pMsg->srcId.vgId);
+ cJSON_AddItemToObject(pRoot, "srcId", pSrcId);
+
+ cJSON* pDestId = cJSON_CreateObject();
+ snprintf(u64buf, sizeof(u64buf), "%" PRIu64, pMsg->destId.addr);
+ cJSON_AddStringToObject(pDestId, "addr", u64buf);
+ {
+ uint64_t u64 = pMsg->destId.addr;
+ cJSON* pTmp = pDestId;
+ char host[128] = {0};
+ uint16_t port;
+ syncUtilU642Addr(u64, host, sizeof(host), &port);
+ cJSON_AddStringToObject(pTmp, "addr_host", host);
+ cJSON_AddNumberToObject(pTmp, "addr_port", port);
+ }
+ cJSON_AddNumberToObject(pDestId, "vgId", pMsg->destId.vgId);
+ cJSON_AddItemToObject(pRoot, "destId", pDestId);
+
+ snprintf(u64buf, sizeof(u64buf), "%" PRIu64, pMsg->term);
+ cJSON_AddStringToObject(pRoot, "term", u64buf);
+ }
+
+ cJSON* pJson = cJSON_CreateObject();
+ cJSON_AddItemToObject(pJson, "SyncPreSnapshot", pRoot);
+ return pJson;
+}
+
+char* syncPreSnapshot2Str(const SyncPreSnapshot* pMsg) {
+ cJSON* pJson = syncPreSnapshot2Json(pMsg);
+ char* serialized = cJSON_Print(pJson);
+ cJSON_Delete(pJson);
+ return serialized;
+}
+
+void syncPreSnapshotPrint(const SyncPreSnapshot* pMsg) {
+ char* serialized = syncPreSnapshot2Str(pMsg);
+ printf("syncPreSnapshotPrint | len:%d | %s \n", (int32_t)strlen(serialized), serialized);
+ fflush(NULL);
+ taosMemoryFree(serialized);
+}
+
+void syncPreSnapshotPrint2(char* s, const SyncPreSnapshot* pMsg) {
+ char* serialized = syncPreSnapshot2Str(pMsg);
+ printf("syncPreSnapshotPrint2 | len:%d | %s | %s \n", (int32_t)strlen(serialized), s, serialized);
+ fflush(NULL);
+ taosMemoryFree(serialized);
+}
+
+void syncPreSnapshotLog(const SyncPreSnapshot* pMsg) {
+ char* serialized = syncPreSnapshot2Str(pMsg);
+ sTrace("syncPreSnapshotLog | len:%d | %s", (int32_t)strlen(serialized), serialized);
+ taosMemoryFree(serialized);
+}
+
+void syncPreSnapshotLog2(char* s, const SyncPreSnapshot* pMsg) {
+ if (gRaftDetailLog) {
+ char* serialized = syncPreSnapshot2Str(pMsg);
+ sTrace("syncPreSnapshotLog2 | len:%d | %s | %s", (int32_t)strlen(serialized), s, serialized);
+ taosMemoryFree(serialized);
+ }
+}
+
+// ---- message process SyncPreSnapshotReply----
+SyncPreSnapshotReply* syncPreSnapshotReplyBuild(int32_t vgId) {
+ uint32_t bytes = sizeof(SyncPreSnapshotReply);
+ SyncPreSnapshotReply* pMsg = taosMemoryMalloc(bytes);
+ memset(pMsg, 0, bytes);
+ pMsg->bytes = bytes;
+ pMsg->vgId = vgId;
+ pMsg->msgType = TDMT_SYNC_PRE_SNAPSHOT_REPLY;
+ return pMsg;
+}
+
+void syncPreSnapshotReplyDestroy(SyncPreSnapshotReply* pMsg) {
+ if (pMsg != NULL) {
+ taosMemoryFree(pMsg);
+ }
+}
+
+void syncPreSnapshotReplySerialize(const SyncPreSnapshotReply* pMsg, char* buf, uint32_t bufLen) {
+ ASSERT(pMsg->bytes <= bufLen);
+ memcpy(buf, pMsg, pMsg->bytes);
+}
+
+void syncPreSnapshotReplyDeserialize(const char* buf, uint32_t len, SyncPreSnapshotReply* pMsg) {
+ memcpy(pMsg, buf, len);
+ ASSERT(len == pMsg->bytes);
+}
+
+char* syncPreSnapshotReplySerialize2(const SyncPreSnapshotReply* pMsg, uint32_t* len) {
+ char* buf = taosMemoryMalloc(pMsg->bytes);
+ ASSERT(buf != NULL);
+ syncPreSnapshotReplySerialize(pMsg, buf, pMsg->bytes);
+ if (len != NULL) {
+ *len = pMsg->bytes;
+ }
+ return buf;
+}
+
+SyncPreSnapshotReply* syncPreSnapshotReplyDeserialize2(const char* buf, uint32_t len) {
+ uint32_t bytes = *((uint32_t*)buf);
+ SyncPreSnapshotReply* pMsg = taosMemoryMalloc(bytes);
+ ASSERT(pMsg != NULL);
+ syncPreSnapshotReplyDeserialize(buf, len, pMsg);
+ ASSERT(len == pMsg->bytes);
+ return pMsg;
+}
+
+void syncPreSnapshotReply2RpcMsg(const SyncPreSnapshotReply* pMsg, SRpcMsg* pRpcMsg) {
+ memset(pRpcMsg, 0, sizeof(*pRpcMsg));
+ pRpcMsg->msgType = pMsg->msgType;
+ pRpcMsg->contLen = pMsg->bytes;
+ pRpcMsg->pCont = rpcMallocCont(pRpcMsg->contLen);
+ syncPreSnapshotReplySerialize(pMsg, pRpcMsg->pCont, pRpcMsg->contLen);
+}
+
+void syncPreSnapshotReplyFromRpcMsg(const SRpcMsg* pRpcMsg, SyncPreSnapshotReply* pMsg) {
+ syncPreSnapshotReplyDeserialize(pRpcMsg->pCont, pRpcMsg->contLen, pMsg);
+}
+
+SyncPreSnapshotReply* syncPreSnapshotReplyFromRpcMsg2(const SRpcMsg* pRpcMsg) {
+ SyncPreSnapshotReply* pMsg = syncPreSnapshotReplyDeserialize2(pRpcMsg->pCont, pRpcMsg->contLen);
+ ASSERT(pMsg != NULL);
+ return pMsg;
+}
+
+cJSON* syncPreSnapshotReply2Json(const SyncPreSnapshotReply* pMsg) {
+ char u64buf[128] = {0};
+ cJSON* pRoot = cJSON_CreateObject();
+
+ if (pMsg != NULL) {
+ cJSON_AddNumberToObject(pRoot, "bytes", pMsg->bytes);
+ cJSON_AddNumberToObject(pRoot, "vgId", pMsg->vgId);
+ cJSON_AddNumberToObject(pRoot, "msgType", pMsg->msgType);
+
+ cJSON* pSrcId = cJSON_CreateObject();
+ snprintf(u64buf, sizeof(u64buf), "%" PRIu64, pMsg->srcId.addr);
+ cJSON_AddStringToObject(pSrcId, "addr", u64buf);
+ {
+ uint64_t u64 = pMsg->srcId.addr;
+ cJSON* pTmp = pSrcId;
+ char host[128] = {0};
+ uint16_t port;
+ syncUtilU642Addr(u64, host, sizeof(host), &port);
+ cJSON_AddStringToObject(pTmp, "addr_host", host);
+ cJSON_AddNumberToObject(pTmp, "addr_port", port);
+ }
+ cJSON_AddNumberToObject(pSrcId, "vgId", pMsg->srcId.vgId);
+ cJSON_AddItemToObject(pRoot, "srcId", pSrcId);
+
+ cJSON* pDestId = cJSON_CreateObject();
+ snprintf(u64buf, sizeof(u64buf), "%" PRIu64, pMsg->destId.addr);
+ cJSON_AddStringToObject(pDestId, "addr", u64buf);
+ {
+ uint64_t u64 = pMsg->destId.addr;
+ cJSON* pTmp = pDestId;
+ char host[128] = {0};
+ uint16_t port;
+ syncUtilU642Addr(u64, host, sizeof(host), &port);
+ cJSON_AddStringToObject(pTmp, "addr_host", host);
+ cJSON_AddNumberToObject(pTmp, "addr_port", port);
+ }
+ cJSON_AddNumberToObject(pDestId, "vgId", pMsg->destId.vgId);
+ cJSON_AddItemToObject(pRoot, "destId", pDestId);
+
+ snprintf(u64buf, sizeof(u64buf), "%" PRIu64, pMsg->term);
+ cJSON_AddStringToObject(pRoot, "term", u64buf);
+
+ snprintf(u64buf, sizeof(u64buf), "%" PRId64, pMsg->snapStart);
+ cJSON_AddStringToObject(pRoot, "snap-start", u64buf);
+ }
+
+ cJSON* pJson = cJSON_CreateObject();
+ cJSON_AddItemToObject(pJson, "SyncPreSnapshotReply", pRoot);
+ return pJson;
+}
+
+char* syncPreSnapshotReply2Str(const SyncPreSnapshotReply* pMsg) {
+ cJSON* pJson = syncPreSnapshotReply2Json(pMsg);
+ char* serialized = cJSON_Print(pJson);
+ cJSON_Delete(pJson);
+ return serialized;
+}
+
+void syncPreSnapshotReplyPrint(const SyncPreSnapshotReply* pMsg) {
+ char* serialized = syncPreSnapshotReply2Str(pMsg);
+ printf("syncPreSnapshotReplyPrint | len:%d | %s \n", (int32_t)strlen(serialized), serialized);
+ fflush(NULL);
+ taosMemoryFree(serialized);
+}
+
+void syncPreSnapshotReplyPrint2(char* s, const SyncPreSnapshotReply* pMsg) {
+ char* serialized = syncPreSnapshotReply2Str(pMsg);
+ printf("syncPreSnapshotReplyPrint2 | len:%d | %s | %s \n", (int32_t)strlen(serialized), s, serialized);
+ fflush(NULL);
+ taosMemoryFree(serialized);
+}
+
+void syncPreSnapshotReplyLog(const SyncPreSnapshotReply* pMsg) {
+ char* serialized = syncPreSnapshotReply2Str(pMsg);
+ sTrace("syncPreSnapshotReplyLog | len:%d | %s", (int32_t)strlen(serialized), serialized);
+ taosMemoryFree(serialized);
+}
+
+void syncPreSnapshotReplyLog2(char* s, const SyncPreSnapshotReply* pMsg) {
+ if (gRaftDetailLog) {
+ char* serialized = syncPreSnapshotReply2Str(pMsg);
+ sTrace("syncPreSnapshotReplyLog2 | len:%d | %s | %s", (int32_t)strlen(serialized), s, serialized);
+ taosMemoryFree(serialized);
+ }
+}
+
// ---- message process SyncApplyMsg----
SyncApplyMsg* syncApplyMsgBuild(uint32_t dataLen) {
uint32_t bytes = sizeof(SyncApplyMsg) + dataLen;
@@ -2413,7 +2710,7 @@ cJSON* syncApplyMsg2Json(const SyncApplyMsg* pMsg) {
cJSON_AddNumberToObject(pRoot, "fsmMeta.isWeak", pMsg->fsmMeta.isWeak);
cJSON_AddNumberToObject(pRoot, "fsmMeta.code", pMsg->fsmMeta.code);
cJSON_AddNumberToObject(pRoot, "fsmMeta.state", pMsg->fsmMeta.state);
- cJSON_AddStringToObject(pRoot, "fsmMeta.state.str", syncUtilState2String(pMsg->fsmMeta.state));
+ cJSON_AddStringToObject(pRoot, "fsmMeta.state.str", syncStr(pMsg->fsmMeta.state));
snprintf(u64buf, sizeof(u64buf), "%" PRIu64, pMsg->fsmMeta.seqNum);
cJSON_AddStringToObject(pRoot, "fsmMeta.seqNum", u64buf);
@@ -2576,8 +2873,8 @@ cJSON* syncSnapshotSend2Json(const SyncSnapshotSend* pMsg) {
snprintf(u64buf, sizeof(u64buf), "%" PRIu64, pMsg->term);
cJSON_AddStringToObject(pRoot, "term", u64buf);
- snprintf(u64buf, sizeof(u64buf), "%" PRIu64, pMsg->privateTerm);
- cJSON_AddStringToObject(pRoot, "privateTerm", u64buf);
+ snprintf(u64buf, sizeof(u64buf), "%" PRId64, pMsg->startTime);
+ cJSON_AddStringToObject(pRoot, "startTime", u64buf);
snprintf(u64buf, sizeof(u64buf), "%" PRId64, pMsg->beginIndex);
cJSON_AddStringToObject(pRoot, "beginIndex", u64buf);
@@ -2751,8 +3048,8 @@ cJSON* syncSnapshotRsp2Json(const SyncSnapshotRsp* pMsg) {
snprintf(u64buf, sizeof(u64buf), "%" PRIu64, pMsg->term);
cJSON_AddStringToObject(pRoot, "term", u64buf);
- snprintf(u64buf, sizeof(u64buf), "%" PRIu64, pMsg->privateTerm);
- cJSON_AddStringToObject(pRoot, "privateTerm", u64buf);
+ snprintf(u64buf, sizeof(u64buf), "%" PRId64, pMsg->startTime);
+ cJSON_AddStringToObject(pRoot, "startTime", u64buf);
snprintf(u64buf, sizeof(u64buf), "%" PRId64, pMsg->lastIndex);
cJSON_AddStringToObject(pRoot, "lastIndex", u64buf);
@@ -2762,6 +3059,9 @@ cJSON* syncSnapshotRsp2Json(const SyncSnapshotRsp* pMsg) {
cJSON_AddNumberToObject(pRoot, "ack", pMsg->ack);
cJSON_AddNumberToObject(pRoot, "code", pMsg->code);
+
+ snprintf(u64buf, sizeof(u64buf), "%" PRId64, pMsg->snapBeginIndex);
+ cJSON_AddStringToObject(pRoot, "snap-begin", u64buf);
}
cJSON* pJson = cJSON_CreateObject();
@@ -3097,6 +3397,16 @@ void syncReconfigFinishLog2(char* s, const SyncReconfigFinish* pMsg) {
}
// ---------------------------------------------
+const char* syncLocalCmdGetStr(int32_t cmd) {
+ if (cmd == SYNC_LOCAL_CMD_STEP_DOWN) {
+ return "step-down";
+ } else if (cmd == SYNC_LOCAL_CMD_FOLLOWER_CMT) {
+ return "follower-commit";
+ }
+
+ return "unknown-local-cmd";
+}
+
SyncLocalCmd* syncLocalCmdBuild(int32_t vgId) {
uint32_t bytes = sizeof(SyncLocalCmd);
SyncLocalCmd* pMsg = taosMemoryMalloc(bytes);
@@ -3203,6 +3513,9 @@ cJSON* syncLocalCmd2Json(const SyncLocalCmd* pMsg) {
snprintf(u64buf, sizeof(u64buf), "%" PRIu64, pMsg->sdNewTerm);
cJSON_AddStringToObject(pRoot, "sd-new-term", u64buf);
+
+ snprintf(u64buf, sizeof(u64buf), "%" PRId64, pMsg->fcIndex);
+ cJSON_AddStringToObject(pRoot, "fc-index", u64buf);
}
cJSON* pJson = cJSON_CreateObject();
diff --git a/source/libs/sync/src/syncReplication.c b/source/libs/sync/src/syncReplication.c
index af53123421..4aa8b0bc34 100644
--- a/source/libs/sync/src/syncReplication.c
+++ b/source/libs/sync/src/syncReplication.c
@@ -62,8 +62,8 @@ int32_t syncNodeReplicateOne(SSyncNode* pSyncNode, SRaftId* pDestId) {
syncNodeEventLog(pSyncNode, logBuf);
// start snapshot
- int32_t code = syncNodeStartSnapshot(pSyncNode, pDestId);
- ASSERT(code == 0);
+ // int32_t code = syncNodeStartSnapshot(pSyncNode, pDestId);
+
return 0;
}
diff --git a/source/libs/sync/src/syncRespMgr.c b/source/libs/sync/src/syncRespMgr.c
index 88af5746d4..35c831b52f 100644
--- a/source/libs/sync/src/syncRespMgr.c
+++ b/source/libs/sync/src/syncRespMgr.c
@@ -145,16 +145,17 @@ void syncRespCleanByTTL(SSyncRespMgr *pObj, int64_t ttl, bool rsp) {
taosArrayPush(delIndexArray, pSeqNum);
cnt++;
- SFsmCbMeta cbMeta = {0};
- cbMeta.index = SYNC_INDEX_INVALID;
- cbMeta.lastConfigIndex = SYNC_INDEX_INVALID;
- cbMeta.isWeak = false;
- cbMeta.code = TSDB_CODE_SYN_TIMEOUT;
- cbMeta.state = pSyncNode->state;
- cbMeta.seqNum = *pSeqNum;
- cbMeta.term = SYNC_TERM_INVALID;
- cbMeta.currentTerm = pSyncNode->pRaftStore->currentTerm;
- cbMeta.flag = 0;
+ SFsmCbMeta cbMeta = {
+ cbMeta.index = SYNC_INDEX_INVALID,
+ cbMeta.lastConfigIndex = SYNC_INDEX_INVALID,
+ cbMeta.isWeak = false,
+ cbMeta.code = TSDB_CODE_SYN_TIMEOUT,
+ cbMeta.state = pSyncNode->state,
+ cbMeta.seqNum = *pSeqNum,
+ cbMeta.term = SYNC_TERM_INVALID,
+ cbMeta.currentTerm = pSyncNode->pRaftStore->currentTerm,
+ cbMeta.flag = 0,
+ };
pStub->rpcMsg.pCont = NULL;
pStub->rpcMsg.contLen = 0;
diff --git a/source/libs/sync/src/syncSnapshot.c b/source/libs/sync/src/syncSnapshot.c
index a7bafa9f28..b728315746 100644
--- a/source/libs/sync/src/syncSnapshot.c
+++ b/source/libs/sync/src/syncSnapshot.c
@@ -41,8 +41,6 @@ SSyncSnapshotSender *snapshotSenderCreate(SSyncNode *pSyncNode, int32_t replicaI
}
memset(pSender, 0, sizeof(*pSender));
- int64_t timeNow = taosGetTimestampMs();
-
pSender->start = false;
pSender->seq = SYNC_SNAPSHOT_SEQ_INVALID;
pSender->ack = SYNC_SNAPSHOT_SEQ_INVALID;
@@ -53,8 +51,7 @@ SSyncSnapshotSender *snapshotSenderCreate(SSyncNode *pSyncNode, int32_t replicaI
pSender->pSyncNode = pSyncNode;
pSender->replicaIndex = replicaIndex;
pSender->term = pSyncNode->pRaftStore->currentTerm;
- pSender->privateTerm = timeNow + 100;
- pSender->startTime = timeNow;
+ pSender->startTime = 0;
pSender->pSyncNode->pFsm->FpGetSnapshotInfo(pSender->pSyncNode->pFsm, &(pSender->snapshot));
pSender->finish = false;
} else {
@@ -88,88 +85,30 @@ void snapshotSenderDestroy(SSyncSnapshotSender *pSender) {
bool snapshotSenderIsStart(SSyncSnapshotSender *pSender) { return pSender->start; }
-// begin send snapshot by param, snapshot, pReader
-//
-// action:
-// 1. assert reader not start
-// 2. update state
-// 3. send first snapshot block
-int32_t snapshotSenderStart(SSyncSnapshotSender *pSender, SSnapshotParam snapshotParam, SSnapshot snapshot,
- void *pReader) {
+int32_t snapshotSenderStart(SSyncSnapshotSender *pSender) {
ASSERT(!snapshotSenderIsStart(pSender));
- // init snapshot, parm, reader
- ASSERT(pSender->pReader == NULL);
- pSender->pReader = pReader;
- pSender->snapshot = snapshot;
- pSender->snapshotParam = snapshotParam;
-
- // init current block
- if (pSender->pCurrentBlock != NULL) {
- taosMemoryFree(pSender->pCurrentBlock);
- }
- pSender->blockLen = 0;
-
- // update term
- pSender->term = pSender->pSyncNode->pRaftStore->currentTerm;
- ++(pSender->privateTerm); // increase private term
-
- // update state
- pSender->finish = false;
pSender->start = true;
pSender->seq = SYNC_SNAPSHOT_SEQ_BEGIN;
pSender->ack = SYNC_SNAPSHOT_SEQ_INVALID;
+ pSender->pReader = NULL;
+ pSender->pCurrentBlock = NULL;
+ pSender->blockLen = 0;
- // init last config
- if (pSender->snapshot.lastConfigIndex != SYNC_INDEX_INVALID) {
- int32_t code = 0;
- SSyncRaftEntry *pEntry = NULL;
- bool getLastConfig = false;
+ pSender->snapshotParam.start = SYNC_INDEX_INVALID;
+ pSender->snapshotParam.end = SYNC_INDEX_INVALID;
- code = pSender->pSyncNode->pLogStore->syncLogGetEntry(pSender->pSyncNode->pLogStore,
- pSender->snapshot.lastConfigIndex, &pEntry);
- if (code == 0 && pEntry != NULL) {
- SRpcMsg rpcMsg;
- syncEntry2OriginalRpc(pEntry, &rpcMsg);
+ pSender->snapshot.data = NULL;
+ pSender->snapshotParam.end = SYNC_INDEX_INVALID;
+ pSender->snapshot.lastApplyIndex = SYNC_INDEX_INVALID;
+ pSender->snapshot.lastApplyTerm = SYNC_TERM_INVALID;
+ pSender->snapshot.lastConfigIndex = SYNC_INDEX_INVALID;
- SSyncCfg lastConfig;
- int32_t ret = syncCfgFromStr(rpcMsg.pCont, &lastConfig);
- ASSERT(ret == 0);
- pSender->lastConfig = lastConfig;
- getLastConfig = true;
-
- rpcFreeCont(rpcMsg.pCont);
- syncEntryDestory(pEntry);
- } else {
- if (pSender->snapshot.lastConfigIndex == pSender->pSyncNode->pRaftCfg->lastConfigIndex) {
- sTrace("vgId:%d, sync sender get cfg from local", pSender->pSyncNode->vgId);
- pSender->lastConfig = pSender->pSyncNode->pRaftCfg->cfg;
- getLastConfig = true;
- }
- }
-
- // last config not found in wal, update to -1
- if (!getLastConfig) {
- SyncIndex oldLastConfigIndex = pSender->snapshot.lastConfigIndex;
- SyncIndex newLastConfigIndex = SYNC_INDEX_INVALID;
- pSender->snapshot.lastConfigIndex = SYNC_INDEX_INVALID;
- memset(&(pSender->lastConfig), 0, sizeof(SSyncCfg));
-
- // event log
- do {
- char logBuf[128];
- snprintf(logBuf, sizeof(logBuf), "snapshot sender update lcindex from %" PRId64 " to %" PRId64,
- oldLastConfigIndex, newLastConfigIndex);
- char *eventLog = snapshotSender2SimpleStr(pSender, logBuf);
- syncNodeEventLog(pSender->pSyncNode, eventLog);
- taosMemoryFree(eventLog);
- } while (0);
- }
-
- } else {
- // no last config
- memset(&(pSender->lastConfig), 0, sizeof(SSyncCfg));
- }
+ memset(&(pSender->lastConfig), 0, sizeof(pSender->lastConfig));
+ pSender->sendingMS = 0;
+ pSender->term = pSender->pSyncNode->pRaftStore->currentTerm;
+ pSender->startTime = taosGetTimestampMs();
+ pSender->finish = false;
// build begin msg
SyncSnapshotSend *pMsg = syncSnapshotSendBuild(0, pSender->pSyncNode->vgId);
@@ -181,8 +120,8 @@ int32_t snapshotSenderStart(SSyncSnapshotSender *pSender, SSnapshotParam snapsho
pMsg->lastTerm = pSender->snapshot.lastApplyTerm;
pMsg->lastConfigIndex = pSender->snapshot.lastConfigIndex;
pMsg->lastConfig = pSender->lastConfig;
- pMsg->seq = pSender->seq; // SYNC_SNAPSHOT_SEQ_BEGIN
- pMsg->privateTerm = pSender->privateTerm;
+ pMsg->startTime = pSender->startTime;
+ pMsg->seq = SYNC_SNAPSHOT_SEQ_PRE_SNAPSHOT;
// send msg
SRpcMsg rpcMsg;
@@ -201,6 +140,10 @@ int32_t snapshotSenderStart(SSyncSnapshotSender *pSender, SSnapshotParam snapsho
}
int32_t snapshotSenderStop(SSyncSnapshotSender *pSender, bool finish) {
+ // update flag
+ pSender->start = false;
+ pSender->finish = finish;
+
// close reader
if (pSender->pReader != NULL) {
int32_t ret = pSender->pSyncNode->pFsm->FpSnapshotStopRead(pSender->pSyncNode->pFsm, pSender->pReader);
@@ -215,12 +158,6 @@ int32_t snapshotSenderStop(SSyncSnapshotSender *pSender, bool finish) {
pSender->blockLen = 0;
}
- // update flag
- pSender->start = false;
- pSender->finish = finish;
-
- // do not update term, maybe print
-
// event log
do {
char *eventLog = snapshotSender2SimpleStr(pSender, "snapshot sender stop");
@@ -263,7 +200,9 @@ int32_t snapshotSend(SSyncSnapshotSender *pSender) {
pMsg->lastConfigIndex = pSender->snapshot.lastConfigIndex;
pMsg->lastConfig = pSender->lastConfig;
pMsg->seq = pSender->seq;
- pMsg->privateTerm = pSender->privateTerm;
+
+ // pMsg->privateTerm = pSender->privateTerm;
+
memcpy(pMsg->data, pSender->pCurrentBlock, pSender->blockLen);
// send msg
@@ -302,7 +241,9 @@ int32_t snapshotReSend(SSyncSnapshotSender *pSender) {
pMsg->lastConfigIndex = pSender->snapshot.lastConfigIndex;
pMsg->lastConfig = pSender->lastConfig;
pMsg->seq = pSender->seq;
- pMsg->privateTerm = pSender->privateTerm;
+
+ // pMsg->privateTerm = pSender->privateTerm;
+
memcpy(pMsg->data, pSender->pCurrentBlock, pSender->blockLen);
// send msg
@@ -367,8 +308,10 @@ cJSON *snapshotSender2Json(SSyncSnapshotSender *pSender) {
cJSON_AddNumberToObject(pRoot, "replicaIndex", pSender->replicaIndex);
snprintf(u64buf, sizeof(u64buf), "%" PRIu64, pSender->term);
cJSON_AddStringToObject(pRoot, "term", u64buf);
- snprintf(u64buf, sizeof(u64buf), "%" PRIu64, pSender->privateTerm);
- cJSON_AddStringToObject(pRoot, "privateTerm", u64buf);
+
+ // snprintf(u64buf, sizeof(u64buf), "%" PRIu64, pSender->privateTerm);
+ // cJSON_AddStringToObject(pRoot, "privateTerm", u64buf);
+
cJSON_AddNumberToObject(pRoot, "finish", pSender->finish);
}
@@ -395,30 +338,38 @@ char *snapshotSender2SimpleStr(SSyncSnapshotSender *pSender, char *event) {
snprintf(s, len,
"%s {%p s-param:%" PRId64 " e-param:%" PRId64 " laindex:%" PRId64 " laterm:%" PRIu64 " lcindex:%" PRId64
- " seq:%d ack:%d finish:%d pterm:%" PRIu64
- " "
- "replica-index:%d %s:%d}",
+ " seq:%d ack:%d finish:%d replica-index:%d %s:%d}",
event, pSender, pSender->snapshotParam.start, pSender->snapshotParam.end, pSender->snapshot.lastApplyIndex,
pSender->snapshot.lastApplyTerm, pSender->snapshot.lastConfigIndex, pSender->seq, pSender->ack,
- pSender->finish, pSender->privateTerm, pSender->replicaIndex, host, port);
+ pSender->finish, pSender->replicaIndex, host, port);
return s;
}
int32_t syncNodeStartSnapshot(SSyncNode *pSyncNode, SRaftId *pDestId) {
- // calculate index
-
- syncNodeEventLog(pSyncNode, "start snapshot ...");
+ syncNodeEventLog(pSyncNode, "starting snapshot ...");
SSyncSnapshotSender *pSender = syncNodeGetSnapshotSender(pSyncNode, pDestId);
if (pSender == NULL) {
- // create sender
- } else {
- // if is same
- // return 0;
+ syncNodeErrorLog(pSyncNode, "start snapshot error, sender is null");
+ return -1;
}
- // send begin msg
+ int32_t code = 0;
+
+ if (snapshotSenderIsStart(pSender)) {
+ code = snapshotSenderStop(pSender, false);
+ if (code != 0) {
+ syncNodeErrorLog(pSyncNode, "snapshot sender stop error");
+ return -1;
+ }
+ }
+
+ code = snapshotSenderStart(pSender);
+ if (code != 0) {
+ syncNodeErrorLog(pSyncNode, "snapshot sender start error");
+ return -1;
+ }
return 0;
}
@@ -440,7 +391,6 @@ SSyncSnapshotReceiver *snapshotReceiverCreate(SSyncNode *pSyncNode, SRaftId from
pReceiver->pSyncNode = pSyncNode;
pReceiver->fromId = fromId;
pReceiver->term = pSyncNode->pRaftStore->currentTerm;
- pReceiver->privateTerm = 0;
pReceiver->snapshot.data = NULL;
pReceiver->snapshot.lastApplyIndex = SYNC_INDEX_INVALID;
pReceiver->snapshot.lastApplyTerm = 0;
@@ -474,19 +424,8 @@ bool snapshotReceiverIsStart(SSyncSnapshotReceiver *pReceiver) { return pReceive
// receive first snapshot data
// write first block data
static void snapshotReceiverDoStart(SSyncSnapshotReceiver *pReceiver, SyncSnapshotSend *pBeginMsg) {
- // update state
- pReceiver->term = pReceiver->pSyncNode->pRaftStore->currentTerm;
- pReceiver->privateTerm = pBeginMsg->privateTerm;
- pReceiver->ack = SYNC_SNAPSHOT_SEQ_BEGIN;
- pReceiver->fromId = pBeginMsg->srcId;
pReceiver->start = true;
-
- // update snapshot
- pReceiver->snapshot.lastApplyIndex = pBeginMsg->lastIndex;
- pReceiver->snapshot.lastApplyTerm = pBeginMsg->lastTerm;
- pReceiver->snapshot.lastConfigIndex = pBeginMsg->lastConfigIndex;
- pReceiver->snapshotParam.start = pBeginMsg->beginIndex;
- pReceiver->snapshotParam.end = pBeginMsg->lastIndex;
+ pReceiver->ack = SYNC_SNAPSHOT_SEQ_BEGIN;
// start writer
ASSERT(pReceiver->pWriter == NULL);
@@ -494,6 +433,19 @@ static void snapshotReceiverDoStart(SSyncSnapshotReceiver *pReceiver, SyncSnapsh
&(pReceiver->snapshotParam), &(pReceiver->pWriter));
ASSERT(ret == 0);
+ pReceiver->term = pReceiver->pSyncNode->pRaftStore->currentTerm;
+ pReceiver->snapshotParam.start = pBeginMsg->beginIndex;
+ pReceiver->snapshotParam.end = pBeginMsg->lastIndex;
+
+ pReceiver->fromId = pBeginMsg->srcId;
+
+ // update snapshot
+ pReceiver->snapshot.lastApplyIndex = pBeginMsg->lastIndex;
+ pReceiver->snapshot.lastApplyTerm = pBeginMsg->lastTerm;
+ pReceiver->snapshot.lastConfigIndex = pBeginMsg->lastConfigIndex;
+
+ pReceiver->startTime = pBeginMsg->startTime;
+
// event log
do {
char *eventLog = snapshotReceiver2SimpleStr(pReceiver, "snapshot receiver start");
@@ -523,22 +475,9 @@ void snapshotReceiverForceStop(SSyncSnapshotReceiver *pReceiver) {
}
// if receiver receive msg from seq = SYNC_SNAPSHOT_SEQ_BEGIN, start receiver
-// if already start, force close, start again
int32_t snapshotReceiverStart(SSyncSnapshotReceiver *pReceiver, SyncSnapshotSend *pBeginMsg) {
- if (!snapshotReceiverIsStart(pReceiver)) {
- // first start
- snapshotReceiverDoStart(pReceiver, pBeginMsg);
-
- } else {
- // already start
- sInfo("vgId:%d, snapshot recv, receiver already start", pReceiver->pSyncNode->vgId);
-
- // force close, abandon incomplete data
- snapshotReceiverForceStop(pReceiver);
-
- // start again
- snapshotReceiverDoStart(pReceiver, pBeginMsg);
- }
+ ASSERT(!snapshotReceiverIsStart(pReceiver));
+ snapshotReceiverDoStart(pReceiver, pBeginMsg);
return 0;
}
@@ -698,8 +637,8 @@ cJSON *snapshotReceiver2Json(SSyncSnapshotReceiver *pReceiver) {
snprintf(u64buf, sizeof(u64buf), "%" PRIu64, pReceiver->term);
cJSON_AddStringToObject(pRoot, "term", u64buf);
- snprintf(u64buf, sizeof(u64buf), "%" PRIu64, pReceiver->privateTerm);
- cJSON_AddStringToObject(pRoot, "privateTerm", u64buf);
+ snprintf(u64buf, sizeof(u64buf), "%" PRId64, pReceiver->startTime);
+ cJSON_AddStringToObject(pRoot, "startTime", u64buf);
}
cJSON *pJson = cJSON_CreateObject();
@@ -724,38 +663,204 @@ char *snapshotReceiver2SimpleStr(SSyncSnapshotReceiver *pReceiver, char *event)
syncUtilU642Addr(fromId.addr, host, sizeof(host), &port);
snprintf(s, len,
- "%s {%p start:%d ack:%d term:%" PRIu64 " pterm:%" PRIu64 " from:%s:%d s-param:%" PRId64 " e-param:%" PRId64
- " laindex:%" PRId64 " laterm:%" PRIu64
+ "%s {%p start:%d ack:%d term:%" PRIu64 " start-time:%" PRId64 " from:%s:%d s-param:%" PRId64
+ " e-param:%" PRId64 " laindex:%" PRId64 " laterm:%" PRIu64
" "
"lcindex:%" PRId64 "}",
- event, pReceiver, pReceiver->start, pReceiver->ack, pReceiver->term, pReceiver->privateTerm, host, port,
+ event, pReceiver, pReceiver->start, pReceiver->ack, pReceiver->term, pReceiver->startTime, host, port,
pReceiver->snapshotParam.start, pReceiver->snapshotParam.end, pReceiver->snapshot.lastApplyIndex,
pReceiver->snapshot.lastApplyTerm, pReceiver->snapshot.lastConfigIndex);
return s;
}
+SyncIndex syncNodeGetSnapBeginIndex(SSyncNode *ths) {
+ SyncIndex snapStart = SYNC_INDEX_INVALID;
+
+ if (syncNodeIsMnode(ths)) {
+ snapStart = SYNC_INDEX_BEGIN;
+
+ } else {
+ 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) {
+ char logBuf[128];
+ snprintf(logBuf, sizeof(logBuf), "commit not same, wal-commit:%" PRId64 ", commit:%" PRId64 ", ignore",
+ walCommitVer, ths->commitIndex);
+ syncNodeErrorLog(ths, logBuf);
+
+ snapStart = walCommitVer + 1;
+ } else {
+ snapStart = ths->commitIndex + 1;
+ }
+ }
+
+ return snapStart;
+}
+
+static int32_t syncNodeOnSnapshotPre(SSyncNode *pSyncNode, SyncSnapshotSend *pMsg) {
+ SSyncSnapshotReceiver *pReceiver = pSyncNode->pNewNodeReceiver;
+
+ if (snapshotReceiverIsStart(pReceiver)) {
+ // already start
+
+ if (pMsg->startTime > pReceiver->startTime) {
+ goto _START_RECEIVER;
+
+ } else if (pMsg->startTime == pReceiver->startTime) {
+ goto _SEND_REPLY;
+
+ } else {
+ // ignore
+ return 0;
+ }
+
+ } else {
+ // start new
+ goto _START_RECEIVER;
+ }
+
+_START_RECEIVER:
+ if (taosGetTimestampMs() - pMsg->startTime > SNAPSHOT_MAX_CLOCK_SKEW_MS) {
+ syncNodeErrorLog(pSyncNode, "snapshot receiver time skew too much");
+ return -1;
+ } else {
+ // waiting for clock match
+ while (taosGetTimestampMs() > pMsg->startTime) {
+ taosMsleep(10);
+ }
+
+ snapshotReceiverStart(pReceiver, pMsg); // set start-time same with sender
+ }
+
+_SEND_REPLY:
+ // build msg
+ ; // make complier happy
+ SyncSnapshotRsp *pRspMsg = syncSnapshotRspBuild(pSyncNode->vgId);
+ pRspMsg->srcId = pSyncNode->myRaftId;
+ pRspMsg->destId = pMsg->srcId;
+ pRspMsg->term = pSyncNode->pRaftStore->currentTerm;
+ pRspMsg->lastIndex = pMsg->lastIndex;
+ pRspMsg->lastTerm = pMsg->lastTerm;
+ pRspMsg->startTime = pReceiver->startTime;
+ pRspMsg->ack = pMsg->seq; // receiver maybe already closed
+ pRspMsg->code = 0;
+ pRspMsg->snapBeginIndex = syncNodeGetSnapBeginIndex(pSyncNode);
+
+ // send msg
+ SRpcMsg rpcMsg;
+ syncSnapshotRsp2RpcMsg(pRspMsg, &rpcMsg);
+ syncNodeSendMsgById(&(pRspMsg->destId), pSyncNode, &rpcMsg);
+ syncSnapshotRspDestroy(pRspMsg);
+
+ return 0;
+}
+
+static int32_t syncNodeOnSnapshotBegin(SSyncNode *pSyncNode, SyncSnapshotSend *pMsg) {
+ // condition 1
+ SSyncSnapshotReceiver *pReceiver = pSyncNode->pNewNodeReceiver;
+
+ if (snapshotReceiverIsStart(pReceiver)) {
+ if (pMsg->startTime > pReceiver->startTime) {
+ snapshotReceiverStop(pReceiver);
+
+ } else if (pMsg->startTime == pReceiver->startTime) {
+ return 0;
+ } else {
+ // ignore
+ syncNodeEventLog(pSyncNode, "msg ignore");
+ return 0;
+ }
+ }
+
+_START_RECEIVER:
+ if (taosGetTimestampMs() - pMsg->startTime > SNAPSHOT_MAX_CLOCK_SKEW_MS) {
+ syncNodeErrorLog(pSyncNode, "snapshot receiver time skew too much");
+ return -1;
+ } else {
+ // waiting for clock match
+ while (taosGetTimestampMs() > pMsg->startTime) {
+ taosMsleep(10);
+ }
+
+ snapshotReceiverStart(pReceiver, pMsg);
+
+ // build msg
+ SyncSnapshotRsp *pRspMsg = syncSnapshotRspBuild(pSyncNode->vgId);
+ pRspMsg->srcId = pSyncNode->myRaftId;
+ pRspMsg->destId = pMsg->srcId;
+ pRspMsg->term = pSyncNode->pRaftStore->currentTerm;
+ pRspMsg->lastIndex = pMsg->lastIndex;
+ pRspMsg->lastTerm = pMsg->lastTerm;
+ pRspMsg->ack = pReceiver->ack; // receiver maybe already closed
+ pRspMsg->code = 0;
+
+ // send msg
+ SRpcMsg rpcMsg;
+ syncSnapshotRsp2RpcMsg(pRspMsg, &rpcMsg);
+ syncNodeSendMsgById(&(pRspMsg->destId), pSyncNode, &rpcMsg);
+ syncSnapshotRspDestroy(pRspMsg);
+ }
+
+ return 0;
+}
+
+static int32_t syncNodeOnSnapshotTransfer(SSyncNode *pSyncNode, SyncSnapshotSend *pMsg) { return 0; }
+
+static int32_t syncNodeOnSnapshotEnd(SSyncNode *pSyncNode, SyncSnapshotSend *pMsg) { return 0; }
+
// receiver on message
//
-// condition 1, recv SYNC_SNAPSHOT_SEQ_BEGIN, start receiver, update privateTerm
-// condition 2, recv SYNC_SNAPSHOT_SEQ_END, finish receiver(apply snapshot data, update commit index, maybe reconfig)
-// condition 3, recv SYNC_SNAPSHOT_SEQ_FORCE_CLOSE, force close
-// condition 4, got data, update ack
+// condition 1, recv SYNC_SNAPSHOT_SEQ_PRE_SNAPSHOT
+// if receiver already start
+// if sender.start-time > receiver.start-time, restart receiver(reply snapshot start)
+// if sender.start-time = receiver.start-time, maybe duplicate msg
+// if sender.start-time < receiver.start-time, ignore
+// else
+// waiting for clock match
+// start receiver(reply snapshot start)
+//
+// condition 2, recv SYNC_SNAPSHOT_SEQ_BEGIN
+// a. create writer with
+//
+// condition 3, recv SYNC_SNAPSHOT_SEQ_END, finish receiver(apply snapshot data, update commit index, maybe reconfig)
+//
+// condition 4, recv SYNC_SNAPSHOT_SEQ_FORCE_CLOSE, force close
+//
+// condition 5, got data, update ack
//
int32_t syncNodeOnSnapshot(SSyncNode *pSyncNode, SyncSnapshotSend *pMsg) {
- // get receiver
- SSyncSnapshotReceiver *pReceiver = pSyncNode->pNewNodeReceiver;
- bool needRsp = false;
+ // if already drop replica, do not process
+ if (!syncNodeInRaftGroup(pSyncNode, &(pMsg->srcId))) {
+ syncLogRecvSyncSnapshotSend(pSyncNode, pMsg, "not in my config");
+ return 0;
+ }
+
+ if (pMsg->term < pSyncNode->pRaftStore->currentTerm) {
+ syncLogRecvSyncSnapshotSend(pSyncNode, pMsg, "reject, small term");
+ return 0;
+ }
+
+ if (pMsg->term > pSyncNode->pRaftStore->currentTerm) {
+ syncNodeStepDown(pSyncNode, pMsg->term);
+ }
+ syncNodeResetElectTimer(pSyncNode);
+
int32_t code = 0;
+ SSyncSnapshotReceiver *pReceiver = pSyncNode->pNewNodeReceiver;
// state, term, seq/ack
if (pSyncNode->state == TAOS_SYNC_STATE_FOLLOWER) {
if (pMsg->term == pSyncNode->pRaftStore->currentTerm) {
- if (pMsg->seq == SYNC_SNAPSHOT_SEQ_BEGIN) {
- // condition 1
- // begin, no data
- snapshotReceiverStart(pReceiver, pMsg);
- needRsp = true;
+ if (pMsg->seq == SYNC_SNAPSHOT_SEQ_PRE_SNAPSHOT) {
+ syncNodeOnSnapshotPre(pSyncNode, pMsg);
+
+ } else if (pMsg->seq == SYNC_SNAPSHOT_SEQ_BEGIN) {
+ syncNodeOnSnapshotBegin(pSyncNode, pMsg);
} else if (pMsg->seq == SYNC_SNAPSHOT_SEQ_END) {
// condition 2
@@ -764,7 +869,7 @@ int32_t syncNodeOnSnapshot(SSyncNode *pSyncNode, SyncSnapshotSend *pMsg) {
if (code == 0) {
snapshotReceiverStop(pReceiver);
}
- needRsp = true;
+ bool needRsp = true;
// maybe update lastconfig
if (pMsg->lastConfigIndex >= SYNC_INDEX_BEGIN) {
@@ -782,7 +887,7 @@ int32_t syncNodeOnSnapshot(SSyncNode *pSyncNode, SyncSnapshotSend *pMsg) {
// condition 3
// force close
snapshotReceiverForceStop(pReceiver);
- needRsp = false;
+ bool needRsp = false;
} else if (pMsg->seq > SYNC_SNAPSHOT_SEQ_BEGIN && pMsg->seq < SYNC_SNAPSHOT_SEQ_END) {
// condition 4
@@ -790,7 +895,7 @@ int32_t syncNodeOnSnapshot(SSyncNode *pSyncNode, SyncSnapshotSend *pMsg) {
if (pMsg->seq == pReceiver->ack + 1) {
snapshotReceiverGotData(pReceiver, pMsg);
}
- needRsp = true;
+ bool needRsp = true;
} else {
// error log
@@ -805,26 +910,6 @@ int32_t syncNodeOnSnapshot(SSyncNode *pSyncNode, SyncSnapshotSend *pMsg) {
return -1;
}
- // send ack
- if (needRsp) {
- // build msg
- SyncSnapshotRsp *pRspMsg = syncSnapshotRspBuild(pSyncNode->vgId);
- pRspMsg->srcId = pSyncNode->myRaftId;
- pRspMsg->destId = pMsg->srcId;
- pRspMsg->term = pSyncNode->pRaftStore->currentTerm;
- pRspMsg->lastIndex = pMsg->lastIndex;
- pRspMsg->lastTerm = pMsg->lastTerm;
- pRspMsg->ack = pReceiver->ack; // receiver maybe already closed
- pRspMsg->code = 0;
- pRspMsg->privateTerm = pReceiver->privateTerm; // receiver maybe already closed
-
- // send msg
- SRpcMsg rpcMsg;
- syncSnapshotRsp2RpcMsg(pRspMsg, &rpcMsg);
- syncNodeSendMsgById(&(pRspMsg->destId), pSyncNode, &rpcMsg);
- syncSnapshotRspDestroy(pRspMsg);
- }
-
} else {
// error log
do {
@@ -849,6 +934,52 @@ int32_t syncNodeOnSnapshot(SSyncNode *pSyncNode, SyncSnapshotSend *pMsg) {
return 0;
}
+int32_t syncNodeOnSnapshotReplyPre(SSyncNode *pSyncNode, SyncSnapshotRsp *pMsg) {
+ // get sender
+ SSyncSnapshotSender *pSender = syncNodeGetSnapshotSender(pSyncNode, &(pMsg->srcId));
+ ASSERT(pSender != NULL);
+
+ SSnapshot snapshot;
+ pSyncNode->pFsm->FpGetSnapshotInfo(pSyncNode->pFsm, &snapshot);
+
+ // prepare
+ pSender->snapshotParam.start = pMsg->snapBeginIndex;
+ pSender->snapshotParam.end = snapshot.lastApplyIndex;
+
+ if (pMsg->snapBeginIndex > snapshot.lastApplyIndex) {
+ syncNodeErrorLog(pSyncNode, "snapshot last index too small");
+ return -1;
+ }
+
+ // start reader
+ int32_t code = pSyncNode->pFsm->FpSnapshotStartRead(pSyncNode->pFsm, &(pSender->snapshotParam), &(pSender->pReader));
+ if (code != 0) {
+ syncNodeErrorLog(pSyncNode, "create snapshot reader error");
+ return -1;
+ }
+
+ // build begin msg
+ SyncSnapshotSend *pSendMsg = syncSnapshotSendBuild(0, pSender->pSyncNode->vgId);
+ pSendMsg->srcId = pSender->pSyncNode->myRaftId;
+ pSendMsg->destId = (pSender->pSyncNode->replicasId)[pSender->replicaIndex];
+ pSendMsg->term = pSender->pSyncNode->pRaftStore->currentTerm;
+ pSendMsg->beginIndex = pSender->snapshotParam.start;
+ pSendMsg->lastIndex = pSender->snapshot.lastApplyIndex;
+ pSendMsg->lastTerm = pSender->snapshot.lastApplyTerm;
+ pSendMsg->lastConfigIndex = pSender->snapshot.lastConfigIndex;
+ pSendMsg->lastConfig = pSender->lastConfig;
+ pSendMsg->startTime = pSender->startTime;
+ pSendMsg->seq = SYNC_SNAPSHOT_SEQ_BEGIN;
+
+ // send msg
+ SRpcMsg rpcMsg;
+ syncSnapshotSend2RpcMsg(pSendMsg, &rpcMsg);
+ syncNodeSendMsgById(&(pSendMsg->destId), pSender->pSyncNode, &rpcMsg);
+ syncSnapshotSendDestroy(pSendMsg);
+
+ return 0;
+}
+
// sender on message
//
// condition 1 sender receives SYNC_SNAPSHOT_SEQ_END, close sender
@@ -857,8 +988,8 @@ int32_t syncNodeOnSnapshot(SSyncNode *pSyncNode, SyncSnapshotSend *pMsg) {
//
int32_t syncNodeOnSnapshotReply(SSyncNode *pSyncNode, SyncSnapshotRsp *pMsg) {
// if already drop replica, do not process
- if (!syncNodeInRaftGroup(pSyncNode, &(pMsg->srcId)) && pSyncNode->state == TAOS_SYNC_STATE_LEADER) {
- sError("vgId:%d, recv sync-snapshot-rsp, maybe replica already dropped", pSyncNode->vgId);
+ if (!syncNodeInRaftGroup(pSyncNode, &(pMsg->srcId))) {
+ syncLogRecvSyncSnapshotRsp(pSyncNode, pMsg, "maybe replica already dropped");
return -1;
}
@@ -866,17 +997,26 @@ int32_t syncNodeOnSnapshotReply(SSyncNode *pSyncNode, SyncSnapshotRsp *pMsg) {
SSyncSnapshotSender *pSender = syncNodeGetSnapshotSender(pSyncNode, &(pMsg->srcId));
ASSERT(pSender != NULL);
+ if (pMsg->startTime != pSender->startTime) {
+ syncLogRecvSyncSnapshotRsp(pSyncNode, pMsg, "sender/receiver start time not match");
+ return -1;
+ }
+
// state, term, seq/ack
if (pSyncNode->state == TAOS_SYNC_STATE_LEADER) {
if (pMsg->term == pSyncNode->pRaftStore->currentTerm) {
- // condition 1
+ // prepare , send begin msg
+ if (pMsg->ack == SYNC_SNAPSHOT_SEQ_PRE_SNAPSHOT) {
+ syncNodeOnSnapshotReplyPre(pSyncNode, pMsg);
+ return 0;
+ }
+
// receive ack is finish, close sender
if (pMsg->ack == SYNC_SNAPSHOT_SEQ_END) {
snapshotSenderStop(pSender, true);
return 0;
}
- // condition 2
// send next msg
if (pMsg->ack == pSender->seq) {
// update sender ack
@@ -922,3 +1062,63 @@ int32_t syncNodeOnSnapshotReply(SSyncNode *pSyncNode, SyncSnapshotRsp *pMsg) {
return 0;
}
+
+int32_t syncNodeOnPreSnapshot(SSyncNode *ths, SyncPreSnapshot *pMsg) {
+ syncLogRecvSyncPreSnapshot(ths, pMsg, "");
+
+ SyncPreSnapshotReply *pMsgReply = syncPreSnapshotReplyBuild(ths->vgId);
+ pMsgReply->srcId = ths->myRaftId;
+ pMsgReply->destId = pMsg->srcId;
+ pMsgReply->term = ths->pRaftStore->currentTerm;
+
+ SSyncLogStoreData *pData = ths->pLogStore->data;
+ SWal *pWal = pData->pWal;
+
+ if (syncNodeIsMnode(ths)) {
+ pMsgReply->snapStart = SYNC_INDEX_BEGIN;
+
+ } else {
+ bool isEmpty = ths->pLogStore->syncLogIsEmpty(ths->pLogStore);
+ int64_t walCommitVer = walGetCommittedVer(pWal);
+
+ if (!isEmpty && ths->commitIndex != walCommitVer) {
+ char logBuf[128];
+ snprintf(logBuf, sizeof(logBuf), "commit not same, wal-commit:%" PRId64 ", commit:%" PRId64 ", ignore",
+ walCommitVer, ths->commitIndex);
+ syncNodeErrorLog(ths, logBuf);
+
+ goto _IGNORE;
+ }
+
+ pMsgReply->snapStart = ths->commitIndex + 1;
+
+ // make local log clean
+ int32_t code = ths->pLogStore->syncLogTruncate(ths->pLogStore, pMsgReply->snapStart);
+ if (code != 0) {
+ syncNodeErrorLog(ths, "truncate wal error");
+ goto _IGNORE;
+ }
+ }
+
+ // can not write behind _RESPONSE
+ SRpcMsg rpcMsg;
+
+_RESPONSE:
+ syncPreSnapshotReply2RpcMsg(pMsgReply, &rpcMsg);
+ syncNodeSendMsgById(&pMsgReply->destId, ths, &rpcMsg);
+
+ syncPreSnapshotReplyDestroy(pMsgReply);
+ return 0;
+
+_IGNORE:
+ syncPreSnapshotReplyDestroy(pMsgReply);
+ return 0;
+}
+
+int32_t syncNodeOnPreSnapshotReply(SSyncNode *ths, SyncPreSnapshotReply *pMsg) {
+ syncLogRecvSyncPreSnapshotReply(ths, pMsg, "");
+
+ // start snapshot
+
+ return 0;
+}
\ No newline at end of file
diff --git a/source/libs/sync/src/syncTimeout.c b/source/libs/sync/src/syncTimeout.c
index 5ff73a6406..1c08217099 100644
--- a/source/libs/sync/src/syncTimeout.c
+++ b/source/libs/sync/src/syncTimeout.c
@@ -76,7 +76,7 @@ int32_t syncNodeTimerRoutine(SSyncNode* ths) {
SSyncLogStoreData* pData = ths->pLogStore->data;
int32_t code = walEndSnapshot(pData->pWal);
if (code != 0) {
- sError("vgId:%d, wal snapshot end error since:%s", ths->vgId, terrstr(terrno));
+ sError("vgId:%d, timer wal snapshot end error since:%s", ths->vgId, terrstr());
return -1;
} else {
do {
diff --git a/source/libs/sync/src/syncUtil.c b/source/libs/sync/src/syncUtil.c
index f152201901..164e050930 100644
--- a/source/libs/sync/src/syncUtil.c
+++ b/source/libs/sync/src/syncUtil.c
@@ -176,30 +176,6 @@ char* syncUtilRaftId2Str(const SRaftId* p) {
return serialized;
}
-const char* syncUtilState2String(ESyncState state) {
- /*
- if (state == TAOS_SYNC_STATE_FOLLOWER) {
- return "TAOS_SYNC_STATE_FOLLOWER";
- } else if (state == TAOS_SYNC_STATE_CANDIDATE) {
- return "TAOS_SYNC_STATE_CANDIDATE";
- } else if (state == TAOS_SYNC_STATE_LEADER) {
- return "TAOS_SYNC_STATE_LEADER";
- } else {
- return "TAOS_SYNC_STATE_UNKNOWN";
- }
- */
-
- if (state == TAOS_SYNC_STATE_FOLLOWER) {
- return "follower";
- } else if (state == TAOS_SYNC_STATE_CANDIDATE) {
- return "candidate";
- } else if (state == TAOS_SYNC_STATE_LEADER) {
- return "leader";
- } else {
- return "state_error";
- }
-}
-
bool syncUtilCanPrint(char c) {
if (c >= 32 && c <= 126) {
return true;
diff --git a/source/libs/sync/test/CMakeLists.txt b/source/libs/sync/test/CMakeLists.txt
index 26dd32942b..1b7ec7f0df 100644
--- a/source/libs/sync/test/CMakeLists.txt
+++ b/source/libs/sync/test/CMakeLists.txt
@@ -60,6 +60,8 @@ add_executable(syncRaftCfgIndexTest "")
add_executable(syncHeartbeatTest "")
add_executable(syncHeartbeatReplyTest "")
add_executable(syncLocalCmdTest "")
+add_executable(syncPreSnapshotTest "")
+add_executable(syncPreSnapshotReplyTest "")
target_sources(syncTest
@@ -310,6 +312,14 @@ target_sources(syncLocalCmdTest
PRIVATE
"syncLocalCmdTest.cpp"
)
+target_sources(syncPreSnapshotTest
+ PRIVATE
+ "syncPreSnapshotTest.cpp"
+)
+target_sources(syncPreSnapshotReplyTest
+ PRIVATE
+ "syncPreSnapshotReplyTest.cpp"
+)
target_include_directories(syncTest
@@ -622,6 +632,16 @@ target_include_directories(syncLocalCmdTest
"${TD_SOURCE_DIR}/include/libs/sync"
"${CMAKE_CURRENT_SOURCE_DIR}/../inc"
)
+target_include_directories(syncPreSnapshotTest
+ PUBLIC
+ "${TD_SOURCE_DIR}/include/libs/sync"
+ "${CMAKE_CURRENT_SOURCE_DIR}/../inc"
+)
+target_include_directories(syncPreSnapshotReplyTest
+ PUBLIC
+ "${TD_SOURCE_DIR}/include/libs/sync"
+ "${CMAKE_CURRENT_SOURCE_DIR}/../inc"
+)
target_link_libraries(syncTest
@@ -872,6 +892,14 @@ target_link_libraries(syncLocalCmdTest
sync
gtest_main
)
+target_link_libraries(syncPreSnapshotTest
+ sync
+ gtest_main
+)
+target_link_libraries(syncPreSnapshotReplyTest
+ sync
+ gtest_main
+)
enable_testing()
diff --git a/source/libs/sync/test/syncConfigChangeSnapshotTest.cpp b/source/libs/sync/test/syncConfigChangeSnapshotTest.cpp
index 8f16be27e7..dcf7249d30 100644
--- a/source/libs/sync/test/syncConfigChangeSnapshotTest.cpp
+++ b/source/libs/sync/test/syncConfigChangeSnapshotTest.cpp
@@ -47,8 +47,8 @@ void CommitCb(struct SSyncFSM* pFsm, const SRpcMsg* pMsg, SFsmCbMeta cbMeta) {
snprintf(logBuf, sizeof(logBuf),
"==callback== ==CommitCb== pFsm:%p, index:%" PRId64 ", isWeak:%d, code:%d, state:%d %s, flag:%" PRIu64
", term:%" PRIu64 " \n",
- pFsm, cbMeta.index, cbMeta.isWeak, cbMeta.code, cbMeta.state, syncUtilState2String(cbMeta.state),
- cbMeta.flag, cbMeta.term);
+ pFsm, cbMeta.index, cbMeta.isWeak, cbMeta.code, cbMeta.state, syncStr(cbMeta.state), cbMeta.flag,
+ cbMeta.term);
syncRpcMsgLog2(logBuf, (SRpcMsg*)pMsg);
} else {
sTrace("==callback== ==CommitCb== do not apply again %" PRId64, cbMeta.index);
@@ -57,10 +57,10 @@ void CommitCb(struct SSyncFSM* pFsm, const SRpcMsg* pMsg, SFsmCbMeta cbMeta) {
void PreCommitCb(struct SSyncFSM* pFsm, const SRpcMsg* pMsg, SFsmCbMeta cbMeta) {
char logBuf[256] = {0};
- snprintf(
- logBuf, sizeof(logBuf),
- "==callback== ==PreCommitCb== pFsm:%p, index:%" PRId64 ", isWeak:%d, code:%d, state:%d %s flag:%" PRIu64 "\n",
- pFsm, cbMeta.index, cbMeta.isWeak, cbMeta.code, cbMeta.state, syncUtilState2String(cbMeta.state), cbMeta.flag);
+ snprintf(logBuf, sizeof(logBuf),
+ "==callback== ==PreCommitCb== pFsm:%p, index:%" PRId64 ", isWeak:%d, code:%d, state:%d %s flag:%" PRIu64
+ "\n",
+ pFsm, cbMeta.index, cbMeta.isWeak, cbMeta.code, cbMeta.state, syncStr(cbMeta.state), cbMeta.flag);
syncRpcMsgLog2(logBuf, (SRpcMsg*)pMsg);
}
@@ -68,8 +68,7 @@ void RollBackCb(struct SSyncFSM* pFsm, const SRpcMsg* pMsg, SFsmCbMeta cbMeta) {
char logBuf[256];
snprintf(logBuf, sizeof(logBuf),
"==callback== ==RollBackCb== pFsm:%p, index:%" PRId64 ", isWeak:%d, code:%d, state:%d %s flag:%" PRIu64 "\n",
- pFsm, cbMeta.index, cbMeta.isWeak, cbMeta.code, cbMeta.state, syncUtilState2String(cbMeta.state),
- cbMeta.flag);
+ pFsm, cbMeta.index, cbMeta.isWeak, cbMeta.code, cbMeta.state, syncStr(cbMeta.state), cbMeta.flag);
syncRpcMsgLog2(logBuf, (SRpcMsg*)pMsg);
}
@@ -158,6 +157,7 @@ SSyncFSM* createFsm() {
SSyncFSM* pFsm = (SSyncFSM*)taosMemoryMalloc(sizeof(SSyncFSM));
memset(pFsm, 0, sizeof(*pFsm));
+#if 0
pFsm->FpCommitCb = CommitCb;
pFsm->FpPreCommitCb = PreCommitCb;
pFsm->FpRollBackCb = RollBackCb;
@@ -172,6 +172,7 @@ SSyncFSM* createFsm() {
pFsm->FpSnapshotDoWrite = SnapshotDoWrite;
pFsm->FpReConfigCb = ReConfigCb;
+#endif
return pFsm;
}
@@ -195,8 +196,8 @@ int64_t createSyncNode(int32_t replicaNum, int32_t myIndex, int32_t vgId, SWal*
SSyncInfo syncInfo;
syncInfo.vgId = vgId;
syncInfo.msgcb = &gSyncIO->msgcb;
- syncInfo.FpSendMsg = syncIOSendMsg;
- syncInfo.FpEqMsg = syncIOEqMsg;
+ syncInfo.syncSendMSg = syncIOSendMsg;
+ syncInfo.syncEqMsg = syncIOEqMsg;
syncInfo.pFsm = createFsm();
snprintf(syncInfo.path, sizeof(syncInfo.path), "%s_sync_replica%d_index%d", path, replicaNum, myIndex);
syncInfo.pWal = pWal;
diff --git a/source/libs/sync/test/syncConfigChangeTest.cpp b/source/libs/sync/test/syncConfigChangeTest.cpp
index d1244546c9..c5548d25d4 100644
--- a/source/libs/sync/test/syncConfigChangeTest.cpp
+++ b/source/libs/sync/test/syncConfigChangeTest.cpp
@@ -33,7 +33,7 @@ void init() {
void cleanup() { walCleanUp(); }
-void CommitCb(struct SSyncFSM* pFsm, const SRpcMsg* pMsg, SFsmCbMeta cbMeta) {
+void CommitCb(const struct SSyncFSM* pFsm, const SRpcMsg* pMsg, const SFsmCbMeta cbMeta) {
SyncIndex beginIndex = SYNC_INDEX_INVALID;
if (pFsm->FpGetSnapshotInfo != NULL) {
SSnapshot snapshot;
@@ -45,33 +45,31 @@ void CommitCb(struct SSyncFSM* pFsm, const SRpcMsg* pMsg, SFsmCbMeta cbMeta) {
char logBuf[256] = {0};
snprintf(logBuf, sizeof(logBuf),
"==callback== ==CommitCb== pFsm:%p, index:%" PRId64 ", isWeak:%d, code:%d, state:%d %s flag:%" PRIu64 "\n",
- pFsm, cbMeta.index, cbMeta.isWeak, cbMeta.code, cbMeta.state, syncUtilState2String(cbMeta.state),
- cbMeta.flag);
+ pFsm, cbMeta.index, cbMeta.isWeak, cbMeta.code, cbMeta.state, syncStr(cbMeta.state), cbMeta.flag);
syncRpcMsgLog2(logBuf, (SRpcMsg*)pMsg);
} else {
sTrace("==callback== ==CommitCb== do not apply again %" PRId64, cbMeta.index);
}
}
-void PreCommitCb(struct SSyncFSM* pFsm, const SRpcMsg* pMsg, SFsmCbMeta cbMeta) {
+void PreCommitCb(const struct SSyncFSM* pFsm, const SRpcMsg* pMsg, SFsmCbMeta cbMeta) {
char logBuf[256] = {0};
- snprintf(
- logBuf, sizeof(logBuf),
- "==callback== ==PreCommitCb== pFsm:%p, index:%" PRId64 ", isWeak:%d, code:%d, state:%d %s flag:%" PRIu64 "\n",
- pFsm, cbMeta.index, cbMeta.isWeak, cbMeta.code, cbMeta.state, syncUtilState2String(cbMeta.state), cbMeta.flag);
+ snprintf(logBuf, sizeof(logBuf),
+ "==callback== ==PreCommitCb== pFsm:%p, index:%" PRId64 ", isWeak:%d, code:%d, state:%d %s flag:%" PRIu64
+ "\n",
+ pFsm, cbMeta.index, cbMeta.isWeak, cbMeta.code, cbMeta.state, syncStr(cbMeta.state), cbMeta.flag);
syncRpcMsgLog2(logBuf, (SRpcMsg*)pMsg);
}
-void RollBackCb(struct SSyncFSM* pFsm, const SRpcMsg* pMsg, SFsmCbMeta cbMeta) {
+void RollBackCb(const struct SSyncFSM* pFsm, const SRpcMsg* pMsg, SFsmCbMeta cbMeta) {
char logBuf[256];
snprintf(logBuf, sizeof(logBuf),
"==callback== ==RollBackCb== pFsm:%p, index:%" PRId64 ", isWeak:%d, code:%d, state:%d %s flag:%" PRIu64 "\n",
- pFsm, cbMeta.index, cbMeta.isWeak, cbMeta.code, cbMeta.state, syncUtilState2String(cbMeta.state),
- cbMeta.flag);
+ pFsm, cbMeta.index, cbMeta.isWeak, cbMeta.code, cbMeta.state, syncStr(cbMeta.state), cbMeta.flag);
syncRpcMsgLog2(logBuf, (SRpcMsg*)pMsg);
}
-int32_t GetSnapshotCb(struct SSyncFSM* pFsm, SSnapshot* pSnapshot) {
+int32_t GetSnapshotCb(const struct SSyncFSM* pFsm, SSnapshot* pSnapshot) {
pSnapshot->data = NULL;
pSnapshot->lastApplyIndex = gSnapshotLastApplyIndex;
pSnapshot->lastApplyTerm = 100;
@@ -89,6 +87,7 @@ SSyncFSM* createFsm() {
SSyncFSM* pFsm = (SSyncFSM*)taosMemoryMalloc(sizeof(SSyncFSM));
memset(pFsm, 0, sizeof(*pFsm));
+#if 0
pFsm->FpCommitCb = CommitCb;
pFsm->FpPreCommitCb = PreCommitCb;
pFsm->FpRollBackCb = RollBackCb;
@@ -97,6 +96,7 @@ SSyncFSM* createFsm() {
pFsm->FpRestoreFinishCb = RestoreFinishCb;
pFsm->FpReConfigCb = ReConfigCb;
+#endif
return pFsm;
}
@@ -120,8 +120,8 @@ int64_t createSyncNode(int32_t replicaNum, int32_t myIndex, int32_t vgId, SWal*
SSyncInfo syncInfo;
syncInfo.vgId = vgId;
syncInfo.msgcb = &gSyncIO->msgcb;
- syncInfo.FpSendMsg = syncIOSendMsg;
- syncInfo.FpEqMsg = syncIOEqMsg;
+ syncInfo.syncSendMSg = syncIOSendMsg;
+ syncInfo.syncEqMsg = syncIOEqMsg;
syncInfo.pFsm = createFsm();
snprintf(syncInfo.path, sizeof(syncInfo.path), "%s_sync_replica%d_index%d", path, replicaNum, myIndex);
syncInfo.pWal = pWal;
diff --git a/source/libs/sync/test/syncElectTest.cpp b/source/libs/sync/test/syncElectTest.cpp
index 862f7bd0ba..c290368c7f 100644
--- a/source/libs/sync/test/syncElectTest.cpp
+++ b/source/libs/sync/test/syncElectTest.cpp
@@ -45,8 +45,8 @@ SSyncNode* createSyncNode(int32_t replicaNum, int32_t myIndex, int32_t vgId, SWa
SSyncInfo syncInfo;
syncInfo.vgId = vgId;
syncInfo.msgcb = &gSyncIO->msgcb;
- syncInfo.FpSendMsg = syncIOSendMsg;
- syncInfo.FpEqMsg = syncIOEqMsg;
+ syncInfo.syncSendMSg = syncIOSendMsg;
+ syncInfo.syncEqMsg = syncIOEqMsg;
syncInfo.pFsm = NULL;
snprintf(syncInfo.path, sizeof(syncInfo.path), "%s_sync_replica%d_index%d", path, replicaNum, myIndex);
syncInfo.pWal = pWal;
@@ -98,7 +98,7 @@ int main(int argc, char** argv) {
init();
int32_t ret = syncIOStart((char*)"127.0.0.1", gPorts[myIndex]);
assert(ret == 0);
- ret = syncEnvStart();
+ ret = syncInit();
assert(ret == 0);
char walPath[128];
diff --git a/source/libs/sync/test/syncEncodeTest.cpp b/source/libs/sync/test/syncEncodeTest.cpp
index 9f1a81e7ed..35dc7e4398 100644
--- a/source/libs/sync/test/syncEncodeTest.cpp
+++ b/source/libs/sync/test/syncEncodeTest.cpp
@@ -32,8 +32,8 @@ SSyncNode *pSyncNode;
SSyncNode *syncNodeInit() {
syncInfo.vgId = 1234;
syncInfo.msgcb = &gSyncIO->msgcb;
- syncInfo.FpSendMsg = syncIOSendMsg;
- syncInfo.FpEqMsg = syncIOEqMsg;
+ syncInfo.syncSendMSg = syncIOSendMsg;
+ syncInfo.syncEqMsg = syncIOEqMsg;
syncInfo.pFsm = pFsm;
snprintf(syncInfo.path, sizeof(syncInfo.path), "%s", "./");
@@ -152,7 +152,7 @@ int main(int argc, char **argv) {
int32_t ret = syncIOStart((char *)"127.0.0.1", ports[myIndex]);
assert(ret == 0);
- ret = syncEnvStart();
+ ret = syncInit();
assert(ret == 0);
taosRemoveDir("./wal_test");
diff --git a/source/libs/sync/test/syncEnqTest.cpp b/source/libs/sync/test/syncEnqTest.cpp
index 8461bfe9b7..d43789c91e 100644
--- a/source/libs/sync/test/syncEnqTest.cpp
+++ b/source/libs/sync/test/syncEnqTest.cpp
@@ -25,8 +25,8 @@ SSyncFSM* pFsm;
SSyncNode* syncNodeInit() {
syncInfo.vgId = 1234;
- syncInfo.FpSendMsg = syncIOSendMsg;
- syncInfo.FpEqMsg = syncIOEqMsg;
+ syncInfo.syncSendMSg = syncIOSendMsg;
+ syncInfo.syncEqMsg = syncIOEqMsg;
syncInfo.pFsm = pFsm;
snprintf(syncInfo.path, sizeof(syncInfo.path), "%s", "./");
@@ -81,7 +81,7 @@ int main(int argc, char** argv) {
int32_t ret = syncIOStart((char*)"127.0.0.1", ports[myIndex]);
assert(ret == 0);
- ret = syncEnvStart();
+ ret = syncInit();
assert(ret == 0);
SSyncNode* pSyncNode = syncInitTest();
@@ -97,7 +97,7 @@ int main(int argc, char** argv) {
SyncPingReply* pSyncMsg = syncPingReplyBuild2(&pSyncNode->myRaftId, &pSyncNode->myRaftId, 1000, "syncEnqTest");
SRpcMsg rpcMsg;
syncPingReply2RpcMsg(pSyncMsg, &rpcMsg);
- pSyncNode->FpEqMsg(pSyncNode->msgcb, &rpcMsg);
+ pSyncNode->syncEqMsg(pSyncNode->msgcb, &rpcMsg);
taosMsleep(1000);
}
diff --git a/source/libs/sync/test/syncEnvTest.cpp b/source/libs/sync/test/syncEnvTest.cpp
index a7a819e046..a220c2aed4 100644
--- a/source/libs/sync/test/syncEnvTest.cpp
+++ b/source/libs/sync/test/syncEnvTest.cpp
@@ -22,23 +22,21 @@ int main() {
logTest();
- ret = syncEnvStart();
+ ret = syncInit();
assert(ret == 0);
for (int i = 0; i < 5; ++i) {
- ret = syncEnvStartTimer();
+ //ret = syncEnvStartTimer();
assert(ret == 0);
taosMsleep(5000);
- ret = syncEnvStopTimer();
+ //ret = syncEnvStopTimer();
assert(ret == 0);
taosMsleep(5000);
}
- ret = syncEnvStop();
- assert(ret == 0);
-
+ syncCleanUp();
return 0;
}
diff --git a/source/libs/sync/test/syncIOSendMsgTest.cpp b/source/libs/sync/test/syncIOSendMsgTest.cpp
index 630d96054b..055f869130 100644
--- a/source/libs/sync/test/syncIOSendMsgTest.cpp
+++ b/source/libs/sync/test/syncIOSendMsgTest.cpp
@@ -26,8 +26,8 @@ SSyncFSM* pFsm;
SSyncNode* syncNodeInit() {
syncInfo.vgId = 1234;
syncInfo.msgcb = &gSyncIO->msgcb;
- syncInfo.FpSendMsg = syncIOSendMsg;
- syncInfo.FpEqMsg = syncIOEqMsg;
+ syncInfo.syncSendMSg = syncIOSendMsg;
+ syncInfo.syncEqMsg = syncIOEqMsg;
syncInfo.pFsm = pFsm;
snprintf(syncInfo.path, sizeof(syncInfo.path), "%s", "./");
@@ -82,7 +82,7 @@ int main(int argc, char** argv) {
int32_t ret = syncIOStart((char*)"127.0.0.1", ports[myIndex]);
assert(ret == 0);
- ret = syncEnvStart();
+ ret = syncInit();
assert(ret == 0);
SSyncNode* pSyncNode = syncInitTest();
@@ -103,7 +103,7 @@ int main(int argc, char** argv) {
SEpSet epSet;
syncUtilnodeInfo2EpSet(&pSyncNode->myNodeInfo, &epSet);
rpcMsg.info.noResp = 1;
- pSyncNode->FpSendMsg(&epSet, &rpcMsg);
+ pSyncNode->syncSendMSg(&epSet, &rpcMsg);
taosMsleep(1000);
}
diff --git a/source/libs/sync/test/syncInitTest.cpp b/source/libs/sync/test/syncInitTest.cpp
index d0843151f4..4333127405 100644
--- a/source/libs/sync/test/syncInitTest.cpp
+++ b/source/libs/sync/test/syncInitTest.cpp
@@ -26,8 +26,8 @@ SSyncFSM* pFsm;
SSyncNode* syncNodeInit() {
syncInfo.vgId = 1234;
syncInfo.msgcb = &gSyncIO->msgcb;
- syncInfo.FpSendMsg = syncIOSendMsg;
- syncInfo.FpEqMsg = syncIOEqMsg;
+ syncInfo.syncSendMSg = syncIOSendMsg;
+ syncInfo.syncEqMsg = syncIOEqMsg;
syncInfo.pFsm = pFsm;
snprintf(syncInfo.path, sizeof(syncInfo.path), "%s", "./sync_init_test");
@@ -81,7 +81,7 @@ int main(int argc, char** argv) {
int32_t ret = syncIOStart((char*)"127.0.0.1", ports[myIndex]);
assert(ret == 0);
- ret = syncEnvStart();
+ ret = syncInit();
assert(ret == 0);
SSyncNode* pSyncNode = syncInitTest();
@@ -91,7 +91,7 @@ int main(int argc, char** argv) {
initRaftId(pSyncNode);
syncNodeClose(pSyncNode);
- syncEnvStop();
+ syncCleanUp();
// syncIOStop();
// taosCloseLog();
diff --git a/source/libs/sync/test/syncLocalCmdTest.cpp b/source/libs/sync/test/syncLocalCmdTest.cpp
index de908bf9c1..b42626df29 100644
--- a/source/libs/sync/test/syncLocalCmdTest.cpp
+++ b/source/libs/sync/test/syncLocalCmdTest.cpp
@@ -21,6 +21,7 @@ SyncLocalCmd *createMsg() {
pMsg->destId.addr = syncUtilAddr2U64("127.0.0.1", 5678);
pMsg->destId.vgId = 100;
pMsg->sdNewTerm = 123;
+ pMsg->fcIndex = 456;
pMsg->cmd = SYNC_LOCAL_CMD_STEP_DOWN;
return pMsg;
diff --git a/source/libs/sync/test/syncPingSelfTest.cpp b/source/libs/sync/test/syncPingSelfTest.cpp
index 99287bf7b0..7d8ed73ac7 100644
--- a/source/libs/sync/test/syncPingSelfTest.cpp
+++ b/source/libs/sync/test/syncPingSelfTest.cpp
@@ -26,8 +26,8 @@ SSyncFSM* pFsm;
SSyncNode* syncNodeInit() {
syncInfo.vgId = 1234;
syncInfo.msgcb = &gSyncIO->msgcb;
- syncInfo.FpSendMsg = syncIOSendMsg;
- syncInfo.FpEqMsg = syncIOEqMsg;
+ syncInfo.syncSendMSg = syncIOSendMsg;
+ syncInfo.syncEqMsg = syncIOEqMsg;
syncInfo.pFsm = pFsm;
snprintf(syncInfo.path, sizeof(syncInfo.path), "%s", "./");
@@ -81,7 +81,7 @@ int main(int argc, char** argv) {
int32_t ret = syncIOStart((char*)"127.0.0.1", ports[myIndex]);
assert(ret == 0);
- ret = syncEnvStart();
+ ret = syncInit();
assert(ret == 0);
SSyncNode* pSyncNode = syncInitTest();
diff --git a/source/libs/sync/test/syncPingTimerTest.cpp b/source/libs/sync/test/syncPingTimerTest.cpp
index cd9440e3e2..c074103f38 100644
--- a/source/libs/sync/test/syncPingTimerTest.cpp
+++ b/source/libs/sync/test/syncPingTimerTest.cpp
@@ -26,8 +26,8 @@ SSyncFSM* pFsm;
SSyncNode* syncNodeInit() {
syncInfo.vgId = 1234;
syncInfo.msgcb = &gSyncIO->msgcb;
- syncInfo.FpSendMsg = syncIOSendMsg;
- syncInfo.FpEqMsg = syncIOEqMsg;
+ syncInfo.syncSendMSg = syncIOSendMsg;
+ syncInfo.syncEqMsg = syncIOEqMsg;
syncInfo.pFsm = pFsm;
snprintf(syncInfo.path, sizeof(syncInfo.path), "%s", "./");
@@ -81,7 +81,7 @@ int main(int argc, char** argv) {
int32_t ret = syncIOStart((char*)"127.0.0.1", ports[myIndex]);
assert(ret == 0);
- ret = syncEnvStart();
+ ret = syncInit();
assert(ret == 0);
SSyncNode* pSyncNode = syncInitTest();
diff --git a/source/libs/sync/test/syncPingTimerTest2.cpp b/source/libs/sync/test/syncPingTimerTest2.cpp
index fa09d04368..2683f48487 100644
--- a/source/libs/sync/test/syncPingTimerTest2.cpp
+++ b/source/libs/sync/test/syncPingTimerTest2.cpp
@@ -26,8 +26,8 @@ SSyncFSM* pFsm;
SSyncNode* syncNodeInit() {
syncInfo.vgId = 1234;
syncInfo.msgcb = &gSyncIO->msgcb;
- syncInfo.FpSendMsg = syncIOSendMsg;
- syncInfo.FpEqMsg = syncIOEqMsg;
+ syncInfo.syncSendMSg = syncIOSendMsg;
+ syncInfo.syncEqMsg = syncIOEqMsg;
syncInfo.pFsm = pFsm;
snprintf(syncInfo.path, sizeof(syncInfo.path), "%s", "./");
@@ -81,7 +81,7 @@ int main(int argc, char** argv) {
int32_t ret = syncIOStart((char*)"127.0.0.1", ports[myIndex]);
assert(ret == 0);
- ret = syncEnvStart();
+ ret = syncInit();
assert(ret == 0);
SSyncNode* pSyncNode = syncInitTest();
diff --git a/source/libs/sync/test/syncPreSnapshotReplyTest.cpp b/source/libs/sync/test/syncPreSnapshotReplyTest.cpp
new file mode 100644
index 0000000000..a30dcc2c54
--- /dev/null
+++ b/source/libs/sync/test/syncPreSnapshotReplyTest.cpp
@@ -0,0 +1,99 @@
+
+#include
+#include
+#include "syncIO.h"
+#include "syncInt.h"
+#include "syncMessage.h"
+#include "syncUtil.h"
+
+void logTest() {
+ sTrace("--- sync log test: trace");
+ sDebug("--- sync log test: debug");
+ sInfo("--- sync log test: info");
+ sWarn("--- sync log test: warn");
+ sError("--- sync log test: error");
+ sFatal("--- sync log test: fatal");
+}
+
+SyncPreSnapshotReply *createMsg() {
+ SyncPreSnapshotReply *pMsg = syncPreSnapshotReplyBuild(789);
+ pMsg->srcId.addr = syncUtilAddr2U64("127.0.0.1", 1234);
+ pMsg->srcId.vgId = 100;
+ pMsg->destId.addr = syncUtilAddr2U64("127.0.0.1", 5678);
+ pMsg->destId.vgId = 100;
+ pMsg->term = 9527;
+ pMsg->snapStart = 12306;
+ return pMsg;
+}
+
+void test1() {
+ SyncPreSnapshotReply *pMsg = createMsg();
+ syncPreSnapshotReplyLog2((char *)"test1:", pMsg);
+ syncPreSnapshotReplyDestroy(pMsg);
+}
+
+void test2() {
+ SyncPreSnapshotReply *pMsg = createMsg();
+ uint32_t len = pMsg->bytes;
+ char * serialized = (char *)taosMemoryMalloc(len);
+ syncPreSnapshotReplySerialize(pMsg, serialized, len);
+ SyncPreSnapshotReply *pMsg2 = syncPreSnapshotReplyBuild(789);
+ syncPreSnapshotReplyDeserialize(serialized, len, pMsg2);
+ syncPreSnapshotReplyLog2((char *)"test2: syncPreSnapshotReplySerialize -> syncPreSnapshotReplyDeserialize ", pMsg2);
+
+ taosMemoryFree(serialized);
+ syncPreSnapshotReplyDestroy(pMsg);
+ syncPreSnapshotReplyDestroy(pMsg2);
+}
+
+void test3() {
+ SyncPreSnapshotReply *pMsg = createMsg();
+ uint32_t len;
+ char * serialized = syncPreSnapshotReplySerialize2(pMsg, &len);
+ SyncPreSnapshotReply *pMsg2 = syncPreSnapshotReplyDeserialize2(serialized, len);
+ syncPreSnapshotReplyLog2((char *)"test3: syncPreSnapshotReplySerialize2 -> syncPreSnapshotReplyDeserialize2 ", pMsg2);
+
+ taosMemoryFree(serialized);
+ syncPreSnapshotReplyDestroy(pMsg);
+ syncPreSnapshotReplyDestroy(pMsg2);
+}
+
+void test4() {
+ SyncPreSnapshotReply *pMsg = createMsg();
+ SRpcMsg rpcMsg;
+ syncPreSnapshotReply2RpcMsg(pMsg, &rpcMsg);
+ SyncPreSnapshotReply *pMsg2 = (SyncPreSnapshotReply *)taosMemoryMalloc(rpcMsg.contLen);
+ syncPreSnapshotReplyFromRpcMsg(&rpcMsg, pMsg2);
+ syncPreSnapshotReplyLog2((char *)"test4: syncPreSnapshotReply2RpcMsg -> syncPreSnapshotReplyFromRpcMsg ", pMsg2);
+
+ rpcFreeCont(rpcMsg.pCont);
+ syncPreSnapshotReplyDestroy(pMsg);
+ syncPreSnapshotReplyDestroy(pMsg2);
+}
+
+void test5() {
+ SyncPreSnapshotReply *pMsg = createMsg();
+ SRpcMsg rpcMsg;
+ syncPreSnapshotReply2RpcMsg(pMsg, &rpcMsg);
+ SyncPreSnapshotReply *pMsg2 = syncPreSnapshotReplyFromRpcMsg2(&rpcMsg);
+ syncPreSnapshotReplyLog2((char *)"test5: syncPreSnapshotReply2RpcMsg -> syncPreSnapshotReplyFromRpcMsg2 ", pMsg2);
+
+ rpcFreeCont(rpcMsg.pCont);
+ syncPreSnapshotReplyDestroy(pMsg);
+ syncPreSnapshotReplyDestroy(pMsg2);
+}
+
+int main() {
+ tsAsyncLog = 0;
+ sDebugFlag = DEBUG_TRACE + DEBUG_SCREEN + DEBUG_FILE;
+ gRaftDetailLog = true;
+ logTest();
+
+ test1();
+ test2();
+ test3();
+ test4();
+ test5();
+
+ return 0;
+}
diff --git a/source/libs/sync/test/syncPreSnapshotTest.cpp b/source/libs/sync/test/syncPreSnapshotTest.cpp
new file mode 100644
index 0000000000..03894dfa84
--- /dev/null
+++ b/source/libs/sync/test/syncPreSnapshotTest.cpp
@@ -0,0 +1,97 @@
+#include
+#include
+#include "syncIO.h"
+#include "syncInt.h"
+#include "syncMessage.h"
+#include "syncUtil.h"
+
+void logTest() {
+ sTrace("--- sync log test: trace");
+ sDebug("--- sync log test: debug");
+ sInfo("--- sync log test: info");
+ sWarn("--- sync log test: warn");
+ sError("--- sync log test: error");
+ sFatal("--- sync log test: fatal");
+}
+
+SyncPreSnapshot *createMsg() {
+ SyncPreSnapshot *pMsg = syncPreSnapshotBuild(789);
+ pMsg->srcId.addr = syncUtilAddr2U64("127.0.0.1", 1234);
+ pMsg->srcId.vgId = 100;
+ pMsg->destId.addr = syncUtilAddr2U64("127.0.0.1", 5678);
+ pMsg->destId.vgId = 100;
+ pMsg->term = 9527;
+ return pMsg;
+}
+
+void test1() {
+ SyncPreSnapshot *pMsg = createMsg();
+ syncPreSnapshotLog2((char *)"test1:", pMsg);
+ syncPreSnapshotDestroy(pMsg);
+}
+
+void test2() {
+ SyncPreSnapshot *pMsg = createMsg();
+ uint32_t len = pMsg->bytes;
+ char * serialized = (char *)taosMemoryMalloc(len);
+ syncPreSnapshotSerialize(pMsg, serialized, len);
+ SyncPreSnapshot *pMsg2 = syncPreSnapshotBuild(789);
+ syncPreSnapshotDeserialize(serialized, len, pMsg2);
+ syncPreSnapshotLog2((char *)"test2: syncPreSnapshotSerialize -> syncPreSnapshotDeserialize ", pMsg2);
+
+ taosMemoryFree(serialized);
+ syncPreSnapshotDestroy(pMsg);
+ syncPreSnapshotDestroy(pMsg2);
+}
+
+void test3() {
+ SyncPreSnapshot *pMsg = createMsg();
+ uint32_t len;
+ char * serialized = syncPreSnapshotSerialize2(pMsg, &len);
+ SyncPreSnapshot *pMsg2 = syncPreSnapshotDeserialize2(serialized, len);
+ syncPreSnapshotLog2((char *)"test3: syncPreSnapshotSerialize2 -> syncPreSnapshotDeserialize2 ", pMsg2);
+
+ taosMemoryFree(serialized);
+ syncPreSnapshotDestroy(pMsg);
+ syncPreSnapshotDestroy(pMsg2);
+}
+
+void test4() {
+ SyncPreSnapshot *pMsg = createMsg();
+ SRpcMsg rpcMsg;
+ syncPreSnapshot2RpcMsg(pMsg, &rpcMsg);
+ SyncPreSnapshot *pMsg2 = (SyncPreSnapshot *)taosMemoryMalloc(rpcMsg.contLen);
+ syncPreSnapshotFromRpcMsg(&rpcMsg, pMsg2);
+ syncPreSnapshotLog2((char *)"test4: syncPreSnapshot2RpcMsg -> syncPreSnapshotFromRpcMsg ", pMsg2);
+
+ rpcFreeCont(rpcMsg.pCont);
+ syncPreSnapshotDestroy(pMsg);
+ syncPreSnapshotDestroy(pMsg2);
+}
+
+void test5() {
+ SyncPreSnapshot *pMsg = createMsg();
+ SRpcMsg rpcMsg;
+ syncPreSnapshot2RpcMsg(pMsg, &rpcMsg);
+ SyncPreSnapshot *pMsg2 = syncPreSnapshotFromRpcMsg2(&rpcMsg);
+ syncPreSnapshotLog2((char *)"test5: syncPreSnapshot2RpcMsg -> syncPreSnapshotFromRpcMsg2 ", pMsg2);
+
+ rpcFreeCont(rpcMsg.pCont);
+ syncPreSnapshotDestroy(pMsg);
+ syncPreSnapshotDestroy(pMsg2);
+}
+
+int main() {
+ tsAsyncLog = 0;
+ sDebugFlag = DEBUG_TRACE + DEBUG_SCREEN + DEBUG_FILE;
+ gRaftDetailLog = true;
+ logTest();
+
+ test1();
+ test2();
+ test3();
+ test4();
+ test5();
+
+ return 0;
+}
diff --git a/source/libs/sync/test/syncRaftLogTest2.cpp b/source/libs/sync/test/syncRaftLogTest2.cpp
index 0cb9b51fba..78c08a6d8d 100644
--- a/source/libs/sync/test/syncRaftLogTest2.cpp
+++ b/source/libs/sync/test/syncRaftLogTest2.cpp
@@ -25,7 +25,7 @@ const char* pWalPath = "./syncLogStoreTest_wal";
SyncIndex gSnapshotLastApplyIndex;
SyncIndex gSnapshotLastApplyTerm;
-int32_t GetSnapshotCb(struct SSyncFSM* pFsm, SSnapshot* pSnapshot) {
+int32_t GetSnapshotCb(const struct SSyncFSM* pFsm, SSnapshot* pSnapshot) {
pSnapshot->data = NULL;
pSnapshot->lastApplyIndex = gSnapshotLastApplyIndex;
pSnapshot->lastApplyTerm = gSnapshotLastApplyTerm;
diff --git a/source/libs/sync/test/syncRaftLogTest3.cpp b/source/libs/sync/test/syncRaftLogTest3.cpp
index 1171ef8785..cf862feb2a 100644
--- a/source/libs/sync/test/syncRaftLogTest3.cpp
+++ b/source/libs/sync/test/syncRaftLogTest3.cpp
@@ -27,7 +27,7 @@ const char* pWalPath = "./syncLogStoreTest_wal";
SyncIndex gSnapshotLastApplyIndex;
SyncIndex gSnapshotLastApplyTerm;
-int32_t GetSnapshotCb(struct SSyncFSM* pFsm, SSnapshot* pSnapshot) {
+int32_t GetSnapshotCb(const struct SSyncFSM* pFsm, SSnapshot* pSnapshot) {
pSnapshot->data = NULL;
pSnapshot->lastApplyIndex = gSnapshotLastApplyIndex;
pSnapshot->lastApplyTerm = gSnapshotLastApplyTerm;
diff --git a/source/libs/sync/test/syncReplicateTest.cpp b/source/libs/sync/test/syncReplicateTest.cpp
index adb3deb22d..7506ae19bd 100644
--- a/source/libs/sync/test/syncReplicateTest.cpp
+++ b/source/libs/sync/test/syncReplicateTest.cpp
@@ -42,7 +42,7 @@ void CommitCb(struct SSyncFSM* pFsm, const SRpcMsg* pMsg, SFsmCbMeta cbMeta) {
char logBuf[256];
snprintf(logBuf, sizeof(logBuf),
"==callback== ==CommitCb== pFsm:%p, index:%" PRId64 ", isWeak:%d, code:%d, state:%d %s \n", pFsm,
- cbMeta.index, cbMeta.isWeak, cbMeta.code, cbMeta.state, syncUtilState2String(cbMeta.state));
+ cbMeta.index, cbMeta.isWeak, cbMeta.code, cbMeta.state, syncStr(cbMeta.state));
syncRpcMsgLog2(logBuf, (SRpcMsg*)pMsg);
} else {
sTrace("==callback== ==CommitCb== do not apply again %" PRId64, cbMeta.index);
@@ -53,7 +53,7 @@ void PreCommitCb(struct SSyncFSM* pFsm, const SRpcMsg* pMsg, SFsmCbMeta cbMeta)
char logBuf[256];
snprintf(logBuf, sizeof(logBuf),
"==callback== ==PreCommitCb== pFsm:%p, index:%" PRId64 ", isWeak:%d, code:%d, state:%d %s \n", pFsm,
- cbMeta.index, cbMeta.isWeak, cbMeta.code, cbMeta.state, syncUtilState2String(cbMeta.state));
+ cbMeta.index, cbMeta.isWeak, cbMeta.code, cbMeta.state, syncStr(cbMeta.state));
syncRpcMsgLog2(logBuf, (SRpcMsg*)pMsg);
}
@@ -61,7 +61,7 @@ void RollBackCb(struct SSyncFSM* pFsm, const SRpcMsg* pMsg, SFsmCbMeta cbMeta) {
char logBuf[256];
snprintf(logBuf, sizeof(logBuf),
"==callback== ==RollBackCb== pFsm:%p, index:%" PRId64 ", isWeak:%d, code:%d, state:%d %s \n", pFsm,
- cbMeta.index, cbMeta.isWeak, cbMeta.code, cbMeta.state, syncUtilState2String(cbMeta.state));
+ cbMeta.index, cbMeta.isWeak, cbMeta.code, cbMeta.state, syncStr(cbMeta.state));
syncRpcMsgLog2(logBuf, (SRpcMsg*)pMsg);
}
@@ -74,10 +74,14 @@ int32_t GetSnapshotCb(struct SSyncFSM* pFsm, SSnapshot* pSnapshot) {
SSyncFSM* createFsm() {
SSyncFSM* pFsm = (SSyncFSM*)taosMemoryMalloc(sizeof(SSyncFSM));
+
+#if 0
pFsm->FpCommitCb = CommitCb;
pFsm->FpPreCommitCb = PreCommitCb;
pFsm->FpRollBackCb = RollBackCb;
pFsm->FpGetSnapshotInfo = GetSnapshotCb;
+#endif
+
return pFsm;
}
@@ -100,8 +104,8 @@ int64_t createSyncNode(int32_t replicaNum, int32_t myIndex, int32_t vgId, SWal*
SSyncInfo syncInfo;
syncInfo.vgId = vgId;
syncInfo.msgcb = &gSyncIO->msgcb;
- syncInfo.FpSendMsg = syncIOSendMsg;
- syncInfo.FpEqMsg = syncIOEqMsg;
+ syncInfo.syncSendMSg = syncIOSendMsg;
+ syncInfo.syncEqMsg = syncIOEqMsg;
syncInfo.pFsm = createFsm();
snprintf(syncInfo.path, sizeof(syncInfo.path), "%s_sync_replica%d_index%d", path, replicaNum, myIndex);
syncInfo.pWal = pWal;
diff --git a/source/libs/sync/test/syncSnapshotReceiverTest.cpp b/source/libs/sync/test/syncSnapshotReceiverTest.cpp
index 0f8e76f121..6eb8548740 100644
--- a/source/libs/sync/test/syncSnapshotReceiverTest.cpp
+++ b/source/libs/sync/test/syncSnapshotReceiverTest.cpp
@@ -37,9 +37,12 @@ SSyncSnapshotReceiver* createReceiver() {
SSyncNode* pSyncNode = (SSyncNode*)taosMemoryMalloc(sizeof(*pSyncNode));
pSyncNode->pRaftStore = (SRaftStore*)taosMemoryMalloc(sizeof(*(pSyncNode->pRaftStore)));
pSyncNode->pFsm = (SSyncFSM*)taosMemoryMalloc(sizeof(*(pSyncNode->pFsm)));
+
+#if 0
pSyncNode->pFsm->FpSnapshotStartWrite = SnapshotStartWrite;
pSyncNode->pFsm->FpSnapshotStopWrite = SnapshotStopWrite;
pSyncNode->pFsm->FpSnapshotDoWrite = SnapshotDoWrite;
+#endif
SRaftId id;
id.addr = syncUtilAddr2U64("1.2.3.4", 99);
@@ -50,7 +53,6 @@ SSyncSnapshotReceiver* createReceiver() {
pReceiver->ack = 20;
pReceiver->pWriter = (void*)0x11;
pReceiver->term = 66;
- pReceiver->privateTerm = 99;
return pReceiver;
}
diff --git a/source/libs/sync/test/syncSnapshotRspTest.cpp b/source/libs/sync/test/syncSnapshotRspTest.cpp
index 89348da617..63905c2182 100644
--- a/source/libs/sync/test/syncSnapshotRspTest.cpp
+++ b/source/libs/sync/test/syncSnapshotRspTest.cpp
@@ -21,7 +21,7 @@ SyncSnapshotRsp *createMsg() {
pMsg->destId.addr = syncUtilAddr2U64("127.0.0.1", 5678);
pMsg->destId.vgId = 100;
pMsg->term = 11;
- pMsg->privateTerm = 99;
+ pMsg->startTime = 99;
pMsg->lastIndex = 22;
pMsg->lastTerm = 33;
pMsg->ack = 44;
diff --git a/source/libs/sync/test/syncSnapshotSendTest.cpp b/source/libs/sync/test/syncSnapshotSendTest.cpp
index 6fcfa6f6c4..83f1dfebb3 100644
--- a/source/libs/sync/test/syncSnapshotSendTest.cpp
+++ b/source/libs/sync/test/syncSnapshotSendTest.cpp
@@ -21,7 +21,6 @@ SyncSnapshotSend *createMsg() {
pMsg->destId.addr = syncUtilAddr2U64("127.0.0.1", 5678);
pMsg->destId.vgId = 100;
pMsg->term = 11;
- pMsg->privateTerm = 99;
pMsg->lastIndex = 22;
pMsg->lastTerm = 33;
diff --git a/source/libs/sync/test/syncSnapshotSenderTest.cpp b/source/libs/sync/test/syncSnapshotSenderTest.cpp
index 8d1f83b3b1..7b2c13463c 100644
--- a/source/libs/sync/test/syncSnapshotSenderTest.cpp
+++ b/source/libs/sync/test/syncSnapshotSenderTest.cpp
@@ -37,10 +37,13 @@ SSyncSnapshotSender* createSender() {
SSyncNode* pSyncNode = (SSyncNode*)taosMemoryMalloc(sizeof(*pSyncNode));
pSyncNode->pRaftStore = (SRaftStore*)taosMemoryMalloc(sizeof(*(pSyncNode->pRaftStore)));
pSyncNode->pFsm = (SSyncFSM*)taosMemoryMalloc(sizeof(*(pSyncNode->pFsm)));
+
+ #if 0
pSyncNode->pFsm->FpSnapshotStartRead = SnapshotStartRead;
pSyncNode->pFsm->FpSnapshotStopRead = SnapshotStopRead;
pSyncNode->pFsm->FpSnapshotDoRead = SnapshotDoRead;
pSyncNode->pFsm->FpGetSnapshotInfo = GetSnapshot;
+#endif
SSyncSnapshotSender* pSender = snapshotSenderCreate(pSyncNode, 2);
pSender->start = true;
@@ -55,7 +58,8 @@ SSyncSnapshotSender* createSender() {
pSender->snapshot.lastApplyTerm = 88;
pSender->sendingMS = 77;
pSender->term = 66;
- pSender->privateTerm = 99;
+
+ //pSender->privateTerm = 99;
return pSender;
}
diff --git a/source/libs/sync/test/syncSnapshotTest.cpp b/source/libs/sync/test/syncSnapshotTest.cpp
index 3dc8518072..ea90621bac 100644
--- a/source/libs/sync/test/syncSnapshotTest.cpp
+++ b/source/libs/sync/test/syncSnapshotTest.cpp
@@ -33,7 +33,7 @@ SyncIndex snapshotLastApplyIndex = SYNC_INDEX_INVALID;
const char *pDir = "./syncSnapshotTest";
const char *pWalDir = "./syncSnapshotTest_wal";
-void CommitCb(struct SSyncFSM *pFsm, const SRpcMsg *pMsg, SFsmCbMeta cbMeta) {
+void CommitCb(const struct SSyncFSM *pFsm, const SRpcMsg *pMsg, SFsmCbMeta cbMeta) {
SyncIndex beginIndex = SYNC_INDEX_INVALID;
if (pFsm->FpGetSnapshotInfo != NULL) {
SSnapshot snapshot;
@@ -45,30 +45,30 @@ void CommitCb(struct SSyncFSM *pFsm, const SRpcMsg *pMsg, SFsmCbMeta cbMeta) {
char logBuf[256];
snprintf(logBuf, sizeof(logBuf),
"==callback== ==CommitCb== pFsm:%p, index:%" PRId64 ", isWeak:%d, code:%d, state:%d %s \n", pFsm,
- cbMeta.index, cbMeta.isWeak, cbMeta.code, cbMeta.state, syncUtilState2String(cbMeta.state));
+ cbMeta.index, cbMeta.isWeak, cbMeta.code, cbMeta.state, syncStr(cbMeta.state));
syncRpcMsgLog2(logBuf, (SRpcMsg *)pMsg);
} else {
sTrace("==callback== ==CommitCb== do not apply again %" PRId64, cbMeta.index);
}
}
-void PreCommitCb(struct SSyncFSM *pFsm, const SRpcMsg *pMsg, SFsmCbMeta cbMeta) {
+void PreCommitCb(const struct SSyncFSM *pFsm, const SRpcMsg *pMsg, SFsmCbMeta cbMeta) {
char logBuf[256];
snprintf(logBuf, sizeof(logBuf),
"==callback== ==PreCommitCb== pFsm:%p, index:%" PRId64 ", isWeak:%d, code:%d, state:%d %s \n", pFsm,
- cbMeta.index, cbMeta.isWeak, cbMeta.code, cbMeta.state, syncUtilState2String(cbMeta.state));
+ cbMeta.index, cbMeta.isWeak, cbMeta.code, cbMeta.state, syncStr(cbMeta.state));
syncRpcMsgLog2(logBuf, (SRpcMsg *)pMsg);
}
-void RollBackCb(struct SSyncFSM *pFsm, const SRpcMsg *pMsg, SFsmCbMeta cbMeta) {
+void RollBackCb(const struct SSyncFSM *pFsm, const SRpcMsg *pMsg, SFsmCbMeta cbMeta) {
char logBuf[256];
snprintf(logBuf, sizeof(logBuf),
"==callback== ==RollBackCb== pFsm:%p, index:%" PRId64 ", isWeak:%d, code:%d, state:%d %s \n", pFsm,
- cbMeta.index, cbMeta.isWeak, cbMeta.code, cbMeta.state, syncUtilState2String(cbMeta.state));
+ cbMeta.index, cbMeta.isWeak, cbMeta.code, cbMeta.state, syncStr(cbMeta.state));
syncRpcMsgLog2(logBuf, (SRpcMsg *)pMsg);
}
-int32_t GetSnapshotCb(struct SSyncFSM *pFsm, SSnapshot *pSnapshot) {
+int32_t GetSnapshotCb(const struct SSyncFSM *pFsm, SSnapshot *pSnapshot) {
pSnapshot->data = NULL;
pSnapshot->lastApplyIndex = snapshotLastApplyIndex;
pSnapshot->lastApplyTerm = 100;
@@ -78,17 +78,21 @@ int32_t GetSnapshotCb(struct SSyncFSM *pFsm, SSnapshot *pSnapshot) {
void initFsm() {
pFsm = (SSyncFSM *)taosMemoryMalloc(sizeof(SSyncFSM));
memset(pFsm, 0, sizeof(*pFsm));
+
+#if 0
pFsm->FpCommitCb = CommitCb;
pFsm->FpPreCommitCb = PreCommitCb;
pFsm->FpRollBackCb = RollBackCb;
pFsm->FpGetSnapshotInfo = GetSnapshotCb;
+#endif
+
}
SSyncNode *syncNodeInit() {
syncInfo.vgId = 1234;
syncInfo.msgcb = &gSyncIO->msgcb;
- syncInfo.FpSendMsg = syncIOSendMsg;
- syncInfo.FpEqMsg = syncIOEqMsg;
+ syncInfo.syncSendMSg = syncIOSendMsg;
+ syncInfo.syncEqMsg = syncIOEqMsg;
syncInfo.pFsm = pFsm;
snprintf(syncInfo.path, sizeof(syncInfo.path), "%s", pDir);
@@ -179,7 +183,7 @@ int main(int argc, char **argv) {
int32_t ret = syncIOStart((char *)"127.0.0.1", ports[myIndex]);
assert(ret == 0);
- ret = syncEnvStart();
+ ret = syncInit();
assert(ret == 0);
// taosRemoveDir(pWalDir);
@@ -204,7 +208,7 @@ int main(int argc, char **argv) {
SyncClientRequest *pSyncClientRequest = pMsg1;
SRpcMsg rpcMsg;
syncClientRequest2RpcMsg(pSyncClientRequest, &rpcMsg);
- gSyncNode->FpEqMsg(gSyncNode->msgcb, &rpcMsg);
+ gSyncNode->syncEqMsg(gSyncNode->msgcb, &rpcMsg);
taosMsleep(1000);
}
diff --git a/source/libs/sync/test/syncTestTool.cpp b/source/libs/sync/test/syncTestTool.cpp
index bdb4d7d2d8..e6f6006410 100644
--- a/source/libs/sync/test/syncTestTool.cpp
+++ b/source/libs/sync/test/syncTestTool.cpp
@@ -44,8 +44,8 @@ void CommitCb(struct SSyncFSM* pFsm, const SRpcMsg* pMsg, SFsmCbMeta cbMeta) {
", term:%" PRIu64
" "
"currentTerm:%" PRIu64 " \n",
- pFsm, cbMeta.index, cbMeta.isWeak, cbMeta.code, cbMeta.state, syncUtilState2String(cbMeta.state),
- cbMeta.flag, cbMeta.term, cbMeta.currentTerm);
+ pFsm, cbMeta.index, cbMeta.isWeak, cbMeta.code, cbMeta.state, syncStr(cbMeta.state), cbMeta.flag,
+ cbMeta.term, cbMeta.currentTerm);
syncRpcMsgLog2(logBuf, (SRpcMsg*)pMsg);
}
@@ -56,8 +56,8 @@ void PreCommitCb(struct SSyncFSM* pFsm, const SRpcMsg* pMsg, SFsmCbMeta cbMeta)
", term:%" PRIu64
" "
"currentTerm:%" PRIu64 " \n",
- pFsm, cbMeta.index, cbMeta.isWeak, cbMeta.code, cbMeta.state, syncUtilState2String(cbMeta.state),
- cbMeta.flag, cbMeta.term, cbMeta.currentTerm);
+ pFsm, cbMeta.index, cbMeta.isWeak, cbMeta.code, cbMeta.state, syncStr(cbMeta.state), cbMeta.flag,
+ cbMeta.term, cbMeta.currentTerm);
syncRpcMsgLog2(logBuf, (SRpcMsg*)pMsg);
}
@@ -68,8 +68,8 @@ void RollBackCb(struct SSyncFSM* pFsm, const SRpcMsg* pMsg, SFsmCbMeta cbMeta) {
", term:%" PRIu64
" "
"currentTerm:%" PRIu64 " \n",
- pFsm, cbMeta.index, cbMeta.isWeak, cbMeta.code, cbMeta.state, syncUtilState2String(cbMeta.state),
- cbMeta.flag, cbMeta.term, cbMeta.currentTerm);
+ pFsm, cbMeta.index, cbMeta.isWeak, cbMeta.code, cbMeta.state, syncStr(cbMeta.state), cbMeta.flag,
+ cbMeta.term, cbMeta.currentTerm);
syncRpcMsgLog2(logBuf, (SRpcMsg*)pMsg);
}
@@ -168,8 +168,8 @@ void LeaderTransferCb(struct SSyncFSM* pFsm, const SRpcMsg* pMsg, SFsmCbMeta cbM
", isWeak:%d, code:%d, state:%d %s, flag:%" PRIu64 ", term:%" PRIu64
" "
"currentTerm:%" PRIu64 " \n",
- pFsm, cbMeta.index, cbMeta.isWeak, cbMeta.code, cbMeta.state, syncUtilState2String(cbMeta.state),
- cbMeta.flag, cbMeta.term, cbMeta.currentTerm);
+ pFsm, cbMeta.index, cbMeta.isWeak, cbMeta.code, cbMeta.state, syncStr(cbMeta.state), cbMeta.flag,
+ cbMeta.term, cbMeta.currentTerm);
syncRpcMsgLog2(logBuf, (SRpcMsg*)pMsg);
}
@@ -177,6 +177,7 @@ SSyncFSM* createFsm() {
SSyncFSM* pFsm = (SSyncFSM*)taosMemoryMalloc(sizeof(SSyncFSM));
memset(pFsm, 0, sizeof(*pFsm));
+#if 0
pFsm->FpCommitCb = CommitCb;
pFsm->FpPreCommitCb = PreCommitCb;
pFsm->FpRollBackCb = RollBackCb;
@@ -193,6 +194,7 @@ SSyncFSM* createFsm() {
pFsm->FpSnapshotDoWrite = SnapshotDoWrite;
pFsm->FpLeaderTransferCb = LeaderTransferCb;
+#endif
return pFsm;
}
@@ -217,8 +219,8 @@ int64_t createSyncNode(int32_t replicaNum, int32_t myIndex, int32_t vgId, SWal*
SSyncInfo syncInfo;
syncInfo.vgId = vgId;
syncInfo.msgcb = &gSyncIO->msgcb;
- syncInfo.FpSendMsg = syncIOSendMsg;
- syncInfo.FpEqMsg = syncIOEqMsg;
+ syncInfo.syncSendMSg = syncIOSendMsg;
+ syncInfo.syncEqMsg = syncIOEqMsg;
syncInfo.pFsm = createFsm();
snprintf(syncInfo.path, sizeof(syncInfo.path), "%s_sync_replica%d_index%d", path, replicaNum, myIndex);
syncInfo.pWal = pWal;
diff --git a/source/libs/sync/test/syncVotesGrantedTest.cpp b/source/libs/sync/test/syncVotesGrantedTest.cpp
index d4885d0316..bbf14c604e 100644
--- a/source/libs/sync/test/syncVotesGrantedTest.cpp
+++ b/source/libs/sync/test/syncVotesGrantedTest.cpp
@@ -28,8 +28,8 @@ SSyncNode* pSyncNode;
SSyncNode* syncNodeInit() {
syncInfo.vgId = 1234;
syncInfo.msgcb = &gSyncIO->msgcb;
- syncInfo.FpSendMsg = syncIOSendMsg;
- syncInfo.FpEqMsg = syncIOEqMsg;
+ syncInfo.syncSendMSg = syncIOSendMsg;
+ syncInfo.syncEqMsg = syncIOEqMsg;
syncInfo.pFsm = pFsm;
snprintf(syncInfo.path, sizeof(syncInfo.path), "%s", "./");
@@ -82,7 +82,7 @@ int main(int argc, char** argv) {
int32_t ret = syncIOStart((char*)"127.0.0.1", ports[myIndex]);
assert(ret == 0);
- ret = syncEnvStart();
+ ret = syncInit();
assert(ret == 0);
SSyncNode* pSyncNode = syncInitTest();
diff --git a/source/libs/sync/test/syncVotesRespondTest.cpp b/source/libs/sync/test/syncVotesRespondTest.cpp
index 77262dfc65..adebfe1be2 100644
--- a/source/libs/sync/test/syncVotesRespondTest.cpp
+++ b/source/libs/sync/test/syncVotesRespondTest.cpp
@@ -28,8 +28,8 @@ SSyncNode* pSyncNode;
SSyncNode* syncNodeInit() {
syncInfo.vgId = 1234;
syncInfo.msgcb = &gSyncIO->msgcb;
- syncInfo.FpSendMsg = syncIOSendMsg;
- syncInfo.FpEqMsg = syncIOEqMsg;
+ syncInfo.syncSendMSg = syncIOSendMsg;
+ syncInfo.syncEqMsg = syncIOEqMsg;
syncInfo.pFsm = pFsm;
snprintf(syncInfo.path, sizeof(syncInfo.path), "%s", "./");
@@ -82,7 +82,7 @@ int main(int argc, char** argv) {
int32_t ret = syncIOStart((char*)"127.0.0.1", ports[myIndex]);
assert(ret == 0);
- ret = syncEnvStart();
+ ret = syncInit();
assert(ret == 0);
SSyncNode* pSyncNode = syncInitTest();
diff --git a/source/libs/sync/test/syncWriteTest.cpp b/source/libs/sync/test/syncWriteTest.cpp
index b185f52f75..cafecabc4d 100644
--- a/source/libs/sync/test/syncWriteTest.cpp
+++ b/source/libs/sync/test/syncWriteTest.cpp
@@ -35,7 +35,7 @@ void CommitCb(struct SSyncFSM *pFsm, const SRpcMsg *pMsg, SFsmCbMeta cbMeta) {
char logBuf[256];
snprintf(logBuf, sizeof(logBuf),
"==callback== ==CommitCb== pFsm:%p, index:%" PRId64 ", isWeak:%d, code:%d, state:%d %s \n", pFsm,
- cbMeta.index, cbMeta.isWeak, cbMeta.code, cbMeta.state, syncUtilState2String(cbMeta.state));
+ cbMeta.index, cbMeta.isWeak, cbMeta.code, cbMeta.state, syncStr(cbMeta.state));
syncRpcMsgLog2(logBuf, (SRpcMsg *)pMsg);
}
@@ -43,7 +43,7 @@ void PreCommitCb(struct SSyncFSM *pFsm, const SRpcMsg *pMsg, SFsmCbMeta cbMeta)
char logBuf[256];
snprintf(logBuf, sizeof(logBuf),
"==callback== ==PreCommitCb== pFsm:%p, index:%" PRId64 ", isWeak:%d, code:%d, state:%d %s \n", pFsm,
- cbMeta.index, cbMeta.isWeak, cbMeta.code, cbMeta.state, syncUtilState2String(cbMeta.state));
+ cbMeta.index, cbMeta.isWeak, cbMeta.code, cbMeta.state, syncStr(cbMeta.state));
syncRpcMsgLog2(logBuf, (SRpcMsg *)pMsg);
}
@@ -51,22 +51,26 @@ void RollBackCb(struct SSyncFSM *pFsm, const SRpcMsg *pMsg, SFsmCbMeta cbMeta) {
char logBuf[256];
snprintf(logBuf, sizeof(logBuf),
"==callback== ==RollBackCb== pFsm:%p, index:%" PRId64 ", isWeak:%d, code:%d, state:%d %s \n", pFsm,
- cbMeta.index, cbMeta.isWeak, cbMeta.code, cbMeta.state, syncUtilState2String(cbMeta.state));
+ cbMeta.index, cbMeta.isWeak, cbMeta.code, cbMeta.state, syncStr(cbMeta.state));
syncRpcMsgLog2(logBuf, (SRpcMsg *)pMsg);
}
void initFsm() {
pFsm = (SSyncFSM *)taosMemoryMalloc(sizeof(SSyncFSM));
+
+#if 0
pFsm->FpCommitCb = CommitCb;
pFsm->FpPreCommitCb = PreCommitCb;
pFsm->FpRollBackCb = RollBackCb;
+#endif
+
}
SSyncNode *syncNodeInit() {
syncInfo.vgId = 1234;
syncInfo.msgcb = &gSyncIO->msgcb;
- syncInfo.FpSendMsg = syncIOSendMsg;
- syncInfo.FpEqMsg = syncIOEqMsg;
+ syncInfo.syncSendMSg = syncIOSendMsg;
+ syncInfo.syncEqMsg = syncIOEqMsg;
syncInfo.pFsm = pFsm;
snprintf(syncInfo.path, sizeof(syncInfo.path), "%s", pDir);
@@ -154,7 +158,7 @@ int main(int argc, char **argv) {
int32_t ret = syncIOStart((char *)"127.0.0.1", ports[myIndex]);
assert(ret == 0);
- ret = syncEnvStart();
+ ret = syncInit();
assert(ret == 0);
taosRemoveDir("./wal_test");
@@ -179,7 +183,7 @@ int main(int argc, char **argv) {
SyncClientRequest *pSyncClientRequest = pMsg1;
SRpcMsg rpcMsg;
syncClientRequest2RpcMsg(pSyncClientRequest, &rpcMsg);
- gSyncNode->FpEqMsg(gSyncNode->msgcb, &rpcMsg);
+ gSyncNode->syncEqMsg(gSyncNode->msgcb, &rpcMsg);
taosMsleep(1000);
}
diff --git a/source/libs/tdb/src/db/tdbBtree.c b/source/libs/tdb/src/db/tdbBtree.c
index 19580d486a..e4d3cc3488 100644
--- a/source/libs/tdb/src/db/tdbBtree.c
+++ b/source/libs/tdb/src/db/tdbBtree.c
@@ -1715,16 +1715,20 @@ int tdbBtreeNext(SBTC *pBtc, void **ppKey, int *kLen, void **ppVal, int *vLen) {
memcpy(pKey, cd.pKey, cd.kLen);
if (ppVal) {
- // TODO: vLen may be zero
- pVal = tdbRealloc(*ppVal, cd.vLen);
- if (pVal == NULL) {
- tdbFree(pKey);
- return -1;
+ if (cd.vLen > 0) {
+ pVal = tdbRealloc(*ppVal, cd.vLen);
+ if (pVal == NULL) {
+ tdbFree(pKey);
+ return -1;
+ }
+
+ memcpy(pVal, cd.pVal, cd.vLen);
+ } else {
+ pVal = NULL;
}
*ppVal = pVal;
*vLen = cd.vLen;
- memcpy(pVal, cd.pVal, cd.vLen);
}
ret = tdbBtcMoveToNext(pBtc);
diff --git a/source/libs/transport/inc/transComm.h b/source/libs/transport/inc/transComm.h
index b83f84e3f2..2354f0f959 100644
--- a/source/libs/transport/inc/transComm.h
+++ b/source/libs/transport/inc/transComm.h
@@ -428,6 +428,7 @@ void transDestoryExHandle(void* handle);
int32_t transGetRefMgt();
int32_t transGetInstMgt();
+void transHttpEnvDestroy();
#ifdef __cplusplus
}
#endif
diff --git a/source/libs/transport/src/thttp.c b/source/libs/transport/src/thttp.c
index 92989a45f5..00854b5ee5 100644
--- a/source/libs/transport/src/thttp.c
+++ b/source/libs/transport/src/thttp.c
@@ -20,21 +20,52 @@
#include "thttp.h"
#include "taoserror.h"
#include "tlog.h"
+#include "transComm.h"
// clang-format on
#define HTTP_RECV_BUF_SIZE 1024
+typedef struct SHttpModule {
+ uv_loop_t* loop;
+ SAsyncPool* asyncPool;
+ TdThread thread;
+} SHttpModule;
+
+typedef struct SHttpMsg {
+ queue q;
+ char* server;
+ int32_t port;
+ char* cont;
+ int32_t len;
+ EHttpCompFlag flag;
+ int8_t quit;
+ SHttpModule* http;
+
+} SHttpMsg;
+
typedef struct SHttpClient {
- uv_connect_t conn;
- uv_tcp_t tcp;
- uv_write_t req;
- uv_buf_t* wbuf;
- char* rbuf;
- char* addr;
- uint16_t port;
+ uv_connect_t conn;
+ uv_tcp_t tcp;
+ uv_write_t req;
+ uv_buf_t* wbuf;
+ char* rbuf;
+ char* addr;
+ uint16_t port;
+ struct sockaddr_in dest;
} SHttpClient;
+static TdThreadOnce transHttpInit = PTHREAD_ONCE_INIT;
+static SHttpModule* thttp = NULL;
+static void transHttpEnvInit();
+
+static void httpHandleReq(SHttpMsg* msg);
+static void httpHandleQuit(SHttpMsg* msg);
+static int32_t httpSendQuit();
+
+static int32_t taosSendHttpReportImpl(const char* server, uint16_t port, char* pCont, int32_t contLen,
+ EHttpCompFlag flag);
+
static int32_t taosBuildHttpHeader(const char* server, int32_t contLen, char* pHead, int32_t headLen,
EHttpCompFlag flag) {
if (flag == HTTP_FLAT) {
@@ -53,6 +84,7 @@ static int32_t taosBuildHttpHeader(const char* server, int32_t contLen, char* pH
"Content-Length: %d\n\n",
server, contLen);
} else {
+ terrno = TSDB_CODE_INVALID_CFG;
return -1;
}
}
@@ -126,88 +158,10 @@ _OVER:
return code;
}
-static FORCE_INLINE void destroyHttpClient(SHttpClient* cli) {
- taosMemoryFree(cli->wbuf);
- taosMemoryFree(cli->rbuf);
- taosMemoryFree(cli->addr);
- taosMemoryFree(cli);
-}
-static FORCE_INLINE void clientCloseCb(uv_handle_t* handle) {
- SHttpClient* cli = handle->data;
- destroyHttpClient(cli);
-}
-static FORCE_INLINE void clientAllocBuffCb(uv_handle_t* handle, size_t suggested_size, uv_buf_t* buf) {
- SHttpClient* cli = handle->data;
- buf->base = cli->rbuf;
- buf->len = HTTP_RECV_BUF_SIZE;
-}
-static FORCE_INLINE void clientRecvCb(uv_stream_t* handle, ssize_t nread, const uv_buf_t* buf) {
- SHttpClient* cli = handle->data;
- if (nread < 0) {
- uError("http-report recv error:%s", uv_err_name(nread));
- } else {
- uTrace("http-report succ to recv %d bytes", (int32_t)nread);
- }
- if (!uv_is_closing((uv_handle_t*)&cli->tcp)) {
- uv_close((uv_handle_t*)&cli->tcp, clientCloseCb);
- } else {
- destroyHttpClient(cli);
- }
-}
-static void clientSentCb(uv_write_t* req, int32_t status) {
- SHttpClient* cli = req->data;
- if (status != 0) {
- terrno = TAOS_SYSTEM_ERROR(status);
- uError("http-report failed to send data %s", uv_strerror(status));
- if (!uv_is_closing((uv_handle_t*)&cli->tcp)) {
- uv_close((uv_handle_t*)&cli->tcp, clientCloseCb);
- } else {
- destroyHttpClient(cli);
- }
- return;
- } else {
- uTrace("http-report succ to send data");
- }
- status = uv_read_start((uv_stream_t*)&cli->tcp, clientAllocBuffCb, clientRecvCb);
- if (status != 0) {
- terrno = TAOS_SYSTEM_ERROR(status);
- uError("http-report failed to recv data,reason:%s, dst:%s:%d", uv_strerror(status), cli->addr, cli->port);
- if (!uv_is_closing((uv_handle_t*)&cli->tcp)) {
- uv_close((uv_handle_t*)&cli->tcp, clientCloseCb);
- } else {
- destroyHttpClient(cli);
- }
- }
-}
-static void clientConnCb(uv_connect_t* req, int32_t status) {
- SHttpClient* cli = req->data;
- if (status != 0) {
- terrno = TAOS_SYSTEM_ERROR(status);
- uError("http-report failed to conn to server, reason:%s, dst:%s:%d", uv_strerror(status), cli->addr, cli->port);
- if (!uv_is_closing((uv_handle_t*)&cli->tcp)) {
- uv_close((uv_handle_t*)&cli->tcp, clientCloseCb);
- } else {
- destroyHttpClient(cli);
- }
- return;
- }
- status = uv_write(&cli->req, (uv_stream_t*)&cli->tcp, cli->wbuf, 2, clientSentCb);
- if (0 != status) {
- terrno = TAOS_SYSTEM_ERROR(status);
- uError("http-report failed to send data,reason:%s, dst:%s:%d", uv_strerror(status), cli->addr, cli->port);
- if (!uv_is_closing((uv_handle_t*)&cli->tcp)) {
- uv_close((uv_handle_t*)&cli->tcp, clientCloseCb);
- } else {
- destroyHttpClient(cli);
- }
- }
-}
-
static FORCE_INLINE int32_t taosBuildDstAddr(const char* server, uint16_t port, struct sockaddr_in* dest) {
uint32_t ip = taosGetIpv4FromFqdn(server);
if (ip == 0xffffffff) {
- terrno = TAOS_SYSTEM_ERROR(errno);
- uError("http-report failed to get http server:%s since %s", server, errno == 0 ? "invalid http server" : terrstr());
+ tError("http-report failed to get http server:%s since %s", server, errno == 0 ? "invalid http server" : terrstr());
return -1;
}
char buf[128] = {0};
@@ -215,27 +169,206 @@ static FORCE_INLINE int32_t taosBuildDstAddr(const char* server, uint16_t port,
uv_ip4_addr(buf, port, dest);
return 0;
}
-int32_t taosSendHttpReport(const char* server, uint16_t port, char* pCont, int32_t contLen, EHttpCompFlag flag) {
- struct sockaddr_in dest = {0};
- if (taosBuildDstAddr(server, port, &dest) < 0) {
- return -1;
- }
- if (flag == HTTP_GZIP) {
- int32_t dstLen = taosCompressHttpRport(pCont, contLen);
- if (dstLen > 0) {
- contLen = dstLen;
+
+static void* httpThread(void* arg) {
+ SHttpModule* http = (SHttpModule*)arg;
+ setThreadName("http-cli-send-thread");
+ uv_run(http->loop, UV_RUN_DEFAULT);
+ return NULL;
+}
+
+static void httpDestroyMsg(SHttpMsg* msg) {
+ if (msg == NULL) return;
+
+ taosMemoryFree(msg->server);
+ taosMemoryFree(msg->cont);
+ taosMemoryFree(msg);
+}
+static void httpAsyncCb(uv_async_t* handle) {
+ SAsyncItem* item = handle->data;
+ SHttpModule* http = item->pThrd;
+
+ SHttpMsg *msg = NULL, *quitMsg = NULL;
+
+ queue wq;
+ taosThreadMutexLock(&item->mtx);
+ QUEUE_MOVE(&item->qmsg, &wq);
+ taosThreadMutexUnlock(&item->mtx);
+
+ int count = 0;
+ while (!QUEUE_IS_EMPTY(&wq)) {
+ queue* h = QUEUE_HEAD(&wq);
+ QUEUE_REMOVE(h);
+ msg = QUEUE_DATA(h, SHttpMsg, q);
+ if (msg->quit) {
+ quitMsg = msg;
} else {
- flag = HTTP_FLAT;
+ httpHandleReq(msg);
}
}
- terrno = 0;
+ if (quitMsg) httpHandleQuit(quitMsg);
+}
- char header[2048] = {0};
- int32_t headLen = taosBuildHttpHeader(server, contLen, header, sizeof(header), flag);
+static FORCE_INLINE void destroyHttpClient(SHttpClient* cli) {
+ taosMemoryFree(cli->wbuf[0].base);
+ taosMemoryFree(cli->wbuf[1].base);
+ taosMemoryFree(cli->wbuf);
+ taosMemoryFree(cli->rbuf);
+ taosMemoryFree(cli->addr);
+ taosMemoryFree(cli);
+}
+
+static FORCE_INLINE void clientCloseCb(uv_handle_t* handle) {
+ SHttpClient* cli = handle->data;
+ destroyHttpClient(cli);
+}
+
+static FORCE_INLINE void clientAllocBuffCb(uv_handle_t* handle, size_t suggested_size, uv_buf_t* buf) {
+ SHttpClient* cli = handle->data;
+ buf->base = cli->rbuf;
+ buf->len = HTTP_RECV_BUF_SIZE;
+}
+
+static FORCE_INLINE void clientRecvCb(uv_stream_t* handle, ssize_t nread, const uv_buf_t* buf) {
+ SHttpClient* cli = handle->data;
+ if (nread < 0) {
+ tError("http-report recv error:%s", uv_err_name(nread));
+ } else {
+ tTrace("http-report succ to recv %d bytes", (int32_t)nread);
+ }
+ if (!uv_is_closing((uv_handle_t*)&cli->tcp)) {
+ uv_close((uv_handle_t*)&cli->tcp, clientCloseCb);
+ }
+}
+static void clientSentCb(uv_write_t* req, int32_t status) {
+ SHttpClient* cli = req->data;
+ if (status != 0) {
+ tError("http-report failed to send data, reason: %s, dst:%s:%d", uv_strerror(status), cli->addr, cli->port);
+ if (!uv_is_closing((uv_handle_t*)&cli->tcp)) {
+ uv_close((uv_handle_t*)&cli->tcp, clientCloseCb);
+ }
+ return;
+ } else {
+ tTrace("http-report succ to send data");
+ }
+ status = uv_read_start((uv_stream_t*)&cli->tcp, clientAllocBuffCb, clientRecvCb);
+ if (status != 0) {
+ tError("http-report failed to recv data,reason:%s, dst:%s:%d", uv_strerror(status), cli->addr, cli->port);
+ if (!uv_is_closing((uv_handle_t*)&cli->tcp)) {
+ uv_close((uv_handle_t*)&cli->tcp, clientCloseCb);
+ }
+ }
+}
+static void clientConnCb(uv_connect_t* req, int32_t status) {
+ SHttpClient* cli = req->data;
+ if (status != 0) {
+ tError("http-report failed to conn to server, reason:%s, dst:%s:%d", uv_strerror(status), cli->addr, cli->port);
+ if (!uv_is_closing((uv_handle_t*)&cli->tcp)) {
+ uv_close((uv_handle_t*)&cli->tcp, clientCloseCb);
+ }
+ return;
+ }
+ status = uv_write(&cli->req, (uv_stream_t*)&cli->tcp, cli->wbuf, 2, clientSentCb);
+ if (0 != status) {
+ tError("http-report failed to send data,reason:%s, dst:%s:%d", uv_strerror(status), cli->addr, cli->port);
+ if (!uv_is_closing((uv_handle_t*)&cli->tcp)) {
+ uv_close((uv_handle_t*)&cli->tcp, clientCloseCb);
+ }
+ }
+}
+
+int32_t httpSendQuit() {
+ SHttpMsg* msg = taosMemoryCalloc(1, sizeof(SHttpMsg));
+ msg->quit = 1;
+
+ SHttpModule* load = atomic_load_ptr(&thttp);
+ if (load == NULL) {
+ httpDestroyMsg(msg);
+ tError("http-report already released");
+ return -1;
+ } else {
+ msg->http = load;
+ }
+ transAsyncSend(load->asyncPool, &(msg->q));
+ return 0;
+}
+
+static int32_t taosSendHttpReportImpl(const char* server, uint16_t port, char* pCont, int32_t contLen,
+ EHttpCompFlag flag) {
+ SHttpMsg* msg = taosMemoryMalloc(sizeof(SHttpMsg));
+ msg->server = strdup(server);
+ msg->port = port;
+ msg->cont = taosMemoryMalloc(contLen);
+ memcpy(msg->cont, pCont, contLen);
+ msg->len = contLen;
+ msg->flag = flag;
+ msg->quit = 0;
+
+ SHttpModule* load = atomic_load_ptr(&thttp);
+ if (load == NULL) {
+ httpDestroyMsg(msg);
+ tError("http-report already released");
+ return -1;
+ } else {
+ msg->http = load;
+ transAsyncSend(load->asyncPool, &(msg->q));
+ }
+
+ return 0;
+}
+
+static void httpDestroyClientCb(uv_handle_t* handle) {
+ SHttpClient* http = handle->data;
+ destroyHttpClient(http);
+}
+static void httpWalkCb(uv_handle_t* handle, void* arg) {
+ // impl later
+ if (!uv_is_closing(handle)) {
+ uv_handle_type type = uv_handle_get_type(handle);
+ if (uv_handle_get_type(handle) == UV_TCP) {
+ uv_close(handle, httpDestroyClientCb);
+ } else {
+ uv_close(handle, NULL);
+ }
+ }
+ return;
+}
+static void httpHandleQuit(SHttpMsg* msg) {
+ SHttpModule* http = msg->http;
+ taosMemoryFree(msg);
+
+ uv_walk(http->loop, httpWalkCb, NULL);
+}
+static void httpHandleReq(SHttpMsg* msg) {
+ SHttpModule* http = msg->http;
+
+ struct sockaddr_in dest = {0};
+ if (taosBuildDstAddr(msg->server, msg->port, &dest) < 0) {
+ goto END;
+ }
+ if (msg->flag == HTTP_GZIP) {
+ int32_t dstLen = taosCompressHttpRport(msg->cont, msg->len);
+ if (dstLen > 0) {
+ msg->len = dstLen;
+ } else {
+ msg->flag = HTTP_FLAT;
+ }
+ if (dstLen < 0) {
+ goto END;
+ }
+ }
+
+ int32_t len = 2048;
+ char* header = taosMemoryCalloc(1, len);
+ int32_t headLen = taosBuildHttpHeader(msg->server, msg->len, header, len, msg->flag);
+ if (headLen < 0) {
+ taosMemoryFree(header);
+ goto END;
+ }
uv_buf_t* wb = taosMemoryCalloc(2, sizeof(uv_buf_t));
- wb[0] = uv_buf_init((char*)header, headLen); // stack var
- wb[1] = uv_buf_init((char*)pCont, contLen); // heap var
+ wb[0] = uv_buf_init((char*)header, strlen(header)); // heap var
+ wb[1] = uv_buf_init((char*)msg->cont, msg->len); // heap var
SHttpClient* cli = taosMemoryCalloc(1, sizeof(SHttpClient));
cli->conn.data = cli;
@@ -243,41 +376,71 @@ int32_t taosSendHttpReport(const char* server, uint16_t port, char* pCont, int32
cli->req.data = cli;
cli->wbuf = wb;
cli->rbuf = taosMemoryCalloc(1, HTTP_RECV_BUF_SIZE);
- cli->addr = tstrdup(server);
- cli->port = port;
+ cli->addr = msg->server;
+ cli->port = msg->port;
+ cli->dest = dest;
+
+ taosMemoryFree(msg);
+
+ uv_tcp_init(http->loop, &cli->tcp);
- uv_loop_t* loop = taosMemoryMalloc(sizeof(uv_loop_t));
- int err = uv_loop_init(loop);
- if (err != 0) {
- uError("http-report failed to init uv_loop, reason: %s", uv_strerror(err));
- taosMemoryFree(loop);
- terrno = TAOS_SYSTEM_ERROR(err);
- destroyHttpClient(cli);
- return terrno;
- }
- uv_tcp_init(loop, &cli->tcp);
// set up timeout to avoid stuck;
int32_t fd = taosCreateSocketWithTimeout(5);
-
- int ret = uv_tcp_open((uv_tcp_t*)&cli->tcp, fd);
+ int ret = uv_tcp_open((uv_tcp_t*)&cli->tcp, fd);
if (ret != 0) {
- uError("http-report failed to open socket, reason:%s, dst:%s:%d", uv_strerror(ret), cli->addr, cli->port);
+ tError("http-report failed to open socket, reason:%s, dst:%s:%d", uv_strerror(ret), cli->addr, cli->port);
destroyHttpClient(cli);
- uv_stop(loop);
- terrno = TAOS_SYSTEM_ERROR(ret);
- } else {
- ret = uv_tcp_connect(&cli->conn, &cli->tcp, (const struct sockaddr*)&dest, clientConnCb);
- if (ret != 0) {
- uError("http-report failed to connect to http-server, reason:%s, dst:%s:%d", uv_strerror(ret), cli->addr,
- cli->port);
- destroyHttpClient(cli);
- uv_stop(loop);
- terrno = TAOS_SYSTEM_ERROR(ret);
- }
+ return;
}
- uv_run(loop, UV_RUN_DEFAULT);
- uv_loop_close(loop);
- taosMemoryFree(loop);
- return terrno;
+ ret = uv_tcp_connect(&cli->conn, &cli->tcp, (const struct sockaddr*)&cli->dest, clientConnCb);
+ if (ret != 0) {
+ tError("http-report failed to connect to http-server, reason:%s, dst:%s:%d", uv_strerror(ret), cli->addr,
+ cli->port);
+ destroyHttpClient(cli);
+ }
+ return;
+
+END:
+ tError("http-report failed to report, reason: %s, addr: %s:%d", terrstr(), msg->server, msg->port);
+ httpDestroyMsg(msg);
+}
+
+int32_t taosSendHttpReport(const char* server, uint16_t port, char* pCont, int32_t contLen, EHttpCompFlag flag) {
+ taosThreadOnce(&transHttpInit, transHttpEnvInit);
+ return taosSendHttpReportImpl(server, port, pCont, contLen, flag);
+}
+
+static void transHttpEnvInit() {
+ SHttpModule* http = taosMemoryMalloc(sizeof(SHttpModule));
+
+ http->loop = taosMemoryMalloc(sizeof(uv_loop_t));
+ uv_loop_init(http->loop);
+
+ http->asyncPool = transAsyncPoolCreate(http->loop, 1, http, httpAsyncCb);
+
+ int err = taosThreadCreate(&http->thread, NULL, httpThread, (void*)http);
+ if (err != 0) {
+ taosMemoryFree(http->loop);
+ taosMemoryFree(http);
+ http = NULL;
+ }
+ atomic_store_ptr(&thttp, http);
+}
+
+void transHttpEnvDestroy() {
+ SHttpModule* load = atomic_load_ptr(&thttp);
+ if (load == NULL) {
+ return;
+ }
+ httpSendQuit();
+ taosThreadJoin(load->thread, NULL);
+
+ TRANS_DESTROY_ASYNC_POOL_MSG(load->asyncPool, SHttpMsg, httpDestroyMsg);
+ transAsyncPoolDestroy(load->asyncPool);
+ uv_loop_close(load->loop);
+ taosMemoryFree(load->loop);
+ taosMemoryFree(load);
+
+ atomic_store_ptr(&thttp, NULL);
}
diff --git a/source/libs/transport/src/trans.c b/source/libs/transport/src/trans.c
index 756a8ff2cf..d3db4879d1 100644
--- a/source/libs/transport/src/trans.c
+++ b/source/libs/transport/src/trans.c
@@ -172,6 +172,8 @@ int32_t rpcInit() {
}
void rpcCleanup(void) {
transCleanup();
+ transHttpEnvDestroy();
+
return;
}
diff --git a/source/libs/transport/src/transCli.c b/source/libs/transport/src/transCli.c
index 28660934f8..21444018cd 100644
--- a/source/libs/transport/src/transCli.c
+++ b/source/libs/transport/src/transCli.c
@@ -187,18 +187,8 @@ static void cliReleaseUnfinishedMsg(SCliConn* conn) {
snprintf(key, sizeof(key), "%s:%d", ip, (int)port); \
} while (0)
-#define CONN_HOST_THREAD_IDX1(idx, exh, refId, pThrd) \
- do { \
- if (exh == NULL) { \
- idx = -1; \
- } else { \
- ASYNC_CHECK_HANDLE((exh), refId); \
- pThrd = (SCliThrd*)(exh)->pThrd; \
- } \
- } while (0)
-#define CONN_PERSIST_TIME(para) ((para) <= 90000 ? 90000 : (para))
-#define CONN_GET_HOST_THREAD(conn) (conn ? ((SCliConn*)conn)->hostThrd : NULL)
-#define CONN_GET_INST_LABEL(conn) (((STrans*)(((SCliThrd*)(conn)->hostThrd)->pTransInst))->label)
+#define CONN_PERSIST_TIME(para) ((para) <= 90000 ? 90000 : (para))
+#define CONN_GET_INST_LABEL(conn) (((STrans*)(((SCliThrd*)(conn)->hostThrd)->pTransInst))->label)
#define CONN_GET_MSGCTX_BY_AHANDLE(conn, ahandle) \
do { \
@@ -217,6 +207,7 @@ static void cliReleaseUnfinishedMsg(SCliConn* conn) {
tDebug("msg found, %" PRIu64 "", ahandle); \
} \
} while (0)
+
#define CONN_GET_NEXT_SENDMSG(conn) \
do { \
int i = 0; \
@@ -231,21 +222,6 @@ static void cliReleaseUnfinishedMsg(SCliConn* conn) {
} \
} while (0)
-#define CONN_HANDLE_THREAD_QUIT(thrd) \
- do { \
- if (thrd->quit) { \
- return; \
- } \
- } while (0)
-
-#define CONN_HANDLE_BROKEN(conn) \
- do { \
- if (conn->broken) { \
- cliHandleExcept(conn); \
- return; \
- } \
- } while (0)
-
#define CONN_SET_PERSIST_BY_APP(conn) \
do { \
if (conn->status == ConnNormal) { \
@@ -742,8 +718,10 @@ static void cliSendCb(uv_write_t* req, int status) {
if (status == 0) {
tTrace("%s conn %p data already was written out", CONN_GET_INST_LABEL(pConn), pConn);
} else {
- tError("%s conn %p failed to write:%s", CONN_GET_INST_LABEL(pConn), pConn, uv_err_name(status));
- cliHandleExcept(pConn);
+ if (!uv_is_closing((uv_handle_t*)&pConn->stream)) {
+ tError("%s conn %p failed to write:%s", CONN_GET_INST_LABEL(pConn), pConn, uv_err_name(status));
+ cliHandleExcept(pConn);
+ }
return;
}
if (cliHandleNoResp(pConn) == true) {
diff --git a/source/libs/transport/src/transSvr.c b/source/libs/transport/src/transSvr.c
index b829251ccd..944995c892 100644
--- a/source/libs/transport/src/transSvr.c
+++ b/source/libs/transport/src/transSvr.c
@@ -127,7 +127,7 @@ static void uvFreeCb(uv_handle_t* handle);
static FORCE_INLINE void uvStartSendRespImpl(SSvrMsg* smsg);
-static void uvPrepareSendData(SSvrMsg* msg, uv_buf_t* wb);
+static int uvPrepareSendData(SSvrMsg* msg, uv_buf_t* wb);
static void uvStartSendResp(SSvrMsg* msg);
static void uvNotifyLinkBrokenToApp(SSvrConn* conn);
@@ -363,9 +363,11 @@ void uvOnSendCb(uv_write_t* req, int status) {
}
transUnrefSrvHandle(conn);
} else {
- tError("conn %p failed to write data, %s", conn, uv_err_name(status));
- conn->broken = true;
- transUnrefSrvHandle(conn);
+ if (!uv_is_closing((uv_handle_t*)(conn->pTcp))) {
+ tError("conn %p failed to write data, %s", conn, uv_err_name(status));
+ conn->broken = true;
+ transUnrefSrvHandle(conn);
+ }
}
}
static void uvOnPipeWriteCb(uv_write_t* req, int status) {
@@ -382,7 +384,7 @@ static void uvOnPipeWriteCb(uv_write_t* req, int status) {
taosMemoryFree(req);
}
-static void uvPrepareSendData(SSvrMsg* smsg, uv_buf_t* wb) {
+static int uvPrepareSendData(SSvrMsg* smsg, uv_buf_t* wb) {
SSvrConn* pConn = smsg->pConn;
STransMsg* pMsg = &smsg->msg;
if (pMsg->pCont == 0) {
@@ -395,6 +397,13 @@ static void uvPrepareSendData(SSvrMsg* smsg, uv_buf_t* wb) {
pHead->hasEpSet = pMsg->info.hasEpSet;
pHead->magicNum = htonl(TRANS_MAGIC_NUM);
+ // handle invalid drop_task resp, TD-20098
+ if (pMsg->msgType == TDMT_SCH_DROP_TASK && pMsg->code == TSDB_CODE_VND_INVALID_VGROUP_ID) {
+ transQueuePop(&pConn->srvMsgs);
+ destroySmsg(smsg);
+ return -1;
+ }
+
if (pConn->status == ConnNormal) {
pHead->msgType = (0 == pMsg->msgType ? pConn->inType + 1 : pMsg->msgType);
if (smsg->type == Release) pHead->msgType = 0;
@@ -429,6 +438,7 @@ static void uvPrepareSendData(SSvrMsg* smsg, uv_buf_t* wb) {
wb->base = (char*)pHead;
wb->len = len;
+ return 0;
}
static FORCE_INLINE void uvStartSendRespImpl(SSvrMsg* smsg) {
@@ -438,7 +448,9 @@ static FORCE_INLINE void uvStartSendRespImpl(SSvrMsg* smsg) {
}
uv_buf_t wb;
- uvPrepareSendData(smsg, &wb);
+ if (uvPrepareSendData(smsg, &wb) < 0) {
+ return;
+ }
transRefSrvHandle(pConn);
uv_write_t* req = transReqQueuePush(&pConn->wreqQueue);
@@ -449,8 +461,9 @@ static void uvStartSendResp(SSvrMsg* smsg) {
SSvrConn* pConn = smsg->pConn;
if (pConn->broken == true) {
// persist by
- transFreeMsg(smsg->msg.pCont);
- taosMemoryFree(smsg);
+ destroySmsg(smsg);
+ // transFreeMsg(smsg->msg.pCont);
+ // taosMemoryFree(smsg);
transUnrefSrvHandle(pConn);
return;
}
@@ -746,10 +759,11 @@ void uvOnConnectionCb(uv_stream_t* q, ssize_t nread, const uv_buf_t* buf) {
return;
}
transSockInfo2Str(&sockname, pConn->src);
- struct sockaddr_in addr = *(struct sockaddr_in*)&sockname;
+ struct sockaddr_in addr = *(struct sockaddr_in*)&peername;
pConn->clientIp = addr.sin_addr.s_addr;
pConn->port = ntohs(addr.sin_port);
+
uv_read_start((uv_stream_t*)(pConn->pTcp), uvAllocRecvBufferCb, uvOnRecvCb);
} else {
diff --git a/source/libs/wal/inc/walInt.h b/source/libs/wal/inc/walInt.h
index 1aea0e8148..6dc9922981 100644
--- a/source/libs/wal/inc/walInt.h
+++ b/source/libs/wal/inc/walInt.h
@@ -34,6 +34,7 @@ typedef struct {
int64_t createTs;
int64_t closeTs;
int64_t fileSize;
+ int64_t syncedOffset;
} SWalFileInfo;
typedef struct WalIdxEntry {
@@ -66,6 +67,12 @@ static inline int64_t walGetLastFileSize(SWal* pWal) {
return pInfo->fileSize;
}
+static inline int64_t walGetLastFileCachedSize(SWal* pWal) {
+ if (taosArrayGetSize(pWal->fileInfoSet) == 0) return 0;
+ SWalFileInfo* pInfo = (SWalFileInfo*)taosArrayGetLast(pWal->fileInfoSet);
+ return (pInfo->fileSize - pInfo->syncedOffset);
+}
+
static inline int64_t walGetLastFileFirstVer(SWal* pWal) {
if (taosArrayGetSize(pWal->fileInfoSet) == 0) return -1;
SWalFileInfo* pInfo = (SWalFileInfo*)taosArrayGetLast(pWal->fileInfoSet);
diff --git a/source/libs/wal/src/walMeta.c b/source/libs/wal/src/walMeta.c
index b489df2f4c..1c6e1a2e17 100644
--- a/source/libs/wal/src/walMeta.c
+++ b/source/libs/wal/src/walMeta.c
@@ -16,6 +16,7 @@
#include "cJSON.h"
#include "os.h"
#include "taoserror.h"
+#include "tglobal.h"
#include "tutil.h"
#include "walInt.h"
@@ -65,32 +66,43 @@ static FORCE_INLINE int64_t walScanLogGetLastVer(SWal* pWal, int32_t fileIdx) {
// ensure size as non-negative
pFileInfo->fileSize = TMAX(0, pFileInfo->fileSize);
+ int64_t stepSize = WAL_SCAN_BUF_SIZE;
uint64_t magic = WAL_MAGIC;
int64_t walCkHeadSz = sizeof(SWalCkHead);
int64_t end = fileSize;
- int64_t offset = 0;
int64_t capacity = 0;
int64_t readSize = 0;
char* buf = NULL;
- int64_t found = -1;
bool firstTrial = pFileInfo->fileSize < fileSize;
+ int64_t offset = TMIN(pFileInfo->fileSize, fileSize);
+ int64_t offsetForward = offset - stepSize + walCkHeadSz - 1;
+ int64_t offsetBackward = offset;
+ int64_t retVer = -1;
+ int64_t lastEntryBeginOffset = 0;
+ int64_t lastEntryEndOffset = 0;
+
+ // check recover size
+ if (2 * tsWalFsyncDataSizeLimit + offset < end) {
+ wWarn("vgId:%d, possibly corrupted WAL range exceeds size limit (i.e. %" PRId64 " bytes). offset:%" PRId64
+ ", end:%" PRId64 ", file:%s",
+ pWal->cfg.vgId, 2 * tsWalFsyncDataSizeLimit, offset, end, fnameStr);
+ }
// search for the valid last WAL entry, e.g. block by block
while (1) {
- offset = (firstTrial) ? pFileInfo->fileSize : TMAX(0, end - WAL_SCAN_BUF_SIZE);
+ offset = (firstTrial) ? TMIN(fileSize, offsetForward + stepSize - walCkHeadSz + 1)
+ : TMAX(0, offsetBackward - stepSize + walCkHeadSz - 1);
+ end = TMIN(offset + stepSize, fileSize);
+ if (firstTrial) {
+ offsetForward = offset;
+ } else {
+ offsetBackward = offset;
+ }
+
ASSERT(offset <= end);
readSize = end - offset;
capacity = readSize + sizeof(magic);
- int64_t limit = WAL_RECOV_SIZE_LIMIT;
- if (limit < readSize) {
- wError("vgId:%d, possibly corrupted WAL range exceeds size limit (i.e. %" PRId64 " bytes). offset:%" PRId64
- ", end:%" PRId64 ", file:%s",
- pWal->cfg.vgId, limit, offset, end, fnameStr);
- terrno = TSDB_CODE_WAL_SIZE_LIMIT;
- goto _err;
- }
-
void* ptr = taosMemoryRealloc(buf, capacity);
if (ptr == NULL) {
terrno = TSDB_CODE_WAL_OUT_OF_MEMORY;
@@ -127,6 +139,7 @@ static FORCE_INLINE int64_t walScanLogGetLastVer(SWal* pWal, int32_t fileIdx) {
}
logContent = (SWalCkHead*)(buf + pos);
if (walValidHeadCksum(logContent) != 0) {
+ terrno = TSDB_CODE_WAL_CHKSUM_MISMATCH;
wWarn("vgId:%d, failed to validate checksum of wal entry header. offset:%" PRId64 ", file:%s", pWal->cfg.vgId,
offset + pos, fnameStr);
haystack = buf + pos + 1;
@@ -179,46 +192,47 @@ static FORCE_INLINE int64_t walScanLogGetLastVer(SWal* pWal, int32_t fileIdx) {
}
// found one
- found = pos;
+ retVer = logContent->head.version;
+ lastEntryBeginOffset = offset + pos;
+ lastEntryEndOffset = offset + pos + sizeof(SWalCkHead) + logContent->head.bodyLen;
+
+ // try next
haystack = buf + pos + 1;
}
- if (found >= 0 || offset == 0) break;
-
- // go backwards, e.g. by at most one WAL scan buf size
- end = TMIN(offset + walCkHeadSz - 1, fileSize);
- firstTrial = false;
+ if (end == fileSize) firstTrial = false;
+ if (firstTrial) {
+ if (terrno == TSDB_CODE_SUCCESS) {
+ continue;
+ } else {
+ firstTrial = false;
+ }
+ }
+ if (retVer >= 0 || offset == 0) break;
}
- // determine end of last entry
- SWalCkHead* lastEntry = (found >= 0) ? (SWalCkHead*)(buf + found) : NULL;
- int64_t retVer = -1;
- int64_t lastEntryBeginOffset = 0;
- int64_t lastEntryEndOffset = 0;
-
- if (lastEntry == NULL) {
+ if (retVer < 0) {
terrno = TSDB_CODE_WAL_LOG_NOT_EXIST;
- } else {
- retVer = lastEntry->head.version;
- lastEntryBeginOffset = offset + (int64_t)((char*)lastEntry - (char*)buf);
- lastEntryEndOffset = lastEntryBeginOffset + sizeof(SWalCkHead) + lastEntry->head.bodyLen;
}
// truncate file
if (lastEntryEndOffset != fileSize) {
wWarn("vgId:%d, repair meta truncate file %s to %" PRId64 ", orig size %" PRId64, pWal->cfg.vgId, fnameStr,
lastEntryEndOffset, fileSize);
+
if (taosFtruncateFile(pFile, lastEntryEndOffset) < 0) {
wError("failed to truncate file due to %s. file:%s", strerror(errno), fnameStr);
terrno = TAOS_SYSTEM_ERROR(errno);
goto _err;
}
+
if (taosFsyncFile(pFile) < 0) {
wError("failed to fsync file due to %s. file:%s", strerror(errno), fnameStr);
terrno = TAOS_SYSTEM_ERROR(errno);
goto _err;
}
}
+
pFileInfo->fileSize = lastEntryEndOffset;
taosCloseFile(&pFile);
@@ -288,6 +302,33 @@ void walAlignVersions(SWal* pWal) {
pWal->vers.appliedVer = TMIN(pWal->vers.commitVer, pWal->vers.appliedVer);
}
+bool walLogEntriesComplete(const SWal* pWal) {
+ int32_t sz = taosArrayGetSize(pWal->fileInfoSet);
+ bool complete = true;
+ int32_t fileIdx = -1;
+ int64_t index = pWal->vers.firstVer;
+
+ while (++fileIdx < sz) {
+ SWalFileInfo* pFileInfo = taosArrayGet(pWal->fileInfoSet, fileIdx);
+ if (pFileInfo->firstVer != index) {
+ break;
+ }
+ index = pFileInfo->lastVer + ((fileIdx + 1 < sz) ? 1 : 0);
+ }
+ // empty is regarded as complete
+ if (sz != 0) {
+ complete = (index == pWal->vers.lastVer);
+ }
+
+ if (!complete) {
+ wError("vgId:%d, WAL log entries incomplete in range [%" PRId64 ", %" PRId64 "], aligned with snaphotVer:%" PRId64,
+ pWal->cfg.vgId, pWal->vers.firstVer, pWal->vers.lastVer, pWal->vers.snapshotVer);
+ terrno = TSDB_CODE_WAL_LOG_INCOMPLETE;
+ }
+
+ return complete;
+}
+
int walCheckAndRepairMeta(SWal* pWal) {
// load log files, get first/snapshot/last version info
const char* logPattern = "^[0-9]+.log$";
@@ -401,6 +442,11 @@ int walCheckAndRepairMeta(SWal* pWal) {
if (updateMeta) {
(void)walSaveMeta(pWal);
}
+
+ if (!walLogEntriesComplete(pWal)) {
+ return -1;
+ }
+
return 0;
}
@@ -589,6 +635,7 @@ int walRollFileInfo(SWal* pWal) {
pNewInfo->createTs = ts;
pNewInfo->closeTs = -1;
pNewInfo->fileSize = 0;
+ pNewInfo->syncedOffset = 0;
taosArrayPush(pArray, pNewInfo);
taosMemoryFree(pNewInfo);
return 0;
@@ -739,6 +786,12 @@ static int walFindCurMetaVer(SWal* pWal) {
return metaVer;
}
+void walUpdateSyncedOffset(SWal* pWal) {
+ SWalFileInfo* pFileInfo = walGetCurFileInfo(pWal);
+ if (pFileInfo == NULL) return;
+ pFileInfo->syncedOffset = pFileInfo->fileSize;
+}
+
int walSaveMeta(SWal* pWal) {
int metaVer = walFindCurMetaVer(pWal);
char fnameStr[WAL_FILE_LEN];
@@ -758,6 +811,9 @@ int walSaveMeta(SWal* pWal) {
return -1;
}
+ // update synced offset
+ (void)walUpdateSyncedOffset(pWal);
+
// flush to a tmpfile
n = walBuildTmpMetaName(pWal, tmpFnameStr);
ASSERT(n < sizeof(tmpFnameStr) && "Buffer overflow of file name");
diff --git a/source/libs/wal/src/walMgmt.c b/source/libs/wal/src/walMgmt.c
index 0df1a6b387..1a70a3038f 100644
--- a/source/libs/wal/src/walMgmt.c
+++ b/source/libs/wal/src/walMgmt.c
@@ -187,6 +187,13 @@ int32_t walAlter(SWal *pWal, SWalCfg *pCfg) {
return 0;
}
+int32_t walPersist(SWal *pWal) {
+ taosThreadMutexLock(&pWal->mutex);
+ int32_t ret = walSaveMeta(pWal);
+ taosThreadMutexUnlock(&pWal->mutex);
+ return ret;
+}
+
void walClose(SWal *pWal) {
taosThreadMutexLock(&pWal->mutex);
(void)walSaveMeta(pWal);
diff --git a/source/libs/wal/src/walRead.c b/source/libs/wal/src/walRead.c
index 8f493ddd85..1350ca0c37 100644
--- a/source/libs/wal/src/walRead.c
+++ b/source/libs/wal/src/walRead.c
@@ -198,7 +198,7 @@ int32_t walReadSeekVerImpl(SWalReader *pReader, int64_t ver) {
return -1;
}
- wDebug("vgId:%d, wal version reset from index:%" PRId64 "(invalid:%d) to index:%" PRId64, pReader->pWal->cfg.vgId,
+ wDebug("vgId:%d, wal version reset from %" PRId64 "(invalid:%d) to %" PRId64, pReader->pWal->cfg.vgId,
pReader->curVersion, pReader->curInvalid, ver);
pReader->curVersion = ver;
@@ -347,22 +347,47 @@ static int32_t walSkipFetchBodyNew(SWalReader *pRead) {
int32_t walFetchHead(SWalReader *pRead, int64_t ver, SWalCkHead *pHead) {
int64_t code;
+ int64_t contLen;
+ bool seeked = false;
+
+ wDebug("vgId:%d try to fetch ver %" PRId64 ", first ver:%" PRId64 ", commit ver:%" PRId64 ", last ver:%" PRId64
+ ", applied ver:%" PRId64,
+ pRead->pWal->cfg.vgId, ver, pRead->pWal->vers.firstVer, pRead->pWal->vers.commitVer, pRead->pWal->vers.lastVer,
+ pRead->pWal->vers.appliedVer);
// TODO: valid ver
- if (ver > pRead->pWal->vers.commitVer) {
+ if (ver > pRead->pWal->vers.appliedVer) {
return -1;
}
if (pRead->curInvalid || pRead->curVersion != ver) {
code = walReadSeekVer(pRead, ver);
- if (code < 0) return -1;
+ if (code < 0) {
+ pRead->curVersion = ver;
+ pRead->curInvalid = 1;
+ return -1;
+ }
+ seeked = true;
}
- ASSERT(taosValidFile(pRead->pLogFile) == true);
-
- code = taosReadFile(pRead->pLogFile, pHead, sizeof(SWalCkHead));
- if (code != sizeof(SWalCkHead)) {
- return -1;
+ while (1) {
+ contLen = taosReadFile(pRead->pLogFile, pHead, sizeof(SWalCkHead));
+ if (contLen == sizeof(SWalCkHead)) {
+ break;
+ } else if (contLen == 0 && !seeked) {
+ walReadSeekVerImpl(pRead, ver);
+ seeked = true;
+ continue;
+ } else {
+ if (contLen < 0) {
+ terrno = TAOS_SYSTEM_ERROR(errno);
+ } else {
+ terrno = TSDB_CODE_WAL_FILE_CORRUPTED;
+ }
+ ASSERT(0);
+ pRead->curInvalid = 1;
+ return -1;
+ }
}
code = walValidHeadCksum(pHead);
@@ -373,13 +398,20 @@ int32_t walFetchHead(SWalReader *pRead, int64_t ver, SWalCkHead *pHead) {
return -1;
}
+ pRead->curInvalid = 0;
return 0;
}
int32_t walSkipFetchBody(SWalReader *pRead, const SWalCkHead *pHead) {
int64_t code;
- // ASSERT(pRead->curVersion == pHead->head.version);
+ wDebug("vgId:%d skip fetch body %" PRId64 ", first ver:%" PRId64 ", commit ver:%" PRId64 ", last ver:%" PRId64
+ ", applied ver:%" PRId64,
+ pRead->pWal->cfg.vgId, pHead->head.version, pRead->pWal->vers.firstVer, pRead->pWal->vers.commitVer,
+ pRead->pWal->vers.lastVer, pRead->pWal->vers.appliedVer);
+
+ ASSERT(pRead->curVersion == pHead->head.version);
+ ASSERT(pRead->curInvalid == 0);
code = taosLSeekFile(pRead->pLogFile, pHead->head.bodyLen, SEEK_CUR);
if (code < 0) {
@@ -397,6 +429,11 @@ int32_t walFetchBody(SWalReader *pRead, SWalCkHead **ppHead) {
SWalCont *pReadHead = &((*ppHead)->head);
int64_t ver = pReadHead->version;
+ wDebug("vgId:%d fetch body %" PRId64 ", first ver:%" PRId64 ", commit ver:%" PRId64 ", last ver:%" PRId64
+ ", applied ver:%" PRId64,
+ pRead->pWal->cfg.vgId, ver, pRead->pWal->vers.firstVer, pRead->pWal->vers.commitVer, pRead->pWal->vers.lastVer,
+ pRead->pWal->vers.appliedVer);
+
if (pRead->capacity < pReadHead->bodyLen) {
SWalCkHead *ptr = (SWalCkHead *)taosMemoryRealloc(*ppHead, sizeof(SWalCkHead) + pReadHead->bodyLen);
if (ptr == NULL) {
@@ -409,19 +446,32 @@ 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));
+ } else {
+ wError("vgId:%d, wal fetch body error:%" PRId64 ", read request index:%" PRId64 ", since file corrupted",
+ pRead->pWal->cfg.vgId, pReadHead->version, ver);
+ 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,
- pRead->pHead->head.version, ver);
+ pReadHead->version, ver);
pRead->curInvalid = 1;
terrno = TSDB_CODE_WAL_FILE_CORRUPTED;
return -1;
}
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;
diff --git a/source/libs/wal/src/walWrite.c b/source/libs/wal/src/walWrite.c
index 527ffa0056..c723618a4b 100644
--- a/source/libs/wal/src/walWrite.c
+++ b/source/libs/wal/src/walWrite.c
@@ -16,6 +16,7 @@
#include "os.h"
#include "taoserror.h"
#include "tchecksum.h"
+#include "tglobal.h"
#include "walInt.h"
int32_t walRestoreFromSnapshot(SWal *pWal, int64_t ver) {
@@ -101,7 +102,7 @@ int32_t walRollback(SWal *pWal, int64_t ver) {
taosThreadMutexLock(&pWal->mutex);
int64_t code;
char fnameStr[WAL_FILE_LEN];
- if (ver > pWal->vers.lastVer || ver < pWal->vers.commitVer) {
+ if (ver > pWal->vers.lastVer || ver < pWal->vers.commitVer || ver <= pWal->vers.snapshotVer) {
terrno = TSDB_CODE_WAL_INVALID_VER;
taosThreadMutexUnlock(&pWal->mutex);
return -1;
@@ -252,23 +253,36 @@ static FORCE_INLINE int32_t walCheckAndRoll(SWal *pWal) {
}
}
+ if (walGetLastFileCachedSize(pWal) > tsWalFsyncDataSizeLimit) {
+ if (walSaveMeta(pWal) < 0) {
+ return -1;
+ }
+ }
+
return 0;
}
int32_t walBeginSnapshot(SWal *pWal, int64_t ver) {
+ taosThreadMutexLock(&pWal->mutex);
+
pWal->vers.verInSnapshotting = ver;
wDebug("vgId:%d, wal begin snapshot for version %" PRId64 ", first ver %" PRId64 ", last ver %" PRId64,
pWal->cfg.vgId, ver, pWal->vers.firstVer, pWal->vers.lastVer);
// check file rolling
if (pWal->cfg.retentionPeriod == 0) {
- taosThreadMutexLock(&pWal->mutex);
if (walGetLastFileSize(pWal) != 0) {
- walRollImpl(pWal);
+ if (walRollImpl(pWal) < 0) {
+ wError("vgId:%d, failed to roll wal files since %s", pWal->cfg.vgId, terrstr());
+ goto _err;
+ }
}
- taosThreadMutexUnlock(&pWal->mutex);
}
-
+ taosThreadMutexUnlock(&pWal->mutex);
return 0;
+
+_err:
+ taosThreadMutexUnlock(&pWal->mutex);
+ return -1;
}
int32_t walEndSnapshot(SWal *pWal) {
diff --git a/source/libs/wal/test/walMetaTest.cpp b/source/libs/wal/test/walMetaTest.cpp
index d98826a384..891e7dcdae 100644
--- a/source/libs/wal/test/walMetaTest.cpp
+++ b/source/libs/wal/test/walMetaTest.cpp
@@ -274,17 +274,17 @@ TEST_F(WalCleanEnv, rollbackMultiFile) {
code = walRollback(pWal, 9);
ASSERT_EQ(code, 0);
ASSERT_EQ(pWal->vers.lastVer, 8);
+ code = walRollback(pWal, 6);
+ ASSERT_EQ(code, 0);
+ ASSERT_EQ(pWal->vers.lastVer, 5);
code = walRollback(pWal, 5);
- ASSERT_EQ(code, 0);
- ASSERT_EQ(pWal->vers.lastVer, 4);
- code = walRollback(pWal, 3);
- ASSERT_EQ(code, 0);
+ ASSERT_EQ(code, -1);
- ASSERT_EQ(pWal->vers.lastVer, 2);
+ ASSERT_EQ(pWal->vers.lastVer, 5);
- code = walWrite(pWal, 3, 3, (void*)ranStr, ranStrLen);
+ code = walWrite(pWal, 6, 6, (void*)ranStr, ranStrLen);
ASSERT_EQ(code, 0);
- ASSERT_EQ(pWal->vers.lastVer, 3);
+ ASSERT_EQ(pWal->vers.lastVer, 6);
code = walSaveMeta(pWal);
ASSERT_EQ(code, 0);
diff --git a/source/os/src/osMemory.c b/source/os/src/osMemory.c
index 75a963d5c7..78fa362179 100644
--- a/source/os/src/osMemory.c
+++ b/source/os/src/osMemory.c
@@ -336,3 +336,12 @@ int64_t taosMemorySize(void *ptr) {
#endif
#endif
}
+
+void taosMemoryTrim(int32_t size) {
+#if defined(WINDOWS) || defined(DARWIN)
+ // do nothing
+ return;
+#else
+ malloc_trim(size);
+#endif
+}
diff --git a/source/os/src/osSysinfo.c b/source/os/src/osSysinfo.c
index 0a6dad4819..e5ca9faacb 100644
--- a/source/os/src/osSysinfo.c
+++ b/source/os/src/osSysinfo.c
@@ -227,9 +227,7 @@ void taosGetSystemInfo() {
#ifdef WINDOWS
taosGetCpuCores(&tsNumOfCores);
taosGetTotalMemory(&tsTotalMemoryKB);
-
- double tmp1, tmp2, tmp3, tmp4;
- taosGetCpuUsage(&tmp1, &tmp2);
+ taosGetCpuUsage(NULL, NULL);
#elif defined(_TD_DARWIN_64)
long physical_pages = sysconf(_SC_PHYS_PAGES);
long page_size = sysconf(_SC_PAGESIZE);
@@ -240,9 +238,7 @@ void taosGetSystemInfo() {
taosGetProcIOnfos();
taosGetCpuCores(&tsNumOfCores);
taosGetTotalMemory(&tsTotalMemoryKB);
-
- double tmp1, tmp2, tmp3, tmp4;
- taosGetCpuUsage(&tmp1, &tmp2);
+ taosGetCpuUsage(NULL, NULL);
#endif
}
@@ -447,8 +443,8 @@ void taosGetCpuUsage(double *cpu_system, double *cpu_engine) {
static int64_t curSysTotal = 0;
static int64_t curProcTotal = 0;
- *cpu_system = 0;
- *cpu_engine = 0;
+ if (cpu_system != NULL) *cpu_system = 0;
+ if (cpu_engine != NULL) *cpu_engine = 0;
SysCpuInfo sysCpu = {0};
ProcCpuInfo procCpu = {0};
@@ -458,8 +454,12 @@ void taosGetCpuUsage(double *cpu_system, double *cpu_engine) {
curProcTotal = procCpu.utime + procCpu.stime + procCpu.cutime + procCpu.cstime;
if (curSysTotal > lastSysTotal && curSysUsed >= lastSysUsed && curProcTotal >= lastProcTotal) {
- *cpu_engine = (curSysUsed - lastSysUsed) / (double)(curSysTotal - lastSysTotal) * 100;
- *cpu_system = (curProcTotal - lastProcTotal) / (double)(curSysTotal - lastSysTotal) * 100;
+ if (cpu_system != NULL) {
+ *cpu_system = (curSysUsed - lastSysUsed) / (double)(curSysTotal - lastSysTotal) * 100;
+ }
+ if (cpu_engine != NULL) {
+ *cpu_engine = (curProcTotal - lastProcTotal) / (double)(curSysTotal - lastSysTotal) * 100;
+ }
}
lastSysUsed = curSysUsed;
diff --git a/source/util/src/tconfig.c b/source/util/src/tconfig.c
index 0bf9e7cc33..712ff8feba 100644
--- a/source/util/src/tconfig.c
+++ b/source/util/src/tconfig.c
@@ -915,7 +915,7 @@ int32_t cfgLoadFromApollUrl(SConfig *pConfig, const char *url) {
int32_t olen, vlen, vlen2, vlen3;
int32_t code = 0;
if (url == NULL || strlen(url) == 0) {
- uInfo("fail to load apoll url");
+ uInfo("apoll url not load");
return 0;
}
diff --git a/source/util/src/terror.c b/source/util/src/terror.c
index 37f9734eab..f7e56f372f 100644
--- a/source/util/src/terror.c
+++ b/source/util/src/terror.c
@@ -94,6 +94,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_INVALID_TIMESTAMP, "Invalid timestamp for
TAOS_DEFINE_ERROR(TSDB_CODE_MSG_DECODE_ERROR, "Msg decode 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")
//client
TAOS_DEFINE_ERROR(TSDB_CODE_TSC_INVALID_OPERATION, "Invalid operation")
@@ -109,7 +110,6 @@ TAOS_DEFINE_ERROR(TSDB_CODE_TSC_INVALID_DB_LENGTH, "Database name too lon
TAOS_DEFINE_ERROR(TSDB_CODE_TSC_INVALID_TABLE_ID_LENGTH, "Table name too long")
TAOS_DEFINE_ERROR(TSDB_CODE_TSC_INVALID_CONNECTION, "Invalid connection")
TAOS_DEFINE_ERROR(TSDB_CODE_TSC_OUT_OF_MEMORY, "System out of memory")
-TAOS_DEFINE_ERROR(TSDB_CODE_TSC_NO_DISKSPACE, "System out of disk space")
TAOS_DEFINE_ERROR(TSDB_CODE_TSC_QUERY_CACHE_ERASED, "Query cache erased")
TAOS_DEFINE_ERROR(TSDB_CODE_TSC_QUERY_CANCELLED, "Query terminated")
TAOS_DEFINE_ERROR(TSDB_CODE_TSC_SORTED_RES_TOO_MANY, "Result set too large to be sorted") // too many result for ordered super table projection query
@@ -305,35 +305,14 @@ TAOS_DEFINE_ERROR(TSDB_CODE_NODE_ALREADY_DEPLOYED, "Node already deployed
TAOS_DEFINE_ERROR(TSDB_CODE_NODE_NOT_DEPLOYED, "Node not deployed")
// vnode
-TAOS_DEFINE_ERROR(TSDB_CODE_VND_ACTION_IN_PROGRESS, "Action in progress")
-TAOS_DEFINE_ERROR(TSDB_CODE_VND_MSG_NOT_PROCESSED, "Message not processed")
-TAOS_DEFINE_ERROR(TSDB_CODE_VND_ACTION_NEED_REPROCESSED, "Action need to be reprocessed")
TAOS_DEFINE_ERROR(TSDB_CODE_VND_INVALID_VGROUP_ID, "Invalid Vgroup ID")
-TAOS_DEFINE_ERROR(TSDB_CODE_VND_INIT_FAILED, "Vnode initialization failed")
-TAOS_DEFINE_ERROR(TSDB_CODE_VND_NO_DISKSPACE, "System out of disk space")
-TAOS_DEFINE_ERROR(TSDB_CODE_VND_NO_DISK_PERMISSIONS, "No write permission for disk files")
-TAOS_DEFINE_ERROR(TSDB_CODE_VND_NO_SUCH_FILE_OR_DIR, "Missing data file")
-TAOS_DEFINE_ERROR(TSDB_CODE_VND_OUT_OF_MEMORY, "Out of memory")
-TAOS_DEFINE_ERROR(TSDB_CODE_VND_APP_ERROR, "Unexpected generic error in vnode")
-
-TAOS_DEFINE_ERROR(TSDB_CODE_VND_IS_FLOWCTRL, "Database memory is full")
-TAOS_DEFINE_ERROR(TSDB_CODE_VND_IS_DROPPING, "Database is dropping")
-TAOS_DEFINE_ERROR(TSDB_CODE_VND_IS_UPDATING, "Database is updating")
-TAOS_DEFINE_ERROR(TSDB_CODE_VND_IS_CLOSING, "Database is closing")
-TAOS_DEFINE_ERROR(TSDB_CODE_VND_NOT_SYNCED, "Database suspended")
TAOS_DEFINE_ERROR(TSDB_CODE_VND_NO_WRITE_AUTH, "Database write operation denied")
-TAOS_DEFINE_ERROR(TSDB_CODE_VND_IS_SYNCING, "Database is syncing")
-TAOS_DEFINE_ERROR(TSDB_CODE_VND_INVALID_TSDB_STATE, "Invalid tsdb state")
-TAOS_DEFINE_ERROR(TSDB_CODE_VND_TB_NOT_EXIST, "Table not exists")
-TAOS_DEFINE_ERROR(TSDB_CODE_VND_SMA_NOT_EXIST, "SMA not exists")
TAOS_DEFINE_ERROR(TSDB_CODE_VND_HASH_MISMATCH, "Hash value mismatch")
-TAOS_DEFINE_ERROR(TSDB_CODE_VND_TABLE_NOT_EXIST, "Table does not exists")
TAOS_DEFINE_ERROR(TSDB_CODE_VND_INVALID_TABLE_ACTION, "Invalid table action")
TAOS_DEFINE_ERROR(TSDB_CODE_VND_COL_ALREADY_EXISTS, "Table column already exists")
-TAOS_DEFINE_ERROR(TSDB_CODE_VND_TABLE_COL_NOT_EXISTS, "Table column not exists")
+TAOS_DEFINE_ERROR(TSDB_CODE_VND_COL_NOT_EXISTS, "Table column not exists")
TAOS_DEFINE_ERROR(TSDB_CODE_VND_COL_SUBSCRIBED, "Table column is subscribed")
-TAOS_DEFINE_ERROR(TSDB_CODE_VND_INVALID_CFG_FILE, "Invalid config file")
-TAOS_DEFINE_ERROR(TSDB_CODE_VND_INVALID_TERM_FILE, "Invalid term file")
+TAOS_DEFINE_ERROR(TSDB_CODE_VND_NO_AVAIL_BUFPOOL, "No availabe buffer pool")
// tsdb
TAOS_DEFINE_ERROR(TSDB_CODE_TDB_INVALID_TABLE_ID, "Invalid table ID")
@@ -342,7 +321,6 @@ TAOS_DEFINE_ERROR(TSDB_CODE_TDB_IVD_TB_SCHEMA_VERSION, "Invalid table schema
TAOS_DEFINE_ERROR(TSDB_CODE_TDB_TABLE_ALREADY_EXIST, "Table already exists")
TAOS_DEFINE_ERROR(TSDB_CODE_TDB_INVALID_CONFIG, "Invalid configuration")
TAOS_DEFINE_ERROR(TSDB_CODE_TDB_INIT_FAILED, "Tsdb init failed")
-TAOS_DEFINE_ERROR(TSDB_CODE_TDB_NO_DISKSPACE, "No diskspace for tsdb")
TAOS_DEFINE_ERROR(TSDB_CODE_TDB_NO_DISK_PERMISSIONS, "No permission for disk files")
TAOS_DEFINE_ERROR(TSDB_CODE_TDB_FILE_CORRUPTED, "Data file(s) corrupted")
TAOS_DEFINE_ERROR(TSDB_CODE_TDB_OUT_OF_MEMORY, "Out of memory")
@@ -362,13 +340,12 @@ TAOS_DEFINE_ERROR(TSDB_CODE_TDB_NO_CACHE_LAST_ROW, "TSDB no cache last ro
TAOS_DEFINE_ERROR(TSDB_CODE_TDB_TABLE_NOT_EXIST, "Table not exists")
TAOS_DEFINE_ERROR(TSDB_CODE_TDB_STB_ALREADY_EXIST, "Stable already exists")
TAOS_DEFINE_ERROR(TSDB_CODE_TDB_STB_NOT_EXIST, "Stable not exists")
-TAOS_DEFINE_ERROR(TSDB_CODE_TDB_TABLE_RECREATED, "Table re-created")
+TAOS_DEFINE_ERROR(TSDB_CODE_TDB_INVALID_TABLE_SCHEMA_VER, "Table schema is old")
TAOS_DEFINE_ERROR(TSDB_CODE_TDB_TDB_ENV_OPEN_ERROR, "TDB env open error")
// query
TAOS_DEFINE_ERROR(TSDB_CODE_QRY_INVALID_QHANDLE, "Invalid handle")
TAOS_DEFINE_ERROR(TSDB_CODE_QRY_INVALID_MSG, "Invalid message") // failed to validate the sql expression msg by vnode
-TAOS_DEFINE_ERROR(TSDB_CODE_QRY_NO_DISKSPACE, "No diskspace for query")
TAOS_DEFINE_ERROR(TSDB_CODE_QRY_OUT_OF_MEMORY, "System out of memory")
TAOS_DEFINE_ERROR(TSDB_CODE_QRY_APP_ERROR, "Unexpected generic error in query")
TAOS_DEFINE_ERROR(TSDB_CODE_QRY_DUP_JOIN_KEY, "Duplicated join key")
@@ -431,7 +408,6 @@ TAOS_DEFINE_ERROR(TSDB_CODE_SYN_INTERNAL_ERROR, "Sync internal error")
//tq
TAOS_DEFINE_ERROR(TSDB_CODE_TQ_INVALID_CONFIG, "TQ invalid config")
TAOS_DEFINE_ERROR(TSDB_CODE_TQ_INIT_FAILED, "TQ init falied")
-TAOS_DEFINE_ERROR(TSDB_CODE_TQ_NO_DISKSPACE, "TQ no disk space")
TAOS_DEFINE_ERROR(TSDB_CODE_TQ_NO_DISK_PERMISSIONS, "TQ no disk permissions")
TAOS_DEFINE_ERROR(TSDB_CODE_TQ_FILE_CORRUPTED, "TQ file corrupted")
TAOS_DEFINE_ERROR(TSDB_CODE_TQ_OUT_OF_MEMORY, "TQ out of memory")
@@ -452,6 +428,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_WAL_INVALID_VER, "WAL use invalid versi
TAOS_DEFINE_ERROR(TSDB_CODE_WAL_OUT_OF_MEMORY, "WAL out of memory")
TAOS_DEFINE_ERROR(TSDB_CODE_WAL_LOG_NOT_EXIST, "WAL log not exist")
TAOS_DEFINE_ERROR(TSDB_CODE_WAL_CHKSUM_MISMATCH, "WAL checksum mismatch")
+TAOS_DEFINE_ERROR(TSDB_CODE_WAL_LOG_INCOMPLETE, "WAL log incomplete")
// tfs
TAOS_DEFINE_ERROR(TSDB_CODE_FS_INVLD_CFG, "tfs invalid mount config")
@@ -632,6 +609,9 @@ TAOS_DEFINE_ERROR(TSDB_CODE_TMQ_INVALID_MSG, "Invalid message")
TAOS_DEFINE_ERROR(TSDB_CODE_TMQ_CONSUMER_MISMATCH, "Consumer mismatch")
TAOS_DEFINE_ERROR(TSDB_CODE_TMQ_CONSUMER_CLOSED, "Consumer closed")
+// stream
+TAOS_DEFINE_ERROR(TSDB_CODE_STREAM_TASK_NOT_EXIST, "Stream task not exist")
+
// TDLite
TAOS_DEFINE_ERROR(TSDB_CODE_TDLITE_IVLD_OPEN_FLAGS, "Invalid TDLite open flags")
TAOS_DEFINE_ERROR(TSDB_CODE_TDLITE_IVLD_OPEN_DIR, "Invalid TDLite open directory")
diff --git a/source/util/src/tref.c b/source/util/src/tref.c
index c984ef3f34..aa741b909a 100644
--- a/source/util/src/tref.c
+++ b/source/util/src/tref.c
@@ -57,7 +57,7 @@ static void taosIncRsetCount(SRefSet *pSet);
static void taosDecRsetCount(SRefSet *pSet);
static int32_t taosDecRefCount(int32_t rsetId, int64_t rid, int32_t remove);
-int32_t taosOpenRef(int32_t max, void (*fp)(void *)) {
+int32_t taosOpenRef(int32_t max, RefFp fp) {
SRefNode **nodeList;
SRefSet *pSet;
int64_t *lockedBy;
diff --git a/tests/script/jenkins/basic.txt b/tests/script/jenkins/basic.txt
index cf3d26eb17..3b00c6bf24 100644
--- a/tests/script/jenkins/basic.txt
+++ b/tests/script/jenkins/basic.txt
@@ -48,6 +48,7 @@
./test.sh -f tsim/dnode/drop_dnode_has_vnode_replica3.sim
./test.sh -f tsim/dnode/drop_dnode_has_multi_vnode_replica1.sim
./test.sh -f tsim/dnode/drop_dnode_has_multi_vnode_replica3.sim
+./test.sh -f tsim/dnode/drop_dnode_force.sim
./test.sh -f tsim/dnode/offline_reason.sim
./test.sh -f tsim/dnode/redistribute_vgroup_replica1.sim
./test.sh -f tsim/dnode/redistribute_vgroup_replica3_v1_leader.sim
@@ -233,6 +234,9 @@
./test.sh -f tsim/stream/basic1.sim
./test.sh -f tsim/stream/basic2.sim
./test.sh -f tsim/stream/drop_stream.sim
+./test.sh -f tsim/stream/fillHistoryBasic1.sim
+./test.sh -f tsim/stream/fillHistoryBasic2.sim
+./test.sh -f tsim/stream/fillHistoryBasic3.sim
./test.sh -f tsim/stream/distributeInterval0.sim
./test.sh -f tsim/stream/distributeIntervalRetrive0.sim
./test.sh -f tsim/stream/distributeSession0.sim
@@ -447,6 +451,7 @@
./test.sh -f tsim/tag/smallint.sim
./test.sh -f tsim/tag/tinyint.sim
./test.sh -f tsim/tag/drop_tag.sim
+./test.sh -f tsim/tag/tbNameIn.sim
./test.sh -f tmp/monitor.sim
#======================b1-end===============
diff --git a/tests/script/tmp/data.sim b/tests/script/tmp/data.sim
index c59a43263b..cdabc97c09 100644
--- a/tests/script/tmp/data.sim
+++ b/tests/script/tmp/data.sim
@@ -45,74 +45,9 @@ if $data(4)[4] != ready then
goto step1
endi
-return
-
+return
print =============== step2: create database
-sql create database db vgroups 1 replica 3
-sql select * from information_schema.ins_databases
-if $rows != 3 then
- return -1
-endi
-if $data(db)[4] != 3 then
- return -1
-endi
-
-sql select * from information_schema.ins_dnodes
-if $data(2)[2] != 1 then
- return -1
-endi
-if $data(3)[2] != 1 then
- return -1
-endi
-if $data(4)[2] != 1 then
- return -1
-endi
-
-# vnodes
-sql select * from information_schema.ins_dnodes
-if $data(2)[2] != 1 then
- return -1
-endi
-if $data(3)[2] != 1 then
- return -1
-endi
-if $data(4)[2] != 1 then
- return -1
-endi
-
-# v1_dnode
-$hasleader = 0
-$x = 0
-step2:
- $x = $x + 1
- sleep 1000
- if $x == 20 then
- print ====> dnode not ready!
- return -1
- endi
-sql show db.vgroups
-print ===> $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08
-if $data(2)[3] != 2 then
- return -1
-endi
-if $data(2)[5] != 3 then
- return -1
-endi
-if $data(2)[7] != 4 then
- return -1
-endi
-if $data(2)[4] == leader then
- $hasleader = 1
-endi
-if $data(2)[6] == leader then
- $hasleader = 1
-endi
-if $data(2)[8] == leader then
- $hasleader = 1
-endi
-if $hasleader != 1 then
- goto step2
-endi
+sql create database db vgroups 33 replica 3
sql use db;
sql create table stb (ts timestamp, c int) tags (t int);
@@ -122,6 +57,8 @@ sql select * from information_schema.ins_stables where db_name = 'db';
sql select * from information_schema.ins_tables where db_name = 'db';
sql show db.vgroups;
+system sh/exec.sh -n dnode2 -s stop
+
return
print ======== start back
run_back tmp/back.sim
diff --git a/tests/script/tsim/dnode/drop_dnode_force.sim b/tests/script/tsim/dnode/drop_dnode_force.sim
new file mode 100644
index 0000000000..10edacf3aa
--- /dev/null
+++ b/tests/script/tsim/dnode/drop_dnode_force.sim
@@ -0,0 +1,301 @@
+system sh/stop_dnodes.sh
+system sh/deploy.sh -n dnode1 -i 1
+system sh/deploy.sh -n dnode2 -i 2
+system sh/deploy.sh -n dnode3 -i 3
+system sh/deploy.sh -n dnode4 -i 4
+system sh/deploy.sh -n dnode5 -i 5
+system sh/cfg.sh -n dnode1 -c supportVnodes -v 0
+system sh/exec.sh -n dnode1 -s start
+system sh/exec.sh -n dnode2 -s start
+system sh/exec.sh -n dnode3 -s start
+system sh/exec.sh -n dnode4 -s start
+sql connect
+
+print =============== step1 create dnode2 dnode3 dnode4 dnode 5
+sql create dnode $hostname port 7200
+sql create dnode $hostname port 7300
+sql create dnode $hostname port 7400
+sql create dnode $hostname port 7500
+
+$x = 0
+step1:
+ $ = $x + 1
+ sleep 1000
+ if $x == 10 then
+ print ====> dnode not online!
+ return -1
+ endi
+sql select * from information_schema.ins_dnodes
+print ===> $data00 $data01 $data02 $data03 $data04 $data05
+print ===> $data10 $data11 $data12 $data13 $data14 $data15
+if $rows != 5 then
+ return -1
+endi
+if $data(1)[4] != ready then
+ goto step1
+endi
+if $data(2)[4] != ready then
+ goto step1
+endi
+if $data(3)[4] != ready then
+ goto step1
+endi
+if $data(4)[4] != ready then
+ goto step1
+endi
+if $data(5)[4] != offline then
+ goto step1
+endi
+
+print =============== step2 create database
+sql create database d1 vgroups 1 replica 3
+sql use d1
+sql create table d1.st0 (ts timestamp, i int) tags (j int)
+sql create table d1.c0 using st0 tags(0)
+sql create table d1.c1 using st0 tags(1)
+sql create table d1.c2 using st0 tags(2)
+sql create table d1.c3 using st0 tags(3)
+sql create table d1.c4 using st0 tags(4)
+sql create table d1.c5 using st0 tags(5)
+sql create table d1.c6 using st0 tags(6)
+sql create table d1.c7 using st0 tags(7)
+sql create table d1.c8 using st0 tags(8)
+sql create table d1.c9 using st0 tags(9)
+sql show d1.tables
+if $rows != 10 then
+ return -1
+endi
+print d1.rows ===> $rows
+sql select * from information_schema.ins_tables where stable_name = 'st0' and db_name = 'd1'
+if $rows != 10 then
+ return -1
+endi
+
+sql create database d2 vgroups 3 replica 1
+sql use d2
+sql create table d2.st1 (ts timestamp, i int) tags (j int)
+sql create table d2.c10 using st1 tags(0)
+sql create table d2.c11 using st1 tags(1)
+sql create table d2.c12 using st1 tags(2)
+sql create table d2.c13 using st1 tags(3)
+sql create table d2.c14 using st1 tags(4)
+sql create table d2.c15 using st1 tags(5)
+sql create table d2.c16 using st1 tags(6)
+sql create table d2.c17 using st1 tags(7)
+sql create table d2.c18 using st1 tags(8)
+sql create table d2.c19 using st1 tags(9)
+sql create table d2.c190 using st1 tags(9)
+sql show d2.tables
+if $rows != 11 then
+ return -1
+endi
+sql reset query cache
+sql select * from information_schema.ins_tables where stable_name = 'st1' and db_name = 'd2'
+print d2.st1.tables ===> $rows
+if $rows != 11 then
+ return -1
+endi
+
+sql create table d2.st2 (ts timestamp, i int) tags (j int)
+sql create table d2.c20 using st2 tags(0)
+sql create table d2.c21 using st2 tags(1)
+sql create table d2.c22 using st2 tags(2)
+sql create table d2.c23 using st2 tags(3)
+sql create table d2.c24 using st2 tags(4)
+sql create table d2.c25 using st2 tags(5)
+sql create table d2.c26 using st2 tags(6)
+sql create table d2.c27 using st2 tags(7)
+sql create table d2.c28 using st2 tags(8)
+sql create table d2.c29 using st2 tags(9)
+sql create table d2.c290 using st2 tags(9)
+sql create table d2.c291 using st2 tags(9)
+sql show d2.tables
+if $rows != 23 then
+ return -1
+endi
+sql reset query cache
+sql select * from information_schema.ins_tables where stable_name = 'st2' and db_name = 'd2'
+print d2.st2.tables ===> $rows
+if $rows != 12 then
+ return -1
+endi
+
+print =============== step3: create qnode snode on dnode 2
+sql create qnode on dnode 2
+sql create snode on dnode 2
+sql select * from information_schema.ins_qnodes
+if $rows != 1 then
+ return -1
+endi
+sql show snodes
+if $rows != 1 then
+ return -1
+endi
+
+print =============== step4: create mnode on dnode 2
+sql create mnode on dnode 3
+sql create mnode on dnode 2
+$x = 0
+step4:
+ $x = $x + 1
+ sleep 1000
+ if $x == 10 then
+ return -1
+ endi
+sql select * from information_schema.ins_mnodes -x step4
+print $data[0][0] $data[0][1] $data[0][2] $data[0][3] $data[0][4]
+print $data[1][0] $data[1][1] $data[1][2] $data[1][3] $data[1][4]
+print $data[2][0] $data[2][1] $data[2][2] $data[2][3] $data[1][4]
+#if $data(1)[2] != leader then
+# goto step4
+#endi
+if $data(2)[2] != follower then
+ goto step4
+endi
+#if $data(3)[2] != follower then
+# goto step4
+#endi
+
+print =============== step5: create dnode 5
+system sh/exec.sh -n dnode2 -s stop -x SIGINT
+system sh/exec.sh -n dnode5 -s start
+$x = 0
+step5:
+ $ = $x + 1
+ sleep 1000
+ if $x == 10 then
+ print ====> dnode not online!
+ return -1
+ endi
+sql select * from information_schema.ins_dnodes
+print ===> $data00 $data01 $data02 $data03 $data04 $data05
+print ===> $data10 $data11 $data12 $data13 $data14 $data15
+print ===> $data20 $data21 $data22 $data23 $data24 $data25
+print ===> $data30 $data31 $data32 $data33 $data34 $data35
+print ===> $data40 $data41 $data42 $data43 $data44 $data45
+if $rows != 5 then
+ return -1
+endi
+if $data(1)[4] != ready then
+ goto step5
+endi
+if $data(2)[4] != offline then
+ goto step5
+endi
+if $data(3)[4] != ready then
+ goto step5
+endi
+if $data(4)[4] != ready then
+ goto step5
+endi
+if $data(5)[4] != ready then
+ goto step5
+endi
+
+print =============== step5: drop dnode 2
+sql_error drop dnode 2
+sql drop dnode 2 force
+
+print select * from information_schema.ins_dnodes;
+sql select * from information_schema.ins_dnodes;
+print $data[0][0] $data[0][1] $data[0][2] $data[0][3] $data[0][4]
+print $data[1][0] $data[1][1] $data[1][2] $data[1][3] $data[1][4]
+if $rows != 4 then
+ return -1
+endi
+
+print select * from information_schema.ins_mnodes;
+sql select * from information_schema.ins_mnodes
+print $data[0][0] $data[0][1] $data[0][2] $data[0][3] $data[0][4]
+print $data[1][0] $data[1][1] $data[1][2] $data[1][3] $data[1][4]
+if $rows != 2 then
+ return -1
+endi
+if $data(1)[2] != leader then
+ return -1
+endi
+
+sql select * from information_schema.ins_qnodes
+if $rows != 0 then
+ return -1
+endi
+sql show snodes
+if $rows != 0 then
+ return -1
+endi
+
+print =============== step6: check d1
+sql reset query cache
+sql show d1.tables
+if $rows != 10 then
+ return -1
+endi
+
+print =============== step7: check d2
+sql show d2.tables
+print ===> d2.tables: $rows remained
+if $rows > 23 then
+ return -1
+endi
+if $rows <= 0 then
+ return -1
+endi
+
+print =============== step8: drop stable and recreate it
+sql select * from information_schema.ins_tables where stable_name = 'st2' and db_name = 'd2'
+print d2.st2.tables ==> $rows
+
+sql drop table d2.st2;
+sql create table d2.st2 (ts timestamp, i int) tags (j int)
+sql create table d2.c20 using st2 tags(0)
+sql create table d2.c21 using st2 tags(1)
+sql create table d2.c22 using st2 tags(2)
+sql create table d2.c23 using st2 tags(3)
+sql create table d2.c24 using st2 tags(4)
+sql create table d2.c25 using st2 tags(5)
+sql create table d2.c26 using st2 tags(6)
+sql create table d2.c27 using st2 tags(7)
+sql create table d2.c28 using st2 tags(8)
+sql create table d2.c29 using st2 tags(9)
+sql create table d2.c30 using st2 tags(9)
+sql create table d2.c31 using st2 tags(9)
+sql create table d2.c32 using st2 tags(9)
+
+sql select * from information_schema.ins_tables where stable_name = 'st2' and db_name = 'd2'
+print d2.st2.tables ==> $rows
+if $rows != 13 then
+ return -1
+endi
+
+print =============== step9: alter stable
+return
+print By modifying the stable, the missing stable information can be reconstructed in the vnode.
+print However, currently, getting the stable meta from the vnode, and return the table not exist
+print To handle this, we need to modify the way stable-meta is fetched
+
+sql select * from information_schema.ins_tables where stable_name = 'st1' and db_name = 'd2'
+print d2.st1.tables ==> $rows
+$remains = $rows
+
+sql alter table d2.st1 add column b smallint
+return
+sql create table d2.c30 using st tags(0)
+sql create table d2.c31 using st tags(1)
+sql create table d2.c32 using st tags(2)
+sql create table d2.c33 using st tags(3)
+sql create table d2.c34 using st tags(4)
+sql create table d2.c35 using st tags(5)
+sql create table d2.c36 using st tags(6)
+sql create table d2.c37 using st tags(7)
+sql create table d2.c38 using st tags(8)
+sql create table d2.c39 using st tags(9)
+sql show d2.tables
+print d2.st1.tables ==> $rows
+
+$total = $remains + 10
+if $rows != $total then
+ return -1
+endi
+
+system sh/exec.sh -n dnode1 -s stop -x SIGINT
+system sh/exec.sh -n dnode2 -s stop -x SIGINT
diff --git a/tests/script/tsim/parser/function.sim b/tests/script/tsim/parser/function.sim
index 0002a5d095..ec9cdf2666 100644
--- a/tests/script/tsim/parser/function.sim
+++ b/tests/script/tsim/parser/function.sim
@@ -995,3 +995,86 @@ endi
if $data00 != 0.000000000 then
return -1
endi
+
+sql create table ft1(ts timestamp, a int, b int , c int, d double);
+
+sql insert into ft1 values(1648791213000,1,2,3,1.0);
+sql_error select sum(_wduration), a from ft1 state_window(a);
+
+sql_error select count(_wduration), a from ft1 state_window(a);
+
+sql_error select max(_wduration), a from ft1 state_window(a);
+
+sql_error select sum(1 + _wduration), a from ft1 state_window(a);
+
+sql_error select sum(cast(_wstart as bigint)), a from ft1 state_window(a);
+
+sql_error select sum(cast(_wend as bigint)), a from ft1 state_window(a);
+
+sql_error create stream streams1 trigger at_once into streamt as select _wstart, sum(_wduration) from ft1 interval(10s);
+
+sql_error create stream streams1 trigger at_once into streamt as select _wstart, sum(cast(_wend as bigint)) from ft1 interval(10s);
+
+sql create database test vgroups 1;
+sql use test;
+sql create table t1(ts timestamp, a int, b int , c int, d double);
+sql insert into t1 values(1648791213000,1,1,3,1.0);
+sql insert into t1 values(1648791223000,1,2,NULL,NULL);
+
+sleep 200
+
+sql select apercentile(c, 50), apercentile(d, 50, "t-digest") from t1;
+
+if $data00 != 3.000000000 then
+ print ======data00=$data00
+ return -1
+endi
+
+if $data01 != 1.000000000 then
+ print ======data01=$data01
+ return -1
+endi
+
+sql select apercentile(c, 50) a, apercentile(d, 50, "t-digest") from t1 partition by b session(ts, 5s) order by a desc;
+
+if $data00 != 3.000000000 then
+ print ======data00=$data00
+ return -1
+endi
+
+if $data01 != 1.000000000 then
+ print ======data01=$data01
+ return -1
+endi
+
+if $data10 != NULL then
+ print ======data10=$data10
+ return -1
+endi
+
+if $data11 != NULL then
+ print ======data11=$data11
+ return -1
+endi
+
+sql select apercentile(c, 50) a, apercentile(d, 50, "t-digest") from t1 state_window(b) order by a desc;
+
+if $data00 != 3.000000000 then
+ print ======data00=$data00
+ return -1
+endi
+
+if $data01 != 1.000000000 then
+ print ======data01=$data01
+ return -1
+endi
+
+if $data10 != NULL then
+ print ======data10=$data10
+ return -1
+endi
+
+if $data11 != NULL then
+ print ======data11=$data11
+ return -1
+endi
\ No newline at end of file
diff --git a/tests/script/tsim/stream/fillHistoryBasic1.sim b/tests/script/tsim/stream/fillHistoryBasic1.sim
new file mode 100644
index 0000000000..772a09c017
--- /dev/null
+++ b/tests/script/tsim/stream/fillHistoryBasic1.sim
@@ -0,0 +1,923 @@
+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 =============== create database
+sql create database test vgroups 1;
+sql select * from information_schema.ins_databases
+if $rows != 3 then
+ return -1
+endi
+
+print $data00 $data01 $data02
+
+sql use test;
+
+sql create table t1(ts timestamp, a int, b int , c int, d double);
+
+sql create stream stream1 trigger at_once fill_history 1 into streamt as select _wstart, count(*) c1, count(d) c2 , sum(a) c3 , max(b) c4, min(c) c5 from t1 interval(10s);
+
+sql insert into t1 values(1648791213000,1,2,3,1.0);
+sql insert into t1 values(1648791223001,2,2,3,1.1);
+sql insert into t1 values(1648791233002,3,2,3,2.1);
+sql insert into t1 values(1648791243003,4,2,3,3.1);
+sql insert into t1 values(1648791213004,4,2,3,4.1);
+
+
+sleep 5000
+sql select `_wstart`, c1, c2 ,c3 ,c4, c5 from streamt;
+
+if $rows != 4 then
+ print ======$rows
+ return -1
+endi
+
+# row 0
+if $data01 != 2 then
+ print ======$data01
+ return -1
+endi
+
+if $data02 != 2 then
+ print ======$data02
+ return -1
+endi
+
+if $data03 != 5 then
+ print ======$data03
+ return -1
+endi
+
+if $data04 != 2 then
+ print ======$data04
+ return -1
+endi
+
+if $data05 != 3 then
+ print ======$data05
+ return -1
+endi
+
+# row 1
+if $data11 != 1 then
+ print ======$data11
+ return -1
+endi
+
+if $data12 != 1 then
+ print ======$data12
+ return -1
+endi
+
+if $data13 != 2 then
+ print ======$data13
+ return -1
+endi
+
+if $data14 != 2 then
+ print ======$data14
+ return -1
+endi
+
+if $data15 != 3 then
+ print ======$data15
+ return -1
+endi
+
+# row 2
+if $data21 != 1 then
+ print ======$data21
+ return -1
+endi
+
+if $data22 != 1 then
+ print ======$data22
+ return -1
+endi
+
+if $data23 != 3 then
+ print ======$data23
+ return -1
+endi
+
+if $data24 != 2 then
+ print ======$data24
+ return -1
+endi
+
+if $data25 != 3 then
+ print ======$data25
+ return -1
+endi
+
+# row 3
+if $data31 != 1 then
+ print ======$data31
+ return -1
+endi
+
+if $data32 != 1 then
+ print ======$data32
+ return -1
+endi
+
+if $data33 != 4 then
+ print ======$data33
+ return -1
+endi
+
+if $data34 != 2 then
+ print ======$data34
+ return -1
+endi
+
+if $data35 != 3 then
+ print ======$data35
+ return -1
+endi
+
+sql insert into t1 values(1648791223001,12,14,13,11.1);
+sleep 1000
+sql select * from streamt;
+
+print count(*) , count(d) , sum(a) , max(b) , min(c)
+print 0: $data00 , $data01 , $data02 , $data03 , $data04 , $data05
+print 1: $data10 , $data11 , $data12 , $data13 , $data14 , $data15
+
+if $rows != 4 then
+ print ======$rows
+ return -1
+endi
+
+# row 0
+if $data01 != 2 then
+ print ======$data01
+ return -1
+endi
+
+if $data02 != 2 then
+ print ======$data02
+ return -1
+endi
+
+if $data03 != 5 then
+ print ======$data03
+ return -1
+endi
+
+if $data04 != 2 then
+ print ======$data04
+ return -1
+endi
+
+if $data05 != 3 then
+ print ======$data05
+ return -1
+endi
+
+# row 1
+if $data11 != 1 then
+ print ======$data11
+ return -1
+endi
+
+if $data12 != 1 then
+ print ======$data12
+ return -1
+endi
+
+if $data13 != 12 then
+ print ======$data13
+ return -1
+endi
+
+if $data14 != 14 then
+ print ======$data14
+ return -1
+endi
+
+if $data15 != 13 then
+ print ======$data15
+ return -1
+endi
+
+# row 2
+if $data21 != 1 then
+ print ======$data21
+ return -1
+endi
+
+if $data22 != 1 then
+ print ======$data22
+ return -1
+endi
+
+if $data23 != 3 then
+ print ======$data23
+ return -1
+endi
+
+if $data24 != 2 then
+ print ======$data24
+ return -1
+endi
+
+if $data25 != 3 then
+ print ======$data25
+ return -1
+endi
+
+# row 3
+if $data31 != 1 then
+ print ======$data31
+ return -1
+endi
+
+if $data32 != 1 then
+ print ======$data32
+ return -1
+endi
+
+if $data33 != 4 then
+ print ======$data33
+ return -1
+endi
+
+if $data34 != 2 then
+ print ======$data34
+ return -1
+endi
+
+if $data35 != 3 then
+ print ======$data35
+ return -1
+endi
+
+sql insert into t1 values(1648791223002,12,14,13,11.1);
+sleep 1000
+sql select `_wstart`, c1, c2 ,c3 ,c4, c5 from streamt;
+
+# row 1
+if $data11 != 2 then
+ print ======$data11
+ return -1
+endi
+
+if $data12 != 2 then
+ print ======$data12
+ return -1
+endi
+
+if $data13 != 24 then
+ print ======$data13
+ return -1
+endi
+
+if $data14 != 14 then
+ print ======$data14
+ return -1
+endi
+
+if $data15 != 13 then
+ print ======$data15
+ return -1
+endi
+
+sql insert into t1 values(1648791223003,12,14,13,11.1);
+sleep 1000
+sql select `_wstart`, c1, c2 ,c3 ,c4, c5 from streamt;
+
+# row 1
+if $data11 != 3 then
+ print ======$data11
+ return -1
+endi
+
+if $data12 != 3 then
+ print ======$data12
+ return -1
+endi
+
+if $data13 != 36 then
+ print ======$data13
+ return -1
+endi
+
+if $data14 != 14 then
+ print ======$data14
+ return -1
+endi
+
+if $data15 != 13 then
+ print ======$data15
+ return -1
+endi
+
+sql insert into t1 values(1648791223001,1,1,1,1.1);
+sql insert into t1 values(1648791223002,2,2,2,2.1);
+sql insert into t1 values(1648791223003,3,3,3,3.1);
+sleep 1000
+sql select `_wstart`, c1, c2 ,c3 ,c4, c5 from streamt;
+
+# row 1
+if $data11 != 3 then
+ print ======$data11
+ return -1
+endi
+
+if $data12 != 3 then
+ print ======$data12
+ return -1
+endi
+
+if $data13 != 6 then
+ print ======$data13
+ return -1
+endi
+
+if $data14 != 3 then
+ print ======$data14
+ return -1
+endi
+
+if $data15 != 1 then
+ print ======$data15
+ return -1
+endi
+
+sql insert into t1 values(1648791233003,3,2,3,2.1);
+sql insert into t1 values(1648791233002,5,6,7,8.1);
+sql insert into t1 values(1648791233002,3,2,3,2.1);
+sleep 1000
+sql select `_wstart`, c1, c2 ,c3 ,c4, c5 from streamt;
+
+# row 2
+if $data21 != 2 then
+ print ======$data21
+ return -1
+endi
+
+if $data22 != 2 then
+ print ======$data22
+ return -1
+endi
+
+if $data23 != 6 then
+ print ======$data23
+ return -1
+endi
+
+if $data24 != 2 then
+ print ======$data24
+ return -1
+endi
+
+if $data25 != 3 then
+ print ======$data25
+ return -1
+endi
+
+sql insert into t1 values(1648791213004,4,2,3,4.1) (1648791213006,5,4,7,9.1) (1648791213004,40,20,30,40.1) (1648791213005,4,2,3,4.1);
+sleep 1000
+sql select `_wstart`, c1, c2 ,c3 ,c4, c5 from streamt;
+
+# row 0
+if $data01 != 4 then
+ print ======$data01
+ return -1
+endi
+
+if $data02 != 4 then
+ print ======$data02
+ return -1
+endi
+
+if $data03 != 50 then
+ print ======$data03 != 50
+ return -1
+endi
+
+if $data04 != 20 then
+ print ======$data04 != 20
+ return -1
+endi
+
+if $data05 != 3 then
+ print ======$data05
+ return -1
+endi
+
+sql insert into t1 values(1648791223004,4,2,3,4.1) (1648791233006,5,4,7,9.1) (1648791223004,40,20,30,40.1) (1648791233005,4,2,3,4.1);
+sleep 1000
+sql select `_wstart`, c1, c2 ,c3 ,c4, c5 from streamt;
+
+# row 1
+if $data11 != 4 then
+ print ======$data11
+ return -1
+endi
+
+if $data12 != 4 then
+ print ======$data12
+ return -1
+endi
+
+if $data13 != 46 then
+ print ======$data13 != 46
+ return -1
+endi
+
+if $data14 != 20 then
+ print ======$data14 != 20
+ return -1
+endi
+
+if $data15 != 1 then
+ print ======$data15
+ return -1
+endi
+
+# row 2
+if $data21 != 4 then
+ print ======$data21
+ return -1
+endi
+
+if $data22 != 4 then
+ print ======$data22
+ return -1
+endi
+
+if $data23 != 15 then
+ print ======$data23
+ return -1
+endi
+
+if $data24 != 4 then
+ print ======$data24
+ return -1
+endi
+
+if $data25 != 3 then
+ print ======$data25
+ return -1
+endi
+
+
+sql create database test2 vgroups 1;
+sql select * from information_schema.ins_databases;
+
+sql use test2;
+
+sql create table t1(ts timestamp, a int, b int , c int, d double);
+
+sql insert into t1 values(1648791213000,1,2,3,1.0);
+sql insert into t1 values(1648791223001,2,2,3,1.1);
+sql insert into t1 values(1648791233002,3,2,3,2.1);
+sql insert into t1 values(1648791243003,4,2,3,3.1);
+sql insert into t1 values(1648791213004,4,2,3,4.1);
+
+sql create stream stream2 trigger at_once fill_history 1 into streamt as select _wstart, count(*) c1, count(d) c2 , sum(a) c3 , max(b) c4, min(c) c5 from t1 interval(10s);
+
+sleep 5000
+sql select `_wstart`, c1, c2 ,c3 ,c4, c5 from streamt;
+
+if $rows != 4 then
+ print ======$rows
+ return -1
+endi
+
+# row 0
+if $data01 != 2 then
+ print ======$data01
+ return -1
+endi
+
+if $data02 != 2 then
+ print ======$data02
+ return -1
+endi
+
+if $data03 != 5 then
+ print ======$data03
+ return -1
+endi
+
+if $data04 != 2 then
+ print ======$data04
+ return -1
+endi
+
+if $data05 != 3 then
+ print ======$data05
+ return -1
+endi
+
+# row 1
+if $data11 != 1 then
+ print ======$data11
+ return -1
+endi
+
+if $data12 != 1 then
+ print ======$data12
+ return -1
+endi
+
+if $data13 != 2 then
+ print ======$data13
+ return -1
+endi
+
+if $data14 != 2 then
+ print ======$data14
+ return -1
+endi
+
+if $data15 != 3 then
+ print ======$data15
+ return -1
+endi
+
+# row 2
+if $data21 != 1 then
+ print ======$data21
+ return -1
+endi
+
+if $data22 != 1 then
+ print ======$data22
+ return -1
+endi
+
+if $data23 != 3 then
+ print ======$data23
+ return -1
+endi
+
+if $data24 != 2 then
+ print ======$data24
+ return -1
+endi
+
+if $data25 != 3 then
+ print ======$data25
+ return -1
+endi
+
+# row 3
+if $data31 != 1 then
+ print ======$data31
+ return -1
+endi
+
+if $data32 != 1 then
+ print ======$data32
+ return -1
+endi
+
+if $data33 != 4 then
+ print ======$data33
+ return -1
+endi
+
+if $data34 != 2 then
+ print ======$data34
+ return -1
+endi
+
+if $data35 != 3 then
+ print ======$data35
+ return -1
+endi
+
+sql insert into t1 values(1648791223001,12,14,13,11.1);
+sleep 1000
+sql select * from streamt;
+
+print count(*) , count(d) , sum(a) , max(b) , min(c)
+print 0: $data00 , $data01 , $data02 , $data03 , $data04 , $data05
+print 1: $data10 , $data11 , $data12 , $data13 , $data14 , $data15
+
+if $rows != 4 then
+ print ======$rows
+ return -1
+endi
+
+# row 0
+if $data01 != 2 then
+ print ======$data01
+ return -1
+endi
+
+if $data02 != 2 then
+ print ======$data02
+ return -1
+endi
+
+if $data03 != 5 then
+ print ======$data03
+ return -1
+endi
+
+if $data04 != 2 then
+ print ======$data04
+ return -1
+endi
+
+if $data05 != 3 then
+ print ======$data05
+ return -1
+endi
+
+# row 1
+if $data11 != 1 then
+ print ======$data11
+ return -1
+endi
+
+if $data12 != 1 then
+ print ======$data12
+ return -1
+endi
+
+if $data13 != 12 then
+ print ======$data13
+ return -1
+endi
+
+if $data14 != 14 then
+ print ======$data14
+ return -1
+endi
+
+if $data15 != 13 then
+ print ======$data15
+ return -1
+endi
+
+# row 2
+if $data21 != 1 then
+ print ======$data21
+ return -1
+endi
+
+if $data22 != 1 then
+ print ======$data22
+ return -1
+endi
+
+if $data23 != 3 then
+ print ======$data23
+ return -1
+endi
+
+if $data24 != 2 then
+ print ======$data24
+ return -1
+endi
+
+if $data25 != 3 then
+ print ======$data25
+ return -1
+endi
+
+# row 3
+if $data31 != 1 then
+ print ======$data31
+ return -1
+endi
+
+if $data32 != 1 then
+ print ======$data32
+ return -1
+endi
+
+if $data33 != 4 then
+ print ======$data33
+ return -1
+endi
+
+if $data34 != 2 then
+ print ======$data34
+ return -1
+endi
+
+if $data35 != 3 then
+ print ======$data35
+ return -1
+endi
+
+sql insert into t1 values(1648791223002,12,14,13,11.1);
+sleep 1000
+sql select `_wstart`, c1, c2 ,c3 ,c4, c5 from streamt;
+
+# row 1
+if $data11 != 2 then
+ print ======$data11
+ return -1
+endi
+
+if $data12 != 2 then
+ print ======$data12
+ return -1
+endi
+
+if $data13 != 24 then
+ print ======$data13
+ return -1
+endi
+
+if $data14 != 14 then
+ print ======$data14
+ return -1
+endi
+
+if $data15 != 13 then
+ print ======$data15
+ return -1
+endi
+
+sql insert into t1 values(1648791223003,12,14,13,11.1);
+sleep 1000
+sql select `_wstart`, c1, c2 ,c3 ,c4, c5 from streamt;
+
+# row 1
+if $data11 != 3 then
+ print ======$data11
+ return -1
+endi
+
+if $data12 != 3 then
+ print ======$data12
+ return -1
+endi
+
+if $data13 != 36 then
+ print ======$data13
+ return -1
+endi
+
+if $data14 != 14 then
+ print ======$data14
+ return -1
+endi
+
+if $data15 != 13 then
+ print ======$data15
+ return -1
+endi
+
+sql insert into t1 values(1648791223001,1,1,1,1.1);
+sql insert into t1 values(1648791223002,2,2,2,2.1);
+sql insert into t1 values(1648791223003,3,3,3,3.1);
+sleep 1000
+sql select `_wstart`, c1, c2 ,c3 ,c4, c5 from streamt;
+
+# row 1
+if $data11 != 3 then
+ print ======$data11
+ return -1
+endi
+
+if $data12 != 3 then
+ print ======$data12
+ return -1
+endi
+
+if $data13 != 6 then
+ print ======$data13
+ return -1
+endi
+
+if $data14 != 3 then
+ print ======$data14
+ return -1
+endi
+
+if $data15 != 1 then
+ print ======$data15
+ return -1
+endi
+
+sql insert into t1 values(1648791233003,3,2,3,2.1);
+sql insert into t1 values(1648791233002,5,6,7,8.1);
+sql insert into t1 values(1648791233002,3,2,3,2.1);
+sleep 1000
+sql select `_wstart`, c1, c2 ,c3 ,c4, c5 from streamt;
+
+# row 2
+if $data21 != 2 then
+ print ======$data21
+ return -1
+endi
+
+if $data22 != 2 then
+ print ======$data22
+ return -1
+endi
+
+if $data23 != 6 then
+ print ======$data23
+ return -1
+endi
+
+if $data24 != 2 then
+ print ======$data24
+ return -1
+endi
+
+if $data25 != 3 then
+ print ======$data25
+ return -1
+endi
+
+sql insert into t1 values(1648791213004,4,2,3,4.1) (1648791213006,5,4,7,9.1) (1648791213004,40,20,30,40.1) (1648791213005,4,2,3,4.1);
+sleep 1000
+sql select `_wstart`, c1, c2 ,c3 ,c4, c5 from streamt;
+
+# row 0
+if $data01 != 4 then
+ print ======$data01
+ return -1
+endi
+
+if $data02 != 4 then
+ print ======$data02
+ return -1
+endi
+
+if $data03 != 50 then
+ print ======$data03 != 50
+ return -1
+endi
+
+if $data04 != 20 then
+ print ======$data04 != 20
+ return -1
+endi
+
+if $data05 != 3 then
+ print ======$data05
+ return -1
+endi
+
+sql insert into t1 values(1648791223004,4,2,3,4.1) (1648791233006,5,4,7,9.1) (1648791223004,40,20,30,40.1) (1648791233005,4,2,3,4.1);
+sleep 1000
+sql select `_wstart`, c1, c2 ,c3 ,c4, c5 from streamt;
+
+# row 1
+if $data11 != 4 then
+ print ======$data11
+ return -1
+endi
+
+if $data12 != 4 then
+ print ======$data12
+ return -1
+endi
+
+if $data13 != 46 then
+ print ======$data13 != 46
+ return -1
+endi
+
+if $data14 != 20 then
+ print ======$data14 != 20
+ return -1
+endi
+
+if $data15 != 1 then
+ print ======$data15
+ return -1
+endi
+
+# row 2
+if $data21 != 4 then
+ print ======$data21
+ return -1
+endi
+
+if $data22 != 4 then
+ print ======$data22
+ return -1
+endi
+
+if $data23 != 15 then
+ print ======$data23
+ return -1
+endi
+
+if $data24 != 4 then
+ print ======$data24
+ return -1
+endi
+
+if $data25 != 3 then
+ print ======$data25
+ return -1
+endi
+
+
diff --git a/tests/script/tsim/stream/fillHistoryBasic2.sim b/tests/script/tsim/stream/fillHistoryBasic2.sim
new file mode 100644
index 0000000000..3af198259d
--- /dev/null
+++ b/tests/script/tsim/stream/fillHistoryBasic2.sim
@@ -0,0 +1,277 @@
+system sh/stop_dnodes.sh
+system sh/deploy.sh -n dnode1 -i 1
+system sh/deploy.sh -n dnode2 -i 2
+
+system sh/exec.sh -n dnode1 -s start
+sleep 50
+sql connect
+
+sql create dnode $hostname2 port 7200
+
+system sh/exec.sh -n dnode2 -s start
+
+print ===== step1
+$x = 0
+step1:
+ $x = $x + 1
+ sleep 1000
+ if $x == 10 then
+ print ====> dnode not ready!
+ return -1
+ endi
+sql select * from information_schema.ins_dnodes
+print ===> $data00 $data01 $data02 $data03 $data04 $data05
+print ===> $data10 $data11 $data12 $data13 $data14 $data15
+if $rows != 2 then
+ return -1
+endi
+if $data(1)[4] != ready then
+ goto step1
+endi
+if $data(2)[4] != ready then
+ goto step1
+endi
+
+print ===== step2
+sql drop stream if exists stream_t1;
+sql drop database if exists test;
+sql create database test vgroups 4;
+sql use test;
+sql create stable st(ts timestamp, a int, b int , c int, d double) tags(ta int,tb int,tc int);
+sql create table ts1 using st tags(1,1,1);
+sql create table ts2 using st tags(2,2,2);
+sql create table ts3 using st tags(3,2,2);
+sql create table ts4 using st tags(4,2,2);
+
+sql insert into ts1 values(1648791213001,1,12,3,1.0);
+sql insert into ts2 values(1648791213001,1,12,3,1.0);
+
+sql insert into ts3 values(1648791213001,1,12,3,1.0);
+sql insert into ts4 values(1648791213001,1,12,3,1.0);
+
+sql insert into ts1 values(1648791213002,NULL,NULL,NULL,NULL);
+sql insert into ts2 values(1648791213002,NULL,NULL,NULL,NULL);
+
+sql insert into ts3 values(1648791213002,NULL,NULL,NULL,NULL);
+sql insert into ts4 values(1648791213002,NULL,NULL,NULL,NULL);
+
+sql insert into ts1 values(1648791223002,2,2,3,1.1);
+sql insert into ts1 values(1648791233003,3,2,3,2.1);
+sql insert into ts2 values(1648791243004,4,2,43,73.1);
+sql insert into ts1 values(1648791213002,24,22,23,4.1);
+sql insert into ts1 values(1648791243005,4,20,3,3.1);
+sql insert into ts2 values(1648791243006,4,2,3,3.1) (1648791243007,4,2,3,3.1) ;
+sql insert into ts1 values(1648791243008,4,2,30,3.1) (1648791243009,4,2,3,3.1) (1648791243010,4,2,3,3.1) ;
+sql insert into ts2 values(1648791243011,4,2,3,3.1) (1648791243012,34,32,33,3.1) (1648791243013,4,2,3,3.1) (1648791243014,4,2,13,3.1);
+sql insert into ts1 values(1648791243005,4,42,3,3.1) (1648791243003,4,2,33,3.1) (1648791243006,4,2,3,3.1) (1648791213001,1,52,13,1.0) (1648791223001,22,22,83,1.1) ;
+sql insert into ts2 values(1648791243005,4,42,3,3.1) (1648791243003,4,2,33,3.1) (1648791243006,4,2,3,3.1) (1648791213001,1,52,13,1.0) (1648791223001,22,22,83,1.1) (1648791233004,13,12,13,2.1) ;
+sql insert into ts1 values(1648791243006,4,2,3,3.1) (1648791213001,1,52,13,1.0) (1648791223001,22,22,83,1.1) ;
+
+sql insert into ts3 values(1648791223002,2,2,3,1.1);
+sql insert into ts4 values(1648791233003,3,2,3,2.1);
+sql insert into ts3 values(1648791243004,4,2,43,73.1);
+sql insert into ts4 values(1648791213002,24,22,23,4.1);
+sql insert into ts3 values(1648791243005,4,20,3,3.1);
+sql insert into ts4 values(1648791243006,4,2,3,3.1) (1648791243007,4,2,3,3.1) ;
+sql insert into ts3 values(1648791243008,4,2,30,3.1) (1648791243009,4,2,3,3.1) (1648791243010,4,2,3,3.1) ;
+sql insert into ts4 values(1648791243011,4,2,3,3.1) (1648791243012,34,32,33,3.1) (1648791243013,4,2,3,3.1) (1648791243014,4,2,13,3.1);
+sql insert into ts3 values(1648791243005,4,42,3,3.1) (1648791243003,4,2,33,3.1) (1648791243006,4,2,3,3.1) (1648791213001,1,52,13,1.0) (1648791223001,22,22,83,1.1) ;
+sql insert into ts4 values(1648791243005,4,42,3,3.1) (1648791243003,4,2,33,3.1) (1648791243006,4,2,3,3.1) (1648791213001,1,52,13,1.0) (1648791223001,22,22,83,1.1) (1648791233004,13,12,13,2.1) ;
+sql insert into ts3 values(1648791243006,4,2,3,3.1) (1648791213001,1,52,13,1.0) (1648791223001,22,22,83,1.1) ;
+
+sql create stream stream_t1 trigger at_once fill_history 1 watermark 1d into streamtST1 as select _wstart, count(*) c1, count(d) c2 , sum(a) c3 , max(b) c4, min(c) c5 from st interval(10s);
+
+sleep 1000
+
+$loop_count = 0
+loop1:
+sleep 300
+sql select * from streamtST1;
+
+$loop_count = $loop_count + 1
+if $loop_count == 10 then
+ return -1
+endi
+
+# row 0
+if $data01 != 8 then
+ print =====data01=$data01
+ goto loop1
+endi
+
+if $data02 != 6 then
+ print =====data02=$data02
+ goto loop1
+endi
+
+if $data03 != 52 then
+ print ======data03=$data03
+ goto loop1
+endi
+
+if $data04 != 52 then
+ print ======data04=$data04
+ goto loop1
+endi
+
+if $data05 != 13 then
+ print ======data05=$data05
+ goto loop1
+endi
+
+# row 1
+if $data11 != 6 then
+ print =====data11=$data11
+ goto loop1
+endi
+
+if $data12 != 6 then
+ print =====data12=$data12
+ goto loop1
+endi
+
+if $data13 != 92 then
+ print ======$data13
+ return -1
+endi
+
+if $data14 != 22 then
+ print ======$data14
+ return -1
+endi
+
+if $data15 != 3 then
+ print ======$data15
+ return -1
+endi
+
+# row 2
+if $data21 != 4 then
+ print =====data21=$data21
+ goto loop1
+endi
+
+if $data22 != 4 then
+ print =====data22=$data22
+ goto loop1
+endi
+
+if $data23 != 32 then
+ print ======$data23
+ return -1
+endi
+
+if $data24 != 12 then
+ print ======$data24
+ return -1
+endi
+
+if $data25 != 3 then
+ print ======$data25
+ return -1
+endi
+
+# row 3
+if $data31 != 30 then
+ print =====data31=$data31
+ goto loop1
+endi
+
+if $data32 != 30 then
+ print =====data32=$data32
+ goto loop1
+endi
+
+if $data33 != 180 then
+ print ======$data33
+ return -1
+endi
+
+if $data34 != 42 then
+ print ======$data34
+ return -1
+endi
+
+if $data35 != 3 then
+ print ======$data35
+ return -1
+endi
+
+sql select _wstart, count(*) c1, count(d) c2 , sum(a) c3 , max(b) c4, min(c) c5, avg(d) from st interval(10s);
+
+
+sql create database test1 vgroups 4;
+sql use test1;
+sql create stable st(ts timestamp, a int, b int , c int) tags(ta int,tb int,tc int);
+sql create table ts1 using st tags(1,1,1);
+sql create table ts2 using st tags(2,2,2);
+
+sql insert into ts1 values(1648791211000,1,2,3);
+sql insert into ts1 values(1648791222001,2,2,3);
+sql insert into ts2 values(1648791211000,1,2,3);
+sql insert into ts2 values(1648791222001,2,2,3);
+
+sql create stream stream_t2 trigger at_once fill_history 1 watermark 20s into streamtST1 as select _wstart, count(*) c1, count(a) c2 , sum(a) c3 , max(b) c5, min(c) c6 from st interval(10s) ;
+
+$loop_count = 0
+loop2:
+sql select * from streamtST1;
+
+sleep 300
+$loop_count = $loop_count + 1
+if $loop_count == 10 then
+ return -1
+endi
+
+# row 0
+if $data01 != 2 then
+ print =====data01=$data01
+ goto loop2
+endi
+
+#rows 1
+if $data11 != 2 then
+ print =====data11=$data11
+ goto loop2
+endi
+
+#max,min selectivity
+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 ts1 using st tags(1,1,1);
+sql create table ts2 using st tags(2,2,2);
+sql create stream stream_t3 trigger at_once into streamtST3 as select ts, min(a) c6, a, b, c, ta, tb, tc from st interval(10s) ;
+
+sql insert into ts1 values(1648791211000,1,2,3);
+sleep 50
+sql insert into ts1 values(1648791222001,2,2,3);
+sleep 50
+sql insert into ts2 values(1648791211000,1,2,3);
+sleep 50
+sql insert into ts2 values(1648791222001,2,2,3);
+sleep 50
+
+$loop_count = 0
+loop3:
+sql select * from streamtST3;
+
+sleep 300
+$loop_count = $loop_count + 1
+if $loop_count == 10 then
+ return -1
+endi
+
+# row 0
+if $data02 != 1 then
+ print =====data02=$data02
+ goto loop3
+endi
+
+# row 1
+if $data12 != 2 then
+ print =====data12=$data12
+ goto loop3
+endi
+
+system sh/stop_dnodes.sh
diff --git a/tests/script/tsim/stream/fillHistoryBasic3.sim b/tests/script/tsim/stream/fillHistoryBasic3.sim
new file mode 100644
index 0000000000..db8d6bc2d0
--- /dev/null
+++ b/tests/script/tsim/stream/fillHistoryBasic3.sim
@@ -0,0 +1,203 @@
+$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 50
+sql connect
+
+sql create database test vgroups 1;
+sql create database test2 vgroups 4;
+sql use test2;
+sql create stable st(ts timestamp, a int, b int, c int, d double) tags(ta int,tb int,tc int);
+sql create table t1 using st tags(1,1,1);
+sql create table t2 using st tags(2,2,2);
+
+sql insert into t1 values(1648791213000,NULL,NULL,NULL,NULL);
+sql insert into t2 values(1648791213000,NULL,NULL,NULL,NULL);
+
+sql create stream streams2 trigger at_once fill_history 1 into test.streamt2 as select _wstart c1, count(*) c2, max(a) c3 from st partition by a interval(10s);
+
+sleep 3000
+
+$loop_count = 0
+
+loop7:
+sleep 50
+sql select * from test.streamt2 order by c1, c2, c3;
+
+$loop_count = $loop_count + 1
+if $loop_count == 20 then
+ return -1
+endi
+
+if $data01 != 2 then
+ print =====data01=$data01
+ goto loop7
+endi
+
+if $data02 != NULL then
+ print =====data02=$data02
+ goto loop7
+endi
+
+sql insert into t1 values(1648791213000,1,2,3,1.0);
+sql insert into t2 values(1648791213000,1,2,3,1.0);
+
+$loop_count = 0
+
+loop8:
+sleep 50
+sql select * from test.streamt2 order by c1, c2, c3;
+
+$loop_count = $loop_count + 1
+if $loop_count == 20 then
+ return -1
+endi
+
+if $data01 != 2 then
+ print =====data01=$data01
+ goto loop8
+endi
+
+if $data02 != 1 then
+ print =====data02=$data02
+ goto loop8
+endi
+
+sql insert into t1 values(1648791213000,2,2,3,1.0);
+sql insert into t2 values(1648791213000,2,2,3,1.0);
+
+$loop_count = 0
+
+loop9:
+sleep 50
+sql select * from test.streamt2 order by c1, c2, c3;
+
+$loop_count = $loop_count + 1
+if $loop_count == 20 then
+ return -1
+endi
+
+if $data01 != 2 then
+ print =====data01=$data01
+ goto loop9
+endi
+
+if $data02 != 2 then
+ print =====data02=$data02
+ goto loop9
+endi
+
+sql insert into t1 values(1648791213000,2,2,3,1.0);
+sql insert into t1 values(1648791213001,2,2,3,1.0);
+sql insert into t1 values(1648791213002,2,2,3,1.0);
+sql insert into t1 values(1648791213002,1,2,3,1.0);
+sql insert into t2 values(1648791213000,2,2,3,1.0);
+sql insert into t2 values(1648791213001,2,2,3,1.0);
+sql insert into t2 values(1648791213002,2,2,3,1.0);
+sql insert into t2 values(1648791213002,1,2,3,1.0);
+
+$loop_count = 0
+
+loop10:
+sleep 50
+sql select * from test.streamt2 order by c1, c2, c3;
+
+$loop_count = $loop_count + 1
+if $loop_count == 20 then
+ return -1
+endi
+
+if $data01 != 2 then
+ print =====data01=$data01
+ goto loop10
+endi
+
+if $data02 != 1 then
+ print =====data02=$data02
+ goto loop10
+endi
+
+if $data11 != 4 thenloop4
+ print =====data11=$data11
+ goto loop10
+endi
+
+if $data12 != 2 then
+ print =====data12=$data12
+ goto loop10
+endi
+
+sql insert into t1 values(1648791223000,1,2,3,1.0);
+sql insert into t1 values(1648791223001,1,2,3,1.0);
+sql insert into t1 values(1648791223002,3,2,3,1.0);
+sql insert into t1 values(1648791223003,3,2,3,1.0);
+sql insert into t1 values(1648791213001,1,2,3,1.0) (1648791223001,2,2,3,1.0) (1648791223003,1,2,3,1.0);
+sql insert into t2 values(1648791223000,1,2,3,1.0);
+sql insert into t2 values(1648791223001,1,2,3,1.0);
+sql insert into t2 values(1648791223002,3,2,3,1.0);
+sql insert into t2 values(1648791223003,3,2,3,1.0);
+sql insert into t2 values(1648791213001,1,2,3,1.0) (1648791223001,2,2,3,1.0) (1648791223003,1,2,3,1.0);
+
+$loop_count = 0
+
+loop11:
+sleep 50
+sql select * from test.streamt2 order by c1, c2, c3;
+
+$loop_count = $loop_count + 1
+if $loop_count == 20 then
+ return -1
+endi
+
+if $data01 != 2 then
+ print =====data01=$data01
+ goto loop11
+endi
+
+if $data02 != 2 then
+ print =====data02=$data02
+ goto loop11
+endi
+
+if $data11 != 4 then
+ print =====data11=$data11
+ goto loop11
+endi
+
+if $data12 != 1 then
+ print =====data12=$data12
+ goto loop11
+endi
+
+if $data21 != 2 then
+ print =====data21=$data21
+ goto loop11
+endi
+
+if $data22 != 2 then
+ print =====data22=$data22
+ goto loop11
+endi
+
+if $data31 != 2 then
+ print =====data31=$data31
+ goto loop11
+endi
+
+if $data32 != 3 then
+ print =====data32=$data32
+ goto loop11
+endi
+
+if $data41 != 4 then
+ print =====data41=$data41
+ goto loop11
+endi
+
+if $data42 != 1 then
+ print =====data42=$data42
+ goto loop11
+endi
diff --git a/tests/script/tsim/stream/scalar.sim b/tests/script/tsim/stream/scalar.sim
new file mode 100644
index 0000000000..e211357276
--- /dev/null
+++ b/tests/script/tsim/stream/scalar.sim
@@ -0,0 +1,94 @@
+$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 50
+sql connect
+
+sql drop database if exists test;
+sql create database test vgroups 1;
+sql use test;
+sql create stable st(ts timestamp,a int,b int,c int, d double) tags(ta int,tb int,tc int);
+sql create table t1 using st tags(1,1,1);
+sql create table t2 using st tags(2,2,2);
+sql create stream streams0 into streamt0 as select ts c1, a, abs(b) c4 from t1 partition by a;
+sql create stream streams1 into streamt1 as select ts c1, a, abs(b) c4 from t1;
+sql create stream streams2 into streamt2 as select ts c1, a, abs(b) c4 from st partition by tbname;
+
+sql insert into t1 values(1648791213000,1,1,1,1);
+sql insert into t1 values(1648791213001,1,1,1,1);
+sql insert into t1 values(1648791213002,1,1,1,1);
+
+sql insert into t2 values(1648791213000,1,2,2,2);
+sql insert into t2 values(1648791213001,1,1,1,1);
+sql insert into t2 values(1648791213002,1,1,1,1);
+
+sql insert into t1 values(1648791213001,2,11,11,11);
+
+
+$loop_count = 0
+loop1:
+
+sleep 200
+
+sql select * from streamt0 order by a desc;
+
+$loop_count = $loop_count + 1
+
+if $loop_count == 10 then
+ return -1
+endi
+
+if $rows != 3 then
+ print ======streamt0=rows=$rows
+ goto loop1
+endi
+
+if $data01 != 2 then
+ print ======streamt0=data01=$data01
+ goto loop1
+endi
+
+if $data02 != 11 then
+ print ======streamt0=data02=$data02
+ goto loop1
+endi
+
+
+sql select * from streamt1 order by a desc;
+
+if $rows != 3 then
+ print ======streamt1=rows=$rows
+ goto loop1
+endi
+
+if $data01 != 2 then
+ print ======streamt1=data01=$data01
+ goto loop1
+endi
+
+if $data02 != 11 then
+ print ======streamt1=data02=$data02
+ goto loop1
+endi
+
+sql select * from streamt2 order by a desc;
+
+if $rows != 6 then
+ print ======streamt2=rows=$rows
+ goto loop1
+endi
+
+if $data01 != 2 then
+ print ======streamt2=data01=$data01
+ goto loop1
+endi
+
+if $data02 != 11 then
+ print ======streamt2=data02=$data02
+ goto loop1
+endi
+
+system sh/stop_dnodes.sh
\ No newline at end of file
diff --git a/tests/script/tsim/tag/tbNameIn.sim b/tests/script/tsim/tag/tbNameIn.sim
new file mode 100644
index 0000000000..1af4bd6a9e
--- /dev/null
+++ b/tests/script/tsim/tag/tbNameIn.sim
@@ -0,0 +1,102 @@
+system sh/stop_dnodes.sh
+system sh/deploy.sh -n dnode1 -i 1
+system sh/exec.sh -n dnode1 -s start
+sql connect
+
+print ======== step1
+sql drop database if exists db1;
+sql create database db1 vgroups 3;
+sql use db1;
+sql create stable st1 (ts timestamp, f1 int) tags(tg1 int);
+sql create table tb1 using st1 tags(1);
+sql create table tb2 using st1 tags(2);
+sql create table tb3 using st1 tags(3);
+sql create table tb4 using st1 tags(4);
+sql create table tb5 using st1 tags(5);
+sql create table tb6 using st1 tags(6);
+sql create table tb7 using st1 tags(7);
+sql create table tb8 using st1 tags(8);
+
+sql insert into tb1 values ('2022-07-10 16:31:01', 1);
+sql insert into tb2 values ('2022-07-10 16:31:02', 2);
+sql insert into tb3 values ('2022-07-10 16:31:03', 3);
+sql insert into tb4 values ('2022-07-10 16:31:04', 4);
+sql insert into tb5 values ('2022-07-10 16:31:05', 5);
+sql insert into tb6 values ('2022-07-10 16:31:06', 6);
+sql insert into tb7 values ('2022-07-10 16:31:07', 7);
+sql insert into tb8 values ('2022-07-10 16:31:08', 8);
+
+sql select * from tb1 where tbname in ('tb1');
+if $rows != 1 then
+ return -1
+endi
+if $data01 != 1 then
+ return -1
+endi
+sql select * from tb1 where tbname in ('tb1','tb1');
+if $rows != 1 then
+ return -1
+endi
+if $data01 != 1 then
+ return -1
+endi
+sql select * from tb1 where tbname in ('tb1','tb2','tb1');
+if $rows != 1 then
+ return -1
+endi
+if $data01 != 1 then
+ return -1
+endi
+sql select * from tb1 where tbname in ('tb1','tb2','st1');
+if $rows != 1 then
+ return -1
+endi
+if $data01 != 1 then
+ return -1
+endi
+sql select * from tb1 where tbname = 'tb1';
+if $rows != 1 then
+ return -1
+endi
+if $data01 != 1 then
+ return -1
+endi
+sql select * from tb1 where tbname > 'tb1';
+if $rows != 0 then
+ return -1
+endi
+sql select * from st1 where tbname in ('tb1');
+if $rows != 1 then
+ return -1
+endi
+if $data01 != 1 then
+ return -1
+endi
+sql select * from st1 where tbname in ('tb1','tb1');
+if $rows != 1 then
+ return -1
+endi
+if $data01 != 1 then
+ return -1
+endi
+sql select * from st1 where tbname in ('tb1','tb2','tb1');
+if $rows != 2 then
+ return -1
+endi
+sql select * from st1 where tbname in ('tb1','tb2','st1');
+if $rows != 2 then
+ return -1
+endi
+sql select * from st1 where tbname = 'tb1';
+if $rows != 1 then
+ return -1
+endi
+if $data01 != 1 then
+ return -1
+endi
+sql select * from st1 where tbname > 'tb1';
+if $rows != 7 then
+ return -1
+endi
+
+system sh/exec.sh -n dnode1 -s stop -x SIGINT
diff --git a/tests/script/tsim/vnode/replica3_repeat.sim b/tests/script/tsim/vnode/replica3_repeat.sim
index 4902cde7c5..ccff06819b 100644
--- a/tests/script/tsim/vnode/replica3_repeat.sim
+++ b/tests/script/tsim/vnode/replica3_repeat.sim
@@ -107,7 +107,16 @@ system sh/exec.sh -n dnode2 -s stop
sleep 3000
print ======== step7
-sql select count(*) from db.tb
+$x = 0
+step7:
+ $x = $x + 1
+ sleep 1000
+ if $x == 30 then
+ print ====> dnode not ready!
+ return -1
+ endi
+sql select count(*) from db.tb -x step7
+
print select count(*) from db.tb ==> $data00 $lastRows
if $data00 <= $lastRows then
return -1
diff --git a/tests/system-test/1-insert/delete_data.py b/tests/system-test/1-insert/delete_data.py
index bcaebd6e3e..fe30f69229 100644
--- a/tests/system-test/1-insert/delete_data.py
+++ b/tests/system-test/1-insert/delete_data.py
@@ -26,7 +26,7 @@ class TDTestCase:
def init(self, conn, logSql, replicaVar=1):
self.replicaVar = int(replicaVar)
tdLog.debug("start to execute %s" % __file__)
- tdSql.init(conn.cursor())
+ tdSql.init(conn.cursor(), True)
self.dbname = 'db_test'
self.setsql = TDSetSql()
self.stbname = 'stb'
diff --git a/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopDnodeCreateStb.py b/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopDnodeCreateStb.py
index 3a2492c89d..97e6195037 100644
--- a/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopDnodeCreateStb.py
+++ b/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopDnodeCreateStb.py
@@ -168,7 +168,7 @@ class TDTestCase:
def run(self):
# print(self.master_dnode.cfgDict)
- self.fiveDnodeThreeMnode(dnodeNumbers=6,mnodeNums=3,restartNumbers=2,stopRole='dnode')
+ self.fiveDnodeThreeMnode(dnodeNumbers=5,mnodeNums=3,restartNumbers=2,stopRole='dnode')
def stop(self):
tdSql.close()
diff --git a/tests/system-test/7-tmq/tmqDnodeRestart1.py b/tests/system-test/7-tmq/tmqDnodeRestart1.py
index 054afe4fef..714f10b362 100644
--- a/tests/system-test/7-tmq/tmqDnodeRestart1.py
+++ b/tests/system-test/7-tmq/tmqDnodeRestart1.py
@@ -21,7 +21,7 @@ class TDTestCase:
self.ctbNum = 100
self.rowsPerTbl = 1000
- def init(self, conn, logSql):
+ def init(self, conn, logSql, replicaVar=1):
tdLog.debug(f"start to excute {__file__}")
tdSql.init(conn.cursor(), False)
diff --git a/tests/system-test/7-tmq/tmqError.py b/tests/system-test/7-tmq/tmqError.py
index 7263f8553e..164e7f1c8c 100644
--- a/tests/system-test/7-tmq/tmqError.py
+++ b/tests/system-test/7-tmq/tmqError.py
@@ -245,7 +245,7 @@ class TDTestCase:
tmqCom.insertConsumerInfo(consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifManualCommit)
tdLog.info("start consume processor")
- pollDelay = 9000000 # Forever loop
+ paraDict['pollDelay'] = 9000000 # Forever loop
showMsg = 1
showRow = 1
#self.startTmqSimProcess(buildPath,cfgPath,pollDelay,parameterDict["dbName"],showMsg, showRow)
diff --git a/tests/system-test/7-tmq/tmqShow.py b/tests/system-test/7-tmq/tmqShow.py
index 0c7403c615..406fd9f7f3 100644
--- a/tests/system-test/7-tmq/tmqShow.py
+++ b/tests/system-test/7-tmq/tmqShow.py
@@ -139,8 +139,9 @@ class TDTestCase:
tdSql.query("show subscriptions")
# tdLog.debug(tdSql.queryResult)
rows = tdSql.getRows()
- tdLog.info("show subscriptions rows: %d"%rows)
- if rows != paraDict['vgroups'] * len(topicNameList):
+ expectSubscriptions = paraDict['vgroups'] * len(topicNameList)
+ tdLog.info("show subscriptions rows: %d, expect Subscriptions: %d"%(rows,expectSubscriptions))
+ if rows != expectSubscriptions:
tdLog.exit("show subscriptions rows error")
pThread.join()
diff --git a/tests/system-test/7-tmq/tmqSubscribeStb-r3.py b/tests/system-test/7-tmq/tmqSubscribeStb-r3.py
index b3b3c4240f..5602876893 100644
--- a/tests/system-test/7-tmq/tmqSubscribeStb-r3.py
+++ b/tests/system-test/7-tmq/tmqSubscribeStb-r3.py
@@ -101,7 +101,7 @@ class TDTestCase:
# tmqCom.insert_data_with_autoCreateTbl(tsql=tdSql,dbName=paraDict["dbName"],stbName=paraDict["stbName"],ctbPrefix="ctbx",
# ctbNum=paraDict["ctbNum"],rowsPerTbl=paraDict["rowsPerTbl"],batchNum=paraDict["batchNum"],
# startTs=paraDict["startTs"],ctbStartIdx=paraDict['ctbStartIdx'])
- tmqCom.asyncInsertDataByInterlace(paraDict)
+ pThread = tmqCom.asyncInsertDataByInterlace(paraDict)
tdLog.info("wait some data inserted")
exitFlag = 1
@@ -129,6 +129,7 @@ class TDTestCase:
cluster.dnodes[4].stoptaosd()
cluster.dnodes[4].starttaosd()
+ pThread.join()
# tdLog.info("restart taosd to ensure that the data falls into the disk")
# tdSql.query("flush database %s"%(paraDict['dbName']))
return
@@ -291,6 +292,7 @@ class TDTestCase:
def run(self):
self.prepareTestEnv()
self.tmqCase1()
+ self.prepareTestEnv()
self.tmqCase2()
def stop(self):
diff --git a/tools/shell/CMakeLists.txt b/tools/shell/CMakeLists.txt
index 31dcde036d..1e7d0ed140 100644
--- a/tools/shell/CMakeLists.txt
+++ b/tools/shell/CMakeLists.txt
@@ -2,6 +2,14 @@ aux_source_directory(src SHELL_SRC)
add_executable(shell ${SHELL_SRC})
+IF (TD_LINUX_64 AND JEMALLOC_ENABLED)
+ ADD_DEFINITIONS(-DTD_JEMALLOC_ENABLED -I${CMAKE_BINARY_DIR}/build/include -L${CMAKE_BINARY_DIR}/build/lib -Wl,-rpath,${CMAKE_BINARY_DIR}/build/lib -ljemalloc)
+ SET(LINK_JEMALLOC "-L${CMAKE_BINARY_DIR}/build/lib -ljemalloc")
+ ADD_DEPENDENCIES(shell jemalloc)
+ELSE ()
+ SET(LINK_JEMALLOC "")
+ENDIF ()
+
IF (TD_LINUX AND TD_WEBSOCKET)
ADD_DEFINITIONS(-DWEBSOCKET -I${CMAKE_BINARY_DIR}/build/include -ltaosws)
SET(LINK_WEBSOCKET "-L${CMAKE_BINARY_DIR}/build/lib -ltaosws")
@@ -21,7 +29,7 @@ ENDIF ()
if(TD_WINDOWS)
target_link_libraries(shell PUBLIC taos_static ${LINK_WEBSOCKET})
else()
- target_link_libraries(shell PUBLIC taos ${LINK_WEBSOCKET})
+ target_link_libraries(shell PUBLIC taos ${LINK_WEBSOCKET} ${LINK_JEMALLOC})
endif ()
target_link_libraries(
shell