diff --git a/cmake/taosadapter_CMakeLists.txt.in b/cmake/taosadapter_CMakeLists.txt.in
index b2f335e1f7..ba937b40c1 100644
--- a/cmake/taosadapter_CMakeLists.txt.in
+++ b/cmake/taosadapter_CMakeLists.txt.in
@@ -2,7 +2,7 @@
# taosadapter
ExternalProject_Add(taosadapter
GIT_REPOSITORY https://github.com/taosdata/taosadapter.git
- GIT_TAG cb1e89c
+ GIT_TAG e02ddb2
SOURCE_DIR "${TD_SOURCE_DIR}/tools/taosadapter"
BINARY_DIR ""
#BUILD_IN_SOURCE TRUE
diff --git a/cmake/taostools_CMakeLists.txt.in b/cmake/taostools_CMakeLists.txt.in
index 0110b27b32..d8bf3a09b4 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 149ac34
+ GIT_TAG 0681d8b
SOURCE_DIR "${TD_SOURCE_DIR}/tools/taos-tools"
BINARY_DIR ""
#BUILD_IN_SOURCE TRUE
diff --git a/compile_flags.txt b/compile_flags.txt
new file mode 100644
index 0000000000..c61f9701ab
--- /dev/null
+++ b/compile_flags.txt
@@ -0,0 +1,9 @@
+-DLINUX
+-DWEBSOCKET
+-I/usr/include
+-Iinclude
+-Iinclude/os
+-Iinclude/common
+-Iinclude/util
+-Iinclude/libs/transport
+-Itools/shell/inc
diff --git a/docs/zh/05-get-started/03-package.md b/docs/zh/05-get-started/03-package.md
index af5f1acae6..bdf6a730d0 100644
--- a/docs/zh/05-get-started/03-package.md
+++ b/docs/zh/05-get-started/03-package.md
@@ -178,7 +178,7 @@ Active: inactive (dead)
:::
-## TDengine 命令行(CLI)
+**TDengine 命令行(CLI)**
为便于检查 TDengine 的状态,执行数据库(Database)的各种即席(Ad Hoc)查询,TDengine 提供一命令行应用程序(以下简称为 TDengine CLI)taos。要进入 TDengine 命令行,您只要在终端执行 `taos` 即可。
@@ -188,7 +188,7 @@ Active: inactive (dead)
安装后,可以在拥有管理员权限的 cmd 窗口执行 `sc start taosd` 或在 `C:\TDengine` 目录下,运行 `taosd.exe` 来启动 TDengine 服务进程。
-## TDengine 命令行(CLI)
+**TDengine 命令行(CLI)**
为便于检查 TDengine 的状态,执行数据库(Database)的各种即席(Ad Hoc)查询,TDengine 提供一命令行应用程序(以下简称为 TDengine CLI)taos。要进入 TDengine 命令行,您只要在终端执行 `taos` 即可。
@@ -215,7 +215,7 @@ Active: inactive (dead)
:::
-## TDengine 命令行(CLI)
+**TDengine 命令行(CLI)**
为便于检查 TDengine 的状态,执行数据库(Database)的各种即席(Ad Hoc)查询,TDengine 提供一命令行应用程序(以下简称为 TDengine CLI)taos。要进入 TDengine 命令行,您只要在 Windows 终端的 C:\TDengine 目录下,运行 taos.exe 来启动 TDengine 命令行。
diff --git a/docs/zh/07-develop/09-udf.md b/docs/zh/07-develop/09-udf.md
index 2eb4b3dee3..8a8ef82009 100644
--- a/docs/zh/07-develop/09-udf.md
+++ b/docs/zh/07-develop/09-udf.md
@@ -231,7 +231,7 @@ bit_add 实现多列的按位与功能。如果只有一列,返回这一列。
-### 聚合函数示例 [l2norm](https://github.com/taosdata/TDengine/blob/develop/tests/script/sh/l2norm.c)
+### 聚合函数示例1 返回值为数值类型 [l2norm](https://github.com/taosdata/TDengine/blob/develop/tests/script/sh/l2norm.c)
l2norm 实现了输入列的所有数据的二阶范数,即对每个数据先平方,再累加求和,最后开方。
@@ -243,3 +243,29 @@ l2norm 实现了输入列的所有数据的二阶范数,即对每个数据先
```
+
+### 聚合函数示例2 返回值为字符串类型 [max_vol](https://github.com/taosdata/TDengine/blob/develop/tests/script/sh/max_vol.c)
+
+max_vol 实现了从多个输入的电压列中找到最大电压,返回由设备ID + 最大电压所在(行,列)+ 最大电压值 组成的组合字符串值
+
+创建表:
+```bash
+create table battery(ts timestamp, vol1 float, vol2 float, vol3 float, deviceId varchar(16));
+```
+创建自定义函数:
+```bash
+create aggregate function max_vol as '/root/udf/libmaxvol.so' outputtype binary(64) bufsize 10240 language 'C';
+```
+使用自定义函数:
+```bash
+select max_vol(vol1,vol2,vol3,deviceid) from battery;
+```
+
+
+max_vol.c
+
+```c
+{{#include tests/script/sh/max_vol.c}}
+```
+
+
\ No newline at end of file
diff --git a/include/common/tcommon.h b/include/common/tcommon.h
index 51a714c792..a97c68be49 100644
--- a/include/common/tcommon.h
+++ b/include/common/tcommon.h
@@ -208,15 +208,12 @@ typedef struct SSDataBlock {
} SSDataBlock;
enum {
- FETCH_TYPE__DATA = 1,
- FETCH_TYPE__META,
- FETCH_TYPE__SEP,
+ FETCH_TYPE__DATA = 0,
FETCH_TYPE__NONE,
};
typedef struct {
int8_t fetchType;
- STqOffsetVal offset;
union {
SSDataBlock data;
void* meta;
diff --git a/include/common/tglobal.h b/include/common/tglobal.h
index c52c822793..809488088d 100644
--- a/include/common/tglobal.h
+++ b/include/common/tglobal.h
@@ -104,6 +104,7 @@ extern int32_t tsCacheLazyLoadThreshold; // cost threshold for last/last_row lo
// query client
extern int32_t tsQueryPolicy;
extern int32_t tsQueryRspPolicy;
+extern int64_t tsQueryMaxConcurrentTables;
extern int32_t tsQuerySmaOptimize;
extern int32_t tsQueryRsmaTolerance;
extern bool tsQueryPlannerTrace;
diff --git a/include/common/tmsg.h b/include/common/tmsg.h
index eefb8fc99e..bb2450e8f7 100644
--- a/include/common/tmsg.h
+++ b/include/common/tmsg.h
@@ -177,6 +177,12 @@ typedef enum _mgmt_table {
#define TSDB_ALTER_USER_SYSINFO 0xA
#define TSDB_ALTER_USER_ADD_SUBSCRIBE_TOPIC 0xB
#define TSDB_ALTER_USER_REMOVE_SUBSCRIBE_TOPIC 0xC
+#define TSDB_ALTER_USER_ADD_READ_TABLE 0xD
+#define TSDB_ALTER_USER_REMOVE_READ_TABLE 0xE
+#define TSDB_ALTER_USER_ADD_WRITE_TABLE 0xF
+#define TSDB_ALTER_USER_REMOVE_WRITE_TABLE 0x10
+#define TSDB_ALTER_USER_ADD_ALL_TABLE 0x11
+#define TSDB_ALTER_USER_REMOVE_ALL_TABLE 0x12
#define TSDB_ALTER_USER_PRIVILEGES 0x2
@@ -669,13 +675,16 @@ int32_t tSerializeSCreateUserReq(void* buf, int32_t bufLen, SCreateUserReq* pReq
int32_t tDeserializeSCreateUserReq(void* buf, int32_t bufLen, SCreateUserReq* pReq);
typedef struct {
- int8_t alterType;
- int8_t superUser;
- int8_t sysInfo;
- int8_t enable;
- char user[TSDB_USER_LEN];
- char pass[TSDB_USET_PASSWORD_LEN];
- char objname[TSDB_DB_FNAME_LEN]; // db or topic
+ int8_t alterType;
+ int8_t superUser;
+ int8_t sysInfo;
+ int8_t enable;
+ char user[TSDB_USER_LEN];
+ char pass[TSDB_USET_PASSWORD_LEN];
+ char objname[TSDB_DB_FNAME_LEN]; // db or topic
+ char tabName[TSDB_TABLE_NAME_LEN];
+ char* tagCond;
+ int32_t tagCondLen;
} SAlterUserReq;
int32_t tSerializeSAlterUserReq(void* buf, int32_t bufLen, SAlterUserReq* pReq);
@@ -698,6 +707,9 @@ typedef struct {
SHashObj* createdDbs;
SHashObj* readDbs;
SHashObj* writeDbs;
+ SHashObj* readTbs;
+ SHashObj* writeTbs;
+ SHashObj* useDbs;
} SGetUserAuthRsp;
int32_t tSerializeSGetUserAuthRsp(void* buf, int32_t bufLen, SGetUserAuthRsp* pRsp);
diff --git a/include/common/ttokendef.h b/include/common/ttokendef.h
index fc66363603..641cbbb588 100644
--- a/include/common/ttokendef.h
+++ b/include/common/ttokendef.h
@@ -63,55 +63,55 @@
#define TK_READ 45
#define TK_WRITE 46
#define TK_NK_DOT 47
-#define TK_DNODE 48
-#define TK_PORT 49
-#define TK_DNODES 50
-#define TK_NK_IPTOKEN 51
-#define TK_FORCE 52
-#define TK_LOCAL 53
-#define TK_QNODE 54
-#define TK_BNODE 55
-#define TK_SNODE 56
-#define TK_MNODE 57
-#define TK_DATABASE 58
-#define TK_USE 59
-#define TK_FLUSH 60
-#define TK_TRIM 61
-#define TK_COMPACT 62
-#define TK_IF 63
-#define TK_NOT 64
-#define TK_EXISTS 65
-#define TK_BUFFER 66
-#define TK_CACHEMODEL 67
-#define TK_CACHESIZE 68
-#define TK_COMP 69
-#define TK_DURATION 70
-#define TK_NK_VARIABLE 71
-#define TK_MAXROWS 72
-#define TK_MINROWS 73
-#define TK_KEEP 74
-#define TK_PAGES 75
-#define TK_PAGESIZE 76
-#define TK_TSDB_PAGESIZE 77
-#define TK_PRECISION 78
-#define TK_REPLICA 79
-#define TK_VGROUPS 80
-#define TK_SINGLE_STABLE 81
-#define TK_RETENTIONS 82
-#define TK_SCHEMALESS 83
-#define TK_WAL_LEVEL 84
-#define TK_WAL_FSYNC_PERIOD 85
-#define TK_WAL_RETENTION_PERIOD 86
-#define TK_WAL_RETENTION_SIZE 87
-#define TK_WAL_ROLL_PERIOD 88
-#define TK_WAL_SEGMENT_SIZE 89
-#define TK_STT_TRIGGER 90
-#define TK_TABLE_PREFIX 91
-#define TK_TABLE_SUFFIX 92
-#define TK_NK_COLON 93
-#define TK_MAX_SPEED 94
-#define TK_START 95
-#define TK_WITH 96
+#define TK_WITH 48
+#define TK_DNODE 49
+#define TK_PORT 50
+#define TK_DNODES 51
+#define TK_NK_IPTOKEN 52
+#define TK_FORCE 53
+#define TK_LOCAL 54
+#define TK_QNODE 55
+#define TK_BNODE 56
+#define TK_SNODE 57
+#define TK_MNODE 58
+#define TK_DATABASE 59
+#define TK_USE 60
+#define TK_FLUSH 61
+#define TK_TRIM 62
+#define TK_COMPACT 63
+#define TK_IF 64
+#define TK_NOT 65
+#define TK_EXISTS 66
+#define TK_BUFFER 67
+#define TK_CACHEMODEL 68
+#define TK_CACHESIZE 69
+#define TK_COMP 70
+#define TK_DURATION 71
+#define TK_NK_VARIABLE 72
+#define TK_MAXROWS 73
+#define TK_MINROWS 74
+#define TK_KEEP 75
+#define TK_PAGES 76
+#define TK_PAGESIZE 77
+#define TK_TSDB_PAGESIZE 78
+#define TK_PRECISION 79
+#define TK_REPLICA 80
+#define TK_VGROUPS 81
+#define TK_SINGLE_STABLE 82
+#define TK_RETENTIONS 83
+#define TK_SCHEMALESS 84
+#define TK_WAL_LEVEL 85
+#define TK_WAL_FSYNC_PERIOD 86
+#define TK_WAL_RETENTION_PERIOD 87
+#define TK_WAL_RETENTION_SIZE 88
+#define TK_WAL_ROLL_PERIOD 89
+#define TK_WAL_SEGMENT_SIZE 90
+#define TK_STT_TRIGGER 91
+#define TK_TABLE_PREFIX 92
+#define TK_TABLE_SUFFIX 93
+#define TK_NK_COLON 94
+#define TK_MAX_SPEED 95
+#define TK_START 96
#define TK_TIMESTAMP 97
#define TK_END 98
#define TK_TABLE 99
@@ -127,24 +127,24 @@
#define TK_NK_EQ 109
#define TK_USING 110
#define TK_TAGS 111
-#define TK_COMMENT 112
-#define TK_BOOL 113
-#define TK_TINYINT 114
-#define TK_SMALLINT 115
-#define TK_INT 116
-#define TK_INTEGER 117
-#define TK_BIGINT 118
-#define TK_FLOAT 119
-#define TK_DOUBLE 120
-#define TK_BINARY 121
-#define TK_NCHAR 122
-#define TK_UNSIGNED 123
-#define TK_JSON 124
-#define TK_VARCHAR 125
-#define TK_MEDIUMBLOB 126
-#define TK_BLOB 127
-#define TK_VARBINARY 128
-#define TK_DECIMAL 129
+#define TK_BOOL 112
+#define TK_TINYINT 113
+#define TK_SMALLINT 114
+#define TK_INT 115
+#define TK_INTEGER 116
+#define TK_BIGINT 117
+#define TK_FLOAT 118
+#define TK_DOUBLE 119
+#define TK_BINARY 120
+#define TK_NCHAR 121
+#define TK_UNSIGNED 122
+#define TK_JSON 123
+#define TK_VARCHAR 124
+#define TK_MEDIUMBLOB 125
+#define TK_BLOB 126
+#define TK_VARBINARY 127
+#define TK_DECIMAL 128
+#define TK_COMMENT 129
#define TK_MAX_DELAY 130
#define TK_WATERMARK 131
#define TK_ROLLUP 132
diff --git a/include/libs/catalog/catalog.h b/include/libs/catalog/catalog.h
index fbb24d2862..2c684f8f76 100644
--- a/include/libs/catalog/catalog.h
+++ b/include/libs/catalog/catalog.h
@@ -29,6 +29,7 @@ extern "C" {
#include "tmsg.h"
#include "tname.h"
#include "transport.h"
+#include "nodes.h"
typedef struct SCatalog SCatalog;
@@ -49,10 +50,15 @@ typedef enum {
typedef struct SUserAuthInfo {
char user[TSDB_USER_LEN];
- char dbFName[TSDB_DB_FNAME_LEN];
+ SName tbName;
AUTH_TYPE type;
} SUserAuthInfo;
+typedef struct SUserAuthRes {
+ bool pass;
+ SNode* pCond;
+} SUserAuthRes;
+
typedef struct SDbInfo {
int32_t vgVer;
int32_t tbNum;
@@ -96,7 +102,7 @@ typedef struct SMetaData {
SArray* pTableIndex; // pRes = SArray*
SArray* pUdfList; // pRes = SFuncInfo*
SArray* pIndex; // pRes = SIndexInfo*
- SArray* pUser; // pRes = bool*
+ SArray* pUser; // pRes = SUserAuthRes*
SArray* pQnodeList; // pRes = SArray*
SArray* pTableCfg; // pRes = STableCfg*
SArray* pDnodeList; // pRes = SArray*
@@ -312,11 +318,9 @@ int32_t catalogUpdateTableIndex(SCatalog* pCtg, STableIndexRsp* pRsp);
int32_t catalogGetUdfInfo(SCatalog* pCtg, SRequestConnInfo* pConn, const char* funcName, SFuncInfo* pInfo);
-int32_t catalogChkAuth(SCatalog* pCtg, SRequestConnInfo* pConn, const char* user, const char* dbFName, AUTH_TYPE type,
- bool* pass);
+int32_t catalogChkAuth(SCatalog* pCtg, SRequestConnInfo* pConn, SUserAuthInfo *pAuth, SUserAuthRes* pRes);
-int32_t catalogChkAuthFromCache(SCatalog* pCtg, const char* user, const char* dbFName, AUTH_TYPE type, bool* pass,
- bool* exists);
+int32_t catalogChkAuthFromCache(SCatalog* pCtg, SUserAuthInfo *pAuth, SUserAuthRes* pRes, bool* exists);
int32_t catalogUpdateUserAuthInfo(SCatalog* pCtg, SGetUserAuthRsp* pAuth);
diff --git a/include/libs/executor/executor.h b/include/libs/executor/executor.h
index 0b98751652..6f2a6126b3 100644
--- a/include/libs/executor/executor.h
+++ b/include/libs/executor/executor.h
@@ -26,6 +26,7 @@ extern "C" {
typedef void* qTaskInfo_t;
typedef void* DataSinkHandle;
+
struct SRpcMsg;
struct SSubplan;
@@ -91,7 +92,9 @@ void qSetTaskId(qTaskInfo_t tinfo, uint64_t taskId, uint64_t queryId);
int32_t qSetStreamOpOpen(qTaskInfo_t tinfo);
+// todo refactor
void qGetCheckpointVersion(qTaskInfo_t tinfo, int64_t* dataVer, int64_t* ckId);
+
/**
* Set multiple input data blocks for the stream scan.
* @param tinfo
@@ -120,7 +123,7 @@ int32_t qSetSMAInput(qTaskInfo_t tinfo, const void* pBlocks, size_t numOfBlocks,
* @param isAdd
* @return
*/
-int32_t qUpdateQualifiedTableId(qTaskInfo_t tinfo, const SArray* tableIdList, bool isAdd);
+int32_t qUpdateTableListForStreamScanner(qTaskInfo_t tinfo, const SArray* tableIdList, bool isAdd, SArray* pList);
/**
* Create the exec task object according to task json
@@ -164,6 +167,7 @@ void qCleanExecTaskBlockBuf(qTaskInfo_t tinfo);
* @return
*/
int32_t qAsyncKillTask(qTaskInfo_t tinfo, int32_t rspCode);
+
int32_t qKillTask(qTaskInfo_t tinfo, int32_t rspCode);
bool qTaskIsExecuting(qTaskInfo_t qinfo);
@@ -183,29 +187,19 @@ int32_t qSerializeTaskStatus(qTaskInfo_t tinfo, char** pOutput, int32_t* len);
int32_t qDeserializeTaskStatus(qTaskInfo_t tinfo, const char* pInput, int32_t len);
STimeWindow getAlignQueryTimeWindow(SInterval* pInterval, int32_t precision, int64_t key);
-/**
- * return the scan info, in the form of tuple of two items, including table uid and current timestamp
- * @param tinfo
- * @param uid
- * @param ts
- * @return
- */
-int32_t qGetStreamScanStatus(qTaskInfo_t tinfo, uint64_t* uid, int64_t* ts);
-int32_t qStreamPrepareTsdbScan(qTaskInfo_t tinfo, uint64_t uid, int64_t ts);
+SArray* qGetQueriedTableListInfo(qTaskInfo_t tinfo);
int32_t qStreamPrepareScan(qTaskInfo_t tinfo, STqOffsetVal* pOffset, int8_t subType);
-// int32_t qStreamScanMemData(qTaskInfo_t tinfo, const SSubmitReq* pReq, int64_t ver);
-//
int32_t qStreamSetScanMemData(qTaskInfo_t tinfo, SPackedData submit);
-int32_t qStreamExtractOffset(qTaskInfo_t tinfo, STqOffsetVal* pOffset);
+void qStreamSetOpen(qTaskInfo_t tinfo);
+
+void qStreamExtractOffset(qTaskInfo_t tinfo, STqOffsetVal* pOffset);
SMqMetaRsp* qStreamExtractMetaMsg(qTaskInfo_t tinfo);
-int64_t qStreamExtractPrepareUid(qTaskInfo_t tinfo);
-
const SSchemaWrapper* qExtractSchemaFromTask(qTaskInfo_t tinfo);
const char* qExtractTbnameFromTask(qTaskInfo_t tinfo);
diff --git a/include/libs/nodes/cmdnodes.h b/include/libs/nodes/cmdnodes.h
index 3ae3900a5c..2323d044ec 100644
--- a/include/libs/nodes/cmdnodes.h
+++ b/include/libs/nodes/cmdnodes.h
@@ -458,7 +458,9 @@ typedef struct SGrantStmt {
ENodeType type;
char userName[TSDB_USER_LEN];
char objName[TSDB_DB_NAME_LEN]; // db or topic
+ char tabName[TSDB_TABLE_NAME_LEN];
int64_t privileges;
+ SNode* pTagCond;
} SGrantStmt;
typedef SGrantStmt SRevokeStmt;
diff --git a/include/libs/nodes/querynodes.h b/include/libs/nodes/querynodes.h
index 1a9700907e..480912a8cf 100644
--- a/include/libs/nodes/querynodes.h
+++ b/include/libs/nodes/querynodes.h
@@ -298,6 +298,7 @@ typedef struct SSelectStmt {
bool hasUniqueFunc;
bool hasTailFunc;
bool hasInterpFunc;
+ bool hasInterpPseudoColFunc;
bool hasLastRowFunc;
bool hasLastFunc;
bool hasTimeLineFunc;
diff --git a/include/libs/qcom/query.h b/include/libs/qcom/query.h
index b6ada5a0c7..cfc6ef2025 100644
--- a/include/libs/qcom/query.h
+++ b/include/libs/qcom/query.h
@@ -194,6 +194,7 @@ typedef struct SRequestConnInfo {
typedef void (*__freeFunc)(void* param);
+// todo add creator/destroyer function
typedef struct SMsgSendInfo {
__async_send_cb_fn_t fp; // async callback function
STargetInfo target; // for update epset
diff --git a/include/libs/stream/streamState.h b/include/libs/stream/streamState.h
index ae84299c1c..b61faf957f 100644
--- a/include/libs/stream/streamState.h
+++ b/include/libs/stream/streamState.h
@@ -88,6 +88,8 @@ int32_t streamStateGetByPos(SStreamState* pState, void* pos, void** pVal);
int32_t streamStateDel(SStreamState* pState, const SWinKey* key);
int32_t streamStateClear(SStreamState* pState);
void streamStateSetNumber(SStreamState* pState, int32_t number);
+int32_t streamStateSaveInfo(SStreamState* pState, void* pKey, int32_t keyLen, void* pVal, int32_t vLen);
+int32_t streamStateGetInfo(SStreamState* pState, void* pKey, int32_t keyLen, void** pVal, int32_t* pLen);
int32_t streamStateSessionAddIfNotExist(SStreamState* pState, SSessionKey* key, TSKEY gap, void** pVal, int32_t* pVLen);
int32_t streamStateSessionPut(SStreamState* pState, const SSessionKey* key, const void* value, int32_t vLen);
diff --git a/include/libs/stream/tstream.h b/include/libs/stream/tstream.h
index 66682799d3..70b2eb0c3b 100644
--- a/include/libs/stream/tstream.h
+++ b/include/libs/stream/tstream.h
@@ -13,8 +13,8 @@
* along with this program. If not, see .
*/
-#include "executor.h"
#include "os.h"
+#include "executor.h"
#include "query.h"
#include "streamState.h"
#include "tdatablock.h"
@@ -31,6 +31,7 @@ extern "C" {
#ifndef _STREAM_H_
#define _STREAM_H_
+typedef void (*_free_reader_fn_t)(void*);
typedef struct SStreamTask SStreamTask;
enum {
@@ -50,6 +51,7 @@ enum {
TASK_STATUS__RECOVER_PREPARE,
TASK_STATUS__RECOVER1,
TASK_STATUS__RECOVER2,
+ TASK_STATUS__RESTORE, // only available for source task to replay WAL from the checkpoint
};
enum {
@@ -103,21 +105,8 @@ typedef struct {
int8_t type;
} SStreamQueueItem;
-#if 0
-typedef struct {
- int8_t type;
- int64_t ver;
- int32_t* dataRef;
- SSubmitReq* data;
-} SStreamDataSubmit;
-
-typedef struct {
- int8_t type;
- int64_t ver;
- SArray* dataRefs; // SArray
- SArray* reqs; // SArray
-} SStreamMergedSubmit;
-#endif
+typedef void FTbSink(SStreamTask* pTask, void* vnode, int64_t ver, void* data);
+typedef int32_t FTaskExpand(void* ahandle, SStreamTask* pTask, int64_t ver);
typedef struct {
int8_t type;
@@ -219,36 +208,21 @@ static FORCE_INLINE void streamQueueProcessFail(SStreamQueue* queue) {
}
static FORCE_INLINE void* streamQueueCurItem(SStreamQueue* queue) {
- //
return queue->qItem;
}
-static FORCE_INLINE void* streamQueueNextItem(SStreamQueue* queue) {
- int8_t dequeueFlag = atomic_exchange_8(&queue->status, STREAM_QUEUE__PROCESSING);
- if (dequeueFlag == STREAM_QUEUE__FAILED) {
- ASSERT(queue->qItem != NULL);
- return streamQueueCurItem(queue);
- } else {
- queue->qItem = NULL;
- taosGetQitem(queue->qall, &queue->qItem);
- if (queue->qItem == NULL) {
- taosReadAllQitems(queue->queue, queue->qall);
- taosGetQitem(queue->qall, &queue->qItem);
- }
- return streamQueueCurItem(queue);
- }
-}
+void* streamQueueNextItem(SStreamQueue* queue);
-SStreamDataSubmit2* streamDataSubmitNew(SPackedData submit);
+SStreamDataSubmit2* streamDataSubmitNew(SPackedData submit, int32_t type);
+void streamDataSubmitDestroy(SStreamDataSubmit2* pDataSubmit);
-void streamDataSubmitRefDec(SStreamDataSubmit2* pDataSubmit);
-
-SStreamDataSubmit2* streamSubmitRefClone(SStreamDataSubmit2* pSubmit);
+SStreamDataSubmit2* streamSubmitBlockClone(SStreamDataSubmit2* pSubmit);
typedef struct {
- char* qmsg;
- // followings are not applicable to encoder and decoder
- void* executor;
+ char* qmsg;
+ void* pExecutor; // not applicable to encoder and decoder
+ struct STqReader* pTqReader; // not applicable to encoder and decoder
+ struct SWalReader* pWalReader; // not applicable to encoder and decoder
} STaskExec;
typedef struct {
@@ -263,16 +237,13 @@ typedef struct {
SUseDbRsp dbInfo;
} STaskDispatcherShuffle;
-typedef void FTbSink(SStreamTask* pTask, void* vnode, int64_t ver, void* data);
-
typedef struct {
int64_t stbUid;
char stbFullName[TSDB_TABLE_FNAME_LEN];
SSchemaWrapper* pSchemaWrapper;
- // not applicable to encoder and decoder
- void* vnode;
- FTbSink* tbSinkFunc;
- STSchema* pTSchema;
+ void* vnode; // not available to encoder and decoder
+ FTbSink* tbSinkFunc;
+ STSchema* pTSchema;
} STaskSinkTb;
typedef void FSmaSink(void* vnode, int64_t smaId, const SArray* data);
@@ -295,24 +266,34 @@ typedef struct {
SEpSet epSet;
} SStreamChildEpInfo;
-struct SStreamTask {
- int64_t streamId;
- int32_t taskId;
- int32_t totalLevel;
- int8_t taskLevel;
- int8_t outputType;
- int16_t dispatchMsgType;
+typedef struct SStreamId {
+ int64_t streamId;
+ int32_t taskId;
+ const char* idStr;
+} SStreamId;
+typedef struct SCheckpointInfo {
+ int64_t id;
+ int64_t version; // offset in WAL
+} SCheckpointInfo;
+
+typedef struct SStreamStatus {
int8_t taskStatus;
int8_t schedStatus;
+} SStreamStatus;
- // node info
- int32_t selfChildId;
- int32_t nodeId;
- SEpSet epSet;
-
- int64_t recoverSnapVer;
- int64_t startVer;
+struct SStreamTask {
+ SStreamId id;
+ int32_t totalLevel;
+ int8_t taskLevel;
+ int8_t outputType;
+ int16_t dispatchMsgType;
+ SStreamStatus status;
+ int32_t selfChildId;
+ int32_t nodeId;
+ SEpSet epSet;
+ SCheckpointInfo chkInfo;
+ STaskExec exec;
// fill history
int8_t fillHistory;
@@ -322,9 +303,6 @@ struct SStreamTask {
int32_t nextCheckId;
SArray* checkpointInfo; // SArray
- // exec
- STaskExec exec;
-
// output
union {
STaskDispatcherFixedEp fixedEpDispatcher;
@@ -334,82 +312,56 @@ struct SStreamTask {
STaskSinkFetch fetchSink;
};
- int8_t inputStatus;
- int8_t outputStatus;
-
- // STaosQueue* inputQueue1;
- // STaosQall* inputQall;
+ int8_t inputStatus;
+ int8_t outputStatus;
SStreamQueue* inputQueue;
SStreamQueue* outputQueue;
// trigger
- int8_t triggerStatus;
- int64_t triggerParam;
- void* timer;
+ int8_t triggerStatus;
+ int64_t triggerParam;
+ void* timer;
+ SMsgCb* pMsgCb; // msg handle
+ SStreamState* pState; // state backend
- // msg handle
- SMsgCb* pMsgCb;
-
- // state backend
- SStreamState* pState;
-
- // do not serialize
- int32_t recoverTryingDownstream;
- int32_t recoverWaitingUpstream;
- int64_t checkReqId;
- SArray* checkReqIds; // shuffle
- int32_t refCnt;
-
- int64_t checkpointingId;
- int32_t checkpointAlignCnt;
+ // the followings attributes don't be serialized
+ int32_t recoverTryingDownstream;
+ int32_t recoverWaitingUpstream;
+ int64_t checkReqId;
+ SArray* checkReqIds; // shuffle
+ int32_t refCnt;
+ int64_t checkpointingId;
+ int32_t checkpointAlignCnt;
+ struct SStreamMeta* pMeta;
+ _free_reader_fn_t freeFp;
};
+// meta
+typedef struct SStreamMeta {
+ char* path;
+ TDB* db;
+ TTB* pTaskDb;
+ TTB* pCheckpointDb;
+ SHashObj* pTasks;
+ SHashObj* pWalReadTasks;
+ void* ahandle;
+ TXN* txn;
+ FTaskExpand* expandFunc;
+ int32_t vgId;
+ SRWLatch lock;
+ int8_t walScan;
+ bool quit;
+} SStreamMeta;
+
int32_t tEncodeStreamEpInfo(SEncoder* pEncoder, const SStreamChildEpInfo* pInfo);
int32_t tDecodeStreamEpInfo(SDecoder* pDecoder, SStreamChildEpInfo* pInfo);
-SStreamTask* tNewSStreamTask(int64_t streamId);
-int32_t tEncodeSStreamTask(SEncoder* pEncoder, const SStreamTask* pTask);
-int32_t tDecodeSStreamTask(SDecoder* pDecoder, SStreamTask* pTask);
-void tFreeSStreamTask(SStreamTask* pTask);
-
-static FORCE_INLINE int32_t streamTaskInput(SStreamTask* pTask, SStreamQueueItem* pItem) {
- int32_t code = 0;
- int8_t type = pItem->type;
- if (type == STREAM_INPUT__DATA_SUBMIT) {
- SStreamDataSubmit2* pSubmitClone = streamSubmitRefClone((SStreamDataSubmit2*)pItem);
- if (pSubmitClone == NULL) {
- qDebug("task %d %p submit enqueue failed since out of memory", pTask->taskId, pTask);
- terrno = TSDB_CODE_OUT_OF_MEMORY;
- atomic_store_8(&pTask->inputStatus, TASK_INPUT_STATUS__FAILED);
- return -1;
- }
- qDebug("task %d %p submit enqueue %p %p %p %d %" PRId64, pTask->taskId, pTask, pItem, pSubmitClone,
- pSubmitClone->submit.msgStr, pSubmitClone->submit.msgLen, pSubmitClone->submit.ver);
- code = taosWriteQitem(pTask->inputQueue->queue, pSubmitClone);
- // qStreamInput(pTask->exec.executor, pSubmitClone);
- } else if (type == STREAM_INPUT__DATA_BLOCK || type == STREAM_INPUT__DATA_RETRIEVE ||
- type == STREAM_INPUT__REF_DATA_BLOCK) {
- code = taosWriteQitem(pTask->inputQueue->queue, pItem);
- // qStreamInput(pTask->exec.executor, pItem);
- } else if (type == STREAM_INPUT__CHECKPOINT) {
- code = taosWriteQitem(pTask->inputQueue->queue, pItem);
- // qStreamInput(pTask->exec.executor, pItem);
- } else if (type == STREAM_INPUT__GET_RES) {
- code = taosWriteQitem(pTask->inputQueue->queue, pItem);
- // qStreamInput(pTask->exec.executor, pItem);
- }
- if (code != 0) return code;
-
- if (type != STREAM_INPUT__GET_RES && type != STREAM_INPUT__CHECKPOINT && pTask->triggerParam != 0) {
- atomic_val_compare_exchange_8(&pTask->triggerStatus, TASK_TRIGGER_STATUS__INACTIVE, TASK_TRIGGER_STATUS__ACTIVE);
- }
-
-#if 0
- // TODO: back pressure
- atomic_store_8(&pTask->inputStatus, TASK_INPUT_STATUS__NORMAL);
-#endif
- return 0;
-}
+SStreamTask* tNewStreamTask(int64_t streamId);
+int32_t tEncodeStreamTask(SEncoder* pEncoder, const SStreamTask* pTask);
+int32_t tDecodeStreamTask(SDecoder* pDecoder, SStreamTask* pTask);
+void tFreeStreamTask(SStreamTask* pTask);
+int32_t tAppendDataToInputQueue(SStreamTask* pTask, SStreamQueueItem* pItem);
+bool tInputQueueIsFull(const SStreamTask* pTask);
static FORCE_INLINE void streamTaskInputFail(SStreamTask* pTask) {
atomic_store_8(&pTask->inputStatus, TASK_INPUT_STATUS__FAILED);
@@ -617,40 +569,23 @@ int32_t streamAggRecoverPrepare(SStreamTask* pTask);
// int32_t streamAggChildrenRecoverFinish(SStreamTask* pTask);
int32_t streamProcessRecoverFinishReq(SStreamTask* pTask, int32_t childId);
-// expand and deploy
-typedef int32_t FTaskExpand(void* ahandle, SStreamTask* pTask, int64_t ver);
-
-// meta
-typedef struct SStreamMeta {
- char* path;
- TDB* db;
- TTB* pTaskDb;
- TTB* pCheckpointDb;
- SHashObj* pTasks;
- SHashObj* pRecoverStatus;
- void* ahandle;
- TXN* txn;
- FTaskExpand* expandFunc;
- int32_t vgId;
- SRWLatch lock;
-} SStreamMeta;
-
SStreamMeta* streamMetaOpen(const char* path, void* ahandle, FTaskExpand expandFunc, int32_t vgId);
void streamMetaClose(SStreamMeta* streamMeta);
-int32_t streamMetaSaveTask(SStreamMeta* pMeta, SStreamTask* pTask);
-int32_t streamMetaAddTask(SStreamMeta* pMeta, int64_t ver, SStreamTask* pTask);
-int32_t streamMetaAddSerializedTask(SStreamMeta* pMeta, int64_t startVer, char* msg, int32_t msgLen);
-// SStreamTask* streamMetaGetTask(SStreamMeta* pMeta, int32_t taskId);
+int32_t streamMetaSaveTask(SStreamMeta* pMeta, SStreamTask* pTask);
+int32_t streamMetaAddDeployedTask(SStreamMeta* pMeta, int64_t ver, SStreamTask* pTask);
+int32_t streamMetaAddSerializedTask(SStreamMeta* pMeta, int64_t checkpointVer, char* msg, int32_t msgLen);
+int32_t streamMetaGetNumOfTasks(const SStreamMeta* pMeta);
+SStreamTask* streamMetaAcquireTaskEx(SStreamMeta* pMeta, int32_t taskId);
SStreamTask* streamMetaAcquireTask(SStreamMeta* pMeta, int32_t taskId);
void streamMetaReleaseTask(SStreamMeta* pMeta, SStreamTask* pTask);
void streamMetaRemoveTask(SStreamMeta* pMeta, int32_t taskId);
-int32_t streamMetaBegin(SStreamMeta* pMeta);
-int32_t streamMetaCommit(SStreamMeta* pMeta);
-int32_t streamMetaRollBack(SStreamMeta* pMeta);
-int32_t streamLoadTasks(SStreamMeta* pMeta, int64_t ver);
+int32_t streamMetaBegin(SStreamMeta* pMeta);
+int32_t streamMetaCommit(SStreamMeta* pMeta);
+int32_t streamMetaRollBack(SStreamMeta* pMeta);
+int32_t streamLoadTasks(SStreamMeta* pMeta, int64_t ver);
// checkpoint
int32_t streamProcessCheckpointSourceReq(SStreamMeta* pMeta, SStreamTask* pTask, SStreamCheckpointSourceReq* pReq);
diff --git a/include/libs/wal/wal.h b/include/libs/wal/wal.h
index 014ed518a3..b51289de5e 100644
--- a/include/libs/wal/wal.h
+++ b/include/libs/wal/wal.h
@@ -138,7 +138,8 @@ typedef struct {
int8_t enableRef;
} SWalFilterCond;
-typedef struct {
+// todo hide this struct
+typedef struct SWalReader {
SWal *pWal;
int64_t readerId;
TdFilePtr pLogFile;
@@ -146,8 +147,8 @@ typedef struct {
int64_t curFileFirstVer;
int64_t curVersion;
int64_t capacity;
- int8_t curInvalid;
- int8_t curStopped;
+// int8_t curInvalid;
+// int8_t curStopped;
TdThreadMutex mutex;
SWalFilterCond cond;
// TODO remove it
@@ -196,6 +197,7 @@ void walReadReset(SWalReader *pReader);
int32_t walReadVer(SWalReader *pRead, int64_t ver);
int32_t walReadSeekVer(SWalReader *pRead, int64_t ver);
int32_t walNextValidMsg(SWalReader *pRead);
+int64_t walReaderGetCurrentVer(const SWalReader* pReader);
// only for tq usage
void walSetReaderCapacity(SWalReader *pRead, int32_t capacity);
diff --git a/include/util/taoserror.h b/include/util/taoserror.h
index adce476cf0..908c1a8ba6 100644
--- a/include/util/taoserror.h
+++ b/include/util/taoserror.h
@@ -242,6 +242,7 @@ int32_t* taosGetErrno();
#define TSDB_CODE_MND_INVALID_ALTER_OPER TAOS_DEF_ERROR_CODE(0, 0x0356)
#define TSDB_CODE_MND_AUTH_FAILURE TAOS_DEF_ERROR_CODE(0, 0x0357)
#define TSDB_CODE_MND_USER_NOT_AVAILABLE TAOS_DEF_ERROR_CODE(0, 0x0358)
+#define TSDB_CODE_MND_PRIVILEDGE_EXIST TAOS_DEF_ERROR_CODE(0, 0x0359)
// mnode-stable-part1
#define TSDB_CODE_MND_STB_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x0360)
@@ -762,6 +763,7 @@ int32_t* taosGetErrno();
#define TSDB_CODE_TMQ_INVALID_MSG TAOS_DEF_ERROR_CODE(0, 0x4000)
#define TSDB_CODE_TMQ_CONSUMER_MISMATCH TAOS_DEF_ERROR_CODE(0, 0x4001)
#define TSDB_CODE_TMQ_CONSUMER_CLOSED TAOS_DEF_ERROR_CODE(0, 0x4002)
+#define TSDB_CODE_TMQ_CONSUMER_ERROR TAOS_DEF_ERROR_CODE(0, 0x4003)
// stream
#define TSDB_CODE_STREAM_TASK_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x4100)
diff --git a/include/util/tdef.h b/include/util/tdef.h
index e5000891c9..2f86395dad 100644
--- a/include/util/tdef.h
+++ b/include/util/tdef.h
@@ -198,6 +198,7 @@ typedef enum ELogicConditionType {
#define TSDB_STREAM_NAME_LEN 193 // it is a null-terminated string
#define TSDB_DB_NAME_LEN 65
#define TSDB_DB_FNAME_LEN (TSDB_ACCT_ID_LEN + TSDB_DB_NAME_LEN + TSDB_NAME_DELIMITER_LEN)
+#define TSDB_PRIVILEDGE_CONDITION_LEN 200
#define TSDB_FUNC_NAME_LEN 65
#define TSDB_FUNC_COMMENT_LEN 1024 * 1024
diff --git a/include/util/tqueue.h b/include/util/tqueue.h
index 576703e842..503d15e793 100644
--- a/include/util/tqueue.h
+++ b/include/util/tqueue.h
@@ -61,7 +61,7 @@ typedef void (*FItems)(SQueueInfo *pInfo, STaosQall *qall, int32_t numOfItems);
typedef struct STaosQnode STaosQnode;
-typedef struct STaosQnode {
+struct STaosQnode {
STaosQnode *next;
STaosQueue *queue;
int64_t timestamp;
@@ -70,9 +70,9 @@ typedef struct STaosQnode {
int8_t itype;
int8_t reserved[3];
char item[];
-} STaosQnode;
+};
-typedef struct STaosQueue {
+struct STaosQueue {
STaosQnode *head;
STaosQnode *tail;
STaosQueue *next; // for queue set
@@ -86,22 +86,22 @@ typedef struct STaosQueue {
int64_t threadId;
int64_t memLimit;
int64_t itemLimit;
-} STaosQueue;
+};
-typedef struct STaosQset {
+struct STaosQset {
STaosQueue *head;
STaosQueue *current;
TdThreadMutex mutex;
tsem_t sem;
int32_t numOfQueues;
int32_t numOfItems;
-} STaosQset;
+};
-typedef struct STaosQall {
+struct STaosQall {
STaosQnode *current;
STaosQnode *start;
int32_t numOfItems;
-} STaosQall;
+};
STaosQueue *taosOpenQueue();
void taosCloseQueue(STaosQueue *queue);
diff --git a/packaging/docker/Dockerfile b/packaging/docker/Dockerfile
index 35bea0e65c..4b61a0cc0a 100644
--- a/packaging/docker/Dockerfile
+++ b/packaging/docker/Dockerfile
@@ -12,7 +12,7 @@ ENV TINI_VERSION v0.19.0
ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini-${cpuType} /tini
ENV DEBIAN_FRONTEND=noninteractive
WORKDIR /root/
-RUN tar -zxf ${pkgFile} && cd /root/${dirName}/ && /bin/bash install.sh -e no && cd /root && rm /root/${pkgFile} && rm -rf /root/${dirName} && apt-get update && apt-get install -y locales tzdata netcat && locale-gen en_US.UTF-8 && apt-get clean && rm -rf /var/lib/apt/lists/ && chmod +x /tini
+RUN tar -zxf ${pkgFile} && cd /root/${dirName}/ && /bin/bash install.sh -e no && cd /root && rm /root/${pkgFile} && rm -rf /root/${dirName} && apt-get update && apt-get install -y locales tzdata netcat curl gdb vim tmux less net-tools valgrind && locale-gen en_US.UTF-8 && apt-get clean && rm -rf /var/lib/apt/lists/ && chmod +x /tini
ENV LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/lib" \
LC_CTYPE=en_US.UTF-8 \
diff --git a/packaging/tools/install.sh b/packaging/tools/install.sh
index 0a4f3ff622..1b47b10520 100755
--- a/packaging/tools/install.sh
+++ b/packaging/tools/install.sh
@@ -572,6 +572,22 @@ function install_config() {
done
}
+function install_share_etc() {
+ [ ! -d ${script_dir}/share/etc ] && return
+ for c in `ls ${script_dir}/share/etc/`; do
+ if [ -e /etc/${clientName2}/$c ]; then
+ out=/etc/${clientName2}/$c.new.`date +%F`
+ ${csudo}cp -f ${script_dir}/share/etc/$c $out ||:
+ else
+ ${csudo}mkdir -p /etc/${clientName2} >/dev/null 2>/dev/null ||:
+ ${csudo}cp -f ${script_dir}/share/etc/$c /etc/${clientName2}/$c ||:
+ fi
+ done
+
+ [ ! -d ${script_dir}/share/srv ] && return
+ ${csudo} cp ${script_dir}/share/srv/* ${service_config_dir} ||:
+}
+
function install_log() {
${csudo}rm -rf ${log_dir} || :
${csudo}mkdir -p ${log_dir} && ${csudo}chmod 777 ${log_dir}
@@ -599,7 +615,7 @@ function install_examples() {
function install_web() {
if [ -d "${script_dir}/share" ]; then
- ${csudo}cp -rf ${script_dir}/share/* ${install_main_dir}/share
+ ${csudo}cp -rf ${script_dir}/share/* ${install_main_dir}/share > /dev/null 2>&1 ||:
fi
}
@@ -687,11 +703,33 @@ function clean_service_on_systemd() {
# if [ "$verMode" == "cluster" ] && [ "$clientName" != "$clientName2" ]; then
# ${csudo}rm -f ${service_config_dir}/${serverName2}.service
# fi
+ x_service_config="${service_config_dir}/${xName2}.service"
+ if [ -e "$x_service_config" ]; then
+ if systemctl is-active --quiet ${xName2}; then
+ echo "${productName2} ${xName2} is running, stopping it..."
+ ${csudo}systemctl stop ${xName2} &>/dev/null || echo &>/dev/null
+ fi
+ ${csudo}systemctl disable ${xName2} &>/dev/null || echo &>/dev/null
+ ${csudo}rm -f ${x_service_config}
+ fi
+
+ explorer_service_config="${service_config_dir}/${explorerName2}.service"
+ if [ -e "$explorer_service_config" ]; then
+ if systemctl is-active --quiet ${explorerName2}; then
+ echo "${productName2} ${explorerName2} is running, stopping it..."
+ ${csudo}systemctl stop ${explorerName2} &>/dev/null || echo &>/dev/null
+ fi
+ ${csudo}systemctl disable ${explorerName2} &>/dev/null || echo &>/dev/null
+ ${csudo}rm -f ${explorer_service_config}
+ ${csudo}rm -f /etc/${clientName2}/explorer.toml
+ fi
}
function install_service_on_systemd() {
clean_service_on_systemd
+ install_share_etc
+
[ -f ${script_dir}/cfg/${serverName2}.service ] &&
${csudo}cp ${script_dir}/cfg/${serverName2}.service \
${service_config_dir}/ || :
diff --git a/packaging/tools/mac_before_install.txt b/packaging/tools/mac_before_install.txt
index a428c612b2..4ce2374b7f 100644
--- a/packaging/tools/mac_before_install.txt
+++ b/packaging/tools/mac_before_install.txt
@@ -1,9 +1,9 @@
TDengine is an open-source, cloud-native time-series database optimized for Internet of Things (IoT), Connected Cars, and Industrial IoT. With its built-in caching, stream processing, and data subscription capabilities, TDengine offers a simplified solution for time-series data processing.
-To configure TDengine : edit /etc/taos/taos.cfg
-To start service : launchctl start com.tdengine.taosd
-To start Taos Adapter : launchctl start com.tdengine.taosadapter
-To access TDengine : use taos in shell
+• To configure TDengine, edit /etc/taos/taos.cfg
+• To start service, run launchctl start com.tdengine.taosd
+• To start Taos Adapter, run launchctl start com.tdengine.taosadapter
+• To access TDengine from your local machine, run taos
If you're experiencing problems installing TDengine, check the file /var/log/taos/tdengine_install.log to help troubleshoot the installation.
diff --git a/packaging/tools/mac_before_install_client.txt b/packaging/tools/mac_before_install_client.txt
index 0457d73c49..cce8191667 100644
--- a/packaging/tools/mac_before_install_client.txt
+++ b/packaging/tools/mac_before_install_client.txt
@@ -1,9 +1,9 @@
TDengine is an open-source, cloud-native time-series database optimized for Internet of Things (IoT), Connected Cars, and Industrial IoT. With its built-in caching, stream processing, and data subscription capabilities, TDengine offers a simplified solution for time-series data processing.
-Once it's installed, please take the steps below:
-1: open a terminal/shell in Mac
-2: if connecting to Cloud Service, follow the instructions on your cloud service account and configure the environment variable
-3: if connecting to another TDengine Service, you can also view help information via "taos --help"
-4: execute command taos
+After the installation process is complete, perform the following steps to start using TDengine:
+1: Open Terminal on your Mac.
+2: To connect to a TDengine server using the default settings and credentials, run the taos command.
+3: To connect to a TDengine server using custom settings or credentials, run taos --help for more information.
+4: To connect to TDengine Cloud, follow the instructions on the Tools - TDengine CLI page in your TDengine Cloud account.
-If you're experiencing problems installing TDengine, check the file /var/log/taos/tdengine_install.log to help troubleshoot the installation.
+If any issues occur during installation, check the /var/log/taos/tdengine_install.log file to troubleshoot.
\ No newline at end of file
diff --git a/packaging/tools/makepkg.sh b/packaging/tools/makepkg.sh
index 1a1622cb93..0dce526db6 100755
--- a/packaging/tools/makepkg.sh
+++ b/packaging/tools/makepkg.sh
@@ -51,11 +51,9 @@ fi
if [ -d ${top_dir}/tools/taos-tools/packaging/deb ]; then
cd ${top_dir}/tools/taos-tools/packaging/deb
-
- taostools_ver=$(git for-each-ref --sort=taggerdate --format '%(tag)' refs/tags|grep -v taos | tail -1)
- [ -z "$taos_tools_ver" ] && taos_tools_ver="0.1.0"
taostools_ver=$(git for-each-ref --sort=taggerdate --format '%(tag)' refs/tags|grep -v taos | tail -1)
+ [ -z "$taostools_ver" ] && taostools_ver="0.1.0"
taostools_install_dir="${release_dir}/${clientName2}Tools-${taostools_ver}"
cd ${curr_dir}
@@ -152,6 +150,7 @@ fi
mkdir -p ${install_dir}/bin && cp ${bin_files} ${install_dir}/bin && chmod a+x ${install_dir}/bin/* || :
mkdir -p ${install_dir}/init.d && cp ${init_file_deb} ${install_dir}/init.d/${serverName}.deb
mkdir -p ${install_dir}/init.d && cp ${init_file_rpm} ${install_dir}/init.d/${serverName}.rpm
+mkdir -p ${install_dir}/share && cp -rf ${build_dir}/share/{etc,srv} ${install_dir}/share ||:
if [ $adapterName != "taosadapter" ]; then
mv ${install_dir}/cfg/${clientName2}adapter.toml ${install_dir}/cfg/$adapterName.toml
diff --git a/packaging/tools/remove.sh b/packaging/tools/remove.sh
index 8ed3bd74b9..6c671473bf 100755
--- a/packaging/tools/remove.sh
+++ b/packaging/tools/remove.sh
@@ -192,7 +192,27 @@ function clean_service_on_systemd() {
${csudo}systemctl stop ${tarbitrator_service_name} &>/dev/null || echo &>/dev/null
fi
${csudo}systemctl disable ${tarbitrator_service_name} &>/dev/null || echo &>/dev/null
- ${csudo}rm -f ${tarbitratord_service_config}
+
+ x_service_config="${service_config_dir}/${xName2}.service"
+ if [ -e "$x_service_config" ]; then
+ if systemctl is-active --quiet ${xName2}; then
+ echo "${productName2} ${xName2} is running, stopping it..."
+ ${csudo}systemctl stop ${xName2} &>/dev/null || echo &>/dev/null
+ fi
+ ${csudo}systemctl disable ${xName2} &>/dev/null || echo &>/dev/null
+ ${csudo}rm -f ${x_service_config}
+ fi
+
+ explorer_service_config="${service_config_dir}/${explorerName2}.service"
+ if [ -e "$explorer_service_config" ]; then
+ if systemctl is-active --quiet ${explorerName2}; then
+ echo "${productName2} ${explorerName2} is running, stopping it..."
+ ${csudo}systemctl stop ${explorerName2} &>/dev/null || echo &>/dev/null
+ fi
+ ${csudo}systemctl disable ${explorerName2} &>/dev/null || echo &>/dev/null
+ ${csudo}rm -f ${explorer_service_config}
+ ${csudo}rm -f /etc/${clientName2}/explorer.toml
+ fi
}
function clean_service_on_sysvinit() {
diff --git a/source/client/inc/clientInt.h b/source/client/inc/clientInt.h
index 86db35b412..41f87379a9 100644
--- a/source/client/inc/clientInt.h
+++ b/source/client/inc/clientInt.h
@@ -36,14 +36,6 @@ extern "C" {
#include "tconfig.h"
-#define CHECK_CODE_GOTO(expr, label) \
- do { \
- code = expr; \
- if (TSDB_CODE_SUCCESS != code) { \
- goto label; \
- } \
- } while (0)
-
#define ERROR_MSG_BUF_DEFAULT_SIZE 512
#define HEARTBEAT_INTERVAL 1500 // ms
@@ -286,28 +278,7 @@ static FORCE_INLINE SReqResultInfo* tmqGetCurResInfo(TAOS_RES* res) {
return (SReqResultInfo*)&msg->resInfo;
}
-static FORCE_INLINE SReqResultInfo* tmqGetNextResInfo(TAOS_RES* res, bool convertUcs4) {
- SMqRspObj* pRspObj = (SMqRspObj*)res;
- pRspObj->resIter++;
-
- if (pRspObj->resIter < pRspObj->rsp.blockNum) {
- SRetrieveTableRsp* pRetrieve = (SRetrieveTableRsp*)taosArrayGetP(pRspObj->rsp.blockData, pRspObj->resIter);
- if (pRspObj->rsp.withSchema) {
- SSchemaWrapper* pSW = (SSchemaWrapper*)taosArrayGetP(pRspObj->rsp.blockSchema, pRspObj->resIter);
- setResSchemaInfo(&pRspObj->resInfo, pSW->pSchema, pSW->nCols);
- taosMemoryFreeClear(pRspObj->resInfo.row);
- taosMemoryFreeClear(pRspObj->resInfo.pCol);
- taosMemoryFreeClear(pRspObj->resInfo.length);
- taosMemoryFreeClear(pRspObj->resInfo.convertBuf);
- taosMemoryFreeClear(pRspObj->resInfo.convertJson);
- }
-
- setQueryResultFromRsp(&pRspObj->resInfo, pRetrieve, convertUcs4, false);
- return &pRspObj->resInfo;
- }
-
- return NULL;
-}
+SReqResultInfo* tmqGetNextResInfo(TAOS_RES* res, bool convertUcs4);
static FORCE_INLINE SReqResultInfo* tscGetCurResInfo(TAOS_RES* res) {
if (TD_RES_QUERY(res)) return &(((SRequestObj*)res)->body.resInfo);
@@ -320,7 +291,6 @@ extern int32_t clientConnRefPool;
extern int32_t timestampDeltaLimit;
extern int64_t lastClusterId;
-
__async_send_cb_fn_t getMsgRspHandle(int32_t msgType);
SMsgSendInfo* buildMsgInfoImpl(SRequestObj* pReqObj);
@@ -373,7 +343,6 @@ void taos_close_internal(void* taos);
// global, called by mgmt
int hbMgrInit();
void hbMgrCleanUp();
-int hbHandleRsp(SClientHbBatchRsp* hbRsp);
// cluster level
SAppHbMgr* appHbMgrInit(SAppInstInfo* pAppInstInfo, char* key);
@@ -386,9 +355,6 @@ void stopAllRequests(SHashObj* pRequests);
int hbRegisterConn(SAppHbMgr* pAppHbMgr, int64_t tscRefId, int64_t clusterId, int8_t connType);
void hbDeregisterConn(SAppHbMgr* pAppHbMgr, SClientHbKey connKey);
-// --- mq
-void hbMgrInitMqHbRspHandle();
-
typedef struct SSqlCallbackWrapper {
SParseContext* pParseCtx;
SCatalogReq* pCatalogReq;
diff --git a/source/client/inc/clientLog.h b/source/client/inc/clientLog.h
index c29f495201..908e470830 100644
--- a/source/client/inc/clientLog.h
+++ b/source/client/inc/clientLog.h
@@ -26,6 +26,7 @@ extern "C" {
#define tscFatal(...) do { if (cDebugFlag & DEBUG_FATAL) { taosPrintLog("TSC FATAL ", DEBUG_FATAL, cDebugFlag, __VA_ARGS__); }} while(0)
#define tscError(...) do { if (cDebugFlag & DEBUG_ERROR) { taosPrintLog("TSC ERROR ", DEBUG_ERROR, cDebugFlag, __VA_ARGS__); }} while(0)
#define tscWarn(...) do { if (cDebugFlag & DEBUG_WARN) { taosPrintLog("TSC WARN ", DEBUG_WARN, cDebugFlag, __VA_ARGS__); }} while(0)
+#define tscWarnL(...) do { if (cDebugFlag & DEBUG_WARN) { taosPrintLongString("TSC WARN ", DEBUG_WARN, cDebugFlag, __VA_ARGS__); }} while(0)
#define tscInfo(...) do { if (cDebugFlag & DEBUG_INFO) { taosPrintLog("TSC ", DEBUG_INFO, cDebugFlag, __VA_ARGS__); }} while(0)
#define tscDebug(...) do { if (cDebugFlag & DEBUG_DEBUG) { taosPrintLog("TSC ", DEBUG_DEBUG, cDebugFlag, __VA_ARGS__); }} while(0)
#define tscTrace(...) do { if (cDebugFlag & DEBUG_TRACE) { taosPrintLog("TSC ", DEBUG_TRACE, cDebugFlag, __VA_ARGS__); }} while(0)
diff --git a/source/client/inc/clientStmt.h b/source/client/inc/clientStmt.h
index 2b42de93e3..cbef80b6da 100644
--- a/source/client/inc/clientStmt.h
+++ b/source/client/inc/clientStmt.h
@@ -102,6 +102,7 @@ typedef struct STscStmt {
SStmtBindInfo bInfo;
int64_t reqid;
+ int32_t errCode;
} STscStmt;
extern char *gStmtStatusStr[];
@@ -121,6 +122,7 @@ extern char *gStmtStatusStr[];
int32_t _code = c; \
if (_code != TSDB_CODE_SUCCESS) { \
terrno = _code; \
+ pStmt->errCode = _code; \
return _code; \
} \
} while (0)
@@ -129,6 +131,7 @@ extern char *gStmtStatusStr[];
int32_t _code = c; \
if (_code != TSDB_CODE_SUCCESS) { \
terrno = _code; \
+ pStmt->errCode = _code; \
} \
return _code; \
} while (0)
@@ -137,9 +140,19 @@ extern char *gStmtStatusStr[];
code = c; \
if (code != TSDB_CODE_SUCCESS) { \
terrno = code; \
+ pStmt->errCode = code; \
goto _return; \
} \
} while (0)
+#define STMT_ERRI_JRET(c) \
+ do { \
+ code = c; \
+ if (code != TSDB_CODE_SUCCESS) { \
+ terrno = code; \
+ goto _return; \
+ } \
+ } while (0)
+
#define STMT_ELOG(param, ...) qError("stmt:%p " param, pStmt, __VA_ARGS__)
#define STMT_DLOG(param, ...) qDebug("stmt:%p " param, pStmt, __VA_ARGS__)
diff --git a/source/client/src/clientEnv.c b/source/client/src/clientEnv.c
index 874ac12f5c..418103f2a6 100644
--- a/source/client/src/clientEnv.c
+++ b/source/client/src/clientEnv.c
@@ -107,6 +107,7 @@ static void deregisterRequest(SRequestObj *pRequest) {
if (duration >= SLOW_QUERY_INTERVAL) {
atomic_add_fetch_64((int64_t *)&pActivity->numOfSlowQueries, 1);
+ tscWarnL("slow query: %s, duration:%" PRId64, pRequest->sqlstr, duration);
}
releaseTscObj(pTscObj->id);
diff --git a/source/client/src/clientImpl.c b/source/client/src/clientImpl.c
index dac44bd9c4..ce174744ef 100644
--- a/source/client/src/clientImpl.c
+++ b/source/client/src/clientImpl.c
@@ -1039,8 +1039,7 @@ static int32_t asyncExecSchQuery(SRequestObj* pRequest, SQuery* pQuery, SMetaDat
.sysInfo = pRequest->pTscObj->sysInfo,
.allocatorId = pRequest->allocatorRefId};
- SAppInstInfo* pAppInfo = getAppInfo(pRequest);
- SQueryPlan* pDag = NULL;
+ SQueryPlan* pDag = NULL;
int64_t st = taosGetTimestampUs();
int32_t code = qCreateQueryPlan(&cxt, &pDag, pMnodeList);
@@ -1052,7 +1051,6 @@ static int32_t asyncExecSchQuery(SRequestObj* pRequest, SQuery* pQuery, SMetaDat
}
pRequest->metric.execStart = taosGetTimestampUs();
-
pRequest->metric.planCostUs = pRequest->metric.execStart - st;
if (TSDB_CODE_SUCCESS == code && !pRequest->validateOnly) {
diff --git a/source/client/src/clientSml.c b/source/client/src/clientSml.c
index ef7bd546c1..17150286e1 100644
--- a/source/client/src/clientSml.c
+++ b/source/client/src/clientSml.c
@@ -174,6 +174,7 @@ static int32_t smlParseTableName(SArray *tags, char *childTableName) {
if (childTableNameLen == tag->keyLen && strncmp(tag->key, tsSmlChildTableName, tag->keyLen) == 0) {
memset(childTableName, 0, TSDB_TABLE_NAME_LEN);
strncpy(childTableName, tag->value, (tag->length < TSDB_TABLE_NAME_LEN ? tag->length : TSDB_TABLE_NAME_LEN));
+ taosArrayRemove(tags, i);
break;
}
}
@@ -533,8 +534,7 @@ static int32_t smlGenerateSchemaAction(SSchema *colField, SHashObj *colHash, SSm
uint16_t *index = colHash ? (uint16_t *)taosHashGet(colHash, kv->key, kv->keyLen) : NULL;
if (index) {
if (colField[*index].type != kv->type) {
- uError("SML:0x%" PRIx64 " point type and db type mismatch. key: %s. point type: %d, db type: %d", info->id,
- kv->key, colField[*index].type, kv->type);
+ uError("SML:0x%" PRIx64 " point type and db type mismatch. point type: %d, db type: %d, key: %s", info->id, colField[*index].type, kv->type, kv->key);
return TSDB_CODE_TSC_INVALID_VALUE;
}
@@ -699,7 +699,7 @@ static int32_t smlSendMetaMsg(SSmlHandle *info, SName *pName, SArray *pColumns,
pReq.numOfTags = 1;
SField field = {0};
field.type = TSDB_DATA_TYPE_NCHAR;
- field.bytes = 1;
+ field.bytes = TSDB_NCHAR_SIZE + VARSTR_HEADER_SIZE;
strcpy(field.name, tsSmlTagName);
taosArrayPush(pReq.pTags, &field);
}
diff --git a/source/client/src/clientStmt.c b/source/client/src/clientStmt.c
index 3ed157efef..6e529f1a0b 100644
--- a/source/client/src/clientStmt.c
+++ b/source/client/src/clientStmt.c
@@ -32,8 +32,14 @@ int32_t stmtSwitchStatus(STscStmt* pStmt, STMT_STATUS newStatus) {
STMT_LOG_SEQ(newStatus);
}
+ if (pStmt->errCode && newStatus != STMT_PREPARE) {
+ STMT_DLOG("stmt already failed with err: %s", tstrerror(pStmt->errCode));
+ return pStmt->errCode;
+ }
+
switch (newStatus) {
case STMT_PREPARE:
+ pStmt->errCode = 0;
break;
case STMT_SETTBNAME:
if (STMT_STATUS_EQ(INIT) || STMT_STATUS_EQ(BIND) || STMT_STATUS_EQ(BIND_COL)) {
@@ -197,7 +203,10 @@ int32_t stmtGetExecInfo(TAOS_STMT* stmt, SHashObj** pVgHash, SHashObj** pBlockHa
STscStmt* pStmt = (STscStmt*)stmt;
*pVgHash = pStmt->sql.pVgHash;
+ pStmt->sql.pVgHash = NULL;
+
*pBlockHash = pStmt->exec.pBlockHash;
+ pStmt->exec.pBlockHash = NULL;
return TSDB_CODE_SUCCESS;
}
@@ -325,6 +334,8 @@ int32_t stmtCleanExecInfo(STscStmt* pStmt, bool keepTable, bool deepClean) {
}
int32_t stmtCleanSQLInfo(STscStmt* pStmt) {
+ STMT_DLOG_E("start to free SQL info");
+
taosMemoryFree(pStmt->sql.queryRes.fields);
taosMemoryFree(pStmt->sql.queryRes.userFields);
taosMemoryFree(pStmt->sql.sqlStr);
@@ -351,6 +362,8 @@ int32_t stmtCleanSQLInfo(STscStmt* pStmt) {
memset(&pStmt->sql, 0, sizeof(pStmt->sql));
+ STMT_DLOG_E("end to free SQL info");
+
return TSDB_CODE_SUCCESS;
}
@@ -441,11 +454,10 @@ int32_t stmtGetFromCache(STscStmt* pStmt) {
.mgmtEps = getEpSet_s(&pStmt->taos->pAppInfo->mgmtEp)};
int32_t code = catalogGetTableMeta(pStmt->pCatalog, &conn, &pStmt->bInfo.sname, &pTableMeta);
if (TSDB_CODE_PAR_TABLE_NOT_EXIST == code) {
- STMT_ERR_RET(stmtCleanBindInfo(pStmt));
-
tscDebug("tb %s not exist", pStmt->bInfo.tbFName);
+ stmtCleanBindInfo(pStmt);
- return TSDB_CODE_SUCCESS;
+ STMT_ERR_RET(code);
}
STMT_ERR_RET(code);
@@ -922,9 +934,13 @@ _return:
int stmtClose(TAOS_STMT* stmt) {
STscStmt* pStmt = (STscStmt*)stmt;
+ STMT_DLOG_E("start to free stmt");
+
stmtCleanSQLInfo(pStmt);
taosMemoryFree(stmt);
+ STMT_DLOG_E("stmt freed");
+
return TSDB_CODE_SUCCESS;
}
@@ -959,15 +975,17 @@ int stmtIsInsert(TAOS_STMT* stmt, int* insert) {
}
int stmtGetTagFields(TAOS_STMT* stmt, int* nums, TAOS_FIELD_E** fields) {
+ int32_t code = 0;
STscStmt* pStmt = (STscStmt*)stmt;
+ int32_t preCode = pStmt->errCode;
STMT_DLOG_E("start to get tag fields");
if (STMT_TYPE_QUERY == pStmt->sql.type) {
- STMT_RET(TSDB_CODE_TSC_STMT_API_ERROR);
+ STMT_ERRI_JRET(TSDB_CODE_TSC_STMT_API_ERROR);
}
- STMT_ERR_RET(stmtSwitchStatus(pStmt, STMT_FETCH_FIELDS));
+ STMT_ERRI_JRET(stmtSwitchStatus(pStmt, STMT_FETCH_FIELDS));
if (pStmt->bInfo.needParse && pStmt->sql.runTimes && pStmt->sql.type > 0 &&
STMT_TYPE_MULTI_INSERT != pStmt->sql.type) {
@@ -979,27 +997,33 @@ int stmtGetTagFields(TAOS_STMT* stmt, int* nums, TAOS_FIELD_E** fields) {
pStmt->exec.pRequest = NULL;
}
- STMT_ERR_RET(stmtCreateRequest(pStmt));
+ STMT_ERRI_JRET(stmtCreateRequest(pStmt));
if (pStmt->bInfo.needParse) {
- STMT_ERR_RET(stmtParseSql(pStmt));
+ STMT_ERRI_JRET(stmtParseSql(pStmt));
}
- STMT_ERR_RET(stmtFetchTagFields(stmt, nums, fields));
+ STMT_ERRI_JRET(stmtFetchTagFields(stmt, nums, fields));
- return TSDB_CODE_SUCCESS;
+_return:
+
+ pStmt->errCode = preCode;
+
+ return code;
}
int stmtGetColFields(TAOS_STMT* stmt, int* nums, TAOS_FIELD_E** fields) {
+ int32_t code = 0;
STscStmt* pStmt = (STscStmt*)stmt;
+ int32_t preCode = pStmt->errCode;
STMT_DLOG_E("start to get col fields");
if (STMT_TYPE_QUERY == pStmt->sql.type) {
- STMT_RET(TSDB_CODE_TSC_STMT_API_ERROR);
+ STMT_ERRI_JRET(TSDB_CODE_TSC_STMT_API_ERROR);
}
- STMT_ERR_RET(stmtSwitchStatus(pStmt, STMT_FETCH_FIELDS));
+ STMT_ERRI_JRET(stmtSwitchStatus(pStmt, STMT_FETCH_FIELDS));
if (pStmt->bInfo.needParse && pStmt->sql.runTimes && pStmt->sql.type > 0 &&
STMT_TYPE_MULTI_INSERT != pStmt->sql.type) {
@@ -1011,15 +1035,19 @@ int stmtGetColFields(TAOS_STMT* stmt, int* nums, TAOS_FIELD_E** fields) {
pStmt->exec.pRequest = NULL;
}
- STMT_ERR_RET(stmtCreateRequest(pStmt));
+ STMT_ERRI_JRET(stmtCreateRequest(pStmt));
if (pStmt->bInfo.needParse) {
- STMT_ERR_RET(stmtParseSql(pStmt));
+ STMT_ERRI_JRET(stmtParseSql(pStmt));
}
- STMT_ERR_RET(stmtFetchColFields(stmt, nums, fields));
+ STMT_ERRI_JRET(stmtFetchColFields(stmt, nums, fields));
- return TSDB_CODE_SUCCESS;
+_return:
+
+ pStmt->errCode = preCode;
+
+ return code;
}
int stmtGetParamNum(TAOS_STMT* stmt, int* nums) {
diff --git a/source/client/src/clientTmq.c b/source/client/src/clientTmq.c
index 9e43765b5b..ceca06e309 100644
--- a/source/client/src/clientTmq.c
+++ b/source/client/src/clientTmq.c
@@ -98,17 +98,16 @@ struct tmq_t {
int64_t totalRows;
// timer
- tmr_h hbLiveTimer;
- tmr_h epTimer;
- tmr_h reportTimer;
- tmr_h commitTimer;
- STscObj* pTscObj; // connection
- SArray* clientTopics; // SArray
- STaosQueue* mqueue; // queue of rsp
- STaosQall* qall;
- STaosQueue* delayedTask; // delayed task queue for heartbeat and auto commit
- TdThreadMutex lock; // used to protect the operation on each topic, when updating the epsets.
- tsem_t rspSem;
+ tmr_h hbLiveTimer;
+ tmr_h epTimer;
+ tmr_h reportTimer;
+ tmr_h commitTimer;
+ STscObj* pTscObj; // connection
+ SArray* clientTopics; // SArray
+ STaosQueue* mqueue; // queue of rsp
+ STaosQall* qall;
+ STaosQueue* delayedTask; // delayed task queue for heartbeat and auto commit
+ tsem_t rspSem;
};
typedef struct SAskEpInfo {
@@ -188,7 +187,6 @@ typedef struct {
SMqClientVg* pVg;
SMqClientTopic* pTopic;
int32_t vgId;
- tsem_t rspSem;
uint64_t requestId; // request id for debug purpose
} SMqPollCbParam;
@@ -212,6 +210,11 @@ typedef struct {
tmq_t* pTmq;
} SMqCommitCbParam;
+typedef struct SSyncCommitInfo {
+ tsem_t sem;
+ int32_t code;
+} SSyncCommitInfo;
+
static int32_t doAskEp(tmq_t* tmq);
static int32_t makeTopicVgroupKey(char* dst, const char* topicName, int32_t vg);
static int32_t tmqCommitDone(SMqCommitCbParamSet* pParamSet);
@@ -523,11 +526,7 @@ static int32_t doSendCommitMsg(tmq_t* tmq, SMqClientVg* pVg, const char* pTopicN
return TSDB_CODE_OUT_OF_MEMORY;
}
- pMsgSendInfo->msgInfo = (SDataBuf){
- .pData = buf,
- .len = sizeof(SMsgHead) + len,
- .handle = NULL,
- };
+ pMsgSendInfo->msgInfo = (SDataBuf) { .pData = buf, .len = sizeof(SMsgHead) + len, .handle = NULL };
pMsgSendInfo->requestId = generateRequestId();
pMsgSendInfo->requestObjRefId = 0;
@@ -788,11 +787,7 @@ void tmqSendHbReq(void* param, void* tmrId) {
goto OVER;
}
- sendInfo->msgInfo = (SDataBuf){
- .pData = pReq,
- .len = tlen,
- .handle = NULL,
- };
+ sendInfo->msgInfo = (SDataBuf){ .pData = pReq, .len = tlen, .handle = NULL };
sendInfo->requestId = generateRequestId();
sendInfo->requestObjRefId = 0;
@@ -979,7 +974,6 @@ void tmqFreeImpl(void* handle) {
taosFreeQall(tmq->qall);
tsem_destroy(&tmq->rspSem);
- taosThreadMutexDestroy(&tmq->lock);
taosArrayDestroyEx(tmq->clientTopics, freeClientVgImpl);
taos_close_internal(tmq->pTscObj);
@@ -1024,7 +1018,6 @@ tmq_t* tmq_consumer_new(tmq_conf_t* conf, char* errstr, int32_t errstrLen) {
pTmq->delayedTask = taosOpenQueue();
pTmq->qall = taosAllocateQall();
- taosThreadMutexInit(&pTmq->lock, NULL);
if (pTmq->clientTopics == NULL || pTmq->mqueue == NULL || pTmq->qall == NULL || pTmq->delayedTask == NULL ||
conf->groupId[0] == 0) {
terrno = TSDB_CODE_OUT_OF_MEMORY;
@@ -1155,6 +1148,7 @@ int32_t tmq_subscribe(tmq_t* tmq, const tmq_list_t* topic_list) {
};
if (tsem_init(¶m.rspSem, 0, 0) != 0) {
+ code = TSDB_CODE_TSC_INTERNAL_ERROR;
goto FAIL;
}
@@ -1190,6 +1184,8 @@ int32_t tmq_subscribe(tmq_t* tmq, const tmq_list_t* topic_list) {
int32_t retryCnt = 0;
while (TSDB_CODE_MND_CONSUMER_NOT_READY == doAskEp(tmq)) {
if (retryCnt++ > MAX_RETRY_COUNT) {
+ tscError("consumer:0x%" PRIx64 ", mnd not ready for subscribe, retry:%d in 500ms", tmq->consumerId, retryCnt);
+ code = TSDB_CODE_TSC_INTERNAL_ERROR;
goto FAIL;
}
@@ -1233,7 +1229,6 @@ int32_t tmqPollCb(void* param, SDataBuf* pMsg, int32_t code) {
tmq_t* tmq = taosAcquireRef(tmqMgmt.rsetId, refId);
if (tmq == NULL) {
- tsem_destroy(&pParam->rspSem);
taosMemoryFree(pParam);
taosMemoryFree(pMsg->pData);
taosMemoryFree(pMsg->pEpSet);
@@ -1270,6 +1265,8 @@ int32_t tmqPollCb(void* param, SDataBuf* pMsg, int32_t code) {
pRspWrapper->tmqRspType = TMQ_MSG_TYPE__END_RSP;
taosWriteQitem(tmq->mqueue, pRspWrapper);
+ } else if (code == TSDB_CODE_WAL_LOG_NOT_EXIST) { // poll data while insert
+ taosMsleep(500);
}
goto CREATE_MSG_FAIL;
@@ -1346,8 +1343,9 @@ int32_t tmqPollCb(void* param, SDataBuf* pMsg, int32_t code) {
taosMemoryFree(pMsg->pData);
taosWriteQitem(tmq->mqueue, pRspWrapper);
+ int32_t total = taosQueueItemSize(tmq->mqueue);
tscDebug("consumer:0x%" PRIx64 " put poll res into mqueue, type:%d, vgId:%d, total in queue:%d, reqId:0x%" PRIx64,
- tmq->consumerId, rspType, vgId, tmq->mqueue->numOfItems, requestId);
+ tmq->consumerId, rspType, vgId, total, requestId);
tsem_post(&tmq->rspSem);
taosReleaseRef(tmqMgmt.rsetId, refId);
@@ -1422,7 +1420,7 @@ static void freeClientVgInfo(void* param) {
taosArrayDestroy(pTopic->vgs);
}
-static bool tmqUpdateEp(tmq_t* tmq, int32_t epoch, const SMqAskEpRsp* pRsp) {
+static bool doUpdateLocalEp(tmq_t* tmq, int32_t epoch, const SMqAskEpRsp* pRsp) {
bool set = false;
int32_t topicNumCur = taosArrayGetSize(tmq->clientTopics);
@@ -1431,6 +1429,9 @@ static bool tmqUpdateEp(tmq_t* tmq, int32_t epoch, const SMqAskEpRsp* pRsp) {
char vgKey[TSDB_TOPIC_FNAME_LEN + 22];
tscDebug("consumer:0x%" PRIx64 " update ep epoch from %d to epoch %d, incoming topics:%d, existed topics:%d",
tmq->consumerId, tmq->epoch, epoch, topicNumGet, topicNumCur);
+ if (epoch <= tmq->epoch) {
+ return false;
+ }
SArray* newTopics = taosArrayInit(topicNumGet, sizeof(SMqClientTopic));
if (newTopics == NULL) {
@@ -1474,14 +1475,11 @@ static bool tmqUpdateEp(tmq_t* tmq, int32_t epoch, const SMqAskEpRsp* pRsp) {
taosHashCleanup(pVgOffsetHashMap);
- taosThreadMutexLock(&tmq->lock);
// destroy current buffered existed topics info
if (tmq->clientTopics) {
taosArrayDestroyEx(tmq->clientTopics, freeClientVgInfo);
}
-
tmq->clientTopics = newTopics;
- taosThreadMutexUnlock(&tmq->lock);
int8_t flag = (topicNumGet == 0) ? TMQ_CONSUMER_STATUS__NO_TOPIC : TMQ_CONSUMER_STATUS__READY;
atomic_store_8(&tmq->status, flag);
@@ -1537,8 +1535,8 @@ int32_t askEpCallbackFn(void* param, SDataBuf* pMsg, int32_t code) {
} else {
tscDebug("consumer:0x%" PRIx64 ", recv ep, msg epoch %d, current epoch %d, update local ep", tmq->consumerId,
head->epoch, epoch);
- pParam->pUserFn(tmq, code, pMsg, pParam->pParam);
}
+ pParam->pUserFn(tmq, code, pMsg, pParam->pParam);
taosReleaseRef(tmqMgmt.rsetId, pParam->refId);
@@ -1745,7 +1743,7 @@ static int32_t tmqHandleNoPollRsp(tmq_t* tmq, SMqRspWrapper* rspWrapper, bool* p
if (rspWrapper->epoch > atomic_load_32(&tmq->epoch)) {
SMqAskEpRspWrapper* pEpRspWrapper = (SMqAskEpRspWrapper*)rspWrapper;
SMqAskEpRsp* rspMsg = &pEpRspWrapper->msg;
- tmqUpdateEp(tmq, rspWrapper->epoch, rspMsg);
+ doUpdateLocalEp(tmq, rspWrapper->epoch, rspMsg);
/*tmqClearUnhandleMsg(tmq);*/
tDeleteSMqAskEpRsp(rspMsg);
*pReset = true;
@@ -2125,13 +2123,8 @@ void tmq_commit_async(tmq_t* tmq, const TAOS_RES* pRes, tmq_commit_cb* cb, void*
}
}
-typedef struct SSyncCommitInfo {
- tsem_t sem;
- int32_t code;
-} SSyncCommitInfo;
-
-static void commitCallBackFn(tmq_t* pTmq, int32_t code, void* param) {
- SSyncCommitInfo* pInfo = (SSyncCommitInfo*)param;
+static void commitCallBackFn(tmq_t *pTmq, int32_t code, void* param) {
+ SSyncCommitInfo* pInfo = (SSyncCommitInfo*) param;
pInfo->code = code;
tsem_post(&pInfo->sem);
}
@@ -2168,7 +2161,7 @@ void updateEpCallbackFn(tmq_t* pTmq, int32_t code, SDataBuf* pDataBuf, void* par
SMqAskEpRsp rsp;
tDecodeSMqAskEpRsp(POINTER_SHIFT(pDataBuf->pData, sizeof(SMqRspHead)), &rsp);
- tmqUpdateEp(pTmq, head->epoch, &rsp);
+ doUpdateLocalEp(pTmq, head->epoch, &rsp);
tDeleteSMqAskEpRsp(&rsp);
}
@@ -2308,3 +2301,26 @@ void commitRspCountDown(SMqCommitCbParamSet* pParamSet, int64_t consumerId, cons
waitingRspNum);
}
}
+
+SReqResultInfo* tmqGetNextResInfo(TAOS_RES* res, bool convertUcs4) {
+ SMqRspObj* pRspObj = (SMqRspObj*)res;
+ pRspObj->resIter++;
+
+ if (pRspObj->resIter < pRspObj->rsp.blockNum) {
+ SRetrieveTableRsp* pRetrieve = (SRetrieveTableRsp*)taosArrayGetP(pRspObj->rsp.blockData, pRspObj->resIter);
+ if (pRspObj->rsp.withSchema) {
+ SSchemaWrapper* pSW = (SSchemaWrapper*)taosArrayGetP(pRspObj->rsp.blockSchema, pRspObj->resIter);
+ setResSchemaInfo(&pRspObj->resInfo, pSW->pSchema, pSW->nCols);
+ taosMemoryFreeClear(pRspObj->resInfo.row);
+ taosMemoryFreeClear(pRspObj->resInfo.pCol);
+ taosMemoryFreeClear(pRspObj->resInfo.length);
+ taosMemoryFreeClear(pRspObj->resInfo.convertBuf);
+ taosMemoryFreeClear(pRspObj->resInfo.convertJson);
+ }
+
+ setQueryResultFromRsp(&pRspObj->resInfo, pRetrieve, convertUcs4, false);
+ return &pRspObj->resInfo;
+ }
+
+ return NULL;
+}
\ No newline at end of file
diff --git a/source/client/test/clientTests.cpp b/source/client/test/clientTests.cpp
index 517d8e0221..055ac450dc 100644
--- a/source/client/test/clientTests.cpp
+++ b/source/client/test/clientTests.cpp
@@ -162,9 +162,11 @@ void* queryThread(void* arg) {
return NULL;
}
-static int32_t numOfThreads = 1;
+int32_t numOfThreads = 1;
-void tmq_commit_cb_print(tmq_t* pTmq, int32_t code, void* param) { printf("success, code:%d\n", code); }
+void tmq_commit_cb_print(tmq_t* pTmq, int32_t code, void* param) {
+ printf("auto commit success, code:%d\n\n\n\n", code);
+}
void* doConsumeData(void* param) {
TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0);
@@ -172,7 +174,7 @@ void* doConsumeData(void* param) {
tmq_conf_t* conf = tmq_conf_new();
tmq_conf_set(conf, "enable.auto.commit", "true");
tmq_conf_set(conf, "auto.commit.interval.ms", "1000");
- tmq_conf_set(conf, "group.id", "cgrpName12");
+ tmq_conf_set(conf, "group.id", "cgrpName41");
tmq_conf_set(conf, "td.connect.user", "root");
tmq_conf_set(conf, "td.connect.pass", "taosdata");
tmq_conf_set(conf, "auto.offset.reset", "earliest");
@@ -1059,7 +1061,7 @@ TEST(clientCase, sub_tb_test) {
tmq_conf_t* conf = tmq_conf_new();
tmq_conf_set(conf, "enable.auto.commit", "true");
tmq_conf_set(conf, "auto.commit.interval.ms", "1000");
- tmq_conf_set(conf, "group.id", "cgrpName27");
+ tmq_conf_set(conf, "group.id", "cgrpName45");
tmq_conf_set(conf, "td.connect.user", "root");
tmq_conf_set(conf, "td.connect.pass", "taosdata");
tmq_conf_set(conf, "auto.offset.reset", "earliest");
diff --git a/source/common/src/systable.c b/source/common/src/systable.c
index 228aa40fa9..cd3dd63ef0 100644
--- a/source/common/src/systable.c
+++ b/source/common/src/systable.c
@@ -299,7 +299,9 @@ static const SSysDbTableSchema vnodesSchema[] = {
static const SSysDbTableSchema userUserPrivilegesSchema[] = {
{.name = "user_name", .bytes = TSDB_USER_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false},
{.name = "privilege", .bytes = 10 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false},
- {.name = "object_name", .bytes = TSDB_DB_NAME_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false},
+ {.name = "db_name", .bytes = TSDB_DB_NAME_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false},
+ {.name = "table_name", .bytes = TSDB_TABLE_NAME_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false},
+ {.name = "condition", .bytes = TSDB_PRIVILEDGE_CONDITION_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false},
};
static const SSysTableMeta infosMeta[] = {
diff --git a/source/common/src/tdatablock.c b/source/common/src/tdatablock.c
index e021e65549..b2cf380f3b 100644
--- a/source/common/src/tdatablock.c
+++ b/source/common/src/tdatablock.c
@@ -1590,12 +1590,13 @@ static void doShiftBitmap(char* nullBitmap, size_t n, size_t total) {
i += 1;
}
} else if (n > 8) {
- int32_t gap = len - newLen;
+ int32_t remain = (total % 8 != 0 && total % 8 <= tail) ? 1 : 0;
+ int32_t gap = len - newLen - remain;
while (i < newLen) {
uint8_t v = p[i + gap];
p[i] = (v << tail);
- if (i < newLen - 1) {
+ if (i < newLen - 1 + remain) {
uint8_t next = p[i + gap + 1];
p[i] |= (next >> (8 - tail));
}
diff --git a/source/common/src/tglobal.c b/source/common/src/tglobal.c
index a4ee0624ce..ed3c74ad3d 100644
--- a/source/common/src/tglobal.c
+++ b/source/common/src/tglobal.c
@@ -20,6 +20,10 @@
#include "tlog.h"
#include "tmisce.h"
+#if defined(CUS_NAME) || defined(CUS_PROMPT) || defined(CUS_EMAIL)
+#include "cus_name.h"
+#endif
+
GRANT_CFG_DECLARE;
SConfig *tsCfg = NULL;
@@ -99,6 +103,7 @@ char tsSmlChildTableName[TSDB_TABLE_NAME_LEN] = ""; // user defined child table
// query
int32_t tsQueryPolicy = 1;
int32_t tsQueryRspPolicy = 0;
+int64_t tsQueryMaxConcurrentTables = 200; // unit is TSDB_TABLE_NUM_UNIT
bool tsEnableQueryHb = false;
int32_t tsQuerySmaOptimize = 0;
int32_t tsQueryRsmaTolerance = 1000; // the tolerance time (ms) to judge from which level to query rsma data.
@@ -338,6 +343,7 @@ static int32_t taosAddClientCfg(SConfig *pCfg) {
if (cfgAddInt32(pCfg, "maxRetryWaitTime", tsMaxRetryWaitTime, 0, 86400000, 0) != 0) return -1;
if (cfgAddBool(pCfg, "useAdapter", tsUseAdapter, true) != 0) return -1;
if (cfgAddBool(pCfg, "crashReporting", tsEnableCrashReport, true) != 0) return -1;
+ if (cfgAddInt64(pCfg, "queryMaxConcurrentTables", tsQueryMaxConcurrentTables, INT64_MIN, INT64_MAX, 1) != 0) return -1;
tsNumOfRpcThreads = tsNumOfCores / 2;
tsNumOfRpcThreads = TRANGE(tsNumOfRpcThreads, 2, TSDB_MAX_RPC_THREADS);
@@ -735,6 +741,7 @@ static int32_t taosSetClientCfg(SConfig *pCfg) {
tsKeepColumnName = cfgGetItem(pCfg, "keepColumnName")->bval;
tsUseAdapter = cfgGetItem(pCfg, "useAdapter")->bval;
tsEnableCrashReport = cfgGetItem(pCfg, "crashReporting")->bval;
+ tsQueryMaxConcurrentTables = cfgGetItem(pCfg, "queryMaxConcurrentTables")->i64;
tsMaxRetryWaitTime = cfgGetItem(pCfg, "maxRetryWaitTime")->i32;
diff --git a/source/common/src/tmsg.c b/source/common/src/tmsg.c
index ac3d4e6a10..d9802244b7 100644
--- a/source/common/src/tmsg.c
+++ b/source/common/src/tmsg.c
@@ -1368,6 +1368,12 @@ int32_t tSerializeSAlterUserReq(void *buf, int32_t bufLen, SAlterUserReq *pReq)
if (tEncodeCStr(&encoder, pReq->user) < 0) return -1;
if (tEncodeCStr(&encoder, pReq->pass) < 0) return -1;
if (tEncodeCStr(&encoder, pReq->objname) < 0) return -1;
+ int32_t len = strlen(pReq->tabName);
+ if (tEncodeI32(&encoder, len) < 0) return -1;
+ if (len > 0) {
+ if (tEncodeCStr(&encoder, pReq->tabName) < 0) return -1;
+ }
+ if (tEncodeBinary(&encoder, pReq->tagCond, pReq->tagCondLen) < 0) return -1;
tEndEncode(&encoder);
int32_t tlen = encoder.pos;
@@ -1387,6 +1393,16 @@ int32_t tDeserializeSAlterUserReq(void *buf, int32_t bufLen, SAlterUserReq *pReq
if (tDecodeCStrTo(&decoder, pReq->user) < 0) return -1;
if (tDecodeCStrTo(&decoder, pReq->pass) < 0) return -1;
if (tDecodeCStrTo(&decoder, pReq->objname) < 0) return -1;
+ if (!tDecodeIsEnd(&decoder)) {
+ int32_t len = 0;
+ if (tDecodeI32(&decoder, &len) < 0) return -1;
+ if (len > 0) {
+ if (tDecodeCStrTo(&decoder, pReq->tabName) < 0) return -1;
+ }
+ uint64_t tagCondLen = 0;
+ if (tDecodeBinaryAlloc(&decoder, (void **)&pReq->tagCond, &tagCondLen) < 0) return -1;
+ pReq->tagCondLen = tagCondLen;
+ }
tEndDecode(&decoder);
tDecoderClear(&decoder);
@@ -1429,6 +1445,7 @@ int32_t tSerializeSGetUserAuthRspImpl(SEncoder *pEncoder, SGetUserAuthRsp *pRsp)
int32_t numOfCreatedDbs = taosHashGetSize(pRsp->createdDbs);
int32_t numOfReadDbs = taosHashGetSize(pRsp->readDbs);
int32_t numOfWriteDbs = taosHashGetSize(pRsp->writeDbs);
+
if (tEncodeI32(pEncoder, numOfCreatedDbs) < 0) return -1;
if (tEncodeI32(pEncoder, numOfReadDbs) < 0) return -1;
if (tEncodeI32(pEncoder, numOfWriteDbs) < 0) return -1;
@@ -1451,6 +1468,54 @@ int32_t tSerializeSGetUserAuthRspImpl(SEncoder *pEncoder, SGetUserAuthRsp *pRsp)
db = taosHashIterate(pRsp->writeDbs, db);
}
+ int32_t numOfReadTbs = taosHashGetSize(pRsp->readTbs);
+ int32_t numOfWriteTbs = taosHashGetSize(pRsp->writeTbs);
+ int32_t numOfUseTbs = taosHashGetSize(pRsp->useDbs);
+ if (tEncodeI32(pEncoder, numOfReadTbs) < 0) return -1;
+ if (tEncodeI32(pEncoder, numOfWriteTbs) < 0) return -1;
+ if (tEncodeI32(pEncoder, numOfUseTbs) < 0) return -1;
+
+ char *tb = taosHashIterate(pRsp->readTbs, NULL);
+ while (tb != NULL) {
+ size_t keyLen = 0;
+ void *key = taosHashGetKey(tb, &keyLen);
+ if (tEncodeI32(pEncoder, keyLen) < 0) return -1;
+ if (tEncodeCStr(pEncoder, key) < 0) return -1;
+
+ size_t valueLen = 0;
+ valueLen = strlen(tb);
+ if (tEncodeI32(pEncoder, valueLen) < 0) return -1;
+ if (tEncodeCStr(pEncoder, tb) < 0) return -1;
+
+ tb = taosHashIterate(pRsp->readTbs, tb);
+ }
+
+ tb = taosHashIterate(pRsp->writeTbs, NULL);
+ while (tb != NULL) {
+ size_t keyLen = 0;
+ void *key = taosHashGetKey(tb, &keyLen);
+ if (tEncodeI32(pEncoder, keyLen) < 0) return -1;
+ if (tEncodeCStr(pEncoder, key) < 0) return -1;
+
+ size_t valueLen = 0;
+ valueLen = strlen(tb);
+ if (tEncodeI32(pEncoder, valueLen) < 0) return -1;
+ if (tEncodeCStr(pEncoder, tb) < 0) return -1;
+
+ tb = taosHashIterate(pRsp->writeTbs, tb);
+ }
+
+ int32_t *useDb = taosHashIterate(pRsp->useDbs, NULL);
+ while (useDb != NULL) {
+ size_t keyLen = 0;
+ void *key = taosHashGetKey(useDb, &keyLen);
+ if (tEncodeI32(pEncoder, keyLen) < 0) return -1;
+ if (tEncodeCStr(pEncoder, key) < 0) return -1;
+
+ if (tEncodeI32(pEncoder, *useDb) < 0) return -1;
+ useDb = taosHashIterate(pRsp->useDbs, useDb);
+ }
+
return 0;
}
@@ -1473,7 +1538,11 @@ int32_t tDeserializeSGetUserAuthRspImpl(SDecoder *pDecoder, SGetUserAuthRsp *pRs
pRsp->createdDbs = taosHashInit(4, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_ENTRY_LOCK);
pRsp->readDbs = taosHashInit(4, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_ENTRY_LOCK);
pRsp->writeDbs = taosHashInit(4, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_ENTRY_LOCK);
- if (pRsp->readDbs == NULL || pRsp->writeDbs == NULL) {
+ pRsp->readTbs = taosHashInit(4, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_ENTRY_LOCK);
+ pRsp->writeTbs = taosHashInit(4, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_ENTRY_LOCK);
+ pRsp->useDbs = taosHashInit(4, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_ENTRY_LOCK);
+ if (pRsp->createdDbs == NULL || pRsp->readDbs == NULL || pRsp->writeDbs == NULL || pRsp->readTbs == NULL ||
+ pRsp->writeTbs == NULL || pRsp->useDbs == NULL) {
return -1;
}
@@ -1512,6 +1581,63 @@ int32_t tDeserializeSGetUserAuthRspImpl(SDecoder *pDecoder, SGetUserAuthRsp *pRs
taosHashPut(pRsp->writeDbs, db, len, db, len);
}
+ if (!tDecodeIsEnd(pDecoder)) {
+ int32_t numOfReadTbs = 0;
+ int32_t numOfWriteTbs = 0;
+ int32_t numOfUseDbs = 0;
+ if (tDecodeI32(pDecoder, &numOfReadTbs) < 0) return -1;
+ if (tDecodeI32(pDecoder, &numOfWriteTbs) < 0) return -1;
+ if (tDecodeI32(pDecoder, &numOfUseDbs) < 0) return -1;
+
+ for (int32_t i = 0; i < numOfReadTbs; ++i) {
+ int32_t keyLen = 0;
+ if (tDecodeI32(pDecoder, &keyLen) < 0) return -1;
+
+ char *key = taosMemoryCalloc(keyLen + 1, sizeof(char));
+ if (tDecodeCStrTo(pDecoder, key) < 0) return -1;
+
+ int32_t valuelen = 0;
+ if (tDecodeI32(pDecoder, &valuelen) < 0) return -1;
+ char *value = taosMemoryCalloc(valuelen + 1, sizeof(char));
+ if (tDecodeCStrTo(pDecoder, value) < 0) return -1;
+
+ taosHashPut(pRsp->readTbs, key, strlen(key), value, valuelen + 1);
+
+ taosMemoryFree(key);
+ taosMemoryFree(value);
+ }
+
+ for (int32_t i = 0; i < numOfWriteTbs; ++i) {
+ int32_t keyLen = 0;
+ if (tDecodeI32(pDecoder, &keyLen) < 0) return -1;
+
+ char *key = taosMemoryCalloc(keyLen + 1, sizeof(char));
+ if (tDecodeCStrTo(pDecoder, key) < 0) return -1;
+
+ int32_t valuelen = 0;
+ if (tDecodeI32(pDecoder, &valuelen) < 0) return -1;
+ char *value = taosMemoryCalloc(valuelen + 1, sizeof(char));
+ if (tDecodeCStrTo(pDecoder, value) < 0) return -1;
+
+ taosHashPut(pRsp->writeTbs, key, strlen(key), value, valuelen + 1);
+
+ taosMemoryFree(key);
+ taosMemoryFree(value);
+ }
+
+ for (int32_t i = 0; i < numOfUseDbs; ++i) {
+ int32_t keyLen = 0;
+ if (tDecodeI32(pDecoder, &keyLen) < 0) return -1;
+
+ char *key = taosMemoryCalloc(keyLen + 1, sizeof(char));
+ if (tDecodeCStrTo(pDecoder, key) < 0) return -1;
+
+ int32_t ref = 0;
+ if (tDecodeI32(pDecoder, &ref) < 0) return -1;
+ taosHashPut(pRsp->useDbs, key, strlen(key), &ref, sizeof(ref));
+ }
+ }
+
return 0;
}
@@ -1533,6 +1659,9 @@ void tFreeSGetUserAuthRsp(SGetUserAuthRsp *pRsp) {
taosHashCleanup(pRsp->createdDbs);
taosHashCleanup(pRsp->readDbs);
taosHashCleanup(pRsp->writeDbs);
+ taosHashCleanup(pRsp->writeTbs);
+ taosHashCleanup(pRsp->readTbs);
+ taosHashCleanup(pRsp->useDbs);
}
int32_t tSerializeSCreateDropMQSNodeReq(void *buf, int32_t bufLen, SMCreateQnodeReq *pReq) {
@@ -7317,6 +7446,7 @@ void tDestroySSubmitReq2(SSubmitReq2 *pReq, int32_t flag) {
tDestroySSubmitTbData(&aSubmitTbData[i], flag);
}
taosArrayDestroy(pReq->aSubmitTbData);
+ pReq->aSubmitTbData = NULL;
}
int32_t tEncodeSSubmitRsp2(SEncoder *pCoder, const SSubmitRsp2 *pRsp) {
diff --git a/source/dnode/mgmt/mgmt_vnode/src/vmWorker.c b/source/dnode/mgmt/mgmt_vnode/src/vmWorker.c
index e4e0d608de..da08bd01ac 100644
--- a/source/dnode/mgmt/mgmt_vnode/src/vmWorker.c
+++ b/source/dnode/mgmt/mgmt_vnode/src/vmWorker.c
@@ -114,11 +114,11 @@ static void vmProcessFetchQueue(SQueueInfo *pInfo, STaosQall *qall, int32_t numO
int32_t code = vnodeProcessFetchMsg(pVnode->pImpl, pMsg, pInfo);
if (code != 0) {
if (terrno != 0) code = terrno;
- dGError("vgId:%d, msg:%p failed to fetch since %s", pVnode->vgId, pMsg, terrstr(code));
+ dGError("vnodeProcessFetchMsg vgId:%d, msg:%p failed to fetch since %s", pVnode->vgId, pMsg, terrstr());
vmSendRsp(pMsg, code);
}
- dGTrace("vgId:%d, msg:%p is freed, code:0x%x", pVnode->vgId, pMsg, code);
+ dGTrace("vnodeProcessFetchMsg vgId:%d, msg:%p is freed, code:0x%x", pVnode->vgId, pMsg, code);
rpcFreeCont(pMsg->pCont);
taosFreeQitem(pMsg);
}
@@ -163,8 +163,8 @@ static int32_t vmPutMsgToQueue(SVnodeMgmt *pMgmt, SRpcMsg *pMsg, EQueueType qtyp
SVnodeObj *pVnode = vmAcquireVnode(pMgmt, pHead->vgId);
if (pVnode == NULL) {
- dGError("vgId:%d, msg:%p failed to put into vnode queue since %s, type:%s qtype:%d contLen:%d", pHead->vgId, pMsg,
- terrstr(), TMSG_INFO(pMsg->msgType), qtype, pHead->contLen);
+ dGWarn("vgId:%d, msg:%p failed to put into vnode queue since %s, type:%s qtype:%d contLen:%d", pHead->vgId, pMsg,
+ terrstr(), TMSG_INFO(pMsg->msgType), qtype, pHead->contLen);
terrno = (terrno != 0) ? terrno : -1;
return terrno;
}
diff --git a/source/dnode/mnode/impl/inc/mndConsumer.h b/source/dnode/mnode/impl/inc/mndConsumer.h
index 99b0d06936..aa38b94fd7 100644
--- a/source/dnode/mnode/impl/inc/mndConsumer.h
+++ b/source/dnode/mnode/impl/inc/mndConsumer.h
@@ -24,10 +24,10 @@ extern "C" {
enum {
MQ_CONSUMER_STATUS__MODIFY = 1,
- MQ_CONSUMER_STATUS__MODIFY_IN_REB, // this value is not used anymore
+// MQ_CONSUMER_STATUS__MODIFY_IN_REB, // this value is not used anymore
MQ_CONSUMER_STATUS__READY,
MQ_CONSUMER_STATUS__LOST,
- MQ_CONSUMER_STATUS__LOST_IN_REB, // this value is not used anymore
+// MQ_CONSUMER_STATUS__LOST_IN_REB, // this value is not used anymore
MQ_CONSUMER_STATUS__LOST_REBD,
MQ_CONSUMER_STATUS__REMOVED,
};
diff --git a/source/dnode/mnode/impl/inc/mndDef.h b/source/dnode/mnode/impl/inc/mndDef.h
index 710c2c52b2..3a4f06f6fa 100644
--- a/source/dnode/mnode/impl/inc/mndDef.h
+++ b/source/dnode/mnode/impl/inc/mndDef.h
@@ -281,6 +281,9 @@ typedef struct {
SHashObj* readDbs;
SHashObj* writeDbs;
SHashObj* topics;
+ SHashObj* readTbs;
+ SHashObj* writeTbs;
+ SHashObj* useDbs;
SRWLatch lock;
} SUserObj;
diff --git a/source/dnode/mnode/impl/inc/mndStb.h b/source/dnode/mnode/impl/inc/mndStb.h
index ac0924aab9..66d0ed1d12 100644
--- a/source/dnode/mnode/impl/inc/mndStb.h
+++ b/source/dnode/mnode/impl/inc/mndStb.h
@@ -38,6 +38,7 @@ void mndFreeStb(SStbObj *pStb);
int32_t mndBuildSMCreateStbRsp(SMnode *pMnode, char *dbFName, char *stbFName, void **pCont, int32_t *pLen);
void mndExtractDbNameFromStbFullName(const char *stbFullName, char *dst);
+void mndExtractShortDbNameFromStbFullName(const char *stbFullName, char *dst);
void mndExtractTbNameFromStbFullName(const char *stbFullName, char *dst, int32_t dstSize);
const char *mndGetStbStr(const char *src);
diff --git a/source/dnode/mnode/impl/inc/mndUser.h b/source/dnode/mnode/impl/inc/mndUser.h
index 8943ba703e..95d15f6e5a 100644
--- a/source/dnode/mnode/impl/inc/mndUser.h
+++ b/source/dnode/mnode/impl/inc/mndUser.h
@@ -31,6 +31,7 @@ void mndReleaseUser(SMnode *pMnode, SUserObj *pUser);
// for trans test
SSdbRaw *mndUserActionEncode(SUserObj *pUser);
SHashObj *mndDupDbHash(SHashObj *pOld);
+SHashObj *mndDupTableHash(SHashObj *pOld);
SHashObj *mndDupTopicHash(SHashObj *pOld);
int32_t mndValidateUserAuthInfo(SMnode *pMnode, SUserAuthVersion *pUsers, int32_t numOfUses, void **ppRsp,
int32_t *pRspLen);
diff --git a/source/dnode/mnode/impl/src/mndCluster.c b/source/dnode/mnode/impl/src/mndCluster.c
index 94584dfe58..4d05637a2b 100644
--- a/source/dnode/mnode/impl/src/mndCluster.c
+++ b/source/dnode/mnode/impl/src/mndCluster.c
@@ -67,7 +67,7 @@ int32_t mndGetClusterName(SMnode *pMnode, char *clusterName, int32_t len) {
return 0;
}
-static SClusterObj *mndAcquireCluster(SMnode *pMnode) {
+static SClusterObj *mndAcquireCluster(SMnode *pMnode, void **ppIter) {
SSdb *pSdb = pMnode->pSdb;
void *pIter = NULL;
@@ -76,23 +76,27 @@ static SClusterObj *mndAcquireCluster(SMnode *pMnode) {
pIter = sdbFetch(pSdb, SDB_CLUSTER, pIter, (void **)&pCluster);
if (pIter == NULL) break;
+ *ppIter = pIter;
+
return pCluster;
}
return NULL;
}
-static void mndReleaseCluster(SMnode *pMnode, SClusterObj *pCluster) {
+static void mndReleaseCluster(SMnode *pMnode, SClusterObj *pCluster, void *pIter) {
SSdb *pSdb = pMnode->pSdb;
+ sdbCancelFetch(pSdb, pIter);
sdbRelease(pSdb, pCluster);
}
int64_t mndGetClusterId(SMnode *pMnode) {
int64_t clusterId = 0;
- SClusterObj *pCluster = mndAcquireCluster(pMnode);
+ void *pIter = NULL;
+ SClusterObj *pCluster = mndAcquireCluster(pMnode, &pIter);
if (pCluster != NULL) {
clusterId = pCluster->id;
- mndReleaseCluster(pMnode, pCluster);
+ mndReleaseCluster(pMnode, pCluster, pIter);
}
return clusterId;
@@ -100,10 +104,11 @@ int64_t mndGetClusterId(SMnode *pMnode) {
int64_t mndGetClusterCreateTime(SMnode *pMnode) {
int64_t createTime = 0;
- SClusterObj *pCluster = mndAcquireCluster(pMnode);
+ void *pIter = NULL;
+ SClusterObj *pCluster = mndAcquireCluster(pMnode, &pIter);
if (pCluster != NULL) {
createTime = pCluster->createdTime;
- mndReleaseCluster(pMnode, pCluster);
+ mndReleaseCluster(pMnode, pCluster, pIter);
}
return createTime;
@@ -121,10 +126,11 @@ static int32_t mndGetClusterUpTimeImp(SClusterObj *pCluster) {
float mndGetClusterUpTime(SMnode *pMnode) {
int64_t upTime = 0;
- SClusterObj *pCluster = mndAcquireCluster(pMnode);
+ void *pIter = NULL;
+ SClusterObj *pCluster = mndAcquireCluster(pMnode, &pIter);
if (pCluster != NULL) {
upTime = mndGetClusterUpTimeImp(pCluster);
- mndReleaseCluster(pMnode, pCluster);
+ mndReleaseCluster(pMnode, pCluster, pIter);
}
return upTime / 86400.0f;
@@ -321,11 +327,12 @@ static void mndCancelGetNextCluster(SMnode *pMnode, void *pIter) {
static int32_t mndProcessUptimeTimer(SRpcMsg *pReq) {
SMnode *pMnode = pReq->info.node;
SClusterObj clusterObj = {0};
- SClusterObj *pCluster = mndAcquireCluster(pMnode);
+ void *pIter = NULL;
+ SClusterObj *pCluster = mndAcquireCluster(pMnode, &pIter);
if (pCluster != NULL) {
memcpy(&clusterObj, pCluster, sizeof(SClusterObj));
clusterObj.upTime += tsUptimeInterval;
- mndReleaseCluster(pMnode, pCluster);
+ mndReleaseCluster(pMnode, pCluster, pIter);
}
if (clusterObj.id <= 0) {
diff --git a/source/dnode/mnode/impl/src/mndConsumer.c b/source/dnode/mnode/impl/src/mndConsumer.c
index 8f1cfbff93..1b146506a2 100644
--- a/source/dnode/mnode/impl/src/mndConsumer.c
+++ b/source/dnode/mnode/impl/src/mndConsumer.c
@@ -335,7 +335,7 @@ static int32_t mndProcessMqTimerMsg(SRpcMsg *pMsg) {
taosArrayPush(pRebSub->removedConsumers, &pConsumer->consumerId);
}
taosRUnLockLatch(&pConsumer->lock);
- } else if (status == MQ_CONSUMER_STATUS__MODIFY || status == MQ_CONSUMER_STATUS__MODIFY_IN_REB) {
+ } else if (status == MQ_CONSUMER_STATUS__MODIFY) {
taosRLockLatch(&pConsumer->lock);
int32_t newTopicNum = taosArrayGetSize(pConsumer->rebNewTopics);
@@ -873,17 +873,11 @@ static void updateConsumerStatus(SMqConsumerObj *pConsumer) {
int32_t status = pConsumer->status;
if (taosArrayGetSize(pConsumer->rebNewTopics) == 0 && taosArrayGetSize(pConsumer->rebRemovedTopics) == 0) {
- if (status == MQ_CONSUMER_STATUS__MODIFY || status == MQ_CONSUMER_STATUS__MODIFY_IN_REB) {
+ if (status == MQ_CONSUMER_STATUS__MODIFY) {
pConsumer->status = MQ_CONSUMER_STATUS__READY;
- } else if (status == MQ_CONSUMER_STATUS__LOST_IN_REB || status == MQ_CONSUMER_STATUS__LOST) {
+ } else if (status == MQ_CONSUMER_STATUS__LOST) {
pConsumer->status = MQ_CONSUMER_STATUS__LOST_REBD;
}
- } else {
- if (status == MQ_CONSUMER_STATUS__MODIFY || status == MQ_CONSUMER_STATUS__MODIFY_IN_REB) {
- pConsumer->status = MQ_CONSUMER_STATUS__MODIFY;
- } else if (status == MQ_CONSUMER_STATUS__LOST || status == MQ_CONSUMER_STATUS__LOST_IN_REB) {
- pConsumer->status = MQ_CONSUMER_STATUS__LOST;
- }
}
}
@@ -1192,10 +1186,8 @@ static const char *mndConsumerStatusName(int status) {
return "ready";
case MQ_CONSUMER_STATUS__LOST:
case MQ_CONSUMER_STATUS__LOST_REBD:
- case MQ_CONSUMER_STATUS__LOST_IN_REB:
return "lost";
case MQ_CONSUMER_STATUS__MODIFY:
- case MQ_CONSUMER_STATUS__MODIFY_IN_REB:
return "rebalancing";
default:
return "unknown";
diff --git a/source/dnode/mnode/impl/src/mndDef.c b/source/dnode/mnode/impl/src/mndDef.c
index fb81a764f1..c69f08eb6b 100644
--- a/source/dnode/mnode/impl/src/mndDef.c
+++ b/source/dnode/mnode/impl/src/mndDef.c
@@ -70,7 +70,7 @@ int32_t tEncodeSStreamObj(SEncoder *pEncoder, const SStreamObj *pObj) {
if (tEncodeI32(pEncoder, innerSz) < 0) return -1;
for (int32_t j = 0; j < innerSz; j++) {
SStreamTask *pTask = taosArrayGetP(pArray, j);
- if (tEncodeSStreamTask(pEncoder, pTask) < 0) return -1;
+ if (tEncodeStreamTask(pEncoder, pTask) < 0) return -1;
}
}
@@ -130,7 +130,7 @@ int32_t tDecodeSStreamObj(SDecoder *pDecoder, SStreamObj *pObj, int32_t sver) {
taosArrayDestroy(pArray);
return -1;
}
- if (tDecodeSStreamTask(pDecoder, pTask) < 0) {
+ if (tDecodeStreamTask(pDecoder, pTask) < 0) {
taosMemoryFree(pTask);
taosArrayDestroy(pArray);
return -1;
@@ -158,7 +158,10 @@ void tFreeStreamObj(SStreamObj *pStream) {
taosMemoryFree(pStream->sql);
taosMemoryFree(pStream->ast);
taosMemoryFree(pStream->physicalPlan);
- if (pStream->outputSchema.nCols) taosMemoryFree(pStream->outputSchema.pSchema);
+
+ if (pStream->outputSchema.nCols) {
+ taosMemoryFree(pStream->outputSchema.pSchema);
+ }
int32_t sz = taosArrayGetSize(pStream->tasks);
for (int32_t i = 0; i < sz; i++) {
@@ -166,11 +169,14 @@ void tFreeStreamObj(SStreamObj *pStream) {
int32_t taskSz = taosArrayGetSize(pLevel);
for (int32_t j = 0; j < taskSz; j++) {
SStreamTask *pTask = taosArrayGetP(pLevel, j);
- tFreeSStreamTask(pTask);
+ tFreeStreamTask(pTask);
}
+
taosArrayDestroy(pLevel);
}
+
taosArrayDestroy(pStream->tasks);
+
// tagSchema.pSchema
if (pStream->tagSchema.nCols > 0) {
taosMemoryFree(pStream->tagSchema.pSchema);
diff --git a/source/dnode/mnode/impl/src/mndPrivilege.c b/source/dnode/mnode/impl/src/mndPrivilege.c
index ccb4140b83..de0374c6e8 100644
--- a/source/dnode/mnode/impl/src/mndPrivilege.c
+++ b/source/dnode/mnode/impl/src/mndPrivilege.c
@@ -35,6 +35,7 @@ int32_t mndCheckTopicPrivilegeByName(SMnode *pMnode, const char *user, EOperType
int32_t mndSetUserAuthRsp(SMnode *pMnode, SUserObj *pUser, SGetUserAuthRsp *pRsp) {
memcpy(pRsp->user, pUser->user, TSDB_USER_LEN);
pRsp->superAuth = 1;
+ pRsp->enable = pUser->enable;
pRsp->version = pUser->authVersion;
return 0;
}
diff --git a/source/dnode/mnode/impl/src/mndScheduler.c b/source/dnode/mnode/impl/src/mndScheduler.c
index d1671aa12a..36521fd778 100644
--- a/source/dnode/mnode/impl/src/mndScheduler.c
+++ b/source/dnode/mnode/impl/src/mndScheduler.c
@@ -138,7 +138,7 @@ int32_t mndAddDispatcherToInnerTask(SMnode* pMnode, SStreamObj* pStream, SStream
for (int32_t j = 0; j < sinkLvSize; j++) {
SStreamTask* pLastLevelTask = taosArrayGetP(sinkLv, j);
if (pLastLevelTask->nodeId == pVgInfo->vgId) {
- pVgInfo->taskId = pLastLevelTask->taskId;
+ pVgInfo->taskId = pLastLevelTask->id.taskId;
break;
}
}
@@ -149,7 +149,7 @@ int32_t mndAddDispatcherToInnerTask(SMnode* pMnode, SStreamObj* pStream, SStream
SArray* pArray = taosArrayGetP(pStream->tasks, 0);
// one sink only
SStreamTask* lastLevelTask = taosArrayGetP(pArray, 0);
- pTask->fixedEpDispatcher.taskId = lastLevelTask->taskId;
+ pTask->fixedEpDispatcher.taskId = lastLevelTask->id.taskId;
pTask->fixedEpDispatcher.nodeId = lastLevelTask->nodeId;
pTask->fixedEpDispatcher.epSet = lastLevelTask->epSet;
}
@@ -224,7 +224,7 @@ int32_t mndAddShuffleSinkTasksToStream(SMnode* pMnode, SStreamObj* pStream) {
continue;
}
- SStreamTask* pTask = tNewSStreamTask(pStream->uid);
+ SStreamTask* pTask = tNewStreamTask(pStream->uid);
if (pTask == NULL) {
sdbRelease(pSdb, pVgroup);
terrno = TSDB_CODE_OUT_OF_MEMORY;
@@ -260,7 +260,7 @@ int32_t mndAddShuffleSinkTasksToStream(SMnode* pMnode, SStreamObj* pStream) {
int32_t mndAddFixedSinkTaskToStream(SMnode* pMnode, SStreamObj* pStream) {
SArray* tasks = taosArrayGetP(pStream->tasks, 0);
- SStreamTask* pTask = tNewSStreamTask(pStream->uid);
+ SStreamTask* pTask = tNewStreamTask(pStream->uid);
if (pTask == NULL) {
terrno = TSDB_CODE_OUT_OF_MEMORY;
return -1;
@@ -350,7 +350,7 @@ int32_t mndScheduleStream(SMnode* pMnode, SStreamObj* pStream) {
return -1;
}
- pInnerTask = tNewSStreamTask(pStream->uid);
+ pInnerTask = tNewStreamTask(pStream->uid);
if (pInnerTask == NULL) {
terrno = TSDB_CODE_OUT_OF_MEMORY;
qDestroyQueryPlan(pPlan);
@@ -421,7 +421,7 @@ int32_t mndScheduleStream(SMnode* pMnode, SStreamObj* pStream) {
continue;
}
- SStreamTask* pTask = tNewSStreamTask(pStream->uid);
+ SStreamTask* pTask = tNewStreamTask(pStream->uid);
if (pTask == NULL) {
terrno = TSDB_CODE_OUT_OF_MEMORY;
sdbRelease(pSdb, pVgroup);
@@ -440,7 +440,7 @@ int32_t mndScheduleStream(SMnode* pMnode, SStreamObj* pStream) {
pTask->dispatchMsgType = TDMT_STREAM_TASK_DISPATCH;
pTask->outputType = TASK_OUTPUT__FIXED_DISPATCH;
- pTask->fixedEpDispatcher.taskId = pInnerTask->taskId;
+ pTask->fixedEpDispatcher.taskId = pInnerTask->id.taskId;
pTask->fixedEpDispatcher.nodeId = pInnerTask->nodeId;
pTask->fixedEpDispatcher.epSet = pInnerTask->epSet;
@@ -460,7 +460,7 @@ int32_t mndScheduleStream(SMnode* pMnode, SStreamObj* pStream) {
pEpInfo->childId = pTask->selfChildId;
pEpInfo->epSet = pTask->epSet;
pEpInfo->nodeId = pTask->nodeId;
- pEpInfo->taskId = pTask->taskId;
+ pEpInfo->taskId = pTask->id.taskId;
taosArrayPush(pInnerTask->childEpInfo, &pEpInfo);
sdbRelease(pSdb, pVgroup);
}
@@ -491,7 +491,7 @@ int32_t mndScheduleStream(SMnode* pMnode, SStreamObj* pStream) {
continue;
}
- SStreamTask* pTask = tNewSStreamTask(pStream->uid);
+ SStreamTask* pTask = tNewStreamTask(pStream->uid);
if (pTask == NULL) {
sdbRelease(pSdb, pVgroup);
qDestroyQueryPlan(pPlan);
diff --git a/source/dnode/mnode/impl/src/mndStb.c b/source/dnode/mnode/impl/src/mndStb.c
index b3da66a035..63bcef2a5b 100644
--- a/source/dnode/mnode/impl/src/mndStb.c
+++ b/source/dnode/mnode/impl/src/mndStb.c
@@ -2614,6 +2614,13 @@ void mndExtractDbNameFromStbFullName(const char *stbFullName, char *dst) {
tNameGetFullDbName(&name, dst);
}
+void mndExtractShortDbNameFromStbFullName(const char *stbFullName, char *dst) {
+ SName name = {0};
+ tNameFromString(&name, stbFullName, T_NAME_ACCT | T_NAME_DB | T_NAME_TABLE);
+
+ tNameGetDbName(&name, dst);
+}
+
void mndExtractTbNameFromStbFullName(const char *stbFullName, char *dst, int32_t dstSize) {
int32_t pos = -1;
int32_t num = 0;
diff --git a/source/dnode/mnode/impl/src/mndStream.c b/source/dnode/mnode/impl/src/mndStream.c
index ff759f5e78..76bb144fcb 100644
--- a/source/dnode/mnode/impl/src/mndStream.c
+++ b/source/dnode/mnode/impl/src/mndStream.c
@@ -35,12 +35,12 @@
static int32_t mndStreamActionInsert(SSdb *pSdb, SStreamObj *pStream);
static int32_t mndStreamActionDelete(SSdb *pSdb, SStreamObj *pStream);
-static int32_t mndStreamActionUpdate(SSdb *pSdb, SStreamObj *pStream, SStreamObj *pNewStream);
+static int32_t mndStreamActionUpdate(SSdb *pSdb, SStreamObj *pOldStream, SStreamObj *pNewStream);
static int32_t mndProcessCreateStreamReq(SRpcMsg *pReq);
static int32_t mndProcessDropStreamReq(SRpcMsg *pReq);
static int32_t mndProcessStreamCheckpointTmr(SRpcMsg *pReq);
-// static int32_t mndProcessStreamDoCheckpoint(SRpcMsg *pReq);
-/*static int32_t mndProcessRecoverStreamReq(SRpcMsg *pReq);*/
+static int32_t mndProcessStreamDoCheckpoint(SRpcMsg *pReq);
+static int32_t mndProcessRecoverStreamReq(SRpcMsg *pReq);
static int32_t mndProcessStreamMetaReq(SRpcMsg *pReq);
static int32_t mndGetStreamMeta(SRpcMsg *pReq, SShowObj *pShow, STableMetaRsp *pMeta);
static int32_t mndRetrieveStream(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock, int32_t rows);
@@ -418,7 +418,7 @@ FAIL:
int32_t mndPersistTaskDeployReq(STrans *pTrans, const SStreamTask *pTask) {
SEncoder encoder;
tEncoderInit(&encoder, NULL, 0);
- tEncodeSStreamTask(&encoder, pTask);
+ tEncodeStreamTask(&encoder, pTask);
int32_t size = encoder.pos;
int32_t tlen = sizeof(SMsgHead) + size;
tEncoderClear(&encoder);
@@ -430,7 +430,7 @@ int32_t mndPersistTaskDeployReq(STrans *pTrans, const SStreamTask *pTask) {
((SMsgHead *)buf)->vgId = htonl(pTask->nodeId);
void *abuf = POINTER_SHIFT(buf, sizeof(SMsgHead));
tEncoderInit(&encoder, abuf, size);
- tEncodeSStreamTask(&encoder, pTask);
+ tEncodeStreamTask(&encoder, pTask);
tEncoderClear(&encoder);
STransAction action = {0};
@@ -601,7 +601,7 @@ static int32_t mndPersistTaskDropReq(STrans *pTrans, SStreamTask *pTask) {
return -1;
}
pReq->head.vgId = htonl(pTask->nodeId);
- pReq->taskId = pTask->taskId;
+ pReq->taskId = pTask->id.taskId;
STransAction action = {0};
memcpy(&action.epSet, &pTask->epSet, sizeof(SEpSet));
action.pCont = pReq;
@@ -1209,7 +1209,7 @@ static int32_t mndRetrieveStreamTask(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock
// task id
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
- colDataSetVal(pColInfo, numOfRows, (const char *)&pTask->taskId, false);
+ colDataSetVal(pColInfo, numOfRows, (const char *)&pTask->id.taskId, false);
// node type
char nodeType[20 + VARSTR_HEADER_SIZE] = {0};
diff --git a/source/dnode/mnode/impl/src/mndUser.c b/source/dnode/mnode/impl/src/mndUser.c
index 92b73aed96..d08227927a 100644
--- a/source/dnode/mnode/impl/src/mndUser.c
+++ b/source/dnode/mnode/impl/src/mndUser.c
@@ -18,11 +18,12 @@
#include "mndDb.h"
#include "mndPrivilege.h"
#include "mndShow.h"
+#include "mndStb.h"
#include "mndTopic.h"
#include "mndTrans.h"
#include "tbase64.h"
-#define USER_VER_NUMBER 2
+#define USER_VER_NUMBER 3
#define USER_RESERVE_SIZE 64
static int32_t mndCreateDefaultUsers(SMnode *pMnode);
@@ -124,9 +125,40 @@ SSdbRaw *mndUserActionEncode(SUserObj *pUser) {
int32_t numOfReadDbs = taosHashGetSize(pUser->readDbs);
int32_t numOfWriteDbs = taosHashGetSize(pUser->writeDbs);
+ int32_t numOfReadStbs = taosHashGetSize(pUser->readTbs);
+ int32_t numOfWriteStbs = taosHashGetSize(pUser->writeTbs);
int32_t numOfTopics = taosHashGetSize(pUser->topics);
- int32_t size = sizeof(SUserObj) + USER_RESERVE_SIZE + (numOfReadDbs + numOfWriteDbs) * TSDB_DB_FNAME_LEN +
- numOfTopics * TSDB_TOPIC_FNAME_LEN;
+ int32_t numOfUseDbs = taosHashGetSize(pUser->useDbs);
+ int32_t size = sizeof(SUserObj) + USER_RESERVE_SIZE +
+ (numOfReadDbs + numOfWriteDbs + numOfUseDbs) * TSDB_DB_FNAME_LEN + numOfTopics * TSDB_TOPIC_FNAME_LEN;
+
+ char *stb = taosHashIterate(pUser->readTbs, NULL);
+ while (stb != NULL) {
+ size_t keyLen = 0;
+ void *key = taosHashGetKey(stb, &keyLen);
+ size += sizeof(int32_t);
+ size += keyLen;
+
+ size_t valueLen = 0;
+ valueLen = strlen(stb);
+ size += sizeof(int32_t);
+ size += valueLen;
+ stb = taosHashIterate(pUser->readTbs, stb);
+ }
+
+ stb = taosHashIterate(pUser->writeTbs, NULL);
+ while (stb != NULL) {
+ size_t keyLen = 0;
+ void *key = taosHashGetKey(stb, &keyLen);
+ size += sizeof(int32_t);
+ size += keyLen;
+
+ size_t valueLen = 0;
+ valueLen = strlen(stb);
+ size += sizeof(int32_t);
+ size += valueLen;
+ stb = taosHashIterate(pUser->writeTbs, stb);
+ }
SSdbRaw *pRaw = sdbAllocRaw(SDB_USER, USER_VER_NUMBER, size);
if (pRaw == NULL) goto _OVER;
@@ -164,6 +196,49 @@ SSdbRaw *mndUserActionEncode(SUserObj *pUser) {
topic = taosHashIterate(pUser->topics, topic);
}
+ SDB_SET_INT32(pRaw, dataPos, numOfReadStbs, _OVER)
+ SDB_SET_INT32(pRaw, dataPos, numOfWriteStbs, _OVER)
+ SDB_SET_INT32(pRaw, dataPos, numOfUseDbs, _OVER)
+
+ stb = taosHashIterate(pUser->readTbs, NULL);
+ while (stb != NULL) {
+ size_t keyLen = 0;
+ void *key = taosHashGetKey(stb, &keyLen);
+ SDB_SET_INT32(pRaw, dataPos, keyLen, _OVER)
+ SDB_SET_BINARY(pRaw, dataPos, key, keyLen, _OVER);
+
+ size_t valueLen = 0;
+ valueLen = strlen(stb) + 1;
+ SDB_SET_INT32(pRaw, dataPos, valueLen, _OVER)
+ SDB_SET_BINARY(pRaw, dataPos, stb, valueLen, _OVER);
+ stb = taosHashIterate(pUser->readTbs, stb);
+ }
+
+ stb = taosHashIterate(pUser->writeTbs, NULL);
+ while (stb != NULL) {
+ size_t keyLen = 0;
+ void *key = taosHashGetKey(stb, &keyLen);
+ SDB_SET_INT32(pRaw, dataPos, keyLen, _OVER)
+ SDB_SET_BINARY(pRaw, dataPos, key, keyLen, _OVER);
+
+ size_t valueLen = 0;
+ valueLen = strlen(stb) + 1;
+ SDB_SET_INT32(pRaw, dataPos, valueLen, _OVER)
+ SDB_SET_BINARY(pRaw, dataPos, stb, valueLen, _OVER);
+ stb = taosHashIterate(pUser->writeTbs, stb);
+ }
+
+ int32_t *useDb = taosHashIterate(pUser->useDbs, NULL);
+ while (useDb != NULL) {
+ size_t keyLen = 0;
+ void *key = taosHashGetKey(useDb, &keyLen);
+ SDB_SET_INT32(pRaw, dataPos, keyLen, _OVER)
+ SDB_SET_BINARY(pRaw, dataPos, key, keyLen, _OVER);
+
+ SDB_SET_INT32(pRaw, dataPos, *useDb, _OVER)
+ useDb = taosHashIterate(pUser->writeTbs, useDb);
+ }
+
SDB_SET_RESERVE(pRaw, dataPos, USER_RESERVE_SIZE, _OVER)
SDB_SET_DATALEN(pRaw, dataPos, _OVER)
@@ -188,7 +263,7 @@ static SSdbRow *mndUserActionDecode(SSdbRaw *pRaw) {
int8_t sver = 0;
if (sdbGetRawSoftVer(pRaw, &sver) != 0) goto _OVER;
- if (sver != 1 && sver != 2) {
+ if (sver != 1 && sver != 2 && sver != 3) {
terrno = TSDB_CODE_SDB_INVALID_DATA_VER;
goto _OVER;
}
@@ -249,6 +324,75 @@ static SSdbRow *mndUserActionDecode(SSdbRaw *pRaw) {
}
}
+ if (sver >= 3) {
+ int32_t numOfReadStbs = 0;
+ int32_t numOfWriteStbs = 0;
+ int32_t numOfUseDbs = 0;
+ SDB_GET_INT32(pRaw, dataPos, &numOfReadStbs, _OVER)
+ SDB_GET_INT32(pRaw, dataPos, &numOfWriteStbs, _OVER)
+ SDB_GET_INT32(pRaw, dataPos, &numOfUseDbs, _OVER)
+
+ pUser->readTbs =
+ taosHashInit(numOfReadStbs, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_ENTRY_LOCK);
+ pUser->writeTbs =
+ taosHashInit(numOfWriteStbs, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_ENTRY_LOCK);
+ pUser->useDbs = taosHashInit(numOfUseDbs, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_ENTRY_LOCK);
+
+ for (int32_t i = 0; i < numOfReadStbs; ++i) {
+ int32_t keyLen = 0;
+ SDB_GET_INT32(pRaw, dataPos, &keyLen, _OVER);
+
+ char *key = taosMemoryCalloc(keyLen, sizeof(char));
+ memset(key, 0, keyLen);
+ SDB_GET_BINARY(pRaw, dataPos, key, keyLen, _OVER);
+
+ int32_t valuelen = 0;
+ SDB_GET_INT32(pRaw, dataPos, &valuelen, _OVER);
+ char *value = taosMemoryCalloc(valuelen, sizeof(char));
+ memset(value, 0, valuelen);
+ SDB_GET_BINARY(pRaw, dataPos, value, valuelen, _OVER)
+
+ taosHashPut(pUser->readTbs, key, keyLen, value, valuelen);
+
+ taosMemoryFree(key);
+ taosMemoryFree(value);
+ }
+
+ for (int32_t i = 0; i < numOfWriteStbs; ++i) {
+ int32_t keyLen = 0;
+ SDB_GET_INT32(pRaw, dataPos, &keyLen, _OVER);
+
+ char *key = taosMemoryCalloc(keyLen, sizeof(char));
+ memset(key, 0, keyLen);
+ SDB_GET_BINARY(pRaw, dataPos, key, keyLen, _OVER);
+
+ int32_t valuelen = 0;
+ SDB_GET_INT32(pRaw, dataPos, &valuelen, _OVER);
+ char *value = taosMemoryCalloc(valuelen, sizeof(char));
+ memset(value, 0, valuelen);
+ SDB_GET_BINARY(pRaw, dataPos, value, valuelen, _OVER)
+
+ taosHashPut(pUser->writeTbs, key, keyLen, value, valuelen);
+
+ taosMemoryFree(key);
+ taosMemoryFree(value);
+ }
+
+ for (int32_t i = 0; i < numOfUseDbs; ++i) {
+ int32_t keyLen = 0;
+ SDB_GET_INT32(pRaw, dataPos, &keyLen, _OVER);
+
+ char *key = taosMemoryCalloc(keyLen, sizeof(char));
+ memset(key, 0, keyLen);
+ SDB_GET_BINARY(pRaw, dataPos, key, keyLen, _OVER);
+
+ int32_t ref = 0;
+ SDB_GET_INT32(pRaw, dataPos, &ref, _OVER);
+
+ taosHashPut(pUser->useDbs, key, keyLen, &ref, sizeof(ref));
+ }
+ }
+
SDB_GET_RESERVE(pRaw, dataPos, USER_RESERVE_SIZE, _OVER)
taosInitRWLatch(&pUser->lock);
@@ -261,6 +405,9 @@ _OVER:
taosHashCleanup(pUser->readDbs);
taosHashCleanup(pUser->writeDbs);
taosHashCleanup(pUser->topics);
+ taosHashCleanup(pUser->readTbs);
+ taosHashCleanup(pUser->writeTbs);
+ taosHashCleanup(pUser->useDbs);
}
taosMemoryFreeClear(pRow);
return NULL;
@@ -285,6 +432,57 @@ static int32_t mndUserActionInsert(SSdb *pSdb, SUserObj *pUser) {
return 0;
}
+SHashObj *mndDupTableHash(SHashObj *pOld) {
+ SHashObj *pNew =
+ taosHashInit(taosHashGetSize(pOld), taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_ENTRY_LOCK);
+ if (pNew == NULL) {
+ terrno = TSDB_CODE_OUT_OF_MEMORY;
+ return NULL;
+ }
+
+ char *tb = taosHashIterate(pOld, NULL);
+ while (tb != NULL) {
+ size_t keyLen = 0;
+ char *key = taosHashGetKey(tb, &keyLen);
+
+ int32_t valueLen = strlen(tb) + 1;
+ if (taosHashPut(pNew, key, keyLen, tb, valueLen) != 0) {
+ taosHashCancelIterate(pOld, tb);
+ taosHashCleanup(pNew);
+ terrno = TSDB_CODE_OUT_OF_MEMORY;
+ return NULL;
+ }
+ tb = taosHashIterate(pOld, tb);
+ }
+
+ return pNew;
+}
+
+SHashObj *mndDupUseDbHash(SHashObj *pOld) {
+ SHashObj *pNew =
+ taosHashInit(taosHashGetSize(pOld), taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_ENTRY_LOCK);
+ if (pNew == NULL) {
+ terrno = TSDB_CODE_OUT_OF_MEMORY;
+ return NULL;
+ }
+
+ int32_t *db = taosHashIterate(pOld, NULL);
+ while (db != NULL) {
+ size_t keyLen = 0;
+ char *key = taosHashGetKey(db, &keyLen);
+
+ if (taosHashPut(pNew, key, keyLen, db, sizeof(*db)) != 0) {
+ taosHashCancelIterate(pOld, db);
+ taosHashCleanup(pNew);
+ terrno = TSDB_CODE_OUT_OF_MEMORY;
+ return NULL;
+ }
+ db = taosHashIterate(pOld, db);
+ }
+
+ return pNew;
+}
+
static int32_t mndUserDupObj(SUserObj *pUser, SUserObj *pNew) {
memcpy(pNew, pUser, sizeof(SUserObj));
pNew->authVersion++;
@@ -293,7 +491,10 @@ static int32_t mndUserDupObj(SUserObj *pUser, SUserObj *pNew) {
taosRLockLatch(&pUser->lock);
pNew->readDbs = mndDupDbHash(pUser->readDbs);
pNew->writeDbs = mndDupDbHash(pUser->writeDbs);
+ pNew->readTbs = mndDupTableHash(pUser->readTbs);
+ pNew->writeTbs = mndDupTableHash(pUser->writeTbs);
pNew->topics = mndDupTopicHash(pUser->topics);
+ pNew->useDbs = mndDupUseDbHash(pUser->useDbs);
taosRUnLockLatch(&pUser->lock);
if (pNew->readDbs == NULL || pNew->writeDbs == NULL || pNew->topics == NULL) {
@@ -306,9 +507,15 @@ static void mndUserFreeObj(SUserObj *pUser) {
taosHashCleanup(pUser->readDbs);
taosHashCleanup(pUser->writeDbs);
taosHashCleanup(pUser->topics);
+ taosHashCleanup(pUser->readTbs);
+ taosHashCleanup(pUser->writeTbs);
+ taosHashCleanup(pUser->useDbs);
pUser->readDbs = NULL;
pUser->writeDbs = NULL;
pUser->topics = NULL;
+ pUser->readTbs = NULL;
+ pUser->writeTbs = NULL;
+ pUser->useDbs = NULL;
}
static int32_t mndUserActionDelete(SSdb *pSdb, SUserObj *pUser) {
@@ -328,6 +535,9 @@ static int32_t mndUserActionUpdate(SSdb *pSdb, SUserObj *pOld, SUserObj *pNew) {
TSWAP(pOld->readDbs, pNew->readDbs);
TSWAP(pOld->writeDbs, pNew->writeDbs);
TSWAP(pOld->topics, pNew->topics);
+ TSWAP(pOld->readTbs, pNew->readTbs);
+ TSWAP(pOld->writeTbs, pNew->writeTbs);
+ TSWAP(pOld->useDbs, pNew->useDbs);
taosWUnLockLatch(&pOld->lock);
return 0;
@@ -498,6 +708,71 @@ SHashObj *mndDupDbHash(SHashObj *pOld) { return mndDupObjHash(pOld, TSDB_DB_FNAM
SHashObj *mndDupTopicHash(SHashObj *pOld) { return mndDupObjHash(pOld, TSDB_TOPIC_FNAME_LEN); }
+static int32_t mndTablePriviledge(SMnode *pMnode, SHashObj *hash, SHashObj *useDbHash, SAlterUserReq *alterReq,
+ SSdb *pSdb) {
+ void *pIter = NULL;
+ char tbFName[TSDB_TABLE_FNAME_LEN] = {0};
+
+ snprintf(tbFName, sizeof(tbFName), "%s.%s", alterReq->objname, alterReq->tabName);
+ int32_t len = strlen(tbFName) + 1;
+
+ if (alterReq->tagCond != NULL && alterReq->tagCondLen != 0) {
+ char *value = taosHashGet(hash, tbFName, len);
+ if (value != NULL) {
+ terrno = TSDB_CODE_MND_PRIVILEDGE_EXIST;
+ return -1;
+ }
+
+ int32_t condLen = alterReq->tagCondLen;
+ if (taosHashPut(hash, tbFName, len, alterReq->tagCond, condLen) != 0) {
+ return -1;
+ }
+ } else {
+ if (taosHashPut(hash, tbFName, len, "t", 2) != 0) {
+ return -1;
+ }
+ }
+
+ int32_t dbKeyLen = strlen(alterReq->objname) + 1;
+ int32_t ref = 1;
+ int32_t *currRef = taosHashGet(useDbHash, alterReq->objname, dbKeyLen);
+ if (NULL != currRef) {
+ ref = (*currRef) + 1;
+ }
+ if (taosHashPut(useDbHash, alterReq->objname, dbKeyLen, &ref, sizeof(ref)) != 0) {
+ return -1;
+ }
+
+ return 0;
+}
+
+static int32_t mndRemoveTablePriviledge(SMnode *pMnode, SHashObj *hash, SHashObj *useDbHash, SAlterUserReq *alterReq,
+ SSdb *pSdb) {
+ void *pIter = NULL;
+ char tbFName[TSDB_TABLE_FNAME_LEN] = {0};
+ snprintf(tbFName, sizeof(tbFName), "%s.%s", alterReq->objname, alterReq->tabName);
+ int32_t len = strlen(tbFName) + 1;
+
+ if (taosHashRemove(hash, tbFName, len) != 0) {
+ return -1;
+ }
+
+ int32_t dbKeyLen = strlen(alterReq->objname) + 1;
+ int32_t *currRef = taosHashGet(useDbHash, alterReq->objname, dbKeyLen);
+ if (NULL == currRef || 1 == *currRef) {
+ if (taosHashRemove(useDbHash, alterReq->objname, dbKeyLen) != 0) {
+ return -1;
+ }
+ return 0;
+ }
+ int32_t ref = (*currRef) - 1;
+ if (taosHashPut(useDbHash, alterReq->objname, dbKeyLen, &ref, sizeof(ref)) != 0) {
+ return -1;
+ }
+
+ return 0;
+}
+
static int32_t mndProcessAlterUserReq(SRpcMsg *pReq) {
SMnode *pMnode = pReq->info.node;
SSdb *pSdb = pMnode->pSdb;
@@ -637,6 +912,22 @@ static int32_t mndProcessAlterUserReq(SRpcMsg *pReq) {
}
}
+ if (alterReq.alterType == TSDB_ALTER_USER_ADD_READ_TABLE) {
+ if (mndTablePriviledge(pMnode, newUser.readTbs, newUser.useDbs, &alterReq, pSdb) != 0) goto _OVER;
+ }
+
+ if (alterReq.alterType == TSDB_ALTER_USER_ADD_WRITE_TABLE) {
+ if (mndTablePriviledge(pMnode, newUser.writeTbs, newUser.useDbs, &alterReq, pSdb) != 0) goto _OVER;
+ }
+
+ if (alterReq.alterType == TSDB_ALTER_USER_REMOVE_READ_TABLE) {
+ if (mndRemoveTablePriviledge(pMnode, newUser.readTbs, newUser.useDbs, &alterReq, pSdb) != 0) goto _OVER;
+ }
+
+ if (alterReq.alterType == TSDB_ALTER_USER_REMOVE_WRITE_TABLE) {
+ if (mndRemoveTablePriviledge(pMnode, newUser.writeTbs, newUser.useDbs, &alterReq, pSdb) != 0) goto _OVER;
+ }
+
if (alterReq.alterType == TSDB_ALTER_USER_ADD_SUBSCRIBE_TOPIC) {
int32_t len = strlen(alterReq.objname) + 1;
SMqTopicObj *pTopic = mndAcquireTopic(pMnode, alterReq.objname);
@@ -830,6 +1121,70 @@ static void mndCancelGetNextUser(SMnode *pMnode, void *pIter) {
sdbCancelFetch(pSdb, pIter);
}
+static void mndLoopHash(SHashObj *hash, char *priType, SSDataBlock *pBlock, int32_t *numOfRows, char *user,
+ SShowObj *pShow) {
+ char *value = taosHashIterate(hash, NULL);
+ int32_t cols = 0;
+
+ while (value != NULL) {
+ cols = 0;
+ char userName[TSDB_USER_LEN + VARSTR_HEADER_SIZE] = {0};
+ STR_WITH_MAXSIZE_TO_VARSTR(userName, user, pShow->pMeta->pSchemas[cols].bytes);
+ SColumnInfoData *pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
+ colDataSetVal(pColInfo, *numOfRows, (const char *)userName, false);
+
+ char privilege[20] = {0};
+ STR_WITH_MAXSIZE_TO_VARSTR(privilege, priType, pShow->pMeta->pSchemas[cols].bytes);
+ pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
+ colDataSetVal(pColInfo, *numOfRows, (const char *)privilege, false);
+
+ size_t keyLen = 0;
+ void *key = taosHashGetKey(value, &keyLen);
+
+ char dbName[TSDB_DB_NAME_LEN] = {0};
+ mndExtractShortDbNameFromStbFullName(key, dbName);
+ char dbNameContent[TSDB_DB_NAME_LEN + VARSTR_HEADER_SIZE] = {0};
+ STR_WITH_MAXSIZE_TO_VARSTR(dbNameContent, dbName, pShow->pMeta->pSchemas[cols].bytes);
+ pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
+ colDataSetVal(pColInfo, *numOfRows, (const char *)dbNameContent, false);
+
+ char tableName[TSDB_TABLE_NAME_LEN] = {0};
+ mndExtractTbNameFromStbFullName(key, tableName, TSDB_TABLE_NAME_LEN);
+ char tableNameContent[TSDB_TABLE_NAME_LEN + VARSTR_HEADER_SIZE] = {0};
+ STR_WITH_MAXSIZE_TO_VARSTR(tableNameContent, tableName, pShow->pMeta->pSchemas[cols].bytes);
+ pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
+ colDataSetVal(pColInfo, *numOfRows, (const char *)tableNameContent, false);
+
+ if (strcmp("t", value) != 0) {
+ SNode *pAst = NULL;
+ int32_t sqlLen = 0;
+ char sql[TSDB_EXPLAIN_RESULT_ROW_SIZE] = {0};
+
+ if (nodesStringToNode(value, &pAst) == 0) {
+ nodesNodeToSQL(pAst, sql, TSDB_EXPLAIN_RESULT_ROW_SIZE, &sqlLen);
+ nodesDestroyNode(pAst);
+ } else {
+ sqlLen = 5;
+ sprintf(sql, "error");
+ }
+
+ char obj[TSDB_PRIVILEDGE_CONDITION_LEN + VARSTR_HEADER_SIZE] = {0};
+ STR_WITH_MAXSIZE_TO_VARSTR(obj, sql, pShow->pMeta->pSchemas[cols].bytes);
+
+ pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
+ colDataSetVal(pColInfo, *numOfRows, (const char *)obj, false);
+ } else {
+ char condition[TSDB_PRIVILEDGE_CONDITION_LEN + VARSTR_HEADER_SIZE] = {0};
+ STR_WITH_MAXSIZE_TO_VARSTR(condition, "", pShow->pMeta->pSchemas[cols].bytes);
+ pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
+ colDataSetVal(pColInfo, *numOfRows, (const char *)condition, false);
+ }
+
+ (*numOfRows)++;
+ value = taosHashIterate(hash, value);
+ }
+}
+
static int32_t mndRetrievePrivileges(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock, int32_t rows) {
SMnode *pMnode = pReq->info.node;
SSdb *pSdb = pMnode->pSdb;
@@ -845,7 +1200,9 @@ static int32_t mndRetrievePrivileges(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock
int32_t numOfReadDbs = taosHashGetSize(pUser->readDbs);
int32_t numOfWriteDbs = taosHashGetSize(pUser->writeDbs);
int32_t numOfTopics = taosHashGetSize(pUser->topics);
- if (numOfRows + numOfReadDbs + numOfWriteDbs + numOfTopics >= rows) break;
+ int32_t numOfReadTbs = taosHashGetSize(pUser->readTbs);
+ int32_t numOfWriteTbs = taosHashGetSize(pUser->writeTbs);
+ if (numOfRows + numOfReadDbs + numOfWriteDbs + numOfTopics + numOfReadTbs + numOfWriteTbs >= rows) break;
if (pUser->superUser) {
cols = 0;
@@ -864,6 +1221,16 @@ static int32_t mndRetrievePrivileges(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
colDataSetVal(pColInfo, numOfRows, (const char *)objName, false);
+ char tableName[TSDB_TABLE_NAME_LEN + VARSTR_HEADER_SIZE] = {0};
+ STR_WITH_MAXSIZE_TO_VARSTR(tableName, "", pShow->pMeta->pSchemas[cols].bytes);
+ pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
+ colDataSetVal(pColInfo, numOfRows, (const char *)tableName, false);
+
+ char condition[TSDB_PRIVILEDGE_CONDITION_LEN + VARSTR_HEADER_SIZE] = {0};
+ STR_WITH_MAXSIZE_TO_VARSTR(condition, "", pShow->pMeta->pSchemas[cols].bytes);
+ pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
+ colDataSetVal(pColInfo, numOfRows, (const char *)condition, false);
+
numOfRows++;
}
@@ -888,6 +1255,16 @@ static int32_t mndRetrievePrivileges(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
colDataSetVal(pColInfo, numOfRows, (const char *)objName, false);
+ char tableName[TSDB_TABLE_NAME_LEN + VARSTR_HEADER_SIZE] = {0};
+ STR_WITH_MAXSIZE_TO_VARSTR(tableName, "", pShow->pMeta->pSchemas[cols].bytes);
+ pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
+ colDataSetVal(pColInfo, numOfRows, (const char *)tableName, false);
+
+ char condition[TSDB_PRIVILEDGE_CONDITION_LEN + VARSTR_HEADER_SIZE] = {0};
+ STR_WITH_MAXSIZE_TO_VARSTR(condition, "", pShow->pMeta->pSchemas[cols].bytes);
+ pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
+ colDataSetVal(pColInfo, numOfRows, (const char *)condition, false);
+
numOfRows++;
db = taosHashIterate(pUser->readDbs, db);
}
@@ -913,10 +1290,24 @@ static int32_t mndRetrievePrivileges(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
colDataSetVal(pColInfo, numOfRows, (const char *)objName, false);
+ char tableName[TSDB_TABLE_NAME_LEN + VARSTR_HEADER_SIZE] = {0};
+ STR_WITH_MAXSIZE_TO_VARSTR(tableName, "", pShow->pMeta->pSchemas[cols].bytes);
+ pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
+ colDataSetVal(pColInfo, numOfRows, (const char *)tableName, false);
+
+ char condition[TSDB_PRIVILEDGE_CONDITION_LEN + VARSTR_HEADER_SIZE] = {0};
+ STR_WITH_MAXSIZE_TO_VARSTR(condition, "", pShow->pMeta->pSchemas[cols].bytes);
+ pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
+ colDataSetVal(pColInfo, numOfRows, (const char *)condition, false);
+
numOfRows++;
db = taosHashIterate(pUser->writeDbs, db);
}
+ mndLoopHash(pUser->readTbs, "read", pBlock, &numOfRows, pUser->user, pShow);
+
+ mndLoopHash(pUser->writeTbs, "write", pBlock, &numOfRows, pUser->user, pShow);
+
char *topic = taosHashIterate(pUser->topics, NULL);
while (topic != NULL) {
cols = 0;
@@ -936,6 +1327,16 @@ static int32_t mndRetrievePrivileges(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
colDataSetVal(pColInfo, numOfRows, (const char *)topicName, false);
+ char tableName[TSDB_TABLE_NAME_LEN + VARSTR_HEADER_SIZE] = {0};
+ STR_WITH_MAXSIZE_TO_VARSTR(tableName, "", pShow->pMeta->pSchemas[cols].bytes);
+ pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
+ colDataSetVal(pColInfo, numOfRows, (const char *)tableName, false);
+
+ char condition[TSDB_PRIVILEDGE_CONDITION_LEN + VARSTR_HEADER_SIZE] = {0};
+ STR_WITH_MAXSIZE_TO_VARSTR(condition, "", pShow->pMeta->pSchemas[cols].bytes);
+ pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
+ colDataSetVal(pColInfo, numOfRows, (const char *)condition, false);
+
numOfRows++;
topic = taosHashIterate(pUser->topics, topic);
}
diff --git a/source/dnode/snode/src/snode.c b/source/dnode/snode/src/snode.c
index acfd181c51..eb4ea284a5 100644
--- a/source/dnode/snode/src/snode.c
+++ b/source/dnode/snode/src/snode.c
@@ -65,7 +65,7 @@ int32_t sndExpandTask(SSnode *pSnode, SStreamTask *pTask, int64_t ver) {
ASSERT(taosArrayGetSize(pTask->childEpInfo) != 0);
pTask->refCnt = 1;
- pTask->schedStatus = TASK_SCHED_STATUS__INACTIVE;
+ pTask->status.schedStatus = TASK_SCHED_STATUS__INACTIVE;
pTask->inputQueue = streamQueueOpen(0);
pTask->outputQueue = streamQueueOpen(0);
@@ -77,21 +77,18 @@ int32_t sndExpandTask(SSnode *pSnode, SStreamTask *pTask, int64_t ver) {
pTask->inputStatus = TASK_INPUT_STATUS__NORMAL;
pTask->outputStatus = TASK_OUTPUT_STATUS__NORMAL;
pTask->pMsgCb = &pSnode->msgCb;
- pTask->startVer = ver;
+ pTask->chkInfo.version = ver;
pTask->pState = streamStateOpen(pSnode->path, pTask, false, -1, -1);
if (pTask->pState == NULL) {
return -1;
}
- SReadHandle mgHandle = {
- .vnode = NULL,
- .numOfVgroups = (int32_t)taosArrayGetSize(pTask->childEpInfo),
- .pStateBackend = pTask->pState,
- };
+ int32_t numOfChildEp = taosArrayGetSize(pTask->childEpInfo);
+ SReadHandle mgHandle = { .vnode = NULL, .numOfVgroups = numOfChildEp, .pStateBackend = pTask->pState };
- pTask->exec.executor = qCreateStreamExecTaskInfo(pTask->exec.qmsg, &mgHandle, 0);
- ASSERT(pTask->exec.executor);
+ pTask->exec.pExecutor = qCreateStreamExecTaskInfo(pTask->exec.qmsg, &mgHandle, 0);
+ ASSERT(pTask->exec.pExecutor);
streamSetupTrigger(pTask);
return 0;
@@ -143,7 +140,7 @@ int32_t sndProcessTaskDeployReq(SSnode *pSnode, char *msg, int32_t msgLen) {
}
SDecoder decoder;
tDecoderInit(&decoder, (uint8_t *)msg, msgLen);
- code = tDecodeSStreamTask(&decoder, pTask);
+ code = tDecodeStreamTask(&decoder, pTask);
if (code < 0) {
tDecoderClear(&decoder);
taosMemoryFree(pTask);
@@ -154,7 +151,7 @@ int32_t sndProcessTaskDeployReq(SSnode *pSnode, char *msg, int32_t msgLen) {
ASSERT(pTask->taskLevel == TASK_LEVEL__AGG);
// 2.save task
- code = streamMetaAddTask(pSnode->pMeta, -1, pTask);
+ code = streamMetaAddDeployedTask(pSnode->pMeta, -1, pTask);
if (code < 0) {
return -1;
}
diff --git a/source/dnode/vnode/CMakeLists.txt b/source/dnode/vnode/CMakeLists.txt
index 7dbfdc5ed2..f3087e3662 100644
--- a/source/dnode/vnode/CMakeLists.txt
+++ b/source/dnode/vnode/CMakeLists.txt
@@ -57,6 +57,7 @@ target_sources(
# tq
"src/tq/tq.c"
+ "src/tq/tqUtil.c"
"src/tq/tqScan.c"
"src/tq/tqMeta.c"
"src/tq/tqRead.c"
@@ -64,6 +65,7 @@ target_sources(
"src/tq/tqPush.c"
"src/tq/tqSink.c"
"src/tq/tqCommit.c"
+ "src/tq/tqRestore.c"
"src/tq/tqSnapshot.c"
"src/tq/tqOffsetSnapshot.c"
)
diff --git a/source/dnode/vnode/inc/vnode.h b/source/dnode/vnode/inc/vnode.h
index 9636dc2872..e6e21e1e4a 100644
--- a/source/dnode/vnode/inc/vnode.h
+++ b/source/dnode/vnode/inc/vnode.h
@@ -228,19 +228,12 @@ typedef struct SSnapContext {
SArray *idList;
int32_t index;
bool withMeta;
- bool queryMetaOrData; // true-get meta, false-get data
+ bool queryMeta; // true-get meta, false-get data
} SSnapContext;
typedef struct STqReader {
- // const SSubmitReq *pMsg;
- // SSubmitBlk *pBlock;
- // SSubmitMsgIter msgIter;
- // SSubmitBlkIter blkIter;
-
- int64_t ver;
SPackedData msg2;
- int8_t setMsg;
SSubmitReq2 submit;
int32_t nextBlk;
@@ -263,15 +256,16 @@ void tqCloseReader(STqReader *);
void tqReaderSetColIdList(STqReader *pReader, SArray *pColIdList);
int32_t tqReaderSetTbUidList(STqReader *pReader, const SArray *tbUidList);
-int32_t tqReaderAddTbUidList(STqReader *pReader, const SArray *tbUidList);
+int32_t tqReaderAddTbUidList(STqReader *pReader, const SArray *pTableUidList);
int32_t tqReaderRemoveTbUidList(STqReader *pReader, const SArray *tbUidList);
int32_t tqSeekVer(STqReader *pReader, int64_t ver, const char *id);
-int32_t tqNextBlock(STqReader *pReader, SFetchRet *ret);
+void tqNextBlock(STqReader *pReader, SFetchRet *ret);
+int32_t extractSubmitMsgFromWal(SWalReader *pReader, SPackedData *pPackedData);
-int32_t tqReaderSetSubmitReq2(STqReader *pReader, void *msgStr, int32_t msgLen, int64_t ver);
+int32_t tqReaderSetSubmitMsg(STqReader *pReader, void *msgStr, int32_t msgLen, int64_t ver);
// int32_t tqReaderSetDataMsg(STqReader *pReader, const SSubmitReq *pMsg, int64_t ver);
-bool tqNextDataBlock2(STqReader *pReader);
+bool tqNextDataBlock(STqReader *pReader);
bool tqNextDataBlockFilterOut2(STqReader *pReader, SHashObj *filterOutUids);
int32_t tqRetrieveDataBlock2(SSDataBlock *pBlock, STqReader *pReader, SSubmitTbData **pSubmitTbDataRet);
int32_t tqRetrieveTaosxBlock2(STqReader *pReader, SArray *blocks, SArray *schemas, SSubmitTbData **pSubmitTbDataRet);
diff --git a/source/dnode/vnode/src/inc/tq.h b/source/dnode/vnode/src/inc/tq.h
index 9037644602..c007f84790 100644
--- a/source/dnode/vnode/src/inc/tq.h
+++ b/source/dnode/vnode/src/inc/tq.h
@@ -80,7 +80,7 @@ typedef struct {
typedef struct {
int8_t subType;
- STqReader* pExecReader;
+ STqReader* pTqReader;
qTaskInfo_t task;
union {
STqExecCol execCol;
@@ -128,6 +128,10 @@ typedef struct {
tmr_h timer;
} STqMgmt;
+typedef struct {
+ int32_t size;
+} STqOffsetHead;
+
static STqMgmt tqMgmt = {0};
int32_t tEncodeSTqHandle(SEncoder* pEncoder, const STqHandle* pHandle);
@@ -154,10 +158,6 @@ int32_t tqMetaSaveCheckInfo(STQ* pTq, const char* key, const void* value, int32_
int32_t tqMetaDeleteCheckInfo(STQ* pTq, const char* key);
int32_t tqMetaRestoreCheckInfo(STQ* pTq);
-typedef struct {
- int32_t size;
-} STqOffsetHead;
-
STqOffsetStore* tqOffsetOpen(STQ* pTq);
void tqOffsetClose(STqOffsetStore*);
STqOffset* tqOffsetRead(STqOffsetStore* pStore, const char* subscribeKey);
@@ -176,6 +176,18 @@ int32_t tqOffsetRestoreFromFile(STqOffsetStore* pStore, const char* fname);
// tqStream
int32_t tqExpandTask(STQ* pTq, SStreamTask* pTask, int64_t ver);
+int32_t tqStreamTasksScanWal(STQ* pTq);
+
+// tq util
+void createStreamTaskOffsetKey(char* dst, uint64_t streamId, uint32_t taskId);
+int32_t tqAddInputBlockNLaunchTask(SStreamTask* pTask, SStreamQueueItem* pQueueItem, int64_t ver);
+int32_t launchTaskForWalBlock(SStreamTask* pTask, SFetchRet* pRet, STqOffset* pOffset);
+int32_t tqExtractDataForMq(STQ* pTq, STqHandle* pHandle, const SMqPollReq* pRequest, SRpcMsg* pMsg);
+
+void doSaveTaskOffset(STqOffsetStore* pOffsetStore, const char* pKey, int64_t ver);
+void saveOffsetForAllTasks(STQ* pTq, int64_t ver);
+void initOffsetForAllRestoreTasks(STQ* pTq);
+int32_t transferToWalReadTask(SStreamMeta* pStreamMeta, SArray* pTaskList);
#ifdef __cplusplus
}
diff --git a/source/dnode/vnode/src/inc/tsdb.h b/source/dnode/vnode/src/inc/tsdb.h
index 0c4ada2cb1..2a85b191a4 100644
--- a/source/dnode/vnode/src/inc/tsdb.h
+++ b/source/dnode/vnode/src/inc/tsdb.h
@@ -123,12 +123,12 @@ int32_t tsdbRowIterOpen(STSDBRowIter *pIter, TSDBROW *pRow, STSchema *pTSchema)
void tsdbRowClose(STSDBRowIter *pIter);
SColVal *tsdbRowIterNext(STSDBRowIter *pIter);
// SRowMerger
-int32_t tsdbRowMergerInit2(SRowMerger *pMerger, STSchema *pResTSchema, TSDBROW *pRow, STSchema *pTSchema);
+int32_t tsdbRowMergerInit(SRowMerger *pMerger, STSchema *pResTSchema, TSDBROW *pRow, STSchema *pTSchema);
int32_t tsdbRowMergerAdd(SRowMerger *pMerger, TSDBROW *pRow, STSchema *pTSchema);
-int32_t tsdbRowMergerInit(SRowMerger *pMerger, TSDBROW *pRow, STSchema *pTSchema);
-void tsdbRowMergerClear(SRowMerger *pMerger);
-int32_t tsdbRowMerge(SRowMerger *pMerger, TSDBROW *pRow);
+// int32_t tsdbRowMergerInit(SRowMerger *pMerger, TSDBROW *pRow, STSchema *pTSchema);
+void tsdbRowMergerClear(SRowMerger *pMerger);
+// int32_t tsdbRowMerge(SRowMerger *pMerger, TSDBROW *pRow);
int32_t tsdbRowMergerGetRow(SRowMerger *pMerger, SRow **ppRow);
// TABLEID
int32_t tTABLEIDCmprFn(const void *p1, const void *p2);
@@ -224,7 +224,7 @@ int32_t tsdbTbDataIterCreate(STbData *pTbData, TSDBKEY *pFrom, int8_t backward,
void *tsdbTbDataIterDestroy(STbDataIter *pIter);
void tsdbTbDataIterOpen(STbData *pTbData, TSDBKEY *pFrom, int8_t backward, STbDataIter *pIter);
bool tsdbTbDataIterNext(STbDataIter *pIter);
-void tsdbMemTableCountRows(SMemTable *pMemTable, SHashObj* pTableMap, int64_t *rowsNum);
+void tsdbMemTableCountRows(SMemTable *pMemTable, SHashObj *pTableMap, int64_t *rowsNum);
// STbData
int32_t tsdbGetNRowsInTbData(STbData *pTbData);
diff --git a/source/dnode/vnode/src/inc/vnodeInt.h b/source/dnode/vnode/src/inc/vnodeInt.h
index 253d5aebce..81f7c3d52a 100644
--- a/source/dnode/vnode/src/inc/vnodeInt.h
+++ b/source/dnode/vnode/src/inc/vnodeInt.h
@@ -192,9 +192,10 @@ void tqCleanUp();
STQ* tqOpen(const char* path, SVnode* pVnode);
void tqClose(STQ*);
int tqPushMsg(STQ*, void* msg, int32_t msgLen, tmsg_t msgType, int64_t ver);
-int tqRegisterPushEntry(STQ* pTq, void* pHandle, const SMqPollReq* pRequest, SRpcMsg* pRpcMsg, SMqDataRsp* pDataRsp,
+int tqRegisterPushHandle(STQ* pTq, void* pHandle, const SMqPollReq* pRequest, SRpcMsg* pRpcMsg, SMqDataRsp* pDataRsp,
int32_t type);
-int tqUnregisterPushEntry(STQ* pTq, const char* pKey, int32_t keyLen, uint64_t consumerId, bool rspConsumer);
+int tqUnregisterPushHandle(STQ* pTq, const char* pKey, int32_t keyLen, uint64_t consumerId, bool rspConsumer);
+int tqStartStreamTasks(STQ* pTq); // restore all stream tasks after vnode launching completed.
int tqCommit(STQ*);
int32_t tqUpdateTbUidList(STQ* pTq, const SArray* tbUidList, bool isAdd);
diff --git a/source/dnode/vnode/src/meta/metaCache.c b/source/dnode/vnode/src/meta/metaCache.c
index 9501bf4b8e..795f281ab2 100644
--- a/source/dnode/vnode/src/meta/metaCache.c
+++ b/source/dnode/vnode/src/meta/metaCache.c
@@ -531,10 +531,11 @@ static void freePayload(const void* key, size_t keyLen, void* value) {
return;
}
- SHashObj* pHashObj = (SHashObj*)p[0];
+ SHashObj* pHashObj = (SHashObj*)p[0];
+
STagFilterResEntry** pEntry = taosHashGet(pHashObj, &p[1], sizeof(uint64_t));
- {
+ if (pEntry != NULL && (*pEntry) != NULL) {
int64_t st = taosGetTimestampUs();
SListIter iter = {0};
@@ -547,9 +548,9 @@ static void freePayload(const void* key, size_t keyLen, void* value) {
void* tmp = tdListPopNode(&((*pEntry)->list), pNode);
taosMemoryFree(tmp);
- int64_t et = taosGetTimestampUs();
- metaInfo("clear items in cache, remain cached item:%d, elapsed time:%.2fms", listNEles(&((*pEntry)->list)),
- (et - st) / 1000.0);
+ double el = (taosGetTimestampUs() - st) / 1000.0;
+ metaInfo("clear items in meta-cache, remain cached item:%d, elapsed time:%.2fms", listNEles(&((*pEntry)->list)),
+ el);
break;
}
}
diff --git a/source/dnode/vnode/src/meta/metaSnapshot.c b/source/dnode/vnode/src/meta/metaSnapshot.c
index 67ade45732..0126d29cc9 100644
--- a/source/dnode/vnode/src/meta/metaSnapshot.c
+++ b/source/dnode/vnode/src/meta/metaSnapshot.c
@@ -268,7 +268,7 @@ int32_t buildSnapContext(SMeta* pMeta, int64_t snapVersion, int64_t suid, int8_t
ctx->snapVersion = snapVersion;
ctx->suid = suid;
ctx->subType = subType;
- ctx->queryMetaOrData = withMeta;
+ ctx->queryMeta = withMeta;
ctx->withMeta = withMeta;
ctx->idVersion = taosHashInit(100, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), true, HASH_NO_LOCK);
if (ctx->idVersion == NULL) {
@@ -475,7 +475,7 @@ int32_t getMetafromSnapShot(SSnapContext* ctx, void** pBuf, int32_t* contLen, in
if (ctx->index >= taosArrayGetSize(ctx->idList)) {
metaDebug("tmqsnap get meta end");
ctx->index = 0;
- ctx->queryMetaOrData = false; // change to get data
+ ctx->queryMeta = false; // change to get data
return 0;
}
diff --git a/source/dnode/vnode/src/sma/smaRollup.c b/source/dnode/vnode/src/sma/smaRollup.c
index c75c675ec3..8aeb705d90 100644
--- a/source/dnode/vnode/src/sma/smaRollup.c
+++ b/source/dnode/vnode/src/sma/smaRollup.c
@@ -168,7 +168,7 @@ static int32_t tdUpdateTbUidListImpl(SSma *pSma, tb_uid_t *suid, SArray *tbUids,
for (int32_t i = 0; i < TSDB_RETENTION_L2; ++i) {
if (pRSmaInfo->taskInfo[i]) {
- if ((terrno = qUpdateQualifiedTableId(pRSmaInfo->taskInfo[i], tbUids, isAdd)) < 0) {
+ if ((terrno = qUpdateTableListForStreamScanner(pRSmaInfo->taskInfo[i], tbUids, isAdd, NULL)) < 0) {
tdReleaseRSmaInfo(pSma, pRSmaInfo);
smaError("vgId:%d, update tbUidList failed for uid:%" PRIi64 " level %d since %s", SMA_VID(pSma), *suid, i,
terrstr());
diff --git a/source/dnode/vnode/src/tq/tq.c b/source/dnode/vnode/src/tq/tq.c
index 1364a61929..940841bf70 100644
--- a/source/dnode/vnode/src/tq/tq.c
+++ b/source/dnode/vnode/src/tq/tq.c
@@ -18,6 +18,7 @@
// 0: not init
// 1: already inited
// 2: wait to be inited or cleaup
+#define WAL_READ_TASKS_ID (-1)
int32_t tqInit() {
int8_t old;
@@ -61,12 +62,12 @@ static void destroyTqHandle(void* data) {
if (pData->execHandle.subType == TOPIC_SUB_TYPE__COLUMN) {
taosMemoryFreeClear(pData->execHandle.execCol.qmsg);
} else if (pData->execHandle.subType == TOPIC_SUB_TYPE__DB) {
- tqCloseReader(pData->execHandle.pExecReader);
+ tqCloseReader(pData->execHandle.pTqReader);
walCloseReader(pData->pWalReader);
taosHashCleanup(pData->execHandle.execDb.pFilterOutTbUid);
} else if (pData->execHandle.subType == TOPIC_SUB_TYPE__TABLE) {
walCloseReader(pData->pWalReader);
- tqCloseReader(pData->execHandle.pExecReader);
+ tqCloseReader(pData->execHandle.pTqReader);
}
}
@@ -82,12 +83,18 @@ static void tqPushEntryFree(void* data) {
taosMemoryFree(p);
}
+static bool tqOffsetLessOrEqual(const STqOffset* pLeft, const STqOffset* pRight) {
+ return pLeft->val.type == TMQ_OFFSET__LOG && pRight->val.type == TMQ_OFFSET__LOG &&
+ pLeft->val.version <= pRight->val.version;
+}
+
STQ* tqOpen(const char* path, SVnode* pVnode) {
STQ* pTq = taosMemoryCalloc(1, sizeof(STQ));
if (pTq == NULL) {
terrno = TSDB_CODE_OUT_OF_MEMORY;
return NULL;
}
+
pTq->path = taosStrdup(path);
pTq->pVnode = pVnode;
pTq->walLogLastVer = pVnode->pWal->vers.lastVer;
@@ -138,44 +145,6 @@ void tqClose(STQ* pTq) {
taosMemoryFree(pTq);
}
-int32_t tqSendMetaPollRsp(STQ* pTq, const SRpcMsg* pMsg, const SMqPollReq* pReq, const SMqMetaRsp* pRsp) {
- int32_t len = 0;
- int32_t code = 0;
- tEncodeSize(tEncodeSMqMetaRsp, pRsp, len, code);
- if (code < 0) {
- return -1;
- }
- int32_t tlen = sizeof(SMqRspHead) + len;
- void* buf = rpcMallocCont(tlen);
- if (buf == NULL) {
- return -1;
- }
-
- ((SMqRspHead*)buf)->mqMsgType = TMQ_MSG_TYPE__POLL_META_RSP;
- ((SMqRspHead*)buf)->epoch = pReq->epoch;
- ((SMqRspHead*)buf)->consumerId = pReq->consumerId;
-
- void* abuf = POINTER_SHIFT(buf, sizeof(SMqRspHead));
-
- SEncoder encoder = {0};
- tEncoderInit(&encoder, abuf, len);
- tEncodeSMqMetaRsp(&encoder, pRsp);
- tEncoderClear(&encoder);
-
- SRpcMsg resp = {
- .info = pMsg->info,
- .pCont = buf,
- .contLen = tlen,
- .code = 0,
- };
- tmsgSendRsp(&resp);
-
- tqDebug("vgId:%d, from consumer:0x%" PRIx64 " (epoch %d) send rsp, res msg type %d, offset type:%d",
- TD_VID(pTq->pVnode), pReq->consumerId, pReq->epoch, pRsp->resMsgType, pRsp->rspOffset.type);
-
- return 0;
-}
-
static int32_t doSendDataRsp(const SRpcHandleInfo* pRpcHandleInfo, const SMqDataRsp* pRsp, int32_t epoch,
int64_t consumerId, int32_t type) {
int32_t len = 0;
@@ -240,17 +209,6 @@ int32_t tqPushDataRsp(STQ* pTq, STqPushEntry* pPushEntry) {
}
int32_t tqSendDataRsp(STQ* pTq, const SRpcMsg* pMsg, const SMqPollReq* pReq, const SMqDataRsp* pRsp, int32_t type) {
-#if 0
- A(taosArrayGetSize(pRsp->blockData) == pRsp->blockNum);
- A(taosArrayGetSize(pRsp->blockDataLen) == pRsp->blockNum);
-
- A(!pRsp->withSchema);
- A(taosArrayGetSize(pRsp->blockSchema) == 0);
-
- if (pRsp->reqOffset.type == TMQ_OFFSET__LOG) {
- A(pRsp->rspOffset.version > pRsp->reqOffset.version);
- }
-#endif
doSendDataRsp(&pMsg->info, pRsp, pReq->epoch, pReq->consumerId, type);
char buf1[80] = {0};
@@ -264,11 +222,6 @@ int32_t tqSendDataRsp(STQ* pTq, const SRpcMsg* pMsg, const SMqPollReq* pReq, con
return 0;
}
-static FORCE_INLINE bool tqOffsetLessOrEqual(const STqOffset* pLeft, const STqOffset* pRight) {
- return pLeft->val.type == TMQ_OFFSET__LOG && pRight->val.type == TMQ_OFFSET__LOG &&
- pLeft->val.version <= pRight->val.version;
-}
-
int32_t tqProcessOffsetCommitReq(STQ* pTq, int64_t sversion, char* msg, int32_t msgLen) {
STqOffset offset = {0};
int32_t vgId = TD_VID(pTq->pVnode);
@@ -341,324 +294,6 @@ int32_t tqCheckColModifiable(STQ* pTq, int64_t tbUid, int32_t colId) {
return 0;
}
-static int32_t tqInitDataRsp(SMqDataRsp* pRsp, const SMqPollReq* pReq, int8_t subType) {
- pRsp->reqOffset = pReq->reqOffset;
-
- pRsp->blockData = taosArrayInit(0, sizeof(void*));
- pRsp->blockDataLen = taosArrayInit(0, sizeof(int32_t));
-
- if (pRsp->blockData == NULL || pRsp->blockDataLen == NULL) {
- return -1;
- }
-
- pRsp->withTbName = 0;
-#if 0
- pRsp->withTbName = pReq->withTbName;
- if (pRsp->withTbName) {
- pRsp->blockTbName = taosArrayInit(0, sizeof(void*));
- if (pRsp->blockTbName == NULL) {
- // TODO free
- return -1;
- }
- }
-#endif
-
- pRsp->withSchema = false;
- return 0;
-}
-
-static int32_t tqInitTaosxRsp(STaosxRsp* pRsp, const SMqPollReq* pReq) {
- pRsp->reqOffset = pReq->reqOffset;
-
- pRsp->withTbName = 1;
- pRsp->withSchema = 1;
- pRsp->blockData = taosArrayInit(0, sizeof(void*));
- pRsp->blockDataLen = taosArrayInit(0, sizeof(int32_t));
- pRsp->blockTbName = taosArrayInit(0, sizeof(void*));
- pRsp->blockSchema = taosArrayInit(0, sizeof(void*));
-
- if (pRsp->blockData == NULL || pRsp->blockDataLen == NULL || pRsp->blockTbName == NULL || pRsp->blockSchema == NULL) {
- return -1;
- }
-
- return 0;
-}
-
-static int32_t extractResetOffsetVal(STqOffsetVal* pOffsetVal, STQ* pTq, STqHandle* pHandle, const SMqPollReq* pRequest,
- SRpcMsg* pMsg, bool* pBlockReturned) {
- uint64_t consumerId = pRequest->consumerId;
- STqOffsetVal reqOffset = pRequest->reqOffset;
- STqOffset* pOffset = tqOffsetRead(pTq->pOffsetStore, pRequest->subKey);
- int32_t vgId = TD_VID(pTq->pVnode);
-
- *pBlockReturned = false;
-
- // In this vnode, data has been polled by consumer for this topic, so let's continue from the last offset value.
- if (pOffset != NULL) {
- *pOffsetVal = pOffset->val;
-
- char formatBuf[80];
- tFormatOffset(formatBuf, 80, pOffsetVal);
- tqDebug("tmq poll: consumer:0x%" PRIx64
- ", subkey %s, vgId:%d, existed offset found, offset reset to %s and continue. reqId:0x%" PRIx64,
- consumerId, pHandle->subKey, vgId, formatBuf, pRequest->reqId);
- return 0;
- } else {
- // no poll occurs in this vnode for this topic, let's seek to the right offset value.
- if (reqOffset.type == TMQ_OFFSET__RESET_EARLIEAST) {
- if (pRequest->useSnapshot) {
- tqDebug("tmq poll: consumer:0x%" PRIx64 ", subkey:%s, vgId:%d, (earliest) set offset to be snapshot",
- consumerId, pHandle->subKey, vgId);
-
- if (pHandle->fetchMeta) {
- tqOffsetResetToMeta(pOffsetVal, 0);
- } else {
- tqOffsetResetToData(pOffsetVal, 0, 0);
- }
- } else {
- pHandle->pRef = walRefFirstVer(pTq->pVnode->pWal, pHandle->pRef);
- if (pHandle->pRef == NULL) {
- terrno = TSDB_CODE_OUT_OF_MEMORY;
- return -1;
- }
-
- tqOffsetResetToLog(pOffsetVal, pHandle->pRef->refVer - 1);
- }
- } else if (reqOffset.type == TMQ_OFFSET__RESET_LATEST) {
- if (pHandle->execHandle.subType == TOPIC_SUB_TYPE__COLUMN) {
- SMqDataRsp dataRsp = {0};
- tqInitDataRsp(&dataRsp, pRequest, pHandle->execHandle.subType);
-
- tqOffsetResetToLog(&dataRsp.rspOffset, walGetLastVer(pTq->pVnode->pWal));
- tqDebug("tmq poll: consumer:0x%" PRIx64 ", subkey %s, vgId:%d, (latest) offset reset to %" PRId64, consumerId,
- pHandle->subKey, vgId, dataRsp.rspOffset.version);
- int32_t code = tqSendDataRsp(pTq, pMsg, pRequest, &dataRsp, TMQ_MSG_TYPE__POLL_RSP);
- tDeleteSMqDataRsp(&dataRsp);
-
- *pBlockReturned = true;
- return code;
- } else {
- STaosxRsp taosxRsp = {0};
- tqInitTaosxRsp(&taosxRsp, pRequest);
- tqOffsetResetToLog(&taosxRsp.rspOffset, walGetLastVer(pTq->pVnode->pWal));
- int32_t code = tqSendDataRsp(pTq, pMsg, pRequest, (SMqDataRsp*)&taosxRsp, TMQ_MSG_TYPE__TAOSX_RSP);
- tDeleteSTaosxRsp(&taosxRsp);
-
- *pBlockReturned = true;
- return code;
- }
- } else if (reqOffset.type == TMQ_OFFSET__RESET_NONE) {
- tqError("tmq poll: subkey:%s, no offset committed for consumer:0x%" PRIx64
- " in vg %d, subkey %s, reset none failed",
- pHandle->subKey, consumerId, vgId, pRequest->subKey);
- terrno = TSDB_CODE_TQ_NO_COMMITTED_OFFSET;
- return -1;
- }
- }
-
- return 0;
-}
-
-#define IS_OFFSET_RESET_TYPE(_t) ((_t) < 0)
-
-static int32_t extractDataAndRspForNormalSubscribe(STQ* pTq, STqHandle* pHandle, const SMqPollReq* pRequest,
- SRpcMsg* pMsg, STqOffsetVal* pOffset) {
- int32_t code = 0;
- uint64_t consumerId = pRequest->consumerId;
- int32_t vgId = TD_VID(pTq->pVnode);
-
- SMqDataRsp dataRsp = {0};
- tqInitDataRsp(&dataRsp, pRequest, pHandle->execHandle.subType);
-
- // lock
- taosWLockLatch(&pTq->lock);
-
- qSetTaskId(pHandle->execHandle.task, consumerId, pRequest->reqId);
- code = tqScanData(pTq, pHandle, &dataRsp, pOffset);
- if (code != TSDB_CODE_SUCCESS) {
- taosWUnLockLatch(&pTq->lock);
- return code;
- }
-
- // till now, all data has been transferred to consumer, new data needs to push client once arrived.
- if (dataRsp.blockNum == 0 && dataRsp.reqOffset.type == TMQ_OFFSET__LOG &&
- dataRsp.reqOffset.version == dataRsp.rspOffset.version && pHandle->consumerId == pRequest->consumerId) {
- code = tqRegisterPushEntry(pTq, pHandle, pRequest, pMsg, &dataRsp, TMQ_MSG_TYPE__POLL_RSP);
- taosWUnLockLatch(&pTq->lock);
- return code;
- }
-
- taosWUnLockLatch(&pTq->lock);
- code = tqSendDataRsp(pTq, pMsg, pRequest, (SMqDataRsp*)&dataRsp, TMQ_MSG_TYPE__POLL_RSP);
-
- // NOTE: this pHandle->consumerId may have been changed already.
- tqDebug("tmq poll: consumer:0x%" PRIx64 ", subkey %s, vgId:%d, rsp block:%d, offset type:%d, uid/version:%" PRId64
- ", ts:%" PRId64 ", reqId:0x%" PRIx64,
- consumerId, pHandle->subKey, vgId, dataRsp.blockNum, dataRsp.rspOffset.type, dataRsp.rspOffset.uid,
- dataRsp.rspOffset.ts, pRequest->reqId);
-
- tDeleteSMqDataRsp(&dataRsp);
- return code;
-}
-
-static int32_t doPollDataForMq(STQ* pTq, STqHandle* pHandle, const SMqPollReq* pRequest, SRpcMsg* pMsg) {
- int32_t code = -1;
- STqOffsetVal offset = {0};
- SWalCkHead* pCkHead = NULL;
- int32_t vgId = TD_VID(pTq->pVnode);
-
- STqOffsetVal reqOffset = pRequest->reqOffset;
- uint64_t consumerId = pRequest->consumerId;
-
- // 1. reset the offset if needed
- if (IS_OFFSET_RESET_TYPE(reqOffset.type)) {
- // handle the reset offset cases, according to the consumer's choice.
- bool blockReturned = false;
- code = extractResetOffsetVal(&offset, pTq, pHandle, pRequest, pMsg, &blockReturned);
- if (code != 0) {
- return code;
- }
-
- // empty block returned, quit
- if (blockReturned) {
- return 0;
- }
- } else { // use the consumer specified offset
- // the offset value can not be monotonious increase??
- offset = reqOffset;
- }
-
- // this is a normal subscribe requirement
- if (pHandle->execHandle.subType == TOPIC_SUB_TYPE__COLUMN) {
- return extractDataAndRspForNormalSubscribe(pTq, pHandle, pRequest, pMsg, &offset);
- }
-
- // todo handle the case where re-balance occurs.
- // for taosx
- SMqMetaRsp metaRsp = {0};
- STaosxRsp taosxRsp = {0};
- tqInitTaosxRsp(&taosxRsp, pRequest);
-
- if (offset.type != TMQ_OFFSET__LOG) {
- if (tqScanTaosx(pTq, pHandle, &taosxRsp, &metaRsp, &offset) < 0) {
- return -1;
- }
-
- if (metaRsp.metaRspLen > 0) {
- code = tqSendMetaPollRsp(pTq, pMsg, pRequest, &metaRsp);
- tqDebug("tmq poll: consumer:0x%" PRIx64 " subkey:%s vgId:%d, send meta offset type:%d,uid:%" PRId64
- ",ts:%" PRId64,
- consumerId, pHandle->subKey, vgId, metaRsp.rspOffset.type, metaRsp.rspOffset.uid, metaRsp.rspOffset.ts);
- taosMemoryFree(metaRsp.metaRsp);
- tDeleteSTaosxRsp(&taosxRsp);
- return code;
- }
-
- if (taosxRsp.blockNum > 0) {
- code = tqSendDataRsp(pTq, pMsg, pRequest, (SMqDataRsp*)&taosxRsp, TMQ_MSG_TYPE__TAOSX_RSP);
- tDeleteSTaosxRsp(&taosxRsp);
- return code;
- } else {
- offset = taosxRsp.rspOffset;
- }
-
- tqDebug("taosx poll: consumer:0x%" PRIx64 " subkey:%s vgId:%d, send data blockNum:%d, offset type:%d,uid:%" PRId64
- ",version:%" PRId64,
- consumerId, pHandle->subKey, vgId, taosxRsp.blockNum, taosxRsp.rspOffset.type, taosxRsp.rspOffset.uid,
- taosxRsp.rspOffset.version);
- }
-
- if (offset.type == TMQ_OFFSET__LOG) {
- int64_t fetchVer = offset.version + 1;
- pCkHead = taosMemoryMalloc(sizeof(SWalCkHead) + 2048);
- if (pCkHead == NULL) {
- tDeleteSTaosxRsp(&taosxRsp);
- terrno = TSDB_CODE_OUT_OF_MEMORY;
- return -1;
- }
- walSetReaderCapacity(pHandle->pWalReader, 2048);
- int totalRows = 0;
- while (1) {
- // todo refactor: this is not correct.
- int32_t savedEpoch = atomic_load_32(&pHandle->epoch);
- if (savedEpoch > pRequest->epoch) {
- tqWarn("tmq poll: consumer:0x%" PRIx64 " (epoch %d), subkey:%s vgId:%d offset %" PRId64
- ", found new consumer epoch %d, discard req epoch %d",
- consumerId, pRequest->epoch, pHandle->subKey, vgId, fetchVer, savedEpoch, pRequest->epoch);
- break;
- }
-
- if (tqFetchLog(pTq, pHandle, &fetchVer, &pCkHead, pRequest->reqId) < 0) {
- tqOffsetResetToLog(&taosxRsp.rspOffset, fetchVer);
- code = tqSendDataRsp(pTq, pMsg, pRequest, (SMqDataRsp*)&taosxRsp, TMQ_MSG_TYPE__TAOSX_RSP);
- tDeleteSTaosxRsp(&taosxRsp);
- taosMemoryFreeClear(pCkHead);
- return code;
- }
-
- SWalCont* pHead = &pCkHead->head;
- tqDebug("tmq poll: consumer:0x%" PRIx64 " (epoch %d) iter log, vgId:%d offset %" PRId64 " msgType %d", consumerId,
- pRequest->epoch, vgId, fetchVer, pHead->msgType);
-
- // process meta
- if (pHead->msgType != TDMT_VND_SUBMIT) {
- if (totalRows > 0) {
- tqOffsetResetToLog(&taosxRsp.rspOffset, fetchVer - 1);
- code = tqSendDataRsp(pTq, pMsg, pRequest, (SMqDataRsp*)&taosxRsp, TMQ_MSG_TYPE__TAOSX_RSP);
- tDeleteSTaosxRsp(&taosxRsp);
- taosMemoryFreeClear(pCkHead);
- return code;
- }
-
- tqDebug("fetch meta msg, ver:%" PRId64 ", type:%s", pHead->version, TMSG_INFO(pHead->msgType));
- tqOffsetResetToLog(&metaRsp.rspOffset, fetchVer);
- metaRsp.resMsgType = pHead->msgType;
- metaRsp.metaRspLen = pHead->bodyLen;
- metaRsp.metaRsp = pHead->body;
- if (tqSendMetaPollRsp(pTq, pMsg, pRequest, &metaRsp) < 0) {
- code = -1;
- taosMemoryFreeClear(pCkHead);
- tDeleteSTaosxRsp(&taosxRsp);
- return code;
- }
- code = 0;
- taosMemoryFreeClear(pCkHead);
- tDeleteSTaosxRsp(&taosxRsp);
- return code;
- }
-
- // process data
- SPackedData submit = {
- .msgStr = POINTER_SHIFT(pHead->body, sizeof(SSubmitReq2Msg)),
- .msgLen = pHead->bodyLen - sizeof(SSubmitReq2Msg),
- .ver = pHead->version,
- };
-
- if (tqTaosxScanLog(pTq, pHandle, submit, &taosxRsp, &totalRows) < 0) {
- tqError("tmq poll: tqTaosxScanLog error %" PRId64 ", in vgId:%d, subkey %s", consumerId, vgId,
- pRequest->subKey);
- taosMemoryFreeClear(pCkHead);
- tDeleteSTaosxRsp(&taosxRsp);
- return -1;
- }
-
- if (totalRows >= 4096 || taosxRsp.createTableNum > 0) {
- tqOffsetResetToLog(&taosxRsp.rspOffset, fetchVer);
- code = tqSendDataRsp(pTq, pMsg, pRequest, (SMqDataRsp*)&taosxRsp, TMQ_MSG_TYPE__TAOSX_RSP);
- tDeleteSTaosxRsp(&taosxRsp);
- taosMemoryFreeClear(pCkHead);
- return code;
- } else {
- fetchVer++;
- }
- }
- }
-
- tDeleteSTaosxRsp(&taosxRsp);
- taosMemoryFreeClear(pCkHead);
- return 0;
-}
-
int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg) {
SMqPollReq req = {0};
if (tDeserializeSMqPollReq(pMsg->pCont, pMsg->contLen, &req) < 0) {
@@ -706,7 +341,7 @@ int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg) {
tqDebug("tmq poll: consumer:0x%" PRIx64 " (epoch %d), subkey %s, recv poll req vgId:%d, req:%s, reqId:0x%" PRIx64,
consumerId, req.epoch, pHandle->subKey, vgId, buf, req.reqId);
- return doPollDataForMq(pTq, pHandle, &req, pMsg);
+ return tqExtractDataForMq(pTq, pHandle, &req, pMsg);
}
int32_t tqProcessDeleteSubReq(STQ* pTq, int64_t sversion, char* msg, int32_t msgLen) {
@@ -821,13 +456,7 @@ int32_t tqProcessSubscribeReq(STQ* pTq, int64_t sversion, char* msg, int32_t msg
pHandle->pRef = pRef;
SReadHandle handle = {
- .meta = pVnode->pMeta,
- .vnode = pVnode,
- .initTableReader = true,
- .initTqReader = true,
- .version = ver,
- };
-
+ .meta = pVnode->pMeta, .vnode = pVnode, .initTableReader = true, .initTqReader = true, .version = ver};
pHandle->snapshotVer = ver;
if (pHandle->execHandle.subType == TOPIC_SUB_TYPE__COLUMN) {
@@ -838,10 +467,10 @@ int32_t tqProcessSubscribeReq(STQ* pTq, int64_t sversion, char* msg, int32_t msg
&pHandle->execHandle.numOfCols, req.newConsumerId);
void* scanner = NULL;
qExtractStreamScanner(pHandle->execHandle.task, &scanner);
- pHandle->execHandle.pExecReader = qExtractReaderFromStreamScanner(scanner);
+ pHandle->execHandle.pTqReader = qExtractReaderFromStreamScanner(scanner);
} else if (pHandle->execHandle.subType == TOPIC_SUB_TYPE__DB) {
pHandle->pWalReader = walOpenReader(pVnode->pWal, NULL);
- pHandle->execHandle.pExecReader = tqOpenReader(pVnode);
+ pHandle->execHandle.pTqReader = tqOpenReader(pVnode);
pHandle->execHandle.execDb.pFilterOutTbUid =
taosHashInit(64, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), false, HASH_NO_LOCK);
@@ -860,8 +489,8 @@ int32_t tqProcessSubscribeReq(STQ* pTq, int64_t sversion, char* msg, int32_t msg
int64_t tbUid = *(int64_t*)taosArrayGet(tbUidList, i);
tqDebug("vgId:%d, idx %d, uid:%" PRId64, vgId, i, tbUid);
}
- pHandle->execHandle.pExecReader = tqOpenReader(pVnode);
- tqReaderSetTbUidList(pHandle->execHandle.pExecReader, tbUidList);
+ pHandle->execHandle.pTqReader = tqOpenReader(pVnode);
+ tqReaderSetTbUidList(pHandle->execHandle.pTqReader, tbUidList);
taosArrayDestroy(tbUidList);
buildSnapContext(handle.meta, handle.version, req.suid, pHandle->execHandle.subType, pHandle->fetchMeta,
@@ -897,7 +526,7 @@ int32_t tqProcessSubscribeReq(STQ* pTq, int64_t sversion, char* msg, int32_t msg
atomic_store_32(&pHandle->epoch, -1);
// remove if it has been register in the push manager, and return one empty block to consumer
- tqUnregisterPushEntry(pTq, req.subKey, (int32_t)strlen(req.subKey), pHandle->consumerId, true);
+ tqUnregisterPushHandle(pTq, req.subKey, (int32_t)strlen(req.subKey), pHandle->consumerId, true);
atomic_store_64(&pHandle->consumerId, req.newConsumerId);
atomic_add_fetch_32(&pHandle->epoch, 1);
@@ -919,16 +548,14 @@ int32_t tqProcessSubscribeReq(STQ* pTq, int64_t sversion, char* msg, int32_t msg
}
int32_t tqExpandTask(STQ* pTq, SStreamTask* pTask, int64_t ver) {
-#if 0
- if (pTask->taskLevel == TASK_LEVEL__AGG) {
- A(taosArrayGetSize(pTask->childEpInfo) != 0);
- }
-#endif
+ // todo extract method
+ char buf[128] = {0};
+ sprintf(buf, "0x%"PRIx64"-%d", pTask->id.streamId, pTask->id.taskId);
int32_t vgId = TD_VID(pTq->pVnode);
+ pTask->id.idStr = taosStrdup(buf);
pTask->refCnt = 1;
- pTask->schedStatus = TASK_SCHED_STATUS__INACTIVE;
-
+ pTask->status.schedStatus = TASK_SCHED_STATUS__INACTIVE;
pTask->inputQueue = streamQueueOpen(512 << 10);
pTask->outputQueue = streamQueueOpen(512 << 10);
@@ -939,11 +566,13 @@ int32_t tqExpandTask(STQ* pTq, SStreamTask* pTask, int64_t ver) {
pTask->inputStatus = TASK_INPUT_STATUS__NORMAL;
pTask->outputStatus = TASK_OUTPUT_STATUS__NORMAL;
pTask->pMsgCb = &pTq->pVnode->msgCb;
- pTask->startVer = ver;
+ pTask->pMeta = pTq->pStreamMeta;
// expand executor
if (pTask->fillHistory) {
- pTask->taskStatus = TASK_STATUS__WAIT_DOWNSTREAM;
+ pTask->status.taskStatus = TASK_STATUS__WAIT_DOWNSTREAM;
+ } else {
+ pTask->status.taskStatus = TASK_STATUS__RESTORE;
}
if (pTask->taskLevel == TASK_LEVEL__SOURCE) {
@@ -953,14 +582,10 @@ int32_t tqExpandTask(STQ* pTq, SStreamTask* pTask, int64_t ver) {
}
SReadHandle handle = {
- .meta = pTq->pVnode->pMeta,
- .vnode = pTq->pVnode,
- .initTqReader = 1,
- .pStateBackend = pTask->pState,
- };
+ .meta = pTq->pVnode->pMeta, .vnode = pTq->pVnode, .initTqReader = 1, .pStateBackend = pTask->pState};
- pTask->exec.executor = qCreateStreamExecTaskInfo(pTask->exec.qmsg, &handle, vgId);
- if (pTask->exec.executor == NULL) {
+ pTask->exec.pExecutor = qCreateStreamExecTaskInfo(pTask->exec.qmsg, &handle, vgId);
+ if (pTask->exec.pExecutor == NULL) {
return -1;
}
@@ -969,14 +594,12 @@ int32_t tqExpandTask(STQ* pTq, SStreamTask* pTask, int64_t ver) {
if (pTask->pState == NULL) {
return -1;
}
- SReadHandle mgHandle = {
- .vnode = NULL,
- .numOfVgroups = (int32_t)taosArrayGetSize(pTask->childEpInfo),
- .pStateBackend = pTask->pState,
- };
- pTask->exec.executor = qCreateStreamExecTaskInfo(pTask->exec.qmsg, &mgHandle, vgId);
- if (pTask->exec.executor == NULL) {
+ int32_t numOfVgroups = (int32_t)taosArrayGetSize(pTask->childEpInfo);
+ SReadHandle mgHandle = { .vnode = NULL, .numOfVgroups = numOfVgroups, .pStateBackend = pTask->pState};
+
+ pTask->exec.pExecutor = qCreateStreamExecTaskInfo(pTask->exec.qmsg, &mgHandle, vgId);
+ if (pTask->exec.pExecutor == NULL) {
return -1;
}
}
@@ -997,16 +620,31 @@ int32_t tqExpandTask(STQ* pTq, SStreamTask* pTask, int64_t ver) {
ver1 = info.skmVer;
}
- pTask->tbSink.pTSchema =
- tBuildTSchema(pTask->tbSink.pSchemaWrapper->pSchema, pTask->tbSink.pSchemaWrapper->nCols, ver1);
- if (pTask->tbSink.pTSchema == NULL) {
+ SSchemaWrapper* pschemaWrapper = pTask->tbSink.pSchemaWrapper;
+ pTask->tbSink.pTSchema = tBuildTSchema(pschemaWrapper->pSchema, pschemaWrapper->nCols, ver1);
+ if(pTask->tbSink.pTSchema == NULL) {
return -1;
}
}
+ if (pTask->taskLevel == TASK_LEVEL__SOURCE) {
+ pTask->exec.pTqReader = tqOpenReader(pTq->pVnode);
+ if (pTask->exec.pTqReader == NULL) {
+ terrno = TSDB_CODE_OUT_OF_MEMORY;
+ return -1;
+ }
+
+ pTask->exec.pWalReader = walOpenReader(pTq->pVnode->pWal, NULL);
+
+ pTask->freeFp = (_free_reader_fn_t)tqCloseReader;
+ SArray* pList = qGetQueriedTableListInfo(pTask->exec.pExecutor);
+ tqReaderAddTbUidList(pTask->exec.pTqReader, pList);
+ taosArrayDestroy(pList);
+ }
+
streamSetupTrigger(pTask);
- tqInfo("expand stream task on vg %d, task id %d, child id %d, level %d", vgId, pTask->taskId, pTask->selfChildId,
- pTask->taskLevel);
+ tqInfo("vgId:%d expand stream task, s-task:%s, ver:%" PRId64 " child id:%d, level:%d", vgId, pTask->id.idStr,
+ pTask->chkInfo.version, pTask->selfChildId, pTask->taskLevel);
return 0;
}
@@ -1029,8 +667,9 @@ int32_t tqProcessStreamTaskCheckReq(STQ* pTq, SRpcMsg* pMsg) {
.upstreamNodeId = req.upstreamNodeId,
.upstreamTaskId = req.upstreamTaskId,
};
+
SStreamTask* pTask = streamMetaAcquireTask(pTq->pStreamMeta, taskId);
- if (pTask && atomic_load_8(&pTask->taskStatus) == TASK_STATUS__NORMAL) {
+ if (pTask && atomic_load_8(&pTask->status.taskStatus) == TASK_STATUS__NORMAL) {
rsp.status = 1;
} else {
rsp.status = 0;
@@ -1113,17 +752,20 @@ int32_t tqProcessTaskDeployReq(STQ* pTq, int64_t sversion, char* msg, int32_t ms
SDecoder decoder;
tDecoderInit(&decoder, (uint8_t*)msg, msgLen);
- code = tDecodeSStreamTask(&decoder, pTask);
+ code = tDecodeStreamTask(&decoder, pTask);
if (code < 0) {
tDecoderClear(&decoder);
taosMemoryFree(pTask);
return -1;
}
+
tDecoderClear(&decoder);
// 2.save task
- code = streamMetaAddTask(pTq->pStreamMeta, sversion, pTask);
+ code = streamMetaAddDeployedTask(pTq->pStreamMeta, sversion, pTask);
if (code < 0) {
+ tqError("vgId:%d failed to add s-task:%s, total:%d", TD_VID(pTq->pVnode), pTask->id.idStr,
+ streamMetaGetNumOfTasks(pTq->pStreamMeta));
return -1;
}
@@ -1132,6 +774,8 @@ int32_t tqProcessTaskDeployReq(STQ* pTq, int64_t sversion, char* msg, int32_t ms
streamTaskCheckDownstream(pTask, sversion);
}
+ tqDebug("vgId:%d s-task:%s is deployed from mnd, status:%d, total:%d", TD_VID(pTq->pVnode), pTask->id.idStr,
+ pTask->status.taskStatus, streamMetaGetNumOfTasks(pTq->pStreamMeta));
return 0;
}
@@ -1147,7 +791,7 @@ int32_t tqProcessTaskRecover1Req(STQ* pTq, SRpcMsg* pMsg) {
}
// check param
- int64_t fillVer1 = pTask->startVer;
+ int64_t fillVer1 = pTask->chkInfo.version;
if (fillVer1 <= 0) {
streamMetaReleaseTask(pTq->pStreamMeta, pTask);
return -1;
@@ -1156,7 +800,7 @@ int32_t tqProcessTaskRecover1Req(STQ* pTq, SRpcMsg* pMsg) {
// do recovery step 1
streamSourceRecoverScanStep1(pTask);
- if (atomic_load_8(&pTask->taskStatus) == TASK_STATUS__DROPPING) {
+ if (atomic_load_8(&pTask->status.taskStatus) == TASK_STATUS__DROPPING) {
streamMetaReleaseTask(pTq->pStreamMeta, pTask);
return 0;
}
@@ -1171,7 +815,7 @@ int32_t tqProcessTaskRecover1Req(STQ* pTq, SRpcMsg* pMsg) {
streamMetaReleaseTask(pTq->pStreamMeta, pTask);
- if (atomic_load_8(&pTask->taskStatus) == TASK_STATUS__DROPPING) {
+ if (atomic_load_8(&pTask->status.taskStatus) == TASK_STATUS__DROPPING) {
return 0;
}
@@ -1213,7 +857,7 @@ int32_t tqProcessTaskRecover2Req(STQ* pTq, int64_t sversion, char* msg, int32_t
return -1;
}
- if (atomic_load_8(&pTask->taskStatus) == TASK_STATUS__DROPPING) {
+ if (atomic_load_8(&pTask->status.taskStatus) == TASK_STATUS__DROPPING) {
streamMetaReleaseTask(pTq->pStreamMeta, pTask);
return 0;
}
@@ -1332,7 +976,7 @@ int32_t tqProcessDelReq(STQ* pTq, void* pReq, int32_t len, int64_t ver) {
SStreamTask* pTask = *(SStreamTask**)pIter;
if (pTask->taskLevel != TASK_LEVEL__SOURCE) continue;
- qDebug("delete req enqueue stream task: %d, ver: %" PRId64, pTask->taskId, ver);
+ qDebug("delete req enqueue stream task: %d, ver: %" PRId64, pTask->id.taskId, ver);
if (!failed) {
SStreamRefDataBlock* pRefBlock = taosAllocateQitem(sizeof(SStreamRefDataBlock), DEF_QITEM, 0);
@@ -1341,8 +985,8 @@ int32_t tqProcessDelReq(STQ* pTq, void* pReq, int32_t len, int64_t ver) {
pRefBlock->dataRef = pRef;
atomic_add_fetch_32(pRefBlock->dataRef, 1);
- if (streamTaskInput(pTask, (SStreamQueueItem*)pRefBlock) < 0) {
- qError("stream task input del failed, task id %d", pTask->taskId);
+ if (tAppendDataToInputQueue(pTask, (SStreamQueueItem*)pRefBlock) < 0) {
+ qError("stream task input del failed, task id %d", pTask->id.taskId);
atomic_sub_fetch_32(pRef, 1);
taosFreeQitem(pRefBlock);
@@ -1350,7 +994,7 @@ int32_t tqProcessDelReq(STQ* pTq, void* pReq, int32_t len, int64_t ver) {
}
if (streamSchedExec(pTask) < 0) {
- qError("stream task launch failed, task id %d", pTask->taskId);
+ qError("stream task launch failed, task id %d", pTask->id.taskId);
continue;
}
@@ -1376,13 +1020,13 @@ int32_t tqProcessDelReq(STQ* pTq, void* pReq, int32_t len, int64_t ver) {
taosArrayPush(pStreamBlock->blocks, &block);
if (!failed) {
- if (streamTaskInput(pTask, (SStreamQueueItem*)pStreamBlock) < 0) {
- qError("stream task input del failed, task id %d", pTask->taskId);
+ if (tAppendDataToInputQueue(pTask, (SStreamQueueItem*)pStreamBlock) < 0) {
+ qError("stream task input del failed, task id %d", pTask->id.taskId);
continue;
}
if (streamSchedExec(pTask) < 0) {
- qError("stream task launch failed, task id %d", pTask->taskId);
+ qError("stream task launch failed, task id %d", pTask->id.taskId);
continue;
}
} else {
@@ -1395,18 +1039,32 @@ int32_t tqProcessDelReq(STQ* pTq, void* pReq, int32_t len, int64_t ver) {
return 0;
}
-int32_t tqProcessSubmitReq(STQ* pTq, SPackedData submit) {
- void* pIter = NULL;
- bool failed = false;
- SStreamDataSubmit2* pSubmit = NULL;
+static int32_t addSubmitBlockNLaunchTask(STqOffsetStore* pOffsetStore, SStreamTask* pTask, SStreamDataSubmit2* pSubmit,
+ const char* key, int64_t ver) {
+ doSaveTaskOffset(pOffsetStore, key, ver);
+ int32_t code = tqAddInputBlockNLaunchTask(pTask, (SStreamQueueItem*)pSubmit, ver);
- pSubmit = streamDataSubmitNew(submit);
+ // remove the offset, if all functions are completed successfully.
+ if (code == TSDB_CODE_SUCCESS) {
+ tqOffsetDelete(pOffsetStore, key);
+ }
+
+ return code;
+}
+
+int32_t tqProcessSubmitReq(STQ* pTq, SPackedData submit) {
+#if 0
+ void* pIter = NULL;
+ SStreamDataSubmit2* pSubmit = streamDataSubmitNew(submit, STREAM_INPUT__DATA_SUBMIT);
if (pSubmit == NULL) {
terrno = TSDB_CODE_OUT_OF_MEMORY;
tqError("failed to create data submit for stream since out of memory");
- failed = true;
+ saveOffsetForAllTasks(pTq, submit.ver);
+ return -1;
}
+ SArray* pInputQueueFullTasks = taosArrayInit(4, POINTER_BYTES);
+
while (1) {
pIter = taosHashIterate(pTq->pStreamMeta->pTasks, pIter);
if (pIter == NULL) {
@@ -1414,46 +1072,80 @@ int32_t tqProcessSubmitReq(STQ* pTq, SPackedData submit) {
}
SStreamTask* pTask = *(SStreamTask**)pIter;
- if (pTask->taskLevel != TASK_LEVEL__SOURCE) 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);
+ if (pTask->taskLevel != TASK_LEVEL__SOURCE) {
continue;
}
- tqDebug("data submit enqueue stream task: %d, ver: %" PRId64, pTask->taskId, submit.ver);
-
- if (!failed) {
- if (streamTaskInput(pTask, (SStreamQueueItem*)pSubmit) < 0) {
- tqError("stream task input failed, task id %d", pTask->taskId);
- continue;
- }
-
- if (streamSchedExec(pTask) < 0) {
- tqError("stream task launch failed, task id %d", pTask->taskId);
- continue;
- }
- } else {
- streamTaskInputFail(pTask);
+ if (pTask->status.taskStatus == TASK_STATUS__RECOVER_PREPARE || pTask->status.taskStatus == TASK_STATUS__WAIT_DOWNSTREAM) {
+ tqDebug("stream task:%d skip push data, not ready for processing, status %d", pTask->id.taskId,
+ pTask->status.taskStatus);
+ continue;
}
+
+ // check if offset value exists
+ char key[128] = {0};
+ createStreamTaskOffsetKey(key, pTask->id.streamId, pTask->id.taskId);
+
+ if (tInputQueueIsFull(pTask)) {
+ STqOffset* pOffset = tqOffsetRead(pTq->pOffsetStore, key);
+
+ int64_t ver = submit.ver;
+ if (pOffset == NULL) {
+ doSaveTaskOffset(pTq->pOffsetStore, key, submit.ver);
+ } else {
+ ver = pOffset->val.version;
+ }
+
+ tqDebug("s-task:%s input queue is full, discard submit block, ver:%" PRId64, pTask->id.idStr, ver);
+ taosArrayPush(pInputQueueFullTasks, &pTask);
+ continue;
+ }
+
+ // check if offset value exists
+ STqOffset* pOffset = tqOffsetRead(pTq->pOffsetStore, key);
+ ASSERT(pOffset == NULL);
+
+ addSubmitBlockNLaunchTask(pTq->pOffsetStore, pTask, pSubmit, key, submit.ver);
}
- if (pSubmit) {
- streamDataSubmitRefDec(pSubmit);
- taosFreeQitem(pSubmit);
- }
+ streamDataSubmitDestroy(pSubmit);
+ taosFreeQitem(pSubmit);
+#endif
- return failed ? -1 : 0;
+ tqStartStreamTasks(pTq);
+ return 0;
}
int32_t tqProcessTaskRunReq(STQ* pTq, SRpcMsg* pMsg) {
SStreamTaskRunReq* pReq = pMsg->pCont;
- int32_t taskId = pReq->taskId;
- SStreamTask* pTask = streamMetaAcquireTask(pTq->pStreamMeta, taskId);
- if (pTask) {
- streamProcessRunReq(pTask);
+
+ int32_t taskId = pReq->taskId;
+ int32_t vgId = TD_VID(pTq->pVnode);
+
+ if (taskId == WAL_READ_TASKS_ID) { // all tasks are extracted submit data from the wal
+ tqStreamTasksScanWal(pTq);
+ return 0;
+ }
+
+ SStreamTask* pTask = streamMetaAcquireTaskEx(pTq->pStreamMeta, taskId);
+ if (pTask != NULL) {
+ if (pTask->status.taskStatus == TASK_STATUS__NORMAL) {
+ tqDebug("vgId:%d s-task:%s start to process run req", vgId, pTask->id.idStr);
+ streamProcessRunReq(pTask);
+ } else if (pTask->status.taskStatus == TASK_STATUS__RESTORE) {
+ tqDebug("vgId:%d s-task:%s start to process block from wal, last chk point:%" PRId64, vgId,
+ pTask->id.idStr, pTask->chkInfo.version);
+ streamProcessRunReq(pTask);
+ } else {
+ tqDebug("vgId:%d s-task:%s ignore run req since not in ready state", vgId, pTask->id.idStr);
+ }
+
streamMetaReleaseTask(pTq->pStreamMeta, pTask);
+
+ tqStartStreamTasks(pTq);
return 0;
} else {
+ tqError("vgId:%d failed to found s-task, taskId:%d", vgId, taskId);
return -1;
}
}
@@ -1466,14 +1158,10 @@ int32_t tqProcessTaskDispatchReq(STQ* pTq, SRpcMsg* pMsg, bool exec) {
SDecoder decoder;
tDecoderInit(&decoder, (uint8_t*)msgBody, msgLen);
tDecodeStreamDispatchReq(&decoder, &req);
- int32_t taskId = req.taskId;
- SStreamTask* pTask = streamMetaAcquireTask(pTq->pStreamMeta, taskId);
+ SStreamTask* pTask = streamMetaAcquireTask(pTq->pStreamMeta, req.taskId);
if (pTask) {
- SRpcMsg rsp = {
- .info = pMsg->info,
- .code = 0,
- };
+ SRpcMsg rsp = { .info = pMsg->info, .code = 0 };
streamProcessDispatchReq(pTask, &req, &rsp, exec);
streamMetaReleaseTask(pTq->pStreamMeta, pTask);
return 0;
@@ -1486,7 +1174,7 @@ int32_t tqProcessTaskDispatchRsp(STQ* pTq, SRpcMsg* pMsg) {
SStreamDispatchRsp* pRsp = POINTER_SHIFT(pMsg->pCont, sizeof(SMsgHead));
int32_t taskId = ntohl(pRsp->upstreamTaskId);
SStreamTask* pTask = streamMetaAcquireTask(pTq->pStreamMeta, taskId);
- tqDebug("recv dispatch rsp, code: %x", pMsg->code);
+ tqDebug("recv dispatch rsp, code:%x", pMsg->code);
if (pTask) {
streamProcessDispatchRsp(pTask, pRsp, pMsg->code);
streamMetaReleaseTask(pTq->pStreamMeta, pTask);
@@ -1514,10 +1202,7 @@ int32_t tqProcessTaskRetrieveReq(STQ* pTq, SRpcMsg* pMsg) {
int32_t taskId = req.dstTaskId;
SStreamTask* pTask = streamMetaAcquireTask(pTq->pStreamMeta, taskId);
if (pTask) {
- SRpcMsg rsp = {
- .info = pMsg->info,
- .code = 0,
- };
+ SRpcMsg rsp = { .info = pMsg->info, .code = 0 };
streamProcessRetrieveReq(pTask, &req, &rsp);
streamMetaReleaseTask(pTq->pStreamMeta, pTask);
tDeleteStreamRetrieveReq(&req);
@@ -1553,15 +1238,14 @@ int32_t vnodeEnqueueStreamMsg(SVnode* pVnode, SRpcMsg* pMsg) {
SStreamTask* pTask = streamMetaAcquireTask(pTq->pStreamMeta, taskId);
if (pTask) {
- SRpcMsg rsp = {
- .info = pMsg->info,
- .code = 0,
- };
+ SRpcMsg rsp = { .info = pMsg->info, .code = 0 };
streamProcessDispatchReq(pTask, &req, &rsp, false);
streamMetaReleaseTask(pTq->pStreamMeta, pTask);
rpcFreeCont(pMsg->pCont);
taosFreeQitem(pMsg);
return 0;
+ } else {
+ tDeleteStreamDispatchReq(&req);
}
code = TSDB_CODE_STREAM_TASK_NOT_EXIST;
@@ -1571,10 +1255,7 @@ FAIL:
SMsgHead* pRspHead = rpcMallocCont(sizeof(SMsgHead) + sizeof(SStreamDispatchRsp));
if (pRspHead == NULL) {
- SRpcMsg rsp = {
- .code = TSDB_CODE_OUT_OF_MEMORY,
- .info = pMsg->info,
- };
+ SRpcMsg rsp = { .code = TSDB_CODE_OUT_OF_MEMORY, .info = pMsg->info };
tqDebug("send dispatch error rsp, code: %x", code);
tmsgSendRsp(&rsp);
rpcFreeCont(pMsg->pCont);
@@ -1592,11 +1273,7 @@ FAIL:
pRsp->inputStatus = TASK_OUTPUT_STATUS__NORMAL;
SRpcMsg rsp = {
- .code = code,
- .info = pMsg->info,
- .contLen = sizeof(SMsgHead) + sizeof(SStreamDispatchRsp),
- .pCont = pRspHead,
- };
+ .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);
@@ -1605,3 +1282,40 @@ FAIL:
}
int32_t tqCheckLogInWal(STQ* pTq, int64_t sversion) { return sversion <= pTq->walLogLastVer; }
+
+int32_t tqStartStreamTasks(STQ* pTq) {
+ int32_t vgId = TD_VID(pTq->pVnode);
+
+ SStreamMeta* pMeta = pTq->pStreamMeta;
+ taosWLockLatch(&pMeta->lock);
+ pMeta->walScan += 1;
+
+ if (pMeta->walScan > 1) {
+ tqDebug("vgId:%d wal read task has been launched, remain scan times:%d", vgId, pMeta->walScan);
+ taosWUnLockLatch(&pTq->pStreamMeta->lock);
+ return 0;
+ }
+
+ SStreamTaskRunReq* pRunReq = rpcMallocCont(sizeof(SStreamTaskRunReq));
+ if (pRunReq == NULL) {
+ terrno = TSDB_CODE_OUT_OF_MEMORY;
+ tqError("vgId:%d failed restore stream tasks, code:%s", vgId, terrstr(terrno));
+ taosWUnLockLatch(&pTq->pStreamMeta->lock);
+ return -1;
+ }
+
+ int32_t numOfTasks = taosHashGetSize(pTq->pStreamMeta->pTasks);
+
+ tqInfo("vgId:%d start wal scan stream tasks, tasks:%d", vgId, numOfTasks);
+ initOffsetForAllRestoreTasks(pTq);
+
+ pRunReq->head.vgId = vgId;
+ pRunReq->streamId = 0;
+ pRunReq->taskId = WAL_READ_TASKS_ID;
+
+ SRpcMsg msg = {.msgType = TDMT_STREAM_TASK_RUN, .pCont = pRunReq, .contLen = sizeof(SStreamTaskRunReq)};
+ tmsgPutToQueue(&pTq->pVnode->msgCb, STREAM_QUEUE, &msg);
+ taosWUnLockLatch(&pTq->pStreamMeta->lock);
+
+ return 0;
+}
diff --git a/source/dnode/vnode/src/tq/tqCommit.c b/source/dnode/vnode/src/tq/tqCommit.c
index 7fc66c4919..0f5daa31ad 100644
--- a/source/dnode/vnode/src/tq/tqCommit.c
+++ b/source/dnode/vnode/src/tq/tqCommit.c
@@ -16,10 +16,13 @@
#include "tq.h"
int tqCommit(STQ* pTq) {
+#if 0
+ // stream meta commit does not be aligned to the vnode commit
if (streamMetaCommit(pTq->pStreamMeta) < 0) {
tqError("vgId:%d, failed to commit stream meta since %s", TD_VID(pTq->pVnode), terrstr());
return -1;
}
+#endif
return tqOffsetCommitFile(pTq->pOffsetStore);
}
diff --git a/source/dnode/vnode/src/tq/tqMeta.c b/source/dnode/vnode/src/tq/tqMeta.c
index 7b0cdab2f8..cd8cefb307 100644
--- a/source/dnode/vnode/src/tq/tqMeta.c
+++ b/source/dnode/vnode/src/tq/tqMeta.c
@@ -320,15 +320,15 @@ int32_t tqMetaRestoreHandle(STQ* pTq) {
code = -1;
goto end;
}
- handle.execHandle.pExecReader = qExtractReaderFromStreamScanner(scanner);
- if (handle.execHandle.pExecReader == NULL) {
+ handle.execHandle.pTqReader = qExtractReaderFromStreamScanner(scanner);
+ if (handle.execHandle.pTqReader == NULL) {
tqError("cannot extract exec reader for %s", handle.subKey);
code = -1;
goto end;
}
} else if (handle.execHandle.subType == TOPIC_SUB_TYPE__DB) {
handle.pWalReader = walOpenReader(pTq->pVnode->pWal, NULL);
- handle.execHandle.pExecReader = tqOpenReader(pTq->pVnode);
+ handle.execHandle.pTqReader = tqOpenReader(pTq->pVnode);
buildSnapContext(reader.meta, reader.version, 0, handle.execHandle.subType, handle.fetchMeta,
(SSnapContext**)(&reader.sContext));
@@ -343,8 +343,8 @@ int32_t tqMetaRestoreHandle(STQ* pTq) {
int64_t tbUid = *(int64_t*)taosArrayGet(tbUidList, i);
tqDebug("vgId:%d, idx %d, uid:%" PRId64, vgId, i, tbUid);
}
- handle.execHandle.pExecReader = tqOpenReader(pTq->pVnode);
- tqReaderSetTbUidList(handle.execHandle.pExecReader, tbUidList);
+ handle.execHandle.pTqReader = tqOpenReader(pTq->pVnode);
+ tqReaderSetTbUidList(handle.execHandle.pTqReader, tbUidList);
taosArrayDestroy(tbUidList);
buildSnapContext(reader.meta, reader.version, handle.execHandle.execTb.suid, handle.execHandle.subType,
diff --git a/source/dnode/vnode/src/tq/tqOffset.c b/source/dnode/vnode/src/tq/tqOffset.c
index 66d1ac2c7e..e8051a1406 100644
--- a/source/dnode/vnode/src/tq/tqOffset.c
+++ b/source/dnode/vnode/src/tq/tqOffset.c
@@ -128,31 +128,35 @@ int32_t tqOffsetDelete(STqOffsetStore* pStore, const char* subscribeKey) {
}
int32_t tqOffsetCommitFile(STqOffsetStore* pStore) {
- if (!pStore->needCommit) return 0;
+ if (!pStore->needCommit) {
+ return 0;
+ }
+
// TODO file name should be with a newer version
char* fname = tqOffsetBuildFName(pStore->pTq->path, 0);
TdFilePtr pFile = taosOpenFile(fname, TD_FILE_CREATE | TD_FILE_WRITE | TD_FILE_APPEND);
if (pFile == NULL) {
terrno = TAOS_SYSTEM_ERROR(errno);
-
- int32_t err = terrno;
- const char* errStr = tstrerror(err);
- int32_t sysErr = errno;
- const char* sysErrStr = strerror(errno);
- tqError("vgId:%d, cannot open file %s when commit offset since %s", pStore->pTq->pVnode->config.vgId, fname,
- sysErrStr);
+ const char* err = strerror(errno);
+ tqError("vgId:%d, failed to open offset file %s, since %s", TD_VID(pStore->pTq->pVnode), fname, err);
taosMemoryFree(fname);
return -1;
}
+
taosMemoryFree(fname);
+
void* pIter = NULL;
while (1) {
pIter = taosHashIterate(pStore->pHash, pIter);
- if (pIter == NULL) break;
+ if (pIter == NULL) {
+ break;
+ }
+
STqOffset* pOffset = (STqOffset*)pIter;
int32_t bodyLen;
int32_t code;
tEncodeSize(tEncodeSTqOffset, pOffset, bodyLen, code);
+
if (code < 0) {
taosHashCancelIterate(pStore->pHash, pIter);
return -1;
@@ -166,6 +170,7 @@ int32_t tqOffsetCommitFile(STqOffsetStore* pStore) {
SEncoder encoder;
tEncoderInit(&encoder, abuf, bodyLen);
tEncodeSTqOffset(&encoder, pOffset);
+
// write file
int64_t writeLen;
if ((writeLen = taosWriteFile(pFile, buf, totLen)) != totLen) {
@@ -174,8 +179,10 @@ int32_t tqOffsetCommitFile(STqOffsetStore* pStore) {
taosMemoryFree(buf);
return -1;
}
+
taosMemoryFree(buf);
}
+
// close and rename file
taosCloseFile(&pFile);
pStore->needCommit = 0;
diff --git a/source/dnode/vnode/src/tq/tqPush.c b/source/dnode/vnode/src/tq/tqPush.c
index d55b533f8a..7a1a6b7454 100644
--- a/source/dnode/vnode/src/tq/tqPush.c
+++ b/source/dnode/vnode/src/tq/tqPush.c
@@ -30,7 +30,7 @@ static int32_t tqLoopExecFromQueue(STQ* pTq, STqHandle* pHandle, SStreamDataSubm
// update processed
atomic_store_64(&pHandle->pushHandle.processedVer, pSubmit->ver);
streamQueueProcessSuccess(&pHandle->pushHandle.inputQ);
- streamDataSubmitRefDec(pSubmit);
+ streamDataSubmitDestroy(pSubmit);
if (pRsp->blockNum > 0) {
*ppSubmit = pSubmit;
return 0;
@@ -58,7 +58,7 @@ int32_t tqExecFromInputQ(STQ* pTq, STqHandle* pHandle) {
}
while (pHandle->pushHandle.processedVer > pSubmit->ver + 1) {
streamQueueProcessSuccess(&pHandle->pushHandle.inputQ);
- streamDataSubmitRefDec(pSubmit);
+ streamDataSubmitDestroy(pSubmit);
pSubmit = streamQueueNextItem(&pHandle->pushHandle.inputQ);
if (pSubmit == NULL) break;
}
@@ -120,7 +120,7 @@ int32_t tqPreparePush(STQ* pTq, STqHandle* pHandle, int64_t reqId, const SRpcHan
int32_t tqEnqueue(STqHandle* pHandle, SStreamDataSubmit* pSubmit) {
int8_t inputStatus = atomic_load_8(&pHandle->pushHandle.inputStatus);
if (inputStatus == TASK_INPUT_STATUS__NORMAL) {
- SStreamDataSubmit* pSubmitClone = streamSubmitRefClone(pSubmit);
+ SStreamDataSubmit* pSubmitClone = streamSubmitBlockClone(pSubmit);
if (pSubmitClone == NULL) {
return -1;
}
@@ -212,28 +212,13 @@ typedef struct {
} SItem;
static void recordPushedEntry(SArray* cachedKey, void* pIter);
+static void doRemovePushedEntry(SArray* pCachedKeys, STQ* pTq);
static void freeItem(void* param) {
SItem* p = (SItem*)param;
taosMemoryFree(p->pKey);
}
-static void doRemovePushedEntry(SArray* pCachedKeys, STQ* pTq) {
- int32_t vgId = TD_VID(pTq->pVnode);
- int32_t numOfKeys = (int32_t)taosArrayGetSize(pCachedKeys);
-
- for (int32_t i = 0; i < numOfKeys; i++) {
- SItem* pItem = taosArrayGet(pCachedKeys, i);
- if (taosHashRemove(pTq->pPushMgr, pItem->pKey, pItem->keyLen) != 0) {
- tqError("vgId:%d, tq push hash remove key error, key: %s", vgId, (char*)pItem->pKey);
- }
- }
-
- if (numOfKeys > 0) {
- tqDebug("vgId:%d, pushed %d items and remain:%d", vgId, numOfKeys, (int32_t)taosHashGetSize(pTq->pPushMgr));
- }
-}
-
static void doPushDataForEntry(void* pIter, STqExecHandle* pExec, STQ* pTq, int64_t ver, int32_t vgId, char* pData,
int32_t dataLen, SArray* pCachedKey) {
STqPushEntry* pPushEntry = *(STqPushEntry**)pIter;
@@ -253,7 +238,7 @@ static void doPushDataForEntry(void* pIter, STqExecHandle* pExec, STQ* pTq, int6
if (qStreamSetScanMemData(pTaskInfo, submit) != 0) {
return;
}
-
+ qStreamSetOpen(pTaskInfo);
// here start to scan submit block to extract the subscribed data
int32_t totalRows = 0;
@@ -338,24 +323,34 @@ int32_t tqPushMsg(STQ* pTq, void* msg, int32_t msgLen, tmsg_t msgType, int64_t v
taosWUnLockLatch(&pTq->lock);
}
- // push data for stream processing
- if (!tsDisableStream && vnodeIsRoleLeader(pTq->pVnode)) {
+ tqDebug("handle submit, restore:%d, size:%d", pTq->pVnode->restored, (int)taosHashGetSize(pTq->pStreamMeta->pTasks));
+
+ // push data for stream processing:
+ // 1. the vnode has already been restored.
+ // 2. the vnode should be the leader.
+ // 3. the stream is not suspended yet.
+ if (!tsDisableStream && vnodeIsRoleLeader(pTq->pVnode) && pTq->pVnode->restored) {
if (taosHashGetSize(pTq->pStreamMeta->pTasks) == 0) {
return 0;
}
if (msgType == TDMT_VND_SUBMIT) {
+#if 0
void* data = taosMemoryMalloc(len);
if (data == NULL) {
+ // todo: for all stream in this vnode, keep this offset in the offset files, and wait for a moment, and then retry
terrno = TSDB_CODE_OUT_OF_MEMORY;
- tqError("failed to copy data for stream since out of memory");
+ tqError("vgId:%d, failed to copy submit data for stream processing, since out of memory", vgId);
return -1;
}
memcpy(data, pReq, len);
SPackedData submit = {.msgStr = data, .msgLen = len, .ver = ver};
- tqDebug("tq copy write msg %p %d %" PRId64 " from %p", data, len, ver, pReq);
+ tqDebug("vgId:%d tq copy submit msg:%p len:%d ver:%" PRId64 " from %p for stream", vgId, data, len, ver, pReq);
+ tqProcessSubmitReq(pTq, submit);
+#endif
+ SPackedData submit = {0};
tqProcessSubmitReq(pTq, submit);
}
@@ -367,14 +362,7 @@ int32_t tqPushMsg(STQ* pTq, void* msg, int32_t msgLen, tmsg_t msgType, int64_t v
return 0;
}
-void recordPushedEntry(SArray* cachedKey, void* pIter) {
- size_t kLen = 0;
- void* key = taosHashGetKey(pIter, &kLen);
- SItem item = {.pKey = strndup(key, kLen), .keyLen = kLen};
- taosArrayPush(cachedKey, &item);
-}
-
-int32_t tqRegisterPushEntry(STQ* pTq, void* pHandle, const SMqPollReq* pRequest, SRpcMsg* pRpcMsg, SMqDataRsp* pDataRsp,
+int32_t tqRegisterPushHandle(STQ* pTq, void* pHandle, const SMqPollReq* pRequest, SRpcMsg* pRpcMsg, SMqDataRsp* pDataRsp,
int32_t type) {
uint64_t consumerId = pRequest->consumerId;
int32_t vgId = TD_VID(pTq->pVnode);
@@ -411,7 +399,7 @@ int32_t tqRegisterPushEntry(STQ* pTq, void* pHandle, const SMqPollReq* pRequest,
return 0;
}
-int32_t tqUnregisterPushEntry(STQ* pTq, const char* pKey, int32_t keyLen, uint64_t consumerId, bool rspConsumer) {
+int32_t tqUnregisterPushHandle(STQ* pTq, const char* pKey, int32_t keyLen, uint64_t consumerId, bool rspConsumer) {
int32_t vgId = TD_VID(pTq->pVnode);
STqPushEntry** pEntry = taosHashGet(pTq->pPushMgr, pKey, keyLen);
@@ -431,3 +419,26 @@ int32_t tqUnregisterPushEntry(STQ* pTq, const char* pKey, int32_t keyLen, uint64
return 0;
}
+
+void recordPushedEntry(SArray* cachedKey, void* pIter) {
+ size_t kLen = 0;
+ void* key = taosHashGetKey(pIter, &kLen);
+ SItem item = {.pKey = strndup(key, kLen), .keyLen = kLen};
+ taosArrayPush(cachedKey, &item);
+}
+
+void doRemovePushedEntry(SArray* pCachedKeys, STQ* pTq) {
+ int32_t vgId = TD_VID(pTq->pVnode);
+ int32_t numOfKeys = (int32_t)taosArrayGetSize(pCachedKeys);
+
+ for (int32_t i = 0; i < numOfKeys; i++) {
+ SItem* pItem = taosArrayGet(pCachedKeys, i);
+ if (taosHashRemove(pTq->pPushMgr, pItem->pKey, pItem->keyLen) != 0) {
+ tqError("vgId:%d, tq push hash remove key error, key: %s", vgId, (char*)pItem->pKey);
+ }
+ }
+
+ if (numOfKeys > 0) {
+ tqDebug("vgId:%d, pushed %d items and remain:%d", vgId, numOfKeys, (int32_t)taosHashGetSize(pTq->pPushMgr));
+ }
+}
diff --git a/source/dnode/vnode/src/tq/tqRead.c b/source/dnode/vnode/src/tq/tqRead.c
index 90ff1f8a84..69624f4d10 100644
--- a/source/dnode/vnode/src/tq/tqRead.c
+++ b/source/dnode/vnode/src/tq/tqRead.c
@@ -113,7 +113,7 @@ bool isValValidForTable(STqHandle* pHandle, SWalCont* pHead) {
}
SMetaReader mr = {0};
- metaReaderInit(&mr, pHandle->execHandle.pExecReader->pVnodeMeta, 0);
+ metaReaderInit(&mr, pHandle->execHandle.pTqReader->pVnodeMeta, 0);
if (metaGetTableEntryByName(&mr, req.tbName) < 0) {
metaReaderClear(&mr);
@@ -262,8 +262,6 @@ STqReader* tqOpenReader(SVnode* pVnode) {
}
pReader->pVnodeMeta = pVnode->pMeta;
- /*pReader->pMsg = NULL;*/
- pReader->ver = -1;
pReader->pColIdList = NULL;
pReader->cachedSchemaVer = 0;
pReader->cachedSchemaSuid = 0;
@@ -290,163 +288,112 @@ void tqCloseReader(STqReader* pReader) {
}
// free hash
taosHashCleanup(pReader->tbIdHash);
+ tDestroySSubmitReq2(&pReader->submit, TSDB_MSG_FLG_DECODE);
taosMemoryFree(pReader);
}
int32_t tqSeekVer(STqReader* pReader, int64_t ver, const char* id) {
- // todo set the correct vgId
- tqDebug("tmq poll: wal seek to version:%"PRId64" %s", ver, id);
if (walReadSeekVer(pReader->pWalReader, ver) < 0) {
- tqDebug("tmq poll: wal reader failed to seek to ver:%"PRId64" code:%s, %s", ver, tstrerror(terrno), id);
return -1;
- } else {
- tqDebug("tmq poll: wal reader seek to ver:%"PRId64" %s", ver, id);
- return 0;
}
+ tqDebug("wal reader seek to ver:%"PRId64" %s", ver, id);
+ return 0;
}
-int32_t tqNextBlock(STqReader* pReader, SFetchRet* ret) {
- bool fromProcessedMsg = pReader->msg2.msgStr != NULL;
+int32_t extractSubmitMsgFromWal(SWalReader* pReader, SPackedData* pPackedData) {
+ if (walNextValidMsg(pReader) < 0) {
+ return -1;
+ }
+ void* pBody = POINTER_SHIFT(pReader->pHead->head.body, sizeof(SSubmitReq2Msg));
+ int32_t len = pReader->pHead->head.bodyLen - sizeof(SSubmitReq2Msg);
+ int64_t ver = pReader->pHead->head.version;
+
+ void* data = taosMemoryMalloc(len);
+ if (data == NULL) {
+ // todo: for all stream in this vnode, keep this offset in the offset files, and wait for a moment, and then retry
+ terrno = TSDB_CODE_OUT_OF_MEMORY;
+ tqError("vgId:%d, failed to copy submit data for stream processing, since out of memory", 0);
+ return -1;
+ }
+
+ memcpy(data, pBody, len);
+ *pPackedData = (SPackedData){.ver = ver, .msgLen = len, .msgStr = data};
+ return 0;
+}
+
+void tqNextBlock(STqReader* pReader, SFetchRet* ret) {
while (1) {
- if (!fromProcessedMsg) {
+ if (pReader->msg2.msgStr == NULL) {
if (walNextValidMsg(pReader->pWalReader) < 0) {
-// pReader->ver = pReader->pWalReader->curVersion - pReader->pWalReader->curStopped;
- if(pReader->pWalReader->curInvalid == 0){
- pReader->ver = pReader->pWalReader->curVersion - pReader->pWalReader->curStopped;
- }else{
- pReader->ver = walGetLastVer(pReader->pWalReader->pWal);
- }
- ret->offset.type = TMQ_OFFSET__LOG;
-
- ret->offset.version = pReader->ver;
ret->fetchType = FETCH_TYPE__NONE;
- tqDebug("return offset %" PRId64 ", no more valid msg in wal", ret->offset.version);
- return -1;
+ return;
}
- void* body = POINTER_SHIFT(pReader->pWalReader->pHead->head.body, sizeof(SSubmitReq2Msg));
+ void* pBody = POINTER_SHIFT(pReader->pWalReader->pHead->head.body, sizeof(SSubmitReq2Msg));
int32_t bodyLen = pReader->pWalReader->pHead->head.bodyLen - sizeof(SSubmitReq2Msg);
int64_t ver = pReader->pWalReader->pHead->head.version;
- tqReaderSetSubmitReq2(pReader, body, bodyLen, ver);
+ tqReaderSetSubmitMsg(pReader, pBody, bodyLen, ver);
}
- while (tqNextDataBlock2(pReader)) {
- // TODO mem free
+ while (tqNextDataBlock(pReader)) {
memset(&ret->data, 0, sizeof(SSDataBlock));
int32_t code = tqRetrieveDataBlock2(&ret->data, pReader, NULL);
if (code != 0 || ret->data.info.rows == 0) {
continue;
}
- ret->fetchType = FETCH_TYPE__DATA;
- tqDebug("return data rows %" PRId64, ret->data.info.rows);
- return 0;
- }
- if (fromProcessedMsg) {
- ret->offset.type = TMQ_OFFSET__LOG;
- ret->offset.version = pReader->ver;
- ret->fetchType = FETCH_TYPE__SEP;
- tqDebug("return offset %" PRId64 ", processed finish", ret->offset.version);
- return 0;
+ ret->fetchType = FETCH_TYPE__DATA;
+ return;
}
}
}
-#if 0
-int32_t tqReaderSetDataMsg(STqReader* pReader, const SSubmitReq* pMsg, int64_t ver) {
- pReader->pMsg = pMsg;
-
-// if (tInitSubmitMsgIter(pMsg, &pReader->msgIter) < 0) return -1;
-// while (true) {
-// if (tGetSubmitMsgNext(&pReader->msgIter, &pReader->pBlock) < 0) return -1;
-// tqDebug("submitnext vgId:%d, block:%p, dataLen:%d, len:%d, uid:%"PRId64, pWalReader->pWal->cfg.vgId, pReader->pBlock, pReader->msgIter.dataLen,
-// pReader->msgIter.len, pReader->msgIter.uid);
-// if (pReader->pBlock == NULL) break;
-// }
-
- if (tInitSubmitMsgIter(pMsg, &pReader->msgIter) < 0) return -1;
- pReader->ver = ver;
- memset(&pReader->blkIter, 0, sizeof(SSubmitBlkIter));
- return 0;
-}
-#endif
-
-int32_t tqReaderSetSubmitReq2(STqReader* pReader, void* msgStr, int32_t msgLen, int64_t ver) {
- ASSERT(pReader->msg2.msgStr == NULL && msgStr && msgLen && (ver >= 0));
-
+int32_t tqReaderSetSubmitMsg(STqReader* pReader, void* msgStr, int32_t msgLen, int64_t ver) {
pReader->msg2.msgStr = msgStr;
pReader->msg2.msgLen = msgLen;
pReader->msg2.ver = ver;
- pReader->ver = ver;
tqDebug("tq reader set msg %p %d", msgStr, msgLen);
-
- if (pReader->setMsg == 0) {
- SDecoder decoder;
- tDecoderInit(&decoder, pReader->msg2.msgStr, pReader->msg2.msgLen);
- if (tDecodeSSubmitReq2(&decoder, &pReader->submit) < 0) {
- ASSERT(0);
- }
+ SDecoder decoder;
+ tDecoderInit(&decoder, pReader->msg2.msgStr, pReader->msg2.msgLen);
+ if (tDecodeSSubmitReq2(&decoder, &pReader->submit) < 0) {
tDecoderClear(&decoder);
- pReader->setMsg = 1;
+ tqError("DecodeSSubmitReq2 error, msgLen:%d, ver:%"PRId64, msgLen, ver);
+ return -1;
}
+ tDecoderClear(&decoder);
return 0;
}
-#if 0
bool tqNextDataBlock(STqReader* pReader) {
- if (pReader->pMsg == NULL) return false;
- while (1) {
- if (tGetSubmitMsgNext(&pReader->msgIter, &pReader->pBlock) < 0) {
- return false;
- }
- if (pReader->pBlock == NULL) {
- pReader->pMsg = NULL;
- return false;
- }
-
- if (pReader->tbIdHash == NULL) {
- return true;
- }
- void* ret = taosHashGet(pReader->tbIdHash, &pReader->msgIter.uid, sizeof(int64_t));
- /*tqDebug("search uid %" PRId64, pHandle->msgIter.uid);*/
- if (ret != NULL) {
- /*tqDebug("find uid %" PRId64, pHandle->msgIter.uid);*/
- return true;
- }
- }
- return false;
-}
-#endif
-
-bool tqNextDataBlock2(STqReader* pReader) {
if (pReader->msg2.msgStr == NULL) {
return false;
}
- ASSERT(pReader->setMsg == 1);
-
- tqDebug("tq reader next data block %p, %d %" PRId64 " %d", pReader->msg2.msgStr, pReader->msg2.msgLen,
- pReader->msg2.ver, pReader->nextBlk);
-
int32_t blockSz = taosArrayGetSize(pReader->submit.aSubmitTbData);
while (pReader->nextBlk < blockSz) {
- SSubmitTbData* pSubmitTbData = taosArrayGet(pReader->submit.aSubmitTbData, pReader->nextBlk);
- ASSERT(pSubmitTbData->uid);
+ tqDebug("tq reader next data block %p, %d %" PRId64 " %d", pReader->msg2.msgStr, pReader->msg2.msgLen,
+ pReader->msg2.ver, pReader->nextBlk);
- if (pReader->tbIdHash == NULL) return true;
+ SSubmitTbData* pSubmitTbData = taosArrayGet(pReader->submit.aSubmitTbData, pReader->nextBlk);
+ if (pReader->tbIdHash == NULL) {
+ return true;
+ }
void* ret = taosHashGet(pReader->tbIdHash, &pSubmitTbData->uid, sizeof(int64_t));
if (ret != NULL) {
+ tqDebug("tq reader block found, ver:%"PRId64", uid:%"PRId64, pReader->msg2.ver, pSubmitTbData->uid);
return true;
+ } else {
+ tqDebug("tq reader discard block, uid:%"PRId64", continue", pSubmitTbData->uid);
}
+
pReader->nextBlk++;
}
tDestroySSubmitReq2(&pReader->submit, TSDB_MSG_FLG_DECODE);
- pReader->setMsg = 0;
pReader->nextBlk = 0;
pReader->msg2.msgStr = NULL;
@@ -455,7 +402,6 @@ bool tqNextDataBlock2(STqReader* pReader) {
bool tqNextDataBlockFilterOut2(STqReader* pReader, SHashObj* filterOutUids) {
if (pReader->msg2.msgStr == NULL) return false;
- ASSERT(pReader->setMsg == 1);
int32_t blockSz = taosArrayGetSize(pReader->submit.aSubmitTbData);
while (pReader->nextBlk < blockSz) {
@@ -470,7 +416,6 @@ bool tqNextDataBlockFilterOut2(STqReader* pReader, SHashObj* filterOutUids) {
}
tDestroySSubmitReq2(&pReader->submit, TSDB_MSG_FLG_DECODE);
- pReader->setMsg = 0;
pReader->nextBlk = 0;
pReader->msg2.msgStr = NULL;
@@ -506,67 +451,15 @@ int32_t tqMaskBlock(SSchemaWrapper* pDst, SSDataBlock* pBlock, const SSchemaWrap
return 0;
}
-#if 0
-bool tqNextDataBlockFilterOut(STqReader* pHandle, SHashObj* filterOutUids) {
- while (1) {
- if (tGetSubmitMsgNext(&pHandle->msgIter, &pHandle->pBlock) < 0) {
- return false;
- }
- if (pHandle->pBlock == NULL) return false;
-
- void* ret = taosHashGet(filterOutUids, &pHandle->msgIter.uid, sizeof(int64_t));
- if (ret == NULL) {
- return true;
- }
- }
- return false;
-}
-
-int32_t tqScanSubmitSplit(SArray* pBlocks, SArray* schemas, STqReader* pReader) {
- //
- int32_t sversion = htonl(pReader->pBlock->sversion);
- if (pReader->cachedSchemaSuid == 0 || pReader->cachedSchemaVer != sversion ||
- pReader->cachedSchemaSuid != pReader->msgIter.suid) {
- taosMemoryFree(pReader->pSchema);
- pReader->pSchema = metaGetTbTSchema(pReader->pVnodeMeta, pReader->msgIter.uid, sversion, 1);
- if (pReader->pSchema == NULL) {
- tqWarn("vgId:%d, cannot found tsschema for table: uid:%" PRId64 " (suid:%" PRId64
- "), version %d, possibly dropped table",
- pWalReader->pWal->cfg.vgId, pReader->msgIter.uid, pReader->msgIter.suid, sversion);
- pReader->cachedSchemaSuid = 0;
- terrno = TSDB_CODE_TQ_TABLE_SCHEMA_NOT_FOUND;
- return -1;
- }
-
- tDeleteSSchemaWrapper(pReader->pSchemaWrapper);
- pReader->pSchemaWrapper = metaGetTableSchema(pReader->pVnodeMeta, pReader->msgIter.uid, sversion, 1);
- if (pReader->pSchemaWrapper == NULL) {
- tqWarn("vgId:%d, cannot found schema wrapper for table: suid:%" PRId64 ", version %d, possibly dropped table",
- pWalReader->pWal->cfg.vgId, pReader->msgIter.uid, pReader->cachedSchemaVer);
- pReader->cachedSchemaSuid = 0;
- terrno = TSDB_CODE_TQ_TABLE_SCHEMA_NOT_FOUND;
- return -1;
- }
-
- STSchema* pTschema = pReader->pSchema;
- SSchemaWrapper* pSchemaWrapper = pReader->pSchemaWrapper;
-
- int32_t colNumNeed = taosArrayGetSize(pReader->pColIdList);
- }
- return 0;
-}
-#endif
-
int32_t tqRetrieveDataBlock2(SSDataBlock* pBlock, STqReader* pReader, SSubmitTbData** pSubmitTbDataRet) {
- int32_t blockSz = taosArrayGetSize(pReader->submit.aSubmitTbData);
- ASSERT(pReader->nextBlk < blockSz);
-
- tqDebug("tq reader retrieve data block %p, %d", pReader->msg2.msgStr, pReader->nextBlk);
-
+ tqDebug("tq reader retrieve data block %p, index:%d", pReader->msg2.msgStr, pReader->nextBlk);
SSubmitTbData* pSubmitTbData = taosArrayGet(pReader->submit.aSubmitTbData, pReader->nextBlk);
pReader->nextBlk++;
- if (pSubmitTbDataRet) *pSubmitTbDataRet = pSubmitTbData;
+ if (pSubmitTbDataRet) {
+ *pSubmitTbDataRet = pSubmitTbData;
+ }
+
int32_t sversion = pSubmitTbData->sver;
int64_t suid = pSubmitTbData->suid;
int64_t uid = pSubmitTbData->uid;
@@ -666,33 +559,27 @@ int32_t tqRetrieveDataBlock2(SSDataBlock* pBlock, STqReader* pReader, SSubmitTbD
int32_t targetIdx = 0;
int32_t sourceIdx = 0;
while (targetIdx < colActual) {
- ASSERT(sourceIdx < numOfCols);
-
+ if(sourceIdx >= numOfCols){
+ tqError("tqRetrieveDataBlock2 sourceIdx:%d >= numOfCols:%d", sourceIdx, numOfCols);
+ goto FAIL;
+ }
SColData* pCol = taosArrayGet(pCols, sourceIdx);
SColumnInfoData* pColData = taosArrayGet(pBlock->pDataBlock, targetIdx);
SColVal colVal;
- ASSERT(pCol->nVal == numOfRows);
+ if(pCol->nVal != numOfRows){
+ tqError("tqRetrieveDataBlock2 pCol->nVal:%d != numOfRows:%d", pCol->nVal, numOfRows);
+ goto FAIL;
+ }
if (pCol->cid < pColData->info.colId) {
sourceIdx++;
} else if (pCol->cid == pColData->info.colId) {
for (int32_t i = 0; i < pCol->nVal; i++) {
tColDataGetValue(pCol, i, &colVal);
-#if 0
- void* val = NULL;
- if (IS_STR_DATA_TYPE(colVal.type)) {
- val = colVal.value.pData;
- } else {
- val = &colVal.value.val;
- }
- if (colDataAppend(pColData, i, val, !COL_VAL_IS_VALUE(&colVal)) < 0) {
- goto FAIL;
- }
-#endif
if (IS_STR_DATA_TYPE(colVal.type)) {
if (colVal.value.pData != NULL) {
- char val[65535 + 2];
+ char val[65535 + 2] = {0};
memcpy(varDataVal(val), colVal.value.pData, colVal.value.nData);
varDataSetLen(val, colVal.value.nData);
if (colDataAppend(pColData, i, val, !COL_VAL_IS_VALUE(&colVal)) < 0) {
@@ -726,8 +613,6 @@ int32_t tqRetrieveDataBlock2(SSDataBlock* pBlock, STqReader* pReader, SSubmitTbD
for (int32_t j = 0; j < colActual; j++) {
SColumnInfoData* pColData = taosArrayGet(pBlock->pDataBlock, j);
while (1) {
- ASSERT(sourceIdx < pTschema->numOfCols);
-
SColVal colVal;
tRowGet(pRow, pTschema, sourceIdx, &colVal);
if (colVal.cid < pColData->info.colId) {
@@ -736,7 +621,7 @@ int32_t tqRetrieveDataBlock2(SSDataBlock* pBlock, STqReader* pReader, SSubmitTbD
} else if (colVal.cid == pColData->info.colId) {
if (IS_STR_DATA_TYPE(colVal.type)) {
if (colVal.value.pData != NULL) {
- char val[65535 + 2];
+ char val[65535 + 2] = {0};
memcpy(varDataVal(val), colVal.value.pData, colVal.value.nData);
varDataSetLen(val, colVal.value.nData);
if (colDataAppend(pColData, i, val, !COL_VAL_IS_VALUE(&colVal)) < 0) {
@@ -745,7 +630,6 @@ int32_t tqRetrieveDataBlock2(SSDataBlock* pBlock, STqReader* pReader, SSubmitTbD
} else {
colDataSetNULL(pColData, i);
}
- /*val = colVal.value.pData;*/
} else {
if (colDataAppend(pColData, i, (void*)&colVal.value.val, !COL_VAL_IS_VALUE(&colVal)) < 0) {
goto FAIL;
@@ -771,253 +655,6 @@ FAIL:
return -1;
}
-#if 0
-int32_t tqRetrieveDataBlock(SSDataBlock* pBlock, STqReader* pReader) {
- // TODO: cache multiple schema
- int32_t sversion = htonl(pReader->pBlock->sversion);
- if (pReader->cachedSchemaSuid == 0 || pReader->cachedSchemaVer != sversion ||
- pReader->cachedSchemaSuid != pReader->msgIter.suid) {
- if (pReader->pSchema) taosMemoryFree(pReader->pSchema);
- pReader->pSchema = metaGetTbTSchema(pReader->pVnodeMeta, pReader->msgIter.uid, sversion, 1);
- if (pReader->pSchema == NULL) {
- tqWarn("cannot found tsschema for table: uid:%" PRId64 " (suid:%" PRId64 "), version %d, possibly dropped table",
- pReader->msgIter.uid, pReader->msgIter.suid, pReader->cachedSchemaVer);
- pReader->cachedSchemaSuid = 0;
- terrno = TSDB_CODE_TQ_TABLE_SCHEMA_NOT_FOUND;
- return -1;
- }
-
- if (pReader->pSchemaWrapper) tDeleteSSchemaWrapper(pReader->pSchemaWrapper);
- pReader->pSchemaWrapper = metaGetTableSchema(pReader->pVnodeMeta, pReader->msgIter.uid, sversion, 1);
- if (pReader->pSchemaWrapper == NULL) {
- tqWarn("cannot found schema wrapper for table: suid:%" PRId64 ", version %d, possibly dropped table",
- pReader->msgIter.uid, pReader->cachedSchemaVer);
- pReader->cachedSchemaSuid = 0;
- terrno = TSDB_CODE_TQ_TABLE_SCHEMA_NOT_FOUND;
- return -1;
- }
- pReader->cachedSchemaVer = sversion;
- pReader->cachedSchemaSuid = pReader->msgIter.suid;
- }
-
- STSchema* pTschema = pReader->pSchema;
- SSchemaWrapper* pSchemaWrapper = pReader->pSchemaWrapper;
-
- int32_t colNumNeed = taosArrayGetSize(pReader->pColIdList);
-
- if (colNumNeed == 0) {
- int32_t colMeta = 0;
- while (colMeta < pSchemaWrapper->nCols) {
- SSchema* pColSchema = &pSchemaWrapper->pSchema[colMeta];
- SColumnInfoData colInfo = createColumnInfoData(pColSchema->type, pColSchema->bytes, pColSchema->colId);
- int32_t code = blockDataAppendColInfo(pBlock, &colInfo);
- if (code != TSDB_CODE_SUCCESS) {
- goto FAIL;
- }
- colMeta++;
- }
- } else {
- if (colNumNeed > pSchemaWrapper->nCols) {
- colNumNeed = pSchemaWrapper->nCols;
- }
-
- int32_t colMeta = 0;
- int32_t colNeed = 0;
- while (colMeta < pSchemaWrapper->nCols && colNeed < colNumNeed) {
- SSchema* pColSchema = &pSchemaWrapper->pSchema[colMeta];
- col_id_t colIdSchema = pColSchema->colId;
- col_id_t colIdNeed = *(col_id_t*)taosArrayGet(pReader->pColIdList, colNeed);
- if (colIdSchema < colIdNeed) {
- colMeta++;
- } else if (colIdSchema > colIdNeed) {
- colNeed++;
- } else {
- SColumnInfoData colInfo = createColumnInfoData(pColSchema->type, pColSchema->bytes, pColSchema->colId);
- int32_t code = blockDataAppendColInfo(pBlock, &colInfo);
- if (code != TSDB_CODE_SUCCESS) {
- goto FAIL;
- }
- colMeta++;
- colNeed++;
- }
- }
- }
-
- if (blockDataEnsureCapacity(pBlock, pReader->msgIter.numOfRows) < 0) {
- terrno = TSDB_CODE_OUT_OF_MEMORY;
- goto FAIL;
- }
-
- int32_t colActual = blockDataGetNumOfCols(pBlock);
-
- STSRowIter iter = {0};
- tdSTSRowIterInit(&iter, pTschema);
- STSRow* row;
- int32_t curRow = 0;
-
- tInitSubmitBlkIter(&pReader->msgIter, pReader->pBlock, &pReader->blkIter);
-
- pBlock->info.id.uid = pReader->msgIter.uid;
- pBlock->info.rows = pReader->msgIter.numOfRows;
- pBlock->info.version = pReader->pMsg->version;
- pBlock->info.dataLoad = 1;
-
- while ((row = tGetSubmitBlkNext(&pReader->blkIter)) != NULL) {
- tdSTSRowIterReset(&iter, row);
- // get all wanted col of that block
- for (int32_t i = 0; i < colActual; i++) {
- SColumnInfoData* pColData = taosArrayGet(pBlock->pDataBlock, i);
- SCellVal sVal = {0};
- if (!tdSTSRowIterFetch(&iter, pColData->info.colId, pColData->info.type, &sVal)) {
- break;
- }
- if (colDataSetVal(pColData, curRow, sVal.val, sVal.valType != TD_VTYPE_NORM) < 0) {
- goto FAIL;
- }
- }
- curRow++;
- }
- return 0;
-
-FAIL:
- blockDataFreeRes(pBlock);
- return -1;
-}
-
-int32_t tqRetrieveTaosxBlock(STqReader* pReader, SArray* blocks, SArray* schemas) {
- int32_t sversion = htonl(pReader->pBlock->sversion);
-
- if (pReader->cachedSchemaSuid == 0 || pReader->cachedSchemaVer != sversion ||
- pReader->cachedSchemaSuid != pReader->msgIter.suid) {
- if (pReader->pSchema) taosMemoryFree(pReader->pSchema);
- pReader->pSchema = metaGetTbTSchema(pReader->pVnodeMeta, pReader->msgIter.uid, sversion, 1);
- if (pReader->pSchema == NULL) {
- tqWarn("cannot found tsschema for table: uid:%" PRId64 " (suid:%" PRId64 "), version %d, possibly dropped table",
- pReader->msgIter.uid, pReader->msgIter.suid, pReader->cachedSchemaVer);
- pReader->cachedSchemaSuid = 0;
- terrno = TSDB_CODE_TQ_TABLE_SCHEMA_NOT_FOUND;
- return -1;
- }
-
- if (pReader->pSchemaWrapper) tDeleteSSchemaWrapper(pReader->pSchemaWrapper);
- pReader->pSchemaWrapper = metaGetTableSchema(pReader->pVnodeMeta, pReader->msgIter.uid, sversion, 1);
- if (pReader->pSchemaWrapper == NULL) {
- tqWarn("cannot found schema wrapper for table: suid:%" PRId64 ", version %d, possibly dropped table",
- pReader->msgIter.uid, pReader->cachedSchemaVer);
- pReader->cachedSchemaSuid = 0;
- terrno = TSDB_CODE_TQ_TABLE_SCHEMA_NOT_FOUND;
- return -1;
- }
- pReader->cachedSchemaVer = sversion;
- pReader->cachedSchemaSuid = pReader->msgIter.suid;
- }
-
- STSchema* pTschema = pReader->pSchema;
- SSchemaWrapper* pSchemaWrapper = pReader->pSchemaWrapper;
-
- int32_t colAtMost = pSchemaWrapper->nCols;
-
- int32_t curRow = 0;
- int32_t lastRow = 0;
-
- char* assigned = taosMemoryCalloc(1, pSchemaWrapper->nCols);
- if (assigned == NULL) return -1;
-
- tInitSubmitBlkIter(&pReader->msgIter, pReader->pBlock, &pReader->blkIter);
- STSRowIter iter = {0};
- tdSTSRowIterInit(&iter, pTschema);
- STSRow* row;
-
- while ((row = tGetSubmitBlkNext(&pReader->blkIter)) != NULL) {
- bool buildNew = false;
- tdSTSRowIterReset(&iter, row);
-
- tqDebug("vgId:%d, row of block %d", pReader->pWalReader->pWal->cfg.vgId, curRow);
- for (int32_t i = 0; i < colAtMost; i++) {
- SCellVal sVal = {0};
- if (!tdSTSRowIterFetch(&iter, pSchemaWrapper->pSchema[i].colId, pSchemaWrapper->pSchema[i].type, &sVal)) {
- break;
- }
- tqDebug("vgId:%d, %d col, type %d", pReader->pWalReader->pWal->cfg.vgId, i, sVal.valType);
- if (curRow == 0) {
- assigned[i] = sVal.valType != TD_VTYPE_NONE;
- buildNew = true;
- } else {
- bool currentRowAssigned = sVal.valType != TD_VTYPE_NONE;
- if (currentRowAssigned != assigned[i]) {
- assigned[i] = currentRowAssigned;
- buildNew = true;
- }
- }
- }
-
- if (buildNew) {
- if (taosArrayGetSize(blocks) > 0) {
- SSDataBlock* pLastBlock = taosArrayGetLast(blocks);
- pLastBlock->info.rows = curRow - lastRow;
- lastRow = curRow;
- }
- SSDataBlock* pBlock = createDataBlock();
- SSchemaWrapper* pSW = taosMemoryCalloc(1, sizeof(SSchemaWrapper));
- if (tqMaskBlock(pSW, pBlock, pSchemaWrapper, assigned) < 0) {
- blockDataDestroy(pBlock);
- goto FAIL;
- }
- SSDataBlock block = {0};
- assignOneDataBlock(&block, pBlock);
- blockDataDestroy(pBlock);
-
- tqDebug("vgId:%d, build new block, col %d", pReader->pWalReader->pWal->cfg.vgId,
- (int32_t)taosArrayGetSize(block.pDataBlock));
-
- taosArrayPush(blocks, &block);
- taosArrayPush(schemas, &pSW);
- }
-
- SSDataBlock* pBlock = taosArrayGetLast(blocks);
- pBlock->info.id.uid = pReader->msgIter.uid;
- pBlock->info.rows = 0;
- pBlock->info.version = pReader->pMsg->version;
-
- tqDebug("vgId:%d, taosx scan, block num: %d", pReader->pWalReader->pWal->cfg.vgId,
- (int32_t)taosArrayGetSize(blocks));
-
- if (blockDataEnsureCapacity(pBlock, pReader->msgIter.numOfRows - curRow) < 0) {
- terrno = TSDB_CODE_OUT_OF_MEMORY;
- goto FAIL;
- }
-
- tdSTSRowIterReset(&iter, row);
- for (int32_t i = 0; i < taosArrayGetSize(pBlock->pDataBlock); i++) {
- SColumnInfoData* pColData = taosArrayGet(pBlock->pDataBlock, i);
- SCellVal sVal = {0};
-
- if (!tdSTSRowIterFetch(&iter, pColData->info.colId, pColData->info.type, &sVal)) {
- break;
- }
-
- ASSERT(sVal.valType != TD_VTYPE_NONE);
-
- if (colDataSetVal(pColData, curRow, sVal.val, sVal.valType == TD_VTYPE_NULL) < 0) {
- goto FAIL;
- }
- tqDebug("vgId:%d, row %d col %d append %d", pReader->pWalReader->pWal->cfg.vgId, curRow, i,
- sVal.valType == TD_VTYPE_NULL);
- }
- curRow++;
- }
- SSDataBlock* pLastBlock = taosArrayGetLast(blocks);
- pLastBlock->info.rows = curRow - lastRow;
-
- taosMemoryFree(assigned);
- return 0;
-
-FAIL:
- taosMemoryFree(assigned);
- return -1;
-}
-#endif
-
int32_t tqRetrieveTaosxBlock2(STqReader* pReader, SArray* blocks, SArray* schemas, SSubmitTbData** pSubmitTbDataRet) {
tqDebug("tq reader retrieve data block %p, %d", pReader->msg2.msgStr, pReader->nextBlk);
@@ -1295,7 +932,7 @@ int tqReaderSetTbUidList(STqReader* pReader, const SArray* tbUidList) {
return 0;
}
-int tqReaderAddTbUidList(STqReader* pReader, const SArray* tbUidList) {
+int tqReaderAddTbUidList(STqReader* pReader, const SArray* pTableUidList) {
if (pReader->tbIdHash == NULL) {
pReader->tbIdHash = taosHashInit(64, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), true, HASH_ENTRY_LOCK);
if (pReader->tbIdHash == NULL) {
@@ -1304,8 +941,9 @@ int tqReaderAddTbUidList(STqReader* pReader, const SArray* tbUidList) {
}
}
- for (int i = 0; i < taosArrayGetSize(tbUidList); i++) {
- int64_t* pKey = (int64_t*)taosArrayGet(tbUidList, i);
+ int32_t numOfTables = taosArrayGetSize(pTableUidList);
+ for (int i = 0; i < numOfTables; i++) {
+ int64_t* pKey = (int64_t*)taosArrayGet(pTableUidList, i);
taosHashPut(pReader->tbIdHash, pKey, sizeof(int64_t), NULL, 0);
}
@@ -1321,30 +959,34 @@ int tqReaderRemoveTbUidList(STqReader* pReader, const SArray* tbUidList) {
return 0;
}
+// todo update the table list in wal reader
int32_t tqUpdateTbUidList(STQ* pTq, const SArray* tbUidList, bool isAdd) {
- void* pIter = NULL;
+ void* pIter = NULL;
+ int32_t vgId = TD_VID(pTq->pVnode);
+
+ // update the table list for each consumer handle
while (1) {
pIter = taosHashIterate(pTq->pHandle, pIter);
if (pIter == NULL) {
break;
}
- STqHandle* pExec = (STqHandle*)pIter;
- if (pExec->execHandle.subType == TOPIC_SUB_TYPE__COLUMN) {
- int32_t code = qUpdateQualifiedTableId(pExec->execHandle.task, tbUidList, isAdd);
+ STqHandle* pTqHandle = (STqHandle*)pIter;
+ if (pTqHandle->execHandle.subType == TOPIC_SUB_TYPE__COLUMN) {
+ int32_t code = qUpdateTableListForStreamScanner(pTqHandle->execHandle.task, tbUidList, isAdd, NULL);
if (code != 0) {
- tqError("update qualified table error for %s", pExec->subKey);
+ tqError("update qualified table error for %s", pTqHandle->subKey);
continue;
}
- } else if (pExec->execHandle.subType == TOPIC_SUB_TYPE__DB) {
+ } else if (pTqHandle->execHandle.subType == TOPIC_SUB_TYPE__DB) {
if (!isAdd) {
int32_t sz = taosArrayGetSize(tbUidList);
for (int32_t i = 0; i < sz; i++) {
int64_t tbUid = *(int64_t*)taosArrayGet(tbUidList, i);
- taosHashPut(pExec->execHandle.execDb.pFilterOutTbUid, &tbUid, sizeof(int64_t), NULL, 0);
+ taosHashPut(pTqHandle->execHandle.execDb.pFilterOutTbUid, &tbUid, sizeof(int64_t), NULL, 0);
}
}
- } else if (pExec->execHandle.subType == TOPIC_SUB_TYPE__TABLE) {
+ } else if (pTqHandle->execHandle.subType == TOPIC_SUB_TYPE__TABLE) {
if (isAdd) {
SArray* qa = taosArrayInit(4, sizeof(tb_uid_t));
SMetaReader mr = {0};
@@ -1359,35 +1001,50 @@ int32_t tqUpdateTbUidList(STQ* pTq, const SArray* tbUidList, bool isAdd) {
}
tDecoderClear(&mr.coder);
-
- if (mr.me.type != TSDB_CHILD_TABLE || mr.me.ctbEntry.suid != pExec->execHandle.execTb.suid) {
+ if (mr.me.type != TSDB_CHILD_TABLE || mr.me.ctbEntry.suid != pTqHandle->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);
+ tqReaderAddTbUidList(pTqHandle->execHandle.pTqReader, qa);
}
+
taosArrayDestroy(qa);
} else {
- tqReaderRemoveTbUidList(pExec->execHandle.pExecReader, tbUidList);
+ tqReaderRemoveTbUidList(pTqHandle->execHandle.pTqReader, tbUidList);
}
}
}
+
+ // update the table list handle for each stream scanner/wal reader
while (1) {
pIter = taosHashIterate(pTq->pStreamMeta->pTasks, pIter);
- if (pIter == NULL) break;
+ if (pIter == NULL) {
+ break;
+ }
+
SStreamTask* pTask = *(SStreamTask**)pIter;
if (pTask->taskLevel == TASK_LEVEL__SOURCE) {
- int32_t code = qUpdateQualifiedTableId(pTask->exec.executor, tbUidList, isAdd);
+ SArray* pList = NULL;
+ int32_t code = qUpdateTableListForStreamScanner(pTask->exec.pExecutor, tbUidList, isAdd, pList);
if (code != 0) {
- tqError("update qualified table error for stream task %d", pTask->taskId);
+ tqError("vgId:%d, s-task:%s update qualified table error for stream task", vgId, pTask->id.idStr);
continue;
}
+
+ if (isAdd) { // only add qualified tables
+ tqReaderAddTbUidList(pTask->exec.pTqReader, pList);
+ } else {
+ tqReaderRemoveTbUidList(pTask->exec.pTqReader, tbUidList);
+ }
}
}
+
return 0;
}
diff --git a/source/dnode/vnode/src/tq/tqRestore.c b/source/dnode/vnode/src/tq/tqRestore.c
new file mode 100644
index 0000000000..6ed74ddcc3
--- /dev/null
+++ b/source/dnode/vnode/src/tq/tqRestore.c
@@ -0,0 +1,167 @@
+/*
+ * Copyright (c) 2019 TAOS Data, Inc.
+ *
+ * This program is free software: you can use, redistribute, and/or modify
+ * it under the terms of the GNU Affero General Public License, version 3
+ * or later ("AGPL"), as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
+#include "tq.h"
+
+static int32_t streamTaskReplayWal(SStreamMeta* pStreamMeta, STqOffsetStore* pOffsetStore, bool* pScanIdle);
+static int32_t transferToNormalTask(SStreamMeta* pStreamMeta, SArray* pTaskList);
+
+// this function should be executed by stream threads.
+// there is a case that the WAL increases more fast than the restore procedure, and this restore procedure
+// will not stop eventually.
+int tqStreamTasksScanWal(STQ* pTq) {
+ int32_t vgId = TD_VID(pTq->pVnode);
+ SStreamMeta* pMeta = pTq->pStreamMeta;
+ int64_t st = taosGetTimestampMs();
+
+ while (1) {
+ tqInfo("vgId:%d continue check if data in wal are available", vgId);
+
+ // check all restore tasks
+ bool allFull = true;
+ streamTaskReplayWal(pTq->pStreamMeta, pTq->pOffsetStore, &allFull);
+
+ int32_t times = 0;
+
+ if (allFull) {
+ taosWLockLatch(&pMeta->lock);
+ pMeta->walScan -= 1;
+ times = pMeta->walScan;
+
+ if (pMeta->walScan <= 0) {
+ taosWUnLockLatch(&pMeta->lock);
+ break;
+ }
+
+ taosWUnLockLatch(&pMeta->lock);
+ tqInfo("vgId:%d scan wal for stream tasks for %d times", vgId, times);
+ }
+ }
+
+ double el = (taosGetTimestampMs() - st) / 1000.0;
+ tqInfo("vgId:%d scan wal for stream tasks completed, elapsed time:%.2f sec", vgId, el);
+
+ // restore wal scan flag
+// atomic_store_8(&pTq->pStreamMeta->walScan, 0);
+ return 0;
+}
+
+//int32_t transferToNormalTask(SStreamMeta* pStreamMeta, SArray* pTaskList) {
+// int32_t numOfTask = taosArrayGetSize(pTaskList);
+// if (numOfTask <= 0) {
+// return TSDB_CODE_SUCCESS;
+// }
+//
+// // todo: add lock
+// for (int32_t i = 0; i < numOfTask; ++i) {
+// SStreamTask* pTask = taosArrayGetP(pTaskList, i);
+// tqDebug("vgId:%d transfer s-task:%s state restore -> ready, checkpoint:%" PRId64 " checkpoint id:%" PRId64,
+// pStreamMeta->vgId, pTask->id.idStr, pTask->chkInfo.version, pTask->chkInfo.id);
+// taosHashRemove(pStreamMeta->pWalReadTasks, &pTask->id.taskId, sizeof(pTask->id.taskId));
+//
+// // NOTE: do not change the following order
+// atomic_store_8(&pTask->status.taskStatus, TASK_STATUS__NORMAL);
+// taosHashPut(pStreamMeta->pTasks, &pTask->id.taskId, sizeof(pTask->id.taskId), &pTask, POINTER_BYTES);
+// }
+//
+// return TSDB_CODE_SUCCESS;
+//}
+
+int32_t streamTaskReplayWal(SStreamMeta* pStreamMeta, STqOffsetStore* pOffsetStore, bool* pScanIdle) {
+ void* pIter = NULL;
+ int32_t vgId = pStreamMeta->vgId;
+
+ *pScanIdle = true;
+
+ bool allWalChecked = true;
+ tqDebug("vgId:%d start to check wal to extract new submit block", vgId);
+
+ while (1) {
+ pIter = taosHashIterate(pStreamMeta->pTasks, pIter);
+ if (pIter == NULL) {
+ break;
+ }
+
+ SStreamTask* pTask = *(SStreamTask**)pIter;
+ if (pTask->taskLevel != TASK_LEVEL__SOURCE) {
+ continue;
+ }
+
+ if (pTask->status.taskStatus == TASK_STATUS__RECOVER_PREPARE ||
+ pTask->status.taskStatus == TASK_STATUS__WAIT_DOWNSTREAM) {
+ tqDebug("s-task:%s skip push data, not ready for processing, status %d", pTask->id.idStr,
+ pTask->status.taskStatus);
+ continue;
+ }
+
+ // check if offset value exists
+ char key[128] = {0};
+ createStreamTaskOffsetKey(key, pTask->id.streamId, pTask->id.taskId);
+
+ if (tInputQueueIsFull(pTask)) {
+ tqDebug("vgId:%d s-task:%s input queue is full, do nothing", vgId, pTask->id.idStr);
+ continue;
+ }
+
+ *pScanIdle = false;
+
+ // check if offset value exists
+ STqOffset* pOffset = tqOffsetRead(pOffsetStore, key);
+ ASSERT(pOffset != NULL);
+
+ // seek the stored version and extract data from WAL
+ int32_t code = walReadSeekVer(pTask->exec.pWalReader, pOffset->val.version);
+ if (code != TSDB_CODE_SUCCESS) { // no data in wal, quit
+ continue;
+ }
+
+ // append the data for the stream
+ tqDebug("vgId:%d wal reader seek to ver:%" PRId64 " %s", vgId, pOffset->val.version, pTask->id.idStr);
+
+ SPackedData packData = {0};
+ code = extractSubmitMsgFromWal(pTask->exec.pWalReader, &packData);
+ if (code != TSDB_CODE_SUCCESS) { // failed, continue
+ continue;
+ }
+
+ SStreamDataSubmit2* p = streamDataSubmitNew(packData, STREAM_INPUT__DATA_SUBMIT);
+ if (p == NULL) {
+ terrno = TSDB_CODE_OUT_OF_MEMORY;
+ tqError("%s failed to create data submit for stream since out of memory", pTask->id.idStr);
+ continue;
+ }
+
+ allWalChecked = false;
+
+ tqDebug("s-task:%s submit data extracted from WAL", pTask->id.idStr);
+ code = tqAddInputBlockNLaunchTask(pTask, (SStreamQueueItem*)p, packData.ver);
+ if (code == TSDB_CODE_SUCCESS) {
+ pOffset->val.version = walReaderGetCurrentVer(pTask->exec.pWalReader);
+ tqDebug("s-task:%s set the ver:%" PRId64 " from WALReader after extract block from WAL", pTask->id.idStr,
+ pOffset->val.version);
+ } else {
+ // do nothing
+ }
+
+ streamDataSubmitDestroy(p);
+ taosFreeQitem(p);
+ }
+
+ if (allWalChecked) {
+ *pScanIdle = true;
+ }
+ return 0;
+}
+
diff --git a/source/dnode/vnode/src/tq/tqScan.c b/source/dnode/vnode/src/tq/tqScan.c
index 6528b7c8d2..27db66f048 100644
--- a/source/dnode/vnode/src/tq/tqScan.c
+++ b/source/dnode/vnode/src/tq/tqScan.c
@@ -38,7 +38,7 @@ int32_t tqAddBlockDataToRsp(const SSDataBlock* pBlock, SMqDataRsp* pRsp, int32_t
}
static int32_t tqAddBlockSchemaToRsp(const STqExecHandle* pExec, STaosxRsp* pRsp) {
- SSchemaWrapper* pSW = tCloneSSchemaWrapper(pExec->pExecReader->pSchemaWrapper);
+ SSchemaWrapper* pSW = tCloneSSchemaWrapper(pExec->pTqReader->pSchemaWrapper);
if (pSW == NULL) {
return -1;
}
@@ -74,33 +74,23 @@ int32_t tqScanData(STQ* pTq, const STqHandle* pHandle, SMqDataRsp* pRsp, STqOffs
qTaskInfo_t task = pExec->task;
if (qStreamPrepareScan(task, pOffset, pHandle->execHandle.subType) < 0) {
- tqDebug("prepare scan failed, vgId:%d, consumer:0x%" PRIx64, vgId, pHandle->consumerId);
- if (pOffset->type == TMQ_OFFSET__LOG) {
- pRsp->rspOffset = *pOffset;
- return code;
- } else {
- tqOffsetResetToLog(pOffset, pHandle->snapshotVer);
- if (qStreamPrepareScan(task, pOffset, pHandle->execHandle.subType) < 0) {
- tqDebug("prepare scan failed, vgId:%d, consumer:0x%" PRIx64, vgId, pHandle->consumerId);
- pRsp->rspOffset = *pOffset;
- return code;
- }
- }
+ tqError("prepare scan failed, return");
+ return -1;
}
while (1) {
SSDataBlock* pDataBlock = NULL;
uint64_t ts = 0;
-
- tqDebug("vgId:%d, tmq task start to execute, consumer:0x%" PRIx64, vgId, pHandle->consumerId);
-
- code = qExecTask(task, &pDataBlock, &ts);
- if (code != TSDB_CODE_SUCCESS) {
- tqError("vgId:%d, task exec error since %s, consumer:0x%" PRIx64, vgId, terrstr(), pHandle->consumerId);
- return code;
+ qStreamSetOpen(task);
+ tqDebug("consumer:0x%" PRIx64 " vgId:%d, tmq one task start execute", pHandle->consumerId, vgId);
+ if (qExecTask(task, &pDataBlock, &ts) != TSDB_CODE_SUCCESS) {
+ tqError("consumer:0x%" PRIx64 " vgId:%d, task exec error since %s", pHandle->consumerId, vgId, terrstr());
+ return -1;
}
- // current scan should be stopped ASAP, since the re-balance occurs.
+ tqDebug("consumer:0x%" PRIx64 " vgId:%d tmq one task end executed, pDataBlock:%p", pHandle->consumerId, vgId,
+ pDataBlock);
+ // current scan should be stopped asap, since the rebalance occurs.
if (pDataBlock == NULL) {
break;
}
@@ -112,37 +102,16 @@ int32_t tqScanData(STQ* pTq, const STqHandle* pHandle, SMqDataRsp* pRsp, STqOffs
}
pRsp->blockNum++;
-
- tqDebug("vgId:%d, consumer:0x%" PRIx64 " tmq task executed, rows:%" PRId64 ", total blocks:%d", vgId,
- pHandle->consumerId, pDataBlock->info.rows, pRsp->blockNum);
-
- if (pOffset->type == TMQ_OFFSET__SNAPSHOT_DATA) {
- totalRows += pDataBlock->info.rows;
- if (totalRows >= MAX_ROWS_TO_RETURN) {
- break;
- }
+ totalRows += pDataBlock->info.rows;
+ if (totalRows >= MAX_ROWS_TO_RETURN) {
+ break;
}
}
+ tqDebug("consumer:0x%" PRIx64 " vgId:%d tmq task executed finished, total blocks:%d, totalRows:%d",
+ pHandle->consumerId, vgId, pRsp->blockNum, totalRows);
qStreamExtractOffset(task, &pRsp->rspOffset);
-
- if (pRsp->rspOffset.type == 0) {
- code = TSDB_CODE_INVALID_PARA;
- tqError("vgId:%d, expected rsp offset: type %d %" PRId64 " %" PRId64 " %" PRId64, vgId, pRsp->rspOffset.type,
- pRsp->rspOffset.ts, pRsp->rspOffset.uid, pRsp->rspOffset.version);
- return code;
- }
-
- if (pRsp->withTbName || pRsp->withSchema) {
- code = TSDB_CODE_INVALID_PARA;
- tqError("vgId:%d, get column should not with meta:%d,%d", vgId, pRsp->withTbName, pRsp->withSchema);
- return code;
- }
-
- tqDebug("vgId:%d, consumer:0x%" PRIx64 " tmq task executed, total blocks:%d, rows:%d", vgId, pHandle->consumerId,
- pRsp->blockNum, totalRows);
-
- return code;
+ return 0;
}
int32_t tqScanTaosx(STQ* pTq, const STqHandle* pHandle, STaosxRsp* pRsp, SMqMetaRsp* pMetaRsp, STqOffsetVal* pOffset) {
@@ -150,18 +119,8 @@ int32_t tqScanTaosx(STQ* pTq, const STqHandle* pHandle, STaosxRsp* pRsp, SMqMeta
qTaskInfo_t task = pExec->task;
if (qStreamPrepareScan(task, pOffset, pHandle->execHandle.subType) < 0) {
- tqDebug("prepare scan failed, return");
- if (pOffset->type == TMQ_OFFSET__LOG) {
- pRsp->rspOffset = *pOffset;
- return 0;
- } else {
- tqOffsetResetToLog(pOffset, pHandle->snapshotVer);
- if (qStreamPrepareScan(task, pOffset, pHandle->execHandle.subType) < 0) {
- tqDebug("prepare scan failed, return");
- pRsp->rspOffset = *pOffset;
- return 0;
- }
- }
+ tqDebug("tqScanTaosx prepare scan failed, return");
+ return -1;
}
int32_t rowCnt = 0;
@@ -178,7 +137,7 @@ int32_t tqScanTaosx(STQ* pTq, const STqHandle* pHandle, STaosxRsp* pRsp, SMqMeta
if (pDataBlock != NULL && pDataBlock->info.rows > 0) {
if (pRsp->withTbName) {
if (pOffset->type == TMQ_OFFSET__LOG) {
- int64_t uid = pExec->pExecReader->lastBlkUid;
+ int64_t uid = pExec->pTqReader->lastBlkUid;
if (tqAddTbNameToRsp(pTq, uid, pRsp, 1) < 0) {
continue;
}
@@ -207,42 +166,32 @@ int32_t tqScanTaosx(STQ* pTq, const STqHandle* pHandle, STaosxRsp* pRsp, SMqMeta
}
}
- if (pDataBlock == NULL && pOffset->type == TMQ_OFFSET__SNAPSHOT_DATA) {
- if (qStreamExtractPrepareUid(task) != 0) {
+ // get meta
+ SMqMetaRsp* tmp = qStreamExtractMetaMsg(task);
+ if (tmp->metaRspLen > 0) {
+ qStreamExtractOffset(task, &tmp->rspOffset);
+ *pMetaRsp = *tmp;
+
+ tqDebug("tmqsnap task get meta");
+ break;
+ }
+
+ if (pDataBlock == NULL) {
+ qStreamExtractOffset(task, pOffset);
+ if (pOffset->type == TMQ_OFFSET__SNAPSHOT_DATA) {
continue;
}
tqDebug("tmqsnap vgId: %d, tsdb consume over, switch to wal, ver %" PRId64, TD_VID(pTq->pVnode),
pHandle->snapshotVer + 1);
+ qStreamExtractOffset(task, &pRsp->rspOffset);
break;
}
if (pRsp->blockNum > 0) {
tqDebug("tmqsnap task exec exited, get data");
+ qStreamExtractOffset(task, &pRsp->rspOffset);
break;
}
-
- SMqMetaRsp* tmp = qStreamExtractMetaMsg(task);
- if (tmp->rspOffset.type == TMQ_OFFSET__SNAPSHOT_DATA) {
- tqOffsetResetToData(pOffset, tmp->rspOffset.uid, tmp->rspOffset.ts);
- qStreamPrepareScan(task, pOffset, pHandle->execHandle.subType);
- tmp->rspOffset.type = TMQ_OFFSET__SNAPSHOT_META;
- tqDebug("tmqsnap task exec change to get data");
- continue;
- }
-
- *pMetaRsp = *tmp;
- tqDebug("tmqsnap task exec exited, get meta");
-
- tqDebug("task exec exited");
- break;
- }
-
- qStreamExtractOffset(task, &pRsp->rspOffset);
-
- if (pRsp->rspOffset.type == 0) {
- tqError("expected rsp offset: type %d %" PRId64 " %" PRId64 " %" PRId64, pRsp->rspOffset.type, pRsp->rspOffset.ts,
- pRsp->rspOffset.uid, pRsp->rspOffset.version);
- return -1;
}
return 0;
@@ -254,9 +203,9 @@ int32_t tqTaosxScanLog(STQ* pTq, STqHandle* pHandle, SPackedData submit, STaosxR
SArray* pSchemas = taosArrayInit(0, sizeof(void*));
if (pExec->subType == TOPIC_SUB_TYPE__TABLE) {
- STqReader* pReader = pExec->pExecReader;
- tqReaderSetSubmitReq2(pReader, submit.msgStr, submit.msgLen, submit.ver);
- while (tqNextDataBlock2(pReader)) {
+ STqReader* pReader = pExec->pTqReader;
+ tqReaderSetSubmitMsg(pReader, submit.msgStr, submit.msgLen, submit.ver);
+ while (tqNextDataBlock(pReader)) {
taosArrayClear(pBlocks);
taosArrayClear(pSchemas);
SSubmitTbData* pSubmitTbDataRet = NULL;
@@ -264,7 +213,7 @@ int32_t tqTaosxScanLog(STQ* pTq, STqHandle* pHandle, SPackedData submit, STaosxR
if (terrno == TSDB_CODE_TQ_TABLE_SCHEMA_NOT_FOUND) continue;
}
if (pRsp->withTbName) {
- int64_t uid = pExec->pExecReader->lastBlkUid;
+ int64_t uid = pExec->pTqReader->lastBlkUid;
if (tqAddTbNameToRsp(pTq, uid, pRsp, taosArrayGetSize(pBlocks)) < 0) {
taosArrayDestroyEx(pBlocks, (FDelete)blockDataFreeRes);
taosArrayDestroyP(pSchemas, (FDelete)tDeleteSSchemaWrapper);
@@ -313,8 +262,8 @@ int32_t tqTaosxScanLog(STQ* pTq, STqHandle* pHandle, SPackedData submit, STaosxR
}
}
} else if (pExec->subType == TOPIC_SUB_TYPE__DB) {
- STqReader* pReader = pExec->pExecReader;
- tqReaderSetSubmitReq2(pReader, submit.msgStr, submit.msgLen, submit.ver);
+ STqReader* pReader = pExec->pTqReader;
+ tqReaderSetSubmitMsg(pReader, submit.msgStr, submit.msgLen, submit.ver);
while (tqNextDataBlockFilterOut2(pReader, pExec->execDb.pFilterOutTbUid)) {
taosArrayClear(pBlocks);
taosArrayClear(pSchemas);
@@ -323,7 +272,7 @@ int32_t tqTaosxScanLog(STQ* pTq, STqHandle* pHandle, SPackedData submit, STaosxR
if (terrno == TSDB_CODE_TQ_TABLE_SCHEMA_NOT_FOUND) continue;
}
if (pRsp->withTbName) {
- int64_t uid = pExec->pExecReader->lastBlkUid;
+ int64_t uid = pExec->pTqReader->lastBlkUid;
if (tqAddTbNameToRsp(pTq, uid, pRsp, taosArrayGetSize(pBlocks)) < 0) {
taosArrayDestroyEx(pBlocks, (FDelete)blockDataFreeRes);
taosArrayDestroyP(pSchemas, (FDelete)tDeleteSSchemaWrapper);
diff --git a/source/dnode/vnode/src/tq/tqSink.c b/source/dnode/vnode/src/tq/tqSink.c
index e2ab1e7369..567483055f 100644
--- a/source/dnode/vnode/src/tq/tqSink.c
+++ b/source/dnode/vnode/src/tq/tqSink.c
@@ -131,7 +131,7 @@ void tqSinkToTablePipeline2(SStreamTask* pTask, void* vnode, int64_t ver, void*
int32_t blockSz = taosArrayGetSize(pBlocks);
- tqDebug("vgId:%d, task %d write into table, block num: %d", TD_VID(pVnode), pTask->taskId, blockSz);
+ tqDebug("vgId:%d, s-task:%s write results blocks:%d into table", TD_VID(pVnode), pTask->id.idStr, blockSz);
void* pBuf = NULL;
SArray* tagArray = NULL;
@@ -224,11 +224,9 @@ void tqSinkToTablePipeline2(SStreamTask* pTask, void* vnode, int64_t ver, void*
}
for (int32_t tagId = UD_TAG_COLUMN_INDEX, step = 1; tagId < size; tagId++, step++) {
SColumnInfoData* pTagData = taosArrayGet(pDataBlock->pDataBlock, tagId);
- STagVal tagVal = {
- .cid = pTSchema->numOfCols + step,
- .type = pTagData->info.type,
- };
- void* pData = colDataGetData(pTagData, rowId);
+
+ STagVal tagVal = {.cid = pTSchema->numOfCols + step, .type = pTagData->info.type};
+ void* pData = colDataGetData(pTagData, rowId);
if (colDataIsNull_s(pTagData, rowId)) {
continue;
} else if (IS_VAR_DATA_TYPE(pTagData->info.type)) {
diff --git a/source/dnode/vnode/src/tq/tqUtil.c b/source/dnode/vnode/src/tq/tqUtil.c
new file mode 100644
index 0000000000..791bfbe6df
--- /dev/null
+++ b/source/dnode/vnode/src/tq/tqUtil.c
@@ -0,0 +1,489 @@
+/*
+ * Copyright (c) 2019 TAOS Data, Inc.
+ *
+ * This program is free software: you can use, redistribute, and/or modify
+ * it under the terms of the GNU Affero General Public License, version 3
+ * or later ("AGPL"), as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
+#include "tq.h"
+
+#define IS_OFFSET_RESET_TYPE(_t) ((_t) < 0)
+
+static int32_t tqSendMetaPollRsp(STQ* pTq, const SRpcMsg* pMsg, const SMqPollReq* pReq, const SMqMetaRsp* pRsp);
+
+// stream_task:stream_id:task_id
+void createStreamTaskOffsetKey(char* dst, uint64_t streamId, uint32_t taskId) {
+ int32_t n = 12;
+ char* p = dst;
+
+ memcpy(p, "stream_task:", n);
+ p += n;
+
+ int32_t inc = tintToHex(streamId, p);
+ p += inc;
+
+ *(p++) = ':';
+ tintToHex(taskId, p);
+}
+
+int32_t tqAddInputBlockNLaunchTask(SStreamTask* pTask, SStreamQueueItem* pQueueItem, int64_t ver) {
+ int32_t code = tAppendDataToInputQueue(pTask, pQueueItem);
+ if (code < 0) {
+ tqError("s-task:%s failed to put into queue, too many, next start ver:%" PRId64, pTask->id.idStr, ver);
+ return -1;
+ }
+
+ if (streamSchedExec(pTask) < 0) {
+ tqError("stream task:%d failed to be launched, code:%s", pTask->id.taskId, tstrerror(terrno));
+ return -1;
+ }
+
+ return TSDB_CODE_SUCCESS;
+}
+
+int32_t launchTaskForWalBlock(SStreamTask* pTask, SFetchRet* pRet, STqOffset* pOffset) {
+ SStreamDataBlock* pBlocks = taosAllocateQitem(sizeof(SStreamDataBlock), DEF_QITEM, 0);
+ if (pBlocks == NULL) { // failed, do nothing
+ terrno = TSDB_CODE_OUT_OF_MEMORY;
+ return -1;
+ }
+
+ pRet->data.info.type = STREAM_NORMAL;
+ pBlocks->type = STREAM_INPUT__DATA_BLOCK;
+ pBlocks->sourceVer = pOffset->val.version;
+ pBlocks->blocks = taosArrayInit(0, sizeof(SSDataBlock));
+ taosArrayPush(pBlocks->blocks, &pRet->data);
+
+// int64_t* ts = (int64_t*)(((SColumnInfoData*)ret.data.pDataBlock->pData)->pData);
+// tqDebug("-----------%ld\n", ts[0]);
+
+ int32_t code = tqAddInputBlockNLaunchTask(pTask, (SStreamQueueItem*)pBlocks, pBlocks->sourceVer);
+ if (code == TSDB_CODE_SUCCESS) {
+ pOffset->val.version = walReaderGetCurrentVer(pTask->exec.pTqReader->pWalReader);
+ tqDebug("s-task:%s set the ver:%" PRId64 " from WALReader after extract block from WAL", pTask->id.idStr,
+ pOffset->val.version);
+ }
+
+ return 0;
+}
+
+void initOffsetForAllRestoreTasks(STQ* pTq) {
+ void* pIter = NULL;
+
+ while(1) {
+ pIter = taosHashIterate(pTq->pStreamMeta->pTasks, pIter);
+ if (pIter == NULL) {
+ break;
+ }
+
+ SStreamTask* pTask = *(SStreamTask**)pIter;
+ if (pTask->taskLevel != TASK_LEVEL__SOURCE) {
+ continue;
+ }
+
+ if (pTask->status.taskStatus == TASK_STATUS__RECOVER_PREPARE || pTask->status.taskStatus == TASK_STATUS__WAIT_DOWNSTREAM) {
+ tqDebug("stream task:%d skip push data, not ready for processing, status %d", pTask->id.taskId,
+ pTask->status.taskStatus);
+ continue;
+ }
+
+ char key[128] = {0};
+ createStreamTaskOffsetKey(key, pTask->id.streamId, pTask->id.taskId);
+
+ STqOffset* pOffset = tqOffsetRead(pTq->pOffsetStore, key);
+ if (pOffset == NULL) {
+ doSaveTaskOffset(pTq->pOffsetStore, key, pTask->chkInfo.version);
+ }
+ }
+}
+
+void saveOffsetForAllTasks(STQ* pTq, int64_t ver) {
+ void* pIter = NULL;
+
+ while(1) {
+ pIter = taosHashIterate(pTq->pStreamMeta->pTasks, pIter);
+ if (pIter == NULL) {
+ break;
+ }
+
+ SStreamTask* pTask = *(SStreamTask**)pIter;
+ if (pTask->taskLevel != TASK_LEVEL__SOURCE) {
+ continue;
+ }
+
+ if (pTask->status.taskStatus == TASK_STATUS__RECOVER_PREPARE || pTask->status.taskStatus == TASK_STATUS__WAIT_DOWNSTREAM) {
+ tqDebug("stream task:%d skip push data, not ready for processing, status %d", pTask->id.taskId,
+ pTask->status.taskStatus);
+ continue;
+ }
+
+ char key[128] = {0};
+ createStreamTaskOffsetKey(key, pTask->id.streamId, pTask->id.taskId);
+
+ STqOffset* pOffset = tqOffsetRead(pTq->pOffsetStore, key);
+ if (pOffset == NULL) {
+ doSaveTaskOffset(pTq->pOffsetStore, key, ver);
+ }
+ }
+}
+
+void doSaveTaskOffset(STqOffsetStore* pOffsetStore, const char* pKey, int64_t ver) {
+ STqOffset offset = {0};
+ tqOffsetResetToLog(&offset.val, ver);
+
+ tstrncpy(offset.subKey, pKey, tListLen(offset.subKey));
+
+ // keep the offset info in the offset store
+ tqOffsetWrite(pOffsetStore, &offset);
+}
+
+static int32_t tqInitDataRsp(SMqDataRsp* pRsp, const SMqPollReq* pReq, int8_t subType) {
+ pRsp->reqOffset = pReq->reqOffset;
+
+ pRsp->blockData = taosArrayInit(0, sizeof(void*));
+ pRsp->blockDataLen = taosArrayInit(0, sizeof(int32_t));
+
+ if (pRsp->blockData == NULL || pRsp->blockDataLen == NULL) {
+ return -1;
+ }
+
+ pRsp->withTbName = 0;
+ pRsp->withSchema = false;
+ return 0;
+}
+
+static int32_t tqInitTaosxRsp(STaosxRsp* pRsp, const SMqPollReq* pReq) {
+ pRsp->reqOffset = pReq->reqOffset;
+
+ pRsp->withTbName = 1;
+ pRsp->withSchema = 1;
+ pRsp->blockData = taosArrayInit(0, sizeof(void*));
+ pRsp->blockDataLen = taosArrayInit(0, sizeof(int32_t));
+ pRsp->blockTbName = taosArrayInit(0, sizeof(void*));
+ pRsp->blockSchema = taosArrayInit(0, sizeof(void*));
+
+ if (pRsp->blockData == NULL || pRsp->blockDataLen == NULL || pRsp->blockTbName == NULL || pRsp->blockSchema == NULL) {
+ return -1;
+ }
+
+ return 0;
+}
+
+static int32_t extractResetOffsetVal(STqOffsetVal* pOffsetVal, STQ* pTq, STqHandle* pHandle, const SMqPollReq* pRequest,
+ SRpcMsg* pMsg, bool* pBlockReturned) {
+ uint64_t consumerId = pRequest->consumerId;
+ STqOffsetVal reqOffset = pRequest->reqOffset;
+ STqOffset* pOffset = tqOffsetRead(pTq->pOffsetStore, pRequest->subKey);
+ int32_t vgId = TD_VID(pTq->pVnode);
+
+ *pBlockReturned = false;
+
+ // In this vnode, data has been polled by consumer for this topic, so let's continue from the last offset value.
+ if (pOffset != NULL) {
+ *pOffsetVal = pOffset->val;
+
+ char formatBuf[80];
+ tFormatOffset(formatBuf, 80, pOffsetVal);
+ tqDebug("tmq poll: consumer:0x%" PRIx64 ", subkey %s, vgId:%d, existed offset found, offset reset to %s and continue. reqId:0x%"PRIx64,
+ consumerId, pHandle->subKey, vgId, formatBuf, pRequest->reqId);
+ return 0;
+ } else {
+ // no poll occurs in this vnode for this topic, let's seek to the right offset value.
+ if (reqOffset.type == TMQ_OFFSET__RESET_EARLIEAST) {
+ if (pRequest->useSnapshot) {
+ tqDebug("tmq poll: consumer:0x%" PRIx64 ", subkey:%s, vgId:%d, (earliest) set offset to be snapshot",
+ consumerId, pHandle->subKey, vgId);
+
+ if (pHandle->fetchMeta) {
+ tqOffsetResetToMeta(pOffsetVal, 0);
+ } else {
+ tqOffsetResetToData(pOffsetVal, 0, 0);
+ }
+ } else {
+ pHandle->pRef = walRefFirstVer(pTq->pVnode->pWal, pHandle->pRef);
+ if (pHandle->pRef == NULL) {
+ terrno = TSDB_CODE_OUT_OF_MEMORY;
+ return -1;
+ }
+
+ // offset set to previous version when init
+ tqOffsetResetToLog(pOffsetVal, pHandle->pRef->refVer - 1);
+ }
+ } else if (reqOffset.type == TMQ_OFFSET__RESET_LATEST) {
+ if (pHandle->execHandle.subType == TOPIC_SUB_TYPE__COLUMN) {
+ SMqDataRsp dataRsp = {0};
+ tqInitDataRsp(&dataRsp, pRequest, pHandle->execHandle.subType);
+
+ tqOffsetResetToLog(&dataRsp.rspOffset, walGetLastVer(pTq->pVnode->pWal));
+ tqDebug("tmq poll: consumer:0x%" PRIx64 ", subkey %s, vgId:%d, (latest) offset reset to %" PRId64, consumerId,
+ pHandle->subKey, vgId, dataRsp.rspOffset.version);
+ int32_t code = tqSendDataRsp(pTq, pMsg, pRequest, &dataRsp, TMQ_MSG_TYPE__POLL_RSP);
+ tDeleteSMqDataRsp(&dataRsp);
+
+ *pBlockReturned = true;
+ return code;
+ } else {
+ STaosxRsp taosxRsp = {0};
+ tqInitTaosxRsp(&taosxRsp, pRequest);
+ tqOffsetResetToLog(&taosxRsp.rspOffset, walGetLastVer(pTq->pVnode->pWal));
+ int32_t code = tqSendDataRsp(pTq, pMsg, pRequest, (SMqDataRsp*)&taosxRsp, TMQ_MSG_TYPE__TAOSX_RSP);
+ tDeleteSTaosxRsp(&taosxRsp);
+
+ *pBlockReturned = true;
+ return code;
+ }
+ } else if (reqOffset.type == TMQ_OFFSET__RESET_NONE) {
+ tqError("tmq poll: subkey:%s, no offset committed for consumer:0x%" PRIx64 " in vg %d, subkey %s, reset none failed",
+ pHandle->subKey, consumerId, vgId, pRequest->subKey);
+ terrno = TSDB_CODE_TQ_NO_COMMITTED_OFFSET;
+ return -1;
+ }
+ }
+
+ return 0;
+}
+
+static int32_t extractDataAndRspForNormalSubscribe(STQ* pTq, STqHandle* pHandle, const SMqPollReq* pRequest,
+ SRpcMsg* pMsg, STqOffsetVal* pOffset) {
+ uint64_t consumerId = pRequest->consumerId;
+ int32_t vgId = TD_VID(pTq->pVnode);
+
+ SMqDataRsp dataRsp = {0};
+ tqInitDataRsp(&dataRsp, pRequest, pHandle->execHandle.subType);
+
+ // lock
+ taosWLockLatch(&pTq->lock);
+
+ qSetTaskId(pHandle->execHandle.task, consumerId, pRequest->reqId);
+ int code = tqScanData(pTq, pHandle, &dataRsp, pOffset);
+ if(code != 0) {
+ goto end;
+ }
+
+ // till now, all data has been transferred to consumer, new data needs to push client once arrived.
+ if (dataRsp.blockNum == 0 && dataRsp.reqOffset.type == TMQ_OFFSET__LOG &&
+ dataRsp.reqOffset.version == dataRsp.rspOffset.version && pHandle->consumerId == pRequest->consumerId) {
+ code = tqRegisterPushHandle(pTq, pHandle, pRequest, pMsg, &dataRsp, TMQ_MSG_TYPE__POLL_RSP);
+ taosWUnLockLatch(&pTq->lock);
+ return code;
+ }
+
+
+ code = tqSendDataRsp(pTq, pMsg, pRequest, (SMqDataRsp*)&dataRsp, TMQ_MSG_TYPE__POLL_RSP);
+
+ // NOTE: this pHandle->consumerId may have been changed already.
+
+ end:
+ {
+ char buf[80] = {0};
+ tFormatOffset(buf, 80, &dataRsp.rspOffset);
+ tqDebug("tmq poll: consumer:0x%" PRIx64 ", subkey %s, vgId:%d, rsp block:%d, rsp offset type:%s, reqId:0x%" PRIx64 " code:%d",
+ consumerId, pHandle->subKey, vgId, dataRsp.blockNum, buf, pRequest->reqId, code);
+ taosWUnLockLatch(&pTq->lock);
+ tDeleteSMqDataRsp(&dataRsp);
+ }
+ return code;
+}
+
+
+static int32_t extractDataAndRspForDbStbSubscribe(STQ* pTq, STqHandle* pHandle, const SMqPollReq* pRequest, SRpcMsg* pMsg, STqOffsetVal *offset) {
+ int code = 0;
+ int32_t vgId = TD_VID(pTq->pVnode);
+ SWalCkHead* pCkHead = NULL;
+ SMqMetaRsp metaRsp = {0};
+ STaosxRsp taosxRsp = {0};
+ tqInitTaosxRsp(&taosxRsp, pRequest);
+
+ if (offset->type != TMQ_OFFSET__LOG) {
+ if (tqScanTaosx(pTq, pHandle, &taosxRsp, &metaRsp, offset) < 0) {
+ return -1;
+ }
+
+ if (metaRsp.metaRspLen > 0) {
+ code = tqSendMetaPollRsp(pTq, pMsg, pRequest, &metaRsp);
+ tqDebug("tmq poll: consumer:0x%" PRIx64 " subkey:%s vgId:%d, send meta offset type:%d,uid:%" PRId64 ",ts:%" PRId64,
+ pRequest->consumerId, pHandle->subKey, vgId, metaRsp.rspOffset.type, metaRsp.rspOffset.uid, metaRsp.rspOffset.ts);
+ taosMemoryFree(metaRsp.metaRsp);
+ tDeleteSTaosxRsp(&taosxRsp);
+ return code;
+ }
+
+ tqDebug("taosx poll: consumer:0x%" PRIx64 " subkey:%s vgId:%d, send data blockNum:%d, offset type:%d,uid:%" PRId64
+ ",ts:%" PRId64,pRequest->consumerId, pHandle->subKey, vgId, taosxRsp.blockNum, taosxRsp.rspOffset.type, taosxRsp.rspOffset.uid,taosxRsp.rspOffset.ts);
+ if (taosxRsp.blockNum > 0) {
+ code = tqSendDataRsp(pTq, pMsg, pRequest, (SMqDataRsp*)&taosxRsp, TMQ_MSG_TYPE__TAOSX_RSP);
+ tDeleteSTaosxRsp(&taosxRsp);
+ return code;
+ }else {
+ *offset = taosxRsp.rspOffset;
+ }
+ }
+
+
+ if (offset->type == TMQ_OFFSET__LOG) {
+ int64_t fetchVer = offset->version + 1;
+ pCkHead = taosMemoryMalloc(sizeof(SWalCkHead) + 2048);
+ if (pCkHead == NULL) {
+ tDeleteSTaosxRsp(&taosxRsp);
+ terrno = TSDB_CODE_OUT_OF_MEMORY;
+ return -1;
+ }
+ walSetReaderCapacity(pHandle->pWalReader, 2048);
+ int totalRows = 0;
+ while (1) {
+ int32_t savedEpoch = atomic_load_32(&pHandle->epoch);
+ if (savedEpoch > pRequest->epoch) {
+ tqWarn("tmq poll: consumer:0x%" PRIx64 " (epoch %d), subkey:%s vgId:%d offset %" PRId64
+ ", found new consumer epoch %d, discard req epoch %d", pRequest->consumerId, pRequest->epoch, pHandle->subKey, vgId, fetchVer, savedEpoch, pRequest->epoch);
+ break;
+ }
+
+ if (tqFetchLog(pTq, pHandle, &fetchVer, &pCkHead, pRequest->reqId) < 0) {
+ tqOffsetResetToLog(&taosxRsp.rspOffset, fetchVer);
+ code = tqSendDataRsp(pTq, pMsg, pRequest, (SMqDataRsp*)&taosxRsp, TMQ_MSG_TYPE__TAOSX_RSP);
+ tDeleteSTaosxRsp(&taosxRsp);
+ taosMemoryFreeClear(pCkHead);
+ return code;
+ }
+
+ SWalCont* pHead = &pCkHead->head;
+ tqDebug("tmq poll: consumer:0x%" PRIx64 " (epoch %d) iter log, vgId:%d offset %" PRId64 " msgType %d", pRequest->consumerId,
+ pRequest->epoch, vgId, fetchVer, pHead->msgType);
+
+ // process meta
+ if (pHead->msgType != TDMT_VND_SUBMIT) {
+ if(totalRows > 0) {
+ tqOffsetResetToLog(&taosxRsp.rspOffset, fetchVer - 1);
+ code = tqSendDataRsp(pTq, pMsg, pRequest, (SMqDataRsp*)&taosxRsp, TMQ_MSG_TYPE__TAOSX_RSP);
+ tDeleteSTaosxRsp(&taosxRsp);
+ taosMemoryFreeClear(pCkHead);
+ return code;
+ }
+
+ tqDebug("fetch meta msg, ver:%" PRId64 ", type:%s", pHead->version, TMSG_INFO(pHead->msgType));
+ tqOffsetResetToLog(&metaRsp.rspOffset, fetchVer);
+ metaRsp.resMsgType = pHead->msgType;
+ metaRsp.metaRspLen = pHead->bodyLen;
+ metaRsp.metaRsp = pHead->body;
+ if (tqSendMetaPollRsp(pTq, pMsg, pRequest, &metaRsp) < 0) {
+ code = -1;
+ taosMemoryFreeClear(pCkHead);
+ tDeleteSTaosxRsp(&taosxRsp);
+ return code;
+ }
+ code = 0;
+ taosMemoryFreeClear(pCkHead);
+ tDeleteSTaosxRsp(&taosxRsp);
+ return code;
+ }
+
+ // process data
+ SPackedData submit = {
+ .msgStr = POINTER_SHIFT(pHead->body, sizeof(SSubmitReq2Msg)),
+ .msgLen = pHead->bodyLen - sizeof(SSubmitReq2Msg),
+ .ver = pHead->version,
+ };
+
+ if (tqTaosxScanLog(pTq, pHandle, submit, &taosxRsp, &totalRows) < 0) {
+ tqError("tmq poll: tqTaosxScanLog error %" PRId64 ", in vgId:%d, subkey %s", pRequest->consumerId, vgId,
+ pRequest->subKey);
+ taosMemoryFreeClear(pCkHead);
+ tDeleteSTaosxRsp(&taosxRsp);
+ return -1;
+ }
+
+ if (totalRows >= 4096 || taosxRsp.createTableNum > 0) {
+ tqOffsetResetToLog(&taosxRsp.rspOffset, fetchVer);
+ code = tqSendDataRsp(pTq, pMsg, pRequest, (SMqDataRsp*)&taosxRsp, TMQ_MSG_TYPE__TAOSX_RSP);
+ tDeleteSTaosxRsp(&taosxRsp);
+ taosMemoryFreeClear(pCkHead);
+ return code;
+ } else {
+ fetchVer++;
+ }
+ }
+ }
+
+ tDeleteSTaosxRsp(&taosxRsp);
+ taosMemoryFreeClear(pCkHead);
+ return 0;
+}
+
+int32_t tqExtractDataForMq(STQ* pTq, STqHandle* pHandle, const SMqPollReq* pRequest, SRpcMsg* pMsg) {
+ int32_t code = -1;
+ STqOffsetVal offset = {0};
+ STqOffsetVal reqOffset = pRequest->reqOffset;
+
+ // 1. reset the offset if needed
+ if (IS_OFFSET_RESET_TYPE(reqOffset.type)) {
+ // handle the reset offset cases, according to the consumer's choice.
+ bool blockReturned = false;
+ code = extractResetOffsetVal(&offset, pTq, pHandle, pRequest, pMsg, &blockReturned);
+ if (code != 0) {
+ return code;
+ }
+
+ // empty block returned, quit
+ if (blockReturned) {
+ return 0;
+ }
+ } else { // use the consumer specified offset
+ // the offset value can not be monotonious increase??
+ offset = reqOffset;
+ }
+
+ // this is a normal subscribe requirement
+ if (pHandle->execHandle.subType == TOPIC_SUB_TYPE__COLUMN) {
+ return extractDataAndRspForNormalSubscribe(pTq, pHandle, pRequest, pMsg, &offset);
+ }
+
+ // todo handle the case where re-balance occurs.
+ // for taosx
+ return extractDataAndRspForDbStbSubscribe(pTq, pHandle, pRequest, pMsg, &offset);
+}
+
+int32_t tqSendMetaPollRsp(STQ* pTq, const SRpcMsg* pMsg, const SMqPollReq* pReq, const SMqMetaRsp* pRsp) {
+ int32_t len = 0;
+ int32_t code = 0;
+ tEncodeSize(tEncodeSMqMetaRsp, pRsp, len, code);
+ if (code < 0) {
+ return -1;
+ }
+ int32_t tlen = sizeof(SMqRspHead) + len;
+ void* buf = rpcMallocCont(tlen);
+ if (buf == NULL) {
+ return -1;
+ }
+
+ ((SMqRspHead*)buf)->mqMsgType = TMQ_MSG_TYPE__POLL_META_RSP;
+ ((SMqRspHead*)buf)->epoch = pReq->epoch;
+ ((SMqRspHead*)buf)->consumerId = pReq->consumerId;
+
+ void* abuf = POINTER_SHIFT(buf, sizeof(SMqRspHead));
+
+ SEncoder encoder = {0};
+ tEncoderInit(&encoder, abuf, len);
+ tEncodeSMqMetaRsp(&encoder, pRsp);
+ tEncoderClear(&encoder);
+
+ SRpcMsg resp = {
+ .info = pMsg->info,
+ .pCont = buf,
+ .contLen = tlen,
+ .code = 0,
+ };
+ tmsgSendRsp(&resp);
+
+ tqDebug("vgId:%d, from consumer:0x%" PRIx64 " (epoch %d) send rsp, res msg type %d, offset type:%d",
+ TD_VID(pTq->pVnode), pReq->consumerId, pReq->epoch, pRsp->resMsgType, pRsp->rspOffset.type);
+
+ return 0;
+}
diff --git a/source/dnode/vnode/src/tsdb/tsdbCache.c b/source/dnode/vnode/src/tsdb/tsdbCache.c
index 48d3371284..3c7edd931b 100644
--- a/source/dnode/vnode/src/tsdb/tsdbCache.c
+++ b/source/dnode/vnode/src/tsdb/tsdbCache.c
@@ -35,7 +35,11 @@ _err:
static void tsdbCloseBICache(STsdb *pTsdb) {
SLRUCache *pCache = pTsdb->biCache;
if (pCache) {
+ int32_t elems = taosLRUCacheGetElems(pCache);
+ tsdbTrace("vgId:%d, elems: %d", TD_VID(pTsdb->pVnode), elems);
taosLRUCacheEraseUnrefEntries(pCache);
+ elems = taosLRUCacheGetElems(pCache);
+ tsdbTrace("vgId:%d, elems: %d", TD_VID(pTsdb->pVnode), elems);
taosLRUCacheCleanup(pCache);
@@ -820,7 +824,12 @@ static int32_t getNextRowFromFS(void *iter, TSDBROW **ppRow, bool *pIgnoreEarlie
* &state->blockIdx);
*/
state->pBlockIdx = taosArraySearch(state->aBlockIdx, state->pBlockIdxExp, tCmprBlockIdx, TD_EQ);
- if (!state->pBlockIdx) { /*
+ if (!state->pBlockIdx) {
+ tsdbBICacheRelease(state->pTsdb->biCache, state->aBlockIdxHandle);
+
+ state->aBlockIdxHandle = NULL;
+ state->aBlockIdx = NULL;
+ /*
tsdbDataFReaderClose(state->pDataFReader);
*state->pDataFReader = NULL;
resetLastBlockLoadInfo(state->pLoadInfo);*/
@@ -1469,11 +1478,14 @@ static int32_t mergeLastRow(tb_uid_t uid, STsdb *pTsdb, bool *dup, SArray **ppCo
hasRow = true;
- code = updateTSchema(TSDBROW_SVERSION(pRow), pr, uid);
- if (TSDB_CODE_SUCCESS != code) {
- goto _err;
+ int32_t sversion = TSDBROW_SVERSION(pRow);
+ if (sversion != -1) {
+ code = updateTSchema(sversion, pr, uid);
+ if (TSDB_CODE_SUCCESS != code) {
+ goto _err;
+ }
+ pTSchema = pr->pCurrSchema;
}
- pTSchema = pr->pCurrSchema;
int16_t nCol = pTSchema->numOfCols;
TSKEY rowTs = TSDBROW_TS(pRow);
@@ -1623,11 +1635,14 @@ static int32_t mergeLast(tb_uid_t uid, STsdb *pTsdb, SArray **ppLastArray, SCach
hasRow = true;
- code = updateTSchema(TSDBROW_SVERSION(pRow), pr, uid);
- if (TSDB_CODE_SUCCESS != code) {
- goto _err;
+ int32_t sversion = TSDBROW_SVERSION(pRow);
+ if (sversion != -1) {
+ code = updateTSchema(sversion, pr, uid);
+ if (TSDB_CODE_SUCCESS != code) {
+ goto _err;
+ }
+ pTSchema = pr->pCurrSchema;
}
- pTSchema = pr->pCurrSchema;
int16_t nCol = pTSchema->numOfCols;
TSKEY rowTs = TSDBROW_TS(pRow);
@@ -1931,6 +1946,7 @@ int32_t tsdbCacheGetBlockIdx(SLRUCache *pCache, SDataFReader *pFileReader, LRUHa
taosThreadMutexUnlock(&pTsdb->biMutex);
}
+ tsdbTrace("bi cache:%p, ref", pCache);
*handle = h;
return code;
@@ -1940,6 +1956,7 @@ int32_t tsdbBICacheRelease(SLRUCache *pCache, LRUHandle *h) {
int32_t code = 0;
taosLRUCacheRelease(pCache, h, false);
+ tsdbTrace("bi cache:%p, release", pCache);
return code;
}
diff --git a/source/dnode/vnode/src/tsdb/tsdbRead.c b/source/dnode/vnode/src/tsdb/tsdbRead.c
index 480ae7ea64..89686c3d33 100644
--- a/source/dnode/vnode/src/tsdb/tsdbRead.c
+++ b/source/dnode/vnode/src/tsdb/tsdbRead.c
@@ -831,6 +831,7 @@ static int32_t doLoadBlockIndex(STsdbReader* pReader, SDataFReader* pFileReader,
// this block belongs to a table that is not queried.
STableBlockScanInfo* pScanInfo = getTableBlockScanInfo(pReader->status.pTableMap, pBlockIdx->uid, pReader->idStr);
if (pScanInfo == NULL) {
+ tsdbBICacheRelease(pFileReader->pTsdb->biCache, handle);
return terrno;
}
@@ -1969,7 +1970,7 @@ static int32_t doMergeBufAndFileRows(STsdbReader* pReader, STableBlockScanInfo*
if (pReader->order == TSDB_ORDER_ASC) {
if (minKey == key) {
init = true;
- int32_t code = tsdbRowMergerInit(&merge, &fRow, pReader->pSchema);
+ int32_t code = tsdbRowMergerInit(&merge, NULL, &fRow, pReader->pSchema);
if (code != TSDB_CODE_SUCCESS) {
return code;
}
@@ -1979,10 +1980,10 @@ static int32_t doMergeBufAndFileRows(STsdbReader* pReader, STableBlockScanInfo*
if (minKey == tsLast) {
TSDBROW fRow1 = tMergeTreeGetRow(&pLastBlockReader->mergeTree);
if (init) {
- tsdbRowMerge(&merge, &fRow1);
+ tsdbRowMergerAdd(&merge, &fRow1, NULL);
} else {
init = true;
- int32_t code = tsdbRowMergerInit(&merge, &fRow1, pReader->pSchema);
+ int32_t code = tsdbRowMergerInit(&merge, NULL, &fRow1, pReader->pSchema);
if (code != TSDB_CODE_SUCCESS) {
return code;
}
@@ -1999,7 +2000,7 @@ static int32_t doMergeBufAndFileRows(STsdbReader* pReader, STableBlockScanInfo*
tsdbRowMergerAdd(&merge, pRow, pSchema);
} else {
init = true;
- int32_t code = tsdbRowMergerInit(&merge, pRow, pSchema);
+ int32_t code = tsdbRowMergerInit(&merge, NULL, pRow, pSchema);
if (code != TSDB_CODE_SUCCESS) {
return code;
}
@@ -2013,7 +2014,7 @@ static int32_t doMergeBufAndFileRows(STsdbReader* pReader, STableBlockScanInfo*
if (minKey == k.ts) {
init = true;
STSchema* pSchema = doGetSchemaForTSRow(TSDBROW_SVERSION(pRow), pReader, pBlockScanInfo->uid);
- int32_t code = tsdbRowMergerInit(&merge, pRow, pSchema);
+ int32_t code = tsdbRowMergerInit(&merge, NULL, pRow, pSchema);
if (code != TSDB_CODE_SUCCESS) {
return code;
}
@@ -2027,10 +2028,10 @@ static int32_t doMergeBufAndFileRows(STsdbReader* pReader, STableBlockScanInfo*
if (minKey == tsLast) {
TSDBROW fRow1 = tMergeTreeGetRow(&pLastBlockReader->mergeTree);
if (init) {
- tsdbRowMerge(&merge, &fRow1);
+ tsdbRowMergerAdd(&merge, &fRow1, NULL);
} else {
init = true;
- int32_t code = tsdbRowMergerInit(&merge, &fRow1, pReader->pSchema);
+ int32_t code = tsdbRowMergerInit(&merge, NULL, &fRow1, pReader->pSchema);
if (code != TSDB_CODE_SUCCESS) {
return code;
}
@@ -2040,10 +2041,10 @@ static int32_t doMergeBufAndFileRows(STsdbReader* pReader, STableBlockScanInfo*
if (minKey == key) {
if (init) {
- tsdbRowMerge(&merge, &fRow);
+ tsdbRowMergerAdd(&merge, &fRow, NULL);
} else {
init = true;
- int32_t code = tsdbRowMergerInit(&merge, &fRow, pReader->pSchema);
+ int32_t code = tsdbRowMergerInit(&merge, NULL, &fRow, pReader->pSchema);
if (code != TSDB_CODE_SUCCESS) {
return code;
}
@@ -2088,13 +2089,13 @@ static int32_t doMergeFileBlockAndLastBlock(SLastBlockReader* pLastBlockReader,
pBlockScanInfo->lastKey = tsLastBlock;
return TSDB_CODE_SUCCESS;
} else {
- int32_t code = tsdbRowMergerInit(&merge, &fRow, pReader->pSchema);
+ code = tsdbRowMergerInit(&merge, NULL, &fRow, pReader->pSchema);
if (code != TSDB_CODE_SUCCESS) {
return code;
}
TSDBROW fRow1 = tMergeTreeGetRow(&pLastBlockReader->mergeTree);
- tsdbRowMerge(&merge, &fRow1);
+ tsdbRowMergerAdd(&merge, &fRow1, NULL);
doMergeRowsInLastBlock(pLastBlockReader, pBlockScanInfo, tsLastBlock, &merge, &pReader->verRange, pReader->idStr);
code = tsdbRowMergerGetRow(&merge, &pTSRow);
@@ -2112,7 +2113,7 @@ static int32_t doMergeFileBlockAndLastBlock(SLastBlockReader* pLastBlockReader,
}
}
} else { // not merge block data
- int32_t code = tsdbRowMergerInit(&merge, &fRow, pReader->pSchema);
+ code = tsdbRowMergerInit(&merge, NULL, &fRow, pReader->pSchema);
if (code != TSDB_CODE_SUCCESS) {
return code;
}
@@ -2164,7 +2165,7 @@ static int32_t mergeFileBlockAndLastBlock(STsdbReader* pReader, SLastBlockReader
SRow* pTSRow = NULL;
SRowMerger merge = {0};
- int32_t code = tsdbRowMergerInit(&merge, &fRow, pReader->pSchema);
+ int32_t code = tsdbRowMergerInit(&merge, NULL, &fRow, pReader->pSchema);
if (code != TSDB_CODE_SUCCESS) {
return code;
}
@@ -2172,7 +2173,7 @@ static int32_t mergeFileBlockAndLastBlock(STsdbReader* pReader, SLastBlockReader
doMergeRowsInFileBlocks(pBlockData, pBlockScanInfo, pReader, &merge);
TSDBROW fRow1 = tMergeTreeGetRow(&pLastBlockReader->mergeTree);
- tsdbRowMerge(&merge, &fRow1);
+ tsdbRowMergerAdd(&merge, &fRow1, NULL);
doMergeRowsInLastBlock(pLastBlockReader, pBlockScanInfo, ts, &merge, &pReader->verRange, pReader->idStr);
@@ -2215,8 +2216,16 @@ static int32_t doMergeMultiLevelRows(STsdbReader* pReader, STableBlockScanInfo*
int64_t key = hasDataInFileBlock(pBlockData, pDumpInfo) ? pBlockData->aTSKEY[pDumpInfo->rowIndex] : INT64_MIN;
- TSDBKEY k = TSDBROW_KEY(pRow);
- TSDBKEY ik = TSDBROW_KEY(piRow);
+ TSDBKEY k = TSDBROW_KEY(pRow);
+ TSDBKEY ik = TSDBROW_KEY(piRow);
+ STSchema* pSchema = doGetSchemaForTSRow(TSDBROW_SVERSION(pRow), pReader, pBlockScanInfo->uid);
+ if (pSchema == NULL) {
+ return code;
+ }
+ STSchema* piSchema = doGetSchemaForTSRow(TSDBROW_SVERSION(piRow), pReader, pBlockScanInfo->uid);
+ if (piSchema == NULL) {
+ return code;
+ }
int64_t minKey = 0;
if (ASCENDING_TRAVERSE(pReader->order)) {
@@ -2263,7 +2272,7 @@ static int32_t doMergeMultiLevelRows(STsdbReader* pReader, STableBlockScanInfo*
if (minKey == key) {
init = true;
TSDBROW fRow = tsdbRowFromBlockData(pBlockData, pDumpInfo->rowIndex);
- code = tsdbRowMergerInit(&merge, &fRow, pReader->pSchema);
+ code = tsdbRowMergerInit(&merge, NULL, &fRow, pReader->pSchema);
if (code != TSDB_CODE_SUCCESS) {
return code;
}
@@ -2274,10 +2283,10 @@ static int32_t doMergeMultiLevelRows(STsdbReader* pReader, STableBlockScanInfo*
if (minKey == tsLast) {
TSDBROW fRow1 = tMergeTreeGetRow(&pLastBlockReader->mergeTree);
if (init) {
- tsdbRowMerge(&merge, &fRow1);
+ tsdbRowMergerAdd(&merge, &fRow1, NULL);
} else {
init = true;
- code = tsdbRowMergerInit(&merge, &fRow1, pReader->pSchema);
+ code = tsdbRowMergerInit(&merge, NULL, &fRow1, pReader->pSchema);
if (code != TSDB_CODE_SUCCESS) {
return code;
}
@@ -2288,15 +2297,10 @@ static int32_t doMergeMultiLevelRows(STsdbReader* pReader, STableBlockScanInfo*
if (minKey == ik.ts) {
if (init) {
- tsdbRowMerge(&merge, piRow);
+ tsdbRowMergerAdd(&merge, piRow, piSchema);
} else {
init = true;
- STSchema* pSchema = doGetSchemaForTSRow(TSDBROW_SVERSION(piRow), pReader, pBlockScanInfo->uid);
- if (pSchema == NULL) {
- return code;
- }
-
- code = tsdbRowMergerInit(&merge, piRow, pSchema);
+ code = tsdbRowMergerInit(&merge, pSchema, piRow, piSchema);
if (code != TSDB_CODE_SUCCESS) {
return code;
}
@@ -2315,10 +2319,10 @@ static int32_t doMergeMultiLevelRows(STsdbReader* pReader, STableBlockScanInfo*
return code;
}
- tsdbRowMerge(&merge, pRow);
+ tsdbRowMergerAdd(&merge, pRow, pSchema);
} else {
- STSchema* pSchema = doGetSchemaForTSRow(TSDBROW_SVERSION(pRow), pReader, pBlockScanInfo->uid);
- code = tsdbRowMergerInit(&merge, pRow, pSchema);
+ // STSchema* pSchema = doGetSchemaForTSRow(TSDBROW_SVERSION(pRow), pReader, pBlockScanInfo->uid);
+ code = tsdbRowMergerInit(&merge, NULL, pRow, pSchema);
if (code != TSDB_CODE_SUCCESS) {
return code;
}
@@ -2332,8 +2336,7 @@ static int32_t doMergeMultiLevelRows(STsdbReader* pReader, STableBlockScanInfo*
} else {
if (minKey == k.ts) {
init = true;
- STSchema* pSchema = doGetSchemaForTSRow(TSDBROW_SVERSION(pRow), pReader, pBlockScanInfo->uid);
- code = tsdbRowMergerInit(&merge, pRow, pSchema);
+ code = tsdbRowMergerInit(&merge, NULL, pRow, pSchema);
if (code != TSDB_CODE_SUCCESS) {
return code;
}
@@ -2347,11 +2350,11 @@ static int32_t doMergeMultiLevelRows(STsdbReader* pReader, STableBlockScanInfo*
if (minKey == ik.ts) {
if (init) {
- tsdbRowMerge(&merge, piRow);
+ tsdbRowMergerAdd(&merge, piRow, piSchema);
} else {
init = true;
- STSchema* pSchema = doGetSchemaForTSRow(TSDBROW_SVERSION(piRow), pReader, pBlockScanInfo->uid);
- code = tsdbRowMergerInit(&merge, piRow, pSchema);
+ // STSchema* pSchema = doGetSchemaForTSRow(TSDBROW_SVERSION(piRow), pReader, pBlockScanInfo->uid);
+ code = tsdbRowMergerInit(&merge, pSchema, piRow, piSchema);
if (code != TSDB_CODE_SUCCESS) {
return code;
}
@@ -2366,10 +2369,10 @@ static int32_t doMergeMultiLevelRows(STsdbReader* pReader, STableBlockScanInfo*
if (minKey == tsLast) {
TSDBROW fRow1 = tMergeTreeGetRow(&pLastBlockReader->mergeTree);
if (init) {
- tsdbRowMerge(&merge, &fRow1);
+ tsdbRowMergerAdd(&merge, &fRow1, NULL);
} else {
init = true;
- code = tsdbRowMergerInit(&merge, &fRow1, pReader->pSchema);
+ code = tsdbRowMergerInit(&merge, NULL, &fRow1, pReader->pSchema);
if (code != TSDB_CODE_SUCCESS) {
return code;
}
@@ -2380,7 +2383,7 @@ static int32_t doMergeMultiLevelRows(STsdbReader* pReader, STableBlockScanInfo*
if (minKey == key) {
TSDBROW fRow = tsdbRowFromBlockData(pBlockData, pDumpInfo->rowIndex);
if (!init) {
- code = tsdbRowMergerInit(&merge, &fRow, pReader->pSchema);
+ code = tsdbRowMergerInit(&merge, NULL, &fRow, pReader->pSchema);
if (code != TSDB_CODE_SUCCESS) {
return code;
}
@@ -2388,7 +2391,7 @@ static int32_t doMergeMultiLevelRows(STsdbReader* pReader, STableBlockScanInfo*
if (merge.pTSchema == NULL) {
return code;
}
- tsdbRowMerge(&merge, &fRow);
+ tsdbRowMergerAdd(&merge, &fRow, NULL);
}
doMergeRowsInFileBlocks(pBlockData, pBlockScanInfo, pReader, &merge);
}
@@ -2573,7 +2576,7 @@ int32_t mergeRowsInFileBlocks(SBlockData* pBlockData, STableBlockScanInfo* pBloc
SRow* pTSRow = NULL;
SRowMerger merge = {0};
- int32_t code = tsdbRowMergerInit(&merge, &fRow, pReader->pSchema);
+ code = tsdbRowMergerInit(&merge, NULL, &fRow, pReader->pSchema);
if (code != TSDB_CODE_SUCCESS) {
return code;
}
@@ -3240,8 +3243,8 @@ static int32_t readRowsCountFromFiles(STsdbReader* pReader) {
int32_t code = TSDB_CODE_SUCCESS;
while (1) {
- bool hasNext = false;
- int32_t code = filesetIteratorNext(&pReader->status.fileIter, pReader, &hasNext);
+ bool hasNext = false;
+ code = filesetIteratorNext(&pReader->status.fileIter, pReader, &hasNext);
if (code) {
return code;
}
@@ -3513,8 +3516,8 @@ SVersionRange getQueryVerRange(SVnode* pVnode, SQueryTableDataCond* pCond, int8_
int64_t startVer = (pCond->startVersion == -1) ? 0 : pCond->startVersion;
int64_t endVer = 0;
- if (pCond->endVersion ==
- -1) { // user not specified end version, set current maximum version of vnode as the endVersion
+ if (pCond->endVersion == -1) {
+ // user not specified end version, set current maximum version of vnode as the endVersion
endVer = pVnode->state.applied;
} else {
endVer = (pCond->endVersion > pVnode->state.applied) ? pVnode->state.applied : pCond->endVersion;
@@ -3694,7 +3697,7 @@ int32_t doMergeRowsInBuf(SIterInfo* pIter, uint64_t uid, int64_t ts, SArray* pDe
tsdbRowMergerAdd(pMerger, pRow, pTSchema);
} else { // column format
- tsdbRowMerge(pMerger, pRow);
+ tsdbRowMergerAdd(pMerger, pRow, NULL);
}
}
@@ -3710,7 +3713,7 @@ static int32_t doMergeRowsInFileBlockImpl(SBlockData* pBlockData, int32_t rowInd
}
TSDBROW fRow = tsdbRowFromBlockData(pBlockData, rowIndex);
- tsdbRowMerge(pMerger, &fRow);
+ tsdbRowMergerAdd(pMerger, &fRow, NULL);
rowIndex += step;
}
@@ -3788,7 +3791,7 @@ int32_t doMergeRowsInLastBlock(SLastBlockReader* pLastBlockReader, STableBlockSc
int64_t next1 = getCurrentKeyInLastBlock(pLastBlockReader);
if (next1 == ts) {
TSDBROW fRow1 = tMergeTreeGetRow(&pLastBlockReader->mergeTree);
- tsdbRowMerge(pMerger, &fRow1);
+ tsdbRowMergerAdd(pMerger, &fRow1, NULL);
} else {
tsdbTrace("uid:%" PRIu64 " last del index:%d, del range:%d, lastKeyInStt:%" PRId64 ", %s", pScanInfo->uid,
pScanInfo->lastBlockDelIndex, (int32_t)taosArrayGetSize(pScanInfo->delSkyline), pScanInfo->lastKeyInStt,
@@ -3844,7 +3847,7 @@ int32_t doMergeMemTableMultiRows(TSDBROW* pRow, uint64_t uid, SIterInfo* pIter,
pReader->pSchema = pTSchema;
}
- code = tsdbRowMergerInit2(&merge, pReader->pSchema, ¤t, pTSchema);
+ code = tsdbRowMergerInit(&merge, pReader->pSchema, ¤t, pTSchema);
if (code != TSDB_CODE_SUCCESS) {
return code;
}
@@ -3856,12 +3859,12 @@ int32_t doMergeMemTableMultiRows(TSDBROW* pRow, uint64_t uid, SIterInfo* pIter,
tsdbRowMergerAdd(&merge, pNextRow, pTSchema1);
} else { // let's merge rows in file block
- code = tsdbRowMergerInit(&merge, ¤t, pReader->pSchema);
+ code = tsdbRowMergerInit(&merge, NULL, ¤t, pReader->pSchema);
if (code != TSDB_CODE_SUCCESS) {
return code;
}
- tsdbRowMerge(&merge, pNextRow);
+ tsdbRowMergerAdd(&merge, pNextRow, NULL);
}
code = doMergeRowsInBuf(pIter, uid, TSDBROW_TS(¤t), pDelList, &merge, pReader);
@@ -3885,14 +3888,13 @@ int32_t doMergeMemIMemRows(TSDBROW* pRow, TSDBROW* piRow, STableBlockScanInfo* p
SRow** pTSRow) {
SRowMerger merge = {0};
- TSDBKEY k = TSDBROW_KEY(pRow);
- TSDBKEY ik = TSDBROW_KEY(piRow);
+ TSDBKEY k = TSDBROW_KEY(pRow);
+ TSDBKEY ik = TSDBROW_KEY(piRow);
+ STSchema* pSchema = doGetSchemaForTSRow(TSDBROW_SVERSION(pRow), pReader, pBlockScanInfo->uid);
+ STSchema* piSchema = doGetSchemaForTSRow(TSDBROW_SVERSION(piRow), pReader, pBlockScanInfo->uid);
if (ASCENDING_TRAVERSE(pReader->order)) { // ascending order imem --> mem
- STSchema* pSchema = doGetSchemaForTSRow(TSDBROW_SVERSION(pRow), pReader, pBlockScanInfo->uid);
- STSchema* piSchema = doGetSchemaForTSRow(TSDBROW_SVERSION(piRow), pReader, pBlockScanInfo->uid);
-
- int32_t code = tsdbRowMergerInit2(&merge, pSchema, piRow, piSchema);
+ int32_t code = tsdbRowMergerInit(&merge, pSchema, piRow, piSchema);
if (code != TSDB_CODE_SUCCESS) {
return code;
}
@@ -3911,9 +3913,7 @@ int32_t doMergeMemIMemRows(TSDBROW* pRow, TSDBROW* piRow, STableBlockScanInfo* p
}
} else {
- STSchema* pSchema = doGetSchemaForTSRow(TSDBROW_SVERSION(pRow), pReader, pBlockScanInfo->uid);
-
- int32_t code = tsdbRowMergerInit(&merge, pRow, pSchema);
+ int32_t code = tsdbRowMergerInit(&merge, NULL, pRow, pSchema);
if (code != TSDB_CODE_SUCCESS || merge.pTSchema == NULL) {
return code;
}
@@ -3924,7 +3924,7 @@ int32_t doMergeMemIMemRows(TSDBROW* pRow, TSDBROW* piRow, STableBlockScanInfo* p
return code;
}
- tsdbRowMerge(&merge, piRow);
+ tsdbRowMergerAdd(&merge, piRow, piSchema);
code = doMergeRowsInBuf(&pBlockScanInfo->iiter, pBlockScanInfo->uid, ik.ts, pBlockScanInfo->delSkyline, &merge,
pReader);
if (code != TSDB_CODE_SUCCESS) {
diff --git a/source/dnode/vnode/src/tsdb/tsdbUtil.c b/source/dnode/vnode/src/tsdb/tsdbUtil.c
index c323ae1532..dd11134bd0 100644
--- a/source/dnode/vnode/src/tsdb/tsdbUtil.c
+++ b/source/dnode/vnode/src/tsdb/tsdbUtil.c
@@ -638,13 +638,17 @@ SColVal *tsdbRowIterNext(STSDBRowIter *pIter) {
// SRowMerger ======================================================
-int32_t tsdbRowMergerInit2(SRowMerger *pMerger, STSchema *pResTSchema, TSDBROW *pRow, STSchema *pTSchema) {
+int32_t tsdbRowMergerInit(SRowMerger *pMerger, STSchema *pResTSchema, TSDBROW *pRow, STSchema *pTSchema) {
int32_t code = 0;
TSDBKEY key = TSDBROW_KEY(pRow);
SColVal *pColVal = &(SColVal){0};
STColumn *pTColumn;
int32_t iCol, jCol = 0;
+ if (NULL == pResTSchema) {
+ pResTSchema = pTSchema;
+ }
+
pMerger->pTSchema = pResTSchema;
pMerger->version = key.version;
@@ -712,6 +716,9 @@ int32_t tsdbRowMergerAdd(SRowMerger *pMerger, TSDBROW *pRow, STSchema *pTSchema)
STColumn *pTColumn;
int32_t iCol, jCol = 1;
+ if (NULL == pTSchema) {
+ pTSchema = pMerger->pTSchema;
+ }
ASSERT(((SColVal *)pMerger->pArray->pData)->value.val == key.ts);
for (iCol = 1; iCol < pMerger->pTSchema->numOfCols && jCol < pTSchema->numOfCols; ++iCol) {
@@ -727,23 +734,6 @@ int32_t tsdbRowMergerAdd(SRowMerger *pMerger, TSDBROW *pRow, STSchema *pTSchema)
tsdbRowGetColVal(pRow, pTSchema, jCol++, pColVal);
if (key.version > pMerger->version) {
-#if 0
- if (!COL_VAL_IS_NONE(pColVal)) {
- if ((!COL_VAL_IS_NULL(pColVal)) && IS_VAR_DATA_TYPE(pColVal->type)) {
- SColVal *tColVal = taosArrayGet(pMerger->pArray, iCol);
- code = tRealloc(&tColVal->value.pData, pColVal->value.nData);
- if (code) return code;
-
- tColVal->value.nData = pColVal->value.nData;
- if (pColVal->value.nData) {
- memcpy(tColVal->value.pData, pColVal->value.pData, pColVal->value.nData);
- }
- tColVal->flag = 0;
- } else {
- taosArraySet(pMerger->pArray, iCol, pColVal);
- }
- }
-#endif
if (!COL_VAL_IS_NONE(pColVal)) {
if (IS_VAR_DATA_TYPE(pColVal->type)) {
SColVal *pTColVal = taosArrayGet(pMerger->pArray, iCol);
@@ -758,7 +748,6 @@ int32_t tsdbRowMergerAdd(SRowMerger *pMerger, TSDBROW *pRow, STSchema *pTSchema)
pTColVal->flag = 0;
} else {
tFree(pTColVal->value.pData);
- pTColVal->value.pData = NULL;
taosArraySet(pMerger->pArray, iCol, pColVal);
}
} else {
@@ -789,7 +778,7 @@ int32_t tsdbRowMergerAdd(SRowMerger *pMerger, TSDBROW *pRow, STSchema *pTSchema)
pMerger->version = key.version;
return code;
}
-
+/*
int32_t tsdbRowMergerInit(SRowMerger *pMerger, TSDBROW *pRow, STSchema *pTSchema) {
int32_t code = 0;
TSDBKEY key = TSDBROW_KEY(pRow);
@@ -840,7 +829,7 @@ int32_t tsdbRowMergerInit(SRowMerger *pMerger, TSDBROW *pRow, STSchema *pTSchema
_exit:
return code;
}
-
+*/
void tsdbRowMergerClear(SRowMerger *pMerger) {
for (int32_t iCol = 1; iCol < pMerger->pTSchema->numOfCols; iCol++) {
SColVal *pTColVal = taosArrayGet(pMerger->pArray, iCol);
@@ -851,7 +840,7 @@ void tsdbRowMergerClear(SRowMerger *pMerger) {
taosArrayDestroy(pMerger->pArray);
}
-
+/*
int32_t tsdbRowMerge(SRowMerger *pMerger, TSDBROW *pRow) {
int32_t code = 0;
TSDBKEY key = TSDBROW_KEY(pRow);
@@ -916,7 +905,7 @@ int32_t tsdbRowMerge(SRowMerger *pMerger, TSDBROW *pRow) {
_exit:
return code;
}
-
+*/
int32_t tsdbRowMergerGetRow(SRowMerger *pMerger, SRow **ppRow) {
return tRowBuild(pMerger->pArray, pMerger->pTSchema, ppRow);
}
diff --git a/source/dnode/vnode/src/vnd/vnodeSvr.c b/source/dnode/vnode/src/vnd/vnodeSvr.c
index 02d361ccdb..b62bf27def 100644
--- a/source/dnode/vnode/src/vnd/vnodeSvr.c
+++ b/source/dnode/vnode/src/vnd/vnodeSvr.c
@@ -400,7 +400,7 @@ int32_t vnodeProcessWriteMsg(SVnode *pVnode, SRpcMsg *pMsg, int64_t version, SRp
}
break;
case TDMT_STREAM_TASK_DEPLOY: {
- if (tqProcessTaskDeployReq(pVnode->pTq, version, pReq, len) < 0) {
+ if (pVnode->restored && tqProcessTaskDeployReq(pVnode->pTq, version, pReq, len) < 0) {
goto _err;
}
} break;
@@ -447,13 +447,11 @@ int32_t vnodeProcessWriteMsg(SVnode *pVnode, SRpcMsg *pMsg, int64_t version, SRp
walApplyVer(pVnode->pWal, version);
- /*vInfo("vgId:%d, push msg begin", pVnode->config.vgId);*/
if (tqPushMsg(pVnode->pTq, pMsg->pCont, pMsg->contLen, pMsg->msgType, version) < 0) {
/*vInfo("vgId:%d, push msg end", pVnode->config.vgId);*/
vError("vgId:%d, failed to push msg to TQ since %s", TD_VID(pVnode), tstrerror(terrno));
return -1;
}
- /*vInfo("vgId:%d, push msg end", pVnode->config.vgId);*/
// commit if need
if (needCommit) {
@@ -543,10 +541,8 @@ int32_t vnodeProcessFetchMsg(SVnode *pVnode, SRpcMsg *pMsg, SQueueInfo *pInfo) {
return tqProcessPollReq(pVnode->pTq, pMsg);
case TDMT_STREAM_TASK_RUN:
return tqProcessTaskRunReq(pVnode->pTq, pMsg);
-#if 1
case TDMT_STREAM_TASK_DISPATCH:
return tqProcessTaskDispatchReq(pVnode->pTq, pMsg, true);
-#endif
case TDMT_STREAM_TASK_CHECK:
return tqProcessStreamTaskCheckReq(pVnode->pTq, pMsg);
case TDMT_STREAM_TASK_DISPATCH_RSP:
diff --git a/source/dnode/vnode/src/vnd/vnodeSync.c b/source/dnode/vnode/src/vnd/vnodeSync.c
index d681f5b65e..9f5d722583 100644
--- a/source/dnode/vnode/src/vnd/vnodeSync.c
+++ b/source/dnode/vnode/src/vnd/vnodeSync.c
@@ -549,6 +549,9 @@ static void vnodeRestoreFinish(const SSyncFSM *pFsm, const SyncIndex commitIdx)
pVnode->restored = true;
vInfo("vgId:%d, sync restore finished", pVnode->config.vgId);
+
+ // start to restore all stream tasks
+ tqStartStreamTasks(pVnode->pTq);
}
static void vnodeBecomeFollower(const SSyncFSM *pFsm) {
diff --git a/source/libs/catalog/CMakeLists.txt b/source/libs/catalog/CMakeLists.txt
index 632034d6b6..bc56ff4c7f 100644
--- a/source/libs/catalog/CMakeLists.txt
+++ b/source/libs/catalog/CMakeLists.txt
@@ -8,9 +8,9 @@ target_include_directories(
target_link_libraries(
catalog
- PRIVATE os util transport qcom
+ PRIVATE os util transport qcom nodes
)
if(${BUILD_TEST})
ADD_SUBDIRECTORY(test)
-endif(${BUILD_TEST})
\ No newline at end of file
+endif(${BUILD_TEST})
diff --git a/source/libs/catalog/inc/catalogInt.h b/source/libs/catalog/inc/catalogInt.h
index c4e1fd3078..85a130d293 100644
--- a/source/libs/catalog/inc/catalogInt.h
+++ b/source/libs/catalog/inc/catalogInt.h
@@ -66,8 +66,8 @@ typedef enum {
} CTG_CACHE_ITEM;
#define CTG_CI_FLAG_LEVEL_GLOBAL (1)
-#define CTG_CI_FLAG_LEVEL_CLUSTER (1<<1)
-#define CTG_CI_FLAG_LEVEL_DB (1<<2)
+#define CTG_CI_FLAG_LEVEL_CLUSTER (1 << 1)
+#define CTG_CI_FLAG_LEVEL_DB (1 << 2)
enum {
CTG_READ = 1,
@@ -132,6 +132,19 @@ typedef struct SCtgCacheStat {
uint64_t cacheNHit[CTG_CI_MAX_VALUE];
} SCtgCacheStat;
+typedef struct SCtgAuthReq {
+ SRequestConnInfo* pConn;
+ SUserAuthInfo* pRawReq;
+ SGetUserAuthRsp authInfo;
+ AUTH_TYPE singleType;
+ bool onlyCache;
+} SCtgAuthReq;
+
+typedef struct SCtgAuthRsp {
+ SUserAuthRes* pRawRes;
+ bool metaNotExists;
+} SCtgAuthRsp;
+
typedef struct SCtgTbCacheInfo {
bool inCache;
uint64_t dbId;
@@ -224,13 +237,13 @@ typedef struct SCtgVgCache {
} SCtgVgCache;
typedef struct SCtgDBCache {
- SRWLatch dbLock; // RC between destroy tbCache/stbCache and all reads
- uint64_t dbId;
- int8_t deleted;
- SCtgVgCache vgCache;
- SHashObj* tbCache; // key:tbname, value:SCtgTbCache
- SHashObj* stbCache; // key:suid, value:char*
- uint64_t dbCacheNum[CTG_CI_MAX_VALUE];
+ SRWLatch dbLock; // RC between destroy tbCache/stbCache and all reads
+ uint64_t dbId;
+ int8_t deleted;
+ SCtgVgCache vgCache;
+ SHashObj* tbCache; // key:tbname, value:SCtgTbCache
+ SHashObj* stbCache; // key:suid, value:char*
+ uint64_t dbCacheNum[CTG_CI_MAX_VALUE];
} SCtgDBCache;
typedef struct SCtgRentSlot {
@@ -248,12 +261,8 @@ typedef struct SCtgRentMgmt {
} SCtgRentMgmt;
typedef struct SCtgUserAuth {
- int32_t version;
- SRWLatch lock;
- bool superUser;
- SHashObj* createdDbs;
- SHashObj* readDbs;
- SHashObj* writeDbs;
+ SRWLatch lock;
+ SGetUserAuthRsp userAuth;
} SCtgUserAuth;
typedef struct SCatalog {
@@ -505,11 +514,11 @@ typedef struct SCtgOperation {
} SCtgOperation;
typedef struct SCtgCacheItemInfo {
- char *name;
+ char* name;
int32_t flag;
} SCtgCacheItemInfo;
-#define CTG_AUTH_READ(_t) ((_t) == AUTH_TYPE_READ || (_t) == AUTH_TYPE_READ_OR_WRITE)
+#define CTG_AUTH_READ(_t) ((_t) == AUTH_TYPE_READ || (_t) == AUTH_TYPE_READ_OR_WRITE)
#define CTG_AUTH_WRITE(_t) ((_t) == AUTH_TYPE_WRITE || (_t) == AUTH_TYPE_READ_OR_WRITE)
#define CTG_QUEUE_INC() atomic_add_fetch_64(&gCtgMgmt.queue.qRemainNum, 1)
@@ -519,88 +528,90 @@ typedef struct SCtgCacheItemInfo {
#define CTG_STAT_DEC(_item, _n) atomic_sub_fetch_64(&(_item), _n)
#define CTG_STAT_GET(_item) atomic_load_64(&(_item))
-#define CTG_DB_NUM_INC(_item) dbCache->dbCacheNum[_item] += 1
-#define CTG_DB_NUM_DEC(_item) dbCache->dbCacheNum[_item] -= 1
-#define CTG_DB_NUM_SET(_item) dbCache->dbCacheNum[_item] = 1
+#define CTG_DB_NUM_INC(_item) dbCache->dbCacheNum[_item] += 1
+#define CTG_DB_NUM_DEC(_item) dbCache->dbCacheNum[_item] -= 1
+#define CTG_DB_NUM_SET(_item) dbCache->dbCacheNum[_item] = 1
#define CTG_DB_NUM_RESET(_item) dbCache->dbCacheNum[_item] = 0
-#define CTG_STAT_API_INC(item, n) (CTG_STAT_INC(gCtgMgmt.statInfo.api.item, n))
-#define CTG_STAT_RT_INC(item, n) (CTG_STAT_INC(gCtgMgmt.statInfo.runtime.item, n))
-#define CTG_STAT_NUM_INC(item, n) (CTG_STAT_INC(gCtgMgmt.statInfo.cache.cacheNum[item], n))
-#define CTG_STAT_NUM_DEC(item, n) (CTG_STAT_DEC(gCtgMgmt.statInfo.cache.cacheNum[item], n))
-#define CTG_STAT_HIT_INC(item, n) (CTG_STAT_INC(gCtgMgmt.statInfo.cache.cacheHit[item], n))
-#define CTG_STAT_HIT_DEC(item, n) (CTG_STAT_DEC(gCtgMgmt.statInfo.cache.cacheHit[item], n))
+#define CTG_STAT_API_INC(item, n) (CTG_STAT_INC(gCtgMgmt.statInfo.api.item, n))
+#define CTG_STAT_RT_INC(item, n) (CTG_STAT_INC(gCtgMgmt.statInfo.runtime.item, n))
+#define CTG_STAT_NUM_INC(item, n) (CTG_STAT_INC(gCtgMgmt.statInfo.cache.cacheNum[item], n))
+#define CTG_STAT_NUM_DEC(item, n) (CTG_STAT_DEC(gCtgMgmt.statInfo.cache.cacheNum[item], n))
+#define CTG_STAT_HIT_INC(item, n) (CTG_STAT_INC(gCtgMgmt.statInfo.cache.cacheHit[item], n))
+#define CTG_STAT_HIT_DEC(item, n) (CTG_STAT_DEC(gCtgMgmt.statInfo.cache.cacheHit[item], n))
#define CTG_STAT_NHIT_INC(item, n) (CTG_STAT_INC(gCtgMgmt.statInfo.cache.cacheNHit[item], n))
#define CTG_STAT_NHIT_DEC(item, n) (CTG_STAT_DEC(gCtgMgmt.statInfo.cache.cacheNHit[item], n))
-#define CTG_CACHE_NUM_INC(item, n) (CTG_STAT_INC(pCtg->cacheStat.cacheNum[item], n))
-#define CTG_CACHE_NUM_DEC(item, n) (CTG_STAT_DEC(pCtg->cacheStat.cacheNum[item], n))
-#define CTG_CACHE_HIT_INC(item, n) (CTG_STAT_INC(pCtg->cacheStat.cacheHit[item], n))
+#define CTG_CACHE_NUM_INC(item, n) (CTG_STAT_INC(pCtg->cacheStat.cacheNum[item], n))
+#define CTG_CACHE_NUM_DEC(item, n) (CTG_STAT_DEC(pCtg->cacheStat.cacheNum[item], n))
+#define CTG_CACHE_HIT_INC(item, n) (CTG_STAT_INC(pCtg->cacheStat.cacheHit[item], n))
#define CTG_CACHE_NHIT_INC(item, n) (CTG_STAT_INC(pCtg->cacheStat.cacheNHit[item], n))
-#define CTG_META_NUM_INC(type) do { \
- switch (type) { \
- case TSDB_SUPER_TABLE: \
- CTG_DB_NUM_INC(CTG_CI_STABLE_META); \
- break; \
- case TSDB_CHILD_TABLE: \
- CTG_DB_NUM_INC(CTG_CI_CTABLE_META); \
- break; \
- case TSDB_NORMAL_TABLE: \
- CTG_DB_NUM_INC(CTG_CI_NTABLE_META); \
- break; \
- case TSDB_SYSTEM_TABLE: \
- CTG_DB_NUM_INC(CTG_CI_SYSTABLE_META); \
- break; \
- default: \
- CTG_DB_NUM_INC(CTG_CI_OTHERTABLE_META); \
- break; \
- } \
-} while (0)
+#define CTG_META_NUM_INC(type) \
+ do { \
+ switch (type) { \
+ case TSDB_SUPER_TABLE: \
+ CTG_DB_NUM_INC(CTG_CI_STABLE_META); \
+ break; \
+ case TSDB_CHILD_TABLE: \
+ CTG_DB_NUM_INC(CTG_CI_CTABLE_META); \
+ break; \
+ case TSDB_NORMAL_TABLE: \
+ CTG_DB_NUM_INC(CTG_CI_NTABLE_META); \
+ break; \
+ case TSDB_SYSTEM_TABLE: \
+ CTG_DB_NUM_INC(CTG_CI_SYSTABLE_META); \
+ break; \
+ default: \
+ CTG_DB_NUM_INC(CTG_CI_OTHERTABLE_META); \
+ break; \
+ } \
+ } while (0)
-#define CTG_META_NUM_DEC(type) do { \
- switch (type) { \
- case TSDB_SUPER_TABLE: \
- CTG_DB_NUM_DEC(CTG_CI_STABLE_META); \
- break; \
- case TSDB_CHILD_TABLE: \
- CTG_DB_NUM_DEC(CTG_CI_CTABLE_META); \
- break; \
- case TSDB_NORMAL_TABLE: \
- CTG_DB_NUM_DEC(CTG_CI_NTABLE_META); \
- break; \
- case TSDB_SYSTEM_TABLE: \
- CTG_DB_NUM_DEC(CTG_CI_SYSTABLE_META); \
- break; \
- default: \
- CTG_DB_NUM_DEC(CTG_CI_OTHERTABLE_META); \
- break; \
- } \
-} while (0)
+#define CTG_META_NUM_DEC(type) \
+ do { \
+ switch (type) { \
+ case TSDB_SUPER_TABLE: \
+ CTG_DB_NUM_DEC(CTG_CI_STABLE_META); \
+ break; \
+ case TSDB_CHILD_TABLE: \
+ CTG_DB_NUM_DEC(CTG_CI_CTABLE_META); \
+ break; \
+ case TSDB_NORMAL_TABLE: \
+ CTG_DB_NUM_DEC(CTG_CI_NTABLE_META); \
+ break; \
+ case TSDB_SYSTEM_TABLE: \
+ CTG_DB_NUM_DEC(CTG_CI_SYSTABLE_META); \
+ break; \
+ default: \
+ CTG_DB_NUM_DEC(CTG_CI_OTHERTABLE_META); \
+ break; \
+ } \
+ } while (0)
-#define CTG_META_HIT_INC(type) do { \
- switch (type) { \
- case TSDB_SUPER_TABLE: \
- CTG_CACHE_HIT_INC(CTG_CI_STABLE_META, 1); \
- break; \
- case TSDB_CHILD_TABLE: \
- CTG_CACHE_HIT_INC(CTG_CI_CTABLE_META, 1); \
- break; \
- case TSDB_NORMAL_TABLE: \
- CTG_CACHE_HIT_INC(CTG_CI_NTABLE_META, 1); \
- break; \
- case TSDB_SYSTEM_TABLE: \
- CTG_CACHE_HIT_INC(CTG_CI_SYSTABLE_META, 1); \
- break; \
- default: \
- CTG_CACHE_HIT_INC(CTG_CI_OTHERTABLE_META, 1); \
- break; \
- } \
-} while (0)
+#define CTG_META_HIT_INC(type) \
+ do { \
+ switch (type) { \
+ case TSDB_SUPER_TABLE: \
+ CTG_CACHE_HIT_INC(CTG_CI_STABLE_META, 1); \
+ break; \
+ case TSDB_CHILD_TABLE: \
+ CTG_CACHE_HIT_INC(CTG_CI_CTABLE_META, 1); \
+ break; \
+ case TSDB_NORMAL_TABLE: \
+ CTG_CACHE_HIT_INC(CTG_CI_NTABLE_META, 1); \
+ break; \
+ case TSDB_SYSTEM_TABLE: \
+ CTG_CACHE_HIT_INC(CTG_CI_SYSTABLE_META, 1); \
+ break; \
+ default: \
+ CTG_CACHE_HIT_INC(CTG_CI_OTHERTABLE_META, 1); \
+ break; \
+ } \
+ } while (0)
#define CTG_META_NHIT_INC() CTG_CACHE_NHIT_INC(CTG_CI_OTHERTABLE_META, 1)
-
#define CTG_IS_META_NULL(type) ((type) == META_TYPE_NULL_TABLE)
#define CTG_IS_META_CTABLE(type) ((type) == META_TYPE_CTABLE)
#define CTG_IS_META_TABLE(type) ((type) == META_TYPE_TABLE)
@@ -659,7 +670,6 @@ typedef struct SCtgCacheItemInfo {
#define ctgTaskDebug(param, ...) qDebug("QID:%" PRIx64 " CTG:%p " param, pTask->pJob->queryId, pCtg, __VA_ARGS__)
#define ctgTaskTrace(param, ...) qTrace("QID:%" PRIx64 " CTG:%p " param, pTask->pJob->queryId, pCtg, __VA_ARGS__)
-
#define CTG_LOCK_DEBUG(...) \
do { \
if (gCTGDebug.lockEnable) { \
@@ -681,38 +691,38 @@ typedef struct SCtgCacheItemInfo {
#define TD_RWLATCH_WRITE_FLAG_COPY 0x40000000
-#define CTG_LOCK(type, _lock) \
- do { \
- if (CTG_READ == (type)) { \
- ASSERTS(atomic_load_32((_lock)) >= 0, "invalid lock value before read lock"); \
- CTG_LOCK_DEBUG("CTG RLOCK%p:%d, %s:%d B", (_lock), atomic_load_32(_lock), __FILE__, __LINE__); \
- taosRLockLatch(_lock); \
- CTG_LOCK_DEBUG("CTG RLOCK%p:%d, %s:%d E", (_lock), atomic_load_32(_lock), __FILE__, __LINE__); \
- ASSERTS(atomic_load_32((_lock)) > 0, "invalid lock value after read lock"); \
- } else { \
- ASSERTS(atomic_load_32((_lock)) >= 0, "invalid lock value before write lock"); \
- CTG_LOCK_DEBUG("CTG WLOCK%p:%d, %s:%d B", (_lock), atomic_load_32(_lock), __FILE__, __LINE__); \
- taosWLockLatch(_lock); \
- CTG_LOCK_DEBUG("CTG WLOCK%p:%d, %s:%d E", (_lock), atomic_load_32(_lock), __FILE__, __LINE__); \
- ASSERTS(atomic_load_32((_lock)) == TD_RWLATCH_WRITE_FLAG_COPY, "invalid lock value after write lock"); \
- } \
+#define CTG_LOCK(type, _lock) \
+ do { \
+ if (CTG_READ == (type)) { \
+ ASSERTS(atomic_load_32((_lock)) >= 0, "invalid lock value before read lock"); \
+ CTG_LOCK_DEBUG("CTG RLOCK%p:%d, %s:%d B", (_lock), atomic_load_32(_lock), __FILE__, __LINE__); \
+ taosRLockLatch(_lock); \
+ CTG_LOCK_DEBUG("CTG RLOCK%p:%d, %s:%d E", (_lock), atomic_load_32(_lock), __FILE__, __LINE__); \
+ ASSERTS(atomic_load_32((_lock)) > 0, "invalid lock value after read lock"); \
+ } else { \
+ ASSERTS(atomic_load_32((_lock)) >= 0, "invalid lock value before write lock"); \
+ CTG_LOCK_DEBUG("CTG WLOCK%p:%d, %s:%d B", (_lock), atomic_load_32(_lock), __FILE__, __LINE__); \
+ taosWLockLatch(_lock); \
+ CTG_LOCK_DEBUG("CTG WLOCK%p:%d, %s:%d E", (_lock), atomic_load_32(_lock), __FILE__, __LINE__); \
+ ASSERTS(atomic_load_32((_lock)) == TD_RWLATCH_WRITE_FLAG_COPY, "invalid lock value after write lock"); \
+ } \
} while (0)
-#define CTG_UNLOCK(type, _lock) \
- do { \
- if (CTG_READ == (type)) { \
- ASSERTS(atomic_load_32((_lock)) > 0, "invalid lock value before read unlock"); \
- CTG_LOCK_DEBUG("CTG RULOCK%p:%d, %s:%d B", (_lock), atomic_load_32(_lock), __FILE__, __LINE__); \
- taosRUnLockLatch(_lock); \
- CTG_LOCK_DEBUG("CTG RULOCK%p:%d, %s:%d E", (_lock), atomic_load_32(_lock), __FILE__, __LINE__); \
- ASSERTS(atomic_load_32((_lock)) >= 0, "invalid lock value after read unlock"); \
- } else { \
- ASSERTS(atomic_load_32((_lock)) == TD_RWLATCH_WRITE_FLAG_COPY, "invalid lock value before write unlock"); \
- CTG_LOCK_DEBUG("CTG WULOCK%p:%d, %s:%d B", (_lock), atomic_load_32(_lock), __FILE__, __LINE__); \
- taosWUnLockLatch(_lock); \
- CTG_LOCK_DEBUG("CTG WULOCK%p:%d, %s:%d E", (_lock), atomic_load_32(_lock), __FILE__, __LINE__); \
- ASSERTS(atomic_load_32((_lock)) >= 0, "invalid lock value after write unlock"); \
- } \
+#define CTG_UNLOCK(type, _lock) \
+ do { \
+ if (CTG_READ == (type)) { \
+ ASSERTS(atomic_load_32((_lock)) > 0, "invalid lock value before read unlock"); \
+ CTG_LOCK_DEBUG("CTG RULOCK%p:%d, %s:%d B", (_lock), atomic_load_32(_lock), __FILE__, __LINE__); \
+ taosRUnLockLatch(_lock); \
+ CTG_LOCK_DEBUG("CTG RULOCK%p:%d, %s:%d E", (_lock), atomic_load_32(_lock), __FILE__, __LINE__); \
+ ASSERTS(atomic_load_32((_lock)) >= 0, "invalid lock value after read unlock"); \
+ } else { \
+ ASSERTS(atomic_load_32((_lock)) == TD_RWLATCH_WRITE_FLAG_COPY, "invalid lock value before write unlock"); \
+ CTG_LOCK_DEBUG("CTG WULOCK%p:%d, %s:%d B", (_lock), atomic_load_32(_lock), __FILE__, __LINE__); \
+ taosWUnLockLatch(_lock); \
+ CTG_LOCK_DEBUG("CTG WULOCK%p:%d, %s:%d E", (_lock), atomic_load_32(_lock), __FILE__, __LINE__); \
+ ASSERTS(atomic_load_32((_lock)) >= 0, "invalid lock value after write unlock"); \
+ } \
} while (0)
#define CTG_ERR_RET(c) \
@@ -806,7 +816,7 @@ int32_t ctgTbMetaExistInCache(SCatalog* pCtg, char* dbFName, char* tbName, int32
int32_t ctgReadTbMetaFromCache(SCatalog* pCtg, SCtgTbMetaCtx* ctx, STableMeta** pTableMeta);
int32_t ctgReadTbVerFromCache(SCatalog* pCtg, SName* pTableName, int32_t* sver, int32_t* tver, int32_t* tbType,
uint64_t* suid, char* stbName);
-int32_t ctgChkAuthFromCache(SCatalog* pCtg, char* user, char* dbFName, AUTH_TYPE type, bool* inCache, bool* pass);
+int32_t ctgChkAuthFromCache(SCatalog* pCtg, SUserAuthInfo* pReq, bool* inCache, SCtgAuthRsp* pRes);
int32_t ctgDropDbCacheEnqueue(SCatalog* pCtg, const char* dbFName, int64_t dbId);
int32_t ctgDropDbVgroupEnqueue(SCatalog* pCtg, const char* dbFName, bool syncReq);
int32_t ctgDropStbMetaEnqueue(SCatalog* pCtg, const char* dbFName, int64_t dbId, const char* stbName, uint64_t suid,
@@ -879,7 +889,8 @@ void ctgFreeHandleImpl(SCatalog* pCtg);
int32_t ctgGetVgInfoFromHashValue(SCatalog* pCtg, SDBVgInfo* dbInfo, const SName* pTableName, SVgroupInfo* pVgroup);
int32_t ctgGetVgInfosFromHashValue(SCatalog* pCtg, SCtgTaskReq* tReq, SDBVgInfo* dbInfo, SCtgTbHashsCtx* pCtx,
char* dbFName, SArray* pNames, bool update);
-int32_t ctgGetVgIdsFromHashValue(SCatalog* pCtg, SDBVgInfo* dbInfo, char* dbFName, const char* pTbs[], int32_t tbNum, int32_t* vgId);
+int32_t ctgGetVgIdsFromHashValue(SCatalog* pCtg, SDBVgInfo* dbInfo, char* dbFName, const char* pTbs[], int32_t tbNum,
+ int32_t* vgId);
void ctgResetTbMetaTask(SCtgTask* pTask);
void ctgFreeDbCache(SCtgDBCache* dbCache);
int32_t ctgStbVersionSortCompare(const void* key1, const void* key2);
@@ -900,20 +911,24 @@ void ctgFreeQNode(SCtgQNode* node);
void ctgClearHandle(SCatalog* pCtg);
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);
+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);
+int32_t ctgdGetOneHandle(SCatalog** pHandle);
int ctgVgInfoComp(const void* lp, const void* rp);
int32_t ctgMakeVgArray(SDBVgInfo* dbInfo);
-int32_t ctgAcquireVgMetaFromCache(SCatalog *pCtg, const char *dbFName, const char *tbName, SCtgDBCache **pDb, SCtgTbCache **pTb);
-int32_t ctgCopyTbMeta(SCatalog *pCtg, SCtgTbMetaCtx *ctx, SCtgDBCache **pDb, SCtgTbCache **pTb, STableMeta **pTableMeta, char* dbFName);
-void ctgReleaseVgMetaToCache(SCatalog *pCtg, SCtgDBCache *dbCache, SCtgTbCache *pCache);
-void ctgReleaseTbMetaToCache(SCatalog *pCtg, SCtgDBCache *dbCache, SCtgTbCache *pCache);
-void ctgGetGlobalCacheStat(SCtgCacheStat *pStat);
+int32_t ctgAcquireVgMetaFromCache(SCatalog* pCtg, const char* dbFName, const char* tbName, SCtgDBCache** pDb,
+ SCtgTbCache** pTb);
+int32_t ctgCopyTbMeta(SCatalog* pCtg, SCtgTbMetaCtx* ctx, SCtgDBCache** pDb, SCtgTbCache** pTb, STableMeta** pTableMeta,
+ char* dbFName);
+void ctgReleaseVgMetaToCache(SCatalog* pCtg, SCtgDBCache* dbCache, SCtgTbCache* pCache);
+void ctgReleaseTbMetaToCache(SCatalog* pCtg, SCtgDBCache* dbCache, SCtgTbCache* pCache);
+void ctgGetGlobalCacheStat(SCtgCacheStat* pStat);
+int32_t ctgChkSetAuthRes(SCatalog* pCtg, SCtgAuthReq* req, SCtgAuthRsp* res);
-extern SCatalogMgmt gCtgMgmt;
-extern SCtgDebug gCTGDebug;
-extern SCtgAsyncFps gCtgAsyncFps[];
+extern SCatalogMgmt gCtgMgmt;
+extern SCtgDebug gCTGDebug;
+extern SCtgAsyncFps gCtgAsyncFps[];
extern SCtgCacheItemInfo gCtgStatItem[CTG_CI_MAX_VALUE];
#ifdef __cplusplus
diff --git a/source/libs/catalog/src/catalog.c b/source/libs/catalog/src/catalog.c
index 8a56b0889b..bddc6c01a7 100644
--- a/source/libs/catalog/src/catalog.c
+++ b/source/libs/catalog/src/catalog.c
@@ -319,14 +319,13 @@ _return:
CTG_RET(code);
}
-int32_t ctgChkAuth(SCatalog* pCtg, SRequestConnInfo* pConn, const char* user, const char* dbFName, AUTH_TYPE type,
- bool* pass, bool* exists) {
+int32_t ctgChkAuth(SCatalog* pCtg, SRequestConnInfo* pConn, SUserAuthInfo *pReq, SUserAuthRes* pRes, bool* exists) {
bool inCache = false;
int32_t code = 0;
+ SCtgAuthRsp rsp = {0};
+ rsp.pRawRes = pRes;
- *pass = false;
-
- CTG_ERR_RET(ctgChkAuthFromCache(pCtg, (char*)user, (char*)dbFName, type, &inCache, pass));
+ CTG_ERR_RET(ctgChkAuthFromCache(pCtg, pReq, &inCache, &rsp));
if (inCache) {
if (exists) {
@@ -339,30 +338,22 @@ int32_t ctgChkAuth(SCatalog* pCtg, SRequestConnInfo* pConn, const char* user, co
return TSDB_CODE_SUCCESS;
}
- SGetUserAuthRsp authRsp = {0};
- CTG_ERR_RET(ctgGetUserDbAuthFromMnode(pCtg, pConn, user, &authRsp, NULL));
+ SCtgAuthReq req = {0};
+ req.pRawReq = pReq;
+ req.pConn = pConn;
+ req.onlyCache = exists ? true : false;
+ CTG_ERR_RET(ctgGetUserDbAuthFromMnode(pCtg, pConn, pReq->user, &req.authInfo, NULL));
- if (authRsp.superAuth) {
- *pass = true;
- goto _return;
- }
-
- if (authRsp.createdDbs && taosHashGet(authRsp.createdDbs, dbFName, strlen(dbFName))) {
- *pass = true;
- goto _return;
- }
-
- if (CTG_AUTH_READ(type) && authRsp.readDbs && taosHashGet(authRsp.readDbs, dbFName, strlen(dbFName))) {
- *pass = true;
- } else if (CTG_AUTH_WRITE(type) && authRsp.writeDbs && taosHashGet(authRsp.writeDbs, dbFName, strlen(dbFName))) {
- *pass = true;
+ CTG_ERR_JRET(ctgChkSetAuthRes(pCtg, &req, &rsp));
+ if (rsp.metaNotExists && exists) {
+ *exists = false;
}
_return:
- ctgUpdateUserEnqueue(pCtg, &authRsp, false);
+ ctgUpdateUserEnqueue(pCtg, &req.authInfo, false);
- return TSDB_CODE_SUCCESS;
+ CTG_RET(code);
}
int32_t ctgGetTbType(SCatalog* pCtg, SRequestConnInfo* pConn, SName* pTableName, int32_t* tbType) {
@@ -1373,7 +1364,7 @@ int32_t catalogGetExpiredUsers(SCatalog* pCtg, SUserAuthVersion** users, uint32_
void* key = taosHashGetKey(pAuth, &len);
strncpy((*users)[i].user, key, len);
(*users)[i].user[len] = 0;
- (*users)[i].version = pAuth->version;
+ (*users)[i].version = pAuth->userAuth.version;
++i;
if (i >= *num) {
taosHashCancelIterate(pCtg->userCache, pAuth);
@@ -1457,32 +1448,30 @@ _return:
CTG_API_LEAVE(code);
}
-int32_t catalogChkAuth(SCatalog* pCtg, SRequestConnInfo* pConn, const char* user, const char* dbFName, AUTH_TYPE type,
- bool* pass) {
+int32_t catalogChkAuth(SCatalog* pCtg, SRequestConnInfo* pConn, SUserAuthInfo *pAuth, SUserAuthRes* pRes) {
CTG_API_ENTER();
- if (NULL == pCtg || NULL == pConn || NULL == user || NULL == dbFName || NULL == pass) {
+ if (NULL == pCtg || NULL == pConn || NULL == pAuth || NULL == pRes) {
CTG_API_LEAVE(TSDB_CODE_CTG_INVALID_INPUT);
}
int32_t code = 0;
- CTG_ERR_JRET(ctgChkAuth(pCtg, pConn, user, dbFName, type, pass, NULL));
+ CTG_ERR_JRET(ctgChkAuth(pCtg, pConn, pAuth, pRes, NULL));
_return:
CTG_API_LEAVE(code);
}
-int32_t catalogChkAuthFromCache(SCatalog* pCtg, const char* user, const char* dbFName, AUTH_TYPE type,
- bool* pass, bool* exists) {
+int32_t catalogChkAuthFromCache(SCatalog* pCtg, SUserAuthInfo *pAuth, SUserAuthRes* pRes, bool* exists) {
CTG_API_ENTER();
- if (NULL == pCtg || NULL == user || NULL == dbFName || NULL == pass || NULL == exists) {
+ if (NULL == pCtg || NULL == pAuth || NULL == pRes || 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));
+ CTG_ERR_JRET(ctgChkAuth(pCtg, NULL, pAuth, pRes, exists));
_return:
diff --git a/source/libs/catalog/src/ctgAsync.c b/source/libs/catalog/src/ctgAsync.c
index 6c56661937..f2a354997d 100644
--- a/source/libs/catalog/src/ctgAsync.c
+++ b/source/libs/catalog/src/ctgAsync.c
@@ -1550,45 +1550,20 @@ _return:
int32_t ctgHandleGetUserRsp(SCtgTaskReq* tReq, int32_t reqType, const SDataBuf* pMsg, int32_t rspCode) {
int32_t code = 0;
SCtgTask* pTask = tReq->pTask;
- SCtgUserCtx* ctx = (SCtgUserCtx*)pTask->taskCtx;
SCatalog* pCtg = pTask->pJob->pCtg;
- bool pass = false;
SGetUserAuthRsp* pOut = (SGetUserAuthRsp*)pTask->msgCtx.out;
CTG_ERR_JRET(ctgProcessRspMsg(pTask->msgCtx.out, reqType, pMsg->pData, pMsg->len, rspCode, pTask->msgCtx.target));
- if (pOut->superAuth) {
- pass = true;
- goto _return;
- }
+ ctgUpdateUserEnqueue(pCtg, pOut, true);
+ taosMemoryFreeClear(pTask->msgCtx.out);
- if (pOut->createdDbs && taosHashGet(pOut->createdDbs, ctx->user.dbFName, strlen(ctx->user.dbFName))) {
- pass = true;
- goto _return;
- }
+ CTG_ERR_JRET((*gCtgAsyncFps[pTask->type].launchFp)(pTask));
- if (CTG_AUTH_READ(ctx->user.type) && pOut->readDbs &&
- taosHashGet(pOut->readDbs, ctx->user.dbFName, strlen(ctx->user.dbFName))) {
- pass = true;
- } else if (CTG_AUTH_WRITE(ctx->user.type) && pOut->writeDbs &&
- taosHashGet(pOut->writeDbs, ctx->user.dbFName, strlen(ctx->user.dbFName))) {
- pass = true;
- }
+ return TSDB_CODE_SUCCESS;
_return:
- if (TSDB_CODE_SUCCESS == code) {
- pTask->res = taosMemoryCalloc(1, sizeof(bool));
- if (NULL == pTask->res) {
- code = TSDB_CODE_OUT_OF_MEMORY;
- } else {
- *(bool*)pTask->res = pass;
- }
- }
-
- ctgUpdateUserEnqueue(pCtg, pOut, false);
- taosMemoryFreeClear(pTask->msgCtx.out);
-
ctgHandleTaskEnd(pTask, code);
CTG_RET(code);
@@ -2081,31 +2056,39 @@ int32_t ctgLaunchGetUdfTask(SCtgTask* pTask) {
}
int32_t ctgLaunchGetUserTask(SCtgTask* pTask) {
+ int32_t code = 0;
SCatalog* pCtg = pTask->pJob->pCtg;
SRequestConnInfo* pConn = &pTask->pJob->conn;
SCtgUserCtx* pCtx = (SCtgUserCtx*)pTask->taskCtx;
bool inCache = false;
- bool pass = false;
+ SCtgAuthRsp rsp = {0};
SCtgJob* pJob = pTask->pJob;
SCtgMsgCtx* pMsgCtx = CTG_GET_TASK_MSGCTX(pTask, -1);
if (NULL == pMsgCtx->pBatchs) {
pMsgCtx->pBatchs = pJob->pBatchs;
}
- CTG_ERR_RET(ctgChkAuthFromCache(pCtg, pCtx->user.user, pCtx->user.dbFName, pCtx->user.type, &inCache, &pass));
+ rsp.pRawRes = taosMemoryCalloc(1, sizeof(SUserAuthRes));
+ if (NULL == rsp.pRawRes) {
+ CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
+ }
+
+ CTG_ERR_RET(ctgChkAuthFromCache(pCtg, &pCtx->user, &inCache, &rsp));
if (inCache) {
- pTask->res = taosMemoryCalloc(1, sizeof(bool));
- if (NULL == pTask->res) {
- CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
- }
- *(bool*)pTask->res = pass;
+ pTask->res = rsp.pRawRes;
CTG_ERR_RET(ctgHandleTaskEnd(pTask, 0));
return TSDB_CODE_SUCCESS;
}
- CTG_ERR_RET(ctgGetUserDbAuthFromMnode(pCtg, pConn, pCtx->user.user, NULL, pTask));
+ taosMemoryFreeClear(rsp.pRawRes);
+ if (rsp.metaNotExists) {
+ CTG_ERR_RET(ctgLaunchSubTask(pTask, CTG_TASK_GET_TB_META, ctgGetTbCfgCb, &pCtx->user.tbName));
+ } else {
+ CTG_ERR_RET(ctgGetUserDbAuthFromMnode(pCtg, pConn, pCtx->user.user, NULL, pTask));
+ }
+
return TSDB_CODE_SUCCESS;
}
@@ -2155,6 +2138,20 @@ _return:
CTG_RET(ctgHandleTaskEnd(pTask, pTask->subRes.code));
}
+
+int32_t ctgGetUserCb(SCtgTask* pTask) {
+ int32_t code = 0;
+
+ CTG_ERR_JRET(pTask->subRes.code);
+
+ CTG_RET(ctgLaunchGetUserTask(pTask));
+
+_return:
+
+ CTG_RET(ctgHandleTaskEnd(pTask, pTask->subRes.code));
+}
+
+
int32_t ctgCompDbVgTasks(SCtgTask* pTask, void* param, bool* equal) {
SCtgDbVgCtx* ctx = pTask->taskCtx;
diff --git a/source/libs/catalog/src/ctgCache.c b/source/libs/catalog/src/ctgCache.c
index b032158865..592b6e9c72 100644
--- a/source/libs/catalog/src/ctgCache.c
+++ b/source/libs/catalog/src/ctgCache.c
@@ -32,27 +32,26 @@ SCtgOperation gCtgCacheOperation[CTG_OP_MAX] = {{CTG_OP_UPDATE_VGROUP, "update v
{CTG_OP_CLEAR_CACHE, "clear cache", ctgOpClearCache}};
SCtgCacheItemInfo gCtgStatItem[CTG_CI_MAX_VALUE] = {
- {"Cluster ", CTG_CI_FLAG_LEVEL_GLOBAL}, //CTG_CI_CLUSTER
- {"Dnode ", CTG_CI_FLAG_LEVEL_CLUSTER}, //CTG_CI_DNODE,
- {"Qnode ", CTG_CI_FLAG_LEVEL_CLUSTER}, //CTG_CI_QNODE,
- {"DB ", CTG_CI_FLAG_LEVEL_CLUSTER}, //CTG_CI_DB,
- {"DbVgroup ", CTG_CI_FLAG_LEVEL_DB}, //CTG_CI_DB_VGROUP,
- {"DbCfg ", CTG_CI_FLAG_LEVEL_DB}, //CTG_CI_DB_CFG,
- {"DbInfo ", CTG_CI_FLAG_LEVEL_DB}, //CTG_CI_DB_INFO,
- {"StbMeta ", CTG_CI_FLAG_LEVEL_DB}, //CTG_CI_STABLE_META,
- {"NtbMeta ", CTG_CI_FLAG_LEVEL_DB}, //CTG_CI_NTABLE_META,
- {"CtbMeta ", CTG_CI_FLAG_LEVEL_DB}, //CTG_CI_CTABLE_META,
- {"SysTblMeta", CTG_CI_FLAG_LEVEL_DB}, //CTG_CI_SYSTABLE_META,
- {"OthTblMeta", CTG_CI_FLAG_LEVEL_DB}, //CTG_CI_OTHERTABLE_META,
- {"TblSMA ", CTG_CI_FLAG_LEVEL_DB}, //CTG_CI_TBL_SMA,
- {"TblCfg ", CTG_CI_FLAG_LEVEL_DB}, //CTG_CI_TBL_CFG,
- {"IndexInfo ", CTG_CI_FLAG_LEVEL_DB}, //CTG_CI_INDEX_INFO,
- {"User ", CTG_CI_FLAG_LEVEL_CLUSTER}, //CTG_CI_USER,
- {"UDF ", CTG_CI_FLAG_LEVEL_CLUSTER}, //CTG_CI_UDF,
- {"SvrVer ", CTG_CI_FLAG_LEVEL_CLUSTER} //CTG_CI_SVR_VER,
+ {"Cluster ", CTG_CI_FLAG_LEVEL_GLOBAL}, // CTG_CI_CLUSTER
+ {"Dnode ", CTG_CI_FLAG_LEVEL_CLUSTER}, // CTG_CI_DNODE,
+ {"Qnode ", CTG_CI_FLAG_LEVEL_CLUSTER}, // CTG_CI_QNODE,
+ {"DB ", CTG_CI_FLAG_LEVEL_CLUSTER}, // CTG_CI_DB,
+ {"DbVgroup ", CTG_CI_FLAG_LEVEL_DB}, // CTG_CI_DB_VGROUP,
+ {"DbCfg ", CTG_CI_FLAG_LEVEL_DB}, // CTG_CI_DB_CFG,
+ {"DbInfo ", CTG_CI_FLAG_LEVEL_DB}, // CTG_CI_DB_INFO,
+ {"StbMeta ", CTG_CI_FLAG_LEVEL_DB}, // CTG_CI_STABLE_META,
+ {"NtbMeta ", CTG_CI_FLAG_LEVEL_DB}, // CTG_CI_NTABLE_META,
+ {"CtbMeta ", CTG_CI_FLAG_LEVEL_DB}, // CTG_CI_CTABLE_META,
+ {"SysTblMeta", CTG_CI_FLAG_LEVEL_DB}, // CTG_CI_SYSTABLE_META,
+ {"OthTblMeta", CTG_CI_FLAG_LEVEL_DB}, // CTG_CI_OTHERTABLE_META,
+ {"TblSMA ", CTG_CI_FLAG_LEVEL_DB}, // CTG_CI_TBL_SMA,
+ {"TblCfg ", CTG_CI_FLAG_LEVEL_DB}, // CTG_CI_TBL_CFG,
+ {"IndexInfo ", CTG_CI_FLAG_LEVEL_DB}, // CTG_CI_INDEX_INFO,
+ {"User ", CTG_CI_FLAG_LEVEL_CLUSTER}, // CTG_CI_USER,
+ {"UDF ", CTG_CI_FLAG_LEVEL_CLUSTER}, // CTG_CI_UDF,
+ {"SvrVer ", CTG_CI_FLAG_LEVEL_CLUSTER} // CTG_CI_SVR_VER,
};
-
int32_t ctgRLockVgInfo(SCatalog *pCtg, SCtgDBCache *dbCache, bool *inCache) {
CTG_LOCK(CTG_READ, &dbCache->vgCache.vgLock);
@@ -263,10 +262,11 @@ _return:
return TSDB_CODE_SUCCESS;
}
-int32_t ctgAcquireVgMetaFromCache(SCatalog *pCtg, const char *dbFName, const char *tbName, SCtgDBCache **pDb, SCtgTbCache **pTb) {
+int32_t ctgAcquireVgMetaFromCache(SCatalog *pCtg, const char *dbFName, const char *tbName, SCtgDBCache **pDb,
+ SCtgTbCache **pTb) {
SCtgDBCache *dbCache = NULL;
SCtgTbCache *tbCache = NULL;
- bool vgInCache = false;
+ bool vgInCache = false;
ctgAcquireDBCache(pCtg, dbFName, &dbCache);
if (NULL == dbCache) {
@@ -331,7 +331,6 @@ _return:
return TSDB_CODE_SUCCESS;
}
-
/*
int32_t ctgAcquireStbMetaFromCache(SCatalog *pCtg, char *dbFName, uint64_t suid, SCtgDBCache **pDb, SCtgTbCache **pTb) {
SCtgDBCache *dbCache = NULL;
@@ -385,9 +384,10 @@ _return:
}
*/
-int32_t ctgAcquireStbMetaFromCache(SCtgDBCache *dbCache, SCatalog *pCtg, char *dbFName, uint64_t suid, SCtgTbCache **pTb) {
+int32_t ctgAcquireStbMetaFromCache(SCtgDBCache *dbCache, SCatalog *pCtg, char *dbFName, uint64_t suid,
+ SCtgTbCache **pTb) {
SCtgTbCache *pCache = NULL;
- char *stName = taosHashAcquire(dbCache->stbCache, &suid, sizeof(suid));
+ char *stName = taosHashAcquire(dbCache->stbCache, &suid, sizeof(suid));
if (NULL == stName) {
ctgDebug("stb 0x%" PRIx64 " not in cache, dbFName:%s", suid, dbFName);
goto _return;
@@ -484,10 +484,11 @@ int32_t ctgTbMetaExistInCache(SCatalog *pCtg, char *dbFName, char *tbName, int32
return TSDB_CODE_SUCCESS;
}
-int32_t ctgCopyTbMeta(SCatalog *pCtg, SCtgTbMetaCtx *ctx, SCtgDBCache **pDb, SCtgTbCache **pTb, STableMeta **pTableMeta, char* dbFName) {
+int32_t ctgCopyTbMeta(SCatalog *pCtg, SCtgTbMetaCtx *ctx, SCtgDBCache **pDb, SCtgTbCache **pTb, STableMeta **pTableMeta,
+ char *dbFName) {
SCtgDBCache *dbCache = *pDb;
SCtgTbCache *tbCache = *pTb;
- STableMeta *tbMeta = tbCache->pMeta;
+ STableMeta *tbMeta = tbCache->pMeta;
ctx->tbInfo.inCache = true;
ctx->tbInfo.dbId = dbCache->dbId;
ctx->tbInfo.suid = tbMeta->suid;
@@ -516,12 +517,12 @@ int32_t ctgCopyTbMeta(SCatalog *pCtg, SCtgTbMetaCtx *ctx, SCtgDBCache **pDb, SCt
memcpy(*pTableMeta, tbMeta, metaSize);
- //ctgReleaseTbMetaToCache(pCtg, dbCache, tbCache);
+ // ctgReleaseTbMetaToCache(pCtg, dbCache, tbCache);
CTG_UNLOCK(CTG_READ, &tbCache->metaLock);
taosHashRelease(dbCache->tbCache, tbCache);
*pTb = NULL;
-
+
ctgDebug("Got ctb %s meta from cache, will continue to get its stb meta, type:%d, dbFName:%s", ctx->pName->tname,
ctx->tbInfo.tbType, dbFName);
@@ -553,7 +554,6 @@ int32_t ctgCopyTbMeta(SCatalog *pCtg, SCtgTbMetaCtx *ctx, SCtgDBCache **pDb, SCt
return TSDB_CODE_SUCCESS;
}
-
int32_t ctgReadTbMetaFromCache(SCatalog *pCtg, SCtgTbMetaCtx *ctx, STableMeta **pTableMeta) {
int32_t code = 0;
SCtgDBCache *dbCache = NULL;
@@ -623,17 +623,17 @@ int32_t ctgReadTbVerFromCache(SCatalog *pCtg, SName *pTableName, int32_t *sver,
// PROCESS FOR CHILD TABLE
- //ctgReleaseTbMetaToCache(pCtg, dbCache, tbCache);
+ // ctgReleaseTbMetaToCache(pCtg, dbCache, tbCache);
if (tbCache) {
CTG_UNLOCK(CTG_READ, &tbCache->metaLock);
taosHashRelease(dbCache->tbCache, tbCache);
}
-
+
ctgDebug("Got ctb %s ver from cache, will continue to get its stb ver, dbFName:%s", pTableName->tname, dbFName);
ctgAcquireStbMetaFromCache(dbCache, pCtg, dbFName, *suid, &tbCache);
if (NULL == tbCache) {
- //ctgReleaseTbMetaToCache(pCtg, dbCache, tbCache);
+ // ctgReleaseTbMetaToCache(pCtg, dbCache, tbCache);
ctgDebug("stb 0x%" PRIx64 " meta not in cache", *suid);
return TSDB_CODE_SUCCESS;
}
@@ -703,55 +703,40 @@ _return:
CTG_RET(code);
}
-int32_t ctgChkAuthFromCache(SCatalog *pCtg, char *user, char *dbFName, AUTH_TYPE type, bool *inCache, bool *pass) {
- char *p = strchr(dbFName, '.');
- if (p) {
- ++p;
- } else {
- p = dbFName;
- }
-
- if (IS_SYS_DBNAME(p)) {
+int32_t ctgChkAuthFromCache(SCatalog *pCtg, SUserAuthInfo *pReq, bool *inCache, SCtgAuthRsp *pRes) {
+ if (IS_SYS_DBNAME(pReq->tbName.dbname)) {
*inCache = true;
- *pass = true;
- ctgDebug("sysdb %s, pass", dbFName);
+ pRes->pRawRes->pass = true;
+ ctgDebug("sysdb %s, pass", pReq->tbName.dbname);
return TSDB_CODE_SUCCESS;
}
- SCtgUserAuth *pUser = (SCtgUserAuth *)taosHashGet(pCtg->userCache, user, strlen(user));
+ SCtgUserAuth *pUser = (SCtgUserAuth *)taosHashGet(pCtg->userCache, pReq->user, strlen(pReq->user));
if (NULL == pUser) {
- ctgDebug("user not in cache, user:%s", user);
+ ctgDebug("user not in cache, user:%s", pReq->user);
goto _return;
}
*inCache = true;
- ctgDebug("Got user from cache, user:%s", user);
+ ctgDebug("Got user from cache, user:%s", pReq->user);
CTG_CACHE_HIT_INC(CTG_CI_USER, 1);
- if (pUser->superUser) {
- *pass = true;
- return TSDB_CODE_SUCCESS;
- }
+ SCtgAuthReq req = {0};
+ req.pRawReq = pReq;
+ req.onlyCache = true;
CTG_LOCK(CTG_READ, &pUser->lock);
- if (pUser->createdDbs && taosHashGet(pUser->createdDbs, dbFName, strlen(dbFName))) {
- *pass = true;
- CTG_UNLOCK(CTG_READ, &pUser->lock);
- return TSDB_CODE_SUCCESS;
- }
-
- if (pUser->readDbs && taosHashGet(pUser->readDbs, dbFName, strlen(dbFName)) && CTG_AUTH_READ(type)) {
- *pass = true;
- }
-
- if (pUser->writeDbs && taosHashGet(pUser->writeDbs, dbFName, strlen(dbFName)) && CTG_AUTH_WRITE(type)) {
- *pass = true;
- }
-
+ memcpy(&req.authInfo, &pUser->userAuth, sizeof(pUser->userAuth));
+ int32_t code = ctgChkSetAuthRes(pCtg, &req, pRes);
CTG_UNLOCK(CTG_READ, &pUser->lock);
+ CTG_ERR_JRET(code);
- return TSDB_CODE_SUCCESS;
+ if (pRes->metaNotExists) {
+ goto _return;
+ }
+
+ CTG_RET(code);
_return:
@@ -1639,7 +1624,7 @@ int32_t ctgWriteTbIndexToCache(SCatalog *pCtg, SCtgDBCache *dbCache, char *dbFNa
}
CTG_DB_NUM_INC(CTG_CI_TBL_SMA);
-
+
*index = NULL;
ctgDebug("table %s index updated to cache, ver:%d, num:%d", tbName, pIndex->version,
(int32_t)taosArrayGetSize(pIndex->pIndex));
@@ -1725,9 +1710,9 @@ void ctgFreeAllInstance(void) {
taosHashClear(gCtgMgmt.pCluster);
}
-int32_t ctgVgInfoIdComp(void const* lp, void const* rp) {
- int32_t* key = (int32_t*)lp;
- SVgroupInfo* pVg = (SVgroupInfo*)rp;
+int32_t ctgVgInfoIdComp(void const *lp, void const *rp) {
+ int32_t *key = (int32_t *)lp;
+ SVgroupInfo *pVg = (SVgroupInfo *)rp;
if (*key < pVg->vgId) {
return -1;
@@ -1738,7 +1723,6 @@ int32_t ctgVgInfoIdComp(void const* lp, void const* rp) {
return 0;
}
-
int32_t ctgOpUpdateVgroup(SCtgCacheOperation *operation) {
int32_t code = 0;
SCtgUpdateVgMsg *msg = operation->data;
@@ -1805,10 +1789,10 @@ int32_t ctgOpUpdateVgroup(SCtgCacheOperation *operation) {
dbCache = NULL;
- //if (!IS_SYS_DBNAME(dbFName)) {
- tstrncpy(vgVersion.dbFName, dbFName, sizeof(vgVersion.dbFName));
- CTG_ERR_JRET(ctgMetaRentUpdate(&msg->pCtg->dbRent, &vgVersion, vgVersion.dbId, sizeof(SDbVgVersion),
- ctgDbVgVersionSortCompare, ctgDbVgVersionSearchCompare));
+ // if (!IS_SYS_DBNAME(dbFName)) {
+ tstrncpy(vgVersion.dbFName, dbFName, sizeof(vgVersion.dbFName));
+ CTG_ERR_JRET(ctgMetaRentUpdate(&msg->pCtg->dbRent, &vgVersion, vgVersion.dbId, sizeof(SDbVgVersion),
+ ctgDbVgVersionSortCompare, ctgDbVgVersionSearchCompare));
//}
_return:
@@ -2054,11 +2038,7 @@ int32_t ctgOpUpdateUser(SCtgCacheOperation *operation) {
if (NULL == pUser) {
SCtgUserAuth userAuth = {0};
- userAuth.version = msg->userAuth.version;
- userAuth.superUser = msg->userAuth.superAuth;
- userAuth.createdDbs = msg->userAuth.createdDbs;
- userAuth.readDbs = msg->userAuth.readDbs;
- userAuth.writeDbs = msg->userAuth.writeDbs;
+ memcpy(&userAuth.userAuth, &msg->userAuth, sizeof(msg->userAuth));
if (taosHashPut(pCtg->userCache, msg->userAuth.user, strlen(msg->userAuth.user), &userAuth, sizeof(userAuth))) {
ctgError("taosHashPut user %s to cache failed", msg->userAuth.user);
@@ -2072,22 +2052,32 @@ int32_t ctgOpUpdateUser(SCtgCacheOperation *operation) {
return TSDB_CODE_SUCCESS;
}
- pUser->version = msg->userAuth.version;
-
CTG_LOCK(CTG_WRITE, &pUser->lock);
- taosHashCleanup(pUser->createdDbs);
- pUser->createdDbs = msg->userAuth.createdDbs;
+ taosHashCleanup(pUser->userAuth.createdDbs);
+ pUser->userAuth.createdDbs = msg->userAuth.createdDbs;
msg->userAuth.createdDbs = NULL;
- taosHashCleanup(pUser->readDbs);
- pUser->readDbs = msg->userAuth.readDbs;
+ taosHashCleanup(pUser->userAuth.readDbs);
+ pUser->userAuth.readDbs = msg->userAuth.readDbs;
msg->userAuth.readDbs = NULL;
- taosHashCleanup(pUser->writeDbs);
- pUser->writeDbs = msg->userAuth.writeDbs;
+ taosHashCleanup(pUser->userAuth.writeDbs);
+ pUser->userAuth.writeDbs = msg->userAuth.writeDbs;
msg->userAuth.writeDbs = NULL;
+ taosHashCleanup(pUser->userAuth.readTbs);
+ pUser->userAuth.readTbs = msg->userAuth.readTbs;
+ msg->userAuth.readTbs = NULL;
+
+ taosHashCleanup(pUser->userAuth.writeTbs);
+ pUser->userAuth.writeTbs = msg->userAuth.writeTbs;
+ msg->userAuth.writeTbs = NULL;
+
+ taosHashCleanup(pUser->userAuth.useDbs);
+ pUser->userAuth.useDbs = msg->userAuth.useDbs;
+ msg->userAuth.useDbs = NULL;
+
CTG_UNLOCK(CTG_WRITE, &pUser->lock);
_return:
@@ -2095,6 +2085,9 @@ _return:
taosHashCleanup(msg->userAuth.createdDbs);
taosHashCleanup(msg->userAuth.readDbs);
taosHashCleanup(msg->userAuth.writeDbs);
+ taosHashCleanup(msg->userAuth.readTbs);
+ taosHashCleanup(msg->userAuth.writeTbs);
+ taosHashCleanup(msg->userAuth.useDbs);
taosMemoryFreeClear(msg);
@@ -2287,6 +2280,9 @@ void ctgFreeCacheOperationData(SCtgCacheOperation *op) {
taosHashCleanup(msg->userAuth.createdDbs);
taosHashCleanup(msg->userAuth.readDbs);
taosHashCleanup(msg->userAuth.writeDbs);
+ taosHashCleanup(msg->userAuth.readTbs);
+ taosHashCleanup(msg->userAuth.writeTbs);
+ taosHashCleanup(msg->userAuth.useDbs);
taosMemoryFreeClear(op->data);
break;
}
@@ -2526,7 +2522,7 @@ int32_t ctgGetTbMetasFromCache(SCatalog *pCtg, SRequestConnInfo *pConn, SCtgTbMe
ctgAddFetch(&ctx->pFetchs, dbIdx, i, fetchIdx, baseResIdx + i, flag);
taosArrayPush(ctx->pResList, &(SMetaRes){0});
CTG_META_NHIT_INC();
-
+
continue;
}
@@ -2544,7 +2540,7 @@ int32_t ctgGetTbMetasFromCache(SCatalog *pCtg, SRequestConnInfo *pConn, SCtgTbMe
STableMeta *tbMeta = pCache->pMeta;
CTG_META_HIT_INC(tbMeta->tableType);
-
+
SCtgTbMetaCtx nctx = {0};
nctx.flag = flag;
nctx.tbInfo.inCache = true;
@@ -2626,7 +2622,7 @@ int32_t ctgGetTbMetasFromCache(SCatalog *pCtg, SRequestConnInfo *pConn, SCtgTbMe
ctgAddFetch(&ctx->pFetchs, dbIdx, i, fetchIdx, baseResIdx + i, flag);
taosArrayPush(ctx->pResList, &(SMetaRes){0});
taosMemoryFreeClear(pTableMeta);
-
+
CTG_META_NHIT_INC();
continue;
}
diff --git a/source/libs/catalog/src/ctgUtil.c b/source/libs/catalog/src/ctgUtil.c
index fd6ee6c1b9..b2b2b5a87e 100644
--- a/source/libs/catalog/src/ctgUtil.c
+++ b/source/libs/catalog/src/ctgUtil.c
@@ -174,9 +174,12 @@ void ctgFreeSMetaData(SMetaData* pData) {
}
void ctgFreeSCtgUserAuth(SCtgUserAuth* userCache) {
- taosHashCleanup(userCache->createdDbs);
- taosHashCleanup(userCache->readDbs);
- taosHashCleanup(userCache->writeDbs);
+ taosHashCleanup(userCache->userAuth.createdDbs);
+ taosHashCleanup(userCache->userAuth.readDbs);
+ taosHashCleanup(userCache->userAuth.writeDbs);
+ taosHashCleanup(userCache->userAuth.readTbs);
+ taosHashCleanup(userCache->userAuth.writeTbs);
+ taosHashCleanup(userCache->userAuth.useDbs);
}
void ctgFreeMetaRent(SCtgRentMgmt* mgmt) {
@@ -419,6 +422,9 @@ void ctgFreeMsgCtx(SCtgMsgCtx* pCtx) {
taosHashCleanup(pOut->createdDbs);
taosHashCleanup(pOut->readDbs);
taosHashCleanup(pOut->writeDbs);
+ taosHashCleanup(pOut->readTbs);
+ taosHashCleanup(pOut->writeTbs);
+ taosHashCleanup(pOut->useDbs);
taosMemoryFreeClear(pCtx->out);
break;
}
@@ -1325,6 +1331,143 @@ static void* ctgCloneDnodeList(void* pSrc) { return taosArrayDup((const SArray*)
static void ctgFreeDnodeList(void* p) { taosArrayDestroy((SArray*)((SMetaRes*)p)->pRes); }
+int32_t ctgChkSetTbAuthRes(SCatalog* pCtg, SCtgAuthReq* req, SCtgAuthRsp* res) {
+ int32_t code = 0;
+ STableMeta* pMeta = NULL;
+ SGetUserAuthRsp* pInfo = &req->authInfo;
+ SHashObj* pTbs = (AUTH_TYPE_READ == req->singleType) ? pInfo->readTbs : pInfo->writeTbs;
+
+ char tbFullName[TSDB_TABLE_FNAME_LEN];
+ tNameExtractFullName(&req->pRawReq->tbName, tbFullName);
+ char* pCond = taosHashGet(pTbs, tbFullName, strlen(tbFullName));
+ if (pCond) {
+ if (strlen(pCond) > 1) {
+ CTG_ERR_RET(nodesStringToNode(pCond, &res->pRawRes->pCond));
+ }
+
+ res->pRawRes->pass = true;
+ return TSDB_CODE_SUCCESS;
+ }
+
+ res->pRawRes->pass = false;
+
+ // CTG_ERR_RET(catalogGetCachedTableMeta(pCtg, &req->pRawReq->tbName, &pMeta));
+ // if (NULL == pMeta) {
+ // if (req->onlyCache) {
+ // res->metaNotExists = true;
+ // ctgDebug("db %s tb %s meta not in cache for auth", req->pRawReq->tbName.dbname, req->pRawReq->tbName.tname);
+ // return TSDB_CODE_SUCCESS;
+ // }
+
+ // CTG_ERR_RET(catalogGetTableMeta(pCtg, req->pConn, &req->pRawReq->tbName, &pMeta));
+ // }
+
+ // if (TSDB_SUPER_TABLE == pMeta->tableType || TSDB_NORMAL_TABLE == pMeta->tableType) {
+ // res->pRawRes->pass = false;
+ // goto _return;
+ // }
+
+ // if (TSDB_CHILD_TABLE == pMeta->tableType) {
+ // res->pRawRes->pass = true;
+
+ // /*
+ // char stbName[TSDB_TABLE_NAME_LEN] = {0};
+ // CTG_ERR_JRET(ctgGetCachedStbNameFromSuid(pCtg, pMeta->suid, stbName));
+ // if (0 == stbName[0]) {
+ // if (req->onlyCache) {
+ // res->notExists = true;
+ // return TSDB_CODE_SUCCESS;
+ // }
+
+ // CTG_ERR_RET(catalogRefreshTableMeta(pCtg, req->pConn, &req->pRawReq->tbName, 0));
+ // }
+ // */
+ // }
+
+_return:
+
+ taosMemoryFree(pMeta);
+
+ CTG_RET(code);
+}
+
+int32_t ctgChkSetAuthRes(SCatalog* pCtg, SCtgAuthReq* req, SCtgAuthRsp* res) {
+ int32_t code = 0;
+ SUserAuthInfo* pReq = req->pRawReq;
+ SUserAuthRes* pRes = res->pRawRes;
+ SGetUserAuthRsp* pInfo = &req->authInfo;
+
+ pRes->pass = false;
+ pRes->pCond = NULL;
+
+ if (!pInfo->enable) {
+ pRes->pass = false;
+ return TSDB_CODE_SUCCESS;
+ }
+
+ if (pInfo->superAuth) {
+ pRes->pass = true;
+ return TSDB_CODE_SUCCESS;
+ }
+
+ char dbFName[TSDB_DB_FNAME_LEN];
+ tNameGetFullDbName(&pReq->tbName, dbFName);
+
+ if (pInfo->createdDbs && taosHashGet(pInfo->createdDbs, dbFName, strlen(dbFName))) {
+ pRes->pass = true;
+ return TSDB_CODE_SUCCESS;
+ }
+
+ switch (pReq->type) {
+ case AUTH_TYPE_READ: {
+ if (pInfo->readTbs && taosHashGetSize(pInfo->readTbs) > 0) {
+ req->singleType = AUTH_TYPE_READ;
+ CTG_ERR_RET(ctgChkSetTbAuthRes(pCtg, req, res));
+ if (pRes->pass) {
+ return TSDB_CODE_SUCCESS;
+ }
+ }
+
+ if (pInfo->readDbs && taosHashGet(pInfo->readDbs, dbFName, strlen(dbFName))) {
+ pRes->pass = true;
+ return TSDB_CODE_SUCCESS;
+ }
+
+ break;
+ }
+ case AUTH_TYPE_WRITE: {
+ if (pInfo->writeTbs && taosHashGetSize(pInfo->writeTbs) > 0) {
+ req->singleType = AUTH_TYPE_WRITE;
+ CTG_ERR_RET(ctgChkSetTbAuthRes(pCtg, req, res));
+ if (pRes->pass) {
+ return TSDB_CODE_SUCCESS;
+ }
+ }
+
+ if (pInfo->writeDbs && taosHashGet(pInfo->writeDbs, dbFName, strlen(dbFName))) {
+ pRes->pass = true;
+ return TSDB_CODE_SUCCESS;
+ }
+
+ break;
+ }
+ case AUTH_TYPE_READ_OR_WRITE: {
+ if ((pInfo->readDbs && taosHashGet(pInfo->readDbs, dbFName, strlen(dbFName))) ||
+ (pInfo->writeDbs && taosHashGet(pInfo->writeDbs, dbFName, strlen(dbFName))) ||
+ (pInfo->useDbs && taosHashGet(pInfo->useDbs, dbFName, strlen(dbFName)))) {
+ pRes->pass = true;
+ return TSDB_CODE_SUCCESS;
+ }
+
+ break;
+ }
+ default:
+ break;
+ }
+
+ return TSDB_CODE_SUCCESS;
+}
+
#if 0
static int32_t ctgCloneMetaDataArray(SArray* pSrc, __array_item_dup_fn_t copyFunc, SArray** pDst) {
if (NULL == pSrc) {
diff --git a/source/libs/catalog/test/CMakeLists.txt b/source/libs/catalog/test/CMakeLists.txt
index dbbb24ce0b..de4d08835c 100644
--- a/source/libs/catalog/test/CMakeLists.txt
+++ b/source/libs/catalog/test/CMakeLists.txt
@@ -9,7 +9,7 @@ IF(NOT TD_DARWIN)
ADD_EXECUTABLE(catalogTest ${SOURCE_LIST})
TARGET_LINK_LIBRARIES(
catalogTest
- PUBLIC os util common catalog transport gtest qcom taos_static
+ PUBLIC os util common nodes catalog transport gtest qcom taos_static
)
TARGET_INCLUDE_DIRECTORIES(
diff --git a/source/libs/catalog/test/catalogTests.cpp b/source/libs/catalog/test/catalogTests.cpp
index fd925a8fe5..2cba433e84 100644
--- a/source/libs/catalog/test/catalogTests.cpp
+++ b/source/libs/catalog/test/catalogTests.cpp
@@ -27,8 +27,8 @@
#ifdef WINDOWS
#define TD_USE_WINSOCK
#endif
-#include "catalogInt.h"
#include "catalog.h"
+#include "catalogInt.h"
#include "os.h"
#include "stub.h"
#include "taos.h"
@@ -48,7 +48,7 @@ void ctgTestSetRspCTableMeta();
void ctgTestSetRspSTableMeta();
void ctgTestSetRspMultiSTableMeta();
-extern int32_t clientConnRefPool;
+extern int32_t clientConnRefPool;
enum {
CTGT_RSP_VGINFO = 1,
@@ -298,7 +298,7 @@ void ctgTestBuildSTableMetaRsp(STableMetaRsp *rspMsg) {
void ctgTestRspDbVgroups(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg *pRsp) {
rpcFreeCont(pMsg->pCont);
-
+
SUseDbRsp usedbRsp = {0};
strcpy(usedbRsp.db, ctgTestDbname);
usedbRsp.vgVersion = ctgTestVgVersion;
@@ -343,7 +343,7 @@ void ctgTestRspDbVgroups(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg *
void ctgTestRspTableMeta(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg *pRsp) {
rpcFreeCont(pMsg->pCont);
-
+
STableMetaRsp metaRsp = {0};
strcpy(metaRsp.dbFName, ctgTestDbname);
strcpy(metaRsp.tbName, ctgTestTablename);
@@ -384,13 +384,13 @@ void ctgTestRspTableMeta(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg *
void ctgTestRspTableMetaNotExist(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg *pRsp) {
rpcFreeCont(pMsg->pCont);
-
+
pRsp->code = CTG_ERR_CODE_TABLE_NOT_EXIST;
}
void ctgTestRspCTableMeta(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg *pRsp) {
rpcFreeCont(pMsg->pCont);
-
+
STableMetaRsp metaRsp = {0};
strcpy(metaRsp.dbFName, ctgTestDbname);
strcpy(metaRsp.tbName, ctgTestCurrentCTableName ? ctgTestCurrentCTableName : ctgTestCTablename);
@@ -438,7 +438,7 @@ void ctgTestRspCTableMeta(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg
void ctgTestRspSTableMeta(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg *pRsp) {
rpcFreeCont(pMsg->pCont);
-
+
STableMetaRsp metaRsp = {0};
strcpy(metaRsp.dbFName, ctgTestDbname);
strcpy(metaRsp.tbName, ctgTestCurrentSTableName ? ctgTestCurrentSTableName : ctgTestSTablename);
@@ -450,7 +450,7 @@ void ctgTestRspSTableMeta(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg
metaRsp.sversion = ctgTestSVersion;
metaRsp.tversion = ctgTestTVersion;
metaRsp.suid = ctgTestSuid;
- metaRsp.tuid = ctgTestSuid+1;
+ metaRsp.tuid = ctgTestSuid + 1;
metaRsp.vgId = 0;
metaRsp.pSchemas = (SSchema *)taosMemoryMalloc((metaRsp.numOfTags + metaRsp.numOfColumns) * sizeof(SSchema));
@@ -486,7 +486,7 @@ void ctgTestRspSTableMeta(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg
void ctgTestRspMultiSTableMeta(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg *pRsp) {
rpcFreeCont(pMsg->pCont);
-
+
static int32_t idx = 1;
STableMetaRsp metaRsp = {0};
@@ -536,16 +536,14 @@ void ctgTestRspMultiSTableMeta(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRp
tFreeSTableMetaRsp(&metaRsp);
}
-
void ctgTestRspErrIndexInfo(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg *pRsp) {
rpcFreeCont(pMsg->pCont);
-
+
pRsp->code = TSDB_CODE_MND_DB_INDEX_NOT_EXIST;
pRsp->contLen = 0;
pRsp->pCont = NULL;
}
-
void ctgTestRspUserAuth(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg *pRsp) {
rpcFreeCont(pMsg->pCont);
@@ -553,6 +551,7 @@ void ctgTestRspUserAuth(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg *p
strcpy(userRsp.user, ctgTestUsername);
userRsp.version = 1;
userRsp.superAuth = 1;
+ userRsp.enable = 1;
int32_t contLen = tSerializeSGetUserAuthRsp(NULL, 0, &userRsp);
void *pReq = rpcMallocCont(contLen);
@@ -565,7 +564,7 @@ void ctgTestRspUserAuth(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg *p
void ctgTestRspTableCfg(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg *pRsp) {
rpcFreeCont(pMsg->pCont);
-
+
static int32_t idx = 1;
STableCfgRsp tblRsp = {0};
@@ -600,7 +599,7 @@ void ctgTestRspTableCfg(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg *p
void ctgTestRspTableIndex(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg *pRsp) {
rpcFreeCont(pMsg->pCont);
-
+
static int32_t idx = 1;
STableIndexRsp tblRsp = {0};
@@ -611,10 +610,10 @@ void ctgTestRspTableIndex(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg
STableIndexInfo info = {0};
for (int32_t i = 0; i < ctgTestIndexNum; ++i) {
info.interval = 1 + i;
- info.expr = (char*)taosMemoryCalloc(1, 10);
+ info.expr = (char *)taosMemoryCalloc(1, 10);
taosArrayPush(tblRsp.pIndex, &info);
}
-
+
int32_t contLen = tSerializeSTableIndexRsp(NULL, 0, &tblRsp);
void *pReq = rpcMallocCont(contLen);
tSerializeSTableIndexRsp(pReq, contLen, &tblRsp);
@@ -628,12 +627,12 @@ void ctgTestRspTableIndex(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg
void ctgTestRspDBCfg(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg *pRsp) {
rpcFreeCont(pMsg->pCont);
-
+
static int32_t idx = 1;
SDbCfgRsp dbRsp = {0};
dbRsp.numOfVgroups = ctgTestVgNum;
-
+
int32_t contLen = tSerializeSDbCfgRsp(NULL, 0, &dbRsp);
void *pReq = rpcMallocCont(contLen);
tSerializeSDbCfgRsp(pReq, contLen, &dbRsp);
@@ -651,7 +650,7 @@ void ctgTestRspQnodeList(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg *
for (int32_t i = 0; i < ctgTestQnodeNum; ++i) {
SQueryNodeLoad nodeLoad = {0};
nodeLoad.addr.nodeId = i;
-
+
(void)taosArrayPush(qlistRsp.qnodeList, &nodeLoad);
}
@@ -676,7 +675,7 @@ void ctgTestRspUdfInfo(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg *pR
SFuncInfo funcInfo = {0};
strcpy(funcInfo.name, "func1");
funcInfo.funcType = ctgTestFuncType;
-
+
(void)taosArrayPush(funcRsp.pFuncInfos, &funcInfo);
SFuncExtraInfo extraInfo = {0};
extraInfo.funcVersion = 0;
@@ -699,7 +698,7 @@ void ctgTestRspSvrVer(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg *pRs
SServerVerRsp verRsp = {0};
strcpy(verRsp.ver, "1.0");
-
+
int32_t rspLen = tSerializeSServerVerRsp(NULL, 0, &verRsp);
void *pReq = rpcMallocCont(rspLen);
tSerializeSServerVerRsp(pReq, rspLen, &verRsp);
@@ -718,9 +717,9 @@ void ctgTestRspDndeList(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg *p
epSet.numOfEps = 1;
tstrncpy(epSet.eps[0].fqdn, "localhost", TSDB_FQDN_LEN);
epSet.eps[0].port = 6030;
-
+
(void)taosArrayPush(dRsp.dnodeList, &epSet);
-
+
int32_t rspLen = tSerializeSDnodeListRsp(NULL, 0, &dRsp);
void *pReq = rpcMallocCont(rspLen);
tSerializeSDnodeListRsp(pReq, rspLen, &dRsp);
@@ -732,8 +731,6 @@ void ctgTestRspDndeList(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg *p
tFreeSDnodeListRsp(&dRsp);
}
-
-
void ctgTestRspAuto(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg *pRsp) {
switch (pMsg->msgType) {
case TDMT_MND_USE_DB:
@@ -750,7 +747,7 @@ void ctgTestRspAuto(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg *pRsp)
ctgTestRspDBCfg(shandle, pEpSet, pMsg, pRsp);
break;
case TDMT_MND_QNODE_LIST:
- ctgTestRspQnodeList(shandle, pEpSet, pMsg, pRsp);
+ ctgTestRspQnodeList(shandle, pEpSet, pMsg, pRsp);
break;
case TDMT_MND_RETRIEVE_FUNC:
ctgTestRspUdfInfo(shandle, pEpSet, pMsg, pRsp);
@@ -768,7 +765,6 @@ void ctgTestRspAuto(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg *pRsp)
return;
}
-
void ctgTestRspByIdx(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg *pRsp) {
switch (ctgTestRspFunc[ctgTestRspIdx]) {
case CTGT_RSP_VGINFO:
@@ -1063,7 +1059,7 @@ void ctgTestSetRspDbVgroupsAndMultiSuperMeta() {
void *ctgTestGetDbVgroupThread(void *param) {
struct SCatalog *pCtg = (struct SCatalog *)param;
int32_t code = 0;
- SRequestConnInfo connInfo = {0};
+ SRequestConnInfo connInfo = {0};
SRequestConnInfo *mockPointer = (SRequestConnInfo *)&connInfo;
SArray *vgList = NULL;
int32_t n = 0;
@@ -1209,7 +1205,6 @@ void *ctgTestSetCtableMetaThread(void *param) {
return NULL;
}
-
void ctgTestFetchRows(TAOS_RES *result, int32_t *rows) {
TAOS_ROW row;
int num_fields = taos_num_fields(result);
@@ -1225,23 +1220,22 @@ void ctgTestFetchRows(TAOS_RES *result, int32_t *rows) {
}
}
-void ctgTestExecQuery(TAOS * taos, char* sql, bool fetch, int32_t *rows) {
+void ctgTestExecQuery(TAOS *taos, char *sql, bool fetch, int32_t *rows) {
TAOS_RES *result = taos_query(taos, sql);
- int code = taos_errno(result);
+ 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};
- SRequestConnInfo connInfo = {0};
+ SRequestConnInfo connInfo = {0};
SRequestConnInfo *mockPointer = (SRequestConnInfo *)&connInfo;
ctgTestInitLogFile();
@@ -1377,7 +1371,7 @@ TEST(tableMeta, normalTable) {
TEST(tableMeta, childTableCase) {
struct SCatalog *pCtg = NULL;
- SRequestConnInfo connInfo = {0};
+ SRequestConnInfo connInfo = {0};
SRequestConnInfo *mockPointer = (SRequestConnInfo *)&connInfo;
SVgroupInfo vgInfo = {0};
@@ -1489,7 +1483,7 @@ TEST(tableMeta, childTableCase) {
TEST(tableMeta, superTableCase) {
struct SCatalog *pCtg = NULL;
- SRequestConnInfo connInfo = {0};
+ SRequestConnInfo connInfo = {0};
SRequestConnInfo *mockPointer = (SRequestConnInfo *)&connInfo;
SVgroupInfo vgInfo = {0};
@@ -1631,7 +1625,7 @@ TEST(tableMeta, superTableCase) {
TEST(tableMeta, rmStbMeta) {
struct SCatalog *pCtg = NULL;
- SRequestConnInfo connInfo = {0};
+ SRequestConnInfo connInfo = {0};
SRequestConnInfo *mockPointer = (SRequestConnInfo *)&connInfo;
SVgroupInfo vgInfo = {0};
@@ -1701,7 +1695,7 @@ TEST(tableMeta, rmStbMeta) {
TEST(tableMeta, updateStbMeta) {
struct SCatalog *pCtg = NULL;
- SRequestConnInfo connInfo = {0};
+ SRequestConnInfo connInfo = {0};
SRequestConnInfo *mockPointer = (SRequestConnInfo *)&connInfo;
SVgroupInfo vgInfo = {0};
@@ -1790,7 +1784,7 @@ TEST(tableMeta, updateStbMeta) {
TEST(getIndexInfo, notExists) {
struct SCatalog *pCtg = NULL;
- SRequestConnInfo connInfo = {0};
+ SRequestConnInfo connInfo = {0};
SRequestConnInfo *mockPointer = (SRequestConnInfo *)&connInfo;
SVgroupInfo vgInfo = {0};
SArray *vgList = NULL;
@@ -1814,13 +1808,13 @@ TEST(getIndexInfo, notExists) {
SIndexInfo info;
code = catalogGetIndexMeta(pCtg, mockPointer, "index1", &info);
ASSERT_TRUE(code != 0);
-
+
catalogDestroy();
}
TEST(refreshGetMeta, normal2normal) {
struct SCatalog *pCtg = NULL;
- SRequestConnInfo connInfo = {0};
+ SRequestConnInfo connInfo = {0};
SRequestConnInfo *mockPointer = (SRequestConnInfo *)&connInfo;
SVgroupInfo vgInfo = {0};
SArray *vgList = NULL;
@@ -1899,7 +1893,7 @@ TEST(refreshGetMeta, normal2normal) {
TEST(refreshGetMeta, normal2notexist) {
struct SCatalog *pCtg = NULL;
- SRequestConnInfo connInfo = {0};
+ SRequestConnInfo connInfo = {0};
SRequestConnInfo *mockPointer = (SRequestConnInfo *)&connInfo;
SVgroupInfo vgInfo = {0};
SArray *vgList = NULL;
@@ -1969,7 +1963,7 @@ TEST(refreshGetMeta, normal2notexist) {
TEST(refreshGetMeta, normal2child) {
struct SCatalog *pCtg = NULL;
- SRequestConnInfo connInfo = {0};
+ SRequestConnInfo connInfo = {0};
SRequestConnInfo *mockPointer = (SRequestConnInfo *)&connInfo;
SVgroupInfo vgInfo = {0};
SArray *vgList = NULL;
@@ -2050,10 +2044,9 @@ TEST(refreshGetMeta, normal2child) {
ctgTestCurrentSTableName = NULL;
}
-
TEST(refreshGetMeta, stable2child) {
struct SCatalog *pCtg = NULL;
- SRequestConnInfo connInfo = {0};
+ SRequestConnInfo connInfo = {0};
SRequestConnInfo *mockPointer = (SRequestConnInfo *)&connInfo;
SVgroupInfo vgInfo = {0};
SArray *vgList = NULL;
@@ -2139,7 +2132,7 @@ TEST(refreshGetMeta, stable2child) {
TEST(refreshGetMeta, stable2stable) {
struct SCatalog *pCtg = NULL;
- SRequestConnInfo connInfo = {0};
+ SRequestConnInfo connInfo = {0};
SRequestConnInfo *mockPointer = (SRequestConnInfo *)&connInfo;
SVgroupInfo vgInfo = {0};
SArray *vgList = NULL;
@@ -2225,7 +2218,7 @@ TEST(refreshGetMeta, stable2stable) {
TEST(refreshGetMeta, child2stable) {
struct SCatalog *pCtg = NULL;
- SRequestConnInfo connInfo = {0};
+ SRequestConnInfo connInfo = {0};
SRequestConnInfo *mockPointer = (SRequestConnInfo *)&connInfo;
SVgroupInfo vgInfo = {0};
SArray *vgList = NULL;
@@ -2311,7 +2304,7 @@ TEST(refreshGetMeta, child2stable) {
TEST(tableDistVgroup, normalTable) {
struct SCatalog *pCtg = NULL;
- SRequestConnInfo connInfo = {0};
+ SRequestConnInfo connInfo = {0};
SRequestConnInfo *mockPointer = (SRequestConnInfo *)&connInfo;
SVgroupInfo *vgInfo = NULL;
SArray *vgList = NULL;
@@ -2348,7 +2341,7 @@ TEST(tableDistVgroup, normalTable) {
TEST(tableDistVgroup, childTableCase) {
struct SCatalog *pCtg = NULL;
- SRequestConnInfo connInfo = {0};
+ SRequestConnInfo connInfo = {0};
SRequestConnInfo *mockPointer = (SRequestConnInfo *)&connInfo;
SVgroupInfo *vgInfo = NULL;
SArray *vgList = NULL;
@@ -2386,7 +2379,7 @@ TEST(tableDistVgroup, childTableCase) {
TEST(tableDistVgroup, superTableCase) {
struct SCatalog *pCtg = NULL;
- SRequestConnInfo connInfo = {0};
+ SRequestConnInfo connInfo = {0};
SRequestConnInfo *mockPointer = (SRequestConnInfo *)&connInfo;
SVgroupInfo *vgInfo = NULL;
SArray *vgList = NULL;
@@ -2435,7 +2428,7 @@ TEST(tableDistVgroup, superTableCase) {
TEST(dbVgroup, getSetDbVgroupCase) {
struct SCatalog *pCtg = NULL;
- SRequestConnInfo connInfo = {0};
+ SRequestConnInfo connInfo = {0};
SRequestConnInfo *mockPointer = (SRequestConnInfo *)&connInfo;
SVgroupInfo vgInfo = {0};
SVgroupInfo *pvgInfo = NULL;
@@ -2525,7 +2518,7 @@ TEST(dbVgroup, getSetDbVgroupCase) {
TEST(multiThread, getSetRmSameDbVgroup) {
struct SCatalog *pCtg = NULL;
- SRequestConnInfo connInfo = {0};
+ SRequestConnInfo connInfo = {0};
SRequestConnInfo *mockPointer = (SRequestConnInfo *)&connInfo;
SVgroupInfo vgInfo = {0};
SVgroupInfo *pvgInfo = NULL;
@@ -2577,7 +2570,7 @@ TEST(multiThread, getSetRmSameDbVgroup) {
TEST(multiThread, getSetRmDiffDbVgroup) {
struct SCatalog *pCtg = NULL;
- SRequestConnInfo connInfo = {0};
+ SRequestConnInfo connInfo = {0};
SRequestConnInfo *mockPointer = (SRequestConnInfo *)&connInfo;
SVgroupInfo vgInfo = {0};
SVgroupInfo *pvgInfo = NULL;
@@ -2629,7 +2622,7 @@ TEST(multiThread, getSetRmDiffDbVgroup) {
TEST(multiThread, ctableMeta) {
struct SCatalog *pCtg = NULL;
- SRequestConnInfo connInfo = {0};
+ SRequestConnInfo connInfo = {0};
SRequestConnInfo *mockPointer = (SRequestConnInfo *)&connInfo;
SVgroupInfo vgInfo = {0};
SVgroupInfo *pvgInfo = NULL;
@@ -2680,7 +2673,7 @@ TEST(multiThread, ctableMeta) {
TEST(rentTest, allRent) {
struct SCatalog *pCtg = NULL;
- SRequestConnInfo connInfo = {0};
+ SRequestConnInfo connInfo = {0};
SRequestConnInfo *mockPointer = (SRequestConnInfo *)&connInfo;
SVgroupInfo vgInfo = {0};
SVgroupInfo *pvgInfo = NULL;
@@ -2759,7 +2752,7 @@ TEST(rentTest, allRent) {
TEST(apiTest, catalogRefreshDBVgInfo_test) {
struct SCatalog *pCtg = NULL;
- SRequestConnInfo connInfo = {0};
+ SRequestConnInfo connInfo = {0};
SRequestConnInfo *mockPointer = (SRequestConnInfo *)&connInfo;
ctgTestInitLogFile();
@@ -2786,7 +2779,7 @@ TEST(apiTest, catalogRefreshDBVgInfo_test) {
TEST(apiTest, catalogChkAuth_test) {
struct SCatalog *pCtg = NULL;
- SRequestConnInfo connInfo = {0};
+ SRequestConnInfo connInfo = {0};
SRequestConnInfo *mockPointer = (SRequestConnInfo *)&connInfo;
ctgTestInitLogFile();
@@ -2805,15 +2798,19 @@ TEST(apiTest, catalogChkAuth_test) {
code = catalogGetHandle(ctgTestClusterId, &pCtg);
ASSERT_EQ(code, 0);
- bool pass = false;
+ SUserAuthInfo authInfo = {0};
+ SUserAuthRes authRes = {0};
+ strcpy(authInfo.user, ctgTestUsername);
+ toName(1, ctgTestDbname, ctgTestSTablename, &authInfo.tbName);
+ authInfo.type = AUTH_TYPE_READ;
bool exists = false;
- code = catalogChkAuthFromCache(pCtg, ctgTestUsername, ctgTestDbname, AUTH_TYPE_READ, &pass, &exists);
+ code = catalogChkAuthFromCache(pCtg, &authInfo, &authRes, &exists);
ASSERT_EQ(code, 0);
ASSERT_EQ(exists, false);
-
- code = catalogChkAuth(pCtg, mockPointer, ctgTestUsername, ctgTestDbname, AUTH_TYPE_READ, &pass);
+
+ code = catalogChkAuth(pCtg, mockPointer, &authInfo, &authRes);
ASSERT_EQ(code, 0);
- ASSERT_EQ(pass, true);
+ ASSERT_EQ(authRes.pass, true);
while (true) {
uint64_t n = 0;
@@ -2825,9 +2822,9 @@ TEST(apiTest, catalogChkAuth_test) {
}
}
- code = catalogChkAuthFromCache(pCtg, ctgTestUsername, ctgTestDbname, AUTH_TYPE_READ, &pass, &exists);
+ code = catalogChkAuthFromCache(pCtg, &authInfo, &authRes, &exists);
ASSERT_EQ(code, 0);
- ASSERT_EQ(pass, true);
+ ASSERT_EQ(authRes.pass, true);
ASSERT_EQ(exists, true);
catalogDestroy();
@@ -2835,7 +2832,7 @@ TEST(apiTest, catalogChkAuth_test) {
TEST(apiTest, catalogRefreshGetTableCfg_test) {
struct SCatalog *pCtg = NULL;
- SRequestConnInfo connInfo = {0};
+ SRequestConnInfo connInfo = {0};
SRequestConnInfo *mockPointer = (SRequestConnInfo *)&connInfo;
ctgTestInitLogFile();
@@ -2873,7 +2870,7 @@ TEST(apiTest, catalogRefreshGetTableCfg_test) {
TEST(apiTest, catalogGetTableIndex_test) {
struct SCatalog *pCtg = NULL;
- SRequestConnInfo connInfo = {0};
+ SRequestConnInfo connInfo = {0};
SRequestConnInfo *mockPointer = (SRequestConnInfo *)&connInfo;
ctgTestInitLogFile();
@@ -2909,7 +2906,7 @@ TEST(apiTest, catalogGetTableIndex_test) {
TEST(apiTest, catalogGetDBCfg_test) {
struct SCatalog *pCtg = NULL;
- SRequestConnInfo connInfo = {0};
+ SRequestConnInfo connInfo = {0};
SRequestConnInfo *mockPointer = (SRequestConnInfo *)&connInfo;
ctgTestInitLogFile();
@@ -2942,7 +2939,7 @@ TEST(apiTest, catalogGetDBCfg_test) {
TEST(apiTest, catalogGetQnodeList_test) {
struct SCatalog *pCtg = NULL;
- SRequestConnInfo connInfo = {0};
+ SRequestConnInfo connInfo = {0};
SRequestConnInfo *mockPointer = (SRequestConnInfo *)&connInfo;
ctgTestInitLogFile();
@@ -2967,17 +2964,16 @@ TEST(apiTest, catalogGetQnodeList_test) {
ASSERT_EQ(taosArrayGetSize(qnodeList), ctgTestQnodeNum);
for (int32_t i = 0; i < ctgTestQnodeNum; ++i) {
- SQueryNodeLoad * pLoad = (SQueryNodeLoad *)taosArrayGet(qnodeList, i);
+ SQueryNodeLoad *pLoad = (SQueryNodeLoad *)taosArrayGet(qnodeList, i);
ASSERT_EQ(pLoad->addr.nodeId, i);
}
catalogDestroy();
}
-
TEST(apiTest, catalogGetUdfInfo_test) {
struct SCatalog *pCtg = NULL;
- SRequestConnInfo connInfo = {0};
+ SRequestConnInfo connInfo = {0};
SRequestConnInfo *mockPointer = (SRequestConnInfo *)&connInfo;
ctgTestInitLogFile();
@@ -3004,10 +3000,9 @@ TEST(apiTest, catalogGetUdfInfo_test) {
catalogDestroy();
}
-
TEST(apiTest, catalogGetServerVersion_test) {
struct SCatalog *pCtg = NULL;
- SRequestConnInfo connInfo = {0};
+ SRequestConnInfo connInfo = {0};
SRequestConnInfo *mockPointer = (SRequestConnInfo *)&connInfo;
ctgTestInitLogFile();
@@ -3026,7 +3021,7 @@ TEST(apiTest, catalogGetServerVersion_test) {
code = catalogGetHandle(ctgTestClusterId, &pCtg);
ASSERT_EQ(code, 0);
- char* ver = NULL;
+ char *ver = NULL;
code = catalogGetServerVersion(pCtg, mockPointer, &ver);
ASSERT_EQ(code, 0);
ASSERT_TRUE(0 == strcmp(ver, "1.0"));
@@ -3036,7 +3031,7 @@ TEST(apiTest, catalogGetServerVersion_test) {
TEST(apiTest, catalogUpdateTableIndex_test) {
struct SCatalog *pCtg = NULL;
- SRequestConnInfo connInfo = {0};
+ SRequestConnInfo connInfo = {0};
SRequestConnInfo *mockPointer = (SRequestConnInfo *)&connInfo;
ctgTestInitLogFile();
@@ -3066,10 +3061,9 @@ TEST(apiTest, catalogUpdateTableIndex_test) {
catalogDestroy();
}
-
TEST(apiTest, catalogGetDnodeList_test) {
struct SCatalog *pCtg = NULL;
- SRequestConnInfo connInfo = {0};
+ SRequestConnInfo connInfo = {0};
SRequestConnInfo *mockPointer = (SRequestConnInfo *)&connInfo;
ctgTestInitLogFile();
@@ -3088,7 +3082,7 @@ TEST(apiTest, catalogGetDnodeList_test) {
code = catalogGetHandle(ctgTestClusterId, &pCtg);
ASSERT_EQ(code, 0);
- SArray* pList = NULL;
+ SArray *pList = NULL;
code = catalogGetDnodeList(pCtg, mockPointer, &pList);
ASSERT_EQ(code, 0);
ASSERT_EQ(taosArrayGetSize(pList), 1);
@@ -3100,23 +3094,23 @@ TEST(apiTest, catalogGetDnodeList_test) {
#ifdef INTEGRATION_TEST
TEST(intTest, autoCreateTableTest) {
- struct SCatalog *pCtg = NULL;
+ struct SCatalog *pCtg = NULL;
- TAOS *taos = taos_connect("localhost", "root", "taosdata", NULL, 0);
- ASSERT_TRUE(NULL != taos);
+ 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) {
@@ -3142,15 +3136,14 @@ TEST(intTest, autoCreateTableTest) {
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);
return RUN_ALL_TESTS();
diff --git a/source/libs/executor/inc/dataSinkInt.h b/source/libs/executor/inc/dataSinkInt.h
index 220e9c0b6c..57a771b275 100644
--- a/source/libs/executor/inc/dataSinkInt.h
+++ b/source/libs/executor/inc/dataSinkInt.h
@@ -29,7 +29,6 @@ struct SDataSinkHandle;
typedef struct SDataSinkManager {
SDataSinkMgtCfg cfg;
- TdThreadMutex mutex;
} SDataSinkManager;
typedef int32_t (*FPutDataBlock)(struct SDataSinkHandle* pHandle, const SInputData* pInput, bool* pContinue);
diff --git a/source/libs/executor/inc/executorimpl.h b/source/libs/executor/inc/executorimpl.h
index f503f9370b..f2b62b1174 100644
--- a/source/libs/executor/inc/executorimpl.h
+++ b/source/libs/executor/inc/executorimpl.h
@@ -127,14 +127,9 @@ enum {
};
typedef struct {
- // TODO remove prepareStatus
- STqOffsetVal prepareStatus; // for tmq
- STqOffsetVal lastStatus; // for tmq
- SMqMetaRsp metaRsp; // for tmq fetching meta
- int8_t returned;
- int64_t snapshotVer;
- // const SSubmitReq* pReq;
-
+ STqOffsetVal currentOffset; // for tmq
+ SMqMetaRsp metaRsp; // for tmq fetching meta
+ int64_t snapshotVer;
SPackedData submit;
SSchemaWrapper* schema;
char tbName[TSDB_TABLE_NAME_LEN];
@@ -193,7 +188,6 @@ enum {
OP_OPENED = 0x1,
OP_RES_TO_RETURN = 0x5,
OP_EXEC_DONE = 0x9,
- OP_EXEC_RECV = 0x11,
};
typedef struct SOperatorFpSet {
@@ -507,32 +501,12 @@ typedef struct STableCountScanSupp {
char stbNameFilter[TSDB_TABLE_NAME_LEN];
} STableCountScanSupp;
-typedef struct STableCountScanOperatorInfo {
- SReadHandle readHandle;
- SSDataBlock* pRes;
-
- STableCountScanSupp supp;
-
- int32_t currGrpIdx;
- SArray* stbUidList; // when group by db_name and/or stable_name
-} STableCountScanOperatorInfo;
-
typedef struct SOptrBasicInfo {
SResultRowInfo resultRowInfo;
SSDataBlock* pRes;
bool mergeResultBlock;
} SOptrBasicInfo;
-typedef struct SAggOperatorInfo {
- SOptrBasicInfo binfo;
- SAggSupporter aggSup;
- STableQueryInfo* current;
- uint64_t groupId;
- SGroupResInfo groupResInfo;
- SExprSupp scalarExprSup;
- bool groupKeyOptimized;
-} SAggOperatorInfo;
-
typedef struct SIntervalAggOperatorInfo {
SOptrBasicInfo binfo; // basic info
SAggSupporter aggSup; // aggregate supporter
@@ -859,8 +833,7 @@ SArray* getTableListInfo(const SExecTaskInfo* pTaskInfo);
int32_t createExecTaskInfo(SSubplan* pPlan, SExecTaskInfo** pTaskInfo, SReadHandle* pHandle, uint64_t taskId,
int32_t vgId, char* sql, EOPTR_EXEC_MODEL model);
-int32_t createDataSinkParam(SDataSinkNode* pNode, void** pParam, STableListInfo* pTableListInfo,
- SReadHandle* readHandle);
+int32_t createDataSinkParam(SDataSinkNode* pNode, void** pParam, SExecTaskInfo* pTask, SReadHandle* readHandle);
int32_t getOperatorExplainExecInfo(SOperatorInfo* operatorInfo, SArray* pExecInfoList);
STimeWindow getActiveTimeWindow(SDiskbasedBuf* pBuf, SResultRowInfo* pResultRowInfo, int64_t ts, SInterval* pInterval,
diff --git a/source/libs/executor/src/aggregateoperator.c b/source/libs/executor/src/aggregateoperator.c
index a26e3ace7b..ec8060348d 100644
--- a/source/libs/executor/src/aggregateoperator.c
+++ b/source/libs/executor/src/aggregateoperator.c
@@ -40,6 +40,16 @@ typedef struct {
int32_t startOffset;
} SFunctionCtxStatus;
+typedef struct SAggOperatorInfo {
+ SOptrBasicInfo binfo;
+ SAggSupporter aggSup;
+ STableQueryInfo* current;
+ uint64_t groupId;
+ SGroupResInfo groupResInfo;
+ SExprSupp scalarExprSup;
+ bool groupKeyOptimized;
+} SAggOperatorInfo;
+
static void destroyAggOperatorInfo(void* param);
static void setExecutionContext(SOperatorInfo* pOperator, int32_t numOfOutput, uint64_t groupId);
@@ -162,9 +172,9 @@ int32_t doOpenAggregateOptr(SOperatorInfo* pOperator) {
int32_t scanFlag = MAIN_SCAN;
bool hasValidBlock = false;
- bool blockAllocated = false;
while (1) {
+ bool blockAllocated = false;
SSDataBlock* pBlock = downstream->fpSet.getNextFn(downstream);
if (pBlock == NULL) {
if (!hasValidBlock) {
@@ -560,4 +570,4 @@ void functionCtxRestore(SqlFunctionCtx* pCtx, SFunctionCtxStatus* pStatus) {
pCtx->input.colDataSMAIsSet = pStatus->hasAgg;
pCtx->input.numOfRows = pStatus->numOfRows;
pCtx->input.startRowIndex = pStatus->startOffset;
-}
\ No newline at end of file
+}
diff --git a/source/libs/executor/src/dataSinkMgt.c b/source/libs/executor/src/dataSinkMgt.c
index 7fbde07f59..b3cb57325b 100644
--- a/source/libs/executor/src/dataSinkMgt.c
+++ b/source/libs/executor/src/dataSinkMgt.c
@@ -23,7 +23,6 @@ SDataSinkStat gDataSinkStat = {0};
int32_t dsDataSinkMgtInit(SDataSinkMgtCfg* cfg) {
gDataSinkManager.cfg = *cfg;
- taosThreadMutexInit(&gDataSinkManager.mutex, NULL);
return 0; // to avoid compiler eror
}
diff --git a/source/libs/executor/src/executor.c b/source/libs/executor/src/executor.c
index feff35e67f..255949a588 100644
--- a/source/libs/executor/src/executor.c
+++ b/source/libs/executor/src/executor.c
@@ -127,12 +127,10 @@ static int32_t doSetStreamBlock(SOperatorInfo* pOperator, void* input, size_t nu
pOperator->status = OP_NOT_OPENED;
SStreamScanInfo* pInfo = pOperator->info;
- qDebug("stream set total blocks:%d, task id:%s" PRIx64, (int32_t)numOfBlocks, id);
- ASSERT(pInfo->validBlockIndex == 0);
- ASSERT(taosArrayGetSize(pInfo->pBlockLists) == 0);
+ qDebug("s-task set source blocks:%d %s", (int32_t)numOfBlocks, id);
+ ASSERT(pInfo->validBlockIndex == 0 && taosArrayGetSize(pInfo->pBlockLists) == 0);
if (type == STREAM_INPUT__MERGED_SUBMIT) {
- // ASSERT(numOfBlocks > 1);
for (int32_t i = 0; i < numOfBlocks; i++) {
SPackedData* pReq = POINTER_SHIFT(input, i * sizeof(SPackedData));
taosArrayPush(pInfo->pBlockLists, pReq);
@@ -206,6 +204,7 @@ void qGetCheckpointVersion(qTaskInfo_t tinfo, int64_t* dataVer, int64_t* ckId) {
*ckId = pTaskInfo->streamInfo.checkPointId;
}
+
int32_t qSetMultiStreamInput(qTaskInfo_t tinfo, const void* pBlocks, size_t numOfBlocks, int32_t type) {
if (tinfo == NULL) {
return TSDB_CODE_APP_ERROR;
@@ -371,27 +370,28 @@ static SArray* filterUnqualifiedTables(const SStreamScanInfo* pScanInfo, const S
return qa;
}
-int32_t qUpdateQualifiedTableId(qTaskInfo_t tinfo, const SArray* tableIdList, bool isAdd) {
+int32_t qUpdateTableListForStreamScanner(qTaskInfo_t tinfo, const SArray* tableIdList, bool isAdd, SArray* pList) {
SExecTaskInfo* pTaskInfo = (SExecTaskInfo*)tinfo;
+ const char* id = GET_TASKID(pTaskInfo);
+ int32_t code = 0;
if (isAdd) {
- qDebug("add %d tables id into query list, %s", (int32_t)taosArrayGetSize(tableIdList), pTaskInfo->id.str);
+ qDebug("add %d tables id into query list, %s", (int32_t)taosArrayGetSize(tableIdList), id);
}
// traverse to the stream scanner node to add this table id
- SOperatorInfo* pInfo = pTaskInfo->pRoot;
- while (pInfo->operatorType != QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN) {
- pInfo = pInfo->pDownstream[0];
- }
-
- int32_t code = 0;
+ SOperatorInfo* pInfo = extractOperatorInTree(pTaskInfo->pRoot, QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN, id);
SStreamScanInfo* pScanInfo = pInfo->info;
+
if (isAdd) { // add new table id
SArray* qa = filterUnqualifiedTables(pScanInfo, tableIdList, GET_TASKID(pTaskInfo));
int32_t numOfQualifiedTables = taosArrayGetSize(qa);
- qDebug(" %d qualified child tables added into stream scanner", numOfQualifiedTables);
+ if (pList != NULL) {
+ taosArrayAddAll(pList, qa);
+ }
+ qDebug("%d qualified child tables added into stream scanner, %s", numOfQualifiedTables, id);
code = tqReaderAddTbUidList(pScanInfo->tqReader, qa);
if (code != TSDB_CODE_SUCCESS) {
taosArrayDestroy(qa);
@@ -432,19 +432,6 @@ int32_t qUpdateQualifiedTableId(qTaskInfo_t tinfo, const SArray* tableIdList, bo
}
}
-#if 0
- bool exists = false;
- for (int32_t k = 0; k < taosArrayGetSize(pListInfo->pTableList); ++k) {
- STableKeyInfo* pKeyInfo = taosArrayGet(pListInfo->pTableList, k);
- if (pKeyInfo->uid == keyInfo.uid) {
- qWarn("ignore duplicated query table uid:%" PRIu64 " added, %s", pKeyInfo->uid, pTaskInfo->id.str);
- exists = true;
- }
- }
-
- if (!exists) {
-#endif
-
tableListAddTableInfo(pTableListInfo, keyInfo.uid, keyInfo.groupId);
}
@@ -455,7 +442,7 @@ int32_t qUpdateQualifiedTableId(qTaskInfo_t tinfo, const SArray* tableIdList, bo
taosArrayDestroy(qa);
} else { // remove the table id in current list
- qDebug(" %d remove child tables from the stream scanner", (int32_t)taosArrayGetSize(tableIdList));
+ qDebug("%d remove child tables from the stream scanner, %s", (int32_t)taosArrayGetSize(tableIdList), id);
taosWLockLatch(&pTaskInfo->lock);
code = tqReaderRemoveTbUidList(pScanInfo->tqReader, tableIdList);
taosWUnLockLatch(&pTaskInfo->lock);
@@ -511,12 +498,7 @@ int32_t qCreateExecTask(SReadHandle* readHandle, int32_t vgId, uint64_t taskId,
if (handle) {
void* pSinkParam = NULL;
-
- SArray* pInfoList = getTableListInfo(*pTask);
- STableListInfo* pTableListInfo = taosArrayGetP(pInfoList, 0);
- taosArrayDestroy(pInfoList);
-
- code = createDataSinkParam(pSubplan->pDataSink, &pSinkParam, pTableListInfo, readHandle);
+ code = createDataSinkParam(pSubplan->pDataSink, &pSinkParam, (*pTask), readHandle);
if (code != TSDB_CODE_SUCCESS) {
qError("failed to createDataSinkParam, vgId:%d, code:%s, %s", vgId, tstrerror(code), (*pTask)->id.str);
goto _error;
@@ -1035,15 +1017,9 @@ SMqMetaRsp* qStreamExtractMetaMsg(qTaskInfo_t tinfo) {
return &pTaskInfo->streamInfo.metaRsp;
}
-int64_t qStreamExtractPrepareUid(qTaskInfo_t tinfo) {
+void qStreamExtractOffset(qTaskInfo_t tinfo, STqOffsetVal* pOffset) {
SExecTaskInfo* pTaskInfo = (SExecTaskInfo*)tinfo;
- return pTaskInfo->streamInfo.prepareStatus.uid;
-}
-
-int32_t qStreamExtractOffset(qTaskInfo_t tinfo, STqOffsetVal* pOffset) {
- SExecTaskInfo* pTaskInfo = (SExecTaskInfo*)tinfo;
- memcpy(pOffset, &pTaskInfo->streamInfo.lastStatus, sizeof(STqOffsetVal));
- return 0;
+ memcpy(pOffset, &pTaskInfo->streamInfo.currentOffset, sizeof(STqOffsetVal));
}
int32_t initQueryTableDataCondForTmq(SQueryTableDataCond* pCond, SSnapContext* sContext, SMetaTableInfo* pMtInfo) {
@@ -1081,6 +1057,7 @@ int32_t qStreamSetScanMemData(qTaskInfo_t tinfo, SPackedData submit) {
SExecTaskInfo* pTaskInfo = (SExecTaskInfo*)tinfo;
if ((pTaskInfo->execModel != OPTR_EXEC_MODEL_QUEUE) || (pTaskInfo->streamInfo.submit.msgStr != NULL)) {
qError("qStreamSetScanMemData err:%d,%p", pTaskInfo->execModel, pTaskInfo->streamInfo.submit.msgStr);
+ terrno = TSDB_CODE_PAR_INTERNAL_ERROR;
return -1;
}
qDebug("set the submit block for future scan");
@@ -1089,22 +1066,27 @@ int32_t qStreamSetScanMemData(qTaskInfo_t tinfo, SPackedData submit) {
return 0;
}
+void qStreamSetOpen(qTaskInfo_t tinfo) {
+ SExecTaskInfo* pTaskInfo = (SExecTaskInfo*)tinfo;
+ SOperatorInfo* pOperator = pTaskInfo->pRoot;
+ pOperator->status = OP_NOT_OPENED;
+}
+
int32_t qStreamPrepareScan(qTaskInfo_t tinfo, STqOffsetVal* pOffset, int8_t subType) {
SExecTaskInfo* pTaskInfo = (SExecTaskInfo*)tinfo;
SOperatorInfo* pOperator = pTaskInfo->pRoot;
const char* id = GET_TASKID(pTaskInfo);
- pTaskInfo->streamInfo.prepareStatus = *pOffset;
- pTaskInfo->streamInfo.returned = 0;
-
- if (tOffsetEqual(pOffset, &pTaskInfo->streamInfo.lastStatus)) {
+ // if pOffset equal to current offset, means continue consume
+ if (tOffsetEqual(pOffset, &pTaskInfo->streamInfo.currentOffset)) {
return 0;
}
if (subType == TOPIC_SUB_TYPE__COLUMN) {
- pOperator->status = OP_OPENED;
pOperator = extractOperatorInTree(pOperator, QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN, id);
-
+ if (pOperator == NULL) {
+ return -1;
+ }
SStreamScanInfo* pInfo = pOperator->info;
STableScanInfo* pScanInfo = pInfo->pTableScanOp->info;
STableScanBase* pScanBaseInfo = &pScanInfo->base;
@@ -1115,7 +1097,7 @@ int32_t qStreamPrepareScan(qTaskInfo_t tinfo, STqOffsetVal* pOffset, int8_t subT
pScanBaseInfo->dataReader = NULL;
// let's seek to the next version in wal file
- if (tqSeekVer(pInfo->tqReader, pOffset->version + 1, pTaskInfo->id.str) < 0) {
+ if (tqSeekVer(pInfo->tqReader, pOffset->version + 1, id) < 0) {
qError("tqSeekVer failed ver:%" PRId64 ", %s", pOffset->version + 1, id);
return -1;
}
@@ -1139,10 +1121,13 @@ int32_t qStreamPrepareScan(qTaskInfo_t tinfo, STqOffsetVal* pOffset, int8_t subT
} else {
taosRUnLockLatch(&pTaskInfo->lock);
qError("no table in table list, %s", id);
+ terrno = TSDB_CODE_PAR_INTERNAL_ERROR;
return -1;
}
}
+ qDebug("switch to table uid:%" PRId64 " ts:%" PRId64 "% " PRId64 " rows returned", uid, ts,
+ pInfo->pTableScanOp->resultInfo.totalRows);
pInfo->pTableScanOp->resultInfo.totalRows = 0;
// start from current accessed position
@@ -1156,6 +1141,7 @@ int32_t qStreamPrepareScan(qTaskInfo_t tinfo, STqOffsetVal* pOffset, int8_t subT
} else {
qError("vgId:%d uid:%" PRIu64 " not found in table list, total:%d, index:%d %s", pTaskInfo->id.vgId, uid,
numOfTables, pScanInfo->currentTable, id);
+ terrno = TSDB_CODE_PAR_INTERNAL_ERROR;
return -1;
}
@@ -1188,6 +1174,7 @@ int32_t qStreamPrepareScan(qTaskInfo_t tinfo, STqOffsetVal* pOffset, int8_t subT
pScanBaseInfo->cond.twindows.skey = oldSkey;
} else {
qError("invalid pOffset->type:%d, %s", pOffset->type, id);
+ terrno = TSDB_CODE_PAR_INTERNAL_ERROR;
return -1;
}
@@ -1202,6 +1189,7 @@ int32_t qStreamPrepareScan(qTaskInfo_t tinfo, STqOffsetVal* pOffset, int8_t subT
if (setForSnapShot(sContext, pOffset->uid) != 0) {
qError("setDataForSnapShot error. uid:%" PRId64 " , %s", pOffset->uid, id);
+ terrno = TSDB_CODE_PAR_INTERNAL_ERROR;
return -1;
}
@@ -1213,7 +1201,7 @@ int32_t qStreamPrepareScan(qTaskInfo_t tinfo, STqOffsetVal* pOffset, int8_t subT
tableListClear(pTableListInfo);
if (mtInfo.uid == 0) {
- return 0; // no data
+ goto end; // no data
}
initQueryTableDataCondForTmq(&pTaskInfo->streamInfo.tableCond, sContext, &mtInfo);
@@ -1238,6 +1226,7 @@ int32_t qStreamPrepareScan(qTaskInfo_t tinfo, STqOffsetVal* pOffset, int8_t subT
SSnapContext* sContext = pInfo->sContext;
if (setForSnapShot(sContext, pOffset->uid) != 0) {
qError("setForSnapShot error. uid:%" PRIu64 " ,version:%" PRId64, pOffset->uid, pOffset->version);
+ terrno = TSDB_CODE_PAR_INTERNAL_ERROR;
return -1;
}
qDebug("tmqsnap qStreamPrepareScan snapshot meta uid:%" PRId64 " ts %" PRId64 " %s", pOffset->uid, pOffset->ts,
@@ -1250,6 +1239,9 @@ int32_t qStreamPrepareScan(qTaskInfo_t tinfo, STqOffsetVal* pOffset, int8_t subT
}
}
+end:
+ pTaskInfo->streamInfo.currentOffset = *pOffset;
+
return 0;
}
@@ -1276,3 +1268,22 @@ void qProcessRspMsg(void* parent, SRpcMsg* pMsg, SEpSet* pEpSet) {
rpcFreeCont(pMsg->pCont);
destroySendMsgInfo(pSendInfo);
}
+
+SArray* qGetQueriedTableListInfo(qTaskInfo_t tinfo) {
+ SExecTaskInfo* pTaskInfo = tinfo;
+ SArray* plist = getTableListInfo(pTaskInfo);
+
+ // only extract table in the first elements
+ STableListInfo* pTableListInfo = taosArrayGetP(plist, 0);
+
+ SArray* pUidList = taosArrayInit(10, sizeof(uint64_t));
+
+ int32_t numOfTables = tableListGetSize(pTableListInfo);
+ for(int32_t i = 0; i < numOfTables; ++i) {
+ STableKeyInfo* pKeyInfo = tableListGetInfo(pTableListInfo, i);
+ taosArrayPush(pUidList, &pKeyInfo->uid);
+ }
+
+ taosArrayDestroy(plist);
+ return pUidList;
+}
diff --git a/source/libs/executor/src/executorimpl.c b/source/libs/executor/src/executorimpl.c
index da9516be8a..3dcd147bec 100644
--- a/source/libs/executor/src/executorimpl.c
+++ b/source/libs/executor/src/executorimpl.c
@@ -972,6 +972,7 @@ int32_t getTableScanInfo(SOperatorInfo* pOperator, int32_t* order, int32_t* scan
SOperatorInfo* extractOperatorInTree(SOperatorInfo* pOperator, int32_t type, const char* id) {
if (pOperator == NULL) {
qError("invalid operator, failed to find tableScanOperator %s", id);
+ terrno = TSDB_CODE_PAR_INTERNAL_ERROR;
return NULL;
}
@@ -980,6 +981,7 @@ SOperatorInfo* extractOperatorInTree(SOperatorInfo* pOperator, int32_t type, con
} else {
if (pOperator->pDownstream == NULL || pOperator->pDownstream[0] == NULL) {
qError("invalid operator, failed to find tableScanOperator %s", id);
+ terrno = TSDB_CODE_PAR_INTERNAL_ERROR;
return NULL;
}
@@ -1565,8 +1567,7 @@ int32_t extractTableScanNode(SPhysiNode* pNode, STableScanPhysiNode** ppNode) {
return -1;
}
-int32_t createDataSinkParam(SDataSinkNode* pNode, void** pParam, STableListInfo* pTableListInfo,
- SReadHandle* readHandle) {
+int32_t createDataSinkParam(SDataSinkNode* pNode, void** pParam, SExecTaskInfo* pTask, SReadHandle* readHandle) {
switch (pNode->type) {
case QUERY_NODE_PHYSICAL_PLAN_QUERY_INSERT: {
SInserterParam* pInserterParam = taosMemoryCalloc(1, sizeof(SInserterParam));
@@ -1584,23 +1585,26 @@ int32_t createDataSinkParam(SDataSinkNode* pNode, void** pParam, STableListInfo*
return TSDB_CODE_OUT_OF_MEMORY;
}
- int32_t tbNum = tableListGetSize(pTableListInfo);
+ SArray* pInfoList = getTableListInfo(pTask);
+ STableListInfo* pTableListInfo = taosArrayGetP(pInfoList, 0);
+ taosArrayDestroy(pInfoList);
+
pDeleterParam->suid = tableListGetSuid(pTableListInfo);
// TODO extract uid list
- pDeleterParam->pUidList = taosArrayInit(tbNum, sizeof(uint64_t));
+ int32_t numOfTables = tableListGetSize(pTableListInfo);
+ pDeleterParam->pUidList = taosArrayInit(numOfTables, sizeof(uint64_t));
if (NULL == pDeleterParam->pUidList) {
taosMemoryFree(pDeleterParam);
return TSDB_CODE_OUT_OF_MEMORY;
}
- for (int32_t i = 0; i < tbNum; ++i) {
+ for (int32_t i = 0; i < numOfTables; ++i) {
STableKeyInfo* pTable = tableListGetInfo(pTableListInfo, i);
taosArrayPush(pDeleterParam->pUidList, &pTable->uid);
}
*pParam = pDeleterParam;
-
break;
}
default:
@@ -1965,11 +1969,11 @@ void qStreamCloseTsdbReader(void* task) {
SExecTaskInfo* pTaskInfo = (SExecTaskInfo*)task;
SOperatorInfo* pOp = pTaskInfo->pRoot;
- qDebug("stream close tsdb reader, reset status uid:%" PRId64 " ts:%" PRId64, pTaskInfo->streamInfo.lastStatus.uid,
- pTaskInfo->streamInfo.lastStatus.ts);
+ qDebug("stream close tsdb reader, reset status uid:%" PRId64 " ts:%" PRId64, pTaskInfo->streamInfo.currentOffset.uid,
+ pTaskInfo->streamInfo.currentOffset.ts);
// todo refactor, other thread may already use this read to extract data.
- pTaskInfo->streamInfo.lastStatus = (STqOffsetVal){0};
+ pTaskInfo->streamInfo.currentOffset = (STqOffsetVal){0};
while (pOp->numOfDownstream == 1 && pOp->pDownstream[0]) {
SOperatorInfo* pDownstreamOp = pOp->pDownstream[0];
if (pDownstreamOp->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN) {
@@ -1996,7 +2000,11 @@ void qStreamCloseTsdbReader(void* task) {
}
static void extractTableList(SArray* pList, const SOperatorInfo* pOperator) {
- if (pOperator->operatorType == QUERY_NODE_PHYSICAL_PLAN_TABLE_SCAN) {
+ if (pOperator->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN) {
+ SStreamScanInfo* pScanInfo = pOperator->info;
+ STableScanInfo* pTableScanInfo = pScanInfo->pTableScanOp->info;
+ taosArrayPush(pList, &pTableScanInfo->base.pTableListInfo);
+ } else if (pOperator->operatorType == QUERY_NODE_PHYSICAL_PLAN_TABLE_SCAN) {
STableScanInfo* pScanInfo = pOperator->info;
taosArrayPush(pList, &pScanInfo->base.pTableListInfo);
} else {
diff --git a/source/libs/executor/src/projectoperator.c b/source/libs/executor/src/projectoperator.c
index c943270df9..86c49e0fc8 100644
--- a/source/libs/executor/src/projectoperator.c
+++ b/source/libs/executor/src/projectoperator.c
@@ -227,17 +227,8 @@ SSDataBlock* doProjectOperation(SOperatorInfo* pOperator) {
blockDataCleanup(pFinalRes);
SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo;
- if (pTaskInfo->streamInfo.submit.msgStr) {
- pOperator->status = OP_OPENED;
- }
if (pOperator->status == OP_EXEC_DONE) {
- if (pTaskInfo->execModel == OPTR_EXEC_MODEL_QUEUE) {
- pOperator->status = OP_OPENED;
- qDebug("projection in queue model, set status open and return null");
- return NULL;
- }
-
return NULL;
}
@@ -263,23 +254,14 @@ SSDataBlock* doProjectOperation(SOperatorInfo* pOperator) {
// The downstream exec may change the value of the newgroup, so use a local variable instead.
SSDataBlock* pBlock = downstream->fpSet.getNextFn(downstream);
if (pBlock == NULL) {
- if (pTaskInfo->execModel == OPTR_EXEC_MODEL_QUEUE && pFinalRes->info.rows == 0) {
- pOperator->status = OP_OPENED;
- if (pOperator->status == OP_EXEC_RECV) {
- continue;
- } else {
- return NULL;
- }
- }
- qDebug("set op close, exec %d, status %d rows %" PRId64 , pTaskInfo->execModel, pOperator->status,
- pFinalRes->info.rows);
+ qDebug("set op close, exec %d, status %d rows %" PRId64 , pTaskInfo->execModel, pOperator->status, pFinalRes->info.rows);
setOperatorCompleted(pOperator);
break;
}
- if (pTaskInfo->execModel == OPTR_EXEC_MODEL_QUEUE) {
- qDebug("set status recv");
- pOperator->status = OP_EXEC_RECV;
- }
+// if (pTaskInfo->execModel == OPTR_EXEC_MODEL_QUEUE) {
+// qDebug("set status recv");
+// pOperator->status = OP_EXEC_RECV;
+// }
// for stream interval
if (pBlock->info.type == STREAM_RETRIEVE || pBlock->info.type == STREAM_DELETE_RESULT ||
diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c
index fbc835beea..49623dc619 100644
--- a/source/libs/executor/src/scanoperator.c
+++ b/source/libs/executor/src/scanoperator.c
@@ -36,6 +36,7 @@ int32_t scanDebug = 0;
#define MULTI_READER_MAX_TABLE_NUM 5000
#define SET_REVERSE_SCAN_FLAG(_info) ((_info)->scanFlag = REVERSE_SCAN)
#define SWITCH_ORDER(n) (((n) = ((n) == TSDB_ORDER_ASC) ? TSDB_ORDER_DESC : TSDB_ORDER_ASC))
+#define STREAM_SCAN_OP_NAME "StreamScanOperator"
typedef struct STableMergeScanExecInfo {
SFileBlockLoadRecorder blockRecorder;
@@ -51,6 +52,16 @@ typedef struct STableMergeScanSortSourceParam {
STsdbReader* dataReader;
} STableMergeScanSortSourceParam;
+typedef struct STableCountScanOperatorInfo {
+ SReadHandle readHandle;
+ SSDataBlock* pRes;
+
+ STableCountScanSupp supp;
+
+ int32_t currGrpIdx;
+ SArray* stbUidList; // when group by db_name and/or stable_name
+} STableCountScanOperatorInfo;
+
static bool processBlockWithProbability(const SSampleExecInfo* pInfo);
bool processBlockWithProbability(const SSampleExecInfo* pInfo) {
@@ -320,7 +331,7 @@ static int32_t loadDataBlock(SOperatorInfo* pOperator, STableScanBase* pTableSca
qDebug("%s data block skipped, brange:%" PRId64 "-%" PRId64 ", rows:%" PRId64 ", uid:%" PRIu64,
GET_TASKID(pTaskInfo), pBlockInfo->window.skey, pBlockInfo->window.ekey, pBlockInfo->rows,
pBlockInfo->id.uid);
- doSetTagColumnData(pTableScanInfo, pBlock, pTaskInfo, 1);
+ doSetTagColumnData(pTableScanInfo, pBlock, pTaskInfo, pBlock->info.rows);
pCost->skipBlocks += 1;
tsdbReleaseDataBlock(pTableScanInfo->dataReader);
return TSDB_CODE_SUCCESS;
@@ -331,7 +342,7 @@ static int32_t loadDataBlock(SOperatorInfo* pOperator, STableScanBase* 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:%" PRId64, GET_TASKID(pTaskInfo),
pBlockInfo->window.skey, pBlockInfo->window.ekey, pBlockInfo->rows);
- doSetTagColumnData(pTableScanInfo, pBlock, pTaskInfo, 1);
+ doSetTagColumnData(pTableScanInfo, pBlock, pTaskInfo, pBlock->info.rows);
tsdbReleaseDataBlock(pTableScanInfo->dataReader);
return TSDB_CODE_SUCCESS;
} else {
@@ -698,9 +709,9 @@ static SSDataBlock* doTableScanImpl(SOperatorInfo* pOperator) {
// todo refactor
/*pTableScanInfo->lastStatus.uid = pBlock->info.id.uid;*/
/*pTableScanInfo->lastStatus.ts = pBlock->info.window.ekey;*/
- pTaskInfo->streamInfo.lastStatus.type = TMQ_OFFSET__SNAPSHOT_DATA;
- pTaskInfo->streamInfo.lastStatus.uid = pBlock->info.id.uid;
- pTaskInfo->streamInfo.lastStatus.ts = pBlock->info.window.ekey;
+ // pTaskInfo->streamInfo.lastStatus.type = TMQ_OFFSET__SNAPSHOT_DATA;
+ // pTaskInfo->streamInfo.lastStatus.uid = pBlock->info.id.uid;
+ // pTaskInfo->streamInfo.lastStatus.ts = pBlock->info.window.ekey;
return pBlock;
}
@@ -890,9 +901,11 @@ static void destroyTableScanOperatorInfo(void* param) {
SOperatorInfo* createTableScanOperatorInfo(STableScanPhysiNode* pTableScanNode, SReadHandle* readHandle,
STableListInfo* pTableListInfo, SExecTaskInfo* pTaskInfo) {
+ int32_t code = 0;
STableScanInfo* pInfo = taosMemoryCalloc(1, sizeof(STableScanInfo));
SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo));
if (pInfo == NULL || pOperator == NULL) {
+ code = TSDB_CODE_OUT_OF_MEMORY;
goto _error;
}
@@ -900,7 +913,7 @@ SOperatorInfo* createTableScanOperatorInfo(STableScanPhysiNode* pTableScanNode,
SDataBlockDescNode* pDescNode = pScanNode->node.pOutputDataBlockDesc;
int32_t numOfCols = 0;
- int32_t code =
+ code =
extractColMatchInfo(pScanNode->pScanCols, pDescNode, &numOfCols, COL_MATCH_FROM_COL_ID, &pInfo->base.matchInfo);
if (code != TSDB_CODE_SUCCESS) {
goto _error;
@@ -1601,18 +1614,16 @@ static SSDataBlock* doQueueScan(SOperatorInfo* pOperator) {
if (pTaskInfo->streamInfo.submit.msgStr != NULL) {
if (pInfo->tqReader->msg2.msgStr == NULL) {
SPackedData submit = pTaskInfo->streamInfo.submit;
- if (tqReaderSetSubmitReq2(pInfo->tqReader, submit.msgStr, submit.msgLen, submit.ver) < 0) {
- qError("submit msg messed up when initing stream submit block %p, %s", submit.msgStr, id);
- pInfo->tqReader->msg2 = (SPackedData){0};
- pInfo->tqReader->setMsg = 0;
- ASSERT(0);
+ if (tqReaderSetSubmitMsg(pInfo->tqReader, submit.msgStr, submit.msgLen, submit.ver) < 0) {
+ qError("submit msg messed up when initing stream submit block %p", submit.msgStr);
+ return NULL;
}
}
blockDataCleanup(pInfo->pRes);
SDataBlockInfo* pBlockInfo = &pInfo->pRes->info;
- while (tqNextDataBlock2(pInfo->tqReader)) {
+ while (tqNextDataBlock(pInfo->tqReader)) {
SSDataBlock block = {0};
int32_t code = tqRetrieveDataBlock2(&block, pInfo->tqReader, NULL);
@@ -1628,73 +1639,54 @@ static SSDataBlock* doQueueScan(SOperatorInfo* pOperator) {
}
pInfo->tqReader->msg2 = (SPackedData){0};
- pInfo->tqReader->setMsg = 0;
pTaskInfo->streamInfo.submit = (SPackedData){0};
return NULL;
}
- if (pTaskInfo->streamInfo.prepareStatus.type == TMQ_OFFSET__SNAPSHOT_DATA) {
+ if (pTaskInfo->streamInfo.currentOffset.type == TMQ_OFFSET__SNAPSHOT_DATA) {
SSDataBlock* pResult = doTableScan(pInfo->pTableScanOp);
if (pResult && pResult->info.rows > 0) {
- qDebug("queue scan tsdb return %" PRId64 " rows min:%" PRId64 " max:%" PRId64 " wal curVersion:%" PRId64 " %s",
+ qDebug("queue scan tsdb return %" PRId64 " rows min:%" PRId64 " max:%" PRId64 " wal curVersion:%" PRId64,
pResult->info.rows, pResult->info.window.skey, pResult->info.window.ekey,
- pInfo->tqReader->pWalReader->curVersion, id);
- pTaskInfo->streamInfo.returned = 1;
+ pInfo->tqReader->pWalReader->curVersion);
+ tqOffsetResetToData(&pTaskInfo->streamInfo.currentOffset, pResult->info.id.uid, pResult->info.window.ekey);
return pResult;
- } else {
- // no data has return already, try to extract data in the WAL
- if (!pTaskInfo->streamInfo.returned) {
- STableScanInfo* pTSInfo = pInfo->pTableScanOp->info;
- tsdbReaderClose(pTSInfo->base.dataReader);
- pTSInfo->base.dataReader = NULL;
- tqOffsetResetToLog(&pTaskInfo->streamInfo.prepareStatus, pTaskInfo->streamInfo.snapshotVer);
-
- qDebug("queue scan tsdb over, switch to wal ver:%" PRId64 " %s", pTaskInfo->streamInfo.snapshotVer + 1, id);
- if (tqSeekVer(pInfo->tqReader, pTaskInfo->streamInfo.snapshotVer + 1, pTaskInfo->id.str) < 0) {
- tqOffsetResetToLog(&pTaskInfo->streamInfo.lastStatus, pTaskInfo->streamInfo.snapshotVer);
- return NULL;
- }
- } else {
- return NULL;
- }
}
+ STableScanInfo* pTSInfo = pInfo->pTableScanOp->info;
+ tsdbReaderClose(pTSInfo->base.dataReader);
+ pTSInfo->base.dataReader = NULL;
+ qDebug("queue scan tsdb over, switch to wal ver %" PRId64 "", pTaskInfo->streamInfo.snapshotVer + 1);
+ if (tqSeekVer(pInfo->tqReader, pTaskInfo->streamInfo.snapshotVer + 1, pTaskInfo->id.str) < 0) {
+ return NULL;
+ }
+ tqOffsetResetToLog(&pTaskInfo->streamInfo.currentOffset, pTaskInfo->streamInfo.snapshotVer);
}
- if (pTaskInfo->streamInfo.prepareStatus.type == TMQ_OFFSET__LOG) {
+ if (pTaskInfo->streamInfo.currentOffset.type == TMQ_OFFSET__LOG) {
while (1) {
SFetchRet ret = {0};
- terrno = 0;
-
- if (tqNextBlock(pInfo->tqReader, &ret) < 0) {
- // if the end is reached, terrno is 0
- if (terrno != 0) {
- qError("failed to get next log block since %s, %s", terrstr(), id);
- }
- }
+ tqNextBlock(pInfo->tqReader, &ret);
+ tqOffsetResetToLog(
+ &pTaskInfo->streamInfo.currentOffset,
+ pInfo->tqReader->pWalReader->curVersion - 1); // curVersion move to next, so currentOffset = curVersion - 1
if (ret.fetchType == FETCH_TYPE__DATA) {
+ qDebug("doQueueScan get data from log %" PRId64 " rows, version:%" PRId64, ret.data.info.rows,
+ pTaskInfo->streamInfo.currentOffset.version);
blockDataCleanup(pInfo->pRes);
setBlockIntoRes(pInfo, &ret.data, true);
if (pInfo->pRes->info.rows > 0) {
- pOperator->status = OP_EXEC_RECV;
- qDebug("queue scan log return %" PRId64 " rows", pInfo->pRes->info.rows);
+ qDebug("doQueueScan get data from log %" PRId64 " rows, return, version:%" PRId64, pInfo->pRes->info.rows,
+ pTaskInfo->streamInfo.currentOffset.version);
return pInfo->pRes;
}
- } else if (ret.fetchType == FETCH_TYPE__META) {
- qError("unexpected ret.fetchType:%d", ret.fetchType);
- continue;
- } else if (ret.fetchType == FETCH_TYPE__NONE ||
- (ret.fetchType == FETCH_TYPE__SEP && pOperator->status == OP_EXEC_RECV)) {
- pTaskInfo->streamInfo.lastStatus = ret.offset;
- char formatBuf[80];
- tFormatOffset(formatBuf, 80, &ret.offset);
- qDebug("queue scan log return null, offset %s", formatBuf);
- pOperator->status = OP_OPENED;
+ } else if (ret.fetchType == FETCH_TYPE__NONE) {
+ qDebug("doQueueScan get none from log, return, version:%" PRId64, pTaskInfo->streamInfo.currentOffset.version);
return NULL;
}
}
} else {
- qError("unexpected streamInfo prepare type: %d %s", pTaskInfo->streamInfo.prepareStatus.type, id);
+ qError("unexpected streamInfo prepare type: %d", pTaskInfo->streamInfo.currentOffset.type);
return NULL;
}
}
@@ -1780,7 +1772,7 @@ int32_t streamScanOperatorEncode(SStreamScanInfo* pInfo, void** pBuff) {
// other properties are recovered from the execution plan
void streamScanOperatorDeocde(void* pBuff, int32_t len, SStreamScanInfo* pInfo) {
- if (!pBuff) {
+ if (!pBuff || len == 0) {
return;
}
@@ -1817,7 +1809,6 @@ static SSDataBlock* doStreamScan(SOperatorInfo* pOperator) {
}
tsdbReaderClose(pTSInfo->base.dataReader);
- qDebug("4");
pTSInfo->base.dataReader = NULL;
pInfo->pTableScanOp->status = OP_OPENED;
@@ -1898,7 +1889,6 @@ static SSDataBlock* doStreamScan(SOperatorInfo* pOperator) {
pTaskInfo->streamInfo.recoverStep = STREAM_RECOVER_STEP__NONE;
STableScanInfo* pTSInfo = pInfo->pTableScanOp->info;
tsdbReaderClose(pTSInfo->base.dataReader);
- qDebug("5");
pTSInfo->base.dataReader = NULL;
@@ -1925,6 +1915,7 @@ FETCH_NEXT_BLOCK:
if (pBlock->info.parTbName[0]) {
streamStatePutParName(pTaskInfo->streamInfo.pState, pBlock->info.id.groupId, pBlock->info.parTbName);
}
+
// TODO move into scan
pBlock->info.calWin.skey = INT64_MIN;
pBlock->info.calWin.ekey = INT64_MAX;
@@ -2064,17 +2055,18 @@ FETCH_NEXT_BLOCK:
updateInfoDestoryColseWinSBF(pInfo->pUpdateInfo);
doClearBufferedBlocks(pInfo);
qDebug("stream scan return empty, consume block %d", totBlockNum);
- // void* buff = NULL;
- // int32_t len = streamScanOperatorEncode(pInfo, &buff);
- // todo(liuyao) save buff
- // taosMemoryFreeClear(buff);
+ void* buff = NULL;
+ int32_t len = streamScanOperatorEncode(pInfo, &buff);
+ if (len > 0) {
+ streamStateSaveInfo(pInfo->pState, STREAM_SCAN_OP_NAME, strlen(STREAM_SCAN_OP_NAME), buff, len);
+ }
+ taosMemoryFreeClear(buff);
return NULL;
}
int32_t current = pInfo->validBlockIndex++;
SPackedData* pSubmit = taosArrayGet(pInfo->pBlockLists, current);
- /*if (tqReaderSetDataMsg(pInfo->tqReader, pSubmit, 0) < 0) {*/
- if (tqReaderSetSubmitReq2(pInfo->tqReader, pSubmit->msgStr, pSubmit->msgLen, pSubmit->ver) < 0) {
+ if (tqReaderSetSubmitMsg(pInfo->tqReader, pSubmit->msgStr, pSubmit->msgLen, pSubmit->ver) < 0) {
qError("submit msg messed up when initing stream submit block %p, current %d, total %d", pSubmit, current,
totBlockNum);
continue;
@@ -2083,7 +2075,7 @@ FETCH_NEXT_BLOCK:
blockDataCleanup(pInfo->pRes);
- while (tqNextDataBlock2(pInfo->tqReader)) {
+ while (tqNextDataBlock(pInfo->tqReader)) {
SSDataBlock block = {0};
int32_t code = tqRetrieveDataBlock2(&block, pInfo->tqReader, NULL);
@@ -2158,7 +2150,7 @@ static SSDataBlock* doRawScan(SOperatorInfo* pOperator) {
pTaskInfo->streamInfo.metaRsp.metaRsp = NULL;
qDebug("tmqsnap doRawScan called");
- if (pTaskInfo->streamInfo.prepareStatus.type == TMQ_OFFSET__SNAPSHOT_DATA) {
+ if (pTaskInfo->streamInfo.currentOffset.type == TMQ_OFFSET__SNAPSHOT_DATA) {
bool hasNext = false;
if (pInfo->dataReader) {
code = tsdbNextDataBlock(pInfo->dataReader, &hasNext);
@@ -2180,28 +2172,23 @@ static SSDataBlock* doRawScan(SOperatorInfo* pOperator) {
}
qDebug("tmqsnap doRawScan get data uid:%" PRId64 "", pBlock->info.id.uid);
- pTaskInfo->streamInfo.lastStatus.type = TMQ_OFFSET__SNAPSHOT_DATA;
- pTaskInfo->streamInfo.lastStatus.uid = pBlock->info.id.uid;
- pTaskInfo->streamInfo.lastStatus.ts = pBlock->info.window.ekey;
+ tqOffsetResetToData(&pTaskInfo->streamInfo.currentOffset, pBlock->info.id.uid, pBlock->info.window.ekey);
return pBlock;
}
SMetaTableInfo mtInfo = getUidfromSnapShot(pInfo->sContext);
+ STqOffsetVal offset = {0};
if (mtInfo.uid == 0) { // read snapshot done, change to get data from wal
qDebug("tmqsnap read snapshot done, change to get data from wal");
- pTaskInfo->streamInfo.prepareStatus.uid = mtInfo.uid;
- pTaskInfo->streamInfo.lastStatus.type = TMQ_OFFSET__LOG;
- pTaskInfo->streamInfo.lastStatus.version = pInfo->sContext->snapVersion;
+ tqOffsetResetToLog(&offset, pInfo->sContext->snapVersion);
} else {
- pTaskInfo->streamInfo.prepareStatus.uid = mtInfo.uid;
- pTaskInfo->streamInfo.prepareStatus.ts = INT64_MIN;
+ tqOffsetResetToData(&offset, mtInfo.uid, INT64_MIN);
qDebug("tmqsnap change get data uid:%" PRId64 "", mtInfo.uid);
- qStreamPrepareScan(pTaskInfo, &pTaskInfo->streamInfo.prepareStatus, pInfo->sContext->subType);
}
+ qStreamPrepareScan(pTaskInfo, &offset, pInfo->sContext->subType);
tDeleteSSchemaWrapper(mtInfo.schema);
- qDebug("tmqsnap stream scan tsdb return null");
return NULL;
- } else if (pTaskInfo->streamInfo.prepareStatus.type == TMQ_OFFSET__SNAPSHOT_META) {
+ } else if (pTaskInfo->streamInfo.currentOffset.type == TMQ_OFFSET__SNAPSHOT_META) {
SSnapContext* sContext = pInfo->sContext;
void* data = NULL;
int32_t dataLen = 0;
@@ -2213,16 +2200,12 @@ static SSDataBlock* doRawScan(SOperatorInfo* pOperator) {
return NULL;
}
- if (!sContext->queryMetaOrData) { // change to get data next poll request
- pTaskInfo->streamInfo.lastStatus.type = TMQ_OFFSET__SNAPSHOT_META;
- pTaskInfo->streamInfo.lastStatus.uid = uid;
- pTaskInfo->streamInfo.metaRsp.rspOffset.type = TMQ_OFFSET__SNAPSHOT_DATA;
- pTaskInfo->streamInfo.metaRsp.rspOffset.uid = 0;
- pTaskInfo->streamInfo.metaRsp.rspOffset.ts = INT64_MIN;
+ if (!sContext->queryMeta) { // change to get data next poll request
+ STqOffsetVal offset = {0};
+ tqOffsetResetToData(&offset, 0, INT64_MIN);
+ qStreamPrepareScan(pTaskInfo, &offset, pInfo->sContext->subType);
} else {
- pTaskInfo->streamInfo.lastStatus.type = TMQ_OFFSET__SNAPSHOT_META;
- pTaskInfo->streamInfo.lastStatus.uid = uid;
- pTaskInfo->streamInfo.metaRsp.rspOffset = pTaskInfo->streamInfo.lastStatus;
+ tqOffsetResetToMeta(&pTaskInfo->streamInfo.currentOffset, uid);
pTaskInfo->streamInfo.metaRsp.resMsgType = type;
pTaskInfo->streamInfo.metaRsp.metaRspLen = dataLen;
pTaskInfo->streamInfo.metaRsp.metaRsp = data;
@@ -2436,7 +2419,6 @@ SOperatorInfo* createStreamScanOperatorInfo(SReadHandle* pHandle, STableScanPhys
if (pHandle->initTableReader) {
pTSInfo->scanMode = TABLE_SCAN__TABLE_ORDER;
pTSInfo->base.dataReader = NULL;
- pTaskInfo->streamInfo.lastStatus.uid = -1;
}
if (pHandle->initTqReader) {
@@ -2505,12 +2487,12 @@ SOperatorInfo* createStreamScanOperatorInfo(SReadHandle* pHandle, STableScanPhys
pInfo->twAggSup.maxTs = INT64_MIN;
pInfo->pState = NULL;
- // todo(liuyao) get buff from rocks db;
void* buff = NULL;
int32_t len = 0;
+ streamStateGetInfo(pTaskInfo->streamInfo.pState, STREAM_SCAN_OP_NAME, strlen(STREAM_SCAN_OP_NAME), &buff, &len);
streamScanOperatorDeocde(buff, len, pInfo);
- setOperatorInfo(pOperator, "StreamScanOperator", QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN, false, OP_NOT_OPENED, pInfo,
+ setOperatorInfo(pOperator, STREAM_SCAN_OP_NAME, QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN, false, OP_NOT_OPENED, pInfo,
pTaskInfo);
pOperator->exprSupp.numOfExprs = taosArrayGetSize(pInfo->pRes->pDataBlock);
diff --git a/source/libs/executor/src/timewindowoperator.c b/source/libs/executor/src/timewindowoperator.c
index f85ec1fb2f..f6f4a75cd9 100644
--- a/source/libs/executor/src/timewindowoperator.c
+++ b/source/libs/executor/src/timewindowoperator.c
@@ -2846,6 +2846,7 @@ void initDownStream(SOperatorInfo* downstream, SStreamAggSupporter* pAggSup, uin
}
SStreamScanInfo* pScanInfo = downstream->info;
pScanInfo->windowSup = (SWindowSupporter){.pStreamAggSup = pAggSup, .gap = pAggSup->gap, .parentType = type};
+ pScanInfo->pState = pAggSup->pState;
if (!pScanInfo->igCheckUpdate && !pScanInfo->pUpdateInfo) {
pScanInfo->pUpdateInfo = updateInfoInit(60000, TSDB_TIME_PRECISION_MILLI, pTwSup->waterMark);
}
@@ -4745,6 +4746,7 @@ static SSDataBlock* doStreamIntervalAgg(SOperatorInfo* pOperator) {
if (!pInfo->pUpdated) {
pInfo->pUpdated = taosArrayInit(4096, POINTER_BYTES);
}
+
if (!pInfo->pUpdatedMap) {
_hash_fn_t hashFn = taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY);
pInfo->pUpdatedMap = tSimpleHashInit(4096, hashFn);
@@ -4757,6 +4759,7 @@ static SSDataBlock* doStreamIntervalAgg(SOperatorInfo* pOperator) {
pInfo->numOfDatapack = 0;
break;
}
+
pInfo->numOfDatapack++;
printDataBlock(pBlock, "single interval recv");
diff --git a/source/libs/function/src/builtinsimpl.c b/source/libs/function/src/builtinsimpl.c
index 0d2ae4bd74..0006ce1f27 100644
--- a/source/libs/function/src/builtinsimpl.c
+++ b/source/libs/function/src/builtinsimpl.c
@@ -3353,7 +3353,7 @@ int32_t spreadFunction(SqlFunctionCtx* pCtx) {
goto _spread_over;
}
double tmin = 0.0, tmax = 0.0;
- if (IS_SIGNED_NUMERIC_TYPE(type)) {
+ if (IS_SIGNED_NUMERIC_TYPE(type) || IS_TIMESTAMP_TYPE(type)) {
tmin = (double)GET_INT64_VAL(&pAgg->min);
tmax = (double)GET_INT64_VAL(&pAgg->max);
} else if (IS_FLOAT_TYPE(type)) {
diff --git a/source/libs/function/test/udf1.c b/source/libs/function/test/udf1.c
index 7798a0bf3d..5b95087996 100644
--- a/source/libs/function/test/udf1.c
+++ b/source/libs/function/test/udf1.c
@@ -24,7 +24,7 @@ DLL_EXPORT int32_t udf1(SUdfDataBlock *block, SUdfColumn *resultCol) {
}
}
if (j == block->numOfCols) {
- int32_t luckyNum = 88;
+ int32_t luckyNum = 1;
udfColDataSet(resultCol, i, (char *)&luckyNum, false);
}
}
diff --git a/source/libs/nodes/src/nodesUtilFuncs.c b/source/libs/nodes/src/nodesUtilFuncs.c
index 4180ba1d6c..3f571e22ae 100644
--- a/source/libs/nodes/src/nodesUtilFuncs.c
+++ b/source/libs/nodes/src/nodesUtilFuncs.c
@@ -925,6 +925,7 @@ void nodesDestroyNode(SNode* pNode) {
taosMemoryFree(((SDescribeStmt*)pNode)->pMeta);
break;
case QUERY_NODE_RESET_QUERY_CACHE_STMT: // no pointer field
+ break;
case QUERY_NODE_COMPACT_DATABASE_STMT: {
SCompactDatabaseStmt* pStmt = (SCompactDatabaseStmt*)pNode;
nodesDestroyNode(pStmt->pStart);
@@ -942,10 +943,10 @@ void nodesDestroyNode(SNode* pNode) {
nodesDestroyNode(pStmt->pSubtable);
break;
}
- case QUERY_NODE_DROP_STREAM_STMT: // no pointer field
- case QUERY_NODE_BALANCE_VGROUP_STMT: // no pointer field
+ case QUERY_NODE_DROP_STREAM_STMT: // no pointer field
+ case QUERY_NODE_BALANCE_VGROUP_STMT: // no pointer field
case QUERY_NODE_BALANCE_VGROUP_LEADER_STMT: // no pointer field
- case QUERY_NODE_MERGE_VGROUP_STMT: // no pointer field
+ case QUERY_NODE_MERGE_VGROUP_STMT: // no pointer field
break;
case QUERY_NODE_REDISTRIBUTE_VGROUP_STMT:
nodesDestroyList(((SRedistributeVgroupStmt*)pNode)->pDnodes);
diff --git a/source/libs/parser/inc/parAst.h b/source/libs/parser/inc/parAst.h
index 69043e8915..e08b77e681 100644
--- a/source/libs/parser/inc/parAst.h
+++ b/source/libs/parser/inc/parAst.h
@@ -82,6 +82,11 @@ typedef struct SAlterOption {
SNodeList* pList;
} SAlterOption;
+typedef struct STokenPair {
+ SToken first;
+ SToken second;
+} STokenPair;
+
extern SToken nil_token;
void initAstCreateContext(SParseContext* pParseCxt, SAstCreateContext* pCxt);
@@ -229,8 +234,10 @@ SNode* createMergeVgroupStmt(SAstCreateContext* pCxt, const SToken* pVgId1, cons
SNode* createRedistributeVgroupStmt(SAstCreateContext* pCxt, const SToken* pVgId, SNodeList* pDnodes);
SNode* createSplitVgroupStmt(SAstCreateContext* pCxt, const SToken* pVgId);
SNode* createSyncdbStmt(SAstCreateContext* pCxt, const SToken* pDbName);
-SNode* createGrantStmt(SAstCreateContext* pCxt, int64_t privileges, SToken* pDbName, SToken* pUserName);
-SNode* createRevokeStmt(SAstCreateContext* pCxt, int64_t privileges, SToken* pDbName, SToken* pUserName);
+SNode* createGrantStmt(SAstCreateContext* pCxt, int64_t privileges, STokenPair* pPrivLevel, SToken* pUserName,
+ SNode* pTagCond);
+SNode* createRevokeStmt(SAstCreateContext* pCxt, int64_t privileges, STokenPair* pPrivLevel, SToken* pUserName,
+ SNode* pTagCond);
SNode* createDeleteStmt(SAstCreateContext* pCxt, SNode* pTable, SNode* pWhere);
SNode* createInsertStmt(SAstCreateContext* pCxt, SNode* pTable, SNodeList* pCols, SNode* pQuery);
diff --git a/source/libs/parser/inc/parUtil.h b/source/libs/parser/inc/parUtil.h
index ce5a63f5d0..850571eea1 100644
--- a/source/libs/parser/inc/parUtil.h
+++ b/source/libs/parser/inc/parUtil.h
@@ -97,9 +97,8 @@ int32_t reserveTableVgroupInCache(int32_t acctId, const char* pDb, const char* p
int32_t reserveTableVgroupInCacheExt(const SName* pName, SParseMetaCache* pMetaCache);
int32_t reserveDbVgVersionInCache(int32_t acctId, const char* pDb, SParseMetaCache* pMetaCache);
int32_t reserveDbCfgInCache(int32_t acctId, const char* pDb, SParseMetaCache* pMetaCache);
-int32_t reserveUserAuthInCache(int32_t acctId, const char* pUser, const char* pDb, AUTH_TYPE type,
+int32_t reserveUserAuthInCache(int32_t acctId, const char* pUser, const char* pDb, const char* pTable, AUTH_TYPE type,
SParseMetaCache* pMetaCache);
-int32_t reserveUserAuthInCacheExt(const char* pUser, const SName* pName, AUTH_TYPE type, SParseMetaCache* pMetaCache);
int32_t reserveUdfInCache(const char* pFunc, SParseMetaCache* pMetaCache);
int32_t reserveTableIndexInCache(int32_t acctId, const char* pDb, const char* pTable, SParseMetaCache* pMetaCache);
int32_t reserveTableCfgInCache(int32_t acctId, const char* pDb, const char* pTable, SParseMetaCache* pMetaCache);
@@ -110,8 +109,7 @@ int32_t getTableVgroupFromCache(SParseMetaCache* pMetaCache, const SName* pName,
int32_t getDbVgVersionFromCache(SParseMetaCache* pMetaCache, const char* pDbFName, int32_t* pVersion, int64_t* pDbId,
int32_t* pTableNum, int64_t* pStateTs);
int32_t getDbCfgFromCache(SParseMetaCache* pMetaCache, const char* pDbFName, SDbCfgInfo* pInfo);
-int32_t getUserAuthFromCache(SParseMetaCache* pMetaCache, const char* pUser, const char* pDbFName, AUTH_TYPE type,
- bool* pPass);
+int32_t getUserAuthFromCache(SParseMetaCache* pMetaCache, SUserAuthInfo* pAuthReq, SUserAuthRes* pAuthRes);
int32_t getUdfInfoFromCache(SParseMetaCache* pMetaCache, const char* pFunc, SFuncInfo* pInfo);
int32_t getTableIndexFromCache(SParseMetaCache* pMetaCache, const SName* pName, SArray** pIndexes);
int32_t getTableCfgFromCache(SParseMetaCache* pMetaCache, const SName* pName, STableCfg** pOutput);
diff --git a/source/libs/parser/inc/sql.y b/source/libs/parser/inc/sql.y
index ebd8f51f90..f99976e0df 100644
--- a/source/libs/parser/inc/sql.y
+++ b/source/libs/parser/inc/sql.y
@@ -94,8 +94,8 @@ sysinfo_opt(A) ::= .
sysinfo_opt(A) ::= SYSINFO NK_INTEGER(B). { A = taosStr2Int8(B.z, NULL, 10); }
/************************************************ grant/revoke ********************************************************/
-cmd ::= GRANT privileges(A) ON priv_level(B) TO user_name(C). { pCxt->pRootNode = createGrantStmt(pCxt, A, &B, &C); }
-cmd ::= REVOKE privileges(A) ON priv_level(B) FROM user_name(C). { pCxt->pRootNode = createRevokeStmt(pCxt, A, &B, &C); }
+cmd ::= GRANT privileges(A) ON priv_level(B) with_opt(D) TO user_name(C). { pCxt->pRootNode = createGrantStmt(pCxt, A, &B, &C, D); }
+cmd ::= REVOKE privileges(A) ON priv_level(B) with_opt(D) FROM user_name(C). { pCxt->pRootNode = createRevokeStmt(pCxt, A, &B, &C, D); }
%type privileges { int64_t }
%destructor privileges { }
@@ -113,11 +113,15 @@ priv_type_list(A) ::= priv_type_list(B) NK_COMMA priv_type(C).
priv_type(A) ::= READ. { A = PRIVILEGE_TYPE_READ; }
priv_type(A) ::= WRITE. { A = PRIVILEGE_TYPE_WRITE; }
-%type priv_level { SToken }
+%type priv_level { STokenPair }
%destructor priv_level { }
-priv_level(A) ::= NK_STAR(B) NK_DOT NK_STAR. { A = B; }
-priv_level(A) ::= db_name(B) NK_DOT NK_STAR. { A = B; }
-priv_level(A) ::= topic_name(B). { A = B; }
+priv_level(A) ::= NK_STAR(B) NK_DOT NK_STAR(C). { A.first = B; A.second = C; }
+priv_level(A) ::= db_name(B) NK_DOT NK_STAR(C). { A.first = B; A.second = C; }
+priv_level(A) ::= db_name(B) NK_DOT table_name(C). { A.first = B; A.second = C; }
+priv_level(A) ::= topic_name(B). { A.first = B; A.second = nil_token; }
+
+with_opt(A) ::= . { A = NULL; }
+with_opt(A) ::= WITH search_condition(B). { A = B; }
/************************************************ create/drop/alter dnode *********************************************/
cmd ::= CREATE DNODE dnode_endpoint(A). { pCxt->pRootNode = createCreateDnodeStmt(pCxt, &A, NULL); }
@@ -342,7 +346,7 @@ column_def_list(A) ::= column_def(B).
column_def_list(A) ::= column_def_list(B) NK_COMMA column_def(C). { A = addNodeToList(pCxt, B, C); }
column_def(A) ::= column_name(B) type_name(C). { A = createColumnDefNode(pCxt, &B, C, NULL); }
-column_def(A) ::= column_name(B) type_name(C) COMMENT NK_STRING(D). { A = createColumnDefNode(pCxt, &B, C, &D); }
+//column_def(A) ::= column_name(B) type_name(C) COMMENT NK_STRING(D). { A = createColumnDefNode(pCxt, &B, C, &D); }
%type type_name { SDataType }
%destructor type_name { }
diff --git a/source/libs/parser/src/parAstCreater.c b/source/libs/parser/src/parAstCreater.c
index 2ec942d890..2afe34c1f7 100644
--- a/source/libs/parser/src/parAstCreater.c
+++ b/source/libs/parser/src/parAstCreater.c
@@ -1994,29 +1994,39 @@ SNode* createSyncdbStmt(SAstCreateContext* pCxt, const SToken* pDbName) {
return pStmt;
}
-SNode* createGrantStmt(SAstCreateContext* pCxt, int64_t privileges, SToken* pDbName, SToken* pUserName) {
+SNode* createGrantStmt(SAstCreateContext* pCxt, int64_t privileges, STokenPair* pPrivLevel, SToken* pUserName,
+ SNode* pTagCond) {
CHECK_PARSER_STATUS(pCxt);
- if (!checkDbName(pCxt, pDbName, false) || !checkUserName(pCxt, pUserName)) {
+ if (!checkDbName(pCxt, &pPrivLevel->first, false) || !checkUserName(pCxt, pUserName)) {
return NULL;
}
SGrantStmt* pStmt = (SGrantStmt*)nodesMakeNode(QUERY_NODE_GRANT_STMT);
CHECK_OUT_OF_MEM(pStmt);
pStmt->privileges = privileges;
- COPY_STRING_FORM_ID_TOKEN(pStmt->objName, pDbName);
+ COPY_STRING_FORM_ID_TOKEN(pStmt->objName, &pPrivLevel->first);
+ if (TK_NK_NIL != pPrivLevel->second.type && TK_NK_STAR != pPrivLevel->second.type) {
+ COPY_STRING_FORM_ID_TOKEN(pStmt->tabName, &pPrivLevel->second);
+ }
COPY_STRING_FORM_ID_TOKEN(pStmt->userName, pUserName);
+ pStmt->pTagCond = pTagCond;
return (SNode*)pStmt;
}
-SNode* createRevokeStmt(SAstCreateContext* pCxt, int64_t privileges, SToken* pDbName, SToken* pUserName) {
+SNode* createRevokeStmt(SAstCreateContext* pCxt, int64_t privileges, STokenPair* pPrivLevel, SToken* pUserName,
+ SNode* pTagCond) {
CHECK_PARSER_STATUS(pCxt);
- if (!checkDbName(pCxt, pDbName, false) || !checkUserName(pCxt, pUserName)) {
+ if (!checkDbName(pCxt, &pPrivLevel->first, false) || !checkUserName(pCxt, pUserName)) {
return NULL;
}
SRevokeStmt* pStmt = (SRevokeStmt*)nodesMakeNode(QUERY_NODE_REVOKE_STMT);
CHECK_OUT_OF_MEM(pStmt);
pStmt->privileges = privileges;
- COPY_STRING_FORM_ID_TOKEN(pStmt->objName, pDbName);
+ COPY_STRING_FORM_ID_TOKEN(pStmt->objName, &pPrivLevel->first);
+ if (TK_NK_NIL != pPrivLevel->second.type && TK_NK_STAR != pPrivLevel->second.type) {
+ COPY_STRING_FORM_ID_TOKEN(pStmt->tabName, &pPrivLevel->second);
+ }
COPY_STRING_FORM_ID_TOKEN(pStmt->userName, pUserName);
+ pStmt->pTagCond = pTagCond;
return (SNode*)pStmt;
}
diff --git a/source/libs/parser/src/parAstParser.c b/source/libs/parser/src/parAstParser.c
index cd4b455e02..5db1f5dbdb 100644
--- a/source/libs/parser/src/parAstParser.c
+++ b/source/libs/parser/src/parAstParser.c
@@ -154,7 +154,8 @@ static int32_t collectMetaKeyFromRealTableImpl(SCollectMetaKeyCxt* pCxt, const c
code = reserveTableVgroupInCache(pCxt->pParseCxt->acctId, pDb, pTable, pCxt->pMetaCache);
}
if (TSDB_CODE_SUCCESS == code) {
- code = reserveUserAuthInCache(pCxt->pParseCxt->acctId, pCxt->pParseCxt->pUser, pDb, authType, pCxt->pMetaCache);
+ code = reserveUserAuthInCache(pCxt->pParseCxt->acctId, pCxt->pParseCxt->pUser, pDb, pTable, authType,
+ pCxt->pMetaCache);
}
if (TSDB_CODE_SUCCESS == code) {
code = reserveDbVgInfoInCache(pCxt->pParseCxt->acctId, pDb, pCxt->pMetaCache);
@@ -247,7 +248,7 @@ static int32_t collectMetaKeyFromCreateTable(SCollectMetaKeyCxt* pCxt, SCreateTa
code = reserveTableVgroupInCache(pCxt->pParseCxt->acctId, pStmt->dbName, pStmt->tableName, pCxt->pMetaCache);
}
if (TSDB_CODE_SUCCESS == code) {
- code = reserveUserAuthInCache(pCxt->pParseCxt->acctId, pCxt->pParseCxt->pUser, pStmt->dbName, AUTH_TYPE_WRITE,
+ code = reserveUserAuthInCache(pCxt->pParseCxt->acctId, pCxt->pParseCxt->pUser, pStmt->dbName, NULL, AUTH_TYPE_WRITE,
pCxt->pMetaCache);
}
return code;
@@ -267,8 +268,8 @@ static int32_t collectMetaKeyFromCreateMultiTable(SCollectMetaKeyCxt* pCxt, SCre
code = reserveTableVgroupInCache(pCxt->pParseCxt->acctId, pClause->dbName, pClause->tableName, pCxt->pMetaCache);
}
if (TSDB_CODE_SUCCESS == code) {
- code = reserveUserAuthInCache(pCxt->pParseCxt->acctId, pCxt->pParseCxt->pUser, pClause->dbName, AUTH_TYPE_WRITE,
- pCxt->pMetaCache);
+ code = reserveUserAuthInCache(pCxt->pParseCxt->acctId, pCxt->pParseCxt->pUser, pClause->dbName, NULL,
+ AUTH_TYPE_WRITE, pCxt->pMetaCache);
}
if (TSDB_CODE_SUCCESS != code) {
break;
@@ -286,6 +287,10 @@ static int32_t collectMetaKeyFromDropTable(SCollectMetaKeyCxt* pCxt, SDropTableS
if (TSDB_CODE_SUCCESS == code) {
code = reserveTableVgroupInCache(pCxt->pParseCxt->acctId, pClause->dbName, pClause->tableName, pCxt->pMetaCache);
}
+ if (TSDB_CODE_SUCCESS == code) {
+ code = reserveUserAuthInCache(pCxt->pParseCxt->acctId, pCxt->pParseCxt->pUser, pClause->dbName,
+ pClause->tableName, AUTH_TYPE_WRITE, pCxt->pMetaCache);
+ }
if (TSDB_CODE_SUCCESS != code) {
break;
}
@@ -293,6 +298,11 @@ static int32_t collectMetaKeyFromDropTable(SCollectMetaKeyCxt* pCxt, SDropTableS
return code;
}
+static int32_t collectMetaKeyFromDropStable(SCollectMetaKeyCxt* pCxt, SDropSuperTableStmt* pStmt) {
+ return reserveUserAuthInCache(pCxt->pParseCxt->acctId, pCxt->pParseCxt->pUser, pStmt->dbName, pStmt->tableName,
+ AUTH_TYPE_WRITE, pCxt->pMetaCache);
+}
+
static int32_t collectMetaKeyFromAlterTable(SCollectMetaKeyCxt* pCxt, SAlterTableStmt* pStmt) {
int32_t code = reserveDbCfgInCache(pCxt->pParseCxt->acctId, pStmt->dbName, pCxt->pMetaCache);
if (TSDB_CODE_SUCCESS == code) {
@@ -301,6 +311,10 @@ static int32_t collectMetaKeyFromAlterTable(SCollectMetaKeyCxt* pCxt, SAlterTabl
if (TSDB_CODE_SUCCESS == code) {
code = reserveTableVgroupInCache(pCxt->pParseCxt->acctId, pStmt->dbName, pStmt->tableName, pCxt->pMetaCache);
}
+ if (TSDB_CODE_SUCCESS == code) {
+ code = reserveUserAuthInCache(pCxt->pParseCxt->acctId, pCxt->pParseCxt->pUser, pStmt->dbName, pStmt->tableName,
+ AUTH_TYPE_WRITE, pCxt->pMetaCache);
+ }
return code;
}
@@ -309,6 +323,10 @@ static int32_t collectMetaKeyFromAlterStable(SCollectMetaKeyCxt* pCxt, SAlterTab
if (TSDB_CODE_SUCCESS == code) {
code = reserveTableMetaInCache(pCxt->pParseCxt->acctId, pStmt->dbName, pStmt->tableName, pCxt->pMetaCache);
}
+ if (TSDB_CODE_SUCCESS == code) {
+ code = reserveUserAuthInCache(pCxt->pParseCxt->acctId, pCxt->pParseCxt->pUser, pStmt->dbName, pStmt->tableName,
+ AUTH_TYPE_WRITE, pCxt->pMetaCache);
+ }
return code;
}
@@ -439,8 +457,9 @@ static int32_t collectMetaKeyFromShowStables(SCollectMetaKeyCxt* pCxt, SShowStmt
int32_t code = reserveTableMetaInCache(pCxt->pParseCxt->acctId, TSDB_INFORMATION_SCHEMA_DB, TSDB_INS_TABLE_STABLES,
pCxt->pMetaCache);
if (TSDB_CODE_SUCCESS == code) {
- code = reserveUserAuthInCache(pCxt->pParseCxt->acctId, pCxt->pParseCxt->pUser,
- ((SValueNode*)pStmt->pDbName)->literal, AUTH_TYPE_READ_OR_WRITE, pCxt->pMetaCache);
+ code =
+ reserveUserAuthInCache(pCxt->pParseCxt->acctId, pCxt->pParseCxt->pUser, ((SValueNode*)pStmt->pDbName)->literal,
+ NULL, AUTH_TYPE_READ_OR_WRITE, pCxt->pMetaCache);
}
return code;
}
@@ -457,8 +476,9 @@ static int32_t collectMetaKeyFromShowTables(SCollectMetaKeyCxt* pCxt, SShowStmt*
code = reserveDbVgInfoInCache(pCxt->pParseCxt->acctId, ((SValueNode*)pStmt->pDbName)->literal, pCxt->pMetaCache);
}
if (TSDB_CODE_SUCCESS == code) {
- code = reserveUserAuthInCache(pCxt->pParseCxt->acctId, pCxt->pParseCxt->pUser,
- ((SValueNode*)pStmt->pDbName)->literal, AUTH_TYPE_READ_OR_WRITE, pCxt->pMetaCache);
+ code =
+ reserveUserAuthInCache(pCxt->pParseCxt->acctId, pCxt->pParseCxt->pUser, ((SValueNode*)pStmt->pDbName)->literal,
+ NULL, AUTH_TYPE_READ_OR_WRITE, pCxt->pMetaCache);
}
return code;
}
@@ -561,7 +581,8 @@ static int32_t collectMetaKeyFromShowCreateTable(SCollectMetaKeyCxt* pCxt, SShow
code = reserveDbCfgInCache(pCxt->pParseCxt->acctId, pStmt->dbName, pCxt->pMetaCache);
}
if (TSDB_CODE_SUCCESS == code) {
- code = reserveUserAuthInCacheExt(pCxt->pParseCxt->pUser, &name, AUTH_TYPE_READ, pCxt->pMetaCache);
+ code = reserveUserAuthInCache(pCxt->pParseCxt->acctId, pCxt->pParseCxt->pUser, pStmt->dbName, NULL, AUTH_TYPE_READ,
+ pCxt->pMetaCache);
}
return code;
}
@@ -610,6 +631,13 @@ static int32_t collectMetaKeyFromCompactDatabase(SCollectMetaKeyCxt* pCxt, SComp
return reserveDbCfgInCache(pCxt->pParseCxt->acctId, pStmt->dbName, pCxt->pMetaCache);
}
+static int32_t collectMetaKeyFromGrant(SCollectMetaKeyCxt* pCxt, SGrantStmt* pStmt) {
+ if ('\0' == pStmt->tabName[0]) {
+ return TSDB_CODE_SUCCESS;
+ }
+ return reserveTableMetaInCache(pCxt->pParseCxt->acctId, pStmt->objName, pStmt->tabName, pCxt->pMetaCache);
+}
+
static int32_t collectMetaKeyFromQuery(SCollectMetaKeyCxt* pCxt, SNode* pStmt) {
pCxt->pStmt = pStmt;
switch (nodeType(pStmt)) {
@@ -627,6 +655,8 @@ static int32_t collectMetaKeyFromQuery(SCollectMetaKeyCxt* pCxt, SNode* pStmt) {
return collectMetaKeyFromCreateMultiTable(pCxt, (SCreateMultiTablesStmt*)pStmt);
case QUERY_NODE_DROP_TABLE_STMT:
return collectMetaKeyFromDropTable(pCxt, (SDropTableStmt*)pStmt);
+ case QUERY_NODE_DROP_SUPER_TABLE_STMT:
+ return collectMetaKeyFromDropStable(pCxt, (SDropSuperTableStmt*)pStmt);
case QUERY_NODE_ALTER_TABLE_STMT:
return collectMetaKeyFromAlterTable(pCxt, (SAlterTableStmt*)pStmt);
case QUERY_NODE_ALTER_SUPER_TABLE_STMT:
@@ -645,6 +675,8 @@ static int32_t collectMetaKeyFromQuery(SCollectMetaKeyCxt* pCxt, SNode* pStmt) {
return collectMetaKeyFromCompactDatabase(pCxt, (SCompactDatabaseStmt*)pStmt);
case QUERY_NODE_CREATE_STREAM_STMT:
return collectMetaKeyFromCreateStream(pCxt, (SCreateStreamStmt*)pStmt);
+ case QUERY_NODE_GRANT_STMT:
+ return collectMetaKeyFromGrant(pCxt, (SGrantStmt*)pStmt);
case QUERY_NODE_SHOW_DNODES_STMT:
return collectMetaKeyFromShowDnodes(pCxt, (SShowStmt*)pStmt);
case QUERY_NODE_SHOW_MNODES_STMT:
diff --git a/source/libs/parser/src/parAuthenticator.c b/source/libs/parser/src/parAuthenticator.c
index e4de60fd05..b06d48a690 100644
--- a/source/libs/parser/src/parAuthenticator.c
+++ b/source/libs/parser/src/parAuthenticator.c
@@ -23,49 +23,112 @@ typedef struct SAuthCxt {
int32_t errCode;
} SAuthCxt;
+typedef struct SSelectAuthCxt {
+ SAuthCxt* pAuthCxt;
+ SSelectStmt* pSelect;
+} SSelectAuthCxt;
+
static int32_t authQuery(SAuthCxt* pCxt, SNode* pStmt);
-static int32_t checkAuth(SAuthCxt* pCxt, const char* pDbName, AUTH_TYPE type) {
+static void setUserAuthInfo(SParseContext* pCxt, const char* pDbName, const char* pTabName, AUTH_TYPE type,
+ SUserAuthInfo* pAuth) {
+ snprintf(pAuth->user, sizeof(pAuth->user), "%s", pCxt->pUser);
+ if (NULL == pTabName) {
+ tNameSetDbName(&pAuth->tbName, pCxt->acctId, pDbName, strlen(pDbName));
+ } else {
+ toName(pCxt->acctId, pDbName, pTabName, &pAuth->tbName);
+ }
+ pAuth->type = type;
+}
+
+static int32_t checkAuth(SAuthCxt* pCxt, const char* pDbName, const char* pTabName, AUTH_TYPE type, SNode** pCond) {
SParseContext* pParseCxt = pCxt->pParseCxt;
if (pParseCxt->isSuperUser) {
return TSDB_CODE_SUCCESS;
}
- SName name;
- tNameSetDbName(&name, pParseCxt->acctId, pDbName, strlen(pDbName));
- char dbFname[TSDB_DB_FNAME_LEN] = {0};
- tNameGetFullDbName(&name, dbFname);
- int32_t code = TSDB_CODE_SUCCESS;
- bool pass = false;
+
+ SUserAuthInfo authInfo = {0};
+ setUserAuthInfo(pCxt->pParseCxt, pDbName, pTabName, type, &authInfo);
+ int32_t code = TSDB_CODE_SUCCESS;
+ SUserAuthRes authRes = {0};
if (NULL != pCxt->pMetaCache) {
- code = getUserAuthFromCache(pCxt->pMetaCache, pParseCxt->pUser, dbFname, type, &pass);
+ code = getUserAuthFromCache(pCxt->pMetaCache, &authInfo, &authRes);
} else {
SRequestConnInfo conn = {.pTrans = pParseCxt->pTransporter,
.requestId = pParseCxt->requestId,
.requestObjRefId = pParseCxt->requestRid,
.mgmtEps = pParseCxt->mgmtEpSet};
-
- code = catalogChkAuth(pParseCxt->pCatalog, &conn, pParseCxt->pUser, dbFname, type, &pass);
+ code = catalogChkAuth(pParseCxt->pCatalog, &conn, &authInfo, &authRes);
}
- return TSDB_CODE_SUCCESS == code ? (pass ? TSDB_CODE_SUCCESS : TSDB_CODE_PAR_PERMISSION_DENIED) : code;
+ if (TSDB_CODE_SUCCESS == code && NULL != pCond) {
+ *pCond = authRes.pCond;
+ }
+ return TSDB_CODE_SUCCESS == code ? (authRes.pass ? TSDB_CODE_SUCCESS : TSDB_CODE_PAR_PERMISSION_DENIED) : code;
}
static EDealRes authSubquery(SAuthCxt* pCxt, SNode* pStmt) {
return TSDB_CODE_SUCCESS == authQuery(pCxt, pStmt) ? DEAL_RES_CONTINUE : DEAL_RES_ERROR;
}
+static int32_t mergeStableTagCond(SNode** pWhere, SNode** pTagCond) {
+ SLogicConditionNode* pLogicCond = (SLogicConditionNode*)nodesMakeNode(QUERY_NODE_LOGIC_CONDITION);
+ if (NULL == pLogicCond) {
+ return TSDB_CODE_OUT_OF_MEMORY;
+ }
+ pLogicCond->node.resType.type = TSDB_DATA_TYPE_BOOL;
+ pLogicCond->node.resType.bytes = tDataTypes[TSDB_DATA_TYPE_BOOL].bytes;
+ pLogicCond->condType = LOGIC_COND_TYPE_AND;
+ int32_t code = nodesListMakeStrictAppend(&pLogicCond->pParameterList, *pTagCond);
+ if (TSDB_CODE_SUCCESS == code) {
+ code = nodesListMakeAppend(&pLogicCond->pParameterList, *pWhere);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ *pWhere = (SNode*)pLogicCond;
+ } else {
+ nodesDestroyNode((SNode*)pLogicCond);
+ }
+ return code;
+}
+
+static int32_t appendStableTagCond(SNode** pWhere, SNode* pTagCond) {
+ SNode* pTagCondCopy = nodesCloneNode(pTagCond);
+ if (NULL == pTagCondCopy) {
+ return TSDB_CODE_OUT_OF_MEMORY;
+ }
+
+ if (NULL == *pWhere) {
+ *pWhere = pTagCondCopy;
+ return TSDB_CODE_SUCCESS;
+ }
+
+ if (QUERY_NODE_LOGIC_CONDITION == nodeType(*pWhere) &&
+ LOGIC_COND_TYPE_AND == ((SLogicConditionNode*)*pWhere)->condType) {
+ return nodesListStrictAppend(((SLogicConditionNode*)*pWhere)->pParameterList, pTagCondCopy);
+ }
+
+ return mergeStableTagCond(pWhere, &pTagCondCopy);
+}
+
static EDealRes authSelectImpl(SNode* pNode, void* pContext) {
- SAuthCxt* pCxt = pContext;
+ SSelectAuthCxt* pCxt = pContext;
+ SAuthCxt* pAuthCxt = pCxt->pAuthCxt;
if (QUERY_NODE_REAL_TABLE == nodeType(pNode)) {
- pCxt->errCode = checkAuth(pCxt, ((SRealTableNode*)pNode)->table.dbName, AUTH_TYPE_READ);
- return TSDB_CODE_SUCCESS == pCxt->errCode ? DEAL_RES_CONTINUE : DEAL_RES_ERROR;
+ SNode* pTagCond = NULL;
+ STableNode* pTable = (STableNode*)pNode;
+ pAuthCxt->errCode = checkAuth(pAuthCxt, pTable->dbName, pTable->tableName, AUTH_TYPE_READ, &pTagCond);
+ if (TSDB_CODE_SUCCESS == pAuthCxt->errCode && NULL != pTagCond) {
+ pAuthCxt->errCode = appendStableTagCond(&pCxt->pSelect->pWhere, pTagCond);
+ }
+ return TSDB_CODE_SUCCESS == pAuthCxt->errCode ? DEAL_RES_CONTINUE : DEAL_RES_ERROR;
} else if (QUERY_NODE_TEMP_TABLE == nodeType(pNode)) {
- return authSubquery(pCxt, ((STempTableNode*)pNode)->pSubquery);
+ return authSubquery(pAuthCxt, ((STempTableNode*)pNode)->pSubquery);
}
return DEAL_RES_CONTINUE;
}
static int32_t authSelect(SAuthCxt* pCxt, SSelectStmt* pSelect) {
- nodesWalkSelectStmt(pSelect, SQL_CLAUSE_FROM, authSelectImpl, pCxt);
+ SSelectAuthCxt cxt = {.pAuthCxt = pCxt, .pSelect = pSelect};
+ nodesWalkSelectStmt(pSelect, SQL_CLAUSE_FROM, authSelectImpl, &cxt);
return pCxt->errCode;
}
@@ -85,11 +148,20 @@ static int32_t authDropUser(SAuthCxt* pCxt, SDropUserStmt* pStmt) {
}
static int32_t authDelete(SAuthCxt* pCxt, SDeleteStmt* pDelete) {
- return checkAuth(pCxt, ((SRealTableNode*)pDelete->pFromTable)->table.dbName, AUTH_TYPE_WRITE);
+ SNode* pTagCond = NULL;
+ STableNode* pTable = (STableNode*)pDelete->pFromTable;
+ int32_t code = checkAuth(pCxt, pTable->dbName, pTable->tableName, AUTH_TYPE_WRITE, &pTagCond);
+ if (TSDB_CODE_SUCCESS == code && NULL != pTagCond) {
+ code = appendStableTagCond(&pDelete->pWhere, pTagCond);
+ }
+ return code;
}
static int32_t authInsert(SAuthCxt* pCxt, SInsertStmt* pInsert) {
- int32_t code = checkAuth(pCxt, ((SRealTableNode*)pInsert->pTable)->table.dbName, AUTH_TYPE_WRITE);
+ SNode* pTagCond = NULL;
+ STableNode* pTable = (STableNode*)pInsert->pTable;
+ // todo check tag condition for subtable
+ int32_t code = checkAuth(pCxt, pTable->dbName, pTable->tableName, AUTH_TYPE_WRITE, &pTagCond);
if (TSDB_CODE_SUCCESS == code) {
code = authQuery(pCxt, pInsert->pQuery);
}
@@ -97,22 +169,27 @@ static int32_t authInsert(SAuthCxt* pCxt, SInsertStmt* pInsert) {
}
static int32_t authShowTables(SAuthCxt* pCxt, SShowStmt* pStmt) {
- return checkAuth(pCxt, ((SValueNode*)pStmt->pDbName)->literal, AUTH_TYPE_READ_OR_WRITE);
+ return checkAuth(pCxt, ((SValueNode*)pStmt->pDbName)->literal, NULL, AUTH_TYPE_READ_OR_WRITE, NULL);
}
static int32_t authShowCreateTable(SAuthCxt* pCxt, SShowCreateTableStmt* pStmt) {
- return checkAuth(pCxt, pStmt->dbName, AUTH_TYPE_READ);
+ SNode* pTagCond = NULL;
+ // todo check tag condition for subtable
+ return checkAuth(pCxt, pStmt->dbName, NULL, AUTH_TYPE_READ, &pTagCond);
}
static int32_t authCreateTable(SAuthCxt* pCxt, SCreateTableStmt* pStmt) {
- return checkAuth(pCxt, pStmt->dbName, AUTH_TYPE_WRITE);
+ SNode* pTagCond = NULL;
+ // todo check tag condition for subtable
+ return checkAuth(pCxt, pStmt->dbName, NULL, AUTH_TYPE_WRITE, &pTagCond);
}
static int32_t authCreateMultiTable(SAuthCxt* pCxt, SCreateMultiTablesStmt* pStmt) {
int32_t code = TSDB_CODE_SUCCESS;
SNode* pNode = NULL;
FOREACH(pNode, pStmt->pSubTables) {
- code = checkAuth(pCxt, ((SCreateSubTableClause*)pNode)->dbName, AUTH_TYPE_WRITE);
+ SCreateSubTableClause* pClause = (SCreateSubTableClause*)pNode;
+ code = checkAuth(pCxt, pClause->dbName, NULL, AUTH_TYPE_WRITE, NULL);
if (TSDB_CODE_SUCCESS != code) {
break;
}
@@ -120,6 +197,29 @@ static int32_t authCreateMultiTable(SAuthCxt* pCxt, SCreateMultiTablesStmt* pStm
return code;
}
+static int32_t authDropTable(SAuthCxt* pCxt, SDropTableStmt* pStmt) {
+ int32_t code = TSDB_CODE_SUCCESS;
+ SNode* pNode = NULL;
+ FOREACH(pNode, pStmt->pTables) {
+ SDropTableClause* pClause = (SDropTableClause*)pNode;
+ code = checkAuth(pCxt, pClause->dbName, pClause->tableName, AUTH_TYPE_WRITE, NULL);
+ if (TSDB_CODE_SUCCESS != code) {
+ break;
+ }
+ }
+ return code;
+}
+
+static int32_t authDropStable(SAuthCxt* pCxt, SDropSuperTableStmt* pStmt) {
+ return checkAuth(pCxt, pStmt->dbName, pStmt->tableName, AUTH_TYPE_WRITE, NULL);
+}
+
+static int32_t authAlterTable(SAuthCxt* pCxt, SAlterTableStmt* pStmt) {
+ SNode* pTagCond = NULL;
+ // todo check tag condition for subtable
+ return checkAuth(pCxt, pStmt->dbName, pStmt->tableName, AUTH_TYPE_WRITE, NULL);
+}
+
static int32_t authQuery(SAuthCxt* pCxt, SNode* pStmt) {
switch (nodeType(pStmt)) {
case QUERY_NODE_SET_OPERATOR:
@@ -136,6 +236,13 @@ static int32_t authQuery(SAuthCxt* pCxt, SNode* pStmt) {
return authCreateTable(pCxt, (SCreateTableStmt*)pStmt);
case QUERY_NODE_CREATE_MULTI_TABLES_STMT:
return authCreateMultiTable(pCxt, (SCreateMultiTablesStmt*)pStmt);
+ case QUERY_NODE_DROP_TABLE_STMT:
+ return authDropTable(pCxt, (SDropTableStmt*)pStmt);
+ case QUERY_NODE_DROP_SUPER_TABLE_STMT:
+ return authDropStable(pCxt, (SDropSuperTableStmt*)pStmt);
+ case QUERY_NODE_ALTER_TABLE_STMT:
+ case QUERY_NODE_ALTER_SUPER_TABLE_STMT:
+ return authAlterTable(pCxt, (SAlterTableStmt*)pStmt);
case QUERY_NODE_SHOW_DNODES_STMT:
case QUERY_NODE_SHOW_MNODES_STMT:
case QUERY_NODE_SHOW_MODULES_STMT:
@@ -146,7 +253,7 @@ static int32_t authQuery(SAuthCxt* pCxt, SNode* pStmt) {
case QUERY_NODE_SHOW_LICENCES_STMT:
case QUERY_NODE_SHOW_VGROUPS_STMT:
case QUERY_NODE_SHOW_DB_ALIVE_STMT:
- case QUERY_NODE_SHOW_CLUSTER_ALIVE_STMT:
+ case QUERY_NODE_SHOW_CLUSTER_ALIVE_STMT:
case QUERY_NODE_SHOW_CREATE_DATABASE_STMT:
case QUERY_NODE_SHOW_TABLE_DISTRIBUTED_STMT:
case QUERY_NODE_SHOW_VNODES_STMT:
diff --git a/source/libs/parser/src/parInsertSml.c b/source/libs/parser/src/parInsertSml.c
index 0bcd777d2a..1c921b2d7c 100644
--- a/source/libs/parser/src/parInsertSml.c
+++ b/source/libs/parser/src/parInsertSml.c
@@ -125,6 +125,12 @@ static int32_t smlBuildTagRow(SArray* cols, SBoundColInfo* tags, SSchema* pSchem
SSchema* pTagSchema = &pSchema[tags->pColIndex[i]];
SSmlKv* kv = taosArrayGet(cols, i);
+ if(kv->keyLen != strlen(pTagSchema->name) || memcmp(kv->key, pTagSchema->name, kv->keyLen) != 0 || kv->type != pTagSchema->type){
+ code = TSDB_CODE_SML_INVALID_DATA;
+ uError("SML smlBuildCol error col not same %s", pTagSchema->name);
+ goto end;
+ }
+
taosArrayPush(*tagName, pTagSchema->name);
STagVal val = {.cid = pTagSchema->colId, .type = pTagSchema->type};
// strcpy(val.colName, pTagSchema->name);
diff --git a/source/libs/parser/src/parInsertSql.c b/source/libs/parser/src/parInsertSql.c
index 18d65dd477..eb2efd573d 100644
--- a/source/libs/parser/src/parInsertSql.c
+++ b/source/libs/parser/src/parInsertSql.c
@@ -15,6 +15,7 @@
#include "parInsertUtil.h"
#include "parToken.h"
+#include "scalar.h"
#include "tglobal.h"
#include "ttime.h"
@@ -565,6 +566,120 @@ static int32_t checkAndTrimValue(SToken* pToken, char* tmpTokenBuf, SMsgBuf* pMs
return TSDB_CODE_SUCCESS;
}
+typedef struct SRewriteTagCondCxt {
+ SArray* pTagVals;
+ SArray* pTagName;
+ int32_t code;
+} SRewriteTagCondCxt;
+
+static int32_t rewriteTagCondColumnImpl(STagVal* pVal, SNode** pNode) {
+ SValueNode* pValue = (SValueNode*)nodesMakeNode(QUERY_NODE_VALUE);
+ if (NULL == pValue) {
+ return TSDB_CODE_OUT_OF_MEMORY;
+ }
+ pValue->node.resType.type = pVal->type;
+ switch (pVal->type) {
+ case TSDB_DATA_TYPE_BOOL:
+ pValue->datum.b = *(int8_t*)(&pVal->i64);
+ break;
+ case TSDB_DATA_TYPE_TINYINT:
+ pValue->datum.i = *(int8_t*)(&pVal->i64);
+ break;
+ case TSDB_DATA_TYPE_SMALLINT:
+ pValue->datum.i = *(int16_t*)(&pVal->i64);
+ break;
+ case TSDB_DATA_TYPE_INT:
+ pValue->datum.i = *(int32_t*)(&pVal->i64);
+ break;
+ case TSDB_DATA_TYPE_BIGINT:
+ pValue->datum.i = pVal->i64;
+ break;
+ case TSDB_DATA_TYPE_FLOAT:
+ pValue->datum.d = *(float*)(&pVal->i64);
+ break;
+ case TSDB_DATA_TYPE_DOUBLE:
+ pValue->datum.d = *(double*)(&pVal->i64);
+ break;
+ case TSDB_DATA_TYPE_VARCHAR:
+ case TSDB_DATA_TYPE_NCHAR:
+ pValue->datum.p = taosMemoryCalloc(1, pVal->nData + VARSTR_HEADER_SIZE);
+ if (NULL == pValue->datum.p) {
+ return TSDB_CODE_OUT_OF_MEMORY;
+ }
+ varDataSetLen(pValue->datum.p, pVal->nData);
+ memcpy(varDataVal(pValue->datum.p), pVal->pData, pVal->nData);
+ break;
+ case TSDB_DATA_TYPE_TIMESTAMP:
+ pValue->datum.i = pVal->i64;
+ break;
+ case TSDB_DATA_TYPE_UTINYINT:
+ pValue->datum.i = *(uint8_t*)(&pVal->i64);
+ break;
+ case TSDB_DATA_TYPE_USMALLINT:
+ pValue->datum.i = *(uint16_t*)(&pVal->i64);
+ break;
+ case TSDB_DATA_TYPE_UINT:
+ pValue->datum.i = *(uint32_t*)(&pVal->i64);
+ break;
+ case TSDB_DATA_TYPE_UBIGINT:
+ pValue->datum.i = *(uint64_t*)(&pVal->i64);
+ break;
+ case TSDB_DATA_TYPE_JSON:
+ case TSDB_DATA_TYPE_VARBINARY:
+ case TSDB_DATA_TYPE_DECIMAL:
+ case TSDB_DATA_TYPE_BLOB:
+ case TSDB_DATA_TYPE_MEDIUMBLOB:
+ default:
+ return TSDB_CODE_FAILED;
+ }
+ return TSDB_CODE_SUCCESS;
+}
+
+static int32_t rewriteTagCondColumn(SArray* pTagVals, SArray* pTagName, SNode** pNode) {
+ SColumnNode* pCol = (SColumnNode*)*pNode;
+ int32_t ntags = taosArrayGetSize(pTagName);
+ for (int32_t i = 0; i < ntags; ++i) {
+ char* pTagColName = taosArrayGet(pTagName, i);
+ if (0 == strcmp(pTagColName, pCol->colName)) {
+ return rewriteTagCondColumnImpl(taosArrayGet(pTagVals, i), pNode);
+ }
+ }
+ return TSDB_CODE_PAR_PERMISSION_DENIED;
+}
+
+static EDealRes rewriteTagCond(SNode** pNode, void* pContext) {
+ if (QUERY_NODE_COLUMN == nodeType(*pNode)) {
+ SRewriteTagCondCxt* pCxt = pContext;
+ pCxt->code = rewriteTagCondColumn(pCxt->pTagVals, pCxt->pTagName, pNode);
+ return (TSDB_CODE_SUCCESS == pCxt->code ? DEAL_RES_IGNORE_CHILD : DEAL_RES_ERROR);
+ }
+ return DEAL_RES_CONTINUE;
+}
+
+static int32_t setTagVal(SArray* pTagVals, SArray* pTagName, SNode* pCond) {
+ SRewriteTagCondCxt cxt = {.code = TSDB_CODE_SUCCESS, .pTagVals = pTagVals, .pTagName = pTagName};
+ nodesRewriteExpr(&pCond, rewriteTagCond, &cxt);
+ return cxt.code;
+}
+
+static int32_t checkTagCondResult(SNode* pResult) {
+ return (QUERY_NODE_VALUE == nodeType(pResult) && ((SValueNode*)pResult)->datum.b) ? TSDB_CODE_SUCCESS
+ : TSDB_CODE_PAR_PERMISSION_DENIED;
+}
+
+int32_t checkSubtablePrivilege(SArray* pTagVals, SArray* pTagName, SNode* pCond) {
+ int32_t code = setTagVal(pTagVals, pTagName, pCond);
+ SNode* pNew = NULL;
+ if (TSDB_CODE_SUCCESS == code) {
+ code = scalarCalculateConstants(pCond, &pNew);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = checkTagCondResult(pNew);
+ }
+ nodesDestroyNode(pNew);
+ return code;
+}
+
// pSql -> tag1_value, ...)
static int32_t parseTagsClauseImpl(SInsertParseContext* pCxt, SVnodeModifyOpStmt* pStmt) {
int32_t code = TSDB_CODE_SUCCESS;
@@ -722,25 +837,31 @@ static int32_t parseUsingClauseBottom(SInsertParseContext* pCxt, SVnodeModifyOpS
return code;
}
+static void setUserAuthInfo(SParseContext* pCxt, SName* pTbName, SUserAuthInfo* pInfo) {
+ snprintf(pInfo->user, sizeof(pInfo->user), "%s", pCxt->pUser);
+ memcpy(&pInfo->tbName, pTbName, sizeof(SName));
+ pInfo->type = AUTH_TYPE_WRITE;
+}
+
static int32_t checkAuth(SParseContext* pCxt, SName* pTbName, bool* pMissCache) {
- char dbFName[TSDB_DB_FNAME_LEN];
- tNameGetFullDbName(pTbName, dbFName);
- int32_t code = TSDB_CODE_SUCCESS;
- bool pass = true;
- bool exists = true;
+ int32_t code = TSDB_CODE_SUCCESS;
+ SUserAuthInfo authInfo = {0};
+ setUserAuthInfo(pCxt, pTbName, &authInfo);
+ SUserAuthRes authRes = {0};
+ bool exists = true;
if (pCxt->async) {
- code = catalogChkAuthFromCache(pCxt->pCatalog, pCxt->pUser, dbFName, AUTH_TYPE_WRITE, &pass, &exists);
+ code = catalogChkAuthFromCache(pCxt->pCatalog, &authInfo, &authRes, &exists);
} else {
SRequestConnInfo conn = {.pTrans = pCxt->pTransporter,
.requestId = pCxt->requestId,
.requestObjRefId = pCxt->requestRid,
.mgmtEps = pCxt->mgmtEpSet};
- code = catalogChkAuth(pCxt->pCatalog, &conn, pCxt->pUser, dbFName, AUTH_TYPE_WRITE, &pass);
+ code = catalogChkAuth(pCxt->pCatalog, &conn, &authInfo, &authRes);
}
if (TSDB_CODE_SUCCESS == code) {
if (!exists) {
*pMissCache = true;
- } else if (!pass) {
+ } else if (!authRes.pass) {
code = TSDB_CODE_PAR_PERMISSION_DENIED;
}
}
@@ -1906,7 +2027,7 @@ static int32_t buildInsertUserAuthReq(const char* pUser, SName* pName, SArray**
SUserAuthInfo userAuth = {.type = AUTH_TYPE_WRITE};
snprintf(userAuth.user, sizeof(userAuth.user), "%s", pUser);
- tNameGetFullDbName(pName, userAuth.dbFName);
+ memcpy(&userAuth.tbName, pName, sizeof(SName));
taosArrayPush(*pUserAuth, &userAuth);
return TSDB_CODE_SUCCESS;
diff --git a/source/libs/parser/src/parInsertUtil.c b/source/libs/parser/src/parInsertUtil.c
index 132a3b2618..ac504b9809 100644
--- a/source/libs/parser/src/parInsertUtil.c
+++ b/source/libs/parser/src/parInsertUtil.c
@@ -470,11 +470,11 @@ int32_t insMergeTableDataCxt(SHashObj* pTableHash, SArray** pVgDataBlocks) {
if (TSDB_CODE_SUCCESS == code) {
SVgroupDataCxt* pVgCxt = NULL;
int32_t vgId = pTableCxt->pMeta->vgId;
- void** p = taosHashGet(pVgroupHash, &vgId, sizeof(vgId));
- if (NULL == p) {
+ void** pp = taosHashGet(pVgroupHash, &vgId, sizeof(vgId));
+ if (NULL == pp) {
code = createVgroupDataCxt(pTableCxt, pVgroupHash, pVgroupList, &pVgCxt);
} else {
- pVgCxt = *(SVgroupDataCxt**)p;
+ pVgCxt = *(SVgroupDataCxt**)pp;
}
if (TSDB_CODE_SUCCESS == code) {
code = fillVgroupDataCxt(pTableCxt, pVgCxt);
diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c
index 78fc097f6f..8f7a841edf 100644
--- a/source/libs/parser/src/parTranslater.c
+++ b/source/libs/parser/src/parTranslater.c
@@ -645,6 +645,10 @@ static bool isSelectStmt(SNode* pCurrStmt) {
return NULL != pCurrStmt && QUERY_NODE_SELECT_STMT == nodeType(pCurrStmt);
}
+static bool isDeleteStmt(SNode* pCurrStmt) {
+ return NULL != pCurrStmt && QUERY_NODE_DELETE_STMT == nodeType(pCurrStmt);
+}
+
static bool isSetOperator(SNode* pCurrStmt) {
return NULL != pCurrStmt && QUERY_NODE_SET_OPERATOR == nodeType(pCurrStmt);
}
@@ -669,6 +673,9 @@ static uint8_t getPrecisionFromCurrStmt(SNode* pCurrStmt, uint8_t defaultVal) {
if (NULL != pCurrStmt && QUERY_NODE_CREATE_STREAM_STMT == nodeType(pCurrStmt)) {
return getPrecisionFromCurrStmt(((SCreateStreamStmt*)pCurrStmt)->pQuery, defaultVal);
}
+ if (isDeleteStmt(pCurrStmt)) {
+ return ((SDeleteStmt*)pCurrStmt)->precision;
+ }
return defaultVal;
}
@@ -978,7 +985,8 @@ static EDealRes translateColumnUseAlias(STranslateContext* pCxt, SColumnNode** p
}
static EDealRes translateColumn(STranslateContext* pCxt, SColumnNode** pCol) {
- if (NULL == pCxt->pCurrStmt || isSelectStmt(pCxt->pCurrStmt) && NULL == ((SSelectStmt*)pCxt->pCurrStmt)->pFromTable) {
+ if (NULL == pCxt->pCurrStmt ||
+ (isSelectStmt(pCxt->pCurrStmt) && NULL == ((SSelectStmt*)pCxt->pCurrStmt)->pFromTable)) {
return generateDealNodeErrMsg(pCxt, TSDB_CODE_PAR_INVALID_COLUMN, (*pCol)->colName);
}
@@ -1234,6 +1242,10 @@ static int32_t calcTypeBytes(SDataType dt) {
}
static EDealRes translateValue(STranslateContext* pCxt, SValueNode* pVal) {
+ if (pVal->translate) {
+ return TSDB_CODE_SUCCESS;
+ }
+
SDataType dt = pVal->node.resType;
dt.bytes = calcTypeBytes(dt);
return translateValueImpl(pCxt, pVal, dt, false);
@@ -1691,6 +1703,8 @@ static void setFuncClassification(SNode* pCurrStmt, SFunctionNode* pFunc) {
pSelect->hasUniqueFunc = pSelect->hasUniqueFunc ? true : (FUNCTION_TYPE_UNIQUE == pFunc->funcType);
pSelect->hasTailFunc = pSelect->hasTailFunc ? true : (FUNCTION_TYPE_TAIL == pFunc->funcType);
pSelect->hasInterpFunc = pSelect->hasInterpFunc ? true : (FUNCTION_TYPE_INTERP == pFunc->funcType);
+ pSelect->hasInterpPseudoColFunc =
+ pSelect->hasInterpPseudoColFunc ? true : fmIsInterpPseudoColumnFunc(pFunc->funcId);
pSelect->hasLastRowFunc = pSelect->hasLastRowFunc ? true : (FUNCTION_TYPE_LAST_ROW == pFunc->funcType);
pSelect->hasLastFunc = pSelect->hasLastFunc ? true : (FUNCTION_TYPE_LAST == pFunc->funcType);
pSelect->hasTimeLineFunc = pSelect->hasTimeLineFunc ? true : fmIsTimelineFunc(pFunc->funcId);
@@ -3369,6 +3383,10 @@ static int32_t translateInterp(STranslateContext* pCxt, SSelectStmt* pSelect) {
if (NULL != pSelect->pRange || NULL != pSelect->pEvery || NULL != pSelect->pFill) {
return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_INTERP_CLAUSE);
}
+ if (pSelect->hasInterpPseudoColFunc) {
+ return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_NOT_ALLOWED_FUNC,
+ "Has Interp pseudo column(s) but missing interp function");
+ }
return TSDB_CODE_SUCCESS;
}
@@ -3736,6 +3754,7 @@ static int32_t translateDelete(STranslateContext* pCxt, SDeleteStmt* pDelete) {
pCxt->pCurrStmt = (SNode*)pDelete;
int32_t code = translateFrom(pCxt, pDelete->pFromTable);
if (TSDB_CODE_SUCCESS == code) {
+ pDelete->precision = ((STableNode*)pDelete->pFromTable)->precision;
code = translateDeleteWhere(pCxt, pDelete);
}
pCxt->currClause = SQL_CLAUSE_SELECT;
@@ -6485,22 +6504,69 @@ static int32_t translateDropFunction(STranslateContext* pCxt, SDropFunctionStmt*
return buildCmdMsg(pCxt, TDMT_MND_DROP_FUNC, (FSerializeFunc)tSerializeSDropFuncReq, &req);
}
+static int32_t createRealTableForGrantTable(SGrantStmt* pStmt, SRealTableNode** pTable) {
+ SRealTableNode* pRealTable = (SRealTableNode*)nodesMakeNode(QUERY_NODE_REAL_TABLE);
+ if (NULL == pRealTable) {
+ return TSDB_CODE_OUT_OF_MEMORY;
+ }
+ strcpy(pRealTable->table.dbName, pStmt->objName);
+ strcpy(pRealTable->table.tableName, pStmt->tabName);
+ strcpy(pRealTable->table.tableAlias, pStmt->tabName);
+ *pTable = pRealTable;
+ return TSDB_CODE_SUCCESS;
+}
+
+static int32_t translateGrantTagCond(STranslateContext* pCxt, SGrantStmt* pStmt, SAlterUserReq* pReq) {
+ if (NULL == pStmt->pTagCond) {
+ return TSDB_CODE_SUCCESS;
+ }
+ if ('\0' == pStmt->tabName[0] || '*' == pStmt->tabName[0]) {
+ return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_SYNTAX_ERROR,
+ "The With clause can only be used for table level privilege");
+ }
+
+ pCxt->pCurrStmt = (SNode*)pStmt;
+ SRealTableNode* pTable = NULL;
+ int32_t code = createRealTableForGrantTable(pStmt, &pTable);
+ if (TSDB_CODE_SUCCESS == code) {
+ SName name;
+ code = getTableMetaImpl(pCxt, toName(pCxt->pParseCxt->acctId, pTable->table.dbName, pTable->table.tableName, &name),
+ &(pTable->pMeta));
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = addNamespace(pCxt, pTable);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = translateExpr(pCxt, &pStmt->pTagCond);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = nodesNodeToString(pStmt->pTagCond, false, &pReq->tagCond, &pReq->tagCondLen);
+ }
+ nodesDestroyNode((SNode*)pTable);
+ return code;
+}
+
static int32_t translateGrant(STranslateContext* pCxt, SGrantStmt* pStmt) {
SAlterUserReq req = {0};
if (BIT_FLAG_TEST_MASK(pStmt->privileges, PRIVILEGE_TYPE_ALL) ||
(BIT_FLAG_TEST_MASK(pStmt->privileges, PRIVILEGE_TYPE_READ) &&
BIT_FLAG_TEST_MASK(pStmt->privileges, PRIVILEGE_TYPE_WRITE))) {
- req.alterType = TSDB_ALTER_USER_ADD_ALL_DB;
+ req.alterType = ('\0' == pStmt->tabName[0] ? TSDB_ALTER_USER_ADD_ALL_DB : TSDB_ALTER_USER_ADD_ALL_TABLE);
} else if (BIT_FLAG_TEST_MASK(pStmt->privileges, PRIVILEGE_TYPE_READ)) {
- req.alterType = TSDB_ALTER_USER_ADD_READ_DB;
+ req.alterType = ('\0' == pStmt->tabName[0] ? TSDB_ALTER_USER_ADD_READ_DB : TSDB_ALTER_USER_ADD_READ_TABLE);
} else if (BIT_FLAG_TEST_MASK(pStmt->privileges, PRIVILEGE_TYPE_WRITE)) {
- req.alterType = TSDB_ALTER_USER_ADD_WRITE_DB;
+ req.alterType = ('\0' == pStmt->tabName[0] ? TSDB_ALTER_USER_ADD_WRITE_DB : TSDB_ALTER_USER_ADD_WRITE_TABLE);
} else if (BIT_FLAG_TEST_MASK(pStmt->privileges, PRIVILEGE_TYPE_SUBSCRIBE)) {
req.alterType = TSDB_ALTER_USER_ADD_SUBSCRIBE_TOPIC;
}
strcpy(req.user, pStmt->userName);
sprintf(req.objname, "%d.%s", pCxt->pParseCxt->acctId, pStmt->objName);
- return buildCmdMsg(pCxt, TDMT_MND_ALTER_USER, (FSerializeFunc)tSerializeSAlterUserReq, &req);
+ sprintf(req.tabName, "%s", pStmt->tabName);
+ int32_t code = translateGrantTagCond(pCxt, pStmt, &req);
+ if (TSDB_CODE_SUCCESS == code) {
+ code = buildCmdMsg(pCxt, TDMT_MND_ALTER_USER, (FSerializeFunc)tSerializeSAlterUserReq, &req);
+ }
+ return code;
}
static int32_t translateRevoke(STranslateContext* pCxt, SRevokeStmt* pStmt) {
@@ -6508,16 +6574,17 @@ static int32_t translateRevoke(STranslateContext* pCxt, SRevokeStmt* pStmt) {
if (BIT_FLAG_TEST_MASK(pStmt->privileges, PRIVILEGE_TYPE_ALL) ||
(BIT_FLAG_TEST_MASK(pStmt->privileges, PRIVILEGE_TYPE_READ) &&
BIT_FLAG_TEST_MASK(pStmt->privileges, PRIVILEGE_TYPE_WRITE))) {
- req.alterType = TSDB_ALTER_USER_REMOVE_ALL_DB;
+ req.alterType = ('\0' == pStmt->tabName[0] ? TSDB_ALTER_USER_REMOVE_ALL_DB : TSDB_ALTER_USER_REMOVE_ALL_TABLE);
} else if (BIT_FLAG_TEST_MASK(pStmt->privileges, PRIVILEGE_TYPE_READ)) {
- req.alterType = TSDB_ALTER_USER_REMOVE_READ_DB;
+ req.alterType = ('\0' == pStmt->tabName[0] ? TSDB_ALTER_USER_REMOVE_READ_DB : TSDB_ALTER_USER_REMOVE_READ_TABLE);
} else if (BIT_FLAG_TEST_MASK(pStmt->privileges, PRIVILEGE_TYPE_WRITE)) {
- req.alterType = TSDB_ALTER_USER_REMOVE_WRITE_DB;
+ req.alterType = ('\0' == pStmt->tabName[0] ? TSDB_ALTER_USER_REMOVE_WRITE_DB : TSDB_ALTER_USER_REMOVE_WRITE_TABLE);
} else if (BIT_FLAG_TEST_MASK(pStmt->privileges, PRIVILEGE_TYPE_SUBSCRIBE)) {
req.alterType = TSDB_ALTER_USER_REMOVE_SUBSCRIBE_TOPIC;
}
strcpy(req.user, pStmt->userName);
sprintf(req.objname, "%d.%s", pCxt->pParseCxt->acctId, pStmt->objName);
+ sprintf(req.tabName, "%s", pStmt->tabName);
return buildCmdMsg(pCxt, TDMT_MND_ALTER_USER, (FSerializeFunc)tSerializeSAlterUserReq, &req);
}
diff --git a/source/libs/parser/src/parUtil.c b/source/libs/parser/src/parUtil.c
index 563bc5e780..14da6f8aab 100644
--- a/source/libs/parser/src/parUtil.c
+++ b/source/libs/parser/src/parUtil.c
@@ -17,7 +17,7 @@
#include "cJSON.h"
#include "querynodes.h"
-#define USER_AUTH_KEY_MAX_LEN TSDB_USER_LEN + TSDB_DB_FNAME_LEN + 2
+#define USER_AUTH_KEY_MAX_LEN TSDB_USER_LEN + TSDB_TABLE_FNAME_LEN + 2
const void* nullPointer = NULL;
@@ -496,24 +496,44 @@ int32_t getVnodeSysTableTargetName(int32_t acctId, SNode* pWhere, SName* pName)
return TSDB_CODE_SUCCESS;
}
-static int32_t userAuthToString(int32_t acctId, const char* pUser, const char* pDb, AUTH_TYPE type, char* pStr) {
- return sprintf(pStr, "%s*%d.%s*%d", pUser, acctId, pDb, type);
+static int32_t userAuthToString(int32_t acctId, const char* pUser, const char* pDb, const char* pTable, AUTH_TYPE type,
+ char* pStr) {
+ return sprintf(pStr, "%s*%d*%s*%s*%d", pUser, acctId, pDb, (NULL != pTable && '\0' == pTable[0]) ? NULL : pTable,
+ type);
}
-static int32_t userAuthToStringExt(const char* pUser, const char* pDbFName, AUTH_TYPE type, char* pStr) {
- return sprintf(pStr, "%s*%s*%d", pUser, pDbFName, type);
+static int32_t getIntegerFromAuthStr(const char* pStart, char** pNext) {
+ char* p = strchr(pStart, '*');
+ char buf[10] = {0};
+ if (NULL == p) {
+ strcpy(buf, pStart);
+ *pNext = NULL;
+ } else {
+ strncpy(buf, pStart, p - pStart);
+ *pNext = ++p;
+ }
+ return taosStr2Int32(buf, NULL, 10);
+}
+
+static void getStringFromAuthStr(const char* pStart, char* pStr, char** pNext) {
+ char* p = strchr(pStart, '*');
+ if (NULL == p) {
+ strcpy(pStr, pStart);
+ *pNext = NULL;
+ } else {
+ strncpy(pStr, pStart, p - pStart);
+ *pNext = ++p;
+ }
}
static void stringToUserAuth(const char* pStr, int32_t len, SUserAuthInfo* pUserAuth) {
- char* p1 = strchr(pStr, '*');
- strncpy(pUserAuth->user, pStr, p1 - pStr);
- ++p1;
- char* p2 = strchr(p1, '*');
- strncpy(pUserAuth->dbFName, p1, p2 - p1);
- ++p2;
- char buf[10] = {0};
- strncpy(buf, p2, len - (p2 - pStr));
- pUserAuth->type = taosStr2Int32(buf, NULL, 10);
+ char* p = NULL;
+ getStringFromAuthStr(pStr, pUserAuth->user, &p);
+ pUserAuth->tbName.acctId = getIntegerFromAuthStr(p, &p);
+ getStringFromAuthStr(p, pUserAuth->tbName.dbname, &p);
+ getStringFromAuthStr(p, pUserAuth->tbName.tname, &p);
+ pUserAuth->tbName.type = TSDB_TABLE_NAME_T;
+ pUserAuth->type = getIntegerFromAuthStr(p, &p);
}
static int32_t buildTableReq(SHashObj* pTablesHash, SArray** pTables) {
@@ -584,10 +604,12 @@ static int32_t buildUserAuthReq(SHashObj* pUserAuthHash, SArray** pUserAuth) {
}
void* p = taosHashIterate(pUserAuthHash, NULL);
while (NULL != p) {
- size_t len = 0;
- char* pKey = taosHashGetKey(p, &len);
+ size_t len = 0;
+ char* pKey = taosHashGetKey(p, &len);
+ char key[USER_AUTH_KEY_MAX_LEN] = {0};
+ strncpy(key, pKey, len);
SUserAuthInfo userAuth = {0};
- stringToUserAuth(pKey, len, &userAuth);
+ stringToUserAuth(key, len, &userAuth);
taosArrayPush(*pUserAuth, &userAuth);
p = taosHashIterate(pUserAuthHash, p);
}
@@ -712,7 +734,8 @@ static int32_t putUserAuthToCache(const SArray* pUserAuthReq, const SArray* pUse
for (int32_t i = 0; i < nvgs; ++i) {
SUserAuthInfo* pUser = taosArrayGet(pUserAuthReq, i);
char key[USER_AUTH_KEY_MAX_LEN] = {0};
- int32_t len = userAuthToStringExt(pUser->user, pUser->dbFName, pUser->type, key);
+ int32_t len = userAuthToString(pUser->tbName.acctId, pUser->user, pUser->tbName.dbname, pUser->tbName.tname,
+ pUser->type, key);
if (TSDB_CODE_SUCCESS != putMetaDataToHash(key, len, pUserAuthData, i, pUserAuth)) {
return TSDB_CODE_OUT_OF_MEMORY;
}
@@ -910,33 +933,24 @@ static int32_t reserveUserAuthInCacheImpl(const char* pKey, int32_t len, SParseM
return TSDB_CODE_OUT_OF_MEMORY;
}
}
- bool pass = false;
- return taosHashPut(pMetaCache->pUserAuth, pKey, len, &pass, sizeof(pass));
+ return taosHashPut(pMetaCache->pUserAuth, pKey, len, &nullPointer, POINTER_BYTES);
}
-int32_t reserveUserAuthInCache(int32_t acctId, const char* pUser, const char* pDb, AUTH_TYPE type,
+int32_t reserveUserAuthInCache(int32_t acctId, const char* pUser, const char* pDb, const char* pTable, AUTH_TYPE type,
SParseMetaCache* pMetaCache) {
char key[USER_AUTH_KEY_MAX_LEN] = {0};
- int32_t len = userAuthToString(acctId, pUser, pDb, type, key);
+ int32_t len = userAuthToString(acctId, pUser, pDb, pTable, type, key);
return reserveUserAuthInCacheImpl(key, len, pMetaCache);
}
-int32_t reserveUserAuthInCacheExt(const char* pUser, const SName* pName, AUTH_TYPE type, SParseMetaCache* pMetaCache) {
- char dbFName[TSDB_DB_FNAME_LEN] = {0};
- tNameGetFullDbName(pName, dbFName);
- char key[USER_AUTH_KEY_MAX_LEN] = {0};
- int32_t len = userAuthToStringExt(pUser, dbFName, type, key);
- return reserveUserAuthInCacheImpl(key, len, pMetaCache);
-}
-
-int32_t getUserAuthFromCache(SParseMetaCache* pMetaCache, const char* pUser, const char* pDbFName, AUTH_TYPE type,
- bool* pPass) {
- char key[USER_AUTH_KEY_MAX_LEN] = {0};
- int32_t len = userAuthToStringExt(pUser, pDbFName, type, key);
- bool* pRes = NULL;
- int32_t code = getMetaDataFromHash(key, len, pMetaCache->pUserAuth, (void**)&pRes);
+int32_t getUserAuthFromCache(SParseMetaCache* pMetaCache, SUserAuthInfo* pAuthReq, SUserAuthRes* pAuthRes) {
+ char key[USER_AUTH_KEY_MAX_LEN] = {0};
+ int32_t len = userAuthToString(pAuthReq->tbName.acctId, pAuthReq->user, pAuthReq->tbName.dbname,
+ pAuthReq->tbName.tname, pAuthReq->type, key);
+ SUserAuthRes* pAuth = NULL;
+ int32_t code = getMetaDataFromHash(key, len, pMetaCache->pUserAuth, (void**)&pAuth);
if (TSDB_CODE_SUCCESS == code) {
- *pPass = *pRes;
+ memcpy(pAuthRes, pAuth, sizeof(SUserAuthRes));
}
return code;
}
diff --git a/source/libs/parser/src/sql.c b/source/libs/parser/src/sql.c
index b1437bbb6b..9ad5bcf644 100644
--- a/source/libs/parser/src/sql.c
+++ b/source/libs/parser/src/sql.c
@@ -104,26 +104,27 @@
#endif
/************* Begin control #defines *****************************************/
#define YYCODETYPE unsigned short int
-#define YYNOCODE 475
+#define YYNOCODE 476
#define YYACTIONTYPE unsigned short int
#define ParseTOKENTYPE SToken
typedef union {
int yyinit;
ParseTOKENTYPE yy0;
- EOrder yy88;
- EFillMode yy94;
- SToken yy129;
- SDataType yy184;
- SNodeList* yy274;
- int32_t yy310;
- bool yy337;
- int8_t yy353;
- int64_t yy359;
- EOperatorType yy440;
- SAlterOption yy595;
- SNode* yy712;
- ENullOrder yy907;
- EJoinType yy912;
+ EFillMode yy46;
+ SAlterOption yy53;
+ SToken yy113;
+ EOperatorType yy156;
+ bool yy369;
+ SNodeList* yy432;
+ SNode* yy448;
+ int8_t yy551;
+ ENullOrder yy585;
+ EJoinType yy596;
+ EOrder yy666;
+ SDataType yy728;
+ STokenPair yy777;
+ int32_t yy788;
+ int64_t yy837;
} YYMINORTYPE;
#ifndef YYSTACKDEPTH
#define YYSTACKDEPTH 100
@@ -139,17 +140,17 @@ typedef union {
#define ParseCTX_FETCH
#define ParseCTX_STORE
#define YYFALLBACK 1
-#define YYNSTATE 761
-#define YYNRULE 581
+#define YYNSTATE 762
+#define YYNRULE 583
#define YYNTOKEN 330
-#define YY_MAX_SHIFT 760
-#define YY_MIN_SHIFTREDUCE 1133
-#define YY_MAX_SHIFTREDUCE 1713
-#define YY_ERROR_ACTION 1714
-#define YY_ACCEPT_ACTION 1715
-#define YY_NO_ACTION 1716
-#define YY_MIN_REDUCE 1717
-#define YY_MAX_REDUCE 2297
+#define YY_MAX_SHIFT 761
+#define YY_MIN_SHIFTREDUCE 1136
+#define YY_MAX_SHIFTREDUCE 1718
+#define YY_ERROR_ACTION 1719
+#define YY_ACCEPT_ACTION 1720
+#define YY_NO_ACTION 1721
+#define YY_MIN_REDUCE 1722
+#define YY_MAX_REDUCE 2304
/************* End control #defines *******************************************/
#define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0])))
@@ -216,827 +217,790 @@ typedef union {
** yy_default[] Default action for each state.
**
*********** Begin parsing tables **********************************************/
-#define YY_ACTTAB_COUNT (3096)
+#define YY_ACTTAB_COUNT (2905)
static const YYACTIONTYPE yy_action[] = {
- /* 0 */ 1873, 2109, 2003, 428, 1875, 1869, 631, 427, 2096, 167,
- /* 10 */ 650, 1729, 45, 43, 1641, 2091, 176, 2001, 637, 2091,
- /* 20 */ 389, 613, 1490, 38, 37, 2268, 187, 44, 42, 41,
- /* 30 */ 40, 39, 1937, 1571, 2127, 1488, 1783, 354, 1986, 367,
- /* 40 */ 612, 182, 664, 1884, 106, 2269, 614, 2077, 1935, 666,
- /* 50 */ 588, 2087, 2093, 588, 2268, 2087, 2093, 2268, 1566, 1517,
- /* 60 */ 140, 2273, 660, 178, 18, 2268, 660, 2003, 1876, 2274,
- /* 70 */ 182, 1496, 2274, 182, 2269, 614, 1924, 2269, 614, 380,
- /* 80 */ 2108, 2272, 2000, 637, 2144, 2269, 2271, 328, 2110, 670,
- /* 90 */ 2112, 2113, 665, 663, 660, 651, 2162, 757, 1258, 649,
- /* 100 */ 14, 501, 734, 733, 732, 731, 399, 497, 730, 729,
- /* 110 */ 143, 724, 723, 722, 721, 720, 719, 718, 156, 714,
- /* 120 */ 713, 712, 398, 397, 709, 708, 707, 706, 705, 1515,
- /* 130 */ 495, 1315, 496, 1753, 1260, 122, 1573, 1574, 121, 120,
- /* 140 */ 119, 118, 117, 116, 115, 114, 113, 1306, 692, 691,
- /* 150 */ 690, 1310, 689, 1312, 1313, 688, 685, 649, 1321, 682,
- /* 160 */ 1323, 1324, 679, 676, 650, 61, 1546, 1556, 2273, 649,
- /* 170 */ 38, 37, 1572, 1575, 44, 42, 41, 40, 39, 48,
- /* 180 */ 132, 504, 1937, 496, 1753, 1517, 1491, 534, 1489, 352,
- /* 190 */ 1515, 35, 292, 1710, 635, 38, 37, 1884, 1935, 44,
- /* 200 */ 42, 41, 40, 39, 238, 38, 37, 273, 237, 44,
- /* 210 */ 42, 41, 40, 39, 2109, 1494, 1495, 1518, 1545, 1548,
- /* 220 */ 1549, 1550, 1551, 1552, 1553, 1554, 1555, 662, 658, 1564,
- /* 230 */ 1565, 1567, 1568, 1569, 1570, 2, 45, 43, 166, 513,
- /* 240 */ 636, 337, 625, 1513, 389, 1825, 1490, 2127, 1740, 48,
- /* 250 */ 465, 346, 1739, 479, 625, 628, 478, 1571, 2044, 1488,
- /* 260 */ 2077, 613, 666, 1680, 2070, 2268, 1703, 49, 89, 341,
- /* 270 */ 61, 448, 366, 480, 568, 139, 450, 1516, 434, 2095,
- /* 280 */ 612, 182, 1566, 13, 12, 2269, 614, 139, 18, 511,
- /* 290 */ 2091, 1996, 1709, 2108, 2077, 1496, 1600, 2144, 2077, 608,
- /* 300 */ 109, 2110, 670, 2112, 2113, 665, 240, 660, 1185, 274,
- /* 310 */ 1184, 588, 179, 86, 2197, 2268, 2109, 185, 383, 2193,
- /* 320 */ 334, 757, 355, 222, 14, 86, 2087, 2093, 370, 356,
- /* 330 */ 2274, 182, 184, 273, 438, 2269, 614, 660, 1879, 1186,
- /* 340 */ 2223, 627, 180, 2205, 2206, 1862, 137, 2210, 1516, 2127,
- /* 350 */ 1880, 61, 1601, 92, 181, 2205, 2206, 667, 137, 2210,
- /* 360 */ 1573, 1574, 2077, 476, 666, 251, 470, 469, 468, 467,
- /* 370 */ 464, 463, 462, 461, 460, 456, 455, 454, 453, 336,
- /* 380 */ 445, 444, 443, 1614, 440, 439, 353, 1931, 1932, 147,
- /* 390 */ 1546, 1556, 1738, 1349, 1350, 2108, 1572, 1575, 566, 2144,
- /* 400 */ 392, 185, 109, 2110, 670, 2112, 2113, 665, 161, 660,
- /* 410 */ 1491, 564, 1489, 562, 2172, 368, 2197, 1886, 603, 185,
- /* 420 */ 383, 2193, 185, 652, 1935, 2169, 34, 387, 1595, 1596,
- /* 430 */ 1597, 1598, 1599, 1603, 1604, 1605, 1606, 625, 2077, 1494,
- /* 440 */ 1495, 704, 1545, 1548, 1549, 1550, 1551, 1552, 1553, 1554,
- /* 450 */ 1555, 662, 658, 1564, 1565, 1567, 1568, 1569, 1570, 2,
- /* 460 */ 11, 45, 43, 394, 1421, 1422, 1930, 1932, 1514, 389,
- /* 470 */ 139, 1490, 552, 551, 550, 1669, 548, 547, 1982, 542,
- /* 480 */ 136, 546, 1571, 239, 1488, 545, 1737, 223, 2109, 190,
- /* 490 */ 544, 549, 362, 361, 494, 1515, 543, 499, 1759, 1967,
- /* 500 */ 1420, 1423, 171, 185, 609, 604, 597, 1566, 530, 526,
- /* 510 */ 522, 518, 220, 18, 44, 42, 41, 40, 39, 650,
- /* 520 */ 1496, 2127, 600, 599, 1667, 1668, 1670, 1671, 1672, 667,
- /* 530 */ 100, 636, 2077, 65, 2077, 54, 666, 271, 2205, 624,
- /* 540 */ 503, 133, 623, 499, 1759, 2268, 757, 61, 1937, 14,
- /* 550 */ 1463, 1464, 1884, 87, 1877, 377, 218, 1645, 728, 726,
- /* 560 */ 612, 182, 2127, 1515, 1935, 2269, 614, 2108, 165, 1718,
- /* 570 */ 607, 2144, 1786, 312, 169, 2110, 670, 2112, 2113, 665,
- /* 580 */ 634, 660, 1996, 2272, 702, 1573, 1574, 310, 72, 421,
- /* 590 */ 122, 71, 1861, 121, 120, 119, 118, 117, 116, 115,
- /* 600 */ 114, 113, 154, 153, 699, 698, 697, 151, 575, 205,
- /* 610 */ 491, 489, 486, 423, 419, 1546, 1556, 606, 41, 40,
- /* 620 */ 39, 1572, 1575, 217, 211, 11, 615, 2289, 216, 61,
- /* 630 */ 509, 538, 426, 176, 425, 1491, 381, 1489, 552, 551,
- /* 640 */ 550, 1404, 1405, 636, 164, 542, 136, 546, 209, 2095,
- /* 650 */ 61, 545, 537, 1886, 452, 1987, 544, 549, 362, 361,
- /* 660 */ 2091, 424, 543, 451, 1494, 1495, 1496, 1545, 1548, 1549,
- /* 670 */ 1550, 1551, 1552, 1553, 1554, 1555, 662, 658, 1564, 1565,
- /* 680 */ 1567, 1568, 1569, 1570, 2, 45, 43, 1576, 108, 1717,
- /* 690 */ 1736, 1735, 645, 389, 1996, 1490, 2087, 2093, 371, 185,
- /* 700 */ 11, 2109, 9, 1715, 702, 1871, 1571, 660, 1488, 1547,
- /* 710 */ 1185, 1166, 1184, 131, 130, 129, 128, 127, 126, 125,
- /* 720 */ 124, 123, 154, 153, 699, 698, 697, 151, 80, 79,
- /* 730 */ 431, 1566, 650, 189, 2127, 650, 2077, 2077, 1171, 1172,
- /* 740 */ 1734, 1186, 667, 650, 1496, 695, 472, 2077, 132, 666,
- /* 750 */ 1168, 432, 1171, 1172, 335, 539, 1269, 417, 716, 433,
- /* 760 */ 415, 411, 407, 404, 424, 1884, 2095, 1937, 1884, 1268,
- /* 770 */ 757, 402, 1490, 46, 382, 401, 1884, 2091, 1860, 2109,
- /* 780 */ 2108, 185, 2098, 1935, 2144, 1488, 2077, 109, 2110, 670,
- /* 790 */ 2112, 2113, 665, 654, 660, 2169, 1867, 142, 1581, 149,
- /* 800 */ 2168, 2197, 185, 650, 1515, 383, 2193, 198, 197, 1573,
- /* 810 */ 1574, 625, 2127, 2087, 2093, 384, 1937, 164, 588, 442,
- /* 820 */ 667, 1496, 2268, 393, 660, 2077, 1887, 666, 283, 284,
- /* 830 */ 471, 481, 1935, 282, 194, 2100, 1884, 2274, 182, 1546,
- /* 840 */ 1556, 704, 2269, 614, 139, 1572, 1575, 757, 650, 38,
- /* 850 */ 37, 1518, 616, 44, 42, 41, 40, 39, 2108, 1491,
- /* 860 */ 1273, 1489, 2144, 392, 457, 109, 2110, 670, 2112, 2113,
- /* 870 */ 665, 164, 660, 1272, 1733, 83, 1515, 2170, 82, 2197,
- /* 880 */ 1886, 1884, 1732, 383, 2193, 27, 2071, 1602, 1494, 1495,
- /* 890 */ 1638, 1545, 1548, 1549, 1550, 1551, 1552, 1553, 1554, 1555,
- /* 900 */ 662, 658, 1564, 1565, 1567, 1568, 1569, 1570, 2, 45,
- /* 910 */ 43, 183, 2205, 2206, 395, 137, 2210, 389, 650, 1490,
- /* 920 */ 2077, 2109, 164, 248, 2217, 1634, 650, 1731, 2077, 73,
- /* 930 */ 1571, 1886, 1488, 588, 458, 483, 1491, 2268, 1489, 38,
- /* 940 */ 37, 557, 512, 44, 42, 41, 40, 39, 2212, 694,
- /* 950 */ 1547, 1884, 2274, 182, 2127, 1566, 567, 2269, 614, 1884,
- /* 960 */ 1728, 32, 628, 2212, 2060, 1494, 1495, 2077, 1496, 666,
- /* 970 */ 236, 1607, 1727, 2077, 2209, 38, 37, 1982, 81, 44,
- /* 980 */ 42, 41, 40, 39, 717, 560, 1846, 650, 192, 2208,
- /* 990 */ 554, 1726, 8, 152, 757, 235, 1725, 46, 1724, 191,
- /* 1000 */ 2108, 1518, 1723, 1881, 2144, 2109, 2077, 109, 2110, 670,
- /* 1010 */ 2112, 2113, 665, 1722, 660, 1721, 1720, 31, 2077, 179,
- /* 1020 */ 1884, 2197, 1547, 38, 37, 383, 2193, 44, 42, 41,
- /* 1030 */ 40, 39, 1657, 1573, 1574, 1859, 69, 2077, 2127, 68,
- /* 1040 */ 141, 650, 2077, 2168, 2077, 1982, 667, 2224, 2077, 650,
- /* 1050 */ 53, 2077, 1937, 666, 435, 2212, 196, 241, 51, 2077,
- /* 1060 */ 3, 2077, 2077, 1546, 1556, 584, 33, 436, 1936, 1572,
- /* 1070 */ 1575, 650, 38, 37, 1884, 617, 44, 42, 41, 40,
- /* 1080 */ 39, 2207, 1884, 1491, 2108, 1489, 696, 629, 2144, 1928,
- /* 1090 */ 2063, 109, 2110, 670, 2112, 2113, 665, 700, 660, 701,
- /* 1100 */ 1928, 620, 1928, 653, 1884, 2197, 152, 2109, 306, 383,
- /* 1110 */ 2193, 1914, 1494, 1495, 540, 1545, 1548, 1549, 1550, 1551,
- /* 1120 */ 1552, 1553, 1554, 1555, 662, 658, 1564, 1565, 1567, 1568,
- /* 1130 */ 1569, 1570, 2, 45, 43, 163, 1256, 587, 409, 1637,
- /* 1140 */ 2127, 389, 650, 1490, 570, 650, 569, 702, 667, 250,
- /* 1150 */ 145, 152, 134, 2077, 1571, 666, 1488, 228, 633, 573,
- /* 1160 */ 226, 287, 245, 1458, 661, 154, 153, 699, 698, 697,
- /* 1170 */ 151, 230, 359, 416, 229, 1884, 38, 37, 1884, 1566,
- /* 1180 */ 44, 42, 41, 40, 39, 232, 2108, 650, 231, 249,
- /* 1190 */ 2144, 63, 1496, 109, 2110, 670, 2112, 2113, 665, 650,
- /* 1200 */ 660, 650, 1826, 647, 1634, 2288, 588, 2197, 1461, 52,
- /* 1210 */ 2268, 383, 2193, 2109, 1499, 648, 63, 293, 757, 650,
- /* 1220 */ 1884, 14, 2231, 1773, 234, 2274, 182, 233, 1766, 255,
- /* 1230 */ 2269, 614, 1884, 90, 1884, 396, 2109, 1498, 360, 105,
- /* 1240 */ 358, 357, 1764, 536, 541, 553, 2127, 538, 1666, 102,
- /* 1250 */ 555, 2273, 1884, 152, 667, 2268, 1730, 1573, 1574, 2077,
- /* 1260 */ 2237, 666, 1712, 1713, 558, 268, 1254, 710, 537, 2127,
- /* 1270 */ 601, 2272, 657, 1665, 47, 2269, 2270, 667, 280, 13,
- /* 1280 */ 12, 70, 2077, 221, 666, 262, 257, 1546, 1556, 1234,
- /* 1290 */ 2128, 400, 2108, 1572, 1575, 1991, 2144, 1754, 1215, 110,
- /* 1300 */ 2110, 670, 2112, 2113, 665, 618, 660, 1491, 150, 1489,
- /* 1310 */ 632, 152, 1925, 2197, 63, 2108, 47, 2196, 2193, 2144,
- /* 1320 */ 47, 674, 168, 2110, 670, 2112, 2113, 665, 2109, 660,
- /* 1330 */ 2227, 1418, 150, 621, 1216, 285, 1494, 1495, 642, 1545,
- /* 1340 */ 1548, 1549, 1550, 1551, 1552, 1553, 1554, 1555, 662, 658,
- /* 1350 */ 1564, 1565, 1567, 1568, 1569, 1570, 2, 711, 626, 270,
- /* 1360 */ 267, 2127, 1, 589, 2234, 289, 4, 1502, 1299, 667,
- /* 1370 */ 152, 1608, 135, 1557, 2077, 403, 666, 305, 1327, 1232,
- /* 1380 */ 150, 1760, 408, 350, 1441, 300, 437, 195, 1518, 1331,
- /* 1390 */ 1501, 1992, 441, 446, 474, 459, 1513, 1984, 2109, 466,
- /* 1400 */ 484, 473, 475, 485, 482, 199, 487, 2108, 488, 200,
- /* 1410 */ 202, 2144, 490, 492, 109, 2110, 670, 2112, 2113, 665,
- /* 1420 */ 1519, 660, 493, 1592, 502, 1521, 2288, 1338, 2197, 1336,
- /* 1430 */ 752, 2127, 383, 2193, 505, 208, 1516, 155, 210, 667,
- /* 1440 */ 1520, 506, 507, 2244, 2077, 1522, 666, 508, 510, 2109,
- /* 1450 */ 213, 215, 84, 1188, 514, 531, 85, 219, 532, 533,
- /* 1460 */ 535, 1874, 225, 1870, 227, 157, 111, 340, 158, 572,
- /* 1470 */ 88, 2053, 2050, 578, 574, 148, 579, 2108, 242, 244,
- /* 1480 */ 301, 2144, 2127, 1872, 109, 2110, 670, 2112, 2113, 665,
- /* 1490 */ 667, 660, 577, 1868, 159, 2077, 2288, 666, 2197, 386,
- /* 1500 */ 385, 2049, 383, 2193, 160, 246, 1448, 585, 2228, 1504,
- /* 1510 */ 582, 602, 2238, 595, 7, 592, 2243, 640, 611, 583,
- /* 1520 */ 1571, 598, 1497, 372, 2109, 605, 593, 373, 2108, 591,
- /* 1530 */ 2242, 253, 2144, 261, 256, 109, 2110, 670, 2112, 2113,
- /* 1540 */ 665, 2219, 660, 622, 590, 1566, 2267, 2288, 619, 2197,
- /* 1550 */ 1634, 2291, 269, 383, 2193, 138, 1517, 2127, 1496, 266,
- /* 1560 */ 630, 2213, 376, 275, 2262, 667, 95, 1523, 1997, 302,
- /* 1570 */ 2077, 638, 666, 172, 639, 2011, 2010, 2009, 303, 643,
- /* 1580 */ 379, 644, 60, 264, 656, 97, 304, 1885, 263, 99,
- /* 1590 */ 2178, 1929, 101, 265, 1847, 672, 296, 307, 753, 342,
- /* 1600 */ 50, 754, 331, 2108, 756, 343, 316, 2144, 330, 576,
- /* 1610 */ 109, 2110, 670, 2112, 2113, 665, 311, 660, 320, 309,
- /* 1620 */ 2069, 2068, 2288, 2067, 2197, 77, 2064, 760, 383, 2193,
- /* 1630 */ 405, 406, 1481, 1482, 188, 410, 2062, 412, 413, 2216,
- /* 1640 */ 414, 299, 2061, 2109, 351, 2059, 418, 2058, 2057, 420,
- /* 1650 */ 422, 78, 1444, 1443, 2023, 2022, 175, 2021, 429, 430,
- /* 1660 */ 2020, 2019, 750, 746, 742, 738, 297, 1975, 1974, 1395,
- /* 1670 */ 1972, 144, 1971, 1505, 1970, 1500, 2127, 193, 447, 1963,
- /* 1680 */ 449, 1977, 1962, 1961, 667, 1973, 1969, 1968, 1966, 2077,
- /* 1690 */ 1965, 666, 1964, 1960, 1959, 1958, 1957, 1956, 1955, 1954,
- /* 1700 */ 1953, 1952, 1508, 1510, 1951, 1950, 1949, 107, 2109, 1948,
- /* 1710 */ 290, 146, 1947, 1946, 1945, 658, 1564, 1565, 1567, 1568,
- /* 1720 */ 1569, 1570, 2108, 1976, 1944, 1943, 2144, 1942, 1941, 110,
- /* 1730 */ 2110, 670, 2112, 2113, 665, 1940, 660, 1397, 1939, 477,
- /* 1740 */ 1938, 2127, 646, 2197, 1270, 338, 339, 655, 2193, 667,
- /* 1750 */ 1789, 1274, 1266, 1788, 2077, 1787, 666, 1785, 1749, 75,
- /* 1760 */ 201, 206, 177, 2097, 1748, 203, 204, 2040, 1174, 76,
- /* 1770 */ 1173, 2030, 2018, 2109, 207, 212, 2017, 277, 498, 500,
- /* 1780 */ 1995, 1863, 276, 214, 1784, 1782, 1208, 668, 517, 516,
- /* 1790 */ 1780, 2144, 520, 1778, 110, 2110, 670, 2112, 2113, 665,
- /* 1800 */ 515, 660, 243, 519, 523, 521, 2127, 524, 2197, 525,
- /* 1810 */ 1776, 528, 345, 2193, 667, 1763, 529, 527, 1762, 2077,
- /* 1820 */ 1745, 666, 1865, 1343, 2109, 1342, 1864, 1257, 1244, 1255,
- /* 1830 */ 725, 1253, 1252, 1251, 1250, 62, 1249, 1246, 1774, 1245,
- /* 1840 */ 224, 363, 1243, 2109, 727, 1767, 364, 1765, 559, 365,
- /* 1850 */ 1744, 561, 2108, 1743, 1742, 556, 2144, 2127, 563, 110,
- /* 1860 */ 2110, 670, 2112, 2113, 665, 667, 660, 1468, 565, 112,
- /* 1870 */ 2077, 1470, 666, 2197, 1467, 26, 2127, 2039, 2194, 1472,
- /* 1880 */ 1452, 2029, 1454, 66, 667, 580, 1450, 2016, 2014, 2077,
- /* 1890 */ 16, 666, 2273, 20, 64, 17, 19, 2015, 2013, 162,
- /* 1900 */ 58, 59, 1697, 2108, 596, 55, 259, 2144, 28, 247,
- /* 1910 */ 168, 2110, 670, 2112, 2113, 665, 581, 660, 2109, 369,
- /* 1920 */ 586, 252, 2108, 260, 5, 2098, 2144, 594, 30, 322,
- /* 1930 */ 2110, 670, 2112, 2113, 665, 1682, 660, 2109, 6, 21,
- /* 1940 */ 1696, 254, 1664, 170, 258, 374, 1701, 1700, 29, 375,
- /* 1950 */ 272, 2127, 2235, 57, 173, 2012, 1656, 1994, 641, 667,
- /* 1960 */ 91, 56, 1702, 94, 2077, 1703, 666, 1631, 278, 1630,
- /* 1970 */ 2127, 93, 22, 610, 279, 378, 1662, 1993, 667, 281,
- /* 1980 */ 286, 96, 67, 2077, 102, 666, 288, 291, 23, 10,
- /* 1990 */ 12, 1583, 98, 1506, 1582, 1561, 174, 2108, 186, 2147,
- /* 2000 */ 659, 2144, 1559, 1558, 169, 2110, 670, 2112, 2113, 665,
- /* 2010 */ 2109, 660, 1538, 36, 673, 15, 2108, 24, 391, 1530,
- /* 2020 */ 2144, 677, 25, 329, 2110, 670, 2112, 2113, 665, 1593,
- /* 2030 */ 660, 671, 1328, 675, 680, 1325, 2109, 678, 683, 1322,
- /* 2040 */ 1316, 681, 686, 2127, 1314, 684, 687, 669, 1320, 1319,
- /* 2050 */ 1318, 664, 1317, 1305, 103, 294, 2077, 2290, 666, 693,
- /* 2060 */ 104, 1337, 74, 1333, 1240, 1206, 703, 1239, 1238, 2127,
- /* 2070 */ 1237, 1236, 1264, 1235, 388, 1233, 1224, 667, 1231, 1230,
- /* 2080 */ 1229, 1227, 2077, 295, 666, 715, 1226, 1225, 1223, 2108,
- /* 2090 */ 1222, 1221, 1261, 2144, 1259, 1218, 328, 2110, 670, 2112,
- /* 2100 */ 2113, 665, 1217, 660, 1214, 2163, 1213, 2109, 1212, 1211,
- /* 2110 */ 1781, 735, 736, 1779, 737, 2108, 739, 741, 740, 2144,
- /* 2120 */ 1777, 744, 329, 2110, 670, 2112, 2113, 665, 2109, 660,
- /* 2130 */ 743, 745, 1775, 748, 747, 749, 1761, 751, 1163, 1741,
- /* 2140 */ 2127, 298, 755, 759, 1492, 390, 308, 758, 667, 1716,
- /* 2150 */ 1716, 1716, 1716, 2077, 1716, 666, 1716, 1716, 2109, 1716,
- /* 2160 */ 1716, 2127, 1716, 1716, 1716, 1716, 1716, 1716, 1716, 667,
- /* 2170 */ 1716, 1716, 1716, 1716, 2077, 1716, 666, 1716, 1716, 1716,
- /* 2180 */ 1716, 1716, 1716, 1716, 1716, 1716, 2108, 1716, 1716, 1716,
- /* 2190 */ 2144, 2127, 1716, 329, 2110, 670, 2112, 2113, 665, 667,
- /* 2200 */ 660, 1716, 1716, 1716, 2077, 1716, 666, 571, 1716, 1716,
- /* 2210 */ 1716, 2144, 1716, 1716, 324, 2110, 670, 2112, 2113, 665,
- /* 2220 */ 1716, 660, 1716, 2109, 1716, 1716, 1716, 1716, 1716, 1716,
- /* 2230 */ 1716, 1716, 1716, 1716, 1716, 1716, 1716, 2108, 1716, 1716,
- /* 2240 */ 1716, 2144, 1716, 1716, 313, 2110, 670, 2112, 2113, 665,
- /* 2250 */ 1716, 660, 2109, 1716, 1716, 1716, 2127, 1716, 1716, 1716,
- /* 2260 */ 1716, 1716, 1716, 1716, 667, 1716, 1716, 1716, 1716, 2077,
- /* 2270 */ 1716, 666, 1716, 1716, 1716, 1716, 1716, 1716, 1716, 1716,
- /* 2280 */ 1716, 1716, 1716, 1716, 1716, 2127, 2109, 1716, 1716, 1716,
- /* 2290 */ 1716, 1716, 1716, 667, 1716, 1716, 1716, 1716, 2077, 1716,
- /* 2300 */ 666, 1716, 2108, 1716, 1716, 1716, 2144, 1716, 1716, 314,
- /* 2310 */ 2110, 670, 2112, 2113, 665, 1716, 660, 1716, 1716, 2127,
- /* 2320 */ 1716, 1716, 1716, 1716, 1716, 1716, 1716, 667, 1716, 1716,
- /* 2330 */ 1716, 2108, 2077, 1716, 666, 2144, 1716, 1716, 315, 2110,
- /* 2340 */ 670, 2112, 2113, 665, 1716, 660, 1716, 1716, 1716, 1716,
- /* 2350 */ 2109, 1716, 1716, 1716, 1716, 1716, 1716, 1716, 1716, 1716,
- /* 2360 */ 1716, 1716, 1716, 1716, 1716, 2108, 1716, 1716, 1716, 2144,
- /* 2370 */ 2109, 1716, 321, 2110, 670, 2112, 2113, 665, 1716, 660,
- /* 2380 */ 1716, 1716, 1716, 2127, 1716, 1716, 1716, 1716, 1716, 1716,
- /* 2390 */ 1716, 667, 1716, 1716, 1716, 1716, 2077, 1716, 666, 1716,
- /* 2400 */ 1716, 1716, 1716, 2127, 1716, 1716, 1716, 1716, 1716, 1716,
- /* 2410 */ 1716, 667, 1716, 1716, 1716, 1716, 2077, 1716, 666, 1716,
- /* 2420 */ 1716, 1716, 1716, 1716, 1716, 1716, 1716, 1716, 1716, 2108,
- /* 2430 */ 1716, 2109, 1716, 2144, 1716, 1716, 325, 2110, 670, 2112,
- /* 2440 */ 2113, 665, 1716, 660, 1716, 1716, 1716, 1716, 1716, 2108,
- /* 2450 */ 1716, 1716, 1716, 2144, 1716, 1716, 317, 2110, 670, 2112,
- /* 2460 */ 2113, 665, 1716, 660, 2127, 1716, 1716, 1716, 1716, 1716,
- /* 2470 */ 1716, 1716, 667, 1716, 1716, 1716, 1716, 2077, 1716, 666,
- /* 2480 */ 1716, 1716, 2109, 1716, 1716, 1716, 1716, 1716, 1716, 1716,
- /* 2490 */ 1716, 1716, 1716, 1716, 1716, 1716, 1716, 1716, 1716, 1716,
- /* 2500 */ 1716, 1716, 1716, 2109, 1716, 1716, 1716, 1716, 1716, 1716,
- /* 2510 */ 2108, 1716, 1716, 1716, 2144, 2127, 1716, 326, 2110, 670,
- /* 2520 */ 2112, 2113, 665, 667, 660, 1716, 1716, 1716, 2077, 1716,
- /* 2530 */ 666, 1716, 1716, 2109, 1716, 1716, 2127, 1716, 1716, 1716,
- /* 2540 */ 1716, 1716, 1716, 1716, 667, 1716, 1716, 1716, 1716, 2077,
- /* 2550 */ 1716, 666, 1716, 1716, 1716, 1716, 1716, 1716, 1716, 1716,
- /* 2560 */ 1716, 2108, 1716, 1716, 1716, 2144, 2127, 1716, 318, 2110,
- /* 2570 */ 670, 2112, 2113, 665, 667, 660, 1716, 1716, 1716, 2077,
- /* 2580 */ 1716, 666, 2108, 1716, 1716, 1716, 2144, 1716, 1716, 327,
- /* 2590 */ 2110, 670, 2112, 2113, 665, 1716, 660, 1716, 2109, 1716,
- /* 2600 */ 1716, 1716, 1716, 1716, 1716, 1716, 1716, 1716, 1716, 1716,
- /* 2610 */ 1716, 1716, 2108, 1716, 1716, 1716, 2144, 1716, 1716, 319,
- /* 2620 */ 2110, 670, 2112, 2113, 665, 1716, 660, 2109, 1716, 1716,
- /* 2630 */ 1716, 2127, 1716, 1716, 1716, 1716, 1716, 1716, 1716, 667,
- /* 2640 */ 1716, 1716, 1716, 1716, 2077, 1716, 666, 1716, 1716, 1716,
- /* 2650 */ 1716, 1716, 1716, 1716, 1716, 1716, 1716, 1716, 1716, 1716,
- /* 2660 */ 2127, 2109, 1716, 1716, 1716, 1716, 1716, 1716, 667, 1716,
- /* 2670 */ 1716, 1716, 1716, 2077, 1716, 666, 1716, 2108, 1716, 1716,
- /* 2680 */ 1716, 2144, 1716, 1716, 332, 2110, 670, 2112, 2113, 665,
- /* 2690 */ 1716, 660, 1716, 1716, 2127, 1716, 1716, 1716, 1716, 1716,
- /* 2700 */ 1716, 1716, 667, 1716, 1716, 1716, 2108, 2077, 1716, 666,
- /* 2710 */ 2144, 1716, 1716, 333, 2110, 670, 2112, 2113, 665, 1716,
- /* 2720 */ 660, 1716, 1716, 1716, 1716, 2109, 1716, 1716, 1716, 1716,
- /* 2730 */ 1716, 1716, 1716, 1716, 1716, 1716, 1716, 1716, 1716, 1716,
- /* 2740 */ 2108, 1716, 1716, 1716, 2144, 2109, 1716, 2121, 2110, 670,
- /* 2750 */ 2112, 2113, 665, 1716, 660, 1716, 1716, 1716, 2127, 1716,
- /* 2760 */ 1716, 1716, 1716, 1716, 1716, 1716, 667, 1716, 1716, 1716,
- /* 2770 */ 1716, 2077, 1716, 666, 1716, 1716, 1716, 1716, 2127, 1716,
- /* 2780 */ 1716, 1716, 1716, 1716, 1716, 1716, 667, 1716, 1716, 1716,
- /* 2790 */ 1716, 2077, 1716, 666, 1716, 1716, 1716, 1716, 1716, 1716,
- /* 2800 */ 1716, 1716, 1716, 1716, 2108, 1716, 2109, 1716, 2144, 1716,
- /* 2810 */ 1716, 2120, 2110, 670, 2112, 2113, 665, 1716, 660, 1716,
- /* 2820 */ 1716, 1716, 1716, 1716, 2108, 1716, 1716, 1716, 2144, 1716,
- /* 2830 */ 1716, 2119, 2110, 670, 2112, 2113, 665, 1716, 660, 2127,
- /* 2840 */ 1716, 1716, 1716, 1716, 1716, 1716, 1716, 667, 1716, 1716,
- /* 2850 */ 1716, 1716, 2077, 1716, 666, 1716, 1716, 2109, 1716, 1716,
- /* 2860 */ 1716, 1716, 1716, 1716, 1716, 1716, 1716, 1716, 1716, 1716,
- /* 2870 */ 1716, 1716, 1716, 1716, 1716, 1716, 1716, 1716, 2109, 1716,
- /* 2880 */ 1716, 1716, 1716, 1716, 1716, 2108, 1716, 1716, 1716, 2144,
- /* 2890 */ 2127, 1716, 347, 2110, 670, 2112, 2113, 665, 667, 660,
- /* 2900 */ 1716, 1716, 1716, 2077, 1716, 666, 1716, 1716, 2109, 1716,
- /* 2910 */ 1716, 2127, 1716, 1716, 1716, 1716, 1716, 1716, 1716, 667,
- /* 2920 */ 1716, 1716, 1716, 1716, 2077, 1716, 666, 1716, 1716, 1716,
- /* 2930 */ 1716, 1716, 1716, 1716, 1716, 1716, 2108, 1716, 1716, 1716,
- /* 2940 */ 2144, 2127, 1716, 348, 2110, 670, 2112, 2113, 665, 667,
- /* 2950 */ 660, 1716, 1716, 1716, 2077, 1716, 666, 2108, 1716, 1716,
- /* 2960 */ 1716, 2144, 1716, 1716, 344, 2110, 670, 2112, 2113, 665,
- /* 2970 */ 1716, 660, 1716, 2109, 1716, 1716, 1716, 1716, 1716, 1716,
- /* 2980 */ 1716, 1716, 1716, 1716, 1716, 1716, 1716, 2108, 1716, 1716,
- /* 2990 */ 1716, 2144, 1716, 1716, 349, 2110, 670, 2112, 2113, 665,
- /* 3000 */ 1716, 660, 2109, 1716, 1716, 1716, 2127, 1716, 1716, 1716,
- /* 3010 */ 1716, 1716, 1716, 1716, 667, 1716, 1716, 1716, 1716, 2077,
- /* 3020 */ 1716, 666, 1716, 1716, 1716, 1716, 1716, 1716, 1716, 1716,
- /* 3030 */ 1716, 1716, 1716, 1716, 1716, 2127, 1716, 1716, 1716, 1716,
- /* 3040 */ 1716, 1716, 1716, 667, 1716, 1716, 1716, 1716, 2077, 1716,
- /* 3050 */ 666, 1716, 668, 1716, 1716, 1716, 2144, 1716, 1716, 324,
- /* 3060 */ 2110, 670, 2112, 2113, 665, 1716, 660, 1716, 1716, 1716,
- /* 3070 */ 1716, 1716, 1716, 1716, 1716, 1716, 1716, 1716, 1716, 1716,
- /* 3080 */ 1716, 2108, 1716, 1716, 1716, 2144, 1716, 1716, 323, 2110,
- /* 3090 */ 670, 2112, 2113, 665, 1716, 660,
+ /* 0 */ 2116, 1881, 2010, 499, 432, 1877, 500, 1758, 431, 2102,
+ /* 10 */ 670, 2051, 46, 44, 1646, 1722, 2102, 2008, 640, 2098,
+ /* 20 */ 393, 504, 1495, 1520, 39, 38, 2098, 501, 45, 43,
+ /* 30 */ 42, 41, 40, 1576, 1791, 1493, 2134, 2010, 1520, 132,
+ /* 40 */ 131, 130, 129, 128, 127, 126, 125, 124, 2084, 384,
+ /* 50 */ 669, 591, 2007, 640, 2275, 2094, 2100, 374, 244, 1571,
+ /* 60 */ 28, 1944, 2094, 2100, 375, 19, 663, 652, 371, 2281,
+ /* 70 */ 184, 638, 1501, 663, 2276, 617, 1942, 628, 140, 1869,
+ /* 80 */ 507, 2115, 107, 500, 1758, 2151, 36, 296, 169, 2117,
+ /* 90 */ 673, 2119, 2120, 668, 168, 663, 1734, 758, 141, 9,
+ /* 100 */ 15, 735, 734, 733, 732, 403, 1884, 731, 730, 144,
+ /* 110 */ 725, 724, 723, 722, 721, 720, 719, 157, 715, 714,
+ /* 120 */ 713, 402, 401, 710, 709, 708, 707, 706, 592, 2241,
+ /* 130 */ 398, 2219, 1320, 1937, 1939, 123, 1578, 1579, 122, 121,
+ /* 140 */ 120, 119, 118, 117, 116, 115, 114, 1311, 695, 694,
+ /* 150 */ 693, 1315, 692, 1317, 1318, 691, 688, 2216, 1326, 685,
+ /* 160 */ 1328, 1329, 682, 679, 177, 652, 1551, 1561, 2280, 1409,
+ /* 170 */ 1410, 2275, 1577, 1580, 1944, 653, 1892, 630, 182, 2212,
+ /* 180 */ 2213, 356, 138, 2217, 358, 1993, 1496, 2279, 1494, 1942,
+ /* 190 */ 1720, 2276, 2278, 133, 287, 288, 516, 39, 38, 286,
+ /* 200 */ 537, 45, 43, 42, 41, 40, 278, 62, 703, 155,
+ /* 210 */ 154, 700, 699, 698, 152, 1499, 1500, 1794, 1550, 1553,
+ /* 220 */ 1554, 1555, 1556, 1557, 1558, 1559, 1560, 665, 661, 1569,
+ /* 230 */ 1570, 1572, 1573, 1574, 1575, 2, 46, 44, 425, 1169,
+ /* 240 */ 1522, 341, 62, 1518, 393, 49, 1495, 62, 611, 93,
+ /* 250 */ 469, 2116, 616, 483, 350, 2275, 482, 1576, 177, 1493,
+ /* 260 */ 406, 670, 427, 423, 405, 45, 43, 42, 41, 40,
+ /* 270 */ 615, 184, 452, 50, 484, 2276, 617, 454, 1171, 1994,
+ /* 280 */ 1174, 1175, 180, 1571, 555, 554, 553, 2134, 1723, 19,
+ /* 290 */ 106, 545, 137, 549, 1931, 1520, 1501, 548, 1605, 2084,
+ /* 300 */ 103, 669, 547, 552, 366, 365, 1521, 591, 546, 123,
+ /* 310 */ 2275, 1639, 122, 121, 120, 119, 118, 117, 116, 115,
+ /* 320 */ 114, 758, 359, 101, 15, 2281, 184, 430, 2280, 429,
+ /* 330 */ 2276, 617, 2115, 1191, 442, 1190, 2151, 653, 1892, 110,
+ /* 340 */ 2117, 673, 2119, 2120, 668, 1522, 663, 1885, 226, 143,
+ /* 350 */ 438, 150, 2175, 2204, 1606, 133, 428, 387, 2200, 187,
+ /* 360 */ 1578, 1579, 542, 480, 1519, 1192, 474, 473, 472, 471,
+ /* 370 */ 468, 467, 466, 465, 464, 460, 459, 458, 457, 340,
+ /* 380 */ 449, 448, 447, 209, 444, 443, 357, 502, 277, 1765,
+ /* 390 */ 1551, 1561, 2280, 338, 187, 2275, 1577, 1580, 1650, 187,
+ /* 400 */ 555, 554, 553, 705, 1520, 1938, 1939, 545, 137, 549,
+ /* 410 */ 1496, 2279, 1494, 548, 606, 2276, 2277, 1868, 547, 552,
+ /* 420 */ 366, 365, 1354, 1355, 546, 187, 1708, 1264, 35, 391,
+ /* 430 */ 1600, 1601, 1602, 1603, 1604, 1608, 1609, 1610, 1611, 1499,
+ /* 440 */ 1500, 1552, 1550, 1553, 1554, 1555, 1556, 1557, 1558, 1559,
+ /* 450 */ 1560, 665, 661, 1569, 1570, 1572, 1573, 1574, 1575, 2,
+ /* 460 */ 12, 46, 44, 227, 1266, 1495, 167, 1521, 211, 393,
+ /* 470 */ 2116, 1495, 502, 1833, 1765, 1674, 578, 652, 1493, 172,
+ /* 480 */ 631, 705, 1576, 476, 1493, 533, 529, 525, 521, 224,
+ /* 490 */ 2219, 39, 38, 277, 1745, 45, 43, 42, 41, 40,
+ /* 500 */ 612, 607, 600, 1523, 1523, 66, 2134, 1883, 1571, 551,
+ /* 510 */ 550, 1501, 1520, 610, 19, 1501, 2215, 2098, 2084, 639,
+ /* 520 */ 669, 1501, 603, 602, 1672, 1673, 1675, 1676, 1677, 88,
+ /* 530 */ 39, 38, 222, 12, 45, 43, 42, 41, 40, 2134,
+ /* 540 */ 758, 1944, 2084, 200, 199, 543, 758, 1744, 381, 15,
+ /* 550 */ 1552, 2115, 1607, 2094, 2100, 2151, 1942, 49, 110, 2117,
+ /* 560 */ 673, 2119, 2120, 668, 663, 663, 475, 1262, 166, 514,
+ /* 570 */ 181, 2003, 2204, 316, 39, 38, 387, 2200, 45, 43,
+ /* 580 */ 42, 41, 40, 1426, 1427, 1578, 1579, 314, 73, 186,
+ /* 590 */ 1743, 72, 62, 609, 560, 2084, 1191, 2230, 1190, 221,
+ /* 600 */ 215, 62, 87, 639, 220, 12, 512, 10, 2219, 570,
+ /* 610 */ 207, 495, 493, 490, 696, 1551, 1561, 396, 360, 1425,
+ /* 620 */ 1428, 1577, 1580, 240, 213, 162, 33, 1887, 1192, 1496,
+ /* 630 */ 717, 1494, 372, 1894, 2214, 1496, 1612, 1494, 2084, 563,
+ /* 640 */ 1942, 2067, 653, 1892, 557, 653, 1892, 1944, 1742, 239,
+ /* 650 */ 62, 255, 193, 637, 386, 2003, 2102, 541, 1499, 1500,
+ /* 660 */ 189, 540, 1942, 55, 1499, 1500, 2098, 1550, 1553, 1554,
+ /* 670 */ 1555, 1556, 1557, 1558, 1559, 1560, 665, 661, 1569, 1570,
+ /* 680 */ 1572, 1573, 1574, 1575, 2, 46, 44, 1581, 109, 70,
+ /* 690 */ 1944, 2116, 69, 393, 1879, 1495, 2084, 397, 653, 1892,
+ /* 700 */ 1715, 631, 2094, 2100, 388, 1942, 1576, 1741, 1493, 187,
+ /* 710 */ 718, 32, 1854, 663, 628, 140, 436, 39, 38, 653,
+ /* 720 */ 1892, 45, 43, 42, 41, 40, 1834, 2134, 81, 80,
+ /* 730 */ 435, 87, 1571, 191, 164, 729, 727, 437, 639, 2084,
+ /* 740 */ 1875, 669, 39, 38, 187, 1501, 45, 43, 42, 41,
+ /* 750 */ 40, 653, 1892, 187, 339, 2084, 1888, 421, 1974, 1989,
+ /* 760 */ 419, 415, 411, 408, 428, 1177, 1740, 653, 1892, 446,
+ /* 770 */ 758, 1519, 2115, 47, 653, 1892, 2151, 2116, 1739, 110,
+ /* 780 */ 2117, 673, 2119, 2120, 668, 461, 663, 670, 648, 1767,
+ /* 790 */ 2003, 181, 462, 2204, 34, 1643, 1738, 387, 2200, 1714,
+ /* 800 */ 39, 38, 187, 192, 45, 43, 42, 41, 40, 1578,
+ /* 810 */ 1579, 653, 1892, 2134, 2084, 275, 2212, 627, 2231, 134,
+ /* 820 */ 626, 569, 2275, 628, 140, 2084, 2084, 669, 1896, 515,
+ /* 830 */ 1523, 653, 1892, 196, 567, 1685, 565, 615, 184, 1551,
+ /* 840 */ 1561, 1989, 2276, 617, 2084, 1577, 1580, 39, 38, 1889,
+ /* 850 */ 420, 45, 43, 42, 41, 40, 1867, 142, 2115, 1496,
+ /* 860 */ 2175, 1494, 2151, 653, 1892, 110, 2117, 673, 2119, 2120,
+ /* 870 */ 668, 1944, 663, 84, 242, 249, 83, 2295, 241, 2204,
+ /* 880 */ 363, 245, 165, 387, 2200, 194, 1943, 634, 1499, 1500,
+ /* 890 */ 1895, 1550, 1553, 1554, 1555, 1556, 1557, 1558, 1559, 1560,
+ /* 900 */ 665, 661, 1569, 1570, 1572, 1573, 1574, 1575, 2, 46,
+ /* 910 */ 44, 2116, 655, 456, 2176, 653, 1892, 393, 1737, 1495,
+ /* 920 */ 1736, 670, 455, 2238, 183, 2212, 2213, 253, 138, 2217,
+ /* 930 */ 1576, 2116, 1493, 587, 591, 1174, 1175, 2275, 90, 345,
+ /* 940 */ 1662, 667, 370, 657, 571, 2176, 364, 2134, 362, 361,
+ /* 950 */ 1733, 539, 2281, 184, 1586, 1735, 1571, 2276, 617, 2084,
+ /* 960 */ 1520, 669, 653, 1892, 653, 1892, 2084, 2134, 2084, 1501,
+ /* 970 */ 91, 1275, 541, 42, 41, 40, 540, 2279, 254, 2084,
+ /* 980 */ 632, 669, 636, 2103, 1274, 703, 155, 154, 700, 699,
+ /* 990 */ 698, 152, 2115, 2098, 758, 2077, 2151, 47, 2084, 110,
+ /* 1000 */ 2117, 673, 2119, 2120, 668, 2116, 663, 2078, 14, 13,
+ /* 1010 */ 1732, 2295, 2115, 2204, 1731, 670, 2151, 387, 2200, 332,
+ /* 1020 */ 2117, 673, 2119, 2120, 668, 666, 663, 654, 2169, 2094,
+ /* 1030 */ 2100, 39, 38, 1578, 1579, 45, 43, 42, 41, 40,
+ /* 1040 */ 663, 2134, 591, 385, 1642, 2275, 485, 1989, 620, 653,
+ /* 1050 */ 1892, 165, 660, 2084, 591, 669, 664, 2275, 2084, 1894,
+ /* 1060 */ 2281, 184, 2084, 1551, 1561, 2276, 617, 291, 697, 1577,
+ /* 1070 */ 1580, 1935, 2281, 184, 2224, 1639, 396, 2276, 617, 1717,
+ /* 1080 */ 1718, 653, 1892, 1496, 165, 1494, 2115, 653, 1892, 1279,
+ /* 1090 */ 2151, 198, 1894, 170, 2117, 673, 2119, 2120, 668, 650,
+ /* 1100 */ 663, 576, 1278, 628, 140, 651, 1552, 52, 1619, 3,
+ /* 1110 */ 243, 701, 1499, 1500, 1935, 1550, 1553, 1554, 1555, 1556,
+ /* 1120 */ 1557, 1558, 1559, 1560, 665, 661, 1569, 1570, 1572, 1573,
+ /* 1130 */ 1574, 1575, 2, 46, 44, 653, 1892, 653, 1892, 1730,
+ /* 1140 */ 1729, 393, 399, 1495, 618, 2296, 1728, 2116, 591, 2070,
+ /* 1150 */ 165, 2275, 1727, 297, 1576, 400, 1493, 670, 1894, 2251,
+ /* 1160 */ 153, 623, 439, 1726, 487, 1725, 2281, 184, 1870, 252,
+ /* 1170 */ 310, 2276, 617, 1921, 2116, 440, 702, 1468, 1469, 1935,
+ /* 1180 */ 1571, 74, 232, 2134, 670, 230, 598, 2084, 2084, 146,
+ /* 1190 */ 573, 135, 572, 1501, 2084, 2084, 616, 669, 413, 2275,
+ /* 1200 */ 2084, 590, 1597, 544, 185, 2212, 2213, 1781, 138, 2217,
+ /* 1210 */ 2134, 2084, 148, 2084, 615, 184, 2244, 54, 758, 2276,
+ /* 1220 */ 617, 15, 2084, 234, 669, 1260, 233, 272, 2115, 556,
+ /* 1230 */ 82, 1504, 2151, 153, 2116, 110, 2117, 673, 2119, 2120,
+ /* 1240 */ 668, 1503, 663, 604, 670, 236, 619, 2295, 235, 2204,
+ /* 1250 */ 1774, 1772, 225, 387, 2200, 2115, 153, 1578, 1579, 2151,
+ /* 1260 */ 64, 711, 110, 2117, 673, 2119, 2120, 668, 238, 663,
+ /* 1270 */ 2134, 237, 558, 561, 2295, 64, 2204, 259, 621, 266,
+ /* 1280 */ 387, 2200, 2084, 1240, 669, 2105, 2135, 1551, 1561, 1998,
+ /* 1290 */ 1463, 1221, 404, 1577, 1580, 1759, 703, 155, 154, 700,
+ /* 1300 */ 699, 698, 152, 14, 13, 153, 1764, 1496, 48, 1494,
+ /* 1310 */ 1932, 284, 2234, 1466, 71, 2115, 151, 1671, 153, 2151,
+ /* 1320 */ 629, 53, 169, 2117, 673, 2119, 2120, 668, 1222, 663,
+ /* 1330 */ 48, 1768, 1670, 64, 261, 48, 1499, 1500, 2107, 1550,
+ /* 1340 */ 1553, 1554, 1555, 1556, 1557, 1558, 1559, 1560, 665, 661,
+ /* 1350 */ 1569, 1570, 1572, 1573, 1574, 1575, 2, 271, 274, 390,
+ /* 1360 */ 389, 677, 635, 2242, 151, 1423, 153, 2116, 289, 1509,
+ /* 1370 */ 136, 645, 151, 293, 712, 1305, 1, 670, 5, 2269,
+ /* 1380 */ 1576, 753, 1502, 407, 1507, 412, 354, 309, 1446, 441,
+ /* 1390 */ 1613, 304, 1562, 624, 1506, 197, 1238, 2116, 1523, 1999,
+ /* 1400 */ 445, 478, 450, 2134, 1518, 463, 1571, 670, 1991, 2223,
+ /* 1410 */ 470, 477, 479, 488, 489, 2084, 202, 669, 1332, 1501,
+ /* 1420 */ 486, 1336, 201, 1343, 491, 492, 204, 1341, 494, 156,
+ /* 1430 */ 496, 1524, 497, 2134, 4, 498, 505, 506, 1526, 508,
+ /* 1440 */ 212, 1521, 509, 214, 659, 2084, 1525, 669, 2115, 510,
+ /* 1450 */ 1527, 511, 2151, 217, 513, 110, 2117, 673, 2119, 2120,
+ /* 1460 */ 668, 219, 663, 85, 86, 2116, 1194, 2295, 517, 2204,
+ /* 1470 */ 223, 536, 534, 387, 2200, 670, 535, 538, 2115, 344,
+ /* 1480 */ 2060, 1882, 2151, 2057, 229, 110, 2117, 673, 2119, 2120,
+ /* 1490 */ 668, 1878, 663, 112, 577, 575, 231, 2295, 89, 2204,
+ /* 1500 */ 158, 2134, 159, 387, 2200, 149, 1880, 1876, 160, 2056,
+ /* 1510 */ 246, 161, 582, 2084, 580, 669, 305, 581, 585, 250,
+ /* 1520 */ 1453, 588, 8, 605, 2250, 248, 643, 595, 2249, 586,
+ /* 1530 */ 257, 601, 614, 1510, 2235, 1505, 2245, 376, 608, 2226,
+ /* 1540 */ 265, 173, 596, 594, 260, 268, 2115, 267, 593, 622,
+ /* 1550 */ 2151, 2298, 625, 110, 2117, 673, 2119, 2120, 668, 269,
+ /* 1560 */ 663, 377, 1513, 1515, 2274, 2179, 139, 2204, 270, 1639,
+ /* 1570 */ 1522, 387, 2200, 2116, 2220, 661, 1569, 1570, 1572, 1573,
+ /* 1580 */ 1574, 1575, 279, 670, 633, 380, 1528, 96, 2004, 306,
+ /* 1590 */ 641, 642, 2018, 2116, 2017, 2016, 307, 646, 273, 383,
+ /* 1600 */ 98, 647, 308, 670, 61, 100, 1893, 2185, 102, 2134,
+ /* 1610 */ 1936, 311, 754, 1855, 2076, 755, 675, 757, 51, 346,
+ /* 1620 */ 2075, 2084, 347, 669, 2074, 315, 300, 335, 320, 2134,
+ /* 1630 */ 313, 334, 78, 2071, 409, 1486, 410, 1487, 324, 190,
+ /* 1640 */ 414, 2084, 416, 669, 2069, 417, 418, 2068, 355, 2066,
+ /* 1650 */ 422, 2065, 424, 2064, 2115, 79, 426, 1449, 2151, 1448,
+ /* 1660 */ 2030, 110, 2117, 673, 2119, 2120, 668, 2029, 663, 2028,
+ /* 1670 */ 433, 434, 2027, 2177, 2115, 2204, 1400, 2116, 2151, 387,
+ /* 1680 */ 2200, 110, 2117, 673, 2119, 2120, 668, 670, 663, 2026,
+ /* 1690 */ 1982, 1981, 1979, 656, 145, 2204, 1978, 1977, 1980, 387,
+ /* 1700 */ 2200, 2116, 1976, 1975, 1973, 1972, 1971, 195, 451, 1970,
+ /* 1710 */ 453, 670, 1984, 2134, 1969, 1968, 1967, 1966, 1965, 1964,
+ /* 1720 */ 1963, 1962, 1961, 1960, 1959, 2084, 1958, 669, 1957, 1956,
+ /* 1730 */ 1955, 1954, 1953, 1952, 1983, 147, 1951, 2134, 1950, 1949,
+ /* 1740 */ 1948, 1947, 481, 1946, 1945, 1797, 203, 1402, 342, 2084,
+ /* 1750 */ 1796, 669, 1795, 205, 206, 343, 1793, 1276, 2115, 1280,
+ /* 1760 */ 1754, 1176, 2151, 218, 2024, 111, 2117, 673, 2119, 2120,
+ /* 1770 */ 668, 178, 663, 1753, 2047, 2037, 2025, 1272, 2116, 2204,
+ /* 1780 */ 2002, 1871, 2115, 2203, 2200, 76, 2151, 77, 670, 111,
+ /* 1790 */ 2117, 673, 2119, 2120, 668, 208, 663, 216, 2104, 210,
+ /* 1800 */ 1792, 2116, 179, 2204, 503, 1790, 518, 658, 2200, 520,
+ /* 1810 */ 519, 670, 1788, 522, 2134, 1214, 523, 1786, 524, 526,
+ /* 1820 */ 1784, 527, 528, 530, 2116, 532, 2084, 1771, 669, 1770,
+ /* 1830 */ 1750, 531, 1873, 1348, 670, 1347, 1872, 2134, 1263, 1261,
+ /* 1840 */ 726, 1259, 1258, 1257, 1256, 1255, 728, 2116, 1250, 2084,
+ /* 1850 */ 1252, 669, 1782, 1251, 1249, 367, 1775, 670, 1773, 671,
+ /* 1860 */ 2134, 228, 368, 2151, 369, 559, 111, 2117, 673, 2119,
+ /* 1870 */ 2120, 668, 2084, 663, 669, 63, 562, 1749, 564, 1748,
+ /* 1880 */ 2204, 566, 2115, 2134, 349, 2200, 2151, 1747, 568, 111,
+ /* 1890 */ 2117, 673, 2119, 2120, 668, 2084, 663, 669, 113, 1473,
+ /* 1900 */ 1475, 27, 1472, 2204, 2046, 2115, 1459, 1455, 2201, 2151,
+ /* 1910 */ 2116, 67, 326, 2117, 673, 2119, 2120, 668, 1457, 663,
+ /* 1920 */ 670, 2036, 1477, 583, 2023, 2021, 2280, 20, 2115, 1687,
+ /* 1930 */ 56, 17, 2151, 6, 29, 170, 2117, 673, 2119, 2120,
+ /* 1940 */ 668, 7, 663, 589, 256, 584, 2134, 597, 258, 599,
+ /* 1950 */ 59, 382, 60, 373, 163, 613, 1669, 171, 2084, 251,
+ /* 1960 */ 669, 262, 30, 263, 1661, 264, 21, 65, 92, 2105,
+ /* 1970 */ 31, 1707, 1708, 22, 1702, 2116, 1701, 378, 1706, 1705,
+ /* 1980 */ 379, 1636, 1635, 2022, 276, 667, 2020, 2297, 2019, 2001,
+ /* 1990 */ 58, 2115, 94, 95, 174, 2151, 2116, 282, 333, 2117,
+ /* 2000 */ 673, 2119, 2120, 668, 283, 663, 670, 23, 644, 2116,
+ /* 2010 */ 1667, 2134, 285, 290, 68, 2000, 97, 292, 295, 670,
+ /* 2020 */ 103, 13, 24, 2084, 1511, 669, 1588, 99, 1587, 11,
+ /* 2030 */ 1543, 1598, 2134, 2154, 175, 1566, 1564, 392, 662, 188,
+ /* 2040 */ 57, 1563, 672, 674, 2084, 2134, 669, 18, 37, 16,
+ /* 2050 */ 394, 25, 676, 1535, 1333, 26, 2115, 2084, 395, 669,
+ /* 2060 */ 2151, 579, 678, 332, 2117, 673, 2119, 2120, 668, 1330,
+ /* 2070 */ 663, 680, 2170, 681, 683, 1327, 684, 2115, 686, 761,
+ /* 2080 */ 1321, 2151, 687, 689, 333, 2117, 673, 2119, 2120, 668,
+ /* 2090 */ 2115, 663, 1319, 303, 2151, 690, 2116, 333, 2117, 673,
+ /* 2100 */ 2119, 2120, 668, 1325, 663, 104, 670, 1324, 298, 176,
+ /* 2110 */ 105, 1342, 1323, 75, 1338, 751, 747, 743, 739, 301,
+ /* 2120 */ 2116, 1322, 1212, 704, 1246, 1245, 1244, 1270, 1243, 1242,
+ /* 2130 */ 670, 1241, 2134, 1239, 1237, 1236, 1235, 1233, 716, 299,
+ /* 2140 */ 1232, 1231, 1230, 1229, 2084, 1228, 669, 1227, 1265, 1267,
+ /* 2150 */ 1224, 1223, 1218, 1220, 1219, 1789, 2134, 1217, 736, 108,
+ /* 2160 */ 737, 1787, 294, 738, 740, 742, 1785, 744, 2084, 1783,
+ /* 2170 */ 669, 748, 1769, 746, 741, 752, 745, 574, 750, 1166,
+ /* 2180 */ 749, 2151, 1746, 2116, 328, 2117, 673, 2119, 2120, 668,
+ /* 2190 */ 302, 663, 756, 670, 649, 1497, 312, 759, 760, 1721,
+ /* 2200 */ 1721, 2115, 1721, 1721, 1721, 2151, 1721, 2116, 317, 2117,
+ /* 2210 */ 673, 2119, 2120, 668, 1721, 663, 1721, 670, 1721, 2134,
+ /* 2220 */ 1721, 1721, 1721, 1721, 1721, 1721, 1721, 1721, 1721, 281,
+ /* 2230 */ 1721, 2084, 1721, 669, 280, 1721, 1721, 1721, 1721, 1721,
+ /* 2240 */ 1721, 1721, 1721, 2134, 1721, 1721, 1721, 1721, 1721, 1721,
+ /* 2250 */ 1721, 1721, 1721, 2116, 247, 2084, 1721, 669, 1721, 1721,
+ /* 2260 */ 1721, 1721, 1721, 670, 2115, 1721, 1721, 1721, 2151, 2116,
+ /* 2270 */ 1721, 318, 2117, 673, 2119, 2120, 668, 1721, 663, 670,
+ /* 2280 */ 1721, 1721, 1721, 1721, 1721, 1721, 1721, 1721, 2115, 2134,
+ /* 2290 */ 1721, 1721, 2151, 1721, 1721, 319, 2117, 673, 2119, 2120,
+ /* 2300 */ 668, 2084, 663, 669, 1721, 2134, 1721, 1721, 1721, 1721,
+ /* 2310 */ 1721, 1721, 1721, 1721, 1721, 1721, 1721, 2084, 1721, 669,
+ /* 2320 */ 1721, 1721, 1721, 1721, 1721, 1721, 1721, 1721, 1721, 2116,
+ /* 2330 */ 1721, 1721, 1721, 1721, 2115, 1721, 1721, 1721, 2151, 670,
+ /* 2340 */ 1721, 325, 2117, 673, 2119, 2120, 668, 1721, 663, 1721,
+ /* 2350 */ 2115, 1721, 1721, 2116, 2151, 1721, 1721, 329, 2117, 673,
+ /* 2360 */ 2119, 2120, 668, 670, 663, 2134, 1721, 1721, 1721, 1721,
+ /* 2370 */ 1721, 1721, 1721, 1721, 1721, 1721, 1721, 2084, 1721, 669,
+ /* 2380 */ 2116, 1721, 1721, 1721, 1721, 1721, 1721, 1721, 1721, 2134,
+ /* 2390 */ 670, 1721, 1721, 1721, 1721, 1721, 1721, 1721, 1721, 2116,
+ /* 2400 */ 1721, 2084, 1721, 669, 1721, 1721, 1721, 1721, 1721, 670,
+ /* 2410 */ 2115, 1721, 1721, 1721, 2151, 1721, 2134, 321, 2117, 673,
+ /* 2420 */ 2119, 2120, 668, 1721, 663, 1721, 1721, 1721, 2084, 1721,
+ /* 2430 */ 669, 1721, 1721, 1721, 2115, 2134, 1721, 1721, 2151, 1721,
+ /* 2440 */ 1721, 330, 2117, 673, 2119, 2120, 668, 2084, 663, 669,
+ /* 2450 */ 2116, 1721, 1721, 1721, 1721, 1721, 1721, 1721, 1721, 1721,
+ /* 2460 */ 670, 2115, 1721, 1721, 1721, 2151, 2116, 1721, 322, 2117,
+ /* 2470 */ 673, 2119, 2120, 668, 1721, 663, 670, 1721, 1721, 1721,
+ /* 2480 */ 2115, 1721, 1721, 1721, 2151, 1721, 2134, 331, 2117, 673,
+ /* 2490 */ 2119, 2120, 668, 1721, 663, 1721, 2116, 1721, 2084, 1721,
+ /* 2500 */ 669, 1721, 2134, 1721, 1721, 1721, 670, 1721, 1721, 1721,
+ /* 2510 */ 1721, 1721, 1721, 1721, 2084, 1721, 669, 2116, 1721, 1721,
+ /* 2520 */ 1721, 1721, 1721, 1721, 1721, 1721, 1721, 670, 1721, 1721,
+ /* 2530 */ 1721, 2115, 2134, 1721, 1721, 2151, 1721, 1721, 323, 2117,
+ /* 2540 */ 673, 2119, 2120, 668, 2084, 663, 669, 2115, 1721, 1721,
+ /* 2550 */ 1721, 2151, 1721, 2134, 336, 2117, 673, 2119, 2120, 668,
+ /* 2560 */ 1721, 663, 1721, 2116, 1721, 2084, 1721, 669, 1721, 1721,
+ /* 2570 */ 1721, 1721, 1721, 670, 1721, 1721, 1721, 2115, 1721, 1721,
+ /* 2580 */ 1721, 2151, 1721, 1721, 337, 2117, 673, 2119, 2120, 668,
+ /* 2590 */ 1721, 663, 1721, 1721, 1721, 1721, 1721, 1721, 2115, 2134,
+ /* 2600 */ 1721, 1721, 2151, 1721, 1721, 2128, 2117, 673, 2119, 2120,
+ /* 2610 */ 668, 2084, 663, 669, 1721, 1721, 1721, 1721, 1721, 1721,
+ /* 2620 */ 1721, 1721, 1721, 2116, 1721, 1721, 1721, 1721, 1721, 1721,
+ /* 2630 */ 1721, 1721, 1721, 670, 1721, 1721, 2116, 1721, 1721, 1721,
+ /* 2640 */ 1721, 1721, 1721, 1721, 2115, 1721, 670, 1721, 2151, 1721,
+ /* 2650 */ 1721, 2127, 2117, 673, 2119, 2120, 668, 1721, 663, 2134,
+ /* 2660 */ 1721, 1721, 1721, 1721, 1721, 1721, 1721, 1721, 1721, 1721,
+ /* 2670 */ 1721, 2084, 2134, 669, 1721, 1721, 1721, 1721, 1721, 1721,
+ /* 2680 */ 1721, 1721, 1721, 1721, 2084, 1721, 669, 2116, 1721, 1721,
+ /* 2690 */ 1721, 1721, 1721, 1721, 1721, 1721, 1721, 670, 1721, 1721,
+ /* 2700 */ 1721, 1721, 1721, 1721, 2115, 1721, 1721, 1721, 2151, 1721,
+ /* 2710 */ 1721, 2126, 2117, 673, 2119, 2120, 668, 2115, 663, 1721,
+ /* 2720 */ 1721, 2151, 1721, 2134, 351, 2117, 673, 2119, 2120, 668,
+ /* 2730 */ 1721, 663, 1721, 2116, 1721, 2084, 1721, 669, 1721, 1721,
+ /* 2740 */ 1721, 1721, 1721, 670, 1721, 1721, 1721, 1721, 2116, 1721,
+ /* 2750 */ 1721, 1721, 1721, 1721, 1721, 1721, 1721, 1721, 670, 1721,
+ /* 2760 */ 1721, 1721, 1721, 1721, 1721, 1721, 1721, 1721, 2115, 2134,
+ /* 2770 */ 1721, 1721, 2151, 1721, 1721, 352, 2117, 673, 2119, 2120,
+ /* 2780 */ 668, 2084, 663, 669, 2134, 1721, 1721, 1721, 1721, 1721,
+ /* 2790 */ 1721, 1721, 1721, 1721, 2116, 1721, 2084, 1721, 669, 1721,
+ /* 2800 */ 1721, 1721, 1721, 1721, 670, 1721, 1721, 1721, 1721, 2116,
+ /* 2810 */ 1721, 1721, 1721, 1721, 2115, 1721, 1721, 1721, 2151, 670,
+ /* 2820 */ 1721, 348, 2117, 673, 2119, 2120, 668, 1721, 663, 2115,
+ /* 2830 */ 2134, 1721, 1721, 2151, 1721, 1721, 353, 2117, 673, 2119,
+ /* 2840 */ 2120, 668, 2084, 663, 669, 2134, 1721, 1721, 1721, 1721,
+ /* 2850 */ 1721, 1721, 1721, 1721, 1721, 1721, 1721, 2084, 1721, 669,
+ /* 2860 */ 1721, 1721, 1721, 1721, 1721, 1721, 1721, 1721, 1721, 1721,
+ /* 2870 */ 1721, 1721, 1721, 1721, 1721, 671, 1721, 1721, 1721, 2151,
+ /* 2880 */ 1721, 1721, 328, 2117, 673, 2119, 2120, 668, 1721, 663,
+ /* 2890 */ 2115, 1721, 1721, 1721, 2151, 1721, 1721, 327, 2117, 673,
+ /* 2900 */ 2119, 2120, 668, 1721, 663,
};
static const YYCODETYPE yy_lookahead[] = {
- /* 0 */ 367, 333, 381, 398, 368, 367, 398, 402, 368, 332,
- /* 10 */ 341, 334, 12, 13, 14, 379, 366, 396, 397, 379,
- /* 20 */ 20, 445, 22, 8, 9, 449, 357, 12, 13, 14,
- /* 30 */ 15, 16, 366, 33, 366, 35, 0, 387, 388, 373,
- /* 40 */ 464, 465, 374, 374, 345, 469, 470, 379, 382, 381,
- /* 50 */ 445, 415, 416, 445, 449, 415, 416, 449, 58, 20,
- /* 60 */ 361, 445, 426, 365, 64, 449, 426, 381, 369, 464,
- /* 70 */ 465, 71, 464, 465, 469, 470, 378, 469, 470, 393,
- /* 80 */ 412, 465, 396, 397, 416, 469, 470, 419, 420, 421,
- /* 90 */ 422, 423, 424, 425, 426, 427, 428, 97, 35, 20,
- /* 100 */ 100, 14, 66, 67, 68, 69, 70, 20, 72, 73,
- /* 110 */ 74, 75, 76, 77, 78, 79, 80, 81, 82, 83,
- /* 120 */ 84, 85, 86, 87, 88, 89, 90, 91, 92, 20,
- /* 130 */ 337, 97, 339, 340, 71, 21, 136, 137, 24, 25,
- /* 140 */ 26, 27, 28, 29, 30, 31, 32, 113, 114, 115,
- /* 150 */ 116, 117, 118, 119, 120, 121, 122, 20, 124, 125,
- /* 160 */ 126, 127, 128, 129, 341, 100, 166, 167, 3, 20,
- /* 170 */ 8, 9, 172, 173, 12, 13, 14, 15, 16, 100,
- /* 180 */ 357, 337, 366, 339, 340, 20, 186, 364, 188, 373,
- /* 190 */ 20, 434, 435, 178, 20, 8, 9, 374, 382, 12,
- /* 200 */ 13, 14, 15, 16, 131, 8, 9, 168, 135, 12,
- /* 210 */ 13, 14, 15, 16, 333, 215, 216, 20, 218, 219,
+ /* 0 */ 333, 370, 383, 337, 400, 370, 340, 341, 404, 371,
+ /* 10 */ 343, 365, 12, 13, 14, 0, 371, 398, 399, 381,
+ /* 20 */ 20, 14, 22, 20, 8, 9, 381, 20, 12, 13,
+ /* 30 */ 14, 15, 16, 33, 0, 35, 369, 383, 20, 24,
+ /* 40 */ 25, 26, 27, 28, 29, 30, 31, 32, 381, 395,
+ /* 50 */ 383, 447, 398, 399, 450, 417, 418, 419, 412, 59,
+ /* 60 */ 44, 369, 417, 418, 419, 65, 428, 20, 376, 465,
+ /* 70 */ 466, 20, 72, 428, 470, 471, 384, 342, 343, 0,
+ /* 80 */ 337, 414, 348, 340, 341, 418, 436, 437, 421, 422,
+ /* 90 */ 423, 424, 425, 426, 332, 428, 334, 97, 364, 39,
+ /* 100 */ 100, 67, 68, 69, 70, 71, 372, 73, 74, 75,
+ /* 110 */ 76, 77, 78, 79, 80, 81, 82, 83, 84, 85,
+ /* 120 */ 86, 87, 88, 89, 90, 91, 92, 93, 461, 462,
+ /* 130 */ 379, 420, 97, 382, 383, 21, 136, 137, 24, 25,
+ /* 140 */ 26, 27, 28, 29, 30, 31, 32, 112, 113, 114,
+ /* 150 */ 115, 116, 117, 118, 119, 120, 121, 446, 123, 124,
+ /* 160 */ 125, 126, 127, 128, 369, 20, 166, 167, 447, 166,
+ /* 170 */ 167, 450, 172, 173, 369, 342, 343, 442, 443, 444,
+ /* 180 */ 445, 376, 447, 448, 389, 390, 186, 466, 188, 384,
+ /* 190 */ 330, 470, 471, 360, 130, 131, 64, 8, 9, 135,
+ /* 200 */ 367, 12, 13, 14, 15, 16, 59, 100, 129, 130,
+ /* 210 */ 131, 132, 133, 134, 135, 215, 216, 0, 218, 219,
/* 220 */ 220, 221, 222, 223, 224, 225, 226, 227, 228, 229,
- /* 230 */ 230, 231, 232, 233, 234, 235, 12, 13, 348, 63,
- /* 240 */ 341, 18, 341, 20, 20, 355, 22, 366, 333, 100,
- /* 250 */ 27, 64, 333, 30, 341, 374, 33, 33, 362, 35,
- /* 260 */ 379, 445, 381, 101, 398, 449, 101, 100, 195, 196,
- /* 270 */ 100, 48, 199, 50, 201, 374, 53, 20, 341, 368,
- /* 280 */ 464, 465, 58, 1, 2, 469, 470, 374, 64, 390,
- /* 290 */ 379, 392, 277, 412, 379, 71, 109, 416, 379, 20,
- /* 300 */ 419, 420, 421, 422, 423, 424, 410, 426, 20, 58,
- /* 310 */ 22, 445, 431, 347, 433, 449, 333, 252, 437, 438,
- /* 320 */ 383, 97, 99, 35, 100, 347, 415, 416, 417, 363,
- /* 330 */ 464, 465, 451, 168, 111, 469, 470, 426, 372, 51,
- /* 340 */ 459, 440, 441, 442, 443, 0, 445, 446, 20, 366,
- /* 350 */ 372, 100, 165, 102, 441, 442, 443, 374, 445, 446,
- /* 360 */ 136, 137, 379, 140, 381, 168, 143, 144, 145, 146,
+ /* 230 */ 230, 231, 232, 233, 234, 235, 12, 13, 181, 4,
+ /* 240 */ 20, 18, 100, 20, 20, 100, 22, 100, 20, 102,
+ /* 250 */ 27, 333, 447, 30, 65, 450, 33, 33, 369, 35,
+ /* 260 */ 400, 343, 205, 206, 404, 12, 13, 14, 15, 16,
+ /* 270 */ 465, 466, 49, 100, 51, 470, 471, 54, 43, 390,
+ /* 280 */ 45, 46, 368, 59, 67, 68, 69, 369, 0, 65,
+ /* 290 */ 100, 74, 75, 76, 380, 20, 72, 80, 109, 381,
+ /* 300 */ 110, 383, 85, 86, 87, 88, 20, 447, 91, 21,
+ /* 310 */ 450, 251, 24, 25, 26, 27, 28, 29, 30, 31,
+ /* 320 */ 32, 97, 99, 348, 100, 465, 466, 185, 3, 187,
+ /* 330 */ 470, 471, 414, 20, 111, 22, 418, 342, 343, 421,
+ /* 340 */ 422, 423, 424, 425, 426, 20, 428, 372, 35, 431,
+ /* 350 */ 342, 433, 434, 435, 165, 360, 214, 439, 440, 252,
+ /* 360 */ 136, 137, 367, 140, 20, 52, 143, 144, 145, 146,
/* 370 */ 147, 148, 149, 150, 151, 152, 153, 154, 155, 156,
- /* 380 */ 157, 158, 159, 101, 161, 162, 163, 380, 381, 44,
- /* 390 */ 166, 167, 333, 136, 137, 412, 172, 173, 21, 416,
- /* 400 */ 358, 252, 419, 420, 421, 422, 423, 424, 366, 426,
- /* 410 */ 186, 34, 188, 36, 431, 373, 433, 375, 171, 252,
- /* 420 */ 437, 438, 252, 430, 382, 432, 239, 240, 241, 242,
- /* 430 */ 243, 244, 245, 246, 247, 248, 249, 341, 379, 215,
- /* 440 */ 216, 63, 218, 219, 220, 221, 222, 223, 224, 225,
+ /* 380 */ 157, 158, 159, 338, 161, 162, 163, 342, 168, 344,
+ /* 390 */ 166, 167, 447, 385, 252, 450, 172, 173, 14, 252,
+ /* 400 */ 67, 68, 69, 64, 20, 382, 383, 74, 75, 76,
+ /* 410 */ 186, 466, 188, 80, 171, 470, 471, 0, 85, 86,
+ /* 420 */ 87, 88, 136, 137, 91, 252, 101, 35, 239, 240,
+ /* 430 */ 241, 242, 243, 244, 245, 246, 247, 248, 249, 215,
+ /* 440 */ 216, 166, 218, 219, 220, 221, 222, 223, 224, 225,
/* 450 */ 226, 227, 228, 229, 230, 231, 232, 233, 234, 235,
- /* 460 */ 236, 12, 13, 377, 136, 137, 380, 381, 20, 20,
- /* 470 */ 374, 22, 66, 67, 68, 215, 352, 353, 374, 73,
- /* 480 */ 74, 75, 33, 130, 35, 79, 333, 33, 333, 385,
- /* 490 */ 84, 85, 86, 87, 338, 20, 90, 341, 342, 0,
- /* 500 */ 172, 173, 48, 252, 257, 258, 259, 58, 54, 55,
- /* 510 */ 56, 57, 58, 64, 12, 13, 14, 15, 16, 341,
- /* 520 */ 71, 366, 262, 263, 264, 265, 266, 267, 268, 374,
- /* 530 */ 345, 341, 379, 4, 379, 357, 381, 441, 442, 443,
- /* 540 */ 338, 445, 446, 341, 342, 449, 97, 100, 366, 100,
- /* 550 */ 197, 198, 374, 99, 369, 373, 102, 14, 352, 353,
- /* 560 */ 464, 465, 366, 20, 382, 469, 470, 412, 18, 0,
- /* 570 */ 374, 416, 0, 23, 419, 420, 421, 422, 423, 424,
- /* 580 */ 390, 426, 392, 3, 112, 136, 137, 37, 38, 181,
- /* 590 */ 21, 41, 0, 24, 25, 26, 27, 28, 29, 30,
- /* 600 */ 31, 32, 130, 131, 132, 133, 134, 135, 111, 59,
- /* 610 */ 60, 61, 62, 205, 206, 166, 167, 421, 14, 15,
- /* 620 */ 16, 172, 173, 169, 170, 236, 471, 472, 174, 100,
- /* 630 */ 176, 112, 185, 366, 187, 186, 358, 188, 66, 67,
- /* 640 */ 68, 166, 167, 341, 366, 73, 74, 75, 194, 368,
- /* 650 */ 100, 79, 133, 375, 155, 388, 84, 85, 86, 87,
- /* 660 */ 379, 214, 90, 164, 215, 216, 71, 218, 219, 220,
+ /* 460 */ 236, 12, 13, 33, 72, 22, 351, 20, 338, 20,
+ /* 470 */ 333, 22, 342, 358, 344, 215, 111, 20, 35, 49,
+ /* 480 */ 343, 64, 33, 81, 35, 55, 56, 57, 58, 59,
+ /* 490 */ 420, 8, 9, 168, 333, 12, 13, 14, 15, 16,
+ /* 500 */ 257, 258, 259, 20, 20, 4, 369, 371, 59, 355,
+ /* 510 */ 356, 72, 20, 343, 65, 72, 446, 381, 381, 342,
+ /* 520 */ 383, 72, 262, 263, 264, 265, 266, 267, 268, 99,
+ /* 530 */ 8, 9, 102, 236, 12, 13, 14, 15, 16, 369,
+ /* 540 */ 97, 369, 381, 141, 142, 13, 97, 333, 376, 100,
+ /* 550 */ 166, 414, 165, 417, 418, 418, 384, 100, 421, 422,
+ /* 560 */ 423, 424, 425, 426, 428, 428, 164, 35, 18, 392,
+ /* 570 */ 433, 394, 435, 23, 8, 9, 439, 440, 12, 13,
+ /* 580 */ 14, 15, 16, 136, 137, 136, 137, 37, 38, 452,
+ /* 590 */ 333, 41, 100, 423, 4, 381, 20, 460, 22, 169,
+ /* 600 */ 170, 100, 350, 342, 174, 236, 176, 238, 420, 19,
+ /* 610 */ 60, 61, 62, 63, 111, 166, 167, 361, 366, 172,
+ /* 620 */ 173, 172, 173, 33, 194, 369, 239, 375, 52, 186,
+ /* 630 */ 72, 188, 376, 377, 446, 186, 249, 188, 381, 49,
+ /* 640 */ 384, 0, 342, 343, 54, 342, 343, 369, 333, 59,
+ /* 650 */ 100, 168, 168, 392, 376, 394, 371, 129, 215, 216,
+ /* 660 */ 360, 133, 384, 360, 215, 216, 381, 218, 219, 220,
/* 670 */ 221, 222, 223, 224, 225, 226, 227, 228, 229, 230,
- /* 680 */ 231, 232, 233, 234, 235, 12, 13, 14, 138, 0,
- /* 690 */ 333, 333, 390, 20, 392, 22, 415, 416, 417, 252,
- /* 700 */ 236, 333, 238, 330, 112, 367, 33, 426, 35, 166,
- /* 710 */ 20, 4, 22, 24, 25, 26, 27, 28, 29, 30,
- /* 720 */ 31, 32, 130, 131, 132, 133, 134, 135, 178, 179,
- /* 730 */ 180, 58, 341, 183, 366, 341, 379, 379, 45, 46,
- /* 740 */ 333, 51, 374, 341, 71, 111, 80, 379, 357, 381,
- /* 750 */ 43, 357, 45, 46, 204, 364, 22, 207, 71, 357,
- /* 760 */ 210, 211, 212, 213, 214, 374, 368, 366, 374, 35,
- /* 770 */ 97, 398, 22, 100, 373, 402, 374, 379, 0, 333,
- /* 780 */ 412, 252, 47, 382, 416, 35, 379, 419, 420, 421,
- /* 790 */ 422, 423, 424, 430, 426, 432, 367, 429, 14, 431,
- /* 800 */ 432, 433, 252, 341, 20, 437, 438, 141, 142, 136,
- /* 810 */ 137, 341, 366, 415, 416, 417, 366, 366, 445, 357,
- /* 820 */ 374, 71, 449, 373, 426, 379, 375, 381, 130, 131,
- /* 830 */ 164, 97, 382, 135, 58, 100, 374, 464, 465, 166,
- /* 840 */ 167, 63, 469, 470, 374, 172, 173, 97, 341, 8,
- /* 850 */ 9, 20, 272, 12, 13, 14, 15, 16, 412, 186,
- /* 860 */ 22, 188, 416, 358, 357, 419, 420, 421, 422, 423,
- /* 870 */ 424, 366, 426, 35, 333, 99, 20, 431, 102, 433,
- /* 880 */ 375, 374, 333, 437, 438, 44, 398, 165, 215, 216,
- /* 890 */ 4, 218, 219, 220, 221, 222, 223, 224, 225, 226,
+ /* 680 */ 231, 232, 233, 234, 235, 12, 13, 14, 138, 99,
+ /* 690 */ 369, 333, 102, 20, 370, 22, 381, 376, 342, 343,
+ /* 700 */ 178, 343, 417, 418, 419, 384, 33, 333, 35, 252,
+ /* 710 */ 357, 2, 359, 428, 342, 343, 360, 8, 9, 342,
+ /* 720 */ 343, 12, 13, 14, 15, 16, 358, 369, 178, 179,
+ /* 730 */ 180, 350, 59, 183, 168, 355, 356, 360, 342, 381,
+ /* 740 */ 370, 383, 8, 9, 252, 72, 12, 13, 14, 15,
+ /* 750 */ 16, 342, 343, 252, 204, 381, 375, 207, 0, 343,
+ /* 760 */ 210, 211, 212, 213, 214, 14, 333, 342, 343, 360,
+ /* 770 */ 97, 20, 414, 100, 342, 343, 418, 333, 333, 421,
+ /* 780 */ 422, 423, 424, 425, 426, 360, 428, 343, 392, 345,
+ /* 790 */ 394, 433, 360, 435, 2, 4, 333, 439, 440, 277,
+ /* 800 */ 8, 9, 252, 387, 12, 13, 14, 15, 16, 136,
+ /* 810 */ 137, 342, 343, 369, 381, 443, 444, 445, 460, 447,
+ /* 820 */ 448, 21, 450, 342, 343, 381, 381, 383, 370, 360,
+ /* 830 */ 20, 342, 343, 59, 34, 101, 36, 465, 466, 166,
+ /* 840 */ 167, 343, 470, 471, 381, 172, 173, 8, 9, 360,
+ /* 850 */ 209, 12, 13, 14, 15, 16, 0, 431, 414, 186,
+ /* 860 */ 434, 188, 418, 342, 343, 421, 422, 423, 424, 425,
+ /* 870 */ 426, 369, 428, 99, 131, 370, 102, 433, 135, 435,
+ /* 880 */ 37, 360, 369, 439, 440, 387, 384, 400, 215, 216,
+ /* 890 */ 377, 218, 219, 220, 221, 222, 223, 224, 225, 226,
/* 900 */ 227, 228, 229, 230, 231, 232, 233, 234, 235, 12,
- /* 910 */ 13, 441, 442, 443, 358, 445, 446, 20, 341, 22,
- /* 920 */ 379, 333, 366, 403, 250, 251, 341, 333, 379, 111,
- /* 930 */ 33, 375, 35, 445, 357, 97, 186, 449, 188, 8,
- /* 940 */ 9, 4, 357, 12, 13, 14, 15, 16, 418, 367,
- /* 950 */ 166, 374, 464, 465, 366, 58, 19, 469, 470, 374,
- /* 960 */ 333, 239, 374, 418, 0, 215, 216, 379, 71, 381,
- /* 970 */ 33, 249, 333, 379, 444, 8, 9, 374, 160, 12,
- /* 980 */ 13, 14, 15, 16, 354, 48, 356, 341, 385, 444,
- /* 990 */ 53, 333, 39, 44, 97, 58, 333, 100, 333, 168,
- /* 1000 */ 412, 20, 333, 357, 416, 333, 379, 419, 420, 421,
- /* 1010 */ 422, 423, 424, 333, 426, 333, 333, 2, 379, 431,
- /* 1020 */ 374, 433, 166, 8, 9, 437, 438, 12, 13, 14,
- /* 1030 */ 15, 16, 101, 136, 137, 0, 99, 379, 366, 102,
- /* 1040 */ 429, 341, 379, 432, 379, 374, 374, 459, 379, 341,
- /* 1050 */ 101, 379, 366, 381, 22, 418, 385, 357, 42, 379,
- /* 1060 */ 44, 379, 379, 166, 167, 357, 2, 35, 382, 172,
- /* 1070 */ 173, 341, 8, 9, 374, 44, 12, 13, 14, 15,
- /* 1080 */ 16, 444, 374, 186, 412, 188, 376, 357, 416, 379,
- /* 1090 */ 0, 419, 420, 421, 422, 423, 424, 376, 426, 376,
- /* 1100 */ 379, 44, 379, 431, 374, 433, 44, 333, 359, 437,
- /* 1110 */ 438, 362, 215, 216, 13, 218, 219, 220, 221, 222,
+ /* 910 */ 13, 333, 432, 155, 434, 342, 343, 20, 333, 22,
+ /* 920 */ 333, 343, 164, 345, 443, 444, 445, 59, 447, 448,
+ /* 930 */ 33, 333, 35, 360, 447, 45, 46, 450, 195, 196,
+ /* 940 */ 101, 343, 199, 432, 201, 434, 103, 369, 105, 106,
+ /* 950 */ 333, 108, 465, 466, 14, 334, 59, 470, 471, 381,
+ /* 960 */ 20, 383, 342, 343, 342, 343, 381, 369, 381, 72,
+ /* 970 */ 102, 22, 129, 14, 15, 16, 133, 3, 168, 381,
+ /* 980 */ 360, 383, 360, 371, 35, 129, 130, 131, 132, 133,
+ /* 990 */ 134, 135, 414, 381, 97, 400, 418, 100, 381, 421,
+ /* 1000 */ 422, 423, 424, 425, 426, 333, 428, 400, 1, 2,
+ /* 1010 */ 333, 433, 414, 435, 333, 343, 418, 439, 440, 421,
+ /* 1020 */ 422, 423, 424, 425, 426, 427, 428, 429, 430, 417,
+ /* 1030 */ 418, 8, 9, 136, 137, 12, 13, 14, 15, 16,
+ /* 1040 */ 428, 369, 447, 361, 253, 450, 97, 343, 44, 342,
+ /* 1050 */ 343, 369, 65, 381, 447, 383, 370, 450, 381, 377,
+ /* 1060 */ 465, 466, 381, 166, 167, 470, 471, 360, 378, 172,
+ /* 1070 */ 173, 381, 465, 466, 250, 251, 361, 470, 471, 136,
+ /* 1080 */ 137, 342, 343, 186, 369, 188, 414, 342, 343, 22,
+ /* 1090 */ 418, 387, 377, 421, 422, 423, 424, 425, 426, 360,
+ /* 1100 */ 428, 400, 35, 342, 343, 360, 166, 42, 101, 44,
+ /* 1110 */ 130, 378, 215, 216, 381, 218, 219, 220, 221, 222,
/* 1120 */ 223, 224, 225, 226, 227, 228, 229, 230, 231, 232,
- /* 1130 */ 233, 234, 235, 12, 13, 168, 35, 96, 48, 253,
- /* 1140 */ 366, 20, 341, 22, 200, 341, 202, 112, 374, 168,
- /* 1150 */ 42, 44, 44, 379, 33, 381, 35, 104, 357, 398,
- /* 1160 */ 107, 357, 367, 101, 367, 130, 131, 132, 133, 134,
- /* 1170 */ 135, 104, 37, 209, 107, 374, 8, 9, 374, 58,
- /* 1180 */ 12, 13, 14, 15, 16, 104, 412, 341, 107, 58,
- /* 1190 */ 416, 44, 71, 419, 420, 421, 422, 423, 424, 341,
- /* 1200 */ 426, 341, 355, 357, 251, 431, 445, 433, 101, 168,
- /* 1210 */ 449, 437, 438, 333, 35, 357, 44, 357, 97, 341,
- /* 1220 */ 374, 100, 448, 0, 104, 464, 465, 107, 0, 44,
- /* 1230 */ 469, 470, 374, 102, 374, 357, 333, 35, 103, 100,
- /* 1240 */ 105, 106, 0, 108, 13, 22, 366, 112, 101, 110,
- /* 1250 */ 22, 445, 374, 44, 374, 449, 334, 136, 137, 379,
- /* 1260 */ 389, 381, 136, 137, 22, 473, 35, 13, 133, 366,
- /* 1270 */ 462, 465, 64, 101, 44, 469, 470, 374, 44, 1,
- /* 1280 */ 2, 44, 379, 343, 381, 456, 101, 166, 167, 35,
- /* 1290 */ 366, 343, 412, 172, 173, 389, 416, 340, 35, 419,
- /* 1300 */ 420, 421, 422, 423, 424, 274, 426, 186, 44, 188,
- /* 1310 */ 101, 44, 378, 433, 44, 412, 44, 437, 438, 416,
- /* 1320 */ 44, 44, 419, 420, 421, 422, 423, 424, 333, 426,
- /* 1330 */ 389, 101, 44, 276, 71, 101, 215, 216, 101, 218,
+ /* 1130 */ 233, 234, 235, 12, 13, 342, 343, 342, 343, 333,
+ /* 1140 */ 333, 20, 361, 22, 472, 473, 333, 333, 447, 0,
+ /* 1150 */ 369, 450, 333, 360, 33, 360, 35, 343, 377, 345,
+ /* 1160 */ 44, 44, 22, 333, 97, 333, 465, 466, 0, 405,
+ /* 1170 */ 362, 470, 471, 365, 333, 35, 378, 197, 198, 381,
+ /* 1180 */ 59, 111, 104, 369, 343, 107, 345, 381, 381, 42,
+ /* 1190 */ 200, 44, 202, 72, 381, 381, 447, 383, 49, 450,
+ /* 1200 */ 381, 48, 215, 13, 443, 444, 445, 0, 447, 448,
+ /* 1210 */ 369, 381, 44, 381, 465, 466, 391, 101, 97, 470,
+ /* 1220 */ 471, 100, 381, 104, 383, 35, 107, 474, 414, 22,
+ /* 1230 */ 160, 35, 418, 44, 333, 421, 422, 423, 424, 425,
+ /* 1240 */ 426, 35, 428, 463, 343, 104, 272, 433, 107, 435,
+ /* 1250 */ 0, 0, 346, 439, 440, 414, 44, 136, 137, 418,
+ /* 1260 */ 44, 13, 421, 422, 423, 424, 425, 426, 104, 428,
+ /* 1270 */ 369, 107, 22, 22, 433, 44, 435, 44, 274, 457,
+ /* 1280 */ 439, 440, 381, 35, 383, 47, 369, 166, 167, 391,
+ /* 1290 */ 101, 35, 346, 172, 173, 341, 129, 130, 131, 132,
+ /* 1300 */ 133, 134, 135, 1, 2, 44, 343, 186, 44, 188,
+ /* 1310 */ 380, 44, 391, 101, 44, 414, 44, 101, 44, 418,
+ /* 1320 */ 449, 168, 421, 422, 423, 424, 425, 426, 72, 428,
+ /* 1330 */ 44, 0, 101, 44, 101, 44, 215, 216, 100, 218,
/* 1340 */ 219, 220, 221, 222, 223, 224, 225, 226, 227, 228,
- /* 1350 */ 229, 230, 231, 232, 233, 234, 235, 13, 447, 466,
- /* 1360 */ 439, 366, 450, 460, 461, 101, 254, 188, 101, 374,
- /* 1370 */ 44, 101, 44, 101, 379, 414, 381, 101, 101, 35,
- /* 1380 */ 44, 0, 48, 413, 184, 400, 386, 42, 20, 101,
- /* 1390 */ 188, 389, 386, 384, 165, 341, 20, 341, 333, 386,
- /* 1400 */ 98, 384, 384, 351, 95, 350, 94, 412, 349, 341,
- /* 1410 */ 341, 416, 341, 341, 419, 420, 421, 422, 423, 424,
- /* 1420 */ 20, 426, 335, 215, 335, 20, 431, 101, 433, 101,
- /* 1430 */ 49, 366, 437, 438, 407, 347, 20, 101, 347, 374,
- /* 1440 */ 20, 381, 342, 448, 379, 20, 381, 399, 342, 333,
- /* 1450 */ 347, 347, 347, 52, 341, 344, 347, 347, 344, 335,
- /* 1460 */ 366, 366, 366, 366, 366, 366, 341, 335, 366, 203,
- /* 1470 */ 100, 379, 379, 192, 411, 409, 406, 412, 345, 405,
- /* 1480 */ 407, 416, 366, 366, 419, 420, 421, 422, 423, 424,
- /* 1490 */ 374, 426, 191, 366, 366, 379, 431, 381, 433, 12,
- /* 1500 */ 13, 379, 437, 438, 366, 345, 190, 341, 389, 22,
- /* 1510 */ 381, 261, 389, 448, 269, 379, 455, 260, 177, 404,
- /* 1520 */ 33, 379, 35, 379, 333, 379, 271, 278, 412, 270,
- /* 1530 */ 455, 394, 416, 457, 394, 419, 420, 421, 422, 423,
- /* 1540 */ 424, 458, 426, 275, 255, 58, 468, 431, 273, 433,
- /* 1550 */ 251, 474, 467, 437, 438, 374, 20, 366, 71, 414,
- /* 1560 */ 341, 418, 342, 345, 448, 374, 345, 20, 392, 394,
- /* 1570 */ 379, 379, 381, 455, 379, 379, 379, 379, 394, 170,
- /* 1580 */ 379, 391, 100, 453, 97, 345, 362, 374, 454, 345,
- /* 1590 */ 436, 379, 100, 452, 356, 370, 345, 341, 36, 395,
- /* 1600 */ 401, 336, 408, 412, 335, 395, 360, 416, 360, 1,
- /* 1610 */ 419, 420, 421, 422, 423, 424, 331, 426, 360, 346,
- /* 1620 */ 0, 0, 431, 0, 433, 42, 0, 19, 437, 438,
- /* 1630 */ 35, 208, 35, 35, 35, 208, 0, 35, 35, 448,
- /* 1640 */ 208, 33, 0, 333, 208, 0, 35, 0, 0, 22,
- /* 1650 */ 35, 195, 188, 186, 0, 0, 48, 0, 182, 181,
- /* 1660 */ 0, 0, 54, 55, 56, 57, 58, 0, 0, 47,
- /* 1670 */ 0, 42, 0, 186, 0, 188, 366, 155, 35, 0,
- /* 1680 */ 155, 0, 0, 0, 374, 0, 0, 0, 0, 379,
- /* 1690 */ 0, 381, 0, 0, 0, 0, 0, 0, 0, 0,
- /* 1700 */ 0, 0, 215, 216, 0, 0, 0, 99, 333, 0,
- /* 1710 */ 102, 42, 0, 0, 0, 228, 229, 230, 231, 232,
- /* 1720 */ 233, 234, 412, 0, 0, 0, 416, 0, 0, 419,
- /* 1730 */ 420, 421, 422, 423, 424, 0, 426, 22, 0, 139,
- /* 1740 */ 0, 366, 134, 433, 22, 96, 96, 437, 438, 374,
- /* 1750 */ 0, 22, 35, 0, 379, 0, 381, 0, 0, 39,
- /* 1760 */ 58, 42, 44, 47, 0, 58, 58, 0, 14, 39,
- /* 1770 */ 14, 0, 0, 333, 40, 39, 0, 169, 47, 47,
- /* 1780 */ 0, 0, 174, 177, 0, 0, 65, 412, 39, 48,
- /* 1790 */ 0, 416, 48, 0, 419, 420, 421, 422, 423, 424,
- /* 1800 */ 35, 426, 194, 35, 35, 39, 366, 48, 433, 39,
- /* 1810 */ 0, 48, 437, 438, 374, 0, 39, 35, 0, 379,
- /* 1820 */ 0, 381, 0, 35, 333, 22, 0, 35, 22, 35,
- /* 1830 */ 44, 35, 35, 35, 35, 109, 35, 35, 0, 35,
- /* 1840 */ 107, 22, 35, 333, 44, 0, 22, 0, 35, 22,
- /* 1850 */ 0, 35, 412, 0, 0, 50, 416, 366, 35, 419,
- /* 1860 */ 420, 421, 422, 423, 424, 374, 426, 35, 22, 20,
- /* 1870 */ 379, 35, 381, 433, 35, 100, 366, 0, 438, 101,
- /* 1880 */ 22, 0, 193, 100, 374, 22, 35, 0, 0, 379,
- /* 1890 */ 256, 381, 3, 256, 3, 256, 44, 0, 0, 189,
- /* 1900 */ 44, 44, 35, 412, 95, 168, 44, 416, 100, 170,
- /* 1910 */ 419, 420, 421, 422, 423, 424, 168, 426, 333, 168,
- /* 1920 */ 175, 100, 412, 47, 96, 47, 416, 98, 44, 419,
- /* 1930 */ 420, 421, 422, 423, 424, 101, 426, 333, 96, 44,
- /* 1940 */ 35, 101, 101, 100, 100, 35, 35, 35, 100, 35,
- /* 1950 */ 47, 366, 461, 44, 47, 0, 101, 0, 171, 374,
- /* 1960 */ 100, 250, 101, 39, 379, 101, 381, 101, 47, 101,
- /* 1970 */ 366, 100, 100, 463, 101, 371, 101, 0, 374, 100,
- /* 1980 */ 100, 39, 100, 379, 110, 381, 169, 47, 44, 237,
- /* 1990 */ 2, 98, 100, 22, 98, 101, 47, 412, 47, 100,
- /* 2000 */ 100, 416, 101, 101, 419, 420, 421, 422, 423, 424,
- /* 2010 */ 333, 426, 22, 100, 35, 100, 412, 100, 35, 101,
- /* 2020 */ 416, 35, 100, 419, 420, 421, 422, 423, 424, 215,
- /* 2030 */ 426, 111, 101, 100, 35, 101, 333, 100, 35, 101,
- /* 2040 */ 101, 100, 35, 366, 101, 100, 100, 217, 123, 123,
- /* 2050 */ 123, 374, 123, 22, 100, 44, 379, 472, 381, 112,
- /* 2060 */ 100, 35, 100, 22, 35, 65, 64, 35, 35, 366,
- /* 2070 */ 35, 35, 71, 35, 371, 35, 22, 374, 35, 35,
- /* 2080 */ 35, 35, 379, 44, 381, 93, 35, 35, 35, 412,
- /* 2090 */ 35, 35, 71, 416, 35, 35, 419, 420, 421, 422,
- /* 2100 */ 423, 424, 35, 426, 35, 428, 35, 333, 22, 35,
- /* 2110 */ 0, 35, 48, 0, 39, 412, 35, 39, 48, 416,
- /* 2120 */ 0, 48, 419, 420, 421, 422, 423, 424, 333, 426,
- /* 2130 */ 35, 39, 0, 48, 35, 39, 0, 35, 35, 0,
- /* 2140 */ 366, 22, 21, 20, 22, 371, 22, 21, 374, 475,
- /* 2150 */ 475, 475, 475, 379, 475, 381, 475, 475, 333, 475,
- /* 2160 */ 475, 366, 475, 475, 475, 475, 475, 475, 475, 374,
- /* 2170 */ 475, 475, 475, 475, 379, 475, 381, 475, 475, 475,
- /* 2180 */ 475, 475, 475, 475, 475, 475, 412, 475, 475, 475,
- /* 2190 */ 416, 366, 475, 419, 420, 421, 422, 423, 424, 374,
- /* 2200 */ 426, 475, 475, 475, 379, 475, 381, 412, 475, 475,
- /* 2210 */ 475, 416, 475, 475, 419, 420, 421, 422, 423, 424,
- /* 2220 */ 475, 426, 475, 333, 475, 475, 475, 475, 475, 475,
- /* 2230 */ 475, 475, 475, 475, 475, 475, 475, 412, 475, 475,
- /* 2240 */ 475, 416, 475, 475, 419, 420, 421, 422, 423, 424,
- /* 2250 */ 475, 426, 333, 475, 475, 475, 366, 475, 475, 475,
- /* 2260 */ 475, 475, 475, 475, 374, 475, 475, 475, 475, 379,
- /* 2270 */ 475, 381, 475, 475, 475, 475, 475, 475, 475, 475,
- /* 2280 */ 475, 475, 475, 475, 475, 366, 333, 475, 475, 475,
- /* 2290 */ 475, 475, 475, 374, 475, 475, 475, 475, 379, 475,
- /* 2300 */ 381, 475, 412, 475, 475, 475, 416, 475, 475, 419,
- /* 2310 */ 420, 421, 422, 423, 424, 475, 426, 475, 475, 366,
- /* 2320 */ 475, 475, 475, 475, 475, 475, 475, 374, 475, 475,
- /* 2330 */ 475, 412, 379, 475, 381, 416, 475, 475, 419, 420,
- /* 2340 */ 421, 422, 423, 424, 475, 426, 475, 475, 475, 475,
- /* 2350 */ 333, 475, 475, 475, 475, 475, 475, 475, 475, 475,
- /* 2360 */ 475, 475, 475, 475, 475, 412, 475, 475, 475, 416,
- /* 2370 */ 333, 475, 419, 420, 421, 422, 423, 424, 475, 426,
- /* 2380 */ 475, 475, 475, 366, 475, 475, 475, 475, 475, 475,
- /* 2390 */ 475, 374, 475, 475, 475, 475, 379, 475, 381, 475,
- /* 2400 */ 475, 475, 475, 366, 475, 475, 475, 475, 475, 475,
- /* 2410 */ 475, 374, 475, 475, 475, 475, 379, 475, 381, 475,
- /* 2420 */ 475, 475, 475, 475, 475, 475, 475, 475, 475, 412,
- /* 2430 */ 475, 333, 475, 416, 475, 475, 419, 420, 421, 422,
- /* 2440 */ 423, 424, 475, 426, 475, 475, 475, 475, 475, 412,
- /* 2450 */ 475, 475, 475, 416, 475, 475, 419, 420, 421, 422,
- /* 2460 */ 423, 424, 475, 426, 366, 475, 475, 475, 475, 475,
- /* 2470 */ 475, 475, 374, 475, 475, 475, 475, 379, 475, 381,
- /* 2480 */ 475, 475, 333, 475, 475, 475, 475, 475, 475, 475,
- /* 2490 */ 475, 475, 475, 475, 475, 475, 475, 475, 475, 475,
- /* 2500 */ 475, 475, 475, 333, 475, 475, 475, 475, 475, 475,
- /* 2510 */ 412, 475, 475, 475, 416, 366, 475, 419, 420, 421,
- /* 2520 */ 422, 423, 424, 374, 426, 475, 475, 475, 379, 475,
- /* 2530 */ 381, 475, 475, 333, 475, 475, 366, 475, 475, 475,
- /* 2540 */ 475, 475, 475, 475, 374, 475, 475, 475, 475, 379,
- /* 2550 */ 475, 381, 475, 475, 475, 475, 475, 475, 475, 475,
- /* 2560 */ 475, 412, 475, 475, 475, 416, 366, 475, 419, 420,
- /* 2570 */ 421, 422, 423, 424, 374, 426, 475, 475, 475, 379,
- /* 2580 */ 475, 381, 412, 475, 475, 475, 416, 475, 475, 419,
- /* 2590 */ 420, 421, 422, 423, 424, 475, 426, 475, 333, 475,
- /* 2600 */ 475, 475, 475, 475, 475, 475, 475, 475, 475, 475,
- /* 2610 */ 475, 475, 412, 475, 475, 475, 416, 475, 475, 419,
- /* 2620 */ 420, 421, 422, 423, 424, 475, 426, 333, 475, 475,
- /* 2630 */ 475, 366, 475, 475, 475, 475, 475, 475, 475, 374,
- /* 2640 */ 475, 475, 475, 475, 379, 475, 381, 475, 475, 475,
- /* 2650 */ 475, 475, 475, 475, 475, 475, 475, 475, 475, 475,
- /* 2660 */ 366, 333, 475, 475, 475, 475, 475, 475, 374, 475,
- /* 2670 */ 475, 475, 475, 379, 475, 381, 475, 412, 475, 475,
- /* 2680 */ 475, 416, 475, 475, 419, 420, 421, 422, 423, 424,
- /* 2690 */ 475, 426, 475, 475, 366, 475, 475, 475, 475, 475,
- /* 2700 */ 475, 475, 374, 475, 475, 475, 412, 379, 475, 381,
- /* 2710 */ 416, 475, 475, 419, 420, 421, 422, 423, 424, 475,
- /* 2720 */ 426, 475, 475, 475, 475, 333, 475, 475, 475, 475,
- /* 2730 */ 475, 475, 475, 475, 475, 475, 475, 475, 475, 475,
- /* 2740 */ 412, 475, 475, 475, 416, 333, 475, 419, 420, 421,
- /* 2750 */ 422, 423, 424, 475, 426, 475, 475, 475, 366, 475,
- /* 2760 */ 475, 475, 475, 475, 475, 475, 374, 475, 475, 475,
- /* 2770 */ 475, 379, 475, 381, 475, 475, 475, 475, 366, 475,
- /* 2780 */ 475, 475, 475, 475, 475, 475, 374, 475, 475, 475,
- /* 2790 */ 475, 379, 475, 381, 475, 475, 475, 475, 475, 475,
- /* 2800 */ 475, 475, 475, 475, 412, 475, 333, 475, 416, 475,
- /* 2810 */ 475, 419, 420, 421, 422, 423, 424, 475, 426, 475,
- /* 2820 */ 475, 475, 475, 475, 412, 475, 475, 475, 416, 475,
- /* 2830 */ 475, 419, 420, 421, 422, 423, 424, 475, 426, 366,
- /* 2840 */ 475, 475, 475, 475, 475, 475, 475, 374, 475, 475,
- /* 2850 */ 475, 475, 379, 475, 381, 475, 475, 333, 475, 475,
- /* 2860 */ 475, 475, 475, 475, 475, 475, 475, 475, 475, 475,
- /* 2870 */ 475, 475, 475, 475, 475, 475, 475, 475, 333, 475,
- /* 2880 */ 475, 475, 475, 475, 475, 412, 475, 475, 475, 416,
- /* 2890 */ 366, 475, 419, 420, 421, 422, 423, 424, 374, 426,
- /* 2900 */ 475, 475, 475, 379, 475, 381, 475, 475, 333, 475,
- /* 2910 */ 475, 366, 475, 475, 475, 475, 475, 475, 475, 374,
- /* 2920 */ 475, 475, 475, 475, 379, 475, 381, 475, 475, 475,
- /* 2930 */ 475, 475, 475, 475, 475, 475, 412, 475, 475, 475,
- /* 2940 */ 416, 366, 475, 419, 420, 421, 422, 423, 424, 374,
- /* 2950 */ 426, 475, 475, 475, 379, 475, 381, 412, 475, 475,
- /* 2960 */ 475, 416, 475, 475, 419, 420, 421, 422, 423, 424,
- /* 2970 */ 475, 426, 475, 333, 475, 475, 475, 475, 475, 475,
- /* 2980 */ 475, 475, 475, 475, 475, 475, 475, 412, 475, 475,
- /* 2990 */ 475, 416, 475, 475, 419, 420, 421, 422, 423, 424,
- /* 3000 */ 475, 426, 333, 475, 475, 475, 366, 475, 475, 475,
- /* 3010 */ 475, 475, 475, 475, 374, 475, 475, 475, 475, 379,
- /* 3020 */ 475, 381, 475, 475, 475, 475, 475, 475, 475, 475,
- /* 3030 */ 475, 475, 475, 475, 475, 366, 475, 475, 475, 475,
- /* 3040 */ 475, 475, 475, 374, 475, 475, 475, 475, 379, 475,
- /* 3050 */ 381, 475, 412, 475, 475, 475, 416, 475, 475, 419,
- /* 3060 */ 420, 421, 422, 423, 424, 475, 426, 475, 475, 475,
- /* 3070 */ 475, 475, 475, 475, 475, 475, 475, 475, 475, 475,
- /* 3080 */ 475, 412, 475, 475, 475, 416, 475, 475, 419, 420,
- /* 3090 */ 421, 422, 423, 424, 475, 426,
+ /* 1350 */ 229, 230, 231, 232, 233, 234, 235, 441, 467, 12,
+ /* 1360 */ 13, 44, 101, 462, 44, 101, 44, 333, 101, 22,
+ /* 1370 */ 44, 101, 44, 101, 13, 101, 451, 343, 254, 345,
+ /* 1380 */ 33, 50, 35, 416, 188, 49, 415, 101, 184, 388,
+ /* 1390 */ 101, 402, 101, 276, 188, 42, 35, 333, 20, 391,
+ /* 1400 */ 388, 165, 386, 369, 20, 342, 59, 343, 342, 345,
+ /* 1410 */ 388, 386, 386, 98, 354, 381, 342, 383, 101, 72,
+ /* 1420 */ 96, 101, 353, 101, 95, 352, 342, 101, 342, 101,
+ /* 1430 */ 342, 20, 335, 369, 48, 339, 335, 339, 20, 409,
+ /* 1440 */ 350, 20, 383, 350, 97, 381, 20, 383, 414, 344,
+ /* 1450 */ 20, 401, 418, 350, 344, 421, 422, 423, 424, 425,
+ /* 1460 */ 426, 350, 428, 350, 350, 333, 53, 433, 342, 435,
+ /* 1470 */ 350, 335, 347, 439, 440, 343, 347, 369, 414, 335,
+ /* 1480 */ 381, 369, 418, 381, 369, 421, 422, 423, 424, 425,
+ /* 1490 */ 426, 369, 428, 342, 413, 203, 369, 433, 100, 435,
+ /* 1500 */ 369, 369, 369, 439, 440, 411, 369, 369, 369, 381,
+ /* 1510 */ 348, 369, 408, 381, 191, 383, 409, 192, 383, 348,
+ /* 1520 */ 190, 342, 269, 261, 456, 407, 260, 381, 456, 406,
+ /* 1530 */ 396, 381, 177, 186, 391, 188, 391, 381, 381, 459,
+ /* 1540 */ 458, 456, 271, 270, 396, 454, 414, 455, 255, 273,
+ /* 1550 */ 418, 475, 275, 421, 422, 423, 424, 425, 426, 453,
+ /* 1560 */ 428, 278, 215, 216, 469, 433, 343, 435, 416, 251,
+ /* 1570 */ 20, 439, 440, 333, 420, 228, 229, 230, 231, 232,
+ /* 1580 */ 233, 234, 348, 343, 342, 344, 20, 348, 394, 396,
+ /* 1590 */ 381, 381, 381, 333, 381, 381, 396, 170, 468, 381,
+ /* 1600 */ 348, 393, 365, 343, 100, 348, 343, 438, 100, 369,
+ /* 1610 */ 381, 342, 36, 359, 0, 336, 373, 335, 403, 397,
+ /* 1620 */ 0, 381, 397, 383, 0, 331, 348, 410, 363, 369,
+ /* 1630 */ 349, 363, 42, 0, 35, 35, 208, 35, 363, 35,
+ /* 1640 */ 208, 381, 35, 383, 0, 35, 208, 0, 208, 0,
+ /* 1650 */ 35, 0, 22, 0, 414, 195, 35, 188, 418, 186,
+ /* 1660 */ 0, 421, 422, 423, 424, 425, 426, 0, 428, 0,
+ /* 1670 */ 182, 181, 0, 433, 414, 435, 47, 333, 418, 439,
+ /* 1680 */ 440, 421, 422, 423, 424, 425, 426, 343, 428, 0,
+ /* 1690 */ 0, 0, 0, 433, 42, 435, 0, 0, 0, 439,
+ /* 1700 */ 440, 333, 0, 0, 0, 0, 0, 155, 35, 0,
+ /* 1710 */ 155, 343, 0, 369, 0, 0, 0, 0, 0, 0,
+ /* 1720 */ 0, 0, 0, 0, 0, 381, 0, 383, 0, 0,
+ /* 1730 */ 0, 0, 0, 0, 0, 42, 0, 369, 0, 0,
+ /* 1740 */ 0, 0, 139, 0, 0, 0, 59, 22, 48, 381,
+ /* 1750 */ 0, 383, 0, 59, 59, 48, 0, 22, 414, 22,
+ /* 1760 */ 0, 14, 418, 177, 0, 421, 422, 423, 424, 425,
+ /* 1770 */ 426, 44, 428, 0, 0, 0, 0, 35, 333, 435,
+ /* 1780 */ 0, 0, 414, 439, 440, 39, 418, 39, 343, 421,
+ /* 1790 */ 422, 423, 424, 425, 426, 42, 428, 39, 47, 40,
+ /* 1800 */ 0, 333, 47, 435, 47, 0, 35, 439, 440, 39,
+ /* 1810 */ 49, 343, 0, 35, 369, 66, 49, 0, 39, 35,
+ /* 1820 */ 0, 49, 39, 35, 333, 39, 381, 0, 383, 0,
+ /* 1830 */ 0, 49, 0, 35, 343, 22, 0, 369, 35, 35,
+ /* 1840 */ 44, 35, 35, 35, 35, 35, 44, 333, 22, 381,
+ /* 1850 */ 35, 383, 0, 35, 35, 22, 0, 343, 0, 414,
+ /* 1860 */ 369, 107, 22, 418, 22, 51, 421, 422, 423, 424,
+ /* 1870 */ 425, 426, 381, 428, 383, 109, 35, 0, 35, 0,
+ /* 1880 */ 435, 35, 414, 369, 439, 440, 418, 0, 22, 421,
+ /* 1890 */ 422, 423, 424, 425, 426, 381, 428, 383, 20, 35,
+ /* 1900 */ 35, 100, 35, 435, 0, 414, 193, 35, 440, 418,
+ /* 1910 */ 333, 100, 421, 422, 423, 424, 425, 426, 22, 428,
+ /* 1920 */ 343, 0, 101, 22, 0, 0, 3, 44, 414, 101,
+ /* 1930 */ 168, 256, 418, 48, 100, 421, 422, 423, 424, 425,
+ /* 1940 */ 426, 48, 428, 175, 100, 168, 369, 98, 101, 96,
+ /* 1950 */ 44, 374, 44, 168, 189, 464, 101, 100, 381, 170,
+ /* 1960 */ 383, 100, 100, 44, 101, 47, 256, 3, 100, 47,
+ /* 1970 */ 44, 101, 101, 44, 35, 333, 35, 35, 35, 35,
+ /* 1980 */ 35, 101, 101, 0, 47, 343, 0, 473, 0, 0,
+ /* 1990 */ 44, 414, 100, 39, 47, 418, 333, 47, 421, 422,
+ /* 2000 */ 423, 424, 425, 426, 101, 428, 343, 100, 171, 333,
+ /* 2010 */ 101, 369, 100, 100, 100, 0, 39, 169, 47, 343,
+ /* 2020 */ 110, 2, 44, 381, 22, 383, 98, 100, 98, 237,
+ /* 2030 */ 22, 215, 369, 100, 47, 101, 101, 374, 100, 47,
+ /* 2040 */ 250, 101, 217, 111, 381, 369, 383, 256, 100, 100,
+ /* 2050 */ 374, 100, 35, 101, 101, 100, 414, 381, 35, 383,
+ /* 2060 */ 418, 1, 100, 421, 422, 423, 424, 425, 426, 101,
+ /* 2070 */ 428, 35, 430, 100, 35, 101, 100, 414, 35, 19,
+ /* 2080 */ 101, 418, 100, 35, 421, 422, 423, 424, 425, 426,
+ /* 2090 */ 414, 428, 101, 33, 418, 100, 333, 421, 422, 423,
+ /* 2100 */ 424, 425, 426, 122, 428, 100, 343, 122, 44, 49,
+ /* 2110 */ 100, 35, 122, 100, 22, 55, 56, 57, 58, 59,
+ /* 2120 */ 333, 122, 66, 65, 35, 35, 35, 72, 35, 35,
+ /* 2130 */ 343, 35, 369, 35, 35, 35, 35, 35, 94, 44,
+ /* 2140 */ 35, 35, 22, 35, 381, 35, 383, 35, 35, 72,
+ /* 2150 */ 35, 35, 22, 35, 35, 0, 369, 35, 35, 99,
+ /* 2160 */ 49, 0, 102, 39, 35, 39, 0, 35, 381, 0,
+ /* 2170 */ 383, 35, 0, 39, 49, 35, 49, 414, 39, 35,
+ /* 2180 */ 49, 418, 0, 333, 421, 422, 423, 424, 425, 426,
+ /* 2190 */ 22, 428, 21, 343, 134, 22, 22, 21, 20, 476,
+ /* 2200 */ 476, 414, 476, 476, 476, 418, 476, 333, 421, 422,
+ /* 2210 */ 423, 424, 425, 426, 476, 428, 476, 343, 476, 369,
+ /* 2220 */ 476, 476, 476, 476, 476, 476, 476, 476, 476, 169,
+ /* 2230 */ 476, 381, 476, 383, 174, 476, 476, 476, 476, 476,
+ /* 2240 */ 476, 476, 476, 369, 476, 476, 476, 476, 476, 476,
+ /* 2250 */ 476, 476, 476, 333, 194, 381, 476, 383, 476, 476,
+ /* 2260 */ 476, 476, 476, 343, 414, 476, 476, 476, 418, 333,
+ /* 2270 */ 476, 421, 422, 423, 424, 425, 426, 476, 428, 343,
+ /* 2280 */ 476, 476, 476, 476, 476, 476, 476, 476, 414, 369,
+ /* 2290 */ 476, 476, 418, 476, 476, 421, 422, 423, 424, 425,
+ /* 2300 */ 426, 381, 428, 383, 476, 369, 476, 476, 476, 476,
+ /* 2310 */ 476, 476, 476, 476, 476, 476, 476, 381, 476, 383,
+ /* 2320 */ 476, 476, 476, 476, 476, 476, 476, 476, 476, 333,
+ /* 2330 */ 476, 476, 476, 476, 414, 476, 476, 476, 418, 343,
+ /* 2340 */ 476, 421, 422, 423, 424, 425, 426, 476, 428, 476,
+ /* 2350 */ 414, 476, 476, 333, 418, 476, 476, 421, 422, 423,
+ /* 2360 */ 424, 425, 426, 343, 428, 369, 476, 476, 476, 476,
+ /* 2370 */ 476, 476, 476, 476, 476, 476, 476, 381, 476, 383,
+ /* 2380 */ 333, 476, 476, 476, 476, 476, 476, 476, 476, 369,
+ /* 2390 */ 343, 476, 476, 476, 476, 476, 476, 476, 476, 333,
+ /* 2400 */ 476, 381, 476, 383, 476, 476, 476, 476, 476, 343,
+ /* 2410 */ 414, 476, 476, 476, 418, 476, 369, 421, 422, 423,
+ /* 2420 */ 424, 425, 426, 476, 428, 476, 476, 476, 381, 476,
+ /* 2430 */ 383, 476, 476, 476, 414, 369, 476, 476, 418, 476,
+ /* 2440 */ 476, 421, 422, 423, 424, 425, 426, 381, 428, 383,
+ /* 2450 */ 333, 476, 476, 476, 476, 476, 476, 476, 476, 476,
+ /* 2460 */ 343, 414, 476, 476, 476, 418, 333, 476, 421, 422,
+ /* 2470 */ 423, 424, 425, 426, 476, 428, 343, 476, 476, 476,
+ /* 2480 */ 414, 476, 476, 476, 418, 476, 369, 421, 422, 423,
+ /* 2490 */ 424, 425, 426, 476, 428, 476, 333, 476, 381, 476,
+ /* 2500 */ 383, 476, 369, 476, 476, 476, 343, 476, 476, 476,
+ /* 2510 */ 476, 476, 476, 476, 381, 476, 383, 333, 476, 476,
+ /* 2520 */ 476, 476, 476, 476, 476, 476, 476, 343, 476, 476,
+ /* 2530 */ 476, 414, 369, 476, 476, 418, 476, 476, 421, 422,
+ /* 2540 */ 423, 424, 425, 426, 381, 428, 383, 414, 476, 476,
+ /* 2550 */ 476, 418, 476, 369, 421, 422, 423, 424, 425, 426,
+ /* 2560 */ 476, 428, 476, 333, 476, 381, 476, 383, 476, 476,
+ /* 2570 */ 476, 476, 476, 343, 476, 476, 476, 414, 476, 476,
+ /* 2580 */ 476, 418, 476, 476, 421, 422, 423, 424, 425, 426,
+ /* 2590 */ 476, 428, 476, 476, 476, 476, 476, 476, 414, 369,
+ /* 2600 */ 476, 476, 418, 476, 476, 421, 422, 423, 424, 425,
+ /* 2610 */ 426, 381, 428, 383, 476, 476, 476, 476, 476, 476,
+ /* 2620 */ 476, 476, 476, 333, 476, 476, 476, 476, 476, 476,
+ /* 2630 */ 476, 476, 476, 343, 476, 476, 333, 476, 476, 476,
+ /* 2640 */ 476, 476, 476, 476, 414, 476, 343, 476, 418, 476,
+ /* 2650 */ 476, 421, 422, 423, 424, 425, 426, 476, 428, 369,
+ /* 2660 */ 476, 476, 476, 476, 476, 476, 476, 476, 476, 476,
+ /* 2670 */ 476, 381, 369, 383, 476, 476, 476, 476, 476, 476,
+ /* 2680 */ 476, 476, 476, 476, 381, 476, 383, 333, 476, 476,
+ /* 2690 */ 476, 476, 476, 476, 476, 476, 476, 343, 476, 476,
+ /* 2700 */ 476, 476, 476, 476, 414, 476, 476, 476, 418, 476,
+ /* 2710 */ 476, 421, 422, 423, 424, 425, 426, 414, 428, 476,
+ /* 2720 */ 476, 418, 476, 369, 421, 422, 423, 424, 425, 426,
+ /* 2730 */ 476, 428, 476, 333, 476, 381, 476, 383, 476, 476,
+ /* 2740 */ 476, 476, 476, 343, 476, 476, 476, 476, 333, 476,
+ /* 2750 */ 476, 476, 476, 476, 476, 476, 476, 476, 343, 476,
+ /* 2760 */ 476, 476, 476, 476, 476, 476, 476, 476, 414, 369,
+ /* 2770 */ 476, 476, 418, 476, 476, 421, 422, 423, 424, 425,
+ /* 2780 */ 426, 381, 428, 383, 369, 476, 476, 476, 476, 476,
+ /* 2790 */ 476, 476, 476, 476, 333, 476, 381, 476, 383, 476,
+ /* 2800 */ 476, 476, 476, 476, 343, 476, 476, 476, 476, 333,
+ /* 2810 */ 476, 476, 476, 476, 414, 476, 476, 476, 418, 343,
+ /* 2820 */ 476, 421, 422, 423, 424, 425, 426, 476, 428, 414,
+ /* 2830 */ 369, 476, 476, 418, 476, 476, 421, 422, 423, 424,
+ /* 2840 */ 425, 426, 381, 428, 383, 369, 476, 476, 476, 476,
+ /* 2850 */ 476, 476, 476, 476, 476, 476, 476, 381, 476, 383,
+ /* 2860 */ 476, 476, 476, 476, 476, 476, 476, 476, 476, 476,
+ /* 2870 */ 476, 476, 476, 476, 476, 414, 476, 476, 476, 418,
+ /* 2880 */ 476, 476, 421, 422, 423, 424, 425, 426, 476, 428,
+ /* 2890 */ 414, 476, 476, 476, 418, 476, 476, 421, 422, 423,
+ /* 2900 */ 424, 425, 426, 476, 428,
};
-#define YY_SHIFT_COUNT (760)
+#define YY_SHIFT_COUNT (761)
#define YY_SHIFT_MIN (0)
-#define YY_SHIFT_MAX (2139)
+#define YY_SHIFT_MAX (2182)
static const unsigned short int yy_shift_ofst[] = {
/* 0 */ 550, 0, 224, 0, 449, 449, 449, 449, 449, 449,
- /* 10 */ 449, 449, 449, 449, 449, 673, 897, 897, 1121, 897,
+ /* 10 */ 449, 449, 449, 449, 449, 449, 673, 897, 897, 1121,
/* 20 */ 897, 897, 897, 897, 897, 897, 897, 897, 897, 897,
/* 30 */ 897, 897, 897, 897, 897, 897, 897, 897, 897, 897,
- /* 40 */ 897, 897, 897, 897, 897, 897, 897, 897, 149, 170,
- /* 50 */ 447, 79, 251, 65, 167, 65, 79, 79, 1487, 1487,
- /* 60 */ 1487, 65, 1487, 1487, 529, 65, 109, 328, 137, 137,
- /* 70 */ 328, 707, 707, 475, 257, 87, 87, 137, 137, 137,
- /* 80 */ 137, 137, 137, 137, 174, 137, 137, 176, 109, 137,
- /* 90 */ 137, 279, 137, 109, 137, 174, 137, 174, 109, 137,
- /* 100 */ 137, 109, 137, 109, 109, 109, 137, 378, 223, 187,
- /* 110 */ 187, 406, 114, 750, 750, 750, 750, 750, 750, 750,
- /* 120 */ 750, 750, 750, 750, 750, 750, 750, 750, 750, 750,
- /* 130 */ 750, 750, 1135, 165, 475, 257, 63, 39, 39, 39,
- /* 140 */ 778, 464, 464, 63, 448, 448, 448, 176, 497, 389,
- /* 150 */ 109, 595, 109, 595, 595, 634, 687, 34, 34, 34,
- /* 160 */ 34, 34, 34, 34, 34, 1608, 572, 569, 197, 15,
- /* 170 */ 260, 288, 247, 543, 784, 690, 831, 693, 519, 981,
- /* 180 */ 674, 953, 580, 674, 1016, 886, 856, 1112, 1334, 1200,
- /* 190 */ 1345, 1368, 1345, 1229, 1376, 1376, 1345, 1229, 1229, 1302,
- /* 200 */ 1309, 1376, 1312, 1376, 1376, 1376, 1400, 1400, 1405, 176,
- /* 210 */ 1416, 176, 1420, 1425, 176, 1420, 176, 176, 176, 1376,
- /* 220 */ 176, 1401, 1401, 1400, 109, 109, 109, 109, 109, 109,
- /* 230 */ 109, 109, 109, 109, 109, 1376, 1400, 595, 595, 595,
- /* 240 */ 1266, 1370, 1405, 378, 1281, 1301, 1416, 378, 1316, 1376,
- /* 250 */ 1368, 1368, 595, 1250, 1257, 595, 1250, 1257, 595, 595,
- /* 260 */ 109, 1245, 1341, 1250, 1255, 1259, 1289, 1112, 1249, 1268,
- /* 270 */ 1275, 1299, 448, 1536, 1376, 1420, 378, 378, 1547, 1257,
- /* 280 */ 595, 595, 595, 595, 595, 1257, 595, 1409, 378, 634,
- /* 290 */ 378, 448, 1482, 1492, 595, 687, 1376, 378, 1562, 1400,
- /* 300 */ 3096, 3096, 3096, 3096, 3096, 3096, 3096, 3096, 3096, 36,
- /* 310 */ 454, 689, 937, 162, 841, 931, 592, 1015, 1064, 967,
- /* 320 */ 1035, 1168, 1168, 1168, 1168, 1168, 1168, 1168, 1168, 1168,
- /* 330 */ 472, 73, 502, 502, 666, 408, 499, 776, 734, 838,
- /* 340 */ 377, 353, 698, 698, 604, 282, 722, 604, 604, 604,
- /* 350 */ 1090, 964, 949, 1032, 1108, 818, 345, 1053, 1067, 1081,
- /* 360 */ 1120, 1101, 1231, 1223, 1228, 1242, 944, 1062, 1107, 1131,
- /* 370 */ 1147, 1172, 1185, 1126, 1031, 1057, 1041, 1209, 1230, 1234,
- /* 380 */ 1237, 1264, 1267, 1278, 1270, 1179, 1202, 1208, 1272, 735,
- /* 390 */ 1276, 1277, 1288, 1326, 1328, 1336, 1139, 1254, 1344, 1263,
- /* 400 */ 1381, 1620, 1621, 1623, 1583, 1626, 1595, 1423, 1597, 1598,
- /* 410 */ 1599, 1427, 1636, 1602, 1603, 1432, 1642, 1436, 1645, 1611,
- /* 420 */ 1647, 1627, 1648, 1615, 1456, 1464, 1467, 1654, 1655, 1657,
- /* 430 */ 1476, 1478, 1660, 1661, 1622, 1667, 1668, 1670, 1629, 1672,
- /* 440 */ 1674, 1685, 1686, 1687, 1688, 1690, 1692, 1522, 1643, 1679,
- /* 450 */ 1525, 1681, 1682, 1683, 1693, 1694, 1695, 1696, 1697, 1698,
- /* 460 */ 1699, 1700, 1701, 1704, 1705, 1706, 1709, 1669, 1712, 1713,
- /* 470 */ 1714, 1723, 1724, 1725, 1715, 1727, 1728, 1735, 1600, 1738,
- /* 480 */ 1740, 1722, 1649, 1729, 1650, 1750, 1702, 1717, 1753, 1707,
- /* 490 */ 1755, 1708, 1757, 1758, 1719, 1720, 1718, 1716, 1754, 1731,
- /* 500 */ 1756, 1732, 1764, 1734, 1730, 1767, 1771, 1772, 1736, 1606,
- /* 510 */ 1776, 1780, 1781, 1721, 1784, 1785, 1765, 1741, 1749, 1790,
- /* 520 */ 1768, 1744, 1766, 1793, 1769, 1759, 1770, 1810, 1782, 1763,
- /* 530 */ 1777, 1815, 1818, 1820, 1822, 1726, 1733, 1788, 1803, 1826,
- /* 540 */ 1792, 1794, 1796, 1797, 1798, 1799, 1801, 1786, 1800, 1802,
- /* 550 */ 1804, 1806, 1807, 1838, 1819, 1845, 1824, 1805, 1847, 1827,
- /* 560 */ 1813, 1850, 1816, 1853, 1823, 1854, 1846, 1849, 1832, 1836,
- /* 570 */ 1839, 1778, 1775, 1877, 1737, 1783, 1689, 1851, 1858, 1881,
- /* 580 */ 1710, 1863, 1748, 1739, 1887, 1888, 1751, 1745, 1889, 1852,
- /* 590 */ 1634, 1808, 1834, 1821, 1828, 1829, 1842, 1809, 1840, 1856,
- /* 600 */ 1857, 1841, 1843, 1844, 1848, 1855, 1862, 1876, 1878, 1860,
- /* 610 */ 1884, 1637, 1861, 1864, 1891, 1895, 1639, 1867, 1905, 1910,
- /* 620 */ 1911, 1912, 1914, 1866, 1868, 1903, 1711, 1909, 1907, 1897,
- /* 630 */ 1898, 1955, 1957, 1871, 1924, 1716, 1921, 1872, 1873, 1875,
- /* 640 */ 1879, 1880, 1787, 1882, 1977, 1942, 1817, 1892, 1874, 1716,
- /* 650 */ 1940, 1944, 1893, 1752, 1896, 1988, 1971, 1814, 1899, 1894,
- /* 660 */ 1900, 1901, 1913, 1902, 1949, 1915, 1917, 1951, 1918, 1990,
- /* 670 */ 1830, 1922, 1920, 1931, 1979, 1983, 1933, 1934, 1986, 1937,
- /* 680 */ 1938, 1999, 1941, 1939, 2003, 1945, 1943, 2007, 1946, 1925,
- /* 690 */ 1926, 1927, 1929, 2031, 1947, 1954, 2011, 1960, 2026, 1962,
- /* 700 */ 2011, 2011, 2041, 2000, 2002, 2029, 2032, 2033, 2035, 2036,
- /* 710 */ 2038, 2040, 2043, 2044, 2045, 2001, 1992, 2039, 2046, 2051,
- /* 720 */ 2052, 2054, 2053, 2055, 2056, 2021, 1786, 2059, 1800, 2060,
- /* 730 */ 2067, 2069, 2071, 2086, 2074, 2110, 2076, 2064, 2075, 2113,
- /* 740 */ 2081, 2070, 2078, 2120, 2095, 2073, 2092, 2132, 2099, 2085,
- /* 750 */ 2096, 2136, 2102, 2103, 2139, 2119, 2121, 2122, 2124, 2126,
- /* 760 */ 2123,
+ /* 40 */ 897, 897, 897, 897, 897, 897, 897, 897, 897, 457,
+ /* 50 */ 492, 142, 145, 147, 107, 173, 107, 145, 145, 1347,
+ /* 60 */ 1347, 1347, 107, 1347, 1347, 501, 107, 18, 447, 47,
+ /* 70 */ 47, 447, 235, 235, 3, 286, 7, 7, 47, 47,
+ /* 80 */ 47, 47, 47, 47, 47, 51, 47, 47, 132, 18,
+ /* 90 */ 47, 47, 228, 47, 18, 47, 51, 47, 51, 18,
+ /* 100 */ 47, 47, 18, 47, 18, 18, 18, 47, 339, 223,
+ /* 110 */ 189, 189, 333, 114, 443, 443, 443, 443, 443, 443,
+ /* 120 */ 443, 443, 443, 443, 443, 443, 443, 443, 443, 443,
+ /* 130 */ 443, 443, 443, 843, 325, 3, 286, 392, 220, 220,
+ /* 140 */ 220, 417, 369, 369, 392, 344, 344, 344, 132, 365,
+ /* 150 */ 297, 18, 439, 18, 439, 439, 503, 558, 35, 35,
+ /* 160 */ 35, 35, 35, 35, 35, 35, 2060, 217, 288, 483,
+ /* 170 */ 522, 260, 313, 243, 384, 940, 576, 484, 890, 751,
+ /* 180 */ 528, 810, 824, 60, 974, 824, 1065, 791, 275, 1124,
+ /* 190 */ 1336, 1204, 1353, 1378, 1353, 1236, 1384, 1384, 1353, 1236,
+ /* 200 */ 1236, 1315, 1324, 1384, 1329, 1384, 1384, 1384, 1411, 1386,
+ /* 210 */ 1411, 1386, 1418, 132, 1421, 132, 1426, 1430, 132, 1426,
+ /* 220 */ 132, 132, 132, 1384, 132, 1413, 1413, 1411, 18, 18,
+ /* 230 */ 18, 18, 18, 18, 18, 18, 18, 18, 18, 1384,
+ /* 240 */ 1411, 439, 439, 439, 1292, 1398, 1418, 339, 1325, 1323,
+ /* 250 */ 1421, 339, 1330, 1384, 1378, 1378, 439, 1262, 1266, 439,
+ /* 260 */ 1262, 1266, 439, 439, 18, 1253, 1355, 1262, 1271, 1273,
+ /* 270 */ 1293, 1124, 1283, 1277, 1276, 1318, 344, 1550, 1384, 1426,
+ /* 280 */ 339, 339, 1566, 1266, 439, 439, 439, 439, 439, 1266,
+ /* 290 */ 439, 1427, 339, 503, 339, 344, 1504, 1508, 439, 558,
+ /* 300 */ 1384, 339, 1576, 1411, 2905, 2905, 2905, 2905, 2905, 2905,
+ /* 310 */ 2905, 2905, 2905, 34, 430, 15, 590, 734, 16, 839,
+ /* 320 */ 79, 709, 792, 566, 856, 1023, 1023, 1023, 1023, 1023,
+ /* 330 */ 1023, 1023, 1023, 1023, 1167, 743, 253, 253, 402, 57,
+ /* 340 */ 758, 774, 949, 1067, 800, 980, 64, 64, 959, 1007,
+ /* 350 */ 387, 959, 959, 959, 1149, 641, 1116, 1140, 1147, 1070,
+ /* 360 */ 1168, 1078, 1119, 1141, 1164, 532, 1190, 1207, 1250, 1251,
+ /* 370 */ 990, 1189, 1212, 868, 1216, 1231, 1233, 943, 1004, 1117,
+ /* 380 */ 1153, 1261, 1264, 1267, 1270, 1272, 1274, 1302, 1289, 1196,
+ /* 390 */ 1206, 987, 1291, 1238, 1286, 1317, 1320, 1322, 1326, 1328,
+ /* 400 */ 190, 1248, 1361, 1256, 1331, 1614, 1620, 1624, 1590, 1633,
+ /* 410 */ 1599, 1428, 1600, 1602, 1604, 1432, 1644, 1607, 1610, 1438,
+ /* 420 */ 1647, 1440, 1649, 1615, 1651, 1630, 1653, 1621, 1460, 1469,
+ /* 430 */ 1473, 1660, 1667, 1669, 1488, 1490, 1672, 1689, 1629, 1690,
+ /* 440 */ 1691, 1692, 1652, 1696, 1697, 1698, 1702, 1703, 1704, 1705,
+ /* 450 */ 1706, 1552, 1673, 1709, 1555, 1712, 1714, 1715, 1716, 1717,
+ /* 460 */ 1718, 1719, 1720, 1721, 1722, 1723, 1724, 1726, 1728, 1729,
+ /* 470 */ 1730, 1693, 1731, 1732, 1733, 1734, 1736, 1738, 1725, 1739,
+ /* 480 */ 1740, 1741, 1603, 1743, 1744, 1735, 1700, 1737, 1707, 1745,
+ /* 490 */ 1687, 1742, 1750, 1694, 1752, 1695, 1756, 1760, 1753, 1746,
+ /* 500 */ 1727, 1751, 1755, 1747, 1757, 1773, 1759, 1748, 1774, 1775,
+ /* 510 */ 1776, 1758, 1586, 1764, 1780, 1781, 1749, 1800, 1805, 1771,
+ /* 520 */ 1761, 1770, 1812, 1778, 1767, 1779, 1817, 1784, 1772, 1783,
+ /* 530 */ 1820, 1788, 1782, 1786, 1827, 1829, 1830, 1832, 1766, 1754,
+ /* 540 */ 1798, 1813, 1836, 1803, 1804, 1806, 1807, 1808, 1809, 1810,
+ /* 550 */ 1796, 1802, 1815, 1818, 1826, 1819, 1852, 1833, 1856, 1840,
+ /* 560 */ 1814, 1858, 1842, 1841, 1877, 1843, 1879, 1846, 1887, 1866,
+ /* 570 */ 1878, 1864, 1865, 1867, 1821, 1801, 1904, 1762, 1811, 1713,
+ /* 580 */ 1872, 1896, 1921, 1765, 1901, 1777, 1789, 1924, 1925, 1785,
+ /* 590 */ 1768, 1923, 1883, 1675, 1834, 1828, 1844, 1885, 1849, 1893,
+ /* 600 */ 1853, 1847, 1906, 1908, 1855, 1857, 1861, 1862, 1863, 1919,
+ /* 610 */ 1918, 1922, 1868, 1926, 1710, 1870, 1871, 1964, 1929, 1791,
+ /* 620 */ 1939, 1941, 1942, 1943, 1944, 1945, 1880, 1881, 1937, 1790,
+ /* 630 */ 1946, 1947, 1983, 1986, 1988, 1989, 1892, 1954, 1751, 1950,
+ /* 640 */ 1907, 1903, 1909, 1912, 1913, 1837, 1914, 2015, 1977, 1848,
+ /* 650 */ 1927, 1910, 1751, 1971, 1978, 1928, 1792, 1930, 2019, 2002,
+ /* 660 */ 1816, 1933, 1934, 1938, 1935, 1948, 1940, 1987, 1949, 1951,
+ /* 670 */ 1992, 1952, 2008, 1825, 1955, 1932, 1953, 2017, 2023, 1962,
+ /* 680 */ 1968, 2036, 1973, 1974, 2039, 1976, 1979, 2043, 1982, 1991,
+ /* 690 */ 2048, 1995, 1981, 1985, 1990, 1999, 2005, 2064, 2010, 2076,
+ /* 700 */ 2013, 2064, 2064, 2092, 2056, 2058, 2089, 2090, 2091, 2093,
+ /* 710 */ 2094, 2096, 2098, 2099, 2100, 2101, 2055, 2044, 2095, 2102,
+ /* 720 */ 2105, 2106, 2120, 2108, 2110, 2112, 2077, 1796, 2113, 1802,
+ /* 730 */ 2115, 2116, 2118, 2119, 2130, 2122, 2155, 2123, 2111, 2124,
+ /* 740 */ 2161, 2129, 2125, 2126, 2166, 2132, 2127, 2134, 2169, 2136,
+ /* 750 */ 2131, 2139, 2172, 2140, 2144, 2182, 2168, 2171, 2173, 2174,
+ /* 760 */ 2176, 2178,
};
-#define YY_REDUCE_COUNT (308)
-#define YY_REDUCE_MIN (-424)
-#define YY_REDUCE_MAX (2669)
+#define YY_REDUCE_COUNT (312)
+#define YY_REDUCE_MIN (-396)
+#define YY_REDUCE_MAX (2476)
static const short yy_reduce_ofst[] = {
- /* 0 */ 373, -119, 368, 588, 774, 995, 1065, 1116, 1191, -17,
- /* 10 */ 446, 672, 880, 1310, 1375, -332, 903, 155, 1440, 1491,
- /* 20 */ 1510, 1585, 1604, 1677, 1703, 1774, 1795, 1825, 1890, 1919,
- /* 30 */ 1953, 2017, 2037, 2098, 2149, 2170, 2200, 2265, 2294, 2328,
- /* 40 */ 2392, 2412, 2473, 2524, 2545, 2575, 2640, 2669, 96, -184,
- /* 50 */ -395, -99, -392, -134, 488, 761, -87, 470, -89, 281,
- /* 60 */ 398, -424, -364, -360, -384, 806, 42, -314, -177, 391,
- /* 70 */ -379, -207, -156, -350, 86, 156, 202, -331, 178, 394,
- /* 80 */ 402, 462, 507, 577, -101, 585, 646, -34, -334, 700,
- /* 90 */ 708, 196, 730, 182, 801, 190, 804, 302, 278, 846,
- /* 100 */ 858, 401, 860, 505, 450, 556, 878, -301, -63, -243,
- /* 110 */ -243, -110, -323, -85, -81, 59, 153, 357, 358, 407,
- /* 120 */ 541, 549, 594, 627, 639, 658, 663, 665, 669, 680,
- /* 130 */ 682, 683, -302, 530, 267, 7, 124, 530, 545, 637,
- /* 140 */ 185, -7, 363, 206, 104, 603, 671, -22, -104, 611,
- /* 150 */ 451, 710, 686, 721, 723, 749, 630, -367, -362, 338,
- /* 160 */ 429, 582, 795, 797, 582, 520, 847, 922, 871, 792,
- /* 170 */ 808, 940, 829, 924, 924, 948, 906, 957, 934, 941,
- /* 180 */ 911, 911, 893, 911, 921, 912, 924, 961, 970, 985,
- /* 190 */ 1000, 1002, 1006, 1009, 1054, 1056, 1013, 1017, 1018, 1052,
- /* 200 */ 1055, 1068, 1059, 1069, 1071, 1072, 1087, 1089, 1027, 1088,
- /* 210 */ 1060, 1091, 1100, 1048, 1103, 1106, 1104, 1105, 1109, 1113,
- /* 220 */ 1110, 1111, 1114, 1124, 1094, 1095, 1096, 1097, 1098, 1099,
- /* 230 */ 1102, 1117, 1127, 1128, 1138, 1125, 1132, 1092, 1093, 1122,
- /* 240 */ 1063, 1066, 1073, 1133, 1070, 1074, 1129, 1160, 1115, 1166,
- /* 250 */ 1119, 1123, 1136, 1061, 1137, 1142, 1075, 1140, 1144, 1146,
- /* 260 */ 924, 1083, 1076, 1118, 1134, 1130, 1141, 1145, 1077, 1078,
- /* 270 */ 1085, 911, 1181, 1143, 1219, 1220, 1218, 1221, 1176, 1175,
- /* 280 */ 1192, 1195, 1196, 1197, 1198, 1184, 1201, 1190, 1240, 1224,
- /* 290 */ 1244, 1213, 1154, 1225, 1212, 1238, 1256, 1251, 1265, 1269,
- /* 300 */ 1199, 1194, 1204, 1210, 1246, 1248, 1258, 1273, 1285,
+ /* 0 */ -140, 137, -82, 358, 444, 578, 814, 841, 1034, 1064,
+ /* 10 */ 1132, 1240, 1260, 1344, 1368, 1445, 598, -333, 672, 1468,
+ /* 20 */ 901, 1491, 1514, 1577, 1642, 1663, 1676, 1763, 1787, 1850,
+ /* 30 */ 1874, 1920, 1936, 1996, 2020, 2047, 2066, 2117, 2133, 2163,
+ /* 40 */ 2184, 2230, 2290, 2303, 2354, 2400, 2415, 2461, 2476, 372,
+ /* 50 */ -195, -396, -265, 487, 595, 607, 701, 481, 761, -362,
+ /* 60 */ -355, 285, 749, 136, 612, -279, -55, 256, -346, -167,
+ /* 70 */ -5, -381, -334, -257, -205, -249, 45, 130, 300, 303,
+ /* 80 */ 356, 377, 409, 425, 432, 177, 469, 489, 252, -308,
+ /* 90 */ 521, 573, 170, 620, 172, 622, 261, 707, 396, 682,
+ /* 100 */ 739, 745, 278, 793, 715, 321, 781, 795, -266, 8,
+ /* 110 */ -350, -350, 115, -238, 161, 214, 257, 315, 374, 433,
+ /* 120 */ 445, 463, 585, 587, 617, 677, 681, 806, 807, 813,
+ /* 130 */ 819, 830, 832, -86, -289, -111, 23, 154, -289, 70,
+ /* 140 */ 188, -25, 480, 511, 380, 416, 498, 704, 381, -354,
+ /* 150 */ 426, 513, 690, 502, 733, 798, 808, 353, -369, -365,
+ /* 160 */ 324, 370, 458, 505, 686, 458, 764, 368, 621, 825,
+ /* 170 */ 753, 780, 906, 822, 917, 917, 946, 898, 954, 963,
+ /* 180 */ 930, 921, 871, 871, 891, 871, 916, 925, 917, 967,
+ /* 190 */ 971, 989, 1001, 1008, 1012, 1016, 1063, 1066, 1022, 1025,
+ /* 200 */ 1026, 1060, 1069, 1074, 1073, 1084, 1086, 1088, 1097, 1096,
+ /* 210 */ 1101, 1098, 1030, 1090, 1059, 1093, 1105, 1050, 1103, 1110,
+ /* 220 */ 1111, 1113, 1114, 1126, 1120, 1125, 1129, 1136, 1108, 1112,
+ /* 230 */ 1115, 1122, 1127, 1131, 1133, 1137, 1138, 1139, 1142, 1151,
+ /* 240 */ 1144, 1099, 1102, 1128, 1081, 1094, 1107, 1162, 1104, 1118,
+ /* 250 */ 1135, 1171, 1123, 1179, 1143, 1145, 1146, 1068, 1134, 1150,
+ /* 260 */ 1072, 1148, 1156, 1157, 917, 1080, 1082, 1085, 1092, 1091,
+ /* 270 */ 1106, 1152, 1076, 1095, 1130, 871, 1223, 1154, 1242, 1241,
+ /* 280 */ 1234, 1239, 1194, 1193, 1209, 1210, 1211, 1213, 1214, 1200,
+ /* 290 */ 1218, 1208, 1252, 1237, 1257, 1263, 1169, 1243, 1229, 1254,
+ /* 300 */ 1269, 1278, 1279, 1282, 1215, 1217, 1222, 1225, 1265, 1268,
+ /* 310 */ 1275, 1281, 1294,
};
static const YYACTIONTYPE yy_default[] = {
- /* 0 */ 1714, 1714, 1714, 1714, 1714, 1714, 1714, 1714, 1714, 1714,
- /* 10 */ 1714, 1714, 1714, 1714, 1714, 1714, 1714, 1714, 1714, 1714,
- /* 20 */ 1714, 1714, 1714, 1714, 1714, 1714, 1714, 1714, 1714, 1714,
- /* 30 */ 1714, 1714, 1714, 1714, 1714, 1714, 1714, 1714, 1714, 1714,
- /* 40 */ 1714, 1714, 1714, 1714, 1714, 1714, 1714, 1714, 1714, 1714,
- /* 50 */ 1714, 1714, 1714, 1714, 1714, 1714, 1714, 1714, 1714, 1714,
- /* 60 */ 1714, 1714, 1714, 1714, 1714, 1714, 1714, 1714, 1714, 1714,
- /* 70 */ 1714, 1714, 1714, 1985, 1714, 1714, 1714, 1714, 1714, 1714,
- /* 80 */ 1714, 1714, 1714, 1714, 1714, 1714, 1714, 1793, 1714, 1714,
- /* 90 */ 1714, 1714, 1714, 1714, 1714, 1714, 1714, 1714, 1714, 1714,
- /* 100 */ 1714, 1714, 1714, 1714, 1714, 1714, 1714, 1791, 1978, 2199,
- /* 110 */ 1714, 1714, 1714, 1714, 1714, 1714, 1714, 1714, 1714, 1714,
- /* 120 */ 1714, 1714, 1714, 1714, 1714, 1714, 1714, 1714, 1714, 1714,
- /* 130 */ 1714, 1714, 1714, 2211, 1714, 1714, 1714, 2211, 2211, 2211,
- /* 140 */ 1791, 2171, 2171, 1714, 1714, 1714, 1714, 1793, 2043, 1714,
- /* 150 */ 1714, 1714, 1714, 1714, 1714, 1913, 1714, 1714, 1714, 1714,
- /* 160 */ 1714, 1937, 1714, 1714, 1714, 2037, 1714, 1714, 2236, 2292,
- /* 170 */ 1714, 1714, 2239, 1714, 1714, 1714, 1990, 1714, 1866, 2226,
- /* 180 */ 2203, 2217, 2276, 2204, 2201, 2220, 1714, 2230, 1714, 2024,
- /* 190 */ 1983, 1714, 1983, 1980, 1714, 1714, 1983, 1980, 1980, 1855,
- /* 200 */ 1851, 1714, 1849, 1714, 1714, 1714, 1714, 1714, 1714, 1793,
- /* 210 */ 1714, 1793, 1714, 1714, 1793, 1714, 1793, 1793, 1793, 1714,
- /* 220 */ 1793, 1771, 1771, 1714, 1714, 1714, 1714, 1714, 1714, 1714,
- /* 230 */ 1714, 1714, 1714, 1714, 1714, 1714, 1714, 1714, 1714, 1714,
- /* 240 */ 2055, 2041, 1714, 1791, 2035, 2033, 1714, 1791, 2031, 1714,
- /* 250 */ 1714, 1714, 1714, 2247, 2245, 1714, 2247, 2245, 1714, 1714,
- /* 260 */ 1714, 2261, 2257, 2247, 2265, 2263, 2232, 2230, 2295, 2282,
- /* 270 */ 2278, 2217, 1714, 1714, 1714, 1714, 1791, 1791, 1714, 2245,
- /* 280 */ 1714, 1714, 1714, 1714, 1714, 2245, 1714, 1714, 1791, 1714,
- /* 290 */ 1791, 1714, 1714, 1882, 1714, 1714, 1714, 1791, 1746, 1714,
- /* 300 */ 2026, 2046, 2008, 2008, 1916, 1916, 1916, 1794, 1719, 1714,
- /* 310 */ 1714, 1714, 1714, 1714, 1714, 1714, 1714, 1714, 1714, 1714,
- /* 320 */ 1714, 2260, 2259, 2126, 1714, 2175, 2174, 2173, 2164, 2125,
- /* 330 */ 1878, 1714, 2124, 2123, 1714, 1714, 1714, 1714, 1714, 1714,
- /* 340 */ 1714, 1714, 1999, 1998, 2117, 1714, 1714, 2118, 2116, 2115,
- /* 350 */ 1714, 1714, 1714, 1714, 1714, 1714, 1714, 1714, 1714, 1714,
- /* 360 */ 1714, 1714, 1714, 1714, 1714, 1714, 1714, 1714, 1714, 1714,
- /* 370 */ 1714, 1714, 1714, 1714, 2279, 2283, 1714, 1714, 1714, 1714,
- /* 380 */ 1714, 1714, 1714, 2200, 1714, 1714, 1714, 1714, 1714, 2099,
- /* 390 */ 1714, 1714, 1714, 1714, 1714, 1714, 1714, 1714, 1714, 1714,
- /* 400 */ 1714, 1714, 1714, 1714, 1714, 1714, 1714, 1714, 1714, 1714,
- /* 410 */ 1714, 1714, 1714, 1714, 1714, 1714, 1714, 1714, 1714, 1714,
- /* 420 */ 1714, 1714, 1714, 1714, 1714, 1714, 1714, 1714, 1714, 1714,
- /* 430 */ 1714, 1714, 1714, 1714, 1714, 1714, 1714, 1714, 1714, 1714,
- /* 440 */ 1714, 1714, 1714, 1714, 1714, 1714, 1714, 1714, 1714, 1714,
- /* 450 */ 1714, 1714, 1714, 1714, 1714, 1714, 1714, 1714, 1714, 1714,
- /* 460 */ 1714, 1714, 1714, 1714, 1714, 1714, 1714, 1714, 1714, 1714,
- /* 470 */ 1714, 1714, 1714, 1714, 1714, 1714, 1714, 1714, 1714, 1714,
- /* 480 */ 1714, 1714, 1714, 1714, 1714, 1714, 1714, 1714, 1714, 1714,
- /* 490 */ 1714, 1714, 1714, 1714, 1714, 1714, 1751, 2104, 1714, 1714,
- /* 500 */ 1714, 1714, 1714, 1714, 1714, 1714, 1714, 1714, 1714, 1714,
- /* 510 */ 1714, 1714, 1714, 1714, 1714, 1714, 1714, 1714, 1714, 1714,
- /* 520 */ 1714, 1714, 1714, 1714, 1714, 1714, 1714, 1714, 1714, 1714,
- /* 530 */ 1714, 1714, 1714, 1714, 1714, 1714, 1714, 1714, 1714, 1714,
- /* 540 */ 1714, 1714, 1714, 1714, 1714, 1714, 1714, 1832, 1831, 1714,
- /* 550 */ 1714, 1714, 1714, 1714, 1714, 1714, 1714, 1714, 1714, 1714,
- /* 560 */ 1714, 1714, 1714, 1714, 1714, 1714, 1714, 1714, 1714, 1714,
- /* 570 */ 1714, 2108, 1714, 1714, 1714, 1714, 1714, 1714, 1714, 1714,
- /* 580 */ 1714, 1714, 1714, 1714, 1714, 1714, 1714, 1714, 2275, 2233,
- /* 590 */ 1714, 1714, 1714, 1714, 1714, 1714, 1714, 1714, 1714, 1714,
- /* 600 */ 1714, 1714, 1714, 1714, 1714, 1714, 1714, 1714, 2099, 1714,
- /* 610 */ 2258, 1714, 1714, 2273, 1714, 2277, 1714, 1714, 1714, 1714,
- /* 620 */ 1714, 1714, 1714, 2210, 2206, 1714, 1714, 2202, 1714, 1714,
- /* 630 */ 1714, 1714, 1714, 1714, 1714, 2107, 1714, 1714, 1714, 1714,
- /* 640 */ 1714, 1714, 1714, 1714, 1714, 1714, 1714, 1714, 1714, 2098,
- /* 650 */ 1714, 2161, 1714, 1714, 1714, 2195, 1714, 1714, 2146, 1714,
- /* 660 */ 1714, 1714, 1714, 1714, 1714, 1714, 1714, 1714, 2108, 1714,
- /* 670 */ 2111, 1714, 1714, 1714, 1714, 1714, 1910, 1714, 1714, 1714,
- /* 680 */ 1714, 1714, 1714, 1714, 1714, 1714, 1714, 1714, 1714, 1895,
- /* 690 */ 1893, 1892, 1891, 1714, 1888, 1714, 1923, 1714, 1714, 1714,
- /* 700 */ 1919, 1918, 1714, 1714, 1714, 1714, 1714, 1714, 1714, 1714,
- /* 710 */ 1714, 1714, 1714, 1714, 1714, 1714, 1714, 1812, 1714, 1714,
- /* 720 */ 1714, 1714, 1714, 1714, 1714, 1714, 1804, 1714, 1803, 1714,
- /* 730 */ 1714, 1714, 1714, 1714, 1714, 1714, 1714, 1714, 1714, 1714,
- /* 740 */ 1714, 1714, 1714, 1714, 1714, 1714, 1714, 1714, 1714, 1714,
- /* 750 */ 1714, 1714, 1714, 1714, 1714, 1714, 1714, 1714, 1714, 1714,
- /* 760 */ 1714,
+ /* 0 */ 1719, 1719, 1719, 1719, 1719, 1719, 1719, 1719, 1719, 1719,
+ /* 10 */ 1719, 1719, 1719, 1719, 1719, 1719, 1719, 1719, 1719, 1719,
+ /* 20 */ 1719, 1719, 1719, 1719, 1719, 1719, 1719, 1719, 1719, 1719,
+ /* 30 */ 1719, 1719, 1719, 1719, 1719, 1719, 1719, 1719, 1719, 1719,
+ /* 40 */ 1719, 1719, 1719, 1719, 1719, 1719, 1719, 1719, 1719, 1719,
+ /* 50 */ 1719, 1719, 1719, 1719, 1719, 1719, 1719, 1719, 1719, 1719,
+ /* 60 */ 1719, 1719, 1719, 1719, 1719, 1719, 1719, 1719, 1719, 1719,
+ /* 70 */ 1719, 1719, 1719, 1719, 1992, 1719, 1719, 1719, 1719, 1719,
+ /* 80 */ 1719, 1719, 1719, 1719, 1719, 1719, 1719, 1719, 1801, 1719,
+ /* 90 */ 1719, 1719, 1719, 1719, 1719, 1719, 1719, 1719, 1719, 1719,
+ /* 100 */ 1719, 1719, 1719, 1719, 1719, 1719, 1719, 1719, 1799, 1985,
+ /* 110 */ 2206, 1719, 1719, 1719, 1719, 1719, 1719, 1719, 1719, 1719,
+ /* 120 */ 1719, 1719, 1719, 1719, 1719, 1719, 1719, 1719, 1719, 1719,
+ /* 130 */ 1719, 1719, 1719, 1719, 2218, 1719, 1719, 1719, 2218, 2218,
+ /* 140 */ 2218, 1799, 2178, 2178, 1719, 1719, 1719, 1719, 1801, 2050,
+ /* 150 */ 1719, 1719, 1719, 1719, 1719, 1719, 1920, 1719, 1719, 1719,
+ /* 160 */ 1719, 1719, 1944, 1719, 1719, 1719, 2044, 1719, 1719, 2243,
+ /* 170 */ 2299, 1719, 1719, 2246, 1719, 1719, 1719, 1997, 1719, 1719,
+ /* 180 */ 1874, 2233, 2210, 2224, 2283, 2211, 2208, 2227, 1719, 2237,
+ /* 190 */ 1719, 2031, 1990, 1719, 1990, 1987, 1719, 1719, 1990, 1987,
+ /* 200 */ 1987, 1863, 1859, 1719, 1857, 1719, 1719, 1719, 1719, 1766,
+ /* 210 */ 1719, 1766, 1719, 1801, 1719, 1801, 1719, 1719, 1801, 1719,
+ /* 220 */ 1801, 1801, 1801, 1719, 1801, 1779, 1779, 1719, 1719, 1719,
+ /* 230 */ 1719, 1719, 1719, 1719, 1719, 1719, 1719, 1719, 1719, 1719,
+ /* 240 */ 1719, 1719, 1719, 1719, 2062, 2048, 1719, 1799, 2042, 2040,
+ /* 250 */ 1719, 1799, 2038, 1719, 1719, 1719, 1719, 2254, 2252, 1719,
+ /* 260 */ 2254, 2252, 1719, 1719, 1719, 2268, 2264, 2254, 2272, 2270,
+ /* 270 */ 2239, 2237, 2302, 2289, 2285, 2224, 1719, 1719, 1719, 1719,
+ /* 280 */ 1799, 1799, 1719, 2252, 1719, 1719, 1719, 1719, 1719, 2252,
+ /* 290 */ 1719, 1719, 1799, 1719, 1799, 1719, 1719, 1890, 1719, 1719,
+ /* 300 */ 1719, 1799, 1751, 1719, 2033, 2053, 2015, 2015, 1923, 1923,
+ /* 310 */ 1923, 1802, 1724, 1719, 1719, 1719, 1719, 1719, 1719, 1719,
+ /* 320 */ 1719, 1719, 1719, 1719, 1719, 2267, 2266, 2133, 1719, 2182,
+ /* 330 */ 2181, 2180, 2171, 2132, 1886, 1719, 2131, 2130, 1719, 1719,
+ /* 340 */ 1719, 1719, 1719, 1719, 1719, 1719, 2006, 2005, 2124, 1719,
+ /* 350 */ 1719, 2125, 2123, 2122, 1719, 1719, 1719, 1719, 1719, 1719,
+ /* 360 */ 1719, 1719, 1719, 1719, 1719, 1719, 1719, 1719, 1719, 1719,
+ /* 370 */ 1719, 1719, 1719, 1719, 1719, 1719, 1719, 1719, 2286, 2290,
+ /* 380 */ 1719, 1719, 1719, 1719, 1719, 1719, 1719, 2207, 1719, 1719,
+ /* 390 */ 1719, 1719, 1719, 2106, 1719, 1719, 1719, 1719, 1719, 1719,
+ /* 400 */ 1719, 1719, 1719, 1719, 1719, 1719, 1719, 1719, 1719, 1719,
+ /* 410 */ 1719, 1719, 1719, 1719, 1719, 1719, 1719, 1719, 1719, 1719,
+ /* 420 */ 1719, 1719, 1719, 1719, 1719, 1719, 1719, 1719, 1719, 1719,
+ /* 430 */ 1719, 1719, 1719, 1719, 1719, 1719, 1719, 1719, 1719, 1719,
+ /* 440 */ 1719, 1719, 1719, 1719, 1719, 1719, 1719, 1719, 1719, 1719,
+ /* 450 */ 1719, 1719, 1719, 1719, 1719, 1719, 1719, 1719, 1719, 1719,
+ /* 460 */ 1719, 1719, 1719, 1719, 1719, 1719, 1719, 1719, 1719, 1719,
+ /* 470 */ 1719, 1719, 1719, 1719, 1719, 1719, 1719, 1719, 1719, 1719,
+ /* 480 */ 1719, 1719, 1719, 1719, 1719, 1719, 1719, 1719, 1719, 1719,
+ /* 490 */ 1719, 1719, 1719, 1719, 1719, 1719, 1719, 1719, 1719, 1719,
+ /* 500 */ 1756, 2111, 1719, 1719, 1719, 1719, 1719, 1719, 1719, 1719,
+ /* 510 */ 1719, 1719, 1719, 1719, 1719, 1719, 1719, 1719, 1719, 1719,
+ /* 520 */ 1719, 1719, 1719, 1719, 1719, 1719, 1719, 1719, 1719, 1719,
+ /* 530 */ 1719, 1719, 1719, 1719, 1719, 1719, 1719, 1719, 1719, 1719,
+ /* 540 */ 1719, 1719, 1719, 1719, 1719, 1719, 1719, 1719, 1719, 1719,
+ /* 550 */ 1840, 1839, 1719, 1719, 1719, 1719, 1719, 1719, 1719, 1719,
+ /* 560 */ 1719, 1719, 1719, 1719, 1719, 1719, 1719, 1719, 1719, 1719,
+ /* 570 */ 1719, 1719, 1719, 1719, 2115, 1719, 1719, 1719, 1719, 1719,
+ /* 580 */ 1719, 1719, 1719, 1719, 1719, 1719, 1719, 1719, 1719, 1719,
+ /* 590 */ 1719, 2282, 2240, 1719, 1719, 1719, 1719, 1719, 1719, 1719,
+ /* 600 */ 1719, 1719, 1719, 1719, 1719, 1719, 1719, 1719, 1719, 1719,
+ /* 610 */ 1719, 2106, 1719, 2265, 1719, 1719, 2280, 1719, 2284, 1719,
+ /* 620 */ 1719, 1719, 1719, 1719, 1719, 1719, 2217, 2213, 1719, 1719,
+ /* 630 */ 2209, 1719, 1719, 1719, 1719, 1719, 1719, 1719, 2114, 1719,
+ /* 640 */ 1719, 1719, 1719, 1719, 1719, 1719, 1719, 1719, 1719, 1719,
+ /* 650 */ 1719, 1719, 2105, 1719, 2168, 1719, 1719, 1719, 2202, 1719,
+ /* 660 */ 1719, 2153, 1719, 1719, 1719, 1719, 1719, 1719, 1719, 1719,
+ /* 670 */ 1719, 2115, 1719, 2118, 1719, 1719, 1719, 1719, 1719, 1917,
+ /* 680 */ 1719, 1719, 1719, 1719, 1719, 1719, 1719, 1719, 1719, 1719,
+ /* 690 */ 1719, 1719, 1902, 1900, 1899, 1898, 1719, 1930, 1719, 1719,
+ /* 700 */ 1719, 1926, 1925, 1719, 1719, 1719, 1719, 1719, 1719, 1719,
+ /* 710 */ 1719, 1719, 1719, 1719, 1719, 1719, 1719, 1719, 1820, 1719,
+ /* 720 */ 1719, 1719, 1719, 1719, 1719, 1719, 1719, 1812, 1719, 1811,
+ /* 730 */ 1719, 1719, 1719, 1719, 1719, 1719, 1719, 1719, 1719, 1719,
+ /* 740 */ 1719, 1719, 1719, 1719, 1719, 1719, 1719, 1719, 1719, 1719,
+ /* 750 */ 1719, 1719, 1719, 1719, 1719, 1719, 1719, 1719, 1719, 1719,
+ /* 760 */ 1719, 1719,
};
/********** End of lemon-generated parsing tables *****************************/
@@ -1104,6 +1068,7 @@ static const YYCODETYPE yyFallback[] = {
0, /* READ => nothing */
0, /* WRITE => nothing */
0, /* NK_DOT => nothing */
+ 0, /* WITH => nothing */
0, /* DNODE => nothing */
0, /* PORT => nothing */
0, /* DNODES => nothing */
@@ -1152,7 +1117,6 @@ static const YYCODETYPE yyFallback[] = {
0, /* NK_COLON => nothing */
0, /* MAX_SPEED => nothing */
0, /* START => nothing */
- 0, /* WITH => nothing */
0, /* TIMESTAMP => nothing */
279, /* END => ABORT */
0, /* TABLE => nothing */
@@ -1168,7 +1132,6 @@ static const YYCODETYPE yyFallback[] = {
0, /* NK_EQ => nothing */
0, /* USING => nothing */
0, /* TAGS => nothing */
- 0, /* COMMENT => nothing */
0, /* BOOL => nothing */
0, /* TINYINT => nothing */
0, /* SMALLINT => nothing */
@@ -1186,6 +1149,7 @@ static const YYCODETYPE yyFallback[] = {
0, /* BLOB => nothing */
0, /* VARBINARY => nothing */
0, /* DECIMAL => nothing */
+ 0, /* COMMENT => nothing */
0, /* MAX_DELAY => nothing */
0, /* WATERMARK => nothing */
0, /* ROLLUP => nothing */
@@ -1521,55 +1485,55 @@ static const char *const yyTokenName[] = {
/* 45 */ "READ",
/* 46 */ "WRITE",
/* 47 */ "NK_DOT",
- /* 48 */ "DNODE",
- /* 49 */ "PORT",
- /* 50 */ "DNODES",
- /* 51 */ "NK_IPTOKEN",
- /* 52 */ "FORCE",
- /* 53 */ "LOCAL",
- /* 54 */ "QNODE",
- /* 55 */ "BNODE",
- /* 56 */ "SNODE",
- /* 57 */ "MNODE",
- /* 58 */ "DATABASE",
- /* 59 */ "USE",
- /* 60 */ "FLUSH",
- /* 61 */ "TRIM",
- /* 62 */ "COMPACT",
- /* 63 */ "IF",
- /* 64 */ "NOT",
- /* 65 */ "EXISTS",
- /* 66 */ "BUFFER",
- /* 67 */ "CACHEMODEL",
- /* 68 */ "CACHESIZE",
- /* 69 */ "COMP",
- /* 70 */ "DURATION",
- /* 71 */ "NK_VARIABLE",
- /* 72 */ "MAXROWS",
- /* 73 */ "MINROWS",
- /* 74 */ "KEEP",
- /* 75 */ "PAGES",
- /* 76 */ "PAGESIZE",
- /* 77 */ "TSDB_PAGESIZE",
- /* 78 */ "PRECISION",
- /* 79 */ "REPLICA",
- /* 80 */ "VGROUPS",
- /* 81 */ "SINGLE_STABLE",
- /* 82 */ "RETENTIONS",
- /* 83 */ "SCHEMALESS",
- /* 84 */ "WAL_LEVEL",
- /* 85 */ "WAL_FSYNC_PERIOD",
- /* 86 */ "WAL_RETENTION_PERIOD",
- /* 87 */ "WAL_RETENTION_SIZE",
- /* 88 */ "WAL_ROLL_PERIOD",
- /* 89 */ "WAL_SEGMENT_SIZE",
- /* 90 */ "STT_TRIGGER",
- /* 91 */ "TABLE_PREFIX",
- /* 92 */ "TABLE_SUFFIX",
- /* 93 */ "NK_COLON",
- /* 94 */ "MAX_SPEED",
- /* 95 */ "START",
- /* 96 */ "WITH",
+ /* 48 */ "WITH",
+ /* 49 */ "DNODE",
+ /* 50 */ "PORT",
+ /* 51 */ "DNODES",
+ /* 52 */ "NK_IPTOKEN",
+ /* 53 */ "FORCE",
+ /* 54 */ "LOCAL",
+ /* 55 */ "QNODE",
+ /* 56 */ "BNODE",
+ /* 57 */ "SNODE",
+ /* 58 */ "MNODE",
+ /* 59 */ "DATABASE",
+ /* 60 */ "USE",
+ /* 61 */ "FLUSH",
+ /* 62 */ "TRIM",
+ /* 63 */ "COMPACT",
+ /* 64 */ "IF",
+ /* 65 */ "NOT",
+ /* 66 */ "EXISTS",
+ /* 67 */ "BUFFER",
+ /* 68 */ "CACHEMODEL",
+ /* 69 */ "CACHESIZE",
+ /* 70 */ "COMP",
+ /* 71 */ "DURATION",
+ /* 72 */ "NK_VARIABLE",
+ /* 73 */ "MAXROWS",
+ /* 74 */ "MINROWS",
+ /* 75 */ "KEEP",
+ /* 76 */ "PAGES",
+ /* 77 */ "PAGESIZE",
+ /* 78 */ "TSDB_PAGESIZE",
+ /* 79 */ "PRECISION",
+ /* 80 */ "REPLICA",
+ /* 81 */ "VGROUPS",
+ /* 82 */ "SINGLE_STABLE",
+ /* 83 */ "RETENTIONS",
+ /* 84 */ "SCHEMALESS",
+ /* 85 */ "WAL_LEVEL",
+ /* 86 */ "WAL_FSYNC_PERIOD",
+ /* 87 */ "WAL_RETENTION_PERIOD",
+ /* 88 */ "WAL_RETENTION_SIZE",
+ /* 89 */ "WAL_ROLL_PERIOD",
+ /* 90 */ "WAL_SEGMENT_SIZE",
+ /* 91 */ "STT_TRIGGER",
+ /* 92 */ "TABLE_PREFIX",
+ /* 93 */ "TABLE_SUFFIX",
+ /* 94 */ "NK_COLON",
+ /* 95 */ "MAX_SPEED",
+ /* 96 */ "START",
/* 97 */ "TIMESTAMP",
/* 98 */ "END",
/* 99 */ "TABLE",
@@ -1585,24 +1549,24 @@ static const char *const yyTokenName[] = {
/* 109 */ "NK_EQ",
/* 110 */ "USING",
/* 111 */ "TAGS",
- /* 112 */ "COMMENT",
- /* 113 */ "BOOL",
- /* 114 */ "TINYINT",
- /* 115 */ "SMALLINT",
- /* 116 */ "INT",
- /* 117 */ "INTEGER",
- /* 118 */ "BIGINT",
- /* 119 */ "FLOAT",
- /* 120 */ "DOUBLE",
- /* 121 */ "BINARY",
- /* 122 */ "NCHAR",
- /* 123 */ "UNSIGNED",
- /* 124 */ "JSON",
- /* 125 */ "VARCHAR",
- /* 126 */ "MEDIUMBLOB",
- /* 127 */ "BLOB",
- /* 128 */ "VARBINARY",
- /* 129 */ "DECIMAL",
+ /* 112 */ "BOOL",
+ /* 113 */ "TINYINT",
+ /* 114 */ "SMALLINT",
+ /* 115 */ "INT",
+ /* 116 */ "INTEGER",
+ /* 117 */ "BIGINT",
+ /* 118 */ "FLOAT",
+ /* 119 */ "DOUBLE",
+ /* 120 */ "BINARY",
+ /* 121 */ "NCHAR",
+ /* 122 */ "UNSIGNED",
+ /* 123 */ "JSON",
+ /* 124 */ "VARCHAR",
+ /* 125 */ "MEDIUMBLOB",
+ /* 126 */ "BLOB",
+ /* 127 */ "VARBINARY",
+ /* 128 */ "DECIMAL",
+ /* 129 */ "COMMENT",
/* 130 */ "MAX_DELAY",
/* 131 */ "WATERMARK",
/* 132 */ "ROLLUP",
@@ -1812,142 +1776,143 @@ static const char *const yyTokenName[] = {
/* 336 */ "sysinfo_opt",
/* 337 */ "privileges",
/* 338 */ "priv_level",
- /* 339 */ "priv_type_list",
- /* 340 */ "priv_type",
- /* 341 */ "db_name",
- /* 342 */ "topic_name",
- /* 343 */ "dnode_endpoint",
- /* 344 */ "force_opt",
- /* 345 */ "not_exists_opt",
- /* 346 */ "db_options",
- /* 347 */ "exists_opt",
- /* 348 */ "alter_db_options",
- /* 349 */ "speed_opt",
- /* 350 */ "start_opt",
- /* 351 */ "end_opt",
- /* 352 */ "integer_list",
- /* 353 */ "variable_list",
- /* 354 */ "retention_list",
- /* 355 */ "alter_db_option",
- /* 356 */ "retention",
- /* 357 */ "full_table_name",
- /* 358 */ "column_def_list",
- /* 359 */ "tags_def_opt",
- /* 360 */ "table_options",
- /* 361 */ "multi_create_clause",
- /* 362 */ "tags_def",
- /* 363 */ "multi_drop_clause",
- /* 364 */ "alter_table_clause",
- /* 365 */ "alter_table_options",
- /* 366 */ "column_name",
- /* 367 */ "type_name",
- /* 368 */ "signed_literal",
- /* 369 */ "create_subtable_clause",
- /* 370 */ "specific_cols_opt",
- /* 371 */ "expression_list",
- /* 372 */ "drop_table_clause",
- /* 373 */ "col_name_list",
- /* 374 */ "table_name",
- /* 375 */ "column_def",
- /* 376 */ "duration_list",
- /* 377 */ "rollup_func_list",
- /* 378 */ "alter_table_option",
- /* 379 */ "duration_literal",
- /* 380 */ "rollup_func_name",
- /* 381 */ "function_name",
- /* 382 */ "col_name",
- /* 383 */ "db_name_cond_opt",
- /* 384 */ "like_pattern_opt",
- /* 385 */ "table_name_cond",
- /* 386 */ "from_db_opt",
- /* 387 */ "tag_list_opt",
- /* 388 */ "tag_item",
- /* 389 */ "column_alias",
- /* 390 */ "full_index_name",
- /* 391 */ "index_options",
- /* 392 */ "index_name",
- /* 393 */ "func_list",
- /* 394 */ "sliding_opt",
- /* 395 */ "sma_stream_opt",
- /* 396 */ "func",
- /* 397 */ "sma_func_name",
- /* 398 */ "query_or_subquery",
- /* 399 */ "cgroup_name",
- /* 400 */ "analyze_opt",
- /* 401 */ "explain_options",
- /* 402 */ "insert_query",
- /* 403 */ "or_replace_opt",
- /* 404 */ "agg_func_opt",
- /* 405 */ "bufsize_opt",
- /* 406 */ "language_opt",
- /* 407 */ "stream_name",
- /* 408 */ "stream_options",
- /* 409 */ "col_list_opt",
- /* 410 */ "tag_def_or_ref_opt",
- /* 411 */ "subtable_opt",
- /* 412 */ "expression",
- /* 413 */ "dnode_list",
- /* 414 */ "where_clause_opt",
- /* 415 */ "signed",
- /* 416 */ "literal_func",
- /* 417 */ "literal_list",
- /* 418 */ "table_alias",
- /* 419 */ "expr_or_subquery",
- /* 420 */ "pseudo_column",
- /* 421 */ "column_reference",
- /* 422 */ "function_expression",
- /* 423 */ "case_when_expression",
- /* 424 */ "star_func",
- /* 425 */ "star_func_para_list",
- /* 426 */ "noarg_func",
- /* 427 */ "other_para_list",
- /* 428 */ "star_func_para",
- /* 429 */ "when_then_list",
- /* 430 */ "case_when_else_opt",
- /* 431 */ "common_expression",
- /* 432 */ "when_then_expr",
- /* 433 */ "predicate",
- /* 434 */ "compare_op",
- /* 435 */ "in_op",
- /* 436 */ "in_predicate_value",
- /* 437 */ "boolean_value_expression",
- /* 438 */ "boolean_primary",
- /* 439 */ "from_clause_opt",
- /* 440 */ "table_reference_list",
- /* 441 */ "table_reference",
- /* 442 */ "table_primary",
- /* 443 */ "joined_table",
- /* 444 */ "alias_opt",
- /* 445 */ "subquery",
- /* 446 */ "parenthesized_joined_table",
- /* 447 */ "join_type",
- /* 448 */ "search_condition",
- /* 449 */ "query_specification",
- /* 450 */ "set_quantifier_opt",
- /* 451 */ "select_list",
- /* 452 */ "partition_by_clause_opt",
- /* 453 */ "range_opt",
- /* 454 */ "every_opt",
- /* 455 */ "fill_opt",
- /* 456 */ "twindow_clause_opt",
- /* 457 */ "group_by_clause_opt",
- /* 458 */ "having_clause_opt",
- /* 459 */ "select_item",
- /* 460 */ "partition_list",
- /* 461 */ "partition_item",
- /* 462 */ "fill_mode",
- /* 463 */ "group_by_list",
- /* 464 */ "query_expression",
- /* 465 */ "query_simple",
- /* 466 */ "order_by_clause_opt",
- /* 467 */ "slimit_clause_opt",
- /* 468 */ "limit_clause_opt",
- /* 469 */ "union_query_expression",
- /* 470 */ "query_simple_or_subquery",
- /* 471 */ "sort_specification_list",
- /* 472 */ "sort_specification",
- /* 473 */ "ordering_specification_opt",
- /* 474 */ "null_ordering_opt",
+ /* 339 */ "with_opt",
+ /* 340 */ "priv_type_list",
+ /* 341 */ "priv_type",
+ /* 342 */ "db_name",
+ /* 343 */ "table_name",
+ /* 344 */ "topic_name",
+ /* 345 */ "search_condition",
+ /* 346 */ "dnode_endpoint",
+ /* 347 */ "force_opt",
+ /* 348 */ "not_exists_opt",
+ /* 349 */ "db_options",
+ /* 350 */ "exists_opt",
+ /* 351 */ "alter_db_options",
+ /* 352 */ "speed_opt",
+ /* 353 */ "start_opt",
+ /* 354 */ "end_opt",
+ /* 355 */ "integer_list",
+ /* 356 */ "variable_list",
+ /* 357 */ "retention_list",
+ /* 358 */ "alter_db_option",
+ /* 359 */ "retention",
+ /* 360 */ "full_table_name",
+ /* 361 */ "column_def_list",
+ /* 362 */ "tags_def_opt",
+ /* 363 */ "table_options",
+ /* 364 */ "multi_create_clause",
+ /* 365 */ "tags_def",
+ /* 366 */ "multi_drop_clause",
+ /* 367 */ "alter_table_clause",
+ /* 368 */ "alter_table_options",
+ /* 369 */ "column_name",
+ /* 370 */ "type_name",
+ /* 371 */ "signed_literal",
+ /* 372 */ "create_subtable_clause",
+ /* 373 */ "specific_cols_opt",
+ /* 374 */ "expression_list",
+ /* 375 */ "drop_table_clause",
+ /* 376 */ "col_name_list",
+ /* 377 */ "column_def",
+ /* 378 */ "duration_list",
+ /* 379 */ "rollup_func_list",
+ /* 380 */ "alter_table_option",
+ /* 381 */ "duration_literal",
+ /* 382 */ "rollup_func_name",
+ /* 383 */ "function_name",
+ /* 384 */ "col_name",
+ /* 385 */ "db_name_cond_opt",
+ /* 386 */ "like_pattern_opt",
+ /* 387 */ "table_name_cond",
+ /* 388 */ "from_db_opt",
+ /* 389 */ "tag_list_opt",
+ /* 390 */ "tag_item",
+ /* 391 */ "column_alias",
+ /* 392 */ "full_index_name",
+ /* 393 */ "index_options",
+ /* 394 */ "index_name",
+ /* 395 */ "func_list",
+ /* 396 */ "sliding_opt",
+ /* 397 */ "sma_stream_opt",
+ /* 398 */ "func",
+ /* 399 */ "sma_func_name",
+ /* 400 */ "query_or_subquery",
+ /* 401 */ "cgroup_name",
+ /* 402 */ "analyze_opt",
+ /* 403 */ "explain_options",
+ /* 404 */ "insert_query",
+ /* 405 */ "or_replace_opt",
+ /* 406 */ "agg_func_opt",
+ /* 407 */ "bufsize_opt",
+ /* 408 */ "language_opt",
+ /* 409 */ "stream_name",
+ /* 410 */ "stream_options",
+ /* 411 */ "col_list_opt",
+ /* 412 */ "tag_def_or_ref_opt",
+ /* 413 */ "subtable_opt",
+ /* 414 */ "expression",
+ /* 415 */ "dnode_list",
+ /* 416 */ "where_clause_opt",
+ /* 417 */ "signed",
+ /* 418 */ "literal_func",
+ /* 419 */ "literal_list",
+ /* 420 */ "table_alias",
+ /* 421 */ "expr_or_subquery",
+ /* 422 */ "pseudo_column",
+ /* 423 */ "column_reference",
+ /* 424 */ "function_expression",
+ /* 425 */ "case_when_expression",
+ /* 426 */ "star_func",
+ /* 427 */ "star_func_para_list",
+ /* 428 */ "noarg_func",
+ /* 429 */ "other_para_list",
+ /* 430 */ "star_func_para",
+ /* 431 */ "when_then_list",
+ /* 432 */ "case_when_else_opt",
+ /* 433 */ "common_expression",
+ /* 434 */ "when_then_expr",
+ /* 435 */ "predicate",
+ /* 436 */ "compare_op",
+ /* 437 */ "in_op",
+ /* 438 */ "in_predicate_value",
+ /* 439 */ "boolean_value_expression",
+ /* 440 */ "boolean_primary",
+ /* 441 */ "from_clause_opt",
+ /* 442 */ "table_reference_list",
+ /* 443 */ "table_reference",
+ /* 444 */ "table_primary",
+ /* 445 */ "joined_table",
+ /* 446 */ "alias_opt",
+ /* 447 */ "subquery",
+ /* 448 */ "parenthesized_joined_table",
+ /* 449 */ "join_type",
+ /* 450 */ "query_specification",
+ /* 451 */ "set_quantifier_opt",
+ /* 452 */ "select_list",
+ /* 453 */ "partition_by_clause_opt",
+ /* 454 */ "range_opt",
+ /* 455 */ "every_opt",
+ /* 456 */ "fill_opt",
+ /* 457 */ "twindow_clause_opt",
+ /* 458 */ "group_by_clause_opt",
+ /* 459 */ "having_clause_opt",
+ /* 460 */ "select_item",
+ /* 461 */ "partition_list",
+ /* 462 */ "partition_item",
+ /* 463 */ "fill_mode",
+ /* 464 */ "group_by_list",
+ /* 465 */ "query_expression",
+ /* 466 */ "query_simple",
+ /* 467 */ "order_by_clause_opt",
+ /* 468 */ "slimit_clause_opt",
+ /* 469 */ "limit_clause_opt",
+ /* 470 */ "union_query_expression",
+ /* 471 */ "query_simple_or_subquery",
+ /* 472 */ "sort_specification_list",
+ /* 473 */ "sort_specification",
+ /* 474 */ "ordering_specification_opt",
+ /* 475 */ "null_ordering_opt",
};
#endif /* defined(YYCOVERAGE) || !defined(NDEBUG) */
@@ -1986,8 +1951,8 @@ static const char *const yyRuleName[] = {
/* 28 */ "cmd ::= DROP USER user_name",
/* 29 */ "sysinfo_opt ::=",
/* 30 */ "sysinfo_opt ::= SYSINFO NK_INTEGER",
- /* 31 */ "cmd ::= GRANT privileges ON priv_level TO user_name",
- /* 32 */ "cmd ::= REVOKE privileges ON priv_level FROM user_name",
+ /* 31 */ "cmd ::= GRANT privileges ON priv_level with_opt TO user_name",
+ /* 32 */ "cmd ::= REVOKE privileges ON priv_level with_opt FROM user_name",
/* 33 */ "privileges ::= ALL",
/* 34 */ "privileges ::= priv_type_list",
/* 35 */ "privileges ::= SUBSCRIBE",
@@ -1997,545 +1962,547 @@ static const char *const yyRuleName[] = {
/* 39 */ "priv_type ::= WRITE",
/* 40 */ "priv_level ::= NK_STAR NK_DOT NK_STAR",
/* 41 */ "priv_level ::= db_name NK_DOT NK_STAR",
- /* 42 */ "priv_level ::= topic_name",
- /* 43 */ "cmd ::= CREATE DNODE dnode_endpoint",
- /* 44 */ "cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER",
- /* 45 */ "cmd ::= DROP DNODE NK_INTEGER force_opt",
- /* 46 */ "cmd ::= DROP DNODE dnode_endpoint force_opt",
- /* 47 */ "cmd ::= ALTER DNODE NK_INTEGER NK_STRING",
- /* 48 */ "cmd ::= ALTER DNODE NK_INTEGER NK_STRING NK_STRING",
- /* 49 */ "cmd ::= ALTER ALL DNODES NK_STRING",
- /* 50 */ "cmd ::= ALTER ALL DNODES NK_STRING NK_STRING",
- /* 51 */ "dnode_endpoint ::= NK_STRING",
- /* 52 */ "dnode_endpoint ::= NK_ID",
- /* 53 */ "dnode_endpoint ::= NK_IPTOKEN",
- /* 54 */ "force_opt ::=",
- /* 55 */ "force_opt ::= FORCE",
- /* 56 */ "cmd ::= ALTER LOCAL NK_STRING",
- /* 57 */ "cmd ::= ALTER LOCAL NK_STRING NK_STRING",
- /* 58 */ "cmd ::= CREATE QNODE ON DNODE NK_INTEGER",
- /* 59 */ "cmd ::= DROP QNODE ON DNODE NK_INTEGER",
- /* 60 */ "cmd ::= CREATE BNODE ON DNODE NK_INTEGER",
- /* 61 */ "cmd ::= DROP BNODE ON DNODE NK_INTEGER",
- /* 62 */ "cmd ::= CREATE SNODE ON DNODE NK_INTEGER",
- /* 63 */ "cmd ::= DROP SNODE ON DNODE NK_INTEGER",
- /* 64 */ "cmd ::= CREATE MNODE ON DNODE NK_INTEGER",
- /* 65 */ "cmd ::= DROP MNODE ON DNODE NK_INTEGER",
- /* 66 */ "cmd ::= CREATE DATABASE not_exists_opt db_name db_options",
- /* 67 */ "cmd ::= DROP DATABASE exists_opt db_name",
- /* 68 */ "cmd ::= USE db_name",
- /* 69 */ "cmd ::= ALTER DATABASE db_name alter_db_options",
- /* 70 */ "cmd ::= FLUSH DATABASE db_name",
- /* 71 */ "cmd ::= TRIM DATABASE db_name speed_opt",
- /* 72 */ "cmd ::= COMPACT DATABASE db_name start_opt end_opt",
- /* 73 */ "not_exists_opt ::= IF NOT EXISTS",
- /* 74 */ "not_exists_opt ::=",
- /* 75 */ "exists_opt ::= IF EXISTS",
- /* 76 */ "exists_opt ::=",
- /* 77 */ "db_options ::=",
- /* 78 */ "db_options ::= db_options BUFFER NK_INTEGER",
- /* 79 */ "db_options ::= db_options CACHEMODEL NK_STRING",
- /* 80 */ "db_options ::= db_options CACHESIZE NK_INTEGER",
- /* 81 */ "db_options ::= db_options COMP NK_INTEGER",
- /* 82 */ "db_options ::= db_options DURATION NK_INTEGER",
- /* 83 */ "db_options ::= db_options DURATION NK_VARIABLE",
- /* 84 */ "db_options ::= db_options MAXROWS NK_INTEGER",
- /* 85 */ "db_options ::= db_options MINROWS NK_INTEGER",
- /* 86 */ "db_options ::= db_options KEEP integer_list",
- /* 87 */ "db_options ::= db_options KEEP variable_list",
- /* 88 */ "db_options ::= db_options PAGES NK_INTEGER",
- /* 89 */ "db_options ::= db_options PAGESIZE NK_INTEGER",
- /* 90 */ "db_options ::= db_options TSDB_PAGESIZE NK_INTEGER",
- /* 91 */ "db_options ::= db_options PRECISION NK_STRING",
- /* 92 */ "db_options ::= db_options REPLICA NK_INTEGER",
- /* 93 */ "db_options ::= db_options VGROUPS NK_INTEGER",
- /* 94 */ "db_options ::= db_options SINGLE_STABLE NK_INTEGER",
- /* 95 */ "db_options ::= db_options RETENTIONS retention_list",
- /* 96 */ "db_options ::= db_options SCHEMALESS NK_INTEGER",
- /* 97 */ "db_options ::= db_options WAL_LEVEL NK_INTEGER",
- /* 98 */ "db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER",
- /* 99 */ "db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER",
- /* 100 */ "db_options ::= db_options WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER",
- /* 101 */ "db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER",
- /* 102 */ "db_options ::= db_options WAL_RETENTION_SIZE NK_MINUS NK_INTEGER",
- /* 103 */ "db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER",
- /* 104 */ "db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER",
- /* 105 */ "db_options ::= db_options STT_TRIGGER NK_INTEGER",
- /* 106 */ "db_options ::= db_options TABLE_PREFIX NK_INTEGER",
- /* 107 */ "db_options ::= db_options TABLE_SUFFIX NK_INTEGER",
- /* 108 */ "alter_db_options ::= alter_db_option",
- /* 109 */ "alter_db_options ::= alter_db_options alter_db_option",
- /* 110 */ "alter_db_option ::= BUFFER NK_INTEGER",
- /* 111 */ "alter_db_option ::= CACHEMODEL NK_STRING",
- /* 112 */ "alter_db_option ::= CACHESIZE NK_INTEGER",
- /* 113 */ "alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER",
- /* 114 */ "alter_db_option ::= KEEP integer_list",
- /* 115 */ "alter_db_option ::= KEEP variable_list",
- /* 116 */ "alter_db_option ::= PAGES NK_INTEGER",
- /* 117 */ "alter_db_option ::= REPLICA NK_INTEGER",
- /* 118 */ "alter_db_option ::= WAL_LEVEL NK_INTEGER",
- /* 119 */ "alter_db_option ::= STT_TRIGGER NK_INTEGER",
- /* 120 */ "alter_db_option ::= MINROWS NK_INTEGER",
- /* 121 */ "alter_db_option ::= WAL_RETENTION_PERIOD NK_INTEGER",
- /* 122 */ "alter_db_option ::= WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER",
- /* 123 */ "alter_db_option ::= WAL_RETENTION_SIZE NK_INTEGER",
- /* 124 */ "alter_db_option ::= WAL_RETENTION_SIZE NK_MINUS NK_INTEGER",
- /* 125 */ "integer_list ::= NK_INTEGER",
- /* 126 */ "integer_list ::= integer_list NK_COMMA NK_INTEGER",
- /* 127 */ "variable_list ::= NK_VARIABLE",
- /* 128 */ "variable_list ::= variable_list NK_COMMA NK_VARIABLE",
- /* 129 */ "retention_list ::= retention",
- /* 130 */ "retention_list ::= retention_list NK_COMMA retention",
- /* 131 */ "retention ::= NK_VARIABLE NK_COLON NK_VARIABLE",
- /* 132 */ "speed_opt ::=",
- /* 133 */ "speed_opt ::= MAX_SPEED NK_INTEGER",
- /* 134 */ "start_opt ::=",
- /* 135 */ "start_opt ::= START WITH NK_INTEGER",
- /* 136 */ "start_opt ::= START WITH NK_STRING",
- /* 137 */ "start_opt ::= START WITH TIMESTAMP NK_STRING",
- /* 138 */ "end_opt ::=",
- /* 139 */ "end_opt ::= END WITH NK_INTEGER",
- /* 140 */ "end_opt ::= END WITH NK_STRING",
- /* 141 */ "end_opt ::= END WITH TIMESTAMP NK_STRING",
- /* 142 */ "cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options",
- /* 143 */ "cmd ::= CREATE TABLE multi_create_clause",
- /* 144 */ "cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options",
- /* 145 */ "cmd ::= DROP TABLE multi_drop_clause",
- /* 146 */ "cmd ::= DROP STABLE exists_opt full_table_name",
- /* 147 */ "cmd ::= ALTER TABLE alter_table_clause",
- /* 148 */ "cmd ::= ALTER STABLE alter_table_clause",
- /* 149 */ "alter_table_clause ::= full_table_name alter_table_options",
- /* 150 */ "alter_table_clause ::= full_table_name ADD COLUMN column_name type_name",
- /* 151 */ "alter_table_clause ::= full_table_name DROP COLUMN column_name",
- /* 152 */ "alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name",
- /* 153 */ "alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name",
- /* 154 */ "alter_table_clause ::= full_table_name ADD TAG column_name type_name",
- /* 155 */ "alter_table_clause ::= full_table_name DROP TAG column_name",
- /* 156 */ "alter_table_clause ::= full_table_name MODIFY TAG column_name type_name",
- /* 157 */ "alter_table_clause ::= full_table_name RENAME TAG column_name column_name",
- /* 158 */ "alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal",
- /* 159 */ "multi_create_clause ::= create_subtable_clause",
- /* 160 */ "multi_create_clause ::= multi_create_clause create_subtable_clause",
- /* 161 */ "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",
- /* 162 */ "multi_drop_clause ::= drop_table_clause",
- /* 163 */ "multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause",
- /* 164 */ "drop_table_clause ::= exists_opt full_table_name",
- /* 165 */ "specific_cols_opt ::=",
- /* 166 */ "specific_cols_opt ::= NK_LP col_name_list NK_RP",
- /* 167 */ "full_table_name ::= table_name",
- /* 168 */ "full_table_name ::= db_name NK_DOT table_name",
- /* 169 */ "column_def_list ::= column_def",
- /* 170 */ "column_def_list ::= column_def_list NK_COMMA column_def",
- /* 171 */ "column_def ::= column_name type_name",
- /* 172 */ "column_def ::= column_name type_name COMMENT NK_STRING",
- /* 173 */ "type_name ::= BOOL",
- /* 174 */ "type_name ::= TINYINT",
- /* 175 */ "type_name ::= SMALLINT",
- /* 176 */ "type_name ::= INT",
- /* 177 */ "type_name ::= INTEGER",
- /* 178 */ "type_name ::= BIGINT",
- /* 179 */ "type_name ::= FLOAT",
- /* 180 */ "type_name ::= DOUBLE",
- /* 181 */ "type_name ::= BINARY NK_LP NK_INTEGER NK_RP",
- /* 182 */ "type_name ::= TIMESTAMP",
- /* 183 */ "type_name ::= NCHAR NK_LP NK_INTEGER NK_RP",
- /* 184 */ "type_name ::= TINYINT UNSIGNED",
- /* 185 */ "type_name ::= SMALLINT UNSIGNED",
- /* 186 */ "type_name ::= INT UNSIGNED",
- /* 187 */ "type_name ::= BIGINT UNSIGNED",
- /* 188 */ "type_name ::= JSON",
- /* 189 */ "type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP",
- /* 190 */ "type_name ::= MEDIUMBLOB",
- /* 191 */ "type_name ::= BLOB",
- /* 192 */ "type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP",
- /* 193 */ "type_name ::= DECIMAL",
- /* 194 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP",
- /* 195 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP",
- /* 196 */ "tags_def_opt ::=",
- /* 197 */ "tags_def_opt ::= tags_def",
- /* 198 */ "tags_def ::= TAGS NK_LP column_def_list NK_RP",
- /* 199 */ "table_options ::=",
- /* 200 */ "table_options ::= table_options COMMENT NK_STRING",
- /* 201 */ "table_options ::= table_options MAX_DELAY duration_list",
- /* 202 */ "table_options ::= table_options WATERMARK duration_list",
- /* 203 */ "table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP",
- /* 204 */ "table_options ::= table_options TTL NK_INTEGER",
- /* 205 */ "table_options ::= table_options SMA NK_LP col_name_list NK_RP",
- /* 206 */ "table_options ::= table_options DELETE_MARK duration_list",
- /* 207 */ "alter_table_options ::= alter_table_option",
- /* 208 */ "alter_table_options ::= alter_table_options alter_table_option",
- /* 209 */ "alter_table_option ::= COMMENT NK_STRING",
- /* 210 */ "alter_table_option ::= TTL NK_INTEGER",
- /* 211 */ "duration_list ::= duration_literal",
- /* 212 */ "duration_list ::= duration_list NK_COMMA duration_literal",
- /* 213 */ "rollup_func_list ::= rollup_func_name",
- /* 214 */ "rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name",
- /* 215 */ "rollup_func_name ::= function_name",
- /* 216 */ "rollup_func_name ::= FIRST",
- /* 217 */ "rollup_func_name ::= LAST",
- /* 218 */ "col_name_list ::= col_name",
- /* 219 */ "col_name_list ::= col_name_list NK_COMMA col_name",
- /* 220 */ "col_name ::= column_name",
- /* 221 */ "cmd ::= SHOW DNODES",
- /* 222 */ "cmd ::= SHOW USERS",
- /* 223 */ "cmd ::= SHOW USER PRIVILEGES",
- /* 224 */ "cmd ::= SHOW DATABASES",
- /* 225 */ "cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt",
- /* 226 */ "cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt",
- /* 227 */ "cmd ::= SHOW db_name_cond_opt VGROUPS",
- /* 228 */ "cmd ::= SHOW MNODES",
- /* 229 */ "cmd ::= SHOW QNODES",
- /* 230 */ "cmd ::= SHOW FUNCTIONS",
- /* 231 */ "cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt",
- /* 232 */ "cmd ::= SHOW STREAMS",
- /* 233 */ "cmd ::= SHOW ACCOUNTS",
- /* 234 */ "cmd ::= SHOW APPS",
- /* 235 */ "cmd ::= SHOW CONNECTIONS",
- /* 236 */ "cmd ::= SHOW LICENCES",
- /* 237 */ "cmd ::= SHOW GRANTS",
- /* 238 */ "cmd ::= SHOW CREATE DATABASE db_name",
- /* 239 */ "cmd ::= SHOW CREATE TABLE full_table_name",
- /* 240 */ "cmd ::= SHOW CREATE STABLE full_table_name",
- /* 241 */ "cmd ::= SHOW QUERIES",
- /* 242 */ "cmd ::= SHOW SCORES",
- /* 243 */ "cmd ::= SHOW TOPICS",
- /* 244 */ "cmd ::= SHOW VARIABLES",
- /* 245 */ "cmd ::= SHOW CLUSTER VARIABLES",
- /* 246 */ "cmd ::= SHOW LOCAL VARIABLES",
- /* 247 */ "cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt",
- /* 248 */ "cmd ::= SHOW BNODES",
- /* 249 */ "cmd ::= SHOW SNODES",
- /* 250 */ "cmd ::= SHOW CLUSTER",
- /* 251 */ "cmd ::= SHOW TRANSACTIONS",
- /* 252 */ "cmd ::= SHOW TABLE DISTRIBUTED full_table_name",
- /* 253 */ "cmd ::= SHOW CONSUMERS",
- /* 254 */ "cmd ::= SHOW SUBSCRIPTIONS",
- /* 255 */ "cmd ::= SHOW TAGS FROM table_name_cond from_db_opt",
- /* 256 */ "cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt",
- /* 257 */ "cmd ::= SHOW VNODES NK_INTEGER",
- /* 258 */ "cmd ::= SHOW VNODES NK_STRING",
- /* 259 */ "cmd ::= SHOW db_name_cond_opt ALIVE",
- /* 260 */ "cmd ::= SHOW CLUSTER ALIVE",
- /* 261 */ "db_name_cond_opt ::=",
- /* 262 */ "db_name_cond_opt ::= db_name NK_DOT",
- /* 263 */ "like_pattern_opt ::=",
- /* 264 */ "like_pattern_opt ::= LIKE NK_STRING",
- /* 265 */ "table_name_cond ::= table_name",
- /* 266 */ "from_db_opt ::=",
- /* 267 */ "from_db_opt ::= FROM db_name",
- /* 268 */ "tag_list_opt ::=",
- /* 269 */ "tag_list_opt ::= tag_item",
- /* 270 */ "tag_list_opt ::= tag_list_opt NK_COMMA tag_item",
- /* 271 */ "tag_item ::= TBNAME",
- /* 272 */ "tag_item ::= QTAGS",
- /* 273 */ "tag_item ::= column_name",
- /* 274 */ "tag_item ::= column_name column_alias",
- /* 275 */ "tag_item ::= column_name AS column_alias",
- /* 276 */ "cmd ::= CREATE SMA INDEX not_exists_opt full_index_name ON full_table_name index_options",
- /* 277 */ "cmd ::= CREATE INDEX not_exists_opt full_index_name ON full_table_name NK_LP col_name_list NK_RP",
- /* 278 */ "cmd ::= DROP INDEX exists_opt full_index_name",
- /* 279 */ "full_index_name ::= index_name",
- /* 280 */ "full_index_name ::= db_name NK_DOT index_name",
- /* 281 */ "index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt",
- /* 282 */ "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",
- /* 283 */ "func_list ::= func",
- /* 284 */ "func_list ::= func_list NK_COMMA func",
- /* 285 */ "func ::= sma_func_name NK_LP expression_list NK_RP",
- /* 286 */ "sma_func_name ::= function_name",
- /* 287 */ "sma_func_name ::= COUNT",
- /* 288 */ "sma_func_name ::= FIRST",
- /* 289 */ "sma_func_name ::= LAST",
- /* 290 */ "sma_func_name ::= LAST_ROW",
- /* 291 */ "sma_stream_opt ::=",
- /* 292 */ "sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal",
- /* 293 */ "sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal",
- /* 294 */ "sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal",
- /* 295 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery",
- /* 296 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name",
- /* 297 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name",
- /* 298 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name",
- /* 299 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name",
- /* 300 */ "cmd ::= DROP TOPIC exists_opt topic_name",
- /* 301 */ "cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name",
- /* 302 */ "cmd ::= DESC full_table_name",
- /* 303 */ "cmd ::= DESCRIBE full_table_name",
- /* 304 */ "cmd ::= RESET QUERY CACHE",
- /* 305 */ "cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery",
- /* 306 */ "cmd ::= EXPLAIN analyze_opt explain_options insert_query",
- /* 307 */ "analyze_opt ::=",
- /* 308 */ "analyze_opt ::= ANALYZE",
- /* 309 */ "explain_options ::=",
- /* 310 */ "explain_options ::= explain_options VERBOSE NK_BOOL",
- /* 311 */ "explain_options ::= explain_options RATIO NK_FLOAT",
- /* 312 */ "cmd ::= CREATE or_replace_opt agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt",
- /* 313 */ "cmd ::= DROP FUNCTION exists_opt function_name",
- /* 314 */ "agg_func_opt ::=",
- /* 315 */ "agg_func_opt ::= AGGREGATE",
- /* 316 */ "bufsize_opt ::=",
- /* 317 */ "bufsize_opt ::= BUFSIZE NK_INTEGER",
- /* 318 */ "language_opt ::=",
- /* 319 */ "language_opt ::= LANGUAGE NK_STRING",
- /* 320 */ "or_replace_opt ::=",
- /* 321 */ "or_replace_opt ::= OR REPLACE",
- /* 322 */ "cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name col_list_opt tag_def_or_ref_opt subtable_opt AS query_or_subquery",
- /* 323 */ "cmd ::= DROP STREAM exists_opt stream_name",
- /* 324 */ "col_list_opt ::=",
- /* 325 */ "col_list_opt ::= NK_LP col_name_list NK_RP",
- /* 326 */ "tag_def_or_ref_opt ::=",
- /* 327 */ "tag_def_or_ref_opt ::= tags_def",
- /* 328 */ "tag_def_or_ref_opt ::= TAGS NK_LP col_name_list NK_RP",
- /* 329 */ "stream_options ::=",
- /* 330 */ "stream_options ::= stream_options TRIGGER AT_ONCE",
- /* 331 */ "stream_options ::= stream_options TRIGGER WINDOW_CLOSE",
- /* 332 */ "stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal",
- /* 333 */ "stream_options ::= stream_options WATERMARK duration_literal",
- /* 334 */ "stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER",
- /* 335 */ "stream_options ::= stream_options FILL_HISTORY NK_INTEGER",
- /* 336 */ "stream_options ::= stream_options DELETE_MARK duration_literal",
- /* 337 */ "stream_options ::= stream_options IGNORE UPDATE NK_INTEGER",
- /* 338 */ "subtable_opt ::=",
- /* 339 */ "subtable_opt ::= SUBTABLE NK_LP expression NK_RP",
- /* 340 */ "cmd ::= KILL CONNECTION NK_INTEGER",
- /* 341 */ "cmd ::= KILL QUERY NK_STRING",
- /* 342 */ "cmd ::= KILL TRANSACTION NK_INTEGER",
- /* 343 */ "cmd ::= BALANCE VGROUP",
- /* 344 */ "cmd ::= BALANCE VGROUP LEADER",
- /* 345 */ "cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER",
- /* 346 */ "cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list",
- /* 347 */ "cmd ::= SPLIT VGROUP NK_INTEGER",
- /* 348 */ "dnode_list ::= DNODE NK_INTEGER",
- /* 349 */ "dnode_list ::= dnode_list DNODE NK_INTEGER",
- /* 350 */ "cmd ::= DELETE FROM full_table_name where_clause_opt",
- /* 351 */ "cmd ::= query_or_subquery",
- /* 352 */ "cmd ::= insert_query",
- /* 353 */ "insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery",
- /* 354 */ "insert_query ::= INSERT INTO full_table_name query_or_subquery",
- /* 355 */ "literal ::= NK_INTEGER",
- /* 356 */ "literal ::= NK_FLOAT",
- /* 357 */ "literal ::= NK_STRING",
- /* 358 */ "literal ::= NK_BOOL",
- /* 359 */ "literal ::= TIMESTAMP NK_STRING",
- /* 360 */ "literal ::= duration_literal",
- /* 361 */ "literal ::= NULL",
- /* 362 */ "literal ::= NK_QUESTION",
- /* 363 */ "duration_literal ::= NK_VARIABLE",
- /* 364 */ "signed ::= NK_INTEGER",
- /* 365 */ "signed ::= NK_PLUS NK_INTEGER",
- /* 366 */ "signed ::= NK_MINUS NK_INTEGER",
- /* 367 */ "signed ::= NK_FLOAT",
- /* 368 */ "signed ::= NK_PLUS NK_FLOAT",
- /* 369 */ "signed ::= NK_MINUS NK_FLOAT",
- /* 370 */ "signed_literal ::= signed",
- /* 371 */ "signed_literal ::= NK_STRING",
- /* 372 */ "signed_literal ::= NK_BOOL",
- /* 373 */ "signed_literal ::= TIMESTAMP NK_STRING",
- /* 374 */ "signed_literal ::= duration_literal",
- /* 375 */ "signed_literal ::= NULL",
- /* 376 */ "signed_literal ::= literal_func",
- /* 377 */ "signed_literal ::= NK_QUESTION",
- /* 378 */ "literal_list ::= signed_literal",
- /* 379 */ "literal_list ::= literal_list NK_COMMA signed_literal",
- /* 380 */ "db_name ::= NK_ID",
- /* 381 */ "table_name ::= NK_ID",
- /* 382 */ "column_name ::= NK_ID",
- /* 383 */ "function_name ::= NK_ID",
- /* 384 */ "table_alias ::= NK_ID",
- /* 385 */ "column_alias ::= NK_ID",
- /* 386 */ "user_name ::= NK_ID",
- /* 387 */ "topic_name ::= NK_ID",
- /* 388 */ "stream_name ::= NK_ID",
- /* 389 */ "cgroup_name ::= NK_ID",
- /* 390 */ "index_name ::= NK_ID",
- /* 391 */ "expr_or_subquery ::= expression",
- /* 392 */ "expression ::= literal",
- /* 393 */ "expression ::= pseudo_column",
- /* 394 */ "expression ::= column_reference",
- /* 395 */ "expression ::= function_expression",
- /* 396 */ "expression ::= case_when_expression",
- /* 397 */ "expression ::= NK_LP expression NK_RP",
- /* 398 */ "expression ::= NK_PLUS expr_or_subquery",
- /* 399 */ "expression ::= NK_MINUS expr_or_subquery",
- /* 400 */ "expression ::= expr_or_subquery NK_PLUS expr_or_subquery",
- /* 401 */ "expression ::= expr_or_subquery NK_MINUS expr_or_subquery",
- /* 402 */ "expression ::= expr_or_subquery NK_STAR expr_or_subquery",
- /* 403 */ "expression ::= expr_or_subquery NK_SLASH expr_or_subquery",
- /* 404 */ "expression ::= expr_or_subquery NK_REM expr_or_subquery",
- /* 405 */ "expression ::= column_reference NK_ARROW NK_STRING",
- /* 406 */ "expression ::= expr_or_subquery NK_BITAND expr_or_subquery",
- /* 407 */ "expression ::= expr_or_subquery NK_BITOR expr_or_subquery",
- /* 408 */ "expression_list ::= expr_or_subquery",
- /* 409 */ "expression_list ::= expression_list NK_COMMA expr_or_subquery",
- /* 410 */ "column_reference ::= column_name",
- /* 411 */ "column_reference ::= table_name NK_DOT column_name",
- /* 412 */ "pseudo_column ::= ROWTS",
- /* 413 */ "pseudo_column ::= TBNAME",
- /* 414 */ "pseudo_column ::= table_name NK_DOT TBNAME",
- /* 415 */ "pseudo_column ::= QSTART",
- /* 416 */ "pseudo_column ::= QEND",
- /* 417 */ "pseudo_column ::= QDURATION",
- /* 418 */ "pseudo_column ::= WSTART",
- /* 419 */ "pseudo_column ::= WEND",
- /* 420 */ "pseudo_column ::= WDURATION",
- /* 421 */ "pseudo_column ::= IROWTS",
- /* 422 */ "pseudo_column ::= ISFILLED",
- /* 423 */ "pseudo_column ::= QTAGS",
- /* 424 */ "function_expression ::= function_name NK_LP expression_list NK_RP",
- /* 425 */ "function_expression ::= star_func NK_LP star_func_para_list NK_RP",
- /* 426 */ "function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP",
- /* 427 */ "function_expression ::= literal_func",
- /* 428 */ "literal_func ::= noarg_func NK_LP NK_RP",
- /* 429 */ "literal_func ::= NOW",
- /* 430 */ "noarg_func ::= NOW",
- /* 431 */ "noarg_func ::= TODAY",
- /* 432 */ "noarg_func ::= TIMEZONE",
- /* 433 */ "noarg_func ::= DATABASE",
- /* 434 */ "noarg_func ::= CLIENT_VERSION",
- /* 435 */ "noarg_func ::= SERVER_VERSION",
- /* 436 */ "noarg_func ::= SERVER_STATUS",
- /* 437 */ "noarg_func ::= CURRENT_USER",
- /* 438 */ "noarg_func ::= USER",
- /* 439 */ "star_func ::= COUNT",
- /* 440 */ "star_func ::= FIRST",
- /* 441 */ "star_func ::= LAST",
- /* 442 */ "star_func ::= LAST_ROW",
- /* 443 */ "star_func_para_list ::= NK_STAR",
- /* 444 */ "star_func_para_list ::= other_para_list",
- /* 445 */ "other_para_list ::= star_func_para",
- /* 446 */ "other_para_list ::= other_para_list NK_COMMA star_func_para",
- /* 447 */ "star_func_para ::= expr_or_subquery",
- /* 448 */ "star_func_para ::= table_name NK_DOT NK_STAR",
- /* 449 */ "case_when_expression ::= CASE when_then_list case_when_else_opt END",
- /* 450 */ "case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END",
- /* 451 */ "when_then_list ::= when_then_expr",
- /* 452 */ "when_then_list ::= when_then_list when_then_expr",
- /* 453 */ "when_then_expr ::= WHEN common_expression THEN common_expression",
- /* 454 */ "case_when_else_opt ::=",
- /* 455 */ "case_when_else_opt ::= ELSE common_expression",
- /* 456 */ "predicate ::= expr_or_subquery compare_op expr_or_subquery",
- /* 457 */ "predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery",
- /* 458 */ "predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery",
- /* 459 */ "predicate ::= expr_or_subquery IS NULL",
- /* 460 */ "predicate ::= expr_or_subquery IS NOT NULL",
- /* 461 */ "predicate ::= expr_or_subquery in_op in_predicate_value",
- /* 462 */ "compare_op ::= NK_LT",
- /* 463 */ "compare_op ::= NK_GT",
- /* 464 */ "compare_op ::= NK_LE",
- /* 465 */ "compare_op ::= NK_GE",
- /* 466 */ "compare_op ::= NK_NE",
- /* 467 */ "compare_op ::= NK_EQ",
- /* 468 */ "compare_op ::= LIKE",
- /* 469 */ "compare_op ::= NOT LIKE",
- /* 470 */ "compare_op ::= MATCH",
- /* 471 */ "compare_op ::= NMATCH",
- /* 472 */ "compare_op ::= CONTAINS",
- /* 473 */ "in_op ::= IN",
- /* 474 */ "in_op ::= NOT IN",
- /* 475 */ "in_predicate_value ::= NK_LP literal_list NK_RP",
- /* 476 */ "boolean_value_expression ::= boolean_primary",
- /* 477 */ "boolean_value_expression ::= NOT boolean_primary",
- /* 478 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression",
- /* 479 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression",
- /* 480 */ "boolean_primary ::= predicate",
- /* 481 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP",
- /* 482 */ "common_expression ::= expr_or_subquery",
- /* 483 */ "common_expression ::= boolean_value_expression",
- /* 484 */ "from_clause_opt ::=",
- /* 485 */ "from_clause_opt ::= FROM table_reference_list",
- /* 486 */ "table_reference_list ::= table_reference",
- /* 487 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference",
- /* 488 */ "table_reference ::= table_primary",
- /* 489 */ "table_reference ::= joined_table",
- /* 490 */ "table_primary ::= table_name alias_opt",
- /* 491 */ "table_primary ::= db_name NK_DOT table_name alias_opt",
- /* 492 */ "table_primary ::= subquery alias_opt",
- /* 493 */ "table_primary ::= parenthesized_joined_table",
- /* 494 */ "alias_opt ::=",
- /* 495 */ "alias_opt ::= table_alias",
- /* 496 */ "alias_opt ::= AS table_alias",
- /* 497 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP",
- /* 498 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP",
- /* 499 */ "joined_table ::= table_reference join_type JOIN table_reference ON search_condition",
- /* 500 */ "join_type ::=",
- /* 501 */ "join_type ::= INNER",
- /* 502 */ "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",
- /* 503 */ "set_quantifier_opt ::=",
- /* 504 */ "set_quantifier_opt ::= DISTINCT",
- /* 505 */ "set_quantifier_opt ::= ALL",
- /* 506 */ "select_list ::= select_item",
- /* 507 */ "select_list ::= select_list NK_COMMA select_item",
- /* 508 */ "select_item ::= NK_STAR",
- /* 509 */ "select_item ::= common_expression",
- /* 510 */ "select_item ::= common_expression column_alias",
- /* 511 */ "select_item ::= common_expression AS column_alias",
- /* 512 */ "select_item ::= table_name NK_DOT NK_STAR",
- /* 513 */ "where_clause_opt ::=",
- /* 514 */ "where_clause_opt ::= WHERE search_condition",
- /* 515 */ "partition_by_clause_opt ::=",
- /* 516 */ "partition_by_clause_opt ::= PARTITION BY partition_list",
- /* 517 */ "partition_list ::= partition_item",
- /* 518 */ "partition_list ::= partition_list NK_COMMA partition_item",
- /* 519 */ "partition_item ::= expr_or_subquery",
- /* 520 */ "partition_item ::= expr_or_subquery column_alias",
- /* 521 */ "partition_item ::= expr_or_subquery AS column_alias",
- /* 522 */ "twindow_clause_opt ::=",
- /* 523 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP",
- /* 524 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP",
- /* 525 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt",
- /* 526 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt",
- /* 527 */ "twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition",
- /* 528 */ "sliding_opt ::=",
- /* 529 */ "sliding_opt ::= SLIDING NK_LP duration_literal NK_RP",
- /* 530 */ "fill_opt ::=",
- /* 531 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP",
- /* 532 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP",
- /* 533 */ "fill_opt ::= FILL NK_LP VALUE_F NK_COMMA literal_list NK_RP",
- /* 534 */ "fill_mode ::= NONE",
- /* 535 */ "fill_mode ::= PREV",
- /* 536 */ "fill_mode ::= NULL",
- /* 537 */ "fill_mode ::= NULL_F",
- /* 538 */ "fill_mode ::= LINEAR",
- /* 539 */ "fill_mode ::= NEXT",
- /* 540 */ "group_by_clause_opt ::=",
- /* 541 */ "group_by_clause_opt ::= GROUP BY group_by_list",
- /* 542 */ "group_by_list ::= expr_or_subquery",
- /* 543 */ "group_by_list ::= group_by_list NK_COMMA expr_or_subquery",
- /* 544 */ "having_clause_opt ::=",
- /* 545 */ "having_clause_opt ::= HAVING search_condition",
- /* 546 */ "range_opt ::=",
- /* 547 */ "range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP",
- /* 548 */ "every_opt ::=",
- /* 549 */ "every_opt ::= EVERY NK_LP duration_literal NK_RP",
- /* 550 */ "query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt",
- /* 551 */ "query_simple ::= query_specification",
- /* 552 */ "query_simple ::= union_query_expression",
- /* 553 */ "union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery",
- /* 554 */ "union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery",
- /* 555 */ "query_simple_or_subquery ::= query_simple",
- /* 556 */ "query_simple_or_subquery ::= subquery",
- /* 557 */ "query_or_subquery ::= query_expression",
- /* 558 */ "query_or_subquery ::= subquery",
- /* 559 */ "order_by_clause_opt ::=",
- /* 560 */ "order_by_clause_opt ::= ORDER BY sort_specification_list",
- /* 561 */ "slimit_clause_opt ::=",
- /* 562 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER",
- /* 563 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER",
- /* 564 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER",
- /* 565 */ "limit_clause_opt ::=",
- /* 566 */ "limit_clause_opt ::= LIMIT NK_INTEGER",
- /* 567 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER",
- /* 568 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER",
- /* 569 */ "subquery ::= NK_LP query_expression NK_RP",
- /* 570 */ "subquery ::= NK_LP subquery NK_RP",
- /* 571 */ "search_condition ::= common_expression",
- /* 572 */ "sort_specification_list ::= sort_specification",
- /* 573 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification",
- /* 574 */ "sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt",
- /* 575 */ "ordering_specification_opt ::=",
- /* 576 */ "ordering_specification_opt ::= ASC",
- /* 577 */ "ordering_specification_opt ::= DESC",
- /* 578 */ "null_ordering_opt ::=",
- /* 579 */ "null_ordering_opt ::= NULLS FIRST",
- /* 580 */ "null_ordering_opt ::= NULLS LAST",
+ /* 42 */ "priv_level ::= db_name NK_DOT table_name",
+ /* 43 */ "priv_level ::= topic_name",
+ /* 44 */ "with_opt ::=",
+ /* 45 */ "with_opt ::= WITH search_condition",
+ /* 46 */ "cmd ::= CREATE DNODE dnode_endpoint",
+ /* 47 */ "cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER",
+ /* 48 */ "cmd ::= DROP DNODE NK_INTEGER force_opt",
+ /* 49 */ "cmd ::= DROP DNODE dnode_endpoint force_opt",
+ /* 50 */ "cmd ::= ALTER DNODE NK_INTEGER NK_STRING",
+ /* 51 */ "cmd ::= ALTER DNODE NK_INTEGER NK_STRING NK_STRING",
+ /* 52 */ "cmd ::= ALTER ALL DNODES NK_STRING",
+ /* 53 */ "cmd ::= ALTER ALL DNODES NK_STRING NK_STRING",
+ /* 54 */ "dnode_endpoint ::= NK_STRING",
+ /* 55 */ "dnode_endpoint ::= NK_ID",
+ /* 56 */ "dnode_endpoint ::= NK_IPTOKEN",
+ /* 57 */ "force_opt ::=",
+ /* 58 */ "force_opt ::= FORCE",
+ /* 59 */ "cmd ::= ALTER LOCAL NK_STRING",
+ /* 60 */ "cmd ::= ALTER LOCAL NK_STRING NK_STRING",
+ /* 61 */ "cmd ::= CREATE QNODE ON DNODE NK_INTEGER",
+ /* 62 */ "cmd ::= DROP QNODE ON DNODE NK_INTEGER",
+ /* 63 */ "cmd ::= CREATE BNODE ON DNODE NK_INTEGER",
+ /* 64 */ "cmd ::= DROP BNODE ON DNODE NK_INTEGER",
+ /* 65 */ "cmd ::= CREATE SNODE ON DNODE NK_INTEGER",
+ /* 66 */ "cmd ::= DROP SNODE ON DNODE NK_INTEGER",
+ /* 67 */ "cmd ::= CREATE MNODE ON DNODE NK_INTEGER",
+ /* 68 */ "cmd ::= DROP MNODE ON DNODE NK_INTEGER",
+ /* 69 */ "cmd ::= CREATE DATABASE not_exists_opt db_name db_options",
+ /* 70 */ "cmd ::= DROP DATABASE exists_opt db_name",
+ /* 71 */ "cmd ::= USE db_name",
+ /* 72 */ "cmd ::= ALTER DATABASE db_name alter_db_options",
+ /* 73 */ "cmd ::= FLUSH DATABASE db_name",
+ /* 74 */ "cmd ::= TRIM DATABASE db_name speed_opt",
+ /* 75 */ "cmd ::= COMPACT DATABASE db_name start_opt end_opt",
+ /* 76 */ "not_exists_opt ::= IF NOT EXISTS",
+ /* 77 */ "not_exists_opt ::=",
+ /* 78 */ "exists_opt ::= IF EXISTS",
+ /* 79 */ "exists_opt ::=",
+ /* 80 */ "db_options ::=",
+ /* 81 */ "db_options ::= db_options BUFFER NK_INTEGER",
+ /* 82 */ "db_options ::= db_options CACHEMODEL NK_STRING",
+ /* 83 */ "db_options ::= db_options CACHESIZE NK_INTEGER",
+ /* 84 */ "db_options ::= db_options COMP NK_INTEGER",
+ /* 85 */ "db_options ::= db_options DURATION NK_INTEGER",
+ /* 86 */ "db_options ::= db_options DURATION NK_VARIABLE",
+ /* 87 */ "db_options ::= db_options MAXROWS NK_INTEGER",
+ /* 88 */ "db_options ::= db_options MINROWS NK_INTEGER",
+ /* 89 */ "db_options ::= db_options KEEP integer_list",
+ /* 90 */ "db_options ::= db_options KEEP variable_list",
+ /* 91 */ "db_options ::= db_options PAGES NK_INTEGER",
+ /* 92 */ "db_options ::= db_options PAGESIZE NK_INTEGER",
+ /* 93 */ "db_options ::= db_options TSDB_PAGESIZE NK_INTEGER",
+ /* 94 */ "db_options ::= db_options PRECISION NK_STRING",
+ /* 95 */ "db_options ::= db_options REPLICA NK_INTEGER",
+ /* 96 */ "db_options ::= db_options VGROUPS NK_INTEGER",
+ /* 97 */ "db_options ::= db_options SINGLE_STABLE NK_INTEGER",
+ /* 98 */ "db_options ::= db_options RETENTIONS retention_list",
+ /* 99 */ "db_options ::= db_options SCHEMALESS NK_INTEGER",
+ /* 100 */ "db_options ::= db_options WAL_LEVEL NK_INTEGER",
+ /* 101 */ "db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER",
+ /* 102 */ "db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER",
+ /* 103 */ "db_options ::= db_options WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER",
+ /* 104 */ "db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER",
+ /* 105 */ "db_options ::= db_options WAL_RETENTION_SIZE NK_MINUS NK_INTEGER",
+ /* 106 */ "db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER",
+ /* 107 */ "db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER",
+ /* 108 */ "db_options ::= db_options STT_TRIGGER NK_INTEGER",
+ /* 109 */ "db_options ::= db_options TABLE_PREFIX NK_INTEGER",
+ /* 110 */ "db_options ::= db_options TABLE_SUFFIX NK_INTEGER",
+ /* 111 */ "alter_db_options ::= alter_db_option",
+ /* 112 */ "alter_db_options ::= alter_db_options alter_db_option",
+ /* 113 */ "alter_db_option ::= BUFFER NK_INTEGER",
+ /* 114 */ "alter_db_option ::= CACHEMODEL NK_STRING",
+ /* 115 */ "alter_db_option ::= CACHESIZE NK_INTEGER",
+ /* 116 */ "alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER",
+ /* 117 */ "alter_db_option ::= KEEP integer_list",
+ /* 118 */ "alter_db_option ::= KEEP variable_list",
+ /* 119 */ "alter_db_option ::= PAGES NK_INTEGER",
+ /* 120 */ "alter_db_option ::= REPLICA NK_INTEGER",
+ /* 121 */ "alter_db_option ::= WAL_LEVEL NK_INTEGER",
+ /* 122 */ "alter_db_option ::= STT_TRIGGER NK_INTEGER",
+ /* 123 */ "alter_db_option ::= MINROWS NK_INTEGER",
+ /* 124 */ "alter_db_option ::= WAL_RETENTION_PERIOD NK_INTEGER",
+ /* 125 */ "alter_db_option ::= WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER",
+ /* 126 */ "alter_db_option ::= WAL_RETENTION_SIZE NK_INTEGER",
+ /* 127 */ "alter_db_option ::= WAL_RETENTION_SIZE NK_MINUS NK_INTEGER",
+ /* 128 */ "integer_list ::= NK_INTEGER",
+ /* 129 */ "integer_list ::= integer_list NK_COMMA NK_INTEGER",
+ /* 130 */ "variable_list ::= NK_VARIABLE",
+ /* 131 */ "variable_list ::= variable_list NK_COMMA NK_VARIABLE",
+ /* 132 */ "retention_list ::= retention",
+ /* 133 */ "retention_list ::= retention_list NK_COMMA retention",
+ /* 134 */ "retention ::= NK_VARIABLE NK_COLON NK_VARIABLE",
+ /* 135 */ "speed_opt ::=",
+ /* 136 */ "speed_opt ::= MAX_SPEED NK_INTEGER",
+ /* 137 */ "start_opt ::=",
+ /* 138 */ "start_opt ::= START WITH NK_INTEGER",
+ /* 139 */ "start_opt ::= START WITH NK_STRING",
+ /* 140 */ "start_opt ::= START WITH TIMESTAMP NK_STRING",
+ /* 141 */ "end_opt ::=",
+ /* 142 */ "end_opt ::= END WITH NK_INTEGER",
+ /* 143 */ "end_opt ::= END WITH NK_STRING",
+ /* 144 */ "end_opt ::= END WITH TIMESTAMP NK_STRING",
+ /* 145 */ "cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options",
+ /* 146 */ "cmd ::= CREATE TABLE multi_create_clause",
+ /* 147 */ "cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options",
+ /* 148 */ "cmd ::= DROP TABLE multi_drop_clause",
+ /* 149 */ "cmd ::= DROP STABLE exists_opt full_table_name",
+ /* 150 */ "cmd ::= ALTER TABLE alter_table_clause",
+ /* 151 */ "cmd ::= ALTER STABLE alter_table_clause",
+ /* 152 */ "alter_table_clause ::= full_table_name alter_table_options",
+ /* 153 */ "alter_table_clause ::= full_table_name ADD COLUMN column_name type_name",
+ /* 154 */ "alter_table_clause ::= full_table_name DROP COLUMN column_name",
+ /* 155 */ "alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name",
+ /* 156 */ "alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name",
+ /* 157 */ "alter_table_clause ::= full_table_name ADD TAG column_name type_name",
+ /* 158 */ "alter_table_clause ::= full_table_name DROP TAG column_name",
+ /* 159 */ "alter_table_clause ::= full_table_name MODIFY TAG column_name type_name",
+ /* 160 */ "alter_table_clause ::= full_table_name RENAME TAG column_name column_name",
+ /* 161 */ "alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal",
+ /* 162 */ "multi_create_clause ::= create_subtable_clause",
+ /* 163 */ "multi_create_clause ::= multi_create_clause create_subtable_clause",
+ /* 164 */ "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",
+ /* 165 */ "multi_drop_clause ::= drop_table_clause",
+ /* 166 */ "multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause",
+ /* 167 */ "drop_table_clause ::= exists_opt full_table_name",
+ /* 168 */ "specific_cols_opt ::=",
+ /* 169 */ "specific_cols_opt ::= NK_LP col_name_list NK_RP",
+ /* 170 */ "full_table_name ::= table_name",
+ /* 171 */ "full_table_name ::= db_name NK_DOT table_name",
+ /* 172 */ "column_def_list ::= column_def",
+ /* 173 */ "column_def_list ::= column_def_list NK_COMMA column_def",
+ /* 174 */ "column_def ::= column_name type_name",
+ /* 175 */ "type_name ::= BOOL",
+ /* 176 */ "type_name ::= TINYINT",
+ /* 177 */ "type_name ::= SMALLINT",
+ /* 178 */ "type_name ::= INT",
+ /* 179 */ "type_name ::= INTEGER",
+ /* 180 */ "type_name ::= BIGINT",
+ /* 181 */ "type_name ::= FLOAT",
+ /* 182 */ "type_name ::= DOUBLE",
+ /* 183 */ "type_name ::= BINARY NK_LP NK_INTEGER NK_RP",
+ /* 184 */ "type_name ::= TIMESTAMP",
+ /* 185 */ "type_name ::= NCHAR NK_LP NK_INTEGER NK_RP",
+ /* 186 */ "type_name ::= TINYINT UNSIGNED",
+ /* 187 */ "type_name ::= SMALLINT UNSIGNED",
+ /* 188 */ "type_name ::= INT UNSIGNED",
+ /* 189 */ "type_name ::= BIGINT UNSIGNED",
+ /* 190 */ "type_name ::= JSON",
+ /* 191 */ "type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP",
+ /* 192 */ "type_name ::= MEDIUMBLOB",
+ /* 193 */ "type_name ::= BLOB",
+ /* 194 */ "type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP",
+ /* 195 */ "type_name ::= DECIMAL",
+ /* 196 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP",
+ /* 197 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP",
+ /* 198 */ "tags_def_opt ::=",
+ /* 199 */ "tags_def_opt ::= tags_def",
+ /* 200 */ "tags_def ::= TAGS NK_LP column_def_list NK_RP",
+ /* 201 */ "table_options ::=",
+ /* 202 */ "table_options ::= table_options COMMENT NK_STRING",
+ /* 203 */ "table_options ::= table_options MAX_DELAY duration_list",
+ /* 204 */ "table_options ::= table_options WATERMARK duration_list",
+ /* 205 */ "table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP",
+ /* 206 */ "table_options ::= table_options TTL NK_INTEGER",
+ /* 207 */ "table_options ::= table_options SMA NK_LP col_name_list NK_RP",
+ /* 208 */ "table_options ::= table_options DELETE_MARK duration_list",
+ /* 209 */ "alter_table_options ::= alter_table_option",
+ /* 210 */ "alter_table_options ::= alter_table_options alter_table_option",
+ /* 211 */ "alter_table_option ::= COMMENT NK_STRING",
+ /* 212 */ "alter_table_option ::= TTL NK_INTEGER",
+ /* 213 */ "duration_list ::= duration_literal",
+ /* 214 */ "duration_list ::= duration_list NK_COMMA duration_literal",
+ /* 215 */ "rollup_func_list ::= rollup_func_name",
+ /* 216 */ "rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name",
+ /* 217 */ "rollup_func_name ::= function_name",
+ /* 218 */ "rollup_func_name ::= FIRST",
+ /* 219 */ "rollup_func_name ::= LAST",
+ /* 220 */ "col_name_list ::= col_name",
+ /* 221 */ "col_name_list ::= col_name_list NK_COMMA col_name",
+ /* 222 */ "col_name ::= column_name",
+ /* 223 */ "cmd ::= SHOW DNODES",
+ /* 224 */ "cmd ::= SHOW USERS",
+ /* 225 */ "cmd ::= SHOW USER PRIVILEGES",
+ /* 226 */ "cmd ::= SHOW DATABASES",
+ /* 227 */ "cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt",
+ /* 228 */ "cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt",
+ /* 229 */ "cmd ::= SHOW db_name_cond_opt VGROUPS",
+ /* 230 */ "cmd ::= SHOW MNODES",
+ /* 231 */ "cmd ::= SHOW QNODES",
+ /* 232 */ "cmd ::= SHOW FUNCTIONS",
+ /* 233 */ "cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt",
+ /* 234 */ "cmd ::= SHOW STREAMS",
+ /* 235 */ "cmd ::= SHOW ACCOUNTS",
+ /* 236 */ "cmd ::= SHOW APPS",
+ /* 237 */ "cmd ::= SHOW CONNECTIONS",
+ /* 238 */ "cmd ::= SHOW LICENCES",
+ /* 239 */ "cmd ::= SHOW GRANTS",
+ /* 240 */ "cmd ::= SHOW CREATE DATABASE db_name",
+ /* 241 */ "cmd ::= SHOW CREATE TABLE full_table_name",
+ /* 242 */ "cmd ::= SHOW CREATE STABLE full_table_name",
+ /* 243 */ "cmd ::= SHOW QUERIES",
+ /* 244 */ "cmd ::= SHOW SCORES",
+ /* 245 */ "cmd ::= SHOW TOPICS",
+ /* 246 */ "cmd ::= SHOW VARIABLES",
+ /* 247 */ "cmd ::= SHOW CLUSTER VARIABLES",
+ /* 248 */ "cmd ::= SHOW LOCAL VARIABLES",
+ /* 249 */ "cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt",
+ /* 250 */ "cmd ::= SHOW BNODES",
+ /* 251 */ "cmd ::= SHOW SNODES",
+ /* 252 */ "cmd ::= SHOW CLUSTER",
+ /* 253 */ "cmd ::= SHOW TRANSACTIONS",
+ /* 254 */ "cmd ::= SHOW TABLE DISTRIBUTED full_table_name",
+ /* 255 */ "cmd ::= SHOW CONSUMERS",
+ /* 256 */ "cmd ::= SHOW SUBSCRIPTIONS",
+ /* 257 */ "cmd ::= SHOW TAGS FROM table_name_cond from_db_opt",
+ /* 258 */ "cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt",
+ /* 259 */ "cmd ::= SHOW VNODES NK_INTEGER",
+ /* 260 */ "cmd ::= SHOW VNODES NK_STRING",
+ /* 261 */ "cmd ::= SHOW db_name_cond_opt ALIVE",
+ /* 262 */ "cmd ::= SHOW CLUSTER ALIVE",
+ /* 263 */ "db_name_cond_opt ::=",
+ /* 264 */ "db_name_cond_opt ::= db_name NK_DOT",
+ /* 265 */ "like_pattern_opt ::=",
+ /* 266 */ "like_pattern_opt ::= LIKE NK_STRING",
+ /* 267 */ "table_name_cond ::= table_name",
+ /* 268 */ "from_db_opt ::=",
+ /* 269 */ "from_db_opt ::= FROM db_name",
+ /* 270 */ "tag_list_opt ::=",
+ /* 271 */ "tag_list_opt ::= tag_item",
+ /* 272 */ "tag_list_opt ::= tag_list_opt NK_COMMA tag_item",
+ /* 273 */ "tag_item ::= TBNAME",
+ /* 274 */ "tag_item ::= QTAGS",
+ /* 275 */ "tag_item ::= column_name",
+ /* 276 */ "tag_item ::= column_name column_alias",
+ /* 277 */ "tag_item ::= column_name AS column_alias",
+ /* 278 */ "cmd ::= CREATE SMA INDEX not_exists_opt full_index_name ON full_table_name index_options",
+ /* 279 */ "cmd ::= CREATE INDEX not_exists_opt full_index_name ON full_table_name NK_LP col_name_list NK_RP",
+ /* 280 */ "cmd ::= DROP INDEX exists_opt full_index_name",
+ /* 281 */ "full_index_name ::= index_name",
+ /* 282 */ "full_index_name ::= db_name NK_DOT index_name",
+ /* 283 */ "index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt",
+ /* 284 */ "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",
+ /* 285 */ "func_list ::= func",
+ /* 286 */ "func_list ::= func_list NK_COMMA func",
+ /* 287 */ "func ::= sma_func_name NK_LP expression_list NK_RP",
+ /* 288 */ "sma_func_name ::= function_name",
+ /* 289 */ "sma_func_name ::= COUNT",
+ /* 290 */ "sma_func_name ::= FIRST",
+ /* 291 */ "sma_func_name ::= LAST",
+ /* 292 */ "sma_func_name ::= LAST_ROW",
+ /* 293 */ "sma_stream_opt ::=",
+ /* 294 */ "sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal",
+ /* 295 */ "sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal",
+ /* 296 */ "sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal",
+ /* 297 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery",
+ /* 298 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name",
+ /* 299 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name",
+ /* 300 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name",
+ /* 301 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name",
+ /* 302 */ "cmd ::= DROP TOPIC exists_opt topic_name",
+ /* 303 */ "cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name",
+ /* 304 */ "cmd ::= DESC full_table_name",
+ /* 305 */ "cmd ::= DESCRIBE full_table_name",
+ /* 306 */ "cmd ::= RESET QUERY CACHE",
+ /* 307 */ "cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery",
+ /* 308 */ "cmd ::= EXPLAIN analyze_opt explain_options insert_query",
+ /* 309 */ "analyze_opt ::=",
+ /* 310 */ "analyze_opt ::= ANALYZE",
+ /* 311 */ "explain_options ::=",
+ /* 312 */ "explain_options ::= explain_options VERBOSE NK_BOOL",
+ /* 313 */ "explain_options ::= explain_options RATIO NK_FLOAT",
+ /* 314 */ "cmd ::= CREATE or_replace_opt agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt",
+ /* 315 */ "cmd ::= DROP FUNCTION exists_opt function_name",
+ /* 316 */ "agg_func_opt ::=",
+ /* 317 */ "agg_func_opt ::= AGGREGATE",
+ /* 318 */ "bufsize_opt ::=",
+ /* 319 */ "bufsize_opt ::= BUFSIZE NK_INTEGER",
+ /* 320 */ "language_opt ::=",
+ /* 321 */ "language_opt ::= LANGUAGE NK_STRING",
+ /* 322 */ "or_replace_opt ::=",
+ /* 323 */ "or_replace_opt ::= OR REPLACE",
+ /* 324 */ "cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name col_list_opt tag_def_or_ref_opt subtable_opt AS query_or_subquery",
+ /* 325 */ "cmd ::= DROP STREAM exists_opt stream_name",
+ /* 326 */ "col_list_opt ::=",
+ /* 327 */ "col_list_opt ::= NK_LP col_name_list NK_RP",
+ /* 328 */ "tag_def_or_ref_opt ::=",
+ /* 329 */ "tag_def_or_ref_opt ::= tags_def",
+ /* 330 */ "tag_def_or_ref_opt ::= TAGS NK_LP col_name_list NK_RP",
+ /* 331 */ "stream_options ::=",
+ /* 332 */ "stream_options ::= stream_options TRIGGER AT_ONCE",
+ /* 333 */ "stream_options ::= stream_options TRIGGER WINDOW_CLOSE",
+ /* 334 */ "stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal",
+ /* 335 */ "stream_options ::= stream_options WATERMARK duration_literal",
+ /* 336 */ "stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER",
+ /* 337 */ "stream_options ::= stream_options FILL_HISTORY NK_INTEGER",
+ /* 338 */ "stream_options ::= stream_options DELETE_MARK duration_literal",
+ /* 339 */ "stream_options ::= stream_options IGNORE UPDATE NK_INTEGER",
+ /* 340 */ "subtable_opt ::=",
+ /* 341 */ "subtable_opt ::= SUBTABLE NK_LP expression NK_RP",
+ /* 342 */ "cmd ::= KILL CONNECTION NK_INTEGER",
+ /* 343 */ "cmd ::= KILL QUERY NK_STRING",
+ /* 344 */ "cmd ::= KILL TRANSACTION NK_INTEGER",
+ /* 345 */ "cmd ::= BALANCE VGROUP",
+ /* 346 */ "cmd ::= BALANCE VGROUP LEADER",
+ /* 347 */ "cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER",
+ /* 348 */ "cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list",
+ /* 349 */ "cmd ::= SPLIT VGROUP NK_INTEGER",
+ /* 350 */ "dnode_list ::= DNODE NK_INTEGER",
+ /* 351 */ "dnode_list ::= dnode_list DNODE NK_INTEGER",
+ /* 352 */ "cmd ::= DELETE FROM full_table_name where_clause_opt",
+ /* 353 */ "cmd ::= query_or_subquery",
+ /* 354 */ "cmd ::= insert_query",
+ /* 355 */ "insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery",
+ /* 356 */ "insert_query ::= INSERT INTO full_table_name query_or_subquery",
+ /* 357 */ "literal ::= NK_INTEGER",
+ /* 358 */ "literal ::= NK_FLOAT",
+ /* 359 */ "literal ::= NK_STRING",
+ /* 360 */ "literal ::= NK_BOOL",
+ /* 361 */ "literal ::= TIMESTAMP NK_STRING",
+ /* 362 */ "literal ::= duration_literal",
+ /* 363 */ "literal ::= NULL",
+ /* 364 */ "literal ::= NK_QUESTION",
+ /* 365 */ "duration_literal ::= NK_VARIABLE",
+ /* 366 */ "signed ::= NK_INTEGER",
+ /* 367 */ "signed ::= NK_PLUS NK_INTEGER",
+ /* 368 */ "signed ::= NK_MINUS NK_INTEGER",
+ /* 369 */ "signed ::= NK_FLOAT",
+ /* 370 */ "signed ::= NK_PLUS NK_FLOAT",
+ /* 371 */ "signed ::= NK_MINUS NK_FLOAT",
+ /* 372 */ "signed_literal ::= signed",
+ /* 373 */ "signed_literal ::= NK_STRING",
+ /* 374 */ "signed_literal ::= NK_BOOL",
+ /* 375 */ "signed_literal ::= TIMESTAMP NK_STRING",
+ /* 376 */ "signed_literal ::= duration_literal",
+ /* 377 */ "signed_literal ::= NULL",
+ /* 378 */ "signed_literal ::= literal_func",
+ /* 379 */ "signed_literal ::= NK_QUESTION",
+ /* 380 */ "literal_list ::= signed_literal",
+ /* 381 */ "literal_list ::= literal_list NK_COMMA signed_literal",
+ /* 382 */ "db_name ::= NK_ID",
+ /* 383 */ "table_name ::= NK_ID",
+ /* 384 */ "column_name ::= NK_ID",
+ /* 385 */ "function_name ::= NK_ID",
+ /* 386 */ "table_alias ::= NK_ID",
+ /* 387 */ "column_alias ::= NK_ID",
+ /* 388 */ "user_name ::= NK_ID",
+ /* 389 */ "topic_name ::= NK_ID",
+ /* 390 */ "stream_name ::= NK_ID",
+ /* 391 */ "cgroup_name ::= NK_ID",
+ /* 392 */ "index_name ::= NK_ID",
+ /* 393 */ "expr_or_subquery ::= expression",
+ /* 394 */ "expression ::= literal",
+ /* 395 */ "expression ::= pseudo_column",
+ /* 396 */ "expression ::= column_reference",
+ /* 397 */ "expression ::= function_expression",
+ /* 398 */ "expression ::= case_when_expression",
+ /* 399 */ "expression ::= NK_LP expression NK_RP",
+ /* 400 */ "expression ::= NK_PLUS expr_or_subquery",
+ /* 401 */ "expression ::= NK_MINUS expr_or_subquery",
+ /* 402 */ "expression ::= expr_or_subquery NK_PLUS expr_or_subquery",
+ /* 403 */ "expression ::= expr_or_subquery NK_MINUS expr_or_subquery",
+ /* 404 */ "expression ::= expr_or_subquery NK_STAR expr_or_subquery",
+ /* 405 */ "expression ::= expr_or_subquery NK_SLASH expr_or_subquery",
+ /* 406 */ "expression ::= expr_or_subquery NK_REM expr_or_subquery",
+ /* 407 */ "expression ::= column_reference NK_ARROW NK_STRING",
+ /* 408 */ "expression ::= expr_or_subquery NK_BITAND expr_or_subquery",
+ /* 409 */ "expression ::= expr_or_subquery NK_BITOR expr_or_subquery",
+ /* 410 */ "expression_list ::= expr_or_subquery",
+ /* 411 */ "expression_list ::= expression_list NK_COMMA expr_or_subquery",
+ /* 412 */ "column_reference ::= column_name",
+ /* 413 */ "column_reference ::= table_name NK_DOT column_name",
+ /* 414 */ "pseudo_column ::= ROWTS",
+ /* 415 */ "pseudo_column ::= TBNAME",
+ /* 416 */ "pseudo_column ::= table_name NK_DOT TBNAME",
+ /* 417 */ "pseudo_column ::= QSTART",
+ /* 418 */ "pseudo_column ::= QEND",
+ /* 419 */ "pseudo_column ::= QDURATION",
+ /* 420 */ "pseudo_column ::= WSTART",
+ /* 421 */ "pseudo_column ::= WEND",
+ /* 422 */ "pseudo_column ::= WDURATION",
+ /* 423 */ "pseudo_column ::= IROWTS",
+ /* 424 */ "pseudo_column ::= ISFILLED",
+ /* 425 */ "pseudo_column ::= QTAGS",
+ /* 426 */ "function_expression ::= function_name NK_LP expression_list NK_RP",
+ /* 427 */ "function_expression ::= star_func NK_LP star_func_para_list NK_RP",
+ /* 428 */ "function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP",
+ /* 429 */ "function_expression ::= literal_func",
+ /* 430 */ "literal_func ::= noarg_func NK_LP NK_RP",
+ /* 431 */ "literal_func ::= NOW",
+ /* 432 */ "noarg_func ::= NOW",
+ /* 433 */ "noarg_func ::= TODAY",
+ /* 434 */ "noarg_func ::= TIMEZONE",
+ /* 435 */ "noarg_func ::= DATABASE",
+ /* 436 */ "noarg_func ::= CLIENT_VERSION",
+ /* 437 */ "noarg_func ::= SERVER_VERSION",
+ /* 438 */ "noarg_func ::= SERVER_STATUS",
+ /* 439 */ "noarg_func ::= CURRENT_USER",
+ /* 440 */ "noarg_func ::= USER",
+ /* 441 */ "star_func ::= COUNT",
+ /* 442 */ "star_func ::= FIRST",
+ /* 443 */ "star_func ::= LAST",
+ /* 444 */ "star_func ::= LAST_ROW",
+ /* 445 */ "star_func_para_list ::= NK_STAR",
+ /* 446 */ "star_func_para_list ::= other_para_list",
+ /* 447 */ "other_para_list ::= star_func_para",
+ /* 448 */ "other_para_list ::= other_para_list NK_COMMA star_func_para",
+ /* 449 */ "star_func_para ::= expr_or_subquery",
+ /* 450 */ "star_func_para ::= table_name NK_DOT NK_STAR",
+ /* 451 */ "case_when_expression ::= CASE when_then_list case_when_else_opt END",
+ /* 452 */ "case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END",
+ /* 453 */ "when_then_list ::= when_then_expr",
+ /* 454 */ "when_then_list ::= when_then_list when_then_expr",
+ /* 455 */ "when_then_expr ::= WHEN common_expression THEN common_expression",
+ /* 456 */ "case_when_else_opt ::=",
+ /* 457 */ "case_when_else_opt ::= ELSE common_expression",
+ /* 458 */ "predicate ::= expr_or_subquery compare_op expr_or_subquery",
+ /* 459 */ "predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery",
+ /* 460 */ "predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery",
+ /* 461 */ "predicate ::= expr_or_subquery IS NULL",
+ /* 462 */ "predicate ::= expr_or_subquery IS NOT NULL",
+ /* 463 */ "predicate ::= expr_or_subquery in_op in_predicate_value",
+ /* 464 */ "compare_op ::= NK_LT",
+ /* 465 */ "compare_op ::= NK_GT",
+ /* 466 */ "compare_op ::= NK_LE",
+ /* 467 */ "compare_op ::= NK_GE",
+ /* 468 */ "compare_op ::= NK_NE",
+ /* 469 */ "compare_op ::= NK_EQ",
+ /* 470 */ "compare_op ::= LIKE",
+ /* 471 */ "compare_op ::= NOT LIKE",
+ /* 472 */ "compare_op ::= MATCH",
+ /* 473 */ "compare_op ::= NMATCH",
+ /* 474 */ "compare_op ::= CONTAINS",
+ /* 475 */ "in_op ::= IN",
+ /* 476 */ "in_op ::= NOT IN",
+ /* 477 */ "in_predicate_value ::= NK_LP literal_list NK_RP",
+ /* 478 */ "boolean_value_expression ::= boolean_primary",
+ /* 479 */ "boolean_value_expression ::= NOT boolean_primary",
+ /* 480 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression",
+ /* 481 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression",
+ /* 482 */ "boolean_primary ::= predicate",
+ /* 483 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP",
+ /* 484 */ "common_expression ::= expr_or_subquery",
+ /* 485 */ "common_expression ::= boolean_value_expression",
+ /* 486 */ "from_clause_opt ::=",
+ /* 487 */ "from_clause_opt ::= FROM table_reference_list",
+ /* 488 */ "table_reference_list ::= table_reference",
+ /* 489 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference",
+ /* 490 */ "table_reference ::= table_primary",
+ /* 491 */ "table_reference ::= joined_table",
+ /* 492 */ "table_primary ::= table_name alias_opt",
+ /* 493 */ "table_primary ::= db_name NK_DOT table_name alias_opt",
+ /* 494 */ "table_primary ::= subquery alias_opt",
+ /* 495 */ "table_primary ::= parenthesized_joined_table",
+ /* 496 */ "alias_opt ::=",
+ /* 497 */ "alias_opt ::= table_alias",
+ /* 498 */ "alias_opt ::= AS table_alias",
+ /* 499 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP",
+ /* 500 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP",
+ /* 501 */ "joined_table ::= table_reference join_type JOIN table_reference ON search_condition",
+ /* 502 */ "join_type ::=",
+ /* 503 */ "join_type ::= INNER",
+ /* 504 */ "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",
+ /* 505 */ "set_quantifier_opt ::=",
+ /* 506 */ "set_quantifier_opt ::= DISTINCT",
+ /* 507 */ "set_quantifier_opt ::= ALL",
+ /* 508 */ "select_list ::= select_item",
+ /* 509 */ "select_list ::= select_list NK_COMMA select_item",
+ /* 510 */ "select_item ::= NK_STAR",
+ /* 511 */ "select_item ::= common_expression",
+ /* 512 */ "select_item ::= common_expression column_alias",
+ /* 513 */ "select_item ::= common_expression AS column_alias",
+ /* 514 */ "select_item ::= table_name NK_DOT NK_STAR",
+ /* 515 */ "where_clause_opt ::=",
+ /* 516 */ "where_clause_opt ::= WHERE search_condition",
+ /* 517 */ "partition_by_clause_opt ::=",
+ /* 518 */ "partition_by_clause_opt ::= PARTITION BY partition_list",
+ /* 519 */ "partition_list ::= partition_item",
+ /* 520 */ "partition_list ::= partition_list NK_COMMA partition_item",
+ /* 521 */ "partition_item ::= expr_or_subquery",
+ /* 522 */ "partition_item ::= expr_or_subquery column_alias",
+ /* 523 */ "partition_item ::= expr_or_subquery AS column_alias",
+ /* 524 */ "twindow_clause_opt ::=",
+ /* 525 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP",
+ /* 526 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP",
+ /* 527 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt",
+ /* 528 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt",
+ /* 529 */ "twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition",
+ /* 530 */ "sliding_opt ::=",
+ /* 531 */ "sliding_opt ::= SLIDING NK_LP duration_literal NK_RP",
+ /* 532 */ "fill_opt ::=",
+ /* 533 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP",
+ /* 534 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP",
+ /* 535 */ "fill_opt ::= FILL NK_LP VALUE_F NK_COMMA literal_list NK_RP",
+ /* 536 */ "fill_mode ::= NONE",
+ /* 537 */ "fill_mode ::= PREV",
+ /* 538 */ "fill_mode ::= NULL",
+ /* 539 */ "fill_mode ::= NULL_F",
+ /* 540 */ "fill_mode ::= LINEAR",
+ /* 541 */ "fill_mode ::= NEXT",
+ /* 542 */ "group_by_clause_opt ::=",
+ /* 543 */ "group_by_clause_opt ::= GROUP BY group_by_list",
+ /* 544 */ "group_by_list ::= expr_or_subquery",
+ /* 545 */ "group_by_list ::= group_by_list NK_COMMA expr_or_subquery",
+ /* 546 */ "having_clause_opt ::=",
+ /* 547 */ "having_clause_opt ::= HAVING search_condition",
+ /* 548 */ "range_opt ::=",
+ /* 549 */ "range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP",
+ /* 550 */ "every_opt ::=",
+ /* 551 */ "every_opt ::= EVERY NK_LP duration_literal NK_RP",
+ /* 552 */ "query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt",
+ /* 553 */ "query_simple ::= query_specification",
+ /* 554 */ "query_simple ::= union_query_expression",
+ /* 555 */ "union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery",
+ /* 556 */ "union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery",
+ /* 557 */ "query_simple_or_subquery ::= query_simple",
+ /* 558 */ "query_simple_or_subquery ::= subquery",
+ /* 559 */ "query_or_subquery ::= query_expression",
+ /* 560 */ "query_or_subquery ::= subquery",
+ /* 561 */ "order_by_clause_opt ::=",
+ /* 562 */ "order_by_clause_opt ::= ORDER BY sort_specification_list",
+ /* 563 */ "slimit_clause_opt ::=",
+ /* 564 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER",
+ /* 565 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER",
+ /* 566 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER",
+ /* 567 */ "limit_clause_opt ::=",
+ /* 568 */ "limit_clause_opt ::= LIMIT NK_INTEGER",
+ /* 569 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER",
+ /* 570 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER",
+ /* 571 */ "subquery ::= NK_LP query_expression NK_RP",
+ /* 572 */ "subquery ::= NK_LP subquery NK_RP",
+ /* 573 */ "search_condition ::= common_expression",
+ /* 574 */ "sort_specification_list ::= sort_specification",
+ /* 575 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification",
+ /* 576 */ "sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt",
+ /* 577 */ "ordering_specification_opt ::=",
+ /* 578 */ "ordering_specification_opt ::= ASC",
+ /* 579 */ "ordering_specification_opt ::= DESC",
+ /* 580 */ "null_ordering_opt ::=",
+ /* 581 */ "null_ordering_opt ::= NULLS FIRST",
+ /* 582 */ "null_ordering_opt ::= NULLS LAST",
};
#endif /* NDEBUG */
@@ -2664,108 +2631,108 @@ static void yy_destructor(
/* Default NON-TERMINAL Destructor */
case 330: /* cmd */
case 333: /* literal */
- case 346: /* db_options */
- case 348: /* alter_db_options */
- case 350: /* start_opt */
- case 351: /* end_opt */
- case 356: /* retention */
- case 357: /* full_table_name */
- case 360: /* table_options */
- case 364: /* alter_table_clause */
- case 365: /* alter_table_options */
- case 368: /* signed_literal */
- case 369: /* create_subtable_clause */
- case 372: /* drop_table_clause */
- case 375: /* column_def */
- case 379: /* duration_literal */
- case 380: /* rollup_func_name */
- case 382: /* col_name */
- case 383: /* db_name_cond_opt */
- case 384: /* like_pattern_opt */
- case 385: /* table_name_cond */
- case 386: /* from_db_opt */
- case 388: /* tag_item */
- case 390: /* full_index_name */
- case 391: /* index_options */
- case 394: /* sliding_opt */
- case 395: /* sma_stream_opt */
- case 396: /* func */
- case 398: /* query_or_subquery */
- case 401: /* explain_options */
- case 402: /* insert_query */
- case 408: /* stream_options */
- case 411: /* subtable_opt */
- case 412: /* expression */
- case 414: /* where_clause_opt */
- case 415: /* signed */
- case 416: /* literal_func */
- case 419: /* expr_or_subquery */
- case 420: /* pseudo_column */
- case 421: /* column_reference */
- case 422: /* function_expression */
- case 423: /* case_when_expression */
- case 428: /* star_func_para */
- case 430: /* case_when_else_opt */
- case 431: /* common_expression */
- case 432: /* when_then_expr */
- case 433: /* predicate */
- case 436: /* in_predicate_value */
- case 437: /* boolean_value_expression */
- case 438: /* boolean_primary */
- case 439: /* from_clause_opt */
- case 440: /* table_reference_list */
- case 441: /* table_reference */
- case 442: /* table_primary */
- case 443: /* joined_table */
- case 445: /* subquery */
- case 446: /* parenthesized_joined_table */
- case 448: /* search_condition */
- case 449: /* query_specification */
- case 453: /* range_opt */
- case 454: /* every_opt */
- case 455: /* fill_opt */
- case 456: /* twindow_clause_opt */
- case 458: /* having_clause_opt */
- case 459: /* select_item */
- case 461: /* partition_item */
- case 464: /* query_expression */
- case 465: /* query_simple */
- case 467: /* slimit_clause_opt */
- case 468: /* limit_clause_opt */
- case 469: /* union_query_expression */
- case 470: /* query_simple_or_subquery */
- case 472: /* sort_specification */
+ case 339: /* with_opt */
+ case 345: /* search_condition */
+ case 349: /* db_options */
+ case 351: /* alter_db_options */
+ case 353: /* start_opt */
+ case 354: /* end_opt */
+ case 359: /* retention */
+ case 360: /* full_table_name */
+ case 363: /* table_options */
+ case 367: /* alter_table_clause */
+ case 368: /* alter_table_options */
+ case 371: /* signed_literal */
+ case 372: /* create_subtable_clause */
+ case 375: /* drop_table_clause */
+ case 377: /* column_def */
+ case 381: /* duration_literal */
+ case 382: /* rollup_func_name */
+ case 384: /* col_name */
+ case 385: /* db_name_cond_opt */
+ case 386: /* like_pattern_opt */
+ case 387: /* table_name_cond */
+ case 388: /* from_db_opt */
+ case 390: /* tag_item */
+ case 392: /* full_index_name */
+ case 393: /* index_options */
+ case 396: /* sliding_opt */
+ case 397: /* sma_stream_opt */
+ case 398: /* func */
+ case 400: /* query_or_subquery */
+ case 403: /* explain_options */
+ case 404: /* insert_query */
+ case 410: /* stream_options */
+ case 413: /* subtable_opt */
+ case 414: /* expression */
+ case 416: /* where_clause_opt */
+ case 417: /* signed */
+ case 418: /* literal_func */
+ case 421: /* expr_or_subquery */
+ case 422: /* pseudo_column */
+ case 423: /* column_reference */
+ case 424: /* function_expression */
+ case 425: /* case_when_expression */
+ case 430: /* star_func_para */
+ case 432: /* case_when_else_opt */
+ case 433: /* common_expression */
+ case 434: /* when_then_expr */
+ case 435: /* predicate */
+ case 438: /* in_predicate_value */
+ case 439: /* boolean_value_expression */
+ case 440: /* boolean_primary */
+ case 441: /* from_clause_opt */
+ case 442: /* table_reference_list */
+ case 443: /* table_reference */
+ case 444: /* table_primary */
+ case 445: /* joined_table */
+ case 447: /* subquery */
+ case 448: /* parenthesized_joined_table */
+ case 450: /* query_specification */
+ case 454: /* range_opt */
+ case 455: /* every_opt */
+ case 456: /* fill_opt */
+ case 457: /* twindow_clause_opt */
+ case 459: /* having_clause_opt */
+ case 460: /* select_item */
+ case 462: /* partition_item */
+ case 465: /* query_expression */
+ case 466: /* query_simple */
+ case 468: /* slimit_clause_opt */
+ case 469: /* limit_clause_opt */
+ case 470: /* union_query_expression */
+ case 471: /* query_simple_or_subquery */
+ case 473: /* sort_specification */
{
- nodesDestroyNode((yypminor->yy712));
+ nodesDestroyNode((yypminor->yy448));
}
break;
case 331: /* account_options */
case 332: /* alter_account_options */
case 334: /* alter_account_option */
- case 349: /* speed_opt */
- case 405: /* bufsize_opt */
+ case 352: /* speed_opt */
+ case 407: /* bufsize_opt */
{
}
break;
case 335: /* user_name */
- case 338: /* priv_level */
- case 341: /* db_name */
- case 342: /* topic_name */
- case 343: /* dnode_endpoint */
- case 366: /* column_name */
- case 374: /* table_name */
- case 381: /* function_name */
- case 389: /* column_alias */
- case 392: /* index_name */
- case 397: /* sma_func_name */
- case 399: /* cgroup_name */
- case 406: /* language_opt */
- case 407: /* stream_name */
- case 418: /* table_alias */
- case 424: /* star_func */
- case 426: /* noarg_func */
- case 444: /* alias_opt */
+ case 342: /* db_name */
+ case 343: /* table_name */
+ case 344: /* topic_name */
+ case 346: /* dnode_endpoint */
+ case 369: /* column_name */
+ case 383: /* function_name */
+ case 391: /* column_alias */
+ case 394: /* index_name */
+ case 399: /* sma_func_name */
+ case 401: /* cgroup_name */
+ case 408: /* language_opt */
+ case 409: /* stream_name */
+ case 420: /* table_alias */
+ case 426: /* star_func */
+ case 428: /* noarg_func */
+ case 446: /* alias_opt */
{
}
@@ -2776,89 +2743,94 @@ static void yy_destructor(
}
break;
case 337: /* privileges */
- case 339: /* priv_type_list */
- case 340: /* priv_type */
+ case 340: /* priv_type_list */
+ case 341: /* priv_type */
{
}
break;
- case 344: /* force_opt */
- case 345: /* not_exists_opt */
- case 347: /* exists_opt */
- case 400: /* analyze_opt */
- case 403: /* or_replace_opt */
- case 404: /* agg_func_opt */
- case 450: /* set_quantifier_opt */
+ case 338: /* priv_level */
{
}
break;
- case 352: /* integer_list */
- case 353: /* variable_list */
- case 354: /* retention_list */
- case 358: /* column_def_list */
- case 359: /* tags_def_opt */
- case 361: /* multi_create_clause */
- case 362: /* tags_def */
- case 363: /* multi_drop_clause */
- case 370: /* specific_cols_opt */
- case 371: /* expression_list */
- case 373: /* col_name_list */
- case 376: /* duration_list */
- case 377: /* rollup_func_list */
- case 387: /* tag_list_opt */
- case 393: /* func_list */
- case 409: /* col_list_opt */
- case 410: /* tag_def_or_ref_opt */
- case 413: /* dnode_list */
- case 417: /* literal_list */
- case 425: /* star_func_para_list */
- case 427: /* other_para_list */
- case 429: /* when_then_list */
- case 451: /* select_list */
- case 452: /* partition_by_clause_opt */
- case 457: /* group_by_clause_opt */
- case 460: /* partition_list */
- case 463: /* group_by_list */
- case 466: /* order_by_clause_opt */
- case 471: /* sort_specification_list */
-{
- nodesDestroyList((yypminor->yy274));
-}
- break;
- case 355: /* alter_db_option */
- case 378: /* alter_table_option */
+ case 347: /* force_opt */
+ case 348: /* not_exists_opt */
+ case 350: /* exists_opt */
+ case 402: /* analyze_opt */
+ case 405: /* or_replace_opt */
+ case 406: /* agg_func_opt */
+ case 451: /* set_quantifier_opt */
{
}
break;
- case 367: /* type_name */
+ case 355: /* integer_list */
+ case 356: /* variable_list */
+ case 357: /* retention_list */
+ case 361: /* column_def_list */
+ case 362: /* tags_def_opt */
+ case 364: /* multi_create_clause */
+ case 365: /* tags_def */
+ case 366: /* multi_drop_clause */
+ case 373: /* specific_cols_opt */
+ case 374: /* expression_list */
+ case 376: /* col_name_list */
+ case 378: /* duration_list */
+ case 379: /* rollup_func_list */
+ case 389: /* tag_list_opt */
+ case 395: /* func_list */
+ case 411: /* col_list_opt */
+ case 412: /* tag_def_or_ref_opt */
+ case 415: /* dnode_list */
+ case 419: /* literal_list */
+ case 427: /* star_func_para_list */
+ case 429: /* other_para_list */
+ case 431: /* when_then_list */
+ case 452: /* select_list */
+ case 453: /* partition_by_clause_opt */
+ case 458: /* group_by_clause_opt */
+ case 461: /* partition_list */
+ case 464: /* group_by_list */
+ case 467: /* order_by_clause_opt */
+ case 472: /* sort_specification_list */
+{
+ nodesDestroyList((yypminor->yy432));
+}
+ break;
+ case 358: /* alter_db_option */
+ case 380: /* alter_table_option */
{
}
break;
- case 434: /* compare_op */
- case 435: /* in_op */
+ case 370: /* type_name */
{
}
break;
- case 447: /* join_type */
+ case 436: /* compare_op */
+ case 437: /* in_op */
{
}
break;
- case 462: /* fill_mode */
+ case 449: /* join_type */
{
}
break;
- case 473: /* ordering_specification_opt */
+ case 463: /* fill_mode */
{
}
break;
- case 474: /* null_ordering_opt */
+ case 474: /* ordering_specification_opt */
+{
+
+}
+ break;
+ case 475: /* null_ordering_opt */
{
}
@@ -3188,556 +3160,558 @@ static const struct {
{ 330, -3 }, /* (28) cmd ::= DROP USER user_name */
{ 336, 0 }, /* (29) sysinfo_opt ::= */
{ 336, -2 }, /* (30) sysinfo_opt ::= SYSINFO NK_INTEGER */
- { 330, -6 }, /* (31) cmd ::= GRANT privileges ON priv_level TO user_name */
- { 330, -6 }, /* (32) cmd ::= REVOKE privileges ON priv_level FROM user_name */
+ { 330, -7 }, /* (31) cmd ::= GRANT privileges ON priv_level with_opt TO user_name */
+ { 330, -7 }, /* (32) cmd ::= REVOKE privileges ON priv_level with_opt FROM user_name */
{ 337, -1 }, /* (33) privileges ::= ALL */
{ 337, -1 }, /* (34) privileges ::= priv_type_list */
{ 337, -1 }, /* (35) privileges ::= SUBSCRIBE */
- { 339, -1 }, /* (36) priv_type_list ::= priv_type */
- { 339, -3 }, /* (37) priv_type_list ::= priv_type_list NK_COMMA priv_type */
- { 340, -1 }, /* (38) priv_type ::= READ */
- { 340, -1 }, /* (39) priv_type ::= WRITE */
+ { 340, -1 }, /* (36) priv_type_list ::= priv_type */
+ { 340, -3 }, /* (37) priv_type_list ::= priv_type_list NK_COMMA priv_type */
+ { 341, -1 }, /* (38) priv_type ::= READ */
+ { 341, -1 }, /* (39) priv_type ::= WRITE */
{ 338, -3 }, /* (40) priv_level ::= NK_STAR NK_DOT NK_STAR */
{ 338, -3 }, /* (41) priv_level ::= db_name NK_DOT NK_STAR */
- { 338, -1 }, /* (42) priv_level ::= topic_name */
- { 330, -3 }, /* (43) cmd ::= CREATE DNODE dnode_endpoint */
- { 330, -5 }, /* (44) cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER */
- { 330, -4 }, /* (45) cmd ::= DROP DNODE NK_INTEGER force_opt */
- { 330, -4 }, /* (46) cmd ::= DROP DNODE dnode_endpoint force_opt */
- { 330, -4 }, /* (47) cmd ::= ALTER DNODE NK_INTEGER NK_STRING */
- { 330, -5 }, /* (48) cmd ::= ALTER DNODE NK_INTEGER NK_STRING NK_STRING */
- { 330, -4 }, /* (49) cmd ::= ALTER ALL DNODES NK_STRING */
- { 330, -5 }, /* (50) cmd ::= ALTER ALL DNODES NK_STRING NK_STRING */
- { 343, -1 }, /* (51) dnode_endpoint ::= NK_STRING */
- { 343, -1 }, /* (52) dnode_endpoint ::= NK_ID */
- { 343, -1 }, /* (53) dnode_endpoint ::= NK_IPTOKEN */
- { 344, 0 }, /* (54) force_opt ::= */
- { 344, -1 }, /* (55) force_opt ::= FORCE */
- { 330, -3 }, /* (56) cmd ::= ALTER LOCAL NK_STRING */
- { 330, -4 }, /* (57) cmd ::= ALTER LOCAL NK_STRING NK_STRING */
- { 330, -5 }, /* (58) cmd ::= CREATE QNODE ON DNODE NK_INTEGER */
- { 330, -5 }, /* (59) cmd ::= DROP QNODE ON DNODE NK_INTEGER */
- { 330, -5 }, /* (60) cmd ::= CREATE BNODE ON DNODE NK_INTEGER */
- { 330, -5 }, /* (61) cmd ::= DROP BNODE ON DNODE NK_INTEGER */
- { 330, -5 }, /* (62) cmd ::= CREATE SNODE ON DNODE NK_INTEGER */
- { 330, -5 }, /* (63) cmd ::= DROP SNODE ON DNODE NK_INTEGER */
- { 330, -5 }, /* (64) cmd ::= CREATE MNODE ON DNODE NK_INTEGER */
- { 330, -5 }, /* (65) cmd ::= DROP MNODE ON DNODE NK_INTEGER */
- { 330, -5 }, /* (66) cmd ::= CREATE DATABASE not_exists_opt db_name db_options */
- { 330, -4 }, /* (67) cmd ::= DROP DATABASE exists_opt db_name */
- { 330, -2 }, /* (68) cmd ::= USE db_name */
- { 330, -4 }, /* (69) cmd ::= ALTER DATABASE db_name alter_db_options */
- { 330, -3 }, /* (70) cmd ::= FLUSH DATABASE db_name */
- { 330, -4 }, /* (71) cmd ::= TRIM DATABASE db_name speed_opt */
- { 330, -5 }, /* (72) cmd ::= COMPACT DATABASE db_name start_opt end_opt */
- { 345, -3 }, /* (73) not_exists_opt ::= IF NOT EXISTS */
- { 345, 0 }, /* (74) not_exists_opt ::= */
- { 347, -2 }, /* (75) exists_opt ::= IF EXISTS */
- { 347, 0 }, /* (76) exists_opt ::= */
- { 346, 0 }, /* (77) db_options ::= */
- { 346, -3 }, /* (78) db_options ::= db_options BUFFER NK_INTEGER */
- { 346, -3 }, /* (79) db_options ::= db_options CACHEMODEL NK_STRING */
- { 346, -3 }, /* (80) db_options ::= db_options CACHESIZE NK_INTEGER */
- { 346, -3 }, /* (81) db_options ::= db_options COMP NK_INTEGER */
- { 346, -3 }, /* (82) db_options ::= db_options DURATION NK_INTEGER */
- { 346, -3 }, /* (83) db_options ::= db_options DURATION NK_VARIABLE */
- { 346, -3 }, /* (84) db_options ::= db_options MAXROWS NK_INTEGER */
- { 346, -3 }, /* (85) db_options ::= db_options MINROWS NK_INTEGER */
- { 346, -3 }, /* (86) db_options ::= db_options KEEP integer_list */
- { 346, -3 }, /* (87) db_options ::= db_options KEEP variable_list */
- { 346, -3 }, /* (88) db_options ::= db_options PAGES NK_INTEGER */
- { 346, -3 }, /* (89) db_options ::= db_options PAGESIZE NK_INTEGER */
- { 346, -3 }, /* (90) db_options ::= db_options TSDB_PAGESIZE NK_INTEGER */
- { 346, -3 }, /* (91) db_options ::= db_options PRECISION NK_STRING */
- { 346, -3 }, /* (92) db_options ::= db_options REPLICA NK_INTEGER */
- { 346, -3 }, /* (93) db_options ::= db_options VGROUPS NK_INTEGER */
- { 346, -3 }, /* (94) db_options ::= db_options SINGLE_STABLE NK_INTEGER */
- { 346, -3 }, /* (95) db_options ::= db_options RETENTIONS retention_list */
- { 346, -3 }, /* (96) db_options ::= db_options SCHEMALESS NK_INTEGER */
- { 346, -3 }, /* (97) db_options ::= db_options WAL_LEVEL NK_INTEGER */
- { 346, -3 }, /* (98) db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER */
- { 346, -3 }, /* (99) db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER */
- { 346, -4 }, /* (100) db_options ::= db_options WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */
- { 346, -3 }, /* (101) db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER */
- { 346, -4 }, /* (102) db_options ::= db_options WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */
- { 346, -3 }, /* (103) db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER */
- { 346, -3 }, /* (104) db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER */
- { 346, -3 }, /* (105) db_options ::= db_options STT_TRIGGER NK_INTEGER */
- { 346, -3 }, /* (106) db_options ::= db_options TABLE_PREFIX NK_INTEGER */
- { 346, -3 }, /* (107) db_options ::= db_options TABLE_SUFFIX NK_INTEGER */
- { 348, -1 }, /* (108) alter_db_options ::= alter_db_option */
- { 348, -2 }, /* (109) alter_db_options ::= alter_db_options alter_db_option */
- { 355, -2 }, /* (110) alter_db_option ::= BUFFER NK_INTEGER */
- { 355, -2 }, /* (111) alter_db_option ::= CACHEMODEL NK_STRING */
- { 355, -2 }, /* (112) alter_db_option ::= CACHESIZE NK_INTEGER */
- { 355, -2 }, /* (113) alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER */
- { 355, -2 }, /* (114) alter_db_option ::= KEEP integer_list */
- { 355, -2 }, /* (115) alter_db_option ::= KEEP variable_list */
- { 355, -2 }, /* (116) alter_db_option ::= PAGES NK_INTEGER */
- { 355, -2 }, /* (117) alter_db_option ::= REPLICA NK_INTEGER */
- { 355, -2 }, /* (118) alter_db_option ::= WAL_LEVEL NK_INTEGER */
- { 355, -2 }, /* (119) alter_db_option ::= STT_TRIGGER NK_INTEGER */
- { 355, -2 }, /* (120) alter_db_option ::= MINROWS NK_INTEGER */
- { 355, -2 }, /* (121) alter_db_option ::= WAL_RETENTION_PERIOD NK_INTEGER */
- { 355, -3 }, /* (122) alter_db_option ::= WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */
- { 355, -2 }, /* (123) alter_db_option ::= WAL_RETENTION_SIZE NK_INTEGER */
- { 355, -3 }, /* (124) alter_db_option ::= WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */
- { 352, -1 }, /* (125) integer_list ::= NK_INTEGER */
- { 352, -3 }, /* (126) integer_list ::= integer_list NK_COMMA NK_INTEGER */
- { 353, -1 }, /* (127) variable_list ::= NK_VARIABLE */
- { 353, -3 }, /* (128) variable_list ::= variable_list NK_COMMA NK_VARIABLE */
- { 354, -1 }, /* (129) retention_list ::= retention */
- { 354, -3 }, /* (130) retention_list ::= retention_list NK_COMMA retention */
- { 356, -3 }, /* (131) retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */
- { 349, 0 }, /* (132) speed_opt ::= */
- { 349, -2 }, /* (133) speed_opt ::= MAX_SPEED NK_INTEGER */
- { 350, 0 }, /* (134) start_opt ::= */
- { 350, -3 }, /* (135) start_opt ::= START WITH NK_INTEGER */
- { 350, -3 }, /* (136) start_opt ::= START WITH NK_STRING */
- { 350, -4 }, /* (137) start_opt ::= START WITH TIMESTAMP NK_STRING */
- { 351, 0 }, /* (138) end_opt ::= */
- { 351, -3 }, /* (139) end_opt ::= END WITH NK_INTEGER */
- { 351, -3 }, /* (140) end_opt ::= END WITH NK_STRING */
- { 351, -4 }, /* (141) end_opt ::= END WITH TIMESTAMP NK_STRING */
- { 330, -9 }, /* (142) cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */
- { 330, -3 }, /* (143) cmd ::= CREATE TABLE multi_create_clause */
- { 330, -9 }, /* (144) cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */
- { 330, -3 }, /* (145) cmd ::= DROP TABLE multi_drop_clause */
- { 330, -4 }, /* (146) cmd ::= DROP STABLE exists_opt full_table_name */
- { 330, -3 }, /* (147) cmd ::= ALTER TABLE alter_table_clause */
- { 330, -3 }, /* (148) cmd ::= ALTER STABLE alter_table_clause */
- { 364, -2 }, /* (149) alter_table_clause ::= full_table_name alter_table_options */
- { 364, -5 }, /* (150) alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */
- { 364, -4 }, /* (151) alter_table_clause ::= full_table_name DROP COLUMN column_name */
- { 364, -5 }, /* (152) alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */
- { 364, -5 }, /* (153) alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */
- { 364, -5 }, /* (154) alter_table_clause ::= full_table_name ADD TAG column_name type_name */
- { 364, -4 }, /* (155) alter_table_clause ::= full_table_name DROP TAG column_name */
- { 364, -5 }, /* (156) alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */
- { 364, -5 }, /* (157) alter_table_clause ::= full_table_name RENAME TAG column_name column_name */
- { 364, -6 }, /* (158) alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */
- { 361, -1 }, /* (159) multi_create_clause ::= create_subtable_clause */
- { 361, -2 }, /* (160) multi_create_clause ::= multi_create_clause create_subtable_clause */
- { 369, -10 }, /* (161) 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 */
- { 363, -1 }, /* (162) multi_drop_clause ::= drop_table_clause */
- { 363, -3 }, /* (163) multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause */
- { 372, -2 }, /* (164) drop_table_clause ::= exists_opt full_table_name */
- { 370, 0 }, /* (165) specific_cols_opt ::= */
- { 370, -3 }, /* (166) specific_cols_opt ::= NK_LP col_name_list NK_RP */
- { 357, -1 }, /* (167) full_table_name ::= table_name */
- { 357, -3 }, /* (168) full_table_name ::= db_name NK_DOT table_name */
- { 358, -1 }, /* (169) column_def_list ::= column_def */
- { 358, -3 }, /* (170) column_def_list ::= column_def_list NK_COMMA column_def */
- { 375, -2 }, /* (171) column_def ::= column_name type_name */
- { 375, -4 }, /* (172) column_def ::= column_name type_name COMMENT NK_STRING */
- { 367, -1 }, /* (173) type_name ::= BOOL */
- { 367, -1 }, /* (174) type_name ::= TINYINT */
- { 367, -1 }, /* (175) type_name ::= SMALLINT */
- { 367, -1 }, /* (176) type_name ::= INT */
- { 367, -1 }, /* (177) type_name ::= INTEGER */
- { 367, -1 }, /* (178) type_name ::= BIGINT */
- { 367, -1 }, /* (179) type_name ::= FLOAT */
- { 367, -1 }, /* (180) type_name ::= DOUBLE */
- { 367, -4 }, /* (181) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */
- { 367, -1 }, /* (182) type_name ::= TIMESTAMP */
- { 367, -4 }, /* (183) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */
- { 367, -2 }, /* (184) type_name ::= TINYINT UNSIGNED */
- { 367, -2 }, /* (185) type_name ::= SMALLINT UNSIGNED */
- { 367, -2 }, /* (186) type_name ::= INT UNSIGNED */
- { 367, -2 }, /* (187) type_name ::= BIGINT UNSIGNED */
- { 367, -1 }, /* (188) type_name ::= JSON */
- { 367, -4 }, /* (189) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */
- { 367, -1 }, /* (190) type_name ::= MEDIUMBLOB */
- { 367, -1 }, /* (191) type_name ::= BLOB */
- { 367, -4 }, /* (192) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */
- { 367, -1 }, /* (193) type_name ::= DECIMAL */
- { 367, -4 }, /* (194) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */
- { 367, -6 }, /* (195) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */
- { 359, 0 }, /* (196) tags_def_opt ::= */
- { 359, -1 }, /* (197) tags_def_opt ::= tags_def */
- { 362, -4 }, /* (198) tags_def ::= TAGS NK_LP column_def_list NK_RP */
- { 360, 0 }, /* (199) table_options ::= */
- { 360, -3 }, /* (200) table_options ::= table_options COMMENT NK_STRING */
- { 360, -3 }, /* (201) table_options ::= table_options MAX_DELAY duration_list */
- { 360, -3 }, /* (202) table_options ::= table_options WATERMARK duration_list */
- { 360, -5 }, /* (203) table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */
- { 360, -3 }, /* (204) table_options ::= table_options TTL NK_INTEGER */
- { 360, -5 }, /* (205) table_options ::= table_options SMA NK_LP col_name_list NK_RP */
- { 360, -3 }, /* (206) table_options ::= table_options DELETE_MARK duration_list */
- { 365, -1 }, /* (207) alter_table_options ::= alter_table_option */
- { 365, -2 }, /* (208) alter_table_options ::= alter_table_options alter_table_option */
- { 378, -2 }, /* (209) alter_table_option ::= COMMENT NK_STRING */
- { 378, -2 }, /* (210) alter_table_option ::= TTL NK_INTEGER */
- { 376, -1 }, /* (211) duration_list ::= duration_literal */
- { 376, -3 }, /* (212) duration_list ::= duration_list NK_COMMA duration_literal */
- { 377, -1 }, /* (213) rollup_func_list ::= rollup_func_name */
- { 377, -3 }, /* (214) rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */
- { 380, -1 }, /* (215) rollup_func_name ::= function_name */
- { 380, -1 }, /* (216) rollup_func_name ::= FIRST */
- { 380, -1 }, /* (217) rollup_func_name ::= LAST */
- { 373, -1 }, /* (218) col_name_list ::= col_name */
- { 373, -3 }, /* (219) col_name_list ::= col_name_list NK_COMMA col_name */
- { 382, -1 }, /* (220) col_name ::= column_name */
- { 330, -2 }, /* (221) cmd ::= SHOW DNODES */
- { 330, -2 }, /* (222) cmd ::= SHOW USERS */
- { 330, -3 }, /* (223) cmd ::= SHOW USER PRIVILEGES */
- { 330, -2 }, /* (224) cmd ::= SHOW DATABASES */
- { 330, -4 }, /* (225) cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */
- { 330, -4 }, /* (226) cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */
- { 330, -3 }, /* (227) cmd ::= SHOW db_name_cond_opt VGROUPS */
- { 330, -2 }, /* (228) cmd ::= SHOW MNODES */
- { 330, -2 }, /* (229) cmd ::= SHOW QNODES */
- { 330, -2 }, /* (230) cmd ::= SHOW FUNCTIONS */
- { 330, -5 }, /* (231) cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */
- { 330, -2 }, /* (232) cmd ::= SHOW STREAMS */
- { 330, -2 }, /* (233) cmd ::= SHOW ACCOUNTS */
- { 330, -2 }, /* (234) cmd ::= SHOW APPS */
- { 330, -2 }, /* (235) cmd ::= SHOW CONNECTIONS */
- { 330, -2 }, /* (236) cmd ::= SHOW LICENCES */
- { 330, -2 }, /* (237) cmd ::= SHOW GRANTS */
- { 330, -4 }, /* (238) cmd ::= SHOW CREATE DATABASE db_name */
- { 330, -4 }, /* (239) cmd ::= SHOW CREATE TABLE full_table_name */
- { 330, -4 }, /* (240) cmd ::= SHOW CREATE STABLE full_table_name */
- { 330, -2 }, /* (241) cmd ::= SHOW QUERIES */
- { 330, -2 }, /* (242) cmd ::= SHOW SCORES */
- { 330, -2 }, /* (243) cmd ::= SHOW TOPICS */
- { 330, -2 }, /* (244) cmd ::= SHOW VARIABLES */
- { 330, -3 }, /* (245) cmd ::= SHOW CLUSTER VARIABLES */
- { 330, -3 }, /* (246) cmd ::= SHOW LOCAL VARIABLES */
- { 330, -5 }, /* (247) cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt */
- { 330, -2 }, /* (248) cmd ::= SHOW BNODES */
- { 330, -2 }, /* (249) cmd ::= SHOW SNODES */
- { 330, -2 }, /* (250) cmd ::= SHOW CLUSTER */
- { 330, -2 }, /* (251) cmd ::= SHOW TRANSACTIONS */
- { 330, -4 }, /* (252) cmd ::= SHOW TABLE DISTRIBUTED full_table_name */
- { 330, -2 }, /* (253) cmd ::= SHOW CONSUMERS */
- { 330, -2 }, /* (254) cmd ::= SHOW SUBSCRIPTIONS */
- { 330, -5 }, /* (255) cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */
- { 330, -7 }, /* (256) cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */
- { 330, -3 }, /* (257) cmd ::= SHOW VNODES NK_INTEGER */
- { 330, -3 }, /* (258) cmd ::= SHOW VNODES NK_STRING */
- { 330, -3 }, /* (259) cmd ::= SHOW db_name_cond_opt ALIVE */
- { 330, -3 }, /* (260) cmd ::= SHOW CLUSTER ALIVE */
- { 383, 0 }, /* (261) db_name_cond_opt ::= */
- { 383, -2 }, /* (262) db_name_cond_opt ::= db_name NK_DOT */
- { 384, 0 }, /* (263) like_pattern_opt ::= */
- { 384, -2 }, /* (264) like_pattern_opt ::= LIKE NK_STRING */
- { 385, -1 }, /* (265) table_name_cond ::= table_name */
- { 386, 0 }, /* (266) from_db_opt ::= */
- { 386, -2 }, /* (267) from_db_opt ::= FROM db_name */
- { 387, 0 }, /* (268) tag_list_opt ::= */
- { 387, -1 }, /* (269) tag_list_opt ::= tag_item */
- { 387, -3 }, /* (270) tag_list_opt ::= tag_list_opt NK_COMMA tag_item */
- { 388, -1 }, /* (271) tag_item ::= TBNAME */
- { 388, -1 }, /* (272) tag_item ::= QTAGS */
- { 388, -1 }, /* (273) tag_item ::= column_name */
- { 388, -2 }, /* (274) tag_item ::= column_name column_alias */
- { 388, -3 }, /* (275) tag_item ::= column_name AS column_alias */
- { 330, -8 }, /* (276) cmd ::= CREATE SMA INDEX not_exists_opt full_index_name ON full_table_name index_options */
- { 330, -9 }, /* (277) cmd ::= CREATE INDEX not_exists_opt full_index_name ON full_table_name NK_LP col_name_list NK_RP */
- { 330, -4 }, /* (278) cmd ::= DROP INDEX exists_opt full_index_name */
- { 390, -1 }, /* (279) full_index_name ::= index_name */
- { 390, -3 }, /* (280) full_index_name ::= db_name NK_DOT index_name */
- { 391, -10 }, /* (281) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */
- { 391, -12 }, /* (282) 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 */
- { 393, -1 }, /* (283) func_list ::= func */
- { 393, -3 }, /* (284) func_list ::= func_list NK_COMMA func */
- { 396, -4 }, /* (285) func ::= sma_func_name NK_LP expression_list NK_RP */
- { 397, -1 }, /* (286) sma_func_name ::= function_name */
- { 397, -1 }, /* (287) sma_func_name ::= COUNT */
- { 397, -1 }, /* (288) sma_func_name ::= FIRST */
- { 397, -1 }, /* (289) sma_func_name ::= LAST */
- { 397, -1 }, /* (290) sma_func_name ::= LAST_ROW */
- { 395, 0 }, /* (291) sma_stream_opt ::= */
- { 395, -3 }, /* (292) sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */
- { 395, -3 }, /* (293) sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */
- { 395, -3 }, /* (294) sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */
- { 330, -6 }, /* (295) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */
- { 330, -7 }, /* (296) cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name */
- { 330, -9 }, /* (297) cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name */
- { 330, -7 }, /* (298) cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name */
- { 330, -9 }, /* (299) cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name */
- { 330, -4 }, /* (300) cmd ::= DROP TOPIC exists_opt topic_name */
- { 330, -7 }, /* (301) cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */
- { 330, -2 }, /* (302) cmd ::= DESC full_table_name */
- { 330, -2 }, /* (303) cmd ::= DESCRIBE full_table_name */
- { 330, -3 }, /* (304) cmd ::= RESET QUERY CACHE */
- { 330, -4 }, /* (305) cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */
- { 330, -4 }, /* (306) cmd ::= EXPLAIN analyze_opt explain_options insert_query */
- { 400, 0 }, /* (307) analyze_opt ::= */
- { 400, -1 }, /* (308) analyze_opt ::= ANALYZE */
- { 401, 0 }, /* (309) explain_options ::= */
- { 401, -3 }, /* (310) explain_options ::= explain_options VERBOSE NK_BOOL */
- { 401, -3 }, /* (311) explain_options ::= explain_options RATIO NK_FLOAT */
- { 330, -12 }, /* (312) cmd ::= CREATE or_replace_opt agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt */
- { 330, -4 }, /* (313) cmd ::= DROP FUNCTION exists_opt function_name */
- { 404, 0 }, /* (314) agg_func_opt ::= */
- { 404, -1 }, /* (315) agg_func_opt ::= AGGREGATE */
- { 405, 0 }, /* (316) bufsize_opt ::= */
- { 405, -2 }, /* (317) bufsize_opt ::= BUFSIZE NK_INTEGER */
- { 406, 0 }, /* (318) language_opt ::= */
- { 406, -2 }, /* (319) language_opt ::= LANGUAGE NK_STRING */
- { 403, 0 }, /* (320) or_replace_opt ::= */
- { 403, -2 }, /* (321) or_replace_opt ::= OR REPLACE */
- { 330, -12 }, /* (322) cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name col_list_opt tag_def_or_ref_opt subtable_opt AS query_or_subquery */
- { 330, -4 }, /* (323) cmd ::= DROP STREAM exists_opt stream_name */
- { 409, 0 }, /* (324) col_list_opt ::= */
- { 409, -3 }, /* (325) col_list_opt ::= NK_LP col_name_list NK_RP */
- { 410, 0 }, /* (326) tag_def_or_ref_opt ::= */
- { 410, -1 }, /* (327) tag_def_or_ref_opt ::= tags_def */
- { 410, -4 }, /* (328) tag_def_or_ref_opt ::= TAGS NK_LP col_name_list NK_RP */
- { 408, 0 }, /* (329) stream_options ::= */
- { 408, -3 }, /* (330) stream_options ::= stream_options TRIGGER AT_ONCE */
- { 408, -3 }, /* (331) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */
- { 408, -4 }, /* (332) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */
- { 408, -3 }, /* (333) stream_options ::= stream_options WATERMARK duration_literal */
- { 408, -4 }, /* (334) stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */
- { 408, -3 }, /* (335) stream_options ::= stream_options FILL_HISTORY NK_INTEGER */
- { 408, -3 }, /* (336) stream_options ::= stream_options DELETE_MARK duration_literal */
- { 408, -4 }, /* (337) stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */
- { 411, 0 }, /* (338) subtable_opt ::= */
- { 411, -4 }, /* (339) subtable_opt ::= SUBTABLE NK_LP expression NK_RP */
- { 330, -3 }, /* (340) cmd ::= KILL CONNECTION NK_INTEGER */
- { 330, -3 }, /* (341) cmd ::= KILL QUERY NK_STRING */
- { 330, -3 }, /* (342) cmd ::= KILL TRANSACTION NK_INTEGER */
- { 330, -2 }, /* (343) cmd ::= BALANCE VGROUP */
- { 330, -3 }, /* (344) cmd ::= BALANCE VGROUP LEADER */
- { 330, -4 }, /* (345) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */
- { 330, -4 }, /* (346) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */
- { 330, -3 }, /* (347) cmd ::= SPLIT VGROUP NK_INTEGER */
- { 413, -2 }, /* (348) dnode_list ::= DNODE NK_INTEGER */
- { 413, -3 }, /* (349) dnode_list ::= dnode_list DNODE NK_INTEGER */
- { 330, -4 }, /* (350) cmd ::= DELETE FROM full_table_name where_clause_opt */
- { 330, -1 }, /* (351) cmd ::= query_or_subquery */
- { 330, -1 }, /* (352) cmd ::= insert_query */
- { 402, -7 }, /* (353) insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */
- { 402, -4 }, /* (354) insert_query ::= INSERT INTO full_table_name query_or_subquery */
- { 333, -1 }, /* (355) literal ::= NK_INTEGER */
- { 333, -1 }, /* (356) literal ::= NK_FLOAT */
- { 333, -1 }, /* (357) literal ::= NK_STRING */
- { 333, -1 }, /* (358) literal ::= NK_BOOL */
- { 333, -2 }, /* (359) literal ::= TIMESTAMP NK_STRING */
- { 333, -1 }, /* (360) literal ::= duration_literal */
- { 333, -1 }, /* (361) literal ::= NULL */
- { 333, -1 }, /* (362) literal ::= NK_QUESTION */
- { 379, -1 }, /* (363) duration_literal ::= NK_VARIABLE */
- { 415, -1 }, /* (364) signed ::= NK_INTEGER */
- { 415, -2 }, /* (365) signed ::= NK_PLUS NK_INTEGER */
- { 415, -2 }, /* (366) signed ::= NK_MINUS NK_INTEGER */
- { 415, -1 }, /* (367) signed ::= NK_FLOAT */
- { 415, -2 }, /* (368) signed ::= NK_PLUS NK_FLOAT */
- { 415, -2 }, /* (369) signed ::= NK_MINUS NK_FLOAT */
- { 368, -1 }, /* (370) signed_literal ::= signed */
- { 368, -1 }, /* (371) signed_literal ::= NK_STRING */
- { 368, -1 }, /* (372) signed_literal ::= NK_BOOL */
- { 368, -2 }, /* (373) signed_literal ::= TIMESTAMP NK_STRING */
- { 368, -1 }, /* (374) signed_literal ::= duration_literal */
- { 368, -1 }, /* (375) signed_literal ::= NULL */
- { 368, -1 }, /* (376) signed_literal ::= literal_func */
- { 368, -1 }, /* (377) signed_literal ::= NK_QUESTION */
- { 417, -1 }, /* (378) literal_list ::= signed_literal */
- { 417, -3 }, /* (379) literal_list ::= literal_list NK_COMMA signed_literal */
- { 341, -1 }, /* (380) db_name ::= NK_ID */
- { 374, -1 }, /* (381) table_name ::= NK_ID */
- { 366, -1 }, /* (382) column_name ::= NK_ID */
- { 381, -1 }, /* (383) function_name ::= NK_ID */
- { 418, -1 }, /* (384) table_alias ::= NK_ID */
- { 389, -1 }, /* (385) column_alias ::= NK_ID */
- { 335, -1 }, /* (386) user_name ::= NK_ID */
- { 342, -1 }, /* (387) topic_name ::= NK_ID */
- { 407, -1 }, /* (388) stream_name ::= NK_ID */
- { 399, -1 }, /* (389) cgroup_name ::= NK_ID */
- { 392, -1 }, /* (390) index_name ::= NK_ID */
- { 419, -1 }, /* (391) expr_or_subquery ::= expression */
- { 412, -1 }, /* (392) expression ::= literal */
- { 412, -1 }, /* (393) expression ::= pseudo_column */
- { 412, -1 }, /* (394) expression ::= column_reference */
- { 412, -1 }, /* (395) expression ::= function_expression */
- { 412, -1 }, /* (396) expression ::= case_when_expression */
- { 412, -3 }, /* (397) expression ::= NK_LP expression NK_RP */
- { 412, -2 }, /* (398) expression ::= NK_PLUS expr_or_subquery */
- { 412, -2 }, /* (399) expression ::= NK_MINUS expr_or_subquery */
- { 412, -3 }, /* (400) expression ::= expr_or_subquery NK_PLUS expr_or_subquery */
- { 412, -3 }, /* (401) expression ::= expr_or_subquery NK_MINUS expr_or_subquery */
- { 412, -3 }, /* (402) expression ::= expr_or_subquery NK_STAR expr_or_subquery */
- { 412, -3 }, /* (403) expression ::= expr_or_subquery NK_SLASH expr_or_subquery */
- { 412, -3 }, /* (404) expression ::= expr_or_subquery NK_REM expr_or_subquery */
- { 412, -3 }, /* (405) expression ::= column_reference NK_ARROW NK_STRING */
- { 412, -3 }, /* (406) expression ::= expr_or_subquery NK_BITAND expr_or_subquery */
- { 412, -3 }, /* (407) expression ::= expr_or_subquery NK_BITOR expr_or_subquery */
- { 371, -1 }, /* (408) expression_list ::= expr_or_subquery */
- { 371, -3 }, /* (409) expression_list ::= expression_list NK_COMMA expr_or_subquery */
- { 421, -1 }, /* (410) column_reference ::= column_name */
- { 421, -3 }, /* (411) column_reference ::= table_name NK_DOT column_name */
- { 420, -1 }, /* (412) pseudo_column ::= ROWTS */
- { 420, -1 }, /* (413) pseudo_column ::= TBNAME */
- { 420, -3 }, /* (414) pseudo_column ::= table_name NK_DOT TBNAME */
- { 420, -1 }, /* (415) pseudo_column ::= QSTART */
- { 420, -1 }, /* (416) pseudo_column ::= QEND */
- { 420, -1 }, /* (417) pseudo_column ::= QDURATION */
- { 420, -1 }, /* (418) pseudo_column ::= WSTART */
- { 420, -1 }, /* (419) pseudo_column ::= WEND */
- { 420, -1 }, /* (420) pseudo_column ::= WDURATION */
- { 420, -1 }, /* (421) pseudo_column ::= IROWTS */
- { 420, -1 }, /* (422) pseudo_column ::= ISFILLED */
- { 420, -1 }, /* (423) pseudo_column ::= QTAGS */
- { 422, -4 }, /* (424) function_expression ::= function_name NK_LP expression_list NK_RP */
- { 422, -4 }, /* (425) function_expression ::= star_func NK_LP star_func_para_list NK_RP */
- { 422, -6 }, /* (426) function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */
- { 422, -1 }, /* (427) function_expression ::= literal_func */
- { 416, -3 }, /* (428) literal_func ::= noarg_func NK_LP NK_RP */
- { 416, -1 }, /* (429) literal_func ::= NOW */
- { 426, -1 }, /* (430) noarg_func ::= NOW */
- { 426, -1 }, /* (431) noarg_func ::= TODAY */
- { 426, -1 }, /* (432) noarg_func ::= TIMEZONE */
- { 426, -1 }, /* (433) noarg_func ::= DATABASE */
- { 426, -1 }, /* (434) noarg_func ::= CLIENT_VERSION */
- { 426, -1 }, /* (435) noarg_func ::= SERVER_VERSION */
- { 426, -1 }, /* (436) noarg_func ::= SERVER_STATUS */
- { 426, -1 }, /* (437) noarg_func ::= CURRENT_USER */
- { 426, -1 }, /* (438) noarg_func ::= USER */
- { 424, -1 }, /* (439) star_func ::= COUNT */
- { 424, -1 }, /* (440) star_func ::= FIRST */
- { 424, -1 }, /* (441) star_func ::= LAST */
- { 424, -1 }, /* (442) star_func ::= LAST_ROW */
- { 425, -1 }, /* (443) star_func_para_list ::= NK_STAR */
- { 425, -1 }, /* (444) star_func_para_list ::= other_para_list */
- { 427, -1 }, /* (445) other_para_list ::= star_func_para */
- { 427, -3 }, /* (446) other_para_list ::= other_para_list NK_COMMA star_func_para */
- { 428, -1 }, /* (447) star_func_para ::= expr_or_subquery */
- { 428, -3 }, /* (448) star_func_para ::= table_name NK_DOT NK_STAR */
- { 423, -4 }, /* (449) case_when_expression ::= CASE when_then_list case_when_else_opt END */
- { 423, -5 }, /* (450) case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */
- { 429, -1 }, /* (451) when_then_list ::= when_then_expr */
- { 429, -2 }, /* (452) when_then_list ::= when_then_list when_then_expr */
- { 432, -4 }, /* (453) when_then_expr ::= WHEN common_expression THEN common_expression */
- { 430, 0 }, /* (454) case_when_else_opt ::= */
- { 430, -2 }, /* (455) case_when_else_opt ::= ELSE common_expression */
- { 433, -3 }, /* (456) predicate ::= expr_or_subquery compare_op expr_or_subquery */
- { 433, -5 }, /* (457) predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */
- { 433, -6 }, /* (458) predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */
- { 433, -3 }, /* (459) predicate ::= expr_or_subquery IS NULL */
- { 433, -4 }, /* (460) predicate ::= expr_or_subquery IS NOT NULL */
- { 433, -3 }, /* (461) predicate ::= expr_or_subquery in_op in_predicate_value */
- { 434, -1 }, /* (462) compare_op ::= NK_LT */
- { 434, -1 }, /* (463) compare_op ::= NK_GT */
- { 434, -1 }, /* (464) compare_op ::= NK_LE */
- { 434, -1 }, /* (465) compare_op ::= NK_GE */
- { 434, -1 }, /* (466) compare_op ::= NK_NE */
- { 434, -1 }, /* (467) compare_op ::= NK_EQ */
- { 434, -1 }, /* (468) compare_op ::= LIKE */
- { 434, -2 }, /* (469) compare_op ::= NOT LIKE */
- { 434, -1 }, /* (470) compare_op ::= MATCH */
- { 434, -1 }, /* (471) compare_op ::= NMATCH */
- { 434, -1 }, /* (472) compare_op ::= CONTAINS */
- { 435, -1 }, /* (473) in_op ::= IN */
- { 435, -2 }, /* (474) in_op ::= NOT IN */
- { 436, -3 }, /* (475) in_predicate_value ::= NK_LP literal_list NK_RP */
- { 437, -1 }, /* (476) boolean_value_expression ::= boolean_primary */
- { 437, -2 }, /* (477) boolean_value_expression ::= NOT boolean_primary */
- { 437, -3 }, /* (478) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */
- { 437, -3 }, /* (479) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */
- { 438, -1 }, /* (480) boolean_primary ::= predicate */
- { 438, -3 }, /* (481) boolean_primary ::= NK_LP boolean_value_expression NK_RP */
- { 431, -1 }, /* (482) common_expression ::= expr_or_subquery */
- { 431, -1 }, /* (483) common_expression ::= boolean_value_expression */
- { 439, 0 }, /* (484) from_clause_opt ::= */
- { 439, -2 }, /* (485) from_clause_opt ::= FROM table_reference_list */
- { 440, -1 }, /* (486) table_reference_list ::= table_reference */
- { 440, -3 }, /* (487) table_reference_list ::= table_reference_list NK_COMMA table_reference */
- { 441, -1 }, /* (488) table_reference ::= table_primary */
- { 441, -1 }, /* (489) table_reference ::= joined_table */
- { 442, -2 }, /* (490) table_primary ::= table_name alias_opt */
- { 442, -4 }, /* (491) table_primary ::= db_name NK_DOT table_name alias_opt */
- { 442, -2 }, /* (492) table_primary ::= subquery alias_opt */
- { 442, -1 }, /* (493) table_primary ::= parenthesized_joined_table */
- { 444, 0 }, /* (494) alias_opt ::= */
- { 444, -1 }, /* (495) alias_opt ::= table_alias */
- { 444, -2 }, /* (496) alias_opt ::= AS table_alias */
- { 446, -3 }, /* (497) parenthesized_joined_table ::= NK_LP joined_table NK_RP */
- { 446, -3 }, /* (498) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */
- { 443, -6 }, /* (499) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */
- { 447, 0 }, /* (500) join_type ::= */
- { 447, -1 }, /* (501) join_type ::= INNER */
- { 449, -12 }, /* (502) 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 */
- { 450, 0 }, /* (503) set_quantifier_opt ::= */
- { 450, -1 }, /* (504) set_quantifier_opt ::= DISTINCT */
- { 450, -1 }, /* (505) set_quantifier_opt ::= ALL */
- { 451, -1 }, /* (506) select_list ::= select_item */
- { 451, -3 }, /* (507) select_list ::= select_list NK_COMMA select_item */
- { 459, -1 }, /* (508) select_item ::= NK_STAR */
- { 459, -1 }, /* (509) select_item ::= common_expression */
- { 459, -2 }, /* (510) select_item ::= common_expression column_alias */
- { 459, -3 }, /* (511) select_item ::= common_expression AS column_alias */
- { 459, -3 }, /* (512) select_item ::= table_name NK_DOT NK_STAR */
- { 414, 0 }, /* (513) where_clause_opt ::= */
- { 414, -2 }, /* (514) where_clause_opt ::= WHERE search_condition */
- { 452, 0 }, /* (515) partition_by_clause_opt ::= */
- { 452, -3 }, /* (516) partition_by_clause_opt ::= PARTITION BY partition_list */
- { 460, -1 }, /* (517) partition_list ::= partition_item */
- { 460, -3 }, /* (518) partition_list ::= partition_list NK_COMMA partition_item */
- { 461, -1 }, /* (519) partition_item ::= expr_or_subquery */
- { 461, -2 }, /* (520) partition_item ::= expr_or_subquery column_alias */
- { 461, -3 }, /* (521) partition_item ::= expr_or_subquery AS column_alias */
- { 456, 0 }, /* (522) twindow_clause_opt ::= */
- { 456, -6 }, /* (523) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */
- { 456, -4 }, /* (524) twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */
- { 456, -6 }, /* (525) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */
- { 456, -8 }, /* (526) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */
- { 456, -7 }, /* (527) twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */
- { 394, 0 }, /* (528) sliding_opt ::= */
- { 394, -4 }, /* (529) sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */
- { 455, 0 }, /* (530) fill_opt ::= */
- { 455, -4 }, /* (531) fill_opt ::= FILL NK_LP fill_mode NK_RP */
- { 455, -6 }, /* (532) fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */
- { 455, -6 }, /* (533) fill_opt ::= FILL NK_LP VALUE_F NK_COMMA literal_list NK_RP */
- { 462, -1 }, /* (534) fill_mode ::= NONE */
- { 462, -1 }, /* (535) fill_mode ::= PREV */
- { 462, -1 }, /* (536) fill_mode ::= NULL */
- { 462, -1 }, /* (537) fill_mode ::= NULL_F */
- { 462, -1 }, /* (538) fill_mode ::= LINEAR */
- { 462, -1 }, /* (539) fill_mode ::= NEXT */
- { 457, 0 }, /* (540) group_by_clause_opt ::= */
- { 457, -3 }, /* (541) group_by_clause_opt ::= GROUP BY group_by_list */
- { 463, -1 }, /* (542) group_by_list ::= expr_or_subquery */
- { 463, -3 }, /* (543) group_by_list ::= group_by_list NK_COMMA expr_or_subquery */
- { 458, 0 }, /* (544) having_clause_opt ::= */
- { 458, -2 }, /* (545) having_clause_opt ::= HAVING search_condition */
- { 453, 0 }, /* (546) range_opt ::= */
- { 453, -6 }, /* (547) range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */
- { 454, 0 }, /* (548) every_opt ::= */
- { 454, -4 }, /* (549) every_opt ::= EVERY NK_LP duration_literal NK_RP */
- { 464, -4 }, /* (550) query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */
- { 465, -1 }, /* (551) query_simple ::= query_specification */
- { 465, -1 }, /* (552) query_simple ::= union_query_expression */
- { 469, -4 }, /* (553) union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */
- { 469, -3 }, /* (554) union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */
- { 470, -1 }, /* (555) query_simple_or_subquery ::= query_simple */
- { 470, -1 }, /* (556) query_simple_or_subquery ::= subquery */
- { 398, -1 }, /* (557) query_or_subquery ::= query_expression */
- { 398, -1 }, /* (558) query_or_subquery ::= subquery */
- { 466, 0 }, /* (559) order_by_clause_opt ::= */
- { 466, -3 }, /* (560) order_by_clause_opt ::= ORDER BY sort_specification_list */
- { 467, 0 }, /* (561) slimit_clause_opt ::= */
- { 467, -2 }, /* (562) slimit_clause_opt ::= SLIMIT NK_INTEGER */
- { 467, -4 }, /* (563) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */
- { 467, -4 }, /* (564) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */
- { 468, 0 }, /* (565) limit_clause_opt ::= */
- { 468, -2 }, /* (566) limit_clause_opt ::= LIMIT NK_INTEGER */
- { 468, -4 }, /* (567) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */
- { 468, -4 }, /* (568) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */
- { 445, -3 }, /* (569) subquery ::= NK_LP query_expression NK_RP */
- { 445, -3 }, /* (570) subquery ::= NK_LP subquery NK_RP */
- { 448, -1 }, /* (571) search_condition ::= common_expression */
- { 471, -1 }, /* (572) sort_specification_list ::= sort_specification */
- { 471, -3 }, /* (573) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */
- { 472, -3 }, /* (574) sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */
- { 473, 0 }, /* (575) ordering_specification_opt ::= */
- { 473, -1 }, /* (576) ordering_specification_opt ::= ASC */
- { 473, -1 }, /* (577) ordering_specification_opt ::= DESC */
- { 474, 0 }, /* (578) null_ordering_opt ::= */
- { 474, -2 }, /* (579) null_ordering_opt ::= NULLS FIRST */
- { 474, -2 }, /* (580) null_ordering_opt ::= NULLS LAST */
+ { 338, -3 }, /* (42) priv_level ::= db_name NK_DOT table_name */
+ { 338, -1 }, /* (43) priv_level ::= topic_name */
+ { 339, 0 }, /* (44) with_opt ::= */
+ { 339, -2 }, /* (45) with_opt ::= WITH search_condition */
+ { 330, -3 }, /* (46) cmd ::= CREATE DNODE dnode_endpoint */
+ { 330, -5 }, /* (47) cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER */
+ { 330, -4 }, /* (48) cmd ::= DROP DNODE NK_INTEGER force_opt */
+ { 330, -4 }, /* (49) cmd ::= DROP DNODE dnode_endpoint force_opt */
+ { 330, -4 }, /* (50) cmd ::= ALTER DNODE NK_INTEGER NK_STRING */
+ { 330, -5 }, /* (51) cmd ::= ALTER DNODE NK_INTEGER NK_STRING NK_STRING */
+ { 330, -4 }, /* (52) cmd ::= ALTER ALL DNODES NK_STRING */
+ { 330, -5 }, /* (53) cmd ::= ALTER ALL DNODES NK_STRING NK_STRING */
+ { 346, -1 }, /* (54) dnode_endpoint ::= NK_STRING */
+ { 346, -1 }, /* (55) dnode_endpoint ::= NK_ID */
+ { 346, -1 }, /* (56) dnode_endpoint ::= NK_IPTOKEN */
+ { 347, 0 }, /* (57) force_opt ::= */
+ { 347, -1 }, /* (58) force_opt ::= FORCE */
+ { 330, -3 }, /* (59) cmd ::= ALTER LOCAL NK_STRING */
+ { 330, -4 }, /* (60) cmd ::= ALTER LOCAL NK_STRING NK_STRING */
+ { 330, -5 }, /* (61) cmd ::= CREATE QNODE ON DNODE NK_INTEGER */
+ { 330, -5 }, /* (62) cmd ::= DROP QNODE ON DNODE NK_INTEGER */
+ { 330, -5 }, /* (63) cmd ::= CREATE BNODE ON DNODE NK_INTEGER */
+ { 330, -5 }, /* (64) cmd ::= DROP BNODE ON DNODE NK_INTEGER */
+ { 330, -5 }, /* (65) cmd ::= CREATE SNODE ON DNODE NK_INTEGER */
+ { 330, -5 }, /* (66) cmd ::= DROP SNODE ON DNODE NK_INTEGER */
+ { 330, -5 }, /* (67) cmd ::= CREATE MNODE ON DNODE NK_INTEGER */
+ { 330, -5 }, /* (68) cmd ::= DROP MNODE ON DNODE NK_INTEGER */
+ { 330, -5 }, /* (69) cmd ::= CREATE DATABASE not_exists_opt db_name db_options */
+ { 330, -4 }, /* (70) cmd ::= DROP DATABASE exists_opt db_name */
+ { 330, -2 }, /* (71) cmd ::= USE db_name */
+ { 330, -4 }, /* (72) cmd ::= ALTER DATABASE db_name alter_db_options */
+ { 330, -3 }, /* (73) cmd ::= FLUSH DATABASE db_name */
+ { 330, -4 }, /* (74) cmd ::= TRIM DATABASE db_name speed_opt */
+ { 330, -5 }, /* (75) cmd ::= COMPACT DATABASE db_name start_opt end_opt */
+ { 348, -3 }, /* (76) not_exists_opt ::= IF NOT EXISTS */
+ { 348, 0 }, /* (77) not_exists_opt ::= */
+ { 350, -2 }, /* (78) exists_opt ::= IF EXISTS */
+ { 350, 0 }, /* (79) exists_opt ::= */
+ { 349, 0 }, /* (80) db_options ::= */
+ { 349, -3 }, /* (81) db_options ::= db_options BUFFER NK_INTEGER */
+ { 349, -3 }, /* (82) db_options ::= db_options CACHEMODEL NK_STRING */
+ { 349, -3 }, /* (83) db_options ::= db_options CACHESIZE NK_INTEGER */
+ { 349, -3 }, /* (84) db_options ::= db_options COMP NK_INTEGER */
+ { 349, -3 }, /* (85) db_options ::= db_options DURATION NK_INTEGER */
+ { 349, -3 }, /* (86) db_options ::= db_options DURATION NK_VARIABLE */
+ { 349, -3 }, /* (87) db_options ::= db_options MAXROWS NK_INTEGER */
+ { 349, -3 }, /* (88) db_options ::= db_options MINROWS NK_INTEGER */
+ { 349, -3 }, /* (89) db_options ::= db_options KEEP integer_list */
+ { 349, -3 }, /* (90) db_options ::= db_options KEEP variable_list */
+ { 349, -3 }, /* (91) db_options ::= db_options PAGES NK_INTEGER */
+ { 349, -3 }, /* (92) db_options ::= db_options PAGESIZE NK_INTEGER */
+ { 349, -3 }, /* (93) db_options ::= db_options TSDB_PAGESIZE NK_INTEGER */
+ { 349, -3 }, /* (94) db_options ::= db_options PRECISION NK_STRING */
+ { 349, -3 }, /* (95) db_options ::= db_options REPLICA NK_INTEGER */
+ { 349, -3 }, /* (96) db_options ::= db_options VGROUPS NK_INTEGER */
+ { 349, -3 }, /* (97) db_options ::= db_options SINGLE_STABLE NK_INTEGER */
+ { 349, -3 }, /* (98) db_options ::= db_options RETENTIONS retention_list */
+ { 349, -3 }, /* (99) db_options ::= db_options SCHEMALESS NK_INTEGER */
+ { 349, -3 }, /* (100) db_options ::= db_options WAL_LEVEL NK_INTEGER */
+ { 349, -3 }, /* (101) db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER */
+ { 349, -3 }, /* (102) db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER */
+ { 349, -4 }, /* (103) db_options ::= db_options WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */
+ { 349, -3 }, /* (104) db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER */
+ { 349, -4 }, /* (105) db_options ::= db_options WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */
+ { 349, -3 }, /* (106) db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER */
+ { 349, -3 }, /* (107) db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER */
+ { 349, -3 }, /* (108) db_options ::= db_options STT_TRIGGER NK_INTEGER */
+ { 349, -3 }, /* (109) db_options ::= db_options TABLE_PREFIX NK_INTEGER */
+ { 349, -3 }, /* (110) db_options ::= db_options TABLE_SUFFIX NK_INTEGER */
+ { 351, -1 }, /* (111) alter_db_options ::= alter_db_option */
+ { 351, -2 }, /* (112) alter_db_options ::= alter_db_options alter_db_option */
+ { 358, -2 }, /* (113) alter_db_option ::= BUFFER NK_INTEGER */
+ { 358, -2 }, /* (114) alter_db_option ::= CACHEMODEL NK_STRING */
+ { 358, -2 }, /* (115) alter_db_option ::= CACHESIZE NK_INTEGER */
+ { 358, -2 }, /* (116) alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER */
+ { 358, -2 }, /* (117) alter_db_option ::= KEEP integer_list */
+ { 358, -2 }, /* (118) alter_db_option ::= KEEP variable_list */
+ { 358, -2 }, /* (119) alter_db_option ::= PAGES NK_INTEGER */
+ { 358, -2 }, /* (120) alter_db_option ::= REPLICA NK_INTEGER */
+ { 358, -2 }, /* (121) alter_db_option ::= WAL_LEVEL NK_INTEGER */
+ { 358, -2 }, /* (122) alter_db_option ::= STT_TRIGGER NK_INTEGER */
+ { 358, -2 }, /* (123) alter_db_option ::= MINROWS NK_INTEGER */
+ { 358, -2 }, /* (124) alter_db_option ::= WAL_RETENTION_PERIOD NK_INTEGER */
+ { 358, -3 }, /* (125) alter_db_option ::= WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */
+ { 358, -2 }, /* (126) alter_db_option ::= WAL_RETENTION_SIZE NK_INTEGER */
+ { 358, -3 }, /* (127) alter_db_option ::= WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */
+ { 355, -1 }, /* (128) integer_list ::= NK_INTEGER */
+ { 355, -3 }, /* (129) integer_list ::= integer_list NK_COMMA NK_INTEGER */
+ { 356, -1 }, /* (130) variable_list ::= NK_VARIABLE */
+ { 356, -3 }, /* (131) variable_list ::= variable_list NK_COMMA NK_VARIABLE */
+ { 357, -1 }, /* (132) retention_list ::= retention */
+ { 357, -3 }, /* (133) retention_list ::= retention_list NK_COMMA retention */
+ { 359, -3 }, /* (134) retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */
+ { 352, 0 }, /* (135) speed_opt ::= */
+ { 352, -2 }, /* (136) speed_opt ::= MAX_SPEED NK_INTEGER */
+ { 353, 0 }, /* (137) start_opt ::= */
+ { 353, -3 }, /* (138) start_opt ::= START WITH NK_INTEGER */
+ { 353, -3 }, /* (139) start_opt ::= START WITH NK_STRING */
+ { 353, -4 }, /* (140) start_opt ::= START WITH TIMESTAMP NK_STRING */
+ { 354, 0 }, /* (141) end_opt ::= */
+ { 354, -3 }, /* (142) end_opt ::= END WITH NK_INTEGER */
+ { 354, -3 }, /* (143) end_opt ::= END WITH NK_STRING */
+ { 354, -4 }, /* (144) end_opt ::= END WITH TIMESTAMP NK_STRING */
+ { 330, -9 }, /* (145) cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */
+ { 330, -3 }, /* (146) cmd ::= CREATE TABLE multi_create_clause */
+ { 330, -9 }, /* (147) cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */
+ { 330, -3 }, /* (148) cmd ::= DROP TABLE multi_drop_clause */
+ { 330, -4 }, /* (149) cmd ::= DROP STABLE exists_opt full_table_name */
+ { 330, -3 }, /* (150) cmd ::= ALTER TABLE alter_table_clause */
+ { 330, -3 }, /* (151) cmd ::= ALTER STABLE alter_table_clause */
+ { 367, -2 }, /* (152) alter_table_clause ::= full_table_name alter_table_options */
+ { 367, -5 }, /* (153) alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */
+ { 367, -4 }, /* (154) alter_table_clause ::= full_table_name DROP COLUMN column_name */
+ { 367, -5 }, /* (155) alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */
+ { 367, -5 }, /* (156) alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */
+ { 367, -5 }, /* (157) alter_table_clause ::= full_table_name ADD TAG column_name type_name */
+ { 367, -4 }, /* (158) alter_table_clause ::= full_table_name DROP TAG column_name */
+ { 367, -5 }, /* (159) alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */
+ { 367, -5 }, /* (160) alter_table_clause ::= full_table_name RENAME TAG column_name column_name */
+ { 367, -6 }, /* (161) alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */
+ { 364, -1 }, /* (162) multi_create_clause ::= create_subtable_clause */
+ { 364, -2 }, /* (163) multi_create_clause ::= multi_create_clause create_subtable_clause */
+ { 372, -10 }, /* (164) 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 */
+ { 366, -1 }, /* (165) multi_drop_clause ::= drop_table_clause */
+ { 366, -3 }, /* (166) multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause */
+ { 375, -2 }, /* (167) drop_table_clause ::= exists_opt full_table_name */
+ { 373, 0 }, /* (168) specific_cols_opt ::= */
+ { 373, -3 }, /* (169) specific_cols_opt ::= NK_LP col_name_list NK_RP */
+ { 360, -1 }, /* (170) full_table_name ::= table_name */
+ { 360, -3 }, /* (171) full_table_name ::= db_name NK_DOT table_name */
+ { 361, -1 }, /* (172) column_def_list ::= column_def */
+ { 361, -3 }, /* (173) column_def_list ::= column_def_list NK_COMMA column_def */
+ { 377, -2 }, /* (174) column_def ::= column_name type_name */
+ { 370, -1 }, /* (175) type_name ::= BOOL */
+ { 370, -1 }, /* (176) type_name ::= TINYINT */
+ { 370, -1 }, /* (177) type_name ::= SMALLINT */
+ { 370, -1 }, /* (178) type_name ::= INT */
+ { 370, -1 }, /* (179) type_name ::= INTEGER */
+ { 370, -1 }, /* (180) type_name ::= BIGINT */
+ { 370, -1 }, /* (181) type_name ::= FLOAT */
+ { 370, -1 }, /* (182) type_name ::= DOUBLE */
+ { 370, -4 }, /* (183) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */
+ { 370, -1 }, /* (184) type_name ::= TIMESTAMP */
+ { 370, -4 }, /* (185) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */
+ { 370, -2 }, /* (186) type_name ::= TINYINT UNSIGNED */
+ { 370, -2 }, /* (187) type_name ::= SMALLINT UNSIGNED */
+ { 370, -2 }, /* (188) type_name ::= INT UNSIGNED */
+ { 370, -2 }, /* (189) type_name ::= BIGINT UNSIGNED */
+ { 370, -1 }, /* (190) type_name ::= JSON */
+ { 370, -4 }, /* (191) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */
+ { 370, -1 }, /* (192) type_name ::= MEDIUMBLOB */
+ { 370, -1 }, /* (193) type_name ::= BLOB */
+ { 370, -4 }, /* (194) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */
+ { 370, -1 }, /* (195) type_name ::= DECIMAL */
+ { 370, -4 }, /* (196) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */
+ { 370, -6 }, /* (197) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */
+ { 362, 0 }, /* (198) tags_def_opt ::= */
+ { 362, -1 }, /* (199) tags_def_opt ::= tags_def */
+ { 365, -4 }, /* (200) tags_def ::= TAGS NK_LP column_def_list NK_RP */
+ { 363, 0 }, /* (201) table_options ::= */
+ { 363, -3 }, /* (202) table_options ::= table_options COMMENT NK_STRING */
+ { 363, -3 }, /* (203) table_options ::= table_options MAX_DELAY duration_list */
+ { 363, -3 }, /* (204) table_options ::= table_options WATERMARK duration_list */
+ { 363, -5 }, /* (205) table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */
+ { 363, -3 }, /* (206) table_options ::= table_options TTL NK_INTEGER */
+ { 363, -5 }, /* (207) table_options ::= table_options SMA NK_LP col_name_list NK_RP */
+ { 363, -3 }, /* (208) table_options ::= table_options DELETE_MARK duration_list */
+ { 368, -1 }, /* (209) alter_table_options ::= alter_table_option */
+ { 368, -2 }, /* (210) alter_table_options ::= alter_table_options alter_table_option */
+ { 380, -2 }, /* (211) alter_table_option ::= COMMENT NK_STRING */
+ { 380, -2 }, /* (212) alter_table_option ::= TTL NK_INTEGER */
+ { 378, -1 }, /* (213) duration_list ::= duration_literal */
+ { 378, -3 }, /* (214) duration_list ::= duration_list NK_COMMA duration_literal */
+ { 379, -1 }, /* (215) rollup_func_list ::= rollup_func_name */
+ { 379, -3 }, /* (216) rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */
+ { 382, -1 }, /* (217) rollup_func_name ::= function_name */
+ { 382, -1 }, /* (218) rollup_func_name ::= FIRST */
+ { 382, -1 }, /* (219) rollup_func_name ::= LAST */
+ { 376, -1 }, /* (220) col_name_list ::= col_name */
+ { 376, -3 }, /* (221) col_name_list ::= col_name_list NK_COMMA col_name */
+ { 384, -1 }, /* (222) col_name ::= column_name */
+ { 330, -2 }, /* (223) cmd ::= SHOW DNODES */
+ { 330, -2 }, /* (224) cmd ::= SHOW USERS */
+ { 330, -3 }, /* (225) cmd ::= SHOW USER PRIVILEGES */
+ { 330, -2 }, /* (226) cmd ::= SHOW DATABASES */
+ { 330, -4 }, /* (227) cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */
+ { 330, -4 }, /* (228) cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */
+ { 330, -3 }, /* (229) cmd ::= SHOW db_name_cond_opt VGROUPS */
+ { 330, -2 }, /* (230) cmd ::= SHOW MNODES */
+ { 330, -2 }, /* (231) cmd ::= SHOW QNODES */
+ { 330, -2 }, /* (232) cmd ::= SHOW FUNCTIONS */
+ { 330, -5 }, /* (233) cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */
+ { 330, -2 }, /* (234) cmd ::= SHOW STREAMS */
+ { 330, -2 }, /* (235) cmd ::= SHOW ACCOUNTS */
+ { 330, -2 }, /* (236) cmd ::= SHOW APPS */
+ { 330, -2 }, /* (237) cmd ::= SHOW CONNECTIONS */
+ { 330, -2 }, /* (238) cmd ::= SHOW LICENCES */
+ { 330, -2 }, /* (239) cmd ::= SHOW GRANTS */
+ { 330, -4 }, /* (240) cmd ::= SHOW CREATE DATABASE db_name */
+ { 330, -4 }, /* (241) cmd ::= SHOW CREATE TABLE full_table_name */
+ { 330, -4 }, /* (242) cmd ::= SHOW CREATE STABLE full_table_name */
+ { 330, -2 }, /* (243) cmd ::= SHOW QUERIES */
+ { 330, -2 }, /* (244) cmd ::= SHOW SCORES */
+ { 330, -2 }, /* (245) cmd ::= SHOW TOPICS */
+ { 330, -2 }, /* (246) cmd ::= SHOW VARIABLES */
+ { 330, -3 }, /* (247) cmd ::= SHOW CLUSTER VARIABLES */
+ { 330, -3 }, /* (248) cmd ::= SHOW LOCAL VARIABLES */
+ { 330, -5 }, /* (249) cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt */
+ { 330, -2 }, /* (250) cmd ::= SHOW BNODES */
+ { 330, -2 }, /* (251) cmd ::= SHOW SNODES */
+ { 330, -2 }, /* (252) cmd ::= SHOW CLUSTER */
+ { 330, -2 }, /* (253) cmd ::= SHOW TRANSACTIONS */
+ { 330, -4 }, /* (254) cmd ::= SHOW TABLE DISTRIBUTED full_table_name */
+ { 330, -2 }, /* (255) cmd ::= SHOW CONSUMERS */
+ { 330, -2 }, /* (256) cmd ::= SHOW SUBSCRIPTIONS */
+ { 330, -5 }, /* (257) cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */
+ { 330, -7 }, /* (258) cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */
+ { 330, -3 }, /* (259) cmd ::= SHOW VNODES NK_INTEGER */
+ { 330, -3 }, /* (260) cmd ::= SHOW VNODES NK_STRING */
+ { 330, -3 }, /* (261) cmd ::= SHOW db_name_cond_opt ALIVE */
+ { 330, -3 }, /* (262) cmd ::= SHOW CLUSTER ALIVE */
+ { 385, 0 }, /* (263) db_name_cond_opt ::= */
+ { 385, -2 }, /* (264) db_name_cond_opt ::= db_name NK_DOT */
+ { 386, 0 }, /* (265) like_pattern_opt ::= */
+ { 386, -2 }, /* (266) like_pattern_opt ::= LIKE NK_STRING */
+ { 387, -1 }, /* (267) table_name_cond ::= table_name */
+ { 388, 0 }, /* (268) from_db_opt ::= */
+ { 388, -2 }, /* (269) from_db_opt ::= FROM db_name */
+ { 389, 0 }, /* (270) tag_list_opt ::= */
+ { 389, -1 }, /* (271) tag_list_opt ::= tag_item */
+ { 389, -3 }, /* (272) tag_list_opt ::= tag_list_opt NK_COMMA tag_item */
+ { 390, -1 }, /* (273) tag_item ::= TBNAME */
+ { 390, -1 }, /* (274) tag_item ::= QTAGS */
+ { 390, -1 }, /* (275) tag_item ::= column_name */
+ { 390, -2 }, /* (276) tag_item ::= column_name column_alias */
+ { 390, -3 }, /* (277) tag_item ::= column_name AS column_alias */
+ { 330, -8 }, /* (278) cmd ::= CREATE SMA INDEX not_exists_opt full_index_name ON full_table_name index_options */
+ { 330, -9 }, /* (279) cmd ::= CREATE INDEX not_exists_opt full_index_name ON full_table_name NK_LP col_name_list NK_RP */
+ { 330, -4 }, /* (280) cmd ::= DROP INDEX exists_opt full_index_name */
+ { 392, -1 }, /* (281) full_index_name ::= index_name */
+ { 392, -3 }, /* (282) full_index_name ::= db_name NK_DOT index_name */
+ { 393, -10 }, /* (283) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */
+ { 393, -12 }, /* (284) 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 */
+ { 395, -1 }, /* (285) func_list ::= func */
+ { 395, -3 }, /* (286) func_list ::= func_list NK_COMMA func */
+ { 398, -4 }, /* (287) func ::= sma_func_name NK_LP expression_list NK_RP */
+ { 399, -1 }, /* (288) sma_func_name ::= function_name */
+ { 399, -1 }, /* (289) sma_func_name ::= COUNT */
+ { 399, -1 }, /* (290) sma_func_name ::= FIRST */
+ { 399, -1 }, /* (291) sma_func_name ::= LAST */
+ { 399, -1 }, /* (292) sma_func_name ::= LAST_ROW */
+ { 397, 0 }, /* (293) sma_stream_opt ::= */
+ { 397, -3 }, /* (294) sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */
+ { 397, -3 }, /* (295) sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */
+ { 397, -3 }, /* (296) sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */
+ { 330, -6 }, /* (297) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */
+ { 330, -7 }, /* (298) cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name */
+ { 330, -9 }, /* (299) cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name */
+ { 330, -7 }, /* (300) cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name */
+ { 330, -9 }, /* (301) cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name */
+ { 330, -4 }, /* (302) cmd ::= DROP TOPIC exists_opt topic_name */
+ { 330, -7 }, /* (303) cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */
+ { 330, -2 }, /* (304) cmd ::= DESC full_table_name */
+ { 330, -2 }, /* (305) cmd ::= DESCRIBE full_table_name */
+ { 330, -3 }, /* (306) cmd ::= RESET QUERY CACHE */
+ { 330, -4 }, /* (307) cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */
+ { 330, -4 }, /* (308) cmd ::= EXPLAIN analyze_opt explain_options insert_query */
+ { 402, 0 }, /* (309) analyze_opt ::= */
+ { 402, -1 }, /* (310) analyze_opt ::= ANALYZE */
+ { 403, 0 }, /* (311) explain_options ::= */
+ { 403, -3 }, /* (312) explain_options ::= explain_options VERBOSE NK_BOOL */
+ { 403, -3 }, /* (313) explain_options ::= explain_options RATIO NK_FLOAT */
+ { 330, -12 }, /* (314) cmd ::= CREATE or_replace_opt agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt */
+ { 330, -4 }, /* (315) cmd ::= DROP FUNCTION exists_opt function_name */
+ { 406, 0 }, /* (316) agg_func_opt ::= */
+ { 406, -1 }, /* (317) agg_func_opt ::= AGGREGATE */
+ { 407, 0 }, /* (318) bufsize_opt ::= */
+ { 407, -2 }, /* (319) bufsize_opt ::= BUFSIZE NK_INTEGER */
+ { 408, 0 }, /* (320) language_opt ::= */
+ { 408, -2 }, /* (321) language_opt ::= LANGUAGE NK_STRING */
+ { 405, 0 }, /* (322) or_replace_opt ::= */
+ { 405, -2 }, /* (323) or_replace_opt ::= OR REPLACE */
+ { 330, -12 }, /* (324) cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name col_list_opt tag_def_or_ref_opt subtable_opt AS query_or_subquery */
+ { 330, -4 }, /* (325) cmd ::= DROP STREAM exists_opt stream_name */
+ { 411, 0 }, /* (326) col_list_opt ::= */
+ { 411, -3 }, /* (327) col_list_opt ::= NK_LP col_name_list NK_RP */
+ { 412, 0 }, /* (328) tag_def_or_ref_opt ::= */
+ { 412, -1 }, /* (329) tag_def_or_ref_opt ::= tags_def */
+ { 412, -4 }, /* (330) tag_def_or_ref_opt ::= TAGS NK_LP col_name_list NK_RP */
+ { 410, 0 }, /* (331) stream_options ::= */
+ { 410, -3 }, /* (332) stream_options ::= stream_options TRIGGER AT_ONCE */
+ { 410, -3 }, /* (333) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */
+ { 410, -4 }, /* (334) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */
+ { 410, -3 }, /* (335) stream_options ::= stream_options WATERMARK duration_literal */
+ { 410, -4 }, /* (336) stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */
+ { 410, -3 }, /* (337) stream_options ::= stream_options FILL_HISTORY NK_INTEGER */
+ { 410, -3 }, /* (338) stream_options ::= stream_options DELETE_MARK duration_literal */
+ { 410, -4 }, /* (339) stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */
+ { 413, 0 }, /* (340) subtable_opt ::= */
+ { 413, -4 }, /* (341) subtable_opt ::= SUBTABLE NK_LP expression NK_RP */
+ { 330, -3 }, /* (342) cmd ::= KILL CONNECTION NK_INTEGER */
+ { 330, -3 }, /* (343) cmd ::= KILL QUERY NK_STRING */
+ { 330, -3 }, /* (344) cmd ::= KILL TRANSACTION NK_INTEGER */
+ { 330, -2 }, /* (345) cmd ::= BALANCE VGROUP */
+ { 330, -3 }, /* (346) cmd ::= BALANCE VGROUP LEADER */
+ { 330, -4 }, /* (347) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */
+ { 330, -4 }, /* (348) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */
+ { 330, -3 }, /* (349) cmd ::= SPLIT VGROUP NK_INTEGER */
+ { 415, -2 }, /* (350) dnode_list ::= DNODE NK_INTEGER */
+ { 415, -3 }, /* (351) dnode_list ::= dnode_list DNODE NK_INTEGER */
+ { 330, -4 }, /* (352) cmd ::= DELETE FROM full_table_name where_clause_opt */
+ { 330, -1 }, /* (353) cmd ::= query_or_subquery */
+ { 330, -1 }, /* (354) cmd ::= insert_query */
+ { 404, -7 }, /* (355) insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */
+ { 404, -4 }, /* (356) insert_query ::= INSERT INTO full_table_name query_or_subquery */
+ { 333, -1 }, /* (357) literal ::= NK_INTEGER */
+ { 333, -1 }, /* (358) literal ::= NK_FLOAT */
+ { 333, -1 }, /* (359) literal ::= NK_STRING */
+ { 333, -1 }, /* (360) literal ::= NK_BOOL */
+ { 333, -2 }, /* (361) literal ::= TIMESTAMP NK_STRING */
+ { 333, -1 }, /* (362) literal ::= duration_literal */
+ { 333, -1 }, /* (363) literal ::= NULL */
+ { 333, -1 }, /* (364) literal ::= NK_QUESTION */
+ { 381, -1 }, /* (365) duration_literal ::= NK_VARIABLE */
+ { 417, -1 }, /* (366) signed ::= NK_INTEGER */
+ { 417, -2 }, /* (367) signed ::= NK_PLUS NK_INTEGER */
+ { 417, -2 }, /* (368) signed ::= NK_MINUS NK_INTEGER */
+ { 417, -1 }, /* (369) signed ::= NK_FLOAT */
+ { 417, -2 }, /* (370) signed ::= NK_PLUS NK_FLOAT */
+ { 417, -2 }, /* (371) signed ::= NK_MINUS NK_FLOAT */
+ { 371, -1 }, /* (372) signed_literal ::= signed */
+ { 371, -1 }, /* (373) signed_literal ::= NK_STRING */
+ { 371, -1 }, /* (374) signed_literal ::= NK_BOOL */
+ { 371, -2 }, /* (375) signed_literal ::= TIMESTAMP NK_STRING */
+ { 371, -1 }, /* (376) signed_literal ::= duration_literal */
+ { 371, -1 }, /* (377) signed_literal ::= NULL */
+ { 371, -1 }, /* (378) signed_literal ::= literal_func */
+ { 371, -1 }, /* (379) signed_literal ::= NK_QUESTION */
+ { 419, -1 }, /* (380) literal_list ::= signed_literal */
+ { 419, -3 }, /* (381) literal_list ::= literal_list NK_COMMA signed_literal */
+ { 342, -1 }, /* (382) db_name ::= NK_ID */
+ { 343, -1 }, /* (383) table_name ::= NK_ID */
+ { 369, -1 }, /* (384) column_name ::= NK_ID */
+ { 383, -1 }, /* (385) function_name ::= NK_ID */
+ { 420, -1 }, /* (386) table_alias ::= NK_ID */
+ { 391, -1 }, /* (387) column_alias ::= NK_ID */
+ { 335, -1 }, /* (388) user_name ::= NK_ID */
+ { 344, -1 }, /* (389) topic_name ::= NK_ID */
+ { 409, -1 }, /* (390) stream_name ::= NK_ID */
+ { 401, -1 }, /* (391) cgroup_name ::= NK_ID */
+ { 394, -1 }, /* (392) index_name ::= NK_ID */
+ { 421, -1 }, /* (393) expr_or_subquery ::= expression */
+ { 414, -1 }, /* (394) expression ::= literal */
+ { 414, -1 }, /* (395) expression ::= pseudo_column */
+ { 414, -1 }, /* (396) expression ::= column_reference */
+ { 414, -1 }, /* (397) expression ::= function_expression */
+ { 414, -1 }, /* (398) expression ::= case_when_expression */
+ { 414, -3 }, /* (399) expression ::= NK_LP expression NK_RP */
+ { 414, -2 }, /* (400) expression ::= NK_PLUS expr_or_subquery */
+ { 414, -2 }, /* (401) expression ::= NK_MINUS expr_or_subquery */
+ { 414, -3 }, /* (402) expression ::= expr_or_subquery NK_PLUS expr_or_subquery */
+ { 414, -3 }, /* (403) expression ::= expr_or_subquery NK_MINUS expr_or_subquery */
+ { 414, -3 }, /* (404) expression ::= expr_or_subquery NK_STAR expr_or_subquery */
+ { 414, -3 }, /* (405) expression ::= expr_or_subquery NK_SLASH expr_or_subquery */
+ { 414, -3 }, /* (406) expression ::= expr_or_subquery NK_REM expr_or_subquery */
+ { 414, -3 }, /* (407) expression ::= column_reference NK_ARROW NK_STRING */
+ { 414, -3 }, /* (408) expression ::= expr_or_subquery NK_BITAND expr_or_subquery */
+ { 414, -3 }, /* (409) expression ::= expr_or_subquery NK_BITOR expr_or_subquery */
+ { 374, -1 }, /* (410) expression_list ::= expr_or_subquery */
+ { 374, -3 }, /* (411) expression_list ::= expression_list NK_COMMA expr_or_subquery */
+ { 423, -1 }, /* (412) column_reference ::= column_name */
+ { 423, -3 }, /* (413) column_reference ::= table_name NK_DOT column_name */
+ { 422, -1 }, /* (414) pseudo_column ::= ROWTS */
+ { 422, -1 }, /* (415) pseudo_column ::= TBNAME */
+ { 422, -3 }, /* (416) pseudo_column ::= table_name NK_DOT TBNAME */
+ { 422, -1 }, /* (417) pseudo_column ::= QSTART */
+ { 422, -1 }, /* (418) pseudo_column ::= QEND */
+ { 422, -1 }, /* (419) pseudo_column ::= QDURATION */
+ { 422, -1 }, /* (420) pseudo_column ::= WSTART */
+ { 422, -1 }, /* (421) pseudo_column ::= WEND */
+ { 422, -1 }, /* (422) pseudo_column ::= WDURATION */
+ { 422, -1 }, /* (423) pseudo_column ::= IROWTS */
+ { 422, -1 }, /* (424) pseudo_column ::= ISFILLED */
+ { 422, -1 }, /* (425) pseudo_column ::= QTAGS */
+ { 424, -4 }, /* (426) function_expression ::= function_name NK_LP expression_list NK_RP */
+ { 424, -4 }, /* (427) function_expression ::= star_func NK_LP star_func_para_list NK_RP */
+ { 424, -6 }, /* (428) function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */
+ { 424, -1 }, /* (429) function_expression ::= literal_func */
+ { 418, -3 }, /* (430) literal_func ::= noarg_func NK_LP NK_RP */
+ { 418, -1 }, /* (431) literal_func ::= NOW */
+ { 428, -1 }, /* (432) noarg_func ::= NOW */
+ { 428, -1 }, /* (433) noarg_func ::= TODAY */
+ { 428, -1 }, /* (434) noarg_func ::= TIMEZONE */
+ { 428, -1 }, /* (435) noarg_func ::= DATABASE */
+ { 428, -1 }, /* (436) noarg_func ::= CLIENT_VERSION */
+ { 428, -1 }, /* (437) noarg_func ::= SERVER_VERSION */
+ { 428, -1 }, /* (438) noarg_func ::= SERVER_STATUS */
+ { 428, -1 }, /* (439) noarg_func ::= CURRENT_USER */
+ { 428, -1 }, /* (440) noarg_func ::= USER */
+ { 426, -1 }, /* (441) star_func ::= COUNT */
+ { 426, -1 }, /* (442) star_func ::= FIRST */
+ { 426, -1 }, /* (443) star_func ::= LAST */
+ { 426, -1 }, /* (444) star_func ::= LAST_ROW */
+ { 427, -1 }, /* (445) star_func_para_list ::= NK_STAR */
+ { 427, -1 }, /* (446) star_func_para_list ::= other_para_list */
+ { 429, -1 }, /* (447) other_para_list ::= star_func_para */
+ { 429, -3 }, /* (448) other_para_list ::= other_para_list NK_COMMA star_func_para */
+ { 430, -1 }, /* (449) star_func_para ::= expr_or_subquery */
+ { 430, -3 }, /* (450) star_func_para ::= table_name NK_DOT NK_STAR */
+ { 425, -4 }, /* (451) case_when_expression ::= CASE when_then_list case_when_else_opt END */
+ { 425, -5 }, /* (452) case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */
+ { 431, -1 }, /* (453) when_then_list ::= when_then_expr */
+ { 431, -2 }, /* (454) when_then_list ::= when_then_list when_then_expr */
+ { 434, -4 }, /* (455) when_then_expr ::= WHEN common_expression THEN common_expression */
+ { 432, 0 }, /* (456) case_when_else_opt ::= */
+ { 432, -2 }, /* (457) case_when_else_opt ::= ELSE common_expression */
+ { 435, -3 }, /* (458) predicate ::= expr_or_subquery compare_op expr_or_subquery */
+ { 435, -5 }, /* (459) predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */
+ { 435, -6 }, /* (460) predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */
+ { 435, -3 }, /* (461) predicate ::= expr_or_subquery IS NULL */
+ { 435, -4 }, /* (462) predicate ::= expr_or_subquery IS NOT NULL */
+ { 435, -3 }, /* (463) predicate ::= expr_or_subquery in_op in_predicate_value */
+ { 436, -1 }, /* (464) compare_op ::= NK_LT */
+ { 436, -1 }, /* (465) compare_op ::= NK_GT */
+ { 436, -1 }, /* (466) compare_op ::= NK_LE */
+ { 436, -1 }, /* (467) compare_op ::= NK_GE */
+ { 436, -1 }, /* (468) compare_op ::= NK_NE */
+ { 436, -1 }, /* (469) compare_op ::= NK_EQ */
+ { 436, -1 }, /* (470) compare_op ::= LIKE */
+ { 436, -2 }, /* (471) compare_op ::= NOT LIKE */
+ { 436, -1 }, /* (472) compare_op ::= MATCH */
+ { 436, -1 }, /* (473) compare_op ::= NMATCH */
+ { 436, -1 }, /* (474) compare_op ::= CONTAINS */
+ { 437, -1 }, /* (475) in_op ::= IN */
+ { 437, -2 }, /* (476) in_op ::= NOT IN */
+ { 438, -3 }, /* (477) in_predicate_value ::= NK_LP literal_list NK_RP */
+ { 439, -1 }, /* (478) boolean_value_expression ::= boolean_primary */
+ { 439, -2 }, /* (479) boolean_value_expression ::= NOT boolean_primary */
+ { 439, -3 }, /* (480) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */
+ { 439, -3 }, /* (481) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */
+ { 440, -1 }, /* (482) boolean_primary ::= predicate */
+ { 440, -3 }, /* (483) boolean_primary ::= NK_LP boolean_value_expression NK_RP */
+ { 433, -1 }, /* (484) common_expression ::= expr_or_subquery */
+ { 433, -1 }, /* (485) common_expression ::= boolean_value_expression */
+ { 441, 0 }, /* (486) from_clause_opt ::= */
+ { 441, -2 }, /* (487) from_clause_opt ::= FROM table_reference_list */
+ { 442, -1 }, /* (488) table_reference_list ::= table_reference */
+ { 442, -3 }, /* (489) table_reference_list ::= table_reference_list NK_COMMA table_reference */
+ { 443, -1 }, /* (490) table_reference ::= table_primary */
+ { 443, -1 }, /* (491) table_reference ::= joined_table */
+ { 444, -2 }, /* (492) table_primary ::= table_name alias_opt */
+ { 444, -4 }, /* (493) table_primary ::= db_name NK_DOT table_name alias_opt */
+ { 444, -2 }, /* (494) table_primary ::= subquery alias_opt */
+ { 444, -1 }, /* (495) table_primary ::= parenthesized_joined_table */
+ { 446, 0 }, /* (496) alias_opt ::= */
+ { 446, -1 }, /* (497) alias_opt ::= table_alias */
+ { 446, -2 }, /* (498) alias_opt ::= AS table_alias */
+ { 448, -3 }, /* (499) parenthesized_joined_table ::= NK_LP joined_table NK_RP */
+ { 448, -3 }, /* (500) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */
+ { 445, -6 }, /* (501) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */
+ { 449, 0 }, /* (502) join_type ::= */
+ { 449, -1 }, /* (503) join_type ::= INNER */
+ { 450, -12 }, /* (504) 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, 0 }, /* (505) set_quantifier_opt ::= */
+ { 451, -1 }, /* (506) set_quantifier_opt ::= DISTINCT */
+ { 451, -1 }, /* (507) set_quantifier_opt ::= ALL */
+ { 452, -1 }, /* (508) select_list ::= select_item */
+ { 452, -3 }, /* (509) select_list ::= select_list NK_COMMA select_item */
+ { 460, -1 }, /* (510) select_item ::= NK_STAR */
+ { 460, -1 }, /* (511) select_item ::= common_expression */
+ { 460, -2 }, /* (512) select_item ::= common_expression column_alias */
+ { 460, -3 }, /* (513) select_item ::= common_expression AS column_alias */
+ { 460, -3 }, /* (514) select_item ::= table_name NK_DOT NK_STAR */
+ { 416, 0 }, /* (515) where_clause_opt ::= */
+ { 416, -2 }, /* (516) where_clause_opt ::= WHERE search_condition */
+ { 453, 0 }, /* (517) partition_by_clause_opt ::= */
+ { 453, -3 }, /* (518) partition_by_clause_opt ::= PARTITION BY partition_list */
+ { 461, -1 }, /* (519) partition_list ::= partition_item */
+ { 461, -3 }, /* (520) partition_list ::= partition_list NK_COMMA partition_item */
+ { 462, -1 }, /* (521) partition_item ::= expr_or_subquery */
+ { 462, -2 }, /* (522) partition_item ::= expr_or_subquery column_alias */
+ { 462, -3 }, /* (523) partition_item ::= expr_or_subquery AS column_alias */
+ { 457, 0 }, /* (524) twindow_clause_opt ::= */
+ { 457, -6 }, /* (525) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */
+ { 457, -4 }, /* (526) twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */
+ { 457, -6 }, /* (527) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */
+ { 457, -8 }, /* (528) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */
+ { 457, -7 }, /* (529) twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */
+ { 396, 0 }, /* (530) sliding_opt ::= */
+ { 396, -4 }, /* (531) sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */
+ { 456, 0 }, /* (532) fill_opt ::= */
+ { 456, -4 }, /* (533) fill_opt ::= FILL NK_LP fill_mode NK_RP */
+ { 456, -6 }, /* (534) fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */
+ { 456, -6 }, /* (535) fill_opt ::= FILL NK_LP VALUE_F NK_COMMA literal_list NK_RP */
+ { 463, -1 }, /* (536) fill_mode ::= NONE */
+ { 463, -1 }, /* (537) fill_mode ::= PREV */
+ { 463, -1 }, /* (538) fill_mode ::= NULL */
+ { 463, -1 }, /* (539) fill_mode ::= NULL_F */
+ { 463, -1 }, /* (540) fill_mode ::= LINEAR */
+ { 463, -1 }, /* (541) fill_mode ::= NEXT */
+ { 458, 0 }, /* (542) group_by_clause_opt ::= */
+ { 458, -3 }, /* (543) group_by_clause_opt ::= GROUP BY group_by_list */
+ { 464, -1 }, /* (544) group_by_list ::= expr_or_subquery */
+ { 464, -3 }, /* (545) group_by_list ::= group_by_list NK_COMMA expr_or_subquery */
+ { 459, 0 }, /* (546) having_clause_opt ::= */
+ { 459, -2 }, /* (547) having_clause_opt ::= HAVING search_condition */
+ { 454, 0 }, /* (548) range_opt ::= */
+ { 454, -6 }, /* (549) range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */
+ { 455, 0 }, /* (550) every_opt ::= */
+ { 455, -4 }, /* (551) every_opt ::= EVERY NK_LP duration_literal NK_RP */
+ { 465, -4 }, /* (552) query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */
+ { 466, -1 }, /* (553) query_simple ::= query_specification */
+ { 466, -1 }, /* (554) query_simple ::= union_query_expression */
+ { 470, -4 }, /* (555) union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */
+ { 470, -3 }, /* (556) union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */
+ { 471, -1 }, /* (557) query_simple_or_subquery ::= query_simple */
+ { 471, -1 }, /* (558) query_simple_or_subquery ::= subquery */
+ { 400, -1 }, /* (559) query_or_subquery ::= query_expression */
+ { 400, -1 }, /* (560) query_or_subquery ::= subquery */
+ { 467, 0 }, /* (561) order_by_clause_opt ::= */
+ { 467, -3 }, /* (562) order_by_clause_opt ::= ORDER BY sort_specification_list */
+ { 468, 0 }, /* (563) slimit_clause_opt ::= */
+ { 468, -2 }, /* (564) slimit_clause_opt ::= SLIMIT NK_INTEGER */
+ { 468, -4 }, /* (565) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */
+ { 468, -4 }, /* (566) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */
+ { 469, 0 }, /* (567) limit_clause_opt ::= */
+ { 469, -2 }, /* (568) limit_clause_opt ::= LIMIT NK_INTEGER */
+ { 469, -4 }, /* (569) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */
+ { 469, -4 }, /* (570) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */
+ { 447, -3 }, /* (571) subquery ::= NK_LP query_expression NK_RP */
+ { 447, -3 }, /* (572) subquery ::= NK_LP subquery NK_RP */
+ { 345, -1 }, /* (573) search_condition ::= common_expression */
+ { 472, -1 }, /* (574) sort_specification_list ::= sort_specification */
+ { 472, -3 }, /* (575) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */
+ { 473, -3 }, /* (576) sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */
+ { 474, 0 }, /* (577) ordering_specification_opt ::= */
+ { 474, -1 }, /* (578) ordering_specification_opt ::= ASC */
+ { 474, -1 }, /* (579) ordering_specification_opt ::= DESC */
+ { 475, 0 }, /* (580) null_ordering_opt ::= */
+ { 475, -2 }, /* (581) null_ordering_opt ::= NULLS FIRST */
+ { 475, -2 }, /* (582) null_ordering_opt ::= NULLS LAST */
};
static void yy_accept(yyParser*); /* Forward Declaration */
@@ -3874,1592 +3848,1597 @@ static YYACTIONTYPE yy_reduce(
yy_destructor(yypParser,333,&yymsp[0].minor);
break;
case 24: /* cmd ::= CREATE USER user_name PASS NK_STRING sysinfo_opt */
-{ pCxt->pRootNode = createCreateUserStmt(pCxt, &yymsp[-3].minor.yy129, &yymsp[-1].minor.yy0, yymsp[0].minor.yy353); }
+{ pCxt->pRootNode = createCreateUserStmt(pCxt, &yymsp[-3].minor.yy113, &yymsp[-1].minor.yy0, yymsp[0].minor.yy551); }
break;
case 25: /* cmd ::= ALTER USER user_name PASS NK_STRING */
-{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy129, TSDB_ALTER_USER_PASSWD, &yymsp[0].minor.yy0); }
+{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy113, 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.yy129, TSDB_ALTER_USER_ENABLE, &yymsp[0].minor.yy0); }
+{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy113, 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.yy129, TSDB_ALTER_USER_SYSINFO, &yymsp[0].minor.yy0); }
+{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy113, TSDB_ALTER_USER_SYSINFO, &yymsp[0].minor.yy0); }
break;
case 28: /* cmd ::= DROP USER user_name */
-{ pCxt->pRootNode = createDropUserStmt(pCxt, &yymsp[0].minor.yy129); }
+{ pCxt->pRootNode = createDropUserStmt(pCxt, &yymsp[0].minor.yy113); }
break;
case 29: /* sysinfo_opt ::= */
-{ yymsp[1].minor.yy353 = 1; }
+{ yymsp[1].minor.yy551 = 1; }
break;
case 30: /* sysinfo_opt ::= SYSINFO NK_INTEGER */
-{ yymsp[-1].minor.yy353 = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); }
+{ yymsp[-1].minor.yy551 = 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.yy359, &yymsp[-2].minor.yy129, &yymsp[0].minor.yy129); }
+ case 31: /* cmd ::= GRANT privileges ON priv_level with_opt TO user_name */
+{ pCxt->pRootNode = createGrantStmt(pCxt, yymsp[-5].minor.yy837, &yymsp[-3].minor.yy777, &yymsp[0].minor.yy113, yymsp[-2].minor.yy448); }
break;
- case 32: /* cmd ::= REVOKE privileges ON priv_level FROM user_name */
-{ pCxt->pRootNode = createRevokeStmt(pCxt, yymsp[-4].minor.yy359, &yymsp[-2].minor.yy129, &yymsp[0].minor.yy129); }
+ case 32: /* cmd ::= REVOKE privileges ON priv_level with_opt FROM user_name */
+{ pCxt->pRootNode = createRevokeStmt(pCxt, yymsp[-5].minor.yy837, &yymsp[-3].minor.yy777, &yymsp[0].minor.yy113, yymsp[-2].minor.yy448); }
break;
case 33: /* privileges ::= ALL */
-{ yymsp[0].minor.yy359 = PRIVILEGE_TYPE_ALL; }
+{ yymsp[0].minor.yy837 = PRIVILEGE_TYPE_ALL; }
break;
case 34: /* privileges ::= priv_type_list */
case 36: /* priv_type_list ::= priv_type */ yytestcase(yyruleno==36);
-{ yylhsminor.yy359 = yymsp[0].minor.yy359; }
- yymsp[0].minor.yy359 = yylhsminor.yy359;
+{ yylhsminor.yy837 = yymsp[0].minor.yy837; }
+ yymsp[0].minor.yy837 = yylhsminor.yy837;
break;
case 35: /* privileges ::= SUBSCRIBE */
-{ yymsp[0].minor.yy359 = PRIVILEGE_TYPE_SUBSCRIBE; }
+{ yymsp[0].minor.yy837 = PRIVILEGE_TYPE_SUBSCRIBE; }
break;
case 37: /* priv_type_list ::= priv_type_list NK_COMMA priv_type */
-{ yylhsminor.yy359 = yymsp[-2].minor.yy359 | yymsp[0].minor.yy359; }
- yymsp[-2].minor.yy359 = yylhsminor.yy359;
+{ yylhsminor.yy837 = yymsp[-2].minor.yy837 | yymsp[0].minor.yy837; }
+ yymsp[-2].minor.yy837 = yylhsminor.yy837;
break;
case 38: /* priv_type ::= READ */
-{ yymsp[0].minor.yy359 = PRIVILEGE_TYPE_READ; }
+{ yymsp[0].minor.yy837 = PRIVILEGE_TYPE_READ; }
break;
case 39: /* priv_type ::= WRITE */
-{ yymsp[0].minor.yy359 = PRIVILEGE_TYPE_WRITE; }
+{ yymsp[0].minor.yy837 = PRIVILEGE_TYPE_WRITE; }
break;
case 40: /* priv_level ::= NK_STAR NK_DOT NK_STAR */
-{ yylhsminor.yy129 = yymsp[-2].minor.yy0; }
- yymsp[-2].minor.yy129 = yylhsminor.yy129;
+{ yylhsminor.yy777.first = yymsp[-2].minor.yy0; yylhsminor.yy777.second = yymsp[0].minor.yy0; }
+ yymsp[-2].minor.yy777 = yylhsminor.yy777;
break;
case 41: /* priv_level ::= db_name NK_DOT NK_STAR */
-{ yylhsminor.yy129 = yymsp[-2].minor.yy129; }
- yymsp[-2].minor.yy129 = yylhsminor.yy129;
+{ yylhsminor.yy777.first = yymsp[-2].minor.yy113; yylhsminor.yy777.second = yymsp[0].minor.yy0; }
+ yymsp[-2].minor.yy777 = yylhsminor.yy777;
break;
- case 42: /* priv_level ::= topic_name */
- case 286: /* sma_func_name ::= function_name */ yytestcase(yyruleno==286);
- case 495: /* alias_opt ::= table_alias */ yytestcase(yyruleno==495);
-{ yylhsminor.yy129 = yymsp[0].minor.yy129; }
- yymsp[0].minor.yy129 = yylhsminor.yy129;
+ case 42: /* priv_level ::= db_name NK_DOT table_name */
+{ yylhsminor.yy777.first = yymsp[-2].minor.yy113; yylhsminor.yy777.second = yymsp[0].minor.yy113; }
+ yymsp[-2].minor.yy777 = yylhsminor.yy777;
break;
- case 43: /* cmd ::= CREATE DNODE dnode_endpoint */
-{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[0].minor.yy129, NULL); }
+ case 43: /* priv_level ::= topic_name */
+{ yylhsminor.yy777.first = yymsp[0].minor.yy113; yylhsminor.yy777.second = nil_token; }
+ yymsp[0].minor.yy777 = yylhsminor.yy777;
break;
- case 44: /* cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER */
-{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[-2].minor.yy129, &yymsp[0].minor.yy0); }
+ case 44: /* with_opt ::= */
+ case 137: /* start_opt ::= */ yytestcase(yyruleno==137);
+ case 141: /* end_opt ::= */ yytestcase(yyruleno==141);
+ case 265: /* like_pattern_opt ::= */ yytestcase(yyruleno==265);
+ case 340: /* subtable_opt ::= */ yytestcase(yyruleno==340);
+ case 456: /* case_when_else_opt ::= */ yytestcase(yyruleno==456);
+ case 486: /* from_clause_opt ::= */ yytestcase(yyruleno==486);
+ case 515: /* where_clause_opt ::= */ yytestcase(yyruleno==515);
+ case 524: /* twindow_clause_opt ::= */ yytestcase(yyruleno==524);
+ case 530: /* sliding_opt ::= */ yytestcase(yyruleno==530);
+ case 532: /* fill_opt ::= */ yytestcase(yyruleno==532);
+ case 546: /* having_clause_opt ::= */ yytestcase(yyruleno==546);
+ case 548: /* range_opt ::= */ yytestcase(yyruleno==548);
+ case 550: /* every_opt ::= */ yytestcase(yyruleno==550);
+ case 563: /* slimit_clause_opt ::= */ yytestcase(yyruleno==563);
+ case 567: /* limit_clause_opt ::= */ yytestcase(yyruleno==567);
+{ yymsp[1].minor.yy448 = NULL; }
break;
- case 45: /* cmd ::= DROP DNODE NK_INTEGER force_opt */
-{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy337); }
+ case 45: /* with_opt ::= WITH search_condition */
+ case 487: /* from_clause_opt ::= FROM table_reference_list */ yytestcase(yyruleno==487);
+ case 516: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==516);
+ case 547: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==547);
+{ yymsp[-1].minor.yy448 = yymsp[0].minor.yy448; }
break;
- case 46: /* cmd ::= DROP DNODE dnode_endpoint force_opt */
-{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy129, yymsp[0].minor.yy337); }
+ case 46: /* cmd ::= CREATE DNODE dnode_endpoint */
+{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[0].minor.yy113, NULL); }
break;
- case 47: /* cmd ::= ALTER DNODE NK_INTEGER NK_STRING */
+ case 47: /* cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER */
+{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[-2].minor.yy113, &yymsp[0].minor.yy0); }
+ break;
+ case 48: /* cmd ::= DROP DNODE NK_INTEGER force_opt */
+{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy369); }
+ break;
+ case 49: /* cmd ::= DROP DNODE dnode_endpoint force_opt */
+{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy113, yymsp[0].minor.yy369); }
+ break;
+ case 50: /* cmd ::= ALTER DNODE NK_INTEGER NK_STRING */
{ pCxt->pRootNode = createAlterDnodeStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, NULL); }
break;
- case 48: /* cmd ::= ALTER DNODE NK_INTEGER NK_STRING NK_STRING */
+ case 51: /* cmd ::= ALTER DNODE NK_INTEGER NK_STRING NK_STRING */
{ pCxt->pRootNode = createAlterDnodeStmt(pCxt, &yymsp[-2].minor.yy0, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); }
break;
- case 49: /* cmd ::= ALTER ALL DNODES NK_STRING */
+ case 52: /* cmd ::= ALTER ALL DNODES NK_STRING */
{ pCxt->pRootNode = createAlterDnodeStmt(pCxt, NULL, &yymsp[0].minor.yy0, NULL); }
break;
- case 50: /* cmd ::= ALTER ALL DNODES NK_STRING NK_STRING */
+ case 53: /* cmd ::= ALTER ALL DNODES NK_STRING NK_STRING */
{ pCxt->pRootNode = createAlterDnodeStmt(pCxt, NULL, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); }
break;
- case 51: /* dnode_endpoint ::= NK_STRING */
- case 52: /* dnode_endpoint ::= NK_ID */ yytestcase(yyruleno==52);
- case 53: /* dnode_endpoint ::= NK_IPTOKEN */ yytestcase(yyruleno==53);
- case 287: /* sma_func_name ::= COUNT */ yytestcase(yyruleno==287);
- case 288: /* sma_func_name ::= FIRST */ yytestcase(yyruleno==288);
- case 289: /* sma_func_name ::= LAST */ yytestcase(yyruleno==289);
- case 290: /* sma_func_name ::= LAST_ROW */ yytestcase(yyruleno==290);
- case 380: /* db_name ::= NK_ID */ yytestcase(yyruleno==380);
- case 381: /* table_name ::= NK_ID */ yytestcase(yyruleno==381);
- case 382: /* column_name ::= NK_ID */ yytestcase(yyruleno==382);
- case 383: /* function_name ::= NK_ID */ yytestcase(yyruleno==383);
- case 384: /* table_alias ::= NK_ID */ yytestcase(yyruleno==384);
- case 385: /* column_alias ::= NK_ID */ yytestcase(yyruleno==385);
- case 386: /* user_name ::= NK_ID */ yytestcase(yyruleno==386);
- case 387: /* topic_name ::= NK_ID */ yytestcase(yyruleno==387);
- case 388: /* stream_name ::= NK_ID */ yytestcase(yyruleno==388);
- case 389: /* cgroup_name ::= NK_ID */ yytestcase(yyruleno==389);
- case 390: /* index_name ::= NK_ID */ yytestcase(yyruleno==390);
- case 430: /* noarg_func ::= NOW */ yytestcase(yyruleno==430);
- case 431: /* noarg_func ::= TODAY */ yytestcase(yyruleno==431);
- case 432: /* noarg_func ::= TIMEZONE */ yytestcase(yyruleno==432);
- case 433: /* noarg_func ::= DATABASE */ yytestcase(yyruleno==433);
- case 434: /* noarg_func ::= CLIENT_VERSION */ yytestcase(yyruleno==434);
- case 435: /* noarg_func ::= SERVER_VERSION */ yytestcase(yyruleno==435);
- case 436: /* noarg_func ::= SERVER_STATUS */ yytestcase(yyruleno==436);
- case 437: /* noarg_func ::= CURRENT_USER */ yytestcase(yyruleno==437);
- case 438: /* noarg_func ::= USER */ yytestcase(yyruleno==438);
- case 439: /* star_func ::= COUNT */ yytestcase(yyruleno==439);
- case 440: /* star_func ::= FIRST */ yytestcase(yyruleno==440);
- case 441: /* star_func ::= LAST */ yytestcase(yyruleno==441);
- case 442: /* star_func ::= LAST_ROW */ yytestcase(yyruleno==442);
-{ yylhsminor.yy129 = yymsp[0].minor.yy0; }
- yymsp[0].minor.yy129 = yylhsminor.yy129;
+ case 54: /* dnode_endpoint ::= NK_STRING */
+ case 55: /* dnode_endpoint ::= NK_ID */ yytestcase(yyruleno==55);
+ case 56: /* dnode_endpoint ::= NK_IPTOKEN */ yytestcase(yyruleno==56);
+ case 289: /* sma_func_name ::= COUNT */ yytestcase(yyruleno==289);
+ case 290: /* sma_func_name ::= FIRST */ yytestcase(yyruleno==290);
+ case 291: /* sma_func_name ::= LAST */ yytestcase(yyruleno==291);
+ case 292: /* sma_func_name ::= LAST_ROW */ yytestcase(yyruleno==292);
+ case 382: /* db_name ::= NK_ID */ yytestcase(yyruleno==382);
+ case 383: /* table_name ::= NK_ID */ yytestcase(yyruleno==383);
+ case 384: /* column_name ::= NK_ID */ yytestcase(yyruleno==384);
+ case 385: /* function_name ::= NK_ID */ yytestcase(yyruleno==385);
+ case 386: /* table_alias ::= NK_ID */ yytestcase(yyruleno==386);
+ case 387: /* column_alias ::= NK_ID */ yytestcase(yyruleno==387);
+ case 388: /* user_name ::= NK_ID */ yytestcase(yyruleno==388);
+ case 389: /* topic_name ::= NK_ID */ yytestcase(yyruleno==389);
+ case 390: /* stream_name ::= NK_ID */ yytestcase(yyruleno==390);
+ case 391: /* cgroup_name ::= NK_ID */ yytestcase(yyruleno==391);
+ case 392: /* index_name ::= NK_ID */ yytestcase(yyruleno==392);
+ case 432: /* noarg_func ::= NOW */ yytestcase(yyruleno==432);
+ case 433: /* noarg_func ::= TODAY */ yytestcase(yyruleno==433);
+ case 434: /* noarg_func ::= TIMEZONE */ yytestcase(yyruleno==434);
+ case 435: /* noarg_func ::= DATABASE */ yytestcase(yyruleno==435);
+ case 436: /* noarg_func ::= CLIENT_VERSION */ yytestcase(yyruleno==436);
+ case 437: /* noarg_func ::= SERVER_VERSION */ yytestcase(yyruleno==437);
+ case 438: /* noarg_func ::= SERVER_STATUS */ yytestcase(yyruleno==438);
+ case 439: /* noarg_func ::= CURRENT_USER */ yytestcase(yyruleno==439);
+ case 440: /* noarg_func ::= USER */ yytestcase(yyruleno==440);
+ case 441: /* star_func ::= COUNT */ yytestcase(yyruleno==441);
+ case 442: /* star_func ::= FIRST */ yytestcase(yyruleno==442);
+ case 443: /* star_func ::= LAST */ yytestcase(yyruleno==443);
+ case 444: /* star_func ::= LAST_ROW */ yytestcase(yyruleno==444);
+{ yylhsminor.yy113 = yymsp[0].minor.yy0; }
+ yymsp[0].minor.yy113 = yylhsminor.yy113;
break;
- case 54: /* force_opt ::= */
- case 74: /* not_exists_opt ::= */ yytestcase(yyruleno==74);
- case 76: /* exists_opt ::= */ yytestcase(yyruleno==76);
- case 307: /* analyze_opt ::= */ yytestcase(yyruleno==307);
- case 314: /* agg_func_opt ::= */ yytestcase(yyruleno==314);
- case 320: /* or_replace_opt ::= */ yytestcase(yyruleno==320);
- case 503: /* set_quantifier_opt ::= */ yytestcase(yyruleno==503);
-{ yymsp[1].minor.yy337 = false; }
+ case 57: /* force_opt ::= */
+ case 77: /* not_exists_opt ::= */ yytestcase(yyruleno==77);
+ case 79: /* exists_opt ::= */ yytestcase(yyruleno==79);
+ case 309: /* analyze_opt ::= */ yytestcase(yyruleno==309);
+ case 316: /* agg_func_opt ::= */ yytestcase(yyruleno==316);
+ case 322: /* or_replace_opt ::= */ yytestcase(yyruleno==322);
+ case 505: /* set_quantifier_opt ::= */ yytestcase(yyruleno==505);
+{ yymsp[1].minor.yy369 = false; }
break;
- case 55: /* force_opt ::= FORCE */
- case 308: /* analyze_opt ::= ANALYZE */ yytestcase(yyruleno==308);
- case 315: /* agg_func_opt ::= AGGREGATE */ yytestcase(yyruleno==315);
- case 504: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==504);
-{ yymsp[0].minor.yy337 = true; }
+ case 58: /* force_opt ::= FORCE */
+ case 310: /* analyze_opt ::= ANALYZE */ yytestcase(yyruleno==310);
+ case 317: /* agg_func_opt ::= AGGREGATE */ yytestcase(yyruleno==317);
+ case 506: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==506);
+{ yymsp[0].minor.yy369 = true; }
break;
- case 56: /* cmd ::= ALTER LOCAL NK_STRING */
+ case 59: /* cmd ::= ALTER LOCAL NK_STRING */
{ pCxt->pRootNode = createAlterLocalStmt(pCxt, &yymsp[0].minor.yy0, NULL); }
break;
- case 57: /* cmd ::= ALTER LOCAL NK_STRING NK_STRING */
+ case 60: /* cmd ::= ALTER LOCAL NK_STRING NK_STRING */
{ pCxt->pRootNode = createAlterLocalStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); }
break;
- case 58: /* cmd ::= CREATE QNODE ON DNODE NK_INTEGER */
+ case 61: /* cmd ::= CREATE QNODE ON DNODE NK_INTEGER */
{ pCxt->pRootNode = createCreateComponentNodeStmt(pCxt, QUERY_NODE_CREATE_QNODE_STMT, &yymsp[0].minor.yy0); }
break;
- case 59: /* cmd ::= DROP QNODE ON DNODE NK_INTEGER */
+ case 62: /* cmd ::= DROP QNODE ON DNODE NK_INTEGER */
{ pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_QNODE_STMT, &yymsp[0].minor.yy0); }
break;
- case 60: /* cmd ::= CREATE BNODE ON DNODE NK_INTEGER */
+ case 63: /* cmd ::= CREATE BNODE ON DNODE NK_INTEGER */
{ pCxt->pRootNode = createCreateComponentNodeStmt(pCxt, QUERY_NODE_CREATE_BNODE_STMT, &yymsp[0].minor.yy0); }
break;
- case 61: /* cmd ::= DROP BNODE ON DNODE NK_INTEGER */
+ case 64: /* cmd ::= DROP BNODE ON DNODE NK_INTEGER */
{ pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_BNODE_STMT, &yymsp[0].minor.yy0); }
break;
- case 62: /* cmd ::= CREATE SNODE ON DNODE NK_INTEGER */
+ case 65: /* cmd ::= CREATE SNODE ON DNODE NK_INTEGER */
{ pCxt->pRootNode = createCreateComponentNodeStmt(pCxt, QUERY_NODE_CREATE_SNODE_STMT, &yymsp[0].minor.yy0); }
break;
- case 63: /* cmd ::= DROP SNODE ON DNODE NK_INTEGER */
+ case 66: /* cmd ::= DROP SNODE ON DNODE NK_INTEGER */
{ pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_SNODE_STMT, &yymsp[0].minor.yy0); }
break;
- case 64: /* cmd ::= CREATE MNODE ON DNODE NK_INTEGER */
+ case 67: /* cmd ::= CREATE MNODE ON DNODE NK_INTEGER */
{ pCxt->pRootNode = createCreateComponentNodeStmt(pCxt, QUERY_NODE_CREATE_MNODE_STMT, &yymsp[0].minor.yy0); }
break;
- case 65: /* cmd ::= DROP MNODE ON DNODE NK_INTEGER */
+ case 68: /* cmd ::= DROP MNODE ON DNODE NK_INTEGER */
{ pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_MNODE_STMT, &yymsp[0].minor.yy0); }
break;
- case 66: /* cmd ::= CREATE DATABASE not_exists_opt db_name db_options */
-{ pCxt->pRootNode = createCreateDatabaseStmt(pCxt, yymsp[-2].minor.yy337, &yymsp[-1].minor.yy129, yymsp[0].minor.yy712); }
+ case 69: /* cmd ::= CREATE DATABASE not_exists_opt db_name db_options */
+{ pCxt->pRootNode = createCreateDatabaseStmt(pCxt, yymsp[-2].minor.yy369, &yymsp[-1].minor.yy113, yymsp[0].minor.yy448); }
break;
- case 67: /* cmd ::= DROP DATABASE exists_opt db_name */
-{ pCxt->pRootNode = createDropDatabaseStmt(pCxt, yymsp[-1].minor.yy337, &yymsp[0].minor.yy129); }
+ case 70: /* cmd ::= DROP DATABASE exists_opt db_name */
+{ pCxt->pRootNode = createDropDatabaseStmt(pCxt, yymsp[-1].minor.yy369, &yymsp[0].minor.yy113); }
break;
- case 68: /* cmd ::= USE db_name */
-{ pCxt->pRootNode = createUseDatabaseStmt(pCxt, &yymsp[0].minor.yy129); }
+ case 71: /* cmd ::= USE db_name */
+{ pCxt->pRootNode = createUseDatabaseStmt(pCxt, &yymsp[0].minor.yy113); }
break;
- case 69: /* cmd ::= ALTER DATABASE db_name alter_db_options */
-{ pCxt->pRootNode = createAlterDatabaseStmt(pCxt, &yymsp[-1].minor.yy129, yymsp[0].minor.yy712); }
+ case 72: /* cmd ::= ALTER DATABASE db_name alter_db_options */
+{ pCxt->pRootNode = createAlterDatabaseStmt(pCxt, &yymsp[-1].minor.yy113, yymsp[0].minor.yy448); }
break;
- case 70: /* cmd ::= FLUSH DATABASE db_name */
-{ pCxt->pRootNode = createFlushDatabaseStmt(pCxt, &yymsp[0].minor.yy129); }
+ case 73: /* cmd ::= FLUSH DATABASE db_name */
+{ pCxt->pRootNode = createFlushDatabaseStmt(pCxt, &yymsp[0].minor.yy113); }
break;
- case 71: /* cmd ::= TRIM DATABASE db_name speed_opt */
-{ pCxt->pRootNode = createTrimDatabaseStmt(pCxt, &yymsp[-1].minor.yy129, yymsp[0].minor.yy310); }
+ case 74: /* cmd ::= TRIM DATABASE db_name speed_opt */
+{ pCxt->pRootNode = createTrimDatabaseStmt(pCxt, &yymsp[-1].minor.yy113, yymsp[0].minor.yy788); }
break;
- case 72: /* cmd ::= COMPACT DATABASE db_name start_opt end_opt */
-{ pCxt->pRootNode = createCompactStmt(pCxt, &yymsp[-2].minor.yy129, yymsp[-1].minor.yy712, yymsp[0].minor.yy712); }
+ case 75: /* cmd ::= COMPACT DATABASE db_name start_opt end_opt */
+{ pCxt->pRootNode = createCompactStmt(pCxt, &yymsp[-2].minor.yy113, yymsp[-1].minor.yy448, yymsp[0].minor.yy448); }
break;
- case 73: /* not_exists_opt ::= IF NOT EXISTS */
-{ yymsp[-2].minor.yy337 = true; }
+ case 76: /* not_exists_opt ::= IF NOT EXISTS */
+{ yymsp[-2].minor.yy369 = true; }
break;
- case 75: /* exists_opt ::= IF EXISTS */
- case 321: /* or_replace_opt ::= OR REPLACE */ yytestcase(yyruleno==321);
-{ yymsp[-1].minor.yy337 = true; }
+ case 78: /* exists_opt ::= IF EXISTS */
+ case 323: /* or_replace_opt ::= OR REPLACE */ yytestcase(yyruleno==323);
+{ yymsp[-1].minor.yy369 = true; }
break;
- case 77: /* db_options ::= */
-{ yymsp[1].minor.yy712 = createDefaultDatabaseOptions(pCxt); }
+ case 80: /* db_options ::= */
+{ yymsp[1].minor.yy448 = createDefaultDatabaseOptions(pCxt); }
break;
- case 78: /* db_options ::= db_options BUFFER NK_INTEGER */
-{ yylhsminor.yy712 = setDatabaseOption(pCxt, yymsp[-2].minor.yy712, DB_OPTION_BUFFER, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy712 = yylhsminor.yy712;
+ case 81: /* db_options ::= db_options BUFFER NK_INTEGER */
+{ yylhsminor.yy448 = setDatabaseOption(pCxt, yymsp[-2].minor.yy448, DB_OPTION_BUFFER, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy448 = yylhsminor.yy448;
break;
- case 79: /* db_options ::= db_options CACHEMODEL NK_STRING */
-{ yylhsminor.yy712 = setDatabaseOption(pCxt, yymsp[-2].minor.yy712, DB_OPTION_CACHEMODEL, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy712 = yylhsminor.yy712;
+ case 82: /* db_options ::= db_options CACHEMODEL NK_STRING */
+{ yylhsminor.yy448 = setDatabaseOption(pCxt, yymsp[-2].minor.yy448, DB_OPTION_CACHEMODEL, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy448 = yylhsminor.yy448;
break;
- case 80: /* db_options ::= db_options CACHESIZE NK_INTEGER */
-{ yylhsminor.yy712 = setDatabaseOption(pCxt, yymsp[-2].minor.yy712, DB_OPTION_CACHESIZE, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy712 = yylhsminor.yy712;
+ case 83: /* db_options ::= db_options CACHESIZE NK_INTEGER */
+{ yylhsminor.yy448 = setDatabaseOption(pCxt, yymsp[-2].minor.yy448, DB_OPTION_CACHESIZE, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy448 = yylhsminor.yy448;
break;
- case 81: /* db_options ::= db_options COMP NK_INTEGER */
-{ yylhsminor.yy712 = setDatabaseOption(pCxt, yymsp[-2].minor.yy712, DB_OPTION_COMP, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy712 = yylhsminor.yy712;
+ case 84: /* db_options ::= db_options COMP NK_INTEGER */
+{ yylhsminor.yy448 = setDatabaseOption(pCxt, yymsp[-2].minor.yy448, DB_OPTION_COMP, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy448 = yylhsminor.yy448;
break;
- case 82: /* db_options ::= db_options DURATION NK_INTEGER */
- case 83: /* db_options ::= db_options DURATION NK_VARIABLE */ yytestcase(yyruleno==83);
-{ yylhsminor.yy712 = setDatabaseOption(pCxt, yymsp[-2].minor.yy712, DB_OPTION_DAYS, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy712 = yylhsminor.yy712;
+ case 85: /* db_options ::= db_options DURATION NK_INTEGER */
+ case 86: /* db_options ::= db_options DURATION NK_VARIABLE */ yytestcase(yyruleno==86);
+{ yylhsminor.yy448 = setDatabaseOption(pCxt, yymsp[-2].minor.yy448, DB_OPTION_DAYS, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy448 = yylhsminor.yy448;
break;
- case 84: /* db_options ::= db_options MAXROWS NK_INTEGER */
-{ yylhsminor.yy712 = setDatabaseOption(pCxt, yymsp[-2].minor.yy712, DB_OPTION_MAXROWS, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy712 = yylhsminor.yy712;
+ case 87: /* db_options ::= db_options MAXROWS NK_INTEGER */
+{ yylhsminor.yy448 = setDatabaseOption(pCxt, yymsp[-2].minor.yy448, DB_OPTION_MAXROWS, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy448 = yylhsminor.yy448;
break;
- case 85: /* db_options ::= db_options MINROWS NK_INTEGER */
-{ yylhsminor.yy712 = setDatabaseOption(pCxt, yymsp[-2].minor.yy712, DB_OPTION_MINROWS, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy712 = yylhsminor.yy712;
+ case 88: /* db_options ::= db_options MINROWS NK_INTEGER */
+{ yylhsminor.yy448 = setDatabaseOption(pCxt, yymsp[-2].minor.yy448, DB_OPTION_MINROWS, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy448 = yylhsminor.yy448;
break;
- case 86: /* db_options ::= db_options KEEP integer_list */
- case 87: /* db_options ::= db_options KEEP variable_list */ yytestcase(yyruleno==87);
-{ yylhsminor.yy712 = setDatabaseOption(pCxt, yymsp[-2].minor.yy712, DB_OPTION_KEEP, yymsp[0].minor.yy274); }
- yymsp[-2].minor.yy712 = yylhsminor.yy712;
+ case 89: /* db_options ::= db_options KEEP integer_list */
+ case 90: /* db_options ::= db_options KEEP variable_list */ yytestcase(yyruleno==90);
+{ yylhsminor.yy448 = setDatabaseOption(pCxt, yymsp[-2].minor.yy448, DB_OPTION_KEEP, yymsp[0].minor.yy432); }
+ yymsp[-2].minor.yy448 = yylhsminor.yy448;
break;
- case 88: /* db_options ::= db_options PAGES NK_INTEGER */
-{ yylhsminor.yy712 = setDatabaseOption(pCxt, yymsp[-2].minor.yy712, DB_OPTION_PAGES, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy712 = yylhsminor.yy712;
+ case 91: /* db_options ::= db_options PAGES NK_INTEGER */
+{ yylhsminor.yy448 = setDatabaseOption(pCxt, yymsp[-2].minor.yy448, DB_OPTION_PAGES, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy448 = yylhsminor.yy448;
break;
- case 89: /* db_options ::= db_options PAGESIZE NK_INTEGER */
-{ yylhsminor.yy712 = setDatabaseOption(pCxt, yymsp[-2].minor.yy712, DB_OPTION_PAGESIZE, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy712 = yylhsminor.yy712;
+ case 92: /* db_options ::= db_options PAGESIZE NK_INTEGER */
+{ yylhsminor.yy448 = setDatabaseOption(pCxt, yymsp[-2].minor.yy448, DB_OPTION_PAGESIZE, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy448 = yylhsminor.yy448;
break;
- case 90: /* db_options ::= db_options TSDB_PAGESIZE NK_INTEGER */
-{ yylhsminor.yy712 = setDatabaseOption(pCxt, yymsp[-2].minor.yy712, DB_OPTION_TSDB_PAGESIZE, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy712 = yylhsminor.yy712;
+ case 93: /* db_options ::= db_options TSDB_PAGESIZE NK_INTEGER */
+{ yylhsminor.yy448 = setDatabaseOption(pCxt, yymsp[-2].minor.yy448, DB_OPTION_TSDB_PAGESIZE, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy448 = yylhsminor.yy448;
break;
- case 91: /* db_options ::= db_options PRECISION NK_STRING */
-{ yylhsminor.yy712 = setDatabaseOption(pCxt, yymsp[-2].minor.yy712, DB_OPTION_PRECISION, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy712 = yylhsminor.yy712;
+ case 94: /* db_options ::= db_options PRECISION NK_STRING */
+{ yylhsminor.yy448 = setDatabaseOption(pCxt, yymsp[-2].minor.yy448, DB_OPTION_PRECISION, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy448 = yylhsminor.yy448;
break;
- case 92: /* db_options ::= db_options REPLICA NK_INTEGER */
-{ yylhsminor.yy712 = setDatabaseOption(pCxt, yymsp[-2].minor.yy712, DB_OPTION_REPLICA, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy712 = yylhsminor.yy712;
+ case 95: /* db_options ::= db_options REPLICA NK_INTEGER */
+{ yylhsminor.yy448 = setDatabaseOption(pCxt, yymsp[-2].minor.yy448, DB_OPTION_REPLICA, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy448 = yylhsminor.yy448;
break;
- case 93: /* db_options ::= db_options VGROUPS NK_INTEGER */
-{ yylhsminor.yy712 = setDatabaseOption(pCxt, yymsp[-2].minor.yy712, DB_OPTION_VGROUPS, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy712 = yylhsminor.yy712;
+ case 96: /* db_options ::= db_options VGROUPS NK_INTEGER */
+{ yylhsminor.yy448 = setDatabaseOption(pCxt, yymsp[-2].minor.yy448, DB_OPTION_VGROUPS, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy448 = yylhsminor.yy448;
break;
- case 94: /* db_options ::= db_options SINGLE_STABLE NK_INTEGER */
-{ yylhsminor.yy712 = setDatabaseOption(pCxt, yymsp[-2].minor.yy712, DB_OPTION_SINGLE_STABLE, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy712 = yylhsminor.yy712;
+ case 97: /* db_options ::= db_options SINGLE_STABLE NK_INTEGER */
+{ yylhsminor.yy448 = setDatabaseOption(pCxt, yymsp[-2].minor.yy448, DB_OPTION_SINGLE_STABLE, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy448 = yylhsminor.yy448;
break;
- case 95: /* db_options ::= db_options RETENTIONS retention_list */
-{ yylhsminor.yy712 = setDatabaseOption(pCxt, yymsp[-2].minor.yy712, DB_OPTION_RETENTIONS, yymsp[0].minor.yy274); }
- yymsp[-2].minor.yy712 = yylhsminor.yy712;
+ case 98: /* db_options ::= db_options RETENTIONS retention_list */
+{ yylhsminor.yy448 = setDatabaseOption(pCxt, yymsp[-2].minor.yy448, DB_OPTION_RETENTIONS, yymsp[0].minor.yy432); }
+ yymsp[-2].minor.yy448 = yylhsminor.yy448;
break;
- case 96: /* db_options ::= db_options SCHEMALESS NK_INTEGER */
-{ yylhsminor.yy712 = setDatabaseOption(pCxt, yymsp[-2].minor.yy712, DB_OPTION_SCHEMALESS, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy712 = yylhsminor.yy712;
+ case 99: /* db_options ::= db_options SCHEMALESS NK_INTEGER */
+{ yylhsminor.yy448 = setDatabaseOption(pCxt, yymsp[-2].minor.yy448, DB_OPTION_SCHEMALESS, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy448 = yylhsminor.yy448;
break;
- case 97: /* db_options ::= db_options WAL_LEVEL NK_INTEGER */
-{ yylhsminor.yy712 = setDatabaseOption(pCxt, yymsp[-2].minor.yy712, DB_OPTION_WAL, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy712 = yylhsminor.yy712;
+ case 100: /* db_options ::= db_options WAL_LEVEL NK_INTEGER */
+{ yylhsminor.yy448 = setDatabaseOption(pCxt, yymsp[-2].minor.yy448, DB_OPTION_WAL, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy448 = yylhsminor.yy448;
break;
- case 98: /* db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER */
-{ yylhsminor.yy712 = setDatabaseOption(pCxt, yymsp[-2].minor.yy712, DB_OPTION_FSYNC, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy712 = yylhsminor.yy712;
+ case 101: /* db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER */
+{ yylhsminor.yy448 = setDatabaseOption(pCxt, yymsp[-2].minor.yy448, DB_OPTION_FSYNC, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy448 = yylhsminor.yy448;
break;
- case 99: /* db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER */
-{ yylhsminor.yy712 = setDatabaseOption(pCxt, yymsp[-2].minor.yy712, DB_OPTION_WAL_RETENTION_PERIOD, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy712 = yylhsminor.yy712;
+ case 102: /* db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER */
+{ yylhsminor.yy448 = setDatabaseOption(pCxt, yymsp[-2].minor.yy448, DB_OPTION_WAL_RETENTION_PERIOD, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy448 = yylhsminor.yy448;
break;
- case 100: /* db_options ::= db_options WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */
+ case 103: /* 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.yy712 = setDatabaseOption(pCxt, yymsp[-3].minor.yy712, DB_OPTION_WAL_RETENTION_PERIOD, &t);
+ yylhsminor.yy448 = setDatabaseOption(pCxt, yymsp[-3].minor.yy448, DB_OPTION_WAL_RETENTION_PERIOD, &t);
}
- yymsp[-3].minor.yy712 = yylhsminor.yy712;
+ yymsp[-3].minor.yy448 = yylhsminor.yy448;
break;
- case 101: /* db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER */
-{ yylhsminor.yy712 = setDatabaseOption(pCxt, yymsp[-2].minor.yy712, DB_OPTION_WAL_RETENTION_SIZE, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy712 = yylhsminor.yy712;
+ case 104: /* db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER */
+{ yylhsminor.yy448 = setDatabaseOption(pCxt, yymsp[-2].minor.yy448, DB_OPTION_WAL_RETENTION_SIZE, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy448 = yylhsminor.yy448;
break;
- case 102: /* db_options ::= db_options WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */
+ case 105: /* 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.yy712 = setDatabaseOption(pCxt, yymsp[-3].minor.yy712, DB_OPTION_WAL_RETENTION_SIZE, &t);
+ yylhsminor.yy448 = setDatabaseOption(pCxt, yymsp[-3].minor.yy448, DB_OPTION_WAL_RETENTION_SIZE, &t);
}
- yymsp[-3].minor.yy712 = yylhsminor.yy712;
+ yymsp[-3].minor.yy448 = yylhsminor.yy448;
break;
- case 103: /* db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER */
-{ yylhsminor.yy712 = setDatabaseOption(pCxt, yymsp[-2].minor.yy712, DB_OPTION_WAL_ROLL_PERIOD, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy712 = yylhsminor.yy712;
+ case 106: /* db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER */
+{ yylhsminor.yy448 = setDatabaseOption(pCxt, yymsp[-2].minor.yy448, DB_OPTION_WAL_ROLL_PERIOD, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy448 = yylhsminor.yy448;
break;
- case 104: /* db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER */
-{ yylhsminor.yy712 = setDatabaseOption(pCxt, yymsp[-2].minor.yy712, DB_OPTION_WAL_SEGMENT_SIZE, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy712 = yylhsminor.yy712;
+ case 107: /* db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER */
+{ yylhsminor.yy448 = setDatabaseOption(pCxt, yymsp[-2].minor.yy448, DB_OPTION_WAL_SEGMENT_SIZE, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy448 = yylhsminor.yy448;
break;
- case 105: /* db_options ::= db_options STT_TRIGGER NK_INTEGER */
-{ yylhsminor.yy712 = setDatabaseOption(pCxt, yymsp[-2].minor.yy712, DB_OPTION_STT_TRIGGER, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy712 = yylhsminor.yy712;
+ case 108: /* db_options ::= db_options STT_TRIGGER NK_INTEGER */
+{ yylhsminor.yy448 = setDatabaseOption(pCxt, yymsp[-2].minor.yy448, DB_OPTION_STT_TRIGGER, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy448 = yylhsminor.yy448;
break;
- case 106: /* db_options ::= db_options TABLE_PREFIX NK_INTEGER */
-{ yylhsminor.yy712 = setDatabaseOption(pCxt, yymsp[-2].minor.yy712, DB_OPTION_TABLE_PREFIX, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy712 = yylhsminor.yy712;
+ case 109: /* db_options ::= db_options TABLE_PREFIX NK_INTEGER */
+{ yylhsminor.yy448 = setDatabaseOption(pCxt, yymsp[-2].minor.yy448, DB_OPTION_TABLE_PREFIX, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy448 = yylhsminor.yy448;
break;
- case 107: /* db_options ::= db_options TABLE_SUFFIX NK_INTEGER */
-{ yylhsminor.yy712 = setDatabaseOption(pCxt, yymsp[-2].minor.yy712, DB_OPTION_TABLE_SUFFIX, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy712 = yylhsminor.yy712;
+ case 110: /* db_options ::= db_options TABLE_SUFFIX NK_INTEGER */
+{ yylhsminor.yy448 = setDatabaseOption(pCxt, yymsp[-2].minor.yy448, DB_OPTION_TABLE_SUFFIX, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy448 = yylhsminor.yy448;
break;
- case 108: /* alter_db_options ::= alter_db_option */
-{ yylhsminor.yy712 = createAlterDatabaseOptions(pCxt); yylhsminor.yy712 = setAlterDatabaseOption(pCxt, yylhsminor.yy712, &yymsp[0].minor.yy595); }
- yymsp[0].minor.yy712 = yylhsminor.yy712;
+ case 111: /* alter_db_options ::= alter_db_option */
+{ yylhsminor.yy448 = createAlterDatabaseOptions(pCxt); yylhsminor.yy448 = setAlterDatabaseOption(pCxt, yylhsminor.yy448, &yymsp[0].minor.yy53); }
+ yymsp[0].minor.yy448 = yylhsminor.yy448;
break;
- case 109: /* alter_db_options ::= alter_db_options alter_db_option */
-{ yylhsminor.yy712 = setAlterDatabaseOption(pCxt, yymsp[-1].minor.yy712, &yymsp[0].minor.yy595); }
- yymsp[-1].minor.yy712 = yylhsminor.yy712;
+ case 112: /* alter_db_options ::= alter_db_options alter_db_option */
+{ yylhsminor.yy448 = setAlterDatabaseOption(pCxt, yymsp[-1].minor.yy448, &yymsp[0].minor.yy53); }
+ yymsp[-1].minor.yy448 = yylhsminor.yy448;
break;
- case 110: /* alter_db_option ::= BUFFER NK_INTEGER */
-{ yymsp[-1].minor.yy595.type = DB_OPTION_BUFFER; yymsp[-1].minor.yy595.val = yymsp[0].minor.yy0; }
+ case 113: /* alter_db_option ::= BUFFER NK_INTEGER */
+{ yymsp[-1].minor.yy53.type = DB_OPTION_BUFFER; yymsp[-1].minor.yy53.val = yymsp[0].minor.yy0; }
break;
- case 111: /* alter_db_option ::= CACHEMODEL NK_STRING */
-{ yymsp[-1].minor.yy595.type = DB_OPTION_CACHEMODEL; yymsp[-1].minor.yy595.val = yymsp[0].minor.yy0; }
+ case 114: /* alter_db_option ::= CACHEMODEL NK_STRING */
+{ yymsp[-1].minor.yy53.type = DB_OPTION_CACHEMODEL; yymsp[-1].minor.yy53.val = yymsp[0].minor.yy0; }
break;
- case 112: /* alter_db_option ::= CACHESIZE NK_INTEGER */
-{ yymsp[-1].minor.yy595.type = DB_OPTION_CACHESIZE; yymsp[-1].minor.yy595.val = yymsp[0].minor.yy0; }
+ case 115: /* alter_db_option ::= CACHESIZE NK_INTEGER */
+{ yymsp[-1].minor.yy53.type = DB_OPTION_CACHESIZE; yymsp[-1].minor.yy53.val = yymsp[0].minor.yy0; }
break;
- case 113: /* alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER */
-{ yymsp[-1].minor.yy595.type = DB_OPTION_FSYNC; yymsp[-1].minor.yy595.val = yymsp[0].minor.yy0; }
+ case 116: /* alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER */
+{ yymsp[-1].minor.yy53.type = DB_OPTION_FSYNC; yymsp[-1].minor.yy53.val = yymsp[0].minor.yy0; }
break;
- case 114: /* alter_db_option ::= KEEP integer_list */
- case 115: /* alter_db_option ::= KEEP variable_list */ yytestcase(yyruleno==115);
-{ yymsp[-1].minor.yy595.type = DB_OPTION_KEEP; yymsp[-1].minor.yy595.pList = yymsp[0].minor.yy274; }
+ case 117: /* alter_db_option ::= KEEP integer_list */
+ case 118: /* alter_db_option ::= KEEP variable_list */ yytestcase(yyruleno==118);
+{ yymsp[-1].minor.yy53.type = DB_OPTION_KEEP; yymsp[-1].minor.yy53.pList = yymsp[0].minor.yy432; }
break;
- case 116: /* alter_db_option ::= PAGES NK_INTEGER */
-{ yymsp[-1].minor.yy595.type = DB_OPTION_PAGES; yymsp[-1].minor.yy595.val = yymsp[0].minor.yy0; }
+ case 119: /* alter_db_option ::= PAGES NK_INTEGER */
+{ yymsp[-1].minor.yy53.type = DB_OPTION_PAGES; yymsp[-1].minor.yy53.val = yymsp[0].minor.yy0; }
break;
- case 117: /* alter_db_option ::= REPLICA NK_INTEGER */
-{ yymsp[-1].minor.yy595.type = DB_OPTION_REPLICA; yymsp[-1].minor.yy595.val = yymsp[0].minor.yy0; }
+ case 120: /* alter_db_option ::= REPLICA NK_INTEGER */
+{ yymsp[-1].minor.yy53.type = DB_OPTION_REPLICA; yymsp[-1].minor.yy53.val = yymsp[0].minor.yy0; }
break;
- case 118: /* alter_db_option ::= WAL_LEVEL NK_INTEGER */
-{ yymsp[-1].minor.yy595.type = DB_OPTION_WAL; yymsp[-1].minor.yy595.val = yymsp[0].minor.yy0; }
+ case 121: /* alter_db_option ::= WAL_LEVEL NK_INTEGER */
+{ yymsp[-1].minor.yy53.type = DB_OPTION_WAL; yymsp[-1].minor.yy53.val = yymsp[0].minor.yy0; }
break;
- case 119: /* alter_db_option ::= STT_TRIGGER NK_INTEGER */
-{ yymsp[-1].minor.yy595.type = DB_OPTION_STT_TRIGGER; yymsp[-1].minor.yy595.val = yymsp[0].minor.yy0; }
+ case 122: /* alter_db_option ::= STT_TRIGGER NK_INTEGER */
+{ yymsp[-1].minor.yy53.type = DB_OPTION_STT_TRIGGER; yymsp[-1].minor.yy53.val = yymsp[0].minor.yy0; }
break;
- case 120: /* alter_db_option ::= MINROWS NK_INTEGER */
-{ yymsp[-1].minor.yy595.type = DB_OPTION_MINROWS; yymsp[-1].minor.yy595.val = yymsp[0].minor.yy0; }
+ case 123: /* alter_db_option ::= MINROWS NK_INTEGER */
+{ yymsp[-1].minor.yy53.type = DB_OPTION_MINROWS; yymsp[-1].minor.yy53.val = yymsp[0].minor.yy0; }
break;
- case 121: /* alter_db_option ::= WAL_RETENTION_PERIOD NK_INTEGER */
-{ yymsp[-1].minor.yy595.type = DB_OPTION_WAL_RETENTION_PERIOD; yymsp[-1].minor.yy595.val = yymsp[0].minor.yy0; }
+ case 124: /* alter_db_option ::= WAL_RETENTION_PERIOD NK_INTEGER */
+{ yymsp[-1].minor.yy53.type = DB_OPTION_WAL_RETENTION_PERIOD; yymsp[-1].minor.yy53.val = yymsp[0].minor.yy0; }
break;
- case 122: /* alter_db_option ::= WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */
+ case 125: /* alter_db_option ::= 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;
- yymsp[-2].minor.yy595.type = DB_OPTION_WAL_RETENTION_PERIOD; yymsp[-2].minor.yy595.val = t;
+ yymsp[-2].minor.yy53.type = DB_OPTION_WAL_RETENTION_PERIOD; yymsp[-2].minor.yy53.val = t;
}
break;
- case 123: /* alter_db_option ::= WAL_RETENTION_SIZE NK_INTEGER */
-{ yymsp[-1].minor.yy595.type = DB_OPTION_WAL_RETENTION_SIZE; yymsp[-1].minor.yy595.val = yymsp[0].minor.yy0; }
+ case 126: /* alter_db_option ::= WAL_RETENTION_SIZE NK_INTEGER */
+{ yymsp[-1].minor.yy53.type = DB_OPTION_WAL_RETENTION_SIZE; yymsp[-1].minor.yy53.val = yymsp[0].minor.yy0; }
break;
- case 124: /* alter_db_option ::= WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */
+ case 127: /* alter_db_option ::= 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;
- yymsp[-2].minor.yy595.type = DB_OPTION_WAL_RETENTION_SIZE; yymsp[-2].minor.yy595.val = t;
+ yymsp[-2].minor.yy53.type = DB_OPTION_WAL_RETENTION_SIZE; yymsp[-2].minor.yy53.val = t;
}
break;
- case 125: /* integer_list ::= NK_INTEGER */
-{ yylhsminor.yy274 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); }
- yymsp[0].minor.yy274 = yylhsminor.yy274;
- break;
- case 126: /* integer_list ::= integer_list NK_COMMA NK_INTEGER */
- case 349: /* dnode_list ::= dnode_list DNODE NK_INTEGER */ yytestcase(yyruleno==349);
-{ yylhsminor.yy274 = addNodeToList(pCxt, yymsp[-2].minor.yy274, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); }
- yymsp[-2].minor.yy274 = yylhsminor.yy274;
- break;
- case 127: /* variable_list ::= NK_VARIABLE */
-{ yylhsminor.yy274 = createNodeList(pCxt, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); }
- yymsp[0].minor.yy274 = yylhsminor.yy274;
- break;
- case 128: /* variable_list ::= variable_list NK_COMMA NK_VARIABLE */
-{ yylhsminor.yy274 = addNodeToList(pCxt, yymsp[-2].minor.yy274, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); }
- yymsp[-2].minor.yy274 = yylhsminor.yy274;
- break;
- case 129: /* retention_list ::= retention */
- case 159: /* multi_create_clause ::= create_subtable_clause */ yytestcase(yyruleno==159);
- case 162: /* multi_drop_clause ::= drop_table_clause */ yytestcase(yyruleno==162);
- case 169: /* column_def_list ::= column_def */ yytestcase(yyruleno==169);
- case 213: /* rollup_func_list ::= rollup_func_name */ yytestcase(yyruleno==213);
- case 218: /* col_name_list ::= col_name */ yytestcase(yyruleno==218);
- case 269: /* tag_list_opt ::= tag_item */ yytestcase(yyruleno==269);
- case 283: /* func_list ::= func */ yytestcase(yyruleno==283);
- case 378: /* literal_list ::= signed_literal */ yytestcase(yyruleno==378);
- case 445: /* other_para_list ::= star_func_para */ yytestcase(yyruleno==445);
- case 451: /* when_then_list ::= when_then_expr */ yytestcase(yyruleno==451);
- case 506: /* select_list ::= select_item */ yytestcase(yyruleno==506);
- case 517: /* partition_list ::= partition_item */ yytestcase(yyruleno==517);
- case 572: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==572);
-{ yylhsminor.yy274 = createNodeList(pCxt, yymsp[0].minor.yy712); }
- yymsp[0].minor.yy274 = yylhsminor.yy274;
- break;
- case 130: /* retention_list ::= retention_list NK_COMMA retention */
- case 163: /* multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause */ yytestcase(yyruleno==163);
- case 170: /* column_def_list ::= column_def_list NK_COMMA column_def */ yytestcase(yyruleno==170);
- case 214: /* rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ yytestcase(yyruleno==214);
- case 219: /* col_name_list ::= col_name_list NK_COMMA col_name */ yytestcase(yyruleno==219);
- case 270: /* tag_list_opt ::= tag_list_opt NK_COMMA tag_item */ yytestcase(yyruleno==270);
- case 284: /* func_list ::= func_list NK_COMMA func */ yytestcase(yyruleno==284);
- case 379: /* literal_list ::= literal_list NK_COMMA signed_literal */ yytestcase(yyruleno==379);
- case 446: /* other_para_list ::= other_para_list NK_COMMA star_func_para */ yytestcase(yyruleno==446);
- case 507: /* select_list ::= select_list NK_COMMA select_item */ yytestcase(yyruleno==507);
- case 518: /* partition_list ::= partition_list NK_COMMA partition_item */ yytestcase(yyruleno==518);
- case 573: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==573);
-{ yylhsminor.yy274 = addNodeToList(pCxt, yymsp[-2].minor.yy274, yymsp[0].minor.yy712); }
- yymsp[-2].minor.yy274 = yylhsminor.yy274;
- break;
- case 131: /* retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */
-{ yylhsminor.yy712 = createNodeListNodeEx(pCxt, createDurationValueNode(pCxt, &yymsp[-2].minor.yy0), createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); }
- yymsp[-2].minor.yy712 = yylhsminor.yy712;
- break;
- case 132: /* speed_opt ::= */
- case 316: /* bufsize_opt ::= */ yytestcase(yyruleno==316);
-{ yymsp[1].minor.yy310 = 0; }
- break;
- case 133: /* speed_opt ::= MAX_SPEED NK_INTEGER */
- case 317: /* bufsize_opt ::= BUFSIZE NK_INTEGER */ yytestcase(yyruleno==317);
-{ yymsp[-1].minor.yy310 = taosStr2Int32(yymsp[0].minor.yy0.z, NULL, 10); }
- break;
- case 134: /* start_opt ::= */
- case 138: /* end_opt ::= */ yytestcase(yyruleno==138);
- case 263: /* like_pattern_opt ::= */ yytestcase(yyruleno==263);
- case 338: /* subtable_opt ::= */ yytestcase(yyruleno==338);
- case 454: /* case_when_else_opt ::= */ yytestcase(yyruleno==454);
- case 484: /* from_clause_opt ::= */ yytestcase(yyruleno==484);
- case 513: /* where_clause_opt ::= */ yytestcase(yyruleno==513);
- case 522: /* twindow_clause_opt ::= */ yytestcase(yyruleno==522);
- case 528: /* sliding_opt ::= */ yytestcase(yyruleno==528);
- case 530: /* fill_opt ::= */ yytestcase(yyruleno==530);
- case 544: /* having_clause_opt ::= */ yytestcase(yyruleno==544);
- case 546: /* range_opt ::= */ yytestcase(yyruleno==546);
- case 548: /* every_opt ::= */ yytestcase(yyruleno==548);
- case 561: /* slimit_clause_opt ::= */ yytestcase(yyruleno==561);
- case 565: /* limit_clause_opt ::= */ yytestcase(yyruleno==565);
-{ yymsp[1].minor.yy712 = NULL; }
- break;
- case 135: /* start_opt ::= START WITH NK_INTEGER */
- case 139: /* end_opt ::= END WITH NK_INTEGER */ yytestcase(yyruleno==139);
-{ yymsp[-2].minor.yy712 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); }
- break;
- case 136: /* start_opt ::= START WITH NK_STRING */
- case 140: /* end_opt ::= END WITH NK_STRING */ yytestcase(yyruleno==140);
-{ yymsp[-2].minor.yy712 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); }
- break;
- case 137: /* start_opt ::= START WITH TIMESTAMP NK_STRING */
- case 141: /* end_opt ::= END WITH TIMESTAMP NK_STRING */ yytestcase(yyruleno==141);
-{ yymsp[-3].minor.yy712 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); }
- break;
- case 142: /* cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */
- case 144: /* cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ yytestcase(yyruleno==144);
-{ pCxt->pRootNode = createCreateTableStmt(pCxt, yymsp[-6].minor.yy337, yymsp[-5].minor.yy712, yymsp[-3].minor.yy274, yymsp[-1].minor.yy274, yymsp[0].minor.yy712); }
- break;
- case 143: /* cmd ::= CREATE TABLE multi_create_clause */
-{ pCxt->pRootNode = createCreateMultiTableStmt(pCxt, yymsp[0].minor.yy274); }
- break;
- case 145: /* cmd ::= DROP TABLE multi_drop_clause */
-{ pCxt->pRootNode = createDropTableStmt(pCxt, yymsp[0].minor.yy274); }
- break;
- case 146: /* cmd ::= DROP STABLE exists_opt full_table_name */
-{ pCxt->pRootNode = createDropSuperTableStmt(pCxt, yymsp[-1].minor.yy337, yymsp[0].minor.yy712); }
- break;
- case 147: /* cmd ::= ALTER TABLE alter_table_clause */
- case 351: /* cmd ::= query_or_subquery */ yytestcase(yyruleno==351);
- case 352: /* cmd ::= insert_query */ yytestcase(yyruleno==352);
-{ pCxt->pRootNode = yymsp[0].minor.yy712; }
- break;
- case 148: /* cmd ::= ALTER STABLE alter_table_clause */
-{ pCxt->pRootNode = setAlterSuperTableType(yymsp[0].minor.yy712); }
- break;
- case 149: /* alter_table_clause ::= full_table_name alter_table_options */
-{ yylhsminor.yy712 = createAlterTableModifyOptions(pCxt, yymsp[-1].minor.yy712, yymsp[0].minor.yy712); }
- yymsp[-1].minor.yy712 = yylhsminor.yy712;
- break;
- case 150: /* alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */
-{ yylhsminor.yy712 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy712, TSDB_ALTER_TABLE_ADD_COLUMN, &yymsp[-1].minor.yy129, yymsp[0].minor.yy184); }
- yymsp[-4].minor.yy712 = yylhsminor.yy712;
- break;
- case 151: /* alter_table_clause ::= full_table_name DROP COLUMN column_name */
-{ yylhsminor.yy712 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy712, TSDB_ALTER_TABLE_DROP_COLUMN, &yymsp[0].minor.yy129); }
- yymsp[-3].minor.yy712 = yylhsminor.yy712;
- break;
- case 152: /* alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */
-{ yylhsminor.yy712 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy712, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, &yymsp[-1].minor.yy129, yymsp[0].minor.yy184); }
- yymsp[-4].minor.yy712 = yylhsminor.yy712;
- break;
- case 153: /* alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */
-{ yylhsminor.yy712 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy712, TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, &yymsp[-1].minor.yy129, &yymsp[0].minor.yy129); }
- yymsp[-4].minor.yy712 = yylhsminor.yy712;
- break;
- case 154: /* alter_table_clause ::= full_table_name ADD TAG column_name type_name */
-{ yylhsminor.yy712 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy712, TSDB_ALTER_TABLE_ADD_TAG, &yymsp[-1].minor.yy129, yymsp[0].minor.yy184); }
- yymsp[-4].minor.yy712 = yylhsminor.yy712;
- break;
- case 155: /* alter_table_clause ::= full_table_name DROP TAG column_name */
-{ yylhsminor.yy712 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy712, TSDB_ALTER_TABLE_DROP_TAG, &yymsp[0].minor.yy129); }
- yymsp[-3].minor.yy712 = yylhsminor.yy712;
- break;
- case 156: /* alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */
-{ yylhsminor.yy712 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy712, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, &yymsp[-1].minor.yy129, yymsp[0].minor.yy184); }
- yymsp[-4].minor.yy712 = yylhsminor.yy712;
- break;
- case 157: /* alter_table_clause ::= full_table_name RENAME TAG column_name column_name */
-{ yylhsminor.yy712 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy712, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &yymsp[-1].minor.yy129, &yymsp[0].minor.yy129); }
- yymsp[-4].minor.yy712 = yylhsminor.yy712;
+ case 128: /* integer_list ::= NK_INTEGER */
+{ yylhsminor.yy432 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy432 = yylhsminor.yy432;
+ break;
+ case 129: /* integer_list ::= integer_list NK_COMMA NK_INTEGER */
+ case 351: /* dnode_list ::= dnode_list DNODE NK_INTEGER */ yytestcase(yyruleno==351);
+{ yylhsminor.yy432 = addNodeToList(pCxt, yymsp[-2].minor.yy432, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); }
+ yymsp[-2].minor.yy432 = yylhsminor.yy432;
+ break;
+ case 130: /* variable_list ::= NK_VARIABLE */
+{ yylhsminor.yy432 = createNodeList(pCxt, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy432 = yylhsminor.yy432;
+ break;
+ case 131: /* variable_list ::= variable_list NK_COMMA NK_VARIABLE */
+{ yylhsminor.yy432 = addNodeToList(pCxt, yymsp[-2].minor.yy432, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); }
+ yymsp[-2].minor.yy432 = yylhsminor.yy432;
+ break;
+ case 132: /* retention_list ::= retention */
+ case 162: /* multi_create_clause ::= create_subtable_clause */ yytestcase(yyruleno==162);
+ case 165: /* multi_drop_clause ::= drop_table_clause */ yytestcase(yyruleno==165);
+ case 172: /* column_def_list ::= column_def */ yytestcase(yyruleno==172);
+ case 215: /* rollup_func_list ::= rollup_func_name */ yytestcase(yyruleno==215);
+ case 220: /* col_name_list ::= col_name */ yytestcase(yyruleno==220);
+ case 271: /* tag_list_opt ::= tag_item */ yytestcase(yyruleno==271);
+ case 285: /* func_list ::= func */ yytestcase(yyruleno==285);
+ case 380: /* literal_list ::= signed_literal */ yytestcase(yyruleno==380);
+ case 447: /* other_para_list ::= star_func_para */ yytestcase(yyruleno==447);
+ case 453: /* when_then_list ::= when_then_expr */ yytestcase(yyruleno==453);
+ case 508: /* select_list ::= select_item */ yytestcase(yyruleno==508);
+ case 519: /* partition_list ::= partition_item */ yytestcase(yyruleno==519);
+ case 574: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==574);
+{ yylhsminor.yy432 = createNodeList(pCxt, yymsp[0].minor.yy448); }
+ yymsp[0].minor.yy432 = yylhsminor.yy432;
+ break;
+ case 133: /* retention_list ::= retention_list NK_COMMA retention */
+ case 166: /* multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause */ yytestcase(yyruleno==166);
+ case 173: /* column_def_list ::= column_def_list NK_COMMA column_def */ yytestcase(yyruleno==173);
+ case 216: /* rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ yytestcase(yyruleno==216);
+ case 221: /* col_name_list ::= col_name_list NK_COMMA col_name */ yytestcase(yyruleno==221);
+ case 272: /* tag_list_opt ::= tag_list_opt NK_COMMA tag_item */ yytestcase(yyruleno==272);
+ case 286: /* func_list ::= func_list NK_COMMA func */ yytestcase(yyruleno==286);
+ case 381: /* literal_list ::= literal_list NK_COMMA signed_literal */ yytestcase(yyruleno==381);
+ case 448: /* other_para_list ::= other_para_list NK_COMMA star_func_para */ yytestcase(yyruleno==448);
+ case 509: /* select_list ::= select_list NK_COMMA select_item */ yytestcase(yyruleno==509);
+ case 520: /* partition_list ::= partition_list NK_COMMA partition_item */ yytestcase(yyruleno==520);
+ case 575: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==575);
+{ yylhsminor.yy432 = addNodeToList(pCxt, yymsp[-2].minor.yy432, yymsp[0].minor.yy448); }
+ yymsp[-2].minor.yy432 = yylhsminor.yy432;
+ break;
+ case 134: /* retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */
+{ yylhsminor.yy448 = createNodeListNodeEx(pCxt, createDurationValueNode(pCxt, &yymsp[-2].minor.yy0), createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); }
+ yymsp[-2].minor.yy448 = yylhsminor.yy448;
+ break;
+ case 135: /* speed_opt ::= */
+ case 318: /* bufsize_opt ::= */ yytestcase(yyruleno==318);
+{ yymsp[1].minor.yy788 = 0; }
+ break;
+ case 136: /* speed_opt ::= MAX_SPEED NK_INTEGER */
+ case 319: /* bufsize_opt ::= BUFSIZE NK_INTEGER */ yytestcase(yyruleno==319);
+{ yymsp[-1].minor.yy788 = taosStr2Int32(yymsp[0].minor.yy0.z, NULL, 10); }
+ break;
+ case 138: /* start_opt ::= START WITH NK_INTEGER */
+ case 142: /* end_opt ::= END WITH NK_INTEGER */ yytestcase(yyruleno==142);
+{ yymsp[-2].minor.yy448 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); }
+ break;
+ case 139: /* start_opt ::= START WITH NK_STRING */
+ case 143: /* end_opt ::= END WITH NK_STRING */ yytestcase(yyruleno==143);
+{ yymsp[-2].minor.yy448 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); }
+ break;
+ case 140: /* start_opt ::= START WITH TIMESTAMP NK_STRING */
+ case 144: /* end_opt ::= END WITH TIMESTAMP NK_STRING */ yytestcase(yyruleno==144);
+{ yymsp[-3].minor.yy448 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); }
+ break;
+ case 145: /* cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */
+ case 147: /* cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ yytestcase(yyruleno==147);
+{ pCxt->pRootNode = createCreateTableStmt(pCxt, yymsp[-6].minor.yy369, yymsp[-5].minor.yy448, yymsp[-3].minor.yy432, yymsp[-1].minor.yy432, yymsp[0].minor.yy448); }
+ break;
+ case 146: /* cmd ::= CREATE TABLE multi_create_clause */
+{ pCxt->pRootNode = createCreateMultiTableStmt(pCxt, yymsp[0].minor.yy432); }
+ break;
+ case 148: /* cmd ::= DROP TABLE multi_drop_clause */
+{ pCxt->pRootNode = createDropTableStmt(pCxt, yymsp[0].minor.yy432); }
+ break;
+ case 149: /* cmd ::= DROP STABLE exists_opt full_table_name */
+{ pCxt->pRootNode = createDropSuperTableStmt(pCxt, yymsp[-1].minor.yy369, yymsp[0].minor.yy448); }
+ break;
+ case 150: /* cmd ::= ALTER TABLE alter_table_clause */
+ case 353: /* cmd ::= query_or_subquery */ yytestcase(yyruleno==353);
+ case 354: /* cmd ::= insert_query */ yytestcase(yyruleno==354);
+{ pCxt->pRootNode = yymsp[0].minor.yy448; }
+ break;
+ case 151: /* cmd ::= ALTER STABLE alter_table_clause */
+{ pCxt->pRootNode = setAlterSuperTableType(yymsp[0].minor.yy448); }
+ break;
+ case 152: /* alter_table_clause ::= full_table_name alter_table_options */
+{ yylhsminor.yy448 = createAlterTableModifyOptions(pCxt, yymsp[-1].minor.yy448, yymsp[0].minor.yy448); }
+ yymsp[-1].minor.yy448 = yylhsminor.yy448;
+ break;
+ case 153: /* alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */
+{ yylhsminor.yy448 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy448, TSDB_ALTER_TABLE_ADD_COLUMN, &yymsp[-1].minor.yy113, yymsp[0].minor.yy728); }
+ yymsp[-4].minor.yy448 = yylhsminor.yy448;
+ break;
+ case 154: /* alter_table_clause ::= full_table_name DROP COLUMN column_name */
+{ yylhsminor.yy448 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy448, TSDB_ALTER_TABLE_DROP_COLUMN, &yymsp[0].minor.yy113); }
+ yymsp[-3].minor.yy448 = yylhsminor.yy448;
+ break;
+ case 155: /* alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */
+{ yylhsminor.yy448 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy448, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, &yymsp[-1].minor.yy113, yymsp[0].minor.yy728); }
+ yymsp[-4].minor.yy448 = yylhsminor.yy448;
+ break;
+ case 156: /* alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */
+{ yylhsminor.yy448 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy448, TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, &yymsp[-1].minor.yy113, &yymsp[0].minor.yy113); }
+ yymsp[-4].minor.yy448 = yylhsminor.yy448;
+ break;
+ case 157: /* alter_table_clause ::= full_table_name ADD TAG column_name type_name */
+{ yylhsminor.yy448 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy448, TSDB_ALTER_TABLE_ADD_TAG, &yymsp[-1].minor.yy113, yymsp[0].minor.yy728); }
+ yymsp[-4].minor.yy448 = yylhsminor.yy448;
+ break;
+ case 158: /* alter_table_clause ::= full_table_name DROP TAG column_name */
+{ yylhsminor.yy448 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy448, TSDB_ALTER_TABLE_DROP_TAG, &yymsp[0].minor.yy113); }
+ yymsp[-3].minor.yy448 = yylhsminor.yy448;
+ break;
+ case 159: /* alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */
+{ yylhsminor.yy448 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy448, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, &yymsp[-1].minor.yy113, yymsp[0].minor.yy728); }
+ yymsp[-4].minor.yy448 = yylhsminor.yy448;
+ break;
+ case 160: /* alter_table_clause ::= full_table_name RENAME TAG column_name column_name */
+{ yylhsminor.yy448 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy448, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &yymsp[-1].minor.yy113, &yymsp[0].minor.yy113); }
+ yymsp[-4].minor.yy448 = yylhsminor.yy448;
break;
- case 158: /* alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */
-{ yylhsminor.yy712 = createAlterTableSetTag(pCxt, yymsp[-5].minor.yy712, &yymsp[-2].minor.yy129, yymsp[0].minor.yy712); }
- yymsp[-5].minor.yy712 = yylhsminor.yy712;
+ case 161: /* alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */
+{ yylhsminor.yy448 = createAlterTableSetTag(pCxt, yymsp[-5].minor.yy448, &yymsp[-2].minor.yy113, yymsp[0].minor.yy448); }
+ yymsp[-5].minor.yy448 = yylhsminor.yy448;
break;
- case 160: /* multi_create_clause ::= multi_create_clause create_subtable_clause */
- case 452: /* when_then_list ::= when_then_list when_then_expr */ yytestcase(yyruleno==452);
-{ yylhsminor.yy274 = addNodeToList(pCxt, yymsp[-1].minor.yy274, yymsp[0].minor.yy712); }
- yymsp[-1].minor.yy274 = yylhsminor.yy274;
+ case 163: /* multi_create_clause ::= multi_create_clause create_subtable_clause */
+ case 454: /* when_then_list ::= when_then_list when_then_expr */ yytestcase(yyruleno==454);
+{ yylhsminor.yy432 = addNodeToList(pCxt, yymsp[-1].minor.yy432, yymsp[0].minor.yy448); }
+ yymsp[-1].minor.yy432 = yylhsminor.yy432;
break;
- case 161: /* 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.yy712 = createCreateSubTableClause(pCxt, yymsp[-9].minor.yy337, yymsp[-8].minor.yy712, yymsp[-6].minor.yy712, yymsp[-5].minor.yy274, yymsp[-2].minor.yy274, yymsp[0].minor.yy712); }
- yymsp[-9].minor.yy712 = yylhsminor.yy712;
+ case 164: /* 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.yy448 = createCreateSubTableClause(pCxt, yymsp[-9].minor.yy369, yymsp[-8].minor.yy448, yymsp[-6].minor.yy448, yymsp[-5].minor.yy432, yymsp[-2].minor.yy432, yymsp[0].minor.yy448); }
+ yymsp[-9].minor.yy448 = yylhsminor.yy448;
break;
- case 164: /* drop_table_clause ::= exists_opt full_table_name */
-{ yylhsminor.yy712 = createDropTableClause(pCxt, yymsp[-1].minor.yy337, yymsp[0].minor.yy712); }
- yymsp[-1].minor.yy712 = yylhsminor.yy712;
+ case 167: /* drop_table_clause ::= exists_opt full_table_name */
+{ yylhsminor.yy448 = createDropTableClause(pCxt, yymsp[-1].minor.yy369, yymsp[0].minor.yy448); }
+ yymsp[-1].minor.yy448 = yylhsminor.yy448;
break;
- case 165: /* specific_cols_opt ::= */
- case 196: /* tags_def_opt ::= */ yytestcase(yyruleno==196);
- case 268: /* tag_list_opt ::= */ yytestcase(yyruleno==268);
- case 324: /* col_list_opt ::= */ yytestcase(yyruleno==324);
- case 326: /* tag_def_or_ref_opt ::= */ yytestcase(yyruleno==326);
- case 515: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==515);
- case 540: /* group_by_clause_opt ::= */ yytestcase(yyruleno==540);
- case 559: /* order_by_clause_opt ::= */ yytestcase(yyruleno==559);
-{ yymsp[1].minor.yy274 = NULL; }
+ case 168: /* specific_cols_opt ::= */
+ case 198: /* tags_def_opt ::= */ yytestcase(yyruleno==198);
+ case 270: /* tag_list_opt ::= */ yytestcase(yyruleno==270);
+ case 326: /* col_list_opt ::= */ yytestcase(yyruleno==326);
+ case 328: /* tag_def_or_ref_opt ::= */ yytestcase(yyruleno==328);
+ case 517: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==517);
+ case 542: /* group_by_clause_opt ::= */ yytestcase(yyruleno==542);
+ case 561: /* order_by_clause_opt ::= */ yytestcase(yyruleno==561);
+{ yymsp[1].minor.yy432 = NULL; }
break;
- case 166: /* specific_cols_opt ::= NK_LP col_name_list NK_RP */
- case 325: /* col_list_opt ::= NK_LP col_name_list NK_RP */ yytestcase(yyruleno==325);
-{ yymsp[-2].minor.yy274 = yymsp[-1].minor.yy274; }
+ case 169: /* specific_cols_opt ::= NK_LP col_name_list NK_RP */
+ case 327: /* col_list_opt ::= NK_LP col_name_list NK_RP */ yytestcase(yyruleno==327);
+{ yymsp[-2].minor.yy432 = yymsp[-1].minor.yy432; }
break;
- case 167: /* full_table_name ::= table_name */
-{ yylhsminor.yy712 = createRealTableNode(pCxt, NULL, &yymsp[0].minor.yy129, NULL); }
- yymsp[0].minor.yy712 = yylhsminor.yy712;
+ case 170: /* full_table_name ::= table_name */
+{ yylhsminor.yy448 = createRealTableNode(pCxt, NULL, &yymsp[0].minor.yy113, NULL); }
+ yymsp[0].minor.yy448 = yylhsminor.yy448;
break;
- case 168: /* full_table_name ::= db_name NK_DOT table_name */
-{ yylhsminor.yy712 = createRealTableNode(pCxt, &yymsp[-2].minor.yy129, &yymsp[0].minor.yy129, NULL); }
- yymsp[-2].minor.yy712 = yylhsminor.yy712;
+ case 171: /* full_table_name ::= db_name NK_DOT table_name */
+{ yylhsminor.yy448 = createRealTableNode(pCxt, &yymsp[-2].minor.yy113, &yymsp[0].minor.yy113, NULL); }
+ yymsp[-2].minor.yy448 = yylhsminor.yy448;
break;
- case 171: /* column_def ::= column_name type_name */
-{ yylhsminor.yy712 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy129, yymsp[0].minor.yy184, NULL); }
- yymsp[-1].minor.yy712 = yylhsminor.yy712;
+ case 174: /* column_def ::= column_name type_name */
+{ yylhsminor.yy448 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy113, yymsp[0].minor.yy728, NULL); }
+ yymsp[-1].minor.yy448 = yylhsminor.yy448;
break;
- case 172: /* column_def ::= column_name type_name COMMENT NK_STRING */
-{ yylhsminor.yy712 = createColumnDefNode(pCxt, &yymsp[-3].minor.yy129, yymsp[-2].minor.yy184, &yymsp[0].minor.yy0); }
- yymsp[-3].minor.yy712 = yylhsminor.yy712;
+ case 175: /* type_name ::= BOOL */
+{ yymsp[0].minor.yy728 = createDataType(TSDB_DATA_TYPE_BOOL); }
break;
- case 173: /* type_name ::= BOOL */
-{ yymsp[0].minor.yy184 = createDataType(TSDB_DATA_TYPE_BOOL); }
+ case 176: /* type_name ::= TINYINT */
+{ yymsp[0].minor.yy728 = createDataType(TSDB_DATA_TYPE_TINYINT); }
break;
- case 174: /* type_name ::= TINYINT */
-{ yymsp[0].minor.yy184 = createDataType(TSDB_DATA_TYPE_TINYINT); }
+ case 177: /* type_name ::= SMALLINT */
+{ yymsp[0].minor.yy728 = createDataType(TSDB_DATA_TYPE_SMALLINT); }
break;
- case 175: /* type_name ::= SMALLINT */
-{ yymsp[0].minor.yy184 = createDataType(TSDB_DATA_TYPE_SMALLINT); }
+ case 178: /* type_name ::= INT */
+ case 179: /* type_name ::= INTEGER */ yytestcase(yyruleno==179);
+{ yymsp[0].minor.yy728 = createDataType(TSDB_DATA_TYPE_INT); }
break;
- case 176: /* type_name ::= INT */
- case 177: /* type_name ::= INTEGER */ yytestcase(yyruleno==177);
-{ yymsp[0].minor.yy184 = createDataType(TSDB_DATA_TYPE_INT); }
+ case 180: /* type_name ::= BIGINT */
+{ yymsp[0].minor.yy728 = createDataType(TSDB_DATA_TYPE_BIGINT); }
break;
- case 178: /* type_name ::= BIGINT */
-{ yymsp[0].minor.yy184 = createDataType(TSDB_DATA_TYPE_BIGINT); }
+ case 181: /* type_name ::= FLOAT */
+{ yymsp[0].minor.yy728 = createDataType(TSDB_DATA_TYPE_FLOAT); }
break;
- case 179: /* type_name ::= FLOAT */
-{ yymsp[0].minor.yy184 = createDataType(TSDB_DATA_TYPE_FLOAT); }
+ case 182: /* type_name ::= DOUBLE */
+{ yymsp[0].minor.yy728 = createDataType(TSDB_DATA_TYPE_DOUBLE); }
break;
- case 180: /* type_name ::= DOUBLE */
-{ yymsp[0].minor.yy184 = createDataType(TSDB_DATA_TYPE_DOUBLE); }
+ case 183: /* type_name ::= BINARY NK_LP NK_INTEGER NK_RP */
+{ yymsp[-3].minor.yy728 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); }
break;
- case 181: /* type_name ::= BINARY NK_LP NK_INTEGER NK_RP */
-{ yymsp[-3].minor.yy184 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); }
+ case 184: /* type_name ::= TIMESTAMP */
+{ yymsp[0].minor.yy728 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); }
break;
- case 182: /* type_name ::= TIMESTAMP */
-{ yymsp[0].minor.yy184 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); }
+ case 185: /* type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */
+{ yymsp[-3].minor.yy728 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); }
break;
- case 183: /* type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */
-{ yymsp[-3].minor.yy184 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); }
+ case 186: /* type_name ::= TINYINT UNSIGNED */
+{ yymsp[-1].minor.yy728 = createDataType(TSDB_DATA_TYPE_UTINYINT); }
break;
- case 184: /* type_name ::= TINYINT UNSIGNED */
-{ yymsp[-1].minor.yy184 = createDataType(TSDB_DATA_TYPE_UTINYINT); }
+ case 187: /* type_name ::= SMALLINT UNSIGNED */
+{ yymsp[-1].minor.yy728 = createDataType(TSDB_DATA_TYPE_USMALLINT); }
break;
- case 185: /* type_name ::= SMALLINT UNSIGNED */
-{ yymsp[-1].minor.yy184 = createDataType(TSDB_DATA_TYPE_USMALLINT); }
+ case 188: /* type_name ::= INT UNSIGNED */
+{ yymsp[-1].minor.yy728 = createDataType(TSDB_DATA_TYPE_UINT); }
break;
- case 186: /* type_name ::= INT UNSIGNED */
-{ yymsp[-1].minor.yy184 = createDataType(TSDB_DATA_TYPE_UINT); }
+ case 189: /* type_name ::= BIGINT UNSIGNED */
+{ yymsp[-1].minor.yy728 = createDataType(TSDB_DATA_TYPE_UBIGINT); }
break;
- case 187: /* type_name ::= BIGINT UNSIGNED */
-{ yymsp[-1].minor.yy184 = createDataType(TSDB_DATA_TYPE_UBIGINT); }
+ case 190: /* type_name ::= JSON */
+{ yymsp[0].minor.yy728 = createDataType(TSDB_DATA_TYPE_JSON); }
break;
- case 188: /* type_name ::= JSON */
-{ yymsp[0].minor.yy184 = createDataType(TSDB_DATA_TYPE_JSON); }
+ case 191: /* type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */
+{ yymsp[-3].minor.yy728 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); }
break;
- case 189: /* type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */
-{ yymsp[-3].minor.yy184 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); }
+ case 192: /* type_name ::= MEDIUMBLOB */
+{ yymsp[0].minor.yy728 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); }
break;
- case 190: /* type_name ::= MEDIUMBLOB */
-{ yymsp[0].minor.yy184 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); }
+ case 193: /* type_name ::= BLOB */
+{ yymsp[0].minor.yy728 = createDataType(TSDB_DATA_TYPE_BLOB); }
break;
- case 191: /* type_name ::= BLOB */
-{ yymsp[0].minor.yy184 = createDataType(TSDB_DATA_TYPE_BLOB); }
+ case 194: /* type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */
+{ yymsp[-3].minor.yy728 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &yymsp[-1].minor.yy0); }
break;
- case 192: /* type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */
-{ yymsp[-3].minor.yy184 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &yymsp[-1].minor.yy0); }
+ case 195: /* type_name ::= DECIMAL */
+{ yymsp[0].minor.yy728 = createDataType(TSDB_DATA_TYPE_DECIMAL); }
break;
- case 193: /* type_name ::= DECIMAL */
-{ yymsp[0].minor.yy184 = createDataType(TSDB_DATA_TYPE_DECIMAL); }
+ case 196: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */
+{ yymsp[-3].minor.yy728 = createDataType(TSDB_DATA_TYPE_DECIMAL); }
break;
- case 194: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */
-{ yymsp[-3].minor.yy184 = createDataType(TSDB_DATA_TYPE_DECIMAL); }
+ case 197: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */
+{ yymsp[-5].minor.yy728 = createDataType(TSDB_DATA_TYPE_DECIMAL); }
break;
- case 195: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */
-{ yymsp[-5].minor.yy184 = createDataType(TSDB_DATA_TYPE_DECIMAL); }
+ case 199: /* tags_def_opt ::= tags_def */
+ case 329: /* tag_def_or_ref_opt ::= tags_def */ yytestcase(yyruleno==329);
+ case 446: /* star_func_para_list ::= other_para_list */ yytestcase(yyruleno==446);
+{ yylhsminor.yy432 = yymsp[0].minor.yy432; }
+ yymsp[0].minor.yy432 = yylhsminor.yy432;
break;
- case 197: /* tags_def_opt ::= tags_def */
- case 327: /* tag_def_or_ref_opt ::= tags_def */ yytestcase(yyruleno==327);
- case 444: /* star_func_para_list ::= other_para_list */ yytestcase(yyruleno==444);
-{ yylhsminor.yy274 = yymsp[0].minor.yy274; }
- yymsp[0].minor.yy274 = yylhsminor.yy274;
+ case 200: /* tags_def ::= TAGS NK_LP column_def_list NK_RP */
+ case 330: /* tag_def_or_ref_opt ::= TAGS NK_LP col_name_list NK_RP */ yytestcase(yyruleno==330);
+{ yymsp[-3].minor.yy432 = yymsp[-1].minor.yy432; }
break;
- case 198: /* tags_def ::= TAGS NK_LP column_def_list NK_RP */
- case 328: /* tag_def_or_ref_opt ::= TAGS NK_LP col_name_list NK_RP */ yytestcase(yyruleno==328);
-{ yymsp[-3].minor.yy274 = yymsp[-1].minor.yy274; }
+ case 201: /* table_options ::= */
+{ yymsp[1].minor.yy448 = createDefaultTableOptions(pCxt); }
break;
- case 199: /* table_options ::= */
-{ yymsp[1].minor.yy712 = createDefaultTableOptions(pCxt); }
+ case 202: /* table_options ::= table_options COMMENT NK_STRING */
+{ yylhsminor.yy448 = setTableOption(pCxt, yymsp[-2].minor.yy448, TABLE_OPTION_COMMENT, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy448 = yylhsminor.yy448;
break;
- case 200: /* table_options ::= table_options COMMENT NK_STRING */
-{ yylhsminor.yy712 = setTableOption(pCxt, yymsp[-2].minor.yy712, TABLE_OPTION_COMMENT, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy712 = yylhsminor.yy712;
+ case 203: /* table_options ::= table_options MAX_DELAY duration_list */
+{ yylhsminor.yy448 = setTableOption(pCxt, yymsp[-2].minor.yy448, TABLE_OPTION_MAXDELAY, yymsp[0].minor.yy432); }
+ yymsp[-2].minor.yy448 = yylhsminor.yy448;
break;
- case 201: /* table_options ::= table_options MAX_DELAY duration_list */
-{ yylhsminor.yy712 = setTableOption(pCxt, yymsp[-2].minor.yy712, TABLE_OPTION_MAXDELAY, yymsp[0].minor.yy274); }
- yymsp[-2].minor.yy712 = yylhsminor.yy712;
+ case 204: /* table_options ::= table_options WATERMARK duration_list */
+{ yylhsminor.yy448 = setTableOption(pCxt, yymsp[-2].minor.yy448, TABLE_OPTION_WATERMARK, yymsp[0].minor.yy432); }
+ yymsp[-2].minor.yy448 = yylhsminor.yy448;
break;
- case 202: /* table_options ::= table_options WATERMARK duration_list */
-{ yylhsminor.yy712 = setTableOption(pCxt, yymsp[-2].minor.yy712, TABLE_OPTION_WATERMARK, yymsp[0].minor.yy274); }
- yymsp[-2].minor.yy712 = yylhsminor.yy712;
+ case 205: /* table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */
+{ yylhsminor.yy448 = setTableOption(pCxt, yymsp[-4].minor.yy448, TABLE_OPTION_ROLLUP, yymsp[-1].minor.yy432); }
+ yymsp[-4].minor.yy448 = yylhsminor.yy448;
break;
- case 203: /* table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */
-{ yylhsminor.yy712 = setTableOption(pCxt, yymsp[-4].minor.yy712, TABLE_OPTION_ROLLUP, yymsp[-1].minor.yy274); }
- yymsp[-4].minor.yy712 = yylhsminor.yy712;
+ case 206: /* table_options ::= table_options TTL NK_INTEGER */
+{ yylhsminor.yy448 = setTableOption(pCxt, yymsp[-2].minor.yy448, TABLE_OPTION_TTL, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy448 = yylhsminor.yy448;
break;
- case 204: /* table_options ::= table_options TTL NK_INTEGER */
-{ yylhsminor.yy712 = setTableOption(pCxt, yymsp[-2].minor.yy712, TABLE_OPTION_TTL, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy712 = yylhsminor.yy712;
+ case 207: /* table_options ::= table_options SMA NK_LP col_name_list NK_RP */
+{ yylhsminor.yy448 = setTableOption(pCxt, yymsp[-4].minor.yy448, TABLE_OPTION_SMA, yymsp[-1].minor.yy432); }
+ yymsp[-4].minor.yy448 = yylhsminor.yy448;
break;
- case 205: /* table_options ::= table_options SMA NK_LP col_name_list NK_RP */
-{ yylhsminor.yy712 = setTableOption(pCxt, yymsp[-4].minor.yy712, TABLE_OPTION_SMA, yymsp[-1].minor.yy274); }
- yymsp[-4].minor.yy712 = yylhsminor.yy712;
+ case 208: /* table_options ::= table_options DELETE_MARK duration_list */
+{ yylhsminor.yy448 = setTableOption(pCxt, yymsp[-2].minor.yy448, TABLE_OPTION_DELETE_MARK, yymsp[0].minor.yy432); }
+ yymsp[-2].minor.yy448 = yylhsminor.yy448;
break;
- case 206: /* table_options ::= table_options DELETE_MARK duration_list */
-{ yylhsminor.yy712 = setTableOption(pCxt, yymsp[-2].minor.yy712, TABLE_OPTION_DELETE_MARK, yymsp[0].minor.yy274); }
- yymsp[-2].minor.yy712 = yylhsminor.yy712;
+ case 209: /* alter_table_options ::= alter_table_option */
+{ yylhsminor.yy448 = createAlterTableOptions(pCxt); yylhsminor.yy448 = setTableOption(pCxt, yylhsminor.yy448, yymsp[0].minor.yy53.type, &yymsp[0].minor.yy53.val); }
+ yymsp[0].minor.yy448 = yylhsminor.yy448;
break;
- case 207: /* alter_table_options ::= alter_table_option */
-{ yylhsminor.yy712 = createAlterTableOptions(pCxt); yylhsminor.yy712 = setTableOption(pCxt, yylhsminor.yy712, yymsp[0].minor.yy595.type, &yymsp[0].minor.yy595.val); }
- yymsp[0].minor.yy712 = yylhsminor.yy712;
+ case 210: /* alter_table_options ::= alter_table_options alter_table_option */
+{ yylhsminor.yy448 = setTableOption(pCxt, yymsp[-1].minor.yy448, yymsp[0].minor.yy53.type, &yymsp[0].minor.yy53.val); }
+ yymsp[-1].minor.yy448 = yylhsminor.yy448;
break;
- case 208: /* alter_table_options ::= alter_table_options alter_table_option */
-{ yylhsminor.yy712 = setTableOption(pCxt, yymsp[-1].minor.yy712, yymsp[0].minor.yy595.type, &yymsp[0].minor.yy595.val); }
- yymsp[-1].minor.yy712 = yylhsminor.yy712;
+ case 211: /* alter_table_option ::= COMMENT NK_STRING */
+{ yymsp[-1].minor.yy53.type = TABLE_OPTION_COMMENT; yymsp[-1].minor.yy53.val = yymsp[0].minor.yy0; }
break;
- case 209: /* alter_table_option ::= COMMENT NK_STRING */
-{ yymsp[-1].minor.yy595.type = TABLE_OPTION_COMMENT; yymsp[-1].minor.yy595.val = yymsp[0].minor.yy0; }
+ case 212: /* alter_table_option ::= TTL NK_INTEGER */
+{ yymsp[-1].minor.yy53.type = TABLE_OPTION_TTL; yymsp[-1].minor.yy53.val = yymsp[0].minor.yy0; }
break;
- case 210: /* alter_table_option ::= TTL NK_INTEGER */
-{ yymsp[-1].minor.yy595.type = TABLE_OPTION_TTL; yymsp[-1].minor.yy595.val = yymsp[0].minor.yy0; }
+ case 213: /* duration_list ::= duration_literal */
+ case 410: /* expression_list ::= expr_or_subquery */ yytestcase(yyruleno==410);
+{ yylhsminor.yy432 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy448)); }
+ yymsp[0].minor.yy432 = yylhsminor.yy432;
break;
- case 211: /* duration_list ::= duration_literal */
- case 408: /* expression_list ::= expr_or_subquery */ yytestcase(yyruleno==408);
-{ yylhsminor.yy274 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy712)); }
- yymsp[0].minor.yy274 = yylhsminor.yy274;
+ case 214: /* duration_list ::= duration_list NK_COMMA duration_literal */
+ case 411: /* expression_list ::= expression_list NK_COMMA expr_or_subquery */ yytestcase(yyruleno==411);
+{ yylhsminor.yy432 = addNodeToList(pCxt, yymsp[-2].minor.yy432, releaseRawExprNode(pCxt, yymsp[0].minor.yy448)); }
+ yymsp[-2].minor.yy432 = yylhsminor.yy432;
break;
- case 212: /* duration_list ::= duration_list NK_COMMA duration_literal */
- case 409: /* expression_list ::= expression_list NK_COMMA expr_or_subquery */ yytestcase(yyruleno==409);
-{ yylhsminor.yy274 = addNodeToList(pCxt, yymsp[-2].minor.yy274, releaseRawExprNode(pCxt, yymsp[0].minor.yy712)); }
- yymsp[-2].minor.yy274 = yylhsminor.yy274;
+ case 217: /* rollup_func_name ::= function_name */
+{ yylhsminor.yy448 = createFunctionNode(pCxt, &yymsp[0].minor.yy113, NULL); }
+ yymsp[0].minor.yy448 = yylhsminor.yy448;
break;
- case 215: /* rollup_func_name ::= function_name */
-{ yylhsminor.yy712 = createFunctionNode(pCxt, &yymsp[0].minor.yy129, NULL); }
- yymsp[0].minor.yy712 = yylhsminor.yy712;
+ case 218: /* rollup_func_name ::= FIRST */
+ case 219: /* rollup_func_name ::= LAST */ yytestcase(yyruleno==219);
+ case 274: /* tag_item ::= QTAGS */ yytestcase(yyruleno==274);
+{ yylhsminor.yy448 = createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL); }
+ yymsp[0].minor.yy448 = yylhsminor.yy448;
break;
- case 216: /* rollup_func_name ::= FIRST */
- case 217: /* rollup_func_name ::= LAST */ yytestcase(yyruleno==217);
- case 272: /* tag_item ::= QTAGS */ yytestcase(yyruleno==272);
-{ yylhsminor.yy712 = createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL); }
- yymsp[0].minor.yy712 = yylhsminor.yy712;
+ case 222: /* col_name ::= column_name */
+ case 275: /* tag_item ::= column_name */ yytestcase(yyruleno==275);
+{ yylhsminor.yy448 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy113); }
+ yymsp[0].minor.yy448 = yylhsminor.yy448;
break;
- case 220: /* col_name ::= column_name */
- case 273: /* tag_item ::= column_name */ yytestcase(yyruleno==273);
-{ yylhsminor.yy712 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy129); }
- yymsp[0].minor.yy712 = yylhsminor.yy712;
- break;
- case 221: /* cmd ::= SHOW DNODES */
+ case 223: /* cmd ::= SHOW DNODES */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DNODES_STMT); }
break;
- case 222: /* cmd ::= SHOW USERS */
+ case 224: /* cmd ::= SHOW USERS */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_USERS_STMT); }
break;
- case 223: /* cmd ::= SHOW USER PRIVILEGES */
+ case 225: /* cmd ::= SHOW USER PRIVILEGES */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_USER_PRIVILEGES_STMT); }
break;
- case 224: /* cmd ::= SHOW DATABASES */
+ case 226: /* cmd ::= SHOW DATABASES */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DATABASES_STMT); }
break;
- case 225: /* cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */
-{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TABLES_STMT, yymsp[-2].minor.yy712, yymsp[0].minor.yy712, OP_TYPE_LIKE); }
+ case 227: /* cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */
+{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TABLES_STMT, yymsp[-2].minor.yy448, yymsp[0].minor.yy448, OP_TYPE_LIKE); }
break;
- case 226: /* cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */
-{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_STABLES_STMT, yymsp[-2].minor.yy712, yymsp[0].minor.yy712, OP_TYPE_LIKE); }
+ case 228: /* cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */
+{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_STABLES_STMT, yymsp[-2].minor.yy448, yymsp[0].minor.yy448, OP_TYPE_LIKE); }
break;
- case 227: /* cmd ::= SHOW db_name_cond_opt VGROUPS */
-{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VGROUPS_STMT, yymsp[-1].minor.yy712, NULL, OP_TYPE_LIKE); }
+ case 229: /* cmd ::= SHOW db_name_cond_opt VGROUPS */
+{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VGROUPS_STMT, yymsp[-1].minor.yy448, NULL, OP_TYPE_LIKE); }
break;
- case 228: /* cmd ::= SHOW MNODES */
+ case 230: /* cmd ::= SHOW MNODES */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_MNODES_STMT); }
break;
- case 229: /* cmd ::= SHOW QNODES */
+ case 231: /* cmd ::= SHOW QNODES */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_QNODES_STMT); }
break;
- case 230: /* cmd ::= SHOW FUNCTIONS */
+ case 232: /* cmd ::= SHOW FUNCTIONS */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_FUNCTIONS_STMT); }
break;
- case 231: /* cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */
-{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, yymsp[0].minor.yy712, yymsp[-1].minor.yy712, OP_TYPE_EQUAL); }
+ case 233: /* cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */
+{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, yymsp[0].minor.yy448, yymsp[-1].minor.yy448, OP_TYPE_EQUAL); }
break;
- case 232: /* cmd ::= SHOW STREAMS */
+ case 234: /* cmd ::= SHOW STREAMS */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_STREAMS_STMT); }
break;
- case 233: /* cmd ::= SHOW ACCOUNTS */
+ case 235: /* cmd ::= SHOW ACCOUNTS */
{ pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); }
break;
- case 234: /* cmd ::= SHOW APPS */
+ case 236: /* cmd ::= SHOW APPS */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_APPS_STMT); }
break;
- case 235: /* cmd ::= SHOW CONNECTIONS */
+ case 237: /* cmd ::= SHOW CONNECTIONS */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CONNECTIONS_STMT); }
break;
- case 236: /* cmd ::= SHOW LICENCES */
- case 237: /* cmd ::= SHOW GRANTS */ yytestcase(yyruleno==237);
+ case 238: /* cmd ::= SHOW LICENCES */
+ case 239: /* cmd ::= SHOW GRANTS */ yytestcase(yyruleno==239);
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_LICENCES_STMT); }
break;
- case 238: /* cmd ::= SHOW CREATE DATABASE db_name */
-{ pCxt->pRootNode = createShowCreateDatabaseStmt(pCxt, &yymsp[0].minor.yy129); }
+ case 240: /* cmd ::= SHOW CREATE DATABASE db_name */
+{ pCxt->pRootNode = createShowCreateDatabaseStmt(pCxt, &yymsp[0].minor.yy113); }
break;
- case 239: /* cmd ::= SHOW CREATE TABLE full_table_name */
-{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_TABLE_STMT, yymsp[0].minor.yy712); }
+ case 241: /* cmd ::= SHOW CREATE TABLE full_table_name */
+{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_TABLE_STMT, yymsp[0].minor.yy448); }
break;
- case 240: /* cmd ::= SHOW CREATE STABLE full_table_name */
-{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_STABLE_STMT, yymsp[0].minor.yy712); }
+ case 242: /* cmd ::= SHOW CREATE STABLE full_table_name */
+{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_STABLE_STMT, yymsp[0].minor.yy448); }
break;
- case 241: /* cmd ::= SHOW QUERIES */
+ case 243: /* cmd ::= SHOW QUERIES */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_QUERIES_STMT); }
break;
- case 242: /* cmd ::= SHOW SCORES */
+ case 244: /* cmd ::= SHOW SCORES */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SCORES_STMT); }
break;
- case 243: /* cmd ::= SHOW TOPICS */
+ case 245: /* cmd ::= SHOW TOPICS */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TOPICS_STMT); }
break;
- case 244: /* cmd ::= SHOW VARIABLES */
- case 245: /* cmd ::= SHOW CLUSTER VARIABLES */ yytestcase(yyruleno==245);
+ case 246: /* cmd ::= SHOW VARIABLES */
+ case 247: /* cmd ::= SHOW CLUSTER VARIABLES */ yytestcase(yyruleno==247);
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_VARIABLES_STMT); }
break;
- case 246: /* cmd ::= SHOW LOCAL VARIABLES */
+ case 248: /* cmd ::= SHOW LOCAL VARIABLES */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_LOCAL_VARIABLES_STMT); }
break;
- case 247: /* 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.yy712); }
+ case 249: /* 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.yy448); }
break;
- case 248: /* cmd ::= SHOW BNODES */
+ case 250: /* cmd ::= SHOW BNODES */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_BNODES_STMT); }
break;
- case 249: /* cmd ::= SHOW SNODES */
+ case 251: /* cmd ::= SHOW SNODES */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SNODES_STMT); }
break;
- case 250: /* cmd ::= SHOW CLUSTER */
+ case 252: /* cmd ::= SHOW CLUSTER */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CLUSTER_STMT); }
break;
- case 251: /* cmd ::= SHOW TRANSACTIONS */
+ case 253: /* cmd ::= SHOW TRANSACTIONS */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TRANSACTIONS_STMT); }
break;
- case 252: /* cmd ::= SHOW TABLE DISTRIBUTED full_table_name */
-{ pCxt->pRootNode = createShowTableDistributedStmt(pCxt, yymsp[0].minor.yy712); }
+ case 254: /* cmd ::= SHOW TABLE DISTRIBUTED full_table_name */
+{ pCxt->pRootNode = createShowTableDistributedStmt(pCxt, yymsp[0].minor.yy448); }
break;
- case 253: /* cmd ::= SHOW CONSUMERS */
+ case 255: /* cmd ::= SHOW CONSUMERS */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CONSUMERS_STMT); }
break;
- case 254: /* cmd ::= SHOW SUBSCRIPTIONS */
+ case 256: /* cmd ::= SHOW SUBSCRIPTIONS */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SUBSCRIPTIONS_STMT); }
break;
- case 255: /* cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */
-{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, yymsp[0].minor.yy712, yymsp[-1].minor.yy712, OP_TYPE_EQUAL); }
+ case 257: /* cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */
+{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, yymsp[0].minor.yy448, yymsp[-1].minor.yy448, OP_TYPE_EQUAL); }
break;
- case 256: /* cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */
-{ pCxt->pRootNode = createShowTableTagsStmt(pCxt, yymsp[-1].minor.yy712, yymsp[0].minor.yy712, yymsp[-3].minor.yy274); }
+ case 258: /* cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */
+{ pCxt->pRootNode = createShowTableTagsStmt(pCxt, yymsp[-1].minor.yy448, yymsp[0].minor.yy448, yymsp[-3].minor.yy432); }
break;
- case 257: /* cmd ::= SHOW VNODES NK_INTEGER */
+ case 259: /* cmd ::= SHOW VNODES NK_INTEGER */
{ pCxt->pRootNode = createShowVnodesStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0), NULL); }
break;
- case 258: /* cmd ::= SHOW VNODES NK_STRING */
+ case 260: /* cmd ::= SHOW VNODES NK_STRING */
{ pCxt->pRootNode = createShowVnodesStmt(pCxt, NULL, createValueNode(pCxt, TSDB_DATA_TYPE_VARCHAR, &yymsp[0].minor.yy0)); }
break;
- case 259: /* cmd ::= SHOW db_name_cond_opt ALIVE */
-{ pCxt->pRootNode = createShowAliveStmt(pCxt, yymsp[-1].minor.yy712, QUERY_NODE_SHOW_DB_ALIVE_STMT); }
+ case 261: /* cmd ::= SHOW db_name_cond_opt ALIVE */
+{ pCxt->pRootNode = createShowAliveStmt(pCxt, yymsp[-1].minor.yy448, QUERY_NODE_SHOW_DB_ALIVE_STMT); }
break;
- case 260: /* cmd ::= SHOW CLUSTER ALIVE */
+ case 262: /* cmd ::= SHOW CLUSTER ALIVE */
{ pCxt->pRootNode = createShowAliveStmt(pCxt, NULL, QUERY_NODE_SHOW_CLUSTER_ALIVE_STMT); }
break;
- case 261: /* db_name_cond_opt ::= */
- case 266: /* from_db_opt ::= */ yytestcase(yyruleno==266);
-{ yymsp[1].minor.yy712 = createDefaultDatabaseCondValue(pCxt); }
+ case 263: /* db_name_cond_opt ::= */
+ case 268: /* from_db_opt ::= */ yytestcase(yyruleno==268);
+{ yymsp[1].minor.yy448 = createDefaultDatabaseCondValue(pCxt); }
break;
- case 262: /* db_name_cond_opt ::= db_name NK_DOT */
-{ yylhsminor.yy712 = createIdentifierValueNode(pCxt, &yymsp[-1].minor.yy129); }
- yymsp[-1].minor.yy712 = yylhsminor.yy712;
+ case 264: /* db_name_cond_opt ::= db_name NK_DOT */
+{ yylhsminor.yy448 = createIdentifierValueNode(pCxt, &yymsp[-1].minor.yy113); }
+ yymsp[-1].minor.yy448 = yylhsminor.yy448;
break;
- case 264: /* like_pattern_opt ::= LIKE NK_STRING */
-{ yymsp[-1].minor.yy712 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); }
+ case 266: /* like_pattern_opt ::= LIKE NK_STRING */
+{ yymsp[-1].minor.yy448 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); }
break;
- case 265: /* table_name_cond ::= table_name */
-{ yylhsminor.yy712 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy129); }
- yymsp[0].minor.yy712 = yylhsminor.yy712;
+ case 267: /* table_name_cond ::= table_name */
+{ yylhsminor.yy448 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy113); }
+ yymsp[0].minor.yy448 = yylhsminor.yy448;
break;
- case 267: /* from_db_opt ::= FROM db_name */
-{ yymsp[-1].minor.yy712 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy129); }
+ case 269: /* from_db_opt ::= FROM db_name */
+{ yymsp[-1].minor.yy448 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy113); }
break;
- case 271: /* tag_item ::= TBNAME */
-{ yylhsminor.yy712 = setProjectionAlias(pCxt, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL), &yymsp[0].minor.yy0); }
- yymsp[0].minor.yy712 = yylhsminor.yy712;
+ case 273: /* tag_item ::= TBNAME */
+{ yylhsminor.yy448 = setProjectionAlias(pCxt, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL), &yymsp[0].minor.yy0); }
+ yymsp[0].minor.yy448 = yylhsminor.yy448;
break;
- case 274: /* tag_item ::= column_name column_alias */
-{ yylhsminor.yy712 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-1].minor.yy129), &yymsp[0].minor.yy129); }
- yymsp[-1].minor.yy712 = yylhsminor.yy712;
+ case 276: /* tag_item ::= column_name column_alias */
+{ yylhsminor.yy448 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-1].minor.yy113), &yymsp[0].minor.yy113); }
+ yymsp[-1].minor.yy448 = yylhsminor.yy448;
break;
- case 275: /* tag_item ::= column_name AS column_alias */
-{ yylhsminor.yy712 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-2].minor.yy129), &yymsp[0].minor.yy129); }
- yymsp[-2].minor.yy712 = yylhsminor.yy712;
+ case 277: /* tag_item ::= column_name AS column_alias */
+{ yylhsminor.yy448 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-2].minor.yy113), &yymsp[0].minor.yy113); }
+ yymsp[-2].minor.yy448 = yylhsminor.yy448;
break;
- case 276: /* cmd ::= CREATE SMA INDEX not_exists_opt full_index_name ON full_table_name index_options */
-{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, yymsp[-4].minor.yy337, yymsp[-3].minor.yy712, yymsp[-1].minor.yy712, NULL, yymsp[0].minor.yy712); }
+ case 278: /* cmd ::= CREATE SMA INDEX not_exists_opt full_index_name ON full_table_name index_options */
+{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, yymsp[-4].minor.yy369, yymsp[-3].minor.yy448, yymsp[-1].minor.yy448, NULL, yymsp[0].minor.yy448); }
break;
- case 277: /* cmd ::= CREATE INDEX not_exists_opt full_index_name ON full_table_name NK_LP col_name_list NK_RP */
-{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_NORMAL, yymsp[-6].minor.yy337, yymsp[-5].minor.yy712, yymsp[-3].minor.yy712, yymsp[-1].minor.yy274, NULL); }
+ case 279: /* cmd ::= CREATE INDEX not_exists_opt full_index_name ON full_table_name NK_LP col_name_list NK_RP */
+{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_NORMAL, yymsp[-6].minor.yy369, yymsp[-5].minor.yy448, yymsp[-3].minor.yy448, yymsp[-1].minor.yy432, NULL); }
break;
- case 278: /* cmd ::= DROP INDEX exists_opt full_index_name */
-{ pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-1].minor.yy337, yymsp[0].minor.yy712); }
+ case 280: /* cmd ::= DROP INDEX exists_opt full_index_name */
+{ pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-1].minor.yy369, yymsp[0].minor.yy448); }
break;
- case 279: /* full_index_name ::= index_name */
-{ yylhsminor.yy712 = createRealTableNodeForIndexName(pCxt, NULL, &yymsp[0].minor.yy129); }
- yymsp[0].minor.yy712 = yylhsminor.yy712;
+ case 281: /* full_index_name ::= index_name */
+{ yylhsminor.yy448 = createRealTableNodeForIndexName(pCxt, NULL, &yymsp[0].minor.yy113); }
+ yymsp[0].minor.yy448 = yylhsminor.yy448;
break;
- case 280: /* full_index_name ::= db_name NK_DOT index_name */
-{ yylhsminor.yy712 = createRealTableNodeForIndexName(pCxt, &yymsp[-2].minor.yy129, &yymsp[0].minor.yy129); }
- yymsp[-2].minor.yy712 = yylhsminor.yy712;
+ case 282: /* full_index_name ::= db_name NK_DOT index_name */
+{ yylhsminor.yy448 = createRealTableNodeForIndexName(pCxt, &yymsp[-2].minor.yy113, &yymsp[0].minor.yy113); }
+ yymsp[-2].minor.yy448 = yylhsminor.yy448;
break;
- case 281: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */
-{ yymsp[-9].minor.yy712 = createIndexOption(pCxt, yymsp[-7].minor.yy274, releaseRawExprNode(pCxt, yymsp[-3].minor.yy712), NULL, yymsp[-1].minor.yy712, yymsp[0].minor.yy712); }
+ case 283: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */
+{ yymsp[-9].minor.yy448 = createIndexOption(pCxt, yymsp[-7].minor.yy432, releaseRawExprNode(pCxt, yymsp[-3].minor.yy448), NULL, yymsp[-1].minor.yy448, yymsp[0].minor.yy448); }
break;
- case 282: /* 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.yy712 = createIndexOption(pCxt, yymsp[-9].minor.yy274, releaseRawExprNode(pCxt, yymsp[-5].minor.yy712), releaseRawExprNode(pCxt, yymsp[-3].minor.yy712), yymsp[-1].minor.yy712, yymsp[0].minor.yy712); }
+ case 284: /* 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.yy448 = createIndexOption(pCxt, yymsp[-9].minor.yy432, releaseRawExprNode(pCxt, yymsp[-5].minor.yy448), releaseRawExprNode(pCxt, yymsp[-3].minor.yy448), yymsp[-1].minor.yy448, yymsp[0].minor.yy448); }
break;
- case 285: /* func ::= sma_func_name NK_LP expression_list NK_RP */
-{ yylhsminor.yy712 = createFunctionNode(pCxt, &yymsp[-3].minor.yy129, yymsp[-1].minor.yy274); }
- yymsp[-3].minor.yy712 = yylhsminor.yy712;
+ case 287: /* func ::= sma_func_name NK_LP expression_list NK_RP */
+{ yylhsminor.yy448 = createFunctionNode(pCxt, &yymsp[-3].minor.yy113, yymsp[-1].minor.yy432); }
+ yymsp[-3].minor.yy448 = yylhsminor.yy448;
break;
- case 291: /* sma_stream_opt ::= */
- case 329: /* stream_options ::= */ yytestcase(yyruleno==329);
-{ yymsp[1].minor.yy712 = createStreamOptions(pCxt); }
+ case 288: /* sma_func_name ::= function_name */
+ case 497: /* alias_opt ::= table_alias */ yytestcase(yyruleno==497);
+{ yylhsminor.yy113 = yymsp[0].minor.yy113; }
+ yymsp[0].minor.yy113 = yylhsminor.yy113;
break;
- case 292: /* sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */
-{ ((SStreamOptions*)yymsp[-2].minor.yy712)->pWatermark = releaseRawExprNode(pCxt, yymsp[0].minor.yy712); yylhsminor.yy712 = yymsp[-2].minor.yy712; }
- yymsp[-2].minor.yy712 = yylhsminor.yy712;
+ case 293: /* sma_stream_opt ::= */
+ case 331: /* stream_options ::= */ yytestcase(yyruleno==331);
+{ yymsp[1].minor.yy448 = createStreamOptions(pCxt); }
break;
- case 293: /* sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */
-{ ((SStreamOptions*)yymsp[-2].minor.yy712)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy712); yylhsminor.yy712 = yymsp[-2].minor.yy712; }
- yymsp[-2].minor.yy712 = yylhsminor.yy712;
+ case 294: /* sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */
+{ ((SStreamOptions*)yymsp[-2].minor.yy448)->pWatermark = releaseRawExprNode(pCxt, yymsp[0].minor.yy448); yylhsminor.yy448 = yymsp[-2].minor.yy448; }
+ yymsp[-2].minor.yy448 = yylhsminor.yy448;
break;
- case 294: /* sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */
-{ ((SStreamOptions*)yymsp[-2].minor.yy712)->pDeleteMark = releaseRawExprNode(pCxt, yymsp[0].minor.yy712); yylhsminor.yy712 = yymsp[-2].minor.yy712; }
- yymsp[-2].minor.yy712 = yylhsminor.yy712;
+ case 295: /* sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */
+{ ((SStreamOptions*)yymsp[-2].minor.yy448)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy448); yylhsminor.yy448 = yymsp[-2].minor.yy448; }
+ yymsp[-2].minor.yy448 = yylhsminor.yy448;
break;
- case 295: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */
-{ pCxt->pRootNode = createCreateTopicStmtUseQuery(pCxt, yymsp[-3].minor.yy337, &yymsp[-2].minor.yy129, yymsp[0].minor.yy712); }
+ case 296: /* sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */
+{ ((SStreamOptions*)yymsp[-2].minor.yy448)->pDeleteMark = releaseRawExprNode(pCxt, yymsp[0].minor.yy448); yylhsminor.yy448 = yymsp[-2].minor.yy448; }
+ yymsp[-2].minor.yy448 = yylhsminor.yy448;
break;
- case 296: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name */
-{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-4].minor.yy337, &yymsp[-3].minor.yy129, &yymsp[0].minor.yy129, false); }
+ case 297: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */
+{ pCxt->pRootNode = createCreateTopicStmtUseQuery(pCxt, yymsp[-3].minor.yy369, &yymsp[-2].minor.yy113, yymsp[0].minor.yy448); }
break;
- case 297: /* cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name */
-{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-6].minor.yy337, &yymsp[-5].minor.yy129, &yymsp[0].minor.yy129, true); }
+ case 298: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name */
+{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-4].minor.yy369, &yymsp[-3].minor.yy113, &yymsp[0].minor.yy113, false); }
break;
- case 298: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name */
-{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-4].minor.yy337, &yymsp[-3].minor.yy129, yymsp[0].minor.yy712, false); }
+ case 299: /* cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name */
+{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-6].minor.yy369, &yymsp[-5].minor.yy113, &yymsp[0].minor.yy113, true); }
break;
- case 299: /* cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name */
-{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-6].minor.yy337, &yymsp[-5].minor.yy129, yymsp[0].minor.yy712, true); }
+ case 300: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name */
+{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-4].minor.yy369, &yymsp[-3].minor.yy113, yymsp[0].minor.yy448, false); }
break;
- case 300: /* cmd ::= DROP TOPIC exists_opt topic_name */
-{ pCxt->pRootNode = createDropTopicStmt(pCxt, yymsp[-1].minor.yy337, &yymsp[0].minor.yy129); }
+ case 301: /* cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name */
+{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-6].minor.yy369, &yymsp[-5].minor.yy113, yymsp[0].minor.yy448, true); }
break;
- case 301: /* cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */
-{ pCxt->pRootNode = createDropCGroupStmt(pCxt, yymsp[-3].minor.yy337, &yymsp[-2].minor.yy129, &yymsp[0].minor.yy129); }
+ case 302: /* cmd ::= DROP TOPIC exists_opt topic_name */
+{ pCxt->pRootNode = createDropTopicStmt(pCxt, yymsp[-1].minor.yy369, &yymsp[0].minor.yy113); }
break;
- case 302: /* cmd ::= DESC full_table_name */
- case 303: /* cmd ::= DESCRIBE full_table_name */ yytestcase(yyruleno==303);
-{ pCxt->pRootNode = createDescribeStmt(pCxt, yymsp[0].minor.yy712); }
+ case 303: /* cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */
+{ pCxt->pRootNode = createDropCGroupStmt(pCxt, yymsp[-3].minor.yy369, &yymsp[-2].minor.yy113, &yymsp[0].minor.yy113); }
break;
- case 304: /* cmd ::= RESET QUERY CACHE */
+ case 304: /* cmd ::= DESC full_table_name */
+ case 305: /* cmd ::= DESCRIBE full_table_name */ yytestcase(yyruleno==305);
+{ pCxt->pRootNode = createDescribeStmt(pCxt, yymsp[0].minor.yy448); }
+ break;
+ case 306: /* cmd ::= RESET QUERY CACHE */
{ pCxt->pRootNode = createResetQueryCacheStmt(pCxt); }
break;
- case 305: /* cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */
- case 306: /* cmd ::= EXPLAIN analyze_opt explain_options insert_query */ yytestcase(yyruleno==306);
-{ pCxt->pRootNode = createExplainStmt(pCxt, yymsp[-2].minor.yy337, yymsp[-1].minor.yy712, yymsp[0].minor.yy712); }
+ case 307: /* cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */
+ case 308: /* cmd ::= EXPLAIN analyze_opt explain_options insert_query */ yytestcase(yyruleno==308);
+{ pCxt->pRootNode = createExplainStmt(pCxt, yymsp[-2].minor.yy369, yymsp[-1].minor.yy448, yymsp[0].minor.yy448); }
break;
- case 309: /* explain_options ::= */
-{ yymsp[1].minor.yy712 = createDefaultExplainOptions(pCxt); }
+ case 311: /* explain_options ::= */
+{ yymsp[1].minor.yy448 = createDefaultExplainOptions(pCxt); }
break;
- case 310: /* explain_options ::= explain_options VERBOSE NK_BOOL */
-{ yylhsminor.yy712 = setExplainVerbose(pCxt, yymsp[-2].minor.yy712, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy712 = yylhsminor.yy712;
+ case 312: /* explain_options ::= explain_options VERBOSE NK_BOOL */
+{ yylhsminor.yy448 = setExplainVerbose(pCxt, yymsp[-2].minor.yy448, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy448 = yylhsminor.yy448;
break;
- case 311: /* explain_options ::= explain_options RATIO NK_FLOAT */
-{ yylhsminor.yy712 = setExplainRatio(pCxt, yymsp[-2].minor.yy712, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy712 = yylhsminor.yy712;
+ case 313: /* explain_options ::= explain_options RATIO NK_FLOAT */
+{ yylhsminor.yy448 = setExplainRatio(pCxt, yymsp[-2].minor.yy448, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy448 = yylhsminor.yy448;
break;
- case 312: /* cmd ::= CREATE or_replace_opt agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt */
-{ pCxt->pRootNode = createCreateFunctionStmt(pCxt, yymsp[-7].minor.yy337, yymsp[-9].minor.yy337, &yymsp[-6].minor.yy129, &yymsp[-4].minor.yy0, yymsp[-2].minor.yy184, yymsp[-1].minor.yy310, &yymsp[0].minor.yy129, yymsp[-10].minor.yy337); }
+ case 314: /* cmd ::= CREATE or_replace_opt agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt */
+{ pCxt->pRootNode = createCreateFunctionStmt(pCxt, yymsp[-7].minor.yy369, yymsp[-9].minor.yy369, &yymsp[-6].minor.yy113, &yymsp[-4].minor.yy0, yymsp[-2].minor.yy728, yymsp[-1].minor.yy788, &yymsp[0].minor.yy113, yymsp[-10].minor.yy369); }
break;
- case 313: /* cmd ::= DROP FUNCTION exists_opt function_name */
-{ pCxt->pRootNode = createDropFunctionStmt(pCxt, yymsp[-1].minor.yy337, &yymsp[0].minor.yy129); }
+ case 315: /* cmd ::= DROP FUNCTION exists_opt function_name */
+{ pCxt->pRootNode = createDropFunctionStmt(pCxt, yymsp[-1].minor.yy369, &yymsp[0].minor.yy113); }
break;
- case 318: /* language_opt ::= */
-{ yymsp[1].minor.yy129 = nil_token; }
+ case 320: /* language_opt ::= */
+{ yymsp[1].minor.yy113 = nil_token; }
break;
- case 319: /* language_opt ::= LANGUAGE NK_STRING */
-{ yymsp[-1].minor.yy129 = yymsp[0].minor.yy0; }
+ case 321: /* language_opt ::= LANGUAGE NK_STRING */
+{ yymsp[-1].minor.yy113 = yymsp[0].minor.yy0; }
break;
- case 322: /* cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name col_list_opt tag_def_or_ref_opt subtable_opt AS query_or_subquery */
-{ pCxt->pRootNode = createCreateStreamStmt(pCxt, yymsp[-9].minor.yy337, &yymsp[-8].minor.yy129, yymsp[-5].minor.yy712, yymsp[-7].minor.yy712, yymsp[-3].minor.yy274, yymsp[-2].minor.yy712, yymsp[0].minor.yy712, yymsp[-4].minor.yy274); }
+ case 324: /* cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name col_list_opt tag_def_or_ref_opt subtable_opt AS query_or_subquery */
+{ pCxt->pRootNode = createCreateStreamStmt(pCxt, yymsp[-9].minor.yy369, &yymsp[-8].minor.yy113, yymsp[-5].minor.yy448, yymsp[-7].minor.yy448, yymsp[-3].minor.yy432, yymsp[-2].minor.yy448, yymsp[0].minor.yy448, yymsp[-4].minor.yy432); }
break;
- case 323: /* cmd ::= DROP STREAM exists_opt stream_name */
-{ pCxt->pRootNode = createDropStreamStmt(pCxt, yymsp[-1].minor.yy337, &yymsp[0].minor.yy129); }
+ case 325: /* cmd ::= DROP STREAM exists_opt stream_name */
+{ pCxt->pRootNode = createDropStreamStmt(pCxt, yymsp[-1].minor.yy369, &yymsp[0].minor.yy113); }
break;
- case 330: /* stream_options ::= stream_options TRIGGER AT_ONCE */
- case 331: /* stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ yytestcase(yyruleno==331);
-{ yylhsminor.yy712 = setStreamOptions(pCxt, yymsp[-2].minor.yy712, SOPT_TRIGGER_TYPE_SET, &yymsp[0].minor.yy0, NULL); }
- yymsp[-2].minor.yy712 = yylhsminor.yy712;
+ case 332: /* stream_options ::= stream_options TRIGGER AT_ONCE */
+ case 333: /* stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ yytestcase(yyruleno==333);
+{ yylhsminor.yy448 = setStreamOptions(pCxt, yymsp[-2].minor.yy448, SOPT_TRIGGER_TYPE_SET, &yymsp[0].minor.yy0, NULL); }
+ yymsp[-2].minor.yy448 = yylhsminor.yy448;
break;
- case 332: /* stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */
-{ yylhsminor.yy712 = setStreamOptions(pCxt, yymsp[-3].minor.yy712, SOPT_TRIGGER_TYPE_SET, &yymsp[-1].minor.yy0, releaseRawExprNode(pCxt, yymsp[0].minor.yy712)); }
- yymsp[-3].minor.yy712 = yylhsminor.yy712;
+ case 334: /* stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */
+{ yylhsminor.yy448 = setStreamOptions(pCxt, yymsp[-3].minor.yy448, SOPT_TRIGGER_TYPE_SET, &yymsp[-1].minor.yy0, releaseRawExprNode(pCxt, yymsp[0].minor.yy448)); }
+ yymsp[-3].minor.yy448 = yylhsminor.yy448;
break;
- case 333: /* stream_options ::= stream_options WATERMARK duration_literal */
-{ yylhsminor.yy712 = setStreamOptions(pCxt, yymsp[-2].minor.yy712, SOPT_WATERMARK_SET, NULL, releaseRawExprNode(pCxt, yymsp[0].minor.yy712)); }
- yymsp[-2].minor.yy712 = yylhsminor.yy712;
+ case 335: /* stream_options ::= stream_options WATERMARK duration_literal */
+{ yylhsminor.yy448 = setStreamOptions(pCxt, yymsp[-2].minor.yy448, SOPT_WATERMARK_SET, NULL, releaseRawExprNode(pCxt, yymsp[0].minor.yy448)); }
+ yymsp[-2].minor.yy448 = yylhsminor.yy448;
break;
- case 334: /* stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */
-{ yylhsminor.yy712 = setStreamOptions(pCxt, yymsp[-3].minor.yy712, SOPT_IGNORE_EXPIRED_SET, &yymsp[0].minor.yy0, NULL); }
- yymsp[-3].minor.yy712 = yylhsminor.yy712;
+ case 336: /* stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */
+{ yylhsminor.yy448 = setStreamOptions(pCxt, yymsp[-3].minor.yy448, SOPT_IGNORE_EXPIRED_SET, &yymsp[0].minor.yy0, NULL); }
+ yymsp[-3].minor.yy448 = yylhsminor.yy448;
break;
- case 335: /* stream_options ::= stream_options FILL_HISTORY NK_INTEGER */
-{ yylhsminor.yy712 = setStreamOptions(pCxt, yymsp[-2].minor.yy712, SOPT_FILL_HISTORY_SET, &yymsp[0].minor.yy0, NULL); }
- yymsp[-2].minor.yy712 = yylhsminor.yy712;
+ case 337: /* stream_options ::= stream_options FILL_HISTORY NK_INTEGER */
+{ yylhsminor.yy448 = setStreamOptions(pCxt, yymsp[-2].minor.yy448, SOPT_FILL_HISTORY_SET, &yymsp[0].minor.yy0, NULL); }
+ yymsp[-2].minor.yy448 = yylhsminor.yy448;
break;
- case 336: /* stream_options ::= stream_options DELETE_MARK duration_literal */
-{ yylhsminor.yy712 = setStreamOptions(pCxt, yymsp[-2].minor.yy712, SOPT_DELETE_MARK_SET, NULL, releaseRawExprNode(pCxt, yymsp[0].minor.yy712)); }
- yymsp[-2].minor.yy712 = yylhsminor.yy712;
+ case 338: /* stream_options ::= stream_options DELETE_MARK duration_literal */
+{ yylhsminor.yy448 = setStreamOptions(pCxt, yymsp[-2].minor.yy448, SOPT_DELETE_MARK_SET, NULL, releaseRawExprNode(pCxt, yymsp[0].minor.yy448)); }
+ yymsp[-2].minor.yy448 = yylhsminor.yy448;
break;
- case 337: /* stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */
-{ yylhsminor.yy712 = setStreamOptions(pCxt, yymsp[-3].minor.yy712, SOPT_IGNORE_UPDATE_SET, &yymsp[0].minor.yy0, NULL); }
- yymsp[-3].minor.yy712 = yylhsminor.yy712;
+ case 339: /* stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */
+{ yylhsminor.yy448 = setStreamOptions(pCxt, yymsp[-3].minor.yy448, SOPT_IGNORE_UPDATE_SET, &yymsp[0].minor.yy0, NULL); }
+ yymsp[-3].minor.yy448 = yylhsminor.yy448;
break;
- case 339: /* subtable_opt ::= SUBTABLE NK_LP expression NK_RP */
- case 529: /* sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ yytestcase(yyruleno==529);
- case 549: /* every_opt ::= EVERY NK_LP duration_literal NK_RP */ yytestcase(yyruleno==549);
-{ yymsp[-3].minor.yy712 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy712); }
+ case 341: /* subtable_opt ::= SUBTABLE NK_LP expression NK_RP */
+ case 531: /* sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ yytestcase(yyruleno==531);
+ case 551: /* every_opt ::= EVERY NK_LP duration_literal NK_RP */ yytestcase(yyruleno==551);
+{ yymsp[-3].minor.yy448 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy448); }
break;
- case 340: /* cmd ::= KILL CONNECTION NK_INTEGER */
+ case 342: /* cmd ::= KILL CONNECTION NK_INTEGER */
{ pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_CONNECTION_STMT, &yymsp[0].minor.yy0); }
break;
- case 341: /* cmd ::= KILL QUERY NK_STRING */
+ case 343: /* cmd ::= KILL QUERY NK_STRING */
{ pCxt->pRootNode = createKillQueryStmt(pCxt, &yymsp[0].minor.yy0); }
break;
- case 342: /* cmd ::= KILL TRANSACTION NK_INTEGER */
+ case 344: /* cmd ::= KILL TRANSACTION NK_INTEGER */
{ pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_TRANSACTION_STMT, &yymsp[0].minor.yy0); }
break;
- case 343: /* cmd ::= BALANCE VGROUP */
+ case 345: /* cmd ::= BALANCE VGROUP */
{ pCxt->pRootNode = createBalanceVgroupStmt(pCxt); }
break;
- case 344: /* cmd ::= BALANCE VGROUP LEADER */
+ case 346: /* cmd ::= BALANCE VGROUP LEADER */
{ pCxt->pRootNode = createBalanceVgroupLeaderStmt(pCxt); }
break;
- case 345: /* cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */
+ case 347: /* cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */
{ pCxt->pRootNode = createMergeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); }
break;
- case 346: /* cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */
-{ pCxt->pRootNode = createRedistributeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy274); }
+ case 348: /* cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */
+{ pCxt->pRootNode = createRedistributeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy432); }
break;
- case 347: /* cmd ::= SPLIT VGROUP NK_INTEGER */
+ case 349: /* cmd ::= SPLIT VGROUP NK_INTEGER */
{ pCxt->pRootNode = createSplitVgroupStmt(pCxt, &yymsp[0].minor.yy0); }
break;
- case 348: /* dnode_list ::= DNODE NK_INTEGER */
-{ yymsp[-1].minor.yy274 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); }
+ case 350: /* dnode_list ::= DNODE NK_INTEGER */
+{ yymsp[-1].minor.yy432 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); }
break;
- case 350: /* cmd ::= DELETE FROM full_table_name where_clause_opt */
-{ pCxt->pRootNode = createDeleteStmt(pCxt, yymsp[-1].minor.yy712, yymsp[0].minor.yy712); }
+ case 352: /* cmd ::= DELETE FROM full_table_name where_clause_opt */
+{ pCxt->pRootNode = createDeleteStmt(pCxt, yymsp[-1].minor.yy448, yymsp[0].minor.yy448); }
break;
- case 353: /* insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */
-{ yymsp[-6].minor.yy712 = createInsertStmt(pCxt, yymsp[-4].minor.yy712, yymsp[-2].minor.yy274, yymsp[0].minor.yy712); }
+ case 355: /* insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */
+{ yymsp[-6].minor.yy448 = createInsertStmt(pCxt, yymsp[-4].minor.yy448, yymsp[-2].minor.yy432, yymsp[0].minor.yy448); }
break;
- case 354: /* insert_query ::= INSERT INTO full_table_name query_or_subquery */
-{ yymsp[-3].minor.yy712 = createInsertStmt(pCxt, yymsp[-1].minor.yy712, NULL, yymsp[0].minor.yy712); }
+ case 356: /* insert_query ::= INSERT INTO full_table_name query_or_subquery */
+{ yymsp[-3].minor.yy448 = createInsertStmt(pCxt, yymsp[-1].minor.yy448, NULL, yymsp[0].minor.yy448); }
break;
- case 355: /* literal ::= NK_INTEGER */
-{ yylhsminor.yy712 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0)); }
- yymsp[0].minor.yy712 = yylhsminor.yy712;
+ case 357: /* literal ::= NK_INTEGER */
+{ yylhsminor.yy448 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy448 = yylhsminor.yy448;
break;
- case 356: /* literal ::= NK_FLOAT */
-{ yylhsminor.yy712 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); }
- yymsp[0].minor.yy712 = yylhsminor.yy712;
+ case 358: /* literal ::= NK_FLOAT */
+{ yylhsminor.yy448 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy448 = yylhsminor.yy448;
break;
- case 357: /* literal ::= NK_STRING */
-{ yylhsminor.yy712 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); }
- yymsp[0].minor.yy712 = yylhsminor.yy712;
+ case 359: /* literal ::= NK_STRING */
+{ yylhsminor.yy448 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy448 = yylhsminor.yy448;
break;
- case 358: /* literal ::= NK_BOOL */
-{ yylhsminor.yy712 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); }
- yymsp[0].minor.yy712 = yylhsminor.yy712;
+ case 360: /* literal ::= NK_BOOL */
+{ yylhsminor.yy448 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy448 = yylhsminor.yy448;
break;
- case 359: /* literal ::= TIMESTAMP NK_STRING */
-{ yylhsminor.yy712 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); }
- yymsp[-1].minor.yy712 = yylhsminor.yy712;
+ case 361: /* literal ::= TIMESTAMP NK_STRING */
+{ yylhsminor.yy448 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); }
+ yymsp[-1].minor.yy448 = yylhsminor.yy448;
break;
- case 360: /* literal ::= duration_literal */
- case 370: /* signed_literal ::= signed */ yytestcase(yyruleno==370);
- case 391: /* expr_or_subquery ::= expression */ yytestcase(yyruleno==391);
- case 392: /* expression ::= literal */ yytestcase(yyruleno==392);
- case 393: /* expression ::= pseudo_column */ yytestcase(yyruleno==393);
- case 394: /* expression ::= column_reference */ yytestcase(yyruleno==394);
- case 395: /* expression ::= function_expression */ yytestcase(yyruleno==395);
- case 396: /* expression ::= case_when_expression */ yytestcase(yyruleno==396);
- case 427: /* function_expression ::= literal_func */ yytestcase(yyruleno==427);
- case 476: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==476);
- case 480: /* boolean_primary ::= predicate */ yytestcase(yyruleno==480);
- case 482: /* common_expression ::= expr_or_subquery */ yytestcase(yyruleno==482);
- case 483: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==483);
- case 486: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==486);
- case 488: /* table_reference ::= table_primary */ yytestcase(yyruleno==488);
- case 489: /* table_reference ::= joined_table */ yytestcase(yyruleno==489);
- case 493: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==493);
- case 551: /* query_simple ::= query_specification */ yytestcase(yyruleno==551);
- case 552: /* query_simple ::= union_query_expression */ yytestcase(yyruleno==552);
- case 555: /* query_simple_or_subquery ::= query_simple */ yytestcase(yyruleno==555);
- case 557: /* query_or_subquery ::= query_expression */ yytestcase(yyruleno==557);
-{ yylhsminor.yy712 = yymsp[0].minor.yy712; }
- yymsp[0].minor.yy712 = yylhsminor.yy712;
+ case 362: /* literal ::= duration_literal */
+ case 372: /* signed_literal ::= signed */ yytestcase(yyruleno==372);
+ case 393: /* expr_or_subquery ::= expression */ yytestcase(yyruleno==393);
+ case 394: /* expression ::= literal */ yytestcase(yyruleno==394);
+ case 395: /* expression ::= pseudo_column */ yytestcase(yyruleno==395);
+ case 396: /* expression ::= column_reference */ yytestcase(yyruleno==396);
+ case 397: /* expression ::= function_expression */ yytestcase(yyruleno==397);
+ case 398: /* expression ::= case_when_expression */ yytestcase(yyruleno==398);
+ case 429: /* function_expression ::= literal_func */ yytestcase(yyruleno==429);
+ case 478: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==478);
+ case 482: /* boolean_primary ::= predicate */ yytestcase(yyruleno==482);
+ case 484: /* common_expression ::= expr_or_subquery */ yytestcase(yyruleno==484);
+ case 485: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==485);
+ case 488: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==488);
+ case 490: /* table_reference ::= table_primary */ yytestcase(yyruleno==490);
+ case 491: /* table_reference ::= joined_table */ yytestcase(yyruleno==491);
+ case 495: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==495);
+ case 553: /* query_simple ::= query_specification */ yytestcase(yyruleno==553);
+ case 554: /* query_simple ::= union_query_expression */ yytestcase(yyruleno==554);
+ case 557: /* query_simple_or_subquery ::= query_simple */ yytestcase(yyruleno==557);
+ case 559: /* query_or_subquery ::= query_expression */ yytestcase(yyruleno==559);
+{ yylhsminor.yy448 = yymsp[0].minor.yy448; }
+ yymsp[0].minor.yy448 = yylhsminor.yy448;
break;
- case 361: /* literal ::= NULL */
-{ yylhsminor.yy712 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0)); }
- yymsp[0].minor.yy712 = yylhsminor.yy712;
+ case 363: /* literal ::= NULL */
+{ yylhsminor.yy448 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy448 = yylhsminor.yy448;
break;
- case 362: /* literal ::= NK_QUESTION */
-{ yylhsminor.yy712 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0)); }
- yymsp[0].minor.yy712 = yylhsminor.yy712;
+ case 364: /* literal ::= NK_QUESTION */
+{ yylhsminor.yy448 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy448 = yylhsminor.yy448;
break;
- case 363: /* duration_literal ::= NK_VARIABLE */
-{ yylhsminor.yy712 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); }
- yymsp[0].minor.yy712 = yylhsminor.yy712;
+ case 365: /* duration_literal ::= NK_VARIABLE */
+{ yylhsminor.yy448 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy448 = yylhsminor.yy448;
break;
- case 364: /* signed ::= NK_INTEGER */
-{ yylhsminor.yy712 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); }
- yymsp[0].minor.yy712 = yylhsminor.yy712;
+ case 366: /* signed ::= NK_INTEGER */
+{ yylhsminor.yy448 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); }
+ yymsp[0].minor.yy448 = yylhsminor.yy448;
break;
- case 365: /* signed ::= NK_PLUS NK_INTEGER */
-{ yymsp[-1].minor.yy712 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); }
+ case 367: /* signed ::= NK_PLUS NK_INTEGER */
+{ yymsp[-1].minor.yy448 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); }
break;
- case 366: /* signed ::= NK_MINUS NK_INTEGER */
+ case 368: /* 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.yy712 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &t);
+ yylhsminor.yy448 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &t);
}
- yymsp[-1].minor.yy712 = yylhsminor.yy712;
+ yymsp[-1].minor.yy448 = yylhsminor.yy448;
break;
- case 367: /* signed ::= NK_FLOAT */
-{ yylhsminor.yy712 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); }
- yymsp[0].minor.yy712 = yylhsminor.yy712;
+ case 369: /* signed ::= NK_FLOAT */
+{ yylhsminor.yy448 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); }
+ yymsp[0].minor.yy448 = yylhsminor.yy448;
break;
- case 368: /* signed ::= NK_PLUS NK_FLOAT */
-{ yymsp[-1].minor.yy712 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); }
+ case 370: /* signed ::= NK_PLUS NK_FLOAT */
+{ yymsp[-1].minor.yy448 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); }
break;
- case 369: /* signed ::= NK_MINUS NK_FLOAT */
+ case 371: /* 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.yy712 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t);
+ yylhsminor.yy448 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t);
}
- yymsp[-1].minor.yy712 = yylhsminor.yy712;
+ yymsp[-1].minor.yy448 = yylhsminor.yy448;
break;
- case 371: /* signed_literal ::= NK_STRING */
-{ yylhsminor.yy712 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); }
- yymsp[0].minor.yy712 = yylhsminor.yy712;
+ case 373: /* signed_literal ::= NK_STRING */
+{ yylhsminor.yy448 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); }
+ yymsp[0].minor.yy448 = yylhsminor.yy448;
break;
- case 372: /* signed_literal ::= NK_BOOL */
-{ yylhsminor.yy712 = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0); }
- yymsp[0].minor.yy712 = yylhsminor.yy712;
+ case 374: /* signed_literal ::= NK_BOOL */
+{ yylhsminor.yy448 = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0); }
+ yymsp[0].minor.yy448 = yylhsminor.yy448;
break;
- case 373: /* signed_literal ::= TIMESTAMP NK_STRING */
-{ yymsp[-1].minor.yy712 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); }
+ case 375: /* signed_literal ::= TIMESTAMP NK_STRING */
+{ yymsp[-1].minor.yy448 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); }
break;
- case 374: /* signed_literal ::= duration_literal */
- case 376: /* signed_literal ::= literal_func */ yytestcase(yyruleno==376);
- case 447: /* star_func_para ::= expr_or_subquery */ yytestcase(yyruleno==447);
- case 509: /* select_item ::= common_expression */ yytestcase(yyruleno==509);
- case 519: /* partition_item ::= expr_or_subquery */ yytestcase(yyruleno==519);
- case 556: /* query_simple_or_subquery ::= subquery */ yytestcase(yyruleno==556);
- case 558: /* query_or_subquery ::= subquery */ yytestcase(yyruleno==558);
- case 571: /* search_condition ::= common_expression */ yytestcase(yyruleno==571);
-{ yylhsminor.yy712 = releaseRawExprNode(pCxt, yymsp[0].minor.yy712); }
- yymsp[0].minor.yy712 = yylhsminor.yy712;
+ case 376: /* signed_literal ::= duration_literal */
+ case 378: /* signed_literal ::= literal_func */ yytestcase(yyruleno==378);
+ case 449: /* star_func_para ::= expr_or_subquery */ yytestcase(yyruleno==449);
+ case 511: /* select_item ::= common_expression */ yytestcase(yyruleno==511);
+ case 521: /* partition_item ::= expr_or_subquery */ yytestcase(yyruleno==521);
+ case 558: /* query_simple_or_subquery ::= subquery */ yytestcase(yyruleno==558);
+ case 560: /* query_or_subquery ::= subquery */ yytestcase(yyruleno==560);
+ case 573: /* search_condition ::= common_expression */ yytestcase(yyruleno==573);
+{ yylhsminor.yy448 = releaseRawExprNode(pCxt, yymsp[0].minor.yy448); }
+ yymsp[0].minor.yy448 = yylhsminor.yy448;
break;
- case 375: /* signed_literal ::= NULL */
-{ yylhsminor.yy712 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0); }
- yymsp[0].minor.yy712 = yylhsminor.yy712;
+ case 377: /* signed_literal ::= NULL */
+{ yylhsminor.yy448 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0); }
+ yymsp[0].minor.yy448 = yylhsminor.yy448;
break;
- case 377: /* signed_literal ::= NK_QUESTION */
-{ yylhsminor.yy712 = createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0); }
- yymsp[0].minor.yy712 = yylhsminor.yy712;
+ case 379: /* signed_literal ::= NK_QUESTION */
+{ yylhsminor.yy448 = createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0); }
+ yymsp[0].minor.yy448 = yylhsminor.yy448;
break;
- case 397: /* expression ::= NK_LP expression NK_RP */
- case 481: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==481);
- case 570: /* subquery ::= NK_LP subquery NK_RP */ yytestcase(yyruleno==570);
-{ yylhsminor.yy712 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy712)); }
- yymsp[-2].minor.yy712 = yylhsminor.yy712;
+ case 399: /* expression ::= NK_LP expression NK_RP */
+ case 483: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==483);
+ case 572: /* subquery ::= NK_LP subquery NK_RP */ yytestcase(yyruleno==572);
+{ yylhsminor.yy448 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy448)); }
+ yymsp[-2].minor.yy448 = yylhsminor.yy448;
break;
- case 398: /* expression ::= NK_PLUS expr_or_subquery */
+ case 400: /* expression ::= NK_PLUS expr_or_subquery */
{
- SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy712);
- yylhsminor.yy712 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy712));
+ SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy448);
+ yylhsminor.yy448 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy448));
}
- yymsp[-1].minor.yy712 = yylhsminor.yy712;
+ yymsp[-1].minor.yy448 = yylhsminor.yy448;
break;
- case 399: /* expression ::= NK_MINUS expr_or_subquery */
+ case 401: /* expression ::= NK_MINUS expr_or_subquery */
{
- SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy712);
- yylhsminor.yy712 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_MINUS, releaseRawExprNode(pCxt, yymsp[0].minor.yy712), NULL));
+ SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy448);
+ yylhsminor.yy448 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_MINUS, releaseRawExprNode(pCxt, yymsp[0].minor.yy448), NULL));
}
- yymsp[-1].minor.yy712 = yylhsminor.yy712;
+ yymsp[-1].minor.yy448 = yylhsminor.yy448;
break;
- case 400: /* expression ::= expr_or_subquery NK_PLUS expr_or_subquery */
+ case 402: /* expression ::= expr_or_subquery NK_PLUS expr_or_subquery */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy712);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy712);
- yylhsminor.yy712 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_ADD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy712), releaseRawExprNode(pCxt, yymsp[0].minor.yy712)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy448);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy448);
+ yylhsminor.yy448 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_ADD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy448), releaseRawExprNode(pCxt, yymsp[0].minor.yy448)));
}
- yymsp[-2].minor.yy712 = yylhsminor.yy712;
+ yymsp[-2].minor.yy448 = yylhsminor.yy448;
break;
- case 401: /* expression ::= expr_or_subquery NK_MINUS expr_or_subquery */
+ case 403: /* expression ::= expr_or_subquery NK_MINUS expr_or_subquery */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy712);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy712);
- yylhsminor.yy712 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[-2].minor.yy712), releaseRawExprNode(pCxt, yymsp[0].minor.yy712)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy448);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy448);
+ yylhsminor.yy448 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[-2].minor.yy448), releaseRawExprNode(pCxt, yymsp[0].minor.yy448)));
}
- yymsp[-2].minor.yy712 = yylhsminor.yy712;
+ yymsp[-2].minor.yy448 = yylhsminor.yy448;
break;
- case 402: /* expression ::= expr_or_subquery NK_STAR expr_or_subquery */
+ case 404: /* expression ::= expr_or_subquery NK_STAR expr_or_subquery */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy712);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy712);
- yylhsminor.yy712 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MULTI, releaseRawExprNode(pCxt, yymsp[-2].minor.yy712), releaseRawExprNode(pCxt, yymsp[0].minor.yy712)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy448);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy448);
+ yylhsminor.yy448 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MULTI, releaseRawExprNode(pCxt, yymsp[-2].minor.yy448), releaseRawExprNode(pCxt, yymsp[0].minor.yy448)));
}
- yymsp[-2].minor.yy712 = yylhsminor.yy712;
+ yymsp[-2].minor.yy448 = yylhsminor.yy448;
break;
- case 403: /* expression ::= expr_or_subquery NK_SLASH expr_or_subquery */
+ case 405: /* expression ::= expr_or_subquery NK_SLASH expr_or_subquery */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy712);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy712);
- yylhsminor.yy712 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_DIV, releaseRawExprNode(pCxt, yymsp[-2].minor.yy712), releaseRawExprNode(pCxt, yymsp[0].minor.yy712)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy448);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy448);
+ yylhsminor.yy448 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_DIV, releaseRawExprNode(pCxt, yymsp[-2].minor.yy448), releaseRawExprNode(pCxt, yymsp[0].minor.yy448)));
}
- yymsp[-2].minor.yy712 = yylhsminor.yy712;
+ yymsp[-2].minor.yy448 = yylhsminor.yy448;
break;
- case 404: /* expression ::= expr_or_subquery NK_REM expr_or_subquery */
+ case 406: /* expression ::= expr_or_subquery NK_REM expr_or_subquery */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy712);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy712);
- yylhsminor.yy712 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_REM, releaseRawExprNode(pCxt, yymsp[-2].minor.yy712), releaseRawExprNode(pCxt, yymsp[0].minor.yy712)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy448);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy448);
+ yylhsminor.yy448 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_REM, releaseRawExprNode(pCxt, yymsp[-2].minor.yy448), releaseRawExprNode(pCxt, yymsp[0].minor.yy448)));
}
- yymsp[-2].minor.yy712 = yylhsminor.yy712;
+ yymsp[-2].minor.yy448 = yylhsminor.yy448;
break;
- case 405: /* expression ::= column_reference NK_ARROW NK_STRING */
+ case 407: /* expression ::= column_reference NK_ARROW NK_STRING */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy712);
- yylhsminor.yy712 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_JSON_GET_VALUE, releaseRawExprNode(pCxt, yymsp[-2].minor.yy712), createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy448);
+ yylhsminor.yy448 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_JSON_GET_VALUE, releaseRawExprNode(pCxt, yymsp[-2].minor.yy448), createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)));
}
- yymsp[-2].minor.yy712 = yylhsminor.yy712;
+ yymsp[-2].minor.yy448 = yylhsminor.yy448;
break;
- case 406: /* expression ::= expr_or_subquery NK_BITAND expr_or_subquery */
+ case 408: /* expression ::= expr_or_subquery NK_BITAND expr_or_subquery */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy712);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy712);
- yylhsminor.yy712 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy712), releaseRawExprNode(pCxt, yymsp[0].minor.yy712)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy448);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy448);
+ yylhsminor.yy448 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy448), releaseRawExprNode(pCxt, yymsp[0].minor.yy448)));
}
- yymsp[-2].minor.yy712 = yylhsminor.yy712;
+ yymsp[-2].minor.yy448 = yylhsminor.yy448;
break;
- case 407: /* expression ::= expr_or_subquery NK_BITOR expr_or_subquery */
+ case 409: /* expression ::= expr_or_subquery NK_BITOR expr_or_subquery */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy712);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy712);
- yylhsminor.yy712 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy712), releaseRawExprNode(pCxt, yymsp[0].minor.yy712)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy448);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy448);
+ yylhsminor.yy448 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy448), releaseRawExprNode(pCxt, yymsp[0].minor.yy448)));
}
- yymsp[-2].minor.yy712 = yylhsminor.yy712;
+ yymsp[-2].minor.yy448 = yylhsminor.yy448;
break;
- case 410: /* column_reference ::= column_name */
-{ yylhsminor.yy712 = createRawExprNode(pCxt, &yymsp[0].minor.yy129, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy129)); }
- yymsp[0].minor.yy712 = yylhsminor.yy712;
+ case 412: /* column_reference ::= column_name */
+{ yylhsminor.yy448 = createRawExprNode(pCxt, &yymsp[0].minor.yy113, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy113)); }
+ yymsp[0].minor.yy448 = yylhsminor.yy448;
break;
- case 411: /* column_reference ::= table_name NK_DOT column_name */
-{ yylhsminor.yy712 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy129, &yymsp[0].minor.yy129, createColumnNode(pCxt, &yymsp[-2].minor.yy129, &yymsp[0].minor.yy129)); }
- yymsp[-2].minor.yy712 = yylhsminor.yy712;
+ case 413: /* column_reference ::= table_name NK_DOT column_name */
+{ yylhsminor.yy448 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy113, &yymsp[0].minor.yy113, createColumnNode(pCxt, &yymsp[-2].minor.yy113, &yymsp[0].minor.yy113)); }
+ yymsp[-2].minor.yy448 = yylhsminor.yy448;
break;
- case 412: /* pseudo_column ::= ROWTS */
- case 413: /* pseudo_column ::= TBNAME */ yytestcase(yyruleno==413);
- case 415: /* pseudo_column ::= QSTART */ yytestcase(yyruleno==415);
- case 416: /* pseudo_column ::= QEND */ yytestcase(yyruleno==416);
- case 417: /* pseudo_column ::= QDURATION */ yytestcase(yyruleno==417);
- case 418: /* pseudo_column ::= WSTART */ yytestcase(yyruleno==418);
- case 419: /* pseudo_column ::= WEND */ yytestcase(yyruleno==419);
- case 420: /* pseudo_column ::= WDURATION */ yytestcase(yyruleno==420);
- case 421: /* pseudo_column ::= IROWTS */ yytestcase(yyruleno==421);
- case 422: /* pseudo_column ::= ISFILLED */ yytestcase(yyruleno==422);
- case 423: /* pseudo_column ::= QTAGS */ yytestcase(yyruleno==423);
- case 429: /* literal_func ::= NOW */ yytestcase(yyruleno==429);
-{ yylhsminor.yy712 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); }
- yymsp[0].minor.yy712 = yylhsminor.yy712;
+ case 414: /* pseudo_column ::= ROWTS */
+ case 415: /* pseudo_column ::= TBNAME */ yytestcase(yyruleno==415);
+ case 417: /* pseudo_column ::= QSTART */ yytestcase(yyruleno==417);
+ case 418: /* pseudo_column ::= QEND */ yytestcase(yyruleno==418);
+ case 419: /* pseudo_column ::= QDURATION */ yytestcase(yyruleno==419);
+ case 420: /* pseudo_column ::= WSTART */ yytestcase(yyruleno==420);
+ case 421: /* pseudo_column ::= WEND */ yytestcase(yyruleno==421);
+ case 422: /* pseudo_column ::= WDURATION */ yytestcase(yyruleno==422);
+ case 423: /* pseudo_column ::= IROWTS */ yytestcase(yyruleno==423);
+ case 424: /* pseudo_column ::= ISFILLED */ yytestcase(yyruleno==424);
+ case 425: /* pseudo_column ::= QTAGS */ yytestcase(yyruleno==425);
+ case 431: /* literal_func ::= NOW */ yytestcase(yyruleno==431);
+{ yylhsminor.yy448 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); }
+ yymsp[0].minor.yy448 = yylhsminor.yy448;
break;
- case 414: /* pseudo_column ::= table_name NK_DOT TBNAME */
-{ yylhsminor.yy712 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy129, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-2].minor.yy129)))); }
- yymsp[-2].minor.yy712 = yylhsminor.yy712;
+ case 416: /* pseudo_column ::= table_name NK_DOT TBNAME */
+{ yylhsminor.yy448 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy113, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-2].minor.yy113)))); }
+ yymsp[-2].minor.yy448 = yylhsminor.yy448;
break;
- case 424: /* function_expression ::= function_name NK_LP expression_list NK_RP */
- case 425: /* function_expression ::= star_func NK_LP star_func_para_list NK_RP */ yytestcase(yyruleno==425);
-{ yylhsminor.yy712 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy129, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy129, yymsp[-1].minor.yy274)); }
- yymsp[-3].minor.yy712 = yylhsminor.yy712;
+ case 426: /* function_expression ::= function_name NK_LP expression_list NK_RP */
+ case 427: /* function_expression ::= star_func NK_LP star_func_para_list NK_RP */ yytestcase(yyruleno==427);
+{ yylhsminor.yy448 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy113, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy113, yymsp[-1].minor.yy432)); }
+ yymsp[-3].minor.yy448 = yylhsminor.yy448;
break;
- case 426: /* function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */
-{ yylhsminor.yy712 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createCastFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy712), yymsp[-1].minor.yy184)); }
- yymsp[-5].minor.yy712 = yylhsminor.yy712;
+ case 428: /* function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */
+{ yylhsminor.yy448 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createCastFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy448), yymsp[-1].minor.yy728)); }
+ yymsp[-5].minor.yy448 = yylhsminor.yy448;
break;
- case 428: /* literal_func ::= noarg_func NK_LP NK_RP */
-{ yylhsminor.yy712 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy129, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-2].minor.yy129, NULL)); }
- yymsp[-2].minor.yy712 = yylhsminor.yy712;
+ case 430: /* literal_func ::= noarg_func NK_LP NK_RP */
+{ yylhsminor.yy448 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy113, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-2].minor.yy113, NULL)); }
+ yymsp[-2].minor.yy448 = yylhsminor.yy448;
break;
- case 443: /* star_func_para_list ::= NK_STAR */
-{ yylhsminor.yy274 = createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); }
- yymsp[0].minor.yy274 = yylhsminor.yy274;
+ case 445: /* star_func_para_list ::= NK_STAR */
+{ yylhsminor.yy432 = createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy432 = yylhsminor.yy432;
break;
- case 448: /* star_func_para ::= table_name NK_DOT NK_STAR */
- case 512: /* select_item ::= table_name NK_DOT NK_STAR */ yytestcase(yyruleno==512);
-{ yylhsminor.yy712 = createColumnNode(pCxt, &yymsp[-2].minor.yy129, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy712 = yylhsminor.yy712;
+ case 450: /* star_func_para ::= table_name NK_DOT NK_STAR */
+ case 514: /* select_item ::= table_name NK_DOT NK_STAR */ yytestcase(yyruleno==514);
+{ yylhsminor.yy448 = createColumnNode(pCxt, &yymsp[-2].minor.yy113, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy448 = yylhsminor.yy448;
break;
- case 449: /* case_when_expression ::= CASE when_then_list case_when_else_opt END */
-{ yylhsminor.yy712 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, NULL, yymsp[-2].minor.yy274, yymsp[-1].minor.yy712)); }
- yymsp[-3].minor.yy712 = yylhsminor.yy712;
+ case 451: /* case_when_expression ::= CASE when_then_list case_when_else_opt END */
+{ yylhsminor.yy448 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, NULL, yymsp[-2].minor.yy432, yymsp[-1].minor.yy448)); }
+ yymsp[-3].minor.yy448 = yylhsminor.yy448;
break;
- case 450: /* case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */
-{ yylhsminor.yy712 = createRawExprNodeExt(pCxt, &yymsp[-4].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy712), yymsp[-2].minor.yy274, yymsp[-1].minor.yy712)); }
- yymsp[-4].minor.yy712 = yylhsminor.yy712;
+ case 452: /* case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */
+{ yylhsminor.yy448 = createRawExprNodeExt(pCxt, &yymsp[-4].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy448), yymsp[-2].minor.yy432, yymsp[-1].minor.yy448)); }
+ yymsp[-4].minor.yy448 = yylhsminor.yy448;
break;
- case 453: /* when_then_expr ::= WHEN common_expression THEN common_expression */
-{ yymsp[-3].minor.yy712 = createWhenThenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy712), releaseRawExprNode(pCxt, yymsp[0].minor.yy712)); }
+ case 455: /* when_then_expr ::= WHEN common_expression THEN common_expression */
+{ yymsp[-3].minor.yy448 = createWhenThenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy448), releaseRawExprNode(pCxt, yymsp[0].minor.yy448)); }
break;
- case 455: /* case_when_else_opt ::= ELSE common_expression */
-{ yymsp[-1].minor.yy712 = releaseRawExprNode(pCxt, yymsp[0].minor.yy712); }
+ case 457: /* case_when_else_opt ::= ELSE common_expression */
+{ yymsp[-1].minor.yy448 = releaseRawExprNode(pCxt, yymsp[0].minor.yy448); }
break;
- case 456: /* predicate ::= expr_or_subquery compare_op expr_or_subquery */
- case 461: /* predicate ::= expr_or_subquery in_op in_predicate_value */ yytestcase(yyruleno==461);
+ case 458: /* predicate ::= expr_or_subquery compare_op expr_or_subquery */
+ case 463: /* predicate ::= expr_or_subquery in_op in_predicate_value */ yytestcase(yyruleno==463);
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy712);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy712);
- yylhsminor.yy712 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, yymsp[-1].minor.yy440, releaseRawExprNode(pCxt, yymsp[-2].minor.yy712), releaseRawExprNode(pCxt, yymsp[0].minor.yy712)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy448);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy448);
+ yylhsminor.yy448 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, yymsp[-1].minor.yy156, releaseRawExprNode(pCxt, yymsp[-2].minor.yy448), releaseRawExprNode(pCxt, yymsp[0].minor.yy448)));
}
- yymsp[-2].minor.yy712 = yylhsminor.yy712;
+ yymsp[-2].minor.yy448 = yylhsminor.yy448;
break;
- case 457: /* predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */
+ case 459: /* predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy712);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy712);
- yylhsminor.yy712 = createRawExprNodeExt(pCxt, &s, &e, createBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-4].minor.yy712), releaseRawExprNode(pCxt, yymsp[-2].minor.yy712), releaseRawExprNode(pCxt, yymsp[0].minor.yy712)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy448);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy448);
+ yylhsminor.yy448 = createRawExprNodeExt(pCxt, &s, &e, createBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-4].minor.yy448), releaseRawExprNode(pCxt, yymsp[-2].minor.yy448), releaseRawExprNode(pCxt, yymsp[0].minor.yy448)));
}
- yymsp[-4].minor.yy712 = yylhsminor.yy712;
+ yymsp[-4].minor.yy448 = yylhsminor.yy448;
break;
- case 458: /* predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */
+ case 460: /* predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy712);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy712);
- yylhsminor.yy712 = createRawExprNodeExt(pCxt, &s, &e, createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy712), releaseRawExprNode(pCxt, yymsp[-2].minor.yy712), releaseRawExprNode(pCxt, yymsp[0].minor.yy712)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy448);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy448);
+ yylhsminor.yy448 = createRawExprNodeExt(pCxt, &s, &e, createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy448), releaseRawExprNode(pCxt, yymsp[-2].minor.yy448), releaseRawExprNode(pCxt, yymsp[0].minor.yy448)));
}
- yymsp[-5].minor.yy712 = yylhsminor.yy712;
+ yymsp[-5].minor.yy448 = yylhsminor.yy448;
break;
- case 459: /* predicate ::= expr_or_subquery IS NULL */
+ case 461: /* predicate ::= expr_or_subquery IS NULL */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy712);
- yylhsminor.yy712 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy712), NULL));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy448);
+ yylhsminor.yy448 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy448), NULL));
}
- yymsp[-2].minor.yy712 = yylhsminor.yy712;
+ yymsp[-2].minor.yy448 = yylhsminor.yy448;
break;
- case 460: /* predicate ::= expr_or_subquery IS NOT NULL */
+ case 462: /* predicate ::= expr_or_subquery IS NOT NULL */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy712);
- yylhsminor.yy712 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy712), NULL));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy448);
+ yylhsminor.yy448 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy448), NULL));
}
- yymsp[-3].minor.yy712 = yylhsminor.yy712;
+ yymsp[-3].minor.yy448 = yylhsminor.yy448;
break;
- case 462: /* compare_op ::= NK_LT */
-{ yymsp[0].minor.yy440 = OP_TYPE_LOWER_THAN; }
+ case 464: /* compare_op ::= NK_LT */
+{ yymsp[0].minor.yy156 = OP_TYPE_LOWER_THAN; }
break;
- case 463: /* compare_op ::= NK_GT */
-{ yymsp[0].minor.yy440 = OP_TYPE_GREATER_THAN; }
+ case 465: /* compare_op ::= NK_GT */
+{ yymsp[0].minor.yy156 = OP_TYPE_GREATER_THAN; }
break;
- case 464: /* compare_op ::= NK_LE */
-{ yymsp[0].minor.yy440 = OP_TYPE_LOWER_EQUAL; }
+ case 466: /* compare_op ::= NK_LE */
+{ yymsp[0].minor.yy156 = OP_TYPE_LOWER_EQUAL; }
break;
- case 465: /* compare_op ::= NK_GE */
-{ yymsp[0].minor.yy440 = OP_TYPE_GREATER_EQUAL; }
+ case 467: /* compare_op ::= NK_GE */
+{ yymsp[0].minor.yy156 = OP_TYPE_GREATER_EQUAL; }
break;
- case 466: /* compare_op ::= NK_NE */
-{ yymsp[0].minor.yy440 = OP_TYPE_NOT_EQUAL; }
+ case 468: /* compare_op ::= NK_NE */
+{ yymsp[0].minor.yy156 = OP_TYPE_NOT_EQUAL; }
break;
- case 467: /* compare_op ::= NK_EQ */
-{ yymsp[0].minor.yy440 = OP_TYPE_EQUAL; }
+ case 469: /* compare_op ::= NK_EQ */
+{ yymsp[0].minor.yy156 = OP_TYPE_EQUAL; }
break;
- case 468: /* compare_op ::= LIKE */
-{ yymsp[0].minor.yy440 = OP_TYPE_LIKE; }
+ case 470: /* compare_op ::= LIKE */
+{ yymsp[0].minor.yy156 = OP_TYPE_LIKE; }
break;
- case 469: /* compare_op ::= NOT LIKE */
-{ yymsp[-1].minor.yy440 = OP_TYPE_NOT_LIKE; }
+ case 471: /* compare_op ::= NOT LIKE */
+{ yymsp[-1].minor.yy156 = OP_TYPE_NOT_LIKE; }
break;
- case 470: /* compare_op ::= MATCH */
-{ yymsp[0].minor.yy440 = OP_TYPE_MATCH; }
+ case 472: /* compare_op ::= MATCH */
+{ yymsp[0].minor.yy156 = OP_TYPE_MATCH; }
break;
- case 471: /* compare_op ::= NMATCH */
-{ yymsp[0].minor.yy440 = OP_TYPE_NMATCH; }
+ case 473: /* compare_op ::= NMATCH */
+{ yymsp[0].minor.yy156 = OP_TYPE_NMATCH; }
break;
- case 472: /* compare_op ::= CONTAINS */
-{ yymsp[0].minor.yy440 = OP_TYPE_JSON_CONTAINS; }
+ case 474: /* compare_op ::= CONTAINS */
+{ yymsp[0].minor.yy156 = OP_TYPE_JSON_CONTAINS; }
break;
- case 473: /* in_op ::= IN */
-{ yymsp[0].minor.yy440 = OP_TYPE_IN; }
+ case 475: /* in_op ::= IN */
+{ yymsp[0].minor.yy156 = OP_TYPE_IN; }
break;
- case 474: /* in_op ::= NOT IN */
-{ yymsp[-1].minor.yy440 = OP_TYPE_NOT_IN; }
+ case 476: /* in_op ::= NOT IN */
+{ yymsp[-1].minor.yy156 = OP_TYPE_NOT_IN; }
break;
- case 475: /* in_predicate_value ::= NK_LP literal_list NK_RP */
-{ yylhsminor.yy712 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy274)); }
- yymsp[-2].minor.yy712 = yylhsminor.yy712;
+ case 477: /* in_predicate_value ::= NK_LP literal_list NK_RP */
+{ yylhsminor.yy448 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy432)); }
+ yymsp[-2].minor.yy448 = yylhsminor.yy448;
break;
- case 477: /* boolean_value_expression ::= NOT boolean_primary */
+ case 479: /* boolean_value_expression ::= NOT boolean_primary */
{
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy712);
- yylhsminor.yy712 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy712), NULL));
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy448);
+ yylhsminor.yy448 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy448), NULL));
}
- yymsp[-1].minor.yy712 = yylhsminor.yy712;
+ yymsp[-1].minor.yy448 = yylhsminor.yy448;
break;
- case 478: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */
+ case 480: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy712);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy712);
- yylhsminor.yy712 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy712), releaseRawExprNode(pCxt, yymsp[0].minor.yy712)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy448);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy448);
+ yylhsminor.yy448 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy448), releaseRawExprNode(pCxt, yymsp[0].minor.yy448)));
}
- yymsp[-2].minor.yy712 = yylhsminor.yy712;
+ yymsp[-2].minor.yy448 = yylhsminor.yy448;
break;
- case 479: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */
+ case 481: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy712);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy712);
- yylhsminor.yy712 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy712), releaseRawExprNode(pCxt, yymsp[0].minor.yy712)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy448);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy448);
+ yylhsminor.yy448 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy448), releaseRawExprNode(pCxt, yymsp[0].minor.yy448)));
}
- yymsp[-2].minor.yy712 = yylhsminor.yy712;
+ yymsp[-2].minor.yy448 = yylhsminor.yy448;
break;
- case 485: /* from_clause_opt ::= FROM table_reference_list */
- case 514: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==514);
- case 545: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==545);
-{ yymsp[-1].minor.yy712 = yymsp[0].minor.yy712; }
+ case 489: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */
+{ yylhsminor.yy448 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, yymsp[-2].minor.yy448, yymsp[0].minor.yy448, NULL); }
+ yymsp[-2].minor.yy448 = yylhsminor.yy448;
break;
- case 487: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */
-{ yylhsminor.yy712 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, yymsp[-2].minor.yy712, yymsp[0].minor.yy712, NULL); }
- yymsp[-2].minor.yy712 = yylhsminor.yy712;
+ case 492: /* table_primary ::= table_name alias_opt */
+{ yylhsminor.yy448 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy113, &yymsp[0].minor.yy113); }
+ yymsp[-1].minor.yy448 = yylhsminor.yy448;
break;
- case 490: /* table_primary ::= table_name alias_opt */
-{ yylhsminor.yy712 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy129, &yymsp[0].minor.yy129); }
- yymsp[-1].minor.yy712 = yylhsminor.yy712;
+ case 493: /* table_primary ::= db_name NK_DOT table_name alias_opt */
+{ yylhsminor.yy448 = createRealTableNode(pCxt, &yymsp[-3].minor.yy113, &yymsp[-1].minor.yy113, &yymsp[0].minor.yy113); }
+ yymsp[-3].minor.yy448 = yylhsminor.yy448;
break;
- case 491: /* table_primary ::= db_name NK_DOT table_name alias_opt */
-{ yylhsminor.yy712 = createRealTableNode(pCxt, &yymsp[-3].minor.yy129, &yymsp[-1].minor.yy129, &yymsp[0].minor.yy129); }
- yymsp[-3].minor.yy712 = yylhsminor.yy712;
+ case 494: /* table_primary ::= subquery alias_opt */
+{ yylhsminor.yy448 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy448), &yymsp[0].minor.yy113); }
+ yymsp[-1].minor.yy448 = yylhsminor.yy448;
break;
- case 492: /* table_primary ::= subquery alias_opt */
-{ yylhsminor.yy712 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy712), &yymsp[0].minor.yy129); }
- yymsp[-1].minor.yy712 = yylhsminor.yy712;
+ case 496: /* alias_opt ::= */
+{ yymsp[1].minor.yy113 = nil_token; }
break;
- case 494: /* alias_opt ::= */
-{ yymsp[1].minor.yy129 = nil_token; }
+ case 498: /* alias_opt ::= AS table_alias */
+{ yymsp[-1].minor.yy113 = yymsp[0].minor.yy113; }
break;
- case 496: /* alias_opt ::= AS table_alias */
-{ yymsp[-1].minor.yy129 = yymsp[0].minor.yy129; }
+ case 499: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */
+ case 500: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==500);
+{ yymsp[-2].minor.yy448 = yymsp[-1].minor.yy448; }
break;
- case 497: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */
- case 498: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==498);
-{ yymsp[-2].minor.yy712 = yymsp[-1].minor.yy712; }
+ case 501: /* joined_table ::= table_reference join_type JOIN table_reference ON search_condition */
+{ yylhsminor.yy448 = createJoinTableNode(pCxt, yymsp[-4].minor.yy596, yymsp[-5].minor.yy448, yymsp[-2].minor.yy448, yymsp[0].minor.yy448); }
+ yymsp[-5].minor.yy448 = yylhsminor.yy448;
break;
- case 499: /* joined_table ::= table_reference join_type JOIN table_reference ON search_condition */
-{ yylhsminor.yy712 = createJoinTableNode(pCxt, yymsp[-4].minor.yy912, yymsp[-5].minor.yy712, yymsp[-2].minor.yy712, yymsp[0].minor.yy712); }
- yymsp[-5].minor.yy712 = yylhsminor.yy712;
+ case 502: /* join_type ::= */
+{ yymsp[1].minor.yy596 = JOIN_TYPE_INNER; }
break;
- case 500: /* join_type ::= */
-{ yymsp[1].minor.yy912 = JOIN_TYPE_INNER; }
+ case 503: /* join_type ::= INNER */
+{ yymsp[0].minor.yy596 = JOIN_TYPE_INNER; }
break;
- case 501: /* join_type ::= INNER */
-{ yymsp[0].minor.yy912 = JOIN_TYPE_INNER; }
- break;
- case 502: /* 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 504: /* 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.yy712 = createSelectStmt(pCxt, yymsp[-10].minor.yy337, yymsp[-9].minor.yy274, yymsp[-8].minor.yy712);
- yymsp[-11].minor.yy712 = addWhereClause(pCxt, yymsp[-11].minor.yy712, yymsp[-7].minor.yy712);
- yymsp[-11].minor.yy712 = addPartitionByClause(pCxt, yymsp[-11].minor.yy712, yymsp[-6].minor.yy274);
- yymsp[-11].minor.yy712 = addWindowClauseClause(pCxt, yymsp[-11].minor.yy712, yymsp[-2].minor.yy712);
- yymsp[-11].minor.yy712 = addGroupByClause(pCxt, yymsp[-11].minor.yy712, yymsp[-1].minor.yy274);
- yymsp[-11].minor.yy712 = addHavingClause(pCxt, yymsp[-11].minor.yy712, yymsp[0].minor.yy712);
- yymsp[-11].minor.yy712 = addRangeClause(pCxt, yymsp[-11].minor.yy712, yymsp[-5].minor.yy712);
- yymsp[-11].minor.yy712 = addEveryClause(pCxt, yymsp[-11].minor.yy712, yymsp[-4].minor.yy712);
- yymsp[-11].minor.yy712 = addFillClause(pCxt, yymsp[-11].minor.yy712, yymsp[-3].minor.yy712);
+ yymsp[-11].minor.yy448 = createSelectStmt(pCxt, yymsp[-10].minor.yy369, yymsp[-9].minor.yy432, yymsp[-8].minor.yy448);
+ yymsp[-11].minor.yy448 = addWhereClause(pCxt, yymsp[-11].minor.yy448, yymsp[-7].minor.yy448);
+ yymsp[-11].minor.yy448 = addPartitionByClause(pCxt, yymsp[-11].minor.yy448, yymsp[-6].minor.yy432);
+ yymsp[-11].minor.yy448 = addWindowClauseClause(pCxt, yymsp[-11].minor.yy448, yymsp[-2].minor.yy448);
+ yymsp[-11].minor.yy448 = addGroupByClause(pCxt, yymsp[-11].minor.yy448, yymsp[-1].minor.yy432);
+ yymsp[-11].minor.yy448 = addHavingClause(pCxt, yymsp[-11].minor.yy448, yymsp[0].minor.yy448);
+ yymsp[-11].minor.yy448 = addRangeClause(pCxt, yymsp[-11].minor.yy448, yymsp[-5].minor.yy448);
+ yymsp[-11].minor.yy448 = addEveryClause(pCxt, yymsp[-11].minor.yy448, yymsp[-4].minor.yy448);
+ yymsp[-11].minor.yy448 = addFillClause(pCxt, yymsp[-11].minor.yy448, yymsp[-3].minor.yy448);
}
break;
- case 505: /* set_quantifier_opt ::= ALL */
-{ yymsp[0].minor.yy337 = false; }
+ case 507: /* set_quantifier_opt ::= ALL */
+{ yymsp[0].minor.yy369 = false; }
break;
- case 508: /* select_item ::= NK_STAR */
-{ yylhsminor.yy712 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0); }
- yymsp[0].minor.yy712 = yylhsminor.yy712;
+ case 510: /* select_item ::= NK_STAR */
+{ yylhsminor.yy448 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0); }
+ yymsp[0].minor.yy448 = yylhsminor.yy448;
break;
- case 510: /* select_item ::= common_expression column_alias */
- case 520: /* partition_item ::= expr_or_subquery column_alias */ yytestcase(yyruleno==520);
-{ yylhsminor.yy712 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy712), &yymsp[0].minor.yy129); }
- yymsp[-1].minor.yy712 = yylhsminor.yy712;
+ case 512: /* select_item ::= common_expression column_alias */
+ case 522: /* partition_item ::= expr_or_subquery column_alias */ yytestcase(yyruleno==522);
+{ yylhsminor.yy448 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy448), &yymsp[0].minor.yy113); }
+ yymsp[-1].minor.yy448 = yylhsminor.yy448;
break;
- case 511: /* select_item ::= common_expression AS column_alias */
- case 521: /* partition_item ::= expr_or_subquery AS column_alias */ yytestcase(yyruleno==521);
-{ yylhsminor.yy712 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy712), &yymsp[0].minor.yy129); }
- yymsp[-2].minor.yy712 = yylhsminor.yy712;
+ case 513: /* select_item ::= common_expression AS column_alias */
+ case 523: /* partition_item ::= expr_or_subquery AS column_alias */ yytestcase(yyruleno==523);
+{ yylhsminor.yy448 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy448), &yymsp[0].minor.yy113); }
+ yymsp[-2].minor.yy448 = yylhsminor.yy448;
break;
- case 516: /* partition_by_clause_opt ::= PARTITION BY partition_list */
- case 541: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==541);
- case 560: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==560);
-{ yymsp[-2].minor.yy274 = yymsp[0].minor.yy274; }
+ case 518: /* partition_by_clause_opt ::= PARTITION BY partition_list */
+ case 543: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==543);
+ case 562: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==562);
+{ yymsp[-2].minor.yy432 = yymsp[0].minor.yy432; }
break;
- case 523: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */
-{ yymsp[-5].minor.yy712 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy712), releaseRawExprNode(pCxt, yymsp[-1].minor.yy712)); }
+ case 525: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */
+{ yymsp[-5].minor.yy448 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy448), releaseRawExprNode(pCxt, yymsp[-1].minor.yy448)); }
break;
- case 524: /* twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */
-{ yymsp[-3].minor.yy712 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy712)); }
+ case 526: /* twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */
+{ yymsp[-3].minor.yy448 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy448)); }
break;
- case 525: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */
-{ yymsp[-5].minor.yy712 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy712), NULL, yymsp[-1].minor.yy712, yymsp[0].minor.yy712); }
+ case 527: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */
+{ yymsp[-5].minor.yy448 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy448), NULL, yymsp[-1].minor.yy448, yymsp[0].minor.yy448); }
break;
- case 526: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */
-{ yymsp[-7].minor.yy712 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy712), releaseRawExprNode(pCxt, yymsp[-3].minor.yy712), yymsp[-1].minor.yy712, yymsp[0].minor.yy712); }
+ case 528: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */
+{ yymsp[-7].minor.yy448 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy448), releaseRawExprNode(pCxt, yymsp[-3].minor.yy448), yymsp[-1].minor.yy448, yymsp[0].minor.yy448); }
break;
- case 527: /* twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */
-{ yymsp[-6].minor.yy712 = createEventWindowNode(pCxt, yymsp[-3].minor.yy712, yymsp[0].minor.yy712); }
+ case 529: /* twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */
+{ yymsp[-6].minor.yy448 = createEventWindowNode(pCxt, yymsp[-3].minor.yy448, yymsp[0].minor.yy448); }
break;
- case 531: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */
-{ yymsp[-3].minor.yy712 = createFillNode(pCxt, yymsp[-1].minor.yy94, NULL); }
+ case 533: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */
+{ yymsp[-3].minor.yy448 = createFillNode(pCxt, yymsp[-1].minor.yy46, NULL); }
break;
- case 532: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */
-{ yymsp[-5].minor.yy712 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy274)); }
+ case 534: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */
+{ yymsp[-5].minor.yy448 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy432)); }
break;
- case 533: /* fill_opt ::= FILL NK_LP VALUE_F NK_COMMA literal_list NK_RP */
-{ yymsp[-5].minor.yy712 = createFillNode(pCxt, FILL_MODE_VALUE_F, createNodeListNode(pCxt, yymsp[-1].minor.yy274)); }
+ case 535: /* fill_opt ::= FILL NK_LP VALUE_F NK_COMMA literal_list NK_RP */
+{ yymsp[-5].minor.yy448 = createFillNode(pCxt, FILL_MODE_VALUE_F, createNodeListNode(pCxt, yymsp[-1].minor.yy432)); }
break;
- case 534: /* fill_mode ::= NONE */
-{ yymsp[0].minor.yy94 = FILL_MODE_NONE; }
+ case 536: /* fill_mode ::= NONE */
+{ yymsp[0].minor.yy46 = FILL_MODE_NONE; }
break;
- case 535: /* fill_mode ::= PREV */
-{ yymsp[0].minor.yy94 = FILL_MODE_PREV; }
+ case 537: /* fill_mode ::= PREV */
+{ yymsp[0].minor.yy46 = FILL_MODE_PREV; }
break;
- case 536: /* fill_mode ::= NULL */
-{ yymsp[0].minor.yy94 = FILL_MODE_NULL; }
+ case 538: /* fill_mode ::= NULL */
+{ yymsp[0].minor.yy46 = FILL_MODE_NULL; }
break;
- case 537: /* fill_mode ::= NULL_F */
-{ yymsp[0].minor.yy94 = FILL_MODE_NULL_F; }
+ case 539: /* fill_mode ::= NULL_F */
+{ yymsp[0].minor.yy46 = FILL_MODE_NULL_F; }
break;
- case 538: /* fill_mode ::= LINEAR */
-{ yymsp[0].minor.yy94 = FILL_MODE_LINEAR; }
+ case 540: /* fill_mode ::= LINEAR */
+{ yymsp[0].minor.yy46 = FILL_MODE_LINEAR; }
break;
- case 539: /* fill_mode ::= NEXT */
-{ yymsp[0].minor.yy94 = FILL_MODE_NEXT; }
+ case 541: /* fill_mode ::= NEXT */
+{ yymsp[0].minor.yy46 = FILL_MODE_NEXT; }
break;
- case 542: /* group_by_list ::= expr_or_subquery */
-{ yylhsminor.yy274 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy712))); }
- yymsp[0].minor.yy274 = yylhsminor.yy274;
+ case 544: /* group_by_list ::= expr_or_subquery */
+{ yylhsminor.yy432 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy448))); }
+ yymsp[0].minor.yy432 = yylhsminor.yy432;
break;
- case 543: /* group_by_list ::= group_by_list NK_COMMA expr_or_subquery */
-{ yylhsminor.yy274 = addNodeToList(pCxt, yymsp[-2].minor.yy274, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy712))); }
- yymsp[-2].minor.yy274 = yylhsminor.yy274;
+ case 545: /* group_by_list ::= group_by_list NK_COMMA expr_or_subquery */
+{ yylhsminor.yy432 = addNodeToList(pCxt, yymsp[-2].minor.yy432, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy448))); }
+ yymsp[-2].minor.yy432 = yylhsminor.yy432;
break;
- case 547: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */
-{ yymsp[-5].minor.yy712 = createInterpTimeRange(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy712), releaseRawExprNode(pCxt, yymsp[-1].minor.yy712)); }
+ case 549: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */
+{ yymsp[-5].minor.yy448 = createInterpTimeRange(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy448), releaseRawExprNode(pCxt, yymsp[-1].minor.yy448)); }
break;
- case 550: /* query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */
+ case 552: /* query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */
{
- yylhsminor.yy712 = addOrderByClause(pCxt, yymsp[-3].minor.yy712, yymsp[-2].minor.yy274);
- yylhsminor.yy712 = addSlimitClause(pCxt, yylhsminor.yy712, yymsp[-1].minor.yy712);
- yylhsminor.yy712 = addLimitClause(pCxt, yylhsminor.yy712, yymsp[0].minor.yy712);
+ yylhsminor.yy448 = addOrderByClause(pCxt, yymsp[-3].minor.yy448, yymsp[-2].minor.yy432);
+ yylhsminor.yy448 = addSlimitClause(pCxt, yylhsminor.yy448, yymsp[-1].minor.yy448);
+ yylhsminor.yy448 = addLimitClause(pCxt, yylhsminor.yy448, yymsp[0].minor.yy448);
}
- yymsp[-3].minor.yy712 = yylhsminor.yy712;
+ yymsp[-3].minor.yy448 = yylhsminor.yy448;
break;
- case 553: /* union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */
-{ yylhsminor.yy712 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy712, yymsp[0].minor.yy712); }
- yymsp[-3].minor.yy712 = yylhsminor.yy712;
+ case 555: /* union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */
+{ yylhsminor.yy448 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy448, yymsp[0].minor.yy448); }
+ yymsp[-3].minor.yy448 = yylhsminor.yy448;
break;
- case 554: /* union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */
-{ yylhsminor.yy712 = createSetOperator(pCxt, SET_OP_TYPE_UNION, yymsp[-2].minor.yy712, yymsp[0].minor.yy712); }
- yymsp[-2].minor.yy712 = yylhsminor.yy712;
+ case 556: /* union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */
+{ yylhsminor.yy448 = createSetOperator(pCxt, SET_OP_TYPE_UNION, yymsp[-2].minor.yy448, yymsp[0].minor.yy448); }
+ yymsp[-2].minor.yy448 = yylhsminor.yy448;
break;
- case 562: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */
- case 566: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==566);
-{ yymsp[-1].minor.yy712 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); }
+ case 564: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */
+ case 568: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==568);
+{ yymsp[-1].minor.yy448 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); }
break;
- case 563: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */
- case 567: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==567);
-{ yymsp[-3].minor.yy712 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); }
+ case 565: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */
+ case 569: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==569);
+{ yymsp[-3].minor.yy448 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); }
break;
- case 564: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */
- case 568: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==568);
-{ yymsp[-3].minor.yy712 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); }
+ case 566: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */
+ case 570: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==570);
+{ yymsp[-3].minor.yy448 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); }
break;
- case 569: /* subquery ::= NK_LP query_expression NK_RP */
-{ yylhsminor.yy712 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy712); }
- yymsp[-2].minor.yy712 = yylhsminor.yy712;
+ case 571: /* subquery ::= NK_LP query_expression NK_RP */
+{ yylhsminor.yy448 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy448); }
+ yymsp[-2].minor.yy448 = yylhsminor.yy448;
break;
- case 574: /* sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */
-{ yylhsminor.yy712 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy712), yymsp[-1].minor.yy88, yymsp[0].minor.yy907); }
- yymsp[-2].minor.yy712 = yylhsminor.yy712;
+ case 576: /* sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */
+{ yylhsminor.yy448 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy448), yymsp[-1].minor.yy666, yymsp[0].minor.yy585); }
+ yymsp[-2].minor.yy448 = yylhsminor.yy448;
break;
- case 575: /* ordering_specification_opt ::= */
-{ yymsp[1].minor.yy88 = ORDER_ASC; }
+ case 577: /* ordering_specification_opt ::= */
+{ yymsp[1].minor.yy666 = ORDER_ASC; }
break;
- case 576: /* ordering_specification_opt ::= ASC */
-{ yymsp[0].minor.yy88 = ORDER_ASC; }
+ case 578: /* ordering_specification_opt ::= ASC */
+{ yymsp[0].minor.yy666 = ORDER_ASC; }
break;
- case 577: /* ordering_specification_opt ::= DESC */
-{ yymsp[0].minor.yy88 = ORDER_DESC; }
+ case 579: /* ordering_specification_opt ::= DESC */
+{ yymsp[0].minor.yy666 = ORDER_DESC; }
break;
- case 578: /* null_ordering_opt ::= */
-{ yymsp[1].minor.yy907 = NULL_ORDER_DEFAULT; }
+ case 580: /* null_ordering_opt ::= */
+{ yymsp[1].minor.yy585 = NULL_ORDER_DEFAULT; }
break;
- case 579: /* null_ordering_opt ::= NULLS FIRST */
-{ yymsp[-1].minor.yy907 = NULL_ORDER_FIRST; }
+ case 581: /* null_ordering_opt ::= NULLS FIRST */
+{ yymsp[-1].minor.yy585 = NULL_ORDER_FIRST; }
break;
- case 580: /* null_ordering_opt ::= NULLS LAST */
-{ yymsp[-1].minor.yy907 = NULL_ORDER_LAST; }
+ case 582: /* null_ordering_opt ::= NULLS LAST */
+{ yymsp[-1].minor.yy585 = NULL_ORDER_LAST; }
break;
default:
break;
diff --git a/source/libs/parser/test/mockCatalog.cpp b/source/libs/parser/test/mockCatalog.cpp
index 1af214bfb4..be4f3cd80b 100644
--- a/source/libs/parser/test/mockCatalog.cpp
+++ b/source/libs/parser/test/mockCatalog.cpp
@@ -279,15 +279,13 @@ int32_t __catalogGetDBCfg(SCatalog* pCtg, SRequestConnInfo* pConn, const char* d
return g_mockCatalogService->catalogGetDBCfg(dbFName, pDbCfg);
}
-int32_t __catalogChkAuth(SCatalog* pCtg, SRequestConnInfo* pConn, const char* user, const char* dbFName, AUTH_TYPE type,
- bool* pass) {
- *pass = true;
+int32_t __catalogChkAuth(SCatalog* pCtg, SRequestConnInfo* pConn, SUserAuthInfo *pAuth, SUserAuthRes* pRes) {
+ pRes->pass = true;
return 0;
}
-int32_t __catalogChkAuthFromCache(SCatalog* pCtg, const char* user, const char* dbFName, AUTH_TYPE type, bool* pass,
- bool* exists) {
- *pass = true;
+int32_t __catalogChkAuthFromCache(SCatalog* pCtg, SUserAuthInfo *pAuth, SUserAuthRes* pRes, bool* exists) {
+ pRes->pass = true;
*exists = true;
return 0;
}
diff --git a/source/libs/parser/test/mockCatalogService.cpp b/source/libs/parser/test/mockCatalogService.cpp
index 4d1ef597d0..f6a8b407d7 100644
--- a/source/libs/parser/test/mockCatalogService.cpp
+++ b/source/libs/parser/test/mockCatalogService.cpp
@@ -589,8 +589,8 @@ class MockCatalogServiceImpl {
*pUserAuthData = taosArrayInit(num, sizeof(SMetaRes));
for (int32_t i = 0; i < num; ++i) {
SMetaRes res = {0};
- res.pRes = taosMemoryCalloc(1, sizeof(bool));
- *(bool*)(res.pRes) = true;
+ res.pRes = taosMemoryCalloc(1, sizeof(SUserAuthRes));
+ ((SUserAuthRes*)res.pRes)->pass = true;
taosArrayPush(*pUserAuthData, &res);
}
}
diff --git a/source/libs/parser/test/parInitialCTest.cpp b/source/libs/parser/test/parInitialCTest.cpp
index 88e66997eb..b7ca944ebb 100644
--- a/source/libs/parser/test/parInitialCTest.cpp
+++ b/source/libs/parser/test/parInitialCTest.cpp
@@ -760,10 +760,10 @@ TEST_F(ParserInitialCTest, createStable) {
addFieldToCreateStbReq(false, "a15", TSDB_DATA_TYPE_VARCHAR, 50 + VARSTR_HEADER_SIZE);
run("CREATE STABLE IF NOT EXISTS rollup_db.t1("
"ts TIMESTAMP, c1 INT, c2 INT UNSIGNED, c3 BIGINT, c4 BIGINT UNSIGNED, c5 FLOAT, c6 DOUBLE, c7 BINARY(20), "
- "c8 SMALLINT, c9 SMALLINT UNSIGNED COMMENT 'test column comment', c10 TINYINT, c11 TINYINT UNSIGNED, c12 BOOL, "
+ "c8 SMALLINT, c9 SMALLINT UNSIGNED, c10 TINYINT, c11 TINYINT UNSIGNED, c12 BOOL, "
"c13 NCHAR(30), c14 VARCHAR(50)) "
"TAGS (a1 TIMESTAMP, a2 INT, a3 INT UNSIGNED, a4 BIGINT, a5 BIGINT UNSIGNED, a6 FLOAT, a7 DOUBLE, "
- "a8 BINARY(20), a9 SMALLINT, a10 SMALLINT UNSIGNED COMMENT 'test column comment', a11 TINYINT, "
+ "a8 BINARY(20), a9 SMALLINT, a10 SMALLINT UNSIGNED, a11 TINYINT, "
"a12 TINYINT UNSIGNED, a13 BOOL, a14 NCHAR(30), a15 VARCHAR(50)) "
"TTL 100 COMMENT 'test create table' SMA(c1, c2, c3) ROLLUP (MIN) MAX_DELAY 100s,10m WATERMARK 10a,1m "
"DELETE_MARK 1000s,200m");
@@ -1023,16 +1023,16 @@ TEST_F(ParserInitialCTest, createTable) {
run("CREATE TABLE IF NOT EXISTS test.t1("
"ts TIMESTAMP, c1 INT, c2 INT UNSIGNED, c3 BIGINT, c4 BIGINT UNSIGNED, c5 FLOAT, c6 DOUBLE, c7 BINARY(20), "
- "c8 SMALLINT, c9 SMALLINT UNSIGNED COMMENT 'test column comment', c10 TINYINT, c11 TINYINT UNSIGNED, c12 BOOL, "
+ "c8 SMALLINT, c9 SMALLINT UNSIGNED, c10 TINYINT, c11 TINYINT UNSIGNED, c12 BOOL, "
"c13 NCHAR(30), c15 VARCHAR(50)) "
"TTL 100 COMMENT 'test create table' SMA(c1, c2, c3)");
run("CREATE TABLE IF NOT EXISTS rollup_db.t1("
"ts TIMESTAMP, c1 INT, c2 INT UNSIGNED, c3 BIGINT, c4 BIGINT UNSIGNED, c5 FLOAT, c6 DOUBLE, c7 BINARY(20), "
- "c8 SMALLINT, c9 SMALLINT UNSIGNED COMMENT 'test column comment', c10 TINYINT, c11 TINYINT UNSIGNED, c12 BOOL, "
+ "c8 SMALLINT, c9 SMALLINT UNSIGNED, c10 TINYINT, c11 TINYINT UNSIGNED, c12 BOOL, "
"c13 NCHAR(30), c14 VARCHAR(50)) "
"TAGS (a1 TIMESTAMP, a2 INT, a3 INT UNSIGNED, a4 BIGINT, a5 BIGINT UNSIGNED, a6 FLOAT, a7 DOUBLE, a8 BINARY(20), "
- "a9 SMALLINT, a10 SMALLINT UNSIGNED COMMENT 'test column comment', a11 TINYINT, a12 TINYINT UNSIGNED, a13 BOOL, "
+ "a9 SMALLINT, a10 SMALLINT UNSIGNED, a11 TINYINT, a12 TINYINT UNSIGNED, a13 BOOL, "
"a14 NCHAR(30), a15 VARCHAR(50)) "
"TTL 100 COMMENT 'test create table' SMA(c1, c2, c3) ROLLUP (MIN)");
diff --git a/source/libs/planner/src/planOptimizer.c b/source/libs/planner/src/planOptimizer.c
index 8fee17d968..52bb03466c 100644
--- a/source/libs/planner/src/planOptimizer.c
+++ b/source/libs/planner/src/planOptimizer.c
@@ -1079,11 +1079,23 @@ static bool sortPriKeyOptMayBeOptimized(SLogicNode* pNode) {
if (!sortPriKeyOptIsPriKeyOrderBy(pSort->pSortKeys) || 1 != LIST_LENGTH(pSort->node.pChildren)) {
return false;
}
+ SNode* pChild;
+ FOREACH(pChild, pSort->node.pChildren) {
+ SLogicNode* pSortDescendent = optFindPossibleNode((SLogicNode*)pChild, sortPriKeyOptMayBeOptimized);
+ if (pSortDescendent != NULL) {
+ return false;
+ }
+ }
return true;
}
static int32_t sortPriKeyOptGetSequencingNodesImpl(SLogicNode* pNode, bool groupSort, bool* pNotOptimize,
SNodeList** pSequencingNodes) {
+ if (NULL != pNode->pLimit || NULL != pNode->pSlimit) {
+ *pNotOptimize = false;
+ return TSDB_CODE_SUCCESS;
+ }
+
switch (nodeType(pNode)) {
case QUERY_NODE_LOGIC_PLAN_SCAN: {
SScanLogicNode* pScan = (SScanLogicNode*)pNode;
diff --git a/source/libs/scheduler/inc/schInt.h b/source/libs/scheduler/inc/schInt.h
index d002b5dfa9..7840fe2017 100644
--- a/source/libs/scheduler/inc/schInt.h
+++ b/source/libs/scheduler/inc/schInt.h
@@ -54,7 +54,6 @@ typedef enum {
#define SCHEDULE_DEFAULT_MAX_JOB_NUM 1000
#define SCHEDULE_DEFAULT_MAX_TASK_NUM 1000
-#define SCHEDULE_DEFAULT_MAX_NODE_TABLE_NUM 200 // unit is TSDB_TABLE_NUM_UNIT
#define SCHEDULE_DEFAULT_POLICY SCH_LOAD_SEQ
#define SCHEDULE_DEFAULT_MAX_NODE_NUM 20
@@ -134,7 +133,7 @@ typedef struct SSchStatusFps {
typedef struct SSchedulerCfg {
uint32_t maxJobNum;
- int32_t maxNodeTableNum;
+ int64_t maxNodeTableNum;
SCH_POLICY schPolicy;
bool enableReSchedule;
} SSchedulerCfg;
@@ -175,7 +174,7 @@ typedef struct SSchHbCallbackParam {
typedef struct SSchFlowControl {
SRWLatch lock;
bool sorted;
- int32_t tableNumSum;
+ int64_t tableNumSum;
uint32_t execTaskNum;
SArray *taskList; // Element is SSchTask*
} SSchFlowControl;
diff --git a/source/libs/scheduler/src/schFlowCtrl.c b/source/libs/scheduler/src/schFlowCtrl.c
index 9cb95a6bbe..8c2b65e125 100644
--- a/source/libs/scheduler/src/schFlowCtrl.c
+++ b/source/libs/scheduler/src/schFlowCtrl.c
@@ -46,7 +46,7 @@ int32_t schChkJobNeedFlowCtrl(SSchJob *pJob, SSchLevel *pLevel) {
return TSDB_CODE_SUCCESS;
}
- int32_t sum = 0;
+ int64_t sum = 0;
int32_t taskNum = taosArrayGetSize(pJob->dataSrcTasks);
for (int32_t i = 0; i < taskNum; ++i) {
SSchTask *pTask = *(SSchTask **)taosArrayGet(pJob->dataSrcTasks, i);
@@ -55,7 +55,7 @@ int32_t schChkJobNeedFlowCtrl(SSchJob *pJob, SSchLevel *pLevel) {
}
if (schMgmt.cfg.maxNodeTableNum <= 0 || sum < schMgmt.cfg.maxNodeTableNum) {
- SCH_JOB_DLOG("job no need flow ctrl, totalTableNum:%d", sum);
+ SCH_JOB_DLOG("job no need flow ctrl, totalTableNum:%" PRId64, sum);
return TSDB_CODE_SUCCESS;
}
@@ -68,7 +68,7 @@ int32_t schChkJobNeedFlowCtrl(SSchJob *pJob, SSchLevel *pLevel) {
SCH_SET_JOB_NEED_FLOW_CTRL(pJob);
- SCH_JOB_DLOG("job NEED flow ctrl, totalTableNum:%d", sum);
+ SCH_JOB_DLOG("job NEED flow ctrl, totalTableNum:%" PRId64, sum);
return TSDB_CODE_SUCCESS;
}
@@ -94,7 +94,7 @@ int32_t schDecTaskFlowQuota(SSchJob *pJob, SSchTask *pTask) {
--ctrl->execTaskNum;
ctrl->tableNumSum -= pTask->plan->execNodeStat.tableNum;
- SCH_TASK_DLOG("task quota removed, fqdn:%s, port:%d, tableNum:%d, remainNum:%d, remainExecTaskNum:%d", ep->fqdn,
+ SCH_TASK_DLOG("task quota removed, fqdn:%s, port:%d, tableNum:%d, remainNum:%" PRId64 ", remainExecTaskNum:%d", ep->fqdn,
ep->port, pTask->plan->execNodeStat.tableNum, ctrl->tableNumSum, ctrl->execTaskNum);
_return:
@@ -125,7 +125,7 @@ int32_t schCheckIncTaskFlowQuota(SSchJob *pJob, SSchTask *pTask, bool *enough) {
SCH_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
}
- SCH_TASK_DLOG("task quota added, fqdn:%s, port:%d, tableNum:%d, remainNum:%d, remainExecTaskNum:%d", ep->fqdn,
+ SCH_TASK_DLOG("task quota added, fqdn:%s, port:%d, tableNum:%d, remainNum:%" PRId64 ", remainExecTaskNum:%d", ep->fqdn,
ep->port, pTask->plan->execNodeStat.tableNum, nctrl.tableNumSum, nctrl.execTaskNum);
*enough = true;
@@ -142,7 +142,7 @@ int32_t schCheckIncTaskFlowQuota(SSchJob *pJob, SSchTask *pTask, bool *enough) {
break;
}
- int32_t sum = pTask->plan->execNodeStat.tableNum + ctrl->tableNumSum;
+ int64_t sum = pTask->plan->execNodeStat.tableNum + ctrl->tableNumSum;
if (sum <= schMgmt.cfg.maxNodeTableNum) {
ctrl->tableNumSum = sum;
@@ -173,7 +173,7 @@ int32_t schCheckIncTaskFlowQuota(SSchJob *pJob, SSchTask *pTask, bool *enough) {
_return:
- SCH_TASK_DLOG("task quota %s added, fqdn:%s, port:%d, tableNum:%d, remainNum:%d, remainExecTaskNum:%d",
+ SCH_TASK_DLOG("task quota %s added, fqdn:%s, port:%d, tableNum:%d, remainNum:%" PRId64 ", remainExecTaskNum:%d",
((*enough) ? "" : "NOT"), ep->fqdn, ep->port, pTask->plan->execNodeStat.tableNum, ctrl->tableNumSum,
ctrl->execTaskNum);
@@ -203,7 +203,7 @@ int32_t schLaunchTasksInFlowCtrlListImpl(SSchJob *pJob, SSchFlowControl *ctrl) {
return TSDB_CODE_SUCCESS;
}
- int32_t remainNum = schMgmt.cfg.maxNodeTableNum - ctrl->tableNumSum;
+ int64_t remainNum = schMgmt.cfg.maxNodeTableNum - ctrl->tableNumSum;
int32_t taskNum = taosArrayGetSize(ctrl->taskList);
int32_t code = 0;
SSchTask *pTask = NULL;
@@ -217,7 +217,7 @@ int32_t schLaunchTasksInFlowCtrlListImpl(SSchJob *pJob, SSchFlowControl *ctrl) {
SEp *ep = SCH_GET_CUR_EP(&pTask->plan->execNode);
if (pTask->plan->execNodeStat.tableNum > remainNum && ctrl->execTaskNum > 0) {
- SCH_TASK_DLOG("task NOT to launch, fqdn:%s, port:%d, tableNum:%d, remainNum:%d, remainExecTaskNum:%d", ep->fqdn,
+ SCH_TASK_DLOG("task NOT to launch, fqdn:%s, port:%d, tableNum:%d, remainNum:%" PRId64 ", remainExecTaskNum:%d", ep->fqdn,
ep->port, pTask->plan->execNodeStat.tableNum, ctrl->tableNumSum, ctrl->execTaskNum);
continue;
@@ -228,14 +228,14 @@ int32_t schLaunchTasksInFlowCtrlListImpl(SSchJob *pJob, SSchFlowControl *ctrl) {
taosArrayRemove(ctrl->taskList, i);
- SCH_TASK_DLOG("task to launch, fqdn:%s, port:%d, tableNum:%d, remainNum:%d, remainExecTaskNum:%d", ep->fqdn,
+ SCH_TASK_DLOG("task to launch, fqdn:%s, port:%d, tableNum:%d, remainNum:%" PRId64 ", remainExecTaskNum:%d", ep->fqdn,
ep->port, pTask->plan->execNodeStat.tableNum, ctrl->tableNumSum, ctrl->execTaskNum);
SCH_ERR_JRET(schAsyncLaunchTaskImpl(pJob, pTask));
remainNum -= pTask->plan->execNodeStat.tableNum;
if (remainNum <= 0) {
- SCH_TASK_DLOG("no more task to launch, fqdn:%s, port:%d, remainNum:%d, remainExecTaskNum:%d", ep->fqdn, ep->port,
+ SCH_TASK_DLOG("no more task to launch, fqdn:%s, port:%d, remainNum:%" PRId64 ", remainExecTaskNum:%d", ep->fqdn, ep->port,
ctrl->tableNumSum, ctrl->execTaskNum);
break;
@@ -244,7 +244,7 @@ int32_t schLaunchTasksInFlowCtrlListImpl(SSchJob *pJob, SSchFlowControl *ctrl) {
if (i < (taskNum - 1)) {
SSchTask *pLastTask = *(SSchTask **)taosArrayGetLast(ctrl->taskList);
if (remainNum < pLastTask->plan->execNodeStat.tableNum) {
- SCH_TASK_DLOG("no more task to launch, fqdn:%s, port:%d, remainNum:%d, remainExecTaskNum:%d, smallestInList:%d",
+ SCH_TASK_DLOG("no more task to launch, fqdn:%s, port:%d, remainNum:%" PRId64 ", remainExecTaskNum:%d, smallestInList:%d",
ep->fqdn, ep->port, ctrl->tableNumSum, ctrl->execTaskNum, pLastTask->plan->execNodeStat.tableNum);
break;
diff --git a/source/libs/scheduler/src/scheduler.c b/source/libs/scheduler/src/scheduler.c
index 2b46a4710e..e7561ccb7e 100644
--- a/source/libs/scheduler/src/scheduler.c
+++ b/source/libs/scheduler/src/scheduler.c
@@ -18,6 +18,7 @@
#include "schInt.h"
#include "tmsg.h"
#include "tref.h"
+#include "tglobal.h"
SSchedulerMgmt schMgmt = {
.jobRef = -1,
@@ -30,11 +31,12 @@ int32_t schedulerInit() {
}
schMgmt.cfg.maxJobNum = SCHEDULE_DEFAULT_MAX_JOB_NUM;
- schMgmt.cfg.maxNodeTableNum = SCHEDULE_DEFAULT_MAX_NODE_TABLE_NUM;
+ schMgmt.cfg.maxNodeTableNum = tsQueryMaxConcurrentTables;
schMgmt.cfg.schPolicy = SCHEDULE_DEFAULT_POLICY;
schMgmt.cfg.enableReSchedule = true;
- qDebug("schedule policy init to %d", schMgmt.cfg.schPolicy);
+ qDebug("schedule init, policy: %d, maxNodeTableNum: %" PRId64", reSchedule:%d",
+ schMgmt.cfg.schPolicy, schMgmt.cfg.maxNodeTableNum, schMgmt.cfg.enableReSchedule);
schMgmt.jobRef = taosOpenRef(schMgmt.cfg.maxJobNum, schFreeJobImpl);
if (schMgmt.jobRef < 0) {
diff --git a/source/libs/stream/CMakeLists.txt b/source/libs/stream/CMakeLists.txt
index 7ceee9b2f2..2edbc44aae 100644
--- a/source/libs/stream/CMakeLists.txt
+++ b/source/libs/stream/CMakeLists.txt
@@ -8,15 +8,16 @@ target_include_directories(
if(${BUILD_WITH_ROCKSDB})
target_link_libraries(
- stream
- PUBLIC rocksdb tdb
- PRIVATE os util transport qcom executor
+ stream
+ PUBLIC rocksdb tdb
+ PRIVATE os util transport qcom executor wal
)
+
target_include_directories(
stream
PUBLIC "${TD_SOURCE_DIR}/contrib/rocksdb/include"
)
-
+
add_definitions(-DUSE_ROCKSDB)
endif(${BUILD_WITH_ROCKSDB})
diff --git a/source/libs/stream/inc/streamInc.h b/source/libs/stream/inc/streamInc.h
index 66496f11f8..00da4ef9a2 100644
--- a/source/libs/stream/inc/streamInc.h
+++ b/source/libs/stream/inc/streamInc.h
@@ -16,7 +16,7 @@
#ifndef _STREAM_INC_H_
#define _STREAM_INC_H_
-#include "executor.h"
+//#include "executor.h"
#include "tstream.h"
#ifdef __cplusplus
@@ -44,7 +44,7 @@ int32_t streamDispatchOneCheckReq(SStreamTask* pTask, const SStreamTaskCheckReq*
int32_t streamDispatchOneRecoverFinishReq(SStreamTask* pTask, const SStreamRecoverFinishReq* pReq, int32_t vgId,
SEpSet* pEpSet);
-SStreamQueueItem* streamMergeQueueItem(SStreamQueueItem* dst, SStreamQueueItem* elem);
+SStreamQueueItem* streamMergeQueueItem(SStreamQueueItem* dst, SStreamQueueItem* pElem);
#ifdef __cplusplus
}
diff --git a/source/libs/stream/src/stream.c b/source/libs/stream/src/stream.c
index bd23dc2312..155ea3ba05 100644
--- a/source/libs/stream/src/stream.c
+++ b/source/libs/stream/src/stream.c
@@ -16,6 +16,8 @@
#include "streamInc.h"
#include "ttimer.h"
+#define STREAM_TASK_INPUT_QUEUEU_CAPACITY 2
+
int32_t streamInit() {
int8_t old;
while (1) {
@@ -50,7 +52,7 @@ void streamCleanUp() {
void streamSchedByTimer(void* param, void* tmrId) {
SStreamTask* pTask = (void*)param;
- if (atomic_load_8(&pTask->taskStatus) == TASK_STATUS__DROPPING) {
+ if (atomic_load_8(&pTask->status.taskStatus) == TASK_STATUS__DROPPING) {
streamMetaReleaseTask(NULL, pTask);
return;
}
@@ -64,15 +66,16 @@ void streamSchedByTimer(void* param, void* tmrId) {
taosFreeQitem(trigger);
return;
}
- trigger->pBlock->info.type = STREAM_GET_ALL;
+ trigger->pBlock->info.type = STREAM_GET_ALL;
atomic_store_8(&pTask->triggerStatus, TASK_TRIGGER_STATUS__INACTIVE);
- if (streamTaskInput(pTask, (SStreamQueueItem*)trigger) < 0) {
+ if (tAppendDataToInputQueue(pTask, (SStreamQueueItem*)trigger) < 0) {
taosFreeQitem(trigger);
taosTmrReset(streamSchedByTimer, (int32_t)pTask->triggerParam, pTask, streamEnv.timer, &pTask->timer);
return;
}
+
streamSchedExec(pTask);
}
@@ -91,31 +94,33 @@ int32_t streamSetupTrigger(SStreamTask* pTask) {
int32_t streamSchedExec(SStreamTask* pTask) {
int8_t schedStatus =
- atomic_val_compare_exchange_8(&pTask->schedStatus, TASK_SCHED_STATUS__INACTIVE, TASK_SCHED_STATUS__WAITING);
+ atomic_val_compare_exchange_8(&pTask->status.schedStatus, TASK_SCHED_STATUS__INACTIVE, TASK_SCHED_STATUS__WAITING);
+
if (schedStatus == TASK_SCHED_STATUS__INACTIVE) {
SStreamTaskRunReq* pRunReq = rpcMallocCont(sizeof(SStreamTaskRunReq));
if (pRunReq == NULL) {
- atomic_store_8(&pTask->schedStatus, TASK_SCHED_STATUS__INACTIVE);
+ terrno = TSDB_CODE_OUT_OF_MEMORY;
+ atomic_store_8(&pTask->status.schedStatus, TASK_SCHED_STATUS__INACTIVE);
return -1;
}
+
pRunReq->head.vgId = pTask->nodeId;
- pRunReq->streamId = pTask->streamId;
- pRunReq->taskId = pTask->taskId;
- SRpcMsg msg = {
- .msgType = TDMT_STREAM_TASK_RUN,
- .pCont = pRunReq,
- .contLen = sizeof(SStreamTaskRunReq),
- };
+ pRunReq->streamId = pTask->id.streamId;
+ pRunReq->taskId = pTask->id.taskId;
+
+ SRpcMsg msg = { .msgType = TDMT_STREAM_TASK_RUN, .pCont = pRunReq, .contLen = sizeof(SStreamTaskRunReq) };
tmsgPutToQueue(pTask->pMsgCb, STREAM_QUEUE, &msg);
+ qDebug("trigger to run s-task:%s", pTask->id.idStr);
}
+
return 0;
}
-int32_t streamTaskEnqueue(SStreamTask* pTask, const SStreamDispatchReq* pReq, SRpcMsg* pRsp) {
+int32_t streamTaskEnqueueBlocks(SStreamTask* pTask, const SStreamDispatchReq* pReq, SRpcMsg* pRsp) {
SStreamDataBlock* pData = taosAllocateQitem(sizeof(SStreamDataBlock), DEF_QITEM, 0);
int8_t status;
- // enqueue
+ // enqueue data block
if (pData != NULL) {
pData->type = STREAM_INPUT__DATA_BLOCK;
pData->srcVgId = pReq->dataSrcVgId;
@@ -123,10 +128,10 @@ int32_t streamTaskEnqueue(SStreamTask* pTask, const SStreamDispatchReq* pReq, SR
/*pData->blocks = pReq->data;*/
/*pBlock->sourceVer = pReq->sourceVer;*/
streamDispatchReqToData(pReq, pData);
- if (streamTaskInput(pTask, (SStreamQueueItem*)pData) == 0) {
+ if (tAppendDataToInputQueue(pTask, (SStreamQueueItem*)pData) == 0) {
status = TASK_INPUT_STATUS__NORMAL;
- } else {
- status = TASK_INPUT_STATUS__FAILED;
+ } else { // input queue is full, upstream is blocked now
+ status = TASK_INPUT_STATUS__BLOCKED;
}
} else {
streamTaskInputFail(pTask);
@@ -142,10 +147,12 @@ int32_t streamTaskEnqueue(SStreamTask* pTask, const SStreamDispatchReq* pReq, SR
pCont->upstreamNodeId = htonl(pReq->upstreamNodeId);
pCont->upstreamTaskId = htonl(pReq->upstreamTaskId);
pCont->downstreamNodeId = htonl(pTask->nodeId);
- pCont->downstreamTaskId = htonl(pTask->taskId);
+ pCont->downstreamTaskId = htonl(pTask->id.taskId);
pRsp->pCont = buf;
+
pRsp->contLen = sizeof(SMsgHead) + sizeof(SStreamDispatchRsp);
tmsgSendRsp(pRsp);
+
return status == TASK_INPUT_STATUS__NORMAL ? 0 : -1;
}
@@ -155,7 +162,7 @@ int32_t streamTaskEnqueueRetrieve(SStreamTask* pTask, SStreamRetrieveReq* pReq,
// enqueue
if (pData != NULL) {
- qDebug("task %d(child %d) recv retrieve req from task %d, reqId %" PRId64, pTask->taskId, pTask->selfChildId,
+ qDebug("task %d(child %d) recv retrieve req from task %d, reqId %" PRId64, pTask->id.taskId, pTask->selfChildId,
pReq->srcTaskId, pReq->reqId);
pData->type = STREAM_INPUT__DATA_RETRIEVE;
@@ -164,7 +171,7 @@ int32_t streamTaskEnqueueRetrieve(SStreamTask* pTask, SStreamRetrieveReq* pReq,
/*pData->blocks = pReq->data;*/
/*pBlock->sourceVer = pReq->sourceVer;*/
streamRetrieveReqToData(pReq, pData);
- if (streamTaskInput(pTask, (SStreamQueueItem*)pData) == 0) {
+ if (tAppendDataToInputQueue(pTask, (SStreamQueueItem*)pData) == 0) {
status = TASK_INPUT_STATUS__NORMAL;
} else {
status = TASK_INPUT_STATUS__FAILED;
@@ -209,10 +216,10 @@ int32_t streamTaskOutput(SStreamTask* pTask, SStreamDataBlock* pBlock) {
}
int32_t streamProcessDispatchReq(SStreamTask* pTask, SStreamDispatchReq* pReq, SRpcMsg* pRsp, bool exec) {
- qDebug("task %d receive dispatch req from node %d task %d", pTask->taskId, pReq->upstreamNodeId,
+ qDebug("vgId:%d s-task:%s receive dispatch req from taskId:%d", pReq->upstreamNodeId, pTask->id.idStr,
pReq->upstreamTaskId);
- streamTaskEnqueue(pTask, pReq, pRsp);
+ streamTaskEnqueueBlocks(pTask, pReq, pRsp);
tDeleteStreamDispatchReq(pReq);
if (exec) {
@@ -232,13 +239,14 @@ int32_t streamProcessDispatchReq(SStreamTask* pTask, SStreamDispatchReq* pReq, S
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, code: %x", pTask->taskId, code);
+ qDebug("s-task:%s receive dispatch rsp, code: %x", pTask->id.idStr, code);
if (pTask->outputType == TASK_OUTPUT__SHUFFLE_DISPATCH) {
int32_t leftRsp = atomic_sub_fetch_32(&pTask->shuffleDispatcher.waitingRspCnt, 1);
- qDebug("task %d is shuffle, left waiting rsp %d", pTask->taskId, leftRsp);
- if (leftRsp > 0) return 0;
+ qDebug("task %d is shuffle, left waiting rsp %d", pTask->id.taskId, leftRsp);
+ if (leftRsp > 0) {
+ return 0;
+ }
}
int8_t old = atomic_exchange_8(&pTask->outputStatus, pRsp->inputStatus);
@@ -265,7 +273,7 @@ int32_t streamProcessRunReq(SStreamTask* pTask) {
}
int32_t streamProcessRetrieveReq(SStreamTask* pTask, SStreamRetrieveReq* pReq, SRpcMsg* pRsp) {
- qDebug("task %d receive retrieve req from node %d task %d", pTask->taskId, pReq->srcNodeId, pReq->srcTaskId);
+ qDebug("task %d receive retrieve req from node %d task %d", pTask->id.taskId, pReq->srcNodeId, pReq->srcTaskId);
streamTaskEnqueueRetrieve(pTask, pReq, pRsp);
@@ -279,7 +287,73 @@ int32_t streamProcessRetrieveReq(SStreamTask* pTask, SStreamRetrieveReq* pReq, S
return 0;
}
-// int32_t streamProcessRetrieveRsp(SStreamTask* pTask, SStreamRetrieveRsp* pRsp) {
-// //
-// return 0;
-// }
+bool tInputQueueIsFull(const SStreamTask* pTask) {
+ return taosQueueItemSize((pTask->inputQueue->queue)) >= STREAM_TASK_INPUT_QUEUEU_CAPACITY;
+}
+
+int32_t tAppendDataToInputQueue(SStreamTask* pTask, SStreamQueueItem* pItem) {
+ int8_t type = pItem->type;
+
+ if (type == STREAM_INPUT__DATA_SUBMIT) {
+ SStreamDataSubmit2* pSubmitBlock = streamSubmitBlockClone((SStreamDataSubmit2*)pItem);
+ if (pSubmitBlock == NULL) {
+ qDebug("task %d %p submit enqueue failed since out of memory", pTask->id.taskId, pTask);
+ terrno = TSDB_CODE_OUT_OF_MEMORY;
+ atomic_store_8(&pTask->inputStatus, TASK_INPUT_STATUS__FAILED);
+ return -1;
+ }
+
+ int32_t total = taosQueueItemSize(pTask->inputQueue->queue) + 1;
+ qDebug("s-task:%s submit enqueue %p %p msgLen:%d ver:%" PRId64 ", total in queue:%d", pTask->id.idStr,
+ pItem, pSubmitBlock->submit.msgStr, pSubmitBlock->submit.msgLen,
+ pSubmitBlock->submit.ver, total);
+
+ if ((pTask->taskLevel == TASK_LEVEL__SOURCE) && total > STREAM_TASK_INPUT_QUEUEU_CAPACITY) {
+ qError("s-task:%s input queue is full, capacity:%d, abort", pTask->id.idStr, STREAM_TASK_INPUT_QUEUEU_CAPACITY);
+ streamDataSubmitDestroy(pSubmitBlock);
+ return -1;
+ }
+
+ taosWriteQitem(pTask->inputQueue->queue, pSubmitBlock);
+ } else if (type == STREAM_INPUT__DATA_BLOCK || type == STREAM_INPUT__DATA_RETRIEVE ||
+ type == STREAM_INPUT__REF_DATA_BLOCK) {
+ int32_t total = taosQueueItemSize(pTask->inputQueue->queue) + 1;
+ if ((pTask->taskLevel == TASK_LEVEL__SOURCE) && total > STREAM_TASK_INPUT_QUEUEU_CAPACITY) {
+ qError("s-task:%s input queue is full, capacity:%d, abort", pTask->id.idStr, STREAM_TASK_INPUT_QUEUEU_CAPACITY);
+ return -1;
+ }
+
+ qDebug("s-task:%s data block enqueue, total in queue:%d", pTask->id.idStr, total);
+ taosWriteQitem(pTask->inputQueue->queue, pItem);
+ } else if (type == STREAM_INPUT__CHECKPOINT) {
+ taosWriteQitem(pTask->inputQueue->queue, pItem);
+ } else if (type == STREAM_INPUT__GET_RES) {
+ taosWriteQitem(pTask->inputQueue->queue, pItem);
+ }
+
+ if (type != STREAM_INPUT__GET_RES && type != STREAM_INPUT__CHECKPOINT && pTask->triggerParam != 0) {
+ atomic_val_compare_exchange_8(&pTask->triggerStatus, TASK_TRIGGER_STATUS__INACTIVE, TASK_TRIGGER_STATUS__ACTIVE);
+ }
+
+#if 0
+ atomic_store_8(&pTask->inputStatus, TASK_INPUT_STATUS__NORMAL);
+#endif
+
+ return 0;
+}
+
+void* streamQueueNextItem(SStreamQueue* queue) {
+ int8_t dequeueFlag = atomic_exchange_8(&queue->status, STREAM_QUEUE__PROCESSING);
+ if (dequeueFlag == STREAM_QUEUE__FAILED) {
+ ASSERT(queue->qItem != NULL);
+ return streamQueueCurItem(queue);
+ } else {
+ queue->qItem = NULL;
+ taosGetQitem(queue->qall, &queue->qItem);
+ if (queue->qItem == NULL) {
+ taosReadAllQitems(queue->queue, queue->qall);
+ taosGetQitem(queue->qall, &queue->qItem);
+ }
+ return streamQueueCurItem(queue);
+ }
+}
\ No newline at end of file
diff --git a/source/libs/stream/src/streamData.c b/source/libs/stream/src/streamData.c
index 8baebaee42..ae616260f3 100644
--- a/source/libs/stream/src/streamData.c
+++ b/source/libs/stream/src/streamData.c
@@ -48,10 +48,12 @@ int32_t streamRetrieveReqToData(const SStreamRetrieveReq* pReq, SStreamDataBlock
if (pArray == NULL) {
return -1;
}
+
taosArrayPush(pArray, &(SSDataBlock){0});
SRetrieveTableRsp* pRetrieve = pReq->pRetrieve;
SSDataBlock* pDataBlock = taosArrayGet(pArray, 0);
blockDecode(pDataBlock, pRetrieve->data);
+
// TODO: refactor
pDataBlock->info.window.skey = be64toh(pRetrieve->skey);
pDataBlock->info.window.ekey = be64toh(pRetrieve->ekey);
@@ -65,35 +67,53 @@ int32_t streamRetrieveReqToData(const SStreamRetrieveReq* pReq, SStreamDataBlock
return 0;
}
-SStreamDataSubmit2* streamDataSubmitNew(SPackedData submit) {
+SStreamDataSubmit2* streamDataSubmitNew(SPackedData submit, int32_t type) {
SStreamDataSubmit2* pDataSubmit = (SStreamDataSubmit2*)taosAllocateQitem(sizeof(SStreamDataSubmit2), DEF_QITEM, 0);
+ if (pDataSubmit == NULL) {
+ return NULL;
+ }
- if (pDataSubmit == NULL) return NULL;
pDataSubmit->dataRef = (int32_t*)taosMemoryMalloc(sizeof(int32_t));
- if (pDataSubmit->dataRef == NULL) goto FAIL;
+ if (pDataSubmit->dataRef == NULL) {
+ taosFreeQitem(pDataSubmit);
+ return NULL;
+ }
+
pDataSubmit->submit = submit;
- *pDataSubmit->dataRef = 1;
- pDataSubmit->type = STREAM_INPUT__DATA_SUBMIT;
+ *pDataSubmit->dataRef = 1; // initialize the reference count to be 1
+ pDataSubmit->type = type;
+
return pDataSubmit;
-FAIL:
- taosFreeQitem(pDataSubmit);
- return NULL;
+}
+
+void streamDataSubmitDestroy(SStreamDataSubmit2* pDataSubmit) {
+ int32_t ref = atomic_sub_fetch_32(pDataSubmit->dataRef, 1);
+ ASSERT(ref >= 0 && pDataSubmit->type == STREAM_INPUT__DATA_SUBMIT);
+
+ if (ref == 0) {
+ taosMemoryFree(pDataSubmit->submit.msgStr);
+ taosMemoryFree(pDataSubmit->dataRef);
+ }
}
SStreamMergedSubmit2* streamMergedSubmitNew() {
SStreamMergedSubmit2* pMerged = (SStreamMergedSubmit2*)taosAllocateQitem(sizeof(SStreamMergedSubmit2), DEF_QITEM, 0);
+ if (pMerged == NULL) {
+ return NULL;
+ }
- if (pMerged == NULL) return NULL;
pMerged->submits = taosArrayInit(0, sizeof(SPackedData));
pMerged->dataRefs = taosArrayInit(0, sizeof(void*));
- if (pMerged->dataRefs == NULL || pMerged->submits == NULL) goto FAIL;
+
+ if (pMerged->dataRefs == NULL || pMerged->submits == NULL) {
+ taosArrayDestroy(pMerged->submits);
+ taosArrayDestroy(pMerged->dataRefs);
+ taosFreeQitem(pMerged);
+ return NULL;
+ }
+
pMerged->type = STREAM_INPUT__MERGED_SUBMIT;
return pMerged;
-FAIL:
- if (pMerged->submits) taosArrayDestroy(pMerged->submits);
- if (pMerged->dataRefs) taosArrayDestroy(pMerged->dataRefs);
- taosFreeQitem(pMerged);
- return NULL;
}
int32_t streamMergeSubmit(SStreamMergedSubmit2* pMerged, SStreamDataSubmit2* pSubmit) {
@@ -107,48 +127,38 @@ static FORCE_INLINE void streamDataSubmitRefInc(SStreamDataSubmit2* pDataSubmit)
atomic_add_fetch_32(pDataSubmit->dataRef, 1);
}
-SStreamDataSubmit2* streamSubmitRefClone(SStreamDataSubmit2* pSubmit) {
+SStreamDataSubmit2* streamSubmitBlockClone(SStreamDataSubmit2* pSubmit) {
SStreamDataSubmit2* pSubmitClone = taosAllocateQitem(sizeof(SStreamDataSubmit2), DEF_QITEM, 0);
-
if (pSubmitClone == NULL) {
return NULL;
}
+
streamDataSubmitRefInc(pSubmit);
memcpy(pSubmitClone, pSubmit, sizeof(SStreamDataSubmit2));
return pSubmitClone;
}
-void streamDataSubmitRefDec(SStreamDataSubmit2* pDataSubmit) {
- int32_t ref = atomic_sub_fetch_32(pDataSubmit->dataRef, 1);
- ASSERT(ref >= 0);
- if (ref == 0) {
- taosMemoryFree(pDataSubmit->submit.msgStr);
- taosMemoryFree(pDataSubmit->dataRef);
- }
-}
-
-SStreamQueueItem* streamMergeQueueItem(SStreamQueueItem* dst, SStreamQueueItem* elem) {
- ASSERT(elem);
- if (dst->type == STREAM_INPUT__DATA_BLOCK && elem->type == STREAM_INPUT__DATA_BLOCK) {
+SStreamQueueItem* streamMergeQueueItem(SStreamQueueItem* dst, SStreamQueueItem* pElem) {
+ if (dst->type == STREAM_INPUT__DATA_BLOCK && pElem->type == STREAM_INPUT__DATA_BLOCK) {
SStreamDataBlock* pBlock = (SStreamDataBlock*)dst;
- SStreamDataBlock* pBlockSrc = (SStreamDataBlock*)elem;
+ SStreamDataBlock* pBlockSrc = (SStreamDataBlock*)pElem;
taosArrayAddAll(pBlock->blocks, pBlockSrc->blocks);
taosArrayDestroy(pBlockSrc->blocks);
- taosFreeQitem(elem);
+ taosFreeQitem(pElem);
return dst;
- } else if (dst->type == STREAM_INPUT__MERGED_SUBMIT && elem->type == STREAM_INPUT__DATA_SUBMIT) {
+ } else if (dst->type == STREAM_INPUT__MERGED_SUBMIT && pElem->type == STREAM_INPUT__DATA_SUBMIT) {
SStreamMergedSubmit2* pMerged = (SStreamMergedSubmit2*)dst;
- SStreamDataSubmit2* pBlockSrc = (SStreamDataSubmit2*)elem;
+ SStreamDataSubmit2* pBlockSrc = (SStreamDataSubmit2*)pElem;
streamMergeSubmit(pMerged, pBlockSrc);
- taosFreeQitem(elem);
+ taosFreeQitem(pElem);
return dst;
- } else if (dst->type == STREAM_INPUT__DATA_SUBMIT && elem->type == STREAM_INPUT__DATA_SUBMIT) {
+ } else if (dst->type == STREAM_INPUT__DATA_SUBMIT && pElem->type == STREAM_INPUT__DATA_SUBMIT) {
SStreamMergedSubmit2* pMerged = streamMergedSubmitNew();
ASSERT(pMerged);
streamMergeSubmit(pMerged, (SStreamDataSubmit2*)dst);
- streamMergeSubmit(pMerged, (SStreamDataSubmit2*)elem);
+ streamMergeSubmit(pMerged, (SStreamDataSubmit2*)pElem);
taosFreeQitem(dst);
- taosFreeQitem(elem);
+ taosFreeQitem(pElem);
return (SStreamQueueItem*)pMerged;
} else {
return NULL;
@@ -164,7 +174,7 @@ void streamFreeQitem(SStreamQueueItem* data) {
taosArrayDestroyEx(((SStreamDataBlock*)data)->blocks, (FDelete)blockDataFreeRes);
taosFreeQitem(data);
} else if (type == STREAM_INPUT__DATA_SUBMIT) {
- streamDataSubmitRefDec((SStreamDataSubmit2*)data);
+ streamDataSubmitDestroy((SStreamDataSubmit2*)data);
taosFreeQitem(data);
} else if (type == STREAM_INPUT__MERGED_SUBMIT) {
SStreamMergedSubmit2* pMerge = (SStreamMergedSubmit2*)data;
diff --git a/source/libs/stream/src/streamDispatch.c b/source/libs/stream/src/streamDispatch.c
index 7e7c23f98a..a9f6d29bf5 100644
--- a/source/libs/stream/src/streamDispatch.c
+++ b/source/libs/stream/src/streamDispatch.c
@@ -121,9 +121,9 @@ int32_t streamBroadcastToChildren(SStreamTask* pTask, const SSDataBlock* pBlock)
int32_t actualLen = blockEncode(pBlock, pRetrieve->data, numOfCols);
SStreamRetrieveReq req = {
- .streamId = pTask->streamId,
+ .streamId = pTask->id.streamId,
.srcNodeId = pTask->nodeId,
- .srcTaskId = pTask->taskId,
+ .srcTaskId = pTask->id.taskId,
.pRetrieve = pRetrieve,
.retrieveLen = dataStrLen,
};
@@ -168,7 +168,7 @@ int32_t streamBroadcastToChildren(SStreamTask* pTask, const SSDataBlock* pBlock)
}
buf = NULL;
- qDebug("task %d(child %d) send retrieve req to task %d at node %d, reqId %" PRId64, pTask->taskId,
+ qDebug("s-task:%s (child %d) send retrieve req to task %d at node %d, reqId %" PRId64, pTask->id.idStr,
pTask->selfChildId, pEpInfo->taskId, pEpInfo->nodeId, req.reqId);
}
code = 0;
@@ -238,7 +238,8 @@ int32_t streamDispatchOneCheckReq(SStreamTask* pTask, const SStreamTaskCheckReq*
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);
+ qDebug("dispatch from s-task:%s to downstream s-task:%"PRIx64":%d node %d: check msg", pTask->id.idStr,
+ pReq->streamId, pReq->downstreamTaskId, nodeId);
tmsgSendReq(pEpSet, &msg);
@@ -282,7 +283,7 @@ int32_t streamDispatchOneRecoverFinishReq(SStreamTask* pTask, const SStreamRecov
tmsgSendReq(pEpSet, &msg);
- qDebug("dispatch from task %d to task %d node %d: recover finish msg", pTask->taskId, pReq->taskId, vgId);
+ qDebug("dispatch from task %d to task %d node %d: recover finish msg", pTask->id.taskId, pReq->taskId, vgId);
return 0;
FAIL:
@@ -319,8 +320,7 @@ int32_t streamDispatchOneDataReq(SStreamTask* pTask, const SStreamDispatchReq* p
msg.pCont = buf;
msg.msgType = pTask->dispatchMsgType;
- qDebug("dispatch from task %d to task %d node %d: data msg", pTask->taskId, pReq->taskId, vgId);
-
+ qDebug("dispatch from s-task:%s to taskId:%d vgId:%d data msg", pTask->id.idStr, pReq->taskId, vgId);
tmsgSendReq(pEpSet, &msg);
code = 0;
@@ -382,9 +382,9 @@ int32_t streamDispatchAllBlocks(SStreamTask* pTask, const SStreamDataBlock* pDat
if (pTask->outputType == TASK_OUTPUT__FIXED_DISPATCH) {
SStreamDispatchReq req = {
- .streamId = pTask->streamId,
+ .streamId = pTask->id.streamId,
.dataSrcVgId = pData->srcVgId,
- .upstreamTaskId = pTask->taskId,
+ .upstreamTaskId = pTask->id.taskId,
.upstreamChildId = pTask->selfChildId,
.upstreamNodeId = pTask->nodeId,
.blockNum = blockNum,
@@ -402,14 +402,15 @@ int32_t streamDispatchAllBlocks(SStreamTask* pTask, const SStreamDataBlock* pDat
goto FAIL_FIXED_DISPATCH;
}
}
+
int32_t vgId = pTask->fixedEpDispatcher.nodeId;
SEpSet* pEpSet = &pTask->fixedEpDispatcher.epSet;
int32_t downstreamTaskId = pTask->fixedEpDispatcher.taskId;
req.taskId = downstreamTaskId;
- qDebug("dispatch from task %d (child id %d) to down stream task %d in vnode %d", pTask->taskId, pTask->selfChildId,
- downstreamTaskId, vgId);
+ qDebug("s-task:%s (child taskId:%d) dispatch blocks:%d to down stream s-task:%d in vgId:%d", pTask->id.idStr,
+ pTask->selfChildId, blockNum, downstreamTaskId, vgId);
if (streamDispatchOneDataReq(pTask, &req, vgId, pEpSet) < 0) {
goto FAIL_FIXED_DISPATCH;
@@ -432,9 +433,9 @@ int32_t streamDispatchAllBlocks(SStreamTask* pTask, const SStreamDataBlock* pDat
}
for (int32_t i = 0; i < vgSz; i++) {
- pReqs[i].streamId = pTask->streamId;
+ pReqs[i].streamId = pTask->id.streamId;
pReqs[i].dataSrcVgId = pData->srcVgId;
- pReqs[i].upstreamTaskId = pTask->taskId;
+ pReqs[i].upstreamTaskId = pTask->id.taskId;
pReqs[i].upstreamChildId = pTask->selfChildId;
pReqs[i].upstreamNodeId = pTask->nodeId;
pReqs[i].blockNum = 0;
@@ -494,6 +495,8 @@ int32_t streamDispatchAllBlocks(SStreamTask* pTask, const SStreamDataBlock* pDat
int32_t streamDispatch(SStreamTask* pTask) {
ASSERT(pTask->outputType == TASK_OUTPUT__FIXED_DISPATCH || pTask->outputType == TASK_OUTPUT__SHUFFLE_DISPATCH);
+ qDebug("s-task:%s try to dispatch intermediate result block to downstream, numofBlocks in outputQ:%d", pTask->id.idStr,
+ taosQueueItemSize(pTask->outputQueue->queue));
int8_t old =
atomic_val_compare_exchange_8(&pTask->outputStatus, TASK_OUTPUT_STATUS__NORMAL, TASK_OUTPUT_STATUS__WAIT);
@@ -503,13 +506,12 @@ int32_t streamDispatch(SStreamTask* pTask) {
SStreamDataBlock* pBlock = streamQueueNextItem(pTask->outputQueue);
if (pBlock == NULL) {
- qDebug("stream stop dispatching since no output: task %d", pTask->taskId);
+ qDebug("s-task:%s stream stop dispatching since no output in output queue", pTask->id.idStr);
atomic_store_8(&pTask->outputStatus, TASK_OUTPUT_STATUS__NORMAL);
return 0;
}
- ASSERT(pBlock->type == STREAM_INPUT__DATA_BLOCK);
- qDebug("stream dispatching: task %d", pTask->taskId);
+ ASSERT(pBlock->type == STREAM_INPUT__DATA_BLOCK);
int32_t code = 0;
if (streamDispatchAllBlocks(pTask, pBlock) < 0) {
@@ -518,6 +520,7 @@ int32_t streamDispatch(SStreamTask* pTask) {
atomic_store_8(&pTask->outputStatus, TASK_OUTPUT_STATUS__NORMAL);
goto FREE;
}
+
FREE:
taosArrayDestroyEx(pBlock->blocks, (FDelete)blockDataFreeRes);
taosFreeQitem(pBlock);
diff --git a/source/libs/stream/src/streamExec.c b/source/libs/stream/src/streamExec.c
index fd186a3fee..67f51d3896 100644
--- a/source/libs/stream/src/streamExec.c
+++ b/source/libs/stream/src/streamExec.c
@@ -18,70 +18,82 @@
#define STREAM_EXEC_MAX_BATCH_NUM 1024
static int32_t streamTaskExecImpl(SStreamTask* pTask, const void* data, SArray* pRes) {
- int32_t code;
- void* exec = pTask->exec.executor;
- while (pTask->taskLevel == TASK_LEVEL__SOURCE && atomic_load_8(&pTask->taskStatus) != TASK_STATUS__NORMAL) {
- qError("stream task wait for the end of fill history");
- taosMsleep(2);
- continue;
+ int32_t code = TSDB_CODE_SUCCESS;
+ void* pExecutor = pTask->exec.pExecutor;
+
+ while (pTask->taskLevel == TASK_LEVEL__SOURCE) {
+ int8_t status = atomic_load_8(&pTask->status.taskStatus);
+ if (status != TASK_STATUS__NORMAL && status != TASK_STATUS__RESTORE) {
+ qError("stream task wait for the end of fill history, s-task:%s, status:%d", pTask->id.idStr,
+ atomic_load_8(&pTask->status.taskStatus));
+ taosMsleep(2);
+ } else {
+ break;
+ }
}
// set input
const SStreamQueueItem* pItem = (const SStreamQueueItem*)data;
if (pItem->type == STREAM_INPUT__GET_RES) {
const SStreamTrigger* pTrigger = (const SStreamTrigger*)data;
- qSetMultiStreamInput(exec, pTrigger->pBlock, 1, STREAM_INPUT__DATA_BLOCK);
+ qSetMultiStreamInput(pExecutor, pTrigger->pBlock, 1, STREAM_INPUT__DATA_BLOCK);
} else if (pItem->type == STREAM_INPUT__DATA_SUBMIT) {
ASSERT(pTask->taskLevel == TASK_LEVEL__SOURCE);
const SStreamDataSubmit2* pSubmit = (const SStreamDataSubmit2*)data;
- qDebug("task %d %p set submit input %p %p %d %" PRId64, pTask->taskId, pTask, pSubmit, pSubmit->submit.msgStr,
+ qSetMultiStreamInput(pExecutor, &pSubmit->submit, 1, STREAM_INPUT__DATA_SUBMIT);
+ qDebug("s-task:%s set submit blocks as source block completed, %p %p len:%d ver:%" PRId64, pTask->id.idStr, pSubmit, pSubmit->submit.msgStr,
pSubmit->submit.msgLen, pSubmit->submit.ver);
- qSetMultiStreamInput(exec, &pSubmit->submit, 1, STREAM_INPUT__DATA_SUBMIT);
} else if (pItem->type == STREAM_INPUT__DATA_BLOCK || pItem->type == STREAM_INPUT__DATA_RETRIEVE) {
const SStreamDataBlock* pBlock = (const SStreamDataBlock*)data;
- SArray* blocks = pBlock->blocks;
- qDebug("task %d %p set ssdata input", pTask->taskId, pTask);
- qSetMultiStreamInput(exec, blocks->pData, blocks->size, STREAM_INPUT__DATA_BLOCK);
+
+ SArray* pBlockList = pBlock->blocks;
+ int32_t numOfBlocks = taosArrayGetSize(pBlockList);
+ qDebug("s-task:%s set sdata blocks as input num:%d, ver:%"PRId64, pTask->id.idStr, numOfBlocks, pBlock->sourceVer);
+ qSetMultiStreamInput(pExecutor, pBlockList->pData, numOfBlocks, STREAM_INPUT__DATA_BLOCK);
} else if (pItem->type == STREAM_INPUT__MERGED_SUBMIT) {
const SStreamMergedSubmit2* pMerged = (const SStreamMergedSubmit2*)data;
- SArray* blocks = pMerged->submits;
- qDebug("task %d %p set submit input (merged), batch num: %d", pTask->taskId, pTask, (int32_t)blocks->size);
- qSetMultiStreamInput(exec, blocks->pData, blocks->size, STREAM_INPUT__MERGED_SUBMIT);
+
+ SArray* pBlockList = pMerged->submits;
+ int32_t numOfBlocks = taosArrayGetSize(pBlockList);
+ qDebug("st-task:%s %p set submit input (merged), batch num:%d", pTask->id.idStr, pTask, numOfBlocks);
+ qSetMultiStreamInput(pExecutor, pBlockList->pData, numOfBlocks, STREAM_INPUT__MERGED_SUBMIT);
} else if (pItem->type == STREAM_INPUT__REF_DATA_BLOCK) {
const SStreamRefDataBlock* pRefBlock = (const SStreamRefDataBlock*)data;
- qSetMultiStreamInput(exec, pRefBlock->pBlock, 1, STREAM_INPUT__DATA_BLOCK);
+ qSetMultiStreamInput(pExecutor, pRefBlock->pBlock, 1, STREAM_INPUT__DATA_BLOCK);
} else {
ASSERT(0);
}
- // exec
+ // pExecutor
while (1) {
- if (pTask->taskStatus == TASK_STATUS__DROPPING) {
+ if (pTask->status.taskStatus == TASK_STATUS__DROPPING) {
return 0;
}
SSDataBlock* output = NULL;
uint64_t ts = 0;
- if ((code = qExecTask(exec, &output, &ts)) < 0) {
+ if ((code = qExecTask(pExecutor, &output, &ts)) < 0) {
if (code == TSDB_CODE_QRY_IN_EXEC) {
- resetTaskInfo(exec);
+ resetTaskInfo(pExecutor);
}
- /*ASSERT(false);*/
- qError("unexpected stream execution, stream %" PRId64 " task: %d, since %s", pTask->streamId, pTask->taskId,
- terrstr());
+
+ qError("unexpected stream execution, s-task:%s since %s", pTask->id.idStr, terrstr());
continue;
}
+
if (output == NULL) {
if (pItem->type == STREAM_INPUT__DATA_RETRIEVE) {
- SSDataBlock block = {0};
+ SSDataBlock block = {0};
+
const SStreamDataBlock* pRetrieveBlock = (const SStreamDataBlock*)data;
ASSERT(taosArrayGetSize(pRetrieveBlock->blocks) == 1);
+
assignOneDataBlock(&block, taosArrayGet(pRetrieveBlock->blocks, 0));
block.info.type = STREAM_PULL_OVER;
block.info.childId = pTask->selfChildId;
taosArrayPush(pRes, &block);
- qDebug("task %d(child %d) processed retrieve, reqId %" PRId64, pTask->taskId, pTask->selfChildId,
+ qDebug("task %d(child %d) processed retrieve, reqId %" PRId64, pTask->id.taskId, pTask->selfChildId,
pRetrieveBlock->reqId);
}
break;
@@ -94,13 +106,14 @@ static int32_t streamTaskExecImpl(SStreamTask* pTask, const void* data, SArray*
continue;
}
- qDebug("task %d(child %d) executed and get block", pTask->taskId, pTask->selfChildId);
+ qDebug("task %d(child %d) executed and get block", pTask->id.taskId, pTask->selfChildId);
SSDataBlock block = {0};
assignOneDataBlock(&block, output);
block.info.childId = pTask->selfChildId;
taosArrayPush(pRes, &block);
}
+
return 0;
}
@@ -108,7 +121,8 @@ int32_t streamScanExec(SStreamTask* pTask, int32_t batchSz) {
int32_t code = 0;
ASSERT(pTask->taskLevel == TASK_LEVEL__SOURCE);
- void* exec = pTask->exec.executor;
+
+ void* exec = pTask->exec.pExecutor;
qSetStreamOpOpen(exec);
bool finished = false;
@@ -122,7 +136,7 @@ int32_t streamScanExec(SStreamTask* pTask, int32_t batchSz) {
int32_t batchCnt = 0;
while (1) {
- if (atomic_load_8(&pTask->taskStatus) == TASK_STATUS__DROPPING) {
+ if (atomic_load_8(&pTask->status.taskStatus) == TASK_STATUS__DROPPING) {
taosArrayDestroy(pRes);
return 0;
}
@@ -148,17 +162,17 @@ int32_t streamScanExec(SStreamTask* pTask, int32_t batchSz) {
batchCnt++;
- qDebug("task %d scan exec block num %d, block limit %d", pTask->taskId, batchCnt, batchSz);
+ qDebug("task %d scan exec block num %d, block limit %d", pTask->id.taskId, batchCnt, batchSz);
if (batchCnt >= batchSz) break;
}
if (taosArrayGetSize(pRes) == 0) {
if (finished) {
taosArrayDestroy(pRes);
- qDebug("task %d finish recover exec task ", pTask->taskId);
+ qDebug("task %d finish recover exec task ", pTask->id.taskId);
break;
} else {
- qDebug("task %d continue recover exec task ", pTask->taskId);
+ qDebug("task %d continue recover exec task ", pTask->id.taskId);
continue;
}
}
@@ -178,7 +192,7 @@ int32_t streamScanExec(SStreamTask* pTask, int32_t batchSz) {
}
if (pTask->outputType == TASK_OUTPUT__FIXED_DISPATCH || pTask->outputType == TASK_OUTPUT__SHUFFLE_DISPATCH) {
- qDebug("task %d scan exec dispatch block num %d", pTask->taskId, batchCnt);
+ qDebug("task %d scan exec dispatch block num %d", pTask->id.taskId, batchCnt);
streamDispatch(pTask);
}
if (finished) break;
@@ -191,7 +205,7 @@ int32_t streamBatchExec(SStreamTask* pTask, int32_t batchLimit) {
// fetch all queue item, merge according to batchLimit
int32_t numOfItems = taosReadAllQitems(pTask->inputQueue1, pTask->inputQall);
if (numOfItems == 0) {
- qDebug("task: %d, stream task exec over, queue empty", pTask->taskId);
+ qDebug("task: %d, stream task exec over, queue empty", pTask->id.taskId);
return 0;
}
SStreamQueueItem* pMerged = NULL;
@@ -227,76 +241,103 @@ int32_t streamBatchExec(SStreamTask* pTask, int32_t batchLimit) {
int32_t streamExecForAll(SStreamTask* pTask) {
int32_t code = 0;
while (1) {
- int32_t batchCnt = 1;
- void* input = NULL;
+ int32_t batchSize = 1;
+ void* pInput = NULL;
+
+ // merge multiple input data if possible in the input queue.
while (1) {
SStreamQueueItem* qItem = streamQueueNextItem(pTask->inputQueue);
if (qItem == NULL) {
- qDebug("stream task exec over, queue empty, task: %d", pTask->taskId);
+// qDebug("s-task:%s extract data from input queue, queue is empty, abort", pTask->id.idStr);
break;
}
- if (input == NULL) {
- input = qItem;
+
+ if (pInput == NULL) {
+ pInput = qItem;
streamQueueProcessSuccess(pTask->inputQueue);
if (pTask->taskLevel == TASK_LEVEL__SINK) {
break;
}
} else {
- void* newRet;
- if ((newRet = streamMergeQueueItem(input, qItem)) == NULL) {
+ void* newRet = NULL;
+ if ((newRet = streamMergeQueueItem(pInput, qItem)) == NULL) {
streamQueueProcessFail(pTask->inputQueue);
break;
} else {
- batchCnt++;
- input = newRet;
+ batchSize++;
+ pInput = newRet;
streamQueueProcessSuccess(pTask->inputQueue);
- if (batchCnt > STREAM_EXEC_MAX_BATCH_NUM) {
+ if (batchSize > STREAM_EXEC_MAX_BATCH_NUM) {
break;
}
}
}
}
- if (pTask->taskStatus == TASK_STATUS__DROPPING) {
- if (input) streamFreeQitem(input);
+ if (pTask->status.taskStatus == TASK_STATUS__DROPPING) {
+ if (pInput) {
+ streamFreeQitem(pInput);
+ }
return 0;
}
- if (input == NULL) {
+ if (pInput == NULL) {
break;
}
if (pTask->taskLevel == TASK_LEVEL__SINK) {
- ASSERT(((SStreamQueueItem*)input)->type == STREAM_INPUT__DATA_BLOCK);
- code = streamTaskOutput(pTask, input);
- if (code != 0) {
- // backpressure and record position
- }
+ ASSERT(((SStreamQueueItem*)pInput)->type == STREAM_INPUT__DATA_BLOCK);
+ qDebug("s-task:%s sink node start to sink result. numOfBlocks:%d", pTask->id.idStr, batchSize);
+ streamTaskOutput(pTask, pInput);
continue;
}
SArray* pRes = taosArrayInit(0, sizeof(SSDataBlock));
+ qDebug("s-task:%s exec begin, numOfBlocks:%d", pTask->id.idStr, batchSize);
- qDebug("stream task %d exec begin, msg batch: %d", pTask->taskId, batchCnt);
- streamTaskExecImpl(pTask, input, pRes);
- qDebug("stream task %d exec end", pTask->taskId);
+ streamTaskExecImpl(pTask, pInput, pRes);
+
+ int64_t ckId = 0;
+ int64_t dataVer = 0;
+ qGetCheckpointVersion(pTask->exec.pExecutor, &dataVer, &ckId);
+ if (dataVer > pTask->chkInfo.version) { // save it since the checkpoint is updated
+ qDebug("s-task:%s exec end, start to update check point, ver from %" PRId64 " to %" PRId64
+ ", checkPoint id:%" PRId64 " -> %" PRId64,
+ pTask->id.idStr, pTask->chkInfo.version, dataVer, pTask->chkInfo.id, ckId);
+
+ pTask->chkInfo = (SCheckpointInfo) {.version = dataVer, .id = ckId};
+
+ taosWLockLatch(&pTask->pMeta->lock);
+ streamMetaSaveTask(pTask->pMeta, pTask);
+ if (streamMetaCommit(pTask->pMeta) < 0) {
+ taosWUnLockLatch(&pTask->pMeta->lock);
+ qError("s-task:%s failed to commit stream meta, since %s", pTask->id.idStr, terrstr());
+ return -1;
+ } else {
+ taosWUnLockLatch(&pTask->pMeta->lock);
+ qDebug("s-task:%s update checkpoint ver succeed", pTask->id.idStr);
+ }
+ } else {
+ qDebug("s-task:%s exec end", pTask->id.idStr);
+ }
if (taosArrayGetSize(pRes) != 0) {
SStreamDataBlock* qRes = taosAllocateQitem(sizeof(SStreamDataBlock), DEF_QITEM, 0);
if (qRes == NULL) {
taosArrayDestroyEx(pRes, (FDelete)blockDataFreeRes);
- streamFreeQitem(input);
+ streamFreeQitem(pInput);
return -1;
}
+
qRes->type = STREAM_INPUT__DATA_BLOCK;
qRes->blocks = pRes;
- if (((SStreamQueueItem*)input)->type == STREAM_INPUT__DATA_SUBMIT) {
- SStreamDataSubmit2* pSubmit = (SStreamDataSubmit2*)input;
+ if (((SStreamQueueItem*)pInput)->type == STREAM_INPUT__DATA_SUBMIT) {
+ SStreamDataSubmit2* pSubmit = (SStreamDataSubmit2*)pInput;
qRes->childId = pTask->selfChildId;
qRes->sourceVer = pSubmit->ver;
- } else if (((SStreamQueueItem*)input)->type == STREAM_INPUT__MERGED_SUBMIT) {
- SStreamMergedSubmit2* pMerged = (SStreamMergedSubmit2*)input;
+ } else if (((SStreamQueueItem*)pInput)->type == STREAM_INPUT__MERGED_SUBMIT) {
+ SStreamMergedSubmit2* pMerged = (SStreamMergedSubmit2*)pInput;
qRes->childId = pTask->selfChildId;
qRes->sourceVer = pMerged->ver;
}
@@ -305,32 +346,38 @@ int32_t streamExecForAll(SStreamTask* pTask) {
if (code == TSDB_CODE_UTIL_QUEUE_OUT_OF_MEMORY) {
// backpressure and record position
taosArrayDestroyEx(pRes, (FDelete)blockDataFreeRes);
- streamFreeQitem(input);
+ streamFreeQitem(pInput);
taosFreeQitem(qRes);
return -1;
}
} else {
taosArrayDestroy(pRes);
}
- streamFreeQitem(input);
+ streamFreeQitem(pInput);
}
return 0;
}
int32_t streamTryExec(SStreamTask* pTask) {
+ // this function may be executed by multi-threads, so status check is required.
int8_t schedStatus =
- atomic_val_compare_exchange_8(&pTask->schedStatus, TASK_SCHED_STATUS__WAITING, TASK_SCHED_STATUS__ACTIVE);
+ atomic_val_compare_exchange_8(&pTask->status.schedStatus, TASK_SCHED_STATUS__WAITING, TASK_SCHED_STATUS__ACTIVE);
+
if (schedStatus == TASK_SCHED_STATUS__WAITING) {
int32_t code = streamExecForAll(pTask);
if (code < 0) {
- atomic_store_8(&pTask->schedStatus, TASK_SCHED_STATUS__FAILED);
+ atomic_store_8(&pTask->status.schedStatus, TASK_SCHED_STATUS__FAILED);
return -1;
}
- atomic_store_8(&pTask->schedStatus, TASK_SCHED_STATUS__INACTIVE);
+
+ // todo the task should be commit here
+ atomic_store_8(&pTask->status.schedStatus, TASK_SCHED_STATUS__INACTIVE);
+ qDebug("s-task:%s exec completed", pTask->id.idStr);
if (!taosQueueEmpty(pTask->inputQueue->queue)) {
streamSchedExec(pTask);
}
}
+
return 0;
}
diff --git a/source/libs/stream/src/streamMeta.c b/source/libs/stream/src/streamMeta.c
index 03391c0ba2..0008c8dd8c 100644
--- a/source/libs/stream/src/streamMeta.c
+++ b/source/libs/stream/src/streamMeta.c
@@ -24,6 +24,7 @@ SStreamMeta* streamMetaOpen(const char* path, void* ahandle, FTaskExpand expandF
terrno = TSDB_CODE_OUT_OF_MEMORY;
return NULL;
}
+
int32_t len = strlen(path) + 20;
char* streamPath = taosMemoryCalloc(1, len);
sprintf(streamPath, "%s/%s", path, "stream");
@@ -50,23 +51,31 @@ SStreamMeta* streamMetaOpen(const char* path, void* ahandle, FTaskExpand expandF
goto _err;
}
- pMeta->pTasks = taosHashInit(64, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT), true, HASH_ENTRY_LOCK);
+ _hash_fn_t fp = taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT);
+ pMeta->pTasks = taosHashInit(64, fp, true, HASH_ENTRY_LOCK);
if (pMeta->pTasks == NULL) {
goto _err;
}
+ pMeta->pWalReadTasks = taosHashInit(64, fp, true, HASH_ENTRY_LOCK);
+ if (pMeta->pWalReadTasks == NULL) {
+ goto _err;
+ }
+
if (streamMetaBegin(pMeta) < 0) {
goto _err;
}
+ pMeta->vgId = vgId;
pMeta->ahandle = ahandle;
pMeta->expandFunc = expandFunc;
-
+ taosInitRWLatch(&pMeta->lock);
return pMeta;
_err:
taosMemoryFree(pMeta->path);
if (pMeta->pTasks) taosHashCleanup(pMeta->pTasks);
+ if (pMeta->pWalReadTasks) taosHashCleanup(pMeta->pWalReadTasks);
if (pMeta->pTaskDb) tdbTbClose(pMeta->pTaskDb);
if (pMeta->pCheckpointDb) tdbTbClose(pMeta->pCheckpointDb);
if (pMeta->db) tdbClose(pMeta->db);
@@ -81,19 +90,29 @@ void streamMetaClose(SStreamMeta* pMeta) {
tdbClose(pMeta->db);
void* pIter = NULL;
+ while(pMeta->walScan) {
+ qDebug("wait stream daemon quit");
+ taosMsleep(100);
+ }
+
while (1) {
pIter = taosHashIterate(pMeta->pTasks, pIter);
- if (pIter == NULL) break;
+ if (pIter == NULL) {
+ break;
+ }
+
SStreamTask* pTask = *(SStreamTask**)pIter;
if (pTask->timer) {
taosTmrStop(pTask->timer);
pTask->timer = NULL;
}
- tFreeSStreamTask(pTask);
+
+ tFreeStreamTask(pTask);
/*streamMetaReleaseTask(pMeta, pTask);*/
}
+
taosHashCleanup(pMeta->pTasks);
- taosHashCleanup(pMeta->pRecoverStatus);
+ taosHashCleanup(pMeta->pWalReadTasks);
taosMemoryFree(pMeta->path);
taosMemoryFree(pMeta);
}
@@ -106,7 +125,7 @@ int32_t streamMetaAddSerializedTask(SStreamMeta* pMeta, int64_t ver, char* msg,
}
SDecoder decoder;
tDecoderInit(&decoder, (uint8_t*)msg, msgLen);
- if (tDecodeSStreamTask(&decoder, pTask) < 0) {
+ if (tDecodeStreamTask(&decoder, pTask) < 0) {
tDecoderClear(&decoder);
goto FAIL;
}
@@ -117,12 +136,12 @@ int32_t streamMetaAddSerializedTask(SStreamMeta* pMeta, int64_t ver, char* msg,
goto FAIL;
}
- if (taosHashPut(pMeta->pTasks, &pTask->taskId, sizeof(int32_t), &pTask, sizeof(void*)) < 0) {
+ if (taosHashPut(pMeta->pTasks, &pTask->id.taskId, sizeof(int32_t), &pTask, sizeof(void*)) < 0) {
goto FAIL;
}
- if (tdbTbUpsert(pMeta->pTaskDb, &pTask->taskId, sizeof(int32_t), msg, msgLen, pMeta->txn) < 0) {
- taosHashRemove(pMeta->pTasks, &pTask->taskId, sizeof(int32_t));
+ if (tdbTbUpsert(pMeta->pTaskDb, &pTask->id.taskId, sizeof(int32_t), msg, msgLen, pMeta->txn) < 0) {
+ taosHashRemove(pMeta->pTasks, &pTask->id.taskId, sizeof(int32_t));
ASSERT(0);
goto FAIL;
}
@@ -130,7 +149,7 @@ int32_t streamMetaAddSerializedTask(SStreamMeta* pMeta, int64_t ver, char* msg,
return 0;
FAIL:
- if (pTask) tFreeSStreamTask(pTask);
+ if (pTask) tFreeStreamTask(pTask);
return -1;
}
#endif
@@ -139,7 +158,7 @@ int32_t streamMetaSaveTask(SStreamMeta* pMeta, SStreamTask* pTask) {
void* buf = NULL;
int32_t len;
int32_t code;
- tEncodeSize(tEncodeSStreamTask, pTask, len, code);
+ tEncodeSize(tEncodeStreamTask, pTask, len, code);
if (code < 0) {
return -1;
}
@@ -150,10 +169,10 @@ int32_t streamMetaSaveTask(SStreamMeta* pMeta, SStreamTask* pTask) {
SEncoder encoder = {0};
tEncoderInit(&encoder, buf, len);
- tEncodeSStreamTask(&encoder, pTask);
+ tEncodeStreamTask(&encoder, pTask);
tEncoderClear(&encoder);
- if (tdbTbUpsert(pMeta->pTaskDb, &pTask->taskId, sizeof(int32_t), buf, len, pMeta->txn) < 0) {
+ if (tdbTbUpsert(pMeta->pTaskDb, &pTask->id.taskId, sizeof(int32_t), buf, len, pMeta->txn) < 0) {
return -1;
}
@@ -161,8 +180,8 @@ int32_t streamMetaSaveTask(SStreamMeta* pMeta, SStreamTask* pTask) {
return 0;
}
-#if 1
-int32_t streamMetaAddTask(SStreamMeta* pMeta, int64_t ver, SStreamTask* pTask) {
+// add to the ready tasks hash map, not the restored tasks hash map
+int32_t streamMetaAddDeployedTask(SStreamMeta* pMeta, int64_t ver, SStreamTask* pTask) {
if (pMeta->expandFunc(pMeta->ahandle, pTask, ver) < 0) {
return -1;
}
@@ -171,39 +190,27 @@ int32_t streamMetaAddTask(SStreamMeta* pMeta, int64_t ver, SStreamTask* pTask) {
return -1;
}
- taosHashPut(pMeta->pTasks, &pTask->taskId, sizeof(int32_t), &pTask, sizeof(void*));
-
+ pTask->status.taskStatus = STREAM_STATUS__NORMAL;
+ taosHashPut(pMeta->pTasks, &pTask->id.taskId, sizeof(int32_t), &pTask, POINTER_BYTES);
return 0;
}
-#endif
-#if 0
-SStreamTask* streamMetaGetTask(SStreamMeta* pMeta, int32_t taskId) {
- SStreamTask** ppTask = (SStreamTask**)taosHashGet(pMeta->pTasks, &taskId, sizeof(int32_t));
- if (ppTask) {
- ASSERT((*ppTask)->taskId == taskId);
- return *ppTask;
- } else {
- return NULL;
- }
+int32_t streamMetaGetNumOfTasks(const SStreamMeta* pMeta) {
+ int32_t numOfReady = taosHashGetSize(pMeta->pTasks);
+ int32_t numOfRestoring = taosHashGetSize(pMeta->pWalReadTasks);
+ return numOfReady + numOfRestoring;
}
-#endif
SStreamTask* streamMetaAcquireTask(SStreamMeta* pMeta, int32_t taskId) {
taosRLockLatch(&pMeta->lock);
SStreamTask** ppTask = (SStreamTask**)taosHashGet(pMeta->pTasks, &taskId, sizeof(int32_t));
- if (ppTask) {
- SStreamTask* pTask = *ppTask;
- if (atomic_load_8(&pTask->taskStatus) != TASK_STATUS__DROPPING) {
- atomic_add_fetch_32(&pTask->refCnt, 1);
- taosRUnLockLatch(&pMeta->lock);
- return pTask;
- } else {
- taosRUnLockLatch(&pMeta->lock);
- return NULL;
- }
+ if (ppTask != NULL && (atomic_load_8(&((*ppTask)->status.taskStatus)) != TASK_STATUS__DROPPING)) {
+ atomic_add_fetch_32(&(*ppTask)->refCnt, 1);
+ taosRUnLockLatch(&pMeta->lock);
+ return *ppTask;
}
+
taosRUnLockLatch(&pMeta->lock);
return NULL;
}
@@ -212,11 +219,42 @@ void streamMetaReleaseTask(SStreamMeta* pMeta, SStreamTask* pTask) {
int32_t left = atomic_sub_fetch_32(&pTask->refCnt, 1);
ASSERT(left >= 0);
if (left == 0) {
- ASSERT(atomic_load_8(&pTask->taskStatus) == TASK_STATUS__DROPPING);
- tFreeSStreamTask(pTask);
+ ASSERT(atomic_load_8(&pTask->status.taskStatus) == TASK_STATUS__DROPPING);
+ tFreeStreamTask(pTask);
}
}
+SStreamTask* streamMetaAcquireTaskEx(SStreamMeta* pMeta, int32_t taskId) {
+ taosRLockLatch(&pMeta->lock);
+
+ SStreamTask* pTask = NULL;
+ int32_t numOfRestored = taosHashGetSize(pMeta->pWalReadTasks);
+ if (numOfRestored > 0) {
+ SStreamTask** p = (SStreamTask**)taosHashGet(pMeta->pWalReadTasks, &taskId, sizeof(taskId));
+ if (p != NULL) {
+ pTask = *p;
+ if (pTask != NULL && (atomic_load_8(&(pTask->status.taskStatus)) != TASK_STATUS__DROPPING)) {
+ atomic_add_fetch_32(&pTask->refCnt, 1);
+ taosRUnLockLatch(&pMeta->lock);
+ return pTask;
+ }
+ }
+ }
+
+ SStreamTask** p = (SStreamTask**)taosHashGet(pMeta->pTasks, &taskId, sizeof(int32_t));
+ if (p != NULL) {
+ pTask = *p;
+ if (pTask != NULL && atomic_load_8(&(pTask->status.taskStatus)) != TASK_STATUS__DROPPING) {
+ atomic_add_fetch_32(&pTask->refCnt, 1);
+ taosRUnLockLatch(&pMeta->lock);
+ return pTask;
+ }
+ }
+
+ taosRUnLockLatch(&pMeta->lock);
+ return NULL;
+}
+
void streamMetaRemoveTask(SStreamMeta* pMeta, int32_t taskId) {
SStreamTask** ppTask = (SStreamTask**)taosHashGet(pMeta->pTasks, &taskId, sizeof(int32_t));
if (ppTask) {
@@ -227,7 +265,7 @@ void streamMetaRemoveTask(SStreamMeta* pMeta, int32_t taskId) {
* taosTmrStop(pTask->timer);*/
/*pTask->timer = NULL;*/
/*}*/
- atomic_store_8(&pTask->taskStatus, TASK_STATUS__DROPPING);
+ atomic_store_8(&pTask->status.taskStatus, TASK_STATUS__DROPPING);
taosWLockLatch(&pMeta->lock);
streamMetaReleaseTask(pMeta, pTask);
@@ -245,9 +283,12 @@ int32_t streamMetaBegin(SStreamMeta* pMeta) {
int32_t streamMetaCommit(SStreamMeta* pMeta) {
if (tdbCommit(pMeta->db, pMeta->txn) < 0) {
+ ASSERT(0);
return -1;
}
+
if (tdbPostCommit(pMeta->db, pMeta->txn) < 0) {
+ ASSERT(0);
return -1;
}
@@ -293,7 +334,7 @@ int32_t streamLoadTasks(SStreamMeta* pMeta, int64_t ver) {
return -1;
}
tDecoderInit(&decoder, (uint8_t*)pVal, vLen);
- tDecodeSStreamTask(&decoder, pTask);
+ tDecodeStreamTask(&decoder, pTask);
tDecoderClear(&decoder);
if (pMeta->expandFunc(pMeta->ahandle, pTask, -1) < 0) {
@@ -303,15 +344,16 @@ int32_t streamLoadTasks(SStreamMeta* pMeta, int64_t ver) {
return -1;
}
- if (taosHashPut(pMeta->pTasks, &pTask->taskId, sizeof(int32_t), &pTask, sizeof(void*)) < 0) {
+ if (taosHashPut(pMeta->pWalReadTasks, &pTask->id.taskId, sizeof(int32_t), &pTask, sizeof(void*)) < 0) {
tdbFree(pKey);
tdbFree(pVal);
tdbTbcClose(pCur);
return -1;
}
- /*pTask->taskStatus = TASK_STATUS__NORMAL;*/
+
+ /*pTask->status.taskStatus = TASK_STATUS__NORMAL;*/
if (pTask->fillHistory) {
- pTask->taskStatus = TASK_STATUS__WAIT_DOWNSTREAM;
+ pTask->status.taskStatus = TASK_STATUS__WAIT_DOWNSTREAM;
streamTaskCheckDownstream(pTask, ver);
}
}
diff --git a/source/libs/stream/src/streamRecover.c b/source/libs/stream/src/streamRecover.c
index 87058bf490..9962cdfcc0 100644
--- a/source/libs/stream/src/streamRecover.c
+++ b/source/libs/stream/src/streamRecover.c
@@ -16,9 +16,9 @@
#include "streamInc.h"
int32_t streamTaskLaunchRecover(SStreamTask* pTask, int64_t version) {
- qDebug("task %d at node %d launch recover", pTask->taskId, pTask->nodeId);
+ qDebug("s-task:%s at node %d launch recover", pTask->id.idStr, pTask->nodeId);
if (pTask->taskLevel == TASK_LEVEL__SOURCE) {
- atomic_store_8(&pTask->taskStatus, TASK_STATUS__RECOVER_PREPARE);
+ atomic_store_8(&pTask->status.taskStatus, TASK_STATUS__RECOVER_PREPARE);
streamSetParamForRecover(pTask);
streamSourceRecoverPrepareStep1(pTask, version);
@@ -44,11 +44,11 @@ int32_t streamTaskLaunchRecover(SStreamTask* pTask, int64_t version) {
}
} else if (pTask->taskLevel == TASK_LEVEL__AGG) {
- atomic_store_8(&pTask->taskStatus, TASK_STATUS__NORMAL);
+ atomic_store_8(&pTask->status.taskStatus, TASK_STATUS__NORMAL);
streamSetParamForRecover(pTask);
streamAggRecoverPrepare(pTask);
} else if (pTask->taskLevel == TASK_LEVEL__SINK) {
- atomic_store_8(&pTask->taskStatus, TASK_STATUS__NORMAL);
+ atomic_store_8(&pTask->status.taskStatus, TASK_STATUS__NORMAL);
}
return 0;
}
@@ -56,8 +56,8 @@ int32_t streamTaskLaunchRecover(SStreamTask* pTask, int64_t version) {
// checkstatus
int32_t streamTaskCheckDownstream(SStreamTask* pTask, int64_t version) {
SStreamTaskCheckReq req = {
- .streamId = pTask->streamId,
- .upstreamTaskId = pTask->taskId,
+ .streamId = pTask->id.streamId,
+ .upstreamTaskId = pTask->id.taskId,
.upstreamNodeId = pTask->nodeId,
.childId = pTask->selfChildId,
};
@@ -68,7 +68,7 @@ int32_t streamTaskCheckDownstream(SStreamTask* pTask, int64_t version) {
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,
+ qDebug("task %d at node %d check downstream task %d at node %d", pTask->id.taskId, pTask->nodeId, req.downstreamTaskId,
req.downstreamNodeId);
streamDispatchOneCheckReq(pTask, &req, pTask->fixedEpDispatcher.nodeId, &pTask->fixedEpDispatcher.epSet);
} else if (pTask->outputType == TASK_OUTPUT__SHUFFLE_DISPATCH) {
@@ -83,12 +83,12 @@ int32_t streamTaskCheckDownstream(SStreamTask* pTask, int64_t version) {
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,
+ qDebug("task %d at node %d check downstream task %d at node %d (shuffle)", pTask->id.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);
+ qDebug("task %d at node %d direct launch recover since no downstream", pTask->id.taskId, pTask->nodeId);
streamTaskLaunchRecover(pTask, version);
}
return 0;
@@ -104,7 +104,7 @@ int32_t streamRecheckOneDownstream(SStreamTask* pTask, const SStreamTaskCheckRsp
.downstreamNodeId = pRsp->downstreamNodeId,
.childId = pRsp->childId,
};
- qDebug("task %d at node %d check downstream task %d at node %d (recheck)", pTask->taskId, pTask->nodeId,
+ qDebug("task %d at node %d check downstream task %d at node %d (recheck)", pTask->id.taskId, pTask->nodeId,
req.downstreamTaskId, req.downstreamNodeId);
if (pTask->outputType == TASK_OUTPUT__FIXED_DISPATCH) {
streamDispatchOneCheckReq(pTask, &req, pRsp->downstreamNodeId, &pTask->fixedEpDispatcher.epSet);
@@ -122,7 +122,7 @@ int32_t streamRecheckOneDownstream(SStreamTask* pTask, const SStreamTaskCheckRsp
}
int32_t streamProcessTaskCheckReq(SStreamTask* pTask, const SStreamTaskCheckReq* pReq) {
- return atomic_load_8(&pTask->taskStatus) == TASK_STATUS__NORMAL;
+ return atomic_load_8(&pTask->status.taskStatus) == TASK_STATUS__NORMAL;
}
int32_t streamProcessTaskCheckRsp(SStreamTask* pTask, const SStreamTaskCheckRsp* pRsp, int64_t version) {
@@ -160,28 +160,28 @@ int32_t streamProcessTaskCheckRsp(SStreamTask* pTask, const SStreamTaskCheckRsp*
// common
int32_t streamSetParamForRecover(SStreamTask* pTask) {
- void* exec = pTask->exec.executor;
+ void* exec = pTask->exec.pExecutor;
return qStreamSetParamForRecover(exec);
}
int32_t streamRestoreParam(SStreamTask* pTask) {
- void* exec = pTask->exec.executor;
+ void* exec = pTask->exec.pExecutor;
return qStreamRestoreParam(exec);
}
int32_t streamSetStatusNormal(SStreamTask* pTask) {
- atomic_store_8(&pTask->taskStatus, TASK_STATUS__NORMAL);
+ atomic_store_8(&pTask->status.taskStatus, TASK_STATUS__NORMAL);
return 0;
}
// source
int32_t streamSourceRecoverPrepareStep1(SStreamTask* pTask, int64_t ver) {
- void* exec = pTask->exec.executor;
+ void* exec = pTask->exec.pExecutor;
return qStreamSourceRecoverStep1(exec, ver);
}
int32_t streamBuildSourceRecover1Req(SStreamTask* pTask, SStreamRecoverStep1Req* pReq) {
pReq->msgHead.vgId = pTask->nodeId;
- pReq->streamId = pTask->streamId;
- pReq->taskId = pTask->taskId;
+ pReq->streamId = pTask->id.streamId;
+ pReq->taskId = pTask->id.taskId;
return 0;
}
@@ -192,13 +192,13 @@ int32_t streamSourceRecoverScanStep1(SStreamTask* pTask) {
int32_t streamBuildSourceRecover2Req(SStreamTask* pTask, SStreamRecoverStep2Req* pReq) {
pReq->msgHead.vgId = pTask->nodeId;
- pReq->streamId = pTask->streamId;
- pReq->taskId = pTask->taskId;
+ pReq->streamId = pTask->id.streamId;
+ pReq->taskId = pTask->id.taskId;
return 0;
}
int32_t streamSourceRecoverScanStep2(SStreamTask* pTask, int64_t ver) {
- void* exec = pTask->exec.executor;
+ void* exec = pTask->exec.pExecutor;
if (qStreamSourceRecoverStep2(exec, ver) < 0) {
}
return streamScanExec(pTask, 100);
@@ -206,7 +206,7 @@ int32_t streamSourceRecoverScanStep2(SStreamTask* pTask, int64_t ver) {
int32_t streamDispatchRecoverFinishReq(SStreamTask* pTask) {
SStreamRecoverFinishReq req = {
- .streamId = pTask->streamId,
+ .streamId = pTask->id.streamId,
.childId = pTask->selfChildId,
};
// serialize
@@ -227,13 +227,13 @@ int32_t streamDispatchRecoverFinishReq(SStreamTask* pTask) {
// agg
int32_t streamAggRecoverPrepare(SStreamTask* pTask) {
- void* exec = pTask->exec.executor;
+ void* exec = pTask->exec.pExecutor;
pTask->recoverWaitingUpstream = taosArrayGetSize(pTask->childEpInfo);
return 0;
}
int32_t streamAggChildrenRecoverFinish(SStreamTask* pTask) {
- void* exec = pTask->exec.executor;
+ void* exec = pTask->exec.pExecutor;
if (qStreamRestoreParam(exec) < 0) {
return -1;
}
diff --git a/source/libs/stream/src/streamState.c b/source/libs/stream/src/streamState.c
index 4ead4c49b5..9e49ae9e97 100644
--- a/source/libs/stream/src/streamState.c
+++ b/source/libs/stream/src/streamState.c
@@ -120,7 +120,7 @@ SStreamState* streamStateOpen(char* path, SStreamTask* pTask, bool specPath, int
char statePath[1024];
if (!specPath) {
- sprintf(statePath, "%s/%d", path, pTask->taskId);
+ sprintf(statePath, "%s/%d", path, pTask->id.taskId);
} else {
memset(statePath, 0, 1024);
tstrncpy(statePath, path, 1024);
@@ -395,6 +395,32 @@ int32_t streamStateClear(SStreamState* pState) {
void streamStateSetNumber(SStreamState* pState, int32_t number) { pState->number = number; }
+int32_t streamStateSaveInfo(SStreamState* pState, void* pKey, int32_t keyLen, void* pVal, int32_t vLen) {
+#ifdef USE_ROCKSDB
+ int32_t code = 0;
+ void* batch = streamStateCreateBatch();
+ code = streamStatePutBatch(pState, "default", batch, pKey, pVal, vLen);
+ if (code != 0) {
+ return code;
+ }
+ code = streamStatePutBatch_rocksdb(pState, batch);
+ streamStateDestroyBatch(batch);
+ return code;
+#else
+ return 0;
+#endif
+}
+
+int32_t streamStateGetInfo(SStreamState* pState, void* pKey, int32_t keyLen, void** pVal, int32_t* pLen) {
+#ifdef USE_ROCKSDB
+ int32_t code = 0;
+ code = streamDefaultGet_rocksdb(pState, pKey, pVal, pLen);
+ return code;
+#else
+ return 0;
+#endif
+}
+
int32_t streamStateAddIfNotExist(SStreamState* pState, const SWinKey* key, void** pVal, int32_t* pVLen) {
#ifdef USE_ROCKSDB
return streamStateGet(pState, key, pVal, pVLen);
@@ -1066,7 +1092,7 @@ void streamStateDestroy(SStreamState* pState) {
#ifdef USE_ROCKSDB
streamFileStateDestroy(pState->pFileState);
streamStateDestroy_rocksdb(pState);
- taosMemoryFreeClear(pState->parNameMap);
+ tSimpleHashCleanup(pState->parNameMap);
// do nothong
#endif
taosMemoryFreeClear(pState->pTdbState);
diff --git a/source/libs/stream/src/streamTask.c b/source/libs/stream/src/streamTask.c
index e9aba0bc39..4783997276 100644
--- a/source/libs/stream/src/streamTask.c
+++ b/source/libs/stream/src/streamTask.c
@@ -15,15 +15,22 @@
#include "executor.h"
#include "tstream.h"
+#include "wal.h"
-SStreamTask* tNewSStreamTask(int64_t streamId) {
+SStreamTask* tNewStreamTask(int64_t streamId) {
SStreamTask* pTask = (SStreamTask*)taosMemoryCalloc(1, sizeof(SStreamTask));
if (pTask == NULL) {
return NULL;
}
- pTask->taskId = tGenIdPI32();
- pTask->streamId = streamId;
- pTask->schedStatus = TASK_SCHED_STATUS__INACTIVE;
+
+ pTask->id.taskId = tGenIdPI32();
+ pTask->id.streamId = streamId;
+
+ char buf[128] = {0};
+ sprintf(buf, "0x%"PRIx64"-%d", pTask->id.streamId, pTask->id.taskId);
+
+ pTask->id.idStr = taosStrdup(buf);
+ pTask->status.schedStatus = TASK_SCHED_STATUS__INACTIVE;
pTask->inputStatus = TASK_INPUT_STATUS__NORMAL;
pTask->outputStatus = TASK_OUTPUT_STATUS__NORMAL;
@@ -48,24 +55,24 @@ int32_t tDecodeStreamEpInfo(SDecoder* pDecoder, SStreamChildEpInfo* pInfo) {
return 0;
}
-int32_t tEncodeSStreamTask(SEncoder* pEncoder, const SStreamTask* pTask) {
+int32_t tEncodeStreamTask(SEncoder* pEncoder, const SStreamTask* pTask) {
if (tStartEncode(pEncoder) < 0) return -1;
- if (tEncodeI64(pEncoder, pTask->streamId) < 0) return -1;
- if (tEncodeI32(pEncoder, pTask->taskId) < 0) return -1;
+ if (tEncodeI64(pEncoder, pTask->id.streamId) < 0) return -1;
+ if (tEncodeI32(pEncoder, pTask->id.taskId) < 0) return -1;
if (tEncodeI32(pEncoder, pTask->totalLevel) < 0) return -1;
if (tEncodeI8(pEncoder, pTask->taskLevel) < 0) return -1;
if (tEncodeI8(pEncoder, pTask->outputType) < 0) return -1;
if (tEncodeI16(pEncoder, pTask->dispatchMsgType) < 0) return -1;
- if (tEncodeI8(pEncoder, pTask->taskStatus) < 0) return -1;
- if (tEncodeI8(pEncoder, pTask->schedStatus) < 0) return -1;
+ if (tEncodeI8(pEncoder, pTask->status.taskStatus) < 0) return -1;
+ if (tEncodeI8(pEncoder, pTask->status.schedStatus) < 0) return -1;
if (tEncodeI32(pEncoder, pTask->selfChildId) < 0) return -1;
if (tEncodeI32(pEncoder, pTask->nodeId) < 0) return -1;
if (tEncodeSEpSet(pEncoder, &pTask->epSet) < 0) return -1;
- if (tEncodeI64(pEncoder, pTask->recoverSnapVer) < 0) return -1;
- if (tEncodeI64(pEncoder, pTask->startVer) < 0) return -1;
+ if (tEncodeI64(pEncoder, pTask->chkInfo.id) < 0) return -1;
+ if (tEncodeI64(pEncoder, pTask->chkInfo.version) < 0) return -1;
if (tEncodeI8(pEncoder, pTask->fillHistory) < 0) return -1;
int32_t epSz = taosArrayGetSize(pTask->childEpInfo);
@@ -101,24 +108,24 @@ int32_t tEncodeSStreamTask(SEncoder* pEncoder, const SStreamTask* pTask) {
return pEncoder->pos;
}
-int32_t tDecodeSStreamTask(SDecoder* pDecoder, SStreamTask* pTask) {
+int32_t tDecodeStreamTask(SDecoder* pDecoder, SStreamTask* pTask) {
if (tStartDecode(pDecoder) < 0) return -1;
- if (tDecodeI64(pDecoder, &pTask->streamId) < 0) return -1;
- if (tDecodeI32(pDecoder, &pTask->taskId) < 0) return -1;
+ if (tDecodeI64(pDecoder, &pTask->id.streamId) < 0) return -1;
+ if (tDecodeI32(pDecoder, &pTask->id.taskId) < 0) return -1;
if (tDecodeI32(pDecoder, &pTask->totalLevel) < 0) return -1;
if (tDecodeI8(pDecoder, &pTask->taskLevel) < 0) return -1;
if (tDecodeI8(pDecoder, &pTask->outputType) < 0) return -1;
if (tDecodeI16(pDecoder, &pTask->dispatchMsgType) < 0) return -1;
- if (tDecodeI8(pDecoder, &pTask->taskStatus) < 0) return -1;
- if (tDecodeI8(pDecoder, &pTask->schedStatus) < 0) return -1;
+ if (tDecodeI8(pDecoder, &pTask->status.taskStatus) < 0) return -1;
+ if (tDecodeI8(pDecoder, &pTask->status.schedStatus) < 0) return -1;
if (tDecodeI32(pDecoder, &pTask->selfChildId) < 0) return -1;
if (tDecodeI32(pDecoder, &pTask->nodeId) < 0) return -1;
if (tDecodeSEpSet(pDecoder, &pTask->epSet) < 0) return -1;
- if (tDecodeI64(pDecoder, &pTask->recoverSnapVer) < 0) return -1;
- if (tDecodeI64(pDecoder, &pTask->startVer) < 0) return -1;
+ if (tDecodeI64(pDecoder, &pTask->chkInfo.id) < 0) return -1;
+ if (tDecodeI64(pDecoder, &pTask->chkInfo.version) < 0) return -1;
if (tDecodeI8(pDecoder, &pTask->fillHistory) < 0) return -1;
int32_t epSz;
@@ -162,24 +169,52 @@ int32_t tDecodeSStreamTask(SDecoder* pDecoder, SStreamTask* pTask) {
return 0;
}
-void tFreeSStreamTask(SStreamTask* pTask) {
- qDebug("free stream task %d", pTask->taskId);
- if (pTask->inputQueue) streamQueueClose(pTask->inputQueue);
- if (pTask->outputQueue) streamQueueClose(pTask->outputQueue);
- if (pTask->exec.qmsg) taosMemoryFree(pTask->exec.qmsg);
- if (pTask->exec.executor) qDestroyTask(pTask->exec.executor);
+void tFreeStreamTask(SStreamTask* pTask) {
+ qDebug("free s-task:%s", pTask->id.idStr);
+
+ if (pTask->inputQueue) {
+ streamQueueClose(pTask->inputQueue);
+ }
+ if (pTask->outputQueue) {
+ streamQueueClose(pTask->outputQueue);
+ }
+ if (pTask->exec.qmsg) {
+ taosMemoryFree(pTask->exec.qmsg);
+ }
+
+ if (pTask->exec.pExecutor) {
+ qDestroyTask(pTask->exec.pExecutor);
+ pTask->exec.pExecutor = NULL;
+ }
+
+ if (pTask->exec.pTqReader != NULL && pTask->freeFp != NULL) {
+ pTask->freeFp(pTask->exec.pTqReader);
+ pTask->exec.pTqReader = NULL;
+ }
+
+ if (pTask->exec.pWalReader != NULL) {
+ walCloseReader(pTask->exec.pWalReader);
+ }
+
taosArrayDestroyP(pTask->childEpInfo, taosMemoryFree);
if (pTask->outputType == TASK_OUTPUT__TABLE) {
tDeleteSSchemaWrapper(pTask->tbSink.pSchemaWrapper);
taosMemoryFree(pTask->tbSink.pTSchema);
}
+
if (pTask->outputType == TASK_OUTPUT__SHUFFLE_DISPATCH) {
taosArrayDestroy(pTask->shuffleDispatcher.dbInfo.pVgroupInfos);
taosArrayDestroy(pTask->checkReqIds);
pTask->checkReqIds = NULL;
}
- if (pTask->pState) streamStateClose(pTask->pState);
+ if (pTask->pState) {
+ streamStateClose(pTask->pState);
+ }
+
+ if (pTask->id.idStr != NULL) {
+ taosMemoryFree((void*)pTask->id.idStr);
+ }
taosMemoryFree(pTask);
}
diff --git a/source/libs/stream/src/streamUpdate.c b/source/libs/stream/src/streamUpdate.c
index 70a1c543f6..fff666ec9f 100644
--- a/source/libs/stream/src/streamUpdate.c
+++ b/source/libs/stream/src/streamUpdate.c
@@ -274,7 +274,10 @@ void updateInfoDestoryColseWinSBF(SUpdateInfo *pInfo) {
}
int32_t updateInfoSerialize(void *buf, int32_t bufLen, const SUpdateInfo *pInfo) {
- ASSERT(pInfo);
+ if(!pInfo) {
+ return 0;
+ }
+
SEncoder encoder = {0};
tEncoderInit(&encoder, buf, bufLen);
if (tStartEncode(&encoder) < 0) return -1;
diff --git a/source/libs/sync/inc/syncPipeline.h b/source/libs/sync/inc/syncPipeline.h
index a1de2ee71a..d709e33cd4 100644
--- a/source/libs/sync/inc/syncPipeline.h
+++ b/source/libs/sync/inc/syncPipeline.h
@@ -59,36 +59,37 @@ typedef struct SSyncLogBuffer {
} SSyncLogBuffer;
// SSyncLogRepMgr
-SSyncLogReplMgr* syncLogReplMgrCreate();
-void syncLogReplMgrDestroy(SSyncLogReplMgr* pMgr);
-void syncLogReplMgrReset(SSyncLogReplMgr* pMgr);
+SSyncLogReplMgr* syncLogReplCreate();
+void syncLogReplDestroy(SSyncLogReplMgr* pMgr);
+void syncLogReplReset(SSyncLogReplMgr* pMgr);
-int32_t syncNodeLogReplMgrInit(SSyncNode* pNode);
-void syncNodeLogReplMgrDestroy(SSyncNode* pNode);
+int32_t syncNodeLogReplInit(SSyncNode* pNode);
+void syncNodeLogReplDestroy(SSyncNode* pNode);
// access
-static FORCE_INLINE int64_t syncLogGetRetryBackoffTimeMs(SSyncLogReplMgr* pMgr) {
+static FORCE_INLINE int64_t syncLogReplGetRetryBackoffTimeMs(SSyncLogReplMgr* pMgr) {
return ((int64_t)1 << pMgr->retryBackoff) * SYNC_LOG_REPL_RETRY_WAIT_MS;
}
-static FORCE_INLINE int32_t syncLogGetNextRetryBackoff(SSyncLogReplMgr* pMgr) {
+static FORCE_INLINE int32_t syncLogReplGetNextRetryBackoff(SSyncLogReplMgr* pMgr) {
return TMIN(pMgr->retryBackoff + 1, SYNC_MAX_RETRY_BACKOFF);
}
-SyncTerm syncLogReplMgrGetPrevLogTerm(SSyncLogReplMgr* pMgr, SSyncNode* pNode, SyncIndex index);
+SyncTerm syncLogReplGetPrevLogTerm(SSyncLogReplMgr* pMgr, SSyncNode* pNode, SyncIndex index);
-int32_t syncLogReplMgrReplicateOnce(SSyncLogReplMgr* pMgr, SSyncNode* pNode);
-int32_t syncLogReplMgrReplicateOneTo(SSyncLogReplMgr* pMgr, SSyncNode* pNode, SyncIndex index, SyncTerm* pTerm,
- SRaftId* pDestId, bool* pBarrier);
-int32_t syncLogReplMgrReplicateAttempt(SSyncLogReplMgr* pMgr, SSyncNode* pNode);
-int32_t syncLogReplMgrReplicateProbe(SSyncLogReplMgr* pMgr, SSyncNode* pNode, SyncIndex index);
+int32_t syncLogReplDoOnce(SSyncLogReplMgr* pMgr, SSyncNode* pNode);
+int32_t syncLogReplAttempt(SSyncLogReplMgr* pMgr, SSyncNode* pNode);
+int32_t syncLogReplProbe(SSyncLogReplMgr* pMgr, SSyncNode* pNode, SyncIndex index);
-int32_t syncLogReplMgrProcessReply(SSyncLogReplMgr* pMgr, SSyncNode* pNode, SyncAppendEntriesReply* pMsg);
-int32_t syncLogReplMgrProcessReplyAsRecovery(SSyncLogReplMgr* pMgr, SSyncNode* pNode, SyncAppendEntriesReply* pMsg);
-int32_t syncLogReplMgrProcessReplyAsNormal(SSyncLogReplMgr* pMgr, SSyncNode* pNode, SyncAppendEntriesReply* pMsg);
+int32_t syncLogReplRetryOnNeed(SSyncLogReplMgr* pMgr, SSyncNode* pNode);
+int32_t syncLogReplSendTo(SSyncLogReplMgr* pMgr, SSyncNode* pNode, SyncIndex index, SyncTerm* pTerm, SRaftId* pDestId,
+ bool* pBarrier);
-int32_t syncLogReplMgrProcessHeartbeatReply(SSyncLogReplMgr* pMgr, SSyncNode* pNode, SyncHeartbeatReply* pMsg);
-int32_t syncLogReplMgrRetryOnNeed(SSyncLogReplMgr* pMgr, SSyncNode* pNode);
+int32_t syncLogReplProcessReply(SSyncLogReplMgr* pMgr, SSyncNode* pNode, SyncAppendEntriesReply* pMsg);
+int32_t syncLogReplProcessReplyAsRecovery(SSyncLogReplMgr* pMgr, SSyncNode* pNode, SyncAppendEntriesReply* pMsg);
+int32_t syncLogReplProcessReplyAsNormal(SSyncLogReplMgr* pMgr, SSyncNode* pNode, SyncAppendEntriesReply* pMsg);
+
+int32_t syncLogReplProcessHeartbeatReply(SSyncLogReplMgr* pMgr, SSyncNode* pNode, SyncHeartbeatReply* pMsg);
// SSyncLogBuffer
SSyncLogBuffer* syncLogBufferCreate();
@@ -100,6 +101,7 @@ int32_t syncLogBufferReInit(SSyncLogBuffer* pBuf, SSyncNode* pNode);
int64_t syncLogBufferGetEndIndex(SSyncLogBuffer* pBuf);
SyncTerm syncLogBufferGetLastMatchTerm(SSyncLogBuffer* pBuf);
bool syncLogBufferIsEmpty(SSyncLogBuffer* pBuf);
+
int32_t syncLogBufferAppend(SSyncLogBuffer* pBuf, SSyncNode* pNode, SSyncRaftEntry* pEntry);
int32_t syncLogBufferAccept(SSyncLogBuffer* pBuf, SSyncNode* pNode, SSyncRaftEntry* pEntry, SyncTerm prevTerm);
int64_t syncLogBufferProceed(SSyncLogBuffer* pBuf, SSyncNode* pNode, SyncTerm* pMatchTerm);
@@ -111,8 +113,8 @@ SSyncRaftEntry* syncLogBufferGetOneEntry(SSyncLogBuffer* pBuf, SSyncNode* pNode,
int32_t syncLogBufferValidate(SSyncLogBuffer* pBuf);
int32_t syncLogBufferRollback(SSyncLogBuffer* pBuf, SSyncNode* pNode, SyncIndex toIndex);
-int32_t syncLogFsmExecute(SSyncNode* pNode, SSyncFSM* pFsm, ESyncState role, SyncTerm term, SSyncRaftEntry* pEntry,
- int32_t applyCode);
+int32_t syncFsmExecute(SSyncNode* pNode, SSyncFSM* pFsm, ESyncState role, SyncTerm term, SSyncRaftEntry* pEntry,
+ int32_t applyCode);
#ifdef __cplusplus
}
#endif
diff --git a/source/libs/sync/inc/syncRaftEntry.h b/source/libs/sync/inc/syncRaftEntry.h
index a39e043c52..f9447e0168 100644
--- a/source/libs/sync/inc/syncRaftEntry.h
+++ b/source/libs/sync/inc/syncRaftEntry.h
@@ -45,7 +45,7 @@ SSyncRaftEntry* syncEntryBuildNoop(SyncTerm term, SyncIndex index, int32_t vgId)
void syncEntryDestroy(SSyncRaftEntry* pEntry);
void syncEntry2OriginalRpc(const SSyncRaftEntry* pEntry, SRpcMsg* pRpcMsg); // step 7
-static FORCE_INLINE bool syncLogIsReplicationBarrier(SSyncRaftEntry* pEntry) {
+static FORCE_INLINE bool syncLogReplBarrier(SSyncRaftEntry* pEntry) {
return pEntry->originalRpcType == TDMT_SYNC_NOOP;
}
diff --git a/source/libs/sync/src/syncAppendEntriesReply.c b/source/libs/sync/src/syncAppendEntriesReply.c
index a60f43cd5e..7c343c0e5d 100644
--- a/source/libs/sync/src/syncAppendEntriesReply.c
+++ b/source/libs/sync/src/syncAppendEntriesReply.c
@@ -85,7 +85,7 @@ int32_t syncNodeOnAppendEntriesReply(SSyncNode* ths, const SRpcMsg* pRpcMsg) {
sError("vgId:%d, failed to get log repl mgr for src addr: 0x%016" PRIx64, ths->vgId, pMsg->srcId.addr);
return -1;
}
- (void)syncLogReplMgrProcessReply(pMgr, ths, pMsg);
+ (void)syncLogReplProcessReply(pMgr, ths, pMsg);
}
return 0;
}
diff --git a/source/libs/sync/src/syncMain.c b/source/libs/sync/src/syncMain.c
index 524daee7cf..966b3ed093 100644
--- a/source/libs/sync/src/syncMain.c
+++ b/source/libs/sync/src/syncMain.c
@@ -617,7 +617,7 @@ int32_t syncNodePropose(SSyncNode* pSyncNode, SRpcMsg* pMsg, bool isWeak, int64_
sNTrace(pSyncNode, "propose msg, type:%s", TMSG_INFO(pMsg->msgType));
code = (*pSyncNode->syncEqMsg)(pSyncNode->msgcb, &rpcMsg);
if (code != 0) {
- sError("vgId:%d, failed to propose msg while enqueue since %s", pSyncNode->vgId, terrstr());
+ sWarn("vgId:%d, failed to propose msg while enqueue since %s", pSyncNode->vgId, terrstr());
(void)syncRespMgrDel(pSyncNode->pSyncRespMgr, seqNum);
}
@@ -967,7 +967,7 @@ SSyncNode* syncNodeOpen(SSyncInfo* pSyncInfo) {
pSyncNode->changing = false;
// replication mgr
- if (syncNodeLogReplMgrInit(pSyncNode) < 0) {
+ if (syncNodeLogReplInit(pSyncNode) < 0) {
sError("vgId:%d, failed to init repl mgr since %s.", pSyncNode->vgId, terrstr());
goto _error;
}
@@ -1140,7 +1140,7 @@ void syncNodeClose(SSyncNode* pSyncNode) {
syncNodeStopPingTimer(pSyncNode);
syncNodeStopElectTimer(pSyncNode);
syncNodeStopHeartbeatTimer(pSyncNode);
- syncNodeLogReplMgrDestroy(pSyncNode);
+ syncNodeLogReplDestroy(pSyncNode);
syncRespMgrDestroy(pSyncNode->pSyncRespMgr);
pSyncNode->pSyncRespMgr = NULL;
@@ -2182,7 +2182,7 @@ int32_t syncNodeAppend(SSyncNode* ths, SSyncRaftEntry* pEntry) {
if (syncLogBufferAppend(ths->pLogBuf, ths, pEntry) < 0) {
sError("vgId:%d, failed to enqueue sync log buffer, index:%" PRId64, ths->vgId, pEntry->index);
ASSERT(terrno != 0);
- (void)syncLogFsmExecute(ths, ths->pFsm, ths->state, raftStoreGetTerm(ths), pEntry, terrno);
+ (void)syncFsmExecute(ths, ths->pFsm, ths->state, raftStoreGetTerm(ths), pEntry, terrno);
syncEntryDestroy(pEntry);
return -1;
}
@@ -2400,7 +2400,7 @@ int32_t syncNodeOnHeartbeatReply(SSyncNode* ths, const SRpcMsg* pRpcMsg) {
syncIndexMgrSetRecvTime(ths->pMatchIndex, &pMsg->srcId, tsMs);
- return syncLogReplMgrProcessHeartbeatReply(pMgr, ths, pMsg);
+ return syncLogReplProcessHeartbeatReply(pMgr, ths, pMsg);
}
int32_t syncNodeOnHeartbeatReplyOld(SSyncNode* ths, const SRpcMsg* pRpcMsg) {
diff --git a/source/libs/sync/src/syncPipeline.c b/source/libs/sync/src/syncPipeline.c
index 6600b505c1..6bebef77dc 100644
--- a/source/libs/sync/src/syncPipeline.c
+++ b/source/libs/sync/src/syncPipeline.c
@@ -86,7 +86,7 @@ _err:
return -1;
}
-SyncTerm syncLogReplMgrGetPrevLogTerm(SSyncLogReplMgr* pMgr, SSyncNode* pNode, SyncIndex index) {
+SyncTerm syncLogReplGetPrevLogTerm(SSyncLogReplMgr* pMgr, SSyncNode* pNode, SyncIndex index) {
SSyncLogBuffer* pBuf = pNode->pLogBuf;
SSyncRaftEntry* pEntry = NULL;
SyncIndex prevIndex = index - 1;
@@ -316,7 +316,7 @@ int32_t syncLogBufferAccept(SSyncLogBuffer* pBuf, SSyncNode* pNode, SSyncRaftEnt
" %" PRId64 ", %" PRId64 ")",
pNode->vgId, pEntry->index, pEntry->term, pBuf->startIndex, pBuf->commitIndex, pBuf->matchIndex,
pBuf->endIndex);
- SyncTerm term = syncLogReplMgrGetPrevLogTerm(NULL, pNode, index + 1);
+ SyncTerm term = syncLogReplGetPrevLogTerm(NULL, pNode, index + 1);
ASSERT(pEntry->term >= 0);
if (term == pEntry->term) {
ret = 0;
@@ -351,7 +351,7 @@ int32_t syncLogBufferAccept(SSyncLogBuffer* pBuf, SSyncNode* pNode, SSyncRaftEnt
" %" PRId64 " %" PRId64 ", %" PRId64 ")",
pNode->vgId, pEntry->index, pEntry->term, pBuf->startIndex, pBuf->commitIndex, pBuf->matchIndex,
pBuf->endIndex);
- SyncTerm existPrevTerm = syncLogReplMgrGetPrevLogTerm(NULL, pNode, index);
+ SyncTerm existPrevTerm = syncLogReplGetPrevLogTerm(NULL, pNode, index);
ASSERT(pEntry->term == pExist->term && (pEntry->index > pBuf->matchIndex || prevTerm == existPrevTerm));
ret = 0;
goto _out;
@@ -482,8 +482,8 @@ _out:
return matchIndex;
}
-int32_t syncLogFsmExecute(SSyncNode* pNode, SSyncFSM* pFsm, ESyncState role, SyncTerm term, SSyncRaftEntry* pEntry,
- int32_t applyCode) {
+int32_t syncFsmExecute(SSyncNode* pNode, SSyncFSM* pFsm, ESyncState role, SyncTerm term, SSyncRaftEntry* pEntry,
+ int32_t applyCode) {
if (pNode->replicaNum == 1 && pNode->restoreFinish && pNode->vgId != 1) {
return 0;
}
@@ -564,7 +564,7 @@ int32_t syncLogBufferCommit(SSyncLogBuffer* pBuf, SSyncNode* pNode, int64_t comm
pEntry->term, TMSG_INFO(pEntry->originalRpcType));
}
- if (syncLogFsmExecute(pNode, pFsm, role, currentTerm, pEntry, 0) != 0) {
+ if (syncFsmExecute(pNode, pFsm, role, currentTerm, pEntry, 0) != 0) {
sError("vgId:%d, failed to execute sync log entry. index:%" PRId64 ", term:%" PRId64
", role:%d, current term:%" PRId64,
vgId, pEntry->index, pEntry->term, role, currentTerm);
@@ -611,7 +611,7 @@ _out:
return ret;
}
-void syncLogReplMgrReset(SSyncLogReplMgr* pMgr) {
+void syncLogReplReset(SSyncLogReplMgr* pMgr) {
if (pMgr == NULL) return;
ASSERT(pMgr->startIndex >= 0);
@@ -625,22 +625,22 @@ void syncLogReplMgrReset(SSyncLogReplMgr* pMgr) {
pMgr->retryBackoff = 0;
}
-int32_t syncLogReplMgrRetryOnNeed(SSyncLogReplMgr* pMgr, SSyncNode* pNode) {
+int32_t syncLogReplRetryOnNeed(SSyncLogReplMgr* pMgr, SSyncNode* pNode) {
if (pMgr->endIndex <= pMgr->startIndex) {
return 0;
}
SRaftId* pDestId = &pNode->replicasId[pMgr->peerId];
if (pMgr->retryBackoff == SYNC_MAX_RETRY_BACKOFF) {
- syncLogReplMgrReset(pMgr);
- sWarn("vgId:%d, reset sync log repl mgr since retry backoff exceeding limit. peer:%" PRIx64, pNode->vgId,
+ syncLogReplReset(pMgr);
+ sWarn("vgId:%d, reset sync log repl since retry backoff exceeding limit. peer:%" PRIx64, pNode->vgId,
pDestId->addr);
return -1;
}
int32_t ret = -1;
bool retried = false;
- int64_t retryWaitMs = syncLogGetRetryBackoffTimeMs(pMgr);
+ int64_t retryWaitMs = syncLogReplGetRetryBackoffTimeMs(pMgr);
int64_t nowMs = taosGetMonoTimestampMs();
int count = 0;
int64_t firstIndex = -1;
@@ -657,16 +657,16 @@ int32_t syncLogReplMgrRetryOnNeed(SSyncLogReplMgr* pMgr, SSyncNode* pNode) {
if (pMgr->states[pos].acked) {
if (pMgr->matchIndex < index && pMgr->states[pos].timeMs + (syncGetRetryMaxWaitMs() << 3) < nowMs) {
- syncLogReplMgrReset(pMgr);
- sWarn("vgId:%d, reset sync log repl mgr since stagnation. index:%" PRId64 ", peer:%" PRIx64, pNode->vgId,
- index, pDestId->addr);
+ syncLogReplReset(pMgr);
+ sWarn("vgId:%d, reset sync log repl since stagnation. index:%" PRId64 ", peer:%" PRIx64, pNode->vgId, index,
+ pDestId->addr);
goto _out;
}
continue;
}
bool barrier = false;
- if (syncLogReplMgrReplicateOneTo(pMgr, pNode, index, &term, pDestId, &barrier) < 0) {
+ if (syncLogReplSendTo(pMgr, pNode, index, &term, pDestId, &barrier) < 0) {
sError("vgId:%d, failed to replicate sync log entry since %s. index:%" PRId64 ", dest:%" PRIx64 "", pNode->vgId,
terrstr(), index, pDestId->addr);
goto _out;
@@ -687,7 +687,7 @@ int32_t syncLogReplMgrRetryOnNeed(SSyncLogReplMgr* pMgr, SSyncNode* pNode) {
ret = 0;
_out:
if (retried) {
- pMgr->retryBackoff = syncLogGetNextRetryBackoff(pMgr);
+ pMgr->retryBackoff = syncLogReplGetNextRetryBackoff(pMgr);
SSyncLogBuffer* pBuf = pNode->pLogBuf;
sInfo("vgId:%d, resend %d sync log entries. dest:%" PRIx64 ", indexes:%" PRId64 " ..., terms: ... %" PRId64
", retryWaitMs:%" PRId64 ", mgr: [%" PRId64 " %" PRId64 ", %" PRId64 "), buffer: [%" PRId64 " %" PRId64
@@ -698,7 +698,7 @@ _out:
return ret;
}
-int32_t syncLogReplMgrProcessReplyAsRecovery(SSyncLogReplMgr* pMgr, SSyncNode* pNode, SyncAppendEntriesReply* pMsg) {
+int32_t syncLogReplProcessReplyAsRecovery(SSyncLogReplMgr* pMgr, SSyncNode* pNode, SyncAppendEntriesReply* pMsg) {
SSyncLogBuffer* pBuf = pNode->pLogBuf;
SRaftId destId = pMsg->srcId;
ASSERT(pMgr->restored == false);
@@ -708,7 +708,7 @@ int32_t syncLogReplMgrProcessReplyAsRecovery(SSyncLogReplMgr* pMgr, SSyncNode* p
ASSERT(pMgr->matchIndex == 0);
if (pMsg->matchIndex < 0) {
pMgr->restored = true;
- sInfo("vgId:%d, sync log repl mgr restored. peer: dnode:%d (%" PRIx64 "), mgr: rs(%d) [%" PRId64 " %" PRId64
+ sInfo("vgId:%d, sync log repl restored. peer: dnode:%d (%" PRIx64 "), mgr: rs(%d) [%" PRId64 " %" PRId64
", %" PRId64 "), buffer: [%" PRId64 " %" PRId64 " %" PRId64 ", %" PRId64 ")",
pNode->vgId, DID(&destId), destId.addr, pMgr->restored, pMgr->startIndex, pMgr->matchIndex, pMgr->endIndex,
pBuf->startIndex, pBuf->commitIndex, pBuf->matchIndex, pBuf->endIndex);
@@ -716,7 +716,7 @@ int32_t syncLogReplMgrProcessReplyAsRecovery(SSyncLogReplMgr* pMgr, SSyncNode* p
}
} else {
if (pMsg->lastSendIndex < pMgr->startIndex || pMsg->lastSendIndex >= pMgr->endIndex) {
- syncLogReplMgrRetryOnNeed(pMgr, pNode);
+ syncLogReplRetryOnNeed(pMgr, pNode);
return 0;
}
@@ -725,7 +725,7 @@ int32_t syncLogReplMgrProcessReplyAsRecovery(SSyncLogReplMgr* pMgr, SSyncNode* p
if (pMsg->success && pMsg->matchIndex == pMsg->lastSendIndex) {
pMgr->matchIndex = pMsg->matchIndex;
pMgr->restored = true;
- sInfo("vgId:%d, sync log repl mgr restored. peer: dnode:%d (%" PRIx64 "), mgr: rs(%d) [%" PRId64 " %" PRId64
+ sInfo("vgId:%d, sync log repl restored. peer: dnode:%d (%" PRIx64 "), mgr: rs(%d) [%" PRId64 " %" PRId64
", %" PRId64 "), buffer: [%" PRId64 " %" PRId64 " %" PRId64 ", %" PRId64 ")",
pNode->vgId, DID(&destId), destId.addr, pMgr->restored, pMgr->startIndex, pMgr->matchIndex, pMgr->endIndex,
pBuf->startIndex, pBuf->commitIndex, pBuf->matchIndex, pBuf->endIndex);
@@ -750,7 +750,7 @@ int32_t syncLogReplMgrProcessReplyAsRecovery(SSyncLogReplMgr* pMgr, SSyncNode* p
SyncIndex index = TMIN(pMsg->matchIndex, pNode->pLogBuf->matchIndex);
if (pMsg->matchIndex < pNode->pLogBuf->matchIndex) {
- term = syncLogReplMgrGetPrevLogTerm(pMgr, pNode, index + 1);
+ term = syncLogReplGetPrevLogTerm(pMgr, pNode, index + 1);
if ((index + 1 < firstVer) || (term < 0) ||
(term != pMsg->lastMatchTerm && (index + 1 == firstVer || index == firstVer))) {
ASSERT(term >= 0 || terrno == TSDB_CODE_WAL_LOG_NOT_EXIST);
@@ -773,53 +773,52 @@ int32_t syncLogReplMgrProcessReplyAsRecovery(SSyncLogReplMgr* pMgr, SSyncNode* p
}
// attempt to replicate the raft log at index
- (void)syncLogReplMgrReset(pMgr);
- return syncLogReplMgrReplicateProbe(pMgr, pNode, index);
+ (void)syncLogReplReset(pMgr);
+ return syncLogReplProbe(pMgr, pNode, index);
}
-int32_t syncLogReplMgrProcessHeartbeatReply(SSyncLogReplMgr* pMgr, SSyncNode* pNode, SyncHeartbeatReply* pMsg) {
+int32_t syncLogReplProcessHeartbeatReply(SSyncLogReplMgr* pMgr, SSyncNode* pNode, SyncHeartbeatReply* pMsg) {
SSyncLogBuffer* pBuf = pNode->pLogBuf;
taosThreadMutexLock(&pBuf->mutex);
if (pMsg->startTime != 0 && pMsg->startTime != pMgr->peerStartTime) {
- sInfo("vgId:%d, reset sync log repl mgr in heartbeat. peer:%" PRIx64 ", start time:%" PRId64 ", old:%" PRId64 "",
+ sInfo("vgId:%d, reset sync log repl in heartbeat. peer:%" PRIx64 ", start time:%" PRId64 ", old:%" PRId64 "",
pNode->vgId, pMsg->srcId.addr, pMsg->startTime, pMgr->peerStartTime);
- syncLogReplMgrReset(pMgr);
+ syncLogReplReset(pMgr);
pMgr->peerStartTime = pMsg->startTime;
}
taosThreadMutexUnlock(&pBuf->mutex);
return 0;
}
-int32_t syncLogReplMgrProcessReply(SSyncLogReplMgr* pMgr, SSyncNode* pNode, SyncAppendEntriesReply* pMsg) {
+int32_t syncLogReplProcessReply(SSyncLogReplMgr* pMgr, SSyncNode* pNode, SyncAppendEntriesReply* pMsg) {
SSyncLogBuffer* pBuf = pNode->pLogBuf;
taosThreadMutexLock(&pBuf->mutex);
if (pMsg->startTime != pMgr->peerStartTime) {
- sInfo("vgId:%d, reset sync log repl mgr in appendlog reply. peer:%" PRIx64 ", start time:%" PRId64
- ", old:%" PRId64,
+ sInfo("vgId:%d, reset sync log repl in appendlog reply. peer:%" PRIx64 ", start time:%" PRId64 ", old:%" PRId64,
pNode->vgId, pMsg->srcId.addr, pMsg->startTime, pMgr->peerStartTime);
- syncLogReplMgrReset(pMgr);
+ syncLogReplReset(pMgr);
pMgr->peerStartTime = pMsg->startTime;
}
if (pMgr->restored) {
- (void)syncLogReplMgrProcessReplyAsNormal(pMgr, pNode, pMsg);
+ (void)syncLogReplProcessReplyAsNormal(pMgr, pNode, pMsg);
} else {
- (void)syncLogReplMgrProcessReplyAsRecovery(pMgr, pNode, pMsg);
+ (void)syncLogReplProcessReplyAsRecovery(pMgr, pNode, pMsg);
}
taosThreadMutexUnlock(&pBuf->mutex);
return 0;
}
-int32_t syncLogReplMgrReplicateOnce(SSyncLogReplMgr* pMgr, SSyncNode* pNode) {
+int32_t syncLogReplDoOnce(SSyncLogReplMgr* pMgr, SSyncNode* pNode) {
if (pMgr->restored) {
- (void)syncLogReplMgrReplicateAttempt(pMgr, pNode);
+ (void)syncLogReplAttempt(pMgr, pNode);
} else {
- (void)syncLogReplMgrReplicateProbe(pMgr, pNode, pNode->pLogBuf->matchIndex);
+ (void)syncLogReplProbe(pMgr, pNode, pNode->pLogBuf->matchIndex);
}
return 0;
}
-int32_t syncLogReplMgrReplicateProbe(SSyncLogReplMgr* pMgr, SSyncNode* pNode, SyncIndex index) {
+int32_t syncLogReplProbe(SSyncLogReplMgr* pMgr, SSyncNode* pNode, SyncIndex index) {
ASSERT(!pMgr->restored);
ASSERT(pMgr->startIndex >= 0);
int64_t retryMaxWaitMs = syncGetRetryMaxWaitMs();
@@ -829,12 +828,12 @@ int32_t syncLogReplMgrReplicateProbe(SSyncLogReplMgr* pMgr, SSyncNode* pNode, Sy
nowMs < pMgr->states[pMgr->startIndex % pMgr->size].timeMs + retryMaxWaitMs) {
return 0;
}
- (void)syncLogReplMgrReset(pMgr);
+ (void)syncLogReplReset(pMgr);
SRaftId* pDestId = &pNode->replicasId[pMgr->peerId];
bool barrier = false;
SyncTerm term = -1;
- if (syncLogReplMgrReplicateOneTo(pMgr, pNode, index, &term, pDestId, &barrier) < 0) {
+ if (syncLogReplSendTo(pMgr, pNode, index, &term, pDestId, &barrier) < 0) {
sError("vgId:%d, failed to replicate log entry since %s. index:%" PRId64 ", dest: 0x%016" PRIx64 "", pNode->vgId,
terrstr(), index, pDestId->addr);
return -1;
@@ -857,7 +856,7 @@ int32_t syncLogReplMgrReplicateProbe(SSyncLogReplMgr* pMgr, SSyncNode* pNode, Sy
return 0;
}
-int32_t syncLogReplMgrReplicateAttempt(SSyncLogReplMgr* pMgr, SSyncNode* pNode) {
+int32_t syncLogReplAttempt(SSyncLogReplMgr* pMgr, SSyncNode* pNode) {
ASSERT(pMgr->restored);
SRaftId* pDestId = &pNode->replicasId[pMgr->peerId];
@@ -879,7 +878,7 @@ int32_t syncLogReplMgrReplicateAttempt(SSyncLogReplMgr* pMgr, SSyncNode* pNode)
SRaftId* pDestId = &pNode->replicasId[pMgr->peerId];
bool barrier = false;
SyncTerm term = -1;
- if (syncLogReplMgrReplicateOneTo(pMgr, pNode, index, &term, pDestId, &barrier) < 0) {
+ if (syncLogReplSendTo(pMgr, pNode, index, &term, pDestId, &barrier) < 0) {
sError("vgId:%d, failed to replicate log entry since %s. index:%" PRId64 ", dest: 0x%016" PRIx64 "", pNode->vgId,
terrstr(), index, pDestId->addr);
return -1;
@@ -902,7 +901,7 @@ int32_t syncLogReplMgrReplicateAttempt(SSyncLogReplMgr* pMgr, SSyncNode* pNode)
}
}
- syncLogReplMgrRetryOnNeed(pMgr, pNode);
+ syncLogReplRetryOnNeed(pMgr, pNode);
SSyncLogBuffer* pBuf = pNode->pLogBuf;
sTrace("vgId:%d, replicated %d msgs to peer:%" PRIx64 ". indexes:%" PRId64 "..., terms: ...%" PRId64
@@ -913,14 +912,14 @@ int32_t syncLogReplMgrReplicateAttempt(SSyncLogReplMgr* pMgr, SSyncNode* pNode)
return 0;
}
-int32_t syncLogReplMgrProcessReplyAsNormal(SSyncLogReplMgr* pMgr, SSyncNode* pNode, SyncAppendEntriesReply* pMsg) {
+int32_t syncLogReplProcessReplyAsNormal(SSyncLogReplMgr* pMgr, SSyncNode* pNode, SyncAppendEntriesReply* pMsg) {
ASSERT(pMgr->restored == true);
if (pMgr->startIndex <= pMsg->lastSendIndex && pMsg->lastSendIndex < pMgr->endIndex) {
if (pMgr->startIndex < pMgr->matchIndex && pMgr->retryBackoff > 0) {
- int64_t firstSentMs = pMgr->states[pMgr->startIndex % pMgr->size].timeMs;
- int64_t lastSentMs = pMgr->states[(pMgr->endIndex - 1) % pMgr->size].timeMs;
- int64_t timeDiffMs = lastSentMs - firstSentMs;
- if (timeDiffMs > 0 && timeDiffMs < ((int64_t)SYNC_LOG_REPL_RETRY_WAIT_MS << (pMgr->retryBackoff - 1))) {
+ int64_t firstMs = pMgr->states[pMgr->startIndex % pMgr->size].timeMs;
+ int64_t lastMs = pMgr->states[(pMgr->endIndex - 1) % pMgr->size].timeMs;
+ int64_t diffMs = lastMs - firstMs;
+ if (diffMs > 0 && diffMs < ((int64_t)SYNC_LOG_REPL_RETRY_WAIT_MS << (pMgr->retryBackoff - 1))) {
pMgr->retryBackoff -= 1;
}
}
@@ -932,10 +931,10 @@ int32_t syncLogReplMgrProcessReplyAsNormal(SSyncLogReplMgr* pMgr, SSyncNode* pNo
pMgr->startIndex = pMgr->matchIndex;
}
- return syncLogReplMgrReplicateAttempt(pMgr, pNode);
+ return syncLogReplAttempt(pMgr, pNode);
}
-SSyncLogReplMgr* syncLogReplMgrCreate() {
+SSyncLogReplMgr* syncLogReplCreate() {
SSyncLogReplMgr* pMgr = taosMemoryCalloc(1, sizeof(SSyncLogReplMgr));
if (pMgr == NULL) {
terrno = TSDB_CODE_OUT_OF_MEMORY;
@@ -949,7 +948,7 @@ SSyncLogReplMgr* syncLogReplMgrCreate() {
return pMgr;
}
-void syncLogReplMgrDestroy(SSyncLogReplMgr* pMgr) {
+void syncLogReplDestroy(SSyncLogReplMgr* pMgr) {
if (pMgr == NULL) {
return;
}
@@ -957,10 +956,10 @@ void syncLogReplMgrDestroy(SSyncLogReplMgr* pMgr) {
return;
}
-int32_t syncNodeLogReplMgrInit(SSyncNode* pNode) {
+int32_t syncNodeLogReplInit(SSyncNode* pNode) {
for (int i = 0; i < TSDB_MAX_REPLICA; i++) {
ASSERT(pNode->logReplMgrs[i] == NULL);
- pNode->logReplMgrs[i] = syncLogReplMgrCreate();
+ pNode->logReplMgrs[i] = syncLogReplCreate();
if (pNode->logReplMgrs[i] == NULL) {
terrno = TSDB_CODE_OUT_OF_MEMORY;
return -1;
@@ -970,9 +969,9 @@ int32_t syncNodeLogReplMgrInit(SSyncNode* pNode) {
return 0;
}
-void syncNodeLogReplMgrDestroy(SSyncNode* pNode) {
+void syncNodeLogReplDestroy(SSyncNode* pNode) {
for (int i = 0; i < TSDB_MAX_REPLICA; i++) {
- syncLogReplMgrDestroy(pNode->logReplMgrs[i]);
+ syncLogReplDestroy(pNode->logReplMgrs[i]);
pNode->logReplMgrs[i] = NULL;
}
}
@@ -1103,7 +1102,7 @@ int32_t syncLogBufferReset(SSyncLogBuffer* pBuf, SSyncNode* pNode) {
// reset repl mgr
for (int i = 0; i < pNode->replicaNum; i++) {
SSyncLogReplMgr* pMgr = pNode->logReplMgrs[i];
- syncLogReplMgrReset(pMgr);
+ syncLogReplReset(pMgr);
}
syncLogBufferValidate(pBuf);
taosThreadMutexUnlock(&pBuf->mutex);
@@ -1127,8 +1126,8 @@ SSyncRaftEntry* syncLogBufferGetOneEntry(SSyncLogBuffer* pBuf, SSyncNode* pNode,
return pEntry;
}
-int32_t syncLogReplMgrReplicateOneTo(SSyncLogReplMgr* pMgr, SSyncNode* pNode, SyncIndex index, SyncTerm* pTerm,
- SRaftId* pDestId, bool* pBarrier) {
+int32_t syncLogReplSendTo(SSyncLogReplMgr* pMgr, SSyncNode* pNode, SyncIndex index, SyncTerm* pTerm, SRaftId* pDestId,
+ bool* pBarrier) {
SSyncRaftEntry* pEntry = NULL;
SRpcMsg msgOut = {0};
bool inBuf = false;
@@ -1141,16 +1140,16 @@ int32_t syncLogReplMgrReplicateOneTo(SSyncLogReplMgr* pMgr, SSyncNode* pNode, Sy
if (terrno == TSDB_CODE_WAL_LOG_NOT_EXIST) {
SSyncLogReplMgr* pMgr = syncNodeGetLogReplMgr(pNode, pDestId);
if (pMgr) {
- sInfo("vgId:%d, reset sync log repl mgr of peer:%" PRIx64 " since %s. index:%" PRId64, pNode->vgId,
- pDestId->addr, terrstr(), index);
- (void)syncLogReplMgrReset(pMgr);
+ sInfo("vgId:%d, reset sync log repl of peer:%" PRIx64 " since %s. index:%" PRId64, pNode->vgId, pDestId->addr,
+ terrstr(), index);
+ (void)syncLogReplReset(pMgr);
}
}
goto _err;
}
- *pBarrier = syncLogIsReplicationBarrier(pEntry);
+ *pBarrier = syncLogReplBarrier(pEntry);
- prevLogTerm = syncLogReplMgrGetPrevLogTerm(pMgr, pNode, index);
+ prevLogTerm = syncLogReplGetPrevLogTerm(pMgr, pNode, index);
if (prevLogTerm < 0) {
sError("vgId:%d, failed to get prev log term since %s. index:%" PRId64 "", pNode->vgId, terrstr(), index);
goto _err;
diff --git a/source/libs/sync/src/syncReplication.c b/source/libs/sync/src/syncReplication.c
index 1d94b288d3..8ac9a860e3 100644
--- a/source/libs/sync/src/syncReplication.c
+++ b/source/libs/sync/src/syncReplication.c
@@ -52,7 +52,7 @@ int32_t syncNodeReplicateReset(SSyncNode* pNode, SRaftId* pDestId) {
SSyncLogBuffer* pBuf = pNode->pLogBuf;
taosThreadMutexLock(&pBuf->mutex);
SSyncLogReplMgr* pMgr = syncNodeGetLogReplMgr(pNode, pDestId);
- syncLogReplMgrReset(pMgr);
+ syncLogReplReset(pMgr);
taosThreadMutexUnlock(&pBuf->mutex);
return 0;
}
@@ -74,7 +74,7 @@ int32_t syncNodeReplicateWithoutLock(SSyncNode* pNode) {
continue;
}
SSyncLogReplMgr* pMgr = pNode->logReplMgrs[i];
- (void)syncLogReplMgrReplicateOnce(pMgr, pNode);
+ (void)syncLogReplDoOnce(pMgr, pNode);
}
return 0;
}
diff --git a/source/libs/sync/src/syncUtil.c b/source/libs/sync/src/syncUtil.c
index a519c76cda..056a597777 100644
--- a/source/libs/sync/src/syncUtil.c
+++ b/source/libs/sync/src/syncUtil.c
@@ -125,7 +125,7 @@ static void syncLogBufferStates2Str(SSyncNode* pSyncNode, char* buf, int32_t buf
pBuf->commitIndex, pBuf->matchIndex, pBuf->endIndex);
}
-static void syncLogReplMgrStates2Str(SSyncNode* pSyncNode, char* buf, int32_t bufLen) {
+static void syncLogReplStates2Str(SSyncNode* pSyncNode, char* buf, int32_t bufLen) {
int len = 0;
len += snprintf(buf + len, bufLen - len, "%s", "{");
for (int32_t i = 0; i < pSyncNode->replicaNum; i++) {
@@ -178,7 +178,7 @@ void syncPrintNodeLog(const char* flags, ELogLevel level, int32_t dflag, SSyncNo
syncCfg2SimpleStr(&pNode->raftCfg.cfg, cfgStr, sizeof(cfgStr));
char replMgrStatesStr[1024] = "";
- syncLogReplMgrStates2Str(pNode, replMgrStatesStr, sizeof(replMgrStatesStr));
+ syncLogReplStates2Str(pNode, replMgrStatesStr, sizeof(replMgrStatesStr));
char bufferStatesStr[256] = "";
syncLogBufferStates2Str(pNode, bufferStatesStr, sizeof(bufferStatesStr));
diff --git a/source/libs/transport/src/transCli.c b/source/libs/transport/src/transCli.c
index 50ed9fa61b..c23d6d0a1f 100644
--- a/source/libs/transport/src/transCli.c
+++ b/source/libs/transport/src/transCli.c
@@ -462,6 +462,7 @@ void cliHandleExceptImpl(SCliConn* pConn, int32_t code) {
if (transQueueEmpty(&pConn->cliMsgs)) {
if (pConn->broken == true && CONN_NO_PERSIST_BY_APP(pConn)) {
tTrace("%s conn %p handle except, persist:0", CONN_GET_INST_LABEL(pConn), pConn);
+ if (T_REF_VAL_GET(pConn) > 1) transUnrefCliHandle(pConn);
transUnrefCliHandle(pConn);
return;
}
@@ -521,6 +522,7 @@ void cliHandleExceptImpl(SCliConn* pConn, int32_t code) {
destroyCmsg(pMsg);
tTrace("%s conn %p start to destroy, ref:%d", CONN_GET_INST_LABEL(pConn), pConn, T_REF_VAL_GET(pConn));
} while (!transQueueEmpty(&pConn->cliMsgs));
+ if (T_REF_VAL_GET(pConn) > 1) transUnrefCliHandle(pConn);
transUnrefCliHandle(pConn);
}
void cliHandleExcept(SCliConn* conn) {
diff --git a/source/libs/wal/src/walRead.c b/source/libs/wal/src/walRead.c
index 3e1e36ccc1..dc3ff3e6de 100644
--- a/source/libs/wal/src/walRead.c
+++ b/source/libs/wal/src/walRead.c
@@ -33,7 +33,6 @@ SWalReader *walOpenReader(SWal *pWal, SWalFilterCond *cond) {
pReader->pLogFile = NULL;
pReader->curVersion = -1;
pReader->curFileFirstVer = -1;
- pReader->curInvalid = 1;
pReader->capacity = 0;
if (cond) {
pReader->cond = *cond;
@@ -81,7 +80,6 @@ int32_t walNextValidMsg(SWalReader *pReader) {
wDebug("vgId:%d, wal start to fetch, index:%" PRId64 ", last index:%" PRId64 " commit index:%" PRId64
", applied index:%" PRId64 ", end index:%" PRId64,
pReader->pWal->cfg.vgId, fetchVer, lastVer, committedVer, appliedVer, endVer);
- pReader->curStopped = 0;
while (fetchVer <= endVer) {
if (walFetchHeadNew(pReader, fetchVer) < 0) {
return -1;
@@ -99,10 +97,11 @@ int32_t walNextValidMsg(SWalReader *pReader) {
fetchVer = pReader->curVersion;
}
}
- pReader->curStopped = 1;
return -1;
}
+int64_t walReaderGetCurrentVer(const SWalReader *pReader) { return pReader->curVersion; }
+
static int64_t walReadSeekFilePos(SWalReader *pReader, int64_t fileFirstVer, int64_t ver) {
int64_t ret = 0;
@@ -196,32 +195,26 @@ int32_t walReadSeekVerImpl(SWalReader *pReader, int64_t ver) {
return -1;
}
- wDebug("vgId:%d, wal version reset from %" PRId64 "(invalid:%d) to %" PRId64, pReader->pWal->cfg.vgId,
- pReader->curVersion, pReader->curInvalid, ver);
+ wDebug("vgId:%d, wal version reset from %" PRId64 " to %" PRId64, pReader->pWal->cfg.vgId,
+ pReader->curVersion, ver);
pReader->curVersion = ver;
- pReader->curInvalid = 0;
return 0;
}
int32_t walReadSeekVer(SWalReader *pReader, int64_t ver) {
SWal *pWal = pReader->pWal;
- if (!pReader->curInvalid && ver == pReader->curVersion) {
+ if (ver == pReader->curVersion) {
wDebug("vgId:%d, wal index:%" PRId64 " match, no need to reset", pReader->pWal->cfg.vgId, ver);
return 0;
}
-// pReader->curInvalid = 1;
-// pReader->curVersion = ver;
-
if (ver > pWal->vers.lastVer || ver < pWal->vers.firstVer) {
- wDebug("vgId:%d, invalid index:%" PRId64 ", first index:%" PRId64 ", last index:%" PRId64, pReader->pWal->cfg.vgId,
+ wInfo("vgId:%d, invalid index:%" PRId64 ", first index:%" PRId64 ", last index:%" PRId64, pReader->pWal->cfg.vgId,
ver, pWal->vers.firstVer, pWal->vers.lastVer);
terrno = TSDB_CODE_WAL_LOG_NOT_EXIST;
return -1;
}
-// if (ver < pWal->vers.snapshotVer) {
-// }
if (walReadSeekVerImpl(pReader, ver) < 0) {
return -1;
@@ -238,10 +231,8 @@ static int32_t walFetchHeadNew(SWalReader *pRead, int64_t fetchVer) {
wDebug("vgId:%d, wal starts to fetch head, index:%" PRId64, pRead->pWal->cfg.vgId, fetchVer);
- if (pRead->curInvalid || pRead->curVersion != fetchVer) {
+ if (pRead->curVersion != fetchVer) {
if (walReadSeekVer(pRead, fetchVer) < 0) {
-// pRead->curVersion = fetchVer;
-// pRead->curInvalid = 1;
return -1;
}
seeked = true;
@@ -260,7 +251,6 @@ static int32_t walFetchHeadNew(SWalReader *pRead, int64_t fetchVer) {
} else {
terrno = TSDB_CODE_WAL_FILE_CORRUPTED;
}
-// pRead->curInvalid = 1;
return -1;
}
}
@@ -344,7 +334,7 @@ int32_t walFetchHead(SWalReader *pRead, int64_t ver, SWalCkHead *pHead) {
return -1;
}
- if (pRead->curInvalid || pRead->curVersion != ver) {
+ if (pRead->curVersion != ver) {
code = walReadSeekVer(pRead, ver);
if (code < 0) {
// pRead->curVersion = ver;
@@ -479,7 +469,7 @@ int32_t walReadVer(SWalReader *pReader, int64_t ver) {
taosThreadMutexLock(&pReader->mutex);
- if (pReader->curInvalid || pReader->curVersion != ver) {
+ if (pReader->curVersion != ver) {
if (walReadSeekVer(pReader, ver) < 0) {
wError("vgId:%d, unexpected wal log, index:%" PRId64 ", since %s", pReader->pWal->cfg.vgId, ver, terrstr());
taosThreadMutexUnlock(&pReader->mutex);
@@ -575,7 +565,6 @@ void walReadReset(SWalReader *pReader) {
taosThreadMutexLock(&pReader->mutex);
taosCloseFile(&pReader->pIdxFile);
taosCloseFile(&pReader->pLogFile);
- pReader->curInvalid = 1;
pReader->curFileFirstVer = -1;
pReader->curVersion = -1;
taosThreadMutexUnlock(&pReader->mutex);
diff --git a/source/util/src/terror.c b/source/util/src/terror.c
index af85201e0a..25a982f950 100644
--- a/source/util/src/terror.c
+++ b/source/util/src/terror.c
@@ -190,6 +190,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_MND_NO_USER_FROM_CONN, "Can not get user from
TAOS_DEFINE_ERROR(TSDB_CODE_MND_TOO_MANY_USERS, "Too many users")
TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_ALTER_OPER, "Invalid alter operation")
TAOS_DEFINE_ERROR(TSDB_CODE_MND_AUTH_FAILURE, "Authentication failure")
+TAOS_DEFINE_ERROR(TSDB_CODE_MND_PRIVILEDGE_EXIST, "User already have this priviledge")
//mnode-stable-part1
TAOS_DEFINE_ERROR(TSDB_CODE_MND_STB_ALREADY_EXIST, "STable already exists")
@@ -320,7 +321,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_SNODE_ALREADY_DEPLOYED, "Snode already deploye
TAOS_DEFINE_ERROR(TSDB_CODE_SNODE_NOT_DEPLOYED, "Snode not deployed")
// vnode
-TAOS_DEFINE_ERROR(TSDB_CODE_VND_INVALID_VGROUP_ID, "Vnode moved to another dnode or was deleted")
+TAOS_DEFINE_ERROR(TSDB_CODE_VND_INVALID_VGROUP_ID, "Vnode is closed or removed")
TAOS_DEFINE_ERROR(TSDB_CODE_VND_NO_WRITE_AUTH, "Database write operation denied")
TAOS_DEFINE_ERROR(TSDB_CODE_VND_NOT_EXIST, "Vnode not exist")
TAOS_DEFINE_ERROR(TSDB_CODE_VND_ALREADY_EXIST, "Vnode already exist")
@@ -631,6 +632,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_INDEX_INVALID_FILE, "Index file is inval
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")
+TAOS_DEFINE_ERROR(TSDB_CODE_TMQ_CONSUMER_ERROR, "Consumer error, to see log")
// stream
TAOS_DEFINE_ERROR(TSDB_CODE_STREAM_TASK_NOT_EXIST, "Stream task not exist")
diff --git a/source/util/src/tworker.c b/source/util/src/tworker.c
index 631bcb443e..a49ff0cd5b 100644
--- a/source/util/src/tworker.c
+++ b/source/util/src/tworker.c
@@ -218,7 +218,7 @@ STaosQueue *tAutoQWorkerAllocQueue(SAutoQWorkerPool *pool, void *ahandle, FItem
int32_t queueNum = taosGetQueueNumber(pool->qset);
int32_t curWorkerNum = taosArrayGetSize(pool->workers);
int32_t dstWorkerNum = ceil(queueNum * pool->ratio);
- if (dstWorkerNum < 1) dstWorkerNum = 1;
+ if (dstWorkerNum < 2) dstWorkerNum = 2;
// spawn a thread to process queue
while (curWorkerNum < dstWorkerNum) {
@@ -248,7 +248,8 @@ STaosQueue *tAutoQWorkerAllocQueue(SAutoQWorkerPool *pool, void *ahandle, FItem
}
taosThreadAttrDestroy(&thAttr);
- uInfo("worker:%s:%d is launched, total:%d", pool->name, worker->id, (int32_t)taosArrayGetSize(pool->workers));
+ int32_t numOfThreads = taosArrayGetSize(pool->workers);
+ uInfo("worker:%s:%d is launched, total:%d, expect:%d", pool->name, worker->id, numOfThreads, dstWorkerNum);
curWorkerNum++;
}
diff --git a/tests/develop-test/5-taos-tools/taosbenchmark/default_json.py b/tests/develop-test/5-taos-tools/taosbenchmark/default_json.py
index b06b0890ff..35ed298213 100644
--- a/tests/develop-test/5-taos-tools/taosbenchmark/default_json.py
+++ b/tests/develop-test/5-taos-tools/taosbenchmark/default_json.py
@@ -59,9 +59,9 @@ class TDTestCase:
os.system("%s" % cmd)
tdSql.execute("reset query cache")
tdSql.query("show db.tables")
- tdSql.checkRows(10)
+ tdSql.checkRows(8)
tdSql.query("select count(*) from db.stb")
- tdSql.checkData(0, 0, 100)
+ tdSql.checkData(0, 0, 80)
def stop(self):
tdSql.close()
diff --git a/tests/develop-test/5-taos-tools/taosbenchmark/json/default.json b/tests/develop-test/5-taos-tools/taosbenchmark/json/default.json
index da22ef75e2..c841e90b51 100644
--- a/tests/develop-test/5-taos-tools/taosbenchmark/json/default.json
+++ b/tests/develop-test/5-taos-tools/taosbenchmark/json/default.json
@@ -15,13 +15,18 @@
"num_of_records_per_req": 10,
"databases": [{
"dbinfo": {
- "name": "db"
+ "name": "db",
+ "drop": "yes"
+
},
"super_tables": [{
+ "child_table_exists":"no",
"name": "stb",
"childtable_prefix": "stb_",
"childtable_count": 10,
"insert_rows": 10,
+ "childtable_from": 1,
+ "childtable_to": 9,
"columns": [{"type": "INT"}],
"tags": [{"type": "INT"}]
}]
diff --git a/tests/parallel_test/cases.task b/tests/parallel_test/cases.task
index a387df4da6..d8ff2d4996 100644
--- a/tests/parallel_test/cases.task
+++ b/tests/parallel_test/cases.task
@@ -505,12 +505,12 @@
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqUpdateWithConsume.py -N 3 -n 3
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqUpdate-multiCtb-snapshot0.py
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqUpdate-multiCtb-snapshot1.py
-# ,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqDelete-1ctb.py
+,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqDelete-1ctb.py
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqDelete-multiCtb.py -N 3 -n 3
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqDropStbCtb.py
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqDropNtb-snapshot0.py
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqDropNtb-snapshot1.py
-,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqUdf.py
+#,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqUdf.py
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqUdf-multCtb-snapshot0.py
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqUdf-multCtb-snapshot1.py
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/stbTagFilter-1ctb.py
@@ -1201,6 +1201,7 @@
,,y,script,./test.sh -f tsim/insert/query_multi_file.sim
,,y,script,./test.sh -f tsim/insert/tcp.sim
,,y,script,./test.sh -f tsim/insert/update0.sim
+,,y,script,./test.sh -f tsim/insert/delete0.sim
,,y,script,./test.sh -f tsim/insert/update1_sort_merge.sim
,,y,script,./test.sh -f tsim/insert/update2.sim
,,y,script,./test.sh -f tsim/parser/alter__for_community_version.sim
@@ -1294,6 +1295,7 @@
,,y,script,./test.sh -f tsim/query/udf_with_const.sim
,,y,script,./test.sh -f tsim/query/join_interval.sim
,,y,script,./test.sh -f tsim/query/unionall_as_table.sim
+,,y,script,./test.sh -f tsim/query/multi_order_by.sim
,,y,script,./test.sh -f tsim/query/sys_tbname.sim
,,y,script,./test.sh -f tsim/query/groupby.sim
,,y,script,./test.sh -f tsim/query/event.sim
diff --git a/tests/pytest/util/autogen.py b/tests/pytest/util/autogen.py
index b85348d0ba..90cd347b9a 100644
--- a/tests/pytest/util/autogen.py
+++ b/tests/pytest/util/autogen.py
@@ -51,7 +51,7 @@ class AutoGen:
metas = []
for i in range(cnt):
colname = f"{pre}{i}"
- sel = len(types) % len(types)
+ sel = i % len(types)
coltype = types[sel]
sql = f"{colname} {coltype}"
if sqls != "":
diff --git a/tests/script/api/batchprepare.c b/tests/script/api/batchprepare.c
index 0903095dc9..99507ef5c3 100644
--- a/tests/script/api/batchprepare.c
+++ b/tests/script/api/batchprepare.c
@@ -122,9 +122,11 @@ int insertAUTOTest2(TAOS_STMT *stmt, TAOS *taos);
int insertAUTOTest3(TAOS_STMT *stmt, TAOS *taos);
int queryColumnTest(TAOS_STMT *stmt, TAOS *taos);
int queryMiscTest(TAOS_STMT *stmt, TAOS *taos);
+int insertNonExistsTb(TAOS_STMT *stmt, TAOS *taos);
enum {
TTYPE_INSERT = 1,
+ TTYPE_INSERT_NG,
TTYPE_QUERY,
};
@@ -187,6 +189,8 @@ CaseCfg gCase[] = {
{"query:SUBT-COLUMN", tListLen(fullColList), fullColList, TTYPE_QUERY, 0, false, false, queryColumnTest, 10, 10, 1, 3, 0, 0, 1, 2},
{"query:SUBT-MISC", tListLen(fullColList), fullColList, TTYPE_QUERY, 0, false, false, queryMiscTest, 10, 10, 1, 3, 0, 0, 1, 2},
+ {"query:NG-TBNEXISTS",tListLen(fullColList), fullColList, TTYPE_INSERT_NG,0, false, false, insertNonExistsTb, 10, 10, 1, 3, 0, 0, 1, -1},
+
// {"query:SUBT-COLUMN", tListLen(fullColList), fullColList, TTYPE_QUERY, 0, false, false, queryColumnTest, 1, 10, 1, 1, 0, 0, 1, 2},
// {"query:SUBT-MISC", tListLen(fullColList), fullColList, TTYPE_QUERY, 0, false, false, queryMiscTest, 2, 10, 1, 1, 0, 0, 1, 2},
@@ -250,7 +254,7 @@ CaseCtrl gCaseCtrl = {
.funcIdxList = NULL,
.checkParamNum = false,
.runTimes = 0,
- .caseIdx = 24,
+ .caseIdx = 26,
.caseNum = 1,
.caseRunIdx = -1,
.caseRunNum = -1,
@@ -2191,6 +2195,47 @@ int queryMiscTest(TAOS_STMT *stmt, TAOS *taos) {
}
+int insertNonExistsTb(TAOS_STMT *stmt, TAOS *taos) {
+ BindData data = {0};
+ prepareInsertData(&data);
+
+ int code = taos_stmt_prepare(stmt, data.sql, 0);
+ if (code != 0){
+ printf("!!!failed to execute taos_stmt_prepare. error:%s\n", taos_stmt_errstr(stmt));
+ exit(1);
+ }
+
+ bpCheckIsInsert(stmt, 1);
+
+ char *buf = "tbnexist";
+ code = bpSetTableNameTags(&data, 0, buf, stmt);
+ if (code == 0){
+ printf("!!!taos_stmt_set_tbname expected error not occurred\n");
+ exit(1);
+ }
+
+ if (0 == taos_stmt_bind_param_batch(stmt, data.pBind)) {
+ printf("!!!taos_stmt_bind_param_batch expected error not occurred\n");
+ exit(1);
+ }
+
+ if (0 == taos_stmt_add_batch(stmt)) {
+ printf("!!!taos_stmt_add_batch expected error not occurred\n");
+ exit(1);
+ }
+
+ if (0 == taos_stmt_execute(stmt)) {
+ printf("!!!taos_stmt_execute expected error not occurred\n");
+ exit(1);
+ }
+
+ destroyData(&data);
+
+ return 0;
+}
+
+
+
int errorSQLTest1(TAOS_STMT *stmt, TAOS *taos) {
BindData data = {0};
@@ -2213,6 +2258,10 @@ int errorSQLTest1(TAOS_STMT *stmt, TAOS *taos) {
}
void prepareCheckResultImpl(TAOS * taos, char *tname, bool printr, int expected, bool silent) {
+ if (TTYPE_INSERT_NG == gCurCase->testType) {
+ return;
+ }
+
char sql[255] = "SELECT * FROM ";
int32_t rows = 0;
diff --git a/tests/script/sh/max_vol.c b/tests/script/sh/max_vol.c
new file mode 100644
index 0000000000..4f9ecd33a7
--- /dev/null
+++ b/tests/script/sh/max_vol.c
@@ -0,0 +1,101 @@
+#include
+#include
+#include
+#include
+
+#include "taosudf.h"
+
+#define STR_MAX_LEN 256 // inter buffer length
+
+// init
+DLL_EXPORT int32_t max_vol_init()
+{
+ return 0;
+}
+
+// destory
+DLL_EXPORT int32_t max_vol_destroy()
+{
+ return 0;
+}
+
+// start
+DLL_EXPORT int32_t max_vol_start(SUdfInterBuf *buf)
+{
+ memset(buf->buf, 0, sizeof(float) + STR_MAX_LEN);
+ // set init value
+ *((float*)buf->buf) = -10000000;
+ buf->bufLen = sizeof(float) + STR_MAX_LEN;
+ buf->numOfResult = 0;
+ return 0;
+}
+
+DLL_EXPORT int32_t max_vol(SUdfDataBlock *block, SUdfInterBuf *interBuf, SUdfInterBuf *newInterBuf) {
+ float maxValue = *(float *)interBuf->buf;
+ char strBuff[STR_MAX_LEN] = "inter1buf";
+
+ if (block->numOfCols < 2)
+ {
+ return TSDB_CODE_UDF_INVALID_INPUT;
+ }
+
+ // check data type
+ for (int32_t i = 0; i < block->numOfCols; ++i)
+ {
+ SUdfColumn *col = block->udfCols[i];
+ if( i == block->numOfCols - 1) {
+ // last column is device id , must varchar
+ if (col->colMeta.type != TSDB_DATA_TYPE_VARCHAR ) {
+ return TSDB_CODE_UDF_INVALID_INPUT;
+ }
+ } else {
+ if (col->colMeta.type != TSDB_DATA_TYPE_FLOAT) {
+ return TSDB_CODE_UDF_INVALID_INPUT;
+ }
+ }
+ }
+
+ // calc max voltage
+ SUdfColumn *lastCol = block->udfCols[block->numOfCols - 1];
+ for (int32_t i = 0; i < (block->numOfCols - 1); ++i) {
+ for (int32_t j = 0; j < block->numOfRows; ++j) {
+ SUdfColumn *col = block->udfCols[i];
+ if (udfColDataIsNull(col, j)) {
+ continue;
+ }
+ char *data = udfColDataGetData(col, j);
+ float voltage = *(float *)data;
+ if (voltage > maxValue) {
+ maxValue = voltage;
+ char *valData = udfColDataGetData(lastCol, j);
+ // get device id
+ char *deviceId = valData + sizeof(uint16_t);
+ sprintf(strBuff, "%s_(%d,%d)_%f", deviceId, j, i, maxValue);
+ }
+ }
+ }
+
+ *(float*)newInterBuf->buf = maxValue;
+ strcpy(newInterBuf->buf + sizeof(float), strBuff);
+ newInterBuf->bufLen = sizeof(float) + strlen(strBuff)+1;
+ newInterBuf->numOfResult = 1;
+ return 0;
+}
+
+DLL_EXPORT int32_t max_vol_finish(SUdfInterBuf *buf, SUdfInterBuf *resultData)
+{
+ char * str = buf->buf + sizeof(float);
+ // copy to des
+ char * des = resultData->buf + sizeof(uint16_t);
+ strcpy(des, str);
+
+ // set binary type len
+ uint16_t len = strlen(str);
+ *((uint16_t*)resultData->buf) = len;
+
+ // set buf len
+ resultData->bufLen = len + sizeof(uint16_t);
+ // set row count
+ resultData->numOfResult = 1;
+ return 0;
+}
diff --git a/tests/script/tsim/insert/delete0.sim b/tests/script/tsim/insert/delete0.sim
new file mode 100644
index 0000000000..5653853643
--- /dev/null
+++ b/tests/script/tsim/insert/delete0.sim
@@ -0,0 +1,161 @@
+system sh/stop_dnodes.sh
+system sh/deploy.sh -n dnode1 -i 1
+system sh/exec.sh -n dnode1 -s start
+sql connect
+
+print =============== create database with different precision
+sql create database d0 keep 365
+sql create database d1 keep 365 precision 'ms'
+sql create database d2 keep 365 precision 'us'
+sql create database d3 keep 365 precision 'ns'
+
+sql select * from information_schema.ins_databases
+if $rows != 6 then
+ return -1
+endi
+
+print $data00 $data01 $data02
+
+
+sql create table if not exists d0.stb (ts timestamp, c1 int, c2 float, c3 double) tags (t1 int unsigned)
+sql create table if not exists d1.stb (ts timestamp, c1 int, c2 float, c3 double) tags (t1 int unsigned)
+sql create table if not exists d2.stb (ts timestamp, c1 int, c2 float, c3 double) tags (t1 int unsigned)
+sql create table if not exists d3.stb (ts timestamp, c1 int, c2 float, c3 double) tags (t1 int unsigned)
+sql create table if not exists d0.ntb (ts timestamp, c1 int, c2 float, c3 double)
+sql create table if not exists d1.ntb (ts timestamp, c1 int, c2 float, c3 double)
+sql create table if not exists d2.ntb (ts timestamp, c1 int, c2 float, c3 double)
+sql create table if not exists d3.ntb (ts timestamp, c1 int, c2 float, c3 double)
+
+sql create table d0.ct1 using d0.stb tags(1000)
+sql create table d1.ct1 using d1.stb tags(1000)
+sql create table d2.ct1 using d2.stb tags(1000)
+sql create table d3.ct1 using d3.stb tags(1000)
+sql create table d0.ct2 using d0.stb tags(1000)
+sql create table d1.ct2 using d1.stb tags(1000)
+sql create table d2.ct2 using d2.stb tags(1000)
+sql create table d3.ct2 using d3.stb tags(1000)
+
+
+sql insert into d0.ct1 values(now+0s, 10, 2.0, 3.0)
+sql insert into d1.ct1 values(now+0s, 10, 2.0, 3.0)
+sql insert into d2.ct1 values(now+0s, 10, 2.0, 3.0)
+sql insert into d3.ct1 values(now+0s, 10, 2.0, 3.0)
+sql insert into d0.ct2 values(now+0s, 10, 2.0, 3.0)
+sql insert into d1.ct2 values(now+0s, 10, 2.0, 3.0)
+sql insert into d2.ct2 values(now+0s, 10, 2.0, 3.0)
+sql insert into d3.ct2 values(now+0s, 10, 2.0, 3.0)
+sql insert into d0.ntb values(now+0s, 10, 2.0, 3.0)
+sql insert into d1.ntb values(now+0s, 10, 2.0, 3.0)
+sql insert into d2.ntb values(now+0s, 10, 2.0, 3.0)
+sql insert into d3.ntb values(now+0s, 10, 2.0, 3.0)
+
+
+print =============== query data from super table
+sql select count(*) from d0.stb
+if $data00 != 2 then
+ return -1
+endi
+sql select count(*) from d1.stb
+if $data00 != 2 then
+ return -1
+endi
+sql select count(*) from d2.stb
+if $data00 != 2 then
+ return -1
+endi
+sql select count(*) from d3.stb
+if $data00 != 2 then
+ return -1
+endi
+
+print =============== delete from child table
+sql delete from d0.ct1 where ts < now()
+sql delete from d1.ct1 where ts < now()
+sql delete from d2.ct1 where ts < now()
+sql delete from d3.ct1 where ts < now()
+
+
+print =============== query data from super table
+sql select count(*) from d0.stb
+if $data00 != 1 then
+ return -1
+endi
+sql select count(*) from d1.stb
+if $data00 != 1 then
+ return -1
+endi
+sql select count(*) from d2.stb
+if $data00 != 1 then
+ return -1
+endi
+sql select count(*) from d3.stb
+if $data00 != 1 then
+ return -1
+endi
+print =============== query data from normal table
+sql select count(*) from d0.ntb
+if $data00 != 1 then
+ return -1
+endi
+sql select count(*) from d1.ntb
+if $data00 != 1 then
+ return -1
+endi
+sql select count(*) from d2.ntb
+if $data00 != 1 then
+ return -1
+endi
+sql select count(*) from d3.ntb
+if $data00 != 1 then
+ return -1
+endi
+
+print =============== delete from super table
+sql delete from d0.stb where ts < now()
+sql delete from d1.stb where ts < now()
+sql delete from d2.stb where ts < now()
+sql delete from d3.stb where ts < now()
+
+print =============== query data from super table
+sql select count(*) from d0.stb
+if $data00 != 0 then
+ return -1
+endi
+sql select count(*) from d1.stb
+if $data00 != 0 then
+ return -1
+endi
+sql select count(*) from d2.stb
+if $data00 != 0 then
+ return -1
+endi
+sql select count(*) from d3.stb
+if $data00 != 0 then
+ return -1
+endi
+
+print =============== delete from normal table
+sql delete from d0.ntb where ts < now()
+sql delete from d1.ntb where ts < now()
+sql delete from d2.ntb where ts < now()
+sql delete from d3.ntb where ts < now()
+
+print =============== query data from normal table
+sql select count(*) from d0.ntb
+if $data00 != 0 then
+ return -1
+endi
+sql select count(*) from d1.ntb
+if $data00 != 0 then
+ return -1
+endi
+sql select count(*) from d2.ntb
+if $data00 != 0 then
+ return -1
+endi
+sql select count(*) from d3.ntb
+if $data00 != 0 then
+ return -1
+endi
+
+system sh/exec.sh -n dnode1 -s stop -x SIGINT
diff --git a/tests/script/tsim/parser/last_cache.sim b/tests/script/tsim/parser/last_cache.sim
index 9a41a9f5aa..3f1a29d928 100644
--- a/tests/script/tsim/parser/last_cache.sim
+++ b/tests/script/tsim/parser/last_cache.sim
@@ -54,6 +54,7 @@ sql insert into tbd values ("2021-05-11 10:12:29",NULL,NULL,NULL,NULL )
run tsim/parser/last_cache_query.sim
+sql flush database $db
system sh/exec.sh -n dnode1 -s stop -x SIGINT
system sh/exec.sh -n dnode1 -s start
diff --git a/tests/script/tsim/parser/limit1.sim b/tests/script/tsim/parser/limit1.sim
index d1a75f3ba9..bae5eba7a4 100644
--- a/tests/script/tsim/parser/limit1.sim
+++ b/tests/script/tsim/parser/limit1.sim
@@ -55,6 +55,7 @@ print ====== tables created
run tsim/parser/limit1_tb.sim
run tsim/parser/limit1_stb.sim
+sql flush database $db
print ================== restart server to commit data into disk
system sh/exec.sh -n dnode1 -s stop -x SIGINT
system sh/exec.sh -n dnode1 -s start
diff --git a/tests/script/tsim/query/multi_order_by.sim b/tests/script/tsim/query/multi_order_by.sim
new file mode 100644
index 0000000000..7b7f2abe36
--- /dev/null
+++ b/tests/script/tsim/query/multi_order_by.sim
@@ -0,0 +1,57 @@
+system sh/stop_dnodes.sh
+system sh/deploy.sh -n dnode1 -i 1
+system sh/exec.sh -n dnode1 -s start
+sql connect
+
+sql create database test;
+sql use test;
+
+sql create table t(ts timestamp, f int);
+sql insert into t values(now,0)(now+1s, 1)(now+2s, 2)(now+3s,3)(now+4s,4)(now+5s,5)(now+6s,6)(now+7s,7)(now+8s,8)(now+9s,9)
+sql select * from (select * from t order by ts desc limit 3 offset 2) order by ts;
+print $data01 $data11 $data21
+if $data01 != 5 then
+ return -1
+endi
+if $data11 != 6 then
+ return -1
+endi
+if $data21 != 7 then
+ return -1
+endi
+sql select * from (select * from t order by ts limit 3 offset 2) order by ts desc;
+print $data01 $data11 $data21
+if $data01 != 4 then
+ return -1
+endi
+if $data11 != 3 then
+ return -1
+endi
+if $data21 != 2 then
+ return -1
+endi
+sql select * from (select * from t order by ts desc limit 3 offset 2) order by ts desc;
+print $data01 $data11 $data21
+if $data01 != 7 then
+ return -1
+endi
+if $data11 != 6 then
+ return -1
+endi
+if $data21 != 5 then
+ return -1
+endi
+sql select * from (select * from t order by ts limit 3 offset 2) order by ts;
+print $data01 $data11 $data21
+if $data01 != 2 then
+ return -1
+endi
+if $data11 != 3 then
+ return -1
+endi
+if $data21 != 4 then
+ return -1
+endi
+
+
+system sh/exec.sh -n dnode1 -s stop -x SIGINT
diff --git a/tests/script/tsim/stream/basic1.sim b/tests/script/tsim/stream/basic1.sim
index f8791c4963..26b8bd6c97 100644
--- a/tests/script/tsim/stream/basic1.sim
+++ b/tests/script/tsim/stream/basic1.sim
@@ -37,7 +37,7 @@ if $loop_count == 20 then
endi
if $rows != 4 then
- print =====rows=$rows
+ print =====rows=$rows, expect 4
goto loop0
endi
@@ -53,7 +53,7 @@ if $data02 != 2 then
endi
if $data03 != 5 then
- print =====data03=$data03
+ print =====data03=$data03, expect:5
goto loop0
endi
diff --git a/tests/script/tsim/stream/basic2.sim b/tests/script/tsim/stream/basic2.sim
index 20e8c95391..8d0df2697b 100644
--- a/tests/script/tsim/stream/basic2.sim
+++ b/tests/script/tsim/stream/basic2.sim
@@ -48,23 +48,34 @@ sleep 100
#===================================================================
print =============== query data from child table
+$loop_count = 0
+
+loop0:
+
+sleep 200
+
+$loop_count = $loop_count + 1
+if $loop_count == 10 then
+ return -1
+endi
+
sql select `_wstart`,`min(k)`,`max(k)`,sum_alias from outstb
print rows: $rows
print $data00 $data01 $data02 $data03
if $rows != 1 then
- return -1
+ goto loop0
endi
if $data01 != 234 then
- return -1
+ goto loop0
endi
if $data02 != 234 then
- return -1
+ goto loop0
endi
if $data03 != 234 then
- return -1
+ goto loop0
endi
#===================================================================
@@ -77,36 +88,47 @@ sleep 100
#===================================================================
print =============== query data from child table
+$loop_count = 0
+
+loop1:
+
+sleep 200
+
+$loop_count = $loop_count + 1
+if $loop_count == 10 then
+ return -1
+endi
+
sql select `_wstart`,`min(k)`,`max(k)`,sum_alias from outstb
print rows: $rows
print $data00 $data01 $data02 $data03
print $data10 $data11 $data12 $data13
if $rows != 2 then
- return -1
+ goto loop1
endi
if $data01 != 234 then
- return -1
+ goto loop1
endi
if $data02 != 234 then
- return -1
+ goto loop1
endi
if $data03 != 234 then
- return -1
+ goto loop1
endi
if $data11 != -111 then
- return -1
+ goto loop1
endi
if $data12 != -111 then
- return -1
+ goto loop1
endi
if $data13 != -111 then
- return -1
+ goto loop1
endi
system sh/exec.sh -n dnode1 -s stop -x SIGINT
diff --git a/tests/script/tsim/testsuit.sim b/tests/script/tsim/testsuit.sim
index c5fbf41b66..0abe56ab3c 100644
--- a/tests/script/tsim/testsuit.sim
+++ b/tests/script/tsim/testsuit.sim
@@ -114,6 +114,7 @@ run tsim/insert/basic1.sim
run tsim/insert/commit-merge0.sim
run tsim/insert/basic0.sim
run tsim/insert/update0.sim
+run tsim/insert/delete0.sim
run tsim/insert/backquote.sim
run tsim/insert/null.sim
run tsim/catalog/alterInCurrent.sim
diff --git a/tests/script/tsim/tmq/basic1.sim b/tests/script/tsim/tmq/basic1.sim
index b296290214..4551228f2f 100644
--- a/tests/script/tsim/tmq/basic1.sim
+++ b/tests/script/tsim/tmq/basic1.sim
@@ -117,8 +117,8 @@ endi
$consumerId = 0
$totalMsgOfStb = $ctbNum * $rowsPerCtb
-$expectmsgcnt = $totalMsgOfStb
-sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata , $ifmanualcommit )
+$expectmsgcnt = 1
+sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $totalMsgOfStb , $ifcheckdata , $ifmanualcommit )
print == start consumer to pull msgs from stb
print == tsim/tmq/consume.sh -d $dbName -y $pullDelay -g $showMsg -r $showRow -w $cdbName -s start
@@ -140,7 +140,7 @@ if $data[0][2] != $expectmsgcnt then
print expect $expectmsgcnt , actual $data02
return -1
endi
-if $data[0][3] != $expectmsgcnt then
+if $data[0][3] != $totalMsgOfStb then
return -1
endi
$loop_cnt = $loop_cnt + 1
@@ -192,8 +192,8 @@ endi
$consumerId = 0
$totalMsgOfCtb = $rowsPerCtb
-$expectmsgcnt = $totalMsgOfCtb
-sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata , $ifmanualcommit )
+$expectmsgcnt = 1
+sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $totalMsgOfCtb , $ifcheckdata , $ifmanualcommit )
print == start consumer to pull msgs from ctb
print == tsim/tmq/consume.sh -d $dbName -y $pullDelay -g $showMsg -r $showRow -s start
@@ -211,7 +211,7 @@ endi
if $data[0][1] != $consumerId then
return -1
endi
-if $data[0][2] != $totalMsgOfCtb then
+if $data[0][2] != $expectmsgcnt then
return -1
endi
if $data[0][3] != $totalMsgOfCtb then
@@ -266,8 +266,8 @@ endi
$consumerId = 0
$totalMsgOfNtb = $rowsPerCtb
-$expectmsgcnt = $totalMsgOfNtb
-sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata , $ifmanualcommit )
+$expectmsgcnt = 1
+sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $totalMsgOfNtb , $ifcheckdata , $ifmanualcommit )
print == start consumer to pull msgs from ntb
print == tsim/tmq/consume.sh -d $dbName -y $pullDelay -g $showMsg -r $showRow -s start
@@ -285,7 +285,7 @@ endi
if $data[0][1] != $consumerId then
return -1
endi
-if $data[0][2] != $totalMsgOfNtb then
+if $data[0][2] != $expectmsgcnt then
return -1
endi
if $data[0][3] != $totalMsgOfNtb then
diff --git a/tests/script/tsim/tmq/basic1Of2Cons.sim b/tests/script/tsim/tmq/basic1Of2Cons.sim
index 4c966c370e..51d39e8d11 100644
--- a/tests/script/tsim/tmq/basic1Of2Cons.sim
+++ b/tests/script/tsim/tmq/basic1Of2Cons.sim
@@ -117,11 +117,11 @@ endi
$consumerId = 0
$totalMsgOfStb = $ctbNum * $rowsPerCtb
-$expectmsgcnt = $totalMsgOfStb
-sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata , $ifmanualcommit )
+$expectmsgcnt = 1
+sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $totalMsgOfStb , $ifcheckdata , $ifmanualcommit )
$consumerId = 1
-sql insert into consumeinfo values (now+1s , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata , $ifmanualcommit )
+sql insert into consumeinfo values (now+1s , $consumerId , $topicList , $keyList , $totalMsgOfStb , $ifcheckdata , $ifmanualcommit )
print == start consumer to pull msgs from stb
print == tsim/tmq/consume.sh -d $dbName -y $pullDelay -g $showMsg -r $showRow -w $cdbName -s start
@@ -148,14 +148,14 @@ if $data[0][1] == 1 then
endi
endi
-# either $data[0][2] == $totalMsgOfStb and $data[1][2] == 0
-# or $data[0][2] == 0 and $data[1][2] == $totalMsgOfStb
-if $data[0][2] == $totalMsgOfStb then
+# either $data[0][2] == $expectmsgcnt and $data[1][2] == 0
+# or $data[0][2] == 0 and $data[1][2] == $expectmsgcnt
+if $data[0][2] == $expectmsgcnt then
if $data[1][2] == 0 then
goto check_ok_0
endi
elif $data[0][2] == 0 then
- if $data[1][2] == $totalMsgOfStb then
+ if $data[1][2] == $expectmsgcnt then
goto check_ok_0
endi
endi
@@ -223,10 +223,10 @@ endi
$consumerId = 0
$totalMsgOfCtb = $rowsPerCtb
-$expectmsgcnt = $totalMsgOfCtb
-sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata , $ifmanualcommit )
+$expectmsgcnt = 1
+sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $totalMsgOfCtb , $ifcheckdata , $ifmanualcommit )
$consumerId = 1
-sql insert into consumeinfo values (now+1s , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata , $ifmanualcommit )
+sql insert into consumeinfo values (now+1s , $consumerId , $topicList , $keyList , $totalMsgOfCtb , $ifcheckdata , $ifmanualcommit )
print == start consumer to pull msgs from ctb
print == tsim/tmq/consume.sh -d $dbName -y $pullDelay -g $showMsg -r $showRow -s start
@@ -253,14 +253,14 @@ if $data[0][1] == 1 then
endi
endi
-# either $data[0][2] == $totalMsgOfCtb and $data[1][2] == 0
-# or $data[0][2] == 0 and $data[1][2] == $totalMsgOfCtb
-if $data[0][2] == $totalMsgOfCtb then
+# either $data[0][2] == $expectmsgcnt and $data[1][2] == 0
+# or $data[0][2] == 0 and $data[1][2] == $expectmsgcnt
+if $data[0][2] == $expectmsgcnt then
if $data[1][2] == 0 then
goto check_ok_2
endi
elif $data[0][2] == 0 then
- if $data[1][2] == $totalMsgOfCtb then
+ if $data[1][2] == $expectmsgcnt then
goto check_ok_2
endi
endi
@@ -328,10 +328,10 @@ endi
$consumerId = 0
$totalMsgOfNtb = $rowsPerCtb
-$expectmsgcnt = $totalMsgOfNtb
-sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata , $ifmanualcommit )
+$expectmsgcnt = 1
+sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $totalMsgOfNtb , $ifcheckdata , $ifmanualcommit )
$consumerId = 1
-sql insert into consumeinfo values (now+1s , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata , $ifmanualcommit )
+sql insert into consumeinfo values (now+1s , $consumerId , $topicList , $keyList , $totalMsgOfNtb , $ifcheckdata , $ifmanualcommit )
print == start consumer to pull msgs from ntb
print == tsim/tmq/consume.sh -d $dbName -y $pullDelay -g $showMsg -r $showRow -s start
@@ -358,14 +358,14 @@ if $data[1][1] == 0 then
endi
endi
-# either $data[0][2] == $totalMsgOfNtb and $data[1][2] == 0
-# or $data[0][2] == 0 and $data[1][2] == $totalMsgOfNtb
-if $data[0][2] == $totalMsgOfNtb then
+# either $data[0][2] == $expectmsgcnt and $data[1][2] == 0
+# or $data[0][2] == 0 and $data[1][2] == $expectmsgcnt
+if $data[0][2] == $expectmsgcnt then
if $data[1][2] == 0 then
goto check_ok_4
endi
elif $data[0][2] == 0 then
- if $data[1][2] == $totalMsgOfNtb then
+ if $data[1][2] == $expectmsgcnt then
goto check_ok_4
endi
endi
diff --git a/tests/script/tsim/tmq/basic2.sim b/tests/script/tsim/tmq/basic2.sim
index 6d49b46c85..8356a60b67 100644
--- a/tests/script/tsim/tmq/basic2.sim
+++ b/tests/script/tsim/tmq/basic2.sim
@@ -86,8 +86,8 @@ $topicList = $topicList . '
$consumerId = 0
$totalMsgOfStb = $ctbNum * $rowsPerCtb
$totalMsgOfStb = $totalMsgOfStb * $topicNum
-$expectmsgcnt = $totalMsgOfStb
-sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata , $ifmanualcommit )
+$expectmsgcnt = $topicNum
+sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $totalMsgOfStb , $ifcheckdata , $ifmanualcommit )
print == start consumer to pull msgs from stb
print == tsim/tmq/consume.sh -d $dbName -y $pullDelay -g $showMsg -r $showRow -w $dbName -s start
@@ -108,7 +108,7 @@ endi
if $data[0][2] != $expectmsgcnt then
return -1
endi
-if $data[0][3] != $expectmsgcnt then
+if $data[0][3] != $totalMsgOfStb then
return -1
endi
@@ -146,8 +146,8 @@ $topicList = $topicList . '
$consumerId = 0
$totalMsgOfCtb = $rowsPerCtb * $topicNum
-$expectmsgcnt = $totalMsgOfCtb
-sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata , $ifmanualcommit )
+$expectmsgcnt = $topicNum
+sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $totalMsgOfCtb , $ifcheckdata , $ifmanualcommit )
print == start consumer to pull msgs from ctb
print == tsim/tmq/consume.sh -d $dbName -y $pullDelay -g $showMsg -r $showRow -s start
@@ -165,7 +165,7 @@ endi
if $data[0][1] != $consumerId then
return -1
endi
-if $data[0][2] != $totalMsgOfCtb then
+if $data[0][2] != $expectmsgcnt then
return -1
endi
if $data[0][3] != $totalMsgOfCtb then
@@ -206,8 +206,8 @@ $topicList = $topicList . '
$consumerId = 0
$totalMsgOfNtb = $rowsPerCtb * $topicNum
-$expectmsgcnt = $totalMsgOfNtb
-sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata , $ifmanualcommit )
+$expectmsgcnt = $topicNum
+sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $totalMsgOfNtb , $ifcheckdata , $ifmanualcommit )
print == start consumer to pull msgs from ntb
print == tsim/tmq/consume.sh -d $dbName -y $pullDelay -g $showMsg -r $showRow -s start
@@ -225,7 +225,7 @@ endi
if $data[0][1] != $consumerId then
return -1
endi
-if $data[0][2] != $totalMsgOfNtb then
+if $data[0][2] != $expectmsgcnt then
return -1
endi
if $data[0][3] != $totalMsgOfNtb then
diff --git a/tests/script/tsim/tmq/basic2Of2Cons.sim b/tests/script/tsim/tmq/basic2Of2Cons.sim
index db660a0c93..63e7e2dcf4 100644
--- a/tests/script/tsim/tmq/basic2Of2Cons.sim
+++ b/tests/script/tsim/tmq/basic2Of2Cons.sim
@@ -85,10 +85,10 @@ $topicList = $topicList . '
$consumerId = 0
$totalMsgOfStb = $ctbNum * $rowsPerCtb
$totalMsgOfStb = $totalMsgOfStb * $topicNum
-$expectmsgcnt = $totalMsgOfStb
-sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata , $ifmanualcommit )
+$expectmsgcnt = $topicNum
+sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $totalMsgOfStb , $ifcheckdata , $ifmanualcommit )
$consumerId = 1
-sql insert into consumeinfo values (now+1s , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata , $ifmanualcommit )
+sql insert into consumeinfo values (now+1s , $consumerId , $topicList , $keyList , $totalMsgOfStb , $ifcheckdata , $ifmanualcommit )
print == start consumer to pull msgs from stb
print == tsim/tmq/consume.sh -d $dbName -y $pullDelay -g $showMsg -r $showRow -w $dbName -s start
@@ -115,14 +115,14 @@ if $data[0][1] == 1 then
endi
endi
-# either $data[0][2] == $totalMsgOfStb and $data[1][2] == 0
-# or $data[0][2] == 0 and $data[1][2] == $totalMsgOfStb
-if $data[0][2] == $totalMsgOfStb then
+# either $data[0][2] == $expectmsgcnt and $data[1][2] == 0
+# or $data[0][2] == 0 and $data[1][2] == $expectmsgcnt
+if $data[0][2] == $expectmsgcnt then
if $data[1][2] == 0 then
goto check_ok_0
endi
elif $data[0][2] == 0 then
- if $data[1][2] == $totalMsgOfStb then
+ if $data[1][2] == $expectmsgcnt then
goto check_ok_0
endi
endi
@@ -175,10 +175,10 @@ $topicList = $topicList . '
$consumerId = 0
$totalMsgOfCtb = $rowsPerCtb * $topicNum
-$expectmsgcnt = $totalMsgOfCtb
-sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata , $ifmanualcommit )
+$expectmsgcnt = $topicNum
+sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $totalMsgOfCtb , $ifcheckdata , $ifmanualcommit )
$consumerId = 1
-sql insert into consumeinfo values (now+1s , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata , $ifmanualcommit )
+sql insert into consumeinfo values (now+1s , $consumerId , $topicList , $keyList , $totalMsgOfCtb , $ifcheckdata , $ifmanualcommit )
print == start consumer to pull msgs from ctb
print == tsim/tmq/consume.sh -d $dbName -y $pullDelay -g $showMsg -r $showRow -s start
@@ -205,14 +205,14 @@ if $data[0][1] == 1 then
endi
endi
-# either $data[0][2] == $totalMsgOfCtb and $data[1][2] == 0
-# or $data[0][2] == 0 and $data[1][2] == $totalMsgOfCtb
-if $data[0][2] == $totalMsgOfCtb then
+# either $data[0][2] == $expectmsgcnt and $data[1][2] == 0
+# or $data[0][2] == 0 and $data[1][2] == $expectmsgcnt
+if $data[0][2] == $expectmsgcnt then
if $data[1][2] == 0 then
goto check_ok_2
endi
elif $data[0][2] == 0 then
- if $data[1][2] == $totalMsgOfCtb then
+ if $data[1][2] == $expectmsgcnt then
goto check_ok_2
endi
endi
@@ -265,10 +265,10 @@ $topicList = $topicList . '
$consumerId = 0
$totalMsgOfNtb = $rowsPerCtb * $topicNum
-$expectmsgcnt = $totalMsgOfNtb
-sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata , $ifmanualcommit )
+$expectmsgcnt = $topicNum
+sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $totalMsgOfNtb , $ifcheckdata , $ifmanualcommit )
$consumerId = 1
-sql insert into consumeinfo values (now+1s , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata , $ifmanualcommit )
+sql insert into consumeinfo values (now+1s , $consumerId , $topicList , $keyList , $totalMsgOfNtb , $ifcheckdata , $ifmanualcommit )
print == start consumer to pull msgs from ntb
print == tsim/tmq/consume.sh -d $dbName -y $pullDelay -g $showMsg -r $showRow -s start
@@ -295,14 +295,14 @@ if $data[1][1] == 0 then
endi
endi
-# either $data[0][2] == $totalMsgOfNtb and $data[1][2] == 0
-# or $data[0][2] == 0 and $data[1][2] == $totalMsgOfNtb
-if $data[0][2] == $totalMsgOfNtb then
+# either $data[0][2] == $expectmsgcnt and $data[1][2] == 0
+# or $data[0][2] == 0 and $data[1][2] == $expectmsgcnt
+if $data[0][2] == $expectmsgcnt then
if $data[1][2] == 0 then
goto check_ok_4
endi
elif $data[0][2] == 0 then
- if $data[1][2] == $totalMsgOfNtb then
+ if $data[1][2] == $expectmsgcnt then
goto check_ok_4
endi
endi
diff --git a/tests/script/tsim/tmq/basic2Of2ConsOverlap.sim b/tests/script/tsim/tmq/basic2Of2ConsOverlap.sim
index 54e10126f1..cfdae059dc 100644
--- a/tests/script/tsim/tmq/basic2Of2ConsOverlap.sim
+++ b/tests/script/tsim/tmq/basic2Of2ConsOverlap.sim
@@ -83,8 +83,8 @@ $topicList = $topicList . '
$consumerId = 0
$totalMsgOfOneTopic = $ctbNum * $rowsPerCtb
$totalMsgOfStb = $totalMsgOfOneTopic * $topicNum
-$expectmsgcnt = $totalMsgOfStb
-sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata , $ifmanualcommit )
+$expectmsgcnt = 3
+sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $totalMsgOfStb , $ifcheckdata , $ifmanualcommit )
$topicList = ' . topic_stb_all
@@ -92,7 +92,7 @@ $topicList = $topicList . ,
$topicList = $topicList . topic_stb_function
$topicList = $topicList . '
$consumerId = 1
-sql insert into consumeinfo values (now +1s , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata , $ifmanualcommit )
+sql insert into consumeinfo values (now +1s , $consumerId , $topicList , $keyList , $totalMsgOfStb , $ifcheckdata , $ifmanualcommit )
print == start consumer to pull msgs from stb
print == tsim/tmq/consume.sh -d $dbName -y $pullDelay -g $showMsg -r $showRow -w $dbName -s start
@@ -121,40 +121,40 @@ endi
# $data[0][2]/$data[1][2] should be between $totalMsgOfOneTopic and $totalMsgOfStb.
-if $data[0][2] < $totalMsgOfOneTopic then
+#if $data[0][2] < $totalMsgOfOneTopic then
+# return -1
+#endi
+if $data[0][2] > $expectmsgcnt then
return -1
endi
-if $data[0][2] > $totalMsgOfStb then
- return -1
-endi
-if $data[1][2] < $totalMsgOfOneTopic then
- return -1
-endi
-if $data[1][2] > $totalMsgOfStb then
+#if $data[1][2] < $totalMsgOfOneTopic then
+# return -1
+#endi
+if $data[1][2] > $expectmsgcnt then
return -1
endi
-$totalMsgCons = $totalMsgOfOneTopic + $totalMsgOfStb
+#$totalMsgCons = $totalMsgOfOneTopic + $totalMsgOfStb
$sumOfMsgCnt = $data[0][2] + $data[1][2]
-if $sumOfMsgCnt != $totalMsgCons then
- print total: $totalMsgCons
+if $sumOfMsgCnt != $expectmsgcnt then
+ print total: $expectmsgcnt
print sum: $sumOfMsgCnt
return -1
endi
# $data[0][3]/$data[1][3] should be between $totalMsgOfOneTopic and $totalMsgOfStb.
-if $data[0][3] < $totalMsgOfOneTopic then
- return -1
-endi
-if $data[0][3] > $totalMsgOfStb then
- return -1
-endi
-if $data[1][3] < $totalMsgOfOneTopic then
- return -1
-endi
-if $data[1][3] > $totalMsgOfStb then
- return -1
-endi
+#if $data[0][3] < $totalMsgOfStb then
+# return -1
+#endi
+#if $data[0][3] > $totalMsgOfStb then
+# return -1
+#endi
+#if $data[1][3] < $totalMsgOfStb then
+# return -1
+#endi
+#if $data[1][3] > $totalMsgOfStb then
+# return -1
+#endi
$totalMsgCons = $totalMsgOfOneTopic + $totalMsgOfStb
$sumOfRows = $data[0][3] + $data[1][3]
@@ -195,15 +195,15 @@ $consumerId = 0
$totalMsgOfOneTopic = $rowsPerCtb
$totalMsgOfCtb = $totalMsgOfOneTopic * $topicNum
-$expectmsgcnt = $totalMsgOfCtb
-sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata , $ifmanualcommit )
+$expectmsgcnt = $topicNum
+sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $totalMsgOfCtb , $ifcheckdata , $ifmanualcommit )
$topicList = ' . topic_ctb_function
$topicList = $topicList . ,
$topicList = $topicList . topic_ctb_all
$topicList = $topicList . '
$consumerId = 1
-sql insert into consumeinfo values (now +1s, $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata , $ifmanualcommit )
+sql insert into consumeinfo values (now +1s, $consumerId , $topicList , $keyList , $totalMsgOfCtb , $ifcheckdata , $ifmanualcommit )
print == start consumer to pull msgs from ctb
print == tsim/tmq/consume.sh -d $dbName -y $pullDelay -g $showMsg -r $showRow -w $cdbName -s start
@@ -232,24 +232,24 @@ endi
# either $data[0][2] $totalMsgOfOneTopic and $data[1][2] == $totalMsgOfCtb
# or $data[0][2] $totalMsgOfCtb and $data[1][2] == $totalMsgOfOneTopic
-if $data[0][2] == $totalMsgOfOneTopic then
- if $data[1][2] == $totalMsgOfCtb then
+if $data[0][2] == $topicNum then
+ if $data[1][2] == 1 then
goto check_ok_0
endi
-elif $data[1][2] == $totalMsgOfOneTopic then
- if $data[0][2] == $totalMsgOfCtb then
+elif $data[0][2] == 1 then
+ if $data[1][2] == $topicNum then
goto check_ok_0
endi
endi
return -1
check_ok_0:
-if $data[0][3] == $totalMsgOfOneTopic then
- if $data[1][3] == $totalMsgOfCtb then
+if $data[0][3] == $totalMsgOfCtb then
+ if $data[1][3] == $totalMsgOfOneTopic then
goto check_ok_1
endi
-elif $data[1][3] == $totalMsgOfOneTopic then
- if $data[0][3] == $totalMsgOfCtb then
+elif $data[0][3] == $totalMsgOfOneTopic then
+ if $data[1][3] == $totalMsgOfCtb then
goto check_ok_1
endi
endi
@@ -289,8 +289,8 @@ $topicList = $topicList . '
$consumerId = 0
$totalMsgOfOneTopic = $rowsPerCtb
$totalMsgOfNtb = $totalMsgOfOneTopic * $topicNum
-$expectmsgcnt = $totalMsgOfNtb
-sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata , $ifmanualcommit )
+$expectmsgcnt = $topicNum
+sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $totalMsgOfNtb , $ifcheckdata , $ifmanualcommit )
$topicList = ' . topic_ntb_function
@@ -298,7 +298,7 @@ $topicList = $topicList . ,
$topicList = $topicList . topic_ntb_all
$topicList = $topicList . '
$consumerId = 1
-sql insert into consumeinfo values (now+1s , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata , $ifmanualcommit )
+sql insert into consumeinfo values (now+1s , $consumerId , $topicList , $keyList , $totalMsgOfNtb , $ifcheckdata , $ifmanualcommit )
print == start consumer to pull msgs from ntb
print == tsim/tmq/consume.sh -d $dbName -y $pullDelay -g $showMsg -r $showRow -s start
@@ -327,12 +327,12 @@ endi
# either $data[0][2] $totalMsgOfOneTopic and $data[1][2] == $totalMsgOfNtb
# or $data[0][2] $totalMsgOfNtb and $data[1][2] == $totalMsgOfOneTopic
-if $data[0][2] == $totalMsgOfOneTopic then
- if $data[1][2] == $totalMsgOfNtb then
+if $data[0][2] == $expectmsgcnt then
+ if $data[1][2] == 1 then
goto check_ok_2
endi
-elif $data[1][2] == $totalMsgOfOneTopic then
- if $data[0][2] == $totalMsgOfNtb then
+elif $data[0][2] == 1 then
+ if $data[1][2] == $expectmsgcnt then
goto check_ok_2
endi
endi
@@ -343,8 +343,8 @@ if $data[0][3] == $totalMsgOfOneTopic then
if $data[1][3] == $totalMsgOfNtb then
goto check_ok_3
endi
-elif $data[1][3] == $totalMsgOfOneTopic then
- if $data[0][3] == $totalMsgOfNtb then
+elif $data[0][3] == $totalMsgOfNtb then
+ if $data[1][3] == $totalMsgOfOneTopic then
goto check_ok_3
endi
endi
diff --git a/tests/script/tsim/tmq/basic3.sim b/tests/script/tsim/tmq/basic3.sim
index 1e95fa90a5..a64dd6924d 100644
--- a/tests/script/tsim/tmq/basic3.sim
+++ b/tests/script/tsim/tmq/basic3.sim
@@ -117,8 +117,8 @@ endi
$consumerId = 0
$totalMsgOfStb = $ctbNum * $rowsPerCtb
-$expectmsgcnt = $totalMsgOfStb
-sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata , $ifmanualcommit )
+$expectmsgcnt = 1
+sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $totalMsgOfStb , $ifcheckdata , $ifmanualcommit )
print == start consumer to pull msgs from stb
print == tsim/tmq/consume.sh -d $dbName -y $pullDelay -g $showMsg -r $showRow -w $cdbName -s start
@@ -136,10 +136,10 @@ endi
if $data[0][1] != $consumerId then
return -1
endi
-if $data[0][2] != $expectmsgcnt then
- return -1
-endi
-if $data[0][3] != $expectmsgcnt then
+#if $data[0][2] != $expectmsgcnt then
+# return -1
+#endi
+if $data[0][3] != $totalMsgOfStb then
return -1
endi
$loop_cnt = $loop_cnt + 1
@@ -191,8 +191,8 @@ endi
$consumerId = 0
$totalMsgOfCtb = $rowsPerCtb
-$expectmsgcnt = $totalMsgOfCtb
-sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata , $ifmanualcommit )
+$expectmsgcnt = 1
+sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $totalMsgOfCtb , $ifcheckdata , $ifmanualcommit )
print == start consumer to pull msgs from ctb
print == tsim/tmq/consume.sh -d $dbName -y $pullDelay -g $showMsg -r $showRow -s start
@@ -210,7 +210,7 @@ endi
if $data[0][1] != $consumerId then
return -1
endi
-if $data[0][2] != $totalMsgOfCtb then
+if $data[0][2] != $expectmsgcnt then
return -1
endi
if $data[0][3] != $totalMsgOfCtb then
@@ -265,8 +265,8 @@ endi
$consumerId = 0
$totalMsgOfNtb = $rowsPerCtb
-$expectmsgcnt = $totalMsgOfNtb
-sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata , $ifmanualcommit )
+$expectmsgcnt = 1
+sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $totalMsgOfNtb , $ifcheckdata , $ifmanualcommit )
print == start consumer to pull msgs from ntb
print == tsim/tmq/consume.sh -d $dbName -y $pullDelay -g $showMsg -r $showRow -s start
@@ -284,7 +284,7 @@ endi
if $data[0][1] != $consumerId then
return -1
endi
-if $data[0][2] != $totalMsgOfNtb then
+if $data[0][2] != $expectmsgcnt then
return -1
endi
if $data[0][3] != $totalMsgOfNtb then
diff --git a/tests/script/tsim/tmq/basic3Of2Cons.sim b/tests/script/tsim/tmq/basic3Of2Cons.sim
index be0292c57b..4e47e3dbf9 100644
--- a/tests/script/tsim/tmq/basic3Of2Cons.sim
+++ b/tests/script/tsim/tmq/basic3Of2Cons.sim
@@ -116,10 +116,10 @@ endi
$consumerId = 0
$totalMsgOfStb = $ctbNum * $rowsPerCtb
-$expectmsgcnt = $totalMsgOfStb
-sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata , $ifmanualcommit )
+$expectmsgcnt = 3
+sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $totalMsgOfStb , $ifcheckdata , $ifmanualcommit )
$consumerId = 1
-sql insert into consumeinfo values (now+1s , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata , $ifmanualcommit )
+sql insert into consumeinfo values (now+1s , $consumerId , $topicList , $keyList , $totalMsgOfStb , $ifcheckdata , $ifmanualcommit )
print == start consumer to pull msgs from stb
print == tsim/tmq/consume.sh -d $dbName -y $pullDelay -g $showMsg -r $showRow -w $cdbName -s start
@@ -169,19 +169,19 @@ endi
if $data[0][3] <= 0 then
return -1
endi
-if $data[0][3] >= $expectmsgcnt then
+if $data[0][3] >= $totalMsgOfStb then
return -1
endi
if $data[1][3] <= 0 then
return -1
endi
-if $data[1][3] >= $expectmsgcnt then
+if $data[1][3] >= $totalMsgOfStb then
return -1
endi
$sumOfMsgRows = $data[0][3] + $data[1][3]
-if $sumOfMsgRows != $expectmsgcnt then
+if $sumOfMsgRows != $totalMsgOfStb then
return -1
endi
@@ -234,10 +234,10 @@ endi
$consumerId = 0
$totalMsgOfCtb = $rowsPerCtb
-$expectmsgcnt = $totalMsgOfCtb
-sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata , $ifmanualcommit )
+$expectmsgcnt = 1
+sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $totalMsgOfCtb , $ifcheckdata , $ifmanualcommit )
$consumerId = 1
-sql insert into consumeinfo values (now+1s , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata , $ifmanualcommit )
+sql insert into consumeinfo values (now+1s , $consumerId , $topicList , $keyList , $totalMsgOfCtb , $ifcheckdata , $ifmanualcommit )
print == start consumer to pull msgs from ctb
print == tsim/tmq/consume.sh -d $dbName -y $pullDelay -g $showMsg -r $showRow -s start
@@ -264,13 +264,13 @@ if $data[0][1] == 1 then
endi
endi
-# either $data[0][2] == $totalMsgOfCtb and $data[1][2] == 0
-# or $data[0][2] == 0 and $data[1][2] == $totalMsgOfCtb
-if $data[0][2] == $totalMsgOfCtb then
+# either $data[0][2] == $expectmsgcnt and $data[1][2] == 0
+# or $data[0][2] == 0 and $data[1][2] == $expectmsgcnt
+if $data[0][2] == $expectmsgcnt then
if $data[1][2] == 0 then
goto check_ok_0
endi
-elif $data[1][2] == $totalMsgOfCtb then
+elif $data[1][2] == $expectmsgcnt then
if $data[0][2] == 0 then
goto check_ok_0
endi
@@ -339,10 +339,10 @@ endi
$consumerId = 0
$totalMsgOfNtb = $rowsPerCtb
-$expectmsgcnt = $totalMsgOfNtb
-sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata , $ifmanualcommit )
+$expectmsgcnt = 1
+sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $totalMsgOfNtb , $ifcheckdata , $ifmanualcommit )
$consumerId = 1
-sql insert into consumeinfo values (now+1s , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata , $ifmanualcommit )
+sql insert into consumeinfo values (now+1s , $consumerId , $topicList , $keyList , $totalMsgOfNtb , $ifcheckdata , $ifmanualcommit )
print == start consumer to pull msgs from ntb
print == tsim/tmq/consume.sh -d $dbName -y $pullDelay -g $showMsg -r $showRow -s start
@@ -369,13 +369,13 @@ if $data[1][1] == 0 then
endi
endi
-# either $data[0][2] == $totalMsgOfNtb and $data[1][2] == 0
-# or $data[0][2] == 0 and $data[1][2] == $totalMsgOfNtb
-if $data[0][2] == $totalMsgOfNtb then
+# either $data[0][2] == $expectmsgcnt and $data[1][2] == 0
+# or $data[0][2] == 0 and $data[1][2] == $expectmsgcnt
+if $data[0][2] == $expectmsgcnt then
if $data[1][2] == 0 then
goto check_ok_2
endi
-elif $data[1][2] == $totalMsgOfNtb then
+elif $data[1][2] == $expectmsgcnt then
if $data[0][2] == 0 then
goto check_ok_2
endi
diff --git a/tests/script/tsim/tmq/basic4.sim b/tests/script/tsim/tmq/basic4.sim
index 33a66628d0..6b35342ad1 100644
--- a/tests/script/tsim/tmq/basic4.sim
+++ b/tests/script/tsim/tmq/basic4.sim
@@ -83,8 +83,8 @@ $topicList = $topicList . '
$consumerId = 0
$totalMsgOfStb = $ctbNum * $rowsPerCtb
$totalMsgOfStb = $totalMsgOfStb * $topicNum
-$expectmsgcnt = $totalMsgOfStb
-sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata , $ifmanualcommit )
+$expectmsgcnt = 9
+sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $totalMsgOfStb , $ifcheckdata , $ifmanualcommit )
print == start consumer to pull msgs from stb
print == tsim/tmq/consume.sh -d $dbName -y $pullDelay -g $showMsg -r $showRow -w $dbName -s start
@@ -105,7 +105,7 @@ endi
if $data[0][2] != $expectmsgcnt then
return -1
endi
-if $data[0][3] != $expectmsgcnt then
+if $data[0][3] != $totalMsgOfStb then
return -1
endi
@@ -143,8 +143,8 @@ $topicList = $topicList . '
$consumerId = 0
$totalMsgOfCtb = $rowsPerCtb * $topicNum
-$expectmsgcnt = $totalMsgOfCtb
-sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata , $ifmanualcommit )
+$expectmsgcnt = $topicNum
+sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $totalMsgOfCtb , $ifcheckdata , $ifmanualcommit )
print == start consumer to pull msgs from ctb
print == tsim/tmq/consume.sh -d $dbName -y $pullDelay -g $showMsg -r $showRow -s start
@@ -162,7 +162,7 @@ endi
if $data[0][1] != $consumerId then
return -1
endi
-if $data[0][2] != $totalMsgOfCtb then
+if $data[0][2] != $expectmsgcnt then
return -1
endi
if $data[0][3] != $totalMsgOfCtb then
@@ -203,8 +203,8 @@ $topicList = $topicList . '
$consumerId = 0
$totalMsgOfNtb = $rowsPerCtb * $topicNum
-$expectmsgcnt = $totalMsgOfNtb
-sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata , $ifmanualcommit )
+$expectmsgcnt = $topicNum
+sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $totalMsgOfNtb , $ifcheckdata , $ifmanualcommit )
print == start consumer to pull msgs from ntb
print == tsim/tmq/consume.sh -d $dbName -y $pullDelay -g $showMsg -r $showRow -s start
@@ -222,7 +222,7 @@ endi
if $data[0][1] != $consumerId then
return -1
endi
-if $data[0][2] != $totalMsgOfNtb then
+if $data[0][2] != $expectmsgcnt then
return -1
endi
if $data[0][3] != $totalMsgOfNtb then
diff --git a/tests/script/tsim/tmq/basic4Of2Cons.sim b/tests/script/tsim/tmq/basic4Of2Cons.sim
index fdee3f633e..122a91af36 100644
--- a/tests/script/tsim/tmq/basic4Of2Cons.sim
+++ b/tests/script/tsim/tmq/basic4Of2Cons.sim
@@ -82,10 +82,10 @@ $topicList = $topicList . '
$consumerId = 0
$totalMsgOfStb = $ctbNum * $rowsPerCtb
$totalMsgOfStb = $totalMsgOfStb * $topicNum
-$expectmsgcnt = $totalMsgOfStb
-sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata , $ifmanualcommit )
+$expectmsgcnt = 9
+sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $totalMsgOfStb , $ifcheckdata , $ifmanualcommit )
$consumerId = 1
-sql insert into consumeinfo values (now+1s , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata , $ifmanualcommit )
+sql insert into consumeinfo values (now+1s , $consumerId , $topicList , $keyList , $totalMsgOfStb , $ifcheckdata , $ifmanualcommit )
print == start consumer to pull msgs from stb
print == tsim/tmq/consume.sh -d $dbName -y $pullDelay -g $showMsg -r $showRow -w $dbName -s start
@@ -134,19 +134,19 @@ endi
if $data[0][3] <= 0 then
return -1
endi
-if $data[0][3] >= $expectmsgcnt then
+if $data[0][3] >= $totalMsgOfStb then
return -1
endi
if $data[1][3] <= 0 then
return -1
endi
-if $data[1][3] >= $expectmsgcnt then
+if $data[1][3] >= $totalMsgOfStb then
return -1
endi
$sumOfConsRow = $data[0][3] + $data[1][3]
-if $sumOfConsRow != $expectmsgcnt then
+if $sumOfConsRow != $totalMsgOfStb then
return -1
endi
@@ -184,10 +184,10 @@ $topicList = $topicList . '
$consumerId = 0
$totalMsgOfCtb = $rowsPerCtb * $topicNum
-$expectmsgcnt = $totalMsgOfCtb
-sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata , $ifmanualcommit )
+$expectmsgcnt = $topicNum
+sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $totalMsgOfCtb , $ifcheckdata , $ifmanualcommit )
$consumerId = 1
-sql insert into consumeinfo values (now+1s , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata , $ifmanualcommit )
+sql insert into consumeinfo values (now+1s , $consumerId , $topicList , $keyList , $totalMsgOfCtb , $ifcheckdata , $ifmanualcommit )
print == start consumer to pull msgs from ctb
print == tsim/tmq/consume.sh -d $dbName -y $pullDelay -g $showMsg -r $showRow -s start
@@ -214,14 +214,14 @@ if $data[0][1] == 1 then
endi
endi
-# either $data[0][2] == $totalMsgOfCtb and $data[1][2] == 0
-# or $data[0][2] == 0 and $data[1][2] == $totalMsgOfCtb
-if $data[0][2] == $totalMsgOfCtb then
+# either $data[0][2] == $expectmsgcnt and $data[1][2] == 0
+# or $data[0][2] == 0 and $data[1][2] == $expectmsgcnt
+if $data[0][2] == $expectmsgcnt then
if $data[1][2] == 0 then
goto check_ok_0
endi
elif $data[0][2] == 0 then
- if $data[1][2] == $totalMsgOfCtb then
+ if $data[1][2] == $expectmsgcnt then
goto check_ok_0
endi
endi
@@ -275,10 +275,10 @@ $topicList = $topicList . '
$consumerId = 0
$totalMsgOfNtb = $rowsPerCtb * $topicNum
-$expectmsgcnt = $totalMsgOfNtb
-sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata , $ifmanualcommit )
+$expectmsgcnt = $topicNum
+sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $totalMsgOfNtb , $ifcheckdata , $ifmanualcommit )
$consumerId = 1
-sql insert into consumeinfo values (now+1s , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata , $ifmanualcommit )
+sql insert into consumeinfo values (now+1s , $consumerId , $topicList , $keyList , $totalMsgOfNtb , $ifcheckdata , $ifmanualcommit )
print == start consumer to pull msgs from ntb
print == tsim/tmq/consume.sh -d $dbName -y $pullDelay -g $showMsg -r $showRow -s start
@@ -305,14 +305,14 @@ if $data[1][1] == 0 then
endi
endi
-# either $data[0][2] == $totalMsgOfNtb and $data[1][2] == 0
-# or $data[0][2] == 0 and $data[1][2] == $totalMsgOfNtb
-if $data[0][2] == $totalMsgOfNtb then
+# either $data[0][2] == $expectmsgcnt and $data[1][2] == 0
+# or $data[0][2] == 0 and $data[1][2] == $expectmsgcnt
+if $data[0][2] == $expectmsgcnt then
if $data[1][2] == 0 then
goto check_ok_2
endi
elif $data[0][2] == 0 then
- if $data[1][2] == $totalMsgOfNtb then
+ if $data[1][2] == $expectmsgcnt then
goto check_ok_2
endi
endi
diff --git a/tests/script/tsim/valgrind/checkUdf.sim b/tests/script/tsim/valgrind/checkUdf.sim
index dc703e155d..e316c104ed 100644
--- a/tests/script/tsim/valgrind/checkUdf.sim
+++ b/tests/script/tsim/valgrind/checkUdf.sim
@@ -29,10 +29,10 @@ sql select udf1(f) from t;
if $rows != 2 then
return -1
endi
-if $data00 != 88 then
+if $data00 != 1 then
return -1
endi
-if $data10 != 88 then
+if $data10 != 1 then
return -1
endi
@@ -51,10 +51,10 @@ sql select udf1(f1, f2) from t2;
if $rows != 2 then
return -1
endi
-if $data00 != 88 then
+if $data00 != 1 then
return -1
endi
-if $data10 != 88 then
+if $data10 != 1 then
return -1
endi
@@ -72,10 +72,10 @@ print $rows , $data00 , $data10 , $data20 , $data30
if $rows != 4 then
return -1
endi
-if $data00 != 88 then
+if $data00 != 1 then
return -1
endi
-if $data10 != 88 then
+if $data10 != 1 then
return -1
endi
@@ -114,10 +114,10 @@ print $rows , $data00 , $data01
if $rows != 1 then
return -1
endi
-if $data00 != 176.000000000 then
+if $data00 != 2.000000000 then
return -1
endi
-if $data01 != 152.420471066 then
+if $data01 != 1.732050808 then
return -1
endi
diff --git a/tests/system-test/0-others/udfTest.py b/tests/system-test/0-others/udfTest.py
index da77078208..78020cb958 100644
--- a/tests/system-test/0-others/udfTest.py
+++ b/tests/system-test/0-others/udfTest.py
@@ -191,20 +191,20 @@ class TDTestCase:
tdSql.checkData(0,0,None)
tdSql.checkData(0,1,None)
tdSql.checkData(0,2,1)
- tdSql.checkData(0,3,88)
+ tdSql.checkData(0,3,1)
tdSql.checkData(0,4,1.000000000)
- tdSql.checkData(0,5,88)
+ tdSql.checkData(0,5,1)
tdSql.checkData(0,6,"binary1")
- tdSql.checkData(0,7,88)
+ tdSql.checkData(0,7,1)
tdSql.checkData(3,0,3)
- tdSql.checkData(3,1,88)
+ tdSql.checkData(3,1,1)
tdSql.checkData(3,2,33333)
- tdSql.checkData(3,3,88)
+ tdSql.checkData(3,3,1)
tdSql.checkData(3,4,33.000000000)
- tdSql.checkData(3,5,88)
+ tdSql.checkData(3,5,1)
tdSql.checkData(3,6,"binary1")
- tdSql.checkData(3,7,88)
+ tdSql.checkData(3,7,1)
tdSql.checkData(11,0,None)
tdSql.checkData(11,1,None)
@@ -213,7 +213,7 @@ class TDTestCase:
tdSql.checkData(11,4,None)
tdSql.checkData(11,5,None)
tdSql.checkData(11,6,"binary1")
- tdSql.checkData(11,7,88)
+ tdSql.checkData(11,7,1)
tdSql.query("select c1 , udf1(c1) ,c2 ,udf1(c2), c3 ,udf1(c3), c4 ,udf1(c4) from stb1 order by c1")
tdSql.checkData(0,0,None)
@@ -226,13 +226,13 @@ class TDTestCase:
tdSql.checkData(0,7,None)
tdSql.checkData(20,0,8)
- tdSql.checkData(20,1,88)
+ tdSql.checkData(20,1,1)
tdSql.checkData(20,2,88888)
- tdSql.checkData(20,3,88)
+ tdSql.checkData(20,3,1)
tdSql.checkData(20,4,888)
- tdSql.checkData(20,5,88)
+ tdSql.checkData(20,5,1)
tdSql.checkData(20,6,88)
- tdSql.checkData(20,7,88)
+ tdSql.checkData(20,7,1)
# aggregate functions
@@ -375,14 +375,14 @@ class TDTestCase:
tdSql.checkRows(25)
tdSql.checkData(0,0,None)
tdSql.checkData(0,1,None)
- tdSql.checkData(1,0,88)
+ tdSql.checkData(1,0,1)
tdSql.checkData(1,1,8)
tdSql.query("select abs(udf1(c1)) , abs(ceil(c1)) from ct1 order by ts;")
tdSql.checkRows(13)
- tdSql.checkData(0,0,88)
+ tdSql.checkData(0,0,1)
tdSql.checkData(0,1,8)
- tdSql.checkData(1,0,88)
+ tdSql.checkData(1,0,1)
tdSql.checkData(1,1,7)
# bug fix for crash
@@ -401,9 +401,9 @@ class TDTestCase:
tdSql.query("select c1 ,udf1(c1) , c6 ,udf1(c6) from stb1 where c1 > 8 order by ts")
tdSql.checkRows(3)
tdSql.checkData(0,0,9)
- tdSql.checkData(0,1,88)
+ tdSql.checkData(0,1,1)
tdSql.checkData(0,2,-99.990000000)
- tdSql.checkData(0,3,88)
+ tdSql.checkData(0,3,1)
tdSql.query("select sub1.c1, sub2.c2 from sub1, sub2 where sub1.ts=sub2.ts and sub1.c1 is not null")
tdSql.checkData(0,0,0)
@@ -412,20 +412,20 @@ class TDTestCase:
tdSql.checkData(1,1,10)
tdSql.query("select udf1(sub1.c1), udf1(sub2.c2) from sub1, sub2 where sub1.ts=sub2.ts and sub1.c1 is not null")
- tdSql.checkData(0,0,88)
- tdSql.checkData(0,1,88)
- tdSql.checkData(1,0,88)
- tdSql.checkData(1,1,88)
+ tdSql.checkData(0,0,1)
+ tdSql.checkData(0,1,1)
+ tdSql.checkData(1,0,1)
+ tdSql.checkData(1,1,1)
tdSql.query("select sub1.c1 , udf1(sub1.c1), sub2.c2 ,udf1(sub2.c2) from sub1, sub2 where sub1.ts=sub2.ts and sub1.c1 is not null")
tdSql.checkData(0,0,0)
- tdSql.checkData(0,1,88)
+ tdSql.checkData(0,1,1)
tdSql.checkData(0,2,0)
- tdSql.checkData(0,3,88)
+ tdSql.checkData(0,3,1)
tdSql.checkData(1,0,1)
- tdSql.checkData(1,1,88)
+ tdSql.checkData(1,1,1)
tdSql.checkData(1,2,10)
- tdSql.checkData(1,3,88)
+ tdSql.checkData(1,3,1)
tdSql.query("select udf2(sub1.c1), udf2(sub2.c2) from sub1, sub2 where sub1.ts=sub2.ts and sub1.c1 is not null")
tdSql.checkData(0,0,16.881943016)
diff --git a/tests/system-test/0-others/udf_cfg2.py b/tests/system-test/0-others/udf_cfg2.py
index cc6da81847..b535b4f626 100644
--- a/tests/system-test/0-others/udf_cfg2.py
+++ b/tests/system-test/0-others/udf_cfg2.py
@@ -193,20 +193,20 @@ class TDTestCase:
tdSql.checkData(0,0,None)
tdSql.checkData(0,1,None)
tdSql.checkData(0,2,1)
- tdSql.checkData(0,3,88)
+ tdSql.checkData(0,3,1)
tdSql.checkData(0,4,1.000000000)
- tdSql.checkData(0,5,88)
+ tdSql.checkData(0,5,1)
tdSql.checkData(0,6,"binary1")
- tdSql.checkData(0,7,88)
+ tdSql.checkData(0,7,1)
tdSql.checkData(3,0,3)
- tdSql.checkData(3,1,88)
+ tdSql.checkData(3,1,1)
tdSql.checkData(3,2,33333)
- tdSql.checkData(3,3,88)
+ tdSql.checkData(3,3,1)
tdSql.checkData(3,4,33.000000000)
- tdSql.checkData(3,5,88)
+ tdSql.checkData(3,5,1)
tdSql.checkData(3,6,"binary1")
- tdSql.checkData(3,7,88)
+ tdSql.checkData(3,7,1)
tdSql.checkData(11,0,None)
tdSql.checkData(11,1,None)
@@ -215,7 +215,7 @@ class TDTestCase:
tdSql.checkData(11,4,None)
tdSql.checkData(11,5,None)
tdSql.checkData(11,6,"binary1")
- tdSql.checkData(11,7,88)
+ tdSql.checkData(11,7,1)
tdSql.query("select c1 , udf1(c1) ,c2 ,udf1(c2), c3 ,udf1(c3), c4 ,udf1(c4) from stb1 order by c1")
tdSql.checkData(0,0,None)
@@ -228,13 +228,13 @@ class TDTestCase:
tdSql.checkData(0,7,None)
tdSql.checkData(20,0,8)
- tdSql.checkData(20,1,88)
+ tdSql.checkData(20,1,1)
tdSql.checkData(20,2,88888)
- tdSql.checkData(20,3,88)
+ tdSql.checkData(20,3,1)
tdSql.checkData(20,4,888)
- tdSql.checkData(20,5,88)
+ tdSql.checkData(20,5,1)
tdSql.checkData(20,6,88)
- tdSql.checkData(20,7,88)
+ tdSql.checkData(20,7,1)
# aggregate functions
@@ -377,14 +377,14 @@ class TDTestCase:
tdSql.checkRows(25)
tdSql.checkData(0,0,None)
tdSql.checkData(0,1,None)
- tdSql.checkData(1,0,88)
+ tdSql.checkData(1,0,1)
tdSql.checkData(1,1,8)
tdSql.query("select abs(udf1(c1)) , abs(ceil(c1)) from ct1 order by ts;")
tdSql.checkRows(13)
- tdSql.checkData(0,0,88)
+ tdSql.checkData(0,0,1)
tdSql.checkData(0,1,8)
- tdSql.checkData(1,0,88)
+ tdSql.checkData(1,0,1)
tdSql.checkData(1,1,7)
# bug fix for crash
@@ -403,9 +403,9 @@ class TDTestCase:
tdSql.query("select c1 ,udf1(c1) , c6 ,udf1(c6) from stb1 where c1 > 8 order by ts")
tdSql.checkRows(3)
tdSql.checkData(0,0,9)
- tdSql.checkData(0,1,88)
+ tdSql.checkData(0,1,1)
tdSql.checkData(0,2,-99.990000000)
- tdSql.checkData(0,3,88)
+ tdSql.checkData(0,3,1)
tdSql.query("select sub1.c1, sub2.c2 from sub1, sub2 where sub1.ts=sub2.ts and sub1.c1 is not null")
tdSql.checkData(0,0,0)
@@ -414,20 +414,20 @@ class TDTestCase:
tdSql.checkData(1,1,10)
tdSql.query("select udf1(sub1.c1), udf1(sub2.c2) from sub1, sub2 where sub1.ts=sub2.ts and sub1.c1 is not null")
- tdSql.checkData(0,0,88)
- tdSql.checkData(0,1,88)
- tdSql.checkData(1,0,88)
- tdSql.checkData(1,1,88)
+ tdSql.checkData(0,0,1)
+ tdSql.checkData(0,1,1)
+ tdSql.checkData(1,0,1)
+ tdSql.checkData(1,1,1)
tdSql.query("select sub1.c1 , udf1(sub1.c1), sub2.c2 ,udf1(sub2.c2) from sub1, sub2 where sub1.ts=sub2.ts and sub1.c1 is not null")
tdSql.checkData(0,0,0)
- tdSql.checkData(0,1,88)
+ tdSql.checkData(0,1,1)
tdSql.checkData(0,2,0)
- tdSql.checkData(0,3,88)
+ tdSql.checkData(0,3,1)
tdSql.checkData(1,0,1)
- tdSql.checkData(1,1,88)
+ tdSql.checkData(1,1,1)
tdSql.checkData(1,2,10)
- tdSql.checkData(1,3,88)
+ tdSql.checkData(1,3,1)
tdSql.query("select udf2(sub1.c1), udf2(sub2.c2) from sub1, sub2 where sub1.ts=sub2.ts and sub1.c1 is not null")
tdSql.checkData(0,0,16.881943016)
diff --git a/tests/system-test/0-others/udf_create.py b/tests/system-test/0-others/udf_create.py
index d35688c8da..f467e802ac 100644
--- a/tests/system-test/0-others/udf_create.py
+++ b/tests/system-test/0-others/udf_create.py
@@ -193,20 +193,20 @@ class TDTestCase:
tdSql.checkData(0,0,None)
tdSql.checkData(0,1,None)
tdSql.checkData(0,2,1)
- tdSql.checkData(0,3,88)
+ tdSql.checkData(0,3,1)
tdSql.checkData(0,4,1.000000000)
- tdSql.checkData(0,5,88)
+ tdSql.checkData(0,5,1)
tdSql.checkData(0,6,"binary1")
- tdSql.checkData(0,7,88)
+ tdSql.checkData(0,7,1)
tdSql.checkData(3,0,3)
- tdSql.checkData(3,1,88)
+ tdSql.checkData(3,1,1)
tdSql.checkData(3,2,33333)
- tdSql.checkData(3,3,88)
+ tdSql.checkData(3,3,1)
tdSql.checkData(3,4,33.000000000)
- tdSql.checkData(3,5,88)
+ tdSql.checkData(3,5,1)
tdSql.checkData(3,6,"binary1")
- tdSql.checkData(3,7,88)
+ tdSql.checkData(3,7,1)
tdSql.checkData(11,0,None)
tdSql.checkData(11,1,None)
@@ -215,7 +215,7 @@ class TDTestCase:
tdSql.checkData(11,4,None)
tdSql.checkData(11,5,None)
tdSql.checkData(11,6,"binary1")
- tdSql.checkData(11,7,88)
+ tdSql.checkData(11,7,1)
tdSql.query("select c1 , udf1(c1) ,c2 ,udf1(c2), c3 ,udf1(c3), c4 ,udf1(c4) from stb1 order by c1")
tdSql.checkData(0,0,None)
@@ -228,13 +228,13 @@ class TDTestCase:
tdSql.checkData(0,7,None)
tdSql.checkData(20,0,8)
- tdSql.checkData(20,1,88)
+ tdSql.checkData(20,1,1)
tdSql.checkData(20,2,88888)
- tdSql.checkData(20,3,88)
+ tdSql.checkData(20,3,1)
tdSql.checkData(20,4,888)
- tdSql.checkData(20,5,88)
+ tdSql.checkData(20,5,1)
tdSql.checkData(20,6,88)
- tdSql.checkData(20,7,88)
+ tdSql.checkData(20,7,1)
# aggregate functions
@@ -377,14 +377,14 @@ class TDTestCase:
tdSql.checkRows(25)
tdSql.checkData(0,0,None)
tdSql.checkData(0,1,None)
- tdSql.checkData(1,0,88)
+ tdSql.checkData(1,0,1)
tdSql.checkData(1,1,8)
tdSql.query("select abs(udf1(c1)) , abs(ceil(c1)) from ct1 order by ts;")
tdSql.checkRows(13)
- tdSql.checkData(0,0,88)
+ tdSql.checkData(0,0,1)
tdSql.checkData(0,1,8)
- tdSql.checkData(1,0,88)
+ tdSql.checkData(1,0,1)
tdSql.checkData(1,1,7)
# bug fix for crash
@@ -403,9 +403,9 @@ class TDTestCase:
tdSql.query("select c1 ,udf1(c1) , c6 ,udf1(c6) from stb1 where c1 > 8 order by ts")
tdSql.checkRows(3)
tdSql.checkData(0,0,9)
- tdSql.checkData(0,1,88)
+ tdSql.checkData(0,1,1)
tdSql.checkData(0,2,-99.990000000)
- tdSql.checkData(0,3,88)
+ tdSql.checkData(0,3,1)
tdSql.query("select sub1.c1, sub2.c2 from sub1, sub2 where sub1.ts=sub2.ts and sub1.c1 is not null")
tdSql.checkData(0,0,0)
@@ -414,20 +414,20 @@ class TDTestCase:
tdSql.checkData(1,1,10)
tdSql.query("select udf1(sub1.c1), udf1(sub2.c2) from sub1, sub2 where sub1.ts=sub2.ts and sub1.c1 is not null")
- tdSql.checkData(0,0,88)
- tdSql.checkData(0,1,88)
- tdSql.checkData(1,0,88)
- tdSql.checkData(1,1,88)
+ tdSql.checkData(0,0,1)
+ tdSql.checkData(0,1,1)
+ tdSql.checkData(1,0,1)
+ tdSql.checkData(1,1,1)
tdSql.query("select sub1.c1 , udf1(sub1.c1), sub2.c2 ,udf1(sub2.c2) from sub1, sub2 where sub1.ts=sub2.ts and sub1.c1 is not null")
tdSql.checkData(0,0,0)
- tdSql.checkData(0,1,88)
+ tdSql.checkData(0,1,1)
tdSql.checkData(0,2,0)
- tdSql.checkData(0,3,88)
+ tdSql.checkData(0,3,1)
tdSql.checkData(1,0,1)
- tdSql.checkData(1,1,88)
+ tdSql.checkData(1,1,1)
tdSql.checkData(1,2,10)
- tdSql.checkData(1,3,88)
+ tdSql.checkData(1,3,1)
tdSql.query("select udf2(sub1.c1), udf2(sub2.c2) from sub1, sub2 where sub1.ts=sub2.ts and sub1.c1 is not null")
tdSql.checkData(0,0,16.881943016)
diff --git a/tests/system-test/0-others/udf_restart_taosd.py b/tests/system-test/0-others/udf_restart_taosd.py
index a0f70ccd49..61b6a4ea68 100644
--- a/tests/system-test/0-others/udf_restart_taosd.py
+++ b/tests/system-test/0-others/udf_restart_taosd.py
@@ -190,20 +190,20 @@ class TDTestCase:
tdSql.checkData(0,0,None)
tdSql.checkData(0,1,None)
tdSql.checkData(0,2,1)
- tdSql.checkData(0,3,88)
+ tdSql.checkData(0,3,1)
tdSql.checkData(0,4,1.000000000)
- tdSql.checkData(0,5,88)
+ tdSql.checkData(0,5,1)
tdSql.checkData(0,6,"binary1")
- tdSql.checkData(0,7,88)
+ tdSql.checkData(0,7,1)
tdSql.checkData(3,0,3)
- tdSql.checkData(3,1,88)
+ tdSql.checkData(3,1,1)
tdSql.checkData(3,2,33333)
- tdSql.checkData(3,3,88)
+ tdSql.checkData(3,3,1)
tdSql.checkData(3,4,33.000000000)
- tdSql.checkData(3,5,88)
+ tdSql.checkData(3,5,1)
tdSql.checkData(3,6,"binary1")
- tdSql.checkData(3,7,88)
+ tdSql.checkData(3,7,1)
tdSql.checkData(11,0,None)
tdSql.checkData(11,1,None)
@@ -212,7 +212,7 @@ class TDTestCase:
tdSql.checkData(11,4,None)
tdSql.checkData(11,5,None)
tdSql.checkData(11,6,"binary1")
- tdSql.checkData(11,7,88)
+ tdSql.checkData(11,7,1)
tdSql.query("select c1 , udf1(c1) ,c2 ,udf1(c2), c3 ,udf1(c3), c4 ,udf1(c4) from stb1 order by c1")
tdSql.checkData(0,0,None)
@@ -225,13 +225,13 @@ class TDTestCase:
tdSql.checkData(0,7,None)
tdSql.checkData(20,0,8)
- tdSql.checkData(20,1,88)
+ tdSql.checkData(20,1,1)
tdSql.checkData(20,2,88888)
- tdSql.checkData(20,3,88)
+ tdSql.checkData(20,3,1)
tdSql.checkData(20,4,888)
- tdSql.checkData(20,5,88)
+ tdSql.checkData(20,5,1)
tdSql.checkData(20,6,88)
- tdSql.checkData(20,7,88)
+ tdSql.checkData(20,7,1)
# aggregate functions
@@ -374,14 +374,14 @@ class TDTestCase:
tdSql.checkRows(25)
tdSql.checkData(0,0,None)
tdSql.checkData(0,1,None)
- tdSql.checkData(1,0,88)
+ tdSql.checkData(1,0,1)
tdSql.checkData(1,1,8)
tdSql.query("select abs(udf1(c1)) , abs(ceil(c1)) from ct1 order by ts;")
tdSql.checkRows(13)
- tdSql.checkData(0,0,88)
+ tdSql.checkData(0,0,1)
tdSql.checkData(0,1,8)
- tdSql.checkData(1,0,88)
+ tdSql.checkData(1,0,1)
tdSql.checkData(1,1,7)
# bug fix for crash
@@ -400,9 +400,9 @@ class TDTestCase:
tdSql.query("select c1 ,udf1(c1) , c6 ,udf1(c6) from stb1 where c1 > 8 order by ts")
tdSql.checkRows(3)
tdSql.checkData(0,0,9)
- tdSql.checkData(0,1,88)
+ tdSql.checkData(0,1,1)
tdSql.checkData(0,2,-99.990000000)
- tdSql.checkData(0,3,88)
+ tdSql.checkData(0,3,1)
tdSql.query("select sub1.c1, sub2.c2 from sub1, sub2 where sub1.ts=sub2.ts and sub1.c1 is not null")
tdSql.checkData(0,0,0)
@@ -411,20 +411,20 @@ class TDTestCase:
tdSql.checkData(1,1,10)
tdSql.query("select udf1(sub1.c1), udf1(sub2.c2) from sub1, sub2 where sub1.ts=sub2.ts and sub1.c1 is not null")
- tdSql.checkData(0,0,88)
- tdSql.checkData(0,1,88)
- tdSql.checkData(1,0,88)
- tdSql.checkData(1,1,88)
+ tdSql.checkData(0,0,1)
+ tdSql.checkData(0,1,1)
+ tdSql.checkData(1,0,1)
+ tdSql.checkData(1,1,1)
tdSql.query("select sub1.c1 , udf1(sub1.c1), sub2.c2 ,udf1(sub2.c2) from sub1, sub2 where sub1.ts=sub2.ts and sub1.c1 is not null")
tdSql.checkData(0,0,0)
- tdSql.checkData(0,1,88)
+ tdSql.checkData(0,1,1)
tdSql.checkData(0,2,0)
- tdSql.checkData(0,3,88)
+ tdSql.checkData(0,3,1)
tdSql.checkData(1,0,1)
- tdSql.checkData(1,1,88)
+ tdSql.checkData(1,1,1)
tdSql.checkData(1,2,10)
- tdSql.checkData(1,3,88)
+ tdSql.checkData(1,3,1)
tdSql.query("select udf2(sub1.c1), udf2(sub2.c2) from sub1, sub2 where sub1.ts=sub2.ts and sub1.c1 is not null")
tdSql.checkData(0,0,16.881943016)
@@ -468,12 +468,12 @@ class TDTestCase:
tdSql.checkData(1,0,1)
tdSql.checkData(1,1,1)
tdSql.checkData(1,2,1.110000000)
- tdSql.checkData(1,3,88)
+ tdSql.checkData(1,3,1)
tdSql.query("select c1,c6,udf1(c1,c6) from stb1 order by ts")
tdSql.checkData(1,0,8)
tdSql.checkData(1,1,88.880000000)
- tdSql.checkData(1,2,88)
+ tdSql.checkData(1,2,1)
tdSql.query("select abs(udf1(c1,c6,c1,c6)) , abs(ceil(c1)) from stb1 where c1 is not null order by ts;")
tdSql.checkRows(22)
diff --git a/tests/system-test/0-others/user_control.py b/tests/system-test/0-others/user_control.py
index d27892b588..7b5578ba45 100644
--- a/tests/system-test/0-others/user_control.py
+++ b/tests/system-test/0-others/user_control.py
@@ -444,7 +444,7 @@ class TDTestCase:
self.__grant_user_privileges(privilege="", dbname="db", user_name=self.__user_list[0]) ,
self.__grant_user_privileges(privilege=" ".join(self.__privilege), user_name=self.__user_list[0]) ,
f"GRANT {self.__privilege[0]} ON * TO {self.__user_list[0]}" ,
- f"GRANT {self.__privilege[0]} ON {DBNAME}.{NTBNAME} TO {self.__user_list[0]}" ,
+ # f"GRANT {self.__privilege[0]} ON {DBNAME}.{NTBNAME} TO {self.__user_list[0]}" ,
]
def __revoke_err(self):
@@ -456,7 +456,7 @@ class TDTestCase:
self.__revoke_user_privileges(privilege="", dbname="db", user_name=self.__user_list[0]) ,
self.__revoke_user_privileges(privilege=" ".join(self.__privilege), user_name=self.__user_list[0]) ,
f"REVOKE {self.__privilege[0]} ON * FROM {self.__user_list[0]}" ,
- f"REVOKE {self.__privilege[0]} ON {DBNAME}.{NTBNAME} FROM {self.__user_list[0]}" ,
+ # f"REVOKE {self.__privilege[0]} ON {DBNAME}.{NTBNAME} FROM {self.__user_list[0]}" ,
]
def test_grant_err(self):
diff --git a/tests/system-test/2-query/interp.py b/tests/system-test/2-query/interp.py
index 51d907b13a..74b552dcc8 100644
--- a/tests/system-test/2-query/interp.py
+++ b/tests/system-test/2-query/interp.py
@@ -2397,6 +2397,8 @@ class TDTestCase:
#tdSql.query(f"select _irowts,interp(c0) from {dbname}.{stbname} partition by tbname range('2020-02-01 00:00:04', '2020-02-02 00:00:16') every(1h) fill(prev)")
#tdSql.query(f"select tbname,_irowts,interp(c0) from {dbname}.{stbname} partition by tbname range('2020-02-01 00:00:04', '2020-02-02 00:00:16') every(1h) fill(prev)")
+ tdLog.printNoPrefix("======step 14: test interp pseudo columns")
+ tdSql.error(f"select _irowts, c6 from {dbname}.{tbname}")
def stop(self):
tdSql.close()
diff --git a/tests/system-test/2-query/max.py b/tests/system-test/2-query/max.py
index b8da02b9a6..ba6ab53fc7 100644
--- a/tests/system-test/2-query/max.py
+++ b/tests/system-test/2-query/max.py
@@ -20,8 +20,8 @@ class TDTestCase:
intData = []
floatData = []
tdSql.execute(f'''create table {dbname}.stb(ts timestamp, col1 tinyint, col2 smallint, col3 int, col4 bigint, col5 tinyint unsigned, col6 smallint unsigned,
- col7 int unsigned, col8 bigint unsigned, col9 float, col10 double, col11 bool, col12 binary(20), col13 nchar(20)) tags(loc nchar(20))''')
- tdSql.execute(f"create table {dbname}.stb_1 using {dbname}.stb tags('beijing')")
+ col7 int unsigned, col8 bigint unsigned, col9 float, col10 double, col11 bool, col12 binary(20), col13 nchar(20)) tags(t0 tinyint, t1 float, loc nchar(20))''')
+ tdSql.execute(f"create table {dbname}.stb_1 using {dbname}.stb tags(5, 5.5, 'beijing')")
for i in range(self.rowNum):
tdSql.execute(f"insert into {dbname}.stb_1 values(%d, %d, %d, %d, %d, %d, %d, %d, %d, %f, %f, %d, '{self.binary_str}%d', '{self.nchar_str}%d')"
% (self.ts + i, i + 1, i + 1, i + 1, i + 1, i + 1, i + 1, i + 1, i + 1, i + 0.1, i + 0.1, i % 2, i + 1, i + 1))
@@ -55,13 +55,20 @@ class TDTestCase:
tdSql.checkData(0, 1, np.max(intData))
tdSql.query(f"select ts, min(col9) from {dbname}.stb")
- tdSql.checkRows(1)
+ tdSql.checkRows(1)
tdSql.checkData(0, 1, np.min(floatData))
tdSql.query(f"select ts, min(col9) from {dbname}.stb_1")
- tdSql.checkRows(1)
+ tdSql.checkRows(1)
tdSql.checkData(0, 1, np.min(floatData))
+ # check tags
+ tdSql.query(f"select max(t0) from {dbname}.stb")
+ tdSql.checkData(0,0,5)
+
+ tdSql.query(f"select max(t1) from {dbname}.stb")
+ tdSql.checkData(0,0,5.5)
+
def max_check_ntb_base(self, dbname="db"):
tdSql.prepare()
intData = []
diff --git a/tests/system-test/2-query/odbc.py b/tests/system-test/2-query/odbc.py
index 9ff4a26ac0..a05e057042 100644
--- a/tests/system-test/2-query/odbc.py
+++ b/tests/system-test/2-query/odbc.py
@@ -22,7 +22,7 @@ class TDTestCase:
tdSql.execute("insert into db.ctb using db.stb tags(1) (ts, c1) values (now, 1)")
tdSql.query("select count(*) from information_schema.ins_columns")
- tdSql.checkData(0, 0, 275)
+ tdSql.checkData(0, 0, 277)
tdSql.query("select * from information_schema.ins_columns where table_name = 'ntb'")
tdSql.checkRows(14)
diff --git a/tests/system-test/2-query/sml.py b/tests/system-test/2-query/sml.py
index ec6309c71a..f96ed8a3ff 100644
--- a/tests/system-test/2-query/sml.py
+++ b/tests/system-test/2-query/sml.py
@@ -24,7 +24,7 @@ class TDTestCase:
tdSql.init(conn.cursor(), True)
#tdSql.init(conn.cursor(), logSql) # output sql.txt file
- def checkFileContent(self, dbname="sml_db"):
+ def checkContent(self, dbname="sml_db"):
simClientCfg="%s/taos.cfg"%tdDnodes.getSimCfgPath()
buildPath = tdCom.getBuildPath()
cmdStr = '%s/build/bin/sml_test %s'%(buildPath, simClientCfg)
@@ -102,7 +102,7 @@ class TDTestCase:
def run(self):
tdSql.prepare()
- self.checkFileContent()
+ self.checkContent()
def stop(self):
tdSql.close()
diff --git a/tests/system-test/7-tmq/dropDbR3ConflictTransaction.py b/tests/system-test/7-tmq/dropDbR3ConflictTransaction.py
index fa22cad726..7d11684ed8 100644
--- a/tests/system-test/7-tmq/dropDbR3ConflictTransaction.py
+++ b/tests/system-test/7-tmq/dropDbR3ConflictTransaction.py
@@ -32,34 +32,6 @@ class TDTestCase:
tdSql.init(conn.cursor())
#tdSql.init(conn.cursor(), logSql) # output sql.txt file
- def checkFileContent(self, consumerId, queryString):
- buildPath = tdCom.getBuildPath()
- cfgPath = tdCom.getClientCfgPath()
- dstFile = '%s/../log/dstrows_%d.txt'%(cfgPath, consumerId)
- cmdStr = '%s/build/bin/taos -c %s -s "%s >> %s"'%(buildPath, cfgPath, queryString, dstFile)
- tdLog.info(cmdStr)
- os.system(cmdStr)
-
- consumeRowsFile = '%s/../log/consumerid_%d.txt'%(cfgPath, consumerId)
- tdLog.info("rows file: %s, %s"%(consumeRowsFile, dstFile))
-
- consumeFile = open(consumeRowsFile, mode='r')
- queryFile = open(dstFile, mode='r')
-
- # skip first line for it is schema
- queryFile.readline()
-
- while True:
- dst = queryFile.readline()
- src = consumeFile.readline()
-
- if dst:
- if dst != src:
- tdLog.exit("consumerId %d consume rows is not match the rows by direct query"%consumerId)
- else:
- break
- return
-
def prepareTestEnv(self):
tdLog.printNoPrefix("======== prepare test env include database, stable, ctables, and insert data: ")
paraDict = {'dbName': 'dbt',
diff --git a/tests/system-test/7-tmq/subscribeStb.py b/tests/system-test/7-tmq/subscribeStb.py
index c8b66adfa2..9dcbf5b351 100644
--- a/tests/system-test/7-tmq/subscribeStb.py
+++ b/tests/system-test/7-tmq/subscribeStb.py
@@ -226,7 +226,7 @@ class TDTestCase:
self.insertConsumerInfo(consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifManualCommit)
tdLog.info("start consume processor")
- pollDelay = 100
+ pollDelay = 5
showMsg = 1
showRow = 1
self.startTmqSimProcess(buildPath,cfgPath,pollDelay,parameterDict["dbName"],showMsg, showRow)
@@ -307,7 +307,7 @@ class TDTestCase:
self.insertConsumerInfo(consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifManualCommit)
tdLog.info("start consume processor")
- pollDelay = 100
+ pollDelay = 5
showMsg = 1
showRow = 1
self.startTmqSimProcess(buildPath,cfgPath,pollDelay,parameterDict["dbName"],showMsg, showRow)
diff --git a/tests/system-test/7-tmq/subscribeStb0.py b/tests/system-test/7-tmq/subscribeStb0.py
index 717cf05bdc..06aa18c9b6 100644
--- a/tests/system-test/7-tmq/subscribeStb0.py
+++ b/tests/system-test/7-tmq/subscribeStb0.py
@@ -228,7 +228,7 @@ class TDTestCase:
self.insertConsumerInfo(consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifManualCommit)
tdLog.info("start consume processor")
- pollDelay = 100
+ pollDelay = 5
showMsg = 1
showRow = 1
self.startTmqSimProcess(buildPath,cfgPath,pollDelay,parameterDict["dbName"],showMsg, showRow)
@@ -303,7 +303,7 @@ class TDTestCase:
self.insertConsumerInfo(consumerId, expectrowcnt/4,topicList,keyList,ifcheckdata,ifManualCommit)
tdLog.info("start consume processor")
- pollDelay = 100
+ pollDelay = 5
showMsg = 1
showRow = 1
self.startTmqSimProcess(buildPath,cfgPath,pollDelay,parameterDict["dbName"],showMsg, showRow)
@@ -315,7 +315,7 @@ class TDTestCase:
for i in range(expectRows):
totalConsumeRows += resultList[i]
- if totalConsumeRows != expectrowcnt/4:
+ if totalConsumeRows < expectrowcnt/4:
tdLog.info("act consume rows: %d, expect consume rows: %d"%(totalConsumeRows, expectrowcnt/4))
tdLog.exit("tmq consume rows error!")
@@ -333,7 +333,7 @@ class TDTestCase:
for i in range(expectRows):
totalConsumeRows += resultList[i]
- if totalConsumeRows != expectrowcnt:
+ if totalConsumeRows < expectrowcnt:
tdLog.info("act consume rows: %d, expect consume rows: %d"%(totalConsumeRows, expectrowcnt))
tdLog.exit("tmq consume rows error!")
@@ -386,7 +386,7 @@ class TDTestCase:
self.insertConsumerInfo(consumerId, expectrowcnt/4,topicList,keyList,ifcheckdata,ifManualCommit)
tdLog.info("start consume processor")
- pollDelay = 100
+ pollDelay = 5
showMsg = 1
showRow = 1
self.startTmqSimProcess(buildPath,cfgPath,pollDelay,parameterDict["dbName"],showMsg, showRow)
@@ -398,7 +398,7 @@ class TDTestCase:
for i in range(expectRows):
totalConsumeRows += resultList[i]
- if totalConsumeRows != expectrowcnt/4:
+ if totalConsumeRows < expectrowcnt/4:
tdLog.info("act consume rows: %d, expect consume rows: %d"%(totalConsumeRows, expectrowcnt/4))
tdLog.exit("tmq consume rows error!")
@@ -416,7 +416,7 @@ class TDTestCase:
for i in range(expectRows):
totalConsumeRows += resultList[i]
- if totalConsumeRows != (expectrowcnt * (1 + 1/4)):
+ if totalConsumeRows < (expectrowcnt * (1 + 1/4)):
tdLog.info("act consume rows: %d, expect consume rows: %d"%(totalConsumeRows, expectrowcnt))
tdLog.exit("tmq consume rows error!")
diff --git a/tests/system-test/7-tmq/subscribeStb1.py b/tests/system-test/7-tmq/subscribeStb1.py
index 6d4b7d2380..25d09c38e2 100644
--- a/tests/system-test/7-tmq/subscribeStb1.py
+++ b/tests/system-test/7-tmq/subscribeStb1.py
@@ -233,7 +233,7 @@ class TDTestCase:
self.insertConsumerInfo(consumerId, expectrowcnt/4,topicList,keyList,ifcheckdata,ifManualCommit)
tdLog.info("start consume processor")
- pollDelay = 100
+ pollDelay = 5
showMsg = 1
showRow = 1
self.startTmqSimProcess(buildPath,cfgPath,pollDelay,parameterDict["dbName"],showMsg, showRow)
@@ -320,7 +320,7 @@ class TDTestCase:
self.insertConsumerInfo(consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifManualCommit)
tdLog.info("start consume processor")
- pollDelay = 100
+ pollDelay = 5
showMsg = 1
showRow = 1
self.startTmqSimProcess(buildPath,cfgPath,pollDelay,parameterDict["dbName"],showMsg, showRow)
diff --git a/tests/system-test/7-tmq/subscribeStb2.py b/tests/system-test/7-tmq/subscribeStb2.py
index 422cb23ffd..cdbc41a593 100644
--- a/tests/system-test/7-tmq/subscribeStb2.py
+++ b/tests/system-test/7-tmq/subscribeStb2.py
@@ -233,7 +233,7 @@ class TDTestCase:
self.insertConsumerInfo(consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifManualCommit)
tdLog.info("start consume 0 processor")
- pollDelay = 100
+ pollDelay = 10
showMsg = 1
showRow = 1
self.startTmqSimProcess(buildPath,cfgPath,pollDelay,parameterDict["dbName"],showMsg, showRow)
@@ -251,6 +251,7 @@ class TDTestCase:
tdLog.info("start consume 1 processor")
self.startTmqSimProcess(buildPath,cfgPath,pollDelay,parameterDict["dbName"],showMsg, showRow)
+ tdLog.sleep(2)
tdLog.info("start one new thread to insert data")
parameterDict['actionType'] = actionType.INSERT_DATA
@@ -271,6 +272,7 @@ class TDTestCase:
tdLog.info("start consume 2 processor")
self.startTmqSimProcess(buildPath,cfgPath,pollDelay,parameterDict["dbName"],showMsg, showRow)
+ tdLog.sleep(2)
tdLog.info("start one new thread to insert data")
parameterDict['actionType'] = actionType.INSERT_DATA
@@ -338,7 +340,7 @@ class TDTestCase:
self.insertConsumerInfo(consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifManualCommit)
tdLog.info("start consume 0 processor")
- pollDelay = 100
+ pollDelay = 20
showMsg = 1
showRow = 1
self.startTmqSimProcess(buildPath,cfgPath,pollDelay,parameterDict["dbName"],showMsg, showRow)
@@ -380,6 +382,7 @@ class TDTestCase:
tdLog.info("start consume 2 processor")
self.startTmqSimProcess(buildPath,cfgPath,pollDelay,parameterDict["dbName"],showMsg, showRow)
+ tdLog.sleep(2)
tdLog.info("start one new thread to insert data")
parameterDict['actionType'] = actionType.INSERT_DATA
@@ -394,7 +397,7 @@ class TDTestCase:
for i in range(expectRows):
totalConsumeRows += resultList[i]
- if totalConsumeRows != expectrowcnt*2:
+ if totalConsumeRows < expectrowcnt*2:
tdLog.info("act consume rows: %d, expect consume rows: %d"%(totalConsumeRows, expectrowcnt*2))
tdLog.exit("tmq consume rows error!")
diff --git a/tests/system-test/7-tmq/subscribeStb3.py b/tests/system-test/7-tmq/subscribeStb3.py
index 7205e84620..6f3230e687 100644
--- a/tests/system-test/7-tmq/subscribeStb3.py
+++ b/tests/system-test/7-tmq/subscribeStb3.py
@@ -215,7 +215,8 @@ class TDTestCase:
parameterDict["stbName"],\
parameterDict["ctbNum"],\
parameterDict["rowsPerTbl"],\
- parameterDict["batchNum"])
+ parameterDict["batchNum"],\
+ parameterDict["startTs"])
tdLog.info("create topics from stb1")
topicFromStb1 = 'topic_stb1'
@@ -233,7 +234,7 @@ class TDTestCase:
self.insertConsumerInfo(consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifManualCommit)
tdLog.info("start consume 0 processor")
- pollDelay = 100
+ pollDelay = 5
showMsg = 1
showRow = 1
self.startTmqSimProcess(buildPath,cfgPath,pollDelay,parameterDict["dbName"],showMsg, showRow)
@@ -269,7 +270,7 @@ class TDTestCase:
for i in range(expectRows):
totalConsumeRows += resultList[i]
- if totalConsumeRows != expectrowcnt-10000:
+ if totalConsumeRows < expectrowcnt-10000:
tdLog.info("act consume rows: %d, expect consume rows: %d"%(totalConsumeRows, expectrowcnt-10000))
tdLog.exit("tmq consume rows error!")
@@ -328,7 +329,8 @@ class TDTestCase:
parameterDict["stbName"],\
parameterDict["ctbNum"],\
parameterDict["rowsPerTbl"],\
- parameterDict["batchNum"])
+ parameterDict["batchNum"],\
+ parameterDict["startTs"])
tdLog.info("create topics from stb1")
topicFromStb1 = 'topic_stb1'
@@ -346,7 +348,7 @@ class TDTestCase:
self.insertConsumerInfo(consumerId, expectrowcnt/4,topicList,keyList,ifcheckdata,ifManualCommit)
tdLog.info("start consume processor")
- pollDelay = 100
+ pollDelay = 5
showMsg = 1
showRow = 1
self.startTmqSimProcess(buildPath,cfgPath,pollDelay,parameterDict["dbName"],showMsg, showRow)
@@ -415,7 +417,8 @@ class TDTestCase:
parameterDict["stbName"],\
parameterDict["ctbNum"],\
parameterDict["rowsPerTbl"],\
- parameterDict["batchNum"])
+ parameterDict["batchNum"],\
+ parameterDict["startTs"])
tdLog.info("create topics from stb1")
topicFromStb1 = 'topic_stb1'
@@ -433,7 +436,7 @@ class TDTestCase:
self.insertConsumerInfo(consumerId, expectrowcnt/4,topicList,keyList,ifcheckdata,ifManualCommit)
tdLog.info("start consume processor")
- pollDelay = 100
+ pollDelay = 5
showMsg = 1
showRow = 1
self.startTmqSimProcess(buildPath,cfgPath,pollDelay,parameterDict["dbName"],showMsg, showRow)
@@ -445,7 +448,7 @@ class TDTestCase:
for i in range(expectRows):
totalConsumeRows += resultList[i]
- if totalConsumeRows != expectrowcnt/4:
+ if totalConsumeRows < expectrowcnt/4:
tdLog.info("act consume rows: %d, expect consume rows: %d"%(totalConsumeRows, expectrowcnt/4))
tdLog.exit("tmq consume rows error!")
@@ -467,7 +470,7 @@ class TDTestCase:
for i in range(expectRows):
totalConsumeRows += resultList[i]
- if totalConsumeRows != expectrowcnt/4:
+ if totalConsumeRows < expectrowcnt/4:
tdLog.info("act consume rows: %d, expect consume rows: %d"%(totalConsumeRows, expectrowcnt/4))
tdLog.exit("tmq consume rows error!")
@@ -502,7 +505,8 @@ class TDTestCase:
parameterDict["stbName"],\
parameterDict["ctbNum"],\
parameterDict["rowsPerTbl"],\
- parameterDict["batchNum"])
+ parameterDict["batchNum"],\
+ parameterDict["startTs"])
tdLog.info("create topics from stb1")
topicFromStb1 = 'topic_stb1'
@@ -520,7 +524,7 @@ class TDTestCase:
self.insertConsumerInfo(consumerId, expectrowcnt/4,topicList,keyList,ifcheckdata,ifManualCommit)
tdLog.info("start consume processor")
- pollDelay = 100
+ pollDelay = 5
showMsg = 1
showRow = 1
self.startTmqSimProcess(buildPath,cfgPath,pollDelay,parameterDict["dbName"],showMsg, showRow)
@@ -532,7 +536,7 @@ class TDTestCase:
for i in range(expectRows):
totalConsumeRows += resultList[i]
- if totalConsumeRows != expectrowcnt/4:
+ if totalConsumeRows < expectrowcnt/4:
tdLog.info("act consume rows: %d, expect consume rows: %d"%(totalConsumeRows, expectrowcnt/4))
tdLog.exit("tmq consume rows error!")
@@ -555,7 +559,7 @@ class TDTestCase:
for i in range(expectRows):
totalConsumeRows += resultList[i]
- if totalConsumeRows != expectrowcnt*(1/2+1/4):
+ if totalConsumeRows < expectrowcnt*(1/2+1/4):
tdLog.info("act consume rows: %d, expect consume rows: %d"%(totalConsumeRows, expectrowcnt*(1/2+1/4)))
tdLog.exit("tmq consume rows error!")
diff --git a/tests/system-test/7-tmq/subscribeStb4.py b/tests/system-test/7-tmq/subscribeStb4.py
index bb8afcf14e..ed467b09b3 100644
--- a/tests/system-test/7-tmq/subscribeStb4.py
+++ b/tests/system-test/7-tmq/subscribeStb4.py
@@ -231,7 +231,7 @@ class TDTestCase:
self.insertConsumerInfo(consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifManualCommit)
tdLog.info("start consume processor")
- pollDelay = 100
+ pollDelay = 5
showMsg = 1
showRow = 1
self.startTmqSimProcess(buildPath,cfgPath,pollDelay,parameterDict["dbName"],showMsg, showRow)
@@ -305,7 +305,7 @@ class TDTestCase:
self.insertConsumerInfo(consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifManualCommit)
tdLog.info("start consume processor")
- pollDelay = 100
+ pollDelay = 5
showMsg = 1
showRow = 1
self.startTmqSimProcess(buildPath,cfgPath,pollDelay,parameterDict["dbName"],showMsg, showRow)
diff --git a/tests/system-test/7-tmq/tmq3mnodeSwitch.py b/tests/system-test/7-tmq/tmq3mnodeSwitch.py
index 22ef8cebdc..0740830696 100644
--- a/tests/system-test/7-tmq/tmq3mnodeSwitch.py
+++ b/tests/system-test/7-tmq/tmq3mnodeSwitch.py
@@ -138,34 +138,6 @@ class TDTestCase:
else:
tdLog.exit("three mnodes is not ready in 10s ")
- def checkFileContent(self, consumerId, queryString):
- buildPath = tdCom.getBuildPath()
- cfgPath = tdCom.getClientCfgPath()
- dstFile = '%s/../log/dstrows_%d.txt'%(cfgPath, consumerId)
- cmdStr = '%s/build/bin/taos -c %s -s "%s >> %s"'%(buildPath, cfgPath, queryString, dstFile)
- tdLog.info(cmdStr)
- os.system(cmdStr)
-
- consumeRowsFile = '%s/../log/consumerid_%d.txt'%(cfgPath, consumerId)
- tdLog.info("rows file: %s, %s"%(consumeRowsFile, dstFile))
-
- consumeFile = open(consumeRowsFile, mode='r')
- queryFile = open(dstFile, mode='r')
-
- # skip first line for it is schema
- queryFile.readline()
-
- while True:
- dst = queryFile.readline()
- src = consumeFile.readline()
-
- if dst:
- if dst != src:
- tdLog.exit("consumerId %d consume rows is not match the rows by direct query"%consumerId)
- else:
- break
- return
-
def tmqCase1(self):
tdLog.printNoPrefix("======== test case 1: ")
paraDict = {'dbName': 'db1',
@@ -257,7 +229,7 @@ class TDTestCase:
tdLog.exit("0 tmq consume rows error!")
if expectRowsList[0] == resultList[0]:
- self.checkFileContent(consumerId, queryString)
+ tmqCom.checkFileContent(consumerId, queryString)
time.sleep(10)
for i in range(len(topicNameList)):
diff --git a/tests/system-test/7-tmq/tmqCheckData.py b/tests/system-test/7-tmq/tmqCheckData.py
index a9671241a9..cb5a40642a 100644
--- a/tests/system-test/7-tmq/tmqCheckData.py
+++ b/tests/system-test/7-tmq/tmqCheckData.py
@@ -5,6 +5,7 @@ import time
import socket
import os
import threading
+import math
from util.log import *
from util.sql import *
@@ -21,34 +22,6 @@ class TDTestCase:
tdSql.init(conn.cursor())
#tdSql.init(conn.cursor(), logSql) # output sql.txt file
- def checkFileContent(self, consumerId, queryString):
- buildPath = tdCom.getBuildPath()
- cfgPath = tdCom.getClientCfgPath()
- dstFile = '%s/../log/dstrows_%d.txt'%(cfgPath, consumerId)
- cmdStr = '%s/build/bin/taos -c %s -s "%s >> %s"'%(buildPath, cfgPath, queryString, dstFile)
- tdLog.info(cmdStr)
- os.system(cmdStr)
-
- consumeRowsFile = '%s/../log/consumerid_%d.txt'%(cfgPath, consumerId)
- tdLog.info("rows file: %s, %s"%(consumeRowsFile, dstFile))
-
- consumeFile = open(consumeRowsFile, mode='r')
- queryFile = open(dstFile, mode='r')
-
- # skip first line for it is schema
- queryFile.readline()
-
- while True:
- dst = queryFile.readline()
- src = consumeFile.readline()
-
- if dst:
- if dst != src:
- tdLog.exit("consumerId %d consume rows is not match the rows by direct query"%consumerId)
- else:
- break
- return
-
def tmqCase1(self):
tdLog.printNoPrefix("======== test case 1: ")
paraDict = {'dbName': 'db1',
@@ -110,7 +83,7 @@ class TDTestCase:
tdLog.info("expect consume rows: %d, act consume rows: %d"%(expectRowsList[0], resultList[0]))
tdLog.exit("0 tmq consume rows error!")
- self.checkFileContent(consumerId, queryString)
+ tmqCom.checkFileContent(consumerId, queryString)
# reinit consume info, and start tmq_sim, then check consume result
tmqCom.initConsumerTable()
@@ -136,7 +109,7 @@ class TDTestCase:
tdLog.info("expect consume rows: %d, act consume rows: %d"%(expectRowsList[1], resultList[0]))
tdLog.exit("1 tmq consume rows error!")
- self.checkFileContent(consumerId, queryString)
+ tmqCom.checkFileContent(consumerId, queryString)
# reinit consume info, and start tmq_sim, then check consume result
tmqCom.initConsumerTable()
@@ -162,7 +135,7 @@ class TDTestCase:
# tdLog.info("expect consume rows: %d, act consume rows: %d"%(expectRowsList[2], resultList[0]))
# tdLog.exit("2 tmq consume rows error!")
- # self.checkFileContent(consumerId, queryString)
+ # tmqCom.checkFileContent(consumerId, queryString)
time.sleep(10)
for i in range(len(topicNameList)):
diff --git a/tests/system-test/7-tmq/tmqCheckData1.py b/tests/system-test/7-tmq/tmqCheckData1.py
index e06c29c5a2..b4fec94dcc 100644
--- a/tests/system-test/7-tmq/tmqCheckData1.py
+++ b/tests/system-test/7-tmq/tmqCheckData1.py
@@ -21,34 +21,6 @@ class TDTestCase:
tdSql.init(conn.cursor())
#tdSql.init(conn.cursor(), logSql) # output sql.txt file
- def checkFileContent(self, consumerId, queryString):
- buildPath = tdCom.getBuildPath()
- cfgPath = tdCom.getClientCfgPath()
- dstFile = '%s/../log/dstrows_%d.txt'%(cfgPath, consumerId)
- cmdStr = '%s/build/bin/taos -c %s -s "%s >> %s"'%(buildPath, cfgPath, queryString, dstFile)
- tdLog.info(cmdStr)
- os.system(cmdStr)
-
- consumeRowsFile = '%s/../log/consumerid_%d.txt'%(cfgPath, consumerId)
- tdLog.info("rows file: %s, %s"%(consumeRowsFile, dstFile))
-
- consumeFile = open(consumeRowsFile, mode='r')
- queryFile = open(dstFile, mode='r')
-
- # skip first line for it is schema
- queryFile.readline()
-
- while True:
- dst = queryFile.readline()
- src = consumeFile.readline()
-
- if dst:
- if dst != src:
- tdLog.exit("consumerId %d consume rows is not match the rows by direct query"%consumerId)
- else:
- break
- return
-
def tmqCase1(self):
tdLog.printNoPrefix("======== test case 1: ")
paraDict = {'dbName': 'db1',
@@ -110,7 +82,7 @@ class TDTestCase:
tdLog.info("expect consume rows: %d, act consume rows: %d"%(expectRowsList[0], resultList[0]))
tdLog.exit("0 tmq consume rows error!")
- self.checkFileContent(consumerId, queryString)
+ tmqCom.checkFileContent(consumerId, queryString)
# reinit consume info, and start tmq_sim, then check consume result
tmqCom.initConsumerTable()
@@ -135,7 +107,7 @@ class TDTestCase:
tdLog.info("expect consume rows: %d, act consume rows: %d"%(expectRowsList[1], resultList[0]))
tdLog.exit("1 tmq consume rows error!")
- self.checkFileContent(consumerId, queryString)
+ tmqCom.checkFileContent(consumerId, queryString)
# reinit consume info, and start tmq_sim, then check consume result
tmqCom.initConsumerTable()
@@ -160,7 +132,7 @@ class TDTestCase:
tdLog.info("expect consume rows: %d, act consume rows: %d"%(expectRowsList[2], resultList[0]))
tdLog.exit("2 tmq consume rows error!")
- self.checkFileContent(consumerId, queryString)
+ tmqCom.checkFileContent(consumerId, queryString)
time.sleep(10)
for i in range(len(topicNameList)):
diff --git a/tests/system-test/7-tmq/tmqCommon.py b/tests/system-test/7-tmq/tmqCommon.py
index 1e636e2074..f63c70a4c6 100644
--- a/tests/system-test/7-tmq/tmqCommon.py
+++ b/tests/system-test/7-tmq/tmqCommon.py
@@ -10,7 +10,7 @@
###################################################################
# -*- coding: utf-8 -*-
-
+import math
from asyncore import loop
from collections import defaultdict
import subprocess
@@ -467,18 +467,24 @@ class TMQCom:
for i in range(0,skipRowsOfCons):
consumeFile.readline()
- lines = 0
while True:
dst = queryFile.readline()
src = consumeFile.readline()
- lines += 1
- if dst:
- if dst != src:
- tdLog.info("src row: %s"%src)
- tdLog.info("dst row: %s"%dst)
- tdLog.exit("consumerId %d consume rows[%d] is not match the rows by direct query"%(consumerId, lines))
- else:
+ dstSplit = dst.split(',')
+ srcSplit = src.split(',')
+
+ if not dst or not src:
break
+ if len(dstSplit) != len(srcSplit):
+ tdLog.exit("consumerId %d consume rows len is not match the rows by direct query,len(dstSplit):%d != len(srcSplit):%d, dst:%s, src:%s"
+ %(consumerId, len(dstSplit), len(srcSplit), dst, src))
+
+ for i in range(len(dstSplit)):
+ if srcSplit[i] != dstSplit[i]:
+ srcFloat = float(srcSplit[i])
+ dstFloat = float(dstSplit[i])
+ if not math.isclose(srcFloat, dstFloat, abs_tol=1e-9):
+ tdLog.exit("consumerId %d consume rows is not match the rows by direct query"%consumerId)
return
def getResultFileByTaosShell(self, consumerId, queryString):
diff --git a/tests/system-test/7-tmq/tmqConsumerGroup.py b/tests/system-test/7-tmq/tmqConsumerGroup.py
index b1aef9d762..d146dca449 100644
--- a/tests/system-test/7-tmq/tmqConsumerGroup.py
+++ b/tests/system-test/7-tmq/tmqConsumerGroup.py
@@ -21,34 +21,6 @@ class TDTestCase:
tdSql.init(conn.cursor())
#tdSql.init(conn.cursor(), logSql) # output sql.txt file
- def checkFileContent(self, consumerId, queryString):
- buildPath = tdCom.getBuildPath()
- cfgPath = tdCom.getClientCfgPath()
- dstFile = '%s/../log/dstrows_%d.txt'%(cfgPath, consumerId)
- cmdStr = '%s/build/bin/taos -c %s -s "%s >> %s"'%(buildPath, cfgPath, queryString, dstFile)
- tdLog.info(cmdStr)
- os.system(cmdStr)
-
- consumeRowsFile = '%s/../log/consumerid_%d.txt'%(cfgPath, consumerId)
- tdLog.info("rows file: %s, %s"%(consumeRowsFile, dstFile))
-
- consumeFile = open(consumeRowsFile, mode='r')
- queryFile = open(dstFile, mode='r')
-
- # skip first line for it is schema
- queryFile.readline()
-
- while True:
- dst = queryFile.readline()
- src = consumeFile.readline()
-
- if dst:
- if dst != src:
- tdLog.exit("consumerId %d consume rows is not match the rows by direct query"%consumerId)
- else:
- break
- return
-
def tmqCase1(self):
tdLog.printNoPrefix("======== test case 1: ")
paraDict = {'dbName': 'db1',
diff --git a/tests/system-test/7-tmq/tmqDelete-1ctb.py b/tests/system-test/7-tmq/tmqDelete-1ctb.py
index 6dc8de7efc..aa9c8d25d0 100644
--- a/tests/system-test/7-tmq/tmqDelete-1ctb.py
+++ b/tests/system-test/7-tmq/tmqDelete-1ctb.py
@@ -238,10 +238,10 @@ class TDTestCase:
if self.snapshot == 0:
consumerId = 2
- expectrowcnt = int(paraDict["rowsPerTbl"] * paraDict["ctbNum"] * (1 + 1/4 + 3/4))
+ expectrowcnt = int(paraDict["rowsPerTbl"] * paraDict["ctbNum"]) * 2
elif self.snapshot == 1:
consumerId = 3
- expectrowcnt = int(paraDict["rowsPerTbl"] * paraDict["ctbNum"] * (1 - 1/4 + 1/4 + 3/4))
+ expectrowcnt = int(paraDict["rowsPerTbl"] * paraDict["ctbNum"] * (1 + 1/4))
topicList = topicFromStb1
ifcheckdata = 1
@@ -271,7 +271,7 @@ class TDTestCase:
if totalConsumeRows != expectrowcnt:
tdLog.exit("tmq consume rows error with snapshot = 0!")
elif self.snapshot == 1:
- if totalConsumeRows != totalRowsFromQuery:
+ if totalConsumeRows != expectrowcnt:
tdLog.exit("tmq consume rows error with snapshot = 1!")
# tmqCom.checkFileContent(consumerId, queryString)
@@ -324,7 +324,7 @@ class TDTestCase:
if self.snapshot == 0:
consumerId = 4
- expectrowcnt = int(paraDict["rowsPerTbl"] * paraDict["ctbNum"] * (1/4 + 3/4))
+ expectrowcnt = int(paraDict["rowsPerTbl"] * paraDict["ctbNum"]) * 2
elif self.snapshot == 1:
consumerId = 5
expectrowcnt = int(paraDict["rowsPerTbl"] * paraDict["ctbNum"] * (1 - 1/4 + 1/4 + 3/4))
@@ -370,11 +370,7 @@ class TDTestCase:
tdLog.info("act consume rows: %d, act query rows: %d, expect consume rows: %d, "%(totalConsumeRows, totalRowsFromQuery, expectrowcnt))
if self.snapshot == 0:
- # If data writing is completed before consumer get snapshot, will consume 7500 from wal;
- # If data writing has not started before consumer get snapshot, will consume 10000 from wal;
- minRows = int(expectrowcnt * (1 - 1/4)) # 7500
- tdLog.info("consume rows should be between %d and %d, "%(minRows, expectrowcnt))
- if not ((totalConsumeRows >= minRows) and (totalConsumeRows <= expectrowcnt)):
+ if (totalConsumeRows != expectrowcnt):
tdLog.exit("tmq consume rows error with snapshot = 0!")
elif self.snapshot == 1:
tdLog.info("consume rows should be between %d and %d, "%(totalRowsFromQuery, expectrowcnt))
@@ -495,7 +491,7 @@ class TDTestCase:
tdLog.printNoPrefix("======== test case 4 end ...... ")
def run(self):
- # tdSql.prepare()
+ tdSql.prepare()
tdLog.printNoPrefix("=============================================")
tdLog.printNoPrefix("======== snapshot is 0: only consume from wal")
self.snapshot = 0
@@ -521,11 +517,11 @@ class TDTestCase:
self.prepareTestEnv()
self.tmqCase3()
- tdLog.printNoPrefix("=============================================")
- tdLog.printNoPrefix("======== snapshot is 0: only consume from wal")
- self.snapshot = 0
- self.prepareTestEnv()
- self.tmqCase4()
+ # tdLog.printNoPrefix("=============================================")
+ # tdLog.printNoPrefix("======== snapshot is 0: only consume from wal")
+ # self.snapshot = 0
+ # self.prepareTestEnv()
+ # self.tmqCase4()
tdLog.printNoPrefix("====================================================================")
tdLog.printNoPrefix("======== snapshot is 1: firstly consume from tsbs, and then from wal")
self.snapshot = 1
diff --git a/tests/system-test/7-tmq/tmqUdf-multCtb-snapshot0.py b/tests/system-test/7-tmq/tmqUdf-multCtb-snapshot0.py
index a923232706..bee38ca8ee 100644
--- a/tests/system-test/7-tmq/tmqUdf-multCtb-snapshot0.py
+++ b/tests/system-test/7-tmq/tmqUdf-multCtb-snapshot0.py
@@ -60,34 +60,6 @@ class TDTestCase:
tdLog.exit("create udf functions fail")
return
- def checkFileContent(self, consumerId, queryString):
- buildPath = tdCom.getBuildPath()
- cfgPath = tdCom.getClientCfgPath()
- dstFile = '%s/../log/dstrows_%d.txt'%(cfgPath, consumerId)
- cmdStr = '%s/build/bin/taos -c %s -s "%s >> %s"'%(buildPath, cfgPath, queryString, dstFile)
- tdLog.info(cmdStr)
- os.system(cmdStr)
-
- consumeRowsFile = '%s/../log/consumerid_%d.txt'%(cfgPath, consumerId)
- tdLog.info("rows file: %s, %s"%(consumeRowsFile, dstFile))
-
- consumeFile = open(consumeRowsFile, mode='r')
- queryFile = open(dstFile, mode='r')
-
- # skip first line for it is schema
- queryFile.readline()
-
- while True:
- dst = queryFile.readline()
- src = consumeFile.readline()
-
- if dst:
- if dst != src:
- tdLog.exit("consumerId %d consume rows is not match the rows by direct query"%consumerId)
- else:
- break
- return
-
def prepareTestEnv(self):
tdLog.printNoPrefix("======== prepare test env include database, stable, ctables, and insert data: ")
paraDict = {'dbName': 'dbt',
@@ -201,7 +173,7 @@ class TDTestCase:
tdLog.info("expect consume rows: %d, act consume rows: %d"%(expectRowsList[0], resultList[0]))
tdLog.exit("0 tmq consume rows error!")
- # self.checkFileContent(consumerId, queryString)
+ # tmqCom.checkFileContent(consumerId, queryString)
# tdLog.printNoPrefix("consumerId %d check data ok!"%(consumerId))
# reinit consume info, and start tmq_sim, then check consume result
@@ -228,7 +200,7 @@ class TDTestCase:
tdLog.info("expect consume rows: %d, act consume rows: %d"%(expectRowsList[1], resultList[0]))
tdLog.exit("1 tmq consume rows error!")
- # self.checkFileContent(consumerId, queryString)
+ # tmqCom.checkFileContent(consumerId, queryString)
# tdLog.printNoPrefix("consumerId %d check data ok!"%(consumerId))
time.sleep(10)
@@ -312,7 +284,7 @@ class TDTestCase:
tdLog.info("expect consume rows: %d, act consume rows: %d"%(expectRowsList[0], resultList[0]))
tdLog.exit("2 tmq consume rows error!")
- # self.checkFileContent(consumerId, queryString)
+ # tmqCom.checkFileContent(consumerId, queryString)
# tdLog.printNoPrefix("consumerId %d check data ok!"%(consumerId))
# reinit consume info, and start tmq_sim, then check consume result
@@ -339,7 +311,7 @@ class TDTestCase:
tdLog.info("expect consume rows: %d, act consume rows: %d"%(expectRowsList[1], resultList[0]))
tdLog.exit("3 tmq consume rows error!")
- # self.checkFileContent(consumerId, queryString)
+ # tmqCom.checkFileContent(consumerId, queryString)
# tdLog.printNoPrefix("consumerId %d check data ok!"%(consumerId))
time.sleep(10)
diff --git a/tests/system-test/7-tmq/tmqUdf-multCtb-snapshot1.py b/tests/system-test/7-tmq/tmqUdf-multCtb-snapshot1.py
index bee174376d..d3b64d2b21 100644
--- a/tests/system-test/7-tmq/tmqUdf-multCtb-snapshot1.py
+++ b/tests/system-test/7-tmq/tmqUdf-multCtb-snapshot1.py
@@ -60,34 +60,6 @@ class TDTestCase:
tdLog.exit("create udf functions fail")
return
- def checkFileContent(self, consumerId, queryString):
- buildPath = tdCom.getBuildPath()
- cfgPath = tdCom.getClientCfgPath()
- dstFile = '%s/../log/dstrows_%d.txt'%(cfgPath, consumerId)
- cmdStr = '%s/build/bin/taos -c %s -s "%s >> %s"'%(buildPath, cfgPath, queryString, dstFile)
- tdLog.info(cmdStr)
- os.system(cmdStr)
-
- consumeRowsFile = '%s/../log/consumerid_%d.txt'%(cfgPath, consumerId)
- tdLog.info("rows file: %s, %s"%(consumeRowsFile, dstFile))
-
- consumeFile = open(consumeRowsFile, mode='r')
- queryFile = open(dstFile, mode='r')
-
- # skip first line for it is schema
- queryFile.readline()
-
- while True:
- dst = queryFile.readline()
- src = consumeFile.readline()
-
- if dst:
- if dst != src:
- tdLog.exit("consumerId %d consume rows is not match the rows by direct query"%consumerId)
- else:
- break
- return
-
def prepareTestEnv(self):
tdLog.printNoPrefix("======== prepare test env include database, stable, ctables, and insert data: ")
paraDict = {'dbName': 'dbt',
@@ -201,7 +173,7 @@ class TDTestCase:
tdLog.info("expect consume rows: %d, act consume rows: %d"%(expectRowsList[0], resultList[0]))
tdLog.exit("0 tmq consume rows error!")
- # self.checkFileContent(consumerId, queryString)
+ # tmqCom.checkFileContent(consumerId, queryString)
# tdLog.printNoPrefix("consumerId %d check data ok!"%(consumerId))
# reinit consume info, and start tmq_sim, then check consume result
@@ -228,7 +200,7 @@ class TDTestCase:
tdLog.info("expect consume rows: %d, act consume rows: %d"%(expectRowsList[1], resultList[0]))
tdLog.exit("1 tmq consume rows error!")
- # self.checkFileContent(consumerId, queryString)
+ # tmqCom.checkFileContent(consumerId, queryString)
# tdLog.printNoPrefix("consumerId %d check data ok!"%(consumerId))
time.sleep(10)
@@ -312,7 +284,7 @@ class TDTestCase:
tdLog.info("expect consume rows: %d, act consume rows: %d"%(expectRowsList[0], resultList[0]))
tdLog.exit("2 tmq consume rows error!")
- # self.checkFileContent(consumerId, queryString)
+ # tmqCom.checkFileContent(consumerId, queryString)
# tdLog.printNoPrefix("consumerId %d check data ok!"%(consumerId))
# reinit consume info, and start tmq_sim, then check consume result
@@ -339,7 +311,7 @@ class TDTestCase:
tdLog.info("expect consume rows: %d, act consume rows: %d"%(expectRowsList[1], resultList[0]))
tdLog.exit("3 tmq consume rows error!")
- # self.checkFileContent(consumerId, queryString)
+ # tmqCom.checkFileContent(consumerId, queryString)
# tdLog.printNoPrefix("consumerId %d check data ok!"%(consumerId))
time.sleep(10)
diff --git a/tests/system-test/7-tmq/tmqUdf.py b/tests/system-test/7-tmq/tmqUdf.py
index 5bb8e3034c..5da1625cb1 100644
--- a/tests/system-test/7-tmq/tmqUdf.py
+++ b/tests/system-test/7-tmq/tmqUdf.py
@@ -60,34 +60,6 @@ class TDTestCase:
tdLog.exit("create udf functions fail")
return
- def checkFileContent(self, consumerId, queryString):
- buildPath = tdCom.getBuildPath()
- cfgPath = tdCom.getClientCfgPath()
- dstFile = '%s/../log/dstrows_%d.txt'%(cfgPath, consumerId)
- cmdStr = '%s/build/bin/taos -c %s -s "%s >> %s"'%(buildPath, cfgPath, queryString, dstFile)
- tdLog.info(cmdStr)
- os.system(cmdStr)
-
- consumeRowsFile = '%s/../log/consumerid_%d.txt'%(cfgPath, consumerId)
- tdLog.info("rows file: %s, %s"%(consumeRowsFile, dstFile))
-
- consumeFile = open(consumeRowsFile, mode='r')
- queryFile = open(dstFile, mode='r')
-
- # skip first line for it is schema
- queryFile.readline()
-
- while True:
- dst = queryFile.readline()
- src = consumeFile.readline()
-
- if dst:
- if dst != src:
- tdLog.exit("consumerId %d consume rows is not match the rows by direct query"%consumerId)
- else:
- break
- return
-
def prepareTestEnv(self):
tdLog.printNoPrefix("======== prepare test env include database, stable, ctables, and insert data: ")
paraDict = {'dbName': 'dbt',
@@ -201,7 +173,7 @@ class TDTestCase:
tdLog.info("expect consume rows: %d, act consume rows: %d"%(expectRowsList[0], resultList[0]))
tdLog.exit("0 tmq consume rows error!")
- self.checkFileContent(consumerId, queryString)
+ tmqCom.checkFileContent(consumerId, queryString)
tdLog.printNoPrefix("consumerId %d check data ok!"%(consumerId))
@@ -229,7 +201,7 @@ class TDTestCase:
tdLog.info("expect consume rows: %d, act consume rows: %d"%(expectRowsList[1], resultList[0]))
tdLog.exit("1 tmq consume rows error!")
- self.checkFileContent(consumerId, queryString)
+ tmqCom.checkFileContent(consumerId, queryString)
tdLog.printNoPrefix("consumerId %d check data ok!"%(consumerId))
time.sleep(10)
@@ -313,7 +285,7 @@ class TDTestCase:
tdLog.info("expect consume rows: %d, act consume rows: %d"%(expectRowsList[0], resultList[0]))
tdLog.exit("2 tmq consume rows error!")
- self.checkFileContent(consumerId, queryString)
+ tmqCom.checkFileContent(consumerId, queryString)
tdLog.printNoPrefix("consumerId %d check data ok!"%(consumerId))
# reinit consume info, and start tmq_sim, then check consume result
@@ -340,7 +312,7 @@ class TDTestCase:
tdLog.info("expect consume rows: %d, act consume rows: %d"%(expectRowsList[1], resultList[0]))
tdLog.exit("3 tmq consume rows error!")
- self.checkFileContent(consumerId, queryString)
+ tmqCom.checkFileContent(consumerId, queryString)
tdLog.printNoPrefix("consumerId %d check data ok!"%(consumerId))
time.sleep(10)
diff --git a/tests/system-test/99-TDcase/TD-16821.py b/tests/system-test/99-TDcase/TD-16821.py
index 78ac172f30..2e23002059 100644
--- a/tests/system-test/99-TDcase/TD-16821.py
+++ b/tests/system-test/99-TDcase/TD-16821.py
@@ -21,34 +21,6 @@ class TDTestCase:
tdSql.init(conn.cursor())
#tdSql.init(conn.cursor(), logSql) # output sql.txt file
- def checkFileContent(self, consumerId, queryString):
- buildPath = tdCom.getBuildPath()
- cfgPath = tdCom.getClientCfgPath()
- dstFile = '%s/../log/dstrows_%d.txt'%(cfgPath, consumerId)
- cmdStr = '%s/build/bin/taos -c %s -s "%s >> %s"'%(buildPath, cfgPath, queryString, dstFile)
- tdLog.info(cmdStr)
- os.system(cmdStr)
-
- consumeRowsFile = '%s/../log/consumerid_%d.txt'%(cfgPath, consumerId)
- tdLog.info("rows file: %s, %s"%(consumeRowsFile, dstFile))
-
- consumeFile = open(consumeRowsFile, mode='r')
- queryFile = open(dstFile, mode='r')
-
- # skip first line for it is schema
- queryFile.readline()
-
- while True:
- dst = queryFile.readline()
- src = consumeFile.readline()
-
- if dst:
- if dst != src:
- tdLog.exit("consumerId %d consume rows is not match the rows by direct query"%consumerId)
- else:
- break
- return
-
def tmqCase1(self):
tdLog.printNoPrefix("======== test case 1: ")
paraDict = {'dbName': 'db1',
@@ -114,7 +86,7 @@ class TDTestCase:
tdLog.info("expect consume rows: %d, act consume rows: %d"%(expectRowsList[0], resultList[0]))
tdLog.exit("0 tmq consume rows error!")
- self.checkFileContent(consumerId, queryString)
+ tmqCom.checkFileContent(consumerId, queryString)
# reinit consume info, and start tmq_sim, then check consume result
tmqCom.initConsumerTable()
@@ -140,7 +112,7 @@ class TDTestCase:
tdLog.info("expect consume rows: %d, act consume rows: %d"%(expectRowsList[1], resultList[0]))
tdLog.exit("1 tmq consume rows error!")
- self.checkFileContent(consumerId, queryString)
+ tmqCom.checkFileContent(consumerId, queryString)
# reinit consume info, and start tmq_sim, then check consume result
tmqCom.initConsumerTable()
@@ -166,7 +138,7 @@ class TDTestCase:
# tdLog.info("expect consume rows: %d, act consume rows: %d"%(expectRowsList[2], resultList[0]))
# tdLog.exit("2 tmq consume rows error!")
- # self.checkFileContent(consumerId, queryString)
+ # tmqCom.checkFileContent(consumerId, queryString)
time.sleep(10)
for i in range(len(topicNameList)):
diff --git a/tests/system-test/runAllOne.sh b/tests/system-test/runAllOne.sh
new file mode 100644
index 0000000000..5a8d358d98
--- /dev/null
+++ b/tests/system-test/runAllOne.sh
@@ -0,0 +1,688 @@
+# start -N3
+echo " ********** -N 3 *************"
+python3 ./test.py -f 7-tmq/tmqDelete-multiCtb.py -N 3 -n 3
+python3 ./test.py -f 1-insert/alter_database.py -P
+python3 ./test.py -f 1-insert/influxdb_line_taosc_insert.py -P
+python3 ./test.py -f 1-insert/opentsdb_telnet_line_taosc_insert.py -P
+python3 ./test.py -f 1-insert/opentsdb_json_taosc_insert.py -P
+python3 ./test.py -f 1-insert/test_stmt_muti_insert_query.py -P
+python3 ./test.py -f 1-insert/test_stmt_set_tbname_tag.py -P
+python3 ./test.py -f 1-insert/alter_stable.py -P
+python3 ./test.py -f 1-insert/alter_table.py -P
+python3 ./test.py -f 1-insert/boundary.py -P
+python3 ./test.py -f 1-insert/insertWithMoreVgroup.py -P
+python3 ./test.py -f 1-insert/table_comment.py -P
+python3 ./test.py -f 1-insert/time_range_wise.py -P
+python3 ./test.py -f 1-insert/block_wise.py -P
+python3 ./test.py -f 1-insert/create_retentions.py -P
+python3 ./test.py -f 1-insert/mutil_stage.py -P
+python3 ./test.py -f 1-insert/table_param_ttl.py -P
+python3 ./test.py -f 1-insert/table_param_ttl.py -P -R
+python3 ./test.py -f 1-insert/update_data_muti_rows.py -P
+python3 ./test.py -f 1-insert/db_tb_name_check.py -P
+python3 ./test.py -f 1-insert/InsertFuturets.py -P
+python3 ./test.py -f 1-insert/insert_wide_column.py -P
+python3 ./test.py -f 2-query/nestedQuery.py -P
+python3 ./test.py -f 2-query/nestedQuery_str.py -P
+python3 ./test.py -f 2-query/nestedQuery_math.py -P
+python3 ./test.py -f 2-query/nestedQuery_time.py -P
+python3 ./test.py -f 2-query/nestedQuery_26.py -P
+python3 ./test.py -f 2-query/nestedQuery_str.py -P -Q 2
+python3 ./test.py -f 2-query/nestedQuery_math.py -P -Q 2
+python3 ./test.py -f 2-query/nestedQuery_time.py -P -Q 2
+python3 ./test.py -f 2-query/nestedQuery.py -P -Q 2
+python3 ./test.py -f 2-query/nestedQuery_26.py -P -Q 2
+python3 ./test.py -f 2-query/columnLenUpdated.py -P
+python3 ./test.py -f 2-query/columnLenUpdated.py -P -Q 2
+python3 ./test.py -f 2-query/columnLenUpdated.py -P -Q 3
+python3 ./test.py -f 2-query/columnLenUpdated.py -P -Q 4
+python3 ./test.py -f 2-query/nestedQuery.py -P -Q 4
+python3 ./test.py -f 2-query/nestedQuery_str.py -P -Q 4
+python3 ./test.py -f 2-query/nestedQuery_math.py -P -Q 4
+python3 ./test.py -f 2-query/nestedQuery_time.py -P -Q 4
+python3 ./test.py -f 2-query/nestedQuery_26.py -P -Q 4
+python3 ./test.py -f 7-tmq/tmqShow.py -P
+python3 ./test.py -f 7-tmq/tmqDropStb.py -P
+python3 ./test.py -f 7-tmq/subscribeStb0.py -P
+python3 ./test.py -f 7-tmq/subscribeStb1.py -P
+python3 ./test.py -f 7-tmq/subscribeStb2.py -P
+python3 ./test.py -f 7-tmq/subscribeStb3.py -P
+python3 ./test.py -f 7-tmq/subscribeDb0.py -P -N 3 -n 3
+python3 ./test.py -f 1-insert/delete_stable.py -P
+python3 ./test.py -f 2-query/out_of_order.py -P -Q 3
+python3 ./test.py -f 2-query/out_of_order.py -P
+python3 ./test.py -f 2-query/insert_null_none.py -P
+python3 ./test.py -f 2-query/insert_null_none.py -P -R
+python3 ./test.py -f 2-query/insert_null_none.py -P -Q 2
+python3 ./test.py -f 2-query/insert_null_none.py -P -Q 3
+python3 ./test.py -f 2-query/insert_null_none.py -P -Q 4
+python3 ./test.py -f 1-insert/database_pre_suf.py -P
+python3 ./test.py -f 2-query/concat.py -P -Q 3
+python3 ./test.py -f 2-query/out_of_order.py -P -Q 2
+python3 ./test.py -f 2-query/out_of_order.py -P -Q 4
+python3 ./test.py -f 2-query/nestedQuery.py -P -Q 3
+python3 ./test.py -f 2-query/nestedQuery_str.py -P -Q 3
+python3 ./test.py -f 2-query/nestedQuery_math.py -P -Q 3
+python3 ./test.py -f 2-query/nestedQuery_time.py -P -Q 3
+python3 ./test.py -f 2-query/nestedQuery_26.py -P -Q 3
+python3 ./test.py -f 7-tmq/create_wrong_topic.py -P
+python3 ./test.py -f 7-tmq/dropDbR3ConflictTransaction.py -P -N 3
+python3 ./test.py -f 7-tmq/basic5.py -P
+python3 ./test.py -f 7-tmq/subscribeDb.py -P -N 3 -n 3
+python3 ./test.py -f 7-tmq/subscribeDb1.py -P
+python3 ./test.py -f 7-tmq/subscribeDb2.py -P
+python3 ./test.py -f 7-tmq/subscribeDb3.py -P
+python3 ./test.py -f 7-tmq/subscribeDb4.py -P
+python3 ./test.py -f 7-tmq/subscribeStb.py -P
+python3 ./test.py -f 7-tmq/subscribeStb4.py -P
+python3 ./test.py -f 7-tmq/db.py -P
+python3 ./test.py -f 7-tmq/tmqError.py -P
+python3 ./test.py -f 7-tmq/schema.py -P
+python3 ./test.py -f 7-tmq/stbFilter.py -P
+python3 ./test.py -f 7-tmq/tmqCheckData.py -P
+python3 ./test.py -f 7-tmq/tmqCheckData1.py -P
+python3 ./test.py -f 7-tmq/tmqConsumerGroup.py -P
+python3 ./test.py -f 7-tmq/tmqAlterSchema.py -P
+python3 ./test.py -f 7-tmq/tmqConsFromTsdb.py -P -N 3 -n 3
+python3 ./test.py -f 7-tmq/tmqConsFromTsdb1.py -P -N 3 -n 3
+python3 ./test.py -f 7-tmq/tmqConsFromTsdb-mutilVg.py -P
+python3 ./test.py -f 7-tmq/tmqConsFromTsdb1-mutilVg.py -P
+python3 ./test.py -f 7-tmq/tmqConsFromTsdb-1ctb.py -P
+python3 ./test.py -f 7-tmq/tmqConsFromTsdb1-1ctb.py -P
+python3 ./test.py -f 7-tmq/tmqConsFromTsdb-1ctb-funcNFilter.py -P
+python3 ./test.py -f 7-tmq/tmqConsFromTsdb-mutilVg-mutilCtb-funcNFilter.py -P
+python3 ./test.py -f 7-tmq/tmqConsFromTsdb-mutilVg-mutilCtb.py -P
+python3 ./test.py -f 7-tmq/tmqConsFromTsdb1-1ctb-funcNFilter.py -P
+python3 ./test.py -f 7-tmq/tmqConsFromTsdb1-mutilVg-mutilCtb-funcNFilter.py -P
+python3 ./test.py -f 7-tmq/tmqConsFromTsdb1-mutilVg-mutilCtb.py -P
+python3 ./test.py -f 7-tmq/tmqAutoCreateTbl.py -P
+python3 ./test.py -f 7-tmq/tmqDnodeRestart.py -P
+python3 ./test.py -f 7-tmq/tmqDnodeRestart1.py -P
+python3 ./test.py -f 7-tmq/tmqUpdate-1ctb.py -P
+python3 ./test.py -f 7-tmq/tmqUpdate-multiCtb-snapshot0.py -P
+python3 ./test.py -f 7-tmq/tmqUpdate-multiCtb-snapshot1.py -P
+python3 ./test.py -f 7-tmq/tmqDropStbCtb.py -P
+python3 ./test.py -f 7-tmq/tmqDropNtb-snapshot0.py -P
+python3 ./test.py -f 7-tmq/tmqDropNtb-snapshot1.py -P
+python3 ./test.py -f 7-tmq/tmqUdf-multCtb-snapshot0.py -P
+python3 ./test.py -f 7-tmq/tmqUdf-multCtb-snapshot1.py -P
+python3 ./test.py -f 7-tmq/stbTagFilter-1ctb.py -P
+python3 ./test.py -f 7-tmq/dataFromTsdbNWal.py -P
+python3 ./test.py -f 7-tmq/dataFromTsdbNWal-multiCtb.py -P
+python3 ./test.py -f 7-tmq/tmq_taosx.py -P
+python3 ./test.py -f 7-tmq/raw_block_interface_test.py -P
+python3 ./test.py -f 7-tmq/stbTagFilter-multiCtb.py -P
+python3 ./test.py -f 99-TDcase/TD-19201.py -P
+python3 ./test.py -f 99-TDcase/TD-21561.py -P
+python3 ./test.py -f 0-others/taosShell.py -P
+python3 ./test.py -f 0-others/taosShellError.py -P
+python3 ./test.py -f 0-others/taosShellNetChk.py -P
+python3 ./test.py -f 0-others/telemetry.py -P
+python3 ./test.py -f 0-others/backquote_check.py -P
+python3 ./test.py -f 0-others/taosdMonitor.py -P
+python3 ./test.py -f 0-others/udfTest.py -P
+python3 ./test.py -f 0-others/udf_create.py -P
+python3 ./test.py -f 0-others/udf_restart_taosd.py -P
+python3 ./test.py -f 0-others/udf_cfg1.py -P
+python3 ./test.py -f 0-others/udf_cfg2.py -P
+python3 ./test.py -f 0-others/cachemodel.py -P
+python3 ./test.py -f 0-others/sysinfo.py -P
+python3 ./test.py -f 0-others/user_control.py -P
+python3 ./test.py -f 0-others/user_manage.py -P
+python3 ./test.py -f 0-others/fsync.py -P
+python3 ./test.py -f 0-others/tag_index_basic.py -P
+python3 ./test.py -f 0-others/show.py -P
+python3 ./test.py -f 0-others/information_schema.py -P
+python3 ./test.py -f 2-query/abs.py -P
+python3 ./test.py -f 2-query/abs.py -P -R
+python3 ./test.py -f 2-query/and_or_for_byte.py -P
+python3 ./test.py -f 2-query/and_or_for_byte.py -P -R
+python3 ./test.py -f 2-query/apercentile.py -P
+python3 ./test.py -f 2-query/apercentile.py -P -R
+python3 ./test.py -f 2-query/arccos.py -P
+python3 ./test.py -f 2-query/arccos.py -P -R
+python3 ./test.py -f 2-query/arcsin.py -P
+python3 ./test.py -f 2-query/arcsin.py -P -R
+python3 ./test.py -f 2-query/arctan.py -P
+python3 ./test.py -f 2-query/arctan.py -P -R
+python3 ./test.py -f 2-query/avg.py -P
+python3 ./test.py -f 2-query/avg.py -P -R
+python3 ./test.py -f 2-query/between.py -P
+python3 ./test.py -f 2-query/between.py -P -R
+python3 ./test.py -f 2-query/bottom.py -P
+python3 ./test.py -f 2-query/bottom.py -P -R
+python3 ./test.py -f 2-query/cast.py -P
+python3 ./test.py -f 2-query/cast.py -P -R
+python3 ./test.py -f 2-query/ceil.py -P
+python3 ./test.py -f 2-query/ceil.py -P -R
+python3 ./test.py -f 2-query/char_length.py -P
+python3 ./test.py -f 2-query/char_length.py -P -R
+python3 ./test.py -f 2-query/check_tsdb.py -P
+python3 ./test.py -f 2-query/check_tsdb.py -P -R
+python3 ./test.py -f 2-query/concat.py -P
+python3 ./test.py -f 2-query/concat.py -P -R
+python3 ./test.py -f 2-query/concat_ws.py -P
+python3 ./test.py -f 2-query/concat_ws.py -P -R
+python3 ./test.py -f 2-query/concat_ws2.py -P
+python3 ./test.py -f 2-query/concat_ws2.py -P -R
+python3 ./test.py -f 2-query/cos.py -P
+python3 ./test.py -f 2-query/cos.py -P -R
+python3 ./test.py -f 2-query/count_partition.py -P
+python3 ./test.py -f 2-query/count_partition.py -P -R
+python3 ./test.py -f 2-query/count.py -P
+python3 ./test.py -f 2-query/count.py -P -R
+python3 ./test.py -f 2-query/countAlwaysReturnValue.py -P
+python3 ./test.py -f 2-query/countAlwaysReturnValue.py -P -R
+python3 ./test.py -f 2-query/db.py -P
+python3 ./test.py -f 2-query/diff.py -P
+python3 ./test.py -f 2-query/diff.py -P -R
+python3 ./test.py -f 2-query/distinct.py -P
+python3 ./test.py -f 2-query/distinct.py -P -R
+python3 ./test.py -f 2-query/distribute_agg_apercentile.py -P
+python3 ./test.py -f 2-query/distribute_agg_apercentile.py -P -R
+python3 ./test.py -f 2-query/distribute_agg_avg.py -P
+python3 ./test.py -f 2-query/distribute_agg_avg.py -P -R
+python3 ./test.py -f 2-query/distribute_agg_count.py -P
+python3 ./test.py -f 2-query/distribute_agg_count.py -P -R
+python3 ./test.py -f 2-query/distribute_agg_max.py -P
+python3 ./test.py -f 2-query/distribute_agg_max.py -P -R
+python3 ./test.py -f 2-query/distribute_agg_min.py -P
+python3 ./test.py -f 2-query/distribute_agg_min.py -P -R
+python3 ./test.py -f 2-query/distribute_agg_spread.py -P
+python3 ./test.py -f 2-query/distribute_agg_spread.py -P -R
+python3 ./test.py -f 2-query/distribute_agg_stddev.py -P
+python3 ./test.py -f 2-query/distribute_agg_stddev.py -P -R
+python3 ./test.py -f 2-query/distribute_agg_sum.py -P
+python3 ./test.py -f 2-query/distribute_agg_sum.py -P -R
+python3 ./test.py -f 2-query/explain.py -P
+python3 ./test.py -f 2-query/explain.py -P -R
+python3 ./test.py -f 2-query/first.py -P
+python3 ./test.py -f 2-query/first.py -P -R
+python3 ./test.py -f 2-query/floor.py -P
+python3 ./test.py -f 2-query/floor.py -P -R
+python3 ./test.py -f 2-query/function_null.py -P
+python3 ./test.py -f 2-query/function_null.py -P -R
+python3 ./test.py -f 2-query/function_stateduration.py -P
+python3 ./test.py -f 2-query/function_stateduration.py -P -R
+python3 ./test.py -f 2-query/histogram.py -P
+python3 ./test.py -f 2-query/histogram.py -P -R
+python3 ./test.py -f 2-query/hyperloglog.py -P
+python3 ./test.py -f 2-query/hyperloglog.py -P -R
+python3 ./test.py -f 2-query/interp.py -P
+python3 ./test.py -f 2-query/interp.py -P -R
+python3 ./test.py -f 2-query/irate.py -P
+python3 ./test.py -f 2-query/irate.py -P -R
+python3 ./test.py -f 2-query/join.py -P
+python3 ./test.py -f 2-query/join.py -P -R
+python3 ./test.py -f 2-query/last_row.py -P
+python3 ./test.py -f 2-query/last_row.py -P -R
+python3 ./test.py -f 2-query/last.py -P
+python3 ./test.py -f 2-query/last.py -P -R
+python3 ./test.py -f 2-query/leastsquares.py -P
+python3 ./test.py -f 2-query/leastsquares.py -P -R
+python3 ./test.py -f 2-query/length.py -P
+python3 ./test.py -f 2-query/length.py -P -R
+python3 ./test.py -f 2-query/limit.py -P
+python3 ./test.py -f 2-query/log.py -P
+python3 ./test.py -f 2-query/log.py -P -R
+python3 ./test.py -f 2-query/lower.py -P
+python3 ./test.py -f 2-query/lower.py -P -R
+python3 ./test.py -f 2-query/ltrim.py -P
+python3 ./test.py -f 2-query/ltrim.py -P -R
+python3 ./test.py -f 2-query/mavg.py -P
+python3 ./test.py -f 2-query/mavg.py -P -R
+python3 ./test.py -f 2-query/max_partition.py -P
+python3 ./test.py -f 2-query/max_partition.py -P -R
+python3 ./test.py -f 2-query/max_min_last_interval.py -P
+python3 ./test.py -f 2-query/last_row_interval.py -P
+python3 ./test.py -f 2-query/max.py -P
+python3 ./test.py -f 2-query/max.py -P -R
+python3 ./test.py -f 2-query/min.py -P
+python3 ./test.py -f 2-query/min.py -P -R
+python3 ./test.py -f 2-query/mode.py -P
+python3 ./test.py -f 2-query/mode.py -P -R
+python3 ./test.py -f 2-query/Now.py -P
+python3 ./test.py -f 2-query/Now.py -P -R
+python3 ./test.py -f 2-query/percentile.py -P
+python3 ./test.py -f 2-query/percentile.py -P -R
+python3 ./test.py -f 2-query/pow.py -P
+python3 ./test.py -f 2-query/pow.py -P -R
+python3 ./test.py -f 2-query/query_cols_tags_and_or.py -P
+python3 ./test.py -f 2-query/query_cols_tags_and_or.py -P -R
+python3 ./test.py -f 2-query/round.py -P
+python3 ./test.py -f 2-query/round.py -P -R
+python3 ./test.py -f 2-query/rtrim.py -P
+python3 ./test.py -f 2-query/rtrim.py -P -R
+python3 ./test.py -f 1-insert/drop.py -P -N 3 -M 3 -i False -n 3
+python3 ./test.py -f 7-tmq/tmqUpdateWithConsume.py -P -N 3 -n 3
+python3 ./test.py -f 2-query/db.py -P -N 3 -n 3 -R
+python3 ./test.py -f 2-query/stablity.py -P
+python3 ./test.py -f 2-query/stablity_1.py -P
+python3 ./test.py -f 2-query/elapsed.py -P
+python3 ./test.py -f 2-query/csum.py -P
+python3 ./test.py -f 2-query/function_diff.py -P
+python3 ./test.py -f 2-query/tagFilter.py -P
+python3 ./test.py -f 2-query/projectionDesc.py -P
+python3 ./test.py -f 2-query/queryQnode.py -P
+python3 ./test.py -f 6-cluster/5dnode1mnode.py -P
+
+
+# -N 4
+echo " ********** -N 4 *************"
+python3 ./test.py -f 6-cluster/vnode/4dnode1mnode_basic_createDb_replica1.py -N 4 -M 1
+python3 ./test.py -f 6-cluster/vnode/4dnode1mnode_basic_replica1_insertdatas.py -P -N 4 -M 1
+python3 ./test.py -f 6-cluster/vnode/4dnode1mnode_basic_replica1_insertdatas_querys.py -P -N 4 -M 1
+python3 ./test.py -f 6-cluster/vnode/4dnode1mnode_basic_replica3_insertdatas.py -P -N 4 -M 1
+python3 ./test.py -f 6-cluster/vnode/4dnode1mnode_basic_replica3_insertdatas_querys.py -P -N 4 -M 1
+python3 ./test.py -f 6-cluster/vnode/4dnode1mnode_basic_replica3_vgroups.py -P -N 4 -M 1
+python3 ./test.py -f 2-query/varchar.py -P -R
+python3 ./test.py -f 2-query/case_when.py -P
+python3 ./test.py -f 2-query/case_when.py -P -R
+python3 ./test.py -f 2-query/blockSMA.py -P
+python3 ./test.py -f 2-query/blockSMA.py -P -R
+python3 ./test.py -f 2-query/projectionDesc.py -P
+python3 ./test.py -f 2-query/projectionDesc.py -P -R
+python3 ./test.py -f 1-insert/update_data.py -P
+python3 ./test.py -f 1-insert/tb_100w_data_order.py -P
+python3 ./test.py -f 1-insert/delete_childtable.py -P
+python3 ./test.py -f 1-insert/delete_normaltable.py -P
+python3 ./test.py -f 1-insert/keep_expired.py -P
+python3 ./test.py -f 1-insert/drop.py -P
+python3 ./test.py -f 2-query/join2.py -P
+python3 ./test.py -f 2-query/union1.py -P
+python3 ./test.py -f 2-query/concat2.py -P
+python3 ./test.py -f 2-query/json_tag.py -P
+python3 ./test.py -f 2-query/nestedQueryInterval.py -P
+
+
+# -N 5
+echo " ********** -N 5 *************"
+python3 ./test.py -f 6-cluster/5dnode2mnode.py -P -N 5
+python3 ./test.py -f 6-cluster/5dnode3mnodeStop.py -P -N 5 -M 3 -i False
+python3 ./test.py -f 6-cluster/5dnode3mnodeStop2Follower.py -P -N 5 -M 3
+python3 ./test.py -f 6-cluster/5dnode3mnodeStop2Follower.py -P -N 5 -M 3 -i False
+python3 ./test.py -f 6-cluster/5dnode3mnodeStopLoop.py -P -N 5 -M 3
+python3 ./test.py -f 6-cluster/5dnode3mnodeRecreateMnode.py -P -N 5 -M 3
+python3 ./test.py -f 6-cluster/5dnode3mnodeStopFollowerLeader.py -P -N 5 -M 3
+python3 ./test.py -f 6-cluster/5dnode3mnodeStop2Follower.py -P -N 5 -M 3
+python3 ./test.py -f 6-cluster/5dnode3mnodeStop.py -P -N 5 -M 3
+python3 ./test.py -f 0-others/taosdShell.py -P -N 5 -M 3 -Q 3
+python3 ./test.py -f 7-tmq/tmqSubscribeStb-r3.py -P -N 5
+python3 ./test.py -f 2-query/timezone.py -P
+python3 ./test.py -f 2-query/timezone.py -P -R
+python3 ./test.py -f 2-query/To_iso8601.py -P
+python3 ./test.py -f 2-query/To_iso8601.py -P -R
+python3 ./test.py -f 2-query/To_unixtimestamp.py -P
+python3 ./test.py -f 2-query/To_unixtimestamp.py -P -R
+python3 ./test.py -f 2-query/Today.py -P
+python3 ./test.py -f 2-query/Today.py -P -R
+python3 ./test.py -f 2-query/top.py -P
+python3 ./test.py -f 2-query/top.py -P -R
+python3 ./test.py -f 2-query/tsbsQuery.py -P
+python3 ./test.py -f 2-query/tsbsQuery.py -P -R
+python3 ./test.py -f 2-query/ttl_comment.py -P
+python3 ./test.py -f 2-query/ttl_comment.py -P -R
+python3 ./test.py -f 2-query/twa.py -P
+python3 ./test.py -f 2-query/twa.py -P -R
+python3 ./test.py -f 2-query/union.py -P
+python3 ./test.py -f 2-query/union.py -P -R
+python3 ./test.py -f 2-query/unique.py -P
+python3 ./test.py -f 2-query/unique.py -P -R
+python3 ./test.py -f 2-query/upper.py -P
+python3 ./test.py -f 2-query/upper.py -P -R
+python3 ./test.py -f 2-query/varchar.py -P
+
+# -N6
+echo " ********** -N 6 *************"
+python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopDnodeCreateDb.py -N 6 -M 3
+python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopDnodeCreateDb.py -P -N 6 -M 3 -n 3
+python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopMnodeCreateDb.py -P -N 6 -M 3
+python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopMnodeCreateDb.py -P -N 6 -M 3 -n 3
+python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopVnodeCreateDb.py -P -N 6 -M 3
+python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopVnodeCreateDb.py -P -N 6 -M 3 -n 3
+python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopDnodeModifyMeta.py -P -N 6 -M 3
+python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopMnodeModifyMeta.py -P -N 6 -M 3
+python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopDnodeCreateStb.py -P -N 6 -M 3
+python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopDnodeCreateStb.py -P -N 6 -M 3 -n 3
+python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopMnodeCreateStb.py -P -N 6 -M 3
+python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopMnodeCreateStb.py -P -N 6 -M 3 -n 3
+python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopVnodeCreateStb.py -P -N 6 -M 3
+python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopVnodeCreateStb.py -P -N 6 -M 3 -n 3
+python3 ./test.py -f 6-cluster/5dnode3mnodeRestartDnodeInsertData.py -P -N 6 -M 3
+python3 ./test.py -f 6-cluster/5dnode3mnodeRestartDnodeInsertData.py -P -N 6 -M 3 -n 3
+python3 ./test.py -f 6-cluster/5dnode3mnodeRestartDnodeInsertDataAsync.py -P -N 6 -M 3
+python3 ./test.py -f 6-cluster/5dnode3mnodeRestartDnodeInsertDataAsync.py -P -N 6 -M 3 -n 3
+python3 ./test.py -f 7-tmq/tmq3mnodeSwitch.py -P -N 6 -M 3
+python3 ./test.py -f 7-tmq/tmq3mnodeSwitch.py -P -N 6 -M 3 -n 3
+python3 ./test.py -f 0-others/balance_vgroups_r1.py -P -N 6
+
+python3 ./test.py -f 2-query/sample.py -P
+python3 ./test.py -f 2-query/sample.py -P -R
+python3 ./test.py -f 2-query/sin.py -P
+python3 ./test.py -f 2-query/sin.py -P -R
+python3 ./test.py -f 2-query/smaTest.py -P
+python3 ./test.py -f 2-query/smaTest.py -P -R
+python3 ./test.py -f 2-query/sml.py -P
+python3 ./test.py -f 2-query/sml.py -P -R
+python3 ./test.py -f 2-query/spread.py -P
+python3 ./test.py -f 2-query/spread.py -P -R
+python3 ./test.py -f 2-query/sqrt.py -P
+python3 ./test.py -f 2-query/sqrt.py -P -R
+python3 ./test.py -f 2-query/statecount.py -P
+python3 ./test.py -f 2-query/statecount.py -P -R
+python3 ./test.py -f 2-query/stateduration.py -P
+python3 ./test.py -f 2-query/stateduration.py -P -R
+python3 ./test.py -f 2-query/substr.py -P
+python3 ./test.py -f 2-query/substr.py -P -R
+python3 ./test.py -f 2-query/sum.py -P
+python3 ./test.py -f 2-query/sum.py -P -R
+python3 ./test.py -f 2-query/tail.py -P
+python3 ./test.py -f 2-query/tail.py -P -R
+python3 ./test.py -f 2-query/tan.py -P
+python3 ./test.py -f 2-query/tan.py -P -R
+python3 ./test.py -f 2-query/Timediff.py -P
+python3 ./test.py -f 2-query/Timediff.py -P -R
+python3 ./test.py -f 2-query/timetruncate.py -P
+python3 ./test.py -f 2-query/timetruncate.py -P -R
+
+# N-7
+echo " ********** -N 7 *************"
+python3 ./test.py -f 6-cluster/5dnode3mnodeAdd1Ddnoe.py -N 7 -M 3 -C 6
+python3 ./test.py -f 6-cluster/5dnode3mnodeAdd1Ddnoe.py -P -N 7 -M 3 -C 6 -n 3
+
+python3 ./test.py -f 2-query/between.py -P -Q 2
+python3 ./test.py -f 2-query/distinct.py -P -Q 2
+python3 ./test.py -f 2-query/varchar.py -P -Q 2
+python3 ./test.py -f 2-query/ltrim.py -P -Q 2
+python3 ./test.py -f 2-query/rtrim.py -P -Q 2
+python3 ./test.py -f 2-query/length.py -P -Q 2
+python3 ./test.py -f 2-query/char_length.py -P -Q 2
+python3 ./test.py -f 2-query/upper.py -P -Q 2
+python3 ./test.py -f 2-query/lower.py -P -Q 2
+python3 ./test.py -f 2-query/join.py -P -Q 2
+python3 ./test.py -f 2-query/join2.py -P -Q 2
+python3 ./test.py -f 2-query/cast.py -P -Q 2
+python3 ./test.py -f 2-query/substr.py -P -Q 2
+python3 ./test.py -f 2-query/union.py -P -Q 2
+python3 ./test.py -f 2-query/union1.py -P -Q 2
+python3 ./test.py -f 2-query/concat.py -P -Q 2
+python3 ./test.py -f 2-query/concat2.py -P -Q 2
+python3 ./test.py -f 2-query/concat_ws.py -P -Q 2
+python3 ./test.py -f 2-query/concat_ws2.py -P -Q 2
+python3 ./test.py -f 2-query/check_tsdb.py -P -Q 2
+python3 ./test.py -f 2-query/spread.py -P -Q 2
+python3 ./test.py -f 2-query/hyperloglog.py -P -Q 2
+python3 ./test.py -f 2-query/explain.py -P -Q 2
+python3 ./test.py -f 2-query/leastsquares.py -P -Q 2
+python3 ./test.py -f 2-query/timezone.py -P -Q 2
+python3 ./test.py -f 2-query/Now.py -P -Q 2
+python3 ./test.py -f 2-query/Today.py -P -Q 2
+python3 ./test.py -f 2-query/max.py -P -Q 2
+python3 ./test.py -f 2-query/min.py -P -Q 2
+python3 ./test.py -f 2-query/mode.py -P -Q 2
+python3 ./test.py -f 2-query/count.py -P -Q 2
+python3 ./test.py -f 2-query/countAlwaysReturnValue.py -P -Q 2
+python3 ./test.py -f 2-query/last.py -P -Q 2
+python3 ./test.py -f 2-query/first.py -P -Q 2
+python3 ./test.py -f 2-query/To_iso8601.py -P -Q 2
+python3 ./test.py -f 2-query/To_unixtimestamp.py -P -Q 2
+python3 ./test.py -f 2-query/timetruncate.py -P -Q 2
+python3 ./test.py -f 2-query/diff.py -P -Q 2
+python3 ./test.py -f 2-query/Timediff.py -P -Q 2
+python3 ./test.py -f 2-query/json_tag.py -P -Q 2
+python3 ./test.py -f 2-query/top.py -P -Q 2
+python3 ./test.py -f 2-query/bottom.py -P -Q 2
+python3 ./test.py -f 2-query/percentile.py -P -Q 2
+python3 ./test.py -f 2-query/apercentile.py -P -Q 2
+python3 ./test.py -f 2-query/abs.py -P -Q 2
+python3 ./test.py -f 2-query/ceil.py -P -Q 2
+python3 ./test.py -f 2-query/floor.py -P -Q 2
+python3 ./test.py -f 2-query/round.py -P -Q 2
+python3 ./test.py -f 2-query/log.py -P -Q 2
+python3 ./test.py -f 2-query/pow.py -P -Q 2
+python3 ./test.py -f 2-query/sqrt.py -P -Q 2
+python3 ./test.py -f 2-query/sin.py -P -Q 2
+python3 ./test.py -f 2-query/cos.py -P -Q 2
+python3 ./test.py -f 2-query/tan.py -P -Q 2
+python3 ./test.py -f 2-query/arcsin.py -P -Q 2
+python3 ./test.py -f 2-query/arccos.py -P -Q 2
+python3 ./test.py -f 2-query/arctan.py -P -Q 2
+python3 ./test.py -f 2-query/query_cols_tags_and_or.py -P -Q 2
+python3 ./test.py -f 2-query/interp.py -P -Q 2
+python3 ./test.py -f 2-query/nestedQueryInterval.py -P -Q 2
+python3 ./test.py -f 2-query/stablity.py -P -Q 2
+python3 ./test.py -f 2-query/stablity_1.py -P -Q 2
+python3 ./test.py -f 2-query/avg.py -P -Q 2
+python3 ./test.py -f 2-query/elapsed.py -P -Q 2
+python3 ./test.py -f 2-query/csum.py -P -Q 2
+python3 ./test.py -f 2-query/mavg.py -P -Q 2
+python3 ./test.py -f 2-query/sample.py -P -Q 2
+python3 ./test.py -f 2-query/function_diff.py -P -Q 2
+python3 ./test.py -f 2-query/unique.py -P -Q 2
+python3 ./test.py -f 2-query/stateduration.py -P -Q 2
+python3 ./test.py -f 2-query/function_stateduration.py -P -Q 2
+python3 ./test.py -f 2-query/statecount.py -P -Q 2
+python3 ./test.py -f 2-query/tail.py -P -Q 2
+python3 ./test.py -f 2-query/ttl_comment.py -P -Q 2
+python3 ./test.py -f 2-query/distribute_agg_count.py -P -Q 2
+python3 ./test.py -f 2-query/distribute_agg_max.py -P -Q 2
+python3 ./test.py -f 2-query/distribute_agg_min.py -P -Q 2
+python3 ./test.py -f 2-query/distribute_agg_sum.py -P -Q 2
+python3 ./test.py -f 2-query/distribute_agg_spread.py -P -Q 2
+python3 ./test.py -f 2-query/distribute_agg_apercentile.py -P -Q 2
+python3 ./test.py -f 2-query/distribute_agg_avg.py -P -Q 2
+python3 ./test.py -f 2-query/distribute_agg_stddev.py -P -Q 2
+python3 ./test.py -f 2-query/twa.py -P -Q 2
+python3 ./test.py -f 2-query/irate.py -P -Q 2
+python3 ./test.py -f 2-query/function_null.py -P -Q 2
+python3 ./test.py -f 2-query/count_partition.py -P -Q 2
+python3 ./test.py -f 2-query/max_partition.py -P -Q 2
+python3 ./test.py -f 2-query/max_min_last_interval.py -P -Q 2
+python3 ./test.py -f 2-query/last_row_interval.py -P -Q 2
+python3 ./test.py -f 2-query/last_row.py -P -Q 2
+python3 ./test.py -f 2-query/tsbsQuery.py -P -Q 2
+python3 ./test.py -f 2-query/sml.py -P -Q 2
+python3 ./test.py -f 2-query/case_when.py -P -Q 2
+python3 ./test.py -f 2-query/blockSMA.py -P -Q 2
+python3 ./test.py -f 2-query/projectionDesc.py -P -Q 2
+python3 ./test.py -f 99-TDcase/TD-21561.py -P -Q 2
+
+python3 ./test.py -f 2-query/between.py -P -Q 3
+python3 ./test.py -f 2-query/distinct.py -P -Q 3
+python3 ./test.py -f 2-query/varchar.py -P -Q 3
+python3 ./test.py -f 2-query/ltrim.py -P -Q 3
+python3 ./test.py -f 2-query/rtrim.py -P -Q 3
+python3 ./test.py -f 2-query/length.py -P -Q 3
+python3 ./test.py -f 2-query/char_length.py -P -Q 3
+python3 ./test.py -f 2-query/upper.py -P -Q 3
+python3 ./test.py -f 2-query/lower.py -P -Q 3
+python3 ./test.py -f 2-query/join.py -P -Q 3
+python3 ./test.py -f 2-query/join2.py -P -Q 3
+python3 ./test.py -f 2-query/cast.py -P -Q 3
+python3 ./test.py -f 2-query/substr.py -P -Q 3
+python3 ./test.py -f 2-query/union.py -P -Q 3
+python3 ./test.py -f 2-query/union1.py -P -Q 3
+python3 ./test.py -f 2-query/concat2.py -P -Q 3
+python3 ./test.py -f 2-query/concat_ws.py -P -Q 3
+python3 ./test.py -f 2-query/concat_ws2.py -P -Q 3
+python3 ./test.py -f 2-query/check_tsdb.py -P -Q 3
+python3 ./test.py -f 2-query/spread.py -P -Q 3
+python3 ./test.py -f 2-query/hyperloglog.py -P -Q 3
+python3 ./test.py -f 2-query/explain.py -P -Q 3
+python3 ./test.py -f 2-query/leastsquares.py -P -Q 3
+python3 ./test.py -f 2-query/timezone.py -P -Q 3
+python3 ./test.py -f 2-query/Now.py -P -Q 3
+python3 ./test.py -f 2-query/Today.py -P -Q 3
+python3 ./test.py -f 2-query/max.py -P -Q 3
+python3 ./test.py -f 2-query/min.py -P -Q 3
+python3 ./test.py -f 2-query/mode.py -P -Q 3
+python3 ./test.py -f 2-query/count.py -P -Q 3
+python3 ./test.py -f 2-query/countAlwaysReturnValue.py -P -Q 3
+python3 ./test.py -f 2-query/last.py -P -Q 3
+python3 ./test.py -f 2-query/first.py -P -Q 3
+python3 ./test.py -f 2-query/To_iso8601.py -P -Q 3
+python3 ./test.py -f 2-query/To_unixtimestamp.py -P -Q 3
+python3 ./test.py -f 2-query/timetruncate.py -P -Q 3
+python3 ./test.py -f 2-query/diff.py -P -Q 3
+python3 ./test.py -f 2-query/Timediff.py -P -Q 3
+python3 ./test.py -f 2-query/json_tag.py -P -Q 3
+python3 ./test.py -f 2-query/top.py -P -Q 3
+python3 ./test.py -f 2-query/bottom.py -P -Q 3
+python3 ./test.py -f 2-query/percentile.py -P -Q 3
+python3 ./test.py -f 2-query/apercentile.py -P -Q 3
+python3 ./test.py -f 2-query/abs.py -P -Q 3
+python3 ./test.py -f 2-query/ceil.py -P -Q 3
+python3 ./test.py -f 2-query/floor.py -P -Q 3
+python3 ./test.py -f 2-query/round.py -P -Q 3
+python3 ./test.py -f 2-query/log.py -P -Q 3
+python3 ./test.py -f 2-query/pow.py -P -Q 3
+python3 ./test.py -f 2-query/sqrt.py -P -Q 3
+python3 ./test.py -f 2-query/sin.py -P -Q 3
+python3 ./test.py -f 2-query/cos.py -P -Q 3
+python3 ./test.py -f 2-query/tan.py -P -Q 3
+python3 ./test.py -f 2-query/arcsin.py -P -Q 3
+python3 ./test.py -f 2-query/arccos.py -P -Q 3
+python3 ./test.py -f 2-query/arctan.py -P -Q 3
+python3 ./test.py -f 2-query/query_cols_tags_and_or.py -P -Q 3
+python3 ./test.py -f 2-query/nestedQueryInterval.py -P -Q 3
+python3 ./test.py -f 2-query/stablity.py -P -Q 3
+python3 ./test.py -f 2-query/stablity_1.py -P -Q 3
+python3 ./test.py -f 2-query/avg.py -P -Q 3
+python3 ./test.py -f 2-query/elapsed.py -P -Q 3
+python3 ./test.py -f 2-query/csum.py -P -Q 3
+python3 ./test.py -f 2-query/mavg.py -P -Q 3
+python3 ./test.py -f 2-query/sample.py -P -Q 3
+python3 ./test.py -f 2-query/function_diff.py -P -Q 3
+python3 ./test.py -f 2-query/unique.py -P -Q 3
+python3 ./test.py -f 2-query/stateduration.py -P -Q 3
+python3 ./test.py -f 2-query/function_stateduration.py -P -Q 3
+python3 ./test.py -f 2-query/statecount.py -P -Q 3
+python3 ./test.py -f 2-query/tail.py -P -Q 3
+python3 ./test.py -f 2-query/ttl_comment.py -P -Q 3
+python3 ./test.py -f 2-query/distribute_agg_count.py -P -Q 3
+python3 ./test.py -f 2-query/distribute_agg_max.py -P -Q 3
+python3 ./test.py -f 2-query/distribute_agg_min.py -P -Q 3
+python3 ./test.py -f 2-query/distribute_agg_sum.py -P -Q 3
+python3 ./test.py -f 2-query/distribute_agg_spread.py -P -Q 3
+python3 ./test.py -f 2-query/distribute_agg_apercentile.py -P -Q 3
+python3 ./test.py -f 2-query/distribute_agg_avg.py -P -Q 3
+python3 ./test.py -f 2-query/distribute_agg_stddev.py -P -Q 3
+python3 ./test.py -f 2-query/twa.py -P -Q 3
+python3 ./test.py -f 2-query/irate.py -P -Q 3
+python3 ./test.py -f 2-query/function_null.py -P -Q 3
+python3 ./test.py -f 2-query/count_partition.py -P -Q 3
+python3 ./test.py -f 2-query/max_partition.py -P -Q 3
+python3 ./test.py -f 2-query/max_min_last_interval.py -P -Q 3
+python3 ./test.py -f 2-query/last_row_interval.py -P -Q 3
+python3 ./test.py -f 2-query/last_row.py -P -Q 3
+python3 ./test.py -f 2-query/tsbsQuery.py -P -Q 3
+python3 ./test.py -f 2-query/sml.py -P -Q 3
+python3 ./test.py -f 2-query/interp.py -P -Q 3
+python3 ./test.py -f 2-query/case_when.py -P -Q 3
+python3 ./test.py -f 2-query/blockSMA.py -P -Q 3
+python3 ./test.py -f 2-query/projectionDesc.py -P -Q 3
+python3 ./test.py -f 99-TDcase/TD-21561.py -P -Q 3
+python3 ./test.py -f 2-query/between.py -P -Q 4
+python3 ./test.py -f 2-query/distinct.py -P -Q 4
+python3 ./test.py -f 2-query/varchar.py -P -Q 4
+python3 ./test.py -f 2-query/ltrim.py -P -Q 4
+python3 ./test.py -f 2-query/rtrim.py -P -Q 4
+python3 ./test.py -f 2-query/length.py -P -Q 4
+python3 ./test.py -f 2-query/char_length.py -P -Q 4
+python3 ./test.py -f 2-query/upper.py -P -Q 4
+python3 ./test.py -f 2-query/lower.py -P -Q 4
+python3 ./test.py -f 2-query/join.py -P -Q 4
+python3 ./test.py -f 2-query/join2.py -P -Q 4
+python3 ./test.py -f 2-query/substr.py -P -Q 4
+python3 ./test.py -f 2-query/union.py -P -Q 4
+python3 ./test.py -f 2-query/union1.py -P -Q 4
+python3 ./test.py -f 2-query/concat.py -P -Q 4
+python3 ./test.py -f 2-query/concat2.py -P -Q 4
+python3 ./test.py -f 2-query/concat_ws.py -P -Q 4
+python3 ./test.py -f 2-query/concat_ws2.py -P -Q 4
+python3 ./test.py -f 2-query/check_tsdb.py -P -Q 4
+python3 ./test.py -f 2-query/spread.py -P -Q 4
+python3 ./test.py -f 2-query/hyperloglog.py -P -Q 4
+python3 ./test.py -f 2-query/explain.py -P -Q 4
+python3 ./test.py -f 2-query/leastsquares.py -P -Q 4
+python3 ./test.py -f 2-query/timezone.py -P -Q 4
+python3 ./test.py -f 2-query/Now.py -P -Q 4
+python3 ./test.py -f 2-query/Today.py -P -Q 4
+python3 ./test.py -f 2-query/max.py -P -Q 4
+python3 ./test.py -f 2-query/min.py -P -Q 4
+python3 ./test.py -f 2-query/mode.py -P -Q 4
+python3 ./test.py -f 2-query/count.py -P -Q 4
+python3 ./test.py -f 2-query/countAlwaysReturnValue.py -P -Q 4
+python3 ./test.py -f 2-query/last.py -P -Q 4
+python3 ./test.py -f 2-query/first.py -P -Q 4
+python3 ./test.py -f 2-query/To_iso8601.py -P -Q 4
+python3 ./test.py -f 2-query/To_unixtimestamp.py -P -Q 4
+python3 ./test.py -f 2-query/timetruncate.py -P -Q 4
+python3 ./test.py -f 2-query/diff.py -P -Q 4
+python3 ./test.py -f 2-query/Timediff.py -P -Q 4
+python3 ./test.py -f 2-query/json_tag.py -P -Q 4
+python3 ./test.py -f 2-query/top.py -P -Q 4
+python3 ./test.py -f 2-query/bottom.py -P -Q 4
+python3 ./test.py -f 2-query/percentile.py -P -Q 4
+python3 ./test.py -f 2-query/apercentile.py -P -Q 4
+python3 ./test.py -f 2-query/abs.py -P -Q 4
+python3 ./test.py -f 2-query/ceil.py -P -Q 4
+python3 ./test.py -f 2-query/floor.py -P -Q 4
+python3 ./test.py -f 2-query/round.py -P -Q 4
+python3 ./test.py -f 2-query/log.py -P -Q 4
+python3 ./test.py -f 2-query/pow.py -P -Q 4
+python3 ./test.py -f 2-query/sqrt.py -P -Q 4
+python3 ./test.py -f 2-query/sin.py -P -Q 4
+python3 ./test.py -f 2-query/cos.py -P -Q 4
+python3 ./test.py -f 2-query/tan.py -P -Q 4
+python3 ./test.py -f 2-query/arcsin.py -P -Q 4
+python3 ./test.py -f 2-query/arccos.py -P -Q 4
+python3 ./test.py -f 2-query/arctan.py -P -Q 4
+python3 ./test.py -f 2-query/query_cols_tags_and_or.py -P -Q 4
+python3 ./test.py -f 2-query/nestedQueryInterval.py -P -Q 4
+python3 ./test.py -f 2-query/stablity.py -P -Q 4
+python3 ./test.py -f 2-query/stablity_1.py -P -Q 4
+python3 ./test.py -f 2-query/avg.py -P -Q 4
+python3 ./test.py -f 2-query/elapsed.py -P -Q 4
+python3 ./test.py -f 2-query/csum.py -P -Q 4
+python3 ./test.py -f 2-query/mavg.py -P -Q 4
+python3 ./test.py -f 2-query/sample.py -P -Q 4
+python3 ./test.py -f 2-query/cast.py -P -Q 4
+python3 ./test.py -f 2-query/function_diff.py -P -Q 4
+python3 ./test.py -f 2-query/unique.py -P -Q 4
+python3 ./test.py -f 2-query/stateduration.py -P -Q 4
+python3 ./test.py -f 2-query/function_stateduration.py -P -Q 4
+python3 ./test.py -f 2-query/statecount.py -P -Q 4
+python3 ./test.py -f 2-query/tail.py -P -Q 4
+python3 ./test.py -f 2-query/ttl_comment.py -P -Q 4
+python3 ./test.py -f 2-query/distribute_agg_count.py -P -Q 4
+python3 ./test.py -f 2-query/distribute_agg_max.py -P -Q 4
+python3 ./test.py -f 2-query/distribute_agg_min.py -P -Q 4
+python3 ./test.py -f 2-query/distribute_agg_sum.py -P -Q 4
+python3 ./test.py -f 2-query/distribute_agg_spread.py -P -Q 4
+python3 ./test.py -f 2-query/distribute_agg_apercentile.py -P -Q 4
+python3 ./test.py -f 2-query/distribute_agg_avg.py -P -Q 4
+python3 ./test.py -f 2-query/distribute_agg_stddev.py -P -Q 4
+python3 ./test.py -f 2-query/twa.py -P -Q 4
+python3 ./test.py -f 2-query/irate.py -P -Q 4
+python3 ./test.py -f 2-query/function_null.py -P -Q 4
+python3 ./test.py -f 2-query/count_partition.py -P -Q 4
+python3 ./test.py -f 2-query/max_partition.py -P -Q 4
+python3 ./test.py -f 2-query/max_min_last_interval.py -P -Q 4
+python3 ./test.py -f 2-query/last_row_interval.py -P -Q 4
+python3 ./test.py -f 2-query/last_row.py -P -Q 4
+python3 ./test.py -f 2-query/tsbsQuery.py -P -Q 4
+python3 ./test.py -f 2-query/sml.py -P -Q 4
+python3 ./test.py -f 2-query/interp.py -P -Q 4
+python3 ./test.py -f 2-query/case_when.py -P -Q 4
+python3 ./test.py -f 2-query/insert_select.py -P
+python3 ./test.py -f 2-query/insert_select.py -P -R
+python3 ./test.py -f 2-query/insert_select.py -P -Q 2
+python3 ./test.py -f 2-query/insert_select.py -P -Q 3
+python3 ./test.py -f 2-query/insert_select.py -P -Q 4
+python3 ./test.py -f 2-query/out_of_order.py -P -R
+python3 ./test.py -f 2-query/blockSMA.py -P -Q 4
+python3 ./test.py -f 2-query/projectionDesc.py -P -Q 4
+python3 ./test.py -f 2-query/odbc.py -P
+python3 ./test.py -f 99-TDcase/TD-21561.py -P -Q 4
+python3 ./test.py -f 99-TDcase/TD-20582.py -P
\ No newline at end of file
diff --git a/tests/system-test/test.py b/tests/system-test/test.py
index bc7f1d9861..7082bb0f22 100644
--- a/tests/system-test/test.py
+++ b/tests/system-test/test.py
@@ -13,6 +13,7 @@
# pip install src/connector/python/
# -*- coding: utf-8 -*-
+import os
import sys
import getopt
import subprocess
@@ -22,6 +23,7 @@ import json
import platform
import socket
import threading
+import importlib
import toml
sys.path.append("../pytest")
@@ -53,8 +55,39 @@ def checkRunTimeError():
if hwnd:
os.system("TASKKILL /F /IM taosd.exe")
+#
+# run case on previous cluster
+#
+def runOnPreviousCluster(host, config, fileName):
+ print("enter run on previeous")
+
+ # load case module
+ sep = "/"
+ if platform.system().lower() == 'windows':
+ sep = os.sep
+ moduleName = fileName.replace(".py", "").replace(sep, ".")
+ uModule = importlib.import_module(moduleName)
+ case = uModule.TDTestCase()
+
+ # create conn
+ conn = taos.connect(host, config)
+
+ # run case
+ case.init(conn, False)
+ try:
+ case.run()
+ except Exception as e:
+ tdLog.notice(repr(e))
+ tdLog.exit("%s failed" % (fileName))
+ # stop
+ case.stop()
+
+
if __name__ == "__main__":
+ #
+ # analysis paramaters
+ #
fileName = "all"
deployPath = ""
masterIp = ""
@@ -75,8 +108,9 @@ if __name__ == "__main__":
replicaVar = 1
asan = False
independentMnode = True
- opts, args = getopt.gnu_getopt(sys.argv[1:], 'f:p:m:l:scghrd:k:e:N:M:Q:C:RD:n:i:a', [
- 'file=', 'path=', 'master', 'logSql', 'stop', 'cluster', 'valgrind', 'help', 'restart', 'updateCfgDict', 'killv', 'execCmd','dnodeNums','mnodeNums','queryPolicy','createDnodeNums','restful','adaptercfgupdate','replicaVar','independentMnode'])
+ previousCluster = False
+ opts, args = getopt.gnu_getopt(sys.argv[1:], 'f:p:m:l:scghrd:k:e:N:M:Q:C:RD:n:i:aP', [
+ 'file=', 'path=', 'master', 'logSql', 'stop', 'cluster', 'valgrind', 'help', 'restart', 'updateCfgDict', 'killv', 'execCmd','dnodeNums','mnodeNums','queryPolicy','createDnodeNums','restful','adaptercfgupdate','replicaVar','independentMnode','previous'])
for key, value in opts:
if key in ['-h', '--help']:
tdLog.printNoPrefix(
@@ -101,6 +135,7 @@ if __name__ == "__main__":
tdLog.printNoPrefix('-n the number of replicas')
tdLog.printNoPrefix('-i independentMnode Mnode')
tdLog.printNoPrefix('-a address sanitizer mode')
+ tdLog.printNoPrefix('-P run case with [P]revious cluster, do not create new cluster to run case.')
sys.exit(0)
@@ -182,6 +217,12 @@ if __name__ == "__main__":
if key in ['-n', '--replicaVar']:
replicaVar = value
+ if key in ['-P', '--previous']:
+ previousCluster = True
+
+ #
+ # do exeCmd command
+ #
if not execCmd == "":
if restful:
tAdapter.init(deployPath)
@@ -191,6 +232,9 @@ if __name__ == "__main__":
exec(execCmd)
quit()
+ #
+ # do stop option
+ #
if (stop != 0):
if (valgrind == 0):
toBeKilled = "taosd"
@@ -248,6 +292,9 @@ if __name__ == "__main__":
tdLog.info('stop All dnodes')
+ #
+ # get hostname
+ #
if masterIp == "":
host = socket.gethostname()
else:
@@ -256,8 +303,20 @@ if __name__ == "__main__":
host = config["host"]
except Exception as r:
host = masterIp
-
tdLog.info("Procedures for tdengine deployed in %s" % (host))
+
+ #
+ # do previousCluster option
+ #
+ if previousCluster:
+ tdDnodes.init(deployPath, masterIp)
+ runOnPreviousCluster(host, tdDnodes.getSimCfgPath(), fileName)
+ tdLog.info("run on previous cluster end.")
+ quit()
+
+ #
+ # windows run
+ #
if platform.system().lower() == 'windows':
fileName = fileName.replace("/", os.sep)
if (masterIp == "" and not fileName == "0-others\\udf_create.py"):
@@ -451,6 +510,7 @@ if __name__ == "__main__":
tAdapter.stop(force_kill=True)
if dnodeNums == 1 :
+ # dnode is one
tdDnodes.deploy(1,updateCfgDict)
tdDnodes.start(1)
tdCases.logSql(logSql)
@@ -491,6 +551,7 @@ if __name__ == "__main__":
tdLog.exit(f"alter queryPolicy to {queryPolicy} failed")
else :
+ # dnode > 1 cluster
tdLog.debug("create an cluster with %s nodes and make %s dnode as independent mnode"%(dnodeNums,mnodeNums))
dnodeslist = cluster.configure_cluster(dnodeNums=dnodeNums, mnodeNums=mnodeNums, independentMnode=independentMnode)
tdDnodes = ClusterDnodes(dnodeslist)
@@ -509,6 +570,7 @@ if __name__ == "__main__":
tAdapter.deploy(adapter_cfg_dict)
tAdapter.start()
+ # create taos connect
if not restful:
conn = taos.connect(host,config=tdDnodes.getSimCfgPath())
else:
@@ -527,6 +589,7 @@ if __name__ == "__main__":
except Exception as r:
print(r)
+ # do queryPolicy option
if queryPolicy != 1:
queryPolicy=int(queryPolicy)
if restful:
@@ -548,6 +611,7 @@ if __name__ == "__main__":
tdLog.exit(f"alter queryPolicy to {queryPolicy} failed")
+ # run case
if testCluster:
tdLog.info("Procedures for testing cluster")
if fileName == "all":
@@ -566,6 +630,7 @@ if __name__ == "__main__":
else:
tdCases.runOneLinux(conn, fileName, replicaVar)
+ # do restart option
if restart:
if fileName == "all":
tdLog.info("not need to query ")
@@ -585,6 +650,7 @@ if __name__ == "__main__":
else:
tdLog.info("not need to query")
+ # close for end
if conn is not None:
conn.close()
if asan:
diff --git a/tools/shell/src/shellArguments.c b/tools/shell/src/shellArguments.c
index 0f5585991e..52cb524e3b 100644
--- a/tools/shell/src/shellArguments.c
+++ b/tools/shell/src/shellArguments.c
@@ -20,18 +20,6 @@
#include "shellInt.h"
#include "version.h"
-#ifndef CUS_NAME
-char cusName[] = "TDengine";
-#endif
-
-#ifndef CUS_PROMPT
-char cusPrompt[] = "taos";
-#endif
-
-#ifndef CUS_EMAIL
-char cusEmail[] = "";
-#endif
-
#if defined(CUS_NAME) || defined(CUS_PROMPT) || defined(CUS_EMAIL)
#include "cus_name.h"
#endif
@@ -255,8 +243,8 @@ int32_t shellParseArgsWithoutArgp(int argc, char *argv[]) {
SShellArgs *pArgs = &shell.args;
for (int i = 1; i < argc; i++) {
- if (strcmp(argv[i], "--help") == 0 || strcmp(argv[i], "--usage") == 0 || strcmp(argv[i], "-?") == 0 ||
- strcmp(argv[i], "/?") == 0) {
+ if (strcmp(argv[i], "--help") == 0 || strcmp(argv[i], "--usage") == 0
+ || strcmp(argv[i], "-?") == 0 || strcmp(argv[i], "/?") == 0) {
shellParseSingleOpt('?', NULL);
return 0;
}
@@ -272,8 +260,10 @@ int32_t shellParseArgsWithoutArgp(int argc, char *argv[]) {
return -1;
}
- if (key[1] == 'h' || key[1] == 'P' || key[1] == 'u' || key[1] == 'a' || key[1] == 'c' || key[1] == 's' ||
- key[1] == 'f' || key[1] == 'd' || key[1] == 'w' || key[1] == 'n' || key[1] == 'l' || key[1] == 'N'
+ if (key[1] == 'h' || key[1] == 'P' || key[1] == 'u'
+ || key[1] == 'a' || key[1] == 'c' || key[1] == 's'
+ || key[1] == 'f' || key[1] == 'd' || key[1] == 'w'
+ || key[1] == 'n' || key[1] == 'l' || key[1] == 'N'
#ifdef WEBSOCKET
|| key[1] == 'E' || key[1] == 'T'
#endif
@@ -289,10 +279,12 @@ int32_t shellParseArgsWithoutArgp(int argc, char *argv[]) {
}
shellParseSingleOpt(key[1], val);
i++;
- } else if (key[1] == 'p' || key[1] == 'A' || key[1] == 'C' || key[1] == 'r' || key[1] == 'k' || key[1] == 't' ||
- key[1] == 'V' || key[1] == '?' || key[1] == 1
+ } else if (key[1] == 'p' || key[1] == 'A' || key[1] == 'C'
+ || key[1] == 'r' || key[1] == 'k'
+ || key[1] == 't' || key[1] == 'V'
+ || key[1] == '?' || key[1] == 1
#ifdef WEBSOCKET
- || key[1] == 'R'
+ ||key[1] == 'R'
#endif
) {
shellParseSingleOpt(key[1], NULL);
diff --git a/tools/shell/src/shellEngine.c b/tools/shell/src/shellEngine.c
index 70130397ba..01ca2efaba 100644
--- a/tools/shell/src/shellEngine.c
+++ b/tools/shell/src/shellEngine.c
@@ -317,7 +317,6 @@ void shellDumpFieldToFile(TdFilePtr pFile, const char *val, TAOS_FIELD *field, i
quotationStr[0] = '\"';
quotationStr[1] = 0;
- int n;
char buf[TSDB_MAX_BYTES_PER_ROW];
switch (field->type) {
case TSDB_DATA_TYPE_BOOL:
@@ -348,15 +347,11 @@ void shellDumpFieldToFile(TdFilePtr pFile, const char *val, TAOS_FIELD *field, i
taosFprintfFile(pFile, "%" PRIu64, *((uint64_t *)val));
break;
case TSDB_DATA_TYPE_FLOAT:
- taosFprintfFile(pFile, "%.5f", GET_FLOAT_VAL(val));
+ taosFprintfFile(pFile, "%e", GET_FLOAT_VAL(val));
break;
case TSDB_DATA_TYPE_DOUBLE:
- n = snprintf(buf, TSDB_MAX_BYTES_PER_ROW, "%*.9f", length, GET_DOUBLE_VAL(val));
- if (n > TMAX(25, length)) {
- taosFprintfFile(pFile, "%*.15e", length, GET_DOUBLE_VAL(val));
- } else {
- taosFprintfFile(pFile, "%s", buf);
- }
+ snprintf(buf, TSDB_MAX_BYTES_PER_ROW, "%*.15e", 23, GET_DOUBLE_VAL(val));
+ taosFprintfFile(pFile, "%s", buf);
break;
case TSDB_DATA_TYPE_BINARY:
case TSDB_DATA_TYPE_NCHAR:
@@ -512,7 +507,6 @@ void shellPrintField(const char *val, TAOS_FIELD *field, int32_t width, int32_t
return;
}
- int n;
char buf[TSDB_MAX_BYTES_PER_ROW];
switch (field->type) {
case TSDB_DATA_TYPE_BOOL:
@@ -543,15 +537,11 @@ void shellPrintField(const char *val, TAOS_FIELD *field, int32_t width, int32_t
printf("%*" PRIu64, width, *((uint64_t *)val));
break;
case TSDB_DATA_TYPE_FLOAT:
- printf("%*ef", width, GET_FLOAT_VAL(val));
+ printf("%*e", width, GET_FLOAT_VAL(val));
break;
case TSDB_DATA_TYPE_DOUBLE:
- n = snprintf(buf, TSDB_MAX_BYTES_PER_ROW, "%*.9f", width, GET_DOUBLE_VAL(val));
- if (n > TMAX(25, width)) {
- printf("%*.15e", width, GET_DOUBLE_VAL(val));
- } else {
- printf("%s", buf);
- }
+ snprintf(buf, TSDB_MAX_BYTES_PER_ROW, "%.9e", GET_DOUBLE_VAL(val));
+ printf("%*s", width, buf);
break;
case TSDB_DATA_TYPE_BINARY:
case TSDB_DATA_TYPE_NCHAR:
diff --git a/tools/shell/src/shellWebsocket.c b/tools/shell/src/shellWebsocket.c
index 1d81ce4b2f..d8920cb4c3 100644
--- a/tools/shell/src/shellWebsocket.c
+++ b/tools/shell/src/shellWebsocket.c
@@ -24,7 +24,7 @@ int shell_conn_ws_server(bool first) {
((dsnLen-SHELL_WS_DSN_MASK) > SHELL_WS_DSN_BUFF)?
SHELL_WS_DSN_BUFF:(dsnLen-SHELL_WS_DSN_MASK),
"%s", shell.args.dsn);
- fprintf(stdout, "trying to connect %s*** ", cuttedDsn);
+ fprintf(stdout, "trying to connect %s****** ", cuttedDsn);
fflush(stdout);
for (int i = 0; i < shell.args.timeout; i++) {
shell.ws_conn = ws_connect_with_dsn(shell.args.dsn);
diff --git a/utils/test/c/CMakeLists.txt b/utils/test/c/CMakeLists.txt
index eda9c70f15..87b0d11d1c 100644
--- a/utils/test/c/CMakeLists.txt
+++ b/utils/test/c/CMakeLists.txt
@@ -6,6 +6,14 @@ add_executable(tmq_taosx_ci tmq_taosx_ci.c)
add_executable(write_raw_block_test write_raw_block_test.c)
add_executable(sml_test sml_test.c)
add_executable(get_db_name_test get_db_name_test.c)
+add_executable(tmq_offset tmqOffset.c)
+target_link_libraries(
+ tmq_offset
+ PUBLIC taos_static
+ PUBLIC util
+ PUBLIC common
+ PUBLIC os
+)
target_link_libraries(
create_table
PUBLIC taos_static
diff --git a/utils/test/c/sml_test.c b/utils/test/c/sml_test.c
index b0cc6f749c..755ab55625 100644
--- a/utils/test/c/sml_test.c
+++ b/utils/test/c/sml_test.c
@@ -773,26 +773,26 @@ int sml_dup_time_Test() {
taos_free_result(pRes);
const char *sql[] = {//"test_ms,t0=t c0=f 1626006833641",
- "ubzlsr,id=qmtcvgd,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11."
- "12345f32,t6=22.123456789f64,t7=\"binaryTagValue\",t8=L\"ncharTagValue\" "
- "c0=f,c1=1i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22."
- "123456789f64,c7=\"xcxvwjvf\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000",
- "ubzlsr,id=qmtcvgd,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11."
- "12345f32,t6=22.123456789f64,t7=\"binaryTagValue\",t8=L\"ncharTagValue\" "
- "c0=T,c1=2i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22."
- "123456789f64,c7=\"fixrzcuq\",c8=L\"ncharColValue\",c9=7u64 1626006834639000000",
- "ubzlsr,id=qmtcvgd,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11."
- "12345f32,t6=22.123456789f64,t7=\"binaryTagValue\",t8=L\"ncharTagValue\" "
- "c0=t,c1=3i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22."
- "123456789f64,c7=\"iupzdqub\",c8=L\"ncharColValue\",c9=7u64 1626006835639000000",
- "ubzlsr,id=qmtcvgd,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11."
- "12345f32,t6=22.123456789f64,t7=\"binaryTagValue\",t8=L\"ncharTagValue\" "
- "c0=t,c1=4i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22."
- "123456789f64,c7=\"yvvtzzof\",c8=L\"ncharColValue\",c9=7u64 1626006836639000000",
- "ubzlsr,id=qmtcvgd,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11."
- "12345f32,t6=22.123456789f64,t7=\"binaryTagValue\",t8=L\"ncharTagValue\" "
- "c0=t,c1=5i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22."
- "123456789f64,c7=\"vbxpilkj\",c8=L\"ncharColValue\",c9=7u64 1626006837639000000"};
+ "ubzlsr,id=qmtcvgd,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11."
+ "12345f32,t6=22.123456789f64,t7=\"binaryTagValue\",t8=L\"ncharTagValue\" "
+ "c0=f,c1=1i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22."
+ "123456789f64,c7=\"xcxvwjvf\",c8=L\"ncharColValue\",c9=7u64 1626006833639000000",
+ "ubzlsr,id=qmtcvgd,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11."
+ "12345f32,t6=22.123456789f64,t7=\"binaryTagValue\",t8=L\"ncharTagValue\" "
+ "c0=T,c1=2i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22."
+ "123456789f64,c7=\"fixrzcuq\",c8=L\"ncharColValue\",c9=7u64 1626006834639000000",
+ "ubzlsr,id=qmtcvgd,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11."
+ "12345f32,t6=22.123456789f64,t7=\"binaryTagValue\",t8=L\"ncharTagValue\" "
+ "c0=t,c1=3i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22."
+ "123456789f64,c7=\"iupzdqub\",c8=L\"ncharColValue\",c9=7u64 1626006835639000000",
+ "ubzlsr,id=qmtcvgd,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11."
+ "12345f32,t6=22.123456789f64,t7=\"binaryTagValue\",t8=L\"ncharTagValue\" "
+ "c0=t,c1=4i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22."
+ "123456789f64,c7=\"yvvtzzof\",c8=L\"ncharColValue\",c9=7u64 1626006836639000000",
+ "ubzlsr,id=qmtcvgd,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11."
+ "12345f32,t6=22.123456789f64,t7=\"binaryTagValue\",t8=L\"ncharTagValue\" "
+ "c0=t,c1=5i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22."
+ "123456789f64,c7=\"vbxpilkj\",c8=L\"ncharColValue\",c9=7u64 1626006837639000000"};
pRes = taos_query(taos, "use sml_db");
taos_free_result(pRes);
@@ -942,6 +942,8 @@ int sml_ts2164_Test() {
"ts3038,location=l2a,groupid=ca current=L\"11.8\"",
"ts3038,location=l2a,groupid=ca voltage=L\"221\"",
"ts3038,location=l2a,groupid=ca phase=L\"221\"",
+// "qgyltizmkq,id=sub_table_0123456,t0=f,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"binaryTagValue\",t8=L\"ncharTagValue\" c0=f,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"binaryColValue\",c8=L\"ncharColValue\",c9=7u64",
+// "qgyltizmkq,id=sub_table_0123456,t=3,t0=f,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"binaryTagValue\",t8=L\"ncharTagValue\" c0=f,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"binaryColValue\",c8=L\"ncharColValue\",c9=7u64"
// "meters,location=la,groupid=cb current=11.8,voltage=221,phase=0.27",
};
diff --git a/utils/test/c/tmqOffset.c b/utils/test/c/tmqOffset.c
new file mode 100644
index 0000000000..7225cb87bd
--- /dev/null
+++ b/utils/test/c/tmqOffset.c
@@ -0,0 +1,64 @@
+//
+// Created by mingming wanng on 2023/4/7.
+//
+#include
+#include
+#include "taoserror.h"
+#include "tlog.h"
+#include "tmsg.h"
+
+typedef struct {
+ int32_t size;
+} STqOffsetHead;
+
+int32_t tqOffsetRestoreFromFile(const char* fname) {
+ TdFilePtr pFile = taosOpenFile(fname, TD_FILE_READ);
+ if (pFile != NULL) {
+ STqOffsetHead head = {0};
+ int32_t code;
+
+ while (1) {
+ if ((code = taosReadFile(pFile, &head, sizeof(STqOffsetHead))) != sizeof(STqOffsetHead)) {
+ if (code == 0) {
+ break;
+ } else {
+ printf("code:%d != 0\n", code);
+ return -1;
+ }
+ }
+ int32_t size = htonl(head.size);
+ void* memBuf = taosMemoryCalloc(1, size);
+ if (memBuf == NULL) {
+ printf("memBuf == NULL\n");
+ return -1;
+ }
+ if ((code = taosReadFile(pFile, memBuf, size)) != size) {
+ taosMemoryFree(memBuf);
+ printf("code:%d != size:%d\n", code, size);
+ return -1;
+ }
+ STqOffset offset;
+ SDecoder decoder;
+ tDecoderInit(&decoder, memBuf, size);
+ if (tDecodeSTqOffset(&decoder, &offset) < 0) {
+ taosMemoryFree(memBuf);
+ tDecoderClear(&decoder);
+ printf("tDecodeSTqOffset error\n");
+ return -1;
+ }
+
+ tDecoderClear(&decoder);
+ printf("subkey:%s, type:%d, uid/version:%"PRId64", ts:%"PRId64"\n",
+ offset.subKey, offset.val.type, offset.val.uid, offset.val.ts);
+ taosMemoryFree(memBuf);
+ }
+
+ taosCloseFile(&pFile);
+ }
+ return 0;
+}
+
+int main(int argc, char *argv[]) {
+ tqOffsetRestoreFromFile("offset-ver0");
+ return 0;
+}