From a999e56a1dad1dd2ead3c6288cf8ec223990d984 Mon Sep 17 00:00:00 2001 From: freemine Date: Sun, 5 Feb 2023 16:08:34 +0800 Subject: [PATCH 001/174] typo: pthread_cleanup_push/pop better exist in pair --- source/os/src/osTimer.c | 37 ++++++++++++++++++----------------- tools/shell/src/shellEngine.c | 32 ++++++++++++++++-------------- 2 files changed, 36 insertions(+), 33 deletions(-) diff --git a/source/os/src/osTimer.c b/source/os/src/osTimer.c index d1c233ea9c..185bd9832a 100644 --- a/source/os/src/osTimer.c +++ b/source/os/src/osTimer.c @@ -114,27 +114,28 @@ static void *taosProcessAlarmSignal(void *tharg) { taosThreadCleanupPush(taosDeleteTimer, &timerId); - struct itimerspec ts; - ts.it_value.tv_sec = 0; - ts.it_value.tv_nsec = 1000000 * MSECONDS_PER_TICK; - ts.it_interval.tv_sec = 0; - ts.it_interval.tv_nsec = 1000000 * MSECONDS_PER_TICK; + do { + struct itimerspec ts; + ts.it_value.tv_sec = 0; + ts.it_value.tv_nsec = 1000000 * MSECONDS_PER_TICK; + ts.it_interval.tv_sec = 0; + ts.it_interval.tv_nsec = 1000000 * MSECONDS_PER_TICK; - if (timer_settime(timerId, 0, &ts, NULL)) { - // printf("Failed to init timer"); - return NULL; - } - - int signo; - while (!stopTimer) { - if (sigwait(&sigset, &signo)) { - // printf("Failed to wait signal: number %d", signo); - continue; + if (timer_settime(timerId, 0, &ts, NULL)) { + // printf("Failed to init timer"); + break; } - /* //printf("Signal handling: number %d ......\n", signo); */ - callback(0); - } + int signo; + while (!stopTimer) { + if (sigwait(&sigset, &signo)) { + // printf("Failed to wait signal: number %d", signo); + continue; + } + /* //printf("Signal handling: number %d ......\n", signo); */ + callback(0); + } + } while (0); taosThreadCleanupPop(1); diff --git a/tools/shell/src/shellEngine.c b/tools/shell/src/shellEngine.c index 479c2cf39a..d45c4fbdb5 100644 --- a/tools/shell/src/shellEngine.c +++ b/tools/shell/src/shellEngine.c @@ -1046,26 +1046,28 @@ void *shellThreadLoop(void *arg) { taosGetOldTerminalMode(); taosThreadCleanupPush(shellCleanup, NULL); - char *command = taosMemoryMalloc(SHELL_MAX_COMMAND_SIZE); - if (command == NULL) { - printf("failed to malloc command\r\n"); - return NULL; - } - do { - memset(command, 0, SHELL_MAX_COMMAND_SIZE); - taosSetTerminalMode(); - - if (shellReadCommand(command) != 0) { + char *command = taosMemoryMalloc(SHELL_MAX_COMMAND_SIZE); + if (command == NULL) { + printf("failed to malloc command\r\n"); break; } - taosResetTerminalMode(); - } while (shellRunCommand(command, true) == 0); + do { + memset(command, 0, SHELL_MAX_COMMAND_SIZE); + taosSetTerminalMode(); - taosMemoryFreeClear(command); - shellWriteHistory(); - shellExit(); + if (shellReadCommand(command) != 0) { + break; + } + + taosResetTerminalMode(); + } while (shellRunCommand(command, true) == 0); + + taosMemoryFreeClear(command); + shellWriteHistory(); + shellExit(); + } while (0); taosThreadCleanupPop(1); return NULL; From 8c754bed200dddcc4f796e7790a8351f54e619c3 Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Fri, 10 Feb 2023 14:32:31 +0800 Subject: [PATCH 002/174] fix: mem leak whene fd excced limit --- source/libs/transport/src/transSvr.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/source/libs/transport/src/transSvr.c b/source/libs/transport/src/transSvr.c index fa8929f7d9..349d679e0d 100644 --- a/source/libs/transport/src/transSvr.c +++ b/source/libs/transport/src/transSvr.c @@ -679,14 +679,21 @@ void uvOnAcceptCb(uv_stream_t* stream, int status) { SServerObj* pObj = container_of(stream, SServerObj, server); uv_tcp_t* cli = (uv_tcp_t*)taosMemoryMalloc(sizeof(uv_tcp_t)); - uv_tcp_init(pObj->loop, cli); + if (cli == NULL) return; - if (uv_accept(stream, (uv_stream_t*)cli) == 0) { + int err = uv_tcp_init(pObj->loop, cli); + if (err != 0) { + tError("failed to create tcp: %s", uv_err_name(err)); + taosMemoryFree(cli); + return; + } + err = uv_accept(stream, (uv_stream_t*)cli); + if (err == 0) { #if defined(WINDOWS) || defined(DARWIN) if (pObj->numOfWorkerReady < pObj->numOfThreads) { tError("worker-threads are not ready for all, need %d instead of %d.", pObj->numOfThreads, pObj->numOfWorkerReady); - uv_close((uv_handle_t*)cli, NULL); + uv_close((uv_handle_t*)cli, uvFreeCb); return; } #endif @@ -702,8 +709,10 @@ void uvOnAcceptCb(uv_stream_t* stream, int status) { uv_write2(wr, (uv_stream_t*)&(pObj->pipe[pObj->workerIdx][0]), &buf, 1, (uv_stream_t*)cli, uvOnPipeWriteCb); } else { if (!uv_is_closing((uv_handle_t*)cli)) { - uv_close((uv_handle_t*)cli, NULL); + tError("failed to accept tcp: %s", uv_err_name(err)); + uv_close((uv_handle_t*)cli, uvFreeCb); } else { + tError("failed to accept tcp: %s", uv_err_name(err)); taosMemoryFree(cli); } } From 181d588f85e5b510bb75ed125e60be62aacf014e Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Fri, 24 Feb 2023 16:04:35 +0800 Subject: [PATCH 003/174] fix:core dump if data block size is 0 --- source/dnode/vnode/src/tq/tqExec.c | 2 +- tests/system-test/7-tmq/subscribeDb4.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/source/dnode/vnode/src/tq/tqExec.c b/source/dnode/vnode/src/tq/tqExec.c index 093186ebbb..97612d3582 100644 --- a/source/dnode/vnode/src/tq/tqExec.c +++ b/source/dnode/vnode/src/tq/tqExec.c @@ -152,7 +152,7 @@ int32_t tqScanTaosx(STQ* pTq, const STqHandle* pHandle, STaosxRsp* pRsp, SMqMeta } tqDebug("tmqsnap task execute end, get %p", pDataBlock); - if (pDataBlock != NULL) { + if (pDataBlock != NULL && pDataBlock->info.rows > 0) { if (pRsp->withTbName) { int64_t uid = 0; if (pOffset->type == TMQ_OFFSET__LOG) { diff --git a/tests/system-test/7-tmq/subscribeDb4.py b/tests/system-test/7-tmq/subscribeDb4.py index 7f5169361c..1395359a1f 100644 --- a/tests/system-test/7-tmq/subscribeDb4.py +++ b/tests/system-test/7-tmq/subscribeDb4.py @@ -26,7 +26,7 @@ class TDTestCase: 'ctbPrefix': 'ctb', 'ctbStartIdx': 0, 'ctbNum': 10, - 'rowsPerTbl': 10000, + 'rowsPerTbl': 50000, 'batchNum': 10, 'startTs': 1640966400000, # 2022-01-01 00:00:00.000 'pollDelay': 20, From 54a546931c7ba4f86d62df05abfcd270be52e04b Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Fri, 24 Feb 2023 19:22:08 +0800 Subject: [PATCH 004/174] fix:optimize version logic in tmq and remove useless code --- include/common/tmsg.h | 2 +- source/dnode/mnode/impl/inc/mndDef.h | 2 +- source/dnode/vnode/src/inc/tq.h | 2 +- source/dnode/vnode/src/tq/tq.c | 5 --- source/dnode/vnode/src/tq/tqRead.c | 14 ++------ source/libs/executor/src/scanoperator.c | 12 ------- source/libs/wal/src/walRead.c | 44 +++++++++++++------------ 7 files changed, 28 insertions(+), 53 deletions(-) diff --git a/include/common/tmsg.h b/include/common/tmsg.h index 8dcadf47b6..1cb5695bc6 100644 --- a/include/common/tmsg.h +++ b/include/common/tmsg.h @@ -2605,7 +2605,7 @@ typedef struct { char subKey[TSDB_SUBSCRIBE_KEY_LEN]; int8_t subType; int8_t withMeta; - char* qmsg; + char* qmsg; //SubPlanToString int64_t suid; } SMqRebVgReq; diff --git a/source/dnode/mnode/impl/inc/mndDef.h b/source/dnode/mnode/impl/inc/mndDef.h index 6f6f801c39..4c42e6b2a1 100644 --- a/source/dnode/mnode/impl/inc/mndDef.h +++ b/source/dnode/mnode/impl/inc/mndDef.h @@ -528,7 +528,7 @@ void* tDecodeSMqConsumerObj(const void* buf, SMqConsumerObj* pConsumer typedef struct { int32_t vgId; - char* qmsg; + char* qmsg; //SubPlanToString SEpSet epSet; } SMqVgEp; diff --git a/source/dnode/vnode/src/inc/tq.h b/source/dnode/vnode/src/inc/tq.h index 828341ddd8..f76347dee2 100644 --- a/source/dnode/vnode/src/inc/tq.h +++ b/source/dnode/vnode/src/inc/tq.h @@ -67,7 +67,7 @@ typedef struct { // tqExec typedef struct { - char* qmsg; + char* qmsg; // SubPlanToString } STqExecCol; typedef struct { diff --git a/source/dnode/vnode/src/tq/tq.c b/source/dnode/vnode/src/tq/tq.c index 276de64bbd..00d86983f2 100644 --- a/source/dnode/vnode/src/tq/tq.c +++ b/source/dnode/vnode/src/tq/tq.c @@ -568,7 +568,6 @@ int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg) { taosWLockLatch(&pTq->pushLock); tqScanData(pTq, pHandle, &dataRsp, &fetchOffsetNew); -#if 1 if (dataRsp.blockNum == 0 && dataRsp.reqOffset.type == TMQ_OFFSET__LOG && dataRsp.reqOffset.version == dataRsp.rspOffset.version) { STqPushEntry* pPushEntry = taosMemoryCalloc(1, sizeof(STqPushEntry)); @@ -588,7 +587,6 @@ int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg) { return 0; } } -#endif taosWUnLockLatch(&pTq->pushLock); if (tqSendDataRsp(pTq, pMsg, &req, &dataRsp) < 0) { @@ -605,10 +603,7 @@ int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg) { } // for taosx - ASSERT(pHandle->execHandle.subType != TOPIC_SUB_TYPE__COLUMN); - SMqMetaRsp metaRsp = {0}; - STaosxRsp taosxRsp = {0}; tqInitTaosxRsp(&taosxRsp, &req); diff --git a/source/dnode/vnode/src/tq/tqRead.c b/source/dnode/vnode/src/tq/tqRead.c index 7cad739ffa..1a54614f43 100644 --- a/source/dnode/vnode/src/tq/tqRead.c +++ b/source/dnode/vnode/src/tq/tqRead.c @@ -309,7 +309,8 @@ int32_t tqNextBlock(STqReader* pReader, SFetchRet* ret) { if (!fromProcessedMsg) { if (walNextValidMsg(pReader->pWalReader) < 0) { pReader->ver = - pReader->pWalReader->curVersion - (pReader->pWalReader->curInvalid | pReader->pWalReader->curStopped); + pReader->pWalReader->curVersion - pReader->pWalReader->curStopped; +// pReader->pWalReader->curVersion - (pReader->pWalReader->curInvalid | pReader->pWalReader->curStopped); ret->offset.type = TMQ_OFFSET__LOG; ret->offset.version = pReader->ver; ret->fetchType = FETCH_TYPE__NONE; @@ -318,18 +319,7 @@ int32_t tqNextBlock(STqReader* pReader, SFetchRet* ret) { return -1; } void* body = pReader->pWalReader->pHead->head.body; -#if 0 - if (pReader->pWalReader->pHead->head.msgType != TDMT_VND_SUBMIT) { - // TODO do filter - ret->fetchType = FETCH_TYPE__META; - ret->meta = pReader->pWalReader->pHead->head.body; - return 0; - } else { -#endif tqReaderSetDataMsg(pReader, body, pReader->pWalReader->pHead->head.version); -#if 0 - } -#endif } while (tqNextDataBlock(pReader)) { diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c index 99e630f45e..99ea62fe3e 100644 --- a/source/libs/executor/src/scanoperator.c +++ b/source/libs/executor/src/scanoperator.c @@ -1647,8 +1647,6 @@ static SSDataBlock* doQueueScan(SOperatorInfo* pOperator) { } else if (ret.fetchType == FETCH_TYPE__NONE || (ret.fetchType == FETCH_TYPE__SEP && pOperator->status == OP_EXEC_RECV)) { pTaskInfo->streamInfo.lastStatus = ret.offset; - ASSERT(pTaskInfo->streamInfo.lastStatus.version >= pTaskInfo->streamInfo.prepareStatus.version); - ASSERT(pTaskInfo->streamInfo.lastStatus.version + 1 == pInfo->tqReader->pWalReader->curVersion); char formatBuf[80]; tFormatOffset(formatBuf, 80, &ret.offset); qDebug("queue scan log return null, offset %s", formatBuf); @@ -1656,16 +1654,6 @@ static SSDataBlock* doQueueScan(SOperatorInfo* pOperator) { return NULL; } } -#if 0 - } else if (pTaskInfo->streamInfo.prepareStatus.type == TMQ_OFFSET__SNAPSHOT_DATA) { - SSDataBlock* pResult = doTableScan(pInfo->pTableScanOp); - if (pResult && pResult->info.rows > 0) { - qDebug("stream scan tsdb return %d rows", pResult->info.rows); - return pResult; - } - qDebug("stream scan tsdb return null"); - return NULL; -#endif } else { qError("unexpected streamInfo prepare type: %d", pTaskInfo->streamInfo.prepareStatus.type); return NULL; diff --git a/source/libs/wal/src/walRead.c b/source/libs/wal/src/walRead.c index 526dba0bb5..a0a0a96b3a 100644 --- a/source/libs/wal/src/walRead.c +++ b/source/libs/wal/src/walRead.c @@ -201,6 +201,7 @@ int32_t walReadSeekVerImpl(SWalReader *pReader, int64_t ver) { pReader->curVersion, pReader->curInvalid, ver); pReader->curVersion = ver; + pReader->curInvalid = 0; return 0; } @@ -211,8 +212,8 @@ int32_t walReadSeekVer(SWalReader *pReader, int64_t ver) { return 0; } - pReader->curInvalid = 1; - pReader->curVersion = ver; +// 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, @@ -220,8 +221,8 @@ int32_t walReadSeekVer(SWalReader *pReader, int64_t ver) { terrno = TSDB_CODE_WAL_LOG_NOT_EXIST; return -1; } - if (ver < pWal->vers.snapshotVer) { - } +// if (ver < pWal->vers.snapshotVer) { +// } if (walReadSeekVerImpl(pReader, ver) < 0) { return -1; @@ -240,8 +241,8 @@ static int32_t walFetchHeadNew(SWalReader *pRead, int64_t fetchVer) { if (pRead->curInvalid || pRead->curVersion != fetchVer) { if (walReadSeekVer(pRead, fetchVer) < 0) { - pRead->curVersion = fetchVer; - pRead->curInvalid = 1; +// pRead->curVersion = fetchVer; +// pRead->curInvalid = 1; return -1; } seeked = true; @@ -260,11 +261,11 @@ static int32_t walFetchHeadNew(SWalReader *pRead, int64_t fetchVer) { } else { terrno = TSDB_CODE_WAL_FILE_CORRUPTED; } - pRead->curInvalid = 1; +// pRead->curInvalid = 1; return -1; } } - pRead->curInvalid = 0; +// pRead->curInvalid = 0; return 0; } @@ -295,13 +296,13 @@ static int32_t walFetchBodyNew(SWalReader *pRead) { pRead->pWal->cfg.vgId, pRead->pHead->head.version, ver); terrno = TSDB_CODE_WAL_FILE_CORRUPTED; } - pRead->curInvalid = 1; +// pRead->curInvalid = 1; return -1; } if (walValidBodyCksum(pRead->pHead) != 0) { wError("vgId:%d, wal fetch body error:%" PRId64 ", since body checksum not passed", pRead->pWal->cfg.vgId, ver); - pRead->curInvalid = 1; +// pRead->curInvalid = 1; terrno = TSDB_CODE_WAL_FILE_CORRUPTED; return -1; } @@ -320,7 +321,7 @@ static int32_t walSkipFetchBodyNew(SWalReader *pRead) { code = taosLSeekFile(pRead->pLogFile, pRead->pHead->head.bodyLen, SEEK_CUR); if (code < 0) { terrno = TAOS_SYSTEM_ERROR(errno); - pRead->curInvalid = 1; +// pRead->curInvalid = 1; return -1; } @@ -348,8 +349,8 @@ int32_t walFetchHead(SWalReader *pRead, int64_t ver, SWalCkHead *pHead) { if (pRead->curInvalid || pRead->curVersion != ver) { code = walReadSeekVer(pRead, ver); if (code < 0) { - pRead->curVersion = ver; - pRead->curInvalid = 1; +// pRead->curVersion = ver; +// pRead->curInvalid = 1; return -1; } seeked = true; @@ -369,7 +370,7 @@ int32_t walFetchHead(SWalReader *pRead, int64_t ver, SWalCkHead *pHead) { } else { terrno = TSDB_CODE_WAL_FILE_CORRUPTED; } - pRead->curInvalid = 1; +// pRead->curInvalid = 1; return -1; } } @@ -382,7 +383,7 @@ int32_t walFetchHead(SWalReader *pRead, int64_t ver, SWalCkHead *pHead) { return -1; } - pRead->curInvalid = 0; +// pRead->curInvalid = 0; return 0; } @@ -400,7 +401,7 @@ int32_t walSkipFetchBody(SWalReader *pRead, const SWalCkHead *pHead) { code = taosLSeekFile(pRead->pLogFile, pHead->head.bodyLen, SEEK_CUR); if (code < 0) { terrno = TAOS_SYSTEM_ERROR(errno); - pRead->curInvalid = 1; +// pRead->curInvalid = 1; return -1; } @@ -439,14 +440,14 @@ int32_t walFetchBody(SWalReader *pRead, SWalCkHead **ppHead) { pRead->pWal->cfg.vgId, pReadHead->version, ver); terrno = TSDB_CODE_WAL_FILE_CORRUPTED; } - pRead->curInvalid = 1; +// pRead->curInvalid = 1; return -1; } if (pReadHead->version != ver) { wError("vgId:%d, wal fetch body error, index:%" PRId64 ", read request index:%" PRId64, pRead->pWal->cfg.vgId, pReadHead->version, ver); - pRead->curInvalid = 1; +// pRead->curInvalid = 1; terrno = TSDB_CODE_WAL_FILE_CORRUPTED; return -1; } @@ -454,7 +455,7 @@ int32_t walFetchBody(SWalReader *pRead, SWalCkHead **ppHead) { if (walValidBodyCksum(*ppHead) != 0) { wError("vgId:%d, wal fetch body error, index:%" PRId64 ", since body checksum not passed", pRead->pWal->cfg.vgId, ver); - pRead->curInvalid = 1; +// pRead->curInvalid = 1; terrno = TSDB_CODE_WAL_FILE_CORRUPTED; return -1; } @@ -550,7 +551,7 @@ int32_t walReadVer(SWalReader *pReader, int64_t ver) { if (pReader->pHead->head.version != ver) { wError("vgId:%d, unexpected wal log, index:%" PRId64 ", read request index:%" PRId64, pReader->pWal->cfg.vgId, pReader->pHead->head.version, ver); - pReader->curInvalid = 1; +// pReader->curInvalid = 1; terrno = TSDB_CODE_WAL_FILE_CORRUPTED; taosThreadMutexUnlock(&pReader->mutex); return -1; @@ -563,7 +564,7 @@ int32_t walReadVer(SWalReader *pReader, int64_t ver) { uint32_t readCkSum = walCalcBodyCksum(pReader->pHead->head.body, pReader->pHead->head.bodyLen); uint32_t logCkSum = pReader->pHead->cksumBody; wError("checksum written into log:%u, checksum calculated:%u", logCkSum, readCkSum); - pReader->curInvalid = 1; +// pReader->curInvalid = 1; terrno = TSDB_CODE_WAL_FILE_CORRUPTED; taosThreadMutexUnlock(&pReader->mutex); return -1; @@ -581,5 +582,6 @@ void walReadReset(SWalReader *pReader) { taosCloseFile(&pReader->pLogFile); pReader->curInvalid = 1; pReader->curFileFirstVer = -1; + pReader->curVersion = -1; taosThreadMutexUnlock(&pReader->mutex); } From 5830e0931ca43d8a63919f7d00da19f41e6a9c0c Mon Sep 17 00:00:00 2001 From: jiacy-jcy <714897623@qq.com> Date: Mon, 27 Feb 2023 15:22:46 +0800 Subject: [PATCH 005/174] test:add test case for TD-22532 --- tests/system-test/0-others/show.py | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/tests/system-test/0-others/show.py b/tests/system-test/0-others/show.py index b5d6a0d1a3..82f9cb9d7e 100644 --- a/tests/system-test/0-others/show.py +++ b/tests/system-test/0-others/show.py @@ -12,13 +12,16 @@ # -*- coding: utf-8 -*- + + + +import re from util.log import * from util.cases import * from util.sql import * from util.common import * from util.sqlset import * - class TDTestCase: def init(self, conn, logSql, replicaVar=1): self.replicaVar = int(replicaVar) @@ -28,7 +31,7 @@ class TDTestCase: self.ins_param_list = ['dnodes','mnodes','qnodes','cluster','functions','users','grants','topics','subscriptions','streams'] self.perf_param = ['apps','connections','consumers','queries','transactions'] self.perf_param_list = ['apps','connections','consumers','queries','trans'] - + def ins_check(self): tdSql.prepare() for param in self.ins_param_list: @@ -113,7 +116,25 @@ class TDTestCase: query_result = tdSql.queryResult tdSql.checkEqual(query_result[0][1].lower(),sql) tdSql.execute('drop database db') + def check_gitinfo(self): + taosd_gitinfo_sql = '' + tdSql.query('show dnode 1 variables') + for i in tdSql.queryResult: + if i[1].lower() == "gitinfo": + taosd_gitinfo_sql = f"gitinfo: {i[2]}" + taos_gitinfo_sql = '' + tdSql.query('show local variables') + for i in tdSql.queryResult: + if i[0].lower() == "gitinfo": + taos_gitinfo_sql = f"gitinfo: {i[1]}" + taos_info = os.popen('taos -V').read() + taos_gitinfo = re.findall("^gitinfo.*",taos_info,re.M) + tdSql.checkEqual(taos_gitinfo_sql,taos_gitinfo[0]) + taosd_info = os.popen('taosd -V').read() + taosd_gitinfo = re.findall("^gitinfo.*",taosd_info,re.M) + tdSql.checkEqual(taosd_gitinfo_sql,taosd_gitinfo[0]) def run(self): + self.check_gitinfo() self.ins_check() self.perf_check() self.show_sql() From 031e9032d0c7e25d62d6bd6d4f1fe52ce525d900 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Mon, 27 Feb 2023 18:59:38 +0800 Subject: [PATCH 006/174] fix:asan error --- source/dnode/mnode/impl/src/mndStream.c | 2 +- tests/script/tsim/stream/basic1.sim | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/source/dnode/mnode/impl/src/mndStream.c b/source/dnode/mnode/impl/src/mndStream.c index 2a05511134..b7f80f6b0e 100644 --- a/source/dnode/mnode/impl/src/mndStream.c +++ b/source/dnode/mnode/impl/src/mndStream.c @@ -1223,7 +1223,7 @@ static int32_t mndRetrieveStreamTask(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock // node id pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); - int32_t nodeId = TMAX(pTask->nodeId, 0); + int64_t nodeId = TMAX(pTask->nodeId, 0); colDataSetVal(pColInfo, numOfRows, (const char *)&nodeId, false); // level diff --git a/tests/script/tsim/stream/basic1.sim b/tests/script/tsim/stream/basic1.sim index c61c7667f8..a8f04aac64 100644 --- a/tests/script/tsim/stream/basic1.sim +++ b/tests/script/tsim/stream/basic1.sim @@ -887,4 +887,20 @@ if $rows != 1 then goto loop19 endi +print select * from information_schema.ins_stream_tasks; +sql select * from information_schema.ins_stream_tasks; + +if $rows == 0 then + print =====rows=$rows + return -1 +endi + +print select * from information_schema.ins_streams; +sql select * from information_schema.ins_streams; + +if $rows == 0 then + print =====rows=$rows + return -1 +endi + system sh/exec.sh -n dnode1 -s stop -x SIGINT From 5c70ea58f809e449938822d7ef2ff9c6691d99ae Mon Sep 17 00:00:00 2001 From: Huo Linhe Date: Tue, 28 Feb 2023 10:31:36 +0800 Subject: [PATCH 007/174] fix: explorer packaging --- packaging/tools/install.sh | 3 +++ packaging/tools/make_install.bat | 3 +++ packaging/tools/makepkg.sh | 2 ++ packaging/tools/remove.sh | 1 + 4 files changed, 9 insertions(+) diff --git a/packaging/tools/install.sh b/packaging/tools/install.sh index 5aeff0e2fa..2495e177e1 100755 --- a/packaging/tools/install.sh +++ b/packaging/tools/install.sh @@ -34,6 +34,7 @@ benchmarkName="taosBenchmark" dumpName="taosdump" demoName="taosdemo" xname="taosx" +explorerName="${clientName}-explorer" clientName2="taos" serverName2="taosd" @@ -214,6 +215,7 @@ function install_bin() { ${csudo}rm -f ${bin_link_dir}/${benchmarkName} || : ${csudo}rm -f ${bin_link_dir}/${dumpName} || : ${csudo}rm -f ${bin_link_dir}/${xname} || : + ${csudo}rm -f ${bin_link_dir}/${explorerName} || : ${csudo}rm -f ${bin_link_dir}/set_core || : ${csudo}rm -f ${bin_link_dir}/TDinsight.sh || : @@ -228,6 +230,7 @@ function install_bin() { [ -x ${install_main_dir}/bin/${benchmarkName} ] && ${csudo}ln -sf ${install_main_dir}/bin/${benchmarkName} ${bin_link_dir}/${benchmarkName} || : [ -x ${install_main_dir}/bin/${dumpName} ] && ${csudo}ln -s ${install_main_dir}/bin/${dumpName} ${bin_link_dir}/${dumpName} || : [ -x ${install_main_dir}/bin/${xname} ] && ${csudo}ln -s ${install_main_dir}/bin/${xname} ${bin_link_dir}/${xname} || : + [ -x ${install_main_dir}/bin/${explorerName} ] && ${csudo}ln -s ${install_main_dir}/bin/${explorerName} ${bin_link_dir}/${explorerName} || : [ -x ${install_main_dir}/bin/TDinsight.sh ] && ${csudo}ln -s ${install_main_dir}/bin/TDinsight.sh ${bin_link_dir}/TDinsight.sh || : [ -x ${install_main_dir}/bin/remove.sh ] && ${csudo}ln -s ${install_main_dir}/bin/remove.sh ${bin_link_dir}/${uninstallScript} || : [ -x ${install_main_dir}/bin/set_core.sh ] && ${csudo}ln -s ${install_main_dir}/bin/set_core.sh ${bin_link_dir}/set_core || : diff --git a/packaging/tools/make_install.bat b/packaging/tools/make_install.bat index f5ed1cdf66..6dc7c356cd 100644 --- a/packaging/tools/make_install.bat +++ b/packaging/tools/make_install.bat @@ -70,6 +70,9 @@ if %Enterprise% == TRUE ( if exist %binary_dir%\\build\\bin\\taosx.exe ( copy %binary_dir%\\build\\bin\\taosx.exe %target_dir% > nul ) + if exist %binary_dir%\\build\\bin\\taos-explorer.exe ( + copy %binary_dir%\\build\\bin\\taos-explorer.exe %target_dir% > nul + ) if exist %binary_dir%\\build\\bin\\tmq_sim.exe ( copy %binary_dir%\\build\\bin\\tmq_sim.exe %target_dir% > nul ) diff --git a/packaging/tools/makepkg.sh b/packaging/tools/makepkg.sh index 0a34d81b7f..92a20418c5 100755 --- a/packaging/tools/makepkg.sh +++ b/packaging/tools/makepkg.sh @@ -89,11 +89,13 @@ else ${build_dir}/bin/tdengine-datasource.zip \ ${build_dir}/bin/tdengine-datasource.zip.md5sum" [ -f ${build_dir}/bin/taosx ] && taosx_bin="${build_dir}/bin/taosx" + explorer_bin_files=$(sh -c "ls ${build_dir}/bin/*-explorer") bin_files="${build_dir}/bin/${serverName} \ ${build_dir}/bin/${clientName} \ ${taostools_bin_files} \ ${taosx_bin} \ + ${explorer_bin_files} \ ${build_dir}/bin/taosadapter \ ${build_dir}/bin/udfd \ ${script_dir}/remove.sh \ diff --git a/packaging/tools/remove.sh b/packaging/tools/remove.sh index 9c50c4582d..2479e48670 100755 --- a/packaging/tools/remove.sh +++ b/packaging/tools/remove.sh @@ -119,6 +119,7 @@ function clean_bin() { ${csudo}rm -f ${bin_link_dir}/TDinsight.sh || : ${csudo}rm -f ${bin_link_dir}/taoskeeper || : ${csudo}rm -f ${bin_link_dir}/taosx || : + ${csudo}rm -f ${bin_link_dir}/taos-explorer || : if [ "$verMode" == "cluster" ] && [ "$clientName" != "$clientName2" ]; then ${csudo}rm -f ${bin_link_dir}/${clientName2} || : From ce38d80480ffc45ac25b60aed7950725260867b7 Mon Sep 17 00:00:00 2001 From: shenglian zhou Date: Tue, 28 Feb 2023 11:19:13 +0800 Subject: [PATCH 008/174] fix: ensure capacity and move to next group --- source/libs/executor/src/executorimpl.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/source/libs/executor/src/executorimpl.c b/source/libs/executor/src/executorimpl.c index 89e0dd363c..3cbeb55f8a 100644 --- a/source/libs/executor/src/executorimpl.c +++ b/source/libs/executor/src/executorimpl.c @@ -1197,16 +1197,11 @@ int32_t doCopyToSDataBlock(SExecTaskInfo* pTaskInfo, SSDataBlock* pBlock, SExprS } if (pBlock->info.rows + pRow->numOfRows > pBlock->info.capacity) { - // expand the result datablock capacity - if (pRow->numOfRows > pBlock->info.capacity) { - blockDataEnsureCapacity(pBlock, pRow->numOfRows); - qDebug("datablock capacity not sufficient, expand to requried:%d, current capacity:%d, %s", pRow->numOfRows, - pBlock->info.capacity, GET_TASKID(pTaskInfo)); + blockDataEnsureCapacity(pBlock, pBlock->info.rows + pRow->numOfRows); + qDebug("datablock capacity not sufficient, expand to required:%d, current capacity:%d, %s", + (pRow->numOfRows+pBlock->info.rows), + pBlock->info.capacity, GET_TASKID(pTaskInfo)); // todo set the pOperator->resultInfo size - } else { - releaseBufPage(pBuf, page); - break; - } } pGroupResInfo->index += 1; From 22e52ebb3882910fc398866df79277292c3e553c Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Tue, 28 Feb 2023 14:25:19 +0800 Subject: [PATCH 009/174] fix(query): fix block distribution error. --- source/dnode/vnode/src/tsdb/tsdbRead.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/source/dnode/vnode/src/tsdb/tsdbRead.c b/source/dnode/vnode/src/tsdb/tsdbRead.c index a158bbfa8d..f4929635d9 100644 --- a/source/dnode/vnode/src/tsdb/tsdbRead.c +++ b/source/dnode/vnode/src/tsdb/tsdbRead.c @@ -4720,8 +4720,12 @@ int32_t tsdbReaderReset(STsdbReader* pReader, SQueryTableDataCond* pCond) { return code; } -static int32_t getBucketIndex(int32_t startRow, int32_t bucketRange, int32_t numOfRows) { - return (numOfRows - startRow) / bucketRange; +static int32_t getBucketIndex(int32_t startRow, int32_t bucketRange, int32_t numOfRows, int32_t numOfBucket) { + int32_t bucketIndex = (numOfRows - startRow) / bucketRange; + if (bucketIndex == numOfBucket) { + bucketIndex -= 1; + } + return bucketIndex; } int32_t tsdbGetFileBlocksDistInfo(STsdbReader* pReader, STableBlockDistInfo* pTableBlockInfo) { @@ -4730,8 +4734,9 @@ int32_t tsdbGetFileBlocksDistInfo(STsdbReader* pReader, STableBlockDistInfo* pTa pTableBlockInfo->totalRows = 0; pTableBlockInfo->numOfVgroups = 1; - // find the start data block in file + const int32_t numOfBucket = 20.0; + // find the start data block in file tsdbAcquireReader(pReader); if (pReader->suspended) { tsdbReaderResume(pReader); @@ -4742,7 +4747,7 @@ int32_t tsdbGetFileBlocksDistInfo(STsdbReader* pReader, STableBlockDistInfo* pTa pTableBlockInfo->defMinRows = pc->minRows; pTableBlockInfo->defMaxRows = pc->maxRows; - int32_t bucketRange = ceil((pc->maxRows - pc->minRows) / 20.0); + int32_t bucketRange = ceil((pc->maxRows - pc->minRows) / numOfBucket); pTableBlockInfo->numOfFiles += 1; @@ -4780,7 +4785,7 @@ int32_t tsdbGetFileBlocksDistInfo(STsdbReader* pReader, STableBlockDistInfo* pTa pTableBlockInfo->totalSize += pBlock->aSubBlock[0].szBlock; - int32_t bucketIndex = getBucketIndex(pTableBlockInfo->defMinRows, bucketRange, numOfRows); + int32_t bucketIndex = getBucketIndex(pTableBlockInfo->defMinRows, bucketRange, numOfRows, numOfBucket); pTableBlockInfo->blockRowsHisto[bucketIndex]++; hasNext = blockIteratorNext(&pStatus->blockIter, pReader->idStr); From 2310dfca22e7e7c76f1b399668653840369efdd1 Mon Sep 17 00:00:00 2001 From: plum-lihui Date: Tue, 28 Feb 2023 15:02:57 +0800 Subject: [PATCH 010/174] test: del data from async to sync --- tests/system-test/7-tmq/tmqDelete-1ctb.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/tests/system-test/7-tmq/tmqDelete-1ctb.py b/tests/system-test/7-tmq/tmqDelete-1ctb.py index 4b45b1a834..4c62bb757b 100644 --- a/tests/system-test/7-tmq/tmqDelete-1ctb.py +++ b/tests/system-test/7-tmq/tmqDelete-1ctb.py @@ -80,16 +80,16 @@ class TDTestCase: tdLog.debug("del data ............ [OK]") return - def threadFunctionForDeletaData(self, **paraDict): + def threadFunctionForDeletaData(self, paraDict): # create new connector for new tdSql instance in my thread newTdSql = tdCom.newTdSql() self.delData(newTdSql,paraDict["dbName"],paraDict["ctbPrefix"],paraDict["ctbNum"],paraDict["startTs"],paraDict["endTs"],paraDict["ctbStartIdx"]) return - def asyncDeleteData(self, paraDict): - pThread = threading.Thread(target=self.threadFunctionForDeletaData, kwargs=paraDict) - pThread.start() - return pThread + # def asyncDeleteData(self, paraDict): + # pThread = threading.Thread(target=self.threadFunctionForDeletaData, kwargs=paraDict) + # pThread.start() + # return pThread def tmqCase1(self): tdLog.printNoPrefix("======== test case 1: ") @@ -340,7 +340,8 @@ class TDTestCase: # del some data rowsOfDelete = int(self.rowsPerTbl / 4 ) paraDict["endTs"] = paraDict["startTs"] + rowsOfDelete - 1 - pDeleteThread = self.asyncDeleteData(paraDict) + # pDeleteThread = self.asyncDeleteData(paraDict) + self.threadFunctionForDeletaData(paraDict) tdLog.info("start consume processor") tmqCom.startTmqSimProcess(pollDelay=paraDict['pollDelay'],dbName=paraDict["dbName"],showMsg=paraDict['showMsg'], showRow=paraDict['showRow'],snapshot=paraDict['snapshot']) From e7a19755c66118ae120e1b0e1da03ca298a15028 Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Tue, 28 Feb 2023 16:02:49 +0800 Subject: [PATCH 011/174] fix: a plan error of set operator subquery --- source/libs/parser/src/parCalcConst.c | 57 ++++++++++++++++++++++++--- 1 file changed, 52 insertions(+), 5 deletions(-) diff --git a/source/libs/parser/src/parCalcConst.c b/source/libs/parser/src/parCalcConst.c index d4f4949df0..5afd61a054 100644 --- a/source/libs/parser/src/parCalcConst.c +++ b/source/libs/parser/src/parCalcConst.c @@ -320,6 +320,57 @@ static int32_t calcConstInsert(SCalcConstContext* pCxt, SInsertStmt* pInsert) { return code; } +static SNodeList* getChildProjection(SNode* pStmt) { + switch (nodeType(pStmt)) { + case QUERY_NODE_SELECT_STMT: + return ((SSelectStmt*)pStmt)->pProjectionList; + case QUERY_NODE_SET_OPERATOR: + return ((SSetOperator*)pStmt)->pProjectionList; + default: + break; + } + return NULL; +} + +static void eraseSetOpChildProjection(SSetOperator* pSetOp, int32_t index) { + SNodeList* pLeftProjs = getChildProjection(pSetOp->pLeft); + nodesListErase(pLeftProjs, nodesListGetCell(pLeftProjs, index)); + SNodeList* pRightProjs = getChildProjection(pSetOp->pRight); + nodesListErase(pRightProjs, nodesListGetCell(pRightProjs, index)); +} + +static int32_t calcConstSetOpProjections(SCalcConstContext* pCxt, SSetOperator* pSetOp, bool subquery) { + int32_t index = 0; + SNode* pProj = NULL; + WHERE_EACH(pProj, pSetOp->pProjectionList) { + if (subquery && isUselessCol((SExprNode*)pProj)) { + ERASE_NODE(pSetOp->pProjectionList); + eraseSetOpChildProjection(pSetOp, index); + continue; + } + ++index; + WHERE_NEXT; + } + if (0 == LIST_LENGTH(pSetOp->pProjectionList)) { + return nodesListStrictAppend(pSetOp->pProjectionList, createConstantValue()); + } + return TSDB_CODE_SUCCESS; +} + +static int32_t calcConstSetOperator(SCalcConstContext* pCxt, SSetOperator* pSetOp, bool subquery) { + int32_t code = calcConstSetOpProjections(pCxt, pSetOp, subquery); + if (TSDB_CODE_SUCCESS == code) { + code = calcConstQuery(pCxt, pSetOp->pLeft, false); + } + if (TSDB_CODE_SUCCESS == code) { + code = calcConstQuery(pCxt, pSetOp->pRight, false); + } + if (TSDB_CODE_SUCCESS == code) { + code = calcConstList(pSetOp->pOrderByList); + } + return code; +} + static int32_t calcConstQuery(SCalcConstContext* pCxt, SNode* pStmt, bool subquery) { int32_t code = TSDB_CODE_SUCCESS; switch (nodeType(pStmt)) { @@ -330,11 +381,7 @@ static int32_t calcConstQuery(SCalcConstContext* pCxt, SNode* pStmt, bool subque code = calcConstQuery(pCxt, ((SExplainStmt*)pStmt)->pQuery, subquery); break; case QUERY_NODE_SET_OPERATOR: { - SSetOperator* pSetOp = (SSetOperator*)pStmt; - code = calcConstQuery(pCxt, pSetOp->pLeft, false); - if (TSDB_CODE_SUCCESS == code) { - code = calcConstQuery(pCxt, pSetOp->pRight, false); - } + code = calcConstSetOperator(pCxt, (SSetOperator*)pStmt, subquery); break; } case QUERY_NODE_DELETE_STMT: From 5ad0d18c2e193e5720254a8b7d2e8984d21a4752 Mon Sep 17 00:00:00 2001 From: Ganlin Zhao Date: Tue, 28 Feb 2023 16:05:41 +0800 Subject: [PATCH 012/174] fix(query): make exchange operator inherit input order from upstream --- source/libs/executor/src/executorimpl.c | 11 +++++++---- tests/parallel_test/cases.task | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/source/libs/executor/src/executorimpl.c b/source/libs/executor/src/executorimpl.c index 89e0dd363c..0b8bd2a817 100644 --- a/source/libs/executor/src/executorimpl.c +++ b/source/libs/executor/src/executorimpl.c @@ -1452,13 +1452,16 @@ int32_t appendDownstream(SOperatorInfo* p, SOperatorInfo** pDownstream, int32_t int32_t getTableScanInfo(SOperatorInfo* pOperator, int32_t* order, int32_t* scanFlag) { // todo add more information about exchange operation int32_t type = pOperator->operatorType; - if (type == QUERY_NODE_PHYSICAL_PLAN_EXCHANGE || type == QUERY_NODE_PHYSICAL_PLAN_SYSTABLE_SCAN || - type == QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN || type == QUERY_NODE_PHYSICAL_PLAN_TAG_SCAN || - type == QUERY_NODE_PHYSICAL_PLAN_BLOCK_DIST_SCAN || type == QUERY_NODE_PHYSICAL_PLAN_LAST_ROW_SCAN || - type == QUERY_NODE_PHYSICAL_PLAN_TABLE_COUNT_SCAN) { + if (type == QUERY_NODE_PHYSICAL_PLAN_SYSTABLE_SCAN || type == QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN || + type == QUERY_NODE_PHYSICAL_PLAN_TAG_SCAN || type == QUERY_NODE_PHYSICAL_PLAN_BLOCK_DIST_SCAN || + type == QUERY_NODE_PHYSICAL_PLAN_LAST_ROW_SCAN || type == QUERY_NODE_PHYSICAL_PLAN_TABLE_COUNT_SCAN) { *order = TSDB_ORDER_ASC; *scanFlag = MAIN_SCAN; return TSDB_CODE_SUCCESS; + } else if (type == QUERY_NODE_PHYSICAL_PLAN_EXCHANGE) { + // for exchange operator inherit order from upstream and do not overwrite here + *scanFlag = MAIN_SCAN; + return TSDB_CODE_SUCCESS; } else if (type == QUERY_NODE_PHYSICAL_PLAN_TABLE_SCAN) { STableScanInfo* pTableScanInfo = pOperator->info; *order = pTableScanInfo->base.cond.order; diff --git a/tests/parallel_test/cases.task b/tests/parallel_test/cases.task index c70a50867b..e6384a87e9 100644 --- a/tests/parallel_test/cases.task +++ b/tests/parallel_test/cases.task @@ -945,7 +945,7 @@ ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/function_null.py -Q 3 ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/count_partition.py -Q 3 ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/max_partition.py -Q 3 -#,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/max_min_last_interval.py -Q 3 +,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/max_min_last_interval.py -Q 3 ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/last_row.py -Q 3 ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/tsbsQuery.py -Q 3 ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/sml.py -Q 3 From ecf166bd0fad0d8df6d713bc13a91497130620aa Mon Sep 17 00:00:00 2001 From: chenhaoran Date: Tue, 28 Feb 2023 17:04:48 +0800 Subject: [PATCH 013/174] test: remove cross-threaded operations that use Python connections in test cases --- .../6-cluster/5dnode3mnodeRestartDnodeInsertDataAsync.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/system-test/6-cluster/5dnode3mnodeRestartDnodeInsertDataAsync.py b/tests/system-test/6-cluster/5dnode3mnodeRestartDnodeInsertDataAsync.py index 66c2fdd14f..04c69ad618 100644 --- a/tests/system-test/6-cluster/5dnode3mnodeRestartDnodeInsertDataAsync.py +++ b/tests/system-test/6-cluster/5dnode3mnodeRestartDnodeInsertDataAsync.py @@ -143,7 +143,8 @@ class TDTestCase: stableName= '%s_%d'%(paraDict['stbName'],i) newTdSql=tdCom.newTdSql() threads.append(threading.Thread(target=clusterComCreate.insert_data, args=(newTdSql, paraDict["dbName"],stableName,paraDict["ctbNum"],paraDict["rowsPerTbl"],paraDict["batchNum"],paraDict["startTs"]))) - threads.append(threading.Thread(target=self.reCreateUser,args=(newTdSql,i,"user","passwd"))) + createTdSql=tdCom.newTdSql() + threads.append(threading.Thread(target=self.reCreateUser,args=(createTdSql,i,"user","passwd"))) for tr in threads: tr.start() From ca624678b139a3d657122d3921b8f4d81a1834d4 Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Tue, 28 Feb 2023 17:28:23 +0800 Subject: [PATCH 014/174] fix: a plan error of set operator subquery --- source/libs/parser/src/parCalcConst.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/source/libs/parser/src/parCalcConst.c b/source/libs/parser/src/parCalcConst.c index 5afd61a054..b2fc88add1 100644 --- a/source/libs/parser/src/parCalcConst.c +++ b/source/libs/parser/src/parCalcConst.c @@ -339,11 +339,33 @@ static void eraseSetOpChildProjection(SSetOperator* pSetOp, int32_t index) { nodesListErase(pRightProjs, nodesListGetCell(pRightProjs, index)); } +typedef struct SNotRefByOrderByCxt { + SColumnNode* pCol; + bool hasThisCol; +} SNotRefByOrderByCxt; + +static EDealRes notRefByOrderByImpl(SNode* pNode, void* pContext) { + if (QUERY_NODE_COLUMN == nodeType(pNode)) { + SNotRefByOrderByCxt* pCxt = (SNotRefByOrderByCxt*)pContext; + if (nodesEqualNode((SNode*)pCxt->pCol, pNode)) { + pCxt->hasThisCol = true; + return DEAL_RES_END; + } + } + return DEAL_RES_CONTINUE; +} + +static bool notRefByOrderBy(SColumnNode* pCol, SNodeList* pOrderByList) { + SNotRefByOrderByCxt cxt = {.pCol = pCol, .hasThisCol = false}; + nodesWalkExprs(pOrderByList, notRefByOrderByImpl, &cxt); + return !cxt.hasThisCol; +} + static int32_t calcConstSetOpProjections(SCalcConstContext* pCxt, SSetOperator* pSetOp, bool subquery) { int32_t index = 0; SNode* pProj = NULL; WHERE_EACH(pProj, pSetOp->pProjectionList) { - if (subquery && isUselessCol((SExprNode*)pProj)) { + if (subquery && notRefByOrderBy((SColumnNode*)pProj, pSetOp->pOrderByList) && isUselessCol((SExprNode*)pProj)) { ERASE_NODE(pSetOp->pProjectionList); eraseSetOpChildProjection(pSetOp, index); continue; From 3249b838905acab2e3cafd70de8e9152ef5704f1 Mon Sep 17 00:00:00 2001 From: Alex Duan <417921451@qq.com> Date: Tue, 28 Feb 2023 17:38:35 +0800 Subject: [PATCH 015/174] fix: destroy node with wrong type coversion --- source/libs/nodes/src/nodesUtilFuncs.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/source/libs/nodes/src/nodesUtilFuncs.c b/source/libs/nodes/src/nodesUtilFuncs.c index 024130b5f8..22afc7ef55 100644 --- a/source/libs/nodes/src/nodesUtilFuncs.c +++ b/source/libs/nodes/src/nodesUtilFuncs.c @@ -963,8 +963,6 @@ void nodesDestroyNode(SNode* pNode) { case QUERY_NODE_SHOW_USERS_STMT: 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_TOPICS_STMT: case QUERY_NODE_SHOW_CONSUMERS_STMT: case QUERY_NODE_SHOW_CONNECTIONS_STMT: From abbc69a2ed29a465ce464dfba04603c6b60aa1f1 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Mon, 27 Feb 2023 18:59:38 +0800 Subject: [PATCH 016/174] fix:asan error --- source/dnode/mnode/impl/src/mndStream.c | 2 +- tests/script/tsim/stream/basic1.sim | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/source/dnode/mnode/impl/src/mndStream.c b/source/dnode/mnode/impl/src/mndStream.c index 2a05511134..b7f80f6b0e 100644 --- a/source/dnode/mnode/impl/src/mndStream.c +++ b/source/dnode/mnode/impl/src/mndStream.c @@ -1223,7 +1223,7 @@ static int32_t mndRetrieveStreamTask(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock // node id pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); - int32_t nodeId = TMAX(pTask->nodeId, 0); + int64_t nodeId = TMAX(pTask->nodeId, 0); colDataSetVal(pColInfo, numOfRows, (const char *)&nodeId, false); // level diff --git a/tests/script/tsim/stream/basic1.sim b/tests/script/tsim/stream/basic1.sim index c61c7667f8..a8f04aac64 100644 --- a/tests/script/tsim/stream/basic1.sim +++ b/tests/script/tsim/stream/basic1.sim @@ -887,4 +887,20 @@ if $rows != 1 then goto loop19 endi +print select * from information_schema.ins_stream_tasks; +sql select * from information_schema.ins_stream_tasks; + +if $rows == 0 then + print =====rows=$rows + return -1 +endi + +print select * from information_schema.ins_streams; +sql select * from information_schema.ins_streams; + +if $rows == 0 then + print =====rows=$rows + return -1 +endi + system sh/exec.sh -n dnode1 -s stop -x SIGINT From fe4123e814db9f76460df070d84186361b937a6a Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Tue, 28 Feb 2023 14:19:21 +0800 Subject: [PATCH 017/174] feat:window close && ignore expired --- include/common/tmsg.h | 2 +- source/libs/parser/src/parAstCreater.c | 2 +- source/libs/parser/test/parInitialCTest.cpp | 10 ++----- tests/script/tsim/stream/basic1.sim | 16 +++++----- tests/script/tsim/stream/deleteInterval.sim | 6 ++-- tests/script/tsim/stream/deleteSession.sim | 10 +++---- tests/script/tsim/stream/deleteState.sim | 6 ++-- .../stream/distributeIntervalRetrive0.sim | 4 +-- .../script/tsim/stream/distributeSession0.sim | 2 +- .../script/tsim/stream/fillHistoryBasic1.sim | 4 +-- .../script/tsim/stream/fillHistoryBasic2.sim | 6 ++-- .../script/tsim/stream/fillHistoryBasic3.sim | 2 +- .../tsim/stream/fillIntervalDelete0.sim | 20 ++++++------- .../tsim/stream/fillIntervalDelete1.sim | 30 +++++++++---------- .../script/tsim/stream/fillIntervalLinear.sim | 6 ++-- .../tsim/stream/fillIntervalPartitionBy.sim | 10 +++---- .../tsim/stream/fillIntervalPrevNext.sim | 8 ++--- .../tsim/stream/fillIntervalPrevNext1.sim | 4 +-- .../script/tsim/stream/fillIntervalRange.sim | 6 ++-- .../script/tsim/stream/fillIntervalValue.sim | 12 ++++---- .../script/tsim/stream/ignoreCheckUpdate.sim | 4 +-- tests/script/tsim/stream/partitionby.sim | 6 ++-- tests/script/tsim/stream/partitionby1.sim | 6 ++-- .../tsim/stream/partitionbyColumnInterval.sim | 10 +++---- .../tsim/stream/partitionbyColumnSession.sim | 8 ++--- .../tsim/stream/partitionbyColumnState.sim | 4 +-- tests/script/tsim/stream/schedSnode.sim | 2 +- tests/script/tsim/stream/session0.sim | 18 +++++------ tests/script/tsim/stream/session1.sim | 4 +-- tests/script/tsim/stream/sliding.sim | 20 ++++++------- tests/script/tsim/stream/state0.sim | 20 ++++++------- tests/script/tsim/stream/triggerInterval0.sim | 2 +- tests/script/tsim/stream/triggerSession0.sim | 2 +- tests/script/tsim/stream/udTableAndTag0.sim | 12 ++++---- tests/script/tsim/stream/udTableAndTag1.sim | 10 +++---- tests/script/tsim/stream/udTableAndTag2.sim | 14 ++++----- .../system-test/1-insert/database_pre_suf.py | 2 +- tests/system-test/1-insert/drop.py | 8 ++--- utils/test/c/tmq_taosx_ci.c | 2 +- 39 files changed, 158 insertions(+), 162 deletions(-) diff --git a/include/common/tmsg.h b/include/common/tmsg.h index cd63f7d278..d6a301c38b 100644 --- a/include/common/tmsg.h +++ b/include/common/tmsg.h @@ -1812,7 +1812,7 @@ typedef struct { #define STREAM_TRIGGER_AT_ONCE 1 #define STREAM_TRIGGER_WINDOW_CLOSE 2 #define STREAM_TRIGGER_MAX_DELAY 3 -#define STREAM_DEFAULT_IGNORE_EXPIRED 0 +#define STREAM_DEFAULT_IGNORE_EXPIRED 1 #define STREAM_FILL_HISTORY_ON 1 #define STREAM_FILL_HISTORY_OFF 0 #define STREAM_DEFAULT_FILL_HISTORY STREAM_FILL_HISTORY_OFF diff --git a/source/libs/parser/src/parAstCreater.c b/source/libs/parser/src/parAstCreater.c index f613b1bd3d..634a239399 100644 --- a/source/libs/parser/src/parAstCreater.c +++ b/source/libs/parser/src/parAstCreater.c @@ -1810,7 +1810,7 @@ SNode* createStreamOptions(SAstCreateContext* pCxt) { CHECK_PARSER_STATUS(pCxt); SStreamOptions* pOptions = (SStreamOptions*)nodesMakeNode(QUERY_NODE_STREAM_OPTIONS); CHECK_OUT_OF_MEM(pOptions); - pOptions->triggerType = STREAM_TRIGGER_AT_ONCE; + pOptions->triggerType = STREAM_TRIGGER_WINDOW_CLOSE; pOptions->fillHistory = STREAM_DEFAULT_FILL_HISTORY; pOptions->ignoreExpired = STREAM_DEFAULT_IGNORE_EXPIRED; pOptions->ignoreUpdate = STREAM_DEFAULT_IGNORE_UPDATE; diff --git a/source/libs/parser/test/parInitialCTest.cpp b/source/libs/parser/test/parInitialCTest.cpp index 8ba5802ad6..2dac35590e 100644 --- a/source/libs/parser/test/parInitialCTest.cpp +++ b/source/libs/parser/test/parInitialCTest.cpp @@ -781,16 +781,10 @@ TEST_F(ParserInitialCTest, createStream) { snprintf(expect.targetStbFullName, sizeof(expect.targetStbFullName), "0.test.%s", pDstStb); expect.igExists = igExists; expect.sql = taosStrdup(pSql); - expect.createStb = STREAM_CREATE_STABLE_TRUE; - expect.triggerType = STREAM_TRIGGER_AT_ONCE; - expect.maxDelay = 0; - expect.watermark = 0; - expect.fillHistory = STREAM_DEFAULT_FILL_HISTORY; - expect.igExpired = STREAM_DEFAULT_IGNORE_EXPIRED; }; auto setStreamOptions = - [&](int8_t createStb = STREAM_CREATE_STABLE_TRUE, int8_t triggerType = STREAM_TRIGGER_AT_ONCE, + [&](int8_t createStb = STREAM_CREATE_STABLE_TRUE, int8_t triggerType = STREAM_TRIGGER_WINDOW_CLOSE, int64_t maxDelay = 0, int64_t watermark = 0, int8_t igExpired = STREAM_DEFAULT_IGNORE_EXPIRED, int8_t fillHistory = STREAM_DEFAULT_FILL_HISTORY, int8_t igUpdate = STREAM_DEFAULT_IGNORE_UPDATE) { expect.createStb = createStb; @@ -852,6 +846,7 @@ TEST_F(ParserInitialCTest, createStream) { }); setCreateStreamReq("s1", "test", "create stream s1 into st3 as select count(*) from t1 interval(10s)", "st3"); + setStreamOptions(); run("CREATE STREAM s1 INTO st3 AS SELECT COUNT(*) FROM t1 INTERVAL(10S)"); clearCreateStreamReq(); @@ -872,6 +867,7 @@ TEST_F(ParserInitialCTest, createStream) { "st3"); addTag("tname", TSDB_DATA_TYPE_VARCHAR, 10 + VARSTR_HEADER_SIZE); addTag("id", TSDB_DATA_TYPE_INT); + setStreamOptions(); run("CREATE STREAM s1 INTO st3 TAGS(tname VARCHAR(10), id INT) SUBTABLE(CONCAT('new-', tname)) " "AS SELECT _WSTART wstart, COUNT(*) cnt FROM st1 PARTITION BY TBNAME tname, tag1 id INTERVAL(10S)"); clearCreateStreamReq(); diff --git a/tests/script/tsim/stream/basic1.sim b/tests/script/tsim/stream/basic1.sim index a8f04aac64..e69875d69f 100644 --- a/tests/script/tsim/stream/basic1.sim +++ b/tests/script/tsim/stream/basic1.sim @@ -17,7 +17,7 @@ sql use test; sql create table t1(ts timestamp, a int, b int , c int, d double); -sql create stream streams1 trigger at_once into streamt as select _wstart, count(*) c1, count(d) c2 , sum(a) c3 , max(b) c4, min(c) c5 from t1 interval(10s); +sql create stream streams1 trigger at_once IGNORE EXPIRED 0 into streamt as select _wstart, count(*) c1, count(d) c2 , sum(a) c3 , max(b) c4, min(c) c5 from t1 interval(10s); sql insert into t1 values(1648791213000,1,2,3,1.0); sql insert into t1 values(1648791223001,2,2,3,1.1); sql insert into t1 values(1648791233002,3,2,3,2.1); @@ -545,8 +545,8 @@ sql create table t2 using st tags(2,2,2); sql create table t3 using st tags(2,2,2); sql create table t4 using st tags(2,2,2); sql create table t5 using st tags(2,2,2); -sql create stream streams2 trigger at_once into streamt as select _wstart, count(*) c1, sum(a) c3,max(b) c4 from st partition by tbname interval(10s); -sql create stream streams3 trigger at_once into streamt3 as select _wstart, count(*) c1, sum(a) c3,max(b) c4, now c5 from st partition by tbname interval(10s); +sql create stream streams2 trigger at_once IGNORE EXPIRED 0 into streamt as select _wstart, count(*) c1, sum(a) c3,max(b) c4 from st partition by tbname interval(10s); +sql create stream streams3 trigger at_once IGNORE EXPIRED 0 into streamt3 as select _wstart, count(*) c1, sum(a) c3,max(b) c4, now c5 from st partition by tbname interval(10s); sql insert into t1 values(1648791213000,1,1,1,1.0) t2 values(1648791213000,2,2,2,2.0) t3 values(1648791213000,3,3,3,3.0) t4 values(1648791213000,4,4,4,4.0); @@ -667,7 +667,7 @@ sql create database test3 vgroups 1; sql use test3; sql create stable st(ts timestamp, a int, b int , c int) tags(ta int,tb int,tc int); sql create table ts1 using st tags(1,1,1); -sql create stream stream_t3 trigger at_once into streamtST3 as select ts, min(a) c6, a, b, c, ta, tb, tc from ts1 interval(10s) ; +sql create stream stream_t3 trigger at_once IGNORE EXPIRED 0 into streamtST3 as select ts, min(a) c6, a, b, c, ta, tb, tc from ts1 interval(10s) ; sql insert into ts1 values(1648791211000,1,2,3); sleep 50 @@ -701,7 +701,7 @@ endi sql create database test4 vgroups 1; sql use test4; sql create table t1(ts timestamp, a int, b int , c int, d double); -sql create stream streams4 trigger at_once into streamt4 as select _wstart, count(*) c1 from t1 where a > 5 interval(10s); +sql create stream streams4 trigger at_once IGNORE EXPIRED 0 into streamt4 as select _wstart, count(*) c1 from t1 where a > 5 interval(10s); sql insert into t1 values(1648791213000,1,2,3,1.0); $loop_count = 0 @@ -797,8 +797,8 @@ sql create database test5 vgroups 1; sql use test5; sql create stable st(ts timestamp, a int, b int , c int) tags(ta int,tb int,tc int); sql create table ts1 using st tags(1,1,1); -sql create stream streams5 trigger at_once into streamt5 as select count(*), _wstart, _wend, max(a) from ts1 interval(10s) ; -sql create stream streams6 trigger at_once into streamt6 as select count(*), _wstart, _wend, max(a), _wstart as ts from ts1 interval(10s) ; +sql create stream streams5 trigger at_once IGNORE EXPIRED 0 into streamt5 as select count(*), _wstart, _wend, max(a) from ts1 interval(10s) ; +sql create stream streams6 trigger at_once IGNORE EXPIRED 0 into streamt6 as select count(*), _wstart, _wend, max(a), _wstart as ts from ts1 interval(10s) ; sql_error create stream streams7 trigger at_once into streamt7 as select _wstart, count(*), _wstart, _wend, max(a) from ts1 interval(10s) ; sql_error create stream streams8 trigger at_once into streamt8 as select count(*), _wstart, _wstart, _wend, max(a) from ts1 interval(10s) ; @@ -840,7 +840,7 @@ sql create database test7 vgroups 1; sql use test7; sql create stable st(ts timestamp, a int, b int , c int) tags(ta int,tb int,tc int); sql create table ts1 using st tags(1,1,1); -sql create stream streams7 trigger at_once into streamt7 as select _wstart, count(*) from ts1 interval(10s) ; +sql create stream streams7 trigger at_once IGNORE EXPIRED 0 into streamt7 as select _wstart, count(*) from ts1 interval(10s) ; sql insert into ts1 values(1648791211000,1,2,3); sql_error insert into ts1 values(-1648791211000,1,2,3); diff --git a/tests/script/tsim/stream/deleteInterval.sim b/tests/script/tsim/stream/deleteInterval.sim index 7532b2d5de..9540e448d4 100644 --- a/tests/script/tsim/stream/deleteInterval.sim +++ b/tests/script/tsim/stream/deleteInterval.sim @@ -16,7 +16,7 @@ sql drop database if exists test; sql create database test vgroups 1; sql use test; sql create table t1(ts timestamp, a int, b int , c int, d double); -sql create stream streams0 trigger at_once into streamt as select _wstart c1, count(*) c2, max(a) c3 from t1 interval(10s); +sql create stream streams0 trigger at_once IGNORE EXPIRED 0 into streamt as select _wstart c1, count(*) c2, max(a) c3 from t1 interval(10s); sql insert into t1 values(1648791213000,NULL,NULL,NULL,NULL); sleep 200 @@ -193,7 +193,7 @@ sql use test2; sql create stable st(ts timestamp, a int, b int, c int, d double) tags(ta int,tb int,tc int); sql create table t1 using st tags(1,1,1); sql create table t2 using st tags(2,2,2); -sql create stream streams2 trigger at_once into test.streamt2 as select _wstart c1, count(*) c2, max(a) c3 from st interval(10s); +sql create stream streams2 trigger at_once IGNORE EXPIRED 0 into test.streamt2 as select _wstart c1, count(*) c2, max(a) c3 from st interval(10s); sql insert into t1 values(1648791213000,NULL,NULL,NULL,NULL); sql insert into t2 values(1648791213000,NULL,NULL,NULL,NULL); @@ -419,7 +419,7 @@ sql use test3; sql create stable st(ts timestamp, a int, b int, c int, d double) tags(ta int,tb int,tc int); sql create table t1 using st tags(1,1,1); sql create table t2 using st tags(2,2,2); -sql create stream streams3 trigger at_once into test.streamt3 as select _wstart c1, count(*) c2, max(a) c3 from st interval(10s); +sql create stream streams3 trigger at_once IGNORE EXPIRED 0 into test.streamt3 as select _wstart c1, count(*) c2, max(a) c3 from st interval(10s); sql insert into t1 values(1648791213000,NULL,NULL,NULL,NULL); sql insert into t2 values(1648791213000,NULL,NULL,NULL,NULL); diff --git a/tests/script/tsim/stream/deleteSession.sim b/tests/script/tsim/stream/deleteSession.sim index c3c64a5977..3645939178 100644 --- a/tests/script/tsim/stream/deleteSession.sim +++ b/tests/script/tsim/stream/deleteSession.sim @@ -16,7 +16,7 @@ sql drop database if exists test; sql create database test vgroups 1; sql use test; sql create table t1(ts timestamp, a int, b int , c int, d double); -sql create stream streams0 trigger at_once into streamt as select _wstart c1, count(*) c2, max(a) c3 from t1 session(ts, 5s); +sql create stream streams0 trigger at_once IGNORE EXPIRED 0 into streamt as select _wstart c1, count(*) c2, max(a) c3 from t1 session(ts, 5s); sql insert into t1 values(1648791213000,NULL,NULL,NULL,NULL); sleep 200 @@ -191,7 +191,7 @@ sql use test2; sql create stable st(ts timestamp, a int, b int, c int, d double) tags(ta int,tb int,tc int); sql create table t1 using st tags(1,1,1); sql create table t2 using st tags(2,2,2); -sql create stream streams2 trigger at_once into test.streamt2 as select _wstart c1, count(*) c2, max(a) c3 from st session(ts,5s); +sql create stream streams2 trigger at_once IGNORE EXPIRED 0 into test.streamt2 as select _wstart c1, count(*) c2, max(a) c3 from st session(ts,5s); sql insert into t1 values(1648791213000,NULL,NULL,NULL,NULL); sql insert into t2 values(1648791213000,NULL,NULL,NULL,NULL); @@ -422,7 +422,7 @@ sql use test3; sql create stable st(ts timestamp, a int, b int, c int, d double) tags(ta int,tb int,tc int); sql create table t1 using st tags(1,1,1); sql create table t2 using st tags(2,2,2); -sql create stream streams3 trigger at_once into test.streamt3 as select _wstart c1, count(*) c2, max(a) c3 from st session(ts,5s); +sql create stream streams3 trigger at_once IGNORE EXPIRED 0 into test.streamt3 as select _wstart c1, count(*) c2, max(a) c3 from st session(ts,5s); sql insert into t1 values(1648791210000,1,1,1,NULL); sql insert into t1 values(1648791210001,2,2,2,NULL); @@ -532,8 +532,8 @@ sql create stable st(ts timestamp,a int,b int,c int) tags(ta int,tb int,tc int); sql create table t1 using st tags(1,1,1); sql create table t2 using st tags(2,2,2); -print create stream streams4 trigger at_once into streamt4 as select _wstart, count(*) c1 from st partition by tbname session(ts, 2s); -sql create stream streams4 trigger at_once into streamt4 as select _wstart, count(*) c1 from st partition by tbname session(ts, 2s); +print create stream streams4 trigger at_once IGNORE EXPIRED 0 into streamt4 as select _wstart, count(*) c1 from st partition by tbname session(ts, 2s); +sql create stream streams4 trigger at_once IGNORE EXPIRED 0 into streamt4 as select _wstart, count(*) c1 from st partition by tbname session(ts, 2s); sql insert into t1 values(1648791210000,1,2,3); sql insert into t1 values(1648791220000,2,2,3); diff --git a/tests/script/tsim/stream/deleteState.sim b/tests/script/tsim/stream/deleteState.sim index 45d9bc3e39..dd74b73dce 100644 --- a/tests/script/tsim/stream/deleteState.sim +++ b/tests/script/tsim/stream/deleteState.sim @@ -16,7 +16,7 @@ sql drop database if exists test; sql create database test vgroups 1; sql use test; sql create table t1(ts timestamp, a int, b int , c int, d double); -sql create stream streams0 trigger at_once into streamt as select _wstart c1, count(*) c2, max(b) c3 from t1 state_window(a); +sql create stream streams0 trigger at_once IGNORE EXPIRED 0 into streamt as select _wstart c1, count(*) c2, max(b) c3 from t1 state_window(a); sql insert into t1 values(1648791213000,NULL,NULL,NULL,NULL); sleep 200 @@ -197,8 +197,8 @@ sql create stable st(ts timestamp,a int,b int,c int) tags(ta int,tb int,tc int); sql create table t1 using st tags(1,1,1); sql create table t2 using st tags(2,2,2); -print create stream streams4 trigger at_once into streamt4 as select _wstart, count(*) c1 from st partition by tbname state_window(c); -sql create stream streams4 trigger at_once into streamt4 as select _wstart, count(*) c1 from st partition by tbname state_window(c); +print create stream streams4 trigger at_once IGNORE EXPIRED 0 into streamt4 as select _wstart, count(*) c1 from st partition by tbname state_window(c); +sql create stream streams4 trigger at_once IGNORE EXPIRED 0 into streamt4 as select _wstart, count(*) c1 from st partition by tbname state_window(c); sql insert into t1 values(1648791210000,1,2,1); sql insert into t1 values(1648791220000,2,2,2); diff --git a/tests/script/tsim/stream/distributeIntervalRetrive0.sim b/tests/script/tsim/stream/distributeIntervalRetrive0.sim index ae2f9afdb5..529a2a1b30 100644 --- a/tests/script/tsim/stream/distributeIntervalRetrive0.sim +++ b/tests/script/tsim/stream/distributeIntervalRetrive0.sim @@ -44,7 +44,7 @@ sql create table ts1 using st tags(1,1,1); sql create table ts2 using st tags(2,2,2); sql create table ts3 using st tags(3,2,2); sql create table ts4 using st tags(4,2,2); -sql create stream stream_t1 trigger at_once into streamtST1 as select _wstart, count(*) c1, sum(a) c3 , max(b) c4, min(c) c5 from st interval(10s); +sql create stream stream_t1 trigger at_once IGNORE EXPIRED 0 into streamtST1 as select _wstart, count(*) c1, sum(a) c3 , max(b) c4, min(c) c5 from st interval(10s); sleep 1000 @@ -243,7 +243,7 @@ sql use test1; sql create stable st(ts timestamp,a int,b int,c int) tags(ta int,tb int,tc int); sql create table t1 using st tags(1,1,1); sql create table t2 using st tags(2,2,2); -sql create stream streams1 trigger at_once into streamt1 as select _wstart as c0, count(*) c1, count(a) c2 from st interval(10s) ; +sql create stream streams1 trigger at_once IGNORE EXPIRED 0 into streamt1 as select _wstart as c0, count(*) c1, count(a) c2 from st interval(10s) ; sql insert into t1 values(1648791211000,1,2,3); diff --git a/tests/script/tsim/stream/distributeSession0.sim b/tests/script/tsim/stream/distributeSession0.sim index d752f5c29c..25ac479a38 100644 --- a/tests/script/tsim/stream/distributeSession0.sim +++ b/tests/script/tsim/stream/distributeSession0.sim @@ -39,7 +39,7 @@ sql use test; sql create stable st(ts timestamp,a int,b int,c int) tags(ta int,tb int,tc int); sql create table ts1 using st tags(1,1,1); sql create table ts2 using st tags(2,2,2); -sql create stream stream_t1 trigger at_once into streamtST as select _wstart, count(*) c1, sum(a) c2 , max(b) c3 from st session(ts, 10s) ; +sql create stream stream_t1 trigger at_once IGNORE EXPIRED 0 into streamtST as select _wstart, count(*) c1, sum(a) c2 , max(b) c3 from st session(ts, 10s) ; sleep 1000 diff --git a/tests/script/tsim/stream/fillHistoryBasic1.sim b/tests/script/tsim/stream/fillHistoryBasic1.sim index 772a09c017..e7a8da90e2 100644 --- a/tests/script/tsim/stream/fillHistoryBasic1.sim +++ b/tests/script/tsim/stream/fillHistoryBasic1.sim @@ -17,7 +17,7 @@ sql use test; sql create table t1(ts timestamp, a int, b int , c int, d double); -sql create stream stream1 trigger at_once fill_history 1 into streamt as select _wstart, count(*) c1, count(d) c2 , sum(a) c3 , max(b) c4, min(c) c5 from t1 interval(10s); +sql create stream stream1 trigger at_once fill_history 1 IGNORE EXPIRED 0 into streamt as select _wstart, count(*) c1, count(d) c2 , sum(a) c3 , max(b) c4, min(c) c5 from t1 interval(10s); sql insert into t1 values(1648791213000,1,2,3,1.0); sql insert into t1 values(1648791223001,2,2,3,1.1); @@ -479,7 +479,7 @@ sql insert into t1 values(1648791233002,3,2,3,2.1); sql insert into t1 values(1648791243003,4,2,3,3.1); sql insert into t1 values(1648791213004,4,2,3,4.1); -sql create stream stream2 trigger at_once fill_history 1 into streamt as select _wstart, count(*) c1, count(d) c2 , sum(a) c3 , max(b) c4, min(c) c5 from t1 interval(10s); +sql create stream stream2 trigger at_once fill_history 1 IGNORE EXPIRED 0 into streamt as select _wstart, count(*) c1, count(d) c2 , sum(a) c3 , max(b) c4, min(c) c5 from t1 interval(10s); sleep 5000 sql select `_wstart`, c1, c2 ,c3 ,c4, c5 from streamt; diff --git a/tests/script/tsim/stream/fillHistoryBasic2.sim b/tests/script/tsim/stream/fillHistoryBasic2.sim index 3af198259d..2f6c3ea92d 100644 --- a/tests/script/tsim/stream/fillHistoryBasic2.sim +++ b/tests/script/tsim/stream/fillHistoryBasic2.sim @@ -79,7 +79,7 @@ sql insert into ts3 values(1648791243005,4,42,3,3.1) (1648791243003,4,2,33,3.1) sql insert into ts4 values(1648791243005,4,42,3,3.1) (1648791243003,4,2,33,3.1) (1648791243006,4,2,3,3.1) (1648791213001,1,52,13,1.0) (1648791223001,22,22,83,1.1) (1648791233004,13,12,13,2.1) ; sql insert into ts3 values(1648791243006,4,2,3,3.1) (1648791213001,1,52,13,1.0) (1648791223001,22,22,83,1.1) ; -sql create stream stream_t1 trigger at_once fill_history 1 watermark 1d into streamtST1 as select _wstart, count(*) c1, count(d) c2 , sum(a) c3 , max(b) c4, min(c) c5 from st interval(10s); +sql create stream stream_t1 trigger at_once fill_history 1 watermark 1d IGNORE EXPIRED 0 into streamtST1 as select _wstart, count(*) c1, count(d) c2 , sum(a) c3 , max(b) c4, min(c) c5 from st interval(10s); sleep 1000 @@ -211,7 +211,7 @@ sql insert into ts1 values(1648791222001,2,2,3); sql insert into ts2 values(1648791211000,1,2,3); sql insert into ts2 values(1648791222001,2,2,3); -sql create stream stream_t2 trigger at_once fill_history 1 watermark 20s into streamtST1 as select _wstart, count(*) c1, count(a) c2 , sum(a) c3 , max(b) c5, min(c) c6 from st interval(10s) ; +sql create stream stream_t2 trigger at_once fill_history 1 watermark 20s IGNORE EXPIRED 0 into streamtST1 as select _wstart, count(*) c1, count(a) c2 , sum(a) c3 , max(b) c5, min(c) c6 from st interval(10s) ; $loop_count = 0 loop2: @@ -241,7 +241,7 @@ sql use test3; sql create stable st(ts timestamp, a int, b int , c int) tags(ta int,tb int,tc int); sql create table ts1 using st tags(1,1,1); sql create table ts2 using st tags(2,2,2); -sql create stream stream_t3 trigger at_once into streamtST3 as select ts, min(a) c6, a, b, c, ta, tb, tc from st interval(10s) ; +sql create stream stream_t3 trigger at_once IGNORE EXPIRED 0 into streamtST3 as select ts, min(a) c6, a, b, c, ta, tb, tc from st interval(10s) ; sql insert into ts1 values(1648791211000,1,2,3); sleep 50 diff --git a/tests/script/tsim/stream/fillHistoryBasic3.sim b/tests/script/tsim/stream/fillHistoryBasic3.sim index db8d6bc2d0..44d7ee9d9e 100644 --- a/tests/script/tsim/stream/fillHistoryBasic3.sim +++ b/tests/script/tsim/stream/fillHistoryBasic3.sim @@ -17,7 +17,7 @@ sql create table t2 using st tags(2,2,2); sql insert into t1 values(1648791213000,NULL,NULL,NULL,NULL); sql insert into t2 values(1648791213000,NULL,NULL,NULL,NULL); -sql create stream streams2 trigger at_once fill_history 1 into test.streamt2 as select _wstart c1, count(*) c2, max(a) c3 from st partition by a interval(10s); +sql create stream streams2 trigger at_once fill_history 1 IGNORE EXPIRED 0 into test.streamt2 as select _wstart c1, count(*) c2, max(a) c3 from st partition by a interval(10s); sleep 3000 diff --git a/tests/script/tsim/stream/fillIntervalDelete0.sim b/tests/script/tsim/stream/fillIntervalDelete0.sim index 1c0647d57b..41b018a862 100644 --- a/tests/script/tsim/stream/fillIntervalDelete0.sim +++ b/tests/script/tsim/stream/fillIntervalDelete0.sim @@ -16,11 +16,11 @@ sql drop database if exists test1; sql create database test1 vgroups 1; sql use test1; sql create table t1(ts timestamp, a int, b int , c int, d double, s varchar(20)); -sql create stream streams1 trigger at_once into streamt1 as select _wstart as ts, max(a), sum(b), count(*) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(NULL); -sql create stream streams2 trigger at_once into streamt2 as select _wstart as ts, max(a), sum(b), count(*) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(value,100,200,300); -sql create stream streams3 trigger at_once into streamt3 as select _wstart as ts, max(a), sum(b), count(*) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(next); -sql create stream streams4 trigger at_once into streamt4 as select _wstart as ts, max(a), sum(b), count(*) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(prev); -sql create stream streams5 trigger at_once into streamt5 as select _wstart as ts, max(a), sum(b), count(*) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(linear); +sql create stream streams1 trigger at_once IGNORE EXPIRED 0 into streamt1 as select _wstart as ts, max(a), sum(b), count(*) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(NULL); +sql create stream streams2 trigger at_once IGNORE EXPIRED 0 into streamt2 as select _wstart as ts, max(a), sum(b), count(*) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(value,100,200,300); +sql create stream streams3 trigger at_once IGNORE EXPIRED 0 into streamt3 as select _wstart as ts, max(a), sum(b), count(*) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(next); +sql create stream streams4 trigger at_once IGNORE EXPIRED 0 into streamt4 as select _wstart as ts, max(a), sum(b), count(*) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(prev); +sql create stream streams5 trigger at_once IGNORE EXPIRED 0 into streamt5 as select _wstart as ts, max(a), sum(b), count(*) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(linear); sql insert into t1 values(1648791213000,1,1,1,1.0,'aaa'); sleep 200 @@ -256,11 +256,11 @@ sql use test6; sql create stable st(ts timestamp, a int, b int , c int, d double, s varchar(20)) tags(ta int,tb int,tc int); sql create table t1 using st tags(1,1,1); sql create table t2 using st tags(1,1,1); -sql create stream streams6 trigger at_once into streamt6 as select _wstart as ts, max(a), sum(b), count(*) from st where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(NULL); -sql create stream streams7 trigger at_once into streamt7 as select _wstart as ts, max(a), sum(b), count(*) from st where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(value,100,200,300); -sql create stream streams8 trigger at_once into streamt8 as select _wstart as ts, max(a), sum(b), count(*) from st where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(next); -sql create stream streams9 trigger at_once into streamt9 as select _wstart as ts, max(a), sum(b), count(*) from st where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(prev); -sql create stream streams10 trigger at_once into streamt10 as select _wstart as ts, max(a), sum(b), count(*) from st where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(linear); +sql create stream streams6 trigger at_once IGNORE EXPIRED 0 into streamt6 as select _wstart as ts, max(a), sum(b), count(*) from st where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(NULL); +sql create stream streams7 trigger at_once IGNORE EXPIRED 0 into streamt7 as select _wstart as ts, max(a), sum(b), count(*) from st where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(value,100,200,300); +sql create stream streams8 trigger at_once IGNORE EXPIRED 0 into streamt8 as select _wstart as ts, max(a), sum(b), count(*) from st where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(next); +sql create stream streams9 trigger at_once IGNORE EXPIRED 0 into streamt9 as select _wstart as ts, max(a), sum(b), count(*) from st where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(prev); +sql create stream streams10 trigger at_once IGNORE EXPIRED 0 into streamt10 as select _wstart as ts, max(a), sum(b), count(*) from st where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(linear); sql insert into t1 values(1648791210000,1,1,1,1.0,'aaa'); sql insert into t1 values(1648791217000,1,1,1,1.0,'aaa'); diff --git a/tests/script/tsim/stream/fillIntervalDelete1.sim b/tests/script/tsim/stream/fillIntervalDelete1.sim index 0206b88fdc..108f5f862d 100644 --- a/tests/script/tsim/stream/fillIntervalDelete1.sim +++ b/tests/script/tsim/stream/fillIntervalDelete1.sim @@ -18,11 +18,11 @@ sql drop database if exists test1; sql create database test1 vgroups 1; sql use test1; sql create table t1(ts timestamp, a int, b int , c int, d double, s varchar(20)); -sql create stream streams1 trigger at_once into streamt1 as select _wstart as ts, max(a), sum(b), count(*) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(NULL); -sql create stream streams2 trigger at_once into streamt2 as select _wstart as ts, max(a), sum(b), count(*) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(value,100,200,300); -sql create stream streams3 trigger at_once into streamt3 as select _wstart as ts, max(a), sum(b), count(*) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(next); -sql create stream streams4 trigger at_once into streamt4 as select _wstart as ts, max(a), sum(b), count(*) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(prev); -sql create stream streams5 trigger at_once into streamt5 as select _wstart as ts, max(a), sum(b), count(*) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(linear); +sql create stream streams1 trigger at_once IGNORE EXPIRED 0 into streamt1 as select _wstart as ts, max(a), sum(b), count(*) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(NULL); +sql create stream streams2 trigger at_once IGNORE EXPIRED 0 into streamt2 as select _wstart as ts, max(a), sum(b), count(*) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(value,100,200,300); +sql create stream streams3 trigger at_once IGNORE EXPIRED 0 into streamt3 as select _wstart as ts, max(a), sum(b), count(*) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(next); +sql create stream streams4 trigger at_once IGNORE EXPIRED 0 into streamt4 as select _wstart as ts, max(a), sum(b), count(*) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(prev); +sql create stream streams5 trigger at_once IGNORE EXPIRED 0 into streamt5 as select _wstart as ts, max(a), sum(b), count(*) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(linear); sql insert into t1 values(1648791210000,0,0,0,0.0,'aaa'); sql insert into t1 values(1648791213000,1,1,1,1.0,'bbb'); @@ -221,11 +221,11 @@ sql use test6; sql create stable st(ts timestamp, a int, b int , c int, d double, s varchar(20)) tags(ta int,tb int,tc int); sql create table t1 using st tags(1,1,1); sql create table t2 using st tags(1,1,1); -sql create stream streams6 trigger at_once into streamt6 as select _wstart as ts, max(a), sum(b), count(*) from st where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(NULL); -sql create stream streams7 trigger at_once into streamt7 as select _wstart as ts, max(a), sum(b), count(*) from st where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(value,100,200,300); -sql create stream streams8 trigger at_once into streamt8 as select _wstart as ts, max(a), sum(b), count(*) from st where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(next); -sql create stream streams9 trigger at_once into streamt9 as select _wstart as ts, max(a), sum(b), count(*) from st where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(prev); -sql create stream streams10 trigger at_once into streamt10 as select _wstart as ts, max(a), sum(b), count(*) from st where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(linear); +sql create stream streams6 trigger at_once IGNORE EXPIRED 0 into streamt6 as select _wstart as ts, max(a), sum(b), count(*) from st where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(NULL); +sql create stream streams7 trigger at_once IGNORE EXPIRED 0 into streamt7 as select _wstart as ts, max(a), sum(b), count(*) from st where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(value,100,200,300); +sql create stream streams8 trigger at_once IGNORE EXPIRED 0 into streamt8 as select _wstart as ts, max(a), sum(b), count(*) from st where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(next); +sql create stream streams9 trigger at_once IGNORE EXPIRED 0 into streamt9 as select _wstart as ts, max(a), sum(b), count(*) from st where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(prev); +sql create stream streams10 trigger at_once IGNORE EXPIRED 0 into streamt10 as select _wstart as ts, max(a), sum(b), count(*) from st where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(linear); sql insert into t1 values(1648791210000,1,1,1,1.0,'aaa'); sql insert into t1 values(1648791215000,6,8,8,8.0,'bbb'); @@ -353,11 +353,11 @@ sql drop database if exists test7; sql create database test7 vgroups 1; sql use test7; sql create table t1(ts timestamp, a int, b int , c int, d double, s varchar(20)); -sql create stream streams11 trigger at_once into streamt11 as select _wstart as ts, avg(a), count(*), timezone(), to_iso8601(1) from t1 where ts >= 1648791210000 and ts < 1648791240000 interval(1s) fill(NULL); -sql create stream streams12 trigger at_once into streamt12 as select _wstart as ts, avg(a), count(*), timezone(), to_iso8601(1) from t1 where ts >= 1648791210000 and ts < 1648791240000 interval(1s) fill(value,100.0,200); -sql create stream streams13 trigger at_once into streamt13 as select _wstart as ts, avg(a), count(*), timezone(), to_iso8601(1) from t1 where ts >= 1648791210000 and ts < 1648791240000 interval(1s) fill(next); -sql create stream streams14 trigger at_once into streamt14 as select _wstart as ts, avg(a), count(*), timezone(), to_iso8601(1) from t1 where ts >= 1648791210000 and ts < 1648791240000 interval(1s) fill(prev); -sql create stream streams15 trigger at_once into streamt15 as select _wstart as ts, avg(a), count(*), timezone(), to_iso8601(1) from t1 where ts >= 1648791210000 and ts < 1648791240000 interval(1s) fill(linear); +sql create stream streams11 trigger at_once IGNORE EXPIRED 0 into streamt11 as select _wstart as ts, avg(a), count(*), timezone(), to_iso8601(1) from t1 where ts >= 1648791210000 and ts < 1648791240000 interval(1s) fill(NULL); +sql create stream streams12 trigger at_once IGNORE EXPIRED 0 into streamt12 as select _wstart as ts, avg(a), count(*), timezone(), to_iso8601(1) from t1 where ts >= 1648791210000 and ts < 1648791240000 interval(1s) fill(value,100.0,200); +sql create stream streams13 trigger at_once IGNORE EXPIRED 0 into streamt13 as select _wstart as ts, avg(a), count(*), timezone(), to_iso8601(1) from t1 where ts >= 1648791210000 and ts < 1648791240000 interval(1s) fill(next); +sql create stream streams14 trigger at_once IGNORE EXPIRED 0 into streamt14 as select _wstart as ts, avg(a), count(*), timezone(), to_iso8601(1) from t1 where ts >= 1648791210000 and ts < 1648791240000 interval(1s) fill(prev); +sql create stream streams15 trigger at_once IGNORE EXPIRED 0 into streamt15 as select _wstart as ts, avg(a), count(*), timezone(), to_iso8601(1) from t1 where ts >= 1648791210000 and ts < 1648791240000 interval(1s) fill(linear); sql insert into t1 values(1648791210000,1,1,1,1.0,'aaa'); diff --git a/tests/script/tsim/stream/fillIntervalLinear.sim b/tests/script/tsim/stream/fillIntervalLinear.sim index b9f301d81b..3fa369d8d5 100644 --- a/tests/script/tsim/stream/fillIntervalLinear.sim +++ b/tests/script/tsim/stream/fillIntervalLinear.sim @@ -16,7 +16,7 @@ sql drop database if exists test1; sql create database test1 vgroups 1; sql use test1; sql create table t1(ts timestamp, a int, b int , c int, d double, s varchar(20)); -sql create stream streams1 trigger at_once into streamt1 as select _wstart as ts, max(a)+sum(c), avg(b), first(s), count(*) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(linear); +sql create stream streams1 trigger at_once IGNORE EXPIRED 0 into streamt1 as select _wstart as ts, max(a)+sum(c), avg(b), first(s), count(*) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(linear); sql insert into t1 values(1648791213000,4,4,4,4.0,'aaa') (1648791216000,5,5,5,5.0,'bbb'); sql insert into t1 values(1648791210000,1,1,1,1.0,'ccc') (1648791219000,2,2,2,2.0,'ddd') (1648791222000,3,3,3,3.0,'eee'); @@ -205,7 +205,7 @@ sql drop database if exists test2; sql create database test2 vgroups 1; sql use test2; sql create table t1(ts timestamp, a int, b int , c int, d double, s varchar(20)); -sql create stream streams2 trigger at_once into streamt2 as select _wstart as ts, max(a)+sum(c), avg(b), first(s), count(*) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(linear); +sql create stream streams2 trigger at_once IGNORE EXPIRED 0 into streamt2 as select _wstart as ts, max(a)+sum(c), avg(b), first(s), count(*) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(linear); sql insert into t1 values(1648791210000,1,1,1,1.0,'ccc') (1648791219000,2,2,2,2.0,'ddd') (1648791222000,3,3,3,3.0,'eee'); sql insert into t1 values(1648791213000,4,4,4,4.0,'aaa') (1648791216000,5,5,5,5.0,'bbb'); @@ -393,7 +393,7 @@ sql drop database if exists test3; sql create database test3 vgroups 1; sql use test3; sql create table t1(ts timestamp, a int, b int , c int, d double, s varchar(20)); -sql create stream streams3 trigger at_once into streamt3 as select _wstart as ts, max(a), b+c, s, b+1, 1 from t1 where ts >= 1648791150000 and ts < 1648791261000 interval(1s) fill(linear); +sql create stream streams3 trigger at_once IGNORE EXPIRED 0 into streamt3 as select _wstart as ts, max(a), b+c, s, b+1, 1 from t1 where ts >= 1648791150000 and ts < 1648791261000 interval(1s) fill(linear); sql insert into t1 values(1648791215000,1,1,1,1.0,'aaa'); sql insert into t1 values(1648791217000,2,2,2,2.0,'bbb'); sql insert into t1 values(1648791211000,3,3,3,3.0,'ccc'); diff --git a/tests/script/tsim/stream/fillIntervalPartitionBy.sim b/tests/script/tsim/stream/fillIntervalPartitionBy.sim index 168452fdc8..6a11b9952c 100644 --- a/tests/script/tsim/stream/fillIntervalPartitionBy.sim +++ b/tests/script/tsim/stream/fillIntervalPartitionBy.sim @@ -18,11 +18,11 @@ sql use test1; sql create stable st(ts timestamp, a int, b int , c int, d double, s varchar(20)) tags(ta int,tb int,tc int); sql create table t1 using st tags(1,1,1); sql create table t2 using st tags(2,2,2); -sql create stream streams1 trigger at_once into streamt1 as select _wstart as ts, max(a) c1, sum(b), count(*) from st where ts >= 1648791210000 and ts < 1648791261000 partition by ta interval(1s) fill(NULL); -sql create stream streams2 trigger at_once into streamt2 as select _wstart as ts, max(a) c1, sum(b), count(*) from st where ts >= 1648791210000 and ts < 1648791261000 partition by ta interval(1s) fill(value,100,200,300); -sql create stream streams3 trigger at_once into streamt3 as select _wstart as ts, max(a) c1, sum(b), count(*) from st where ts >= 1648791210000 and ts < 1648791261000 partition by ta interval(1s) fill(next); -sql create stream streams4 trigger at_once into streamt4 as select _wstart as ts, max(a) c1, sum(b), count(*) from st where ts >= 1648791210000 and ts < 1648791261000 partition by ta interval(1s) fill(prev); -sql create stream streams5 trigger at_once into streamt5 as select _wstart as ts, max(a) c1, sum(b), count(*) from st where ts >= 1648791210000 and ts < 1648791261000 partition by ta interval(1s) fill(linear); +sql create stream streams1 trigger at_once IGNORE EXPIRED 0 into streamt1 as select _wstart as ts, max(a) c1, sum(b), count(*) from st where ts >= 1648791210000 and ts < 1648791261000 partition by ta interval(1s) fill(NULL); +sql create stream streams2 trigger at_once IGNORE EXPIRED 0 into streamt2 as select _wstart as ts, max(a) c1, sum(b), count(*) from st where ts >= 1648791210000 and ts < 1648791261000 partition by ta interval(1s) fill(value,100,200,300); +sql create stream streams3 trigger at_once IGNORE EXPIRED 0 into streamt3 as select _wstart as ts, max(a) c1, sum(b), count(*) from st where ts >= 1648791210000 and ts < 1648791261000 partition by ta interval(1s) fill(next); +sql create stream streams4 trigger at_once IGNORE EXPIRED 0 into streamt4 as select _wstart as ts, max(a) c1, sum(b), count(*) from st where ts >= 1648791210000 and ts < 1648791261000 partition by ta interval(1s) fill(prev); +sql create stream streams5 trigger at_once IGNORE EXPIRED 0 into streamt5 as select _wstart as ts, max(a) c1, sum(b), count(*) from st where ts >= 1648791210000 and ts < 1648791261000 partition by ta interval(1s) fill(linear); sql insert into t1 values(1648791210000,0,0,0,0.0,'aaa'); sql insert into t1 values(1648791213000,1,1,1,1.0,'bbb'); diff --git a/tests/script/tsim/stream/fillIntervalPrevNext.sim b/tests/script/tsim/stream/fillIntervalPrevNext.sim index 99f7dcb5cb..ec963e1d4a 100644 --- a/tests/script/tsim/stream/fillIntervalPrevNext.sim +++ b/tests/script/tsim/stream/fillIntervalPrevNext.sim @@ -15,8 +15,8 @@ sql drop database if exists test1; sql create database test1 vgroups 1; sql use test1; sql create table t1(ts timestamp, a int, b int , c int, d double, s varchar(20)); -sql create stream streams1 trigger at_once into streamt1 as select _wstart as ts, count(*) c1, max(b)+sum(a) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(prev); -sql create stream streams2 trigger at_once into streamt2 as select _wstart as ts, count(*) c1, max(a)+min(c), avg(b) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(next); +sql create stream streams1 trigger at_once IGNORE EXPIRED 0 into streamt1 as select _wstart as ts, count(*) c1, max(b)+sum(a) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(prev); +sql create stream streams2 trigger at_once IGNORE EXPIRED 0 into streamt2 as select _wstart as ts, count(*) c1, max(a)+min(c), avg(b) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(next); sql insert into t1 values(1648791213000,4,4,4,4.0,'aaa') (1648791215000,5,5,5,5.0,'aaa'); sql insert into t1 values(1648791211000,1,1,1,1.0,'aaa') (1648791217000,2,2,2,2.0,'aaa') (1648791220000,3,3,3,3.0,'aaa'); @@ -263,8 +263,8 @@ sql drop database if exists test5; sql create database test5 vgroups 1; sql use test5; sql create table t1(ts timestamp, a int, b int , c int, d double, s varchar(20)); -sql create stream streams5 trigger at_once into streamt5 as select _wstart as ts, count(*) c1, max(b)+sum(a) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(prev); -sql create stream streams6 trigger at_once into streamt6 as select _wstart as ts, count(*) c1, max(a)+min(c), avg(b) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(next); +sql create stream streams5 trigger at_once IGNORE EXPIRED 0 into streamt5 as select _wstart as ts, count(*) c1, max(b)+sum(a) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(prev); +sql create stream streams6 trigger at_once IGNORE EXPIRED 0 into streamt6 as select _wstart as ts, count(*) c1, max(a)+min(c), avg(b) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(next); sql insert into t1 values(1648791211000,1,1,1,1.0,'aaa') (1648791217000,2,2,2,2.0,'aaa') (1648791220000,3,3,3,3.0,'aaa'); sql insert into t1 values(1648791213000,4,4,4,4.0,'aaa') (1648791215000,5,5,5,5.0,'aaa'); diff --git a/tests/script/tsim/stream/fillIntervalPrevNext1.sim b/tests/script/tsim/stream/fillIntervalPrevNext1.sim index 8058065bcf..40ef895c5a 100644 --- a/tests/script/tsim/stream/fillIntervalPrevNext1.sim +++ b/tests/script/tsim/stream/fillIntervalPrevNext1.sim @@ -16,8 +16,8 @@ sql drop database if exists test7; sql create database test7 vgroups 1; sql use test7; sql create table t1(ts timestamp, a int, b int , c int, d double, s varchar(20)); -sql create stream streams7 trigger at_once into streamt7 as select _wstart as ts, max(a), b+c, s from t1 where ts >= 1648791150000 and ts < 1648791261000 interval(1s) fill(prev); -sql create stream streams8 trigger at_once into streamt8 as select _wstart as ts, max(a), 1, b+1 from t1 where ts >= 1648791150000 and ts < 1648791261000 interval(1s) fill(next); +sql create stream streams7 trigger at_once IGNORE EXPIRED 0 into streamt7 as select _wstart as ts, max(a), b+c, s from t1 where ts >= 1648791150000 and ts < 1648791261000 interval(1s) fill(prev); +sql create stream streams8 trigger at_once IGNORE EXPIRED 0 into streamt8 as select _wstart as ts, max(a), 1, b+1 from t1 where ts >= 1648791150000 and ts < 1648791261000 interval(1s) fill(next); sql insert into t1 values(1648791215000,1,1,1,1.0,'aaa'); sql insert into t1 values(1648791217000,2,2,2,2.0,'bbb'); sql insert into t1 values(1648791211000,3,3,3,3.0,'ccc'); diff --git a/tests/script/tsim/stream/fillIntervalRange.sim b/tests/script/tsim/stream/fillIntervalRange.sim index a0905141f2..0e0dfb46d8 100644 --- a/tests/script/tsim/stream/fillIntervalRange.sim +++ b/tests/script/tsim/stream/fillIntervalRange.sim @@ -13,7 +13,7 @@ sql create database test vgroups 1; sql use test; sql create table t1(ts timestamp, a int, b int , c int, d double, s varchar(20));; -sql create stream streams1 trigger at_once into streamt as select _wstart ts, count(*) c1 from t1 interval(1s) fill(NULL); +sql create stream streams1 trigger at_once IGNORE EXPIRED 0 into streamt as select _wstart ts, count(*) c1 from t1 interval(1s) fill(NULL); sql insert into t1 values(1648791211000,1,2,3,1.0,'aaa'); sleep 100 sql insert into t1 values(1648795308000,1,2,3,1.0,'aaa'); @@ -126,10 +126,10 @@ sql use test; sql create table t1(ts timestamp, a int, b int , c int, d double, s varchar(20)); print create stream streams1 trigger at_once into streamt as select _wstart ts, max(a) c1 from t1 interval(1s) fill(linear); -sql create stream streams1 trigger at_once into streamt as select _wstart ts, max(a) c1 from t1 interval(1s) fill(linear); +sql create stream streams1 trigger at_once IGNORE EXPIRED 0 into streamt as select _wstart ts, max(a) c1 from t1 interval(1s) fill(linear); print create stream streams2 trigger at_once into streamt2 as select _wstart ts, max(a) c1 from t1 interval(1s) fill(prev); -sql create stream streams2 trigger at_once into streamt2 as select _wstart ts, max(a) c1 from t1 interval(1s) fill(prev); +sql create stream streams2 trigger at_once IGNORE EXPIRED 0 into streamt2 as select _wstart ts, max(a) c1 from t1 interval(1s) fill(prev); sql insert into t1 values(1648791211000,1,2,3,1.0,'aaa'); sleep 100 diff --git a/tests/script/tsim/stream/fillIntervalValue.sim b/tests/script/tsim/stream/fillIntervalValue.sim index 2cd419397f..b447e9a559 100644 --- a/tests/script/tsim/stream/fillIntervalValue.sim +++ b/tests/script/tsim/stream/fillIntervalValue.sim @@ -13,8 +13,8 @@ sql create database test vgroups 1; sql use test; sql create table t1(ts timestamp, a int, b int , c int, d double, s varchar(20));; -sql create stream streams1 trigger at_once into streamt as select _wstart ts, count(*) c1 from t1 where ts > 1648791210000 and ts < 1648791413000 interval(10s) fill(value, 100); -sql create stream streams1a trigger at_once into streamta as select _wstart ts, count(*) c1 from t1 where ts > 1648791210000 and ts < 1648791413000 interval(10s) fill(value_f, 100); +sql create stream streams1 trigger at_once IGNORE EXPIRED 0 into streamt as select _wstart ts, count(*) c1 from t1 where ts > 1648791210000 and ts < 1648791413000 interval(10s) fill(value, 100); +sql create stream streams1a trigger at_once IGNORE EXPIRED 0 into streamta as select _wstart ts, count(*) c1 from t1 where ts > 1648791210000 and ts < 1648791413000 interval(10s) fill(value_f, 100); sql insert into t1 values(1648791213000,1,2,3,1.0,'aaa'); sleep 100 sql insert into t1 values(1648791233000,1,2,3,1.0,'aaa'); @@ -146,7 +146,7 @@ sql drop database if exists test2; sql create database test2 vgroups 1; sql use test2; sql create table t1(ts timestamp, a int, b int , c int, d double, s varchar(20)); -sql create stream streams2 trigger at_once into streamt2 as select _wstart as ts, count(*) c1, max(b)+sum(a) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(value, 100,200); +sql create stream streams2 trigger at_once IGNORE EXPIRED 0 into streamt2 as select _wstart as ts, count(*) c1, max(b)+sum(a) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(value, 100,200); sql insert into t1 values(1648791211000,1,1,1,1.0,'aaa') (1648791217000,2,2,2,2.0,'aaa') (1648791220000,3,3,3,3.0,'aaa'); sql insert into t1 values(1648791213000,4,4,4,4.0,'aaa') (1648791215000,5,5,5,5.0,'aaa'); @@ -280,7 +280,7 @@ sql drop database if exists test3; sql create database test3 vgroups 1; sql use test3; sql create table t1(ts timestamp, a int, b int , c int, d double, s varchar(20)); -sql create stream streams3 trigger at_once into streamt3 as select _wstart as ts, max(b), a+b, c from t1 where ts >= 1648791200000 and ts < 1648791261000 interval(10s) sliding(3s) fill(value, 100,200,300); +sql create stream streams3 trigger at_once IGNORE EXPIRED 0 into streamt3 as select _wstart as ts, max(b), a+b, c from t1 where ts >= 1648791200000 and ts < 1648791261000 interval(10s) sliding(3s) fill(value, 100,200,300); sql insert into t1 values(1648791220000,1,1,1,1.0,'aaa'); sleep 100 @@ -471,8 +471,8 @@ sql create stable st(ts timestamp,a int,b int,c int, d double, s varchar(20) ) t sql create table t1 using st tags(1,1,1); sql create table t2 using st tags(2,2,2); -sql create stream streams4 trigger at_once into streamt4 as select _wstart ts, count(*) c1, concat(tbname, 'aaa') as pname, timezone() from st where ts > 1648791000000 and ts < 1648793000000 partition by tbname interval(10s) fill(NULL); -sql create stream streams4a trigger at_once into streamt4a as select _wstart ts, count(*) c1, concat(tbname, 'aaa') as pname, timezone() from st where ts > 1648791000000 and ts < 1648793000000 partition by tbname interval(10s) fill(NULL_F); +sql create stream streams4 trigger at_once IGNORE EXPIRED 0 into streamt4 as select _wstart ts, count(*) c1, concat(tbname, 'aaa') as pname, timezone() from st where ts > 1648791000000 and ts < 1648793000000 partition by tbname interval(10s) fill(NULL); +sql create stream streams4a trigger at_once IGNORE EXPIRED 0 into streamt4a as select _wstart ts, count(*) c1, concat(tbname, 'aaa') as pname, timezone() from st where ts > 1648791000000 and ts < 1648793000000 partition by tbname interval(10s) fill(NULL_F); sql insert into t1 values(1648791213000,1,2,3,1.0,'aaa'); sql insert into t1 values(1648791233000,1,2,3,1.0,'aaa'); sql insert into t1 values(1648791273000,1,2,3,1.0,'aaa'); diff --git a/tests/script/tsim/stream/ignoreCheckUpdate.sim b/tests/script/tsim/stream/ignoreCheckUpdate.sim index 7f99c534c8..2cd0117feb 100644 --- a/tests/script/tsim/stream/ignoreCheckUpdate.sim +++ b/tests/script/tsim/stream/ignoreCheckUpdate.sim @@ -12,9 +12,9 @@ sql create database test vgroups 1; sql use test; sql create table t1(ts timestamp, a int, b int , c int); -print create stream streams0 trigger at_once ignore update 1 into streamt as select _wstart c1, count(*) c2, max(b) c3 from t1 interval(10s); +print create stream streams0 trigger at_once IGNORE EXPIRED 0 ignore update 1 into streamt as select _wstart c1, count(*) c2, max(b) c3 from t1 interval(10s); -sql create stream streams0 trigger at_once ignore update 1 into streamt as select _wstart c1, count(*) c2, max(b) c3 from t1 interval(10s); +sql create stream streams0 trigger at_once IGNORE EXPIRED 0 ignore update 1 into streamt as select _wstart c1, count(*) c2, max(b) c3 from t1 interval(10s); sql insert into t1 values(1648791213000,1,1,1); sql insert into t1 values(1648791213000,2,2,2); diff --git a/tests/script/tsim/stream/partitionby.sim b/tests/script/tsim/stream/partitionby.sim index bc2c07b951..e63459e97d 100644 --- a/tests/script/tsim/stream/partitionby.sim +++ b/tests/script/tsim/stream/partitionby.sim @@ -12,7 +12,7 @@ sql create table ts1 using st tags(1,1,1); sql create table ts2 using st tags(2,2,2); sql create table ts3 using st tags(3,2,2); sql create table ts4 using st tags(4,2,2); -sql create stream stream_t1 trigger at_once into test0.streamtST1 as select _wstart, count(*) c1, count(d) c2 , sum(a) c3 , max(b) c4, min(c) c5 from st partition by ta,tb,tc interval(10s); +sql create stream stream_t1 trigger at_once IGNORE EXPIRED 0 into test0.streamtST1 as select _wstart, count(*) c1, count(d) c2 , sum(a) c3 , max(b) c4, min(c) c5 from st partition by ta,tb,tc interval(10s); sql insert into ts1 values(1648791213001,1,12,3,1.0); sql insert into ts2 values(1648791213001,1,12,3,1.0); @@ -67,7 +67,7 @@ sql create table ts1 using st tags(1,2,3); sql create table ts2 using st tags(1,3,4); sql create table ts3 using st tags(1,4,5); -sql create stream streams1 trigger at_once into streamt as select _wstart, count(*) c1, count(a) c2 from st partition by ta,tb,tc interval(10s); +sql create stream streams1 trigger at_once IGNORE EXPIRED 0 into streamt as select _wstart, count(*) c1, count(a) c2 from st partition by ta,tb,tc interval(10s); sql insert into ts1 values(1648791211000,1,2,3); @@ -98,7 +98,7 @@ sql create stable st(ts timestamp,a int,b int,c int,id int) tags(ta int,tb int,t sql create table ts1 using st tags(1,1,1); sql create table ts2 using st tags(2,2,2); -sql create stream stream_t2 trigger at_once watermark 20s into streamtST as select _wstart, count(*) c1, count(a) c2 , sum(a) c3 , max(b) c5, min(c) c6, max(id) c7 from st partition by ta interval(10s) ; +sql create stream stream_t2 trigger at_once watermark 20s IGNORE EXPIRED 0 into streamtST as select _wstart, count(*) c1, count(a) c2 , sum(a) c3 , max(b) c5, min(c) c6, max(id) c7 from st partition by ta interval(10s) ; sql insert into ts1 values(1648791211000,1,2,3,1); sql insert into ts1 values(1648791222001,2,2,3,2); sql insert into ts2 values(1648791211000,1,2,3,3); diff --git a/tests/script/tsim/stream/partitionby1.sim b/tests/script/tsim/stream/partitionby1.sim index b29666cad7..c8bb25e0dd 100644 --- a/tests/script/tsim/stream/partitionby1.sim +++ b/tests/script/tsim/stream/partitionby1.sim @@ -11,7 +11,7 @@ sql create table ts1 using st tags(1,1,1); sql create table ts2 using st tags(2,2,2); sql create table ts3 using st tags(3,2,2); sql create table ts4 using st tags(4,2,2); -sql create stream stream_t1 trigger at_once into streamtST1 as select _wstart, count(*) c1, count(d) c2 , sum(a) c3 , max(b) c4, min(c) c5 from st partition by tbname interval(10s); +sql create stream stream_t1 trigger at_once IGNORE EXPIRED 0 into streamtST1 as select _wstart, count(*) c1, count(d) c2 , sum(a) c3 , max(b) c4, min(c) c5 from st partition by tbname interval(10s); sql insert into ts1 values(1648791213001,1,12,3,1.0); sql insert into ts2 values(1648791213001,1,12,3,1.0); @@ -43,7 +43,7 @@ sql create table ts1 using st tags(1,2,3); sql create table ts2 using st tags(1,3,4); sql create table ts3 using st tags(1,4,5); -sql create stream streams1 trigger at_once into streamt as select _wstart, count(*) c1, count(a) c2 from st partition by tbname interval(10s); +sql create stream streams1 trigger at_once IGNORE EXPIRED 0 into streamt as select _wstart, count(*) c1, count(a) c2 from st partition by tbname interval(10s); sql insert into ts1 values(1648791211000,1,2,3); @@ -74,7 +74,7 @@ sql create stable st(ts timestamp,a int,b int,c int,id int) tags(ta int,tb int,t sql create table ts1 using st tags(1,1,1); sql create table ts2 using st tags(2,2,2); -sql create stream stream_t2 trigger at_once into streamtST as select _wstart, count(*) c1, count(a) c2 , sum(a) c3 , max(b) c5, min(c) c6, max(id) c7 from st partition by tbname interval(10s) ; +sql create stream stream_t2 trigger at_once IGNORE EXPIRED 0 into streamtST as select _wstart, count(*) c1, count(a) c2 , sum(a) c3 , max(b) c5, min(c) c6, max(id) c7 from st partition by tbname interval(10s) ; sql insert into ts1 values(1648791211000,1,2,3,1); sql insert into ts1 values(1648791222001,2,2,3,2); sql insert into ts2 values(1648791211000,1,2,3,3); diff --git a/tests/script/tsim/stream/partitionbyColumnInterval.sim b/tests/script/tsim/stream/partitionbyColumnInterval.sim index 2e57e8d699..94053990e4 100644 --- a/tests/script/tsim/stream/partitionbyColumnInterval.sim +++ b/tests/script/tsim/stream/partitionbyColumnInterval.sim @@ -16,7 +16,7 @@ sql drop database if exists test; sql create database test vgroups 1; sql use test; sql create table t1(ts timestamp, a int, b int , c int, d double); -sql create stream streams0 trigger at_once into streamt as select _wstart c1, count(*) c2, max(a) c3, _group_key(a) c4 from t1 partition by a interval(10s); +sql create stream streams0 trigger at_once IGNORE EXPIRED 0 into streamt as select _wstart c1, count(*) c2, max(a) c3, _group_key(a) c4 from t1 partition by a interval(10s); sql insert into t1 values(1648791213000,NULL,NULL,NULL,NULL); sql insert into t1 values(1648791213000,NULL,NULL,NULL,NULL); @@ -197,7 +197,7 @@ sql drop database if exists test1; sql create database test1 vgroups 1; sql use test1; sql create table t1(ts timestamp, a int, b int , c int, d double); -sql create stream streams1 trigger at_once into streamt1 as select _wstart c1, count(*) c2, max(c) c3, _group_key(a+b) c4 from t1 partition by a+b interval(10s); +sql create stream streams1 trigger at_once IGNORE EXPIRED 0 into streamt1 as select _wstart c1, count(*) c2, max(c) c3, _group_key(a+b) c4 from t1 partition by a+b interval(10s); sql insert into t1 values(1648791213000,NULL,NULL,NULL,NULL); sql insert into t1 values(1648791213000,NULL,NULL,NULL,NULL); @@ -284,7 +284,7 @@ sql use test2; sql create stable st(ts timestamp, a int, b int, c int, d double) tags(ta int,tb int,tc int); sql create table t1 using st tags(1,1,1); sql create table t2 using st tags(2,2,2); -sql create stream streams2 trigger at_once into test.streamt2 as select _wstart c1, count(*) c2, max(a) c3 from st partition by a interval(10s); +sql create stream streams2 trigger at_once IGNORE EXPIRED 0 into test.streamt2 as select _wstart c1, count(*) c2, max(a) c3 from st partition by a interval(10s); sql insert into t1 values(1648791213000,NULL,NULL,NULL,NULL); sql insert into t1 values(1648791213000,NULL,NULL,NULL,NULL); @@ -481,7 +481,7 @@ sql create table t1 using st tags(1,1,1); sql create table t2 using st tags(2,2,2); sql create table t3 using st tags(2,2,2); sql create table t4 using st tags(2,2,2); -sql create stream streams4 trigger at_once into test.streamt4 as select _wstart c1, count(*) c2, max(a) c3 from st partition by a interval(10s); +sql create stream streams4 trigger at_once IGNORE EXPIRED 0 into test.streamt4 as select _wstart c1, count(*) c2, max(a) c3 from st partition by a interval(10s); sql insert into t1 values(1648791213000,2,2,3,1.0); sql insert into t2 values(1648791213000,2,2,3,1.0); @@ -571,7 +571,7 @@ sql create table t1 using st tags(1,1,1); sql create table t2 using st tags(2,2,2); sql create table t3 using st tags(2,2,2); sql create table t4 using st tags(2,2,2); -sql create stream streams5 trigger at_once into test.streamt5 as select _wstart c1, count(*) c2, max(a) c3 from st partition by a interval(10s); +sql create stream streams5 trigger at_once IGNORE EXPIRED 0 into test.streamt5 as select _wstart c1, count(*) c2, max(a) c3 from st partition by a interval(10s); sql insert into t1 values(1648791213000,1,2,3,1.0); sql insert into t2 values(1648791213000,2,2,3,1.0); diff --git a/tests/script/tsim/stream/partitionbyColumnSession.sim b/tests/script/tsim/stream/partitionbyColumnSession.sim index 1742d52cf0..bb3f6015c7 100644 --- a/tests/script/tsim/stream/partitionbyColumnSession.sim +++ b/tests/script/tsim/stream/partitionbyColumnSession.sim @@ -16,7 +16,7 @@ sql drop database if exists test; sql create database test vgroups 1; sql use test; sql create table t1(ts timestamp, a int, b int , c int, d double); -sql create stream streams0 trigger at_once into streamt as select _wstart c1, count(*) c2, max(a) c3, _group_key(a) c4 from t1 partition by a session(ts, 5s); +sql create stream streams0 trigger at_once IGNORE EXPIRED 0 into streamt as select _wstart c1, count(*) c2, max(a) c3, _group_key(a) c4 from t1 partition by a session(ts, 5s); sql insert into t1 values(1648791213000,NULL,NULL,NULL,NULL); sql insert into t1 values(1648791213000,NULL,NULL,NULL,NULL); @@ -196,7 +196,7 @@ sql drop database if exists test1; sql create database test1 vgroups 1; sql use test1; sql create table t1(ts timestamp, a int, b int , c int, d double); -sql create stream streams1 trigger at_once into streamt1 as select _wstart c1, count(*) c2, max(c) c3, _group_key(a+b) c4 from t1 partition by a+b session(ts, 5s); +sql create stream streams1 trigger at_once IGNORE EXPIRED 0 into streamt1 as select _wstart c1, count(*) c2, max(c) c3, _group_key(a+b) c4 from t1 partition by a+b session(ts, 5s); sql insert into t1 values(1648791213000,NULL,NULL,NULL,NULL); sql insert into t1 values(1648791213000,NULL,NULL,NULL,NULL); @@ -282,7 +282,7 @@ sql use test2; sql create stable st(ts timestamp, a int, b int, c int, d double) tags(ta int,tb int,tc int); sql create table t1 using st tags(1,1,1); sql create table t2 using st tags(2,2,2); -sql create stream streams2 trigger at_once into test.streamt2 as select _wstart c1, count(*) c2, max(a) c3 from st partition by a session(ts, 5s); +sql create stream streams2 trigger at_once IGNORE EXPIRED 0 into test.streamt2 as select _wstart c1, count(*) c2, max(a) c3 from st partition by a session(ts, 5s); sql insert into t1 values(1648791213000,NULL,NULL,NULL,NULL); sql insert into t1 values(1648791213000,NULL,NULL,NULL,NULL); @@ -478,7 +478,7 @@ sql create table t1 using st tags(1,1,1); sql create table t2 using st tags(2,2,2); sql create table t3 using st tags(2,2,2); sql create table t4 using st tags(2,2,2); -sql create stream streams4 trigger at_once into test.streamt4 as select _wstart c1, count(*) c2, max(a) c3 from st partition by a session(ts, 5s); +sql create stream streams4 trigger at_once IGNORE EXPIRED 0 into test.streamt4 as select _wstart c1, count(*) c2, max(a) c3 from st partition by a session(ts, 5s); sql insert into t1 values(1648791213000,2,2,3,1.0); sql insert into t2 values(1648791213000,2,2,3,1.0); diff --git a/tests/script/tsim/stream/partitionbyColumnState.sim b/tests/script/tsim/stream/partitionbyColumnState.sim index 75d01b17ec..62262a490c 100644 --- a/tests/script/tsim/stream/partitionbyColumnState.sim +++ b/tests/script/tsim/stream/partitionbyColumnState.sim @@ -11,7 +11,7 @@ sql drop database if exists test; sql create database test vgroups 1; sql use test; sql create table t1(ts timestamp, a int, b int , c int, d double); -sql create stream streams0 trigger at_once into streamt as select _wstart c1, count(*) c2, max(a) c3, _group_key(a) c4 from t1 partition by a state_window(b); +sql create stream streams0 trigger at_once IGNORE EXPIRED 0 into streamt as select _wstart c1, count(*) c2, max(a) c3, _group_key(a) c4 from t1 partition by a state_window(b); sql insert into t1 values(1648791213000,NULL,NULL,NULL,NULL); sql insert into t1 values(1648791213000,NULL,NULL,NULL,NULL); @@ -191,7 +191,7 @@ sql drop database if exists test1; sql create database test1 vgroups 1; sql use test1; sql create table t1(ts timestamp, a int, b int , c int, d int); -sql create stream streams1 trigger at_once into streamt1 as select _wstart c1, count(*) c2, max(d) c3, _group_key(a+b) c4 from t1 partition by a+b state_window(c); +sql create stream streams1 trigger at_once IGNORE EXPIRED 0 into streamt1 as select _wstart c1, count(*) c2, max(d) c3, _group_key(a+b) c4 from t1 partition by a+b state_window(c); sql insert into t1 values(1648791213000,NULL,NULL,NULL,NULL); sql insert into t1 values(1648791213000,NULL,NULL,NULL,NULL); diff --git a/tests/script/tsim/stream/schedSnode.sim b/tests/script/tsim/stream/schedSnode.sim index 2caecf50a2..6a4d6f79bb 100644 --- a/tests/script/tsim/stream/schedSnode.sim +++ b/tests/script/tsim/stream/schedSnode.sim @@ -20,7 +20,7 @@ sql create table ts1 using st tags(1,1,1); sql create table ts2 using st tags(2,2,2); sql create table ts3 using st tags(3,2,2); sql create table ts4 using st tags(4,2,2); -sql create stream stream_t1 trigger at_once into target.streamtST1 as select _wstart, count(*) c1, count(d) c2 , sum(a) c3 , max(b) c4, min(c) c5 from st interval(10s); +sql create stream stream_t1 trigger at_once IGNORE EXPIRED 0 into target.streamtST1 as select _wstart, count(*) c1, count(d) c2 , sum(a) c3 , max(b) c4, min(c) c5 from st interval(10s); sleep 1000 diff --git a/tests/script/tsim/stream/session0.sim b/tests/script/tsim/stream/session0.sim index 5e95428e0a..622c5f7c6d 100644 --- a/tests/script/tsim/stream/session0.sim +++ b/tests/script/tsim/stream/session0.sim @@ -17,7 +17,7 @@ sql use test; sql create table t1(ts timestamp, a int, b int , c int, d double,id int); -sql create stream streams1 trigger at_once into streamt as select _wstart, count(*) c1, sum(a), max(a), min(d), stddev(a), last(a), first(d), max(id) s from t1 session(ts,10s); +sql create stream streams1 trigger at_once IGNORE EXPIRED 0 into streamt as select _wstart, count(*) c1, sum(a), max(a), min(d), stddev(a), last(a), first(d), max(id) s from t1 session(ts,10s); sql insert into t1 values(1648791213000,NULL,NULL,NULL,NULL,1); sql insert into t1 values(1648791223001,10,2,3,1.1,2); sql insert into t1 values(1648791233002,3,2,3,2.1,3); @@ -179,7 +179,7 @@ endi sql create database test2 vgroups 1; sql use test2; sql create table t2(ts timestamp, a int, b int , c int, d double, id int); -sql create stream streams2 trigger at_once watermark 1d into streamt2 as select _wstart,apercentile(a,30) c1, apercentile(a,70), apercentile(a,20,"t-digest") c2, apercentile(a,60,"t-digest") c3, max(id) c4 from t2 session(ts,10s); +sql create stream streams2 trigger at_once IGNORE EXPIRED 0 watermark 1d into streamt2 as select _wstart,apercentile(a,30) c1, apercentile(a,70), apercentile(a,20,"t-digest") c2, apercentile(a,60,"t-digest") c3, max(id) c4 from t2 session(ts,10s); sql insert into t2 values(1648791213001,1,1,3,1.0,1); sql insert into t2 values(1648791213002,2,2,6,3.4,2); sql insert into t2 values(1648791213003,4,9,3,4.8,3); @@ -229,13 +229,13 @@ endi sql create database test3 vgroups 1; sql use test3; sql create table t1(ts timestamp, a int, b int , c int, d double); -sql create stream streams3 trigger at_once watermark 1d into streamt3 as select _wstart, min(b), a,c from t1 session(ts,10s); -sql create stream streams4 trigger at_once watermark 1d into streamt4 as select _wstart, max(b), a,c from t1 session(ts,10s); -# sql create stream streams5 trigger at_once watermark 1d into streamt5 as select _wstart, top(b,3), a,c from t1 session(ts,10s); -# sql create stream streams6 trigger at_once watermark 1d into streamt6 as select _wstart, bottom(b,3), a,c from t1 session(ts,10s); -# sql create stream streams7 trigger at_once watermark 1d into streamt7 as select _wstart, spread(a), elapsed(ts), hyperloglog(a) from t1 session(ts,10s); -sql create stream streams7 trigger at_once watermark 1d into streamt7 as select _wstart, spread(a), hyperloglog(a) from t1 session(ts,10s); -# sql create stream streams8 trigger at_once watermark 1d into streamt8 as select _wstart, histogram(a,"user_input", "[1,3,5,7]", 1), histogram(a,"user_input", "[1,3,5,7]", 0) from t1 session(ts,10s); +sql create stream streams3 trigger at_once watermark 1d IGNORE EXPIRED 0 into streamt3 as select _wstart, min(b), a,c from t1 session(ts,10s); +sql create stream streams4 trigger at_once watermark 1d IGNORE EXPIRED 0 into streamt4 as select _wstart, max(b), a,c from t1 session(ts,10s); +# sql create stream streams5 trigger at_once watermark 1d IGNORE EXPIRED 0 into streamt5 as select _wstart, top(b,3), a,c from t1 session(ts,10s); +# sql create stream streams6 trigger at_once watermark 1d IGNORE EXPIRED 0 into streamt6 as select _wstart, bottom(b,3), a,c from t1 session(ts,10s); +# sql create stream streams7 trigger at_once watermark 1d IGNORE EXPIRED 0 into streamt7 as select _wstart, spread(a), elapsed(ts), hyperloglog(a) from t1 session(ts,10s); +sql create stream streams7 trigger at_once watermark 1d IGNORE EXPIRED 0 into streamt7 as select _wstart, spread(a), hyperloglog(a) from t1 session(ts,10s); +# sql create stream streams8 trigger at_once watermark 1d IGNORE EXPIRED 0 into streamt8 as select _wstart, histogram(a,"user_input", "[1,3,5,7]", 1), histogram(a,"user_input", "[1,3,5,7]", 0) from t1 session(ts,10s); sql insert into t1 values(1648791213001,1,1,1,1.0); sql insert into t1 values(1648791213002,2,3,2,3.4); sql insert into t1 values(1648791213003,4,9,3,4.8); diff --git a/tests/script/tsim/stream/session1.sim b/tests/script/tsim/stream/session1.sim index f535fd619f..3ad7c6f04e 100644 --- a/tests/script/tsim/stream/session1.sim +++ b/tests/script/tsim/stream/session1.sim @@ -17,7 +17,7 @@ sql use test; sql create table t1(ts timestamp, a int, b int , c int, d double,id int); -sql create stream streams2 trigger at_once into streamt as select _wstart, count(*) c1, sum(a), min(b), max(id) s from t1 session(ts,10s); +sql create stream streams2 trigger at_once IGNORE EXPIRED 0 into streamt as select _wstart, count(*) c1, sum(a), min(b), max(id) s from t1 session(ts,10s); sql insert into t1 values(1648791210000,1,1,1,1.1,1); sql insert into t1 values(1648791220000,2,2,2,2.1,2); sql insert into t1 values(1648791230000,3,3,3,3.1,3); @@ -200,7 +200,7 @@ endi sql create database test1 vgroups 1; sql use test1; sql create table t1(ts timestamp, a int, b int , c int, d double); -sql create stream streams3 trigger at_once into streamt3 as select _wstart, count(*) c1 from t1 where a > 5 session(ts, 5s); +sql create stream streams3 trigger at_once IGNORE EXPIRED 0 into streamt3 as select _wstart, count(*) c1 from t1 where a > 5 session(ts, 5s); sql insert into t1 values(1648791213000,1,2,3,1.0); $loop_count = 0 diff --git a/tests/script/tsim/stream/sliding.sim b/tests/script/tsim/stream/sliding.sim index 8287274cd2..e12e3c6686 100644 --- a/tests/script/tsim/stream/sliding.sim +++ b/tests/script/tsim/stream/sliding.sim @@ -17,10 +17,10 @@ sql use test; sql create stable st(ts timestamp, a int, b int, c int, d double) tags(ta int,tb int,tc int); sql create table t1 using st tags(1,1,1); sql create table t2 using st tags(2,2,2); -sql create stream streams1 trigger at_once into streamt as select _wstart, count(*) c1, sum(a) c3 , max(b) c4, min(c) c5 from t1 interval(10s) sliding (5s); -sql create stream streams2 trigger at_once watermark 1d into streamt2 as select _wstart, count(*) c1, sum(a) c3 , max(b) c4, min(c) c5 from t1 interval(10s) sliding (5s); -sql create stream stream_t1 trigger at_once into streamtST as select _wstart, count(*) c1, sum(a) c3 , max(b) c4, min(c) c5 from st interval(10s) sliding (5s); -sql create stream stream_t2 trigger at_once watermark 1d into streamtST2 as select _wstart, count(*) c1, sum(a) c3 , max(b) c4, min(c) c5 from st interval(10s) sliding (5s); +sql create stream streams1 trigger at_once IGNORE EXPIRED 0 into streamt as select _wstart, count(*) c1, sum(a) c3 , max(b) c4, min(c) c5 from t1 interval(10s) sliding (5s); +sql create stream streams2 trigger at_once watermark 1d IGNORE EXPIRED 0 into streamt2 as select _wstart, count(*) c1, sum(a) c3 , max(b) c4, min(c) c5 from t1 interval(10s) sliding (5s); +sql create stream stream_t1 trigger at_once IGNORE EXPIRED 0 into streamtST as select _wstart, count(*) c1, sum(a) c3 , max(b) c4, min(c) c5 from st interval(10s) sliding (5s); +sql create stream stream_t2 trigger at_once watermark 1d IGNORE EXPIRED 0 into streamtST2 as select _wstart, count(*) c1, sum(a) c3 , max(b) c4, min(c) c5 from st interval(10s) sliding (5s); sql insert into t1 values(1648791210000,1,2,3,1.0); sql insert into t1 values(1648791216000,2,2,3,1.1); @@ -309,8 +309,8 @@ sql create stable st(ts timestamp, a int, b int, c int, d double) tags(ta int,tb sql create table t1 using st tags(1,1,1); sql create table t2 using st tags(2,2,2); -sql create stream streams11 trigger at_once into streamt as select _wstart, count(*) c1, sum(a) c3 , max(b) c4, min(c) c5 from t1 interval(10s, 5s); -sql create stream streams12 trigger at_once into streamt2 as select _wstart, count(*) c1, sum(a) c3 , max(b) c4, min(c) c5 from st interval(10s, 5s); +sql create stream streams11 trigger at_once IGNORE EXPIRED 0 into streamt as select _wstart, count(*) c1, sum(a) c3 , max(b) c4, min(c) c5 from t1 interval(10s, 5s); +sql create stream streams12 trigger at_once IGNORE EXPIRED 0 into streamt2 as select _wstart, count(*) c1, sum(a) c3 , max(b) c4, min(c) c5 from st interval(10s, 5s); sql insert into t1 values(1648791213000,1,2,3,1.0); sql insert into t1 values(1648791223001,2,2,3,1.1); @@ -442,9 +442,9 @@ sql create stable st(ts timestamp, a int, b int, c int, d double) tags(ta int,tb sql create table t1 using st tags(1,1,1); sql create table t2 using st tags(2,2,2); -sql create stream streams21 trigger at_once into streamt as select _wstart, count(*) c1, sum(a) c3 , max(b) c4, min(c) c5 from t1 interval(10s, 5s); -sql create stream streams22 trigger at_once into streamt2 as select _wstart, count(*) c1, sum(a) c3 , max(b) c4, min(c) c5 from st interval(10s, 5s); -sql create stream streams23 trigger at_once into streamt3 as select _wstart, count(*) c1, sum(a) c3 , max(b) c4, min(c) c5 from st interval(20s) sliding(10s); +sql create stream streams21 trigger at_once IGNORE EXPIRED 0 into streamt as select _wstart, count(*) c1, sum(a) c3 , max(b) c4, min(c) c5 from t1 interval(10s, 5s); +sql create stream streams22 trigger at_once IGNORE EXPIRED 0 into streamt2 as select _wstart, count(*) c1, sum(a) c3 , max(b) c4, min(c) c5 from st interval(10s, 5s); +sql create stream streams23 trigger at_once IGNORE EXPIRED 0 into streamt3 as select _wstart, count(*) c1, sum(a) c3 , max(b) c4, min(c) c5 from st interval(20s) sliding(10s); sql insert into t1 values(1648791213000,1,1,1,1.0); sql insert into t1 values(1648791223001,2,2,2,1.1); @@ -683,7 +683,7 @@ sql create stable st(ts timestamp, a int, b int, c int, d double) tags(ta int,tb sql create table t1 using st tags(1,1,1); sql create table t2 using st tags(2,2,2); -sql create stream streams4 trigger at_once into streamt4 as select _wstart as ts, count(*),min(a) c1 from st interval(10s) sliding(5s); +sql create stream streams4 trigger at_once IGNORE EXPIRED 0 into streamt4 as select _wstart as ts, count(*),min(a) c1 from st interval(10s) sliding(5s); sql insert into t1 values(1648791213000,1,1,1,1.0); sql insert into t1 values(1648791243000,2,1,1,1.0); diff --git a/tests/script/tsim/stream/state0.sim b/tests/script/tsim/stream/state0.sim index 07abdc0040..d009f742b7 100644 --- a/tests/script/tsim/stream/state0.sim +++ b/tests/script/tsim/stream/state0.sim @@ -17,9 +17,9 @@ sql use test; sql create table t1(ts timestamp, a int, b int , c int, d double, id int); -print create stream streams1 trigger at_once into streamt1 as select _wstart, count(*) c1, count(d) c2 , sum(a) c3 , max(a) c4, min(c) c5, max(id) c from t1 state_window(a); +print create stream streams1 trigger at_once IGNORE EXPIRED 0 into streamt1 as select _wstart, count(*) c1, count(d) c2 , sum(a) c3 , max(a) c4, min(c) c5, max(id) c from t1 state_window(a); -sql create stream streams1 trigger at_once into streamt1 as select _wstart, count(*) c1, count(d) c2 , sum(a) c3 , max(a) c4, min(c) c5, max(id) c from t1 state_window(a); +sql create stream streams1 trigger at_once IGNORE EXPIRED 0 into streamt1 as select _wstart, count(*) c1, count(d) c2 , sum(a) c3 , max(a) c4, min(c) c5, max(id) c from t1 state_window(a); sql insert into t1 values(1648791213000,1,2,3,1.0,1); sql insert into t1 values(1648791213000,1,2,3,1.0,2); @@ -453,9 +453,9 @@ sql use test1; sql create table t1(ts timestamp, a int, b int , c int, d double, id int); -print create stream streams2 trigger at_once into streamt1 as select _wstart, count(*) c1, count(d) c2 , sum(a) c3 , max(a) c4, min(c) c5, max(id) c from t1 state_window(a); +print create stream streams2 trigger at_once IGNORE EXPIRED 0 into streamt1 as select _wstart, count(*) c1, count(d) c2 , sum(a) c3 , max(a) c4, min(c) c5, max(id) c from t1 state_window(a); -sql create stream streams2 trigger at_once into streamt1 as select _wstart, count(*) c1, count(d) c2 , sum(a) c3 , max(a) c4, min(c) c5, max(id) c from t1 state_window(a); +sql create stream streams2 trigger at_once IGNORE EXPIRED 0 into streamt1 as select _wstart, count(*) c1, count(d) c2 , sum(a) c3 , max(a) c4, min(c) c5, max(id) c from t1 state_window(a); sql insert into t1 values(1648791212000,2,2,3,1.0,1); sql insert into t1 values(1648791213000,1,2,3,1.0,1); @@ -501,9 +501,9 @@ sql use test3; sql create table t1(ts timestamp, a int, b int , c int, d double, id int); -print create stream streams3 trigger at_once into streamt3 as select _wstart, count(*) c1, sum(b) c3 from t1 state_window(a); +print create stream streams3 trigger at_once IGNORE EXPIRED 0 into streamt3 as select _wstart, count(*) c1, sum(b) c3 from t1 state_window(a); -sql create stream streams3 trigger at_once into streamt3 as select _wstart, count(*) c1, sum(b) c3 from t1 state_window(a); +sql create stream streams3 trigger at_once IGNORE EXPIRED 0 into streamt3 as select _wstart, count(*) c1, sum(b) c3 from t1 state_window(a); sql insert into t1 values(1648791212000,1,2,3,1.0,1); sql insert into t1 values(1648791213000,2,2,3,1.0,1); sql insert into t1 values(1648791214000,3,2,4,1.0,2); @@ -553,9 +553,9 @@ sql create table st (ts timestamp, c1 tinyint, c2 smallint) tags (t1 tinyint) ; sql create table t1 using st tags (-81) ; sql create table t2 using st tags (-81) ; -print create stream if not exists streams4 trigger window_close into streamt4 as select _wstart AS startts, min(c1),count(c1) from t1 state_window(c1); +print create stream if not exists streams4 trigger window_close IGNORE EXPIRED 0 into streamt4 as select _wstart AS startts, min(c1),count(c1) from t1 state_window(c1); -sql create stream if not exists streams4 trigger window_close into streamt4 as select _wstart AS startts, min(c1),count(c1) from t1 state_window(c1); +sql create stream if not exists streams4 trigger window_close IGNORE EXPIRED 0 into streamt4 as select _wstart AS startts, min(c1),count(c1) from t1 state_window(c1); sql insert into t1 (ts, c1) values (1668073288209, 11); sql insert into t1 (ts, c1) values (1668073288210, 11); @@ -742,9 +742,9 @@ sql create table tb (ts timestamp, a int); sql insert into tb values (now + 1m , 1 ); sql create table b (c timestamp, d int, e int , f int, g double); -print create stream streams0 trigger at_once into streamt as select _wstart c1, count(*) c2, max(a) c3 from tb state_window(a); +print create stream streams0 trigger at_once IGNORE EXPIRED 0 into streamt as select _wstart c1, count(*) c2, max(a) c3 from tb state_window(a); -sql create stream streams0 trigger at_once into streamt as select _wstart c1, count(*) c2, max(a) c3 from tb state_window(a); +sql create stream streams0 trigger at_once IGNORE EXPIRED 0 into streamt as select _wstart c1, count(*) c2, max(a) c3 from tb state_window(a); sql insert into b values(1648791213000,NULL,NULL,NULL,NULL); sql select * from streamt order by c1, c2, c3; diff --git a/tests/script/tsim/stream/triggerInterval0.sim b/tests/script/tsim/stream/triggerInterval0.sim index b522dcf035..1c62f689ac 100644 --- a/tests/script/tsim/stream/triggerInterval0.sim +++ b/tests/script/tsim/stream/triggerInterval0.sim @@ -15,7 +15,7 @@ print $data00 $data01 $data02 sql use test sql create table t1(ts timestamp, a int, b int , c int, d double); -sql create stream streams1 trigger window_close into streamt as select _wstart, count(*) c1, count(d) c2 , sum(a) c3 , max(b) c4, min(c) c5 from t1 interval(10s); +sql create stream streams1 trigger window_close IGNORE EXPIRED 0 into streamt as select _wstart, count(*) c1, count(d) c2 , sum(a) c3 , max(b) c4, min(c) c5 from t1 interval(10s); sql insert into t1 values(1648791213001,1,2,3,1.0); sleep 300 diff --git a/tests/script/tsim/stream/triggerSession0.sim b/tests/script/tsim/stream/triggerSession0.sim index 4c664cf7c7..81a016be2b 100644 --- a/tests/script/tsim/stream/triggerSession0.sim +++ b/tests/script/tsim/stream/triggerSession0.sim @@ -15,7 +15,7 @@ print $data00 $data01 $data02 sql use test; sql create table t2(ts timestamp, a int, b int , c int, d double); -sql create stream streams2 trigger window_close into streamt2 as select _wstart, count(*) c1, count(d) c2 , sum(a) c3 , max(b) c4, min(c) c5 from t2 session(ts, 10s); +sql create stream streams2 trigger window_close IGNORE EXPIRED 0 into streamt2 as select _wstart, count(*) c1, count(d) c2 , sum(a) c3 , max(b) c4, min(c) c5 from t2 session(ts, 10s); sql insert into t2 values(1648791213000,1,2,3,1.0); sql insert into t2 values(1648791222999,1,2,3,1.0); diff --git a/tests/script/tsim/stream/udTableAndTag0.sim b/tests/script/tsim/stream/udTableAndTag0.sim index 8bf34dc54c..e3ab344bbe 100644 --- a/tests/script/tsim/stream/udTableAndTag0.sim +++ b/tests/script/tsim/stream/udTableAndTag0.sim @@ -20,8 +20,8 @@ sql create stable st(ts timestamp,a int,b int,c int) tags(ta int,tb int,tc int); sql create table t1 using st tags(1,1,1); sql create table t2 using st tags(2,2,2); -#sql_error create stream streams1 trigger at_once into result.streamt SUBTABLE("aaa") as select _wstart, count(*) c1 from st interval(10s); -sql create stream streams1 trigger at_once into result.streamt SUBTABLE(concat("aaa-", tbname)) as select _wstart, count(*) c1 from st partition by tbname interval(10s); +#sql_error create stream streams1 trigger at_once IGNORE EXPIRED 0 into result.streamt SUBTABLE("aaa") as select _wstart, count(*) c1 from st interval(10s); +sql create stream streams1 trigger at_once IGNORE EXPIRED 0 into result.streamt SUBTABLE(concat("aaa-", tbname)) as select _wstart, count(*) c1 from st partition by tbname interval(10s); sql insert into t1 values(1648791213000,1,2,3); sql insert into t2 values(1648791213000,1,2,3); @@ -88,7 +88,7 @@ sql create stable st(ts timestamp,a int,b int,c int) tags(ta int,tb int,tc int); sql create table t1 using st tags(1,1,1); sql create table t2 using st tags(2,2,2); -sql create stream streams2 trigger at_once into result2.streamt2 TAGS(cc varchar(100)) as select _wstart, count(*) c1 from st partition by concat("tag-", tbname) as cc interval(10s); +sql create stream streams2 trigger at_once IGNORE EXPIRED 0 into result2.streamt2 TAGS(cc varchar(100)) as select _wstart, count(*) c1 from st partition by concat("tag-", tbname) as cc interval(10s); sql insert into t1 values(1648791213000,1,2,3); sql insert into t2 values(1648791213000,1,2,3); @@ -173,7 +173,7 @@ sql create stable st(ts timestamp,a int,b int,c int) tags(ta int,tb int,tc int); sql create table t1 using st tags(1,1,1); sql create table t2 using st tags(2,2,2); -sql create stream streams3 trigger at_once into result3.streamt3 TAGS(dd varchar(100)) SUBTABLE(concat("tbn-", tbname)) as select _wstart, count(*) c1 from st partition by concat("tag-", tbname) as dd, tbname interval(10s); +sql create stream streams3 trigger at_once IGNORE EXPIRED 0 into result3.streamt3 TAGS(dd varchar(100)) SUBTABLE(concat("tbn-", tbname)) as select _wstart, count(*) c1 from st partition by concat("tag-", tbname) as dd, tbname interval(10s); sql insert into t1 values(1648791213000,1,2,3); sql insert into t2 values(1648791213000,1,2,3); @@ -285,7 +285,7 @@ sql create table t1 using st tags(1,1,1); sql create table t2 using st tags(2,2,2); sql create table t3 using st tags(3,3,3); -sql create stream streams4 trigger at_once into result4.streamt4 TAGS(dd varchar(100)) SUBTABLE(concat("tbn-", tbname)) as select _wstart, count(*) c1 from st partition by concat("tag-", tbname) as dd, tbname interval(10s); +sql create stream streams4 trigger at_once IGNORE EXPIRED 0 into result4.streamt4 TAGS(dd varchar(100)) SUBTABLE(concat("tbn-", tbname)) as select _wstart, count(*) c1 from st partition by concat("tag-", tbname) as dd, tbname interval(10s); sql insert into t1 values(1648791213000,1,1,1) t2 values(1648791213000,2,2,2) t3 values(1648791213000,3,3,3); @@ -404,7 +404,7 @@ sql create table t1 using st tags("1",1,1); sql create table t2 using st tags("2",2,2); sql create table t3 using st tags("3",3,3); -sql create stream streams6 trigger at_once into result6.streamt6 TAGS(dd int) as select _wstart, count(*) c1 from st partition by concat(ta, "0") as dd, tbname interval(10s); +sql create stream streams6 trigger at_once IGNORE EXPIRED 0 into result6.streamt6 TAGS(dd int) as select _wstart, count(*) c1 from st partition by concat(ta, "0") as dd, tbname interval(10s); sql insert into t1 values(1648791213000,1,1,1) t2 values(1648791213000,2,2,2) t3 values(1648791213000,3,3,3); diff --git a/tests/script/tsim/stream/udTableAndTag1.sim b/tests/script/tsim/stream/udTableAndTag1.sim index 4229de2cf0..fbedaa6e4e 100644 --- a/tests/script/tsim/stream/udTableAndTag1.sim +++ b/tests/script/tsim/stream/udTableAndTag1.sim @@ -20,8 +20,8 @@ sql create stable st(ts timestamp,a int,b int,c int) tags(ta int,tb int,tc int); sql create table t1 using st tags(1,1,1); sql create table t2 using st tags(2,2,2); -#sql_error create stream streams1 trigger at_once into result.streamt SUBTABLE("aaa") as select _wstart, count(*) c1 from st interval(10s); -sql create stream streams1 trigger at_once into result.streamt SUBTABLE( concat("aaa-", cast(a as varchar(10) ) ) ) as select _wstart, count(*) c1 from st partition by a interval(10s); +#sql_error create stream streams1 trigger at_once IGNORE EXPIRED 0 into result.streamt SUBTABLE("aaa") as select _wstart, count(*) c1 from st interval(10s); +sql create stream streams1 trigger at_once IGNORE EXPIRED 0 into result.streamt SUBTABLE( concat("aaa-", cast(a as varchar(10) ) ) ) as select _wstart, count(*) c1 from st partition by a interval(10s); print ===== insert into 1 sql insert into t1 values(1648791213000,1,2,3); sql insert into t2 values(1648791213000,2,2,3); @@ -87,7 +87,7 @@ sql create stable st(ts timestamp,a int,b int,c int) tags(ta int,tb int,tc int); sql create table t1 using st tags(1,1,1); sql create table t2 using st tags(2,2,2); -sql create stream streams2 trigger at_once into result2.streamt2 TAGS(cc varchar(100)) as select _wstart, count(*) c1 from st partition by concat("col-", cast(a as varchar(10) ) ) as cc interval(10s); +sql create stream streams2 trigger at_once IGNORE EXPIRED 0 into result2.streamt2 TAGS(cc varchar(100)) as select _wstart, count(*) c1 from st partition by concat("col-", cast(a as varchar(10) ) ) as cc interval(10s); print ===== insert into 2 sql insert into t1 values(1648791213000,1,2,3); sql insert into t2 values(1648791213000,2,2,3); @@ -171,7 +171,7 @@ sql create stable st(ts timestamp,a int,b int,c int) tags(ta int,tb int,tc int); sql create table t1 using st tags(1,1,1); sql create table t2 using st tags(2,2,2); -sql create stream streams3 trigger at_once into result3.streamt3 TAGS(dd varchar(100)) SUBTABLE(concat("tbn-", cast(a as varchar(10) ) ) ) as select _wstart, count(*) c1 from st partition by concat("col-", cast(a as varchar(10) ) ) as dd, a interval(10s); +sql create stream streams3 trigger at_once IGNORE EXPIRED 0 into result3.streamt3 TAGS(dd varchar(100)) SUBTABLE(concat("tbn-", cast(a as varchar(10) ) ) ) as select _wstart, count(*) c1 from st partition by concat("col-", cast(a as varchar(10) ) ) as dd, a interval(10s); print ===== insert into 3 sql insert into t1 values(1648791213000,1,2,3); sql insert into t2 values(1648791213000,2,2,3); @@ -283,7 +283,7 @@ sql create table t1 using st tags(1,1,1); sql create table t2 using st tags(2,2,2); sql create table t3 using st tags(3,3,3); -sql create stream streams4 trigger at_once into result4.streamt4 TAGS(dd varchar(100)) SUBTABLE(concat("tbn-", dd)) as select _wstart, count(*) c1 from st partition by concat("t", cast(a as varchar(10) ) ) as dd interval(10s); +sql create stream streams4 trigger at_once IGNORE EXPIRED 0 into result4.streamt4 TAGS(dd varchar(100)) SUBTABLE(concat("tbn-", dd)) as select _wstart, count(*) c1 from st partition by concat("t", cast(a as varchar(10) ) ) as dd interval(10s); sql insert into t1 values(1648791213000,1,1,1) t2 values(1648791213000,2,2,2) t3 values(1648791213000,3,3,3); diff --git a/tests/script/tsim/stream/udTableAndTag2.sim b/tests/script/tsim/stream/udTableAndTag2.sim index bacc301ad0..c0e72712df 100644 --- a/tests/script/tsim/stream/udTableAndTag2.sim +++ b/tests/script/tsim/stream/udTableAndTag2.sim @@ -20,7 +20,7 @@ sql create stable st(ts timestamp,a int,b int,c int) tags(ta int,tb int,tc int); sql create table t1 using st tags(1,1,1); sql create table t2 using st tags(2,2,2); -sql create stream streams1 trigger at_once into result.streamt SUBTABLE("aaa") as select _wstart, count(*) c1 from st interval(10s); +sql create stream streams1 trigger at_once IGNORE EXPIRED 0 into result.streamt SUBTABLE("aaa") as select _wstart, count(*) c1 from st interval(10s); print ===== insert into 1 sql insert into t1 values(1648791213000,1,2,3); sql insert into t2 values(1648791213000,2,2,3); @@ -93,7 +93,7 @@ sql create stable st(ts timestamp,a int,b int,c int) tags(ta int,tb int,tc int); sql create table t1 using st tags(1,1,1); sql create table t2 using st tags(2,2,2); -sql create stream streams2 trigger at_once into result2.streamt2 TAGS(cc varchar(100)) as select _wstart, count(*) c1 from st interval(10s); +sql create stream streams2 trigger at_once IGNORE EXPIRED 0 into result2.streamt2 TAGS(cc varchar(100)) as select _wstart, count(*) c1 from st interval(10s); print ===== insert into 2 sql insert into t1 values(1648791213000,1,2,3); sql insert into t2 values(1648791213000,2,2,3); @@ -195,7 +195,7 @@ sql create stable st(ts timestamp,a int,b int,c int) tags(ta int,tb int,tc int); sql create table t1 using st tags(1,1,1); sql create table t2 using st tags(2,2,2); -sql create stream streams3 trigger at_once into result3.streamt3 TAGS(dd varchar(100)) SUBTABLE(concat("tbn-", "1") ) as select _wstart, count(*) c1 from st interval(10s); +sql create stream streams3 trigger at_once IGNORE EXPIRED 0 into result3.streamt3 TAGS(dd varchar(100)) SUBTABLE(concat("tbn-", "1") ) as select _wstart, count(*) c1 from st interval(10s); print ===== insert into 3 sql insert into t1 values(1648791213000,1,2,3); sql insert into t2 values(1648791213000,2,2,3); @@ -305,7 +305,7 @@ sql create table t1 using st tags(1,1,1); sql create table t2 using st tags(2,2,2); sql create table t3 using st tags(3,3,3); -sql create stream streams4 trigger at_once into result4.streamt4 TAGS(dd varchar(100)) SUBTABLE(concat("tbn-", "1")) as select _wstart, count(*) c1 from st interval(10s); +sql create stream streams4 trigger at_once IGNORE EXPIRED 0 into result4.streamt4 TAGS(dd varchar(100)) SUBTABLE(concat("tbn-", "1")) as select _wstart, count(*) c1 from st interval(10s); sql insert into t1 values(1648791213000,1,1,1) t2 values(1648791213000,2,2,2) t3 values(1648791213000,3,3,3); @@ -375,9 +375,9 @@ sql create stable st(ts timestamp,a int,b int,c int) tags(ta int,tb int,tc int); sql create table t1 using st tags(1,1,1); sql create table t2 using st tags(2,2,2); -sql create stream streams51 trigger at_once into result5.streamt51 SUBTABLE("aaa") as select _wstart, count(*) c1 from st interval(10s); -sql create stream streams52 trigger at_once into result5.streamt52 TAGS(cc varchar(100)) as select _wstart, count(*) c1 from st interval(10s); -sql create stream streams53 trigger at_once into result5.streamt53 TAGS(dd varchar(100)) SUBTABLE(concat("aaa-", "1") ) as select _wstart, count(*) c1 from st interval(10s); +sql create stream streams51 trigger at_once IGNORE EXPIRED 0 into result5.streamt51 SUBTABLE("aaa") as select _wstart, count(*) c1 from st interval(10s); +sql create stream streams52 trigger at_once IGNORE EXPIRED 0 into result5.streamt52 TAGS(cc varchar(100)) as select _wstart, count(*) c1 from st interval(10s); +sql create stream streams53 trigger at_once IGNORE EXPIRED 0 into result5.streamt53 TAGS(dd varchar(100)) SUBTABLE(concat("aaa-", "1") ) as select _wstart, count(*) c1 from st interval(10s); sql insert into t1 values(1648791213000,1,2,3); sql insert into t2 values(1648791213000,2,2,3); diff --git a/tests/system-test/1-insert/database_pre_suf.py b/tests/system-test/1-insert/database_pre_suf.py index 488dfebff5..a6ff95ab3f 100755 --- a/tests/system-test/1-insert/database_pre_suf.py +++ b/tests/system-test/1-insert/database_pre_suf.py @@ -108,7 +108,7 @@ class TDTestCase: # create stream - tdSql.execute('''create stream current_stream into stream_max_stable_1 as select _wstart as startts, _wend as wend, max(q_int) as max_int, min(q_bigint) as min_int from stable_1 where ts is not null interval (5s);''') + tdSql.execute('''create stream current_stream trigger at_once IGNORE EXPIRED 0 into stream_max_stable_1 as select _wstart as startts, _wend as wend, max(q_int) as max_int, min(q_bigint) as min_int from stable_1 where ts is not null interval (5s);''') # insert data for i in range(num_random*n): diff --git a/tests/system-test/1-insert/drop.py b/tests/system-test/1-insert/drop.py index c15a9bbc35..a8bfea2741 100644 --- a/tests/system-test/1-insert/drop.py +++ b/tests/system-test/1-insert/drop.py @@ -138,14 +138,14 @@ class TDTestCase: stream_name = tdCom.getLongName(5,"letters") tdSql.execute(f'create table {stbname} (ts timestamp,c0 int) tags(t0 int)') tdSql.execute(f'create table tb using {stbname} tags(1)') - tdSql.execute(f'create stream {stream_name} into stb as select * from {self.dbname}.{stbname} partition by tbname') + tdSql.execute(f'create stream {stream_name} trigger at_once ignore expired 0 into stb as select * from {self.dbname}.{stbname} partition by tbname') tdSql.query(f'select * from information_schema.ins_streams where stream_name = "{stream_name}"') print(tdSql.queryResult) - tdSql.checkEqual(tdSql.queryResult[0][2],f'create stream {stream_name} into stb as select * from {self.dbname}.{stbname} partition by tbname') + tdSql.checkEqual(tdSql.queryResult[0][2],f'create stream {stream_name} trigger at_once ignore expired 0 into stb as select * from {self.dbname}.{stbname} partition by tbname') tdSql.execute(f'drop stream {stream_name}') - tdSql.execute(f'create stream {stream_name} into stb1 as select * from tb') + tdSql.execute(f'create stream {stream_name} trigger at_once ignore expired 0 into stb1 as select * from tb') tdSql.query(f'select * from information_schema.ins_streams where stream_name = "{stream_name}"') - tdSql.checkEqual(tdSql.queryResult[0][2],f'create stream {stream_name} into stb1 as select * from tb') + tdSql.checkEqual(tdSql.queryResult[0][2],f'create stream {stream_name} trigger at_once ignore expired 0 into stb1 as select * from tb') tdSql.execute(f'drop database {self.dbname}') def run(self): self.drop_ntb_check() diff --git a/utils/test/c/tmq_taosx_ci.c b/utils/test/c/tmq_taosx_ci.c index 3d458d90c1..1f25eae366 100644 --- a/utils/test/c/tmq_taosx_ci.c +++ b/utils/test/c/tmq_taosx_ci.c @@ -409,7 +409,7 @@ int buildStable(TAOS* pConn, TAOS_RES* pRes) { taos_free_result(pRes); pRes = taos_query(pConn, - "create stream meters_summary_s into meters_summary as select _wstart, max(current) as current, " + "create stream meters_summary_s trigger at_once IGNORE EXPIRED 0 into meters_summary as select _wstart, max(current) as current, " "groupid, location from meters partition by groupid, location interval(10m)"); if (taos_errno(pRes) != 0) { printf("failed to create super table meters_summary, reason:%s\n", taos_errstr(pRes)); From cad32b12a5018c5ccbb9320421052ee81f232681 Mon Sep 17 00:00:00 2001 From: Ganlin Zhao Date: Tue, 28 Feb 2023 18:30:51 +0800 Subject: [PATCH 018/174] add inherit from upstream order option for exchange --- source/libs/executor/inc/executorimpl.h | 2 +- source/libs/executor/src/executorimpl.c | 10 ++++++---- source/libs/executor/src/filloperator.c | 4 ++-- source/libs/executor/src/groupoperator.c | 2 +- source/libs/executor/src/projectoperator.c | 4 ++-- source/libs/executor/src/timewindowoperator.c | 6 +++--- 6 files changed, 15 insertions(+), 13 deletions(-) diff --git a/source/libs/executor/inc/executorimpl.h b/source/libs/executor/inc/executorimpl.h index 5df3b14a5b..be79054c1b 100644 --- a/source/libs/executor/inc/executorimpl.h +++ b/source/libs/executor/inc/executorimpl.h @@ -732,7 +732,7 @@ void updateLoadRemoteInfo(SLoadRemoteDataInfo* pInfo, int64_t numOfRows, int3 STimeWindow getFirstQualifiedTimeWindow(int64_t ts, STimeWindow* pWindow, SInterval* pInterval, int32_t order); -int32_t getTableScanInfo(SOperatorInfo* pOperator, int32_t* order, int32_t* scanFlag); +int32_t getTableScanInfo(SOperatorInfo* pOperator, int32_t* order, int32_t* scanFlag, bool inheritUsOrder); int32_t getBufferPgSize(int32_t rowSize, uint32_t* defaultPgsz, uint32_t* defaultBufsz); extern void doDestroyExchangeOperatorInfo(void* param); diff --git a/source/libs/executor/src/executorimpl.c b/source/libs/executor/src/executorimpl.c index 0b8bd2a817..6b7378cb67 100644 --- a/source/libs/executor/src/executorimpl.c +++ b/source/libs/executor/src/executorimpl.c @@ -1449,7 +1449,7 @@ int32_t appendDownstream(SOperatorInfo* p, SOperatorInfo** pDownstream, int32_t return TSDB_CODE_SUCCESS; } -int32_t getTableScanInfo(SOperatorInfo* pOperator, int32_t* order, int32_t* scanFlag) { +int32_t getTableScanInfo(SOperatorInfo* pOperator, int32_t* order, int32_t* scanFlag, bool inheritUsOrder) { // todo add more information about exchange operation int32_t type = pOperator->operatorType; if (type == QUERY_NODE_PHYSICAL_PLAN_SYSTABLE_SCAN || type == QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN || @@ -1459,7 +1459,9 @@ int32_t getTableScanInfo(SOperatorInfo* pOperator, int32_t* order, int32_t* scan *scanFlag = MAIN_SCAN; return TSDB_CODE_SUCCESS; } else if (type == QUERY_NODE_PHYSICAL_PLAN_EXCHANGE) { - // for exchange operator inherit order from upstream and do not overwrite here + if (!inheritUsOrder) { + *order = TSDB_ORDER_ASC; + } *scanFlag = MAIN_SCAN; return TSDB_CODE_SUCCESS; } else if (type == QUERY_NODE_PHYSICAL_PLAN_TABLE_SCAN) { @@ -1476,7 +1478,7 @@ int32_t getTableScanInfo(SOperatorInfo* pOperator, int32_t* order, int32_t* scan if (pOperator->pDownstream == NULL || pOperator->pDownstream[0] == NULL) { return TSDB_CODE_INVALID_PARA; } else { - return getTableScanInfo(pOperator->pDownstream[0], order, scanFlag); + return getTableScanInfo(pOperator->pDownstream[0], order, scanFlag, inheritUsOrder); } } } @@ -1592,7 +1594,7 @@ static int32_t doOpenAggregateOptr(SOperatorInfo* pOperator) { } hasValidBlock = true; - int32_t code = getTableScanInfo(pOperator, &order, &scanFlag); + int32_t code = getTableScanInfo(pOperator, &order, &scanFlag, false); if (code != TSDB_CODE_SUCCESS) { destroyDataBlockForEmptyInput(blockAllocated, &pBlock); T_LONG_JMP(pTaskInfo->env, code); diff --git a/source/libs/executor/src/filloperator.c b/source/libs/executor/src/filloperator.c index adb045a69f..2a33e3527a 100644 --- a/source/libs/executor/src/filloperator.c +++ b/source/libs/executor/src/filloperator.c @@ -69,7 +69,7 @@ static void doHandleRemainBlockForNewGroupImpl(SOperatorInfo* pOperator, SFillOp int32_t order = TSDB_ORDER_ASC; int32_t scanFlag = MAIN_SCAN; - getTableScanInfo(pOperator, &order, &scanFlag); + getTableScanInfo(pOperator, &order, &scanFlag, false); int64_t ekey = pInfo->existNewGroupBlock->info.window.ekey; taosResetFillInfo(pInfo->pFillInfo, getFillInfoStart(pInfo->pFillInfo)); @@ -128,7 +128,7 @@ static SSDataBlock* doFillImpl(SOperatorInfo* pOperator) { int32_t order = TSDB_ORDER_ASC; int32_t scanFlag = MAIN_SCAN; - getTableScanInfo(pOperator, &order, &scanFlag); + getTableScanInfo(pOperator, &order, &scanFlag, false); doHandleRemainBlockFromNewGroup(pOperator, pInfo, pResultInfo, pTaskInfo); if (pResBlock->info.rows > 0) { diff --git a/source/libs/executor/src/groupoperator.c b/source/libs/executor/src/groupoperator.c index 8f5c3786e0..65146edfac 100644 --- a/source/libs/executor/src/groupoperator.c +++ b/source/libs/executor/src/groupoperator.c @@ -383,7 +383,7 @@ static SSDataBlock* hashGroupbyAggregate(SOperatorInfo* pOperator) { break; } - int32_t code = getTableScanInfo(pOperator, &order, &scanFlag); + int32_t code = getTableScanInfo(pOperator, &order, &scanFlag, false); if (code != TSDB_CODE_SUCCESS) { T_LONG_JMP(pTaskInfo->env, code); } diff --git a/source/libs/executor/src/projectoperator.c b/source/libs/executor/src/projectoperator.c index 3ae114c656..49bc5af634 100644 --- a/source/libs/executor/src/projectoperator.c +++ b/source/libs/executor/src/projectoperator.c @@ -289,7 +289,7 @@ SSDataBlock* doProjectOperation(SOperatorInfo* pOperator) { } // the pDataBlock are always the same one, no need to call this again - int32_t code = getTableScanInfo(downstream, &order, &scanFlag); + int32_t code = getTableScanInfo(downstream, &order, &scanFlag, false); if (code != TSDB_CODE_SUCCESS) { T_LONG_JMP(pTaskInfo->env, code); } @@ -441,7 +441,7 @@ static void doHandleDataBlock(SOperatorInfo* pOperator, SSDataBlock* pBlock, SOp SExprSupp* pSup = &pOperator->exprSupp; // the pDataBlock are always the same one, no need to call this again - int32_t code = getTableScanInfo(downstream, &order, &scanFlag); + int32_t code = getTableScanInfo(downstream, &order, &scanFlag, false); if (code != TSDB_CODE_SUCCESS) { T_LONG_JMP(pTaskInfo->env, code); } diff --git a/source/libs/executor/src/timewindowoperator.c b/source/libs/executor/src/timewindowoperator.c index 20d4f46eaf..6411d862ae 100644 --- a/source/libs/executor/src/timewindowoperator.c +++ b/source/libs/executor/src/timewindowoperator.c @@ -1072,7 +1072,7 @@ static int32_t doOpenIntervalAgg(SOperatorInfo* pOperator) { break; } - getTableScanInfo(pOperator, &pInfo->inputOrder, &scanFlag); + getTableScanInfo(pOperator, &pInfo->inputOrder, &scanFlag, true); if (pInfo->scalarSupp.pExprInfo != NULL) { SExprSupp* pExprSup = &pInfo->scalarSupp; @@ -4294,7 +4294,7 @@ static void doMergeAlignedIntervalAgg(SOperatorInfo* pOperator) { } } - getTableScanInfo(pOperator, &pIaInfo->inputOrder, &scanFlag); + getTableScanInfo(pOperator, &pIaInfo->inputOrder, &scanFlag, false); setInputDataBlock(pSup, pBlock, pIaInfo->inputOrder, scanFlag, true); doMergeAlignedIntervalAggImpl(pOperator, &pIaInfo->binfo.resultRowInfo, pBlock, pRes); @@ -4621,7 +4621,7 @@ static SSDataBlock* doMergeIntervalAgg(SOperatorInfo* pOperator) { break; } - getTableScanInfo(pOperator, &iaInfo->inputOrder, &scanFlag); + getTableScanInfo(pOperator, &iaInfo->inputOrder, &scanFlag, false); setInputDataBlock(pExpSupp, pBlock, iaInfo->inputOrder, scanFlag, true); doMergeIntervalAggImpl(pOperator, &iaInfo->binfo.resultRowInfo, pBlock, scanFlag, pRes); From 10531d401a8ffef341498513f796a1a2ce88b06d Mon Sep 17 00:00:00 2001 From: lafirest Date: Tue, 28 Feb 2023 18:35:39 +0800 Subject: [PATCH 019/174] fix command options name error (#19874) --- docs/zh/14-reference/07-tdinsight/index.mdx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/zh/14-reference/07-tdinsight/index.mdx b/docs/zh/14-reference/07-tdinsight/index.mdx index 8ec11378ee..319fa8df53 100644 --- a/docs/zh/14-reference/07-tdinsight/index.mdx +++ b/docs/zh/14-reference/07-tdinsight/index.mdx @@ -140,10 +140,10 @@ Install and configure TDinsight dashboard in Grafana on Ubuntu 18.04/20.04 syste | -n | --tdengine-ds-name | TDENGINE_DS_NAME | TDengine 数据源名称,默认为 TDengine。 | | -a | --tdengine-api | TDENGINE_API | TDengine REST API 端点。默认为`http://127.0.0.1:6041`。 | | -u | --tdengine-user | TDENGINE_USER | TDengine 用户名。 [默认值:root] | -| -p | --tdengine-密码 | TDENGINE_PASSWORD | TDengine 密码。 [默认:taosdata] | +| -p | --tdengine-password | TDENGINE_PASSWORD | TDengine 密码。 [默认:taosdata] | | -i | --tdinsight-uid | TDINSIGHT_DASHBOARD_UID | TDinsight 仪表盘`uid`。 [默认值:tdinsight] | | -t | --tdinsight-title | TDINSIGHT_DASHBOARD_TITLE | TDinsight 仪表盘标题。 [默认:TDinsight] | -| -e | --tdinsight-可编辑 | TDINSIGHT_DASHBOARD_EDITABLE | 如果配置仪表盘可以编辑。 [默认值:false] | +| -e | --tdinsight-editable | TDINSIGHT_DASHBOARD_EDITABLE | 如果配置仪表盘可以编辑。 [默认值:false] | | -E | --external-notifier | EXTERNAL_NOTIFIER | 将外部通知程序 uid 应用于 TDinsight 仪表盘。 | 假设您在主机 `tdengine` 上启动 TDengine 数据库,HTTP API 端口为 `6041`,用户为 `root1`,密码为 `pass5ord`。执行脚本: From 60f24a5c3b96efbf87b489f4e9ca016a61392cee Mon Sep 17 00:00:00 2001 From: Xuefeng Tan <1172915550@qq.com> Date: Tue, 28 Feb 2023 19:32:49 +0800 Subject: [PATCH 020/174] enh(taosAdapter): configurable Http status code (#20212) --- cmake/taosadapter_CMakeLists.txt.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/taosadapter_CMakeLists.txt.in b/cmake/taosadapter_CMakeLists.txt.in index a0e50a02d3..0ff1371618 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 9cfe416 + GIT_TAG 7920f98 SOURCE_DIR "${TD_SOURCE_DIR}/tools/taosadapter" BINARY_DIR "" #BUILD_IN_SOURCE TRUE From d319d6fe0064105adfd5c59b19fbf3f065e34653 Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Tue, 28 Feb 2023 19:52:03 +0800 Subject: [PATCH 021/174] more compact to enterprise --- source/dnode/vnode/CMakeLists.txt | 9 +- source/dnode/vnode/src/inc/vnd.h | 4 - source/dnode/vnode/src/tsdb/tsdbCompact.c | 664 ---------------------- source/dnode/vnode/src/vnd/vnodeCompact.c | 120 ---- source/dnode/vnode/src/vnd/vnodeSvr.c | 20 +- 5 files changed, 14 insertions(+), 803 deletions(-) delete mode 100644 source/dnode/vnode/src/tsdb/tsdbCompact.c delete mode 100644 source/dnode/vnode/src/vnd/vnodeCompact.c diff --git a/source/dnode/vnode/CMakeLists.txt b/source/dnode/vnode/CMakeLists.txt index 8b13d8f02b..cb5de67ab3 100644 --- a/source/dnode/vnode/CMakeLists.txt +++ b/source/dnode/vnode/CMakeLists.txt @@ -14,7 +14,6 @@ target_sources( "src/vnd/vnodeSvr.c" "src/vnd/vnodeSync.c" "src/vnd/vnodeSnapshot.c" - "src/vnd/vnodeCompact.c" "src/vnd/vnodeRetention.c" # meta @@ -53,7 +52,6 @@ target_sources( "src/tsdb/tsdbCacheRead.c" "src/tsdb/tsdbRetention.c" "src/tsdb/tsdbDiskData.c" - "src/tsdb/tsdbCompact.c" "src/tsdb/tsdbMergeTree.c" "src/tsdb/tsdbDataIter.c" @@ -72,7 +70,7 @@ target_sources( target_include_directories( vnode PUBLIC "inc" - PRIVATE "src/inc" + PUBLIC "src/inc" PUBLIC "${TD_SOURCE_DIR}/include/libs/scalar" ) target_link_libraries( @@ -99,6 +97,11 @@ IF (TD_GRANT) TARGET_LINK_LIBRARIES(vnode PUBLIC grant) ENDIF () +IF (TD_VNODE_PLUGINS) + TARGET_LINK_LIBRARIES(vnode PUBLIC vnode_plugin) +ENDIF () + + target_compile_definitions(vnode PUBLIC -DMETA_REFACT) if(${BUILD_WITH_INVERTEDINDEX}) diff --git a/source/dnode/vnode/src/inc/vnd.h b/source/dnode/vnode/src/inc/vnd.h index 88cd1d99e1..134909090f 100644 --- a/source/dnode/vnode/src/inc/vnd.h +++ b/source/dnode/vnode/src/inc/vnd.h @@ -106,10 +106,6 @@ int32_t vnodeSyncCommit(SVnode* pVnode); int32_t vnodeAsyncCommit(SVnode* pVnode); bool vnodeShouldRollback(SVnode* pVnode); -// vnodeCompact.c -int32_t vnodeAsyncCompact(SVnode* pVnode); -int32_t vnodeSyncCompact(SVnode* pVnode); - // vnodeSync.c int32_t vnodeSyncOpen(SVnode* pVnode, char* path); int32_t vnodeSyncStart(SVnode* pVnode); diff --git a/source/dnode/vnode/src/tsdb/tsdbCompact.c b/source/dnode/vnode/src/tsdb/tsdbCompact.c deleted file mode 100644 index 1cd11a3039..0000000000 --- a/source/dnode/vnode/src/tsdb/tsdbCompact.c +++ /dev/null @@ -1,664 +0,0 @@ -/* - * 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 "tsdb.h" - -extern int32_t tsdbUpdateTableSchema(SMeta *pMeta, int64_t suid, int64_t uid, SSkmInfo *pSkmInfo); -extern int32_t tsdbWriteDataBlock(SDataFWriter *pWriter, SBlockData *pBlockData, SMapData *mDataBlk, int8_t cmprAlg); -extern int32_t tsdbWriteSttBlock(SDataFWriter *pWriter, SBlockData *pBlockData, SArray *aSttBlk, int8_t cmprAlg); - -typedef struct { - STsdb *pTsdb; - int64_t commitID; - int8_t cmprAlg; - int32_t maxRows; - int32_t minRows; - - STsdbFS fs; - - int32_t fid; - TABLEID tbid; - SSkmInfo tbSkm; - - // Tombstone - SDelFReader *pDelFReader; - SArray *aDelIdx; // SArray - SArray *aDelData; // SArray - SArray *aSkyLine; // SArray - int32_t iDelIdx; - int32_t iSkyLine; - TSDBKEY *pDKey; - TSDBKEY dKey; - - // Reader - SDataFReader *pReader; - STsdbDataIter2 *iterList; // list of iterators - STsdbDataIter2 *pIter; - SRBTree rbt; - - // Writer - SDataFWriter *pWriter; - SArray *aBlockIdx; // SArray - SMapData mDataBlk; // SMapData - SArray *aSttBlk; // SArray - SBlockData bData; - SBlockData sData; -} STsdbCompactor; - -static int32_t tsdbAbortCompact(STsdbCompactor *pCompactor) { - int32_t code = 0; - int32_t lino = 0; - - STsdb *pTsdb = pCompactor->pTsdb; - code = tsdbFSRollback(pTsdb); - TSDB_CHECK_CODE(code, lino, _exit); - -_exit: - if (code) { - tsdbError("vgId:%d %s failed at line %d since %s", TD_VID(pTsdb->pVnode), __func__, lino, tstrerror(code)); - } else { - tsdbInfo("vgId:%d %s done", TD_VID(pTsdb->pVnode), __func__); - } - return code; -} - -static int32_t tsdbCompactWriteTableDataStart(STsdbCompactor *pCompactor, TABLEID *pId) { - int32_t code = 0; - int32_t lino = 0; - - pCompactor->tbid = *pId; - - // tombstone - for (;;) { - if (pCompactor->iDelIdx >= taosArrayGetSize(pCompactor->aDelIdx)) { - pCompactor->pDKey = NULL; - break; - } - - SDelIdx *pDelIdx = (SDelIdx *)taosArrayGet(pCompactor->aDelIdx, pCompactor->iDelIdx); - int32_t c = tTABLEIDCmprFn(pDelIdx, &pCompactor->tbid); - if (c < 0) { - pCompactor->iDelIdx++; - } else if (c == 0) { - pCompactor->iDelIdx++; - - code = tsdbReadDelData(pCompactor->pDelFReader, pDelIdx, pCompactor->aDelData); - TSDB_CHECK_CODE(code, lino, _exit); - - code = tsdbBuildDeleteSkyline(pCompactor->aDelData, 0, taosArrayGetSize(pCompactor->aDelData) - 1, - pCompactor->aSkyLine); - TSDB_CHECK_CODE(code, lino, _exit); - - pCompactor->iSkyLine = 0; - if (pCompactor->iSkyLine < taosArrayGetSize(pCompactor->aSkyLine)) { - TSDBKEY *pKey = (TSDBKEY *)taosArrayGet(pCompactor->aSkyLine, pCompactor->iSkyLine); - - pCompactor->dKey.version = 0; - pCompactor->dKey.ts = pKey->ts; - pCompactor->pDKey = &pCompactor->dKey; - } else { - pCompactor->pDKey = NULL; - } - break; - } else { - pCompactor->pDKey = NULL; - break; - } - } - - // writer - code = tsdbUpdateTableSchema(pCompactor->pTsdb->pVnode->pMeta, pId->suid, pId->uid, &pCompactor->tbSkm); - TSDB_CHECK_CODE(code, lino, _exit); - - tMapDataReset(&pCompactor->mDataBlk); - - code = tBlockDataInit(&pCompactor->bData, pId, pCompactor->tbSkm.pTSchema, NULL, 0); - TSDB_CHECK_CODE(code, lino, _exit); - - if (!TABLE_SAME_SCHEMA(pCompactor->sData.suid, pCompactor->sData.uid, pId->suid, pId->uid)) { - if (pCompactor->sData.nRow > 0) { - code = tsdbWriteSttBlock(pCompactor->pWriter, &pCompactor->sData, pCompactor->aSttBlk, pCompactor->cmprAlg); - TSDB_CHECK_CODE(code, lino, _exit); - } - - TABLEID tbid = {.suid = pId->suid, .uid = pId->suid ? 0 : pId->uid}; - code = tBlockDataInit(&pCompactor->sData, &tbid, pCompactor->tbSkm.pTSchema, NULL, 0); - TSDB_CHECK_CODE(code, lino, _exit); - } - -_exit: - if (code) { - tsdbError("vgId:%d %s failed at line %d since %s", TD_VID(pCompactor->pTsdb->pVnode), __func__, lino, - tstrerror(code)); - } else { - tsdbDebug("vgId:%d %s done, suid:%" PRId64 " uid:%" PRId64, TD_VID(pCompactor->pTsdb->pVnode), __func__, pId->suid, - pId->uid); - } - return code; -} - -static int32_t tsdbCompactWriteTableDataEnd(STsdbCompactor *pCompactor) { - int32_t code = 0; - int32_t lino = 0; - - if (pCompactor->bData.nRow > 0) { - if (pCompactor->bData.nRow < pCompactor->minRows) { - for (int32_t iRow = 0; iRow < pCompactor->bData.nRow; iRow++) { - code = tBlockDataAppendRow(&pCompactor->sData, &tsdbRowFromBlockData(&pCompactor->bData, iRow), NULL, - pCompactor->tbid.uid); - TSDB_CHECK_CODE(code, lino, _exit); - - if (pCompactor->sData.nRow >= pCompactor->maxRows) { - code = tsdbWriteSttBlock(pCompactor->pWriter, &pCompactor->sData, pCompactor->aSttBlk, pCompactor->cmprAlg); - TSDB_CHECK_CODE(code, lino, _exit); - } - } - tBlockDataClear(&pCompactor->bData); - } else { - code = tsdbWriteDataBlock(pCompactor->pWriter, &pCompactor->bData, &pCompactor->mDataBlk, pCompactor->cmprAlg); - TSDB_CHECK_CODE(code, lino, _exit); - } - } - - if (pCompactor->mDataBlk.nItem > 0) { - SBlockIdx *pBlockIdx = (SBlockIdx *)taosArrayReserve(pCompactor->aBlockIdx, 1); - if (pBlockIdx == NULL) { - code = TSDB_CODE_OUT_OF_MEMORY; - TSDB_CHECK_CODE(code, lino, _exit); - } - - pBlockIdx->suid = pCompactor->tbid.suid; - pBlockIdx->uid = pCompactor->tbid.uid; - - code = tsdbWriteDataBlk(pCompactor->pWriter, &pCompactor->mDataBlk, pBlockIdx); - TSDB_CHECK_CODE(code, lino, _exit); - } - -_exit: - if (code) { - tsdbError("vgId:%d %s failed at line %d since %s", TD_VID(pCompactor->pTsdb->pVnode), __func__, lino, - tstrerror(code)); - } else { - tsdbDebug("vgId:%d %s done, suid:%" PRId64 " uid:%" PRId64, TD_VID(pCompactor->pTsdb->pVnode), __func__, - pCompactor->tbid.suid, pCompactor->tbid.uid); - } - return code; -} - -static bool tsdbCompactRowIsDeleted(STsdbCompactor *pCompactor, TSDBROW *pRow) { - TSDBKEY tKey = TSDBROW_KEY(pRow); - TSDBKEY *aKey = (TSDBKEY *)TARRAY_DATA(pCompactor->aSkyLine); - int32_t nKey = TARRAY_SIZE(pCompactor->aSkyLine); - - if (tKey.ts > pCompactor->pDKey->ts) { - do { - pCompactor->pDKey->version = aKey[pCompactor->iSkyLine].version; - pCompactor->iSkyLine++; - if (pCompactor->iSkyLine < nKey) { - pCompactor->dKey.ts = aKey[pCompactor->iSkyLine].ts; - } else { - if (pCompactor->pDKey->version == 0) { - pCompactor->pDKey = NULL; - return false; - } else { - pCompactor->pDKey->ts = INT64_MAX; - } - } - } while (tKey.ts > pCompactor->pDKey->ts); - } - - if (tKey.ts < pCompactor->pDKey->ts) { - if (tKey.version > pCompactor->pDKey->version) { - return false; - } else { - return true; - } - } else if (tKey.ts == pCompactor->pDKey->ts) { - ASSERT(pCompactor->iSkyLine < nKey); - if (tKey.version > TMAX(pCompactor->pDKey->version, aKey[pCompactor->iSkyLine].version)) { - return false; - } else { - return true; - } - } - - return false; -} - -static int32_t tsdbCompactWriteTableData(STsdbCompactor *pCompactor, SRowInfo *pRowInfo) { - int32_t code = 0; - int32_t lino = 0; - - // start a new table data write if need - if (pRowInfo == NULL || pRowInfo->uid != pCompactor->tbid.uid) { - if (pCompactor->tbid.uid) { - code = tsdbCompactWriteTableDataEnd(pCompactor); - TSDB_CHECK_CODE(code, lino, _exit); - } - - if (pRowInfo == NULL) { - if (pCompactor->sData.nRow > 0) { - code = tsdbWriteSttBlock(pCompactor->pWriter, &pCompactor->sData, pCompactor->aSttBlk, pCompactor->cmprAlg); - TSDB_CHECK_CODE(code, lino, _exit); - } - return code; - } - - code = tsdbCompactWriteTableDataStart(pCompactor, (TABLEID *)pRowInfo); - TSDB_CHECK_CODE(code, lino, _exit); - } - - // check if row is deleted - if (pCompactor->pDKey && tsdbCompactRowIsDeleted(pCompactor, &pRowInfo->row)) goto _exit; - - if (tBlockDataTryUpsertRow(&pCompactor->bData, &pRowInfo->row, pRowInfo->uid) > pCompactor->maxRows) { - code = tsdbWriteDataBlock(pCompactor->pWriter, &pCompactor->bData, &pCompactor->mDataBlk, pCompactor->cmprAlg); - TSDB_CHECK_CODE(code, lino, _exit); - } - - code = tBlockDataUpsertRow(&pCompactor->bData, &pRowInfo->row, NULL, pRowInfo->uid); - TSDB_CHECK_CODE(code, lino, _exit); - -_exit: - if (code) { - tsdbError("vgId:%d %s failed at line %d since %s", TD_VID(pCompactor->pTsdb->pVnode), __func__, lino, - tstrerror(code)); - } else if (pRowInfo) { - tsdbTrace("vgId:%d %s done, suid:%" PRId64 " uid:%" PRId64 " ts:%" PRId64 " version:%" PRId64, - TD_VID(pCompactor->pTsdb->pVnode), __func__, pRowInfo->suid, pRowInfo->uid, TSDBROW_TS(&pRowInfo->row), - TSDBROW_VERSION(&pRowInfo->row)); - } - return code; -} - -static bool tsdbCompactTableIsDropped(STsdbCompactor *pCompactor) { - SMetaInfo info; - - if (pCompactor->pIter->rowInfo.uid == pCompactor->tbid.uid) return false; - if (metaGetInfo(pCompactor->pTsdb->pVnode->pMeta, pCompactor->pIter->rowInfo.uid, &info, NULL)) { - return true; - } - return false; -} -static int32_t tsdbCompactNextRow(STsdbCompactor *pCompactor, SRowInfo **ppRowInfo) { - int32_t code = 0; - int32_t lino = 0; - - for (;;) { - if (pCompactor->pIter) { - code = tsdbDataIterNext2(pCompactor->pIter, NULL); - TSDB_CHECK_CODE(code, lino, _exit); - - if (pCompactor->pIter->rowInfo.suid == 0 && pCompactor->pIter->rowInfo.uid == 0) { - pCompactor->pIter = NULL; - } else { - SRBTreeNode *pNode = tRBTreeMin(&pCompactor->rbt); - if (pNode) { - int32_t c = tsdbDataIterCmprFn(&pCompactor->pIter->rbtn, pNode); - if (c > 0) { - tRBTreePut(&pCompactor->rbt, &pCompactor->pIter->rbtn); - pCompactor->pIter = NULL; - } else if (c == 0) { - ASSERT(0); - } - } - } - } - - if (pCompactor->pIter == NULL) { - SRBTreeNode *pNode = tRBTreeDropMin(&pCompactor->rbt); - if (pNode) { - pCompactor->pIter = TSDB_RBTN_TO_DATA_ITER(pNode); - } - } - - if (pCompactor->pIter) { - if (tsdbCompactTableIsDropped(pCompactor)) { - TABLEID tbid = {.suid = pCompactor->pIter->rowInfo.suid, .uid = pCompactor->pIter->rowInfo.uid}; - tRBTreeClear(&pCompactor->rbt); - for (pCompactor->pIter = pCompactor->iterList; pCompactor->pIter; pCompactor->pIter = pCompactor->pIter->next) { - code = tsdbDataIterNext2(pCompactor->pIter, - &(STsdbFilterInfo){.flag = TSDB_FILTER_FLAG_BY_TABLEID, .tbid = tbid}); - TSDB_CHECK_CODE(code, lino, _exit); - - if (pCompactor->pIter->rowInfo.suid || pCompactor->pIter->rowInfo.uid) { - tRBTreePut(&pCompactor->rbt, &pCompactor->pIter->rbtn); - } - } - } else { - *ppRowInfo = &pCompactor->pIter->rowInfo; - break; - } - } else { - *ppRowInfo = NULL; - break; - } - } - -_exit: - if (code) { - tsdbError("vgId:%d %s failed at line %d since %s", TD_VID(pCompactor->pTsdb->pVnode), __func__, lino, - tstrerror(code)); - } - return code; -} - -static int32_t tsdbCompactFileSetStart(STsdbCompactor *pCompactor, SDFileSet *pSet) { - int32_t code = 0; - int32_t lino = 0; - - pCompactor->fid = pSet->fid; - pCompactor->tbid = (TABLEID){0}; - - /* tombstone */ - pCompactor->iDelIdx = 0; - - /* reader */ - code = tsdbDataFReaderOpen(&pCompactor->pReader, pCompactor->pTsdb, pSet); - TSDB_CHECK_CODE(code, lino, _exit); - - code = tsdbOpenDataFileDataIter(pCompactor->pReader, &pCompactor->pIter); - TSDB_CHECK_CODE(code, lino, _exit); - - tRBTreeCreate(&pCompactor->rbt, tsdbDataIterCmprFn); - if (pCompactor->pIter) { - pCompactor->pIter->next = pCompactor->iterList; - pCompactor->iterList = pCompactor->pIter; - - code = tsdbDataIterNext2(pCompactor->pIter, NULL); - TSDB_CHECK_CODE(code, lino, _exit); - - ASSERT(pCompactor->pIter->rowInfo.suid || pCompactor->pIter->rowInfo.uid); - tRBTreePut(&pCompactor->rbt, &pCompactor->pIter->rbtn); - } - - for (int32_t iStt = 0; iStt < pSet->nSttF; iStt++) { - code = tsdbOpenSttFileDataIter(pCompactor->pReader, iStt, &pCompactor->pIter); - TSDB_CHECK_CODE(code, lino, _exit); - - if (pCompactor->pIter) { - pCompactor->pIter->next = pCompactor->iterList; - pCompactor->iterList = pCompactor->pIter; - - code = tsdbDataIterNext2(pCompactor->pIter, NULL); - TSDB_CHECK_CODE(code, lino, _exit); - - ASSERT(pCompactor->pIter->rowInfo.suid || pCompactor->pIter->rowInfo.uid); - tRBTreePut(&pCompactor->rbt, &pCompactor->pIter->rbtn); - } - } - pCompactor->pIter = NULL; - - /* writer */ - code = tsdbDataFWriterOpen(&pCompactor->pWriter, pCompactor->pTsdb, - &(SDFileSet){.fid = pCompactor->fid, - .diskId = pSet->diskId, - .pHeadF = &(SHeadFile){.commitID = pCompactor->commitID}, - .pDataF = &(SDataFile){.commitID = pCompactor->commitID}, - .pSmaF = &(SSmaFile){.commitID = pCompactor->commitID}, - .nSttF = 1, - .aSttF = {&(SSttFile){.commitID = pCompactor->commitID}}}); - TSDB_CHECK_CODE(code, lino, _exit); - - if (pCompactor->aBlockIdx) { - taosArrayClear(pCompactor->aBlockIdx); - } else if ((pCompactor->aBlockIdx = taosArrayInit(0, sizeof(SBlockIdx))) == NULL) { - code = TSDB_CODE_OUT_OF_MEMORY; - TSDB_CHECK_CODE(code, lino, _exit); - } - - tMapDataReset(&pCompactor->mDataBlk); - - if (pCompactor->aSttBlk) { - taosArrayClear(pCompactor->aSttBlk); - } else if ((pCompactor->aSttBlk = taosArrayInit(0, sizeof(SSttBlk))) == NULL) { - code = TSDB_CODE_OUT_OF_MEMORY; - TSDB_CHECK_CODE(code, lino, _exit); - } - - tBlockDataReset(&pCompactor->bData); - tBlockDataReset(&pCompactor->sData); - -_exit: - if (code) { - tsdbError("vgId:%d %s failed at line %d since %s, fid:%d", TD_VID(pCompactor->pTsdb->pVnode), __func__, lino, - tstrerror(code), pCompactor->fid); - } else { - tsdbInfo("vgId:%d %s done, fid:%d", TD_VID(pCompactor->pTsdb->pVnode), __func__, pCompactor->fid); - } - return code; -} - -static int32_t tsdbCompactFileSetEnd(STsdbCompactor *pCompactor) { - int32_t code = 0; - int32_t lino = 0; - - ASSERT(pCompactor->bData.nRow == 0); - ASSERT(pCompactor->sData.nRow == 0); - - /* update files */ - code = tsdbWriteSttBlk(pCompactor->pWriter, pCompactor->aSttBlk); - TSDB_CHECK_CODE(code, lino, _exit); - - code = tsdbWriteBlockIdx(pCompactor->pWriter, pCompactor->aBlockIdx); - TSDB_CHECK_CODE(code, lino, _exit); - - code = tsdbUpdateDFileSetHeader(pCompactor->pWriter); - TSDB_CHECK_CODE(code, lino, _exit); - - code = tsdbFSUpsertFSet(&pCompactor->fs, &pCompactor->pWriter->wSet); - TSDB_CHECK_CODE(code, lino, _exit); - - code = tsdbDataFWriterClose(&pCompactor->pWriter, 1); - TSDB_CHECK_CODE(code, lino, _exit); - - code = tsdbDataFReaderClose(&pCompactor->pReader); - TSDB_CHECK_CODE(code, lino, _exit); - - /* do clear */ - while ((pCompactor->pIter = pCompactor->iterList) != NULL) { - pCompactor->iterList = pCompactor->pIter->next; - tsdbCloseDataIter2(pCompactor->pIter); - } - - tBlockDataReset(&pCompactor->bData); - tBlockDataReset(&pCompactor->sData); - -_exit: - if (code) { - tsdbError("vgId:%d %s failed at line %d since %s, fid:%d", TD_VID(pCompactor->pTsdb->pVnode), __func__, lino, - tstrerror(code), pCompactor->fid); - } else { - tsdbInfo("vgId:%d %s done, fid:%d", TD_VID(pCompactor->pTsdb->pVnode), __func__, pCompactor->fid); - } - return code; -} - -static int32_t tsdbCompactFileSet(STsdbCompactor *pCompactor, SDFileSet *pSet) { - int32_t code = 0; - int32_t lino = 0; - - // start compact - code = tsdbCompactFileSetStart(pCompactor, pSet); - TSDB_CHECK_CODE(code, lino, _exit); - - // do compact, end with a NULL row - SRowInfo *pRowInfo; - do { - code = tsdbCompactNextRow(pCompactor, &pRowInfo); - TSDB_CHECK_CODE(code, lino, _exit); - - code = tsdbCompactWriteTableData(pCompactor, pRowInfo); - TSDB_CHECK_CODE(code, lino, _exit); - } while (pRowInfo); - - // end compact - code = tsdbCompactFileSetEnd(pCompactor); - TSDB_CHECK_CODE(code, lino, _exit); - -_exit: - if (code) { - tsdbError("vgId:%d %s failed at line %d since %s, fid:%d", TD_VID(pCompactor->pTsdb->pVnode), __func__, lino, - tstrerror(code), pCompactor->fid); - if (pCompactor->pWriter) tsdbDataFWriterClose(&pCompactor->pWriter, 0); - while ((pCompactor->pIter = pCompactor->iterList)) { - pCompactor->iterList = pCompactor->pIter->next; - tsdbCloseDataIter2(pCompactor->pIter); - } - if (pCompactor->pReader) tsdbDataFReaderClose(&pCompactor->pReader); - } - return code; -} - -static void tsdbEndCompact(STsdbCompactor *pCompactor) { - // writer - tBlockDataDestroy(&pCompactor->sData); - tBlockDataDestroy(&pCompactor->bData); - taosArrayDestroy(pCompactor->aSttBlk); - tMapDataClear(&pCompactor->mDataBlk); - taosArrayDestroy(pCompactor->aBlockIdx); - - // reader - - // tombstone - taosArrayDestroy(pCompactor->aSkyLine); - taosArrayDestroy(pCompactor->aDelData); - taosArrayDestroy(pCompactor->aDelIdx); - - // others - tDestroyTSchema(pCompactor->tbSkm.pTSchema); - tsdbFSDestroy(&pCompactor->fs); - - tsdbInfo("vgId:%d %s done, commit ID:%" PRId64, TD_VID(pCompactor->pTsdb->pVnode), __func__, pCompactor->commitID); -} - -static int32_t tsdbBeginCompact(STsdb *pTsdb, SCompactInfo *pInfo, STsdbCompactor *pCompactor) { - int32_t code = 0; - int32_t lino = 0; - - pCompactor->pTsdb = pTsdb; - pCompactor->commitID = pInfo->commitID; - pCompactor->cmprAlg = pTsdb->pVnode->config.tsdbCfg.compression; - pCompactor->maxRows = pTsdb->pVnode->config.tsdbCfg.maxRows; - pCompactor->minRows = pTsdb->pVnode->config.tsdbCfg.minRows; - pCompactor->fid = INT32_MIN; - - code = tsdbFSCopy(pTsdb, &pCompactor->fs); - TSDB_CHECK_CODE(code, lino, _exit); - - /* tombstone */ - if (pCompactor->fs.pDelFile) { - code = tsdbDelFReaderOpen(&pCompactor->pDelFReader, pCompactor->fs.pDelFile, pTsdb); - TSDB_CHECK_CODE(code, lino, _exit); - - if ((pCompactor->aDelIdx = taosArrayInit(0, sizeof(SDelIdx))) == NULL) { - code = TSDB_CODE_OUT_OF_MEMORY; - TSDB_CHECK_CODE(code, lino, _exit); - } - - if ((pCompactor->aDelData = taosArrayInit(0, sizeof(SDelData))) == NULL) { - code = TSDB_CODE_OUT_OF_MEMORY; - TSDB_CHECK_CODE(code, lino, _exit); - } - - if ((pCompactor->aSkyLine = taosArrayInit(0, sizeof(TSDBKEY))) == NULL) { - code = TSDB_CODE_OUT_OF_MEMORY; - TSDB_CHECK_CODE(code, lino, _exit); - } - - code = tsdbReadDelIdx(pCompactor->pDelFReader, pCompactor->aDelIdx); - TSDB_CHECK_CODE(code, lino, _exit); - } - - /* reader */ - - /* writer */ - code = tBlockDataCreate(&pCompactor->bData); - TSDB_CHECK_CODE(code, lino, _exit); - - code = tBlockDataCreate(&pCompactor->sData); - TSDB_CHECK_CODE(code, lino, _exit); - -_exit: - if (code) { - tsdbError("vgId:%d %s failed at line %d since %s, commit ID:%" PRId64, TD_VID(pTsdb->pVnode), __func__, lino, - tstrerror(code), pCompactor->commitID); - tBlockDataDestroy(&pCompactor->sData); - tBlockDataDestroy(&pCompactor->bData); - if (pCompactor->fs.pDelFile) { - taosArrayDestroy(pCompactor->aSkyLine); - taosArrayDestroy(pCompactor->aDelData); - taosArrayDestroy(pCompactor->aDelIdx); - if (pCompactor->pDelFReader) tsdbDelFReaderClose(&pCompactor->pDelFReader); - } - tsdbFSDestroy(&pCompactor->fs); - } else { - tsdbInfo("vgId:%d %s done, commit ID:%" PRId64, TD_VID(pTsdb->pVnode), __func__, pCompactor->commitID); - } - return code; -} - -int32_t tsdbCompact(STsdb *pTsdb, SCompactInfo *pInfo) { - int32_t code = 0; - - STsdbCompactor *pCompactor = &(STsdbCompactor){0}; - - if ((code = tsdbBeginCompact(pTsdb, pInfo, pCompactor))) return code; - - for (;;) { - SDFileSet *pSet = (SDFileSet *)taosArraySearch(pCompactor->fs.aDFileSet, &(SDFileSet){.fid = pCompactor->fid}, - tDFileSetCmprFn, TD_GT); - if (pSet == NULL) { - pCompactor->fid = INT32_MAX; - break; - } - - if ((code = tsdbCompactFileSet(pCompactor, pSet))) goto _exit; - } - - if ((code = tsdbFSUpsertDelFile(&pCompactor->fs, NULL))) goto _exit; - -_exit: - if (code) { - tsdbAbortCompact(pCompactor); - } else { - tsdbFSPrepareCommit(pTsdb, &pCompactor->fs); - } - tsdbEndCompact(pCompactor); - return code; -} - -int32_t tsdbCommitCompact(STsdb *pTsdb) { - int32_t code = 0; - int32_t lino = 0; - - taosThreadRwlockWrlock(&pTsdb->rwLock); - - code = tsdbFSCommit(pTsdb); - if (code) { - taosThreadRwlockUnlock(&pTsdb->rwLock); - TSDB_CHECK_CODE(code, lino, _exit); - } - - taosThreadRwlockUnlock(&pTsdb->rwLock); - -_exit: - if (code) { - tsdbError("vgId:%d %s failed at line %d since %s", TD_VID(pTsdb->pVnode), __func__, lino, tstrerror(code)); - } else { - tsdbInfo("vgId:%d %s done", TD_VID(pTsdb->pVnode), __func__); - } - return code; -} diff --git a/source/dnode/vnode/src/vnd/vnodeCompact.c b/source/dnode/vnode/src/vnd/vnodeCompact.c deleted file mode 100644 index 2b7abee99a..0000000000 --- a/source/dnode/vnode/src/vnd/vnodeCompact.c +++ /dev/null @@ -1,120 +0,0 @@ -/* - * 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 "vnd.h" - -extern int32_t tsdbCommitCompact(STsdb *pTsdb); - -static int32_t vnodeCompactTask(void *param) { - int32_t code = 0; - int32_t lino = 0; - - SCompactInfo *pInfo = (SCompactInfo *)param; - SVnode *pVnode = pInfo->pVnode; - - // do compact - code = tsdbCompact(pInfo->pVnode->pTsdb, pInfo); - TSDB_CHECK_CODE(code, lino, _exit); - - // end compact - char dir[TSDB_FILENAME_LEN] = {0}; - if (pVnode->pTfs) { - snprintf(dir, TSDB_FILENAME_LEN, "%s%s%s", tfsGetPrimaryPath(pVnode->pTfs), TD_DIRSEP, pVnode->path); - } else { - snprintf(dir, TSDB_FILENAME_LEN, "%s", pVnode->path); - } - - vnodeCommitInfo(dir); - - tsdbCommitCompact(pVnode->pTsdb); - -_exit: - tsem_post(&pInfo->pVnode->canCommit); - taosMemoryFree(pInfo); - return code; -} -static int32_t vnodePrepareCompact(SVnode *pVnode, SCompactInfo *pInfo) { - int32_t code = 0; - int32_t lino = 0; - - tsem_wait(&pVnode->canCommit); - - pInfo->pVnode = pVnode; - pInfo->flag = 0; - pInfo->commitID = ++pVnode->state.commitID; - - char dir[TSDB_FILENAME_LEN] = {0}; - SVnodeInfo info = {0}; - - if (pVnode->pTfs) { - snprintf(dir, TSDB_FILENAME_LEN, "%s%s%s", tfsGetPrimaryPath(pVnode->pTfs), TD_DIRSEP, pVnode->path); - } else { - snprintf(dir, TSDB_FILENAME_LEN, "%s", pVnode->path); - } - - if (vnodeLoadInfo(dir, &info) < 0) { - code = terrno; - goto _exit; - } - - info.state.commitID = pInfo->commitID; - - if (vnodeSaveInfo(dir, &info) < 0) { - code = terrno; - goto _exit; - } - -_exit: - if (code) { - vError("vgId:%d %s failed at line %d since %s, commit ID:%" PRId64, TD_VID(pVnode), __func__, lino, tstrerror(code), - pVnode->state.commitID); - } else { - vDebug("vgId:%d %s done, commit ID:%" PRId64, TD_VID(pVnode), __func__, pVnode->state.commitID); - } - return code; -} -int32_t vnodeAsyncCompact(SVnode *pVnode) { - int32_t code = 0; - int32_t lino = 0; - - SCompactInfo *pInfo = taosMemoryCalloc(1, sizeof(*pInfo)); - if (pInfo == NULL) { - code = TSDB_CODE_OUT_OF_MEMORY; - TSDB_CHECK_CODE(code, lino, _exit); - } - - vnodeAsyncCommit(pVnode); - - code = vnodePrepareCompact(pVnode, pInfo); - TSDB_CHECK_CODE(code, lino, _exit); - - vnodeScheduleTask(vnodeCompactTask, pInfo); - -_exit: - if (code) { - vError("vgId:%d %s failed at line %d since %s", TD_VID(pVnode), __func__, lino, tstrerror(code)); - if (pInfo) taosMemoryFree(pInfo); - } else { - vInfo("vgId:%d %s done", TD_VID(pVnode), __func__); - } - return code; -} - -int32_t vnodeSyncCompact(SVnode *pVnode) { - vnodeAsyncCompact(pVnode); - tsem_wait(&pVnode->canCommit); - tsem_post(&pVnode->canCommit); - return 0; -} \ No newline at end of file diff --git a/source/dnode/vnode/src/vnd/vnodeSvr.c b/source/dnode/vnode/src/vnd/vnodeSvr.c index 192a3615e1..3525e696c5 100644 --- a/source/dnode/vnode/src/vnd/vnodeSvr.c +++ b/source/dnode/vnode/src/vnd/vnodeSvr.c @@ -1641,17 +1641,13 @@ static int32_t vnodeProcessDropIndexReq(SVnode *pVnode, int64_t version, void *p return TSDB_CODE_SUCCESS; } +extern int32_t vnodeProcessCompactVnodeReqImpl(SVnode *pVnode, int64_t version, void *pReq, int32_t len, SRpcMsg *pRsp); + static int32_t vnodeProcessCompactVnodeReq(SVnode *pVnode, int64_t version, void *pReq, int32_t len, SRpcMsg *pRsp) { - SCompactVnodeReq req = {0}; - if (tDeserializeSCompactVnodeReq(pReq, len, &req) != 0) { - terrno = TSDB_CODE_INVALID_MSG; - return TSDB_CODE_INVALID_MSG; - } - vInfo("vgId:%d, compact msg will be processed, db:%s dbUid:%" PRId64 " compactStartTime:%" PRId64, TD_VID(pVnode), - req.db, req.dbUid, req.compactStartTime); - - vnodeAsyncCompact(pVnode); - vnodeBegin(pVnode); - - return 0; + return vnodeProcessCompactVnodeReqImpl(pVnode, version, pReq, len, pRsp); } + + +#ifndef TD_ENTERPRISE +int32_t vnodeProcessCompactVnodeReqImpl(SVnode *pVnode, int64_t version, void *pReq, int32_t len, SRpcMsg *pRsp) { return 0; } +#endif From 431244011204308899e5b0e48f6fc59513a7b42a Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Tue, 28 Feb 2023 19:53:17 +0800 Subject: [PATCH 022/174] fix: invalid read memory issue --- source/client/inc/clientInt.h | 3 ++- source/client/src/clientHb.c | 34 ++++++++++++++++++++++------------ 2 files changed, 24 insertions(+), 13 deletions(-) diff --git a/source/client/inc/clientInt.h b/source/client/inc/clientInt.h index 7cc7a1717a..b10daa9c21 100644 --- a/source/client/inc/clientInt.h +++ b/source/client/inc/clientInt.h @@ -66,7 +66,8 @@ enum { typedef struct SAppInstInfo SAppInstInfo; typedef struct { - char* key; + char* key; + int32_t idx; // statistics int32_t reportCnt; int32_t connKeyCnt; diff --git a/source/client/src/clientHb.c b/source/client/src/clientHb.c index b5838386db..c9c2e7a5f8 100644 --- a/source/client/src/clientHb.c +++ b/source/client/src/clientHb.c @@ -303,8 +303,12 @@ static int32_t hbQueryHbRspHandle(SAppHbMgr *pAppHbMgr, SClientHbRsp *pRsp) { } static int32_t hbAsyncCallBack(void *param, SDataBuf *pMsg, int32_t code) { + if (0 == atomic_load_8(&clientHbMgr.inited)) { + goto _return; + } + static int32_t emptyRspNum = 0; - char *key = (char *)param; + int32_t idx = *(int32_t *)param; SClientHbBatchRsp pRsp = {0}; if (TSDB_CODE_SUCCESS == code) { tDeserializeSClientHbBatchRsp(pMsg->pData, pMsg->len, &pRsp); @@ -319,22 +323,24 @@ static int32_t hbAsyncCallBack(void *param, SDataBuf *pMsg, int32_t code) { int32_t rspNum = taosArrayGetSize(pRsp.rsps); - taosThreadMutexLock(&appInfo.mutex); + taosThreadMutexLock(&clientHbMgr.lock); - SAppInstInfo **pInst = taosHashGet(appInfo.pInstMap, key, strlen(key)); - if (pInst == NULL || NULL == *pInst) { - taosThreadMutexUnlock(&appInfo.mutex); - tscError("cluster not exist, key:%s", key); + SAppHbMgr *pAppHbMgr = taosArrayGetP(clientHbMgr.appHbMgrs, idx); + if (pAppHbMgr == NULL) { + taosThreadMutexUnlock(&clientHbMgr.lock); + tscError("appHbMgr not exist, idx:%d", idx); taosMemoryFree(pMsg->pData); taosMemoryFree(pMsg->pEpSet); tFreeClientHbBatchRsp(&pRsp); return -1; } + SAppInstInfo *pInst = pAppHbMgr->pAppInstInfo; + if (code != 0) { - (*pInst)->onlineDnodes = ((*pInst)->totalDnodes ? 0 : -1); - tscDebug("hb rsp error %s, update server status %d/%d", tstrerror(code), (*pInst)->onlineDnodes, - (*pInst)->totalDnodes); + pInst->onlineDnodes = pInst->totalDnodes ? 0 : -1; + tscDebug("hb rsp error %s, update server status %d/%d", tstrerror(code), pInst->onlineDnodes, + pInst->totalDnodes); } if (rspNum) { @@ -346,15 +352,17 @@ static int32_t hbAsyncCallBack(void *param, SDataBuf *pMsg, int32_t code) { for (int32_t i = 0; i < rspNum; ++i) { SClientHbRsp *rsp = taosArrayGet(pRsp.rsps, i); - code = (*clientHbMgr.rspHandle[rsp->connKey.connType])((*pInst)->pAppHbMgr, rsp); + code = (*clientHbMgr.rspHandle[rsp->connKey.connType])(pAppHbMgr, rsp); if (code) { break; } } - taosThreadMutexUnlock(&appInfo.mutex); + taosThreadMutexUnlock(&clientHbMgr.lock); tFreeClientHbBatchRsp(&pRsp); + +_return: taosMemoryFree(pMsg->pData); taosMemoryFree(pMsg->pEpSet); return code; @@ -788,7 +796,8 @@ static void *hbThreadFunc(void *param) { pInfo->msgInfo.pData = buf; pInfo->msgInfo.len = tlen; pInfo->msgType = TDMT_MND_HEARTBEAT; - pInfo->param = taosStrdup(pAppHbMgr->key); + pInfo->param = taosMemoryMalloc(sizeof(int32_t)); + *(int32_t *)pInfo->param = i; pInfo->paramFreeFp = taosMemoryFree; pInfo->requestId = generateRequestId(); pInfo->requestObjRefId = 0; @@ -874,6 +883,7 @@ SAppHbMgr *appHbMgrInit(SAppInstInfo *pAppInstInfo, char *key) { taosThreadMutexLock(&clientHbMgr.lock); taosArrayPush(clientHbMgr.appHbMgrs, &pAppHbMgr); + pAppHbMgr->idx = taosArrayGetSize(clientHbMgr.appHbMgrs) - 1; taosThreadMutexUnlock(&clientHbMgr.lock); return pAppHbMgr; From b5efd1ba057201fb4d0e3abe3bcd99a8f8ee8d27 Mon Sep 17 00:00:00 2001 From: haoranchen Date: Tue, 28 Feb 2023 20:31:40 +0800 Subject: [PATCH 023/174] Update cases.task --- tests/parallel_test/cases.task | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/parallel_test/cases.task b/tests/parallel_test/cases.task index c70a50867b..e933bdb693 100644 --- a/tests/parallel_test/cases.task +++ b/tests/parallel_test/cases.task @@ -680,8 +680,8 @@ ,,y,system-test,./pytest.sh python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopVnodeCreateStb.py -N 6 -M 3 -n 3 ,,y,system-test,./pytest.sh python3 ./test.py -f 6-cluster/5dnode3mnodeRestartDnodeInsertData.py -N 6 -M 3 ,,y,system-test,./pytest.sh python3 ./test.py -f 6-cluster/5dnode3mnodeRestartDnodeInsertData.py -N 6 -M 3 -n 3 -#,,y,system-test,./pytest.sh python3 ./test.py -f 6-cluster/5dnode3mnodeRestartDnodeInsertDataAsync.py -N 6 -M 3 -#,,y,system-test,./pytest.sh python3 ./test.py -f 6-cluster/5dnode3mnodeRestartDnodeInsertDataAsync.py -N 6 -M 3 -n 3 +,,y,system-test,./pytest.sh python3 ./test.py -f 6-cluster/5dnode3mnodeRestartDnodeInsertDataAsync.py -N 6 -M 3 +,,y,system-test,./pytest.sh python3 ./test.py -f 6-cluster/5dnode3mnodeRestartDnodeInsertDataAsync.py -N 6 -M 3 -n 3 ,,y,system-test,./pytest.sh python3 ./test.py -f 6-cluster/5dnode3mnodeAdd1Ddnoe.py -N 7 -M 3 -C 6 ,,y,system-test,./pytest.sh python3 ./test.py -f 6-cluster/5dnode3mnodeAdd1Ddnoe.py -N 7 -M 3 -C 6 -n 3 From ba83826ce1031a97c412786a8ecea9eae1c10115 Mon Sep 17 00:00:00 2001 From: Shuduo Sang Date: Tue, 28 Feb 2023 21:27:04 +0800 Subject: [PATCH 024/174] fix: taosdump time range (#20215) --- cmake/taostools_CMakeLists.txt.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/taostools_CMakeLists.txt.in b/cmake/taostools_CMakeLists.txt.in index db2ae92f6e..aecb8a1750 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 1e15545 + GIT_TAG 0111c66 SOURCE_DIR "${TD_SOURCE_DIR}/tools/taos-tools" BINARY_DIR "" #BUILD_IN_SOURCE TRUE From caaff5c5463d0a077adc64438db59fe0526d25fe Mon Sep 17 00:00:00 2001 From: Benguang Zhao Date: Wed, 1 Mar 2023 10:02:33 +0800 Subject: [PATCH 025/174] enh: rotate wal of mnode properly --- source/dnode/mnode/impl/src/mndMain.c | 16 +++------------- source/dnode/mnode/impl/src/mndSync.c | 3 ++- source/dnode/mnode/impl/src/mndTrans.c | 2 -- source/dnode/mnode/sdb/inc/sdb.h | 2 +- source/dnode/mnode/sdb/src/sdb.c | 1 - source/dnode/mnode/sdb/src/sdbFile.c | 11 ++--------- 6 files changed, 8 insertions(+), 27 deletions(-) diff --git a/source/dnode/mnode/impl/src/mndMain.c b/source/dnode/mnode/impl/src/mndMain.c index 53a5548b2f..b09a4f63a7 100644 --- a/source/dnode/mnode/impl/src/mndMain.c +++ b/source/dnode/mnode/impl/src/mndMain.c @@ -344,8 +344,8 @@ static int32_t mndInitWal(SMnode *pMnode) { .fsyncPeriod = 0, .rollPeriod = -1, .segSize = -1, - .retentionPeriod = -1, - .retentionSize = -1, + .retentionPeriod = 0, + .retentionSize = 0, .level = TAOS_WAL_FSYNC, }; @@ -370,7 +370,6 @@ static int32_t mndInitSdb(SMnode *pMnode) { opt.path = pMnode->path; opt.pMnode = pMnode; opt.pWal = pMnode->pWal; - opt.sync = pMnode->syncMgmt.sync; pMnode->pSdb = sdbInit(&opt); if (pMnode->pSdb == NULL) { @@ -552,16 +551,7 @@ void mndPreClose(SMnode *pMnode) { if (pMnode != NULL) { syncLeaderTransfer(pMnode->syncMgmt.sync); syncPreStop(pMnode->syncMgmt.sync); -#if 0 - while (syncSnapshotRecving(pMnode->syncMgmt.sync)) { - mInfo("vgId:1, snapshot is recving"); - taosMsleep(300); - } - while (syncSnapshotSending(pMnode->syncMgmt.sync)) { - mInfo("vgId:1, snapshot is sending"); - taosMsleep(300); - } -#endif + sdbWriteFile(pMnode->pSdb, 0); } } diff --git a/source/dnode/mnode/impl/src/mndSync.c b/source/dnode/mnode/impl/src/mndSync.c index f618b8afae..edd75c62b9 100644 --- a/source/dnode/mnode/impl/src/mndSync.c +++ b/source/dnode/mnode/impl/src/mndSync.c @@ -118,12 +118,12 @@ int32_t mndProcessWriteMsg(const SSyncFSM *pFsm, SRpcMsg *pMsg, const SFsmCbMeta transId, pTrans->createdTime, pMgmt->transId); mndTransExecute(pMnode, pTrans, false); mndReleaseTrans(pMnode, pTrans); - // sdbWriteFile(pMnode->pSdb, SDB_WRITE_DELTA); } else { mError("trans:%d, not found while execute in mnode since %s", transId, terrstr()); } } + sdbWriteFile(pMnode->pSdb, SDB_WRITE_DELTA); return 0; } @@ -319,6 +319,7 @@ int32_t mndInitSync(SMnode *pMnode) { mError("failed to open sync since %s", terrstr()); return -1; } + pMnode->pSdb->sync = pMgmt->sync; mInfo("mnode-sync is opened, id:%" PRId64, pMgmt->sync); return 0; diff --git a/source/dnode/mnode/impl/src/mndTrans.c b/source/dnode/mnode/impl/src/mndTrans.c index a34dfff4d6..55e9faf020 100644 --- a/source/dnode/mnode/impl/src/mndTrans.c +++ b/source/dnode/mnode/impl/src/mndTrans.c @@ -1645,8 +1645,6 @@ void mndTransPullup(SMnode *pMnode) { } mndReleaseTrans(pMnode, pTrans); } - - sdbWriteFile(pMnode->pSdb, SDB_WRITE_DELTA); taosArrayDestroy(pArray); } diff --git a/source/dnode/mnode/sdb/inc/sdb.h b/source/dnode/mnode/sdb/inc/sdb.h index 8d2cec478c..1b7b2f9672 100644 --- a/source/dnode/mnode/sdb/inc/sdb.h +++ b/source/dnode/mnode/sdb/inc/sdb.h @@ -37,7 +37,7 @@ extern "C" { #define mTrace(...) { if (mDebugFlag & DEBUG_TRACE) { taosPrintLog("MND ", DEBUG_TRACE, mDebugFlag, __VA_ARGS__); }} // clang-format on -#define SDB_WRITE_DELTA 20 +#define SDB_WRITE_DELTA 2000 #define SDB_GET_VAL(pData, dataPos, val, pos, func, type) \ { \ diff --git a/source/dnode/mnode/sdb/src/sdb.c b/source/dnode/mnode/sdb/src/sdb.c index bb8040da07..9797dd8337 100644 --- a/source/dnode/mnode/sdb/src/sdb.c +++ b/source/dnode/mnode/sdb/src/sdb.c @@ -53,7 +53,6 @@ SSdb *sdbInit(SSdbOpt *pOption) { } pSdb->pWal = pOption->pWal; - pSdb->sync = pOption->sync; pSdb->applyIndex = -1; pSdb->applyTerm = -1; pSdb->applyConfig = -1; diff --git a/source/dnode/mnode/sdb/src/sdbFile.c b/source/dnode/mnode/sdb/src/sdbFile.c index c2d27ad713..2e182ec10b 100644 --- a/source/dnode/mnode/sdb/src/sdbFile.c +++ b/source/dnode/mnode/sdb/src/sdbFile.c @@ -472,10 +472,7 @@ int32_t sdbWriteFile(SSdb *pSdb, int32_t delta) { taosThreadMutexLock(&pSdb->filelock); if (pSdb->pWal != NULL) { - // code = walBeginSnapshot(pSdb->pWal, pSdb->applyIndex, 0); - if (pSdb->sync == 0) { - code = 0; - } else { + if (pSdb->sync > 0) { code = syncBeginSnapshot(pSdb->sync, pSdb->applyIndex); } } @@ -484,11 +481,7 @@ int32_t sdbWriteFile(SSdb *pSdb, int32_t delta) { } if (code == 0) { if (pSdb->pWal != NULL) { - // code = walEndSnapshot(pSdb->pWal); - - if (pSdb->sync == 0) { - code = 0; - } else { + if (pSdb->sync > 0) { code = syncEndSnapshot(pSdb->sync); } } From 2b495e6c3314a81fc71d487f29f0fdd2bc165bb7 Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Wed, 1 Mar 2023 10:53:01 +0800 Subject: [PATCH 026/174] fix:reduce the amount of insert data to avoid CI timeout --- tests/system-test/7-tmq/subscribeDb4.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/system-test/7-tmq/subscribeDb4.py b/tests/system-test/7-tmq/subscribeDb4.py index d835603678..c14d3b27b1 100644 --- a/tests/system-test/7-tmq/subscribeDb4.py +++ b/tests/system-test/7-tmq/subscribeDb4.py @@ -26,7 +26,7 @@ class TDTestCase: 'ctbPrefix': 'ctb', 'ctbStartIdx': 0, 'ctbNum': 10, - 'rowsPerTbl': 50000, + 'rowsPerTbl': 10000, 'batchNum': 10, 'startTs': 1640966400000, # 2022-01-01 00:00:00.000 'pollDelay': 20, From d7cbcbf8ef0ce09025c3c518a77177056209d355 Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Wed, 1 Mar 2023 10:55:55 +0800 Subject: [PATCH 027/174] fix:open test cases --- tests/parallel_test/cases.task | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/parallel_test/cases.task b/tests/parallel_test/cases.task index c70a50867b..67d488444d 100644 --- a/tests/parallel_test/cases.task +++ b/tests/parallel_test/cases.task @@ -1086,7 +1086,7 @@ ,,n,develop-test,python3 ./test.py -f 5-taos-tools/taosbenchmark/json_tag.py ,,n,develop-test,python3 ./test.py -f 5-taos-tools/taosbenchmark/query_json.py ,,n,develop-test,python3 ./test.py -f 5-taos-tools/taosbenchmark/sample_csv_json.py -#,,n,develop-test,python3 ./test.py -f 5-taos-tools/taosbenchmark/sml_json_alltypes.py +,,n,develop-test,python3 ./test.py -f 5-taos-tools/taosbenchmark/sml_json_alltypes.py ,,n,develop-test,python3 ./test.py -f 5-taos-tools/taosbenchmark/taosdemoTestQueryWithJson.py -R ,,n,develop-test,python3 ./test.py -f 5-taos-tools/taosbenchmark/telnet_tcp.py -R From ffa1deb07716c1349e33ac607548c1046cb2e2b1 Mon Sep 17 00:00:00 2001 From: Hui Li <52318143+plum-lihui@users.noreply.github.com> Date: Wed, 1 Mar 2023 11:53:00 +0800 Subject: [PATCH 028/174] 'test: add timeout to poll' --- tests/system-test/7-tmq/tmqDelete-1ctb.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/system-test/7-tmq/tmqDelete-1ctb.py b/tests/system-test/7-tmq/tmqDelete-1ctb.py index 4c62bb757b..b09efdd1e6 100644 --- a/tests/system-test/7-tmq/tmqDelete-1ctb.py +++ b/tests/system-test/7-tmq/tmqDelete-1ctb.py @@ -109,7 +109,7 @@ class TDTestCase: 'batchNum': 3000, 'startTs': 1640966400000, # 2022-01-01 00:00:00.000 'endTs': 0, - 'pollDelay': 5, + 'pollDelay': 15, 'showMsg': 1, 'showRow': 1, 'snapshot': 0} @@ -194,7 +194,7 @@ class TDTestCase: 'rowsPerTbl': 10000, 'batchNum': 5000, 'startTs': 1640966400000, # 2022-01-01 00:00:00.000 - 'pollDelay': 5, + 'pollDelay': 15, 'showMsg': 1, 'showRow': 1, 'snapshot': 0} @@ -296,7 +296,7 @@ class TDTestCase: 'rowsPerTbl': 10000, 'batchNum': 5000, 'startTs': 1640966400000, # 2022-01-01 00:00:00.000 - 'pollDelay': 5, + 'pollDelay': 15, 'showMsg': 1, 'showRow': 1, 'snapshot': 0} From d05cb92fc493d11f78ff2b39dbbd66c8755c92fe Mon Sep 17 00:00:00 2001 From: Huo Linhe Date: Wed, 1 Mar 2023 11:53:11 +0800 Subject: [PATCH 029/174] fix: fix ls failed when enabled -e --- packaging/tools/makepkg.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/tools/makepkg.sh b/packaging/tools/makepkg.sh index 92a20418c5..7ad3cf7b0a 100755 --- a/packaging/tools/makepkg.sh +++ b/packaging/tools/makepkg.sh @@ -89,7 +89,7 @@ else ${build_dir}/bin/tdengine-datasource.zip \ ${build_dir}/bin/tdengine-datasource.zip.md5sum" [ -f ${build_dir}/bin/taosx ] && taosx_bin="${build_dir}/bin/taosx" - explorer_bin_files=$(sh -c "ls ${build_dir}/bin/*-explorer") + explorer_bin_files=$(find ${build_dir}/bin/ -name '*-explorer') bin_files="${build_dir}/bin/${serverName} \ ${build_dir}/bin/${clientName} \ From ee70606f19e2d0bb2e94d54a123c277a2f170b91 Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Wed, 1 Mar 2023 14:48:15 +0800 Subject: [PATCH 030/174] fix: projection query in descending order result error issue --- source/dnode/vnode/src/tsdb/tsdbRead.c | 3 +- tests/script/api/insertSameTs.c | 136 +++++++++++++++++++++++++ tests/script/api/makefile | 1 + 3 files changed, 139 insertions(+), 1 deletion(-) create mode 100644 tests/script/api/insertSameTs.c diff --git a/source/dnode/vnode/src/tsdb/tsdbRead.c b/source/dnode/vnode/src/tsdb/tsdbRead.c index a158bbfa8d..4c5b87559e 100644 --- a/source/dnode/vnode/src/tsdb/tsdbRead.c +++ b/source/dnode/vnode/src/tsdb/tsdbRead.c @@ -3512,6 +3512,7 @@ static int32_t checkForNeighborFileBlock(STsdbReader* pReader, STableBlockScanIn CHECK_FILEBLOCK_STATE* state) { SFileBlockDumpInfo* pDumpInfo = &pReader->status.fBlockDumpInfo; SBlockData* pBlockData = &pReader->status.fileBlockData; + bool asc = ASCENDING_TRAVERSE(pReader->order); *state = CHECK_FILEBLOCK_QUIT; int32_t step = ASCENDING_TRAVERSE(pReader->order) ? 1 : -1; @@ -3522,7 +3523,7 @@ static int32_t checkForNeighborFileBlock(STsdbReader* pReader, STableBlockScanIn if (loadNeighbor && (code == TSDB_CODE_SUCCESS)) { pDumpInfo->rowIndex = doMergeRowsInFileBlockImpl(pBlockData, pDumpInfo->rowIndex, key, pMerger, &pReader->verRange, step); - if (pDumpInfo->rowIndex >= pDumpInfo->totalRows) { + if ((pDumpInfo->rowIndex >= pDumpInfo->totalRows && asc) || (pDumpInfo->rowIndex < 0 && !asc)) { *state = CHECK_FILEBLOCK_CONT; } } diff --git a/tests/script/api/insertSameTs.c b/tests/script/api/insertSameTs.c new file mode 100644 index 0000000000..ff5e4dd154 --- /dev/null +++ b/tests/script/api/insertSameTs.c @@ -0,0 +1,136 @@ +/* + * 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 . + */ + +// TAOS standard API example. The same syntax as MySQL, but only a subset +// to compile: gcc -o demo demo.c -ltaos + +#include +#include +#include +#include +#include "taos.h" // TAOS header file + +static void queryDB(TAOS *taos, char *command) { + int i; + TAOS_RES *pSql = NULL; + int32_t code = -1; + + for (i = 0; i < 5; i++) { + if (NULL != pSql) { + taos_free_result(pSql); + pSql = NULL; + } + + pSql = taos_query(taos, command); + code = taos_errno(pSql); + if (0 == code) { + break; + } + } + + if (code != 0) { + fprintf(stderr, "Failed to run %s, reason: %s\n", command, taos_errstr(pSql)); + taos_free_result(pSql); + taos_close(taos); + exit(EXIT_FAILURE); + } + + taos_free_result(pSql); +} + +void Test(TAOS *taos, char *qstr); + +int main(int argc, char *argv[]) { + char qstr[1024]; + + // connect to server + if (argc < 2) { + printf("please input server-ip \n"); + return 0; + } + + TAOS *taos = taos_connect(argv[1], "root", "taosdata", NULL, 0); + if (taos == NULL) { + printf("failed to connect to server, reason:%s\n", "null taos"/*taos_errstr(taos)*/); + exit(1); + } + Test(taos, qstr); + taos_close(taos); + taos_cleanup(); +} +void Test(TAOS *taos, char *qstr) { + queryDB(taos, "drop database if exists demo"); + queryDB(taos, "create database demo vgroups 1 minrows 10"); + TAOS_RES *result; + queryDB(taos, "use demo"); + + queryDB(taos, "create table m1 (ts timestamp, ti tinyint, si smallint, i int, bi bigint, f float, d double, b binary(10))"); + printf("success to create table\n"); + + int i = 0; + for (int32_t n = 0; n < 10; ++n) { + for (i = 0; i < 10; ++i) { + int32_t v = n * 10 + i; + sprintf(qstr, "insert into m1 values (%" PRId64 ", %d, %d, %d, %d, %f, %lf, '%s')", (uint64_t)1546300800000, v, v, v, v*10000000, v*1.0, v*2.0, "hello"); + printf("qstr: %s\n", qstr); + + TAOS_RES *result1 = taos_query(taos, qstr); + if (result1 == NULL || taos_errno(result1) != 0) { + printf("failed to insert row, reason:%s\n", taos_errstr(result1)); + taos_free_result(result1); + exit(1); + } else { + printf("insert row: %i\n", v); + } + taos_free_result(result1); + + strcpy(qstr, "flush database demo"); + result1 = taos_query(taos, qstr); + if (result1 == NULL || taos_errno(result1) != 0) { + printf("failed to fluash database, reason:%s\n", taos_errstr(result1)); + taos_free_result(result1); + exit(1); + } + taos_free_result(result1); + } + } + + // query the records + sprintf(qstr, "SELECT * FROM m1 order by ts desc"); + result = taos_query(taos, qstr); + if (result == NULL || taos_errno(result) != 0) { + printf("failed to select, reason:%s\n", taos_errstr(result)); + taos_free_result(result); + exit(1); + } + + TAOS_ROW row; + int rows = 0; + int num_fields = taos_field_count(result); + TAOS_FIELD *fields = taos_fetch_fields(result); + + printf("num_fields = %d\n", num_fields); + printf("select * from table order by ts desc, result:\n"); + // fetch the records row by row + while ((row = taos_fetch_row(result))) { + char temp[1024] = {0}; + rows++; + taos_print_row(temp, row, fields, num_fields); + printf("%s\n", temp); + } + + taos_free_result(result); +} + diff --git a/tests/script/api/makefile b/tests/script/api/makefile index 75a2273f12..6739794cc8 100644 --- a/tests/script/api/makefile +++ b/tests/script/api/makefile @@ -14,6 +14,7 @@ exe: gcc $(CFLAGS) ./batchprepare.c -o $(ROOT)batchprepare $(LFLAGS) gcc $(CFLAGS) ./stopquery.c -o $(ROOT)stopquery $(LFLAGS) gcc $(CFLAGS) ./dbTableRoute.c -o $(ROOT)dbTableRoute $(LFLAGS) + gcc $(CFLAGS) ./insertSameTs.c -o $(ROOT)insertSameTs $(LFLAGS) clean: rm $(ROOT)batchprepare From 74a4051881a8810742a765aad4d66d9085db2c7e Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Wed, 1 Mar 2023 14:48:31 +0800 Subject: [PATCH 031/174] move compact to enterprise --- source/dnode/vnode/CMakeLists.txt | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/source/dnode/vnode/CMakeLists.txt b/source/dnode/vnode/CMakeLists.txt index cb5de67ab3..8dc3f46ae3 100644 --- a/source/dnode/vnode/CMakeLists.txt +++ b/source/dnode/vnode/CMakeLists.txt @@ -67,6 +67,16 @@ target_sources( "src/tq/tqSnapshot.c" "src/tq/tqOffsetSnapshot.c" ) + +IF (TD_VNODE_PLUGINS) + target_sources( + vnode + PRIVATE + ${TD_ENTERPRISE_DIR}/src/plugins/vnode/src/tsdbCompact.c + ${TD_ENTERPRISE_DIR}/src/plugins/vnode/src/vnodeCompact.c + ) +ENDIF () + target_include_directories( vnode PUBLIC "inc" @@ -97,11 +107,6 @@ IF (TD_GRANT) TARGET_LINK_LIBRARIES(vnode PUBLIC grant) ENDIF () -IF (TD_VNODE_PLUGINS) - TARGET_LINK_LIBRARIES(vnode PUBLIC vnode_plugin) -ENDIF () - - target_compile_definitions(vnode PUBLIC -DMETA_REFACT) if(${BUILD_WITH_INVERTEDINDEX}) From 3327beba1e1900eefd70f7c5e7b8a078b42185f0 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Wed, 1 Mar 2023 14:56:51 +0800 Subject: [PATCH 032/174] fix(query): record the correct last accessed key in the stt file. --- source/dnode/vnode/src/tsdb/tsdbMergeTree.c | 2 +- source/dnode/vnode/src/tsdb/tsdbRead.c | 43 ++++++++++++--------- 2 files changed, 25 insertions(+), 20 deletions(-) diff --git a/source/dnode/vnode/src/tsdb/tsdbMergeTree.c b/source/dnode/vnode/src/tsdb/tsdbMergeTree.c index d4af0422d7..d9d60442ff 100644 --- a/source/dnode/vnode/src/tsdb/tsdbMergeTree.c +++ b/source/dnode/vnode/src/tsdb/tsdbMergeTree.c @@ -404,7 +404,7 @@ void tLDataIterNextBlock(SLDataIter *pIter, const char *idStr) { tsdbDebug("try next last file block:%d from %d, trigger by uid:%" PRIu64 ", file index:%d, %s", pIter->iSttBlk, oldIndex, pIter->uid, pIter->iStt, idStr); } else { - tsdbDebug("no more last block qualified, uid:%" PRIu64 ", file index::%d, %s", pIter->uid, oldIndex, idStr); + tsdbDebug("no more last block qualified, uid:%" PRIu64 ", file index:%d, %s", pIter->uid, oldIndex, idStr); } } diff --git a/source/dnode/vnode/src/tsdb/tsdbRead.c b/source/dnode/vnode/src/tsdb/tsdbRead.c index f4929635d9..22d276b6fd 100644 --- a/source/dnode/vnode/src/tsdb/tsdbRead.c +++ b/source/dnode/vnode/src/tsdb/tsdbRead.c @@ -44,6 +44,7 @@ typedef struct SBlockIndex { typedef struct STableBlockScanInfo { uint64_t uid; TSKEY lastKey; + TSKEY lastKeyInStt; // last accessed key in stt SMapData mapData; // block info (compressed) SArray* pBlockList; // block data index list, SArray SIterInfo iter; // mem buffer skip list iterator @@ -192,7 +193,7 @@ static TSDBROW* getValidMemRow(SIterInfo* pIter, const SArray* pDelList, STsdbRe static int32_t doMergeRowsInFileBlocks(SBlockData* pBlockData, STableBlockScanInfo* pScanInfo, STsdbReader* pReader, SRowMerger* pMerger); static int32_t doMergeRowsInLastBlock(SLastBlockReader* pLastBlockReader, STableBlockScanInfo* pScanInfo, int64_t ts, - SRowMerger* pMerger, SVersionRange* pVerRange); + SRowMerger* pMerger, SVersionRange* pVerRange, const char* id); static int32_t doMergeRowsInBuf(SIterInfo* pIter, uint64_t uid, int64_t ts, SArray* pDelList, SRowMerger* pMerger, STsdbReader* pReader); static int32_t doAppendRowFromTSRow(SSDataBlock* pBlock, STsdbReader* pReader, SRow* pTSRow, @@ -407,6 +408,7 @@ static SHashObj* createDataBlockScanInfo(STsdbReader* pTsdbReader, SBlockInfoBuf pScanInfo->lastKey = (ekey < INT64_MAX) ? (ekey + 1) : ekey; } + pScanInfo->lastKeyInStt = pScanInfo->lastKey; taosHashPut(pTableMap, &pScanInfo->uid, sizeof(uint64_t), &pScanInfo, POINTER_BYTES); tsdbTrace("%p check table uid:%" PRId64 " from lastKey:%" PRId64 " %s", pTsdbReader, pScanInfo->uid, pScanInfo->lastKey, pTsdbReader->idStr); @@ -1795,21 +1797,21 @@ static bool nextRowFromLastBlocks(SLastBlockReader* pLastBlockReader, STableBloc while (1) { bool hasVal = tMergeTreeNext(&pLastBlockReader->mergeTree); - if (!hasVal) { + if (!hasVal) { // the next value will be the accessed key in stt + pScanInfo->lastKeyInStt += step; return false; } TSDBROW row = tMergeTreeGetRow(&pLastBlockReader->mergeTree); TSDBKEY k = TSDBROW_KEY(&row); - if (hasBeenDropped(pScanInfo->delSkyline, &pScanInfo->lastBlockDelIndex, &k, pLastBlockReader->order, pVerRange)) { - pScanInfo->lastKey = k.ts; - } else { + pScanInfo->lastKeyInStt = k.ts; + + if (!hasBeenDropped(pScanInfo->delSkyline, &pScanInfo->lastBlockDelIndex, &k, pLastBlockReader->order, pVerRange)) { // the qualifed ts may equal to k.ts, only a greater version one. // here we need to fallback one step. - if (pScanInfo->lastKey == k.ts) { - pScanInfo->lastKey -= step; - } - +// if (pScanInfo->lastKey == k.ts) { +// pScanInfo->lastKey -= step; +// } return true; } } @@ -1949,7 +1951,7 @@ static int32_t doMergeBufAndFileRows(STsdbReader* pReader, STableBlockScanInfo* return code; } } - doMergeRowsInLastBlock(pLastBlockReader, pBlockScanInfo, tsLast, &merge, &pReader->verRange); + doMergeRowsInLastBlock(pLastBlockReader, pBlockScanInfo, tsLast, &merge, &pReader->verRange, pReader->idStr); } if (minKey == k.ts) { @@ -1997,7 +1999,7 @@ static int32_t doMergeBufAndFileRows(STsdbReader* pReader, STableBlockScanInfo* return code; } } - doMergeRowsInLastBlock(pLastBlockReader, pBlockScanInfo, tsLast, &merge, &pReader->verRange); + doMergeRowsInLastBlock(pLastBlockReader, pBlockScanInfo, tsLast, &merge, &pReader->verRange, pReader->idStr); } if (minKey == key) { @@ -2050,7 +2052,7 @@ static int32_t doMergeFileBlockAndLastBlock(SLastBlockReader* pLastBlockReader, TSDBROW fRow1 = tMergeTreeGetRow(&pLastBlockReader->mergeTree); tsdbRowMerge(&merge, &fRow1); - doMergeRowsInLastBlock(pLastBlockReader, pBlockScanInfo, tsLastBlock, &merge, &pReader->verRange); + doMergeRowsInLastBlock(pLastBlockReader, pBlockScanInfo, tsLastBlock, &merge, &pReader->verRange, pReader->idStr); code = tsdbRowMergerGetRow(&merge, &pTSRow); if (code != TSDB_CODE_SUCCESS) { @@ -2068,7 +2070,7 @@ static int32_t doMergeFileBlockAndLastBlock(SLastBlockReader* pLastBlockReader, return code; } - doMergeRowsInLastBlock(pLastBlockReader, pBlockScanInfo, tsLastBlock, &merge, &pReader->verRange); + doMergeRowsInLastBlock(pLastBlockReader, pBlockScanInfo, tsLastBlock, &merge, &pReader->verRange, pReader->idStr); // merge with block data if ts == key if (tsLastBlock == pBlockData->aTSKEY[pDumpInfo->rowIndex]) { @@ -2121,7 +2123,7 @@ static int32_t mergeFileBlockAndLastBlock(STsdbReader* pReader, SLastBlockReader TSDBROW fRow1 = tMergeTreeGetRow(&pLastBlockReader->mergeTree); tsdbRowMerge(&merge, &fRow1); - doMergeRowsInLastBlock(pLastBlockReader, pBlockScanInfo, ts, &merge, &pReader->verRange); + doMergeRowsInLastBlock(pLastBlockReader, pBlockScanInfo, ts, &merge, &pReader->verRange, pReader->idStr); code = tsdbRowMergerGetRow(&merge, &pTSRow); if (code != TSDB_CODE_SUCCESS) { @@ -2230,7 +2232,7 @@ static int32_t doMergeMultiLevelRows(STsdbReader* pReader, STableBlockScanInfo* } } - doMergeRowsInLastBlock(pLastBlockReader, pBlockScanInfo, tsLast, &merge, &pReader->verRange); + doMergeRowsInLastBlock(pLastBlockReader, pBlockScanInfo, tsLast, &merge, &pReader->verRange, pReader->idStr); } if (minKey == ik.ts) { @@ -2321,7 +2323,7 @@ static int32_t doMergeMultiLevelRows(STsdbReader* pReader, STableBlockScanInfo* return code; } } - doMergeRowsInLastBlock(pLastBlockReader, pBlockScanInfo, tsLast, &merge, &pReader->verRange); + doMergeRowsInLastBlock(pLastBlockReader, pBlockScanInfo, tsLast, &merge, &pReader->verRange, pReader->idStr); } if (minKey == key) { @@ -2472,9 +2474,9 @@ static bool initLastBlockReader(SLastBlockReader* pLBlockReader, STableBlockScan int32_t step = ASCENDING_TRAVERSE(pLBlockReader->order) ? 1 : -1; STimeWindow w = pLBlockReader->window; if (ASCENDING_TRAVERSE(pLBlockReader->order)) { - w.skey = pScanInfo->lastKey + step; + w.skey = pScanInfo->lastKeyInStt; } else { - w.ekey = pScanInfo->lastKey + step; + w.ekey = pScanInfo->lastKeyInStt; } tsdbDebug("init last block reader, window:%" PRId64 "-%" PRId64 ", uid:%" PRIu64 ", %s", w.skey, w.ekey, @@ -3567,13 +3569,16 @@ int32_t doMergeRowsInFileBlocks(SBlockData* pBlockData, STableBlockScanInfo* pSc } int32_t doMergeRowsInLastBlock(SLastBlockReader* pLastBlockReader, STableBlockScanInfo* pScanInfo, int64_t ts, - SRowMerger* pMerger, SVersionRange* pVerRange) { + SRowMerger* pMerger, SVersionRange* pVerRange, const char* idStr) { while (nextRowFromLastBlocks(pLastBlockReader, pScanInfo, pVerRange)) { int64_t next1 = getCurrentKeyInLastBlock(pLastBlockReader); if (next1 == ts) { TSDBROW fRow1 = tMergeTreeGetRow(&pLastBlockReader->mergeTree); tsdbRowMerge(pMerger, &fRow1); } 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, + idStr); break; } } From 7e0efcdc9b87a1379ba0281ced69b4ea1348fb13 Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Wed, 1 Mar 2023 15:06:41 +0800 Subject: [PATCH 033/174] move compact to enterprise --- source/dnode/mnode/impl/src/mndDb.c | 53 ---------------------- source/dnode/mnode/impl/src/mndPrivilege.c | 1 + 2 files changed, 1 insertion(+), 53 deletions(-) diff --git a/source/dnode/mnode/impl/src/mndDb.c b/source/dnode/mnode/impl/src/mndDb.c index 3efd8fb249..4040f9b4b7 100644 --- a/source/dnode/mnode/impl/src/mndDb.c +++ b/source/dnode/mnode/impl/src/mndDb.c @@ -1434,59 +1434,6 @@ static int32_t mndSetCompactDbRedoActions(SMnode *pMnode, STrans *pTrans, SDbObj return 0; } -static int32_t mndCompactDb(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pDb) { - int64_t compactTs = taosGetTimestampMs(); - int32_t code = -1; - STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_DB, pReq, "compact-db"); - if (pTrans == NULL) goto _OVER; - - mInfo("trans:%d, used to compact db:%s", pTrans->id, pDb->name); - mndTransSetDbName(pTrans, pDb->name, NULL); - if (mndTrancCheckConflict(pMnode, pTrans) != 0) goto _OVER; - if (mndSetCompactDbCommitLogs(pMnode, pTrans, pDb, compactTs) != 0) goto _OVER; - if (mndSetCompactDbRedoActions(pMnode, pTrans, pDb, compactTs) != 0) goto _OVER; - if (mndTransPrepare(pMnode, pTrans) != 0) goto _OVER; - code = 0; - -_OVER: - mndTransDrop(pTrans); - return code; -} - -static int32_t mndProcessCompactDbReq(SRpcMsg *pReq) { - SMnode *pMnode = pReq->info.node; - int32_t code = -1; - SDbObj *pDb = NULL; - SCompactDbReq compactReq = {0}; - - if (tDeserializeSCompactDbReq(pReq->pCont, pReq->contLen, &compactReq) != 0) { - terrno = TSDB_CODE_INVALID_MSG; - goto _OVER; - } - - mInfo("db:%s, start to compact", compactReq.db); - - pDb = mndAcquireDb(pMnode, compactReq.db); - if (pDb == NULL) { - goto _OVER; - } - - if (mndCheckDbPrivilege(pMnode, pReq->info.conn.user, MND_OPER_COMPACT_DB, pDb) != 0) { - goto _OVER; - } - - code = mndCompactDb(pMnode, pReq, pDb); - if (code == 0) code = TSDB_CODE_ACTION_IN_PROGRESS; - -_OVER: - if (code != 0 && code != TSDB_CODE_ACTION_IN_PROGRESS) { - mError("db:%s, failed to process compact db req since %s", compactReq.db, terrstr()); - } - - mndReleaseDb(pMnode, pDb); - return code; -} - static int32_t mndTrimDb(SMnode *pMnode, SDbObj *pDb) { SSdb *pSdb = pMnode->pSdb; SVgObj *pVgroup = NULL; diff --git a/source/dnode/mnode/impl/src/mndPrivilege.c b/source/dnode/mnode/impl/src/mndPrivilege.c index ccb4140b83..a3c518c724 100644 --- a/source/dnode/mnode/impl/src/mndPrivilege.c +++ b/source/dnode/mnode/impl/src/mndPrivilege.c @@ -38,4 +38,5 @@ int32_t mndSetUserAuthRsp(SMnode *pMnode, SUserObj *pUser, SGetUserAuthRsp *pRsp pRsp->version = pUser->authVersion; return 0; } +int32_t mndProcessCompactDbReq(SRpcMsg *pReq) { return TSDB_CODE_OPS_NOT_SUPPORT; } #endif \ No newline at end of file From 4cf0a8b3764b544c6d24348240ff2947ff76495e Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Wed, 1 Mar 2023 15:25:01 +0800 Subject: [PATCH 034/174] move compact to enterprise --- source/dnode/mnode/impl/CMakeLists.txt | 3 ++- source/dnode/mnode/impl/inc/mndDb.h | 2 ++ source/dnode/mnode/impl/src/mndDb.c | 5 ++++- source/dnode/mnode/impl/src/mndPrivilege.c | 1 - 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/source/dnode/mnode/impl/CMakeLists.txt b/source/dnode/mnode/impl/CMakeLists.txt index 25a4397b7d..493ba48601 100644 --- a/source/dnode/mnode/impl/CMakeLists.txt +++ b/source/dnode/mnode/impl/CMakeLists.txt @@ -2,8 +2,9 @@ aux_source_directory(src MNODE_SRC) IF (TD_PRIVILEGE) ADD_DEFINITIONS(-D_PRIVILEGE) ENDIF () -IF (TD_PRIVILEGE) +IF (TD_ENTERPRISE) LIST(APPEND MNODE_SRC ${TD_ENTERPRISE_DIR}/src/plugins/privilege/src/privilege.c) + LIST(APPEND MNODE_SRC ${TD_ENTERPRISE_DIR}/src/plugins/mnode/src/mndDb.c) ENDIF () add_library(mnode STATIC ${MNODE_SRC}) diff --git a/source/dnode/mnode/impl/inc/mndDb.h b/source/dnode/mnode/impl/inc/mndDb.h index 9edfd9bf3b..97d047d7a3 100644 --- a/source/dnode/mnode/impl/inc/mndDb.h +++ b/source/dnode/mnode/impl/inc/mndDb.h @@ -33,6 +33,8 @@ bool mndIsDbReady(SMnode *pMnode, SDbObj *pDb); SSdbRaw *mndDbActionEncode(SDbObj *pDb); const char *mndGetDbStr(const char *src); +int32_t mndProcessCompactDbReq(SRpcMsg *pReq); + #ifdef __cplusplus } #endif diff --git a/source/dnode/mnode/impl/src/mndDb.c b/source/dnode/mnode/impl/src/mndDb.c index 4040f9b4b7..49d3e996a6 100644 --- a/source/dnode/mnode/impl/src/mndDb.c +++ b/source/dnode/mnode/impl/src/mndDb.c @@ -41,12 +41,15 @@ static int32_t mndProcessCreateDbReq(SRpcMsg *pReq); static int32_t mndProcessAlterDbReq(SRpcMsg *pReq); static int32_t mndProcessDropDbReq(SRpcMsg *pReq); static int32_t mndProcessUseDbReq(SRpcMsg *pReq); -static int32_t mndProcessCompactDbReq(SRpcMsg *pReq); static int32_t mndProcessTrimDbReq(SRpcMsg *pReq); static int32_t mndRetrieveDbs(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock, int32_t rowsCapacity); static void mndCancelGetNextDb(SMnode *pMnode, void *pIter); static int32_t mndProcessGetDbCfgReq(SRpcMsg *pReq); +#ifndef TD_ENTERPRISE +int32_t mndProcessCompactDbReq(SRpcMsg *pReq) { return TSDB_CODE_OPS_NOT_SUPPORT; } +#endif + int32_t mndInitDb(SMnode *pMnode) { SSdbTable table = { .sdbType = SDB_DB, diff --git a/source/dnode/mnode/impl/src/mndPrivilege.c b/source/dnode/mnode/impl/src/mndPrivilege.c index a3c518c724..ccb4140b83 100644 --- a/source/dnode/mnode/impl/src/mndPrivilege.c +++ b/source/dnode/mnode/impl/src/mndPrivilege.c @@ -38,5 +38,4 @@ int32_t mndSetUserAuthRsp(SMnode *pMnode, SUserObj *pUser, SGetUserAuthRsp *pRsp pRsp->version = pUser->authVersion; return 0; } -int32_t mndProcessCompactDbReq(SRpcMsg *pReq) { return TSDB_CODE_OPS_NOT_SUPPORT; } #endif \ No newline at end of file From 13d29b6f7522b73dc959bebcf0a53019faef34d5 Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Wed, 1 Mar 2023 15:32:57 +0800 Subject: [PATCH 035/174] move compact to enterprise --- source/dnode/mnode/impl/src/mndDb.c | 39 ----------------------------- 1 file changed, 39 deletions(-) diff --git a/source/dnode/mnode/impl/src/mndDb.c b/source/dnode/mnode/impl/src/mndDb.c index 49d3e996a6..5de76a9d46 100644 --- a/source/dnode/mnode/impl/src/mndDb.c +++ b/source/dnode/mnode/impl/src/mndDb.c @@ -1398,45 +1398,6 @@ int32_t mndValidateDbInfo(SMnode *pMnode, SDbVgVersion *pDbs, int32_t numOfDbs, return 0; } -static int32_t mndSetCompactDbCommitLogs(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, int64_t compactTs) { - SDbObj dbObj = {0}; - memcpy(&dbObj, pDb, sizeof(SDbObj)); - dbObj.compactStartTime = compactTs; - - SSdbRaw *pCommitRaw = mndDbActionEncode(&dbObj); - if (pCommitRaw == NULL) return -1; - if (mndTransAppendCommitlog(pTrans, pCommitRaw) != 0) { - sdbFreeRaw(pCommitRaw); - return -1; - } - - (void)sdbSetRawStatus(pCommitRaw, SDB_STATUS_READY); - return 0; -} - -static int32_t mndSetCompactDbRedoActions(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, int64_t compactTs) { - SSdb *pSdb = pMnode->pSdb; - void *pIter = NULL; - - while (1) { - SVgObj *pVgroup = NULL; - pIter = sdbFetch(pSdb, SDB_VGROUP, pIter, (void **)&pVgroup); - if (pIter == NULL) break; - - if (mndVgroupInDb(pVgroup, pDb->uid)) { - if (mndBuildCompactVgroupAction(pMnode, pTrans, pDb, pVgroup, compactTs) != 0) { - sdbCancelFetch(pSdb, pIter); - sdbRelease(pSdb, pVgroup); - return -1; - } - } - - sdbRelease(pSdb, pVgroup); - } - - return 0; -} - static int32_t mndTrimDb(SMnode *pMnode, SDbObj *pDb) { SSdb *pSdb = pMnode->pSdb; SVgObj *pVgroup = NULL; From c3ef678da53c10e1c334c2442f00aac9550e6fc8 Mon Sep 17 00:00:00 2001 From: Benguang Zhao Date: Mon, 27 Feb 2023 19:58:59 +0800 Subject: [PATCH 036/174] enh: not allow to insert when insufficient diskspace left --- include/util/taoserror.h | 1 + source/dnode/mgmt/mgmt_vnode/src/vmWorker.c | 4 ++-- source/util/src/terror.c | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/include/util/taoserror.h b/include/util/taoserror.h index 75860a4b1e..5106196ccd 100644 --- a/include/util/taoserror.h +++ b/include/util/taoserror.h @@ -116,6 +116,7 @@ int32_t* taosGetErrno(); #define TSDB_CODE_NO_DISKSPACE TAOS_DEF_ERROR_CODE(0, 0x012B) #define TSDB_CODE_TIMEOUT_ERROR TAOS_DEF_ERROR_CODE(0, 0x012C) #define TSDB_CODE_MSG_ENCODE_ERROR TAOS_DEF_ERROR_CODE(0, 0x012D) +#define TSDB_CODE_NO_ENOUGH_DISKSPACE TAOS_DEF_ERROR_CODE(0, 0x012E) #define TSDB_CODE_APP_IS_STARTING TAOS_DEF_ERROR_CODE(0, 0x0130) // #define TSDB_CODE_APP_IS_STOPPING TAOS_DEF_ERROR_CODE(0, 0x0131) // diff --git a/source/dnode/mgmt/mgmt_vnode/src/vmWorker.c b/source/dnode/mgmt/mgmt_vnode/src/vmWorker.c index c1b3cde9ea..7aa1c9f56a 100644 --- a/source/dnode/mgmt/mgmt_vnode/src/vmWorker.c +++ b/source/dnode/mgmt/mgmt_vnode/src/vmWorker.c @@ -192,8 +192,8 @@ static int32_t vmPutMsgToQueue(SVnodeMgmt *pMgmt, SRpcMsg *pMsg, EQueueType qtyp taosWriteQitem(pVnode->pFetchQ, pMsg); break; case WRITE_QUEUE: - if (!osDataSpaceAvailable()) { - terrno = TSDB_CODE_NO_DISKSPACE; + if (!osDataSpaceSufficient()) { + terrno = TSDB_CODE_NO_ENOUGH_DISKSPACE; code = terrno; dError("vgId:%d, msg:%p put into vnode-write queue failed since %s", pVnode->vgId, pMsg, terrstr(code)); break; diff --git a/source/util/src/terror.c b/source/util/src/terror.c index 4bb082800d..b22e2e924f 100644 --- a/source/util/src/terror.c +++ b/source/util/src/terror.c @@ -94,6 +94,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_NO_AVAIL_DISK, "No available disk") TAOS_DEFINE_ERROR(TSDB_CODE_NOT_FOUND, "Not found") TAOS_DEFINE_ERROR(TSDB_CODE_NO_DISKSPACE, "Out of disk space") TAOS_DEFINE_ERROR(TSDB_CODE_TIMEOUT_ERROR, "Operation timeout") +TAOS_DEFINE_ERROR(TSDB_CODE_NO_ENOUGH_DISKSPACE, "No enough disk space") TAOS_DEFINE_ERROR(TSDB_CODE_APP_IS_STARTING, "Database is starting up") TAOS_DEFINE_ERROR(TSDB_CODE_APP_IS_STOPPING, "Database is closing down") From 9ad236b8f7278355c553927b8ca801ad48a03f36 Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Wed, 1 Mar 2023 17:03:52 +0800 Subject: [PATCH 037/174] fix:disable test cases --- tests/parallel_test/cases.task | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/parallel_test/cases.task b/tests/parallel_test/cases.task index 67d488444d..c70a50867b 100644 --- a/tests/parallel_test/cases.task +++ b/tests/parallel_test/cases.task @@ -1086,7 +1086,7 @@ ,,n,develop-test,python3 ./test.py -f 5-taos-tools/taosbenchmark/json_tag.py ,,n,develop-test,python3 ./test.py -f 5-taos-tools/taosbenchmark/query_json.py ,,n,develop-test,python3 ./test.py -f 5-taos-tools/taosbenchmark/sample_csv_json.py -,,n,develop-test,python3 ./test.py -f 5-taos-tools/taosbenchmark/sml_json_alltypes.py +#,,n,develop-test,python3 ./test.py -f 5-taos-tools/taosbenchmark/sml_json_alltypes.py ,,n,develop-test,python3 ./test.py -f 5-taos-tools/taosbenchmark/taosdemoTestQueryWithJson.py -R ,,n,develop-test,python3 ./test.py -f 5-taos-tools/taosbenchmark/telnet_tcp.py -R From 8a23f0ce3bc291e6ace9f458e6711592d102b7d2 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Wed, 1 Mar 2023 18:59:27 +0800 Subject: [PATCH 038/174] fix:set timestamp precision --- source/common/src/tdatablock.c | 2 +- source/libs/parser/src/parTranslater.c | 3 ++- source/libs/scalar/src/sclvector.c | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/source/common/src/tdatablock.c b/source/common/src/tdatablock.c index 88eb3bdb97..453e4a8d8e 100644 --- a/source/common/src/tdatablock.c +++ b/source/common/src/tdatablock.c @@ -2003,7 +2003,7 @@ char* dumpBlockData(SSDataBlock* pDataBlock, const char* flag, char** pDataBuf) switch (pColInfoData->info.type) { case TSDB_DATA_TYPE_TIMESTAMP: memset(pBuf, 0, sizeof(pBuf)); - formatTimestamp(pBuf, *(uint64_t*)var, TSDB_TIME_PRECISION_MILLI); + formatTimestamp(pBuf, *(uint64_t*)var, pColInfoData->info.precision); len += snprintf(dumpBuf + len, size - len, " %25s |", pBuf); if (len >= size - 1) return dumpBuf; break; diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index 2f621ba5c8..79dd658987 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -1211,7 +1211,8 @@ static EDealRes translateValueImpl(STranslateContext* pCxt, SValueNode* pVal, SD } else { res = translateNormalValue(pCxt, pVal, targetDt, strict); } - pVal->node.resType = targetDt; + pVal->node.resType.type = targetDt.type; + pVal->node.resType.bytes = targetDt.bytes; pVal->node.resType.scale = pVal->unit; pVal->translate = true; if (!strict && TSDB_DATA_TYPE_UBIGINT == pVal->node.resType.type && pVal->datum.u <= INT64_MAX) { diff --git a/source/libs/scalar/src/sclvector.c b/source/libs/scalar/src/sclvector.c index 3fe016d444..4d803cb638 100644 --- a/source/libs/scalar/src/sclvector.c +++ b/source/libs/scalar/src/sclvector.c @@ -915,6 +915,7 @@ int32_t vectorConvertSingleCol(SScalarParam *input, SScalarParam *output, int32_ SDataType t = {.type = type}; t.bytes = IS_VAR_DATA_TYPE(t.type)? input->columnData->info.bytes:tDataTypes[type].bytes; + t.precision = input->columnData->info.precision; int32_t code = sclCreateColumnInfoData(&t, input->numOfRows, output); if (code != TSDB_CODE_SUCCESS) { From 8f858268d396a89819384ee175f91e78707c065f Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Wed, 1 Mar 2023 19:25:24 +0800 Subject: [PATCH 039/174] fix: add test case --- tests/parallel_test/cases.task | 6 +++ tests/system-test/2-query/projectionDesc.py | 47 +++++++++++++++++++++ 2 files changed, 53 insertions(+) create mode 100644 tests/system-test/2-query/projectionDesc.py diff --git a/tests/parallel_test/cases.task b/tests/parallel_test/cases.task index 93e11eb1fb..ef70c6e8da 100644 --- a/tests/parallel_test/cases.task +++ b/tests/parallel_test/cases.task @@ -632,6 +632,8 @@ ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/case_when.py -R ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/blockSMA.py ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/blockSMA.py -R +,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/projectionDesc.py +,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/projectionDesc.py -R ,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/update_data.py ,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/tb_100w_data_order.py ,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/delete_stable.py @@ -655,6 +657,7 @@ ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/csum.py ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/function_diff.py ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/tagFilter.py +,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/projectionDesc.py ,,n,system-test,python3 ./test.py -f 2-query/queryQnode.py ,,y,system-test,./pytest.sh python3 ./test.py -f 6-cluster/5dnode1mnode.py ,,y,system-test,./pytest.sh python3 ./test.py -f 6-cluster/5dnode2mnode.py -N 5 @@ -854,6 +857,7 @@ ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/sml.py -Q 2 ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/case_when.py -Q 2 ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/blockSMA.py -Q 2 +,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/projectionDesc.py -Q 2 ,,y,system-test,./pytest.sh python3 ./test.py -f 99-TDcase/TD-21561.py -Q 2 ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/between.py -Q 3 ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/distinct.py -Q 3 @@ -952,6 +956,7 @@ ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/interp.py -Q 3 ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/case_when.py -Q 3 ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/blockSMA.py -Q 3 +,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/projectionDesc.py -Q 3 ,,y,system-test,./pytest.sh python3 ./test.py -f 99-TDcase/TD-21561.py -Q 3 ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/between.py -Q 4 ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/distinct.py -Q 4 @@ -1070,6 +1075,7 @@ ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/max_min_data.py -Q 3 ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/max_min_data.py -Q 4 ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/blockSMA.py -Q 4 +,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/projectionDesc.py -Q 4 ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/odbc.py ,,y,system-test,./pytest.sh python3 ./test.py -f 99-TDcase/TD-21561.py -Q 4 ,,y,system-test,./pytest.sh python3 ./test.py -f 99-TDcase/TD-20582.py diff --git a/tests/system-test/2-query/projectionDesc.py b/tests/system-test/2-query/projectionDesc.py new file mode 100644 index 0000000000..6bb9aff4f3 --- /dev/null +++ b/tests/system-test/2-query/projectionDesc.py @@ -0,0 +1,47 @@ +from wsgiref.headers import tspecials +from util.log import * +from util.cases import * +from util.sql import * +import numpy as np + + +class TDTestCase: + def init(self, conn, logSql, replicaVar=1): + self.replicaVar = int(replicaVar) + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + self.rowNum = 10 + self.batchNum = 5 + self.ts = 1537146000000 + + def run(self): + dbname = "db" + tdSql.prepare() + + intData = [] + floatData = [] + + tdSql.execute(f'''create table {dbname}.stb(ts timestamp, col1 tinyint, col2 smallint, col3 int, col4 bigint, col5 float, col6 double, + col7 bool, col8 binary(20), col9 nchar(20), col11 tinyint unsigned, col12 smallint unsigned, col13 int unsigned, col14 bigint unsigned) tags(loc nchar(20))''') + tdSql.execute(f"create table {dbname}.stb_1 using {dbname}.stb tags('beijing')") + for n in range(self.batchNum): + for i in range(self.rowNum): + tdSql.execute(f"insert into {dbname}.stb_1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d', %d, %d, %d, %d)" + % (self.ts, i + 1, i + 1, i + 1, i + 1, i + 0.1, i + 0.1, i % 2, i + 1, i + 1, i + 1, i + 1, i + 1, i + 1)) + intData.append(i + 1) + floatData.append(i + 0.1) + tdSql.execute(f"flush database {dbname}") + + tdSql.query(f"select * from {dbname}.stb_1 order by ts desc") + tdSql.checkRows(1) + #tdSql.checkData(0,0,1537146000000) + tdSql.checkData(0,1,10) + + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) From 37348fb45639ed933f6af127e7c4258e7e5c56ae Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Wed, 1 Mar 2023 21:00:01 +0800 Subject: [PATCH 040/174] change default config --- source/common/src/tglobal.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/source/common/src/tglobal.c b/source/common/src/tglobal.c index 99795fcc79..b48bce78fc 100644 --- a/source/common/src/tglobal.c +++ b/source/common/src/tglobal.c @@ -521,7 +521,6 @@ static int32_t taosUpdateServerCfg(SConfig *pCfg) { pItem = cfgGetItem(tsCfg, "numOfRpcSessions"); if (pItem != NULL && pItem->stype == CFG_STYPE_DEFAULT) { - tsNumOfRpcSessions = 2000; tsNumOfRpcSessions = TRANGE(tsNumOfRpcSessions, 100, 10000); pItem->i32 = tsNumOfRpcSessions; pItem->stype = stype; @@ -529,7 +528,6 @@ static int32_t taosUpdateServerCfg(SConfig *pCfg) { pItem = cfgGetItem(tsCfg, "timeToGetAvailableConn"); if (pItem != NULL && pItem->stype == CFG_STYPE_DEFAULT) { - tsTimeToGetAvailableConn = 1000; tsTimeToGetAvailableConn = TRANGE(tsTimeToGetAvailableConn, 20, 1000000); pItem->i32 = tsTimeToGetAvailableConn; pItem->stype = stype; From 8cdae7933b9795183b05b3962c86b97274fd657a Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Wed, 1 Mar 2023 21:03:24 +0800 Subject: [PATCH 041/174] change default config --- source/common/src/tglobal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/common/src/tglobal.c b/source/common/src/tglobal.c index b48bce78fc..5e28a8a4c0 100644 --- a/source/common/src/tglobal.c +++ b/source/common/src/tglobal.c @@ -42,7 +42,7 @@ bool tsPrintAuth = false; // queue & threads int32_t tsNumOfRpcThreads = 1; int32_t tsNumOfRpcSessions = 5000; -int32_t tsTimeToGetAvailableConn = 100000; +int32_t tsTimeToGetAvailableConn = 2000000; int32_t tsNumOfCommitThreads = 2; int32_t tsNumOfTaskQueueThreads = 4; int32_t tsNumOfMnodeQueryThreads = 4; From 443852cc3ff7e73af2db0deee6784ab733fe1aad Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Wed, 1 Mar 2023 21:46:25 +0800 Subject: [PATCH 042/174] fix(query): set correct last key. --- source/dnode/vnode/src/tsdb/tsdbRead.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/source/dnode/vnode/src/tsdb/tsdbRead.c b/source/dnode/vnode/src/tsdb/tsdbRead.c index 22d276b6fd..74ad2901ee 100644 --- a/source/dnode/vnode/src/tsdb/tsdbRead.c +++ b/source/dnode/vnode/src/tsdb/tsdbRead.c @@ -403,12 +403,14 @@ static SHashObj* createDataBlockScanInfo(STsdbReader* pTsdbReader, SBlockInfoBuf if (ASCENDING_TRAVERSE(pTsdbReader->order)) { int64_t skey = pTsdbReader->window.skey; pScanInfo->lastKey = (skey > INT64_MIN) ? (skey - 1) : skey; + pScanInfo->lastKeyInStt = skey; } else { int64_t ekey = pTsdbReader->window.ekey; pScanInfo->lastKey = (ekey < INT64_MAX) ? (ekey + 1) : ekey; + pScanInfo->lastKeyInStt = pScanInfo->lastKey; + pScanInfo->lastKeyInStt = ekey; } - pScanInfo->lastKeyInStt = pScanInfo->lastKey; taosHashPut(pTableMap, &pScanInfo->uid, sizeof(uint64_t), &pScanInfo, POINTER_BYTES); tsdbTrace("%p check table uid:%" PRId64 " from lastKey:%" PRId64 " %s", pTsdbReader, pScanInfo->uid, pScanInfo->lastKey, pTsdbReader->idStr); @@ -1809,9 +1811,6 @@ static bool nextRowFromLastBlocks(SLastBlockReader* pLastBlockReader, STableBloc if (!hasBeenDropped(pScanInfo->delSkyline, &pScanInfo->lastBlockDelIndex, &k, pLastBlockReader->order, pVerRange)) { // the qualifed ts may equal to k.ts, only a greater version one. // here we need to fallback one step. -// if (pScanInfo->lastKey == k.ts) { -// pScanInfo->lastKey -= step; -// } return true; } } From 8d32d256ade80c5b223025bf0cd929506d7efa49 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Thu, 2 Mar 2023 00:48:17 +0800 Subject: [PATCH 043/174] fix(query): set correct lastkeyinstt. --- source/dnode/vnode/src/tsdb/tsdbRead.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/source/dnode/vnode/src/tsdb/tsdbRead.c b/source/dnode/vnode/src/tsdb/tsdbRead.c index 74ad2901ee..d04bb0ad33 100644 --- a/source/dnode/vnode/src/tsdb/tsdbRead.c +++ b/source/dnode/vnode/src/tsdb/tsdbRead.c @@ -407,7 +407,6 @@ static SHashObj* createDataBlockScanInfo(STsdbReader* pTsdbReader, SBlockInfoBuf } else { int64_t ekey = pTsdbReader->window.ekey; pScanInfo->lastKey = (ekey < INT64_MAX) ? (ekey + 1) : ekey; - pScanInfo->lastKeyInStt = pScanInfo->lastKey; pScanInfo->lastKeyInStt = ekey; } @@ -3940,6 +3939,17 @@ int32_t tsdbSetTableList(STsdbReader* pReader, const void* pTableList, int32_t n pInfo->uid = pList[i].uid; pUidList->tableUidList[i] = pList[i].uid; + // todo extract method + if (ASCENDING_TRAVERSE(pReader->order)) { + int64_t skey = pReader->window.skey; + pInfo->lastKey = (skey > INT64_MIN) ? (skey - 1) : skey; + pInfo->lastKeyInStt = skey; + } else { + int64_t ekey = pReader->window.ekey; + pInfo->lastKey = (ekey < INT64_MAX) ? (ekey + 1) : ekey; + pInfo->lastKeyInStt = ekey; + } + taosHashPut(pReader->status.pTableMap, &pInfo->uid, sizeof(uint64_t), &pInfo, POINTER_BYTES); } From 4fa1839798b299f2b004121cda3ea8c4beb62bfe Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Thu, 2 Mar 2023 09:33:46 +0800 Subject: [PATCH 044/174] change default config --- source/common/src/tglobal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/common/src/tglobal.c b/source/common/src/tglobal.c index 5e28a8a4c0..eef174ef5f 100644 --- a/source/common/src/tglobal.c +++ b/source/common/src/tglobal.c @@ -42,7 +42,7 @@ bool tsPrintAuth = false; // queue & threads int32_t tsNumOfRpcThreads = 1; int32_t tsNumOfRpcSessions = 5000; -int32_t tsTimeToGetAvailableConn = 2000000; +int32_t tsTimeToGetAvailableConn = 1000000; int32_t tsNumOfCommitThreads = 2; int32_t tsNumOfTaskQueueThreads = 4; int32_t tsNumOfMnodeQueryThreads = 4; From 3730ea4b57084172b33fdfe4392e471bcffc2197 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Thu, 2 Mar 2023 10:00:00 +0800 Subject: [PATCH 045/174] test: update the sim to speedup this case and set the tqdebugflag to be 135. --- tests/pytest/util/dnodes.py | 2 ++ tests/script/tsim/parser/sliding.sim | 20 +++++++++++++++++--- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/tests/pytest/util/dnodes.py b/tests/pytest/util/dnodes.py index ddb3bfaa26..360843c46c 100644 --- a/tests/pytest/util/dnodes.py +++ b/tests/pytest/util/dnodes.py @@ -45,6 +45,8 @@ class TDSimClient: "supportVnodes": "1024", "enableQueryHb": "1", "telemetryReporting": "0", + "tqDebugflag": "135", + "wDebugflag":"135", } def getLogDir(self): diff --git a/tests/script/tsim/parser/sliding.sim b/tests/script/tsim/parser/sliding.sim index b9353e2c61..45a49fbc4e 100644 --- a/tests/script/tsim/parser/sliding.sim +++ b/tests/script/tsim/parser/sliding.sim @@ -49,9 +49,23 @@ while $i < $tbNum $nchar = $nchar . $c $nchar = $nchar . ' - sql insert into $tb values ($tstart , $c , $c , $c , $c , $c , $c , $c , $binary , $nchar ) - $tstart = $tstart + 30 - $x = $x + 1 + $next = $tstart + 30 + $f = $x + 1 + $c1 = $f / 100 + $c1 = $c1 * 100 + $c1 = $f - $c1 + + $binary1 = ' . binary + $binary1 = $binary1 . $c1 + $binary1 = $binary1 . ' + + $nchar1 = ' . nchar + $nchar1 = $nchar1 . $c1 + $nchar1 = $nchar1 . ' + + sql insert into $tb values ($tstart , $c , $c , $c , $c , $c , $c , $c , $binary , $nchar ) ($next , $c1 , $c1 , $c1 , $c1 , $c1 , $c1 , $c1 , $binary1 , $nchar1 ) + $tstart = $tstart + 60 + $x = $x + 2 endw $i = $i + 1 From a484725f314299dd655cdd91d7f24d0d8e914036 Mon Sep 17 00:00:00 2001 From: Hui Li <52318143+plum-lihui@users.noreply.github.com> Date: Thu, 2 Mar 2023 10:56:09 +0800 Subject: [PATCH 046/174] Update cases.task --- tests/parallel_test/cases.task | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/parallel_test/cases.task b/tests/parallel_test/cases.task index 93e11eb1fb..5204ee1fb1 100644 --- a/tests/parallel_test/cases.task +++ b/tests/parallel_test/cases.task @@ -738,7 +738,7 @@ ,,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/tmqDropStb.py ,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqDropStbCtb.py From 2a5074870db6196ba5dcee0eddce4c027e53f5e2 Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Thu, 2 Mar 2023 11:33:29 +0800 Subject: [PATCH 047/174] fix: add missing db options in show create database result --- include/common/tmsg.h | 7 +++++++ include/libs/nodes/cmdnodes.h | 1 + source/common/src/tmsg.c | 14 ++++++++++++++ source/dnode/mnode/impl/src/mndDb.c | 7 +++++++ source/libs/command/src/command.c | 16 ++++++++++------ source/libs/parser/src/parTranslater.c | 5 +++++ 6 files changed, 44 insertions(+), 6 deletions(-) diff --git a/include/common/tmsg.h b/include/common/tmsg.h index 6ca36e7433..41bc873a3b 100644 --- a/include/common/tmsg.h +++ b/include/common/tmsg.h @@ -929,12 +929,19 @@ typedef struct { int32_t minRows; int32_t maxRows; int32_t walFsyncPeriod; + int16_t hashPrefix; + int16_t hashSuffix; int8_t walLevel; int8_t precision; int8_t compression; int8_t replications; int8_t strict; int8_t cacheLast; + int32_t tsdbPageSize; + int32_t walRetentionPeriod; + int32_t walRollPeriod; + int64_t walRetentionSize; + int64_t walSegmentSize; int32_t numOfRetensions; SArray* pRetensions; int8_t schemaless; diff --git a/include/libs/nodes/cmdnodes.h b/include/libs/nodes/cmdnodes.h index 164fbf018c..a0fc8d1238 100644 --- a/include/libs/nodes/cmdnodes.h +++ b/include/libs/nodes/cmdnodes.h @@ -265,6 +265,7 @@ typedef struct SShowStmt { typedef struct SShowCreateDatabaseStmt { ENodeType type; char dbName[TSDB_DB_NAME_LEN]; + char dbFName[TSDB_DB_FNAME_LEN]; void* pCfg; // SDbCfgInfo } SShowCreateDatabaseStmt; diff --git a/source/common/src/tmsg.c b/source/common/src/tmsg.c index e180959d1e..d8e987e879 100644 --- a/source/common/src/tmsg.c +++ b/source/common/src/tmsg.c @@ -2865,12 +2865,19 @@ int32_t tSerializeSDbCfgRsp(void *buf, int32_t bufLen, const SDbCfgRsp *pRsp) { if (tEncodeI32(&encoder, pRsp->minRows) < 0) return -1; if (tEncodeI32(&encoder, pRsp->maxRows) < 0) return -1; if (tEncodeI32(&encoder, pRsp->walFsyncPeriod) < 0) return -1; + if (tEncodeI16(&encoder, pRsp->hashPrefix) < 0) return -1; + if (tEncodeI16(&encoder, pRsp->hashSuffix) < 0) return -1; if (tEncodeI8(&encoder, pRsp->walLevel) < 0) return -1; if (tEncodeI8(&encoder, pRsp->precision) < 0) return -1; if (tEncodeI8(&encoder, pRsp->compression) < 0) return -1; if (tEncodeI8(&encoder, pRsp->replications) < 0) return -1; if (tEncodeI8(&encoder, pRsp->strict) < 0) return -1; if (tEncodeI8(&encoder, pRsp->cacheLast) < 0) return -1; + if (tEncodeI32(&encoder, pRsp->tsdbPageSize) < 0) return -1; + if (tEncodeI32(&encoder, pRsp->walRetentionPeriod) < 0) return -1; + if (tEncodeI32(&encoder, pRsp->walRollPeriod) < 0) return -1; + if (tEncodeI64(&encoder, pRsp->walRetentionSize) < 0) return -1; + if (tEncodeI64(&encoder, pRsp->walSegmentSize) < 0) return -1; if (tEncodeI32(&encoder, pRsp->numOfRetensions) < 0) return -1; for (int32_t i = 0; i < pRsp->numOfRetensions; ++i) { SRetention *pRetension = taosArrayGet(pRsp->pRetensions, i); @@ -2905,12 +2912,19 @@ int32_t tDeserializeSDbCfgRsp(void *buf, int32_t bufLen, SDbCfgRsp *pRsp) { if (tDecodeI32(&decoder, &pRsp->minRows) < 0) return -1; if (tDecodeI32(&decoder, &pRsp->maxRows) < 0) return -1; if (tDecodeI32(&decoder, &pRsp->walFsyncPeriod) < 0) return -1; + if (tDecodeI16(&decoder, &pRsp->hashPrefix) < 0) return -1; + if (tDecodeI16(&decoder, &pRsp->hashSuffix) < 0) return -1; if (tDecodeI8(&decoder, &pRsp->walLevel) < 0) return -1; if (tDecodeI8(&decoder, &pRsp->precision) < 0) return -1; if (tDecodeI8(&decoder, &pRsp->compression) < 0) return -1; if (tDecodeI8(&decoder, &pRsp->replications) < 0) return -1; if (tDecodeI8(&decoder, &pRsp->strict) < 0) return -1; if (tDecodeI8(&decoder, &pRsp->cacheLast) < 0) return -1; + if (tDecodeI32(&decoder, &pRsp->tsdbPageSize) < 0) return -1; + if (tDecodeI32(&decoder, &pRsp->walRetentionPeriod) < 0) return -1; + if (tDecodeI32(&decoder, &pRsp->walRollPeriod) < 0) return -1; + if (tDecodeI64(&decoder, &pRsp->walRetentionSize) < 0) return -1; + if (tDecodeI64(&decoder, &pRsp->walSegmentSize) < 0) return -1; if (tDecodeI32(&decoder, &pRsp->numOfRetensions) < 0) return -1; if (pRsp->numOfRetensions > 0) { pRsp->pRetensions = taosArrayInit(pRsp->numOfRetensions, sizeof(SRetention)); diff --git a/source/dnode/mnode/impl/src/mndDb.c b/source/dnode/mnode/impl/src/mndDb.c index 5de76a9d46..af76971304 100644 --- a/source/dnode/mnode/impl/src/mndDb.c +++ b/source/dnode/mnode/impl/src/mndDb.c @@ -887,12 +887,19 @@ static int32_t mndProcessGetDbCfgReq(SRpcMsg *pReq) { cfgRsp.minRows = pDb->cfg.minRows; cfgRsp.maxRows = pDb->cfg.maxRows; cfgRsp.walFsyncPeriod = pDb->cfg.walFsyncPeriod; + cfgRsp.hashPrefix = pDb->cfg.hashPrefix; + cfgRsp.hashSuffix = pDb->cfg.hashSuffix; cfgRsp.walLevel = pDb->cfg.walLevel; cfgRsp.precision = pDb->cfg.precision; cfgRsp.compression = pDb->cfg.compression; cfgRsp.replications = pDb->cfg.replications; cfgRsp.strict = pDb->cfg.strict; cfgRsp.cacheLast = pDb->cfg.cacheLast; + cfgRsp.tsdbPageSize = pDb->cfg.tsdbPageSize; + cfgRsp.walRetentionPeriod = pDb->cfg.walRetentionPeriod; + cfgRsp.walRollPeriod = pDb->cfg.walRollPeriod; + cfgRsp.walRetentionSize = pDb->cfg.walRetentionSize; + cfgRsp.walSegmentSize = pDb->cfg.walSegmentSize; cfgRsp.numOfRetensions = pDb->cfg.numOfRetensions; cfgRsp.pRetensions = pDb->cfg.pRetensions; cfgRsp.schemaless = pDb->cfg.schemaless; diff --git a/source/libs/command/src/command.c b/source/libs/command/src/command.c index f88701afe2..c862a75ed3 100644 --- a/source/libs/command/src/command.c +++ b/source/libs/command/src/command.c @@ -248,13 +248,13 @@ static const char* cacheModelStr(int8_t cacheModel) { return TSDB_CACHE_MODEL_NONE_STR; } -static void setCreateDBResultIntoDataBlock(SSDataBlock* pBlock, char* dbFName, SDbCfgInfo* pCfg) { +static void setCreateDBResultIntoDataBlock(SSDataBlock* pBlock, char* dbName, char* dbFName, SDbCfgInfo* pCfg) { blockDataEnsureCapacity(pBlock, 1); pBlock->info.rows = 1; SColumnInfoData* pCol1 = taosArrayGet(pBlock->pDataBlock, 0); char buf1[SHOW_CREATE_DB_RESULT_FIELD1_LEN] = {0}; - STR_TO_VARSTR(buf1, dbFName); + STR_TO_VARSTR(buf1, dbName); colDataSetVal(pCol1, 0, buf1, false); SColumnInfoData* pCol2 = taosArrayGet(pBlock->pDataBlock, 1); @@ -277,16 +277,20 @@ static void setCreateDBResultIntoDataBlock(SSDataBlock* pBlock, char* dbFName, S } char* retentions = buildRetension(pCfg->pRetensions); + int32_t dbFNameLen = strlen(dbFName); + int32_t hashPrefix = (pCfg->hashPrefix > (dbFNameLen + 1)) ? (pCfg->hashPrefix - dbFNameLen - 1) : 0; len += sprintf( buf2 + VARSTR_HEADER_SIZE, "CREATE DATABASE `%s` BUFFER %d CACHESIZE %d CACHEMODEL '%s' COMP %d DURATION %dm " "WAL_FSYNC_PERIOD %d MAXROWS %d MINROWS %d STT_TRIGGER %d KEEP %dm,%dm,%dm PAGES %d PAGESIZE %d PRECISION '%s' REPLICA %d " - "WAL_LEVEL %d VGROUPS %d SINGLE_STABLE %d", - dbFName, pCfg->buffer, pCfg->cacheSize, cacheModelStr(pCfg->cacheLast), pCfg->compression, pCfg->daysPerFile, + "WAL_LEVEL %d VGROUPS %d SINGLE_STABLE %d TABLE_PREFIX %d TABLE_SUFFIX %d TSDB_PAGESIZE %d " + "WAL_RETENTION_PERIOD %d WAL_RETENTION_SIZE %" PRId64 " WAL_ROLL_PERIOD %d WAL_SEGMENT_SIZE %" PRId64, + dbName, pCfg->buffer, pCfg->cacheSize, cacheModelStr(pCfg->cacheLast), pCfg->compression, pCfg->daysPerFile, pCfg->walFsyncPeriod, pCfg->maxRows, pCfg->minRows, pCfg->sstTrigger, pCfg->daysToKeep0, pCfg->daysToKeep1, pCfg->daysToKeep2, pCfg->pages, pCfg->pageSize, prec, pCfg->replications, pCfg->walLevel, pCfg->numOfVgroups, - 1 == pCfg->numOfStables); + 1 == pCfg->numOfStables, hashPrefix, pCfg->hashSuffix, pCfg->tsdbPageSize, pCfg->walRetentionPeriod, + pCfg->walRetentionSize, pCfg->walRollPeriod, pCfg->walSegmentSize); if (retentions) { len += sprintf(buf2 + VARSTR_HEADER_SIZE + len, " RETENTIONS %s", retentions); @@ -404,7 +408,7 @@ static int32_t execShowCreateDatabase(SShowCreateDatabaseStmt* pStmt, SRetrieveT SSDataBlock* pBlock = NULL; int32_t code = buildCreateDBResultDataBlock(&pBlock); if (TSDB_CODE_SUCCESS == code) { - setCreateDBResultIntoDataBlock(pBlock, pStmt->dbName, pStmt->pCfg); + setCreateDBResultIntoDataBlock(pBlock, pStmt->dbName, pStmt->dbFName, pStmt->pCfg); } if (TSDB_CODE_SUCCESS == code) { code = buildRetrieveTableRsp(pBlock, SHOW_CREATE_DB_RESULT_COLS, pRsp); diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index 2f621ba5c8..a20fe9a8b8 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -6477,6 +6477,11 @@ static int32_t translateShowCreateDatabase(STranslateContext* pCxt, SShowCreateD if (NULL == pStmt->pCfg) { return TSDB_CODE_OUT_OF_MEMORY; } + + SName name; + tNameSetDbName(&name, pCxt->pParseCxt->acctId, pStmt->dbName, strlen(pStmt->dbName)); + tNameGetFullDbName(&name, pStmt->dbFName); + return getDBCfg(pCxt, pStmt->dbName, (SDbCfgInfo*)pStmt->pCfg); } From 5c50eeb5cccbb266c9b4ceceef0d256a7a50ea10 Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Thu, 2 Mar 2023 12:16:28 +0800 Subject: [PATCH 048/174] change default config --- source/libs/transport/src/transCli.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/libs/transport/src/transCli.c b/source/libs/transport/src/transCli.c index 526b4bfc6f..274d153adc 100644 --- a/source/libs/transport/src/transCli.c +++ b/source/libs/transport/src/transCli.c @@ -1173,7 +1173,7 @@ static void cliHandleBatchReq(SCliBatch* pBatch, SCliThrd* pThrd) { addr.sin_port = (uint16_t)htons(pList->port); tTrace("%s conn %p try to connect to %s", pTransInst->label, conn, pList->dst); - int32_t fd = taosCreateSocketWithTimeout(TRANS_CONN_TIMEOUT * 4); + int32_t fd = taosCreateSocketWithTimeout(TRANS_CONN_TIMEOUT * 10); if (fd == -1) { tError("%s conn %p failed to create socket, reason:%s", transLabel(pTransInst), conn, tstrerror(TAOS_SYSTEM_ERROR(errno))); From 1cb6e49c79e31dce3a54c80d5d978007ee4a5198 Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Thu, 2 Mar 2023 13:04:49 +0800 Subject: [PATCH 049/174] change default config --- source/libs/stream/src/streamDispatch.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/libs/stream/src/streamDispatch.c b/source/libs/stream/src/streamDispatch.c index f2b1db19e8..7e7c23f98a 100644 --- a/source/libs/stream/src/streamDispatch.c +++ b/source/libs/stream/src/streamDispatch.c @@ -278,6 +278,7 @@ int32_t streamDispatchOneRecoverFinishReq(SStreamTask* pTask, const SStreamRecov msg.contLen = tlen + sizeof(SMsgHead); msg.pCont = buf; msg.msgType = TDMT_STREAM_RECOVER_FINISH; + msg.info.noResp = 1; tmsgSendReq(pEpSet, &msg); @@ -522,4 +523,3 @@ FREE: taosFreeQitem(pBlock); return code; } - From 3015967484814513ce603fed6a1f2dcc723393ce Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Thu, 2 Mar 2023 13:09:50 +0800 Subject: [PATCH 050/174] fix: fix show create database issue --- tests/develop-test/2-query/show_create_db.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/develop-test/2-query/show_create_db.py b/tests/develop-test/2-query/show_create_db.py index e5a79074ef..5574a59ec2 100644 --- a/tests/develop-test/2-query/show_create_db.py +++ b/tests/develop-test/2-query/show_create_db.py @@ -42,17 +42,17 @@ class TDTestCase: tdSql.query('show create database scd;') tdSql.checkRows(1) tdSql.checkData(0, 0, 'scd') - tdSql.checkData(0, 1, "CREATE DATABASE `scd` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 14400m WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 1 KEEP 5256000m,5256000m,5256000m PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0") + tdSql.checkData(0, 1, "CREATE DATABASE `scd` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 14400m WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 1 KEEP 5256000m,5256000m,5256000m PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0 TABLE_PREFIX 0 TABLE_SUFFIX 0 TSDB_PAGESIZE 4 WAL_RETENTION_PERIOD 0 WAL_RETENTION_SIZE 0 WAL_ROLL_PERIOD 0 WAL_SEGMENT_SIZE 0") tdSql.query('show create database scd2;') tdSql.checkRows(1) tdSql.checkData(0, 0, 'scd2') - tdSql.checkData(0, 1, "CREATE DATABASE `scd2` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 14400m WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 3 KEEP 5256000m,5256000m,5256000m PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0") + tdSql.checkData(0, 1, "CREATE DATABASE `scd2` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 14400m WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 3 KEEP 5256000m,5256000m,5256000m PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0 TABLE_PREFIX 0 TABLE_SUFFIX 0 TSDB_PAGESIZE 4 WAL_RETENTION_PERIOD 0 WAL_RETENTION_SIZE 0 WAL_ROLL_PERIOD 0 WAL_SEGMENT_SIZE 0") tdSql.query('show create database scd4') tdSql.checkRows(1) tdSql.checkData(0, 0, 'scd4') - tdSql.checkData(0, 1, "CREATE DATABASE `scd4` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 14400m WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 13 KEEP 5256000m,5256000m,5256000m PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0") + tdSql.checkData(0, 1, "CREATE DATABASE `scd4` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 14400m WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 13 KEEP 5256000m,5256000m,5256000m PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0 TABLE_PREFIX 0 TABLE_SUFFIX 0 TSDB_PAGESIZE 4 WAL_RETENTION_PERIOD 0 WAL_RETENTION_SIZE 0 WAL_ROLL_PERIOD 0 WAL_SEGMENT_SIZE 0") self.restartTaosd(1, dbname='scd') @@ -60,17 +60,17 @@ class TDTestCase: tdSql.query('show create database scd;') tdSql.checkRows(1) tdSql.checkData(0, 0, 'scd') - tdSql.checkData(0, 1, "CREATE DATABASE `scd` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 14400m WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 1 KEEP 5256000m,5256000m,5256000m PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0") + tdSql.checkData(0, 1, "CREATE DATABASE `scd` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 14400m WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 1 KEEP 5256000m,5256000m,5256000m PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0 TABLE_PREFIX 0 TABLE_SUFFIX 0 TSDB_PAGESIZE 4 WAL_RETENTION_PERIOD 0 WAL_RETENTION_SIZE 0 WAL_ROLL_PERIOD 0 WAL_SEGMENT_SIZE 0") tdSql.query('show create database scd2;') tdSql.checkRows(1) tdSql.checkData(0, 0, 'scd2') - tdSql.checkData(0, 1, "CREATE DATABASE `scd2` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 14400m WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 3 KEEP 5256000m,5256000m,5256000m PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0") + tdSql.checkData(0, 1, "CREATE DATABASE `scd2` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 14400m WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 3 KEEP 5256000m,5256000m,5256000m PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0 TABLE_PREFIX 0 TABLE_SUFFIX 0 TSDB_PAGESIZE 4 WAL_RETENTION_PERIOD 0 WAL_RETENTION_SIZE 0 WAL_ROLL_PERIOD 0 WAL_SEGMENT_SIZE 0") tdSql.query('show create database scd4') tdSql.checkRows(1) tdSql.checkData(0, 0, 'scd4') - tdSql.checkData(0, 1, "CREATE DATABASE `scd4` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 14400m WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 13 KEEP 5256000m,5256000m,5256000m PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0") + tdSql.checkData(0, 1, "CREATE DATABASE `scd4` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 14400m WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 13 KEEP 5256000m,5256000m,5256000m PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0 TABLE_PREFIX 0 TABLE_SUFFIX 0 TSDB_PAGESIZE 4 WAL_RETENTION_PERIOD 0 WAL_RETENTION_SIZE 0 WAL_ROLL_PERIOD 0 WAL_SEGMENT_SIZE 0") tdSql.execute('drop database scd') From e383afc96de869dd19e0fef96301f19b99f98361 Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Thu, 2 Mar 2023 13:58:03 +0800 Subject: [PATCH 051/174] change default config --- source/common/src/tglobal.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/common/src/tglobal.c b/source/common/src/tglobal.c index eef174ef5f..e7873fb269 100644 --- a/source/common/src/tglobal.c +++ b/source/common/src/tglobal.c @@ -41,8 +41,8 @@ bool tsPrintAuth = false; // queue & threads int32_t tsNumOfRpcThreads = 1; -int32_t tsNumOfRpcSessions = 5000; -int32_t tsTimeToGetAvailableConn = 1000000; +int32_t tsNumOfRpcSessions = 6000; +int32_t tsTimeToGetAvailableConn = 500000; int32_t tsNumOfCommitThreads = 2; int32_t tsNumOfTaskQueueThreads = 4; int32_t tsNumOfMnodeQueryThreads = 4; From 09ac1be5ffd3b5b2632c6c2adb31a08978dc6aaa Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Thu, 2 Mar 2023 14:26:11 +0800 Subject: [PATCH 052/174] ci:adjust test cases --- tests/script/tsim/stream/basic0.sim | 62 ++++++++++++++++++++++------- 1 file changed, 47 insertions(+), 15 deletions(-) diff --git a/tests/script/tsim/stream/basic0.sim b/tests/script/tsim/stream/basic0.sim index 8e3e99978b..68c5894cbf 100644 --- a/tests/script/tsim/stream/basic0.sim +++ b/tests/script/tsim/stream/basic0.sim @@ -48,24 +48,35 @@ sleep 100 #=================================================================== print =============== query data from child table +$loop_count = 0 + +loop0: +sleep 200 + +$loop_count = $loop_count + 1 +if $loop_count == 20 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 print expect 234, actual $data03 - return -1 + goto loop0 endi #=================================================================== @@ -77,23 +88,34 @@ sleep 100 #=================================================================== print =============== query data from child table +$loop_count = 0 + +loop1: +sleep 200 + +$loop_count = $loop_count + 1 +if $loop_count == 20 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 loop1 endi if $data01 != -111 then - return -1 + goto loop1 endi if $data02 != 234 then - return -1 + goto loop1 endi if $data03 != 123 then - return -1 + goto loop1 endi #=================================================================== @@ -105,36 +127,46 @@ sleep 100 #=================================================================== print =============== query data from child table +$loop_count = 0 + +loop2: +sleep 200 + +$loop_count = $loop_count + 1 +if $loop_count == 20 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 loop2 endi if $data01 != -111 then - return -1 + goto loop2 endi if $data02 != 234 then - return -1 + goto loop2 endi if $data03 != 123 then - return -1 + goto loop2 endi if $data11 != 789 then - return -1 + goto loop2 endi if $data12 != 789 then - return -1 + goto loop2 endi if $data13 != 789 then - return -1 + goto loop2 endi _OVER: From e0819db5de2d278316f3424d06c5f3089aa8ef81 Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Thu, 2 Mar 2023 15:06:11 +0800 Subject: [PATCH 053/174] fix: auto retention --- source/dnode/vnode/src/vnd/vnodeSvr.c | 28 ++++++--------------------- 1 file changed, 6 insertions(+), 22 deletions(-) diff --git a/source/dnode/vnode/src/vnd/vnodeSvr.c b/source/dnode/vnode/src/vnd/vnodeSvr.c index 3525e696c5..5712a8ecb8 100644 --- a/source/dnode/vnode/src/vnd/vnodeSvr.c +++ b/source/dnode/vnode/src/vnd/vnodeSvr.c @@ -599,16 +599,10 @@ static int32_t vnodeProcessTrimReq(SVnode *pVnode, int64_t version, void *pReq, vInfo("vgId:%d, trim vnode request will be processed, time:%d", pVnode->config.vgId, trimReq.timestamp); -// process -#if 0 - code = tsdbDoRetention(pVnode->pTsdb, trimReq.timestamp); - if (code) goto _exit; - - code = smaDoRetention(pVnode->pSma, trimReq.timestamp); - if (code) goto _exit; -#else + // process vnodeAsyncRentention(pVnode, trimReq.timestamp); -#endif + tsem_wait(&pVnode->canCommit); + tsem_post(&pVnode->canCommit); _exit: return code; @@ -633,18 +627,7 @@ static int32_t vnodeProcessDropTtlTbReq(SVnode *pVnode, int64_t version, void *p tqUpdateTbUidList(pVnode->pTq, tbUids, false); } -#if 0 - // process - ret = tsdbDoRetention(pVnode->pTsdb, ttlReq.timestamp); - if (ret) goto end; - - ret = smaDoRetention(pVnode->pSma, ttlReq.timestamp); - if (ret) goto end; -#else vnodeAsyncRentention(pVnode, ttlReq.timestamp); - tsem_wait(&pVnode->canCommit); - tsem_post(&pVnode->canCommit); -#endif end: taosArrayDestroy(tbUids); @@ -1647,7 +1630,8 @@ static int32_t vnodeProcessCompactVnodeReq(SVnode *pVnode, int64_t version, void return vnodeProcessCompactVnodeReqImpl(pVnode, version, pReq, len, pRsp); } - #ifndef TD_ENTERPRISE -int32_t vnodeProcessCompactVnodeReqImpl(SVnode *pVnode, int64_t version, void *pReq, int32_t len, SRpcMsg *pRsp) { return 0; } +int32_t vnodeProcessCompactVnodeReqImpl(SVnode *pVnode, int64_t version, void *pReq, int32_t len, SRpcMsg *pRsp) { + return 0; +} #endif From e1f5426dd667cb8f3f824e92da097fd4684d8cc4 Mon Sep 17 00:00:00 2001 From: jiacy-jcy <714897623@qq.com> Date: Thu, 2 Mar 2023 15:55:58 +0800 Subject: [PATCH 054/174] update test case --- tests/system-test/0-others/show.py | 87 ++++++++++++++++++++++++------ 1 file changed, 70 insertions(+), 17 deletions(-) diff --git a/tests/system-test/0-others/show.py b/tests/system-test/0-others/show.py index 82f9cb9d7e..f94fd3baad 100644 --- a/tests/system-test/0-others/show.py +++ b/tests/system-test/0-others/show.py @@ -11,10 +11,6 @@ # -*- coding: utf-8 -*- - - - - import re from util.log import * from util.cases import * @@ -31,10 +27,36 @@ class TDTestCase: self.ins_param_list = ['dnodes','mnodes','qnodes','cluster','functions','users','grants','topics','subscriptions','streams'] self.perf_param = ['apps','connections','consumers','queries','transactions'] self.perf_param_list = ['apps','connections','consumers','queries','trans'] - + self.dbname = "db" + self.stbname = f'{self.dbname}.`{tdCom.getLongName(5)}`' + self.tbname = f'{self.dbname}.`{tdCom.getLongName(3)}`' + self.db_param = { + "database":f"{self.dbname}", + "buffer":100, + "cachemodel":"'none'", + "cachesize":1, + "comp":2, + "maxrows":1000, + "minrows":200, + "pages":512, + "pagesize":16, + "precision":"'ms'", + "replica":1, + "retentions":"15s:7d,1m:21d,15m:50d", + "wal_level":1, + "wal_fsync_period":6000, + "wal_retention_period":1, + "wal_retention_size":1024, + "wal_roll_period":0, + "wal_segment_size":1024, + "vgroups":10, + "stt_trigger":1 + } def ins_check(self): tdSql.prepare() for param in self.ins_param_list: + if param.lower() == 'qnodes': + tdSql.execute('create qnode on dnode 1') tdSql.query(f'show {param}') show_result = tdSql.queryResult tdSql.query(f'select * from information_schema.ins_{param}') @@ -62,11 +84,29 @@ class TDTestCase: tag_sql += f"{k} {v}, " create_stb_sql = f'create stable {stbname} ({column_sql[:-2]}) tags ({tag_sql[:-2]})' return create_stb_sql - def show_sql(self): - tdSql.prepare() - tdSql.execute('use db') - stbname = f'`{tdCom.getLongName(5)}`' - tbname = f'`{tdCom.getLongName(3)}`' + + def set_create_database_sql(self,sql_dict): + create_sql = 'create' + for key,value in sql_dict.items(): + create_sql += f' {key} {value}' + + def show_create_sql(self): + create_db_sql = self.set_create_database_sql(self.db_param) + tdSql.execute(create_db_sql) + tdSql.query(f'show create database {self.dbname}') + tdSql.checkEqual(self.dbname,tdSql.queryResult[0][0]) + for key,value in self.db_param.items(): + if key == 'database': + continue + else: + param = f'{key} {value}' + if param in tdSql.queryResult[0][1].lower(): + tdLog.info(f'show create database check success with {key} {value}') + continue + else: + tdLog.exit(f"show create database check failed with {key} {value}") + + column_dict = { '`ts`': 'timestamp', '`col1`': 'tinyint', @@ -101,21 +141,21 @@ class TDTestCase: '`t14`': 'timestamp' } - create_table_sql = self.set_stb_sql(stbname,column_dict,tag_dict) + create_table_sql = self.set_stb_sql(self.stbname,column_dict,tag_dict) tdSql.execute(create_table_sql) - tdSql.query(f'show create table {stbname}') + tdSql.query(f'show create stable {self.stbname}') query_result = tdSql.queryResult tdSql.checkEqual(query_result[0][1].lower(),create_table_sql) - tdSql.execute(f'create table {tbname} using {stbname} tags(1,1,1,1,1,1,1,1,1.000000e+00,1.000000e+00,true,"abc","abc123",0)') + tdSql.execute(f'create table {self.tbname} using {self.stbname} tags(1,1,1,1,1,1,1,1,1.000000e+00,1.000000e+00,true,"abc","abc123",0)') tag_sql = '(' for tag_keys in tag_dict.keys(): tag_sql += f'{tag_keys}, ' tags = f'{tag_sql[:-2]})' - sql = f'create table {tbname} using {stbname} {tags} tags (1, 1, 1, 1, 1, 1, 1, 1, 1.000000e+00, 1.000000e+00, true, "abc", "abc123", 0)' - tdSql.query(f'show create table {tbname}') + sql = f'create table {self.tbname} using {self.stbname} {tags} tags (1, 1, 1, 1, 1, 1, 1, 1, 1.000000e+00, 1.000000e+00, true, "abc", "abc123", 0)' + tdSql.query(f'show create table {self.tbname}') query_result = tdSql.queryResult tdSql.checkEqual(query_result[0][1].lower(),sql) - tdSql.execute('drop database db') + tdSql.execute(f'drop database {self.dbname}') def check_gitinfo(self): taosd_gitinfo_sql = '' tdSql.query('show dnode 1 variables') @@ -133,11 +173,24 @@ class TDTestCase: taosd_info = os.popen('taosd -V').read() taosd_gitinfo = re.findall("^gitinfo.*",taosd_info,re.M) tdSql.checkEqual(taosd_gitinfo_sql,taosd_gitinfo[0]) + + def show_base(self): + for sql in ['dnodes','mnodes','cluster']: + tdSql.query(f'show {sql}') + print(tdSql.queryResult) + tdSql.checkRows(1) + tdSql.query('show grants') + grants_info = tdSql.queryResult + tdSql.query('show licences') + licences_info = tdSql.queryResult + tdSql.checkEqual(grants_info,licences_info) + def run(self): self.check_gitinfo() + self.show_base() self.ins_check() self.perf_check() - self.show_sql() + self.show_create_sql() def stop(self): tdSql.close() From dfaf26dfc56b729a7e7feb86118bc426ea2c433e Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Thu, 2 Mar 2023 18:10:02 +0800 Subject: [PATCH 055/174] add data scan --- source/dnode/vnode/src/vnd/vnodeSvr.c | 38 +++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/source/dnode/vnode/src/vnd/vnodeSvr.c b/source/dnode/vnode/src/vnd/vnodeSvr.c index 192a3615e1..b59eabfbc8 100644 --- a/source/dnode/vnode/src/vnd/vnodeSvr.c +++ b/source/dnode/vnode/src/vnd/vnodeSvr.c @@ -1228,6 +1228,44 @@ static int32_t vnodeProcessSubmitReq(SVnode *pVnode, int64_t version, void *pReq tDecoderClear(&dc); } + // scan + TSKEY now = taosGetTimestamp(pVnode->config.tsdbCfg.precision); + TSKEY minKey = now - tsTickPerMin[pVnode->config.tsdbCfg.precision] * pVnode->config.tsdbCfg.keep2; + TSKEY maxKey = tsMaxKeyByPrecision[pVnode->config.tsdbCfg.precision]; + for (int32_t i = 0; i < TARRAY_SIZE(pSubmitReq->aSubmitTbData); ++i) { + SSubmitTbData *pSubmitTbData = taosArrayGet(pSubmitReq->aSubmitTbData, i); + + if (pSubmitTbData->flags & SUBMIT_REQ_COLUMN_DATA_FORMAT) { + if (TARRAY_SIZE(pSubmitTbData->aCol) <= 0) { + code = TSDB_CODE_INVALID_MSG; + goto _exit; + } + + SColData *pColData = (SColData *)taosArrayGet(pSubmitTbData->aCol, 0); + TSKEY *aKey = (TSKEY *)(pColData->pData); + + for (int32_t iRow = 0; iRow < pColData->nVal; iRow++) { + if (aKey[iRow] < minKey || aKey[iRow] > maxKey || (iRow > 0 && aKey[iRow] <= aKey[iRow - 1])) { + code = TSDB_CODE_INVALID_MSG; + vError("vgId:%d %s failed since %s, version:%" PRId64, TD_VID(pVnode), __func__, tstrerror(terrno), version); + goto _exit; + } + } + + } else { + int32_t nRow = TARRAY_SIZE(pSubmitTbData->aRowP); + SRow **aRow = (SRow **)TARRAY_DATA(pSubmitTbData->aRowP); + + for (int32_t iRow = 0; iRow < nRow; ++iRow) { + if (aRow[iRow]->ts < minKey || aRow[iRow]->ts > maxKey || (iRow > 0 && aRow[iRow]->ts <= aRow[iRow - 1]->ts)) { + code = TSDB_CODE_INVALID_MSG; + vError("vgId:%d %s failed since %s, version:%" PRId64, TD_VID(pVnode), __func__, tstrerror(terrno), version); + goto _exit; + } + } + } + } + for (int32_t i = 0; i < TARRAY_SIZE(pSubmitReq->aSubmitTbData); ++i) { SSubmitTbData *pSubmitTbData = taosArrayGet(pSubmitReq->aSubmitTbData, i); From 7deee1c4c78d8ce9ae51c5475f466a5f6e2c7983 Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Thu, 2 Mar 2023 18:22:42 +0800 Subject: [PATCH 056/174] fix: last cache read problem after schema change --- source/dnode/vnode/src/inc/tsdb.h | 1 + source/dnode/vnode/src/tsdb/tsdbCache.c | 93 ++++++++++++++++----- source/dnode/vnode/src/tsdb/tsdbCacheRead.c | 4 +- 3 files changed, 76 insertions(+), 22 deletions(-) diff --git a/source/dnode/vnode/src/inc/tsdb.h b/source/dnode/vnode/src/inc/tsdb.h index 44b7e95f9e..15087e90f0 100644 --- a/source/dnode/vnode/src/inc/tsdb.h +++ b/source/dnode/vnode/src/inc/tsdb.h @@ -766,6 +766,7 @@ typedef struct SCacheRowsReader { TdThreadMutex readerMutex; SVnode *pVnode; STSchema *pSchema; + STSchema *pCurrSchema; uint64_t uid; uint64_t suid; char **transferBuf; // todo remove it soon diff --git a/source/dnode/vnode/src/tsdb/tsdbCache.c b/source/dnode/vnode/src/tsdb/tsdbCache.c index 79e0ccc3e3..f69445fa0c 100644 --- a/source/dnode/vnode/src/tsdb/tsdbCache.c +++ b/source/dnode/vnode/src/tsdb/tsdbCache.c @@ -1390,17 +1390,56 @@ _err: return code; } -static int32_t mergeLast(tb_uid_t uid, STsdb *pTsdb, SArray **ppLastArray, SCacheRowsReader *pr) { - int32_t code = 0; +static int32_t cloneTSchema(STSchema *pSrc, STSchema **ppDst) { + int32_t len = sizeof(STSchema) + sizeof(STColumn) * pSrc->numOfCols; + *ppDst = taosMemoryMalloc(len); + if (NULL == *ppDst) { + return TSDB_CODE_OUT_OF_MEMORY; + } + memcpy(*ppDst, pSrc, len); + return TSDB_CODE_SUCCESS; +} +static int32_t updateTSchema(int32_t sversion, SCacheRowsReader *pReader, uint64_t uid) { + if (NULL == pReader->pCurrSchema && sversion == pReader->pSchema->version) { + return cloneTSchema(pReader->pSchema, &pReader->pCurrSchema); + } + + if (NULL != pReader->pCurrSchema && sversion == pReader->pCurrSchema->version) { + return TSDB_CODE_SUCCESS; + } + + taosMemoryFreeClear(pReader->pCurrSchema); + return metaGetTbTSchemaEx(pReader->pTsdb->pVnode->pMeta, pReader->suid, uid, sversion, &pReader->pCurrSchema); +} + +static int32_t initLastColArray(STSchema *pTSchema, SArray **ppColArray) { + SArray *pColArray = taosArrayInit(pTSchema->numOfCols, sizeof(SLastCol)); + if (NULL == pColArray) { + return TSDB_CODE_OUT_OF_MEMORY; + } + + for (int32_t i = 0; i < pTSchema->numOfCols; ++i) { + SLastCol col = {.ts = 0, .colVal = COL_VAL_NULL(pTSchema->columns[i].colId, pTSchema->columns[i].type)}; + taosArrayPush(pColArray, &col); + } + *ppColArray = pColArray; + return TSDB_CODE_SUCCESS; +} + +static int32_t mergeLast(tb_uid_t uid, STsdb *pTsdb, SArray **ppLastArray, SCacheRowsReader *pr) { STSchema *pTSchema = pr->pSchema; // metaGetTbTSchema(pTsdb->pVnode->pMeta, uid, -1, 1); - int16_t nCol = pTSchema->numOfCols; - int16_t iCol = 0; + int16_t nLastCol = pTSchema->numOfCols; int16_t noneCol = 0; bool setNoneCol = false; - SArray *pColArray = taosArrayInit(nCol, sizeof(SLastCol)); + SArray *pColArray = NULL; SColVal *pColVal = &(SColVal){0}; + int32_t code = initLastColArray(pTSchema, &pColArray); + if (TSDB_CODE_SUCCESS != code) { + return code; + } + TSKEY lastRowTs = TSKEY_MAX; CacheNextRowIter iter = {0}; @@ -1415,6 +1454,13 @@ static int32_t mergeLast(tb_uid_t uid, STsdb *pTsdb, SArray **ppLastArray, SCach break; } + code = updateTSchema(TSDBROW_SVERSION(pRow), pr, uid); + if (TSDB_CODE_SUCCESS != code) { + goto _err; + } + pTSchema = pr->pCurrSchema; + int16_t nCol = pTSchema->numOfCols; + TSKEY rowTs = TSDBROW_TS(pRow); if (lastRowTs == TSKEY_MAX) { @@ -1422,28 +1468,27 @@ static int32_t mergeLast(tb_uid_t uid, STsdb *pTsdb, SArray **ppLastArray, SCach STColumn *pTColumn = &pTSchema->columns[0]; *pColVal = COL_VAL_VALUE(pTColumn->colId, pTColumn->type, (SValue){.val = lastRowTs}); - if (taosArrayPush(pColArray, &(SLastCol){.ts = lastRowTs, .colVal = *pColVal}) == NULL) { - code = TSDB_CODE_OUT_OF_MEMORY; - goto _err; - } + taosArraySet(pColArray, 0, &(SLastCol){.ts = lastRowTs, .colVal = *pColVal}); - for (iCol = 1; iCol < nCol; ++iCol) { + for (int16_t iCol = 1; iCol < nCol; ++iCol) { + if (iCol >= nLastCol) { + break; + } + SLastCol *pCol = taosArrayGet(pColArray, iCol); + if (pCol->colVal.cid != pTSchema->columns[iCol].colId) { + continue; + } tsdbRowGetColVal(pRow, pTSchema, iCol, pColVal); - SLastCol lastCol = {.ts = lastRowTs, .colVal = *pColVal}; + *pCol = (SLastCol){.ts = lastRowTs, .colVal = *pColVal}; if (IS_VAR_DATA_TYPE(pColVal->type) && pColVal->value.nData > 0) { - lastCol.colVal.value.pData = taosMemoryMalloc(lastCol.colVal.value.nData); - if (lastCol.colVal.value.pData == NULL) { + pCol->colVal.value.pData = taosMemoryMalloc(pCol->colVal.value.nData); + if (pCol->colVal.value.pData == NULL) { terrno = TSDB_CODE_OUT_OF_MEMORY; code = TSDB_CODE_OUT_OF_MEMORY; goto _err; } - memcpy(lastCol.colVal.value.pData, pColVal->value.pData, pColVal->value.nData); - } - - if (taosArrayPush(pColArray, &lastCol) == NULL) { - code = TSDB_CODE_OUT_OF_MEMORY; - goto _err; + memcpy(pCol->colVal.value.pData, pColVal->value.pData, pColVal->value.nData); } if (!COL_VAL_IS_VALUE(pColVal) && !setNoneCol) { @@ -1461,10 +1506,16 @@ static int32_t mergeLast(tb_uid_t uid, STsdb *pTsdb, SArray **ppLastArray, SCach // merge into pColArray setNoneCol = false; - for (iCol = noneCol; iCol < nCol; ++iCol) { + for (int16_t iCol = noneCol; iCol < nCol; ++iCol) { + if (iCol >= nLastCol) { + break; + } // high version's column value SLastCol *lastColVal = (SLastCol *)taosArrayGet(pColArray, iCol); - SColVal *tColVal = &lastColVal->colVal; + if (lastColVal->colVal.cid != pTSchema->columns[iCol].colId) { + continue; + } + SColVal *tColVal = &lastColVal->colVal; tsdbRowGetColVal(pRow, pTSchema, iCol, pColVal); if (!COL_VAL_IS_VALUE(tColVal) && COL_VAL_IS_VALUE(pColVal)) { diff --git a/source/dnode/vnode/src/tsdb/tsdbCacheRead.c b/source/dnode/vnode/src/tsdb/tsdbCacheRead.c index 97b13a3c37..5bb224799a 100644 --- a/source/dnode/vnode/src/tsdb/tsdbCacheRead.c +++ b/source/dnode/vnode/src/tsdb/tsdbCacheRead.c @@ -209,6 +209,8 @@ void* tsdbCacherowsReaderClose(void* pReader) { taosMemoryFree(p->pSchema); } + taosMemoryFree(p->pCurrSchema); + destroyLastBlockLoadInfo(p->pLoadInfo); taosMemoryFree((void*)p->idstr); @@ -303,7 +305,7 @@ int32_t tsdbRetrieveCacheRows(void* pReader, SSDataBlock* pResBlock, const int32 for (int32_t i = 0; i < pr->pSchema->numOfCols; ++i) { struct STColumn* pCol = &pr->pSchema->columns[i]; - SLastCol p = {.ts = INT64_MIN, .colVal.type = pCol->type}; + SLastCol p = {.ts = INT64_MIN, .colVal.type = pCol->type, .colVal.flag = CV_FLAG_NULL}; if (IS_VAR_DATA_TYPE(pCol->type)) { p.colVal.value.pData = taosMemoryCalloc(pCol->bytes, sizeof(char)); From 95660ebed602508db4d4b5558eb63d007919721b Mon Sep 17 00:00:00 2001 From: xinsheng Ren <285808407@qq.com> Date: Thu, 2 Mar 2023 19:31:26 +0800 Subject: [PATCH 057/174] fix: windows release from tdengine/package/release.bat failed (#20232) * fix: windows release from tdengine/package/release.bat failed * fix: TDengine spelling --------- Co-authored-by: facetosea <25808407@qq.com> --- packaging/release.bat | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packaging/release.bat b/packaging/release.bat index 4c82c5ead5..4b49f364d0 100644 --- a/packaging/release.bat +++ b/packaging/release.bat @@ -46,9 +46,9 @@ rd /s /Q C:\TDengine cmake --install . if not %errorlevel% == 0 ( call :RUNFAILED build x64 failed & exit /b 1) cd %package_dir% -iscc /DMyAppInstallName="%packagServerName_x64%" /DMyAppVersion="%2" /DMyAppExcludeSource="" tools\tdengine.iss /O..\release +iscc /DMyAppInstallName="%packagServerName_x64%" /DMyAppVersion="%2" /DCusName="TDengine" /DCusPrompt="taos" /DMyAppExcludeSource="" tools\tdengine.iss /O..\release if not %errorlevel% == 0 ( call :RUNFAILED package %packagServerName_x64% failed & exit /b 1) -iscc /DMyAppInstallName="%packagClientName_x64%" /DMyAppVersion="%2" /DMyAppExcludeSource="taosd.exe" tools\tdengine.iss /O..\release +iscc /DMyAppInstallName="%packagClientName_x64%" /DMyAppVersion="%2" /DCusName="TDengine" /DCusPrompt="taos" /DMyAppExcludeSource="taosd.exe" tools\tdengine.iss /O..\release if not %errorlevel% == 0 ( call :RUNFAILED package %packagClientName_x64% failed & exit /b 1) goto EXIT0 From 7649ede0749734b77b6ab1c2d1897598a7ff04d8 Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Thu, 2 Mar 2023 19:45:21 +0800 Subject: [PATCH 058/174] fix: last cache read problem after schema change --- source/dnode/vnode/src/tsdb/tsdbCache.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/source/dnode/vnode/src/tsdb/tsdbCache.c b/source/dnode/vnode/src/tsdb/tsdbCache.c index f69445fa0c..425bd2ca1c 100644 --- a/source/dnode/vnode/src/tsdb/tsdbCache.c +++ b/source/dnode/vnode/src/tsdb/tsdbCache.c @@ -1432,6 +1432,7 @@ static int32_t mergeLast(tb_uid_t uid, STsdb *pTsdb, SArray **ppLastArray, SCach int16_t nLastCol = pTSchema->numOfCols; int16_t noneCol = 0; bool setNoneCol = false; + bool hasRow = false; SArray *pColArray = NULL; SColVal *pColVal = &(SColVal){0}; @@ -1454,6 +1455,8 @@ static int32_t mergeLast(tb_uid_t uid, STsdb *pTsdb, SArray **ppLastArray, SCach break; } + hasRow = true; + code = updateTSchema(TSDBROW_SVERSION(pRow), pr, uid); if (TSDB_CODE_SUCCESS != code) { goto _err; @@ -1545,6 +1548,9 @@ static int32_t mergeLast(tb_uid_t uid, STsdb *pTsdb, SArray **ppLastArray, SCach //*ppLastArray = NULL; // taosArrayDestroy(pColArray); //} else { + if (!hasRow) { + taosArrayClear(pColArray); + } *ppLastArray = pColArray; //} From ca23365d6887f33fc9e6e706194edfe046a80d98 Mon Sep 17 00:00:00 2001 From: Benguang Zhao Date: Thu, 2 Mar 2023 20:40:34 +0800 Subject: [PATCH 059/174] enh: fsync WAL idx and log when walRollImpl --- source/libs/wal/src/walWrite.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/source/libs/wal/src/walWrite.c b/source/libs/wal/src/walWrite.c index a992c951fa..b74bbdd15f 100644 --- a/source/libs/wal/src/walWrite.c +++ b/source/libs/wal/src/walWrite.c @@ -387,20 +387,33 @@ END: int32_t walRollImpl(SWal *pWal) { int32_t code = 0; + if (pWal->pIdxFile != NULL) { + code = taosFsyncFile(pWal->pIdxFile); + if (code != 0) { + terrno = TAOS_SYSTEM_ERROR(errno); + goto END; + } code = taosCloseFile(&pWal->pIdxFile); if (code != 0) { terrno = TAOS_SYSTEM_ERROR(errno); goto END; } } + if (pWal->pLogFile != NULL) { + code = taosFsyncFile(pWal->pLogFile); + if (code != 0) { + terrno = TAOS_SYSTEM_ERROR(errno); + goto END; + } code = taosCloseFile(&pWal->pLogFile); if (code != 0) { terrno = TAOS_SYSTEM_ERROR(errno); goto END; } } + TdFilePtr pIdxFile, pLogFile; // create new file int64_t newFileFirstVer = pWal->vers.lastVer + 1; From 302c09cc75580a914a81195d3848bc0ffddcb549 Mon Sep 17 00:00:00 2001 From: chenhaoran Date: Thu, 2 Mar 2023 21:56:55 +0800 Subject: [PATCH 060/174] ci:add cache in ci compling --- tests/parallel_test/container_build.sh | 27 ++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/tests/parallel_test/container_build.sh b/tests/parallel_test/container_build.sh index d0086c733e..55df94e610 100755 --- a/tests/parallel_test/container_build.sh +++ b/tests/parallel_test/container_build.sh @@ -51,10 +51,24 @@ else REP_DIR=/home/TDinternal REP_REAL_PATH=$WORKDIR/TDinternal REP_MOUNT_PARAM=$REP_REAL_PATH:/home/TDinternal + fi date docker run \ -v $REP_MOUNT_PARAM \ + -v /root/.cargo/registry:/root/.cargo/registry \ + -v /root/.cargo/git:/root/.cargo/git \ + -v /root/go/pkg/mod:/root/go/pkg/mod \ + -v /root/.cache/go-build:/root/.cache/go-build \ + -v REP_REAL_PATH/enterprise/src/plugins/taosx/target:REP_DIR/enterprise/src/plugins/taosx/target \ + -v REP_REAL_PATH/community/tools/taosws-rs/target:REP_DIR/community/tools/taosws-rs/target \ + -v REP_REAL_PATH/community/contrib/cJson/:REP_DIR/community/contrib/cJson \ + -v REP_REAL_PATH/community/contrib/googletest/:REP_DIR/community/contrib/googletest \ + -v REP_REAL_PATH/community/contrib/cpp-stub/:REP_DIR/community/contrib/cpp-stub \ + -v REP_REAL_PATH/community/contrib/libuv/:REP_DIR/community/contrib/libuv \ + -v REP_REAL_PATH/community/contrib/lz4/:REP_DIR/community/contrib/lz4 \ + -v REP_REAL_PATH/community/contrib/zlib/:REP_DIR/community/contrib/zlib \ + -v REP_REAL_PATH/community/contrib/jemalloc/:REP_DIR/community/contrib/jemalloc \ --rm --ulimit core=-1 taos_test:v1.0 sh -c "pip uninstall taospy -y;pip3 install taospy==2.7.2;cd $REP_DIR;rm -rf debug;mkdir -p debug;cd debug;cmake .. -DBUILD_HTTP=false -DBUILD_TOOLS=true -DBUILD_TEST=true -DWEBSOCKET=true -DBUILD_TAOSX=true;make -j || exit 1" if [[ -d ${WORKDIR}/debugNoSan ]] ;then @@ -70,6 +84,19 @@ mv ${REP_REAL_PATH}/debug ${WORKDIR}/debugNoSan date docker run \ -v $REP_MOUNT_PARAM \ + -v /root/.cargo/registry:/root/.cargo/registry \ + -v /root/.cargo/git:/root/.cargo/git \ + -v /root/go/pkg/mod:/root/go/pkg/mod \ + -v /root/.cache/go-build:/root/.cache/go-build \ + -v REP_REAL_PATH/enterprise/src/plugins/taosx/target:REP_DIR/enterprise/src/plugins/taosx/target \ + -v REP_REAL_PATH/community/tools/taosws-rs/target:REP_DIR/community/tools/taosws-rs/target \ + -v REP_REAL_PATH/community/contrib/cJson/:REP_DIR/community/contrib/cJson \ + -v REP_REAL_PATH/community/contrib/googletest/:REP_DIR/community/contrib/googletest \ + -v REP_REAL_PATH/community/contrib/cpp-stub/:REP_DIR/community/contrib/cpp-stub \ + -v REP_REAL_PATH/community/contrib/libuv/:REP_DIR/community/contrib/libuv \ + -v REP_REAL_PATH/community/contrib/lz4/:REP_DIR/community/contrib/lz4 \ + -v REP_REAL_PATH/community/contrib/zlib/:REP_DIR/community/contrib/zlib \ + -v REP_REAL_PATH/community/contrib/jemalloc/:REP_DIR/community/contrib/jemalloc \ --rm --ulimit core=-1 taos_test:v1.0 sh -c "pip uninstall taospy -y;pip3 install taospy==2.7.2;cd $REP_DIR;rm -rf debug;mkdir -p debug;cd debug;cmake .. -DBUILD_HTTP=false -DBUILD_TOOLS=true -DBUILD_TEST=true -DWEBSOCKET=true -DBUILD_SANITIZER=1 -DTOOLS_SANITIZE=true -DTOOLS_BUILD_TYPE=Debug -DBUILD_TAOSX=true;make -j || exit 1 " mv ${REP_REAL_PATH}/debug ${WORKDIR}/debugSan From 72a0eab44add726eb2c0f303c1f84cc1b5b1e2fa Mon Sep 17 00:00:00 2001 From: chenhaoran Date: Thu, 2 Mar 2023 22:03:36 +0800 Subject: [PATCH 061/174] ci:add cache in ci compling --- tests/parallel_test/container_build.sh | 36 +++++++++++++------------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/tests/parallel_test/container_build.sh b/tests/parallel_test/container_build.sh index 55df94e610..edb9b4ab3c 100755 --- a/tests/parallel_test/container_build.sh +++ b/tests/parallel_test/container_build.sh @@ -60,15 +60,15 @@ docker run \ -v /root/.cargo/git:/root/.cargo/git \ -v /root/go/pkg/mod:/root/go/pkg/mod \ -v /root/.cache/go-build:/root/.cache/go-build \ - -v REP_REAL_PATH/enterprise/src/plugins/taosx/target:REP_DIR/enterprise/src/plugins/taosx/target \ - -v REP_REAL_PATH/community/tools/taosws-rs/target:REP_DIR/community/tools/taosws-rs/target \ - -v REP_REAL_PATH/community/contrib/cJson/:REP_DIR/community/contrib/cJson \ - -v REP_REAL_PATH/community/contrib/googletest/:REP_DIR/community/contrib/googletest \ - -v REP_REAL_PATH/community/contrib/cpp-stub/:REP_DIR/community/contrib/cpp-stub \ - -v REP_REAL_PATH/community/contrib/libuv/:REP_DIR/community/contrib/libuv \ - -v REP_REAL_PATH/community/contrib/lz4/:REP_DIR/community/contrib/lz4 \ - -v REP_REAL_PATH/community/contrib/zlib/:REP_DIR/community/contrib/zlib \ - -v REP_REAL_PATH/community/contrib/jemalloc/:REP_DIR/community/contrib/jemalloc \ + -v ${REP_REAL_PATH}/enterprise/src/plugins/taosx/target:${REP_DIR}/enterprise/src/plugins/taosx/target \ + -v ${REP_REAL_PATH}/community/tools/taosws-rs/target:${REP_DIR}/community/tools/taosws-rs/target \ + -v ${REP_REAL_PATH}/community/contrib/cJson/:${REP_DIR}/community/contrib/cJson \ + -v ${REP_REAL_PATH}/community/contrib/googletest/:${REP_DIR}/community/contrib/googletest \ + -v ${REP_REAL_PATH}/community/contrib/cpp-stub/:${REP_DIR}/community/contrib/cpp-stub \ + -v ${REP_REAL_PATH}/community/contrib/libuv/:${REP_DIR}/community/contrib/libuv \ + -v ${REP_REAL_PATH}/community/contrib/lz4/:${REP_DIR}/community/contrib/lz4 \ + -v ${REP_REAL_PATH}/community/contrib/zlib/:${REP_DIR}/community/contrib/zlib \ + -v ${REP_REAL_PATH}/community/contrib/jemalloc/:${REP_DIR}/community/contrib/jemalloc \ --rm --ulimit core=-1 taos_test:v1.0 sh -c "pip uninstall taospy -y;pip3 install taospy==2.7.2;cd $REP_DIR;rm -rf debug;mkdir -p debug;cd debug;cmake .. -DBUILD_HTTP=false -DBUILD_TOOLS=true -DBUILD_TEST=true -DWEBSOCKET=true -DBUILD_TAOSX=true;make -j || exit 1" if [[ -d ${WORKDIR}/debugNoSan ]] ;then @@ -88,15 +88,15 @@ docker run \ -v /root/.cargo/git:/root/.cargo/git \ -v /root/go/pkg/mod:/root/go/pkg/mod \ -v /root/.cache/go-build:/root/.cache/go-build \ - -v REP_REAL_PATH/enterprise/src/plugins/taosx/target:REP_DIR/enterprise/src/plugins/taosx/target \ - -v REP_REAL_PATH/community/tools/taosws-rs/target:REP_DIR/community/tools/taosws-rs/target \ - -v REP_REAL_PATH/community/contrib/cJson/:REP_DIR/community/contrib/cJson \ - -v REP_REAL_PATH/community/contrib/googletest/:REP_DIR/community/contrib/googletest \ - -v REP_REAL_PATH/community/contrib/cpp-stub/:REP_DIR/community/contrib/cpp-stub \ - -v REP_REAL_PATH/community/contrib/libuv/:REP_DIR/community/contrib/libuv \ - -v REP_REAL_PATH/community/contrib/lz4/:REP_DIR/community/contrib/lz4 \ - -v REP_REAL_PATH/community/contrib/zlib/:REP_DIR/community/contrib/zlib \ - -v REP_REAL_PATH/community/contrib/jemalloc/:REP_DIR/community/contrib/jemalloc \ + -v ${REP_REAL_PATH}/enterprise/src/plugins/taosx/target:${REP_DIR}/enterprise/src/plugins/taosx/target \ + -v ${REP_REAL_PATH}/community/tools/taosws-rs/target:${REP_DIR}/community/tools/taosws-rs/target \ + -v ${REP_REAL_PATH}/community/contrib/cJson/:${REP_DIR}/community/contrib/cJson \ + -v ${REP_REAL_PATH}/community/contrib/googletest/:${REP_DIR}/community/contrib/googletest \ + -v ${REP_REAL_PATH}/community/contrib/cpp-stub/:${REP_DIR}/community/contrib/cpp-stub \ + -v ${REP_REAL_PATH}/community/contrib/libuv/:${REP_DIR}/community/contrib/libuv \ + -v ${REP_REAL_PATH}/community/contrib/lz4/:${REP_DIR}/community/contrib/lz4 \ + -v ${REP_REAL_PATH}/community/contrib/zlib/:${REP_DIR}/community/contrib/zlib \ + -v ${REP_REAL_PATH}/community/contrib/jemalloc/:${REP_DIR}/community/contrib/jemalloc \ --rm --ulimit core=-1 taos_test:v1.0 sh -c "pip uninstall taospy -y;pip3 install taospy==2.7.2;cd $REP_DIR;rm -rf debug;mkdir -p debug;cd debug;cmake .. -DBUILD_HTTP=false -DBUILD_TOOLS=true -DBUILD_TEST=true -DWEBSOCKET=true -DBUILD_SANITIZER=1 -DTOOLS_SANITIZE=true -DTOOLS_BUILD_TYPE=Debug -DBUILD_TAOSX=true;make -j || exit 1 " mv ${REP_REAL_PATH}/debug ${WORKDIR}/debugSan From d3ab568f7f58e6792d1b07c454f4b24cfc7b0cc9 Mon Sep 17 00:00:00 2001 From: chenhaoran Date: Fri, 3 Mar 2023 00:38:53 +0800 Subject: [PATCH 062/174] ci:cancle "git clean -dx" --- Jenkinsfile2 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile2 b/Jenkinsfile2 index 916437b914..0177c57538 100644 --- a/Jenkinsfile2 +++ b/Jenkinsfile2 @@ -40,7 +40,7 @@ def check_docs() { sh ''' cd ${WKC} git reset --hard - git clean -fxd + git clean -f rm -rf examples/rust/ git remote prune origin git fetch @@ -86,7 +86,7 @@ def pre_test(){ git fetch cd ${WKC} git reset --hard - git clean -fxd + git clean -f rm -rf examples/rust/ git remote prune origin git fetch @@ -201,7 +201,7 @@ def pre_test_win(){ ''' bat ''' cd %WIN_COMMUNITY_ROOT% - git clean -fxd + git clean -f git reset --hard git remote prune origin git fetch From cd9070fff7dc2b84effe2d17d317653e36022519 Mon Sep 17 00:00:00 2001 From: jiacy-jcy <714897623@qq.com> Date: Fri, 3 Mar 2023 08:58:21 +0800 Subject: [PATCH 063/174] =?UTF-8?q?test=EF=BC=9Aupdate=20test=20case=20for?= =?UTF-8?q?=20show=20command?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/system-test/0-others/show.py | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/tests/system-test/0-others/show.py b/tests/system-test/0-others/show.py index f94fd3baad..4952ccb739 100644 --- a/tests/system-test/0-others/show.py +++ b/tests/system-test/0-others/show.py @@ -28,8 +28,9 @@ class TDTestCase: self.perf_param = ['apps','connections','consumers','queries','transactions'] self.perf_param_list = ['apps','connections','consumers','queries','trans'] self.dbname = "db" - self.stbname = f'{self.dbname}.`{tdCom.getLongName(5)}`' - self.tbname = f'{self.dbname}.`{tdCom.getLongName(3)}`' + self.vgroups = 10 + self.stbname = f'`{tdCom.getLongName(5)}`' + self.tbname = f'`{tdCom.getLongName(3)}`' self.db_param = { "database":f"{self.dbname}", "buffer":100, @@ -42,15 +43,13 @@ class TDTestCase: "pagesize":16, "precision":"'ms'", "replica":1, - "retentions":"15s:7d,1m:21d,15m:50d", "wal_level":1, "wal_fsync_period":6000, - "wal_retention_period":1, - "wal_retention_size":1024, "wal_roll_period":0, "wal_segment_size":1024, - "vgroups":10, - "stt_trigger":1 + "vgroups":self.vgroups, + "stt_trigger":1, + "tsdb_pagesize":16 } def ins_check(self): tdSql.prepare() @@ -89,9 +88,10 @@ class TDTestCase: create_sql = 'create' for key,value in sql_dict.items(): create_sql += f' {key} {value}' - + return create_sql def show_create_sql(self): create_db_sql = self.set_create_database_sql(self.db_param) + print(create_db_sql) tdSql.execute(create_db_sql) tdSql.query(f'show create database {self.dbname}') tdSql.checkEqual(self.dbname,tdSql.queryResult[0][0]) @@ -105,7 +105,9 @@ class TDTestCase: continue else: tdLog.exit(f"show create database check failed with {key} {value}") - + tdSql.query('show vnodes 1') + tdSql.checkRows(self.vgroups) + tdSql.execute(f'use {self.dbname}') column_dict = { '`ts`': 'timestamp', @@ -186,10 +188,10 @@ class TDTestCase: tdSql.checkEqual(grants_info,licences_info) def run(self): - self.check_gitinfo() - self.show_base() - self.ins_check() - self.perf_check() + # self.check_gitinfo() + # self.show_base() + # self.ins_check() + # self.perf_check() self.show_create_sql() def stop(self): @@ -198,4 +200,3 @@ class TDTestCase: tdCases.addWindows(__file__, TDTestCase()) tdCases.addLinux(__file__, TDTestCase()) - From b6cc356ccb23ec5f5dff1bd3614a3c8d22885651 Mon Sep 17 00:00:00 2001 From: jiacy-jcy <714897623@qq.com> Date: Fri, 3 Mar 2023 09:24:14 +0800 Subject: [PATCH 064/174] update --- tests/system-test/0-others/show.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/system-test/0-others/show.py b/tests/system-test/0-others/show.py index 4952ccb739..3e176fe251 100644 --- a/tests/system-test/0-others/show.py +++ b/tests/system-test/0-others/show.py @@ -188,10 +188,10 @@ class TDTestCase: tdSql.checkEqual(grants_info,licences_info) def run(self): - # self.check_gitinfo() - # self.show_base() - # self.ins_check() - # self.perf_check() + self.check_gitinfo() + self.show_base() + self.ins_check() + self.perf_check() self.show_create_sql() def stop(self): From e8c11c58f0086377cb44497ff46432f176103867 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Fri, 3 Mar 2023 10:20:52 +0800 Subject: [PATCH 065/174] fix(tq): add some logs. --- source/client/src/clientMain.c | 10 +++++- source/client/src/clientTmq.c | 41 ++++++++++++++--------- source/common/src/tmsg.c | 2 +- source/dnode/mnode/impl/src/mndConsumer.c | 13 +++---- source/dnode/mnode/impl/src/mndTrans.c | 10 +++--- source/dnode/vnode/src/tq/tq.c | 9 +++-- 6 files changed, 56 insertions(+), 29 deletions(-) diff --git a/source/client/src/clientMain.c b/source/client/src/clientMain.c index 4ba51ce50d..5a3986257c 100644 --- a/source/client/src/clientMain.c +++ b/source/client/src/clientMain.c @@ -271,6 +271,8 @@ TAOS_ROW taos_fetch_row(TAOS_RES *res) { SReqResultInfo *pResultInfo; if (msg->resIter == -1) { pResultInfo = tmqGetNextResInfo(res, true); + tscDebug("consumer:0x%" PRIx64 ", vgId:%d, numOfRows:%" PRId64 ", total rows:%" PRId64, msg->rsp.head.consumerId, + msg->vgId, pResultInfo->numOfRows, pResultInfo->totalRows); } else { pResultInfo = tmqGetCurResInfo(res); } @@ -281,7 +283,13 @@ TAOS_ROW taos_fetch_row(TAOS_RES *res) { return pResultInfo->row; } else { pResultInfo = tmqGetNextResInfo(res, true); - if (pResultInfo == NULL) return NULL; + if (pResultInfo == NULL) { + return NULL; + } + + tscDebug("consumer:0x%" PRIx64 " vgId:%d, numOfRows:%" PRId64 ", total rows:%" PRId64, msg->rsp.head.consumerId, + msg->vgId, pResultInfo->numOfRows, pResultInfo->totalRows); + doSetOneRowPtr(pResultInfo); pResultInfo->current += 1; return pResultInfo->row; diff --git a/source/client/src/clientTmq.c b/source/client/src/clientTmq.c index d913b32642..40eccd57dd 100644 --- a/source/client/src/clientTmq.c +++ b/source/client/src/clientTmq.c @@ -192,6 +192,7 @@ typedef struct { SMqClientTopic* pTopic; int32_t vgId; tsem_t rspSem; + uint64_t requestId; // request id for debug purpose } SMqPollCbParam; typedef struct { @@ -1054,7 +1055,7 @@ tmq_t* tmq_consumer_new(tmq_conf_t* conf, char* errstr, int32_t errstrLen) { pTmq->hbLiveTimer = taosTmrStart(tmqSendHbReq, 1000, pRefId, tmqMgmt.timer); } - tscInfo("consumer:0x%" PRIx64 " is setup, consumer groupId %s", pTmq->consumerId, pTmq->groupId); + tscInfo("consumer:0x%" PRIx64 " is setup, groupId:%s", pTmq->consumerId, pTmq->groupId); return pTmq; FAIL: @@ -1224,6 +1225,7 @@ int32_t tmqPollCb(void* param, SDataBuf* pMsg, int32_t code) { atomic_store_8(&tmq->status, TMQ_CONSUMER_STATUS__RECOVER); goto CREATE_MSG_FAIL; } + if (code == TSDB_CODE_TQ_NO_COMMITTED_OFFSET) { SMqPollRspWrapper* pRspWrapper = taosAllocateQitem(sizeof(SMqPollRspWrapper), DEF_QITEM, 0); if (pRspWrapper == NULL) { @@ -1277,10 +1279,9 @@ int32_t tmqPollCb(void* param, SDataBuf* pMsg, int32_t code) { tDecoderClear(&decoder); memcpy(&pRspWrapper->dataRsp, pMsg->pData, sizeof(SMqRspHead)); - tscDebug("consumer:0x%" PRIx64 ", recv poll: vgId:%d, req offset %" PRId64 ", rsp offset %" PRId64 " type %d", + tscDebug("consumer:0x%" PRIx64 " recv poll rsp, vgId:%d, req offset:%" PRId64 ", rsp offset:%" PRId64 " type %d, reqId:0x%"PRIx64, tmq->consumerId, pVg->vgId, pRspWrapper->dataRsp.reqOffset.version, pRspWrapper->dataRsp.rspOffset.version, - rspType); - + rspType, pParam->requestId); } else if (rspType == TMQ_MSG_TYPE__POLL_META_RSP) { SDecoder decoder; tDecoderInit(&decoder, POINTER_SHIFT(pMsg->pData, sizeof(SMqRspHead)), pMsg->len - sizeof(SMqRspHead)); @@ -1298,7 +1299,7 @@ int32_t tmqPollCb(void* param, SDataBuf* pMsg, int32_t code) { taosMemoryFree(pMsg->pData); taosMemoryFree(pMsg->pEpSet); - tscDebug("consumer:0x%" PRIx64 ", put poll res into mqueue %p", tmq->consumerId, pRspWrapper); + tscDebug("consumer:0x%" PRIx64 ", put poll res into mqueue, total in queue:%d", tmq->consumerId, tmq->mqueue->numOfItems); taosWriteQitem(tmq->mqueue, pRspWrapper); tsem_post(&tmq->rspSem); @@ -1344,7 +1345,7 @@ bool tmqUpdateEp(tmq_t* tmq, int32_t epoch, const SMqAskEpRsp* pRsp) { sprintf(vgKey, "%s:%d", pTopicCur->topicName, pVgCur->vgId); char buf[80]; tFormatOffset(buf, 80, &pVgCur->currentOffset); - tscDebug("consumer:0x%" PRIx64 ", epoch %d vgId:%d vgKey is %s, offset is %s", tmq->consumerId, epoch, + tscDebug("consumer:0x%" PRIx64 ", epoch:%d vgId:%d vgKey:%s, offset:%s", tmq->consumerId, epoch, pVgCur->vgId, vgKey, buf); taosHashPut(pHash, vgKey, strlen(vgKey), &pVgCur->currentOffset, sizeof(STqOffsetVal)); } @@ -1552,7 +1553,7 @@ int32_t tmqAskEp(tmq_t* tmq, bool async) { .handle = NULL, }; - sendInfo->requestId = tmq->consumerId; + sendInfo->requestId = generateRequestId(); sendInfo->requestObjRefId = 0; sendInfo->param = pParam; sendInfo->fp = tmqAskEpCb; @@ -1560,7 +1561,7 @@ int32_t tmqAskEp(tmq_t* tmq, bool async) { SEpSet epSet = getEpSet_s(&tmq->pTscObj->pAppInfo->mgmtEp); tscDebug("consumer:0x%" PRIx64 " ask ep from mnode, async:%d, reqId:0x%" PRIx64, tmq->consumerId, async, - tmq->consumerId); + sendInfo->requestId); int64_t transporterId = 0; asyncSendMsgToServer(tmq->pTscObj->pAppInfo->pTransporter, &epSet, &transporterId, sendInfo); @@ -1674,6 +1675,7 @@ static int32_t doTmqPollImpl(tmq_t* pTmq, SMqClientTopic* pTopic, SMqClientVg* p pParam->pVg = pVg; // pVg may be released,fix it pParam->pTopic = pTopic; pParam->vgId = pVg->vgId; + pParam->requestId = req.reqId; SMsgSendInfo* sendInfo = taosMemoryCalloc(1, sizeof(SMsgSendInfo)); if (sendInfo == NULL) { @@ -1698,7 +1700,7 @@ static int32_t doTmqPollImpl(tmq_t* pTmq, SMqClientTopic* pTopic, SMqClientVg* p char offsetFormatBuf[80]; tFormatOffset(offsetFormatBuf, tListLen(offsetFormatBuf), &pVg->currentOffset); - tscDebug("consumer:0x%" PRIx64 " send poll to %s vgId:%d, epoch %d, req offset:%s, reqId:0x%" PRIx64, + tscDebug("consumer:0x%" PRIx64 " send poll to %s vgId:%d, epoch %d, req:%s, reqId:0x%" PRIx64, pTmq->consumerId, pTopic->topicName, pVg->vgId, pTmq->epoch, offsetFormatBuf, req.reqId); asyncSendMsgToServer(pTmq->pTscObj->pAppInfo->pTransporter, &pVg->epSet, &transporterId, sendInfo); @@ -1722,10 +1724,9 @@ int32_t tmqPollImpl(tmq_t* tmq, int64_t timeout) { int32_t vgStatus = atomic_val_compare_exchange_32(&pVg->vgStatus, TMQ_VG_STATUS__IDLE, TMQ_VG_STATUS__WAIT); if (vgStatus == TMQ_VG_STATUS__WAIT) { int32_t vgSkipCnt = atomic_add_fetch_32(&pVg->vgSkipCnt, 1); - tscDebug("consumer:0x%" PRIx64 " epoch %d wait poll-rsp, skip vgId:%d skip cnt %d", tmq->consumerId, tmq->epoch, + tscTrace("consumer:0x%" PRIx64 " epoch %d wait poll-rsp, skip vgId:%d skip cnt %d", tmq->consumerId, tmq->epoch, pVg->vgId, vgSkipCnt); continue; - /*if (vgSkipCnt < 10000) continue;*/ #if 0 if (skipCnt < 30000) { continue; @@ -1767,7 +1768,7 @@ int32_t tmqHandleNoPollRsp(tmq_t* tmq, SMqRspWrapper* rspWrapper, bool* pReset) } void* tmqHandleAllRsp(tmq_t* tmq, int64_t timeout, bool pollIfReset) { - tscDebug("consumer:0x%" PRIx64 " start to handle the rsp", tmq->consumerId); + tscDebug("consumer:0x%" PRIx64 " start to handle the rsp, total:%d", tmq->consumerId, tmq->qall->numOfItems); while (1) { SMqRspWrapper* rspWrapper = NULL; @@ -1785,25 +1786,33 @@ void* tmqHandleAllRsp(tmq_t* tmq, int64_t timeout, bool pollIfReset) { if (rspWrapper->tmqRspType == TMQ_MSG_TYPE__END_RSP) { taosFreeQitem(rspWrapper); terrno = TSDB_CODE_TQ_NO_COMMITTED_OFFSET; + tscError("consumer:0x%" PRIx64 " unexpected rsp from poll, code:%s", tmq->consumerId, tstrerror(terrno)); return NULL; } else if (rspWrapper->tmqRspType == TMQ_MSG_TYPE__POLL_RSP) { SMqPollRspWrapper* pollRspWrapper = (SMqPollRspWrapper*)rspWrapper; - tscDebug("consumer:0x%" PRIx64 " process poll rsp", tmq->consumerId); + /*atomic_sub_fetch_32(&tmq->readyRequest, 1);*/ int32_t consumerEpoch = atomic_load_32(&tmq->epoch); if (pollRspWrapper->dataRsp.head.epoch == consumerEpoch) { SMqClientVg* pVg = pollRspWrapper->vgHandle; - /*printf("vgId:%d, offset %" PRId64 " up to %" PRId64 "\n", pVg->vgId, pVg->currentOffset, - * rspMsg->msg.rspOffset);*/ pVg->currentOffset = pollRspWrapper->dataRsp.rspOffset; atomic_store_32(&pVg->vgStatus, TMQ_VG_STATUS__IDLE); + if (pollRspWrapper->dataRsp.blockNum == 0) { + tscDebug("consumer:0x%" PRIx64 " empty block received in poll rsp", tmq->consumerId); + taosFreeQitem(pollRspWrapper); rspWrapper = NULL; continue; } + // build rsp + char buf[80]; + tFormatOffset(buf, 80, &pVg->currentOffset); SMqRspObj* pRsp = tmqBuildRspFromWrapper(pollRspWrapper); + tscDebug("consumer:0x%" PRIx64 " process poll rsp, vgId:%d, offset:%s, blocks:%d", tmq->consumerId, + pVg->vgId, buf, pollRspWrapper->dataRsp.blockNum); + taosFreeQitem(pollRspWrapper); return pRsp; } else { @@ -1876,6 +1885,8 @@ void* tmqHandleAllRsp(tmq_t* tmq, int64_t timeout, bool pollIfReset) { } } } + + tscDebug("consumer:0x%" PRIx64 " handle the rsp completed", tmq->consumerId); } TAOS_RES* tmq_consumer_poll(tmq_t* tmq, int64_t timeout) { diff --git a/source/common/src/tmsg.c b/source/common/src/tmsg.c index e180959d1e..b9b5f3f5dd 100644 --- a/source/common/src/tmsg.c +++ b/source/common/src/tmsg.c @@ -6570,7 +6570,7 @@ int32_t tFormatOffset(char *buf, int32_t maxLen, const STqOffsetVal *pVal) { } else if (pVal->type == TMQ_OFFSET__LOG) { snprintf(buf, maxLen, "offset(log) ver:%" PRId64, pVal->version); } else if (pVal->type == TMQ_OFFSET__SNAPSHOT_DATA || pVal->type == TMQ_OFFSET__SNAPSHOT_META) { - snprintf(buf, maxLen, "offset(ss data) uid:%" PRId64 ", ts:%" PRId64, pVal->uid, pVal->ts); + snprintf(buf, maxLen, "offset(snapshot) uid:%" PRId64 " ts:%" PRId64, pVal->uid, pVal->ts); } else { ASSERT(0); } diff --git a/source/dnode/mnode/impl/src/mndConsumer.c b/source/dnode/mnode/impl/src/mndConsumer.c index 280f3b0ecc..1b86c28a67 100644 --- a/source/dnode/mnode/impl/src/mndConsumer.c +++ b/source/dnode/mnode/impl/src/mndConsumer.c @@ -29,7 +29,7 @@ #define MND_CONSUMER_LOST_HB_CNT 3 #define MND_CONSUMER_LOST_CLEAR_THRESHOLD 43200 -static int8_t mqRebInExecCnt = 0; +static int32_t mqRebInExecCnt = 0; static const char *mndConsumerStatusName(int status); @@ -76,15 +76,16 @@ int32_t mndInitConsumer(SMnode *pMnode) { void mndCleanupConsumer(SMnode *pMnode) {} bool mndRebTryStart() { - int8_t old = atomic_val_compare_exchange_8(&mqRebInExecCnt, 0, 1); + int32_t old = atomic_val_compare_exchange_32(&mqRebInExecCnt, 0, 1); + mInfo("tq timer, rebalance counter old val:%d", old); return old == 0; } -void mndRebEnd() { atomic_sub_fetch_8(&mqRebInExecCnt, 1); } +void mndRebEnd() { int32_t val = atomic_sub_fetch_32(&mqRebInExecCnt, 1); mInfo("rebalance end, rebalance counter:%d", val); } -void mndRebCntInc() { atomic_add_fetch_8(&mqRebInExecCnt, 1); } +void mndRebCntInc() { int32_t val = atomic_add_fetch_32(&mqRebInExecCnt, 1); mInfo("rebalance trans start, rebalance count:%d", val);} -void mndRebCntDec() { atomic_sub_fetch_8(&mqRebInExecCnt, 1); } +void mndRebCntDec() { int32_t val = atomic_sub_fetch_32(&mqRebInExecCnt, 1); mInfo("rebalance trans end, rebalance count:%d", val); } static int32_t mndProcessConsumerLostMsg(SRpcMsg *pMsg) { SMnode *pMnode = pMsg->info.node; @@ -334,7 +335,7 @@ static int32_t mndProcessMqTimerMsg(SRpcMsg *pMsg) { } else { taosHashCleanup(pRebMsg->rebSubHash); rpcFreeCont(pRebMsg); - mTrace("mq rebalance finished, no modification"); + mInfo("mq rebalance finished, no modification"); mndRebEnd(); } return 0; diff --git a/source/dnode/mnode/impl/src/mndTrans.c b/source/dnode/mnode/impl/src/mndTrans.c index 55e9faf020..7721dda576 100644 --- a/source/dnode/mnode/impl/src/mndTrans.c +++ b/source/dnode/mnode/impl/src/mndTrans.c @@ -503,7 +503,8 @@ static TransCbFp mndTransGetCbFp(ETrnFunc ftype) { } static int32_t mndTransActionInsert(SSdb *pSdb, STrans *pTrans) { - mTrace("trans:%d, perform insert action, row:%p stage:%s", pTrans->id, pTrans, mndTransStr(pTrans->stage)); + mInfo("trans:%d, perform insert action, row:%p stage:%s, startFunc:%d, callfunc:1", pTrans->id, pTrans, mndTransStr(pTrans->stage), + pTrans->startFunc); if (pTrans->startFunc > 0) { TransCbFp fp = mndTransGetCbFp(pTrans->startFunc); @@ -546,8 +547,9 @@ static void mndTransDropData(STrans *pTrans) { } static int32_t mndTransActionDelete(SSdb *pSdb, STrans *pTrans, bool callFunc) { - mTrace("trans:%d, perform delete action, row:%p stage:%s callfunc:%d", pTrans->id, pTrans, mndTransStr(pTrans->stage), - callFunc); + mInfo("trans:%d, perform delete action, row:%p stage:%s callfunc:%d, stopFunc:%d", pTrans->id, pTrans, mndTransStr(pTrans->stage), + pTrans->stopFunc, callFunc); + if (pTrans->stopFunc > 0 && callFunc) { TransCbFp fp = mndTransGetCbFp(pTrans->stopFunc); if (fp) { @@ -572,7 +574,7 @@ static void mndTransUpdateActions(SArray *pOldArray, SArray *pNewArray) { } static int32_t mndTransActionUpdate(SSdb *pSdb, STrans *pOld, STrans *pNew) { - mTrace("trans:%d, perform update action, old row:%p stage:%s create:%" PRId64 ", new row:%p stage:%s create:%" PRId64, + mInfo("trans:%d, perform update action, old row:%p stage:%s create:%" PRId64 ", new row:%p stage:%s create:%" PRId64, pOld->id, pOld, mndTransStr(pOld->stage), pOld->createdTime, pNew, mndTransStr(pNew->stage), pNew->createdTime); diff --git a/source/dnode/vnode/src/tq/tq.c b/source/dnode/vnode/src/tq/tq.c index d07933c9f1..4d21a2e7f3 100644 --- a/source/dnode/vnode/src/tq/tq.c +++ b/source/dnode/vnode/src/tq/tq.c @@ -488,7 +488,7 @@ int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg) { // 2. check rebalance if (pHandle->consumerId != consumerId) { - tqError("tmq poll: consumer:0x%" PRIx64 " vgId:%d, subkey %s, mismatch for saved handle consumer:0x%" PRIx64, + tqDebug("ERROR tmq poll: consumer:0x%" PRIx64 " vgId:%d, subkey %s, mismatch for saved handle consumer:0x%" PRIx64, consumerId, TD_VID(pTq->pVnode), req.subKey, pHandle->consumerId); terrno = TSDB_CODE_TMQ_CONSUMER_MISMATCH; return -1; @@ -822,6 +822,7 @@ int32_t tqProcessSubscribeReq(STQ* pTq, int64_t sversion, char* msg, int32_t msg pHandle = &tqHandle; /*taosInitRWLatch(&pExec->lock);*/ + uint64_t oldConsumerId = pHandle->consumerId; memcpy(pHandle->subKey, req.subKey, TSDB_SUBSCRIBE_KEY_LEN); pHandle->consumerId = req.newConsumerId; pHandle->epoch = -1; @@ -884,13 +885,16 @@ int32_t tqProcessSubscribeReq(STQ* pTq, int64_t sversion, char* msg, int32_t msg (SSnapContext**)(&handle.sContext)); pHandle->execHandle.task = qCreateQueueExecTaskInfo(NULL, &handle, NULL, NULL); } + taosHashPut(pTq->pHandle, req.subKey, strlen(req.subKey), pHandle, sizeof(STqHandle)); - tqDebug("try to persist handle %s consumer:0x%" PRIx64, req.subKey, pHandle->consumerId); + tqDebug("try to persist handle %s consumer:0x%" PRIx64" , old consumer:0x%"PRIx64, req.subKey, pHandle->consumerId, + oldConsumerId); if (tqMetaSaveHandle(pTq, req.subKey, pHandle) < 0) { return -1; } } else { // TODO handle qmsg and exec modification + tqInfo("update the consumer info, old consumer id:0x%"PRIx64", new Id:0x%"PRIx64, pHandle->consumerId, req.newConsumerId); atomic_store_32(&pHandle->epoch, -1); atomic_store_64(&pHandle->consumerId, req.newConsumerId); atomic_add_fetch_32(&pHandle->epoch, 1); @@ -898,6 +902,7 @@ int32_t tqProcessSubscribeReq(STQ* pTq, int64_t sversion, char* msg, int32_t msg if (pHandle->execHandle.subType == TOPIC_SUB_TYPE__COLUMN) { qStreamCloseTsdbReader(pHandle->execHandle.task); } + if (tqMetaSaveHandle(pTq, req.subKey, pHandle) < 0) { return -1; } From b26b1aa8fd459a5f9e858b3373852ed2d88750be Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Fri, 3 Mar 2023 10:30:23 +0800 Subject: [PATCH 066/174] fix: minor changes --- source/dnode/mnode/impl/src/mndTrans.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/dnode/mnode/impl/src/mndTrans.c b/source/dnode/mnode/impl/src/mndTrans.c index 7721dda576..05368d3445 100644 --- a/source/dnode/mnode/impl/src/mndTrans.c +++ b/source/dnode/mnode/impl/src/mndTrans.c @@ -503,7 +503,7 @@ static TransCbFp mndTransGetCbFp(ETrnFunc ftype) { } static int32_t mndTransActionInsert(SSdb *pSdb, STrans *pTrans) { - mInfo("trans:%d, perform insert action, row:%p stage:%s, startFunc:%d, callfunc:1", pTrans->id, pTrans, mndTransStr(pTrans->stage), + mInfo("trans:%d, perform insert action, row:%p stage:%s, callfunc:1, startFunc:%d", pTrans->id, pTrans, mndTransStr(pTrans->stage), pTrans->startFunc); if (pTrans->startFunc > 0) { @@ -547,8 +547,8 @@ static void mndTransDropData(STrans *pTrans) { } static int32_t mndTransActionDelete(SSdb *pSdb, STrans *pTrans, bool callFunc) { - mInfo("trans:%d, perform delete action, row:%p stage:%s callfunc:%d, stopFunc:%d", pTrans->id, pTrans, mndTransStr(pTrans->stage), - pTrans->stopFunc, callFunc); + mInfo("trans:%d, perform delete action, row:%p stage:%s callfunc:%d, stopFunc:%d", pTrans->id, pTrans, + mndTransStr(pTrans->stage), callFunc, pTrans->stopFunc); if (pTrans->stopFunc > 0 && callFunc) { TransCbFp fp = mndTransGetCbFp(pTrans->stopFunc); From f30496d958e1bbe2ce35210cd0409776026b435a Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Fri, 3 Mar 2023 10:30:45 +0800 Subject: [PATCH 067/174] refactor: update the consumerid --- source/dnode/mnode/impl/src/mndSubscribe.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/dnode/mnode/impl/src/mndSubscribe.c b/source/dnode/mnode/impl/src/mndSubscribe.c index 8544994c3e..bcddde52f7 100644 --- a/source/dnode/mnode/impl/src/mndSubscribe.c +++ b/source/dnode/mnode/impl/src/mndSubscribe.c @@ -427,10 +427,10 @@ static int32_t mndDoRebalance(SMnode *pMnode, const SMqRebInputObj *pInput, SMqR if (pIter == NULL) break; SMqConsumerEp *pConsumerEp = (SMqConsumerEp *)pIter; int32_t sz = taosArrayGetSize(pConsumerEp->vgs); - mInfo("sub:%s mq re-balance final cfg: consumer:0x%" PRId64 " has %d vg", sub, pConsumerEp->consumerId, sz); + mInfo("sub:%s mq re-balance final cfg: consumer:0x%" PRIx64 " has %d vg", sub, pConsumerEp->consumerId, sz); for (int32_t i = 0; i < sz; i++) { SMqVgEp *pVgEp = taosArrayGetP(pConsumerEp->vgs, i); - mInfo("sub:%s mq re-balance final cfg: vg %d to consumer:0x%" PRId64, sub, pVgEp->vgId, + mInfo("sub:%s mq re-balance final cfg: vg %d to consumer:0x%" PRIx64, sub, pVgEp->vgId, pConsumerEp->consumerId); } } From 8ffc397cf2682d98cef9b5bfae592d3472cda9b7 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Fri, 3 Mar 2023 10:35:13 +0800 Subject: [PATCH 068/174] fix: minor changes --- source/dnode/mnode/impl/src/mndSubscribe.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/source/dnode/mnode/impl/src/mndSubscribe.c b/source/dnode/mnode/impl/src/mndSubscribe.c index 8544994c3e..fcd68d9001 100644 --- a/source/dnode/mnode/impl/src/mndSubscribe.c +++ b/source/dnode/mnode/impl/src/mndSubscribe.c @@ -224,7 +224,7 @@ static int32_t mndDoRebalance(SMnode *pMnode, const SMqRebInputObj *pInput, SMqR .pVgEp = pVgEp, }; taosHashPut(pHash, &pVgEp->vgId, sizeof(int32_t), &outputVg, sizeof(SMqRebOutputVg)); - mInfo("sub:%s mq re-balance remove vgId:%d from consumer:%" PRId64, sub, pVgEp->vgId, consumerId); + mInfo("sub:%s mq re-balance remove vgId:%d from consumer:%" PRIx64, sub, pVgEp->vgId, consumerId); } taosArrayDestroy(pConsumerEp->vgs); taosHashRemove(pOutput->pSub->consumerHash, &consumerId, sizeof(int64_t)); @@ -296,7 +296,7 @@ static int32_t mndDoRebalance(SMnode *pMnode, const SMqRebInputObj *pInput, SMqR .pVgEp = pVgEp, }; taosHashPut(pHash, &pVgEp->vgId, sizeof(int32_t), &outputVg, sizeof(SMqRebOutputVg)); - mInfo("sub:%s mq rebalance remove vgId:%d from consumer:%" PRId64 ",(first scan)", sub, pVgEp->vgId, + mInfo("sub:%s mq rebalance remove vgId:%d from consumer:%" PRIx64 ",(first scan)", sub, pVgEp->vgId, pConsumerEp->consumerId); } imbCnt++; @@ -311,7 +311,7 @@ static int32_t mndDoRebalance(SMnode *pMnode, const SMqRebInputObj *pInput, SMqR .pVgEp = pVgEp, }; taosHashPut(pHash, &pVgEp->vgId, sizeof(int32_t), &outputVg, sizeof(SMqRebOutputVg)); - mInfo("sub:%s mq rebalance remove vgId:%d from consumer:%" PRId64 ",(first scan)", sub, pVgEp->vgId, + mInfo("sub:%s mq rebalance remove vgId:%d from consumer:%" PRIx64 ",(first scan)", sub, pVgEp->vgId, pConsumerEp->consumerId); } } @@ -329,7 +329,7 @@ static int32_t mndDoRebalance(SMnode *pMnode, const SMqRebInputObj *pInput, SMqR newConsumerEp.vgs = taosArrayInit(0, sizeof(void *)); taosHashPut(pOutput->pSub->consumerHash, &consumerId, sizeof(int64_t), &newConsumerEp, sizeof(SMqConsumerEp)); taosArrayPush(pOutput->newConsumers, &consumerId); - mInfo("sub:%s mq rebalance add new consumer:%" PRId64, sub, consumerId); + mInfo("sub:%s mq rebalance add new consumer:%" PRIx64, sub, consumerId); } } @@ -357,7 +357,7 @@ static int32_t mndDoRebalance(SMnode *pMnode, const SMqRebInputObj *pInput, SMqR taosArrayPush(pConsumerEp->vgs, &pRebVg->pVgEp); pRebVg->newConsumerId = pConsumerEp->consumerId; taosArrayPush(pOutput->rebVgs, pRebVg); - mInfo("mq rebalance: add vgId:%d to consumer:%" PRId64 " (second scan) (not enough)", pRebVg->pVgEp->vgId, + mInfo("mq rebalance: add vgId:%d to consumer:%" PRIx64 " (second scan) (not enough)", pRebVg->pVgEp->vgId, pConsumerEp->consumerId); } } @@ -387,12 +387,12 @@ static int32_t mndDoRebalance(SMnode *pMnode, const SMqRebInputObj *pInput, SMqR taosArrayPush(pConsumerEp->vgs, &pRebVg->pVgEp); pRebVg->newConsumerId = pConsumerEp->consumerId; if (pRebVg->newConsumerId == pRebVg->oldConsumerId) { - mInfo("mq rebalance: skip vg %d for same consumer:%" PRId64 " (second scan)", pRebVg->pVgEp->vgId, + mInfo("mq rebalance: skip vg %d for same consumer:%" PRIx64 " (second scan)", pRebVg->pVgEp->vgId, pConsumerEp->consumerId); continue; } taosArrayPush(pOutput->rebVgs, pRebVg); - mInfo("mq rebalance: add vgId:%d to consumer:%" PRId64 " (second scan) (unassigned)", pRebVg->pVgEp->vgId, + mInfo("mq rebalance: add vgId:%d to consumer:%" PRIx64 " (second scan) (unassigned)", pRebVg->pVgEp->vgId, pConsumerEp->consumerId); } } else { @@ -427,10 +427,10 @@ static int32_t mndDoRebalance(SMnode *pMnode, const SMqRebInputObj *pInput, SMqR if (pIter == NULL) break; SMqConsumerEp *pConsumerEp = (SMqConsumerEp *)pIter; int32_t sz = taosArrayGetSize(pConsumerEp->vgs); - mInfo("sub:%s mq re-balance final cfg: consumer:0x%" PRId64 " has %d vg", sub, pConsumerEp->consumerId, sz); + mInfo("sub:%s mq re-balance final cfg: consumer:0x%" PRIx64 " has %d vg", sub, pConsumerEp->consumerId, sz); for (int32_t i = 0; i < sz; i++) { SMqVgEp *pVgEp = taosArrayGetP(pConsumerEp->vgs, i); - mInfo("sub:%s mq re-balance final cfg: vg %d to consumer:0x%" PRId64, sub, pVgEp->vgId, + mInfo("sub:%s mq re-balance final cfg: vg %d to consumer:0x%" PRIx64, sub, pVgEp->vgId, pConsumerEp->consumerId); } } @@ -1017,7 +1017,7 @@ int32_t mndRetrieveSubscribe(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); colDataSetVal(pColInfo, numOfRows, (const char *)&pConsumerEp->consumerId, false); - mDebug("mnd show subscriptions: topic %s, consumer %" PRId64 " cgroup %s vgid %d", varDataVal(topic), + mDebug("mnd show subscriptions: topic %s, consumer:%" PRIx64 " cgroup %s vgid %d", varDataVal(topic), pConsumerEp->consumerId, varDataVal(cgroup), pVgEp->vgId); // offset From f7a20af53840fcee8deed3408b8ccb84f54e522e Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Fri, 3 Mar 2023 11:47:08 +0800 Subject: [PATCH 069/174] fix: taosc crash caused of ordering by string --- source/libs/parser/src/parTranslater.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index 69d48a99d7..cdc5dad8ec 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -2797,6 +2797,10 @@ static int32_t translateOrderBy(STranslateContext* pCxt, SSelectStmt* pSelect) { bool other; int32_t code = translateOrderByPosition(pCxt, pSelect->pProjectionList, pSelect->pOrderByList, &other); if (TSDB_CODE_SUCCESS == code) { + if (0 == LIST_LENGTH(pSelect->pOrderByList)) { + NODES_DESTORY_LIST(pSelect->pOrderByList); + return TSDB_CODE_SUCCESS; + } if (!other) { return TSDB_CODE_SUCCESS; } From dd493d3ee4c939748ca57cabb80e619e29a7d1eb Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Fri, 3 Mar 2023 11:54:25 +0800 Subject: [PATCH 070/174] fix: add order by string case --- tests/system-test/2-query/projectionDesc.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/system-test/2-query/projectionDesc.py b/tests/system-test/2-query/projectionDesc.py index 6bb9aff4f3..1edceaa6f2 100644 --- a/tests/system-test/2-query/projectionDesc.py +++ b/tests/system-test/2-query/projectionDesc.py @@ -38,6 +38,7 @@ class TDTestCase: #tdSql.checkData(0,0,1537146000000) tdSql.checkData(0,1,10) + tdSql.query(f"select * from {dbname}.stb_1 order by 'aaa' desc") def stop(self): tdSql.close() From dfeb3fb458a2dd0275251b79f99c17d8fbc15655 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Fri, 3 Mar 2023 13:45:04 +0800 Subject: [PATCH 071/174] refactor: update some logs. --- source/dnode/mnode/impl/src/mndConsumer.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/source/dnode/mnode/impl/src/mndConsumer.c b/source/dnode/mnode/impl/src/mndConsumer.c index 1b86c28a67..2b5956f6a6 100644 --- a/source/dnode/mnode/impl/src/mndConsumer.c +++ b/source/dnode/mnode/impl/src/mndConsumer.c @@ -944,8 +944,9 @@ static int32_t mndConsumerActionUpdate(SSdb *pSdb, SMqConsumerObj *pOldConsumer, pOldConsumer->rebalanceTime = pNewConsumer->upTime; atomic_add_fetch_32(&pOldConsumer->epoch, 1); - mDebug("consumer:0x%" PRIx64 " state %s -> %s, new epoch:%d, reb-time:%" PRId64 ", current topics:%d", - pOldConsumer->consumerId, mndConsumerStatusName(status), mndConsumerStatusName(pOldConsumer->status), + mDebug("consumer:0x%" PRIx64 " state (%d)%s -> (%d)%s, new epoch:%d, reb-time:%" PRId64 ", current topics:%d", + pOldConsumer->consumerId, status, mndConsumerStatusName(status), pOldConsumer->status, + mndConsumerStatusName(pOldConsumer->status), pOldConsumer->epoch, pOldConsumer->rebalanceTime, (int)taosArrayGetSize(pOldConsumer->currentTopics)); } else if (pNewConsumer->updateType == CONSUMER_UPDATE__REMOVE) { /*A(taosArrayGetSize(pNewConsumer->rebNewTopics) == 0);*/ @@ -1003,8 +1004,9 @@ static int32_t mndConsumerActionUpdate(SSdb *pSdb, SMqConsumerObj *pOldConsumer, pOldConsumer->rebalanceTime = pNewConsumer->upTime; atomic_add_fetch_32(&pOldConsumer->epoch, 1); - mDebug("consumer:0x%" PRIx64 " state %s -> %s, new epoch:%d, reb-time:%" PRId64 ", current topics:%d", - pOldConsumer->consumerId, mndConsumerStatusName(status), mndConsumerStatusName(pOldConsumer->status), + mDebug("consumer:0x%" PRIx64 " state %d(%s) -> %d(%s), new epoch:%d, reb-time:%" PRId64 ", current topics:%d", + pOldConsumer->consumerId, status, mndConsumerStatusName(status), pOldConsumer->status, + mndConsumerStatusName(pOldConsumer->status), pOldConsumer->epoch, pOldConsumer->rebalanceTime, (int)taosArrayGetSize(pOldConsumer->currentTopics)); } From cf9c2a112f4715022b9a79a61ec7e461b4ae2a2b Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Fri, 3 Mar 2023 15:20:07 +0800 Subject: [PATCH 072/174] fix: the number of output lines is incorrect when the event window is used with the multiline function --- source/libs/executor/src/eventwindowoperator.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/libs/executor/src/eventwindowoperator.c b/source/libs/executor/src/eventwindowoperator.c index 49e2d5bc4a..559fce5224 100644 --- a/source/libs/executor/src/eventwindowoperator.c +++ b/source/libs/executor/src/eventwindowoperator.c @@ -29,7 +29,7 @@ typedef struct SEventWindowOperatorInfo { SWindowRowsSup winSup; int32_t tsSlotId; // primary timestamp column slot id STimeWindowAggSupp twAggSup; - uint64_t groupId; // current group id, used to identify the data block from different groups + uint64_t groupId; // current group id, used to identify the data block from different groups SFilterInfo* pStartCondInfo; SFilterInfo* pEndCondInfo; bool inWindow; @@ -310,6 +310,7 @@ int32_t eventWindowAggImpl(SOperatorInfo* pOperator, SEventWindowOperatorInfo* p pSup->rowEntryInfoOffset, pTaskInfo); pRes->info.rows += pInfo->pRow->numOfRows; + pInfo->pRow->numOfRows = 0; pInfo->inWindow = false; rowIndex += 1; From 9305b0efd0499093c6dfb91ed0623ed2f0d2bda9 Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Fri, 3 Mar 2023 16:57:13 +0800 Subject: [PATCH 073/174] fix: create stream syntax check --- include/libs/nodes/cmdnodes.h | 23 ++++++++--- source/libs/parser/inc/parAst.h | 2 + source/libs/parser/inc/sql.y | 16 ++++---- source/libs/parser/src/parAstCreater.c | 53 ++++++++++++++++++++++++++ source/libs/parser/src/parTranslater.c | 28 +++++++------- source/libs/parser/src/sql.c | 25 ++++++------ 6 files changed, 108 insertions(+), 39 deletions(-) diff --git a/include/libs/nodes/cmdnodes.h b/include/libs/nodes/cmdnodes.h index a0fc8d1238..736ee7da05 100644 --- a/include/libs/nodes/cmdnodes.h +++ b/include/libs/nodes/cmdnodes.h @@ -41,14 +41,15 @@ extern "C" { #define SHOW_LOCAL_VARIABLES_RESULT_FIELD2_LEN (TSDB_CONFIG_VALUE_LEN + VARSTR_HEADER_SIZE) #define SHOW_ALIVE_RESULT_COLS 1 -#define PRIVILEGE_TYPE_MASK(n) (1 << n) -#define PRIVILEGE_TYPE_ALL PRIVILEGE_TYPE_MASK(0) -#define PRIVILEGE_TYPE_READ PRIVILEGE_TYPE_MASK(1) -#define PRIVILEGE_TYPE_WRITE PRIVILEGE_TYPE_MASK(2) -#define PRIVILEGE_TYPE_SUBSCRIBE PRIVILEGE_TYPE_MASK(3) +#define BIT_FLAG_MASK(n) (1 << n) +#define BIT_FLAG_SET_MASK(val, mask) ((val) |= (mask)) +#define BIT_FLAG_TEST_MASK(val, mask) (((val) & (mask)) != 0) -#define PRIVILEGE_TYPE_TEST_MASK(val, mask) (((val) & (mask)) != 0) +#define PRIVILEGE_TYPE_ALL BIT_FLAG_MASK(0) +#define PRIVILEGE_TYPE_READ BIT_FLAG_MASK(1) +#define PRIVILEGE_TYPE_WRITE BIT_FLAG_MASK(2) +#define PRIVILEGE_TYPE_SUBSCRIBE BIT_FLAG_MASK(3) typedef struct SDatabaseOptions { ENodeType type; @@ -393,6 +394,15 @@ typedef struct SKillQueryStmt { char queryId[TSDB_QUERY_ID_LEN]; } SKillQueryStmt; +typedef enum EStreamOptionsSetFlag { + SOPT_TRIGGER_TYPE_SET = BIT_FLAG_MASK(0), + SOPT_WATERMARK_SET = BIT_FLAG_MASK(1), + SOPT_DELETE_MARK_SET = BIT_FLAG_MASK(2), + SOPT_FILL_HISTORY_SET = BIT_FLAG_MASK(3), + SOPT_IGNORE_EXPIRED_SET = BIT_FLAG_MASK(4), + SOPT_IGNORE_UPDATE_SET = BIT_FLAG_MASK(5), +} EStreamOptionsSetFlag; + typedef struct SStreamOptions { ENodeType type; int8_t triggerType; @@ -402,6 +412,7 @@ typedef struct SStreamOptions { int8_t fillHistory; int8_t ignoreExpired; int8_t ignoreUpdate; + int64_t setFlag; } SStreamOptions; typedef struct SCreateStreamStmt { diff --git a/source/libs/parser/inc/parAst.h b/source/libs/parser/inc/parAst.h index 3b309db1db..4b9fa7aa42 100644 --- a/source/libs/parser/inc/parAst.h +++ b/source/libs/parser/inc/parAst.h @@ -215,6 +215,8 @@ SNode* createCreateFunctionStmt(SAstCreateContext* pCxt, bool ignoreExists, bool const SToken* pLibPath, SDataType dataType, int32_t bufSize); SNode* createDropFunctionStmt(SAstCreateContext* pCxt, bool ignoreNotExists, const SToken* pFuncName); SNode* createStreamOptions(SAstCreateContext* pCxt); +SNode* setStreamOptions(SAstCreateContext* pCxt, SNode* pOptions, EStreamOptionsSetFlag setflag, SToken* pToken, + SNode* pNode); SNode* createCreateStreamStmt(SAstCreateContext* pCxt, bool ignoreExists, SToken* pStreamName, SNode* pRealTable, SNode* pOptions, SNodeList* pTags, SNode* pSubtable, SNode* pQuery, SNodeList* pCols); SNode* createDropStreamStmt(SAstCreateContext* pCxt, bool ignoreNotExists, SToken* pStreamName); diff --git a/source/libs/parser/inc/sql.y b/source/libs/parser/inc/sql.y index fb6d3bfdd9..b2f85eb677 100644 --- a/source/libs/parser/inc/sql.y +++ b/source/libs/parser/inc/sql.y @@ -562,14 +562,14 @@ tag_def_or_ref_opt(A) ::= tags_def(B). tag_def_or_ref_opt(A) ::= TAGS NK_LP col_name_list(B) NK_RP. { A = B; } stream_options(A) ::= . { A = createStreamOptions(pCxt); } -stream_options(A) ::= stream_options(B) TRIGGER AT_ONCE. { ((SStreamOptions*)B)->triggerType = STREAM_TRIGGER_AT_ONCE; A = B; } -stream_options(A) ::= stream_options(B) TRIGGER WINDOW_CLOSE. { ((SStreamOptions*)B)->triggerType = STREAM_TRIGGER_WINDOW_CLOSE; A = B; } -stream_options(A) ::= stream_options(B) TRIGGER MAX_DELAY duration_literal(C). { ((SStreamOptions*)B)->triggerType = STREAM_TRIGGER_MAX_DELAY; ((SStreamOptions*)B)->pDelay = releaseRawExprNode(pCxt, C); A = B; } -stream_options(A) ::= stream_options(B) WATERMARK duration_literal(C). { ((SStreamOptions*)B)->pWatermark = releaseRawExprNode(pCxt, C); A = B; } -stream_options(A) ::= stream_options(B) IGNORE EXPIRED NK_INTEGER(C). { ((SStreamOptions*)B)->ignoreExpired = taosStr2Int8(C.z, NULL, 10); A = B; } -stream_options(A) ::= stream_options(B) FILL_HISTORY NK_INTEGER(C). { ((SStreamOptions*)B)->fillHistory = taosStr2Int8(C.z, NULL, 10); A = B; } -stream_options(A) ::= stream_options(B) DELETE_MARK duration_literal(C). { ((SStreamOptions*)B)->pDeleteMark = releaseRawExprNode(pCxt, C); A = B; } -stream_options(A) ::= stream_options(B) IGNORE UPDATE NK_INTEGER(C). { ((SStreamOptions*)B)->ignoreUpdate = taosStr2Int8(C.z, NULL, 10); A = B; } +stream_options(A) ::= stream_options(B) TRIGGER AT_ONCE(C). { A = setStreamOptions(pCxt, B, SOPT_TRIGGER_TYPE_SET, &C, NULL); } +stream_options(A) ::= stream_options(B) TRIGGER WINDOW_CLOSE(C). { A = setStreamOptions(pCxt, B, SOPT_TRIGGER_TYPE_SET, &C, NULL); } +stream_options(A) ::= stream_options(B) TRIGGER MAX_DELAY(C) duration_literal(D). { A = setStreamOptions(pCxt, B, SOPT_TRIGGER_TYPE_SET, &C, D); } +stream_options(A) ::= stream_options(B) WATERMARK duration_literal(C). { A = setStreamOptions(pCxt, B, SOPT_WATERMARK_SET, NULL, releaseRawExprNode(pCxt, C)); } +stream_options(A) ::= stream_options(B) IGNORE EXPIRED NK_INTEGER(C). { A = setStreamOptions(pCxt, B, SOPT_IGNORE_EXPIRED_SET, &C, NULL); } +stream_options(A) ::= stream_options(B) FILL_HISTORY NK_INTEGER(C). { A = setStreamOptions(pCxt, B, SOPT_FILL_HISTORY_SET, &C, NULL); } +stream_options(A) ::= stream_options(B) DELETE_MARK duration_literal(C). { A = setStreamOptions(pCxt, B, SOPT_DELETE_MARK_SET, NULL, releaseRawExprNode(pCxt, C)); } +stream_options(A) ::= stream_options(B) IGNORE UPDATE NK_INTEGER(C). { A = setStreamOptions(pCxt, B, SOPT_IGNORE_UPDATE_SET, &C, NULL); } subtable_opt(A) ::= . { A = NULL; } subtable_opt(A) ::= SUBTABLE NK_LP expression(B) NK_RP. { A = releaseRawExprNode(pCxt, B); } diff --git a/source/libs/parser/src/parAstCreater.c b/source/libs/parser/src/parAstCreater.c index 634a239399..469132613d 100644 --- a/source/libs/parser/src/parAstCreater.c +++ b/source/libs/parser/src/parAstCreater.c @@ -1817,6 +1817,59 @@ SNode* createStreamOptions(SAstCreateContext* pCxt) { return (SNode*)pOptions; } +static int8_t getTriggerType(uint32_t tokenType) { + switch (tokenType) { + case TK_AT_ONCE: + return STREAM_TRIGGER_AT_ONCE; + case TK_WINDOW_CLOSE: + return STREAM_TRIGGER_WINDOW_CLOSE; + case TK_MAX_DELAY: + return STREAM_TRIGGER_MAX_DELAY; + default: + break; + } + return STREAM_TRIGGER_WINDOW_CLOSE; +} + +SNode* setStreamOptions(SAstCreateContext* pCxt, SNode* pOptions, EStreamOptionsSetFlag setflag, SToken* pToken, + SNode* pNode) { + SStreamOptions* pStreamOptions = (SStreamOptions*)pOptions; + if (BIT_FLAG_TEST_MASK(setflag, pStreamOptions->setFlag)) { + pCxt->errCode = + generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_SYNTAX_ERROR, "stream options each item is only set once"); + return pOptions; + } + + switch (setflag) { + case SOPT_TRIGGER_TYPE_SET: + pStreamOptions->triggerType = getTriggerType(pToken->type); + if (STREAM_TRIGGER_MAX_DELAY == pStreamOptions->triggerType) { + pStreamOptions->pDelay = pNode; + } + break; + case SOPT_WATERMARK_SET: + pStreamOptions->pWatermark = pNode; + break; + case SOPT_DELETE_MARK_SET: + pStreamOptions->pDeleteMark = pNode; + break; + case SOPT_FILL_HISTORY_SET: + pStreamOptions->fillHistory = taosStr2Int8(pToken->z, NULL, 10); + break; + case SOPT_IGNORE_EXPIRED_SET: + pStreamOptions->ignoreExpired = taosStr2Int8(pToken->z, NULL, 10); + break; + case SOPT_IGNORE_UPDATE_SET: + pStreamOptions->ignoreUpdate = taosStr2Int8(pToken->z, NULL, 10); + break; + default: + break; + } + BIT_FLAG_SET_MASK(pStreamOptions->setFlag, setflag); + + return pOptions; +} + SNode* createCreateStreamStmt(SAstCreateContext* pCxt, bool ignoreExists, SToken* pStreamName, SNode* pRealTable, SNode* pOptions, SNodeList* pTags, SNode* pSubtable, SNode* pQuery, SNodeList* pCols) { CHECK_PARSER_STATUS(pCxt); diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index 69d48a99d7..9f1201a31a 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -6380,15 +6380,15 @@ static int32_t translateDropFunction(STranslateContext* pCxt, SDropFunctionStmt* static int32_t translateGrant(STranslateContext* pCxt, SGrantStmt* pStmt) { SAlterUserReq req = {0}; - if (PRIVILEGE_TYPE_TEST_MASK(pStmt->privileges, PRIVILEGE_TYPE_ALL) || - (PRIVILEGE_TYPE_TEST_MASK(pStmt->privileges, PRIVILEGE_TYPE_READ) && - PRIVILEGE_TYPE_TEST_MASK(pStmt->privileges, PRIVILEGE_TYPE_WRITE))) { + 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; - } else if (PRIVILEGE_TYPE_TEST_MASK(pStmt->privileges, PRIVILEGE_TYPE_READ)) { + } else if (BIT_FLAG_TEST_MASK(pStmt->privileges, PRIVILEGE_TYPE_READ)) { req.alterType = TSDB_ALTER_USER_ADD_READ_DB; - } else if (PRIVILEGE_TYPE_TEST_MASK(pStmt->privileges, PRIVILEGE_TYPE_WRITE)) { + } else if (BIT_FLAG_TEST_MASK(pStmt->privileges, PRIVILEGE_TYPE_WRITE)) { req.alterType = TSDB_ALTER_USER_ADD_WRITE_DB; - } else if (PRIVILEGE_TYPE_TEST_MASK(pStmt->privileges, PRIVILEGE_TYPE_SUBSCRIBE)) { + } else if (BIT_FLAG_TEST_MASK(pStmt->privileges, PRIVILEGE_TYPE_SUBSCRIBE)) { req.alterType = TSDB_ALTER_USER_ADD_SUBSCRIBE_TOPIC; } strcpy(req.user, pStmt->userName); @@ -6398,15 +6398,15 @@ static int32_t translateGrant(STranslateContext* pCxt, SGrantStmt* pStmt) { static int32_t translateRevoke(STranslateContext* pCxt, SRevokeStmt* pStmt) { SAlterUserReq req = {0}; - if (PRIVILEGE_TYPE_TEST_MASK(pStmt->privileges, PRIVILEGE_TYPE_ALL) || - (PRIVILEGE_TYPE_TEST_MASK(pStmt->privileges, PRIVILEGE_TYPE_READ) && - PRIVILEGE_TYPE_TEST_MASK(pStmt->privileges, PRIVILEGE_TYPE_WRITE))) { + 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; - } else if (PRIVILEGE_TYPE_TEST_MASK(pStmt->privileges, PRIVILEGE_TYPE_READ)) { + } else if (BIT_FLAG_TEST_MASK(pStmt->privileges, PRIVILEGE_TYPE_READ)) { req.alterType = TSDB_ALTER_USER_REMOVE_READ_DB; - } else if (PRIVILEGE_TYPE_TEST_MASK(pStmt->privileges, PRIVILEGE_TYPE_WRITE)) { + } else if (BIT_FLAG_TEST_MASK(pStmt->privileges, PRIVILEGE_TYPE_WRITE)) { req.alterType = TSDB_ALTER_USER_REMOVE_WRITE_DB; - } else if (PRIVILEGE_TYPE_TEST_MASK(pStmt->privileges, PRIVILEGE_TYPE_SUBSCRIBE)) { + } else if (BIT_FLAG_TEST_MASK(pStmt->privileges, PRIVILEGE_TYPE_SUBSCRIBE)) { req.alterType = TSDB_ALTER_USER_REMOVE_SUBSCRIBE_TOPIC; } strcpy(req.user, pStmt->userName); @@ -6478,11 +6478,11 @@ static int32_t translateShowCreateDatabase(STranslateContext* pCxt, SShowCreateD if (NULL == pStmt->pCfg) { return TSDB_CODE_OUT_OF_MEMORY; } - + SName name; tNameSetDbName(&name, pCxt->pParseCxt->acctId, pStmt->dbName, strlen(pStmt->dbName)); tNameGetFullDbName(&name, pStmt->dbFName); - + return getDBCfg(pCxt, pStmt->dbName, (SDbCfgInfo*)pStmt->pCfg); } diff --git a/source/libs/parser/src/sql.c b/source/libs/parser/src/sql.c index b6940f8395..92bc419c48 100644 --- a/source/libs/parser/src/sql.c +++ b/source/libs/parser/src/sql.c @@ -4608,7 +4608,6 @@ static YYACTIONTYPE yy_reduce( { yymsp[1].minor.yy42 = createStreamOptions(pCxt); } break; case 279: /* sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */ - case 316: /* stream_options ::= stream_options WATERMARK duration_literal */ yytestcase(yyruleno==316); { ((SStreamOptions*)yymsp[-2].minor.yy42)->pWatermark = releaseRawExprNode(pCxt, yymsp[0].minor.yy42); yylhsminor.yy42 = yymsp[-2].minor.yy42; } yymsp[-2].minor.yy42 = yylhsminor.yy42; break; @@ -4617,7 +4616,6 @@ static YYACTIONTYPE yy_reduce( yymsp[-2].minor.yy42 = yylhsminor.yy42; break; case 281: /* sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */ - case 319: /* stream_options ::= stream_options DELETE_MARK duration_literal */ yytestcase(yyruleno==319); { ((SStreamOptions*)yymsp[-2].minor.yy42)->pDeleteMark = releaseRawExprNode(pCxt, yymsp[0].minor.yy42); yylhsminor.yy42 = yymsp[-2].minor.yy42; } yymsp[-2].minor.yy42 = yylhsminor.yy42; break; @@ -4677,27 +4675,32 @@ static YYACTIONTYPE yy_reduce( { pCxt->pRootNode = createDropStreamStmt(pCxt, yymsp[-1].minor.yy103, &yymsp[0].minor.yy225); } break; case 313: /* stream_options ::= stream_options TRIGGER AT_ONCE */ -{ ((SStreamOptions*)yymsp[-2].minor.yy42)->triggerType = STREAM_TRIGGER_AT_ONCE; yylhsminor.yy42 = yymsp[-2].minor.yy42; } - yymsp[-2].minor.yy42 = yylhsminor.yy42; - break; - case 314: /* stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ -{ ((SStreamOptions*)yymsp[-2].minor.yy42)->triggerType = STREAM_TRIGGER_WINDOW_CLOSE; yylhsminor.yy42 = yymsp[-2].minor.yy42; } + case 314: /* stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ yytestcase(yyruleno==314); +{ yylhsminor.yy42 = setStreamOptions(pCxt, yymsp[-2].minor.yy42, SOPT_TRIGGER_TYPE_SET, &yymsp[0].minor.yy0, NULL); } yymsp[-2].minor.yy42 = yylhsminor.yy42; break; case 315: /* stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ -{ ((SStreamOptions*)yymsp[-3].minor.yy42)->triggerType = STREAM_TRIGGER_MAX_DELAY; ((SStreamOptions*)yymsp[-3].minor.yy42)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy42); yylhsminor.yy42 = yymsp[-3].minor.yy42; } +{ yylhsminor.yy42 = setStreamOptions(pCxt, yymsp[-3].minor.yy42, SOPT_TRIGGER_TYPE_SET, &yymsp[-1].minor.yy0, yymsp[0].minor.yy42); } yymsp[-3].minor.yy42 = yylhsminor.yy42; break; + case 316: /* stream_options ::= stream_options WATERMARK duration_literal */ +{ yylhsminor.yy42 = setStreamOptions(pCxt, yymsp[-2].minor.yy42, SOPT_WATERMARK_SET, NULL, releaseRawExprNode(pCxt, yymsp[0].minor.yy42)); } + yymsp[-2].minor.yy42 = yylhsminor.yy42; + break; case 317: /* stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ -{ ((SStreamOptions*)yymsp[-3].minor.yy42)->ignoreExpired = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); yylhsminor.yy42 = yymsp[-3].minor.yy42; } +{ yylhsminor.yy42 = setStreamOptions(pCxt, yymsp[-3].minor.yy42, SOPT_IGNORE_EXPIRED_SET, &yymsp[0].minor.yy0, NULL); } yymsp[-3].minor.yy42 = yylhsminor.yy42; break; case 318: /* stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ -{ ((SStreamOptions*)yymsp[-2].minor.yy42)->fillHistory = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); yylhsminor.yy42 = yymsp[-2].minor.yy42; } +{ yylhsminor.yy42 = setStreamOptions(pCxt, yymsp[-2].minor.yy42, SOPT_FILL_HISTORY_SET, &yymsp[0].minor.yy0, NULL); } + yymsp[-2].minor.yy42 = yylhsminor.yy42; + break; + case 319: /* stream_options ::= stream_options DELETE_MARK duration_literal */ +{ yylhsminor.yy42 = setStreamOptions(pCxt, yymsp[-2].minor.yy42, SOPT_DELETE_MARK_SET, NULL, releaseRawExprNode(pCxt, yymsp[0].minor.yy42)); } yymsp[-2].minor.yy42 = yylhsminor.yy42; break; case 320: /* stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */ -{ ((SStreamOptions*)yymsp[-3].minor.yy42)->ignoreUpdate = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); yylhsminor.yy42 = yymsp[-3].minor.yy42; } +{ yylhsminor.yy42 = setStreamOptions(pCxt, yymsp[-3].minor.yy42, SOPT_IGNORE_UPDATE_SET, &yymsp[0].minor.yy0, NULL); } yymsp[-3].minor.yy42 = yylhsminor.yy42; break; case 322: /* subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ From 82287c464bb1519e4b815e7eb51ccc9d925f58e3 Mon Sep 17 00:00:00 2001 From: Hui Li <52318143+plum-lihui@users.noreply.github.com> Date: Fri, 3 Mar 2023 17:27:32 +0800 Subject: [PATCH 074/174] Update tmqConsFromTsdb1-1ctb.py --- tests/system-test/7-tmq/tmqConsFromTsdb1-1ctb.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/system-test/7-tmq/tmqConsFromTsdb1-1ctb.py b/tests/system-test/7-tmq/tmqConsFromTsdb1-1ctb.py index 4dcc0b963f..58e3c2ba2c 100644 --- a/tests/system-test/7-tmq/tmqConsFromTsdb1-1ctb.py +++ b/tests/system-test/7-tmq/tmqConsFromTsdb1-1ctb.py @@ -200,7 +200,7 @@ class TDTestCase: tdLog.info("pkill consume processor") tdCom.killProcessor("tmq_sim") - # time.sleep(10) + time.sleep(6) # reinit consume info, and start tmq_sim, then check consume result tmqCom.initConsumerTable() From 81913fcb80cc4677fe75a9c33b79f30fc8611864 Mon Sep 17 00:00:00 2001 From: Hui Li <52318143+plum-lihui@users.noreply.github.com> Date: Fri, 3 Mar 2023 17:28:15 +0800 Subject: [PATCH 075/174] Update tmqConsFromTsdb1-1ctb.py --- tests/system-test/7-tmq/tmqConsFromTsdb1-1ctb.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/system-test/7-tmq/tmqConsFromTsdb1-1ctb.py b/tests/system-test/7-tmq/tmqConsFromTsdb1-1ctb.py index 58e3c2ba2c..c11159c6e5 100644 --- a/tests/system-test/7-tmq/tmqConsFromTsdb1-1ctb.py +++ b/tests/system-test/7-tmq/tmqConsFromTsdb1-1ctb.py @@ -200,7 +200,7 @@ class TDTestCase: tdLog.info("pkill consume processor") tdCom.killProcessor("tmq_sim") - time.sleep(6) + time.sleep(10) # reinit consume info, and start tmq_sim, then check consume result tmqCom.initConsumerTable() From ff70b102fa20ea8f596ad9892c034b25f05a5418 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Fri, 3 Mar 2023 17:30:02 +0800 Subject: [PATCH 076/174] fix: set trans from rollback to undo if mnode not leader --- source/dnode/mnode/impl/src/mndTrans.c | 2 +- source/dnode/mnode/sdb/src/sdbHash.c | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/source/dnode/mnode/impl/src/mndTrans.c b/source/dnode/mnode/impl/src/mndTrans.c index 55e9faf020..e044fe08b1 100644 --- a/source/dnode/mnode/impl/src/mndTrans.c +++ b/source/dnode/mnode/impl/src/mndTrans.c @@ -598,7 +598,7 @@ static int32_t mndTransActionUpdate(SSdb *pSdb, STrans *pOld, STrans *pNew) { } if (pOld->stage == TRN_STAGE_ROLLBACK) { - pOld->stage = TRN_STAGE_REDO_ACTION; + pOld->stage = TRN_STAGE_UNDO_ACTION; mTrace("trans:%d, stage from rollback to undoAction since perform update action", pNew->id); } diff --git a/source/dnode/mnode/sdb/src/sdbHash.c b/source/dnode/mnode/sdb/src/sdbHash.c index cc3dba2e07..569c78a68c 100644 --- a/source/dnode/mnode/sdb/src/sdbHash.c +++ b/source/dnode/mnode/sdb/src/sdbHash.c @@ -160,6 +160,7 @@ static int32_t sdbInsertRow(SSdb *pSdb, SHashObj *hash, SSdbRaw *pRaw, SSdbRow * if (insertFp != NULL) { code = (*insertFp)(pSdb, pRow->pObj); if (code != 0) { + if (terrno == 0) terrno = TSDB_CODE_MND_TRANS_UNKNOW_ERROR; code = terrno; taosHashRemove(hash, pRow->pObj, keySize); sdbFreeRow(pSdb, pRow, false); From d27f392beba77453b7ac9a1a4b3f5090ea048b18 Mon Sep 17 00:00:00 2001 From: Benguang Zhao Date: Fri, 3 Mar 2023 17:27:49 +0800 Subject: [PATCH 077/174] enh: control frequency of mnode sdb flushing with mndSdbWriteDelta --- include/common/tglobal.h | 3 +++ source/common/src/tglobal.c | 8 ++++++++ source/dnode/mnode/impl/src/mndSync.c | 2 +- source/dnode/mnode/sdb/inc/sdb.h | 2 -- 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/include/common/tglobal.h b/include/common/tglobal.h index b35b460211..86395c44da 100644 --- a/include/common/tglobal.h +++ b/include/common/tglobal.h @@ -74,6 +74,9 @@ extern int32_t tsHeartbeatTimeout; // vnode extern int64_t tsVndCommitMaxIntervalMs; +// mnode +extern int64_t tsMndSdbWriteDelta; + // monitor extern bool tsEnableMonitor; extern int32_t tsMonitorInterval; diff --git a/source/common/src/tglobal.c b/source/common/src/tglobal.c index 99795fcc79..023852c9fc 100644 --- a/source/common/src/tglobal.c +++ b/source/common/src/tglobal.c @@ -56,6 +56,7 @@ int32_t tsNumOfQnodeQueryThreads = 4; int32_t tsNumOfQnodeFetchThreads = 1; int32_t tsNumOfSnodeStreamThreads = 4; int32_t tsNumOfSnodeWriteThreads = 1; + // sync raft int32_t tsElectInterval = 25 * 1000; int32_t tsHeartbeatInterval = 1000; @@ -64,6 +65,9 @@ int32_t tsHeartbeatTimeout = 20 * 1000; // vnode int64_t tsVndCommitMaxIntervalMs = 600 * 1000; +// mnode +int64_t tsMndSdbWriteDelta = 2000; + // monitor bool tsEnableMonitor = true; int32_t tsMonitorInterval = 30; @@ -456,6 +460,8 @@ static int32_t taosAddServerCfg(SConfig *pCfg) { if (cfgAddInt64(pCfg, "vndCommitMaxInterval", tsVndCommitMaxIntervalMs, 1000, 1000 * 60 * 60, 0) != 0) return -1; + if (cfgAddInt64(pCfg, "mndSdbWriteDelta", tsMndSdbWriteDelta, 20, 10000, 0) != 0) return -1; + if (cfgAddBool(pCfg, "monitor", tsEnableMonitor, 0) != 0) return -1; if (cfgAddInt32(pCfg, "monitorInterval", tsMonitorInterval, 1, 200000, 0) != 0) return -1; if (cfgAddString(pCfg, "monitorFqdn", tsMonitorFqdn, 0) != 0) return -1; @@ -803,6 +809,8 @@ static int32_t taosSetServerCfg(SConfig *pCfg) { tsVndCommitMaxIntervalMs = cfgGetItem(pCfg, "vndCommitMaxInterval")->i64; + tsMndSdbWriteDelta = cfgGetItem(pCfg, "mndSdbWriteDelta")->i64; + tsStartUdfd = cfgGetItem(pCfg, "udf")->bval; tstrncpy(tsUdfdResFuncs, cfgGetItem(pCfg, "udfdResFuncs")->str, sizeof(tsUdfdResFuncs)); tstrncpy(tsUdfdLdLibPath, cfgGetItem(pCfg, "udfdLdLibPath")->str, sizeof(tsUdfdLdLibPath)); diff --git a/source/dnode/mnode/impl/src/mndSync.c b/source/dnode/mnode/impl/src/mndSync.c index edd75c62b9..f702d8f148 100644 --- a/source/dnode/mnode/impl/src/mndSync.c +++ b/source/dnode/mnode/impl/src/mndSync.c @@ -123,7 +123,7 @@ int32_t mndProcessWriteMsg(const SSyncFSM *pFsm, SRpcMsg *pMsg, const SFsmCbMeta } } - sdbWriteFile(pMnode->pSdb, SDB_WRITE_DELTA); + sdbWriteFile(pMnode->pSdb, tsMndSdbWriteDelta); return 0; } diff --git a/source/dnode/mnode/sdb/inc/sdb.h b/source/dnode/mnode/sdb/inc/sdb.h index 1b7b2f9672..e9a9e425e3 100644 --- a/source/dnode/mnode/sdb/inc/sdb.h +++ b/source/dnode/mnode/sdb/inc/sdb.h @@ -37,8 +37,6 @@ extern "C" { #define mTrace(...) { if (mDebugFlag & DEBUG_TRACE) { taosPrintLog("MND ", DEBUG_TRACE, mDebugFlag, __VA_ARGS__); }} // clang-format on -#define SDB_WRITE_DELTA 2000 - #define SDB_GET_VAL(pData, dataPos, val, pos, func, type) \ { \ if (func(pRaw, dataPos, val) != 0) { \ From 2624ea65d86fd1ec7b97031189aa8afa3e63d09a Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Fri, 3 Mar 2023 18:21:07 +0800 Subject: [PATCH 078/174] fix: add pre-finished stage, trans won't be dropped in follower if it has undo actions while rollback --- source/dnode/mnode/impl/inc/mndDef.h | 3 +- source/dnode/mnode/impl/src/mndTrans.c | 50 ++++++++++++++++-- tests/script/tsim/trans/create_stb.sim | 72 ++++++++++++++++++++++++++ 3 files changed, 121 insertions(+), 4 deletions(-) create mode 100644 tests/script/tsim/trans/create_stb.sim diff --git a/source/dnode/mnode/impl/inc/mndDef.h b/source/dnode/mnode/impl/inc/mndDef.h index 345418801b..fe2c58e29e 100644 --- a/source/dnode/mnode/impl/inc/mndDef.h +++ b/source/dnode/mnode/impl/inc/mndDef.h @@ -108,7 +108,8 @@ typedef enum { TRN_STAGE_UNDO_ACTION = 3, TRN_STAGE_COMMIT = 4, TRN_STAGE_COMMIT_ACTION = 5, - TRN_STAGE_FINISHED = 6 + TRN_STAGE_FINISHED = 6, + TRN_STAGE_PRE_FINISH = 7 } ETrnStage; typedef enum { diff --git a/source/dnode/mnode/impl/src/mndTrans.c b/source/dnode/mnode/impl/src/mndTrans.c index e044fe08b1..eccabf2d5c 100644 --- a/source/dnode/mnode/impl/src/mndTrans.c +++ b/source/dnode/mnode/impl/src/mndTrans.c @@ -460,6 +460,8 @@ static const char *mndTransStr(ETrnStage stage) { return "commitAction"; case TRN_STAGE_FINISHED: return "finished"; + case TRN_STAGE_PRE_FINISH: + return "pre-finish"; default: return "invalid"; } @@ -602,6 +604,11 @@ static int32_t mndTransActionUpdate(SSdb *pSdb, STrans *pOld, STrans *pNew) { mTrace("trans:%d, stage from rollback to undoAction since perform update action", pNew->id); } + if (pOld->stage == TRN_STAGE_PRE_FINISH) { + pOld->stage = TRN_STAGE_FINISHED; + mTrace("trans:%d, stage from pre-finish to finished since perform update action", pNew->id); + } + return 0; } @@ -931,6 +938,16 @@ static int32_t mndTransRollback(SMnode *pMnode, STrans *pTrans) { return 0; } +static int32_t mndTransPreFinish(SMnode *pMnode, STrans *pTrans) { + mInfo("trans:%d, pre-finish transaction", pTrans->id); + if (mndTransSync(pMnode, pTrans) != 0) { + mError("trans:%d, failed to pre-finish since %s", pTrans->id, terrstr()); + return -1; + } + mInfo("trans:%d, pre-finish finished", pTrans->id); + return 0; +} + static void mndTransSendRpcRsp(SMnode *pMnode, STrans *pTrans) { bool sendRsp = false; int32_t code = pTrans->code; @@ -1437,7 +1454,7 @@ static bool mndTransPerformCommitActionStage(SMnode *pMnode, STrans *pTrans) { if (code == 0) { pTrans->code = 0; - pTrans->stage = TRN_STAGE_FINISHED; + pTrans->stage = TRN_STAGE_FINISHED; // TRN_STAGE_PRE_FINISH is not necessary mInfo("trans:%d, stage from commitAction to finished", pTrans->id); continueExec = true; } else { @@ -1455,8 +1472,8 @@ static bool mndTransPerformUndoActionStage(SMnode *pMnode, STrans *pTrans) { int32_t code = mndTransExecuteUndoActions(pMnode, pTrans); if (code == 0) { - pTrans->stage = TRN_STAGE_FINISHED; - mInfo("trans:%d, stage from undoAction to finished", pTrans->id); + pTrans->stage = TRN_STAGE_PRE_FINISH; + mInfo("trans:%d, stage from undoAction to pre-finish", pTrans->id); continueExec = true; } else if (code == TSDB_CODE_ACTION_IN_PROGRESS) { mInfo("trans:%d, stage keep on undoAction since %s", pTrans->id, tstrerror(code)); @@ -1489,6 +1506,25 @@ static bool mndTransPerformRollbackStage(SMnode *pMnode, STrans *pTrans) { return continueExec; } +static bool mndTransPerfromPreFinishedStage(SMnode *pMnode, STrans *pTrans) { + if (mndCannotExecuteTransAction(pMnode)) return false; + + bool continueExec = true; + int32_t code = mndTransPreFinish(pMnode, pTrans); + + if (code == 0) { + pTrans->stage = TRN_STAGE_FINISHED; + mInfo("trans:%d, stage from pre-finish to finish", pTrans->id); + continueExec = true; + } else { + pTrans->failedTimes++; + mError("trans:%d, stage keep on pre-finish since %s, failedTimes:%d", pTrans->id, terrstr(), pTrans->failedTimes); + continueExec = false; + } + + return continueExec; +} + static bool mndTransPerfromFinishedStage(SMnode *pMnode, STrans *pTrans) { bool continueExec = false; @@ -1545,6 +1581,14 @@ void mndTransExecute(SMnode *pMnode, STrans *pTrans, bool isLeader) { case TRN_STAGE_UNDO_ACTION: continueExec = mndTransPerformUndoActionStage(pMnode, pTrans); break; + case TRN_STAGE_PRE_FINISH: + if (isLeader) { + continueExec = mndTransPerfromPreFinishedStage(pMnode, pTrans); + } else { + mInfo("trans:%d, can not pre-finish since not leader", pTrans->id); + continueExec = false; + } + break; case TRN_STAGE_FINISHED: continueExec = mndTransPerfromFinishedStage(pMnode, pTrans); break; diff --git a/tests/script/tsim/trans/create_stb.sim b/tests/script/tsim/trans/create_stb.sim new file mode 100644 index 0000000000..94041645d5 --- /dev/null +++ b/tests/script/tsim/trans/create_stb.sim @@ -0,0 +1,72 @@ +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/deploy.sh -n dnode2 -i 2 +system sh/deploy.sh -n dnode3 -i 3 +system sh/deploy.sh -n dnode4 -i 4 +system sh/cfg.sh -n dnode1 -c transPullupInterval -v 1 +system sh/cfg.sh -n dnode2 -c transPullupInterval -v 1 +system sh/cfg.sh -n dnode3 -c transPullupInterval -v 1 +system sh/cfg.sh -n dnode4 -c transPullupInterval -v 1 +system sh/exec.sh -n dnode1 -s start +system sh/exec.sh -n dnode2 -s start +system sh/exec.sh -n dnode3 -s start +system sh/exec.sh -n dnode4 -s start +sql connect + +print =============== step1: create dnodes +sql create dnode $hostname port 7200 +sql create dnode $hostname port 7300 +sql create dnode $hostname port 7400 + +$x = 0 +step1: + $x = $x + 1 + sleep 1000 + if $x == 10 then + return -1 + endi +sql select * from information_schema.ins_dnodes -x step1 +if $data(1)[4] != ready then + goto step1 +endi +if $data(2)[4] != ready then + goto step1 +endi +if $data(3)[4] != ready then + goto step1 +endi + +print =============== step2: create mnode 2 and 3 +sql create mnode on dnode 2 +sql create mnode on dnode 3 +sql create database db vgroups 2 + +print =============== step3: kill dnode4 +system sh/exec.sh -n dnode4 -s stop -x SIGKILL +sql use db +sql_error create table stb (ts timestamp, i int) tags (j int) + +print =============== step4: create database +sql show transactions +if $rows != 1 then + return -1 +endi + +sleep 3000 +system sh/exec.sh -n dnode4 -s start + +$wt = 0 +step4: +$wt = $wt + 1 +sleep 1000 +if $wt == 200 then + print ====> transaction already running + return -1 +endi + +sql show transactions +if $rows != 0 then + print wait 1 seconds to alter + goto step4 +endi + From 6c68b36d7f1609cbf53d7b176448f364969bc834 Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Fri, 3 Mar 2023 18:22:26 +0800 Subject: [PATCH 079/174] fix:change ask ep to 20s --- source/client/src/clientTmq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/client/src/clientTmq.c b/source/client/src/clientTmq.c index 40eccd57dd..826bbbd8a3 100644 --- a/source/client/src/clientTmq.c +++ b/source/client/src/clientTmq.c @@ -1162,7 +1162,7 @@ int32_t tmq_subscribe(tmq_t* tmq, const tmq_list_t* topic_list) { int32_t retryCnt = 0; while (TSDB_CODE_MND_CONSUMER_NOT_READY == tmqAskEp(tmq, false)) { - if (retryCnt++ > 10) { + if (retryCnt++ > 40) { goto FAIL; } From 24bb33f24a11a8b55aa87f4d7f7a3f1841260aac Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Fri, 3 Mar 2023 18:34:38 +0800 Subject: [PATCH 080/174] refactor: add some logs. --- source/dnode/vnode/inc/vnode.h | 2 +- source/dnode/vnode/src/tq/tqRead.c | 8 ++++---- source/libs/executor/src/executor.c | 2 +- source/libs/executor/src/scanoperator.c | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/source/dnode/vnode/inc/vnode.h b/source/dnode/vnode/inc/vnode.h index acfaccafe2..1d14829891 100644 --- a/source/dnode/vnode/inc/vnode.h +++ b/source/dnode/vnode/inc/vnode.h @@ -264,7 +264,7 @@ int32_t tqReaderSetTbUidList(STqReader *pReader, const SArray *tbUidList); int32_t tqReaderAddTbUidList(STqReader *pReader, const SArray *tbUidList); int32_t tqReaderRemoveTbUidList(STqReader *pReader, const SArray *tbUidList); -int32_t tqSeekVer(STqReader *pReader, int64_t ver); +int32_t tqSeekVer(STqReader *pReader, int64_t ver, const char* id); int32_t tqNextBlock(STqReader *pReader, SFetchRet *ret); int32_t tqReaderSetSubmitReq2(STqReader *pReader, void *msgStr, int32_t msgLen, int64_t ver); diff --git a/source/dnode/vnode/src/tq/tqRead.c b/source/dnode/vnode/src/tq/tqRead.c index ee00cdc205..f4c96d073b 100644 --- a/source/dnode/vnode/src/tq/tqRead.c +++ b/source/dnode/vnode/src/tq/tqRead.c @@ -290,14 +290,14 @@ void tqCloseReader(STqReader* pReader) { taosMemoryFree(pReader); } -int32_t tqSeekVer(STqReader* pReader, int64_t ver) { +int32_t tqSeekVer(STqReader* pReader, int64_t ver, const char* id) { // todo set the correct vgId - tqDebug("tmq poll: vgId:%d wal seek to version:%"PRId64, 0, ver); + tqDebug("tmq poll: wal seek to version:%"PRId64" %s", ver, id); if (walReadSeekVer(pReader->pWalReader, ver) < 0) { - tqError("tmq poll: wal reader failed to seek to ver:%"PRId64, ver); + tqError("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, ver); + tqError("tmq poll: wal reader seek to ver:%"PRId64" %s", ver, id); return 0; } } diff --git a/source/libs/executor/src/executor.c b/source/libs/executor/src/executor.c index c2bf001c86..f24fe2d211 100644 --- a/source/libs/executor/src/executor.c +++ b/source/libs/executor/src/executor.c @@ -1068,7 +1068,7 @@ int32_t qStreamPrepareScan(qTaskInfo_t tinfo, STqOffsetVal* pOffset, int8_t subT tsdbReaderClose(pTSInfo->base.dataReader); pTSInfo->base.dataReader = NULL; // let's seek to the next version in wal file - if (tqSeekVer(pInfo->tqReader, pOffset->version + 1) < 0) { + if (tqSeekVer(pInfo->tqReader, pOffset->version + 1, pTaskInfo->id.str) < 0) { return -1; } } else if (pOffset->type == TMQ_OFFSET__SNAPSHOT_DATA) { diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c index 7961d5518a..8576ac74c7 100644 --- a/source/libs/executor/src/scanoperator.c +++ b/source/libs/executor/src/scanoperator.c @@ -1618,7 +1618,7 @@ static SSDataBlock* doQueueScan(SOperatorInfo* pOperator) { pTSInfo->base.dataReader = NULL; tqOffsetResetToLog(&pTaskInfo->streamInfo.prepareStatus, pTaskInfo->streamInfo.snapshotVer); qDebug("queue scan tsdb over, switch to wal ver %" PRId64 "", pTaskInfo->streamInfo.snapshotVer + 1); - if (tqSeekVer(pInfo->tqReader, pTaskInfo->streamInfo.snapshotVer + 1) < 0) { + if (tqSeekVer(pInfo->tqReader, pTaskInfo->streamInfo.snapshotVer + 1, pTaskInfo->id.str) < 0) { tqOffsetResetToLog(&pTaskInfo->streamInfo.lastStatus, pTaskInfo->streamInfo.snapshotVer); return NULL; } From e937c7727579c84b47168a9e39080fb9f437fb91 Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Fri, 3 Mar 2023 18:35:51 +0800 Subject: [PATCH 081/174] fix: create stream syntax check --- source/libs/parser/inc/sql.y | 2 +- source/libs/parser/src/sql.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/source/libs/parser/inc/sql.y b/source/libs/parser/inc/sql.y index b2f85eb677..317bfccb78 100644 --- a/source/libs/parser/inc/sql.y +++ b/source/libs/parser/inc/sql.y @@ -564,7 +564,7 @@ tag_def_or_ref_opt(A) ::= TAGS NK_LP col_name_list(B) NK_RP. stream_options(A) ::= . { A = createStreamOptions(pCxt); } stream_options(A) ::= stream_options(B) TRIGGER AT_ONCE(C). { A = setStreamOptions(pCxt, B, SOPT_TRIGGER_TYPE_SET, &C, NULL); } stream_options(A) ::= stream_options(B) TRIGGER WINDOW_CLOSE(C). { A = setStreamOptions(pCxt, B, SOPT_TRIGGER_TYPE_SET, &C, NULL); } -stream_options(A) ::= stream_options(B) TRIGGER MAX_DELAY(C) duration_literal(D). { A = setStreamOptions(pCxt, B, SOPT_TRIGGER_TYPE_SET, &C, D); } +stream_options(A) ::= stream_options(B) TRIGGER MAX_DELAY(C) duration_literal(D). { A = setStreamOptions(pCxt, B, SOPT_TRIGGER_TYPE_SET, &C, releaseRawExprNode(pCxt, D)); } stream_options(A) ::= stream_options(B) WATERMARK duration_literal(C). { A = setStreamOptions(pCxt, B, SOPT_WATERMARK_SET, NULL, releaseRawExprNode(pCxt, C)); } stream_options(A) ::= stream_options(B) IGNORE EXPIRED NK_INTEGER(C). { A = setStreamOptions(pCxt, B, SOPT_IGNORE_EXPIRED_SET, &C, NULL); } stream_options(A) ::= stream_options(B) FILL_HISTORY NK_INTEGER(C). { A = setStreamOptions(pCxt, B, SOPT_FILL_HISTORY_SET, &C, NULL); } diff --git a/source/libs/parser/src/sql.c b/source/libs/parser/src/sql.c index 92bc419c48..04f838b92d 100644 --- a/source/libs/parser/src/sql.c +++ b/source/libs/parser/src/sql.c @@ -4680,7 +4680,7 @@ static YYACTIONTYPE yy_reduce( yymsp[-2].minor.yy42 = yylhsminor.yy42; break; case 315: /* stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ -{ yylhsminor.yy42 = setStreamOptions(pCxt, yymsp[-3].minor.yy42, SOPT_TRIGGER_TYPE_SET, &yymsp[-1].minor.yy0, yymsp[0].minor.yy42); } +{ yylhsminor.yy42 = setStreamOptions(pCxt, yymsp[-3].minor.yy42, SOPT_TRIGGER_TYPE_SET, &yymsp[-1].minor.yy0, releaseRawExprNode(pCxt, yymsp[0].minor.yy42)); } yymsp[-3].minor.yy42 = yylhsminor.yy42; break; case 316: /* stream_options ::= stream_options WATERMARK duration_literal */ From 0b00922a43706bb5d40b7aee00cd90dd1beb98f5 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Fri, 3 Mar 2023 23:53:32 +0800 Subject: [PATCH 082/174] fix: should not set startFunc/stopFunc to 0. when the trans is not finished on taosd stop, it will cause the startFunc/stopFunc setting error --- source/dnode/mnode/impl/src/mndTrans.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/dnode/mnode/impl/src/mndTrans.c b/source/dnode/mnode/impl/src/mndTrans.c index 56fce0507f..ff8b4dd9ce 100644 --- a/source/dnode/mnode/impl/src/mndTrans.c +++ b/source/dnode/mnode/impl/src/mndTrans.c @@ -513,7 +513,7 @@ static int32_t mndTransActionInsert(SSdb *pSdb, STrans *pTrans) { if (fp) { (*fp)(pSdb->pMnode, pTrans->param, pTrans->paramLen); } - pTrans->startFunc = 0; + // pTrans->startFunc = 0; } return 0; @@ -557,7 +557,7 @@ static int32_t mndTransActionDelete(SSdb *pSdb, STrans *pTrans, bool callFunc) { if (fp) { (*fp)(pSdb->pMnode, pTrans->param, pTrans->paramLen); } - pTrans->stopFunc = 0; + // pTrans->stopFunc = 0; } mndTransDropData(pTrans); From f4c8444b8f92994a81816c3a90836f3425313ed4 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Fri, 3 Mar 2023 23:55:05 +0800 Subject: [PATCH 083/174] fix: format log --- source/dnode/mnode/impl/src/mndConsumer.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/source/dnode/mnode/impl/src/mndConsumer.c b/source/dnode/mnode/impl/src/mndConsumer.c index 2b5956f6a6..803c4f81e7 100644 --- a/source/dnode/mnode/impl/src/mndConsumer.c +++ b/source/dnode/mnode/impl/src/mndConsumer.c @@ -81,11 +81,20 @@ bool mndRebTryStart() { return old == 0; } -void mndRebEnd() { int32_t val = atomic_sub_fetch_32(&mqRebInExecCnt, 1); mInfo("rebalance end, rebalance counter:%d", val); } +void mndRebEnd() { + int32_t val = atomic_sub_fetch_32(&mqRebInExecCnt, 1); + mInfo("rebalance end, rebalance count:%d", val); +} -void mndRebCntInc() { int32_t val = atomic_add_fetch_32(&mqRebInExecCnt, 1); mInfo("rebalance trans start, rebalance count:%d", val);} +void mndRebCntInc() { + int32_t val = atomic_add_fetch_32(&mqRebInExecCnt, 1); + mInfo("rebalance trans start, rebalance count:%d", val); +} -void mndRebCntDec() { int32_t val = atomic_sub_fetch_32(&mqRebInExecCnt, 1); mInfo("rebalance trans end, rebalance count:%d", val); } +void mndRebCntDec() { + int32_t val = atomic_sub_fetch_32(&mqRebInExecCnt, 1); + mInfo("rebalance trans end, rebalance count:%d", val); +} static int32_t mndProcessConsumerLostMsg(SRpcMsg *pMsg) { SMnode *pMnode = pMsg->info.node; From 3645c52b251ce44c761515e1984782674236dd03 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Sat, 4 Mar 2023 00:34:53 +0800 Subject: [PATCH 084/174] refactor: update some logs. --- source/client/src/clientTmq.c | 7 +++---- source/dnode/mnode/impl/src/mndConsumer.c | 3 ++- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/source/client/src/clientTmq.c b/source/client/src/clientTmq.c index 826bbbd8a3..de338a4642 100644 --- a/source/client/src/clientTmq.c +++ b/source/client/src/clientTmq.c @@ -1799,8 +1799,7 @@ void* tmqHandleAllRsp(tmq_t* tmq, int64_t timeout, bool pollIfReset) { atomic_store_32(&pVg->vgStatus, TMQ_VG_STATUS__IDLE); if (pollRspWrapper->dataRsp.blockNum == 0) { - tscDebug("consumer:0x%" PRIx64 " empty block received in poll rsp", tmq->consumerId); - + tscDebug("consumer:0x%" PRIx64 " empty block received, vgId:%d", tmq->consumerId, pVg->vgId); taosFreeQitem(pollRspWrapper); rspWrapper = NULL; continue; @@ -1913,11 +1912,11 @@ TAOS_RES* tmq_consumer_poll(tmq_t* tmq, int64_t timeout) { if (atomic_load_8(&tmq->status) == TMQ_CONSUMER_STATUS__RECOVER) { int32_t retryCnt = 0; while (TSDB_CODE_MND_CONSUMER_NOT_READY == tmqAskEp(tmq, false)) { - if (retryCnt++ > 10) { + if (retryCnt++ > 40) { return NULL; } - tscDebug("consumer:0x%" PRIx64 " not ready, retry:%d/10 in 500ms", tmq->consumerId, retryCnt); + tscDebug("consumer:0x%" PRIx64 " not ready, retry:%d/40 in 500ms", tmq->consumerId, retryCnt); taosMsleep(500); } } diff --git a/source/dnode/mnode/impl/src/mndConsumer.c b/source/dnode/mnode/impl/src/mndConsumer.c index 803c4f81e7..50aa1bb8c7 100644 --- a/source/dnode/mnode/impl/src/mndConsumer.c +++ b/source/dnode/mnode/impl/src/mndConsumer.c @@ -621,7 +621,8 @@ int32_t mndProcessSubscribeReq(SRpcMsg *pMsg) { pExistedConsumer = mndAcquireConsumer(pMnode, consumerId); if (pExistedConsumer == NULL) { - mInfo("receive subscribe request from new consumer:0x%" PRIx64" cgroup:%s", consumerId, subscribe.cgroup); + mInfo("receive subscribe request from new consumer:0x%" PRIx64" cgroup:%s, numOfTopics:%d", consumerId, + subscribe.cgroup, (int32_t) taosArrayGetSize(pTopicList)); pConsumerNew = tNewSMqConsumerObj(consumerId, cgroup); tstrncpy(pConsumerNew->clientId, subscribe.clientId, 256); From b91734cf91664487302d21d55125db986d04422c Mon Sep 17 00:00:00 2001 From: Benguang Zhao Date: Sat, 4 Mar 2023 09:51:34 +0800 Subject: [PATCH 085/174] enh: sync log retention of mnode configurable with mndLogRetention --- include/common/tglobal.h | 1 + include/libs/sync/sync.h | 1 - source/common/src/tglobal.c | 5 ++++- source/libs/sync/src/syncMain.c | 2 +- 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/include/common/tglobal.h b/include/common/tglobal.h index 86395c44da..ac75b84762 100644 --- a/include/common/tglobal.h +++ b/include/common/tglobal.h @@ -76,6 +76,7 @@ extern int64_t tsVndCommitMaxIntervalMs; // mnode extern int64_t tsMndSdbWriteDelta; +extern int64_t tsMndLogRetention; // monitor extern bool tsEnableMonitor; diff --git a/include/libs/sync/sync.h b/include/libs/sync/sync.h index 5e37da4f3f..189484d1a6 100644 --- a/include/libs/sync/sync.h +++ b/include/libs/sync/sync.h @@ -35,7 +35,6 @@ extern "C" { #define SYNC_MAX_RECV_TIME_RANGE_MS 1200 #define SYNC_DEL_WAL_MS (1000 * 60) #define SYNC_ADD_QUORUM_COUNT 3 -#define SYNC_MNODE_LOG_RETENTION 10000 #define SYNC_VNODE_LOG_RETENTION (TSDB_SYNC_LOG_BUFFER_RETENTION + 1) #define SNAPSHOT_MAX_CLOCK_SKEW_MS 1000 * 10 #define SNAPSHOT_WAIT_MS 1000 * 30 diff --git a/source/common/src/tglobal.c b/source/common/src/tglobal.c index 023852c9fc..cd5486ea25 100644 --- a/source/common/src/tglobal.c +++ b/source/common/src/tglobal.c @@ -66,7 +66,8 @@ int32_t tsHeartbeatTimeout = 20 * 1000; int64_t tsVndCommitMaxIntervalMs = 600 * 1000; // mnode -int64_t tsMndSdbWriteDelta = 2000; +int64_t tsMndSdbWriteDelta = 200; +int64_t tsMndLogRetention = 2000; // monitor bool tsEnableMonitor = true; @@ -461,6 +462,7 @@ static int32_t taosAddServerCfg(SConfig *pCfg) { if (cfgAddInt64(pCfg, "vndCommitMaxInterval", tsVndCommitMaxIntervalMs, 1000, 1000 * 60 * 60, 0) != 0) return -1; if (cfgAddInt64(pCfg, "mndSdbWriteDelta", tsMndSdbWriteDelta, 20, 10000, 0) != 0) return -1; + if (cfgAddInt64(pCfg, "mndLogRetention", tsMndLogRetention, 500, 10000, 0) != 0) return -1; if (cfgAddBool(pCfg, "monitor", tsEnableMonitor, 0) != 0) return -1; if (cfgAddInt32(pCfg, "monitorInterval", tsMonitorInterval, 1, 200000, 0) != 0) return -1; @@ -810,6 +812,7 @@ static int32_t taosSetServerCfg(SConfig *pCfg) { tsVndCommitMaxIntervalMs = cfgGetItem(pCfg, "vndCommitMaxInterval")->i64; tsMndSdbWriteDelta = cfgGetItem(pCfg, "mndSdbWriteDelta")->i64; + tsMndLogRetention = cfgGetItem(pCfg, "mndLogRetention")->i64; tsStartUdfd = cfgGetItem(pCfg, "udf")->bval; tstrncpy(tsUdfdResFuncs, cfgGetItem(pCfg, "udfdResFuncs")->str, sizeof(tsUdfdResFuncs)); diff --git a/source/libs/sync/src/syncMain.c b/source/libs/sync/src/syncMain.c index b07c05dcfe..9601cd6ab0 100644 --- a/source/libs/sync/src/syncMain.c +++ b/source/libs/sync/src/syncMain.c @@ -285,7 +285,7 @@ int32_t syncBeginSnapshot(int64_t rid, int64_t lastApplyIndex) { if (syncNodeIsMnode(pSyncNode)) { // mnode - logRetention = SYNC_MNODE_LOG_RETENTION; + logRetention = tsMndLogRetention; } else { // vnode if (pSyncNode->replicaNum > 1) { From e54e12eff0c8d5da57919d2c292a71335fad512a Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Sat, 4 Mar 2023 11:57:27 +0800 Subject: [PATCH 086/174] fix:give error if col is same in schemless & fix json parse error in TD-22903 --- source/client/src/clientSml.c | 2 + source/client/src/clientSmlJson.c | 2 +- source/common/src/tglobal.c | 1 + source/dnode/vnode/src/vnd/vnodeSync.c | 2 +- utils/test/c/sml_test.c | 65 ++++++++++++++++++++++++-- 5 files changed, 66 insertions(+), 6 deletions(-) diff --git a/source/client/src/clientSml.c b/source/client/src/clientSml.c index b83e7ee976..3314932272 100644 --- a/source/client/src/clientSml.c +++ b/source/client/src/clientSml.c @@ -1141,6 +1141,7 @@ static int32_t smlPushCols(SArray *colsArray, SArray *cols) { for (size_t i = 0; i < taosArrayGetSize(cols); i++) { SSmlKv *kv = (SSmlKv *)taosArrayGet(cols, i); taosHashPut(kvHash, kv->key, kv->keyLen, &kv, POINTER_BYTES); + if(terrno == TSDB_CODE_DUP_KEY){return terrno;} } taosArrayPush(colsArray, &kvHash); @@ -1204,6 +1205,7 @@ static int32_t smlParseLineBottom(SSmlHandle *info) { SSmlSTableMeta *meta = smlBuildSTableMeta(info->dataFormat); smlInsertMeta(meta->tagHash, meta->tags, tinfo->tags); + if(terrno == TSDB_CODE_DUP_KEY){return terrno;} smlInsertMeta(meta->colHash, meta->cols, elements->colArray); taosHashPut(info->superTables, elements->measure, elements->measureLen, &meta, POINTER_BYTES); } diff --git a/source/client/src/clientSmlJson.c b/source/client/src/clientSmlJson.c index e89227d412..b9a1cd00a1 100644 --- a/source/client/src/clientSmlJson.c +++ b/source/client/src/clientSmlJson.c @@ -1214,7 +1214,7 @@ static int32_t smlParseJSONString(SSmlHandle *info, char **start, SSmlLineInfo * return TSDB_CODE_INVALID_TIMESTAMP; } else if (elements->timestamp[0] == '{') { char tmp = elements->timestamp[elements->timestampLen]; - elements->cols[elements->timestampLen] = '\0'; + elements->timestamp[elements->timestampLen] = '\0'; cJSON *tsJson = cJSON_Parse(elements->timestamp); ts = smlParseTSFromJSON(info, tsJson); if (unlikely(ts < 0)) { diff --git a/source/common/src/tglobal.c b/source/common/src/tglobal.c index 4bb64e5fd6..1535c80feb 100644 --- a/source/common/src/tglobal.c +++ b/source/common/src/tglobal.c @@ -1246,6 +1246,7 @@ int32_t taosCreateLog(const char *logname, int32_t logFileNum, const char *cfgDi taosSetAllDebugFlag(cfgGetItem(pCfg, "debugFlag")->i32, false); if (taosMulModeMkDir(tsLogDir, 0777) != 0) { + terrno = TAOS_SYSTEM_ERROR(errno); uError("failed to create dir:%s since %s", tsLogDir, terrstr()); cfgCleanup(pCfg); return -1; diff --git a/source/dnode/vnode/src/vnd/vnodeSync.c b/source/dnode/vnode/src/vnd/vnodeSync.c index 1e96a76170..e71b03d2af 100644 --- a/source/dnode/vnode/src/vnd/vnodeSync.c +++ b/source/dnode/vnode/src/vnd/vnodeSync.c @@ -292,7 +292,7 @@ void vnodeProposeWriteMsg(SQueueInfo *pInfo, STaosQall *qall, int32_t numOfMsgs) code = vnodePreProcessWriteMsg(pVnode, pMsg); if (code != 0) { - vGError("vgId:%d, msg:%p failed to pre-process since %s", vgId, pMsg, terrstr()); + vGError("vgId:%d, msg:%p failed to pre-process since %s", vgId, pMsg, tstrerror(code)); if (terrno != 0) code = terrno; vnodeHandleProposeError(pVnode, pMsg, code); rpcFreeCont(pMsg->pCont); diff --git a/utils/test/c/sml_test.c b/utils/test/c/sml_test.c index c36ab38877..b8d018fc82 100644 --- a/utils/test/c/sml_test.c +++ b/utils/test/c/sml_test.c @@ -137,6 +137,8 @@ int smlProcess_json1_Test() { for (int i = 0; i < 1; i++) { taosMemoryFree(sql1[i]); } + ASSERT(code == 0); + const char *sql2[] = { "[{\"metric\":\"sys.cpu.nice\",\"timestamp\":1662344041,\"value\":13,\"tags\":{\"host\":\"web01\",\"dc\":\"lga\"}" @@ -164,6 +166,34 @@ int smlProcess_json1_Test() { taosMemoryFree(sql3[i]); } + ASSERT(code == 0); + + + // TD-22903 + const char *sql4[] = { + "[{\"metric\": \"test_us\", \"timestamp\": {\"value\": 1626006833639, \"type\": \"ms\"}, \"value\": true, \"tags\": {\"t0\": true}}, {\"metric\": \"test_us\", \"timestamp\": {\"value\": 1626006833638, \"type\": \"ms\"}, \"value\": false, \"tags\": {\"t0\": true}}]" + }; + char *sql5[1] = {0}; + for (int i = 0; i < 1; i++) { + sql5[i] = taosMemoryCalloc(1, 1024); + strncpy(sql5[i], sql4[i], 1023); + } + + pRes = taos_schemaless_insert(taos, (char **)sql5, sizeof(sql5) / sizeof(sql5[0]), TSDB_SML_JSON_PROTOCOL, + TSDB_SML_TIMESTAMP_NANO_SECONDS); + code = taos_errno(pRes); + if (code != 0) { + printf("%s result:%s\n", __FUNCTION__, taos_errstr(pRes)); + } else { + printf("%s result:success\n", __FUNCTION__); + } + taos_free_result(pRes); + + for (int i = 0; i < 1; i++) { + taosMemoryFree(sql5[i]); + } + ASSERT(code == 0); + taos_close(taos); return code; @@ -927,6 +957,31 @@ int sml_ts2164_Test() { return code; } +int sml_td22900_Test() { + TAOS *taos = taos_connect("localhost", "root", "taosdata", NULL, 0); + + TAOS_RES *pRes = + taos_query(taos, "CREATE DATABASE IF NOT EXISTS line_test BUFFER 384 MINROWS 1000 PAGES 256 PRECISION 'ns'"); + taos_free_result(pRes); + + const char *sql[] = { + "qddkgilwfu,id=qddkgilwfu_42383_49198,t0=t,t1=127i8 c4=9223372036854775807i64,c6=11.12345f32,c6=22.123456789f64 1626006833639" + }; + + pRes = taos_query(taos, "use line_test"); + taos_free_result(pRes); + + pRes = taos_schemaless_insert(taos, (char **)sql, sizeof(sql) / sizeof(sql[0]), TSDB_SML_LINE_PROTOCOL, + TSDB_SML_TIMESTAMP_MILLI_SECONDS); + + printf("%s result:%s\n", __FUNCTION__, taos_errstr(pRes)); + int code = taos_errno(pRes); + taos_free_result(pRes); + taos_close(taos); + + return code; +} + int sml_ttl_Test() { TAOS *taos = taos_connect("localhost", "root", "taosdata", NULL, 0); @@ -1096,16 +1151,18 @@ int main(int argc, char *argv[]) { } int ret = 0; - ret = sml_ts2385_Test(); // this test case need config sml table name using ./sml_test config_file - ASSERT(!ret); +// ret = sml_ts2385_Test(); // this test case need config sml table name using ./sml_test config_file +// ASSERT(!ret); // for(int i = 0; i < sizeof(str)/sizeof(str[0]); i++){ // printf("str:%s \t %d\n", str[i], smlCalTypeSum(str[i], strlen(str[i]))); // } // int ret = 0; - ret = sml_ttl_Test(); - ASSERT(!ret); +// ret = sml_ttl_Test(); +// ASSERT(!ret); ret = sml_ts2164_Test(); ASSERT(!ret); + ret = sml_td22900_Test(); + ASSERT(ret); ret = smlProcess_influx_Test(); ASSERT(!ret); ret = smlProcess_telnet_Test(); From 53a0ff0be381dcb5fd1578291871642dea36cb11 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Sat, 4 Mar 2023 16:19:45 +0800 Subject: [PATCH 087/174] refactor: add some logs. --- source/client/src/clientTmq.c | 40 ++++++++++++++-------- source/dnode/mnode/impl/src/mndConsumer.c | 2 +- source/dnode/mnode/impl/src/mndSubscribe.c | 4 +-- 3 files changed, 29 insertions(+), 17 deletions(-) diff --git a/source/client/src/clientTmq.c b/source/client/src/clientTmq.c index de338a4642..56d0148272 100644 --- a/source/client/src/clientTmq.c +++ b/source/client/src/clientTmq.c @@ -1076,7 +1076,7 @@ int32_t tmq_subscribe(tmq_t* tmq, const tmq_list_t* topic_list) { SCMSubscribeReq req = {0}; int32_t code = 0; - tscDebug("consumer:0x%" PRIx64 " subscribe %d topics", tmq->consumerId, sz); + tscDebug("consumer:0x%" PRIx64 " cgroup:%s, subscribe %d topics", tmq->consumerId, tmq->groupId, sz); req.consumerId = tmq->consumerId; tstrncpy(req.clientId, tmq->clientId, 256); @@ -1213,31 +1213,38 @@ int32_t tmqPollCb(void* param, SDataBuf* pMsg, int32_t code) { return -1; } - int32_t epoch = pParam->epoch; - int32_t vgId = pParam->vgId; + int32_t epoch = pParam->epoch; + int32_t vgId = pParam->vgId; + uint64_t requestId = pParam->requestId; + taosMemoryFree(pParam); + if (code != 0) { - tscWarn("msg discard from vgId:%d, epoch %d, since %s", vgId, epoch, terrstr()); + tscWarn("consumer:0x%"PRIx64" msg from vgId:%d discarded, epoch %d, since %s, reqId:0x%"PRIx64, tmq->consumerId, vgId, + epoch, tstrerror(code), requestId); + if (pMsg->pData) taosMemoryFree(pMsg->pData); if (pMsg->pEpSet) taosMemoryFree(pMsg->pEpSet); + // in case of consumer mismatch, wait for 500ms and retry if (code == TSDB_CODE_TMQ_CONSUMER_MISMATCH) { + taosMsleep(500); atomic_store_8(&tmq->status, TMQ_CONSUMER_STATUS__RECOVER); - goto CREATE_MSG_FAIL; - } - - if (code == TSDB_CODE_TQ_NO_COMMITTED_OFFSET) { + } else if (code == TSDB_CODE_TQ_NO_COMMITTED_OFFSET) { SMqPollRspWrapper* pRspWrapper = taosAllocateQitem(sizeof(SMqPollRspWrapper), DEF_QITEM, 0); if (pRspWrapper == NULL) { - tscWarn("msg discard from vgId:%d, epoch %d since out of memory", vgId, epoch); + tscWarn("consumer:0x%" PRIx64 " msg from vgId:%d discarded, epoch %d since out of memory, reqId:0x%" PRIx64, + tmq->consumerId, vgId, epoch, requestId); goto CREATE_MSG_FAIL; } + pRspWrapper->tmqRspType = TMQ_MSG_TYPE__END_RSP; /*pRspWrapper->vgHandle = pVg;*/ /*pRspWrapper->topicHandle = pTopic;*/ taosWriteQitem(tmq->mqueue, pRspWrapper); tsem_post(&tmq->rspSem); } + goto CREATE_MSG_FAIL; } @@ -1245,8 +1252,9 @@ int32_t tmqPollCb(void* param, SDataBuf* pMsg, int32_t code) { int32_t tmqEpoch = atomic_load_32(&tmq->epoch); if (msgEpoch < tmqEpoch) { // do not write into queue since updating epoch reset - tscWarn("msg discard from vgId:%d since from earlier epoch, rsp epoch %d, current epoch %d", vgId, msgEpoch, - tmqEpoch); + tscWarn("consumer:0x%" PRIx64 " msg discard from vgId:%d since from earlier epoch, rsp epoch %d, current epoch %d, reqId:0x%"PRIx64, + tmq->consumerId, vgId, msgEpoch, tmqEpoch, requestId); + tsem_post(&tmq->rspSem); taosMemoryFree(pMsg->pData); taosMemoryFree(pMsg->pEpSet); @@ -1254,7 +1262,8 @@ int32_t tmqPollCb(void* param, SDataBuf* pMsg, int32_t code) { } if (msgEpoch != tmqEpoch) { - tscWarn("mismatch rsp from vgId:%d, epoch %d, current epoch %d", vgId, msgEpoch, tmqEpoch); + tscWarn("consumer:0x%"PRIx64" mismatch rsp from vgId:%d, epoch %d, current epoch %d, reqId:0x%"PRIx64, tmq->consumerId, vgId, + msgEpoch, tmqEpoch, requestId); } // handle meta rsp @@ -1264,7 +1273,7 @@ int32_t tmqPollCb(void* param, SDataBuf* pMsg, int32_t code) { if (pRspWrapper == NULL) { taosMemoryFree(pMsg->pData); taosMemoryFree(pMsg->pEpSet); - tscWarn("msg discard from vgId:%d, epoch %d since out of memory", vgId, epoch); + tscWarn("consumer:0x%"PRIx64" msg discard from vgId:%d, epoch %d since out of memory", tmq->consumerId, vgId, epoch); goto CREATE_MSG_FAIL; } @@ -1299,16 +1308,19 @@ int32_t tmqPollCb(void* param, SDataBuf* pMsg, int32_t code) { taosMemoryFree(pMsg->pData); taosMemoryFree(pMsg->pEpSet); - tscDebug("consumer:0x%" PRIx64 ", put poll res into mqueue, total in queue:%d", tmq->consumerId, tmq->mqueue->numOfItems); + tscDebug("consumer:0x%" PRIx64 ", put poll res into mqueue, total in queue:%d, reqId:0x%" PRIx64, tmq->consumerId, + tmq->mqueue->numOfItems, requestId); taosWriteQitem(tmq->mqueue, pRspWrapper); tsem_post(&tmq->rspSem); return 0; + CREATE_MSG_FAIL: if (epoch == tmq->epoch) { atomic_store_32(&pVg->vgStatus, TMQ_VG_STATUS__IDLE); } + tsem_post(&tmq->rspSem); return -1; } diff --git a/source/dnode/mnode/impl/src/mndConsumer.c b/source/dnode/mnode/impl/src/mndConsumer.c index 50aa1bb8c7..90f5f8c839 100644 --- a/source/dnode/mnode/impl/src/mndConsumer.c +++ b/source/dnode/mnode/impl/src/mndConsumer.c @@ -26,7 +26,7 @@ #define MND_CONSUMER_VER_NUMBER 1 #define MND_CONSUMER_RESERVE_SIZE 64 -#define MND_CONSUMER_LOST_HB_CNT 3 +#define MND_CONSUMER_LOST_HB_CNT 6 #define MND_CONSUMER_LOST_CLEAR_THRESHOLD 43200 static int32_t mqRebInExecCnt = 0; diff --git a/source/dnode/mnode/impl/src/mndSubscribe.c b/source/dnode/mnode/impl/src/mndSubscribe.c index fcd68d9001..648014d97e 100644 --- a/source/dnode/mnode/impl/src/mndSubscribe.c +++ b/source/dnode/mnode/impl/src/mndSubscribe.c @@ -296,7 +296,7 @@ static int32_t mndDoRebalance(SMnode *pMnode, const SMqRebInputObj *pInput, SMqR .pVgEp = pVgEp, }; taosHashPut(pHash, &pVgEp->vgId, sizeof(int32_t), &outputVg, sizeof(SMqRebOutputVg)); - mInfo("sub:%s mq rebalance remove vgId:%d from consumer:%" PRIx64 ",(first scan)", sub, pVgEp->vgId, + mInfo("sub:%s mq rebalance remove vgId:%d from consumer:0x%" PRIx64 ",(first scan)", sub, pVgEp->vgId, pConsumerEp->consumerId); } imbCnt++; @@ -311,7 +311,7 @@ static int32_t mndDoRebalance(SMnode *pMnode, const SMqRebInputObj *pInput, SMqR .pVgEp = pVgEp, }; taosHashPut(pHash, &pVgEp->vgId, sizeof(int32_t), &outputVg, sizeof(SMqRebOutputVg)); - mInfo("sub:%s mq rebalance remove vgId:%d from consumer:%" PRIx64 ",(first scan)", sub, pVgEp->vgId, + mInfo("sub:%s mq rebalance remove vgId:%d from consumer:0x%" PRIx64 ",(first scan)", sub, pVgEp->vgId, pConsumerEp->consumerId); } } From c159fd07471c6a36c42bbcdfdef2bc2b84b99cc1 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Sat, 4 Mar 2023 16:37:44 +0800 Subject: [PATCH 088/174] refactor: disable sleep temporarily. --- source/client/src/clientTmq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/client/src/clientTmq.c b/source/client/src/clientTmq.c index 56d0148272..7a31ab572c 100644 --- a/source/client/src/clientTmq.c +++ b/source/client/src/clientTmq.c @@ -1228,7 +1228,7 @@ int32_t tmqPollCb(void* param, SDataBuf* pMsg, int32_t code) { // in case of consumer mismatch, wait for 500ms and retry if (code == TSDB_CODE_TMQ_CONSUMER_MISMATCH) { - taosMsleep(500); +// taosMsleep(500); atomic_store_8(&tmq->status, TMQ_CONSUMER_STATUS__RECOVER); } else if (code == TSDB_CODE_TQ_NO_COMMITTED_OFFSET) { SMqPollRspWrapper* pRspWrapper = taosAllocateQitem(sizeof(SMqPollRspWrapper), DEF_QITEM, 0); From 33f2d076052013ae0d5cab38b5acac5304c84eb1 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Sat, 4 Mar 2023 16:38:50 +0800 Subject: [PATCH 089/174] refactor: sleep for a while. --- source/client/src/clientTmq.c | 1 + 1 file changed, 1 insertion(+) diff --git a/source/client/src/clientTmq.c b/source/client/src/clientTmq.c index 7a31ab572c..d08cabd27e 100644 --- a/source/client/src/clientTmq.c +++ b/source/client/src/clientTmq.c @@ -1918,6 +1918,7 @@ TAOS_RES* tmq_consumer_poll(tmq_t* tmq, int64_t timeout) { // in no topic status, delayed task also need to be processed if (atomic_load_8(&tmq->status) == TMQ_CONSUMER_STATUS__INIT) { tscDebug("consumer:0x%" PRIx64 " poll return since consumer is init", tmq->consumerId); + // sleep for a while return NULL; } From 3bfd156616fdbf8ae237bee916c5d90d89f07b9f Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Sat, 4 Mar 2023 17:37:38 +0800 Subject: [PATCH 090/174] fix:[TD-22898]:modify schema if schema change --- source/client/src/clientSml.c | 3 +- source/client/src/clientSmlJson.c | 82 +++++++------------------- source/client/src/clientSmlLine.c | 89 ++++++++--------------------- source/client/src/clientSmlTelnet.c | 85 +++++++-------------------- utils/test/c/sml_test.c | 46 ++++++++++++++- 5 files changed, 111 insertions(+), 194 deletions(-) diff --git a/source/client/src/clientSml.c b/source/client/src/clientSml.c index 3314932272..ca76579b9a 100644 --- a/source/client/src/clientSml.c +++ b/source/client/src/clientSml.c @@ -817,6 +817,7 @@ static int32_t smlModifyDBSchemas(SSmlHandle *info) { if (i < pTableMeta->tableInfo.numOfColumns) { taosArrayPush(pColumns, &field); } else { + uError("SML:0x%" PRIx64 "field name:%s, bytes:%d", info->id, field.name, field.bytes); taosArrayPush(pTags, &field); } } @@ -1073,7 +1074,6 @@ void smlDestroyInfo(SSmlHandle *info) { taosArrayDestroy(info->valueJsonArray); taosArrayDestroy(info->preLineTagKV); - taosArrayDestroy(info->maxTagKVs); taosArrayDestroy(info->preLineColKV); if (!info->dataFormat) { @@ -1117,7 +1117,6 @@ SSmlHandle *smlBuildSmlInfo(TAOS *taos) { info->tagJsonArray = taosArrayInit(8, POINTER_BYTES); info->valueJsonArray = taosArrayInit(8, POINTER_BYTES); info->preLineTagKV = taosArrayInit(8, sizeof(SSmlKv)); - info->maxTagKVs = taosArrayInit(8, sizeof(SSmlKv)); info->preLineColKV = taosArrayInit(8, sizeof(SSmlKv)); if (NULL == info->pVgHash || NULL == info->childTables || NULL == info->superTables) { diff --git a/source/client/src/clientSmlJson.c b/source/client/src/clientSmlJson.c index b9a1cd00a1..22fd762960 100644 --- a/source/client/src/clientSmlJson.c +++ b/source/client/src/clientSmlJson.c @@ -683,9 +683,6 @@ static int32_t smlParseTagsFromJSON(SSmlHandle *info, cJSON *tags, SSmlLineInfo int cnt = 0; SArray *preLineKV = info->preLineTagKV; - SArray *maxKVs = info->maxTagKVs; - bool isSuperKVInit = true; - SArray *superKV = NULL; if (info->dataFormat) { if (unlikely(!isSameMeasure)) { SSmlSTableMeta **tmp = (SSmlSTableMeta **)taosHashGet(info->superTables, elements->measure, elements->measureLen); @@ -701,17 +698,15 @@ static int32_t smlParseTagsFromJSON(SSmlHandle *info, cJSON *tags, SSmlLineInfo sMeta->tableMeta = pTableMeta; taosHashPut(info->superTables, elements->measure, elements->measureLen, &sMeta, POINTER_BYTES); tmp = &sMeta; + for(int i = pTableMeta->tableInfo.numOfColumns; i < pTableMeta->tableInfo.numOfTags + pTableMeta->tableInfo.numOfColumns; i++){ + SSchema *tag = pTableMeta->schema + i; + SSmlKv kv = {.key = tag->name, .keyLen = strlen(tag->name), .type = tag->type, .length = (tag->bytes - VARSTR_HEADER_SIZE) / TSDB_NCHAR_SIZE }; + taosArrayPush(sMeta->tags, &kv); + } } info->currSTableMeta = (*tmp)->tableMeta; - superKV = (*tmp)->tags; - - if (unlikely(taosArrayGetSize(superKV) == 0)) { - isSuperKVInit = false; - } - taosArrayClear(maxKVs); + info->maxTagKVs = (*tmp)->tags; } - } else { - taosArrayClear(maxKVs); } taosArrayClear(preLineKV); @@ -747,58 +742,21 @@ static int32_t smlParseTagsFromJSON(SSmlHandle *info, cJSON *tags, SSmlLineInfo return TSDB_CODE_SUCCESS; } - if (isSameMeasure) { - if (unlikely(cnt >= taosArrayGetSize(maxKVs))) { - info->dataFormat = false; - info->reRun = true; - return TSDB_CODE_SUCCESS; - } - SSmlKv *maxKV = (SSmlKv *)taosArrayGet(maxKVs, cnt); - if (unlikely(kv.length > maxKV->length)) { - maxKV->length = kv.length; - SSmlSTableMeta **tableMeta = - (SSmlSTableMeta **)taosHashGet(info->superTables, elements->measure, elements->measureLen); - if (unlikely(NULL == tableMeta)) { - uError("SML:0x%" PRIx64 " NULL == tableMeta", info->id); - return TSDB_CODE_SML_INTERNAL_ERROR; - } - - SSmlKv *oldKV = (SSmlKv *)taosArrayGet((*tableMeta)->tags, cnt); - oldKV->length = kv.length; - info->needModifySchema = true; - } - if (unlikely(!IS_SAME_KEY)) { - info->dataFormat = false; - info->reRun = true; - return TSDB_CODE_SUCCESS; - } - } else { - if (isSuperKVInit) { - if (unlikely(cnt >= taosArrayGetSize(superKV))) { - info->dataFormat = false; - info->reRun = true; - return TSDB_CODE_SUCCESS; - } - SSmlKv *maxKV = (SSmlKv *)taosArrayGet(superKV, cnt); - if (unlikely(kv.length > maxKV->length)) { - maxKV->length = kv.length; - } else { - kv.length = maxKV->length; - } - info->needModifySchema = true; - - if (unlikely(!IS_SAME_KEY)) { - info->dataFormat = false; - info->reRun = true; - return TSDB_CODE_SUCCESS; - } - } else { - taosArrayPush(superKV, &kv); - } - taosArrayPush(maxKVs, &kv); + if (unlikely(cnt >= taosArrayGetSize(info->maxTagKVs))) { + info->dataFormat = false; + info->reRun = true; + return TSDB_CODE_SUCCESS; + } + SSmlKv *maxKV = (SSmlKv *)taosArrayGet(info->maxTagKVs, cnt); + if (unlikely(!IS_SAME_KEY)) { + info->dataFormat = false; + info->reRun = true; + return TSDB_CODE_SUCCESS; + } + if (unlikely(kv.length > maxKV->length)) { + maxKV->length = kv.length; + info->needModifySchema = true; } - } else { - taosArrayPush(maxKVs, &kv); } taosArrayPush(preLineKV, &kv); cnt++; diff --git a/source/client/src/clientSmlLine.c b/source/client/src/clientSmlLine.c index a2f752edb9..c2fe69c875 100644 --- a/source/client/src/clientSmlLine.c +++ b/source/client/src/clientSmlLine.c @@ -144,14 +144,11 @@ static int32_t smlParseTagKv(SSmlHandle *info, char **sql, char *sqlEnd, SSmlLin int cnt = 0; SArray *preLineKV = info->preLineTagKV; - SArray *maxKVs = info->maxTagKVs; - bool isSuperKVInit = true; - SArray *superKV = NULL; if (info->dataFormat) { if (unlikely(!isSameMeasure)) { SSmlSTableMeta **tmp = (SSmlSTableMeta **)taosHashGet(info->superTables, currElement->measure, currElement->measureLen); - SSmlSTableMeta *sMeta = NULL; + if (unlikely(tmp == NULL)) { STableMeta *pTableMeta = smlGetMeta(info, currElement->measure, currElement->measureLen); if (pTableMeta == NULL) { @@ -159,21 +156,20 @@ static int32_t smlParseTagKv(SSmlHandle *info, char **sql, char *sqlEnd, SSmlLin info->reRun = true; return TSDB_CODE_SUCCESS; } - sMeta = smlBuildSTableMeta(info->dataFormat); + SSmlSTableMeta *sMeta = smlBuildSTableMeta(info->dataFormat); sMeta->tableMeta = pTableMeta; taosHashPut(info->superTables, currElement->measure, currElement->measureLen, &sMeta, POINTER_BYTES); tmp = &sMeta; + + for(int i = pTableMeta->tableInfo.numOfColumns; i < pTableMeta->tableInfo.numOfTags + pTableMeta->tableInfo.numOfColumns; i++){ + SSchema *tag = pTableMeta->schema + i; + SSmlKv kv = {.key = tag->name, .keyLen = strlen(tag->name), .type = tag->type, .length = (tag->bytes - VARSTR_HEADER_SIZE) / TSDB_NCHAR_SIZE }; + taosArrayPush(sMeta->tags, &kv); + } } info->currSTableMeta = (*tmp)->tableMeta; - superKV = (*tmp)->tags; - - if (unlikely(taosArrayGetSize(superKV) == 0)) { - isSuperKVInit = false; - } - taosArrayClear(maxKVs); + info->maxTagKVs = (*tmp)->tags; } - } else { - taosArrayClear(maxKVs); } taosArrayClear(preLineKV); @@ -252,58 +248,23 @@ static int32_t smlParseTagKv(SSmlHandle *info, char **sql, char *sqlEnd, SSmlLin return TSDB_CODE_SUCCESS; } - if (isSameMeasure) { - if (unlikely(cnt >= taosArrayGetSize(maxKVs))) { - info->dataFormat = false; - info->reRun = true; - return TSDB_CODE_SUCCESS; - } - SSmlKv *maxKV = (SSmlKv *)taosArrayGet(maxKVs, cnt); - if (unlikely(kv.length > maxKV->length)) { - maxKV->length = kv.length; - SSmlSTableMeta **tableMeta = - (SSmlSTableMeta **)taosHashGet(info->superTables, currElement->measure, currElement->measureLen); - if (unlikely(NULL == tableMeta)) { - uError("SML:0x%" PRIx64 " NULL == tableMeta", info->id); - return TSDB_CODE_SML_INTERNAL_ERROR; - } - - SSmlKv *oldKV = (SSmlKv *)taosArrayGet((*tableMeta)->tags, cnt); - oldKV->length = kv.length; - info->needModifySchema = true; - } - if (unlikely(!IS_SAME_KEY)) { - info->dataFormat = false; - info->reRun = true; - return TSDB_CODE_SUCCESS; - } - } else { - if (isSuperKVInit) { - if (unlikely(cnt >= taosArrayGetSize(superKV))) { - info->dataFormat = false; - info->reRun = true; - return TSDB_CODE_SUCCESS; - } - SSmlKv *maxKV = (SSmlKv *)taosArrayGet(superKV, cnt); - if (unlikely(kv.length > maxKV->length)) { - maxKV->length = kv.length; - } else { - kv.length = maxKV->length; - } - info->needModifySchema = true; - - if (unlikely(!IS_SAME_KEY)) { - info->dataFormat = false; - info->reRun = true; - return TSDB_CODE_SUCCESS; - } - } else { - taosArrayPush(superKV, &kv); - } - taosArrayPush(maxKVs, &kv); + if (unlikely(cnt >= taosArrayGetSize(info->maxTagKVs))) { + info->dataFormat = false; + info->reRun = true; + return TSDB_CODE_SUCCESS; + } + SSmlKv *maxKV = (SSmlKv *)taosArrayGet(info->maxTagKVs, cnt); + + if (unlikely(!IS_SAME_KEY)) { + info->dataFormat = false; + info->reRun = true; + return TSDB_CODE_SUCCESS; + } + + if (unlikely(kv.length > maxKV->length)) { + maxKV->length = kv.length; + info->needModifySchema = true; } - } else { - taosArrayPush(maxKVs, &kv); } taosArrayPush(preLineKV, &kv); diff --git a/source/client/src/clientSmlTelnet.c b/source/client/src/clientSmlTelnet.c index ab071305fa..9201412cbd 100644 --- a/source/client/src/clientSmlTelnet.c +++ b/source/client/src/clientSmlTelnet.c @@ -79,13 +79,10 @@ static int32_t smlParseTelnetTags(SSmlHandle *info, char *data, char *sqlEnd, SS int cnt = 0; SArray *preLineKV = info->preLineTagKV; - SArray *maxKVs = info->maxTagKVs; - bool isSuperKVInit = true; - SArray *superKV = NULL; if (info->dataFormat) { if (!isSameMeasure) { SSmlSTableMeta **tmp = (SSmlSTableMeta **)taosHashGet(info->superTables, elements->measure, elements->measureLen); - SSmlSTableMeta *sMeta = NULL; + SSmlSTableMeta * sMeta = NULL; if (unlikely(tmp == NULL)) { STableMeta *pTableMeta = smlGetMeta(info, elements->measure, elements->measureLen); if (pTableMeta == NULL) { @@ -97,17 +94,15 @@ static int32_t smlParseTelnetTags(SSmlHandle *info, char *data, char *sqlEnd, SS sMeta->tableMeta = pTableMeta; taosHashPut(info->superTables, elements->measure, elements->measureLen, &sMeta, POINTER_BYTES); tmp = &sMeta; + for(int i = pTableMeta->tableInfo.numOfColumns; i < pTableMeta->tableInfo.numOfTags + pTableMeta->tableInfo.numOfColumns; i++){ + SSchema *tag = pTableMeta->schema + i; + SSmlKv kv = {.key = tag->name, .keyLen = strlen(tag->name), .type = tag->type, .length = (tag->bytes - VARSTR_HEADER_SIZE) / TSDB_NCHAR_SIZE }; + taosArrayPush(sMeta->tags, &kv); + } } info->currSTableMeta = (*tmp)->tableMeta; - superKV = (*tmp)->tags; - - if (unlikely(taosArrayGetSize(superKV) == 0)) { - isSuperKVInit = false; - } - taosArrayClear(maxKVs); + info->maxTagKVs = (*tmp)->tags; } - } else { - taosArrayClear(maxKVs); } taosArrayClear(preLineKV); @@ -175,59 +170,21 @@ static int32_t smlParseTelnetTags(SSmlHandle *info, char *data, char *sqlEnd, SS info->reRun = true; return TSDB_CODE_SUCCESS; } - - if (isSameMeasure) { - if (unlikely(cnt >= taosArrayGetSize(maxKVs))) { - info->dataFormat = false; - info->reRun = true; - return TSDB_CODE_SUCCESS; - } - SSmlKv *maxKV = (SSmlKv *)taosArrayGet(maxKVs, cnt); - if (unlikely(kv.length > maxKV->length)) { - maxKV->length = kv.length; - SSmlSTableMeta **tableMeta = - (SSmlSTableMeta **)taosHashGet(info->superTables, elements->measure, elements->measureLen); - if (unlikely(NULL == tableMeta)) { - uError("SML:0x%" PRIx64 " NULL == tableMeta", info->id); - return TSDB_CODE_SML_INTERNAL_ERROR; - } - - SSmlKv *oldKV = (SSmlKv *)taosArrayGet((*tableMeta)->tags, cnt); - oldKV->length = kv.length; - info->needModifySchema = true; - } - if (unlikely(!IS_SAME_KEY)) { - info->dataFormat = false; - info->reRun = true; - return TSDB_CODE_SUCCESS; - } - } else { - if (isSuperKVInit) { - if (unlikely(cnt >= taosArrayGetSize(superKV))) { - info->dataFormat = false; - info->reRun = true; - return TSDB_CODE_SUCCESS; - } - SSmlKv *maxKV = (SSmlKv *)taosArrayGet(superKV, cnt); - if (unlikely(kv.length > maxKV->length)) { - maxKV->length = kv.length; - } else { - kv.length = maxKV->length; - } - info->needModifySchema = true; - - if (unlikely(!IS_SAME_KEY)) { - info->dataFormat = false; - info->reRun = true; - return TSDB_CODE_SUCCESS; - } - } else { - taosArrayPush(superKV, &kv); - } - taosArrayPush(maxKVs, &kv); + if (unlikely(cnt >= taosArrayGetSize(info->maxTagKVs))) { + info->dataFormat = false; + info->reRun = true; + return TSDB_CODE_SUCCESS; + } + SSmlKv *maxKV = (SSmlKv *)taosArrayGet(info->maxTagKVs, cnt); + if (unlikely(!IS_SAME_KEY)) { + info->dataFormat = false; + info->reRun = true; + return TSDB_CODE_SUCCESS; + } + if (unlikely(kv.length > maxKV->length)) { + maxKV->length = kv.length; + info->needModifySchema = true; } - } else { - taosArrayPush(maxKVs, &kv); } taosArrayPush(preLineKV, &kv); cnt++; diff --git a/utils/test/c/sml_test.c b/utils/test/c/sml_test.c index b8d018fc82..7441184271 100644 --- a/utils/test/c/sml_test.c +++ b/utils/test/c/sml_test.c @@ -957,6 +957,46 @@ int sml_ts2164_Test() { return code; } +int sml_td22898_Test() { + TAOS *taos = taos_connect("localhost", "root", "taosdata", NULL, 0); + + TAOS_RES *pRes = + taos_query(taos, "CREATE DATABASE IF NOT EXISTS line_test BUFFER 384 MINROWS 1000 PAGES 256 PRECISION 'ns'"); + taos_free_result(pRes); + + const char *sql[] = { + "svlzxdfutx,id=nyavpjyfas,t0=t,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"binaryTagValue\",t8=L\"ncharTagValue\" c0=t,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"binaryColValue\",c8=L\"ncharColValue\",c9=7u64 1626006833639" + }; + + pRes = taos_query(taos, "use line_test"); + taos_free_result(pRes); + + pRes = taos_schemaless_insert(taos, (char **)sql, sizeof(sql) / sizeof(sql[0]), TSDB_SML_LINE_PROTOCOL, + TSDB_SML_TIMESTAMP_MILLI_SECONDS); + + printf("%s result:%s\n", __FUNCTION__, taos_errstr(pRes)); + int code = taos_errno(pRes); + taos_free_result(pRes); + + const char *sql1[] = { + "svlzxdfutx,id=nyavpjyfas,t0=True,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=\"tgqkvsws\",t8=L\"ncharTagValue\" c0=f,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=\"htvnnldm\",c8=L\"ncharColValue\",c9=7u64 1626006833639" + }; + + pRes = taos_schemaless_insert(taos, (char **)sql1, sizeof(sql1) / sizeof(sql1[0]), TSDB_SML_LINE_PROTOCOL, + TSDB_SML_TIMESTAMP_MILLI_SECONDS); + + printf("%s result:%s\n", __FUNCTION__, taos_errstr(pRes)); + code = taos_errno(pRes); + taos_free_result(pRes); + + pRes = taos_query(taos, "select * from svlzxdfutx"); + taos_free_result(pRes); + + taos_close(taos); + + return code; +} + int sml_td22900_Test() { TAOS *taos = taos_connect("localhost", "root", "taosdata", NULL, 0); @@ -1157,10 +1197,12 @@ int main(int argc, char *argv[]) { // printf("str:%s \t %d\n", str[i], smlCalTypeSum(str[i], strlen(str[i]))); // } // int ret = 0; -// ret = sml_ttl_Test(); -// ASSERT(!ret); + ret = sml_ttl_Test(); + ASSERT(!ret); ret = sml_ts2164_Test(); ASSERT(!ret); + ret = sml_td22898_Test(); + ASSERT(!ret); ret = sml_td22900_Test(); ASSERT(ret); ret = smlProcess_influx_Test(); From 6fe2a9b10dff26679ebc6833ecc0d97c15c5fb28 Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Sat, 4 Mar 2023 18:09:40 +0800 Subject: [PATCH 091/174] add debug --- source/libs/transport/src/transCli.c | 60 +++++++++++++++++++++++++++- 1 file changed, 59 insertions(+), 1 deletion(-) diff --git a/source/libs/transport/src/transCli.c b/source/libs/transport/src/transCli.c index 274d153adc..a2516f6ff7 100644 --- a/source/libs/transport/src/transCli.c +++ b/source/libs/transport/src/transCli.c @@ -13,7 +13,6 @@ */ #include "transComm.h" -#include "tutil.h" typedef struct { int32_t numOfConn; @@ -121,6 +120,9 @@ typedef struct SCliThrd { SCliMsg* stopMsg; bool quit; + + int newConnCount; + SHashObj* msgCount; } SCliThrd; typedef struct SCliObj { @@ -423,6 +425,21 @@ void cliHandleResp(SCliConn* conn) { tDebug("%s conn %p ref by app", CONN_GET_INST_LABEL(conn), conn); } + // if (TMSG_INFO(pHead->msgType - 1) != 0) { + // char buf[128] = {0}; + // sprintf(buf, "%s", TMSG_INFO(pHead->msgType - 1)); + // int* count = taosHashGet(pThrd->msgCount, TMSG_INFO(pHead->msgType - 1), strlen(TMSG_INFO(pHead->msgType - 1))); + // if (NULL == 0) { + // int localCount = 1; + // taosHashPut(pThrd->msgCount, TMSG_INFO(pHead->msgType - 1), strlen(TMSG_INFO(pHead->msgType - 1)), &localCount, + // sizeof(localCount)); + // } else { + // int localCount = *count - 1; + // taosHashPut(pThrd->msgCount, TMSG_INFO(pHead->msgType - 1), strlen(TMSG_INFO(pHead->msgType - 1)), &localCount, + // sizeof(localCount)); + // } + // } + STraceId* trace = &transMsg.info.traceId; tGDebug("%s conn %p %s received from %s, local info:%s, len:%d, code str:%s", CONN_GET_INST_LABEL(conn), conn, TMSG_INFO(pHead->msgType), conn->dst, conn->src, pHead->msgLen, tstrerror(transMsg.code)); @@ -1098,6 +1115,19 @@ void cliSend(SCliConn* pConn) { msgLen = (int32_t)ntohl((uint32_t)(pHead->msgLen)); } + if (TMSG_INFO(pHead->msgType) != 0) { + char buf[128] = {0}; + sprintf(buf, "%s", TMSG_INFO(pHead->msgType)); + int* count = taosHashGet(pThrd->msgCount, buf, strlen(buf)); + if (NULL == 0) { + int localCount = 1; + taosHashPut(pThrd->msgCount, buf, strlen(buf), &localCount, sizeof(localCount)); + } else { + int localCount = *count + 1; + taosHashPut(pThrd->msgCount, buf, strlen(buf), &localCount, sizeof(localCount)); + } + } + tGDebug("%s conn %p %s is sent to %s, local info %s, len:%d", CONN_GET_INST_LABEL(pConn), pConn, TMSG_INFO(pHead->msgType), pConn->dst, pConn->src, msgLen); @@ -1173,6 +1203,7 @@ static void cliHandleBatchReq(SCliBatch* pBatch, SCliThrd* pThrd) { addr.sin_port = (uint16_t)htons(pList->port); tTrace("%s conn %p try to connect to %s", pTransInst->label, conn, pList->dst); + pThrd->newConnCount++; int32_t fd = taosCreateSocketWithTimeout(TRANS_CONN_TIMEOUT * 10); if (fd == -1) { tError("%s conn %p failed to create socket, reason:%s", transLabel(pTransInst), conn, @@ -1546,6 +1577,7 @@ void cliHandleReq(SCliMsg* pMsg, SCliThrd* pThrd) { addr.sin_port = (uint16_t)htons(port); tGTrace("%s conn %p try to connect to %s", pTransInst->label, conn, conn->ip); + pThrd->newConnCount++; int32_t fd = taosCreateSocketWithTimeout(TRANS_CONN_TIMEOUT * 4); if (fd == -1) { tGError("%s conn %p failed to create socket, reason:%s", transLabel(pTransInst), conn, @@ -1735,6 +1767,17 @@ static void cliAsyncCb(uv_async_t* handle) { QUEUE_MOVE(&item->qmsg, &wq); taosThreadMutexUnlock(&item->mtx); + void* pIter = taosHashIterate(pThrd->msgCount, NULL); + while (pIter != NULL) { + int* count = pIter; + size_t len = 0; + char* key = taosHashGetKey(pIter, &len); + tDebug("key: %s count: %d", key, *count); + + pIter = taosHashIterate(pThrd->msgCount, pIter); + } + tDebug("conn count: %d", pThrd->newConnCount); + int8_t supportBatch = pTransInst->supportBatch; if (supportBatch == 0) { cliNoBatchDealReq(&wq, pThrd); @@ -1969,6 +2012,9 @@ static SCliThrd* createThrdObj(void* trans) { pThrd->batchCache = taosHashInit(8, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_NO_LOCK); pThrd->quit = false; + + pThrd->newConnCount = 0; + pThrd->msgCount = taosHashInit(8, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), false, HASH_NO_LOCK); return pThrd; } static void destroyThrdObj(SCliThrd* pThrd) { @@ -2316,6 +2362,18 @@ int cliAppCb(SCliConn* pConn, STransMsg* pResp, SCliMsg* pMsg) { } } + if ((pResp->msgType - 1) > 0) { + char buf[128] = {0}; + sprintf(buf, "%s", TMSG_INFO(pResp->msgType - 1)); + int* count = taosHashGet(pThrd->msgCount, buf, strlen(buf)); + if (NULL == 0) { + int localCount = 0; + taosHashPut(pThrd->msgCount, buf, strlen(buf), &localCount, sizeof(localCount)); + } else { + int localCount = *count - 1; + taosHashPut(pThrd->msgCount, buf, strlen(buf), &localCount, sizeof(localCount)); + } + } if (pCtx->pSem != NULL) { tGTrace("%s conn %p(sync) handle resp", CONN_GET_INST_LABEL(pConn), pConn); if (pCtx->pRsp == NULL) { From 4827c25a6169fff230ebe2a29fbc30ad0987162f Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Sat, 4 Mar 2023 18:16:41 +0800 Subject: [PATCH 092/174] fix:give error if col is same in schemless & fix json parse error in TD-22903 --- source/client/inc/clientSml.h | 2 +- source/client/src/clientSml.c | 3 - source/client/src/clientSmlJson.c | 4 +- source/client/src/clientSmlLine.c | 115 +++++++++------------------- source/client/src/clientSmlTelnet.c | 4 +- 5 files changed, 42 insertions(+), 86 deletions(-) diff --git a/source/client/inc/clientSml.h b/source/client/inc/clientSml.h index 3dcba673bf..d8d41d8be6 100644 --- a/source/client/inc/clientSml.h +++ b/source/client/inc/clientSml.h @@ -190,7 +190,7 @@ typedef struct { // SArray *preLineTagKV; SArray *maxTagKVs; - SArray *preLineColKV; + SArray *masColKVs; SSmlLineInfo preLine; STableMeta *currSTableMeta; diff --git a/source/client/src/clientSml.c b/source/client/src/clientSml.c index ca76579b9a..c438196e71 100644 --- a/source/client/src/clientSml.c +++ b/source/client/src/clientSml.c @@ -817,7 +817,6 @@ static int32_t smlModifyDBSchemas(SSmlHandle *info) { if (i < pTableMeta->tableInfo.numOfColumns) { taosArrayPush(pColumns, &field); } else { - uError("SML:0x%" PRIx64 "field name:%s, bytes:%d", info->id, field.name, field.bytes); taosArrayPush(pTags, &field); } } @@ -1074,7 +1073,6 @@ void smlDestroyInfo(SSmlHandle *info) { taosArrayDestroy(info->valueJsonArray); taosArrayDestroy(info->preLineTagKV); - taosArrayDestroy(info->preLineColKV); if (!info->dataFormat) { for (int i = 0; i < info->lineNum; i++) { @@ -1117,7 +1115,6 @@ SSmlHandle *smlBuildSmlInfo(TAOS *taos) { info->tagJsonArray = taosArrayInit(8, POINTER_BYTES); info->valueJsonArray = taosArrayInit(8, POINTER_BYTES); info->preLineTagKV = taosArrayInit(8, sizeof(SSmlKv)); - info->preLineColKV = taosArrayInit(8, sizeof(SSmlKv)); if (NULL == info->pVgHash || NULL == info->childTables || NULL == info->superTables) { uError("create SSmlHandle failed"); diff --git a/source/client/src/clientSmlJson.c b/source/client/src/clientSmlJson.c index 22fd762960..da82d43950 100644 --- a/source/client/src/clientSmlJson.c +++ b/source/client/src/clientSmlJson.c @@ -686,7 +686,7 @@ static int32_t smlParseTagsFromJSON(SSmlHandle *info, cJSON *tags, SSmlLineInfo if (info->dataFormat) { if (unlikely(!isSameMeasure)) { SSmlSTableMeta **tmp = (SSmlSTableMeta **)taosHashGet(info->superTables, elements->measure, elements->measureLen); - SSmlSTableMeta *sMeta = NULL; + SSmlSTableMeta *sMeta = NULL; if (unlikely(tmp == NULL)) { STableMeta *pTableMeta = smlGetMeta(info, elements->measure, elements->measureLen); if (pTableMeta == NULL) { @@ -697,12 +697,12 @@ static int32_t smlParseTagsFromJSON(SSmlHandle *info, cJSON *tags, SSmlLineInfo sMeta = smlBuildSTableMeta(info->dataFormat); sMeta->tableMeta = pTableMeta; taosHashPut(info->superTables, elements->measure, elements->measureLen, &sMeta, POINTER_BYTES); - tmp = &sMeta; for(int i = pTableMeta->tableInfo.numOfColumns; i < pTableMeta->tableInfo.numOfTags + pTableMeta->tableInfo.numOfColumns; i++){ SSchema *tag = pTableMeta->schema + i; SSmlKv kv = {.key = tag->name, .keyLen = strlen(tag->name), .type = tag->type, .length = (tag->bytes - VARSTR_HEADER_SIZE) / TSDB_NCHAR_SIZE }; taosArrayPush(sMeta->tags, &kv); } + tmp = &sMeta; } info->currSTableMeta = (*tmp)->tableMeta; info->maxTagKVs = (*tmp)->tags; diff --git a/source/client/src/clientSmlLine.c b/source/client/src/clientSmlLine.c index c2fe69c875..66f1316cd5 100644 --- a/source/client/src/clientSmlLine.c +++ b/source/client/src/clientSmlLine.c @@ -149,6 +149,7 @@ static int32_t smlParseTagKv(SSmlHandle *info, char **sql, char *sqlEnd, SSmlLin SSmlSTableMeta **tmp = (SSmlSTableMeta **)taosHashGet(info->superTables, currElement->measure, currElement->measureLen); + SSmlSTableMeta *sMeta = NULL; if (unlikely(tmp == NULL)) { STableMeta *pTableMeta = smlGetMeta(info, currElement->measure, currElement->measureLen); if (pTableMeta == NULL) { @@ -156,16 +157,15 @@ static int32_t smlParseTagKv(SSmlHandle *info, char **sql, char *sqlEnd, SSmlLin info->reRun = true; return TSDB_CODE_SUCCESS; } - SSmlSTableMeta *sMeta = smlBuildSTableMeta(info->dataFormat); + sMeta = smlBuildSTableMeta(info->dataFormat); sMeta->tableMeta = pTableMeta; taosHashPut(info->superTables, currElement->measure, currElement->measureLen, &sMeta, POINTER_BYTES); - tmp = &sMeta; - for(int i = pTableMeta->tableInfo.numOfColumns; i < pTableMeta->tableInfo.numOfTags + pTableMeta->tableInfo.numOfColumns; i++){ SSchema *tag = pTableMeta->schema + i; SSmlKv kv = {.key = tag->name, .keyLen = strlen(tag->name), .type = tag->type, .length = (tag->bytes - VARSTR_HEADER_SIZE) / TSDB_NCHAR_SIZE }; taosArrayPush(sMeta->tags, &kv); } + tmp = &sMeta; } info->currSTableMeta = (*tmp)->tableMeta; info->maxTagKVs = (*tmp)->tags; @@ -305,9 +305,6 @@ static int32_t smlParseTagKv(SSmlHandle *info, char **sql, char *sqlEnd, SSmlLin static int32_t smlParseColKv(SSmlHandle *info, char **sql, char *sqlEnd, SSmlLineInfo *currElement, bool isSameMeasure, bool isSameCTable) { int cnt = 0; - SArray *preLineKV = info->preLineColKV; - bool isSuperKVInit = true; - SArray *superKV = NULL; if (info->dataFormat) { if (unlikely(!isSameCTable)) { SSmlTableInfo **oneTable = @@ -322,7 +319,6 @@ static int32_t smlParseColKv(SSmlHandle *info, char **sql, char *sqlEnd, SSmlLin if (unlikely(!isSameMeasure)) { SSmlSTableMeta **tmp = (SSmlSTableMeta **)taosHashGet(info->superTables, currElement->measure, currElement->measureLen); - SSmlSTableMeta *sMeta = NULL; if (unlikely(tmp == NULL)) { STableMeta *pTableMeta = smlGetMeta(info, currElement->measure, currElement->measureLen); if (pTableMeta == NULL) { @@ -330,17 +326,23 @@ static int32_t smlParseColKv(SSmlHandle *info, char **sql, char *sqlEnd, SSmlLin info->reRun = true; return TSDB_CODE_SUCCESS; } - sMeta = smlBuildSTableMeta(info->dataFormat); - sMeta->tableMeta = pTableMeta; - taosHashPut(info->superTables, currElement->measure, currElement->measureLen, &sMeta, POINTER_BYTES); - tmp = &sMeta; + *tmp = smlBuildSTableMeta(info->dataFormat); + (*tmp)->tableMeta = pTableMeta; + taosHashPut(info->superTables, currElement->measure, currElement->measureLen, tmp, POINTER_BYTES); + + for(int i = 0; i < pTableMeta->tableInfo.numOfColumns; i++){ + SSchema *tag = pTableMeta->schema + i; + SSmlKv kv = {.key = tag->name, .keyLen = strlen(tag->name), .type = tag->type }; + if(tag->type == TSDB_DATA_TYPE_NCHAR){ + kv.length = (tag->bytes - VARSTR_HEADER_SIZE) / TSDB_NCHAR_SIZE; + }else if(tag->type == TSDB_DATA_TYPE_BINARY){ + kv.length = tag->bytes - VARSTR_HEADER_SIZE; + } + taosArrayPush((*tmp)->cols, &kv); + } } info->currSTableMeta = (*tmp)->tableMeta; - superKV = (*tmp)->cols; - if (unlikely(taosArrayGetSize(superKV) == 0)) { - isSuperKVInit = false; - } - taosArrayClear(preLineKV); + info->masColKVs = (*tmp)->cols; } } @@ -439,69 +441,26 @@ static int32_t smlParseColKv(SSmlHandle *info, char **sql, char *sqlEnd, SSmlLin info->reRun = true; return TSDB_CODE_SUCCESS; } + if (cnt >= taosArrayGetSize(info->masColKVs)) { + info->dataFormat = false; + info->reRun = true; + return TSDB_CODE_SUCCESS; + } + SSmlKv *maxKV = (SSmlKv *)taosArrayGet(info->masColKVs, cnt); + if (kv.type != maxKV->type) { + info->dataFormat = false; + info->reRun = true; + return TSDB_CODE_SUCCESS; + } + if (unlikely(!IS_SAME_KEY)) { + info->dataFormat = false; + info->reRun = true; + return TSDB_CODE_SUCCESS; + } - if (isSameMeasure) { - if (cnt >= taosArrayGetSize(preLineKV)) { - info->dataFormat = false; - info->reRun = true; - return TSDB_CODE_SUCCESS; - } - SSmlKv *maxKV = (SSmlKv *)taosArrayGet(preLineKV, cnt); - if (kv.type != maxKV->type) { - info->dataFormat = false; - info->reRun = true; - return TSDB_CODE_SUCCESS; - } - - if (unlikely(IS_VAR_DATA_TYPE(kv.type) && kv.length > maxKV->length)) { - maxKV->length = kv.length; - SSmlSTableMeta **tableMeta = - (SSmlSTableMeta **)taosHashGet(info->superTables, currElement->measure, currElement->measureLen); - if (unlikely(NULL == tableMeta)) { - uError("SML:0x%" PRIx64 " NULL == tableMeta", info->id); - return TSDB_CODE_SML_INTERNAL_ERROR; - } - - SSmlKv *oldKV = (SSmlKv *)taosArrayGet((*tableMeta)->cols, cnt); - oldKV->length = kv.length; - info->needModifySchema = true; - } - if (unlikely(!IS_SAME_KEY)) { - info->dataFormat = false; - info->reRun = true; - return TSDB_CODE_SUCCESS; - } - } else { - if (isSuperKVInit) { - if (unlikely(cnt >= taosArrayGetSize(superKV))) { - info->dataFormat = false; - info->reRun = true; - return TSDB_CODE_SUCCESS; - } - SSmlKv *maxKV = (SSmlKv *)taosArrayGet(superKV, cnt); - if (unlikely(kv.type != maxKV->type)) { - info->dataFormat = false; - info->reRun = true; - return TSDB_CODE_SUCCESS; - } - - if (IS_VAR_DATA_TYPE(kv.type)) { - if (kv.length > maxKV->length) { - maxKV->length = kv.length; - } else { - kv.length = maxKV->length; - } - info->needModifySchema = true; - } - if (unlikely(!IS_SAME_KEY)) { - info->dataFormat = false; - info->reRun = true; - return TSDB_CODE_SUCCESS; - } - } else { - taosArrayPush(superKV, &kv); - } - taosArrayPush(preLineKV, &kv); + if (unlikely(IS_VAR_DATA_TYPE(kv.type) && kv.length > maxKV->length)) { + maxKV->length = kv.length; + info->needModifySchema = true; } } else { if (currElement->colArray == NULL) { diff --git a/source/client/src/clientSmlTelnet.c b/source/client/src/clientSmlTelnet.c index 9201412cbd..ccf79cfc64 100644 --- a/source/client/src/clientSmlTelnet.c +++ b/source/client/src/clientSmlTelnet.c @@ -82,7 +82,7 @@ static int32_t smlParseTelnetTags(SSmlHandle *info, char *data, char *sqlEnd, SS if (info->dataFormat) { if (!isSameMeasure) { SSmlSTableMeta **tmp = (SSmlSTableMeta **)taosHashGet(info->superTables, elements->measure, elements->measureLen); - SSmlSTableMeta * sMeta = NULL; + SSmlSTableMeta *sMeta = NULL; if (unlikely(tmp == NULL)) { STableMeta *pTableMeta = smlGetMeta(info, elements->measure, elements->measureLen); if (pTableMeta == NULL) { @@ -93,12 +93,12 @@ static int32_t smlParseTelnetTags(SSmlHandle *info, char *data, char *sqlEnd, SS sMeta = smlBuildSTableMeta(info->dataFormat); sMeta->tableMeta = pTableMeta; taosHashPut(info->superTables, elements->measure, elements->measureLen, &sMeta, POINTER_BYTES); - tmp = &sMeta; for(int i = pTableMeta->tableInfo.numOfColumns; i < pTableMeta->tableInfo.numOfTags + pTableMeta->tableInfo.numOfColumns; i++){ SSchema *tag = pTableMeta->schema + i; SSmlKv kv = {.key = tag->name, .keyLen = strlen(tag->name), .type = tag->type, .length = (tag->bytes - VARSTR_HEADER_SIZE) / TSDB_NCHAR_SIZE }; taosArrayPush(sMeta->tags, &kv); } + tmp = &sMeta; } info->currSTableMeta = (*tmp)->tableMeta; info->maxTagKVs = (*tmp)->tags; From cea32f2e3ce4e8f941564e2b97a678a10dd49386 Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Sat, 4 Mar 2023 18:18:20 +0800 Subject: [PATCH 093/174] fix:give error if col is same in schemless & fix json parse error in TD-22903 --- utils/test/c/sml_test.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utils/test/c/sml_test.c b/utils/test/c/sml_test.c index 7441184271..3d2c08149b 100644 --- a/utils/test/c/sml_test.c +++ b/utils/test/c/sml_test.c @@ -1191,8 +1191,8 @@ int main(int argc, char *argv[]) { } int ret = 0; -// ret = sml_ts2385_Test(); // this test case need config sml table name using ./sml_test config_file -// ASSERT(!ret); + ret = sml_ts2385_Test(); // this test case need config sml table name using ./sml_test config_file + ASSERT(!ret); // for(int i = 0; i < sizeof(str)/sizeof(str[0]); i++){ // printf("str:%s \t %d\n", str[i], smlCalTypeSum(str[i], strlen(str[i]))); // } From 8f63de5a0ad4be615687544ea8cd5ca173d36b37 Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Sat, 4 Mar 2023 18:30:53 +0800 Subject: [PATCH 094/174] add debug --- source/libs/transport/src/transCli.c | 66 ++++++++++++++-------------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/source/libs/transport/src/transCli.c b/source/libs/transport/src/transCli.c index a2516f6ff7..9ed7953e90 100644 --- a/source/libs/transport/src/transCli.c +++ b/source/libs/transport/src/transCli.c @@ -1115,18 +1115,18 @@ void cliSend(SCliConn* pConn) { msgLen = (int32_t)ntohl((uint32_t)(pHead->msgLen)); } - if (TMSG_INFO(pHead->msgType) != 0) { - char buf[128] = {0}; - sprintf(buf, "%s", TMSG_INFO(pHead->msgType)); - int* count = taosHashGet(pThrd->msgCount, buf, strlen(buf)); - if (NULL == 0) { - int localCount = 1; - taosHashPut(pThrd->msgCount, buf, strlen(buf), &localCount, sizeof(localCount)); - } else { - int localCount = *count + 1; - taosHashPut(pThrd->msgCount, buf, strlen(buf), &localCount, sizeof(localCount)); - } - } + // if (pHead->msgType != 0) { + // char buf[128] = {0}; + // sprintf(buf, "%s", TMSG_INFO(pHead->msgType)); + // int* count = taosHashGet(pThrd->msgCount, buf, strlen(buf)); + // if (NULL == 0) { + // int localCount = 1; + // taosHashPut(pThrd->msgCount, buf, strlen(buf), &localCount, sizeof(localCount)); + //} else { + // int localCount = *count + 1; + // taosHashPut(pThrd->msgCount, buf, strlen(buf), &localCount, sizeof(localCount)); + //} + //} tGDebug("%s conn %p %s is sent to %s, local info %s, len:%d", CONN_GET_INST_LABEL(pConn), pConn, TMSG_INFO(pHead->msgType), pConn->dst, pConn->src, msgLen); @@ -1767,15 +1767,15 @@ static void cliAsyncCb(uv_async_t* handle) { QUEUE_MOVE(&item->qmsg, &wq); taosThreadMutexUnlock(&item->mtx); - void* pIter = taosHashIterate(pThrd->msgCount, NULL); - while (pIter != NULL) { - int* count = pIter; - size_t len = 0; - char* key = taosHashGetKey(pIter, &len); - tDebug("key: %s count: %d", key, *count); + // void* pIter = taosHashIterate(pThrd->msgCount, NULL); + // while (pIter != NULL) { + // int* count = pIter; + // size_t len = 0; + // char* key = taosHashGetKey(pIter, &len); + // tDebug("key: %s count: %d", key, *count); - pIter = taosHashIterate(pThrd->msgCount, pIter); - } + // pIter = taosHashIterate(pThrd->msgCount, pIter); + //} tDebug("conn count: %d", pThrd->newConnCount); int8_t supportBatch = pTransInst->supportBatch; @@ -2014,7 +2014,7 @@ static SCliThrd* createThrdObj(void* trans) { pThrd->quit = false; pThrd->newConnCount = 0; - pThrd->msgCount = taosHashInit(8, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), false, HASH_NO_LOCK); + pThrd->msgCount = taosHashInit(8, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_NO_LOCK); return pThrd; } static void destroyThrdObj(SCliThrd* pThrd) { @@ -2362,18 +2362,18 @@ int cliAppCb(SCliConn* pConn, STransMsg* pResp, SCliMsg* pMsg) { } } - if ((pResp->msgType - 1) > 0) { - char buf[128] = {0}; - sprintf(buf, "%s", TMSG_INFO(pResp->msgType - 1)); - int* count = taosHashGet(pThrd->msgCount, buf, strlen(buf)); - if (NULL == 0) { - int localCount = 0; - taosHashPut(pThrd->msgCount, buf, strlen(buf), &localCount, sizeof(localCount)); - } else { - int localCount = *count - 1; - taosHashPut(pThrd->msgCount, buf, strlen(buf), &localCount, sizeof(localCount)); - } - } + // if ((pResp->msgType - 1) > 0) { + // char buf[128] = {0}; + // sprintf(buf, "%s", TMSG_INFO(pResp->msgType - 1)); + // int* count = taosHashGet(pThrd->msgCount, buf, strlen(buf)); + // if (NULL == 0) { + // int localCount = 0; + // taosHashPut(pThrd->msgCount, buf, strlen(buf), &localCount, sizeof(localCount)); + //} else { + // int localCount = *count - 1; + // taosHashPut(pThrd->msgCount, buf, strlen(buf), &localCount, sizeof(localCount)); + //} + //} if (pCtx->pSem != NULL) { tGTrace("%s conn %p(sync) handle resp", CONN_GET_INST_LABEL(pConn), pConn); if (pCtx->pRsp == NULL) { From b4e8130633710f11e261d73959409c6e0c154e6b Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Sat, 4 Mar 2023 18:48:37 +0800 Subject: [PATCH 095/174] add debug --- source/libs/transport/src/transCli.c | 68 ++++++++++++++-------------- 1 file changed, 35 insertions(+), 33 deletions(-) diff --git a/source/libs/transport/src/transCli.c b/source/libs/transport/src/transCli.c index 9ed7953e90..e7da5b1c69 100644 --- a/source/libs/transport/src/transCli.c +++ b/source/libs/transport/src/transCli.c @@ -1115,18 +1115,18 @@ void cliSend(SCliConn* pConn) { msgLen = (int32_t)ntohl((uint32_t)(pHead->msgLen)); } - // if (pHead->msgType != 0) { - // char buf[128] = {0}; - // sprintf(buf, "%s", TMSG_INFO(pHead->msgType)); - // int* count = taosHashGet(pThrd->msgCount, buf, strlen(buf)); - // if (NULL == 0) { - // int localCount = 1; - // taosHashPut(pThrd->msgCount, buf, strlen(buf), &localCount, sizeof(localCount)); - //} else { - // int localCount = *count + 1; - // taosHashPut(pThrd->msgCount, buf, strlen(buf), &localCount, sizeof(localCount)); - //} - //} + if (pHead->msgType != 0) { + char buf[128] = {0}; + sprintf(buf, "%s", TMSG_INFO(pHead->msgType)); + int* count = taosHashGet(pThrd->msgCount, buf, sizeof(buf)); + if (NULL == 0) { + int localCount = 1; + taosHashPut(pThrd->msgCount, buf, sizeof(buf), &localCount, sizeof(localCount)); + } else { + int localCount = *count + 1; + taosHashPut(pThrd->msgCount, buf, sizeof(buf), &localCount, sizeof(localCount)); + } + } tGDebug("%s conn %p %s is sent to %s, local info %s, len:%d", CONN_GET_INST_LABEL(pConn), pConn, TMSG_INFO(pHead->msgType), pConn->dst, pConn->src, msgLen); @@ -1767,16 +1767,18 @@ static void cliAsyncCb(uv_async_t* handle) { QUEUE_MOVE(&item->qmsg, &wq); taosThreadMutexUnlock(&item->mtx); - // void* pIter = taosHashIterate(pThrd->msgCount, NULL); - // while (pIter != NULL) { - // int* count = pIter; - // size_t len = 0; - // char* key = taosHashGetKey(pIter, &len); - // tDebug("key: %s count: %d", key, *count); + void* pIter = taosHashIterate(pThrd->msgCount, NULL); + while (pIter != NULL) { + int* count = pIter; + size_t len = 0; + char* key = taosHashGetKey(pIter, &len); + if (*count != 0) { + tDebug("key: %s count: %d", key, *count); + } - // pIter = taosHashIterate(pThrd->msgCount, pIter); - //} - tDebug("conn count: %d", pThrd->newConnCount); + pIter = taosHashIterate(pThrd->msgCount, pIter); + } + tDebug("all conn count: %d", pThrd->newConnCount); int8_t supportBatch = pTransInst->supportBatch; if (supportBatch == 0) { @@ -2362,18 +2364,18 @@ int cliAppCb(SCliConn* pConn, STransMsg* pResp, SCliMsg* pMsg) { } } - // if ((pResp->msgType - 1) > 0) { - // char buf[128] = {0}; - // sprintf(buf, "%s", TMSG_INFO(pResp->msgType - 1)); - // int* count = taosHashGet(pThrd->msgCount, buf, strlen(buf)); - // if (NULL == 0) { - // int localCount = 0; - // taosHashPut(pThrd->msgCount, buf, strlen(buf), &localCount, sizeof(localCount)); - //} else { - // int localCount = *count - 1; - // taosHashPut(pThrd->msgCount, buf, strlen(buf), &localCount, sizeof(localCount)); - //} - //} + if ((pResp->msgType - 1) > 0) { + char buf[128] = {0}; + sprintf(buf, "%s", TMSG_INFO(pResp->msgType - 1)); + int* count = taosHashGet(pThrd->msgCount, buf, sizeof(buf)); + if (NULL == 0) { + int localCount = 0; + taosHashPut(pThrd->msgCount, buf, sizeof(buf), &localCount, sizeof(localCount)); + } else { + int localCount = *count - 1; + taosHashPut(pThrd->msgCount, buf, sizeof(buf), &localCount, sizeof(localCount)); + } + } if (pCtx->pSem != NULL) { tGTrace("%s conn %p(sync) handle resp", CONN_GET_INST_LABEL(pConn), pConn); if (pCtx->pRsp == NULL) { From bfc189c9dcac96ea2784a2e1969a71f38b6c308f Mon Sep 17 00:00:00 2001 From: Benguang Zhao Date: Sat, 4 Mar 2023 19:12:36 +0800 Subject: [PATCH 096/174] fix: update docs for WAL_RETENTION_PERIOD, etc. --- docs/en/12-taos-sql/02-database.md | 8 ++++---- docs/zh/12-taos-sql/02-database.md | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/en/12-taos-sql/02-database.md b/docs/en/12-taos-sql/02-database.md index 5e8c9aaa92..a1c46875aa 100644 --- a/docs/en/12-taos-sql/02-database.md +++ b/docs/en/12-taos-sql/02-database.md @@ -75,10 +75,10 @@ database_option: { - TABLE_PREFIX:The prefix length in the table name that is ignored when distributing table to vnode based on table name. - TABLE_SUFFIX:The suffix length in the table name that is ignored when distributing table to vnode based on table name. - TSDB_PAGESIZE: The page size of the data storage engine in a vnode. The unit is KB. The default is 4 KB. The range is 1 to 16384, that is, 1 KB to 16 MB. -- WAL_RETENTION_PERIOD: specifies the time after which WAL files are deleted. This parameter is used for data subscription. Enter a time in seconds. The default value of single copy is 0. A value of 0 indicates that each WAL file is deleted immediately after its contents are written to disk. -1: WAL files are never deleted. The default value of multiple copy is 4 days. -- WAL_RETENTION_SIZE: specifies the size at which WAL files are deleted. This parameter is used for data subscription. Enter a size in KB. The default value of single copy is 0. A value of 0 indicates that each WAL file is deleted immediately after its contents are written to disk. -1: WAL files are never deleted. The default value of multiple copy is -1. -- WAL_ROLL_PERIOD: specifies the time after which WAL files are rotated. After this period elapses, a new WAL file is created. The default value of single copy is 0. A value of 0 indicates that a new WAL file is created only after the previous WAL file was written to disk. The default values of multiple copy is 1 day. -- WAL_SEGMENT_SIZE: specifies the maximum size of a WAL file. After the current WAL file reaches this size, a new WAL file is created. The default value is 0. A value of 0 indicates that a new WAL file is created only after the previous WAL file was written to disk. +- WAL_RETENTION_PERIOD: specifies the maximum time of which WAL files are to be kept after consumption. This parameter is used for data subscription. Enter a time in seconds. The default value 0. A value of 0 indicates that WAL files are not required to keep after consumption. -1: the time of WAL files to keep has no upper limit. +- WAL_RETENTION_SIZE: specifies the maximum total size of which WAL files are to be kept after consumption. This parameter is used for data subscription. Enter a size in KB. The default value is 0. A value of 0 indicates that WAL files are not required to keep after consumption. -1: the total size of WAL files to keep has no upper limit. +- WAL_ROLL_PERIOD: specifies the time after which WAL files are rotated. After this period elapses, a new WAL file is created. The default value is 0. A value of 0 indicates that a new WAL file is created only after TSDB data in memory are flushed to disk. +- WAL_SEGMENT_SIZE: specifies the maximum size of a WAL file. After the current WAL file reaches this size, a new WAL file is created. The default value is 0. A value of 0 indicates that a new WAL file is created only after TSDB data in memory are flushed to disk. ### Example Statement diff --git a/docs/zh/12-taos-sql/02-database.md b/docs/zh/12-taos-sql/02-database.md index d9ef3b51aa..9e346fdca8 100644 --- a/docs/zh/12-taos-sql/02-database.md +++ b/docs/zh/12-taos-sql/02-database.md @@ -75,10 +75,10 @@ database_option: { - TABLE_PREFIX:内部存储引擎根据表名分配存储该表数据的 VNODE 时要忽略的前缀的长度。 - TABLE_SUFFIX:内部存储引擎根据表名分配存储该表数据的 VNODE 时要忽略的后缀的长度。 - TSDB_PAGESIZE:一个 VNODE 中时序数据存储引擎的页大小,单位为 KB,默认为 4 KB。范围为 1 到 16384,即 1 KB到 16 MB。 -- WAL_RETENTION_PERIOD:wal 文件的额外保留策略,用于数据订阅。wal 的保存时长,单位为 s。单副本默认为 0,即落盘后立即删除。-1 表示不删除。多副本默认为 4 天。 -- WAL_RETENTION_SIZE:wal 文件的额外保留策略,用于数据订阅。wal 的保存的最大上限,单位为 KB。单副本默认为 0,即落盘后立即删除。多副本默认为-1,表示不删除。 -- WAL_ROLL_PERIOD:wal 文件切换时长,单位为 s。当 wal 文件创建并写入后,经过该时间,会自动创建一个新的 wal 文件。单副本默认为 0,即仅在落盘时创建新文件。多副本默认为 1 天。 -- WAL_SEGMENT_SIZE:wal 单个文件大小,单位为 KB。当前写入文件大小超过上限后会自动创建一个新的 wal 文件。默认为 0,即仅在落盘时创建新文件。 +- WAL_RETENTION_PERIOD:数据订阅已消费WAL日志,WAL文件的最大额外保留的时长策略。单位为 s。默认为 0,表示无需额外保留。-1, 表示额外保留,时间无上限。 +- WAL_RETENTION_SIZE:数据订阅已消费WAL日志,WAL文件的最大额外保留的累计大小策略。单位为 KB。默认为 0,表示无需额外保留。-1, 表示额外保留,累计大小无上限。 +- WAL_ROLL_PERIOD:wal 文件切换时长,单位为 s。当WAL文件创建并写入后,经过该时间,会自动创建一个新的WAL文件。默认为 0,即仅在TSDB落盘时创建新文件。 +- WAL_SEGMENT_SIZE:wal 单个文件大小,单位为 KB。当前写入文件大小超过上限后会自动创建一个新的WAL文件。默认为 0,即仅在TSDB落盘时创建新文件。 ### 创建数据库示例 From 566d233c1cbb14b8acc5fdea98f3f1edbebf75af Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Sat, 4 Mar 2023 19:28:03 +0800 Subject: [PATCH 097/174] add debug --- source/libs/transport/src/transCli.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/source/libs/transport/src/transCli.c b/source/libs/transport/src/transCli.c index e7da5b1c69..0774492dbb 100644 --- a/source/libs/transport/src/transCli.c +++ b/source/libs/transport/src/transCli.c @@ -1115,7 +1115,8 @@ void cliSend(SCliConn* pConn) { msgLen = (int32_t)ntohl((uint32_t)(pHead->msgLen)); } - if (pHead->msgType != 0) { + if ((pHead->msgType > TDMT_VND_TMQ_MSG && pHead->msgType < TDMT_VND_TMQ_MAX_MSG) || + (pHead->msgType > TDMT_MND_MSG && pHead->msgType < TDMT_MND_MAX_MSG)) { char buf[128] = {0}; sprintf(buf, "%s", TMSG_INFO(pHead->msgType)); int* count = taosHashGet(pThrd->msgCount, buf, sizeof(buf)); @@ -2364,7 +2365,8 @@ int cliAppCb(SCliConn* pConn, STransMsg* pResp, SCliMsg* pMsg) { } } - if ((pResp->msgType - 1) > 0) { + if ((pResp->msgType - 1 > TDMT_VND_TMQ_MSG && pResp->msgType - 1 < TDMT_VND_TMQ_MAX_MSG) || + (pResp->msgType - 1 > TDMT_MND_MSG && pResp->msgType - 1 < TDMT_MND_MAX_MSG)) { char buf[128] = {0}; sprintf(buf, "%s", TMSG_INFO(pResp->msgType - 1)); int* count = taosHashGet(pThrd->msgCount, buf, sizeof(buf)); From dfeed5a4951a530ce4cc40fc91c7f60833f531d5 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Sat, 4 Mar 2023 22:14:30 +0800 Subject: [PATCH 098/174] refactor: disable 0 topics; --- include/util/taoserror.h | 1 + source/client/src/clientTmq.c | 7 ++++++- source/util/src/terror.c | 3 ++- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/include/util/taoserror.h b/include/util/taoserror.h index 5106196ccd..61e181bc36 100644 --- a/include/util/taoserror.h +++ b/include/util/taoserror.h @@ -558,6 +558,7 @@ int32_t* taosGetErrno(); #define TSDB_CODE_TQ_GROUP_NOT_SET TAOS_DEF_ERROR_CODE(0, 0x0A0B) #define TSDB_CODE_TQ_TABLE_SCHEMA_NOT_FOUND TAOS_DEF_ERROR_CODE(0, 0x0A0C) #define TSDB_CODE_TQ_NO_COMMITTED_OFFSET TAOS_DEF_ERROR_CODE(0, 0x0A0D) +#define TSDB_CODE_TQ_NO_SUBSCRIBE_TOPICS TAOS_DEF_ERROR_CODE(0, 0x0A0E) // wal // #define TSDB_CODE_WAL_APP_ERROR TAOS_DEF_ERROR_CODE(0, 0x1000) // 2.x diff --git a/source/client/src/clientTmq.c b/source/client/src/clientTmq.c index d08cabd27e..00e29f5ecc 100644 --- a/source/client/src/clientTmq.c +++ b/source/client/src/clientTmq.c @@ -1076,7 +1076,12 @@ int32_t tmq_subscribe(tmq_t* tmq, const tmq_list_t* topic_list) { SCMSubscribeReq req = {0}; int32_t code = 0; - tscDebug("consumer:0x%" PRIx64 " cgroup:%s, subscribe %d topics", tmq->consumerId, tmq->groupId, sz); + if (sz == 0) { + tscDebug("consumer:0x%" PRIx64 " cgroup:%s, subscribe %d topics, not allowed", tmq->consumerId, tmq->groupId, sz); + return TSDB_CODE_TQ_NO_SUBSCRIBE_TOPICS; + } else { + tscDebug("consumer:0x%" PRIx64 " cgroup:%s, subscribe %d topics", tmq->consumerId, tmq->groupId, sz); + } req.consumerId = tmq->consumerId; tstrncpy(req.clientId, tmq->clientId, 256); diff --git a/source/util/src/terror.c b/source/util/src/terror.c index b22e2e924f..6e63776afe 100644 --- a/source/util/src/terror.c +++ b/source/util/src/terror.c @@ -435,7 +435,8 @@ TAOS_DEFINE_ERROR(TSDB_CODE_TQ_META_KEY_NOT_IN_TXN, "TQ meta key not in tx TAOS_DEFINE_ERROR(TSDB_CODE_TQ_META_KEY_DUP_IN_TXN, "TQ met key dup in txn") TAOS_DEFINE_ERROR(TSDB_CODE_TQ_GROUP_NOT_SET, "TQ group not exist") TAOS_DEFINE_ERROR(TSDB_CODE_TQ_TABLE_SCHEMA_NOT_FOUND, "TQ table schema not found") -TAOS_DEFINE_ERROR(TSDB_CODE_TQ_NO_COMMITTED_OFFSET, "TQ no commited offset") +TAOS_DEFINE_ERROR(TSDB_CODE_TQ_NO_COMMITTED_OFFSET, "TQ no committed offset") +TAOS_DEFINE_ERROR(TSDB_CODE_TQ_NO_SUBSCRIBE_TOPICS, "TQ no topics") // wal TAOS_DEFINE_ERROR(TSDB_CODE_WAL_FILE_CORRUPTED, "WAL file is corrupted") From bf8b36901a0be5602481e22f1c148e9ceee629ec Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Sat, 4 Mar 2023 23:37:50 +0800 Subject: [PATCH 099/174] add crash --- source/libs/transport/src/transCli.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/libs/transport/src/transCli.c b/source/libs/transport/src/transCli.c index 0774492dbb..7d648d69ac 100644 --- a/source/libs/transport/src/transCli.c +++ b/source/libs/transport/src/transCli.c @@ -877,7 +877,7 @@ static SCliConn* cliCreateConn(SCliThrd* pThrd) { static void cliDestroyConn(SCliConn* conn, bool clear) { SCliThrd* pThrd = conn->hostThrd; tTrace("%s conn %p remove from conn pool", CONN_GET_INST_LABEL(conn), conn); - + conn->broken = true; QUEUE_REMOVE(&conn->q); QUEUE_INIT(&conn->q); @@ -1262,7 +1262,7 @@ static void cliSendBatchCb(uv_write_t* req, int status) { } else { tDebug("%s conn %p succ to send batch msg, batch size:%d, msgLen:%d", CONN_GET_INST_LABEL(conn), conn, p->wLen, p->batchSize); - if (!uv_is_closing((uv_handle_t*)&conn->stream)) { + if (!uv_is_closing((uv_handle_t*)&conn->stream) && conn->broken == false) { if (nxtBatch != NULL) { conn->pBatch = nxtBatch; cliSendBatch(conn); From ee65a497816bf47585b5e5710d0f63d07f1287a6 Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Sat, 4 Mar 2023 23:46:09 +0800 Subject: [PATCH 100/174] fix crash --- source/libs/transport/src/transCli.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/source/libs/transport/src/transCli.c b/source/libs/transport/src/transCli.c index 274d153adc..e554580fc9 100644 --- a/source/libs/transport/src/transCli.c +++ b/source/libs/transport/src/transCli.c @@ -864,6 +864,8 @@ static void cliDestroyConn(SCliConn* conn, bool clear) { QUEUE_REMOVE(&conn->q); QUEUE_INIT(&conn->q); + conn->broken = true; + if (conn->list != NULL) { SConnList* connList = conn->list; connList->list->numOfConn--; @@ -1230,7 +1232,7 @@ static void cliSendBatchCb(uv_write_t* req, int status) { } else { tDebug("%s conn %p succ to send batch msg, batch size:%d, msgLen:%d", CONN_GET_INST_LABEL(conn), conn, p->wLen, p->batchSize); - if (!uv_is_closing((uv_handle_t*)&conn->stream)) { + if (!uv_is_closing((uv_handle_t*)&conn->stream) && conn->broken == false) { if (nxtBatch != NULL) { conn->pBatch = nxtBatch; cliSendBatch(conn); From fbad444981627d6079210c4b17ae433f9d4c1c92 Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Sun, 5 Mar 2023 10:52:16 +0800 Subject: [PATCH 101/174] change parameter --- source/client/src/clientEnv.c | 4 ++-- source/common/src/tglobal.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/source/client/src/clientEnv.c b/source/client/src/clientEnv.c index 79c5baf43d..e3e20ee85d 100644 --- a/source/client/src/clientEnv.c +++ b/source/client/src/clientEnv.c @@ -159,9 +159,9 @@ void *openTransporter(const char *user, const char *auth, int32_t numOfThread) { rpcInit.retryMaxInterval = tsRedirectMaxPeriod; rpcInit.retryMaxTimouet = tsMaxRetryWaitTime; - int32_t connLimitNum = tsNumOfRpcSessions / (tsNumOfRpcThreads * 5); + int32_t connLimitNum = tsNumOfRpcSessions / (tsNumOfRpcThreads * 3); connLimitNum = TMAX(connLimitNum, 10); - connLimitNum = TMIN(connLimitNum, 500); + connLimitNum = TMIN(connLimitNum, 1000); rpcInit.connLimitNum = connLimitNum; rpcInit.timeToGetConn = tsTimeToGetAvailableConn; diff --git a/source/common/src/tglobal.c b/source/common/src/tglobal.c index 4bb64e5fd6..0d03e1a11a 100644 --- a/source/common/src/tglobal.c +++ b/source/common/src/tglobal.c @@ -41,7 +41,7 @@ bool tsPrintAuth = false; // queue & threads int32_t tsNumOfRpcThreads = 1; -int32_t tsNumOfRpcSessions = 6000; +int32_t tsNumOfRpcSessions = 10000; int32_t tsTimeToGetAvailableConn = 500000; int32_t tsNumOfCommitThreads = 2; int32_t tsNumOfTaskQueueThreads = 4; From 167f4de9037241e57aea6b7243baed3b23cbb78b Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Sun, 5 Mar 2023 11:06:55 +0800 Subject: [PATCH 102/174] fix debug info --- source/libs/transport/src/transCli.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/source/libs/transport/src/transCli.c b/source/libs/transport/src/transCli.c index 7d648d69ac..15fb20856c 100644 --- a/source/libs/transport/src/transCli.c +++ b/source/libs/transport/src/transCli.c @@ -1116,7 +1116,8 @@ void cliSend(SCliConn* pConn) { } if ((pHead->msgType > TDMT_VND_TMQ_MSG && pHead->msgType < TDMT_VND_TMQ_MAX_MSG) || - (pHead->msgType > TDMT_MND_MSG && pHead->msgType < TDMT_MND_MAX_MSG)) { + (pHead->msgType > TDMT_MND_MSG && pHead->msgType < TDMT_MND_MAX_MSG) || pHead->msgType == TDMT_VND_SUBMIT || + pHead->msgType == TDMT_MND_HEARTBEAT) { char buf[128] = {0}; sprintf(buf, "%s", TMSG_INFO(pHead->msgType)); int* count = taosHashGet(pThrd->msgCount, buf, sizeof(buf)); @@ -2366,7 +2367,8 @@ int cliAppCb(SCliConn* pConn, STransMsg* pResp, SCliMsg* pMsg) { } if ((pResp->msgType - 1 > TDMT_VND_TMQ_MSG && pResp->msgType - 1 < TDMT_VND_TMQ_MAX_MSG) || - (pResp->msgType - 1 > TDMT_MND_MSG && pResp->msgType - 1 < TDMT_MND_MAX_MSG)) { + (pResp->msgType - 1 > TDMT_MND_MSG && pResp->msgType - 1 < TDMT_MND_MAX_MSG) || + pResp->msgType - 1 == TDMT_VND_SUBMIT_RSP || pResp->msgType - 1 == TDMT_MND_HEARTBEAT_RSP) { char buf[128] = {0}; sprintf(buf, "%s", TMSG_INFO(pResp->msgType - 1)); int* count = taosHashGet(pThrd->msgCount, buf, sizeof(buf)); From 7986e1fd49edd9eac9c9676a917bb469ad7040ae Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Sun, 5 Mar 2023 11:08:11 +0800 Subject: [PATCH 103/174] fix debug info --- source/libs/transport/src/transCli.c | 1 + 1 file changed, 1 insertion(+) diff --git a/source/libs/transport/src/transCli.c b/source/libs/transport/src/transCli.c index 15fb20856c..99c9285018 100644 --- a/source/libs/transport/src/transCli.c +++ b/source/libs/transport/src/transCli.c @@ -692,6 +692,7 @@ static SCliConn* getConnFromPool2(SCliThrd* pThrd, char* key, SCliMsg** pMsg) { } list->numOfConn++; } + tTrace("%s numOfConn: %d, limit: %d", pTransInst->label, list->numOfConn, pTransInst->connLimitNum); return NULL; } From e6ec795b4d2c7ba10ed2ea2de1edf9bb74a2175e Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Sun, 5 Mar 2023 11:36:01 +0800 Subject: [PATCH 104/174] fix debug info --- include/common/tmsg.h | 19 ++++++++++++++----- source/libs/transport/src/transCli.c | 8 ++------ 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/include/common/tmsg.h b/include/common/tmsg.h index 41bc873a3b..9a2439f0cf 100644 --- a/include/common/tmsg.h +++ b/include/common/tmsg.h @@ -66,6 +66,15 @@ extern int32_t tMsgDict[]; typedef uint16_t tmsg_t; +static inline bool tmsgIsValid(tmsg_t type) { + if (type < TDMT_DND_MAX_MSG || type < TDMT_MND_MAX_MSG || type < TDMT_VND_MAX_MSG || type < TDMT_SCH_MAX_MSG || + type < TDMT_STREAM_MAX_MSG || type < TDMT_MON_MAX_MSG || type < TDMT_SYNC_MAX_MSG || type < TDMT_VND_STREAM_MSG || + type < TDMT_VND_TMQ_MSG || type < TDMT_VND_TMQ_MAX_MSG) { + return true; + } else { + return false; + } +} static inline bool vnodeIsMsgBlock(tmsg_t type) { return (type == TDMT_VND_CREATE_TABLE) || (type == TDMT_VND_ALTER_TABLE) || (type == TDMT_VND_DROP_TABLE) || (type == TDMT_VND_UPDATE_TAG_VAL) || (type == TDMT_VND_ALTER_CONFIRM); @@ -1911,10 +1920,10 @@ typedef struct { } SMqConsumerLostMsg, SMqConsumerRecoverMsg, SMqConsumerClearMsg; typedef struct { - int64_t consumerId; - char cgroup[TSDB_CGROUP_LEN]; - char clientId[256]; - SArray* topicNames; // SArray + int64_t consumerId; + char cgroup[TSDB_CGROUP_LEN]; + char clientId[256]; + SArray* topicNames; // SArray } SCMSubscribeReq; static FORCE_INLINE int32_t tSerializeSCMSubscribeReq(void** buf, const SCMSubscribeReq* pReq) { @@ -2691,7 +2700,7 @@ typedef struct { char subKey[TSDB_SUBSCRIBE_KEY_LEN]; int8_t subType; int8_t withMeta; - char* qmsg; //SubPlanToString + char* qmsg; // SubPlanToString int64_t suid; } SMqRebVgReq; diff --git a/source/libs/transport/src/transCli.c b/source/libs/transport/src/transCli.c index 99c9285018..c4f0b63ffc 100644 --- a/source/libs/transport/src/transCli.c +++ b/source/libs/transport/src/transCli.c @@ -1116,9 +1116,7 @@ void cliSend(SCliConn* pConn) { msgLen = (int32_t)ntohl((uint32_t)(pHead->msgLen)); } - if ((pHead->msgType > TDMT_VND_TMQ_MSG && pHead->msgType < TDMT_VND_TMQ_MAX_MSG) || - (pHead->msgType > TDMT_MND_MSG && pHead->msgType < TDMT_MND_MAX_MSG) || pHead->msgType == TDMT_VND_SUBMIT || - pHead->msgType == TDMT_MND_HEARTBEAT) { + if (tmsgIsValid(pHead->msgType)) { char buf[128] = {0}; sprintf(buf, "%s", TMSG_INFO(pHead->msgType)); int* count = taosHashGet(pThrd->msgCount, buf, sizeof(buf)); @@ -2367,9 +2365,7 @@ int cliAppCb(SCliConn* pConn, STransMsg* pResp, SCliMsg* pMsg) { } } - if ((pResp->msgType - 1 > TDMT_VND_TMQ_MSG && pResp->msgType - 1 < TDMT_VND_TMQ_MAX_MSG) || - (pResp->msgType - 1 > TDMT_MND_MSG && pResp->msgType - 1 < TDMT_MND_MAX_MSG) || - pResp->msgType - 1 == TDMT_VND_SUBMIT_RSP || pResp->msgType - 1 == TDMT_MND_HEARTBEAT_RSP) { + if (tmsgIsValid(pResp->msgType - 1)) { char buf[128] = {0}; sprintf(buf, "%s", TMSG_INFO(pResp->msgType - 1)); int* count = taosHashGet(pThrd->msgCount, buf, sizeof(buf)); From ee0bf9c501afb8421152dd41e94c02e9da1d6723 Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Sun, 5 Mar 2023 12:42:56 +0800 Subject: [PATCH 105/174] fix debug info --- source/libs/transport/src/transCli.c | 36 ++++++++++++++++++---------- 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/source/libs/transport/src/transCli.c b/source/libs/transport/src/transCli.c index c4f0b63ffc..b97597dc65 100644 --- a/source/libs/transport/src/transCli.c +++ b/source/libs/transport/src/transCli.c @@ -1116,18 +1116,18 @@ void cliSend(SCliConn* pConn) { msgLen = (int32_t)ntohl((uint32_t)(pHead->msgLen)); } - if (tmsgIsValid(pHead->msgType)) { - char buf[128] = {0}; - sprintf(buf, "%s", TMSG_INFO(pHead->msgType)); - int* count = taosHashGet(pThrd->msgCount, buf, sizeof(buf)); - if (NULL == 0) { - int localCount = 1; - taosHashPut(pThrd->msgCount, buf, sizeof(buf), &localCount, sizeof(localCount)); - } else { - int localCount = *count + 1; - taosHashPut(pThrd->msgCount, buf, sizeof(buf), &localCount, sizeof(localCount)); - } - } + // if (tmsgIsValid(pHead->msgType)) { + // char buf[128] = {0}; + // sprintf(buf, "%s", TMSG_INFO(pHead->msgType)); + // int* count = taosHashGet(pThrd->msgCount, buf, sizeof(buf)); + // if (NULL == 0) { + // int localCount = 1; + // taosHashPut(pThrd->msgCount, buf, sizeof(buf), &localCount, sizeof(localCount)); + // } else { + // int localCount = *count + 1; + // taosHashPut(pThrd->msgCount, buf, sizeof(buf), &localCount, sizeof(localCount)); + // } + // } tGDebug("%s conn %p %s is sent to %s, local info %s, len:%d", CONN_GET_INST_LABEL(pConn), pConn, TMSG_INFO(pHead->msgType), pConn->dst, pConn->src, msgLen); @@ -1523,6 +1523,18 @@ void cliHandleReq(SCliMsg* pMsg, SCliThrd* pThrd) { destroyCmsg(pMsg); return; } + if (tmsgIsValid(pMsg->msg.msgType)) { + char buf[128] = {0}; + sprintf(buf, "%s", TMSG_INFO(pMsg->msg.msgType)); + int* count = taosHashGet(pThrd->msgCount, buf, sizeof(buf)); + if (NULL == 0) { + int localCount = 1; + taosHashPut(pThrd->msgCount, buf, sizeof(buf), &localCount, sizeof(localCount)); + } else { + int localCount = *count + 1; + taosHashPut(pThrd->msgCount, buf, sizeof(buf), &localCount, sizeof(localCount)); + } + } char* fqdn = EPSET_GET_INUSE_IP(&pMsg->ctx->epSet); uint16_t port = EPSET_GET_INUSE_PORT(&pMsg->ctx->epSet); From 22a85734c69528e977663a2472b51e4b17cac079 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Sun, 5 Mar 2023 13:23:50 +0800 Subject: [PATCH 106/174] fix(mq): add more chek for balance couner to avoid the negative value emerges. --- include/util/taoserror.h | 1 - source/client/src/clientTmq.c | 7 +------ source/client/test/clientTests.cpp | 9 +++++++- source/dnode/mnode/impl/src/mndConsumer.c | 24 ++++++++++++++++------ source/dnode/mnode/impl/src/mndMain.c | 3 +++ source/dnode/mnode/impl/src/mndSubscribe.c | 6 +++--- source/dnode/vnode/src/tq/tqRead.c | 9 ++++---- source/libs/executor/src/scanoperator.c | 6 +++++- source/util/src/terror.c | 1 - 9 files changed, 42 insertions(+), 24 deletions(-) diff --git a/include/util/taoserror.h b/include/util/taoserror.h index 61e181bc36..5106196ccd 100644 --- a/include/util/taoserror.h +++ b/include/util/taoserror.h @@ -558,7 +558,6 @@ int32_t* taosGetErrno(); #define TSDB_CODE_TQ_GROUP_NOT_SET TAOS_DEF_ERROR_CODE(0, 0x0A0B) #define TSDB_CODE_TQ_TABLE_SCHEMA_NOT_FOUND TAOS_DEF_ERROR_CODE(0, 0x0A0C) #define TSDB_CODE_TQ_NO_COMMITTED_OFFSET TAOS_DEF_ERROR_CODE(0, 0x0A0D) -#define TSDB_CODE_TQ_NO_SUBSCRIBE_TOPICS TAOS_DEF_ERROR_CODE(0, 0x0A0E) // wal // #define TSDB_CODE_WAL_APP_ERROR TAOS_DEF_ERROR_CODE(0, 0x1000) // 2.x diff --git a/source/client/src/clientTmq.c b/source/client/src/clientTmq.c index 00e29f5ecc..d08cabd27e 100644 --- a/source/client/src/clientTmq.c +++ b/source/client/src/clientTmq.c @@ -1076,12 +1076,7 @@ int32_t tmq_subscribe(tmq_t* tmq, const tmq_list_t* topic_list) { SCMSubscribeReq req = {0}; int32_t code = 0; - if (sz == 0) { - tscDebug("consumer:0x%" PRIx64 " cgroup:%s, subscribe %d topics, not allowed", tmq->consumerId, tmq->groupId, sz); - return TSDB_CODE_TQ_NO_SUBSCRIBE_TOPICS; - } else { - tscDebug("consumer:0x%" PRIx64 " cgroup:%s, subscribe %d topics", tmq->consumerId, tmq->groupId, sz); - } + tscDebug("consumer:0x%" PRIx64 " cgroup:%s, subscribe %d topics", tmq->consumerId, tmq->groupId, sz); req.consumerId = tmq->consumerId; tstrncpy(req.clientId, tmq->clientId, 256); diff --git a/source/client/test/clientTests.cpp b/source/client/test/clientTests.cpp index 59c931d9aa..2f3d600019 100644 --- a/source/client/test/clientTests.cpp +++ b/source/client/test/clientTests.cpp @@ -925,7 +925,7 @@ TEST(clientCase, subscription_test) { // 创建订阅 topics 列表 tmq_list_t* topicList = tmq_list_new(); - tmq_list_append(topicList, "topic_t1"); +// tmq_list_append(topicList, "topic_t1"); // 启动订阅 tmq_subscribe(tmq, topicList); @@ -938,6 +938,8 @@ TEST(clientCase, subscription_test) { int32_t msgCnt = 0; int32_t timeout = 5000; + int32_t count = 0; + while (1) { TAOS_RES* pRes = tmq_consumer_poll(tmq, timeout); if (pRes) { @@ -952,6 +954,11 @@ TEST(clientCase, subscription_test) { printf("db: %s\n", dbName); printf("vgroup id: %d\n", vgroupId); + if (count ++ > 20) { + tmq_unsubscribe(tmq); + break; + } + while (1) { TAOS_ROW row = taos_fetch_row(pRes); if (row == NULL) break; diff --git a/source/dnode/mnode/impl/src/mndConsumer.c b/source/dnode/mnode/impl/src/mndConsumer.c index 90f5f8c839..e52b046053 100644 --- a/source/dnode/mnode/impl/src/mndConsumer.c +++ b/source/dnode/mnode/impl/src/mndConsumer.c @@ -82,18 +82,29 @@ bool mndRebTryStart() { } void mndRebEnd() { - int32_t val = atomic_sub_fetch_32(&mqRebInExecCnt, 1); - mInfo("rebalance end, rebalance count:%d", val); + mndRebCntDec(); } void mndRebCntInc() { int32_t val = atomic_add_fetch_32(&mqRebInExecCnt, 1); - mInfo("rebalance trans start, rebalance count:%d", val); + mInfo("rebalance trans start, rebalance counter:%d", val); } void mndRebCntDec() { - int32_t val = atomic_sub_fetch_32(&mqRebInExecCnt, 1); - mInfo("rebalance trans end, rebalance count:%d", val); + while (1) { + int32_t val = atomic_load_32(&mqRebInExecCnt); + if (val <= 0) { + mError("rebalance trans end, rebalance counter:%d should not be less equalled than 0, ignore counter desc", val); + break; + } + + int32_t newVal = val - 1; + int32_t oldVal = atomic_val_compare_exchange_32(&mqRebInExecCnt, val, newVal); + if (oldVal == val) { + mInfo("rebalance trans end, rebalance counter:%d", newVal); + break; + } + } } static int32_t mndProcessConsumerLostMsg(SRpcMsg *pMsg) { @@ -308,6 +319,7 @@ static int32_t mndProcessMqTimerMsg(SRpcMsg *pMsg) { taosRUnLockLatch(&pConsumer->lock); } else if (status == MQ_CONSUMER_STATUS__MODIFY) { taosRLockLatch(&pConsumer->lock); + int32_t newTopicNum = taosArrayGetSize(pConsumer->rebNewTopics); for (int32_t i = 0; i < newTopicNum; i++) { char key[TSDB_SUBSCRIBE_KEY_LEN]; @@ -700,6 +712,7 @@ int32_t mndProcessSubscribeReq(SRpcMsg *pMsg) { // no topics need to be rebalanced if (taosArrayGetSize(pConsumerNew->rebNewTopics) == 0 && taosArrayGetSize(pConsumerNew->rebRemovedTopics) == 0) { +// mInfo(); goto _over; } @@ -1057,7 +1070,6 @@ static int32_t mndRetrieveConsumer(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock * } taosRLockLatch(&pConsumer->lock); - mDebug("showing consumer:0x%" PRIx64, pConsumer->consumerId); int32_t topicSz = taosArrayGetSize(pConsumer->assignedTopics); diff --git a/source/dnode/mnode/impl/src/mndMain.c b/source/dnode/mnode/impl/src/mndMain.c index b09a4f63a7..d83b969e2d 100644 --- a/source/dnode/mnode/impl/src/mndMain.c +++ b/source/dnode/mnode/impl/src/mndMain.c @@ -706,6 +706,9 @@ int32_t mndProcessRpcMsg(SRpcMsg *pMsg) { } else if (code == 0) { mGTrace("msg:%p, successfully processed", pMsg); } else { + if (code == -1) { + code = terrno; + } mGError("msg:%p, failed to process since %s, app:%p type:%s", pMsg, tstrerror(code), pMsg->info.ahandle, TMSG_INFO(pMsg->msgType)); } diff --git a/source/dnode/mnode/impl/src/mndSubscribe.c b/source/dnode/mnode/impl/src/mndSubscribe.c index 648014d97e..86f6976398 100644 --- a/source/dnode/mnode/impl/src/mndSubscribe.c +++ b/source/dnode/mnode/impl/src/mndSubscribe.c @@ -263,7 +263,7 @@ static int32_t mndDoRebalance(SMnode *pMnode, const SMqRebInputObj *pInput, SMqR imbConsumerNum = totalVgNum % afterRebConsumerNum; } - mInfo("sub:%s mq re-balance %d consumers: at least %d vg each, %d consumer has more vg", sub, + mInfo("sub:%s mq re-balance %d consumers: at least %d vgs each, %d consumers has more vgs", sub, afterRebConsumerNum, minVgCnt, imbConsumerNum); // 4. first scan: remove consumer more than wanted, put to remove hash @@ -591,13 +591,13 @@ static int32_t mndProcessRebalanceReq(SRpcMsg *pMsg) { rebOutput.pSub = mndCreateSubscription(pMnode, pTopic, pRebInfo->key); if (rebOutput.pSub == NULL) { - mError("mq rebalance %s failed create sub since %s, abort", pRebInfo->key, terrstr()); + mError("mq rebalance %s failed create sub since %s, ignore", pRebInfo->key, terrstr()); taosRUnLockLatch(&pTopic->lock); mndReleaseTopic(pMnode, pTopic); continue; } - memcpy(rebOutput.pSub->dbName, pTopic->db, TSDB_DB_FNAME_LEN); + memcpy(rebOutput.pSub->dbName, pTopic->db, TSDB_DB_FNAME_LEN); taosRUnLockLatch(&pTopic->lock); mndReleaseTopic(pMnode, pTopic); diff --git a/source/dnode/vnode/src/tq/tqRead.c b/source/dnode/vnode/src/tq/tqRead.c index f4c96d073b..8712a93bff 100644 --- a/source/dnode/vnode/src/tq/tqRead.c +++ b/source/dnode/vnode/src/tq/tqRead.c @@ -297,7 +297,7 @@ int32_t tqSeekVer(STqReader* pReader, int64_t ver, const char* id) { tqError("tmq poll: wal reader failed to seek to ver:%"PRId64" code:%s, %s", ver, tstrerror(terrno), id); return -1; } else { - tqError("tmq poll: wal reader seek to ver:%"PRId64" %s", ver, id); + tqDebug("tmq poll: wal reader seek to ver:%"PRId64" %s", ver, id); return 0; } } @@ -308,13 +308,12 @@ int32_t tqNextBlock(STqReader* pReader, SFetchRet* ret) { while (1) { if (!fromProcessedMsg) { if (walNextValidMsg(pReader->pWalReader) < 0) { - pReader->ver = - pReader->pWalReader->curVersion - pReader->pWalReader->curStopped; -// pReader->pWalReader->curVersion - (pReader->pWalReader->curInvalid | pReader->pWalReader->curStopped); + pReader->ver = pReader->pWalReader->curVersion - pReader->pWalReader->curStopped; ret->offset.type = TMQ_OFFSET__LOG; + ret->offset.version = pReader->ver; ret->fetchType = FETCH_TYPE__NONE; - tqDebug("return offset %" PRId64 ", no more valid", ret->offset.version); + tqDebug("return offset %" PRId64 ", no more valid msg in wal", ret->offset.version); return -1; } diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c index 8576ac74c7..ccc721996f 100644 --- a/source/libs/executor/src/scanoperator.c +++ b/source/libs/executor/src/scanoperator.c @@ -1632,8 +1632,12 @@ static SSDataBlock* doQueueScan(SOperatorInfo* pOperator) { while (1) { SFetchRet ret = {0}; if (tqNextBlock(pInfo->tqReader, &ret) < 0) { - qError("failed to get next log block since %s", terrstr()); + // if the end is reached, terrno is 0 + if (terrno != 0) { + qError("failed to get next log block since %s", terrstr()); + } } + if (ret.fetchType == FETCH_TYPE__DATA) { blockDataCleanup(pInfo->pRes); setBlockIntoRes(pInfo, &ret.data, true); diff --git a/source/util/src/terror.c b/source/util/src/terror.c index 6e63776afe..33b562c8dd 100644 --- a/source/util/src/terror.c +++ b/source/util/src/terror.c @@ -436,7 +436,6 @@ TAOS_DEFINE_ERROR(TSDB_CODE_TQ_META_KEY_DUP_IN_TXN, "TQ met key dup in txn TAOS_DEFINE_ERROR(TSDB_CODE_TQ_GROUP_NOT_SET, "TQ group not exist") TAOS_DEFINE_ERROR(TSDB_CODE_TQ_TABLE_SCHEMA_NOT_FOUND, "TQ table schema not found") TAOS_DEFINE_ERROR(TSDB_CODE_TQ_NO_COMMITTED_OFFSET, "TQ no committed offset") -TAOS_DEFINE_ERROR(TSDB_CODE_TQ_NO_SUBSCRIBE_TOPICS, "TQ no topics") // wal TAOS_DEFINE_ERROR(TSDB_CODE_WAL_FILE_CORRUPTED, "WAL file is corrupted") From 42ba45e60d2aa7fa284ce5f2c5dd4c5718fbf0ab Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Sun, 5 Mar 2023 13:25:00 +0800 Subject: [PATCH 107/174] fix debug info --- source/libs/transport/src/transCli.c | 1 - 1 file changed, 1 deletion(-) diff --git a/source/libs/transport/src/transCli.c b/source/libs/transport/src/transCli.c index b97597dc65..79afe95342 100644 --- a/source/libs/transport/src/transCli.c +++ b/source/libs/transport/src/transCli.c @@ -804,7 +804,6 @@ static int32_t specifyConnRef(SCliConn* conn, bool update, int64_t handle) { static void cliAllocRecvBufferCb(uv_handle_t* handle, size_t suggested_size, uv_buf_t* buf) { SCliConn* conn = handle->data; SConnBuffer* pBuf = &conn->readBuf; - tTrace("%s conn %p alloc read buf", CONN_GET_INST_LABEL(conn), conn); transAllocBuffer(pBuf, buf); } static void cliRecvCb(uv_stream_t* handle, ssize_t nread, const uv_buf_t* buf) { From 6fafa8443e37332ce61a64c21e75b8eeef856a14 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Sun, 5 Mar 2023 15:32:00 +0800 Subject: [PATCH 108/174] fix(query): sleep a little bit when errors occur. --- source/client/src/clientTmq.c | 5 +++-- source/dnode/mnode/impl/src/mndConsumer.c | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/source/client/src/clientTmq.c b/source/client/src/clientTmq.c index d08cabd27e..f6a2c5fdc1 100644 --- a/source/client/src/clientTmq.c +++ b/source/client/src/clientTmq.c @@ -1228,8 +1228,9 @@ int32_t tmqPollCb(void* param, SDataBuf* pMsg, int32_t code) { // in case of consumer mismatch, wait for 500ms and retry if (code == TSDB_CODE_TMQ_CONSUMER_MISMATCH) { -// taosMsleep(500); + taosMsleep(500); atomic_store_8(&tmq->status, TMQ_CONSUMER_STATUS__RECOVER); + tscDebug("consumer:0x%" PRIx64" wait for the re-balance, wait for 500ms and set status to be RECOVER", tmq->consumerId); } else if (code == TSDB_CODE_TQ_NO_COMMITTED_OFFSET) { SMqPollRspWrapper* pRspWrapper = taosAllocateQitem(sizeof(SMqPollRspWrapper), DEF_QITEM, 0); if (pRspWrapper == NULL) { @@ -1918,7 +1919,7 @@ TAOS_RES* tmq_consumer_poll(tmq_t* tmq, int64_t timeout) { // in no topic status, delayed task also need to be processed if (atomic_load_8(&tmq->status) == TMQ_CONSUMER_STATUS__INIT) { tscDebug("consumer:0x%" PRIx64 " poll return since consumer is init", tmq->consumerId); - // sleep for a while + taosMsleep(500); // sleep for a while return NULL; } diff --git a/source/dnode/mnode/impl/src/mndConsumer.c b/source/dnode/mnode/impl/src/mndConsumer.c index e52b046053..24974a1973 100644 --- a/source/dnode/mnode/impl/src/mndConsumer.c +++ b/source/dnode/mnode/impl/src/mndConsumer.c @@ -637,7 +637,7 @@ int32_t mndProcessSubscribeReq(SRpcMsg *pMsg) { subscribe.cgroup, (int32_t) taosArrayGetSize(pTopicList)); pConsumerNew = tNewSMqConsumerObj(consumerId, cgroup); - tstrncpy(pConsumerNew->clientId, subscribe.clientId, 256); + tstrncpy(pConsumerNew->clientId, subscribe.clientId, tListLen(pConsumerNew->clientId)); // set the update type pConsumerNew->updateType = CONSUMER_UPDATE__MODIFY; From 3362b8a4caf3f3a446858010a9118b8351594f7d Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Sun, 5 Mar 2023 15:38:11 +0800 Subject: [PATCH 109/174] fix mem leak --- source/libs/transport/src/transCli.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source/libs/transport/src/transCli.c b/source/libs/transport/src/transCli.c index 79afe95342..1016b50542 100644 --- a/source/libs/transport/src/transCli.c +++ b/source/libs/transport/src/transCli.c @@ -890,6 +890,7 @@ static void cliDestroyConn(SCliConn* conn, bool clear) { connList->list->numOfConn--; } conn->list = NULL; + pThrd->newConnCount--; transReleaseExHandle(transGetRefMgt(), conn->refId); transRemoveExHandle(transGetRefMgt(), conn->refId); @@ -2074,6 +2075,7 @@ static void destroyThrdObj(SCliThrd* pThrd) { pIter = (void**)taosHashIterate(pThrd->batchCache, pIter); } taosHashCleanup(pThrd->batchCache); + taosHashCleanup(pThrd->msgCount); taosMemoryFree(pThrd); } From 54184cda3c322e514086ad57b64519befed26a07 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Mon, 6 Mar 2023 09:42:08 +0800 Subject: [PATCH 110/174] fix: should not set startFunc/stopFunc to 0. when the trans is not finished on taosd stop, it will cause the startFunc/stopFunc setting error --- source/dnode/mnode/impl/src/mndTrans.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/dnode/mnode/impl/src/mndTrans.c b/source/dnode/mnode/impl/src/mndTrans.c index eccabf2d5c..1ae61213ec 100644 --- a/source/dnode/mnode/impl/src/mndTrans.c +++ b/source/dnode/mnode/impl/src/mndTrans.c @@ -512,7 +512,7 @@ static int32_t mndTransActionInsert(SSdb *pSdb, STrans *pTrans) { if (fp) { (*fp)(pSdb->pMnode, pTrans->param, pTrans->paramLen); } - pTrans->startFunc = 0; + // pTrans->startFunc = 0; } return 0; @@ -555,7 +555,7 @@ static int32_t mndTransActionDelete(SSdb *pSdb, STrans *pTrans, bool callFunc) { if (fp) { (*fp)(pSdb->pMnode, pTrans->param, pTrans->paramLen); } - pTrans->stopFunc = 0; + // pTrans->stopFunc = 0; } mndTransDropData(pTrans); From d8fb5914353dd007f7a9c85443e4b3af9f1a1422 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Mon, 6 Mar 2023 09:46:12 +0800 Subject: [PATCH 111/174] fix:incorrectly judged that the stream was killed --- source/libs/executor/inc/executorimpl.h | 1 + source/libs/executor/src/executor.c | 14 +++++++++++++- source/libs/executor/src/scanoperator.c | 2 +- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/source/libs/executor/inc/executorimpl.h b/source/libs/executor/inc/executorimpl.h index be79054c1b..0b55eb4a45 100644 --- a/source/libs/executor/inc/executorimpl.h +++ b/source/libs/executor/inc/executorimpl.h @@ -881,6 +881,7 @@ SExprInfo* createExpr(SNodeList* pNodeList, int32_t* numOfExprs); void copyResultrowToDataBlock(SExprInfo* pExprInfo, int32_t numOfExprs, SResultRow* pRow, SqlFunctionCtx* pCtx, SSDataBlock* pBlock, const int32_t* rowEntryOffset, SExecTaskInfo* pTaskInfo); void doUpdateNumOfRows(SqlFunctionCtx* pCtx, SResultRow* pRow, int32_t numOfExprs, const int32_t* rowEntryOffset); +void doClearBufferedBlocks(SStreamScanInfo* pInfo); #ifdef __cplusplus } diff --git a/source/libs/executor/src/executor.c b/source/libs/executor/src/executor.c index c2bf001c86..d8e7c25bbb 100644 --- a/source/libs/executor/src/executor.c +++ b/source/libs/executor/src/executor.c @@ -93,6 +93,17 @@ static int32_t doSetStreamOpOpen(SOperatorInfo* pOperator, char* id) { return 0; } +static void clearStreamBlock(SOperatorInfo* pOperator) { + if (pOperator->operatorType != QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN) { + if (pOperator->numOfDownstream == 1) { + return clearStreamBlock(pOperator->pDownstream[0]); + } + } else { + SStreamScanInfo* pInfo = pOperator->info; + doClearBufferedBlocks(pInfo); + } +} + static int32_t doSetStreamBlock(SOperatorInfo* pOperator, void* input, size_t numOfBlocks, int32_t type, char* id) { if (pOperator->operatorType != QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN) { if (pOperator->numOfDownstream == 0) { @@ -607,7 +618,8 @@ int32_t qExecTask(qTaskInfo_t tinfo, SSDataBlock** pRes, uint64_t* useconds) { pTaskInfo->cost.start = taosGetTimestampUs(); } - if (isTaskKilled(pTaskInfo)) { + if (isTaskKilled(pTaskInfo) && pTaskInfo->code != TSDB_CODE_QRY_IN_EXEC) { + clearStreamBlock(pTaskInfo->pRoot); atomic_store_64(&pTaskInfo->owner, 0); qDebug("%s already killed, abort", GET_TASKID(pTaskInfo)); return TSDB_CODE_SUCCESS; diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c index 7961d5518a..38822a4565 100644 --- a/source/libs/executor/src/scanoperator.c +++ b/source/libs/executor/src/scanoperator.c @@ -945,7 +945,7 @@ SOperatorInfo* createTableSeqScanOperatorInfo(void* pReadHandle, SExecTaskInfo* return pOperator; } -static FORCE_INLINE void doClearBufferedBlocks(SStreamScanInfo* pInfo) { +FORCE_INLINE void doClearBufferedBlocks(SStreamScanInfo* pInfo) { taosArrayClear(pInfo->pBlockLists); pInfo->validBlockIndex = 0; } From da550029d893d53649d0b25b08b0ebf7dfa85d5b Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Mon, 6 Mar 2023 11:52:52 +0800 Subject: [PATCH 112/174] fix(tmq): fix memory error and adjust some logs. --- source/client/src/clientTmq.c | 2 +- source/dnode/mnode/impl/src/mndConsumer.c | 5 ++--- source/dnode/mnode/impl/src/mndSubscribe.c | 8 +++++--- source/dnode/mnode/impl/src/mndTrans.c | 1 + tests/script/tsim/tmq/consume.sh | 10 +++++----- 5 files changed, 14 insertions(+), 12 deletions(-) diff --git a/source/client/src/clientTmq.c b/source/client/src/clientTmq.c index f6a2c5fdc1..9f24deff94 100644 --- a/source/client/src/clientTmq.c +++ b/source/client/src/clientTmq.c @@ -1291,7 +1291,7 @@ int32_t tmqPollCb(void* param, SDataBuf* pMsg, int32_t code) { tscDebug("consumer:0x%" PRIx64 " recv poll rsp, vgId:%d, req offset:%" PRId64 ", rsp offset:%" PRId64 " type %d, reqId:0x%"PRIx64, tmq->consumerId, pVg->vgId, pRspWrapper->dataRsp.reqOffset.version, pRspWrapper->dataRsp.rspOffset.version, - rspType, pParam->requestId); + rspType, requestId); } else if (rspType == TMQ_MSG_TYPE__POLL_META_RSP) { SDecoder decoder; tDecoderInit(&decoder, POINTER_SHIFT(pMsg->pData, sizeof(SMqRspHead)), pMsg->len - sizeof(SMqRspHead)); diff --git a/source/dnode/mnode/impl/src/mndConsumer.c b/source/dnode/mnode/impl/src/mndConsumer.c index 24974a1973..f1ef83aca5 100644 --- a/source/dnode/mnode/impl/src/mndConsumer.c +++ b/source/dnode/mnode/impl/src/mndConsumer.c @@ -35,9 +35,9 @@ static const char *mndConsumerStatusName(int status); static int32_t mndConsumerActionInsert(SSdb *pSdb, SMqConsumerObj *pConsumer); static int32_t mndConsumerActionDelete(SSdb *pSdb, SMqConsumerObj *pConsumer); -static int32_t mndConsumerActionUpdate(SSdb *pSdb, SMqConsumerObj *pConsumer, SMqConsumerObj *pNewConsumer); +static int32_t mndConsumerActionUpdate(SSdb *pSdb, SMqConsumerObj *pOldConsumer, SMqConsumerObj *pNewConsumer); static int32_t mndProcessConsumerMetaMsg(SRpcMsg *pMsg); -static int32_t mndRetrieveConsumer(SRpcMsg *pMsg, SShowObj *pShow, SSDataBlock *pBlock, int32_t rows); +static int32_t mndRetrieveConsumer(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock, int32_t rows); static void mndCancelGetNextConsumer(SMnode *pMnode, void *pIter); static int32_t mndProcessSubscribeReq(SRpcMsg *pMsg); @@ -712,7 +712,6 @@ int32_t mndProcessSubscribeReq(SRpcMsg *pMsg) { // no topics need to be rebalanced if (taosArrayGetSize(pConsumerNew->rebNewTopics) == 0 && taosArrayGetSize(pConsumerNew->rebRemovedTopics) == 0) { -// mInfo(); goto _over; } diff --git a/source/dnode/mnode/impl/src/mndSubscribe.c b/source/dnode/mnode/impl/src/mndSubscribe.c index 86f6976398..21539a6313 100644 --- a/source/dnode/mnode/impl/src/mndSubscribe.c +++ b/source/dnode/mnode/impl/src/mndSubscribe.c @@ -444,7 +444,9 @@ static int32_t mndDoRebalance(SMnode *pMnode, const SMqRebInputObj *pInput, SMqR static int32_t mndPersistRebResult(SMnode *pMnode, SRpcMsg *pMsg, const SMqRebOutputObj *pOutput) { STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_DB_INSIDE, pMsg, "tmq-reb"); - if (pTrans == NULL) return -1; + if (pTrans == NULL) { + return -1; + } mndTransSetDbName(pTrans, pOutput->pSub->dbName, NULL); if (mndTrancCheckConflict(pMnode, pTrans) != 0) { @@ -616,9 +618,9 @@ static int32_t mndProcessRebalanceReq(SRpcMsg *pMsg) { // if add more consumer to balanced subscribe, // possibly no vg is changed - + // when each topic is re-balanced, issue an trans to save the results in sdb. if (mndPersistRebResult(pMnode, pMsg, &rebOutput) < 0) { - mError("mq re-balance persist re-balance output error, possibly vnode splitted or dropped"); + mError("mq re-balance persist output error, possibly vnode splitted or dropped"); } taosArrayDestroy(pRebInfo->lostConsumers); diff --git a/source/dnode/mnode/impl/src/mndTrans.c b/source/dnode/mnode/impl/src/mndTrans.c index ff8b4dd9ce..39b4252618 100644 --- a/source/dnode/mnode/impl/src/mndTrans.c +++ b/source/dnode/mnode/impl/src/mndTrans.c @@ -875,6 +875,7 @@ int32_t mndTrancCheckConflict(SMnode *pMnode, STrans *pTrans) { } } + if (mndCheckTransConflict(pMnode, pTrans)) { terrno = TSDB_CODE_MND_TRANS_CONFLICT; mError("trans:%d, failed to prepare since %s", pTrans->id, terrstr()); diff --git a/tests/script/tsim/tmq/consume.sh b/tests/script/tsim/tmq/consume.sh index 001ce6ae49..f0c9197a59 100755 --- a/tests/script/tsim/tmq/consume.sh +++ b/tests/script/tsim/tmq/consume.sh @@ -79,15 +79,15 @@ CFG_DIR=$PRG_DIR/cfg LOG_DIR=$PRG_DIR/log echo "------------------------------------------------------------------------" +echo "TOP_DIR: $TOP_DIR" echo "BUILD_DIR: $BUILD_DIR" echo "SIM_DIR : $SIM_DIR" echo "CFG_DIR : $CFG_DIR" - -echo "PROGRAM: $PROGRAM -echo "CFG_DIR: $CFG_DIR -echo "POLL_DELAY: $POLL_DELAY -echo "DB_NAME: $DB_NAME +echo "PROGRAM: $PROGRAM" +echo "CFG_DIR: $CFG_DIR" +echo "POLL_DELAY: $POLL_DELAY" +echo "DB_NAME: $DB_NAME" echo "------------------------------------------------------------------------" if [ "$EXEC_OPTON" = "start" ]; then From 933fa721d6621e003f9d170ddad2a6d001a23e9c Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Mon, 6 Mar 2023 15:49:57 +0800 Subject: [PATCH 113/174] fix:return empty ssdatablock --- source/libs/executor/src/scanoperator.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c index 38822a4565..eea0f77cf6 100644 --- a/source/libs/executor/src/scanoperator.c +++ b/source/libs/executor/src/scanoperator.c @@ -1907,7 +1907,9 @@ FETCH_NEXT_BLOCK: doFilter(pInfo->pRes, pOperator->exprSupp.pFilterInfo, NULL); pInfo->pRes->info.dataLoad = 1; blockDataUpdateTsWindow(pInfo->pRes, pInfo->primaryTsIndex); - return pInfo->pRes; + if (pInfo->pRes->info.rows > 0) { + return pInfo->pRes; + } } break; case STREAM_SCAN_FROM_DELETE_DATA: { generateScanRange(pInfo, pInfo->pUpdateDataRes, pInfo->pUpdateRes); From 809f04dd7cfccd1b18fcd22c8cff379e1aaa3699 Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Mon, 6 Mar 2023 16:32:22 +0800 Subject: [PATCH 114/174] change default valude --- source/common/src/tglobal.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/source/common/src/tglobal.c b/source/common/src/tglobal.c index 5c8f8e885d..83c80c355d 100644 --- a/source/common/src/tglobal.c +++ b/source/common/src/tglobal.c @@ -332,6 +332,10 @@ static int32_t taosAddClientCfg(SConfig *pCfg) { if (cfgAddBool(pCfg, "useAdapter", tsUseAdapter, true) != 0) return -1; if (cfgAddBool(pCfg, "crashReporting", tsEnableCrashReport, true) != 0) return -1; + tsNumOfRpcThreads = tsNumOfCores / 2; + tsNumOfRpcThreads = TRANGE(tsNumOfRpcThreads, 2, TSDB_MAX_RPC_THREADS); + if (cfgAddInt32(pCfg, "numOfRpcThreads", tsNumOfRpcThreads, 1, 1024, 0) != 0) return -1; + tsNumOfRpcSessions = TRANGE(tsNumOfRpcSessions, 100, 100000); if (cfgAddInt32(pCfg, "numOfRpcSessions", tsNumOfRpcSessions, 1, 100000, 0) != 0) return -1; From f01ea67a00cc06d894b3c0f5ca46b2b58700f26e Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Mon, 6 Mar 2023 17:15:14 +0800 Subject: [PATCH 115/174] change default valude --- source/libs/transport/src/transCli.c | 1 - 1 file changed, 1 deletion(-) diff --git a/source/libs/transport/src/transCli.c b/source/libs/transport/src/transCli.c index e554580fc9..6f53674ef7 100644 --- a/source/libs/transport/src/transCli.c +++ b/source/libs/transport/src/transCli.c @@ -786,7 +786,6 @@ static int32_t specifyConnRef(SCliConn* conn, bool update, int64_t handle) { static void cliAllocRecvBufferCb(uv_handle_t* handle, size_t suggested_size, uv_buf_t* buf) { SCliConn* conn = handle->data; SConnBuffer* pBuf = &conn->readBuf; - tTrace("%s conn %p alloc read buf", CONN_GET_INST_LABEL(conn), conn); transAllocBuffer(pBuf, buf); } static void cliRecvCb(uv_stream_t* handle, ssize_t nread, const uv_buf_t* buf) { From 86ef6522ae56e60bdf68dee29d87bebc5e10b813 Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Mon, 6 Mar 2023 17:40:02 +0800 Subject: [PATCH 116/174] fix:wal curVersion error if switch to wal --- source/dnode/vnode/src/tq/tqRead.c | 7 ++++++- source/libs/executor/src/scanoperator.c | 2 ++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/source/dnode/vnode/src/tq/tqRead.c b/source/dnode/vnode/src/tq/tqRead.c index 8712a93bff..bf73cca925 100644 --- a/source/dnode/vnode/src/tq/tqRead.c +++ b/source/dnode/vnode/src/tq/tqRead.c @@ -308,7 +308,12 @@ int32_t tqNextBlock(STqReader* pReader, SFetchRet* ret) { while (1) { if (!fromProcessedMsg) { if (walNextValidMsg(pReader->pWalReader) < 0) { - pReader->ver = pReader->pWalReader->curVersion - pReader->pWalReader->curStopped; +// 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; diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c index ccc721996f..7314e84c9b 100644 --- a/source/libs/executor/src/scanoperator.c +++ b/source/libs/executor/src/scanoperator.c @@ -1609,6 +1609,8 @@ static SSDataBlock* doQueueScan(SOperatorInfo* pOperator) { if (pResult && pResult->info.rows > 0) { qDebug("queue scan tsdb return %d rows min:%" PRId64 " max:%" PRId64, pResult->info.rows, pResult->info.window.skey, pResult->info.window.ekey); + qDebug("queue scan tsdb return %d rows min:%" PRId64 " max:%" PRId64 " wal curVersion:%" PRId64, pResult->info.rows, + pResult->info.window.skey, pResult->info.window.ekey, pInfo->tqReader->pWalReader->curVersion); pTaskInfo->streamInfo.returned = 1; return pResult; } else { From b2247a10cbe151dfffd0b368ffcba1f4df511e2f Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Mon, 6 Mar 2023 18:00:53 +0800 Subject: [PATCH 117/174] fix: last cache invalid write --- source/dnode/vnode/src/tsdb/tsdbCacheRead.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/dnode/vnode/src/tsdb/tsdbCacheRead.c b/source/dnode/vnode/src/tsdb/tsdbCacheRead.c index 5bb224799a..478d21afc9 100644 --- a/source/dnode/vnode/src/tsdb/tsdbCacheRead.c +++ b/source/dnode/vnode/src/tsdb/tsdbCacheRead.c @@ -292,7 +292,8 @@ int32_t tsdbRetrieveCacheRows(void* pReader, SSDataBlock* pResBlock, const int32 } for (int32_t j = 0; j < pr->numOfCols; ++j) { - pRes[j] = taosMemoryCalloc(1, sizeof(SFirstLastRes) + pr->pSchema->columns[slotIds[j]].bytes + VARSTR_HEADER_SIZE); + pRes[j] = taosMemoryCalloc( + 1, sizeof(SFirstLastRes) + pr->pSchema->columns[-1 == slotIds[j] ? 0 : slotIds[j]].bytes + VARSTR_HEADER_SIZE); SFirstLastRes* p = (SFirstLastRes*)varDataVal(pRes[j]); p->ts = INT64_MIN; } From f51a559d560ec8315d8ae48a1b74a86eae404c6b Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Mon, 6 Mar 2023 18:19:19 +0800 Subject: [PATCH 118/174] change default valude --- source/common/src/tglobal.c | 1 + 1 file changed, 1 insertion(+) diff --git a/source/common/src/tglobal.c b/source/common/src/tglobal.c index 83c80c355d..b1c07aac4f 100644 --- a/source/common/src/tglobal.c +++ b/source/common/src/tglobal.c @@ -727,6 +727,7 @@ static int32_t taosSetClientCfg(SConfig *pCfg) { tsMaxRetryWaitTime = cfgGetItem(pCfg, "maxRetryWaitTime")->i32; + tsNumOfRpcThreads = cfgGetItem(pCfg, "numOfRpcThreads")->i32; tsNumOfRpcSessions = cfgGetItem(pCfg, "numOfRpcSessions")->i32; tsTimeToGetAvailableConn = cfgGetItem(pCfg, "timeToGetAvailableConn")->i32; From 56eba758064cc4bcb92d7f53b3f67ae13ab0bbcc Mon Sep 17 00:00:00 2001 From: Benguang Zhao Date: Mon, 6 Mar 2023 19:26:51 +0800 Subject: [PATCH 119/174] enh: print mnode epSet on sending dnode status failure --- source/dnode/mgmt/mgmt_dnode/src/dmHandle.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/source/dnode/mgmt/mgmt_dnode/src/dmHandle.c b/source/dnode/mgmt/mgmt_dnode/src/dmHandle.c index 0724fcc63a..1dd87d0543 100644 --- a/source/dnode/mgmt/mgmt_dnode/src/dmHandle.c +++ b/source/dnode/mgmt/mgmt_dnode/src/dmHandle.c @@ -61,6 +61,16 @@ static void dmProcessStatusRsp(SDnodeMgmt *pMgmt, SRpcMsg *pRsp) { rpcFreeCont(pRsp->pCont); } +void dmEpSetToStr(char *buf, int32_t len, SEpSet *epSet) { + int32_t n = 0; + n += snprintf(buf + n, len - n, "%s", "{"); + for (int i = 0; i < epSet->numOfEps; i++) { + n += snprintf(buf + n, len - n, "%s:%d%s", epSet->eps[i].fqdn, epSet->eps[i].port, + (i + 1 < epSet->numOfEps ? ", " : "")); + } + n += snprintf(buf + n, len - n, "%s", "}"); +} + void dmSendStatusReq(SDnodeMgmt *pMgmt) { SStatusReq req = {0}; @@ -119,11 +129,9 @@ void dmSendStatusReq(SDnodeMgmt *pMgmt) { dmGetMnodeEpSet(pMgmt->pData, &epSet); rpcSendRecv(pMgmt->msgCb.clientRpc, &epSet, &rpcMsg, &rpcRsp); if (rpcRsp.code != 0) { - dError("failed to send status req since %s, numOfEps:%d inUse:%d", tstrerror(rpcRsp.code), epSet.numOfEps, - epSet.inUse); - for (int32_t i = 0; i < epSet.numOfEps; ++i) { - dDebug("index:%d, mnode ep:%s:%u", i, epSet.eps[i].fqdn, epSet.eps[i].port); - } + char tbuf[256]; + dmEpSetToStr(tbuf, sizeof(tbuf), &epSet); + dError("failed to send status req since %s, epSet:%s, inUse:%d", tstrerror(rpcRsp.code), tbuf, epSet.inUse); } dmProcessStatusRsp(pMgmt, &rpcRsp); } From c0a835ff58e99312637efd810680e061efa6e49c Mon Sep 17 00:00:00 2001 From: Benguang Zhao Date: Mon, 6 Mar 2023 19:34:24 +0800 Subject: [PATCH 120/174] enh: rotate mnode epSet on sending dnode status failure --- source/dnode/mgmt/mgmt_dnode/src/dmHandle.c | 1 + source/dnode/mgmt/node_util/inc/dmUtil.h | 1 + source/dnode/mgmt/node_util/src/dmEps.c | 22 +++++++++++++++++++++ 3 files changed, 24 insertions(+) diff --git a/source/dnode/mgmt/mgmt_dnode/src/dmHandle.c b/source/dnode/mgmt/mgmt_dnode/src/dmHandle.c index 1dd87d0543..228f301aec 100644 --- a/source/dnode/mgmt/mgmt_dnode/src/dmHandle.c +++ b/source/dnode/mgmt/mgmt_dnode/src/dmHandle.c @@ -129,6 +129,7 @@ void dmSendStatusReq(SDnodeMgmt *pMgmt) { dmGetMnodeEpSet(pMgmt->pData, &epSet); rpcSendRecv(pMgmt->msgCb.clientRpc, &epSet, &rpcMsg, &rpcRsp); if (rpcRsp.code != 0) { + dmRotateMnodeEpSet(pMgmt->pData); char tbuf[256]; dmEpSetToStr(tbuf, sizeof(tbuf), &epSet); dError("failed to send status req since %s, epSet:%s, inUse:%d", tstrerror(rpcRsp.code), tbuf, epSet.inUse); diff --git a/source/dnode/mgmt/node_util/inc/dmUtil.h b/source/dnode/mgmt/node_util/inc/dmUtil.h index 55ee6d6973..cfdea40477 100644 --- a/source/dnode/mgmt/node_util/inc/dmUtil.h +++ b/source/dnode/mgmt/node_util/inc/dmUtil.h @@ -166,6 +166,7 @@ int32_t dmReadEps(SDnodeData *pData); int32_t dmWriteEps(SDnodeData *pData); void dmUpdateEps(SDnodeData *pData, SArray *pDnodeEps); void dmGetMnodeEpSet(SDnodeData *pData, SEpSet *pEpSet); +void dmRotateMnodeEpSet(SDnodeData *pData); void dmGetMnodeEpSetForRedirect(SDnodeData *pData, SRpcMsg *pMsg, SEpSet *pEpSet); void dmSetMnodeEpSet(SDnodeData *pData, SEpSet *pEpSet); bool dmUpdateDnodeInfo(void *pData, int32_t *dnodeId, int64_t *clusterId, char *fqdn, uint16_t *port); diff --git a/source/dnode/mgmt/node_util/src/dmEps.c b/source/dnode/mgmt/node_util/src/dmEps.c index e9ab8a0460..784d2b425b 100644 --- a/source/dnode/mgmt/node_util/src/dmEps.c +++ b/source/dnode/mgmt/node_util/src/dmEps.c @@ -325,6 +325,28 @@ void dmGetMnodeEpSet(SDnodeData *pData, SEpSet *pEpSet) { taosThreadRwlockUnlock(&pData->lock); } +static FORCE_INLINE void dmSwapEps(SEp *epLhs, SEp *epRhs) { + SEp epTmp; + + epTmp.port = epLhs->port; + tstrncpy(epTmp.fqdn, epLhs->fqdn, tListLen(epTmp.fqdn)); + + epLhs->port = epRhs->port; + tstrncpy(epLhs->fqdn, epRhs->fqdn, tListLen(epLhs->fqdn)); + + epRhs->port = epTmp.port; + tstrncpy(epRhs->fqdn, epTmp.fqdn, tListLen(epRhs->fqdn)); +} + +void dmRotateMnodeEpSet(SDnodeData *pData) { + taosThreadRwlockRdlock(&pData->lock); + SEpSet *pEpSet = &pData->mnodeEps; + for (int i = 1; i < pEpSet->numOfEps; i++) { + dmSwapEps(&pEpSet->eps[i - 1], &pEpSet->eps[i]); + } + taosThreadRwlockUnlock(&pData->lock); +} + void dmGetMnodeEpSetForRedirect(SDnodeData *pData, SRpcMsg *pMsg, SEpSet *pEpSet) { dmGetMnodeEpSet(pData, pEpSet); dTrace("msg is redirected, handle:%p num:%d use:%d", pMsg->info.handle, pEpSet->numOfEps, pEpSet->inUse); From 561c7886749e2caf82a8a683434c5a7eb58bb199 Mon Sep 17 00:00:00 2001 From: Ganlin Zhao Date: Mon, 6 Mar 2023 23:00:07 +0800 Subject: [PATCH 121/174] fix(query): fix apercentile crash in stream due to dereferencing invalid address --- source/libs/function/src/builtinsimpl.c | 1 + 1 file changed, 1 insertion(+) diff --git a/source/libs/function/src/builtinsimpl.c b/source/libs/function/src/builtinsimpl.c index 9631aa76bb..6e3c8f111c 100644 --- a/source/libs/function/src/builtinsimpl.c +++ b/source/libs/function/src/builtinsimpl.c @@ -1940,6 +1940,7 @@ int32_t apercentileFunctionMerge(SqlFunctionCtx* pCtx) { } if (pInfo->algo != APERCT_ALGO_TDIGEST) { + buildHistogramInfo(pInfo); qDebug("%s after merge, total:%" PRId64 ", numOfEntry:%d, %p", __FUNCTION__, pInfo->pHisto->numOfElems, pInfo->pHisto->numOfEntries, pInfo->pHisto); } From 77f86c672997d332f006bd7dfcaa26c1734cbeec Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Mon, 6 Mar 2023 23:24:30 +0800 Subject: [PATCH 122/174] fix:wrong uasge of taosArrayGet --- source/dnode/mnode/impl/src/mndSubscribe.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/dnode/mnode/impl/src/mndSubscribe.c b/source/dnode/mnode/impl/src/mndSubscribe.c index 21539a6313..4d19110f31 100644 --- a/source/dnode/mnode/impl/src/mndSubscribe.c +++ b/source/dnode/mnode/impl/src/mndSubscribe.c @@ -772,7 +772,7 @@ static SSdbRow *mndSubActionDecode(SSdbRaw *pRaw) { if (pSub->unassignedVgs != NULL) { int32_t size = (int32_t)taosArrayGetSize(pSub->unassignedVgs); for (int32_t i = 0; i < size; ++i) { - SMqVgEp *pMqVgEp = taosArrayGet(pSub->unassignedVgs, i); + SMqVgEp *pMqVgEp = (SMqVgEp *)taosArrayGetP(pSub->unassignedVgs, i); tmsgUpdateDnodeEpSet(&pMqVgEp->epSet); } } @@ -782,7 +782,7 @@ static SSdbRow *mndSubActionDecode(SSdbRaw *pRaw) { SMqConsumerEp *pConsumerEp = pIter; int32_t size = (int32_t)taosArrayGetSize(pConsumerEp->vgs); for (int32_t i = 0; i < size; ++i) { - SMqVgEp *pMqVgEp = taosArrayGet(pConsumerEp->vgs, i); + SMqVgEp *pMqVgEp = (SMqVgEp *)taosArrayGetP(pConsumerEp->vgs, i); tmsgUpdateDnodeEpSet(&pMqVgEp->epSet); } pIter = taosHashIterate(pSub->consumerHash, pIter); From dd2137eab73dad3314a2bde69c58fed0965b44a3 Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Tue, 7 Mar 2023 09:22:20 +0800 Subject: [PATCH 123/174] fix: empty ts range in nested query --- source/libs/parser/src/parTranslater.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index fd2d5d53f4..b70a0f83a4 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -2500,6 +2500,12 @@ static int32_t translateTable(STranslateContext* pCxt, SNode* pTable) { STempTableNode* pTempTable = (STempTableNode*)pTable; code = translateSubquery(pCxt, pTempTable->pSubquery); if (TSDB_CODE_SUCCESS == code) { + if (QUERY_NODE_SELECT_STMT == nodeType(pTempTable->pSubquery) && + ((SSelectStmt*)pTempTable->pSubquery)->isEmptyResult && + isSelectStmt(pCxt->pCurrStmt)) { + ((SSelectStmt*)pCxt->pCurrStmt)->isEmptyResult = true; + } + pTempTable->table.precision = getStmtPrecision(pTempTable->pSubquery); pTempTable->table.singleTable = stmtIsSingleTable(pTempTable->pSubquery); code = addNamespace(pCxt, pTempTable); From bc9eb47e04de72fe33ad1274a40e21622a7f1259 Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Tue, 7 Mar 2023 10:14:39 +0800 Subject: [PATCH 124/174] fix: after the last cache is created, modify the schema and query again, resulting in taosd crash --- source/dnode/vnode/src/tsdb/tsdbCacheRead.c | 9 +++++---- source/libs/function/src/builtinsimpl.c | 3 +++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/source/dnode/vnode/src/tsdb/tsdbCacheRead.c b/source/dnode/vnode/src/tsdb/tsdbCacheRead.c index 478d21afc9..0ee42366de 100644 --- a/source/dnode/vnode/src/tsdb/tsdbCacheRead.c +++ b/source/dnode/vnode/src/tsdb/tsdbCacheRead.c @@ -38,16 +38,17 @@ static int32_t saveOneRow(SArray* pRow, SSDataBlock* pBlock, SCacheRowsReader* p *(int64_t*)p->buf = pColVal->ts; allNullRow = false; } else { - int32_t slotId = slotIds[i]; - SLastCol* pColVal = (SLastCol*)taosArrayGet(pRow, slotId); - + int32_t slotId = slotIds[i]; // add check for null value, caused by the modification of table schema (new column added). - if (pColVal == NULL) { + if (slotId >= taosArrayGetSize(pRow)) { p->ts = 0; p->isNull = true; + colDataSetNULL(pColInfoData, numOfRows); continue; } + SLastCol* pColVal = (SLastCol*)taosArrayGet(pRow, slotId); + p->ts = pColVal->ts; p->isNull = !COL_VAL_IS_VALUE(&pColVal->colVal); allNullRow = p->isNull & allNullRow; diff --git a/source/libs/function/src/builtinsimpl.c b/source/libs/function/src/builtinsimpl.c index 9631aa76bb..7f0c38f215 100644 --- a/source/libs/function/src/builtinsimpl.c +++ b/source/libs/function/src/builtinsimpl.c @@ -2461,6 +2461,9 @@ static int32_t firstLastFunctionMergeImpl(SqlFunctionCtx* pCtx, bool isFirstQuer int32_t numOfElems = 0; for (int32_t i = start; i < start + pInput->numOfRows; ++i) { + if (colDataIsNull_s(pCol, i)) { + continue; + } char* data = colDataGetData(pCol, i); SFirstLastRes* pInputInfo = (SFirstLastRes*)varDataVal(data); int32_t code = firstLastTransferInfo(pCtx, pInputInfo, pInfo, isFirstQuery, i); From 424a37fd3a73dd2a5b440a67fc939007b4d10175 Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Tue, 7 Mar 2023 10:20:48 +0800 Subject: [PATCH 125/174] some code --- source/dnode/vnode/src/inc/vnodeInt.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source/dnode/vnode/src/inc/vnodeInt.h b/source/dnode/vnode/src/inc/vnodeInt.h index c0d017e350..ca61a4dfce 100644 --- a/source/dnode/vnode/src/inc/vnodeInt.h +++ b/source/dnode/vnode/src/inc/vnodeInt.h @@ -460,6 +460,8 @@ struct SCompactInfo { SVnode* pVnode; int32_t flag; int64_t commitID; + int64_t stime; + int64_t etime; }; #ifdef __cplusplus From e1be1c8d0f3e84897ec8239422ff174156d64b3c Mon Sep 17 00:00:00 2001 From: chenhaoran Date: Tue, 7 Mar 2023 11:53:45 +0800 Subject: [PATCH 126/174] test: add stream and topic in compatibility case --- tests/system-test/0-others/compa4096.json | 2 +- tests/system-test/0-others/compatibility.py | 91 ++++++++++++++++----- tests/system-test/0-others/testRoll.py | 83 +++++++++++++++++++ 3 files changed, 154 insertions(+), 22 deletions(-) create mode 100644 tests/system-test/0-others/testRoll.py diff --git a/tests/system-test/0-others/compa4096.json b/tests/system-test/0-others/compa4096.json index 5cc5d2084d..49e0ec1d8a 100644 --- a/tests/system-test/0-others/compa4096.json +++ b/tests/system-test/0-others/compa4096.json @@ -41,7 +41,7 @@ "interlace_rows": 0, "line_protocol": null, "tcp_transfer": "no", - "insert_rows": 10000, + "insert_rows": 1000, "childtable_limit": 0, "childtable_offset": 0, "rows_per_tbl": 0, diff --git a/tests/system-test/0-others/compatibility.py b/tests/system-test/0-others/compatibility.py index a5cded7a6b..8764a169fa 100644 --- a/tests/system-test/0-others/compatibility.py +++ b/tests/system-test/0-others/compatibility.py @@ -3,6 +3,8 @@ import taos import sys import os import time +import inspect +from taos.tmq import Consumer from pathlib import Path from util.log import * @@ -14,7 +16,7 @@ from util.dnodes import TDDnode from util.cluster import * import subprocess -BASEVERSION = "3.0.1.8" +BASEVERSION = "3.0.2.5" class TDTestCase: def caseDescription(self): ''' @@ -99,6 +101,7 @@ class TDTestCase: def run(self): + scriptsPath = os.path.dirname(os.path.realpath(__file__)) distro_id = distro.id() if distro_id == "alpine": tdLog.info(f"alpine skip compatibility test") @@ -128,19 +131,18 @@ class TDTestCase: tdLog.printNoPrefix(f"==========step1:prepare and check data in old version-{BASEVERSION}") tdLog.info(f" LD_LIBRARY_PATH=/usr/lib taosBenchmark -t {tableNumbers} -n {recordNumbers1} -y ") os.system(f"LD_LIBRARY_PATH=/usr/lib taosBenchmark -t {tableNumbers} -n {recordNumbers1} -y ") - sleep(3) + os.system(f"LD_LIBRARY_PATH=/usr/lib taos -s 'use test;create stream current_stream into current_stream_output_stb as select _wstart as `start`, _wend as wend, max(current) as max_current from meters where voltage <= 220 interval (5s);' ") + os.system('LD_LIBRARY_PATH=/usr/lib taos -s "use test;create stream power_stream into power_stream_output_stb as select ts, concat_ws(\\".\\", location, tbname) as meter_location, current*voltage*cos(phase) as active_power, current*voltage*sin(phase) as reactive_power from meters partition by tbname;" ') + os.system('LD_LIBRARY_PATH=/usr/lib taos -s "use test;show streams;" ') + os.system(f"cd {scriptsPath} && python3 testRoll.py") + os.system('LD_LIBRARY_PATH=/usr/lib taos -s "use test;show topics;" ') - # tdsqlF.query(f"select count(*) from {stb}") - # tdsqlF.checkData(0,0,tableNumbers*recordNumbers1) - os.system("pkill taosd") - self.checkProcessPid("taosd") - - print(f"start taosd: nohup taosd -c {cPath} & ") - os.system(f" nohup taosd -c {cPath} & " ) - sleep(10) + # print(f"start taosd: nohup taosd -c {cPath} & ") + # os.system(f" nohup taosd -c {cPath} & " ) tdLog.info(" LD_LIBRARY_PATH=/usr/lib taosBenchmark -f 0-others/compa4096.json -y ") os.system("LD_LIBRARY_PATH=/usr/lib taosBenchmark -f 0-others/compa4096.json -y") - os.system("pkill taosd") # make sure all the data are saved in disk. + os.system("LD_LIBRARY_PATH=/usr/lib taos -s 'flush database db4096 '") + os.system("pkill taosd") # make sure all the data are saved in disk. self.checkProcessPid("taosd") @@ -161,12 +163,14 @@ class TDTestCase: tdLog.printNoPrefix(f"==========step3:prepare and check data in new version-{nowServerVersion}") tdsql.query(f"select count(*) from {stb}") - tdsql.checkData(0,0,tableNumbers*recordNumbers1) - os.system(f"taosBenchmark -t {tableNumbers} -n {recordNumbers2} -y ") - tdsql.query(f"select count(*) from {stb}") - tdsql.checkData(0,0,tableNumbers*recordNumbers2) + tdsql.checkData(0,0,tableNumbers*recordNumbers1) + # tdsql.query("show streams;") + # os.system(f"taosBenchmark -t {tableNumbers} -n {recordNumbers2} -y ") + # tdsql.query("show streams;") + # tdsql.query(f"select count(*) from {stb}") + # tdsql.checkData(0,0,tableNumbers*recordNumbers2) tdsql.query(f"select count(*) from db4096.stb0") - tdsql.checkData(0,0,50000) + tdsql.checkData(0,0,5000) tdsql=tdCom.newTdSql() tdLog.printNoPrefix(f"==========step4:verify backticks in taos Sql-TD18542") @@ -183,13 +187,58 @@ class TDTestCase: tdsql.execute("insert into db.`ct4` using db.stb1 TAGS(4) values(now(),14);") tdsql.query("select * from db.ct4") tdsql.checkData(0,1,14) + print(1) + tdsql=tdCom.newTdSql() tdsql.query("describe information_schema.ins_databases;") qRows=tdsql.queryRows - for i in range(qRows) : - if tdsql.queryResult[i][0]=="retentions" : - return True - else: - return False + comFlag=True + j=0 + while comFlag: + for i in range(qRows) : + if tdsql.queryResult[i][0] == "retentions" : + print("parameters include retentions") + comFlag=False + break + else : + comFlag=True + j=j+1 + if j == qRows: + print("parameters don't include retentions") + caller = inspect.getframeinfo(inspect.stack()[0][0]) + args = (caller.filename, caller.lineno) + tdLog.exit("%s(%d) failed" % args) + tdsql.query("show streams;") + tdsql.checkRows(2) + tdsql.execute("insert into tmq_test.tb1 values (now, 11, 3.0, 'tmq test1');") + tdsql.execute("insert into tmq_test.tb2 values (now, 22, 3.0, 'tmq test2');") + + conn = taos.connect() + + consumer = Consumer( + { + "group.id": "tg75", + "client.id": "124", + "td.connect.user": "root", + "td.connect.pass": "taosdata", + "enable.auto.commit": "true", + "experimental.snapshot.enable": "true", + } + ) + consumer.subscribe(["tmq_test_topic"]) + + while True: + res = consumer.poll(10) + if not res: + break + err = res.error() + if err is not None: + raise err + val = res.value() + + for block in val: + print(block.fetchall()) + tdsql.query("show topics;") + tdsql.checkRows(1) def stop(self): tdSql.close() tdLog.success(f"{__file__} successfully executed") diff --git a/tests/system-test/0-others/testRoll.py b/tests/system-test/0-others/testRoll.py new file mode 100644 index 0000000000..56e5b3630a --- /dev/null +++ b/tests/system-test/0-others/testRoll.py @@ -0,0 +1,83 @@ +from taos.tmq import Consumer +import taos +import taosrest +import socket + + +def init_tmq_env(db, topic): + conn = taos.connect() + # conn.execute("create dnode test209") + # conn.execute("create dnode test216") + # conn.execute("create mnode on dnode 2") + # conn.execute("create mnode on dnode 3") + + conn.execute("drop topic if exists {}".format(topic)) + conn.execute("drop database if exists {}".format(db)) + conn.execute("create database if not exists {} replica 1 ".format(db)) + conn.select_db(db) + conn.execute( + "create stable if not exists stb1 (ts timestamp, c1 int, c2 float, c3 varchar(16)) tags(t1 int, t3 varchar(16))") + conn.execute("create table if not exists tb1 using stb1 tags(1, 't1')") + conn.execute("create table if not exists tb2 using stb1 tags(2, 't2')") + conn.execute("create table if not exists tb3 using stb1 tags(3, 't3')") + conn.execute("create topic if not exists {} as select ts, c1, c2, c3 from stb1".format(topic)) + conn.execute("insert into tb1 values (now+10s, 1, 1.0, 'tmq test')") + conn.execute("insert into tb2 values (now+100s, 2, 2.0, 'tmq test')") + conn.execute("insert into tb3 values (now+20s, 3, 3.0, 'tmq test')") + conn.execute("insert into tb3 values (now+30s, 4, 4.0, 'tmq test4')") + +def init_tmq_rest_env(db, topic): + host = socket.gethostname() + conn = taosrest.connect(url=f"http://{host}:6041") + + # conn.execute("create dnode test209") + # conn.execute("create dnode test216") + # conn.execute("create mnode on dnode 2") + # conn.execute("create mnode on dnode 3") + + conn.execute("drop topic if exists {}".format(topic)) + conn.execute("drop database if exists {}".format(db)) + conn.execute("create database if not exists {} replica 3 ".format(db)) + conn.select_db(db) + conn.execute( + "create stable if not exists stb1 (ts timestamp, c1 int, c2 float, c3 varchar(16)) tags(t1 int, t3 varchar(16))") + conn.execute("create table if not exists tb1 using stb1 tags(1, 't1')") + conn.execute("create table if not exists tb2 using stb1 tags(2, 't2')") + conn.execute("create table if not exists tb3 using stb1 tags(3, 't3')") + conn.execute("create topic if not exists {} as select ts, c1, c2, c3 from stb1".format(topic)) + conn.execute("insert into tb1 values (now+10s, 1, 1.0, 'tmq test')") + conn.execute("insert into tb2 values (now+100s, 2, 2.0, 'tmq test')") + conn.execute("insert into tb3 values (now+20s, 3, 3.0, 'tmq test')") + conn.execute("insert into tb3 values (now+30s, 4, 4.0, 'tmq test4')") + + + + +if __name__ == '__main__': + conn = taos.connect() + + init_tmq_env("tmq_test", "tmq_test_topic") # init env + # init_tmq_rest_env("tmq_test", "tmq_test_topic") + consumer = Consumer( + { + "group.id": "tg75", + "client.id": "124", + "td.connect.user": "root", + "td.connect.pass": "taosdata", + "enable.auto.commit": "true", + "experimental.snapshot.enable": "true", + } + ) + consumer.subscribe(["tmq_test_topic"]) + + while True: + res = consumer.poll(10) + if not res: + break + err = res.error() + if err is not None: + raise err + val = res.value() + + for block in val: + print(block.fetchall()) \ No newline at end of file From 53b3de03842193b2f9a9fb6dbf36c0ae801bcded Mon Sep 17 00:00:00 2001 From: chenhaoran Date: Tue, 7 Mar 2023 12:38:38 +0800 Subject: [PATCH 127/174] test: add stream and topic in compatibility case --- tests/system-test/0-others/compatibility.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/system-test/0-others/compatibility.py b/tests/system-test/0-others/compatibility.py index 8764a169fa..b9d0e1844b 100644 --- a/tests/system-test/0-others/compatibility.py +++ b/tests/system-test/0-others/compatibility.py @@ -16,7 +16,7 @@ from util.dnodes import TDDnode from util.cluster import * import subprocess -BASEVERSION = "3.0.2.5" +BASEVERSION = "3.0.1.8" class TDTestCase: def caseDescription(self): ''' From 0cd871010f7f6d38319e422c2b96249c6768043b Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Tue, 7 Mar 2023 13:34:17 +0800 Subject: [PATCH 128/174] fix:fix fill history bug --- include/libs/executor/executor.h | 1 + source/libs/executor/src/executor.c | 8 +++++++- source/libs/executor/src/scanoperator.c | 1 + source/libs/stream/src/streamExec.c | 11 +++++++++-- source/libs/stream/src/streamRecover.c | 2 +- 5 files changed, 19 insertions(+), 4 deletions(-) diff --git a/include/libs/executor/executor.h b/include/libs/executor/executor.h index 095d2f6d10..c3d2010351 100644 --- a/include/libs/executor/executor.h +++ b/include/libs/executor/executor.h @@ -219,6 +219,7 @@ int32_t qStreamRecoverFinish(qTaskInfo_t tinfo); int32_t qStreamRestoreParam(qTaskInfo_t tinfo); bool qStreamRecoverScanFinished(qTaskInfo_t tinfo); void qStreamCloseTsdbReader(void* task); +void resetTaskInfo(qTaskInfo_t tinfo); #ifdef __cplusplus } diff --git a/source/libs/executor/src/executor.c b/source/libs/executor/src/executor.c index 9fe0f4f8a7..04d54a95ae 100644 --- a/source/libs/executor/src/executor.c +++ b/source/libs/executor/src/executor.c @@ -104,6 +104,12 @@ static void clearStreamBlock(SOperatorInfo* pOperator) { } } +void resetTaskInfo(qTaskInfo_t tinfo) { + SExecTaskInfo* pTaskInfo = (SExecTaskInfo*)tinfo; + pTaskInfo->code = 0; + clearStreamBlock(pTaskInfo->pRoot); +} + static int32_t doSetStreamBlock(SOperatorInfo* pOperator, void* input, size_t numOfBlocks, int32_t type, char* id) { if (pOperator->operatorType != QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN) { if (pOperator->numOfDownstream == 0) { @@ -618,7 +624,7 @@ int32_t qExecTask(qTaskInfo_t tinfo, SSDataBlock** pRes, uint64_t* useconds) { pTaskInfo->cost.start = taosGetTimestampUs(); } - if (isTaskKilled(pTaskInfo) && pTaskInfo->code != TSDB_CODE_QRY_IN_EXEC) { + if (isTaskKilled(pTaskInfo)) { clearStreamBlock(pTaskInfo->pRoot); atomic_store_64(&pTaskInfo->owner, 0); qDebug("%s already killed, abort", GET_TASKID(pTaskInfo)); diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c index a7178af20d..2f3b757241 100644 --- a/source/libs/executor/src/scanoperator.c +++ b/source/libs/executor/src/scanoperator.c @@ -946,6 +946,7 @@ SOperatorInfo* createTableSeqScanOperatorInfo(void* pReadHandle, SExecTaskInfo* } FORCE_INLINE void doClearBufferedBlocks(SStreamScanInfo* pInfo) { + qDebug("clear buff blocks:%d", (int32_t)taosArrayGetSize(pInfo->pBlockLists)); taosArrayClear(pInfo->pBlockLists); pInfo->validBlockIndex = 0; } diff --git a/source/libs/stream/src/streamExec.c b/source/libs/stream/src/streamExec.c index 9226d6ebb8..cb9774b584 100644 --- a/source/libs/stream/src/streamExec.c +++ b/source/libs/stream/src/streamExec.c @@ -20,6 +20,11 @@ static int32_t streamTaskExecImpl(SStreamTask* pTask, const void* data, SArray* pRes) { int32_t code; void* exec = pTask->exec.executor; + while(atomic_load_8(&pTask->taskStatus) != TASK_STATUS__NORMAL) { + qError("stream task wait for the end of fill history"); + taosMsleep(2); + continue; + } // set input const SStreamQueueItem* pItem = (const SStreamQueueItem*)data; @@ -58,6 +63,9 @@ static int32_t streamTaskExecImpl(SStreamTask* pTask, const void* data, SArray* SSDataBlock* output = NULL; uint64_t ts = 0; if ((code = qExecTask(exec, &output, &ts)) < 0) { + if (code == TSDB_CODE_QRY_IN_EXEC) { + resetTaskInfo(exec); + } /*ASSERT(false);*/ qError("unexpected stream execution, stream %" PRId64 " task: %d, since %s", pTask->streamId, pTask->taskId, terrstr()); @@ -121,8 +129,7 @@ int32_t streamScanExec(SStreamTask* pTask, int32_t batchSz) { SSDataBlock* output = NULL; uint64_t ts = 0; if (qExecTask(exec, &output, &ts) < 0) { - taosArrayDestroy(pRes); - return -1; + continue; } if (output == NULL) { if (qStreamRecoverScanFinished(exec)) { diff --git a/source/libs/stream/src/streamRecover.c b/source/libs/stream/src/streamRecover.c index 061b211ddf..87058bf490 100644 --- a/source/libs/stream/src/streamRecover.c +++ b/source/libs/stream/src/streamRecover.c @@ -168,7 +168,7 @@ int32_t streamRestoreParam(SStreamTask* pTask) { return qStreamRestoreParam(exec); } int32_t streamSetStatusNormal(SStreamTask* pTask) { - pTask->taskStatus = TASK_STATUS__NORMAL; + atomic_store_8(&pTask->taskStatus, TASK_STATUS__NORMAL); return 0; } From 22e236f4e6b855579302f813806a93b6ccfcc4ba Mon Sep 17 00:00:00 2001 From: Benguang Zhao Date: Tue, 7 Mar 2023 15:15:46 +0800 Subject: [PATCH 129/174] fix: check pWal->cfg.retentionPeriod properly --- source/libs/wal/src/walWrite.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/libs/wal/src/walWrite.c b/source/libs/wal/src/walWrite.c index b74bbdd15f..00ad7a3d67 100644 --- a/source/libs/wal/src/walWrite.c +++ b/source/libs/wal/src/walWrite.c @@ -328,8 +328,8 @@ int32_t walEndSnapshot(SWal *pWal) { "), new tot size %" PRId64, pWal->cfg.vgId, iter->firstVer, iter->fileSize, iter->closeTs, newTotSize); if (((pWal->cfg.retentionSize == 0) || (pWal->cfg.retentionSize != -1 && newTotSize > pWal->cfg.retentionSize)) || - ((pWal->cfg.retentionPeriod == 0) || - (pWal->cfg.retentionPeriod != -1 && iter->closeTs + pWal->cfg.retentionPeriod > ts))) { + ((pWal->cfg.retentionPeriod == 0) || (pWal->cfg.retentionPeriod != -1 && iter->closeTs != -1 && + iter->closeTs + pWal->cfg.retentionPeriod < ts))) { // delete according to file size or close time wDebug("vgId:%d, check pass", pWal->cfg.vgId); deleteCnt++; From 62d4729eb84c94e778ca7df4c6b9fb9e1e734414 Mon Sep 17 00:00:00 2001 From: Benguang Zhao Date: Tue, 7 Mar 2023 15:19:47 +0800 Subject: [PATCH 130/174] enh: print term in logging msg of raftStoreWriteFile --- source/libs/sync/src/syncRaftStore.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/libs/sync/src/syncRaftStore.c b/source/libs/sync/src/syncRaftStore.c index 68e735cf0d..bd15567c87 100644 --- a/source/libs/sync/src/syncRaftStore.c +++ b/source/libs/sync/src/syncRaftStore.c @@ -139,7 +139,7 @@ int32_t raftStoreWriteFile(SSyncNode *pNode) { if (taosRenameFile(file, realfile) != 0) goto _OVER; code = 0; - sInfo("vgId:%d, succeed to write raft store file:%s, len:%d", pNode->vgId, realfile, len); + sInfo("vgId:%d, succeed to write raft store file:%s, term:%" PRId64, pNode->vgId, realfile, pStore->currentTerm); _OVER: if (pJson != NULL) tjsonDelete(pJson); From df0d200f59341fb7d6306999e8e20a4dbade1a4d Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Tue, 7 Mar 2023 15:24:04 +0800 Subject: [PATCH 131/174] feat: the compact command adds 'start with end with' clause --- include/common/tmsg.h | 3 +- include/common/ttokendef.h | 324 +- include/libs/nodes/cmdnodes.h | 2 + source/common/src/tmsg.c | 4 + source/libs/parser/inc/parAst.h | 2 +- source/libs/parser/inc/sql.y | 12 +- source/libs/parser/src/parAstCreater.c | 4 +- source/libs/parser/src/parAstParser.c | 9 +- source/libs/parser/src/parTranslater.c | 26 +- source/libs/parser/src/sql.c | 6086 +++++++++-------- source/libs/parser/test/mockCatalog.cpp | 4 +- .../libs/parser/test/mockCatalogService.cpp | 7 +- source/libs/parser/test/mockCatalogService.h | 3 +- source/libs/parser/test/parInitialCTest.cpp | 23 +- source/libs/parser/test/parTestUtil.cpp | 7 +- 15 files changed, 3303 insertions(+), 3213 deletions(-) diff --git a/include/common/tmsg.h b/include/common/tmsg.h index 9a2439f0cf..308246df64 100644 --- a/include/common/tmsg.h +++ b/include/common/tmsg.h @@ -1031,7 +1031,8 @@ int32_t tDeserializeSUserAuthBatchRsp(void* buf, int32_t bufLen, SUserAuthBatchR void tFreeSUserAuthBatchRsp(SUserAuthBatchRsp* pRsp); typedef struct { - char db[TSDB_DB_FNAME_LEN]; + char db[TSDB_DB_FNAME_LEN]; + STimeWindow timeRange; } SCompactDbReq; int32_t tSerializeSCompactDbReq(void* buf, int32_t bufLen, SCompactDbReq* pReq); diff --git a/include/common/ttokendef.h b/include/common/ttokendef.h index ada3fd20e8..a0593e7d4b 100644 --- a/include/common/ttokendef.h +++ b/include/common/ttokendef.h @@ -110,168 +110,168 @@ #define TK_TABLE_SUFFIX 92 #define TK_NK_COLON 93 #define TK_MAX_SPEED 94 -#define TK_TABLE 95 -#define TK_NK_LP 96 -#define TK_NK_RP 97 -#define TK_STABLE 98 -#define TK_ADD 99 -#define TK_COLUMN 100 -#define TK_MODIFY 101 -#define TK_RENAME 102 -#define TK_TAG 103 -#define TK_SET 104 -#define TK_NK_EQ 105 -#define TK_USING 106 -#define TK_TAGS 107 -#define TK_COMMENT 108 -#define TK_BOOL 109 -#define TK_TINYINT 110 -#define TK_SMALLINT 111 -#define TK_INT 112 -#define TK_INTEGER 113 -#define TK_BIGINT 114 -#define TK_FLOAT 115 -#define TK_DOUBLE 116 -#define TK_BINARY 117 -#define TK_TIMESTAMP 118 -#define TK_NCHAR 119 -#define TK_UNSIGNED 120 -#define TK_JSON 121 -#define TK_VARCHAR 122 -#define TK_MEDIUMBLOB 123 -#define TK_BLOB 124 -#define TK_VARBINARY 125 -#define TK_DECIMAL 126 -#define TK_MAX_DELAY 127 -#define TK_WATERMARK 128 -#define TK_ROLLUP 129 -#define TK_TTL 130 -#define TK_SMA 131 -#define TK_DELETE_MARK 132 -#define TK_FIRST 133 -#define TK_LAST 134 -#define TK_SHOW 135 -#define TK_PRIVILEGES 136 -#define TK_DATABASES 137 -#define TK_TABLES 138 -#define TK_STABLES 139 -#define TK_MNODES 140 -#define TK_QNODES 141 -#define TK_FUNCTIONS 142 -#define TK_INDEXES 143 -#define TK_ACCOUNTS 144 -#define TK_APPS 145 -#define TK_CONNECTIONS 146 -#define TK_LICENCES 147 -#define TK_GRANTS 148 -#define TK_QUERIES 149 -#define TK_SCORES 150 -#define TK_TOPICS 151 -#define TK_VARIABLES 152 -#define TK_CLUSTER 153 -#define TK_BNODES 154 -#define TK_SNODES 155 -#define TK_TRANSACTIONS 156 -#define TK_DISTRIBUTED 157 -#define TK_CONSUMERS 158 -#define TK_SUBSCRIPTIONS 159 -#define TK_VNODES 160 -#define TK_ALIVE 161 -#define TK_LIKE 162 -#define TK_TBNAME 163 -#define TK_QTAGS 164 -#define TK_AS 165 -#define TK_INDEX 166 -#define TK_FUNCTION 167 -#define TK_INTERVAL 168 -#define TK_COUNT 169 -#define TK_LAST_ROW 170 -#define TK_TOPIC 171 -#define TK_WITH 172 -#define TK_META 173 -#define TK_CONSUMER 174 -#define TK_GROUP 175 -#define TK_DESC 176 -#define TK_DESCRIBE 177 -#define TK_RESET 178 -#define TK_QUERY 179 -#define TK_CACHE 180 -#define TK_EXPLAIN 181 -#define TK_ANALYZE 182 -#define TK_VERBOSE 183 -#define TK_NK_BOOL 184 -#define TK_RATIO 185 -#define TK_NK_FLOAT 186 -#define TK_OUTPUTTYPE 187 -#define TK_AGGREGATE 188 -#define TK_BUFSIZE 189 -#define TK_STREAM 190 -#define TK_INTO 191 -#define TK_TRIGGER 192 -#define TK_AT_ONCE 193 -#define TK_WINDOW_CLOSE 194 -#define TK_IGNORE 195 -#define TK_EXPIRED 196 -#define TK_FILL_HISTORY 197 -#define TK_UPDATE 198 -#define TK_SUBTABLE 199 -#define TK_KILL 200 -#define TK_CONNECTION 201 -#define TK_TRANSACTION 202 -#define TK_BALANCE 203 -#define TK_VGROUP 204 -#define TK_MERGE 205 -#define TK_REDISTRIBUTE 206 -#define TK_SPLIT 207 -#define TK_DELETE 208 -#define TK_INSERT 209 -#define TK_NULL 210 -#define TK_NK_QUESTION 211 -#define TK_NK_ARROW 212 -#define TK_ROWTS 213 -#define TK_QSTART 214 -#define TK_QEND 215 -#define TK_QDURATION 216 -#define TK_WSTART 217 -#define TK_WEND 218 -#define TK_WDURATION 219 -#define TK_IROWTS 220 -#define TK_ISFILLED 221 -#define TK_CAST 222 -#define TK_NOW 223 -#define TK_TODAY 224 -#define TK_TIMEZONE 225 -#define TK_CLIENT_VERSION 226 -#define TK_SERVER_VERSION 227 -#define TK_SERVER_STATUS 228 -#define TK_CURRENT_USER 229 -#define TK_CASE 230 -#define TK_END 231 -#define TK_WHEN 232 -#define TK_THEN 233 -#define TK_ELSE 234 -#define TK_BETWEEN 235 -#define TK_IS 236 -#define TK_NK_LT 237 -#define TK_NK_GT 238 -#define TK_NK_LE 239 -#define TK_NK_GE 240 -#define TK_NK_NE 241 -#define TK_MATCH 242 -#define TK_NMATCH 243 -#define TK_CONTAINS 244 -#define TK_IN 245 -#define TK_JOIN 246 -#define TK_INNER 247 -#define TK_SELECT 248 -#define TK_DISTINCT 249 -#define TK_WHERE 250 -#define TK_PARTITION 251 -#define TK_BY 252 -#define TK_SESSION 253 -#define TK_STATE_WINDOW 254 -#define TK_EVENT_WINDOW 255 -#define TK_START 256 +#define TK_START 95 +#define TK_WITH 96 +#define TK_TIMESTAMP 97 +#define TK_END 98 +#define TK_TABLE 99 +#define TK_NK_LP 100 +#define TK_NK_RP 101 +#define TK_STABLE 102 +#define TK_ADD 103 +#define TK_COLUMN 104 +#define TK_MODIFY 105 +#define TK_RENAME 106 +#define TK_TAG 107 +#define TK_SET 108 +#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_MAX_DELAY 130 +#define TK_WATERMARK 131 +#define TK_ROLLUP 132 +#define TK_TTL 133 +#define TK_SMA 134 +#define TK_DELETE_MARK 135 +#define TK_FIRST 136 +#define TK_LAST 137 +#define TK_SHOW 138 +#define TK_PRIVILEGES 139 +#define TK_DATABASES 140 +#define TK_TABLES 141 +#define TK_STABLES 142 +#define TK_MNODES 143 +#define TK_QNODES 144 +#define TK_FUNCTIONS 145 +#define TK_INDEXES 146 +#define TK_ACCOUNTS 147 +#define TK_APPS 148 +#define TK_CONNECTIONS 149 +#define TK_LICENCES 150 +#define TK_GRANTS 151 +#define TK_QUERIES 152 +#define TK_SCORES 153 +#define TK_TOPICS 154 +#define TK_VARIABLES 155 +#define TK_CLUSTER 156 +#define TK_BNODES 157 +#define TK_SNODES 158 +#define TK_TRANSACTIONS 159 +#define TK_DISTRIBUTED 160 +#define TK_CONSUMERS 161 +#define TK_SUBSCRIPTIONS 162 +#define TK_VNODES 163 +#define TK_ALIVE 164 +#define TK_LIKE 165 +#define TK_TBNAME 166 +#define TK_QTAGS 167 +#define TK_AS 168 +#define TK_INDEX 169 +#define TK_FUNCTION 170 +#define TK_INTERVAL 171 +#define TK_COUNT 172 +#define TK_LAST_ROW 173 +#define TK_TOPIC 174 +#define TK_META 175 +#define TK_CONSUMER 176 +#define TK_GROUP 177 +#define TK_DESC 178 +#define TK_DESCRIBE 179 +#define TK_RESET 180 +#define TK_QUERY 181 +#define TK_CACHE 182 +#define TK_EXPLAIN 183 +#define TK_ANALYZE 184 +#define TK_VERBOSE 185 +#define TK_NK_BOOL 186 +#define TK_RATIO 187 +#define TK_NK_FLOAT 188 +#define TK_OUTPUTTYPE 189 +#define TK_AGGREGATE 190 +#define TK_BUFSIZE 191 +#define TK_STREAM 192 +#define TK_INTO 193 +#define TK_TRIGGER 194 +#define TK_AT_ONCE 195 +#define TK_WINDOW_CLOSE 196 +#define TK_IGNORE 197 +#define TK_EXPIRED 198 +#define TK_FILL_HISTORY 199 +#define TK_UPDATE 200 +#define TK_SUBTABLE 201 +#define TK_KILL 202 +#define TK_CONNECTION 203 +#define TK_TRANSACTION 204 +#define TK_BALANCE 205 +#define TK_VGROUP 206 +#define TK_MERGE 207 +#define TK_REDISTRIBUTE 208 +#define TK_SPLIT 209 +#define TK_DELETE 210 +#define TK_INSERT 211 +#define TK_NULL 212 +#define TK_NK_QUESTION 213 +#define TK_NK_ARROW 214 +#define TK_ROWTS 215 +#define TK_QSTART 216 +#define TK_QEND 217 +#define TK_QDURATION 218 +#define TK_WSTART 219 +#define TK_WEND 220 +#define TK_WDURATION 221 +#define TK_IROWTS 222 +#define TK_ISFILLED 223 +#define TK_CAST 224 +#define TK_NOW 225 +#define TK_TODAY 226 +#define TK_TIMEZONE 227 +#define TK_CLIENT_VERSION 228 +#define TK_SERVER_VERSION 229 +#define TK_SERVER_STATUS 230 +#define TK_CURRENT_USER 231 +#define TK_CASE 232 +#define TK_WHEN 233 +#define TK_THEN 234 +#define TK_ELSE 235 +#define TK_BETWEEN 236 +#define TK_IS 237 +#define TK_NK_LT 238 +#define TK_NK_GT 239 +#define TK_NK_LE 240 +#define TK_NK_GE 241 +#define TK_NK_NE 242 +#define TK_MATCH 243 +#define TK_NMATCH 244 +#define TK_CONTAINS 245 +#define TK_IN 246 +#define TK_JOIN 247 +#define TK_INNER 248 +#define TK_SELECT 249 +#define TK_DISTINCT 250 +#define TK_WHERE 251 +#define TK_PARTITION 252 +#define TK_BY 253 +#define TK_SESSION 254 +#define TK_STATE_WINDOW 255 +#define TK_EVENT_WINDOW 256 #define TK_SLIDING 257 #define TK_FILL 258 #define TK_VALUE 259 diff --git a/include/libs/nodes/cmdnodes.h b/include/libs/nodes/cmdnodes.h index 736ee7da05..bcbc5f4cf4 100644 --- a/include/libs/nodes/cmdnodes.h +++ b/include/libs/nodes/cmdnodes.h @@ -128,6 +128,8 @@ typedef struct STrimDatabaseStmt { typedef struct SCompactDatabaseStmt { ENodeType type; char dbName[TSDB_DB_NAME_LEN]; + SNode* pStart; + SNode* pEnd; } SCompactDatabaseStmt; typedef struct STableOptions { diff --git a/source/common/src/tmsg.c b/source/common/src/tmsg.c index 01a0ee7306..5018a517e1 100644 --- a/source/common/src/tmsg.c +++ b/source/common/src/tmsg.c @@ -2531,6 +2531,8 @@ int32_t tSerializeSCompactDbReq(void *buf, int32_t bufLen, SCompactDbReq *pReq) if (tStartEncode(&encoder) < 0) return -1; if (tEncodeCStr(&encoder, pReq->db) < 0) return -1; + if (tEncodeI64(&encoder, pReq->timeRange.skey) < 0) return -1; + if (tEncodeI64(&encoder, pReq->timeRange.ekey) < 0) return -1; tEndEncode(&encoder); int32_t tlen = encoder.pos; @@ -2544,6 +2546,8 @@ int32_t tDeserializeSCompactDbReq(void *buf, int32_t bufLen, SCompactDbReq *pReq if (tStartDecode(&decoder) < 0) return -1; if (tDecodeCStrTo(&decoder, pReq->db) < 0) return -1; + if (tDecodeI64(&decoder, &pReq->timeRange.skey) < 0) return -1; + if (tDecodeI64(&decoder, &pReq->timeRange.ekey) < 0) return -1; tEndDecode(&decoder); tDecoderClear(&decoder); diff --git a/source/libs/parser/inc/parAst.h b/source/libs/parser/inc/parAst.h index 4b9fa7aa42..695d9f3006 100644 --- a/source/libs/parser/inc/parAst.h +++ b/source/libs/parser/inc/parAst.h @@ -151,7 +151,7 @@ SNode* createDropDatabaseStmt(SAstCreateContext* pCxt, bool ignoreNotExists, STo SNode* createAlterDatabaseStmt(SAstCreateContext* pCxt, SToken* pDbName, SNode* pOptions); SNode* createFlushDatabaseStmt(SAstCreateContext* pCxt, SToken* pDbName); SNode* createTrimDatabaseStmt(SAstCreateContext* pCxt, SToken* pDbName, int32_t maxSpeed); -SNode* createCompactStmt(SAstCreateContext* pCxt, SToken* pDbName); +SNode* createCompactStmt(SAstCreateContext* pCxt, SToken* pDbName, SNode* pStart, SNode* pEnd); SNode* createDefaultTableOptions(SAstCreateContext* pCxt); SNode* createAlterTableOptions(SAstCreateContext* pCxt); SNode* setTableOption(SAstCreateContext* pCxt, SNode* pOptions, ETableOptionType type, void* pVal); diff --git a/source/libs/parser/inc/sql.y b/source/libs/parser/inc/sql.y index 317bfccb78..db418169a5 100644 --- a/source/libs/parser/inc/sql.y +++ b/source/libs/parser/inc/sql.y @@ -167,7 +167,7 @@ cmd ::= USE db_name(A). cmd ::= ALTER DATABASE db_name(A) alter_db_options(B). { pCxt->pRootNode = createAlterDatabaseStmt(pCxt, &A, B); } cmd ::= FLUSH DATABASE db_name(A). { pCxt->pRootNode = createFlushDatabaseStmt(pCxt, &A); } cmd ::= TRIM DATABASE db_name(A) speed_opt(B). { pCxt->pRootNode = createTrimDatabaseStmt(pCxt, &A, B); } -cmd ::= COMPACT DATABASE db_name(A). { pCxt->pRootNode = createCompactStmt(pCxt, &A); } +cmd ::= COMPACT DATABASE db_name(A) start_opt(B) end_opt(C). { pCxt->pRootNode = createCompactStmt(pCxt, &A, B, C); } %type not_exists_opt { bool } %destructor not_exists_opt { } @@ -259,6 +259,16 @@ retention(A) ::= NK_VARIABLE(B) NK_COLON NK_VARIABLE(C). speed_opt(A) ::= . { A = 0; } speed_opt(A) ::= MAX_SPEED NK_INTEGER(B). { A = taosStr2Int32(B.z, NULL, 10); } +start_opt(A) ::= . { A = NULL; } +start_opt(A) ::= START WITH NK_INTEGER(B). { A = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &B); } +start_opt(A) ::= START WITH NK_STRING(B). { A = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &B); } +start_opt(A) ::= START WITH TIMESTAMP NK_STRING(B). { A = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &B); } + +end_opt(A) ::= . { A = NULL; } +end_opt(A) ::= END WITH NK_INTEGER(B). { A = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &B); } +end_opt(A) ::= END WITH NK_STRING(B). { A = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &B); } +end_opt(A) ::= END WITH TIMESTAMP NK_STRING(B). { A = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &B); } + /************************************************ create/drop table/stable ********************************************/ cmd ::= CREATE TABLE not_exists_opt(A) full_table_name(B) NK_LP column_def_list(C) NK_RP tags_def_opt(D) table_options(E). { pCxt->pRootNode = createCreateTableStmt(pCxt, A, B, C, D, E); } diff --git a/source/libs/parser/src/parAstCreater.c b/source/libs/parser/src/parAstCreater.c index 469132613d..e1855256b2 100644 --- a/source/libs/parser/src/parAstCreater.c +++ b/source/libs/parser/src/parAstCreater.c @@ -1105,7 +1105,7 @@ SNode* createTrimDatabaseStmt(SAstCreateContext* pCxt, SToken* pDbName, int32_t return (SNode*)pStmt; } -SNode* createCompactStmt(SAstCreateContext* pCxt, SToken* pDbName) { +SNode* createCompactStmt(SAstCreateContext* pCxt, SToken* pDbName, SNode* pStart, SNode* pEnd) { CHECK_PARSER_STATUS(pCxt); if (!checkDbName(pCxt, pDbName, false)) { return NULL; @@ -1113,6 +1113,8 @@ SNode* createCompactStmt(SAstCreateContext* pCxt, SToken* pDbName) { SCompactDatabaseStmt* pStmt = (SCompactDatabaseStmt*)nodesMakeNode(QUERY_NODE_COMPACT_DATABASE_STMT); CHECK_OUT_OF_MEM(pStmt); COPY_STRING_FORM_ID_TOKEN(pStmt->dbName, pDbName); + pStmt->pStart = pStart; + pStmt->pEnd = pEnd; return (SNode*)pStmt; } diff --git a/source/libs/parser/src/parAstParser.c b/source/libs/parser/src/parAstParser.c index 126027c78f..cd4b455e02 100644 --- a/source/libs/parser/src/parAstParser.c +++ b/source/libs/parser/src/parAstParser.c @@ -166,7 +166,8 @@ static int32_t collectMetaKeyFromRealTableImpl(SCollectMetaKeyCxt* pCxt, const c code = reserveDnodeRequiredInCache(pCxt->pMetaCache); } if (TSDB_CODE_SUCCESS == code && - (0 == strcmp(pTable, TSDB_INS_TABLE_TAGS) || 0 == strcmp(pTable, TSDB_INS_TABLE_TABLES) || 0 == strcmp(pTable, TSDB_INS_TABLE_COLS)) && + (0 == strcmp(pTable, TSDB_INS_TABLE_TAGS) || 0 == strcmp(pTable, TSDB_INS_TABLE_TABLES) || + 0 == strcmp(pTable, TSDB_INS_TABLE_COLS)) && QUERY_NODE_SELECT_STMT == nodeType(pCxt->pStmt)) { code = collectMetaKeyFromInsTags(pCxt); } @@ -605,6 +606,10 @@ static int32_t collectMetaKeyFromShowSubscriptions(SCollectMetaKeyCxt* pCxt, SSh pCxt->pMetaCache); } +static int32_t collectMetaKeyFromCompactDatabase(SCollectMetaKeyCxt* pCxt, SCompactDatabaseStmt* pStmt) { + return reserveDbCfgInCache(pCxt->pParseCxt->acctId, pStmt->dbName, pCxt->pMetaCache); +} + static int32_t collectMetaKeyFromQuery(SCollectMetaKeyCxt* pCxt, SNode* pStmt) { pCxt->pStmt = pStmt; switch (nodeType(pStmt)) { @@ -636,6 +641,8 @@ static int32_t collectMetaKeyFromQuery(SCollectMetaKeyCxt* pCxt, SNode* pStmt) { return collectMetaKeyFromExplain(pCxt, (SExplainStmt*)pStmt); case QUERY_NODE_DESCRIBE_STMT: return collectMetaKeyFromDescribe(pCxt, (SDescribeStmt*)pStmt); + case QUERY_NODE_COMPACT_DATABASE_STMT: + return collectMetaKeyFromCompactDatabase(pCxt, (SCompactDatabaseStmt*)pStmt); case QUERY_NODE_CREATE_STREAM_STMT: return collectMetaKeyFromCreateStream(pCxt, (SCreateStreamStmt*)pStmt); case QUERY_NODE_SHOW_DNODES_STMT: diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index fd2d5d53f4..ff6ef2e423 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -5626,12 +5626,36 @@ static int32_t translateDescribe(STranslateContext* pCxt, SDescribeStmt* pStmt) return refreshGetTableMeta(pCxt, pStmt->dbName, pStmt->tableName, &pStmt->pMeta); } +static int32_t translateCompactRange(STranslateContext* pCxt, SCompactDatabaseStmt* pStmt, SCompactDbReq* pReq) { + SDbCfgInfo dbCfg = {0}; + int32_t code = getDBCfg(pCxt, pStmt->dbName, &dbCfg); + if (TSDB_CODE_SUCCESS == code && NULL != pStmt->pStart) { + ((SValueNode*)pStmt->pStart)->node.resType.precision = dbCfg.precision; + ((SValueNode*)pStmt->pStart)->node.resType.type = TSDB_DATA_TYPE_TIMESTAMP; + code = doTranslateValue(pCxt, (SValueNode*)pStmt->pStart); + } + if (TSDB_CODE_SUCCESS == code && NULL != pStmt->pEnd) { + ((SValueNode*)pStmt->pEnd)->node.resType.precision = dbCfg.precision; + ((SValueNode*)pStmt->pEnd)->node.resType.type = TSDB_DATA_TYPE_TIMESTAMP; + code = doTranslateValue(pCxt, (SValueNode*)pStmt->pEnd); + } + if (TSDB_CODE_SUCCESS == code) { + pReq->timeRange.skey = NULL != pStmt->pStart ? ((SValueNode*)pStmt->pStart)->datum.i : INT64_MIN; + pReq->timeRange.ekey = NULL != pStmt->pEnd ? ((SValueNode*)pStmt->pEnd)->datum.i : INT64_MAX; + } + return code; +} + static int32_t translateCompact(STranslateContext* pCxt, SCompactDatabaseStmt* pStmt) { SCompactDbReq compactReq = {0}; SName name; tNameSetDbName(&name, pCxt->pParseCxt->acctId, pStmt->dbName, strlen(pStmt->dbName)); tNameGetFullDbName(&name, compactReq.db); - return buildCmdMsg(pCxt, TDMT_MND_COMPACT_DB, (FSerializeFunc)tSerializeSCompactDbReq, &compactReq); + int32_t code = translateCompactRange(pCxt, pStmt, &compactReq); + if (TSDB_CODE_SUCCESS == code) { + code = buildCmdMsg(pCxt, TDMT_MND_COMPACT_DB, (FSerializeFunc)tSerializeSCompactDbReq, &compactReq); + } + return code; } static int32_t translateKillConnection(STranslateContext* pCxt, SKillStmt* pStmt) { diff --git a/source/libs/parser/src/sql.c b/source/libs/parser/src/sql.c index 04f838b92d..6df57cd32b 100644 --- a/source/libs/parser/src/sql.c +++ b/source/libs/parser/src/sql.c @@ -104,26 +104,26 @@ #endif /************* Begin control #defines *****************************************/ #define YYCODETYPE unsigned short int -#define YYNOCODE 469 +#define YYNOCODE 471 #define YYACTIONTYPE unsigned short int #define ParseTOKENTYPE SToken typedef union { int yyinit; ParseTOKENTYPE yy0; - EOperatorType yy2; - SNode* yy42; - bool yy103; - EOrder yy106; - SNodeList* yy110; - SToken yy225; - EFillMode yy410; - SDataType yy448; - SAlterOption yy459; - int32_t yy508; - ENullOrder yy599; - EJoinType yy638; - int64_t yy641; - int8_t yy705; + SNode* yy140; + EFillMode yy174; + int32_t yy214; + SNodeList* yy220; + int64_t yy303; + bool yy587; + SDataType yy682; + ENullOrder yy697; + EOperatorType yy794; + SAlterOption yy809; + EJoinType yy852; + int8_t yy857; + EOrder yy866; + SToken yy881; } YYMINORTYPE; #ifndef YYSTACKDEPTH #define YYSTACKDEPTH 100 @@ -139,17 +139,17 @@ typedef union { #define ParseCTX_FETCH #define ParseCTX_STORE #define YYFALLBACK 1 -#define YYNSTATE 743 -#define YYNRULE 563 +#define YYNSTATE 751 +#define YYNRULE 571 #define YYNTOKEN 328 -#define YY_MAX_SHIFT 742 -#define YY_MIN_SHIFTREDUCE 1102 -#define YY_MAX_SHIFTREDUCE 1664 -#define YY_ERROR_ACTION 1665 -#define YY_ACCEPT_ACTION 1666 -#define YY_NO_ACTION 1667 -#define YY_MIN_REDUCE 1668 -#define YY_MAX_REDUCE 2230 +#define YY_MAX_SHIFT 750 +#define YY_MIN_SHIFTREDUCE 1116 +#define YY_MAX_SHIFTREDUCE 1686 +#define YY_ERROR_ACTION 1687 +#define YY_ACCEPT_ACTION 1688 +#define YY_NO_ACTION 1689 +#define YY_MIN_REDUCE 1690 +#define YY_MAX_REDUCE 2260 /************* End control #defines *******************************************/ #define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0]))) @@ -216,753 +216,739 @@ typedef union { ** yy_default[] Default action for each state. ** *********** Begin parsing tables **********************************************/ -#define YY_ACTTAB_COUNT (2749) +#define YY_ACTTAB_COUNT (2669) static const YYACTIONTYPE yy_action[] = { - /* 0 */ 1941, 2206, 1798, 607, 482, 2201, 483, 1704, 491, 1811, - /* 10 */ 483, 1704, 45, 43, 1592, 1939, 619, 31, 176, 178, - /* 20 */ 380, 2205, 1441, 38, 37, 2202, 2204, 44, 42, 41, - /* 30 */ 40, 39, 1862, 1522, 139, 1439, 1466, 2042, 1875, 347, - /* 40 */ 1924, 2028, 38, 37, 613, 358, 44, 42, 41, 40, - /* 50 */ 39, 425, 2024, 2206, 1873, 38, 37, 2201, 1517, 44, - /* 60 */ 42, 41, 40, 39, 18, 686, 385, 1469, 2060, 1868, - /* 70 */ 1870, 1447, 1666, 2205, 167, 607, 646, 2202, 2203, 1776, - /* 80 */ 1154, 2010, 1153, 648, 45, 43, 2020, 2026, 361, 570, - /* 90 */ 1135, 330, 380, 2201, 1441, 220, 14, 642, 340, 181, - /* 100 */ 2138, 2139, 550, 137, 2143, 1522, 139, 1439, 2207, 182, - /* 110 */ 602, 1155, 2041, 2202, 596, 548, 2077, 546, 739, 324, - /* 120 */ 2043, 652, 2045, 2046, 647, 645, 642, 633, 2095, 1137, - /* 130 */ 1517, 1140, 1141, 1524, 1525, 631, 18, 481, 393, 1551, - /* 140 */ 486, 1710, 392, 1447, 1691, 1262, 674, 673, 672, 1266, - /* 150 */ 671, 1268, 1269, 670, 1271, 667, 176, 1277, 664, 1279, - /* 160 */ 1280, 661, 658, 1497, 1507, 1941, 607, 617, 14, 1523, - /* 170 */ 1526, 267, 2138, 606, 383, 133, 605, 371, 1925, 2201, - /* 180 */ 1938, 619, 161, 570, 1442, 618, 1440, 2201, 2010, 359, - /* 190 */ 739, 1824, 631, 270, 594, 182, 1552, 139, 1873, 2202, - /* 200 */ 596, 500, 2207, 182, 631, 1524, 1525, 2202, 596, 590, - /* 210 */ 1445, 1446, 247, 1496, 1499, 1500, 1501, 1502, 1503, 1504, - /* 220 */ 1505, 1506, 644, 640, 1515, 1516, 1518, 1519, 1520, 1521, - /* 230 */ 2, 61, 498, 92, 1934, 1497, 1507, 585, 106, 686, - /* 240 */ 122, 1523, 1526, 121, 120, 119, 118, 117, 116, 115, - /* 250 */ 114, 113, 140, 1596, 352, 166, 1442, 1680, 1440, 1466, - /* 260 */ 1814, 609, 180, 2138, 2139, 1465, 137, 2143, 48, 34, - /* 270 */ 378, 1546, 1547, 1548, 1549, 1550, 1554, 1555, 1556, 1557, - /* 280 */ 48, 61, 1445, 1446, 1222, 1496, 1499, 1500, 1501, 1502, - /* 290 */ 1503, 1504, 1505, 1506, 644, 640, 1515, 1516, 1518, 1519, - /* 300 */ 1520, 1521, 2, 2028, 11, 45, 43, 44, 42, 41, - /* 310 */ 40, 39, 1466, 380, 2024, 1441, 353, 742, 351, 350, - /* 320 */ 1224, 523, 591, 586, 579, 525, 1522, 1466, 1439, 490, - /* 330 */ 2042, 295, 486, 1710, 607, 35, 288, 38, 37, 603, - /* 340 */ 412, 44, 42, 41, 40, 39, 175, 524, 2020, 2026, - /* 350 */ 362, 1517, 732, 728, 724, 720, 293, 18, 86, 642, - /* 360 */ 488, 2060, 414, 410, 1447, 139, 484, 559, 417, 649, - /* 370 */ 416, 2145, 349, 1154, 2010, 1153, 648, 45, 43, 1527, - /* 380 */ 1467, 1817, 2206, 185, 11, 380, 9, 1441, 61, 14, - /* 390 */ 279, 280, 65, 107, 415, 278, 286, 2142, 1522, 1468, - /* 400 */ 1439, 634, 1498, 2102, 1155, 2041, 1737, 632, 1690, 2077, - /* 410 */ 632, 739, 168, 2043, 652, 2045, 2046, 647, 1669, 642, - /* 420 */ 185, 132, 678, 1517, 187, 1866, 1524, 1525, 521, 628, - /* 430 */ 183, 2138, 2139, 185, 137, 2143, 1447, 632, 1822, 122, - /* 440 */ 11, 1822, 121, 120, 119, 118, 117, 116, 115, 114, - /* 450 */ 113, 132, 2010, 571, 2167, 194, 1497, 1507, 526, 1875, - /* 460 */ 100, 46, 1523, 1526, 273, 636, 368, 2102, 1822, 272, - /* 470 */ 1360, 1361, 536, 535, 534, 1873, 1654, 1442, 2031, 1440, - /* 480 */ 136, 530, 1815, 739, 61, 529, 1404, 463, 241, 1905, - /* 490 */ 528, 533, 83, 1305, 1306, 82, 527, 237, 1524, 1525, - /* 500 */ 1869, 1870, 1467, 1445, 1446, 1661, 1496, 1499, 1500, 1501, - /* 510 */ 1502, 1503, 1504, 1505, 1506, 644, 640, 1515, 1516, 1518, - /* 520 */ 1519, 1520, 1521, 2, 536, 535, 534, 2033, 1497, 1507, - /* 530 */ 1668, 1875, 136, 530, 1523, 1526, 632, 529, 345, 632, - /* 540 */ 185, 1447, 528, 533, 269, 198, 197, 1873, 527, 1442, - /* 550 */ 54, 1440, 618, 423, 131, 130, 129, 128, 127, 126, - /* 560 */ 125, 124, 123, 1415, 1416, 419, 677, 1822, 462, 418, - /* 570 */ 1822, 41, 40, 39, 2042, 1445, 1446, 618, 1496, 1499, - /* 580 */ 1500, 1501, 1502, 1503, 1504, 1505, 1506, 644, 640, 1515, - /* 590 */ 1516, 1518, 1519, 1520, 1521, 2, 45, 43, 1468, 616, - /* 600 */ 1920, 1934, 86, 1660, 380, 2060, 1441, 632, 595, 632, - /* 610 */ 570, 190, 2201, 649, 2201, 1377, 1378, 1522, 2010, 1439, - /* 620 */ 648, 424, 221, 433, 627, 1818, 1934, 594, 182, 2207, - /* 630 */ 182, 61, 2202, 596, 2202, 596, 185, 171, 1822, 1689, - /* 640 */ 1822, 443, 1517, 517, 513, 509, 505, 218, 632, 2041, - /* 650 */ 442, 1376, 1379, 2077, 1620, 1447, 110, 2043, 652, 2045, - /* 660 */ 2046, 647, 448, 642, 49, 372, 1532, 1688, 45, 43, - /* 670 */ 2130, 2205, 1466, 164, 2129, 2126, 380, 698, 1441, 1822, - /* 680 */ 46, 541, 1824, 2010, 87, 1687, 2145, 216, 1807, 1522, - /* 690 */ 1686, 1439, 141, 38, 37, 2101, 551, 44, 42, 41, - /* 700 */ 40, 39, 739, 582, 581, 1618, 1619, 1621, 1622, 1623, - /* 710 */ 234, 2010, 2141, 1685, 1517, 38, 37, 1524, 1525, 44, - /* 720 */ 42, 41, 40, 39, 236, 544, 33, 1447, 235, 2010, - /* 730 */ 538, 1799, 38, 37, 2010, 233, 44, 42, 41, 40, - /* 740 */ 39, 1684, 595, 269, 1553, 2145, 2201, 1497, 1507, 1875, - /* 750 */ 632, 27, 14, 1523, 1526, 215, 209, 2010, 13, 12, - /* 760 */ 214, 594, 182, 496, 449, 1874, 2202, 596, 1442, 383, - /* 770 */ 1440, 2140, 69, 1589, 739, 68, 2060, 164, 1683, 207, - /* 780 */ 1809, 1822, 1631, 185, 589, 2010, 1824, 89, 335, 1524, - /* 790 */ 1525, 357, 1978, 552, 1445, 1446, 1469, 1496, 1499, 1500, - /* 800 */ 1501, 1502, 1503, 1504, 1505, 1506, 644, 640, 1515, 1516, - /* 810 */ 1518, 1519, 1520, 1521, 2, 1498, 185, 32, 1805, 1497, - /* 820 */ 1507, 333, 2010, 1464, 684, 1523, 1526, 1558, 164, 588, - /* 830 */ 456, 710, 708, 470, 1875, 152, 469, 1825, 238, 684, - /* 840 */ 1442, 373, 1440, 154, 153, 681, 680, 679, 151, 1682, - /* 850 */ 1873, 439, 1679, 471, 1565, 676, 441, 1920, 154, 153, - /* 860 */ 681, 680, 679, 151, 532, 531, 1445, 1446, 192, 1496, - /* 870 */ 1499, 1500, 1501, 1502, 1503, 1504, 1505, 1506, 644, 640, - /* 880 */ 1515, 1516, 1518, 1519, 1520, 1521, 2, 699, 53, 1792, - /* 890 */ 632, 682, 165, 2010, 1866, 1678, 2010, 308, 348, 1734, - /* 900 */ 632, 38, 37, 1797, 499, 44, 42, 41, 40, 39, - /* 910 */ 429, 306, 72, 242, 1819, 71, 1677, 1920, 643, 38, - /* 920 */ 37, 1822, 1875, 44, 42, 41, 40, 39, 196, 384, - /* 930 */ 51, 1822, 3, 203, 478, 476, 473, 598, 1873, 2010, - /* 940 */ 467, 191, 525, 461, 460, 459, 458, 455, 454, 453, - /* 950 */ 452, 451, 447, 446, 445, 444, 332, 436, 435, 434, - /* 960 */ 2010, 431, 430, 346, 524, 716, 715, 714, 713, 390, - /* 970 */ 61, 712, 711, 143, 706, 705, 704, 703, 702, 701, - /* 980 */ 700, 156, 696, 695, 694, 389, 388, 691, 690, 689, - /* 990 */ 688, 687, 632, 632, 1676, 38, 37, 565, 2003, 44, - /* 1000 */ 42, 41, 40, 39, 1441, 632, 239, 566, 1608, 108, - /* 1010 */ 2042, 684, 1996, 632, 632, 632, 1469, 1439, 1588, 629, - /* 1020 */ 8, 1675, 1674, 1822, 1822, 1673, 1672, 630, 611, 615, - /* 1030 */ 154, 153, 681, 680, 679, 151, 1822, 683, 2010, 1466, - /* 1040 */ 1866, 2060, 1671, 570, 1822, 1822, 1822, 2201, 152, 610, - /* 1050 */ 80, 79, 422, 1447, 2010, 189, 648, 632, 163, 2042, - /* 1060 */ 400, 302, 2207, 182, 1852, 2010, 2010, 2202, 596, 2010, - /* 1070 */ 2010, 283, 599, 2028, 331, 1140, 1141, 408, 1450, 406, - /* 1080 */ 402, 398, 395, 415, 2024, 2041, 2010, 1681, 1822, 2077, - /* 1090 */ 2060, 1813, 109, 2043, 652, 2045, 2046, 647, 649, 642, - /* 1100 */ 739, 1410, 2024, 2010, 179, 648, 2130, 1777, 386, 632, - /* 1110 */ 374, 2126, 2150, 1585, 426, 639, 164, 2029, 2020, 2026, - /* 1120 */ 375, 632, 185, 387, 184, 1824, 2042, 427, 2024, 642, - /* 1130 */ 2004, 145, 2156, 134, 2041, 289, 2020, 2026, 2077, 1800, - /* 1140 */ 1822, 109, 2043, 652, 2045, 2046, 647, 642, 642, 52, - /* 1150 */ 152, 142, 1822, 149, 2101, 2130, 569, 2060, 2042, 374, - /* 1160 */ 2126, 246, 2020, 2026, 73, 610, 1442, 1711, 1440, 1724, - /* 1170 */ 2010, 226, 648, 642, 224, 570, 1717, 228, 230, 2201, - /* 1180 */ 227, 229, 1498, 147, 232, 245, 554, 231, 553, 2060, - /* 1190 */ 2170, 537, 1445, 1446, 2207, 182, 1715, 649, 539, 2202, - /* 1200 */ 596, 2041, 2010, 1413, 648, 2077, 1449, 2042, 109, 2043, - /* 1210 */ 652, 2045, 2046, 647, 81, 642, 734, 63, 542, 63, - /* 1220 */ 179, 251, 2130, 1663, 1664, 90, 374, 2126, 1585, 1453, - /* 1230 */ 152, 47, 276, 2041, 70, 13, 12, 2077, 2060, 105, - /* 1240 */ 109, 2043, 652, 2045, 2046, 647, 649, 642, 2157, 102, - /* 1250 */ 264, 2010, 2221, 648, 2130, 583, 150, 557, 374, 2126, - /* 1260 */ 152, 1543, 63, 47, 47, 219, 2042, 258, 2061, 2164, - /* 1270 */ 1617, 656, 1616, 692, 253, 150, 152, 135, 1184, 150, - /* 1280 */ 391, 1929, 2041, 614, 1374, 281, 2077, 624, 1705, 109, - /* 1290 */ 2043, 652, 2045, 2046, 647, 1203, 642, 2060, 693, 600, - /* 1300 */ 2042, 2221, 570, 2130, 1863, 649, 2201, 374, 2126, 285, - /* 1310 */ 2010, 2160, 648, 1255, 1185, 1559, 1508, 301, 2177, 608, - /* 1320 */ 1201, 2207, 182, 263, 1283, 266, 2202, 596, 1287, 1294, - /* 1330 */ 1292, 2060, 155, 1, 399, 4, 394, 296, 344, 649, - /* 1340 */ 1397, 2041, 195, 428, 2010, 2077, 648, 1469, 109, 2043, - /* 1350 */ 652, 2045, 2046, 647, 432, 642, 1930, 1452, 437, 465, - /* 1360 */ 2221, 1464, 2130, 450, 1922, 457, 374, 2126, 464, 466, - /* 1370 */ 472, 474, 200, 2042, 475, 2041, 477, 577, 479, 2077, - /* 1380 */ 1470, 480, 109, 2043, 652, 2045, 2046, 647, 489, 642, - /* 1390 */ 1472, 206, 377, 376, 2221, 492, 2130, 1467, 493, 208, - /* 1400 */ 374, 2126, 1455, 1471, 2060, 494, 1473, 211, 495, 497, - /* 1410 */ 1157, 2195, 649, 1522, 518, 1448, 519, 2010, 213, 648, - /* 1420 */ 84, 85, 2042, 522, 217, 501, 520, 1987, 1812, 223, - /* 1430 */ 1808, 334, 225, 112, 1984, 1983, 556, 558, 1517, 88, - /* 1440 */ 240, 148, 157, 158, 1810, 1806, 297, 560, 2041, 159, - /* 1450 */ 160, 1447, 2077, 2060, 243, 109, 2043, 652, 2045, 2046, - /* 1460 */ 647, 649, 642, 561, 567, 584, 2010, 2221, 648, 2130, - /* 1470 */ 622, 2176, 564, 374, 2126, 2175, 574, 580, 593, 363, - /* 1480 */ 587, 2161, 575, 7, 2149, 2171, 2042, 2152, 573, 249, - /* 1490 */ 172, 257, 259, 252, 260, 572, 261, 2041, 638, 364, - /* 1500 */ 604, 2077, 2224, 1585, 109, 2043, 652, 2045, 2046, 647, - /* 1510 */ 601, 642, 138, 1468, 265, 262, 2105, 2060, 2130, 612, - /* 1520 */ 2200, 2146, 374, 2126, 367, 649, 271, 1474, 95, 1935, - /* 1530 */ 2010, 620, 648, 625, 298, 621, 1949, 1948, 1947, 299, - /* 1540 */ 370, 626, 97, 99, 1823, 60, 2111, 300, 101, 303, - /* 1550 */ 1793, 292, 735, 1867, 2042, 327, 736, 654, 738, 336, - /* 1560 */ 312, 2041, 326, 50, 1456, 2077, 1451, 316, 109, 2043, - /* 1570 */ 652, 2045, 2046, 647, 305, 642, 307, 2002, 2001, 2000, - /* 1580 */ 2103, 77, 2130, 337, 2042, 2060, 374, 2126, 1997, 396, - /* 1590 */ 1459, 1461, 397, 649, 1432, 1433, 188, 401, 2010, 1995, - /* 1600 */ 648, 405, 403, 640, 1515, 1516, 1518, 1519, 1520, 1521, - /* 1610 */ 404, 1994, 407, 1993, 2042, 2060, 409, 1992, 411, 1991, - /* 1620 */ 413, 78, 1400, 649, 1399, 1961, 1960, 1959, 2010, 2041, - /* 1630 */ 648, 420, 421, 2077, 1958, 1957, 109, 2043, 652, 2045, - /* 1640 */ 2046, 647, 1351, 642, 2042, 2060, 1913, 1912, 635, 1910, - /* 1650 */ 2130, 144, 1909, 649, 374, 2126, 1908, 1911, 2010, 2041, - /* 1660 */ 648, 1907, 1906, 2077, 193, 438, 110, 2043, 652, 2045, - /* 1670 */ 2046, 647, 1904, 642, 1903, 2060, 1902, 1901, 2042, 440, - /* 1680 */ 2130, 1915, 1900, 649, 637, 2126, 1899, 1898, 2010, 650, - /* 1690 */ 648, 1897, 1896, 2077, 1895, 1894, 110, 2043, 652, 2045, - /* 1700 */ 2046, 647, 1893, 642, 1892, 2042, 1891, 1890, 1889, 2060, - /* 1710 */ 2130, 1888, 1887, 1886, 339, 2126, 1885, 649, 1884, 2041, - /* 1720 */ 146, 1883, 2010, 2077, 648, 1914, 169, 2043, 652, 2045, - /* 1730 */ 2046, 647, 1882, 642, 1881, 1880, 2060, 1353, 1879, 1878, - /* 1740 */ 468, 1877, 1876, 1740, 649, 1230, 199, 1739, 201, 2010, - /* 1750 */ 1738, 648, 2030, 2041, 2042, 202, 1736, 2077, 1700, 204, - /* 1760 */ 168, 2043, 652, 2045, 2046, 647, 75, 642, 177, 1143, - /* 1770 */ 485, 1142, 1699, 487, 1974, 1968, 205, 1956, 597, 2222, - /* 1780 */ 2041, 212, 1955, 76, 2077, 2060, 1933, 110, 2043, 652, - /* 1790 */ 2045, 2046, 647, 649, 642, 1801, 1177, 1735, 2010, 210, - /* 1800 */ 648, 2130, 2168, 1733, 502, 504, 2127, 503, 1731, 507, - /* 1810 */ 508, 506, 1729, 510, 1727, 511, 2042, 1714, 514, 512, - /* 1820 */ 516, 515, 1713, 1696, 1803, 62, 1299, 1298, 1802, 2041, - /* 1830 */ 1725, 222, 707, 2077, 1221, 1220, 318, 2043, 652, 2045, - /* 1840 */ 2046, 647, 1219, 642, 1218, 1215, 709, 2060, 2042, 1213, - /* 1850 */ 1214, 1212, 1718, 354, 355, 649, 540, 1716, 356, 1695, - /* 1860 */ 2010, 543, 648, 1694, 545, 1693, 549, 111, 547, 1420, - /* 1870 */ 1422, 1973, 1419, 1406, 55, 1967, 562, 1954, 1952, 2060, - /* 1880 */ 592, 1424, 2206, 26, 369, 66, 162, 649, 16, 244, - /* 1890 */ 19, 2041, 2010, 1633, 648, 2077, 576, 2042, 169, 2043, - /* 1900 */ 652, 2045, 2046, 647, 578, 642, 568, 28, 58, 248, - /* 1910 */ 563, 360, 5, 59, 2042, 250, 1615, 170, 255, 256, - /* 1920 */ 6, 254, 20, 2041, 30, 64, 1648, 2077, 2060, 2031, - /* 1930 */ 325, 2043, 652, 2045, 2046, 647, 646, 642, 29, 21, - /* 1940 */ 1607, 2010, 1653, 648, 91, 2060, 2042, 1654, 17, 1647, - /* 1950 */ 379, 2223, 365, 649, 1652, 1651, 366, 1582, 2010, 1581, - /* 1960 */ 648, 1953, 57, 268, 1951, 56, 1950, 1932, 94, 93, - /* 1970 */ 173, 2042, 2041, 274, 1931, 96, 2077, 2060, 287, 324, - /* 1980 */ 2043, 652, 2045, 2046, 647, 649, 642, 275, 2096, 2041, - /* 1990 */ 2010, 1613, 648, 2077, 102, 2042, 325, 2043, 652, 2045, - /* 2000 */ 2046, 647, 2060, 642, 22, 277, 282, 381, 623, 67, - /* 2010 */ 649, 12, 23, 1457, 1544, 2010, 1534, 648, 174, 284, - /* 2020 */ 2042, 555, 1512, 98, 1533, 2077, 2060, 10, 320, 2043, - /* 2030 */ 652, 2045, 2046, 647, 649, 642, 2080, 641, 36, 2010, - /* 2040 */ 1510, 648, 1509, 1481, 15, 24, 2041, 186, 1489, 25, - /* 2050 */ 2077, 2060, 655, 325, 2043, 652, 2045, 2046, 647, 649, - /* 2060 */ 642, 651, 653, 382, 2010, 657, 648, 1284, 659, 660, - /* 2070 */ 2041, 662, 1281, 1278, 2077, 663, 665, 309, 2043, 652, - /* 2080 */ 2045, 2046, 647, 2042, 642, 1272, 666, 668, 1261, 1270, - /* 2090 */ 669, 675, 290, 103, 104, 2041, 1293, 1276, 1275, 2077, - /* 2100 */ 1274, 1273, 310, 2043, 652, 2045, 2046, 647, 74, 642, - /* 2110 */ 2042, 1289, 1175, 685, 2060, 1209, 1208, 1207, 1206, 291, - /* 2120 */ 1205, 1204, 649, 1202, 1228, 1200, 1199, 2010, 1198, 648, - /* 2130 */ 697, 1196, 2042, 1195, 1194, 1193, 1192, 1191, 1190, 1225, - /* 2140 */ 1223, 2060, 1187, 1186, 1183, 1182, 1181, 1180, 1732, 649, - /* 2150 */ 717, 1730, 718, 719, 2010, 721, 648, 723, 2041, 1728, - /* 2160 */ 725, 727, 2077, 2060, 722, 311, 2043, 652, 2045, 2046, - /* 2170 */ 647, 649, 642, 1726, 726, 729, 2010, 730, 648, 1712, - /* 2180 */ 731, 733, 1132, 1692, 294, 2041, 737, 741, 1443, 2077, - /* 2190 */ 304, 740, 317, 2043, 652, 2045, 2046, 647, 1667, 642, - /* 2200 */ 1667, 1667, 1667, 1667, 1667, 1667, 1667, 2041, 1667, 1667, - /* 2210 */ 1667, 2077, 2042, 1667, 321, 2043, 652, 2045, 2046, 647, - /* 2220 */ 1667, 642, 1667, 1667, 1667, 1667, 1667, 1667, 1667, 2042, - /* 2230 */ 1667, 1667, 1667, 1667, 1667, 1667, 1667, 1667, 1667, 1667, - /* 2240 */ 1667, 1667, 1667, 2060, 1667, 1667, 2042, 1667, 1667, 1667, - /* 2250 */ 1667, 649, 1667, 1667, 1667, 1667, 2010, 1667, 648, 1667, - /* 2260 */ 2060, 1667, 1667, 1667, 1667, 1667, 1667, 1667, 649, 1667, - /* 2270 */ 1667, 1667, 1667, 2010, 1667, 648, 1667, 2060, 2042, 1667, - /* 2280 */ 1667, 1667, 1667, 1667, 1667, 649, 1667, 2041, 1667, 1667, - /* 2290 */ 2010, 2077, 648, 1667, 313, 2043, 652, 2045, 2046, 647, - /* 2300 */ 1667, 642, 1667, 2042, 2041, 1667, 1667, 1667, 2077, 2060, - /* 2310 */ 1667, 322, 2043, 652, 2045, 2046, 647, 649, 642, 1667, - /* 2320 */ 1667, 2041, 2010, 1667, 648, 2077, 1667, 2042, 314, 2043, - /* 2330 */ 652, 2045, 2046, 647, 2060, 642, 1667, 1667, 1667, 1667, - /* 2340 */ 1667, 1667, 649, 1667, 1667, 1667, 1667, 2010, 1667, 648, - /* 2350 */ 1667, 1667, 2042, 2041, 1667, 1667, 1667, 2077, 2060, 1667, - /* 2360 */ 323, 2043, 652, 2045, 2046, 647, 649, 642, 1667, 1667, - /* 2370 */ 1667, 2010, 1667, 648, 1667, 1667, 1667, 1667, 2041, 1667, - /* 2380 */ 1667, 1667, 2077, 2060, 1667, 315, 2043, 652, 2045, 2046, - /* 2390 */ 647, 649, 642, 1667, 1667, 1667, 2010, 1667, 648, 1667, - /* 2400 */ 1667, 1667, 2041, 1667, 1667, 1667, 2077, 1667, 1667, 328, - /* 2410 */ 2043, 652, 2045, 2046, 647, 2042, 642, 1667, 1667, 1667, - /* 2420 */ 1667, 1667, 1667, 1667, 1667, 1667, 1667, 2041, 1667, 1667, - /* 2430 */ 1667, 2077, 1667, 1667, 329, 2043, 652, 2045, 2046, 647, - /* 2440 */ 1667, 642, 2042, 1667, 1667, 1667, 2060, 1667, 1667, 1667, - /* 2450 */ 1667, 1667, 1667, 1667, 649, 1667, 1667, 1667, 1667, 2010, - /* 2460 */ 1667, 648, 1667, 1667, 2042, 1667, 1667, 1667, 1667, 1667, - /* 2470 */ 1667, 1667, 1667, 2060, 1667, 1667, 1667, 1667, 1667, 1667, - /* 2480 */ 1667, 649, 1667, 1667, 1667, 1667, 2010, 1667, 648, 1667, - /* 2490 */ 2041, 1667, 1667, 1667, 2077, 2060, 1667, 2054, 2043, 652, - /* 2500 */ 2045, 2046, 647, 649, 642, 1667, 1667, 1667, 2010, 1667, - /* 2510 */ 648, 1667, 1667, 1667, 1667, 1667, 1667, 2041, 1667, 1667, - /* 2520 */ 1667, 2077, 1667, 1667, 2053, 2043, 652, 2045, 2046, 647, - /* 2530 */ 1667, 642, 1667, 1667, 1667, 1667, 1667, 1667, 1667, 2041, - /* 2540 */ 1667, 1667, 1667, 2077, 2042, 1667, 2052, 2043, 652, 2045, - /* 2550 */ 2046, 647, 1667, 642, 1667, 1667, 1667, 1667, 1667, 1667, - /* 2560 */ 1667, 2042, 1667, 1667, 1667, 1667, 1667, 1667, 1667, 1667, - /* 2570 */ 1667, 1667, 1667, 1667, 1667, 2060, 1667, 1667, 2042, 1667, - /* 2580 */ 1667, 1667, 1667, 649, 1667, 1667, 1667, 1667, 2010, 1667, - /* 2590 */ 648, 1667, 2060, 1667, 1667, 1667, 1667, 1667, 1667, 1667, - /* 2600 */ 649, 1667, 1667, 1667, 1667, 2010, 1667, 648, 1667, 2060, - /* 2610 */ 2042, 1667, 1667, 1667, 1667, 1667, 1667, 649, 1667, 2041, - /* 2620 */ 1667, 1667, 2010, 2077, 648, 1667, 341, 2043, 652, 2045, - /* 2630 */ 2046, 647, 1667, 642, 1667, 2042, 2041, 1667, 1667, 1667, - /* 2640 */ 2077, 2060, 1667, 342, 2043, 652, 2045, 2046, 647, 649, - /* 2650 */ 642, 1667, 1667, 2041, 2010, 1667, 648, 2077, 1667, 2042, - /* 2660 */ 338, 2043, 652, 2045, 2046, 647, 2060, 642, 1667, 1667, - /* 2670 */ 1667, 1667, 1667, 1667, 649, 1667, 1667, 1667, 1667, 2010, - /* 2680 */ 1667, 648, 1667, 1667, 1667, 2041, 1667, 1667, 1667, 2077, - /* 2690 */ 2060, 1667, 343, 2043, 652, 2045, 2046, 647, 649, 642, - /* 2700 */ 1667, 1667, 1667, 2010, 1667, 648, 1667, 1667, 1667, 1667, - /* 2710 */ 650, 1667, 1667, 1667, 2077, 1667, 1667, 320, 2043, 652, - /* 2720 */ 2045, 2046, 647, 1667, 642, 1667, 1667, 1667, 1667, 1667, - /* 2730 */ 1667, 1667, 1667, 1667, 2041, 1667, 1667, 1667, 2077, 1667, - /* 2740 */ 1667, 319, 2043, 652, 2045, 2046, 647, 1667, 642, + /* 0 */ 387, 376, 490, 2072, 491, 1726, 603, 1841, 161, 164, + /* 10 */ 2231, 1149, 45, 43, 1614, 363, 176, 1854, 1854, 549, + /* 20 */ 384, 1843, 1463, 615, 1903, 602, 182, 1971, 1247, 2058, + /* 30 */ 2232, 604, 2054, 1544, 559, 1461, 2090, 351, 1954, 375, + /* 40 */ 2054, 1246, 1968, 627, 618, 1971, 13, 12, 236, 2040, + /* 50 */ 1151, 656, 1154, 1155, 1488, 166, 139, 1702, 1539, 1488, + /* 60 */ 1969, 627, 1905, 552, 18, 1905, 2050, 2056, 546, 349, + /* 70 */ 1688, 1469, 362, 235, 2050, 2056, 365, 650, 1903, 640, + /* 80 */ 2071, 1903, 429, 178, 2107, 650, 2235, 109, 2073, 660, + /* 90 */ 2075, 2076, 655, 639, 650, 132, 1892, 747, 2236, 179, + /* 100 */ 14, 2160, 529, 476, 389, 378, 2156, 1898, 1900, 167, + /* 110 */ 45, 43, 1852, 625, 69, 1490, 1798, 68, 384, 184, + /* 120 */ 1463, 269, 2168, 614, 332, 133, 613, 2186, 508, 2231, + /* 130 */ 1490, 1544, 499, 1461, 491, 1726, 1546, 1547, 397, 603, + /* 140 */ 621, 31, 396, 2231, 602, 182, 1587, 38, 37, 2232, + /* 150 */ 604, 44, 42, 41, 40, 39, 1539, 489, 602, 182, + /* 160 */ 494, 1732, 18, 2232, 604, 1489, 1519, 1529, 1713, 1469, + /* 170 */ 1756, 122, 1545, 1548, 121, 120, 119, 118, 117, 116, + /* 180 */ 115, 114, 113, 578, 598, 578, 1464, 2231, 1462, 2231, + /* 190 */ 44, 42, 41, 40, 39, 747, 1676, 639, 14, 694, + /* 200 */ 1382, 1383, 2237, 182, 2237, 182, 593, 2232, 604, 2232, + /* 210 */ 604, 176, 1467, 1468, 2040, 1518, 1521, 1522, 1523, 1524, + /* 220 */ 1525, 1526, 1527, 1528, 652, 648, 1537, 1538, 1540, 1541, + /* 230 */ 1542, 1543, 2, 1955, 1546, 1547, 724, 723, 722, 721, + /* 240 */ 394, 1712, 720, 719, 143, 714, 713, 712, 711, 710, + /* 250 */ 709, 708, 156, 704, 703, 702, 393, 392, 699, 698, + /* 260 */ 697, 696, 695, 271, 1519, 1529, 639, 567, 38, 37, + /* 270 */ 1545, 1548, 44, 42, 41, 40, 39, 48, 271, 640, + /* 280 */ 1491, 1327, 1328, 467, 1464, 692, 1462, 2040, 238, 599, + /* 290 */ 594, 587, 237, 38, 37, 132, 1487, 44, 42, 41, + /* 300 */ 40, 39, 534, 154, 153, 689, 688, 687, 151, 86, + /* 310 */ 1467, 1468, 1852, 1518, 1521, 1522, 1523, 1524, 1525, 1526, + /* 320 */ 1527, 1528, 652, 648, 1537, 1538, 1540, 1541, 1542, 1543, + /* 330 */ 2, 11, 45, 43, 1848, 498, 626, 2059, 494, 1732, + /* 340 */ 384, 1293, 1463, 423, 198, 197, 48, 422, 2054, 344, + /* 350 */ 89, 339, 606, 1544, 361, 1461, 560, 1284, 682, 681, + /* 360 */ 680, 1288, 679, 1290, 1291, 678, 675, 466, 1299, 672, + /* 370 */ 1301, 1302, 669, 666, 1691, 194, 35, 290, 1539, 1829, + /* 380 */ 496, 2072, 2050, 2056, 18, 506, 492, 1964, 578, 610, + /* 390 */ 2033, 1469, 2231, 650, 1573, 122, 1899, 1900, 121, 120, + /* 400 */ 119, 118, 117, 116, 115, 114, 113, 2237, 182, 86, + /* 410 */ 281, 282, 2232, 604, 2090, 280, 83, 747, 1618, 82, + /* 420 */ 14, 1168, 657, 1167, 1488, 353, 185, 2040, 249, 656, + /* 430 */ 45, 43, 1549, 61, 1847, 578, 222, 1554, 384, 2231, + /* 440 */ 1463, 38, 37, 1488, 49, 44, 42, 41, 40, 39, + /* 450 */ 1574, 1544, 1169, 1461, 2237, 182, 1546, 1547, 2071, 2232, + /* 460 */ 604, 100, 2107, 272, 106, 109, 2073, 660, 2075, 2076, + /* 470 */ 655, 1690, 650, 1711, 1710, 142, 1539, 149, 2131, 2160, + /* 480 */ 140, 718, 716, 378, 2156, 1845, 1519, 1529, 1844, 1469, + /* 490 */ 1759, 692, 1545, 1548, 1746, 131, 130, 129, 128, 127, + /* 500 */ 126, 125, 124, 123, 11, 61, 1464, 92, 1462, 154, + /* 510 */ 153, 689, 688, 687, 151, 747, 545, 1488, 46, 2040, + /* 520 */ 2040, 34, 382, 1568, 1569, 1570, 1571, 1572, 1576, 1577, + /* 530 */ 1578, 1579, 1467, 1468, 1469, 1518, 1521, 1522, 1523, 1524, + /* 540 */ 1525, 1526, 1527, 1528, 652, 648, 1537, 1538, 1540, 1541, + /* 550 */ 1542, 1543, 2, 1251, 1546, 1547, 544, 543, 542, 544, + /* 560 */ 543, 542, 1489, 685, 136, 538, 1250, 136, 538, 537, + /* 570 */ 1520, 1611, 537, 2090, 536, 541, 2058, 536, 541, 2072, + /* 580 */ 535, 597, 185, 535, 1519, 1529, 615, 2054, 706, 1520, + /* 590 */ 1545, 1548, 558, 185, 38, 37, 65, 61, 44, 42, + /* 600 */ 41, 40, 39, 33, 1464, 556, 1462, 554, 1491, 38, + /* 610 */ 37, 1683, 2090, 44, 42, 41, 40, 39, 611, 139, + /* 620 */ 618, 2050, 2056, 366, 1837, 2040, 596, 656, 478, 1839, + /* 630 */ 1467, 1468, 650, 1518, 1521, 1522, 1523, 1524, 1525, 1526, + /* 640 */ 1527, 1528, 652, 648, 1537, 1538, 1540, 1541, 1542, 1543, + /* 650 */ 2, 45, 43, 61, 185, 1905, 2071, 640, 239, 384, + /* 660 */ 2107, 1463, 372, 109, 2073, 660, 2075, 2076, 655, 1642, + /* 670 */ 650, 1903, 1544, 187, 1461, 179, 577, 2160, 1399, 1400, + /* 680 */ 1950, 378, 2156, 617, 180, 2168, 2169, 1653, 137, 2173, + /* 690 */ 1852, 190, 61, 640, 38, 37, 2072, 1539, 44, 42, + /* 700 */ 41, 40, 39, 2187, 41, 40, 39, 1682, 1835, 54, + /* 710 */ 1469, 626, 1709, 684, 1398, 1401, 590, 589, 1640, 1641, + /* 720 */ 1643, 1644, 1645, 1437, 1438, 2175, 1852, 38, 37, 2090, + /* 730 */ 27, 44, 42, 41, 40, 39, 747, 657, 421, 46, + /* 740 */ 420, 2236, 2040, 2236, 656, 2231, 185, 2231, 52, 45, + /* 750 */ 43, 2172, 2175, 640, 2034, 1236, 191, 384, 2040, 1463, + /* 760 */ 624, 2235, 1964, 2235, 419, 2232, 2234, 2232, 2233, 427, + /* 770 */ 1544, 387, 1461, 2071, 640, 1546, 1547, 2107, 2171, 164, + /* 780 */ 168, 2073, 660, 2075, 2076, 655, 1852, 650, 1854, 626, + /* 790 */ 241, 1238, 416, 640, 1905, 1539, 1708, 640, 2072, 578, + /* 800 */ 640, 377, 185, 2231, 1707, 1519, 1529, 1852, 1469, 428, + /* 810 */ 1903, 1545, 1548, 437, 418, 414, 452, 1610, 2237, 182, + /* 820 */ 1630, 579, 2197, 2232, 604, 1464, 1852, 1462, 390, 1828, + /* 830 */ 1852, 2090, 1935, 1852, 747, 430, 164, 14, 635, 657, + /* 840 */ 1964, 185, 2040, 615, 2040, 1854, 656, 1168, 431, 1167, + /* 850 */ 2040, 1467, 1468, 1575, 1518, 1521, 1522, 1523, 1524, 1525, + /* 860 */ 1526, 1527, 1528, 652, 648, 1537, 1538, 1540, 1541, 1542, + /* 870 */ 1543, 2, 1488, 1546, 1547, 2071, 139, 244, 1169, 2107, + /* 880 */ 1706, 1705, 109, 2073, 660, 2075, 2076, 655, 165, 650, + /* 890 */ 1905, 2058, 694, 310, 2135, 615, 2160, 388, 540, 539, + /* 900 */ 378, 2156, 2054, 1519, 1529, 1704, 1903, 308, 72, 1545, + /* 910 */ 1548, 71, 141, 38, 37, 2131, 8, 44, 42, 41, + /* 920 */ 40, 39, 2175, 1464, 32, 1462, 2040, 2040, 139, 205, + /* 930 */ 486, 484, 481, 1701, 1580, 1700, 2050, 2056, 379, 1154, + /* 940 */ 1155, 181, 2168, 2169, 2072, 137, 2173, 650, 2170, 1467, + /* 950 */ 1468, 2040, 1518, 1521, 1522, 1523, 1524, 1525, 1526, 1527, + /* 960 */ 1528, 652, 648, 1537, 1538, 1540, 1541, 1542, 1543, 2, + /* 970 */ 61, 335, 640, 1486, 2072, 2180, 1607, 2090, 1699, 2040, + /* 980 */ 460, 2040, 651, 474, 640, 657, 473, 447, 453, 1703, + /* 990 */ 2040, 1698, 656, 183, 2168, 2169, 446, 137, 2173, 1697, + /* 1000 */ 507, 443, 11, 475, 9, 1852, 445, 2090, 108, 1799, + /* 1010 */ 640, 640, 373, 13, 12, 657, 1827, 1852, 1520, 152, + /* 1020 */ 2040, 2071, 656, 640, 2040, 2107, 1849, 623, 109, 2073, + /* 1030 */ 660, 2075, 2076, 655, 642, 650, 2132, 2040, 640, 574, + /* 1040 */ 2251, 1696, 2160, 1852, 1852, 2040, 378, 2156, 80, 79, + /* 1050 */ 426, 2071, 352, 189, 619, 2107, 1852, 2194, 327, 2073, + /* 1060 */ 660, 2075, 2076, 655, 433, 650, 644, 1695, 2132, 1463, + /* 1070 */ 1491, 1852, 333, 163, 1694, 412, 53, 410, 406, 402, + /* 1080 */ 399, 419, 1461, 1950, 1950, 1693, 2008, 2040, 573, 2072, + /* 1090 */ 707, 565, 1814, 471, 192, 196, 465, 464, 463, 462, + /* 1100 */ 459, 458, 457, 456, 455, 451, 450, 449, 448, 334, + /* 1110 */ 440, 439, 438, 2040, 435, 434, 350, 647, 1469, 185, + /* 1120 */ 2040, 2200, 2090, 1905, 164, 1607, 640, 1472, 692, 640, + /* 1130 */ 657, 2040, 240, 1855, 2026, 2040, 578, 656, 2072, 1904, + /* 1140 */ 2231, 356, 285, 533, 747, 637, 154, 153, 689, 688, + /* 1150 */ 687, 151, 73, 1198, 686, 2237, 182, 1896, 266, 1852, + /* 1160 */ 2232, 604, 1852, 591, 532, 640, 2071, 640, 607, 690, + /* 1170 */ 2107, 2090, 1896, 109, 2073, 660, 2075, 2076, 655, 657, + /* 1180 */ 650, 638, 404, 291, 2040, 2251, 656, 2160, 1830, 1199, + /* 1190 */ 691, 378, 2156, 1896, 221, 640, 304, 2072, 1852, 1882, + /* 1200 */ 1852, 81, 2207, 51, 145, 3, 134, 357, 1471, 355, + /* 1210 */ 354, 391, 531, 247, 228, 2071, 533, 226, 248, 2107, + /* 1220 */ 2072, 105, 109, 2073, 660, 2075, 2076, 655, 1852, 650, + /* 1230 */ 2090, 102, 147, 1464, 2251, 1462, 2160, 532, 657, 230, + /* 1240 */ 378, 2156, 229, 2040, 232, 656, 234, 231, 1739, 233, + /* 1250 */ 1737, 585, 562, 2090, 561, 152, 152, 90, 260, 1467, + /* 1260 */ 1468, 657, 63, 63, 253, 1565, 2040, 700, 656, 152, + /* 1270 */ 547, 47, 550, 278, 2071, 1685, 1686, 70, 2107, 150, + /* 1280 */ 1475, 109, 2073, 660, 2075, 2076, 655, 2061, 650, 1217, + /* 1290 */ 152, 2091, 395, 2251, 1959, 2160, 1727, 2071, 2072, 378, + /* 1300 */ 2156, 2107, 63, 701, 109, 2073, 660, 2075, 2076, 655, + /* 1310 */ 2225, 650, 1432, 1435, 381, 380, 2251, 47, 2160, 1639, + /* 1320 */ 1638, 255, 378, 2156, 1477, 1215, 622, 1733, 1396, 2190, + /* 1330 */ 283, 2090, 1893, 2179, 632, 1544, 287, 1470, 616, 657, + /* 1340 */ 2063, 268, 1, 223, 2040, 47, 656, 1277, 38, 37, + /* 1350 */ 664, 150, 44, 42, 41, 40, 39, 2072, 171, 1581, + /* 1360 */ 1539, 1474, 152, 135, 525, 521, 517, 513, 220, 265, + /* 1370 */ 4, 398, 403, 1469, 1530, 2071, 742, 348, 150, 2107, + /* 1380 */ 2072, 1419, 109, 2073, 660, 2075, 2076, 655, 298, 650, + /* 1390 */ 2090, 195, 432, 1491, 2133, 608, 2160, 1960, 657, 646, + /* 1400 */ 378, 2156, 303, 2040, 436, 656, 469, 1305, 1309, 87, + /* 1410 */ 441, 1486, 218, 2090, 454, 1952, 461, 468, 470, 1316, + /* 1420 */ 1314, 657, 480, 479, 477, 199, 2040, 200, 656, 482, + /* 1430 */ 483, 1492, 202, 485, 2071, 155, 487, 1494, 2107, 488, + /* 1440 */ 497, 109, 2073, 660, 2075, 2076, 655, 500, 650, 1489, + /* 1450 */ 208, 501, 1493, 643, 210, 2160, 502, 2071, 1495, 378, + /* 1460 */ 2156, 2107, 2072, 503, 110, 2073, 660, 2075, 2076, 655, + /* 1470 */ 213, 650, 505, 215, 84, 85, 509, 1171, 2160, 217, + /* 1480 */ 211, 219, 2159, 2156, 216, 526, 504, 527, 1478, 528, + /* 1490 */ 1473, 530, 2017, 564, 2014, 2090, 338, 1842, 566, 112, + /* 1500 */ 2013, 88, 209, 657, 148, 225, 299, 242, 2040, 245, + /* 1510 */ 656, 2072, 1838, 227, 1481, 1483, 157, 158, 1840, 568, + /* 1520 */ 575, 1836, 159, 160, 569, 572, 592, 648, 1537, 1538, + /* 1530 */ 1540, 1541, 1542, 1543, 2072, 2206, 630, 2191, 2201, 2071, + /* 1540 */ 2205, 2182, 582, 2107, 2090, 588, 110, 2073, 660, 2075, + /* 1550 */ 2076, 655, 657, 650, 367, 595, 601, 2040, 261, 656, + /* 1560 */ 2160, 251, 254, 7, 645, 2156, 259, 2090, 583, 580, + /* 1570 */ 581, 172, 2254, 138, 263, 654, 2230, 264, 609, 368, + /* 1580 */ 2040, 612, 656, 1490, 1607, 2176, 620, 262, 658, 371, + /* 1590 */ 1496, 300, 2107, 628, 273, 110, 2073, 660, 2075, 2076, + /* 1600 */ 655, 629, 650, 95, 1965, 1979, 2072, 267, 1978, 2160, + /* 1610 */ 633, 2071, 634, 343, 2156, 2107, 1977, 97, 326, 2073, + /* 1620 */ 660, 2075, 2076, 655, 653, 650, 641, 2125, 301, 2072, + /* 1630 */ 374, 302, 99, 1853, 60, 101, 2141, 662, 1815, 2090, + /* 1640 */ 1897, 743, 294, 750, 305, 744, 746, 657, 329, 340, + /* 1650 */ 341, 50, 2040, 314, 656, 309, 307, 297, 2032, 2031, + /* 1660 */ 2030, 77, 2090, 2072, 2027, 400, 401, 1454, 1455, 188, + /* 1670 */ 657, 405, 175, 328, 318, 2040, 407, 656, 740, 736, + /* 1680 */ 732, 728, 295, 2071, 2025, 408, 409, 2107, 2024, 2072, + /* 1690 */ 169, 2073, 660, 2075, 2076, 655, 2090, 650, 411, 2023, + /* 1700 */ 413, 2022, 415, 2021, 657, 417, 2071, 78, 1422, 2040, + /* 1710 */ 2107, 656, 1421, 110, 2073, 660, 2075, 2076, 655, 1991, + /* 1720 */ 650, 1990, 2090, 107, 1989, 424, 288, 2160, 425, 1988, + /* 1730 */ 657, 1987, 2157, 1373, 1943, 2040, 1942, 656, 1940, 144, + /* 1740 */ 2071, 1939, 605, 2252, 2107, 1938, 1941, 168, 2073, 660, + /* 1750 */ 2075, 2076, 655, 2072, 650, 1937, 1936, 1934, 636, 193, + /* 1760 */ 442, 1931, 444, 1945, 1930, 1929, 2071, 1933, 1932, 1928, + /* 1770 */ 2107, 1927, 1926, 320, 2073, 660, 2075, 2076, 655, 1925, + /* 1780 */ 650, 1924, 1923, 1922, 1921, 2072, 2090, 1920, 1919, 2198, + /* 1790 */ 1918, 1917, 1916, 275, 657, 146, 1915, 1914, 274, 2040, + /* 1800 */ 1913, 656, 1944, 1912, 1911, 1910, 1909, 1375, 1908, 1907, + /* 1810 */ 2072, 472, 1906, 336, 1426, 1248, 243, 600, 2090, 337, + /* 1820 */ 1252, 1762, 1761, 1760, 201, 1758, 654, 1722, 203, 1244, + /* 1830 */ 2071, 2040, 204, 656, 2107, 1721, 2060, 169, 2073, 660, + /* 1840 */ 2075, 2076, 655, 2090, 650, 177, 493, 1157, 383, 206, + /* 1850 */ 75, 657, 1156, 207, 76, 2004, 2040, 495, 656, 2072, + /* 1860 */ 1998, 1986, 2071, 212, 214, 1985, 2107, 1963, 1831, 326, + /* 1870 */ 2073, 660, 2075, 2076, 655, 2072, 650, 1757, 2126, 1191, + /* 1880 */ 1755, 510, 511, 512, 1753, 514, 516, 2071, 515, 1751, + /* 1890 */ 2253, 2107, 2090, 518, 327, 2073, 660, 2075, 2076, 655, + /* 1900 */ 657, 650, 519, 520, 1749, 2040, 522, 656, 2090, 524, + /* 1910 */ 523, 1736, 1735, 385, 1321, 1320, 657, 1718, 1833, 1832, + /* 1920 */ 1235, 2040, 1234, 656, 2072, 62, 224, 1233, 1227, 1232, + /* 1930 */ 715, 1229, 717, 1747, 1228, 1226, 563, 358, 1740, 1738, + /* 1940 */ 2107, 2072, 359, 322, 2073, 660, 2075, 2076, 655, 360, + /* 1950 */ 650, 548, 2071, 1717, 1716, 1715, 2107, 2090, 2072, 327, + /* 1960 */ 2073, 660, 2075, 2076, 655, 657, 650, 551, 557, 553, + /* 1970 */ 2040, 555, 656, 1446, 2090, 1442, 111, 1444, 1441, 2003, + /* 1980 */ 1428, 26, 657, 66, 1997, 55, 570, 2040, 571, 656, + /* 1990 */ 1984, 2090, 1982, 576, 2236, 19, 246, 364, 1655, 657, + /* 2000 */ 16, 2071, 28, 250, 2040, 2107, 656, 2072, 311, 2073, + /* 2010 */ 660, 2075, 2076, 655, 584, 650, 586, 162, 2071, 5, + /* 2020 */ 6, 58, 2107, 2072, 59, 312, 2073, 660, 2075, 2076, + /* 2030 */ 655, 252, 650, 257, 258, 2071, 1637, 170, 30, 2107, + /* 2040 */ 2090, 2072, 313, 2073, 660, 2075, 2076, 655, 657, 650, + /* 2050 */ 256, 2061, 29, 2040, 64, 656, 2090, 21, 1629, 91, + /* 2060 */ 1670, 1675, 1676, 1669, 657, 369, 1674, 1673, 370, 2040, + /* 2070 */ 1604, 656, 1603, 270, 2090, 1983, 173, 1981, 56, 57, + /* 2080 */ 1980, 1962, 657, 20, 2071, 93, 94, 2040, 2107, 656, + /* 2090 */ 2072, 319, 2073, 660, 2075, 2076, 655, 276, 650, 22, + /* 2100 */ 2071, 17, 277, 1635, 2107, 279, 2072, 323, 2073, 660, + /* 2110 */ 2075, 2076, 655, 1961, 650, 284, 67, 96, 2071, 631, + /* 2120 */ 98, 102, 2107, 2090, 10, 315, 2073, 660, 2075, 2076, + /* 2130 */ 655, 657, 650, 289, 286, 23, 2040, 1556, 656, 2090, + /* 2140 */ 1555, 12, 1479, 1566, 2110, 174, 1534, 657, 649, 186, + /* 2150 */ 1532, 1511, 2040, 36, 656, 1531, 15, 24, 659, 1503, + /* 2160 */ 25, 663, 1306, 2072, 665, 386, 661, 2071, 1303, 667, + /* 2170 */ 668, 2107, 1300, 670, 324, 2073, 660, 2075, 2076, 655, + /* 2180 */ 2072, 650, 671, 2071, 673, 1294, 1292, 2107, 674, 676, + /* 2190 */ 316, 2073, 660, 2075, 2076, 655, 2090, 650, 1283, 677, + /* 2200 */ 103, 292, 1298, 104, 657, 683, 1315, 74, 1311, 2040, + /* 2210 */ 1297, 656, 1296, 2090, 693, 1295, 1189, 1223, 1222, 1221, + /* 2220 */ 1220, 657, 1219, 1218, 1216, 1214, 2040, 1213, 656, 2072, + /* 2230 */ 1212, 1242, 1207, 705, 1210, 293, 1209, 1208, 1206, 1205, + /* 2240 */ 2071, 1204, 1237, 1239, 2107, 2072, 1201, 325, 2073, 660, + /* 2250 */ 2075, 2076, 655, 1200, 650, 1197, 1196, 2071, 1195, 1194, + /* 2260 */ 1754, 2107, 2090, 725, 317, 2073, 660, 2075, 2076, 655, + /* 2270 */ 657, 650, 727, 726, 1752, 2040, 729, 656, 2090, 730, + /* 2280 */ 1750, 731, 733, 734, 735, 1748, 657, 737, 738, 739, + /* 2290 */ 1734, 2040, 741, 656, 2072, 1714, 1146, 296, 745, 1689, + /* 2300 */ 1465, 306, 748, 749, 1689, 1689, 2071, 1689, 1689, 1689, + /* 2310 */ 2107, 1689, 1689, 330, 2073, 660, 2075, 2076, 655, 2072, + /* 2320 */ 650, 1689, 2071, 1689, 1689, 1689, 2107, 2090, 1689, 331, + /* 2330 */ 2073, 660, 2075, 2076, 655, 657, 650, 1689, 1689, 1689, + /* 2340 */ 2040, 1689, 656, 2072, 1689, 1689, 1689, 1689, 1689, 1689, + /* 2350 */ 1689, 1689, 2090, 1689, 1689, 1689, 1689, 1689, 1689, 1689, + /* 2360 */ 657, 1689, 1689, 1689, 1689, 2040, 1689, 656, 1689, 1689, + /* 2370 */ 1689, 2071, 1689, 1689, 1689, 2107, 2090, 1689, 2084, 2073, + /* 2380 */ 660, 2075, 2076, 655, 657, 650, 1689, 1689, 1689, 2040, + /* 2390 */ 1689, 656, 1689, 1689, 1689, 1689, 2071, 1689, 1689, 1689, + /* 2400 */ 2107, 1689, 1689, 2083, 2073, 660, 2075, 2076, 655, 1689, + /* 2410 */ 650, 1689, 1689, 1689, 2072, 1689, 1689, 1689, 1689, 1689, + /* 2420 */ 2071, 1689, 1689, 1689, 2107, 1689, 1689, 2082, 2073, 660, + /* 2430 */ 2075, 2076, 655, 1689, 650, 1689, 2072, 1689, 1689, 1689, + /* 2440 */ 1689, 1689, 1689, 1689, 1689, 1689, 1689, 2090, 1689, 1689, + /* 2450 */ 1689, 1689, 1689, 1689, 1689, 657, 1689, 1689, 1689, 1689, + /* 2460 */ 2040, 1689, 656, 2072, 1689, 1689, 1689, 1689, 1689, 2090, + /* 2470 */ 1689, 1689, 1689, 1689, 1689, 1689, 1689, 657, 1689, 1689, + /* 2480 */ 1689, 1689, 2040, 1689, 656, 1689, 1689, 1689, 1689, 1689, + /* 2490 */ 1689, 2071, 1689, 1689, 1689, 2107, 2090, 1689, 345, 2073, + /* 2500 */ 660, 2075, 2076, 655, 657, 650, 1689, 1689, 1689, 2040, + /* 2510 */ 1689, 656, 2072, 2071, 1689, 1689, 1689, 2107, 1689, 1689, + /* 2520 */ 346, 2073, 660, 2075, 2076, 655, 1689, 650, 2072, 1689, + /* 2530 */ 1689, 1689, 1689, 1689, 1689, 1689, 1689, 1689, 1689, 1689, + /* 2540 */ 2071, 1689, 1689, 1689, 2107, 2090, 1689, 342, 2073, 660, + /* 2550 */ 2075, 2076, 655, 657, 650, 1689, 1689, 1689, 2040, 1689, + /* 2560 */ 656, 2090, 1689, 1689, 1689, 1689, 1689, 1689, 1689, 657, + /* 2570 */ 1689, 1689, 1689, 1689, 2040, 1689, 656, 2072, 1689, 1689, + /* 2580 */ 1689, 1689, 1689, 1689, 1689, 1689, 1689, 1689, 1689, 2071, + /* 2590 */ 1689, 1689, 1689, 2107, 1689, 1689, 347, 2073, 660, 2075, + /* 2600 */ 2076, 655, 1689, 650, 1689, 658, 1689, 1689, 1689, 2107, + /* 2610 */ 2090, 1689, 322, 2073, 660, 2075, 2076, 655, 657, 650, + /* 2620 */ 1689, 1689, 1689, 2040, 1689, 656, 1689, 1689, 1689, 1689, + /* 2630 */ 1689, 1689, 1689, 1689, 1689, 1689, 1689, 1689, 1689, 1689, + /* 2640 */ 1689, 1689, 1689, 1689, 1689, 1689, 1689, 1689, 1689, 1689, + /* 2650 */ 1689, 1689, 1689, 1689, 2071, 1689, 1689, 1689, 2107, 1689, + /* 2660 */ 1689, 321, 2073, 660, 2075, 2076, 655, 1689, 650, }; static const YYCODETYPE yy_lookahead[] = { - /* 0 */ 377, 439, 0, 339, 335, 443, 337, 338, 335, 363, - /* 10 */ 337, 338, 12, 13, 14, 392, 393, 2, 362, 361, - /* 20 */ 20, 459, 22, 8, 9, 463, 464, 12, 13, 14, - /* 30 */ 15, 16, 374, 33, 370, 35, 20, 331, 362, 383, - /* 40 */ 384, 364, 8, 9, 394, 369, 12, 13, 14, 15, - /* 50 */ 16, 339, 375, 439, 378, 8, 9, 443, 58, 12, - /* 60 */ 13, 14, 15, 16, 64, 63, 373, 20, 362, 376, - /* 70 */ 377, 71, 328, 459, 346, 339, 370, 463, 464, 351, - /* 80 */ 20, 375, 22, 377, 12, 13, 409, 410, 411, 439, - /* 90 */ 4, 379, 20, 443, 22, 35, 96, 420, 64, 435, - /* 100 */ 436, 437, 21, 439, 440, 33, 370, 35, 458, 459, - /* 110 */ 44, 51, 406, 463, 464, 34, 410, 36, 118, 413, - /* 120 */ 414, 415, 416, 417, 418, 419, 420, 421, 422, 43, - /* 130 */ 58, 45, 46, 133, 134, 20, 64, 336, 394, 105, - /* 140 */ 339, 340, 398, 71, 331, 109, 110, 111, 112, 113, - /* 150 */ 114, 115, 116, 117, 118, 119, 362, 121, 122, 123, - /* 160 */ 124, 125, 126, 163, 164, 377, 339, 20, 96, 169, - /* 170 */ 170, 435, 436, 437, 354, 439, 440, 389, 384, 443, - /* 180 */ 392, 393, 362, 439, 184, 339, 186, 443, 375, 369, - /* 190 */ 118, 371, 20, 58, 458, 459, 162, 370, 378, 463, - /* 200 */ 464, 63, 458, 459, 20, 133, 134, 463, 464, 20, - /* 210 */ 210, 211, 165, 213, 214, 215, 216, 217, 218, 219, + /* 0 */ 356, 356, 335, 331, 337, 338, 441, 365, 364, 364, + /* 10 */ 445, 4, 12, 13, 14, 371, 364, 373, 373, 4, + /* 20 */ 20, 366, 22, 339, 380, 460, 461, 379, 22, 366, + /* 30 */ 465, 466, 377, 33, 19, 35, 364, 385, 386, 391, + /* 40 */ 377, 35, 394, 395, 372, 379, 1, 2, 33, 377, + /* 50 */ 43, 379, 45, 46, 20, 330, 372, 332, 58, 20, + /* 60 */ 394, 395, 364, 48, 64, 364, 411, 412, 53, 371, + /* 70 */ 328, 71, 371, 58, 411, 412, 413, 422, 380, 339, + /* 80 */ 408, 380, 339, 363, 412, 422, 3, 415, 416, 417, + /* 90 */ 418, 419, 420, 20, 422, 355, 376, 97, 3, 427, + /* 100 */ 100, 429, 362, 97, 375, 433, 434, 378, 379, 346, + /* 110 */ 12, 13, 372, 20, 99, 20, 353, 102, 20, 447, + /* 120 */ 22, 437, 438, 439, 381, 441, 442, 455, 63, 445, + /* 130 */ 20, 33, 335, 35, 337, 338, 136, 137, 396, 441, + /* 140 */ 396, 2, 400, 445, 460, 461, 101, 8, 9, 465, + /* 150 */ 466, 12, 13, 14, 15, 16, 58, 336, 460, 461, + /* 160 */ 339, 340, 64, 465, 466, 20, 166, 167, 331, 71, + /* 170 */ 0, 21, 172, 173, 24, 25, 26, 27, 28, 29, + /* 180 */ 30, 31, 32, 441, 20, 441, 186, 445, 188, 445, + /* 190 */ 12, 13, 14, 15, 16, 97, 101, 20, 100, 63, + /* 200 */ 166, 167, 460, 461, 460, 461, 171, 465, 466, 465, + /* 210 */ 466, 364, 212, 213, 377, 215, 216, 217, 218, 219, /* 220 */ 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, - /* 230 */ 230, 96, 386, 98, 388, 163, 164, 168, 343, 63, - /* 240 */ 21, 169, 170, 24, 25, 26, 27, 28, 29, 30, - /* 250 */ 31, 32, 357, 14, 37, 330, 184, 332, 186, 20, - /* 260 */ 365, 434, 435, 436, 437, 20, 439, 440, 96, 235, - /* 270 */ 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, - /* 280 */ 96, 96, 210, 211, 35, 213, 214, 215, 216, 217, - /* 290 */ 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, - /* 300 */ 228, 229, 230, 364, 232, 12, 13, 12, 13, 14, - /* 310 */ 15, 16, 20, 20, 375, 22, 99, 19, 101, 102, - /* 320 */ 71, 104, 253, 254, 255, 108, 33, 20, 35, 336, - /* 330 */ 331, 33, 339, 340, 339, 428, 429, 8, 9, 273, - /* 340 */ 179, 12, 13, 14, 15, 16, 48, 130, 409, 410, - /* 350 */ 411, 58, 54, 55, 56, 57, 58, 64, 345, 420, - /* 360 */ 14, 362, 201, 202, 71, 370, 20, 107, 183, 370, - /* 370 */ 185, 412, 359, 20, 375, 22, 377, 12, 13, 14, - /* 380 */ 20, 368, 3, 248, 232, 20, 234, 22, 96, 96, - /* 390 */ 127, 128, 4, 95, 209, 132, 98, 438, 33, 20, - /* 400 */ 35, 424, 163, 426, 51, 406, 0, 339, 331, 410, - /* 410 */ 339, 118, 413, 414, 415, 416, 417, 418, 0, 420, - /* 420 */ 248, 353, 372, 58, 353, 375, 133, 134, 360, 131, - /* 430 */ 435, 436, 437, 248, 439, 440, 71, 339, 370, 21, - /* 440 */ 232, 370, 24, 25, 26, 27, 28, 29, 30, 31, - /* 450 */ 32, 353, 375, 454, 455, 58, 163, 164, 360, 362, - /* 460 */ 343, 96, 169, 170, 166, 424, 369, 426, 370, 171, - /* 470 */ 163, 164, 66, 67, 68, 378, 97, 184, 47, 186, - /* 480 */ 74, 75, 365, 118, 96, 79, 188, 80, 190, 0, - /* 490 */ 84, 85, 95, 133, 134, 98, 90, 127, 133, 134, - /* 500 */ 376, 377, 20, 210, 211, 176, 213, 214, 215, 216, - /* 510 */ 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, - /* 520 */ 227, 228, 229, 230, 66, 67, 68, 96, 163, 164, - /* 530 */ 0, 362, 74, 75, 169, 170, 339, 79, 369, 339, - /* 540 */ 248, 71, 84, 85, 165, 138, 139, 378, 90, 184, - /* 550 */ 353, 186, 339, 353, 24, 25, 26, 27, 28, 29, - /* 560 */ 30, 31, 32, 193, 194, 394, 107, 370, 161, 398, - /* 570 */ 370, 14, 15, 16, 331, 210, 211, 339, 213, 214, - /* 580 */ 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, - /* 590 */ 225, 226, 227, 228, 229, 230, 12, 13, 20, 386, - /* 600 */ 370, 388, 345, 274, 20, 362, 22, 339, 439, 339, - /* 610 */ 439, 381, 443, 370, 443, 133, 134, 33, 375, 35, - /* 620 */ 377, 353, 33, 353, 386, 368, 388, 458, 459, 458, - /* 630 */ 459, 96, 463, 464, 463, 464, 248, 48, 370, 331, - /* 640 */ 370, 152, 58, 54, 55, 56, 57, 58, 339, 406, - /* 650 */ 161, 169, 170, 410, 210, 71, 413, 414, 415, 416, - /* 660 */ 417, 418, 353, 420, 96, 354, 14, 331, 12, 13, - /* 670 */ 427, 3, 20, 362, 431, 432, 20, 71, 22, 370, - /* 680 */ 96, 4, 371, 375, 95, 331, 412, 98, 363, 33, - /* 690 */ 331, 35, 423, 8, 9, 426, 19, 12, 13, 14, - /* 700 */ 15, 16, 118, 259, 260, 261, 262, 263, 264, 265, - /* 710 */ 33, 375, 438, 331, 58, 8, 9, 133, 134, 12, - /* 720 */ 13, 14, 15, 16, 128, 48, 2, 71, 132, 375, - /* 730 */ 53, 0, 8, 9, 375, 58, 12, 13, 14, 15, - /* 740 */ 16, 331, 439, 165, 162, 412, 443, 163, 164, 362, - /* 750 */ 339, 44, 96, 169, 170, 166, 167, 375, 1, 2, - /* 760 */ 171, 458, 459, 174, 353, 378, 463, 464, 184, 354, - /* 770 */ 186, 438, 95, 4, 118, 98, 362, 362, 331, 190, - /* 780 */ 363, 370, 97, 248, 370, 375, 371, 191, 192, 133, - /* 790 */ 134, 195, 358, 197, 210, 211, 20, 213, 214, 215, - /* 800 */ 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, - /* 810 */ 226, 227, 228, 229, 230, 163, 248, 235, 363, 163, - /* 820 */ 164, 18, 375, 20, 108, 169, 170, 245, 362, 415, - /* 830 */ 27, 348, 349, 30, 362, 44, 33, 371, 404, 108, - /* 840 */ 184, 369, 186, 127, 128, 129, 130, 131, 132, 331, - /* 850 */ 378, 48, 331, 50, 97, 363, 53, 370, 127, 128, - /* 860 */ 129, 130, 131, 132, 348, 349, 210, 211, 381, 213, - /* 870 */ 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, - /* 880 */ 224, 225, 226, 227, 228, 229, 230, 350, 97, 352, - /* 890 */ 339, 372, 18, 375, 375, 331, 375, 23, 95, 0, - /* 900 */ 339, 8, 9, 0, 353, 12, 13, 14, 15, 16, - /* 910 */ 107, 37, 38, 363, 353, 41, 331, 370, 363, 8, - /* 920 */ 9, 370, 362, 12, 13, 14, 15, 16, 381, 369, - /* 930 */ 42, 370, 44, 59, 60, 61, 62, 269, 378, 375, - /* 940 */ 137, 165, 108, 140, 141, 142, 143, 144, 145, 146, - /* 950 */ 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, - /* 960 */ 375, 158, 159, 160, 130, 66, 67, 68, 69, 70, - /* 970 */ 96, 72, 73, 74, 75, 76, 77, 78, 79, 80, - /* 980 */ 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, - /* 990 */ 91, 92, 339, 339, 331, 8, 9, 399, 394, 12, - /* 1000 */ 13, 14, 15, 16, 22, 339, 353, 353, 97, 135, - /* 1010 */ 331, 108, 0, 339, 339, 339, 20, 35, 249, 353, - /* 1020 */ 39, 331, 331, 370, 370, 331, 331, 353, 353, 353, - /* 1030 */ 127, 128, 129, 130, 131, 132, 370, 372, 375, 20, - /* 1040 */ 375, 362, 331, 439, 370, 370, 370, 443, 44, 370, - /* 1050 */ 176, 177, 178, 71, 375, 181, 377, 339, 165, 331, - /* 1060 */ 48, 355, 458, 459, 358, 375, 375, 463, 464, 375, - /* 1070 */ 375, 353, 44, 364, 200, 45, 46, 203, 35, 205, - /* 1080 */ 206, 207, 208, 209, 375, 406, 375, 332, 370, 410, - /* 1090 */ 362, 364, 413, 414, 415, 416, 417, 418, 370, 420, - /* 1100 */ 118, 97, 375, 375, 425, 377, 427, 351, 354, 339, - /* 1110 */ 431, 432, 246, 247, 22, 64, 362, 364, 409, 410, - /* 1120 */ 411, 339, 248, 353, 445, 371, 331, 35, 375, 420, - /* 1130 */ 394, 42, 453, 44, 406, 353, 409, 410, 410, 0, - /* 1140 */ 370, 413, 414, 415, 416, 417, 418, 420, 420, 165, - /* 1150 */ 44, 423, 370, 425, 426, 427, 172, 362, 331, 431, - /* 1160 */ 432, 165, 409, 410, 107, 370, 184, 0, 186, 0, - /* 1170 */ 375, 100, 377, 420, 103, 439, 0, 100, 100, 443, - /* 1180 */ 103, 103, 163, 44, 100, 58, 196, 103, 198, 362, - /* 1190 */ 385, 22, 210, 211, 458, 459, 0, 370, 22, 463, - /* 1200 */ 464, 406, 375, 97, 377, 410, 35, 331, 413, 414, - /* 1210 */ 415, 416, 417, 418, 157, 420, 49, 44, 22, 44, - /* 1220 */ 425, 44, 427, 133, 134, 98, 431, 432, 247, 186, - /* 1230 */ 44, 44, 44, 406, 44, 1, 2, 410, 362, 96, - /* 1240 */ 413, 414, 415, 416, 417, 418, 370, 420, 453, 106, - /* 1250 */ 467, 375, 425, 377, 427, 456, 44, 394, 431, 432, - /* 1260 */ 44, 210, 44, 44, 44, 341, 331, 450, 362, 442, - /* 1270 */ 97, 44, 97, 13, 97, 44, 44, 44, 35, 44, - /* 1280 */ 341, 385, 406, 97, 97, 97, 410, 97, 338, 413, - /* 1290 */ 414, 415, 416, 417, 418, 35, 420, 362, 13, 271, - /* 1300 */ 331, 425, 439, 427, 374, 370, 443, 431, 432, 97, - /* 1310 */ 375, 385, 377, 97, 71, 97, 97, 97, 442, 441, - /* 1320 */ 35, 458, 459, 433, 97, 460, 463, 464, 97, 97, - /* 1330 */ 97, 362, 97, 444, 48, 250, 408, 396, 407, 370, - /* 1340 */ 182, 406, 42, 382, 375, 410, 377, 20, 413, 414, - /* 1350 */ 415, 416, 417, 418, 382, 420, 385, 186, 380, 162, - /* 1360 */ 425, 20, 427, 339, 339, 382, 431, 432, 380, 380, - /* 1370 */ 339, 94, 339, 331, 347, 406, 339, 442, 339, 410, - /* 1380 */ 20, 333, 413, 414, 415, 416, 417, 418, 333, 420, - /* 1390 */ 20, 345, 12, 13, 425, 401, 427, 20, 377, 345, - /* 1400 */ 431, 432, 22, 20, 362, 340, 20, 345, 395, 340, - /* 1410 */ 52, 442, 370, 33, 342, 35, 342, 375, 345, 377, - /* 1420 */ 345, 345, 331, 362, 345, 339, 333, 375, 362, 362, - /* 1430 */ 362, 333, 362, 339, 375, 375, 199, 405, 58, 96, - /* 1440 */ 343, 403, 362, 362, 362, 362, 401, 189, 406, 362, - /* 1450 */ 362, 71, 410, 362, 343, 413, 414, 415, 416, 417, - /* 1460 */ 418, 370, 420, 400, 339, 258, 375, 425, 377, 427, - /* 1470 */ 257, 449, 377, 431, 432, 449, 375, 375, 175, 375, - /* 1480 */ 375, 385, 268, 266, 442, 385, 331, 452, 267, 390, - /* 1490 */ 449, 451, 448, 390, 447, 251, 446, 406, 118, 275, - /* 1500 */ 272, 410, 468, 247, 413, 414, 415, 416, 417, 418, - /* 1510 */ 270, 420, 370, 20, 461, 408, 425, 362, 427, 339, - /* 1520 */ 462, 412, 431, 432, 340, 370, 343, 20, 343, 388, - /* 1530 */ 375, 375, 377, 167, 390, 375, 375, 375, 375, 390, - /* 1540 */ 375, 387, 343, 343, 370, 96, 430, 358, 96, 339, - /* 1550 */ 352, 343, 36, 375, 331, 402, 334, 366, 333, 391, - /* 1560 */ 356, 406, 356, 397, 184, 410, 186, 356, 413, 414, - /* 1570 */ 415, 416, 417, 418, 344, 420, 329, 0, 0, 0, - /* 1580 */ 425, 42, 427, 391, 331, 362, 431, 432, 0, 35, - /* 1590 */ 210, 211, 204, 370, 35, 35, 35, 204, 375, 0, - /* 1600 */ 377, 204, 35, 223, 224, 225, 226, 227, 228, 229, - /* 1610 */ 35, 0, 204, 0, 331, 362, 35, 0, 22, 0, - /* 1620 */ 35, 191, 186, 370, 184, 0, 0, 0, 375, 406, - /* 1630 */ 377, 180, 179, 410, 0, 0, 413, 414, 415, 416, - /* 1640 */ 417, 418, 47, 420, 331, 362, 0, 0, 425, 0, - /* 1650 */ 427, 42, 0, 370, 431, 432, 0, 0, 375, 406, - /* 1660 */ 377, 0, 0, 410, 152, 35, 413, 414, 415, 416, - /* 1670 */ 417, 418, 0, 420, 0, 362, 0, 0, 331, 152, - /* 1680 */ 427, 0, 0, 370, 431, 432, 0, 0, 375, 406, - /* 1690 */ 377, 0, 0, 410, 0, 0, 413, 414, 415, 416, - /* 1700 */ 417, 418, 0, 420, 0, 331, 0, 0, 0, 362, - /* 1710 */ 427, 0, 0, 0, 431, 432, 0, 370, 0, 406, - /* 1720 */ 42, 0, 375, 410, 377, 0, 413, 414, 415, 416, - /* 1730 */ 417, 418, 0, 420, 0, 0, 362, 22, 0, 0, - /* 1740 */ 136, 0, 0, 0, 370, 35, 58, 0, 58, 375, - /* 1750 */ 0, 377, 47, 406, 331, 58, 0, 410, 0, 42, - /* 1760 */ 413, 414, 415, 416, 417, 418, 39, 420, 44, 14, - /* 1770 */ 47, 14, 0, 47, 0, 0, 40, 0, 465, 466, - /* 1780 */ 406, 175, 0, 39, 410, 362, 0, 413, 414, 415, - /* 1790 */ 416, 417, 418, 370, 420, 0, 65, 0, 375, 39, - /* 1800 */ 377, 427, 455, 0, 35, 39, 432, 48, 0, 48, - /* 1810 */ 39, 35, 0, 35, 0, 48, 331, 0, 35, 39, - /* 1820 */ 39, 48, 0, 0, 0, 105, 35, 22, 0, 406, - /* 1830 */ 0, 103, 44, 410, 35, 35, 413, 414, 415, 416, - /* 1840 */ 417, 418, 35, 420, 35, 35, 44, 362, 331, 22, - /* 1850 */ 35, 35, 0, 22, 22, 370, 50, 0, 22, 0, - /* 1860 */ 375, 35, 377, 0, 35, 0, 22, 20, 35, 35, - /* 1870 */ 35, 0, 35, 35, 165, 0, 22, 0, 0, 362, - /* 1880 */ 457, 97, 3, 96, 367, 96, 187, 370, 252, 167, - /* 1890 */ 44, 406, 375, 97, 377, 410, 231, 331, 413, 414, - /* 1900 */ 415, 416, 417, 418, 256, 420, 173, 96, 44, 96, - /* 1910 */ 165, 165, 172, 44, 331, 97, 97, 96, 44, 47, - /* 1920 */ 172, 96, 252, 406, 44, 3, 35, 410, 362, 47, - /* 1930 */ 413, 414, 415, 416, 417, 418, 370, 420, 96, 44, - /* 1940 */ 97, 375, 97, 377, 96, 362, 331, 97, 252, 35, - /* 1950 */ 367, 466, 35, 370, 35, 35, 35, 97, 375, 97, - /* 1960 */ 377, 0, 44, 47, 0, 246, 0, 0, 39, 96, - /* 1970 */ 47, 331, 406, 47, 0, 39, 410, 362, 47, 413, - /* 1980 */ 414, 415, 416, 417, 418, 370, 420, 97, 422, 406, - /* 1990 */ 375, 97, 377, 410, 106, 331, 413, 414, 415, 416, - /* 2000 */ 417, 418, 362, 420, 96, 96, 96, 367, 168, 96, - /* 2010 */ 370, 2, 44, 22, 210, 375, 231, 377, 47, 166, - /* 2020 */ 331, 406, 97, 96, 231, 410, 362, 233, 413, 414, - /* 2030 */ 415, 416, 417, 418, 370, 420, 96, 96, 96, 375, - /* 2040 */ 97, 377, 97, 97, 96, 96, 406, 47, 22, 96, - /* 2050 */ 410, 362, 35, 413, 414, 415, 416, 417, 418, 370, - /* 2060 */ 420, 212, 107, 35, 375, 96, 377, 97, 35, 96, - /* 2070 */ 406, 35, 97, 97, 410, 96, 35, 413, 414, 415, - /* 2080 */ 416, 417, 418, 331, 420, 97, 96, 35, 22, 97, - /* 2090 */ 96, 108, 44, 96, 96, 406, 35, 120, 120, 410, - /* 2100 */ 120, 120, 413, 414, 415, 416, 417, 418, 96, 420, - /* 2110 */ 331, 22, 65, 64, 362, 35, 35, 35, 35, 44, - /* 2120 */ 35, 35, 370, 35, 71, 35, 35, 375, 35, 377, - /* 2130 */ 93, 35, 331, 35, 35, 22, 35, 35, 35, 71, - /* 2140 */ 35, 362, 35, 35, 35, 35, 22, 35, 0, 370, - /* 2150 */ 35, 0, 48, 39, 375, 35, 377, 39, 406, 0, - /* 2160 */ 35, 39, 410, 362, 48, 413, 414, 415, 416, 417, - /* 2170 */ 418, 370, 420, 0, 48, 35, 375, 48, 377, 0, - /* 2180 */ 39, 35, 35, 0, 22, 406, 21, 20, 22, 410, - /* 2190 */ 22, 21, 413, 414, 415, 416, 417, 418, 469, 420, - /* 2200 */ 469, 469, 469, 469, 469, 469, 469, 406, 469, 469, - /* 2210 */ 469, 410, 331, 469, 413, 414, 415, 416, 417, 418, - /* 2220 */ 469, 420, 469, 469, 469, 469, 469, 469, 469, 331, - /* 2230 */ 469, 469, 469, 469, 469, 469, 469, 469, 469, 469, - /* 2240 */ 469, 469, 469, 362, 469, 469, 331, 469, 469, 469, - /* 2250 */ 469, 370, 469, 469, 469, 469, 375, 469, 377, 469, - /* 2260 */ 362, 469, 469, 469, 469, 469, 469, 469, 370, 469, - /* 2270 */ 469, 469, 469, 375, 469, 377, 469, 362, 331, 469, - /* 2280 */ 469, 469, 469, 469, 469, 370, 469, 406, 469, 469, - /* 2290 */ 375, 410, 377, 469, 413, 414, 415, 416, 417, 418, - /* 2300 */ 469, 420, 469, 331, 406, 469, 469, 469, 410, 362, - /* 2310 */ 469, 413, 414, 415, 416, 417, 418, 370, 420, 469, - /* 2320 */ 469, 406, 375, 469, 377, 410, 469, 331, 413, 414, - /* 2330 */ 415, 416, 417, 418, 362, 420, 469, 469, 469, 469, - /* 2340 */ 469, 469, 370, 469, 469, 469, 469, 375, 469, 377, - /* 2350 */ 469, 469, 331, 406, 469, 469, 469, 410, 362, 469, - /* 2360 */ 413, 414, 415, 416, 417, 418, 370, 420, 469, 469, - /* 2370 */ 469, 375, 469, 377, 469, 469, 469, 469, 406, 469, - /* 2380 */ 469, 469, 410, 362, 469, 413, 414, 415, 416, 417, - /* 2390 */ 418, 370, 420, 469, 469, 469, 375, 469, 377, 469, - /* 2400 */ 469, 469, 406, 469, 469, 469, 410, 469, 469, 413, - /* 2410 */ 414, 415, 416, 417, 418, 331, 420, 469, 469, 469, - /* 2420 */ 469, 469, 469, 469, 469, 469, 469, 406, 469, 469, - /* 2430 */ 469, 410, 469, 469, 413, 414, 415, 416, 417, 418, - /* 2440 */ 469, 420, 331, 469, 469, 469, 362, 469, 469, 469, - /* 2450 */ 469, 469, 469, 469, 370, 469, 469, 469, 469, 375, - /* 2460 */ 469, 377, 469, 469, 331, 469, 469, 469, 469, 469, - /* 2470 */ 469, 469, 469, 362, 469, 469, 469, 469, 469, 469, - /* 2480 */ 469, 370, 469, 469, 469, 469, 375, 469, 377, 469, - /* 2490 */ 406, 469, 469, 469, 410, 362, 469, 413, 414, 415, - /* 2500 */ 416, 417, 418, 370, 420, 469, 469, 469, 375, 469, - /* 2510 */ 377, 469, 469, 469, 469, 469, 469, 406, 469, 469, - /* 2520 */ 469, 410, 469, 469, 413, 414, 415, 416, 417, 418, - /* 2530 */ 469, 420, 469, 469, 469, 469, 469, 469, 469, 406, - /* 2540 */ 469, 469, 469, 410, 331, 469, 413, 414, 415, 416, - /* 2550 */ 417, 418, 469, 420, 469, 469, 469, 469, 469, 469, - /* 2560 */ 469, 331, 469, 469, 469, 469, 469, 469, 469, 469, - /* 2570 */ 469, 469, 469, 469, 469, 362, 469, 469, 331, 469, - /* 2580 */ 469, 469, 469, 370, 469, 469, 469, 469, 375, 469, - /* 2590 */ 377, 469, 362, 469, 469, 469, 469, 469, 469, 469, - /* 2600 */ 370, 469, 469, 469, 469, 375, 469, 377, 469, 362, - /* 2610 */ 331, 469, 469, 469, 469, 469, 469, 370, 469, 406, - /* 2620 */ 469, 469, 375, 410, 377, 469, 413, 414, 415, 416, - /* 2630 */ 417, 418, 469, 420, 469, 331, 406, 469, 469, 469, - /* 2640 */ 410, 362, 469, 413, 414, 415, 416, 417, 418, 370, - /* 2650 */ 420, 469, 469, 406, 375, 469, 377, 410, 469, 331, - /* 2660 */ 413, 414, 415, 416, 417, 418, 362, 420, 469, 469, - /* 2670 */ 469, 469, 469, 469, 370, 469, 469, 469, 469, 375, - /* 2680 */ 469, 377, 469, 469, 469, 406, 469, 469, 469, 410, - /* 2690 */ 362, 469, 413, 414, 415, 416, 417, 418, 370, 420, - /* 2700 */ 469, 469, 469, 375, 469, 377, 469, 469, 469, 469, - /* 2710 */ 406, 469, 469, 469, 410, 469, 469, 413, 414, 415, - /* 2720 */ 416, 417, 418, 469, 420, 469, 469, 469, 469, 469, - /* 2730 */ 469, 469, 469, 469, 406, 469, 469, 469, 410, 469, - /* 2740 */ 469, 413, 414, 415, 416, 417, 418, 469, 420, + /* 230 */ 230, 231, 232, 386, 136, 137, 66, 67, 68, 69, + /* 240 */ 70, 331, 72, 73, 74, 75, 76, 77, 78, 79, + /* 250 */ 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, + /* 260 */ 90, 91, 92, 168, 166, 167, 20, 111, 8, 9, + /* 270 */ 172, 173, 12, 13, 14, 15, 16, 100, 168, 339, + /* 280 */ 20, 136, 137, 80, 186, 112, 188, 377, 131, 254, + /* 290 */ 255, 256, 135, 8, 9, 355, 20, 12, 13, 14, + /* 300 */ 15, 16, 362, 130, 131, 132, 133, 134, 135, 345, + /* 310 */ 212, 213, 372, 215, 216, 217, 218, 219, 220, 221, + /* 320 */ 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, + /* 330 */ 232, 233, 12, 13, 370, 336, 339, 366, 339, 340, + /* 340 */ 20, 97, 22, 396, 141, 142, 100, 400, 377, 64, + /* 350 */ 193, 194, 269, 33, 197, 35, 199, 113, 114, 115, + /* 360 */ 116, 117, 118, 119, 120, 121, 122, 164, 124, 125, + /* 370 */ 126, 127, 128, 129, 0, 58, 430, 431, 58, 0, + /* 380 */ 14, 331, 411, 412, 64, 388, 20, 390, 441, 44, + /* 390 */ 396, 71, 445, 422, 109, 21, 378, 379, 24, 25, + /* 400 */ 26, 27, 28, 29, 30, 31, 32, 460, 461, 345, + /* 410 */ 130, 131, 465, 466, 364, 135, 99, 97, 14, 102, + /* 420 */ 100, 20, 372, 22, 20, 361, 249, 377, 168, 379, + /* 430 */ 12, 13, 14, 100, 370, 441, 35, 14, 20, 445, + /* 440 */ 22, 8, 9, 20, 100, 12, 13, 14, 15, 16, + /* 450 */ 165, 33, 51, 35, 460, 461, 136, 137, 408, 465, + /* 460 */ 466, 343, 412, 58, 343, 415, 416, 417, 418, 419, + /* 470 */ 420, 0, 422, 331, 331, 425, 58, 427, 428, 429, + /* 480 */ 359, 350, 351, 433, 434, 367, 166, 167, 367, 71, + /* 490 */ 0, 112, 172, 173, 0, 24, 25, 26, 27, 28, + /* 500 */ 29, 30, 31, 32, 233, 100, 186, 102, 188, 130, + /* 510 */ 131, 132, 133, 134, 135, 97, 22, 20, 100, 377, + /* 520 */ 377, 236, 237, 238, 239, 240, 241, 242, 243, 244, + /* 530 */ 245, 246, 212, 213, 71, 215, 216, 217, 218, 219, + /* 540 */ 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, + /* 550 */ 230, 231, 232, 22, 136, 137, 66, 67, 68, 66, + /* 560 */ 67, 68, 20, 111, 74, 75, 35, 74, 75, 79, + /* 570 */ 166, 4, 79, 364, 84, 85, 366, 84, 85, 331, + /* 580 */ 90, 372, 249, 90, 166, 167, 339, 377, 71, 166, + /* 590 */ 172, 173, 21, 249, 8, 9, 4, 100, 12, 13, + /* 600 */ 14, 15, 16, 2, 186, 34, 188, 36, 20, 8, + /* 610 */ 9, 178, 364, 12, 13, 14, 15, 16, 273, 372, + /* 620 */ 372, 411, 412, 413, 365, 377, 417, 379, 97, 365, + /* 630 */ 212, 213, 422, 215, 216, 217, 218, 219, 220, 221, + /* 640 */ 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, + /* 650 */ 232, 12, 13, 100, 249, 364, 408, 339, 130, 20, + /* 660 */ 412, 22, 371, 415, 416, 417, 418, 419, 420, 212, + /* 670 */ 422, 380, 33, 355, 35, 427, 96, 429, 136, 137, + /* 680 */ 372, 433, 434, 436, 437, 438, 439, 101, 441, 442, + /* 690 */ 372, 383, 100, 339, 8, 9, 331, 58, 12, 13, + /* 700 */ 14, 15, 16, 455, 14, 15, 16, 274, 365, 355, + /* 710 */ 71, 339, 331, 365, 172, 173, 259, 260, 261, 262, + /* 720 */ 263, 264, 265, 195, 196, 414, 372, 8, 9, 364, + /* 730 */ 44, 12, 13, 14, 15, 16, 97, 372, 185, 100, + /* 740 */ 187, 441, 377, 441, 379, 445, 249, 445, 168, 12, + /* 750 */ 13, 440, 414, 339, 396, 35, 168, 20, 377, 22, + /* 760 */ 388, 461, 390, 461, 211, 465, 466, 465, 466, 355, + /* 770 */ 33, 356, 35, 408, 339, 136, 137, 412, 440, 364, + /* 780 */ 415, 416, 417, 418, 419, 420, 372, 422, 373, 339, + /* 790 */ 355, 71, 181, 339, 364, 58, 331, 339, 331, 441, + /* 800 */ 339, 371, 249, 445, 331, 166, 167, 372, 71, 355, + /* 810 */ 380, 172, 173, 355, 203, 204, 355, 250, 460, 461, + /* 820 */ 101, 456, 457, 465, 466, 186, 372, 188, 356, 0, + /* 830 */ 372, 364, 0, 372, 97, 22, 364, 100, 388, 372, + /* 840 */ 390, 249, 377, 339, 377, 373, 379, 20, 35, 22, + /* 850 */ 377, 212, 213, 165, 215, 216, 217, 218, 219, 220, + /* 860 */ 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, + /* 870 */ 231, 232, 20, 136, 137, 408, 372, 365, 51, 412, + /* 880 */ 331, 331, 415, 416, 417, 418, 419, 420, 18, 422, + /* 890 */ 364, 366, 63, 23, 427, 339, 429, 371, 350, 351, + /* 900 */ 433, 434, 377, 166, 167, 331, 380, 37, 38, 172, + /* 910 */ 173, 41, 425, 8, 9, 428, 39, 12, 13, 14, + /* 920 */ 15, 16, 414, 186, 236, 188, 377, 377, 372, 59, + /* 930 */ 60, 61, 62, 331, 246, 331, 411, 412, 413, 45, + /* 940 */ 46, 437, 438, 439, 331, 441, 442, 422, 440, 212, + /* 950 */ 213, 377, 215, 216, 217, 218, 219, 220, 221, 222, + /* 960 */ 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, + /* 970 */ 100, 18, 339, 20, 331, 247, 248, 364, 331, 377, + /* 980 */ 27, 377, 365, 30, 339, 372, 33, 155, 355, 332, + /* 990 */ 377, 331, 379, 437, 438, 439, 164, 441, 442, 331, + /* 1000 */ 355, 48, 233, 50, 235, 372, 53, 364, 138, 353, + /* 1010 */ 339, 339, 369, 1, 2, 372, 0, 372, 166, 44, + /* 1020 */ 377, 408, 379, 339, 377, 412, 355, 355, 415, 416, + /* 1030 */ 417, 418, 419, 420, 426, 422, 428, 377, 339, 355, + /* 1040 */ 427, 331, 429, 372, 372, 377, 433, 434, 178, 179, + /* 1050 */ 180, 408, 99, 183, 355, 412, 372, 444, 415, 416, + /* 1060 */ 417, 418, 419, 420, 111, 422, 426, 331, 428, 22, + /* 1070 */ 20, 372, 202, 168, 331, 205, 101, 207, 208, 209, + /* 1080 */ 210, 211, 35, 372, 372, 331, 360, 377, 401, 331, + /* 1090 */ 352, 396, 354, 140, 383, 383, 143, 144, 145, 146, + /* 1100 */ 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, + /* 1110 */ 157, 158, 159, 377, 161, 162, 163, 64, 71, 249, + /* 1120 */ 377, 387, 364, 364, 364, 248, 339, 35, 112, 339, + /* 1130 */ 372, 377, 406, 373, 0, 377, 441, 379, 331, 380, + /* 1140 */ 445, 37, 355, 112, 97, 355, 130, 131, 132, 133, + /* 1150 */ 134, 135, 111, 35, 374, 460, 461, 377, 469, 372, + /* 1160 */ 465, 466, 372, 458, 133, 339, 408, 339, 44, 374, + /* 1170 */ 412, 364, 377, 415, 416, 417, 418, 419, 420, 372, + /* 1180 */ 422, 355, 48, 355, 377, 427, 379, 429, 0, 71, + /* 1190 */ 374, 433, 434, 377, 341, 339, 357, 331, 372, 360, + /* 1200 */ 372, 160, 444, 42, 42, 44, 44, 103, 35, 105, + /* 1210 */ 106, 355, 108, 58, 104, 408, 112, 107, 168, 412, + /* 1220 */ 331, 100, 415, 416, 417, 418, 419, 420, 372, 422, + /* 1230 */ 364, 110, 44, 186, 427, 188, 429, 133, 372, 104, + /* 1240 */ 433, 434, 107, 377, 104, 379, 104, 107, 0, 107, + /* 1250 */ 0, 444, 198, 364, 200, 44, 44, 102, 452, 212, + /* 1260 */ 213, 372, 44, 44, 44, 212, 377, 13, 379, 44, + /* 1270 */ 22, 44, 22, 44, 408, 136, 137, 44, 412, 44, + /* 1280 */ 188, 415, 416, 417, 418, 419, 420, 47, 422, 35, + /* 1290 */ 44, 364, 341, 427, 387, 429, 338, 408, 331, 433, + /* 1300 */ 434, 412, 44, 13, 415, 416, 417, 418, 419, 420, + /* 1310 */ 444, 422, 101, 101, 12, 13, 427, 44, 429, 101, + /* 1320 */ 101, 101, 433, 434, 22, 35, 101, 0, 101, 387, + /* 1330 */ 101, 364, 376, 444, 101, 33, 101, 35, 443, 372, + /* 1340 */ 100, 462, 446, 33, 377, 44, 379, 101, 8, 9, + /* 1350 */ 44, 44, 12, 13, 14, 15, 16, 331, 48, 101, + /* 1360 */ 58, 188, 44, 44, 54, 55, 56, 57, 58, 435, + /* 1370 */ 251, 410, 48, 71, 101, 408, 49, 409, 44, 412, + /* 1380 */ 331, 184, 415, 416, 417, 418, 419, 420, 398, 422, + /* 1390 */ 364, 42, 384, 20, 427, 271, 429, 387, 372, 97, + /* 1400 */ 433, 434, 101, 377, 384, 379, 165, 101, 101, 99, + /* 1410 */ 382, 20, 102, 364, 339, 339, 384, 382, 382, 101, + /* 1420 */ 101, 372, 349, 98, 95, 348, 377, 339, 379, 94, + /* 1430 */ 347, 20, 339, 339, 408, 101, 339, 20, 412, 333, + /* 1440 */ 333, 415, 416, 417, 418, 419, 420, 403, 422, 20, + /* 1450 */ 345, 379, 20, 427, 345, 429, 340, 408, 20, 433, + /* 1460 */ 434, 412, 331, 397, 415, 416, 417, 418, 419, 420, + /* 1470 */ 345, 422, 340, 345, 345, 345, 339, 52, 429, 169, + /* 1480 */ 170, 345, 433, 434, 174, 342, 176, 342, 186, 333, + /* 1490 */ 188, 364, 377, 201, 377, 364, 333, 364, 407, 339, + /* 1500 */ 377, 100, 192, 372, 405, 364, 403, 343, 377, 343, + /* 1510 */ 379, 331, 364, 364, 212, 213, 364, 364, 364, 191, + /* 1520 */ 339, 364, 364, 364, 402, 379, 258, 225, 226, 227, + /* 1530 */ 228, 229, 230, 231, 331, 451, 257, 387, 387, 408, + /* 1540 */ 451, 454, 377, 412, 364, 377, 415, 416, 417, 418, + /* 1550 */ 419, 420, 372, 422, 377, 377, 177, 377, 450, 379, + /* 1560 */ 429, 392, 392, 266, 433, 434, 453, 364, 268, 252, + /* 1570 */ 267, 451, 470, 372, 448, 372, 464, 410, 270, 275, + /* 1580 */ 377, 272, 379, 20, 248, 414, 339, 449, 408, 340, + /* 1590 */ 20, 392, 412, 377, 343, 415, 416, 417, 418, 419, + /* 1600 */ 420, 377, 422, 343, 390, 377, 331, 463, 377, 429, + /* 1610 */ 170, 408, 389, 433, 434, 412, 377, 343, 415, 416, + /* 1620 */ 417, 418, 419, 420, 421, 422, 423, 424, 392, 331, + /* 1630 */ 377, 360, 343, 372, 100, 100, 432, 368, 354, 364, + /* 1640 */ 377, 36, 343, 19, 339, 334, 333, 372, 404, 393, + /* 1650 */ 393, 399, 377, 358, 379, 329, 344, 33, 0, 0, + /* 1660 */ 0, 42, 364, 331, 0, 35, 206, 35, 35, 35, + /* 1670 */ 372, 206, 48, 358, 358, 377, 35, 379, 54, 55, + /* 1680 */ 56, 57, 58, 408, 0, 35, 206, 412, 0, 331, + /* 1690 */ 415, 416, 417, 418, 419, 420, 364, 422, 206, 0, + /* 1700 */ 35, 0, 22, 0, 372, 35, 408, 193, 188, 377, + /* 1710 */ 412, 379, 186, 415, 416, 417, 418, 419, 420, 0, + /* 1720 */ 422, 0, 364, 99, 0, 182, 102, 429, 181, 0, + /* 1730 */ 372, 0, 434, 47, 0, 377, 0, 379, 0, 42, + /* 1740 */ 408, 0, 467, 468, 412, 0, 0, 415, 416, 417, + /* 1750 */ 418, 419, 420, 331, 422, 0, 0, 0, 134, 155, + /* 1760 */ 35, 0, 155, 0, 0, 0, 408, 0, 0, 0, + /* 1770 */ 412, 0, 0, 415, 416, 417, 418, 419, 420, 0, + /* 1780 */ 422, 0, 0, 0, 0, 331, 364, 0, 0, 457, + /* 1790 */ 0, 0, 0, 169, 372, 42, 0, 0, 174, 377, + /* 1800 */ 0, 379, 0, 0, 0, 0, 0, 22, 0, 0, + /* 1810 */ 331, 139, 0, 96, 190, 22, 192, 459, 364, 96, + /* 1820 */ 22, 0, 0, 0, 58, 0, 372, 0, 58, 35, + /* 1830 */ 408, 377, 58, 379, 412, 0, 47, 415, 416, 417, + /* 1840 */ 418, 419, 420, 364, 422, 44, 47, 14, 369, 42, + /* 1850 */ 39, 372, 14, 40, 39, 0, 377, 47, 379, 331, + /* 1860 */ 0, 0, 408, 39, 177, 0, 412, 0, 0, 415, + /* 1870 */ 416, 417, 418, 419, 420, 331, 422, 0, 424, 65, + /* 1880 */ 0, 35, 48, 39, 0, 35, 39, 408, 48, 0, + /* 1890 */ 468, 412, 364, 35, 415, 416, 417, 418, 419, 420, + /* 1900 */ 372, 422, 48, 39, 0, 377, 35, 379, 364, 39, + /* 1910 */ 48, 0, 0, 369, 35, 22, 372, 0, 0, 0, + /* 1920 */ 35, 377, 35, 379, 331, 109, 107, 35, 22, 35, + /* 1930 */ 44, 35, 44, 0, 35, 35, 408, 22, 0, 0, + /* 1940 */ 412, 331, 22, 415, 416, 417, 418, 419, 420, 22, + /* 1950 */ 422, 50, 408, 0, 0, 0, 412, 364, 331, 415, + /* 1960 */ 416, 417, 418, 419, 420, 372, 422, 35, 22, 35, + /* 1970 */ 377, 35, 379, 101, 364, 35, 20, 35, 35, 0, + /* 1980 */ 35, 100, 372, 100, 0, 168, 22, 377, 168, 379, + /* 1990 */ 0, 364, 0, 175, 3, 44, 170, 168, 101, 372, + /* 2000 */ 253, 408, 100, 100, 377, 412, 379, 331, 415, 416, + /* 2010 */ 417, 418, 419, 420, 98, 422, 95, 189, 408, 96, + /* 2020 */ 96, 44, 412, 331, 44, 415, 416, 417, 418, 419, + /* 2030 */ 420, 101, 422, 44, 47, 408, 101, 100, 44, 412, + /* 2040 */ 364, 331, 415, 416, 417, 418, 419, 420, 372, 422, + /* 2050 */ 100, 47, 100, 377, 3, 379, 364, 44, 101, 100, + /* 2060 */ 35, 101, 101, 35, 372, 35, 35, 35, 35, 377, + /* 2070 */ 101, 379, 101, 47, 364, 0, 47, 0, 247, 44, + /* 2080 */ 0, 0, 372, 253, 408, 100, 39, 377, 412, 379, + /* 2090 */ 331, 415, 416, 417, 418, 419, 420, 47, 422, 100, + /* 2100 */ 408, 253, 101, 101, 412, 100, 331, 415, 416, 417, + /* 2110 */ 418, 419, 420, 0, 422, 100, 100, 39, 408, 171, + /* 2120 */ 100, 110, 412, 364, 234, 415, 416, 417, 418, 419, + /* 2130 */ 420, 372, 422, 47, 169, 44, 377, 98, 379, 364, + /* 2140 */ 98, 2, 22, 212, 100, 47, 101, 372, 100, 47, + /* 2150 */ 101, 22, 377, 100, 379, 101, 100, 100, 214, 101, + /* 2160 */ 100, 35, 101, 331, 100, 35, 111, 408, 101, 35, + /* 2170 */ 100, 412, 101, 35, 415, 416, 417, 418, 419, 420, + /* 2180 */ 331, 422, 100, 408, 35, 101, 101, 412, 100, 35, + /* 2190 */ 415, 416, 417, 418, 419, 420, 364, 422, 22, 100, + /* 2200 */ 100, 44, 123, 100, 372, 112, 35, 100, 22, 377, + /* 2210 */ 123, 379, 123, 364, 64, 123, 65, 35, 35, 35, + /* 2220 */ 35, 372, 35, 35, 35, 35, 377, 35, 379, 331, + /* 2230 */ 35, 71, 22, 93, 35, 44, 35, 35, 35, 35, + /* 2240 */ 408, 35, 35, 71, 412, 331, 35, 415, 416, 417, + /* 2250 */ 418, 419, 420, 35, 422, 35, 35, 408, 22, 35, + /* 2260 */ 0, 412, 364, 35, 415, 416, 417, 418, 419, 420, + /* 2270 */ 372, 422, 39, 48, 0, 377, 35, 379, 364, 48, + /* 2280 */ 0, 39, 35, 48, 39, 0, 372, 35, 48, 39, + /* 2290 */ 0, 377, 35, 379, 331, 0, 35, 22, 21, 471, + /* 2300 */ 22, 22, 21, 20, 471, 471, 408, 471, 471, 471, + /* 2310 */ 412, 471, 471, 415, 416, 417, 418, 419, 420, 331, + /* 2320 */ 422, 471, 408, 471, 471, 471, 412, 364, 471, 415, + /* 2330 */ 416, 417, 418, 419, 420, 372, 422, 471, 471, 471, + /* 2340 */ 377, 471, 379, 331, 471, 471, 471, 471, 471, 471, + /* 2350 */ 471, 471, 364, 471, 471, 471, 471, 471, 471, 471, + /* 2360 */ 372, 471, 471, 471, 471, 377, 471, 379, 471, 471, + /* 2370 */ 471, 408, 471, 471, 471, 412, 364, 471, 415, 416, + /* 2380 */ 417, 418, 419, 420, 372, 422, 471, 471, 471, 377, + /* 2390 */ 471, 379, 471, 471, 471, 471, 408, 471, 471, 471, + /* 2400 */ 412, 471, 471, 415, 416, 417, 418, 419, 420, 471, + /* 2410 */ 422, 471, 471, 471, 331, 471, 471, 471, 471, 471, + /* 2420 */ 408, 471, 471, 471, 412, 471, 471, 415, 416, 417, + /* 2430 */ 418, 419, 420, 471, 422, 471, 331, 471, 471, 471, + /* 2440 */ 471, 471, 471, 471, 471, 471, 471, 364, 471, 471, + /* 2450 */ 471, 471, 471, 471, 471, 372, 471, 471, 471, 471, + /* 2460 */ 377, 471, 379, 331, 471, 471, 471, 471, 471, 364, + /* 2470 */ 471, 471, 471, 471, 471, 471, 471, 372, 471, 471, + /* 2480 */ 471, 471, 377, 471, 379, 471, 471, 471, 471, 471, + /* 2490 */ 471, 408, 471, 471, 471, 412, 364, 471, 415, 416, + /* 2500 */ 417, 418, 419, 420, 372, 422, 471, 471, 471, 377, + /* 2510 */ 471, 379, 331, 408, 471, 471, 471, 412, 471, 471, + /* 2520 */ 415, 416, 417, 418, 419, 420, 471, 422, 331, 471, + /* 2530 */ 471, 471, 471, 471, 471, 471, 471, 471, 471, 471, + /* 2540 */ 408, 471, 471, 471, 412, 364, 471, 415, 416, 417, + /* 2550 */ 418, 419, 420, 372, 422, 471, 471, 471, 377, 471, + /* 2560 */ 379, 364, 471, 471, 471, 471, 471, 471, 471, 372, + /* 2570 */ 471, 471, 471, 471, 377, 471, 379, 331, 471, 471, + /* 2580 */ 471, 471, 471, 471, 471, 471, 471, 471, 471, 408, + /* 2590 */ 471, 471, 471, 412, 471, 471, 415, 416, 417, 418, + /* 2600 */ 419, 420, 471, 422, 471, 408, 471, 471, 471, 412, + /* 2610 */ 364, 471, 415, 416, 417, 418, 419, 420, 372, 422, + /* 2620 */ 471, 471, 471, 377, 471, 379, 471, 471, 471, 471, + /* 2630 */ 471, 471, 471, 471, 471, 471, 471, 471, 471, 471, + /* 2640 */ 471, 471, 471, 471, 471, 471, 471, 471, 471, 471, + /* 2650 */ 471, 471, 471, 471, 408, 471, 471, 471, 412, 471, + /* 2660 */ 471, 415, 416, 417, 418, 419, 420, 471, 422, }; -#define YY_SHIFT_COUNT (742) +#define YY_SHIFT_COUNT (750) #define YY_SHIFT_MIN (0) -#define YY_SHIFT_MAX (2183) +#define YY_SHIFT_MAX (2295) static const unsigned short int yy_shift_ofst[] = { - /* 0 */ 874, 0, 72, 0, 293, 293, 293, 293, 293, 293, - /* 10 */ 293, 293, 293, 293, 293, 365, 584, 584, 656, 584, - /* 20 */ 584, 584, 584, 584, 584, 584, 584, 584, 584, 584, - /* 30 */ 584, 584, 584, 584, 584, 584, 584, 584, 584, 584, - /* 40 */ 584, 584, 584, 584, 584, 584, 584, 584, 172, 292, - /* 50 */ 185, 184, 135, 535, 568, 535, 184, 184, 1380, 1380, - /* 60 */ 1380, 535, 1380, 1380, 388, 535, 16, 482, 115, 115, - /* 70 */ 482, 86, 86, 307, 360, 346, 346, 115, 115, 115, - /* 80 */ 115, 115, 115, 115, 147, 115, 115, 138, 16, 115, - /* 90 */ 115, 189, 115, 16, 115, 147, 115, 147, 16, 115, - /* 100 */ 115, 16, 115, 16, 16, 16, 115, 176, 803, 34, - /* 110 */ 34, 219, 458, 982, 982, 982, 982, 982, 982, 982, - /* 120 */ 982, 982, 982, 982, 982, 982, 982, 982, 982, 982, - /* 130 */ 982, 982, 217, 379, 307, 360, 249, 578, 578, 578, - /* 140 */ 2, 152, 152, 249, 245, 245, 245, 138, 260, 208, - /* 150 */ 16, 470, 16, 470, 470, 459, 606, 36, 36, 36, - /* 160 */ 36, 36, 36, 36, 36, 298, 418, 406, 47, 329, - /* 170 */ 444, 60, 69, 239, 652, 353, 776, 1030, 834, 996, - /* 180 */ 866, 981, 668, 866, 888, 769, 1019, 1085, 1286, 1158, - /* 190 */ 1300, 1327, 1300, 1197, 1341, 1341, 1300, 1197, 1197, 1341, - /* 200 */ 1277, 1341, 1341, 1341, 1360, 1360, 1370, 138, 1377, 138, - /* 210 */ 1383, 1386, 138, 1383, 138, 138, 138, 1341, 138, 1358, - /* 220 */ 1358, 1360, 16, 16, 16, 16, 16, 16, 16, 16, - /* 230 */ 16, 16, 16, 1341, 1360, 470, 470, 470, 1237, 1343, - /* 240 */ 1370, 176, 1258, 1377, 176, 1341, 1327, 1327, 470, 1207, - /* 250 */ 1213, 470, 1207, 1213, 470, 470, 16, 1217, 1303, 1207, - /* 260 */ 1214, 1221, 1244, 1085, 1224, 1228, 1240, 1256, 245, 1493, - /* 270 */ 1341, 1383, 176, 176, 1507, 1213, 470, 470, 470, 470, - /* 280 */ 470, 1213, 470, 1366, 176, 459, 176, 245, 1449, 1452, - /* 290 */ 470, 606, 1341, 176, 1516, 1360, 2749, 2749, 2749, 2749, - /* 300 */ 2749, 2749, 2749, 2749, 2749, 899, 589, 530, 677, 685, - /* 310 */ 707, 911, 731, 15, 724, 893, 903, 987, 987, 987, - /* 320 */ 987, 987, 987, 987, 987, 987, 716, 596, 295, 295, - /* 330 */ 407, 161, 489, 397, 81, 370, 263, 263, 557, 757, - /* 340 */ 582, 557, 557, 557, 1012, 791, 1092, 1089, 1057, 1139, - /* 350 */ 1071, 1077, 1078, 1084, 1169, 1176, 1196, 990, 1004, 1106, - /* 360 */ 1127, 1173, 1175, 1177, 1090, 1028, 66, 984, 1186, 1187, - /* 370 */ 1188, 1190, 1212, 1216, 1234, 1218, 1043, 1171, 1051, 1219, - /* 380 */ 431, 1220, 1227, 1231, 1232, 1233, 1235, 1143, 1260, 1285, - /* 390 */ 1243, 1167, 1577, 1578, 1579, 1539, 1588, 1554, 1388, 1559, - /* 400 */ 1560, 1561, 1393, 1599, 1567, 1575, 1397, 1611, 1408, 1613, - /* 410 */ 1581, 1617, 1596, 1619, 1585, 1430, 1436, 1440, 1625, 1626, - /* 420 */ 1627, 1451, 1453, 1634, 1635, 1595, 1646, 1647, 1649, 1609, - /* 430 */ 1652, 1656, 1657, 1661, 1662, 1672, 1674, 1676, 1512, 1630, - /* 440 */ 1677, 1527, 1681, 1682, 1686, 1687, 1691, 1692, 1694, 1695, - /* 450 */ 1702, 1704, 1706, 1707, 1708, 1711, 1712, 1713, 1678, 1716, - /* 460 */ 1718, 1721, 1725, 1732, 1734, 1715, 1735, 1738, 1739, 1604, - /* 470 */ 1741, 1742, 1743, 1688, 1710, 1747, 1690, 1750, 1697, 1756, - /* 480 */ 1758, 1717, 1727, 1724, 1705, 1755, 1723, 1757, 1726, 1772, - /* 490 */ 1736, 1744, 1774, 1775, 1777, 1760, 1606, 1782, 1786, 1795, - /* 500 */ 1731, 1797, 1803, 1769, 1759, 1766, 1808, 1776, 1761, 1771, - /* 510 */ 1812, 1778, 1767, 1780, 1814, 1783, 1773, 1781, 1817, 1822, - /* 520 */ 1823, 1824, 1720, 1728, 1791, 1805, 1828, 1799, 1800, 1807, - /* 530 */ 1809, 1788, 1802, 1810, 1815, 1827, 1816, 1830, 1831, 1852, - /* 540 */ 1832, 1806, 1857, 1836, 1826, 1859, 1829, 1863, 1833, 1865, - /* 550 */ 1844, 1847, 1834, 1835, 1837, 1784, 1787, 1871, 1709, 1789, - /* 560 */ 1838, 1875, 1699, 1854, 1745, 1722, 1877, 1878, 1746, 1733, - /* 570 */ 1879, 1846, 1636, 1811, 1796, 1813, 1740, 1665, 1748, 1648, - /* 580 */ 1818, 1864, 1869, 1819, 1821, 1825, 1842, 1843, 1874, 1872, - /* 590 */ 1882, 1848, 1880, 1670, 1845, 1850, 1922, 1895, 1696, 1891, - /* 600 */ 1914, 1917, 1919, 1920, 1921, 1860, 1862, 1916, 1719, 1918, - /* 610 */ 1923, 1961, 1964, 1966, 1967, 1873, 1929, 1705, 1926, 1908, - /* 620 */ 1890, 1894, 1909, 1910, 1840, 1913, 1974, 1936, 1853, 1927, - /* 630 */ 1888, 1705, 1931, 1968, 1785, 1794, 1793, 2009, 1991, 1804, - /* 640 */ 1940, 1925, 1941, 1943, 1942, 1945, 1971, 1948, 1949, 2000, - /* 650 */ 1946, 2026, 1849, 1953, 1955, 1970, 2017, 2028, 1969, 1975, - /* 660 */ 2033, 1973, 1976, 2036, 1979, 1988, 2041, 1990, 1992, 2052, - /* 670 */ 1994, 1977, 1978, 1980, 1981, 2066, 1983, 1997, 2048, 1998, - /* 680 */ 2061, 2012, 2048, 2048, 2089, 2047, 2049, 2080, 2081, 2082, - /* 690 */ 2083, 2085, 2086, 2088, 2090, 2091, 2093, 2053, 2037, 2075, - /* 700 */ 2096, 2098, 2099, 2113, 2101, 2102, 2103, 2068, 1788, 2105, - /* 710 */ 1802, 2107, 2108, 2109, 2110, 2124, 2112, 2148, 2115, 2104, - /* 720 */ 2114, 2151, 2120, 2116, 2118, 2159, 2125, 2126, 2122, 2173, - /* 730 */ 2140, 2129, 2141, 2179, 2146, 2147, 2183, 2162, 2165, 2166, - /* 740 */ 2168, 2170, 2167, + /* 0 */ 870, 0, 98, 0, 320, 320, 320, 320, 320, 320, + /* 10 */ 320, 320, 320, 320, 320, 418, 639, 639, 737, 639, + /* 20 */ 639, 639, 639, 639, 639, 639, 639, 639, 639, 639, + /* 30 */ 639, 639, 639, 639, 639, 639, 639, 639, 639, 639, + /* 40 */ 639, 639, 639, 639, 639, 639, 639, 639, 177, 497, + /* 50 */ 553, 246, 405, 333, 344, 333, 246, 246, 1302, 1302, + /* 60 */ 1302, 333, 1302, 1302, 592, 333, 39, 542, 73, 73, + /* 70 */ 542, 7, 7, 34, 145, 366, 366, 73, 73, 73, + /* 80 */ 73, 73, 73, 73, 93, 73, 73, 65, 39, 73, + /* 90 */ 73, 164, 73, 39, 73, 93, 73, 93, 39, 73, + /* 100 */ 73, 39, 73, 39, 39, 39, 73, 136, 953, 285, + /* 110 */ 285, 150, 493, 1047, 1047, 1047, 1047, 1047, 1047, 1047, + /* 120 */ 1047, 1047, 1047, 1047, 1047, 1047, 1047, 1047, 1047, 1047, + /* 130 */ 1047, 1047, 1104, 95, 34, 145, 720, 110, 110, 110, + /* 140 */ 829, 769, 769, 720, 276, 276, 276, 65, 156, 271, + /* 150 */ 39, 463, 39, 463, 463, 452, 517, 244, 244, 244, + /* 160 */ 244, 244, 244, 244, 244, 1624, 374, 490, 260, 433, + /* 170 */ 457, 401, 35, 404, 423, 827, 588, 894, 1031, 1050, + /* 180 */ 728, 877, 83, 728, 1161, 567, 852, 1119, 1324, 1197, + /* 190 */ 1349, 1373, 1349, 1241, 1391, 1391, 1349, 1241, 1241, 1325, + /* 200 */ 1329, 1391, 1335, 1391, 1391, 1391, 1411, 1411, 1417, 65, + /* 210 */ 1429, 65, 1432, 1438, 65, 1432, 65, 65, 65, 1391, + /* 220 */ 65, 1425, 1425, 1411, 39, 39, 39, 39, 39, 39, + /* 230 */ 39, 39, 39, 39, 39, 1391, 1411, 463, 463, 463, + /* 240 */ 1292, 1401, 1417, 136, 1328, 1429, 136, 1391, 1373, 1373, + /* 250 */ 463, 1268, 1279, 463, 1268, 1279, 463, 463, 39, 1297, + /* 260 */ 1379, 1268, 1300, 1303, 1317, 1119, 1304, 1309, 1308, 1336, + /* 270 */ 276, 1563, 1391, 1432, 136, 136, 1570, 1279, 463, 463, + /* 280 */ 463, 463, 463, 1279, 463, 1440, 136, 452, 136, 276, + /* 290 */ 1534, 1535, 463, 517, 1391, 136, 1605, 1411, 2669, 2669, + /* 300 */ 2669, 2669, 2669, 2669, 2669, 2669, 2669, 170, 1310, 471, + /* 310 */ 15, 586, 686, 719, 379, 139, 601, 905, 1016, 1340, + /* 320 */ 1340, 1340, 1340, 1340, 1340, 1340, 1340, 1340, 173, 157, + /* 330 */ 178, 178, 203, 611, 832, 317, 6, 531, 571, 528, + /* 340 */ 280, 280, 690, 45, 688, 690, 690, 690, 1134, 975, + /* 350 */ 813, 1162, 1041, 1188, 1110, 1135, 1140, 1142, 494, 1248, + /* 360 */ 1250, 1054, 1211, 1212, 1155, 1218, 1219, 1220, 1139, 1124, + /* 370 */ 345, 580, 1225, 1227, 1229, 1233, 1235, 1246, 1012, 1258, + /* 380 */ 1092, 1173, 1053, 1273, 1240, 1301, 1306, 1307, 1318, 1319, + /* 390 */ 1334, 1121, 1254, 1290, 1118, 1327, 1658, 1659, 1660, 1619, + /* 400 */ 1664, 1630, 1460, 1632, 1633, 1634, 1465, 1684, 1641, 1650, + /* 410 */ 1480, 1688, 1492, 1699, 1665, 1701, 1680, 1703, 1670, 1514, + /* 420 */ 1520, 1526, 1719, 1721, 1724, 1543, 1547, 1729, 1731, 1686, + /* 430 */ 1734, 1736, 1738, 1697, 1741, 1745, 1746, 1755, 1756, 1757, + /* 440 */ 1767, 1768, 1604, 1725, 1761, 1607, 1763, 1764, 1765, 1769, + /* 450 */ 1771, 1772, 1779, 1781, 1782, 1783, 1784, 1787, 1788, 1790, + /* 460 */ 1791, 1792, 1753, 1796, 1797, 1800, 1802, 1803, 1804, 1785, + /* 470 */ 1805, 1806, 1808, 1672, 1809, 1812, 1793, 1717, 1798, 1723, + /* 480 */ 1821, 1766, 1794, 1822, 1770, 1823, 1774, 1825, 1827, 1807, + /* 490 */ 1811, 1801, 1789, 1833, 1799, 1838, 1810, 1835, 1813, 1815, + /* 500 */ 1855, 1860, 1861, 1824, 1687, 1865, 1867, 1868, 1814, 1877, + /* 510 */ 1880, 1846, 1834, 1844, 1884, 1850, 1840, 1847, 1889, 1858, + /* 520 */ 1854, 1864, 1904, 1871, 1862, 1870, 1911, 1912, 1917, 1918, + /* 530 */ 1816, 1819, 1879, 1893, 1919, 1885, 1887, 1892, 1894, 1886, + /* 540 */ 1888, 1896, 1899, 1906, 1900, 1933, 1915, 1938, 1920, 1901, + /* 550 */ 1939, 1927, 1932, 1953, 1934, 1954, 1936, 1955, 1946, 1956, + /* 560 */ 1940, 1942, 1943, 1872, 1881, 1979, 1817, 1883, 1945, 1984, + /* 570 */ 1828, 1964, 1820, 1826, 1990, 1992, 1829, 1818, 1991, 1951, + /* 580 */ 1747, 1902, 1897, 1903, 1923, 1916, 1924, 1921, 1930, 1977, + /* 590 */ 1980, 1935, 1937, 1950, 1952, 1957, 1989, 1987, 2004, 1959, + /* 600 */ 1994, 1830, 1960, 1961, 2051, 2013, 1848, 2025, 2028, 2030, + /* 610 */ 2031, 2032, 2033, 1969, 1971, 2026, 1831, 2035, 2029, 2075, + /* 620 */ 2077, 2080, 2081, 1985, 2047, 1789, 2050, 1999, 2001, 2002, + /* 630 */ 2005, 2015, 1948, 2016, 2113, 2078, 1965, 2020, 2011, 1789, + /* 640 */ 2086, 2091, 2039, 1890, 2042, 2139, 2120, 1931, 2044, 2045, + /* 650 */ 2048, 2049, 2053, 2054, 2098, 2056, 2057, 2102, 2058, 2129, + /* 660 */ 1944, 2060, 2055, 2061, 2126, 2130, 2064, 2067, 2134, 2070, + /* 670 */ 2071, 2138, 2082, 2084, 2149, 2088, 2085, 2154, 2099, 2079, + /* 680 */ 2087, 2089, 2092, 2176, 2093, 2100, 2157, 2103, 2171, 2107, + /* 690 */ 2157, 2157, 2186, 2151, 2150, 2182, 2183, 2184, 2185, 2187, + /* 700 */ 2188, 2189, 2190, 2192, 2195, 2160, 2140, 2191, 2199, 2201, + /* 710 */ 2202, 2210, 2203, 2204, 2206, 2172, 1886, 2207, 1888, 2211, + /* 720 */ 2218, 2220, 2221, 2236, 2224, 2260, 2228, 2225, 2233, 2274, + /* 730 */ 2241, 2231, 2242, 2280, 2247, 2235, 2245, 2285, 2252, 2240, + /* 740 */ 2250, 2290, 2257, 2261, 2295, 2275, 2277, 2278, 2279, 2281, + /* 750 */ 2283, }; -#define YY_REDUCE_COUNT (304) -#define YY_REDUCE_MIN (-438) -#define YY_REDUCE_MAX (2328) +#define YY_REDUCE_COUNT (306) +#define YY_REDUCE_MIN (-435) +#define YY_REDUCE_MAX (2246) static const short yy_reduce_ofst[] = { - /* 0 */ -256, 679, 728, 795, 827, 876, 935, 969, 1042, 1091, - /* 10 */ 1155, 1223, 243, 1253, 1283, -294, -1, 1313, 1374, 1347, - /* 20 */ 1423, 1485, 1517, 1566, 1583, 1640, 1615, 1664, 1689, 1752, - /* 30 */ 1779, 1801, 1881, 1898, 1915, 1947, 1972, 1996, 2021, 2084, - /* 40 */ 2111, 2133, 2213, 2230, 2247, 2279, 2304, 2328, -264, 169, - /* 50 */ 171, -173, -350, 604, 736, 863, -336, -5, -323, -61, - /* 60 */ 709, 303, 727, 753, -438, -386, -180, -212, 68, 98, - /* 70 */ -377, -331, -327, -344, -307, -199, -7, 71, 197, 200, - /* 80 */ 268, 270, 309, 411, -154, 551, 561, 13, -324, 653, - /* 90 */ 654, 414, 675, 97, 676, 213, 718, 238, 311, 666, - /* 100 */ 674, 472, 782, 415, 560, 754, 770, -105, -288, -93, - /* 110 */ -93, -75, -272, -187, 77, 308, 336, 354, 359, 382, - /* 120 */ 410, 447, 518, 521, 564, 585, 663, 690, 691, 694, - /* 130 */ 695, 711, -342, -41, -206, 124, 516, -41, 274, 333, - /* 140 */ 117, -23, 41, 483, 230, 487, 547, 257, 434, 269, - /* 150 */ 466, 50, 387, 519, 665, 706, 537, -354, 325, 417, - /* 160 */ 455, 492, 550, 555, 492, 598, 755, 756, 805, 783, - /* 170 */ 799, 924, 817, 906, 906, 939, 896, 950, 930, 926, - /* 180 */ 878, 878, 865, 878, 890, 889, 906, 928, 931, 941, - /* 190 */ 961, 971, 972, 978, 1024, 1025, 983, 988, 989, 1031, - /* 200 */ 1027, 1033, 1037, 1039, 1048, 1055, 994, 1046, 1021, 1054, - /* 210 */ 1065, 1013, 1062, 1069, 1073, 1075, 1076, 1086, 1079, 1072, - /* 220 */ 1074, 1093, 1061, 1066, 1067, 1068, 1070, 1080, 1081, 1082, - /* 230 */ 1083, 1087, 1088, 1094, 1098, 1052, 1059, 1060, 1032, 1038, - /* 240 */ 1045, 1097, 1063, 1095, 1111, 1125, 1096, 1100, 1101, 1022, - /* 250 */ 1099, 1102, 1026, 1103, 1104, 1105, 906, 1035, 1040, 1041, - /* 260 */ 1044, 1047, 1050, 1107, 1034, 1058, 1053, 878, 1142, 1109, - /* 270 */ 1180, 1184, 1183, 1185, 1141, 1144, 1156, 1160, 1161, 1162, - /* 280 */ 1163, 1149, 1165, 1154, 1199, 1189, 1200, 1174, 1116, 1191, - /* 290 */ 1178, 1198, 1210, 1208, 1222, 1225, 1166, 1153, 1168, 1192, - /* 300 */ 1204, 1206, 1211, 1230, 1247, + /* 0 */ -258, -328, 50, 248, 613, 758, 807, 866, 889, 467, + /* 10 */ 967, 1026, 1049, 1131, 1180, 1203, 365, 1275, 1298, 1332, + /* 20 */ 1358, 1422, 643, 1454, 1479, 1544, 1528, 1593, 1610, 1627, + /* 30 */ 1676, 1692, 1710, 1759, 1775, 1832, 1849, 1898, 1914, 1963, + /* 40 */ 1988, 2012, 2083, 2105, 2132, 2181, 2197, 2246, -316, -302, + /* 50 */ -53, 247, -256, -6, 358, 695, 504, 556, -337, 210, + /* 60 */ 525, -435, -345, -29, 300, 302, -356, -352, -260, -60, + /* 70 */ -334, -333, -203, -348, -271, -179, -1, 318, 354, 414, + /* 80 */ 454, 458, 461, 633, -3, 645, 671, 64, -299, 435, + /* 90 */ 684, 209, 699, 291, 672, 372, 787, 450, -355, 790, + /* 100 */ 826, 430, 828, 415, 526, 472, 856, 121, -257, -54, + /* 110 */ -54, -275, -237, -163, -90, 142, 143, 381, 465, 473, + /* 120 */ 549, 550, 574, 602, 604, 647, 660, 668, 710, 736, + /* 130 */ 743, 754, -280, 311, -153, 18, 548, 311, 338, 508, + /* 140 */ 118, 608, 640, 131, 308, 711, 712, -36, 726, 487, + /* 150 */ 760, 780, 759, 795, 816, 839, 738, -358, 259, 264, + /* 160 */ 343, 348, 512, 617, 348, 687, 657, 656, 734, 689, + /* 170 */ 705, 853, 806, 927, 927, 951, 907, 958, 956, 942, + /* 180 */ 895, 895, 879, 895, 934, 896, 927, 961, 968, 990, + /* 190 */ 1008, 1010, 1020, 1028, 1075, 1076, 1032, 1035, 1036, 1073, + /* 200 */ 1077, 1088, 1083, 1093, 1094, 1097, 1106, 1107, 1044, 1105, + /* 210 */ 1072, 1109, 1116, 1066, 1125, 1132, 1128, 1129, 1130, 1137, + /* 220 */ 1136, 1143, 1145, 1156, 1127, 1133, 1141, 1148, 1149, 1152, + /* 230 */ 1153, 1154, 1157, 1158, 1159, 1160, 1163, 1115, 1117, 1123, + /* 240 */ 1091, 1099, 1103, 1164, 1122, 1146, 1166, 1181, 1150, 1151, + /* 250 */ 1165, 1084, 1169, 1168, 1089, 1170, 1177, 1178, 927, 1087, + /* 260 */ 1113, 1120, 1108, 1138, 1126, 1167, 1102, 1112, 1144, 895, + /* 270 */ 1201, 1171, 1247, 1249, 1251, 1260, 1214, 1199, 1216, 1224, + /* 280 */ 1228, 1231, 1239, 1236, 1253, 1223, 1274, 1271, 1289, 1261, + /* 290 */ 1204, 1269, 1263, 1284, 1305, 1299, 1311, 1313, 1252, 1244, + /* 300 */ 1256, 1257, 1295, 1315, 1316, 1312, 1326, }; static const YYACTIONTYPE yy_default[] = { - /* 0 */ 1665, 1665, 1665, 1665, 1665, 1665, 1665, 1665, 1665, 1665, - /* 10 */ 1665, 1665, 1665, 1665, 1665, 1665, 1665, 1665, 1665, 1665, - /* 20 */ 1665, 1665, 1665, 1665, 1665, 1665, 1665, 1665, 1665, 1665, - /* 30 */ 1665, 1665, 1665, 1665, 1665, 1665, 1665, 1665, 1665, 1665, - /* 40 */ 1665, 1665, 1665, 1665, 1665, 1665, 1665, 1665, 1665, 1665, - /* 50 */ 1665, 1665, 1665, 1665, 1665, 1665, 1665, 1665, 1665, 1665, - /* 60 */ 1665, 1665, 1665, 1665, 1665, 1665, 1665, 1665, 1665, 1665, - /* 70 */ 1665, 1665, 1665, 1923, 1665, 1665, 1665, 1665, 1665, 1665, - /* 80 */ 1665, 1665, 1665, 1665, 1665, 1665, 1665, 1744, 1665, 1665, - /* 90 */ 1665, 1665, 1665, 1665, 1665, 1665, 1665, 1665, 1665, 1665, - /* 100 */ 1665, 1665, 1665, 1665, 1665, 1665, 1665, 1742, 1916, 2132, - /* 110 */ 1665, 1665, 1665, 1665, 1665, 1665, 1665, 1665, 1665, 1665, - /* 120 */ 1665, 1665, 1665, 1665, 1665, 1665, 1665, 1665, 1665, 1665, - /* 130 */ 1665, 1665, 1665, 2144, 1665, 1665, 1665, 2144, 2144, 2144, - /* 140 */ 1742, 2104, 2104, 1665, 1665, 1665, 1665, 1744, 1977, 1665, - /* 150 */ 1665, 1665, 1665, 1665, 1665, 1851, 1665, 1665, 1665, 1665, - /* 160 */ 1665, 1875, 1665, 1665, 1665, 1969, 1665, 1665, 2169, 2225, - /* 170 */ 1665, 1665, 2172, 1665, 1665, 1665, 1928, 1665, 1804, 2159, - /* 180 */ 2136, 2150, 2209, 2137, 2134, 2153, 1665, 2163, 1665, 1962, - /* 190 */ 1921, 1665, 1921, 1918, 1665, 1665, 1921, 1918, 1918, 1665, - /* 200 */ 1795, 1665, 1665, 1665, 1665, 1665, 1665, 1744, 1665, 1744, - /* 210 */ 1665, 1665, 1744, 1665, 1744, 1744, 1744, 1665, 1744, 1722, - /* 220 */ 1722, 1665, 1665, 1665, 1665, 1665, 1665, 1665, 1665, 1665, - /* 230 */ 1665, 1665, 1665, 1665, 1665, 1665, 1665, 1665, 1989, 1975, - /* 240 */ 1665, 1742, 1971, 1665, 1742, 1665, 1665, 1665, 1665, 2180, - /* 250 */ 2178, 1665, 2180, 2178, 1665, 1665, 1665, 2194, 2190, 2180, - /* 260 */ 2198, 2196, 2165, 2163, 2228, 2215, 2211, 2150, 1665, 1665, - /* 270 */ 1665, 1665, 1742, 1742, 1665, 2178, 1665, 1665, 1665, 1665, - /* 280 */ 1665, 2178, 1665, 1665, 1742, 1665, 1742, 1665, 1665, 1820, - /* 290 */ 1665, 1665, 1665, 1742, 1697, 1665, 1964, 1980, 1946, 1946, - /* 300 */ 1854, 1854, 1854, 1745, 1670, 1665, 1665, 1665, 1665, 1665, - /* 310 */ 1665, 1665, 1665, 1665, 1665, 1665, 1665, 2193, 2192, 2059, - /* 320 */ 1665, 2108, 2107, 2106, 2097, 2058, 1816, 1665, 2057, 2056, - /* 330 */ 1665, 1665, 1665, 1665, 1665, 1665, 1937, 1936, 2050, 1665, - /* 340 */ 1665, 2051, 2049, 2048, 1665, 1665, 1665, 1665, 1665, 1665, - /* 350 */ 1665, 1665, 1665, 1665, 1665, 1665, 1665, 1665, 1665, 1665, - /* 360 */ 1665, 1665, 1665, 1665, 1665, 2212, 2216, 1665, 1665, 1665, - /* 370 */ 1665, 1665, 1665, 1665, 2133, 1665, 1665, 1665, 1665, 1665, - /* 380 */ 2032, 1665, 1665, 1665, 1665, 1665, 1665, 1665, 1665, 1665, - /* 390 */ 1665, 1665, 1665, 1665, 1665, 1665, 1665, 1665, 1665, 1665, - /* 400 */ 1665, 1665, 1665, 1665, 1665, 1665, 1665, 1665, 1665, 1665, - /* 410 */ 1665, 1665, 1665, 1665, 1665, 1665, 1665, 1665, 1665, 1665, - /* 420 */ 1665, 1665, 1665, 1665, 1665, 1665, 1665, 1665, 1665, 1665, - /* 430 */ 1665, 1665, 1665, 1665, 1665, 1665, 1665, 1665, 1665, 1665, - /* 440 */ 1665, 1665, 1665, 1665, 1665, 1665, 1665, 1665, 1665, 1665, - /* 450 */ 1665, 1665, 1665, 1665, 1665, 1665, 1665, 1665, 1665, 1665, - /* 460 */ 1665, 1665, 1665, 1665, 1665, 1665, 1665, 1665, 1665, 1665, - /* 470 */ 1665, 1665, 1665, 1665, 1665, 1665, 1665, 1665, 1665, 1665, - /* 480 */ 1665, 1665, 1665, 1702, 2037, 1665, 1665, 1665, 1665, 1665, - /* 490 */ 1665, 1665, 1665, 1665, 1665, 1665, 1665, 1665, 1665, 1665, - /* 500 */ 1665, 1665, 1665, 1665, 1665, 1665, 1665, 1665, 1665, 1665, - /* 510 */ 1665, 1665, 1665, 1665, 1665, 1665, 1665, 1665, 1665, 1665, - /* 520 */ 1665, 1665, 1665, 1665, 1665, 1665, 1665, 1665, 1665, 1665, - /* 530 */ 1665, 1783, 1782, 1665, 1665, 1665, 1665, 1665, 1665, 1665, - /* 540 */ 1665, 1665, 1665, 1665, 1665, 1665, 1665, 1665, 1665, 1665, - /* 550 */ 1665, 1665, 1665, 1665, 1665, 2041, 1665, 1665, 1665, 1665, - /* 560 */ 1665, 1665, 1665, 1665, 1665, 1665, 1665, 1665, 1665, 1665, - /* 570 */ 2208, 2166, 1665, 1665, 1665, 1665, 1665, 1665, 1665, 1665, - /* 580 */ 1665, 1665, 1665, 1665, 1665, 1665, 1665, 1665, 1665, 1665, - /* 590 */ 2032, 1665, 2191, 1665, 1665, 2206, 1665, 2210, 1665, 1665, - /* 600 */ 1665, 1665, 1665, 1665, 1665, 2143, 2139, 1665, 1665, 2135, - /* 610 */ 1665, 1665, 1665, 1665, 1665, 1665, 1665, 2040, 1665, 1665, - /* 620 */ 1665, 1665, 1665, 1665, 1665, 1665, 1665, 1665, 1665, 1665, - /* 630 */ 1665, 2031, 1665, 2094, 1665, 1665, 1665, 2128, 1665, 1665, - /* 640 */ 2079, 1665, 1665, 1665, 1665, 1665, 1665, 1665, 1665, 1665, - /* 650 */ 2041, 1665, 2044, 1665, 1665, 1665, 1665, 1665, 1848, 1665, - /* 660 */ 1665, 1665, 1665, 1665, 1665, 1665, 1665, 1665, 1665, 1665, - /* 670 */ 1665, 1833, 1831, 1830, 1829, 1665, 1826, 1665, 1861, 1665, - /* 680 */ 1665, 1665, 1857, 1856, 1665, 1665, 1665, 1665, 1665, 1665, - /* 690 */ 1665, 1665, 1665, 1665, 1665, 1665, 1665, 1665, 1665, 1763, - /* 700 */ 1665, 1665, 1665, 1665, 1665, 1665, 1665, 1665, 1755, 1665, - /* 710 */ 1754, 1665, 1665, 1665, 1665, 1665, 1665, 1665, 1665, 1665, - /* 720 */ 1665, 1665, 1665, 1665, 1665, 1665, 1665, 1665, 1665, 1665, - /* 730 */ 1665, 1665, 1665, 1665, 1665, 1665, 1665, 1665, 1665, 1665, - /* 740 */ 1665, 1665, 1665, + /* 0 */ 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, + /* 10 */ 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, + /* 20 */ 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, + /* 30 */ 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, + /* 40 */ 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, + /* 50 */ 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, + /* 60 */ 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, + /* 70 */ 1687, 1687, 1687, 1953, 1687, 1687, 1687, 1687, 1687, 1687, + /* 80 */ 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1766, 1687, 1687, + /* 90 */ 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, + /* 100 */ 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1764, 1946, 2162, + /* 110 */ 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, + /* 120 */ 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, + /* 130 */ 1687, 1687, 1687, 2174, 1687, 1687, 1687, 2174, 2174, 2174, + /* 140 */ 1764, 2134, 2134, 1687, 1687, 1687, 1687, 1766, 2007, 1687, + /* 150 */ 1687, 1687, 1687, 1687, 1687, 1881, 1687, 1687, 1687, 1687, + /* 160 */ 1687, 1905, 1687, 1687, 1687, 1999, 1687, 1687, 2199, 2255, + /* 170 */ 1687, 1687, 2202, 1687, 1687, 1687, 1958, 1687, 1834, 2189, + /* 180 */ 2166, 2180, 2239, 2167, 2164, 2183, 1687, 2193, 1687, 1992, + /* 190 */ 1951, 1687, 1951, 1948, 1687, 1687, 1951, 1948, 1948, 1823, + /* 200 */ 1819, 1687, 1817, 1687, 1687, 1687, 1687, 1687, 1687, 1766, + /* 210 */ 1687, 1766, 1687, 1687, 1766, 1687, 1766, 1766, 1766, 1687, + /* 220 */ 1766, 1744, 1744, 1687, 1687, 1687, 1687, 1687, 1687, 1687, + /* 230 */ 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, + /* 240 */ 2019, 2005, 1687, 1764, 2001, 1687, 1764, 1687, 1687, 1687, + /* 250 */ 1687, 2210, 2208, 1687, 2210, 2208, 1687, 1687, 1687, 2224, + /* 260 */ 2220, 2210, 2228, 2226, 2195, 2193, 2258, 2245, 2241, 2180, + /* 270 */ 1687, 1687, 1687, 1687, 1764, 1764, 1687, 2208, 1687, 1687, + /* 280 */ 1687, 1687, 1687, 2208, 1687, 1687, 1764, 1687, 1764, 1687, + /* 290 */ 1687, 1850, 1687, 1687, 1687, 1764, 1719, 1687, 1994, 2010, + /* 300 */ 1976, 1976, 1884, 1884, 1884, 1767, 1692, 1687, 1687, 1687, + /* 310 */ 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 2223, + /* 320 */ 2222, 2089, 1687, 2138, 2137, 2136, 2127, 2088, 1846, 1687, + /* 330 */ 2087, 2086, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, + /* 340 */ 1967, 1966, 2080, 1687, 1687, 2081, 2079, 2078, 1687, 1687, + /* 350 */ 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, + /* 360 */ 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 2242, + /* 370 */ 2246, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 2163, 1687, + /* 380 */ 1687, 1687, 1687, 1687, 2062, 1687, 1687, 1687, 1687, 1687, + /* 390 */ 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, + /* 400 */ 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, + /* 410 */ 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, + /* 420 */ 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, + /* 430 */ 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, + /* 440 */ 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, + /* 450 */ 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, + /* 460 */ 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, + /* 470 */ 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, + /* 480 */ 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, + /* 490 */ 1687, 1724, 2067, 1687, 1687, 1687, 1687, 1687, 1687, 1687, + /* 500 */ 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, + /* 510 */ 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, + /* 520 */ 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, + /* 530 */ 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1805, + /* 540 */ 1804, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, + /* 550 */ 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, + /* 560 */ 1687, 1687, 1687, 2071, 1687, 1687, 1687, 1687, 1687, 1687, + /* 570 */ 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 2238, 2196, + /* 580 */ 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, + /* 590 */ 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 2062, 1687, + /* 600 */ 2221, 1687, 1687, 2236, 1687, 2240, 1687, 1687, 1687, 1687, + /* 610 */ 1687, 1687, 1687, 2173, 2169, 1687, 1687, 2165, 1687, 1687, + /* 620 */ 1687, 1687, 1687, 1687, 1687, 2070, 1687, 1687, 1687, 1687, + /* 630 */ 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 2061, + /* 640 */ 1687, 2124, 1687, 1687, 1687, 2158, 1687, 1687, 2109, 1687, + /* 650 */ 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 2071, 1687, + /* 660 */ 2074, 1687, 1687, 1687, 1687, 1687, 1878, 1687, 1687, 1687, + /* 670 */ 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1863, + /* 680 */ 1861, 1860, 1859, 1687, 1856, 1687, 1891, 1687, 1687, 1687, + /* 690 */ 1887, 1886, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, + /* 700 */ 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1785, 1687, 1687, + /* 710 */ 1687, 1687, 1687, 1687, 1687, 1687, 1777, 1687, 1776, 1687, + /* 720 */ 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, + /* 730 */ 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, + /* 740 */ 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, 1687, + /* 750 */ 1687, }; /********** End of lemon-generated parsing tables *****************************/ @@ -1077,6 +1063,10 @@ static const YYCODETYPE yyFallback[] = { 0, /* TABLE_SUFFIX => nothing */ 0, /* NK_COLON => nothing */ 0, /* MAX_SPEED => nothing */ + 0, /* START => nothing */ + 0, /* WITH => nothing */ + 0, /* TIMESTAMP => nothing */ + 276, /* END => ABORT */ 0, /* TABLE => nothing */ 0, /* NK_LP => nothing */ 0, /* NK_RP => nothing */ @@ -1100,7 +1090,6 @@ static const YYCODETYPE yyFallback[] = { 0, /* FLOAT => nothing */ 0, /* DOUBLE => nothing */ 0, /* BINARY => nothing */ - 0, /* TIMESTAMP => nothing */ 0, /* NCHAR => nothing */ 0, /* UNSIGNED => nothing */ 0, /* JSON => nothing */ @@ -1154,7 +1143,6 @@ static const YYCODETYPE yyFallback[] = { 0, /* COUNT => nothing */ 0, /* LAST_ROW => nothing */ 0, /* TOPIC => nothing */ - 0, /* WITH => nothing */ 0, /* META => nothing */ 0, /* CONSUMER => nothing */ 0, /* GROUP => nothing */ @@ -1213,7 +1201,6 @@ static const YYCODETYPE yyFallback[] = { 0, /* SERVER_STATUS => nothing */ 0, /* CURRENT_USER => nothing */ 0, /* CASE => nothing */ - 276, /* END => ABORT */ 0, /* WHEN => nothing */ 0, /* THEN => nothing */ 0, /* ELSE => nothing */ @@ -1238,7 +1225,6 @@ static const YYCODETYPE yyFallback[] = { 0, /* SESSION => nothing */ 0, /* STATE_WINDOW => nothing */ 0, /* EVENT_WINDOW => nothing */ - 0, /* START => nothing */ 0, /* SLIDING => nothing */ 0, /* FILL => nothing */ 0, /* VALUE => nothing */ @@ -1492,168 +1478,168 @@ static const char *const yyTokenName[] = { /* 92 */ "TABLE_SUFFIX", /* 93 */ "NK_COLON", /* 94 */ "MAX_SPEED", - /* 95 */ "TABLE", - /* 96 */ "NK_LP", - /* 97 */ "NK_RP", - /* 98 */ "STABLE", - /* 99 */ "ADD", - /* 100 */ "COLUMN", - /* 101 */ "MODIFY", - /* 102 */ "RENAME", - /* 103 */ "TAG", - /* 104 */ "SET", - /* 105 */ "NK_EQ", - /* 106 */ "USING", - /* 107 */ "TAGS", - /* 108 */ "COMMENT", - /* 109 */ "BOOL", - /* 110 */ "TINYINT", - /* 111 */ "SMALLINT", - /* 112 */ "INT", - /* 113 */ "INTEGER", - /* 114 */ "BIGINT", - /* 115 */ "FLOAT", - /* 116 */ "DOUBLE", - /* 117 */ "BINARY", - /* 118 */ "TIMESTAMP", - /* 119 */ "NCHAR", - /* 120 */ "UNSIGNED", - /* 121 */ "JSON", - /* 122 */ "VARCHAR", - /* 123 */ "MEDIUMBLOB", - /* 124 */ "BLOB", - /* 125 */ "VARBINARY", - /* 126 */ "DECIMAL", - /* 127 */ "MAX_DELAY", - /* 128 */ "WATERMARK", - /* 129 */ "ROLLUP", - /* 130 */ "TTL", - /* 131 */ "SMA", - /* 132 */ "DELETE_MARK", - /* 133 */ "FIRST", - /* 134 */ "LAST", - /* 135 */ "SHOW", - /* 136 */ "PRIVILEGES", - /* 137 */ "DATABASES", - /* 138 */ "TABLES", - /* 139 */ "STABLES", - /* 140 */ "MNODES", - /* 141 */ "QNODES", - /* 142 */ "FUNCTIONS", - /* 143 */ "INDEXES", - /* 144 */ "ACCOUNTS", - /* 145 */ "APPS", - /* 146 */ "CONNECTIONS", - /* 147 */ "LICENCES", - /* 148 */ "GRANTS", - /* 149 */ "QUERIES", - /* 150 */ "SCORES", - /* 151 */ "TOPICS", - /* 152 */ "VARIABLES", - /* 153 */ "CLUSTER", - /* 154 */ "BNODES", - /* 155 */ "SNODES", - /* 156 */ "TRANSACTIONS", - /* 157 */ "DISTRIBUTED", - /* 158 */ "CONSUMERS", - /* 159 */ "SUBSCRIPTIONS", - /* 160 */ "VNODES", - /* 161 */ "ALIVE", - /* 162 */ "LIKE", - /* 163 */ "TBNAME", - /* 164 */ "QTAGS", - /* 165 */ "AS", - /* 166 */ "INDEX", - /* 167 */ "FUNCTION", - /* 168 */ "INTERVAL", - /* 169 */ "COUNT", - /* 170 */ "LAST_ROW", - /* 171 */ "TOPIC", - /* 172 */ "WITH", - /* 173 */ "META", - /* 174 */ "CONSUMER", - /* 175 */ "GROUP", - /* 176 */ "DESC", - /* 177 */ "DESCRIBE", - /* 178 */ "RESET", - /* 179 */ "QUERY", - /* 180 */ "CACHE", - /* 181 */ "EXPLAIN", - /* 182 */ "ANALYZE", - /* 183 */ "VERBOSE", - /* 184 */ "NK_BOOL", - /* 185 */ "RATIO", - /* 186 */ "NK_FLOAT", - /* 187 */ "OUTPUTTYPE", - /* 188 */ "AGGREGATE", - /* 189 */ "BUFSIZE", - /* 190 */ "STREAM", - /* 191 */ "INTO", - /* 192 */ "TRIGGER", - /* 193 */ "AT_ONCE", - /* 194 */ "WINDOW_CLOSE", - /* 195 */ "IGNORE", - /* 196 */ "EXPIRED", - /* 197 */ "FILL_HISTORY", - /* 198 */ "UPDATE", - /* 199 */ "SUBTABLE", - /* 200 */ "KILL", - /* 201 */ "CONNECTION", - /* 202 */ "TRANSACTION", - /* 203 */ "BALANCE", - /* 204 */ "VGROUP", - /* 205 */ "MERGE", - /* 206 */ "REDISTRIBUTE", - /* 207 */ "SPLIT", - /* 208 */ "DELETE", - /* 209 */ "INSERT", - /* 210 */ "NULL", - /* 211 */ "NK_QUESTION", - /* 212 */ "NK_ARROW", - /* 213 */ "ROWTS", - /* 214 */ "QSTART", - /* 215 */ "QEND", - /* 216 */ "QDURATION", - /* 217 */ "WSTART", - /* 218 */ "WEND", - /* 219 */ "WDURATION", - /* 220 */ "IROWTS", - /* 221 */ "ISFILLED", - /* 222 */ "CAST", - /* 223 */ "NOW", - /* 224 */ "TODAY", - /* 225 */ "TIMEZONE", - /* 226 */ "CLIENT_VERSION", - /* 227 */ "SERVER_VERSION", - /* 228 */ "SERVER_STATUS", - /* 229 */ "CURRENT_USER", - /* 230 */ "CASE", - /* 231 */ "END", - /* 232 */ "WHEN", - /* 233 */ "THEN", - /* 234 */ "ELSE", - /* 235 */ "BETWEEN", - /* 236 */ "IS", - /* 237 */ "NK_LT", - /* 238 */ "NK_GT", - /* 239 */ "NK_LE", - /* 240 */ "NK_GE", - /* 241 */ "NK_NE", - /* 242 */ "MATCH", - /* 243 */ "NMATCH", - /* 244 */ "CONTAINS", - /* 245 */ "IN", - /* 246 */ "JOIN", - /* 247 */ "INNER", - /* 248 */ "SELECT", - /* 249 */ "DISTINCT", - /* 250 */ "WHERE", - /* 251 */ "PARTITION", - /* 252 */ "BY", - /* 253 */ "SESSION", - /* 254 */ "STATE_WINDOW", - /* 255 */ "EVENT_WINDOW", - /* 256 */ "START", + /* 95 */ "START", + /* 96 */ "WITH", + /* 97 */ "TIMESTAMP", + /* 98 */ "END", + /* 99 */ "TABLE", + /* 100 */ "NK_LP", + /* 101 */ "NK_RP", + /* 102 */ "STABLE", + /* 103 */ "ADD", + /* 104 */ "COLUMN", + /* 105 */ "MODIFY", + /* 106 */ "RENAME", + /* 107 */ "TAG", + /* 108 */ "SET", + /* 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", + /* 130 */ "MAX_DELAY", + /* 131 */ "WATERMARK", + /* 132 */ "ROLLUP", + /* 133 */ "TTL", + /* 134 */ "SMA", + /* 135 */ "DELETE_MARK", + /* 136 */ "FIRST", + /* 137 */ "LAST", + /* 138 */ "SHOW", + /* 139 */ "PRIVILEGES", + /* 140 */ "DATABASES", + /* 141 */ "TABLES", + /* 142 */ "STABLES", + /* 143 */ "MNODES", + /* 144 */ "QNODES", + /* 145 */ "FUNCTIONS", + /* 146 */ "INDEXES", + /* 147 */ "ACCOUNTS", + /* 148 */ "APPS", + /* 149 */ "CONNECTIONS", + /* 150 */ "LICENCES", + /* 151 */ "GRANTS", + /* 152 */ "QUERIES", + /* 153 */ "SCORES", + /* 154 */ "TOPICS", + /* 155 */ "VARIABLES", + /* 156 */ "CLUSTER", + /* 157 */ "BNODES", + /* 158 */ "SNODES", + /* 159 */ "TRANSACTIONS", + /* 160 */ "DISTRIBUTED", + /* 161 */ "CONSUMERS", + /* 162 */ "SUBSCRIPTIONS", + /* 163 */ "VNODES", + /* 164 */ "ALIVE", + /* 165 */ "LIKE", + /* 166 */ "TBNAME", + /* 167 */ "QTAGS", + /* 168 */ "AS", + /* 169 */ "INDEX", + /* 170 */ "FUNCTION", + /* 171 */ "INTERVAL", + /* 172 */ "COUNT", + /* 173 */ "LAST_ROW", + /* 174 */ "TOPIC", + /* 175 */ "META", + /* 176 */ "CONSUMER", + /* 177 */ "GROUP", + /* 178 */ "DESC", + /* 179 */ "DESCRIBE", + /* 180 */ "RESET", + /* 181 */ "QUERY", + /* 182 */ "CACHE", + /* 183 */ "EXPLAIN", + /* 184 */ "ANALYZE", + /* 185 */ "VERBOSE", + /* 186 */ "NK_BOOL", + /* 187 */ "RATIO", + /* 188 */ "NK_FLOAT", + /* 189 */ "OUTPUTTYPE", + /* 190 */ "AGGREGATE", + /* 191 */ "BUFSIZE", + /* 192 */ "STREAM", + /* 193 */ "INTO", + /* 194 */ "TRIGGER", + /* 195 */ "AT_ONCE", + /* 196 */ "WINDOW_CLOSE", + /* 197 */ "IGNORE", + /* 198 */ "EXPIRED", + /* 199 */ "FILL_HISTORY", + /* 200 */ "UPDATE", + /* 201 */ "SUBTABLE", + /* 202 */ "KILL", + /* 203 */ "CONNECTION", + /* 204 */ "TRANSACTION", + /* 205 */ "BALANCE", + /* 206 */ "VGROUP", + /* 207 */ "MERGE", + /* 208 */ "REDISTRIBUTE", + /* 209 */ "SPLIT", + /* 210 */ "DELETE", + /* 211 */ "INSERT", + /* 212 */ "NULL", + /* 213 */ "NK_QUESTION", + /* 214 */ "NK_ARROW", + /* 215 */ "ROWTS", + /* 216 */ "QSTART", + /* 217 */ "QEND", + /* 218 */ "QDURATION", + /* 219 */ "WSTART", + /* 220 */ "WEND", + /* 221 */ "WDURATION", + /* 222 */ "IROWTS", + /* 223 */ "ISFILLED", + /* 224 */ "CAST", + /* 225 */ "NOW", + /* 226 */ "TODAY", + /* 227 */ "TIMEZONE", + /* 228 */ "CLIENT_VERSION", + /* 229 */ "SERVER_VERSION", + /* 230 */ "SERVER_STATUS", + /* 231 */ "CURRENT_USER", + /* 232 */ "CASE", + /* 233 */ "WHEN", + /* 234 */ "THEN", + /* 235 */ "ELSE", + /* 236 */ "BETWEEN", + /* 237 */ "IS", + /* 238 */ "NK_LT", + /* 239 */ "NK_GT", + /* 240 */ "NK_LE", + /* 241 */ "NK_GE", + /* 242 */ "NK_NE", + /* 243 */ "MATCH", + /* 244 */ "NMATCH", + /* 245 */ "CONTAINS", + /* 246 */ "IN", + /* 247 */ "JOIN", + /* 248 */ "INNER", + /* 249 */ "SELECT", + /* 250 */ "DISTINCT", + /* 251 */ "WHERE", + /* 252 */ "PARTITION", + /* 253 */ "BY", + /* 254 */ "SESSION", + /* 255 */ "STATE_WINDOW", + /* 256 */ "EVENT_WINDOW", /* 257 */ "SLIDING", /* 258 */ "FILL", /* 259 */ "VALUE", @@ -1745,127 +1731,129 @@ static const char *const yyTokenName[] = { /* 345 */ "exists_opt", /* 346 */ "alter_db_options", /* 347 */ "speed_opt", - /* 348 */ "integer_list", - /* 349 */ "variable_list", - /* 350 */ "retention_list", - /* 351 */ "alter_db_option", - /* 352 */ "retention", - /* 353 */ "full_table_name", - /* 354 */ "column_def_list", - /* 355 */ "tags_def_opt", - /* 356 */ "table_options", - /* 357 */ "multi_create_clause", - /* 358 */ "tags_def", - /* 359 */ "multi_drop_clause", - /* 360 */ "alter_table_clause", - /* 361 */ "alter_table_options", - /* 362 */ "column_name", - /* 363 */ "type_name", - /* 364 */ "signed_literal", - /* 365 */ "create_subtable_clause", - /* 366 */ "specific_cols_opt", - /* 367 */ "expression_list", - /* 368 */ "drop_table_clause", - /* 369 */ "col_name_list", - /* 370 */ "table_name", - /* 371 */ "column_def", - /* 372 */ "duration_list", - /* 373 */ "rollup_func_list", - /* 374 */ "alter_table_option", - /* 375 */ "duration_literal", - /* 376 */ "rollup_func_name", - /* 377 */ "function_name", - /* 378 */ "col_name", - /* 379 */ "db_name_cond_opt", - /* 380 */ "like_pattern_opt", - /* 381 */ "table_name_cond", - /* 382 */ "from_db_opt", - /* 383 */ "tag_list_opt", - /* 384 */ "tag_item", - /* 385 */ "column_alias", - /* 386 */ "full_index_name", - /* 387 */ "index_options", - /* 388 */ "index_name", - /* 389 */ "func_list", - /* 390 */ "sliding_opt", - /* 391 */ "sma_stream_opt", - /* 392 */ "func", - /* 393 */ "sma_func_name", - /* 394 */ "query_or_subquery", - /* 395 */ "cgroup_name", - /* 396 */ "analyze_opt", - /* 397 */ "explain_options", - /* 398 */ "insert_query", - /* 399 */ "agg_func_opt", - /* 400 */ "bufsize_opt", - /* 401 */ "stream_name", - /* 402 */ "stream_options", - /* 403 */ "col_list_opt", - /* 404 */ "tag_def_or_ref_opt", - /* 405 */ "subtable_opt", - /* 406 */ "expression", - /* 407 */ "dnode_list", - /* 408 */ "where_clause_opt", - /* 409 */ "signed", - /* 410 */ "literal_func", - /* 411 */ "literal_list", - /* 412 */ "table_alias", - /* 413 */ "expr_or_subquery", - /* 414 */ "pseudo_column", - /* 415 */ "column_reference", - /* 416 */ "function_expression", - /* 417 */ "case_when_expression", - /* 418 */ "star_func", - /* 419 */ "star_func_para_list", - /* 420 */ "noarg_func", - /* 421 */ "other_para_list", - /* 422 */ "star_func_para", - /* 423 */ "when_then_list", - /* 424 */ "case_when_else_opt", - /* 425 */ "common_expression", - /* 426 */ "when_then_expr", - /* 427 */ "predicate", - /* 428 */ "compare_op", - /* 429 */ "in_op", - /* 430 */ "in_predicate_value", - /* 431 */ "boolean_value_expression", - /* 432 */ "boolean_primary", - /* 433 */ "from_clause_opt", - /* 434 */ "table_reference_list", - /* 435 */ "table_reference", - /* 436 */ "table_primary", - /* 437 */ "joined_table", - /* 438 */ "alias_opt", - /* 439 */ "subquery", - /* 440 */ "parenthesized_joined_table", - /* 441 */ "join_type", - /* 442 */ "search_condition", - /* 443 */ "query_specification", - /* 444 */ "set_quantifier_opt", - /* 445 */ "select_list", - /* 446 */ "partition_by_clause_opt", - /* 447 */ "range_opt", - /* 448 */ "every_opt", - /* 449 */ "fill_opt", - /* 450 */ "twindow_clause_opt", - /* 451 */ "group_by_clause_opt", - /* 452 */ "having_clause_opt", - /* 453 */ "select_item", - /* 454 */ "partition_list", - /* 455 */ "partition_item", - /* 456 */ "fill_mode", - /* 457 */ "group_by_list", - /* 458 */ "query_expression", - /* 459 */ "query_simple", - /* 460 */ "order_by_clause_opt", - /* 461 */ "slimit_clause_opt", - /* 462 */ "limit_clause_opt", - /* 463 */ "union_query_expression", - /* 464 */ "query_simple_or_subquery", - /* 465 */ "sort_specification_list", - /* 466 */ "sort_specification", - /* 467 */ "ordering_specification_opt", - /* 468 */ "null_ordering_opt", + /* 348 */ "start_opt", + /* 349 */ "end_opt", + /* 350 */ "integer_list", + /* 351 */ "variable_list", + /* 352 */ "retention_list", + /* 353 */ "alter_db_option", + /* 354 */ "retention", + /* 355 */ "full_table_name", + /* 356 */ "column_def_list", + /* 357 */ "tags_def_opt", + /* 358 */ "table_options", + /* 359 */ "multi_create_clause", + /* 360 */ "tags_def", + /* 361 */ "multi_drop_clause", + /* 362 */ "alter_table_clause", + /* 363 */ "alter_table_options", + /* 364 */ "column_name", + /* 365 */ "type_name", + /* 366 */ "signed_literal", + /* 367 */ "create_subtable_clause", + /* 368 */ "specific_cols_opt", + /* 369 */ "expression_list", + /* 370 */ "drop_table_clause", + /* 371 */ "col_name_list", + /* 372 */ "table_name", + /* 373 */ "column_def", + /* 374 */ "duration_list", + /* 375 */ "rollup_func_list", + /* 376 */ "alter_table_option", + /* 377 */ "duration_literal", + /* 378 */ "rollup_func_name", + /* 379 */ "function_name", + /* 380 */ "col_name", + /* 381 */ "db_name_cond_opt", + /* 382 */ "like_pattern_opt", + /* 383 */ "table_name_cond", + /* 384 */ "from_db_opt", + /* 385 */ "tag_list_opt", + /* 386 */ "tag_item", + /* 387 */ "column_alias", + /* 388 */ "full_index_name", + /* 389 */ "index_options", + /* 390 */ "index_name", + /* 391 */ "func_list", + /* 392 */ "sliding_opt", + /* 393 */ "sma_stream_opt", + /* 394 */ "func", + /* 395 */ "sma_func_name", + /* 396 */ "query_or_subquery", + /* 397 */ "cgroup_name", + /* 398 */ "analyze_opt", + /* 399 */ "explain_options", + /* 400 */ "insert_query", + /* 401 */ "agg_func_opt", + /* 402 */ "bufsize_opt", + /* 403 */ "stream_name", + /* 404 */ "stream_options", + /* 405 */ "col_list_opt", + /* 406 */ "tag_def_or_ref_opt", + /* 407 */ "subtable_opt", + /* 408 */ "expression", + /* 409 */ "dnode_list", + /* 410 */ "where_clause_opt", + /* 411 */ "signed", + /* 412 */ "literal_func", + /* 413 */ "literal_list", + /* 414 */ "table_alias", + /* 415 */ "expr_or_subquery", + /* 416 */ "pseudo_column", + /* 417 */ "column_reference", + /* 418 */ "function_expression", + /* 419 */ "case_when_expression", + /* 420 */ "star_func", + /* 421 */ "star_func_para_list", + /* 422 */ "noarg_func", + /* 423 */ "other_para_list", + /* 424 */ "star_func_para", + /* 425 */ "when_then_list", + /* 426 */ "case_when_else_opt", + /* 427 */ "common_expression", + /* 428 */ "when_then_expr", + /* 429 */ "predicate", + /* 430 */ "compare_op", + /* 431 */ "in_op", + /* 432 */ "in_predicate_value", + /* 433 */ "boolean_value_expression", + /* 434 */ "boolean_primary", + /* 435 */ "from_clause_opt", + /* 436 */ "table_reference_list", + /* 437 */ "table_reference", + /* 438 */ "table_primary", + /* 439 */ "joined_table", + /* 440 */ "alias_opt", + /* 441 */ "subquery", + /* 442 */ "parenthesized_joined_table", + /* 443 */ "join_type", + /* 444 */ "search_condition", + /* 445 */ "query_specification", + /* 446 */ "set_quantifier_opt", + /* 447 */ "select_list", + /* 448 */ "partition_by_clause_opt", + /* 449 */ "range_opt", + /* 450 */ "every_opt", + /* 451 */ "fill_opt", + /* 452 */ "twindow_clause_opt", + /* 453 */ "group_by_clause_opt", + /* 454 */ "having_clause_opt", + /* 455 */ "select_item", + /* 456 */ "partition_list", + /* 457 */ "partition_item", + /* 458 */ "fill_mode", + /* 459 */ "group_by_list", + /* 460 */ "query_expression", + /* 461 */ "query_simple", + /* 462 */ "order_by_clause_opt", + /* 463 */ "slimit_clause_opt", + /* 464 */ "limit_clause_opt", + /* 465 */ "union_query_expression", + /* 466 */ "query_simple_or_subquery", + /* 467 */ "sort_specification_list", + /* 468 */ "sort_specification", + /* 469 */ "ordering_specification_opt", + /* 470 */ "null_ordering_opt", }; #endif /* defined(YYCOVERAGE) || !defined(NDEBUG) */ @@ -1945,7 +1933,7 @@ static const char *const yyRuleName[] = { /* 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", + /* 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", @@ -2002,440 +1990,448 @@ static const char *const yyRuleName[] = { /* 126 */ "retention ::= NK_VARIABLE NK_COLON NK_VARIABLE", /* 127 */ "speed_opt ::=", /* 128 */ "speed_opt ::= MAX_SPEED NK_INTEGER", - /* 129 */ "cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options", - /* 130 */ "cmd ::= CREATE TABLE multi_create_clause", - /* 131 */ "cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options", - /* 132 */ "cmd ::= DROP TABLE multi_drop_clause", - /* 133 */ "cmd ::= DROP STABLE exists_opt full_table_name", - /* 134 */ "cmd ::= ALTER TABLE alter_table_clause", - /* 135 */ "cmd ::= ALTER STABLE alter_table_clause", - /* 136 */ "alter_table_clause ::= full_table_name alter_table_options", - /* 137 */ "alter_table_clause ::= full_table_name ADD COLUMN column_name type_name", - /* 138 */ "alter_table_clause ::= full_table_name DROP COLUMN column_name", - /* 139 */ "alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name", - /* 140 */ "alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name", - /* 141 */ "alter_table_clause ::= full_table_name ADD TAG column_name type_name", - /* 142 */ "alter_table_clause ::= full_table_name DROP TAG column_name", - /* 143 */ "alter_table_clause ::= full_table_name MODIFY TAG column_name type_name", - /* 144 */ "alter_table_clause ::= full_table_name RENAME TAG column_name column_name", - /* 145 */ "alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal", - /* 146 */ "multi_create_clause ::= create_subtable_clause", - /* 147 */ "multi_create_clause ::= multi_create_clause create_subtable_clause", - /* 148 */ "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", - /* 149 */ "multi_drop_clause ::= drop_table_clause", - /* 150 */ "multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause", - /* 151 */ "drop_table_clause ::= exists_opt full_table_name", - /* 152 */ "specific_cols_opt ::=", - /* 153 */ "specific_cols_opt ::= NK_LP col_name_list NK_RP", - /* 154 */ "full_table_name ::= table_name", - /* 155 */ "full_table_name ::= db_name NK_DOT table_name", - /* 156 */ "column_def_list ::= column_def", - /* 157 */ "column_def_list ::= column_def_list NK_COMMA column_def", - /* 158 */ "column_def ::= column_name type_name", - /* 159 */ "column_def ::= column_name type_name COMMENT NK_STRING", - /* 160 */ "type_name ::= BOOL", - /* 161 */ "type_name ::= TINYINT", - /* 162 */ "type_name ::= SMALLINT", - /* 163 */ "type_name ::= INT", - /* 164 */ "type_name ::= INTEGER", - /* 165 */ "type_name ::= BIGINT", - /* 166 */ "type_name ::= FLOAT", - /* 167 */ "type_name ::= DOUBLE", - /* 168 */ "type_name ::= BINARY NK_LP NK_INTEGER NK_RP", - /* 169 */ "type_name ::= TIMESTAMP", - /* 170 */ "type_name ::= NCHAR NK_LP NK_INTEGER NK_RP", - /* 171 */ "type_name ::= TINYINT UNSIGNED", - /* 172 */ "type_name ::= SMALLINT UNSIGNED", - /* 173 */ "type_name ::= INT UNSIGNED", - /* 174 */ "type_name ::= BIGINT UNSIGNED", - /* 175 */ "type_name ::= JSON", - /* 176 */ "type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP", - /* 177 */ "type_name ::= MEDIUMBLOB", - /* 178 */ "type_name ::= BLOB", - /* 179 */ "type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP", - /* 180 */ "type_name ::= DECIMAL", - /* 181 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP", - /* 182 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP", - /* 183 */ "tags_def_opt ::=", - /* 184 */ "tags_def_opt ::= tags_def", - /* 185 */ "tags_def ::= TAGS NK_LP column_def_list NK_RP", - /* 186 */ "table_options ::=", - /* 187 */ "table_options ::= table_options COMMENT NK_STRING", - /* 188 */ "table_options ::= table_options MAX_DELAY duration_list", - /* 189 */ "table_options ::= table_options WATERMARK duration_list", - /* 190 */ "table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP", - /* 191 */ "table_options ::= table_options TTL NK_INTEGER", - /* 192 */ "table_options ::= table_options SMA NK_LP col_name_list NK_RP", - /* 193 */ "table_options ::= table_options DELETE_MARK duration_list", - /* 194 */ "alter_table_options ::= alter_table_option", - /* 195 */ "alter_table_options ::= alter_table_options alter_table_option", - /* 196 */ "alter_table_option ::= COMMENT NK_STRING", - /* 197 */ "alter_table_option ::= TTL NK_INTEGER", - /* 198 */ "duration_list ::= duration_literal", - /* 199 */ "duration_list ::= duration_list NK_COMMA duration_literal", - /* 200 */ "rollup_func_list ::= rollup_func_name", - /* 201 */ "rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name", - /* 202 */ "rollup_func_name ::= function_name", - /* 203 */ "rollup_func_name ::= FIRST", - /* 204 */ "rollup_func_name ::= LAST", - /* 205 */ "col_name_list ::= col_name", - /* 206 */ "col_name_list ::= col_name_list NK_COMMA col_name", - /* 207 */ "col_name ::= column_name", - /* 208 */ "cmd ::= SHOW DNODES", - /* 209 */ "cmd ::= SHOW USERS", - /* 210 */ "cmd ::= SHOW USER PRIVILEGES", - /* 211 */ "cmd ::= SHOW DATABASES", - /* 212 */ "cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt", - /* 213 */ "cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt", - /* 214 */ "cmd ::= SHOW db_name_cond_opt VGROUPS", - /* 215 */ "cmd ::= SHOW MNODES", - /* 216 */ "cmd ::= SHOW QNODES", - /* 217 */ "cmd ::= SHOW FUNCTIONS", - /* 218 */ "cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt", - /* 219 */ "cmd ::= SHOW STREAMS", - /* 220 */ "cmd ::= SHOW ACCOUNTS", - /* 221 */ "cmd ::= SHOW APPS", - /* 222 */ "cmd ::= SHOW CONNECTIONS", - /* 223 */ "cmd ::= SHOW LICENCES", - /* 224 */ "cmd ::= SHOW GRANTS", - /* 225 */ "cmd ::= SHOW CREATE DATABASE db_name", - /* 226 */ "cmd ::= SHOW CREATE TABLE full_table_name", - /* 227 */ "cmd ::= SHOW CREATE STABLE full_table_name", - /* 228 */ "cmd ::= SHOW QUERIES", - /* 229 */ "cmd ::= SHOW SCORES", - /* 230 */ "cmd ::= SHOW TOPICS", - /* 231 */ "cmd ::= SHOW VARIABLES", - /* 232 */ "cmd ::= SHOW CLUSTER VARIABLES", - /* 233 */ "cmd ::= SHOW LOCAL VARIABLES", - /* 234 */ "cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt", - /* 235 */ "cmd ::= SHOW BNODES", - /* 236 */ "cmd ::= SHOW SNODES", - /* 237 */ "cmd ::= SHOW CLUSTER", - /* 238 */ "cmd ::= SHOW TRANSACTIONS", - /* 239 */ "cmd ::= SHOW TABLE DISTRIBUTED full_table_name", - /* 240 */ "cmd ::= SHOW CONSUMERS", - /* 241 */ "cmd ::= SHOW SUBSCRIPTIONS", - /* 242 */ "cmd ::= SHOW TAGS FROM table_name_cond from_db_opt", - /* 243 */ "cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt", - /* 244 */ "cmd ::= SHOW VNODES NK_INTEGER", - /* 245 */ "cmd ::= SHOW VNODES NK_STRING", - /* 246 */ "cmd ::= SHOW db_name_cond_opt ALIVE", - /* 247 */ "cmd ::= SHOW CLUSTER ALIVE", - /* 248 */ "db_name_cond_opt ::=", - /* 249 */ "db_name_cond_opt ::= db_name NK_DOT", - /* 250 */ "like_pattern_opt ::=", - /* 251 */ "like_pattern_opt ::= LIKE NK_STRING", - /* 252 */ "table_name_cond ::= table_name", - /* 253 */ "from_db_opt ::=", - /* 254 */ "from_db_opt ::= FROM db_name", - /* 255 */ "tag_list_opt ::=", - /* 256 */ "tag_list_opt ::= tag_item", - /* 257 */ "tag_list_opt ::= tag_list_opt NK_COMMA tag_item", - /* 258 */ "tag_item ::= TBNAME", - /* 259 */ "tag_item ::= QTAGS", - /* 260 */ "tag_item ::= column_name", - /* 261 */ "tag_item ::= column_name column_alias", - /* 262 */ "tag_item ::= column_name AS column_alias", - /* 263 */ "cmd ::= CREATE SMA INDEX not_exists_opt full_index_name ON full_table_name index_options", - /* 264 */ "cmd ::= CREATE INDEX not_exists_opt full_index_name ON full_table_name NK_LP col_name_list NK_RP", - /* 265 */ "cmd ::= DROP INDEX exists_opt full_index_name", - /* 266 */ "full_index_name ::= index_name", - /* 267 */ "full_index_name ::= db_name NK_DOT index_name", - /* 268 */ "index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt", - /* 269 */ "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", - /* 270 */ "func_list ::= func", - /* 271 */ "func_list ::= func_list NK_COMMA func", - /* 272 */ "func ::= sma_func_name NK_LP expression_list NK_RP", - /* 273 */ "sma_func_name ::= function_name", - /* 274 */ "sma_func_name ::= COUNT", - /* 275 */ "sma_func_name ::= FIRST", - /* 276 */ "sma_func_name ::= LAST", - /* 277 */ "sma_func_name ::= LAST_ROW", - /* 278 */ "sma_stream_opt ::=", - /* 279 */ "sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal", - /* 280 */ "sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal", - /* 281 */ "sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal", - /* 282 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery", - /* 283 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name", - /* 284 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name", - /* 285 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name", - /* 286 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name", - /* 287 */ "cmd ::= DROP TOPIC exists_opt topic_name", - /* 288 */ "cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name", - /* 289 */ "cmd ::= DESC full_table_name", - /* 290 */ "cmd ::= DESCRIBE full_table_name", - /* 291 */ "cmd ::= RESET QUERY CACHE", - /* 292 */ "cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery", - /* 293 */ "cmd ::= EXPLAIN analyze_opt explain_options insert_query", - /* 294 */ "analyze_opt ::=", - /* 295 */ "analyze_opt ::= ANALYZE", - /* 296 */ "explain_options ::=", - /* 297 */ "explain_options ::= explain_options VERBOSE NK_BOOL", - /* 298 */ "explain_options ::= explain_options RATIO NK_FLOAT", - /* 299 */ "cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt", - /* 300 */ "cmd ::= DROP FUNCTION exists_opt function_name", - /* 301 */ "agg_func_opt ::=", - /* 302 */ "agg_func_opt ::= AGGREGATE", - /* 303 */ "bufsize_opt ::=", - /* 304 */ "bufsize_opt ::= BUFSIZE NK_INTEGER", - /* 305 */ "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", - /* 306 */ "cmd ::= DROP STREAM exists_opt stream_name", - /* 307 */ "col_list_opt ::=", - /* 308 */ "col_list_opt ::= NK_LP col_name_list NK_RP", - /* 309 */ "tag_def_or_ref_opt ::=", - /* 310 */ "tag_def_or_ref_opt ::= tags_def", - /* 311 */ "tag_def_or_ref_opt ::= TAGS NK_LP col_name_list NK_RP", - /* 312 */ "stream_options ::=", - /* 313 */ "stream_options ::= stream_options TRIGGER AT_ONCE", - /* 314 */ "stream_options ::= stream_options TRIGGER WINDOW_CLOSE", - /* 315 */ "stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal", - /* 316 */ "stream_options ::= stream_options WATERMARK duration_literal", - /* 317 */ "stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER", - /* 318 */ "stream_options ::= stream_options FILL_HISTORY NK_INTEGER", - /* 319 */ "stream_options ::= stream_options DELETE_MARK duration_literal", - /* 320 */ "stream_options ::= stream_options IGNORE UPDATE NK_INTEGER", - /* 321 */ "subtable_opt ::=", - /* 322 */ "subtable_opt ::= SUBTABLE NK_LP expression NK_RP", - /* 323 */ "cmd ::= KILL CONNECTION NK_INTEGER", - /* 324 */ "cmd ::= KILL QUERY NK_STRING", - /* 325 */ "cmd ::= KILL TRANSACTION NK_INTEGER", - /* 326 */ "cmd ::= BALANCE VGROUP", - /* 327 */ "cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER", - /* 328 */ "cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list", - /* 329 */ "cmd ::= SPLIT VGROUP NK_INTEGER", - /* 330 */ "dnode_list ::= DNODE NK_INTEGER", - /* 331 */ "dnode_list ::= dnode_list DNODE NK_INTEGER", - /* 332 */ "cmd ::= DELETE FROM full_table_name where_clause_opt", - /* 333 */ "cmd ::= query_or_subquery", - /* 334 */ "cmd ::= insert_query", - /* 335 */ "insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery", - /* 336 */ "insert_query ::= INSERT INTO full_table_name query_or_subquery", - /* 337 */ "literal ::= NK_INTEGER", - /* 338 */ "literal ::= NK_FLOAT", - /* 339 */ "literal ::= NK_STRING", - /* 340 */ "literal ::= NK_BOOL", - /* 341 */ "literal ::= TIMESTAMP NK_STRING", - /* 342 */ "literal ::= duration_literal", - /* 343 */ "literal ::= NULL", - /* 344 */ "literal ::= NK_QUESTION", - /* 345 */ "duration_literal ::= NK_VARIABLE", - /* 346 */ "signed ::= NK_INTEGER", - /* 347 */ "signed ::= NK_PLUS NK_INTEGER", - /* 348 */ "signed ::= NK_MINUS NK_INTEGER", - /* 349 */ "signed ::= NK_FLOAT", - /* 350 */ "signed ::= NK_PLUS NK_FLOAT", - /* 351 */ "signed ::= NK_MINUS NK_FLOAT", - /* 352 */ "signed_literal ::= signed", - /* 353 */ "signed_literal ::= NK_STRING", - /* 354 */ "signed_literal ::= NK_BOOL", - /* 355 */ "signed_literal ::= TIMESTAMP NK_STRING", - /* 356 */ "signed_literal ::= duration_literal", - /* 357 */ "signed_literal ::= NULL", - /* 358 */ "signed_literal ::= literal_func", - /* 359 */ "signed_literal ::= NK_QUESTION", - /* 360 */ "literal_list ::= signed_literal", - /* 361 */ "literal_list ::= literal_list NK_COMMA signed_literal", - /* 362 */ "db_name ::= NK_ID", - /* 363 */ "table_name ::= NK_ID", - /* 364 */ "column_name ::= NK_ID", - /* 365 */ "function_name ::= NK_ID", - /* 366 */ "table_alias ::= NK_ID", - /* 367 */ "column_alias ::= NK_ID", - /* 368 */ "user_name ::= NK_ID", - /* 369 */ "topic_name ::= NK_ID", - /* 370 */ "stream_name ::= NK_ID", - /* 371 */ "cgroup_name ::= NK_ID", - /* 372 */ "index_name ::= NK_ID", - /* 373 */ "expr_or_subquery ::= expression", - /* 374 */ "expression ::= literal", - /* 375 */ "expression ::= pseudo_column", - /* 376 */ "expression ::= column_reference", - /* 377 */ "expression ::= function_expression", - /* 378 */ "expression ::= case_when_expression", - /* 379 */ "expression ::= NK_LP expression NK_RP", - /* 380 */ "expression ::= NK_PLUS expr_or_subquery", - /* 381 */ "expression ::= NK_MINUS expr_or_subquery", - /* 382 */ "expression ::= expr_or_subquery NK_PLUS expr_or_subquery", - /* 383 */ "expression ::= expr_or_subquery NK_MINUS expr_or_subquery", - /* 384 */ "expression ::= expr_or_subquery NK_STAR expr_or_subquery", - /* 385 */ "expression ::= expr_or_subquery NK_SLASH expr_or_subquery", - /* 386 */ "expression ::= expr_or_subquery NK_REM expr_or_subquery", - /* 387 */ "expression ::= column_reference NK_ARROW NK_STRING", - /* 388 */ "expression ::= expr_or_subquery NK_BITAND expr_or_subquery", - /* 389 */ "expression ::= expr_or_subquery NK_BITOR expr_or_subquery", - /* 390 */ "expression_list ::= expr_or_subquery", - /* 391 */ "expression_list ::= expression_list NK_COMMA expr_or_subquery", - /* 392 */ "column_reference ::= column_name", - /* 393 */ "column_reference ::= table_name NK_DOT column_name", - /* 394 */ "pseudo_column ::= ROWTS", - /* 395 */ "pseudo_column ::= TBNAME", - /* 396 */ "pseudo_column ::= table_name NK_DOT TBNAME", - /* 397 */ "pseudo_column ::= QSTART", - /* 398 */ "pseudo_column ::= QEND", - /* 399 */ "pseudo_column ::= QDURATION", - /* 400 */ "pseudo_column ::= WSTART", - /* 401 */ "pseudo_column ::= WEND", - /* 402 */ "pseudo_column ::= WDURATION", - /* 403 */ "pseudo_column ::= IROWTS", - /* 404 */ "pseudo_column ::= ISFILLED", - /* 405 */ "pseudo_column ::= QTAGS", - /* 406 */ "function_expression ::= function_name NK_LP expression_list NK_RP", - /* 407 */ "function_expression ::= star_func NK_LP star_func_para_list NK_RP", - /* 408 */ "function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP", - /* 409 */ "function_expression ::= literal_func", - /* 410 */ "literal_func ::= noarg_func NK_LP NK_RP", - /* 411 */ "literal_func ::= NOW", - /* 412 */ "noarg_func ::= NOW", - /* 413 */ "noarg_func ::= TODAY", - /* 414 */ "noarg_func ::= TIMEZONE", - /* 415 */ "noarg_func ::= DATABASE", - /* 416 */ "noarg_func ::= CLIENT_VERSION", - /* 417 */ "noarg_func ::= SERVER_VERSION", - /* 418 */ "noarg_func ::= SERVER_STATUS", - /* 419 */ "noarg_func ::= CURRENT_USER", - /* 420 */ "noarg_func ::= USER", - /* 421 */ "star_func ::= COUNT", - /* 422 */ "star_func ::= FIRST", - /* 423 */ "star_func ::= LAST", - /* 424 */ "star_func ::= LAST_ROW", - /* 425 */ "star_func_para_list ::= NK_STAR", - /* 426 */ "star_func_para_list ::= other_para_list", - /* 427 */ "other_para_list ::= star_func_para", - /* 428 */ "other_para_list ::= other_para_list NK_COMMA star_func_para", - /* 429 */ "star_func_para ::= expr_or_subquery", - /* 430 */ "star_func_para ::= table_name NK_DOT NK_STAR", - /* 431 */ "case_when_expression ::= CASE when_then_list case_when_else_opt END", - /* 432 */ "case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END", - /* 433 */ "when_then_list ::= when_then_expr", - /* 434 */ "when_then_list ::= when_then_list when_then_expr", - /* 435 */ "when_then_expr ::= WHEN common_expression THEN common_expression", - /* 436 */ "case_when_else_opt ::=", - /* 437 */ "case_when_else_opt ::= ELSE common_expression", - /* 438 */ "predicate ::= expr_or_subquery compare_op expr_or_subquery", - /* 439 */ "predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery", - /* 440 */ "predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery", - /* 441 */ "predicate ::= expr_or_subquery IS NULL", - /* 442 */ "predicate ::= expr_or_subquery IS NOT NULL", - /* 443 */ "predicate ::= expr_or_subquery in_op in_predicate_value", - /* 444 */ "compare_op ::= NK_LT", - /* 445 */ "compare_op ::= NK_GT", - /* 446 */ "compare_op ::= NK_LE", - /* 447 */ "compare_op ::= NK_GE", - /* 448 */ "compare_op ::= NK_NE", - /* 449 */ "compare_op ::= NK_EQ", - /* 450 */ "compare_op ::= LIKE", - /* 451 */ "compare_op ::= NOT LIKE", - /* 452 */ "compare_op ::= MATCH", - /* 453 */ "compare_op ::= NMATCH", - /* 454 */ "compare_op ::= CONTAINS", - /* 455 */ "in_op ::= IN", - /* 456 */ "in_op ::= NOT IN", - /* 457 */ "in_predicate_value ::= NK_LP literal_list NK_RP", - /* 458 */ "boolean_value_expression ::= boolean_primary", - /* 459 */ "boolean_value_expression ::= NOT boolean_primary", - /* 460 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression", - /* 461 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression", - /* 462 */ "boolean_primary ::= predicate", - /* 463 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP", - /* 464 */ "common_expression ::= expr_or_subquery", - /* 465 */ "common_expression ::= boolean_value_expression", - /* 466 */ "from_clause_opt ::=", - /* 467 */ "from_clause_opt ::= FROM table_reference_list", - /* 468 */ "table_reference_list ::= table_reference", - /* 469 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference", - /* 470 */ "table_reference ::= table_primary", - /* 471 */ "table_reference ::= joined_table", - /* 472 */ "table_primary ::= table_name alias_opt", - /* 473 */ "table_primary ::= db_name NK_DOT table_name alias_opt", - /* 474 */ "table_primary ::= subquery alias_opt", - /* 475 */ "table_primary ::= parenthesized_joined_table", - /* 476 */ "alias_opt ::=", - /* 477 */ "alias_opt ::= table_alias", - /* 478 */ "alias_opt ::= AS table_alias", - /* 479 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP", - /* 480 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP", - /* 481 */ "joined_table ::= table_reference join_type JOIN table_reference ON search_condition", - /* 482 */ "join_type ::=", - /* 483 */ "join_type ::= INNER", - /* 484 */ "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", - /* 485 */ "set_quantifier_opt ::=", - /* 486 */ "set_quantifier_opt ::= DISTINCT", - /* 487 */ "set_quantifier_opt ::= ALL", - /* 488 */ "select_list ::= select_item", - /* 489 */ "select_list ::= select_list NK_COMMA select_item", - /* 490 */ "select_item ::= NK_STAR", - /* 491 */ "select_item ::= common_expression", - /* 492 */ "select_item ::= common_expression column_alias", - /* 493 */ "select_item ::= common_expression AS column_alias", - /* 494 */ "select_item ::= table_name NK_DOT NK_STAR", - /* 495 */ "where_clause_opt ::=", - /* 496 */ "where_clause_opt ::= WHERE search_condition", - /* 497 */ "partition_by_clause_opt ::=", - /* 498 */ "partition_by_clause_opt ::= PARTITION BY partition_list", - /* 499 */ "partition_list ::= partition_item", - /* 500 */ "partition_list ::= partition_list NK_COMMA partition_item", - /* 501 */ "partition_item ::= expr_or_subquery", - /* 502 */ "partition_item ::= expr_or_subquery column_alias", - /* 503 */ "partition_item ::= expr_or_subquery AS column_alias", - /* 504 */ "twindow_clause_opt ::=", - /* 505 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP", - /* 506 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP", - /* 507 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt", - /* 508 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt", - /* 509 */ "twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition", - /* 510 */ "sliding_opt ::=", - /* 511 */ "sliding_opt ::= SLIDING NK_LP duration_literal NK_RP", - /* 512 */ "fill_opt ::=", - /* 513 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP", - /* 514 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP", - /* 515 */ "fill_opt ::= FILL NK_LP VALUE_F NK_COMMA literal_list NK_RP", - /* 516 */ "fill_mode ::= NONE", - /* 517 */ "fill_mode ::= PREV", - /* 518 */ "fill_mode ::= NULL", - /* 519 */ "fill_mode ::= NULL_F", - /* 520 */ "fill_mode ::= LINEAR", - /* 521 */ "fill_mode ::= NEXT", - /* 522 */ "group_by_clause_opt ::=", - /* 523 */ "group_by_clause_opt ::= GROUP BY group_by_list", - /* 524 */ "group_by_list ::= expr_or_subquery", - /* 525 */ "group_by_list ::= group_by_list NK_COMMA expr_or_subquery", - /* 526 */ "having_clause_opt ::=", - /* 527 */ "having_clause_opt ::= HAVING search_condition", - /* 528 */ "range_opt ::=", - /* 529 */ "range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP", - /* 530 */ "every_opt ::=", - /* 531 */ "every_opt ::= EVERY NK_LP duration_literal NK_RP", - /* 532 */ "query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt", - /* 533 */ "query_simple ::= query_specification", - /* 534 */ "query_simple ::= union_query_expression", - /* 535 */ "union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery", - /* 536 */ "union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery", - /* 537 */ "query_simple_or_subquery ::= query_simple", - /* 538 */ "query_simple_or_subquery ::= subquery", - /* 539 */ "query_or_subquery ::= query_expression", - /* 540 */ "query_or_subquery ::= subquery", - /* 541 */ "order_by_clause_opt ::=", - /* 542 */ "order_by_clause_opt ::= ORDER BY sort_specification_list", - /* 543 */ "slimit_clause_opt ::=", - /* 544 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER", - /* 545 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER", - /* 546 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER", - /* 547 */ "limit_clause_opt ::=", - /* 548 */ "limit_clause_opt ::= LIMIT NK_INTEGER", - /* 549 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER", - /* 550 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER", - /* 551 */ "subquery ::= NK_LP query_expression NK_RP", - /* 552 */ "subquery ::= NK_LP subquery NK_RP", - /* 553 */ "search_condition ::= common_expression", - /* 554 */ "sort_specification_list ::= sort_specification", - /* 555 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification", - /* 556 */ "sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt", - /* 557 */ "ordering_specification_opt ::=", - /* 558 */ "ordering_specification_opt ::= ASC", - /* 559 */ "ordering_specification_opt ::= DESC", - /* 560 */ "null_ordering_opt ::=", - /* 561 */ "null_ordering_opt ::= NULLS FIRST", - /* 562 */ "null_ordering_opt ::= NULLS LAST", + /* 129 */ "start_opt ::=", + /* 130 */ "start_opt ::= START WITH NK_INTEGER", + /* 131 */ "start_opt ::= START WITH NK_STRING", + /* 132 */ "start_opt ::= START WITH TIMESTAMP NK_STRING", + /* 133 */ "end_opt ::=", + /* 134 */ "end_opt ::= END WITH NK_INTEGER", + /* 135 */ "end_opt ::= END WITH NK_STRING", + /* 136 */ "end_opt ::= END WITH TIMESTAMP NK_STRING", + /* 137 */ "cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options", + /* 138 */ "cmd ::= CREATE TABLE multi_create_clause", + /* 139 */ "cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options", + /* 140 */ "cmd ::= DROP TABLE multi_drop_clause", + /* 141 */ "cmd ::= DROP STABLE exists_opt full_table_name", + /* 142 */ "cmd ::= ALTER TABLE alter_table_clause", + /* 143 */ "cmd ::= ALTER STABLE alter_table_clause", + /* 144 */ "alter_table_clause ::= full_table_name alter_table_options", + /* 145 */ "alter_table_clause ::= full_table_name ADD COLUMN column_name type_name", + /* 146 */ "alter_table_clause ::= full_table_name DROP COLUMN column_name", + /* 147 */ "alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name", + /* 148 */ "alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name", + /* 149 */ "alter_table_clause ::= full_table_name ADD TAG column_name type_name", + /* 150 */ "alter_table_clause ::= full_table_name DROP TAG column_name", + /* 151 */ "alter_table_clause ::= full_table_name MODIFY TAG column_name type_name", + /* 152 */ "alter_table_clause ::= full_table_name RENAME TAG column_name column_name", + /* 153 */ "alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal", + /* 154 */ "multi_create_clause ::= create_subtable_clause", + /* 155 */ "multi_create_clause ::= multi_create_clause create_subtable_clause", + /* 156 */ "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", + /* 157 */ "multi_drop_clause ::= drop_table_clause", + /* 158 */ "multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause", + /* 159 */ "drop_table_clause ::= exists_opt full_table_name", + /* 160 */ "specific_cols_opt ::=", + /* 161 */ "specific_cols_opt ::= NK_LP col_name_list NK_RP", + /* 162 */ "full_table_name ::= table_name", + /* 163 */ "full_table_name ::= db_name NK_DOT table_name", + /* 164 */ "column_def_list ::= column_def", + /* 165 */ "column_def_list ::= column_def_list NK_COMMA column_def", + /* 166 */ "column_def ::= column_name type_name", + /* 167 */ "column_def ::= column_name type_name COMMENT NK_STRING", + /* 168 */ "type_name ::= BOOL", + /* 169 */ "type_name ::= TINYINT", + /* 170 */ "type_name ::= SMALLINT", + /* 171 */ "type_name ::= INT", + /* 172 */ "type_name ::= INTEGER", + /* 173 */ "type_name ::= BIGINT", + /* 174 */ "type_name ::= FLOAT", + /* 175 */ "type_name ::= DOUBLE", + /* 176 */ "type_name ::= BINARY NK_LP NK_INTEGER NK_RP", + /* 177 */ "type_name ::= TIMESTAMP", + /* 178 */ "type_name ::= NCHAR NK_LP NK_INTEGER NK_RP", + /* 179 */ "type_name ::= TINYINT UNSIGNED", + /* 180 */ "type_name ::= SMALLINT UNSIGNED", + /* 181 */ "type_name ::= INT UNSIGNED", + /* 182 */ "type_name ::= BIGINT UNSIGNED", + /* 183 */ "type_name ::= JSON", + /* 184 */ "type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP", + /* 185 */ "type_name ::= MEDIUMBLOB", + /* 186 */ "type_name ::= BLOB", + /* 187 */ "type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP", + /* 188 */ "type_name ::= DECIMAL", + /* 189 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP", + /* 190 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP", + /* 191 */ "tags_def_opt ::=", + /* 192 */ "tags_def_opt ::= tags_def", + /* 193 */ "tags_def ::= TAGS NK_LP column_def_list NK_RP", + /* 194 */ "table_options ::=", + /* 195 */ "table_options ::= table_options COMMENT NK_STRING", + /* 196 */ "table_options ::= table_options MAX_DELAY duration_list", + /* 197 */ "table_options ::= table_options WATERMARK duration_list", + /* 198 */ "table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP", + /* 199 */ "table_options ::= table_options TTL NK_INTEGER", + /* 200 */ "table_options ::= table_options SMA NK_LP col_name_list NK_RP", + /* 201 */ "table_options ::= table_options DELETE_MARK duration_list", + /* 202 */ "alter_table_options ::= alter_table_option", + /* 203 */ "alter_table_options ::= alter_table_options alter_table_option", + /* 204 */ "alter_table_option ::= COMMENT NK_STRING", + /* 205 */ "alter_table_option ::= TTL NK_INTEGER", + /* 206 */ "duration_list ::= duration_literal", + /* 207 */ "duration_list ::= duration_list NK_COMMA duration_literal", + /* 208 */ "rollup_func_list ::= rollup_func_name", + /* 209 */ "rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name", + /* 210 */ "rollup_func_name ::= function_name", + /* 211 */ "rollup_func_name ::= FIRST", + /* 212 */ "rollup_func_name ::= LAST", + /* 213 */ "col_name_list ::= col_name", + /* 214 */ "col_name_list ::= col_name_list NK_COMMA col_name", + /* 215 */ "col_name ::= column_name", + /* 216 */ "cmd ::= SHOW DNODES", + /* 217 */ "cmd ::= SHOW USERS", + /* 218 */ "cmd ::= SHOW USER PRIVILEGES", + /* 219 */ "cmd ::= SHOW DATABASES", + /* 220 */ "cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt", + /* 221 */ "cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt", + /* 222 */ "cmd ::= SHOW db_name_cond_opt VGROUPS", + /* 223 */ "cmd ::= SHOW MNODES", + /* 224 */ "cmd ::= SHOW QNODES", + /* 225 */ "cmd ::= SHOW FUNCTIONS", + /* 226 */ "cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt", + /* 227 */ "cmd ::= SHOW STREAMS", + /* 228 */ "cmd ::= SHOW ACCOUNTS", + /* 229 */ "cmd ::= SHOW APPS", + /* 230 */ "cmd ::= SHOW CONNECTIONS", + /* 231 */ "cmd ::= SHOW LICENCES", + /* 232 */ "cmd ::= SHOW GRANTS", + /* 233 */ "cmd ::= SHOW CREATE DATABASE db_name", + /* 234 */ "cmd ::= SHOW CREATE TABLE full_table_name", + /* 235 */ "cmd ::= SHOW CREATE STABLE full_table_name", + /* 236 */ "cmd ::= SHOW QUERIES", + /* 237 */ "cmd ::= SHOW SCORES", + /* 238 */ "cmd ::= SHOW TOPICS", + /* 239 */ "cmd ::= SHOW VARIABLES", + /* 240 */ "cmd ::= SHOW CLUSTER VARIABLES", + /* 241 */ "cmd ::= SHOW LOCAL VARIABLES", + /* 242 */ "cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt", + /* 243 */ "cmd ::= SHOW BNODES", + /* 244 */ "cmd ::= SHOW SNODES", + /* 245 */ "cmd ::= SHOW CLUSTER", + /* 246 */ "cmd ::= SHOW TRANSACTIONS", + /* 247 */ "cmd ::= SHOW TABLE DISTRIBUTED full_table_name", + /* 248 */ "cmd ::= SHOW CONSUMERS", + /* 249 */ "cmd ::= SHOW SUBSCRIPTIONS", + /* 250 */ "cmd ::= SHOW TAGS FROM table_name_cond from_db_opt", + /* 251 */ "cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt", + /* 252 */ "cmd ::= SHOW VNODES NK_INTEGER", + /* 253 */ "cmd ::= SHOW VNODES NK_STRING", + /* 254 */ "cmd ::= SHOW db_name_cond_opt ALIVE", + /* 255 */ "cmd ::= SHOW CLUSTER ALIVE", + /* 256 */ "db_name_cond_opt ::=", + /* 257 */ "db_name_cond_opt ::= db_name NK_DOT", + /* 258 */ "like_pattern_opt ::=", + /* 259 */ "like_pattern_opt ::= LIKE NK_STRING", + /* 260 */ "table_name_cond ::= table_name", + /* 261 */ "from_db_opt ::=", + /* 262 */ "from_db_opt ::= FROM db_name", + /* 263 */ "tag_list_opt ::=", + /* 264 */ "tag_list_opt ::= tag_item", + /* 265 */ "tag_list_opt ::= tag_list_opt NK_COMMA tag_item", + /* 266 */ "tag_item ::= TBNAME", + /* 267 */ "tag_item ::= QTAGS", + /* 268 */ "tag_item ::= column_name", + /* 269 */ "tag_item ::= column_name column_alias", + /* 270 */ "tag_item ::= column_name AS column_alias", + /* 271 */ "cmd ::= CREATE SMA INDEX not_exists_opt full_index_name ON full_table_name index_options", + /* 272 */ "cmd ::= CREATE INDEX not_exists_opt full_index_name ON full_table_name NK_LP col_name_list NK_RP", + /* 273 */ "cmd ::= DROP INDEX exists_opt full_index_name", + /* 274 */ "full_index_name ::= index_name", + /* 275 */ "full_index_name ::= db_name NK_DOT index_name", + /* 276 */ "index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt", + /* 277 */ "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", + /* 278 */ "func_list ::= func", + /* 279 */ "func_list ::= func_list NK_COMMA func", + /* 280 */ "func ::= sma_func_name NK_LP expression_list NK_RP", + /* 281 */ "sma_func_name ::= function_name", + /* 282 */ "sma_func_name ::= COUNT", + /* 283 */ "sma_func_name ::= FIRST", + /* 284 */ "sma_func_name ::= LAST", + /* 285 */ "sma_func_name ::= LAST_ROW", + /* 286 */ "sma_stream_opt ::=", + /* 287 */ "sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal", + /* 288 */ "sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal", + /* 289 */ "sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal", + /* 290 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery", + /* 291 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name", + /* 292 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name", + /* 293 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name", + /* 294 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name", + /* 295 */ "cmd ::= DROP TOPIC exists_opt topic_name", + /* 296 */ "cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name", + /* 297 */ "cmd ::= DESC full_table_name", + /* 298 */ "cmd ::= DESCRIBE full_table_name", + /* 299 */ "cmd ::= RESET QUERY CACHE", + /* 300 */ "cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery", + /* 301 */ "cmd ::= EXPLAIN analyze_opt explain_options insert_query", + /* 302 */ "analyze_opt ::=", + /* 303 */ "analyze_opt ::= ANALYZE", + /* 304 */ "explain_options ::=", + /* 305 */ "explain_options ::= explain_options VERBOSE NK_BOOL", + /* 306 */ "explain_options ::= explain_options RATIO NK_FLOAT", + /* 307 */ "cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt", + /* 308 */ "cmd ::= DROP FUNCTION exists_opt function_name", + /* 309 */ "agg_func_opt ::=", + /* 310 */ "agg_func_opt ::= AGGREGATE", + /* 311 */ "bufsize_opt ::=", + /* 312 */ "bufsize_opt ::= BUFSIZE NK_INTEGER", + /* 313 */ "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", + /* 314 */ "cmd ::= DROP STREAM exists_opt stream_name", + /* 315 */ "col_list_opt ::=", + /* 316 */ "col_list_opt ::= NK_LP col_name_list NK_RP", + /* 317 */ "tag_def_or_ref_opt ::=", + /* 318 */ "tag_def_or_ref_opt ::= tags_def", + /* 319 */ "tag_def_or_ref_opt ::= TAGS NK_LP col_name_list NK_RP", + /* 320 */ "stream_options ::=", + /* 321 */ "stream_options ::= stream_options TRIGGER AT_ONCE", + /* 322 */ "stream_options ::= stream_options TRIGGER WINDOW_CLOSE", + /* 323 */ "stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal", + /* 324 */ "stream_options ::= stream_options WATERMARK duration_literal", + /* 325 */ "stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER", + /* 326 */ "stream_options ::= stream_options FILL_HISTORY NK_INTEGER", + /* 327 */ "stream_options ::= stream_options DELETE_MARK duration_literal", + /* 328 */ "stream_options ::= stream_options IGNORE UPDATE NK_INTEGER", + /* 329 */ "subtable_opt ::=", + /* 330 */ "subtable_opt ::= SUBTABLE NK_LP expression NK_RP", + /* 331 */ "cmd ::= KILL CONNECTION NK_INTEGER", + /* 332 */ "cmd ::= KILL QUERY NK_STRING", + /* 333 */ "cmd ::= KILL TRANSACTION NK_INTEGER", + /* 334 */ "cmd ::= BALANCE VGROUP", + /* 335 */ "cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER", + /* 336 */ "cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list", + /* 337 */ "cmd ::= SPLIT VGROUP NK_INTEGER", + /* 338 */ "dnode_list ::= DNODE NK_INTEGER", + /* 339 */ "dnode_list ::= dnode_list DNODE NK_INTEGER", + /* 340 */ "cmd ::= DELETE FROM full_table_name where_clause_opt", + /* 341 */ "cmd ::= query_or_subquery", + /* 342 */ "cmd ::= insert_query", + /* 343 */ "insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery", + /* 344 */ "insert_query ::= INSERT INTO full_table_name query_or_subquery", + /* 345 */ "literal ::= NK_INTEGER", + /* 346 */ "literal ::= NK_FLOAT", + /* 347 */ "literal ::= NK_STRING", + /* 348 */ "literal ::= NK_BOOL", + /* 349 */ "literal ::= TIMESTAMP NK_STRING", + /* 350 */ "literal ::= duration_literal", + /* 351 */ "literal ::= NULL", + /* 352 */ "literal ::= NK_QUESTION", + /* 353 */ "duration_literal ::= NK_VARIABLE", + /* 354 */ "signed ::= NK_INTEGER", + /* 355 */ "signed ::= NK_PLUS NK_INTEGER", + /* 356 */ "signed ::= NK_MINUS NK_INTEGER", + /* 357 */ "signed ::= NK_FLOAT", + /* 358 */ "signed ::= NK_PLUS NK_FLOAT", + /* 359 */ "signed ::= NK_MINUS NK_FLOAT", + /* 360 */ "signed_literal ::= signed", + /* 361 */ "signed_literal ::= NK_STRING", + /* 362 */ "signed_literal ::= NK_BOOL", + /* 363 */ "signed_literal ::= TIMESTAMP NK_STRING", + /* 364 */ "signed_literal ::= duration_literal", + /* 365 */ "signed_literal ::= NULL", + /* 366 */ "signed_literal ::= literal_func", + /* 367 */ "signed_literal ::= NK_QUESTION", + /* 368 */ "literal_list ::= signed_literal", + /* 369 */ "literal_list ::= literal_list NK_COMMA signed_literal", + /* 370 */ "db_name ::= NK_ID", + /* 371 */ "table_name ::= NK_ID", + /* 372 */ "column_name ::= NK_ID", + /* 373 */ "function_name ::= NK_ID", + /* 374 */ "table_alias ::= NK_ID", + /* 375 */ "column_alias ::= NK_ID", + /* 376 */ "user_name ::= NK_ID", + /* 377 */ "topic_name ::= NK_ID", + /* 378 */ "stream_name ::= NK_ID", + /* 379 */ "cgroup_name ::= NK_ID", + /* 380 */ "index_name ::= NK_ID", + /* 381 */ "expr_or_subquery ::= expression", + /* 382 */ "expression ::= literal", + /* 383 */ "expression ::= pseudo_column", + /* 384 */ "expression ::= column_reference", + /* 385 */ "expression ::= function_expression", + /* 386 */ "expression ::= case_when_expression", + /* 387 */ "expression ::= NK_LP expression NK_RP", + /* 388 */ "expression ::= NK_PLUS expr_or_subquery", + /* 389 */ "expression ::= NK_MINUS expr_or_subquery", + /* 390 */ "expression ::= expr_or_subquery NK_PLUS expr_or_subquery", + /* 391 */ "expression ::= expr_or_subquery NK_MINUS expr_or_subquery", + /* 392 */ "expression ::= expr_or_subquery NK_STAR expr_or_subquery", + /* 393 */ "expression ::= expr_or_subquery NK_SLASH expr_or_subquery", + /* 394 */ "expression ::= expr_or_subquery NK_REM expr_or_subquery", + /* 395 */ "expression ::= column_reference NK_ARROW NK_STRING", + /* 396 */ "expression ::= expr_or_subquery NK_BITAND expr_or_subquery", + /* 397 */ "expression ::= expr_or_subquery NK_BITOR expr_or_subquery", + /* 398 */ "expression_list ::= expr_or_subquery", + /* 399 */ "expression_list ::= expression_list NK_COMMA expr_or_subquery", + /* 400 */ "column_reference ::= column_name", + /* 401 */ "column_reference ::= table_name NK_DOT column_name", + /* 402 */ "pseudo_column ::= ROWTS", + /* 403 */ "pseudo_column ::= TBNAME", + /* 404 */ "pseudo_column ::= table_name NK_DOT TBNAME", + /* 405 */ "pseudo_column ::= QSTART", + /* 406 */ "pseudo_column ::= QEND", + /* 407 */ "pseudo_column ::= QDURATION", + /* 408 */ "pseudo_column ::= WSTART", + /* 409 */ "pseudo_column ::= WEND", + /* 410 */ "pseudo_column ::= WDURATION", + /* 411 */ "pseudo_column ::= IROWTS", + /* 412 */ "pseudo_column ::= ISFILLED", + /* 413 */ "pseudo_column ::= QTAGS", + /* 414 */ "function_expression ::= function_name NK_LP expression_list NK_RP", + /* 415 */ "function_expression ::= star_func NK_LP star_func_para_list NK_RP", + /* 416 */ "function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP", + /* 417 */ "function_expression ::= literal_func", + /* 418 */ "literal_func ::= noarg_func NK_LP NK_RP", + /* 419 */ "literal_func ::= NOW", + /* 420 */ "noarg_func ::= NOW", + /* 421 */ "noarg_func ::= TODAY", + /* 422 */ "noarg_func ::= TIMEZONE", + /* 423 */ "noarg_func ::= DATABASE", + /* 424 */ "noarg_func ::= CLIENT_VERSION", + /* 425 */ "noarg_func ::= SERVER_VERSION", + /* 426 */ "noarg_func ::= SERVER_STATUS", + /* 427 */ "noarg_func ::= CURRENT_USER", + /* 428 */ "noarg_func ::= USER", + /* 429 */ "star_func ::= COUNT", + /* 430 */ "star_func ::= FIRST", + /* 431 */ "star_func ::= LAST", + /* 432 */ "star_func ::= LAST_ROW", + /* 433 */ "star_func_para_list ::= NK_STAR", + /* 434 */ "star_func_para_list ::= other_para_list", + /* 435 */ "other_para_list ::= star_func_para", + /* 436 */ "other_para_list ::= other_para_list NK_COMMA star_func_para", + /* 437 */ "star_func_para ::= expr_or_subquery", + /* 438 */ "star_func_para ::= table_name NK_DOT NK_STAR", + /* 439 */ "case_when_expression ::= CASE when_then_list case_when_else_opt END", + /* 440 */ "case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END", + /* 441 */ "when_then_list ::= when_then_expr", + /* 442 */ "when_then_list ::= when_then_list when_then_expr", + /* 443 */ "when_then_expr ::= WHEN common_expression THEN common_expression", + /* 444 */ "case_when_else_opt ::=", + /* 445 */ "case_when_else_opt ::= ELSE common_expression", + /* 446 */ "predicate ::= expr_or_subquery compare_op expr_or_subquery", + /* 447 */ "predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery", + /* 448 */ "predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery", + /* 449 */ "predicate ::= expr_or_subquery IS NULL", + /* 450 */ "predicate ::= expr_or_subquery IS NOT NULL", + /* 451 */ "predicate ::= expr_or_subquery in_op in_predicate_value", + /* 452 */ "compare_op ::= NK_LT", + /* 453 */ "compare_op ::= NK_GT", + /* 454 */ "compare_op ::= NK_LE", + /* 455 */ "compare_op ::= NK_GE", + /* 456 */ "compare_op ::= NK_NE", + /* 457 */ "compare_op ::= NK_EQ", + /* 458 */ "compare_op ::= LIKE", + /* 459 */ "compare_op ::= NOT LIKE", + /* 460 */ "compare_op ::= MATCH", + /* 461 */ "compare_op ::= NMATCH", + /* 462 */ "compare_op ::= CONTAINS", + /* 463 */ "in_op ::= IN", + /* 464 */ "in_op ::= NOT IN", + /* 465 */ "in_predicate_value ::= NK_LP literal_list NK_RP", + /* 466 */ "boolean_value_expression ::= boolean_primary", + /* 467 */ "boolean_value_expression ::= NOT boolean_primary", + /* 468 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression", + /* 469 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression", + /* 470 */ "boolean_primary ::= predicate", + /* 471 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP", + /* 472 */ "common_expression ::= expr_or_subquery", + /* 473 */ "common_expression ::= boolean_value_expression", + /* 474 */ "from_clause_opt ::=", + /* 475 */ "from_clause_opt ::= FROM table_reference_list", + /* 476 */ "table_reference_list ::= table_reference", + /* 477 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference", + /* 478 */ "table_reference ::= table_primary", + /* 479 */ "table_reference ::= joined_table", + /* 480 */ "table_primary ::= table_name alias_opt", + /* 481 */ "table_primary ::= db_name NK_DOT table_name alias_opt", + /* 482 */ "table_primary ::= subquery alias_opt", + /* 483 */ "table_primary ::= parenthesized_joined_table", + /* 484 */ "alias_opt ::=", + /* 485 */ "alias_opt ::= table_alias", + /* 486 */ "alias_opt ::= AS table_alias", + /* 487 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP", + /* 488 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP", + /* 489 */ "joined_table ::= table_reference join_type JOIN table_reference ON search_condition", + /* 490 */ "join_type ::=", + /* 491 */ "join_type ::= INNER", + /* 492 */ "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", + /* 493 */ "set_quantifier_opt ::=", + /* 494 */ "set_quantifier_opt ::= DISTINCT", + /* 495 */ "set_quantifier_opt ::= ALL", + /* 496 */ "select_list ::= select_item", + /* 497 */ "select_list ::= select_list NK_COMMA select_item", + /* 498 */ "select_item ::= NK_STAR", + /* 499 */ "select_item ::= common_expression", + /* 500 */ "select_item ::= common_expression column_alias", + /* 501 */ "select_item ::= common_expression AS column_alias", + /* 502 */ "select_item ::= table_name NK_DOT NK_STAR", + /* 503 */ "where_clause_opt ::=", + /* 504 */ "where_clause_opt ::= WHERE search_condition", + /* 505 */ "partition_by_clause_opt ::=", + /* 506 */ "partition_by_clause_opt ::= PARTITION BY partition_list", + /* 507 */ "partition_list ::= partition_item", + /* 508 */ "partition_list ::= partition_list NK_COMMA partition_item", + /* 509 */ "partition_item ::= expr_or_subquery", + /* 510 */ "partition_item ::= expr_or_subquery column_alias", + /* 511 */ "partition_item ::= expr_or_subquery AS column_alias", + /* 512 */ "twindow_clause_opt ::=", + /* 513 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP", + /* 514 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP", + /* 515 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt", + /* 516 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt", + /* 517 */ "twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition", + /* 518 */ "sliding_opt ::=", + /* 519 */ "sliding_opt ::= SLIDING NK_LP duration_literal NK_RP", + /* 520 */ "fill_opt ::=", + /* 521 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP", + /* 522 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP", + /* 523 */ "fill_opt ::= FILL NK_LP VALUE_F NK_COMMA literal_list NK_RP", + /* 524 */ "fill_mode ::= NONE", + /* 525 */ "fill_mode ::= PREV", + /* 526 */ "fill_mode ::= NULL", + /* 527 */ "fill_mode ::= NULL_F", + /* 528 */ "fill_mode ::= LINEAR", + /* 529 */ "fill_mode ::= NEXT", + /* 530 */ "group_by_clause_opt ::=", + /* 531 */ "group_by_clause_opt ::= GROUP BY group_by_list", + /* 532 */ "group_by_list ::= expr_or_subquery", + /* 533 */ "group_by_list ::= group_by_list NK_COMMA expr_or_subquery", + /* 534 */ "having_clause_opt ::=", + /* 535 */ "having_clause_opt ::= HAVING search_condition", + /* 536 */ "range_opt ::=", + /* 537 */ "range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP", + /* 538 */ "every_opt ::=", + /* 539 */ "every_opt ::= EVERY NK_LP duration_literal NK_RP", + /* 540 */ "query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt", + /* 541 */ "query_simple ::= query_specification", + /* 542 */ "query_simple ::= union_query_expression", + /* 543 */ "union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery", + /* 544 */ "union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery", + /* 545 */ "query_simple_or_subquery ::= query_simple", + /* 546 */ "query_simple_or_subquery ::= subquery", + /* 547 */ "query_or_subquery ::= query_expression", + /* 548 */ "query_or_subquery ::= subquery", + /* 549 */ "order_by_clause_opt ::=", + /* 550 */ "order_by_clause_opt ::= ORDER BY sort_specification_list", + /* 551 */ "slimit_clause_opt ::=", + /* 552 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER", + /* 553 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER", + /* 554 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER", + /* 555 */ "limit_clause_opt ::=", + /* 556 */ "limit_clause_opt ::= LIMIT NK_INTEGER", + /* 557 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER", + /* 558 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER", + /* 559 */ "subquery ::= NK_LP query_expression NK_RP", + /* 560 */ "subquery ::= NK_LP subquery NK_RP", + /* 561 */ "search_condition ::= common_expression", + /* 562 */ "sort_specification_list ::= sort_specification", + /* 563 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification", + /* 564 */ "sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt", + /* 565 */ "ordering_specification_opt ::=", + /* 566 */ "ordering_specification_opt ::= ASC", + /* 567 */ "ordering_specification_opt ::= DESC", + /* 568 */ "null_ordering_opt ::=", + /* 569 */ "null_ordering_opt ::= NULLS FIRST", + /* 570 */ "null_ordering_opt ::= NULLS LAST", }; #endif /* NDEBUG */ @@ -2566,82 +2562,84 @@ static void yy_destructor( case 331: /* literal */ case 344: /* db_options */ case 346: /* alter_db_options */ - case 352: /* retention */ - case 353: /* full_table_name */ - case 356: /* table_options */ - case 360: /* alter_table_clause */ - case 361: /* alter_table_options */ - case 364: /* signed_literal */ - case 365: /* create_subtable_clause */ - case 368: /* drop_table_clause */ - case 371: /* column_def */ - case 375: /* duration_literal */ - case 376: /* rollup_func_name */ - case 378: /* col_name */ - case 379: /* db_name_cond_opt */ - case 380: /* like_pattern_opt */ - case 381: /* table_name_cond */ - case 382: /* from_db_opt */ - case 384: /* tag_item */ - case 386: /* full_index_name */ - case 387: /* index_options */ - case 390: /* sliding_opt */ - case 391: /* sma_stream_opt */ - case 392: /* func */ - case 394: /* query_or_subquery */ - case 397: /* explain_options */ - case 398: /* insert_query */ - case 402: /* stream_options */ - case 405: /* subtable_opt */ - case 406: /* expression */ - case 408: /* where_clause_opt */ - case 409: /* signed */ - case 410: /* literal_func */ - case 413: /* expr_or_subquery */ - case 414: /* pseudo_column */ - case 415: /* column_reference */ - case 416: /* function_expression */ - case 417: /* case_when_expression */ - case 422: /* star_func_para */ - case 424: /* case_when_else_opt */ - case 425: /* common_expression */ - case 426: /* when_then_expr */ - case 427: /* predicate */ - case 430: /* in_predicate_value */ - case 431: /* boolean_value_expression */ - case 432: /* boolean_primary */ - case 433: /* from_clause_opt */ - case 434: /* table_reference_list */ - case 435: /* table_reference */ - case 436: /* table_primary */ - case 437: /* joined_table */ - case 439: /* subquery */ - case 440: /* parenthesized_joined_table */ - case 442: /* search_condition */ - case 443: /* query_specification */ - case 447: /* range_opt */ - case 448: /* every_opt */ - case 449: /* fill_opt */ - case 450: /* twindow_clause_opt */ - case 452: /* having_clause_opt */ - case 453: /* select_item */ - case 455: /* partition_item */ - case 458: /* query_expression */ - case 459: /* query_simple */ - case 461: /* slimit_clause_opt */ - case 462: /* limit_clause_opt */ - case 463: /* union_query_expression */ - case 464: /* query_simple_or_subquery */ - case 466: /* sort_specification */ + case 348: /* start_opt */ + case 349: /* end_opt */ + case 354: /* retention */ + case 355: /* full_table_name */ + case 358: /* table_options */ + case 362: /* alter_table_clause */ + case 363: /* alter_table_options */ + case 366: /* signed_literal */ + case 367: /* create_subtable_clause */ + case 370: /* drop_table_clause */ + case 373: /* column_def */ + case 377: /* duration_literal */ + case 378: /* rollup_func_name */ + case 380: /* col_name */ + case 381: /* db_name_cond_opt */ + case 382: /* like_pattern_opt */ + case 383: /* table_name_cond */ + case 384: /* from_db_opt */ + case 386: /* tag_item */ + case 388: /* full_index_name */ + case 389: /* index_options */ + case 392: /* sliding_opt */ + case 393: /* sma_stream_opt */ + case 394: /* func */ + case 396: /* query_or_subquery */ + case 399: /* explain_options */ + case 400: /* insert_query */ + case 404: /* stream_options */ + case 407: /* subtable_opt */ + case 408: /* expression */ + case 410: /* where_clause_opt */ + case 411: /* signed */ + case 412: /* literal_func */ + case 415: /* expr_or_subquery */ + case 416: /* pseudo_column */ + case 417: /* column_reference */ + case 418: /* function_expression */ + case 419: /* case_when_expression */ + case 424: /* star_func_para */ + case 426: /* case_when_else_opt */ + case 427: /* common_expression */ + case 428: /* when_then_expr */ + case 429: /* predicate */ + case 432: /* in_predicate_value */ + case 433: /* boolean_value_expression */ + case 434: /* boolean_primary */ + case 435: /* from_clause_opt */ + case 436: /* table_reference_list */ + case 437: /* table_reference */ + case 438: /* table_primary */ + case 439: /* joined_table */ + case 441: /* subquery */ + case 442: /* parenthesized_joined_table */ + case 444: /* search_condition */ + case 445: /* query_specification */ + case 449: /* range_opt */ + case 450: /* every_opt */ + case 451: /* fill_opt */ + case 452: /* twindow_clause_opt */ + case 454: /* having_clause_opt */ + case 455: /* select_item */ + case 457: /* partition_item */ + case 460: /* query_expression */ + case 461: /* query_simple */ + case 463: /* slimit_clause_opt */ + case 464: /* limit_clause_opt */ + case 465: /* union_query_expression */ + case 466: /* query_simple_or_subquery */ + case 468: /* sort_specification */ { - nodesDestroyNode((yypminor->yy42)); + nodesDestroyNode((yypminor->yy140)); } break; case 329: /* account_options */ case 330: /* alter_account_options */ case 332: /* alter_account_option */ case 347: /* speed_opt */ - case 400: /* bufsize_opt */ + case 402: /* bufsize_opt */ { } @@ -2651,18 +2649,18 @@ static void yy_destructor( case 339: /* db_name */ case 340: /* topic_name */ case 341: /* dnode_endpoint */ - case 362: /* column_name */ - case 370: /* table_name */ - case 377: /* function_name */ - case 385: /* column_alias */ - case 388: /* index_name */ - case 393: /* sma_func_name */ - case 395: /* cgroup_name */ - case 401: /* stream_name */ - case 412: /* table_alias */ - case 418: /* star_func */ - case 420: /* noarg_func */ - case 438: /* alias_opt */ + case 364: /* column_name */ + case 372: /* table_name */ + case 379: /* function_name */ + case 387: /* column_alias */ + case 390: /* index_name */ + case 395: /* sma_func_name */ + case 397: /* cgroup_name */ + case 403: /* stream_name */ + case 414: /* table_alias */ + case 420: /* star_func */ + case 422: /* noarg_func */ + case 440: /* alias_opt */ { } @@ -2682,79 +2680,79 @@ static void yy_destructor( case 342: /* force_opt */ case 343: /* not_exists_opt */ case 345: /* exists_opt */ - case 396: /* analyze_opt */ - case 399: /* agg_func_opt */ - case 444: /* set_quantifier_opt */ + case 398: /* analyze_opt */ + case 401: /* agg_func_opt */ + case 446: /* set_quantifier_opt */ { } break; - case 348: /* integer_list */ - case 349: /* variable_list */ - case 350: /* retention_list */ - case 354: /* column_def_list */ - case 355: /* tags_def_opt */ - case 357: /* multi_create_clause */ - case 358: /* tags_def */ - case 359: /* multi_drop_clause */ - case 366: /* specific_cols_opt */ - case 367: /* expression_list */ - case 369: /* col_name_list */ - case 372: /* duration_list */ - case 373: /* rollup_func_list */ - case 383: /* tag_list_opt */ - case 389: /* func_list */ - case 403: /* col_list_opt */ - case 404: /* tag_def_or_ref_opt */ - case 407: /* dnode_list */ - case 411: /* literal_list */ - case 419: /* star_func_para_list */ - case 421: /* other_para_list */ - case 423: /* when_then_list */ - case 445: /* select_list */ - case 446: /* partition_by_clause_opt */ - case 451: /* group_by_clause_opt */ - case 454: /* partition_list */ - case 457: /* group_by_list */ - case 460: /* order_by_clause_opt */ - case 465: /* sort_specification_list */ + case 350: /* integer_list */ + case 351: /* variable_list */ + case 352: /* retention_list */ + case 356: /* column_def_list */ + case 357: /* tags_def_opt */ + case 359: /* multi_create_clause */ + case 360: /* tags_def */ + case 361: /* multi_drop_clause */ + case 368: /* specific_cols_opt */ + case 369: /* expression_list */ + case 371: /* col_name_list */ + case 374: /* duration_list */ + case 375: /* rollup_func_list */ + case 385: /* tag_list_opt */ + case 391: /* func_list */ + case 405: /* col_list_opt */ + case 406: /* tag_def_or_ref_opt */ + case 409: /* dnode_list */ + case 413: /* literal_list */ + case 421: /* star_func_para_list */ + case 423: /* other_para_list */ + case 425: /* when_then_list */ + case 447: /* select_list */ + case 448: /* partition_by_clause_opt */ + case 453: /* group_by_clause_opt */ + case 456: /* partition_list */ + case 459: /* group_by_list */ + case 462: /* order_by_clause_opt */ + case 467: /* sort_specification_list */ { - nodesDestroyList((yypminor->yy110)); + nodesDestroyList((yypminor->yy220)); } break; - case 351: /* alter_db_option */ - case 374: /* alter_table_option */ + case 353: /* alter_db_option */ + case 376: /* alter_table_option */ { } break; - case 363: /* type_name */ + case 365: /* type_name */ { } break; - case 428: /* compare_op */ - case 429: /* in_op */ + case 430: /* compare_op */ + case 431: /* in_op */ { } break; - case 441: /* join_type */ + case 443: /* join_type */ { } break; - case 456: /* fill_mode */ + case 458: /* fill_mode */ { } break; - case 467: /* ordering_specification_opt */ + case 469: /* ordering_specification_opt */ { } break; - case 468: /* null_ordering_opt */ + case 470: /* null_ordering_opt */ { } @@ -3125,7 +3123,7 @@ static const struct { { 328, -4 }, /* (69) cmd ::= ALTER DATABASE db_name alter_db_options */ { 328, -3 }, /* (70) cmd ::= FLUSH DATABASE db_name */ { 328, -4 }, /* (71) cmd ::= TRIM DATABASE db_name speed_opt */ - { 328, -3 }, /* (72) cmd ::= COMPACT DATABASE db_name */ + { 328, -5 }, /* (72) cmd ::= COMPACT DATABASE db_name start_opt end_opt */ { 343, -3 }, /* (73) not_exists_opt ::= IF NOT EXISTS */ { 343, 0 }, /* (74) not_exists_opt ::= */ { 345, -2 }, /* (75) exists_opt ::= IF EXISTS */ @@ -3163,459 +3161,467 @@ static const struct { { 344, -3 }, /* (107) db_options ::= db_options TABLE_SUFFIX NK_INTEGER */ { 346, -1 }, /* (108) alter_db_options ::= alter_db_option */ { 346, -2 }, /* (109) alter_db_options ::= alter_db_options alter_db_option */ - { 351, -2 }, /* (110) alter_db_option ::= BUFFER NK_INTEGER */ - { 351, -2 }, /* (111) alter_db_option ::= CACHEMODEL NK_STRING */ - { 351, -2 }, /* (112) alter_db_option ::= CACHESIZE NK_INTEGER */ - { 351, -2 }, /* (113) alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER */ - { 351, -2 }, /* (114) alter_db_option ::= KEEP integer_list */ - { 351, -2 }, /* (115) alter_db_option ::= KEEP variable_list */ - { 351, -2 }, /* (116) alter_db_option ::= PAGES NK_INTEGER */ - { 351, -2 }, /* (117) alter_db_option ::= REPLICA NK_INTEGER */ - { 351, -2 }, /* (118) alter_db_option ::= WAL_LEVEL NK_INTEGER */ - { 351, -2 }, /* (119) alter_db_option ::= STT_TRIGGER NK_INTEGER */ - { 348, -1 }, /* (120) integer_list ::= NK_INTEGER */ - { 348, -3 }, /* (121) integer_list ::= integer_list NK_COMMA NK_INTEGER */ - { 349, -1 }, /* (122) variable_list ::= NK_VARIABLE */ - { 349, -3 }, /* (123) variable_list ::= variable_list NK_COMMA NK_VARIABLE */ - { 350, -1 }, /* (124) retention_list ::= retention */ - { 350, -3 }, /* (125) retention_list ::= retention_list NK_COMMA retention */ - { 352, -3 }, /* (126) retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */ + { 353, -2 }, /* (110) alter_db_option ::= BUFFER NK_INTEGER */ + { 353, -2 }, /* (111) alter_db_option ::= CACHEMODEL NK_STRING */ + { 353, -2 }, /* (112) alter_db_option ::= CACHESIZE NK_INTEGER */ + { 353, -2 }, /* (113) alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER */ + { 353, -2 }, /* (114) alter_db_option ::= KEEP integer_list */ + { 353, -2 }, /* (115) alter_db_option ::= KEEP variable_list */ + { 353, -2 }, /* (116) alter_db_option ::= PAGES NK_INTEGER */ + { 353, -2 }, /* (117) alter_db_option ::= REPLICA NK_INTEGER */ + { 353, -2 }, /* (118) alter_db_option ::= WAL_LEVEL NK_INTEGER */ + { 353, -2 }, /* (119) alter_db_option ::= STT_TRIGGER NK_INTEGER */ + { 350, -1 }, /* (120) integer_list ::= NK_INTEGER */ + { 350, -3 }, /* (121) integer_list ::= integer_list NK_COMMA NK_INTEGER */ + { 351, -1 }, /* (122) variable_list ::= NK_VARIABLE */ + { 351, -3 }, /* (123) variable_list ::= variable_list NK_COMMA NK_VARIABLE */ + { 352, -1 }, /* (124) retention_list ::= retention */ + { 352, -3 }, /* (125) retention_list ::= retention_list NK_COMMA retention */ + { 354, -3 }, /* (126) retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */ { 347, 0 }, /* (127) speed_opt ::= */ { 347, -2 }, /* (128) speed_opt ::= MAX_SPEED NK_INTEGER */ - { 328, -9 }, /* (129) cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ - { 328, -3 }, /* (130) cmd ::= CREATE TABLE multi_create_clause */ - { 328, -9 }, /* (131) cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ - { 328, -3 }, /* (132) cmd ::= DROP TABLE multi_drop_clause */ - { 328, -4 }, /* (133) cmd ::= DROP STABLE exists_opt full_table_name */ - { 328, -3 }, /* (134) cmd ::= ALTER TABLE alter_table_clause */ - { 328, -3 }, /* (135) cmd ::= ALTER STABLE alter_table_clause */ - { 360, -2 }, /* (136) alter_table_clause ::= full_table_name alter_table_options */ - { 360, -5 }, /* (137) alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ - { 360, -4 }, /* (138) alter_table_clause ::= full_table_name DROP COLUMN column_name */ - { 360, -5 }, /* (139) alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ - { 360, -5 }, /* (140) alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ - { 360, -5 }, /* (141) alter_table_clause ::= full_table_name ADD TAG column_name type_name */ - { 360, -4 }, /* (142) alter_table_clause ::= full_table_name DROP TAG column_name */ - { 360, -5 }, /* (143) alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ - { 360, -5 }, /* (144) alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ - { 360, -6 }, /* (145) alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */ - { 357, -1 }, /* (146) multi_create_clause ::= create_subtable_clause */ - { 357, -2 }, /* (147) multi_create_clause ::= multi_create_clause create_subtable_clause */ - { 365, -10 }, /* (148) 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 */ - { 359, -1 }, /* (149) multi_drop_clause ::= drop_table_clause */ - { 359, -3 }, /* (150) multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause */ - { 368, -2 }, /* (151) drop_table_clause ::= exists_opt full_table_name */ - { 366, 0 }, /* (152) specific_cols_opt ::= */ - { 366, -3 }, /* (153) specific_cols_opt ::= NK_LP col_name_list NK_RP */ - { 353, -1 }, /* (154) full_table_name ::= table_name */ - { 353, -3 }, /* (155) full_table_name ::= db_name NK_DOT table_name */ - { 354, -1 }, /* (156) column_def_list ::= column_def */ - { 354, -3 }, /* (157) column_def_list ::= column_def_list NK_COMMA column_def */ - { 371, -2 }, /* (158) column_def ::= column_name type_name */ - { 371, -4 }, /* (159) column_def ::= column_name type_name COMMENT NK_STRING */ - { 363, -1 }, /* (160) type_name ::= BOOL */ - { 363, -1 }, /* (161) type_name ::= TINYINT */ - { 363, -1 }, /* (162) type_name ::= SMALLINT */ - { 363, -1 }, /* (163) type_name ::= INT */ - { 363, -1 }, /* (164) type_name ::= INTEGER */ - { 363, -1 }, /* (165) type_name ::= BIGINT */ - { 363, -1 }, /* (166) type_name ::= FLOAT */ - { 363, -1 }, /* (167) type_name ::= DOUBLE */ - { 363, -4 }, /* (168) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ - { 363, -1 }, /* (169) type_name ::= TIMESTAMP */ - { 363, -4 }, /* (170) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ - { 363, -2 }, /* (171) type_name ::= TINYINT UNSIGNED */ - { 363, -2 }, /* (172) type_name ::= SMALLINT UNSIGNED */ - { 363, -2 }, /* (173) type_name ::= INT UNSIGNED */ - { 363, -2 }, /* (174) type_name ::= BIGINT UNSIGNED */ - { 363, -1 }, /* (175) type_name ::= JSON */ - { 363, -4 }, /* (176) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ - { 363, -1 }, /* (177) type_name ::= MEDIUMBLOB */ - { 363, -1 }, /* (178) type_name ::= BLOB */ - { 363, -4 }, /* (179) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ - { 363, -1 }, /* (180) type_name ::= DECIMAL */ - { 363, -4 }, /* (181) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ - { 363, -6 }, /* (182) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ - { 355, 0 }, /* (183) tags_def_opt ::= */ - { 355, -1 }, /* (184) tags_def_opt ::= tags_def */ - { 358, -4 }, /* (185) tags_def ::= TAGS NK_LP column_def_list NK_RP */ - { 356, 0 }, /* (186) table_options ::= */ - { 356, -3 }, /* (187) table_options ::= table_options COMMENT NK_STRING */ - { 356, -3 }, /* (188) table_options ::= table_options MAX_DELAY duration_list */ - { 356, -3 }, /* (189) table_options ::= table_options WATERMARK duration_list */ - { 356, -5 }, /* (190) table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ - { 356, -3 }, /* (191) table_options ::= table_options TTL NK_INTEGER */ - { 356, -5 }, /* (192) table_options ::= table_options SMA NK_LP col_name_list NK_RP */ - { 356, -3 }, /* (193) table_options ::= table_options DELETE_MARK duration_list */ - { 361, -1 }, /* (194) alter_table_options ::= alter_table_option */ - { 361, -2 }, /* (195) alter_table_options ::= alter_table_options alter_table_option */ - { 374, -2 }, /* (196) alter_table_option ::= COMMENT NK_STRING */ - { 374, -2 }, /* (197) alter_table_option ::= TTL NK_INTEGER */ - { 372, -1 }, /* (198) duration_list ::= duration_literal */ - { 372, -3 }, /* (199) duration_list ::= duration_list NK_COMMA duration_literal */ - { 373, -1 }, /* (200) rollup_func_list ::= rollup_func_name */ - { 373, -3 }, /* (201) rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ - { 376, -1 }, /* (202) rollup_func_name ::= function_name */ - { 376, -1 }, /* (203) rollup_func_name ::= FIRST */ - { 376, -1 }, /* (204) rollup_func_name ::= LAST */ - { 369, -1 }, /* (205) col_name_list ::= col_name */ - { 369, -3 }, /* (206) col_name_list ::= col_name_list NK_COMMA col_name */ - { 378, -1 }, /* (207) col_name ::= column_name */ - { 328, -2 }, /* (208) cmd ::= SHOW DNODES */ - { 328, -2 }, /* (209) cmd ::= SHOW USERS */ - { 328, -3 }, /* (210) cmd ::= SHOW USER PRIVILEGES */ - { 328, -2 }, /* (211) cmd ::= SHOW DATABASES */ - { 328, -4 }, /* (212) cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */ - { 328, -4 }, /* (213) cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ - { 328, -3 }, /* (214) cmd ::= SHOW db_name_cond_opt VGROUPS */ - { 328, -2 }, /* (215) cmd ::= SHOW MNODES */ - { 328, -2 }, /* (216) cmd ::= SHOW QNODES */ - { 328, -2 }, /* (217) cmd ::= SHOW FUNCTIONS */ - { 328, -5 }, /* (218) cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ - { 328, -2 }, /* (219) cmd ::= SHOW STREAMS */ - { 328, -2 }, /* (220) cmd ::= SHOW ACCOUNTS */ - { 328, -2 }, /* (221) cmd ::= SHOW APPS */ - { 328, -2 }, /* (222) cmd ::= SHOW CONNECTIONS */ - { 328, -2 }, /* (223) cmd ::= SHOW LICENCES */ - { 328, -2 }, /* (224) cmd ::= SHOW GRANTS */ - { 328, -4 }, /* (225) cmd ::= SHOW CREATE DATABASE db_name */ - { 328, -4 }, /* (226) cmd ::= SHOW CREATE TABLE full_table_name */ - { 328, -4 }, /* (227) cmd ::= SHOW CREATE STABLE full_table_name */ - { 328, -2 }, /* (228) cmd ::= SHOW QUERIES */ - { 328, -2 }, /* (229) cmd ::= SHOW SCORES */ - { 328, -2 }, /* (230) cmd ::= SHOW TOPICS */ - { 328, -2 }, /* (231) cmd ::= SHOW VARIABLES */ - { 328, -3 }, /* (232) cmd ::= SHOW CLUSTER VARIABLES */ - { 328, -3 }, /* (233) cmd ::= SHOW LOCAL VARIABLES */ - { 328, -5 }, /* (234) cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt */ - { 328, -2 }, /* (235) cmd ::= SHOW BNODES */ - { 328, -2 }, /* (236) cmd ::= SHOW SNODES */ - { 328, -2 }, /* (237) cmd ::= SHOW CLUSTER */ - { 328, -2 }, /* (238) cmd ::= SHOW TRANSACTIONS */ - { 328, -4 }, /* (239) cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ - { 328, -2 }, /* (240) cmd ::= SHOW CONSUMERS */ - { 328, -2 }, /* (241) cmd ::= SHOW SUBSCRIPTIONS */ - { 328, -5 }, /* (242) cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */ - { 328, -7 }, /* (243) cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */ - { 328, -3 }, /* (244) cmd ::= SHOW VNODES NK_INTEGER */ - { 328, -3 }, /* (245) cmd ::= SHOW VNODES NK_STRING */ - { 328, -3 }, /* (246) cmd ::= SHOW db_name_cond_opt ALIVE */ - { 328, -3 }, /* (247) cmd ::= SHOW CLUSTER ALIVE */ - { 379, 0 }, /* (248) db_name_cond_opt ::= */ - { 379, -2 }, /* (249) db_name_cond_opt ::= db_name NK_DOT */ - { 380, 0 }, /* (250) like_pattern_opt ::= */ - { 380, -2 }, /* (251) like_pattern_opt ::= LIKE NK_STRING */ - { 381, -1 }, /* (252) table_name_cond ::= table_name */ - { 382, 0 }, /* (253) from_db_opt ::= */ - { 382, -2 }, /* (254) from_db_opt ::= FROM db_name */ - { 383, 0 }, /* (255) tag_list_opt ::= */ - { 383, -1 }, /* (256) tag_list_opt ::= tag_item */ - { 383, -3 }, /* (257) tag_list_opt ::= tag_list_opt NK_COMMA tag_item */ - { 384, -1 }, /* (258) tag_item ::= TBNAME */ - { 384, -1 }, /* (259) tag_item ::= QTAGS */ - { 384, -1 }, /* (260) tag_item ::= column_name */ - { 384, -2 }, /* (261) tag_item ::= column_name column_alias */ - { 384, -3 }, /* (262) tag_item ::= column_name AS column_alias */ - { 328, -8 }, /* (263) cmd ::= CREATE SMA INDEX not_exists_opt full_index_name ON full_table_name index_options */ - { 328, -9 }, /* (264) cmd ::= CREATE INDEX not_exists_opt full_index_name ON full_table_name NK_LP col_name_list NK_RP */ - { 328, -4 }, /* (265) cmd ::= DROP INDEX exists_opt full_index_name */ - { 386, -1 }, /* (266) full_index_name ::= index_name */ - { 386, -3 }, /* (267) full_index_name ::= db_name NK_DOT index_name */ - { 387, -10 }, /* (268) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ - { 387, -12 }, /* (269) 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 */ - { 389, -1 }, /* (270) func_list ::= func */ - { 389, -3 }, /* (271) func_list ::= func_list NK_COMMA func */ - { 392, -4 }, /* (272) func ::= sma_func_name NK_LP expression_list NK_RP */ - { 393, -1 }, /* (273) sma_func_name ::= function_name */ - { 393, -1 }, /* (274) sma_func_name ::= COUNT */ - { 393, -1 }, /* (275) sma_func_name ::= FIRST */ - { 393, -1 }, /* (276) sma_func_name ::= LAST */ - { 393, -1 }, /* (277) sma_func_name ::= LAST_ROW */ - { 391, 0 }, /* (278) sma_stream_opt ::= */ - { 391, -3 }, /* (279) sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */ - { 391, -3 }, /* (280) sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */ - { 391, -3 }, /* (281) sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */ - { 328, -6 }, /* (282) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ - { 328, -7 }, /* (283) cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name */ - { 328, -9 }, /* (284) cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name */ - { 328, -7 }, /* (285) cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name */ - { 328, -9 }, /* (286) cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name */ - { 328, -4 }, /* (287) cmd ::= DROP TOPIC exists_opt topic_name */ - { 328, -7 }, /* (288) cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ - { 328, -2 }, /* (289) cmd ::= DESC full_table_name */ - { 328, -2 }, /* (290) cmd ::= DESCRIBE full_table_name */ - { 328, -3 }, /* (291) cmd ::= RESET QUERY CACHE */ - { 328, -4 }, /* (292) cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ - { 328, -4 }, /* (293) cmd ::= EXPLAIN analyze_opt explain_options insert_query */ - { 396, 0 }, /* (294) analyze_opt ::= */ - { 396, -1 }, /* (295) analyze_opt ::= ANALYZE */ - { 397, 0 }, /* (296) explain_options ::= */ - { 397, -3 }, /* (297) explain_options ::= explain_options VERBOSE NK_BOOL */ - { 397, -3 }, /* (298) explain_options ::= explain_options RATIO NK_FLOAT */ - { 328, -10 }, /* (299) cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt */ - { 328, -4 }, /* (300) cmd ::= DROP FUNCTION exists_opt function_name */ - { 399, 0 }, /* (301) agg_func_opt ::= */ - { 399, -1 }, /* (302) agg_func_opt ::= AGGREGATE */ - { 400, 0 }, /* (303) bufsize_opt ::= */ - { 400, -2 }, /* (304) bufsize_opt ::= BUFSIZE NK_INTEGER */ - { 328, -12 }, /* (305) 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 */ - { 328, -4 }, /* (306) cmd ::= DROP STREAM exists_opt stream_name */ - { 403, 0 }, /* (307) col_list_opt ::= */ - { 403, -3 }, /* (308) col_list_opt ::= NK_LP col_name_list NK_RP */ - { 404, 0 }, /* (309) tag_def_or_ref_opt ::= */ - { 404, -1 }, /* (310) tag_def_or_ref_opt ::= tags_def */ - { 404, -4 }, /* (311) tag_def_or_ref_opt ::= TAGS NK_LP col_name_list NK_RP */ - { 402, 0 }, /* (312) stream_options ::= */ - { 402, -3 }, /* (313) stream_options ::= stream_options TRIGGER AT_ONCE */ - { 402, -3 }, /* (314) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ - { 402, -4 }, /* (315) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ - { 402, -3 }, /* (316) stream_options ::= stream_options WATERMARK duration_literal */ - { 402, -4 }, /* (317) stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ - { 402, -3 }, /* (318) stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ - { 402, -3 }, /* (319) stream_options ::= stream_options DELETE_MARK duration_literal */ - { 402, -4 }, /* (320) stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */ - { 405, 0 }, /* (321) subtable_opt ::= */ - { 405, -4 }, /* (322) subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ - { 328, -3 }, /* (323) cmd ::= KILL CONNECTION NK_INTEGER */ - { 328, -3 }, /* (324) cmd ::= KILL QUERY NK_STRING */ - { 328, -3 }, /* (325) cmd ::= KILL TRANSACTION NK_INTEGER */ - { 328, -2 }, /* (326) cmd ::= BALANCE VGROUP */ - { 328, -4 }, /* (327) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ - { 328, -4 }, /* (328) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ - { 328, -3 }, /* (329) cmd ::= SPLIT VGROUP NK_INTEGER */ - { 407, -2 }, /* (330) dnode_list ::= DNODE NK_INTEGER */ - { 407, -3 }, /* (331) dnode_list ::= dnode_list DNODE NK_INTEGER */ - { 328, -4 }, /* (332) cmd ::= DELETE FROM full_table_name where_clause_opt */ - { 328, -1 }, /* (333) cmd ::= query_or_subquery */ - { 328, -1 }, /* (334) cmd ::= insert_query */ - { 398, -7 }, /* (335) insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ - { 398, -4 }, /* (336) insert_query ::= INSERT INTO full_table_name query_or_subquery */ - { 331, -1 }, /* (337) literal ::= NK_INTEGER */ - { 331, -1 }, /* (338) literal ::= NK_FLOAT */ - { 331, -1 }, /* (339) literal ::= NK_STRING */ - { 331, -1 }, /* (340) literal ::= NK_BOOL */ - { 331, -2 }, /* (341) literal ::= TIMESTAMP NK_STRING */ - { 331, -1 }, /* (342) literal ::= duration_literal */ - { 331, -1 }, /* (343) literal ::= NULL */ - { 331, -1 }, /* (344) literal ::= NK_QUESTION */ - { 375, -1 }, /* (345) duration_literal ::= NK_VARIABLE */ - { 409, -1 }, /* (346) signed ::= NK_INTEGER */ - { 409, -2 }, /* (347) signed ::= NK_PLUS NK_INTEGER */ - { 409, -2 }, /* (348) signed ::= NK_MINUS NK_INTEGER */ - { 409, -1 }, /* (349) signed ::= NK_FLOAT */ - { 409, -2 }, /* (350) signed ::= NK_PLUS NK_FLOAT */ - { 409, -2 }, /* (351) signed ::= NK_MINUS NK_FLOAT */ - { 364, -1 }, /* (352) signed_literal ::= signed */ - { 364, -1 }, /* (353) signed_literal ::= NK_STRING */ - { 364, -1 }, /* (354) signed_literal ::= NK_BOOL */ - { 364, -2 }, /* (355) signed_literal ::= TIMESTAMP NK_STRING */ - { 364, -1 }, /* (356) signed_literal ::= duration_literal */ - { 364, -1 }, /* (357) signed_literal ::= NULL */ - { 364, -1 }, /* (358) signed_literal ::= literal_func */ - { 364, -1 }, /* (359) signed_literal ::= NK_QUESTION */ - { 411, -1 }, /* (360) literal_list ::= signed_literal */ - { 411, -3 }, /* (361) literal_list ::= literal_list NK_COMMA signed_literal */ - { 339, -1 }, /* (362) db_name ::= NK_ID */ - { 370, -1 }, /* (363) table_name ::= NK_ID */ - { 362, -1 }, /* (364) column_name ::= NK_ID */ - { 377, -1 }, /* (365) function_name ::= NK_ID */ - { 412, -1 }, /* (366) table_alias ::= NK_ID */ - { 385, -1 }, /* (367) column_alias ::= NK_ID */ - { 333, -1 }, /* (368) user_name ::= NK_ID */ - { 340, -1 }, /* (369) topic_name ::= NK_ID */ - { 401, -1 }, /* (370) stream_name ::= NK_ID */ - { 395, -1 }, /* (371) cgroup_name ::= NK_ID */ - { 388, -1 }, /* (372) index_name ::= NK_ID */ - { 413, -1 }, /* (373) expr_or_subquery ::= expression */ - { 406, -1 }, /* (374) expression ::= literal */ - { 406, -1 }, /* (375) expression ::= pseudo_column */ - { 406, -1 }, /* (376) expression ::= column_reference */ - { 406, -1 }, /* (377) expression ::= function_expression */ - { 406, -1 }, /* (378) expression ::= case_when_expression */ - { 406, -3 }, /* (379) expression ::= NK_LP expression NK_RP */ - { 406, -2 }, /* (380) expression ::= NK_PLUS expr_or_subquery */ - { 406, -2 }, /* (381) expression ::= NK_MINUS expr_or_subquery */ - { 406, -3 }, /* (382) expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ - { 406, -3 }, /* (383) expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ - { 406, -3 }, /* (384) expression ::= expr_or_subquery NK_STAR expr_or_subquery */ - { 406, -3 }, /* (385) expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ - { 406, -3 }, /* (386) expression ::= expr_or_subquery NK_REM expr_or_subquery */ - { 406, -3 }, /* (387) expression ::= column_reference NK_ARROW NK_STRING */ - { 406, -3 }, /* (388) expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ - { 406, -3 }, /* (389) expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ - { 367, -1 }, /* (390) expression_list ::= expr_or_subquery */ - { 367, -3 }, /* (391) expression_list ::= expression_list NK_COMMA expr_or_subquery */ - { 415, -1 }, /* (392) column_reference ::= column_name */ - { 415, -3 }, /* (393) column_reference ::= table_name NK_DOT column_name */ - { 414, -1 }, /* (394) pseudo_column ::= ROWTS */ - { 414, -1 }, /* (395) pseudo_column ::= TBNAME */ - { 414, -3 }, /* (396) pseudo_column ::= table_name NK_DOT TBNAME */ - { 414, -1 }, /* (397) pseudo_column ::= QSTART */ - { 414, -1 }, /* (398) pseudo_column ::= QEND */ - { 414, -1 }, /* (399) pseudo_column ::= QDURATION */ - { 414, -1 }, /* (400) pseudo_column ::= WSTART */ - { 414, -1 }, /* (401) pseudo_column ::= WEND */ - { 414, -1 }, /* (402) pseudo_column ::= WDURATION */ - { 414, -1 }, /* (403) pseudo_column ::= IROWTS */ - { 414, -1 }, /* (404) pseudo_column ::= ISFILLED */ - { 414, -1 }, /* (405) pseudo_column ::= QTAGS */ - { 416, -4 }, /* (406) function_expression ::= function_name NK_LP expression_list NK_RP */ - { 416, -4 }, /* (407) function_expression ::= star_func NK_LP star_func_para_list NK_RP */ - { 416, -6 }, /* (408) function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ - { 416, -1 }, /* (409) function_expression ::= literal_func */ - { 410, -3 }, /* (410) literal_func ::= noarg_func NK_LP NK_RP */ - { 410, -1 }, /* (411) literal_func ::= NOW */ - { 420, -1 }, /* (412) noarg_func ::= NOW */ - { 420, -1 }, /* (413) noarg_func ::= TODAY */ - { 420, -1 }, /* (414) noarg_func ::= TIMEZONE */ - { 420, -1 }, /* (415) noarg_func ::= DATABASE */ - { 420, -1 }, /* (416) noarg_func ::= CLIENT_VERSION */ - { 420, -1 }, /* (417) noarg_func ::= SERVER_VERSION */ - { 420, -1 }, /* (418) noarg_func ::= SERVER_STATUS */ - { 420, -1 }, /* (419) noarg_func ::= CURRENT_USER */ - { 420, -1 }, /* (420) noarg_func ::= USER */ - { 418, -1 }, /* (421) star_func ::= COUNT */ - { 418, -1 }, /* (422) star_func ::= FIRST */ - { 418, -1 }, /* (423) star_func ::= LAST */ - { 418, -1 }, /* (424) star_func ::= LAST_ROW */ - { 419, -1 }, /* (425) star_func_para_list ::= NK_STAR */ - { 419, -1 }, /* (426) star_func_para_list ::= other_para_list */ - { 421, -1 }, /* (427) other_para_list ::= star_func_para */ - { 421, -3 }, /* (428) other_para_list ::= other_para_list NK_COMMA star_func_para */ - { 422, -1 }, /* (429) star_func_para ::= expr_or_subquery */ - { 422, -3 }, /* (430) star_func_para ::= table_name NK_DOT NK_STAR */ - { 417, -4 }, /* (431) case_when_expression ::= CASE when_then_list case_when_else_opt END */ - { 417, -5 }, /* (432) case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ - { 423, -1 }, /* (433) when_then_list ::= when_then_expr */ - { 423, -2 }, /* (434) when_then_list ::= when_then_list when_then_expr */ - { 426, -4 }, /* (435) when_then_expr ::= WHEN common_expression THEN common_expression */ - { 424, 0 }, /* (436) case_when_else_opt ::= */ - { 424, -2 }, /* (437) case_when_else_opt ::= ELSE common_expression */ - { 427, -3 }, /* (438) predicate ::= expr_or_subquery compare_op expr_or_subquery */ - { 427, -5 }, /* (439) predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ - { 427, -6 }, /* (440) predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ - { 427, -3 }, /* (441) predicate ::= expr_or_subquery IS NULL */ - { 427, -4 }, /* (442) predicate ::= expr_or_subquery IS NOT NULL */ - { 427, -3 }, /* (443) predicate ::= expr_or_subquery in_op in_predicate_value */ - { 428, -1 }, /* (444) compare_op ::= NK_LT */ - { 428, -1 }, /* (445) compare_op ::= NK_GT */ - { 428, -1 }, /* (446) compare_op ::= NK_LE */ - { 428, -1 }, /* (447) compare_op ::= NK_GE */ - { 428, -1 }, /* (448) compare_op ::= NK_NE */ - { 428, -1 }, /* (449) compare_op ::= NK_EQ */ - { 428, -1 }, /* (450) compare_op ::= LIKE */ - { 428, -2 }, /* (451) compare_op ::= NOT LIKE */ - { 428, -1 }, /* (452) compare_op ::= MATCH */ - { 428, -1 }, /* (453) compare_op ::= NMATCH */ - { 428, -1 }, /* (454) compare_op ::= CONTAINS */ - { 429, -1 }, /* (455) in_op ::= IN */ - { 429, -2 }, /* (456) in_op ::= NOT IN */ - { 430, -3 }, /* (457) in_predicate_value ::= NK_LP literal_list NK_RP */ - { 431, -1 }, /* (458) boolean_value_expression ::= boolean_primary */ - { 431, -2 }, /* (459) boolean_value_expression ::= NOT boolean_primary */ - { 431, -3 }, /* (460) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ - { 431, -3 }, /* (461) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ - { 432, -1 }, /* (462) boolean_primary ::= predicate */ - { 432, -3 }, /* (463) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ - { 425, -1 }, /* (464) common_expression ::= expr_or_subquery */ - { 425, -1 }, /* (465) common_expression ::= boolean_value_expression */ - { 433, 0 }, /* (466) from_clause_opt ::= */ - { 433, -2 }, /* (467) from_clause_opt ::= FROM table_reference_list */ - { 434, -1 }, /* (468) table_reference_list ::= table_reference */ - { 434, -3 }, /* (469) table_reference_list ::= table_reference_list NK_COMMA table_reference */ - { 435, -1 }, /* (470) table_reference ::= table_primary */ - { 435, -1 }, /* (471) table_reference ::= joined_table */ - { 436, -2 }, /* (472) table_primary ::= table_name alias_opt */ - { 436, -4 }, /* (473) table_primary ::= db_name NK_DOT table_name alias_opt */ - { 436, -2 }, /* (474) table_primary ::= subquery alias_opt */ - { 436, -1 }, /* (475) table_primary ::= parenthesized_joined_table */ - { 438, 0 }, /* (476) alias_opt ::= */ - { 438, -1 }, /* (477) alias_opt ::= table_alias */ - { 438, -2 }, /* (478) alias_opt ::= AS table_alias */ - { 440, -3 }, /* (479) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ - { 440, -3 }, /* (480) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ - { 437, -6 }, /* (481) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ - { 441, 0 }, /* (482) join_type ::= */ - { 441, -1 }, /* (483) join_type ::= INNER */ - { 443, -12 }, /* (484) 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 */ - { 444, 0 }, /* (485) set_quantifier_opt ::= */ - { 444, -1 }, /* (486) set_quantifier_opt ::= DISTINCT */ - { 444, -1 }, /* (487) set_quantifier_opt ::= ALL */ - { 445, -1 }, /* (488) select_list ::= select_item */ - { 445, -3 }, /* (489) select_list ::= select_list NK_COMMA select_item */ - { 453, -1 }, /* (490) select_item ::= NK_STAR */ - { 453, -1 }, /* (491) select_item ::= common_expression */ - { 453, -2 }, /* (492) select_item ::= common_expression column_alias */ - { 453, -3 }, /* (493) select_item ::= common_expression AS column_alias */ - { 453, -3 }, /* (494) select_item ::= table_name NK_DOT NK_STAR */ - { 408, 0 }, /* (495) where_clause_opt ::= */ - { 408, -2 }, /* (496) where_clause_opt ::= WHERE search_condition */ - { 446, 0 }, /* (497) partition_by_clause_opt ::= */ - { 446, -3 }, /* (498) partition_by_clause_opt ::= PARTITION BY partition_list */ - { 454, -1 }, /* (499) partition_list ::= partition_item */ - { 454, -3 }, /* (500) partition_list ::= partition_list NK_COMMA partition_item */ - { 455, -1 }, /* (501) partition_item ::= expr_or_subquery */ - { 455, -2 }, /* (502) partition_item ::= expr_or_subquery column_alias */ - { 455, -3 }, /* (503) partition_item ::= expr_or_subquery AS column_alias */ - { 450, 0 }, /* (504) twindow_clause_opt ::= */ - { 450, -6 }, /* (505) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ - { 450, -4 }, /* (506) twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ - { 450, -6 }, /* (507) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ - { 450, -8 }, /* (508) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ - { 450, -7 }, /* (509) twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ - { 390, 0 }, /* (510) sliding_opt ::= */ - { 390, -4 }, /* (511) sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ - { 449, 0 }, /* (512) fill_opt ::= */ - { 449, -4 }, /* (513) fill_opt ::= FILL NK_LP fill_mode NK_RP */ - { 449, -6 }, /* (514) fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ - { 449, -6 }, /* (515) fill_opt ::= FILL NK_LP VALUE_F NK_COMMA literal_list NK_RP */ - { 456, -1 }, /* (516) fill_mode ::= NONE */ - { 456, -1 }, /* (517) fill_mode ::= PREV */ - { 456, -1 }, /* (518) fill_mode ::= NULL */ - { 456, -1 }, /* (519) fill_mode ::= NULL_F */ - { 456, -1 }, /* (520) fill_mode ::= LINEAR */ - { 456, -1 }, /* (521) fill_mode ::= NEXT */ - { 451, 0 }, /* (522) group_by_clause_opt ::= */ - { 451, -3 }, /* (523) group_by_clause_opt ::= GROUP BY group_by_list */ - { 457, -1 }, /* (524) group_by_list ::= expr_or_subquery */ - { 457, -3 }, /* (525) group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ - { 452, 0 }, /* (526) having_clause_opt ::= */ - { 452, -2 }, /* (527) having_clause_opt ::= HAVING search_condition */ - { 447, 0 }, /* (528) range_opt ::= */ - { 447, -6 }, /* (529) range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ - { 448, 0 }, /* (530) every_opt ::= */ - { 448, -4 }, /* (531) every_opt ::= EVERY NK_LP duration_literal NK_RP */ - { 458, -4 }, /* (532) query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ - { 459, -1 }, /* (533) query_simple ::= query_specification */ - { 459, -1 }, /* (534) query_simple ::= union_query_expression */ - { 463, -4 }, /* (535) union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ - { 463, -3 }, /* (536) union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ - { 464, -1 }, /* (537) query_simple_or_subquery ::= query_simple */ - { 464, -1 }, /* (538) query_simple_or_subquery ::= subquery */ - { 394, -1 }, /* (539) query_or_subquery ::= query_expression */ - { 394, -1 }, /* (540) query_or_subquery ::= subquery */ - { 460, 0 }, /* (541) order_by_clause_opt ::= */ - { 460, -3 }, /* (542) order_by_clause_opt ::= ORDER BY sort_specification_list */ - { 461, 0 }, /* (543) slimit_clause_opt ::= */ - { 461, -2 }, /* (544) slimit_clause_opt ::= SLIMIT NK_INTEGER */ - { 461, -4 }, /* (545) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ - { 461, -4 }, /* (546) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - { 462, 0 }, /* (547) limit_clause_opt ::= */ - { 462, -2 }, /* (548) limit_clause_opt ::= LIMIT NK_INTEGER */ - { 462, -4 }, /* (549) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ - { 462, -4 }, /* (550) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - { 439, -3 }, /* (551) subquery ::= NK_LP query_expression NK_RP */ - { 439, -3 }, /* (552) subquery ::= NK_LP subquery NK_RP */ - { 442, -1 }, /* (553) search_condition ::= common_expression */ - { 465, -1 }, /* (554) sort_specification_list ::= sort_specification */ - { 465, -3 }, /* (555) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ - { 466, -3 }, /* (556) sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ - { 467, 0 }, /* (557) ordering_specification_opt ::= */ - { 467, -1 }, /* (558) ordering_specification_opt ::= ASC */ - { 467, -1 }, /* (559) ordering_specification_opt ::= DESC */ - { 468, 0 }, /* (560) null_ordering_opt ::= */ - { 468, -2 }, /* (561) null_ordering_opt ::= NULLS FIRST */ - { 468, -2 }, /* (562) null_ordering_opt ::= NULLS LAST */ + { 348, 0 }, /* (129) start_opt ::= */ + { 348, -3 }, /* (130) start_opt ::= START WITH NK_INTEGER */ + { 348, -3 }, /* (131) start_opt ::= START WITH NK_STRING */ + { 348, -4 }, /* (132) start_opt ::= START WITH TIMESTAMP NK_STRING */ + { 349, 0 }, /* (133) end_opt ::= */ + { 349, -3 }, /* (134) end_opt ::= END WITH NK_INTEGER */ + { 349, -3 }, /* (135) end_opt ::= END WITH NK_STRING */ + { 349, -4 }, /* (136) end_opt ::= END WITH TIMESTAMP NK_STRING */ + { 328, -9 }, /* (137) cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ + { 328, -3 }, /* (138) cmd ::= CREATE TABLE multi_create_clause */ + { 328, -9 }, /* (139) cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ + { 328, -3 }, /* (140) cmd ::= DROP TABLE multi_drop_clause */ + { 328, -4 }, /* (141) cmd ::= DROP STABLE exists_opt full_table_name */ + { 328, -3 }, /* (142) cmd ::= ALTER TABLE alter_table_clause */ + { 328, -3 }, /* (143) cmd ::= ALTER STABLE alter_table_clause */ + { 362, -2 }, /* (144) alter_table_clause ::= full_table_name alter_table_options */ + { 362, -5 }, /* (145) alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ + { 362, -4 }, /* (146) alter_table_clause ::= full_table_name DROP COLUMN column_name */ + { 362, -5 }, /* (147) alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ + { 362, -5 }, /* (148) alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ + { 362, -5 }, /* (149) alter_table_clause ::= full_table_name ADD TAG column_name type_name */ + { 362, -4 }, /* (150) alter_table_clause ::= full_table_name DROP TAG column_name */ + { 362, -5 }, /* (151) alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ + { 362, -5 }, /* (152) alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ + { 362, -6 }, /* (153) alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */ + { 359, -1 }, /* (154) multi_create_clause ::= create_subtable_clause */ + { 359, -2 }, /* (155) multi_create_clause ::= multi_create_clause create_subtable_clause */ + { 367, -10 }, /* (156) 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 */ + { 361, -1 }, /* (157) multi_drop_clause ::= drop_table_clause */ + { 361, -3 }, /* (158) multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause */ + { 370, -2 }, /* (159) drop_table_clause ::= exists_opt full_table_name */ + { 368, 0 }, /* (160) specific_cols_opt ::= */ + { 368, -3 }, /* (161) specific_cols_opt ::= NK_LP col_name_list NK_RP */ + { 355, -1 }, /* (162) full_table_name ::= table_name */ + { 355, -3 }, /* (163) full_table_name ::= db_name NK_DOT table_name */ + { 356, -1 }, /* (164) column_def_list ::= column_def */ + { 356, -3 }, /* (165) column_def_list ::= column_def_list NK_COMMA column_def */ + { 373, -2 }, /* (166) column_def ::= column_name type_name */ + { 373, -4 }, /* (167) column_def ::= column_name type_name COMMENT NK_STRING */ + { 365, -1 }, /* (168) type_name ::= BOOL */ + { 365, -1 }, /* (169) type_name ::= TINYINT */ + { 365, -1 }, /* (170) type_name ::= SMALLINT */ + { 365, -1 }, /* (171) type_name ::= INT */ + { 365, -1 }, /* (172) type_name ::= INTEGER */ + { 365, -1 }, /* (173) type_name ::= BIGINT */ + { 365, -1 }, /* (174) type_name ::= FLOAT */ + { 365, -1 }, /* (175) type_name ::= DOUBLE */ + { 365, -4 }, /* (176) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ + { 365, -1 }, /* (177) type_name ::= TIMESTAMP */ + { 365, -4 }, /* (178) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ + { 365, -2 }, /* (179) type_name ::= TINYINT UNSIGNED */ + { 365, -2 }, /* (180) type_name ::= SMALLINT UNSIGNED */ + { 365, -2 }, /* (181) type_name ::= INT UNSIGNED */ + { 365, -2 }, /* (182) type_name ::= BIGINT UNSIGNED */ + { 365, -1 }, /* (183) type_name ::= JSON */ + { 365, -4 }, /* (184) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ + { 365, -1 }, /* (185) type_name ::= MEDIUMBLOB */ + { 365, -1 }, /* (186) type_name ::= BLOB */ + { 365, -4 }, /* (187) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ + { 365, -1 }, /* (188) type_name ::= DECIMAL */ + { 365, -4 }, /* (189) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ + { 365, -6 }, /* (190) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ + { 357, 0 }, /* (191) tags_def_opt ::= */ + { 357, -1 }, /* (192) tags_def_opt ::= tags_def */ + { 360, -4 }, /* (193) tags_def ::= TAGS NK_LP column_def_list NK_RP */ + { 358, 0 }, /* (194) table_options ::= */ + { 358, -3 }, /* (195) table_options ::= table_options COMMENT NK_STRING */ + { 358, -3 }, /* (196) table_options ::= table_options MAX_DELAY duration_list */ + { 358, -3 }, /* (197) table_options ::= table_options WATERMARK duration_list */ + { 358, -5 }, /* (198) table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ + { 358, -3 }, /* (199) table_options ::= table_options TTL NK_INTEGER */ + { 358, -5 }, /* (200) table_options ::= table_options SMA NK_LP col_name_list NK_RP */ + { 358, -3 }, /* (201) table_options ::= table_options DELETE_MARK duration_list */ + { 363, -1 }, /* (202) alter_table_options ::= alter_table_option */ + { 363, -2 }, /* (203) alter_table_options ::= alter_table_options alter_table_option */ + { 376, -2 }, /* (204) alter_table_option ::= COMMENT NK_STRING */ + { 376, -2 }, /* (205) alter_table_option ::= TTL NK_INTEGER */ + { 374, -1 }, /* (206) duration_list ::= duration_literal */ + { 374, -3 }, /* (207) duration_list ::= duration_list NK_COMMA duration_literal */ + { 375, -1 }, /* (208) rollup_func_list ::= rollup_func_name */ + { 375, -3 }, /* (209) rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ + { 378, -1 }, /* (210) rollup_func_name ::= function_name */ + { 378, -1 }, /* (211) rollup_func_name ::= FIRST */ + { 378, -1 }, /* (212) rollup_func_name ::= LAST */ + { 371, -1 }, /* (213) col_name_list ::= col_name */ + { 371, -3 }, /* (214) col_name_list ::= col_name_list NK_COMMA col_name */ + { 380, -1 }, /* (215) col_name ::= column_name */ + { 328, -2 }, /* (216) cmd ::= SHOW DNODES */ + { 328, -2 }, /* (217) cmd ::= SHOW USERS */ + { 328, -3 }, /* (218) cmd ::= SHOW USER PRIVILEGES */ + { 328, -2 }, /* (219) cmd ::= SHOW DATABASES */ + { 328, -4 }, /* (220) cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */ + { 328, -4 }, /* (221) cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ + { 328, -3 }, /* (222) cmd ::= SHOW db_name_cond_opt VGROUPS */ + { 328, -2 }, /* (223) cmd ::= SHOW MNODES */ + { 328, -2 }, /* (224) cmd ::= SHOW QNODES */ + { 328, -2 }, /* (225) cmd ::= SHOW FUNCTIONS */ + { 328, -5 }, /* (226) cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ + { 328, -2 }, /* (227) cmd ::= SHOW STREAMS */ + { 328, -2 }, /* (228) cmd ::= SHOW ACCOUNTS */ + { 328, -2 }, /* (229) cmd ::= SHOW APPS */ + { 328, -2 }, /* (230) cmd ::= SHOW CONNECTIONS */ + { 328, -2 }, /* (231) cmd ::= SHOW LICENCES */ + { 328, -2 }, /* (232) cmd ::= SHOW GRANTS */ + { 328, -4 }, /* (233) cmd ::= SHOW CREATE DATABASE db_name */ + { 328, -4 }, /* (234) cmd ::= SHOW CREATE TABLE full_table_name */ + { 328, -4 }, /* (235) cmd ::= SHOW CREATE STABLE full_table_name */ + { 328, -2 }, /* (236) cmd ::= SHOW QUERIES */ + { 328, -2 }, /* (237) cmd ::= SHOW SCORES */ + { 328, -2 }, /* (238) cmd ::= SHOW TOPICS */ + { 328, -2 }, /* (239) cmd ::= SHOW VARIABLES */ + { 328, -3 }, /* (240) cmd ::= SHOW CLUSTER VARIABLES */ + { 328, -3 }, /* (241) cmd ::= SHOW LOCAL VARIABLES */ + { 328, -5 }, /* (242) cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt */ + { 328, -2 }, /* (243) cmd ::= SHOW BNODES */ + { 328, -2 }, /* (244) cmd ::= SHOW SNODES */ + { 328, -2 }, /* (245) cmd ::= SHOW CLUSTER */ + { 328, -2 }, /* (246) cmd ::= SHOW TRANSACTIONS */ + { 328, -4 }, /* (247) cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ + { 328, -2 }, /* (248) cmd ::= SHOW CONSUMERS */ + { 328, -2 }, /* (249) cmd ::= SHOW SUBSCRIPTIONS */ + { 328, -5 }, /* (250) cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */ + { 328, -7 }, /* (251) cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */ + { 328, -3 }, /* (252) cmd ::= SHOW VNODES NK_INTEGER */ + { 328, -3 }, /* (253) cmd ::= SHOW VNODES NK_STRING */ + { 328, -3 }, /* (254) cmd ::= SHOW db_name_cond_opt ALIVE */ + { 328, -3 }, /* (255) cmd ::= SHOW CLUSTER ALIVE */ + { 381, 0 }, /* (256) db_name_cond_opt ::= */ + { 381, -2 }, /* (257) db_name_cond_opt ::= db_name NK_DOT */ + { 382, 0 }, /* (258) like_pattern_opt ::= */ + { 382, -2 }, /* (259) like_pattern_opt ::= LIKE NK_STRING */ + { 383, -1 }, /* (260) table_name_cond ::= table_name */ + { 384, 0 }, /* (261) from_db_opt ::= */ + { 384, -2 }, /* (262) from_db_opt ::= FROM db_name */ + { 385, 0 }, /* (263) tag_list_opt ::= */ + { 385, -1 }, /* (264) tag_list_opt ::= tag_item */ + { 385, -3 }, /* (265) tag_list_opt ::= tag_list_opt NK_COMMA tag_item */ + { 386, -1 }, /* (266) tag_item ::= TBNAME */ + { 386, -1 }, /* (267) tag_item ::= QTAGS */ + { 386, -1 }, /* (268) tag_item ::= column_name */ + { 386, -2 }, /* (269) tag_item ::= column_name column_alias */ + { 386, -3 }, /* (270) tag_item ::= column_name AS column_alias */ + { 328, -8 }, /* (271) cmd ::= CREATE SMA INDEX not_exists_opt full_index_name ON full_table_name index_options */ + { 328, -9 }, /* (272) cmd ::= CREATE INDEX not_exists_opt full_index_name ON full_table_name NK_LP col_name_list NK_RP */ + { 328, -4 }, /* (273) cmd ::= DROP INDEX exists_opt full_index_name */ + { 388, -1 }, /* (274) full_index_name ::= index_name */ + { 388, -3 }, /* (275) full_index_name ::= db_name NK_DOT index_name */ + { 389, -10 }, /* (276) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ + { 389, -12 }, /* (277) 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 */ + { 391, -1 }, /* (278) func_list ::= func */ + { 391, -3 }, /* (279) func_list ::= func_list NK_COMMA func */ + { 394, -4 }, /* (280) func ::= sma_func_name NK_LP expression_list NK_RP */ + { 395, -1 }, /* (281) sma_func_name ::= function_name */ + { 395, -1 }, /* (282) sma_func_name ::= COUNT */ + { 395, -1 }, /* (283) sma_func_name ::= FIRST */ + { 395, -1 }, /* (284) sma_func_name ::= LAST */ + { 395, -1 }, /* (285) sma_func_name ::= LAST_ROW */ + { 393, 0 }, /* (286) sma_stream_opt ::= */ + { 393, -3 }, /* (287) sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */ + { 393, -3 }, /* (288) sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */ + { 393, -3 }, /* (289) sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */ + { 328, -6 }, /* (290) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ + { 328, -7 }, /* (291) cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name */ + { 328, -9 }, /* (292) cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name */ + { 328, -7 }, /* (293) cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name */ + { 328, -9 }, /* (294) cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name */ + { 328, -4 }, /* (295) cmd ::= DROP TOPIC exists_opt topic_name */ + { 328, -7 }, /* (296) cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ + { 328, -2 }, /* (297) cmd ::= DESC full_table_name */ + { 328, -2 }, /* (298) cmd ::= DESCRIBE full_table_name */ + { 328, -3 }, /* (299) cmd ::= RESET QUERY CACHE */ + { 328, -4 }, /* (300) cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ + { 328, -4 }, /* (301) cmd ::= EXPLAIN analyze_opt explain_options insert_query */ + { 398, 0 }, /* (302) analyze_opt ::= */ + { 398, -1 }, /* (303) analyze_opt ::= ANALYZE */ + { 399, 0 }, /* (304) explain_options ::= */ + { 399, -3 }, /* (305) explain_options ::= explain_options VERBOSE NK_BOOL */ + { 399, -3 }, /* (306) explain_options ::= explain_options RATIO NK_FLOAT */ + { 328, -10 }, /* (307) cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt */ + { 328, -4 }, /* (308) cmd ::= DROP FUNCTION exists_opt function_name */ + { 401, 0 }, /* (309) agg_func_opt ::= */ + { 401, -1 }, /* (310) agg_func_opt ::= AGGREGATE */ + { 402, 0 }, /* (311) bufsize_opt ::= */ + { 402, -2 }, /* (312) bufsize_opt ::= BUFSIZE NK_INTEGER */ + { 328, -12 }, /* (313) 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 */ + { 328, -4 }, /* (314) cmd ::= DROP STREAM exists_opt stream_name */ + { 405, 0 }, /* (315) col_list_opt ::= */ + { 405, -3 }, /* (316) col_list_opt ::= NK_LP col_name_list NK_RP */ + { 406, 0 }, /* (317) tag_def_or_ref_opt ::= */ + { 406, -1 }, /* (318) tag_def_or_ref_opt ::= tags_def */ + { 406, -4 }, /* (319) tag_def_or_ref_opt ::= TAGS NK_LP col_name_list NK_RP */ + { 404, 0 }, /* (320) stream_options ::= */ + { 404, -3 }, /* (321) stream_options ::= stream_options TRIGGER AT_ONCE */ + { 404, -3 }, /* (322) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ + { 404, -4 }, /* (323) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ + { 404, -3 }, /* (324) stream_options ::= stream_options WATERMARK duration_literal */ + { 404, -4 }, /* (325) stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ + { 404, -3 }, /* (326) stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ + { 404, -3 }, /* (327) stream_options ::= stream_options DELETE_MARK duration_literal */ + { 404, -4 }, /* (328) stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */ + { 407, 0 }, /* (329) subtable_opt ::= */ + { 407, -4 }, /* (330) subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ + { 328, -3 }, /* (331) cmd ::= KILL CONNECTION NK_INTEGER */ + { 328, -3 }, /* (332) cmd ::= KILL QUERY NK_STRING */ + { 328, -3 }, /* (333) cmd ::= KILL TRANSACTION NK_INTEGER */ + { 328, -2 }, /* (334) cmd ::= BALANCE VGROUP */ + { 328, -4 }, /* (335) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ + { 328, -4 }, /* (336) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ + { 328, -3 }, /* (337) cmd ::= SPLIT VGROUP NK_INTEGER */ + { 409, -2 }, /* (338) dnode_list ::= DNODE NK_INTEGER */ + { 409, -3 }, /* (339) dnode_list ::= dnode_list DNODE NK_INTEGER */ + { 328, -4 }, /* (340) cmd ::= DELETE FROM full_table_name where_clause_opt */ + { 328, -1 }, /* (341) cmd ::= query_or_subquery */ + { 328, -1 }, /* (342) cmd ::= insert_query */ + { 400, -7 }, /* (343) insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ + { 400, -4 }, /* (344) insert_query ::= INSERT INTO full_table_name query_or_subquery */ + { 331, -1 }, /* (345) literal ::= NK_INTEGER */ + { 331, -1 }, /* (346) literal ::= NK_FLOAT */ + { 331, -1 }, /* (347) literal ::= NK_STRING */ + { 331, -1 }, /* (348) literal ::= NK_BOOL */ + { 331, -2 }, /* (349) literal ::= TIMESTAMP NK_STRING */ + { 331, -1 }, /* (350) literal ::= duration_literal */ + { 331, -1 }, /* (351) literal ::= NULL */ + { 331, -1 }, /* (352) literal ::= NK_QUESTION */ + { 377, -1 }, /* (353) duration_literal ::= NK_VARIABLE */ + { 411, -1 }, /* (354) signed ::= NK_INTEGER */ + { 411, -2 }, /* (355) signed ::= NK_PLUS NK_INTEGER */ + { 411, -2 }, /* (356) signed ::= NK_MINUS NK_INTEGER */ + { 411, -1 }, /* (357) signed ::= NK_FLOAT */ + { 411, -2 }, /* (358) signed ::= NK_PLUS NK_FLOAT */ + { 411, -2 }, /* (359) signed ::= NK_MINUS NK_FLOAT */ + { 366, -1 }, /* (360) signed_literal ::= signed */ + { 366, -1 }, /* (361) signed_literal ::= NK_STRING */ + { 366, -1 }, /* (362) signed_literal ::= NK_BOOL */ + { 366, -2 }, /* (363) signed_literal ::= TIMESTAMP NK_STRING */ + { 366, -1 }, /* (364) signed_literal ::= duration_literal */ + { 366, -1 }, /* (365) signed_literal ::= NULL */ + { 366, -1 }, /* (366) signed_literal ::= literal_func */ + { 366, -1 }, /* (367) signed_literal ::= NK_QUESTION */ + { 413, -1 }, /* (368) literal_list ::= signed_literal */ + { 413, -3 }, /* (369) literal_list ::= literal_list NK_COMMA signed_literal */ + { 339, -1 }, /* (370) db_name ::= NK_ID */ + { 372, -1 }, /* (371) table_name ::= NK_ID */ + { 364, -1 }, /* (372) column_name ::= NK_ID */ + { 379, -1 }, /* (373) function_name ::= NK_ID */ + { 414, -1 }, /* (374) table_alias ::= NK_ID */ + { 387, -1 }, /* (375) column_alias ::= NK_ID */ + { 333, -1 }, /* (376) user_name ::= NK_ID */ + { 340, -1 }, /* (377) topic_name ::= NK_ID */ + { 403, -1 }, /* (378) stream_name ::= NK_ID */ + { 397, -1 }, /* (379) cgroup_name ::= NK_ID */ + { 390, -1 }, /* (380) index_name ::= NK_ID */ + { 415, -1 }, /* (381) expr_or_subquery ::= expression */ + { 408, -1 }, /* (382) expression ::= literal */ + { 408, -1 }, /* (383) expression ::= pseudo_column */ + { 408, -1 }, /* (384) expression ::= column_reference */ + { 408, -1 }, /* (385) expression ::= function_expression */ + { 408, -1 }, /* (386) expression ::= case_when_expression */ + { 408, -3 }, /* (387) expression ::= NK_LP expression NK_RP */ + { 408, -2 }, /* (388) expression ::= NK_PLUS expr_or_subquery */ + { 408, -2 }, /* (389) expression ::= NK_MINUS expr_or_subquery */ + { 408, -3 }, /* (390) expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ + { 408, -3 }, /* (391) expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ + { 408, -3 }, /* (392) expression ::= expr_or_subquery NK_STAR expr_or_subquery */ + { 408, -3 }, /* (393) expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ + { 408, -3 }, /* (394) expression ::= expr_or_subquery NK_REM expr_or_subquery */ + { 408, -3 }, /* (395) expression ::= column_reference NK_ARROW NK_STRING */ + { 408, -3 }, /* (396) expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ + { 408, -3 }, /* (397) expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ + { 369, -1 }, /* (398) expression_list ::= expr_or_subquery */ + { 369, -3 }, /* (399) expression_list ::= expression_list NK_COMMA expr_or_subquery */ + { 417, -1 }, /* (400) column_reference ::= column_name */ + { 417, -3 }, /* (401) column_reference ::= table_name NK_DOT column_name */ + { 416, -1 }, /* (402) pseudo_column ::= ROWTS */ + { 416, -1 }, /* (403) pseudo_column ::= TBNAME */ + { 416, -3 }, /* (404) pseudo_column ::= table_name NK_DOT TBNAME */ + { 416, -1 }, /* (405) pseudo_column ::= QSTART */ + { 416, -1 }, /* (406) pseudo_column ::= QEND */ + { 416, -1 }, /* (407) pseudo_column ::= QDURATION */ + { 416, -1 }, /* (408) pseudo_column ::= WSTART */ + { 416, -1 }, /* (409) pseudo_column ::= WEND */ + { 416, -1 }, /* (410) pseudo_column ::= WDURATION */ + { 416, -1 }, /* (411) pseudo_column ::= IROWTS */ + { 416, -1 }, /* (412) pseudo_column ::= ISFILLED */ + { 416, -1 }, /* (413) pseudo_column ::= QTAGS */ + { 418, -4 }, /* (414) function_expression ::= function_name NK_LP expression_list NK_RP */ + { 418, -4 }, /* (415) function_expression ::= star_func NK_LP star_func_para_list NK_RP */ + { 418, -6 }, /* (416) function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ + { 418, -1 }, /* (417) function_expression ::= literal_func */ + { 412, -3 }, /* (418) literal_func ::= noarg_func NK_LP NK_RP */ + { 412, -1 }, /* (419) literal_func ::= NOW */ + { 422, -1 }, /* (420) noarg_func ::= NOW */ + { 422, -1 }, /* (421) noarg_func ::= TODAY */ + { 422, -1 }, /* (422) noarg_func ::= TIMEZONE */ + { 422, -1 }, /* (423) noarg_func ::= DATABASE */ + { 422, -1 }, /* (424) noarg_func ::= CLIENT_VERSION */ + { 422, -1 }, /* (425) noarg_func ::= SERVER_VERSION */ + { 422, -1 }, /* (426) noarg_func ::= SERVER_STATUS */ + { 422, -1 }, /* (427) noarg_func ::= CURRENT_USER */ + { 422, -1 }, /* (428) noarg_func ::= USER */ + { 420, -1 }, /* (429) star_func ::= COUNT */ + { 420, -1 }, /* (430) star_func ::= FIRST */ + { 420, -1 }, /* (431) star_func ::= LAST */ + { 420, -1 }, /* (432) star_func ::= LAST_ROW */ + { 421, -1 }, /* (433) star_func_para_list ::= NK_STAR */ + { 421, -1 }, /* (434) star_func_para_list ::= other_para_list */ + { 423, -1 }, /* (435) other_para_list ::= star_func_para */ + { 423, -3 }, /* (436) other_para_list ::= other_para_list NK_COMMA star_func_para */ + { 424, -1 }, /* (437) star_func_para ::= expr_or_subquery */ + { 424, -3 }, /* (438) star_func_para ::= table_name NK_DOT NK_STAR */ + { 419, -4 }, /* (439) case_when_expression ::= CASE when_then_list case_when_else_opt END */ + { 419, -5 }, /* (440) case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ + { 425, -1 }, /* (441) when_then_list ::= when_then_expr */ + { 425, -2 }, /* (442) when_then_list ::= when_then_list when_then_expr */ + { 428, -4 }, /* (443) when_then_expr ::= WHEN common_expression THEN common_expression */ + { 426, 0 }, /* (444) case_when_else_opt ::= */ + { 426, -2 }, /* (445) case_when_else_opt ::= ELSE common_expression */ + { 429, -3 }, /* (446) predicate ::= expr_or_subquery compare_op expr_or_subquery */ + { 429, -5 }, /* (447) predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ + { 429, -6 }, /* (448) predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ + { 429, -3 }, /* (449) predicate ::= expr_or_subquery IS NULL */ + { 429, -4 }, /* (450) predicate ::= expr_or_subquery IS NOT NULL */ + { 429, -3 }, /* (451) predicate ::= expr_or_subquery in_op in_predicate_value */ + { 430, -1 }, /* (452) compare_op ::= NK_LT */ + { 430, -1 }, /* (453) compare_op ::= NK_GT */ + { 430, -1 }, /* (454) compare_op ::= NK_LE */ + { 430, -1 }, /* (455) compare_op ::= NK_GE */ + { 430, -1 }, /* (456) compare_op ::= NK_NE */ + { 430, -1 }, /* (457) compare_op ::= NK_EQ */ + { 430, -1 }, /* (458) compare_op ::= LIKE */ + { 430, -2 }, /* (459) compare_op ::= NOT LIKE */ + { 430, -1 }, /* (460) compare_op ::= MATCH */ + { 430, -1 }, /* (461) compare_op ::= NMATCH */ + { 430, -1 }, /* (462) compare_op ::= CONTAINS */ + { 431, -1 }, /* (463) in_op ::= IN */ + { 431, -2 }, /* (464) in_op ::= NOT IN */ + { 432, -3 }, /* (465) in_predicate_value ::= NK_LP literal_list NK_RP */ + { 433, -1 }, /* (466) boolean_value_expression ::= boolean_primary */ + { 433, -2 }, /* (467) boolean_value_expression ::= NOT boolean_primary */ + { 433, -3 }, /* (468) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ + { 433, -3 }, /* (469) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ + { 434, -1 }, /* (470) boolean_primary ::= predicate */ + { 434, -3 }, /* (471) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ + { 427, -1 }, /* (472) common_expression ::= expr_or_subquery */ + { 427, -1 }, /* (473) common_expression ::= boolean_value_expression */ + { 435, 0 }, /* (474) from_clause_opt ::= */ + { 435, -2 }, /* (475) from_clause_opt ::= FROM table_reference_list */ + { 436, -1 }, /* (476) table_reference_list ::= table_reference */ + { 436, -3 }, /* (477) table_reference_list ::= table_reference_list NK_COMMA table_reference */ + { 437, -1 }, /* (478) table_reference ::= table_primary */ + { 437, -1 }, /* (479) table_reference ::= joined_table */ + { 438, -2 }, /* (480) table_primary ::= table_name alias_opt */ + { 438, -4 }, /* (481) table_primary ::= db_name NK_DOT table_name alias_opt */ + { 438, -2 }, /* (482) table_primary ::= subquery alias_opt */ + { 438, -1 }, /* (483) table_primary ::= parenthesized_joined_table */ + { 440, 0 }, /* (484) alias_opt ::= */ + { 440, -1 }, /* (485) alias_opt ::= table_alias */ + { 440, -2 }, /* (486) alias_opt ::= AS table_alias */ + { 442, -3 }, /* (487) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ + { 442, -3 }, /* (488) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ + { 439, -6 }, /* (489) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ + { 443, 0 }, /* (490) join_type ::= */ + { 443, -1 }, /* (491) join_type ::= INNER */ + { 445, -12 }, /* (492) 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 */ + { 446, 0 }, /* (493) set_quantifier_opt ::= */ + { 446, -1 }, /* (494) set_quantifier_opt ::= DISTINCT */ + { 446, -1 }, /* (495) set_quantifier_opt ::= ALL */ + { 447, -1 }, /* (496) select_list ::= select_item */ + { 447, -3 }, /* (497) select_list ::= select_list NK_COMMA select_item */ + { 455, -1 }, /* (498) select_item ::= NK_STAR */ + { 455, -1 }, /* (499) select_item ::= common_expression */ + { 455, -2 }, /* (500) select_item ::= common_expression column_alias */ + { 455, -3 }, /* (501) select_item ::= common_expression AS column_alias */ + { 455, -3 }, /* (502) select_item ::= table_name NK_DOT NK_STAR */ + { 410, 0 }, /* (503) where_clause_opt ::= */ + { 410, -2 }, /* (504) where_clause_opt ::= WHERE search_condition */ + { 448, 0 }, /* (505) partition_by_clause_opt ::= */ + { 448, -3 }, /* (506) partition_by_clause_opt ::= PARTITION BY partition_list */ + { 456, -1 }, /* (507) partition_list ::= partition_item */ + { 456, -3 }, /* (508) partition_list ::= partition_list NK_COMMA partition_item */ + { 457, -1 }, /* (509) partition_item ::= expr_or_subquery */ + { 457, -2 }, /* (510) partition_item ::= expr_or_subquery column_alias */ + { 457, -3 }, /* (511) partition_item ::= expr_or_subquery AS column_alias */ + { 452, 0 }, /* (512) twindow_clause_opt ::= */ + { 452, -6 }, /* (513) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ + { 452, -4 }, /* (514) twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ + { 452, -6 }, /* (515) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ + { 452, -8 }, /* (516) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ + { 452, -7 }, /* (517) twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ + { 392, 0 }, /* (518) sliding_opt ::= */ + { 392, -4 }, /* (519) sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ + { 451, 0 }, /* (520) fill_opt ::= */ + { 451, -4 }, /* (521) fill_opt ::= FILL NK_LP fill_mode NK_RP */ + { 451, -6 }, /* (522) fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ + { 451, -6 }, /* (523) fill_opt ::= FILL NK_LP VALUE_F NK_COMMA literal_list NK_RP */ + { 458, -1 }, /* (524) fill_mode ::= NONE */ + { 458, -1 }, /* (525) fill_mode ::= PREV */ + { 458, -1 }, /* (526) fill_mode ::= NULL */ + { 458, -1 }, /* (527) fill_mode ::= NULL_F */ + { 458, -1 }, /* (528) fill_mode ::= LINEAR */ + { 458, -1 }, /* (529) fill_mode ::= NEXT */ + { 453, 0 }, /* (530) group_by_clause_opt ::= */ + { 453, -3 }, /* (531) group_by_clause_opt ::= GROUP BY group_by_list */ + { 459, -1 }, /* (532) group_by_list ::= expr_or_subquery */ + { 459, -3 }, /* (533) group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ + { 454, 0 }, /* (534) having_clause_opt ::= */ + { 454, -2 }, /* (535) having_clause_opt ::= HAVING search_condition */ + { 449, 0 }, /* (536) range_opt ::= */ + { 449, -6 }, /* (537) range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ + { 450, 0 }, /* (538) every_opt ::= */ + { 450, -4 }, /* (539) every_opt ::= EVERY NK_LP duration_literal NK_RP */ + { 460, -4 }, /* (540) query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ + { 461, -1 }, /* (541) query_simple ::= query_specification */ + { 461, -1 }, /* (542) query_simple ::= union_query_expression */ + { 465, -4 }, /* (543) union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ + { 465, -3 }, /* (544) union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ + { 466, -1 }, /* (545) query_simple_or_subquery ::= query_simple */ + { 466, -1 }, /* (546) query_simple_or_subquery ::= subquery */ + { 396, -1 }, /* (547) query_or_subquery ::= query_expression */ + { 396, -1 }, /* (548) query_or_subquery ::= subquery */ + { 462, 0 }, /* (549) order_by_clause_opt ::= */ + { 462, -3 }, /* (550) order_by_clause_opt ::= ORDER BY sort_specification_list */ + { 463, 0 }, /* (551) slimit_clause_opt ::= */ + { 463, -2 }, /* (552) slimit_clause_opt ::= SLIMIT NK_INTEGER */ + { 463, -4 }, /* (553) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ + { 463, -4 }, /* (554) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + { 464, 0 }, /* (555) limit_clause_opt ::= */ + { 464, -2 }, /* (556) limit_clause_opt ::= LIMIT NK_INTEGER */ + { 464, -4 }, /* (557) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ + { 464, -4 }, /* (558) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + { 441, -3 }, /* (559) subquery ::= NK_LP query_expression NK_RP */ + { 441, -3 }, /* (560) subquery ::= NK_LP subquery NK_RP */ + { 444, -1 }, /* (561) search_condition ::= common_expression */ + { 467, -1 }, /* (562) sort_specification_list ::= sort_specification */ + { 467, -3 }, /* (563) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ + { 468, -3 }, /* (564) sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ + { 469, 0 }, /* (565) ordering_specification_opt ::= */ + { 469, -1 }, /* (566) ordering_specification_opt ::= ASC */ + { 469, -1 }, /* (567) ordering_specification_opt ::= DESC */ + { 470, 0 }, /* (568) null_ordering_opt ::= */ + { 470, -2 }, /* (569) null_ordering_opt ::= NULLS FIRST */ + { 470, -2 }, /* (570) null_ordering_opt ::= NULLS LAST */ }; static void yy_accept(yyParser*); /* Forward Declaration */ @@ -3752,78 +3758,78 @@ static YYACTIONTYPE yy_reduce( yy_destructor(yypParser,331,&yymsp[0].minor); break; case 24: /* cmd ::= CREATE USER user_name PASS NK_STRING sysinfo_opt */ -{ pCxt->pRootNode = createCreateUserStmt(pCxt, &yymsp[-3].minor.yy225, &yymsp[-1].minor.yy0, yymsp[0].minor.yy705); } +{ pCxt->pRootNode = createCreateUserStmt(pCxt, &yymsp[-3].minor.yy881, &yymsp[-1].minor.yy0, yymsp[0].minor.yy857); } break; case 25: /* cmd ::= ALTER USER user_name PASS NK_STRING */ -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy225, TSDB_ALTER_USER_PASSWD, &yymsp[0].minor.yy0); } +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy881, 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.yy225, TSDB_ALTER_USER_ENABLE, &yymsp[0].minor.yy0); } +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy881, 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.yy225, TSDB_ALTER_USER_SYSINFO, &yymsp[0].minor.yy0); } +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy881, TSDB_ALTER_USER_SYSINFO, &yymsp[0].minor.yy0); } break; case 28: /* cmd ::= DROP USER user_name */ -{ pCxt->pRootNode = createDropUserStmt(pCxt, &yymsp[0].minor.yy225); } +{ pCxt->pRootNode = createDropUserStmt(pCxt, &yymsp[0].minor.yy881); } break; case 29: /* sysinfo_opt ::= */ -{ yymsp[1].minor.yy705 = 1; } +{ yymsp[1].minor.yy857 = 1; } break; case 30: /* sysinfo_opt ::= SYSINFO NK_INTEGER */ -{ yymsp[-1].minor.yy705 = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); } +{ yymsp[-1].minor.yy857 = 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.yy641, &yymsp[-2].minor.yy225, &yymsp[0].minor.yy225); } +{ pCxt->pRootNode = createGrantStmt(pCxt, yymsp[-4].minor.yy303, &yymsp[-2].minor.yy881, &yymsp[0].minor.yy881); } break; case 32: /* cmd ::= REVOKE privileges ON priv_level FROM user_name */ -{ pCxt->pRootNode = createRevokeStmt(pCxt, yymsp[-4].minor.yy641, &yymsp[-2].minor.yy225, &yymsp[0].minor.yy225); } +{ pCxt->pRootNode = createRevokeStmt(pCxt, yymsp[-4].minor.yy303, &yymsp[-2].minor.yy881, &yymsp[0].minor.yy881); } break; case 33: /* privileges ::= ALL */ -{ yymsp[0].minor.yy641 = PRIVILEGE_TYPE_ALL; } +{ yymsp[0].minor.yy303 = PRIVILEGE_TYPE_ALL; } break; case 34: /* privileges ::= priv_type_list */ case 36: /* priv_type_list ::= priv_type */ yytestcase(yyruleno==36); -{ yylhsminor.yy641 = yymsp[0].minor.yy641; } - yymsp[0].minor.yy641 = yylhsminor.yy641; +{ yylhsminor.yy303 = yymsp[0].minor.yy303; } + yymsp[0].minor.yy303 = yylhsminor.yy303; break; case 35: /* privileges ::= SUBSCRIBE */ -{ yymsp[0].minor.yy641 = PRIVILEGE_TYPE_SUBSCRIBE; } +{ yymsp[0].minor.yy303 = PRIVILEGE_TYPE_SUBSCRIBE; } break; case 37: /* priv_type_list ::= priv_type_list NK_COMMA priv_type */ -{ yylhsminor.yy641 = yymsp[-2].minor.yy641 | yymsp[0].minor.yy641; } - yymsp[-2].minor.yy641 = yylhsminor.yy641; +{ yylhsminor.yy303 = yymsp[-2].minor.yy303 | yymsp[0].minor.yy303; } + yymsp[-2].minor.yy303 = yylhsminor.yy303; break; case 38: /* priv_type ::= READ */ -{ yymsp[0].minor.yy641 = PRIVILEGE_TYPE_READ; } +{ yymsp[0].minor.yy303 = PRIVILEGE_TYPE_READ; } break; case 39: /* priv_type ::= WRITE */ -{ yymsp[0].minor.yy641 = PRIVILEGE_TYPE_WRITE; } +{ yymsp[0].minor.yy303 = PRIVILEGE_TYPE_WRITE; } break; case 40: /* priv_level ::= NK_STAR NK_DOT NK_STAR */ -{ yylhsminor.yy225 = yymsp[-2].minor.yy0; } - yymsp[-2].minor.yy225 = yylhsminor.yy225; +{ yylhsminor.yy881 = yymsp[-2].minor.yy0; } + yymsp[-2].minor.yy881 = yylhsminor.yy881; break; case 41: /* priv_level ::= db_name NK_DOT NK_STAR */ -{ yylhsminor.yy225 = yymsp[-2].minor.yy225; } - yymsp[-2].minor.yy225 = yylhsminor.yy225; +{ yylhsminor.yy881 = yymsp[-2].minor.yy881; } + yymsp[-2].minor.yy881 = yylhsminor.yy881; break; case 42: /* priv_level ::= topic_name */ - case 273: /* sma_func_name ::= function_name */ yytestcase(yyruleno==273); - case 477: /* alias_opt ::= table_alias */ yytestcase(yyruleno==477); -{ yylhsminor.yy225 = yymsp[0].minor.yy225; } - yymsp[0].minor.yy225 = yylhsminor.yy225; + case 281: /* sma_func_name ::= function_name */ yytestcase(yyruleno==281); + case 485: /* alias_opt ::= table_alias */ yytestcase(yyruleno==485); +{ yylhsminor.yy881 = yymsp[0].minor.yy881; } + yymsp[0].minor.yy881 = yylhsminor.yy881; break; case 43: /* cmd ::= CREATE DNODE dnode_endpoint */ -{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[0].minor.yy225, NULL); } +{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[0].minor.yy881, NULL); } break; case 44: /* cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER */ -{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[-2].minor.yy225, &yymsp[0].minor.yy0); } +{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[-2].minor.yy881, &yymsp[0].minor.yy0); } break; case 45: /* cmd ::= DROP DNODE NK_INTEGER force_opt */ -{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy103); } +{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy587); } break; case 46: /* cmd ::= DROP DNODE dnode_endpoint force_opt */ -{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy225, yymsp[0].minor.yy103); } +{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy881, yymsp[0].minor.yy587); } break; case 47: /* cmd ::= ALTER DNODE NK_INTEGER NK_STRING */ { pCxt->pRootNode = createAlterDnodeStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, NULL); } @@ -3840,50 +3846,50 @@ static YYACTIONTYPE yy_reduce( case 51: /* dnode_endpoint ::= NK_STRING */ case 52: /* dnode_endpoint ::= NK_ID */ yytestcase(yyruleno==52); case 53: /* dnode_endpoint ::= NK_IPTOKEN */ yytestcase(yyruleno==53); - case 274: /* sma_func_name ::= COUNT */ yytestcase(yyruleno==274); - case 275: /* sma_func_name ::= FIRST */ yytestcase(yyruleno==275); - case 276: /* sma_func_name ::= LAST */ yytestcase(yyruleno==276); - case 277: /* sma_func_name ::= LAST_ROW */ yytestcase(yyruleno==277); - case 362: /* db_name ::= NK_ID */ yytestcase(yyruleno==362); - case 363: /* table_name ::= NK_ID */ yytestcase(yyruleno==363); - case 364: /* column_name ::= NK_ID */ yytestcase(yyruleno==364); - case 365: /* function_name ::= NK_ID */ yytestcase(yyruleno==365); - case 366: /* table_alias ::= NK_ID */ yytestcase(yyruleno==366); - case 367: /* column_alias ::= NK_ID */ yytestcase(yyruleno==367); - case 368: /* user_name ::= NK_ID */ yytestcase(yyruleno==368); - case 369: /* topic_name ::= NK_ID */ yytestcase(yyruleno==369); - case 370: /* stream_name ::= NK_ID */ yytestcase(yyruleno==370); - case 371: /* cgroup_name ::= NK_ID */ yytestcase(yyruleno==371); - case 372: /* index_name ::= NK_ID */ yytestcase(yyruleno==372); - case 412: /* noarg_func ::= NOW */ yytestcase(yyruleno==412); - case 413: /* noarg_func ::= TODAY */ yytestcase(yyruleno==413); - case 414: /* noarg_func ::= TIMEZONE */ yytestcase(yyruleno==414); - case 415: /* noarg_func ::= DATABASE */ yytestcase(yyruleno==415); - case 416: /* noarg_func ::= CLIENT_VERSION */ yytestcase(yyruleno==416); - case 417: /* noarg_func ::= SERVER_VERSION */ yytestcase(yyruleno==417); - case 418: /* noarg_func ::= SERVER_STATUS */ yytestcase(yyruleno==418); - case 419: /* noarg_func ::= CURRENT_USER */ yytestcase(yyruleno==419); - case 420: /* noarg_func ::= USER */ yytestcase(yyruleno==420); - case 421: /* star_func ::= COUNT */ yytestcase(yyruleno==421); - case 422: /* star_func ::= FIRST */ yytestcase(yyruleno==422); - case 423: /* star_func ::= LAST */ yytestcase(yyruleno==423); - case 424: /* star_func ::= LAST_ROW */ yytestcase(yyruleno==424); -{ yylhsminor.yy225 = yymsp[0].minor.yy0; } - yymsp[0].minor.yy225 = yylhsminor.yy225; + case 282: /* sma_func_name ::= COUNT */ yytestcase(yyruleno==282); + case 283: /* sma_func_name ::= FIRST */ yytestcase(yyruleno==283); + case 284: /* sma_func_name ::= LAST */ yytestcase(yyruleno==284); + case 285: /* sma_func_name ::= LAST_ROW */ yytestcase(yyruleno==285); + case 370: /* db_name ::= NK_ID */ yytestcase(yyruleno==370); + case 371: /* table_name ::= NK_ID */ yytestcase(yyruleno==371); + case 372: /* column_name ::= NK_ID */ yytestcase(yyruleno==372); + case 373: /* function_name ::= NK_ID */ yytestcase(yyruleno==373); + case 374: /* table_alias ::= NK_ID */ yytestcase(yyruleno==374); + case 375: /* column_alias ::= NK_ID */ yytestcase(yyruleno==375); + case 376: /* user_name ::= NK_ID */ yytestcase(yyruleno==376); + case 377: /* topic_name ::= NK_ID */ yytestcase(yyruleno==377); + case 378: /* stream_name ::= NK_ID */ yytestcase(yyruleno==378); + case 379: /* cgroup_name ::= NK_ID */ yytestcase(yyruleno==379); + case 380: /* index_name ::= NK_ID */ yytestcase(yyruleno==380); + case 420: /* noarg_func ::= NOW */ yytestcase(yyruleno==420); + case 421: /* noarg_func ::= TODAY */ yytestcase(yyruleno==421); + case 422: /* noarg_func ::= TIMEZONE */ yytestcase(yyruleno==422); + case 423: /* noarg_func ::= DATABASE */ yytestcase(yyruleno==423); + case 424: /* noarg_func ::= CLIENT_VERSION */ yytestcase(yyruleno==424); + case 425: /* noarg_func ::= SERVER_VERSION */ yytestcase(yyruleno==425); + case 426: /* noarg_func ::= SERVER_STATUS */ yytestcase(yyruleno==426); + case 427: /* noarg_func ::= CURRENT_USER */ yytestcase(yyruleno==427); + case 428: /* noarg_func ::= USER */ yytestcase(yyruleno==428); + case 429: /* star_func ::= COUNT */ yytestcase(yyruleno==429); + case 430: /* star_func ::= FIRST */ yytestcase(yyruleno==430); + case 431: /* star_func ::= LAST */ yytestcase(yyruleno==431); + case 432: /* star_func ::= LAST_ROW */ yytestcase(yyruleno==432); +{ yylhsminor.yy881 = yymsp[0].minor.yy0; } + yymsp[0].minor.yy881 = yylhsminor.yy881; break; case 54: /* force_opt ::= */ case 74: /* not_exists_opt ::= */ yytestcase(yyruleno==74); case 76: /* exists_opt ::= */ yytestcase(yyruleno==76); - case 294: /* analyze_opt ::= */ yytestcase(yyruleno==294); - case 301: /* agg_func_opt ::= */ yytestcase(yyruleno==301); - case 485: /* set_quantifier_opt ::= */ yytestcase(yyruleno==485); -{ yymsp[1].minor.yy103 = false; } + case 302: /* analyze_opt ::= */ yytestcase(yyruleno==302); + case 309: /* agg_func_opt ::= */ yytestcase(yyruleno==309); + case 493: /* set_quantifier_opt ::= */ yytestcase(yyruleno==493); +{ yymsp[1].minor.yy587 = false; } break; case 55: /* force_opt ::= FORCE */ - case 295: /* analyze_opt ::= ANALYZE */ yytestcase(yyruleno==295); - case 302: /* agg_func_opt ::= AGGREGATE */ yytestcase(yyruleno==302); - case 486: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==486); -{ yymsp[0].minor.yy103 = true; } + case 303: /* analyze_opt ::= ANALYZE */ yytestcase(yyruleno==303); + case 310: /* agg_func_opt ::= AGGREGATE */ yytestcase(yyruleno==310); + case 494: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==494); +{ yymsp[0].minor.yy587 = true; } break; case 56: /* cmd ::= ALTER LOCAL NK_STRING */ { pCxt->pRootNode = createAlterLocalStmt(pCxt, &yymsp[0].minor.yy0, NULL); } @@ -3916,1380 +3922,1394 @@ static YYACTIONTYPE yy_reduce( { pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_MNODE_STMT, &yymsp[0].minor.yy0); } break; case 66: /* cmd ::= CREATE DATABASE not_exists_opt db_name db_options */ -{ pCxt->pRootNode = createCreateDatabaseStmt(pCxt, yymsp[-2].minor.yy103, &yymsp[-1].minor.yy225, yymsp[0].minor.yy42); } +{ pCxt->pRootNode = createCreateDatabaseStmt(pCxt, yymsp[-2].minor.yy587, &yymsp[-1].minor.yy881, yymsp[0].minor.yy140); } break; case 67: /* cmd ::= DROP DATABASE exists_opt db_name */ -{ pCxt->pRootNode = createDropDatabaseStmt(pCxt, yymsp[-1].minor.yy103, &yymsp[0].minor.yy225); } +{ pCxt->pRootNode = createDropDatabaseStmt(pCxt, yymsp[-1].minor.yy587, &yymsp[0].minor.yy881); } break; case 68: /* cmd ::= USE db_name */ -{ pCxt->pRootNode = createUseDatabaseStmt(pCxt, &yymsp[0].minor.yy225); } +{ pCxt->pRootNode = createUseDatabaseStmt(pCxt, &yymsp[0].minor.yy881); } break; case 69: /* cmd ::= ALTER DATABASE db_name alter_db_options */ -{ pCxt->pRootNode = createAlterDatabaseStmt(pCxt, &yymsp[-1].minor.yy225, yymsp[0].minor.yy42); } +{ pCxt->pRootNode = createAlterDatabaseStmt(pCxt, &yymsp[-1].minor.yy881, yymsp[0].minor.yy140); } break; case 70: /* cmd ::= FLUSH DATABASE db_name */ -{ pCxt->pRootNode = createFlushDatabaseStmt(pCxt, &yymsp[0].minor.yy225); } +{ pCxt->pRootNode = createFlushDatabaseStmt(pCxt, &yymsp[0].minor.yy881); } break; case 71: /* cmd ::= TRIM DATABASE db_name speed_opt */ -{ pCxt->pRootNode = createTrimDatabaseStmt(pCxt, &yymsp[-1].minor.yy225, yymsp[0].minor.yy508); } +{ pCxt->pRootNode = createTrimDatabaseStmt(pCxt, &yymsp[-1].minor.yy881, yymsp[0].minor.yy214); } break; - case 72: /* cmd ::= COMPACT DATABASE db_name */ -{ pCxt->pRootNode = createCompactStmt(pCxt, &yymsp[0].minor.yy225); } + case 72: /* cmd ::= COMPACT DATABASE db_name start_opt end_opt */ +{ pCxt->pRootNode = createCompactStmt(pCxt, &yymsp[-2].minor.yy881, yymsp[-1].minor.yy140, yymsp[0].minor.yy140); } break; case 73: /* not_exists_opt ::= IF NOT EXISTS */ -{ yymsp[-2].minor.yy103 = true; } +{ yymsp[-2].minor.yy587 = true; } break; case 75: /* exists_opt ::= IF EXISTS */ -{ yymsp[-1].minor.yy103 = true; } +{ yymsp[-1].minor.yy587 = true; } break; case 77: /* db_options ::= */ -{ yymsp[1].minor.yy42 = createDefaultDatabaseOptions(pCxt); } +{ yymsp[1].minor.yy140 = createDefaultDatabaseOptions(pCxt); } break; case 78: /* db_options ::= db_options BUFFER NK_INTEGER */ -{ yylhsminor.yy42 = setDatabaseOption(pCxt, yymsp[-2].minor.yy42, DB_OPTION_BUFFER, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy42 = yylhsminor.yy42; +{ yylhsminor.yy140 = setDatabaseOption(pCxt, yymsp[-2].minor.yy140, DB_OPTION_BUFFER, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy140 = yylhsminor.yy140; break; case 79: /* db_options ::= db_options CACHEMODEL NK_STRING */ -{ yylhsminor.yy42 = setDatabaseOption(pCxt, yymsp[-2].minor.yy42, DB_OPTION_CACHEMODEL, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy42 = yylhsminor.yy42; +{ yylhsminor.yy140 = setDatabaseOption(pCxt, yymsp[-2].minor.yy140, DB_OPTION_CACHEMODEL, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy140 = yylhsminor.yy140; break; case 80: /* db_options ::= db_options CACHESIZE NK_INTEGER */ -{ yylhsminor.yy42 = setDatabaseOption(pCxt, yymsp[-2].minor.yy42, DB_OPTION_CACHESIZE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy42 = yylhsminor.yy42; +{ yylhsminor.yy140 = setDatabaseOption(pCxt, yymsp[-2].minor.yy140, DB_OPTION_CACHESIZE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy140 = yylhsminor.yy140; break; case 81: /* db_options ::= db_options COMP NK_INTEGER */ -{ yylhsminor.yy42 = setDatabaseOption(pCxt, yymsp[-2].minor.yy42, DB_OPTION_COMP, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy42 = yylhsminor.yy42; +{ yylhsminor.yy140 = setDatabaseOption(pCxt, yymsp[-2].minor.yy140, DB_OPTION_COMP, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy140 = yylhsminor.yy140; break; case 82: /* db_options ::= db_options DURATION NK_INTEGER */ case 83: /* db_options ::= db_options DURATION NK_VARIABLE */ yytestcase(yyruleno==83); -{ yylhsminor.yy42 = setDatabaseOption(pCxt, yymsp[-2].minor.yy42, DB_OPTION_DAYS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy42 = yylhsminor.yy42; +{ yylhsminor.yy140 = setDatabaseOption(pCxt, yymsp[-2].minor.yy140, DB_OPTION_DAYS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy140 = yylhsminor.yy140; break; case 84: /* db_options ::= db_options MAXROWS NK_INTEGER */ -{ yylhsminor.yy42 = setDatabaseOption(pCxt, yymsp[-2].minor.yy42, DB_OPTION_MAXROWS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy42 = yylhsminor.yy42; +{ yylhsminor.yy140 = setDatabaseOption(pCxt, yymsp[-2].minor.yy140, DB_OPTION_MAXROWS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy140 = yylhsminor.yy140; break; case 85: /* db_options ::= db_options MINROWS NK_INTEGER */ -{ yylhsminor.yy42 = setDatabaseOption(pCxt, yymsp[-2].minor.yy42, DB_OPTION_MINROWS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy42 = yylhsminor.yy42; +{ yylhsminor.yy140 = setDatabaseOption(pCxt, yymsp[-2].minor.yy140, DB_OPTION_MINROWS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy140 = yylhsminor.yy140; break; case 86: /* db_options ::= db_options KEEP integer_list */ case 87: /* db_options ::= db_options KEEP variable_list */ yytestcase(yyruleno==87); -{ yylhsminor.yy42 = setDatabaseOption(pCxt, yymsp[-2].minor.yy42, DB_OPTION_KEEP, yymsp[0].minor.yy110); } - yymsp[-2].minor.yy42 = yylhsminor.yy42; +{ yylhsminor.yy140 = setDatabaseOption(pCxt, yymsp[-2].minor.yy140, DB_OPTION_KEEP, yymsp[0].minor.yy220); } + yymsp[-2].minor.yy140 = yylhsminor.yy140; break; case 88: /* db_options ::= db_options PAGES NK_INTEGER */ -{ yylhsminor.yy42 = setDatabaseOption(pCxt, yymsp[-2].minor.yy42, DB_OPTION_PAGES, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy42 = yylhsminor.yy42; +{ yylhsminor.yy140 = setDatabaseOption(pCxt, yymsp[-2].minor.yy140, DB_OPTION_PAGES, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy140 = yylhsminor.yy140; break; case 89: /* db_options ::= db_options PAGESIZE NK_INTEGER */ -{ yylhsminor.yy42 = setDatabaseOption(pCxt, yymsp[-2].minor.yy42, DB_OPTION_PAGESIZE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy42 = yylhsminor.yy42; +{ yylhsminor.yy140 = setDatabaseOption(pCxt, yymsp[-2].minor.yy140, DB_OPTION_PAGESIZE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy140 = yylhsminor.yy140; break; case 90: /* db_options ::= db_options TSDB_PAGESIZE NK_INTEGER */ -{ yylhsminor.yy42 = setDatabaseOption(pCxt, yymsp[-2].minor.yy42, DB_OPTION_TSDB_PAGESIZE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy42 = yylhsminor.yy42; +{ yylhsminor.yy140 = setDatabaseOption(pCxt, yymsp[-2].minor.yy140, DB_OPTION_TSDB_PAGESIZE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy140 = yylhsminor.yy140; break; case 91: /* db_options ::= db_options PRECISION NK_STRING */ -{ yylhsminor.yy42 = setDatabaseOption(pCxt, yymsp[-2].minor.yy42, DB_OPTION_PRECISION, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy42 = yylhsminor.yy42; +{ yylhsminor.yy140 = setDatabaseOption(pCxt, yymsp[-2].minor.yy140, DB_OPTION_PRECISION, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy140 = yylhsminor.yy140; break; case 92: /* db_options ::= db_options REPLICA NK_INTEGER */ -{ yylhsminor.yy42 = setDatabaseOption(pCxt, yymsp[-2].minor.yy42, DB_OPTION_REPLICA, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy42 = yylhsminor.yy42; +{ yylhsminor.yy140 = setDatabaseOption(pCxt, yymsp[-2].minor.yy140, DB_OPTION_REPLICA, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy140 = yylhsminor.yy140; break; case 93: /* db_options ::= db_options VGROUPS NK_INTEGER */ -{ yylhsminor.yy42 = setDatabaseOption(pCxt, yymsp[-2].minor.yy42, DB_OPTION_VGROUPS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy42 = yylhsminor.yy42; +{ yylhsminor.yy140 = setDatabaseOption(pCxt, yymsp[-2].minor.yy140, DB_OPTION_VGROUPS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy140 = yylhsminor.yy140; break; case 94: /* db_options ::= db_options SINGLE_STABLE NK_INTEGER */ -{ yylhsminor.yy42 = setDatabaseOption(pCxt, yymsp[-2].minor.yy42, DB_OPTION_SINGLE_STABLE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy42 = yylhsminor.yy42; +{ yylhsminor.yy140 = setDatabaseOption(pCxt, yymsp[-2].minor.yy140, DB_OPTION_SINGLE_STABLE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy140 = yylhsminor.yy140; break; case 95: /* db_options ::= db_options RETENTIONS retention_list */ -{ yylhsminor.yy42 = setDatabaseOption(pCxt, yymsp[-2].minor.yy42, DB_OPTION_RETENTIONS, yymsp[0].minor.yy110); } - yymsp[-2].minor.yy42 = yylhsminor.yy42; +{ yylhsminor.yy140 = setDatabaseOption(pCxt, yymsp[-2].minor.yy140, DB_OPTION_RETENTIONS, yymsp[0].minor.yy220); } + yymsp[-2].minor.yy140 = yylhsminor.yy140; break; case 96: /* db_options ::= db_options SCHEMALESS NK_INTEGER */ -{ yylhsminor.yy42 = setDatabaseOption(pCxt, yymsp[-2].minor.yy42, DB_OPTION_SCHEMALESS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy42 = yylhsminor.yy42; +{ yylhsminor.yy140 = setDatabaseOption(pCxt, yymsp[-2].minor.yy140, DB_OPTION_SCHEMALESS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy140 = yylhsminor.yy140; break; case 97: /* db_options ::= db_options WAL_LEVEL NK_INTEGER */ -{ yylhsminor.yy42 = setDatabaseOption(pCxt, yymsp[-2].minor.yy42, DB_OPTION_WAL, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy42 = yylhsminor.yy42; +{ yylhsminor.yy140 = setDatabaseOption(pCxt, yymsp[-2].minor.yy140, DB_OPTION_WAL, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy140 = yylhsminor.yy140; break; case 98: /* db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER */ -{ yylhsminor.yy42 = setDatabaseOption(pCxt, yymsp[-2].minor.yy42, DB_OPTION_FSYNC, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy42 = yylhsminor.yy42; +{ yylhsminor.yy140 = setDatabaseOption(pCxt, yymsp[-2].minor.yy140, DB_OPTION_FSYNC, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy140 = yylhsminor.yy140; break; case 99: /* db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER */ -{ yylhsminor.yy42 = setDatabaseOption(pCxt, yymsp[-2].minor.yy42, DB_OPTION_WAL_RETENTION_PERIOD, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy42 = yylhsminor.yy42; +{ yylhsminor.yy140 = setDatabaseOption(pCxt, yymsp[-2].minor.yy140, DB_OPTION_WAL_RETENTION_PERIOD, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy140 = yylhsminor.yy140; break; case 100: /* 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.yy42 = setDatabaseOption(pCxt, yymsp[-3].minor.yy42, DB_OPTION_WAL_RETENTION_PERIOD, &t); + yylhsminor.yy140 = setDatabaseOption(pCxt, yymsp[-3].minor.yy140, DB_OPTION_WAL_RETENTION_PERIOD, &t); } - yymsp[-3].minor.yy42 = yylhsminor.yy42; + yymsp[-3].minor.yy140 = yylhsminor.yy140; break; case 101: /* db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER */ -{ yylhsminor.yy42 = setDatabaseOption(pCxt, yymsp[-2].minor.yy42, DB_OPTION_WAL_RETENTION_SIZE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy42 = yylhsminor.yy42; +{ yylhsminor.yy140 = setDatabaseOption(pCxt, yymsp[-2].minor.yy140, DB_OPTION_WAL_RETENTION_SIZE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy140 = yylhsminor.yy140; break; case 102: /* 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.yy42 = setDatabaseOption(pCxt, yymsp[-3].minor.yy42, DB_OPTION_WAL_RETENTION_SIZE, &t); + yylhsminor.yy140 = setDatabaseOption(pCxt, yymsp[-3].minor.yy140, DB_OPTION_WAL_RETENTION_SIZE, &t); } - yymsp[-3].minor.yy42 = yylhsminor.yy42; + yymsp[-3].minor.yy140 = yylhsminor.yy140; break; case 103: /* db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER */ -{ yylhsminor.yy42 = setDatabaseOption(pCxt, yymsp[-2].minor.yy42, DB_OPTION_WAL_ROLL_PERIOD, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy42 = yylhsminor.yy42; +{ yylhsminor.yy140 = setDatabaseOption(pCxt, yymsp[-2].minor.yy140, DB_OPTION_WAL_ROLL_PERIOD, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy140 = yylhsminor.yy140; break; case 104: /* db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER */ -{ yylhsminor.yy42 = setDatabaseOption(pCxt, yymsp[-2].minor.yy42, DB_OPTION_WAL_SEGMENT_SIZE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy42 = yylhsminor.yy42; +{ yylhsminor.yy140 = setDatabaseOption(pCxt, yymsp[-2].minor.yy140, DB_OPTION_WAL_SEGMENT_SIZE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy140 = yylhsminor.yy140; break; case 105: /* db_options ::= db_options STT_TRIGGER NK_INTEGER */ -{ yylhsminor.yy42 = setDatabaseOption(pCxt, yymsp[-2].minor.yy42, DB_OPTION_STT_TRIGGER, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy42 = yylhsminor.yy42; +{ yylhsminor.yy140 = setDatabaseOption(pCxt, yymsp[-2].minor.yy140, DB_OPTION_STT_TRIGGER, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy140 = yylhsminor.yy140; break; case 106: /* db_options ::= db_options TABLE_PREFIX NK_INTEGER */ -{ yylhsminor.yy42 = setDatabaseOption(pCxt, yymsp[-2].minor.yy42, DB_OPTION_TABLE_PREFIX, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy42 = yylhsminor.yy42; +{ yylhsminor.yy140 = setDatabaseOption(pCxt, yymsp[-2].minor.yy140, DB_OPTION_TABLE_PREFIX, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy140 = yylhsminor.yy140; break; case 107: /* db_options ::= db_options TABLE_SUFFIX NK_INTEGER */ -{ yylhsminor.yy42 = setDatabaseOption(pCxt, yymsp[-2].minor.yy42, DB_OPTION_TABLE_SUFFIX, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy42 = yylhsminor.yy42; +{ yylhsminor.yy140 = setDatabaseOption(pCxt, yymsp[-2].minor.yy140, DB_OPTION_TABLE_SUFFIX, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy140 = yylhsminor.yy140; break; case 108: /* alter_db_options ::= alter_db_option */ -{ yylhsminor.yy42 = createAlterDatabaseOptions(pCxt); yylhsminor.yy42 = setAlterDatabaseOption(pCxt, yylhsminor.yy42, &yymsp[0].minor.yy459); } - yymsp[0].minor.yy42 = yylhsminor.yy42; +{ yylhsminor.yy140 = createAlterDatabaseOptions(pCxt); yylhsminor.yy140 = setAlterDatabaseOption(pCxt, yylhsminor.yy140, &yymsp[0].minor.yy809); } + yymsp[0].minor.yy140 = yylhsminor.yy140; break; case 109: /* alter_db_options ::= alter_db_options alter_db_option */ -{ yylhsminor.yy42 = setAlterDatabaseOption(pCxt, yymsp[-1].minor.yy42, &yymsp[0].minor.yy459); } - yymsp[-1].minor.yy42 = yylhsminor.yy42; +{ yylhsminor.yy140 = setAlterDatabaseOption(pCxt, yymsp[-1].minor.yy140, &yymsp[0].minor.yy809); } + yymsp[-1].minor.yy140 = yylhsminor.yy140; break; case 110: /* alter_db_option ::= BUFFER NK_INTEGER */ -{ yymsp[-1].minor.yy459.type = DB_OPTION_BUFFER; yymsp[-1].minor.yy459.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy809.type = DB_OPTION_BUFFER; yymsp[-1].minor.yy809.val = yymsp[0].minor.yy0; } break; case 111: /* alter_db_option ::= CACHEMODEL NK_STRING */ -{ yymsp[-1].minor.yy459.type = DB_OPTION_CACHEMODEL; yymsp[-1].minor.yy459.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy809.type = DB_OPTION_CACHEMODEL; yymsp[-1].minor.yy809.val = yymsp[0].minor.yy0; } break; case 112: /* alter_db_option ::= CACHESIZE NK_INTEGER */ -{ yymsp[-1].minor.yy459.type = DB_OPTION_CACHESIZE; yymsp[-1].minor.yy459.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy809.type = DB_OPTION_CACHESIZE; yymsp[-1].minor.yy809.val = yymsp[0].minor.yy0; } break; case 113: /* alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER */ -{ yymsp[-1].minor.yy459.type = DB_OPTION_FSYNC; yymsp[-1].minor.yy459.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy809.type = DB_OPTION_FSYNC; yymsp[-1].minor.yy809.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.yy459.type = DB_OPTION_KEEP; yymsp[-1].minor.yy459.pList = yymsp[0].minor.yy110; } +{ yymsp[-1].minor.yy809.type = DB_OPTION_KEEP; yymsp[-1].minor.yy809.pList = yymsp[0].minor.yy220; } break; case 116: /* alter_db_option ::= PAGES NK_INTEGER */ -{ yymsp[-1].minor.yy459.type = DB_OPTION_PAGES; yymsp[-1].minor.yy459.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy809.type = DB_OPTION_PAGES; yymsp[-1].minor.yy809.val = yymsp[0].minor.yy0; } break; case 117: /* alter_db_option ::= REPLICA NK_INTEGER */ -{ yymsp[-1].minor.yy459.type = DB_OPTION_REPLICA; yymsp[-1].minor.yy459.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy809.type = DB_OPTION_REPLICA; yymsp[-1].minor.yy809.val = yymsp[0].minor.yy0; } break; case 118: /* alter_db_option ::= WAL_LEVEL NK_INTEGER */ -{ yymsp[-1].minor.yy459.type = DB_OPTION_WAL; yymsp[-1].minor.yy459.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy809.type = DB_OPTION_WAL; yymsp[-1].minor.yy809.val = yymsp[0].minor.yy0; } break; case 119: /* alter_db_option ::= STT_TRIGGER NK_INTEGER */ -{ yymsp[-1].minor.yy459.type = DB_OPTION_STT_TRIGGER; yymsp[-1].minor.yy459.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy809.type = DB_OPTION_STT_TRIGGER; yymsp[-1].minor.yy809.val = yymsp[0].minor.yy0; } break; case 120: /* integer_list ::= NK_INTEGER */ -{ yylhsminor.yy110 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy110 = yylhsminor.yy110; +{ yylhsminor.yy220 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy220 = yylhsminor.yy220; break; case 121: /* integer_list ::= integer_list NK_COMMA NK_INTEGER */ - case 331: /* dnode_list ::= dnode_list DNODE NK_INTEGER */ yytestcase(yyruleno==331); -{ yylhsminor.yy110 = addNodeToList(pCxt, yymsp[-2].minor.yy110, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } - yymsp[-2].minor.yy110 = yylhsminor.yy110; + case 339: /* dnode_list ::= dnode_list DNODE NK_INTEGER */ yytestcase(yyruleno==339); +{ yylhsminor.yy220 = addNodeToList(pCxt, yymsp[-2].minor.yy220, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } + yymsp[-2].minor.yy220 = yylhsminor.yy220; break; case 122: /* variable_list ::= NK_VARIABLE */ -{ yylhsminor.yy110 = createNodeList(pCxt, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy110 = yylhsminor.yy110; +{ yylhsminor.yy220 = createNodeList(pCxt, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy220 = yylhsminor.yy220; break; case 123: /* variable_list ::= variable_list NK_COMMA NK_VARIABLE */ -{ yylhsminor.yy110 = addNodeToList(pCxt, yymsp[-2].minor.yy110, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[-2].minor.yy110 = yylhsminor.yy110; +{ yylhsminor.yy220 = addNodeToList(pCxt, yymsp[-2].minor.yy220, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[-2].minor.yy220 = yylhsminor.yy220; break; case 124: /* retention_list ::= retention */ - case 146: /* multi_create_clause ::= create_subtable_clause */ yytestcase(yyruleno==146); - case 149: /* multi_drop_clause ::= drop_table_clause */ yytestcase(yyruleno==149); - case 156: /* column_def_list ::= column_def */ yytestcase(yyruleno==156); - case 200: /* rollup_func_list ::= rollup_func_name */ yytestcase(yyruleno==200); - case 205: /* col_name_list ::= col_name */ yytestcase(yyruleno==205); - case 256: /* tag_list_opt ::= tag_item */ yytestcase(yyruleno==256); - case 270: /* func_list ::= func */ yytestcase(yyruleno==270); - case 360: /* literal_list ::= signed_literal */ yytestcase(yyruleno==360); - case 427: /* other_para_list ::= star_func_para */ yytestcase(yyruleno==427); - case 433: /* when_then_list ::= when_then_expr */ yytestcase(yyruleno==433); - case 488: /* select_list ::= select_item */ yytestcase(yyruleno==488); - case 499: /* partition_list ::= partition_item */ yytestcase(yyruleno==499); - case 554: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==554); -{ yylhsminor.yy110 = createNodeList(pCxt, yymsp[0].minor.yy42); } - yymsp[0].minor.yy110 = yylhsminor.yy110; + case 154: /* multi_create_clause ::= create_subtable_clause */ yytestcase(yyruleno==154); + case 157: /* multi_drop_clause ::= drop_table_clause */ yytestcase(yyruleno==157); + case 164: /* column_def_list ::= column_def */ yytestcase(yyruleno==164); + case 208: /* rollup_func_list ::= rollup_func_name */ yytestcase(yyruleno==208); + case 213: /* col_name_list ::= col_name */ yytestcase(yyruleno==213); + case 264: /* tag_list_opt ::= tag_item */ yytestcase(yyruleno==264); + case 278: /* func_list ::= func */ yytestcase(yyruleno==278); + case 368: /* literal_list ::= signed_literal */ yytestcase(yyruleno==368); + case 435: /* other_para_list ::= star_func_para */ yytestcase(yyruleno==435); + case 441: /* when_then_list ::= when_then_expr */ yytestcase(yyruleno==441); + case 496: /* select_list ::= select_item */ yytestcase(yyruleno==496); + case 507: /* partition_list ::= partition_item */ yytestcase(yyruleno==507); + case 562: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==562); +{ yylhsminor.yy220 = createNodeList(pCxt, yymsp[0].minor.yy140); } + yymsp[0].minor.yy220 = yylhsminor.yy220; break; case 125: /* retention_list ::= retention_list NK_COMMA retention */ - case 150: /* multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause */ yytestcase(yyruleno==150); - case 157: /* column_def_list ::= column_def_list NK_COMMA column_def */ yytestcase(yyruleno==157); - case 201: /* rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ yytestcase(yyruleno==201); - case 206: /* col_name_list ::= col_name_list NK_COMMA col_name */ yytestcase(yyruleno==206); - case 257: /* tag_list_opt ::= tag_list_opt NK_COMMA tag_item */ yytestcase(yyruleno==257); - case 271: /* func_list ::= func_list NK_COMMA func */ yytestcase(yyruleno==271); - case 361: /* literal_list ::= literal_list NK_COMMA signed_literal */ yytestcase(yyruleno==361); - case 428: /* other_para_list ::= other_para_list NK_COMMA star_func_para */ yytestcase(yyruleno==428); - case 489: /* select_list ::= select_list NK_COMMA select_item */ yytestcase(yyruleno==489); - case 500: /* partition_list ::= partition_list NK_COMMA partition_item */ yytestcase(yyruleno==500); - case 555: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==555); -{ yylhsminor.yy110 = addNodeToList(pCxt, yymsp[-2].minor.yy110, yymsp[0].minor.yy42); } - yymsp[-2].minor.yy110 = yylhsminor.yy110; + case 158: /* multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause */ yytestcase(yyruleno==158); + case 165: /* column_def_list ::= column_def_list NK_COMMA column_def */ yytestcase(yyruleno==165); + case 209: /* rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ yytestcase(yyruleno==209); + case 214: /* col_name_list ::= col_name_list NK_COMMA col_name */ yytestcase(yyruleno==214); + case 265: /* tag_list_opt ::= tag_list_opt NK_COMMA tag_item */ yytestcase(yyruleno==265); + case 279: /* func_list ::= func_list NK_COMMA func */ yytestcase(yyruleno==279); + case 369: /* literal_list ::= literal_list NK_COMMA signed_literal */ yytestcase(yyruleno==369); + case 436: /* other_para_list ::= other_para_list NK_COMMA star_func_para */ yytestcase(yyruleno==436); + case 497: /* select_list ::= select_list NK_COMMA select_item */ yytestcase(yyruleno==497); + case 508: /* partition_list ::= partition_list NK_COMMA partition_item */ yytestcase(yyruleno==508); + case 563: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==563); +{ yylhsminor.yy220 = addNodeToList(pCxt, yymsp[-2].minor.yy220, yymsp[0].minor.yy140); } + yymsp[-2].minor.yy220 = yylhsminor.yy220; break; case 126: /* retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */ -{ yylhsminor.yy42 = createNodeListNodeEx(pCxt, createDurationValueNode(pCxt, &yymsp[-2].minor.yy0), createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[-2].minor.yy42 = yylhsminor.yy42; +{ yylhsminor.yy140 = createNodeListNodeEx(pCxt, createDurationValueNode(pCxt, &yymsp[-2].minor.yy0), createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[-2].minor.yy140 = yylhsminor.yy140; break; case 127: /* speed_opt ::= */ - case 303: /* bufsize_opt ::= */ yytestcase(yyruleno==303); -{ yymsp[1].minor.yy508 = 0; } + case 311: /* bufsize_opt ::= */ yytestcase(yyruleno==311); +{ yymsp[1].minor.yy214 = 0; } break; case 128: /* speed_opt ::= MAX_SPEED NK_INTEGER */ - case 304: /* bufsize_opt ::= BUFSIZE NK_INTEGER */ yytestcase(yyruleno==304); -{ yymsp[-1].minor.yy508 = taosStr2Int32(yymsp[0].minor.yy0.z, NULL, 10); } + case 312: /* bufsize_opt ::= BUFSIZE NK_INTEGER */ yytestcase(yyruleno==312); +{ yymsp[-1].minor.yy214 = taosStr2Int32(yymsp[0].minor.yy0.z, NULL, 10); } + break; + case 129: /* start_opt ::= */ + case 133: /* end_opt ::= */ yytestcase(yyruleno==133); + case 258: /* like_pattern_opt ::= */ yytestcase(yyruleno==258); + case 329: /* subtable_opt ::= */ yytestcase(yyruleno==329); + case 444: /* case_when_else_opt ::= */ yytestcase(yyruleno==444); + case 474: /* from_clause_opt ::= */ yytestcase(yyruleno==474); + case 503: /* where_clause_opt ::= */ yytestcase(yyruleno==503); + case 512: /* twindow_clause_opt ::= */ yytestcase(yyruleno==512); + case 518: /* sliding_opt ::= */ yytestcase(yyruleno==518); + case 520: /* fill_opt ::= */ yytestcase(yyruleno==520); + case 534: /* having_clause_opt ::= */ yytestcase(yyruleno==534); + case 536: /* range_opt ::= */ yytestcase(yyruleno==536); + case 538: /* every_opt ::= */ yytestcase(yyruleno==538); + case 551: /* slimit_clause_opt ::= */ yytestcase(yyruleno==551); + case 555: /* limit_clause_opt ::= */ yytestcase(yyruleno==555); +{ yymsp[1].minor.yy140 = NULL; } + break; + case 130: /* start_opt ::= START WITH NK_INTEGER */ + case 134: /* end_opt ::= END WITH NK_INTEGER */ yytestcase(yyruleno==134); +{ yymsp[-2].minor.yy140 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } + break; + case 131: /* start_opt ::= START WITH NK_STRING */ + case 135: /* end_opt ::= END WITH NK_STRING */ yytestcase(yyruleno==135); +{ yymsp[-2].minor.yy140 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } + break; + case 132: /* start_opt ::= START WITH TIMESTAMP NK_STRING */ + case 136: /* end_opt ::= END WITH TIMESTAMP NK_STRING */ yytestcase(yyruleno==136); +{ yymsp[-3].minor.yy140 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } + break; + case 137: /* cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ + case 139: /* cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ yytestcase(yyruleno==139); +{ pCxt->pRootNode = createCreateTableStmt(pCxt, yymsp[-6].minor.yy587, yymsp[-5].minor.yy140, yymsp[-3].minor.yy220, yymsp[-1].minor.yy220, yymsp[0].minor.yy140); } + break; + case 138: /* cmd ::= CREATE TABLE multi_create_clause */ +{ pCxt->pRootNode = createCreateMultiTableStmt(pCxt, yymsp[0].minor.yy220); } + break; + case 140: /* cmd ::= DROP TABLE multi_drop_clause */ +{ pCxt->pRootNode = createDropTableStmt(pCxt, yymsp[0].minor.yy220); } + break; + case 141: /* cmd ::= DROP STABLE exists_opt full_table_name */ +{ pCxt->pRootNode = createDropSuperTableStmt(pCxt, yymsp[-1].minor.yy587, yymsp[0].minor.yy140); } + break; + case 142: /* cmd ::= ALTER TABLE alter_table_clause */ + case 341: /* cmd ::= query_or_subquery */ yytestcase(yyruleno==341); + case 342: /* cmd ::= insert_query */ yytestcase(yyruleno==342); +{ pCxt->pRootNode = yymsp[0].minor.yy140; } + break; + case 143: /* cmd ::= ALTER STABLE alter_table_clause */ +{ pCxt->pRootNode = setAlterSuperTableType(yymsp[0].minor.yy140); } + break; + case 144: /* alter_table_clause ::= full_table_name alter_table_options */ +{ yylhsminor.yy140 = createAlterTableModifyOptions(pCxt, yymsp[-1].minor.yy140, yymsp[0].minor.yy140); } + yymsp[-1].minor.yy140 = yylhsminor.yy140; + break; + case 145: /* alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ +{ yylhsminor.yy140 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy140, TSDB_ALTER_TABLE_ADD_COLUMN, &yymsp[-1].minor.yy881, yymsp[0].minor.yy682); } + yymsp[-4].minor.yy140 = yylhsminor.yy140; + break; + case 146: /* alter_table_clause ::= full_table_name DROP COLUMN column_name */ +{ yylhsminor.yy140 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy140, TSDB_ALTER_TABLE_DROP_COLUMN, &yymsp[0].minor.yy881); } + yymsp[-3].minor.yy140 = yylhsminor.yy140; + break; + case 147: /* alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ +{ yylhsminor.yy140 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy140, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, &yymsp[-1].minor.yy881, yymsp[0].minor.yy682); } + yymsp[-4].minor.yy140 = yylhsminor.yy140; + break; + case 148: /* alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ +{ yylhsminor.yy140 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy140, TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, &yymsp[-1].minor.yy881, &yymsp[0].minor.yy881); } + yymsp[-4].minor.yy140 = yylhsminor.yy140; + break; + case 149: /* alter_table_clause ::= full_table_name ADD TAG column_name type_name */ +{ yylhsminor.yy140 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy140, TSDB_ALTER_TABLE_ADD_TAG, &yymsp[-1].minor.yy881, yymsp[0].minor.yy682); } + yymsp[-4].minor.yy140 = yylhsminor.yy140; + break; + case 150: /* alter_table_clause ::= full_table_name DROP TAG column_name */ +{ yylhsminor.yy140 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy140, TSDB_ALTER_TABLE_DROP_TAG, &yymsp[0].minor.yy881); } + yymsp[-3].minor.yy140 = yylhsminor.yy140; + break; + case 151: /* alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ +{ yylhsminor.yy140 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy140, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, &yymsp[-1].minor.yy881, yymsp[0].minor.yy682); } + yymsp[-4].minor.yy140 = yylhsminor.yy140; break; - case 129: /* cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ - case 131: /* cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ yytestcase(yyruleno==131); -{ pCxt->pRootNode = createCreateTableStmt(pCxt, yymsp[-6].minor.yy103, yymsp[-5].minor.yy42, yymsp[-3].minor.yy110, yymsp[-1].minor.yy110, yymsp[0].minor.yy42); } + case 152: /* alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ +{ yylhsminor.yy140 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy140, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &yymsp[-1].minor.yy881, &yymsp[0].minor.yy881); } + yymsp[-4].minor.yy140 = yylhsminor.yy140; break; - case 130: /* cmd ::= CREATE TABLE multi_create_clause */ -{ pCxt->pRootNode = createCreateMultiTableStmt(pCxt, yymsp[0].minor.yy110); } + case 153: /* alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */ +{ yylhsminor.yy140 = createAlterTableSetTag(pCxt, yymsp[-5].minor.yy140, &yymsp[-2].minor.yy881, yymsp[0].minor.yy140); } + yymsp[-5].minor.yy140 = yylhsminor.yy140; break; - case 132: /* cmd ::= DROP TABLE multi_drop_clause */ -{ pCxt->pRootNode = createDropTableStmt(pCxt, yymsp[0].minor.yy110); } + case 155: /* multi_create_clause ::= multi_create_clause create_subtable_clause */ + case 442: /* when_then_list ::= when_then_list when_then_expr */ yytestcase(yyruleno==442); +{ yylhsminor.yy220 = addNodeToList(pCxt, yymsp[-1].minor.yy220, yymsp[0].minor.yy140); } + yymsp[-1].minor.yy220 = yylhsminor.yy220; break; - case 133: /* cmd ::= DROP STABLE exists_opt full_table_name */ -{ pCxt->pRootNode = createDropSuperTableStmt(pCxt, yymsp[-1].minor.yy103, yymsp[0].minor.yy42); } + case 156: /* 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.yy140 = createCreateSubTableClause(pCxt, yymsp[-9].minor.yy587, yymsp[-8].minor.yy140, yymsp[-6].minor.yy140, yymsp[-5].minor.yy220, yymsp[-2].minor.yy220, yymsp[0].minor.yy140); } + yymsp[-9].minor.yy140 = yylhsminor.yy140; break; - case 134: /* cmd ::= ALTER TABLE alter_table_clause */ - case 333: /* cmd ::= query_or_subquery */ yytestcase(yyruleno==333); - case 334: /* cmd ::= insert_query */ yytestcase(yyruleno==334); -{ pCxt->pRootNode = yymsp[0].minor.yy42; } + case 159: /* drop_table_clause ::= exists_opt full_table_name */ +{ yylhsminor.yy140 = createDropTableClause(pCxt, yymsp[-1].minor.yy587, yymsp[0].minor.yy140); } + yymsp[-1].minor.yy140 = yylhsminor.yy140; break; - case 135: /* cmd ::= ALTER STABLE alter_table_clause */ -{ pCxt->pRootNode = setAlterSuperTableType(yymsp[0].minor.yy42); } + case 160: /* specific_cols_opt ::= */ + case 191: /* tags_def_opt ::= */ yytestcase(yyruleno==191); + case 263: /* tag_list_opt ::= */ yytestcase(yyruleno==263); + case 315: /* col_list_opt ::= */ yytestcase(yyruleno==315); + case 317: /* tag_def_or_ref_opt ::= */ yytestcase(yyruleno==317); + case 505: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==505); + case 530: /* group_by_clause_opt ::= */ yytestcase(yyruleno==530); + case 549: /* order_by_clause_opt ::= */ yytestcase(yyruleno==549); +{ yymsp[1].minor.yy220 = NULL; } break; - case 136: /* alter_table_clause ::= full_table_name alter_table_options */ -{ yylhsminor.yy42 = createAlterTableModifyOptions(pCxt, yymsp[-1].minor.yy42, yymsp[0].minor.yy42); } - yymsp[-1].minor.yy42 = yylhsminor.yy42; + case 161: /* specific_cols_opt ::= NK_LP col_name_list NK_RP */ + case 316: /* col_list_opt ::= NK_LP col_name_list NK_RP */ yytestcase(yyruleno==316); +{ yymsp[-2].minor.yy220 = yymsp[-1].minor.yy220; } break; - case 137: /* alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ -{ yylhsminor.yy42 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy42, TSDB_ALTER_TABLE_ADD_COLUMN, &yymsp[-1].minor.yy225, yymsp[0].minor.yy448); } - yymsp[-4].minor.yy42 = yylhsminor.yy42; + case 162: /* full_table_name ::= table_name */ +{ yylhsminor.yy140 = createRealTableNode(pCxt, NULL, &yymsp[0].minor.yy881, NULL); } + yymsp[0].minor.yy140 = yylhsminor.yy140; break; - case 138: /* alter_table_clause ::= full_table_name DROP COLUMN column_name */ -{ yylhsminor.yy42 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy42, TSDB_ALTER_TABLE_DROP_COLUMN, &yymsp[0].minor.yy225); } - yymsp[-3].minor.yy42 = yylhsminor.yy42; + case 163: /* full_table_name ::= db_name NK_DOT table_name */ +{ yylhsminor.yy140 = createRealTableNode(pCxt, &yymsp[-2].minor.yy881, &yymsp[0].minor.yy881, NULL); } + yymsp[-2].minor.yy140 = yylhsminor.yy140; break; - case 139: /* alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ -{ yylhsminor.yy42 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy42, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, &yymsp[-1].minor.yy225, yymsp[0].minor.yy448); } - yymsp[-4].minor.yy42 = yylhsminor.yy42; + case 166: /* column_def ::= column_name type_name */ +{ yylhsminor.yy140 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy881, yymsp[0].minor.yy682, NULL); } + yymsp[-1].minor.yy140 = yylhsminor.yy140; break; - case 140: /* alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ -{ yylhsminor.yy42 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy42, TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, &yymsp[-1].minor.yy225, &yymsp[0].minor.yy225); } - yymsp[-4].minor.yy42 = yylhsminor.yy42; + case 167: /* column_def ::= column_name type_name COMMENT NK_STRING */ +{ yylhsminor.yy140 = createColumnDefNode(pCxt, &yymsp[-3].minor.yy881, yymsp[-2].minor.yy682, &yymsp[0].minor.yy0); } + yymsp[-3].minor.yy140 = yylhsminor.yy140; break; - case 141: /* alter_table_clause ::= full_table_name ADD TAG column_name type_name */ -{ yylhsminor.yy42 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy42, TSDB_ALTER_TABLE_ADD_TAG, &yymsp[-1].minor.yy225, yymsp[0].minor.yy448); } - yymsp[-4].minor.yy42 = yylhsminor.yy42; + case 168: /* type_name ::= BOOL */ +{ yymsp[0].minor.yy682 = createDataType(TSDB_DATA_TYPE_BOOL); } break; - case 142: /* alter_table_clause ::= full_table_name DROP TAG column_name */ -{ yylhsminor.yy42 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy42, TSDB_ALTER_TABLE_DROP_TAG, &yymsp[0].minor.yy225); } - yymsp[-3].minor.yy42 = yylhsminor.yy42; + case 169: /* type_name ::= TINYINT */ +{ yymsp[0].minor.yy682 = createDataType(TSDB_DATA_TYPE_TINYINT); } break; - case 143: /* alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ -{ yylhsminor.yy42 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy42, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, &yymsp[-1].minor.yy225, yymsp[0].minor.yy448); } - yymsp[-4].minor.yy42 = yylhsminor.yy42; + case 170: /* type_name ::= SMALLINT */ +{ yymsp[0].minor.yy682 = createDataType(TSDB_DATA_TYPE_SMALLINT); } break; - case 144: /* alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ -{ yylhsminor.yy42 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy42, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &yymsp[-1].minor.yy225, &yymsp[0].minor.yy225); } - yymsp[-4].minor.yy42 = yylhsminor.yy42; + case 171: /* type_name ::= INT */ + case 172: /* type_name ::= INTEGER */ yytestcase(yyruleno==172); +{ yymsp[0].minor.yy682 = createDataType(TSDB_DATA_TYPE_INT); } break; - case 145: /* alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */ -{ yylhsminor.yy42 = createAlterTableSetTag(pCxt, yymsp[-5].minor.yy42, &yymsp[-2].minor.yy225, yymsp[0].minor.yy42); } - yymsp[-5].minor.yy42 = yylhsminor.yy42; + case 173: /* type_name ::= BIGINT */ +{ yymsp[0].minor.yy682 = createDataType(TSDB_DATA_TYPE_BIGINT); } break; - case 147: /* multi_create_clause ::= multi_create_clause create_subtable_clause */ - case 434: /* when_then_list ::= when_then_list when_then_expr */ yytestcase(yyruleno==434); -{ yylhsminor.yy110 = addNodeToList(pCxt, yymsp[-1].minor.yy110, yymsp[0].minor.yy42); } - yymsp[-1].minor.yy110 = yylhsminor.yy110; + case 174: /* type_name ::= FLOAT */ +{ yymsp[0].minor.yy682 = createDataType(TSDB_DATA_TYPE_FLOAT); } break; - case 148: /* 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.yy42 = createCreateSubTableClause(pCxt, yymsp[-9].minor.yy103, yymsp[-8].minor.yy42, yymsp[-6].minor.yy42, yymsp[-5].minor.yy110, yymsp[-2].minor.yy110, yymsp[0].minor.yy42); } - yymsp[-9].minor.yy42 = yylhsminor.yy42; + case 175: /* type_name ::= DOUBLE */ +{ yymsp[0].minor.yy682 = createDataType(TSDB_DATA_TYPE_DOUBLE); } break; - case 151: /* drop_table_clause ::= exists_opt full_table_name */ -{ yylhsminor.yy42 = createDropTableClause(pCxt, yymsp[-1].minor.yy103, yymsp[0].minor.yy42); } - yymsp[-1].minor.yy42 = yylhsminor.yy42; + case 176: /* type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ +{ yymsp[-3].minor.yy682 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); } break; - case 152: /* specific_cols_opt ::= */ - case 183: /* tags_def_opt ::= */ yytestcase(yyruleno==183); - case 255: /* tag_list_opt ::= */ yytestcase(yyruleno==255); - case 307: /* col_list_opt ::= */ yytestcase(yyruleno==307); - case 309: /* tag_def_or_ref_opt ::= */ yytestcase(yyruleno==309); - case 497: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==497); - case 522: /* group_by_clause_opt ::= */ yytestcase(yyruleno==522); - case 541: /* order_by_clause_opt ::= */ yytestcase(yyruleno==541); -{ yymsp[1].minor.yy110 = NULL; } + case 177: /* type_name ::= TIMESTAMP */ +{ yymsp[0].minor.yy682 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); } break; - case 153: /* specific_cols_opt ::= NK_LP col_name_list NK_RP */ - case 308: /* col_list_opt ::= NK_LP col_name_list NK_RP */ yytestcase(yyruleno==308); -{ yymsp[-2].minor.yy110 = yymsp[-1].minor.yy110; } + case 178: /* type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ +{ yymsp[-3].minor.yy682 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); } break; - case 154: /* full_table_name ::= table_name */ -{ yylhsminor.yy42 = createRealTableNode(pCxt, NULL, &yymsp[0].minor.yy225, NULL); } - yymsp[0].minor.yy42 = yylhsminor.yy42; + case 179: /* type_name ::= TINYINT UNSIGNED */ +{ yymsp[-1].minor.yy682 = createDataType(TSDB_DATA_TYPE_UTINYINT); } break; - case 155: /* full_table_name ::= db_name NK_DOT table_name */ -{ yylhsminor.yy42 = createRealTableNode(pCxt, &yymsp[-2].minor.yy225, &yymsp[0].minor.yy225, NULL); } - yymsp[-2].minor.yy42 = yylhsminor.yy42; + case 180: /* type_name ::= SMALLINT UNSIGNED */ +{ yymsp[-1].minor.yy682 = createDataType(TSDB_DATA_TYPE_USMALLINT); } break; - case 158: /* column_def ::= column_name type_name */ -{ yylhsminor.yy42 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy225, yymsp[0].minor.yy448, NULL); } - yymsp[-1].minor.yy42 = yylhsminor.yy42; + case 181: /* type_name ::= INT UNSIGNED */ +{ yymsp[-1].minor.yy682 = createDataType(TSDB_DATA_TYPE_UINT); } break; - case 159: /* column_def ::= column_name type_name COMMENT NK_STRING */ -{ yylhsminor.yy42 = createColumnDefNode(pCxt, &yymsp[-3].minor.yy225, yymsp[-2].minor.yy448, &yymsp[0].minor.yy0); } - yymsp[-3].minor.yy42 = yylhsminor.yy42; + case 182: /* type_name ::= BIGINT UNSIGNED */ +{ yymsp[-1].minor.yy682 = createDataType(TSDB_DATA_TYPE_UBIGINT); } break; - case 160: /* type_name ::= BOOL */ -{ yymsp[0].minor.yy448 = createDataType(TSDB_DATA_TYPE_BOOL); } + case 183: /* type_name ::= JSON */ +{ yymsp[0].minor.yy682 = createDataType(TSDB_DATA_TYPE_JSON); } break; - case 161: /* type_name ::= TINYINT */ -{ yymsp[0].minor.yy448 = createDataType(TSDB_DATA_TYPE_TINYINT); } + case 184: /* type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ +{ yymsp[-3].minor.yy682 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); } break; - case 162: /* type_name ::= SMALLINT */ -{ yymsp[0].minor.yy448 = createDataType(TSDB_DATA_TYPE_SMALLINT); } + case 185: /* type_name ::= MEDIUMBLOB */ +{ yymsp[0].minor.yy682 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); } break; - case 163: /* type_name ::= INT */ - case 164: /* type_name ::= INTEGER */ yytestcase(yyruleno==164); -{ yymsp[0].minor.yy448 = createDataType(TSDB_DATA_TYPE_INT); } + case 186: /* type_name ::= BLOB */ +{ yymsp[0].minor.yy682 = createDataType(TSDB_DATA_TYPE_BLOB); } break; - case 165: /* type_name ::= BIGINT */ -{ yymsp[0].minor.yy448 = createDataType(TSDB_DATA_TYPE_BIGINT); } + case 187: /* type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ +{ yymsp[-3].minor.yy682 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &yymsp[-1].minor.yy0); } break; - case 166: /* type_name ::= FLOAT */ -{ yymsp[0].minor.yy448 = createDataType(TSDB_DATA_TYPE_FLOAT); } + case 188: /* type_name ::= DECIMAL */ +{ yymsp[0].minor.yy682 = createDataType(TSDB_DATA_TYPE_DECIMAL); } break; - case 167: /* type_name ::= DOUBLE */ -{ yymsp[0].minor.yy448 = createDataType(TSDB_DATA_TYPE_DOUBLE); } + case 189: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ +{ yymsp[-3].minor.yy682 = createDataType(TSDB_DATA_TYPE_DECIMAL); } break; - case 168: /* type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy448 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); } + case 190: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ +{ yymsp[-5].minor.yy682 = createDataType(TSDB_DATA_TYPE_DECIMAL); } break; - case 169: /* type_name ::= TIMESTAMP */ -{ yymsp[0].minor.yy448 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); } + case 192: /* tags_def_opt ::= tags_def */ + case 318: /* tag_def_or_ref_opt ::= tags_def */ yytestcase(yyruleno==318); + case 434: /* star_func_para_list ::= other_para_list */ yytestcase(yyruleno==434); +{ yylhsminor.yy220 = yymsp[0].minor.yy220; } + yymsp[0].minor.yy220 = yylhsminor.yy220; break; - case 170: /* type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy448 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); } + case 193: /* tags_def ::= TAGS NK_LP column_def_list NK_RP */ + case 319: /* tag_def_or_ref_opt ::= TAGS NK_LP col_name_list NK_RP */ yytestcase(yyruleno==319); +{ yymsp[-3].minor.yy220 = yymsp[-1].minor.yy220; } break; - case 171: /* type_name ::= TINYINT UNSIGNED */ -{ yymsp[-1].minor.yy448 = createDataType(TSDB_DATA_TYPE_UTINYINT); } + case 194: /* table_options ::= */ +{ yymsp[1].minor.yy140 = createDefaultTableOptions(pCxt); } break; - case 172: /* type_name ::= SMALLINT UNSIGNED */ -{ yymsp[-1].minor.yy448 = createDataType(TSDB_DATA_TYPE_USMALLINT); } + case 195: /* table_options ::= table_options COMMENT NK_STRING */ +{ yylhsminor.yy140 = setTableOption(pCxt, yymsp[-2].minor.yy140, TABLE_OPTION_COMMENT, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy140 = yylhsminor.yy140; break; - case 173: /* type_name ::= INT UNSIGNED */ -{ yymsp[-1].minor.yy448 = createDataType(TSDB_DATA_TYPE_UINT); } + case 196: /* table_options ::= table_options MAX_DELAY duration_list */ +{ yylhsminor.yy140 = setTableOption(pCxt, yymsp[-2].minor.yy140, TABLE_OPTION_MAXDELAY, yymsp[0].minor.yy220); } + yymsp[-2].minor.yy140 = yylhsminor.yy140; break; - case 174: /* type_name ::= BIGINT UNSIGNED */ -{ yymsp[-1].minor.yy448 = createDataType(TSDB_DATA_TYPE_UBIGINT); } + case 197: /* table_options ::= table_options WATERMARK duration_list */ +{ yylhsminor.yy140 = setTableOption(pCxt, yymsp[-2].minor.yy140, TABLE_OPTION_WATERMARK, yymsp[0].minor.yy220); } + yymsp[-2].minor.yy140 = yylhsminor.yy140; break; - case 175: /* type_name ::= JSON */ -{ yymsp[0].minor.yy448 = createDataType(TSDB_DATA_TYPE_JSON); } + case 198: /* table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ +{ yylhsminor.yy140 = setTableOption(pCxt, yymsp[-4].minor.yy140, TABLE_OPTION_ROLLUP, yymsp[-1].minor.yy220); } + yymsp[-4].minor.yy140 = yylhsminor.yy140; break; - case 176: /* type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy448 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); } + case 199: /* table_options ::= table_options TTL NK_INTEGER */ +{ yylhsminor.yy140 = setTableOption(pCxt, yymsp[-2].minor.yy140, TABLE_OPTION_TTL, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy140 = yylhsminor.yy140; break; - case 177: /* type_name ::= MEDIUMBLOB */ -{ yymsp[0].minor.yy448 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); } + case 200: /* table_options ::= table_options SMA NK_LP col_name_list NK_RP */ +{ yylhsminor.yy140 = setTableOption(pCxt, yymsp[-4].minor.yy140, TABLE_OPTION_SMA, yymsp[-1].minor.yy220); } + yymsp[-4].minor.yy140 = yylhsminor.yy140; break; - case 178: /* type_name ::= BLOB */ -{ yymsp[0].minor.yy448 = createDataType(TSDB_DATA_TYPE_BLOB); } + case 201: /* table_options ::= table_options DELETE_MARK duration_list */ +{ yylhsminor.yy140 = setTableOption(pCxt, yymsp[-2].minor.yy140, TABLE_OPTION_DELETE_MARK, yymsp[0].minor.yy220); } + yymsp[-2].minor.yy140 = yylhsminor.yy140; break; - case 179: /* type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy448 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &yymsp[-1].minor.yy0); } + case 202: /* alter_table_options ::= alter_table_option */ +{ yylhsminor.yy140 = createAlterTableOptions(pCxt); yylhsminor.yy140 = setTableOption(pCxt, yylhsminor.yy140, yymsp[0].minor.yy809.type, &yymsp[0].minor.yy809.val); } + yymsp[0].minor.yy140 = yylhsminor.yy140; break; - case 180: /* type_name ::= DECIMAL */ -{ yymsp[0].minor.yy448 = createDataType(TSDB_DATA_TYPE_DECIMAL); } + case 203: /* alter_table_options ::= alter_table_options alter_table_option */ +{ yylhsminor.yy140 = setTableOption(pCxt, yymsp[-1].minor.yy140, yymsp[0].minor.yy809.type, &yymsp[0].minor.yy809.val); } + yymsp[-1].minor.yy140 = yylhsminor.yy140; break; - case 181: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy448 = createDataType(TSDB_DATA_TYPE_DECIMAL); } + case 204: /* alter_table_option ::= COMMENT NK_STRING */ +{ yymsp[-1].minor.yy809.type = TABLE_OPTION_COMMENT; yymsp[-1].minor.yy809.val = yymsp[0].minor.yy0; } break; - case 182: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ -{ yymsp[-5].minor.yy448 = createDataType(TSDB_DATA_TYPE_DECIMAL); } + case 205: /* alter_table_option ::= TTL NK_INTEGER */ +{ yymsp[-1].minor.yy809.type = TABLE_OPTION_TTL; yymsp[-1].minor.yy809.val = yymsp[0].minor.yy0; } break; - case 184: /* tags_def_opt ::= tags_def */ - case 310: /* tag_def_or_ref_opt ::= tags_def */ yytestcase(yyruleno==310); - case 426: /* star_func_para_list ::= other_para_list */ yytestcase(yyruleno==426); -{ yylhsminor.yy110 = yymsp[0].minor.yy110; } - yymsp[0].minor.yy110 = yylhsminor.yy110; + case 206: /* duration_list ::= duration_literal */ + case 398: /* expression_list ::= expr_or_subquery */ yytestcase(yyruleno==398); +{ yylhsminor.yy220 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy140)); } + yymsp[0].minor.yy220 = yylhsminor.yy220; break; - case 185: /* tags_def ::= TAGS NK_LP column_def_list NK_RP */ - case 311: /* tag_def_or_ref_opt ::= TAGS NK_LP col_name_list NK_RP */ yytestcase(yyruleno==311); -{ yymsp[-3].minor.yy110 = yymsp[-1].minor.yy110; } + case 207: /* duration_list ::= duration_list NK_COMMA duration_literal */ + case 399: /* expression_list ::= expression_list NK_COMMA expr_or_subquery */ yytestcase(yyruleno==399); +{ yylhsminor.yy220 = addNodeToList(pCxt, yymsp[-2].minor.yy220, releaseRawExprNode(pCxt, yymsp[0].minor.yy140)); } + yymsp[-2].minor.yy220 = yylhsminor.yy220; break; - case 186: /* table_options ::= */ -{ yymsp[1].minor.yy42 = createDefaultTableOptions(pCxt); } + case 210: /* rollup_func_name ::= function_name */ +{ yylhsminor.yy140 = createFunctionNode(pCxt, &yymsp[0].minor.yy881, NULL); } + yymsp[0].minor.yy140 = yylhsminor.yy140; break; - case 187: /* table_options ::= table_options COMMENT NK_STRING */ -{ yylhsminor.yy42 = setTableOption(pCxt, yymsp[-2].minor.yy42, TABLE_OPTION_COMMENT, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy42 = yylhsminor.yy42; + case 211: /* rollup_func_name ::= FIRST */ + case 212: /* rollup_func_name ::= LAST */ yytestcase(yyruleno==212); + case 267: /* tag_item ::= QTAGS */ yytestcase(yyruleno==267); +{ yylhsminor.yy140 = createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL); } + yymsp[0].minor.yy140 = yylhsminor.yy140; break; - case 188: /* table_options ::= table_options MAX_DELAY duration_list */ -{ yylhsminor.yy42 = setTableOption(pCxt, yymsp[-2].minor.yy42, TABLE_OPTION_MAXDELAY, yymsp[0].minor.yy110); } - yymsp[-2].minor.yy42 = yylhsminor.yy42; + case 215: /* col_name ::= column_name */ + case 268: /* tag_item ::= column_name */ yytestcase(yyruleno==268); +{ yylhsminor.yy140 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy881); } + yymsp[0].minor.yy140 = yylhsminor.yy140; break; - case 189: /* table_options ::= table_options WATERMARK duration_list */ -{ yylhsminor.yy42 = setTableOption(pCxt, yymsp[-2].minor.yy42, TABLE_OPTION_WATERMARK, yymsp[0].minor.yy110); } - yymsp[-2].minor.yy42 = yylhsminor.yy42; - break; - case 190: /* table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ -{ yylhsminor.yy42 = setTableOption(pCxt, yymsp[-4].minor.yy42, TABLE_OPTION_ROLLUP, yymsp[-1].minor.yy110); } - yymsp[-4].minor.yy42 = yylhsminor.yy42; - break; - case 191: /* table_options ::= table_options TTL NK_INTEGER */ -{ yylhsminor.yy42 = setTableOption(pCxt, yymsp[-2].minor.yy42, TABLE_OPTION_TTL, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy42 = yylhsminor.yy42; - break; - case 192: /* table_options ::= table_options SMA NK_LP col_name_list NK_RP */ -{ yylhsminor.yy42 = setTableOption(pCxt, yymsp[-4].minor.yy42, TABLE_OPTION_SMA, yymsp[-1].minor.yy110); } - yymsp[-4].minor.yy42 = yylhsminor.yy42; - break; - case 193: /* table_options ::= table_options DELETE_MARK duration_list */ -{ yylhsminor.yy42 = setTableOption(pCxt, yymsp[-2].minor.yy42, TABLE_OPTION_DELETE_MARK, yymsp[0].minor.yy110); } - yymsp[-2].minor.yy42 = yylhsminor.yy42; - break; - case 194: /* alter_table_options ::= alter_table_option */ -{ yylhsminor.yy42 = createAlterTableOptions(pCxt); yylhsminor.yy42 = setTableOption(pCxt, yylhsminor.yy42, yymsp[0].minor.yy459.type, &yymsp[0].minor.yy459.val); } - yymsp[0].minor.yy42 = yylhsminor.yy42; - break; - case 195: /* alter_table_options ::= alter_table_options alter_table_option */ -{ yylhsminor.yy42 = setTableOption(pCxt, yymsp[-1].minor.yy42, yymsp[0].minor.yy459.type, &yymsp[0].minor.yy459.val); } - yymsp[-1].minor.yy42 = yylhsminor.yy42; - break; - case 196: /* alter_table_option ::= COMMENT NK_STRING */ -{ yymsp[-1].minor.yy459.type = TABLE_OPTION_COMMENT; yymsp[-1].minor.yy459.val = yymsp[0].minor.yy0; } - break; - case 197: /* alter_table_option ::= TTL NK_INTEGER */ -{ yymsp[-1].minor.yy459.type = TABLE_OPTION_TTL; yymsp[-1].minor.yy459.val = yymsp[0].minor.yy0; } - break; - case 198: /* duration_list ::= duration_literal */ - case 390: /* expression_list ::= expr_or_subquery */ yytestcase(yyruleno==390); -{ yylhsminor.yy110 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy42)); } - yymsp[0].minor.yy110 = yylhsminor.yy110; - break; - case 199: /* duration_list ::= duration_list NK_COMMA duration_literal */ - case 391: /* expression_list ::= expression_list NK_COMMA expr_or_subquery */ yytestcase(yyruleno==391); -{ yylhsminor.yy110 = addNodeToList(pCxt, yymsp[-2].minor.yy110, releaseRawExprNode(pCxt, yymsp[0].minor.yy42)); } - yymsp[-2].minor.yy110 = yylhsminor.yy110; - break; - case 202: /* rollup_func_name ::= function_name */ -{ yylhsminor.yy42 = createFunctionNode(pCxt, &yymsp[0].minor.yy225, NULL); } - yymsp[0].minor.yy42 = yylhsminor.yy42; - break; - case 203: /* rollup_func_name ::= FIRST */ - case 204: /* rollup_func_name ::= LAST */ yytestcase(yyruleno==204); - case 259: /* tag_item ::= QTAGS */ yytestcase(yyruleno==259); -{ yylhsminor.yy42 = createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL); } - yymsp[0].minor.yy42 = yylhsminor.yy42; - break; - case 207: /* col_name ::= column_name */ - case 260: /* tag_item ::= column_name */ yytestcase(yyruleno==260); -{ yylhsminor.yy42 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy225); } - yymsp[0].minor.yy42 = yylhsminor.yy42; - break; - case 208: /* cmd ::= SHOW DNODES */ + case 216: /* cmd ::= SHOW DNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DNODES_STMT); } break; - case 209: /* cmd ::= SHOW USERS */ + case 217: /* cmd ::= SHOW USERS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_USERS_STMT); } break; - case 210: /* cmd ::= SHOW USER PRIVILEGES */ + case 218: /* cmd ::= SHOW USER PRIVILEGES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_USER_PRIVILEGES_STMT); } break; - case 211: /* cmd ::= SHOW DATABASES */ + case 219: /* cmd ::= SHOW DATABASES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DATABASES_STMT); } break; - case 212: /* cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */ -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TABLES_STMT, yymsp[-2].minor.yy42, yymsp[0].minor.yy42, OP_TYPE_LIKE); } + case 220: /* cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */ +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TABLES_STMT, yymsp[-2].minor.yy140, yymsp[0].minor.yy140, OP_TYPE_LIKE); } break; - case 213: /* cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_STABLES_STMT, yymsp[-2].minor.yy42, yymsp[0].minor.yy42, OP_TYPE_LIKE); } + case 221: /* cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_STABLES_STMT, yymsp[-2].minor.yy140, yymsp[0].minor.yy140, OP_TYPE_LIKE); } break; - case 214: /* cmd ::= SHOW db_name_cond_opt VGROUPS */ -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VGROUPS_STMT, yymsp[-1].minor.yy42, NULL, OP_TYPE_LIKE); } + case 222: /* cmd ::= SHOW db_name_cond_opt VGROUPS */ +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VGROUPS_STMT, yymsp[-1].minor.yy140, NULL, OP_TYPE_LIKE); } break; - case 215: /* cmd ::= SHOW MNODES */ + case 223: /* cmd ::= SHOW MNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_MNODES_STMT); } break; - case 216: /* cmd ::= SHOW QNODES */ + case 224: /* cmd ::= SHOW QNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_QNODES_STMT); } break; - case 217: /* cmd ::= SHOW FUNCTIONS */ + case 225: /* cmd ::= SHOW FUNCTIONS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_FUNCTIONS_STMT); } break; - case 218: /* cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, yymsp[0].minor.yy42, yymsp[-1].minor.yy42, OP_TYPE_EQUAL); } + case 226: /* cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, yymsp[0].minor.yy140, yymsp[-1].minor.yy140, OP_TYPE_EQUAL); } break; - case 219: /* cmd ::= SHOW STREAMS */ + case 227: /* cmd ::= SHOW STREAMS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_STREAMS_STMT); } break; - case 220: /* cmd ::= SHOW ACCOUNTS */ + case 228: /* cmd ::= SHOW ACCOUNTS */ { pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); } break; - case 221: /* cmd ::= SHOW APPS */ + case 229: /* cmd ::= SHOW APPS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_APPS_STMT); } break; - case 222: /* cmd ::= SHOW CONNECTIONS */ + case 230: /* cmd ::= SHOW CONNECTIONS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CONNECTIONS_STMT); } break; - case 223: /* cmd ::= SHOW LICENCES */ - case 224: /* cmd ::= SHOW GRANTS */ yytestcase(yyruleno==224); + case 231: /* cmd ::= SHOW LICENCES */ + case 232: /* cmd ::= SHOW GRANTS */ yytestcase(yyruleno==232); { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_LICENCES_STMT); } break; - case 225: /* cmd ::= SHOW CREATE DATABASE db_name */ -{ pCxt->pRootNode = createShowCreateDatabaseStmt(pCxt, &yymsp[0].minor.yy225); } + case 233: /* cmd ::= SHOW CREATE DATABASE db_name */ +{ pCxt->pRootNode = createShowCreateDatabaseStmt(pCxt, &yymsp[0].minor.yy881); } break; - case 226: /* cmd ::= SHOW CREATE TABLE full_table_name */ -{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_TABLE_STMT, yymsp[0].minor.yy42); } + case 234: /* cmd ::= SHOW CREATE TABLE full_table_name */ +{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_TABLE_STMT, yymsp[0].minor.yy140); } break; - case 227: /* cmd ::= SHOW CREATE STABLE full_table_name */ -{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_STABLE_STMT, yymsp[0].minor.yy42); } + case 235: /* cmd ::= SHOW CREATE STABLE full_table_name */ +{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_STABLE_STMT, yymsp[0].minor.yy140); } break; - case 228: /* cmd ::= SHOW QUERIES */ + case 236: /* cmd ::= SHOW QUERIES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_QUERIES_STMT); } break; - case 229: /* cmd ::= SHOW SCORES */ + case 237: /* cmd ::= SHOW SCORES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SCORES_STMT); } break; - case 230: /* cmd ::= SHOW TOPICS */ + case 238: /* cmd ::= SHOW TOPICS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TOPICS_STMT); } break; - case 231: /* cmd ::= SHOW VARIABLES */ - case 232: /* cmd ::= SHOW CLUSTER VARIABLES */ yytestcase(yyruleno==232); + case 239: /* cmd ::= SHOW VARIABLES */ + case 240: /* cmd ::= SHOW CLUSTER VARIABLES */ yytestcase(yyruleno==240); { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_VARIABLES_STMT); } break; - case 233: /* cmd ::= SHOW LOCAL VARIABLES */ + case 241: /* cmd ::= SHOW LOCAL VARIABLES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_LOCAL_VARIABLES_STMT); } break; - case 234: /* 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.yy42); } + case 242: /* 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.yy140); } break; - case 235: /* cmd ::= SHOW BNODES */ + case 243: /* cmd ::= SHOW BNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_BNODES_STMT); } break; - case 236: /* cmd ::= SHOW SNODES */ + case 244: /* cmd ::= SHOW SNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SNODES_STMT); } break; - case 237: /* cmd ::= SHOW CLUSTER */ + case 245: /* cmd ::= SHOW CLUSTER */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CLUSTER_STMT); } break; - case 238: /* cmd ::= SHOW TRANSACTIONS */ + case 246: /* cmd ::= SHOW TRANSACTIONS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TRANSACTIONS_STMT); } break; - case 239: /* cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ -{ pCxt->pRootNode = createShowTableDistributedStmt(pCxt, yymsp[0].minor.yy42); } + case 247: /* cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ +{ pCxt->pRootNode = createShowTableDistributedStmt(pCxt, yymsp[0].minor.yy140); } break; - case 240: /* cmd ::= SHOW CONSUMERS */ + case 248: /* cmd ::= SHOW CONSUMERS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CONSUMERS_STMT); } break; - case 241: /* cmd ::= SHOW SUBSCRIPTIONS */ + case 249: /* cmd ::= SHOW SUBSCRIPTIONS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SUBSCRIPTIONS_STMT); } break; - case 242: /* cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */ -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, yymsp[0].minor.yy42, yymsp[-1].minor.yy42, OP_TYPE_EQUAL); } + case 250: /* cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */ +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, yymsp[0].minor.yy140, yymsp[-1].minor.yy140, OP_TYPE_EQUAL); } break; - case 243: /* cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */ -{ pCxt->pRootNode = createShowTableTagsStmt(pCxt, yymsp[-1].minor.yy42, yymsp[0].minor.yy42, yymsp[-3].minor.yy110); } + case 251: /* cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */ +{ pCxt->pRootNode = createShowTableTagsStmt(pCxt, yymsp[-1].minor.yy140, yymsp[0].minor.yy140, yymsp[-3].minor.yy220); } break; - case 244: /* cmd ::= SHOW VNODES NK_INTEGER */ + case 252: /* cmd ::= SHOW VNODES NK_INTEGER */ { pCxt->pRootNode = createShowVnodesStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0), NULL); } break; - case 245: /* cmd ::= SHOW VNODES NK_STRING */ + case 253: /* cmd ::= SHOW VNODES NK_STRING */ { pCxt->pRootNode = createShowVnodesStmt(pCxt, NULL, createValueNode(pCxt, TSDB_DATA_TYPE_VARCHAR, &yymsp[0].minor.yy0)); } break; - case 246: /* cmd ::= SHOW db_name_cond_opt ALIVE */ -{ pCxt->pRootNode = createShowAliveStmt(pCxt, yymsp[-1].minor.yy42, QUERY_NODE_SHOW_DB_ALIVE_STMT); } + case 254: /* cmd ::= SHOW db_name_cond_opt ALIVE */ +{ pCxt->pRootNode = createShowAliveStmt(pCxt, yymsp[-1].minor.yy140, QUERY_NODE_SHOW_DB_ALIVE_STMT); } break; - case 247: /* cmd ::= SHOW CLUSTER ALIVE */ + case 255: /* cmd ::= SHOW CLUSTER ALIVE */ { pCxt->pRootNode = createShowAliveStmt(pCxt, NULL, QUERY_NODE_SHOW_CLUSTER_ALIVE_STMT); } break; - case 248: /* db_name_cond_opt ::= */ - case 253: /* from_db_opt ::= */ yytestcase(yyruleno==253); -{ yymsp[1].minor.yy42 = createDefaultDatabaseCondValue(pCxt); } + case 256: /* db_name_cond_opt ::= */ + case 261: /* from_db_opt ::= */ yytestcase(yyruleno==261); +{ yymsp[1].minor.yy140 = createDefaultDatabaseCondValue(pCxt); } break; - case 249: /* db_name_cond_opt ::= db_name NK_DOT */ -{ yylhsminor.yy42 = createIdentifierValueNode(pCxt, &yymsp[-1].minor.yy225); } - yymsp[-1].minor.yy42 = yylhsminor.yy42; + case 257: /* db_name_cond_opt ::= db_name NK_DOT */ +{ yylhsminor.yy140 = createIdentifierValueNode(pCxt, &yymsp[-1].minor.yy881); } + yymsp[-1].minor.yy140 = yylhsminor.yy140; break; - case 250: /* like_pattern_opt ::= */ - case 321: /* subtable_opt ::= */ yytestcase(yyruleno==321); - case 436: /* case_when_else_opt ::= */ yytestcase(yyruleno==436); - case 466: /* from_clause_opt ::= */ yytestcase(yyruleno==466); - case 495: /* where_clause_opt ::= */ yytestcase(yyruleno==495); - case 504: /* twindow_clause_opt ::= */ yytestcase(yyruleno==504); - case 510: /* sliding_opt ::= */ yytestcase(yyruleno==510); - case 512: /* fill_opt ::= */ yytestcase(yyruleno==512); - case 526: /* having_clause_opt ::= */ yytestcase(yyruleno==526); - case 528: /* range_opt ::= */ yytestcase(yyruleno==528); - case 530: /* every_opt ::= */ yytestcase(yyruleno==530); - case 543: /* slimit_clause_opt ::= */ yytestcase(yyruleno==543); - case 547: /* limit_clause_opt ::= */ yytestcase(yyruleno==547); -{ yymsp[1].minor.yy42 = NULL; } + case 259: /* like_pattern_opt ::= LIKE NK_STRING */ +{ yymsp[-1].minor.yy140 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } break; - case 251: /* like_pattern_opt ::= LIKE NK_STRING */ -{ yymsp[-1].minor.yy42 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } + case 260: /* table_name_cond ::= table_name */ +{ yylhsminor.yy140 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy881); } + yymsp[0].minor.yy140 = yylhsminor.yy140; break; - case 252: /* table_name_cond ::= table_name */ -{ yylhsminor.yy42 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy225); } - yymsp[0].minor.yy42 = yylhsminor.yy42; + case 262: /* from_db_opt ::= FROM db_name */ +{ yymsp[-1].minor.yy140 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy881); } break; - case 254: /* from_db_opt ::= FROM db_name */ -{ yymsp[-1].minor.yy42 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy225); } + case 266: /* tag_item ::= TBNAME */ +{ yylhsminor.yy140 = setProjectionAlias(pCxt, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL), &yymsp[0].minor.yy0); } + yymsp[0].minor.yy140 = yylhsminor.yy140; break; - case 258: /* tag_item ::= TBNAME */ -{ yylhsminor.yy42 = setProjectionAlias(pCxt, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL), &yymsp[0].minor.yy0); } - yymsp[0].minor.yy42 = yylhsminor.yy42; + case 269: /* tag_item ::= column_name column_alias */ +{ yylhsminor.yy140 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-1].minor.yy881), &yymsp[0].minor.yy881); } + yymsp[-1].minor.yy140 = yylhsminor.yy140; break; - case 261: /* tag_item ::= column_name column_alias */ -{ yylhsminor.yy42 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-1].minor.yy225), &yymsp[0].minor.yy225); } - yymsp[-1].minor.yy42 = yylhsminor.yy42; + case 270: /* tag_item ::= column_name AS column_alias */ +{ yylhsminor.yy140 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-2].minor.yy881), &yymsp[0].minor.yy881); } + yymsp[-2].minor.yy140 = yylhsminor.yy140; break; - case 262: /* tag_item ::= column_name AS column_alias */ -{ yylhsminor.yy42 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-2].minor.yy225), &yymsp[0].minor.yy225); } - yymsp[-2].minor.yy42 = yylhsminor.yy42; + case 271: /* 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.yy587, yymsp[-3].minor.yy140, yymsp[-1].minor.yy140, NULL, yymsp[0].minor.yy140); } break; - case 263: /* 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.yy103, yymsp[-3].minor.yy42, yymsp[-1].minor.yy42, NULL, yymsp[0].minor.yy42); } + case 272: /* 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.yy587, yymsp[-5].minor.yy140, yymsp[-3].minor.yy140, yymsp[-1].minor.yy220, NULL); } break; - case 264: /* 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.yy103, yymsp[-5].minor.yy42, yymsp[-3].minor.yy42, yymsp[-1].minor.yy110, NULL); } + case 273: /* cmd ::= DROP INDEX exists_opt full_index_name */ +{ pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-1].minor.yy587, yymsp[0].minor.yy140); } break; - case 265: /* cmd ::= DROP INDEX exists_opt full_index_name */ -{ pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-1].minor.yy103, yymsp[0].minor.yy42); } + case 274: /* full_index_name ::= index_name */ +{ yylhsminor.yy140 = createRealTableNodeForIndexName(pCxt, NULL, &yymsp[0].minor.yy881); } + yymsp[0].minor.yy140 = yylhsminor.yy140; break; - case 266: /* full_index_name ::= index_name */ -{ yylhsminor.yy42 = createRealTableNodeForIndexName(pCxt, NULL, &yymsp[0].minor.yy225); } - yymsp[0].minor.yy42 = yylhsminor.yy42; + case 275: /* full_index_name ::= db_name NK_DOT index_name */ +{ yylhsminor.yy140 = createRealTableNodeForIndexName(pCxt, &yymsp[-2].minor.yy881, &yymsp[0].minor.yy881); } + yymsp[-2].minor.yy140 = yylhsminor.yy140; break; - case 267: /* full_index_name ::= db_name NK_DOT index_name */ -{ yylhsminor.yy42 = createRealTableNodeForIndexName(pCxt, &yymsp[-2].minor.yy225, &yymsp[0].minor.yy225); } - yymsp[-2].minor.yy42 = yylhsminor.yy42; + case 276: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ +{ yymsp[-9].minor.yy140 = createIndexOption(pCxt, yymsp[-7].minor.yy220, releaseRawExprNode(pCxt, yymsp[-3].minor.yy140), NULL, yymsp[-1].minor.yy140, yymsp[0].minor.yy140); } break; - case 268: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ -{ yymsp[-9].minor.yy42 = createIndexOption(pCxt, yymsp[-7].minor.yy110, releaseRawExprNode(pCxt, yymsp[-3].minor.yy42), NULL, yymsp[-1].minor.yy42, yymsp[0].minor.yy42); } + case 277: /* 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.yy140 = createIndexOption(pCxt, yymsp[-9].minor.yy220, releaseRawExprNode(pCxt, yymsp[-5].minor.yy140), releaseRawExprNode(pCxt, yymsp[-3].minor.yy140), yymsp[-1].minor.yy140, yymsp[0].minor.yy140); } break; - case 269: /* 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.yy42 = createIndexOption(pCxt, yymsp[-9].minor.yy110, releaseRawExprNode(pCxt, yymsp[-5].minor.yy42), releaseRawExprNode(pCxt, yymsp[-3].minor.yy42), yymsp[-1].minor.yy42, yymsp[0].minor.yy42); } + case 280: /* func ::= sma_func_name NK_LP expression_list NK_RP */ +{ yylhsminor.yy140 = createFunctionNode(pCxt, &yymsp[-3].minor.yy881, yymsp[-1].minor.yy220); } + yymsp[-3].minor.yy140 = yylhsminor.yy140; break; - case 272: /* func ::= sma_func_name NK_LP expression_list NK_RP */ -{ yylhsminor.yy42 = createFunctionNode(pCxt, &yymsp[-3].minor.yy225, yymsp[-1].minor.yy110); } - yymsp[-3].minor.yy42 = yylhsminor.yy42; + case 286: /* sma_stream_opt ::= */ + case 320: /* stream_options ::= */ yytestcase(yyruleno==320); +{ yymsp[1].minor.yy140 = createStreamOptions(pCxt); } break; - case 278: /* sma_stream_opt ::= */ - case 312: /* stream_options ::= */ yytestcase(yyruleno==312); -{ yymsp[1].minor.yy42 = createStreamOptions(pCxt); } + case 287: /* sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */ +{ ((SStreamOptions*)yymsp[-2].minor.yy140)->pWatermark = releaseRawExprNode(pCxt, yymsp[0].minor.yy140); yylhsminor.yy140 = yymsp[-2].minor.yy140; } + yymsp[-2].minor.yy140 = yylhsminor.yy140; break; - case 279: /* sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */ -{ ((SStreamOptions*)yymsp[-2].minor.yy42)->pWatermark = releaseRawExprNode(pCxt, yymsp[0].minor.yy42); yylhsminor.yy42 = yymsp[-2].minor.yy42; } - yymsp[-2].minor.yy42 = yylhsminor.yy42; + case 288: /* sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */ +{ ((SStreamOptions*)yymsp[-2].minor.yy140)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy140); yylhsminor.yy140 = yymsp[-2].minor.yy140; } + yymsp[-2].minor.yy140 = yylhsminor.yy140; break; - case 280: /* sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */ -{ ((SStreamOptions*)yymsp[-2].minor.yy42)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy42); yylhsminor.yy42 = yymsp[-2].minor.yy42; } - yymsp[-2].minor.yy42 = yylhsminor.yy42; + case 289: /* sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */ +{ ((SStreamOptions*)yymsp[-2].minor.yy140)->pDeleteMark = releaseRawExprNode(pCxt, yymsp[0].minor.yy140); yylhsminor.yy140 = yymsp[-2].minor.yy140; } + yymsp[-2].minor.yy140 = yylhsminor.yy140; break; - case 281: /* sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */ -{ ((SStreamOptions*)yymsp[-2].minor.yy42)->pDeleteMark = releaseRawExprNode(pCxt, yymsp[0].minor.yy42); yylhsminor.yy42 = yymsp[-2].minor.yy42; } - yymsp[-2].minor.yy42 = yylhsminor.yy42; + case 290: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ +{ pCxt->pRootNode = createCreateTopicStmtUseQuery(pCxt, yymsp[-3].minor.yy587, &yymsp[-2].minor.yy881, yymsp[0].minor.yy140); } break; - case 282: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ -{ pCxt->pRootNode = createCreateTopicStmtUseQuery(pCxt, yymsp[-3].minor.yy103, &yymsp[-2].minor.yy225, yymsp[0].minor.yy42); } + case 291: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name */ +{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-4].minor.yy587, &yymsp[-3].minor.yy881, &yymsp[0].minor.yy881, false); } break; - case 283: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name */ -{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-4].minor.yy103, &yymsp[-3].minor.yy225, &yymsp[0].minor.yy225, false); } + case 292: /* cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name */ +{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-6].minor.yy587, &yymsp[-5].minor.yy881, &yymsp[0].minor.yy881, true); } break; - case 284: /* cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name */ -{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-6].minor.yy103, &yymsp[-5].minor.yy225, &yymsp[0].minor.yy225, true); } + case 293: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name */ +{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-4].minor.yy587, &yymsp[-3].minor.yy881, yymsp[0].minor.yy140, false); } break; - case 285: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name */ -{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-4].minor.yy103, &yymsp[-3].minor.yy225, yymsp[0].minor.yy42, false); } + case 294: /* cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name */ +{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-6].minor.yy587, &yymsp[-5].minor.yy881, yymsp[0].minor.yy140, true); } break; - case 286: /* cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name */ -{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-6].minor.yy103, &yymsp[-5].minor.yy225, yymsp[0].minor.yy42, true); } + case 295: /* cmd ::= DROP TOPIC exists_opt topic_name */ +{ pCxt->pRootNode = createDropTopicStmt(pCxt, yymsp[-1].minor.yy587, &yymsp[0].minor.yy881); } break; - case 287: /* cmd ::= DROP TOPIC exists_opt topic_name */ -{ pCxt->pRootNode = createDropTopicStmt(pCxt, yymsp[-1].minor.yy103, &yymsp[0].minor.yy225); } + case 296: /* cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ +{ pCxt->pRootNode = createDropCGroupStmt(pCxt, yymsp[-3].minor.yy587, &yymsp[-2].minor.yy881, &yymsp[0].minor.yy881); } break; - case 288: /* cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ -{ pCxt->pRootNode = createDropCGroupStmt(pCxt, yymsp[-3].minor.yy103, &yymsp[-2].minor.yy225, &yymsp[0].minor.yy225); } + case 297: /* cmd ::= DESC full_table_name */ + case 298: /* cmd ::= DESCRIBE full_table_name */ yytestcase(yyruleno==298); +{ pCxt->pRootNode = createDescribeStmt(pCxt, yymsp[0].minor.yy140); } break; - case 289: /* cmd ::= DESC full_table_name */ - case 290: /* cmd ::= DESCRIBE full_table_name */ yytestcase(yyruleno==290); -{ pCxt->pRootNode = createDescribeStmt(pCxt, yymsp[0].minor.yy42); } - break; - case 291: /* cmd ::= RESET QUERY CACHE */ + case 299: /* cmd ::= RESET QUERY CACHE */ { pCxt->pRootNode = createResetQueryCacheStmt(pCxt); } break; - case 292: /* cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ - case 293: /* cmd ::= EXPLAIN analyze_opt explain_options insert_query */ yytestcase(yyruleno==293); -{ pCxt->pRootNode = createExplainStmt(pCxt, yymsp[-2].minor.yy103, yymsp[-1].minor.yy42, yymsp[0].minor.yy42); } + case 300: /* cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ + case 301: /* cmd ::= EXPLAIN analyze_opt explain_options insert_query */ yytestcase(yyruleno==301); +{ pCxt->pRootNode = createExplainStmt(pCxt, yymsp[-2].minor.yy587, yymsp[-1].minor.yy140, yymsp[0].minor.yy140); } break; - case 296: /* explain_options ::= */ -{ yymsp[1].minor.yy42 = createDefaultExplainOptions(pCxt); } + case 304: /* explain_options ::= */ +{ yymsp[1].minor.yy140 = createDefaultExplainOptions(pCxt); } break; - case 297: /* explain_options ::= explain_options VERBOSE NK_BOOL */ -{ yylhsminor.yy42 = setExplainVerbose(pCxt, yymsp[-2].minor.yy42, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy42 = yylhsminor.yy42; + case 305: /* explain_options ::= explain_options VERBOSE NK_BOOL */ +{ yylhsminor.yy140 = setExplainVerbose(pCxt, yymsp[-2].minor.yy140, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy140 = yylhsminor.yy140; break; - case 298: /* explain_options ::= explain_options RATIO NK_FLOAT */ -{ yylhsminor.yy42 = setExplainRatio(pCxt, yymsp[-2].minor.yy42, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy42 = yylhsminor.yy42; + case 306: /* explain_options ::= explain_options RATIO NK_FLOAT */ +{ yylhsminor.yy140 = setExplainRatio(pCxt, yymsp[-2].minor.yy140, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy140 = yylhsminor.yy140; break; - case 299: /* cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt */ -{ pCxt->pRootNode = createCreateFunctionStmt(pCxt, yymsp[-6].minor.yy103, yymsp[-8].minor.yy103, &yymsp[-5].minor.yy225, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy448, yymsp[0].minor.yy508); } + case 307: /* cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt */ +{ pCxt->pRootNode = createCreateFunctionStmt(pCxt, yymsp[-6].minor.yy587, yymsp[-8].minor.yy587, &yymsp[-5].minor.yy881, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy682, yymsp[0].minor.yy214); } break; - case 300: /* cmd ::= DROP FUNCTION exists_opt function_name */ -{ pCxt->pRootNode = createDropFunctionStmt(pCxt, yymsp[-1].minor.yy103, &yymsp[0].minor.yy225); } + case 308: /* cmd ::= DROP FUNCTION exists_opt function_name */ +{ pCxt->pRootNode = createDropFunctionStmt(pCxt, yymsp[-1].minor.yy587, &yymsp[0].minor.yy881); } break; - case 305: /* 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.yy103, &yymsp[-8].minor.yy225, yymsp[-5].minor.yy42, yymsp[-7].minor.yy42, yymsp[-3].minor.yy110, yymsp[-2].minor.yy42, yymsp[0].minor.yy42, yymsp[-4].minor.yy110); } + case 313: /* 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.yy587, &yymsp[-8].minor.yy881, yymsp[-5].minor.yy140, yymsp[-7].minor.yy140, yymsp[-3].minor.yy220, yymsp[-2].minor.yy140, yymsp[0].minor.yy140, yymsp[-4].minor.yy220); } break; - case 306: /* cmd ::= DROP STREAM exists_opt stream_name */ -{ pCxt->pRootNode = createDropStreamStmt(pCxt, yymsp[-1].minor.yy103, &yymsp[0].minor.yy225); } + case 314: /* cmd ::= DROP STREAM exists_opt stream_name */ +{ pCxt->pRootNode = createDropStreamStmt(pCxt, yymsp[-1].minor.yy587, &yymsp[0].minor.yy881); } break; - case 313: /* stream_options ::= stream_options TRIGGER AT_ONCE */ - case 314: /* stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ yytestcase(yyruleno==314); -{ yylhsminor.yy42 = setStreamOptions(pCxt, yymsp[-2].minor.yy42, SOPT_TRIGGER_TYPE_SET, &yymsp[0].minor.yy0, NULL); } - yymsp[-2].minor.yy42 = yylhsminor.yy42; + case 321: /* stream_options ::= stream_options TRIGGER AT_ONCE */ + case 322: /* stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ yytestcase(yyruleno==322); +{ yylhsminor.yy140 = setStreamOptions(pCxt, yymsp[-2].minor.yy140, SOPT_TRIGGER_TYPE_SET, &yymsp[0].minor.yy0, NULL); } + yymsp[-2].minor.yy140 = yylhsminor.yy140; break; - case 315: /* stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ -{ yylhsminor.yy42 = setStreamOptions(pCxt, yymsp[-3].minor.yy42, SOPT_TRIGGER_TYPE_SET, &yymsp[-1].minor.yy0, releaseRawExprNode(pCxt, yymsp[0].minor.yy42)); } - yymsp[-3].minor.yy42 = yylhsminor.yy42; + case 323: /* stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ +{ yylhsminor.yy140 = setStreamOptions(pCxt, yymsp[-3].minor.yy140, SOPT_TRIGGER_TYPE_SET, &yymsp[-1].minor.yy0, releaseRawExprNode(pCxt, yymsp[0].minor.yy140)); } + yymsp[-3].minor.yy140 = yylhsminor.yy140; break; - case 316: /* stream_options ::= stream_options WATERMARK duration_literal */ -{ yylhsminor.yy42 = setStreamOptions(pCxt, yymsp[-2].minor.yy42, SOPT_WATERMARK_SET, NULL, releaseRawExprNode(pCxt, yymsp[0].minor.yy42)); } - yymsp[-2].minor.yy42 = yylhsminor.yy42; + case 324: /* stream_options ::= stream_options WATERMARK duration_literal */ +{ yylhsminor.yy140 = setStreamOptions(pCxt, yymsp[-2].minor.yy140, SOPT_WATERMARK_SET, NULL, releaseRawExprNode(pCxt, yymsp[0].minor.yy140)); } + yymsp[-2].minor.yy140 = yylhsminor.yy140; break; - case 317: /* stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ -{ yylhsminor.yy42 = setStreamOptions(pCxt, yymsp[-3].minor.yy42, SOPT_IGNORE_EXPIRED_SET, &yymsp[0].minor.yy0, NULL); } - yymsp[-3].minor.yy42 = yylhsminor.yy42; + case 325: /* stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ +{ yylhsminor.yy140 = setStreamOptions(pCxt, yymsp[-3].minor.yy140, SOPT_IGNORE_EXPIRED_SET, &yymsp[0].minor.yy0, NULL); } + yymsp[-3].minor.yy140 = yylhsminor.yy140; break; - case 318: /* stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ -{ yylhsminor.yy42 = setStreamOptions(pCxt, yymsp[-2].minor.yy42, SOPT_FILL_HISTORY_SET, &yymsp[0].minor.yy0, NULL); } - yymsp[-2].minor.yy42 = yylhsminor.yy42; + case 326: /* stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ +{ yylhsminor.yy140 = setStreamOptions(pCxt, yymsp[-2].minor.yy140, SOPT_FILL_HISTORY_SET, &yymsp[0].minor.yy0, NULL); } + yymsp[-2].minor.yy140 = yylhsminor.yy140; break; - case 319: /* stream_options ::= stream_options DELETE_MARK duration_literal */ -{ yylhsminor.yy42 = setStreamOptions(pCxt, yymsp[-2].minor.yy42, SOPT_DELETE_MARK_SET, NULL, releaseRawExprNode(pCxt, yymsp[0].minor.yy42)); } - yymsp[-2].minor.yy42 = yylhsminor.yy42; + case 327: /* stream_options ::= stream_options DELETE_MARK duration_literal */ +{ yylhsminor.yy140 = setStreamOptions(pCxt, yymsp[-2].minor.yy140, SOPT_DELETE_MARK_SET, NULL, releaseRawExprNode(pCxt, yymsp[0].minor.yy140)); } + yymsp[-2].minor.yy140 = yylhsminor.yy140; break; - case 320: /* stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */ -{ yylhsminor.yy42 = setStreamOptions(pCxt, yymsp[-3].minor.yy42, SOPT_IGNORE_UPDATE_SET, &yymsp[0].minor.yy0, NULL); } - yymsp[-3].minor.yy42 = yylhsminor.yy42; + case 328: /* stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */ +{ yylhsminor.yy140 = setStreamOptions(pCxt, yymsp[-3].minor.yy140, SOPT_IGNORE_UPDATE_SET, &yymsp[0].minor.yy0, NULL); } + yymsp[-3].minor.yy140 = yylhsminor.yy140; break; - case 322: /* subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ - case 511: /* sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ yytestcase(yyruleno==511); - case 531: /* every_opt ::= EVERY NK_LP duration_literal NK_RP */ yytestcase(yyruleno==531); -{ yymsp[-3].minor.yy42 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy42); } + case 330: /* subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ + case 519: /* sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ yytestcase(yyruleno==519); + case 539: /* every_opt ::= EVERY NK_LP duration_literal NK_RP */ yytestcase(yyruleno==539); +{ yymsp[-3].minor.yy140 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy140); } break; - case 323: /* cmd ::= KILL CONNECTION NK_INTEGER */ + case 331: /* cmd ::= KILL CONNECTION NK_INTEGER */ { pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_CONNECTION_STMT, &yymsp[0].minor.yy0); } break; - case 324: /* cmd ::= KILL QUERY NK_STRING */ + case 332: /* cmd ::= KILL QUERY NK_STRING */ { pCxt->pRootNode = createKillQueryStmt(pCxt, &yymsp[0].minor.yy0); } break; - case 325: /* cmd ::= KILL TRANSACTION NK_INTEGER */ + case 333: /* cmd ::= KILL TRANSACTION NK_INTEGER */ { pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_TRANSACTION_STMT, &yymsp[0].minor.yy0); } break; - case 326: /* cmd ::= BALANCE VGROUP */ + case 334: /* cmd ::= BALANCE VGROUP */ { pCxt->pRootNode = createBalanceVgroupStmt(pCxt); } break; - case 327: /* cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ + case 335: /* cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ { pCxt->pRootNode = createMergeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } break; - case 328: /* cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ -{ pCxt->pRootNode = createRedistributeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy110); } + case 336: /* cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ +{ pCxt->pRootNode = createRedistributeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy220); } break; - case 329: /* cmd ::= SPLIT VGROUP NK_INTEGER */ + case 337: /* cmd ::= SPLIT VGROUP NK_INTEGER */ { pCxt->pRootNode = createSplitVgroupStmt(pCxt, &yymsp[0].minor.yy0); } break; - case 330: /* dnode_list ::= DNODE NK_INTEGER */ -{ yymsp[-1].minor.yy110 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } + case 338: /* dnode_list ::= DNODE NK_INTEGER */ +{ yymsp[-1].minor.yy220 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } break; - case 332: /* cmd ::= DELETE FROM full_table_name where_clause_opt */ -{ pCxt->pRootNode = createDeleteStmt(pCxt, yymsp[-1].minor.yy42, yymsp[0].minor.yy42); } + case 340: /* cmd ::= DELETE FROM full_table_name where_clause_opt */ +{ pCxt->pRootNode = createDeleteStmt(pCxt, yymsp[-1].minor.yy140, yymsp[0].minor.yy140); } break; - case 335: /* insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ -{ yymsp[-6].minor.yy42 = createInsertStmt(pCxt, yymsp[-4].minor.yy42, yymsp[-2].minor.yy110, yymsp[0].minor.yy42); } + case 343: /* insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ +{ yymsp[-6].minor.yy140 = createInsertStmt(pCxt, yymsp[-4].minor.yy140, yymsp[-2].minor.yy220, yymsp[0].minor.yy140); } break; - case 336: /* insert_query ::= INSERT INTO full_table_name query_or_subquery */ -{ yymsp[-3].minor.yy42 = createInsertStmt(pCxt, yymsp[-1].minor.yy42, NULL, yymsp[0].minor.yy42); } + case 344: /* insert_query ::= INSERT INTO full_table_name query_or_subquery */ +{ yymsp[-3].minor.yy140 = createInsertStmt(pCxt, yymsp[-1].minor.yy140, NULL, yymsp[0].minor.yy140); } break; - case 337: /* literal ::= NK_INTEGER */ -{ yylhsminor.yy42 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy42 = yylhsminor.yy42; + case 345: /* literal ::= NK_INTEGER */ +{ yylhsminor.yy140 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy140 = yylhsminor.yy140; break; - case 338: /* literal ::= NK_FLOAT */ -{ yylhsminor.yy42 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy42 = yylhsminor.yy42; + case 346: /* literal ::= NK_FLOAT */ +{ yylhsminor.yy140 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy140 = yylhsminor.yy140; break; - case 339: /* literal ::= NK_STRING */ -{ yylhsminor.yy42 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy42 = yylhsminor.yy42; + case 347: /* literal ::= NK_STRING */ +{ yylhsminor.yy140 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy140 = yylhsminor.yy140; break; - case 340: /* literal ::= NK_BOOL */ -{ yylhsminor.yy42 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy42 = yylhsminor.yy42; + case 348: /* literal ::= NK_BOOL */ +{ yylhsminor.yy140 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy140 = yylhsminor.yy140; break; - case 341: /* literal ::= TIMESTAMP NK_STRING */ -{ yylhsminor.yy42 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); } - yymsp[-1].minor.yy42 = yylhsminor.yy42; + case 349: /* literal ::= TIMESTAMP NK_STRING */ +{ yylhsminor.yy140 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); } + yymsp[-1].minor.yy140 = yylhsminor.yy140; break; - case 342: /* literal ::= duration_literal */ - case 352: /* signed_literal ::= signed */ yytestcase(yyruleno==352); - case 373: /* expr_or_subquery ::= expression */ yytestcase(yyruleno==373); - case 374: /* expression ::= literal */ yytestcase(yyruleno==374); - case 375: /* expression ::= pseudo_column */ yytestcase(yyruleno==375); - case 376: /* expression ::= column_reference */ yytestcase(yyruleno==376); - case 377: /* expression ::= function_expression */ yytestcase(yyruleno==377); - case 378: /* expression ::= case_when_expression */ yytestcase(yyruleno==378); - case 409: /* function_expression ::= literal_func */ yytestcase(yyruleno==409); - case 458: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==458); - case 462: /* boolean_primary ::= predicate */ yytestcase(yyruleno==462); - case 464: /* common_expression ::= expr_or_subquery */ yytestcase(yyruleno==464); - case 465: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==465); - case 468: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==468); - case 470: /* table_reference ::= table_primary */ yytestcase(yyruleno==470); - case 471: /* table_reference ::= joined_table */ yytestcase(yyruleno==471); - case 475: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==475); - case 533: /* query_simple ::= query_specification */ yytestcase(yyruleno==533); - case 534: /* query_simple ::= union_query_expression */ yytestcase(yyruleno==534); - case 537: /* query_simple_or_subquery ::= query_simple */ yytestcase(yyruleno==537); - case 539: /* query_or_subquery ::= query_expression */ yytestcase(yyruleno==539); -{ yylhsminor.yy42 = yymsp[0].minor.yy42; } - yymsp[0].minor.yy42 = yylhsminor.yy42; + case 350: /* literal ::= duration_literal */ + case 360: /* signed_literal ::= signed */ yytestcase(yyruleno==360); + case 381: /* expr_or_subquery ::= expression */ yytestcase(yyruleno==381); + case 382: /* expression ::= literal */ yytestcase(yyruleno==382); + case 383: /* expression ::= pseudo_column */ yytestcase(yyruleno==383); + case 384: /* expression ::= column_reference */ yytestcase(yyruleno==384); + case 385: /* expression ::= function_expression */ yytestcase(yyruleno==385); + case 386: /* expression ::= case_when_expression */ yytestcase(yyruleno==386); + case 417: /* function_expression ::= literal_func */ yytestcase(yyruleno==417); + case 466: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==466); + case 470: /* boolean_primary ::= predicate */ yytestcase(yyruleno==470); + case 472: /* common_expression ::= expr_or_subquery */ yytestcase(yyruleno==472); + case 473: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==473); + case 476: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==476); + case 478: /* table_reference ::= table_primary */ yytestcase(yyruleno==478); + case 479: /* table_reference ::= joined_table */ yytestcase(yyruleno==479); + case 483: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==483); + case 541: /* query_simple ::= query_specification */ yytestcase(yyruleno==541); + case 542: /* query_simple ::= union_query_expression */ yytestcase(yyruleno==542); + case 545: /* query_simple_or_subquery ::= query_simple */ yytestcase(yyruleno==545); + case 547: /* query_or_subquery ::= query_expression */ yytestcase(yyruleno==547); +{ yylhsminor.yy140 = yymsp[0].minor.yy140; } + yymsp[0].minor.yy140 = yylhsminor.yy140; break; - case 343: /* literal ::= NULL */ -{ yylhsminor.yy42 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy42 = yylhsminor.yy42; + case 351: /* literal ::= NULL */ +{ yylhsminor.yy140 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy140 = yylhsminor.yy140; break; - case 344: /* literal ::= NK_QUESTION */ -{ yylhsminor.yy42 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy42 = yylhsminor.yy42; + case 352: /* literal ::= NK_QUESTION */ +{ yylhsminor.yy140 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy140 = yylhsminor.yy140; break; - case 345: /* duration_literal ::= NK_VARIABLE */ -{ yylhsminor.yy42 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy42 = yylhsminor.yy42; + case 353: /* duration_literal ::= NK_VARIABLE */ +{ yylhsminor.yy140 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy140 = yylhsminor.yy140; break; - case 346: /* signed ::= NK_INTEGER */ -{ yylhsminor.yy42 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy42 = yylhsminor.yy42; + case 354: /* signed ::= NK_INTEGER */ +{ yylhsminor.yy140 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy140 = yylhsminor.yy140; break; - case 347: /* signed ::= NK_PLUS NK_INTEGER */ -{ yymsp[-1].minor.yy42 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); } + case 355: /* signed ::= NK_PLUS NK_INTEGER */ +{ yymsp[-1].minor.yy140 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); } break; - case 348: /* signed ::= NK_MINUS NK_INTEGER */ + case 356: /* 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.yy42 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &t); + yylhsminor.yy140 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &t); } - yymsp[-1].minor.yy42 = yylhsminor.yy42; + yymsp[-1].minor.yy140 = yylhsminor.yy140; break; - case 349: /* signed ::= NK_FLOAT */ -{ yylhsminor.yy42 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy42 = yylhsminor.yy42; + case 357: /* signed ::= NK_FLOAT */ +{ yylhsminor.yy140 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy140 = yylhsminor.yy140; break; - case 350: /* signed ::= NK_PLUS NK_FLOAT */ -{ yymsp[-1].minor.yy42 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } + case 358: /* signed ::= NK_PLUS NK_FLOAT */ +{ yymsp[-1].minor.yy140 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } break; - case 351: /* signed ::= NK_MINUS NK_FLOAT */ + case 359: /* 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.yy42 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t); + yylhsminor.yy140 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t); } - yymsp[-1].minor.yy42 = yylhsminor.yy42; + yymsp[-1].minor.yy140 = yylhsminor.yy140; break; - case 353: /* signed_literal ::= NK_STRING */ -{ yylhsminor.yy42 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy42 = yylhsminor.yy42; + case 361: /* signed_literal ::= NK_STRING */ +{ yylhsminor.yy140 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy140 = yylhsminor.yy140; break; - case 354: /* signed_literal ::= NK_BOOL */ -{ yylhsminor.yy42 = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy42 = yylhsminor.yy42; + case 362: /* signed_literal ::= NK_BOOL */ +{ yylhsminor.yy140 = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy140 = yylhsminor.yy140; break; - case 355: /* signed_literal ::= TIMESTAMP NK_STRING */ -{ yymsp[-1].minor.yy42 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } + case 363: /* signed_literal ::= TIMESTAMP NK_STRING */ +{ yymsp[-1].minor.yy140 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } break; - case 356: /* signed_literal ::= duration_literal */ - case 358: /* signed_literal ::= literal_func */ yytestcase(yyruleno==358); - case 429: /* star_func_para ::= expr_or_subquery */ yytestcase(yyruleno==429); - case 491: /* select_item ::= common_expression */ yytestcase(yyruleno==491); - case 501: /* partition_item ::= expr_or_subquery */ yytestcase(yyruleno==501); - case 538: /* query_simple_or_subquery ::= subquery */ yytestcase(yyruleno==538); - case 540: /* query_or_subquery ::= subquery */ yytestcase(yyruleno==540); - case 553: /* search_condition ::= common_expression */ yytestcase(yyruleno==553); -{ yylhsminor.yy42 = releaseRawExprNode(pCxt, yymsp[0].minor.yy42); } - yymsp[0].minor.yy42 = yylhsminor.yy42; + case 364: /* signed_literal ::= duration_literal */ + case 366: /* signed_literal ::= literal_func */ yytestcase(yyruleno==366); + case 437: /* star_func_para ::= expr_or_subquery */ yytestcase(yyruleno==437); + case 499: /* select_item ::= common_expression */ yytestcase(yyruleno==499); + case 509: /* partition_item ::= expr_or_subquery */ yytestcase(yyruleno==509); + case 546: /* query_simple_or_subquery ::= subquery */ yytestcase(yyruleno==546); + case 548: /* query_or_subquery ::= subquery */ yytestcase(yyruleno==548); + case 561: /* search_condition ::= common_expression */ yytestcase(yyruleno==561); +{ yylhsminor.yy140 = releaseRawExprNode(pCxt, yymsp[0].minor.yy140); } + yymsp[0].minor.yy140 = yylhsminor.yy140; break; - case 357: /* signed_literal ::= NULL */ -{ yylhsminor.yy42 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy42 = yylhsminor.yy42; + case 365: /* signed_literal ::= NULL */ +{ yylhsminor.yy140 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy140 = yylhsminor.yy140; break; - case 359: /* signed_literal ::= NK_QUESTION */ -{ yylhsminor.yy42 = createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy42 = yylhsminor.yy42; + case 367: /* signed_literal ::= NK_QUESTION */ +{ yylhsminor.yy140 = createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy140 = yylhsminor.yy140; break; - case 379: /* expression ::= NK_LP expression NK_RP */ - case 463: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==463); - case 552: /* subquery ::= NK_LP subquery NK_RP */ yytestcase(yyruleno==552); -{ yylhsminor.yy42 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy42)); } - yymsp[-2].minor.yy42 = yylhsminor.yy42; + case 387: /* expression ::= NK_LP expression NK_RP */ + case 471: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==471); + case 560: /* subquery ::= NK_LP subquery NK_RP */ yytestcase(yyruleno==560); +{ yylhsminor.yy140 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy140)); } + yymsp[-2].minor.yy140 = yylhsminor.yy140; break; - case 380: /* expression ::= NK_PLUS expr_or_subquery */ + case 388: /* expression ::= NK_PLUS expr_or_subquery */ { - SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy42); - yylhsminor.yy42 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy42)); + SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy140); + yylhsminor.yy140 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy140)); } - yymsp[-1].minor.yy42 = yylhsminor.yy42; + yymsp[-1].minor.yy140 = yylhsminor.yy140; break; - case 381: /* expression ::= NK_MINUS expr_or_subquery */ + case 389: /* expression ::= NK_MINUS expr_or_subquery */ { - SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy42); - yylhsminor.yy42 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_MINUS, releaseRawExprNode(pCxt, yymsp[0].minor.yy42), NULL)); + SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy140); + yylhsminor.yy140 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_MINUS, releaseRawExprNode(pCxt, yymsp[0].minor.yy140), NULL)); } - yymsp[-1].minor.yy42 = yylhsminor.yy42; + yymsp[-1].minor.yy140 = yylhsminor.yy140; break; - case 382: /* expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ + case 390: /* expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy42); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy42); - yylhsminor.yy42 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_ADD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy42), releaseRawExprNode(pCxt, yymsp[0].minor.yy42))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy140); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy140); + yylhsminor.yy140 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_ADD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy140), releaseRawExprNode(pCxt, yymsp[0].minor.yy140))); } - yymsp[-2].minor.yy42 = yylhsminor.yy42; + yymsp[-2].minor.yy140 = yylhsminor.yy140; break; - case 383: /* expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ + case 391: /* expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy42); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy42); - yylhsminor.yy42 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[-2].minor.yy42), releaseRawExprNode(pCxt, yymsp[0].minor.yy42))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy140); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy140); + yylhsminor.yy140 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[-2].minor.yy140), releaseRawExprNode(pCxt, yymsp[0].minor.yy140))); } - yymsp[-2].minor.yy42 = yylhsminor.yy42; + yymsp[-2].minor.yy140 = yylhsminor.yy140; break; - case 384: /* expression ::= expr_or_subquery NK_STAR expr_or_subquery */ + case 392: /* expression ::= expr_or_subquery NK_STAR expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy42); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy42); - yylhsminor.yy42 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MULTI, releaseRawExprNode(pCxt, yymsp[-2].minor.yy42), releaseRawExprNode(pCxt, yymsp[0].minor.yy42))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy140); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy140); + yylhsminor.yy140 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MULTI, releaseRawExprNode(pCxt, yymsp[-2].minor.yy140), releaseRawExprNode(pCxt, yymsp[0].minor.yy140))); } - yymsp[-2].minor.yy42 = yylhsminor.yy42; + yymsp[-2].minor.yy140 = yylhsminor.yy140; break; - case 385: /* expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ + case 393: /* expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy42); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy42); - yylhsminor.yy42 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_DIV, releaseRawExprNode(pCxt, yymsp[-2].minor.yy42), releaseRawExprNode(pCxt, yymsp[0].minor.yy42))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy140); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy140); + yylhsminor.yy140 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_DIV, releaseRawExprNode(pCxt, yymsp[-2].minor.yy140), releaseRawExprNode(pCxt, yymsp[0].minor.yy140))); } - yymsp[-2].minor.yy42 = yylhsminor.yy42; + yymsp[-2].minor.yy140 = yylhsminor.yy140; break; - case 386: /* expression ::= expr_or_subquery NK_REM expr_or_subquery */ + case 394: /* expression ::= expr_or_subquery NK_REM expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy42); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy42); - yylhsminor.yy42 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_REM, releaseRawExprNode(pCxt, yymsp[-2].minor.yy42), releaseRawExprNode(pCxt, yymsp[0].minor.yy42))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy140); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy140); + yylhsminor.yy140 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_REM, releaseRawExprNode(pCxt, yymsp[-2].minor.yy140), releaseRawExprNode(pCxt, yymsp[0].minor.yy140))); } - yymsp[-2].minor.yy42 = yylhsminor.yy42; + yymsp[-2].minor.yy140 = yylhsminor.yy140; break; - case 387: /* expression ::= column_reference NK_ARROW NK_STRING */ + case 395: /* expression ::= column_reference NK_ARROW NK_STRING */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy42); - yylhsminor.yy42 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_JSON_GET_VALUE, releaseRawExprNode(pCxt, yymsp[-2].minor.yy42), createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy140); + yylhsminor.yy140 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_JSON_GET_VALUE, releaseRawExprNode(pCxt, yymsp[-2].minor.yy140), createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0))); } - yymsp[-2].minor.yy42 = yylhsminor.yy42; + yymsp[-2].minor.yy140 = yylhsminor.yy140; break; - case 388: /* expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ + case 396: /* expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy42); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy42); - yylhsminor.yy42 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy42), releaseRawExprNode(pCxt, yymsp[0].minor.yy42))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy140); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy140); + yylhsminor.yy140 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy140), releaseRawExprNode(pCxt, yymsp[0].minor.yy140))); } - yymsp[-2].minor.yy42 = yylhsminor.yy42; + yymsp[-2].minor.yy140 = yylhsminor.yy140; break; - case 389: /* expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ + case 397: /* expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy42); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy42); - yylhsminor.yy42 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy42), releaseRawExprNode(pCxt, yymsp[0].minor.yy42))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy140); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy140); + yylhsminor.yy140 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy140), releaseRawExprNode(pCxt, yymsp[0].minor.yy140))); } - yymsp[-2].minor.yy42 = yylhsminor.yy42; + yymsp[-2].minor.yy140 = yylhsminor.yy140; break; - case 392: /* column_reference ::= column_name */ -{ yylhsminor.yy42 = createRawExprNode(pCxt, &yymsp[0].minor.yy225, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy225)); } - yymsp[0].minor.yy42 = yylhsminor.yy42; + case 400: /* column_reference ::= column_name */ +{ yylhsminor.yy140 = createRawExprNode(pCxt, &yymsp[0].minor.yy881, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy881)); } + yymsp[0].minor.yy140 = yylhsminor.yy140; break; - case 393: /* column_reference ::= table_name NK_DOT column_name */ -{ yylhsminor.yy42 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy225, &yymsp[0].minor.yy225, createColumnNode(pCxt, &yymsp[-2].minor.yy225, &yymsp[0].minor.yy225)); } - yymsp[-2].minor.yy42 = yylhsminor.yy42; + case 401: /* column_reference ::= table_name NK_DOT column_name */ +{ yylhsminor.yy140 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy881, &yymsp[0].minor.yy881, createColumnNode(pCxt, &yymsp[-2].minor.yy881, &yymsp[0].minor.yy881)); } + yymsp[-2].minor.yy140 = yylhsminor.yy140; break; - case 394: /* pseudo_column ::= ROWTS */ - case 395: /* pseudo_column ::= TBNAME */ yytestcase(yyruleno==395); - case 397: /* pseudo_column ::= QSTART */ yytestcase(yyruleno==397); - case 398: /* pseudo_column ::= QEND */ yytestcase(yyruleno==398); - case 399: /* pseudo_column ::= QDURATION */ yytestcase(yyruleno==399); - case 400: /* pseudo_column ::= WSTART */ yytestcase(yyruleno==400); - case 401: /* pseudo_column ::= WEND */ yytestcase(yyruleno==401); - case 402: /* pseudo_column ::= WDURATION */ yytestcase(yyruleno==402); - case 403: /* pseudo_column ::= IROWTS */ yytestcase(yyruleno==403); - case 404: /* pseudo_column ::= ISFILLED */ yytestcase(yyruleno==404); - case 405: /* pseudo_column ::= QTAGS */ yytestcase(yyruleno==405); - case 411: /* literal_func ::= NOW */ yytestcase(yyruleno==411); -{ yylhsminor.yy42 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); } - yymsp[0].minor.yy42 = yylhsminor.yy42; + case 402: /* pseudo_column ::= ROWTS */ + case 403: /* pseudo_column ::= TBNAME */ yytestcase(yyruleno==403); + case 405: /* pseudo_column ::= QSTART */ yytestcase(yyruleno==405); + case 406: /* pseudo_column ::= QEND */ yytestcase(yyruleno==406); + case 407: /* pseudo_column ::= QDURATION */ yytestcase(yyruleno==407); + case 408: /* pseudo_column ::= WSTART */ yytestcase(yyruleno==408); + case 409: /* pseudo_column ::= WEND */ yytestcase(yyruleno==409); + case 410: /* pseudo_column ::= WDURATION */ yytestcase(yyruleno==410); + case 411: /* pseudo_column ::= IROWTS */ yytestcase(yyruleno==411); + case 412: /* pseudo_column ::= ISFILLED */ yytestcase(yyruleno==412); + case 413: /* pseudo_column ::= QTAGS */ yytestcase(yyruleno==413); + case 419: /* literal_func ::= NOW */ yytestcase(yyruleno==419); +{ yylhsminor.yy140 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); } + yymsp[0].minor.yy140 = yylhsminor.yy140; break; - case 396: /* pseudo_column ::= table_name NK_DOT TBNAME */ -{ yylhsminor.yy42 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy225, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-2].minor.yy225)))); } - yymsp[-2].minor.yy42 = yylhsminor.yy42; + case 404: /* pseudo_column ::= table_name NK_DOT TBNAME */ +{ yylhsminor.yy140 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy881, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-2].minor.yy881)))); } + yymsp[-2].minor.yy140 = yylhsminor.yy140; break; - case 406: /* function_expression ::= function_name NK_LP expression_list NK_RP */ - case 407: /* function_expression ::= star_func NK_LP star_func_para_list NK_RP */ yytestcase(yyruleno==407); -{ yylhsminor.yy42 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy225, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy225, yymsp[-1].minor.yy110)); } - yymsp[-3].minor.yy42 = yylhsminor.yy42; + case 414: /* function_expression ::= function_name NK_LP expression_list NK_RP */ + case 415: /* function_expression ::= star_func NK_LP star_func_para_list NK_RP */ yytestcase(yyruleno==415); +{ yylhsminor.yy140 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy881, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy881, yymsp[-1].minor.yy220)); } + yymsp[-3].minor.yy140 = yylhsminor.yy140; break; - case 408: /* function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ -{ yylhsminor.yy42 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createCastFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy42), yymsp[-1].minor.yy448)); } - yymsp[-5].minor.yy42 = yylhsminor.yy42; + case 416: /* function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ +{ yylhsminor.yy140 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createCastFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy140), yymsp[-1].minor.yy682)); } + yymsp[-5].minor.yy140 = yylhsminor.yy140; break; - case 410: /* literal_func ::= noarg_func NK_LP NK_RP */ -{ yylhsminor.yy42 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy225, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-2].minor.yy225, NULL)); } - yymsp[-2].minor.yy42 = yylhsminor.yy42; + case 418: /* literal_func ::= noarg_func NK_LP NK_RP */ +{ yylhsminor.yy140 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy881, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-2].minor.yy881, NULL)); } + yymsp[-2].minor.yy140 = yylhsminor.yy140; break; - case 425: /* star_func_para_list ::= NK_STAR */ -{ yylhsminor.yy110 = createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy110 = yylhsminor.yy110; + case 433: /* star_func_para_list ::= NK_STAR */ +{ yylhsminor.yy220 = createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy220 = yylhsminor.yy220; break; - case 430: /* star_func_para ::= table_name NK_DOT NK_STAR */ - case 494: /* select_item ::= table_name NK_DOT NK_STAR */ yytestcase(yyruleno==494); -{ yylhsminor.yy42 = createColumnNode(pCxt, &yymsp[-2].minor.yy225, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy42 = yylhsminor.yy42; + case 438: /* star_func_para ::= table_name NK_DOT NK_STAR */ + case 502: /* select_item ::= table_name NK_DOT NK_STAR */ yytestcase(yyruleno==502); +{ yylhsminor.yy140 = createColumnNode(pCxt, &yymsp[-2].minor.yy881, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy140 = yylhsminor.yy140; break; - case 431: /* case_when_expression ::= CASE when_then_list case_when_else_opt END */ -{ yylhsminor.yy42 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, NULL, yymsp[-2].minor.yy110, yymsp[-1].minor.yy42)); } - yymsp[-3].minor.yy42 = yylhsminor.yy42; + case 439: /* case_when_expression ::= CASE when_then_list case_when_else_opt END */ +{ yylhsminor.yy140 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, NULL, yymsp[-2].minor.yy220, yymsp[-1].minor.yy140)); } + yymsp[-3].minor.yy140 = yylhsminor.yy140; break; - case 432: /* case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ -{ yylhsminor.yy42 = createRawExprNodeExt(pCxt, &yymsp[-4].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy42), yymsp[-2].minor.yy110, yymsp[-1].minor.yy42)); } - yymsp[-4].minor.yy42 = yylhsminor.yy42; + case 440: /* case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ +{ yylhsminor.yy140 = createRawExprNodeExt(pCxt, &yymsp[-4].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy140), yymsp[-2].minor.yy220, yymsp[-1].minor.yy140)); } + yymsp[-4].minor.yy140 = yylhsminor.yy140; break; - case 435: /* when_then_expr ::= WHEN common_expression THEN common_expression */ -{ yymsp[-3].minor.yy42 = createWhenThenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy42), releaseRawExprNode(pCxt, yymsp[0].minor.yy42)); } + case 443: /* when_then_expr ::= WHEN common_expression THEN common_expression */ +{ yymsp[-3].minor.yy140 = createWhenThenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy140), releaseRawExprNode(pCxt, yymsp[0].minor.yy140)); } break; - case 437: /* case_when_else_opt ::= ELSE common_expression */ -{ yymsp[-1].minor.yy42 = releaseRawExprNode(pCxt, yymsp[0].minor.yy42); } + case 445: /* case_when_else_opt ::= ELSE common_expression */ +{ yymsp[-1].minor.yy140 = releaseRawExprNode(pCxt, yymsp[0].minor.yy140); } break; - case 438: /* predicate ::= expr_or_subquery compare_op expr_or_subquery */ - case 443: /* predicate ::= expr_or_subquery in_op in_predicate_value */ yytestcase(yyruleno==443); + case 446: /* predicate ::= expr_or_subquery compare_op expr_or_subquery */ + case 451: /* predicate ::= expr_or_subquery in_op in_predicate_value */ yytestcase(yyruleno==451); { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy42); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy42); - yylhsminor.yy42 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, yymsp[-1].minor.yy2, releaseRawExprNode(pCxt, yymsp[-2].minor.yy42), releaseRawExprNode(pCxt, yymsp[0].minor.yy42))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy140); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy140); + yylhsminor.yy140 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, yymsp[-1].minor.yy794, releaseRawExprNode(pCxt, yymsp[-2].minor.yy140), releaseRawExprNode(pCxt, yymsp[0].minor.yy140))); } - yymsp[-2].minor.yy42 = yylhsminor.yy42; + yymsp[-2].minor.yy140 = yylhsminor.yy140; break; - case 439: /* predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ + case 447: /* predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy42); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy42); - yylhsminor.yy42 = createRawExprNodeExt(pCxt, &s, &e, createBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-4].minor.yy42), releaseRawExprNode(pCxt, yymsp[-2].minor.yy42), releaseRawExprNode(pCxt, yymsp[0].minor.yy42))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy140); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy140); + yylhsminor.yy140 = createRawExprNodeExt(pCxt, &s, &e, createBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-4].minor.yy140), releaseRawExprNode(pCxt, yymsp[-2].minor.yy140), releaseRawExprNode(pCxt, yymsp[0].minor.yy140))); } - yymsp[-4].minor.yy42 = yylhsminor.yy42; + yymsp[-4].minor.yy140 = yylhsminor.yy140; break; - case 440: /* predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ + case 448: /* predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy42); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy42); - yylhsminor.yy42 = createRawExprNodeExt(pCxt, &s, &e, createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy42), releaseRawExprNode(pCxt, yymsp[-2].minor.yy42), releaseRawExprNode(pCxt, yymsp[0].minor.yy42))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy140); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy140); + yylhsminor.yy140 = createRawExprNodeExt(pCxt, &s, &e, createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy140), releaseRawExprNode(pCxt, yymsp[-2].minor.yy140), releaseRawExprNode(pCxt, yymsp[0].minor.yy140))); } - yymsp[-5].minor.yy42 = yylhsminor.yy42; + yymsp[-5].minor.yy140 = yylhsminor.yy140; break; - case 441: /* predicate ::= expr_or_subquery IS NULL */ + case 449: /* predicate ::= expr_or_subquery IS NULL */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy42); - yylhsminor.yy42 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy42), NULL)); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy140); + yylhsminor.yy140 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy140), NULL)); } - yymsp[-2].minor.yy42 = yylhsminor.yy42; + yymsp[-2].minor.yy140 = yylhsminor.yy140; break; - case 442: /* predicate ::= expr_or_subquery IS NOT NULL */ + case 450: /* predicate ::= expr_or_subquery IS NOT NULL */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy42); - yylhsminor.yy42 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy42), NULL)); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy140); + yylhsminor.yy140 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy140), NULL)); } - yymsp[-3].minor.yy42 = yylhsminor.yy42; + yymsp[-3].minor.yy140 = yylhsminor.yy140; break; - case 444: /* compare_op ::= NK_LT */ -{ yymsp[0].minor.yy2 = OP_TYPE_LOWER_THAN; } + case 452: /* compare_op ::= NK_LT */ +{ yymsp[0].minor.yy794 = OP_TYPE_LOWER_THAN; } break; - case 445: /* compare_op ::= NK_GT */ -{ yymsp[0].minor.yy2 = OP_TYPE_GREATER_THAN; } + case 453: /* compare_op ::= NK_GT */ +{ yymsp[0].minor.yy794 = OP_TYPE_GREATER_THAN; } break; - case 446: /* compare_op ::= NK_LE */ -{ yymsp[0].minor.yy2 = OP_TYPE_LOWER_EQUAL; } + case 454: /* compare_op ::= NK_LE */ +{ yymsp[0].minor.yy794 = OP_TYPE_LOWER_EQUAL; } break; - case 447: /* compare_op ::= NK_GE */ -{ yymsp[0].minor.yy2 = OP_TYPE_GREATER_EQUAL; } + case 455: /* compare_op ::= NK_GE */ +{ yymsp[0].minor.yy794 = OP_TYPE_GREATER_EQUAL; } break; - case 448: /* compare_op ::= NK_NE */ -{ yymsp[0].minor.yy2 = OP_TYPE_NOT_EQUAL; } + case 456: /* compare_op ::= NK_NE */ +{ yymsp[0].minor.yy794 = OP_TYPE_NOT_EQUAL; } break; - case 449: /* compare_op ::= NK_EQ */ -{ yymsp[0].minor.yy2 = OP_TYPE_EQUAL; } + case 457: /* compare_op ::= NK_EQ */ +{ yymsp[0].minor.yy794 = OP_TYPE_EQUAL; } break; - case 450: /* compare_op ::= LIKE */ -{ yymsp[0].minor.yy2 = OP_TYPE_LIKE; } + case 458: /* compare_op ::= LIKE */ +{ yymsp[0].minor.yy794 = OP_TYPE_LIKE; } break; - case 451: /* compare_op ::= NOT LIKE */ -{ yymsp[-1].minor.yy2 = OP_TYPE_NOT_LIKE; } + case 459: /* compare_op ::= NOT LIKE */ +{ yymsp[-1].minor.yy794 = OP_TYPE_NOT_LIKE; } break; - case 452: /* compare_op ::= MATCH */ -{ yymsp[0].minor.yy2 = OP_TYPE_MATCH; } + case 460: /* compare_op ::= MATCH */ +{ yymsp[0].minor.yy794 = OP_TYPE_MATCH; } break; - case 453: /* compare_op ::= NMATCH */ -{ yymsp[0].minor.yy2 = OP_TYPE_NMATCH; } + case 461: /* compare_op ::= NMATCH */ +{ yymsp[0].minor.yy794 = OP_TYPE_NMATCH; } break; - case 454: /* compare_op ::= CONTAINS */ -{ yymsp[0].minor.yy2 = OP_TYPE_JSON_CONTAINS; } + case 462: /* compare_op ::= CONTAINS */ +{ yymsp[0].minor.yy794 = OP_TYPE_JSON_CONTAINS; } break; - case 455: /* in_op ::= IN */ -{ yymsp[0].minor.yy2 = OP_TYPE_IN; } + case 463: /* in_op ::= IN */ +{ yymsp[0].minor.yy794 = OP_TYPE_IN; } break; - case 456: /* in_op ::= NOT IN */ -{ yymsp[-1].minor.yy2 = OP_TYPE_NOT_IN; } + case 464: /* in_op ::= NOT IN */ +{ yymsp[-1].minor.yy794 = OP_TYPE_NOT_IN; } break; - case 457: /* in_predicate_value ::= NK_LP literal_list NK_RP */ -{ yylhsminor.yy42 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy110)); } - yymsp[-2].minor.yy42 = yylhsminor.yy42; + case 465: /* in_predicate_value ::= NK_LP literal_list NK_RP */ +{ yylhsminor.yy140 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy220)); } + yymsp[-2].minor.yy140 = yylhsminor.yy140; break; - case 459: /* boolean_value_expression ::= NOT boolean_primary */ + case 467: /* boolean_value_expression ::= NOT boolean_primary */ { - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy42); - yylhsminor.yy42 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy42), NULL)); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy140); + yylhsminor.yy140 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy140), NULL)); } - yymsp[-1].minor.yy42 = yylhsminor.yy42; + yymsp[-1].minor.yy140 = yylhsminor.yy140; break; - case 460: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ + case 468: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy42); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy42); - yylhsminor.yy42 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy42), releaseRawExprNode(pCxt, yymsp[0].minor.yy42))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy140); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy140); + yylhsminor.yy140 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy140), releaseRawExprNode(pCxt, yymsp[0].minor.yy140))); } - yymsp[-2].minor.yy42 = yylhsminor.yy42; + yymsp[-2].minor.yy140 = yylhsminor.yy140; break; - case 461: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ + case 469: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy42); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy42); - yylhsminor.yy42 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy42), releaseRawExprNode(pCxt, yymsp[0].minor.yy42))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy140); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy140); + yylhsminor.yy140 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy140), releaseRawExprNode(pCxt, yymsp[0].minor.yy140))); } - yymsp[-2].minor.yy42 = yylhsminor.yy42; + yymsp[-2].minor.yy140 = yylhsminor.yy140; break; - case 467: /* from_clause_opt ::= FROM table_reference_list */ - case 496: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==496); - case 527: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==527); -{ yymsp[-1].minor.yy42 = yymsp[0].minor.yy42; } + case 475: /* from_clause_opt ::= FROM table_reference_list */ + case 504: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==504); + case 535: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==535); +{ yymsp[-1].minor.yy140 = yymsp[0].minor.yy140; } break; - case 469: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */ -{ yylhsminor.yy42 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, yymsp[-2].minor.yy42, yymsp[0].minor.yy42, NULL); } - yymsp[-2].minor.yy42 = yylhsminor.yy42; + case 477: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */ +{ yylhsminor.yy140 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, yymsp[-2].minor.yy140, yymsp[0].minor.yy140, NULL); } + yymsp[-2].minor.yy140 = yylhsminor.yy140; break; - case 472: /* table_primary ::= table_name alias_opt */ -{ yylhsminor.yy42 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy225, &yymsp[0].minor.yy225); } - yymsp[-1].minor.yy42 = yylhsminor.yy42; + case 480: /* table_primary ::= table_name alias_opt */ +{ yylhsminor.yy140 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy881, &yymsp[0].minor.yy881); } + yymsp[-1].minor.yy140 = yylhsminor.yy140; break; - case 473: /* table_primary ::= db_name NK_DOT table_name alias_opt */ -{ yylhsminor.yy42 = createRealTableNode(pCxt, &yymsp[-3].minor.yy225, &yymsp[-1].minor.yy225, &yymsp[0].minor.yy225); } - yymsp[-3].minor.yy42 = yylhsminor.yy42; + case 481: /* table_primary ::= db_name NK_DOT table_name alias_opt */ +{ yylhsminor.yy140 = createRealTableNode(pCxt, &yymsp[-3].minor.yy881, &yymsp[-1].minor.yy881, &yymsp[0].minor.yy881); } + yymsp[-3].minor.yy140 = yylhsminor.yy140; break; - case 474: /* table_primary ::= subquery alias_opt */ -{ yylhsminor.yy42 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy42), &yymsp[0].minor.yy225); } - yymsp[-1].minor.yy42 = yylhsminor.yy42; + case 482: /* table_primary ::= subquery alias_opt */ +{ yylhsminor.yy140 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy140), &yymsp[0].minor.yy881); } + yymsp[-1].minor.yy140 = yylhsminor.yy140; break; - case 476: /* alias_opt ::= */ -{ yymsp[1].minor.yy225 = nil_token; } + case 484: /* alias_opt ::= */ +{ yymsp[1].minor.yy881 = nil_token; } break; - case 478: /* alias_opt ::= AS table_alias */ -{ yymsp[-1].minor.yy225 = yymsp[0].minor.yy225; } + case 486: /* alias_opt ::= AS table_alias */ +{ yymsp[-1].minor.yy881 = yymsp[0].minor.yy881; } break; - case 479: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */ - case 480: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==480); -{ yymsp[-2].minor.yy42 = yymsp[-1].minor.yy42; } + case 487: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */ + case 488: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==488); +{ yymsp[-2].minor.yy140 = yymsp[-1].minor.yy140; } break; - case 481: /* joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ -{ yylhsminor.yy42 = createJoinTableNode(pCxt, yymsp[-4].minor.yy638, yymsp[-5].minor.yy42, yymsp[-2].minor.yy42, yymsp[0].minor.yy42); } - yymsp[-5].minor.yy42 = yylhsminor.yy42; + case 489: /* joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ +{ yylhsminor.yy140 = createJoinTableNode(pCxt, yymsp[-4].minor.yy852, yymsp[-5].minor.yy140, yymsp[-2].minor.yy140, yymsp[0].minor.yy140); } + yymsp[-5].minor.yy140 = yylhsminor.yy140; break; - case 482: /* join_type ::= */ -{ yymsp[1].minor.yy638 = JOIN_TYPE_INNER; } + case 490: /* join_type ::= */ +{ yymsp[1].minor.yy852 = JOIN_TYPE_INNER; } break; - case 483: /* join_type ::= INNER */ -{ yymsp[0].minor.yy638 = JOIN_TYPE_INNER; } + case 491: /* join_type ::= INNER */ +{ yymsp[0].minor.yy852 = JOIN_TYPE_INNER; } break; - case 484: /* 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 492: /* 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.yy42 = createSelectStmt(pCxt, yymsp[-10].minor.yy103, yymsp[-9].minor.yy110, yymsp[-8].minor.yy42); - yymsp[-11].minor.yy42 = addWhereClause(pCxt, yymsp[-11].minor.yy42, yymsp[-7].minor.yy42); - yymsp[-11].minor.yy42 = addPartitionByClause(pCxt, yymsp[-11].minor.yy42, yymsp[-6].minor.yy110); - yymsp[-11].minor.yy42 = addWindowClauseClause(pCxt, yymsp[-11].minor.yy42, yymsp[-2].minor.yy42); - yymsp[-11].minor.yy42 = addGroupByClause(pCxt, yymsp[-11].minor.yy42, yymsp[-1].minor.yy110); - yymsp[-11].minor.yy42 = addHavingClause(pCxt, yymsp[-11].minor.yy42, yymsp[0].minor.yy42); - yymsp[-11].minor.yy42 = addRangeClause(pCxt, yymsp[-11].minor.yy42, yymsp[-5].minor.yy42); - yymsp[-11].minor.yy42 = addEveryClause(pCxt, yymsp[-11].minor.yy42, yymsp[-4].minor.yy42); - yymsp[-11].minor.yy42 = addFillClause(pCxt, yymsp[-11].minor.yy42, yymsp[-3].minor.yy42); + yymsp[-11].minor.yy140 = createSelectStmt(pCxt, yymsp[-10].minor.yy587, yymsp[-9].minor.yy220, yymsp[-8].minor.yy140); + yymsp[-11].minor.yy140 = addWhereClause(pCxt, yymsp[-11].minor.yy140, yymsp[-7].minor.yy140); + yymsp[-11].minor.yy140 = addPartitionByClause(pCxt, yymsp[-11].minor.yy140, yymsp[-6].minor.yy220); + yymsp[-11].minor.yy140 = addWindowClauseClause(pCxt, yymsp[-11].minor.yy140, yymsp[-2].minor.yy140); + yymsp[-11].minor.yy140 = addGroupByClause(pCxt, yymsp[-11].minor.yy140, yymsp[-1].minor.yy220); + yymsp[-11].minor.yy140 = addHavingClause(pCxt, yymsp[-11].minor.yy140, yymsp[0].minor.yy140); + yymsp[-11].minor.yy140 = addRangeClause(pCxt, yymsp[-11].minor.yy140, yymsp[-5].minor.yy140); + yymsp[-11].minor.yy140 = addEveryClause(pCxt, yymsp[-11].minor.yy140, yymsp[-4].minor.yy140); + yymsp[-11].minor.yy140 = addFillClause(pCxt, yymsp[-11].minor.yy140, yymsp[-3].minor.yy140); } break; - case 487: /* set_quantifier_opt ::= ALL */ -{ yymsp[0].minor.yy103 = false; } + case 495: /* set_quantifier_opt ::= ALL */ +{ yymsp[0].minor.yy587 = false; } break; - case 490: /* select_item ::= NK_STAR */ -{ yylhsminor.yy42 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy42 = yylhsminor.yy42; + case 498: /* select_item ::= NK_STAR */ +{ yylhsminor.yy140 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy140 = yylhsminor.yy140; break; - case 492: /* select_item ::= common_expression column_alias */ - case 502: /* partition_item ::= expr_or_subquery column_alias */ yytestcase(yyruleno==502); -{ yylhsminor.yy42 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy42), &yymsp[0].minor.yy225); } - yymsp[-1].minor.yy42 = yylhsminor.yy42; + case 500: /* select_item ::= common_expression column_alias */ + case 510: /* partition_item ::= expr_or_subquery column_alias */ yytestcase(yyruleno==510); +{ yylhsminor.yy140 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy140), &yymsp[0].minor.yy881); } + yymsp[-1].minor.yy140 = yylhsminor.yy140; break; - case 493: /* select_item ::= common_expression AS column_alias */ - case 503: /* partition_item ::= expr_or_subquery AS column_alias */ yytestcase(yyruleno==503); -{ yylhsminor.yy42 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy42), &yymsp[0].minor.yy225); } - yymsp[-2].minor.yy42 = yylhsminor.yy42; + case 501: /* select_item ::= common_expression AS column_alias */ + case 511: /* partition_item ::= expr_or_subquery AS column_alias */ yytestcase(yyruleno==511); +{ yylhsminor.yy140 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy140), &yymsp[0].minor.yy881); } + yymsp[-2].minor.yy140 = yylhsminor.yy140; break; - case 498: /* partition_by_clause_opt ::= PARTITION BY partition_list */ - case 523: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==523); - case 542: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==542); -{ yymsp[-2].minor.yy110 = yymsp[0].minor.yy110; } + case 506: /* partition_by_clause_opt ::= PARTITION BY partition_list */ + case 531: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==531); + case 550: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==550); +{ yymsp[-2].minor.yy220 = yymsp[0].minor.yy220; } break; - case 505: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ -{ yymsp[-5].minor.yy42 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy42), releaseRawExprNode(pCxt, yymsp[-1].minor.yy42)); } + case 513: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ +{ yymsp[-5].minor.yy140 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy140), releaseRawExprNode(pCxt, yymsp[-1].minor.yy140)); } break; - case 506: /* twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ -{ yymsp[-3].minor.yy42 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy42)); } + case 514: /* twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ +{ yymsp[-3].minor.yy140 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy140)); } break; - case 507: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ -{ yymsp[-5].minor.yy42 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy42), NULL, yymsp[-1].minor.yy42, yymsp[0].minor.yy42); } + case 515: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ +{ yymsp[-5].minor.yy140 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy140), NULL, yymsp[-1].minor.yy140, yymsp[0].minor.yy140); } break; - case 508: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ -{ yymsp[-7].minor.yy42 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy42), releaseRawExprNode(pCxt, yymsp[-3].minor.yy42), yymsp[-1].minor.yy42, yymsp[0].minor.yy42); } + case 516: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ +{ yymsp[-7].minor.yy140 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy140), releaseRawExprNode(pCxt, yymsp[-3].minor.yy140), yymsp[-1].minor.yy140, yymsp[0].minor.yy140); } break; - case 509: /* twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ -{ yymsp[-6].minor.yy42 = createEventWindowNode(pCxt, yymsp[-3].minor.yy42, yymsp[0].minor.yy42); } + case 517: /* twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ +{ yymsp[-6].minor.yy140 = createEventWindowNode(pCxt, yymsp[-3].minor.yy140, yymsp[0].minor.yy140); } break; - case 513: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */ -{ yymsp[-3].minor.yy42 = createFillNode(pCxt, yymsp[-1].minor.yy410, NULL); } + case 521: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */ +{ yymsp[-3].minor.yy140 = createFillNode(pCxt, yymsp[-1].minor.yy174, NULL); } break; - case 514: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ -{ yymsp[-5].minor.yy42 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy110)); } + case 522: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ +{ yymsp[-5].minor.yy140 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy220)); } break; - case 515: /* fill_opt ::= FILL NK_LP VALUE_F NK_COMMA literal_list NK_RP */ -{ yymsp[-5].minor.yy42 = createFillNode(pCxt, FILL_MODE_VALUE_F, createNodeListNode(pCxt, yymsp[-1].minor.yy110)); } + case 523: /* fill_opt ::= FILL NK_LP VALUE_F NK_COMMA literal_list NK_RP */ +{ yymsp[-5].minor.yy140 = createFillNode(pCxt, FILL_MODE_VALUE_F, createNodeListNode(pCxt, yymsp[-1].minor.yy220)); } break; - case 516: /* fill_mode ::= NONE */ -{ yymsp[0].minor.yy410 = FILL_MODE_NONE; } + case 524: /* fill_mode ::= NONE */ +{ yymsp[0].minor.yy174 = FILL_MODE_NONE; } break; - case 517: /* fill_mode ::= PREV */ -{ yymsp[0].minor.yy410 = FILL_MODE_PREV; } + case 525: /* fill_mode ::= PREV */ +{ yymsp[0].minor.yy174 = FILL_MODE_PREV; } break; - case 518: /* fill_mode ::= NULL */ -{ yymsp[0].minor.yy410 = FILL_MODE_NULL; } + case 526: /* fill_mode ::= NULL */ +{ yymsp[0].minor.yy174 = FILL_MODE_NULL; } break; - case 519: /* fill_mode ::= NULL_F */ -{ yymsp[0].minor.yy410 = FILL_MODE_NULL_F; } + case 527: /* fill_mode ::= NULL_F */ +{ yymsp[0].minor.yy174 = FILL_MODE_NULL_F; } break; - case 520: /* fill_mode ::= LINEAR */ -{ yymsp[0].minor.yy410 = FILL_MODE_LINEAR; } + case 528: /* fill_mode ::= LINEAR */ +{ yymsp[0].minor.yy174 = FILL_MODE_LINEAR; } break; - case 521: /* fill_mode ::= NEXT */ -{ yymsp[0].minor.yy410 = FILL_MODE_NEXT; } + case 529: /* fill_mode ::= NEXT */ +{ yymsp[0].minor.yy174 = FILL_MODE_NEXT; } break; - case 524: /* group_by_list ::= expr_or_subquery */ -{ yylhsminor.yy110 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy42))); } - yymsp[0].minor.yy110 = yylhsminor.yy110; + case 532: /* group_by_list ::= expr_or_subquery */ +{ yylhsminor.yy220 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy140))); } + yymsp[0].minor.yy220 = yylhsminor.yy220; break; - case 525: /* group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ -{ yylhsminor.yy110 = addNodeToList(pCxt, yymsp[-2].minor.yy110, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy42))); } - yymsp[-2].minor.yy110 = yylhsminor.yy110; + case 533: /* group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ +{ yylhsminor.yy220 = addNodeToList(pCxt, yymsp[-2].minor.yy220, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy140))); } + yymsp[-2].minor.yy220 = yylhsminor.yy220; break; - case 529: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ -{ yymsp[-5].minor.yy42 = createInterpTimeRange(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy42), releaseRawExprNode(pCxt, yymsp[-1].minor.yy42)); } + case 537: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ +{ yymsp[-5].minor.yy140 = createInterpTimeRange(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy140), releaseRawExprNode(pCxt, yymsp[-1].minor.yy140)); } break; - case 532: /* query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ + case 540: /* query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ { - yylhsminor.yy42 = addOrderByClause(pCxt, yymsp[-3].minor.yy42, yymsp[-2].minor.yy110); - yylhsminor.yy42 = addSlimitClause(pCxt, yylhsminor.yy42, yymsp[-1].minor.yy42); - yylhsminor.yy42 = addLimitClause(pCxt, yylhsminor.yy42, yymsp[0].minor.yy42); + yylhsminor.yy140 = addOrderByClause(pCxt, yymsp[-3].minor.yy140, yymsp[-2].minor.yy220); + yylhsminor.yy140 = addSlimitClause(pCxt, yylhsminor.yy140, yymsp[-1].minor.yy140); + yylhsminor.yy140 = addLimitClause(pCxt, yylhsminor.yy140, yymsp[0].minor.yy140); } - yymsp[-3].minor.yy42 = yylhsminor.yy42; + yymsp[-3].minor.yy140 = yylhsminor.yy140; break; - case 535: /* union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ -{ yylhsminor.yy42 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy42, yymsp[0].minor.yy42); } - yymsp[-3].minor.yy42 = yylhsminor.yy42; + case 543: /* union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ +{ yylhsminor.yy140 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy140, yymsp[0].minor.yy140); } + yymsp[-3].minor.yy140 = yylhsminor.yy140; break; - case 536: /* union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ -{ yylhsminor.yy42 = createSetOperator(pCxt, SET_OP_TYPE_UNION, yymsp[-2].minor.yy42, yymsp[0].minor.yy42); } - yymsp[-2].minor.yy42 = yylhsminor.yy42; + case 544: /* union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ +{ yylhsminor.yy140 = createSetOperator(pCxt, SET_OP_TYPE_UNION, yymsp[-2].minor.yy140, yymsp[0].minor.yy140); } + yymsp[-2].minor.yy140 = yylhsminor.yy140; break; - case 544: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */ - case 548: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==548); -{ yymsp[-1].minor.yy42 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); } + case 552: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */ + case 556: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==556); +{ yymsp[-1].minor.yy140 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); } break; - case 545: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ - case 549: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==549); -{ yymsp[-3].minor.yy42 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); } + case 553: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ + case 557: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==557); +{ yymsp[-3].minor.yy140 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); } break; - case 546: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - case 550: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==550); -{ yymsp[-3].minor.yy42 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); } + case 554: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + case 558: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==558); +{ yymsp[-3].minor.yy140 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); } break; - case 551: /* subquery ::= NK_LP query_expression NK_RP */ -{ yylhsminor.yy42 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy42); } - yymsp[-2].minor.yy42 = yylhsminor.yy42; + case 559: /* subquery ::= NK_LP query_expression NK_RP */ +{ yylhsminor.yy140 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy140); } + yymsp[-2].minor.yy140 = yylhsminor.yy140; break; - case 556: /* sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ -{ yylhsminor.yy42 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy42), yymsp[-1].minor.yy106, yymsp[0].minor.yy599); } - yymsp[-2].minor.yy42 = yylhsminor.yy42; + case 564: /* sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ +{ yylhsminor.yy140 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy140), yymsp[-1].minor.yy866, yymsp[0].minor.yy697); } + yymsp[-2].minor.yy140 = yylhsminor.yy140; break; - case 557: /* ordering_specification_opt ::= */ -{ yymsp[1].minor.yy106 = ORDER_ASC; } + case 565: /* ordering_specification_opt ::= */ +{ yymsp[1].minor.yy866 = ORDER_ASC; } break; - case 558: /* ordering_specification_opt ::= ASC */ -{ yymsp[0].minor.yy106 = ORDER_ASC; } + case 566: /* ordering_specification_opt ::= ASC */ +{ yymsp[0].minor.yy866 = ORDER_ASC; } break; - case 559: /* ordering_specification_opt ::= DESC */ -{ yymsp[0].minor.yy106 = ORDER_DESC; } + case 567: /* ordering_specification_opt ::= DESC */ +{ yymsp[0].minor.yy866 = ORDER_DESC; } break; - case 560: /* null_ordering_opt ::= */ -{ yymsp[1].minor.yy599 = NULL_ORDER_DEFAULT; } + case 568: /* null_ordering_opt ::= */ +{ yymsp[1].minor.yy697 = NULL_ORDER_DEFAULT; } break; - case 561: /* null_ordering_opt ::= NULLS FIRST */ -{ yymsp[-1].minor.yy599 = NULL_ORDER_FIRST; } + case 569: /* null_ordering_opt ::= NULLS FIRST */ +{ yymsp[-1].minor.yy697 = NULL_ORDER_FIRST; } break; - case 562: /* null_ordering_opt ::= NULLS LAST */ -{ yymsp[-1].minor.yy599 = NULL_ORDER_LAST; } + case 570: /* null_ordering_opt ::= NULLS LAST */ +{ yymsp[-1].minor.yy697 = NULL_ORDER_LAST; } break; default: break; diff --git a/source/libs/parser/test/mockCatalog.cpp b/source/libs/parser/test/mockCatalog.cpp index c3f6c3ac72..1af214bfb4 100644 --- a/source/libs/parser/test/mockCatalog.cpp +++ b/source/libs/parser/test/mockCatalog.cpp @@ -226,6 +226,7 @@ void generateDatabases(MockCatalogService* mcs) { generateTestTables(g_mockCatalogService.get(), "cache_db"); generateTestStables(g_mockCatalogService.get(), "cache_db"); mcs->createDatabase("rollup_db", true); + mcs->createDatabase("testus", false, 0, TSDB_TIME_PRECISION_NANO); } } // namespace @@ -252,7 +253,8 @@ int32_t __catalogGetCachedTableHashVgroup(SCatalog* pCtg, const SName* pTableNam return code; } -int32_t __catalogGetCachedTableVgMeta(SCatalog* pCtg, const SName* pTableName, SVgroupInfo* pVgroup, STableMeta** pTableMeta) { +int32_t __catalogGetCachedTableVgMeta(SCatalog* pCtg, const SName* pTableName, SVgroupInfo* pVgroup, + STableMeta** pTableMeta) { int32_t code = g_mockCatalogService->catalogGetTableMeta(pTableName, pTableMeta, true); if (code) return code; code = g_mockCatalogService->catalogGetTableHashVgroup(pTableName, pVgroup, true); diff --git a/source/libs/parser/test/mockCatalogService.cpp b/source/libs/parser/test/mockCatalogService.cpp index 71b7c1a678..4d1ef597d0 100644 --- a/source/libs/parser/test/mockCatalogService.cpp +++ b/source/libs/parser/test/mockCatalogService.cpp @@ -346,12 +346,13 @@ class MockCatalogServiceImpl { dnode_.insert(std::make_pair(dnodeId, epSet)); } - void createDatabase(const string& db, bool rollup, int8_t cacheLast) { + void createDatabase(const string& db, bool rollup, int8_t cacheLast, int8_t precision) { SDbCfgInfo cfg = {0}; if (rollup) { cfg.pRetensions = taosArrayInit(TARRAY_MIN_SIZE, sizeof(SRetention)); } cfg.cacheLast = cacheLast; + cfg.precision = precision; dbCfg_.insert(std::make_pair(db, cfg)); } @@ -681,8 +682,8 @@ void MockCatalogService::createDnode(int32_t dnodeId, const string& host, int16_ impl_->createDnode(dnodeId, host, port); } -void MockCatalogService::createDatabase(const string& db, bool rollup, int8_t cacheLast) { - impl_->createDatabase(db, rollup, cacheLast); +void MockCatalogService::createDatabase(const string& db, bool rollup, int8_t cacheLast, int8_t precision) { + impl_->createDatabase(db, rollup, cacheLast, precision); } int32_t MockCatalogService::catalogGetTableMeta(const SName* pTableName, STableMeta** pTableMeta, diff --git a/source/libs/parser/test/mockCatalogService.h b/source/libs/parser/test/mockCatalogService.h index acd7fab8e1..cc955df2b0 100644 --- a/source/libs/parser/test/mockCatalogService.h +++ b/source/libs/parser/test/mockCatalogService.h @@ -65,7 +65,8 @@ class MockCatalogService { void createFunction(const std::string& func, int8_t funcType, int8_t outputType, int32_t outputLen, int32_t bufSize); void createSmaIndex(const SMCreateSmaReq* pReq); void createDnode(int32_t dnodeId, const std::string& host, int16_t port); - void createDatabase(const std::string& db, bool rollup = false, int8_t cacheLast = 0); + void createDatabase(const std::string& db, bool rollup = false, int8_t cacheLast = 0, + int8_t precision = TSDB_TIME_PRECISION_MILLI); int32_t catalogGetTableMeta(const SName* pTableName, STableMeta** pTableMeta, bool onlyCache = false) const; int32_t catalogGetTableHashVgroup(const SName* pTableName, SVgroupInfo* vgInfo, bool onlyCache = false) const; diff --git a/source/libs/parser/test/parInitialCTest.cpp b/source/libs/parser/test/parInitialCTest.cpp index 2dac35590e..c36402e8e0 100644 --- a/source/libs/parser/test/parInitialCTest.cpp +++ b/source/libs/parser/test/parInitialCTest.cpp @@ -22,12 +22,16 @@ namespace ParserTest { class ParserInitialCTest : public ParserDdlTest {}; /* - * COMPACT DATABASE db_name + * COMPACT DATABASE db_name [START WITH start_time] [END WITH END_time] */ TEST_F(ParserInitialCTest, compact) { SCompactDbReq expect = {0}; - auto setCompactDbReq = [&](const char* pDb) { snprintf(expect.db, sizeof(expect.db), "0.%s", pDb); }; + auto setCompactDbReq = [&](const char* pDb, int64_t start = INT64_MIN, int64_t end = INT64_MAX) { + snprintf(expect.db, sizeof(expect.db), "0.%s", pDb); + expect.timeRange.skey = start; + expect.timeRange.ekey = end; + }; setCheckDdlFunc([&](const SQuery* pQuery, ParserStage stage) { ASSERT_EQ(nodeType(pQuery->pRoot), QUERY_NODE_COMPACT_DATABASE_STMT); @@ -35,10 +39,21 @@ TEST_F(ParserInitialCTest, compact) { SCompactDbReq req = {0}; ASSERT_EQ(tDeserializeSCompactDbReq(pQuery->pCmdMsg->pMsg, pQuery->pCmdMsg->msgLen, &req), TSDB_CODE_SUCCESS); ASSERT_EQ(std::string(req.db), std::string(expect.db)); + ASSERT_EQ(req.timeRange.skey, expect.timeRange.skey); + ASSERT_EQ(req.timeRange.ekey, expect.timeRange.ekey); }); - setCompactDbReq("wxy_db"); - run("COMPACT DATABASE wxy_db"); + setCompactDbReq("test"); + run("COMPACT DATABASE test"); + + setCompactDbReq("test", 1678168883000, 1678255283000); + run("COMPACT DATABASE test START WITH '2023-03-07 14:01:23' END WITH '2023-03-08 14:01:23'"); + + setCompactDbReq("testus", 1673071283000000000); + run("COMPACT DATABASE testus START WITH TIMESTAMP '2023-01-07 14:01:23'"); + + setCompactDbReq("testus", INT64_MIN, 1675749683000000000); + run("COMPACT DATABASE testus END WITH 1675749683000000000"); } /* diff --git a/source/libs/parser/test/parTestUtil.cpp b/source/libs/parser/test/parTestUtil.cpp index f18dd4f17f..dfe9fcf96e 100644 --- a/source/libs/parser/test/parTestUtil.cpp +++ b/source/libs/parser/test/parTestUtil.cpp @@ -65,15 +65,16 @@ int32_t getLogLevel() { return g_logLevel; } class ParserTestBaseImpl { public: - ParserTestBaseImpl(ParserTestBase* pBase) : pBase_(pBase), sqlNo_(0), sqlNum_(0) {} + ParserTestBaseImpl(ParserTestBase* pBase) : pBase_(pBase), sqlNo_(0), sqlNum_(0) { + caseEnv_.numOfSkipSql_ = g_skipSql; + caseEnv_.numOfLimitSql_ = g_limitSql; + } void login(const std::string& user) { caseEnv_.user_ = user; } void useDb(const string& acctId, const string& db) { caseEnv_.acctId_ = acctId; caseEnv_.db_ = db; - caseEnv_.numOfSkipSql_ = g_skipSql; - caseEnv_.numOfLimitSql_ = g_limitSql; } void run(const string& sql, int32_t expect, ParserStage checkStage) { From 383459441d9c12a64ff2f6017a9fe97f344f91f1 Mon Sep 17 00:00:00 2001 From: Benguang Zhao Date: Mon, 6 Mar 2023 20:24:47 +0800 Subject: [PATCH 132/174] enh: simplify conditions of triggering snapshot --- source/libs/sync/src/syncPipeline.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/libs/sync/src/syncPipeline.c b/source/libs/sync/src/syncPipeline.c index faa44a626c..cc1a40a430 100644 --- a/source/libs/sync/src/syncPipeline.c +++ b/source/libs/sync/src/syncPipeline.c @@ -742,7 +742,8 @@ int32_t syncLogReplMgrProcessReplyAsRecovery(SSyncLogReplMgr* pMgr, SSyncNode* p if (pMsg->matchIndex < pNode->pLogBuf->matchIndex) { term = syncLogReplMgrGetPrevLogTerm(pMgr, pNode, index + 1); - if (term < 0 || (term != pMsg->lastMatchTerm && (index + 1 == firstVer || index == firstVer))) { + if ((index + 1 < firstVer) || (term < 0) || + (term != pMsg->lastMatchTerm && (index + 1 == firstVer || index == firstVer))) { ASSERT(term >= 0 || terrno == TSDB_CODE_WAL_LOG_NOT_EXIST); if (syncNodeStartSnapshot(pNode, &destId) < 0) { sError("vgId:%d, failed to start snapshot for peer dnode:%d", pNode->vgId, DID(&destId)); From 8e6534d9f3c55c757268b5ee5dd9d9c2189c0548 Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Tue, 7 Mar 2023 16:06:56 +0800 Subject: [PATCH 133/174] fix: insert data crash after empty table last_row cache --- source/dnode/vnode/src/tsdb/tsdbCache.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/source/dnode/vnode/src/tsdb/tsdbCache.c b/source/dnode/vnode/src/tsdb/tsdbCache.c index 425bd2ca1c..1fdb9dd972 100644 --- a/source/dnode/vnode/src/tsdb/tsdbCache.c +++ b/source/dnode/vnode/src/tsdb/tsdbCache.c @@ -257,9 +257,6 @@ int32_t tsdbCacheInsertLastrow(SLRUCache *pCache, STsdb *pTsdb, tb_uid_t uid, TS SLastCol lastCol = {.ts = keyTs, .colVal = colVal}; if (IS_VAR_DATA_TYPE(colVal.type) && colVal.value.nData > 0) { - SLastCol *pLastCol = (SLastCol *)taosArrayGet(pLast, iCol); - taosMemoryFree(pLastCol->colVal.value.pData); - lastCol.colVal.value.pData = taosMemoryMalloc(colVal.value.nData); if (lastCol.colVal.value.pData == NULL) { terrno = TSDB_CODE_OUT_OF_MEMORY; From ab5cce806c8b9d7406381917512f1de21186efed Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Tue, 7 Mar 2023 16:25:46 +0800 Subject: [PATCH 134/174] fix: fix: after the last_row cache is created, modify the schema and query again, resulting in taosd crash --- source/dnode/vnode/src/tsdb/tsdbCacheRead.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/source/dnode/vnode/src/tsdb/tsdbCacheRead.c b/source/dnode/vnode/src/tsdb/tsdbCacheRead.c index 0ee42366de..5528b6313c 100644 --- a/source/dnode/vnode/src/tsdb/tsdbCacheRead.c +++ b/source/dnode/vnode/src/tsdb/tsdbCacheRead.c @@ -80,7 +80,12 @@ static int32_t saveOneRow(SArray* pRow, SSDataBlock* pBlock, SCacheRowsReader* p SLastCol* pColVal = (SLastCol*)taosArrayGet(pRow, 0); colDataSetVal(pColInfoData, numOfRows, (const char*)&pColVal->ts, false); } else { - int32_t slotId = slotIds[i]; + int32_t slotId = slotIds[i]; + // add check for null value, caused by the modification of table schema (new column added). + if (slotId >= taosArrayGetSize(pRow)) { + colDataSetNULL(pColInfoData, numOfRows); + continue; + } SLastCol* pColVal = (SLastCol*)taosArrayGet(pRow, slotId); SColVal* pVal = &pColVal->colVal; From 21c18a4a9b14064371067664e03cc8185eda1224 Mon Sep 17 00:00:00 2001 From: Benguang Zhao Date: Tue, 7 Mar 2023 16:34:02 +0800 Subject: [PATCH 135/174] enh: use syncNodeReplicateReset in syncNodeOnSnapshotRsp --- source/libs/sync/inc/syncReplication.h | 2 +- source/libs/sync/src/syncReplication.c | 9 +++++++++ source/libs/sync/src/syncSnapshot.c | 10 +++------- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/source/libs/sync/inc/syncReplication.h b/source/libs/sync/inc/syncReplication.h index f2e240344f..a55fd7ead3 100644 --- a/source/libs/sync/inc/syncReplication.h +++ b/source/libs/sync/inc/syncReplication.h @@ -51,7 +51,7 @@ int32_t syncNodeHeartbeatPeers(SSyncNode* pSyncNode); int32_t syncNodeSendHeartbeat(SSyncNode* pSyncNode, const SRaftId* pDestId, SRpcMsg* pMsg); int32_t syncNodeReplicate(SSyncNode* pSyncNode); -int32_t syncNodeReplicateOne(SSyncNode* pSyncNode, SRaftId* pDestId, bool snapshot); +int32_t syncNodeReplicateReset(SSyncNode* pSyncNode, SRaftId* pDestId); int32_t syncNodeReplicateWithoutLock(SSyncNode* pNode); int32_t syncNodeSendAppendEntries(SSyncNode* pNode, const SRaftId* destRaftId, SRpcMsg* pRpcMsg); diff --git a/source/libs/sync/src/syncReplication.c b/source/libs/sync/src/syncReplication.c index 8cdf821cff..1d94b288d3 100644 --- a/source/libs/sync/src/syncReplication.c +++ b/source/libs/sync/src/syncReplication.c @@ -48,6 +48,15 @@ int32_t syncNodeMaybeSendAppendEntries(SSyncNode* pSyncNode, const SRaftId* destRaftId, SRpcMsg* pRpcMsg); +int32_t syncNodeReplicateReset(SSyncNode* pNode, SRaftId* pDestId) { + SSyncLogBuffer* pBuf = pNode->pLogBuf; + taosThreadMutexLock(&pBuf->mutex); + SSyncLogReplMgr* pMgr = syncNodeGetLogReplMgr(pNode, pDestId); + syncLogReplMgrReset(pMgr); + taosThreadMutexUnlock(&pBuf->mutex); + return 0; +} + int32_t syncNodeReplicate(SSyncNode* pNode) { SSyncLogBuffer* pBuf = pNode->pLogBuf; taosThreadMutexLock(&pBuf->mutex); diff --git a/source/libs/sync/src/syncSnapshot.c b/source/libs/sync/src/syncSnapshot.c index 381327d4d7..413d6adf05 100644 --- a/source/libs/sync/src/syncSnapshot.c +++ b/source/libs/sync/src/syncSnapshot.c @@ -992,8 +992,7 @@ int32_t syncNodeOnSnapshotRsp(SSyncNode *pSyncNode, const SRpcMsg *pRpcMsg) { if (pMsg->ack == SYNC_SNAPSHOT_SEQ_END) { syncLogRecvSyncSnapshotRsp(pSyncNode, pMsg, "process seq end"); snapshotSenderStop(pSender, true); - SSyncLogReplMgr *pMgr = syncNodeGetLogReplMgr(pSyncNode, &pMsg->srcId); - syncLogReplMgrReset(pMgr); + syncNodeReplicateReset(pSyncNode, &pMsg->srcId); return 0; } @@ -1018,8 +1017,7 @@ int32_t syncNodeOnSnapshotRsp(SSyncNode *pSyncNode, const SRpcMsg *pRpcMsg) { syncLogRecvSyncSnapshotRsp(pSyncNode, pMsg, "receive error ack"); sSError(pSender, "snapshot sender receive error ack:%d, my seq:%d", pMsg->ack, pSender->seq); snapshotSenderStop(pSender, true); - SSyncLogReplMgr *pMgr = syncNodeGetLogReplMgr(pSyncNode, &pMsg->srcId); - syncLogReplMgrReset(pMgr); + syncNodeReplicateReset(pSyncNode, &pMsg->srcId); return -1; } @@ -1027,8 +1025,6 @@ int32_t syncNodeOnSnapshotRsp(SSyncNode *pSyncNode, const SRpcMsg *pRpcMsg) { _ERROR: snapshotSenderStop(pSender, true); - SSyncLogReplMgr *pMgr = syncNodeGetLogReplMgr(pSyncNode, &pMsg->srcId); - syncLogReplMgrReset(pMgr); - + syncNodeReplicateReset(pSyncNode, &pMsg->srcId); return -1; } From eca97bf5b49e4f1ceb251a193b877b8873fbd7fc Mon Sep 17 00:00:00 2001 From: Benguang Zhao Date: Tue, 7 Mar 2023 16:44:47 +0800 Subject: [PATCH 136/174] enh: keep extra raft Logs before minimum match index --- source/libs/sync/src/syncMain.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/libs/sync/src/syncMain.c b/source/libs/sync/src/syncMain.c index 9601cd6ab0..04e4859c5e 100644 --- a/source/libs/sync/src/syncMain.c +++ b/source/libs/sync/src/syncMain.c @@ -301,7 +301,7 @@ int32_t syncBeginSnapshot(int64_t rid, int64_t lastApplyIndex) { syncNodeRelease(pSyncNode); return 0; } - logRetention = TMAX(logRetention, lastApplyIndex - pSyncNode->minMatchIndex); + logRetention = TMAX(logRetention, lastApplyIndex - pSyncNode->minMatchIndex + logRetention); } _DEL_WAL: From 14e62eca8cd295bfffec1fb6f6166a13f887cbda Mon Sep 17 00:00:00 2001 From: chenhaoran Date: Tue, 7 Mar 2023 17:51:54 +0800 Subject: [PATCH 137/174] test: add stream and topic in compatibility case --- tests/system-test/0-others/compa4096.json | 2 +- tests/system-test/0-others/compatibility.py | 12 +++++------ tests/system-test/0-others/tmqBasic.json | 24 +++++++++++++++++++++ tests/system-test/2-query/tsbsQuery.py | 2 +- 4 files changed, 32 insertions(+), 8 deletions(-) create mode 100644 tests/system-test/0-others/tmqBasic.json diff --git a/tests/system-test/0-others/compa4096.json b/tests/system-test/0-others/compa4096.json index 49e0ec1d8a..5cc5d2084d 100644 --- a/tests/system-test/0-others/compa4096.json +++ b/tests/system-test/0-others/compa4096.json @@ -41,7 +41,7 @@ "interlace_rows": 0, "line_protocol": null, "tcp_transfer": "no", - "insert_rows": 1000, + "insert_rows": 10000, "childtable_limit": 0, "childtable_offset": 0, "rows_per_tbl": 0, diff --git a/tests/system-test/0-others/compatibility.py b/tests/system-test/0-others/compatibility.py index b9d0e1844b..21d307ce37 100644 --- a/tests/system-test/0-others/compatibility.py +++ b/tests/system-test/0-others/compatibility.py @@ -134,11 +134,11 @@ class TDTestCase: os.system(f"LD_LIBRARY_PATH=/usr/lib taos -s 'use test;create stream current_stream into current_stream_output_stb as select _wstart as `start`, _wend as wend, max(current) as max_current from meters where voltage <= 220 interval (5s);' ") os.system('LD_LIBRARY_PATH=/usr/lib taos -s "use test;create stream power_stream into power_stream_output_stb as select ts, concat_ws(\\".\\", location, tbname) as meter_location, current*voltage*cos(phase) as active_power, current*voltage*sin(phase) as reactive_power from meters partition by tbname;" ') os.system('LD_LIBRARY_PATH=/usr/lib taos -s "use test;show streams;" ') - os.system(f"cd {scriptsPath} && python3 testRoll.py") + os.system(f"sed -i 's/\/etc\/taos/{cPath}/' 0-others/tmqBasic.json ") + # os.system("LD_LIBRARY_PATH=/usr/lib taosBenchmark -f 0-others/tmqBasic.json -y ") + os.system('LD_LIBRARY_PATH=/usr/lib taos -s "create topic if not exists tmq_test_topic as select current,voltage,phase from test.meters where voltage <= 106 and current <= 5;" ') os.system('LD_LIBRARY_PATH=/usr/lib taos -s "use test;show topics;" ') - # print(f"start taosd: nohup taosd -c {cPath} & ") - # os.system(f" nohup taosd -c {cPath} & " ) tdLog.info(" LD_LIBRARY_PATH=/usr/lib taosBenchmark -f 0-others/compa4096.json -y ") os.system("LD_LIBRARY_PATH=/usr/lib taosBenchmark -f 0-others/compa4096.json -y") os.system("LD_LIBRARY_PATH=/usr/lib taos -s 'flush database db4096 '") @@ -170,7 +170,7 @@ class TDTestCase: # tdsql.query(f"select count(*) from {stb}") # tdsql.checkData(0,0,tableNumbers*recordNumbers2) tdsql.query(f"select count(*) from db4096.stb0") - tdsql.checkData(0,0,5000) + tdsql.checkData(0,0,50000) tdsql=tdCom.newTdSql() tdLog.printNoPrefix(f"==========step4:verify backticks in taos Sql-TD18542") @@ -209,8 +209,8 @@ class TDTestCase: tdLog.exit("%s(%d) failed" % args) tdsql.query("show streams;") tdsql.checkRows(2) - tdsql.execute("insert into tmq_test.tb1 values (now, 11, 3.0, 'tmq test1');") - tdsql.execute("insert into tmq_test.tb2 values (now, 22, 3.0, 'tmq test2');") + tdsql.execute("insert into test.d80 values (now+1s, 11, 103, 0.21);") + tdsql.execute("insert into test.d9 values (now+5s, 4.3, 104, 0.4);") conn = taos.connect() diff --git a/tests/system-test/0-others/tmqBasic.json b/tests/system-test/0-others/tmqBasic.json new file mode 100644 index 0000000000..24e815708a --- /dev/null +++ b/tests/system-test/0-others/tmqBasic.json @@ -0,0 +1,24 @@ +{ + "filetype": "subscribe", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "confirm_parameter_prompt": "no", + "tmq_info": { + "concurrent": 1, + "poll_delay": 10000, + "group.id": "grpId_0", + "client.id": "clientId", + "auto.offset.reset": "earliest", + "enable.auto.commit": "true", + "auto.commit.interval.ms": 1000, + "enable.heartbeat.background": "true", + "experimental.snapshot.enable": "true", + "msg.with.table.name": "false", + "topic_list": [ + {"name": "tmq_topic_1", "sql": "select current,voltage,phase from test.meters where voltage <= 106 ;"} + ] + } +} \ No newline at end of file diff --git a/tests/system-test/2-query/tsbsQuery.py b/tests/system-test/2-query/tsbsQuery.py index 106d43ea38..4f415550b8 100644 --- a/tests/system-test/2-query/tsbsQuery.py +++ b/tests/system-test/2-query/tsbsQuery.py @@ -86,7 +86,7 @@ class TDTestCase: self.ctbNums=ctbNums rowNUms=5000 ts=1451606400000 - tdSql.execute(f"create database {dbname};") + tdSql.execute(f"create database {dbname} cachemodel 'both';") tdSql.execute(f"use {dbname} ") tdSql.execute(f''' create table {stabname1} (ts timestamp,latitude double,longitude double,elevation double,velocity double,heading double,grade double,fuel_consumption double) tags (name binary(30),fleet binary(30),driver binary(30),model binary(30),device_version binary(30),load_capacity double,fuel_capacity double,nominal_fuel_consumption double); From 9e49229f0e9b39bdc9c7a0971c5b9b778f31cae6 Mon Sep 17 00:00:00 2001 From: sunpeng Date: Tue, 7 Mar 2023 18:10:06 +0800 Subject: [PATCH 138/174] enh: reqid to hex --- cmake/taosadapter_CMakeLists.txt.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/taosadapter_CMakeLists.txt.in b/cmake/taosadapter_CMakeLists.txt.in index 0ff1371618..357a79715a 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 7920f98 + GIT_TAG 97d717d SOURCE_DIR "${TD_SOURCE_DIR}/tools/taosadapter" BINARY_DIR "" #BUILD_IN_SOURCE TRUE From ab86f6abee379c2f4e5d4c6f4743463e4b106f55 Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Tue, 7 Mar 2023 18:15:17 +0800 Subject: [PATCH 139/174] fix: taosd crash when modify the schema and query last_row --- source/dnode/vnode/src/tsdb/tsdbCache.c | 118 +++++++++++++----------- 1 file changed, 63 insertions(+), 55 deletions(-) diff --git a/source/dnode/vnode/src/tsdb/tsdbCache.c b/source/dnode/vnode/src/tsdb/tsdbCache.c index 1fdb9dd972..3e34c3b048 100644 --- a/source/dnode/vnode/src/tsdb/tsdbCache.c +++ b/source/dnode/vnode/src/tsdb/tsdbCache.c @@ -1262,17 +1262,57 @@ _err: return code; } -static int32_t mergeLastRow(tb_uid_t uid, STsdb *pTsdb, bool *dup, SArray **ppColArray, SCacheRowsReader *pr) { - int32_t code = 0; +static int32_t initLastColArray(STSchema *pTSchema, SArray **ppColArray) { + SArray *pColArray = taosArrayInit(pTSchema->numOfCols, sizeof(SLastCol)); + if (NULL == pColArray) { + return TSDB_CODE_OUT_OF_MEMORY; + } + for (int32_t i = 0; i < pTSchema->numOfCols; ++i) { + SLastCol col = {.ts = 0, .colVal = COL_VAL_NULL(pTSchema->columns[i].colId, pTSchema->columns[i].type)}; + taosArrayPush(pColArray, &col); + } + *ppColArray = pColArray; + return TSDB_CODE_SUCCESS; +} + +static int32_t cloneTSchema(STSchema *pSrc, STSchema **ppDst) { + int32_t len = sizeof(STSchema) + sizeof(STColumn) * pSrc->numOfCols; + *ppDst = taosMemoryMalloc(len); + if (NULL == *ppDst) { + return TSDB_CODE_OUT_OF_MEMORY; + } + memcpy(*ppDst, pSrc, len); + return TSDB_CODE_SUCCESS; +} + +static int32_t updateTSchema(int32_t sversion, SCacheRowsReader *pReader, uint64_t uid) { + if (NULL == pReader->pCurrSchema && sversion == pReader->pSchema->version) { + return cloneTSchema(pReader->pSchema, &pReader->pCurrSchema); + } + + if (NULL != pReader->pCurrSchema && sversion == pReader->pCurrSchema->version) { + return TSDB_CODE_SUCCESS; + } + + taosMemoryFreeClear(pReader->pCurrSchema); + return metaGetTbTSchemaEx(pReader->pTsdb->pVnode->pMeta, pReader->suid, uid, sversion, &pReader->pCurrSchema); +} + +static int32_t mergeLastRow(tb_uid_t uid, STsdb *pTsdb, bool *dup, SArray **ppColArray, SCacheRowsReader *pr) { STSchema *pTSchema = pr->pSchema; // metaGetTbTSchema(pTsdb->pVnode->pMeta, uid, -1, 1); - int16_t nCol = pTSchema->numOfCols; + int16_t nLastCol = pTSchema->numOfCols; int16_t iCol = 0; int16_t noneCol = 0; bool setNoneCol = false; - SArray *pColArray = taosArrayInit(nCol, sizeof(SLastCol)); + SArray *pColArray = NULL; SColVal *pColVal = &(SColVal){0}; + int32_t code = initLastColArray(pTSchema, &pColArray); + if (TSDB_CODE_SUCCESS != code) { + return code; + } + TSKEY lastRowTs = TSKEY_MAX; CacheNextRowIter iter = {0}; @@ -1287,6 +1327,13 @@ static int32_t mergeLastRow(tb_uid_t uid, STsdb *pTsdb, bool *dup, SArray **ppCo break; } + code = updateTSchema(TSDBROW_SVERSION(pRow), pr, uid); + if (TSDB_CODE_SUCCESS != code) { + goto _err; + } + pTSchema = pr->pCurrSchema; + int16_t nCol = pTSchema->numOfCols; + TSKEY rowTs = TSDBROW_TS(pRow); if (lastRowTs == TSKEY_MAX) { @@ -1294,29 +1341,27 @@ static int32_t mergeLastRow(tb_uid_t uid, STsdb *pTsdb, bool *dup, SArray **ppCo STColumn *pTColumn = &pTSchema->columns[0]; *pColVal = COL_VAL_VALUE(pTColumn->colId, pTColumn->type, (SValue){.val = lastRowTs}); - if (taosArrayPush(pColArray, &(SLastCol){.ts = lastRowTs, .colVal = *pColVal}) == NULL) { - terrno = TSDB_CODE_OUT_OF_MEMORY; - code = TSDB_CODE_OUT_OF_MEMORY; - goto _err; - } + taosArraySet(pColArray, 0, &(SLastCol){.ts = lastRowTs, .colVal = *pColVal}); for (iCol = 1; iCol < nCol; ++iCol) { + if (iCol >= nLastCol) { + break; + } + SLastCol *pCol = taosArrayGet(pColArray, iCol); + if (pCol->colVal.cid != pTSchema->columns[iCol].colId) { + continue; + } tsdbRowGetColVal(pRow, pTSchema, iCol, pColVal); - SLastCol lastCol = {.ts = lastRowTs, .colVal = *pColVal}; + *pCol = (SLastCol){.ts = lastRowTs, .colVal = *pColVal}; if (IS_VAR_DATA_TYPE(pColVal->type) && pColVal->value.nData > 0) { - lastCol.colVal.value.pData = taosMemoryMalloc(lastCol.colVal.value.nData); - if (lastCol.colVal.value.pData == NULL) { + pCol->colVal.value.pData = taosMemoryMalloc(pCol->colVal.value.nData); + if (pCol->colVal.value.pData == NULL) { terrno = TSDB_CODE_OUT_OF_MEMORY; code = TSDB_CODE_OUT_OF_MEMORY; goto _err; } - memcpy(lastCol.colVal.value.pData, pColVal->value.pData, pColVal->value.nData); - } - - if (taosArrayPush(pColArray, &lastCol) == NULL) { - code = TSDB_CODE_OUT_OF_MEMORY; - goto _err; + memcpy(pCol->colVal.value.pData, pColVal->value.pData, pColVal->value.nData); } if (COL_VAL_IS_NONE(pColVal) && !setNoneCol) { @@ -1387,43 +1432,6 @@ _err: return code; } -static int32_t cloneTSchema(STSchema *pSrc, STSchema **ppDst) { - int32_t len = sizeof(STSchema) + sizeof(STColumn) * pSrc->numOfCols; - *ppDst = taosMemoryMalloc(len); - if (NULL == *ppDst) { - return TSDB_CODE_OUT_OF_MEMORY; - } - memcpy(*ppDst, pSrc, len); - return TSDB_CODE_SUCCESS; -} - -static int32_t updateTSchema(int32_t sversion, SCacheRowsReader *pReader, uint64_t uid) { - if (NULL == pReader->pCurrSchema && sversion == pReader->pSchema->version) { - return cloneTSchema(pReader->pSchema, &pReader->pCurrSchema); - } - - if (NULL != pReader->pCurrSchema && sversion == pReader->pCurrSchema->version) { - return TSDB_CODE_SUCCESS; - } - - taosMemoryFreeClear(pReader->pCurrSchema); - return metaGetTbTSchemaEx(pReader->pTsdb->pVnode->pMeta, pReader->suid, uid, sversion, &pReader->pCurrSchema); -} - -static int32_t initLastColArray(STSchema *pTSchema, SArray **ppColArray) { - SArray *pColArray = taosArrayInit(pTSchema->numOfCols, sizeof(SLastCol)); - if (NULL == pColArray) { - return TSDB_CODE_OUT_OF_MEMORY; - } - - for (int32_t i = 0; i < pTSchema->numOfCols; ++i) { - SLastCol col = {.ts = 0, .colVal = COL_VAL_NULL(pTSchema->columns[i].colId, pTSchema->columns[i].type)}; - taosArrayPush(pColArray, &col); - } - *ppColArray = pColArray; - return TSDB_CODE_SUCCESS; -} - static int32_t mergeLast(tb_uid_t uid, STsdb *pTsdb, SArray **ppLastArray, SCacheRowsReader *pr) { STSchema *pTSchema = pr->pSchema; // metaGetTbTSchema(pTsdb->pVnode->pMeta, uid, -1, 1); int16_t nLastCol = pTSchema->numOfCols; From a063d698901e1a9f4574c29149b683ffbeaa323f Mon Sep 17 00:00:00 2001 From: cadem Date: Tue, 7 Mar 2023 18:27:26 +0800 Subject: [PATCH 140/174] feat/add-reboot-time --- source/common/src/systable.c | 2 ++ source/dnode/mnode/impl/src/mndDnode.c | 3 +++ source/dnode/mnode/impl/src/mndMnode.c | 3 +++ 3 files changed, 8 insertions(+) diff --git a/source/common/src/systable.c b/source/common/src/systable.c index 6198f923f4..4aa47a3819 100644 --- a/source/common/src/systable.c +++ b/source/common/src/systable.c @@ -33,6 +33,7 @@ static const SSysDbTableSchema dnodesSchema[] = { {.name = "support_vnodes", .bytes = 2, .type = TSDB_DATA_TYPE_SMALLINT, .sysInfo = true}, {.name = "status", .bytes = 10 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true}, {.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP, .sysInfo = true}, + {.name = "reboot_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP, .sysInfo = true}, {.name = "note", .bytes = 256 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true}, }; @@ -42,6 +43,7 @@ static const SSysDbTableSchema mnodesSchema[] = { {.name = "role", .bytes = 12 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true}, {.name = "status", .bytes = 9 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true}, {.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP, .sysInfo = true}, + {.name = "reboot_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP, .sysInfo = true}, }; static const SSysDbTableSchema modulesSchema[] = { diff --git a/source/dnode/mnode/impl/src/mndDnode.c b/source/dnode/mnode/impl/src/mndDnode.c index 5dd1742e5e..1d9db37a7d 100644 --- a/source/dnode/mnode/impl/src/mndDnode.c +++ b/source/dnode/mnode/impl/src/mndDnode.c @@ -1074,6 +1074,9 @@ static int32_t mndRetrieveDnodes(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pB pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); colDataSetVal(pColInfo, numOfRows, (const char *)&pDnode->createdTime, false); + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataSetVal(pColInfo, numOfRows, (const char *)&pDnode->rebootTime, false); + char *b = taosMemoryCalloc(VARSTR_HEADER_SIZE + strlen(offlineReason[pDnode->offlineReason]) + 1, 1); STR_TO_VARSTR(b, online ? "" : offlineReason[pDnode->offlineReason]); diff --git a/source/dnode/mnode/impl/src/mndMnode.c b/source/dnode/mnode/impl/src/mndMnode.c index aada00296e..50fab447e3 100644 --- a/source/dnode/mnode/impl/src/mndMnode.c +++ b/source/dnode/mnode/impl/src/mndMnode.c @@ -644,6 +644,9 @@ static int32_t mndRetrieveMnodes(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pB pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); colDataSetVal(pColInfo, numOfRows, (const char *)&pObj->createdTime, false); + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataSetVal(pColInfo, numOfRows, (const char *)&pObj->stateStartTime, false); + numOfRows++; sdbRelease(pSdb, pObj); } From 163224f4e2fb0053bf0d6a3eb78b6cd66adcf787 Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Tue, 7 Mar 2023 19:42:05 +0800 Subject: [PATCH 141/174] fix: taosd crash when modify the schema and query last_row --- source/dnode/vnode/src/tsdb/tsdbCache.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/source/dnode/vnode/src/tsdb/tsdbCache.c b/source/dnode/vnode/src/tsdb/tsdbCache.c index 3e34c3b048..c92967f7f4 100644 --- a/source/dnode/vnode/src/tsdb/tsdbCache.c +++ b/source/dnode/vnode/src/tsdb/tsdbCache.c @@ -1305,6 +1305,7 @@ static int32_t mergeLastRow(tb_uid_t uid, STsdb *pTsdb, bool *dup, SArray **ppCo int16_t iCol = 0; int16_t noneCol = 0; bool setNoneCol = false; + bool hasRow = false; SArray *pColArray = NULL; SColVal *pColVal = &(SColVal){0}; @@ -1327,6 +1328,8 @@ static int32_t mergeLastRow(tb_uid_t uid, STsdb *pTsdb, bool *dup, SArray **ppCo break; } + hasRow = true; + code = updateTSchema(TSDBROW_SVERSION(pRow), pr, uid); if (TSDB_CODE_SUCCESS != code) { goto _err; @@ -1418,6 +1421,9 @@ static int32_t mergeLastRow(tb_uid_t uid, STsdb *pTsdb, bool *dup, SArray **ppCo //*ppColArray = NULL; // taosArrayDestroy(pColArray); //} else { + if (!hasRow) { + taosArrayClear(pColArray); + } *ppColArray = pColArray; //} From de2fa190293a059c160574a8d51c5bf47e5c4d5c Mon Sep 17 00:00:00 2001 From: xleili Date: Tue, 7 Mar 2023 20:17:01 +0800 Subject: [PATCH 142/174] release: update version in main --- cmake/cmake.version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/cmake.version b/cmake/cmake.version index d0d455c73d..d38ac40b90 100644 --- a/cmake/cmake.version +++ b/cmake/cmake.version @@ -2,7 +2,7 @@ IF (DEFINED VERNUMBER) SET(TD_VER_NUMBER ${VERNUMBER}) ELSE () - SET(TD_VER_NUMBER "3.0.2.6") + SET(TD_VER_NUMBER "3.0.3.0") ENDIF () IF (DEFINED VERCOMPATIBLE) From b876f2d44765f30703be1d5a90b11d3308b10881 Mon Sep 17 00:00:00 2001 From: haoranchen Date: Tue, 7 Mar 2023 20:34:04 +0800 Subject: [PATCH 143/174] test:comment testcase of tmq (#20308) --- tests/parallel_test/cases.task | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/parallel_test/cases.task b/tests/parallel_test/cases.task index 0945c4a7f7..9fbc2155ad 100644 --- a/tests/parallel_test/cases.task +++ b/tests/parallel_test/cases.task @@ -733,7 +733,7 @@ ,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqConsFromTsdb-mutilVg-mutilCtb.py ,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqConsFromTsdb1-1ctb-funcNFilter.py ,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqConsFromTsdb1-mutilVg-mutilCtb-funcNFilter.py -,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqConsFromTsdb1-mutilVg-mutilCtb.py +#,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqConsFromTsdb1-mutilVg-mutilCtb.py ,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqAutoCreateTbl.py ,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqDnodeRestart.py ,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqDnodeRestart1.py From 89281ee488c01e64c1010260d6566406d966691a Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Tue, 7 Mar 2023 21:46:34 +0800 Subject: [PATCH 144/174] compact with time range --- include/common/tmsg.h | 7 ++++--- source/common/src/tmsg.c | 17 ++++++++++++++++- source/dnode/mnode/impl/inc/mndVgroup.h | 3 ++- source/dnode/mnode/impl/src/mndVgroup.c | 16 +++++++++------- source/dnode/vnode/src/inc/vnodeInt.h | 9 ++++----- 5 files changed, 35 insertions(+), 17 deletions(-) diff --git a/include/common/tmsg.h b/include/common/tmsg.h index 308246df64..eb283d6534 100644 --- a/include/common/tmsg.h +++ b/include/common/tmsg.h @@ -1291,9 +1291,10 @@ int32_t tSerializeSDropIdxReq(void* buf, int32_t bufLen, SDropIndexReq* pReq); int32_t tDeserializeSDropIdxReq(void* buf, int32_t bufLen, SDropIndexReq* pReq); typedef struct { - int64_t dbUid; - char db[TSDB_DB_FNAME_LEN]; - int64_t compactStartTime; + int64_t dbUid; + char db[TSDB_DB_FNAME_LEN]; + int64_t compactStartTime; + STimeWindow tw; } SCompactVnodeReq; int32_t tSerializeSCompactVnodeReq(void* buf, int32_t bufLen, SCompactVnodeReq* pReq); diff --git a/source/common/src/tmsg.c b/source/common/src/tmsg.c index 5018a517e1..3a9dfa677c 100644 --- a/source/common/src/tmsg.c +++ b/source/common/src/tmsg.c @@ -4108,6 +4108,11 @@ int32_t tSerializeSCompactVnodeReq(void *buf, int32_t bufLen, SCompactVnodeReq * if (tEncodeI64(&encoder, pReq->dbUid) < 0) return -1; if (tEncodeCStr(&encoder, pReq->db) < 0) return -1; if (tEncodeI64(&encoder, pReq->compactStartTime) < 0) return -1; + + // 1.1 add tw.skey and tw.ekey + if (tEncodeI64(&encoder, pReq->tw.skey) < 0) return -1; + if (tEncodeI64(&encoder, pReq->tw.ekey) < 0) return -1; + tEndEncode(&encoder); int32_t tlen = encoder.pos; @@ -4120,11 +4125,21 @@ int32_t tDeserializeSCompactVnodeReq(void *buf, int32_t bufLen, SCompactVnodeReq tDecoderInit(&decoder, buf, bufLen); if (tStartDecode(&decoder) < 0) return -1; + if (tDecodeI64(&decoder, &pReq->dbUid) < 0) return -1; if (tDecodeCStrTo(&decoder, pReq->db) < 0) return -1; if (tDecodeI64(&decoder, &pReq->compactStartTime) < 0) return -1; - tEndDecode(&decoder); + // 1.1 + if (tDecodeIsEnd(&decoder)) { + pReq->tw.skey = TSKEY_MIN; + pReq->tw.ekey = TSKEY_MAX; + } else { + if (tDecodeI64(&decoder, &pReq->tw.skey) < 0) return -1; + if (tDecodeI64(&decoder, &pReq->tw.ekey) < 0) return -1; + } + + tEndDecode(&decoder); tDecoderClear(&decoder); return 0; } diff --git a/source/dnode/mnode/impl/inc/mndVgroup.h b/source/dnode/mnode/impl/inc/mndVgroup.h index 51eb24f402..0229735952 100644 --- a/source/dnode/mnode/impl/inc/mndVgroup.h +++ b/source/dnode/mnode/impl/inc/mndVgroup.h @@ -43,7 +43,8 @@ int32_t mndAddDropVnodeAction(SMnode *, STrans *pTrans, SDbObj *pDb, SVgObj *pVg int32_t mndSetMoveVgroupsInfoToTrans(SMnode *, STrans *pTrans, int32_t dropDnodeId, bool force); int32_t mndBuildAlterVgroupAction(SMnode *pMnode, STrans *pTrans, SDbObj *pOldDb, SDbObj *pNewDb, SVgObj *pVgroup, SArray *pArray); -int32_t mndBuildCompactVgroupAction(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, SVgObj *pVgroup, int64_t compactTs); +int32_t mndBuildCompactVgroupAction(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, SVgObj *pVgroup, int64_t compactTs, + STimeWindow tw); void *mndBuildCreateVnodeReq(SMnode *, SDnodeObj *pDnode, SDbObj *pDb, SVgObj *pVgroup, int32_t *pContLen); void *mndBuildDropVnodeReq(SMnode *, SDnodeObj *pDnode, SDbObj *pDb, SVgObj *pVgroup, int32_t *pContLen); diff --git a/source/dnode/mnode/impl/src/mndVgroup.c b/source/dnode/mnode/impl/src/mndVgroup.c index b7bcaf41fd..b5d9353b68 100644 --- a/source/dnode/mnode/impl/src/mndVgroup.c +++ b/source/dnode/mnode/impl/src/mndVgroup.c @@ -2209,11 +2209,12 @@ _OVER: bool mndVgroupInDb(SVgObj *pVgroup, int64_t dbUid) { return !pVgroup->isTsma && pVgroup->dbUid == dbUid; } -static void *mndBuildCompactVnodeReq(SMnode *pMnode, SDbObj *pDb, SVgObj *pVgroup, int32_t *pContLen, - int64_t compactTs) { +static void *mndBuildCompactVnodeReq(SMnode *pMnode, SDbObj *pDb, SVgObj *pVgroup, int32_t *pContLen, int64_t compactTs, + STimeWindow tw) { SCompactVnodeReq compactReq = {0}; compactReq.dbUid = pDb->uid; compactReq.compactStartTime = compactTs; + compactReq.tw = tw; tstrncpy(compactReq.db, pDb->name, TSDB_DB_FNAME_LEN); mInfo("vgId:%d, build compact vnode config req", pVgroup->vgId); @@ -2239,13 +2240,13 @@ static void *mndBuildCompactVnodeReq(SMnode *pMnode, SDbObj *pDb, SVgObj *pVgrou return pReq; } -static int32_t mndAddCompactVnodeAction(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, SVgObj *pVgroup, - int64_t compactTs) { +static int32_t mndAddCompactVnodeAction(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, SVgObj *pVgroup, int64_t compactTs, + STimeWindow tw) { STransAction action = {0}; action.epSet = mndGetVgroupEpset(pMnode, pVgroup); int32_t contLen = 0; - void *pReq = mndBuildCompactVnodeReq(pMnode, pDb, pVgroup, &contLen, compactTs); + void *pReq = mndBuildCompactVnodeReq(pMnode, pDb, pVgroup, &contLen, compactTs, tw); if (pReq == NULL) return -1; action.pCont = pReq; @@ -2260,7 +2261,8 @@ static int32_t mndAddCompactVnodeAction(SMnode *pMnode, STrans *pTrans, SDbObj * return 0; } -int32_t mndBuildCompactVgroupAction(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, SVgObj *pVgroup, int64_t compactTs) { - if (mndAddCompactVnodeAction(pMnode, pTrans, pDb, pVgroup, compactTs) != 0) return -1; +int32_t mndBuildCompactVgroupAction(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, SVgObj *pVgroup, int64_t compactTs, + STimeWindow tw) { + if (mndAddCompactVnodeAction(pMnode, pTrans, pDb, pVgroup, compactTs, tw) != 0) return -1; return 0; } \ No newline at end of file diff --git a/source/dnode/vnode/src/inc/vnodeInt.h b/source/dnode/vnode/src/inc/vnodeInt.h index ca61a4dfce..0dff2420ec 100644 --- a/source/dnode/vnode/src/inc/vnodeInt.h +++ b/source/dnode/vnode/src/inc/vnodeInt.h @@ -457,11 +457,10 @@ struct SCommitInfo { }; struct SCompactInfo { - SVnode* pVnode; - int32_t flag; - int64_t commitID; - int64_t stime; - int64_t etime; + SVnode* pVnode; + int32_t flag; + int64_t commitID; + STimeWindow tw; }; #ifdef __cplusplus From f0e23812a168333f12fb46df3c0853955912be55 Mon Sep 17 00:00:00 2001 From: cadem Date: Wed, 8 Mar 2023 09:57:07 +0800 Subject: [PATCH 145/174] fix offline_reason.sim --- tests/script/tsim/dnode/offline_reason.sim | 48 +++++++++++----------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/tests/script/tsim/dnode/offline_reason.sim b/tests/script/tsim/dnode/offline_reason.sim index 6b1686dbb4..8c4d8b47f7 100644 --- a/tests/script/tsim/dnode/offline_reason.sim +++ b/tests/script/tsim/dnode/offline_reason.sim @@ -8,10 +8,10 @@ sql connect sql create dnode $hostname port 7200 sql select * from information_schema.ins_dnodes -print dnode1 off: $data(1)[6] -print dnode2 off: $data(2)[6] +print dnode1 off: $data(1)[7] +print dnode2 off: $data(2)[7] -if $data(2)[6] != @status not received@ then +if $data(2)[7] != @status not received@ then return -1 endi @@ -50,9 +50,9 @@ step3: return -1 endi sql select * from information_schema.ins_dnodes -print dnode1 off: $data(1)[6] -print dnode2 off: $data(2)[6] -if $data(2)[6] != @status msg timeout@ then +print dnode1 off: $data(1)[7] +print dnode2 off: $data(2)[7] +if $data(2)[7] != @status msg timeout@ then goto step3 endi @@ -77,9 +77,9 @@ step5: endi sql select * from information_schema.ins_dnodes -print dnode1 off: $data(1)[6] -print dnode2 off: $data(3)[6] -if $data(3)[6] != @dnodeId not match@ then +print dnode1 off: $data(1)[7] +print dnode2 off: $data(3)[7] +if $data(3)[7] != @dnodeId not match@ then goto step5 endi @@ -98,10 +98,10 @@ step6: endi sql select * from information_schema.ins_dnodes -print dnode1 off: $data(1)[6] -print dnode2 off: $data(3)[6] -print dnode3 off: $data(4)[6] -if $data(4)[6] != @interval not match@ then +print dnode1 off: $data(1)[7] +print dnode2 off: $data(3)[7] +print dnode3 off: $data(4)[67 +if $data(4)[7] != @interval not match@ then goto step6 endi @@ -120,11 +120,11 @@ step7: endi sql select * from information_schema.ins_dnodes -print dnode1 off: $data(1)[6] -print dnode3 off: $data(3)[6] -print dnode4 off: $data(4)[6] -print dnode5 off: $data(5)[6] -if $data(5)[6] != @locale not match@ then +print dnode1 off: $data(1)[7] +print dnode3 off: $data(3)[7] +print dnode4 off: $data(4)[7] +print dnode5 off: $data(5)[7] +if $data(5)[7] != @locale not match@ then goto step7 endi @@ -143,12 +143,12 @@ step8: endi sql select * from information_schema.ins_dnodes -print dnode1 off: $data(1)[6] -print dnode3 off: $data(3)[6] -print dnode4 off: $data(4)[6] -print dnode5 off: $data(5)[6] -print dnode6 off: $data(6)[6] -if $data(6)[6] != @charset not match@ then +print dnode1 off: $data(1)[7] +print dnode3 off: $data(3)[7] +print dnode4 off: $data(4)[7] +print dnode5 off: $data(5)[7] +print dnode6 off: $data(6)[7] +if $data(6)[7] != @charset not match@ then goto step8 endi From 0dc34018b691719b4a8f4bf0f8b88aff8d331025 Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Wed, 8 Mar 2023 10:06:48 +0800 Subject: [PATCH 146/174] fix: insert data crash after empty table last cache --- source/dnode/vnode/src/tsdb/tsdbCache.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/source/dnode/vnode/src/tsdb/tsdbCache.c b/source/dnode/vnode/src/tsdb/tsdbCache.c index c92967f7f4..dcf7286c00 100644 --- a/source/dnode/vnode/src/tsdb/tsdbCache.c +++ b/source/dnode/vnode/src/tsdb/tsdbCache.c @@ -375,9 +375,6 @@ int32_t tsdbCacheInsertLast(SLRUCache *pCache, tb_uid_t uid, TSDBROW *row, STsdb SLastCol lastCol = {.ts = keyTs, .colVal = colVal}; if (IS_VAR_DATA_TYPE(colVal.type) && colVal.value.nData > 0) { - SLastCol *pLastCol = (SLastCol *)taosArrayGet(pLast, iCol); - taosMemoryFree(pLastCol->colVal.value.pData); - lastCol.colVal.value.pData = taosMemoryMalloc(colVal.value.nData); if (lastCol.colVal.value.pData == NULL) { terrno = TSDB_CODE_OUT_OF_MEMORY; From 839758f2d6785409ec1a0daf239255d3a47cbafc Mon Sep 17 00:00:00 2001 From: cademfly Date: Wed, 8 Mar 2023 10:26:28 +0800 Subject: [PATCH 147/174] fix odbc.py total columns numbers --- tests/system-test/2-query/odbc.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/system-test/2-query/odbc.py b/tests/system-test/2-query/odbc.py index 2325b01c35..832734d4a8 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, 269) + tdSql.checkData(0, 0, 271) tdSql.query("select * from information_schema.ins_columns where table_name = 'ntb'") tdSql.checkRows(14) From a03d9778a61ae193e88bbb8c6ff3d3b431853df1 Mon Sep 17 00:00:00 2001 From: kailixu Date: Wed, 8 Mar 2023 11:03:29 +0800 Subject: [PATCH 148/174] fix: update tfs storage size every 1 second by default --- source/dnode/mgmt/mgmt_vnode/src/vmHandle.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c b/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c index 5cf408a905..d7f91b74a8 100644 --- a/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c +++ b/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c @@ -20,6 +20,8 @@ void vmGetVnodeLoads(SVnodeMgmt *pMgmt, SMonVloadInfo *pInfo, bool isReset) { pInfo->pVloads = taosArrayInit(pMgmt->state.totalVnodes, sizeof(SVnodeLoad)); if (pInfo->pVloads == NULL) return; + tfsUpdateSize(pMgmt->pTfs); + taosThreadRwlockRdlock(&pMgmt->lock); void *pIter = taosHashIterate(pMgmt->hash, NULL); From 4a682ebe7ba2e78c74ebf09d4f6d54131d87d8bf Mon Sep 17 00:00:00 2001 From: Shuduo Sang Date: Wed, 8 Mar 2023 14:04:20 +0800 Subject: [PATCH 149/174] feat: taosbenchmark support sample data per child table (#20317) --- cmake/taostools_CMakeLists.txt.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/taostools_CMakeLists.txt.in b/cmake/taostools_CMakeLists.txt.in index aecb8a1750..5fe8f6ea13 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 0111c66 + GIT_TAG d4b3967 SOURCE_DIR "${TD_SOURCE_DIR}/tools/taos-tools" BINARY_DIR "" #BUILD_IN_SOURCE TRUE From 6dcb9c7f0f4908c3980fe02098190db3b377a46c Mon Sep 17 00:00:00 2001 From: cademfly Date: Wed, 8 Mar 2023 14:04:33 +0800 Subject: [PATCH 150/174] trigger ci --- tests/system-test/2-query/odbc.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/system-test/2-query/odbc.py b/tests/system-test/2-query/odbc.py index 832734d4a8..f26f0abda0 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, 271) + tdSql.checkData(0, 0, 271) tdSql.query("select * from information_schema.ins_columns where table_name = 'ntb'") tdSql.checkRows(14) From 8ca7b91520d8ffb96a6c31f11c68e3abc9a23803 Mon Sep 17 00:00:00 2001 From: t_max <1172915550@qq.com> Date: Wed, 8 Mar 2023 14:31:27 +0800 Subject: [PATCH 151/174] fix(taosAdapter): remove influxdb affected rows check --- cmake/taosadapter_CMakeLists.txt.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/taosadapter_CMakeLists.txt.in b/cmake/taosadapter_CMakeLists.txt.in index 357a79715a..1c401ae80e 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 97d717d + GIT_TAG d8059ff SOURCE_DIR "${TD_SOURCE_DIR}/tools/taosadapter" BINARY_DIR "" #BUILD_IN_SOURCE TRUE From c408a434d6a9c90ee3b9eb1aa3e82eb784884d58 Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Wed, 8 Mar 2023 14:31:38 +0800 Subject: [PATCH 152/174] fix tbname in error --- source/libs/executor/src/executil.c | 2 -- tests/script/tsim/tag/tbNameIn.sim | 10 ++++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/source/libs/executor/src/executil.c b/source/libs/executor/src/executil.c index 9537751ff0..0ac458af49 100644 --- a/source/libs/executor/src/executil.c +++ b/source/libs/executor/src/executil.c @@ -957,9 +957,7 @@ static int32_t doFilterByTagCond(STableListInfo* pListInfo, SArray* pUidList, SN STUidTagInfo* pInfo = taosArrayGet(pUidTagList, i); taosArrayPush(pUidList, &pInfo->uid); } - terrno = 0; - goto end; } else { if ((condType == FILTER_NO_LOGIC || condType == FILTER_AND) && status != SFLT_NOT_INDEX) { code = metaGetTableTagsByUids(metaHandle, pListInfo->suid, pUidTagList); diff --git a/tests/script/tsim/tag/tbNameIn.sim b/tests/script/tsim/tag/tbNameIn.sim index 1af4bd6a9e..f5119208ba 100644 --- a/tests/script/tsim/tag/tbNameIn.sim +++ b/tests/script/tsim/tag/tbNameIn.sim @@ -99,4 +99,14 @@ if $rows != 7 then return -1 endi +sql select * from st1 where tbname in('tb1') and tbname in ('tb2'); +if $rows != 0 then + return -1 +endi + +sql select * from st1 where tbname in ('tb1') and tbname != 'tb1'; +if $rows != 0 then + return -1 +endi + system sh/exec.sh -n dnode1 -s stop -x SIGINT From a56c99daac1976b9276593c3dfc54e22e41280f4 Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Wed, 8 Mar 2023 14:45:04 +0800 Subject: [PATCH 153/174] fix: add more msg check --- source/dnode/vnode/src/vnd/vnodeSvr.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/source/dnode/vnode/src/vnd/vnodeSvr.c b/source/dnode/vnode/src/vnd/vnodeSvr.c index 2b275f5122..fc40f81ed5 100644 --- a/source/dnode/vnode/src/vnd/vnodeSvr.c +++ b/source/dnode/vnode/src/vnd/vnodeSvr.c @@ -211,6 +211,11 @@ static int32_t vnodePreProcessSubmitMsg(SVnode *pVnode, SRpcMsg *pMsg) { SDecoder *pCoder = &(SDecoder){0}; + if (((SSubmitReq2Msg *)pMsg->pCont)->version != 1) { + code = TSDB_CODE_INVALID_MSG; + TSDB_CHECK_CODE(code, lino, _exit); + } + tDecoderInit(pCoder, (uint8_t *)pMsg->pCont + sizeof(SSubmitReq2Msg), pMsg->contLen - sizeof(SSubmitReq2Msg)); if (tStartDecode(pCoder) < 0) { @@ -1218,6 +1223,11 @@ static int32_t vnodeProcessSubmitReq(SVnode *pVnode, int64_t version, void *pReq for (int32_t i = 0; i < TARRAY_SIZE(pSubmitReq->aSubmitTbData); ++i) { SSubmitTbData *pSubmitTbData = taosArrayGet(pSubmitReq->aSubmitTbData, i); + if (pSubmitTbData->pCreateTbReq && pSubmitTbData->pCreateTbReq->uid == 0) { + code = TSDB_CODE_INVALID_MSG; + goto _exit; + } + if (pSubmitTbData->flags & SUBMIT_REQ_COLUMN_DATA_FORMAT) { if (TARRAY_SIZE(pSubmitTbData->aCol) <= 0) { code = TSDB_CODE_INVALID_MSG; From 9be3e2027625ece6cfc10419e23898a8ed019265 Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Wed, 8 Mar 2023 15:13:11 +0800 Subject: [PATCH 154/174] fix: check the compatibility of client version and server version --- include/common/tmsg.h | 1 + include/util/tversion.h | 8 +++-- source/client/src/clientImpl.c | 1 + source/client/src/clientMsgHandler.c | 43 ++++++++++++++---------- source/common/src/tmsg.c | 7 ++++ source/dnode/mnode/impl/src/mndProfile.c | 11 ++++-- source/util/src/tversion.c | 17 ++++++++++ 7 files changed, 65 insertions(+), 23 deletions(-) diff --git a/include/common/tmsg.h b/include/common/tmsg.h index 308246df64..75240cef4f 100644 --- a/include/common/tmsg.h +++ b/include/common/tmsg.h @@ -612,6 +612,7 @@ typedef struct { char user[TSDB_USER_LEN]; char passwd[TSDB_PASSWORD_LEN]; int64_t startTime; + char sVer[TSDB_VERSION_LEN]; } SConnectReq; int32_t tSerializeSConnectReq(void* buf, int32_t bufLen, SConnectReq* pReq); diff --git a/include/util/tversion.h b/include/util/tversion.h index c924752a01..f5c42b2a22 100644 --- a/include/util/tversion.h +++ b/include/util/tversion.h @@ -13,8 +13,8 @@ * along with this program. If not, see . */ -#ifndef _TD_UTIL_VERSION_H_ -#define _TD_UTIL_VERSION_H_ +#ifndef _TD_UTIL_TVERSION_H_ +#define _TD_UTIL_TVERSION_H_ #include "os.h" @@ -25,9 +25,11 @@ extern "C" { int32_t taosVersionStrToInt(const char *vstr, int32_t *vint); int32_t taosVersionIntToStr(int32_t vint, char *vstr, int32_t len); int32_t taosCheckVersionCompatible(int32_t clientVer, int32_t serverVer, int32_t comparedSegments); +int32_t taosCheckVersionCompatibleFromStr(const char *pClientVersion, const char *pServerVersion, + int32_t comparedSegments); #ifdef __cplusplus } #endif -#endif /*_TD_UTIL_VERSION_H_*/ +#endif /*_TD_UTIL_TVERSION_H_*/ diff --git a/source/client/src/clientImpl.c b/source/client/src/clientImpl.c index 7bdbc3dc56..70185a1395 100644 --- a/source/client/src/clientImpl.c +++ b/source/client/src/clientImpl.c @@ -1307,6 +1307,7 @@ static SMsgSendInfo* buildConnectMsg(SRequestObj* pRequest) { tstrncpy(connectReq.app, appInfo.appName, sizeof(connectReq.app)); tstrncpy(connectReq.user, pObj->user, sizeof(connectReq.user)); tstrncpy(connectReq.passwd, pObj->pass, sizeof(connectReq.passwd)); + tstrncpy(connectReq.sVer, version, sizeof(connectReq.sVer)); int32_t contLen = tSerializeSConnectReq(NULL, 0, &connectReq); void* pReq = taosMemoryMalloc(contLen); diff --git a/source/client/src/clientMsgHandler.c b/source/client/src/clientMsgHandler.c index a5f963a956..be1b6b07a3 100644 --- a/source/client/src/clientMsgHandler.c +++ b/source/client/src/clientMsgHandler.c @@ -18,10 +18,12 @@ #include "clientLog.h" #include "os.h" #include "query.h" -#include "tdef.h" -#include "tname.h" -#include "tdatablock.h" #include "systable.h" +#include "tdatablock.h" +#include "tdef.h" +#include "tglobal.h" +#include "tname.h" +#include "tversion.h" static void setErrno(SRequestObj* pRequest, int32_t code) { pRequest->code = code; @@ -47,11 +49,11 @@ int32_t genericRspCallback(void* param, SDataBuf* pMsg, int32_t code) { } int32_t processConnectRsp(void* param, SDataBuf* pMsg, int32_t code) { - SRequestObj *pRequest = acquireRequest(*(int64_t*)param); + SRequestObj* pRequest = acquireRequest(*(int64_t*)param); if (NULL == pRequest) { goto End; } - + if (code != TSDB_CODE_SUCCESS) { setErrno(pRequest, code); tsem_post(&pRequest->body.rspSem); @@ -65,7 +67,7 @@ int32_t processConnectRsp(void* param, SDataBuf* pMsg, int32_t code) { tsem_post(&pRequest->body.rspSem); goto End; } - + SConnectRsp connectRsp = {0}; if (tDeserializeSConnectRsp(pMsg->pData, pMsg->len, &connectRsp) != 0) { code = TSDB_CODE_TSC_INVALID_VERSION; @@ -74,6 +76,12 @@ int32_t processConnectRsp(void* param, SDataBuf* pMsg, int32_t code) { goto End; } + if ((code = taosCheckVersionCompatibleFromStr(version, connectRsp.sVer, 2)) != 0) { + setErrno(pRequest, code); + tsem_post(&pRequest->body.rspSem); + goto End; + } + int32_t now = taosGetTimestampSec(); int32_t delta = abs(now - connectRsp.svrTimestamp); if (delta > timestampDeltaLimit) { @@ -127,14 +135,14 @@ int32_t processConnectRsp(void* param, SDataBuf* pMsg, int32_t code) { tscDebug("0x%" PRIx64 " clusterId:%" PRId64 ", totalConn:%" PRId64, pRequest->requestId, connectRsp.clusterId, pTscObj->pAppInfo->numOfConns); - + tsem_post(&pRequest->body.rspSem); End: if (pRequest) { releaseRequest(pRequest->self); } - + taosMemoryFree(param); taosMemoryFree(pMsg->pEpSet); taosMemoryFree(pMsg->pData); @@ -166,18 +174,18 @@ int32_t processCreateDbRsp(void* param, SDataBuf* pMsg, int32_t code) { struct SCatalog* pCatalog = NULL; int32_t code = catalogGetHandle(pRequest->pTscObj->pAppInfo->clusterId, &pCatalog); if (TSDB_CODE_SUCCESS == code) { - STscObj* pTscObj = pRequest->pTscObj; + STscObj* pTscObj = pRequest->pTscObj; SRequestConnInfo conn = {.pTrans = pTscObj->pAppInfo->pTransporter, .requestId = pRequest->requestId, .requestObjRefId = pRequest->self, .mgmtEps = getEpSet_s(&pTscObj->pAppInfo->mgmtEp)}; - char dbFName[TSDB_DB_FNAME_LEN]; + char dbFName[TSDB_DB_FNAME_LEN]; snprintf(dbFName, sizeof(dbFName) - 1, "%d.%s", pTscObj->acctId, TSDB_INFORMATION_SCHEMA_DB); catalogRefreshDBVgInfo(pCatalog, &conn, dbFName); snprintf(dbFName, sizeof(dbFName) - 1, "%d.%s", pTscObj->acctId, TSDB_PERFORMANCE_SCHEMA_DB); catalogRefreshDBVgInfo(pCatalog, &conn, dbFName); - } + } } if (pRequest->body.queryFp) { @@ -197,7 +205,7 @@ int32_t processUseDbRsp(void* param, SDataBuf* pMsg, int32_t code) { tDeserializeSUseDbRsp(pMsg->pData, pMsg->len, &usedbRsp); struct SCatalog* pCatalog = NULL; - if (usedbRsp.vgVersion >= 0) { // cached in local + if (usedbRsp.vgVersion >= 0) { // cached in local uint64_t clusterId = pRequest->pTscObj->pAppInfo->clusterId; int32_t code1 = catalogGetHandle(clusterId, &pCatalog); if (code1 != TSDB_CODE_SUCCESS) { @@ -289,7 +297,7 @@ int32_t processUseDbRsp(void* param, SDataBuf* pMsg, int32_t code) { } int32_t processCreateSTableRsp(void* param, SDataBuf* pMsg, int32_t code) { - if(pMsg == NULL || param == NULL){ + if (pMsg == NULL || param == NULL) { return TSDB_CODE_TSC_INVALID_INPUT; } SRequestObj* pRequest = param; @@ -344,13 +352,13 @@ int32_t processDropDbRsp(void* param, SDataBuf* pMsg, int32_t code) { int32_t code = catalogGetHandle(pRequest->pTscObj->pAppInfo->clusterId, &pCatalog); if (TSDB_CODE_SUCCESS == code) { catalogRemoveDB(pCatalog, dropdbRsp.db, dropdbRsp.uid); - STscObj* pTscObj = pRequest->pTscObj; + STscObj* pTscObj = pRequest->pTscObj; SRequestConnInfo conn = {.pTrans = pTscObj->pAppInfo->pTransporter, .requestId = pRequest->requestId, .requestObjRefId = pRequest->self, .mgmtEps = getEpSet_s(&pTscObj->pAppInfo->mgmtEp)}; - char dbFName[TSDB_DB_FNAME_LEN]; + char dbFName[TSDB_DB_FNAME_LEN]; snprintf(dbFName, sizeof(dbFName) - 1, "%d.%s", pTscObj->acctId, TSDB_INFORMATION_SCHEMA_DB); catalogRefreshDBVgInfo(pCatalog, &conn, dbFName); snprintf(dbFName, sizeof(dbFName) - 1, "%d.%s", pTscObj->acctId, TSDB_PERFORMANCE_SCHEMA_DB); @@ -474,8 +482,9 @@ static int32_t buildShowVariablesRsp(SArray* pVars, SRetrieveTableRsp** pRsp) { int32_t len = blockEncode(pBlock, (*pRsp)->data, SHOW_VARIABLES_RESULT_COLS); blockDataDestroy(pBlock); - if(len != rspSize - sizeof(SRetrieveTableRsp)){ - uError("buildShowVariablesRsp error, len:%d != rspSize - sizeof(SRetrieveTableRsp):%" PRIu64, len, (uint64_t) (rspSize - sizeof(SRetrieveTableRsp))); + if (len != rspSize - sizeof(SRetrieveTableRsp)) { + uError("buildShowVariablesRsp error, len:%d != rspSize - sizeof(SRetrieveTableRsp):%" PRIu64, len, + (uint64_t)(rspSize - sizeof(SRetrieveTableRsp))); return TSDB_CODE_TSC_INVALID_INPUT; } diff --git a/source/common/src/tmsg.c b/source/common/src/tmsg.c index 5018a517e1..84a09f0fb5 100644 --- a/source/common/src/tmsg.c +++ b/source/common/src/tmsg.c @@ -3741,6 +3741,7 @@ int32_t tSerializeSConnectReq(void *buf, int32_t bufLen, SConnectReq *pReq) { if (tEncodeCStr(&encoder, pReq->user) < 0) return -1; if (tEncodeCStrWithLen(&encoder, pReq->passwd, TSDB_PASSWORD_LEN) < 0) return -1; if (tEncodeI64(&encoder, pReq->startTime) < 0) return -1; + if (tEncodeCStr(&encoder, pReq->sVer) < 0) return -1; tEndEncode(&encoder); int32_t tlen = encoder.pos; @@ -3760,6 +3761,12 @@ int32_t tDeserializeSConnectReq(void *buf, int32_t bufLen, SConnectReq *pReq) { if (tDecodeCStrTo(&decoder, pReq->user) < 0) return -1; if (tDecodeCStrTo(&decoder, pReq->passwd) < 0) return -1; if (tDecodeI64(&decoder, &pReq->startTime) < 0) return -1; + // Check the client version from version 3.0.3.0 + if (tDecodeIsEnd(&decoder)) { + tDecoderClear(&decoder); + return TSDB_CODE_VERSION_NOT_COMPATIBLE; + } + if (tDecodeCStrTo(&decoder, pReq->sVer) < 0) return -1; tEndDecode(&decoder); tDecoderClear(&decoder); diff --git a/source/dnode/mnode/impl/src/mndProfile.c b/source/dnode/mnode/impl/src/mndProfile.c index 41dc57f32e..0eb891fa1f 100644 --- a/source/dnode/mnode/impl/src/mndProfile.c +++ b/source/dnode/mnode/impl/src/mndProfile.c @@ -24,7 +24,7 @@ #include "mndStb.h" #include "mndUser.h" #include "tglobal.h" -#include "version.h" +#include "tversion.h" typedef struct { uint32_t id; @@ -221,8 +221,13 @@ static int32_t mndProcessConnectReq(SRpcMsg *pReq) { char ip[24] = {0}; const STraceId *trace = &pReq->info.traceId; - if (tDeserializeSConnectReq(pReq->pCont, pReq->contLen, &connReq) != 0) { - terrno = TSDB_CODE_INVALID_MSG; + if ((code = tDeserializeSConnectReq(pReq->pCont, pReq->contLen, &connReq)) != 0) { + terrno = (-1 == code ? TSDB_CODE_INVALID_MSG : code); + goto _OVER; + } + + if ((code = taosCheckVersionCompatibleFromStr(connReq.sVer, version, 2)) != 0) { + terrno = code; goto _OVER; } diff --git a/source/util/src/tversion.c b/source/util/src/tversion.c index c70fdc87a6..dc357c61a1 100644 --- a/source/util/src/tversion.c +++ b/source/util/src/tversion.c @@ -89,3 +89,20 @@ int32_t taosCheckVersionCompatible(int32_t clientVer, int32_t serverVer, int32_t return -1; } } + +int32_t taosCheckVersionCompatibleFromStr(const char *pClientVersion, const char *pServerVersion, + int32_t comparedSegments) { + int32_t clientVersion = 0; + int32_t serverVersion = 0; + int32_t code = taosVersionStrToInt(pClientVersion, &clientVersion); + if (TSDB_CODE_SUCCESS == code) { + code = taosVersionStrToInt(pServerVersion, &serverVersion); + } + if (TSDB_CODE_SUCCESS == code) { + code = taosCheckVersionCompatible(clientVersion, serverVersion, comparedSegments); + } + if (TSDB_CODE_SUCCESS != code) { + code = terrno; + } + return code; +} \ No newline at end of file From 05688386a0901f4db0a43b008199320a6829aea0 Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Wed, 8 Mar 2023 15:19:55 +0800 Subject: [PATCH 155/174] little fix --- source/dnode/vnode/src/vnd/vnodeSvr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/dnode/vnode/src/vnd/vnodeSvr.c b/source/dnode/vnode/src/vnd/vnodeSvr.c index fc40f81ed5..fb8d230eba 100644 --- a/source/dnode/vnode/src/vnd/vnodeSvr.c +++ b/source/dnode/vnode/src/vnd/vnodeSvr.c @@ -211,7 +211,7 @@ static int32_t vnodePreProcessSubmitMsg(SVnode *pVnode, SRpcMsg *pMsg) { SDecoder *pCoder = &(SDecoder){0}; - if (((SSubmitReq2Msg *)pMsg->pCont)->version != 1) { + if (taosHton64(((SSubmitReq2Msg *)pMsg->pCont)->version) != 1) { code = TSDB_CODE_INVALID_MSG; TSDB_CHECK_CODE(code, lino, _exit); } From 38c9501396387dd8900c473d2b14f6aa0ca787b3 Mon Sep 17 00:00:00 2001 From: Adam Ji Date: Wed, 8 Mar 2023 15:49:19 +0800 Subject: [PATCH 156/174] docs: this line is inaccurate, in current connector-python repo, it require python >= 3.6.2 because there is a dependence iso8601 (#20331) --- docs/zh/08-connector/30-python.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/zh/08-connector/30-python.mdx b/docs/zh/08-connector/30-python.mdx index 1962df9607..b2f2118f39 100644 --- a/docs/zh/08-connector/30-python.mdx +++ b/docs/zh/08-connector/30-python.mdx @@ -32,7 +32,7 @@ Python 连接器的源码托管在 [GitHub](https://github.com/taosdata/taos-con ### 准备 -1. 安装 Python。新近版本 taospy 包要求 Python 3.6+。早期版本 taospy 包要求 Python 3.7+。taos-ws-py 包要求 Python 3.7+。如果系统上还没有 Python 可参考 [Python BeginnersGuide](https://wiki.python.org/moin/BeginnersGuide/Download) 安装。 +1. 安装 Python。新近版本 taospy 包要求 Python 3.6.2+。早期版本 taospy 包要求 Python 3.7+。taos-ws-py 包要求 Python 3.7+。如果系统上还没有 Python 可参考 [Python BeginnersGuide](https://wiki.python.org/moin/BeginnersGuide/Download) 安装。 2. 安装 [pip](https://pypi.org/project/pip/)。大部分情况下 Python 的安装包都自带了 pip 工具, 如果没有请参考 [pip documentation](https://pip.pypa.io/en/stable/installation/) 安装。 3. 如果使用原生连接,还需[安装客户端驱动](../#安装客户端驱动)。客户端软件包含了 TDengine 客户端动态链接库(libtaos.so 或 taos.dll) 和 TDengine CLI。 From 24d3d6cb2014b8062ab7641dc87cca1fb7143a1b Mon Sep 17 00:00:00 2001 From: Shuduo Sang Date: Wed, 8 Mar 2023 15:52:48 +0800 Subject: [PATCH 157/174] docs: this line is inaccurate, in current connector-python repo, it require python >= 3.6.2 because there is a dependence iso8601 (#20336) Co-authored-by: Adam Ji --- docs/zh/08-connector/30-python.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/zh/08-connector/30-python.mdx b/docs/zh/08-connector/30-python.mdx index 9c88402bb4..b57f02ac80 100644 --- a/docs/zh/08-connector/30-python.mdx +++ b/docs/zh/08-connector/30-python.mdx @@ -32,7 +32,7 @@ Python 连接器的源码托管在 [GitHub](https://github.com/taosdata/taos-con ### 准备 -1. 安装 Python。新近版本 taospy 包要求 Python 3.6+。早期版本 taospy 包要求 Python 3.7+。taos-ws-py 包要求 Python 3.7+。如果系统上还没有 Python 可参考 [Python BeginnersGuide](https://wiki.python.org/moin/BeginnersGuide/Download) 安装。 +1. 安装 Python。新近版本 taospy 包要求 Python 3.6.2+。早期版本 taospy 包要求 Python 3.7+。taos-ws-py 包要求 Python 3.7+。如果系统上还没有 Python 可参考 [Python BeginnersGuide](https://wiki.python.org/moin/BeginnersGuide/Download) 安装。 2. 安装 [pip](https://pypi.org/project/pip/)。大部分情况下 Python 的安装包都自带了 pip 工具, 如果没有请参考 [pip documentation](https://pip.pypa.io/en/stable/installation/) 安装。 3. 如果使用原生连接,还需[安装客户端驱动](../#安装客户端驱动)。客户端软件包含了 TDengine 客户端动态链接库(libtaos.so 或 taos.dll) 和 TDengine CLI。 From a01b611dfe0967940a278152d412ad2687d60141 Mon Sep 17 00:00:00 2001 From: Xuefeng Tan <1172915550@qq.com> Date: Wed, 8 Mar 2023 16:08:11 +0800 Subject: [PATCH 158/174] fix(taosAdapter): remove influxdb affected rows check (#20329) --- cmake/taosadapter_CMakeLists.txt.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/taosadapter_CMakeLists.txt.in b/cmake/taosadapter_CMakeLists.txt.in index 357a79715a..1c401ae80e 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 97d717d + GIT_TAG d8059ff SOURCE_DIR "${TD_SOURCE_DIR}/tools/taosadapter" BINARY_DIR "" #BUILD_IN_SOURCE TRUE From 3db2c59581e6e509b266b43a6fc70ab7a79b3ae3 Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Wed, 8 Mar 2023 16:10:11 +0800 Subject: [PATCH 159/174] fix: check the compatibility of client version and server version --- source/dnode/mnode/impl/test/profile/profile.cpp | 6 ++++-- source/dnode/mnode/impl/test/show/show.cpp | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/source/dnode/mnode/impl/test/profile/profile.cpp b/source/dnode/mnode/impl/test/profile/profile.cpp index 2ae113e051..6ab6d364cb 100644 --- a/source/dnode/mnode/impl/test/profile/profile.cpp +++ b/source/dnode/mnode/impl/test/profile/profile.cpp @@ -32,13 +32,14 @@ TEST_F(MndTestProfile, 01_ConnectMsg) { connectReq.pid = 1234; char passwd[] = "taosdata"; - char secretEncrypt[TSDB_PASSWORD_LEN] = {0}; + char secretEncrypt[TSDB_PASSWORD_LEN + 1] = {0}; taosEncryptPass_c((uint8_t*)passwd, strlen(passwd), secretEncrypt); strcpy(connectReq.app, "mnode_test_profile"); strcpy(connectReq.db, ""); strcpy(connectReq.user, "root"); strcpy(connectReq.passwd, secretEncrypt); + strcpy(connectReq.sVer, version); int32_t contLen = tSerializeSConnectReq(NULL, 0, &connectReq); void* pReq = rpcMallocCont(contLen); @@ -66,7 +67,7 @@ TEST_F(MndTestProfile, 01_ConnectMsg) { TEST_F(MndTestProfile, 02_ConnectMsg_InvalidDB) { char passwd[] = "taosdata"; - char secretEncrypt[TSDB_PASSWORD_LEN] = {0}; + char secretEncrypt[TSDB_PASSWORD_LEN + 1] = {0}; taosEncryptPass_c((uint8_t*)passwd, strlen(passwd), secretEncrypt); SConnectReq connectReq = {0}; @@ -75,6 +76,7 @@ TEST_F(MndTestProfile, 02_ConnectMsg_InvalidDB) { strcpy(connectReq.db, "invalid_db"); strcpy(connectReq.user, "root"); strcpy(connectReq.passwd, secretEncrypt); + strcpy(connectReq.sVer, version); int32_t contLen = tSerializeSConnectReq(NULL, 0, &connectReq); void* pReq = rpcMallocCont(contLen); diff --git a/source/dnode/mnode/impl/test/show/show.cpp b/source/dnode/mnode/impl/test/show/show.cpp index 0ccefa7ca2..2e67ffa946 100644 --- a/source/dnode/mnode/impl/test/show/show.cpp +++ b/source/dnode/mnode/impl/test/show/show.cpp @@ -55,7 +55,7 @@ TEST_F(MndTestShow, 02_ShowMsg_InvalidMsgStart) { TEST_F(MndTestShow, 03_ShowMsg_Conn) { char passwd[] = "taosdata"; - char secretEncrypt[TSDB_PASSWORD_LEN] = {0}; + char secretEncrypt[TSDB_PASSWORD_LEN + 1] = {0}; taosEncryptPass_c((uint8_t*)passwd, strlen(passwd), secretEncrypt); SConnectReq connectReq = {0}; @@ -64,6 +64,7 @@ TEST_F(MndTestShow, 03_ShowMsg_Conn) { strcpy(connectReq.db, ""); strcpy(connectReq.user, "root"); strcpy(connectReq.passwd, secretEncrypt); + strcpy(connectReq.sVer, version); int32_t contLen = tSerializeSConnectReq(NULL, 0, &connectReq); void* pReq = rpcMallocCont(contLen); From 5d80e71d9e52d79369cdd75b524e5522be7324a3 Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Wed, 8 Mar 2023 16:42:09 +0800 Subject: [PATCH 160/174] fix: check the compatibility of client version and server version --- source/dnode/mnode/impl/src/mndProfile.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source/dnode/mnode/impl/src/mndProfile.c b/source/dnode/mnode/impl/src/mndProfile.c index 0eb891fa1f..41dea50731 100644 --- a/source/dnode/mnode/impl/src/mndProfile.c +++ b/source/dnode/mnode/impl/src/mndProfile.c @@ -231,6 +231,8 @@ static int32_t mndProcessConnectReq(SRpcMsg *pReq) { goto _OVER; } + code = -1; + taosIp2String(pReq->info.conn.clientIp, ip); if (mndCheckOperPrivilege(pMnode, pReq->info.conn.user, MND_OPER_CONNECT) != 0) { mGError("user:%s, failed to login from %s since %s", pReq->info.conn.user, ip, terrstr()); From 957bf49f9a75373c984c62f2381682c8f97ef3a6 Mon Sep 17 00:00:00 2001 From: xinsheng Ren <285808407@qq.com> Date: Wed, 8 Mar 2023 18:42:38 +0800 Subject: [PATCH 161/174] enh: coverage (#20307) * enh: coverage * enh: coverage, atomic * fix: int to int8 error * enh: delete unused code --- source/os/src/osMath.c | 14 ---- source/os/src/osSleep.c | 3 + source/os/src/osString.c | 30 ++++---- source/os/test/CMakeLists.txt | 58 +++++++++++++++- source/os/test/osAtomicTests.cpp | 115 +++++++++++++++++++++++++++++++ source/os/test/osMathTests.cpp | 62 +++++++++++++++++ source/os/test/osSignalTests.cpp | 40 +++++++++++ source/os/test/osSleepTests.cpp | 63 +++++++++++++++++ source/os/test/osStringTests.cpp | 113 ++++++++++++++++++++++++++++++ source/os/test/osSystemTests.cpp | 41 +++++++++++ source/os/test/osThreadTests.cpp | 34 +++++++++ source/os/test/osTimeTests.cpp | 48 +++++++++++++ 12 files changed, 591 insertions(+), 30 deletions(-) create mode 100644 source/os/test/osAtomicTests.cpp create mode 100644 source/os/test/osMathTests.cpp create mode 100644 source/os/test/osSignalTests.cpp create mode 100644 source/os/test/osSleepTests.cpp create mode 100644 source/os/test/osStringTests.cpp create mode 100644 source/os/test/osSystemTests.cpp create mode 100644 source/os/test/osThreadTests.cpp create mode 100644 source/os/test/osTimeTests.cpp diff --git a/source/os/src/osMath.c b/source/os/src/osMath.c index b466f89a1d..1c7c825ce8 100644 --- a/source/os/src/osMath.c +++ b/source/os/src/osMath.c @@ -18,20 +18,6 @@ #include #include "talgo.h" -#ifdef WINDOWS -void swapStr(char* j, char* J, int width) { - int i; - char tmp; - for (i = 0; i < width; i++) { - tmp = *j; - *j = *J; - *J = tmp; - j++; - J++; - } -} -#endif - int32_t qsortHelper(const void* p1, const void* p2, const void* param) { __compar_fn_t comparFn = param; return comparFn(p1, p2); diff --git a/source/os/src/osSleep.c b/source/os/src/osSleep.c index a2373f952f..f6cc7d608d 100644 --- a/source/os/src/osSleep.c +++ b/source/os/src/osSleep.c @@ -22,6 +22,7 @@ #endif void taosSsleep(int32_t s) { + if (s < 0) return; #ifdef WINDOWS Sleep(1000 * s); #else @@ -30,6 +31,7 @@ void taosSsleep(int32_t s) { } void taosMsleep(int32_t ms) { + if (ms < 0) return; #ifdef WINDOWS Sleep(ms); #else @@ -38,6 +40,7 @@ void taosMsleep(int32_t ms) { } void taosUsleep(int32_t us) { + if (us < 0) return; #ifdef WINDOWS HANDLE timer; LARGE_INTEGER interval; diff --git a/source/os/src/osString.c b/source/os/src/osString.c index ae4a8a5cad..0f459b58cd 100644 --- a/source/os/src/osString.c +++ b/source/os/src/osString.c @@ -94,21 +94,21 @@ int32_t tasoUcs4Compare(TdUcs4 *f1_ucs4, TdUcs4 *f2_ucs4, int32_t bytes) { return 0; -#if 0 - int32_t ucs4_max_len = bytes + 4; - char *f1_mbs = taosMemoryCalloc(bytes, 1); - char *f2_mbs = taosMemoryCalloc(bytes, 1); - if (taosUcs4ToMbs(f1_ucs4, ucs4_max_len, f1_mbs) < 0) { - return -1; - } - if (taosUcs4ToMbs(f2_ucs4, ucs4_max_len, f2_mbs) < 0) { - return -1; - } - int32_t ret = strcmp(f1_mbs, f2_mbs); - taosMemoryFree(f1_mbs); - taosMemoryFree(f2_mbs); - return ret; -#endif +//#if 0 +// int32_t ucs4_max_len = bytes + 4; +// char *f1_mbs = taosMemoryCalloc(bytes, 1); +// char *f2_mbs = taosMemoryCalloc(bytes, 1); +// if (taosUcs4ToMbs(f1_ucs4, ucs4_max_len, f1_mbs) < 0) { +// return -1; +// } +// if (taosUcs4ToMbs(f2_ucs4, ucs4_max_len, f2_mbs) < 0) { +// return -1; +// } +// int32_t ret = strcmp(f1_mbs, f2_mbs); +// taosMemoryFree(f1_mbs); +// taosMemoryFree(f2_mbs); +// return ret; +//#endif } TdUcs4 *tasoUcs4Copy(TdUcs4 *target_ucs4, TdUcs4 *source_ucs4, int32_t len_ucs4) { diff --git a/source/os/test/CMakeLists.txt b/source/os/test/CMakeLists.txt index 21fb2ee630..fba4d23e3f 100644 --- a/source/os/test/CMakeLists.txt +++ b/source/os/test/CMakeLists.txt @@ -17,8 +17,64 @@ INCLUDE_DIRECTORIES(${TD_SOURCE_DIR}/src/util/inc) # osTests add_executable(osTests "osTests.cpp") -target_link_libraries(osTests os util gtest_main) +target_link_libraries(osTests os util gtest_main) add_test( NAME osTests COMMAND osTests +) + +add_executable(osSystemTests "osSystemTests.cpp") +target_link_libraries(osSystemTests os util gtest_main) +add_test( + NAME osSystemTests + COMMAND osSystemTests +) + +add_executable(osMathTests "osMathTests.cpp") +target_link_libraries(osMathTests os util gtest_main) +add_test( + NAME osMathTests + COMMAND osMathTests +) + +add_executable(osSignalTests "osSignalTests.cpp") +target_link_libraries(osSignalTests os util gtest_main) +add_test( + NAME osSignalTests + COMMAND osSignalTests +) + +add_executable(osSleepTests "osSleepTests.cpp") +target_link_libraries(osSleepTests os util gtest_main) +add_test( + NAME osSleepTests + COMMAND osSleepTests +) + +add_executable(osStringTests "osStringTests.cpp") +target_link_libraries(osStringTests os util gtest_main) +add_test( + NAME osStringTests + COMMAND osStringTests +) + +add_executable(osThreadTests "osThreadTests.cpp") +target_link_libraries(osThreadTests os util gtest_main) +add_test( + NAME osThreadTests + COMMAND osThreadTests +) + +add_executable(osTimeTests "osTimeTests.cpp") +target_link_libraries(osTimeTests os util gtest_main) +add_test( + NAME osTimeTests + COMMAND osTimeTests +) + +add_executable(osAtomicTests "osAtomicTests.cpp") +target_link_libraries(osAtomicTests os util gtest_main) +add_test( + NAME osAtomicTests + COMMAND osAtomicTests ) \ No newline at end of file diff --git a/source/os/test/osAtomicTests.cpp b/source/os/test/osAtomicTests.cpp new file mode 100644 index 0000000000..eebc1574c3 --- /dev/null +++ b/source/os/test/osAtomicTests.cpp @@ -0,0 +1,115 @@ +/* + * 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 +#include + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wwrite-strings" +#pragma GCC diagnostic ignored "-Wunused-function" +#pragma GCC diagnostic ignored "-Wunused-variable" +#pragma GCC diagnostic ignored "-Wsign-compare" +#pragma GCC diagnostic ignored "-Wsign-compare" +#pragma GCC diagnostic ignored "-Wformat" +#pragma GCC diagnostic ignored "-Wint-to-pointer-cast" +#pragma GCC diagnostic ignored "-Wpointer-arith" + +#include "os.h" +#include "tlog.h" + +TEST(osAtomicTests, Exchange16) { + int16_t value = 123; + int16_t new_value = 456; + int16_t result = atomic_exchange_16(&value, new_value); + EXPECT_EQ(result, 123); + EXPECT_EQ(value, 456); +} + +TEST(osAtomicTests, Exchange32) { + int32_t value = 123; + int32_t new_value = 456; + int32_t result = atomic_exchange_32(&value, new_value); + EXPECT_EQ(result, 123); + EXPECT_EQ(value, 456); +} + +TEST(osAtomicTests, Exchange64) { + int64_t value = 123; + int64_t new_value = 456; + int64_t result = atomic_exchange_64(&value, new_value); + EXPECT_EQ(result, 123); + EXPECT_EQ(value, 456); +} + +TEST(osAtomicTests, ExchangePtr) { + int value1 = 123; + int value2 = 456; + int* ptr = &value1; + int* result = (int*)atomic_exchange_ptr(&ptr, &value2); + EXPECT_EQ(result, &value1); + EXPECT_EQ(*ptr, 456); +} + +TEST(osAtomicTests, ValCompareExchange8) { + int8_t value = 12; + int8_t oldval = 12; + int8_t newval = 45; + int8_t result = atomic_val_compare_exchange_8(&value, oldval, newval); + EXPECT_EQ(result, 12); + EXPECT_EQ(value, 45); + + oldval = 78; + result = atomic_val_compare_exchange_8(&value, oldval, newval); + EXPECT_EQ(result, 45); + EXPECT_EQ(value, 45); +} + +TEST(osAtomicTests, ValCompareExchange16) { + int16_t value = 123; + int16_t oldval = 123; + int16_t newval = 456; + int16_t result = atomic_val_compare_exchange_16(&value, oldval, newval); + EXPECT_EQ(result, 123); + EXPECT_EQ(value, 456); + + oldval = 789; + result = atomic_val_compare_exchange_16(&value, oldval, newval); + EXPECT_EQ(result, 456); + EXPECT_EQ(value, 456); +} + +TEST(osAtomicTests, TestAtomicExchange8) { + volatile int8_t value = 42; + int8_t new_value = 100; + int8_t old_value = atomic_exchange_8(&value, new_value); + EXPECT_EQ(old_value, 42); + EXPECT_EQ(value, new_value); +} + +TEST(osAtomicTests, TestAtomicAddFetch16) { + volatile int16_t value = 42; + int16_t increment = 10; + int16_t new_value = atomic_add_fetch_16(&value, increment); + EXPECT_EQ(new_value, 52); + EXPECT_EQ(value, 52); +} + +//TEST(osAtomicTests, AddFetchPtr) { +// uintptr_t val = 0; +// uintptr_t* ptr = &val; +// uintptr_t ret = atomic_add_fetch_ptr(ptr, 10); +// EXPECT_EQ(ret, 10); +// EXPECT_EQ(val, 10); +//} diff --git a/source/os/test/osMathTests.cpp b/source/os/test/osMathTests.cpp new file mode 100644 index 0000000000..93c8d1f8da --- /dev/null +++ b/source/os/test/osMathTests.cpp @@ -0,0 +1,62 @@ +/* + * 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 +#include + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wwrite-strings" +#pragma GCC diagnostic ignored "-Wunused-function" +#pragma GCC diagnostic ignored "-Wunused-variable" +#pragma GCC diagnostic ignored "-Wsign-compare" +#pragma GCC diagnostic ignored "-Wsign-compare" +#pragma GCC diagnostic ignored "-Wformat" +#pragma GCC diagnostic ignored "-Wint-to-pointer-cast" +#pragma GCC diagnostic ignored "-Wpointer-arith" + +#include "os.h" +#include "tlog.h" + +struct TestStruct { + int a; + float b; +}; + +// Define a custom comparison function for testing +int cmpFunc(const void* a, const void* b) { + const TestStruct* pa = reinterpret_cast(a); + const TestStruct* pb = reinterpret_cast(b); + if (pa->a < pb->a) { + return -1; + } else if (pa->a > pb->a) { + return 1; + } else { + return 0; + } +} + +TEST(osMathTests, taosSort) { + // Create an array of test data + TestStruct arr[] = {{4, 2.5}, {2, 1.5}, {1, 3.5}, {3, 4.5}}; + + // Sort the array using taosSort + taosSort(arr, 4, sizeof(TestStruct), cmpFunc); + + // Check that the array is sorted correctly + EXPECT_EQ(arr[0].a, 1); + EXPECT_EQ(arr[1].a, 2); + EXPECT_EQ(arr[2].a, 3); + EXPECT_EQ(arr[3].a, 4); +} \ No newline at end of file diff --git a/source/os/test/osSignalTests.cpp b/source/os/test/osSignalTests.cpp new file mode 100644 index 0000000000..f4cc6e9e58 --- /dev/null +++ b/source/os/test/osSignalTests.cpp @@ -0,0 +1,40 @@ +/* + * 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 +#include + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wwrite-strings" +#pragma GCC diagnostic ignored "-Wunused-function" +#pragma GCC diagnostic ignored "-Wunused-variable" +#pragma GCC diagnostic ignored "-Wsign-compare" +#pragma GCC diagnostic ignored "-Wsign-compare" +#pragma GCC diagnostic ignored "-Wformat" +#pragma GCC diagnostic ignored "-Wint-to-pointer-cast" +#pragma GCC diagnostic ignored "-Wpointer-arith" + +#include "os.h" +#include "tlog.h" + +TEST(osSignalTests, taosSetSignal) { + // Set up SIGINT handler using taosSetSignal + //taosSetSignal(SIGINT, sigint_handler); + + // Print PID for testing purposes + // printf("PID: %d\n", getpid()); + + // Wait for signal to be received +} diff --git a/source/os/test/osSleepTests.cpp b/source/os/test/osSleepTests.cpp new file mode 100644 index 0000000000..5faa837a0a --- /dev/null +++ b/source/os/test/osSleepTests.cpp @@ -0,0 +1,63 @@ +/* + * 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 +#include + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wwrite-strings" +#pragma GCC diagnostic ignored "-Wunused-function" +#pragma GCC diagnostic ignored "-Wunused-variable" +#pragma GCC diagnostic ignored "-Wsign-compare" +#pragma GCC diagnostic ignored "-Wsign-compare" +#pragma GCC diagnostic ignored "-Wformat" +#pragma GCC diagnostic ignored "-Wint-to-pointer-cast" +#pragma GCC diagnostic ignored "-Wpointer-arith" + +#include "os.h" +#include "tlog.h" + +TEST(osSleepTests, taosUsleep) { + const int sleep_time1 = 1000; // sleep for 1000 microseconds + taosUsleep(sleep_time1); + + const int sleep_time2 = 0; // sleep for 0 microseconds + taosUsleep(sleep_time2); + + const int sleep_time3 = -1; // sleep for negative time + taosUsleep(sleep_time3); +} + +TEST(osSleepTests, taosSsleep) { + const int sleep_time1 = 1; + taosSsleep(sleep_time1); + + const int sleep_time2 = 0; + taosSsleep(sleep_time2); + + const int sleep_time3 = -1; + taosSsleep(sleep_time3); +} + +TEST(osSleepTests, taosMsleep) { + const int sleep_time1 = 1000; + taosMsleep(sleep_time1); + + const int sleep_time2 = 0; + taosMsleep(sleep_time2); + + const int sleep_time3 = -1; // sleep for negative time + taosMsleep(sleep_time3); +} diff --git a/source/os/test/osStringTests.cpp b/source/os/test/osStringTests.cpp new file mode 100644 index 0000000000..5e07636b1f --- /dev/null +++ b/source/os/test/osStringTests.cpp @@ -0,0 +1,113 @@ +/* + * 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 +#include + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wwrite-strings" +#pragma GCC diagnostic ignored "-Wunused-function" +#pragma GCC diagnostic ignored "-Wunused-variable" +#pragma GCC diagnostic ignored "-Wsign-compare" +#pragma GCC diagnostic ignored "-Wsign-compare" +#pragma GCC diagnostic ignored "-Wformat" +#pragma GCC diagnostic ignored "-Wint-to-pointer-cast" +#pragma GCC diagnostic ignored "-Wpointer-arith" + +#include "os.h" +#include "tlog.h" + +#ifdef WINDOWS +TEST(osStringTests, strsepNormalInput) { + char str[] = "This is a test string."; + char * ptr = str; + char * tok = NULL; + const char delim[] = " "; + + while ((tok = strsep(&ptr, delim)) != NULL) { + printf("%s\n", tok); + } + EXPECT_STREQ(tok, nullptr); + EXPECT_EQ(ptr, nullptr); +} + +TEST(osStringTests, strsepEmptyInput) { + char* str = ""; + char* ptr = str; + char* tok = NULL; + const char delim[] = " "; + + while ((tok = strsep(&ptr, delim)) != NULL) { + printf("%s\n", tok); + } + + EXPECT_STREQ(tok, nullptr); + EXPECT_EQ(ptr, nullptr); +} + +TEST(osStringTests, strsepNullInput) { + char * str = NULL; + char * ptr = str; + char * tok = NULL; + const char delim[] = " "; + + while ((tok = strsep(&ptr, delim)) != NULL) { + printf("%s\n", tok); + } + + EXPECT_STREQ(tok, nullptr); + EXPECT_EQ(ptr, nullptr); +} + +TEST(osStringTests, strndupNormalInput) { + const char s[] = "This is a test string."; + int size = strlen(s) + 1; + char * s2 = strndup(s, size); + + EXPECT_STREQ(s, s2); + + free(s2); +} +#endif + +TEST(osStringTests, osUcs4Tests1) { + TdUcs4 f1_ucs4[] = {0x0048, 0x0065, 0x006C, 0x006C, 0x006F, 0x0000}; + TdUcs4 f2_ucs4[] = {0x0048, 0x0065, 0x006C, 0x006C, 0x006F, 0x0000}; + + EXPECT_EQ(tasoUcs4Compare(f1_ucs4, f2_ucs4, sizeof(f1_ucs4)), 0); + + TdUcs4 f3_ucs4[] = {0x0048, 0x0065, 0x006C, 0x006C, 0x006F, 0x0020, 0x0077, + 0x006F, 0x0072, 0x006C, 0x0064, 0x0021, 0x0000}; + TdUcs4 f4_ucs4[] = {0x0048, 0x0065, 0x006C, 0x006C, 0x006F, 0x0000}; + + EXPECT_GT(tasoUcs4Compare(f3_ucs4, f4_ucs4, sizeof(f3_ucs4)), 0); + + TdUcs4 f5_ucs4[] = {0x0048, 0x0065, 0x006C, 0x006C, 0x006F, 0x0000}; + TdUcs4 f6_ucs4[] = {0x0048, 0x0065, 0x006C, 0x006C, 0x006F, 0x0020, 0x0077, + 0x006F, 0x0072, 0x006C, 0x0064, 0x0021, 0x0000}; + + EXPECT_LT(tasoUcs4Compare(f5_ucs4, f6_ucs4, sizeof(f5_ucs4)), 0); +} + +TEST(osStringTests, osUcs4lenTests2) { + TdUcs4 ucs4_1[] = {'H', 'e', 'l', 'l', 'o', '\0'}; + EXPECT_EQ(taosUcs4len(ucs4_1), 5); + + TdUcs4 ucs4_2[] = {'\0'}; + EXPECT_EQ(taosUcs4len(ucs4_2), 0); + + TdUcs4 ucs4_3[] = {'C', 'h', 'i', 'n', 'a', 0x4E2D, 0x6587, '\0'}; + EXPECT_EQ(taosUcs4len(ucs4_3), 7); +} diff --git a/source/os/test/osSystemTests.cpp b/source/os/test/osSystemTests.cpp new file mode 100644 index 0000000000..dfc92a1b72 --- /dev/null +++ b/source/os/test/osSystemTests.cpp @@ -0,0 +1,41 @@ +/* + * 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 +#include + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wwrite-strings" +#pragma GCC diagnostic ignored "-Wunused-function" +#pragma GCC diagnostic ignored "-Wunused-variable" +#pragma GCC diagnostic ignored "-Wsign-compare" +#pragma GCC diagnostic ignored "-Wsign-compare" +#pragma GCC diagnostic ignored "-Wformat" +#pragma GCC diagnostic ignored "-Wint-to-pointer-cast" +#pragma GCC diagnostic ignored "-Wpointer-arith" + +#include "os.h" +#include "tlog.h" + +TEST(osSystemTest, osSystem1) { + char tmp[4096] = "test"; +#ifdef _TD_DARWIN_64 + taosLogTraceToBuf(tmp, sizeof(tmp), 4); +#elif !defined(WINDOWS) + taosLogTraceToBuf(tmp, sizeof(tmp), 3); +#else + taosLogTraceToBuf(tmp, sizeof(tmp), 8); +#endif +} diff --git a/source/os/test/osThreadTests.cpp b/source/os/test/osThreadTests.cpp new file mode 100644 index 0000000000..e7fc4f1356 --- /dev/null +++ b/source/os/test/osThreadTests.cpp @@ -0,0 +1,34 @@ +/* + * 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 +#include + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wwrite-strings" +#pragma GCC diagnostic ignored "-Wunused-function" +#pragma GCC diagnostic ignored "-Wunused-variable" +#pragma GCC diagnostic ignored "-Wsign-compare" +#pragma GCC diagnostic ignored "-Wsign-compare" +#pragma GCC diagnostic ignored "-Wformat" +#pragma GCC diagnostic ignored "-Wint-to-pointer-cast" +#pragma GCC diagnostic ignored "-Wpointer-arith" + +#include "os.h" +#include "tlog.h" + +TEST(osThreadTests, osThreadTests1) { + +} diff --git a/source/os/test/osTimeTests.cpp b/source/os/test/osTimeTests.cpp new file mode 100644 index 0000000000..366c3fc720 --- /dev/null +++ b/source/os/test/osTimeTests.cpp @@ -0,0 +1,48 @@ +/* + * 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 +#include + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wwrite-strings" +#pragma GCC diagnostic ignored "-Wunused-function" +#pragma GCC diagnostic ignored "-Wunused-variable" +#pragma GCC diagnostic ignored "-Wsign-compare" +#pragma GCC diagnostic ignored "-Wsign-compare" +#pragma GCC diagnostic ignored "-Wformat" +#pragma GCC diagnostic ignored "-Wint-to-pointer-cast" +#pragma GCC diagnostic ignored "-Wpointer-arith" + +#include "os.h" +#include "tlog.h" + +TEST(osTimeTests, taosLocalTimeNolock) { + time_t currentTime; + // Test when result is NULL + struct tm* result = taosLocalTimeNolock(NULL, ¤tTime, 0); + // Test when result is not NULL + struct tm expectedTime; + result = taosLocalTimeNolock(&expectedTime, ¤tTime, 1); + EXPECT_EQ(expectedTime.tm_year, result->tm_year); + EXPECT_EQ(expectedTime.tm_mon, result->tm_mon); + EXPECT_EQ(expectedTime.tm_mday, result->tm_mday); + EXPECT_EQ(expectedTime.tm_hour, result->tm_hour); + EXPECT_EQ(expectedTime.tm_min, result->tm_min); + EXPECT_EQ(expectedTime.tm_sec, result->tm_sec); + EXPECT_EQ(expectedTime.tm_wday, result->tm_wday); + EXPECT_EQ(expectedTime.tm_yday, result->tm_yday); + EXPECT_EQ(expectedTime.tm_isdst, result->tm_isdst); +} From 86e349ec5c5d33b1b8ecd16064439f9326a39d05 Mon Sep 17 00:00:00 2001 From: WANG MINGMING Date: Wed, 8 Mar 2023 20:00:03 +0800 Subject: [PATCH 162/174] Update 10-cpp.mdx --- docs/zh/08-connector/10-cpp.mdx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/docs/zh/08-connector/10-cpp.mdx b/docs/zh/08-connector/10-cpp.mdx index 3ea4b10a96..3d75f9aee1 100644 --- a/docs/zh/08-connector/10-cpp.mdx +++ b/docs/zh/08-connector/10-cpp.mdx @@ -263,6 +263,14 @@ int taos_print_row(char *str, TAOS_ROW row, TAOS_FIELD *fields, int num_fields) - `int taos_select_db(TAOS *taos, const char *db)` 将当前的缺省数据库设置为 `db`。 + +- `int taos_get_current_db(TAOS *taos, char *database, int len, int *required)` + + - database,len为用户在外面申请的空间,内部会把当前db赋值到database里。 + - 只要是没有正常把db名赋值到database中(包括截断),返回错误,返回值为-1,然后用户可以通过 taos_errstr(NULL) 来获取错误提示。 + - 如果,database == NULL 或者 len<=0 返回错误,required里保存存储db需要的空间(包含最后的'\0') + - 如果,len 小于 存储db需要的空间(包含最后的'\0'),返回错误,database里赋值截断的数据,以’\0‘结尾。 + - 如果,len 大于等于 存储db需要的空间(包含最后的'\0'),返回正常0,database里赋值以’\0‘结尾的db名。 - `void taos_close(TAOS *taos)` From a9a439edb9471ed6b58dd74d44783194f41e9b4c Mon Sep 17 00:00:00 2001 From: WANG MINGMING Date: Wed, 8 Mar 2023 20:06:27 +0800 Subject: [PATCH 163/174] Update index.md --- docs/zh/14-reference/12-config/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/zh/14-reference/12-config/index.md b/docs/zh/14-reference/12-config/index.md index f8724fcf96..6eeb577ab5 100644 --- a/docs/zh/14-reference/12-config/index.md +++ b/docs/zh/14-reference/12-config/index.md @@ -609,7 +609,7 @@ charset 的有效值是 UTF-8。 | 适用范围 | 仅客户端适用 | | 含义 | schemaless 列数据是否顺序一致,从3.0.3.0开始,该配置废弃 | | 值域 | 0:不一致;1: 一致 | -| 缺省值 | 1 | +| 缺省值 | 0 | ## 其他 From a8afbaca83576b5506551067ed2e1910d7d14b3a Mon Sep 17 00:00:00 2001 From: WANG MINGMING Date: Wed, 8 Mar 2023 20:08:12 +0800 Subject: [PATCH 164/174] Update index.md --- docs/en/14-reference/12-config/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/en/14-reference/12-config/index.md b/docs/en/14-reference/12-config/index.md index f20018d5e0..a76074f507 100644 --- a/docs/en/14-reference/12-config/index.md +++ b/docs/en/14-reference/12-config/index.md @@ -599,7 +599,7 @@ The charset that takes effect is UTF-8. | Applicable | Client only | | Meaning | Whether schemaless columns are consistently ordered, depat, discarded since 3.0.3.0| | Value Range | 0: not consistent; 1: consistent. | -| Default | 1 | +| Default | 0 | ## Compress Parameters From 7f3e53cf74e16586e3c42b3024ad3829eebdc087 Mon Sep 17 00:00:00 2001 From: WANG MINGMING Date: Wed, 8 Mar 2023 20:24:42 +0800 Subject: [PATCH 165/174] Update 03-cpp.mdx --- docs/en/14-reference/03-connector/03-cpp.mdx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/docs/en/14-reference/03-connector/03-cpp.mdx b/docs/en/14-reference/03-connector/03-cpp.mdx index 3bd7b7f4c6..1ab897e794 100644 --- a/docs/en/14-reference/03-connector/03-cpp.mdx +++ b/docs/en/14-reference/03-connector/03-cpp.mdx @@ -176,6 +176,14 @@ The base API is used to do things like create database connections and provide a Set the current default database to `db`. +- `int taos_get_current_db(TAOS *taos, char *database, int len, int *required)` + + - The variables database and len are applied by the user outside and allocated space. The current database name and length will be assigned to database and len. + - As long as the db name is not assigned to the database normally (including truncation), an error will be returned with the return value of -1, and then the user can use taos_errstr(NULL) to get error message. + - If database==NULL or len<=0, returns an error, the space required to store the db (including the last '\0') in the variable required + - If len is less than the space required to store the db (including the last '\0'), an error is returned. The truncated data assigned in the database ends with '\0'. + - If len is greater than or equal to the space required to store the db (including the last '\0'), return normal 0, and assign the db name ending with '\0' in the database. + - `void taos_close(TAOS *taos)` Closes the connection, where `taos` is the handle returned by `taos_connect()`. From e27d302d52326ff08de09d32a4cfa52df628bd76 Mon Sep 17 00:00:00 2001 From: WANG MINGMING Date: Wed, 8 Mar 2023 20:33:38 +0800 Subject: [PATCH 166/174] Update 03-cpp.mdx --- docs/en/14-reference/03-connector/03-cpp.mdx | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/docs/en/14-reference/03-connector/03-cpp.mdx b/docs/en/14-reference/03-connector/03-cpp.mdx index 3bd7b7f4c6..e8059d8584 100644 --- a/docs/en/14-reference/03-connector/03-cpp.mdx +++ b/docs/en/14-reference/03-connector/03-cpp.mdx @@ -404,5 +404,17 @@ In addition to writing data using the SQL method or the parameter binding API, w Note that the timestamp resolution parameter only takes effect when the protocol type is `SML_LINE_PROTOCOL`. For OpenTSDB's text protocol, timestamp resolution follows its official resolution rules - time precision is confirmed by the number of characters contained in the timestamp. - **Supported Versions** - This feature interface is supported from version 2.3.0.0. + schemaless 其他相关的接口 +- `TAOS_RES *taos_schemaless_insert_with_reqid(TAOS *taos, char *lines[], int numLines, int protocol, int precision, int64_t reqid)` +- `TAOS_RES *taos_schemaless_insert_raw(TAOS *taos, char *lines, int len, int32_t *totalRows, int protocol, int precision)` +- `TAOS_RES *taos_schemaless_insert_raw_with_reqid(TAOS *taos, char *lines, int len, int32_t *totalRows, int protocol, int precision, int64_t reqid)` +- `TAOS_RES *taos_schemaless_insert_ttl(TAOS *taos, char *lines[], int numLines, int protocol, int precision, int32_t ttl)` +- `TAOS_RES *taos_schemaless_insert_ttl_with_reqid(TAOS *taos, char *lines[], int numLines, int protocol, int precision, int32_t ttl, int64_t reqid)` +- `TAOS_RES *taos_schemaless_insert_raw_ttl(TAOS *taos, char *lines, int len, int32_t *totalRows, int protocol, int precision, int32_t ttl)` +- `TAOS_RES *taos_schemaless_insert_raw_ttl_with_reqid(TAOS *taos, char *lines, int len, int32_t *totalRows, int protocol, int precision, int32_t ttl, int64_t reqid)` + + **Description** + - The above seven interfaces are extension interfaces, which are mainly used to pass ttl and reqid parameters, and can be used as needed. + - Withing _raw interfaces represent data through the passed parameters lines and len. In order to solve the problem that the original interface data contains '\0' and is truncated. The totalRows pointer returns the number of parsed data rows. + - Withing _ttl interfaces can pass the ttl parameter to control the ttl expiration time of the table. + - Withing _reqid interfaces can track the entire call chain by passing the reqid parameter. From 55fa2b7fe83148cb186a21c12e4b0be80b6e8b09 Mon Sep 17 00:00:00 2001 From: WANG MINGMING Date: Wed, 8 Mar 2023 20:36:06 +0800 Subject: [PATCH 167/174] Update 10-cpp.mdx --- docs/zh/08-connector/10-cpp.mdx | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/docs/zh/08-connector/10-cpp.mdx b/docs/zh/08-connector/10-cpp.mdx index 3ea4b10a96..51deec278e 100644 --- a/docs/zh/08-connector/10-cpp.mdx +++ b/docs/zh/08-connector/10-cpp.mdx @@ -493,5 +493,17 @@ TDengine 的异步 API 均采用非阻塞调用模式。应用程序可以用多 需要注意的是,时间戳分辨率参数只在协议类型为 `SML_LINE_PROTOCOL` 的时候生效。 对于 OpenTSDB 的文本协议,时间戳的解析遵循其官方解析规则 — 按照时间戳包含的字符的数量来确认时间精度。 - **支持版本** - 该功能接口从 2.3.0.0 版本开始支持。 + **schemaless 其他相关的接口** +- `TAOS_RES *taos_schemaless_insert_with_reqid(TAOS *taos, char *lines[], int numLines, int protocol, int precision, int64_t reqid)` +- `TAOS_RES *taos_schemaless_insert_raw(TAOS *taos, char *lines, int len, int32_t *totalRows, int protocol, int precision)` +- `TAOS_RES *taos_schemaless_insert_raw_with_reqid(TAOS *taos, char *lines, int len, int32_t *totalRows, int protocol, int precision, int64_t reqid)` +- `TAOS_RES *taos_schemaless_insert_ttl(TAOS *taos, char *lines[], int numLines, int protocol, int precision, int32_t ttl)` +- `TAOS_RES *taos_schemaless_insert_ttl_with_reqid(TAOS *taos, char *lines[], int numLines, int protocol, int precision, int32_t ttl, int64_t reqid)` +- `TAOS_RES *taos_schemaless_insert_raw_ttl(TAOS *taos, char *lines, int len, int32_t *totalRows, int protocol, int precision, int32_t ttl)` +- `TAOS_RES *taos_schemaless_insert_raw_ttl_with_reqid(TAOS *taos, char *lines, int len, int32_t *totalRows, int protocol, int precision, int32_t ttl, int64_t reqid)` + + **说明** + - 上面这7个接口是扩展接口,主要用于在schemaless写入时传递ttl、reqid参数,可以根据需要使用。 + - 带_raw的接口通过传递的参数lines指针和长度len来表示数据,为了解决原始接口数据包含'\0'而被截断的问题。totalRows指针返回解析出来的数据行数。 + - 带_ttl的接口可以传递ttl参数来控制建表的ttl到期时间。 + - 带_reqid的接口可以通过传递reqid参数来追踪整个的调用链。 From 3cbafda95310a74cb8601d403240a7ee0ca889d0 Mon Sep 17 00:00:00 2001 From: xiaolei li <85657333+xleili@users.noreply.github.com> Date: Thu, 9 Mar 2023 01:16:02 +0800 Subject: [PATCH 168/174] release: 3.0.3.0 update taostools version (#20351) --- docs/en/28-releases/02-tools.md | 4 ++++ docs/zh/28-releases/02-tools.md | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/docs/en/28-releases/02-tools.md b/docs/en/28-releases/02-tools.md index a8a5c7af6f..7d45110bb0 100644 --- a/docs/en/28-releases/02-tools.md +++ b/docs/en/28-releases/02-tools.md @@ -10,6 +10,10 @@ For other historical version installers, please visit [here](https://www.taosdat import Release from "/components/ReleaseV3"; +## 2.4.9 + + + ## 2.4.8 diff --git a/docs/zh/28-releases/02-tools.md b/docs/zh/28-releases/02-tools.md index a69c901fcb..a9c9ea5ac7 100644 --- a/docs/zh/28-releases/02-tools.md +++ b/docs/zh/28-releases/02-tools.md @@ -10,6 +10,10 @@ taosTools 各版本安装包下载链接如下: import Release from "/components/ReleaseV3"; +## 2.4.9 + + + ## 2.4.8 From 99e0f50cecf83b9c28ec5317727084180b66c30c Mon Sep 17 00:00:00 2001 From: Adam Ji Date: Thu, 9 Mar 2023 01:19:41 +0800 Subject: [PATCH 169/174] docs: fix python version with dependencies [en] (#20339) --- docs/en/14-reference/03-connector/07-python.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/en/14-reference/03-connector/07-python.mdx b/docs/en/14-reference/03-connector/07-python.mdx index 34435a7c0d..c885d416c8 100644 --- a/docs/en/14-reference/03-connector/07-python.mdx +++ b/docs/en/14-reference/03-connector/07-python.mdx @@ -32,7 +32,7 @@ We recommend using the latest version of `taospy`, regardless of the version of ### Preparation -1. Install Python. The recent taospy package requires Python 3.6+. The earlier versions of taospy require Python 3.7+. The taos-ws-py package requires Python 3.7+. If Python is not available on your system, refer to the [Python BeginnersGuide](https://wiki.python.org/moin/BeginnersGuide/Download) to install it. +1. Install Python. The recent taospy package requires Python 3.6.2+. The earlier versions of taospy require Python 3.7+. The taos-ws-py package requires Python 3.7+. If Python is not available on your system, refer to the [Python BeginnersGuide](https://wiki.python.org/moin/BeginnersGuide/Download) to install it. 2. Install [pip](https://pypi.org/project/pip/). In most cases, the Python installer comes with the pip utility. If not, please refer to [pip documentation](https://pip.pypa.io/en/stable/installation/) to install it. If you use a native connection, you will also need to [Install Client Driver](/reference/connector#Install-Client-Driver). The client install package includes the TDengine client dynamic link library (`libtaos.so` or `taos.dll`) and the TDengine CLI. From cd12eca8f84dcdb2102c6e47e0abe4c612bba5c0 Mon Sep 17 00:00:00 2001 From: WANG MINGMING Date: Thu, 9 Mar 2023 09:57:58 +0800 Subject: [PATCH 170/174] Update 13-schemaless.md --- docs/zh/14-reference/13-schemaless/13-schemaless.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/zh/14-reference/13-schemaless/13-schemaless.md b/docs/zh/14-reference/13-schemaless/13-schemaless.md index 3d0bac25d2..e5f232c1fc 100644 --- a/docs/zh/14-reference/13-schemaless/13-schemaless.md +++ b/docs/zh/14-reference/13-schemaless/13-schemaless.md @@ -87,7 +87,7 @@ st,t1=3,t2=4,t3=t3 c1=3i64,c3="passit",c2=false,c4=4f64 1626006833639000000 :::tip 无模式所有的处理逻辑,仍会遵循 TDengine 对数据结构的底层限制,例如每行数据的总长度不能超过 -16KB。这方面的具体限制约束请参见 [TDengine SQL 边界限制](/taos-sql/limit) +48KB,标签值的总长度不超过16KB。这方面的具体限制约束请参见 [TDengine SQL 边界限制](/taos-sql/limit) ::: From 9223fd1e9d57ad28c58d9f2f2804eb1ca8b029bc Mon Sep 17 00:00:00 2001 From: WANG MINGMING Date: Thu, 9 Mar 2023 10:00:47 +0800 Subject: [PATCH 171/174] Update 13-schemaless.md --- docs/en/14-reference/13-schemaless/13-schemaless.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/en/14-reference/13-schemaless/13-schemaless.md b/docs/en/14-reference/13-schemaless/13-schemaless.md index 1099ceabfe..3f75364081 100644 --- a/docs/en/14-reference/13-schemaless/13-schemaless.md +++ b/docs/en/14-reference/13-schemaless/13-schemaless.md @@ -84,7 +84,7 @@ You can configure smlChildTableName in taos.cfg to specify table names, for exam :::tip All processing logic of schemaless will still follow TDengine's underlying restrictions on data structures, such as the total length of each row of data cannot exceed -16KB. See [TDengine SQL Boundary Limits](/taos-sql/limit) for specific constraints in this area. +48KB, and the total length of tag value cannot exceed 16KB. See [TDengine SQL Boundary Limits](/taos-sql/limit) for specific constraints in this area. ::: From 6c67d69c922f3c3f23ab7a7f4ef37ef1bd0e36e9 Mon Sep 17 00:00:00 2001 From: Shuduo Sang Date: Thu, 9 Mar 2023 14:27:57 +0800 Subject: [PATCH 172/174] docs: java connector support subscription over websocket (#20362) * docs: update csharp connector status * docs: fix csharp ws bulk pulling * docs: clarify database param is optional to websocket dsn * docs: fix java connector mistake * fix: a few typos * fix: many typos * docs: java connector support subscription over websocket --- docs/en/14-reference/03-connector/index.mdx | 2 +- docs/zh/08-connector/index.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/en/14-reference/03-connector/index.mdx b/docs/en/14-reference/03-connector/index.mdx index 2df73b8592..a35d5bc2d1 100644 --- a/docs/en/14-reference/03-connector/index.mdx +++ b/docs/en/14-reference/03-connector/index.mdx @@ -61,7 +61,7 @@ The different database framework specifications for various programming language | **Connection Management** | Support | Support | Support | Support | Support | Support | | **Regular Query** | Support | Support | Support | Support | Support | Support | | **Parameter Binding** | Not Supported | Not Supported | Support | Support | Not Supported | Support | -| **Subscription (TMQ) ** | Not Supported | Support | Support | Not Supported | Not Supported | Support | +| **Subscription (TMQ) ** | Supported | Support | Support | Not Supported | Not Supported | Support | | **Schemaless** | Not Supported | Not Supported | Not Supported | Not Supported | Not Supported | Not Supported | | **Bulk Pulling (based on WebSocket) ** | Support | Support | Support | Support | Support | Support | | **DataFrame** | Not Supported | Support | Not Supported | Not Supported | Not Supported | Not Supported | diff --git a/docs/zh/08-connector/index.md b/docs/zh/08-connector/index.md index f3f0f23b34..eb1f3a9a9a 100644 --- a/docs/zh/08-connector/index.md +++ b/docs/zh/08-connector/index.md @@ -60,7 +60,7 @@ TDengine 版本更新往往会增加新的功能特性,列表中的连接器 | **连接管理** | 支持 | 支持 | 支持 | 支持 | 支持 | 支持 | | **普通查询** | 支持 | 支持 | 支持 | 支持 | 支持 | 支持 | | **参数绑定** | 暂不支持 | 暂不支持 | 支持 | 支持 | 暂不支持 | 支持 | -| **数据订阅(TMQ)** | 暂不支持 | 支持 | 支持 | 暂不支持 | 暂不支持 | 支持 | +| **数据订阅(TMQ)** | 支持 | 支持 | 支持 | 暂不支持 | 暂不支持 | 支持 | | **Schemaless** | 暂不支持 | 暂不支持 | 暂不支持 | 暂不支持 | 暂不支持 | 暂不支持 | | **批量拉取(基于 WebSocket)** | 支持 | 支持 | 支持 | 支持 | 支持 | 支持 | | **DataFrame** | 不支持 | 支持 | 不支持 | 不支持 | 不支持 | 不支持 | From 1caac924f12ae2d9036b3fa7acdf068ef9723d68 Mon Sep 17 00:00:00 2001 From: xinsheng Ren <285808407@qq.com> Date: Thu, 9 Mar 2023 18:51:33 +0800 Subject: [PATCH 173/174] fix: install add explorer (#20357) Co-authored-by: facetosea <25808407@qq.com> --- packaging/tools/make_install.bat | 3 +++ packaging/tools/make_install.sh | 2 ++ packaging/tools/post.sh | 4 ++++ 3 files changed, 9 insertions(+) diff --git a/packaging/tools/make_install.bat b/packaging/tools/make_install.bat index 6dc7c356cd..3996495aca 100644 --- a/packaging/tools/make_install.bat +++ b/packaging/tools/make_install.bat @@ -94,6 +94,9 @@ if %Enterprise% == TRUE ( if exist %binary_dir%\\build\\bin\\create_table.exe ( copy %binary_dir%\\build\\bin\\create_table.exe %target_dir% > nul ) + if exist %binary_dir%\\build\\bin\\*explorer.exe ( + copy %binary_dir%\\build\\bin\\*explorer.exe %target_dir% > nul + ) ) copy %binary_dir%\\build\\bin\\taosd.exe %target_dir% > nul diff --git a/packaging/tools/make_install.sh b/packaging/tools/make_install.sh index 5725560bd6..87c72c6a7c 100755 --- a/packaging/tools/make_install.sh +++ b/packaging/tools/make_install.sh @@ -200,6 +200,7 @@ function install_bin() { [ -f ${binary_dir}/build/bin/taosadapter ] && ${csudo}cp -r ${binary_dir}/build/bin/taosadapter ${install_main_dir}/bin || : [ -f ${binary_dir}/build/bin/udfd ] && ${csudo}cp -r ${binary_dir}/build/bin/udfd ${install_main_dir}/bin || : [ -f ${binary_dir}/build/bin/taosx ] && ${csudo}cp -r ${binary_dir}/build/bin/taosx ${install_main_dir}/bin || : + [ -f ${binary_dir}/build/bin/*explorer ] && ${csudo}cp -r ${binary_dir}/build/bin/*explorer ${install_main_dir}/bin || : ${csudo}cp -r ${binary_dir}/build/bin/${serverName} ${install_main_dir}/bin || : ${csudo}cp -r ${script_dir}/remove.sh ${install_main_dir}/bin || : @@ -212,6 +213,7 @@ function install_bin() { [ -x ${install_main_dir}/bin/taosdump ] && ${csudo}ln -s ${install_main_dir}/bin/taosdump ${bin_link_dir}/taosdump > /dev/null 2>&1 || : [ -f ${install_main_dir}/bin/taosBenchmark ] && ${csudo}ln -sf ${install_main_dir}/bin/taosBenchmark ${install_main_dir}/bin/taosdemo > /dev/null 2>&1 || : [ -x ${install_main_dir}/bin/taosx ] && ${csudo}ln -s ${install_main_dir}/bin/taosx ${bin_link_dir}/taosx > /dev/null 2>&1 || : + [ -x ${install_main_dir}/bin/*explorer ] && ${csudo}ln -s ${install_main_dir}/bin/*explorer ${bin_link_dir}/*explorer > /dev/null 2>&1 || : [ -x ${install_main_dir}/bin/remove.sh ] && ${csudo}ln -s ${install_main_dir}/bin/remove.sh ${bin_link_dir}/${uninstallScript} > /dev/null 2>&1 || : fi } diff --git a/packaging/tools/post.sh b/packaging/tools/post.sh index 78eb7f7587..b2fc488a19 100755 --- a/packaging/tools/post.sh +++ b/packaging/tools/post.sh @@ -185,6 +185,7 @@ function install_bin() { ${csudo}rm -f ${bin_link_dir}/taosdump || : ${csudo}rm -f ${bin_link_dir}/rmtaos || : ${csudo}rm -f ${bin_link_dir}/set_core || : + ${csudo}rm -f ${bin_link_dir}/*explorer || : ${csudo}chmod 0555 ${bin_dir}/* @@ -220,6 +221,9 @@ function install_bin() { if [ -x ${bin_dir}/taoskeeper ]; then ${csudo}ln -sf ${bin_dir}/taoskeeper ${bin_link_dir}/taoskeeper 2>>${install_log_path} || return 1 fi + if [ -x ${bin_dir}/*explorer ]; then + ${csudo}ln -s ${bin_dir}/*explorer ${bin_link_dir}/*explorer 2>>${install_log_path} || return 1 + fi log_print "install bin success" } From 96c4ce4e478c144210ea993763bfbf303606ab99 Mon Sep 17 00:00:00 2001 From: Shuduo Sang Date: Thu, 9 Mar 2023 19:46:15 +0800 Subject: [PATCH 174/174] fix: taosbenchmark socket close properly (#20364) * fix: taosbenchmark socket close properly * fix: update taos-tools e84b7d1 * fix: update taos-tools 41d4f95 --- cmake/taostools_CMakeLists.txt.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/taostools_CMakeLists.txt.in b/cmake/taostools_CMakeLists.txt.in index 5fe8f6ea13..10677f0208 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 d4b3967 + GIT_TAG 41d4f95 SOURCE_DIR "${TD_SOURCE_DIR}/tools/taos-tools" BINARY_DIR "" #BUILD_IN_SOURCE TRUE