From 616539a70083f495140070c6c09cd8ae2fa6970e Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Sat, 23 Jul 2022 17:30:00 +0800 Subject: [PATCH 01/54] feat: super table order by primary key optimization --- source/libs/planner/src/planOptimizer.c | 24 +++++++++---------- source/libs/planner/src/planPhysiCreater.c | 1 - source/libs/planner/src/planSpliter.c | 14 ++++++++++- source/libs/planner/src/planUtil.c | 3 ++- source/libs/planner/test/planOptimizeTest.cpp | 2 ++ 5 files changed, 29 insertions(+), 15 deletions(-) diff --git a/source/libs/planner/src/planOptimizer.c b/source/libs/planner/src/planOptimizer.c index b006ac2b0a..f107b2343c 100644 --- a/source/libs/planner/src/planOptimizer.c +++ b/source/libs/planner/src/planOptimizer.c @@ -997,10 +997,7 @@ static int32_t sortPriKeyOptGetScanNodesImpl(SLogicNode* pNode, bool* pNotOptimi switch (nodeType(pNode)) { case QUERY_NODE_LOGIC_PLAN_SCAN: - if (TSDB_SUPER_TABLE != ((SScanLogicNode*)pNode)->tableType) { - return nodesListMakeAppend(pScanNodes, (SNode*)pNode); - } - break; + return nodesListMakeAppend(pScanNodes, (SNode*)pNode); case QUERY_NODE_LOGIC_PLAN_JOIN: code = sortPriKeyOptGetScanNodesImpl((SLogicNode*)nodesListGetNode(pNode->pChildren, 0), pNotOptimize, pScanNodes); @@ -1040,13 +1037,16 @@ static EOrder sortPriKeyOptGetPriKeyOrder(SSortLogicNode* pSort) { static int32_t sortPriKeyOptApply(SOptimizeContext* pCxt, SLogicSubplan* pLogicSubplan, SSortLogicNode* pSort, SNodeList* pScanNodes) { EOrder order = sortPriKeyOptGetPriKeyOrder(pSort); - if (ORDER_DESC == order) { - SNode* pScanNode = NULL; - FOREACH(pScanNode, pScanNodes) { - SScanLogicNode* pScan = (SScanLogicNode*)pScanNode; - if (pScan->scanSeq[0] > 0) { - TSWAP(pScan->scanSeq[0], pScan->scanSeq[1]); - } + SNode* pScanNode = NULL; + FOREACH(pScanNode, pScanNodes) { + SScanLogicNode* pScan = (SScanLogicNode*)pScanNode; + if (ORDER_DESC == order && pScan->scanSeq[0] > 0) { + TSWAP(pScan->scanSeq[0], pScan->scanSeq[1]); + } + if (TSDB_SUPER_TABLE == pScan->tableType) { + pScan->scanType = SCAN_TYPE_TABLE_MERGE; + pScan->node.resultDataOrder = DATA_ORDER_LEVEL_GLOBAL; + pScan->node.requireDataOrder = DATA_ORDER_LEVEL_GLOBAL; } } @@ -2191,7 +2191,7 @@ static bool tagScanMayBeOptimized(SLogicNode* pNode) { !planOptNodeListHasTbname(pAgg->pGroupKeys)) { return false; } - + SNode* pGroupKey = NULL; FOREACH(pGroupKey, pAgg->pGroupKeys) { SNode* pGroup = NULL; diff --git a/source/libs/planner/src/planPhysiCreater.c b/source/libs/planner/src/planPhysiCreater.c index 0a1f8bbd0b..fd359fce45 100644 --- a/source/libs/planner/src/planPhysiCreater.c +++ b/source/libs/planner/src/planPhysiCreater.c @@ -415,7 +415,6 @@ static int32_t createScanPhysiNodeFinalize(SPhysiPlanContext* pCxt, SSubplan* pS SScanPhysiNode* pScanPhysiNode, SPhysiNode** pPhyNode) { int32_t code = createScanCols(pCxt, pScanPhysiNode, pScanLogicNode->pScanCols); if (TSDB_CODE_SUCCESS == code) { - // Data block describe also needs to be set without scanning column, such as SELECT COUNT(*) FROM t code = addDataBlockSlots(pCxt, pScanPhysiNode->pScanCols, pScanPhysiNode->node.pOutputDataBlockDesc); } diff --git a/source/libs/planner/src/planSpliter.c b/source/libs/planner/src/planSpliter.c index 8586234b7e..10604fac19 100644 --- a/source/libs/planner/src/planSpliter.c +++ b/source/libs/planner/src/planSpliter.c @@ -913,13 +913,25 @@ static int32_t stbSplSplitScanNodeWithPartTags(SSplitContext* pCxt, SStableSplit } static SNode* stbSplFindPrimaryKeyFromScan(SScanLogicNode* pScan) { + bool find = false; SNode* pCol = NULL; FOREACH(pCol, pScan->pScanCols) { if (PRIMARYKEY_TIMESTAMP_COL_ID == ((SColumnNode*)pCol)->colId) { + find = true; + break; + } + } + if (!find) { + return NULL; + } + SNode* pTarget = NULL; + FOREACH(pTarget, pScan->node.pTargets) { + if (nodesEqualNode(pTarget, pCol)) { return pCol; } } - return NULL; + nodesListStrictAppend(pScan->node.pTargets, nodesCloneNode(pCol)); + return pCol; } static int32_t stbSplSplitMergeScanNode(SSplitContext* pCxt, SLogicSubplan* pSubplan, SScanLogicNode* pScan, diff --git a/source/libs/planner/src/planUtil.c b/source/libs/planner/src/planUtil.c index bfa6079cb1..7aab8a7ca3 100644 --- a/source/libs/planner/src/planUtil.c +++ b/source/libs/planner/src/planUtil.c @@ -124,7 +124,8 @@ int32_t replaceLogicNode(SLogicSubplan* pSubplan, SLogicNode* pOld, SLogicNode* } static int32_t adjustScanDataRequirement(SScanLogicNode* pScan, EDataOrderLevel requirement) { - if (SCAN_TYPE_TABLE != pScan->scanType && SCAN_TYPE_TABLE_MERGE != pScan->scanType) { + if ((SCAN_TYPE_TABLE != pScan->scanType && SCAN_TYPE_TABLE_MERGE != pScan->scanType) || + DATA_ORDER_LEVEL_GLOBAL == pScan->node.requireDataOrder) { return TSDB_CODE_SUCCESS; } // The lowest sort level of scan output data is DATA_ORDER_LEVEL_IN_BLOCK diff --git a/source/libs/planner/test/planOptimizeTest.cpp b/source/libs/planner/test/planOptimizeTest.cpp index 770ac94e5b..058705403b 100644 --- a/source/libs/planner/test/planOptimizeTest.cpp +++ b/source/libs/planner/test/planOptimizeTest.cpp @@ -53,6 +53,8 @@ TEST_F(PlanOptimizeTest, sortPrimaryKey) { run("SELECT c1 FROM t1 ORDER BY ts"); + run("SELECT c1 FROM st1 ORDER BY ts"); + run("SELECT c1 FROM t1 ORDER BY ts DESC"); run("SELECT COUNT(*) FROM t1 INTERVAL(10S) ORDER BY _WSTART DESC"); From dbd71d247c627520cefc3bf1d914ec90195eb0d6 Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Sat, 23 Jul 2022 20:46:39 +0800 Subject: [PATCH 02/54] feat: super table order by primary key optimization --- source/libs/planner/src/planSpliter.c | 40 +++++++++++++++++++--- source/libs/planner/test/planBasicTest.cpp | 7 ++-- 2 files changed, 39 insertions(+), 8 deletions(-) diff --git a/source/libs/planner/src/planSpliter.c b/source/libs/planner/src/planSpliter.c index 10604fac19..879c04743d 100644 --- a/source/libs/planner/src/planSpliter.c +++ b/source/libs/planner/src/planSpliter.c @@ -934,18 +934,48 @@ static SNode* stbSplFindPrimaryKeyFromScan(SScanLogicNode* pScan) { return pCol; } +static int32_t stbSplCreateMergeScanNode(SScanLogicNode* pScan, SLogicNode** pOutputMergeScan, + SNodeList** pOutputMergeKeys) { + SNodeList* pChildren = pScan->node.pChildren; + pScan->node.pChildren = NULL; + + int32_t code = TSDB_CODE_SUCCESS; + SScanLogicNode* pMergeScan = (SScanLogicNode*)nodesCloneNode((SNode*)pScan); + if (NULL == pMergeScan) { + code = TSDB_CODE_OUT_OF_MEMORY; + } + + SNodeList* pMergeKeys = NULL; + if (TSDB_CODE_SUCCESS == code) { + pMergeScan->scanType = SCAN_TYPE_TABLE_MERGE; + pMergeScan->node.pChildren = pChildren; + splSetParent((SLogicNode*)pMergeScan); + code = stbSplCreateMergeKeysByPrimaryKey(stbSplFindPrimaryKeyFromScan(pMergeScan), &pMergeKeys); + } + + if (TSDB_CODE_SUCCESS == code) { + *pOutputMergeScan = (SLogicNode*)pMergeScan; + *pOutputMergeKeys = pMergeKeys; + } else { + nodesDestroyNode((SNode*)pMergeScan); + nodesDestroyList(pMergeKeys); + } + + return code; +} + static int32_t stbSplSplitMergeScanNode(SSplitContext* pCxt, SLogicSubplan* pSubplan, SScanLogicNode* pScan, bool groupSort) { - SNodeList* pMergeKeys = NULL; - int32_t code = stbSplCreateMergeKeysByPrimaryKey(stbSplFindPrimaryKeyFromScan(pScan), &pMergeKeys); + SLogicNode* pMergeScan = NULL; + SNodeList* pMergeKeys = NULL; + int32_t code = stbSplCreateMergeScanNode(pScan, &pMergeScan, &pMergeKeys); if (TSDB_CODE_SUCCESS == code) { - code = stbSplCreateMergeNode(pCxt, pSubplan, (SLogicNode*)pScan, pMergeKeys, (SLogicNode*)pScan, groupSort); + code = stbSplCreateMergeNode(pCxt, pSubplan, (SLogicNode*)pScan, pMergeKeys, pMergeScan, groupSort); } if (TSDB_CODE_SUCCESS == code) { code = nodesListMakeStrictAppend(&pSubplan->pChildren, - (SNode*)splCreateScanSubplan(pCxt, (SLogicNode*)pScan, SPLIT_FLAG_STABLE_SPLIT)); + (SNode*)splCreateScanSubplan(pCxt, pMergeScan, SPLIT_FLAG_STABLE_SPLIT)); } - pScan->scanType = SCAN_TYPE_TABLE_MERGE; ++(pCxt->groupId); return code; } diff --git a/source/libs/planner/test/planBasicTest.cpp b/source/libs/planner/test/planBasicTest.cpp index 8f9cd94c19..9cfae68d34 100644 --- a/source/libs/planner/test/planBasicTest.cpp +++ b/source/libs/planner/test/planBasicTest.cpp @@ -24,9 +24,10 @@ TEST_F(PlanBasicTest, selectClause) { useDb("root", "test"); run("SELECT * FROM t1"); - run("SELECT 1 FROM t1"); - run("SELECT * FROM st1"); - run("SELECT 1 FROM st1"); + + run("SELECT MAX(c1) c2, c2 FROM t1"); + + run("SELECT MAX(c1) c2, c2 FROM st1"); } TEST_F(PlanBasicTest, whereClause) { From baca08d05dfc1735f3c5f980912e854c601a9f21 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Mon, 25 Jul 2022 14:15:49 +0800 Subject: [PATCH 03/54] refactor: do some internal refactor. --- source/libs/executor/inc/executorimpl.h | 5 + source/libs/executor/src/executorimpl.c | 580 +------------------- source/libs/executor/src/projectoperator.c | 585 +++++++++++++++++++++ 3 files changed, 612 insertions(+), 558 deletions(-) create mode 100644 source/libs/executor/src/projectoperator.c diff --git a/source/libs/executor/inc/executorimpl.h b/source/libs/executor/inc/executorimpl.h index f4d0eb3b5e..bde7a94c53 100644 --- a/source/libs/executor/inc/executorimpl.h +++ b/source/libs/executor/inc/executorimpl.h @@ -351,6 +351,11 @@ typedef enum EStreamScanMode { STREAM_SCAN_FROM_DATAREADER_RANGE, } EStreamScanMode; +enum { + PROJECT_RETRIEVE_CONTINUE = 0x1, + PROJECT_RETRIEVE_DONE = 0x2, +}; + typedef struct SCatchSupporter { SHashObj* pWindowHashTable; // quick locate the window object for each window SDiskbasedBuf* pDataBuf; // buffer based on blocked-wised disk file diff --git a/source/libs/executor/src/executorimpl.c b/source/libs/executor/src/executorimpl.c index 906952be9c..d9cc2dbeb2 100644 --- a/source/libs/executor/src/executorimpl.c +++ b/source/libs/executor/src/executorimpl.c @@ -42,11 +42,6 @@ #define GET_FORWARD_DIRECTION_FACTOR(ord) (((ord) == TSDB_ORDER_ASC) ? QUERY_ASC_FORWARD_STEP : QUERY_DESC_FORWARD_STEP) -enum { - PROJECT_RETRIEVE_CONTINUE = 0x1, - PROJECT_RETRIEVE_DONE = 0x2, -}; - #if 0 static UNUSED_FUNC void *u_malloc (size_t __size) { uint32_t v = taosRand(); @@ -575,6 +570,26 @@ static void setPseudoOutputColInfo(SSDataBlock* pResult, SqlFunctionCtx* pCtx, S int32_t projectApplyFunctions(SExprInfo* pExpr, SSDataBlock* pResult, SSDataBlock* pSrcBlock, SqlFunctionCtx* pCtx, int32_t numOfOutput, SArray* pPseudoList) { setPseudoOutputColInfo(pResult, pCtx, pPseudoList); + + if (pSrcBlock == NULL) { + for (int32_t k = 0; k < numOfOutput; ++k) { + int32_t outputSlotId = pExpr[k].base.resSchema.slotId; + + ASSERT(pExpr[k].pExpr->nodeType == QUERY_NODE_VALUE); + SColumnInfoData* pColInfoData = taosArrayGet(pResult->pDataBlock, outputSlotId); + + int32_t type = pExpr[k].base.pParam[0].param.nType; + if (TSDB_DATA_TYPE_NULL == type) { + colDataAppendNNULL(pColInfoData, 0, 1); + } else { + colDataAppend(pColInfoData, 0, taosVariantGet(&pExpr[k].base.pParam[0].param, type), false); + } + } + + pResult->info.rows = 1; + return TSDB_CODE_SUCCESS; + } + pResult->info.groupId = pSrcBlock->info.groupId; // if the source equals to the destination, it is to create a new column as the result of scalar @@ -1243,52 +1258,6 @@ void initResultRow(SResultRow* pResultRow) { // pResultRow->pEntryInfo = (struct SResultRowEntryInfo*)((char*)pResultRow + sizeof(SResultRow)); } -/* - * The start of each column SResultRowEntryInfo is denote by RowCellInfoOffset. - * Note that in case of top/bottom query, the whole multiple rows of result is treated as only one row of results. - * +------------+-----------------result column 1------------+------------------result column 2-----------+ - * | SResultRow | SResultRowEntryInfo | intermediate buffer1 | SResultRowEntryInfo | intermediate buffer 2| - * +------------+--------------------------------------------+--------------------------------------------+ - * offset[0] offset[1] offset[2] - */ -// TODO refactor: some function move away -void setFunctionResultOutput(SOperatorInfo* pOperator, SOptrBasicInfo* pInfo, SAggSupporter* pSup, int32_t stage, - int32_t numOfExprs) { - SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo; - SqlFunctionCtx* pCtx = pOperator->exprSupp.pCtx; - int32_t* rowEntryInfoOffset = pOperator->exprSupp.rowEntryInfoOffset; - - SResultRowInfo* pResultRowInfo = &pInfo->resultRowInfo; - initResultRowInfo(pResultRowInfo); - - int64_t tid = 0; - int64_t groupId = 0; - SResultRow* pRow = doSetResultOutBufByKey(pSup->pResultBuf, pResultRowInfo, (char*)&tid, sizeof(tid), true, groupId, - pTaskInfo, false, pSup); - - for (int32_t i = 0; i < numOfExprs; ++i) { - struct SResultRowEntryInfo* pEntry = getResultEntryInfo(pRow, i, rowEntryInfoOffset); - cleanupResultRowEntry(pEntry); - - pCtx[i].resultInfo = pEntry; - pCtx[i].scanFlag = stage; - } - - initCtxOutputBuffer(pCtx, numOfExprs); -} - -void initCtxOutputBuffer(SqlFunctionCtx* pCtx, int32_t size) { - for (int32_t j = 0; j < size; ++j) { - struct SResultRowEntryInfo* pResInfo = GET_RES_INFO(&pCtx[j]); - if (isRowEntryInitialized(pResInfo) || fmIsPseudoColumnFunc(pCtx[j].functionId) || pCtx[j].functionId == -1 || - fmIsScalarFunc(pCtx[j].functionId)) { - continue; - } - - pCtx[j].fpSet.init(&pCtx[j], pCtx[j].resultInfo); - } -} - void setTaskStatus(SExecTaskInfo* pTaskInfo, int8_t status) { if (status == TASK_NOT_COMPLETED) { pTaskInfo->status = status; @@ -2805,73 +2774,6 @@ static int32_t initGroupCol(SExprInfo* pExprInfo, int32_t numOfCols, SArray* pGr return TSDB_CODE_SUCCESS; } -SOperatorInfo* createSortedMergeOperatorInfo(SOperatorInfo** downstream, int32_t numOfDownstream, SExprInfo* pExprInfo, - int32_t num, SArray* pSortInfo, SArray* pGroupInfo, - SExecTaskInfo* pTaskInfo) { - SSortedMergeOperatorInfo* pInfo = taosMemoryCalloc(1, sizeof(SSortedMergeOperatorInfo)); - SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo)); - if (pInfo == NULL || pOperator == NULL) { - goto _error; - } - - int32_t code = initExprSupp(&pOperator->exprSupp, pExprInfo, num); - if (code != TSDB_CODE_SUCCESS) { - goto _error; - } - - initResultRowInfo(&pInfo->binfo.resultRowInfo); - - if (pOperator->exprSupp.pCtx == NULL || pInfo->binfo.pRes == NULL) { - goto _error; - } - - size_t keyBufSize = sizeof(int64_t) + sizeof(int64_t) + POINTER_BYTES; - code = doInitAggInfoSup(&pInfo->aggSup, pOperator->exprSupp.pCtx, num, keyBufSize, pTaskInfo->id.str); - if (code != TSDB_CODE_SUCCESS) { - goto _error; - } - - setFunctionResultOutput(pOperator, &pInfo->binfo, &pInfo->aggSup, MAIN_SCAN, num); - code = initGroupCol(pExprInfo, num, pGroupInfo, pInfo); - if (code != TSDB_CODE_SUCCESS) { - goto _error; - } - - // pInfo->resultRowFactor = (int32_t)(getRowNumForMultioutput(pRuntimeEnv->pQueryAttr, - // pRuntimeEnv->pQueryAttr->topBotQuery, false)); - pInfo->sortBufSize = 1024 * 16; // 1MB - pInfo->bufPageSize = 1024; - pInfo->pSortInfo = pSortInfo; - - pOperator->resultInfo.capacity = blockDataGetCapacityInRow(pInfo->binfo.pRes, pInfo->bufPageSize); - - pOperator->name = "SortedMerge"; - // pOperator->operatorType = OP_SortedMerge; - pOperator->blocking = true; - pOperator->status = OP_NOT_OPENED; - pOperator->info = pInfo; - pOperator->pTaskInfo = pTaskInfo; - - pOperator->fpSet = createOperatorFpSet(operatorDummyOpenFn, doSortedMerge, NULL, NULL, destroySortedMergeOperatorInfo, - NULL, NULL, NULL); - code = appendDownstream(pOperator, downstream, numOfDownstream); - if (code != TSDB_CODE_SUCCESS) { - goto _error; - } - - return pOperator; - -_error: - if (pInfo != NULL) { - destroySortedMergeOperatorInfo(pInfo, num); - } - - taosMemoryFreeClear(pInfo); - taosMemoryFreeClear(pOperator); - terrno = TSDB_CODE_QRY_OUT_OF_MEMORY; - return NULL; -} - int32_t getTableScanInfo(SOperatorInfo* pOperator, int32_t* order, int32_t* scanFlag) { // todo add more information about exchange operation int32_t type = pOperator->operatorType; @@ -3274,168 +3176,6 @@ int32_t handleLimitOffset(SOperatorInfo* pOperator, SLimitInfo* pLimitInfo, SSDa } } -static SSDataBlock* doProjectOperation(SOperatorInfo* pOperator) { - SProjectOperatorInfo* pProjectInfo = pOperator->info; - SOptrBasicInfo* pInfo = &pProjectInfo->binfo; - - SExprSupp* pSup = &pOperator->exprSupp; - SSDataBlock* pRes = pInfo->pRes; - SSDataBlock* pFinalRes = pProjectInfo->pFinalRes; - - blockDataCleanup(pFinalRes); - - SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo; - if (pOperator->status == OP_EXEC_DONE) { - if (pTaskInfo->execModel == OPTR_EXEC_MODEL_QUEUE) { - pOperator->status = OP_OPENED; - return NULL; - } - return NULL; - } - - int64_t st = 0; - int32_t order = 0; - int32_t scanFlag = 0; - - if (pOperator->cost.openCost == 0) { - st = taosGetTimestampUs(); - } - - SOperatorInfo* downstream = pOperator->pDownstream[0]; - SLimitInfo* pLimitInfo = &pProjectInfo->limitInfo; - - while(1) { - while (1) { - blockDataCleanup(pRes); - - // The downstream exec may change the value of the newgroup, so use a local variable instead. - SSDataBlock* pBlock = downstream->fpSet.getNextFn(downstream); - if (pBlock == NULL) { - doSetOperatorCompleted(pOperator); - break; - } - - if (pBlock->info.type == STREAM_RETRIEVE) { - // for stream interval - return pBlock; - } - - if (pLimitInfo->remainGroupOffset > 0) { - if (pLimitInfo->currentGroupId == 0 || pLimitInfo->currentGroupId == pBlock->info.groupId) { // it is the first group - pLimitInfo->currentGroupId = pBlock->info.groupId; - continue; - } else if (pLimitInfo->currentGroupId != pBlock->info.groupId) { - // now it is the data from a new group - pLimitInfo->remainGroupOffset -= 1; - pLimitInfo->currentGroupId = pBlock->info.groupId; - - // ignore data block in current group - if (pLimitInfo->remainGroupOffset > 0) { - continue; - } - } - - // set current group id of the project operator - pLimitInfo->currentGroupId = pBlock->info.groupId; - } - - // remainGroupOffset == 0 - // here check for a new group data, we need to handle the data of the previous group. - if (pLimitInfo->currentGroupId != 0 && pLimitInfo->currentGroupId != pBlock->info.groupId) { - pLimitInfo->numOfOutputGroups += 1; - if ((pLimitInfo->slimit.limit > 0) && (pLimitInfo->slimit.limit <= pLimitInfo->numOfOutputGroups)) { - doSetOperatorCompleted(pOperator); - break; - } - - // reset the value for a new group data - // existing rows that belongs to previous group. - pLimitInfo->numOfOutputRows = 0; - pLimitInfo->remainOffset = pLimitInfo->limit.offset; - } - - // the pDataBlock are always the same one, no need to call this again - int32_t code = getTableScanInfo(pOperator->pDownstream[0], &order, &scanFlag); - if (code != TSDB_CODE_SUCCESS) { - longjmp(pTaskInfo->env, code); - } - - setInputDataBlock(pOperator, pSup->pCtx, pBlock, order, scanFlag, false); - blockDataEnsureCapacity(pInfo->pRes, pInfo->pRes->info.rows + pBlock->info.rows); - - code = projectApplyFunctions(pSup->pExprInfo, pInfo->pRes, pBlock, pSup->pCtx, pSup->numOfExprs, - pProjectInfo->pPseudoColInfo); - if (code != TSDB_CODE_SUCCESS) { - longjmp(pTaskInfo->env, code); - } - - // set current group id - pLimitInfo->currentGroupId = pBlock->info.groupId; - - if (pLimitInfo->remainOffset >= pInfo->pRes->info.rows) { - pLimitInfo->remainOffset -= pInfo->pRes->info.rows; - blockDataCleanup(pInfo->pRes); - continue; - } else if (pLimitInfo->remainOffset < pInfo->pRes->info.rows && pLimitInfo->remainOffset > 0) { - blockDataTrimFirstNRows(pInfo->pRes, pLimitInfo->remainOffset); - pLimitInfo->remainOffset = 0; - } - - // check for the limitation in each group - if (pLimitInfo->limit.limit >= 0 && - pLimitInfo->numOfOutputRows + pInfo->pRes->info.rows >= pLimitInfo->limit.limit) { - int32_t keepRows = (int32_t)(pLimitInfo->limit.limit - pLimitInfo->numOfOutputRows); - blockDataKeepFirstNRows(pInfo->pRes, keepRows); - if (pLimitInfo->slimit.limit > 0 && pLimitInfo->slimit.limit <= pLimitInfo->numOfOutputGroups) { - pOperator->status = OP_EXEC_DONE; - } - } - - pLimitInfo->numOfOutputRows += pInfo->pRes->info.rows; - break; - } - - if (pProjectInfo->mergeDataBlocks) { - if (pRes->info.rows > 0) { - pFinalRes->info.groupId = pRes->info.groupId; - pFinalRes->info.version = pRes->info.version; - - // continue merge data, ignore the group id - blockDataMerge(pFinalRes, pRes); - if (pFinalRes->info.rows + pRes->info.rows <= pOperator->resultInfo.threshold) { - continue; - } - } - - // do apply filter - doFilter(pProjectInfo->pFilterNode, pFinalRes, NULL); - if (pFinalRes->info.rows > 0 || pRes->info.rows == 0) { - break; - } - } else { - // do apply filter - if (pRes->info.rows > 0) { - doFilter(pProjectInfo->pFilterNode, pRes, NULL); - if (pRes->info.rows == 0) { - continue; - } - } - - // no results generated - break; - } - } - - SSDataBlock* p = pProjectInfo->mergeDataBlocks ? pFinalRes : pRes; - pOperator->resultInfo.totalRows += p->info.rows; - - if (pOperator->cost.openCost == 0) { - pOperator->cost.openCost = (taosGetTimestampUs() - st) / 1000.0; - } - - return (p->info.rows > 0) ? p : NULL; -} - static void doHandleRemainBlockForNewGroupImpl(SFillOperatorInfo* pInfo, SResultInfo* pResultInfo, SExecTaskInfo* pTaskInfo) { pInfo->totalInputRows = pInfo->existNewGroupBlock->info.rows; @@ -3816,30 +3556,6 @@ void destroySFillOperatorInfo(void* param, int32_t numOfOutput) { taosMemoryFreeClear(param); } -static void destroyProjectOperatorInfo(void* param, int32_t numOfOutput) { - if (NULL == param) { - return; - } - SProjectOperatorInfo* pInfo = (SProjectOperatorInfo*)param; - cleanupBasicInfo(&pInfo->binfo); - cleanupAggSup(&pInfo->aggSup); - taosArrayDestroy(pInfo->pPseudoColInfo); - - blockDataDestroy(pInfo->pFinalRes); - taosMemoryFreeClear(param); -} - -static void destroyIndefinitOperatorInfo(void* param, int32_t numOfOutput) { - SIndefOperatorInfo* pInfo = (SIndefOperatorInfo*)param; - cleanupBasicInfo(&pInfo->binfo); - - taosArrayDestroy(pInfo->pPseudoColInfo); - cleanupAggSup(&pInfo->aggSup); - cleanupExprSupp(&pInfo->scalarSup); - - taosMemoryFreeClear(param); -} - void destroyExchangeOperatorInfo(void* param, int32_t numOfOutput) { SExchangeInfo* pExInfo = (SExchangeInfo*)param; taosRemoveRef(exchangeObjRefPool, pExInfo->self); @@ -3859,259 +3575,6 @@ void doDestroyExchangeOperatorInfo(void* param) { taosMemoryFreeClear(param); } -static SArray* setRowTsColumnOutputInfo(SqlFunctionCtx* pCtx, int32_t numOfCols) { - SArray* pList = taosArrayInit(4, sizeof(int32_t)); - for (int32_t i = 0; i < numOfCols; ++i) { - if (fmIsPseudoColumnFunc(pCtx[i].functionId)) { - taosArrayPush(pList, &i); - } - } - - return pList; -} - -SOperatorInfo* createProjectOperatorInfo(SOperatorInfo* downstream, SProjectPhysiNode* pProjPhyNode, - SExecTaskInfo* pTaskInfo) { - SProjectOperatorInfo* pInfo = taosMemoryCalloc(1, sizeof(SProjectOperatorInfo)); - SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo)); - if (pInfo == NULL || pOperator == NULL) { - goto _error; - } - - int32_t numOfCols = 0; - SExprInfo* pExprInfo = createExprInfo(pProjPhyNode->pProjections, NULL, &numOfCols); - - SSDataBlock* pResBlock = createResDataBlock(pProjPhyNode->node.pOutputDataBlockDesc); - initLimitInfo(pProjPhyNode->node.pLimit, pProjPhyNode->node.pSlimit, &pInfo->limitInfo); - - pInfo->binfo.pRes = pResBlock; - pInfo->pFinalRes = createOneDataBlock(pResBlock, false); - pInfo->pFilterNode = pProjPhyNode->node.pConditions; - pInfo->mergeDataBlocks = pProjPhyNode->mergeDataBlock; - - int32_t numOfRows = 4096; - size_t keyBufSize = sizeof(int64_t) + sizeof(int64_t) + POINTER_BYTES; - - // Make sure the size of SSDataBlock will never exceed the size of 2MB. - int32_t TWOMB = 2 * 1024 * 1024; - if (numOfRows * pResBlock->info.rowSize > TWOMB) { - numOfRows = TWOMB / pResBlock->info.rowSize; - } - initResultSizeInfo(&pOperator->resultInfo, numOfRows); - - initAggInfo(&pOperator->exprSupp, &pInfo->aggSup, pExprInfo, numOfCols, keyBufSize, pTaskInfo->id.str); - initBasicInfo(&pInfo->binfo, pResBlock); - setFunctionResultOutput(pOperator, &pInfo->binfo, &pInfo->aggSup, MAIN_SCAN, numOfCols); - - pInfo->pPseudoColInfo = setRowTsColumnOutputInfo(pOperator->exprSupp.pCtx, numOfCols); - pOperator->name = "ProjectOperator"; - pOperator->operatorType = QUERY_NODE_PHYSICAL_PLAN_PROJECT; - pOperator->blocking = false; - pOperator->status = OP_NOT_OPENED; - pOperator->info = pInfo; - pOperator->pTaskInfo = pTaskInfo; - - pOperator->fpSet = createOperatorFpSet(operatorDummyOpenFn, doProjectOperation, NULL, NULL, - destroyProjectOperatorInfo, NULL, NULL, NULL); - - int32_t code = appendDownstream(pOperator, &downstream, 1); - if (code != TSDB_CODE_SUCCESS) { - goto _error; - } - - return pOperator; - -_error: - pTaskInfo->code = TSDB_CODE_OUT_OF_MEMORY; - return NULL; -} - -static void doHandleDataBlock(SOperatorInfo* pOperator, SSDataBlock* pBlock, SOperatorInfo* downstream, - SExecTaskInfo* pTaskInfo) { - int32_t order = 0; - int32_t scanFlag = 0; - - SIndefOperatorInfo* pIndefInfo = pOperator->info; - SOptrBasicInfo* pInfo = &pIndefInfo->binfo; - SExprSupp* pSup = &pOperator->exprSupp; - - // the pDataBlock are always the same one, no need to call this again - int32_t code = getTableScanInfo(downstream, &order, &scanFlag); - if (code != TSDB_CODE_SUCCESS) { - longjmp(pTaskInfo->env, code); - } - - // there is an scalar expression that needs to be calculated before apply the group aggregation. - SExprSupp* pScalarSup = &pIndefInfo->scalarSup; - if (pScalarSup->pExprInfo != NULL) { - code = projectApplyFunctions(pScalarSup->pExprInfo, pBlock, pBlock, pScalarSup->pCtx, pScalarSup->numOfExprs, - pIndefInfo->pPseudoColInfo); - if (code != TSDB_CODE_SUCCESS) { - longjmp(pTaskInfo->env, code); - } - } - - setInputDataBlock(pOperator, pSup->pCtx, pBlock, order, scanFlag, false); - blockDataEnsureCapacity(pInfo->pRes, pInfo->pRes->info.rows + pBlock->info.rows); - - code = projectApplyFunctions(pSup->pExprInfo, pInfo->pRes, pBlock, pSup->pCtx, pSup->numOfExprs, - pIndefInfo->pPseudoColInfo); - if (code != TSDB_CODE_SUCCESS) { - longjmp(pTaskInfo->env, code); - } -} - -static SSDataBlock* doApplyIndefinitFunction(SOperatorInfo* pOperator) { - SIndefOperatorInfo* pIndefInfo = pOperator->info; - SOptrBasicInfo* pInfo = &pIndefInfo->binfo; - SExprSupp* pSup = &pOperator->exprSupp; - - SSDataBlock* pRes = pInfo->pRes; - blockDataCleanup(pRes); - - SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo; - if (pOperator->status == OP_EXEC_DONE) { - return NULL; - } - - int64_t st = 0; - - if (pOperator->cost.openCost == 0) { - st = taosGetTimestampUs(); - } - - SOperatorInfo* downstream = pOperator->pDownstream[0]; - - while (1) { - // here we need to handle the existsed group results - if (pIndefInfo->pNextGroupRes != NULL) { // todo extract method - for (int32_t k = 0; k < pSup->numOfExprs; ++k) { - SqlFunctionCtx* pCtx = &pSup->pCtx[k]; - - SResultRowEntryInfo* pResInfo = GET_RES_INFO(pCtx); - pResInfo->initialized = false; - pCtx->pOutput = NULL; - } - - doHandleDataBlock(pOperator, pIndefInfo->pNextGroupRes, downstream, pTaskInfo); - pIndefInfo->pNextGroupRes = NULL; - } - - if (pInfo->pRes->info.rows < pOperator->resultInfo.threshold) { - while (1) { - // The downstream exec may change the value of the newgroup, so use a local variable instead. - SSDataBlock* pBlock = downstream->fpSet.getNextFn(downstream); - if (pBlock == NULL) { - doSetOperatorCompleted(pOperator); - break; - } - - if (pIndefInfo->groupId == 0 && pBlock->info.groupId != 0) { - pIndefInfo->groupId = pBlock->info.groupId; // this is the initial group result - } else { - if (pIndefInfo->groupId != pBlock->info.groupId) { // reset output buffer and computing status - pIndefInfo->groupId = pBlock->info.groupId; - pIndefInfo->pNextGroupRes = pBlock; - break; - } - } - - doHandleDataBlock(pOperator, pBlock, downstream, pTaskInfo); - if (pInfo->pRes->info.rows >= pOperator->resultInfo.threshold) { - break; - } - } - } - - doFilter(pIndefInfo->pCondition, pInfo->pRes, NULL); - size_t rows = pInfo->pRes->info.rows; - if (rows > 0 || pOperator->status == OP_EXEC_DONE) { - break; - } else { - blockDataCleanup(pInfo->pRes); - } - } - - size_t rows = pInfo->pRes->info.rows; - pOperator->resultInfo.totalRows += rows; - - if (pOperator->cost.openCost == 0) { - pOperator->cost.openCost = (taosGetTimestampUs() - st) / 1000.0; - } - - return (rows > 0) ? pInfo->pRes : NULL; -} - -SOperatorInfo* createIndefinitOutputOperatorInfo(SOperatorInfo* downstream, SPhysiNode* pNode, - SExecTaskInfo* pTaskInfo) { - SIndefOperatorInfo* pInfo = taosMemoryCalloc(1, sizeof(SIndefOperatorInfo)); - SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo)); - if (pInfo == NULL || pOperator == NULL) { - goto _error; - } - - SExprSupp* pSup = &pOperator->exprSupp; - - SIndefRowsFuncPhysiNode* pPhyNode = (SIndefRowsFuncPhysiNode*)pNode; - - int32_t numOfExpr = 0; - SExprInfo* pExprInfo = createExprInfo(pPhyNode->pFuncs, NULL, &numOfExpr); - - if (pPhyNode->pExprs != NULL) { - int32_t num = 0; - SExprInfo* pSExpr = createExprInfo(pPhyNode->pExprs, NULL, &num); - int32_t code = initExprSupp(&pInfo->scalarSup, pSExpr, num); - if (code != TSDB_CODE_SUCCESS) { - goto _error; - } - } - - SSDataBlock* pResBlock = createResDataBlock(pPhyNode->node.pOutputDataBlockDesc); - - int32_t numOfRows = 4096; - size_t keyBufSize = sizeof(int64_t) + sizeof(int64_t) + POINTER_BYTES; - - // Make sure the size of SSDataBlock will never exceed the size of 2MB. - int32_t TWOMB = 2 * 1024 * 1024; - if (numOfRows * pResBlock->info.rowSize > TWOMB) { - numOfRows = TWOMB / pResBlock->info.rowSize; - } - - initResultSizeInfo(&pOperator->resultInfo, numOfRows); - - initAggInfo(pSup, &pInfo->aggSup, pExprInfo, numOfExpr, keyBufSize, pTaskInfo->id.str); - initBasicInfo(&pInfo->binfo, pResBlock); - - setFunctionResultOutput(pOperator, &pInfo->binfo, &pInfo->aggSup, MAIN_SCAN, numOfExpr); - - pInfo->binfo.pRes = pResBlock; - pInfo->pCondition = pPhyNode->node.pConditions; - pInfo->pPseudoColInfo = setRowTsColumnOutputInfo(pSup->pCtx, numOfExpr); - - pOperator->name = "IndefinitOperator"; - pOperator->operatorType = QUERY_NODE_PHYSICAL_PLAN_INDEF_ROWS_FUNC; - pOperator->blocking = false; - pOperator->status = OP_NOT_OPENED; - pOperator->info = pInfo; - pOperator->pTaskInfo = pTaskInfo; - - pOperator->fpSet = createOperatorFpSet(operatorDummyOpenFn, doApplyIndefinitFunction, NULL, NULL, - destroyIndefinitOperatorInfo, NULL, NULL, NULL); - - int32_t code = appendDownstream(pOperator, &downstream, 1); - if (code != TSDB_CODE_SUCCESS) { - goto _error; - } - - return pOperator; - -_error: - taosMemoryFree(pInfo); - taosMemoryFree(pOperator); - pTaskInfo->code = TSDB_CODE_OUT_OF_MEMORY; - return NULL; -} - static int32_t initFillInfo(SFillOperatorInfo* pInfo, SExprInfo* pExpr, int32_t numOfCols, SNodeListNode* pValNode, STimeWindow win, int32_t capacity, const char* id, SInterval* pInterval, int32_t fillType) { SFillColInfo* pColInfo = createFillColInfo(pExpr, numOfCols, pValNode); @@ -4504,7 +3967,6 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo return createSysTableScanOperatorInfo(pHandle, pSysScanPhyNode, pUser, pTaskInfo); } else if (QUERY_NODE_PHYSICAL_PLAN_TAG_SCAN == type) { STagScanPhysiNode* pScanPhyNode = (STagScanPhysiNode*)pPhyNode; - int32_t code = getTableList(pHandle->meta, pHandle->vnode, pScanPhyNode, pTagCond, pTagIndexCond, pTableListInfo); if (code != TSDB_CODE_SUCCESS) { pTaskInfo->code = terrno; @@ -4555,6 +4017,8 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo } return createLastrowScanOperator(pScanNode, pHandle, pTaskInfo); + } else if (QUERY_NODE_PHYSICAL_PLAN_PROJECT == type) { + return createProjectOperatorInfo(NULL, (SProjectPhysiNode*)pPhyNode, pTaskInfo); } else { ASSERT(0); } diff --git a/source/libs/executor/src/projectoperator.c b/source/libs/executor/src/projectoperator.c new file mode 100644 index 0000000000..87ba0006e1 --- /dev/null +++ b/source/libs/executor/src/projectoperator.c @@ -0,0 +1,585 @@ +/* + * 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 "executorimpl.h" +#include "functionMgt.h" + +static SSDataBlock* doGenerateSourceData(SOperatorInfo* pOperator); +static SSDataBlock* doProjectOperation(SOperatorInfo* pOperator); +static SSDataBlock* doApplyIndefinitFunction(SOperatorInfo* pOperator); +static SArray* setRowTsColumnOutputInfo(SqlFunctionCtx* pCtx, int32_t numOfCols); +static void setFunctionResultOutput(SOperatorInfo* pOperator, SOptrBasicInfo* pInfo, SAggSupporter* pSup, int32_t stage, + int32_t numOfExprs); + +static void destroyProjectOperatorInfo(void* param, int32_t numOfOutput) { + if (NULL == param) { + return; + } + + SProjectOperatorInfo* pInfo = (SProjectOperatorInfo*)param; + cleanupBasicInfo(&pInfo->binfo); + cleanupAggSup(&pInfo->aggSup); + taosArrayDestroy(pInfo->pPseudoColInfo); + + blockDataDestroy(pInfo->pFinalRes); + taosMemoryFreeClear(param); +} + +static void destroyIndefinitOperatorInfo(void* param, int32_t numOfOutput) { + SIndefOperatorInfo* pInfo = (SIndefOperatorInfo*)param; + cleanupBasicInfo(&pInfo->binfo); + + taosArrayDestroy(pInfo->pPseudoColInfo); + cleanupAggSup(&pInfo->aggSup); + cleanupExprSupp(&pInfo->scalarSup); + + taosMemoryFreeClear(param); +} + +SOperatorInfo* createProjectOperatorInfo(SOperatorInfo* downstream, SProjectPhysiNode* pProjPhyNode, + SExecTaskInfo* pTaskInfo) { + SProjectOperatorInfo* pInfo = taosMemoryCalloc(1, sizeof(SProjectOperatorInfo)); + SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo)); + if (pInfo == NULL || pOperator == NULL) { + goto _error; + } + + int32_t numOfCols = 0; + SExprInfo* pExprInfo = createExprInfo(pProjPhyNode->pProjections, NULL, &numOfCols); + + SSDataBlock* pResBlock = createResDataBlock(pProjPhyNode->node.pOutputDataBlockDesc); + initLimitInfo(pProjPhyNode->node.pLimit, pProjPhyNode->node.pSlimit, &pInfo->limitInfo); + + pInfo->binfo.pRes = pResBlock; + pInfo->pFinalRes = createOneDataBlock(pResBlock, false); + pInfo->pFilterNode = pProjPhyNode->node.pConditions; + pInfo->mergeDataBlocks = pProjPhyNode->mergeDataBlock; + + int32_t numOfRows = 4096; + size_t keyBufSize = sizeof(int64_t) + sizeof(int64_t) + POINTER_BYTES; + + // Make sure the size of SSDataBlock will never exceed the size of 2MB. + int32_t TWOMB = 2 * 1024 * 1024; + if (numOfRows * pResBlock->info.rowSize > TWOMB) { + numOfRows = TWOMB / pResBlock->info.rowSize; + } + initResultSizeInfo(&pOperator->resultInfo, numOfRows); + + initAggInfo(&pOperator->exprSupp, &pInfo->aggSup, pExprInfo, numOfCols, keyBufSize, pTaskInfo->id.str); + initBasicInfo(&pInfo->binfo, pResBlock); + setFunctionResultOutput(pOperator, &pInfo->binfo, &pInfo->aggSup, MAIN_SCAN, numOfCols); + + pInfo->pPseudoColInfo = setRowTsColumnOutputInfo(pOperator->exprSupp.pCtx, numOfCols); + pOperator->name = "ProjectOperator"; + pOperator->operatorType = QUERY_NODE_PHYSICAL_PLAN_PROJECT; + pOperator->blocking = false; + pOperator->status = OP_NOT_OPENED; + pOperator->info = pInfo; + pOperator->pTaskInfo = pTaskInfo; + + pOperator->fpSet = createOperatorFpSet(operatorDummyOpenFn, doProjectOperation, NULL, NULL, + destroyProjectOperatorInfo, NULL, NULL, NULL); + + int32_t code = appendDownstream(pOperator, &downstream, 1); + if (code != TSDB_CODE_SUCCESS) { + goto _error; + } + + return pOperator; + + _error: + pTaskInfo->code = TSDB_CODE_OUT_OF_MEMORY; + return NULL; +} + +static int32_t discardGroupDataBlock(SSDataBlock* pBlock, SLimitInfo* pLimitInfo) { + if (pLimitInfo->remainGroupOffset > 0) { + // it is the first group + if (pLimitInfo->currentGroupId == 0 || pLimitInfo->currentGroupId == pBlock->info.groupId) { + pLimitInfo->currentGroupId = pBlock->info.groupId; + return PROJECT_RETRIEVE_CONTINUE; + } else if (pLimitInfo->currentGroupId != pBlock->info.groupId) { + // now it is the data from a new group + pLimitInfo->remainGroupOffset -= 1; + pLimitInfo->currentGroupId = pBlock->info.groupId; + + // ignore data block in current group + if (pLimitInfo->remainGroupOffset > 0) { + return PROJECT_RETRIEVE_CONTINUE; + } + } + + // set current group id of the project operator + pLimitInfo->currentGroupId = pBlock->info.groupId; + } + + return PROJECT_RETRIEVE_DONE; +} + +static int32_t setInfoForNewGroup(SSDataBlock* pBlock, SLimitInfo* pLimitInfo, SOperatorInfo* pOperator) { + // remainGroupOffset == 0 + // here check for a new group data, we need to handle the data of the previous group. + ASSERT(pLimitInfo->remainGroupOffset == 0); + + if (pLimitInfo->currentGroupId != 0 && pLimitInfo->currentGroupId != pBlock->info.groupId) { + pLimitInfo->numOfOutputGroups += 1; + if ((pLimitInfo->slimit.limit > 0) && (pLimitInfo->slimit.limit <= pLimitInfo->numOfOutputGroups)) { + doSetOperatorCompleted(pOperator); + return PROJECT_RETRIEVE_DONE; + } + + // reset the value for a new group data + // existing rows that belongs to previous group. + pLimitInfo->numOfOutputRows = 0; + pLimitInfo->remainOffset = pLimitInfo->limit.offset; + } + + return PROJECT_RETRIEVE_DONE; +} + +static int32_t doIngroupLimitOffset(SLimitInfo* pLimitInfo, uint64_t groupId, SSDataBlock* pBlock, SOperatorInfo* pOperator) { + // set current group id + pLimitInfo->currentGroupId = groupId; + + if (pLimitInfo->remainOffset >= pBlock->info.rows) { + pLimitInfo->remainOffset -= pBlock->info.rows; + blockDataCleanup(pBlock); + return PROJECT_RETRIEVE_CONTINUE; + } else if (pLimitInfo->remainOffset < pBlock->info.rows && pLimitInfo->remainOffset > 0) { + blockDataTrimFirstNRows(pBlock, pLimitInfo->remainOffset); + pLimitInfo->remainOffset = 0; + } + + // check for the limitation in each group + if (pLimitInfo->limit.limit >= 0 && + pLimitInfo->numOfOutputRows + pBlock->info.rows >= pLimitInfo->limit.limit) { + int32_t keepRows = (int32_t)(pLimitInfo->limit.limit - pLimitInfo->numOfOutputRows); + blockDataKeepFirstNRows(pBlock, keepRows); + if (pLimitInfo->slimit.limit > 0 && pLimitInfo->slimit.limit <= pLimitInfo->numOfOutputGroups) { + doSetOperatorCompleted(pOperator); + } + } + + pLimitInfo->numOfOutputRows += pBlock->info.rows; + return PROJECT_RETRIEVE_DONE; +} + +SSDataBlock* doProjectOperation(SOperatorInfo* pOperator) { + SProjectOperatorInfo* pProjectInfo = pOperator->info; + SOptrBasicInfo* pInfo = &pProjectInfo->binfo; + + SExprSupp* pSup = &pOperator->exprSupp; + SSDataBlock* pRes = pInfo->pRes; + SSDataBlock* pFinalRes = pProjectInfo->pFinalRes; + + blockDataCleanup(pFinalRes); + + SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo; + if (pOperator->status == OP_EXEC_DONE) { + if (pTaskInfo->execModel == OPTR_EXEC_MODEL_QUEUE) { + pOperator->status = OP_OPENED; + return NULL; + } + + return NULL; + } + + int64_t st = 0; + int32_t order = 0; + int32_t scanFlag = 0; + + if (pOperator->cost.openCost == 0) { + st = taosGetTimestampUs(); + } + + SOperatorInfo* downstream = pOperator->pDownstream[0]; + SLimitInfo* pLimitInfo = &pProjectInfo->limitInfo; + + if (downstream == NULL) { + return doGenerateSourceData(pOperator); + } + + while (1) { + while (1) { + blockDataCleanup(pRes); + + // The downstream exec may change the value of the newgroup, so use a local variable instead. + SSDataBlock* pBlock = downstream->fpSet.getNextFn(downstream); + if (pBlock == NULL) { + doSetOperatorCompleted(pOperator); + break; + } + + // for stream interval + if (pBlock->info.type == STREAM_RETRIEVE) { + return pBlock; + } + + int32_t status = discardGroupDataBlock(pBlock, pLimitInfo); + if (status == PROJECT_RETRIEVE_CONTINUE) { + continue; + } + + setInfoForNewGroup(pBlock, pLimitInfo, pOperator); + if (pOperator->status == OP_EXEC_DONE) { + break; + } + + // the pDataBlock are always the same one, no need to call this again + int32_t code = getTableScanInfo(downstream, &order, &scanFlag); + if (code != TSDB_CODE_SUCCESS) { + longjmp(pTaskInfo->env, code); + } + + setInputDataBlock(pOperator, pSup->pCtx, pBlock, order, scanFlag, false); + blockDataEnsureCapacity(pInfo->pRes, pInfo->pRes->info.rows + pBlock->info.rows); + + code = projectApplyFunctions(pSup->pExprInfo, pInfo->pRes, pBlock, pSup->pCtx, pSup->numOfExprs, + pProjectInfo->pPseudoColInfo); + if (code != TSDB_CODE_SUCCESS) { + longjmp(pTaskInfo->env, code); + } + + status = doIngroupLimitOffset(pLimitInfo, pBlock->info.groupId, pInfo->pRes, pOperator); + if (status == PROJECT_RETRIEVE_CONTINUE) { + continue; + } + + break; + } + + if (pProjectInfo->mergeDataBlocks) { + if (pRes->info.rows > 0) { + pFinalRes->info.groupId = pRes->info.groupId; + pFinalRes->info.version = pRes->info.version; + + // continue merge data, ignore the group id + blockDataMerge(pFinalRes, pRes); + if (pFinalRes->info.rows + pRes->info.rows <= pOperator->resultInfo.threshold) { + continue; + } + } + + // do apply filter + doFilter(pProjectInfo->pFilterNode, pFinalRes, NULL); + if (pFinalRes->info.rows > 0 || pRes->info.rows == 0) { + break; + } + } else { + // do apply filter + if (pRes->info.rows > 0) { + doFilter(pProjectInfo->pFilterNode, pRes, NULL); + if (pRes->info.rows == 0) { + continue; + } + } + + // no results generated + break; + } + } + + SSDataBlock* p = pProjectInfo->mergeDataBlocks ? pFinalRes : pRes; + pOperator->resultInfo.totalRows += p->info.rows; + + if (pOperator->cost.openCost == 0) { + pOperator->cost.openCost = (taosGetTimestampUs() - st) / 1000.0; + } + + return (p->info.rows > 0) ? p : NULL; +} + +SOperatorInfo* createIndefinitOutputOperatorInfo(SOperatorInfo* downstream, SPhysiNode* pNode, + SExecTaskInfo* pTaskInfo) { + SIndefOperatorInfo* pInfo = taosMemoryCalloc(1, sizeof(SIndefOperatorInfo)); + SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo)); + if (pInfo == NULL || pOperator == NULL) { + goto _error; + } + + SExprSupp* pSup = &pOperator->exprSupp; + + SIndefRowsFuncPhysiNode* pPhyNode = (SIndefRowsFuncPhysiNode*)pNode; + + int32_t numOfExpr = 0; + SExprInfo* pExprInfo = createExprInfo(pPhyNode->pFuncs, NULL, &numOfExpr); + + if (pPhyNode->pExprs != NULL) { + int32_t num = 0; + SExprInfo* pSExpr = createExprInfo(pPhyNode->pExprs, NULL, &num); + int32_t code = initExprSupp(&pInfo->scalarSup, pSExpr, num); + if (code != TSDB_CODE_SUCCESS) { + goto _error; + } + } + + SSDataBlock* pResBlock = createResDataBlock(pPhyNode->node.pOutputDataBlockDesc); + + int32_t numOfRows = 4096; + size_t keyBufSize = sizeof(int64_t) + sizeof(int64_t) + POINTER_BYTES; + + // Make sure the size of SSDataBlock will never exceed the size of 2MB. + int32_t TWOMB = 2 * 1024 * 1024; + if (numOfRows * pResBlock->info.rowSize > TWOMB) { + numOfRows = TWOMB / pResBlock->info.rowSize; + } + + initResultSizeInfo(&pOperator->resultInfo, numOfRows); + + initAggInfo(pSup, &pInfo->aggSup, pExprInfo, numOfExpr, keyBufSize, pTaskInfo->id.str); + initBasicInfo(&pInfo->binfo, pResBlock); + + setFunctionResultOutput(pOperator, &pInfo->binfo, &pInfo->aggSup, MAIN_SCAN, numOfExpr); + + pInfo->binfo.pRes = pResBlock; + pInfo->pCondition = pPhyNode->node.pConditions; + pInfo->pPseudoColInfo = setRowTsColumnOutputInfo(pSup->pCtx, numOfExpr); + + pOperator->name = "IndefinitOperator"; + pOperator->operatorType = QUERY_NODE_PHYSICAL_PLAN_INDEF_ROWS_FUNC; + pOperator->blocking = false; + pOperator->status = OP_NOT_OPENED; + pOperator->info = pInfo; + pOperator->pTaskInfo = pTaskInfo; + + pOperator->fpSet = createOperatorFpSet(operatorDummyOpenFn, doApplyIndefinitFunction, NULL, NULL, + destroyIndefinitOperatorInfo, NULL, NULL, NULL); + + int32_t code = appendDownstream(pOperator, &downstream, 1); + if (code != TSDB_CODE_SUCCESS) { + goto _error; + } + + return pOperator; + + _error: + taosMemoryFree(pInfo); + taosMemoryFree(pOperator); + pTaskInfo->code = TSDB_CODE_OUT_OF_MEMORY; + return NULL; +} + +static void doHandleDataBlock(SOperatorInfo* pOperator, SSDataBlock* pBlock, SOperatorInfo* downstream, + SExecTaskInfo* pTaskInfo) { + int32_t order = 0; + int32_t scanFlag = 0; + + SIndefOperatorInfo* pIndefInfo = pOperator->info; + SOptrBasicInfo* pInfo = &pIndefInfo->binfo; + SExprSupp* pSup = &pOperator->exprSupp; + + // the pDataBlock are always the same one, no need to call this again + int32_t code = getTableScanInfo(downstream, &order, &scanFlag); + if (code != TSDB_CODE_SUCCESS) { + longjmp(pTaskInfo->env, code); + } + + // there is an scalar expression that needs to be calculated before apply the group aggregation. + SExprSupp* pScalarSup = &pIndefInfo->scalarSup; + if (pScalarSup->pExprInfo != NULL) { + code = projectApplyFunctions(pScalarSup->pExprInfo, pBlock, pBlock, pScalarSup->pCtx, pScalarSup->numOfExprs, + pIndefInfo->pPseudoColInfo); + if (code != TSDB_CODE_SUCCESS) { + longjmp(pTaskInfo->env, code); + } + } + + setInputDataBlock(pOperator, pSup->pCtx, pBlock, order, scanFlag, false); + blockDataEnsureCapacity(pInfo->pRes, pInfo->pRes->info.rows + pBlock->info.rows); + + code = projectApplyFunctions(pSup->pExprInfo, pInfo->pRes, pBlock, pSup->pCtx, pSup->numOfExprs, + pIndefInfo->pPseudoColInfo); + if (code != TSDB_CODE_SUCCESS) { + longjmp(pTaskInfo->env, code); + } +} + +SSDataBlock* doApplyIndefinitFunction(SOperatorInfo* pOperator) { + SIndefOperatorInfo* pIndefInfo = pOperator->info; + SOptrBasicInfo* pInfo = &pIndefInfo->binfo; + SExprSupp* pSup = &pOperator->exprSupp; + + SSDataBlock* pRes = pInfo->pRes; + blockDataCleanup(pRes); + + SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo; + if (pOperator->status == OP_EXEC_DONE) { + return NULL; + } + + int64_t st = 0; + + if (pOperator->cost.openCost == 0) { + st = taosGetTimestampUs(); + } + + SOperatorInfo* downstream = pOperator->pDownstream[0]; + + while (1) { + // here we need to handle the existsed group results + if (pIndefInfo->pNextGroupRes != NULL) { // todo extract method + for (int32_t k = 0; k < pSup->numOfExprs; ++k) { + SqlFunctionCtx* pCtx = &pSup->pCtx[k]; + + SResultRowEntryInfo* pResInfo = GET_RES_INFO(pCtx); + pResInfo->initialized = false; + pCtx->pOutput = NULL; + } + + doHandleDataBlock(pOperator, pIndefInfo->pNextGroupRes, downstream, pTaskInfo); + pIndefInfo->pNextGroupRes = NULL; + } + + if (pInfo->pRes->info.rows < pOperator->resultInfo.threshold) { + while (1) { + // The downstream exec may change the value of the newgroup, so use a local variable instead. + SSDataBlock* pBlock = downstream->fpSet.getNextFn(downstream); + if (pBlock == NULL) { + doSetOperatorCompleted(pOperator); + break; + } + + if (pIndefInfo->groupId == 0 && pBlock->info.groupId != 0) { + pIndefInfo->groupId = pBlock->info.groupId; // this is the initial group result + } else { + if (pIndefInfo->groupId != pBlock->info.groupId) { // reset output buffer and computing status + pIndefInfo->groupId = pBlock->info.groupId; + pIndefInfo->pNextGroupRes = pBlock; + break; + } + } + + doHandleDataBlock(pOperator, pBlock, downstream, pTaskInfo); + if (pInfo->pRes->info.rows >= pOperator->resultInfo.threshold) { + break; + } + } + } + + doFilter(pIndefInfo->pCondition, pInfo->pRes, NULL); + size_t rows = pInfo->pRes->info.rows; + if (rows > 0 || pOperator->status == OP_EXEC_DONE) { + break; + } else { + blockDataCleanup(pInfo->pRes); + } + } + + size_t rows = pInfo->pRes->info.rows; + pOperator->resultInfo.totalRows += rows; + + if (pOperator->cost.openCost == 0) { + pOperator->cost.openCost = (taosGetTimestampUs() - st) / 1000.0; + } + + return (rows > 0) ? pInfo->pRes : NULL; +} + +void initCtxOutputBuffer(SqlFunctionCtx* pCtx, int32_t size) { + for (int32_t j = 0; j < size; ++j) { + struct SResultRowEntryInfo* pResInfo = GET_RES_INFO(&pCtx[j]); + if (isRowEntryInitialized(pResInfo) || fmIsPseudoColumnFunc(pCtx[j].functionId) || pCtx[j].functionId == -1 || + fmIsScalarFunc(pCtx[j].functionId)) { + continue; + } + + pCtx[j].fpSet.init(&pCtx[j], pCtx[j].resultInfo); + } +} + +/* + * The start of each column SResultRowEntryInfo is denote by RowCellInfoOffset. + * Note that in case of top/bottom query, the whole multiple rows of result is treated as only one row of results. + * +------------+-----------------result column 1------------+------------------result column 2-----------+ + * | SResultRow | SResultRowEntryInfo | intermediate buffer1 | SResultRowEntryInfo | intermediate buffer 2| + * +------------+--------------------------------------------+--------------------------------------------+ + * offset[0] offset[1] offset[2] + */ +// TODO refactor: some function move away +void setFunctionResultOutput(SOperatorInfo* pOperator, SOptrBasicInfo* pInfo, SAggSupporter* pSup, int32_t stage, + int32_t numOfExprs) { + SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo; + SqlFunctionCtx* pCtx = pOperator->exprSupp.pCtx; + int32_t* rowEntryInfoOffset = pOperator->exprSupp.rowEntryInfoOffset; + + SResultRowInfo* pResultRowInfo = &pInfo->resultRowInfo; + initResultRowInfo(pResultRowInfo); + + int64_t tid = 0; + int64_t groupId = 0; + SResultRow* pRow = doSetResultOutBufByKey(pSup->pResultBuf, pResultRowInfo, (char*)&tid, sizeof(tid), true, groupId, + pTaskInfo, false, pSup); + + for (int32_t i = 0; i < numOfExprs; ++i) { + struct SResultRowEntryInfo* pEntry = getResultEntryInfo(pRow, i, rowEntryInfoOffset); + cleanupResultRowEntry(pEntry); + + pCtx[i].resultInfo = pEntry; + pCtx[i].scanFlag = stage; + } + + initCtxOutputBuffer(pCtx, numOfExprs); +} + +SArray* setRowTsColumnOutputInfo(SqlFunctionCtx* pCtx, int32_t numOfCols) { + SArray* pList = taosArrayInit(4, sizeof(int32_t)); + for (int32_t i = 0; i < numOfCols; ++i) { + if (fmIsPseudoColumnFunc(pCtx[i].functionId)) { + taosArrayPush(pList, &i); + } + } + + return pList; +} + +SSDataBlock* doGenerateSourceData(SOperatorInfo* pOperator) { + SProjectOperatorInfo* pProjectInfo = pOperator->info; + + SExprSupp* pSup = &pOperator->exprSupp; + SSDataBlock* pRes = pProjectInfo->binfo.pRes; + + blockDataEnsureCapacity(pRes, pOperator->resultInfo.capacity); + SExprInfo* pExpr = pSup->pExprInfo; + + int64_t st = taosGetTimestampUs(); + + for (int32_t k = 0; k < pSup->numOfExprs; ++k) { + int32_t outputSlotId = pExpr[k].base.resSchema.slotId; + + ASSERT(pExpr[k].pExpr->nodeType == QUERY_NODE_VALUE); + SColumnInfoData* pColInfoData = taosArrayGet(pRes->pDataBlock, outputSlotId); + + int32_t type = pExpr[k].base.pParam[0].param.nType; + if (TSDB_DATA_TYPE_NULL == type) { + colDataAppendNNULL(pColInfoData, 0, 1); + } else { + colDataAppend(pColInfoData, 0, taosVariantGet(&pExpr[k].base.pParam[0].param, type), false); + } + } + + pRes->info.rows = 1; + doFilter(pProjectInfo->pFilterNode, pRes, NULL); + + /*int32_t status = */doIngroupLimitOffset(&pProjectInfo->limitInfo, 0, pRes, pOperator); + + pOperator->resultInfo.totalRows += pRes->info.rows; + + doSetOperatorCompleted(pOperator); + if (pOperator->cost.openCost == 0) { + pOperator->cost.openCost = (taosGetTimestampUs() - st) / 1000.0; + } + + return (pRes->info.rows > 0) ? pRes : NULL; +} \ No newline at end of file From 7f2d0dc077c954386d14cd7ea82fb07a47976d79 Mon Sep 17 00:00:00 2001 From: Minghao Li Date: Mon, 25 Jul 2022 14:26:41 +0800 Subject: [PATCH 04/54] refactor(sync): add entry cache test --- source/libs/sync/test/syncEntryCacheTest.cpp | 30 ++++++++++++++++++-- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/source/libs/sync/test/syncEntryCacheTest.cpp b/source/libs/sync/test/syncEntryCacheTest.cpp index 1b3d68f959..ed6f48fafe 100644 --- a/source/libs/sync/test/syncEntryCacheTest.cpp +++ b/source/libs/sync/test/syncEntryCacheTest.cpp @@ -143,14 +143,36 @@ void test4() { SSyncRaftEntry* pAcquireEntry = (SSyncRaftEntry*)taosAcquireRef(testRefId, rid); syncEntryLog2((char*)"acquire: ", pAcquireEntry); + taosAcquireRef(testRefId, rid); taosAcquireRef(testRefId, rid); taosAcquireRef(testRefId, rid); - taosReleaseRef(testRefId, rid); + //taosReleaseRef(testRefId, rid); //taosReleaseRef(testRefId, rid); } while (0); taosRemoveRef(testRefId, rid); + + for (int i = 0; i < 10; ++i) { + sTrace("taosReleaseRef, %d", i); + taosReleaseRef(testRefId, rid); + } +} + +void test5() { + int32_t testRefId = taosOpenRef(5, freeObj); + for (int i = 0; i < 100; i++) { + SSyncRaftEntry* pEntry = createEntry(i); + ASSERT(pEntry != NULL); + + int64_t rid = taosAddRef(testRefId, pEntry); + sTrace("rid: %ld", rid); + } + + for (int64_t rid = 2; rid < 101; rid++) { + SSyncRaftEntry* pAcquireEntry = (SSyncRaftEntry*)taosAcquireRef(testRefId, rid); + syncEntryLog2((char*)"taosAcquireRef: ", pAcquireEntry); + } } int main(int argc, char** argv) { @@ -158,11 +180,13 @@ int main(int argc, char** argv) { tsAsyncLog = 0; sDebugFlag = DEBUG_TRACE + DEBUG_SCREEN + DEBUG_FILE + DEBUG_DEBUG; +/* test1(); test2(); test3(); - - //test4(); +*/ + test4(); + //test5(); return 0; } From 135d2673d6d5e8ea255064c0c70f937615a51aa3 Mon Sep 17 00:00:00 2001 From: Cary Xu Date: Mon, 25 Jul 2022 14:50:13 +0800 Subject: [PATCH 05/54] fix: add data len for multiple rows --- source/common/src/tdatablock.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/common/src/tdatablock.c b/source/common/src/tdatablock.c index f64a0df36f..f0b5de9838 100644 --- a/source/common/src/tdatablock.c +++ b/source/common/src/tdatablock.c @@ -1878,7 +1878,7 @@ int32_t buildSubmitReqFromDataBlock(SSubmitReq** pReq, const SArray* pDataBlocks msgLen += sizeof(SSubmitBlk); int32_t dataLen = 0; for (int32_t j = 0; j < rows; ++j) { // iterate by row - tdSRowResetBuf(&rb, POINTER_SHIFT(pDataBuf, msgLen)); // set row buf + tdSRowResetBuf(&rb, POINTER_SHIFT(pDataBuf, msgLen + dataLen)); // set row buf bool isStartKey = false; int32_t offset = 0; for (int32_t k = 0; k < colNum; ++k) { // iterate by column From 015193e81609fae5b75699f0dd9730644ac7ad89 Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Mon, 25 Jul 2022 15:17:53 +0800 Subject: [PATCH 06/54] feat: super table order by primary key optimization --- include/libs/nodes/plannodes.h | 9 ++-- source/libs/command/src/explain.c | 15 +++--- source/libs/executor/inc/executorimpl.h | 45 +++++++++++++++++- source/libs/executor/src/executorimpl.c | 22 +++++---- source/libs/executor/src/joinoperator.c | 26 +++++----- source/libs/executor/src/scanoperator.c | 55 ++++------------------ source/libs/nodes/src/nodesCodeFuncs.c | 4 +- source/libs/nodes/src/nodesTraverseFuncs.c | 2 +- source/libs/nodes/src/nodesUtilFuncs.c | 4 +- source/libs/parser/src/parInsert.c | 14 +++--- source/libs/parser/src/parUtil.c | 2 +- source/libs/planner/src/planOptimizer.c | 35 ++++++++++---- source/libs/planner/src/planPhysiCreater.c | 4 +- source/libs/planner/src/planSpliter.c | 19 ++++---- source/util/src/terror.c | 2 +- 15 files changed, 147 insertions(+), 111 deletions(-) diff --git a/include/libs/nodes/plannodes.h b/include/libs/nodes/plannodes.h index e382fa4efd..ba16acf7b0 100644 --- a/include/libs/nodes/plannodes.h +++ b/include/libs/nodes/plannodes.h @@ -104,6 +104,7 @@ typedef struct SJoinLogicNode { SNode* pMergeCondition; SNode* pOnConditions; bool isSingleTableJoin; + EOrder inputTsOrder; } SJoinLogicNode; typedef struct SAggLogicNode { @@ -201,6 +202,7 @@ typedef struct SWindowLogicNode { int64_t watermark; int8_t igExpired; EWindowAlgorithm windowAlgo; + EOrder inputTsOrder; } SWindowLogicNode; typedef struct SFillLogicNode { @@ -356,15 +358,14 @@ typedef struct SInterpFuncPhysiNode { SNode* pTimeSeries; // SColumnNode } SInterpFuncPhysiNode; -typedef struct SJoinPhysiNode { +typedef struct SSortMergeJoinPhysiNode { SPhysiNode node; EJoinType joinType; SNode* pMergeCondition; SNode* pOnConditions; SNodeList* pTargets; -} SJoinPhysiNode; - -typedef SJoinPhysiNode SSortMergeJoinPhysiNode; + EOrder inputTsOrder; +} SSortMergeJoinPhysiNode; typedef struct SAggPhysiNode { SPhysiNode node; diff --git a/source/libs/command/src/explain.c b/source/libs/command/src/explain.c index 9ffdfc2289..266f96b41e 100644 --- a/source/libs/command/src/explain.c +++ b/source/libs/command/src/explain.c @@ -135,7 +135,7 @@ int32_t qExplainGenerateResChildren(SPhysiNode *pNode, SExplainGroup *group, SNo break; } case QUERY_NODE_PHYSICAL_PLAN_MERGE_JOIN: { - SJoinPhysiNode *pJoinNode = (SJoinPhysiNode *)pNode; + SSortMergeJoinPhysiNode *pJoinNode = (SSortMergeJoinPhysiNode *)pNode; pPhysiChildren = pJoinNode->node.pChildren; break; } @@ -434,7 +434,8 @@ int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SExplainCtx *ctx, i case QUERY_NODE_PHYSICAL_PLAN_TABLE_SCAN: { STableScanPhysiNode *pTblScanNode = (STableScanPhysiNode *)pNode; EXPLAIN_ROW_NEW(level, - QUERY_NODE_PHYSICAL_PLAN_TABLE_MERGE_SCAN == pNode->type ? EXPLAIN_TBL_MERGE_SCAN_FORMAT : EXPLAIN_TBL_SCAN_FORMAT, + QUERY_NODE_PHYSICAL_PLAN_TABLE_MERGE_SCAN == pNode->type ? EXPLAIN_TBL_MERGE_SCAN_FORMAT + : EXPLAIN_TBL_SCAN_FORMAT, pTblScanNode->scan.tableName.tname); EXPLAIN_ROW_APPEND(EXPLAIN_LEFT_PARENTHESIS_FORMAT); if (pResNode->pExecInfo) { @@ -551,7 +552,7 @@ int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SExplainCtx *ctx, i EXPLAIN_ROW_APPEND(EXPLAIN_BLANK_FORMAT); if (pSTblScanNode->scan.pScanPseudoCols) { EXPLAIN_ROW_APPEND(EXPLAIN_PSEUDO_COLUMNS_FORMAT, pSTblScanNode->scan.pScanPseudoCols->length); - EXPLAIN_ROW_APPEND(EXPLAIN_BLANK_FORMAT); + EXPLAIN_ROW_APPEND(EXPLAIN_BLANK_FORMAT); } EXPLAIN_ROW_APPEND(EXPLAIN_WIDTH_FORMAT, pSTblScanNode->scan.node.pOutputDataBlockDesc->totalRowSize); EXPLAIN_ROW_APPEND(EXPLAIN_BLANK_FORMAT); @@ -613,7 +614,7 @@ int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SExplainCtx *ctx, i break; } case QUERY_NODE_PHYSICAL_PLAN_MERGE_JOIN: { - SJoinPhysiNode *pJoinNode = (SJoinPhysiNode *)pNode; + SSortMergeJoinPhysiNode *pJoinNode = (SSortMergeJoinPhysiNode *)pNode; EXPLAIN_ROW_NEW(level, EXPLAIN_JOIN_FORMAT, EXPLAIN_JOIN_STRING(pJoinNode->joinType)); EXPLAIN_ROW_APPEND(EXPLAIN_LEFT_PARENTHESIS_FORMAT); if (pResNode->pExecInfo) { @@ -1180,7 +1181,7 @@ int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SExplainCtx *ctx, i EXPLAIN_ROW_APPEND(EXPLAIN_BLANK_FORMAT); if (pDistScanNode->pScanPseudoCols) { EXPLAIN_ROW_APPEND(EXPLAIN_PSEUDO_COLUMNS_FORMAT, pDistScanNode->pScanPseudoCols->length); - EXPLAIN_ROW_APPEND(EXPLAIN_BLANK_FORMAT); + EXPLAIN_ROW_APPEND(EXPLAIN_BLANK_FORMAT); } EXPLAIN_ROW_APPEND(EXPLAIN_WIDTH_FORMAT, pDistScanNode->node.pOutputDataBlockDesc->totalRowSize); EXPLAIN_ROW_APPEND(EXPLAIN_BLANK_FORMAT); @@ -1367,7 +1368,7 @@ int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SExplainCtx *ctx, i EXPLAIN_ROW_APPEND(EXPLAIN_FUNCTIONS_FORMAT, pInterpNode->pFuncs->length); EXPLAIN_ROW_APPEND(EXPLAIN_BLANK_FORMAT); } - + EXPLAIN_ROW_APPEND(EXPLAIN_MODE_FORMAT, nodesGetFillModeString(pInterpNode->fillMode)); EXPLAIN_ROW_APPEND(EXPLAIN_BLANK_FORMAT); @@ -1419,7 +1420,7 @@ int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SExplainCtx *ctx, i } } break; - } + } default: qError("not supported physical node type %d", pNode->type); return TSDB_CODE_QRY_APP_ERROR; diff --git a/source/libs/executor/inc/executorimpl.h b/source/libs/executor/inc/executorimpl.h index 1ad17bbc76..44394bb2f0 100644 --- a/source/libs/executor/inc/executorimpl.h +++ b/source/libs/executor/inc/executorimpl.h @@ -321,6 +321,49 @@ typedef struct STableScanInfo { int8_t noTable; } STableScanInfo; +typedef struct STableMergeScanInfo { + STableListInfo* tableListInfo; + int32_t tableStartIndex; + int32_t tableEndIndex; + bool hasGroupId; + uint64_t groupId; + SArray* dataReaders; // array of tsdbReaderT* + SReadHandle readHandle; + int32_t bufPageSize; + uint32_t sortBufSize; // max buffer size for in-memory sort + SArray* pSortInfo; + SSortHandle* pSortHandle; + + SSDataBlock* pSortInputBlock; + int64_t startTs; // sort start time + SArray* sortSourceParams; + + SFileBlockLoadRecorder readRecorder; + int64_t numOfRows; + SScanInfo scanInfo; + int32_t scanTimes; + SNode* pFilterNode; // filter info, which is push down by optimizer + SqlFunctionCtx* pCtx; // which belongs to the direct upstream operator operator query context + SResultRowInfo* pResultRowInfo; + int32_t* rowEntryInfoOffset; + SExprInfo* pExpr; + SSDataBlock* pResBlock; + SArray* pColMatchInfo; + int32_t numOfOutput; + + SExprInfo* pPseudoExpr; + int32_t numOfPseudoExpr; + SqlFunctionCtx* pPseudoCtx; + + SQueryTableDataCond cond; + int32_t scanFlag; // table scan flag to denote if it is a repeat/reverse/main scan + int32_t dataBlockLoadFlag; + // if the upstream is an interval operator, the interval info is also kept here to get the time + // window to check if current data block needs to be loaded. + SInterval interval; + SSampleExecInfo sample; // sample execution info +} STableMergeScanInfo; + typedef struct STagScanInfo { SColumnInfo *pCols; SSDataBlock *pRes; @@ -881,7 +924,7 @@ SOperatorInfo* createPartitionOperatorInfo(SOperatorInfo* downstream, SPartition SOperatorInfo* createTimeSliceOperatorInfo(SOperatorInfo* downstream, SPhysiNode* pNode, SExecTaskInfo* pTaskInfo); -SOperatorInfo* createMergeJoinOperatorInfo(SOperatorInfo** pDownstream, int32_t numOfDownstream, SJoinPhysiNode* pJoinNode, +SOperatorInfo* createMergeJoinOperatorInfo(SOperatorInfo** pDownstream, int32_t numOfDownstream, SSortMergeJoinPhysiNode* pJoinNode, SExecTaskInfo* pTaskInfo); SOperatorInfo* createStreamSessionAggOperatorInfo(SOperatorInfo* downstream, diff --git a/source/libs/executor/src/executorimpl.c b/source/libs/executor/src/executorimpl.c index 7bac828a53..7194b16a78 100644 --- a/source/libs/executor/src/executorimpl.c +++ b/source/libs/executor/src/executorimpl.c @@ -1356,7 +1356,7 @@ void doFilter(const SNode* pFilterNode, SSDataBlock* pBlock, const SArray* pColM extractQualifiedTupleByFilterResult(pBlock, rowRes, keep); if (pColMatchInfo != NULL) { - for(int32_t i = 0; i < taosArrayGetSize(pColMatchInfo); ++i) { + for (int32_t i = 0; i < taosArrayGetSize(pColMatchInfo); ++i) { SColMatchInfo* pInfo = taosArrayGet(pColMatchInfo, i); if (pInfo->colId == PRIMARYKEY_TIMESTAMP_COL_ID) { SColumnInfoData* pColData = taosArrayGet(pBlock->pDataBlock, pInfo->targetSlotId); @@ -2885,11 +2885,16 @@ int32_t getTableScanInfo(SOperatorInfo* pOperator, int32_t* order, int32_t* scan *order = TSDB_ORDER_ASC; *scanFlag = MAIN_SCAN; return TSDB_CODE_SUCCESS; - } else if (type == QUERY_NODE_PHYSICAL_PLAN_TABLE_SCAN || type == QUERY_NODE_PHYSICAL_PLAN_TABLE_MERGE_SCAN) { + } else if (type == QUERY_NODE_PHYSICAL_PLAN_TABLE_SCAN) { STableScanInfo* pTableScanInfo = pOperator->info; *order = pTableScanInfo->cond.order; *scanFlag = pTableScanInfo->scanFlag; return TSDB_CODE_SUCCESS; + } else if (type == QUERY_NODE_PHYSICAL_PLAN_TABLE_MERGE_SCAN) { + STableMergeScanInfo* pTableScanInfo = pOperator->info; + *order = pTableScanInfo->cond.order; + *scanFlag = pTableScanInfo->scanFlag; + return TSDB_CODE_SUCCESS; } else { if (pOperator->pDownstream == NULL || pOperator->pDownstream[0] == NULL) { return TSDB_CODE_INVALID_PARA; @@ -3307,9 +3312,9 @@ static SSDataBlock* doProjectOperation(SOperatorInfo* pOperator) { } SOperatorInfo* downstream = pOperator->pDownstream[0]; - SLimitInfo* pLimitInfo = &pProjectInfo->limitInfo; + SLimitInfo* pLimitInfo = &pProjectInfo->limitInfo; - while(1) { + while (1) { while (1) { blockDataCleanup(pRes); @@ -3326,7 +3331,8 @@ static SSDataBlock* doProjectOperation(SOperatorInfo* pOperator) { } if (pLimitInfo->remainGroupOffset > 0) { - if (pLimitInfo->currentGroupId == 0 || pLimitInfo->currentGroupId == pBlock->info.groupId) { // it is the first group + if (pLimitInfo->currentGroupId == 0 || + pLimitInfo->currentGroupId == pBlock->info.groupId) { // it is the first group pLimitInfo->currentGroupId = pBlock->info.groupId; continue; } else if (pLimitInfo->currentGroupId != pBlock->info.groupId) { @@ -4265,7 +4271,7 @@ SSchemaWrapper* extractQueriedColumnSchema(SScanPhysiNode* pScanNode) { } // this the tags and pseudo function columns, we only keep the tag columns - for(int32_t i = 0; i < numOfTags; ++i) { + for (int32_t i = 0; i < numOfTags; ++i) { STargetNode* pNode = (STargetNode*)nodesListGetNode(pScanNode->pScanPseudoCols, i); int32_t type = nodeType(pNode->pExpr); @@ -4381,7 +4387,7 @@ int32_t generateGroupIdMap(STableListInfo* pTableListInfo, SReadHandle* pHandle, int32_t groupNum = 0; for (int32_t i = 0; i < taosArrayGetSize(pTableListInfo->pTableList); i++) { STableKeyInfo* info = taosArrayGet(pTableListInfo->pTableList, i); - int32_t code = getGroupIdFromTagsVal(pHandle->meta, info->uid, group, keyBuf, &info->groupId); + int32_t code = getGroupIdFromTagsVal(pHandle->meta, info->uid, group, keyBuf, &info->groupId); if (code != TSDB_CODE_SUCCESS) { return code; } @@ -4701,7 +4707,7 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo } else if (QUERY_NODE_PHYSICAL_PLAN_STREAM_STATE == type) { pOptr = createStreamStateAggOperatorInfo(ops[0], pPhyNode, pTaskInfo); } else if (QUERY_NODE_PHYSICAL_PLAN_MERGE_JOIN == type) { - pOptr = createMergeJoinOperatorInfo(ops, size, (SJoinPhysiNode*)pPhyNode, pTaskInfo); + pOptr = createMergeJoinOperatorInfo(ops, size, (SSortMergeJoinPhysiNode*)pPhyNode, pTaskInfo); } else if (QUERY_NODE_PHYSICAL_PLAN_FILL == type) { pOptr = createFillOperatorInfo(ops[0], (SFillPhysiNode*)pPhyNode, pTaskInfo); } else if (QUERY_NODE_PHYSICAL_PLAN_INDEF_ROWS_FUNC == type) { diff --git a/source/libs/executor/src/joinoperator.c b/source/libs/executor/src/joinoperator.c index 2e6c9bd351..f26b2f4f0a 100644 --- a/source/libs/executor/src/joinoperator.c +++ b/source/libs/executor/src/joinoperator.c @@ -28,30 +28,30 @@ static SSDataBlock* doMergeJoin(struct SOperatorInfo* pOperator); static void destroyMergeJoinOperator(void* param, int32_t numOfOutput); static void extractTimeCondition(SJoinOperatorInfo* Info, SLogicConditionNode* pLogicConditionNode); -SOperatorInfo* createMergeJoinOperatorInfo(SOperatorInfo** pDownstream, int32_t numOfDownstream, SJoinPhysiNode* pJoinNode, - SExecTaskInfo* pTaskInfo) { +SOperatorInfo* createMergeJoinOperatorInfo(SOperatorInfo** pDownstream, int32_t numOfDownstream, + SSortMergeJoinPhysiNode* pJoinNode, SExecTaskInfo* pTaskInfo) { SJoinOperatorInfo* pInfo = taosMemoryCalloc(1, sizeof(SJoinOperatorInfo)); SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo)); if (pOperator == NULL || pInfo == NULL) { goto _error; } - SSDataBlock* pResBlock = createResDataBlock(pJoinNode->node.pOutputDataBlockDesc); + SSDataBlock* pResBlock = createResDataBlock(pJoinNode->node.pOutputDataBlockDesc); - int32_t numOfCols = 0; + int32_t numOfCols = 0; SExprInfo* pExprInfo = createExprInfo(pJoinNode->pTargets, NULL, &numOfCols); initResultSizeInfo(&pOperator->resultInfo, 4096); - pInfo->pRes = pResBlock; - pOperator->name = "MergeJoinOperator"; + pInfo->pRes = pResBlock; + pOperator->name = "MergeJoinOperator"; pOperator->operatorType = QUERY_NODE_PHYSICAL_PLAN_MERGE_JOIN; - pOperator->blocking = false; - pOperator->status = OP_NOT_OPENED; - pOperator->exprSupp.pExprInfo = pExprInfo; - pOperator->exprSupp.numOfExprs = numOfCols; - pOperator->info = pInfo; - pOperator->pTaskInfo = pTaskInfo; + pOperator->blocking = false; + pOperator->status = OP_NOT_OPENED; + pOperator->exprSupp.pExprInfo = pExprInfo; + pOperator->exprSupp.numOfExprs = numOfCols; + pOperator->info = pInfo; + pOperator->pTaskInfo = pTaskInfo; SNode* pMergeCondition = pJoinNode->pMergeCondition; if (nodeType(pMergeCondition) == QUERY_NODE_OPERATOR) { @@ -104,7 +104,7 @@ void setJoinColumnInfo(SColumnInfo* pColumn, const SColumnNode* pColumnNode) { void destroyMergeJoinOperator(void* param, int32_t numOfOutput) { SJoinOperatorInfo* pJoinOperator = (SJoinOperatorInfo*)param; nodesDestroyNode(pJoinOperator->pCondAfterMerge); - + taosMemoryFreeClear(param); } diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c index a9d03aebbe..539ef18d87 100644 --- a/source/libs/executor/src/scanoperator.c +++ b/source/libs/executor/src/scanoperator.c @@ -274,7 +274,7 @@ static int32_t loadDataBlock(SOperatorInfo* pOperator, STableScanInfo* pTableSca qDebug("%s data block filter out, brange:%" PRId64 "-%" PRId64 ", rows:%d", GET_TASKID(pTaskInfo), pBlockInfo->window.skey, pBlockInfo->window.ekey, pBlockInfo->rows); } else { - qDebug("%s data block filter out, elapsed time:%"PRId64, GET_TASKID(pTaskInfo), (et - st)); + qDebug("%s data block filter out, elapsed time:%" PRId64, GET_TASKID(pTaskInfo), (et - st)); } return TSDB_CODE_SUCCESS; @@ -1838,11 +1838,14 @@ static SSDataBlock* sysTableScanUserTags(SOperatorInfo* pOperator) { int8_t tagType = smr.me.stbEntry.schemaTag.pSchema[i].type; pColInfoData = taosArrayGet(p->pDataBlock, 4); char tagTypeStr[VARSTR_HEADER_SIZE + 32]; - int tagTypeLen = sprintf(varDataVal(tagTypeStr), "%s", tDataTypes[tagType].name); + int tagTypeLen = sprintf(varDataVal(tagTypeStr), "%s", tDataTypes[tagType].name); if (tagType == TSDB_DATA_TYPE_VARCHAR) { - tagTypeLen += sprintf(varDataVal(tagTypeStr) + tagTypeLen, "(%d)", (int32_t)(smr.me.stbEntry.schemaTag.pSchema[i].bytes - VARSTR_HEADER_SIZE)); + tagTypeLen += sprintf(varDataVal(tagTypeStr) + tagTypeLen, "(%d)", + (int32_t)(smr.me.stbEntry.schemaTag.pSchema[i].bytes - VARSTR_HEADER_SIZE)); } else if (tagType == TSDB_DATA_TYPE_NCHAR) { - tagTypeLen += sprintf(varDataVal(tagTypeStr) + tagTypeLen, "(%d)", (int32_t)((smr.me.stbEntry.schemaTag.pSchema[i].bytes - VARSTR_HEADER_SIZE) / TSDB_NCHAR_SIZE)); + tagTypeLen += + sprintf(varDataVal(tagTypeStr) + tagTypeLen, "(%d)", + (int32_t)((smr.me.stbEntry.schemaTag.pSchema[i].bytes - VARSTR_HEADER_SIZE) / TSDB_NCHAR_SIZE)); } varDataSetLen(tagTypeStr, tagTypeLen); colDataAppend(pColInfoData, numOfRows, (char*)tagTypeStr, false); @@ -2527,49 +2530,6 @@ _error: return NULL; } -typedef struct STableMergeScanInfo { - STableListInfo* tableListInfo; - int32_t tableStartIndex; - int32_t tableEndIndex; - bool hasGroupId; - uint64_t groupId; - SArray* dataReaders; // array of tsdbReaderT* - SReadHandle readHandle; - int32_t bufPageSize; - uint32_t sortBufSize; // max buffer size for in-memory sort - SArray* pSortInfo; - SSortHandle* pSortHandle; - - SSDataBlock* pSortInputBlock; - int64_t startTs; // sort start time - SArray* sortSourceParams; - - SFileBlockLoadRecorder readRecorder; - int64_t numOfRows; - SScanInfo scanInfo; - int32_t scanTimes; - SNode* pFilterNode; // filter info, which is push down by optimizer - SqlFunctionCtx* pCtx; // which belongs to the direct upstream operator operator query context - SResultRowInfo* pResultRowInfo; - int32_t* rowEntryInfoOffset; - SExprInfo* pExpr; - SSDataBlock* pResBlock; - SArray* pColMatchInfo; - int32_t numOfOutput; - - SExprInfo* pPseudoExpr; - int32_t numOfPseudoExpr; - SqlFunctionCtx* pPseudoCtx; - - SQueryTableDataCond cond; - int32_t scanFlag; // table scan flag to denote if it is a repeat/reverse/main scan - int32_t dataBlockLoadFlag; - // if the upstream is an interval operator, the interval info is also kept here to get the time - // window to check if current data block needs to be loaded. - SInterval interval; - SSampleExecInfo sample; // sample execution info -} STableMergeScanInfo; - int32_t createScanTableListInfo(SScanPhysiNode* pScanNode, SNodeList* pGroupTags, bool groupSort, SReadHandle* pHandle, STableListInfo* pTableListInfo, SNode* pTagCond, SNode* pTagIndexCond, const char* idStr) { @@ -2975,6 +2935,7 @@ void destroyTableMergeScanOperatorInfo(void* param, int32_t numOfOutput) { taosArrayDestroy(pTableScanInfo->pSortInfo); + taosMemoryFreeClear(pTableScanInfo->rowEntryInfoOffset); taosMemoryFreeClear(param); } diff --git a/source/libs/nodes/src/nodesCodeFuncs.c b/source/libs/nodes/src/nodesCodeFuncs.c index eec4780293..186a51f000 100644 --- a/source/libs/nodes/src/nodesCodeFuncs.c +++ b/source/libs/nodes/src/nodesCodeFuncs.c @@ -1717,7 +1717,7 @@ static const char* jkJoinPhysiPlanOnConditions = "OnConditions"; static const char* jkJoinPhysiPlanTargets = "Targets"; static int32_t physiJoinNodeToJson(const void* pObj, SJson* pJson) { - const SJoinPhysiNode* pNode = (const SJoinPhysiNode*)pObj; + const SSortMergeJoinPhysiNode* pNode = (const SSortMergeJoinPhysiNode*)pObj; int32_t code = physicPlanNodeToJson(pObj, pJson); if (TSDB_CODE_SUCCESS == code) { @@ -1737,7 +1737,7 @@ static int32_t physiJoinNodeToJson(const void* pObj, SJson* pJson) { } static int32_t jsonToPhysiJoinNode(const SJson* pJson, void* pObj) { - SJoinPhysiNode* pNode = (SJoinPhysiNode*)pObj; + SSortMergeJoinPhysiNode* pNode = (SSortMergeJoinPhysiNode*)pObj; int32_t code = jsonToPhysicPlanNode(pJson, pObj); if (TSDB_CODE_SUCCESS == code) { diff --git a/source/libs/nodes/src/nodesTraverseFuncs.c b/source/libs/nodes/src/nodesTraverseFuncs.c index b12e3b14c7..77681af1bc 100644 --- a/source/libs/nodes/src/nodesTraverseFuncs.c +++ b/source/libs/nodes/src/nodesTraverseFuncs.c @@ -468,7 +468,7 @@ static EDealRes dispatchPhysiPlan(SNode* pNode, ETraversalOrder order, FNodeWalk break; } case QUERY_NODE_PHYSICAL_PLAN_MERGE_JOIN: { - SJoinPhysiNode* pJoin = (SJoinPhysiNode*)pNode; + SSortMergeJoinPhysiNode* pJoin = (SSortMergeJoinPhysiNode*)pNode; res = walkPhysiNode((SPhysiNode*)pNode, order, walker, pContext); if (DEAL_RES_ERROR != res && DEAL_RES_END != res) { res = walkPhysiPlan(pJoin->pMergeCondition, order, walker, pContext); diff --git a/source/libs/nodes/src/nodesUtilFuncs.c b/source/libs/nodes/src/nodesUtilFuncs.c index 23f0bb088d..3c6fbe409c 100644 --- a/source/libs/nodes/src/nodesUtilFuncs.c +++ b/source/libs/nodes/src/nodesUtilFuncs.c @@ -287,7 +287,7 @@ SNode* nodesMakeNode(ENodeType type) { case QUERY_NODE_PHYSICAL_PLAN_PROJECT: return makeNode(type, sizeof(SProjectPhysiNode)); case QUERY_NODE_PHYSICAL_PLAN_MERGE_JOIN: - return makeNode(type, sizeof(SJoinPhysiNode)); + return makeNode(type, sizeof(SSortMergeJoinPhysiNode)); case QUERY_NODE_PHYSICAL_PLAN_HASH_AGG: return makeNode(type, sizeof(SAggPhysiNode)); case QUERY_NODE_PHYSICAL_PLAN_EXCHANGE: @@ -883,7 +883,7 @@ void nodesDestroyNode(SNode* pNode) { break; } case QUERY_NODE_PHYSICAL_PLAN_MERGE_JOIN: { - SJoinPhysiNode* pPhyNode = (SJoinPhysiNode*)pNode; + SSortMergeJoinPhysiNode* pPhyNode = (SSortMergeJoinPhysiNode*)pNode; destroyPhysiNode((SPhysiNode*)pPhyNode); nodesDestroyNode(pPhyNode->pMergeCondition); nodesDestroyNode(pPhyNode->pOnConditions); diff --git a/source/libs/parser/src/parInsert.c b/source/libs/parser/src/parInsert.c index 702422e022..d564d53633 100644 --- a/source/libs/parser/src/parInsert.c +++ b/source/libs/parser/src/parInsert.c @@ -739,12 +739,13 @@ static int32_t parseBoundColumns(SInsertParseContext* pCxt, SParsedDataColInfo* return TSDB_CODE_SUCCESS; } -static void buildCreateTbReq(SVCreateTbReq* pTbReq, const char* tname, STag* pTag, int64_t suid, const char* sname, SArray* tagName, uint8_t tagNum) { +static void buildCreateTbReq(SVCreateTbReq* pTbReq, const char* tname, STag* pTag, int64_t suid, const char* sname, + SArray* tagName, uint8_t tagNum) { pTbReq->type = TD_CHILD_TABLE; pTbReq->name = strdup(tname); pTbReq->ctb.suid = suid; pTbReq->ctb.tagNum = tagNum; - if(sname) pTbReq->ctb.name = strdup(sname); + if (sname) pTbReq->ctb.name = strdup(sname); pTbReq->ctb.pTag = (uint8_t*)pTag; pTbReq->ctb.tagName = taosArrayDup(tagName); pTbReq->commentLen = -1; @@ -969,7 +970,7 @@ static int32_t parseTagsClause(SInsertParseContext* pCxt, SSchema* pSchema, uint } SSchema* pTagSchema = &pSchema[pCxt->tags.boundColumns[i]]; - char tmpTokenBuf[TSDB_MAX_BYTES_PER_ROW] = {0}; // todo this can be optimize with parse column + char tmpTokenBuf[TSDB_MAX_BYTES_PER_ROW] = {0}; // todo this can be optimize with parse column code = checkAndTrimValue(&sToken, tmpTokenBuf, &pCxt->msg); if (code != TSDB_CODE_SUCCESS) { goto end; @@ -1012,7 +1013,8 @@ static int32_t parseTagsClause(SInsertParseContext* pCxt, SSchema* pSchema, uint goto end; } - buildCreateTbReq(&pCxt->createTblReq, tName, pTag, pCxt->pTableMeta->suid, pCxt->sTableName, tagName, pCxt->pTableMeta->tableInfo.numOfTags); + buildCreateTbReq(&pCxt->createTblReq, tName, pTag, pCxt->pTableMeta->suid, pCxt->sTableName, tagName, + pCxt->pTableMeta->tableInfo.numOfTags); end: for (int i = 0; i < taosArrayGetSize(pTagVals); ++i) { @@ -1650,7 +1652,6 @@ static int32_t skipUsingClause(SInsertParseSyntaxCxt* pCxt) { static int32_t collectTableMetaKey(SInsertParseSyntaxCxt* pCxt, SToken* pTbToken) { SName name; CHECK_CODE(createSName(&name, pTbToken, pCxt->pComCxt->acctId, pCxt->pComCxt->db, &pCxt->msg)); - CHECK_CODE(reserveDbCfgInCache(pCxt->pComCxt->acctId, name.dbname, pCxt->pMetaCache)); CHECK_CODE(reserveUserAuthInCacheExt(pCxt->pComCxt->pUser, &name, AUTH_TYPE_WRITE, pCxt->pMetaCache)); CHECK_CODE(reserveTableMetaInCacheExt(&name, pCxt->pMetaCache)); CHECK_CODE(reserveTableVgroupInCacheExt(&name, pCxt->pMetaCache)); @@ -2332,7 +2333,8 @@ int32_t smlBindData(void* handle, SArray* tags, SArray* colsSchema, SArray* cols return ret; } - buildCreateTbReq(&smlHandle->tableExecHandle.createTblReq, tableName, pTag, pTableMeta->suid, NULL, tagName, pTableMeta->tableInfo.numOfTags); + buildCreateTbReq(&smlHandle->tableExecHandle.createTblReq, tableName, pTag, pTableMeta->suid, NULL, tagName, + pTableMeta->tableInfo.numOfTags); taosArrayDestroy(tagName); smlHandle->tableExecHandle.createTblReq.ctb.name = taosMemoryMalloc(sTableNameLen + 1); diff --git a/source/libs/parser/src/parUtil.c b/source/libs/parser/src/parUtil.c index 74d5f03dc1..7c9a8b10dd 100644 --- a/source/libs/parser/src/parUtil.c +++ b/source/libs/parser/src/parUtil.c @@ -92,7 +92,7 @@ static char* getSyntaxErrFormat(int32_t errCode) { case TSDB_CODE_PAR_INTER_SLIDING_TOO_BIG: return "sliding value no larger than the interval value"; case TSDB_CODE_PAR_INTER_SLIDING_TOO_SMALL: - return "sliding value can not less than 1% of interval value"; + return "sliding value can not less than 1%% of interval value"; case TSDB_CODE_PAR_ONLY_ONE_JSON_TAG: return "Only one tag if there is a json tag"; case TSDB_CODE_PAR_INCORRECT_NUM_OF_COL: diff --git a/source/libs/planner/src/planOptimizer.c b/source/libs/planner/src/planOptimizer.c index 3b545777a8..fcc395af62 100644 --- a/source/libs/planner/src/planOptimizer.c +++ b/source/libs/planner/src/planOptimizer.c @@ -993,22 +993,28 @@ static bool sortPriKeyOptMayBeOptimized(SLogicNode* pNode) { } static int32_t sortPriKeyOptGetScanNodesImpl(SLogicNode* pNode, bool* pNotOptimize, SNodeList** pScanNodes) { - int32_t code = TSDB_CODE_SUCCESS; - switch (nodeType(pNode)) { - case QUERY_NODE_LOGIC_PLAN_SCAN: + case QUERY_NODE_LOGIC_PLAN_SCAN: { + SScanLogicNode* pScan = (SScanLogicNode*)pNode; + if (NULL != pScan->pGroupTags) { + *pNotOptimize = true; + return TSDB_CODE_SUCCESS; + } return nodesListMakeAppend(pScanNodes, (SNode*)pNode); - case QUERY_NODE_LOGIC_PLAN_JOIN: - code = + } + case QUERY_NODE_LOGIC_PLAN_JOIN: { + int32_t code = sortPriKeyOptGetScanNodesImpl((SLogicNode*)nodesListGetNode(pNode->pChildren, 0), pNotOptimize, pScanNodes); if (TSDB_CODE_SUCCESS == code) { code = sortPriKeyOptGetScanNodesImpl((SLogicNode*)nodesListGetNode(pNode->pChildren, 1), pNotOptimize, pScanNodes); } return code; + } case QUERY_NODE_LOGIC_PLAN_AGG: + case QUERY_NODE_LOGIC_PLAN_PARTITION: *pNotOptimize = true; - return code; + return TSDB_CODE_SUCCESS; default: break; } @@ -1034,6 +1040,18 @@ static EOrder sortPriKeyOptGetPriKeyOrder(SSortLogicNode* pSort) { return ((SOrderByExprNode*)nodesListGetNode(pSort->pSortKeys, 0))->order; } +static void sortPriKeyOptSetParentOrder(SLogicNode* pNode, EOrder order) { + if (NULL == pNode) { + return; + } + if (QUERY_NODE_LOGIC_PLAN_WINDOW == nodeType(pNode)) { + ((SWindowLogicNode*)pNode)->inputTsOrder = order; + } else if (QUERY_NODE_LOGIC_PLAN_JOIN == nodeType(pNode)) { + ((SJoinLogicNode*)pNode)->inputTsOrder = order; + } + sortPriKeyOptSetParentOrder(pNode->pParent, order); +} + static int32_t sortPriKeyOptApply(SOptimizeContext* pCxt, SLogicSubplan* pLogicSubplan, SSortLogicNode* pSort, SNodeList* pScanNodes) { EOrder order = sortPriKeyOptGetPriKeyOrder(pSort); @@ -1048,6 +1066,7 @@ static int32_t sortPriKeyOptApply(SOptimizeContext* pCxt, SLogicSubplan* pLogicS pScan->node.resultDataOrder = DATA_ORDER_LEVEL_GLOBAL; pScan->node.requireDataOrder = DATA_ORDER_LEVEL_GLOBAL; } + sortPriKeyOptSetParentOrder(pScan->node.pParent, order); } SLogicNode* pChild = (SLogicNode*)nodesListGetNode(pSort->node.pChildren, 0); @@ -1613,10 +1632,10 @@ static void alignProjectionWithTarget(SLogicNode* pNode) { } SProjectLogicNode* pProjectNode = (SProjectLogicNode*)pNode; - SNode* pProjection = NULL; + SNode* pProjection = NULL; FOREACH(pProjection, pProjectNode->pProjections) { SNode* pTarget = NULL; - bool keep = false; + bool keep = false; FOREACH(pTarget, pNode->pTargets) { if (0 == strcmp(((SColumnNode*)pProjection)->node.aliasName, ((SColumnNode*)pTarget)->colName)) { keep = true; diff --git a/source/libs/planner/src/planPhysiCreater.c b/source/libs/planner/src/planPhysiCreater.c index fd359fce45..38f3c23925 100644 --- a/source/libs/planner/src/planPhysiCreater.c +++ b/source/libs/planner/src/planPhysiCreater.c @@ -621,8 +621,8 @@ static int32_t createScanPhysiNode(SPhysiPlanContext* pCxt, SSubplan* pSubplan, static int32_t createJoinPhysiNode(SPhysiPlanContext* pCxt, SNodeList* pChildren, SJoinLogicNode* pJoinLogicNode, SPhysiNode** pPhyNode) { - SJoinPhysiNode* pJoin = - (SJoinPhysiNode*)makePhysiNode(pCxt, (SLogicNode*)pJoinLogicNode, QUERY_NODE_PHYSICAL_PLAN_MERGE_JOIN); + SSortMergeJoinPhysiNode* pJoin = + (SSortMergeJoinPhysiNode*)makePhysiNode(pCxt, (SLogicNode*)pJoinLogicNode, QUERY_NODE_PHYSICAL_PLAN_MERGE_JOIN); if (NULL == pJoin) { return TSDB_CODE_OUT_OF_MEMORY; } diff --git a/source/libs/planner/src/planSpliter.c b/source/libs/planner/src/planSpliter.c index 879c04743d..81e2bff179 100644 --- a/source/libs/planner/src/planSpliter.c +++ b/source/libs/planner/src/planSpliter.c @@ -469,7 +469,7 @@ static int32_t stbSplCreateExchangeNode(SSplitContext* pCxt, SLogicNode* pParent return code; } -static int32_t stbSplCreateMergeKeysByPrimaryKey(SNode* pPrimaryKey, SNodeList** pMergeKeys) { +static int32_t stbSplCreateMergeKeysByPrimaryKey(SNode* pPrimaryKey, EOrder order, SNodeList** pMergeKeys) { SOrderByExprNode* pMergeKey = (SOrderByExprNode*)nodesMakeNode(QUERY_NODE_ORDER_BY_EXPR); if (NULL == pMergeKey) { return TSDB_CODE_OUT_OF_MEMORY; @@ -479,7 +479,7 @@ static int32_t stbSplCreateMergeKeysByPrimaryKey(SNode* pPrimaryKey, SNodeList** nodesDestroyNode((SNode*)pMergeKey); return TSDB_CODE_OUT_OF_MEMORY; } - pMergeKey->order = ORDER_ASC; + pMergeKey->order = order; pMergeKey->nullOrder = NULL_ORDER_FIRST; return nodesListMakeStrictAppend(pMergeKeys, (SNode*)pMergeKey); } @@ -491,7 +491,8 @@ static int32_t stbSplSplitIntervalForBatch(SSplitContext* pCxt, SStableSplitInfo ((SWindowLogicNode*)pPartWindow)->windowAlgo = INTERVAL_ALGO_HASH; ((SWindowLogicNode*)pInfo->pSplitNode)->windowAlgo = INTERVAL_ALGO_MERGE; SNodeList* pMergeKeys = NULL; - code = stbSplCreateMergeKeysByPrimaryKey(((SWindowLogicNode*)pInfo->pSplitNode)->pTspk, &pMergeKeys); + code = stbSplCreateMergeKeysByPrimaryKey(((SWindowLogicNode*)pInfo->pSplitNode)->pTspk, + ((SWindowLogicNode*)pInfo->pSplitNode)->inputTsOrder, &pMergeKeys); if (TSDB_CODE_SUCCESS == code) { code = stbSplCreateMergeNode(pCxt, NULL, pInfo->pSplitNode, pMergeKeys, pPartWindow, true); } @@ -579,7 +580,8 @@ static int32_t stbSplSplitSessionOrStateForBatch(SSplitContext* pCxt, SStableSpl SLogicNode* pChild = (SLogicNode*)nodesListGetNode(pWindow->pChildren, 0); SNodeList* pMergeKeys = NULL; - int32_t code = stbSplCreateMergeKeysByPrimaryKey(((SWindowLogicNode*)pWindow)->pTspk, &pMergeKeys); + int32_t code = stbSplCreateMergeKeysByPrimaryKey(((SWindowLogicNode*)pWindow)->pTspk, + ((SWindowLogicNode*)pWindow)->inputTsOrder, &pMergeKeys); if (TSDB_CODE_SUCCESS == code) { code = stbSplCreateMergeNode(pCxt, pInfo->pSubplan, pChild, pMergeKeys, (SLogicNode*)pChild, true); @@ -950,7 +952,8 @@ static int32_t stbSplCreateMergeScanNode(SScanLogicNode* pScan, SLogicNode** pOu pMergeScan->scanType = SCAN_TYPE_TABLE_MERGE; pMergeScan->node.pChildren = pChildren; splSetParent((SLogicNode*)pMergeScan); - code = stbSplCreateMergeKeysByPrimaryKey(stbSplFindPrimaryKeyFromScan(pMergeScan), &pMergeKeys); + code = stbSplCreateMergeKeysByPrimaryKey(stbSplFindPrimaryKeyFromScan(pMergeScan), + pMergeScan->scanSeq[0] > 0 ? ORDER_ASC : ORDER_DESC, &pMergeKeys); } if (TSDB_CODE_SUCCESS == code) { @@ -1020,14 +1023,14 @@ static int32_t stbSplSplitJoinNode(SSplitContext* pCxt, SStableSplitInfo* pInfo) } static int32_t stbSplCreateMergeKeysForPartitionNode(SLogicNode* pPart, SNodeList** pMergeKeys) { - SNode* pPrimaryKey = - nodesCloneNode(stbSplFindPrimaryKeyFromScan((SScanLogicNode*)nodesListGetNode(pPart->pChildren, 0))); + SScanLogicNode* pScan = (SScanLogicNode*)nodesListGetNode(pPart->pChildren, 0); + SNode* pPrimaryKey = nodesCloneNode(stbSplFindPrimaryKeyFromScan(pScan)); if (NULL == pPrimaryKey) { return TSDB_CODE_OUT_OF_MEMORY; } int32_t code = nodesListAppend(pPart->pTargets, pPrimaryKey); if (TSDB_CODE_SUCCESS == code) { - code = stbSplCreateMergeKeysByPrimaryKey(pPrimaryKey, pMergeKeys); + code = stbSplCreateMergeKeysByPrimaryKey(pPrimaryKey, pScan->scanSeq[0] > 0 ? ORDER_ASC : ORDER_DESC, pMergeKeys); } return code; } diff --git a/source/util/src/terror.c b/source/util/src/terror.c index 80ad480e43..ad6eff3c12 100644 --- a/source/util/src/terror.c +++ b/source/util/src/terror.c @@ -512,7 +512,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INTER_OFFSET_UNIT, "Cannot use 'year' as TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INTER_OFFSET_TOO_BIG, "Interval offset should be shorter than interval") TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INTER_SLIDING_UNIT, "Does not support sliding when interval is natural month/year") TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INTER_SLIDING_TOO_BIG, "sliding value no larger than the interval value") -TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INTER_SLIDING_TOO_SMALL, "sliding value can not less than 1% of interval value") +TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INTER_SLIDING_TOO_SMALL, "sliding value can not less than 1%% of interval value") TAOS_DEFINE_ERROR(TSDB_CODE_PAR_ONLY_ONE_JSON_TAG, "Only one tag if there is a json tag") TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INCORRECT_NUM_OF_COL, "Query block has incorrect number of result columns") TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INCORRECT_TIMESTAMP_VAL, "Incorrect TIMESTAMP value") From b87bb4c08396fea4848e8d4ee072d63d54e82e40 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Mon, 25 Jul 2022 15:23:13 +0800 Subject: [PATCH 07/54] fix(query): remove invalid assert. --- source/libs/executor/src/projectoperator.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/source/libs/executor/src/projectoperator.c b/source/libs/executor/src/projectoperator.c index 87ba0006e1..34149d7499 100644 --- a/source/libs/executor/src/projectoperator.c +++ b/source/libs/executor/src/projectoperator.c @@ -67,6 +67,11 @@ SOperatorInfo* createProjectOperatorInfo(SOperatorInfo* downstream, SProjectPhys pInfo->pFilterNode = pProjPhyNode->node.pConditions; pInfo->mergeDataBlocks = pProjPhyNode->mergeDataBlock; + // todo remove it soon + if (pTaskInfo->execModel == OPTR_EXEC_MODEL_STREAM) { + pInfo->mergeDataBlocks = true; + } + int32_t numOfRows = 4096; size_t keyBufSize = sizeof(int64_t) + sizeof(int64_t) + POINTER_BYTES; @@ -131,7 +136,7 @@ static int32_t discardGroupDataBlock(SSDataBlock* pBlock, SLimitInfo* pLimitInfo static int32_t setInfoForNewGroup(SSDataBlock* pBlock, SLimitInfo* pLimitInfo, SOperatorInfo* pOperator) { // remainGroupOffset == 0 // here check for a new group data, we need to handle the data of the previous group. - ASSERT(pLimitInfo->remainGroupOffset == 0); + ASSERT(pLimitInfo->remainGroupOffset == 0 || pLimitInfo->remainGroupOffset == -1); if (pLimitInfo->currentGroupId != 0 && pLimitInfo->currentGroupId != pBlock->info.groupId) { pLimitInfo->numOfOutputGroups += 1; From 9e9a12cb094a15d702054b6144e44e10d0d042aa Mon Sep 17 00:00:00 2001 From: shenglian zhou Date: Mon, 25 Jul 2022 15:23:43 +0800 Subject: [PATCH 08/54] fix: fix memory leak of pseduo col computation in table merge scan --- source/libs/executor/src/scanoperator.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c index a9d03aebbe..8df22bbb11 100644 --- a/source/libs/executor/src/scanoperator.c +++ b/source/libs/executor/src/scanoperator.c @@ -2557,9 +2557,7 @@ typedef struct STableMergeScanInfo { SArray* pColMatchInfo; int32_t numOfOutput; - SExprInfo* pPseudoExpr; - int32_t numOfPseudoExpr; - SqlFunctionCtx* pPseudoCtx; + SExprSupp pseudoSup; SQueryTableDataCond cond; int32_t scanFlag; // table scan flag to denote if it is a repeat/reverse/main scan @@ -2974,6 +2972,7 @@ void destroyTableMergeScanOperatorInfo(void* param, int32_t numOfOutput) { pTableScanInfo->pSortInputBlock = blockDataDestroy(pTableScanInfo->pSortInputBlock); taosArrayDestroy(pTableScanInfo->pSortInfo); + cleanupExprSupp(&pTableScanInfo->pseudoSup); taosMemoryFreeClear(param); } @@ -3031,8 +3030,9 @@ SOperatorInfo* createTableMergeScanOperatorInfo(STableScanPhysiNode* pTableScanN } if (pTableScanNode->scan.pScanPseudoCols != NULL) { - pInfo->pPseudoExpr = createExprInfo(pTableScanNode->scan.pScanPseudoCols, NULL, &pInfo->numOfPseudoExpr); - pInfo->pPseudoCtx = createSqlFunctionCtx(pInfo->pPseudoExpr, pInfo->numOfPseudoExpr, &pInfo->rowEntryInfoOffset); + SExprSupp* pSup = &pInfo->pseudoSup; + pSup->pExprInfo = createExprInfo(pTableScanNode->scan.pScanPseudoCols, NULL, &pSup->numOfExprs); + pSup->pCtx = createSqlFunctionCtx(pSup->pExprInfo, pSup->numOfExprs, &pSup->rowEntryInfoOffset); } pInfo->scanInfo = (SScanInfo){.numOfAsc = pTableScanNode->scanSeq[0], .numOfDesc = pTableScanNode->scanSeq[1]}; From b859e6bde247dc2cc617a1314f3aa416477b75a5 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Mon, 25 Jul 2022 15:27:47 +0800 Subject: [PATCH 09/54] fix: the modification of alter dnode does not take effect through show dnode variables --- include/common/tglobal.h | 3 +- include/util/tlog.h | 1 + source/common/src/tglobal.c | 5 +++ source/dnode/mnode/impl/src/mndDnode.c | 2 +- source/util/src/tlog.c | 42 ++++++++++++++++---------- 5 files changed, 35 insertions(+), 18 deletions(-) diff --git a/include/common/tglobal.h b/include/common/tglobal.h index 23d9c41a51..9633b3e8aa 100644 --- a/include/common/tglobal.h +++ b/include/common/tglobal.h @@ -152,7 +152,8 @@ void taosCfgDynamicOptions(const char *option, const char *value); void taosAddDataDir(int32_t index, char *v1, int32_t level, int32_t primary); struct SConfig *taosGetCfg(); -int32_t taosSetCfg(SConfig *pCfg, char* name); + +int32_t taosSetCfg(SConfig *pCfg, char *name); #ifdef __cplusplus } diff --git a/include/util/tlog.h b/include/util/tlog.h index d186c32841..04ffe21e0b 100644 --- a/include/util/tlog.h +++ b/include/util/tlog.h @@ -68,6 +68,7 @@ int32_t taosInitLog(const char *logName, int32_t maxFiles); void taosCloseLog(); void taosResetLog(); void taosSetAllDebugFlag(int32_t flag); +void taosSetDebugFlag(int32_t *pFlagPtr, const char *flagName, int32_t flagVal); void taosDumpData(uint8_t *msg, int32_t len); void taosPrintLog(const char *flags, ELogLevel level, int32_t dflag, const char *format, ...) diff --git a/source/common/src/tglobal.c b/source/common/src/tglobal.c index 36900e3dfa..5cb5148e30 100644 --- a/source/common/src/tglobal.c +++ b/source/common/src/tglobal.c @@ -1143,6 +1143,10 @@ void taosCfgDynamicOptions(const char *option, const char *value) { int32_t monitor = atoi(value); uInfo("monitor set from %d to %d", tsEnableMonitor, monitor); tsEnableMonitor = monitor; + SConfigItem *pItem = cfgGetItem(tsCfg, "monitor"); + if (pItem != NULL) { + pItem->bval = tsEnableMonitor; + } return; } @@ -1166,6 +1170,7 @@ void taosCfgDynamicOptions(const char *option, const char *value) { int32_t flag = atoi(value); uInfo("%s set from %d to %d", optName, *optionVars[d], flag); *optionVars[d] = flag; + taosSetDebugFlag(optionVars[d], optName, flag); return; } diff --git a/source/dnode/mnode/impl/src/mndDnode.c b/source/dnode/mnode/impl/src/mndDnode.c index f26c1a7d32..7141a62be5 100644 --- a/source/dnode/mnode/impl/src/mndDnode.c +++ b/source/dnode/mnode/impl/src/mndDnode.c @@ -874,7 +874,7 @@ static int32_t mndProcessConfigDnodeReq(SRpcMsg *pReq) { } static int32_t mndProcessConfigDnodeRsp(SRpcMsg *pRsp) { - mInfo("config rsp from dnode, app:%p", pRsp->info.ahandle); + mInfo("config rsp from dnode"); return 0; } diff --git a/source/util/src/tlog.c b/source/util/src/tlog.c index 490c6f29bf..678a12fcf1 100644 --- a/source/util/src/tlog.c +++ b/source/util/src/tlog.c @@ -17,6 +17,7 @@ #include "tlog.h" #include "os.h" #include "tutil.h" +#include "tconfig.h" #define LOG_MAX_LINE_SIZE (1024) #define LOG_MAX_LINE_BUFFER_SIZE (LOG_MAX_LINE_SIZE + 3) @@ -62,6 +63,7 @@ typedef struct { TdThreadMutex logMutex; } SLogObj; +extern SConfig *tsCfg; static int8_t tsLogInited = 0; static SLogObj tsLogObj = {.fileNum = 1}; static int64_t tsAsyncLogLostLines = 0; @@ -742,24 +744,32 @@ cmp_end: return ret; } +void taosSetDebugFlag(int32_t *pFlagPtr, const char *flagName, int32_t flagVal) { + SConfigItem *pItem = cfgGetItem(tsCfg, flagName); + if (pItem != NULL) { + pItem->i32 = flagVal; + } + *pFlagPtr = flagVal; +} + void taosSetAllDebugFlag(int32_t flag) { if (flag <= 0) return; - uDebugFlag = flag; - rpcDebugFlag = flag; - jniDebugFlag = flag; - qDebugFlag = flag; - cDebugFlag = flag; - dDebugFlag = flag; - vDebugFlag = flag; - mDebugFlag = flag; - wDebugFlag = flag; - sDebugFlag = flag; - tsdbDebugFlag = flag; - tqDebugFlag = flag; - fsDebugFlag = flag; - udfDebugFlag = flag; - smaDebugFlag = flag; - idxDebugFlag = flag; + taosSetDebugFlag(&uDebugFlag, "uDebugFlag", flag); + taosSetDebugFlag(&rpcDebugFlag, "rpcDebugFlag", flag); + taosSetDebugFlag(&jniDebugFlag, "jniDebugFlag", flag); + taosSetDebugFlag(&qDebugFlag, "qDebugFlag", flag); + taosSetDebugFlag(&cDebugFlag, "cDebugFlag", flag); + taosSetDebugFlag(&dDebugFlag, "dDebugFlag", flag); + taosSetDebugFlag(&vDebugFlag, "vDebugFlag", flag); + taosSetDebugFlag(&mDebugFlag, "mDebugFlag", flag); + taosSetDebugFlag(&wDebugFlag, "wDebugFlag", flag); + taosSetDebugFlag(&sDebugFlag, "sDebugFlag", flag); + taosSetDebugFlag(&tsdbDebugFlag, "tsdbDebugFlag", flag); + taosSetDebugFlag(&tqDebugFlag, "tqDebugFlag", flag); + taosSetDebugFlag(&fsDebugFlag, "fsDebugFlag", flag); + taosSetDebugFlag(&udfDebugFlag, "udfDebugFlag", flag); + taosSetDebugFlag(&smaDebugFlag, "smaDebugFlag", flag); + taosSetDebugFlag(&idxDebugFlag, "idxDebugFlag", flag); uInfo("all debug flag are set to %d", flag); } From 66bad33c9e8e3f986c43f519202ef9bc42e35baa Mon Sep 17 00:00:00 2001 From: shenglian zhou Date: Mon, 25 Jul 2022 15:34:11 +0800 Subject: [PATCH 10/54] fix: fix compilation error --- source/libs/executor/src/scanoperator.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c index 8df22bbb11..9d6c800ceb 100644 --- a/source/libs/executor/src/scanoperator.c +++ b/source/libs/executor/src/scanoperator.c @@ -2698,9 +2698,9 @@ static int32_t loadDataBlockFromOneTable(SOperatorInfo* pOperator, STableMergeSc relocateColumnData(pBlock, pTableScanInfo->pColMatchInfo, pCols, true); // currently only the tbname pseudo column - if (pTableScanInfo->numOfPseudoExpr > 0) { - int32_t code = addTagPseudoColumnData(&pTableScanInfo->readHandle, pTableScanInfo->pPseudoExpr, - pTableScanInfo->numOfPseudoExpr, pBlock, GET_TASKID(pTaskInfo)); + if (pTableScanInfo->pseudoSup.numOfExprs > 0) { + int32_t code = addTagPseudoColumnData(&pTableScanInfo->readHandle, pTableScanInfo->pseudoSup.pExprInfo, + pTableScanInfo->pseudoSup.numOfExprs, pBlock, GET_TASKID(pTaskInfo)); if (code != TSDB_CODE_SUCCESS) { longjmp(pTaskInfo->env, code); } From db48f118a13a08af695d4d9e2289fa8057c41e71 Mon Sep 17 00:00:00 2001 From: Ganlin Zhao Date: Mon, 25 Jul 2022 15:34:46 +0800 Subject: [PATCH 11/54] enh(query): add selectivity for diff function TD-17659 --- include/libs/function/function.h | 1 + source/libs/executor/src/executorimpl.c | 5 +++ source/libs/function/src/builtins.c | 2 +- source/libs/function/src/builtinsimpl.c | 44 +++++++++++++++++++++++-- 4 files changed, 49 insertions(+), 3 deletions(-) diff --git a/include/libs/function/function.h b/include/libs/function/function.h index 8cb48cc9f0..8fa63bbd45 100644 --- a/include/libs/function/function.h +++ b/include/libs/function/function.h @@ -143,6 +143,7 @@ typedef struct SqlFunctionCtx { struct SExprInfo *pExpr; struct SDiskbasedBuf *pBuf; struct SSDataBlock *pSrcBlock; + struct SSDataBlock *pDstBlock; // used by indifinite rows function to set selectivity int32_t curBufPage; bool increase; diff --git a/source/libs/executor/src/executorimpl.c b/source/libs/executor/src/executorimpl.c index 7bac828a53..9dc6e7898e 100644 --- a/source/libs/executor/src/executorimpl.c +++ b/source/libs/executor/src/executorimpl.c @@ -651,6 +651,11 @@ int32_t projectApplyFunctions(SExprInfo* pExpr, SSDataBlock* pResult, SSDataBloc pfCtx->pTsOutput = (SColumnInfoData*)pCtx[*outputColIndex].pOutput; } + // link pDstBlock to set selectivity value + if (pfCtx->subsidiaries.num > 0) { + pfCtx->pDstBlock = pResult; + } + numOfRows = pfCtx->fpSet.process(pfCtx); } else if (fmIsAggFunc(pfCtx->functionId)) { // _group_key function for "partition by tbname" + csum(col_name) query diff --git a/source/libs/function/src/builtins.c b/source/libs/function/src/builtins.c index 324a17320e..78c65d40f5 100644 --- a/source/libs/function/src/builtins.c +++ b/source/libs/function/src/builtins.c @@ -2425,7 +2425,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { { .name = "diff", .type = FUNCTION_TYPE_DIFF, - .classification = FUNC_MGT_INDEFINITE_ROWS_FUNC | FUNC_MGT_TIMELINE_FUNC | FUNC_MGT_FORBID_STREAM_FUNC, + .classification = FUNC_MGT_INDEFINITE_ROWS_FUNC | FUNC_MGT_SELECT_FUNC | FUNC_MGT_TIMELINE_FUNC | FUNC_MGT_FORBID_STREAM_FUNC, .translateFunc = translateDiff, .getEnvFunc = getDiffFuncEnv, .initFunc = diffFunctionSetup, diff --git a/source/libs/function/src/builtinsimpl.c b/source/libs/function/src/builtinsimpl.c index b6fe5b9998..2d3f649739 100644 --- a/source/libs/function/src/builtinsimpl.c +++ b/source/libs/function/src/builtinsimpl.c @@ -1624,6 +1624,10 @@ int32_t minmaxFunctionFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) { } void setNullSelectivityValue(SqlFunctionCtx* pCtx, SSDataBlock* pBlock, int32_t rowIndex) { + if (pCtx->subsidiaries.num <= 0) { + return; + } + for (int32_t j = 0; j < pCtx->subsidiaries.num; ++j) { SqlFunctionCtx* pc = pCtx->subsidiaries.pCtx[j]; int32_t dstSlotId = pc->pExpr->base.resSchema.slotId; @@ -1655,8 +1659,6 @@ void setSelectivityValue(SqlFunctionCtx* pCtx, SSDataBlock* pBlock, const STuple SFunctParam* pFuncParam = &pc->pExpr->base.pParam[0]; int32_t dstSlotId = pc->pExpr->base.resSchema.slotId; - int32_t ps = 0; - SColumnInfoData* pDstCol = taosArrayGet(pBlock->pDataBlock, dstSlotId); ASSERT(pc->pExpr->base.resSchema.bytes == pDstCol->info.bytes); if (nullList[j]) { @@ -1678,6 +1680,39 @@ void releaseSource(STuplePos* pPos) { // Todo(liuyao) relase row } +// This function append the selectivity to subsidiaries function context directly, without fetching data +// from intermediate disk based buf page +void appendSelectivityValue(SqlFunctionCtx* pCtx, int32_t rowIndex) { + if (pCtx->subsidiaries.num <= 0) { + return; + } + + for (int32_t j = 0; j < pCtx->subsidiaries.num; ++j) { + SqlFunctionCtx* pc = pCtx->subsidiaries.pCtx[j]; + + // get data from source col + SFunctParam* pFuncParam = &pc->pExpr->base.pParam[0]; + int32_t srcSlotId = pFuncParam->pCol->slotId; + + SColumnInfoData* pSrcCol = taosArrayGet(pCtx->pSrcBlock->pDataBlock, srcSlotId); + + char* pData = colDataGetData(pSrcCol, rowIndex); + + // append to dest col + int32_t dstSlotId = pc->pExpr->base.resSchema.slotId; + + SColumnInfoData* pDstCol = taosArrayGet(pCtx->pDstBlock->pDataBlock, dstSlotId); + ASSERT(pc->pExpr->base.resSchema.bytes == pDstCol->info.bytes); + + if (colDataIsNull_s(pSrcCol, rowIndex) == true) { + colDataAppendNULL(pDstCol, rowIndex); + } else { + colDataAppend(pDstCol, rowIndex, pData, false); + } + } + +} + void replaceTupleData(STuplePos* pDestPos, STuplePos* pSourcePos) { releaseSource(pDestPos); *pDestPos = *pSourcePos; @@ -3154,6 +3189,7 @@ static void doHandleDiff(SDiffInfo* pDiffInfo, int32_t type, const char* pv, SCo colDataAppendInt64(pOutput, pos, &delta); } pDiffInfo->prev.i64 = v; + break; } case TSDB_DATA_TYPE_BOOL: @@ -3247,6 +3283,8 @@ int32_t diffFunction(SqlFunctionCtx* pCtx) { if (pDiffInfo->hasPrev) { doHandleDiff(pDiffInfo, pInputCol->info.type, pv, pOutput, pos, pCtx->order); + // handle selectivity + appendSelectivityValue(pCtx, pos); numOfElems++; } else { @@ -3273,6 +3311,8 @@ int32_t diffFunction(SqlFunctionCtx* pCtx) { // there is a row of previous data block to be handled in the first place. if (pDiffInfo->hasPrev) { doHandleDiff(pDiffInfo, pInputCol->info.type, pv, pOutput, pos, pCtx->order); + // handle selectivity + appendSelectivityValue(pCtx, pos); numOfElems++; } else { From 8537449f9081cb850913eb4dbce97dbfadc03e1c Mon Sep 17 00:00:00 2001 From: Ganlin Zhao Date: Mon, 25 Jul 2022 15:54:36 +0800 Subject: [PATCH 12/54] fix diff function selectivity output index --- source/libs/function/src/builtinsimpl.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/source/libs/function/src/builtinsimpl.c b/source/libs/function/src/builtinsimpl.c index 2d3f649739..ba389180af 100644 --- a/source/libs/function/src/builtinsimpl.c +++ b/source/libs/function/src/builtinsimpl.c @@ -1682,7 +1682,7 @@ void releaseSource(STuplePos* pPos) { // This function append the selectivity to subsidiaries function context directly, without fetching data // from intermediate disk based buf page -void appendSelectivityValue(SqlFunctionCtx* pCtx, int32_t rowIndex) { +void appendSelectivityValue(SqlFunctionCtx* pCtx, int32_t rowIndex, int32_t pos) { if (pCtx->subsidiaries.num <= 0) { return; } @@ -1705,9 +1705,9 @@ void appendSelectivityValue(SqlFunctionCtx* pCtx, int32_t rowIndex) { ASSERT(pc->pExpr->base.resSchema.bytes == pDstCol->info.bytes); if (colDataIsNull_s(pSrcCol, rowIndex) == true) { - colDataAppendNULL(pDstCol, rowIndex); + colDataAppendNULL(pDstCol, pos); } else { - colDataAppend(pDstCol, rowIndex, pData, false); + colDataAppend(pDstCol, pos, pData, false); } } @@ -3284,7 +3284,9 @@ int32_t diffFunction(SqlFunctionCtx* pCtx) { if (pDiffInfo->hasPrev) { doHandleDiff(pDiffInfo, pInputCol->info.type, pv, pOutput, pos, pCtx->order); // handle selectivity - appendSelectivityValue(pCtx, pos); + if (pCtx->subsidiaries.num > 0) { + appendSelectivityValue(pCtx, i, pos); + } numOfElems++; } else { @@ -3312,7 +3314,9 @@ int32_t diffFunction(SqlFunctionCtx* pCtx) { if (pDiffInfo->hasPrev) { doHandleDiff(pDiffInfo, pInputCol->info.type, pv, pOutput, pos, pCtx->order); // handle selectivity - appendSelectivityValue(pCtx, pos); + if (pCtx->subsidiaries.num > 0) { + appendSelectivityValue(pCtx, i, pos); + } numOfElems++; } else { From 90b3e77698231a1ebbc07e81934cc0ad8b83c2ea Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Mon, 25 Jul 2022 16:02:49 +0800 Subject: [PATCH 13/54] fix(query):disable merge for project operator in stream processing. --- source/dnode/vnode/src/tsdb/tsdbUtil.c | 89 +++++++++++++++++++--- source/libs/executor/src/executor.c | 1 + source/libs/executor/src/projectoperator.c | 2 +- source/libs/function/src/builtins.c | 2 +- 4 files changed, 83 insertions(+), 11 deletions(-) diff --git a/source/dnode/vnode/src/tsdb/tsdbUtil.c b/source/dnode/vnode/src/tsdb/tsdbUtil.c index f318c69c6f..872357fc93 100644 --- a/source/dnode/vnode/src/tsdb/tsdbUtil.c +++ b/source/dnode/vnode/src/tsdb/tsdbUtil.c @@ -1395,10 +1395,26 @@ void tsdbCalcColDataSMA(SColData *pColData, SColumnDataAgg *pColAgg) { break; case TSDB_DATA_TYPE_BOOL: break; - case TSDB_DATA_TYPE_TINYINT: + case TSDB_DATA_TYPE_TINYINT:{ + pColAgg->sum += colVal.value.i8; + if (pColAgg->min > colVal.value.i8) { + pColAgg->min = colVal.value.i8; + } + if (pColAgg->max < colVal.value.i8) { + pColAgg->max = colVal.value.i8; + } break; - case TSDB_DATA_TYPE_SMALLINT: + } + case TSDB_DATA_TYPE_SMALLINT:{ + pColAgg->sum += colVal.value.i16; + if (pColAgg->min > colVal.value.i16) { + pColAgg->min = colVal.value.i16; + } + if (pColAgg->max < colVal.value.i16) { + pColAgg->max = colVal.value.i16; + } break; + } case TSDB_DATA_TYPE_INT: { pColAgg->sum += colVal.value.i32; if (pColAgg->min > colVal.value.i32) { @@ -1419,24 +1435,79 @@ void tsdbCalcColDataSMA(SColData *pColData, SColumnDataAgg *pColAgg) { } break; } - case TSDB_DATA_TYPE_FLOAT: + case TSDB_DATA_TYPE_FLOAT:{ + pColAgg->sum += colVal.value.f; + if (pColAgg->min > colVal.value.f) { + pColAgg->min = colVal.value.f; + } + if (pColAgg->max < colVal.value.f) { + pColAgg->max = colVal.value.f; + } break; - case TSDB_DATA_TYPE_DOUBLE: + } + case TSDB_DATA_TYPE_DOUBLE:{ + pColAgg->sum += colVal.value.d; + if (pColAgg->min > colVal.value.d) { + pColAgg->min = colVal.value.d; + } + if (pColAgg->max < colVal.value.d) { + pColAgg->max = colVal.value.d; + } break; + } case TSDB_DATA_TYPE_VARCHAR: break; - case TSDB_DATA_TYPE_TIMESTAMP: + case TSDB_DATA_TYPE_TIMESTAMP:{ + if (pColAgg->min > colVal.value.i64) { + pColAgg->min = colVal.value.i64; + } + if (pColAgg->max < colVal.value.i64) { + pColAgg->max = colVal.value.i64; + } break; + } case TSDB_DATA_TYPE_NCHAR: break; - case TSDB_DATA_TYPE_UTINYINT: + case TSDB_DATA_TYPE_UTINYINT:{ + pColAgg->sum += colVal.value.u8; + if (pColAgg->min > colVal.value.u8) { + pColAgg->min = colVal.value.u8; + } + if (pColAgg->max < colVal.value.u8) { + pColAgg->max = colVal.value.u8; + } break; - case TSDB_DATA_TYPE_USMALLINT: + } + case TSDB_DATA_TYPE_USMALLINT:{ + pColAgg->sum += colVal.value.u16; + if (pColAgg->min > colVal.value.u16) { + pColAgg->min = colVal.value.u16; + } + if (pColAgg->max < colVal.value.u16) { + pColAgg->max = colVal.value.u16; + } break; - case TSDB_DATA_TYPE_UINT: + } + case TSDB_DATA_TYPE_UINT:{ + pColAgg->sum += colVal.value.u32; + if (pColAgg->min > colVal.value.u32) { + pColAgg->min = colVal.value.u32; + } + if (pColAgg->max < colVal.value.u32) { + pColAgg->max = colVal.value.u32; + } break; - case TSDB_DATA_TYPE_UBIGINT: + } + case TSDB_DATA_TYPE_UBIGINT:{ + pColAgg->sum += colVal.value.u64; + if (pColAgg->min > colVal.value.u64) { + pColAgg->min = colVal.value.u64; + } + if (pColAgg->max < colVal.value.u64) { + pColAgg->max = colVal.value.u64; + } break; + } case TSDB_DATA_TYPE_JSON: break; case TSDB_DATA_TYPE_VARBINARY: diff --git a/source/libs/executor/src/executor.c b/source/libs/executor/src/executor.c index d8cd76d31e..f249321a76 100644 --- a/source/libs/executor/src/executor.c +++ b/source/libs/executor/src/executor.c @@ -416,6 +416,7 @@ int32_t qExecTask(qTaskInfo_t tinfo, SSDataBlock** pRes, uint64_t* useconds) { } if (isTaskKilled(pTaskInfo)) { + 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/projectoperator.c b/source/libs/executor/src/projectoperator.c index 34149d7499..3f3df6a8f0 100644 --- a/source/libs/executor/src/projectoperator.c +++ b/source/libs/executor/src/projectoperator.c @@ -69,7 +69,7 @@ SOperatorInfo* createProjectOperatorInfo(SOperatorInfo* downstream, SProjectPhys // todo remove it soon if (pTaskInfo->execModel == OPTR_EXEC_MODEL_STREAM) { - pInfo->mergeDataBlocks = true; + pInfo->mergeDataBlocks = false; } int32_t numOfRows = 4096; diff --git a/source/libs/function/src/builtins.c b/source/libs/function/src/builtins.c index 324a17320e..43a5d19ada 100644 --- a/source/libs/function/src/builtins.c +++ b/source/libs/function/src/builtins.c @@ -1532,7 +1532,7 @@ static int32_t translateDiff(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { } uint8_t resType; - if (IS_SIGNED_NUMERIC_TYPE(colType) || TSDB_DATA_TYPE_BOOL == colType) { + if (IS_SIGNED_NUMERIC_TYPE(colType) || TSDB_DATA_TYPE_BOOL == colType || TSDB_DATA_TYPE_TIMESTAMP == colType) { resType = TSDB_DATA_TYPE_BIGINT; } else { resType = TSDB_DATA_TYPE_DOUBLE; From e8da4f429c88c3eca9c6aa971f4645c4e3acb79c Mon Sep 17 00:00:00 2001 From: Ganlin Zhao Date: Mon, 25 Jul 2022 16:04:28 +0800 Subject: [PATCH 14/54] enh(query): add derivative function selectivity TD-17659 --- source/libs/function/src/builtins.c | 2 +- source/libs/function/src/builtinsimpl.c | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/source/libs/function/src/builtins.c b/source/libs/function/src/builtins.c index 78c65d40f5..c55d15badb 100644 --- a/source/libs/function/src/builtins.c +++ b/source/libs/function/src/builtins.c @@ -2220,7 +2220,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { { .name = "derivative", .type = FUNCTION_TYPE_DERIVATIVE, - .classification = FUNC_MGT_INDEFINITE_ROWS_FUNC | FUNC_MGT_TIMELINE_FUNC | FUNC_MGT_IMPLICIT_TS_FUNC, + .classification = FUNC_MGT_INDEFINITE_ROWS_FUNC | FUNC_MGT_SELECT_FUNC | FUNC_MGT_TIMELINE_FUNC | FUNC_MGT_IMPLICIT_TS_FUNC, .translateFunc = translateDerivative, .getEnvFunc = getDerivativeFuncEnv, .initFunc = derivativeFuncSetup, diff --git a/source/libs/function/src/builtinsimpl.c b/source/libs/function/src/builtinsimpl.c index ba389180af..5ad433c9ff 100644 --- a/source/libs/function/src/builtinsimpl.c +++ b/source/libs/function/src/builtinsimpl.c @@ -5767,6 +5767,12 @@ int32_t derivativeFunction(SqlFunctionCtx* pCtx) { if (pTsOutput != NULL) { colDataAppendInt64(pTsOutput, pos, &tsList[i]); } + + // handle selectivity + if (pCtx->subsidiaries.num > 0) { + appendSelectivityValue(pCtx, i, pos); + } + numOfElems++; } } @@ -5799,6 +5805,12 @@ int32_t derivativeFunction(SqlFunctionCtx* pCtx) { if (pTsOutput != NULL) { colDataAppendInt64(pTsOutput, pos, &pDerivInfo->prevTs); } + + // handle selectivity + if (pCtx->subsidiaries.num > 0) { + appendSelectivityValue(pCtx, i, pos); + } + numOfElems++; } } From 222e925644eeb77a977301e7b342f4bbdf6d17a4 Mon Sep 17 00:00:00 2001 From: Liu Jicong Date: Mon, 25 Jul 2022 15:31:36 +0800 Subject: [PATCH 15/54] feat(wal): ref --- source/dnode/vnode/src/tq/tq.c | 4 ++-- source/dnode/vnode/src/tq/tqMeta.c | 11 +++++++++-- source/libs/wal/src/walRead.c | 2 +- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/source/dnode/vnode/src/tq/tq.c b/source/dnode/vnode/src/tq/tq.c index 740cfba9e3..118e3a5d43 100644 --- a/source/dnode/vnode/src/tq/tq.c +++ b/source/dnode/vnode/src/tq/tq.c @@ -385,8 +385,8 @@ int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg) { } if (pHandle->execHandle.subType != TOPIC_SUB_TYPE__COLUMN) { - int64_t fetchVer = fetchOffsetNew.version + 1; - SWalCkHead* pCkHead = taosMemoryMalloc(sizeof(SWalCkHead) + 2048); + int64_t fetchVer = fetchOffsetNew.version + 1; + pCkHead = taosMemoryMalloc(sizeof(SWalCkHead) + 2048); if (pCkHead == NULL) { code = -1; goto OVER; diff --git a/source/dnode/vnode/src/tq/tqMeta.c b/source/dnode/vnode/src/tq/tqMeta.c index 620417016f..290ffe5c8d 100644 --- a/source/dnode/vnode/src/tq/tqMeta.c +++ b/source/dnode/vnode/src/tq/tqMeta.c @@ -52,7 +52,7 @@ int32_t tqMetaOpen(STQ* pTq) { ASSERT(0); } - TXN txn; + TXN txn = {0}; if (tdbTxnOpen(&txn, 0, tdbDefaultMalloc, tdbDefaultFree, NULL, 0) < 0) { ASSERT(0); @@ -75,7 +75,13 @@ int32_t tqMetaOpen(STQ* pTq) { STqHandle handle; tDecoderInit(&decoder, (uint8_t*)pVal, vLen); tDecodeSTqHandle(&decoder, &handle); - handle.pWalReader = walOpenReader(pTq->pVnode->pWal, NULL); + + handle.pRef = walOpenRef(pTq->pVnode->pWal); + if (handle.pRef == NULL) { + ASSERT(0); + } + walRefVer(handle.pRef, handle.snapshotVer); + if (handle.execHandle.subType == TOPIC_SUB_TYPE__COLUMN) { SReadHandle reader = { .meta = pTq->pVnode->pMeta, @@ -94,6 +100,7 @@ int32_t tqMetaOpen(STQ* pTq) { handle.execHandle.pExecReader = qExtractReaderFromStreamScanner(scanner); ASSERT(handle.execHandle.pExecReader); } else { + handle.pWalReader = walOpenReader(pTq->pVnode->pWal, NULL); handle.execHandle.execDb.pFilterOutTbUid = taosHashInit(64, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), false, HASH_NO_LOCK); } diff --git a/source/libs/wal/src/walRead.c b/source/libs/wal/src/walRead.c index 37d7a8c3a9..ac62b7d98d 100644 --- a/source/libs/wal/src/walRead.c +++ b/source/libs/wal/src/walRead.c @@ -54,7 +54,7 @@ SWalReader *walOpenReader(SWal *pWal, SWalFilterCond *cond) { } /*if (pReader->cond.enableRef) {*/ - /*taosHashPut(pWal->pRefHash, &pReader->readerId, sizeof(int64_t), &pReader, sizeof(void *));*/ + /* taosHashPut(pWal->pRefHash, &pReader->readerId, sizeof(int64_t), &pReader, sizeof(void *));*/ /*}*/ return pReader; From 0494f4a6e9716b31a935b7a8e127a8370deab369 Mon Sep 17 00:00:00 2001 From: shenglian zhou Date: Mon, 25 Jul 2022 16:41:32 +0800 Subject: [PATCH 16/54] fix: fix table merge scan memory leak --- source/libs/executor/src/scanoperator.c | 34 ++++++++++++++----------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c index 89db5761c2..2dcb555834 100644 --- a/source/libs/executor/src/scanoperator.c +++ b/source/libs/executor/src/scanoperator.c @@ -2829,29 +2829,31 @@ int32_t stopGroupTableMergeScan(SOperatorInfo* pOperator) { STableMergeScanInfo* pInfo = pOperator->info; SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo; - tsortDestroySortHandle(pInfo->pSortHandle); + size_t numReaders = taosArrayGetSize(pInfo->dataReaders); + + for (int32_t i = 0; i < numReaders; ++i) { + STableMergeScanSortSourceParam* param = taosArrayGet(pInfo->sortSourceParams, i); + blockDataDestroy(param->inputBlock); + } taosArrayClear(pInfo->sortSourceParams); - for (int32_t i = 0; i < taosArrayGetSize(pInfo->dataReaders); ++i) { + tsortDestroySortHandle(pInfo->pSortHandle); + + for (int32_t i = 0; i < numReaders; ++i) { STsdbReader* reader = taosArrayGetP(pInfo->dataReaders, i); tsdbReaderClose(reader); } - taosArrayDestroy(pInfo->dataReaders); pInfo->dataReaders = NULL; return TSDB_CODE_SUCCESS; } -SSDataBlock* getSortedTableMergeScanBlockData(SSortHandle* pHandle, int32_t capacity, SOperatorInfo* pOperator) { +SSDataBlock* getSortedTableMergeScanBlockData(SSortHandle* pHandle, SSDataBlock* pResBlock, int32_t capacity, SOperatorInfo* pOperator) { STableMergeScanInfo* pInfo = pOperator->info; SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo; - SSDataBlock* p = tsortGetSortedDataBlock(pHandle); - if (p == NULL) { - return NULL; - } - - blockDataEnsureCapacity(p, capacity); + blockDataCleanup(pResBlock); + blockDataEnsureCapacity(pResBlock, capacity); while (1) { STupleHandle* pTupleHandle = tsortNextTuple(pHandle); @@ -2859,14 +2861,15 @@ SSDataBlock* getSortedTableMergeScanBlockData(SSortHandle* pHandle, int32_t capa break; } - appendOneRowToDataBlock(p, pTupleHandle); - if (p->info.rows >= capacity) { + appendOneRowToDataBlock(pResBlock, pTupleHandle); + if (pResBlock->info.rows >= capacity) { break; } } - qDebug("%s get sorted row blocks, rows:%d", GET_TASKID(pTaskInfo), p->info.rows); - return (p->info.rows > 0) ? p : NULL; + + qDebug("%s get sorted row blocks, rows:%d", GET_TASKID(pTaskInfo), pResBlock->info.rows); + return (pResBlock->info.rows > 0) ? pResBlock : NULL; } SSDataBlock* doTableMergeScan(SOperatorInfo* pOperator) { @@ -2895,7 +2898,7 @@ SSDataBlock* doTableMergeScan(SOperatorInfo* pOperator) { } SSDataBlock* pBlock = NULL; while (pInfo->tableStartIndex < tableListSize) { - pBlock = getSortedTableMergeScanBlockData(pInfo->pSortHandle, pOperator->resultInfo.capacity, pOperator); + pBlock = getSortedTableMergeScanBlockData(pInfo->pSortHandle, pInfo->pResBlock, pOperator->resultInfo.capacity, pOperator); if (pBlock != NULL) { pBlock->info.groupId = pInfo->groupId; pOperator->resultInfo.totalRows += pBlock->info.rows; @@ -2919,6 +2922,7 @@ SSDataBlock* doTableMergeScan(SOperatorInfo* pOperator) { void destroyTableMergeScanOperatorInfo(void* param, int32_t numOfOutput) { STableMergeScanInfo* pTableScanInfo = (STableMergeScanInfo*)param; cleanupQueryTableDataCond(&pTableScanInfo->cond); + taosArrayDestroy(pTableScanInfo->sortSourceParams); for (int32_t i = 0; i < taosArrayGetSize(pTableScanInfo->dataReaders); ++i) { STsdbReader* reader = taosArrayGetP(pTableScanInfo->dataReaders, i); From 8bb432c348e8e5bf8cc03fd6ddfc49978110ca2f Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Mon, 25 Jul 2022 16:45:23 +0800 Subject: [PATCH 17/54] feat: super table order by primary key optimization --- include/libs/nodes/querynodes.h | 1 + source/libs/nodes/src/nodesCloneFuncs.c | 2 ++ source/libs/parser/src/parAstCreater.c | 1 + source/libs/planner/src/planLogicCreater.c | 8 +++++--- source/libs/planner/src/planPhysiCreater.c | 3 +++ 5 files changed, 12 insertions(+), 3 deletions(-) diff --git a/include/libs/nodes/querynodes.h b/include/libs/nodes/querynodes.h index f8c7024591..81ed5b5ecd 100644 --- a/include/libs/nodes/querynodes.h +++ b/include/libs/nodes/querynodes.h @@ -255,6 +255,7 @@ typedef struct SSelectStmt { int32_t selectFuncNum; bool isEmptyResult; bool isTimeLineResult; + bool isSubquery; bool hasAggFuncs; bool hasRepeatScanFuncs; bool hasIndefiniteRowsFunc; diff --git a/source/libs/nodes/src/nodesCloneFuncs.c b/source/libs/nodes/src/nodesCloneFuncs.c index 121e697630..5279d015b4 100644 --- a/source/libs/nodes/src/nodesCloneFuncs.c +++ b/source/libs/nodes/src/nodesCloneFuncs.c @@ -375,6 +375,7 @@ static int32_t logicJoinCopy(const SJoinLogicNode* pSrc, SJoinLogicNode* pDst) { CLONE_NODE_FIELD(pMergeCondition); CLONE_NODE_FIELD(pOnConditions); COPY_SCALAR_FIELD(isSingleTableJoin); + COPY_SCALAR_FIELD(inputTsOrder); return TSDB_CODE_SUCCESS; } @@ -440,6 +441,7 @@ static int32_t logicWindowCopy(const SWindowLogicNode* pSrc, SWindowLogicNode* p COPY_SCALAR_FIELD(watermark); COPY_SCALAR_FIELD(igExpired); COPY_SCALAR_FIELD(windowAlgo); + COPY_SCALAR_FIELD(inputTsOrder); return TSDB_CODE_SUCCESS; } diff --git a/source/libs/parser/src/parAstCreater.c b/source/libs/parser/src/parAstCreater.c index f52ee9af50..a54dae1ee9 100644 --- a/source/libs/parser/src/parAstCreater.c +++ b/source/libs/parser/src/parAstCreater.c @@ -527,6 +527,7 @@ SNode* createTempTableNode(SAstCreateContext* pCxt, SNode* pSubquery, const STok } if (QUERY_NODE_SELECT_STMT == nodeType(pSubquery)) { strcpy(((SSelectStmt*)pSubquery)->stmtName, tempTable->table.tableAlias); + ((SSelectStmt*)pSubquery)->isSubquery = true; } else if (QUERY_NODE_SET_OPERATOR == nodeType(pSubquery)) { strcpy(((SSetOperator*)pSubquery)->stmtName, tempTable->table.tableAlias); } diff --git a/source/libs/planner/src/planLogicCreater.c b/source/libs/planner/src/planLogicCreater.c index 84e712b466..30e3b676df 100644 --- a/source/libs/planner/src/planLogicCreater.c +++ b/source/libs/planner/src/planLogicCreater.c @@ -339,6 +339,7 @@ static int32_t createJoinLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pSelect pJoin->joinType = pJoinTable->joinType; pJoin->isSingleTableJoin = pJoinTable->table.singleTable; + pJoin->inputTsOrder = ORDER_ASC; pJoin->node.groupAction = GROUP_ACTION_CLEAR; pJoin->node.requireDataOrder = DATA_ORDER_LEVEL_GLOBAL; pJoin->node.requireDataOrder = DATA_ORDER_LEVEL_GLOBAL; @@ -625,14 +626,14 @@ static int32_t createInterpFuncLogicNode(SLogicPlanContext* pCxt, SSelectStmt* p static int32_t createWindowLogicNodeFinalize(SLogicPlanContext* pCxt, SSelectStmt* pSelect, SWindowLogicNode* pWindow, SLogicNode** pLogicNode) { - int32_t code = nodesCollectFuncs(pSelect, SQL_CLAUSE_WINDOW, fmIsWindowClauseFunc, &pWindow->pFuncs); - if (pCxt->pPlanCxt->streamQuery) { pWindow->triggerType = pCxt->pPlanCxt->triggerType; pWindow->watermark = pCxt->pPlanCxt->watermark; pWindow->igExpired = pCxt->pPlanCxt->igExpired; } + pWindow->inputTsOrder = ORDER_ASC; + int32_t code = nodesCollectFuncs(pSelect, SQL_CLAUSE_WINDOW, fmIsWindowClauseFunc, &pWindow->pFuncs); if (TSDB_CODE_SUCCESS == code) { code = rewriteExprsForSelect(pWindow->pFuncs, pSelect, SQL_CLAUSE_WINDOW); } @@ -861,7 +862,8 @@ static int32_t createProjectLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pSel TSWAP(pProject->node.pLimit, pSelect->pLimit); TSWAP(pProject->node.pSlimit, pSelect->pSlimit); - pProject->node.groupAction = GROUP_ACTION_CLEAR; + pProject->node.groupAction = + (!pSelect->isSubquery && pCxt->pPlanCxt->streamQuery) ? GROUP_ACTION_KEEP : GROUP_ACTION_CLEAR; pProject->node.requireDataOrder = DATA_ORDER_LEVEL_NONE; pProject->node.resultDataOrder = DATA_ORDER_LEVEL_NONE; diff --git a/source/libs/planner/src/planPhysiCreater.c b/source/libs/planner/src/planPhysiCreater.c index 38f3c23925..587e566939 100644 --- a/source/libs/planner/src/planPhysiCreater.c +++ b/source/libs/planner/src/planPhysiCreater.c @@ -974,6 +974,9 @@ static int32_t createInterpFuncPhysiNode(SPhysiPlanContext* pCxt, SNodeList* pCh } static bool projectCanMergeDataBlock(SProjectLogicNode* pProject) { + if (GROUP_ACTION_KEEP == pProject->node.groupAction) { + return false; + } if (DATA_ORDER_LEVEL_NONE == pProject->node.resultDataOrder) { return true; } From 8dacdd57c5e57d7297d9553807c46ed214f4c518 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Mon, 25 Jul 2022 17:10:04 +0800 Subject: [PATCH 18/54] enh: add batch processing method to vnode --- source/dnode/vnode/src/vnd/vnodeSync.c | 158 +++++++++++++++++++------ 1 file changed, 120 insertions(+), 38 deletions(-) diff --git a/source/dnode/vnode/src/vnd/vnodeSync.c b/source/dnode/vnode/src/vnd/vnodeSync.c index dbe4458681..b00d6b5eb6 100644 --- a/source/dnode/vnode/src/vnd/vnodeSync.c +++ b/source/dnode/vnode/src/vnd/vnodeSync.c @@ -16,23 +16,28 @@ #define _DEFAULT_SOURCE #include "vnd.h" +#define BATCH_DISABLE 1 + static inline bool vnodeIsMsgBlock(tmsg_t type) { return (type == TDMT_VND_CREATE_TABLE) || (type == TDMT_VND_CREATE_TABLE) || (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_TABLE) || (type == TDMT_VND_DROP_TABLE) || (type == TDMT_VND_UPDATE_TAG_VAL) || + (type == TDMT_VND_ALTER_REPLICA); } static inline bool vnodeIsMsgWeak(tmsg_t type) { return false; } static inline void vnodeWaitBlockMsg(SVnode *pVnode, const SRpcMsg *pMsg) { if (vnodeIsMsgBlock(pMsg->msgType)) { - vTrace("vgId:%d, msg:%p wait block, type:%s", pVnode->config.vgId, pMsg, TMSG_INFO(pMsg->msgType)); + const STraceId *trace = &pMsg->info.traceId; + vGTrace("vgId:%d, msg:%p wait block, type:%s", pVnode->config.vgId, pMsg, TMSG_INFO(pMsg->msgType)); tsem_wait(&pVnode->syncSem); } } static inline void vnodePostBlockMsg(SVnode *pVnode, const SRpcMsg *pMsg) { if (vnodeIsMsgBlock(pMsg->msgType)) { - vTrace("vgId:%d, msg:%p post block, type:%s", pVnode->config.vgId, pMsg, TMSG_INFO(pMsg->msgType)); + const STraceId *trace = &pMsg->info.traceId; + vGTrace("vgId:%d, msg:%p post block, type:%s", pVnode->config.vgId, pMsg, TMSG_INFO(pMsg->msgType)); tsem_post(&pVnode->syncSem); } } @@ -124,60 +129,137 @@ void vnodeRedirectRpcMsg(SVnode *pVnode, SRpcMsg *pMsg) { tmsgSendRedirectRsp(&rsp, &newEpSet); } +static void inline vnodeHandleWriteMsg(SVnode *pVnode, SRpcMsg *pMsg) { + SRpcMsg rsp = {.code = pMsg->code, .info = pMsg->info}; + if (vnodeProcessWriteMsg(pVnode, pMsg, pMsg->info.conn.applyIndex, &rsp) < 0) { + rsp.code = terrno; + const STraceId *trace = &pMsg->info.traceId; + vGError("vgId:%d, msg:%p failed to apply right now since %s", pVnode->config.vgId, pMsg, terrstr()); + } + if (rsp.info.handle != NULL) { + tmsgSendRsp(&rsp); + } +} + +static void vnodeHandleProposeError(SVnode *pVnode, SRpcMsg *pMsg, int32_t code) { + if (code == TSDB_CODE_SYN_NOT_LEADER) { + vnodeRedirectRpcMsg(pVnode, pMsg); + } else { + const STraceId *trace = &pMsg->info.traceId; + vGError("vgId:%d, msg:%p failed to propose since %s, code:0x%x", pVnode->config.vgId, pMsg, tstrerror(code), code); + SRpcMsg rsp = {.code = code, .info = pMsg->info}; + if (rsp.info.handle != NULL) { + tmsgSendRsp(&rsp); + } + } +} + +static void vnodeHandleAlterReplicaReq(SVnode *pVnode, SRpcMsg *pMsg) { + int32_t code = vnodeProcessAlterReplicaReq(pVnode, pMsg); + + if (code > 0) { + ASSERT(0); + } else if (code == 0) { + vnodeWaitBlockMsg(pVnode, pMsg); + } else { + if (terrno != 0) code = terrno; + vnodeHandleProposeError(pVnode, pMsg, code); + } + + const STraceId *trace = &pMsg->info.traceId; + vGTrace("vgId:%d, msg:%p is freed, code:0x%x", pVnode->config.vgId, pMsg, code); + rpcFreeCont(pMsg->pCont); + taosFreeQitem(pMsg); +} + +static void inline vnodeProposeBatchMsg(SVnode *pVnode, SRpcMsg *pMsgArr, bool *pIsWeakArr, int32_t *arrSize) { + if (*arrSize <= 0) return; + +#if BATCH_DISABLE + int32_t code = syncPropose(pVnode->sync, pMsgArr, pIsWeakArr[0]); +#else + int32_t code = syncProposeBatch(pVnode->sync, pMsgArr, pIsWeakArr, *arrSize); +#endif + + if (code > 0) { + for (int32_t i = 0; i < *arrSize; ++i) { + vnodeHandleWriteMsg(pVnode, pMsgArr + i); + } + } else if (code == 0) { + vnodeWaitBlockMsg(pVnode, pMsgArr + (*arrSize - 1)); + } else { + if (terrno != 0) code = terrno; + for (int32_t i = 0; i < *arrSize; ++i) { + vnodeHandleProposeError(pVnode, pMsgArr + i, code); + } + } + + for (int32_t i = 0; i < *arrSize; ++i) { + SRpcMsg *pMsg = pMsgArr + i; + rpcFreeCont(pMsg->pCont); + } + + *arrSize = 0; +} + void vnodeProposeWriteMsg(SQueueInfo *pInfo, STaosQall *qall, int32_t numOfMsgs) { SVnode *pVnode = pInfo->ahandle; int32_t vgId = pVnode->config.vgId; int32_t code = 0; SRpcMsg *pMsg = NULL; - + int32_t arrayPos = 0; + SRpcMsg *pMsgArr = taosMemoryCalloc(numOfMsgs, sizeof(SRpcMsg)); + bool *pIsWeakArr = taosMemoryCalloc(numOfMsgs, sizeof(bool)); vTrace("vgId:%d, get %d msgs from vnode-write queue", vgId, numOfMsgs); - for (int32_t m = 0; m < numOfMsgs; m++) { + for (int32_t msg = 0; msg < numOfMsgs; msg++) { if (taosGetQitem(qall, (void **)&pMsg) == 0) continue; + bool isWeak = vnodeIsMsgWeak(pMsg->msgType); + bool isBlock = vnodeIsMsgBlock(pMsg->msgType); + const STraceId *trace = &pMsg->info.traceId; - vGTrace("vgId:%d, msg:%p get from vnode-write queue handle:%p", vgId, pMsg, pMsg->info.handle); + vGTrace("vgId:%d, msg:%p get from vnode-write queue, weak:%d block:%d msg:%d:%d pos:%d, handle:%p", vgId, pMsg, + isWeak, isBlock, msg, numOfMsgs, arrayPos, pMsg->info.handle); + + if (pMsgArr == NULL || pIsWeakArr == NULL) { + vGError("vgId:%d, msg:%p failed to process since out of memory", vgId, pMsg); + vnodeHandleProposeError(pVnode, pMsg, TSDB_CODE_OUT_OF_MEMORY); + rpcFreeCont(pMsg->pCont); + taosFreeQitem(pMsg); + continue; + } code = vnodePreProcessWriteMsg(pVnode, pMsg); if (code != 0) { - vError("vgId:%d, msg:%p failed to pre-process since %s", vgId, pMsg, terrstr()); - } else { - if (pMsg->msgType == TDMT_VND_ALTER_REPLICA) { - code = vnodeProcessAlterReplicaReq(pVnode, pMsg); - } else { - code = syncPropose(pVnode->sync, pMsg, vnodeIsMsgWeak(pMsg->msgType)); - if (code > 0) { - SRpcMsg rsp = {.code = pMsg->code, .info = pMsg->info}; - if (vnodeProcessWriteMsg(pVnode, pMsg, pMsg->info.conn.applyIndex, &rsp) < 0) { - rsp.code = terrno; - vError("vgId:%d, msg:%p failed to apply right now since %s", vgId, pMsg, terrstr()); - } - if (rsp.info.handle != NULL) { - tmsgSendRsp(&rsp); - } - } else if (code == 0) { - vnodeWaitBlockMsg(pVnode, pMsg); - } else { - } - } + vGError("vgId:%d, msg:%p failed to pre-process since %s", vgId, pMsg, terrstr()); + rpcFreeCont(pMsg->pCont); + taosFreeQitem(pMsg); + continue; } - if (code < 0) { - if (terrno == TSDB_CODE_SYN_NOT_LEADER) { - vnodeRedirectRpcMsg(pVnode, pMsg); - } else { - if (terrno != 0) code = terrno; - vError("vgId:%d, msg:%p failed to propose since %s, code:0x%x", vgId, pMsg, tstrerror(code), code); - SRpcMsg rsp = {.code = code, .info = pMsg->info}; - if (rsp.info.handle != NULL) { - tmsgSendRsp(&rsp); - } - } + if (pMsg->msgType == TDMT_VND_ALTER_REPLICA) { + vnodeHandleAlterReplicaReq(pVnode, pMsg); + continue; + } + + if (isBlock || BATCH_DISABLE) { + vnodeProposeBatchMsg(pVnode, pMsgArr, pIsWeakArr, &arrayPos); + } + + pMsgArr[arrayPos] = *pMsg; + pIsWeakArr[arrayPos] = isWeak; + arrayPos++; + + if (isBlock || msg == numOfMsgs - 1 || BATCH_DISABLE) { + vnodeProposeBatchMsg(pVnode, pMsgArr, pIsWeakArr, &arrayPos); } vGTrace("vgId:%d, msg:%p is freed, code:0x%x", vgId, pMsg, code); - rpcFreeCont(pMsg->pCont); taosFreeQitem(pMsg); } + + taosMemoryFree(pMsgArr); + taosMemoryFree(pIsWeakArr); } void vnodeApplyWriteMsg(SQueueInfo *pInfo, STaosQall *qall, int32_t numOfMsgs) { From 3bceeef43971a68102ee299a6201de4385527dd6 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Mon, 25 Jul 2022 17:16:26 +0800 Subject: [PATCH 19/54] enh: add batch processing method to vnode --- source/dnode/vnode/src/vnd/vnodeSync.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/source/dnode/vnode/src/vnd/vnodeSync.c b/source/dnode/vnode/src/vnd/vnodeSync.c index b00d6b5eb6..6bc057e5ac 100644 --- a/source/dnode/vnode/src/vnd/vnodeSync.c +++ b/source/dnode/vnode/src/vnd/vnodeSync.c @@ -172,31 +172,34 @@ static void vnodeHandleAlterReplicaReq(SVnode *pVnode, SRpcMsg *pMsg) { taosFreeQitem(pMsg); } -static void inline vnodeProposeBatchMsg(SVnode *pVnode, SRpcMsg *pMsgArr, bool *pIsWeakArr, int32_t *arrSize) { +static void inline vnodeProposeBatchMsg(SVnode *pVnode, SRpcMsg **pMsgArr, bool *pIsWeakArr, int32_t *arrSize) { if (*arrSize <= 0) return; #if BATCH_DISABLE - int32_t code = syncPropose(pVnode->sync, pMsgArr, pIsWeakArr[0]); + int32_t code = syncPropose(pVnode->sync, pMsgArr[0], pIsWeakArr[0]); #else int32_t code = syncProposeBatch(pVnode->sync, pMsgArr, pIsWeakArr, *arrSize); #endif if (code > 0) { for (int32_t i = 0; i < *arrSize; ++i) { - vnodeHandleWriteMsg(pVnode, pMsgArr + i); + vnodeHandleWriteMsg(pVnode, pMsgArr[i]); } } else if (code == 0) { - vnodeWaitBlockMsg(pVnode, pMsgArr + (*arrSize - 1)); + vnodeWaitBlockMsg(pVnode, pMsgArr[*arrSize - 1]); } else { if (terrno != 0) code = terrno; for (int32_t i = 0; i < *arrSize; ++i) { - vnodeHandleProposeError(pVnode, pMsgArr + i, code); + vnodeHandleProposeError(pVnode, pMsgArr[i], code); } } for (int32_t i = 0; i < *arrSize; ++i) { - SRpcMsg *pMsg = pMsgArr + i; + SRpcMsg *pMsg = pMsgArr[i]; + const STraceId *trace = &pMsg->info.traceId; + vGTrace("vgId:%d, msg:%p is freed, code:0x%x", pVnode->config.vgId, pMsg, code); rpcFreeCont(pMsg->pCont); + taosFreeQitem(pMsg); } *arrSize = 0; @@ -208,7 +211,7 @@ void vnodeProposeWriteMsg(SQueueInfo *pInfo, STaosQall *qall, int32_t numOfMsgs) int32_t code = 0; SRpcMsg *pMsg = NULL; int32_t arrayPos = 0; - SRpcMsg *pMsgArr = taosMemoryCalloc(numOfMsgs, sizeof(SRpcMsg)); + SRpcMsg **pMsgArr = taosMemoryCalloc(numOfMsgs, sizeof(SRpcMsg*)); bool *pIsWeakArr = taosMemoryCalloc(numOfMsgs, sizeof(bool)); vTrace("vgId:%d, get %d msgs from vnode-write queue", vgId, numOfMsgs); @@ -246,16 +249,13 @@ void vnodeProposeWriteMsg(SQueueInfo *pInfo, STaosQall *qall, int32_t numOfMsgs) vnodeProposeBatchMsg(pVnode, pMsgArr, pIsWeakArr, &arrayPos); } - pMsgArr[arrayPos] = *pMsg; + pMsgArr[arrayPos] = pMsg; pIsWeakArr[arrayPos] = isWeak; arrayPos++; if (isBlock || msg == numOfMsgs - 1 || BATCH_DISABLE) { vnodeProposeBatchMsg(pVnode, pMsgArr, pIsWeakArr, &arrayPos); } - - vGTrace("vgId:%d, msg:%p is freed, code:0x%x", vgId, pMsg, code); - taosFreeQitem(pMsg); } taosMemoryFree(pMsgArr); From e4c434d18680b7202f21a3ccf13e4ed39c00d460 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Mon, 25 Jul 2022 17:20:48 +0800 Subject: [PATCH 20/54] fix: crash while get cfg item --- source/util/src/tconfig.c | 1 + 1 file changed, 1 insertion(+) diff --git a/source/util/src/tconfig.c b/source/util/src/tconfig.c index 11ae31919a..ab7e30bab2 100644 --- a/source/util/src/tconfig.c +++ b/source/util/src/tconfig.c @@ -335,6 +335,7 @@ int32_t cfgSetItem(SConfig *pCfg, const char *name, const char *value, ECfgSrcTy } SConfigItem *cfgGetItem(SConfig *pCfg, const char *name) { + if (pCfg == NULL) return NULL; int32_t size = taosArrayGetSize(pCfg->array); for (int32_t i = 0; i < size; ++i) { SConfigItem *pItem = taosArrayGet(pCfg->array, i); From 292801c9f9922abbfee78b816b542a0b64effea0 Mon Sep 17 00:00:00 2001 From: Ganlin Zhao Date: Mon, 25 Jul 2022 17:23:56 +0800 Subject: [PATCH 21/54] fix test cases --- tests/system-test/2-query/diff.py | 74 +++++++++++++++++++++- tests/system-test/2-query/function_diff.py | 4 +- 2 files changed, 75 insertions(+), 3 deletions(-) diff --git a/tests/system-test/2-query/diff.py b/tests/system-test/2-query/diff.py index 30b588fa97..c6800d9a8a 100644 --- a/tests/system-test/2-query/diff.py +++ b/tests/system-test/2-query/diff.py @@ -95,7 +95,6 @@ class TDTestCase: tdSql.error("select diff(col12) from stb_1") tdSql.error("select diff(col13) from stb_1") tdSql.error("select diff(col14) from stb_1") - tdSql.error("select ts,diff(col1),ts from stb_1") tdSql.query("select diff(col1) from stb_1") tdSql.checkRows(10) @@ -115,6 +114,79 @@ class TDTestCase: tdSql.query("select diff(col6) from stb_1") tdSql.checkRows(10) + # check selectivity + tdSql.query("select ts, diff(col1), col2 from stb_1") + tdSql.checkRows(10) + tdSql.checkData(0, 0, "2018-09-17 09:00:00.000") + tdSql.checkData(1, 0, "2018-09-17 09:00:00.001") + tdSql.checkData(2, 0, "2018-09-17 09:00:00.002") + tdSql.checkData(3, 0, "2018-09-17 09:00:00.003") + tdSql.checkData(4, 0, "2018-09-17 09:00:00.004") + tdSql.checkData(5, 0, "2018-09-17 09:00:00.005") + tdSql.checkData(6, 0, "2018-09-17 09:00:00.006") + tdSql.checkData(7, 0, "2018-09-17 09:00:00.007") + tdSql.checkData(8, 0, "2018-09-17 09:00:00.008") + tdSql.checkData(9, 0, "2018-09-17 09:00:00.009") + + tdSql.checkData(0, 1, 1) + tdSql.checkData(1, 1, 1) + tdSql.checkData(2, 1, 1) + tdSql.checkData(3, 1, 1) + tdSql.checkData(4, 1, 1) + tdSql.checkData(5, 1, 1) + tdSql.checkData(6, 1, 1) + tdSql.checkData(7, 1, 1) + tdSql.checkData(8, 1, 1) + tdSql.checkData(9, 1, 1) + + tdSql.checkData(0, 2, 0) + tdSql.checkData(1, 2, 1) + tdSql.checkData(2, 2, 2) + tdSql.checkData(3, 2, 3) + tdSql.checkData(4, 2, 4) + tdSql.checkData(5, 2, 5) + tdSql.checkData(6, 2, 6) + tdSql.checkData(7, 2, 7) + tdSql.checkData(8, 2, 8) + tdSql.checkData(9, 2, 9) + + tdSql.query("select ts, diff(col1), col2 from stb order by ts") + tdSql.checkRows(10) + + tdSql.checkData(0, 0, "2018-09-17 09:00:00.000") + tdSql.checkData(1, 0, "2018-09-17 09:00:00.001") + tdSql.checkData(2, 0, "2018-09-17 09:00:00.002") + tdSql.checkData(3, 0, "2018-09-17 09:00:00.003") + tdSql.checkData(4, 0, "2018-09-17 09:00:00.004") + tdSql.checkData(5, 0, "2018-09-17 09:00:00.005") + tdSql.checkData(6, 0, "2018-09-17 09:00:00.006") + tdSql.checkData(7, 0, "2018-09-17 09:00:00.007") + tdSql.checkData(8, 0, "2018-09-17 09:00:00.008") + tdSql.checkData(9, 0, "2018-09-17 09:00:00.009") + + tdSql.checkData(0, 1, 1) + tdSql.checkData(1, 1, 1) + tdSql.checkData(2, 1, 1) + tdSql.checkData(3, 1, 1) + tdSql.checkData(4, 1, 1) + tdSql.checkData(5, 1, 1) + tdSql.checkData(6, 1, 1) + tdSql.checkData(7, 1, 1) + tdSql.checkData(8, 1, 1) + tdSql.checkData(9, 1, 1) + + tdSql.checkData(0, 2, 0) + tdSql.checkData(1, 2, 1) + tdSql.checkData(2, 2, 2) + tdSql.checkData(3, 2, 3) + tdSql.checkData(4, 2, 4) + tdSql.checkData(5, 2, 5) + tdSql.checkData(6, 2, 6) + tdSql.checkData(7, 2, 7) + tdSql.checkData(8, 2, 8) + tdSql.checkData(9, 2, 9) + + tdSql.execute('''create table stb1(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("create table stb1_1 using stb tags('shanghai')") diff --git a/tests/system-test/2-query/function_diff.py b/tests/system-test/2-query/function_diff.py index 5e95510c1d..99e87e6cd6 100644 --- a/tests/system-test/2-query/function_diff.py +++ b/tests/system-test/2-query/function_diff.py @@ -283,14 +283,14 @@ class TDTestCase: tdSql.error(self.diff_query_form(alias=", diff(c1)")) # mix with calculation function 2 # tdSql.error(self.diff_query_form(alias=" + 2")) # mix with arithmetic 1 tdSql.error(self.diff_query_form(alias=" + avg(c1)")) # mix with arithmetic 2 - tdSql.error(self.diff_query_form(alias=", c2")) # mix with other 1 + tdSql.query(self.diff_query_form(alias=", c2")) # mix with other 1 # tdSql.error(self.diff_query_form(table_expr="stb1")) # select stb directly stb_join = { "col": "stb1.c1", "table_expr": "stb1, stb2", "condition": "where stb1.ts=stb2.ts and stb1.st1=stb2.st2 order by stb1.ts" } - tdSql.error(self.diff_query_form(**stb_join)) # stb join + tdSql.query(self.diff_query_form(**stb_join)) # stb join interval_sql = { "condition": "where ts>0 and ts < now interval(1h) fill(next)" } From 49c42ef2894d161f92bdf2a7fc0ab164745d3888 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Mon, 25 Jul 2022 17:39:05 +0800 Subject: [PATCH 22/54] fix: compile error in unitest --- include/common/tglobal.h | 2 ++ include/util/tlog.h | 2 -- source/common/src/tglobal.c | 30 ++++++++++++++++++++++++++++++ source/util/src/tlog.c | 30 ------------------------------ 4 files changed, 32 insertions(+), 32 deletions(-) diff --git a/include/common/tglobal.h b/include/common/tglobal.h index 9633b3e8aa..ac998b807e 100644 --- a/include/common/tglobal.h +++ b/include/common/tglobal.h @@ -153,6 +153,8 @@ void taosAddDataDir(int32_t index, char *v1, int32_t level, int32_t primary); struct SConfig *taosGetCfg(); +void taosSetAllDebugFlag(int32_t flag); +void taosSetDebugFlag(int32_t *pFlagPtr, const char *flagName, int32_t flagVal); int32_t taosSetCfg(SConfig *pCfg, char *name); #ifdef __cplusplus diff --git a/include/util/tlog.h b/include/util/tlog.h index 04ffe21e0b..76d04a5997 100644 --- a/include/util/tlog.h +++ b/include/util/tlog.h @@ -67,8 +67,6 @@ extern int32_t idxDebugFlag; int32_t taosInitLog(const char *logName, int32_t maxFiles); void taosCloseLog(); void taosResetLog(); -void taosSetAllDebugFlag(int32_t flag); -void taosSetDebugFlag(int32_t *pFlagPtr, const char *flagName, int32_t flagVal); void taosDumpData(uint8_t *msg, int32_t len); void taosPrintLog(const char *flags, ELogLevel level, int32_t dflag, const char *format, ...) diff --git a/source/common/src/tglobal.c b/source/common/src/tglobal.c index 5cb5148e30..7a20969a63 100644 --- a/source/common/src/tglobal.c +++ b/source/common/src/tglobal.c @@ -1176,3 +1176,33 @@ void taosCfgDynamicOptions(const char *option, const char *value) { uError("failed to cfg dynamic option:%s value:%s", option, value); } + +void taosSetDebugFlag(int32_t *pFlagPtr, const char *flagName, int32_t flagVal) { + SConfigItem *pItem = cfgGetItem(tsCfg, flagName); + if (pItem != NULL) { + pItem->i32 = flagVal; + } + *pFlagPtr = flagVal; +} + +void taosSetAllDebugFlag(int32_t flag) { + if (flag <= 0) return; + + taosSetDebugFlag(&uDebugFlag, "uDebugFlag", flag); + taosSetDebugFlag(&rpcDebugFlag, "rpcDebugFlag", flag); + taosSetDebugFlag(&jniDebugFlag, "jniDebugFlag", flag); + taosSetDebugFlag(&qDebugFlag, "qDebugFlag", flag); + taosSetDebugFlag(&cDebugFlag, "cDebugFlag", flag); + taosSetDebugFlag(&dDebugFlag, "dDebugFlag", flag); + taosSetDebugFlag(&vDebugFlag, "vDebugFlag", flag); + taosSetDebugFlag(&mDebugFlag, "mDebugFlag", flag); + taosSetDebugFlag(&wDebugFlag, "wDebugFlag", flag); + taosSetDebugFlag(&sDebugFlag, "sDebugFlag", flag); + taosSetDebugFlag(&tsdbDebugFlag, "tsdbDebugFlag", flag); + taosSetDebugFlag(&tqDebugFlag, "tqDebugFlag", flag); + taosSetDebugFlag(&fsDebugFlag, "fsDebugFlag", flag); + taosSetDebugFlag(&udfDebugFlag, "udfDebugFlag", flag); + taosSetDebugFlag(&smaDebugFlag, "smaDebugFlag", flag); + taosSetDebugFlag(&idxDebugFlag, "idxDebugFlag", flag); + uInfo("all debug flag are set to %d", flag); +} diff --git a/source/util/src/tlog.c b/source/util/src/tlog.c index 678a12fcf1..a71a75eac5 100644 --- a/source/util/src/tlog.c +++ b/source/util/src/tlog.c @@ -743,33 +743,3 @@ cmp_end: return ret; } - -void taosSetDebugFlag(int32_t *pFlagPtr, const char *flagName, int32_t flagVal) { - SConfigItem *pItem = cfgGetItem(tsCfg, flagName); - if (pItem != NULL) { - pItem->i32 = flagVal; - } - *pFlagPtr = flagVal; -} - -void taosSetAllDebugFlag(int32_t flag) { - if (flag <= 0) return; - - taosSetDebugFlag(&uDebugFlag, "uDebugFlag", flag); - taosSetDebugFlag(&rpcDebugFlag, "rpcDebugFlag", flag); - taosSetDebugFlag(&jniDebugFlag, "jniDebugFlag", flag); - taosSetDebugFlag(&qDebugFlag, "qDebugFlag", flag); - taosSetDebugFlag(&cDebugFlag, "cDebugFlag", flag); - taosSetDebugFlag(&dDebugFlag, "dDebugFlag", flag); - taosSetDebugFlag(&vDebugFlag, "vDebugFlag", flag); - taosSetDebugFlag(&mDebugFlag, "mDebugFlag", flag); - taosSetDebugFlag(&wDebugFlag, "wDebugFlag", flag); - taosSetDebugFlag(&sDebugFlag, "sDebugFlag", flag); - taosSetDebugFlag(&tsdbDebugFlag, "tsdbDebugFlag", flag); - taosSetDebugFlag(&tqDebugFlag, "tqDebugFlag", flag); - taosSetDebugFlag(&fsDebugFlag, "fsDebugFlag", flag); - taosSetDebugFlag(&udfDebugFlag, "udfDebugFlag", flag); - taosSetDebugFlag(&smaDebugFlag, "smaDebugFlag", flag); - taosSetDebugFlag(&idxDebugFlag, "idxDebugFlag", flag); - uInfo("all debug flag are set to %d", flag); -} From cedad48a730884037c3068e624674f73a33826b7 Mon Sep 17 00:00:00 2001 From: Minghao Li Date: Mon, 25 Jul 2022 17:47:15 +0800 Subject: [PATCH 23/54] refactor(sync): add ref in log entry --- source/libs/sync/inc/syncRaftEntry.h | 2 ++ source/libs/sync/src/syncIO.c | 4 +-- source/libs/sync/src/syncIndexMgr.c | 2 +- source/libs/sync/src/syncRaftCfg.c | 8 ++--- source/libs/sync/src/syncRaftEntry.c | 20 ++++++++++++- source/libs/sync/src/syncRaftStore.c | 2 +- source/libs/sync/src/syncRespMgr.c | 2 +- source/libs/sync/src/syncSnapshot.c | 10 +++---- .../test/syncConfigChangeSnapshotTest.cpp | 2 +- source/libs/sync/test/syncEntryCacheTest.cpp | 30 +++++++++---------- .../sync/test/syncSnapshotReceiverTest.cpp | 2 +- source/libs/sync/test/syncTestTool.cpp | 2 +- 12 files changed, 52 insertions(+), 34 deletions(-) diff --git a/source/libs/sync/inc/syncRaftEntry.h b/source/libs/sync/inc/syncRaftEntry.h index 607ff4ba24..bab1dcc661 100644 --- a/source/libs/sync/inc/syncRaftEntry.h +++ b/source/libs/sync/inc/syncRaftEntry.h @@ -26,6 +26,7 @@ extern "C" { #include "syncInt.h" #include "syncMessage.h" #include "taosdef.h" +#include "tref.h" #include "tskiplist.h" typedef struct SSyncRaftEntry { @@ -89,6 +90,7 @@ typedef struct SRaftEntryCache { SSkipList* pSkipList; int32_t maxCount; int32_t currentCount; + int32_t refMgr; TdThreadMutex mutex; SSyncNode* pSyncNode; } SRaftEntryCache; diff --git a/source/libs/sync/src/syncIO.c b/source/libs/sync/src/syncIO.c index d9f11ba80f..b00be6edb6 100644 --- a/source/libs/sync/src/syncIO.c +++ b/source/libs/sync/src/syncIO.c @@ -242,9 +242,9 @@ static int32_t syncIOStopInternal(SSyncIO *io) { } static void *syncIOConsumerFunc(void *param) { - SSyncIO *io = param; + SSyncIO * io = param; STaosQall *qall = taosAllocateQall(); - SRpcMsg *pRpcMsg, rpcMsg; + SRpcMsg * pRpcMsg, rpcMsg; SQueueInfo qinfo = {0}; while (1) { diff --git a/source/libs/sync/src/syncIndexMgr.c b/source/libs/sync/src/syncIndexMgr.c index 39bede23f6..8634676f86 100644 --- a/source/libs/sync/src/syncIndexMgr.c +++ b/source/libs/sync/src/syncIndexMgr.c @@ -125,7 +125,7 @@ cJSON *syncIndexMgr2Json(SSyncIndexMgr *pSyncIndexMgr) { char *syncIndexMgr2Str(SSyncIndexMgr *pSyncIndexMgr) { cJSON *pJson = syncIndexMgr2Json(pSyncIndexMgr); - char *serialized = cJSON_Print(pJson); + char * serialized = cJSON_Print(pJson); cJSON_Delete(pJson); return serialized; } diff --git a/source/libs/sync/src/syncRaftCfg.c b/source/libs/sync/src/syncRaftCfg.c index c634a1bf49..56666b35b6 100644 --- a/source/libs/sync/src/syncRaftCfg.c +++ b/source/libs/sync/src/syncRaftCfg.c @@ -101,7 +101,7 @@ cJSON *syncCfg2Json(SSyncCfg *pSyncCfg) { char *syncCfg2Str(SSyncCfg *pSyncCfg) { cJSON *pJson = syncCfg2Json(pSyncCfg); - char *serialized = cJSON_Print(pJson); + char * serialized = cJSON_Print(pJson); cJSON_Delete(pJson); return serialized; } @@ -109,7 +109,7 @@ char *syncCfg2Str(SSyncCfg *pSyncCfg) { char *syncCfg2SimpleStr(SSyncCfg *pSyncCfg) { if (pSyncCfg != NULL) { int32_t len = 512; - char *s = taosMemoryMalloc(len); + char * s = taosMemoryMalloc(len); memset(s, 0, len); snprintf(s, len, "{r-num:%d, my:%d, ", pSyncCfg->replicaNum, pSyncCfg->myIndex); @@ -206,7 +206,7 @@ cJSON *raftCfg2Json(SRaftCfg *pRaftCfg) { char *raftCfg2Str(SRaftCfg *pRaftCfg) { cJSON *pJson = raftCfg2Json(pRaftCfg); - char *serialized = cJSON_Print(pJson); + char * serialized = cJSON_Print(pJson); cJSON_Delete(pJson); return serialized; } @@ -285,7 +285,7 @@ int32_t raftCfgFromJson(const cJSON *pRoot, SRaftCfg *pRaftCfg) { (pRaftCfg->configIndexArr)[i] = atoll(pIndex->valuestring); } - cJSON *pJsonSyncCfg = cJSON_GetObjectItem(pJson, "SSyncCfg"); + cJSON * pJsonSyncCfg = cJSON_GetObjectItem(pJson, "SSyncCfg"); int32_t code = syncCfgFromJson(pJsonSyncCfg, &(pRaftCfg->cfg)); ASSERT(code == 0); diff --git a/source/libs/sync/src/syncRaftEntry.c b/source/libs/sync/src/syncRaftEntry.c index 64cff4d93d..4687fc41c4 100644 --- a/source/libs/sync/src/syncRaftEntry.c +++ b/source/libs/sync/src/syncRaftEntry.c @@ -23,6 +23,7 @@ SSyncRaftEntry* syncEntryBuild(uint32_t dataLen) { memset(pEntry, 0, bytes); pEntry->bytes = bytes; pEntry->dataLen = dataLen; + pEntry->rid = -1; return pEntry; } @@ -451,6 +452,11 @@ static char* keyFn(const void* pData) { static int cmpFn(const void* p1, const void* p2) { return memcmp(p1, p2, sizeof(SyncIndex)); } +static void freeRaftEntry(void* param) { + SSyncRaftEntry* pEntry = (SSyncRaftEntry*)param; + syncEntryDestory(pEntry); +} + SRaftEntryCache* raftEntryCacheCreate(SSyncNode* pSyncNode, int32_t maxCount) { SRaftEntryCache* pCache = taosMemoryMalloc(sizeof(SRaftEntryCache)); if (pCache == NULL) { @@ -466,6 +472,7 @@ SRaftEntryCache* raftEntryCacheCreate(SSyncNode* pSyncNode, int32_t maxCount) { } taosThreadMutexInit(&(pCache->mutex), NULL); + pCache->refMgr = taosOpenRef(10, freeRaftEntry); pCache->maxCount = maxCount; pCache->currentCount = 0; pCache->pSyncNode = pSyncNode; @@ -477,6 +484,10 @@ void raftEntryCacheDestroy(SRaftEntryCache* pCache) { if (pCache != NULL) { taosThreadMutexLock(&(pCache->mutex)); tSkipListDestroy(pCache->pSkipList); + if (pCache->refMgr != -1) { + taosCloseRef(pCache->refMgr); + pCache->refMgr = -1; + } taosThreadMutexUnlock(&(pCache->mutex)); taosThreadMutexDestroy(&(pCache->mutex)); taosMemoryFree(pCache); @@ -498,6 +509,9 @@ int32_t raftEntryCachePutEntry(struct SRaftEntryCache* pCache, SSyncRaftEntry* p ASSERT(pSkipListNode != NULL); ++(pCache->currentCount); + pEntry->rid = taosAddRef(pCache->refMgr, pEntry); + ASSERT(pEntry->rid >= 0); + do { char eventLog[128]; snprintf(eventLog, sizeof(eventLog), "raft cache add, type:%s,%d, type2:%s,%d, index:%" PRId64 ", bytes:%d", @@ -520,6 +534,7 @@ int32_t raftEntryCacheGetEntry(struct SRaftEntryCache* pCache, SyncIndex index, if (code == 1) { *ppEntry = taosMemoryMalloc(pEntry->bytes); memcpy(*ppEntry, pEntry, pEntry->bytes); + (*ppEntry)->rid = -1; } else { *ppEntry = NULL; } @@ -541,6 +556,7 @@ int32_t raftEntryCacheGetEntryP(struct SRaftEntryCache* pCache, SyncIndex index, SSkipListNode** ppNode = (SSkipListNode**)taosArrayGet(entryPArray, 0); ASSERT(*ppNode != NULL); *ppEntry = (SSyncRaftEntry*)SL_GET_NODE_DATA(*ppNode); + taosAcquireRef(pCache->refMgr, (*ppEntry)->rid); code = 1; } else if (arraySize == 0) { @@ -600,7 +616,9 @@ int32_t raftEntryCacheClear(struct SRaftEntryCache* pCache, int32_t count) { taosArrayPush(delNodeArray, &pNode); ++returnCnt; SSyncRaftEntry* pEntry = (SSyncRaftEntry*)SL_GET_NODE_DATA(pNode); - syncEntryDestory(pEntry); + + // syncEntryDestory(pEntry); + taosRemoveRef(pCache->refMgr, pEntry->rid); } tSkipListDestroyIter(pIter); diff --git a/source/libs/sync/src/syncRaftStore.c b/source/libs/sync/src/syncRaftStore.c index fbfeb031f6..9085873036 100644 --- a/source/libs/sync/src/syncRaftStore.c +++ b/source/libs/sync/src/syncRaftStore.c @@ -216,7 +216,7 @@ cJSON *raftStore2Json(SRaftStore *pRaftStore) { char *raftStore2Str(SRaftStore *pRaftStore) { cJSON *pJson = raftStore2Json(pRaftStore); - char *serialized = cJSON_Print(pJson); + char * serialized = cJSON_Print(pJson); cJSON_Delete(pJson); return serialized; } diff --git a/source/libs/sync/src/syncRespMgr.c b/source/libs/sync/src/syncRespMgr.c index 3c63b7692a..501f1fb435 100644 --- a/source/libs/sync/src/syncRespMgr.c +++ b/source/libs/sync/src/syncRespMgr.c @@ -129,7 +129,7 @@ void syncRespCleanByTTL(SSyncRespMgr *pObj, int64_t ttl) { while (pStub) { size_t len; - void *key = taosHashGetKey(pStub, &len); + void * key = taosHashGetKey(pStub, &len); uint64_t *pSeqNum = (uint64_t *)key; sum++; diff --git a/source/libs/sync/src/syncSnapshot.c b/source/libs/sync/src/syncSnapshot.c index 279a70cb19..702e9f01dc 100644 --- a/source/libs/sync/src/syncSnapshot.c +++ b/source/libs/sync/src/syncSnapshot.c @@ -374,14 +374,14 @@ cJSON *snapshotSender2Json(SSyncSnapshotSender *pSender) { char *snapshotSender2Str(SSyncSnapshotSender *pSender) { cJSON *pJson = snapshotSender2Json(pSender); - char *serialized = cJSON_Print(pJson); + char * serialized = cJSON_Print(pJson); cJSON_Delete(pJson); return serialized; } char *snapshotSender2SimpleStr(SSyncSnapshotSender *pSender, char *event) { int32_t len = 256; - char *s = taosMemoryMalloc(len); + char * s = taosMemoryMalloc(len); SRaftId destId = pSender->pSyncNode->replicasId[pSender->replicaIndex]; char host[64]; @@ -653,7 +653,7 @@ cJSON *snapshotReceiver2Json(SSyncSnapshotReceiver *pReceiver) { cJSON_AddStringToObject(pFromId, "addr", u64buf); { uint64_t u64 = pReceiver->fromId.addr; - cJSON *pTmp = pFromId; + cJSON * pTmp = pFromId; char host[128] = {0}; uint16_t port; syncUtilU642Addr(u64, host, sizeof(host), &port); @@ -686,14 +686,14 @@ cJSON *snapshotReceiver2Json(SSyncSnapshotReceiver *pReceiver) { char *snapshotReceiver2Str(SSyncSnapshotReceiver *pReceiver) { cJSON *pJson = snapshotReceiver2Json(pReceiver); - char *serialized = cJSON_Print(pJson); + char * serialized = cJSON_Print(pJson); cJSON_Delete(pJson); return serialized; } char *snapshotReceiver2SimpleStr(SSyncSnapshotReceiver *pReceiver, char *event) { int32_t len = 256; - char *s = taosMemoryMalloc(len); + char * s = taosMemoryMalloc(len); SRaftId fromId = pReceiver->fromId; char host[128]; diff --git a/source/libs/sync/test/syncConfigChangeSnapshotTest.cpp b/source/libs/sync/test/syncConfigChangeSnapshotTest.cpp index 8c6c68bbf8..714d233984 100644 --- a/source/libs/sync/test/syncConfigChangeSnapshotTest.cpp +++ b/source/libs/sync/test/syncConfigChangeSnapshotTest.cpp @@ -125,7 +125,7 @@ int32_t SnapshotStartWrite(struct SSyncFSM* pFsm, void* pParam, void** ppWriter) return 0; } -int32_t SnapshotStopWrite(struct SSyncFSM* pFsm, void* pWriter, bool isApply, SSnapshot *pSnapshot) { +int32_t SnapshotStopWrite(struct SSyncFSM* pFsm, void* pWriter, bool isApply, SSnapshot* pSnapshot) { char logBuf[256] = {0}; snprintf(logBuf, sizeof(logBuf), "==callback== ==SnapshotStopWrite== pFsm:%p, pWriter:%p, isApply:%d", pFsm, pWriter, isApply); diff --git a/source/libs/sync/test/syncEntryCacheTest.cpp b/source/libs/sync/test/syncEntryCacheTest.cpp index ed6f48fafe..fd0c41cce9 100644 --- a/source/libs/sync/test/syncEntryCacheTest.cpp +++ b/source/libs/sync/test/syncEntryCacheTest.cpp @@ -5,8 +5,8 @@ #include "syncRaftLog.h" #include "syncRaftStore.h" #include "syncUtil.h" -#include "tskiplist.h" #include "tref.h" +#include "tskiplist.h" void logTest() { sTrace("--- sync log test: trace"); @@ -51,7 +51,7 @@ SRaftEntryCache* createCache(int maxCount) { } void test1() { - int32_t code = 0; + int32_t code = 0; SRaftEntryCache* pCache = createCache(5); for (int i = 0; i < 10; ++i) { SSyncRaftEntry* pEntry = createEntry(i); @@ -68,7 +68,7 @@ void test1() { } void test2() { - int32_t code = 0; + int32_t code = 0; SRaftEntryCache* pCache = createCache(5); for (int i = 0; i < 10; ++i) { SSyncRaftEntry* pEntry = createEntry(i); @@ -77,7 +77,7 @@ void test2() { } raftEntryCacheLog2((char*)"==test1 write 5 entries==", pCache); - SyncIndex index = 2; + SyncIndex index = 2; SSyncRaftEntry* pEntry = NULL; code = raftEntryCacheGetEntryP(pCache, index, &pEntry); @@ -107,7 +107,7 @@ void test2() { } void test3() { - int32_t code = 0; + int32_t code = 0; SRaftEntryCache* pCache = createCache(20); for (int i = 0; i <= 4; ++i) { SSyncRaftEntry* pEntry = createEntry(i); @@ -122,8 +122,6 @@ void test3() { raftEntryCacheLog2((char*)"==test3 write 10 entries==", pCache); } - - static void freeObj(void* param) { SSyncRaftEntry* pEntry = (SSyncRaftEntry*)param; syncEntryLog2((char*)"freeObj: ", pEntry); @@ -138,7 +136,7 @@ void test4() { int64_t rid = taosAddRef(testRefId, pEntry); sTrace("rid: %ld", rid); - + do { SSyncRaftEntry* pAcquireEntry = (SSyncRaftEntry*)taosAcquireRef(testRefId, rid); syncEntryLog2((char*)"acquire: ", pAcquireEntry); @@ -147,8 +145,8 @@ void test4() { taosAcquireRef(testRefId, rid); taosAcquireRef(testRefId, rid); - //taosReleaseRef(testRefId, rid); - //taosReleaseRef(testRefId, rid); + // taosReleaseRef(testRefId, rid); + // taosReleaseRef(testRefId, rid); } while (0); taosRemoveRef(testRefId, rid); @@ -180,13 +178,13 @@ int main(int argc, char** argv) { tsAsyncLog = 0; sDebugFlag = DEBUG_TRACE + DEBUG_SCREEN + DEBUG_FILE + DEBUG_DEBUG; -/* - test1(); - test2(); - test3(); -*/ + /* + test1(); + test2(); + test3(); + */ test4(); - //test5(); + // test5(); return 0; } diff --git a/source/libs/sync/test/syncSnapshotReceiverTest.cpp b/source/libs/sync/test/syncSnapshotReceiverTest.cpp index b744843b1e..0f8e76f121 100644 --- a/source/libs/sync/test/syncSnapshotReceiverTest.cpp +++ b/source/libs/sync/test/syncSnapshotReceiverTest.cpp @@ -30,7 +30,7 @@ int32_t SnapshotStopRead(struct SSyncFSM* pFsm, void* pReader) { return 0; } int32_t SnapshotDoRead(struct SSyncFSM* pFsm, void* pReader, void** ppBuf, int32_t* len) { return 0; } int32_t SnapshotStartWrite(struct SSyncFSM* pFsm, void* pParam, void** ppWriter) { return 0; } -int32_t SnapshotStopWrite(struct SSyncFSM* pFsm, void* pWriter, bool isApply, SSnapshot *pSnapshot) { return 0; } +int32_t SnapshotStopWrite(struct SSyncFSM* pFsm, void* pWriter, bool isApply, SSnapshot* pSnapshot) { return 0; } int32_t SnapshotDoWrite(struct SSyncFSM* pFsm, void* pWriter, void* pBuf, int32_t len) { return 0; } SSyncSnapshotReceiver* createReceiver() { diff --git a/source/libs/sync/test/syncTestTool.cpp b/source/libs/sync/test/syncTestTool.cpp index b0a561cb89..9e9769224f 100644 --- a/source/libs/sync/test/syncTestTool.cpp +++ b/source/libs/sync/test/syncTestTool.cpp @@ -126,7 +126,7 @@ int32_t SnapshotStartWrite(struct SSyncFSM* pFsm, void* pParam, void** ppWriter) return 0; } -int32_t SnapshotStopWrite(struct SSyncFSM* pFsm, void* pWriter, bool isApply, SSnapshot *pSnapshot) { +int32_t SnapshotStopWrite(struct SSyncFSM* pFsm, void* pWriter, bool isApply, SSnapshot* pSnapshot) { if (isApply) { gSnapshotLastApplyIndex = gFinishLastApplyIndex; gSnapshotLastApplyTerm = gFinishLastApplyTerm; From 3614db50c61b878aa983768bccde409fc65ccc83 Mon Sep 17 00:00:00 2001 From: plum-lihui Date: Mon, 25 Jul 2022 17:50:36 +0800 Subject: [PATCH 24/54] test: add test case for fix --- tests/system-test/7-tmq/TD-17803.py | 198 ++++++++++++++++++++++++++++ 1 file changed, 198 insertions(+) create mode 100644 tests/system-test/7-tmq/TD-17803.py diff --git a/tests/system-test/7-tmq/TD-17803.py b/tests/system-test/7-tmq/TD-17803.py new file mode 100644 index 0000000000..771ff83a29 --- /dev/null +++ b/tests/system-test/7-tmq/TD-17803.py @@ -0,0 +1,198 @@ +from distutils.log import error +import taos +import sys +import time +import socket +import os +import threading +import subprocess +import platform + +from util.log import * +from util.sql import * +from util.cases import * +from util.dnodes import * +from util.common import * +sys.path.append("./7-tmq") +from tmqCommon import * + + + +class TDTestCase: + def __init__(self): + self.snapshot = 0 + self.replica = 3 + self.vgroups = 3 + self.ctbNum = 2 + self.rowsPerTbl = 2 + + def init(self, conn, logSql): + tdLog.debug(f"start to excute {__file__}") + tdSql.init(conn.cursor()) + #tdSql.init(conn.cursor(), logSql) # output sql.txt file + + def checkFileContent(self, consumerId, queryString): + buildPath = tdCom.getBuildPath() + cfgPath = tdCom.getClientCfgPath() + dstFile = '%s/../log/dstrows_%d.txt'%(cfgPath, consumerId) + cmdStr = '%s/build/bin/taos -c %s -s "%s >> %s"'%(buildPath, cfgPath, queryString, dstFile) + tdLog.info(cmdStr) + os.system(cmdStr) + + consumeRowsFile = '%s/../log/consumerid_%d.txt'%(cfgPath, consumerId) + tdLog.info("rows file: %s, %s"%(consumeRowsFile, dstFile)) + + consumeFile = open(consumeRowsFile, mode='r') + queryFile = open(dstFile, mode='r') + + # skip first line for it is schema + queryFile.readline() + + while True: + dst = queryFile.readline() + src = consumeFile.readline() + + if dst: + if dst != src: + tdLog.exit("consumerId %d consume rows is not match the rows by direct query"%consumerId) + else: + break + return + + def prepareTestEnv(self): + tdLog.printNoPrefix("======== prepare test env include database, stable, ctables, and insert data: ") + paraDict = {'dbName': 'dbt', + 'dropFlag': 1, + 'event': '', + 'vgroups': 4, + 'stbName': 'stb', + 'colPrefix': 'c', + 'tagPrefix': 't', + 'colSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1}], + 'tagSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1}], + 'ctbPrefix': 'ctb', + 'ctbStartIdx': 0, + 'ctbNum': 2, + 'rowsPerTbl': 1000, + 'batchNum': 10, + 'startTs': 1640966400000, # 2022-01-01 00:00:00.000 + 'pollDelay': 3, + 'showMsg': 1, + 'showRow': 1, + 'snapshot': 0} + + paraDict['vgroups'] = self.vgroups + paraDict['ctbNum'] = self.ctbNum + paraDict['rowsPerTbl'] = self.rowsPerTbl + + tmqCom.initConsumerTable() + tdCom.create_database(tdSql, paraDict["dbName"],paraDict["dropFlag"], vgroups=paraDict["vgroups"],replica=self.replica) + tdLog.info("create stb") + tmqCom.create_stable(tdSql, dbName=paraDict["dbName"],stbName=paraDict["stbName"]) + tdLog.info("create ctb") + tmqCom.create_ctable(tdSql, dbName=paraDict["dbName"],stbName=paraDict["stbName"],ctbPrefix=paraDict['ctbPrefix'], + ctbNum=paraDict["ctbNum"],ctbStartIdx=paraDict['ctbStartIdx']) + tdLog.info("insert data") + tmqCom.insert_data_interlaceByMultiTbl(tsql=tdSql,dbName=paraDict["dbName"],ctbPrefix=paraDict["ctbPrefix"], + ctbNum=paraDict["ctbNum"],rowsPerTbl=paraDict["rowsPerTbl"],batchNum=paraDict["batchNum"], + startTs=paraDict["startTs"],ctbStartIdx=paraDict['ctbStartIdx']) + # tmqCom.insert_data_with_autoCreateTbl(tsql=tdSql,dbName=paraDict["dbName"],stbName=paraDict["stbName"],ctbPrefix="ctbx", + # ctbNum=paraDict["ctbNum"],rowsPerTbl=paraDict["rowsPerTbl"],batchNum=paraDict["batchNum"], + # startTs=paraDict["startTs"],ctbStartIdx=paraDict['ctbStartIdx']) + # tmqCom.asyncInsertDataByInterlace(paraDict) + tdLog.printNoPrefix("11111111111111111111111") + tmqCom.create_ntable(tdSql, dbname=paraDict["dbName"], tbname_prefix="ntb", tbname_index_start_num = 1, column_elm_list=paraDict["colSchema"], colPrefix='c', tblNum=1) + tdLog.printNoPrefix("222222222222222") + tmqCom.insert_rows_into_ntbl(tdSql, dbname=paraDict["dbName"], tbname_prefix="ntb", tbname_index_start_num = 1, column_ele_list=paraDict["colSchema"], startTs=paraDict["startTs"], tblNum=1, rows=2) # tdLog.info("restart taosd to ensure that the data falls into the disk") + + tdLog.printNoPrefix("333333333333333333333") + tdSql.query("drop database %s"%paraDict["dbName"]) + tdLog.printNoPrefix("44444444444444444") + return + + def tmqCase1(self): + tdLog.printNoPrefix("======== test case 1: ") + + # create and start thread + paraDict = {'dbName': 'dbt', + 'dropFlag': 1, + 'event': '', + 'vgroups': 4, + 'stbName': 'stb', + 'colPrefix': 'c', + 'tagPrefix': 't', + 'colSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1},{'type': 'TIMESTAMP', 'count':1}], + 'tagSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1}], + 'ctbPrefix': 'ctb', + 'ctbStartIdx': 0, + 'ctbNum': 100, + 'rowsPerTbl': 1000, + 'batchNum': 100, + 'startTs': 1640966400000, # 2022-01-01 00:00:00.000 + 'pollDelay': 3, + 'showMsg': 1, + 'showRow': 1, + 'snapshot': 1} + + paraDict['vgroups'] = self.vgroups + paraDict['ctbNum'] = self.ctbNum + paraDict['rowsPerTbl'] = self.rowsPerTbl + + tdLog.info("create topics from stb1") + topicFromStb1 = 'topic_stb1' + queryString = "select ts, c1, c2 from %s.%s where t4 == 'beijing' or t4 == 'changsha' "%(paraDict['dbName'], paraDict['stbName']) + sqlString = "create topic %s as %s" %(topicFromStb1, queryString) + tdLog.info("create topic sql: %s"%sqlString) + tdSql.execute(sqlString) + + consumerId = 0 + expectrowcnt = paraDict["rowsPerTbl"] * paraDict["ctbNum"] + topicList = topicFromStb1 + ifcheckdata = 0 + ifManualCommit = 0 + keyList = 'group.id:cgrp1,\ + enable.auto.commit:false,\ + auto.commit.interval.ms:6000,\ + auto.offset.reset:earliest' + tmqCom.insertConsumerInfo(consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifManualCommit) + + tdLog.info("start consume processor") + pollDelay = 100 + showMsg = 1 + showRow = 1 + tmqCom.startTmqSimProcess(pollDelay=paraDict['pollDelay'],dbName=paraDict["dbName"],showMsg=paraDict['showMsg'], showRow=paraDict['showRow'],snapshot=paraDict['snapshot']) + + tdLog.info("start to check consume result") + expectRows = 1 + resultList = tmqCom.selectConsumeResult(expectRows) + totalConsumeRows = 0 + for i in range(expectRows): + totalConsumeRows += resultList[i] + + tdSql.query(queryString) + totalRowsInserted = tdSql.getRows() + + tdLog.info("act consume rows: %d, act insert rows: %d, expect consume rows: %d, "%(totalConsumeRows, totalRowsInserted, expectrowcnt)) + + if totalConsumeRows != expectrowcnt: + tdLog.exit("tmq consume rows error!") + + # tmqCom.checkFileContent(consumerId, queryString) + + tmqCom.waitSubscriptionExit(tdSql, topicFromStb1) + tdSql.query("drop topic %s"%topicFromStb1) + + tdLog.printNoPrefix("======== test case 1 end ...... ") + + def run(self): + self.prepareTestEnv() + # self.tmqCase1() + + def stop(self): + tdSql.close() + tdLog.success(f"{__file__} successfully executed") + +event = threading.Event() + +tdCases.addLinux(__file__, TDTestCase()) +tdCases.addWindows(__file__, TDTestCase()) From 4532b23c2b379d965f076319dc4854c8e14a735a Mon Sep 17 00:00:00 2001 From: "wenzhouwww@live.cn" Date: Mon, 25 Jul 2022 18:06:46 +0800 Subject: [PATCH 25/54] test: add cluster case about vnode --- .../4dnode1mnode_basic_createDb_replica1.py | 6 +- ...4dnode1mnode_basic_replica1_insertdatas.py | 10 +- ...4dnode1mnode_basic_replica3_insertdatas.py | 10 +- ...replica3_insertdatas_stop_follower_sync.py | 56 +-- ...plica3_insertdatas_stop_follower_unsync.py | 56 +-- ...rtdatas_stop_follower_unsync_force_stop.py | 58 +-- ..._basic_replica3_insertdatas_stop_leader.py | 344 +++---------- ...ca3_insertdatas_stop_leader_forece_stop.py | 64 +-- ...basic_replica3_querydatas_stop_follower.py | 416 ++++++++++++++++ ...ca3_querydatas_stop_follower_force_stop.py | 416 ++++++++++++++++ ...e_basic_replica3_querydatas_stop_leader.py | 470 ++++++++++++++++++ ...lica3_querydatas_stop_leader_force_stop.py | 470 ++++++++++++++++++ .../4dnode1mnode_basic_replica3_vgroups.py | 20 +- ...de1mnode_basic_replica3_vgroups_stopOne.py | 38 +- .../6-cluster/vnode/insert_100W_rows.json | 118 +++++ .../6-cluster/vnode/insert_10W_rows.json | 118 +++++ 16 files changed, 2241 insertions(+), 429 deletions(-) create mode 100644 tests/system-test/6-cluster/vnode/4dnode1mnode_basic_replica3_querydatas_stop_follower.py create mode 100644 tests/system-test/6-cluster/vnode/4dnode1mnode_basic_replica3_querydatas_stop_follower_force_stop.py create mode 100644 tests/system-test/6-cluster/vnode/4dnode1mnode_basic_replica3_querydatas_stop_leader.py create mode 100644 tests/system-test/6-cluster/vnode/4dnode1mnode_basic_replica3_querydatas_stop_leader_force_stop.py create mode 100644 tests/system-test/6-cluster/vnode/insert_100W_rows.json create mode 100644 tests/system-test/6-cluster/vnode/insert_10W_rows.json diff --git a/tests/system-test/6-cluster/vnode/4dnode1mnode_basic_createDb_replica1.py b/tests/system-test/6-cluster/vnode/4dnode1mnode_basic_createDb_replica1.py index e6192ba313..14494f1171 100644 --- a/tests/system-test/6-cluster/vnode/4dnode1mnode_basic_createDb_replica1.py +++ b/tests/system-test/6-cluster/vnode/4dnode1mnode_basic_createDb_replica1.py @@ -65,14 +65,14 @@ class TDTestCase: is_leader=True if count==1 and is_leader: - tdLog.info("===== depoly cluster success with 1 mnode as leader =====") + tdLog.notice("===== depoly cluster success with 1 mnode as leader =====") else: tdLog.exit("===== depoly cluster fail with 1 mnode as leader =====") for k ,v in self.dnode_list.items(): if k == mnode_name: if v[3]==0: - tdLog.info("===== depoly cluster mnode only success at {} , support_vnodes is {} ".format(mnode_name,v[3])) + tdLog.notice("===== depoly cluster mnode only success at {} , support_vnodes is {} ".format(mnode_name,v[3])) else: tdLog.exit("===== depoly cluster mnode only fail at {} , support_vnodes is {} ".format(mnode_name,v[3])) else: @@ -115,7 +115,7 @@ class TDTestCase: for k , v in vgroups_infos.items(): if len(v) ==1 and v[0]=="leader": - tdLog.info(" === create database replica only 1 role leader check success of vgroup_id {} ======".format(k)) + tdLog.notice(" === create database replica only 1 role leader check success of vgroup_id {} ======".format(k)) else: tdLog.exit(" === create database replica only 1 role leader check fail of vgroup_id {} ======".format(k)) diff --git a/tests/system-test/6-cluster/vnode/4dnode1mnode_basic_replica1_insertdatas.py b/tests/system-test/6-cluster/vnode/4dnode1mnode_basic_replica1_insertdatas.py index d5fef08945..9a21dab855 100644 --- a/tests/system-test/6-cluster/vnode/4dnode1mnode_basic_replica1_insertdatas.py +++ b/tests/system-test/6-cluster/vnode/4dnode1mnode_basic_replica1_insertdatas.py @@ -71,14 +71,14 @@ class TDTestCase: is_leader=True if count==1 and is_leader: - tdLog.info("===== depoly cluster success with 1 mnode as leader =====") + tdLog.notice("===== depoly cluster success with 1 mnode as leader =====") else: tdLog.exit("===== depoly cluster fail with 1 mnode as leader =====") for k ,v in self.dnode_list.items(): if k == mnode_name: if v[3]==0: - tdLog.info("===== depoly cluster mnode only success at {} , support_vnodes is {} ".format(mnode_name,v[3])) + tdLog.notice("===== depoly cluster mnode only success at {} , support_vnodes is {} ".format(mnode_name,v[3])) else: tdLog.exit("===== depoly cluster mnode only fail at {} , support_vnodes is {} ".format(mnode_name,v[3])) else: @@ -121,7 +121,7 @@ class TDTestCase: for k , v in vgroups_infos.items(): if len(v) ==1 and v[0]=="leader": - tdLog.info(" === create database replica only 1 role leader check success of vgroup_id {} ======".format(k)) + tdLog.notice(" === create database replica only 1 role leader check success of vgroup_id {} ======".format(k)) else: tdLog.exit(" === create database replica only 1 role leader check fail of vgroup_id {} ======".format(k)) @@ -129,7 +129,7 @@ class TDTestCase: drop_db_sql = "drop database if exists {}".format(dbname) create_db_sql = "create database {} replica {} vgroups {}".format(dbname,replica_num,vgroup_nums) - tdLog.info(" ==== create database {} and insert rows begin =====".format(dbname)) + tdLog.notice(" ==== create database {} and insert rows begin =====".format(dbname)) tdSql.execute(drop_db_sql) tdSql.execute(create_db_sql) tdSql.execute("use {}".format(dbname)) @@ -155,7 +155,7 @@ class TDTestCase: ts = self.ts + 1000*row_num tdSql.execute(f"insert into {sub_tbname} values ({ts}, {row_num} ,{row_num}, 10 ,1 ,{row_num} ,{row_num},true,'bin_{row_num}','nchar_{row_num}',now) ") - tdLog.info(" ==== create database {} and insert rows execute end =====".format(dbname)) + tdLog.notice(" ==== create database {} and insert rows execute end =====".format(dbname)) def check_insert_status(self, dbname, tb_nums , row_nums): tdSql.execute("use {}".format(dbname)) diff --git a/tests/system-test/6-cluster/vnode/4dnode1mnode_basic_replica3_insertdatas.py b/tests/system-test/6-cluster/vnode/4dnode1mnode_basic_replica3_insertdatas.py index 00bd8a48d9..0b6ab8721a 100644 --- a/tests/system-test/6-cluster/vnode/4dnode1mnode_basic_replica3_insertdatas.py +++ b/tests/system-test/6-cluster/vnode/4dnode1mnode_basic_replica3_insertdatas.py @@ -71,14 +71,14 @@ class TDTestCase: is_leader=True if count==1 and is_leader: - tdLog.info("===== depoly cluster success with 1 mnode as leader =====") + tdLog.notice("===== depoly cluster success with 1 mnode as leader =====") else: tdLog.exit("===== depoly cluster fail with 1 mnode as leader =====") for k ,v in self.dnode_list.items(): if k == mnode_name: if v[3]==0: - tdLog.info("===== depoly cluster mnode only success at {} , support_vnodes is {} ".format(mnode_name,v[3])) + tdLog.notice("===== depoly cluster mnode only success at {} , support_vnodes is {} ".format(mnode_name,v[3])) else: tdLog.exit("===== depoly cluster mnode only fail at {} , support_vnodes is {} ".format(mnode_name,v[3])) else: @@ -121,7 +121,7 @@ class TDTestCase: for k , v in vgroups_infos.items(): if len(v) ==1 and v[0]=="leader": - tdLog.info(" === create database replica only 1 role leader check success of vgroup_id {} ======".format(k)) + tdLog.notice(" === create database replica only 1 role leader check success of vgroup_id {} ======".format(k)) else: tdLog.exit(" === create database replica only 1 role leader check fail of vgroup_id {} ======".format(k)) @@ -129,7 +129,7 @@ class TDTestCase: drop_db_sql = "drop database if exists {}".format(dbname) create_db_sql = "create database {} replica {} vgroups {}".format(dbname,replica_num,vgroup_nums) - tdLog.info(" ==== create database {} and insert rows begin =====".format(dbname)) + tdLog.notice(" ==== create database {} and insert rows begin =====".format(dbname)) tdSql.execute(drop_db_sql) tdSql.execute(create_db_sql) tdSql.execute("use {}".format(dbname)) @@ -155,7 +155,7 @@ class TDTestCase: ts = self.ts + 1000*row_num tdSql.execute(f"insert into {sub_tbname} values ({ts}, {row_num} ,{row_num}, 10 ,1 ,{row_num} ,{row_num},true,'bin_{row_num}','nchar_{row_num}',now) ") - tdLog.info(" ==== create database {} and insert rows execute end =====".format(dbname)) + tdLog.notice(" ==== create database {} and insert rows execute end =====".format(dbname)) def check_insert_status(self, dbname, tb_nums , row_nums): tdSql.execute("use {}".format(dbname)) diff --git a/tests/system-test/6-cluster/vnode/4dnode1mnode_basic_replica3_insertdatas_stop_follower_sync.py b/tests/system-test/6-cluster/vnode/4dnode1mnode_basic_replica3_insertdatas_stop_follower_sync.py index 22d3ba6dbc..3d6b548bdd 100644 --- a/tests/system-test/6-cluster/vnode/4dnode1mnode_basic_replica3_insertdatas_stop_follower_sync.py +++ b/tests/system-test/6-cluster/vnode/4dnode1mnode_basic_replica3_insertdatas_stop_follower_sync.py @@ -80,14 +80,14 @@ class TDTestCase: is_leader=True if count==1 and is_leader: - tdLog.info("===== depoly cluster success with 1 mnode as leader =====") + tdLog.notice("===== depoly cluster success with 1 mnode as leader =====") else: tdLog.exit("===== depoly cluster fail with 1 mnode as leader =====") for k ,v in self.dnode_list.items(): if k == mnode_name: if v[3]==0: - tdLog.info("===== depoly cluster mnode only success at {} , support_vnodes is {} ".format(mnode_name,v[3])) + tdLog.notice("===== depoly cluster mnode only success at {} , support_vnodes is {} ".format(mnode_name,v[3])) else: tdLog.exit("===== depoly cluster mnode only fail at {} , support_vnodes is {} ".format(mnode_name,v[3])) else: @@ -130,7 +130,7 @@ class TDTestCase: for k , v in vgroups_infos.items(): if len(v) ==1 and v[0]=="leader": - tdLog.info(" === create database replica only 1 role leader check success of vgroup_id {} ======".format(k)) + tdLog.notice(" === create database replica only 1 role leader check success of vgroup_id {} ======".format(k)) else: tdLog.exit(" === create database replica only 1 role leader check fail of vgroup_id {} ======".format(k)) @@ -138,7 +138,7 @@ class TDTestCase: drop_db_sql = "drop database if exists {}".format(dbname) create_db_sql = "create database {} replica {} vgroups {}".format(dbname,replica_num,vgroup_nums) - tdLog.info(" ==== create database {} and insert rows begin =====".format(dbname)) + tdLog.notice(" ==== create database {} and insert rows begin =====".format(dbname)) tdSql.execute(drop_db_sql) tdSql.execute(create_db_sql) tdSql.execute("use {}".format(dbname)) @@ -161,7 +161,7 @@ class TDTestCase: ts = self.ts + self.ts_step*row_num tdSql.execute(f"insert into {sub_tbname} values ({ts}, {row_num} ,{row_num}, 10 ,1 ,{row_num} ,{row_num},true,'bin_{row_num}','nchar_{row_num}',now) ") - tdLog.info(" ==== stable {} insert rows execute end =====".format(stablename)) + tdLog.notice(" ==== stable {} insert rows execute end =====".format(stablename)) def append_rows_of_exists_tables(self,dbname ,stablename , tbname , append_nums ): @@ -170,7 +170,7 @@ class TDTestCase: for row_num in range(append_nums): tdSql.execute(f"insert into {tbname} values (now, {row_num} ,{row_num}, 10 ,1 ,{row_num} ,{row_num},true,'bin_{row_num}','nchar_{row_num}',now) ") # print(f"insert into {tbname} values (now, {row_num} ,{row_num}, 10 ,1 ,{row_num} ,{row_num},true,'bin_{row_num}','nchar_{row_num}',now) ") - tdLog.info(" ==== append new rows of table {} belongs to stable {} execute end =====".format(tbname,stablename)) + tdLog.notice(" ==== append new rows of table {} belongs to stable {} execute end =====".format(tbname,stablename)) os.system("taos -s 'select count(*) from {}.{}';".format(dbname,stablename)) def check_insert_rows(self, dbname, stablename , tb_nums , row_nums, append_rows): @@ -197,7 +197,7 @@ class TDTestCase: time.sleep(0.1) tdSql.query("select count(*) from {}.{}".format(dbname,stablename)) status_OK = self.mycheckData("select count(*) from {}.{}".format(dbname,stablename) ,0 , 0 , tb_nums*row_nums+append_rows) - tdLog.info(" ==== check insert rows first failed , this is {}_th retry check rows of database {}".format(count , dbname)) + tdLog.debug(" ==== check insert rows first failed , this is {}_th retry check rows of database {}".format(count , dbname)) count += 1 @@ -218,7 +218,7 @@ class TDTestCase: time.sleep(0.1) tdSql.query("select distinct tbname from {}.{}".format(dbname,stablename)) status_OK = self.mycheckRows("select distinct tbname from {}.{}".format(dbname,stablename) ,tb_nums) - tdLog.info(" ==== check insert tbnames first failed , this is {}_th retry check tbnames of database {}".format(count , dbname)) + tdLog.debug(" ==== check insert tbnames first failed , this is {}_th retry check tbnames of database {}".format(count , dbname)) count += 1 def _get_stop_dnode_id(self,dbname): tdSql.query("show {}.vgroups".format(dbname)) @@ -255,8 +255,8 @@ class TDTestCase: while status !="offline": time.sleep(0.1) status = _get_status() - # tdLog.info("==== stop dnode has not been stopped , endpoint is {}".format(self.stop_dnode)) - tdLog.info("==== stop_dnode has stopped , id is {}".format(self.stop_dnode_id)) + # tdLog.notice("==== stop dnode has not been stopped , endpoint is {}".format(self.stop_dnode)) + tdLog.notice("==== stop_dnode has stopped , id is {} ====".format(self.stop_dnode_id)) def wait_start_dnode_OK(self): @@ -277,8 +277,8 @@ class TDTestCase: while status !="ready": time.sleep(0.1) status = _get_status() - # tdLog.info("==== stop dnode has not been stopped , endpoint is {}".format(self.stop_dnode)) - tdLog.info("==== stop_dnode has restart , id is {}".format(self.stop_dnode_id)) + # tdLog.notice("==== stop dnode has not been stopped , endpoint is {}".format(self.stop_dnode)) + tdLog.notice("==== stop_dnode has restart , id is {} ====".format(self.stop_dnode_id)) def _parse_datetime(self,timestr): try: @@ -342,9 +342,9 @@ class TDTestCase: elif isinstance(data, str): tdLog.info("sql:%s, row:%d col:%d data:%s == expect:%s" % (sql, row, col, tdSql.queryResult[row][col], data)) - elif isinstance(data, datetime.date): - tdLog.info("sql:%s, row:%d col:%d data:%s == expect:%s" % - (sql, row, col, tdSql.queryResult[row][col], data)) + # elif isinstance(data, datetime.date): + # tdLog.info("sql:%s, row:%d col:%d data:%s == expect:%s" % + # (sql, row, col, tdSql.queryResult[row][col], data)) elif isinstance(data, float): tdLog.info("sql:%s, row:%d col:%d data:%s == expect:%s" % (sql, row, col, tdSql.queryResult[row][col], data)) @@ -389,15 +389,15 @@ class TDTestCase: # append rows of stablename when dnode stop tbname = "sub_{}_{}".format(stablename , 0) - tdLog.info(" ==== begin append rows of exists table {} when dnode {} offline ====".format(tbname , self.stop_dnode_id)) + tdLog.notice(" ==== begin append rows of exists table {} when dnode {} offline ====".format(tbname , self.stop_dnode_id)) self.append_rows_of_exists_tables(db_name ,stablename , tbname , 100 ) - tdLog.info(" ==== check append rows of exists table {} when dnode {} offline ====".format(tbname , self.stop_dnode_id)) + tdLog.notice(" ==== check append rows of exists table {} when dnode {} offline ====".format(tbname , self.stop_dnode_id)) self.check_insert_rows(db_name ,stablename ,tb_nums=10 , row_nums= 10 ,append_rows=100) # create new stables - tdLog.info(" ==== create new stable {} when dnode {} offline ====".format('new_stb1' , self.stop_dnode_id)) + tdLog.notice(" ==== create new stable {} when dnode {} offline ====".format('new_stb1' , self.stop_dnode_id)) self.create_stable_insert_datas(dbname = db_name , stablename = 'new_stb1' , tb_nums= 10 ,row_nums= 10 ) - tdLog.info(" ==== check new stable {} when dnode {} offline ====".format('new_stb1' , self.stop_dnode_id)) + tdLog.notice(" ==== check new stable {} when dnode {} offline ====".format('new_stb1' , self.stop_dnode_id)) self.check_insert_rows(db_name ,'new_stb1' ,tb_nums=10 , row_nums= 10 ,append_rows=0) # begin start dnode @@ -409,9 +409,9 @@ class TDTestCase: tdLog.exit(" ==== restart dnode {} cost too much time , please check ====".format(self.stop_dnode_id)) # create new stables again - tdLog.info(" ==== create new stable {} when dnode {} restart ====".format('new_stb2' , self.stop_dnode_id)) + tdLog.notice(" ==== create new stable {} when dnode {} restart ====".format('new_stb2' , self.stop_dnode_id)) self.create_stable_insert_datas(dbname = db_name , stablename = 'new_stb2' , tb_nums= 10 ,row_nums= 10 ) - tdLog.info(" ==== check new stable {} when dnode {} restart ====".format('new_stb2' , self.stop_dnode_id)) + tdLog.notice(" ==== check new stable {} when dnode {} restart ====".format('new_stb2' , self.stop_dnode_id)) self.check_insert_rows(db_name ,'new_stb2' ,tb_nums=10 , row_nums= 10 ,append_rows=0) def unsync_run_case(self): @@ -447,7 +447,7 @@ class TDTestCase: self.create_database(dbname = db_name ,replica_num= self.replica , vgroup_nums= 1) self.create_stable_insert_datas(dbname = db_name , stablename = stablename , tb_nums= 10 ,row_nums= 10 ) - tdLog.info(" ===== restart dnode of database {} in an unsync threading ===== ".format(db_name)) + tdLog.notice(" ===== restart dnode of database {} in an unsync threading ===== ".format(db_name)) # create sync threading and start it self.current_thread = _create_threading(db_name) @@ -457,21 +457,21 @@ class TDTestCase: self.check_insert_rows(db_name ,stablename ,tb_nums=10 , row_nums= 10 ,append_rows=0) tbname = "sub_{}_{}".format(stablename , 0) - tdLog.info(" ==== begin append rows of exists table {} when dnode {} offline ====".format(tbname , self.stop_dnode_id)) + tdLog.notice(" ==== begin append rows of exists table {} when dnode {} offline ====".format(tbname , self.stop_dnode_id)) self.append_rows_of_exists_tables(db_name ,stablename , tbname , 100 ) - tdLog.info(" ==== check append rows of exists table {} when dnode {} offline ====".format(tbname , self.stop_dnode_id)) + tdLog.notice(" ==== check append rows of exists table {} when dnode {} offline ====".format(tbname , self.stop_dnode_id)) self.check_insert_rows(db_name ,stablename ,tb_nums=10 , row_nums= 10 ,append_rows=100) # create new stables - tdLog.info(" ==== create new stable {} when dnode {} offline ====".format('new_stb1' , self.stop_dnode_id)) + tdLog.notice(" ==== create new stable {} when dnode {} offline ====".format('new_stb1' , self.stop_dnode_id)) self.create_stable_insert_datas(dbname = db_name , stablename = 'new_stb1' , tb_nums= 10 ,row_nums= 10 ) - tdLog.info(" ==== check new stable {} when dnode {} offline ====".format('new_stb1' , self.stop_dnode_id)) + tdLog.notice(" ==== check new stable {} when dnode {} offline ====".format('new_stb1' , self.stop_dnode_id)) self.check_insert_rows(db_name ,'new_stb1' ,tb_nums=10 , row_nums= 10 ,append_rows=0) # create new stables again - tdLog.info(" ==== create new stable {} when dnode {} restart ====".format('new_stb2' , self.stop_dnode_id)) + tdLog.notice(" ==== create new stable {} when dnode {} restart ====".format('new_stb2' , self.stop_dnode_id)) self.create_stable_insert_datas(dbname = db_name , stablename = 'new_stb2' , tb_nums= 10 ,row_nums= 10 ) - tdLog.info(" ==== check new stable {} when dnode {} restart ====".format('new_stb2' , self.stop_dnode_id)) + tdLog.notice(" ==== check new stable {} when dnode {} restart ====".format('new_stb2' , self.stop_dnode_id)) self.check_insert_rows(db_name ,'new_stb2' ,tb_nums=10 , row_nums= 10 ,append_rows=0) self.current_thread.join() diff --git a/tests/system-test/6-cluster/vnode/4dnode1mnode_basic_replica3_insertdatas_stop_follower_unsync.py b/tests/system-test/6-cluster/vnode/4dnode1mnode_basic_replica3_insertdatas_stop_follower_unsync.py index 28198b9529..8ec6349879 100644 --- a/tests/system-test/6-cluster/vnode/4dnode1mnode_basic_replica3_insertdatas_stop_follower_unsync.py +++ b/tests/system-test/6-cluster/vnode/4dnode1mnode_basic_replica3_insertdatas_stop_follower_unsync.py @@ -80,14 +80,14 @@ class TDTestCase: is_leader=True if count==1 and is_leader: - tdLog.info("===== depoly cluster success with 1 mnode as leader =====") + tdLog.notice("===== depoly cluster success with 1 mnode as leader =====") else: tdLog.exit("===== depoly cluster fail with 1 mnode as leader =====") for k ,v in self.dnode_list.items(): if k == mnode_name: if v[3]==0: - tdLog.info("===== depoly cluster mnode only success at {} , support_vnodes is {} ".format(mnode_name,v[3])) + tdLog.notice("===== depoly cluster mnode only success at {} , support_vnodes is {} ".format(mnode_name,v[3])) else: tdLog.exit("===== depoly cluster mnode only fail at {} , support_vnodes is {} ".format(mnode_name,v[3])) else: @@ -130,7 +130,7 @@ class TDTestCase: for k , v in vgroups_infos.items(): if len(v) ==1 and v[0]=="leader": - tdLog.info(" === create database replica only 1 role leader check success of vgroup_id {} ======".format(k)) + tdLog.notice(" === create database replica only 1 role leader check success of vgroup_id {} ======".format(k)) else: tdLog.exit(" === create database replica only 1 role leader check fail of vgroup_id {} ======".format(k)) @@ -138,7 +138,7 @@ class TDTestCase: drop_db_sql = "drop database if exists {}".format(dbname) create_db_sql = "create database {} replica {} vgroups {}".format(dbname,replica_num,vgroup_nums) - tdLog.info(" ==== create database {} and insert rows begin =====".format(dbname)) + tdLog.notice(" ==== create database {} and insert rows begin =====".format(dbname)) tdSql.execute(drop_db_sql) tdSql.execute(create_db_sql) tdSql.execute("use {}".format(dbname)) @@ -161,7 +161,7 @@ class TDTestCase: ts = self.ts + self.ts_step*row_num tdSql.execute(f"insert into {sub_tbname} values ({ts}, {row_num} ,{row_num}, 10 ,1 ,{row_num} ,{row_num},true,'bin_{row_num}','nchar_{row_num}',now) ") - tdLog.info(" ==== stable {} insert rows execute end =====".format(stablename)) + tdLog.notice(" ==== stable {} insert rows execute end =====".format(stablename)) def append_rows_of_exists_tables(self,dbname ,stablename , tbname , append_nums ): @@ -170,7 +170,7 @@ class TDTestCase: for row_num in range(append_nums): tdSql.execute(f"insert into {tbname} values (now, {row_num} ,{row_num}, 10 ,1 ,{row_num} ,{row_num},true,'bin_{row_num}','nchar_{row_num}',now) ") # print(f"insert into {tbname} values (now, {row_num} ,{row_num}, 10 ,1 ,{row_num} ,{row_num},true,'bin_{row_num}','nchar_{row_num}',now) ") - tdLog.info(" ==== append new rows of table {} belongs to stable {} execute end =====".format(tbname,stablename)) + tdLog.notice(" ==== append new rows of table {} belongs to stable {} execute end =====".format(tbname,stablename)) os.system("taos -s 'select count(*) from {}.{}';".format(dbname,stablename)) def check_insert_rows(self, dbname, stablename , tb_nums , row_nums, append_rows): @@ -197,7 +197,7 @@ class TDTestCase: time.sleep(0.1) tdSql.query("select count(*) from {}.{}".format(dbname,stablename)) status_OK = self.mycheckData("select count(*) from {}.{}".format(dbname,stablename) ,0 , 0 , tb_nums*row_nums+append_rows) - tdLog.info(" ==== check insert rows first failed , this is {}_th retry check rows of database {}".format(count , dbname)) + tdLog.notice(" ==== check insert rows first failed , this is {}_th retry check rows of database {}".format(count , dbname)) count += 1 @@ -218,7 +218,7 @@ class TDTestCase: time.sleep(0.1) tdSql.query("select distinct tbname from {}.{}".format(dbname,stablename)) status_OK = self.mycheckRows("select distinct tbname from {}.{}".format(dbname,stablename) ,tb_nums) - tdLog.info(" ==== check insert tbnames first failed , this is {}_th retry check tbnames of database {}".format(count , dbname)) + tdLog.notice(" ==== check insert tbnames first failed , this is {}_th retry check tbnames of database {}".format(count , dbname)) count += 1 def _get_stop_dnode_id(self,dbname): @@ -256,8 +256,8 @@ class TDTestCase: while status !="offline": time.sleep(0.1) status = _get_status() - # tdLog.info("==== stop dnode has not been stopped , endpoint is {}".format(self.stop_dnode)) - tdLog.info("==== stop_dnode has stopped , id is {}".format(self.stop_dnode_id)) + # tdLog.notice("==== stop dnode has not been stopped , endpoint is {}".format(self.stop_dnode)) + tdLog.notice("==== stop_dnode has stopped , id is {}".format(self.stop_dnode_id)) def wait_start_dnode_OK(self): @@ -278,8 +278,8 @@ class TDTestCase: while status !="ready": time.sleep(0.1) status = _get_status() - # tdLog.info("==== stop dnode has not been stopped , endpoint is {}".format(self.stop_dnode)) - tdLog.info("==== stop_dnode has restart , id is {}".format(self.stop_dnode_id)) + # tdLog.notice("==== stop dnode has not been stopped , endpoint is {}".format(self.stop_dnode)) + tdLog.notice("==== stop_dnode has restart , id is {}".format(self.stop_dnode_id)) def _parse_datetime(self,timestr): try: @@ -343,9 +343,9 @@ class TDTestCase: elif isinstance(data, str): tdLog.info("sql:%s, row:%d col:%d data:%s == expect:%s" % (sql, row, col, tdSql.queryResult[row][col], data)) - elif isinstance(data, datetime.date): - tdLog.info("sql:%s, row:%d col:%d data:%s == expect:%s" % - (sql, row, col, tdSql.queryResult[row][col], data)) + # elif isinstance(data, datetime.date): + # tdLog.info("sql:%s, row:%d col:%d data:%s == expect:%s" % + # (sql, row, col, tdSql.queryResult[row][col], data)) elif isinstance(data, float): tdLog.info("sql:%s, row:%d col:%d data:%s == expect:%s" % (sql, row, col, tdSql.queryResult[row][col], data)) @@ -390,15 +390,15 @@ class TDTestCase: # append rows of stablename when dnode stop tbname = "sub_{}_{}".format(stablename , 0) - tdLog.info(" ==== begin append rows of exists table {} when dnode {} offline ====".format(tbname , self.stop_dnode_id)) + tdLog.notice(" ==== begin append rows of exists table {} when dnode {} offline ====".format(tbname , self.stop_dnode_id)) self.append_rows_of_exists_tables(db_name ,stablename , tbname , 100 ) - tdLog.info(" ==== check append rows of exists table {} when dnode {} offline ====".format(tbname , self.stop_dnode_id)) + tdLog.notice(" ==== check append rows of exists table {} when dnode {} offline ====".format(tbname , self.stop_dnode_id)) self.check_insert_rows(db_name ,stablename ,tb_nums=10 , row_nums= 10 ,append_rows=100) # create new stables - tdLog.info(" ==== create new stable {} when dnode {} offline ====".format('new_stb1' , self.stop_dnode_id)) + tdLog.notice(" ==== create new stable {} when dnode {} offline ====".format('new_stb1' , self.stop_dnode_id)) self.create_stable_insert_datas(dbname = db_name , stablename = 'new_stb1' , tb_nums= 10 ,row_nums= 10 ) - tdLog.info(" ==== check new stable {} when dnode {} offline ====".format('new_stb1' , self.stop_dnode_id)) + tdLog.notice(" ==== check new stable {} when dnode {} offline ====".format('new_stb1' , self.stop_dnode_id)) self.check_insert_rows(db_name ,'new_stb1' ,tb_nums=10 , row_nums= 10 ,append_rows=0) # begin start dnode @@ -410,9 +410,9 @@ class TDTestCase: tdLog.exit(" ==== restart dnode {} cost too much time , please check ====".format(self.stop_dnode_id)) # create new stables again - tdLog.info(" ==== create new stable {} when dnode {} restart ====".format('new_stb2' , self.stop_dnode_id)) + tdLog.notice(" ==== create new stable {} when dnode {} restart ====".format('new_stb2' , self.stop_dnode_id)) self.create_stable_insert_datas(dbname = db_name , stablename = 'new_stb2' , tb_nums= 10 ,row_nums= 10 ) - tdLog.info(" ==== check new stable {} when dnode {} restart ====".format('new_stb2' , self.stop_dnode_id)) + tdLog.notice(" ==== check new stable {} when dnode {} restart ====".format('new_stb2' , self.stop_dnode_id)) self.check_insert_rows(db_name ,'new_stb2' ,tb_nums=10 , row_nums= 10 ,append_rows=0) def unsync_run_case(self): @@ -448,7 +448,7 @@ class TDTestCase: self.create_database(dbname = db_name ,replica_num= self.replica , vgroup_nums= 1) self.create_stable_insert_datas(dbname = db_name , stablename = stablename , tb_nums= 10 ,row_nums= 10 ) - tdLog.info(" ===== restart dnode of database {} in an unsync threading ===== ".format(db_name)) + tdLog.notice(" ===== restart dnode of database {} in an unsync threading ===== ".format(db_name)) # create sync threading and start it self.current_thread = _create_threading(db_name) @@ -458,21 +458,21 @@ class TDTestCase: self.check_insert_rows(db_name ,stablename ,tb_nums=10 , row_nums= 10 ,append_rows=0) tbname = "sub_{}_{}".format(stablename , 0) - tdLog.info(" ==== begin append rows of exists table {} when dnode {} offline ====".format(tbname , self.stop_dnode_id)) + tdLog.notice(" ==== begin append rows of exists table {} when dnode {} offline ====".format(tbname , self.stop_dnode_id)) self.append_rows_of_exists_tables(db_name ,stablename , tbname , 100 ) - tdLog.info(" ==== check append rows of exists table {} when dnode {} offline ====".format(tbname , self.stop_dnode_id)) + tdLog.notice(" ==== check append rows of exists table {} when dnode {} offline ====".format(tbname , self.stop_dnode_id)) self.check_insert_rows(db_name ,stablename ,tb_nums=10 , row_nums= 10 ,append_rows=100) # create new stables - tdLog.info(" ==== create new stable {} when dnode {} offline ====".format('new_stb1' , self.stop_dnode_id)) + tdLog.notice(" ==== create new stable {} when dnode {} offline ====".format('new_stb1' , self.stop_dnode_id)) self.create_stable_insert_datas(dbname = db_name , stablename = 'new_stb1' , tb_nums= 10 ,row_nums= 10 ) - tdLog.info(" ==== check new stable {} when dnode {} offline ====".format('new_stb1' , self.stop_dnode_id)) + tdLog.notice(" ==== check new stable {} when dnode {} offline ====".format('new_stb1' , self.stop_dnode_id)) self.check_insert_rows(db_name ,'new_stb1' ,tb_nums=10 , row_nums= 10 ,append_rows=0) # create new stables again - tdLog.info(" ==== create new stable {} when dnode {} restart ====".format('new_stb2' , self.stop_dnode_id)) + tdLog.notice(" ==== create new stable {} when dnode {} restart ====".format('new_stb2' , self.stop_dnode_id)) self.create_stable_insert_datas(dbname = db_name , stablename = 'new_stb2' , tb_nums= 10 ,row_nums= 10 ) - tdLog.info(" ==== check new stable {} when dnode {} restart ====".format('new_stb2' , self.stop_dnode_id)) + tdLog.notice(" ==== check new stable {} when dnode {} restart ====".format('new_stb2' , self.stop_dnode_id)) self.check_insert_rows(db_name ,'new_stb2' ,tb_nums=10 , row_nums= 10 ,append_rows=0) self.current_thread.join() diff --git a/tests/system-test/6-cluster/vnode/4dnode1mnode_basic_replica3_insertdatas_stop_follower_unsync_force_stop.py b/tests/system-test/6-cluster/vnode/4dnode1mnode_basic_replica3_insertdatas_stop_follower_unsync_force_stop.py index 83faba4578..fa7e5292de 100644 --- a/tests/system-test/6-cluster/vnode/4dnode1mnode_basic_replica3_insertdatas_stop_follower_unsync_force_stop.py +++ b/tests/system-test/6-cluster/vnode/4dnode1mnode_basic_replica3_insertdatas_stop_follower_unsync_force_stop.py @@ -80,14 +80,14 @@ class TDTestCase: is_leader=True if count==1 and is_leader: - tdLog.info("===== depoly cluster success with 1 mnode as leader =====") + tdLog.notice("===== depoly cluster success with 1 mnode as leader =====") else: tdLog.exit("===== depoly cluster fail with 1 mnode as leader =====") for k ,v in self.dnode_list.items(): if k == mnode_name: if v[3]==0: - tdLog.info("===== depoly cluster mnode only success at {} , support_vnodes is {} ".format(mnode_name,v[3])) + tdLog.notice("===== depoly cluster mnode only success at {} , support_vnodes is {} ".format(mnode_name,v[3])) else: tdLog.exit("===== depoly cluster mnode only fail at {} , support_vnodes is {} ".format(mnode_name,v[3])) else: @@ -130,7 +130,7 @@ class TDTestCase: for k , v in vgroups_infos.items(): if len(v) ==1 and v[0]=="leader": - tdLog.info(" === create database replica only 1 role leader check success of vgroup_id {} ======".format(k)) + tdLog.notice(" === create database replica only 1 role leader check success of vgroup_id {} ======".format(k)) else: tdLog.exit(" === create database replica only 1 role leader check fail of vgroup_id {} ======".format(k)) @@ -138,7 +138,7 @@ class TDTestCase: drop_db_sql = "drop database if exists {}".format(dbname) create_db_sql = "create database {} replica {} vgroups {}".format(dbname,replica_num,vgroup_nums) - tdLog.info(" ==== create database {} and insert rows begin =====".format(dbname)) + tdLog.notice(" ==== create database {} and insert rows begin =====".format(dbname)) tdSql.execute(drop_db_sql) tdSql.execute(create_db_sql) tdSql.execute("use {}".format(dbname)) @@ -161,7 +161,7 @@ class TDTestCase: ts = self.ts + self.ts_step*row_num tdSql.execute(f"insert into {sub_tbname} values ({ts}, {row_num} ,{row_num}, 10 ,1 ,{row_num} ,{row_num},true,'bin_{row_num}','nchar_{row_num}',now) ") - tdLog.info(" ==== stable {} insert rows execute end =====".format(stablename)) + tdLog.notice(" ==== stable {} insert rows execute end =====".format(stablename)) def append_rows_of_exists_tables(self,dbname ,stablename , tbname , append_nums ): @@ -170,7 +170,7 @@ class TDTestCase: for row_num in range(append_nums): tdSql.execute(f"insert into {tbname} values (now, {row_num} ,{row_num}, 10 ,1 ,{row_num} ,{row_num},true,'bin_{row_num}','nchar_{row_num}',now) ") # print(f"insert into {tbname} values (now, {row_num} ,{row_num}, 10 ,1 ,{row_num} ,{row_num},true,'bin_{row_num}','nchar_{row_num}',now) ") - tdLog.info(" ==== append new rows of table {} belongs to stable {} execute end =====".format(tbname,stablename)) + tdLog.notice(" ==== append new rows of table {} belongs to stable {} execute end =====".format(tbname,stablename)) os.system("taos -s 'select count(*) from {}.{}';".format(dbname,stablename)) def check_insert_rows(self, dbname, stablename , tb_nums , row_nums, append_rows): @@ -197,7 +197,7 @@ class TDTestCase: time.sleep(0.1) tdSql.query("select count(*) from {}.{}".format(dbname,stablename)) status_OK = self.mycheckData("select count(*) from {}.{}".format(dbname,stablename) ,0 , 0 , tb_nums*row_nums+append_rows) - tdLog.info(" ==== check insert rows first failed , this is {}_th retry check rows of database {}".format(count , dbname)) + tdLog.notice(" ==== check insert rows first failed , this is {}_th retry check rows of database {}".format(count , dbname)) count += 1 @@ -218,7 +218,7 @@ class TDTestCase: time.sleep(0.1) tdSql.query("select distinct tbname from {}.{}".format(dbname,stablename)) status_OK = self.mycheckRows("select distinct tbname from {}.{}".format(dbname,stablename) ,tb_nums) - tdLog.info(" ==== check insert tbnames first failed , this is {}_th retry check tbnames of database {}".format(count , dbname)) + tdLog.notice(" ==== check insert tbnames first failed , this is {}_th retry check tbnames of database {}".format(count , dbname)) count += 1 def _get_stop_dnode_id(self,dbname): @@ -256,8 +256,8 @@ class TDTestCase: while status !="offline": time.sleep(0.1) status = _get_status() - # tdLog.info("==== stop dnode has not been stopped , endpoint is {}".format(self.stop_dnode)) - tdLog.info("==== stop_dnode has stopped , id is {}".format(self.stop_dnode_id)) + # tdLog.notice("==== stop dnode has not been stopped , endpoint is {}".format(self.stop_dnode)) + tdLog.notice("==== stop_dnode has stopped , id is {}".format(self.stop_dnode_id)) def wait_start_dnode_OK(self): @@ -278,8 +278,8 @@ class TDTestCase: while status !="ready": time.sleep(0.1) status = _get_status() - # tdLog.info("==== stop dnode has not been stopped , endpoint is {}".format(self.stop_dnode)) - tdLog.info("==== stop_dnode has restart , id is {}".format(self.stop_dnode_id)) + # tdLog.notice("==== stop dnode has not been stopped , endpoint is {}".format(self.stop_dnode)) + tdLog.notice("==== stop_dnode has restart , id is {}".format(self.stop_dnode_id)) def _parse_datetime(self,timestr): try: @@ -343,9 +343,9 @@ class TDTestCase: elif isinstance(data, str): tdLog.info("sql:%s, row:%d col:%d data:%s == expect:%s" % (sql, row, col, tdSql.queryResult[row][col], data)) - elif isinstance(data, datetime.date): - tdLog.info("sql:%s, row:%d col:%d data:%s == expect:%s" % - (sql, row, col, tdSql.queryResult[row][col], data)) + # elif isinstance(data, datetime.date): + # tdLog.info("sql:%s, row:%d col:%d data:%s == expect:%s" % + # (sql, row, col, tdSql.queryResult[row][col], data)) elif isinstance(data, float): tdLog.info("sql:%s, row:%d col:%d data:%s == expect:%s" % (sql, row, col, tdSql.queryResult[row][col], data)) @@ -390,15 +390,15 @@ class TDTestCase: # append rows of stablename when dnode stop tbname = "sub_{}_{}".format(stablename , 0) - tdLog.info(" ==== begin append rows of exists table {} when dnode {} offline ====".format(tbname , self.stop_dnode_id)) + tdLog.notice(" ==== begin append rows of exists table {} when dnode {} offline ====".format(tbname , self.stop_dnode_id)) self.append_rows_of_exists_tables(db_name ,stablename , tbname , 100 ) - tdLog.info(" ==== check append rows of exists table {} when dnode {} offline ====".format(tbname , self.stop_dnode_id)) + tdLog.notice(" ==== check append rows of exists table {} when dnode {} offline ====".format(tbname , self.stop_dnode_id)) self.check_insert_rows(db_name ,stablename ,tb_nums=10 , row_nums= 10 ,append_rows=100) # create new stables - tdLog.info(" ==== create new stable {} when dnode {} offline ====".format('new_stb1' , self.stop_dnode_id)) + tdLog.notice(" ==== create new stable {} when dnode {} offline ====".format('new_stb1' , self.stop_dnode_id)) self.create_stable_insert_datas(dbname = db_name , stablename = 'new_stb1' , tb_nums= 10 ,row_nums= 10 ) - tdLog.info(" ==== check new stable {} when dnode {} offline ====".format('new_stb1' , self.stop_dnode_id)) + tdLog.notice(" ==== check new stable {} when dnode {} offline ====".format('new_stb1' , self.stop_dnode_id)) self.check_insert_rows(db_name ,'new_stb1' ,tb_nums=10 , row_nums= 10 ,append_rows=0) # begin start dnode @@ -410,9 +410,9 @@ class TDTestCase: tdLog.exit(" ==== restart dnode {} cost too much time , please check ====".format(self.stop_dnode_id)) # create new stables again - tdLog.info(" ==== create new stable {} when dnode {} restart ====".format('new_stb2' , self.stop_dnode_id)) + tdLog.notice(" ==== create new stable {} when dnode {} restart ====".format('new_stb2' , self.stop_dnode_id)) self.create_stable_insert_datas(dbname = db_name , stablename = 'new_stb2' , tb_nums= 10 ,row_nums= 10 ) - tdLog.info(" ==== check new stable {} when dnode {} restart ====".format('new_stb2' , self.stop_dnode_id)) + tdLog.notice(" ==== check new stable {} when dnode {} restart ====".format('new_stb2' , self.stop_dnode_id)) self.check_insert_rows(db_name ,'new_stb2' ,tb_nums=10 , row_nums= 10 ,append_rows=0) def unsync_run_case(self): @@ -453,7 +453,7 @@ class TDTestCase: self.create_database(dbname = db_name ,replica_num= self.replica , vgroup_nums= 1) self.create_stable_insert_datas(dbname = db_name , stablename = stablename , tb_nums= 10 ,row_nums= 10 ) - tdLog.info(" ===== restart dnode of database {} in an unsync threading ===== ".format(db_name)) + tdLog.notice(" ===== restart dnode of database {} in an unsync threading ===== ".format(db_name)) # create sync threading and start it self.current_thread = _create_threading(db_name) @@ -463,21 +463,21 @@ class TDTestCase: self.check_insert_rows(db_name ,stablename ,tb_nums=10 , row_nums= 10 ,append_rows=0) tbname = "sub_{}_{}".format(stablename , 0) - tdLog.info(" ==== begin append rows of exists table {} when dnode {} offline ====".format(tbname , self.stop_dnode_id)) + tdLog.notice(" ==== begin append rows of exists table {} when dnode {} offline ====".format(tbname , self.stop_dnode_id)) self.append_rows_of_exists_tables(db_name ,stablename , tbname , 100 ) - tdLog.info(" ==== check append rows of exists table {} when dnode {} offline ====".format(tbname , self.stop_dnode_id)) + tdLog.notice(" ==== check append rows of exists table {} when dnode {} offline ====".format(tbname , self.stop_dnode_id)) self.check_insert_rows(db_name ,stablename ,tb_nums=10 , row_nums= 10 ,append_rows=100) # create new stables - tdLog.info(" ==== create new stable {} when dnode {} offline ====".format('new_stb1' , self.stop_dnode_id)) + tdLog.notice(" ==== create new stable {} when dnode {} offline ====".format('new_stb1' , self.stop_dnode_id)) self.create_stable_insert_datas(dbname = db_name , stablename = 'new_stb1' , tb_nums= 10 ,row_nums= 10 ) - tdLog.info(" ==== check new stable {} when dnode {} offline ====".format('new_stb1' , self.stop_dnode_id)) + tdLog.notice(" ==== check new stable {} when dnode {} offline ====".format('new_stb1' , self.stop_dnode_id)) self.check_insert_rows(db_name ,'new_stb1' ,tb_nums=10 , row_nums= 10 ,append_rows=0) # create new stables again - tdLog.info(" ==== create new stable {} when dnode {} restart ====".format('new_stb2' , self.stop_dnode_id)) + tdLog.notice(" ==== create new stable {} when dnode {} restart ====".format('new_stb2' , self.stop_dnode_id)) self.create_stable_insert_datas(dbname = db_name , stablename = 'new_stb2' , tb_nums= 10 ,row_nums= 10 ) - tdLog.info(" ==== check new stable {} when dnode {} restart ====".format('new_stb2' , self.stop_dnode_id)) + tdLog.notice(" ==== check new stable {} when dnode {} restart ====".format('new_stb2' , self.stop_dnode_id)) self.check_insert_rows(db_name ,'new_stb2' ,tb_nums=10 , row_nums= 10 ,append_rows=0) self.current_thread.join() @@ -493,7 +493,7 @@ class TDTestCase: else: continue if port: - tdLog.info(" ==== dnode {} will be force stop by kill -9 ====".format(dnode_id)) + tdLog.notice(" ==== dnode {} will be force stop by kill -9 ====".format(dnode_id)) psCmd = '''netstat -anp|grep -w LISTEN|grep -w %s |grep -o "LISTEN.*"|awk '{print $2}'|cut -d/ -f1|head -n1''' %(port) processID = subprocess.check_output( psCmd, shell=True).decode("utf-8") diff --git a/tests/system-test/6-cluster/vnode/4dnode1mnode_basic_replica3_insertdatas_stop_leader.py b/tests/system-test/6-cluster/vnode/4dnode1mnode_basic_replica3_insertdatas_stop_leader.py index c0aafa7978..2e4b299fc6 100644 --- a/tests/system-test/6-cluster/vnode/4dnode1mnode_basic_replica3_insertdatas_stop_leader.py +++ b/tests/system-test/6-cluster/vnode/4dnode1mnode_basic_replica3_insertdatas_stop_leader.py @@ -114,9 +114,9 @@ class TDTestCase: elif isinstance(data, str): tdLog.info("sql:%s, row:%d col:%d data:%s == expect:%s" % (sql, row, col, tdSql.queryResult[row][col], data)) - elif isinstance(data, datetime.date): - tdLog.info("sql:%s, row:%d col:%d data:%s == expect:%s" % - (sql, row, col, tdSql.queryResult[row][col], data)) + # elif isinstance(data, datetime.date): + # tdLog.info("sql:%s, row:%d col:%d data:%s == expect:%s" % + # (sql, row, col, tdSql.queryResult[row][col], data)) elif isinstance(data, float): tdLog.info("sql:%s, row:%d col:%d data:%s == expect:%s" % (sql, row, col, tdSql.queryResult[row][col], data)) @@ -163,146 +163,20 @@ class TDTestCase: is_leader=True if count==1 and is_leader: - tdLog.info("===== depoly cluster success with 1 mnode as leader =====") + tdLog.notice("===== depoly cluster success with 1 mnode as leader =====") else: tdLog.exit("===== depoly cluster fail with 1 mnode as leader =====") for k ,v in self.dnode_list.items(): if k == mnode_name: if v[3]==0: - tdLog.info("===== depoly cluster mnode only success at {} , support_vnodes is {} ".format(mnode_name,v[3])) + tdLog.notice("===== depoly cluster mnode only success at {} , support_vnodes is {} ".format(mnode_name,v[3])) else: tdLog.exit("===== depoly cluster mnode only fail at {} , support_vnodes is {} ".format(mnode_name,v[3])) else: continue - def create_db_check_vgroups(self): - tdSql.execute("drop database if exists test") - tdSql.execute("create database if not exists test replica 1 duration 300") - tdSql.execute("use test") - tdSql.execute( - '''create table stb1 - (ts timestamp, c1 int, c2 bigint, c3 smallint, c4 tinyint, c5 float, c6 double, c7 bool, c8 binary(16),c9 nchar(32), c10 timestamp) - tags (t1 int) - ''' - ) - tdSql.execute( - ''' - create table t1 - (ts timestamp, c1 int, c2 bigint, c3 smallint, c4 tinyint, c5 float, c6 double, c7 bool, c8 binary(16),c9 nchar(32), c10 timestamp) - ''' - ) - - for i in range(5): - tdSql.execute("create table sub_tb_{} using stb1 tags({})".format(i,i)) - tdSql.query("show stables") - tdSql.checkRows(1) - tdSql.query("show tables") - tdSql.checkRows(6) - - tdSql.query("show test.vgroups;") - vgroups_infos = {} # key is id: value is info list - for vgroup_info in tdSql.queryResult: - vgroup_id = vgroup_info[0] - tmp_list = [] - for role in vgroup_info[3:-4]: - if role in ['leader','follower']: - tmp_list.append(role) - vgroups_infos[vgroup_id]=tmp_list - - for k , v in vgroups_infos.items(): - if len(v) ==1 and v[0]=="leader": - tdLog.info(" === create database replica only 1 role leader check success of vgroup_id {} ======".format(k)) - else: - tdLog.exit(" === create database replica only 1 role leader check fail of vgroup_id {} ======".format(k)) - - def create_database(self, dbname, replica_num ,vgroup_nums ): - drop_db_sql = "drop database if exists {}".format(dbname) - create_db_sql = "create database {} replica {} vgroups {}".format(dbname,replica_num,vgroup_nums) - - tdLog.info(" ==== create database {} and insert rows begin =====".format(dbname)) - tdSql.execute(drop_db_sql) - tdSql.execute(create_db_sql) - tdSql.execute("use {}".format(dbname)) - - def create_stable_insert_datas(self,dbname ,stablename , tb_nums , row_nums): - tdSql.execute("use {}".format(dbname)) - tdSql.execute( - '''create table {} - (ts timestamp, c1 int, c2 bigint, c3 smallint, c4 tinyint, c5 float, c6 double, c7 bool, c8 binary(32),c9 nchar(32), c10 timestamp) - tags (t1 int) - '''.format(stablename) - ) - - for i in range(tb_nums): - sub_tbname = "sub_{}_{}".format(stablename,i) - tdSql.execute("create table {} using {} tags({})".format(sub_tbname, stablename ,i)) - # insert datas about new database - - for row_num in range(row_nums): - ts = self.ts + self.ts_step*row_num - tdSql.execute(f"insert into {sub_tbname} values ({ts}, {row_num} ,{row_num}, 10 ,1 ,{row_num} ,{row_num},true,'bin_{row_num}','nchar_{row_num}',now) ") - - tdLog.info(" ==== stable {} insert rows execute end =====".format(stablename)) - - def append_rows_of_exists_tables(self,dbname ,stablename , tbname , append_nums ): - - tdSql.execute("use {}".format(dbname)) - - for row_num in range(append_nums): - tdSql.execute(f"insert into {tbname} values (now, {row_num} ,{row_num}, 10 ,1 ,{row_num} ,{row_num},true,'bin_{row_num}','nchar_{row_num}',now) ") - # print(f"insert into {tbname} values (now, {row_num} ,{row_num}, 10 ,1 ,{row_num} ,{row_num},true,'bin_{row_num}','nchar_{row_num}',now) ") - tdLog.info(" ==== append new rows of table {} belongs to stable {} execute end =====".format(tbname,stablename)) - os.system("taos -s 'select count(*) from {}.{}';".format(dbname,stablename)) - - def check_insert_rows(self, dbname, stablename , tb_nums , row_nums, append_rows): - - tdSql.execute("use {}".format(dbname)) - - tdSql.query("select count(*) from {}.{}".format(dbname,stablename)) - - while not tdSql.queryResult: - time.sleep(0.1) - tdSql.query("select count(*) from {}.{}".format(dbname,stablename)) - - status_OK = self.mycheckData("select count(*) from {}.{}".format(dbname,stablename) ,0 , 0 , tb_nums*row_nums+append_rows) - - count = 0 - while not status_OK : - if count > self.try_check_times: - os.system("taos -s ' show {}.vgroups; '".format(dbname)) - tdLog.exit(" ==== check insert rows failed after {} try check {} times of database {}".format(count , self.try_check_times ,dbname)) - break - time.sleep(0.1) - tdSql.query("select count(*) from {}.{}".format(dbname,stablename)) - while not tdSql.queryResult: - time.sleep(0.1) - tdSql.query("select count(*) from {}.{}".format(dbname,stablename)) - status_OK = self.mycheckData("select count(*) from {}.{}".format(dbname,stablename) ,0 , 0 , tb_nums*row_nums+append_rows) - tdLog.info(" ==== check insert rows first failed , this is {}_th retry check rows of database {}".format(count , dbname)) - count += 1 - - - tdSql.query("select distinct tbname from {}.{}".format(dbname,stablename)) - while not tdSql.queryResult: - time.sleep(0.1) - tdSql.query("select distinct tbname from {}.{}".format(dbname,stablename)) - status_OK = self.mycheckRows("select distinct tbname from {}.{}".format(dbname,stablename) ,tb_nums) - count = 0 - while not status_OK : - if count > self.try_check_times: - os.system("taos -s ' show {}.vgroups;'".format(dbname)) - tdLog.exit(" ==== check insert rows failed after {} try check {} times of database {}".format(count , self.try_check_times ,dbname)) - break - time.sleep(0.1) - tdSql.query("select distinct tbname from {}.{}".format(dbname,stablename)) - while not tdSql.queryResult: - time.sleep(0.1) - tdSql.query("select distinct tbname from {}.{}".format(dbname,stablename)) - status_OK = self.mycheckRows("select distinct tbname from {}.{}".format(dbname,stablename) ,tb_nums) - tdLog.info(" ==== check insert tbnames first failed , this is {}_th retry check tbnames of database {}".format(count , dbname)) - count += 1 def _get_stop_dnode_id(self,dbname): newTdSql=tdCom.newTdSql() newTdSql.query("show {}.vgroups".format(dbname)) @@ -339,8 +213,8 @@ class TDTestCase: while status !="offline": time.sleep(0.1) status = _get_status() - # tdLog.info("==== stop dnode has not been stopped , endpoint is {}".format(self.stop_dnode)) - tdLog.info("==== stop_dnode has stopped , id is {}".format(self.stop_dnode_id)) + # tdLog.notice("==== stop dnode has not been stopped , endpoint is {}".format(self.stop_dnode)) + tdLog.notice("==== stop_dnode has stopped , id is {}".format(self.stop_dnode_id)) def wait_start_dnode_OK(self): @@ -361,8 +235,8 @@ class TDTestCase: while status !="ready": time.sleep(0.1) status = _get_status() - # tdLog.info("==== stop dnode has not been stopped , endpoint is {}".format(self.stop_dnode)) - tdLog.info("==== stop_dnode has restart , id is {}".format(self.stop_dnode_id)) + # tdLog.notice("==== stop dnode has not been stopped , endpoint is {}".format(self.stop_dnode)) + tdLog.notice("==== stop_dnode has restart , id is {}".format(self.stop_dnode_id)) def get_leader_infos(self ,dbname): @@ -389,166 +263,96 @@ class TDTestCase: if role==self.stop_dnode_id: if vgroup_info[ind+1] =="offline" and "leader" in vgroup_info: - tdLog.info(" === revote leader ok , leader is {} now ====".format(vgroup_info[list(vgroup_info).index("leader")-1])) + tdLog.notice(" === revote leader ok , leader is {} now ====".format(vgroup_info[list(vgroup_info).index("leader")-1])) check_status = True elif vgroup_info[ind+1] !="offline": - tdLog.info(" === dnode {} should be offline ".format(self.stop_dnode_id)) + tdLog.notice(" === dnode {} should be offline ".format(self.stop_dnode_id)) else: continue break return check_status - def sync_run_case(self): + def start_benchmark_inserts(self,dbname , json_file): + benchmark_build_path = self.getBuildPath() + '/build/bin/taosBenchmark' + tdLog.notice("==== start taosBenchmark insert datas of database {} ==== ".format(dbname)) + os.system(" {} -f {} >>/dev/null 2>&1 ".format(benchmark_build_path , json_file)) + + def stop_leader_when_Benchmark_inserts(self,dbname , total_rows , json_file ): # stop follower and insert datas , update tables and create new stables tdDnodes=cluster.dnodes - for loop in range(self.loop_restart_times): - db_name = "sync_db_{}".format(loop) - stablename = 'stable_{}'.format(loop) - self.create_database(dbname = db_name ,replica_num= self.replica , vgroup_nums= 1) - self.create_stable_insert_datas(dbname = db_name , stablename = stablename , tb_nums= 10 ,row_nums= 10 ) - self.stop_dnode_id = self._get_stop_dnode_id(db_name) - - # check rows of datas - - self.check_insert_rows(db_name ,stablename ,tb_nums=10 , row_nums= 10 ,append_rows=0) + tdSql.execute(" drop database if exists {} ".format(dbname)) + tdSql.execute(" create database {} replica {} vgroups {}".format(dbname , self.replica , self.vgroups)) + + # start insert datas using taosBenchmark ,expect insert 10000 rows + + self.current_thread = threading.Thread(target=self.start_benchmark_inserts, args=(dbname,json_file)) + self.current_thread.start() + tdSql.query(" show databases ") + + # make sure create database ok + while (tdSql.queryRows!=3): + time.sleep(0.5) + tdSql.query(" show databases ") - # get leader info before stop - before_leader_infos = self.get_leader_infos(db_name) + # # make sure create stable ok + tdSql.query(" show {}.stables ".format(dbname)) + while (tdSql.queryRows!=1): + time.sleep(0.5) + tdSql.query(" show {}.stables ".format(dbname)) - # begin stop dnode - - tdDnodes[self.stop_dnode_id-1].stoptaosd() + # stop leader of database when insert 10% rows + # os.system("taos -s 'show databases';") + tdSql.query(" select count(*) from {}.{} ".format(dbname,"stb1")) - self.wait_stop_dnode_OK() + while not tdSql.queryResult: + tdSql.query(" select count(*) from {}.{} ".format(dbname,"stb1")) + tdLog.debug(" === current insert {} rows in database {} === ".format(tdSql.queryResult[0][0] , dbname)) - # vote leaders check + while (tdSql.queryResult[0][0] < total_rows/10): + if tdSql.queryResult: + tdLog.debug(" === current insert {} rows in database {} === ".format(tdSql.queryResult[0][0] , dbname)) + time.sleep(0.01) + tdSql.query(" select count(*) from {}.{} ".format(dbname,"stb1")) + + tdLog.debug(" === database {} has write {} rows at least ====".format(dbname,total_rows/10)) - # get leader info after stop - after_leader_infos = self.get_leader_infos(db_name) - - revote_status = self.check_revote_leader_success(db_name ,before_leader_infos , after_leader_infos) + self.stop_dnode_id = self._get_stop_dnode_id(dbname) - # append rows of stablename when dnode stop make sure revote leaders + # prepare stop leader of database + before_leader_infos = self.get_leader_infos(dbname) + + tdDnodes[self.stop_dnode_id-1].stoptaosd() + # self.current_thread.join() + after_leader_infos = self.get_leader_infos(dbname) - while not revote_status: - after_leader_infos = self.get_leader_infos(db_name) - revote_status = self.check_revote_leader_success(db_name ,before_leader_infos , after_leader_infos) + start = time.time() + revote_status = self.check_revote_leader_success(dbname ,before_leader_infos , after_leader_infos) + while not revote_status: + after_leader_infos = self.get_leader_infos(dbname) + revote_status = self.check_revote_leader_success(dbname ,before_leader_infos , after_leader_infos) + end = time.time() + time_cost = end - start + tdLog.debug(" ==== revote leader of database {} cost time {} ====".format(dbname , time_cost)) + self.current_thread.join() - if revote_status: - tbname = "sub_{}_{}".format(stablename , 0) - tdLog.info(" ==== begin append rows of exists table {} when dnode {} offline ====".format(tbname , self.stop_dnode_id)) - self.append_rows_of_exists_tables(db_name ,stablename , tbname , 100 ) - tdLog.info(" ==== check append rows of exists table {} when dnode {} offline ====".format(tbname , self.stop_dnode_id)) - self.check_insert_rows(db_name ,stablename ,tb_nums=10 , row_nums= 10 ,append_rows=100) + tdDnodes[self.stop_dnode_id-1].starttaosd() + self.wait_start_dnode_OK() - # create new stables - tdLog.info(" ==== create new stable {} when dnode {} offline ====".format('new_stb1' , self.stop_dnode_id)) - self.create_stable_insert_datas(dbname = db_name , stablename = 'new_stb1' , tb_nums= 10 ,row_nums= 10 ) - tdLog.info(" ==== check new stable {} when dnode {} offline ====".format('new_stb1' , self.stop_dnode_id)) - self.check_insert_rows(db_name ,'new_stb1' ,tb_nums=10 , row_nums= 10 ,append_rows=0) - else: - tdLog.info("===== leader of database {} is not ok , append rows fail =====".format(db_name)) + tdSql.query(" select count(*) from {}.{} ".format(dbname,"stb1")) + tdLog.debug(" ==== expected insert {} rows of database {} , really is {}".format(total_rows, dbname , tdSql.queryResult[0][0])) - # begin start dnode - start = time.time() - tdDnodes[self.stop_dnode_id-1].starttaosd() - self.wait_start_dnode_OK() - end = time.time() - time_cost = int(end -start) - if time_cost > self.max_restart_time: - tdLog.exit(" ==== restart dnode {} cost too much time , please check ====".format(self.stop_dnode_id)) - - # create new stables again - tdLog.info(" ==== create new stable {} when dnode {} restart ====".format('new_stb2' , self.stop_dnode_id)) - self.create_stable_insert_datas(dbname = db_name , stablename = 'new_stb2' , tb_nums= 10 ,row_nums= 10 ) - tdLog.info(" ==== check new stable {} when dnode {} restart ====".format('new_stb2' , self.stop_dnode_id)) - self.check_insert_rows(db_name ,'new_stb2' ,tb_nums=10 , row_nums= 10 ,append_rows=0) - - def unsync_run_case(self): - - def _restart_dnode_of_db_unsync(dbname): - - tdDnodes=cluster.dnodes - self.stop_dnode_id = self._get_stop_dnode_id(dbname) - # begin restart dnode - - tdDnodes[self.stop_dnode_id-1].stoptaosd() - - tbname = "sub_{}_{}".format(stablename , 0) - tdLog.info(" ==== begin append rows of exists table {} when dnode {} offline ====".format(tbname , self.stop_dnode_id)) - self.append_rows_of_exists_tables(db_name ,stablename , tbname , 100 ) - tdLog.info(" ==== check append rows of exists table {} when dnode {} offline ====".format(tbname , self.stop_dnode_id)) - self.check_insert_rows(db_name ,stablename ,tb_nums=10 , row_nums= 10 ,append_rows=100) - - # create new stables - tdLog.info(" ==== create new stable {} when dnode {} offline ====".format('new_stb1' , self.stop_dnode_id)) - self.create_stable_insert_datas(dbname = db_name , stablename = 'new_stb1' , tb_nums= 10 ,row_nums= 10 ) - tdLog.info(" ==== check new stable {} when dnode {} offline ====".format('new_stb1' , self.stop_dnode_id)) - self.check_insert_rows(db_name ,'new_stb1' ,tb_nums=10 , row_nums= 10 ,append_rows=0) - - # create new stables again - tdLog.info(" ==== create new stable {} when dnode {} restart ====".format('new_stb2' , self.stop_dnode_id)) - self.create_stable_insert_datas(dbname = db_name , stablename = 'new_stb2' , tb_nums= 10 ,row_nums= 10 ) - tdLog.info(" ==== check new stable {} when dnode {} restart ====".format('new_stb2' , self.stop_dnode_id)) - self.check_insert_rows(db_name ,'new_stb2' ,tb_nums=10 , row_nums= 10 ,append_rows=0) - - # # get leader info before stop - # before_leader_infos = self.get_leader_infos(db_name) - # self.wait_stop_dnode_OK() - - # check revote leader when restart servers - # # get leader info after stop - # after_leader_infos = self.get_leader_infos(db_name) - # revote_status = self.check_revote_leader_success(db_name ,before_leader_infos , after_leader_infos) - # # append rows of stablename when dnode stop make sure revote leaders - # while not revote_status: - # after_leader_infos = self.get_leader_infos(db_name) - # revote_status = self.check_revote_leader_success(db_name ,before_leader_infos , after_leader_infos) - tdDnodes[self.stop_dnode_id-1].starttaosd() - start = time.time() - self.wait_start_dnode_OK() - end = time.time() - time_cost = int(end-start) - - if time_cost > self.max_restart_time: - tdLog.exit(" ==== restart dnode {} cost too much time , please check ====".format(self.stop_dnode_id)) - - - def _create_threading(dbname): - self.current_thread = threading.Thread(target=_restart_dnode_of_db_unsync, args=(dbname,)) - return self.current_thread - - - ''' - in this mode , it will be extra threading control start or stop dnode , insert will always going with not care follower online or alive - ''' - for loop in range(self.loop_restart_times): - db_name = "unsync_db_{}".format(loop) - stablename = 'stable_{}'.format(loop) - self.create_database(dbname = db_name ,replica_num= self.replica , vgroup_nums= 1) - self.create_stable_insert_datas(dbname = db_name , stablename = stablename , tb_nums= 10 ,row_nums= 10 ) - - tdLog.info(" ===== restart dnode of database {} in an unsync threading ===== ".format(db_name)) - - # create sync threading and start it - self.current_thread = _create_threading(db_name) - self.current_thread.start() - - # check rows of datas - self.check_insert_rows(db_name ,stablename ,tb_nums=10 , row_nums= 10 ,append_rows=0) - - - self.current_thread.join() def run(self): # basic insert and check of cluster - self.check_setup_cluster_status() - self.create_db_check_vgroups() - self.sync_run_case() - # self.unsync_run_case() + # self.check_setup_cluster_status() + json = os.path.dirname(__file__) + '/insert_10W_rows.json' + self.stop_leader_when_Benchmark_inserts('db_1' , 100000 ,json) + # tdLog.notice( " ===== start insert 100W rows ==== ") + # json = os.path.dirname(__file__) + '/insert_100W_rows.json' + # self.stop_leader_when_Benchmark_inserts('db_2' , 1000000 ,json) def stop(self): tdSql.close() diff --git a/tests/system-test/6-cluster/vnode/4dnode1mnode_basic_replica3_insertdatas_stop_leader_forece_stop.py b/tests/system-test/6-cluster/vnode/4dnode1mnode_basic_replica3_insertdatas_stop_leader_forece_stop.py index d6edfda770..c19a308f1c 100644 --- a/tests/system-test/6-cluster/vnode/4dnode1mnode_basic_replica3_insertdatas_stop_leader_forece_stop.py +++ b/tests/system-test/6-cluster/vnode/4dnode1mnode_basic_replica3_insertdatas_stop_leader_forece_stop.py @@ -114,9 +114,9 @@ class TDTestCase: elif isinstance(data, str): tdLog.info("sql:%s, row:%d col:%d data:%s == expect:%s" % (sql, row, col, tdSql.queryResult[row][col], data)) - elif isinstance(data, datetime.date): - tdLog.info("sql:%s, row:%d col:%d data:%s == expect:%s" % - (sql, row, col, tdSql.queryResult[row][col], data)) + # elif isinstance(data, datetime.date): + # tdLog.info("sql:%s, row:%d col:%d data:%s == expect:%s" % + # (sql, row, col, tdSql.queryResult[row][col], data)) elif isinstance(data, float): tdLog.info("sql:%s, row:%d col:%d data:%s == expect:%s" % (sql, row, col, tdSql.queryResult[row][col], data)) @@ -163,14 +163,14 @@ class TDTestCase: is_leader=True if count==1 and is_leader: - tdLog.info("===== depoly cluster success with 1 mnode as leader =====") + tdLog.notice("===== depoly cluster success with 1 mnode as leader =====") else: tdLog.exit("===== depoly cluster fail with 1 mnode as leader =====") for k ,v in self.dnode_list.items(): if k == mnode_name: if v[3]==0: - tdLog.info("===== depoly cluster mnode only success at {} , support_vnodes is {} ".format(mnode_name,v[3])) + tdLog.notice("===== depoly cluster mnode only success at {} , support_vnodes is {} ".format(mnode_name,v[3])) else: tdLog.exit("===== depoly cluster mnode only fail at {} , support_vnodes is {} ".format(mnode_name,v[3])) else: @@ -213,7 +213,7 @@ class TDTestCase: for k , v in vgroups_infos.items(): if len(v) ==1 and v[0]=="leader": - tdLog.info(" === create database replica only 1 role leader check success of vgroup_id {} ======".format(k)) + tdLog.notice(" === create database replica only 1 role leader check success of vgroup_id {} ======".format(k)) else: tdLog.exit(" === create database replica only 1 role leader check fail of vgroup_id {} ======".format(k)) @@ -221,7 +221,7 @@ class TDTestCase: drop_db_sql = "drop database if exists {}".format(dbname) create_db_sql = "create database {} replica {} vgroups {}".format(dbname,replica_num,vgroup_nums) - tdLog.info(" ==== create database {} and insert rows begin =====".format(dbname)) + tdLog.notice(" ==== create database {} and insert rows begin =====".format(dbname)) tdSql.execute(drop_db_sql) tdSql.execute(create_db_sql) tdSql.execute("use {}".format(dbname)) @@ -244,7 +244,7 @@ class TDTestCase: ts = self.ts + self.ts_step*row_num tdSql.execute(f"insert into {sub_tbname} values ({ts}, {row_num} ,{row_num}, 10 ,1 ,{row_num} ,{row_num},true,'bin_{row_num}','nchar_{row_num}',now) ") - tdLog.info(" ==== stable {} insert rows execute end =====".format(stablename)) + tdLog.notice(" ==== stable {} insert rows execute end =====".format(stablename)) def append_rows_of_exists_tables(self,dbname ,stablename , tbname , append_nums ): @@ -253,7 +253,7 @@ class TDTestCase: for row_num in range(append_nums): tdSql.execute(f"insert into {tbname} values (now, {row_num} ,{row_num}, 10 ,1 ,{row_num} ,{row_num},true,'bin_{row_num}','nchar_{row_num}',now) ") # print(f"insert into {tbname} values (now, {row_num} ,{row_num}, 10 ,1 ,{row_num} ,{row_num},true,'bin_{row_num}','nchar_{row_num}',now) ") - tdLog.info(" ==== append new rows of table {} belongs to stable {} execute end =====".format(tbname,stablename)) + tdLog.notice(" ==== append new rows of table {} belongs to stable {} execute end =====".format(tbname,stablename)) os.system("taos -s 'select count(*) from {}.{}';".format(dbname,stablename)) def check_insert_rows(self, dbname, stablename , tb_nums , row_nums, append_rows): @@ -280,7 +280,7 @@ class TDTestCase: time.sleep(0.1) tdSql.query("select count(*) from {}.{}".format(dbname,stablename)) status_OK = self.mycheckData("select count(*) from {}.{}".format(dbname,stablename) ,0 , 0 , tb_nums*row_nums+append_rows) - tdLog.info(" ==== check insert rows first failed , this is {}_th retry check rows of database {}".format(count , dbname)) + tdLog.notice(" ==== check insert rows first failed , this is {}_th retry check rows of database {} ====".format(count , dbname)) count += 1 @@ -301,7 +301,7 @@ class TDTestCase: time.sleep(0.1) tdSql.query("select distinct tbname from {}.{}".format(dbname,stablename)) status_OK = self.mycheckRows("select distinct tbname from {}.{}".format(dbname,stablename) ,tb_nums) - tdLog.info(" ==== check insert tbnames first failed , this is {}_th retry check tbnames of database {}".format(count , dbname)) + tdLog.notice(" ==== check insert tbnames first failed , this is {}_th retry check tbnames of database {}".format(count , dbname)) count += 1 def _get_stop_dnode_id(self,dbname): @@ -340,8 +340,8 @@ class TDTestCase: while status !="offline": time.sleep(0.1) status = _get_status() - # tdLog.info("==== stop dnode has not been stopped , endpoint is {}".format(self.stop_dnode)) - tdLog.info("==== stop_dnode has stopped , id is {}".format(self.stop_dnode_id)) + # tdLog.notice("==== stop dnode has not been stopped , endpoint is {}".format(self.stop_dnode)) + tdLog.notice("==== stop_dnode has stopped , id is {}".format(self.stop_dnode_id)) def wait_start_dnode_OK(self): @@ -362,8 +362,8 @@ class TDTestCase: while status !="ready": time.sleep(0.1) status = _get_status() - # tdLog.info("==== stop dnode has not been stopped , endpoint is {}".format(self.stop_dnode)) - tdLog.info("==== stop_dnode has restart , id is {}".format(self.stop_dnode_id)) + # tdLog.notice("==== stop dnode has not been stopped , endpoint is {}".format(self.stop_dnode)) + tdLog.notice("==== stop_dnode has restart , id is {}".format(self.stop_dnode_id)) def get_leader_infos(self ,dbname): @@ -390,10 +390,10 @@ class TDTestCase: if role==self.stop_dnode_id: if vgroup_info[ind+1] =="offline" and "leader" in vgroup_info: - tdLog.info(" === revote leader ok , leader is {} now ====".format(vgroup_info[list(vgroup_info).index("leader")-1])) + tdLog.notice(" === revote leader ok , leader is {} now ====".format(vgroup_info[list(vgroup_info).index("leader")-1])) check_status = True elif vgroup_info[ind+1] !="offline": - tdLog.info(" === dnode {} should be offline ".format(self.stop_dnode_id)) + tdLog.notice(" === dnode {} should be offline ".format(self.stop_dnode_id)) else: continue break @@ -410,7 +410,7 @@ class TDTestCase: else: continue if port: - tdLog.info(" ==== dnode {} will be force stop by kill -9 ====".format(dnode_id)) + tdLog.notice(" ==== dnode {} will be force stop by kill -9 ====".format(dnode_id)) psCmd = '''netstat -anp|grep -w LISTEN|grep -w %s |grep -o "LISTEN.*"|awk '{print $2}'|cut -d/ -f1|head -n1''' %(port) processID = subprocess.check_output( psCmd, shell=True).decode("utf-8") @@ -457,18 +457,18 @@ class TDTestCase: if revote_status: tbname = "sub_{}_{}".format(stablename , 0) - tdLog.info(" ==== begin append rows of exists table {} when dnode {} offline ====".format(tbname , self.stop_dnode_id)) + tdLog.notice(" ==== begin append rows of exists table {} when dnode {} offline ====".format(tbname , self.stop_dnode_id)) self.append_rows_of_exists_tables(db_name ,stablename , tbname , 100 ) - tdLog.info(" ==== check append rows of exists table {} when dnode {} offline ====".format(tbname , self.stop_dnode_id)) + tdLog.notice(" ==== check append rows of exists table {} when dnode {} offline ====".format(tbname , self.stop_dnode_id)) self.check_insert_rows(db_name ,stablename ,tb_nums=10 , row_nums= 10 ,append_rows=100) # create new stables - tdLog.info(" ==== create new stable {} when dnode {} offline ====".format('new_stb1' , self.stop_dnode_id)) + tdLog.notice(" ==== create new stable {} when dnode {} offline ====".format('new_stb1' , self.stop_dnode_id)) self.create_stable_insert_datas(dbname = db_name , stablename = 'new_stb1' , tb_nums= 10 ,row_nums= 10 ) - tdLog.info(" ==== check new stable {} when dnode {} offline ====".format('new_stb1' , self.stop_dnode_id)) + tdLog.notice(" ==== check new stable {} when dnode {} offline ====".format('new_stb1' , self.stop_dnode_id)) self.check_insert_rows(db_name ,'new_stb1' ,tb_nums=10 , row_nums= 10 ,append_rows=0) else: - tdLog.info("===== leader of database {} is not ok , append rows fail =====".format(db_name)) + tdLog.notice("===== leader of database {} is not ok , append rows fail =====".format(db_name)) # begin start dnode start = time.time() @@ -480,9 +480,9 @@ class TDTestCase: tdLog.exit(" ==== restart dnode {} cost too much time , please check ====".format(self.stop_dnode_id)) # create new stables again - tdLog.info(" ==== create new stable {} when dnode {} restart ====".format('new_stb2' , self.stop_dnode_id)) + tdLog.notice(" ==== create new stable {} when dnode {} restart ====".format('new_stb2' , self.stop_dnode_id)) self.create_stable_insert_datas(dbname = db_name , stablename = 'new_stb2' , tb_nums= 10 ,row_nums= 10 ) - tdLog.info(" ==== check new stable {} when dnode {} restart ====".format('new_stb2' , self.stop_dnode_id)) + tdLog.notice(" ==== check new stable {} when dnode {} restart ====".format('new_stb2' , self.stop_dnode_id)) self.check_insert_rows(db_name ,'new_stb2' ,tb_nums=10 , row_nums= 10 ,append_rows=0) def unsync_run_case(self): @@ -509,21 +509,21 @@ class TDTestCase: revote_status = self.check_revote_leader_success(db_name ,before_leader_infos , after_leader_infos) tbname = "sub_{}_{}".format(stablename , 0) - tdLog.info(" ==== begin append rows of exists table {} when dnode {} offline ====".format(tbname , self.stop_dnode_id)) + tdLog.notice(" ==== begin append rows of exists table {} when dnode {} offline ====".format(tbname , self.stop_dnode_id)) self.append_rows_of_exists_tables(db_name ,stablename , tbname , 100 ) - tdLog.info(" ==== check append rows of exists table {} when dnode {} offline ====".format(tbname , self.stop_dnode_id)) + tdLog.notice(" ==== check append rows of exists table {} when dnode {} offline ====".format(tbname , self.stop_dnode_id)) self.check_insert_rows(db_name ,stablename ,tb_nums=10 , row_nums= 10 ,append_rows=100) # create new stables - tdLog.info(" ==== create new stable {} when dnode {} offline ====".format('new_stb1' , self.stop_dnode_id)) + tdLog.notice(" ==== create new stable {} when dnode {} offline ====".format('new_stb1' , self.stop_dnode_id)) self.create_stable_insert_datas(dbname = db_name , stablename = 'new_stb1' , tb_nums= 10 ,row_nums= 10 ) - tdLog.info(" ==== check new stable {} when dnode {} offline ====".format('new_stb1' , self.stop_dnode_id)) + tdLog.notice(" ==== check new stable {} when dnode {} offline ====".format('new_stb1' , self.stop_dnode_id)) self.check_insert_rows(db_name ,'new_stb1' ,tb_nums=10 , row_nums= 10 ,append_rows=0) # create new stables again - tdLog.info(" ==== create new stable {} when dnode {} restart ====".format('new_stb2' , self.stop_dnode_id)) + tdLog.notice(" ==== create new stable {} when dnode {} restart ====".format('new_stb2' , self.stop_dnode_id)) self.create_stable_insert_datas(dbname = db_name , stablename = 'new_stb2' , tb_nums= 10 ,row_nums= 10 ) - tdLog.info(" ==== check new stable {} when dnode {} restart ====".format('new_stb2' , self.stop_dnode_id)) + tdLog.notice(" ==== check new stable {} when dnode {} restart ====".format('new_stb2' , self.stop_dnode_id)) self.check_insert_rows(db_name ,'new_stb2' ,tb_nums=10 , row_nums= 10 ,append_rows=0) @@ -551,7 +551,7 @@ class TDTestCase: self.create_database(dbname = db_name ,replica_num= self.replica , vgroup_nums= 1) self.create_stable_insert_datas(dbname = db_name , stablename = stablename , tb_nums= 10 ,row_nums= 10 ) - tdLog.info(" ===== restart dnode of database {} in an unsync threading ===== ".format(db_name)) + tdLog.notice(" ===== restart dnode of database {} in an unsync threading ===== ".format(db_name)) # create sync threading and start it self.current_thread = _create_threading(db_name) diff --git a/tests/system-test/6-cluster/vnode/4dnode1mnode_basic_replica3_querydatas_stop_follower.py b/tests/system-test/6-cluster/vnode/4dnode1mnode_basic_replica3_querydatas_stop_follower.py new file mode 100644 index 0000000000..2bfe544749 --- /dev/null +++ b/tests/system-test/6-cluster/vnode/4dnode1mnode_basic_replica3_querydatas_stop_follower.py @@ -0,0 +1,416 @@ +# author : wenzhouwww +from ssl import ALERT_DESCRIPTION_CERTIFICATE_UNOBTAINABLE +import taos +import sys +import time +import os + +from util.log import * +from util.sql import * +from util.cases import * +from util.dnodes import TDDnodes +from util.dnodes import TDDnode +from util.cluster import * + +import datetime +import inspect +import time +import socket +import subprocess +import threading +sys.path.append(os.path.dirname(__file__)) + +class TDTestCase: + def init(self,conn ,logSql): + tdLog.debug(f"start to excute {__file__}") + tdSql.init(conn.cursor()) + self.host = socket.gethostname() + self.mnode_list = {} + self.dnode_list = {} + self.ts = 1483200000000 + self.ts_step =1000 + self.db_name ='testdb' + self.replica = 3 + self.vgroups = 1 + self.tb_nums = 10 + self.row_nums = 100 + self.stop_dnode_id = None + self.loop_restart_times = 5 + self.thread_list = [] + self.max_restart_time = 10 + self.try_check_times = 10 + self.query_times = 100 + + + def getBuildPath(self): + selfPath = os.path.dirname(os.path.realpath(__file__)) + if ("community" in selfPath): + projPath = selfPath[:selfPath.find("community")] + else: + projPath = selfPath[:selfPath.find("tests")] + + for root, dirs, files in os.walk(projPath): + if ("taosd" in files): + rootRealPath = os.path.dirname(os.path.realpath(root)) + if ("packaging" not in rootRealPath): + buildPath = root[:len(root) - len("/build/bin")] + break + return buildPath + + def check_setup_cluster_status(self): + tdSql.query("show mnodes") + for mnode in tdSql.queryResult: + name = mnode[1] + info = mnode + self.mnode_list[name] = info + + tdSql.query("show dnodes") + for dnode in tdSql.queryResult: + name = dnode[1] + info = dnode + self.dnode_list[name] = info + + count = 0 + is_leader = False + mnode_name = '' + for k,v in self.mnode_list.items(): + count +=1 + # only for 1 mnode + mnode_name = k + + if v[2] =='leader': + is_leader=True + + if count==1 and is_leader: + tdLog.notice("===== depoly cluster success with 1 mnode as leader =====") + else: + tdLog.exit("===== depoly cluster fail with 1 mnode as leader =====") + + for k ,v in self.dnode_list.items(): + if k == mnode_name: + if v[3]==0: + tdLog.notice("===== depoly cluster mnode only success at {} , support_vnodes is {} ".format(mnode_name,v[3])) + else: + tdLog.exit("===== depoly cluster mnode only fail at {} , support_vnodes is {} ".format(mnode_name,v[3])) + else: + continue + + def create_database(self, dbname, replica_num ,vgroup_nums ): + drop_db_sql = "drop database if exists {}".format(dbname) + create_db_sql = "create database {} replica {} vgroups {}".format(dbname,replica_num,vgroup_nums) + + tdLog.notice(" ==== create database {} and insert rows begin =====".format(dbname)) + tdSql.execute(drop_db_sql) + tdSql.execute(create_db_sql) + tdSql.execute("use {}".format(dbname)) + + def create_stable_insert_datas(self,dbname ,stablename , tb_nums , row_nums): + tdSql.execute("use {}".format(dbname)) + tdSql.execute( + '''create table {} + (ts timestamp, c1 int, c2 bigint, c3 smallint, c4 tinyint, c5 float, c6 double, c7 bool, c8 binary(32),c9 nchar(32), c10 timestamp) + tags (t1 int) + '''.format(stablename) + ) + + for i in range(tb_nums): + sub_tbname = "sub_{}_{}".format(stablename,i) + tdSql.execute("create table {} using {} tags({})".format(sub_tbname, stablename ,i)) + # insert datas about new database + + for row_num in range(row_nums): + ts = self.ts + self.ts_step*row_num + tdSql.execute(f"insert into {sub_tbname} values ({ts}, {row_num} ,{row_num}, 10 ,1 ,{row_num} ,{row_num},true,'bin_{row_num}','nchar_{row_num}',now) ") + + tdLog.notice(" ==== stable {} insert rows execute end =====".format(stablename)) + + def append_rows_of_exists_tables(self,dbname ,stablename , tbname , append_nums ): + + tdSql.execute("use {}".format(dbname)) + + for row_num in range(append_nums): + tdSql.execute(f"insert into {tbname} values (now, {row_num} ,{row_num}, 10 ,1 ,{row_num} ,{row_num},true,'bin_{row_num}','nchar_{row_num}',now) ") + # print(f"insert into {tbname} values (now, {row_num} ,{row_num}, 10 ,1 ,{row_num} ,{row_num},true,'bin_{row_num}','nchar_{row_num}',now) ") + tdLog.notice(" ==== append new rows of table {} belongs to stable {} execute end =====".format(tbname,stablename)) + os.system("taos -s 'select count(*) from {}.{}';".format(dbname,stablename)) + + def check_insert_rows(self, dbname, stablename , tb_nums , row_nums, append_rows): + + tdSql.execute("use {}".format(dbname)) + + tdSql.query("select count(*) from {}.{}".format(dbname,stablename)) + + while not tdSql.queryResult: + time.sleep(0.1) + tdSql.query("select count(*) from {}.{}".format(dbname,stablename)) + + status_OK = self.mycheckData("select count(*) from {}.{}".format(dbname,stablename) ,0 , 0 , tb_nums*row_nums+append_rows) + + count = 0 + while not status_OK : + if count > self.try_check_times: + os.system("taos -s ' show {}.vgroups; '".format(dbname)) + tdLog.exit(" ==== check insert rows failed after {} try check {} times of database {}".format(count , self.try_check_times ,dbname)) + break + time.sleep(0.1) + tdSql.query("select count(*) from {}.{}".format(dbname,stablename)) + while not tdSql.queryResult: + time.sleep(0.1) + tdSql.query("select count(*) from {}.{}".format(dbname,stablename)) + status_OK = self.mycheckData("select count(*) from {}.{}".format(dbname,stablename) ,0 , 0 , tb_nums*row_nums+append_rows) + tdLog.notice(" ==== check insert rows first failed , this is {}_th retry check rows of database {}".format(count , dbname)) + count += 1 + + + tdSql.query("select distinct tbname from {}.{}".format(dbname,stablename)) + while not tdSql.queryResult: + time.sleep(0.1) + tdSql.query("select distinct tbname from {}.{}".format(dbname,stablename)) + status_OK = self.mycheckRows("select distinct tbname from {}.{}".format(dbname,stablename) ,tb_nums) + count = 0 + while not status_OK : + if count > self.try_check_times: + os.system("taos -s ' show {}.vgroups;'".format(dbname)) + tdLog.exit(" ==== check insert rows failed after {} try check {} times of database {}".format(count , self.try_check_times ,dbname)) + break + time.sleep(0.1) + tdSql.query("select distinct tbname from {}.{}".format(dbname,stablename)) + while not tdSql.queryResult: + time.sleep(0.1) + tdSql.query("select distinct tbname from {}.{}".format(dbname,stablename)) + status_OK = self.mycheckRows("select distinct tbname from {}.{}".format(dbname,stablename) ,tb_nums) + tdLog.notice(" ==== check insert tbnames first failed , this is {}_th retry check tbnames of database {}".format(count , dbname)) + count += 1 + + def _get_stop_dnode_id(self,dbname): + tdSql.query("show {}.vgroups".format(dbname)) + vgroup_infos = tdSql.queryResult + for vgroup_info in vgroup_infos: + leader_infos = vgroup_info[3:-4] + # print(vgroup_info) + for ind ,role in enumerate(leader_infos): + if role =='follower': + # print(ind,leader_infos) + self.stop_dnode_id = leader_infos[ind-1] + break + + + return self.stop_dnode_id + + def wait_stop_dnode_OK(self): + + def _get_status(): + newTdSql=tdCom.newTdSql() + + status = "" + newTdSql.query("show dnodes") + dnode_infos = newTdSql.queryResult + for dnode_info in dnode_infos: + id = dnode_info[0] + dnode_status = dnode_info[4] + if id == self.stop_dnode_id: + status = dnode_status + break + return status + + status = _get_status() + while status !="offline": + time.sleep(0.1) + status = _get_status() + # tdLog.notice("==== stop dnode has not been stopped , endpoint is {}".format(self.stop_dnode)) + tdLog.notice("==== stop_dnode has stopped , id is {}".format(self.stop_dnode_id)) + + def wait_start_dnode_OK(self): + + def _get_status(): + newTdSql=tdCom.newTdSql() + status = "" + newTdSql.query("show dnodes") + dnode_infos = newTdSql.queryResult + for dnode_info in dnode_infos: + id = dnode_info[0] + dnode_status = dnode_info[4] + if id == self.stop_dnode_id: + status = dnode_status + break + return status + + status = _get_status() + while status !="ready": + time.sleep(0.1) + status = _get_status() + # tdLog.notice("==== stop dnode has not been stopped , endpoint is {}".format(self.stop_dnode)) + tdLog.notice("==== stop_dnode has restart , id is {}".format(self.stop_dnode_id)) + + def _parse_datetime(self,timestr): + try: + return datetime.datetime.strptime(timestr, '%Y-%m-%d %H:%M:%S.%f') + except ValueError: + pass + try: + return datetime.datetime.strptime(timestr, '%Y-%m-%d %H:%M:%S') + except ValueError: + pass + + def mycheckRowCol(self, sql, row, col): + caller = inspect.getframeinfo(inspect.stack()[2][0]) + if row < 0: + args = (caller.filename, caller.lineno, sql, row) + tdLog.exit("%s(%d) failed: sql:%s, row:%d is smaller than zero" % args) + if col < 0: + args = (caller.filename, caller.lineno, sql, row) + tdLog.exit("%s(%d) failed: sql:%s, col:%d is smaller than zero" % args) + if row > tdSql.queryRows: + args = (caller.filename, caller.lineno, sql, row, tdSql.queryRows) + tdLog.exit("%s(%d) failed: sql:%s, row:%d is larger than queryRows:%d" % args) + if col > tdSql.queryCols: + args = (caller.filename, caller.lineno, sql, col, tdSql.queryCols) + tdLog.exit("%s(%d) failed: sql:%s, col:%d is larger than queryCols:%d" % args) + + def mycheckData(self, sql ,row, col, data): + check_status = True + self.mycheckRowCol(sql ,row, col) + if tdSql.queryResult[row][col] != data: + if tdSql.cursor.istype(col, "TIMESTAMP"): + # suppose user want to check nanosecond timestamp if a longer data passed + if (len(data) >= 28): + if pd.to_datetime(tdSql.queryResult[row][col]) == pd.to_datetime(data): + tdLog.info("sql:%s, row:%d col:%d data:%d == expect:%s" % + (sql, row, col, tdSql.queryResult[row][col], data)) + else: + if tdSql.queryResult[row][col] == self._parse_datetime(data): + tdLog.info("sql:%s, row:%d col:%d data:%s == expect:%s" % + (sql, row, col, tdSql.queryResult[row][col], data)) + return + + if str(tdSql.queryResult[row][col]) == str(data): + tdLog.info("sql:%s, row:%d col:%d data:%s == expect:%s" % + (sql, row, col, tdSql.queryResult[row][col], data)) + return + elif isinstance(data, float) and abs(tdSql.queryResult[row][col] - data) <= 0.000001: + tdLog.info("sql:%s, row:%d col:%d data:%f == expect:%f" % + (sql, row, col, tdSql.queryResult[row][col], data)) + return + else: + caller = inspect.getframeinfo(inspect.stack()[1][0]) + args = (caller.filename, caller.lineno, sql, row, col, tdSql.queryResult[row][col], data) + tdLog.info("%s(%d) failed: sql:%s row:%d col:%d data:%s != expect:%s" % args) + + check_status = False + + if data is None: + tdLog.info("sql:%s, row:%d col:%d data:%s == expect:%s" % + (sql, row, col, tdSql.queryResult[row][col], data)) + elif isinstance(data, str): + tdLog.info("sql:%s, row:%d col:%d data:%s == expect:%s" % + (sql, row, col, tdSql.queryResult[row][col], data)) + # elif isinstance(data, datetime.date): + # tdLog.info("sql:%s, row:%d col:%d data:%s == expect:%s" % + # (sql, row, col, tdSql.queryResult[row][col], data)) + elif isinstance(data, float): + tdLog.info("sql:%s, row:%d col:%d data:%s == expect:%s" % + (sql, row, col, tdSql.queryResult[row][col], data)) + else: + tdLog.info("sql:%s, row:%d col:%d data:%s == expect:%d" % + (sql, row, col, tdSql.queryResult[row][col], data)) + + return check_status + + def mycheckRows(self, sql, expectRows): + check_status = True + if len(tdSql.queryResult) == expectRows: + tdLog.info("sql:%s, queryRows:%d == expect:%d" % (sql, len(tdSql.queryResult), expectRows)) + return True + else: + caller = inspect.getframeinfo(inspect.stack()[1][0]) + args = (caller.filename, caller.lineno, sql, len(tdSql.queryResult), expectRows) + tdLog.info("%s(%d) failed: sql:%s, queryRows:%d != expect:%d" % args) + check_status = False + return check_status + + + def force_stop_dnode(self, dnode_id ): + + tdSql.query("show dnodes") + port = None + for dnode_info in tdSql.queryResult: + if dnode_id == dnode_info[0]: + port = dnode_info[1].split(":")[-1] + break + else: + continue + if port: + tdLog.notice(" ==== dnode {} will be force stop by kill -9 ====".format(dnode_id)) + psCmd = '''netstat -anp|grep -w LISTEN|grep -w %s |grep -o "LISTEN.*"|awk '{print $2}'|cut -d/ -f1|head -n1''' %(port) + processID = subprocess.check_output( + psCmd, shell=True).decode("utf-8") + ps_kill_taosd = ''' kill -9 {} '''.format(processID) + # print(ps_kill_taosd) + os.system(ps_kill_taosd) + + def basic_query_task(self,dbname ,stablename): + + sql = "select * from {}.{} ;".format(dbname , stablename) + + count = 0 + while count < self.query_times: + os.system(''' taos -s '{}' >>/dev/null '''.format(sql)) + count += 1 + + def multi_thread_query_task(self, thread_nums ,dbname , stablename ): + + for i in range(thread_nums): + task = threading.Thread(target = self.basic_query_task, args=(dbname ,stablename)) + self.thread_list.append(task) + + for thread in self.thread_list: + + thread.start() + return self.thread_list + + + def stop_follower_when_query_going(self): + + tdDnodes = cluster.dnodes + self.create_database(dbname = self.db_name ,replica_num= self.replica , vgroup_nums= 1) + self.create_stable_insert_datas(dbname = self.db_name , stablename = "stb1" , tb_nums= self.tb_nums ,row_nums= self.row_nums) + + # let query task start + self.thread_list = self.multi_thread_query_task(10 ,self.db_name ,'stb1' ) + + # force stop follower + for loop in range(self.loop_restart_times): + tdLog.debug(" ==== this is {}_th restart follower of database {} ==== ".format(loop ,self.db_name)) + self.stop_dnode_id = self._get_stop_dnode_id(self.db_name) + tdDnodes[self.stop_dnode_id-1].stoptaosd() + self.wait_stop_dnode_OK() + + start = time.time() + tdDnodes[self.stop_dnode_id-1].starttaosd() + self.wait_start_dnode_OK() + end = time.time() + time_cost = int(end-start) + + if time_cost > self.max_restart_time: + tdLog.exit(" ==== restart dnode {} cost too much time , please check ====".format(self.stop_dnode_id)) + + for thread in self.thread_list: + thread.join() + + + def run(self): + + # basic check of cluster + self.check_setup_cluster_status() + self.stop_follower_when_query_going() + + + + + + def stop(self): + tdSql.close() + tdLog.success(f"{__file__} successfully executed") + +tdCases.addLinux(__file__, TDTestCase()) +tdCases.addWindows(__file__, TDTestCase()) \ No newline at end of file diff --git a/tests/system-test/6-cluster/vnode/4dnode1mnode_basic_replica3_querydatas_stop_follower_force_stop.py b/tests/system-test/6-cluster/vnode/4dnode1mnode_basic_replica3_querydatas_stop_follower_force_stop.py new file mode 100644 index 0000000000..2a4e43d904 --- /dev/null +++ b/tests/system-test/6-cluster/vnode/4dnode1mnode_basic_replica3_querydatas_stop_follower_force_stop.py @@ -0,0 +1,416 @@ +# author : wenzhouwww +from ssl import ALERT_DESCRIPTION_CERTIFICATE_UNOBTAINABLE +import taos +import sys +import time +import os + +from util.log import * +from util.sql import * +from util.cases import * +from util.dnodes import TDDnodes +from util.dnodes import TDDnode +from util.cluster import * + +import datetime +import inspect +import time +import socket +import subprocess +import threading +sys.path.append(os.path.dirname(__file__)) + +class TDTestCase: + def init(self,conn ,logSql): + tdLog.debug(f"start to excute {__file__}") + tdSql.init(conn.cursor()) + self.host = socket.gethostname() + self.mnode_list = {} + self.dnode_list = {} + self.ts = 1483200000000 + self.ts_step =1000 + self.db_name ='testdb' + self.replica = 3 + self.vgroups = 1 + self.tb_nums = 10 + self.row_nums = 100 + self.stop_dnode_id = None + self.loop_restart_times = 5 + self.thread_list = [] + self.max_restart_time = 10 + self.try_check_times = 10 + self.query_times = 100 + + + def getBuildPath(self): + selfPath = os.path.dirname(os.path.realpath(__file__)) + if ("community" in selfPath): + projPath = selfPath[:selfPath.find("community")] + else: + projPath = selfPath[:selfPath.find("tests")] + + for root, dirs, files in os.walk(projPath): + if ("taosd" in files): + rootRealPath = os.path.dirname(os.path.realpath(root)) + if ("packaging" not in rootRealPath): + buildPath = root[:len(root) - len("/build/bin")] + break + return buildPath + + def check_setup_cluster_status(self): + tdSql.query("show mnodes") + for mnode in tdSql.queryResult: + name = mnode[1] + info = mnode + self.mnode_list[name] = info + + tdSql.query("show dnodes") + for dnode in tdSql.queryResult: + name = dnode[1] + info = dnode + self.dnode_list[name] = info + + count = 0 + is_leader = False + mnode_name = '' + for k,v in self.mnode_list.items(): + count +=1 + # only for 1 mnode + mnode_name = k + + if v[2] =='leader': + is_leader=True + + if count==1 and is_leader: + tdLog.notice("===== depoly cluster success with 1 mnode as leader =====") + else: + tdLog.exit("===== depoly cluster fail with 1 mnode as leader =====") + + for k ,v in self.dnode_list.items(): + if k == mnode_name: + if v[3]==0: + tdLog.notice("===== depoly cluster mnode only success at {} , support_vnodes is {} ".format(mnode_name,v[3])) + else: + tdLog.exit("===== depoly cluster mnode only fail at {} , support_vnodes is {} ".format(mnode_name,v[3])) + else: + continue + + def create_database(self, dbname, replica_num ,vgroup_nums ): + drop_db_sql = "drop database if exists {}".format(dbname) + create_db_sql = "create database {} replica {} vgroups {}".format(dbname,replica_num,vgroup_nums) + + tdLog.notice(" ==== create database {} and insert rows begin =====".format(dbname)) + tdSql.execute(drop_db_sql) + tdSql.execute(create_db_sql) + tdSql.execute("use {}".format(dbname)) + + def create_stable_insert_datas(self,dbname ,stablename , tb_nums , row_nums): + tdSql.execute("use {}".format(dbname)) + tdSql.execute( + '''create table {} + (ts timestamp, c1 int, c2 bigint, c3 smallint, c4 tinyint, c5 float, c6 double, c7 bool, c8 binary(32),c9 nchar(32), c10 timestamp) + tags (t1 int) + '''.format(stablename) + ) + + for i in range(tb_nums): + sub_tbname = "sub_{}_{}".format(stablename,i) + tdSql.execute("create table {} using {} tags({})".format(sub_tbname, stablename ,i)) + # insert datas about new database + + for row_num in range(row_nums): + ts = self.ts + self.ts_step*row_num + tdSql.execute(f"insert into {sub_tbname} values ({ts}, {row_num} ,{row_num}, 10 ,1 ,{row_num} ,{row_num},true,'bin_{row_num}','nchar_{row_num}',now) ") + + tdLog.notice(" ==== stable {} insert rows execute end =====".format(stablename)) + + def append_rows_of_exists_tables(self,dbname ,stablename , tbname , append_nums ): + + tdSql.execute("use {}".format(dbname)) + + for row_num in range(append_nums): + tdSql.execute(f"insert into {tbname} values (now, {row_num} ,{row_num}, 10 ,1 ,{row_num} ,{row_num},true,'bin_{row_num}','nchar_{row_num}',now) ") + # print(f"insert into {tbname} values (now, {row_num} ,{row_num}, 10 ,1 ,{row_num} ,{row_num},true,'bin_{row_num}','nchar_{row_num}',now) ") + tdLog.notice(" ==== append new rows of table {} belongs to stable {} execute end =====".format(tbname,stablename)) + os.system("taos -s 'select count(*) from {}.{}';".format(dbname,stablename)) + + def check_insert_rows(self, dbname, stablename , tb_nums , row_nums, append_rows): + + tdSql.execute("use {}".format(dbname)) + + tdSql.query("select count(*) from {}.{}".format(dbname,stablename)) + + while not tdSql.queryResult: + time.sleep(0.1) + tdSql.query("select count(*) from {}.{}".format(dbname,stablename)) + + status_OK = self.mycheckData("select count(*) from {}.{}".format(dbname,stablename) ,0 , 0 , tb_nums*row_nums+append_rows) + + count = 0 + while not status_OK : + if count > self.try_check_times: + os.system("taos -s ' show {}.vgroups; '".format(dbname)) + tdLog.exit(" ==== check insert rows failed after {} try check {} times of database {}".format(count , self.try_check_times ,dbname)) + break + time.sleep(0.1) + tdSql.query("select count(*) from {}.{}".format(dbname,stablename)) + while not tdSql.queryResult: + time.sleep(0.1) + tdSql.query("select count(*) from {}.{}".format(dbname,stablename)) + status_OK = self.mycheckData("select count(*) from {}.{}".format(dbname,stablename) ,0 , 0 , tb_nums*row_nums+append_rows) + tdLog.notice(" ==== check insert rows first failed , this is {}_th retry check rows of database {}".format(count , dbname)) + count += 1 + + + tdSql.query("select distinct tbname from {}.{}".format(dbname,stablename)) + while not tdSql.queryResult: + time.sleep(0.1) + tdSql.query("select distinct tbname from {}.{}".format(dbname,stablename)) + status_OK = self.mycheckRows("select distinct tbname from {}.{}".format(dbname,stablename) ,tb_nums) + count = 0 + while not status_OK : + if count > self.try_check_times: + os.system("taos -s ' show {}.vgroups;'".format(dbname)) + tdLog.exit(" ==== check insert rows failed after {} try check {} times of database {}".format(count , self.try_check_times ,dbname)) + break + time.sleep(0.1) + tdSql.query("select distinct tbname from {}.{}".format(dbname,stablename)) + while not tdSql.queryResult: + time.sleep(0.1) + tdSql.query("select distinct tbname from {}.{}".format(dbname,stablename)) + status_OK = self.mycheckRows("select distinct tbname from {}.{}".format(dbname,stablename) ,tb_nums) + tdLog.notice(" ==== check insert tbnames first failed , this is {}_th retry check tbnames of database {}".format(count , dbname)) + count += 1 + + def _get_stop_dnode_id(self,dbname): + tdSql.query("show {}.vgroups".format(dbname)) + vgroup_infos = tdSql.queryResult + for vgroup_info in vgroup_infos: + leader_infos = vgroup_info[3:-4] + # print(vgroup_info) + for ind ,role in enumerate(leader_infos): + if role =='follower': + # print(ind,leader_infos) + self.stop_dnode_id = leader_infos[ind-1] + break + + + return self.stop_dnode_id + + def wait_stop_dnode_OK(self): + + def _get_status(): + newTdSql=tdCom.newTdSql() + + status = "" + newTdSql.query("show dnodes") + dnode_infos = newTdSql.queryResult + for dnode_info in dnode_infos: + id = dnode_info[0] + dnode_status = dnode_info[4] + if id == self.stop_dnode_id: + status = dnode_status + break + return status + + status = _get_status() + while status !="offline": + time.sleep(0.1) + status = _get_status() + # tdLog.notice("==== stop dnode has not been stopped , endpoint is {}".format(self.stop_dnode)) + tdLog.notice("==== stop_dnode has stopped , id is {}".format(self.stop_dnode_id)) + + def wait_start_dnode_OK(self): + + def _get_status(): + newTdSql=tdCom.newTdSql() + status = "" + newTdSql.query("show dnodes") + dnode_infos = newTdSql.queryResult + for dnode_info in dnode_infos: + id = dnode_info[0] + dnode_status = dnode_info[4] + if id == self.stop_dnode_id: + status = dnode_status + break + return status + + status = _get_status() + while status !="ready": + time.sleep(0.1) + status = _get_status() + # tdLog.notice("==== stop dnode has not been stopped , endpoint is {}".format(self.stop_dnode)) + tdLog.notice("==== stop_dnode has restart , id is {}".format(self.stop_dnode_id)) + + def _parse_datetime(self,timestr): + try: + return datetime.datetime.strptime(timestr, '%Y-%m-%d %H:%M:%S.%f') + except ValueError: + pass + try: + return datetime.datetime.strptime(timestr, '%Y-%m-%d %H:%M:%S') + except ValueError: + pass + + def mycheckRowCol(self, sql, row, col): + caller = inspect.getframeinfo(inspect.stack()[2][0]) + if row < 0: + args = (caller.filename, caller.lineno, sql, row) + tdLog.exit("%s(%d) failed: sql:%s, row:%d is smaller than zero" % args) + if col < 0: + args = (caller.filename, caller.lineno, sql, row) + tdLog.exit("%s(%d) failed: sql:%s, col:%d is smaller than zero" % args) + if row > tdSql.queryRows: + args = (caller.filename, caller.lineno, sql, row, tdSql.queryRows) + tdLog.exit("%s(%d) failed: sql:%s, row:%d is larger than queryRows:%d" % args) + if col > tdSql.queryCols: + args = (caller.filename, caller.lineno, sql, col, tdSql.queryCols) + tdLog.exit("%s(%d) failed: sql:%s, col:%d is larger than queryCols:%d" % args) + + def mycheckData(self, sql ,row, col, data): + check_status = True + self.mycheckRowCol(sql ,row, col) + if tdSql.queryResult[row][col] != data: + if tdSql.cursor.istype(col, "TIMESTAMP"): + # suppose user want to check nanosecond timestamp if a longer data passed + if (len(data) >= 28): + if pd.to_datetime(tdSql.queryResult[row][col]) == pd.to_datetime(data): + tdLog.info("sql:%s, row:%d col:%d data:%d == expect:%s" % + (sql, row, col, tdSql.queryResult[row][col], data)) + else: + if tdSql.queryResult[row][col] == self._parse_datetime(data): + tdLog.info("sql:%s, row:%d col:%d data:%s == expect:%s" % + (sql, row, col, tdSql.queryResult[row][col], data)) + return + + if str(tdSql.queryResult[row][col]) == str(data): + tdLog.info("sql:%s, row:%d col:%d data:%s == expect:%s" % + (sql, row, col, tdSql.queryResult[row][col], data)) + return + elif isinstance(data, float) and abs(tdSql.queryResult[row][col] - data) <= 0.000001: + tdLog.info("sql:%s, row:%d col:%d data:%f == expect:%f" % + (sql, row, col, tdSql.queryResult[row][col], data)) + return + else: + caller = inspect.getframeinfo(inspect.stack()[1][0]) + args = (caller.filename, caller.lineno, sql, row, col, tdSql.queryResult[row][col], data) + tdLog.info("%s(%d) failed: sql:%s row:%d col:%d data:%s != expect:%s" % args) + + check_status = False + + if data is None: + tdLog.info("sql:%s, row:%d col:%d data:%s == expect:%s" % + (sql, row, col, tdSql.queryResult[row][col], data)) + elif isinstance(data, str): + tdLog.info("sql:%s, row:%d col:%d data:%s == expect:%s" % + (sql, row, col, tdSql.queryResult[row][col], data)) + # elif isinstance(data, datetime.date): + # tdLog.info("sql:%s, row:%d col:%d data:%s == expect:%s" % + # (sql, row, col, tdSql.queryResult[row][col], data)) + elif isinstance(data, float): + tdLog.info("sql:%s, row:%d col:%d data:%s == expect:%s" % + (sql, row, col, tdSql.queryResult[row][col], data)) + else: + tdLog.info("sql:%s, row:%d col:%d data:%s == expect:%d" % + (sql, row, col, tdSql.queryResult[row][col], data)) + + return check_status + + def mycheckRows(self, sql, expectRows): + check_status = True + if len(tdSql.queryResult) == expectRows: + tdLog.info("sql:%s, queryRows:%d == expect:%d" % (sql, len(tdSql.queryResult), expectRows)) + return True + else: + caller = inspect.getframeinfo(inspect.stack()[1][0]) + args = (caller.filename, caller.lineno, sql, len(tdSql.queryResult), expectRows) + tdLog.info("%s(%d) failed: sql:%s, queryRows:%d != expect:%d" % args) + check_status = False + return check_status + + + def force_stop_dnode(self, dnode_id ): + + tdSql.query("show dnodes") + port = None + for dnode_info in tdSql.queryResult: + if dnode_id == dnode_info[0]: + port = dnode_info[1].split(":")[-1] + break + else: + continue + if port: + tdLog.notice(" ==== dnode {} will be force stop by kill -9 ====".format(dnode_id)) + psCmd = '''netstat -anp|grep -w LISTEN|grep -w %s |grep -o "LISTEN.*"|awk '{print $2}'|cut -d/ -f1|head -n1''' %(port) + processID = subprocess.check_output( + psCmd, shell=True).decode("utf-8") + ps_kill_taosd = ''' kill -9 {} '''.format(processID) + # print(ps_kill_taosd) + os.system(ps_kill_taosd) + + def basic_query_task(self,dbname ,stablename): + + sql = "select * from {}.{} ;".format(dbname , stablename) + + count = 0 + while count < self.query_times: + os.system(''' taos -s '{}' >>/dev/null '''.format(sql)) + count += 1 + + def multi_thread_query_task(self, thread_nums ,dbname , stablename ): + + for i in range(thread_nums): + task = threading.Thread(target = self.basic_query_task, args=(dbname ,stablename)) + self.thread_list.append(task) + + for thread in self.thread_list: + + thread.start() + return self.thread_list + + + def stop_follower_when_query_going(self): + + tdDnodes = cluster.dnodes + self.create_database(dbname = self.db_name ,replica_num= self.replica , vgroup_nums= 1) + self.create_stable_insert_datas(dbname = self.db_name , stablename = "stb1" , tb_nums= self.tb_nums ,row_nums= self.row_nums) + + # let query task start + self.thread_list = self.multi_thread_query_task(10 ,self.db_name ,'stb1' ) + + # force stop follower + for loop in range(self.loop_restart_times): + tdLog.debug(" ==== this is {}_th restart follower of database {} ==== ".format(loop ,self.db_name)) + self.stop_dnode_id = self._get_stop_dnode_id(self.db_name) + self.force_stop_dnode(self.stop_dnode_id) + self.wait_stop_dnode_OK() + + start = time.time() + tdDnodes[self.stop_dnode_id-1].starttaosd() + self.wait_start_dnode_OK() + end = time.time() + time_cost = int(end-start) + + if time_cost > self.max_restart_time: + tdLog.exit(" ==== restart dnode {} cost too much time , please check ====".format(self.stop_dnode_id)) + + for thread in self.thread_list: + thread.join() + + + def run(self): + + # basic check of cluster + self.check_setup_cluster_status() + self.stop_follower_when_query_going() + + + + + + def stop(self): + tdSql.close() + tdLog.success(f"{__file__} successfully executed") + +tdCases.addLinux(__file__, TDTestCase()) +tdCases.addWindows(__file__, TDTestCase()) \ No newline at end of file diff --git a/tests/system-test/6-cluster/vnode/4dnode1mnode_basic_replica3_querydatas_stop_leader.py b/tests/system-test/6-cluster/vnode/4dnode1mnode_basic_replica3_querydatas_stop_leader.py new file mode 100644 index 0000000000..41606946f6 --- /dev/null +++ b/tests/system-test/6-cluster/vnode/4dnode1mnode_basic_replica3_querydatas_stop_leader.py @@ -0,0 +1,470 @@ +# author : wenzhouwww +from ssl import ALERT_DESCRIPTION_CERTIFICATE_UNOBTAINABLE +import taos +import sys +import time +import os + +from util.log import * +from util.sql import * +from util.cases import * +from util.dnodes import TDDnodes +from util.dnodes import TDDnode +from util.cluster import * + +import datetime +import inspect +import time +import socket +import subprocess +import threading +sys.path.append(os.path.dirname(__file__)) + +class TDTestCase: + def init(self,conn ,logSql): + tdLog.debug(f"start to excute {__file__}") + tdSql.init(conn.cursor()) + self.host = socket.gethostname() + self.mnode_list = {} + self.dnode_list = {} + self.ts = 1483200000000 + self.ts_step =1000 + self.db_name ='testdb' + self.replica = 3 + self.vgroups = 1 + self.tb_nums = 10 + self.row_nums = 100 + self.stop_dnode_id = None + self.loop_restart_times = 5 + self.thread_list = [] + self.max_restart_time = 10 + self.try_check_times = 10 + self.query_times = 100 + + + def getBuildPath(self): + selfPath = os.path.dirname(os.path.realpath(__file__)) + if ("community" in selfPath): + projPath = selfPath[:selfPath.find("community")] + else: + projPath = selfPath[:selfPath.find("tests")] + + for root, dirs, files in os.walk(projPath): + if ("taosd" in files): + rootRealPath = os.path.dirname(os.path.realpath(root)) + if ("packaging" not in rootRealPath): + buildPath = root[:len(root) - len("/build/bin")] + break + return buildPath + + def check_setup_cluster_status(self): + tdSql.query("show mnodes") + for mnode in tdSql.queryResult: + name = mnode[1] + info = mnode + self.mnode_list[name] = info + + tdSql.query("show dnodes") + for dnode in tdSql.queryResult: + name = dnode[1] + info = dnode + self.dnode_list[name] = info + + count = 0 + is_leader = False + mnode_name = '' + for k,v in self.mnode_list.items(): + count +=1 + # only for 1 mnode + mnode_name = k + + if v[2] =='leader': + is_leader=True + + if count==1 and is_leader: + tdLog.notice("===== depoly cluster success with 1 mnode as leader =====") + else: + tdLog.exit("===== depoly cluster fail with 1 mnode as leader =====") + + for k ,v in self.dnode_list.items(): + if k == mnode_name: + if v[3]==0: + tdLog.notice("===== depoly cluster mnode only success at {} , support_vnodes is {} ".format(mnode_name,v[3])) + else: + tdLog.exit("===== depoly cluster mnode only fail at {} , support_vnodes is {} ".format(mnode_name,v[3])) + else: + continue + + def create_database(self, dbname, replica_num ,vgroup_nums ): + drop_db_sql = "drop database if exists {}".format(dbname) + create_db_sql = "create database {} replica {} vgroups {}".format(dbname,replica_num,vgroup_nums) + + tdLog.notice(" ==== create database {} and insert rows begin =====".format(dbname)) + tdSql.execute(drop_db_sql) + tdSql.execute(create_db_sql) + tdSql.execute("use {}".format(dbname)) + + def create_stable_insert_datas(self,dbname ,stablename , tb_nums , row_nums): + tdSql.execute("use {}".format(dbname)) + tdSql.execute( + '''create table {} + (ts timestamp, c1 int, c2 bigint, c3 smallint, c4 tinyint, c5 float, c6 double, c7 bool, c8 binary(32),c9 nchar(32), c10 timestamp) + tags (t1 int) + '''.format(stablename) + ) + + for i in range(tb_nums): + sub_tbname = "sub_{}_{}".format(stablename,i) + tdSql.execute("create table {} using {} tags({})".format(sub_tbname, stablename ,i)) + # insert datas about new database + + for row_num in range(row_nums): + ts = self.ts + self.ts_step*row_num + tdSql.execute(f"insert into {sub_tbname} values ({ts}, {row_num} ,{row_num}, 10 ,1 ,{row_num} ,{row_num},true,'bin_{row_num}','nchar_{row_num}',now) ") + + tdLog.notice(" ==== stable {} insert rows execute end =====".format(stablename)) + + def append_rows_of_exists_tables(self,dbname ,stablename , tbname , append_nums ): + + tdSql.execute("use {}".format(dbname)) + + for row_num in range(append_nums): + tdSql.execute(f"insert into {tbname} values (now, {row_num} ,{row_num}, 10 ,1 ,{row_num} ,{row_num},true,'bin_{row_num}','nchar_{row_num}',now) ") + # print(f"insert into {tbname} values (now, {row_num} ,{row_num}, 10 ,1 ,{row_num} ,{row_num},true,'bin_{row_num}','nchar_{row_num}',now) ") + tdLog.notice(" ==== append new rows of table {} belongs to stable {} execute end =====".format(tbname,stablename)) + os.system("taos -s 'select count(*) from {}.{}';".format(dbname,stablename)) + + def check_insert_rows(self, dbname, stablename , tb_nums , row_nums, append_rows): + + tdSql.execute("use {}".format(dbname)) + + tdSql.query("select count(*) from {}.{}".format(dbname,stablename)) + + while not tdSql.queryResult: + time.sleep(0.1) + tdSql.query("select count(*) from {}.{}".format(dbname,stablename)) + + status_OK = self.mycheckData("select count(*) from {}.{}".format(dbname,stablename) ,0 , 0 , tb_nums*row_nums+append_rows) + + count = 0 + while not status_OK : + if count > self.try_check_times: + os.system("taos -s ' show {}.vgroups; '".format(dbname)) + tdLog.exit(" ==== check insert rows failed after {} try check {} times of database {}".format(count , self.try_check_times ,dbname)) + break + time.sleep(0.1) + tdSql.query("select count(*) from {}.{}".format(dbname,stablename)) + while not tdSql.queryResult: + time.sleep(0.1) + tdSql.query("select count(*) from {}.{}".format(dbname,stablename)) + status_OK = self.mycheckData("select count(*) from {}.{}".format(dbname,stablename) ,0 , 0 , tb_nums*row_nums+append_rows) + tdLog.notice(" ==== check insert rows first failed , this is {}_th retry check rows of database {}".format(count , dbname)) + count += 1 + + + tdSql.query("select distinct tbname from {}.{}".format(dbname,stablename)) + while not tdSql.queryResult: + time.sleep(0.1) + tdSql.query("select distinct tbname from {}.{}".format(dbname,stablename)) + status_OK = self.mycheckRows("select distinct tbname from {}.{}".format(dbname,stablename) ,tb_nums) + count = 0 + while not status_OK : + if count > self.try_check_times: + os.system("taos -s ' show {}.vgroups;'".format(dbname)) + tdLog.exit(" ==== check insert rows failed after {} try check {} times of database {}".format(count , self.try_check_times ,dbname)) + break + time.sleep(0.1) + tdSql.query("select distinct tbname from {}.{}".format(dbname,stablename)) + while not tdSql.queryResult: + time.sleep(0.1) + tdSql.query("select distinct tbname from {}.{}".format(dbname,stablename)) + status_OK = self.mycheckRows("select distinct tbname from {}.{}".format(dbname,stablename) ,tb_nums) + tdLog.notice(" ==== check insert tbnames first failed , this is {}_th retry check tbnames of database {}".format(count , dbname)) + count += 1 + + def _get_stop_dnode_id(self,dbname): + tdSql.query("show {}.vgroups".format(dbname)) + vgroup_infos = tdSql.queryResult + for vgroup_info in vgroup_infos: + leader_infos = vgroup_info[3:-4] + # print(vgroup_info) + for ind ,role in enumerate(leader_infos): + if role =='leader': + # print(ind,leader_infos) + self.stop_dnode_id = leader_infos[ind-1] + break + + + return self.stop_dnode_id + + def wait_stop_dnode_OK(self): + + def _get_status(): + newTdSql=tdCom.newTdSql() + + status = "" + newTdSql.query("show dnodes") + dnode_infos = newTdSql.queryResult + for dnode_info in dnode_infos: + id = dnode_info[0] + dnode_status = dnode_info[4] + if id == self.stop_dnode_id: + status = dnode_status + break + return status + + status = _get_status() + while status !="offline": + time.sleep(0.1) + status = _get_status() + # tdLog.notice("==== stop dnode has not been stopped , endpoint is {}".format(self.stop_dnode)) + tdLog.notice("==== stop_dnode has stopped , id is {}".format(self.stop_dnode_id)) + + def check_revote_leader_success(self, dbname, before_leader_infos , after_leader_infos): + check_status = False + vote_act = set(set(after_leader_infos)-set(before_leader_infos)) + if not vote_act: + print("=======before_revote_leader_infos ======\n" , before_leader_infos) + print("=======after_revote_leader_infos ======\n" , after_leader_infos) + tdLog.info(" ===maybe revote not occured , there is no dnode offline ====") + else: + for vgroup_info in vote_act: + for ind , role in enumerate(vgroup_info): + if role==self.stop_dnode_id: + + if vgroup_info[ind+1] =="offline" and "leader" in vgroup_info: + tdLog.notice(" === revote leader ok , leader is {} now ====".format(vgroup_info[list(vgroup_info).index("leader")-1])) + check_status = True + elif vgroup_info[ind+1] !="offline": + tdLog.notice(" === dnode {} should be offline ".format(self.stop_dnode_id)) + else: + continue + break + return check_status + + def wait_start_dnode_OK(self): + + def _get_status(): + newTdSql=tdCom.newTdSql() + status = "" + newTdSql.query("show dnodes") + dnode_infos = newTdSql.queryResult + for dnode_info in dnode_infos: + id = dnode_info[0] + dnode_status = dnode_info[4] + if id == self.stop_dnode_id: + status = dnode_status + break + return status + + status = _get_status() + while status !="ready": + time.sleep(0.1) + status = _get_status() + # tdLog.notice("==== stop dnode has not been stopped , endpoint is {}".format(self.stop_dnode)) + tdLog.notice("==== stop_dnode has restart , id is {}".format(self.stop_dnode_id)) + + def _parse_datetime(self,timestr): + try: + return datetime.datetime.strptime(timestr, '%Y-%m-%d %H:%M:%S.%f') + except ValueError: + pass + try: + return datetime.datetime.strptime(timestr, '%Y-%m-%d %H:%M:%S') + except ValueError: + pass + + def mycheckRowCol(self, sql, row, col): + caller = inspect.getframeinfo(inspect.stack()[2][0]) + if row < 0: + args = (caller.filename, caller.lineno, sql, row) + tdLog.exit("%s(%d) failed: sql:%s, row:%d is smaller than zero" % args) + if col < 0: + args = (caller.filename, caller.lineno, sql, row) + tdLog.exit("%s(%d) failed: sql:%s, col:%d is smaller than zero" % args) + if row > tdSql.queryRows: + args = (caller.filename, caller.lineno, sql, row, tdSql.queryRows) + tdLog.exit("%s(%d) failed: sql:%s, row:%d is larger than queryRows:%d" % args) + if col > tdSql.queryCols: + args = (caller.filename, caller.lineno, sql, col, tdSql.queryCols) + tdLog.exit("%s(%d) failed: sql:%s, col:%d is larger than queryCols:%d" % args) + + def mycheckData(self, sql ,row, col, data): + check_status = True + self.mycheckRowCol(sql ,row, col) + if tdSql.queryResult[row][col] != data: + if tdSql.cursor.istype(col, "TIMESTAMP"): + # suppose user want to check nanosecond timestamp if a longer data passed + if (len(data) >= 28): + if pd.to_datetime(tdSql.queryResult[row][col]) == pd.to_datetime(data): + tdLog.info("sql:%s, row:%d col:%d data:%d == expect:%s" % + (sql, row, col, tdSql.queryResult[row][col], data)) + else: + if tdSql.queryResult[row][col] == self._parse_datetime(data): + tdLog.info("sql:%s, row:%d col:%d data:%s == expect:%s" % + (sql, row, col, tdSql.queryResult[row][col], data)) + return + + if str(tdSql.queryResult[row][col]) == str(data): + tdLog.info("sql:%s, row:%d col:%d data:%s == expect:%s" % + (sql, row, col, tdSql.queryResult[row][col], data)) + return + elif isinstance(data, float) and abs(tdSql.queryResult[row][col] - data) <= 0.000001: + tdLog.info("sql:%s, row:%d col:%d data:%f == expect:%f" % + (sql, row, col, tdSql.queryResult[row][col], data)) + return + else: + caller = inspect.getframeinfo(inspect.stack()[1][0]) + args = (caller.filename, caller.lineno, sql, row, col, tdSql.queryResult[row][col], data) + tdLog.info("%s(%d) failed: sql:%s row:%d col:%d data:%s != expect:%s" % args) + + check_status = False + + if data is None: + tdLog.info("sql:%s, row:%d col:%d data:%s == expect:%s" % + (sql, row, col, tdSql.queryResult[row][col], data)) + elif isinstance(data, str): + tdLog.info("sql:%s, row:%d col:%d data:%s == expect:%s" % + (sql, row, col, tdSql.queryResult[row][col], data)) + # elif isinstance(data, datetime.date): + # tdLog.info("sql:%s, row:%d col:%d data:%s == expect:%s" % + # (sql, row, col, tdSql.queryResult[row][col], data)) + elif isinstance(data, float): + tdLog.info("sql:%s, row:%d col:%d data:%s == expect:%s" % + (sql, row, col, tdSql.queryResult[row][col], data)) + else: + tdLog.info("sql:%s, row:%d col:%d data:%s == expect:%d" % + (sql, row, col, tdSql.queryResult[row][col], data)) + + return check_status + + def mycheckRows(self, sql, expectRows): + check_status = True + if len(tdSql.queryResult) == expectRows: + tdLog.info("sql:%s, queryRows:%d == expect:%d" % (sql, len(tdSql.queryResult), expectRows)) + return True + else: + caller = inspect.getframeinfo(inspect.stack()[1][0]) + args = (caller.filename, caller.lineno, sql, len(tdSql.queryResult), expectRows) + tdLog.info("%s(%d) failed: sql:%s, queryRows:%d != expect:%d" % args) + check_status = False + return check_status + + + def get_leader_infos(self ,dbname): + + newTdSql=tdCom.newTdSql() + newTdSql.query("show {}.vgroups".format(dbname)) + vgroup_infos = newTdSql.queryResult + + leader_infos = set() + for vgroup_info in vgroup_infos: + leader_infos.add(vgroup_info[3:-4]) + + return leader_infos + + def force_stop_dnode(self, dnode_id ): + + tdSql.query("show dnodes") + port = None + for dnode_info in tdSql.queryResult: + if dnode_id == dnode_info[0]: + port = dnode_info[1].split(":")[-1] + break + else: + continue + if port: + tdLog.notice(" ==== dnode {} will be force stop by kill -9 ====".format(dnode_id)) + psCmd = '''netstat -anp|grep -w LISTEN|grep -w %s |grep -o "LISTEN.*"|awk '{print $2}'|cut -d/ -f1|head -n1''' %(port) + processID = subprocess.check_output( + psCmd, shell=True).decode("utf-8") + ps_kill_taosd = ''' kill -9 {} '''.format(processID) + # print(ps_kill_taosd) + os.system(ps_kill_taosd) + + def basic_query_task(self,dbname ,stablename): + + sql = "select * from {}.{} ;".format(dbname , stablename) + + count = 0 + while count < self.query_times: + os.system(''' taos -s '{}' >>/dev/null '''.format(sql)) + count += 1 + + def multi_thread_query_task(self, thread_nums ,dbname , stablename ): + + for i in range(thread_nums): + task = threading.Thread(target = self.basic_query_task, args=(dbname ,stablename)) + self.thread_list.append(task) + + for thread in self.thread_list: + + thread.start() + return self.thread_list + + + def stop_follower_when_query_going(self): + + tdDnodes = cluster.dnodes + self.create_database(dbname = self.db_name ,replica_num= self.replica , vgroup_nums= 1) + self.create_stable_insert_datas(dbname = self.db_name , stablename = "stb1" , tb_nums= self.tb_nums ,row_nums= self.row_nums) + + # let query task start + self.thread_list = self.multi_thread_query_task(10 ,self.db_name ,'stb1' ) + + # force stop follower + for loop in range(self.loop_restart_times): + tdLog.debug(" ==== this is {}_th restart follower of database {} ==== ".format(loop ,self.db_name)) + + # get leader info before stop + before_leader_infos = self.get_leader_infos(self.db_name) + + self.stop_dnode_id = self._get_stop_dnode_id(self.db_name) + tdDnodes[self.stop_dnode_id-1].stoptaosd() + + + start = time.time() + # get leader info after stop + after_leader_infos = self.get_leader_infos(self.db_name) + + revote_status = self.check_revote_leader_success(self.db_name ,before_leader_infos , after_leader_infos) + + while not revote_status: + after_leader_infos = self.get_leader_infos(self.db_name) + revote_status = self.check_revote_leader_success(self.db_name ,before_leader_infos , after_leader_infos) + + end = time.time() + time_cost = end - start + tdLog.debug(" ==== revote leader of database {} cost time {} ====".format(self.db_name , time_cost)) + + self.wait_stop_dnode_OK() + + start = time.time() + tdDnodes[self.stop_dnode_id-1].starttaosd() + self.wait_start_dnode_OK() + end = time.time() + time_cost = int(end-start) + + if time_cost > self.max_restart_time: + tdLog.exit(" ==== restart dnode {} cost too much time , please check ====".format(self.stop_dnode_id)) + + for thread in self.thread_list: + thread.join() + + + def run(self): + + # basic check of cluster + self.check_setup_cluster_status() + self.stop_follower_when_query_going() + + + + + + def stop(self): + tdSql.close() + tdLog.success(f"{__file__} successfully executed") + +tdCases.addLinux(__file__, TDTestCase()) +tdCases.addWindows(__file__, TDTestCase()) \ No newline at end of file diff --git a/tests/system-test/6-cluster/vnode/4dnode1mnode_basic_replica3_querydatas_stop_leader_force_stop.py b/tests/system-test/6-cluster/vnode/4dnode1mnode_basic_replica3_querydatas_stop_leader_force_stop.py new file mode 100644 index 0000000000..5ddcf1c70e --- /dev/null +++ b/tests/system-test/6-cluster/vnode/4dnode1mnode_basic_replica3_querydatas_stop_leader_force_stop.py @@ -0,0 +1,470 @@ +# author : wenzhouwww +from ssl import ALERT_DESCRIPTION_CERTIFICATE_UNOBTAINABLE +import taos +import sys +import time +import os + +from util.log import * +from util.sql import * +from util.cases import * +from util.dnodes import TDDnodes +from util.dnodes import TDDnode +from util.cluster import * + +import datetime +import inspect +import time +import socket +import subprocess +import threading +sys.path.append(os.path.dirname(__file__)) + +class TDTestCase: + def init(self,conn ,logSql): + tdLog.debug(f"start to excute {__file__}") + tdSql.init(conn.cursor()) + self.host = socket.gethostname() + self.mnode_list = {} + self.dnode_list = {} + self.ts = 1483200000000 + self.ts_step =1000 + self.db_name ='testdb' + self.replica = 3 + self.vgroups = 1 + self.tb_nums = 10 + self.row_nums = 100 + self.stop_dnode_id = None + self.loop_restart_times = 5 + self.thread_list = [] + self.max_restart_time = 10 + self.try_check_times = 10 + self.query_times = 100 + + + def getBuildPath(self): + selfPath = os.path.dirname(os.path.realpath(__file__)) + if ("community" in selfPath): + projPath = selfPath[:selfPath.find("community")] + else: + projPath = selfPath[:selfPath.find("tests")] + + for root, dirs, files in os.walk(projPath): + if ("taosd" in files): + rootRealPath = os.path.dirname(os.path.realpath(root)) + if ("packaging" not in rootRealPath): + buildPath = root[:len(root) - len("/build/bin")] + break + return buildPath + + def check_setup_cluster_status(self): + tdSql.query("show mnodes") + for mnode in tdSql.queryResult: + name = mnode[1] + info = mnode + self.mnode_list[name] = info + + tdSql.query("show dnodes") + for dnode in tdSql.queryResult: + name = dnode[1] + info = dnode + self.dnode_list[name] = info + + count = 0 + is_leader = False + mnode_name = '' + for k,v in self.mnode_list.items(): + count +=1 + # only for 1 mnode + mnode_name = k + + if v[2] =='leader': + is_leader=True + + if count==1 and is_leader: + tdLog.notice("===== depoly cluster success with 1 mnode as leader =====") + else: + tdLog.exit("===== depoly cluster fail with 1 mnode as leader =====") + + for k ,v in self.dnode_list.items(): + if k == mnode_name: + if v[3]==0: + tdLog.notice("===== depoly cluster mnode only success at {} , support_vnodes is {} ".format(mnode_name,v[3])) + else: + tdLog.exit("===== depoly cluster mnode only fail at {} , support_vnodes is {} ".format(mnode_name,v[3])) + else: + continue + + def create_database(self, dbname, replica_num ,vgroup_nums ): + drop_db_sql = "drop database if exists {}".format(dbname) + create_db_sql = "create database {} replica {} vgroups {}".format(dbname,replica_num,vgroup_nums) + + tdLog.notice(" ==== create database {} and insert rows begin =====".format(dbname)) + tdSql.execute(drop_db_sql) + tdSql.execute(create_db_sql) + tdSql.execute("use {}".format(dbname)) + + def create_stable_insert_datas(self,dbname ,stablename , tb_nums , row_nums): + tdSql.execute("use {}".format(dbname)) + tdSql.execute( + '''create table {} + (ts timestamp, c1 int, c2 bigint, c3 smallint, c4 tinyint, c5 float, c6 double, c7 bool, c8 binary(32),c9 nchar(32), c10 timestamp) + tags (t1 int) + '''.format(stablename) + ) + + for i in range(tb_nums): + sub_tbname = "sub_{}_{}".format(stablename,i) + tdSql.execute("create table {} using {} tags({})".format(sub_tbname, stablename ,i)) + # insert datas about new database + + for row_num in range(row_nums): + ts = self.ts + self.ts_step*row_num + tdSql.execute(f"insert into {sub_tbname} values ({ts}, {row_num} ,{row_num}, 10 ,1 ,{row_num} ,{row_num},true,'bin_{row_num}','nchar_{row_num}',now) ") + + tdLog.notice(" ==== stable {} insert rows execute end =====".format(stablename)) + + def append_rows_of_exists_tables(self,dbname ,stablename , tbname , append_nums ): + + tdSql.execute("use {}".format(dbname)) + + for row_num in range(append_nums): + tdSql.execute(f"insert into {tbname} values (now, {row_num} ,{row_num}, 10 ,1 ,{row_num} ,{row_num},true,'bin_{row_num}','nchar_{row_num}',now) ") + # print(f"insert into {tbname} values (now, {row_num} ,{row_num}, 10 ,1 ,{row_num} ,{row_num},true,'bin_{row_num}','nchar_{row_num}',now) ") + tdLog.notice(" ==== append new rows of table {} belongs to stable {} execute end =====".format(tbname,stablename)) + os.system("taos -s 'select count(*) from {}.{}';".format(dbname,stablename)) + + def check_insert_rows(self, dbname, stablename , tb_nums , row_nums, append_rows): + + tdSql.execute("use {}".format(dbname)) + + tdSql.query("select count(*) from {}.{}".format(dbname,stablename)) + + while not tdSql.queryResult: + time.sleep(0.1) + tdSql.query("select count(*) from {}.{}".format(dbname,stablename)) + + status_OK = self.mycheckData("select count(*) from {}.{}".format(dbname,stablename) ,0 , 0 , tb_nums*row_nums+append_rows) + + count = 0 + while not status_OK : + if count > self.try_check_times: + os.system("taos -s ' show {}.vgroups; '".format(dbname)) + tdLog.exit(" ==== check insert rows failed after {} try check {} times of database {}".format(count , self.try_check_times ,dbname)) + break + time.sleep(0.1) + tdSql.query("select count(*) from {}.{}".format(dbname,stablename)) + while not tdSql.queryResult: + time.sleep(0.1) + tdSql.query("select count(*) from {}.{}".format(dbname,stablename)) + status_OK = self.mycheckData("select count(*) from {}.{}".format(dbname,stablename) ,0 , 0 , tb_nums*row_nums+append_rows) + tdLog.notice(" ==== check insert rows first failed , this is {}_th retry check rows of database {}".format(count , dbname)) + count += 1 + + + tdSql.query("select distinct tbname from {}.{}".format(dbname,stablename)) + while not tdSql.queryResult: + time.sleep(0.1) + tdSql.query("select distinct tbname from {}.{}".format(dbname,stablename)) + status_OK = self.mycheckRows("select distinct tbname from {}.{}".format(dbname,stablename) ,tb_nums) + count = 0 + while not status_OK : + if count > self.try_check_times: + os.system("taos -s ' show {}.vgroups;'".format(dbname)) + tdLog.exit(" ==== check insert rows failed after {} try check {} times of database {}".format(count , self.try_check_times ,dbname)) + break + time.sleep(0.1) + tdSql.query("select distinct tbname from {}.{}".format(dbname,stablename)) + while not tdSql.queryResult: + time.sleep(0.1) + tdSql.query("select distinct tbname from {}.{}".format(dbname,stablename)) + status_OK = self.mycheckRows("select distinct tbname from {}.{}".format(dbname,stablename) ,tb_nums) + tdLog.notice(" ==== check insert tbnames first failed , this is {}_th retry check tbnames of database {}".format(count , dbname)) + count += 1 + + def _get_stop_dnode_id(self,dbname): + tdSql.query("show {}.vgroups".format(dbname)) + vgroup_infos = tdSql.queryResult + for vgroup_info in vgroup_infos: + leader_infos = vgroup_info[3:-4] + # print(vgroup_info) + for ind ,role in enumerate(leader_infos): + if role =='leader': + # print(ind,leader_infos) + self.stop_dnode_id = leader_infos[ind-1] + break + + + return self.stop_dnode_id + + def wait_stop_dnode_OK(self): + + def _get_status(): + newTdSql=tdCom.newTdSql() + + status = "" + newTdSql.query("show dnodes") + dnode_infos = newTdSql.queryResult + for dnode_info in dnode_infos: + id = dnode_info[0] + dnode_status = dnode_info[4] + if id == self.stop_dnode_id: + status = dnode_status + break + return status + + status = _get_status() + while status !="offline": + time.sleep(0.1) + status = _get_status() + # tdLog.notice("==== stop dnode has not been stopped , endpoint is {}".format(self.stop_dnode)) + tdLog.notice("==== stop_dnode has stopped , id is {}".format(self.stop_dnode_id)) + + def check_revote_leader_success(self, dbname, before_leader_infos , after_leader_infos): + check_status = False + vote_act = set(set(after_leader_infos)-set(before_leader_infos)) + if not vote_act: + print("=======before_revote_leader_infos ======\n" , before_leader_infos) + print("=======after_revote_leader_infos ======\n" , after_leader_infos) + tdLog.info(" ===maybe revote not occured , there is no dnode offline ====") + else: + for vgroup_info in vote_act: + for ind , role in enumerate(vgroup_info): + if role==self.stop_dnode_id: + + if vgroup_info[ind+1] =="offline" and "leader" in vgroup_info: + tdLog.notice(" === revote leader ok , leader is {} now ====".format(vgroup_info[list(vgroup_info).index("leader")-1])) + check_status = True + elif vgroup_info[ind+1] !="offline": + tdLog.notice(" === dnode {} should be offline ".format(self.stop_dnode_id)) + else: + continue + break + return check_status + + def wait_start_dnode_OK(self): + + def _get_status(): + newTdSql=tdCom.newTdSql() + status = "" + newTdSql.query("show dnodes") + dnode_infos = newTdSql.queryResult + for dnode_info in dnode_infos: + id = dnode_info[0] + dnode_status = dnode_info[4] + if id == self.stop_dnode_id: + status = dnode_status + break + return status + + status = _get_status() + while status !="ready": + time.sleep(0.1) + status = _get_status() + # tdLog.notice("==== stop dnode has not been stopped , endpoint is {}".format(self.stop_dnode)) + tdLog.notice("==== stop_dnode has restart , id is {}".format(self.stop_dnode_id)) + + def _parse_datetime(self,timestr): + try: + return datetime.datetime.strptime(timestr, '%Y-%m-%d %H:%M:%S.%f') + except ValueError: + pass + try: + return datetime.datetime.strptime(timestr, '%Y-%m-%d %H:%M:%S') + except ValueError: + pass + + def mycheckRowCol(self, sql, row, col): + caller = inspect.getframeinfo(inspect.stack()[2][0]) + if row < 0: + args = (caller.filename, caller.lineno, sql, row) + tdLog.exit("%s(%d) failed: sql:%s, row:%d is smaller than zero" % args) + if col < 0: + args = (caller.filename, caller.lineno, sql, row) + tdLog.exit("%s(%d) failed: sql:%s, col:%d is smaller than zero" % args) + if row > tdSql.queryRows: + args = (caller.filename, caller.lineno, sql, row, tdSql.queryRows) + tdLog.exit("%s(%d) failed: sql:%s, row:%d is larger than queryRows:%d" % args) + if col > tdSql.queryCols: + args = (caller.filename, caller.lineno, sql, col, tdSql.queryCols) + tdLog.exit("%s(%d) failed: sql:%s, col:%d is larger than queryCols:%d" % args) + + def mycheckData(self, sql ,row, col, data): + check_status = True + self.mycheckRowCol(sql ,row, col) + if tdSql.queryResult[row][col] != data: + if tdSql.cursor.istype(col, "TIMESTAMP"): + # suppose user want to check nanosecond timestamp if a longer data passed + if (len(data) >= 28): + if pd.to_datetime(tdSql.queryResult[row][col]) == pd.to_datetime(data): + tdLog.info("sql:%s, row:%d col:%d data:%d == expect:%s" % + (sql, row, col, tdSql.queryResult[row][col], data)) + else: + if tdSql.queryResult[row][col] == self._parse_datetime(data): + tdLog.info("sql:%s, row:%d col:%d data:%s == expect:%s" % + (sql, row, col, tdSql.queryResult[row][col], data)) + return + + if str(tdSql.queryResult[row][col]) == str(data): + tdLog.info("sql:%s, row:%d col:%d data:%s == expect:%s" % + (sql, row, col, tdSql.queryResult[row][col], data)) + return + elif isinstance(data, float) and abs(tdSql.queryResult[row][col] - data) <= 0.000001: + tdLog.info("sql:%s, row:%d col:%d data:%f == expect:%f" % + (sql, row, col, tdSql.queryResult[row][col], data)) + return + else: + caller = inspect.getframeinfo(inspect.stack()[1][0]) + args = (caller.filename, caller.lineno, sql, row, col, tdSql.queryResult[row][col], data) + tdLog.info("%s(%d) failed: sql:%s row:%d col:%d data:%s != expect:%s" % args) + + check_status = False + + if data is None: + tdLog.info("sql:%s, row:%d col:%d data:%s == expect:%s" % + (sql, row, col, tdSql.queryResult[row][col], data)) + elif isinstance(data, str): + tdLog.info("sql:%s, row:%d col:%d data:%s == expect:%s" % + (sql, row, col, tdSql.queryResult[row][col], data)) + # elif isinstance(data, datetime.date): + # tdLog.info("sql:%s, row:%d col:%d data:%s == expect:%s" % + # (sql, row, col, tdSql.queryResult[row][col], data)) + elif isinstance(data, float): + tdLog.info("sql:%s, row:%d col:%d data:%s == expect:%s" % + (sql, row, col, tdSql.queryResult[row][col], data)) + else: + tdLog.info("sql:%s, row:%d col:%d data:%s == expect:%d" % + (sql, row, col, tdSql.queryResult[row][col], data)) + + return check_status + + def mycheckRows(self, sql, expectRows): + check_status = True + if len(tdSql.queryResult) == expectRows: + tdLog.info("sql:%s, queryRows:%d == expect:%d" % (sql, len(tdSql.queryResult), expectRows)) + return True + else: + caller = inspect.getframeinfo(inspect.stack()[1][0]) + args = (caller.filename, caller.lineno, sql, len(tdSql.queryResult), expectRows) + tdLog.info("%s(%d) failed: sql:%s, queryRows:%d != expect:%d" % args) + check_status = False + return check_status + + + def get_leader_infos(self ,dbname): + + newTdSql=tdCom.newTdSql() + newTdSql.query("show {}.vgroups".format(dbname)) + vgroup_infos = newTdSql.queryResult + + leader_infos = set() + for vgroup_info in vgroup_infos: + leader_infos.add(vgroup_info[3:-4]) + + return leader_infos + + def force_stop_dnode(self, dnode_id ): + + tdSql.query("show dnodes") + port = None + for dnode_info in tdSql.queryResult: + if dnode_id == dnode_info[0]: + port = dnode_info[1].split(":")[-1] + break + else: + continue + if port: + tdLog.notice(" ==== dnode {} will be force stop by kill -9 ====".format(dnode_id)) + psCmd = '''netstat -anp|grep -w LISTEN|grep -w %s |grep -o "LISTEN.*"|awk '{print $2}'|cut -d/ -f1|head -n1''' %(port) + processID = subprocess.check_output( + psCmd, shell=True).decode("utf-8") + ps_kill_taosd = ''' kill -9 {} '''.format(processID) + # print(ps_kill_taosd) + os.system(ps_kill_taosd) + + def basic_query_task(self,dbname ,stablename): + + sql = "select * from {}.{} ;".format(dbname , stablename) + + count = 0 + while count < self.query_times: + os.system(''' taos -s '{}' >>/dev/null '''.format(sql)) + count += 1 + + def multi_thread_query_task(self, thread_nums ,dbname , stablename ): + + for i in range(thread_nums): + task = threading.Thread(target = self.basic_query_task, args=(dbname ,stablename)) + self.thread_list.append(task) + + for thread in self.thread_list: + + thread.start() + return self.thread_list + + + def stop_follower_when_query_going(self): + + tdDnodes = cluster.dnodes + self.create_database(dbname = self.db_name ,replica_num= self.replica , vgroup_nums= 1) + self.create_stable_insert_datas(dbname = self.db_name , stablename = "stb1" , tb_nums= self.tb_nums ,row_nums= self.row_nums) + + # let query task start + self.thread_list = self.multi_thread_query_task(10 ,self.db_name ,'stb1' ) + + # force stop follower + for loop in range(self.loop_restart_times): + tdLog.debug(" ==== this is {}_th restart follower of database {} ==== ".format(loop ,self.db_name)) + + # get leader info before stop + before_leader_infos = self.get_leader_infos(self.db_name) + + self.stop_dnode_id = self._get_stop_dnode_id(self.db_name) + self.force_stop_dnode(self.stop_dnode_id) + + + start = time.time() + # get leader info after stop + after_leader_infos = self.get_leader_infos(self.db_name) + + revote_status = self.check_revote_leader_success(self.db_name ,before_leader_infos , after_leader_infos) + + while not revote_status: + after_leader_infos = self.get_leader_infos(self.db_name) + revote_status = self.check_revote_leader_success(self.db_name ,before_leader_infos , after_leader_infos) + + end = time.time() + time_cost = end - start + tdLog.debug(" ==== revote leader of database {} cost time {} ====".format(self.db_name , time_cost)) + + self.wait_stop_dnode_OK() + + start = time.time() + tdDnodes[self.stop_dnode_id-1].starttaosd() + self.wait_start_dnode_OK() + end = time.time() + time_cost = int(end-start) + + if time_cost > self.max_restart_time: + tdLog.exit(" ==== restart dnode {} cost too much time , please check ====".format(self.stop_dnode_id)) + + for thread in self.thread_list: + thread.join() + + + def run(self): + + # basic check of cluster + self.check_setup_cluster_status() + self.stop_follower_when_query_going() + + + + + + def stop(self): + tdSql.close() + tdLog.success(f"{__file__} successfully executed") + +tdCases.addLinux(__file__, TDTestCase()) +tdCases.addWindows(__file__, TDTestCase()) \ No newline at end of file diff --git a/tests/system-test/6-cluster/vnode/4dnode1mnode_basic_replica3_vgroups.py b/tests/system-test/6-cluster/vnode/4dnode1mnode_basic_replica3_vgroups.py index 5529a5e256..78f6ee153b 100644 --- a/tests/system-test/6-cluster/vnode/4dnode1mnode_basic_replica3_vgroups.py +++ b/tests/system-test/6-cluster/vnode/4dnode1mnode_basic_replica3_vgroups.py @@ -71,14 +71,14 @@ class TDTestCase: is_leader=True if count==1 and is_leader: - tdLog.info("===== depoly cluster success with 1 mnode as leader =====") + tdLog.notice("===== depoly cluster success with 1 mnode as leader =====") else: tdLog.exit("===== depoly cluster fail with 1 mnode as leader =====") for k ,v in self.dnode_list.items(): if k == mnode_name: if v[3]==0: - tdLog.info("===== depoly cluster mnode only success at {} , support_vnodes is {} ".format(mnode_name,v[3])) + tdLog.notice("===== depoly cluster mnode only success at {} , support_vnodes is {} ".format(mnode_name,v[3])) else: tdLog.exit("===== depoly cluster mnode only fail at {} , support_vnodes is {} ".format(mnode_name,v[3])) else: @@ -121,7 +121,7 @@ class TDTestCase: for k , v in vgroups_infos.items(): if len(v) ==1 and v[0]=="leader": - tdLog.info(" === create database replica only 1 role leader check success of vgroup_id {} ======".format(k)) + tdLog.notice(" === create database replica only 1 role leader check success of vgroup_id {} ======".format(k)) else: tdLog.exit(" === create database replica only 1 role leader check fail of vgroup_id {} ======".format(k)) @@ -152,10 +152,10 @@ class TDTestCase: time.sleep(0.1) status = self.check_vgroups_init_done(dbname) - # tdLog.info("=== database {} show vgroups vote the leader is in progress ===".format(dbname)) + # tdLog.notice("=== database {} show vgroups vote the leader is in progress ===".format(dbname)) end = time.time() cost_time = end - start - tdLog.info(" ==== database %s vote the leaders success , cost time is %.3f second ====="%(dbname,cost_time) ) + tdLog.notice(" ==== database %s vote the leaders success , cost time is %.3f second ====="%(dbname,cost_time) ) # os.system("taos -s 'show {}.vgroups;'".format(dbname)) if cost_time >= self.max_vote_time_cost: tdLog.exit(" ==== database %s vote the leaders cost too large time , cost time is %.3f second ===="%(dbname,cost_time) ) @@ -165,28 +165,28 @@ class TDTestCase: def test_init_vgroups_time_costs(self): - tdLog.info(" ====start check time cost about vgroups vote leaders ==== ") - tdLog.info(" ==== current max time cost is set value : {} =======".format(self.max_vote_time_cost)) + tdLog.notice(" ====start check time cost about vgroups vote leaders ==== ") + tdLog.notice(" ==== current max time cost is set value : {} =======".format(self.max_vote_time_cost)) # create database replica 3 vgroups 1 db1 = 'db_1' create_db_replica_3_vgroups_1 = "create database {} replica 3 vgroups 1".format(db1) - tdLog.info('=======database {} replica 3 vgroups 1 ======'.format(db1)) + tdLog.notice('=======database {} replica 3 vgroups 1 ======'.format(db1)) tdSql.execute(create_db_replica_3_vgroups_1) self.vote_leader_time_costs(db1) # create database replica 3 vgroups 10 db2 = 'db_2' create_db_replica_3_vgroups_10 = "create database {} replica 3 vgroups 10".format(db2) - tdLog.info('=======database {} replica 3 vgroups 10 ======'.format(db2)) + tdLog.notice('=======database {} replica 3 vgroups 10 ======'.format(db2)) tdSql.execute(create_db_replica_3_vgroups_10) self.vote_leader_time_costs(db2) # create database replica 3 vgroups 100 db3 = 'db_3' create_db_replica_3_vgroups_100 = "create database {} replica 3 vgroups 100".format(db3) - tdLog.info('=======database {} replica 3 vgroups 100 ======'.format(db3)) + tdLog.notice('=======database {} replica 3 vgroups 100 ======'.format(db3)) tdSql.execute(create_db_replica_3_vgroups_100) self.vote_leader_time_costs(db3) diff --git a/tests/system-test/6-cluster/vnode/4dnode1mnode_basic_replica3_vgroups_stopOne.py b/tests/system-test/6-cluster/vnode/4dnode1mnode_basic_replica3_vgroups_stopOne.py index 3be36c067e..32ee0a8711 100644 --- a/tests/system-test/6-cluster/vnode/4dnode1mnode_basic_replica3_vgroups_stopOne.py +++ b/tests/system-test/6-cluster/vnode/4dnode1mnode_basic_replica3_vgroups_stopOne.py @@ -74,14 +74,14 @@ class TDTestCase: is_leader=True if count==1 and is_leader: - tdLog.info("===== depoly cluster success with 1 mnode as leader =====") + tdLog.notice("===== depoly cluster success with 1 mnode as leader =====") else: tdLog.exit("===== depoly cluster fail with 1 mnode as leader =====") for k ,v in self.dnode_list.items(): if k == mnode_name: if v[3]==0: - tdLog.info("===== depoly cluster mnode only success at {} , support_vnodes is {} ".format(mnode_name,v[3])) + tdLog.notice("===== depoly cluster mnode only success at {} , support_vnodes is {} ".format(mnode_name,v[3])) else: tdLog.exit("===== depoly cluster mnode only fail at {} , support_vnodes is {} ".format(mnode_name,v[3])) else: @@ -124,7 +124,7 @@ class TDTestCase: for k , v in vgroups_infos.items(): if len(v) ==1 and v[0]=="leader": - tdLog.info(" === create database replica only 1 role leader check success of vgroup_id {} ======".format(k)) + tdLog.notice(" === create database replica only 1 role leader check success of vgroup_id {} ======".format(k)) else: tdLog.exit(" === create database replica only 1 role leader check fail of vgroup_id {} ======".format(k)) @@ -148,7 +148,7 @@ class TDTestCase: if ind%2==0: if role == stop_dnode_id and vgroups_leader_follower[ind+1]=="offline": - tdLog.info("====== dnode {} has offline , endpoint is {}".format(stop_dnode_id , self.stop_dnode)) + tdLog.notice("====== dnode {} has offline , endpoint is {}".format(stop_dnode_id , self.stop_dnode)) elif role == stop_dnode_id : tdLog.exit("====== dnode {} has not offline , endpoint is {}".format(stop_dnode_id , self.stop_dnode)) else: @@ -180,8 +180,8 @@ class TDTestCase: while status !="offline": time.sleep(0.1) status = _get_status() - # tdLog.info("==== stop dnode has not been stopped , endpoint is {}".format(self.stop_dnode)) - tdLog.info("==== stop_dnode has stopped , endpoint is {}".format(self.stop_dnode)) + # tdLog.notice("==== stop dnode has not been stopped , endpoint is {}".format(self.stop_dnode)) + tdLog.notice("==== stop_dnode has stopped , endpoint is {}".format(self.stop_dnode)) def wait_start_dnode_OK(self): @@ -202,15 +202,15 @@ class TDTestCase: while status !="ready": time.sleep(0.1) status = _get_status() - # tdLog.info("==== stop dnode has not been stopped , endpoint is {}".format(self.stop_dnode)) - tdLog.info("==== stop_dnode has restart , endpoint is {}".format(self.stop_dnode)) + # tdLog.notice("==== stop dnode has not been stopped , endpoint is {}".format(self.stop_dnode)) + tdLog.notice("==== stop_dnode has restart , endpoint is {}".format(self.stop_dnode)) def random_stop_One_dnode(self): self.stop_dnode = self._get_stop_dnode() stop_dnode_id = self.dnode_list[self.stop_dnode][0] - tdLog.info(" ==== dnode {} will offline ,endpoints is {} ====".format(stop_dnode_id , self.stop_dnode)) + tdLog.notice(" ==== dnode {} will offline ,endpoints is {} ====".format(stop_dnode_id , self.stop_dnode)) tdDnodes=cluster.dnodes tdDnodes[stop_dnode_id-1].stoptaosd() self.wait_stop_dnode_OK() @@ -250,10 +250,10 @@ class TDTestCase: time.sleep(0.1) status = self.check_vgroups_init_done(dbname) - # tdLog.info("=== database {} show vgroups vote the leader is in progress ===".format(dbname)) + # tdLog.notice("=== database {} show vgroups vote the leader is in progress ===".format(dbname)) end = time.time() cost_time = end - start - tdLog.info(" ==== database %s vote the leaders success , cost time is %.3f second ====="%(dbname,cost_time) ) + tdLog.notice(" ==== database %s vote the leaders success , cost time is %.3f second ====="%(dbname,cost_time) ) # os.system("taos -s 'show {}.vgroups;'".format(dbname)) if cost_time >= self.max_vote_time_cost: tdLog.exit(" ==== database %s vote the leaders cost too large time , cost time is %.3f second ===="%(dbname,cost_time) ) @@ -269,10 +269,10 @@ class TDTestCase: time.sleep(0.1) status = self.check_vgroups_revote_leader(dbname) - # tdLog.info("=== database {} show vgroups vote the leader is in progress ===".format(dbname)) + # tdLog.notice("=== database {} show vgroups vote the leader is in progress ===".format(dbname)) end = time.time() cost_time = end - start - tdLog.info(" ==== database %s revote the leaders success , cost time is %.3f second ====="%(dbname,cost_time) ) + tdLog.notice(" ==== database %s revote the leaders success , cost time is %.3f second ====="%(dbname,cost_time) ) # os.system("taos -s 'show {}.vgroups;'".format(dbname)) if cost_time >= self.max_vote_time_cost: tdLog.exit(" ==== database %s revote the leaders cost too large time , cost time is %.3f second ===="%(dbname,cost_time) ) @@ -306,7 +306,7 @@ class TDTestCase: if role==self.dnode_list[self.stop_dnode][0]: if vgroup_info[ind+1] =="offline" and "leader" in vgroup_info: - tdLog.info(" === revote leader ok , leader is {} now ====".format(list(vgroup_info).index("leader")-1)) + tdLog.notice(" === revote leader ok , leader is {} now ====".format(list(vgroup_info).index("leader")-1)) elif vgroup_info[ind+1] !="offline": tdLog.exit(" === dnode {} should be offline ".format(self.stop_dnode)) else: @@ -319,14 +319,14 @@ class TDTestCase: self.Restart_stop_dnode() def test_init_vgroups_time_costs(self): - tdLog.info(" ====start check time cost about vgroups vote leaders ==== ") - tdLog.info(" ==== current max time cost is set value : {} =======".format(self.max_vote_time_cost)) + tdLog.notice(" ====start check time cost about vgroups vote leaders ==== ") + tdLog.notice(" ==== current max time cost is set value : {} =======".format(self.max_vote_time_cost)) # create database replica 3 vgroups 1 db1 = 'db_1' create_db_replica_3_vgroups_1 = "create database {} replica 3 vgroups 1".format(db1) - tdLog.info('=======database {} replica 3 vgroups 1 ======'.format(db1)) + tdLog.notice('=======database {} replica 3 vgroups 1 ======'.format(db1)) tdSql.execute(create_db_replica_3_vgroups_1) self.vote_leader_time_costs(db1) self.exec_revote_action(db1) @@ -334,7 +334,7 @@ class TDTestCase: # create database replica 3 vgroups 10 db2 = 'db_2' create_db_replica_3_vgroups_10 = "create database {} replica 3 vgroups 10".format(db2) - tdLog.info('=======database {} replica 3 vgroups 10 ======'.format(db2)) + tdLog.notice('=======database {} replica 3 vgroups 10 ======'.format(db2)) tdSql.execute(create_db_replica_3_vgroups_10) self.vote_leader_time_costs(db2) self.exec_revote_action(db2) @@ -342,7 +342,7 @@ class TDTestCase: # create database replica 3 vgroups 100 db3 = 'db_3' create_db_replica_3_vgroups_100 = "create database {} replica 3 vgroups 100".format(db3) - tdLog.info('=======database {} replica 3 vgroups 100 ======'.format(db3)) + tdLog.notice('=======database {} replica 3 vgroups 100 ======'.format(db3)) tdSql.execute(create_db_replica_3_vgroups_100) self.vote_leader_time_costs(db3) self.exec_revote_action(db3) diff --git a/tests/system-test/6-cluster/vnode/insert_100W_rows.json b/tests/system-test/6-cluster/vnode/insert_100W_rows.json new file mode 100644 index 0000000000..4b49c38fb6 --- /dev/null +++ b/tests/system-test/6-cluster/vnode/insert_100W_rows.json @@ -0,0 +1,118 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos/", + "host": "localhost", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 10, + "create_table_thread_count": 10, + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "interlace_rows": 1000, + "num_of_records_per_req": 1000, + "databases": [ + { + "dbinfo": { + "name": "db_2", + "drop": "no", + "vgroups": 1, + "replica": 3 + }, + "super_tables": [ + { + "name": "stb1", + "childtable_count": 10, + "childtable_prefix": "sub_", + "auto_create_table": "yes", + "batch_create_tbl_num": 5000, + "data_source": "rand", + "insert_mode": "taosc", + "insert_rows": 100000, + "interlace_rows": 0, + "insert_interval": 0, + "max_sql_len": 1000000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 10, + "start_timestamp": "2015-05-01 00:00:00.000", + "sample_format": "csv", + "use_sample_ts": "no", + "tags_file": "", + "columns": [ + { + "type": "INT", + "count": 1 + }, + { + "type": "TINYINT", + "count": 1 + }, + { + "type": "SMALLINT", + "count": 1 + }, + { + "type": "BIGINT", + "count": 1 + }, + { + "type": "UINT", + "count": 1 + }, + { + "type": "UTINYINT", + "count": 1 + }, + { + "type": "USMALLINT", + "count": 1 + }, + { + "type": "UBIGINT", + "count": 1 + }, + { + "type": "DOUBLE", + "count": 1 + }, + { + "type": "FLOAT", + "count": 1 + }, + { + "type": "BINARY", + "len": 40, + "count": 1 + }, + { + "type": "VARCHAR", + "len": 200, + "count": 1 + }, + { + "type": "nchar", + "len": 200, + "count": 1 + } + ], + "tags": [ + { + "type": "INT", + "count": 1 + }, + { + "type": "BINARY", + "len": 100, + "count": 1 + }, + { + "type": "BOOL", + "count": 1 + } + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/tests/system-test/6-cluster/vnode/insert_10W_rows.json b/tests/system-test/6-cluster/vnode/insert_10W_rows.json new file mode 100644 index 0000000000..b3b63aed12 --- /dev/null +++ b/tests/system-test/6-cluster/vnode/insert_10W_rows.json @@ -0,0 +1,118 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos/", + "host": "localhost", + "port": 6030, + "user": "root", + "password": "taosdata", + "thread_count": 1, + "create_table_thread_count": 1, + "confirm_parameter_prompt": "no", + "insert_interval": 0, + "interlace_rows": 1000, + "num_of_records_per_req": 1000, + "databases": [ + { + "dbinfo": { + "name": "db_1", + "drop": "no", + "vgroups": 1, + "replica": 3 + }, + "super_tables": [ + { + "name": "stb1", + "childtable_count": 10, + "childtable_prefix": "sub_", + "auto_create_table": "yes", + "batch_create_tbl_num": 5000, + "data_source": "rand", + "insert_mode": "taosc", + "insert_rows": 10000, + "interlace_rows": 0, + "insert_interval": 0, + "max_sql_len": 1000000, + "disorder_ratio": 0, + "disorder_range": 1000, + "timestamp_step": 10, + "start_timestamp": "2015-05-01 00:00:00.000", + "sample_format": "csv", + "use_sample_ts": "no", + "tags_file": "", + "columns": [ + { + "type": "INT", + "count": 1 + }, + { + "type": "TINYINT", + "count": 1 + }, + { + "type": "SMALLINT", + "count": 1 + }, + { + "type": "BIGINT", + "count": 1 + }, + { + "type": "UINT", + "count": 1 + }, + { + "type": "UTINYINT", + "count": 1 + }, + { + "type": "USMALLINT", + "count": 1 + }, + { + "type": "UBIGINT", + "count": 1 + }, + { + "type": "DOUBLE", + "count": 1 + }, + { + "type": "FLOAT", + "count": 1 + }, + { + "type": "BINARY", + "len": 40, + "count": 1 + }, + { + "type": "VARCHAR", + "len": 200, + "count": 1 + }, + { + "type": "nchar", + "len": 200, + "count": 1 + } + ], + "tags": [ + { + "type": "INT", + "count": 1 + }, + { + "type": "BINARY", + "len": 100, + "count": 1 + }, + { + "type": "BOOL", + "count": 1 + } + ] + } + ] + } + ] +} \ No newline at end of file From d4abe20eeb81abe1872f23963cb770133f3a378c Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Mon, 25 Jul 2022 18:21:13 +0800 Subject: [PATCH 26/54] fix: can't drop db since transaction conflict --- source/dnode/mnode/impl/src/mndOffset.c | 10 +++++----- source/dnode/mnode/impl/src/mndSubscribe.c | 10 ++++++---- source/dnode/mnode/impl/src/mndTopic.c | 11 +++++++---- source/dnode/mnode/impl/src/mndTrans.c | 1 + 4 files changed, 19 insertions(+), 13 deletions(-) diff --git a/source/dnode/mnode/impl/src/mndOffset.c b/source/dnode/mnode/impl/src/mndOffset.c index 00753de0ec..9f6108004d 100644 --- a/source/dnode/mnode/impl/src/mndOffset.c +++ b/source/dnode/mnode/impl/src/mndOffset.c @@ -281,7 +281,7 @@ static int32_t mndSetDropOffsetRedoLogs(SMnode *pMnode, STrans *pTrans, SMqOffse } int32_t mndDropOffsetByDB(SMnode *pMnode, STrans *pTrans, SDbObj *pDb) { - int32_t code = -1; + int32_t code = 0; SSdb *pSdb = pMnode->pSdb; void *pIter = NULL; @@ -297,15 +297,15 @@ int32_t mndDropOffsetByDB(SMnode *pMnode, STrans *pTrans, SDbObj *pDb) { if (mndSetDropOffsetCommitLogs(pMnode, pTrans, pOffset) < 0) { sdbRelease(pSdb, pOffset); - goto END; + sdbCancelFetch(pSdb, pIter); + code = -1; + break; } sdbRelease(pSdb, pOffset); } - code = 0; -END: - return code; + return code; } int32_t mndDropOffsetByTopic(SMnode *pMnode, STrans *pTrans, const char *topic) { diff --git a/source/dnode/mnode/impl/src/mndSubscribe.c b/source/dnode/mnode/impl/src/mndSubscribe.c index 245dc413f1..8feed476cd 100644 --- a/source/dnode/mnode/impl/src/mndSubscribe.c +++ b/source/dnode/mnode/impl/src/mndSubscribe.c @@ -824,7 +824,7 @@ int32_t mndSetDropSubCommitLogs(SMnode *pMnode, STrans *pTrans, SMqSubscribeObj } int32_t mndDropSubByDB(SMnode *pMnode, STrans *pTrans, SDbObj *pDb) { - int32_t code = -1; + int32_t code = 0; SSdb *pSdb = pMnode->pSdb; void *pIter = NULL; @@ -840,12 +840,14 @@ int32_t mndDropSubByDB(SMnode *pMnode, STrans *pTrans, SDbObj *pDb) { if (mndSetDropSubCommitLogs(pMnode, pTrans, pSub) < 0) { sdbRelease(pSdb, pSub); - goto END; + sdbCancelFetch(pSdb, pIter); + code = -1; + break; } + + sdbRelease(pSdb, pSub); } - code = 0; -END: return code; } diff --git a/source/dnode/mnode/impl/src/mndTopic.c b/source/dnode/mnode/impl/src/mndTopic.c index 7acfc95bfc..7e3e5a9838 100644 --- a/source/dnode/mnode/impl/src/mndTopic.c +++ b/source/dnode/mnode/impl/src/mndTopic.c @@ -833,7 +833,7 @@ static void mndCancelGetNextTopic(SMnode *pMnode, void *pIter) { } int32_t mndDropTopicByDB(SMnode *pMnode, STrans *pTrans, SDbObj *pDb) { - int32_t code = -1; + int32_t code = 0; SSdb *pSdb = pMnode->pSdb; void *pIter = NULL; @@ -848,11 +848,14 @@ int32_t mndDropTopicByDB(SMnode *pMnode, STrans *pTrans, SDbObj *pDb) { } if (mndSetDropTopicCommitLogs(pMnode, pTrans, pTopic) < 0) { - goto END; + sdbRelease(pSdb, pTopic); + sdbCancelFetch(pSdb, pIter); + code = -1; + break; } + + sdbRelease(pSdb, pTopic); } - code = 0; -END: return code; } diff --git a/source/dnode/mnode/impl/src/mndTrans.c b/source/dnode/mnode/impl/src/mndTrans.c index 096a1534fd..04587d96a8 100644 --- a/source/dnode/mnode/impl/src/mndTrans.c +++ b/source/dnode/mnode/impl/src/mndTrans.c @@ -794,6 +794,7 @@ static bool mndCheckTransConflict(SMnode *pMnode, STrans *pNew) { mError("trans:%d, can't execute since conflict with trans:%d, db1:%s db2:%s", pNew->id, pTrans->id, pTrans->dbname1, pTrans->dbname2); + conflict = true; sdbRelease(pMnode->pSdb, pTrans); } From 086ecf754f222e76a4c53569dcc307c769b242e8 Mon Sep 17 00:00:00 2001 From: shenglian zhou Date: Mon, 25 Jul 2022 18:32:50 +0800 Subject: [PATCH 27/54] fix: add some delay to simulate actual processing --- source/libs/function/test/udf1.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/source/libs/function/test/udf1.c b/source/libs/function/test/udf1.c index dfbae357ef..b53f82c3e9 100644 --- a/source/libs/function/test/udf1.c +++ b/source/libs/function/test/udf1.c @@ -1,6 +1,7 @@ #include #include #include +#include #include "taosudf.h" @@ -35,6 +36,18 @@ DLL_EXPORT int32_t udf1(SUdfDataBlock* block, SUdfColumn *resultCol) { udfColDataSet(resultCol, i, (char *)&luckyNum, false); } } + //to simulate actual processing delay by udf +#ifdef WINDOWS + HANDLE timer; + LARGE_INTEGER interval; + interval.QuadPart = (10 * 1000); + timer = CreateWaitableTimer(NULL, TRUE, NULL); + SetWaitableTimer(timer, &interval, 0, NULL, NULL, 0); + WaitForSingleObject(timer, INFINITE); + CloseHandle(timer); +#else + usleep(1000); +#endif return 0; } \ No newline at end of file From 8e7d65176805fbc327ffa74a56fc0bbda68f85da Mon Sep 17 00:00:00 2001 From: shenglian zhou Date: Mon, 25 Jul 2022 18:37:29 +0800 Subject: [PATCH 28/54] fix: add delay to udf1 --- source/libs/function/test/udf1.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/source/libs/function/test/udf1.c b/source/libs/function/test/udf1.c index b53f82c3e9..5be18af553 100644 --- a/source/libs/function/test/udf1.c +++ b/source/libs/function/test/udf1.c @@ -1,8 +1,12 @@ #include #include #include +#ifdef LINUX #include - +#endif +#ifdef WINDOWS +#include +#endif #include "taosudf.h" @@ -37,17 +41,11 @@ DLL_EXPORT int32_t udf1(SUdfDataBlock* block, SUdfColumn *resultCol) { } } //to simulate actual processing delay by udf +#ifdef LINUX + usleep(1 * 1000); // usleep takes sleep time in us (1 millionth of a second) +#endif #ifdef WINDOWS - HANDLE timer; - LARGE_INTEGER interval; - interval.QuadPart = (10 * 1000); - - timer = CreateWaitableTimer(NULL, TRUE, NULL); - SetWaitableTimer(timer, &interval, 0, NULL, NULL, 0); - WaitForSingleObject(timer, INFINITE); - CloseHandle(timer); -#else - usleep(1000); + Sleep(1); #endif return 0; } \ No newline at end of file From 4caa6df1a7876e08ad78055aa6bb485716ff0688 Mon Sep 17 00:00:00 2001 From: shenglian zhou Date: Mon, 25 Jul 2022 19:01:40 +0800 Subject: [PATCH 29/54] fix: add more logs --- source/libs/function/src/tudf.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/source/libs/function/src/tudf.c b/source/libs/function/src/tudf.c index dae8c99aba..afacb50d35 100644 --- a/source/libs/function/src/tudf.c +++ b/source/libs/function/src/tudf.c @@ -877,7 +877,7 @@ void udfcUvHandleError(SClientUvConn *conn); void onUdfcPipeRead(uv_stream_t *client, ssize_t nread, const uv_buf_t *buf); void onUdfcPipeWrite(uv_write_t *write, int status); void onUdfcPipeConnect(uv_connect_t *connect, int status); -int32_t udfcCreateUvTask(SClientUdfTask *task, int8_t uvTaskType, SClientUvTaskNode **pUvTask); +int32_t udfcInitializeUvTask(SClientUdfTask *task, int8_t uvTaskType, SClientUvTaskNode *uvTask); int32_t udfcQueueUvTask(SClientUvTaskNode *uvTask); int32_t udfcStartUvTask(SClientUvTaskNode *uvTask); void udfcAsyncTaskCb(uv_async_t *async); @@ -1376,8 +1376,7 @@ void onUdfcPipeConnect(uv_connect_t *connect, int status) { uv_sem_post(&uvTask->taskSem); } -int32_t udfcCreateUvTask(SClientUdfTask *task, int8_t uvTaskType, SClientUvTaskNode **pUvTask) { - SClientUvTaskNode *uvTask = taosMemoryCalloc(1, sizeof(SClientUvTaskNode)); +int32_t udfcInitializeUvTask(SClientUdfTask *task, int8_t uvTaskType, SClientUvTaskNode *uvTask) { uvTask->type = uvTaskType; uvTask->udfc = task->session->udfc; @@ -1412,7 +1411,6 @@ int32_t udfcCreateUvTask(SClientUdfTask *task, int8_t uvTaskType, SClientUvTaskN } uv_sem_init(&uvTask->taskSem, 0); - *pUvTask = uvTask; return 0; } @@ -1615,10 +1613,10 @@ int32_t udfcClose() { } int32_t udfcRunUdfUvTask(SClientUdfTask *task, int8_t uvTaskType) { - SClientUvTaskNode *uvTask = NULL; - - udfcCreateUvTask(task, uvTaskType, &uvTask); + SClientUvTaskNode *uvTask = taosMemoryCalloc(1, sizeof(SClientUvTaskNode)); fnDebug("udfc client task: %p created uvTask: %p. pipe: %p", task, uvTask, task->session->udfUvPipe); + + udfcInitializeUvTask(task, uvTaskType, uvTask); udfcQueueUvTask(uvTask); udfcGetUdfTaskResultFromUvTask(task, uvTask); if (uvTaskType == UV_TASK_CONNECT) { @@ -1629,6 +1627,8 @@ int32_t udfcRunUdfUvTask(SClientUdfTask *task, int8_t uvTaskType) { taosMemoryFree(uvTask->reqBuf.base); uvTask->reqBuf.base = NULL; taosMemoryFree(uvTask); + fnDebug("udfc freed uvTask: %p", task); + uvTask = NULL; return task->errCode; } From 34384d31e702200ac6ddddfefa2b1d2e2b6063d3 Mon Sep 17 00:00:00 2001 From: Shuduo Sang Date: Mon, 25 Jul 2022 19:03:28 +0800 Subject: [PATCH 30/54] feat: update taostools for3.0 (#15395) * feat: update taos-tools for 3.0 [TD-14141] * feat: update taos-tools for 3.0 * feat: update taos-tools for 3.0 * feat: update taos-tools for 3.0 * feat: update taos-tools for 3.0 * feat: update taos-tools for 3.0 * feat: update taos-tools for 3.0 * feat: update taos-tools for 3.0 * feat: update taos-tools for 3.0 --- tools/taos-tools | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/taos-tools b/tools/taos-tools index 0b8a3373bb..817cb6ac43 160000 --- a/tools/taos-tools +++ b/tools/taos-tools @@ -1 +1 @@ -Subproject commit 0b8a3373bb7548f8106d13e7d3b0a988d3c4d48a +Subproject commit 817cb6ac431ed8ae4c843872cdfc8c201c1e1894 From bc9a553db078675e6bd9c665234dd9e598ea2863 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Mon, 25 Jul 2022 19:08:08 +0800 Subject: [PATCH 31/54] fix: the message cannot be processed until the vnode recovery is complete --- source/dnode/vnode/src/inc/vnodeInt.h | 1 + source/dnode/vnode/src/vnd/vnodeSync.c | 29 +++++++++++++++++++------- 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/source/dnode/vnode/src/inc/vnodeInt.h b/source/dnode/vnode/src/inc/vnodeInt.h index b7c23c8527..9ed2b25fdf 100644 --- a/source/dnode/vnode/src/inc/vnodeInt.h +++ b/source/dnode/vnode/src/inc/vnodeInt.h @@ -268,6 +268,7 @@ struct SVnode { tsem_t canCommit; int64_t sync; int32_t blockCount; + bool restored; tsem_t syncSem; SQHandle* pQuery; }; diff --git a/source/dnode/vnode/src/vnd/vnodeSync.c b/source/dnode/vnode/src/vnd/vnodeSync.c index 6bc057e5ac..a0e2354f51 100644 --- a/source/dnode/vnode/src/vnd/vnodeSync.c +++ b/source/dnode/vnode/src/vnd/vnodeSync.c @@ -224,9 +224,19 @@ void vnodeProposeWriteMsg(SQueueInfo *pInfo, STaosQall *qall, int32_t numOfMsgs) vGTrace("vgId:%d, msg:%p get from vnode-write queue, weak:%d block:%d msg:%d:%d pos:%d, handle:%p", vgId, pMsg, isWeak, isBlock, msg, numOfMsgs, arrayPos, pMsg->info.handle); + if (!pVnode->restored) { + vGError("vgId:%d, msg:%p failed to process since not leader", vgId, pMsg); + terrno = TSDB_CODE_APP_NOT_READY; + vnodeHandleProposeError(pVnode, pMsg, TSDB_CODE_APP_NOT_READY); + rpcFreeCont(pMsg->pCont); + taosFreeQitem(pMsg); + continue; + } + if (pMsgArr == NULL || pIsWeakArr == NULL) { vGError("vgId:%d, msg:%p failed to process since out of memory", vgId, pMsg); - vnodeHandleProposeError(pVnode, pMsg, TSDB_CODE_OUT_OF_MEMORY); + terrno = TSDB_CODE_OUT_OF_MEMORY; + vnodeHandleProposeError(pVnode, pMsg, terrno); rpcFreeCont(pMsg->pCont); taosFreeQitem(pMsg); continue; @@ -609,6 +619,12 @@ static void vnodeLeaderTransfer(struct SSyncFSM *pFsm, const SRpcMsg *pMsg, SFsm SVnode *pVnode = pFsm->data; } +static void vnodeRestoreFinish(struct SSyncFSM *pFsm) { + SVnode *pVnode = pFsm->data; + pVnode->restored = true; + vDebug("vgId:%d, sync restore finished", pVnode->config.vgId); +} + static SSyncFSM *vnodeSyncMakeFsm(SVnode *pVnode) { SSyncFSM *pFsm = taosMemoryCalloc(1, sizeof(SSyncFSM)); pFsm->data = pVnode; @@ -616,7 +632,7 @@ static SSyncFSM *vnodeSyncMakeFsm(SVnode *pVnode) { pFsm->FpPreCommitCb = vnodeSyncPreCommitMsg; pFsm->FpRollBackCb = vnodeSyncRollBackMsg; pFsm->FpGetSnapshotInfo = vnodeSyncGetSnapshot; - pFsm->FpRestoreFinishCb = NULL; + pFsm->FpRestoreFinishCb = vnodeRestoreFinish; pFsm->FpLeaderTransferCb = vnodeLeaderTransfer; pFsm->FpReConfigCb = vnodeSyncReconfig; pFsm->FpSnapshotStartRead = vnodeSnapshotStartRead; @@ -670,11 +686,10 @@ bool vnodeIsLeader(SVnode *pVnode) { return false; } - // todo - // if (!pVnode->restored) { - // terrno = TSDB_CODE_APP_NOT_READY; - // return false; - // } + if (!pVnode->restored) { + terrno = TSDB_CODE_APP_NOT_READY; + return false; + } return true; } \ No newline at end of file From 7296bf16588eca6a68d41103ec9b70a556c35348 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Mon, 25 Jul 2022 19:53:44 +0800 Subject: [PATCH 32/54] fix: failed to create stb in 3 replica db --- source/dnode/mnode/impl/src/mndStb.c | 7 ++++--- source/dnode/mnode/impl/src/mndTrans.c | 14 +++++++++++++- source/dnode/vnode/src/meta/metaTable.c | 4 ++-- 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/source/dnode/mnode/impl/src/mndStb.c b/source/dnode/mnode/impl/src/mndStb.c index 682e78acc0..45c59bad24 100644 --- a/source/dnode/mnode/impl/src/mndStb.c +++ b/source/dnode/mnode/impl/src/mndStb.c @@ -641,6 +641,7 @@ static int32_t mndSetCreateStbRedoActions(SMnode *pMnode, STrans *pTrans, SDbObj action.contLen = contLen; action.msgType = TDMT_VND_CREATE_STB; action.acceptableCode = TSDB_CODE_TDB_STB_ALREADY_EXIST; + action.retryCode = TSDB_CODE_TDB_STB_NOT_EXIST; if (mndTransAppendRedoAction(pTrans, &action) != 0) { taosMemoryFree(pReq); sdbCancelFetch(pSdb, pIter); @@ -789,7 +790,7 @@ static int32_t mndCreateStb(SMnode *pMnode, SRpcMsg *pReq, SMCreateStbReq *pCrea SStbObj stbObj = {0}; int32_t code = -1; - STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_DB_INSIDE, pReq); + STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_DB, pReq); if (pTrans == NULL) goto _OVER; mDebug("trans:%d, used to create stb:%s", pTrans->id, pCreate->name); @@ -1608,7 +1609,7 @@ static int32_t mndBuildSMAlterStbRsp(SDbObj *pDb, SStbObj *pObj, void **pCont, i static int32_t mndAlterStbImp(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pDb, SStbObj *pStb, bool needRsp, void* alterOriData, int32_t alterOriDataLen) { int32_t code = -1; - STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_DB_INSIDE, pReq); + STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_DB, pReq); if (pTrans == NULL) goto _OVER; mDebug("trans:%d, used to alter stb:%s", pTrans->id, pStb->name); @@ -1807,7 +1808,7 @@ static int32_t mndSetDropStbRedoActions(SMnode *pMnode, STrans *pTrans, SDbObj * static int32_t mndDropStb(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pDb, SStbObj *pStb) { int32_t code = -1; - STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_DB_INSIDE, pReq); + STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_DB, pReq); if (pTrans == NULL) goto _OVER; mDebug("trans:%d, used to drop stb:%s", pTrans->id, pStb->name); diff --git a/source/dnode/mnode/impl/src/mndTrans.c b/source/dnode/mnode/impl/src/mndTrans.c index 04587d96a8..2321f40a16 100644 --- a/source/dnode/mnode/impl/src/mndTrans.c +++ b/source/dnode/mnode/impl/src/mndTrans.c @@ -794,7 +794,6 @@ static bool mndCheckTransConflict(SMnode *pMnode, STrans *pNew) { mError("trans:%d, can't execute since conflict with trans:%d, db1:%s db2:%s", pNew->id, pTrans->id, pTrans->dbname1, pTrans->dbname2); - conflict = true; sdbRelease(pMnode->pSdb, pTrans); } @@ -1290,6 +1289,19 @@ static bool mndTransPerformRedoActionStage(SMnode *pMnode, STrans *pTrans) { } else { pTrans->code = terrno; if (pTrans->policy == TRN_POLICY_ROLLBACK) { + if (pTrans->lastAction != 0) { + STransAction *pAction = taosArrayGet(pTrans->redoActions, pTrans->lastAction); + if (pAction->retryCode != 0 && pAction->retryCode != pAction->errCode) { + if (pTrans->failedTimes < 6) { + mError("trans:%d, stage keep on redoAction since action:%d code:0x%x not 0x%x, failedTimes:%d", pTrans->id, + pTrans->lastAction, pTrans->code, pAction->retryCode, pTrans->failedTimes); + taosMsleep(1000); + continueExec = true; + return true; + } + } + } + pTrans->stage = TRN_STAGE_ROLLBACK; mError("trans:%d, stage from redoAction to rollback since %s", pTrans->id, terrstr()); continueExec = true; diff --git a/source/dnode/vnode/src/meta/metaTable.c b/source/dnode/vnode/src/meta/metaTable.c index b6cf08ddf8..02d96b03e7 100644 --- a/source/dnode/vnode/src/meta/metaTable.c +++ b/source/dnode/vnode/src/meta/metaTable.c @@ -178,7 +178,7 @@ int metaCreateSTable(SMeta *pMeta, int64_t version, SVCreateStbReq *pReq) { if (metaGetTableEntryByName(&mr, pReq->name) == 0) { // TODO: just for pass case #if 0 - terrno = TSDB_CODE_TDB_TABLE_ALREADY_EXIST; + terrno = TSDB_CODE_TDB_STB_ALREADY_EXIST; metaReaderClear(&mr); return -1; #else @@ -223,7 +223,7 @@ int metaDropSTable(SMeta *pMeta, int64_t verison, SVDropStbReq *pReq, SArray *tb // check if super table exists rc = tdbTbGet(pMeta->pNameIdx, pReq->name, strlen(pReq->name) + 1, &pData, &nData); if (rc < 0 || *(tb_uid_t *)pData != pReq->suid) { - terrno = TSDB_CODE_VND_TABLE_NOT_EXIST; + terrno = TSDB_CODE_TDB_STB_NOT_EXIST; return -1; } From 64d74bff38d7f7d35c4fd976312473efe82fdf5f Mon Sep 17 00:00:00 2001 From: plum-lihui Date: Mon, 25 Jul 2022 20:29:13 +0800 Subject: [PATCH 33/54] test: add test case for fix --- tests/system-test/7-tmq/tmqSubscribeStb-r3.py | 302 ++++++++++++++++++ 1 file changed, 302 insertions(+) create mode 100644 tests/system-test/7-tmq/tmqSubscribeStb-r3.py diff --git a/tests/system-test/7-tmq/tmqSubscribeStb-r3.py b/tests/system-test/7-tmq/tmqSubscribeStb-r3.py new file mode 100644 index 0000000000..6461ee9644 --- /dev/null +++ b/tests/system-test/7-tmq/tmqSubscribeStb-r3.py @@ -0,0 +1,302 @@ +from distutils.log import error +import taos +import sys +import time +import socket +import os +import threading +import subprocess +import platform + +from util.log import * +from util.sql import * +from util.cases import * +from util.dnodes import * +from util.dnodes import TDDnodes +from util.dnodes import TDDnode +from util.cluster import * +from util.common import * +sys.path.append("./7-tmq") +from tmqCommon import * + +class TDTestCase: + def __init__(self): + self.snapshot = 0 + self.replica = 3 + self.vgroups = 4 + self.ctbNum = 1000 + self.rowsPerTbl = 100 + + def init(self, conn, logSql): + tdLog.debug(f"start to excute {__file__}") + tdSql.init(conn.cursor()) + #tdSql.init(conn.cursor(), logSql) # output sql.txt file + + def checkFileContent(self, consumerId, queryString): + buildPath = tdCom.getBuildPath() + cfgPath = tdCom.getClientCfgPath() + dstFile = '%s/../log/dstrows_%d.txt'%(cfgPath, consumerId) + cmdStr = '%s/build/bin/taos -c %s -s "%s >> %s"'%(buildPath, cfgPath, queryString, dstFile) + tdLog.info(cmdStr) + os.system(cmdStr) + + consumeRowsFile = '%s/../log/consumerid_%d.txt'%(cfgPath, consumerId) + tdLog.info("rows file: %s, %s"%(consumeRowsFile, dstFile)) + + consumeFile = open(consumeRowsFile, mode='r') + queryFile = open(dstFile, mode='r') + + # skip first line for it is schema + queryFile.readline() + + while True: + dst = queryFile.readline() + src = consumeFile.readline() + + if dst: + if dst != src: + tdLog.exit("consumerId %d consume rows is not match the rows by direct query"%consumerId) + else: + break + return + + def prepareTestEnv(self): + tdLog.printNoPrefix("======== prepare test env include database, stable, ctables, and insert data: ") + paraDict = {'dbName': 'dbt', + 'dropFlag': 1, + 'event': '', + 'vgroups': 4, + 'stbName': 'stb', + 'colPrefix': 'c', + 'tagPrefix': 't', + 'colSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1},{'type': 'TIMESTAMP', 'count':1}], + 'tagSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1}], + 'ctbPrefix': 'ctb', + 'ctbStartIdx': 0, + 'ctbNum': 100, + 'rowsPerTbl': 1000, + 'batchNum': 100, + 'startTs': 1640966400000, # 2022-01-01 00:00:00.000 + 'pollDelay': 3, + 'showMsg': 1, + 'showRow': 1, + 'snapshot': 0} + + paraDict['vgroups'] = self.vgroups + paraDict['ctbNum'] = self.ctbNum + paraDict['rowsPerTbl'] = self.rowsPerTbl + + tmqCom.initConsumerTable() + tdCom.create_database(tdSql, paraDict["dbName"],paraDict["dropFlag"], vgroups=paraDict["vgroups"],replica=self.replica) + tdLog.info("create stb") + tmqCom.create_stable(tdSql, dbName=paraDict["dbName"],stbName=paraDict["stbName"]) + tdLog.info("create ctb") + tmqCom.create_ctable(tdSql, dbName=paraDict["dbName"],stbName=paraDict["stbName"],ctbPrefix=paraDict['ctbPrefix'], + ctbNum=paraDict["ctbNum"],ctbStartIdx=paraDict['ctbStartIdx']) + tdLog.info("insert data") + # tmqCom.insert_data_interlaceByMultiTbl(tsql=tdSql,dbName=paraDict["dbName"],ctbPrefix=paraDict["ctbPrefix"], + # ctbNum=paraDict["ctbNum"],rowsPerTbl=paraDict["rowsPerTbl"],batchNum=paraDict["batchNum"], + # startTs=paraDict["startTs"],ctbStartIdx=paraDict['ctbStartIdx']) + # tmqCom.insert_data_with_autoCreateTbl(tsql=tdSql,dbName=paraDict["dbName"],stbName=paraDict["stbName"],ctbPrefix="ctbx", + # ctbNum=paraDict["ctbNum"],rowsPerTbl=paraDict["rowsPerTbl"],batchNum=paraDict["batchNum"], + # startTs=paraDict["startTs"],ctbStartIdx=paraDict['ctbStartIdx']) + tmqCom.asyncInsertDataByInterlace(paraDict) + + tdLog.info("wait some data inserted") + exitFlag = 1 + while exitFlag: + queryString = "select count(*) from %s.%s"%(paraDict["dbName"],paraDict["stbName"]) + tdSql.query(queryString) + if tdSql.getRows() > 0: + rowsInserted = tdSql.getData(0,0) + if (rowsInserted > ((self.ctbNum * self.rowsPerTbl)/5)): + exitFlag = 0 + time.sleep(0.1) + + tdLog.info("inserted rows: %d"%tdSql.getData(0,0)) + # tdDnodes=cluster.dnodes + tdLog.info("================= restart dnode 2===========================") + cluster.dnodes[1].stoptaosd() + cluster.dnodes[1].starttaosd() + tdLog.info("================= restart dnode 3===========================") + cluster.dnodes[2].stoptaosd() + cluster.dnodes[2].starttaosd() + tdLog.info("================= restart dnode 4===========================") + cluster.dnodes[3].stoptaosd() + cluster.dnodes[3].starttaosd() + tdLog.info("================= restart dnode 5===========================") + cluster.dnodes[4].stoptaosd() + cluster.dnodes[4].starttaosd() + + # tdLog.info("restart taosd to ensure that the data falls into the disk") + # tdSql.query("flush database %s"%(paraDict['dbName'])) + return + + def tmqCase1(self): + tdLog.printNoPrefix("======== test case 1: ") + + # create and start thread + paraDict = {'dbName': 'dbt', + 'dropFlag': 1, + 'event': '', + 'vgroups': 4, + 'stbName': 'stb', + 'colPrefix': 'c', + 'tagPrefix': 't', + 'colSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1},{'type': 'TIMESTAMP', 'count':1}], + 'tagSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1}], + 'ctbPrefix': 'ctb', + 'ctbStartIdx': 0, + 'ctbNum': 100, + 'rowsPerTbl': 1000, + 'batchNum': 100, + 'startTs': 1640966400000, # 2022-01-01 00:00:00.000 + 'pollDelay': 15, + 'showMsg': 1, + 'showRow': 1, + 'snapshot': 0} + + paraDict['vgroups'] = self.vgroups + paraDict['ctbNum'] = self.ctbNum + paraDict['rowsPerTbl'] = self.rowsPerTbl + + tdLog.info("create topics from stb1") + topicFromStb1 = 'topic_stb1' + queryString = "select ts, c1, c2 from %s.%s where t4 == 'beijing' or t4 == 'changsha' "%(paraDict['dbName'], paraDict['stbName']) + sqlString = "create topic %s as %s" %(topicFromStb1, queryString) + tdLog.info("create topic sql: %s"%sqlString) + tdSql.execute(sqlString) + + consumerId = 0 + expectrowcnt = paraDict["rowsPerTbl"] * paraDict["ctbNum"] + topicList = topicFromStb1 + ifcheckdata = 0 + ifManualCommit = 0 + keyList = 'group.id:cgrp1,\ + enable.auto.commit:false,\ + auto.commit.interval.ms:6000,\ + auto.offset.reset:earliest' + tmqCom.insertConsumerInfo(consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifManualCommit) + + tdLog.info("start consume processor") + tmqCom.startTmqSimProcess(pollDelay=paraDict['pollDelay'],dbName=paraDict["dbName"],showMsg=paraDict['showMsg'], showRow=paraDict['showRow'],snapshot=paraDict['snapshot']) + + tdLog.info("start to check consume result") + expectRows = 1 + resultList = tmqCom.selectConsumeResult(expectRows) + totalConsumeRows = 0 + for i in range(expectRows): + totalConsumeRows += resultList[i] + + tdSql.query(queryString) + totalRowsFromQuery = tdSql.getRows() + + tdLog.info("act consume rows: %d, act query rows: %d, expect consume rows: %d, "%(totalConsumeRows, totalRowsFromQuery, expectrowcnt)) + + if totalConsumeRows != totalRowsFromQuery: + tdLog.exit("tmq consume rows error!") + + # tmqCom.checkFileContent(consumerId, queryString) + + tmqCom.waitSubscriptionExit(tdSql, topicFromStb1) + tdSql.query("drop topic %s"%topicFromStb1) + + tdLog.printNoPrefix("======== test case 1 end ...... ") + + def tmqCase2(self): + tdLog.printNoPrefix("======== test case 2: ") + + # create and start thread + paraDict = {'dbName': 'dbt', + 'dropFlag': 1, + 'event': '', + 'vgroups': 4, + 'stbName': 'stb', + 'colPrefix': 'c', + 'tagPrefix': 't', + 'colSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1},{'type': 'TIMESTAMP', 'count':1}], + 'tagSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1}], + 'ctbPrefix': 'ctb', + 'ctbStartIdx': 0, + 'ctbNum': 100, + 'rowsPerTbl': 1000, + 'batchNum': 100, + 'startTs': 1640966400000, # 2022-01-01 00:00:00.000 + 'pollDelay': 15, + 'showMsg': 1, + 'showRow': 1, + 'snapshot': 1} + + paraDict['vgroups'] = self.vgroups + paraDict['ctbNum'] = self.ctbNum + paraDict['rowsPerTbl'] = self.rowsPerTbl + + tdLog.info("create topics from stb1") + topicFromStb1 = 'topic_stb1' + queryString = "select ts, c1, c2 from %s.%s where t4 == 'beijing' or t4 == 'changsha' "%(paraDict['dbName'], paraDict['stbName']) + sqlString = "create topic %s as %s" %(topicFromStb1, queryString) + tdLog.info("create topic sql: %s"%sqlString) + tdSql.execute(sqlString) + + consumerId = 0 + expectrowcnt = paraDict["rowsPerTbl"] * paraDict["ctbNum"] + topicList = topicFromStb1 + ifcheckdata = 0 + ifManualCommit = 0 + keyList = 'group.id:cgrp1,\ + enable.auto.commit:false,\ + auto.commit.interval.ms:6000,\ + auto.offset.reset:earliest' + tmqCom.insertConsumerInfo(consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifManualCommit) + + tdLog.info("start consume processor") + tmqCom.startTmqSimProcess(pollDelay=paraDict['pollDelay'],dbName=paraDict["dbName"],showMsg=paraDict['showMsg'], showRow=paraDict['showRow'],snapshot=paraDict['snapshot']) + + tdLog.info("================= restart dnode 2===========================") + cluster.dnodes[1].stoptaosd() + cluster.dnodes[1].starttaosd() + tdLog.info("================= restart dnode 3===========================") + cluster.dnodes[2].stoptaosd() + cluster.dnodes[2].starttaosd() + tdLog.info("================= restart dnode 4===========================") + cluster.dnodes[3].stoptaosd() + cluster.dnodes[3].starttaosd() + tdLog.info("================= restart dnode 5===========================") + cluster.dnodes[4].stoptaosd() + cluster.dnodes[4].starttaosd() + + tdLog.info("start to check consume result") + expectRows = 1 + resultList = tmqCom.selectConsumeResult(expectRows) + totalConsumeRows = 0 + for i in range(expectRows): + totalConsumeRows += resultList[i] + + tdSql.query(queryString) + totalRowsFromQuery = tdSql.getRows() + + tdLog.info("act consume rows: %d, act query rows: %d, expect consume rows: %d, "%(totalConsumeRows, totalRowsFromQuery, expectrowcnt)) + + if totalConsumeRows != totalRowsFromQuery: + tdLog.exit("tmq consume rows error!") + + # tmqCom.checkFileContent(consumerId, queryString) + + tmqCom.waitSubscriptionExit(tdSql, topicFromStb1) + tdSql.query("drop topic %s"%topicFromStb1) + + tdLog.printNoPrefix("======== test case 2 end ...... ") + + def run(self): + self.prepareTestEnv() + self.tmqCase1() + self.tmqCase2() + + def stop(self): + tdSql.close() + tdLog.success(f"{__file__} successfully executed") + +event = threading.Event() + +tdCases.addLinux(__file__, TDTestCase()) +tdCases.addWindows(__file__, TDTestCase()) From 8b42d737423f4c22a576fce716975a59f438b266 Mon Sep 17 00:00:00 2001 From: afwerar <1296468573@qq.com> Date: Mon, 25 Jul 2022 20:31:21 +0800 Subject: [PATCH 34/54] test: fix win test stop taosd error --- tests/pytest/util/dnodes.py | 2 +- tests/system-test/6-cluster/clusterCommonCheck.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/pytest/util/dnodes.py b/tests/pytest/util/dnodes.py index 59e247105c..20e4e4abe6 100644 --- a/tests/pytest/util/dnodes.py +++ b/tests/pytest/util/dnodes.py @@ -518,7 +518,7 @@ class TDDnode: if self.running != 0: if platform.system().lower() == 'windows': - psCmd = "for /f %%a in ('wmic process where \"name='taosd.exe' and CommandLine like '%%dnode%d%%'\" get processId ^| xargs echo ^| awk ^'{print $2}^'') do @(ps | grep %%a | awk '{print $1}' | xargs kill -INT )" % (self.index) + psCmd = "for /f %%a in ('wmic process where \"name='taosd.exe' and CommandLine like '%%dnode%d%%'\" get processId ^| xargs echo ^| awk ^'{print $2}^' ^&^& echo aa') do @(ps | grep %%a | awk '{print $1}' )" % (self.index) else: psCmd = "ps -ef|grep -w %s| grep dnode%d|grep -v grep | awk '{print $2}'" % (toBeKilled,self.index) processID = subprocess.check_output( diff --git a/tests/system-test/6-cluster/clusterCommonCheck.py b/tests/system-test/6-cluster/clusterCommonCheck.py index 294f7cf61c..992d77b03b 100644 --- a/tests/system-test/6-cluster/clusterCommonCheck.py +++ b/tests/system-test/6-cluster/clusterCommonCheck.py @@ -40,7 +40,7 @@ class ClusterComCheck: def checkDnodes(self,dnodeNumbers): count=0 # print(tdSql) - while count < 5: + while count < 30: tdSql.query("show dnodes") # tdLog.debug(tdSql.queryResult) status=0 @@ -50,13 +50,13 @@ class ClusterComCheck: tdLog.info(status) if status == dnodeNumbers: - tdLog.success("it find cluster with %d dnodes and check that all cluster dnodes are ready within 5s! " %dnodeNumbers) + tdLog.success("it find cluster with %d dnodes and check that all cluster dnodes are ready within 30s! " %dnodeNumbers) return True count+=1 time.sleep(1) else: tdLog.debug(tdSql.queryResult) - tdLog.exit("it find cluster with %d dnodes but check that there dnodes are not ready within 5s ! "%dnodeNumbers) + tdLog.exit("it find cluster with %d dnodes but check that there dnodes are not ready within 30s ! "%dnodeNumbers) def checkDbRows(self,dbNumbers): dbNumbers=int(dbNumbers) From 4ad4ffd6f5ae477d276f5a86162b2f2799360ffa Mon Sep 17 00:00:00 2001 From: Ganlin Zhao Date: Mon, 25 Jul 2022 20:40:58 +0800 Subject: [PATCH 35/54] fix(query): fix apercentile merge function percent parameter not reserved cause crash_gen report invalid read TD-17795 --- source/libs/function/src/builtins.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/source/libs/function/src/builtins.c b/source/libs/function/src/builtins.c index 324a17320e..e94d6368fd 100644 --- a/source/libs/function/src/builtins.c +++ b/source/libs/function/src/builtins.c @@ -557,11 +557,13 @@ static int32_t translateApercentileImpl(SFunctionNode* pFunc, char* pErrBuf, int pFunc->node.resType = (SDataType){.bytes = getApercentileMaxSize() + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY}; } else { - if (1 != numOfParams) { + // original percent param is reserved + if (2 != numOfParams) { return invaildFuncParaNumErrMsg(pErrBuf, len, pFunc->functionName); } uint8_t para1Type = ((SExprNode*)nodesListGetNode(pFunc->pParameterList, 0))->resType.type; - if (TSDB_DATA_TYPE_BINARY != para1Type) { + uint8_t para2Type = ((SExprNode*)nodesListGetNode(pFunc->pParameterList, 1))->resType.type; + if (TSDB_DATA_TYPE_BINARY != para1Type || !IS_INTEGER_TYPE(para2Type)) { return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); } @@ -621,7 +623,7 @@ static int32_t translateTopBot(SFunctionNode* pFunc, char* pErrBuf, int32_t len) return TSDB_CODE_SUCCESS; } -int32_t topBotCreateMergePara(SNodeList* pRawParameters, SNode* pPartialRes, SNodeList** pParameters) { +static int32_t reserveFirstMergeParam(SNodeList* pRawParameters, SNode* pPartialRes, SNodeList** pParameters) { int32_t code = nodesListMakeAppend(pParameters, pPartialRes); if (TSDB_CODE_SUCCESS == code) { code = nodesListStrictAppend(*pParameters, nodesCloneNode(nodesListGetNode(pRawParameters, 1))); @@ -629,6 +631,14 @@ int32_t topBotCreateMergePara(SNodeList* pRawParameters, SNode* pPartialRes, SNo return TSDB_CODE_SUCCESS; } +int32_t topBotCreateMergeParam(SNodeList* pRawParameters, SNode* pPartialRes, SNodeList** pParameters) { + return reserveFirstMergeParam(pRawParameters, pPartialRes, pParameters); +} + +int32_t apercentileCreateMergeParam(SNodeList* pRawParameters, SNode* pPartialRes, SNodeList** pParameters) { + return reserveFirstMergeParam(pRawParameters, pPartialRes, pParameters); +} + static int32_t translateSpread(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { if (1 != LIST_LENGTH(pFunc->pParameterList)) { return invaildFuncParaNumErrMsg(pErrBuf, len, pFunc->functionName); @@ -2068,7 +2078,8 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .invertFunc = NULL, .combineFunc = apercentileCombine, .pPartialFunc = "_apercentile_partial", - .pMergeFunc = "_apercentile_merge" + .pMergeFunc = "_apercentile_merge", + .createMergeParaFuc = apercentileCreateMergeParam }, { .name = "_apercentile_partial", @@ -2107,7 +2118,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .combineFunc = topCombine, .pPartialFunc = "top", .pMergeFunc = "top", - .createMergeParaFuc = topBotCreateMergePara + .createMergeParaFuc = topBotCreateMergeParam }, { .name = "bottom", @@ -2122,7 +2133,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .combineFunc = bottomCombine, .pPartialFunc = "bottom", .pMergeFunc = "bottom", - .createMergeParaFuc = topBotCreateMergePara + .createMergeParaFuc = topBotCreateMergeParam }, { .name = "spread", From 1ddbff0acf5175225b8b1ec9ed30911a8ae5f867 Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Mon, 25 Jul 2022 21:09:06 +0800 Subject: [PATCH 36/54] feat: add db options of wal --- include/common/tmsg.h | 6 +- include/common/ttokendef.h | 514 +- include/libs/nodes/cmdnodes.h | 4 + include/util/tdef.h | 9 + source/common/src/tmsg.c | 8 + source/libs/parser/inc/parAst.h | 6 +- source/libs/parser/inc/sql.y | 14 + source/libs/parser/src/parAstCreater.c | 12 + source/libs/parser/src/parTokenizer.c | 4 + source/libs/parser/src/parTranslater.c | 19 + source/libs/parser/src/sql.c | 5860 ++++++++++--------- source/libs/parser/test/parInitialCTest.cpp | 22 +- 12 files changed, 3323 insertions(+), 3155 deletions(-) diff --git a/include/common/tmsg.h b/include/common/tmsg.h index ee19969e50..0d0eb841bc 100644 --- a/include/common/tmsg.h +++ b/include/common/tmsg.h @@ -748,6 +748,10 @@ typedef struct { int8_t ignoreExist; int32_t numOfRetensions; SArray* pRetensions; // SRetention + int32_t walRetentionPeriod; + int32_t walRetentionSize; + int32_t walRollPeriod; + int32_t walSegmentSize; } SCreateDbReq; int32_t tSerializeSCreateDbReq(void* buf, int32_t bufLen, SCreateDbReq* pReq); @@ -1977,7 +1981,7 @@ typedef struct SVCreateTbReq { union { struct { char* name; // super table name - uint8_t tagNum; + uint8_t tagNum; tb_uid_t suid; SArray* tagName; uint8_t* pTag; diff --git a/include/common/ttokendef.h b/include/common/ttokendef.h index 0fce573af9..3d9eabaa9e 100644 --- a/include/common/ttokendef.h +++ b/include/common/ttokendef.h @@ -16,261 +16,265 @@ #ifndef _TD_COMMON_TOKEN_H_ #define _TD_COMMON_TOKEN_H_ -#define TK_OR 1 -#define TK_AND 2 -#define TK_UNION 3 -#define TK_ALL 4 -#define TK_MINUS 5 -#define TK_EXCEPT 6 -#define TK_INTERSECT 7 -#define TK_NK_BITAND 8 -#define TK_NK_BITOR 9 -#define TK_NK_LSHIFT 10 -#define TK_NK_RSHIFT 11 -#define TK_NK_PLUS 12 -#define TK_NK_MINUS 13 -#define TK_NK_STAR 14 -#define TK_NK_SLASH 15 -#define TK_NK_REM 16 -#define TK_NK_CONCAT 17 -#define TK_CREATE 18 -#define TK_ACCOUNT 19 -#define TK_NK_ID 20 -#define TK_PASS 21 -#define TK_NK_STRING 22 -#define TK_ALTER 23 -#define TK_PPS 24 -#define TK_TSERIES 25 -#define TK_STORAGE 26 -#define TK_STREAMS 27 -#define TK_QTIME 28 -#define TK_DBS 29 -#define TK_USERS 30 -#define TK_CONNS 31 -#define TK_STATE 32 -#define TK_USER 33 -#define TK_ENABLE 34 -#define TK_NK_INTEGER 35 -#define TK_SYSINFO 36 -#define TK_DROP 37 -#define TK_GRANT 38 -#define TK_ON 39 -#define TK_TO 40 -#define TK_REVOKE 41 -#define TK_FROM 42 -#define TK_NK_COMMA 43 -#define TK_READ 44 -#define TK_WRITE 45 -#define TK_NK_DOT 46 -#define TK_DNODE 47 -#define TK_PORT 48 -#define TK_DNODES 49 -#define TK_NK_IPTOKEN 50 -#define TK_LOCAL 51 -#define TK_QNODE 52 -#define TK_BNODE 53 -#define TK_SNODE 54 -#define TK_MNODE 55 -#define TK_DATABASE 56 -#define TK_USE 57 -#define TK_FLUSH 58 -#define TK_TRIM 59 -#define TK_IF 60 -#define TK_NOT 61 -#define TK_EXISTS 62 -#define TK_BUFFER 63 -#define TK_CACHEMODEL 64 -#define TK_CACHESIZE 65 -#define TK_COMP 66 -#define TK_DURATION 67 -#define TK_NK_VARIABLE 68 -#define TK_FSYNC 69 -#define TK_MAXROWS 70 -#define TK_MINROWS 71 -#define TK_KEEP 72 -#define TK_PAGES 73 -#define TK_PAGESIZE 74 -#define TK_PRECISION 75 -#define TK_REPLICA 76 -#define TK_STRICT 77 -#define TK_WAL 78 -#define TK_VGROUPS 79 -#define TK_SINGLE_STABLE 80 -#define TK_RETENTIONS 81 -#define TK_SCHEMALESS 82 -#define TK_NK_COLON 83 -#define TK_TABLE 84 -#define TK_NK_LP 85 -#define TK_NK_RP 86 -#define TK_STABLE 87 -#define TK_ADD 88 -#define TK_COLUMN 89 -#define TK_MODIFY 90 -#define TK_RENAME 91 -#define TK_TAG 92 -#define TK_SET 93 -#define TK_NK_EQ 94 -#define TK_USING 95 -#define TK_TAGS 96 -#define TK_COMMENT 97 -#define TK_BOOL 98 -#define TK_TINYINT 99 -#define TK_SMALLINT 100 -#define TK_INT 101 -#define TK_INTEGER 102 -#define TK_BIGINT 103 -#define TK_FLOAT 104 -#define TK_DOUBLE 105 -#define TK_BINARY 106 -#define TK_TIMESTAMP 107 -#define TK_NCHAR 108 -#define TK_UNSIGNED 109 -#define TK_JSON 110 -#define TK_VARCHAR 111 -#define TK_MEDIUMBLOB 112 -#define TK_BLOB 113 -#define TK_VARBINARY 114 -#define TK_DECIMAL 115 -#define TK_MAX_DELAY 116 -#define TK_WATERMARK 117 -#define TK_ROLLUP 118 -#define TK_TTL 119 -#define TK_SMA 120 -#define TK_FIRST 121 -#define TK_LAST 122 -#define TK_SHOW 123 -#define TK_DATABASES 124 -#define TK_TABLES 125 -#define TK_STABLES 126 -#define TK_MNODES 127 -#define TK_MODULES 128 -#define TK_QNODES 129 -#define TK_FUNCTIONS 130 -#define TK_INDEXES 131 -#define TK_ACCOUNTS 132 -#define TK_APPS 133 -#define TK_CONNECTIONS 134 -#define TK_LICENCE 135 -#define TK_GRANTS 136 -#define TK_QUERIES 137 -#define TK_SCORES 138 -#define TK_TOPICS 139 -#define TK_VARIABLES 140 -#define TK_BNODES 141 -#define TK_SNODES 142 -#define TK_CLUSTER 143 -#define TK_TRANSACTIONS 144 -#define TK_DISTRIBUTED 145 -#define TK_CONSUMERS 146 -#define TK_SUBSCRIPTIONS 147 -#define TK_LIKE 148 -#define TK_INDEX 149 -#define TK_FUNCTION 150 -#define TK_INTERVAL 151 -#define TK_TOPIC 152 -#define TK_AS 153 -#define TK_WITH 154 -#define TK_META 155 -#define TK_CONSUMER 156 -#define TK_GROUP 157 -#define TK_DESC 158 -#define TK_DESCRIBE 159 -#define TK_RESET 160 -#define TK_QUERY 161 -#define TK_CACHE 162 -#define TK_EXPLAIN 163 -#define TK_ANALYZE 164 -#define TK_VERBOSE 165 -#define TK_NK_BOOL 166 -#define TK_RATIO 167 -#define TK_NK_FLOAT 168 -#define TK_COMPACT 169 -#define TK_VNODES 170 -#define TK_IN 171 -#define TK_OUTPUTTYPE 172 -#define TK_AGGREGATE 173 -#define TK_BUFSIZE 174 -#define TK_STREAM 175 -#define TK_INTO 176 -#define TK_TRIGGER 177 -#define TK_AT_ONCE 178 -#define TK_WINDOW_CLOSE 179 -#define TK_IGNORE 180 -#define TK_EXPIRED 181 -#define TK_KILL 182 -#define TK_CONNECTION 183 -#define TK_TRANSACTION 184 -#define TK_BALANCE 185 -#define TK_VGROUP 186 -#define TK_MERGE 187 -#define TK_REDISTRIBUTE 188 -#define TK_SPLIT 189 -#define TK_SYNCDB 190 -#define TK_DELETE 191 -#define TK_INSERT 192 -#define TK_NULL 193 -#define TK_NK_QUESTION 194 -#define TK_NK_ARROW 195 -#define TK_ROWTS 196 -#define TK_TBNAME 197 -#define TK_QSTART 198 -#define TK_QEND 199 -#define TK_QDURATION 200 -#define TK_WSTART 201 -#define TK_WEND 202 -#define TK_WDURATION 203 -#define TK_CAST 204 -#define TK_NOW 205 -#define TK_TODAY 206 -#define TK_TIMEZONE 207 -#define TK_CLIENT_VERSION 208 -#define TK_SERVER_VERSION 209 -#define TK_SERVER_STATUS 210 -#define TK_CURRENT_USER 211 -#define TK_COUNT 212 -#define TK_LAST_ROW 213 -#define TK_BETWEEN 214 -#define TK_IS 215 -#define TK_NK_LT 216 -#define TK_NK_GT 217 -#define TK_NK_LE 218 -#define TK_NK_GE 219 -#define TK_NK_NE 220 -#define TK_MATCH 221 -#define TK_NMATCH 222 -#define TK_CONTAINS 223 -#define TK_JOIN 224 -#define TK_INNER 225 -#define TK_SELECT 226 -#define TK_DISTINCT 227 -#define TK_WHERE 228 -#define TK_PARTITION 229 -#define TK_BY 230 -#define TK_SESSION 231 -#define TK_STATE_WINDOW 232 -#define TK_SLIDING 233 -#define TK_FILL 234 -#define TK_VALUE 235 -#define TK_NONE 236 -#define TK_PREV 237 -#define TK_LINEAR 238 -#define TK_NEXT 239 -#define TK_HAVING 240 -#define TK_RANGE 241 -#define TK_EVERY 242 -#define TK_ORDER 243 -#define TK_SLIMIT 244 -#define TK_SOFFSET 245 -#define TK_LIMIT 246 -#define TK_OFFSET 247 -#define TK_ASC 248 -#define TK_NULLS 249 -#define TK_ID 250 -#define TK_NK_BITNOT 251 -#define TK_VALUES 252 -#define TK_IMPORT 253 -#define TK_NK_SEMI 254 -#define TK_FILE 255 +#define TK_OR 1 +#define TK_AND 2 +#define TK_UNION 3 +#define TK_ALL 4 +#define TK_MINUS 5 +#define TK_EXCEPT 6 +#define TK_INTERSECT 7 +#define TK_NK_BITAND 8 +#define TK_NK_BITOR 9 +#define TK_NK_LSHIFT 10 +#define TK_NK_RSHIFT 11 +#define TK_NK_PLUS 12 +#define TK_NK_MINUS 13 +#define TK_NK_STAR 14 +#define TK_NK_SLASH 15 +#define TK_NK_REM 16 +#define TK_NK_CONCAT 17 +#define TK_CREATE 18 +#define TK_ACCOUNT 19 +#define TK_NK_ID 20 +#define TK_PASS 21 +#define TK_NK_STRING 22 +#define TK_ALTER 23 +#define TK_PPS 24 +#define TK_TSERIES 25 +#define TK_STORAGE 26 +#define TK_STREAMS 27 +#define TK_QTIME 28 +#define TK_DBS 29 +#define TK_USERS 30 +#define TK_CONNS 31 +#define TK_STATE 32 +#define TK_USER 33 +#define TK_ENABLE 34 +#define TK_NK_INTEGER 35 +#define TK_SYSINFO 36 +#define TK_DROP 37 +#define TK_GRANT 38 +#define TK_ON 39 +#define TK_TO 40 +#define TK_REVOKE 41 +#define TK_FROM 42 +#define TK_NK_COMMA 43 +#define TK_READ 44 +#define TK_WRITE 45 +#define TK_NK_DOT 46 +#define TK_DNODE 47 +#define TK_PORT 48 +#define TK_DNODES 49 +#define TK_NK_IPTOKEN 50 +#define TK_LOCAL 51 +#define TK_QNODE 52 +#define TK_BNODE 53 +#define TK_SNODE 54 +#define TK_MNODE 55 +#define TK_DATABASE 56 +#define TK_USE 57 +#define TK_FLUSH 58 +#define TK_TRIM 59 +#define TK_IF 60 +#define TK_NOT 61 +#define TK_EXISTS 62 +#define TK_BUFFER 63 +#define TK_CACHEMODEL 64 +#define TK_CACHESIZE 65 +#define TK_COMP 66 +#define TK_DURATION 67 +#define TK_NK_VARIABLE 68 +#define TK_FSYNC 69 +#define TK_MAXROWS 70 +#define TK_MINROWS 71 +#define TK_KEEP 72 +#define TK_PAGES 73 +#define TK_PAGESIZE 74 +#define TK_PRECISION 75 +#define TK_REPLICA 76 +#define TK_STRICT 77 +#define TK_WAL 78 +#define TK_VGROUPS 79 +#define TK_SINGLE_STABLE 80 +#define TK_RETENTIONS 81 +#define TK_SCHEMALESS 82 +#define TK_WAL_RETENTION_PERIOD 83 +#define TK_WAL_RETENTION_SIZE 84 +#define TK_WAL_ROLL_PERIOD 85 +#define TK_WAL_SEGMENT_SIZE 86 +#define TK_NK_COLON 87 +#define TK_TABLE 88 +#define TK_NK_LP 89 +#define TK_NK_RP 90 +#define TK_STABLE 91 +#define TK_ADD 92 +#define TK_COLUMN 93 +#define TK_MODIFY 94 +#define TK_RENAME 95 +#define TK_TAG 96 +#define TK_SET 97 +#define TK_NK_EQ 98 +#define TK_USING 99 +#define TK_TAGS 100 +#define TK_COMMENT 101 +#define TK_BOOL 102 +#define TK_TINYINT 103 +#define TK_SMALLINT 104 +#define TK_INT 105 +#define TK_INTEGER 106 +#define TK_BIGINT 107 +#define TK_FLOAT 108 +#define TK_DOUBLE 109 +#define TK_BINARY 110 +#define TK_TIMESTAMP 111 +#define TK_NCHAR 112 +#define TK_UNSIGNED 113 +#define TK_JSON 114 +#define TK_VARCHAR 115 +#define TK_MEDIUMBLOB 116 +#define TK_BLOB 117 +#define TK_VARBINARY 118 +#define TK_DECIMAL 119 +#define TK_MAX_DELAY 120 +#define TK_WATERMARK 121 +#define TK_ROLLUP 122 +#define TK_TTL 123 +#define TK_SMA 124 +#define TK_FIRST 125 +#define TK_LAST 126 +#define TK_SHOW 127 +#define TK_DATABASES 128 +#define TK_TABLES 129 +#define TK_STABLES 130 +#define TK_MNODES 131 +#define TK_MODULES 132 +#define TK_QNODES 133 +#define TK_FUNCTIONS 134 +#define TK_INDEXES 135 +#define TK_ACCOUNTS 136 +#define TK_APPS 137 +#define TK_CONNECTIONS 138 +#define TK_LICENCE 139 +#define TK_GRANTS 140 +#define TK_QUERIES 141 +#define TK_SCORES 142 +#define TK_TOPICS 143 +#define TK_VARIABLES 144 +#define TK_BNODES 145 +#define TK_SNODES 146 +#define TK_CLUSTER 147 +#define TK_TRANSACTIONS 148 +#define TK_DISTRIBUTED 149 +#define TK_CONSUMERS 150 +#define TK_SUBSCRIPTIONS 151 +#define TK_LIKE 152 +#define TK_INDEX 153 +#define TK_FUNCTION 154 +#define TK_INTERVAL 155 +#define TK_TOPIC 156 +#define TK_AS 157 +#define TK_WITH 158 +#define TK_META 159 +#define TK_CONSUMER 160 +#define TK_GROUP 161 +#define TK_DESC 162 +#define TK_DESCRIBE 163 +#define TK_RESET 164 +#define TK_QUERY 165 +#define TK_CACHE 166 +#define TK_EXPLAIN 167 +#define TK_ANALYZE 168 +#define TK_VERBOSE 169 +#define TK_NK_BOOL 170 +#define TK_RATIO 171 +#define TK_NK_FLOAT 172 +#define TK_COMPACT 173 +#define TK_VNODES 174 +#define TK_IN 175 +#define TK_OUTPUTTYPE 176 +#define TK_AGGREGATE 177 +#define TK_BUFSIZE 178 +#define TK_STREAM 179 +#define TK_INTO 180 +#define TK_TRIGGER 181 +#define TK_AT_ONCE 182 +#define TK_WINDOW_CLOSE 183 +#define TK_IGNORE 184 +#define TK_EXPIRED 185 +#define TK_KILL 186 +#define TK_CONNECTION 187 +#define TK_TRANSACTION 188 +#define TK_BALANCE 189 +#define TK_VGROUP 190 +#define TK_MERGE 191 +#define TK_REDISTRIBUTE 192 +#define TK_SPLIT 193 +#define TK_SYNCDB 194 +#define TK_DELETE 195 +#define TK_INSERT 196 +#define TK_NULL 197 +#define TK_NK_QUESTION 198 +#define TK_NK_ARROW 199 +#define TK_ROWTS 200 +#define TK_TBNAME 201 +#define TK_QSTART 202 +#define TK_QEND 203 +#define TK_QDURATION 204 +#define TK_WSTART 205 +#define TK_WEND 206 +#define TK_WDURATION 207 +#define TK_CAST 208 +#define TK_NOW 209 +#define TK_TODAY 210 +#define TK_TIMEZONE 211 +#define TK_CLIENT_VERSION 212 +#define TK_SERVER_VERSION 213 +#define TK_SERVER_STATUS 214 +#define TK_CURRENT_USER 215 +#define TK_COUNT 216 +#define TK_LAST_ROW 217 +#define TK_BETWEEN 218 +#define TK_IS 219 +#define TK_NK_LT 220 +#define TK_NK_GT 221 +#define TK_NK_LE 222 +#define TK_NK_GE 223 +#define TK_NK_NE 224 +#define TK_MATCH 225 +#define TK_NMATCH 226 +#define TK_CONTAINS 227 +#define TK_JOIN 228 +#define TK_INNER 229 +#define TK_SELECT 230 +#define TK_DISTINCT 231 +#define TK_WHERE 232 +#define TK_PARTITION 233 +#define TK_BY 234 +#define TK_SESSION 235 +#define TK_STATE_WINDOW 236 +#define TK_SLIDING 237 +#define TK_FILL 238 +#define TK_VALUE 239 +#define TK_NONE 240 +#define TK_PREV 241 +#define TK_LINEAR 242 +#define TK_NEXT 243 +#define TK_HAVING 244 +#define TK_RANGE 245 +#define TK_EVERY 246 +#define TK_ORDER 247 +#define TK_SLIMIT 248 +#define TK_SOFFSET 249 +#define TK_LIMIT 250 +#define TK_OFFSET 251 +#define TK_ASC 252 +#define TK_NULLS 253 +#define TK_ID 254 +#define TK_NK_BITNOT 255 +#define TK_VALUES 256 +#define TK_IMPORT 257 +#define TK_NK_SEMI 258 +#define TK_FILE 259 #define TK_NK_SPACE 300 #define TK_NK_COMMENT 301 diff --git a/include/libs/nodes/cmdnodes.h b/include/libs/nodes/cmdnodes.h index e13f85002c..fc1d524506 100644 --- a/include/libs/nodes/cmdnodes.h +++ b/include/libs/nodes/cmdnodes.h @@ -74,6 +74,10 @@ typedef struct SDatabaseOptions { int8_t singleStable; SNodeList* pRetentions; int8_t schemaless; + int32_t walRetentionPeriod; + int32_t walRetentionSize; + int32_t walRollPeriod; + int32_t walSegmentSize; } SDatabaseOptions; typedef struct SCreateDatabaseStmt { diff --git a/include/util/tdef.h b/include/util/tdef.h index 688fe5fe85..6d893765fc 100644 --- a/include/util/tdef.h +++ b/include/util/tdef.h @@ -358,6 +358,15 @@ typedef enum ELogicConditionType { #define TSDB_DB_SCHEMALESS_OFF 0 #define TSDB_DEFAULT_DB_SCHEMALESS TSDB_DB_SCHEMALESS_OFF +#define TSDB_DB_MIN_WAL_RETENTION_PERIOD -1 +#define TSDB_DEFAULT_DB_WAL_RETENTION_PERIOD 0 +#define TSDB_DB_MIN_WAL_RETENTION_SIZE -1 +#define TSDB_DEFAULT_DB_WAL_RETENTION_SIZE 0 +#define TSDB_DB_MIN_WAL_ROLL_PERIOD 0 +#define TSDB_DEFAULT_DB_WAL_ROLL_PERIOD 0 +#define TSDB_DB_MIN_WAL_SEGMENT_SIZE 0 +#define TSDB_DEFAULT_DB_WAL_SEGMENT_SIZE 0 + #define TSDB_MIN_ROLLUP_MAX_DELAY 1 // unit millisecond #define TSDB_MAX_ROLLUP_MAX_DELAY (15 * 60 * 1000) #define TSDB_MIN_ROLLUP_WATERMARK 0 // unit millisecond diff --git a/source/common/src/tmsg.c b/source/common/src/tmsg.c index c94c624f89..f87d336ec2 100644 --- a/source/common/src/tmsg.c +++ b/source/common/src/tmsg.c @@ -2018,6 +2018,10 @@ int32_t tSerializeSCreateDbReq(void *buf, int32_t bufLen, SCreateDbReq *pReq) { if (tEncodeI8(&encoder, pReq->strict) < 0) return -1; if (tEncodeI8(&encoder, pReq->cacheLast) < 0) return -1; if (tEncodeI8(&encoder, pReq->schemaless) < 0) return -1; + if (tEncodeI32(&encoder, pReq->walRetentionPeriod) < 0) return -1; + if (tEncodeI32(&encoder, pReq->walRetentionSize) < 0) return -1; + if (tEncodeI32(&encoder, pReq->walRollPeriod) < 0) return -1; + if (tEncodeI32(&encoder, pReq->walSegmentSize) < 0) return -1; if (tEncodeI8(&encoder, pReq->ignoreExist) < 0) return -1; if (tEncodeI32(&encoder, pReq->numOfRetensions) < 0) return -1; for (int32_t i = 0; i < pReq->numOfRetensions; ++i) { @@ -2060,6 +2064,10 @@ int32_t tDeserializeSCreateDbReq(void *buf, int32_t bufLen, SCreateDbReq *pReq) if (tDecodeI8(&decoder, &pReq->strict) < 0) return -1; if (tDecodeI8(&decoder, &pReq->cacheLast) < 0) return -1; if (tDecodeI8(&decoder, &pReq->schemaless) < 0) return -1; + if (tDecodeI32(&decoder, &pReq->walRetentionPeriod) < 0) return -1; + if (tDecodeI32(&decoder, &pReq->walRetentionSize) < 0) return -1; + if (tDecodeI32(&decoder, &pReq->walRollPeriod) < 0) return -1; + if (tDecodeI32(&decoder, &pReq->walSegmentSize) < 0) return -1; if (tDecodeI8(&decoder, &pReq->ignoreExist) < 0) return -1; if (tDecodeI32(&decoder, &pReq->numOfRetensions) < 0) return -1; pReq->pRetensions = taosArrayInit(pReq->numOfRetensions, sizeof(SRetention)); diff --git a/source/libs/parser/inc/parAst.h b/source/libs/parser/inc/parAst.h index 12c18733b1..705ba9d339 100644 --- a/source/libs/parser/inc/parAst.h +++ b/source/libs/parser/inc/parAst.h @@ -55,7 +55,11 @@ typedef enum EDatabaseOptionType { DB_OPTION_VGROUPS, DB_OPTION_SINGLE_STABLE, DB_OPTION_RETENTIONS, - DB_OPTION_SCHEMALESS + DB_OPTION_SCHEMALESS, + DB_OPTION_WAL_RETENTION_PERIOD, + DB_OPTION_WAL_RETENTION_SIZE, + DB_OPTION_WAL_ROLL_PERIOD, + DB_OPTION_WAL_SEGMENT_SIZE } EDatabaseOptionType; typedef enum ETableOptionType { diff --git a/source/libs/parser/inc/sql.y b/source/libs/parser/inc/sql.y index 920277370a..f4e8779902 100644 --- a/source/libs/parser/inc/sql.y +++ b/source/libs/parser/inc/sql.y @@ -191,6 +191,20 @@ db_options(A) ::= db_options(B) VGROUPS NK_INTEGER(C). db_options(A) ::= db_options(B) SINGLE_STABLE NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_SINGLE_STABLE, &C); } db_options(A) ::= db_options(B) RETENTIONS retention_list(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_RETENTIONS, C); } db_options(A) ::= db_options(B) SCHEMALESS NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_SCHEMALESS, &C); } +db_options(A) ::= db_options(B) WAL_RETENTION_PERIOD NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_WAL_RETENTION_PERIOD, &C); } +db_options(A) ::= db_options(B) WAL_RETENTION_PERIOD NK_MINUS(D) NK_INTEGER(C). { + SToken t = D; + t.n = (C.z + C.n) - D.z; + A = setDatabaseOption(pCxt, B, DB_OPTION_WAL_RETENTION_PERIOD, &t); + } +db_options(A) ::= db_options(B) WAL_RETENTION_SIZE NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_WAL_RETENTION_SIZE, &C); } +db_options(A) ::= db_options(B) WAL_RETENTION_SIZE NK_MINUS(D) NK_INTEGER(C). { + SToken t = D; + t.n = (C.z + C.n) - D.z; + A = setDatabaseOption(pCxt, B, DB_OPTION_WAL_RETENTION_SIZE, &t); + } +db_options(A) ::= db_options(B) WAL_ROLL_PERIOD NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_WAL_ROLL_PERIOD, &C); } +db_options(A) ::= db_options(B) WAL_SEGMENT_SIZE NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_WAL_SEGMENT_SIZE, &C); } alter_db_options(A) ::= alter_db_option(B). { A = createAlterDatabaseOptions(pCxt); A = setAlterDatabaseOption(pCxt, A, &B); } alter_db_options(A) ::= alter_db_options(B) alter_db_option(C). { A = setAlterDatabaseOption(pCxt, B, &C); } diff --git a/source/libs/parser/src/parAstCreater.c b/source/libs/parser/src/parAstCreater.c index a54dae1ee9..ff2157fe67 100644 --- a/source/libs/parser/src/parAstCreater.c +++ b/source/libs/parser/src/parAstCreater.c @@ -894,6 +894,18 @@ SNode* setDatabaseOption(SAstCreateContext* pCxt, SNode* pOptions, EDatabaseOpti case DB_OPTION_RETENTIONS: ((SDatabaseOptions*)pOptions)->pRetentions = pVal; break; + case DB_OPTION_WAL_RETENTION_PERIOD: + ((SDatabaseOptions*)pOptions)->walRetentionPeriod = taosStr2Int32(((SToken*)pVal)->z, NULL, 10); + break; + case DB_OPTION_WAL_RETENTION_SIZE: + ((SDatabaseOptions*)pOptions)->walRetentionSize = taosStr2Int32(((SToken*)pVal)->z, NULL, 10); + break; + case DB_OPTION_WAL_ROLL_PERIOD: + ((SDatabaseOptions*)pOptions)->walRollPeriod = taosStr2Int32(((SToken*)pVal)->z, NULL, 10); + break; + case DB_OPTION_WAL_SEGMENT_SIZE: + ((SDatabaseOptions*)pOptions)->walSegmentSize = taosStr2Int32(((SToken*)pVal)->z, NULL, 10); + break; default: break; } diff --git a/source/libs/parser/src/parTokenizer.c b/source/libs/parser/src/parTokenizer.c index b9d907c600..e204f37a04 100644 --- a/source/libs/parser/src/parTokenizer.c +++ b/source/libs/parser/src/parTokenizer.c @@ -234,6 +234,10 @@ static SKeyword keywordTable[] = { {"VGROUPS", TK_VGROUPS}, {"VNODES", TK_VNODES}, {"WAL", TK_WAL}, + {"WAL_RETENTION_PERIOD", TK_WAL_RETENTION_PERIOD}, + {"WAL_RETENTION_SIZE", TK_WAL_RETENTION_SIZE}, + {"WAL_ROLL_PERIOD", TK_WAL_ROLL_PERIOD}, + {"WAL_SEGMENT_SIZE", TK_WAL_SEGMENT_SIZE}, {"WATERMARK", TK_WATERMARK}, {"WHERE", TK_WHERE}, {"WINDOW_CLOSE", TK_WINDOW_CLOSE}, diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index 3930e46054..4a578e9b86 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -2984,6 +2984,10 @@ static int32_t buildCreateDbReq(STranslateContext* pCxt, SCreateDatabaseStmt* pS pReq->cacheLast = pStmt->pOptions->cacheModel; pReq->cacheLastSize = pStmt->pOptions->cacheLastSize; pReq->schemaless = pStmt->pOptions->schemaless; + pReq->walRetentionPeriod = pStmt->pOptions->walRetentionPeriod; + pReq->walRetentionSize = pStmt->pOptions->walRetentionSize; + pReq->walRollPeriod = pStmt->pOptions->walRollPeriod; + pReq->walSegmentSize = pStmt->pOptions->walSegmentSize; pReq->ignoreExist = pStmt->ignoreExists; return buildCreateDbRetentions(pStmt->pOptions->pRetentions, pReq); } @@ -3252,6 +3256,21 @@ static int32_t checkDatabaseOptions(STranslateContext* pCxt, const char* pDbName if (TSDB_CODE_SUCCESS == code) { code = checkDbEnumOption(pCxt, "schemaless", pOptions->schemaless, TSDB_DB_SCHEMALESS_ON, TSDB_DB_SCHEMALESS_OFF); } + if (TSDB_CODE_SUCCESS == code) { + code = checkDbRangeOption(pCxt, "walRetentionPeriod", pOptions->walRetentionPeriod, + TSDB_DB_MIN_WAL_RETENTION_PERIOD, INT32_MAX); + } + if (TSDB_CODE_SUCCESS == code) { + code = checkDbRangeOption(pCxt, "walRetentionSize", pOptions->walRetentionSize, TSDB_DB_MIN_WAL_RETENTION_SIZE, + INT32_MAX); + } + if (TSDB_CODE_SUCCESS == code) { + code = checkDbRangeOption(pCxt, "walRollPeriod", pOptions->walRollPeriod, TSDB_DB_MIN_WAL_ROLL_PERIOD, INT32_MAX); + } + if (TSDB_CODE_SUCCESS == code) { + code = + checkDbRangeOption(pCxt, "walSegmentSize", pOptions->walSegmentSize, TSDB_DB_MIN_WAL_SEGMENT_SIZE, INT32_MAX); + } if (TSDB_CODE_SUCCESS == code) { code = checkOptionsDependency(pCxt, pDbName, pOptions); } diff --git a/source/libs/parser/src/sql.c b/source/libs/parser/src/sql.c index 6b4c6704f6..7bac546298 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 379 +#define YYNOCODE 383 #define YYACTIONTYPE unsigned short int #define ParseTOKENTYPE SToken typedef union { int yyinit; ParseTOKENTYPE yy0; - EOrder yy58; - bool yy151; - int8_t yy285; - SNodeList* yy356; - SToken yy361; - SAlterOption yy409; - int64_t yy457; - EFillMode yy494; - EJoinType yy504; - EOperatorType yy526; - SDataType yy600; - ENullOrder yy613; - SNode* yy616; - int32_t yy734; + int64_t yy59; + SNode* yy160; + SNodeList* yy180; + SAlterOption yy189; + SDataType yy190; + SToken yy231; + ENullOrder yy283; + EFillMode yy338; + int8_t yy425; + int32_t yy516; + EOperatorType yy598; + bool yy611; + EJoinType yy652; + EOrder yy742; } YYMINORTYPE; #ifndef YYSTACKDEPTH #define YYSTACKDEPTH 100 @@ -139,17 +139,17 @@ typedef union { #define ParseCTX_FETCH #define ParseCTX_STORE #define YYFALLBACK 1 -#define YYNSTATE 669 -#define YYNRULE 488 -#define YYNTOKEN 256 -#define YY_MAX_SHIFT 668 -#define YY_MIN_SHIFTREDUCE 970 -#define YY_MAX_SHIFTREDUCE 1457 -#define YY_ERROR_ACTION 1458 -#define YY_ACCEPT_ACTION 1459 -#define YY_NO_ACTION 1460 -#define YY_MIN_REDUCE 1461 -#define YY_MAX_REDUCE 1948 +#define YYNSTATE 675 +#define YYNRULE 494 +#define YYNTOKEN 260 +#define YY_MAX_SHIFT 674 +#define YY_MIN_SHIFTREDUCE 982 +#define YY_MAX_SHIFTREDUCE 1475 +#define YY_ERROR_ACTION 1476 +#define YY_ACCEPT_ACTION 1477 +#define YY_NO_ACTION 1478 +#define YY_MIN_REDUCE 1479 +#define YY_MAX_REDUCE 1972 /************* End control #defines *******************************************/ #define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0]))) @@ -216,682 +216,696 @@ typedef union { ** yy_default[] Default action for each state. ** *********** Begin parsing tables **********************************************/ -#define YY_ACTTAB_COUNT (2481) +#define YY_ACTTAB_COUNT (2541) static const YYACTIONTYPE yy_action[] = { - /* 0 */ 532, 73, 1459, 440, 555, 441, 1496, 329, 520, 73, - /* 10 */ 1647, 114, 39, 37, 119, 143, 328, 314, 478, 1693, - /* 20 */ 342, 1462, 1257, 1590, 1597, 147, 1645, 555, 1595, 1555, - /* 30 */ 1800, 1591, 124, 1334, 448, 1255, 441, 1496, 548, 558, - /* 40 */ 347, 391, 104, 1640, 1642, 103, 102, 101, 100, 99, - /* 50 */ 98, 97, 96, 95, 439, 124, 1329, 443, 1782, 33, - /* 60 */ 32, 14, 355, 40, 38, 36, 35, 34, 1263, 39, - /* 70 */ 37, 1397, 122, 1283, 1282, 564, 547, 342, 305, 1257, - /* 80 */ 1926, 426, 145, 1926, 1473, 1, 1800, 159, 1868, 1869, - /* 90 */ 1334, 1873, 1255, 163, 584, 122, 1925, 1923, 558, 1751, - /* 100 */ 1923, 583, 64, 1926, 42, 63, 1020, 665, 1019, 557, - /* 110 */ 158, 1868, 1869, 1329, 1873, 560, 162, 81, 14, 1003, - /* 120 */ 1923, 1336, 1337, 30, 263, 1263, 1814, 177, 176, 223, - /* 130 */ 91, 1783, 586, 1785, 1786, 582, 1021, 577, 1588, 63, - /* 140 */ 1860, 1484, 2, 104, 308, 1856, 103, 102, 101, 100, - /* 150 */ 99, 98, 97, 96, 95, 1526, 1926, 489, 488, 1007, - /* 160 */ 1008, 143, 487, 43, 665, 120, 1258, 197, 1256, 164, - /* 170 */ 1598, 484, 1358, 1923, 1152, 1153, 385, 447, 1336, 1337, - /* 180 */ 443, 149, 1751, 63, 1641, 1642, 474, 470, 466, 462, - /* 190 */ 196, 1236, 1237, 1261, 1262, 1363, 1311, 1312, 1314, 1315, - /* 200 */ 1316, 1317, 1318, 1319, 579, 575, 1327, 1328, 1330, 1331, - /* 210 */ 1332, 1333, 1335, 1338, 1020, 1647, 1019, 1926, 74, 489, - /* 220 */ 488, 194, 330, 1258, 487, 1256, 165, 120, 558, 476, - /* 230 */ 162, 1645, 63, 484, 1923, 33, 32, 519, 27, 40, - /* 240 */ 38, 36, 35, 34, 1021, 165, 165, 1692, 555, 302, - /* 250 */ 1261, 1262, 376, 1311, 1312, 1314, 1315, 1316, 1317, 1318, - /* 260 */ 1319, 579, 575, 1327, 1328, 1330, 1331, 1332, 1333, 1335, - /* 270 */ 1338, 39, 37, 1461, 378, 374, 124, 565, 1926, 342, - /* 280 */ 165, 1257, 1782, 193, 186, 1686, 191, 1875, 309, 49, - /* 290 */ 453, 162, 1334, 503, 1255, 1923, 172, 113, 112, 111, - /* 300 */ 110, 109, 108, 107, 106, 105, 501, 1483, 499, 184, - /* 310 */ 1800, 1872, 384, 1296, 383, 1329, 122, 1573, 559, 532, - /* 320 */ 14, 1356, 1482, 1751, 165, 583, 457, 1263, 39, 37, - /* 330 */ 114, 160, 1868, 1869, 532, 1873, 342, 483, 1257, 1523, - /* 340 */ 319, 11, 10, 1418, 2, 55, 445, 1595, 1751, 1334, - /* 350 */ 1814, 1255, 1280, 1394, 92, 1783, 586, 1785, 1786, 582, - /* 360 */ 1737, 577, 1595, 1751, 1860, 1401, 665, 532, 333, 1856, - /* 370 */ 157, 1282, 1329, 165, 1283, 1357, 1647, 457, 167, 1571, - /* 380 */ 1336, 1337, 161, 346, 1263, 541, 1416, 1417, 1419, 1420, - /* 390 */ 1886, 320, 1645, 318, 317, 1595, 480, 1282, 1362, 1481, - /* 400 */ 482, 8, 642, 641, 640, 639, 350, 364, 638, 637, - /* 410 */ 636, 125, 631, 630, 629, 628, 627, 626, 625, 624, - /* 420 */ 136, 620, 481, 665, 1284, 1258, 1370, 1256, 33, 32, - /* 430 */ 165, 549, 40, 38, 36, 35, 34, 1336, 1337, 619, - /* 440 */ 1751, 29, 340, 1351, 1352, 1353, 1354, 1355, 1359, 1360, - /* 450 */ 1361, 1480, 1261, 1262, 1479, 1311, 1312, 1314, 1315, 1316, - /* 460 */ 1317, 1318, 1319, 579, 575, 1327, 1328, 1330, 1331, 1332, - /* 470 */ 1333, 1335, 1338, 33, 32, 218, 619, 40, 38, 36, - /* 480 */ 35, 34, 1258, 482, 1256, 40, 38, 36, 35, 34, - /* 490 */ 1257, 1686, 1751, 33, 32, 1751, 1769, 40, 38, 36, - /* 500 */ 35, 34, 175, 1255, 63, 481, 77, 1765, 22, 1261, - /* 510 */ 1262, 1285, 1311, 1312, 1314, 1315, 1316, 1317, 1318, 1319, - /* 520 */ 579, 575, 1327, 1328, 1330, 1331, 1332, 1333, 1335, 1338, - /* 530 */ 39, 37, 1339, 1761, 1767, 331, 1263, 156, 342, 345, - /* 540 */ 1257, 1782, 165, 1586, 532, 577, 309, 143, 1313, 88, - /* 550 */ 1634, 1334, 1769, 1255, 1765, 389, 1597, 255, 224, 225, - /* 560 */ 33, 32, 121, 1765, 40, 38, 36, 35, 34, 1800, - /* 570 */ 1587, 173, 1595, 1072, 1329, 665, 1393, 559, 1454, 1356, - /* 580 */ 1761, 1767, 1751, 494, 583, 520, 1263, 39, 37, 1761, - /* 590 */ 1767, 337, 577, 532, 1926, 342, 1694, 1257, 504, 71, - /* 600 */ 544, 577, 70, 9, 390, 1478, 1074, 163, 1334, 1814, - /* 610 */ 1255, 1923, 210, 92, 1783, 586, 1785, 1786, 582, 307, - /* 620 */ 577, 1595, 522, 1860, 1477, 665, 497, 333, 1856, 157, - /* 630 */ 491, 1329, 1281, 1357, 1258, 209, 1256, 353, 1428, 1336, - /* 640 */ 1337, 26, 1476, 1263, 235, 165, 1751, 33, 32, 1887, - /* 650 */ 211, 40, 38, 36, 35, 34, 1362, 1691, 1344, 302, - /* 660 */ 9, 1261, 1262, 58, 1282, 1751, 57, 7, 1453, 33, - /* 670 */ 32, 348, 1926, 40, 38, 36, 35, 34, 1926, 143, - /* 680 */ 550, 545, 665, 1751, 1258, 1924, 1256, 615, 1597, 1923, - /* 690 */ 1638, 162, 36, 35, 34, 1923, 1336, 1337, 1502, 29, - /* 700 */ 340, 1351, 1352, 1353, 1354, 1355, 1359, 1360, 1361, 75, - /* 710 */ 307, 1261, 1262, 522, 1311, 1312, 1314, 1315, 1316, 1317, - /* 720 */ 1318, 1319, 579, 575, 1327, 1328, 1330, 1331, 1332, 1333, - /* 730 */ 1335, 1338, 33, 32, 486, 485, 40, 38, 36, 35, - /* 740 */ 34, 1258, 1875, 1256, 635, 633, 660, 1408, 1110, 608, - /* 750 */ 607, 606, 1114, 605, 1116, 1117, 604, 1119, 601, 61, - /* 760 */ 1125, 598, 1127, 1128, 595, 592, 1871, 352, 1261, 1262, - /* 770 */ 1475, 1311, 1312, 1314, 1315, 1316, 1317, 1318, 1319, 579, - /* 780 */ 575, 1327, 1328, 1330, 1331, 1332, 1333, 1335, 1338, 39, - /* 790 */ 37, 304, 1282, 1280, 617, 668, 505, 342, 1472, 1257, - /* 800 */ 419, 616, 1471, 431, 1638, 1470, 1782, 532, 1926, 270, - /* 810 */ 1334, 1751, 1255, 134, 133, 614, 613, 612, 349, 1696, - /* 820 */ 404, 162, 432, 154, 406, 1923, 1469, 532, 658, 654, - /* 830 */ 650, 646, 268, 1329, 1800, 1595, 1647, 1926, 396, 1751, - /* 840 */ 532, 1313, 584, 1751, 611, 1263, 1751, 1751, 532, 583, - /* 850 */ 162, 411, 1646, 1390, 1923, 1595, 1584, 397, 1047, 412, - /* 860 */ 89, 532, 2, 233, 623, 1263, 1567, 1751, 1595, 393, - /* 870 */ 275, 1875, 456, 1625, 1814, 132, 1595, 142, 93, 1783, - /* 880 */ 586, 1785, 1786, 582, 665, 577, 1007, 1008, 1860, 1595, - /* 890 */ 1468, 1048, 1859, 1856, 1572, 1870, 529, 430, 1336, 1337, - /* 900 */ 425, 424, 423, 422, 421, 418, 417, 416, 415, 414, - /* 910 */ 410, 409, 408, 407, 401, 400, 399, 398, 54, 395, - /* 920 */ 394, 1467, 1466, 28, 1880, 1390, 622, 144, 220, 33, - /* 930 */ 32, 1751, 281, 40, 38, 36, 35, 34, 1570, 44, - /* 940 */ 4, 53, 516, 1258, 532, 1256, 279, 60, 1580, 1228, - /* 950 */ 59, 213, 33, 32, 1465, 1592, 40, 38, 36, 35, - /* 960 */ 34, 1464, 1751, 1751, 1582, 1782, 180, 436, 434, 1313, - /* 970 */ 1261, 1262, 1595, 1311, 1312, 1314, 1315, 1316, 1317, 1318, - /* 980 */ 1319, 579, 575, 1327, 1328, 1330, 1331, 1332, 1333, 1335, - /* 990 */ 1338, 617, 532, 1800, 63, 1751, 532, 1513, 532, 562, - /* 1000 */ 634, 584, 1751, 1725, 1266, 41, 1751, 513, 583, 517, - /* 1010 */ 134, 133, 614, 613, 612, 202, 222, 532, 200, 490, - /* 1020 */ 1595, 1265, 560, 128, 1595, 532, 1595, 1508, 530, 1578, - /* 1030 */ 1296, 573, 90, 1814, 217, 617, 531, 91, 1783, 586, - /* 1040 */ 1785, 1786, 582, 379, 577, 1595, 1782, 1860, 1204, 492, - /* 1050 */ 214, 308, 1856, 1595, 134, 133, 614, 613, 612, 226, - /* 1060 */ 339, 338, 532, 1926, 131, 76, 525, 68, 67, 388, - /* 1070 */ 1271, 1506, 171, 264, 1800, 1770, 162, 555, 382, 567, - /* 1080 */ 1923, 1334, 584, 1264, 132, 204, 1765, 1751, 203, 583, - /* 1090 */ 1595, 303, 206, 495, 372, 205, 370, 366, 362, 168, - /* 1100 */ 357, 354, 1772, 208, 1329, 124, 207, 232, 51, 239, - /* 1110 */ 11, 10, 1761, 1767, 1814, 51, 1263, 578, 92, 1783, - /* 1120 */ 586, 1785, 1786, 582, 577, 577, 560, 1103, 1860, 1782, - /* 1130 */ 1456, 1457, 333, 1856, 1939, 165, 41, 1269, 41, 590, - /* 1140 */ 131, 1774, 132, 1894, 116, 122, 131, 610, 512, 87, - /* 1150 */ 1474, 1415, 242, 1556, 1268, 572, 258, 1800, 1364, 84, - /* 1160 */ 253, 1868, 554, 1348, 553, 584, 542, 1926, 475, 506, - /* 1170 */ 1751, 247, 583, 1801, 351, 1635, 1497, 1890, 252, 1320, - /* 1180 */ 164, 274, 1131, 1135, 1923, 1142, 560, 1140, 556, 135, - /* 1190 */ 356, 257, 1782, 260, 3, 262, 5, 1814, 1280, 359, - /* 1200 */ 363, 288, 1783, 586, 1785, 1786, 582, 315, 577, 1072, - /* 1210 */ 316, 1220, 174, 271, 1272, 392, 1267, 413, 1688, 420, - /* 1220 */ 1800, 428, 427, 429, 1286, 433, 435, 1926, 584, 1289, - /* 1230 */ 437, 183, 438, 1751, 1782, 583, 449, 446, 450, 1288, - /* 1240 */ 164, 1275, 1277, 185, 1923, 451, 1290, 1287, 452, 454, - /* 1250 */ 188, 455, 190, 575, 1327, 1328, 1330, 1331, 1332, 1333, - /* 1260 */ 1814, 192, 1800, 72, 92, 1783, 586, 1785, 1786, 582, - /* 1270 */ 584, 577, 458, 195, 1860, 1751, 477, 583, 333, 1856, - /* 1280 */ 1939, 479, 1585, 568, 115, 199, 1581, 201, 137, 1917, - /* 1290 */ 306, 138, 212, 1583, 1579, 139, 272, 1782, 140, 507, - /* 1300 */ 215, 514, 1814, 508, 518, 526, 92, 1783, 586, 1785, - /* 1310 */ 1786, 582, 1730, 577, 219, 511, 1860, 540, 521, 527, - /* 1320 */ 333, 1856, 1939, 230, 1729, 1800, 1698, 129, 523, 273, - /* 1330 */ 327, 1879, 80, 584, 325, 228, 130, 1596, 1751, 1285, - /* 1340 */ 583, 528, 543, 536, 6, 552, 1901, 1782, 1900, 538, - /* 1350 */ 1891, 539, 332, 546, 560, 237, 537, 1882, 246, 535, - /* 1360 */ 534, 241, 1390, 123, 1782, 1814, 1284, 569, 566, 288, - /* 1370 */ 1783, 586, 1785, 1786, 582, 1800, 577, 334, 48, 82, - /* 1380 */ 251, 588, 1639, 584, 1568, 151, 1876, 276, 1751, 661, - /* 1390 */ 583, 267, 1800, 664, 248, 1926, 249, 662, 52, 250, - /* 1400 */ 581, 150, 280, 1841, 289, 1751, 278, 583, 162, 1745, - /* 1410 */ 299, 298, 1923, 1744, 65, 1814, 1743, 1742, 66, 93, - /* 1420 */ 1783, 586, 1785, 1786, 582, 1782, 577, 1741, 358, 1860, - /* 1430 */ 1738, 1922, 1814, 571, 1856, 563, 296, 1783, 586, 1785, - /* 1440 */ 1786, 582, 580, 577, 574, 1832, 1782, 256, 1942, 259, - /* 1450 */ 360, 570, 261, 1800, 1248, 361, 1249, 169, 365, 1736, - /* 1460 */ 367, 584, 369, 368, 1735, 371, 1751, 1734, 583, 373, - /* 1470 */ 1733, 375, 1732, 1715, 1800, 377, 170, 380, 381, 1223, - /* 1480 */ 1222, 1709, 584, 1708, 386, 387, 1707, 1751, 1192, 583, - /* 1490 */ 1706, 1681, 126, 1814, 1680, 1679, 1678, 146, 1783, 586, - /* 1500 */ 1785, 1786, 582, 69, 577, 1677, 1676, 1675, 1674, 1673, - /* 1510 */ 402, 403, 1672, 405, 1814, 1782, 1671, 1670, 93, 1783, - /* 1520 */ 586, 1785, 1786, 582, 1669, 577, 1668, 1782, 1860, 1667, - /* 1530 */ 1666, 1665, 1664, 1857, 1663, 1662, 1661, 1782, 178, 127, - /* 1540 */ 1657, 561, 1940, 1800, 1660, 1659, 1658, 1656, 326, 1655, - /* 1550 */ 1654, 584, 181, 117, 179, 1800, 1751, 1653, 583, 1652, - /* 1560 */ 533, 1651, 1650, 584, 1194, 1800, 1649, 1648, 1751, 1528, - /* 1570 */ 583, 1527, 1525, 584, 1493, 1492, 155, 1010, 1751, 1009, - /* 1580 */ 583, 182, 118, 1814, 1723, 442, 1717, 297, 1783, 586, - /* 1590 */ 1785, 1786, 582, 1782, 577, 1814, 1705, 444, 189, 297, - /* 1600 */ 1783, 586, 1785, 1786, 582, 1814, 577, 1782, 1704, 292, - /* 1610 */ 1783, 586, 1785, 1786, 582, 187, 577, 1690, 1574, 1524, - /* 1620 */ 1040, 1800, 1522, 459, 460, 1520, 461, 463, 464, 584, - /* 1630 */ 465, 1518, 467, 1516, 1751, 1800, 583, 468, 469, 473, - /* 1640 */ 471, 1505, 472, 581, 1504, 1489, 1576, 551, 1751, 50, - /* 1650 */ 583, 1146, 198, 1575, 1145, 1071, 632, 634, 1068, 1067, - /* 1660 */ 1066, 1814, 1514, 1509, 321, 146, 1783, 586, 1785, 1786, - /* 1670 */ 582, 322, 577, 1507, 323, 1814, 493, 1488, 496, 296, - /* 1680 */ 1783, 586, 1785, 1786, 582, 1782, 577, 1487, 1833, 498, - /* 1690 */ 500, 1486, 502, 1722, 94, 1230, 1716, 1782, 509, 141, - /* 1700 */ 1703, 56, 1701, 1702, 216, 1700, 510, 1699, 1697, 324, - /* 1710 */ 1941, 15, 1689, 1800, 221, 227, 84, 229, 341, 515, - /* 1720 */ 78, 584, 79, 41, 524, 1800, 1751, 231, 583, 234, - /* 1730 */ 343, 16, 23, 584, 1430, 236, 245, 238, 1751, 45, - /* 1740 */ 583, 1772, 1412, 240, 47, 1414, 148, 1782, 17, 1240, - /* 1750 */ 243, 24, 244, 1814, 1407, 1387, 83, 297, 1783, 586, - /* 1760 */ 1785, 1786, 582, 25, 577, 1814, 46, 1386, 254, 297, - /* 1770 */ 1783, 586, 1785, 1786, 582, 1800, 577, 1771, 152, 18, - /* 1780 */ 1447, 1442, 1441, 584, 335, 1436, 1446, 1445, 1751, 336, - /* 1790 */ 583, 10, 1273, 19, 1349, 1817, 576, 1782, 1304, 1324, - /* 1800 */ 13, 1322, 31, 153, 1321, 166, 12, 585, 589, 20, - /* 1810 */ 21, 1782, 587, 1132, 344, 1814, 1129, 593, 591, 282, - /* 1820 */ 1783, 586, 1785, 1786, 582, 1800, 577, 594, 596, 1126, - /* 1830 */ 597, 599, 602, 584, 609, 1124, 1109, 1123, 1751, 1800, - /* 1840 */ 583, 1120, 1118, 600, 1122, 1141, 603, 584, 1121, 85, - /* 1850 */ 86, 62, 1751, 1782, 583, 1137, 265, 1038, 1063, 618, - /* 1860 */ 1078, 621, 266, 1782, 1061, 1814, 1060, 1059, 1058, 283, - /* 1870 */ 1783, 586, 1785, 1786, 582, 1057, 577, 1056, 1055, 1814, - /* 1880 */ 1054, 1800, 1073, 284, 1783, 586, 1785, 1786, 582, 584, - /* 1890 */ 577, 1800, 1075, 1051, 1751, 1050, 583, 1049, 1046, 584, - /* 1900 */ 1045, 1044, 1043, 1521, 1751, 643, 583, 645, 644, 1519, - /* 1910 */ 647, 648, 649, 1517, 1515, 651, 652, 653, 655, 656, - /* 1920 */ 657, 1814, 1503, 659, 1000, 291, 1783, 586, 1785, 1786, - /* 1930 */ 582, 1814, 577, 1485, 269, 293, 1783, 586, 1785, 1786, - /* 1940 */ 582, 1782, 577, 1259, 663, 667, 277, 666, 1460, 1460, - /* 1950 */ 1460, 1460, 1460, 1460, 1460, 1460, 1460, 1782, 1460, 1460, - /* 1960 */ 1460, 1460, 1460, 1460, 1460, 1460, 1460, 1460, 1460, 1800, - /* 1970 */ 1460, 1460, 1460, 1460, 1460, 1460, 1460, 584, 1460, 1460, - /* 1980 */ 1460, 1460, 1751, 1460, 583, 1800, 1460, 1460, 1460, 1460, - /* 1990 */ 1460, 1460, 1460, 584, 1460, 1460, 1460, 1460, 1751, 1460, - /* 2000 */ 583, 1460, 1460, 1460, 1460, 1460, 1460, 1782, 1460, 1814, - /* 2010 */ 1460, 1460, 1460, 285, 1783, 586, 1785, 1786, 582, 1782, - /* 2020 */ 577, 1460, 1460, 1460, 1460, 1814, 1460, 1460, 1460, 294, - /* 2030 */ 1783, 586, 1785, 1786, 582, 1800, 577, 1460, 1460, 1460, - /* 2040 */ 1460, 1460, 1460, 584, 1460, 1460, 1460, 1800, 1751, 1460, - /* 2050 */ 583, 1460, 1460, 1460, 1460, 584, 1460, 1460, 1460, 1460, - /* 2060 */ 1751, 1460, 583, 1460, 1460, 1460, 1460, 1460, 1460, 1460, - /* 2070 */ 1460, 1782, 1460, 1460, 1460, 1814, 1460, 1460, 1460, 286, - /* 2080 */ 1783, 586, 1785, 1786, 582, 1782, 577, 1814, 555, 1460, - /* 2090 */ 1460, 295, 1783, 586, 1785, 1786, 582, 1460, 577, 1800, - /* 2100 */ 1460, 1460, 1460, 1460, 1460, 1460, 1460, 584, 1460, 1460, - /* 2110 */ 1460, 1460, 1751, 1800, 583, 1460, 124, 1460, 1460, 1460, - /* 2120 */ 1460, 584, 1460, 1460, 1460, 1460, 1751, 1460, 583, 1460, - /* 2130 */ 1460, 1460, 1460, 1460, 1460, 1460, 1460, 560, 1460, 1814, - /* 2140 */ 1460, 1782, 1460, 287, 1783, 586, 1785, 1786, 582, 1460, - /* 2150 */ 577, 1782, 1460, 1814, 1460, 1460, 122, 300, 1783, 586, - /* 2160 */ 1785, 1786, 582, 1460, 577, 1460, 1460, 1460, 1460, 1800, - /* 2170 */ 1460, 253, 1868, 554, 1460, 553, 1460, 584, 1926, 1800, - /* 2180 */ 1460, 1460, 1751, 1460, 583, 1460, 1460, 584, 1460, 1460, - /* 2190 */ 1460, 162, 1751, 1460, 583, 1923, 1460, 1460, 1460, 1460, - /* 2200 */ 1460, 1782, 1460, 1460, 1460, 1460, 1460, 1460, 1460, 1814, - /* 2210 */ 1460, 1460, 1460, 301, 1783, 586, 1785, 1786, 582, 1814, - /* 2220 */ 577, 1460, 1460, 1794, 1783, 586, 1785, 1786, 582, 1800, - /* 2230 */ 577, 1460, 1460, 1460, 1460, 1460, 1460, 584, 1460, 1460, - /* 2240 */ 1460, 1460, 1751, 1460, 583, 1460, 1460, 1460, 1460, 1460, - /* 2250 */ 1460, 1460, 1460, 1782, 1460, 1460, 1460, 1460, 1460, 1460, - /* 2260 */ 1460, 1460, 1460, 1460, 1460, 1460, 1460, 1782, 1460, 1814, - /* 2270 */ 1460, 1460, 1460, 1793, 1783, 586, 1785, 1786, 582, 1782, - /* 2280 */ 577, 1800, 1460, 1460, 1460, 1460, 1460, 1460, 1460, 584, - /* 2290 */ 1460, 1460, 1460, 1460, 1751, 1800, 583, 1460, 1460, 1460, - /* 2300 */ 1460, 1460, 1460, 584, 1460, 1460, 1460, 1800, 1751, 1460, - /* 2310 */ 583, 1460, 1460, 1460, 1460, 584, 1460, 1460, 1460, 1460, - /* 2320 */ 1751, 1814, 583, 1460, 1460, 1792, 1783, 586, 1785, 1786, - /* 2330 */ 582, 1782, 577, 1460, 1460, 1814, 1460, 1460, 1460, 312, - /* 2340 */ 1783, 586, 1785, 1786, 582, 1782, 577, 1814, 1460, 1460, - /* 2350 */ 1460, 311, 1783, 586, 1785, 1786, 582, 1460, 577, 1800, - /* 2360 */ 1460, 1460, 1460, 1460, 1460, 1460, 1460, 584, 1460, 1460, - /* 2370 */ 1460, 1460, 1751, 1800, 583, 1460, 1460, 1460, 1460, 1460, - /* 2380 */ 1460, 584, 1460, 1460, 1460, 1460, 1751, 1460, 583, 1460, - /* 2390 */ 1460, 1460, 1460, 1460, 1460, 1460, 1460, 1460, 1460, 1814, - /* 2400 */ 1460, 1782, 1460, 313, 1783, 586, 1785, 1786, 582, 1460, - /* 2410 */ 577, 1460, 1460, 1814, 1460, 1460, 1460, 310, 1783, 586, - /* 2420 */ 1785, 1786, 582, 1460, 577, 1460, 1460, 1460, 1460, 1800, - /* 2430 */ 1460, 1460, 1460, 1460, 1460, 1460, 1460, 584, 1460, 1460, - /* 2440 */ 1460, 1460, 1751, 1460, 583, 1460, 1460, 1460, 1460, 1460, - /* 2450 */ 1460, 1460, 1460, 1460, 1460, 1460, 1460, 1460, 1460, 1460, - /* 2460 */ 1460, 1460, 1460, 1460, 1460, 1460, 1460, 1460, 1460, 1814, - /* 2470 */ 1460, 1460, 1460, 290, 1783, 586, 1785, 1786, 582, 1460, - /* 2480 */ 577, + /* 0 */ 442, 1950, 443, 1514, 1720, 64, 1610, 329, 450, 557, + /* 10 */ 443, 1514, 39, 37, 1949, 143, 1502, 1789, 1947, 1950, + /* 20 */ 342, 1480, 1275, 522, 1621, 40, 38, 36, 35, 34, + /* 30 */ 1806, 328, 163, 1352, 1717, 1273, 1947, 124, 1301, 1032, + /* 40 */ 1015, 1031, 104, 1785, 1791, 103, 102, 101, 100, 99, + /* 50 */ 98, 97, 96, 95, 447, 579, 1347, 1775, 1824, 347, + /* 60 */ 1298, 14, 1664, 1666, 393, 88, 586, 1501, 1281, 1033, + /* 70 */ 1032, 1775, 1031, 585, 39, 37, 1415, 122, 121, 143, + /* 80 */ 1019, 1020, 342, 1541, 1275, 478, 1611, 562, 1622, 1, + /* 90 */ 63, 559, 158, 1892, 1893, 1352, 1897, 1273, 1838, 534, + /* 100 */ 1033, 305, 91, 1807, 588, 1809, 1810, 584, 1775, 579, + /* 110 */ 55, 671, 1884, 36, 35, 34, 308, 1880, 1347, 459, + /* 120 */ 560, 30, 263, 14, 560, 1354, 1355, 1619, 1950, 104, + /* 130 */ 1281, 211, 103, 102, 101, 100, 99, 98, 97, 96, + /* 140 */ 95, 164, 560, 1170, 1171, 1947, 648, 647, 646, 645, + /* 150 */ 352, 2, 644, 643, 642, 125, 637, 636, 635, 634, + /* 160 */ 633, 632, 631, 630, 136, 626, 351, 350, 623, 622, + /* 170 */ 1276, 1899, 1274, 671, 224, 225, 147, 33, 32, 1950, + /* 180 */ 1579, 40, 38, 36, 35, 34, 1300, 1354, 1355, 43, + /* 190 */ 75, 307, 1948, 42, 524, 1896, 1947, 1279, 1280, 387, + /* 200 */ 1329, 1330, 1332, 1333, 1334, 1335, 1336, 1337, 581, 577, + /* 210 */ 1345, 1346, 1348, 1349, 1350, 1351, 1353, 1356, 1479, 63, + /* 220 */ 33, 32, 1597, 218, 40, 38, 36, 35, 34, 73, + /* 230 */ 165, 165, 1276, 1595, 1274, 307, 11, 10, 524, 1275, + /* 240 */ 1950, 428, 113, 112, 111, 110, 109, 108, 107, 106, + /* 250 */ 105, 1615, 1273, 162, 1436, 63, 63, 1947, 77, 1279, + /* 260 */ 1280, 378, 1329, 1330, 1332, 1333, 1334, 1335, 1336, 1337, + /* 270 */ 581, 577, 1345, 1346, 1348, 1349, 1350, 1351, 1353, 1356, + /* 280 */ 39, 37, 459, 380, 376, 1281, 617, 1824, 342, 1662, + /* 290 */ 1275, 177, 176, 621, 1806, 550, 543, 1434, 1435, 1437, + /* 300 */ 1438, 1352, 1446, 1273, 1128, 610, 609, 608, 1132, 607, + /* 310 */ 1134, 1135, 606, 1137, 603, 345, 1143, 600, 1145, 1146, + /* 320 */ 597, 594, 1824, 143, 1347, 1388, 546, 534, 671, 14, + /* 330 */ 586, 1472, 1621, 549, 165, 1775, 1281, 585, 167, 1301, + /* 340 */ 33, 32, 39, 37, 40, 38, 36, 35, 34, 557, + /* 350 */ 342, 562, 1275, 1302, 521, 1619, 145, 2, 1491, 1300, + /* 360 */ 165, 81, 1838, 1352, 63, 1273, 91, 1807, 588, 1809, + /* 370 */ 1810, 584, 534, 579, 534, 1806, 1884, 124, 173, 671, + /* 380 */ 308, 1880, 1612, 391, 49, 392, 1347, 1276, 1794, 1274, + /* 390 */ 1665, 1666, 1950, 1354, 1355, 1950, 165, 165, 1281, 1789, + /* 400 */ 1619, 223, 1619, 1824, 1500, 162, 552, 547, 162, 1947, + /* 410 */ 71, 586, 1947, 70, 1279, 1280, 1775, 122, 585, 8, + /* 420 */ 1090, 1471, 1426, 33, 32, 1785, 1791, 40, 38, 36, + /* 430 */ 35, 34, 159, 1892, 1893, 1899, 1897, 579, 1276, 618, + /* 440 */ 1274, 671, 1662, 1838, 386, 1775, 385, 93, 1807, 588, + /* 450 */ 1809, 1810, 584, 1092, 579, 1354, 1355, 1884, 22, 1895, + /* 460 */ 1499, 1883, 1880, 1254, 1255, 1279, 1280, 1531, 1329, 1330, + /* 470 */ 1332, 1333, 1334, 1335, 1336, 1337, 581, 577, 1345, 1346, + /* 480 */ 1348, 1349, 1350, 1351, 1353, 1356, 534, 33, 32, 492, + /* 490 */ 255, 40, 38, 36, 35, 34, 1716, 398, 302, 197, + /* 500 */ 1276, 1775, 1274, 33, 32, 165, 566, 40, 38, 36, + /* 510 */ 35, 34, 441, 149, 1619, 445, 488, 487, 476, 472, + /* 520 */ 468, 464, 196, 1806, 1715, 165, 302, 1279, 1280, 355, + /* 530 */ 1329, 1330, 1332, 1333, 1334, 1335, 1336, 1337, 581, 577, + /* 540 */ 1345, 1346, 1348, 1349, 1350, 1351, 1353, 1356, 39, 37, + /* 550 */ 1357, 1824, 1498, 304, 74, 1298, 342, 194, 1275, 561, + /* 560 */ 165, 1710, 421, 1412, 1775, 433, 585, 26, 551, 1352, + /* 570 */ 1950, 1273, 172, 33, 32, 505, 1497, 40, 38, 36, + /* 580 */ 35, 34, 406, 162, 434, 1314, 408, 1947, 503, 1496, + /* 590 */ 501, 1838, 1347, 1775, 156, 92, 1807, 588, 1809, 1810, + /* 600 */ 584, 1793, 579, 522, 1281, 1884, 1596, 1658, 1299, 333, + /* 610 */ 1880, 157, 1789, 534, 1718, 1495, 1806, 1775, 534, 193, + /* 620 */ 186, 534, 191, 399, 413, 9, 455, 1671, 1376, 414, + /* 630 */ 1775, 1911, 458, 575, 314, 395, 142, 534, 1785, 1791, + /* 640 */ 331, 1619, 1710, 1669, 1824, 184, 1619, 671, 114, 1619, + /* 650 */ 579, 1381, 586, 175, 1419, 480, 1775, 1775, 1594, 585, + /* 660 */ 1300, 1354, 1355, 432, 1494, 1619, 427, 426, 425, 424, + /* 670 */ 423, 420, 419, 418, 417, 416, 412, 411, 410, 409, + /* 680 */ 403, 402, 401, 400, 1838, 397, 396, 73, 92, 1807, + /* 690 */ 588, 1809, 1810, 584, 27, 579, 449, 1950, 1884, 445, + /* 700 */ 119, 1671, 333, 1880, 1963, 1775, 1276, 619, 1274, 1614, + /* 710 */ 163, 1899, 567, 1918, 1947, 33, 32, 1670, 61, 40, + /* 720 */ 38, 36, 35, 34, 621, 1493, 134, 133, 616, 615, + /* 730 */ 614, 641, 639, 1279, 1280, 1894, 1329, 1330, 1332, 1333, + /* 740 */ 1334, 1335, 1336, 1337, 581, 577, 1345, 1346, 1348, 1349, + /* 750 */ 1350, 1351, 1353, 1356, 39, 37, 496, 348, 674, 619, + /* 760 */ 1671, 1490, 342, 1281, 1275, 143, 1775, 330, 309, 1366, + /* 770 */ 354, 506, 270, 1489, 1621, 1352, 1669, 1273, 134, 133, + /* 780 */ 616, 615, 614, 613, 1488, 210, 154, 629, 7, 1591, + /* 790 */ 1411, 664, 660, 656, 652, 268, 1793, 1314, 1347, 499, + /* 800 */ 319, 1806, 1775, 493, 534, 1374, 28, 1789, 209, 1487, + /* 810 */ 1281, 1950, 33, 32, 1775, 114, 40, 38, 36, 35, + /* 820 */ 34, 1486, 485, 557, 162, 1775, 1303, 89, 1947, 1824, + /* 830 */ 233, 9, 1619, 1785, 1791, 337, 1300, 561, 534, 628, + /* 840 */ 58, 1331, 1775, 57, 585, 579, 1362, 1019, 1020, 1616, + /* 850 */ 1775, 124, 1300, 671, 1671, 320, 132, 318, 317, 1375, + /* 860 */ 482, 346, 1775, 531, 484, 1608, 1619, 1354, 1355, 1838, + /* 870 */ 1669, 1904, 1408, 92, 1807, 588, 1809, 1810, 584, 1485, + /* 880 */ 579, 1477, 1380, 1884, 44, 4, 483, 333, 1880, 157, + /* 890 */ 569, 122, 33, 32, 534, 220, 40, 38, 36, 35, + /* 900 */ 34, 161, 1544, 54, 1604, 1749, 160, 1892, 1893, 1910, + /* 910 */ 1897, 1606, 1276, 1284, 1274, 484, 1246, 1602, 213, 214, + /* 920 */ 1775, 275, 1619, 1484, 1649, 29, 340, 1369, 1370, 1371, + /* 930 */ 1372, 1373, 1377, 1378, 1379, 1483, 1482, 483, 580, 1279, + /* 940 */ 1280, 357, 1329, 1330, 1332, 1333, 1334, 1335, 1336, 1337, + /* 950 */ 581, 577, 1345, 1346, 1348, 1349, 1350, 1351, 1353, 1356, + /* 960 */ 39, 37, 564, 235, 1775, 619, 491, 490, 342, 202, + /* 970 */ 1275, 489, 200, 507, 120, 1283, 1775, 1775, 1408, 1806, + /* 980 */ 486, 1352, 1950, 1273, 134, 133, 616, 615, 614, 1761, + /* 990 */ 612, 534, 491, 490, 640, 162, 1526, 489, 534, 1947, + /* 1000 */ 120, 534, 515, 1524, 1347, 217, 486, 1824, 204, 519, + /* 1010 */ 206, 203, 532, 205, 1950, 586, 1281, 1331, 494, 1619, + /* 1020 */ 1775, 534, 585, 144, 41, 497, 1619, 162, 281, 1619, + /* 1030 */ 222, 1947, 533, 1331, 514, 208, 366, 2, 207, 1492, + /* 1040 */ 76, 381, 279, 60, 53, 518, 59, 1838, 258, 1619, + /* 1050 */ 1287, 92, 1807, 588, 1809, 1810, 584, 534, 579, 671, + /* 1060 */ 128, 1884, 180, 438, 436, 333, 1880, 1963, 264, 534, + /* 1070 */ 131, 1222, 132, 1354, 1355, 51, 1941, 226, 544, 239, + /* 1080 */ 349, 11, 10, 33, 32, 1619, 51, 40, 38, 36, + /* 1090 */ 35, 34, 1474, 1475, 63, 41, 1796, 1619, 570, 87, + /* 1100 */ 41, 624, 1059, 625, 1580, 477, 508, 527, 247, 84, + /* 1110 */ 1825, 353, 1286, 1515, 1659, 1914, 558, 232, 1276, 1121, + /* 1120 */ 1274, 252, 1433, 1078, 592, 1076, 242, 131, 132, 116, + /* 1130 */ 131, 1520, 90, 1382, 257, 1060, 309, 260, 3, 1798, + /* 1140 */ 262, 5, 1338, 1298, 358, 1279, 1280, 274, 1329, 1330, + /* 1150 */ 1332, 1333, 1334, 1335, 1336, 1337, 581, 577, 1345, 1346, + /* 1160 */ 1348, 1349, 1350, 1351, 1353, 1356, 361, 68, 67, 390, + /* 1170 */ 1090, 1149, 171, 1374, 1153, 1160, 1158, 135, 384, 666, + /* 1180 */ 315, 365, 339, 338, 316, 271, 1238, 174, 394, 1806, + /* 1190 */ 415, 303, 1289, 1712, 374, 429, 372, 368, 364, 168, + /* 1200 */ 359, 356, 422, 1352, 435, 1282, 430, 431, 437, 439, + /* 1210 */ 1304, 440, 448, 1307, 451, 1306, 183, 1824, 452, 185, + /* 1220 */ 453, 557, 1308, 456, 454, 586, 1347, 1375, 188, 190, + /* 1230 */ 1775, 1305, 585, 457, 192, 165, 72, 460, 1281, 195, + /* 1240 */ 479, 115, 306, 481, 272, 212, 1609, 199, 1605, 124, + /* 1250 */ 1380, 201, 509, 137, 138, 510, 1607, 1838, 215, 1603, + /* 1260 */ 139, 92, 1807, 588, 1809, 1810, 584, 140, 579, 516, + /* 1270 */ 562, 1884, 520, 219, 542, 333, 1880, 1963, 1754, 1806, + /* 1280 */ 528, 574, 230, 523, 513, 228, 1903, 1753, 129, 122, + /* 1290 */ 325, 1620, 1722, 29, 340, 1369, 1370, 1371, 1372, 1373, + /* 1300 */ 1377, 1378, 1379, 525, 253, 1892, 556, 1824, 555, 130, + /* 1310 */ 327, 1950, 273, 80, 530, 586, 1303, 529, 1915, 538, + /* 1320 */ 1775, 545, 585, 237, 164, 1925, 540, 541, 1947, 1806, + /* 1330 */ 332, 536, 548, 6, 241, 554, 562, 539, 537, 1408, + /* 1340 */ 1290, 251, 1285, 123, 1302, 571, 1900, 1838, 568, 1924, + /* 1350 */ 1906, 288, 1807, 588, 1809, 1810, 584, 1824, 579, 246, + /* 1360 */ 151, 248, 249, 48, 334, 586, 82, 1293, 1295, 1663, + /* 1370 */ 1775, 250, 585, 1966, 590, 1592, 276, 1950, 1865, 577, + /* 1380 */ 1345, 1346, 1348, 1349, 1350, 1351, 562, 267, 1946, 667, + /* 1390 */ 164, 565, 52, 668, 1947, 670, 1806, 1838, 572, 278, + /* 1400 */ 256, 288, 1807, 588, 1809, 1810, 584, 259, 579, 261, + /* 1410 */ 150, 1769, 280, 1806, 289, 1768, 65, 299, 1767, 1766, + /* 1420 */ 1765, 298, 66, 360, 1824, 1762, 362, 1950, 363, 1266, + /* 1430 */ 557, 1267, 586, 169, 367, 1760, 369, 1775, 370, 585, + /* 1440 */ 162, 1824, 371, 1759, 1947, 373, 1758, 375, 1757, 583, + /* 1450 */ 1756, 377, 379, 1739, 1775, 382, 585, 170, 124, 383, + /* 1460 */ 1241, 1240, 1733, 1732, 1838, 388, 389, 1806, 93, 1807, + /* 1470 */ 588, 1809, 1810, 584, 1731, 579, 1730, 1210, 1884, 562, + /* 1480 */ 1705, 1838, 573, 1880, 126, 296, 1807, 588, 1809, 1810, + /* 1490 */ 584, 582, 579, 576, 1856, 1824, 1704, 1703, 122, 1702, + /* 1500 */ 69, 1701, 1700, 586, 1699, 1698, 1697, 404, 1775, 1696, + /* 1510 */ 585, 407, 405, 253, 1892, 556, 1695, 555, 1694, 1693, + /* 1520 */ 1950, 1806, 1692, 1691, 1690, 1689, 1688, 1687, 1686, 1685, + /* 1530 */ 1684, 1683, 1682, 162, 127, 1838, 1212, 1947, 1681, 146, + /* 1540 */ 1807, 588, 1809, 1810, 584, 1806, 579, 1680, 1679, 1824, + /* 1550 */ 1678, 1677, 1676, 1675, 1674, 1673, 1672, 586, 1546, 178, + /* 1560 */ 1545, 1543, 1775, 179, 585, 1511, 444, 446, 1510, 1747, + /* 1570 */ 1741, 1806, 1729, 1824, 117, 181, 1022, 155, 326, 182, + /* 1580 */ 1021, 586, 118, 563, 1964, 187, 1775, 189, 585, 1838, + /* 1590 */ 1728, 1714, 1598, 93, 1807, 588, 1809, 1810, 584, 1824, + /* 1600 */ 579, 1542, 1052, 1884, 535, 1540, 461, 586, 1881, 1538, + /* 1610 */ 462, 466, 1775, 1838, 585, 463, 465, 297, 1807, 588, + /* 1620 */ 1809, 1810, 584, 467, 579, 1536, 470, 471, 469, 1806, + /* 1630 */ 1534, 473, 474, 475, 1523, 1522, 1507, 1600, 1164, 1838, + /* 1640 */ 50, 1806, 1163, 297, 1807, 588, 1809, 1810, 584, 1089, + /* 1650 */ 579, 1599, 1086, 198, 638, 640, 1085, 1824, 1532, 1527, + /* 1660 */ 1084, 321, 322, 1525, 495, 586, 323, 498, 1506, 1824, + /* 1670 */ 1775, 1505, 585, 1504, 504, 94, 500, 586, 502, 1746, + /* 1680 */ 1248, 1740, 1775, 511, 585, 1727, 141, 1725, 1726, 1724, + /* 1690 */ 1723, 1806, 221, 15, 56, 1721, 1258, 1838, 512, 216, + /* 1700 */ 1713, 292, 1807, 588, 1809, 1810, 584, 227, 579, 1838, + /* 1710 */ 234, 78, 231, 146, 1807, 588, 1809, 1810, 584, 1824, + /* 1720 */ 579, 229, 79, 84, 324, 16, 41, 583, 526, 47, + /* 1730 */ 245, 23, 1775, 1806, 585, 236, 517, 1448, 238, 553, + /* 1740 */ 1430, 244, 240, 1796, 1432, 1806, 148, 25, 254, 243, + /* 1750 */ 46, 24, 1795, 18, 152, 1425, 83, 1806, 1965, 1838, + /* 1760 */ 1460, 1824, 1405, 296, 1807, 588, 1809, 1810, 584, 586, + /* 1770 */ 579, 1459, 1857, 1824, 1775, 335, 585, 1464, 341, 1463, + /* 1780 */ 336, 586, 1404, 17, 1465, 1824, 1775, 10, 585, 1454, + /* 1790 */ 343, 1291, 1367, 586, 19, 1342, 153, 1322, 1775, 1806, + /* 1800 */ 585, 1838, 45, 1841, 578, 282, 1807, 588, 1809, 1810, + /* 1810 */ 584, 1340, 579, 1838, 13, 31, 12, 297, 1807, 588, + /* 1820 */ 1809, 1810, 584, 1339, 579, 1838, 20, 1824, 166, 297, + /* 1830 */ 1807, 588, 1809, 1810, 584, 586, 579, 21, 589, 1150, + /* 1840 */ 1775, 591, 585, 344, 593, 595, 1147, 596, 598, 1144, + /* 1850 */ 599, 601, 1806, 1138, 602, 587, 1136, 604, 1127, 605, + /* 1860 */ 1142, 611, 1806, 85, 1159, 1141, 1140, 1838, 86, 62, + /* 1870 */ 1139, 283, 1807, 588, 1809, 1810, 584, 265, 579, 1155, + /* 1880 */ 1824, 1050, 620, 1081, 1080, 1079, 1077, 1075, 586, 627, + /* 1890 */ 1824, 1096, 1070, 1775, 1073, 585, 1072, 266, 586, 1071, + /* 1900 */ 1069, 1068, 1067, 1775, 1066, 585, 1093, 1091, 1063, 1062, + /* 1910 */ 1061, 1058, 1806, 1057, 1056, 1055, 1539, 649, 650, 1537, + /* 1920 */ 1838, 653, 651, 655, 284, 1807, 588, 1809, 1810, 584, + /* 1930 */ 1838, 579, 654, 1806, 291, 1807, 588, 1809, 1810, 584, + /* 1940 */ 1824, 579, 1535, 657, 658, 1533, 659, 661, 586, 662, + /* 1950 */ 663, 1521, 665, 1775, 1503, 585, 1012, 269, 669, 673, + /* 1960 */ 1277, 1824, 277, 1478, 672, 1478, 1478, 1478, 1478, 586, + /* 1970 */ 1478, 1478, 1478, 1478, 1775, 1478, 585, 1478, 1478, 1478, + /* 1980 */ 1838, 1478, 1478, 1806, 293, 1807, 588, 1809, 1810, 584, + /* 1990 */ 1478, 579, 1478, 1478, 1478, 1478, 1478, 1806, 1478, 1478, + /* 2000 */ 1478, 1838, 1478, 1478, 1478, 285, 1807, 588, 1809, 1810, + /* 2010 */ 584, 1824, 579, 1478, 1478, 1478, 1478, 1478, 1478, 586, + /* 2020 */ 1478, 1478, 1478, 1478, 1775, 1824, 585, 1478, 1478, 1478, + /* 2030 */ 1478, 1478, 1478, 586, 1478, 1478, 1478, 1478, 1775, 1478, + /* 2040 */ 585, 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1806, + /* 2050 */ 1478, 1838, 1478, 1478, 1478, 294, 1807, 588, 1809, 1810, + /* 2060 */ 584, 1478, 579, 1806, 1478, 1838, 1478, 1478, 1478, 286, + /* 2070 */ 1807, 588, 1809, 1810, 584, 1478, 579, 1824, 1478, 1478, + /* 2080 */ 1478, 1478, 1478, 1478, 1478, 586, 1478, 1478, 1478, 1478, + /* 2090 */ 1775, 1824, 585, 1478, 1478, 1478, 1478, 1478, 1478, 586, + /* 2100 */ 1478, 1478, 1478, 1478, 1775, 1478, 585, 1478, 1478, 1478, + /* 2110 */ 1478, 1478, 1478, 1478, 1478, 1478, 1806, 1838, 1478, 1478, + /* 2120 */ 1478, 295, 1807, 588, 1809, 1810, 584, 1478, 579, 1478, + /* 2130 */ 1478, 1838, 1478, 1478, 1478, 287, 1807, 588, 1809, 1810, + /* 2140 */ 584, 1478, 579, 1478, 1824, 1478, 1478, 1478, 1478, 1478, + /* 2150 */ 1478, 1478, 586, 1478, 1478, 1478, 1478, 1775, 1478, 585, + /* 2160 */ 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1806, + /* 2170 */ 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478, + /* 2180 */ 1478, 1478, 1478, 1478, 1838, 1478, 1478, 1478, 300, 1807, + /* 2190 */ 588, 1809, 1810, 584, 1478, 579, 1478, 1824, 1478, 1478, + /* 2200 */ 1478, 1478, 1478, 1478, 1478, 586, 1478, 1478, 1478, 1478, + /* 2210 */ 1775, 1478, 585, 1478, 1478, 1478, 1478, 1478, 1478, 1806, + /* 2220 */ 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478, + /* 2230 */ 1478, 1478, 1478, 1806, 1478, 1478, 1478, 1838, 1478, 1478, + /* 2240 */ 1478, 301, 1807, 588, 1809, 1810, 584, 1824, 579, 1478, + /* 2250 */ 1478, 1478, 1478, 1478, 1478, 586, 1478, 1478, 1478, 1478, + /* 2260 */ 1775, 1824, 585, 1478, 1478, 1478, 1478, 1478, 1478, 586, + /* 2270 */ 1478, 1478, 1478, 1478, 1775, 1806, 585, 1478, 1478, 1478, + /* 2280 */ 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1838, 1478, 1806, + /* 2290 */ 1478, 1818, 1807, 588, 1809, 1810, 584, 1478, 579, 1478, + /* 2300 */ 1478, 1838, 1478, 1824, 1478, 1817, 1807, 588, 1809, 1810, + /* 2310 */ 584, 586, 579, 1478, 1478, 1478, 1775, 1824, 585, 1478, + /* 2320 */ 1478, 1478, 1478, 1478, 1478, 586, 1478, 1478, 1478, 1478, + /* 2330 */ 1775, 1478, 585, 1478, 1478, 1478, 1478, 1478, 1478, 1478, + /* 2340 */ 1478, 1806, 1478, 1838, 1478, 1478, 1478, 1816, 1807, 588, + /* 2350 */ 1809, 1810, 584, 1478, 579, 1806, 1478, 1838, 1478, 1478, + /* 2360 */ 1478, 312, 1807, 588, 1809, 1810, 584, 1478, 579, 1824, + /* 2370 */ 1478, 1478, 1478, 1478, 1478, 1478, 1478, 586, 1478, 1478, + /* 2380 */ 1478, 1478, 1775, 1824, 585, 1478, 1478, 1478, 1478, 1478, + /* 2390 */ 1478, 586, 1478, 1478, 1478, 1478, 1775, 1478, 585, 1478, + /* 2400 */ 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1806, 1838, + /* 2410 */ 1478, 1478, 1478, 311, 1807, 588, 1809, 1810, 584, 1478, + /* 2420 */ 579, 1478, 1478, 1838, 1478, 1478, 1478, 313, 1807, 588, + /* 2430 */ 1809, 1810, 584, 1478, 579, 1478, 1824, 1478, 1478, 1478, + /* 2440 */ 1478, 1478, 1478, 1478, 586, 1478, 1478, 1478, 1478, 1775, + /* 2450 */ 1478, 585, 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478, + /* 2460 */ 1478, 1806, 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478, + /* 2470 */ 1478, 1478, 1478, 1478, 1478, 1478, 1838, 1478, 1478, 1478, + /* 2480 */ 310, 1807, 588, 1809, 1810, 584, 1478, 579, 1478, 1824, + /* 2490 */ 1478, 1478, 1478, 1478, 1478, 1478, 1478, 586, 1478, 1478, + /* 2500 */ 1478, 1478, 1775, 1478, 585, 1478, 1478, 1478, 1478, 1478, + /* 2510 */ 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478, + /* 2520 */ 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1838, + /* 2530 */ 1478, 1478, 1478, 290, 1807, 588, 1809, 1810, 584, 1478, + /* 2540 */ 579, }; static const YYCODETYPE yy_lookahead[] = { - /* 0 */ 267, 271, 256, 263, 267, 265, 266, 279, 302, 271, - /* 10 */ 287, 278, 12, 13, 284, 287, 310, 294, 285, 313, - /* 20 */ 20, 0, 22, 293, 296, 272, 303, 267, 295, 276, - /* 30 */ 287, 293, 295, 33, 263, 35, 265, 266, 295, 20, - /* 40 */ 298, 267, 21, 301, 302, 24, 25, 26, 27, 28, - /* 50 */ 29, 30, 31, 32, 264, 295, 56, 267, 259, 8, - /* 60 */ 9, 61, 316, 12, 13, 14, 15, 16, 68, 12, - /* 70 */ 13, 14, 335, 20, 20, 43, 333, 20, 304, 22, - /* 80 */ 357, 79, 258, 357, 260, 85, 287, 350, 351, 352, - /* 90 */ 33, 354, 35, 370, 295, 335, 370, 374, 20, 300, - /* 100 */ 374, 302, 4, 357, 85, 85, 20, 107, 22, 349, - /* 110 */ 350, 351, 352, 56, 354, 316, 370, 269, 61, 4, - /* 120 */ 374, 121, 122, 342, 343, 68, 327, 125, 126, 116, - /* 130 */ 331, 332, 333, 334, 335, 336, 50, 338, 290, 85, - /* 140 */ 341, 259, 85, 21, 345, 346, 24, 25, 26, 27, - /* 150 */ 28, 29, 30, 31, 32, 0, 357, 64, 65, 44, - /* 160 */ 45, 287, 69, 85, 107, 72, 166, 33, 168, 370, - /* 170 */ 296, 78, 148, 374, 121, 122, 316, 264, 121, 122, - /* 180 */ 267, 47, 300, 85, 301, 302, 52, 53, 54, 55, - /* 190 */ 56, 178, 179, 193, 194, 171, 196, 197, 198, 199, + /* 0 */ 267, 361, 269, 270, 0, 4, 293, 283, 267, 271, + /* 10 */ 269, 270, 12, 13, 374, 291, 263, 304, 378, 361, + /* 20 */ 20, 0, 22, 306, 300, 12, 13, 14, 15, 16, + /* 30 */ 263, 314, 374, 33, 317, 35, 378, 299, 20, 20, + /* 40 */ 4, 22, 21, 330, 331, 24, 25, 26, 27, 28, + /* 50 */ 29, 30, 31, 32, 14, 342, 56, 304, 291, 302, + /* 60 */ 20, 61, 305, 306, 271, 273, 299, 263, 68, 50, + /* 70 */ 20, 304, 22, 306, 12, 13, 14, 339, 286, 291, + /* 80 */ 44, 45, 20, 0, 22, 35, 294, 320, 300, 89, + /* 90 */ 89, 353, 354, 355, 356, 33, 358, 35, 331, 271, + /* 100 */ 50, 308, 335, 336, 337, 338, 339, 340, 304, 342, + /* 110 */ 282, 111, 345, 14, 15, 16, 349, 350, 56, 60, + /* 120 */ 20, 346, 347, 61, 20, 125, 126, 299, 361, 21, + /* 130 */ 68, 121, 24, 25, 26, 27, 28, 29, 30, 31, + /* 140 */ 32, 374, 20, 125, 126, 378, 63, 64, 65, 66, + /* 150 */ 67, 89, 69, 70, 71, 72, 73, 74, 75, 76, + /* 160 */ 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, + /* 170 */ 170, 333, 172, 111, 120, 121, 276, 8, 9, 361, + /* 180 */ 280, 12, 13, 14, 15, 16, 20, 125, 126, 89, + /* 190 */ 180, 181, 374, 89, 184, 357, 378, 197, 198, 320, /* 200 */ 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, - /* 210 */ 210, 211, 212, 213, 20, 287, 22, 357, 84, 64, - /* 220 */ 65, 87, 294, 166, 69, 168, 226, 72, 20, 35, - /* 230 */ 370, 303, 85, 78, 374, 8, 9, 316, 214, 12, - /* 240 */ 13, 14, 15, 16, 50, 226, 226, 312, 267, 314, - /* 250 */ 193, 194, 161, 196, 197, 198, 199, 200, 201, 202, - /* 260 */ 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, - /* 270 */ 213, 12, 13, 0, 183, 184, 295, 245, 357, 20, - /* 280 */ 226, 22, 259, 149, 150, 295, 152, 329, 61, 85, - /* 290 */ 156, 370, 33, 21, 35, 374, 306, 24, 25, 26, - /* 300 */ 27, 28, 29, 30, 31, 32, 34, 259, 36, 175, - /* 310 */ 287, 353, 165, 86, 167, 56, 335, 0, 295, 267, - /* 320 */ 61, 94, 259, 300, 226, 302, 60, 68, 12, 13, - /* 330 */ 278, 350, 351, 352, 267, 354, 20, 285, 22, 0, - /* 340 */ 37, 1, 2, 193, 85, 278, 14, 295, 300, 33, - /* 350 */ 327, 35, 20, 4, 331, 332, 333, 334, 335, 336, - /* 360 */ 0, 338, 295, 300, 341, 14, 107, 267, 345, 346, - /* 370 */ 347, 20, 56, 226, 20, 148, 287, 60, 278, 0, - /* 380 */ 121, 122, 359, 294, 68, 235, 236, 237, 238, 239, - /* 390 */ 367, 88, 303, 90, 91, 295, 93, 20, 171, 259, - /* 400 */ 97, 85, 63, 64, 65, 66, 67, 47, 69, 70, - /* 410 */ 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, - /* 420 */ 81, 82, 119, 107, 20, 166, 86, 168, 8, 9, - /* 430 */ 226, 20, 12, 13, 14, 15, 16, 121, 122, 60, - /* 440 */ 300, 214, 215, 216, 217, 218, 219, 220, 221, 222, - /* 450 */ 223, 259, 193, 194, 259, 196, 197, 198, 199, 200, - /* 460 */ 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, - /* 470 */ 211, 212, 213, 8, 9, 56, 60, 12, 13, 14, - /* 480 */ 15, 16, 166, 97, 168, 12, 13, 14, 15, 16, - /* 490 */ 22, 295, 300, 8, 9, 300, 289, 12, 13, 14, - /* 500 */ 15, 16, 306, 35, 85, 119, 87, 300, 43, 193, - /* 510 */ 194, 20, 196, 197, 198, 199, 200, 201, 202, 203, - /* 520 */ 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, - /* 530 */ 12, 13, 14, 326, 327, 328, 68, 286, 20, 279, - /* 540 */ 22, 259, 226, 289, 267, 338, 61, 287, 197, 269, - /* 550 */ 299, 33, 289, 35, 300, 278, 296, 153, 116, 117, - /* 560 */ 8, 9, 282, 300, 12, 13, 14, 15, 16, 287, - /* 570 */ 290, 56, 295, 35, 56, 107, 227, 295, 158, 94, - /* 580 */ 326, 327, 300, 4, 302, 302, 68, 12, 13, 326, - /* 590 */ 327, 328, 338, 267, 357, 20, 313, 22, 19, 84, - /* 600 */ 151, 338, 87, 85, 278, 259, 68, 370, 33, 327, - /* 610 */ 35, 374, 33, 331, 332, 333, 334, 335, 336, 177, - /* 620 */ 338, 295, 180, 341, 259, 107, 47, 345, 346, 347, - /* 630 */ 51, 56, 20, 148, 166, 56, 168, 316, 86, 121, - /* 640 */ 122, 2, 259, 68, 153, 226, 300, 8, 9, 367, - /* 650 */ 117, 12, 13, 14, 15, 16, 171, 312, 14, 314, - /* 660 */ 85, 193, 194, 84, 20, 300, 87, 39, 248, 8, - /* 670 */ 9, 279, 357, 12, 13, 14, 15, 16, 357, 287, - /* 680 */ 231, 232, 107, 300, 166, 370, 168, 297, 296, 374, - /* 690 */ 300, 370, 14, 15, 16, 374, 121, 122, 0, 214, - /* 700 */ 215, 216, 217, 218, 219, 220, 221, 222, 223, 176, - /* 710 */ 177, 193, 194, 180, 196, 197, 198, 199, 200, 201, - /* 720 */ 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, - /* 730 */ 212, 213, 8, 9, 273, 274, 12, 13, 14, 15, - /* 740 */ 16, 166, 329, 168, 273, 274, 48, 86, 98, 99, - /* 750 */ 100, 101, 102, 103, 104, 105, 106, 107, 108, 3, - /* 760 */ 110, 111, 112, 113, 114, 115, 353, 316, 193, 194, - /* 770 */ 259, 196, 197, 198, 199, 200, 201, 202, 203, 204, - /* 780 */ 205, 206, 207, 208, 209, 210, 211, 212, 213, 12, - /* 790 */ 13, 18, 20, 20, 97, 19, 316, 20, 259, 22, - /* 800 */ 27, 297, 259, 30, 300, 259, 259, 267, 357, 33, - /* 810 */ 33, 300, 35, 116, 117, 118, 119, 120, 278, 0, - /* 820 */ 47, 370, 49, 47, 51, 374, 259, 267, 52, 53, - /* 830 */ 54, 55, 56, 56, 287, 295, 287, 357, 278, 300, - /* 840 */ 267, 197, 295, 300, 96, 68, 300, 300, 267, 302, - /* 850 */ 370, 278, 303, 225, 374, 295, 288, 84, 35, 278, - /* 860 */ 84, 267, 85, 87, 275, 68, 277, 300, 295, 96, - /* 870 */ 280, 329, 278, 283, 327, 43, 295, 153, 331, 332, - /* 880 */ 333, 334, 335, 336, 107, 338, 44, 45, 341, 295, - /* 890 */ 259, 68, 345, 346, 0, 353, 120, 124, 121, 122, - /* 900 */ 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, - /* 910 */ 137, 138, 139, 140, 141, 142, 143, 144, 86, 146, - /* 920 */ 147, 259, 259, 2, 224, 225, 68, 18, 152, 8, - /* 930 */ 9, 300, 23, 12, 13, 14, 15, 16, 0, 42, - /* 940 */ 43, 153, 154, 166, 267, 168, 37, 38, 288, 173, - /* 950 */ 41, 175, 8, 9, 259, 278, 12, 13, 14, 15, - /* 960 */ 16, 259, 300, 300, 288, 259, 57, 58, 59, 197, - /* 970 */ 193, 194, 295, 196, 197, 198, 199, 200, 201, 202, - /* 980 */ 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, - /* 990 */ 213, 97, 267, 287, 85, 300, 267, 0, 267, 243, - /* 1000 */ 43, 295, 300, 278, 35, 43, 300, 278, 302, 278, - /* 1010 */ 116, 117, 118, 119, 120, 89, 43, 267, 92, 22, - /* 1020 */ 295, 35, 316, 43, 295, 267, 295, 0, 278, 288, - /* 1030 */ 86, 61, 123, 327, 56, 97, 278, 331, 332, 333, - /* 1040 */ 334, 335, 336, 86, 338, 295, 259, 341, 86, 22, - /* 1050 */ 288, 345, 346, 295, 116, 117, 118, 119, 120, 86, - /* 1060 */ 12, 13, 267, 357, 43, 87, 86, 158, 159, 160, - /* 1070 */ 22, 0, 163, 278, 287, 289, 370, 267, 169, 43, - /* 1080 */ 374, 33, 295, 35, 43, 89, 300, 300, 92, 302, - /* 1090 */ 295, 182, 89, 22, 185, 92, 187, 188, 189, 190, - /* 1100 */ 191, 192, 46, 89, 56, 295, 92, 86, 43, 43, - /* 1110 */ 1, 2, 326, 327, 327, 43, 68, 288, 331, 332, - /* 1120 */ 333, 334, 335, 336, 338, 338, 316, 86, 341, 259, - /* 1130 */ 121, 122, 345, 346, 347, 226, 43, 168, 43, 43, - /* 1140 */ 43, 85, 43, 356, 43, 335, 43, 288, 320, 85, - /* 1150 */ 260, 86, 86, 276, 168, 107, 377, 287, 86, 95, - /* 1160 */ 350, 351, 352, 193, 354, 295, 368, 357, 268, 323, - /* 1170 */ 300, 364, 302, 287, 268, 299, 266, 330, 348, 86, - /* 1180 */ 370, 86, 86, 86, 374, 86, 316, 86, 355, 86, - /* 1190 */ 325, 371, 259, 371, 358, 371, 228, 327, 20, 267, - /* 1200 */ 47, 331, 332, 333, 334, 335, 336, 324, 338, 35, - /* 1210 */ 273, 164, 42, 318, 166, 307, 168, 267, 267, 307, - /* 1220 */ 287, 148, 305, 305, 20, 267, 267, 357, 295, 20, - /* 1230 */ 267, 271, 261, 300, 259, 302, 322, 261, 302, 20, - /* 1240 */ 370, 193, 194, 271, 374, 315, 20, 20, 317, 315, - /* 1250 */ 271, 308, 271, 205, 206, 207, 208, 209, 210, 211, - /* 1260 */ 327, 271, 287, 271, 331, 332, 333, 334, 335, 336, - /* 1270 */ 295, 338, 267, 271, 341, 300, 261, 302, 345, 346, - /* 1280 */ 347, 287, 287, 247, 267, 287, 287, 287, 287, 356, - /* 1290 */ 261, 287, 269, 287, 287, 287, 322, 259, 287, 174, - /* 1300 */ 269, 267, 327, 321, 267, 150, 331, 332, 333, 334, - /* 1310 */ 335, 336, 300, 338, 269, 302, 341, 233, 300, 309, - /* 1320 */ 345, 346, 347, 269, 300, 287, 300, 311, 300, 283, - /* 1330 */ 300, 356, 269, 295, 315, 295, 311, 295, 300, 20, - /* 1340 */ 302, 308, 234, 300, 240, 157, 363, 259, 363, 300, - /* 1350 */ 330, 300, 300, 300, 316, 311, 242, 366, 365, 241, - /* 1360 */ 229, 311, 225, 295, 259, 327, 20, 246, 244, 331, - /* 1370 */ 332, 333, 334, 335, 336, 287, 338, 249, 85, 85, - /* 1380 */ 325, 291, 300, 295, 277, 363, 329, 267, 300, 36, - /* 1390 */ 302, 269, 287, 261, 362, 357, 361, 262, 319, 360, - /* 1400 */ 295, 314, 257, 344, 281, 300, 270, 302, 370, 0, - /* 1410 */ 281, 281, 374, 0, 176, 327, 0, 0, 42, 331, - /* 1420 */ 332, 333, 334, 335, 336, 259, 338, 0, 76, 341, - /* 1430 */ 0, 373, 327, 345, 346, 373, 331, 332, 333, 334, - /* 1440 */ 335, 336, 337, 338, 339, 340, 259, 372, 378, 372, - /* 1450 */ 35, 373, 372, 287, 35, 186, 35, 35, 186, 0, - /* 1460 */ 35, 295, 186, 35, 0, 186, 300, 0, 302, 35, - /* 1470 */ 0, 22, 0, 0, 287, 35, 85, 171, 170, 168, - /* 1480 */ 166, 0, 295, 0, 162, 161, 0, 300, 46, 302, - /* 1490 */ 0, 0, 42, 327, 0, 0, 0, 331, 332, 333, - /* 1500 */ 334, 335, 336, 145, 338, 0, 0, 0, 0, 0, - /* 1510 */ 140, 35, 0, 140, 327, 259, 0, 0, 331, 332, - /* 1520 */ 333, 334, 335, 336, 0, 338, 0, 259, 341, 0, - /* 1530 */ 0, 0, 0, 346, 0, 0, 0, 259, 56, 42, - /* 1540 */ 0, 375, 376, 287, 0, 0, 0, 0, 292, 0, - /* 1550 */ 0, 295, 42, 39, 56, 287, 300, 0, 302, 0, - /* 1560 */ 292, 0, 0, 295, 22, 287, 0, 0, 300, 0, - /* 1570 */ 302, 0, 0, 295, 0, 0, 43, 14, 300, 14, - /* 1580 */ 302, 40, 39, 327, 0, 46, 0, 331, 332, 333, - /* 1590 */ 334, 335, 336, 259, 338, 327, 0, 46, 157, 331, - /* 1600 */ 332, 333, 334, 335, 336, 327, 338, 259, 0, 331, - /* 1610 */ 332, 333, 334, 335, 336, 39, 338, 0, 0, 0, - /* 1620 */ 62, 287, 0, 35, 47, 0, 39, 35, 47, 295, - /* 1630 */ 39, 0, 35, 0, 300, 287, 302, 47, 39, 39, - /* 1640 */ 35, 0, 47, 295, 0, 0, 0, 369, 300, 94, - /* 1650 */ 302, 35, 92, 0, 22, 35, 43, 43, 35, 35, - /* 1660 */ 22, 327, 0, 0, 22, 331, 332, 333, 334, 335, - /* 1670 */ 336, 22, 338, 0, 22, 327, 49, 0, 35, 331, - /* 1680 */ 332, 333, 334, 335, 336, 259, 338, 0, 340, 35, - /* 1690 */ 35, 0, 22, 0, 20, 35, 0, 259, 22, 172, - /* 1700 */ 0, 153, 0, 0, 150, 0, 153, 0, 0, 153, - /* 1710 */ 376, 85, 0, 287, 86, 85, 95, 39, 292, 155, - /* 1720 */ 85, 295, 85, 43, 151, 287, 300, 149, 302, 46, - /* 1730 */ 292, 230, 85, 295, 86, 85, 46, 86, 300, 224, - /* 1740 */ 302, 46, 86, 85, 43, 86, 85, 259, 230, 181, - /* 1750 */ 85, 85, 43, 327, 86, 86, 85, 331, 332, 333, - /* 1760 */ 334, 335, 336, 43, 338, 327, 43, 86, 46, 331, - /* 1770 */ 332, 333, 334, 335, 336, 287, 338, 46, 46, 43, - /* 1780 */ 86, 35, 35, 295, 35, 86, 35, 35, 300, 35, - /* 1790 */ 302, 2, 22, 43, 193, 85, 85, 259, 22, 86, - /* 1800 */ 230, 86, 85, 46, 86, 46, 85, 195, 35, 85, - /* 1810 */ 85, 259, 96, 86, 35, 327, 86, 35, 85, 331, - /* 1820 */ 332, 333, 334, 335, 336, 287, 338, 85, 35, 86, - /* 1830 */ 85, 35, 35, 295, 97, 109, 22, 109, 300, 287, - /* 1840 */ 302, 86, 86, 85, 109, 35, 85, 295, 109, 85, - /* 1850 */ 85, 85, 300, 259, 302, 22, 43, 62, 35, 61, - /* 1860 */ 68, 83, 43, 259, 35, 327, 35, 35, 22, 331, - /* 1870 */ 332, 333, 334, 335, 336, 35, 338, 22, 35, 327, - /* 1880 */ 35, 287, 35, 331, 332, 333, 334, 335, 336, 295, - /* 1890 */ 338, 287, 68, 35, 300, 35, 302, 35, 35, 295, - /* 1900 */ 35, 22, 35, 0, 300, 35, 302, 39, 47, 0, - /* 1910 */ 35, 47, 39, 0, 0, 35, 47, 39, 35, 47, - /* 1920 */ 39, 327, 0, 35, 35, 331, 332, 333, 334, 335, - /* 1930 */ 336, 327, 338, 0, 22, 331, 332, 333, 334, 335, - /* 1940 */ 336, 259, 338, 22, 21, 20, 22, 21, 379, 379, - /* 1950 */ 379, 379, 379, 379, 379, 379, 379, 259, 379, 379, - /* 1960 */ 379, 379, 379, 379, 379, 379, 379, 379, 379, 287, - /* 1970 */ 379, 379, 379, 379, 379, 379, 379, 295, 379, 379, - /* 1980 */ 379, 379, 300, 379, 302, 287, 379, 379, 379, 379, - /* 1990 */ 379, 379, 379, 295, 379, 379, 379, 379, 300, 379, - /* 2000 */ 302, 379, 379, 379, 379, 379, 379, 259, 379, 327, - /* 2010 */ 379, 379, 379, 331, 332, 333, 334, 335, 336, 259, - /* 2020 */ 338, 379, 379, 379, 379, 327, 379, 379, 379, 331, - /* 2030 */ 332, 333, 334, 335, 336, 287, 338, 379, 379, 379, - /* 2040 */ 379, 379, 379, 295, 379, 379, 379, 287, 300, 379, - /* 2050 */ 302, 379, 379, 379, 379, 295, 379, 379, 379, 379, - /* 2060 */ 300, 379, 302, 379, 379, 379, 379, 379, 379, 379, - /* 2070 */ 379, 259, 379, 379, 379, 327, 379, 379, 379, 331, - /* 2080 */ 332, 333, 334, 335, 336, 259, 338, 327, 267, 379, - /* 2090 */ 379, 331, 332, 333, 334, 335, 336, 379, 338, 287, - /* 2100 */ 379, 379, 379, 379, 379, 379, 379, 295, 379, 379, - /* 2110 */ 379, 379, 300, 287, 302, 379, 295, 379, 379, 379, - /* 2120 */ 379, 295, 379, 379, 379, 379, 300, 379, 302, 379, - /* 2130 */ 379, 379, 379, 379, 379, 379, 379, 316, 379, 327, - /* 2140 */ 379, 259, 379, 331, 332, 333, 334, 335, 336, 379, - /* 2150 */ 338, 259, 379, 327, 379, 379, 335, 331, 332, 333, - /* 2160 */ 334, 335, 336, 379, 338, 379, 379, 379, 379, 287, - /* 2170 */ 379, 350, 351, 352, 379, 354, 379, 295, 357, 287, - /* 2180 */ 379, 379, 300, 379, 302, 379, 379, 295, 379, 379, - /* 2190 */ 379, 370, 300, 379, 302, 374, 379, 379, 379, 379, - /* 2200 */ 379, 259, 379, 379, 379, 379, 379, 379, 379, 327, - /* 2210 */ 379, 379, 379, 331, 332, 333, 334, 335, 336, 327, - /* 2220 */ 338, 379, 379, 331, 332, 333, 334, 335, 336, 287, - /* 2230 */ 338, 379, 379, 379, 379, 379, 379, 295, 379, 379, - /* 2240 */ 379, 379, 300, 379, 302, 379, 379, 379, 379, 379, - /* 2250 */ 379, 379, 379, 259, 379, 379, 379, 379, 379, 379, - /* 2260 */ 379, 379, 379, 379, 379, 379, 379, 259, 379, 327, - /* 2270 */ 379, 379, 379, 331, 332, 333, 334, 335, 336, 259, - /* 2280 */ 338, 287, 379, 379, 379, 379, 379, 379, 379, 295, - /* 2290 */ 379, 379, 379, 379, 300, 287, 302, 379, 379, 379, - /* 2300 */ 379, 379, 379, 295, 379, 379, 379, 287, 300, 379, - /* 2310 */ 302, 379, 379, 379, 379, 295, 379, 379, 379, 379, - /* 2320 */ 300, 327, 302, 379, 379, 331, 332, 333, 334, 335, - /* 2330 */ 336, 259, 338, 379, 379, 327, 379, 379, 379, 331, - /* 2340 */ 332, 333, 334, 335, 336, 259, 338, 327, 379, 379, - /* 2350 */ 379, 331, 332, 333, 334, 335, 336, 379, 338, 287, - /* 2360 */ 379, 379, 379, 379, 379, 379, 379, 295, 379, 379, - /* 2370 */ 379, 379, 300, 287, 302, 379, 379, 379, 379, 379, - /* 2380 */ 379, 295, 379, 379, 379, 379, 300, 379, 302, 379, - /* 2390 */ 379, 379, 379, 379, 379, 379, 379, 379, 379, 327, - /* 2400 */ 379, 259, 379, 331, 332, 333, 334, 335, 336, 379, - /* 2410 */ 338, 379, 379, 327, 379, 379, 379, 331, 332, 333, - /* 2420 */ 334, 335, 336, 379, 338, 379, 379, 379, 379, 287, - /* 2430 */ 379, 379, 379, 379, 379, 379, 379, 295, 379, 379, - /* 2440 */ 379, 379, 300, 379, 302, 379, 379, 379, 379, 379, - /* 2450 */ 379, 379, 379, 379, 379, 379, 379, 379, 379, 379, - /* 2460 */ 379, 379, 379, 379, 379, 379, 379, 379, 379, 327, - /* 2470 */ 379, 379, 379, 331, 332, 333, 334, 335, 336, 379, - /* 2480 */ 338, + /* 210 */ 210, 211, 212, 213, 214, 215, 216, 217, 0, 89, + /* 220 */ 8, 9, 0, 56, 12, 13, 14, 15, 16, 275, + /* 230 */ 230, 230, 170, 0, 172, 181, 1, 2, 184, 22, + /* 240 */ 361, 79, 24, 25, 26, 27, 28, 29, 30, 31, + /* 250 */ 32, 297, 35, 374, 197, 89, 89, 378, 91, 197, + /* 260 */ 198, 165, 200, 201, 202, 203, 204, 205, 206, 207, + /* 270 */ 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, + /* 280 */ 12, 13, 60, 187, 188, 68, 301, 291, 20, 304, + /* 290 */ 22, 129, 130, 60, 263, 299, 239, 240, 241, 242, + /* 300 */ 243, 33, 90, 35, 102, 103, 104, 105, 106, 107, + /* 310 */ 108, 109, 110, 111, 112, 283, 114, 115, 116, 117, + /* 320 */ 118, 119, 291, 291, 56, 90, 155, 271, 111, 61, + /* 330 */ 299, 162, 300, 337, 230, 304, 68, 306, 282, 20, + /* 340 */ 8, 9, 12, 13, 12, 13, 14, 15, 16, 271, + /* 350 */ 20, 320, 22, 20, 320, 299, 262, 89, 264, 20, + /* 360 */ 230, 273, 331, 33, 89, 35, 335, 336, 337, 338, + /* 370 */ 339, 340, 271, 342, 271, 263, 345, 299, 56, 111, + /* 380 */ 349, 350, 294, 282, 89, 282, 56, 170, 293, 172, + /* 390 */ 305, 306, 361, 125, 126, 361, 230, 230, 68, 304, + /* 400 */ 299, 120, 299, 291, 263, 374, 235, 236, 374, 378, + /* 410 */ 88, 299, 378, 91, 197, 198, 304, 339, 306, 89, + /* 420 */ 35, 252, 90, 8, 9, 330, 331, 12, 13, 14, + /* 430 */ 15, 16, 354, 355, 356, 333, 358, 342, 170, 301, + /* 440 */ 172, 111, 304, 331, 169, 304, 171, 335, 336, 337, + /* 450 */ 338, 339, 340, 68, 342, 125, 126, 345, 43, 357, + /* 460 */ 263, 349, 350, 182, 183, 197, 198, 0, 200, 201, + /* 470 */ 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, + /* 480 */ 212, 213, 214, 215, 216, 217, 271, 8, 9, 22, + /* 490 */ 157, 12, 13, 14, 15, 16, 316, 282, 318, 33, + /* 500 */ 170, 304, 172, 8, 9, 230, 43, 12, 13, 14, + /* 510 */ 15, 16, 268, 47, 299, 271, 277, 278, 52, 53, + /* 520 */ 54, 55, 56, 263, 316, 230, 318, 197, 198, 320, + /* 530 */ 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, + /* 540 */ 210, 211, 212, 213, 214, 215, 216, 217, 12, 13, + /* 550 */ 14, 291, 263, 18, 88, 20, 20, 91, 22, 299, + /* 560 */ 230, 299, 27, 4, 304, 30, 306, 2, 20, 33, + /* 570 */ 361, 35, 310, 8, 9, 21, 263, 12, 13, 14, + /* 580 */ 15, 16, 47, 374, 49, 90, 51, 378, 34, 263, + /* 590 */ 36, 331, 56, 304, 290, 335, 336, 337, 338, 339, + /* 600 */ 340, 293, 342, 306, 68, 345, 0, 303, 20, 349, + /* 610 */ 350, 351, 304, 271, 317, 263, 263, 304, 271, 153, + /* 620 */ 154, 271, 156, 88, 282, 89, 160, 291, 152, 282, + /* 630 */ 304, 371, 282, 61, 298, 100, 157, 271, 330, 331, + /* 640 */ 332, 299, 299, 307, 291, 179, 299, 111, 282, 299, + /* 650 */ 342, 175, 299, 310, 14, 289, 304, 304, 0, 306, + /* 660 */ 20, 125, 126, 128, 263, 299, 131, 132, 133, 134, + /* 670 */ 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, + /* 680 */ 145, 146, 147, 148, 331, 150, 151, 275, 335, 336, + /* 690 */ 337, 338, 339, 340, 218, 342, 268, 361, 345, 271, + /* 700 */ 288, 291, 349, 350, 351, 304, 170, 101, 172, 297, + /* 710 */ 374, 333, 249, 360, 378, 8, 9, 307, 3, 12, + /* 720 */ 13, 14, 15, 16, 60, 263, 120, 121, 122, 123, + /* 730 */ 124, 277, 278, 197, 198, 357, 200, 201, 202, 203, + /* 740 */ 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, + /* 750 */ 214, 215, 216, 217, 12, 13, 4, 283, 19, 101, + /* 760 */ 291, 263, 20, 68, 22, 291, 304, 298, 61, 197, + /* 770 */ 320, 19, 33, 263, 300, 33, 307, 35, 120, 121, + /* 780 */ 122, 123, 124, 100, 263, 33, 47, 279, 39, 281, + /* 790 */ 231, 52, 53, 54, 55, 56, 293, 90, 56, 47, + /* 800 */ 37, 263, 304, 51, 271, 98, 2, 304, 56, 263, + /* 810 */ 68, 361, 8, 9, 304, 282, 12, 13, 14, 15, + /* 820 */ 16, 263, 289, 271, 374, 304, 20, 88, 378, 291, + /* 830 */ 91, 89, 299, 330, 331, 332, 20, 299, 271, 68, + /* 840 */ 88, 201, 304, 91, 306, 342, 14, 44, 45, 282, + /* 850 */ 304, 299, 20, 111, 291, 92, 43, 94, 95, 152, + /* 860 */ 97, 298, 304, 124, 101, 292, 299, 125, 126, 331, + /* 870 */ 307, 228, 229, 335, 336, 337, 338, 339, 340, 263, + /* 880 */ 342, 260, 175, 345, 42, 43, 123, 349, 350, 351, + /* 890 */ 43, 339, 8, 9, 271, 156, 12, 13, 14, 15, + /* 900 */ 16, 363, 0, 90, 292, 282, 354, 355, 356, 371, + /* 910 */ 358, 292, 170, 35, 172, 101, 177, 292, 179, 292, + /* 920 */ 304, 284, 299, 263, 287, 218, 219, 220, 221, 222, + /* 930 */ 223, 224, 225, 226, 227, 263, 263, 123, 292, 197, + /* 940 */ 198, 320, 200, 201, 202, 203, 204, 205, 206, 207, + /* 950 */ 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, + /* 960 */ 12, 13, 247, 157, 304, 101, 64, 65, 20, 93, + /* 970 */ 22, 69, 96, 320, 72, 35, 304, 304, 229, 263, + /* 980 */ 78, 33, 361, 35, 120, 121, 122, 123, 124, 0, + /* 990 */ 292, 271, 64, 65, 43, 374, 0, 69, 271, 378, + /* 1000 */ 72, 271, 282, 0, 56, 56, 78, 291, 93, 282, + /* 1010 */ 93, 96, 282, 96, 361, 299, 68, 201, 22, 299, + /* 1020 */ 304, 271, 306, 18, 43, 22, 299, 374, 23, 299, + /* 1030 */ 43, 378, 282, 201, 324, 93, 47, 89, 96, 264, + /* 1040 */ 91, 90, 37, 38, 157, 158, 41, 331, 381, 299, + /* 1050 */ 172, 335, 336, 337, 338, 339, 340, 271, 342, 111, + /* 1060 */ 43, 345, 57, 58, 59, 349, 350, 351, 282, 271, + /* 1070 */ 43, 90, 43, 125, 126, 43, 360, 90, 372, 43, + /* 1080 */ 282, 1, 2, 8, 9, 299, 43, 12, 13, 14, + /* 1090 */ 15, 16, 125, 126, 89, 43, 46, 299, 251, 89, + /* 1100 */ 43, 13, 35, 13, 280, 272, 327, 90, 368, 99, + /* 1110 */ 291, 272, 172, 270, 303, 334, 359, 90, 170, 90, + /* 1120 */ 172, 352, 90, 35, 43, 35, 90, 43, 43, 43, + /* 1130 */ 43, 0, 127, 90, 375, 68, 61, 375, 362, 89, + /* 1140 */ 375, 232, 90, 20, 329, 197, 198, 90, 200, 201, + /* 1150 */ 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, + /* 1160 */ 212, 213, 214, 215, 216, 217, 271, 162, 163, 164, + /* 1170 */ 35, 90, 167, 98, 90, 90, 90, 90, 173, 48, + /* 1180 */ 328, 47, 12, 13, 277, 322, 168, 42, 311, 263, + /* 1190 */ 271, 186, 22, 271, 189, 309, 191, 192, 193, 194, + /* 1200 */ 195, 196, 311, 33, 271, 35, 152, 309, 271, 271, + /* 1210 */ 20, 265, 265, 20, 326, 20, 275, 291, 306, 275, + /* 1220 */ 319, 271, 20, 319, 321, 299, 56, 152, 275, 275, + /* 1230 */ 304, 20, 306, 312, 275, 230, 275, 271, 68, 275, + /* 1240 */ 265, 271, 265, 291, 326, 273, 291, 291, 291, 299, + /* 1250 */ 175, 291, 178, 291, 291, 325, 291, 331, 273, 291, + /* 1260 */ 291, 335, 336, 337, 338, 339, 340, 291, 342, 271, + /* 1270 */ 320, 345, 271, 273, 237, 349, 350, 351, 304, 263, + /* 1280 */ 154, 111, 273, 304, 306, 299, 360, 304, 315, 339, + /* 1290 */ 319, 299, 304, 218, 219, 220, 221, 222, 223, 224, + /* 1300 */ 225, 226, 227, 304, 354, 355, 356, 291, 358, 315, + /* 1310 */ 304, 361, 287, 273, 312, 299, 20, 313, 334, 304, + /* 1320 */ 304, 238, 306, 315, 374, 367, 304, 304, 378, 263, + /* 1330 */ 304, 233, 304, 244, 315, 161, 320, 246, 245, 229, + /* 1340 */ 170, 329, 172, 299, 20, 250, 333, 331, 248, 367, + /* 1350 */ 370, 335, 336, 337, 338, 339, 340, 291, 342, 369, + /* 1360 */ 367, 366, 365, 89, 253, 299, 89, 197, 198, 304, + /* 1370 */ 304, 364, 306, 382, 295, 281, 271, 361, 348, 209, + /* 1380 */ 210, 211, 212, 213, 214, 215, 320, 273, 377, 36, + /* 1390 */ 374, 377, 323, 266, 378, 265, 263, 331, 377, 274, + /* 1400 */ 376, 335, 336, 337, 338, 339, 340, 376, 342, 376, + /* 1410 */ 318, 0, 261, 263, 285, 0, 180, 285, 0, 0, + /* 1420 */ 0, 285, 42, 76, 291, 0, 35, 361, 190, 35, + /* 1430 */ 271, 35, 299, 35, 190, 0, 35, 304, 35, 306, + /* 1440 */ 374, 291, 190, 0, 378, 190, 0, 35, 0, 299, + /* 1450 */ 0, 22, 35, 0, 304, 175, 306, 89, 299, 174, + /* 1460 */ 172, 170, 0, 0, 331, 166, 165, 263, 335, 336, + /* 1470 */ 337, 338, 339, 340, 0, 342, 0, 46, 345, 320, + /* 1480 */ 0, 331, 349, 350, 42, 335, 336, 337, 338, 339, + /* 1490 */ 340, 341, 342, 343, 344, 291, 0, 0, 339, 0, + /* 1500 */ 149, 0, 0, 299, 0, 0, 0, 144, 304, 0, + /* 1510 */ 306, 144, 35, 354, 355, 356, 0, 358, 0, 0, + /* 1520 */ 361, 263, 0, 0, 0, 0, 0, 0, 0, 0, + /* 1530 */ 0, 0, 0, 374, 42, 331, 22, 378, 0, 335, + /* 1540 */ 336, 337, 338, 339, 340, 263, 342, 0, 0, 291, + /* 1550 */ 0, 0, 0, 0, 0, 0, 0, 299, 0, 56, + /* 1560 */ 0, 0, 304, 56, 306, 0, 46, 46, 0, 0, + /* 1570 */ 0, 263, 0, 291, 39, 42, 14, 43, 296, 40, + /* 1580 */ 14, 299, 39, 379, 380, 39, 304, 161, 306, 331, + /* 1590 */ 0, 0, 0, 335, 336, 337, 338, 339, 340, 291, + /* 1600 */ 342, 0, 62, 345, 296, 0, 35, 299, 350, 0, + /* 1610 */ 47, 47, 304, 331, 306, 39, 35, 335, 336, 337, + /* 1620 */ 338, 339, 340, 39, 342, 0, 47, 39, 35, 263, + /* 1630 */ 0, 35, 47, 39, 0, 0, 0, 0, 35, 331, + /* 1640 */ 98, 263, 22, 335, 336, 337, 338, 339, 340, 35, + /* 1650 */ 342, 0, 35, 96, 43, 43, 35, 291, 0, 0, + /* 1660 */ 22, 22, 22, 0, 49, 299, 22, 35, 0, 291, + /* 1670 */ 304, 0, 306, 0, 22, 20, 35, 299, 35, 0, + /* 1680 */ 35, 0, 304, 22, 306, 0, 176, 0, 0, 0, + /* 1690 */ 0, 263, 90, 89, 157, 0, 185, 331, 157, 154, + /* 1700 */ 0, 335, 336, 337, 338, 339, 340, 89, 342, 331, + /* 1710 */ 46, 89, 153, 335, 336, 337, 338, 339, 340, 291, + /* 1720 */ 342, 39, 89, 99, 157, 234, 43, 299, 155, 43, + /* 1730 */ 46, 89, 304, 263, 306, 89, 159, 90, 90, 373, + /* 1740 */ 90, 43, 89, 46, 90, 263, 89, 43, 46, 89, + /* 1750 */ 43, 89, 46, 43, 46, 90, 89, 263, 380, 331, + /* 1760 */ 35, 291, 90, 335, 336, 337, 338, 339, 340, 299, + /* 1770 */ 342, 35, 344, 291, 304, 35, 306, 35, 296, 35, + /* 1780 */ 35, 299, 90, 234, 90, 291, 304, 2, 306, 90, + /* 1790 */ 296, 22, 197, 299, 43, 90, 46, 22, 304, 263, + /* 1800 */ 306, 331, 228, 89, 89, 335, 336, 337, 338, 339, + /* 1810 */ 340, 90, 342, 331, 234, 89, 89, 335, 336, 337, + /* 1820 */ 338, 339, 340, 90, 342, 331, 89, 291, 46, 335, + /* 1830 */ 336, 337, 338, 339, 340, 299, 342, 89, 100, 90, + /* 1840 */ 304, 35, 306, 35, 89, 35, 90, 89, 35, 90, + /* 1850 */ 89, 35, 263, 90, 89, 199, 90, 35, 22, 89, + /* 1860 */ 113, 101, 263, 89, 35, 113, 113, 331, 89, 89, + /* 1870 */ 113, 335, 336, 337, 338, 339, 340, 43, 342, 22, + /* 1880 */ 291, 62, 61, 35, 35, 35, 35, 35, 299, 87, + /* 1890 */ 291, 68, 22, 304, 35, 306, 35, 43, 299, 35, + /* 1900 */ 35, 22, 35, 304, 35, 306, 68, 35, 35, 35, + /* 1910 */ 35, 35, 263, 35, 22, 35, 0, 35, 47, 0, + /* 1920 */ 331, 35, 39, 39, 335, 336, 337, 338, 339, 340, + /* 1930 */ 331, 342, 47, 263, 335, 336, 337, 338, 339, 340, + /* 1940 */ 291, 342, 0, 35, 47, 0, 39, 35, 299, 47, + /* 1950 */ 39, 0, 35, 304, 0, 306, 35, 22, 21, 20, + /* 1960 */ 22, 291, 22, 383, 21, 383, 383, 383, 383, 299, + /* 1970 */ 383, 383, 383, 383, 304, 383, 306, 383, 383, 383, + /* 1980 */ 331, 383, 383, 263, 335, 336, 337, 338, 339, 340, + /* 1990 */ 383, 342, 383, 383, 383, 383, 383, 263, 383, 383, + /* 2000 */ 383, 331, 383, 383, 383, 335, 336, 337, 338, 339, + /* 2010 */ 340, 291, 342, 383, 383, 383, 383, 383, 383, 299, + /* 2020 */ 383, 383, 383, 383, 304, 291, 306, 383, 383, 383, + /* 2030 */ 383, 383, 383, 299, 383, 383, 383, 383, 304, 383, + /* 2040 */ 306, 383, 383, 383, 383, 383, 383, 383, 383, 263, + /* 2050 */ 383, 331, 383, 383, 383, 335, 336, 337, 338, 339, + /* 2060 */ 340, 383, 342, 263, 383, 331, 383, 383, 383, 335, + /* 2070 */ 336, 337, 338, 339, 340, 383, 342, 291, 383, 383, + /* 2080 */ 383, 383, 383, 383, 383, 299, 383, 383, 383, 383, + /* 2090 */ 304, 291, 306, 383, 383, 383, 383, 383, 383, 299, + /* 2100 */ 383, 383, 383, 383, 304, 383, 306, 383, 383, 383, + /* 2110 */ 383, 383, 383, 383, 383, 383, 263, 331, 383, 383, + /* 2120 */ 383, 335, 336, 337, 338, 339, 340, 383, 342, 383, + /* 2130 */ 383, 331, 383, 383, 383, 335, 336, 337, 338, 339, + /* 2140 */ 340, 383, 342, 383, 291, 383, 383, 383, 383, 383, + /* 2150 */ 383, 383, 299, 383, 383, 383, 383, 304, 383, 306, + /* 2160 */ 383, 383, 383, 383, 383, 383, 383, 383, 383, 263, + /* 2170 */ 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, + /* 2180 */ 383, 383, 383, 383, 331, 383, 383, 383, 335, 336, + /* 2190 */ 337, 338, 339, 340, 383, 342, 383, 291, 383, 383, + /* 2200 */ 383, 383, 383, 383, 383, 299, 383, 383, 383, 383, + /* 2210 */ 304, 383, 306, 383, 383, 383, 383, 383, 383, 263, + /* 2220 */ 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, + /* 2230 */ 383, 383, 383, 263, 383, 383, 383, 331, 383, 383, + /* 2240 */ 383, 335, 336, 337, 338, 339, 340, 291, 342, 383, + /* 2250 */ 383, 383, 383, 383, 383, 299, 383, 383, 383, 383, + /* 2260 */ 304, 291, 306, 383, 383, 383, 383, 383, 383, 299, + /* 2270 */ 383, 383, 383, 383, 304, 263, 306, 383, 383, 383, + /* 2280 */ 383, 383, 383, 383, 383, 383, 383, 331, 383, 263, + /* 2290 */ 383, 335, 336, 337, 338, 339, 340, 383, 342, 383, + /* 2300 */ 383, 331, 383, 291, 383, 335, 336, 337, 338, 339, + /* 2310 */ 340, 299, 342, 383, 383, 383, 304, 291, 306, 383, + /* 2320 */ 383, 383, 383, 383, 383, 299, 383, 383, 383, 383, + /* 2330 */ 304, 383, 306, 383, 383, 383, 383, 383, 383, 383, + /* 2340 */ 383, 263, 383, 331, 383, 383, 383, 335, 336, 337, + /* 2350 */ 338, 339, 340, 383, 342, 263, 383, 331, 383, 383, + /* 2360 */ 383, 335, 336, 337, 338, 339, 340, 383, 342, 291, + /* 2370 */ 383, 383, 383, 383, 383, 383, 383, 299, 383, 383, + /* 2380 */ 383, 383, 304, 291, 306, 383, 383, 383, 383, 383, + /* 2390 */ 383, 299, 383, 383, 383, 383, 304, 383, 306, 383, + /* 2400 */ 383, 383, 383, 383, 383, 383, 383, 383, 263, 331, + /* 2410 */ 383, 383, 383, 335, 336, 337, 338, 339, 340, 383, + /* 2420 */ 342, 383, 383, 331, 383, 383, 383, 335, 336, 337, + /* 2430 */ 338, 339, 340, 383, 342, 383, 291, 383, 383, 383, + /* 2440 */ 383, 383, 383, 383, 299, 383, 383, 383, 383, 304, + /* 2450 */ 383, 306, 383, 383, 383, 383, 383, 383, 383, 383, + /* 2460 */ 383, 263, 383, 383, 383, 383, 383, 383, 383, 383, + /* 2470 */ 383, 383, 383, 383, 383, 383, 331, 383, 383, 383, + /* 2480 */ 335, 336, 337, 338, 339, 340, 383, 342, 383, 291, + /* 2490 */ 383, 383, 383, 383, 383, 383, 383, 299, 383, 383, + /* 2500 */ 383, 383, 304, 383, 306, 383, 383, 383, 383, 383, + /* 2510 */ 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, + /* 2520 */ 383, 383, 383, 383, 383, 383, 383, 383, 383, 331, + /* 2530 */ 383, 383, 383, 335, 336, 337, 338, 339, 340, 383, + /* 2540 */ 342, }; -#define YY_SHIFT_COUNT (668) +#define YY_SHIFT_COUNT (674) #define YY_SHIFT_MIN (0) -#define YY_SHIFT_MAX (1933) +#define YY_SHIFT_MAX (1954) static const unsigned short int yy_shift_ofst[] = { - /* 0 */ 909, 0, 0, 57, 57, 259, 259, 259, 316, 316, - /* 10 */ 259, 259, 518, 575, 777, 575, 575, 575, 575, 575, - /* 20 */ 575, 575, 575, 575, 575, 575, 575, 575, 575, 575, - /* 30 */ 575, 575, 575, 575, 575, 575, 575, 575, 575, 575, - /* 40 */ 575, 575, 19, 19, 78, 78, 78, 1048, 1048, 54, - /* 50 */ 1048, 1048, 147, 419, 20, 204, 20, 208, 208, 115, - /* 60 */ 115, 98, 53, 20, 20, 208, 208, 208, 208, 208, - /* 70 */ 208, 208, 208, 208, 266, 208, 208, 208, 354, 377, - /* 80 */ 208, 208, 377, 411, 208, 377, 377, 377, 208, 416, - /* 90 */ 773, 227, 485, 485, 122, 468, 468, 468, 468, 468, - /* 100 */ 468, 468, 468, 468, 468, 468, 468, 468, 468, 468, - /* 110 */ 468, 468, 468, 468, 303, 93, 53, 332, 332, 317, - /* 120 */ 538, 379, 404, 404, 404, 538, 612, 612, 354, 819, - /* 130 */ 819, 377, 377, 797, 797, 748, 858, 650, 650, 650, - /* 140 */ 650, 650, 650, 650, 776, 21, 420, 155, 150, 194, - /* 150 */ 533, 449, 351, 644, 86, 842, 386, 491, 700, 628, - /* 160 */ 700, 897, 756, 756, 756, 349, 772, 968, 1178, 1153, - /* 170 */ 1174, 1047, 1170, 1178, 1178, 1170, 1073, 1073, 1178, 1178, - /* 180 */ 1178, 1204, 1204, 1209, 266, 354, 266, 1219, 1226, 266, - /* 190 */ 1219, 266, 1227, 266, 266, 1178, 266, 1204, 377, 377, - /* 200 */ 377, 377, 377, 377, 377, 377, 377, 377, 377, 1178, - /* 210 */ 1204, 797, 1209, 416, 1125, 354, 416, 1178, 1178, 1219, - /* 220 */ 416, 1084, 797, 797, 797, 797, 1084, 797, 1155, 612, - /* 230 */ 1227, 416, 748, 416, 612, 1319, 797, 1108, 1084, 797, - /* 240 */ 797, 1108, 1084, 797, 797, 377, 1104, 1188, 1108, 1114, - /* 250 */ 1118, 1131, 968, 1137, 612, 1346, 1121, 1124, 1128, 1121, - /* 260 */ 1124, 1121, 1124, 1293, 1294, 797, 858, 1178, 416, 1353, - /* 270 */ 1204, 2481, 2481, 2481, 2481, 2481, 2481, 2481, 339, 134, - /* 280 */ 273, 579, 552, 465, 661, 639, 921, 724, 944, 894, - /* 290 */ 51, 51, 51, 51, 51, 51, 51, 51, 938, 697, - /* 300 */ 473, 473, 442, 91, 515, 2, 272, 13, 340, 24, - /* 310 */ 678, 678, 678, 678, 832, 360, 957, 926, 996, 1003, - /* 320 */ 1014, 997, 1027, 1071, 978, 788, 962, 973, 980, 1021, - /* 330 */ 1041, 1065, 1066, 1109, 1009, 32, 1036, 1072, 969, 986, - /* 340 */ 970, 1093, 1056, 1095, 1096, 1097, 1099, 1101, 1103, 1064, - /* 350 */ 823, 698, 1409, 1413, 1238, 1416, 1417, 1376, 1427, 1352, - /* 360 */ 1430, 1415, 1269, 1419, 1421, 1422, 1272, 1459, 1425, 1428, - /* 370 */ 1276, 1464, 1279, 1467, 1434, 1470, 1449, 1472, 1440, 1473, - /* 380 */ 1391, 1306, 1308, 1311, 1314, 1481, 1483, 1322, 1324, 1486, - /* 390 */ 1490, 1442, 1491, 1450, 1494, 1495, 1496, 1358, 1505, 1506, - /* 400 */ 1507, 1508, 1509, 1370, 1476, 1512, 1373, 1516, 1517, 1524, - /* 410 */ 1526, 1529, 1530, 1531, 1532, 1534, 1535, 1536, 1544, 1545, - /* 420 */ 1546, 1497, 1540, 1547, 1549, 1550, 1557, 1559, 1542, 1561, - /* 430 */ 1562, 1566, 1567, 1569, 1482, 1571, 1498, 1572, 1574, 1510, - /* 440 */ 1514, 1533, 1563, 1539, 1565, 1551, 1575, 1541, 1543, 1584, - /* 450 */ 1586, 1596, 1576, 1441, 1608, 1617, 1618, 1558, 1619, 1622, - /* 460 */ 1588, 1577, 1587, 1625, 1592, 1581, 1591, 1631, 1597, 1590, - /* 470 */ 1599, 1633, 1605, 1595, 1600, 1641, 1644, 1645, 1646, 1555, - /* 480 */ 1560, 1616, 1632, 1653, 1620, 1613, 1614, 1623, 1624, 1638, - /* 490 */ 1662, 1642, 1663, 1649, 1627, 1673, 1652, 1643, 1677, 1654, - /* 500 */ 1687, 1655, 1691, 1670, 1674, 1693, 1548, 1660, 1696, 1527, - /* 510 */ 1676, 1553, 1554, 1700, 1702, 1556, 1564, 1703, 1705, 1707, - /* 520 */ 1626, 1628, 1568, 1708, 1630, 1573, 1635, 1712, 1678, 1578, - /* 530 */ 1637, 1621, 1683, 1680, 1501, 1647, 1648, 1650, 1651, 1656, - /* 540 */ 1658, 1701, 1659, 1661, 1665, 1666, 1668, 1709, 1690, 1695, - /* 550 */ 1671, 1720, 1518, 1669, 1681, 1722, 1515, 1723, 1731, 1732, - /* 560 */ 1694, 1736, 1570, 1699, 1746, 1747, 1749, 1751, 1752, 1754, - /* 570 */ 1699, 1789, 1770, 1601, 1750, 1710, 1713, 1711, 1715, 1717, - /* 580 */ 1718, 1757, 1721, 1724, 1759, 1776, 1612, 1725, 1716, 1727, - /* 590 */ 1773, 1779, 1733, 1730, 1782, 1742, 1743, 1793, 1745, 1755, - /* 600 */ 1796, 1758, 1756, 1797, 1761, 1726, 1728, 1735, 1739, 1814, - /* 610 */ 1737, 1764, 1765, 1810, 1766, 1813, 1813, 1833, 1795, 1798, - /* 620 */ 1823, 1792, 1778, 1819, 1829, 1831, 1832, 1846, 1840, 1855, - /* 630 */ 1843, 1845, 1824, 1613, 1847, 1614, 1858, 1860, 1862, 1863, - /* 640 */ 1865, 1879, 1867, 1903, 1870, 1861, 1868, 1909, 1875, 1864, - /* 650 */ 1873, 1913, 1880, 1869, 1878, 1914, 1883, 1872, 1881, 1922, - /* 660 */ 1888, 1889, 1933, 1912, 1923, 1921, 1924, 1926, 1925, + /* 0 */ 1005, 0, 0, 62, 62, 268, 268, 268, 330, 330, + /* 10 */ 268, 268, 536, 742, 948, 742, 742, 742, 742, 742, + /* 20 */ 742, 742, 742, 742, 742, 742, 742, 742, 742, 742, + /* 30 */ 742, 742, 742, 742, 742, 742, 742, 742, 742, 742, + /* 40 */ 742, 742, 104, 104, 100, 100, 100, 1170, 1170, 166, + /* 50 */ 1170, 1170, 275, 167, 130, 295, 130, 122, 122, 36, + /* 60 */ 36, 1, 18, 130, 130, 122, 122, 122, 122, 122, + /* 70 */ 122, 122, 122, 122, 59, 122, 122, 122, 319, 339, + /* 80 */ 122, 122, 339, 548, 122, 339, 339, 339, 122, 664, + /* 90 */ 535, 707, 1075, 1075, 108, 217, 217, 217, 217, 217, + /* 100 */ 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, + /* 110 */ 217, 217, 217, 217, 763, 928, 18, 40, 40, 222, + /* 120 */ 385, 233, 333, 333, 333, 385, 588, 588, 319, 4, + /* 130 */ 4, 339, 339, 695, 695, 683, 771, 202, 202, 202, + /* 140 */ 202, 202, 202, 202, 739, 21, 169, 902, 57, 50, + /* 150 */ 10, 171, 640, 832, 19, 803, 814, 806, 643, 749, + /* 160 */ 643, 842, 715, 715, 715, 559, 816, 909, 1123, 1134, + /* 170 */ 1135, 1018, 1145, 1123, 1123, 1145, 1054, 1054, 1123, 1123, + /* 180 */ 1123, 1190, 1190, 1193, 59, 319, 59, 1195, 1202, 59, + /* 190 */ 1195, 59, 1211, 59, 59, 1123, 59, 1190, 339, 339, + /* 200 */ 339, 339, 339, 339, 339, 339, 339, 339, 339, 1123, + /* 210 */ 1190, 695, 1193, 664, 1074, 319, 664, 1123, 1123, 1195, + /* 220 */ 664, 1037, 695, 695, 695, 695, 1037, 695, 1126, 588, + /* 230 */ 1211, 664, 683, 664, 588, 1296, 695, 1083, 1037, 695, + /* 240 */ 695, 1083, 1037, 695, 695, 339, 1089, 1174, 1083, 1091, + /* 250 */ 1093, 1098, 909, 1110, 588, 1324, 1095, 1100, 1111, 1095, + /* 260 */ 1100, 1095, 1100, 1274, 1277, 695, 771, 1123, 664, 1353, + /* 270 */ 1190, 2541, 2541, 2541, 2541, 2541, 2541, 2541, 83, 466, + /* 280 */ 218, 752, 212, 415, 332, 565, 804, 479, 495, 606, + /* 290 */ 884, 884, 884, 884, 884, 884, 884, 884, 658, 864, + /* 300 */ 13, 13, 54, 96, 322, 162, 554, 281, 235, 476, + /* 310 */ 99, 99, 99, 99, 813, 989, 951, 876, 915, 917, + /* 320 */ 942, 467, 996, 1003, 949, 887, 981, 987, 1017, 1027, + /* 330 */ 1029, 1032, 1036, 1080, 967, 463, 847, 1043, 878, 940, + /* 340 */ 572, 1052, 1050, 1057, 1081, 1084, 1085, 1086, 1087, 1010, + /* 350 */ 1088, 1090, 1067, 1131, 1411, 1415, 1236, 1418, 1419, 1380, + /* 360 */ 1420, 1347, 1425, 1391, 1238, 1394, 1396, 1398, 1244, 1435, + /* 370 */ 1401, 1403, 1252, 1443, 1255, 1446, 1412, 1448, 1429, 1450, + /* 380 */ 1417, 1453, 1368, 1280, 1285, 1288, 1291, 1462, 1463, 1299, + /* 390 */ 1301, 1474, 1476, 1431, 1480, 1442, 1496, 1497, 1499, 1351, + /* 400 */ 1501, 1502, 1504, 1505, 1506, 1363, 1477, 1509, 1367, 1516, + /* 410 */ 1518, 1519, 1522, 1523, 1524, 1525, 1526, 1527, 1528, 1529, + /* 420 */ 1530, 1531, 1532, 1492, 1538, 1547, 1548, 1550, 1551, 1552, + /* 430 */ 1514, 1553, 1554, 1555, 1556, 1558, 1503, 1560, 1507, 1561, + /* 440 */ 1565, 1533, 1535, 1534, 1562, 1520, 1566, 1521, 1568, 1539, + /* 450 */ 1543, 1569, 1570, 1572, 1546, 1426, 1590, 1591, 1592, 1540, + /* 460 */ 1601, 1605, 1571, 1563, 1576, 1609, 1581, 1564, 1584, 1625, + /* 470 */ 1593, 1579, 1588, 1630, 1596, 1585, 1594, 1634, 1635, 1636, + /* 480 */ 1637, 1542, 1557, 1603, 1620, 1651, 1614, 1611, 1612, 1617, + /* 490 */ 1621, 1638, 1658, 1639, 1659, 1640, 1615, 1663, 1644, 1632, + /* 500 */ 1668, 1641, 1671, 1643, 1673, 1652, 1655, 1679, 1537, 1645, + /* 510 */ 1681, 1510, 1661, 1541, 1545, 1685, 1687, 1567, 1577, 1688, + /* 520 */ 1689, 1690, 1604, 1602, 1511, 1695, 1618, 1573, 1622, 1700, + /* 530 */ 1682, 1559, 1633, 1624, 1664, 1683, 1491, 1642, 1647, 1646, + /* 540 */ 1648, 1650, 1653, 1686, 1654, 1657, 1660, 1662, 1665, 1698, + /* 550 */ 1684, 1697, 1667, 1704, 1549, 1672, 1692, 1702, 1574, 1707, + /* 560 */ 1706, 1708, 1694, 1710, 1580, 1699, 1725, 1736, 1740, 1742, + /* 570 */ 1744, 1745, 1699, 1785, 1769, 1595, 1751, 1714, 1705, 1715, + /* 580 */ 1721, 1726, 1733, 1750, 1727, 1737, 1782, 1775, 1656, 1748, + /* 590 */ 1738, 1749, 1806, 1808, 1755, 1756, 1810, 1758, 1759, 1813, + /* 600 */ 1761, 1763, 1816, 1765, 1766, 1822, 1770, 1747, 1752, 1753, + /* 610 */ 1757, 1836, 1760, 1774, 1779, 1829, 1780, 1834, 1834, 1857, + /* 620 */ 1819, 1821, 1848, 1849, 1850, 1851, 1852, 1823, 1802, 1854, + /* 630 */ 1859, 1861, 1864, 1870, 1865, 1879, 1867, 1869, 1838, 1611, + /* 640 */ 1872, 1612, 1873, 1874, 1875, 1876, 1878, 1892, 1880, 1916, + /* 650 */ 1882, 1871, 1883, 1919, 1886, 1885, 1884, 1942, 1908, 1897, + /* 660 */ 1907, 1945, 1912, 1902, 1911, 1951, 1917, 1921, 1954, 1935, + /* 670 */ 1937, 1938, 1940, 1943, 1939, }; #define YY_REDUCE_COUNT (277) -#define YY_REDUCE_MIN (-294) -#define YY_REDUCE_MAX (2142) +#define YY_REDUCE_MIN (-360) +#define YY_REDUCE_MAX (2198) static const short yy_reduce_ofst[] = { - /* 0 */ -254, -201, 706, 23, 282, 787, 933, 975, 870, 1038, - /* 10 */ 547, 1088, 1105, 1166, 1187, 1256, 1268, 1278, 1334, 1348, - /* 20 */ 1426, 1438, 1488, 1538, 1552, 1594, 1604, 1682, 1698, 1748, - /* 30 */ 1760, 1812, 1826, 1882, 1892, 1942, 1994, 2008, 2020, 2072, - /* 40 */ 2086, 2142, 810, 1821, -240, -263, -19, 207, 263, -277, - /* 50 */ 254, 786, -140, -79, 321, 451, 480, -267, 52, -260, - /* 60 */ -229, -274, -258, 237, 315, 67, 100, 277, 326, 560, - /* 70 */ 573, 581, 594, 677, -270, 725, 729, 731, -294, -272, - /* 80 */ 750, 758, -72, -257, 795, 260, 89, 392, 540, 280, - /* 90 */ -226, -219, -219, -219, -176, -118, 48, 63, 140, 192, - /* 100 */ 195, 346, 365, 383, 511, 539, 543, 546, 567, 631, - /* 110 */ 662, 663, 695, 702, 251, -247, -117, -210, -87, -262, - /* 120 */ 461, -152, -42, 413, 542, 471, -10, 196, 283, -65, - /* 130 */ 345, -126, 549, 390, 504, 590, 589, 568, 660, 676, - /* 140 */ 741, 762, 829, 859, 828, 890, 779, 877, 798, 900, - /* 150 */ 846, 807, 886, 886, 906, 910, 876, 847, 833, 833, - /* 160 */ 833, 830, 820, 822, 824, 836, 886, 865, 932, 883, - /* 170 */ 937, 895, 908, 950, 951, 912, 917, 918, 958, 959, - /* 180 */ 963, 971, 976, 914, 960, 936, 972, 930, 931, 979, - /* 190 */ 934, 981, 943, 990, 992, 1005, 1002, 1015, 994, 995, - /* 200 */ 998, 999, 1000, 1001, 1004, 1006, 1007, 1008, 1011, 1017, - /* 210 */ 1029, 1012, 974, 1023, 982, 1013, 1031, 1034, 1037, 1019, - /* 220 */ 1045, 1016, 1018, 1024, 1026, 1028, 1025, 1030, 1010, 1040, - /* 230 */ 1033, 1054, 1046, 1063, 1042, 1020, 1043, 983, 1044, 1049, - /* 240 */ 1051, 985, 1050, 1052, 1053, 886, 991, 993, 1022, 1032, - /* 250 */ 1035, 1039, 1055, 833, 1068, 1057, 1058, 1075, 1070, 1062, - /* 260 */ 1077, 1078, 1080, 1059, 1090, 1082, 1107, 1120, 1122, 1135, - /* 270 */ 1132, 1079, 1087, 1123, 1129, 1130, 1136, 1145, + /* 0 */ 621, -233, 31, 538, 260, 353, 716, 926, 1016, 1066, + /* 10 */ 112, 1133, 1150, 1204, 1258, 1282, 1308, 1366, 1378, 1428, + /* 20 */ 1482, 1494, 1470, 1536, 1589, 1599, 1649, 1670, 1720, 1734, + /* 30 */ 1786, 1800, 1853, 1906, 1956, 1970, 2012, 2026, 2078, 2092, + /* 40 */ 2145, 2198, 950, 1159, -262, 78, 552, 308, 503, 336, + /* 50 */ -287, 95, -121, 34, 209, 450, 653, 366, 533, -267, + /* 60 */ -259, -360, -243, -342, -182, -172, 56, 101, 103, 215, + /* 70 */ 342, 347, 350, 567, 412, 623, 720, 727, -283, -276, + /* 80 */ 730, 750, 469, -4, 786, 32, 563, 474, 798, -208, + /* 90 */ -207, -225, -225, -225, 94, -247, -196, 141, 197, 289, + /* 100 */ 313, 326, 352, 401, 462, 498, 510, 521, 546, 558, + /* 110 */ 616, 660, 672, 673, 304, -100, 85, 244, 428, -46, + /* 120 */ 239, 88, -162, 102, 378, 454, 262, 343, 297, 180, + /* 130 */ 208, -212, 410, -15, 138, 637, 508, 573, 612, 619, + /* 140 */ 625, 627, 646, 698, 710, 775, 667, 824, 706, 833, + /* 150 */ 779, 740, 819, 819, 839, 843, 811, 781, 757, 757, + /* 160 */ 757, 769, 759, 762, 765, 776, 819, 815, 895, 852, + /* 170 */ 907, 863, 877, 919, 922, 891, 886, 898, 933, 937, + /* 180 */ 938, 946, 947, 888, 941, 912, 944, 901, 903, 953, + /* 190 */ 904, 954, 921, 959, 961, 966, 964, 975, 952, 955, + /* 200 */ 956, 957, 960, 962, 963, 965, 968, 969, 976, 970, + /* 210 */ 977, 974, 918, 972, 930, 978, 985, 998, 1001, 971, + /* 220 */ 1000, 973, 979, 983, 988, 999, 994, 1006, 1004, 986, + /* 230 */ 1002, 1009, 1025, 1040, 992, 984, 1015, 958, 1008, 1022, + /* 240 */ 1023, 982, 1019, 1026, 1028, 819, 980, 990, 993, 995, + /* 250 */ 997, 1007, 1012, 757, 1044, 1013, 1011, 1024, 991, 1014, + /* 260 */ 1031, 1021, 1033, 1030, 1079, 1065, 1094, 1105, 1114, 1127, + /* 270 */ 1130, 1069, 1092, 1129, 1132, 1136, 1125, 1151, }; static const YYACTIONTYPE yy_default[] = { - /* 0 */ 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, - /* 10 */ 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, - /* 20 */ 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, - /* 30 */ 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, - /* 40 */ 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, - /* 50 */ 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, - /* 60 */ 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, - /* 70 */ 1458, 1458, 1458, 1458, 1532, 1458, 1458, 1458, 1458, 1458, - /* 80 */ 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1530, - /* 90 */ 1682, 1458, 1862, 1458, 1458, 1458, 1458, 1458, 1458, 1458, - /* 100 */ 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, - /* 110 */ 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1532, - /* 120 */ 1458, 1530, 1874, 1874, 1874, 1458, 1458, 1458, 1458, 1726, - /* 130 */ 1726, 1458, 1458, 1458, 1458, 1624, 1458, 1458, 1458, 1458, - /* 140 */ 1458, 1458, 1458, 1458, 1718, 1458, 1943, 1458, 1458, 1458, - /* 150 */ 1724, 1897, 1458, 1458, 1458, 1458, 1577, 1889, 1866, 1880, - /* 160 */ 1867, 1864, 1928, 1928, 1928, 1883, 1458, 1893, 1458, 1458, - /* 170 */ 1458, 1710, 1687, 1458, 1458, 1687, 1684, 1684, 1458, 1458, - /* 180 */ 1458, 1458, 1458, 1458, 1532, 1458, 1532, 1458, 1458, 1532, - /* 190 */ 1458, 1532, 1458, 1532, 1532, 1458, 1532, 1458, 1458, 1458, - /* 200 */ 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, - /* 210 */ 1458, 1458, 1458, 1530, 1720, 1458, 1530, 1458, 1458, 1458, - /* 220 */ 1530, 1902, 1458, 1458, 1458, 1458, 1902, 1458, 1458, 1458, - /* 230 */ 1458, 1530, 1458, 1530, 1458, 1458, 1458, 1904, 1902, 1458, - /* 240 */ 1458, 1904, 1902, 1458, 1458, 1458, 1916, 1912, 1904, 1920, - /* 250 */ 1918, 1895, 1893, 1880, 1458, 1458, 1934, 1930, 1946, 1934, - /* 260 */ 1930, 1934, 1930, 1458, 1593, 1458, 1458, 1458, 1530, 1490, - /* 270 */ 1458, 1712, 1726, 1627, 1627, 1627, 1533, 1463, 1458, 1458, - /* 280 */ 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, - /* 290 */ 1799, 1915, 1914, 1838, 1837, 1836, 1834, 1798, 1458, 1589, - /* 300 */ 1797, 1796, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, - /* 310 */ 1790, 1791, 1789, 1788, 1458, 1458, 1458, 1458, 1458, 1458, - /* 320 */ 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, - /* 330 */ 1458, 1458, 1458, 1863, 1458, 1931, 1935, 1458, 1458, 1458, - /* 340 */ 1458, 1458, 1773, 1458, 1458, 1458, 1458, 1458, 1458, 1458, - /* 350 */ 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, - /* 360 */ 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, - /* 370 */ 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, - /* 380 */ 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, - /* 390 */ 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, - /* 400 */ 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, - /* 410 */ 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, - /* 420 */ 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, - /* 430 */ 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, - /* 440 */ 1458, 1495, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, - /* 450 */ 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, - /* 460 */ 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, - /* 470 */ 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, - /* 480 */ 1458, 1458, 1458, 1458, 1458, 1561, 1560, 1458, 1458, 1458, - /* 490 */ 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, - /* 500 */ 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, - /* 510 */ 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, - /* 520 */ 1458, 1458, 1458, 1730, 1458, 1458, 1458, 1458, 1458, 1458, - /* 530 */ 1458, 1458, 1458, 1896, 1458, 1458, 1458, 1458, 1458, 1458, - /* 540 */ 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1773, - /* 550 */ 1458, 1913, 1458, 1873, 1869, 1458, 1458, 1865, 1772, 1458, - /* 560 */ 1458, 1929, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, - /* 570 */ 1458, 1858, 1458, 1458, 1831, 1816, 1458, 1458, 1458, 1458, - /* 580 */ 1458, 1458, 1458, 1458, 1458, 1458, 1784, 1458, 1458, 1458, - /* 590 */ 1458, 1458, 1621, 1458, 1458, 1458, 1458, 1458, 1458, 1458, - /* 600 */ 1458, 1458, 1458, 1458, 1458, 1606, 1604, 1603, 1602, 1458, - /* 610 */ 1599, 1458, 1458, 1458, 1458, 1630, 1629, 1458, 1458, 1458, - /* 620 */ 1458, 1458, 1458, 1553, 1458, 1458, 1458, 1458, 1458, 1458, - /* 630 */ 1458, 1458, 1458, 1544, 1458, 1543, 1458, 1458, 1458, 1458, - /* 640 */ 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, - /* 650 */ 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, - /* 660 */ 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, + /* 0 */ 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, + /* 10 */ 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, + /* 20 */ 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, + /* 30 */ 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, + /* 40 */ 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, + /* 50 */ 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, + /* 60 */ 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, + /* 70 */ 1476, 1476, 1476, 1476, 1550, 1476, 1476, 1476, 1476, 1476, + /* 80 */ 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1548, + /* 90 */ 1706, 1476, 1886, 1476, 1476, 1476, 1476, 1476, 1476, 1476, + /* 100 */ 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, + /* 110 */ 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1550, + /* 120 */ 1476, 1548, 1898, 1898, 1898, 1476, 1476, 1476, 1476, 1750, + /* 130 */ 1750, 1476, 1476, 1476, 1476, 1648, 1476, 1476, 1476, 1476, + /* 140 */ 1476, 1476, 1476, 1476, 1742, 1476, 1967, 1476, 1476, 1476, + /* 150 */ 1748, 1921, 1476, 1476, 1476, 1476, 1601, 1913, 1890, 1904, + /* 160 */ 1891, 1888, 1952, 1952, 1952, 1907, 1476, 1917, 1476, 1476, + /* 170 */ 1476, 1734, 1711, 1476, 1476, 1711, 1708, 1708, 1476, 1476, + /* 180 */ 1476, 1476, 1476, 1476, 1550, 1476, 1550, 1476, 1476, 1550, + /* 190 */ 1476, 1550, 1476, 1550, 1550, 1476, 1550, 1476, 1476, 1476, + /* 200 */ 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, + /* 210 */ 1476, 1476, 1476, 1548, 1744, 1476, 1548, 1476, 1476, 1476, + /* 220 */ 1548, 1926, 1476, 1476, 1476, 1476, 1926, 1476, 1476, 1476, + /* 230 */ 1476, 1548, 1476, 1548, 1476, 1476, 1476, 1928, 1926, 1476, + /* 240 */ 1476, 1928, 1926, 1476, 1476, 1476, 1940, 1936, 1928, 1944, + /* 250 */ 1942, 1919, 1917, 1904, 1476, 1476, 1958, 1954, 1970, 1958, + /* 260 */ 1954, 1958, 1954, 1476, 1617, 1476, 1476, 1476, 1548, 1508, + /* 270 */ 1476, 1736, 1750, 1651, 1651, 1651, 1551, 1481, 1476, 1476, + /* 280 */ 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, + /* 290 */ 1823, 1939, 1938, 1862, 1861, 1860, 1858, 1822, 1476, 1613, + /* 300 */ 1821, 1820, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, + /* 310 */ 1814, 1815, 1813, 1812, 1476, 1476, 1476, 1476, 1476, 1476, + /* 320 */ 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, + /* 330 */ 1476, 1476, 1476, 1887, 1476, 1955, 1959, 1476, 1476, 1476, + /* 340 */ 1476, 1476, 1797, 1476, 1476, 1476, 1476, 1476, 1476, 1476, + /* 350 */ 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, + /* 360 */ 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, + /* 370 */ 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, + /* 380 */ 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, + /* 390 */ 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, + /* 400 */ 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, + /* 410 */ 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, + /* 420 */ 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, + /* 430 */ 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, + /* 440 */ 1476, 1476, 1476, 1513, 1476, 1476, 1476, 1476, 1476, 1476, + /* 450 */ 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, + /* 460 */ 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, + /* 470 */ 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, + /* 480 */ 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1585, 1584, 1476, + /* 490 */ 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, + /* 500 */ 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, + /* 510 */ 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, + /* 520 */ 1476, 1476, 1476, 1476, 1476, 1754, 1476, 1476, 1476, 1476, + /* 530 */ 1476, 1476, 1476, 1476, 1476, 1920, 1476, 1476, 1476, 1476, + /* 540 */ 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, + /* 550 */ 1476, 1797, 1476, 1937, 1476, 1897, 1893, 1476, 1476, 1889, + /* 560 */ 1796, 1476, 1476, 1953, 1476, 1476, 1476, 1476, 1476, 1476, + /* 570 */ 1476, 1476, 1476, 1882, 1476, 1476, 1855, 1840, 1476, 1476, + /* 580 */ 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1808, 1476, + /* 590 */ 1476, 1476, 1476, 1476, 1645, 1476, 1476, 1476, 1476, 1476, + /* 600 */ 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1630, 1628, 1627, + /* 610 */ 1626, 1476, 1623, 1476, 1476, 1476, 1476, 1654, 1653, 1476, + /* 620 */ 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1571, + /* 630 */ 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1562, + /* 640 */ 1476, 1561, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, + /* 650 */ 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, + /* 660 */ 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, + /* 670 */ 1476, 1476, 1476, 1476, 1476, }; /********** End of lemon-generated parsing tables *****************************/ @@ -994,6 +1008,10 @@ static const YYCODETYPE yyFallback[] = { 0, /* SINGLE_STABLE => nothing */ 0, /* RETENTIONS => nothing */ 0, /* SCHEMALESS => nothing */ + 0, /* WAL_RETENTION_PERIOD => nothing */ + 0, /* WAL_RETENTION_SIZE => nothing */ + 0, /* WAL_ROLL_PERIOD => nothing */ + 0, /* WAL_SEGMENT_SIZE => nothing */ 0, /* NK_COLON => nothing */ 0, /* TABLE => nothing */ 0, /* NK_LP => nothing */ @@ -1162,11 +1180,11 @@ static const YYCODETYPE yyFallback[] = { 0, /* ASC => nothing */ 0, /* NULLS => nothing */ 0, /* ID => nothing */ - 250, /* NK_BITNOT => ID */ - 250, /* VALUES => ID */ - 250, /* IMPORT => ID */ - 250, /* NK_SEMI => ID */ - 250, /* FILE => ID */ + 254, /* NK_BITNOT => ID */ + 254, /* VALUES => ID */ + 254, /* IMPORT => ID */ + 254, /* NK_SEMI => ID */ + 254, /* FILE => ID */ }; #endif /* YYFALLBACK */ @@ -1337,302 +1355,306 @@ static const char *const yyTokenName[] = { /* 80 */ "SINGLE_STABLE", /* 81 */ "RETENTIONS", /* 82 */ "SCHEMALESS", - /* 83 */ "NK_COLON", - /* 84 */ "TABLE", - /* 85 */ "NK_LP", - /* 86 */ "NK_RP", - /* 87 */ "STABLE", - /* 88 */ "ADD", - /* 89 */ "COLUMN", - /* 90 */ "MODIFY", - /* 91 */ "RENAME", - /* 92 */ "TAG", - /* 93 */ "SET", - /* 94 */ "NK_EQ", - /* 95 */ "USING", - /* 96 */ "TAGS", - /* 97 */ "COMMENT", - /* 98 */ "BOOL", - /* 99 */ "TINYINT", - /* 100 */ "SMALLINT", - /* 101 */ "INT", - /* 102 */ "INTEGER", - /* 103 */ "BIGINT", - /* 104 */ "FLOAT", - /* 105 */ "DOUBLE", - /* 106 */ "BINARY", - /* 107 */ "TIMESTAMP", - /* 108 */ "NCHAR", - /* 109 */ "UNSIGNED", - /* 110 */ "JSON", - /* 111 */ "VARCHAR", - /* 112 */ "MEDIUMBLOB", - /* 113 */ "BLOB", - /* 114 */ "VARBINARY", - /* 115 */ "DECIMAL", - /* 116 */ "MAX_DELAY", - /* 117 */ "WATERMARK", - /* 118 */ "ROLLUP", - /* 119 */ "TTL", - /* 120 */ "SMA", - /* 121 */ "FIRST", - /* 122 */ "LAST", - /* 123 */ "SHOW", - /* 124 */ "DATABASES", - /* 125 */ "TABLES", - /* 126 */ "STABLES", - /* 127 */ "MNODES", - /* 128 */ "MODULES", - /* 129 */ "QNODES", - /* 130 */ "FUNCTIONS", - /* 131 */ "INDEXES", - /* 132 */ "ACCOUNTS", - /* 133 */ "APPS", - /* 134 */ "CONNECTIONS", - /* 135 */ "LICENCE", - /* 136 */ "GRANTS", - /* 137 */ "QUERIES", - /* 138 */ "SCORES", - /* 139 */ "TOPICS", - /* 140 */ "VARIABLES", - /* 141 */ "BNODES", - /* 142 */ "SNODES", - /* 143 */ "CLUSTER", - /* 144 */ "TRANSACTIONS", - /* 145 */ "DISTRIBUTED", - /* 146 */ "CONSUMERS", - /* 147 */ "SUBSCRIPTIONS", - /* 148 */ "LIKE", - /* 149 */ "INDEX", - /* 150 */ "FUNCTION", - /* 151 */ "INTERVAL", - /* 152 */ "TOPIC", - /* 153 */ "AS", - /* 154 */ "WITH", - /* 155 */ "META", - /* 156 */ "CONSUMER", - /* 157 */ "GROUP", - /* 158 */ "DESC", - /* 159 */ "DESCRIBE", - /* 160 */ "RESET", - /* 161 */ "QUERY", - /* 162 */ "CACHE", - /* 163 */ "EXPLAIN", - /* 164 */ "ANALYZE", - /* 165 */ "VERBOSE", - /* 166 */ "NK_BOOL", - /* 167 */ "RATIO", - /* 168 */ "NK_FLOAT", - /* 169 */ "COMPACT", - /* 170 */ "VNODES", - /* 171 */ "IN", - /* 172 */ "OUTPUTTYPE", - /* 173 */ "AGGREGATE", - /* 174 */ "BUFSIZE", - /* 175 */ "STREAM", - /* 176 */ "INTO", - /* 177 */ "TRIGGER", - /* 178 */ "AT_ONCE", - /* 179 */ "WINDOW_CLOSE", - /* 180 */ "IGNORE", - /* 181 */ "EXPIRED", - /* 182 */ "KILL", - /* 183 */ "CONNECTION", - /* 184 */ "TRANSACTION", - /* 185 */ "BALANCE", - /* 186 */ "VGROUP", - /* 187 */ "MERGE", - /* 188 */ "REDISTRIBUTE", - /* 189 */ "SPLIT", - /* 190 */ "SYNCDB", - /* 191 */ "DELETE", - /* 192 */ "INSERT", - /* 193 */ "NULL", - /* 194 */ "NK_QUESTION", - /* 195 */ "NK_ARROW", - /* 196 */ "ROWTS", - /* 197 */ "TBNAME", - /* 198 */ "QSTART", - /* 199 */ "QEND", - /* 200 */ "QDURATION", - /* 201 */ "WSTART", - /* 202 */ "WEND", - /* 203 */ "WDURATION", - /* 204 */ "CAST", - /* 205 */ "NOW", - /* 206 */ "TODAY", - /* 207 */ "TIMEZONE", - /* 208 */ "CLIENT_VERSION", - /* 209 */ "SERVER_VERSION", - /* 210 */ "SERVER_STATUS", - /* 211 */ "CURRENT_USER", - /* 212 */ "COUNT", - /* 213 */ "LAST_ROW", - /* 214 */ "BETWEEN", - /* 215 */ "IS", - /* 216 */ "NK_LT", - /* 217 */ "NK_GT", - /* 218 */ "NK_LE", - /* 219 */ "NK_GE", - /* 220 */ "NK_NE", - /* 221 */ "MATCH", - /* 222 */ "NMATCH", - /* 223 */ "CONTAINS", - /* 224 */ "JOIN", - /* 225 */ "INNER", - /* 226 */ "SELECT", - /* 227 */ "DISTINCT", - /* 228 */ "WHERE", - /* 229 */ "PARTITION", - /* 230 */ "BY", - /* 231 */ "SESSION", - /* 232 */ "STATE_WINDOW", - /* 233 */ "SLIDING", - /* 234 */ "FILL", - /* 235 */ "VALUE", - /* 236 */ "NONE", - /* 237 */ "PREV", - /* 238 */ "LINEAR", - /* 239 */ "NEXT", - /* 240 */ "HAVING", - /* 241 */ "RANGE", - /* 242 */ "EVERY", - /* 243 */ "ORDER", - /* 244 */ "SLIMIT", - /* 245 */ "SOFFSET", - /* 246 */ "LIMIT", - /* 247 */ "OFFSET", - /* 248 */ "ASC", - /* 249 */ "NULLS", - /* 250 */ "ID", - /* 251 */ "NK_BITNOT", - /* 252 */ "VALUES", - /* 253 */ "IMPORT", - /* 254 */ "NK_SEMI", - /* 255 */ "FILE", - /* 256 */ "cmd", - /* 257 */ "account_options", - /* 258 */ "alter_account_options", - /* 259 */ "literal", - /* 260 */ "alter_account_option", - /* 261 */ "user_name", - /* 262 */ "sysinfo_opt", - /* 263 */ "privileges", - /* 264 */ "priv_level", - /* 265 */ "priv_type_list", - /* 266 */ "priv_type", - /* 267 */ "db_name", - /* 268 */ "dnode_endpoint", - /* 269 */ "not_exists_opt", - /* 270 */ "db_options", - /* 271 */ "exists_opt", - /* 272 */ "alter_db_options", - /* 273 */ "integer_list", - /* 274 */ "variable_list", - /* 275 */ "retention_list", - /* 276 */ "alter_db_option", - /* 277 */ "retention", - /* 278 */ "full_table_name", - /* 279 */ "column_def_list", - /* 280 */ "tags_def_opt", - /* 281 */ "table_options", - /* 282 */ "multi_create_clause", - /* 283 */ "tags_def", - /* 284 */ "multi_drop_clause", - /* 285 */ "alter_table_clause", - /* 286 */ "alter_table_options", - /* 287 */ "column_name", - /* 288 */ "type_name", - /* 289 */ "signed_literal", - /* 290 */ "create_subtable_clause", - /* 291 */ "specific_cols_opt", - /* 292 */ "expression_list", - /* 293 */ "drop_table_clause", - /* 294 */ "col_name_list", - /* 295 */ "table_name", - /* 296 */ "column_def", - /* 297 */ "duration_list", - /* 298 */ "rollup_func_list", - /* 299 */ "alter_table_option", - /* 300 */ "duration_literal", - /* 301 */ "rollup_func_name", - /* 302 */ "function_name", - /* 303 */ "col_name", - /* 304 */ "db_name_cond_opt", - /* 305 */ "like_pattern_opt", - /* 306 */ "table_name_cond", - /* 307 */ "from_db_opt", - /* 308 */ "index_name", - /* 309 */ "index_options", - /* 310 */ "func_list", - /* 311 */ "sliding_opt", - /* 312 */ "sma_stream_opt", - /* 313 */ "func", - /* 314 */ "stream_options", - /* 315 */ "topic_name", - /* 316 */ "query_expression", - /* 317 */ "cgroup_name", - /* 318 */ "analyze_opt", - /* 319 */ "explain_options", - /* 320 */ "agg_func_opt", - /* 321 */ "bufsize_opt", - /* 322 */ "stream_name", - /* 323 */ "into_opt", - /* 324 */ "dnode_list", - /* 325 */ "where_clause_opt", - /* 326 */ "signed", - /* 327 */ "literal_func", - /* 328 */ "literal_list", - /* 329 */ "table_alias", - /* 330 */ "column_alias", - /* 331 */ "expression", - /* 332 */ "pseudo_column", - /* 333 */ "column_reference", - /* 334 */ "function_expression", - /* 335 */ "subquery", - /* 336 */ "star_func", - /* 337 */ "star_func_para_list", - /* 338 */ "noarg_func", - /* 339 */ "other_para_list", - /* 340 */ "star_func_para", - /* 341 */ "predicate", - /* 342 */ "compare_op", - /* 343 */ "in_op", - /* 344 */ "in_predicate_value", - /* 345 */ "boolean_value_expression", - /* 346 */ "boolean_primary", - /* 347 */ "common_expression", - /* 348 */ "from_clause_opt", - /* 349 */ "table_reference_list", - /* 350 */ "table_reference", - /* 351 */ "table_primary", - /* 352 */ "joined_table", - /* 353 */ "alias_opt", - /* 354 */ "parenthesized_joined_table", - /* 355 */ "join_type", - /* 356 */ "search_condition", - /* 357 */ "query_specification", - /* 358 */ "set_quantifier_opt", - /* 359 */ "select_list", - /* 360 */ "partition_by_clause_opt", - /* 361 */ "range_opt", - /* 362 */ "every_opt", - /* 363 */ "fill_opt", - /* 364 */ "twindow_clause_opt", - /* 365 */ "group_by_clause_opt", - /* 366 */ "having_clause_opt", - /* 367 */ "select_item", - /* 368 */ "fill_mode", - /* 369 */ "group_by_list", - /* 370 */ "query_expression_body", - /* 371 */ "order_by_clause_opt", - /* 372 */ "slimit_clause_opt", - /* 373 */ "limit_clause_opt", - /* 374 */ "query_primary", - /* 375 */ "sort_specification_list", - /* 376 */ "sort_specification", - /* 377 */ "ordering_specification_opt", - /* 378 */ "null_ordering_opt", + /* 83 */ "WAL_RETENTION_PERIOD", + /* 84 */ "WAL_RETENTION_SIZE", + /* 85 */ "WAL_ROLL_PERIOD", + /* 86 */ "WAL_SEGMENT_SIZE", + /* 87 */ "NK_COLON", + /* 88 */ "TABLE", + /* 89 */ "NK_LP", + /* 90 */ "NK_RP", + /* 91 */ "STABLE", + /* 92 */ "ADD", + /* 93 */ "COLUMN", + /* 94 */ "MODIFY", + /* 95 */ "RENAME", + /* 96 */ "TAG", + /* 97 */ "SET", + /* 98 */ "NK_EQ", + /* 99 */ "USING", + /* 100 */ "TAGS", + /* 101 */ "COMMENT", + /* 102 */ "BOOL", + /* 103 */ "TINYINT", + /* 104 */ "SMALLINT", + /* 105 */ "INT", + /* 106 */ "INTEGER", + /* 107 */ "BIGINT", + /* 108 */ "FLOAT", + /* 109 */ "DOUBLE", + /* 110 */ "BINARY", + /* 111 */ "TIMESTAMP", + /* 112 */ "NCHAR", + /* 113 */ "UNSIGNED", + /* 114 */ "JSON", + /* 115 */ "VARCHAR", + /* 116 */ "MEDIUMBLOB", + /* 117 */ "BLOB", + /* 118 */ "VARBINARY", + /* 119 */ "DECIMAL", + /* 120 */ "MAX_DELAY", + /* 121 */ "WATERMARK", + /* 122 */ "ROLLUP", + /* 123 */ "TTL", + /* 124 */ "SMA", + /* 125 */ "FIRST", + /* 126 */ "LAST", + /* 127 */ "SHOW", + /* 128 */ "DATABASES", + /* 129 */ "TABLES", + /* 130 */ "STABLES", + /* 131 */ "MNODES", + /* 132 */ "MODULES", + /* 133 */ "QNODES", + /* 134 */ "FUNCTIONS", + /* 135 */ "INDEXES", + /* 136 */ "ACCOUNTS", + /* 137 */ "APPS", + /* 138 */ "CONNECTIONS", + /* 139 */ "LICENCE", + /* 140 */ "GRANTS", + /* 141 */ "QUERIES", + /* 142 */ "SCORES", + /* 143 */ "TOPICS", + /* 144 */ "VARIABLES", + /* 145 */ "BNODES", + /* 146 */ "SNODES", + /* 147 */ "CLUSTER", + /* 148 */ "TRANSACTIONS", + /* 149 */ "DISTRIBUTED", + /* 150 */ "CONSUMERS", + /* 151 */ "SUBSCRIPTIONS", + /* 152 */ "LIKE", + /* 153 */ "INDEX", + /* 154 */ "FUNCTION", + /* 155 */ "INTERVAL", + /* 156 */ "TOPIC", + /* 157 */ "AS", + /* 158 */ "WITH", + /* 159 */ "META", + /* 160 */ "CONSUMER", + /* 161 */ "GROUP", + /* 162 */ "DESC", + /* 163 */ "DESCRIBE", + /* 164 */ "RESET", + /* 165 */ "QUERY", + /* 166 */ "CACHE", + /* 167 */ "EXPLAIN", + /* 168 */ "ANALYZE", + /* 169 */ "VERBOSE", + /* 170 */ "NK_BOOL", + /* 171 */ "RATIO", + /* 172 */ "NK_FLOAT", + /* 173 */ "COMPACT", + /* 174 */ "VNODES", + /* 175 */ "IN", + /* 176 */ "OUTPUTTYPE", + /* 177 */ "AGGREGATE", + /* 178 */ "BUFSIZE", + /* 179 */ "STREAM", + /* 180 */ "INTO", + /* 181 */ "TRIGGER", + /* 182 */ "AT_ONCE", + /* 183 */ "WINDOW_CLOSE", + /* 184 */ "IGNORE", + /* 185 */ "EXPIRED", + /* 186 */ "KILL", + /* 187 */ "CONNECTION", + /* 188 */ "TRANSACTION", + /* 189 */ "BALANCE", + /* 190 */ "VGROUP", + /* 191 */ "MERGE", + /* 192 */ "REDISTRIBUTE", + /* 193 */ "SPLIT", + /* 194 */ "SYNCDB", + /* 195 */ "DELETE", + /* 196 */ "INSERT", + /* 197 */ "NULL", + /* 198 */ "NK_QUESTION", + /* 199 */ "NK_ARROW", + /* 200 */ "ROWTS", + /* 201 */ "TBNAME", + /* 202 */ "QSTART", + /* 203 */ "QEND", + /* 204 */ "QDURATION", + /* 205 */ "WSTART", + /* 206 */ "WEND", + /* 207 */ "WDURATION", + /* 208 */ "CAST", + /* 209 */ "NOW", + /* 210 */ "TODAY", + /* 211 */ "TIMEZONE", + /* 212 */ "CLIENT_VERSION", + /* 213 */ "SERVER_VERSION", + /* 214 */ "SERVER_STATUS", + /* 215 */ "CURRENT_USER", + /* 216 */ "COUNT", + /* 217 */ "LAST_ROW", + /* 218 */ "BETWEEN", + /* 219 */ "IS", + /* 220 */ "NK_LT", + /* 221 */ "NK_GT", + /* 222 */ "NK_LE", + /* 223 */ "NK_GE", + /* 224 */ "NK_NE", + /* 225 */ "MATCH", + /* 226 */ "NMATCH", + /* 227 */ "CONTAINS", + /* 228 */ "JOIN", + /* 229 */ "INNER", + /* 230 */ "SELECT", + /* 231 */ "DISTINCT", + /* 232 */ "WHERE", + /* 233 */ "PARTITION", + /* 234 */ "BY", + /* 235 */ "SESSION", + /* 236 */ "STATE_WINDOW", + /* 237 */ "SLIDING", + /* 238 */ "FILL", + /* 239 */ "VALUE", + /* 240 */ "NONE", + /* 241 */ "PREV", + /* 242 */ "LINEAR", + /* 243 */ "NEXT", + /* 244 */ "HAVING", + /* 245 */ "RANGE", + /* 246 */ "EVERY", + /* 247 */ "ORDER", + /* 248 */ "SLIMIT", + /* 249 */ "SOFFSET", + /* 250 */ "LIMIT", + /* 251 */ "OFFSET", + /* 252 */ "ASC", + /* 253 */ "NULLS", + /* 254 */ "ID", + /* 255 */ "NK_BITNOT", + /* 256 */ "VALUES", + /* 257 */ "IMPORT", + /* 258 */ "NK_SEMI", + /* 259 */ "FILE", + /* 260 */ "cmd", + /* 261 */ "account_options", + /* 262 */ "alter_account_options", + /* 263 */ "literal", + /* 264 */ "alter_account_option", + /* 265 */ "user_name", + /* 266 */ "sysinfo_opt", + /* 267 */ "privileges", + /* 268 */ "priv_level", + /* 269 */ "priv_type_list", + /* 270 */ "priv_type", + /* 271 */ "db_name", + /* 272 */ "dnode_endpoint", + /* 273 */ "not_exists_opt", + /* 274 */ "db_options", + /* 275 */ "exists_opt", + /* 276 */ "alter_db_options", + /* 277 */ "integer_list", + /* 278 */ "variable_list", + /* 279 */ "retention_list", + /* 280 */ "alter_db_option", + /* 281 */ "retention", + /* 282 */ "full_table_name", + /* 283 */ "column_def_list", + /* 284 */ "tags_def_opt", + /* 285 */ "table_options", + /* 286 */ "multi_create_clause", + /* 287 */ "tags_def", + /* 288 */ "multi_drop_clause", + /* 289 */ "alter_table_clause", + /* 290 */ "alter_table_options", + /* 291 */ "column_name", + /* 292 */ "type_name", + /* 293 */ "signed_literal", + /* 294 */ "create_subtable_clause", + /* 295 */ "specific_cols_opt", + /* 296 */ "expression_list", + /* 297 */ "drop_table_clause", + /* 298 */ "col_name_list", + /* 299 */ "table_name", + /* 300 */ "column_def", + /* 301 */ "duration_list", + /* 302 */ "rollup_func_list", + /* 303 */ "alter_table_option", + /* 304 */ "duration_literal", + /* 305 */ "rollup_func_name", + /* 306 */ "function_name", + /* 307 */ "col_name", + /* 308 */ "db_name_cond_opt", + /* 309 */ "like_pattern_opt", + /* 310 */ "table_name_cond", + /* 311 */ "from_db_opt", + /* 312 */ "index_name", + /* 313 */ "index_options", + /* 314 */ "func_list", + /* 315 */ "sliding_opt", + /* 316 */ "sma_stream_opt", + /* 317 */ "func", + /* 318 */ "stream_options", + /* 319 */ "topic_name", + /* 320 */ "query_expression", + /* 321 */ "cgroup_name", + /* 322 */ "analyze_opt", + /* 323 */ "explain_options", + /* 324 */ "agg_func_opt", + /* 325 */ "bufsize_opt", + /* 326 */ "stream_name", + /* 327 */ "into_opt", + /* 328 */ "dnode_list", + /* 329 */ "where_clause_opt", + /* 330 */ "signed", + /* 331 */ "literal_func", + /* 332 */ "literal_list", + /* 333 */ "table_alias", + /* 334 */ "column_alias", + /* 335 */ "expression", + /* 336 */ "pseudo_column", + /* 337 */ "column_reference", + /* 338 */ "function_expression", + /* 339 */ "subquery", + /* 340 */ "star_func", + /* 341 */ "star_func_para_list", + /* 342 */ "noarg_func", + /* 343 */ "other_para_list", + /* 344 */ "star_func_para", + /* 345 */ "predicate", + /* 346 */ "compare_op", + /* 347 */ "in_op", + /* 348 */ "in_predicate_value", + /* 349 */ "boolean_value_expression", + /* 350 */ "boolean_primary", + /* 351 */ "common_expression", + /* 352 */ "from_clause_opt", + /* 353 */ "table_reference_list", + /* 354 */ "table_reference", + /* 355 */ "table_primary", + /* 356 */ "joined_table", + /* 357 */ "alias_opt", + /* 358 */ "parenthesized_joined_table", + /* 359 */ "join_type", + /* 360 */ "search_condition", + /* 361 */ "query_specification", + /* 362 */ "set_quantifier_opt", + /* 363 */ "select_list", + /* 364 */ "partition_by_clause_opt", + /* 365 */ "range_opt", + /* 366 */ "every_opt", + /* 367 */ "fill_opt", + /* 368 */ "twindow_clause_opt", + /* 369 */ "group_by_clause_opt", + /* 370 */ "having_clause_opt", + /* 371 */ "select_item", + /* 372 */ "fill_mode", + /* 373 */ "group_by_list", + /* 374 */ "query_expression_body", + /* 375 */ "order_by_clause_opt", + /* 376 */ "slimit_clause_opt", + /* 377 */ "limit_clause_opt", + /* 378 */ "query_primary", + /* 379 */ "sort_specification_list", + /* 380 */ "sort_specification", + /* 381 */ "ordering_specification_opt", + /* 382 */ "null_ordering_opt", }; #endif /* defined(YYCOVERAGE) || !defined(NDEBUG) */ @@ -1734,400 +1756,406 @@ static const char *const yyRuleName[] = { /* 91 */ "db_options ::= db_options SINGLE_STABLE NK_INTEGER", /* 92 */ "db_options ::= db_options RETENTIONS retention_list", /* 93 */ "db_options ::= db_options SCHEMALESS NK_INTEGER", - /* 94 */ "alter_db_options ::= alter_db_option", - /* 95 */ "alter_db_options ::= alter_db_options alter_db_option", - /* 96 */ "alter_db_option ::= CACHEMODEL NK_STRING", - /* 97 */ "alter_db_option ::= CACHESIZE NK_INTEGER", - /* 98 */ "alter_db_option ::= FSYNC NK_INTEGER", - /* 99 */ "alter_db_option ::= KEEP integer_list", - /* 100 */ "alter_db_option ::= KEEP variable_list", - /* 101 */ "alter_db_option ::= WAL NK_INTEGER", - /* 102 */ "integer_list ::= NK_INTEGER", - /* 103 */ "integer_list ::= integer_list NK_COMMA NK_INTEGER", - /* 104 */ "variable_list ::= NK_VARIABLE", - /* 105 */ "variable_list ::= variable_list NK_COMMA NK_VARIABLE", - /* 106 */ "retention_list ::= retention", - /* 107 */ "retention_list ::= retention_list NK_COMMA retention", - /* 108 */ "retention ::= NK_VARIABLE NK_COLON NK_VARIABLE", - /* 109 */ "cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options", - /* 110 */ "cmd ::= CREATE TABLE multi_create_clause", - /* 111 */ "cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options", - /* 112 */ "cmd ::= DROP TABLE multi_drop_clause", - /* 113 */ "cmd ::= DROP STABLE exists_opt full_table_name", - /* 114 */ "cmd ::= ALTER TABLE alter_table_clause", - /* 115 */ "cmd ::= ALTER STABLE alter_table_clause", - /* 116 */ "alter_table_clause ::= full_table_name alter_table_options", - /* 117 */ "alter_table_clause ::= full_table_name ADD COLUMN column_name type_name", - /* 118 */ "alter_table_clause ::= full_table_name DROP COLUMN column_name", - /* 119 */ "alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name", - /* 120 */ "alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name", - /* 121 */ "alter_table_clause ::= full_table_name ADD TAG column_name type_name", - /* 122 */ "alter_table_clause ::= full_table_name DROP TAG column_name", - /* 123 */ "alter_table_clause ::= full_table_name MODIFY TAG column_name type_name", - /* 124 */ "alter_table_clause ::= full_table_name RENAME TAG column_name column_name", - /* 125 */ "alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal", - /* 126 */ "multi_create_clause ::= create_subtable_clause", - /* 127 */ "multi_create_clause ::= multi_create_clause create_subtable_clause", - /* 128 */ "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", - /* 129 */ "multi_drop_clause ::= drop_table_clause", - /* 130 */ "multi_drop_clause ::= multi_drop_clause drop_table_clause", - /* 131 */ "drop_table_clause ::= exists_opt full_table_name", - /* 132 */ "specific_cols_opt ::=", - /* 133 */ "specific_cols_opt ::= NK_LP col_name_list NK_RP", - /* 134 */ "full_table_name ::= table_name", - /* 135 */ "full_table_name ::= db_name NK_DOT table_name", - /* 136 */ "column_def_list ::= column_def", - /* 137 */ "column_def_list ::= column_def_list NK_COMMA column_def", - /* 138 */ "column_def ::= column_name type_name", - /* 139 */ "column_def ::= column_name type_name COMMENT NK_STRING", - /* 140 */ "type_name ::= BOOL", - /* 141 */ "type_name ::= TINYINT", - /* 142 */ "type_name ::= SMALLINT", - /* 143 */ "type_name ::= INT", - /* 144 */ "type_name ::= INTEGER", - /* 145 */ "type_name ::= BIGINT", - /* 146 */ "type_name ::= FLOAT", - /* 147 */ "type_name ::= DOUBLE", - /* 148 */ "type_name ::= BINARY NK_LP NK_INTEGER NK_RP", - /* 149 */ "type_name ::= TIMESTAMP", - /* 150 */ "type_name ::= NCHAR NK_LP NK_INTEGER NK_RP", - /* 151 */ "type_name ::= TINYINT UNSIGNED", - /* 152 */ "type_name ::= SMALLINT UNSIGNED", - /* 153 */ "type_name ::= INT UNSIGNED", - /* 154 */ "type_name ::= BIGINT UNSIGNED", - /* 155 */ "type_name ::= JSON", - /* 156 */ "type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP", - /* 157 */ "type_name ::= MEDIUMBLOB", - /* 158 */ "type_name ::= BLOB", - /* 159 */ "type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP", - /* 160 */ "type_name ::= DECIMAL", - /* 161 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP", - /* 162 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP", - /* 163 */ "tags_def_opt ::=", - /* 164 */ "tags_def_opt ::= tags_def", - /* 165 */ "tags_def ::= TAGS NK_LP column_def_list NK_RP", - /* 166 */ "table_options ::=", - /* 167 */ "table_options ::= table_options COMMENT NK_STRING", - /* 168 */ "table_options ::= table_options MAX_DELAY duration_list", - /* 169 */ "table_options ::= table_options WATERMARK duration_list", - /* 170 */ "table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP", - /* 171 */ "table_options ::= table_options TTL NK_INTEGER", - /* 172 */ "table_options ::= table_options SMA NK_LP col_name_list NK_RP", - /* 173 */ "alter_table_options ::= alter_table_option", - /* 174 */ "alter_table_options ::= alter_table_options alter_table_option", - /* 175 */ "alter_table_option ::= COMMENT NK_STRING", - /* 176 */ "alter_table_option ::= TTL NK_INTEGER", - /* 177 */ "duration_list ::= duration_literal", - /* 178 */ "duration_list ::= duration_list NK_COMMA duration_literal", - /* 179 */ "rollup_func_list ::= rollup_func_name", - /* 180 */ "rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name", - /* 181 */ "rollup_func_name ::= function_name", - /* 182 */ "rollup_func_name ::= FIRST", - /* 183 */ "rollup_func_name ::= LAST", - /* 184 */ "col_name_list ::= col_name", - /* 185 */ "col_name_list ::= col_name_list NK_COMMA col_name", - /* 186 */ "col_name ::= column_name", - /* 187 */ "cmd ::= SHOW DNODES", - /* 188 */ "cmd ::= SHOW USERS", - /* 189 */ "cmd ::= SHOW DATABASES", - /* 190 */ "cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt", - /* 191 */ "cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt", - /* 192 */ "cmd ::= SHOW db_name_cond_opt VGROUPS", - /* 193 */ "cmd ::= SHOW MNODES", - /* 194 */ "cmd ::= SHOW MODULES", - /* 195 */ "cmd ::= SHOW QNODES", - /* 196 */ "cmd ::= SHOW FUNCTIONS", - /* 197 */ "cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt", - /* 198 */ "cmd ::= SHOW STREAMS", - /* 199 */ "cmd ::= SHOW ACCOUNTS", - /* 200 */ "cmd ::= SHOW APPS", - /* 201 */ "cmd ::= SHOW CONNECTIONS", - /* 202 */ "cmd ::= SHOW LICENCE", - /* 203 */ "cmd ::= SHOW GRANTS", - /* 204 */ "cmd ::= SHOW CREATE DATABASE db_name", - /* 205 */ "cmd ::= SHOW CREATE TABLE full_table_name", - /* 206 */ "cmd ::= SHOW CREATE STABLE full_table_name", - /* 207 */ "cmd ::= SHOW QUERIES", - /* 208 */ "cmd ::= SHOW SCORES", - /* 209 */ "cmd ::= SHOW TOPICS", - /* 210 */ "cmd ::= SHOW VARIABLES", - /* 211 */ "cmd ::= SHOW LOCAL VARIABLES", - /* 212 */ "cmd ::= SHOW DNODE NK_INTEGER VARIABLES", - /* 213 */ "cmd ::= SHOW BNODES", - /* 214 */ "cmd ::= SHOW SNODES", - /* 215 */ "cmd ::= SHOW CLUSTER", - /* 216 */ "cmd ::= SHOW TRANSACTIONS", - /* 217 */ "cmd ::= SHOW TABLE DISTRIBUTED full_table_name", - /* 218 */ "cmd ::= SHOW CONSUMERS", - /* 219 */ "cmd ::= SHOW SUBSCRIPTIONS", - /* 220 */ "cmd ::= SHOW TAGS FROM table_name_cond from_db_opt", - /* 221 */ "db_name_cond_opt ::=", - /* 222 */ "db_name_cond_opt ::= db_name NK_DOT", - /* 223 */ "like_pattern_opt ::=", - /* 224 */ "like_pattern_opt ::= LIKE NK_STRING", - /* 225 */ "table_name_cond ::= table_name", - /* 226 */ "from_db_opt ::=", - /* 227 */ "from_db_opt ::= FROM db_name", - /* 228 */ "cmd ::= CREATE SMA INDEX not_exists_opt index_name ON table_name index_options", - /* 229 */ "cmd ::= DROP INDEX exists_opt index_name", - /* 230 */ "index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt", - /* 231 */ "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", - /* 232 */ "func_list ::= func", - /* 233 */ "func_list ::= func_list NK_COMMA func", - /* 234 */ "func ::= function_name NK_LP expression_list NK_RP", - /* 235 */ "sma_stream_opt ::=", - /* 236 */ "sma_stream_opt ::= stream_options WATERMARK duration_literal", - /* 237 */ "sma_stream_opt ::= stream_options MAX_DELAY duration_literal", - /* 238 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_expression", - /* 239 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name", - /* 240 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name", - /* 241 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name", - /* 242 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name", - /* 243 */ "cmd ::= DROP TOPIC exists_opt topic_name", - /* 244 */ "cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name", - /* 245 */ "cmd ::= DESC full_table_name", - /* 246 */ "cmd ::= DESCRIBE full_table_name", - /* 247 */ "cmd ::= RESET QUERY CACHE", - /* 248 */ "cmd ::= EXPLAIN analyze_opt explain_options query_expression", - /* 249 */ "analyze_opt ::=", - /* 250 */ "analyze_opt ::= ANALYZE", - /* 251 */ "explain_options ::=", - /* 252 */ "explain_options ::= explain_options VERBOSE NK_BOOL", - /* 253 */ "explain_options ::= explain_options RATIO NK_FLOAT", - /* 254 */ "cmd ::= COMPACT VNODES IN NK_LP integer_list NK_RP", - /* 255 */ "cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt", - /* 256 */ "cmd ::= DROP FUNCTION exists_opt function_name", - /* 257 */ "agg_func_opt ::=", - /* 258 */ "agg_func_opt ::= AGGREGATE", - /* 259 */ "bufsize_opt ::=", - /* 260 */ "bufsize_opt ::= BUFSIZE NK_INTEGER", - /* 261 */ "cmd ::= CREATE STREAM not_exists_opt stream_name stream_options into_opt AS query_expression", - /* 262 */ "cmd ::= DROP STREAM exists_opt stream_name", - /* 263 */ "into_opt ::=", - /* 264 */ "into_opt ::= INTO full_table_name", - /* 265 */ "stream_options ::=", - /* 266 */ "stream_options ::= stream_options TRIGGER AT_ONCE", - /* 267 */ "stream_options ::= stream_options TRIGGER WINDOW_CLOSE", - /* 268 */ "stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal", - /* 269 */ "stream_options ::= stream_options WATERMARK duration_literal", - /* 270 */ "stream_options ::= stream_options IGNORE EXPIRED", - /* 271 */ "cmd ::= KILL CONNECTION NK_INTEGER", - /* 272 */ "cmd ::= KILL QUERY NK_STRING", - /* 273 */ "cmd ::= KILL TRANSACTION NK_INTEGER", - /* 274 */ "cmd ::= BALANCE VGROUP", - /* 275 */ "cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER", - /* 276 */ "cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list", - /* 277 */ "cmd ::= SPLIT VGROUP NK_INTEGER", - /* 278 */ "dnode_list ::= DNODE NK_INTEGER", - /* 279 */ "dnode_list ::= dnode_list DNODE NK_INTEGER", - /* 280 */ "cmd ::= SYNCDB db_name REPLICA", - /* 281 */ "cmd ::= DELETE FROM full_table_name where_clause_opt", - /* 282 */ "cmd ::= query_expression", - /* 283 */ "cmd ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_expression", - /* 284 */ "cmd ::= INSERT INTO full_table_name query_expression", - /* 285 */ "literal ::= NK_INTEGER", - /* 286 */ "literal ::= NK_FLOAT", - /* 287 */ "literal ::= NK_STRING", - /* 288 */ "literal ::= NK_BOOL", - /* 289 */ "literal ::= TIMESTAMP NK_STRING", - /* 290 */ "literal ::= duration_literal", - /* 291 */ "literal ::= NULL", - /* 292 */ "literal ::= NK_QUESTION", - /* 293 */ "duration_literal ::= NK_VARIABLE", - /* 294 */ "signed ::= NK_INTEGER", - /* 295 */ "signed ::= NK_PLUS NK_INTEGER", - /* 296 */ "signed ::= NK_MINUS NK_INTEGER", - /* 297 */ "signed ::= NK_FLOAT", - /* 298 */ "signed ::= NK_PLUS NK_FLOAT", - /* 299 */ "signed ::= NK_MINUS NK_FLOAT", - /* 300 */ "signed_literal ::= signed", - /* 301 */ "signed_literal ::= NK_STRING", - /* 302 */ "signed_literal ::= NK_BOOL", - /* 303 */ "signed_literal ::= TIMESTAMP NK_STRING", - /* 304 */ "signed_literal ::= duration_literal", - /* 305 */ "signed_literal ::= NULL", - /* 306 */ "signed_literal ::= literal_func", - /* 307 */ "signed_literal ::= NK_QUESTION", - /* 308 */ "literal_list ::= signed_literal", - /* 309 */ "literal_list ::= literal_list NK_COMMA signed_literal", - /* 310 */ "db_name ::= NK_ID", - /* 311 */ "table_name ::= NK_ID", - /* 312 */ "column_name ::= NK_ID", - /* 313 */ "function_name ::= NK_ID", - /* 314 */ "table_alias ::= NK_ID", - /* 315 */ "column_alias ::= NK_ID", - /* 316 */ "user_name ::= NK_ID", - /* 317 */ "index_name ::= NK_ID", - /* 318 */ "topic_name ::= NK_ID", - /* 319 */ "stream_name ::= NK_ID", - /* 320 */ "cgroup_name ::= NK_ID", - /* 321 */ "expression ::= literal", - /* 322 */ "expression ::= pseudo_column", - /* 323 */ "expression ::= column_reference", - /* 324 */ "expression ::= function_expression", - /* 325 */ "expression ::= subquery", - /* 326 */ "expression ::= NK_LP expression NK_RP", - /* 327 */ "expression ::= NK_PLUS expression", - /* 328 */ "expression ::= NK_MINUS expression", - /* 329 */ "expression ::= expression NK_PLUS expression", - /* 330 */ "expression ::= expression NK_MINUS expression", - /* 331 */ "expression ::= expression NK_STAR expression", - /* 332 */ "expression ::= expression NK_SLASH expression", - /* 333 */ "expression ::= expression NK_REM expression", - /* 334 */ "expression ::= column_reference NK_ARROW NK_STRING", - /* 335 */ "expression ::= expression NK_BITAND expression", - /* 336 */ "expression ::= expression NK_BITOR expression", - /* 337 */ "expression_list ::= expression", - /* 338 */ "expression_list ::= expression_list NK_COMMA expression", - /* 339 */ "column_reference ::= column_name", - /* 340 */ "column_reference ::= table_name NK_DOT column_name", - /* 341 */ "pseudo_column ::= ROWTS", - /* 342 */ "pseudo_column ::= TBNAME", - /* 343 */ "pseudo_column ::= table_name NK_DOT TBNAME", - /* 344 */ "pseudo_column ::= QSTART", - /* 345 */ "pseudo_column ::= QEND", - /* 346 */ "pseudo_column ::= QDURATION", - /* 347 */ "pseudo_column ::= WSTART", - /* 348 */ "pseudo_column ::= WEND", - /* 349 */ "pseudo_column ::= WDURATION", - /* 350 */ "function_expression ::= function_name NK_LP expression_list NK_RP", - /* 351 */ "function_expression ::= star_func NK_LP star_func_para_list NK_RP", - /* 352 */ "function_expression ::= CAST NK_LP expression AS type_name NK_RP", - /* 353 */ "function_expression ::= literal_func", - /* 354 */ "literal_func ::= noarg_func NK_LP NK_RP", - /* 355 */ "literal_func ::= NOW", - /* 356 */ "noarg_func ::= NOW", - /* 357 */ "noarg_func ::= TODAY", - /* 358 */ "noarg_func ::= TIMEZONE", - /* 359 */ "noarg_func ::= DATABASE", - /* 360 */ "noarg_func ::= CLIENT_VERSION", - /* 361 */ "noarg_func ::= SERVER_VERSION", - /* 362 */ "noarg_func ::= SERVER_STATUS", - /* 363 */ "noarg_func ::= CURRENT_USER", - /* 364 */ "noarg_func ::= USER", - /* 365 */ "star_func ::= COUNT", - /* 366 */ "star_func ::= FIRST", - /* 367 */ "star_func ::= LAST", - /* 368 */ "star_func ::= LAST_ROW", - /* 369 */ "star_func_para_list ::= NK_STAR", - /* 370 */ "star_func_para_list ::= other_para_list", - /* 371 */ "other_para_list ::= star_func_para", - /* 372 */ "other_para_list ::= other_para_list NK_COMMA star_func_para", - /* 373 */ "star_func_para ::= expression", - /* 374 */ "star_func_para ::= table_name NK_DOT NK_STAR", - /* 375 */ "predicate ::= expression compare_op expression", - /* 376 */ "predicate ::= expression BETWEEN expression AND expression", - /* 377 */ "predicate ::= expression NOT BETWEEN expression AND expression", - /* 378 */ "predicate ::= expression IS NULL", - /* 379 */ "predicate ::= expression IS NOT NULL", - /* 380 */ "predicate ::= expression in_op in_predicate_value", - /* 381 */ "compare_op ::= NK_LT", - /* 382 */ "compare_op ::= NK_GT", - /* 383 */ "compare_op ::= NK_LE", - /* 384 */ "compare_op ::= NK_GE", - /* 385 */ "compare_op ::= NK_NE", - /* 386 */ "compare_op ::= NK_EQ", - /* 387 */ "compare_op ::= LIKE", - /* 388 */ "compare_op ::= NOT LIKE", - /* 389 */ "compare_op ::= MATCH", - /* 390 */ "compare_op ::= NMATCH", - /* 391 */ "compare_op ::= CONTAINS", - /* 392 */ "in_op ::= IN", - /* 393 */ "in_op ::= NOT IN", - /* 394 */ "in_predicate_value ::= NK_LP literal_list NK_RP", - /* 395 */ "boolean_value_expression ::= boolean_primary", - /* 396 */ "boolean_value_expression ::= NOT boolean_primary", - /* 397 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression", - /* 398 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression", - /* 399 */ "boolean_primary ::= predicate", - /* 400 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP", - /* 401 */ "common_expression ::= expression", - /* 402 */ "common_expression ::= boolean_value_expression", - /* 403 */ "from_clause_opt ::=", - /* 404 */ "from_clause_opt ::= FROM table_reference_list", - /* 405 */ "table_reference_list ::= table_reference", - /* 406 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference", - /* 407 */ "table_reference ::= table_primary", - /* 408 */ "table_reference ::= joined_table", - /* 409 */ "table_primary ::= table_name alias_opt", - /* 410 */ "table_primary ::= db_name NK_DOT table_name alias_opt", - /* 411 */ "table_primary ::= subquery alias_opt", - /* 412 */ "table_primary ::= parenthesized_joined_table", - /* 413 */ "alias_opt ::=", - /* 414 */ "alias_opt ::= table_alias", - /* 415 */ "alias_opt ::= AS table_alias", - /* 416 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP", - /* 417 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP", - /* 418 */ "joined_table ::= table_reference join_type JOIN table_reference ON search_condition", - /* 419 */ "join_type ::=", - /* 420 */ "join_type ::= INNER", - /* 421 */ "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", - /* 422 */ "set_quantifier_opt ::=", - /* 423 */ "set_quantifier_opt ::= DISTINCT", - /* 424 */ "set_quantifier_opt ::= ALL", - /* 425 */ "select_list ::= select_item", - /* 426 */ "select_list ::= select_list NK_COMMA select_item", - /* 427 */ "select_item ::= NK_STAR", - /* 428 */ "select_item ::= common_expression", - /* 429 */ "select_item ::= common_expression column_alias", - /* 430 */ "select_item ::= common_expression AS column_alias", - /* 431 */ "select_item ::= table_name NK_DOT NK_STAR", - /* 432 */ "where_clause_opt ::=", - /* 433 */ "where_clause_opt ::= WHERE search_condition", - /* 434 */ "partition_by_clause_opt ::=", - /* 435 */ "partition_by_clause_opt ::= PARTITION BY expression_list", - /* 436 */ "twindow_clause_opt ::=", - /* 437 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP", - /* 438 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP", - /* 439 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt", - /* 440 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt", - /* 441 */ "sliding_opt ::=", - /* 442 */ "sliding_opt ::= SLIDING NK_LP duration_literal NK_RP", - /* 443 */ "fill_opt ::=", - /* 444 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP", - /* 445 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP", - /* 446 */ "fill_mode ::= NONE", - /* 447 */ "fill_mode ::= PREV", - /* 448 */ "fill_mode ::= NULL", - /* 449 */ "fill_mode ::= LINEAR", - /* 450 */ "fill_mode ::= NEXT", - /* 451 */ "group_by_clause_opt ::=", - /* 452 */ "group_by_clause_opt ::= GROUP BY group_by_list", - /* 453 */ "group_by_list ::= expression", - /* 454 */ "group_by_list ::= group_by_list NK_COMMA expression", - /* 455 */ "having_clause_opt ::=", - /* 456 */ "having_clause_opt ::= HAVING search_condition", - /* 457 */ "range_opt ::=", - /* 458 */ "range_opt ::= RANGE NK_LP expression NK_COMMA expression NK_RP", - /* 459 */ "every_opt ::=", - /* 460 */ "every_opt ::= EVERY NK_LP duration_literal NK_RP", - /* 461 */ "query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt", - /* 462 */ "query_expression_body ::= query_primary", - /* 463 */ "query_expression_body ::= query_expression_body UNION ALL query_expression_body", - /* 464 */ "query_expression_body ::= query_expression_body UNION query_expression_body", - /* 465 */ "query_primary ::= query_specification", - /* 466 */ "query_primary ::= NK_LP query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt NK_RP", - /* 467 */ "order_by_clause_opt ::=", - /* 468 */ "order_by_clause_opt ::= ORDER BY sort_specification_list", - /* 469 */ "slimit_clause_opt ::=", - /* 470 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER", - /* 471 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER", - /* 472 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER", - /* 473 */ "limit_clause_opt ::=", - /* 474 */ "limit_clause_opt ::= LIMIT NK_INTEGER", - /* 475 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER", - /* 476 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER", - /* 477 */ "subquery ::= NK_LP query_expression NK_RP", - /* 478 */ "search_condition ::= common_expression", - /* 479 */ "sort_specification_list ::= sort_specification", - /* 480 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification", - /* 481 */ "sort_specification ::= expression ordering_specification_opt null_ordering_opt", - /* 482 */ "ordering_specification_opt ::=", - /* 483 */ "ordering_specification_opt ::= ASC", - /* 484 */ "ordering_specification_opt ::= DESC", - /* 485 */ "null_ordering_opt ::=", - /* 486 */ "null_ordering_opt ::= NULLS FIRST", - /* 487 */ "null_ordering_opt ::= NULLS LAST", + /* 94 */ "db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER", + /* 95 */ "db_options ::= db_options WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER", + /* 96 */ "db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER", + /* 97 */ "db_options ::= db_options WAL_RETENTION_SIZE NK_MINUS NK_INTEGER", + /* 98 */ "db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER", + /* 99 */ "db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER", + /* 100 */ "alter_db_options ::= alter_db_option", + /* 101 */ "alter_db_options ::= alter_db_options alter_db_option", + /* 102 */ "alter_db_option ::= CACHEMODEL NK_STRING", + /* 103 */ "alter_db_option ::= CACHESIZE NK_INTEGER", + /* 104 */ "alter_db_option ::= FSYNC NK_INTEGER", + /* 105 */ "alter_db_option ::= KEEP integer_list", + /* 106 */ "alter_db_option ::= KEEP variable_list", + /* 107 */ "alter_db_option ::= WAL NK_INTEGER", + /* 108 */ "integer_list ::= NK_INTEGER", + /* 109 */ "integer_list ::= integer_list NK_COMMA NK_INTEGER", + /* 110 */ "variable_list ::= NK_VARIABLE", + /* 111 */ "variable_list ::= variable_list NK_COMMA NK_VARIABLE", + /* 112 */ "retention_list ::= retention", + /* 113 */ "retention_list ::= retention_list NK_COMMA retention", + /* 114 */ "retention ::= NK_VARIABLE NK_COLON NK_VARIABLE", + /* 115 */ "cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options", + /* 116 */ "cmd ::= CREATE TABLE multi_create_clause", + /* 117 */ "cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options", + /* 118 */ "cmd ::= DROP TABLE multi_drop_clause", + /* 119 */ "cmd ::= DROP STABLE exists_opt full_table_name", + /* 120 */ "cmd ::= ALTER TABLE alter_table_clause", + /* 121 */ "cmd ::= ALTER STABLE alter_table_clause", + /* 122 */ "alter_table_clause ::= full_table_name alter_table_options", + /* 123 */ "alter_table_clause ::= full_table_name ADD COLUMN column_name type_name", + /* 124 */ "alter_table_clause ::= full_table_name DROP COLUMN column_name", + /* 125 */ "alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name", + /* 126 */ "alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name", + /* 127 */ "alter_table_clause ::= full_table_name ADD TAG column_name type_name", + /* 128 */ "alter_table_clause ::= full_table_name DROP TAG column_name", + /* 129 */ "alter_table_clause ::= full_table_name MODIFY TAG column_name type_name", + /* 130 */ "alter_table_clause ::= full_table_name RENAME TAG column_name column_name", + /* 131 */ "alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal", + /* 132 */ "multi_create_clause ::= create_subtable_clause", + /* 133 */ "multi_create_clause ::= multi_create_clause create_subtable_clause", + /* 134 */ "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", + /* 135 */ "multi_drop_clause ::= drop_table_clause", + /* 136 */ "multi_drop_clause ::= multi_drop_clause drop_table_clause", + /* 137 */ "drop_table_clause ::= exists_opt full_table_name", + /* 138 */ "specific_cols_opt ::=", + /* 139 */ "specific_cols_opt ::= NK_LP col_name_list NK_RP", + /* 140 */ "full_table_name ::= table_name", + /* 141 */ "full_table_name ::= db_name NK_DOT table_name", + /* 142 */ "column_def_list ::= column_def", + /* 143 */ "column_def_list ::= column_def_list NK_COMMA column_def", + /* 144 */ "column_def ::= column_name type_name", + /* 145 */ "column_def ::= column_name type_name COMMENT NK_STRING", + /* 146 */ "type_name ::= BOOL", + /* 147 */ "type_name ::= TINYINT", + /* 148 */ "type_name ::= SMALLINT", + /* 149 */ "type_name ::= INT", + /* 150 */ "type_name ::= INTEGER", + /* 151 */ "type_name ::= BIGINT", + /* 152 */ "type_name ::= FLOAT", + /* 153 */ "type_name ::= DOUBLE", + /* 154 */ "type_name ::= BINARY NK_LP NK_INTEGER NK_RP", + /* 155 */ "type_name ::= TIMESTAMP", + /* 156 */ "type_name ::= NCHAR NK_LP NK_INTEGER NK_RP", + /* 157 */ "type_name ::= TINYINT UNSIGNED", + /* 158 */ "type_name ::= SMALLINT UNSIGNED", + /* 159 */ "type_name ::= INT UNSIGNED", + /* 160 */ "type_name ::= BIGINT UNSIGNED", + /* 161 */ "type_name ::= JSON", + /* 162 */ "type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP", + /* 163 */ "type_name ::= MEDIUMBLOB", + /* 164 */ "type_name ::= BLOB", + /* 165 */ "type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP", + /* 166 */ "type_name ::= DECIMAL", + /* 167 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP", + /* 168 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP", + /* 169 */ "tags_def_opt ::=", + /* 170 */ "tags_def_opt ::= tags_def", + /* 171 */ "tags_def ::= TAGS NK_LP column_def_list NK_RP", + /* 172 */ "table_options ::=", + /* 173 */ "table_options ::= table_options COMMENT NK_STRING", + /* 174 */ "table_options ::= table_options MAX_DELAY duration_list", + /* 175 */ "table_options ::= table_options WATERMARK duration_list", + /* 176 */ "table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP", + /* 177 */ "table_options ::= table_options TTL NK_INTEGER", + /* 178 */ "table_options ::= table_options SMA NK_LP col_name_list NK_RP", + /* 179 */ "alter_table_options ::= alter_table_option", + /* 180 */ "alter_table_options ::= alter_table_options alter_table_option", + /* 181 */ "alter_table_option ::= COMMENT NK_STRING", + /* 182 */ "alter_table_option ::= TTL NK_INTEGER", + /* 183 */ "duration_list ::= duration_literal", + /* 184 */ "duration_list ::= duration_list NK_COMMA duration_literal", + /* 185 */ "rollup_func_list ::= rollup_func_name", + /* 186 */ "rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name", + /* 187 */ "rollup_func_name ::= function_name", + /* 188 */ "rollup_func_name ::= FIRST", + /* 189 */ "rollup_func_name ::= LAST", + /* 190 */ "col_name_list ::= col_name", + /* 191 */ "col_name_list ::= col_name_list NK_COMMA col_name", + /* 192 */ "col_name ::= column_name", + /* 193 */ "cmd ::= SHOW DNODES", + /* 194 */ "cmd ::= SHOW USERS", + /* 195 */ "cmd ::= SHOW DATABASES", + /* 196 */ "cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt", + /* 197 */ "cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt", + /* 198 */ "cmd ::= SHOW db_name_cond_opt VGROUPS", + /* 199 */ "cmd ::= SHOW MNODES", + /* 200 */ "cmd ::= SHOW MODULES", + /* 201 */ "cmd ::= SHOW QNODES", + /* 202 */ "cmd ::= SHOW FUNCTIONS", + /* 203 */ "cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt", + /* 204 */ "cmd ::= SHOW STREAMS", + /* 205 */ "cmd ::= SHOW ACCOUNTS", + /* 206 */ "cmd ::= SHOW APPS", + /* 207 */ "cmd ::= SHOW CONNECTIONS", + /* 208 */ "cmd ::= SHOW LICENCE", + /* 209 */ "cmd ::= SHOW GRANTS", + /* 210 */ "cmd ::= SHOW CREATE DATABASE db_name", + /* 211 */ "cmd ::= SHOW CREATE TABLE full_table_name", + /* 212 */ "cmd ::= SHOW CREATE STABLE full_table_name", + /* 213 */ "cmd ::= SHOW QUERIES", + /* 214 */ "cmd ::= SHOW SCORES", + /* 215 */ "cmd ::= SHOW TOPICS", + /* 216 */ "cmd ::= SHOW VARIABLES", + /* 217 */ "cmd ::= SHOW LOCAL VARIABLES", + /* 218 */ "cmd ::= SHOW DNODE NK_INTEGER VARIABLES", + /* 219 */ "cmd ::= SHOW BNODES", + /* 220 */ "cmd ::= SHOW SNODES", + /* 221 */ "cmd ::= SHOW CLUSTER", + /* 222 */ "cmd ::= SHOW TRANSACTIONS", + /* 223 */ "cmd ::= SHOW TABLE DISTRIBUTED full_table_name", + /* 224 */ "cmd ::= SHOW CONSUMERS", + /* 225 */ "cmd ::= SHOW SUBSCRIPTIONS", + /* 226 */ "cmd ::= SHOW TAGS FROM table_name_cond from_db_opt", + /* 227 */ "db_name_cond_opt ::=", + /* 228 */ "db_name_cond_opt ::= db_name NK_DOT", + /* 229 */ "like_pattern_opt ::=", + /* 230 */ "like_pattern_opt ::= LIKE NK_STRING", + /* 231 */ "table_name_cond ::= table_name", + /* 232 */ "from_db_opt ::=", + /* 233 */ "from_db_opt ::= FROM db_name", + /* 234 */ "cmd ::= CREATE SMA INDEX not_exists_opt index_name ON table_name index_options", + /* 235 */ "cmd ::= DROP INDEX exists_opt index_name", + /* 236 */ "index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt", + /* 237 */ "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", + /* 238 */ "func_list ::= func", + /* 239 */ "func_list ::= func_list NK_COMMA func", + /* 240 */ "func ::= function_name NK_LP expression_list NK_RP", + /* 241 */ "sma_stream_opt ::=", + /* 242 */ "sma_stream_opt ::= stream_options WATERMARK duration_literal", + /* 243 */ "sma_stream_opt ::= stream_options MAX_DELAY duration_literal", + /* 244 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_expression", + /* 245 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name", + /* 246 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name", + /* 247 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name", + /* 248 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name", + /* 249 */ "cmd ::= DROP TOPIC exists_opt topic_name", + /* 250 */ "cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name", + /* 251 */ "cmd ::= DESC full_table_name", + /* 252 */ "cmd ::= DESCRIBE full_table_name", + /* 253 */ "cmd ::= RESET QUERY CACHE", + /* 254 */ "cmd ::= EXPLAIN analyze_opt explain_options query_expression", + /* 255 */ "analyze_opt ::=", + /* 256 */ "analyze_opt ::= ANALYZE", + /* 257 */ "explain_options ::=", + /* 258 */ "explain_options ::= explain_options VERBOSE NK_BOOL", + /* 259 */ "explain_options ::= explain_options RATIO NK_FLOAT", + /* 260 */ "cmd ::= COMPACT VNODES IN NK_LP integer_list NK_RP", + /* 261 */ "cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt", + /* 262 */ "cmd ::= DROP FUNCTION exists_opt function_name", + /* 263 */ "agg_func_opt ::=", + /* 264 */ "agg_func_opt ::= AGGREGATE", + /* 265 */ "bufsize_opt ::=", + /* 266 */ "bufsize_opt ::= BUFSIZE NK_INTEGER", + /* 267 */ "cmd ::= CREATE STREAM not_exists_opt stream_name stream_options into_opt AS query_expression", + /* 268 */ "cmd ::= DROP STREAM exists_opt stream_name", + /* 269 */ "into_opt ::=", + /* 270 */ "into_opt ::= INTO full_table_name", + /* 271 */ "stream_options ::=", + /* 272 */ "stream_options ::= stream_options TRIGGER AT_ONCE", + /* 273 */ "stream_options ::= stream_options TRIGGER WINDOW_CLOSE", + /* 274 */ "stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal", + /* 275 */ "stream_options ::= stream_options WATERMARK duration_literal", + /* 276 */ "stream_options ::= stream_options IGNORE EXPIRED", + /* 277 */ "cmd ::= KILL CONNECTION NK_INTEGER", + /* 278 */ "cmd ::= KILL QUERY NK_STRING", + /* 279 */ "cmd ::= KILL TRANSACTION NK_INTEGER", + /* 280 */ "cmd ::= BALANCE VGROUP", + /* 281 */ "cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER", + /* 282 */ "cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list", + /* 283 */ "cmd ::= SPLIT VGROUP NK_INTEGER", + /* 284 */ "dnode_list ::= DNODE NK_INTEGER", + /* 285 */ "dnode_list ::= dnode_list DNODE NK_INTEGER", + /* 286 */ "cmd ::= SYNCDB db_name REPLICA", + /* 287 */ "cmd ::= DELETE FROM full_table_name where_clause_opt", + /* 288 */ "cmd ::= query_expression", + /* 289 */ "cmd ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_expression", + /* 290 */ "cmd ::= INSERT INTO full_table_name query_expression", + /* 291 */ "literal ::= NK_INTEGER", + /* 292 */ "literal ::= NK_FLOAT", + /* 293 */ "literal ::= NK_STRING", + /* 294 */ "literal ::= NK_BOOL", + /* 295 */ "literal ::= TIMESTAMP NK_STRING", + /* 296 */ "literal ::= duration_literal", + /* 297 */ "literal ::= NULL", + /* 298 */ "literal ::= NK_QUESTION", + /* 299 */ "duration_literal ::= NK_VARIABLE", + /* 300 */ "signed ::= NK_INTEGER", + /* 301 */ "signed ::= NK_PLUS NK_INTEGER", + /* 302 */ "signed ::= NK_MINUS NK_INTEGER", + /* 303 */ "signed ::= NK_FLOAT", + /* 304 */ "signed ::= NK_PLUS NK_FLOAT", + /* 305 */ "signed ::= NK_MINUS NK_FLOAT", + /* 306 */ "signed_literal ::= signed", + /* 307 */ "signed_literal ::= NK_STRING", + /* 308 */ "signed_literal ::= NK_BOOL", + /* 309 */ "signed_literal ::= TIMESTAMP NK_STRING", + /* 310 */ "signed_literal ::= duration_literal", + /* 311 */ "signed_literal ::= NULL", + /* 312 */ "signed_literal ::= literal_func", + /* 313 */ "signed_literal ::= NK_QUESTION", + /* 314 */ "literal_list ::= signed_literal", + /* 315 */ "literal_list ::= literal_list NK_COMMA signed_literal", + /* 316 */ "db_name ::= NK_ID", + /* 317 */ "table_name ::= NK_ID", + /* 318 */ "column_name ::= NK_ID", + /* 319 */ "function_name ::= NK_ID", + /* 320 */ "table_alias ::= NK_ID", + /* 321 */ "column_alias ::= NK_ID", + /* 322 */ "user_name ::= NK_ID", + /* 323 */ "index_name ::= NK_ID", + /* 324 */ "topic_name ::= NK_ID", + /* 325 */ "stream_name ::= NK_ID", + /* 326 */ "cgroup_name ::= NK_ID", + /* 327 */ "expression ::= literal", + /* 328 */ "expression ::= pseudo_column", + /* 329 */ "expression ::= column_reference", + /* 330 */ "expression ::= function_expression", + /* 331 */ "expression ::= subquery", + /* 332 */ "expression ::= NK_LP expression NK_RP", + /* 333 */ "expression ::= NK_PLUS expression", + /* 334 */ "expression ::= NK_MINUS expression", + /* 335 */ "expression ::= expression NK_PLUS expression", + /* 336 */ "expression ::= expression NK_MINUS expression", + /* 337 */ "expression ::= expression NK_STAR expression", + /* 338 */ "expression ::= expression NK_SLASH expression", + /* 339 */ "expression ::= expression NK_REM expression", + /* 340 */ "expression ::= column_reference NK_ARROW NK_STRING", + /* 341 */ "expression ::= expression NK_BITAND expression", + /* 342 */ "expression ::= expression NK_BITOR expression", + /* 343 */ "expression_list ::= expression", + /* 344 */ "expression_list ::= expression_list NK_COMMA expression", + /* 345 */ "column_reference ::= column_name", + /* 346 */ "column_reference ::= table_name NK_DOT column_name", + /* 347 */ "pseudo_column ::= ROWTS", + /* 348 */ "pseudo_column ::= TBNAME", + /* 349 */ "pseudo_column ::= table_name NK_DOT TBNAME", + /* 350 */ "pseudo_column ::= QSTART", + /* 351 */ "pseudo_column ::= QEND", + /* 352 */ "pseudo_column ::= QDURATION", + /* 353 */ "pseudo_column ::= WSTART", + /* 354 */ "pseudo_column ::= WEND", + /* 355 */ "pseudo_column ::= WDURATION", + /* 356 */ "function_expression ::= function_name NK_LP expression_list NK_RP", + /* 357 */ "function_expression ::= star_func NK_LP star_func_para_list NK_RP", + /* 358 */ "function_expression ::= CAST NK_LP expression AS type_name NK_RP", + /* 359 */ "function_expression ::= literal_func", + /* 360 */ "literal_func ::= noarg_func NK_LP NK_RP", + /* 361 */ "literal_func ::= NOW", + /* 362 */ "noarg_func ::= NOW", + /* 363 */ "noarg_func ::= TODAY", + /* 364 */ "noarg_func ::= TIMEZONE", + /* 365 */ "noarg_func ::= DATABASE", + /* 366 */ "noarg_func ::= CLIENT_VERSION", + /* 367 */ "noarg_func ::= SERVER_VERSION", + /* 368 */ "noarg_func ::= SERVER_STATUS", + /* 369 */ "noarg_func ::= CURRENT_USER", + /* 370 */ "noarg_func ::= USER", + /* 371 */ "star_func ::= COUNT", + /* 372 */ "star_func ::= FIRST", + /* 373 */ "star_func ::= LAST", + /* 374 */ "star_func ::= LAST_ROW", + /* 375 */ "star_func_para_list ::= NK_STAR", + /* 376 */ "star_func_para_list ::= other_para_list", + /* 377 */ "other_para_list ::= star_func_para", + /* 378 */ "other_para_list ::= other_para_list NK_COMMA star_func_para", + /* 379 */ "star_func_para ::= expression", + /* 380 */ "star_func_para ::= table_name NK_DOT NK_STAR", + /* 381 */ "predicate ::= expression compare_op expression", + /* 382 */ "predicate ::= expression BETWEEN expression AND expression", + /* 383 */ "predicate ::= expression NOT BETWEEN expression AND expression", + /* 384 */ "predicate ::= expression IS NULL", + /* 385 */ "predicate ::= expression IS NOT NULL", + /* 386 */ "predicate ::= expression in_op in_predicate_value", + /* 387 */ "compare_op ::= NK_LT", + /* 388 */ "compare_op ::= NK_GT", + /* 389 */ "compare_op ::= NK_LE", + /* 390 */ "compare_op ::= NK_GE", + /* 391 */ "compare_op ::= NK_NE", + /* 392 */ "compare_op ::= NK_EQ", + /* 393 */ "compare_op ::= LIKE", + /* 394 */ "compare_op ::= NOT LIKE", + /* 395 */ "compare_op ::= MATCH", + /* 396 */ "compare_op ::= NMATCH", + /* 397 */ "compare_op ::= CONTAINS", + /* 398 */ "in_op ::= IN", + /* 399 */ "in_op ::= NOT IN", + /* 400 */ "in_predicate_value ::= NK_LP literal_list NK_RP", + /* 401 */ "boolean_value_expression ::= boolean_primary", + /* 402 */ "boolean_value_expression ::= NOT boolean_primary", + /* 403 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression", + /* 404 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression", + /* 405 */ "boolean_primary ::= predicate", + /* 406 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP", + /* 407 */ "common_expression ::= expression", + /* 408 */ "common_expression ::= boolean_value_expression", + /* 409 */ "from_clause_opt ::=", + /* 410 */ "from_clause_opt ::= FROM table_reference_list", + /* 411 */ "table_reference_list ::= table_reference", + /* 412 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference", + /* 413 */ "table_reference ::= table_primary", + /* 414 */ "table_reference ::= joined_table", + /* 415 */ "table_primary ::= table_name alias_opt", + /* 416 */ "table_primary ::= db_name NK_DOT table_name alias_opt", + /* 417 */ "table_primary ::= subquery alias_opt", + /* 418 */ "table_primary ::= parenthesized_joined_table", + /* 419 */ "alias_opt ::=", + /* 420 */ "alias_opt ::= table_alias", + /* 421 */ "alias_opt ::= AS table_alias", + /* 422 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP", + /* 423 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP", + /* 424 */ "joined_table ::= table_reference join_type JOIN table_reference ON search_condition", + /* 425 */ "join_type ::=", + /* 426 */ "join_type ::= INNER", + /* 427 */ "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", + /* 428 */ "set_quantifier_opt ::=", + /* 429 */ "set_quantifier_opt ::= DISTINCT", + /* 430 */ "set_quantifier_opt ::= ALL", + /* 431 */ "select_list ::= select_item", + /* 432 */ "select_list ::= select_list NK_COMMA select_item", + /* 433 */ "select_item ::= NK_STAR", + /* 434 */ "select_item ::= common_expression", + /* 435 */ "select_item ::= common_expression column_alias", + /* 436 */ "select_item ::= common_expression AS column_alias", + /* 437 */ "select_item ::= table_name NK_DOT NK_STAR", + /* 438 */ "where_clause_opt ::=", + /* 439 */ "where_clause_opt ::= WHERE search_condition", + /* 440 */ "partition_by_clause_opt ::=", + /* 441 */ "partition_by_clause_opt ::= PARTITION BY expression_list", + /* 442 */ "twindow_clause_opt ::=", + /* 443 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP", + /* 444 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP", + /* 445 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt", + /* 446 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt", + /* 447 */ "sliding_opt ::=", + /* 448 */ "sliding_opt ::= SLIDING NK_LP duration_literal NK_RP", + /* 449 */ "fill_opt ::=", + /* 450 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP", + /* 451 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP", + /* 452 */ "fill_mode ::= NONE", + /* 453 */ "fill_mode ::= PREV", + /* 454 */ "fill_mode ::= NULL", + /* 455 */ "fill_mode ::= LINEAR", + /* 456 */ "fill_mode ::= NEXT", + /* 457 */ "group_by_clause_opt ::=", + /* 458 */ "group_by_clause_opt ::= GROUP BY group_by_list", + /* 459 */ "group_by_list ::= expression", + /* 460 */ "group_by_list ::= group_by_list NK_COMMA expression", + /* 461 */ "having_clause_opt ::=", + /* 462 */ "having_clause_opt ::= HAVING search_condition", + /* 463 */ "range_opt ::=", + /* 464 */ "range_opt ::= RANGE NK_LP expression NK_COMMA expression NK_RP", + /* 465 */ "every_opt ::=", + /* 466 */ "every_opt ::= EVERY NK_LP duration_literal NK_RP", + /* 467 */ "query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt", + /* 468 */ "query_expression_body ::= query_primary", + /* 469 */ "query_expression_body ::= query_expression_body UNION ALL query_expression_body", + /* 470 */ "query_expression_body ::= query_expression_body UNION query_expression_body", + /* 471 */ "query_primary ::= query_specification", + /* 472 */ "query_primary ::= NK_LP query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt NK_RP", + /* 473 */ "order_by_clause_opt ::=", + /* 474 */ "order_by_clause_opt ::= ORDER BY sort_specification_list", + /* 475 */ "slimit_clause_opt ::=", + /* 476 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER", + /* 477 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER", + /* 478 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER", + /* 479 */ "limit_clause_opt ::=", + /* 480 */ "limit_clause_opt ::= LIMIT NK_INTEGER", + /* 481 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER", + /* 482 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER", + /* 483 */ "subquery ::= NK_LP query_expression NK_RP", + /* 484 */ "search_condition ::= common_expression", + /* 485 */ "sort_specification_list ::= sort_specification", + /* 486 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification", + /* 487 */ "sort_specification ::= expression ordering_specification_opt null_ordering_opt", + /* 488 */ "ordering_specification_opt ::=", + /* 489 */ "ordering_specification_opt ::= ASC", + /* 490 */ "ordering_specification_opt ::= DESC", + /* 491 */ "null_ordering_opt ::=", + /* 492 */ "null_ordering_opt ::= NULLS FIRST", + /* 493 */ "null_ordering_opt ::= NULLS LAST", }; #endif /* NDEBUG */ @@ -2254,181 +2282,181 @@ static void yy_destructor( */ /********* Begin destructor definitions ***************************************/ /* Default NON-TERMINAL Destructor */ - case 256: /* cmd */ - case 259: /* literal */ - case 270: /* db_options */ - case 272: /* alter_db_options */ - case 277: /* retention */ - case 278: /* full_table_name */ - case 281: /* table_options */ - case 285: /* alter_table_clause */ - case 286: /* alter_table_options */ - case 289: /* signed_literal */ - case 290: /* create_subtable_clause */ - case 293: /* drop_table_clause */ - case 296: /* column_def */ - case 300: /* duration_literal */ - case 301: /* rollup_func_name */ - case 303: /* col_name */ - case 304: /* db_name_cond_opt */ - case 305: /* like_pattern_opt */ - case 306: /* table_name_cond */ - case 307: /* from_db_opt */ - case 309: /* index_options */ - case 311: /* sliding_opt */ - case 312: /* sma_stream_opt */ - case 313: /* func */ - case 314: /* stream_options */ - case 316: /* query_expression */ - case 319: /* explain_options */ - case 323: /* into_opt */ - case 325: /* where_clause_opt */ - case 326: /* signed */ - case 327: /* literal_func */ - case 331: /* expression */ - case 332: /* pseudo_column */ - case 333: /* column_reference */ - case 334: /* function_expression */ - case 335: /* subquery */ - case 340: /* star_func_para */ - case 341: /* predicate */ - case 344: /* in_predicate_value */ - case 345: /* boolean_value_expression */ - case 346: /* boolean_primary */ - case 347: /* common_expression */ - case 348: /* from_clause_opt */ - case 349: /* table_reference_list */ - case 350: /* table_reference */ - case 351: /* table_primary */ - case 352: /* joined_table */ - case 354: /* parenthesized_joined_table */ - case 356: /* search_condition */ - case 357: /* query_specification */ - case 361: /* range_opt */ - case 362: /* every_opt */ - case 363: /* fill_opt */ - case 364: /* twindow_clause_opt */ - case 366: /* having_clause_opt */ - case 367: /* select_item */ - case 370: /* query_expression_body */ - case 372: /* slimit_clause_opt */ - case 373: /* limit_clause_opt */ - case 374: /* query_primary */ - case 376: /* sort_specification */ + case 260: /* cmd */ + case 263: /* literal */ + case 274: /* db_options */ + case 276: /* alter_db_options */ + case 281: /* retention */ + case 282: /* full_table_name */ + case 285: /* table_options */ + case 289: /* alter_table_clause */ + case 290: /* alter_table_options */ + case 293: /* signed_literal */ + case 294: /* create_subtable_clause */ + case 297: /* drop_table_clause */ + case 300: /* column_def */ + case 304: /* duration_literal */ + case 305: /* rollup_func_name */ + case 307: /* col_name */ + case 308: /* db_name_cond_opt */ + case 309: /* like_pattern_opt */ + case 310: /* table_name_cond */ + case 311: /* from_db_opt */ + case 313: /* index_options */ + case 315: /* sliding_opt */ + case 316: /* sma_stream_opt */ + case 317: /* func */ + case 318: /* stream_options */ + case 320: /* query_expression */ + case 323: /* explain_options */ + case 327: /* into_opt */ + case 329: /* where_clause_opt */ + case 330: /* signed */ + case 331: /* literal_func */ + case 335: /* expression */ + case 336: /* pseudo_column */ + case 337: /* column_reference */ + case 338: /* function_expression */ + case 339: /* subquery */ + case 344: /* star_func_para */ + case 345: /* predicate */ + case 348: /* in_predicate_value */ + case 349: /* boolean_value_expression */ + case 350: /* boolean_primary */ + case 351: /* common_expression */ + case 352: /* from_clause_opt */ + case 353: /* table_reference_list */ + case 354: /* table_reference */ + case 355: /* table_primary */ + case 356: /* joined_table */ + case 358: /* parenthesized_joined_table */ + case 360: /* search_condition */ + case 361: /* query_specification */ + case 365: /* range_opt */ + case 366: /* every_opt */ + case 367: /* fill_opt */ + case 368: /* twindow_clause_opt */ + case 370: /* having_clause_opt */ + case 371: /* select_item */ + case 374: /* query_expression_body */ + case 376: /* slimit_clause_opt */ + case 377: /* limit_clause_opt */ + case 378: /* query_primary */ + case 380: /* sort_specification */ { - nodesDestroyNode((yypminor->yy616)); + nodesDestroyNode((yypminor->yy160)); } break; - case 257: /* account_options */ - case 258: /* alter_account_options */ - case 260: /* alter_account_option */ - case 321: /* bufsize_opt */ + case 261: /* account_options */ + case 262: /* alter_account_options */ + case 264: /* alter_account_option */ + case 325: /* bufsize_opt */ { } break; - case 261: /* user_name */ - case 264: /* priv_level */ - case 267: /* db_name */ - case 268: /* dnode_endpoint */ - case 287: /* column_name */ - case 295: /* table_name */ - case 302: /* function_name */ - case 308: /* index_name */ - case 315: /* topic_name */ - case 317: /* cgroup_name */ - case 322: /* stream_name */ - case 329: /* table_alias */ - case 330: /* column_alias */ - case 336: /* star_func */ - case 338: /* noarg_func */ - case 353: /* alias_opt */ + case 265: /* user_name */ + case 268: /* priv_level */ + case 271: /* db_name */ + case 272: /* dnode_endpoint */ + case 291: /* column_name */ + case 299: /* table_name */ + case 306: /* function_name */ + case 312: /* index_name */ + case 319: /* topic_name */ + case 321: /* cgroup_name */ + case 326: /* stream_name */ + case 333: /* table_alias */ + case 334: /* column_alias */ + case 340: /* star_func */ + case 342: /* noarg_func */ + case 357: /* alias_opt */ { } break; - case 262: /* sysinfo_opt */ + case 266: /* sysinfo_opt */ { } break; - case 263: /* privileges */ - case 265: /* priv_type_list */ - case 266: /* priv_type */ + case 267: /* privileges */ + case 269: /* priv_type_list */ + case 270: /* priv_type */ { } break; - case 269: /* not_exists_opt */ - case 271: /* exists_opt */ - case 318: /* analyze_opt */ - case 320: /* agg_func_opt */ - case 358: /* set_quantifier_opt */ + case 273: /* not_exists_opt */ + case 275: /* exists_opt */ + case 322: /* analyze_opt */ + case 324: /* agg_func_opt */ + case 362: /* set_quantifier_opt */ { } break; - case 273: /* integer_list */ - case 274: /* variable_list */ - case 275: /* retention_list */ - case 279: /* column_def_list */ - case 280: /* tags_def_opt */ - case 282: /* multi_create_clause */ - case 283: /* tags_def */ - case 284: /* multi_drop_clause */ - case 291: /* specific_cols_opt */ - case 292: /* expression_list */ - case 294: /* col_name_list */ - case 297: /* duration_list */ - case 298: /* rollup_func_list */ - case 310: /* func_list */ - case 324: /* dnode_list */ - case 328: /* literal_list */ - case 337: /* star_func_para_list */ - case 339: /* other_para_list */ - case 359: /* select_list */ - case 360: /* partition_by_clause_opt */ - case 365: /* group_by_clause_opt */ - case 369: /* group_by_list */ - case 371: /* order_by_clause_opt */ - case 375: /* sort_specification_list */ + case 277: /* integer_list */ + case 278: /* variable_list */ + case 279: /* retention_list */ + case 283: /* column_def_list */ + case 284: /* tags_def_opt */ + case 286: /* multi_create_clause */ + case 287: /* tags_def */ + case 288: /* multi_drop_clause */ + case 295: /* specific_cols_opt */ + case 296: /* expression_list */ + case 298: /* col_name_list */ + case 301: /* duration_list */ + case 302: /* rollup_func_list */ + case 314: /* func_list */ + case 328: /* dnode_list */ + case 332: /* literal_list */ + case 341: /* star_func_para_list */ + case 343: /* other_para_list */ + case 363: /* select_list */ + case 364: /* partition_by_clause_opt */ + case 369: /* group_by_clause_opt */ + case 373: /* group_by_list */ + case 375: /* order_by_clause_opt */ + case 379: /* sort_specification_list */ { - nodesDestroyList((yypminor->yy356)); + nodesDestroyList((yypminor->yy180)); } break; - case 276: /* alter_db_option */ - case 299: /* alter_table_option */ + case 280: /* alter_db_option */ + case 303: /* alter_table_option */ { } break; - case 288: /* type_name */ + case 292: /* type_name */ { } break; - case 342: /* compare_op */ - case 343: /* in_op */ + case 346: /* compare_op */ + case 347: /* in_op */ { } break; - case 355: /* join_type */ + case 359: /* join_type */ { } break; - case 368: /* fill_mode */ + case 372: /* fill_mode */ { } break; - case 377: /* ordering_specification_opt */ + case 381: /* ordering_specification_opt */ { } break; - case 378: /* null_ordering_opt */ + case 382: /* null_ordering_opt */ { } @@ -2727,494 +2755,500 @@ static const struct { YYCODETYPE lhs; /* Symbol on the left-hand side of the rule */ signed char nrhs; /* Negative of the number of RHS symbols in the rule */ } yyRuleInfo[] = { - { 256, -6 }, /* (0) cmd ::= CREATE ACCOUNT NK_ID PASS NK_STRING account_options */ - { 256, -4 }, /* (1) cmd ::= ALTER ACCOUNT NK_ID alter_account_options */ - { 257, 0 }, /* (2) account_options ::= */ - { 257, -3 }, /* (3) account_options ::= account_options PPS literal */ - { 257, -3 }, /* (4) account_options ::= account_options TSERIES literal */ - { 257, -3 }, /* (5) account_options ::= account_options STORAGE literal */ - { 257, -3 }, /* (6) account_options ::= account_options STREAMS literal */ - { 257, -3 }, /* (7) account_options ::= account_options QTIME literal */ - { 257, -3 }, /* (8) account_options ::= account_options DBS literal */ - { 257, -3 }, /* (9) account_options ::= account_options USERS literal */ - { 257, -3 }, /* (10) account_options ::= account_options CONNS literal */ - { 257, -3 }, /* (11) account_options ::= account_options STATE literal */ - { 258, -1 }, /* (12) alter_account_options ::= alter_account_option */ - { 258, -2 }, /* (13) alter_account_options ::= alter_account_options alter_account_option */ - { 260, -2 }, /* (14) alter_account_option ::= PASS literal */ - { 260, -2 }, /* (15) alter_account_option ::= PPS literal */ - { 260, -2 }, /* (16) alter_account_option ::= TSERIES literal */ - { 260, -2 }, /* (17) alter_account_option ::= STORAGE literal */ - { 260, -2 }, /* (18) alter_account_option ::= STREAMS literal */ - { 260, -2 }, /* (19) alter_account_option ::= QTIME literal */ - { 260, -2 }, /* (20) alter_account_option ::= DBS literal */ - { 260, -2 }, /* (21) alter_account_option ::= USERS literal */ - { 260, -2 }, /* (22) alter_account_option ::= CONNS literal */ - { 260, -2 }, /* (23) alter_account_option ::= STATE literal */ - { 256, -6 }, /* (24) cmd ::= CREATE USER user_name PASS NK_STRING sysinfo_opt */ - { 256, -5 }, /* (25) cmd ::= ALTER USER user_name PASS NK_STRING */ - { 256, -5 }, /* (26) cmd ::= ALTER USER user_name ENABLE NK_INTEGER */ - { 256, -5 }, /* (27) cmd ::= ALTER USER user_name SYSINFO NK_INTEGER */ - { 256, -3 }, /* (28) cmd ::= DROP USER user_name */ - { 262, 0 }, /* (29) sysinfo_opt ::= */ - { 262, -2 }, /* (30) sysinfo_opt ::= SYSINFO NK_INTEGER */ - { 256, -6 }, /* (31) cmd ::= GRANT privileges ON priv_level TO user_name */ - { 256, -6 }, /* (32) cmd ::= REVOKE privileges ON priv_level FROM user_name */ - { 263, -1 }, /* (33) privileges ::= ALL */ - { 263, -1 }, /* (34) privileges ::= priv_type_list */ - { 265, -1 }, /* (35) priv_type_list ::= priv_type */ - { 265, -3 }, /* (36) priv_type_list ::= priv_type_list NK_COMMA priv_type */ - { 266, -1 }, /* (37) priv_type ::= READ */ - { 266, -1 }, /* (38) priv_type ::= WRITE */ - { 264, -3 }, /* (39) priv_level ::= NK_STAR NK_DOT NK_STAR */ - { 264, -3 }, /* (40) priv_level ::= db_name NK_DOT NK_STAR */ - { 256, -3 }, /* (41) cmd ::= CREATE DNODE dnode_endpoint */ - { 256, -5 }, /* (42) cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER */ - { 256, -3 }, /* (43) cmd ::= DROP DNODE NK_INTEGER */ - { 256, -3 }, /* (44) cmd ::= DROP DNODE dnode_endpoint */ - { 256, -4 }, /* (45) cmd ::= ALTER DNODE NK_INTEGER NK_STRING */ - { 256, -5 }, /* (46) cmd ::= ALTER DNODE NK_INTEGER NK_STRING NK_STRING */ - { 256, -4 }, /* (47) cmd ::= ALTER ALL DNODES NK_STRING */ - { 256, -5 }, /* (48) cmd ::= ALTER ALL DNODES NK_STRING NK_STRING */ - { 268, -1 }, /* (49) dnode_endpoint ::= NK_STRING */ - { 268, -1 }, /* (50) dnode_endpoint ::= NK_ID */ - { 268, -1 }, /* (51) dnode_endpoint ::= NK_IPTOKEN */ - { 256, -3 }, /* (52) cmd ::= ALTER LOCAL NK_STRING */ - { 256, -4 }, /* (53) cmd ::= ALTER LOCAL NK_STRING NK_STRING */ - { 256, -5 }, /* (54) cmd ::= CREATE QNODE ON DNODE NK_INTEGER */ - { 256, -5 }, /* (55) cmd ::= DROP QNODE ON DNODE NK_INTEGER */ - { 256, -5 }, /* (56) cmd ::= CREATE BNODE ON DNODE NK_INTEGER */ - { 256, -5 }, /* (57) cmd ::= DROP BNODE ON DNODE NK_INTEGER */ - { 256, -5 }, /* (58) cmd ::= CREATE SNODE ON DNODE NK_INTEGER */ - { 256, -5 }, /* (59) cmd ::= DROP SNODE ON DNODE NK_INTEGER */ - { 256, -5 }, /* (60) cmd ::= CREATE MNODE ON DNODE NK_INTEGER */ - { 256, -5 }, /* (61) cmd ::= DROP MNODE ON DNODE NK_INTEGER */ - { 256, -5 }, /* (62) cmd ::= CREATE DATABASE not_exists_opt db_name db_options */ - { 256, -4 }, /* (63) cmd ::= DROP DATABASE exists_opt db_name */ - { 256, -2 }, /* (64) cmd ::= USE db_name */ - { 256, -4 }, /* (65) cmd ::= ALTER DATABASE db_name alter_db_options */ - { 256, -3 }, /* (66) cmd ::= FLUSH DATABASE db_name */ - { 256, -3 }, /* (67) cmd ::= TRIM DATABASE db_name */ - { 269, -3 }, /* (68) not_exists_opt ::= IF NOT EXISTS */ - { 269, 0 }, /* (69) not_exists_opt ::= */ - { 271, -2 }, /* (70) exists_opt ::= IF EXISTS */ - { 271, 0 }, /* (71) exists_opt ::= */ - { 270, 0 }, /* (72) db_options ::= */ - { 270, -3 }, /* (73) db_options ::= db_options BUFFER NK_INTEGER */ - { 270, -3 }, /* (74) db_options ::= db_options CACHEMODEL NK_STRING */ - { 270, -3 }, /* (75) db_options ::= db_options CACHESIZE NK_INTEGER */ - { 270, -3 }, /* (76) db_options ::= db_options COMP NK_INTEGER */ - { 270, -3 }, /* (77) db_options ::= db_options DURATION NK_INTEGER */ - { 270, -3 }, /* (78) db_options ::= db_options DURATION NK_VARIABLE */ - { 270, -3 }, /* (79) db_options ::= db_options FSYNC NK_INTEGER */ - { 270, -3 }, /* (80) db_options ::= db_options MAXROWS NK_INTEGER */ - { 270, -3 }, /* (81) db_options ::= db_options MINROWS NK_INTEGER */ - { 270, -3 }, /* (82) db_options ::= db_options KEEP integer_list */ - { 270, -3 }, /* (83) db_options ::= db_options KEEP variable_list */ - { 270, -3 }, /* (84) db_options ::= db_options PAGES NK_INTEGER */ - { 270, -3 }, /* (85) db_options ::= db_options PAGESIZE NK_INTEGER */ - { 270, -3 }, /* (86) db_options ::= db_options PRECISION NK_STRING */ - { 270, -3 }, /* (87) db_options ::= db_options REPLICA NK_INTEGER */ - { 270, -3 }, /* (88) db_options ::= db_options STRICT NK_STRING */ - { 270, -3 }, /* (89) db_options ::= db_options WAL NK_INTEGER */ - { 270, -3 }, /* (90) db_options ::= db_options VGROUPS NK_INTEGER */ - { 270, -3 }, /* (91) db_options ::= db_options SINGLE_STABLE NK_INTEGER */ - { 270, -3 }, /* (92) db_options ::= db_options RETENTIONS retention_list */ - { 270, -3 }, /* (93) db_options ::= db_options SCHEMALESS NK_INTEGER */ - { 272, -1 }, /* (94) alter_db_options ::= alter_db_option */ - { 272, -2 }, /* (95) alter_db_options ::= alter_db_options alter_db_option */ - { 276, -2 }, /* (96) alter_db_option ::= CACHEMODEL NK_STRING */ - { 276, -2 }, /* (97) alter_db_option ::= CACHESIZE NK_INTEGER */ - { 276, -2 }, /* (98) alter_db_option ::= FSYNC NK_INTEGER */ - { 276, -2 }, /* (99) alter_db_option ::= KEEP integer_list */ - { 276, -2 }, /* (100) alter_db_option ::= KEEP variable_list */ - { 276, -2 }, /* (101) alter_db_option ::= WAL NK_INTEGER */ - { 273, -1 }, /* (102) integer_list ::= NK_INTEGER */ - { 273, -3 }, /* (103) integer_list ::= integer_list NK_COMMA NK_INTEGER */ - { 274, -1 }, /* (104) variable_list ::= NK_VARIABLE */ - { 274, -3 }, /* (105) variable_list ::= variable_list NK_COMMA NK_VARIABLE */ - { 275, -1 }, /* (106) retention_list ::= retention */ - { 275, -3 }, /* (107) retention_list ::= retention_list NK_COMMA retention */ - { 277, -3 }, /* (108) retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */ - { 256, -9 }, /* (109) cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ - { 256, -3 }, /* (110) cmd ::= CREATE TABLE multi_create_clause */ - { 256, -9 }, /* (111) cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ - { 256, -3 }, /* (112) cmd ::= DROP TABLE multi_drop_clause */ - { 256, -4 }, /* (113) cmd ::= DROP STABLE exists_opt full_table_name */ - { 256, -3 }, /* (114) cmd ::= ALTER TABLE alter_table_clause */ - { 256, -3 }, /* (115) cmd ::= ALTER STABLE alter_table_clause */ - { 285, -2 }, /* (116) alter_table_clause ::= full_table_name alter_table_options */ - { 285, -5 }, /* (117) alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ - { 285, -4 }, /* (118) alter_table_clause ::= full_table_name DROP COLUMN column_name */ - { 285, -5 }, /* (119) alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ - { 285, -5 }, /* (120) alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ - { 285, -5 }, /* (121) alter_table_clause ::= full_table_name ADD TAG column_name type_name */ - { 285, -4 }, /* (122) alter_table_clause ::= full_table_name DROP TAG column_name */ - { 285, -5 }, /* (123) alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ - { 285, -5 }, /* (124) alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ - { 285, -6 }, /* (125) alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */ - { 282, -1 }, /* (126) multi_create_clause ::= create_subtable_clause */ - { 282, -2 }, /* (127) multi_create_clause ::= multi_create_clause create_subtable_clause */ - { 290, -10 }, /* (128) 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 */ - { 284, -1 }, /* (129) multi_drop_clause ::= drop_table_clause */ - { 284, -2 }, /* (130) multi_drop_clause ::= multi_drop_clause drop_table_clause */ - { 293, -2 }, /* (131) drop_table_clause ::= exists_opt full_table_name */ - { 291, 0 }, /* (132) specific_cols_opt ::= */ - { 291, -3 }, /* (133) specific_cols_opt ::= NK_LP col_name_list NK_RP */ - { 278, -1 }, /* (134) full_table_name ::= table_name */ - { 278, -3 }, /* (135) full_table_name ::= db_name NK_DOT table_name */ - { 279, -1 }, /* (136) column_def_list ::= column_def */ - { 279, -3 }, /* (137) column_def_list ::= column_def_list NK_COMMA column_def */ - { 296, -2 }, /* (138) column_def ::= column_name type_name */ - { 296, -4 }, /* (139) column_def ::= column_name type_name COMMENT NK_STRING */ - { 288, -1 }, /* (140) type_name ::= BOOL */ - { 288, -1 }, /* (141) type_name ::= TINYINT */ - { 288, -1 }, /* (142) type_name ::= SMALLINT */ - { 288, -1 }, /* (143) type_name ::= INT */ - { 288, -1 }, /* (144) type_name ::= INTEGER */ - { 288, -1 }, /* (145) type_name ::= BIGINT */ - { 288, -1 }, /* (146) type_name ::= FLOAT */ - { 288, -1 }, /* (147) type_name ::= DOUBLE */ - { 288, -4 }, /* (148) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ - { 288, -1 }, /* (149) type_name ::= TIMESTAMP */ - { 288, -4 }, /* (150) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ - { 288, -2 }, /* (151) type_name ::= TINYINT UNSIGNED */ - { 288, -2 }, /* (152) type_name ::= SMALLINT UNSIGNED */ - { 288, -2 }, /* (153) type_name ::= INT UNSIGNED */ - { 288, -2 }, /* (154) type_name ::= BIGINT UNSIGNED */ - { 288, -1 }, /* (155) type_name ::= JSON */ - { 288, -4 }, /* (156) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ - { 288, -1 }, /* (157) type_name ::= MEDIUMBLOB */ - { 288, -1 }, /* (158) type_name ::= BLOB */ - { 288, -4 }, /* (159) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ - { 288, -1 }, /* (160) type_name ::= DECIMAL */ - { 288, -4 }, /* (161) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ - { 288, -6 }, /* (162) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ - { 280, 0 }, /* (163) tags_def_opt ::= */ - { 280, -1 }, /* (164) tags_def_opt ::= tags_def */ - { 283, -4 }, /* (165) tags_def ::= TAGS NK_LP column_def_list NK_RP */ - { 281, 0 }, /* (166) table_options ::= */ - { 281, -3 }, /* (167) table_options ::= table_options COMMENT NK_STRING */ - { 281, -3 }, /* (168) table_options ::= table_options MAX_DELAY duration_list */ - { 281, -3 }, /* (169) table_options ::= table_options WATERMARK duration_list */ - { 281, -5 }, /* (170) table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ - { 281, -3 }, /* (171) table_options ::= table_options TTL NK_INTEGER */ - { 281, -5 }, /* (172) table_options ::= table_options SMA NK_LP col_name_list NK_RP */ - { 286, -1 }, /* (173) alter_table_options ::= alter_table_option */ - { 286, -2 }, /* (174) alter_table_options ::= alter_table_options alter_table_option */ - { 299, -2 }, /* (175) alter_table_option ::= COMMENT NK_STRING */ - { 299, -2 }, /* (176) alter_table_option ::= TTL NK_INTEGER */ - { 297, -1 }, /* (177) duration_list ::= duration_literal */ - { 297, -3 }, /* (178) duration_list ::= duration_list NK_COMMA duration_literal */ - { 298, -1 }, /* (179) rollup_func_list ::= rollup_func_name */ - { 298, -3 }, /* (180) rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ - { 301, -1 }, /* (181) rollup_func_name ::= function_name */ - { 301, -1 }, /* (182) rollup_func_name ::= FIRST */ - { 301, -1 }, /* (183) rollup_func_name ::= LAST */ - { 294, -1 }, /* (184) col_name_list ::= col_name */ - { 294, -3 }, /* (185) col_name_list ::= col_name_list NK_COMMA col_name */ - { 303, -1 }, /* (186) col_name ::= column_name */ - { 256, -2 }, /* (187) cmd ::= SHOW DNODES */ - { 256, -2 }, /* (188) cmd ::= SHOW USERS */ - { 256, -2 }, /* (189) cmd ::= SHOW DATABASES */ - { 256, -4 }, /* (190) cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */ - { 256, -4 }, /* (191) cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ - { 256, -3 }, /* (192) cmd ::= SHOW db_name_cond_opt VGROUPS */ - { 256, -2 }, /* (193) cmd ::= SHOW MNODES */ - { 256, -2 }, /* (194) cmd ::= SHOW MODULES */ - { 256, -2 }, /* (195) cmd ::= SHOW QNODES */ - { 256, -2 }, /* (196) cmd ::= SHOW FUNCTIONS */ - { 256, -5 }, /* (197) cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ - { 256, -2 }, /* (198) cmd ::= SHOW STREAMS */ - { 256, -2 }, /* (199) cmd ::= SHOW ACCOUNTS */ - { 256, -2 }, /* (200) cmd ::= SHOW APPS */ - { 256, -2 }, /* (201) cmd ::= SHOW CONNECTIONS */ - { 256, -2 }, /* (202) cmd ::= SHOW LICENCE */ - { 256, -2 }, /* (203) cmd ::= SHOW GRANTS */ - { 256, -4 }, /* (204) cmd ::= SHOW CREATE DATABASE db_name */ - { 256, -4 }, /* (205) cmd ::= SHOW CREATE TABLE full_table_name */ - { 256, -4 }, /* (206) cmd ::= SHOW CREATE STABLE full_table_name */ - { 256, -2 }, /* (207) cmd ::= SHOW QUERIES */ - { 256, -2 }, /* (208) cmd ::= SHOW SCORES */ - { 256, -2 }, /* (209) cmd ::= SHOW TOPICS */ - { 256, -2 }, /* (210) cmd ::= SHOW VARIABLES */ - { 256, -3 }, /* (211) cmd ::= SHOW LOCAL VARIABLES */ - { 256, -4 }, /* (212) cmd ::= SHOW DNODE NK_INTEGER VARIABLES */ - { 256, -2 }, /* (213) cmd ::= SHOW BNODES */ - { 256, -2 }, /* (214) cmd ::= SHOW SNODES */ - { 256, -2 }, /* (215) cmd ::= SHOW CLUSTER */ - { 256, -2 }, /* (216) cmd ::= SHOW TRANSACTIONS */ - { 256, -4 }, /* (217) cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ - { 256, -2 }, /* (218) cmd ::= SHOW CONSUMERS */ - { 256, -2 }, /* (219) cmd ::= SHOW SUBSCRIPTIONS */ - { 256, -5 }, /* (220) cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */ - { 304, 0 }, /* (221) db_name_cond_opt ::= */ - { 304, -2 }, /* (222) db_name_cond_opt ::= db_name NK_DOT */ - { 305, 0 }, /* (223) like_pattern_opt ::= */ - { 305, -2 }, /* (224) like_pattern_opt ::= LIKE NK_STRING */ - { 306, -1 }, /* (225) table_name_cond ::= table_name */ - { 307, 0 }, /* (226) from_db_opt ::= */ - { 307, -2 }, /* (227) from_db_opt ::= FROM db_name */ - { 256, -8 }, /* (228) cmd ::= CREATE SMA INDEX not_exists_opt index_name ON table_name index_options */ - { 256, -4 }, /* (229) cmd ::= DROP INDEX exists_opt index_name */ - { 309, -10 }, /* (230) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ - { 309, -12 }, /* (231) 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 */ - { 310, -1 }, /* (232) func_list ::= func */ - { 310, -3 }, /* (233) func_list ::= func_list NK_COMMA func */ - { 313, -4 }, /* (234) func ::= function_name NK_LP expression_list NK_RP */ - { 312, 0 }, /* (235) sma_stream_opt ::= */ - { 312, -3 }, /* (236) sma_stream_opt ::= stream_options WATERMARK duration_literal */ - { 312, -3 }, /* (237) sma_stream_opt ::= stream_options MAX_DELAY duration_literal */ - { 256, -6 }, /* (238) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_expression */ - { 256, -7 }, /* (239) cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name */ - { 256, -9 }, /* (240) cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name */ - { 256, -7 }, /* (241) cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name */ - { 256, -9 }, /* (242) cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name */ - { 256, -4 }, /* (243) cmd ::= DROP TOPIC exists_opt topic_name */ - { 256, -7 }, /* (244) cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ - { 256, -2 }, /* (245) cmd ::= DESC full_table_name */ - { 256, -2 }, /* (246) cmd ::= DESCRIBE full_table_name */ - { 256, -3 }, /* (247) cmd ::= RESET QUERY CACHE */ - { 256, -4 }, /* (248) cmd ::= EXPLAIN analyze_opt explain_options query_expression */ - { 318, 0 }, /* (249) analyze_opt ::= */ - { 318, -1 }, /* (250) analyze_opt ::= ANALYZE */ - { 319, 0 }, /* (251) explain_options ::= */ - { 319, -3 }, /* (252) explain_options ::= explain_options VERBOSE NK_BOOL */ - { 319, -3 }, /* (253) explain_options ::= explain_options RATIO NK_FLOAT */ - { 256, -6 }, /* (254) cmd ::= COMPACT VNODES IN NK_LP integer_list NK_RP */ - { 256, -10 }, /* (255) cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt */ - { 256, -4 }, /* (256) cmd ::= DROP FUNCTION exists_opt function_name */ - { 320, 0 }, /* (257) agg_func_opt ::= */ - { 320, -1 }, /* (258) agg_func_opt ::= AGGREGATE */ - { 321, 0 }, /* (259) bufsize_opt ::= */ - { 321, -2 }, /* (260) bufsize_opt ::= BUFSIZE NK_INTEGER */ - { 256, -8 }, /* (261) cmd ::= CREATE STREAM not_exists_opt stream_name stream_options into_opt AS query_expression */ - { 256, -4 }, /* (262) cmd ::= DROP STREAM exists_opt stream_name */ - { 323, 0 }, /* (263) into_opt ::= */ - { 323, -2 }, /* (264) into_opt ::= INTO full_table_name */ - { 314, 0 }, /* (265) stream_options ::= */ - { 314, -3 }, /* (266) stream_options ::= stream_options TRIGGER AT_ONCE */ - { 314, -3 }, /* (267) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ - { 314, -4 }, /* (268) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ - { 314, -3 }, /* (269) stream_options ::= stream_options WATERMARK duration_literal */ - { 314, -3 }, /* (270) stream_options ::= stream_options IGNORE EXPIRED */ - { 256, -3 }, /* (271) cmd ::= KILL CONNECTION NK_INTEGER */ - { 256, -3 }, /* (272) cmd ::= KILL QUERY NK_STRING */ - { 256, -3 }, /* (273) cmd ::= KILL TRANSACTION NK_INTEGER */ - { 256, -2 }, /* (274) cmd ::= BALANCE VGROUP */ - { 256, -4 }, /* (275) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ - { 256, -4 }, /* (276) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ - { 256, -3 }, /* (277) cmd ::= SPLIT VGROUP NK_INTEGER */ - { 324, -2 }, /* (278) dnode_list ::= DNODE NK_INTEGER */ - { 324, -3 }, /* (279) dnode_list ::= dnode_list DNODE NK_INTEGER */ - { 256, -3 }, /* (280) cmd ::= SYNCDB db_name REPLICA */ - { 256, -4 }, /* (281) cmd ::= DELETE FROM full_table_name where_clause_opt */ - { 256, -1 }, /* (282) cmd ::= query_expression */ - { 256, -7 }, /* (283) cmd ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_expression */ - { 256, -4 }, /* (284) cmd ::= INSERT INTO full_table_name query_expression */ - { 259, -1 }, /* (285) literal ::= NK_INTEGER */ - { 259, -1 }, /* (286) literal ::= NK_FLOAT */ - { 259, -1 }, /* (287) literal ::= NK_STRING */ - { 259, -1 }, /* (288) literal ::= NK_BOOL */ - { 259, -2 }, /* (289) literal ::= TIMESTAMP NK_STRING */ - { 259, -1 }, /* (290) literal ::= duration_literal */ - { 259, -1 }, /* (291) literal ::= NULL */ - { 259, -1 }, /* (292) literal ::= NK_QUESTION */ - { 300, -1 }, /* (293) duration_literal ::= NK_VARIABLE */ - { 326, -1 }, /* (294) signed ::= NK_INTEGER */ - { 326, -2 }, /* (295) signed ::= NK_PLUS NK_INTEGER */ - { 326, -2 }, /* (296) signed ::= NK_MINUS NK_INTEGER */ - { 326, -1 }, /* (297) signed ::= NK_FLOAT */ - { 326, -2 }, /* (298) signed ::= NK_PLUS NK_FLOAT */ - { 326, -2 }, /* (299) signed ::= NK_MINUS NK_FLOAT */ - { 289, -1 }, /* (300) signed_literal ::= signed */ - { 289, -1 }, /* (301) signed_literal ::= NK_STRING */ - { 289, -1 }, /* (302) signed_literal ::= NK_BOOL */ - { 289, -2 }, /* (303) signed_literal ::= TIMESTAMP NK_STRING */ - { 289, -1 }, /* (304) signed_literal ::= duration_literal */ - { 289, -1 }, /* (305) signed_literal ::= NULL */ - { 289, -1 }, /* (306) signed_literal ::= literal_func */ - { 289, -1 }, /* (307) signed_literal ::= NK_QUESTION */ - { 328, -1 }, /* (308) literal_list ::= signed_literal */ - { 328, -3 }, /* (309) literal_list ::= literal_list NK_COMMA signed_literal */ - { 267, -1 }, /* (310) db_name ::= NK_ID */ - { 295, -1 }, /* (311) table_name ::= NK_ID */ - { 287, -1 }, /* (312) column_name ::= NK_ID */ - { 302, -1 }, /* (313) function_name ::= NK_ID */ - { 329, -1 }, /* (314) table_alias ::= NK_ID */ - { 330, -1 }, /* (315) column_alias ::= NK_ID */ - { 261, -1 }, /* (316) user_name ::= NK_ID */ - { 308, -1 }, /* (317) index_name ::= NK_ID */ - { 315, -1 }, /* (318) topic_name ::= NK_ID */ - { 322, -1 }, /* (319) stream_name ::= NK_ID */ - { 317, -1 }, /* (320) cgroup_name ::= NK_ID */ - { 331, -1 }, /* (321) expression ::= literal */ - { 331, -1 }, /* (322) expression ::= pseudo_column */ - { 331, -1 }, /* (323) expression ::= column_reference */ - { 331, -1 }, /* (324) expression ::= function_expression */ - { 331, -1 }, /* (325) expression ::= subquery */ - { 331, -3 }, /* (326) expression ::= NK_LP expression NK_RP */ - { 331, -2 }, /* (327) expression ::= NK_PLUS expression */ - { 331, -2 }, /* (328) expression ::= NK_MINUS expression */ - { 331, -3 }, /* (329) expression ::= expression NK_PLUS expression */ - { 331, -3 }, /* (330) expression ::= expression NK_MINUS expression */ - { 331, -3 }, /* (331) expression ::= expression NK_STAR expression */ - { 331, -3 }, /* (332) expression ::= expression NK_SLASH expression */ - { 331, -3 }, /* (333) expression ::= expression NK_REM expression */ - { 331, -3 }, /* (334) expression ::= column_reference NK_ARROW NK_STRING */ - { 331, -3 }, /* (335) expression ::= expression NK_BITAND expression */ - { 331, -3 }, /* (336) expression ::= expression NK_BITOR expression */ - { 292, -1 }, /* (337) expression_list ::= expression */ - { 292, -3 }, /* (338) expression_list ::= expression_list NK_COMMA expression */ - { 333, -1 }, /* (339) column_reference ::= column_name */ - { 333, -3 }, /* (340) column_reference ::= table_name NK_DOT column_name */ - { 332, -1 }, /* (341) pseudo_column ::= ROWTS */ - { 332, -1 }, /* (342) pseudo_column ::= TBNAME */ - { 332, -3 }, /* (343) pseudo_column ::= table_name NK_DOT TBNAME */ - { 332, -1 }, /* (344) pseudo_column ::= QSTART */ - { 332, -1 }, /* (345) pseudo_column ::= QEND */ - { 332, -1 }, /* (346) pseudo_column ::= QDURATION */ - { 332, -1 }, /* (347) pseudo_column ::= WSTART */ - { 332, -1 }, /* (348) pseudo_column ::= WEND */ - { 332, -1 }, /* (349) pseudo_column ::= WDURATION */ - { 334, -4 }, /* (350) function_expression ::= function_name NK_LP expression_list NK_RP */ - { 334, -4 }, /* (351) function_expression ::= star_func NK_LP star_func_para_list NK_RP */ - { 334, -6 }, /* (352) function_expression ::= CAST NK_LP expression AS type_name NK_RP */ - { 334, -1 }, /* (353) function_expression ::= literal_func */ - { 327, -3 }, /* (354) literal_func ::= noarg_func NK_LP NK_RP */ - { 327, -1 }, /* (355) literal_func ::= NOW */ - { 338, -1 }, /* (356) noarg_func ::= NOW */ - { 338, -1 }, /* (357) noarg_func ::= TODAY */ - { 338, -1 }, /* (358) noarg_func ::= TIMEZONE */ - { 338, -1 }, /* (359) noarg_func ::= DATABASE */ - { 338, -1 }, /* (360) noarg_func ::= CLIENT_VERSION */ - { 338, -1 }, /* (361) noarg_func ::= SERVER_VERSION */ - { 338, -1 }, /* (362) noarg_func ::= SERVER_STATUS */ - { 338, -1 }, /* (363) noarg_func ::= CURRENT_USER */ - { 338, -1 }, /* (364) noarg_func ::= USER */ - { 336, -1 }, /* (365) star_func ::= COUNT */ - { 336, -1 }, /* (366) star_func ::= FIRST */ - { 336, -1 }, /* (367) star_func ::= LAST */ - { 336, -1 }, /* (368) star_func ::= LAST_ROW */ - { 337, -1 }, /* (369) star_func_para_list ::= NK_STAR */ - { 337, -1 }, /* (370) star_func_para_list ::= other_para_list */ - { 339, -1 }, /* (371) other_para_list ::= star_func_para */ - { 339, -3 }, /* (372) other_para_list ::= other_para_list NK_COMMA star_func_para */ - { 340, -1 }, /* (373) star_func_para ::= expression */ - { 340, -3 }, /* (374) star_func_para ::= table_name NK_DOT NK_STAR */ - { 341, -3 }, /* (375) predicate ::= expression compare_op expression */ - { 341, -5 }, /* (376) predicate ::= expression BETWEEN expression AND expression */ - { 341, -6 }, /* (377) predicate ::= expression NOT BETWEEN expression AND expression */ - { 341, -3 }, /* (378) predicate ::= expression IS NULL */ - { 341, -4 }, /* (379) predicate ::= expression IS NOT NULL */ - { 341, -3 }, /* (380) predicate ::= expression in_op in_predicate_value */ - { 342, -1 }, /* (381) compare_op ::= NK_LT */ - { 342, -1 }, /* (382) compare_op ::= NK_GT */ - { 342, -1 }, /* (383) compare_op ::= NK_LE */ - { 342, -1 }, /* (384) compare_op ::= NK_GE */ - { 342, -1 }, /* (385) compare_op ::= NK_NE */ - { 342, -1 }, /* (386) compare_op ::= NK_EQ */ - { 342, -1 }, /* (387) compare_op ::= LIKE */ - { 342, -2 }, /* (388) compare_op ::= NOT LIKE */ - { 342, -1 }, /* (389) compare_op ::= MATCH */ - { 342, -1 }, /* (390) compare_op ::= NMATCH */ - { 342, -1 }, /* (391) compare_op ::= CONTAINS */ - { 343, -1 }, /* (392) in_op ::= IN */ - { 343, -2 }, /* (393) in_op ::= NOT IN */ - { 344, -3 }, /* (394) in_predicate_value ::= NK_LP literal_list NK_RP */ - { 345, -1 }, /* (395) boolean_value_expression ::= boolean_primary */ - { 345, -2 }, /* (396) boolean_value_expression ::= NOT boolean_primary */ - { 345, -3 }, /* (397) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ - { 345, -3 }, /* (398) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ - { 346, -1 }, /* (399) boolean_primary ::= predicate */ - { 346, -3 }, /* (400) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ - { 347, -1 }, /* (401) common_expression ::= expression */ - { 347, -1 }, /* (402) common_expression ::= boolean_value_expression */ - { 348, 0 }, /* (403) from_clause_opt ::= */ - { 348, -2 }, /* (404) from_clause_opt ::= FROM table_reference_list */ - { 349, -1 }, /* (405) table_reference_list ::= table_reference */ - { 349, -3 }, /* (406) table_reference_list ::= table_reference_list NK_COMMA table_reference */ - { 350, -1 }, /* (407) table_reference ::= table_primary */ - { 350, -1 }, /* (408) table_reference ::= joined_table */ - { 351, -2 }, /* (409) table_primary ::= table_name alias_opt */ - { 351, -4 }, /* (410) table_primary ::= db_name NK_DOT table_name alias_opt */ - { 351, -2 }, /* (411) table_primary ::= subquery alias_opt */ - { 351, -1 }, /* (412) table_primary ::= parenthesized_joined_table */ - { 353, 0 }, /* (413) alias_opt ::= */ - { 353, -1 }, /* (414) alias_opt ::= table_alias */ - { 353, -2 }, /* (415) alias_opt ::= AS table_alias */ - { 354, -3 }, /* (416) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ - { 354, -3 }, /* (417) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ - { 352, -6 }, /* (418) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ - { 355, 0 }, /* (419) join_type ::= */ - { 355, -1 }, /* (420) join_type ::= INNER */ - { 357, -12 }, /* (421) 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 */ - { 358, 0 }, /* (422) set_quantifier_opt ::= */ - { 358, -1 }, /* (423) set_quantifier_opt ::= DISTINCT */ - { 358, -1 }, /* (424) set_quantifier_opt ::= ALL */ - { 359, -1 }, /* (425) select_list ::= select_item */ - { 359, -3 }, /* (426) select_list ::= select_list NK_COMMA select_item */ - { 367, -1 }, /* (427) select_item ::= NK_STAR */ - { 367, -1 }, /* (428) select_item ::= common_expression */ - { 367, -2 }, /* (429) select_item ::= common_expression column_alias */ - { 367, -3 }, /* (430) select_item ::= common_expression AS column_alias */ - { 367, -3 }, /* (431) select_item ::= table_name NK_DOT NK_STAR */ - { 325, 0 }, /* (432) where_clause_opt ::= */ - { 325, -2 }, /* (433) where_clause_opt ::= WHERE search_condition */ - { 360, 0 }, /* (434) partition_by_clause_opt ::= */ - { 360, -3 }, /* (435) partition_by_clause_opt ::= PARTITION BY expression_list */ - { 364, 0 }, /* (436) twindow_clause_opt ::= */ - { 364, -6 }, /* (437) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ - { 364, -4 }, /* (438) twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP */ - { 364, -6 }, /* (439) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ - { 364, -8 }, /* (440) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ - { 311, 0 }, /* (441) sliding_opt ::= */ - { 311, -4 }, /* (442) sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ - { 363, 0 }, /* (443) fill_opt ::= */ - { 363, -4 }, /* (444) fill_opt ::= FILL NK_LP fill_mode NK_RP */ - { 363, -6 }, /* (445) fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ - { 368, -1 }, /* (446) fill_mode ::= NONE */ - { 368, -1 }, /* (447) fill_mode ::= PREV */ - { 368, -1 }, /* (448) fill_mode ::= NULL */ - { 368, -1 }, /* (449) fill_mode ::= LINEAR */ - { 368, -1 }, /* (450) fill_mode ::= NEXT */ - { 365, 0 }, /* (451) group_by_clause_opt ::= */ - { 365, -3 }, /* (452) group_by_clause_opt ::= GROUP BY group_by_list */ - { 369, -1 }, /* (453) group_by_list ::= expression */ - { 369, -3 }, /* (454) group_by_list ::= group_by_list NK_COMMA expression */ - { 366, 0 }, /* (455) having_clause_opt ::= */ - { 366, -2 }, /* (456) having_clause_opt ::= HAVING search_condition */ - { 361, 0 }, /* (457) range_opt ::= */ - { 361, -6 }, /* (458) range_opt ::= RANGE NK_LP expression NK_COMMA expression NK_RP */ - { 362, 0 }, /* (459) every_opt ::= */ - { 362, -4 }, /* (460) every_opt ::= EVERY NK_LP duration_literal NK_RP */ - { 316, -4 }, /* (461) query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */ - { 370, -1 }, /* (462) query_expression_body ::= query_primary */ - { 370, -4 }, /* (463) query_expression_body ::= query_expression_body UNION ALL query_expression_body */ - { 370, -3 }, /* (464) query_expression_body ::= query_expression_body UNION query_expression_body */ - { 374, -1 }, /* (465) query_primary ::= query_specification */ - { 374, -6 }, /* (466) query_primary ::= NK_LP query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt NK_RP */ - { 371, 0 }, /* (467) order_by_clause_opt ::= */ - { 371, -3 }, /* (468) order_by_clause_opt ::= ORDER BY sort_specification_list */ - { 372, 0 }, /* (469) slimit_clause_opt ::= */ - { 372, -2 }, /* (470) slimit_clause_opt ::= SLIMIT NK_INTEGER */ - { 372, -4 }, /* (471) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ - { 372, -4 }, /* (472) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - { 373, 0 }, /* (473) limit_clause_opt ::= */ - { 373, -2 }, /* (474) limit_clause_opt ::= LIMIT NK_INTEGER */ - { 373, -4 }, /* (475) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ - { 373, -4 }, /* (476) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - { 335, -3 }, /* (477) subquery ::= NK_LP query_expression NK_RP */ - { 356, -1 }, /* (478) search_condition ::= common_expression */ - { 375, -1 }, /* (479) sort_specification_list ::= sort_specification */ - { 375, -3 }, /* (480) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ - { 376, -3 }, /* (481) sort_specification ::= expression ordering_specification_opt null_ordering_opt */ - { 377, 0 }, /* (482) ordering_specification_opt ::= */ - { 377, -1 }, /* (483) ordering_specification_opt ::= ASC */ - { 377, -1 }, /* (484) ordering_specification_opt ::= DESC */ - { 378, 0 }, /* (485) null_ordering_opt ::= */ - { 378, -2 }, /* (486) null_ordering_opt ::= NULLS FIRST */ - { 378, -2 }, /* (487) null_ordering_opt ::= NULLS LAST */ + { 260, -6 }, /* (0) cmd ::= CREATE ACCOUNT NK_ID PASS NK_STRING account_options */ + { 260, -4 }, /* (1) cmd ::= ALTER ACCOUNT NK_ID alter_account_options */ + { 261, 0 }, /* (2) account_options ::= */ + { 261, -3 }, /* (3) account_options ::= account_options PPS literal */ + { 261, -3 }, /* (4) account_options ::= account_options TSERIES literal */ + { 261, -3 }, /* (5) account_options ::= account_options STORAGE literal */ + { 261, -3 }, /* (6) account_options ::= account_options STREAMS literal */ + { 261, -3 }, /* (7) account_options ::= account_options QTIME literal */ + { 261, -3 }, /* (8) account_options ::= account_options DBS literal */ + { 261, -3 }, /* (9) account_options ::= account_options USERS literal */ + { 261, -3 }, /* (10) account_options ::= account_options CONNS literal */ + { 261, -3 }, /* (11) account_options ::= account_options STATE literal */ + { 262, -1 }, /* (12) alter_account_options ::= alter_account_option */ + { 262, -2 }, /* (13) alter_account_options ::= alter_account_options alter_account_option */ + { 264, -2 }, /* (14) alter_account_option ::= PASS literal */ + { 264, -2 }, /* (15) alter_account_option ::= PPS literal */ + { 264, -2 }, /* (16) alter_account_option ::= TSERIES literal */ + { 264, -2 }, /* (17) alter_account_option ::= STORAGE literal */ + { 264, -2 }, /* (18) alter_account_option ::= STREAMS literal */ + { 264, -2 }, /* (19) alter_account_option ::= QTIME literal */ + { 264, -2 }, /* (20) alter_account_option ::= DBS literal */ + { 264, -2 }, /* (21) alter_account_option ::= USERS literal */ + { 264, -2 }, /* (22) alter_account_option ::= CONNS literal */ + { 264, -2 }, /* (23) alter_account_option ::= STATE literal */ + { 260, -6 }, /* (24) cmd ::= CREATE USER user_name PASS NK_STRING sysinfo_opt */ + { 260, -5 }, /* (25) cmd ::= ALTER USER user_name PASS NK_STRING */ + { 260, -5 }, /* (26) cmd ::= ALTER USER user_name ENABLE NK_INTEGER */ + { 260, -5 }, /* (27) cmd ::= ALTER USER user_name SYSINFO NK_INTEGER */ + { 260, -3 }, /* (28) cmd ::= DROP USER user_name */ + { 266, 0 }, /* (29) sysinfo_opt ::= */ + { 266, -2 }, /* (30) sysinfo_opt ::= SYSINFO NK_INTEGER */ + { 260, -6 }, /* (31) cmd ::= GRANT privileges ON priv_level TO user_name */ + { 260, -6 }, /* (32) cmd ::= REVOKE privileges ON priv_level FROM user_name */ + { 267, -1 }, /* (33) privileges ::= ALL */ + { 267, -1 }, /* (34) privileges ::= priv_type_list */ + { 269, -1 }, /* (35) priv_type_list ::= priv_type */ + { 269, -3 }, /* (36) priv_type_list ::= priv_type_list NK_COMMA priv_type */ + { 270, -1 }, /* (37) priv_type ::= READ */ + { 270, -1 }, /* (38) priv_type ::= WRITE */ + { 268, -3 }, /* (39) priv_level ::= NK_STAR NK_DOT NK_STAR */ + { 268, -3 }, /* (40) priv_level ::= db_name NK_DOT NK_STAR */ + { 260, -3 }, /* (41) cmd ::= CREATE DNODE dnode_endpoint */ + { 260, -5 }, /* (42) cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER */ + { 260, -3 }, /* (43) cmd ::= DROP DNODE NK_INTEGER */ + { 260, -3 }, /* (44) cmd ::= DROP DNODE dnode_endpoint */ + { 260, -4 }, /* (45) cmd ::= ALTER DNODE NK_INTEGER NK_STRING */ + { 260, -5 }, /* (46) cmd ::= ALTER DNODE NK_INTEGER NK_STRING NK_STRING */ + { 260, -4 }, /* (47) cmd ::= ALTER ALL DNODES NK_STRING */ + { 260, -5 }, /* (48) cmd ::= ALTER ALL DNODES NK_STRING NK_STRING */ + { 272, -1 }, /* (49) dnode_endpoint ::= NK_STRING */ + { 272, -1 }, /* (50) dnode_endpoint ::= NK_ID */ + { 272, -1 }, /* (51) dnode_endpoint ::= NK_IPTOKEN */ + { 260, -3 }, /* (52) cmd ::= ALTER LOCAL NK_STRING */ + { 260, -4 }, /* (53) cmd ::= ALTER LOCAL NK_STRING NK_STRING */ + { 260, -5 }, /* (54) cmd ::= CREATE QNODE ON DNODE NK_INTEGER */ + { 260, -5 }, /* (55) cmd ::= DROP QNODE ON DNODE NK_INTEGER */ + { 260, -5 }, /* (56) cmd ::= CREATE BNODE ON DNODE NK_INTEGER */ + { 260, -5 }, /* (57) cmd ::= DROP BNODE ON DNODE NK_INTEGER */ + { 260, -5 }, /* (58) cmd ::= CREATE SNODE ON DNODE NK_INTEGER */ + { 260, -5 }, /* (59) cmd ::= DROP SNODE ON DNODE NK_INTEGER */ + { 260, -5 }, /* (60) cmd ::= CREATE MNODE ON DNODE NK_INTEGER */ + { 260, -5 }, /* (61) cmd ::= DROP MNODE ON DNODE NK_INTEGER */ + { 260, -5 }, /* (62) cmd ::= CREATE DATABASE not_exists_opt db_name db_options */ + { 260, -4 }, /* (63) cmd ::= DROP DATABASE exists_opt db_name */ + { 260, -2 }, /* (64) cmd ::= USE db_name */ + { 260, -4 }, /* (65) cmd ::= ALTER DATABASE db_name alter_db_options */ + { 260, -3 }, /* (66) cmd ::= FLUSH DATABASE db_name */ + { 260, -3 }, /* (67) cmd ::= TRIM DATABASE db_name */ + { 273, -3 }, /* (68) not_exists_opt ::= IF NOT EXISTS */ + { 273, 0 }, /* (69) not_exists_opt ::= */ + { 275, -2 }, /* (70) exists_opt ::= IF EXISTS */ + { 275, 0 }, /* (71) exists_opt ::= */ + { 274, 0 }, /* (72) db_options ::= */ + { 274, -3 }, /* (73) db_options ::= db_options BUFFER NK_INTEGER */ + { 274, -3 }, /* (74) db_options ::= db_options CACHEMODEL NK_STRING */ + { 274, -3 }, /* (75) db_options ::= db_options CACHESIZE NK_INTEGER */ + { 274, -3 }, /* (76) db_options ::= db_options COMP NK_INTEGER */ + { 274, -3 }, /* (77) db_options ::= db_options DURATION NK_INTEGER */ + { 274, -3 }, /* (78) db_options ::= db_options DURATION NK_VARIABLE */ + { 274, -3 }, /* (79) db_options ::= db_options FSYNC NK_INTEGER */ + { 274, -3 }, /* (80) db_options ::= db_options MAXROWS NK_INTEGER */ + { 274, -3 }, /* (81) db_options ::= db_options MINROWS NK_INTEGER */ + { 274, -3 }, /* (82) db_options ::= db_options KEEP integer_list */ + { 274, -3 }, /* (83) db_options ::= db_options KEEP variable_list */ + { 274, -3 }, /* (84) db_options ::= db_options PAGES NK_INTEGER */ + { 274, -3 }, /* (85) db_options ::= db_options PAGESIZE NK_INTEGER */ + { 274, -3 }, /* (86) db_options ::= db_options PRECISION NK_STRING */ + { 274, -3 }, /* (87) db_options ::= db_options REPLICA NK_INTEGER */ + { 274, -3 }, /* (88) db_options ::= db_options STRICT NK_STRING */ + { 274, -3 }, /* (89) db_options ::= db_options WAL NK_INTEGER */ + { 274, -3 }, /* (90) db_options ::= db_options VGROUPS NK_INTEGER */ + { 274, -3 }, /* (91) db_options ::= db_options SINGLE_STABLE NK_INTEGER */ + { 274, -3 }, /* (92) db_options ::= db_options RETENTIONS retention_list */ + { 274, -3 }, /* (93) db_options ::= db_options SCHEMALESS NK_INTEGER */ + { 274, -3 }, /* (94) db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER */ + { 274, -4 }, /* (95) db_options ::= db_options WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */ + { 274, -3 }, /* (96) db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER */ + { 274, -4 }, /* (97) db_options ::= db_options WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */ + { 274, -3 }, /* (98) db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER */ + { 274, -3 }, /* (99) db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER */ + { 276, -1 }, /* (100) alter_db_options ::= alter_db_option */ + { 276, -2 }, /* (101) alter_db_options ::= alter_db_options alter_db_option */ + { 280, -2 }, /* (102) alter_db_option ::= CACHEMODEL NK_STRING */ + { 280, -2 }, /* (103) alter_db_option ::= CACHESIZE NK_INTEGER */ + { 280, -2 }, /* (104) alter_db_option ::= FSYNC NK_INTEGER */ + { 280, -2 }, /* (105) alter_db_option ::= KEEP integer_list */ + { 280, -2 }, /* (106) alter_db_option ::= KEEP variable_list */ + { 280, -2 }, /* (107) alter_db_option ::= WAL NK_INTEGER */ + { 277, -1 }, /* (108) integer_list ::= NK_INTEGER */ + { 277, -3 }, /* (109) integer_list ::= integer_list NK_COMMA NK_INTEGER */ + { 278, -1 }, /* (110) variable_list ::= NK_VARIABLE */ + { 278, -3 }, /* (111) variable_list ::= variable_list NK_COMMA NK_VARIABLE */ + { 279, -1 }, /* (112) retention_list ::= retention */ + { 279, -3 }, /* (113) retention_list ::= retention_list NK_COMMA retention */ + { 281, -3 }, /* (114) retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */ + { 260, -9 }, /* (115) cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ + { 260, -3 }, /* (116) cmd ::= CREATE TABLE multi_create_clause */ + { 260, -9 }, /* (117) cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ + { 260, -3 }, /* (118) cmd ::= DROP TABLE multi_drop_clause */ + { 260, -4 }, /* (119) cmd ::= DROP STABLE exists_opt full_table_name */ + { 260, -3 }, /* (120) cmd ::= ALTER TABLE alter_table_clause */ + { 260, -3 }, /* (121) cmd ::= ALTER STABLE alter_table_clause */ + { 289, -2 }, /* (122) alter_table_clause ::= full_table_name alter_table_options */ + { 289, -5 }, /* (123) alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ + { 289, -4 }, /* (124) alter_table_clause ::= full_table_name DROP COLUMN column_name */ + { 289, -5 }, /* (125) alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ + { 289, -5 }, /* (126) alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ + { 289, -5 }, /* (127) alter_table_clause ::= full_table_name ADD TAG column_name type_name */ + { 289, -4 }, /* (128) alter_table_clause ::= full_table_name DROP TAG column_name */ + { 289, -5 }, /* (129) alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ + { 289, -5 }, /* (130) alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ + { 289, -6 }, /* (131) alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */ + { 286, -1 }, /* (132) multi_create_clause ::= create_subtable_clause */ + { 286, -2 }, /* (133) multi_create_clause ::= multi_create_clause create_subtable_clause */ + { 294, -10 }, /* (134) 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 */ + { 288, -1 }, /* (135) multi_drop_clause ::= drop_table_clause */ + { 288, -2 }, /* (136) multi_drop_clause ::= multi_drop_clause drop_table_clause */ + { 297, -2 }, /* (137) drop_table_clause ::= exists_opt full_table_name */ + { 295, 0 }, /* (138) specific_cols_opt ::= */ + { 295, -3 }, /* (139) specific_cols_opt ::= NK_LP col_name_list NK_RP */ + { 282, -1 }, /* (140) full_table_name ::= table_name */ + { 282, -3 }, /* (141) full_table_name ::= db_name NK_DOT table_name */ + { 283, -1 }, /* (142) column_def_list ::= column_def */ + { 283, -3 }, /* (143) column_def_list ::= column_def_list NK_COMMA column_def */ + { 300, -2 }, /* (144) column_def ::= column_name type_name */ + { 300, -4 }, /* (145) column_def ::= column_name type_name COMMENT NK_STRING */ + { 292, -1 }, /* (146) type_name ::= BOOL */ + { 292, -1 }, /* (147) type_name ::= TINYINT */ + { 292, -1 }, /* (148) type_name ::= SMALLINT */ + { 292, -1 }, /* (149) type_name ::= INT */ + { 292, -1 }, /* (150) type_name ::= INTEGER */ + { 292, -1 }, /* (151) type_name ::= BIGINT */ + { 292, -1 }, /* (152) type_name ::= FLOAT */ + { 292, -1 }, /* (153) type_name ::= DOUBLE */ + { 292, -4 }, /* (154) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ + { 292, -1 }, /* (155) type_name ::= TIMESTAMP */ + { 292, -4 }, /* (156) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ + { 292, -2 }, /* (157) type_name ::= TINYINT UNSIGNED */ + { 292, -2 }, /* (158) type_name ::= SMALLINT UNSIGNED */ + { 292, -2 }, /* (159) type_name ::= INT UNSIGNED */ + { 292, -2 }, /* (160) type_name ::= BIGINT UNSIGNED */ + { 292, -1 }, /* (161) type_name ::= JSON */ + { 292, -4 }, /* (162) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ + { 292, -1 }, /* (163) type_name ::= MEDIUMBLOB */ + { 292, -1 }, /* (164) type_name ::= BLOB */ + { 292, -4 }, /* (165) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ + { 292, -1 }, /* (166) type_name ::= DECIMAL */ + { 292, -4 }, /* (167) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ + { 292, -6 }, /* (168) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ + { 284, 0 }, /* (169) tags_def_opt ::= */ + { 284, -1 }, /* (170) tags_def_opt ::= tags_def */ + { 287, -4 }, /* (171) tags_def ::= TAGS NK_LP column_def_list NK_RP */ + { 285, 0 }, /* (172) table_options ::= */ + { 285, -3 }, /* (173) table_options ::= table_options COMMENT NK_STRING */ + { 285, -3 }, /* (174) table_options ::= table_options MAX_DELAY duration_list */ + { 285, -3 }, /* (175) table_options ::= table_options WATERMARK duration_list */ + { 285, -5 }, /* (176) table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ + { 285, -3 }, /* (177) table_options ::= table_options TTL NK_INTEGER */ + { 285, -5 }, /* (178) table_options ::= table_options SMA NK_LP col_name_list NK_RP */ + { 290, -1 }, /* (179) alter_table_options ::= alter_table_option */ + { 290, -2 }, /* (180) alter_table_options ::= alter_table_options alter_table_option */ + { 303, -2 }, /* (181) alter_table_option ::= COMMENT NK_STRING */ + { 303, -2 }, /* (182) alter_table_option ::= TTL NK_INTEGER */ + { 301, -1 }, /* (183) duration_list ::= duration_literal */ + { 301, -3 }, /* (184) duration_list ::= duration_list NK_COMMA duration_literal */ + { 302, -1 }, /* (185) rollup_func_list ::= rollup_func_name */ + { 302, -3 }, /* (186) rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ + { 305, -1 }, /* (187) rollup_func_name ::= function_name */ + { 305, -1 }, /* (188) rollup_func_name ::= FIRST */ + { 305, -1 }, /* (189) rollup_func_name ::= LAST */ + { 298, -1 }, /* (190) col_name_list ::= col_name */ + { 298, -3 }, /* (191) col_name_list ::= col_name_list NK_COMMA col_name */ + { 307, -1 }, /* (192) col_name ::= column_name */ + { 260, -2 }, /* (193) cmd ::= SHOW DNODES */ + { 260, -2 }, /* (194) cmd ::= SHOW USERS */ + { 260, -2 }, /* (195) cmd ::= SHOW DATABASES */ + { 260, -4 }, /* (196) cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */ + { 260, -4 }, /* (197) cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ + { 260, -3 }, /* (198) cmd ::= SHOW db_name_cond_opt VGROUPS */ + { 260, -2 }, /* (199) cmd ::= SHOW MNODES */ + { 260, -2 }, /* (200) cmd ::= SHOW MODULES */ + { 260, -2 }, /* (201) cmd ::= SHOW QNODES */ + { 260, -2 }, /* (202) cmd ::= SHOW FUNCTIONS */ + { 260, -5 }, /* (203) cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ + { 260, -2 }, /* (204) cmd ::= SHOW STREAMS */ + { 260, -2 }, /* (205) cmd ::= SHOW ACCOUNTS */ + { 260, -2 }, /* (206) cmd ::= SHOW APPS */ + { 260, -2 }, /* (207) cmd ::= SHOW CONNECTIONS */ + { 260, -2 }, /* (208) cmd ::= SHOW LICENCE */ + { 260, -2 }, /* (209) cmd ::= SHOW GRANTS */ + { 260, -4 }, /* (210) cmd ::= SHOW CREATE DATABASE db_name */ + { 260, -4 }, /* (211) cmd ::= SHOW CREATE TABLE full_table_name */ + { 260, -4 }, /* (212) cmd ::= SHOW CREATE STABLE full_table_name */ + { 260, -2 }, /* (213) cmd ::= SHOW QUERIES */ + { 260, -2 }, /* (214) cmd ::= SHOW SCORES */ + { 260, -2 }, /* (215) cmd ::= SHOW TOPICS */ + { 260, -2 }, /* (216) cmd ::= SHOW VARIABLES */ + { 260, -3 }, /* (217) cmd ::= SHOW LOCAL VARIABLES */ + { 260, -4 }, /* (218) cmd ::= SHOW DNODE NK_INTEGER VARIABLES */ + { 260, -2 }, /* (219) cmd ::= SHOW BNODES */ + { 260, -2 }, /* (220) cmd ::= SHOW SNODES */ + { 260, -2 }, /* (221) cmd ::= SHOW CLUSTER */ + { 260, -2 }, /* (222) cmd ::= SHOW TRANSACTIONS */ + { 260, -4 }, /* (223) cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ + { 260, -2 }, /* (224) cmd ::= SHOW CONSUMERS */ + { 260, -2 }, /* (225) cmd ::= SHOW SUBSCRIPTIONS */ + { 260, -5 }, /* (226) cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */ + { 308, 0 }, /* (227) db_name_cond_opt ::= */ + { 308, -2 }, /* (228) db_name_cond_opt ::= db_name NK_DOT */ + { 309, 0 }, /* (229) like_pattern_opt ::= */ + { 309, -2 }, /* (230) like_pattern_opt ::= LIKE NK_STRING */ + { 310, -1 }, /* (231) table_name_cond ::= table_name */ + { 311, 0 }, /* (232) from_db_opt ::= */ + { 311, -2 }, /* (233) from_db_opt ::= FROM db_name */ + { 260, -8 }, /* (234) cmd ::= CREATE SMA INDEX not_exists_opt index_name ON table_name index_options */ + { 260, -4 }, /* (235) cmd ::= DROP INDEX exists_opt index_name */ + { 313, -10 }, /* (236) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ + { 313, -12 }, /* (237) 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 */ + { 314, -1 }, /* (238) func_list ::= func */ + { 314, -3 }, /* (239) func_list ::= func_list NK_COMMA func */ + { 317, -4 }, /* (240) func ::= function_name NK_LP expression_list NK_RP */ + { 316, 0 }, /* (241) sma_stream_opt ::= */ + { 316, -3 }, /* (242) sma_stream_opt ::= stream_options WATERMARK duration_literal */ + { 316, -3 }, /* (243) sma_stream_opt ::= stream_options MAX_DELAY duration_literal */ + { 260, -6 }, /* (244) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_expression */ + { 260, -7 }, /* (245) cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name */ + { 260, -9 }, /* (246) cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name */ + { 260, -7 }, /* (247) cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name */ + { 260, -9 }, /* (248) cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name */ + { 260, -4 }, /* (249) cmd ::= DROP TOPIC exists_opt topic_name */ + { 260, -7 }, /* (250) cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ + { 260, -2 }, /* (251) cmd ::= DESC full_table_name */ + { 260, -2 }, /* (252) cmd ::= DESCRIBE full_table_name */ + { 260, -3 }, /* (253) cmd ::= RESET QUERY CACHE */ + { 260, -4 }, /* (254) cmd ::= EXPLAIN analyze_opt explain_options query_expression */ + { 322, 0 }, /* (255) analyze_opt ::= */ + { 322, -1 }, /* (256) analyze_opt ::= ANALYZE */ + { 323, 0 }, /* (257) explain_options ::= */ + { 323, -3 }, /* (258) explain_options ::= explain_options VERBOSE NK_BOOL */ + { 323, -3 }, /* (259) explain_options ::= explain_options RATIO NK_FLOAT */ + { 260, -6 }, /* (260) cmd ::= COMPACT VNODES IN NK_LP integer_list NK_RP */ + { 260, -10 }, /* (261) cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt */ + { 260, -4 }, /* (262) cmd ::= DROP FUNCTION exists_opt function_name */ + { 324, 0 }, /* (263) agg_func_opt ::= */ + { 324, -1 }, /* (264) agg_func_opt ::= AGGREGATE */ + { 325, 0 }, /* (265) bufsize_opt ::= */ + { 325, -2 }, /* (266) bufsize_opt ::= BUFSIZE NK_INTEGER */ + { 260, -8 }, /* (267) cmd ::= CREATE STREAM not_exists_opt stream_name stream_options into_opt AS query_expression */ + { 260, -4 }, /* (268) cmd ::= DROP STREAM exists_opt stream_name */ + { 327, 0 }, /* (269) into_opt ::= */ + { 327, -2 }, /* (270) into_opt ::= INTO full_table_name */ + { 318, 0 }, /* (271) stream_options ::= */ + { 318, -3 }, /* (272) stream_options ::= stream_options TRIGGER AT_ONCE */ + { 318, -3 }, /* (273) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ + { 318, -4 }, /* (274) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ + { 318, -3 }, /* (275) stream_options ::= stream_options WATERMARK duration_literal */ + { 318, -3 }, /* (276) stream_options ::= stream_options IGNORE EXPIRED */ + { 260, -3 }, /* (277) cmd ::= KILL CONNECTION NK_INTEGER */ + { 260, -3 }, /* (278) cmd ::= KILL QUERY NK_STRING */ + { 260, -3 }, /* (279) cmd ::= KILL TRANSACTION NK_INTEGER */ + { 260, -2 }, /* (280) cmd ::= BALANCE VGROUP */ + { 260, -4 }, /* (281) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ + { 260, -4 }, /* (282) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ + { 260, -3 }, /* (283) cmd ::= SPLIT VGROUP NK_INTEGER */ + { 328, -2 }, /* (284) dnode_list ::= DNODE NK_INTEGER */ + { 328, -3 }, /* (285) dnode_list ::= dnode_list DNODE NK_INTEGER */ + { 260, -3 }, /* (286) cmd ::= SYNCDB db_name REPLICA */ + { 260, -4 }, /* (287) cmd ::= DELETE FROM full_table_name where_clause_opt */ + { 260, -1 }, /* (288) cmd ::= query_expression */ + { 260, -7 }, /* (289) cmd ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_expression */ + { 260, -4 }, /* (290) cmd ::= INSERT INTO full_table_name query_expression */ + { 263, -1 }, /* (291) literal ::= NK_INTEGER */ + { 263, -1 }, /* (292) literal ::= NK_FLOAT */ + { 263, -1 }, /* (293) literal ::= NK_STRING */ + { 263, -1 }, /* (294) literal ::= NK_BOOL */ + { 263, -2 }, /* (295) literal ::= TIMESTAMP NK_STRING */ + { 263, -1 }, /* (296) literal ::= duration_literal */ + { 263, -1 }, /* (297) literal ::= NULL */ + { 263, -1 }, /* (298) literal ::= NK_QUESTION */ + { 304, -1 }, /* (299) duration_literal ::= NK_VARIABLE */ + { 330, -1 }, /* (300) signed ::= NK_INTEGER */ + { 330, -2 }, /* (301) signed ::= NK_PLUS NK_INTEGER */ + { 330, -2 }, /* (302) signed ::= NK_MINUS NK_INTEGER */ + { 330, -1 }, /* (303) signed ::= NK_FLOAT */ + { 330, -2 }, /* (304) signed ::= NK_PLUS NK_FLOAT */ + { 330, -2 }, /* (305) signed ::= NK_MINUS NK_FLOAT */ + { 293, -1 }, /* (306) signed_literal ::= signed */ + { 293, -1 }, /* (307) signed_literal ::= NK_STRING */ + { 293, -1 }, /* (308) signed_literal ::= NK_BOOL */ + { 293, -2 }, /* (309) signed_literal ::= TIMESTAMP NK_STRING */ + { 293, -1 }, /* (310) signed_literal ::= duration_literal */ + { 293, -1 }, /* (311) signed_literal ::= NULL */ + { 293, -1 }, /* (312) signed_literal ::= literal_func */ + { 293, -1 }, /* (313) signed_literal ::= NK_QUESTION */ + { 332, -1 }, /* (314) literal_list ::= signed_literal */ + { 332, -3 }, /* (315) literal_list ::= literal_list NK_COMMA signed_literal */ + { 271, -1 }, /* (316) db_name ::= NK_ID */ + { 299, -1 }, /* (317) table_name ::= NK_ID */ + { 291, -1 }, /* (318) column_name ::= NK_ID */ + { 306, -1 }, /* (319) function_name ::= NK_ID */ + { 333, -1 }, /* (320) table_alias ::= NK_ID */ + { 334, -1 }, /* (321) column_alias ::= NK_ID */ + { 265, -1 }, /* (322) user_name ::= NK_ID */ + { 312, -1 }, /* (323) index_name ::= NK_ID */ + { 319, -1 }, /* (324) topic_name ::= NK_ID */ + { 326, -1 }, /* (325) stream_name ::= NK_ID */ + { 321, -1 }, /* (326) cgroup_name ::= NK_ID */ + { 335, -1 }, /* (327) expression ::= literal */ + { 335, -1 }, /* (328) expression ::= pseudo_column */ + { 335, -1 }, /* (329) expression ::= column_reference */ + { 335, -1 }, /* (330) expression ::= function_expression */ + { 335, -1 }, /* (331) expression ::= subquery */ + { 335, -3 }, /* (332) expression ::= NK_LP expression NK_RP */ + { 335, -2 }, /* (333) expression ::= NK_PLUS expression */ + { 335, -2 }, /* (334) expression ::= NK_MINUS expression */ + { 335, -3 }, /* (335) expression ::= expression NK_PLUS expression */ + { 335, -3 }, /* (336) expression ::= expression NK_MINUS expression */ + { 335, -3 }, /* (337) expression ::= expression NK_STAR expression */ + { 335, -3 }, /* (338) expression ::= expression NK_SLASH expression */ + { 335, -3 }, /* (339) expression ::= expression NK_REM expression */ + { 335, -3 }, /* (340) expression ::= column_reference NK_ARROW NK_STRING */ + { 335, -3 }, /* (341) expression ::= expression NK_BITAND expression */ + { 335, -3 }, /* (342) expression ::= expression NK_BITOR expression */ + { 296, -1 }, /* (343) expression_list ::= expression */ + { 296, -3 }, /* (344) expression_list ::= expression_list NK_COMMA expression */ + { 337, -1 }, /* (345) column_reference ::= column_name */ + { 337, -3 }, /* (346) column_reference ::= table_name NK_DOT column_name */ + { 336, -1 }, /* (347) pseudo_column ::= ROWTS */ + { 336, -1 }, /* (348) pseudo_column ::= TBNAME */ + { 336, -3 }, /* (349) pseudo_column ::= table_name NK_DOT TBNAME */ + { 336, -1 }, /* (350) pseudo_column ::= QSTART */ + { 336, -1 }, /* (351) pseudo_column ::= QEND */ + { 336, -1 }, /* (352) pseudo_column ::= QDURATION */ + { 336, -1 }, /* (353) pseudo_column ::= WSTART */ + { 336, -1 }, /* (354) pseudo_column ::= WEND */ + { 336, -1 }, /* (355) pseudo_column ::= WDURATION */ + { 338, -4 }, /* (356) function_expression ::= function_name NK_LP expression_list NK_RP */ + { 338, -4 }, /* (357) function_expression ::= star_func NK_LP star_func_para_list NK_RP */ + { 338, -6 }, /* (358) function_expression ::= CAST NK_LP expression AS type_name NK_RP */ + { 338, -1 }, /* (359) function_expression ::= literal_func */ + { 331, -3 }, /* (360) literal_func ::= noarg_func NK_LP NK_RP */ + { 331, -1 }, /* (361) literal_func ::= NOW */ + { 342, -1 }, /* (362) noarg_func ::= NOW */ + { 342, -1 }, /* (363) noarg_func ::= TODAY */ + { 342, -1 }, /* (364) noarg_func ::= TIMEZONE */ + { 342, -1 }, /* (365) noarg_func ::= DATABASE */ + { 342, -1 }, /* (366) noarg_func ::= CLIENT_VERSION */ + { 342, -1 }, /* (367) noarg_func ::= SERVER_VERSION */ + { 342, -1 }, /* (368) noarg_func ::= SERVER_STATUS */ + { 342, -1 }, /* (369) noarg_func ::= CURRENT_USER */ + { 342, -1 }, /* (370) noarg_func ::= USER */ + { 340, -1 }, /* (371) star_func ::= COUNT */ + { 340, -1 }, /* (372) star_func ::= FIRST */ + { 340, -1 }, /* (373) star_func ::= LAST */ + { 340, -1 }, /* (374) star_func ::= LAST_ROW */ + { 341, -1 }, /* (375) star_func_para_list ::= NK_STAR */ + { 341, -1 }, /* (376) star_func_para_list ::= other_para_list */ + { 343, -1 }, /* (377) other_para_list ::= star_func_para */ + { 343, -3 }, /* (378) other_para_list ::= other_para_list NK_COMMA star_func_para */ + { 344, -1 }, /* (379) star_func_para ::= expression */ + { 344, -3 }, /* (380) star_func_para ::= table_name NK_DOT NK_STAR */ + { 345, -3 }, /* (381) predicate ::= expression compare_op expression */ + { 345, -5 }, /* (382) predicate ::= expression BETWEEN expression AND expression */ + { 345, -6 }, /* (383) predicate ::= expression NOT BETWEEN expression AND expression */ + { 345, -3 }, /* (384) predicate ::= expression IS NULL */ + { 345, -4 }, /* (385) predicate ::= expression IS NOT NULL */ + { 345, -3 }, /* (386) predicate ::= expression in_op in_predicate_value */ + { 346, -1 }, /* (387) compare_op ::= NK_LT */ + { 346, -1 }, /* (388) compare_op ::= NK_GT */ + { 346, -1 }, /* (389) compare_op ::= NK_LE */ + { 346, -1 }, /* (390) compare_op ::= NK_GE */ + { 346, -1 }, /* (391) compare_op ::= NK_NE */ + { 346, -1 }, /* (392) compare_op ::= NK_EQ */ + { 346, -1 }, /* (393) compare_op ::= LIKE */ + { 346, -2 }, /* (394) compare_op ::= NOT LIKE */ + { 346, -1 }, /* (395) compare_op ::= MATCH */ + { 346, -1 }, /* (396) compare_op ::= NMATCH */ + { 346, -1 }, /* (397) compare_op ::= CONTAINS */ + { 347, -1 }, /* (398) in_op ::= IN */ + { 347, -2 }, /* (399) in_op ::= NOT IN */ + { 348, -3 }, /* (400) in_predicate_value ::= NK_LP literal_list NK_RP */ + { 349, -1 }, /* (401) boolean_value_expression ::= boolean_primary */ + { 349, -2 }, /* (402) boolean_value_expression ::= NOT boolean_primary */ + { 349, -3 }, /* (403) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ + { 349, -3 }, /* (404) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ + { 350, -1 }, /* (405) boolean_primary ::= predicate */ + { 350, -3 }, /* (406) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ + { 351, -1 }, /* (407) common_expression ::= expression */ + { 351, -1 }, /* (408) common_expression ::= boolean_value_expression */ + { 352, 0 }, /* (409) from_clause_opt ::= */ + { 352, -2 }, /* (410) from_clause_opt ::= FROM table_reference_list */ + { 353, -1 }, /* (411) table_reference_list ::= table_reference */ + { 353, -3 }, /* (412) table_reference_list ::= table_reference_list NK_COMMA table_reference */ + { 354, -1 }, /* (413) table_reference ::= table_primary */ + { 354, -1 }, /* (414) table_reference ::= joined_table */ + { 355, -2 }, /* (415) table_primary ::= table_name alias_opt */ + { 355, -4 }, /* (416) table_primary ::= db_name NK_DOT table_name alias_opt */ + { 355, -2 }, /* (417) table_primary ::= subquery alias_opt */ + { 355, -1 }, /* (418) table_primary ::= parenthesized_joined_table */ + { 357, 0 }, /* (419) alias_opt ::= */ + { 357, -1 }, /* (420) alias_opt ::= table_alias */ + { 357, -2 }, /* (421) alias_opt ::= AS table_alias */ + { 358, -3 }, /* (422) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ + { 358, -3 }, /* (423) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ + { 356, -6 }, /* (424) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ + { 359, 0 }, /* (425) join_type ::= */ + { 359, -1 }, /* (426) join_type ::= INNER */ + { 361, -12 }, /* (427) 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 */ + { 362, 0 }, /* (428) set_quantifier_opt ::= */ + { 362, -1 }, /* (429) set_quantifier_opt ::= DISTINCT */ + { 362, -1 }, /* (430) set_quantifier_opt ::= ALL */ + { 363, -1 }, /* (431) select_list ::= select_item */ + { 363, -3 }, /* (432) select_list ::= select_list NK_COMMA select_item */ + { 371, -1 }, /* (433) select_item ::= NK_STAR */ + { 371, -1 }, /* (434) select_item ::= common_expression */ + { 371, -2 }, /* (435) select_item ::= common_expression column_alias */ + { 371, -3 }, /* (436) select_item ::= common_expression AS column_alias */ + { 371, -3 }, /* (437) select_item ::= table_name NK_DOT NK_STAR */ + { 329, 0 }, /* (438) where_clause_opt ::= */ + { 329, -2 }, /* (439) where_clause_opt ::= WHERE search_condition */ + { 364, 0 }, /* (440) partition_by_clause_opt ::= */ + { 364, -3 }, /* (441) partition_by_clause_opt ::= PARTITION BY expression_list */ + { 368, 0 }, /* (442) twindow_clause_opt ::= */ + { 368, -6 }, /* (443) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ + { 368, -4 }, /* (444) twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP */ + { 368, -6 }, /* (445) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ + { 368, -8 }, /* (446) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ + { 315, 0 }, /* (447) sliding_opt ::= */ + { 315, -4 }, /* (448) sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ + { 367, 0 }, /* (449) fill_opt ::= */ + { 367, -4 }, /* (450) fill_opt ::= FILL NK_LP fill_mode NK_RP */ + { 367, -6 }, /* (451) fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ + { 372, -1 }, /* (452) fill_mode ::= NONE */ + { 372, -1 }, /* (453) fill_mode ::= PREV */ + { 372, -1 }, /* (454) fill_mode ::= NULL */ + { 372, -1 }, /* (455) fill_mode ::= LINEAR */ + { 372, -1 }, /* (456) fill_mode ::= NEXT */ + { 369, 0 }, /* (457) group_by_clause_opt ::= */ + { 369, -3 }, /* (458) group_by_clause_opt ::= GROUP BY group_by_list */ + { 373, -1 }, /* (459) group_by_list ::= expression */ + { 373, -3 }, /* (460) group_by_list ::= group_by_list NK_COMMA expression */ + { 370, 0 }, /* (461) having_clause_opt ::= */ + { 370, -2 }, /* (462) having_clause_opt ::= HAVING search_condition */ + { 365, 0 }, /* (463) range_opt ::= */ + { 365, -6 }, /* (464) range_opt ::= RANGE NK_LP expression NK_COMMA expression NK_RP */ + { 366, 0 }, /* (465) every_opt ::= */ + { 366, -4 }, /* (466) every_opt ::= EVERY NK_LP duration_literal NK_RP */ + { 320, -4 }, /* (467) query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */ + { 374, -1 }, /* (468) query_expression_body ::= query_primary */ + { 374, -4 }, /* (469) query_expression_body ::= query_expression_body UNION ALL query_expression_body */ + { 374, -3 }, /* (470) query_expression_body ::= query_expression_body UNION query_expression_body */ + { 378, -1 }, /* (471) query_primary ::= query_specification */ + { 378, -6 }, /* (472) query_primary ::= NK_LP query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt NK_RP */ + { 375, 0 }, /* (473) order_by_clause_opt ::= */ + { 375, -3 }, /* (474) order_by_clause_opt ::= ORDER BY sort_specification_list */ + { 376, 0 }, /* (475) slimit_clause_opt ::= */ + { 376, -2 }, /* (476) slimit_clause_opt ::= SLIMIT NK_INTEGER */ + { 376, -4 }, /* (477) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ + { 376, -4 }, /* (478) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + { 377, 0 }, /* (479) limit_clause_opt ::= */ + { 377, -2 }, /* (480) limit_clause_opt ::= LIMIT NK_INTEGER */ + { 377, -4 }, /* (481) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ + { 377, -4 }, /* (482) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + { 339, -3 }, /* (483) subquery ::= NK_LP query_expression NK_RP */ + { 360, -1 }, /* (484) search_condition ::= common_expression */ + { 379, -1 }, /* (485) sort_specification_list ::= sort_specification */ + { 379, -3 }, /* (486) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ + { 380, -3 }, /* (487) sort_specification ::= expression ordering_specification_opt null_ordering_opt */ + { 381, 0 }, /* (488) ordering_specification_opt ::= */ + { 381, -1 }, /* (489) ordering_specification_opt ::= ASC */ + { 381, -1 }, /* (490) ordering_specification_opt ::= DESC */ + { 382, 0 }, /* (491) null_ordering_opt ::= */ + { 382, -2 }, /* (492) null_ordering_opt ::= NULLS FIRST */ + { 382, -2 }, /* (493) null_ordering_opt ::= NULLS LAST */ }; static void yy_accept(yyParser*); /* Forward Declaration */ @@ -3303,11 +3337,11 @@ static YYACTIONTYPE yy_reduce( YYMINORTYPE yylhsminor; case 0: /* cmd ::= CREATE ACCOUNT NK_ID PASS NK_STRING account_options */ { pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); } - yy_destructor(yypParser,257,&yymsp[0].minor); + yy_destructor(yypParser,261,&yymsp[0].minor); break; case 1: /* cmd ::= ALTER ACCOUNT NK_ID alter_account_options */ { pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); } - yy_destructor(yypParser,258,&yymsp[0].minor); + yy_destructor(yypParser,262,&yymsp[0].minor); break; case 2: /* account_options ::= */ { } @@ -3321,20 +3355,20 @@ static YYACTIONTYPE yy_reduce( case 9: /* account_options ::= account_options USERS literal */ yytestcase(yyruleno==9); case 10: /* account_options ::= account_options CONNS literal */ yytestcase(yyruleno==10); case 11: /* account_options ::= account_options STATE literal */ yytestcase(yyruleno==11); -{ yy_destructor(yypParser,257,&yymsp[-2].minor); +{ yy_destructor(yypParser,261,&yymsp[-2].minor); { } - yy_destructor(yypParser,259,&yymsp[0].minor); + yy_destructor(yypParser,263,&yymsp[0].minor); } break; case 12: /* alter_account_options ::= alter_account_option */ -{ yy_destructor(yypParser,260,&yymsp[0].minor); +{ yy_destructor(yypParser,264,&yymsp[0].minor); { } } break; case 13: /* alter_account_options ::= alter_account_options alter_account_option */ -{ yy_destructor(yypParser,258,&yymsp[-1].minor); +{ yy_destructor(yypParser,262,&yymsp[-1].minor); { } - yy_destructor(yypParser,260,&yymsp[0].minor); + yy_destructor(yypParser,264,&yymsp[0].minor); } break; case 14: /* alter_account_option ::= PASS literal */ @@ -3348,72 +3382,72 @@ static YYACTIONTYPE yy_reduce( case 22: /* alter_account_option ::= CONNS literal */ yytestcase(yyruleno==22); case 23: /* alter_account_option ::= STATE literal */ yytestcase(yyruleno==23); { } - yy_destructor(yypParser,259,&yymsp[0].minor); + yy_destructor(yypParser,263,&yymsp[0].minor); break; case 24: /* cmd ::= CREATE USER user_name PASS NK_STRING sysinfo_opt */ -{ pCxt->pRootNode = createCreateUserStmt(pCxt, &yymsp[-3].minor.yy361, &yymsp[-1].minor.yy0, yymsp[0].minor.yy285); } +{ pCxt->pRootNode = createCreateUserStmt(pCxt, &yymsp[-3].minor.yy231, &yymsp[-1].minor.yy0, yymsp[0].minor.yy425); } break; case 25: /* cmd ::= ALTER USER user_name PASS NK_STRING */ -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy361, TSDB_ALTER_USER_PASSWD, &yymsp[0].minor.yy0); } +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy231, 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.yy361, TSDB_ALTER_USER_ENABLE, &yymsp[0].minor.yy0); } +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy231, 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.yy361, TSDB_ALTER_USER_SYSINFO, &yymsp[0].minor.yy0); } +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy231, TSDB_ALTER_USER_SYSINFO, &yymsp[0].minor.yy0); } break; case 28: /* cmd ::= DROP USER user_name */ -{ pCxt->pRootNode = createDropUserStmt(pCxt, &yymsp[0].minor.yy361); } +{ pCxt->pRootNode = createDropUserStmt(pCxt, &yymsp[0].minor.yy231); } break; case 29: /* sysinfo_opt ::= */ -{ yymsp[1].minor.yy285 = 1; } +{ yymsp[1].minor.yy425 = 1; } break; case 30: /* sysinfo_opt ::= SYSINFO NK_INTEGER */ -{ yymsp[-1].minor.yy285 = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); } +{ yymsp[-1].minor.yy425 = 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.yy457, &yymsp[-2].minor.yy361, &yymsp[0].minor.yy361); } +{ pCxt->pRootNode = createGrantStmt(pCxt, yymsp[-4].minor.yy59, &yymsp[-2].minor.yy231, &yymsp[0].minor.yy231); } break; case 32: /* cmd ::= REVOKE privileges ON priv_level FROM user_name */ -{ pCxt->pRootNode = createRevokeStmt(pCxt, yymsp[-4].minor.yy457, &yymsp[-2].minor.yy361, &yymsp[0].minor.yy361); } +{ pCxt->pRootNode = createRevokeStmt(pCxt, yymsp[-4].minor.yy59, &yymsp[-2].minor.yy231, &yymsp[0].minor.yy231); } break; case 33: /* privileges ::= ALL */ -{ yymsp[0].minor.yy457 = PRIVILEGE_TYPE_ALL; } +{ yymsp[0].minor.yy59 = PRIVILEGE_TYPE_ALL; } break; case 34: /* privileges ::= priv_type_list */ case 35: /* priv_type_list ::= priv_type */ yytestcase(yyruleno==35); -{ yylhsminor.yy457 = yymsp[0].minor.yy457; } - yymsp[0].minor.yy457 = yylhsminor.yy457; +{ yylhsminor.yy59 = yymsp[0].minor.yy59; } + yymsp[0].minor.yy59 = yylhsminor.yy59; break; case 36: /* priv_type_list ::= priv_type_list NK_COMMA priv_type */ -{ yylhsminor.yy457 = yymsp[-2].minor.yy457 | yymsp[0].minor.yy457; } - yymsp[-2].minor.yy457 = yylhsminor.yy457; +{ yylhsminor.yy59 = yymsp[-2].minor.yy59 | yymsp[0].minor.yy59; } + yymsp[-2].minor.yy59 = yylhsminor.yy59; break; case 37: /* priv_type ::= READ */ -{ yymsp[0].minor.yy457 = PRIVILEGE_TYPE_READ; } +{ yymsp[0].minor.yy59 = PRIVILEGE_TYPE_READ; } break; case 38: /* priv_type ::= WRITE */ -{ yymsp[0].minor.yy457 = PRIVILEGE_TYPE_WRITE; } +{ yymsp[0].minor.yy59 = PRIVILEGE_TYPE_WRITE; } break; case 39: /* priv_level ::= NK_STAR NK_DOT NK_STAR */ -{ yylhsminor.yy361 = yymsp[-2].minor.yy0; } - yymsp[-2].minor.yy361 = yylhsminor.yy361; +{ yylhsminor.yy231 = yymsp[-2].minor.yy0; } + yymsp[-2].minor.yy231 = yylhsminor.yy231; break; case 40: /* priv_level ::= db_name NK_DOT NK_STAR */ -{ yylhsminor.yy361 = yymsp[-2].minor.yy361; } - yymsp[-2].minor.yy361 = yylhsminor.yy361; +{ yylhsminor.yy231 = yymsp[-2].minor.yy231; } + yymsp[-2].minor.yy231 = yylhsminor.yy231; break; case 41: /* cmd ::= CREATE DNODE dnode_endpoint */ -{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[0].minor.yy361, NULL); } +{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[0].minor.yy231, NULL); } break; case 42: /* cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER */ -{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[-2].minor.yy361, &yymsp[0].minor.yy0); } +{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[-2].minor.yy231, &yymsp[0].minor.yy0); } break; case 43: /* cmd ::= DROP DNODE NK_INTEGER */ { pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[0].minor.yy0); } break; case 44: /* cmd ::= DROP DNODE dnode_endpoint */ -{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[0].minor.yy361); } +{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[0].minor.yy231); } break; case 45: /* cmd ::= ALTER DNODE NK_INTEGER NK_STRING */ { pCxt->pRootNode = createAlterDnodeStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, NULL); } @@ -3430,32 +3464,32 @@ static YYACTIONTYPE yy_reduce( case 49: /* dnode_endpoint ::= NK_STRING */ case 50: /* dnode_endpoint ::= NK_ID */ yytestcase(yyruleno==50); case 51: /* dnode_endpoint ::= NK_IPTOKEN */ yytestcase(yyruleno==51); - case 310: /* db_name ::= NK_ID */ yytestcase(yyruleno==310); - case 311: /* table_name ::= NK_ID */ yytestcase(yyruleno==311); - case 312: /* column_name ::= NK_ID */ yytestcase(yyruleno==312); - case 313: /* function_name ::= NK_ID */ yytestcase(yyruleno==313); - case 314: /* table_alias ::= NK_ID */ yytestcase(yyruleno==314); - case 315: /* column_alias ::= NK_ID */ yytestcase(yyruleno==315); - case 316: /* user_name ::= NK_ID */ yytestcase(yyruleno==316); - case 317: /* index_name ::= NK_ID */ yytestcase(yyruleno==317); - case 318: /* topic_name ::= NK_ID */ yytestcase(yyruleno==318); - case 319: /* stream_name ::= NK_ID */ yytestcase(yyruleno==319); - case 320: /* cgroup_name ::= NK_ID */ yytestcase(yyruleno==320); - case 356: /* noarg_func ::= NOW */ yytestcase(yyruleno==356); - case 357: /* noarg_func ::= TODAY */ yytestcase(yyruleno==357); - case 358: /* noarg_func ::= TIMEZONE */ yytestcase(yyruleno==358); - case 359: /* noarg_func ::= DATABASE */ yytestcase(yyruleno==359); - case 360: /* noarg_func ::= CLIENT_VERSION */ yytestcase(yyruleno==360); - case 361: /* noarg_func ::= SERVER_VERSION */ yytestcase(yyruleno==361); - case 362: /* noarg_func ::= SERVER_STATUS */ yytestcase(yyruleno==362); - case 363: /* noarg_func ::= CURRENT_USER */ yytestcase(yyruleno==363); - case 364: /* noarg_func ::= USER */ yytestcase(yyruleno==364); - case 365: /* star_func ::= COUNT */ yytestcase(yyruleno==365); - case 366: /* star_func ::= FIRST */ yytestcase(yyruleno==366); - case 367: /* star_func ::= LAST */ yytestcase(yyruleno==367); - case 368: /* star_func ::= LAST_ROW */ yytestcase(yyruleno==368); -{ yylhsminor.yy361 = yymsp[0].minor.yy0; } - yymsp[0].minor.yy361 = yylhsminor.yy361; + case 316: /* db_name ::= NK_ID */ yytestcase(yyruleno==316); + case 317: /* table_name ::= NK_ID */ yytestcase(yyruleno==317); + case 318: /* column_name ::= NK_ID */ yytestcase(yyruleno==318); + case 319: /* function_name ::= NK_ID */ yytestcase(yyruleno==319); + case 320: /* table_alias ::= NK_ID */ yytestcase(yyruleno==320); + case 321: /* column_alias ::= NK_ID */ yytestcase(yyruleno==321); + case 322: /* user_name ::= NK_ID */ yytestcase(yyruleno==322); + case 323: /* index_name ::= NK_ID */ yytestcase(yyruleno==323); + case 324: /* topic_name ::= NK_ID */ yytestcase(yyruleno==324); + case 325: /* stream_name ::= NK_ID */ yytestcase(yyruleno==325); + case 326: /* cgroup_name ::= NK_ID */ yytestcase(yyruleno==326); + case 362: /* noarg_func ::= NOW */ yytestcase(yyruleno==362); + case 363: /* noarg_func ::= TODAY */ yytestcase(yyruleno==363); + case 364: /* noarg_func ::= TIMEZONE */ yytestcase(yyruleno==364); + case 365: /* noarg_func ::= DATABASE */ yytestcase(yyruleno==365); + case 366: /* noarg_func ::= CLIENT_VERSION */ yytestcase(yyruleno==366); + case 367: /* noarg_func ::= SERVER_VERSION */ yytestcase(yyruleno==367); + case 368: /* noarg_func ::= SERVER_STATUS */ yytestcase(yyruleno==368); + case 369: /* noarg_func ::= CURRENT_USER */ yytestcase(yyruleno==369); + case 370: /* noarg_func ::= USER */ yytestcase(yyruleno==370); + case 371: /* star_func ::= COUNT */ yytestcase(yyruleno==371); + case 372: /* star_func ::= FIRST */ yytestcase(yyruleno==372); + case 373: /* star_func ::= LAST */ yytestcase(yyruleno==373); + case 374: /* star_func ::= LAST_ROW */ yytestcase(yyruleno==374); +{ yylhsminor.yy231 = yymsp[0].minor.yy0; } + yymsp[0].minor.yy231 = yylhsminor.yy231; break; case 52: /* cmd ::= ALTER LOCAL NK_STRING */ { pCxt->pRootNode = createAlterLocalStmt(pCxt, &yymsp[0].minor.yy0, NULL); } @@ -3488,1238 +3522,1270 @@ static YYACTIONTYPE yy_reduce( { pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_MNODE_STMT, &yymsp[0].minor.yy0); } break; case 62: /* cmd ::= CREATE DATABASE not_exists_opt db_name db_options */ -{ pCxt->pRootNode = createCreateDatabaseStmt(pCxt, yymsp[-2].minor.yy151, &yymsp[-1].minor.yy361, yymsp[0].minor.yy616); } +{ pCxt->pRootNode = createCreateDatabaseStmt(pCxt, yymsp[-2].minor.yy611, &yymsp[-1].minor.yy231, yymsp[0].minor.yy160); } break; case 63: /* cmd ::= DROP DATABASE exists_opt db_name */ -{ pCxt->pRootNode = createDropDatabaseStmt(pCxt, yymsp[-1].minor.yy151, &yymsp[0].minor.yy361); } +{ pCxt->pRootNode = createDropDatabaseStmt(pCxt, yymsp[-1].minor.yy611, &yymsp[0].minor.yy231); } break; case 64: /* cmd ::= USE db_name */ -{ pCxt->pRootNode = createUseDatabaseStmt(pCxt, &yymsp[0].minor.yy361); } +{ pCxt->pRootNode = createUseDatabaseStmt(pCxt, &yymsp[0].minor.yy231); } break; case 65: /* cmd ::= ALTER DATABASE db_name alter_db_options */ -{ pCxt->pRootNode = createAlterDatabaseStmt(pCxt, &yymsp[-1].minor.yy361, yymsp[0].minor.yy616); } +{ pCxt->pRootNode = createAlterDatabaseStmt(pCxt, &yymsp[-1].minor.yy231, yymsp[0].minor.yy160); } break; case 66: /* cmd ::= FLUSH DATABASE db_name */ -{ pCxt->pRootNode = createFlushDatabaseStmt(pCxt, &yymsp[0].minor.yy361); } +{ pCxt->pRootNode = createFlushDatabaseStmt(pCxt, &yymsp[0].minor.yy231); } break; case 67: /* cmd ::= TRIM DATABASE db_name */ -{ pCxt->pRootNode = createTrimDatabaseStmt(pCxt, &yymsp[0].minor.yy361); } +{ pCxt->pRootNode = createTrimDatabaseStmt(pCxt, &yymsp[0].minor.yy231); } break; case 68: /* not_exists_opt ::= IF NOT EXISTS */ -{ yymsp[-2].minor.yy151 = true; } +{ yymsp[-2].minor.yy611 = true; } break; case 69: /* not_exists_opt ::= */ case 71: /* exists_opt ::= */ yytestcase(yyruleno==71); - case 249: /* analyze_opt ::= */ yytestcase(yyruleno==249); - case 257: /* agg_func_opt ::= */ yytestcase(yyruleno==257); - case 422: /* set_quantifier_opt ::= */ yytestcase(yyruleno==422); -{ yymsp[1].minor.yy151 = false; } + case 255: /* analyze_opt ::= */ yytestcase(yyruleno==255); + case 263: /* agg_func_opt ::= */ yytestcase(yyruleno==263); + case 428: /* set_quantifier_opt ::= */ yytestcase(yyruleno==428); +{ yymsp[1].minor.yy611 = false; } break; case 70: /* exists_opt ::= IF EXISTS */ -{ yymsp[-1].minor.yy151 = true; } +{ yymsp[-1].minor.yy611 = true; } break; case 72: /* db_options ::= */ -{ yymsp[1].minor.yy616 = createDefaultDatabaseOptions(pCxt); } +{ yymsp[1].minor.yy160 = createDefaultDatabaseOptions(pCxt); } break; case 73: /* db_options ::= db_options BUFFER NK_INTEGER */ -{ yylhsminor.yy616 = setDatabaseOption(pCxt, yymsp[-2].minor.yy616, DB_OPTION_BUFFER, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy616 = yylhsminor.yy616; +{ yylhsminor.yy160 = setDatabaseOption(pCxt, yymsp[-2].minor.yy160, DB_OPTION_BUFFER, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy160 = yylhsminor.yy160; break; case 74: /* db_options ::= db_options CACHEMODEL NK_STRING */ -{ yylhsminor.yy616 = setDatabaseOption(pCxt, yymsp[-2].minor.yy616, DB_OPTION_CACHEMODEL, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy616 = yylhsminor.yy616; +{ yylhsminor.yy160 = setDatabaseOption(pCxt, yymsp[-2].minor.yy160, DB_OPTION_CACHEMODEL, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy160 = yylhsminor.yy160; break; case 75: /* db_options ::= db_options CACHESIZE NK_INTEGER */ -{ yylhsminor.yy616 = setDatabaseOption(pCxt, yymsp[-2].minor.yy616, DB_OPTION_CACHESIZE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy616 = yylhsminor.yy616; +{ yylhsminor.yy160 = setDatabaseOption(pCxt, yymsp[-2].minor.yy160, DB_OPTION_CACHESIZE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy160 = yylhsminor.yy160; break; case 76: /* db_options ::= db_options COMP NK_INTEGER */ -{ yylhsminor.yy616 = setDatabaseOption(pCxt, yymsp[-2].minor.yy616, DB_OPTION_COMP, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy616 = yylhsminor.yy616; +{ yylhsminor.yy160 = setDatabaseOption(pCxt, yymsp[-2].minor.yy160, DB_OPTION_COMP, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy160 = yylhsminor.yy160; break; case 77: /* db_options ::= db_options DURATION NK_INTEGER */ case 78: /* db_options ::= db_options DURATION NK_VARIABLE */ yytestcase(yyruleno==78); -{ yylhsminor.yy616 = setDatabaseOption(pCxt, yymsp[-2].minor.yy616, DB_OPTION_DAYS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy616 = yylhsminor.yy616; +{ yylhsminor.yy160 = setDatabaseOption(pCxt, yymsp[-2].minor.yy160, DB_OPTION_DAYS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy160 = yylhsminor.yy160; break; case 79: /* db_options ::= db_options FSYNC NK_INTEGER */ -{ yylhsminor.yy616 = setDatabaseOption(pCxt, yymsp[-2].minor.yy616, DB_OPTION_FSYNC, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy616 = yylhsminor.yy616; +{ yylhsminor.yy160 = setDatabaseOption(pCxt, yymsp[-2].minor.yy160, DB_OPTION_FSYNC, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy160 = yylhsminor.yy160; break; case 80: /* db_options ::= db_options MAXROWS NK_INTEGER */ -{ yylhsminor.yy616 = setDatabaseOption(pCxt, yymsp[-2].minor.yy616, DB_OPTION_MAXROWS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy616 = yylhsminor.yy616; +{ yylhsminor.yy160 = setDatabaseOption(pCxt, yymsp[-2].minor.yy160, DB_OPTION_MAXROWS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy160 = yylhsminor.yy160; break; case 81: /* db_options ::= db_options MINROWS NK_INTEGER */ -{ yylhsminor.yy616 = setDatabaseOption(pCxt, yymsp[-2].minor.yy616, DB_OPTION_MINROWS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy616 = yylhsminor.yy616; +{ yylhsminor.yy160 = setDatabaseOption(pCxt, yymsp[-2].minor.yy160, DB_OPTION_MINROWS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy160 = yylhsminor.yy160; break; case 82: /* db_options ::= db_options KEEP integer_list */ case 83: /* db_options ::= db_options KEEP variable_list */ yytestcase(yyruleno==83); -{ yylhsminor.yy616 = setDatabaseOption(pCxt, yymsp[-2].minor.yy616, DB_OPTION_KEEP, yymsp[0].minor.yy356); } - yymsp[-2].minor.yy616 = yylhsminor.yy616; +{ yylhsminor.yy160 = setDatabaseOption(pCxt, yymsp[-2].minor.yy160, DB_OPTION_KEEP, yymsp[0].minor.yy180); } + yymsp[-2].minor.yy160 = yylhsminor.yy160; break; case 84: /* db_options ::= db_options PAGES NK_INTEGER */ -{ yylhsminor.yy616 = setDatabaseOption(pCxt, yymsp[-2].minor.yy616, DB_OPTION_PAGES, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy616 = yylhsminor.yy616; +{ yylhsminor.yy160 = setDatabaseOption(pCxt, yymsp[-2].minor.yy160, DB_OPTION_PAGES, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy160 = yylhsminor.yy160; break; case 85: /* db_options ::= db_options PAGESIZE NK_INTEGER */ -{ yylhsminor.yy616 = setDatabaseOption(pCxt, yymsp[-2].minor.yy616, DB_OPTION_PAGESIZE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy616 = yylhsminor.yy616; +{ yylhsminor.yy160 = setDatabaseOption(pCxt, yymsp[-2].minor.yy160, DB_OPTION_PAGESIZE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy160 = yylhsminor.yy160; break; case 86: /* db_options ::= db_options PRECISION NK_STRING */ -{ yylhsminor.yy616 = setDatabaseOption(pCxt, yymsp[-2].minor.yy616, DB_OPTION_PRECISION, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy616 = yylhsminor.yy616; +{ yylhsminor.yy160 = setDatabaseOption(pCxt, yymsp[-2].minor.yy160, DB_OPTION_PRECISION, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy160 = yylhsminor.yy160; break; case 87: /* db_options ::= db_options REPLICA NK_INTEGER */ -{ yylhsminor.yy616 = setDatabaseOption(pCxt, yymsp[-2].minor.yy616, DB_OPTION_REPLICA, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy616 = yylhsminor.yy616; +{ yylhsminor.yy160 = setDatabaseOption(pCxt, yymsp[-2].minor.yy160, DB_OPTION_REPLICA, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy160 = yylhsminor.yy160; break; case 88: /* db_options ::= db_options STRICT NK_STRING */ -{ yylhsminor.yy616 = setDatabaseOption(pCxt, yymsp[-2].minor.yy616, DB_OPTION_STRICT, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy616 = yylhsminor.yy616; +{ yylhsminor.yy160 = setDatabaseOption(pCxt, yymsp[-2].minor.yy160, DB_OPTION_STRICT, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy160 = yylhsminor.yy160; break; case 89: /* db_options ::= db_options WAL NK_INTEGER */ -{ yylhsminor.yy616 = setDatabaseOption(pCxt, yymsp[-2].minor.yy616, DB_OPTION_WAL, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy616 = yylhsminor.yy616; +{ yylhsminor.yy160 = setDatabaseOption(pCxt, yymsp[-2].minor.yy160, DB_OPTION_WAL, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy160 = yylhsminor.yy160; break; case 90: /* db_options ::= db_options VGROUPS NK_INTEGER */ -{ yylhsminor.yy616 = setDatabaseOption(pCxt, yymsp[-2].minor.yy616, DB_OPTION_VGROUPS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy616 = yylhsminor.yy616; +{ yylhsminor.yy160 = setDatabaseOption(pCxt, yymsp[-2].minor.yy160, DB_OPTION_VGROUPS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy160 = yylhsminor.yy160; break; case 91: /* db_options ::= db_options SINGLE_STABLE NK_INTEGER */ -{ yylhsminor.yy616 = setDatabaseOption(pCxt, yymsp[-2].minor.yy616, DB_OPTION_SINGLE_STABLE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy616 = yylhsminor.yy616; +{ yylhsminor.yy160 = setDatabaseOption(pCxt, yymsp[-2].minor.yy160, DB_OPTION_SINGLE_STABLE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy160 = yylhsminor.yy160; break; case 92: /* db_options ::= db_options RETENTIONS retention_list */ -{ yylhsminor.yy616 = setDatabaseOption(pCxt, yymsp[-2].minor.yy616, DB_OPTION_RETENTIONS, yymsp[0].minor.yy356); } - yymsp[-2].minor.yy616 = yylhsminor.yy616; +{ yylhsminor.yy160 = setDatabaseOption(pCxt, yymsp[-2].minor.yy160, DB_OPTION_RETENTIONS, yymsp[0].minor.yy180); } + yymsp[-2].minor.yy160 = yylhsminor.yy160; break; case 93: /* db_options ::= db_options SCHEMALESS NK_INTEGER */ -{ yylhsminor.yy616 = setDatabaseOption(pCxt, yymsp[-2].minor.yy616, DB_OPTION_SCHEMALESS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy616 = yylhsminor.yy616; - break; - case 94: /* alter_db_options ::= alter_db_option */ -{ yylhsminor.yy616 = createAlterDatabaseOptions(pCxt); yylhsminor.yy616 = setAlterDatabaseOption(pCxt, yylhsminor.yy616, &yymsp[0].minor.yy409); } - yymsp[0].minor.yy616 = yylhsminor.yy616; - break; - case 95: /* alter_db_options ::= alter_db_options alter_db_option */ -{ yylhsminor.yy616 = setAlterDatabaseOption(pCxt, yymsp[-1].minor.yy616, &yymsp[0].minor.yy409); } - yymsp[-1].minor.yy616 = yylhsminor.yy616; - break; - case 96: /* alter_db_option ::= CACHEMODEL NK_STRING */ -{ yymsp[-1].minor.yy409.type = DB_OPTION_CACHEMODEL; yymsp[-1].minor.yy409.val = yymsp[0].minor.yy0; } - break; - case 97: /* alter_db_option ::= CACHESIZE NK_INTEGER */ -{ yymsp[-1].minor.yy409.type = DB_OPTION_CACHESIZE; yymsp[-1].minor.yy409.val = yymsp[0].minor.yy0; } - break; - case 98: /* alter_db_option ::= FSYNC NK_INTEGER */ -{ yymsp[-1].minor.yy409.type = DB_OPTION_FSYNC; yymsp[-1].minor.yy409.val = yymsp[0].minor.yy0; } - break; - case 99: /* alter_db_option ::= KEEP integer_list */ - case 100: /* alter_db_option ::= KEEP variable_list */ yytestcase(yyruleno==100); -{ yymsp[-1].minor.yy409.type = DB_OPTION_KEEP; yymsp[-1].minor.yy409.pList = yymsp[0].minor.yy356; } - break; - case 101: /* alter_db_option ::= WAL NK_INTEGER */ -{ yymsp[-1].minor.yy409.type = DB_OPTION_WAL; yymsp[-1].minor.yy409.val = yymsp[0].minor.yy0; } - break; - case 102: /* integer_list ::= NK_INTEGER */ -{ yylhsminor.yy356 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy356 = yylhsminor.yy356; - break; - case 103: /* integer_list ::= integer_list NK_COMMA NK_INTEGER */ - case 279: /* dnode_list ::= dnode_list DNODE NK_INTEGER */ yytestcase(yyruleno==279); -{ yylhsminor.yy356 = addNodeToList(pCxt, yymsp[-2].minor.yy356, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } - yymsp[-2].minor.yy356 = yylhsminor.yy356; - break; - case 104: /* variable_list ::= NK_VARIABLE */ -{ yylhsminor.yy356 = createNodeList(pCxt, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy356 = yylhsminor.yy356; - break; - case 105: /* variable_list ::= variable_list NK_COMMA NK_VARIABLE */ -{ yylhsminor.yy356 = addNodeToList(pCxt, yymsp[-2].minor.yy356, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[-2].minor.yy356 = yylhsminor.yy356; - break; - case 106: /* retention_list ::= retention */ - case 126: /* multi_create_clause ::= create_subtable_clause */ yytestcase(yyruleno==126); - case 129: /* multi_drop_clause ::= drop_table_clause */ yytestcase(yyruleno==129); - case 136: /* column_def_list ::= column_def */ yytestcase(yyruleno==136); - case 179: /* rollup_func_list ::= rollup_func_name */ yytestcase(yyruleno==179); - case 184: /* col_name_list ::= col_name */ yytestcase(yyruleno==184); - case 232: /* func_list ::= func */ yytestcase(yyruleno==232); - case 308: /* literal_list ::= signed_literal */ yytestcase(yyruleno==308); - case 371: /* other_para_list ::= star_func_para */ yytestcase(yyruleno==371); - case 425: /* select_list ::= select_item */ yytestcase(yyruleno==425); - case 479: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==479); -{ yylhsminor.yy356 = createNodeList(pCxt, yymsp[0].minor.yy616); } - yymsp[0].minor.yy356 = yylhsminor.yy356; - break; - case 107: /* retention_list ::= retention_list NK_COMMA retention */ - case 137: /* column_def_list ::= column_def_list NK_COMMA column_def */ yytestcase(yyruleno==137); - case 180: /* rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ yytestcase(yyruleno==180); - case 185: /* col_name_list ::= col_name_list NK_COMMA col_name */ yytestcase(yyruleno==185); - case 233: /* func_list ::= func_list NK_COMMA func */ yytestcase(yyruleno==233); - case 309: /* literal_list ::= literal_list NK_COMMA signed_literal */ yytestcase(yyruleno==309); - case 372: /* other_para_list ::= other_para_list NK_COMMA star_func_para */ yytestcase(yyruleno==372); - case 426: /* select_list ::= select_list NK_COMMA select_item */ yytestcase(yyruleno==426); - case 480: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==480); -{ yylhsminor.yy356 = addNodeToList(pCxt, yymsp[-2].minor.yy356, yymsp[0].minor.yy616); } - yymsp[-2].minor.yy356 = yylhsminor.yy356; - break; - case 108: /* retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */ -{ yylhsminor.yy616 = createNodeListNodeEx(pCxt, createDurationValueNode(pCxt, &yymsp[-2].minor.yy0), createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[-2].minor.yy616 = yylhsminor.yy616; - break; - case 109: /* cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ - case 111: /* cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ yytestcase(yyruleno==111); -{ pCxt->pRootNode = createCreateTableStmt(pCxt, yymsp[-6].minor.yy151, yymsp[-5].minor.yy616, yymsp[-3].minor.yy356, yymsp[-1].minor.yy356, yymsp[0].minor.yy616); } - break; - case 110: /* cmd ::= CREATE TABLE multi_create_clause */ -{ pCxt->pRootNode = createCreateMultiTableStmt(pCxt, yymsp[0].minor.yy356); } - break; - case 112: /* cmd ::= DROP TABLE multi_drop_clause */ -{ pCxt->pRootNode = createDropTableStmt(pCxt, yymsp[0].minor.yy356); } - break; - case 113: /* cmd ::= DROP STABLE exists_opt full_table_name */ -{ pCxt->pRootNode = createDropSuperTableStmt(pCxt, yymsp[-1].minor.yy151, yymsp[0].minor.yy616); } - break; - case 114: /* cmd ::= ALTER TABLE alter_table_clause */ - case 282: /* cmd ::= query_expression */ yytestcase(yyruleno==282); -{ pCxt->pRootNode = yymsp[0].minor.yy616; } - break; - case 115: /* cmd ::= ALTER STABLE alter_table_clause */ -{ pCxt->pRootNode = setAlterSuperTableType(yymsp[0].minor.yy616); } - break; - case 116: /* alter_table_clause ::= full_table_name alter_table_options */ -{ yylhsminor.yy616 = createAlterTableModifyOptions(pCxt, yymsp[-1].minor.yy616, yymsp[0].minor.yy616); } - yymsp[-1].minor.yy616 = yylhsminor.yy616; - break; - case 117: /* alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ -{ yylhsminor.yy616 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy616, TSDB_ALTER_TABLE_ADD_COLUMN, &yymsp[-1].minor.yy361, yymsp[0].minor.yy600); } - yymsp[-4].minor.yy616 = yylhsminor.yy616; - break; - case 118: /* alter_table_clause ::= full_table_name DROP COLUMN column_name */ -{ yylhsminor.yy616 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy616, TSDB_ALTER_TABLE_DROP_COLUMN, &yymsp[0].minor.yy361); } - yymsp[-3].minor.yy616 = yylhsminor.yy616; - break; - case 119: /* alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ -{ yylhsminor.yy616 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy616, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, &yymsp[-1].minor.yy361, yymsp[0].minor.yy600); } - yymsp[-4].minor.yy616 = yylhsminor.yy616; +{ yylhsminor.yy160 = setDatabaseOption(pCxt, yymsp[-2].minor.yy160, DB_OPTION_SCHEMALESS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy160 = yylhsminor.yy160; + break; + case 94: /* db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER */ +{ yylhsminor.yy160 = setDatabaseOption(pCxt, yymsp[-2].minor.yy160, DB_OPTION_WAL_RETENTION_PERIOD, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy160 = yylhsminor.yy160; + break; + case 95: /* 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.yy160 = setDatabaseOption(pCxt, yymsp[-3].minor.yy160, DB_OPTION_WAL_RETENTION_PERIOD, &t); + } + yymsp[-3].minor.yy160 = yylhsminor.yy160; + break; + case 96: /* db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER */ +{ yylhsminor.yy160 = setDatabaseOption(pCxt, yymsp[-2].minor.yy160, DB_OPTION_WAL_RETENTION_SIZE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy160 = yylhsminor.yy160; + break; + case 97: /* 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.yy160 = setDatabaseOption(pCxt, yymsp[-3].minor.yy160, DB_OPTION_WAL_RETENTION_SIZE, &t); + } + yymsp[-3].minor.yy160 = yylhsminor.yy160; + break; + case 98: /* db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER */ +{ yylhsminor.yy160 = setDatabaseOption(pCxt, yymsp[-2].minor.yy160, DB_OPTION_WAL_ROLL_PERIOD, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy160 = yylhsminor.yy160; + break; + case 99: /* db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER */ +{ yylhsminor.yy160 = setDatabaseOption(pCxt, yymsp[-2].minor.yy160, DB_OPTION_WAL_SEGMENT_SIZE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy160 = yylhsminor.yy160; + break; + case 100: /* alter_db_options ::= alter_db_option */ +{ yylhsminor.yy160 = createAlterDatabaseOptions(pCxt); yylhsminor.yy160 = setAlterDatabaseOption(pCxt, yylhsminor.yy160, &yymsp[0].minor.yy189); } + yymsp[0].minor.yy160 = yylhsminor.yy160; + break; + case 101: /* alter_db_options ::= alter_db_options alter_db_option */ +{ yylhsminor.yy160 = setAlterDatabaseOption(pCxt, yymsp[-1].minor.yy160, &yymsp[0].minor.yy189); } + yymsp[-1].minor.yy160 = yylhsminor.yy160; + break; + case 102: /* alter_db_option ::= CACHEMODEL NK_STRING */ +{ yymsp[-1].minor.yy189.type = DB_OPTION_CACHEMODEL; yymsp[-1].minor.yy189.val = yymsp[0].minor.yy0; } + break; + case 103: /* alter_db_option ::= CACHESIZE NK_INTEGER */ +{ yymsp[-1].minor.yy189.type = DB_OPTION_CACHESIZE; yymsp[-1].minor.yy189.val = yymsp[0].minor.yy0; } + break; + case 104: /* alter_db_option ::= FSYNC NK_INTEGER */ +{ yymsp[-1].minor.yy189.type = DB_OPTION_FSYNC; yymsp[-1].minor.yy189.val = yymsp[0].minor.yy0; } + break; + case 105: /* alter_db_option ::= KEEP integer_list */ + case 106: /* alter_db_option ::= KEEP variable_list */ yytestcase(yyruleno==106); +{ yymsp[-1].minor.yy189.type = DB_OPTION_KEEP; yymsp[-1].minor.yy189.pList = yymsp[0].minor.yy180; } + break; + case 107: /* alter_db_option ::= WAL NK_INTEGER */ +{ yymsp[-1].minor.yy189.type = DB_OPTION_WAL; yymsp[-1].minor.yy189.val = yymsp[0].minor.yy0; } + break; + case 108: /* integer_list ::= NK_INTEGER */ +{ yylhsminor.yy180 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy180 = yylhsminor.yy180; + break; + case 109: /* integer_list ::= integer_list NK_COMMA NK_INTEGER */ + case 285: /* dnode_list ::= dnode_list DNODE NK_INTEGER */ yytestcase(yyruleno==285); +{ yylhsminor.yy180 = addNodeToList(pCxt, yymsp[-2].minor.yy180, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } + yymsp[-2].minor.yy180 = yylhsminor.yy180; + break; + case 110: /* variable_list ::= NK_VARIABLE */ +{ yylhsminor.yy180 = createNodeList(pCxt, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy180 = yylhsminor.yy180; + break; + case 111: /* variable_list ::= variable_list NK_COMMA NK_VARIABLE */ +{ yylhsminor.yy180 = addNodeToList(pCxt, yymsp[-2].minor.yy180, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[-2].minor.yy180 = yylhsminor.yy180; + break; + case 112: /* retention_list ::= retention */ + case 132: /* multi_create_clause ::= create_subtable_clause */ yytestcase(yyruleno==132); + case 135: /* multi_drop_clause ::= drop_table_clause */ yytestcase(yyruleno==135); + case 142: /* column_def_list ::= column_def */ yytestcase(yyruleno==142); + case 185: /* rollup_func_list ::= rollup_func_name */ yytestcase(yyruleno==185); + case 190: /* col_name_list ::= col_name */ yytestcase(yyruleno==190); + case 238: /* func_list ::= func */ yytestcase(yyruleno==238); + case 314: /* literal_list ::= signed_literal */ yytestcase(yyruleno==314); + case 377: /* other_para_list ::= star_func_para */ yytestcase(yyruleno==377); + case 431: /* select_list ::= select_item */ yytestcase(yyruleno==431); + case 485: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==485); +{ yylhsminor.yy180 = createNodeList(pCxt, yymsp[0].minor.yy160); } + yymsp[0].minor.yy180 = yylhsminor.yy180; + break; + case 113: /* retention_list ::= retention_list NK_COMMA retention */ + case 143: /* column_def_list ::= column_def_list NK_COMMA column_def */ yytestcase(yyruleno==143); + case 186: /* rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ yytestcase(yyruleno==186); + case 191: /* col_name_list ::= col_name_list NK_COMMA col_name */ yytestcase(yyruleno==191); + case 239: /* func_list ::= func_list NK_COMMA func */ yytestcase(yyruleno==239); + case 315: /* literal_list ::= literal_list NK_COMMA signed_literal */ yytestcase(yyruleno==315); + case 378: /* other_para_list ::= other_para_list NK_COMMA star_func_para */ yytestcase(yyruleno==378); + case 432: /* select_list ::= select_list NK_COMMA select_item */ yytestcase(yyruleno==432); + case 486: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==486); +{ yylhsminor.yy180 = addNodeToList(pCxt, yymsp[-2].minor.yy180, yymsp[0].minor.yy160); } + yymsp[-2].minor.yy180 = yylhsminor.yy180; + break; + case 114: /* retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */ +{ yylhsminor.yy160 = createNodeListNodeEx(pCxt, createDurationValueNode(pCxt, &yymsp[-2].minor.yy0), createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[-2].minor.yy160 = yylhsminor.yy160; + break; + case 115: /* cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ + case 117: /* cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ yytestcase(yyruleno==117); +{ pCxt->pRootNode = createCreateTableStmt(pCxt, yymsp[-6].minor.yy611, yymsp[-5].minor.yy160, yymsp[-3].minor.yy180, yymsp[-1].minor.yy180, yymsp[0].minor.yy160); } + break; + case 116: /* cmd ::= CREATE TABLE multi_create_clause */ +{ pCxt->pRootNode = createCreateMultiTableStmt(pCxt, yymsp[0].minor.yy180); } + break; + case 118: /* cmd ::= DROP TABLE multi_drop_clause */ +{ pCxt->pRootNode = createDropTableStmt(pCxt, yymsp[0].minor.yy180); } + break; + case 119: /* cmd ::= DROP STABLE exists_opt full_table_name */ +{ pCxt->pRootNode = createDropSuperTableStmt(pCxt, yymsp[-1].minor.yy611, yymsp[0].minor.yy160); } + break; + case 120: /* cmd ::= ALTER TABLE alter_table_clause */ + case 288: /* cmd ::= query_expression */ yytestcase(yyruleno==288); +{ pCxt->pRootNode = yymsp[0].minor.yy160; } + break; + case 121: /* cmd ::= ALTER STABLE alter_table_clause */ +{ pCxt->pRootNode = setAlterSuperTableType(yymsp[0].minor.yy160); } + break; + case 122: /* alter_table_clause ::= full_table_name alter_table_options */ +{ yylhsminor.yy160 = createAlterTableModifyOptions(pCxt, yymsp[-1].minor.yy160, yymsp[0].minor.yy160); } + yymsp[-1].minor.yy160 = yylhsminor.yy160; + break; + case 123: /* alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ +{ yylhsminor.yy160 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy160, TSDB_ALTER_TABLE_ADD_COLUMN, &yymsp[-1].minor.yy231, yymsp[0].minor.yy190); } + yymsp[-4].minor.yy160 = yylhsminor.yy160; + break; + case 124: /* alter_table_clause ::= full_table_name DROP COLUMN column_name */ +{ yylhsminor.yy160 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy160, TSDB_ALTER_TABLE_DROP_COLUMN, &yymsp[0].minor.yy231); } + yymsp[-3].minor.yy160 = yylhsminor.yy160; + break; + case 125: /* alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ +{ yylhsminor.yy160 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy160, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, &yymsp[-1].minor.yy231, yymsp[0].minor.yy190); } + yymsp[-4].minor.yy160 = yylhsminor.yy160; break; - case 120: /* alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ -{ yylhsminor.yy616 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy616, TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, &yymsp[-1].minor.yy361, &yymsp[0].minor.yy361); } - yymsp[-4].minor.yy616 = yylhsminor.yy616; + case 126: /* alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ +{ yylhsminor.yy160 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy160, TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, &yymsp[-1].minor.yy231, &yymsp[0].minor.yy231); } + yymsp[-4].minor.yy160 = yylhsminor.yy160; break; - case 121: /* alter_table_clause ::= full_table_name ADD TAG column_name type_name */ -{ yylhsminor.yy616 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy616, TSDB_ALTER_TABLE_ADD_TAG, &yymsp[-1].minor.yy361, yymsp[0].minor.yy600); } - yymsp[-4].minor.yy616 = yylhsminor.yy616; - break; - case 122: /* alter_table_clause ::= full_table_name DROP TAG column_name */ -{ yylhsminor.yy616 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy616, TSDB_ALTER_TABLE_DROP_TAG, &yymsp[0].minor.yy361); } - yymsp[-3].minor.yy616 = yylhsminor.yy616; + case 127: /* alter_table_clause ::= full_table_name ADD TAG column_name type_name */ +{ yylhsminor.yy160 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy160, TSDB_ALTER_TABLE_ADD_TAG, &yymsp[-1].minor.yy231, yymsp[0].minor.yy190); } + yymsp[-4].minor.yy160 = yylhsminor.yy160; + break; + case 128: /* alter_table_clause ::= full_table_name DROP TAG column_name */ +{ yylhsminor.yy160 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy160, TSDB_ALTER_TABLE_DROP_TAG, &yymsp[0].minor.yy231); } + yymsp[-3].minor.yy160 = yylhsminor.yy160; break; - case 123: /* alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ -{ yylhsminor.yy616 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy616, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, &yymsp[-1].minor.yy361, yymsp[0].minor.yy600); } - yymsp[-4].minor.yy616 = yylhsminor.yy616; + case 129: /* alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ +{ yylhsminor.yy160 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy160, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, &yymsp[-1].minor.yy231, yymsp[0].minor.yy190); } + yymsp[-4].minor.yy160 = yylhsminor.yy160; break; - case 124: /* alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ -{ yylhsminor.yy616 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy616, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &yymsp[-1].minor.yy361, &yymsp[0].minor.yy361); } - yymsp[-4].minor.yy616 = yylhsminor.yy616; + case 130: /* alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ +{ yylhsminor.yy160 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy160, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &yymsp[-1].minor.yy231, &yymsp[0].minor.yy231); } + yymsp[-4].minor.yy160 = yylhsminor.yy160; break; - case 125: /* alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */ -{ yylhsminor.yy616 = createAlterTableSetTag(pCxt, yymsp[-5].minor.yy616, &yymsp[-2].minor.yy361, yymsp[0].minor.yy616); } - yymsp[-5].minor.yy616 = yylhsminor.yy616; + case 131: /* alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */ +{ yylhsminor.yy160 = createAlterTableSetTag(pCxt, yymsp[-5].minor.yy160, &yymsp[-2].minor.yy231, yymsp[0].minor.yy160); } + yymsp[-5].minor.yy160 = yylhsminor.yy160; break; - case 127: /* multi_create_clause ::= multi_create_clause create_subtable_clause */ - case 130: /* multi_drop_clause ::= multi_drop_clause drop_table_clause */ yytestcase(yyruleno==130); -{ yylhsminor.yy356 = addNodeToList(pCxt, yymsp[-1].minor.yy356, yymsp[0].minor.yy616); } - yymsp[-1].minor.yy356 = yylhsminor.yy356; + case 133: /* multi_create_clause ::= multi_create_clause create_subtable_clause */ + case 136: /* multi_drop_clause ::= multi_drop_clause drop_table_clause */ yytestcase(yyruleno==136); +{ yylhsminor.yy180 = addNodeToList(pCxt, yymsp[-1].minor.yy180, yymsp[0].minor.yy160); } + yymsp[-1].minor.yy180 = yylhsminor.yy180; break; - case 128: /* 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.yy616 = createCreateSubTableClause(pCxt, yymsp[-9].minor.yy151, yymsp[-8].minor.yy616, yymsp[-6].minor.yy616, yymsp[-5].minor.yy356, yymsp[-2].minor.yy356, yymsp[0].minor.yy616); } - yymsp[-9].minor.yy616 = yylhsminor.yy616; + case 134: /* 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.yy160 = createCreateSubTableClause(pCxt, yymsp[-9].minor.yy611, yymsp[-8].minor.yy160, yymsp[-6].minor.yy160, yymsp[-5].minor.yy180, yymsp[-2].minor.yy180, yymsp[0].minor.yy160); } + yymsp[-9].minor.yy160 = yylhsminor.yy160; break; - case 131: /* drop_table_clause ::= exists_opt full_table_name */ -{ yylhsminor.yy616 = createDropTableClause(pCxt, yymsp[-1].minor.yy151, yymsp[0].minor.yy616); } - yymsp[-1].minor.yy616 = yylhsminor.yy616; + case 137: /* drop_table_clause ::= exists_opt full_table_name */ +{ yylhsminor.yy160 = createDropTableClause(pCxt, yymsp[-1].minor.yy611, yymsp[0].minor.yy160); } + yymsp[-1].minor.yy160 = yylhsminor.yy160; break; - case 132: /* specific_cols_opt ::= */ - case 163: /* tags_def_opt ::= */ yytestcase(yyruleno==163); - case 434: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==434); - case 451: /* group_by_clause_opt ::= */ yytestcase(yyruleno==451); - case 467: /* order_by_clause_opt ::= */ yytestcase(yyruleno==467); -{ yymsp[1].minor.yy356 = NULL; } + case 138: /* specific_cols_opt ::= */ + case 169: /* tags_def_opt ::= */ yytestcase(yyruleno==169); + case 440: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==440); + case 457: /* group_by_clause_opt ::= */ yytestcase(yyruleno==457); + case 473: /* order_by_clause_opt ::= */ yytestcase(yyruleno==473); +{ yymsp[1].minor.yy180 = NULL; } break; - case 133: /* specific_cols_opt ::= NK_LP col_name_list NK_RP */ -{ yymsp[-2].minor.yy356 = yymsp[-1].minor.yy356; } + case 139: /* specific_cols_opt ::= NK_LP col_name_list NK_RP */ +{ yymsp[-2].minor.yy180 = yymsp[-1].minor.yy180; } break; - case 134: /* full_table_name ::= table_name */ -{ yylhsminor.yy616 = createRealTableNode(pCxt, NULL, &yymsp[0].minor.yy361, NULL); } - yymsp[0].minor.yy616 = yylhsminor.yy616; + case 140: /* full_table_name ::= table_name */ +{ yylhsminor.yy160 = createRealTableNode(pCxt, NULL, &yymsp[0].minor.yy231, NULL); } + yymsp[0].minor.yy160 = yylhsminor.yy160; break; - case 135: /* full_table_name ::= db_name NK_DOT table_name */ -{ yylhsminor.yy616 = createRealTableNode(pCxt, &yymsp[-2].minor.yy361, &yymsp[0].minor.yy361, NULL); } - yymsp[-2].minor.yy616 = yylhsminor.yy616; + case 141: /* full_table_name ::= db_name NK_DOT table_name */ +{ yylhsminor.yy160 = createRealTableNode(pCxt, &yymsp[-2].minor.yy231, &yymsp[0].minor.yy231, NULL); } + yymsp[-2].minor.yy160 = yylhsminor.yy160; break; - case 138: /* column_def ::= column_name type_name */ -{ yylhsminor.yy616 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy361, yymsp[0].minor.yy600, NULL); } - yymsp[-1].minor.yy616 = yylhsminor.yy616; + case 144: /* column_def ::= column_name type_name */ +{ yylhsminor.yy160 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy231, yymsp[0].minor.yy190, NULL); } + yymsp[-1].minor.yy160 = yylhsminor.yy160; break; - case 139: /* column_def ::= column_name type_name COMMENT NK_STRING */ -{ yylhsminor.yy616 = createColumnDefNode(pCxt, &yymsp[-3].minor.yy361, yymsp[-2].minor.yy600, &yymsp[0].minor.yy0); } - yymsp[-3].minor.yy616 = yylhsminor.yy616; + case 145: /* column_def ::= column_name type_name COMMENT NK_STRING */ +{ yylhsminor.yy160 = createColumnDefNode(pCxt, &yymsp[-3].minor.yy231, yymsp[-2].minor.yy190, &yymsp[0].minor.yy0); } + yymsp[-3].minor.yy160 = yylhsminor.yy160; break; - case 140: /* type_name ::= BOOL */ -{ yymsp[0].minor.yy600 = createDataType(TSDB_DATA_TYPE_BOOL); } + case 146: /* type_name ::= BOOL */ +{ yymsp[0].minor.yy190 = createDataType(TSDB_DATA_TYPE_BOOL); } break; - case 141: /* type_name ::= TINYINT */ -{ yymsp[0].minor.yy600 = createDataType(TSDB_DATA_TYPE_TINYINT); } + case 147: /* type_name ::= TINYINT */ +{ yymsp[0].minor.yy190 = createDataType(TSDB_DATA_TYPE_TINYINT); } break; - case 142: /* type_name ::= SMALLINT */ -{ yymsp[0].minor.yy600 = createDataType(TSDB_DATA_TYPE_SMALLINT); } + case 148: /* type_name ::= SMALLINT */ +{ yymsp[0].minor.yy190 = createDataType(TSDB_DATA_TYPE_SMALLINT); } break; - case 143: /* type_name ::= INT */ - case 144: /* type_name ::= INTEGER */ yytestcase(yyruleno==144); -{ yymsp[0].minor.yy600 = createDataType(TSDB_DATA_TYPE_INT); } + case 149: /* type_name ::= INT */ + case 150: /* type_name ::= INTEGER */ yytestcase(yyruleno==150); +{ yymsp[0].minor.yy190 = createDataType(TSDB_DATA_TYPE_INT); } break; - case 145: /* type_name ::= BIGINT */ -{ yymsp[0].minor.yy600 = createDataType(TSDB_DATA_TYPE_BIGINT); } + case 151: /* type_name ::= BIGINT */ +{ yymsp[0].minor.yy190 = createDataType(TSDB_DATA_TYPE_BIGINT); } break; - case 146: /* type_name ::= FLOAT */ -{ yymsp[0].minor.yy600 = createDataType(TSDB_DATA_TYPE_FLOAT); } + case 152: /* type_name ::= FLOAT */ +{ yymsp[0].minor.yy190 = createDataType(TSDB_DATA_TYPE_FLOAT); } break; - case 147: /* type_name ::= DOUBLE */ -{ yymsp[0].minor.yy600 = createDataType(TSDB_DATA_TYPE_DOUBLE); } + case 153: /* type_name ::= DOUBLE */ +{ yymsp[0].minor.yy190 = createDataType(TSDB_DATA_TYPE_DOUBLE); } break; - case 148: /* type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy600 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); } + case 154: /* type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ +{ yymsp[-3].minor.yy190 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); } break; - case 149: /* type_name ::= TIMESTAMP */ -{ yymsp[0].minor.yy600 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); } + case 155: /* type_name ::= TIMESTAMP */ +{ yymsp[0].minor.yy190 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); } break; - case 150: /* type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy600 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); } + case 156: /* type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ +{ yymsp[-3].minor.yy190 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); } break; - case 151: /* type_name ::= TINYINT UNSIGNED */ -{ yymsp[-1].minor.yy600 = createDataType(TSDB_DATA_TYPE_UTINYINT); } + case 157: /* type_name ::= TINYINT UNSIGNED */ +{ yymsp[-1].minor.yy190 = createDataType(TSDB_DATA_TYPE_UTINYINT); } break; - case 152: /* type_name ::= SMALLINT UNSIGNED */ -{ yymsp[-1].minor.yy600 = createDataType(TSDB_DATA_TYPE_USMALLINT); } + case 158: /* type_name ::= SMALLINT UNSIGNED */ +{ yymsp[-1].minor.yy190 = createDataType(TSDB_DATA_TYPE_USMALLINT); } break; - case 153: /* type_name ::= INT UNSIGNED */ -{ yymsp[-1].minor.yy600 = createDataType(TSDB_DATA_TYPE_UINT); } + case 159: /* type_name ::= INT UNSIGNED */ +{ yymsp[-1].minor.yy190 = createDataType(TSDB_DATA_TYPE_UINT); } break; - case 154: /* type_name ::= BIGINT UNSIGNED */ -{ yymsp[-1].minor.yy600 = createDataType(TSDB_DATA_TYPE_UBIGINT); } + case 160: /* type_name ::= BIGINT UNSIGNED */ +{ yymsp[-1].minor.yy190 = createDataType(TSDB_DATA_TYPE_UBIGINT); } break; - case 155: /* type_name ::= JSON */ -{ yymsp[0].minor.yy600 = createDataType(TSDB_DATA_TYPE_JSON); } + case 161: /* type_name ::= JSON */ +{ yymsp[0].minor.yy190 = createDataType(TSDB_DATA_TYPE_JSON); } break; - case 156: /* type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy600 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); } + case 162: /* type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ +{ yymsp[-3].minor.yy190 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); } break; - case 157: /* type_name ::= MEDIUMBLOB */ -{ yymsp[0].minor.yy600 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); } + case 163: /* type_name ::= MEDIUMBLOB */ +{ yymsp[0].minor.yy190 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); } break; - case 158: /* type_name ::= BLOB */ -{ yymsp[0].minor.yy600 = createDataType(TSDB_DATA_TYPE_BLOB); } + case 164: /* type_name ::= BLOB */ +{ yymsp[0].minor.yy190 = createDataType(TSDB_DATA_TYPE_BLOB); } break; - case 159: /* type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy600 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &yymsp[-1].minor.yy0); } + case 165: /* type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ +{ yymsp[-3].minor.yy190 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &yymsp[-1].minor.yy0); } break; - case 160: /* type_name ::= DECIMAL */ -{ yymsp[0].minor.yy600 = createDataType(TSDB_DATA_TYPE_DECIMAL); } + case 166: /* type_name ::= DECIMAL */ +{ yymsp[0].minor.yy190 = createDataType(TSDB_DATA_TYPE_DECIMAL); } break; - case 161: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy600 = createDataType(TSDB_DATA_TYPE_DECIMAL); } + case 167: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ +{ yymsp[-3].minor.yy190 = createDataType(TSDB_DATA_TYPE_DECIMAL); } break; - case 162: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ -{ yymsp[-5].minor.yy600 = createDataType(TSDB_DATA_TYPE_DECIMAL); } + case 168: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ +{ yymsp[-5].minor.yy190 = createDataType(TSDB_DATA_TYPE_DECIMAL); } break; - case 164: /* tags_def_opt ::= tags_def */ - case 370: /* star_func_para_list ::= other_para_list */ yytestcase(yyruleno==370); -{ yylhsminor.yy356 = yymsp[0].minor.yy356; } - yymsp[0].minor.yy356 = yylhsminor.yy356; + case 170: /* tags_def_opt ::= tags_def */ + case 376: /* star_func_para_list ::= other_para_list */ yytestcase(yyruleno==376); +{ yylhsminor.yy180 = yymsp[0].minor.yy180; } + yymsp[0].minor.yy180 = yylhsminor.yy180; break; - case 165: /* tags_def ::= TAGS NK_LP column_def_list NK_RP */ -{ yymsp[-3].minor.yy356 = yymsp[-1].minor.yy356; } + case 171: /* tags_def ::= TAGS NK_LP column_def_list NK_RP */ +{ yymsp[-3].minor.yy180 = yymsp[-1].minor.yy180; } break; - case 166: /* table_options ::= */ -{ yymsp[1].minor.yy616 = createDefaultTableOptions(pCxt); } + case 172: /* table_options ::= */ +{ yymsp[1].minor.yy160 = createDefaultTableOptions(pCxt); } break; - case 167: /* table_options ::= table_options COMMENT NK_STRING */ -{ yylhsminor.yy616 = setTableOption(pCxt, yymsp[-2].minor.yy616, TABLE_OPTION_COMMENT, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy616 = yylhsminor.yy616; + case 173: /* table_options ::= table_options COMMENT NK_STRING */ +{ yylhsminor.yy160 = setTableOption(pCxt, yymsp[-2].minor.yy160, TABLE_OPTION_COMMENT, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy160 = yylhsminor.yy160; break; - case 168: /* table_options ::= table_options MAX_DELAY duration_list */ -{ yylhsminor.yy616 = setTableOption(pCxt, yymsp[-2].minor.yy616, TABLE_OPTION_MAXDELAY, yymsp[0].minor.yy356); } - yymsp[-2].minor.yy616 = yylhsminor.yy616; + case 174: /* table_options ::= table_options MAX_DELAY duration_list */ +{ yylhsminor.yy160 = setTableOption(pCxt, yymsp[-2].minor.yy160, TABLE_OPTION_MAXDELAY, yymsp[0].minor.yy180); } + yymsp[-2].minor.yy160 = yylhsminor.yy160; break; - case 169: /* table_options ::= table_options WATERMARK duration_list */ -{ yylhsminor.yy616 = setTableOption(pCxt, yymsp[-2].minor.yy616, TABLE_OPTION_WATERMARK, yymsp[0].minor.yy356); } - yymsp[-2].minor.yy616 = yylhsminor.yy616; + case 175: /* table_options ::= table_options WATERMARK duration_list */ +{ yylhsminor.yy160 = setTableOption(pCxt, yymsp[-2].minor.yy160, TABLE_OPTION_WATERMARK, yymsp[0].minor.yy180); } + yymsp[-2].minor.yy160 = yylhsminor.yy160; break; - case 170: /* table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ -{ yylhsminor.yy616 = setTableOption(pCxt, yymsp[-4].minor.yy616, TABLE_OPTION_ROLLUP, yymsp[-1].minor.yy356); } - yymsp[-4].minor.yy616 = yylhsminor.yy616; + case 176: /* table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ +{ yylhsminor.yy160 = setTableOption(pCxt, yymsp[-4].minor.yy160, TABLE_OPTION_ROLLUP, yymsp[-1].minor.yy180); } + yymsp[-4].minor.yy160 = yylhsminor.yy160; break; - case 171: /* table_options ::= table_options TTL NK_INTEGER */ -{ yylhsminor.yy616 = setTableOption(pCxt, yymsp[-2].minor.yy616, TABLE_OPTION_TTL, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy616 = yylhsminor.yy616; + case 177: /* table_options ::= table_options TTL NK_INTEGER */ +{ yylhsminor.yy160 = setTableOption(pCxt, yymsp[-2].minor.yy160, TABLE_OPTION_TTL, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy160 = yylhsminor.yy160; break; - case 172: /* table_options ::= table_options SMA NK_LP col_name_list NK_RP */ -{ yylhsminor.yy616 = setTableOption(pCxt, yymsp[-4].minor.yy616, TABLE_OPTION_SMA, yymsp[-1].minor.yy356); } - yymsp[-4].minor.yy616 = yylhsminor.yy616; + case 178: /* table_options ::= table_options SMA NK_LP col_name_list NK_RP */ +{ yylhsminor.yy160 = setTableOption(pCxt, yymsp[-4].minor.yy160, TABLE_OPTION_SMA, yymsp[-1].minor.yy180); } + yymsp[-4].minor.yy160 = yylhsminor.yy160; break; - case 173: /* alter_table_options ::= alter_table_option */ -{ yylhsminor.yy616 = createAlterTableOptions(pCxt); yylhsminor.yy616 = setTableOption(pCxt, yylhsminor.yy616, yymsp[0].minor.yy409.type, &yymsp[0].minor.yy409.val); } - yymsp[0].minor.yy616 = yylhsminor.yy616; + case 179: /* alter_table_options ::= alter_table_option */ +{ yylhsminor.yy160 = createAlterTableOptions(pCxt); yylhsminor.yy160 = setTableOption(pCxt, yylhsminor.yy160, yymsp[0].minor.yy189.type, &yymsp[0].minor.yy189.val); } + yymsp[0].minor.yy160 = yylhsminor.yy160; break; - case 174: /* alter_table_options ::= alter_table_options alter_table_option */ -{ yylhsminor.yy616 = setTableOption(pCxt, yymsp[-1].minor.yy616, yymsp[0].minor.yy409.type, &yymsp[0].minor.yy409.val); } - yymsp[-1].minor.yy616 = yylhsminor.yy616; + case 180: /* alter_table_options ::= alter_table_options alter_table_option */ +{ yylhsminor.yy160 = setTableOption(pCxt, yymsp[-1].minor.yy160, yymsp[0].minor.yy189.type, &yymsp[0].minor.yy189.val); } + yymsp[-1].minor.yy160 = yylhsminor.yy160; break; - case 175: /* alter_table_option ::= COMMENT NK_STRING */ -{ yymsp[-1].minor.yy409.type = TABLE_OPTION_COMMENT; yymsp[-1].minor.yy409.val = yymsp[0].minor.yy0; } + case 181: /* alter_table_option ::= COMMENT NK_STRING */ +{ yymsp[-1].minor.yy189.type = TABLE_OPTION_COMMENT; yymsp[-1].minor.yy189.val = yymsp[0].minor.yy0; } break; - case 176: /* alter_table_option ::= TTL NK_INTEGER */ -{ yymsp[-1].minor.yy409.type = TABLE_OPTION_TTL; yymsp[-1].minor.yy409.val = yymsp[0].minor.yy0; } + case 182: /* alter_table_option ::= TTL NK_INTEGER */ +{ yymsp[-1].minor.yy189.type = TABLE_OPTION_TTL; yymsp[-1].minor.yy189.val = yymsp[0].minor.yy0; } break; - case 177: /* duration_list ::= duration_literal */ - case 337: /* expression_list ::= expression */ yytestcase(yyruleno==337); -{ yylhsminor.yy356 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy616)); } - yymsp[0].minor.yy356 = yylhsminor.yy356; + case 183: /* duration_list ::= duration_literal */ + case 343: /* expression_list ::= expression */ yytestcase(yyruleno==343); +{ yylhsminor.yy180 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy160)); } + yymsp[0].minor.yy180 = yylhsminor.yy180; break; - case 178: /* duration_list ::= duration_list NK_COMMA duration_literal */ - case 338: /* expression_list ::= expression_list NK_COMMA expression */ yytestcase(yyruleno==338); -{ yylhsminor.yy356 = addNodeToList(pCxt, yymsp[-2].minor.yy356, releaseRawExprNode(pCxt, yymsp[0].minor.yy616)); } - yymsp[-2].minor.yy356 = yylhsminor.yy356; + case 184: /* duration_list ::= duration_list NK_COMMA duration_literal */ + case 344: /* expression_list ::= expression_list NK_COMMA expression */ yytestcase(yyruleno==344); +{ yylhsminor.yy180 = addNodeToList(pCxt, yymsp[-2].minor.yy180, releaseRawExprNode(pCxt, yymsp[0].minor.yy160)); } + yymsp[-2].minor.yy180 = yylhsminor.yy180; break; - case 181: /* rollup_func_name ::= function_name */ -{ yylhsminor.yy616 = createFunctionNode(pCxt, &yymsp[0].minor.yy361, NULL); } - yymsp[0].minor.yy616 = yylhsminor.yy616; + case 187: /* rollup_func_name ::= function_name */ +{ yylhsminor.yy160 = createFunctionNode(pCxt, &yymsp[0].minor.yy231, NULL); } + yymsp[0].minor.yy160 = yylhsminor.yy160; break; - case 182: /* rollup_func_name ::= FIRST */ - case 183: /* rollup_func_name ::= LAST */ yytestcase(yyruleno==183); -{ yylhsminor.yy616 = createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL); } - yymsp[0].minor.yy616 = yylhsminor.yy616; + case 188: /* rollup_func_name ::= FIRST */ + case 189: /* rollup_func_name ::= LAST */ yytestcase(yyruleno==189); +{ yylhsminor.yy160 = createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL); } + yymsp[0].minor.yy160 = yylhsminor.yy160; break; - case 186: /* col_name ::= column_name */ -{ yylhsminor.yy616 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy361); } - yymsp[0].minor.yy616 = yylhsminor.yy616; + case 192: /* col_name ::= column_name */ +{ yylhsminor.yy160 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy231); } + yymsp[0].minor.yy160 = yylhsminor.yy160; break; - case 187: /* cmd ::= SHOW DNODES */ + case 193: /* cmd ::= SHOW DNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DNODES_STMT); } break; - case 188: /* cmd ::= SHOW USERS */ + case 194: /* cmd ::= SHOW USERS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_USERS_STMT); } break; - case 189: /* cmd ::= SHOW DATABASES */ + case 195: /* cmd ::= SHOW DATABASES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DATABASES_STMT); } break; - case 190: /* cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */ -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TABLES_STMT, yymsp[-2].minor.yy616, yymsp[0].minor.yy616, OP_TYPE_LIKE); } + case 196: /* cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */ +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TABLES_STMT, yymsp[-2].minor.yy160, yymsp[0].minor.yy160, OP_TYPE_LIKE); } break; - case 191: /* cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_STABLES_STMT, yymsp[-2].minor.yy616, yymsp[0].minor.yy616, OP_TYPE_LIKE); } + case 197: /* cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_STABLES_STMT, yymsp[-2].minor.yy160, yymsp[0].minor.yy160, OP_TYPE_LIKE); } break; - case 192: /* cmd ::= SHOW db_name_cond_opt VGROUPS */ -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VGROUPS_STMT, yymsp[-1].minor.yy616, NULL, OP_TYPE_LIKE); } + case 198: /* cmd ::= SHOW db_name_cond_opt VGROUPS */ +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VGROUPS_STMT, yymsp[-1].minor.yy160, NULL, OP_TYPE_LIKE); } break; - case 193: /* cmd ::= SHOW MNODES */ + case 199: /* cmd ::= SHOW MNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_MNODES_STMT); } break; - case 194: /* cmd ::= SHOW MODULES */ + case 200: /* cmd ::= SHOW MODULES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_MODULES_STMT); } break; - case 195: /* cmd ::= SHOW QNODES */ + case 201: /* cmd ::= SHOW QNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_QNODES_STMT); } break; - case 196: /* cmd ::= SHOW FUNCTIONS */ + case 202: /* cmd ::= SHOW FUNCTIONS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_FUNCTIONS_STMT); } break; - case 197: /* cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, yymsp[0].minor.yy616, yymsp[-1].minor.yy616, OP_TYPE_EQUAL); } + case 203: /* cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, yymsp[0].minor.yy160, yymsp[-1].minor.yy160, OP_TYPE_EQUAL); } break; - case 198: /* cmd ::= SHOW STREAMS */ + case 204: /* cmd ::= SHOW STREAMS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_STREAMS_STMT); } break; - case 199: /* cmd ::= SHOW ACCOUNTS */ + case 205: /* cmd ::= SHOW ACCOUNTS */ { pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); } break; - case 200: /* cmd ::= SHOW APPS */ + case 206: /* cmd ::= SHOW APPS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_APPS_STMT); } break; - case 201: /* cmd ::= SHOW CONNECTIONS */ + case 207: /* cmd ::= SHOW CONNECTIONS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CONNECTIONS_STMT); } break; - case 202: /* cmd ::= SHOW LICENCE */ - case 203: /* cmd ::= SHOW GRANTS */ yytestcase(yyruleno==203); + case 208: /* cmd ::= SHOW LICENCE */ + case 209: /* cmd ::= SHOW GRANTS */ yytestcase(yyruleno==209); { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_LICENCE_STMT); } break; - case 204: /* cmd ::= SHOW CREATE DATABASE db_name */ -{ pCxt->pRootNode = createShowCreateDatabaseStmt(pCxt, &yymsp[0].minor.yy361); } + case 210: /* cmd ::= SHOW CREATE DATABASE db_name */ +{ pCxt->pRootNode = createShowCreateDatabaseStmt(pCxt, &yymsp[0].minor.yy231); } break; - case 205: /* cmd ::= SHOW CREATE TABLE full_table_name */ -{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_TABLE_STMT, yymsp[0].minor.yy616); } + case 211: /* cmd ::= SHOW CREATE TABLE full_table_name */ +{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_TABLE_STMT, yymsp[0].minor.yy160); } break; - case 206: /* cmd ::= SHOW CREATE STABLE full_table_name */ -{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_STABLE_STMT, yymsp[0].minor.yy616); } + case 212: /* cmd ::= SHOW CREATE STABLE full_table_name */ +{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_STABLE_STMT, yymsp[0].minor.yy160); } break; - case 207: /* cmd ::= SHOW QUERIES */ + case 213: /* cmd ::= SHOW QUERIES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_QUERIES_STMT); } break; - case 208: /* cmd ::= SHOW SCORES */ + case 214: /* cmd ::= SHOW SCORES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SCORES_STMT); } break; - case 209: /* cmd ::= SHOW TOPICS */ + case 215: /* cmd ::= SHOW TOPICS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TOPICS_STMT); } break; - case 210: /* cmd ::= SHOW VARIABLES */ + case 216: /* cmd ::= SHOW VARIABLES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_VARIABLES_STMT); } break; - case 211: /* cmd ::= SHOW LOCAL VARIABLES */ + case 217: /* cmd ::= SHOW LOCAL VARIABLES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_LOCAL_VARIABLES_STMT); } break; - case 212: /* cmd ::= SHOW DNODE NK_INTEGER VARIABLES */ + case 218: /* cmd ::= SHOW DNODE NK_INTEGER VARIABLES */ { pCxt->pRootNode = createShowDnodeVariablesStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[-1].minor.yy0)); } break; - case 213: /* cmd ::= SHOW BNODES */ + case 219: /* cmd ::= SHOW BNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_BNODES_STMT); } break; - case 214: /* cmd ::= SHOW SNODES */ + case 220: /* cmd ::= SHOW SNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SNODES_STMT); } break; - case 215: /* cmd ::= SHOW CLUSTER */ + case 221: /* cmd ::= SHOW CLUSTER */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CLUSTER_STMT); } break; - case 216: /* cmd ::= SHOW TRANSACTIONS */ + case 222: /* cmd ::= SHOW TRANSACTIONS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TRANSACTIONS_STMT); } break; - case 217: /* cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ -{ pCxt->pRootNode = createShowTableDistributedStmt(pCxt, yymsp[0].minor.yy616); } + case 223: /* cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ +{ pCxt->pRootNode = createShowTableDistributedStmt(pCxt, yymsp[0].minor.yy160); } break; - case 218: /* cmd ::= SHOW CONSUMERS */ + case 224: /* cmd ::= SHOW CONSUMERS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CONSUMERS_STMT); } break; - case 219: /* cmd ::= SHOW SUBSCRIPTIONS */ + case 225: /* cmd ::= SHOW SUBSCRIPTIONS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SUBSCRIPTIONS_STMT); } break; - case 220: /* cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */ -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, yymsp[0].minor.yy616, yymsp[-1].minor.yy616, OP_TYPE_EQUAL); } + case 226: /* cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */ +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, yymsp[0].minor.yy160, yymsp[-1].minor.yy160, OP_TYPE_EQUAL); } break; - case 221: /* db_name_cond_opt ::= */ - case 226: /* from_db_opt ::= */ yytestcase(yyruleno==226); -{ yymsp[1].minor.yy616 = createDefaultDatabaseCondValue(pCxt); } + case 227: /* db_name_cond_opt ::= */ + case 232: /* from_db_opt ::= */ yytestcase(yyruleno==232); +{ yymsp[1].minor.yy160 = createDefaultDatabaseCondValue(pCxt); } break; - case 222: /* db_name_cond_opt ::= db_name NK_DOT */ -{ yylhsminor.yy616 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy361); } - yymsp[-1].minor.yy616 = yylhsminor.yy616; + case 228: /* db_name_cond_opt ::= db_name NK_DOT */ +{ yylhsminor.yy160 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy231); } + yymsp[-1].minor.yy160 = yylhsminor.yy160; break; - case 223: /* like_pattern_opt ::= */ - case 263: /* into_opt ::= */ yytestcase(yyruleno==263); - case 403: /* from_clause_opt ::= */ yytestcase(yyruleno==403); - case 432: /* where_clause_opt ::= */ yytestcase(yyruleno==432); - case 436: /* twindow_clause_opt ::= */ yytestcase(yyruleno==436); - case 441: /* sliding_opt ::= */ yytestcase(yyruleno==441); - case 443: /* fill_opt ::= */ yytestcase(yyruleno==443); - case 455: /* having_clause_opt ::= */ yytestcase(yyruleno==455); - case 457: /* range_opt ::= */ yytestcase(yyruleno==457); - case 459: /* every_opt ::= */ yytestcase(yyruleno==459); - case 469: /* slimit_clause_opt ::= */ yytestcase(yyruleno==469); - case 473: /* limit_clause_opt ::= */ yytestcase(yyruleno==473); -{ yymsp[1].minor.yy616 = NULL; } + case 229: /* like_pattern_opt ::= */ + case 269: /* into_opt ::= */ yytestcase(yyruleno==269); + case 409: /* from_clause_opt ::= */ yytestcase(yyruleno==409); + case 438: /* where_clause_opt ::= */ yytestcase(yyruleno==438); + case 442: /* twindow_clause_opt ::= */ yytestcase(yyruleno==442); + case 447: /* sliding_opt ::= */ yytestcase(yyruleno==447); + case 449: /* fill_opt ::= */ yytestcase(yyruleno==449); + case 461: /* having_clause_opt ::= */ yytestcase(yyruleno==461); + case 463: /* range_opt ::= */ yytestcase(yyruleno==463); + case 465: /* every_opt ::= */ yytestcase(yyruleno==465); + case 475: /* slimit_clause_opt ::= */ yytestcase(yyruleno==475); + case 479: /* limit_clause_opt ::= */ yytestcase(yyruleno==479); +{ yymsp[1].minor.yy160 = NULL; } break; - case 224: /* like_pattern_opt ::= LIKE NK_STRING */ -{ yymsp[-1].minor.yy616 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } + case 230: /* like_pattern_opt ::= LIKE NK_STRING */ +{ yymsp[-1].minor.yy160 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } break; - case 225: /* table_name_cond ::= table_name */ -{ yylhsminor.yy616 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy361); } - yymsp[0].minor.yy616 = yylhsminor.yy616; + case 231: /* table_name_cond ::= table_name */ +{ yylhsminor.yy160 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy231); } + yymsp[0].minor.yy160 = yylhsminor.yy160; break; - case 227: /* from_db_opt ::= FROM db_name */ -{ yymsp[-1].minor.yy616 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy361); } + case 233: /* from_db_opt ::= FROM db_name */ +{ yymsp[-1].minor.yy160 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy231); } break; - case 228: /* cmd ::= CREATE SMA INDEX not_exists_opt index_name ON table_name index_options */ -{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, yymsp[-4].minor.yy151, &yymsp[-3].minor.yy361, &yymsp[-1].minor.yy361, NULL, yymsp[0].minor.yy616); } + case 234: /* cmd ::= CREATE SMA INDEX not_exists_opt index_name ON table_name index_options */ +{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, yymsp[-4].minor.yy611, &yymsp[-3].minor.yy231, &yymsp[-1].minor.yy231, NULL, yymsp[0].minor.yy160); } break; - case 229: /* cmd ::= DROP INDEX exists_opt index_name */ -{ pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-1].minor.yy151, &yymsp[0].minor.yy361); } + case 235: /* cmd ::= DROP INDEX exists_opt index_name */ +{ pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-1].minor.yy611, &yymsp[0].minor.yy231); } break; - case 230: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ -{ yymsp[-9].minor.yy616 = createIndexOption(pCxt, yymsp[-7].minor.yy356, releaseRawExprNode(pCxt, yymsp[-3].minor.yy616), NULL, yymsp[-1].minor.yy616, yymsp[0].minor.yy616); } + case 236: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ +{ yymsp[-9].minor.yy160 = createIndexOption(pCxt, yymsp[-7].minor.yy180, releaseRawExprNode(pCxt, yymsp[-3].minor.yy160), NULL, yymsp[-1].minor.yy160, yymsp[0].minor.yy160); } break; - case 231: /* 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.yy616 = createIndexOption(pCxt, yymsp[-9].minor.yy356, releaseRawExprNode(pCxt, yymsp[-5].minor.yy616), releaseRawExprNode(pCxt, yymsp[-3].minor.yy616), yymsp[-1].minor.yy616, yymsp[0].minor.yy616); } + case 237: /* 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.yy160 = createIndexOption(pCxt, yymsp[-9].minor.yy180, releaseRawExprNode(pCxt, yymsp[-5].minor.yy160), releaseRawExprNode(pCxt, yymsp[-3].minor.yy160), yymsp[-1].minor.yy160, yymsp[0].minor.yy160); } break; - case 234: /* func ::= function_name NK_LP expression_list NK_RP */ -{ yylhsminor.yy616 = createFunctionNode(pCxt, &yymsp[-3].minor.yy361, yymsp[-1].minor.yy356); } - yymsp[-3].minor.yy616 = yylhsminor.yy616; + case 240: /* func ::= function_name NK_LP expression_list NK_RP */ +{ yylhsminor.yy160 = createFunctionNode(pCxt, &yymsp[-3].minor.yy231, yymsp[-1].minor.yy180); } + yymsp[-3].minor.yy160 = yylhsminor.yy160; break; - case 235: /* sma_stream_opt ::= */ - case 265: /* stream_options ::= */ yytestcase(yyruleno==265); -{ yymsp[1].minor.yy616 = createStreamOptions(pCxt); } + case 241: /* sma_stream_opt ::= */ + case 271: /* stream_options ::= */ yytestcase(yyruleno==271); +{ yymsp[1].minor.yy160 = createStreamOptions(pCxt); } break; - case 236: /* sma_stream_opt ::= stream_options WATERMARK duration_literal */ - case 269: /* stream_options ::= stream_options WATERMARK duration_literal */ yytestcase(yyruleno==269); -{ ((SStreamOptions*)yymsp[-2].minor.yy616)->pWatermark = releaseRawExprNode(pCxt, yymsp[0].minor.yy616); yylhsminor.yy616 = yymsp[-2].minor.yy616; } - yymsp[-2].minor.yy616 = yylhsminor.yy616; + case 242: /* sma_stream_opt ::= stream_options WATERMARK duration_literal */ + case 275: /* stream_options ::= stream_options WATERMARK duration_literal */ yytestcase(yyruleno==275); +{ ((SStreamOptions*)yymsp[-2].minor.yy160)->pWatermark = releaseRawExprNode(pCxt, yymsp[0].minor.yy160); yylhsminor.yy160 = yymsp[-2].minor.yy160; } + yymsp[-2].minor.yy160 = yylhsminor.yy160; break; - case 237: /* sma_stream_opt ::= stream_options MAX_DELAY duration_literal */ -{ ((SStreamOptions*)yymsp[-2].minor.yy616)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy616); yylhsminor.yy616 = yymsp[-2].minor.yy616; } - yymsp[-2].minor.yy616 = yylhsminor.yy616; + case 243: /* sma_stream_opt ::= stream_options MAX_DELAY duration_literal */ +{ ((SStreamOptions*)yymsp[-2].minor.yy160)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy160); yylhsminor.yy160 = yymsp[-2].minor.yy160; } + yymsp[-2].minor.yy160 = yylhsminor.yy160; break; - case 238: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_expression */ -{ pCxt->pRootNode = createCreateTopicStmtUseQuery(pCxt, yymsp[-3].minor.yy151, &yymsp[-2].minor.yy361, yymsp[0].minor.yy616); } + case 244: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_expression */ +{ pCxt->pRootNode = createCreateTopicStmtUseQuery(pCxt, yymsp[-3].minor.yy611, &yymsp[-2].minor.yy231, yymsp[0].minor.yy160); } break; - case 239: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name */ -{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-4].minor.yy151, &yymsp[-3].minor.yy361, &yymsp[0].minor.yy361, false); } + case 245: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name */ +{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-4].minor.yy611, &yymsp[-3].minor.yy231, &yymsp[0].minor.yy231, false); } break; - case 240: /* cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name */ -{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-6].minor.yy151, &yymsp[-5].minor.yy361, &yymsp[0].minor.yy361, true); } + case 246: /* cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name */ +{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-6].minor.yy611, &yymsp[-5].minor.yy231, &yymsp[0].minor.yy231, true); } break; - case 241: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name */ -{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-4].minor.yy151, &yymsp[-3].minor.yy361, yymsp[0].minor.yy616, false); } + case 247: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name */ +{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-4].minor.yy611, &yymsp[-3].minor.yy231, yymsp[0].minor.yy160, false); } break; - case 242: /* cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name */ -{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-6].minor.yy151, &yymsp[-5].minor.yy361, yymsp[0].minor.yy616, true); } + case 248: /* cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name */ +{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-6].minor.yy611, &yymsp[-5].minor.yy231, yymsp[0].minor.yy160, true); } break; - case 243: /* cmd ::= DROP TOPIC exists_opt topic_name */ -{ pCxt->pRootNode = createDropTopicStmt(pCxt, yymsp[-1].minor.yy151, &yymsp[0].minor.yy361); } + case 249: /* cmd ::= DROP TOPIC exists_opt topic_name */ +{ pCxt->pRootNode = createDropTopicStmt(pCxt, yymsp[-1].minor.yy611, &yymsp[0].minor.yy231); } break; - case 244: /* cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ -{ pCxt->pRootNode = createDropCGroupStmt(pCxt, yymsp[-3].minor.yy151, &yymsp[-2].minor.yy361, &yymsp[0].minor.yy361); } + case 250: /* cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ +{ pCxt->pRootNode = createDropCGroupStmt(pCxt, yymsp[-3].minor.yy611, &yymsp[-2].minor.yy231, &yymsp[0].minor.yy231); } break; - case 245: /* cmd ::= DESC full_table_name */ - case 246: /* cmd ::= DESCRIBE full_table_name */ yytestcase(yyruleno==246); -{ pCxt->pRootNode = createDescribeStmt(pCxt, yymsp[0].minor.yy616); } + case 251: /* cmd ::= DESC full_table_name */ + case 252: /* cmd ::= DESCRIBE full_table_name */ yytestcase(yyruleno==252); +{ pCxt->pRootNode = createDescribeStmt(pCxt, yymsp[0].minor.yy160); } break; - case 247: /* cmd ::= RESET QUERY CACHE */ + case 253: /* cmd ::= RESET QUERY CACHE */ { pCxt->pRootNode = createResetQueryCacheStmt(pCxt); } break; - case 248: /* cmd ::= EXPLAIN analyze_opt explain_options query_expression */ -{ pCxt->pRootNode = createExplainStmt(pCxt, yymsp[-2].minor.yy151, yymsp[-1].minor.yy616, yymsp[0].minor.yy616); } + case 254: /* cmd ::= EXPLAIN analyze_opt explain_options query_expression */ +{ pCxt->pRootNode = createExplainStmt(pCxt, yymsp[-2].minor.yy611, yymsp[-1].minor.yy160, yymsp[0].minor.yy160); } break; - case 250: /* analyze_opt ::= ANALYZE */ - case 258: /* agg_func_opt ::= AGGREGATE */ yytestcase(yyruleno==258); - case 423: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==423); -{ yymsp[0].minor.yy151 = true; } + case 256: /* analyze_opt ::= ANALYZE */ + case 264: /* agg_func_opt ::= AGGREGATE */ yytestcase(yyruleno==264); + case 429: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==429); +{ yymsp[0].minor.yy611 = true; } break; - case 251: /* explain_options ::= */ -{ yymsp[1].minor.yy616 = createDefaultExplainOptions(pCxt); } + case 257: /* explain_options ::= */ +{ yymsp[1].minor.yy160 = createDefaultExplainOptions(pCxt); } break; - case 252: /* explain_options ::= explain_options VERBOSE NK_BOOL */ -{ yylhsminor.yy616 = setExplainVerbose(pCxt, yymsp[-2].minor.yy616, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy616 = yylhsminor.yy616; + case 258: /* explain_options ::= explain_options VERBOSE NK_BOOL */ +{ yylhsminor.yy160 = setExplainVerbose(pCxt, yymsp[-2].minor.yy160, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy160 = yylhsminor.yy160; break; - case 253: /* explain_options ::= explain_options RATIO NK_FLOAT */ -{ yylhsminor.yy616 = setExplainRatio(pCxt, yymsp[-2].minor.yy616, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy616 = yylhsminor.yy616; + case 259: /* explain_options ::= explain_options RATIO NK_FLOAT */ +{ yylhsminor.yy160 = setExplainRatio(pCxt, yymsp[-2].minor.yy160, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy160 = yylhsminor.yy160; break; - case 254: /* cmd ::= COMPACT VNODES IN NK_LP integer_list NK_RP */ + case 260: /* cmd ::= COMPACT VNODES IN NK_LP integer_list NK_RP */ { pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); } - yy_destructor(yypParser,273,&yymsp[-1].minor); + yy_destructor(yypParser,277,&yymsp[-1].minor); break; - case 255: /* 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.yy151, yymsp[-8].minor.yy151, &yymsp[-5].minor.yy361, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy600, yymsp[0].minor.yy734); } + case 261: /* 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.yy611, yymsp[-8].minor.yy611, &yymsp[-5].minor.yy231, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy190, yymsp[0].minor.yy516); } break; - case 256: /* cmd ::= DROP FUNCTION exists_opt function_name */ -{ pCxt->pRootNode = createDropFunctionStmt(pCxt, yymsp[-1].minor.yy151, &yymsp[0].minor.yy361); } + case 262: /* cmd ::= DROP FUNCTION exists_opt function_name */ +{ pCxt->pRootNode = createDropFunctionStmt(pCxt, yymsp[-1].minor.yy611, &yymsp[0].minor.yy231); } break; - case 259: /* bufsize_opt ::= */ -{ yymsp[1].minor.yy734 = 0; } + case 265: /* bufsize_opt ::= */ +{ yymsp[1].minor.yy516 = 0; } break; - case 260: /* bufsize_opt ::= BUFSIZE NK_INTEGER */ -{ yymsp[-1].minor.yy734 = taosStr2Int32(yymsp[0].minor.yy0.z, NULL, 10); } + case 266: /* bufsize_opt ::= BUFSIZE NK_INTEGER */ +{ yymsp[-1].minor.yy516 = taosStr2Int32(yymsp[0].minor.yy0.z, NULL, 10); } break; - case 261: /* cmd ::= CREATE STREAM not_exists_opt stream_name stream_options into_opt AS query_expression */ -{ pCxt->pRootNode = createCreateStreamStmt(pCxt, yymsp[-5].minor.yy151, &yymsp[-4].minor.yy361, yymsp[-2].minor.yy616, yymsp[-3].minor.yy616, yymsp[0].minor.yy616); } + case 267: /* cmd ::= CREATE STREAM not_exists_opt stream_name stream_options into_opt AS query_expression */ +{ pCxt->pRootNode = createCreateStreamStmt(pCxt, yymsp[-5].minor.yy611, &yymsp[-4].minor.yy231, yymsp[-2].minor.yy160, yymsp[-3].minor.yy160, yymsp[0].minor.yy160); } break; - case 262: /* cmd ::= DROP STREAM exists_opt stream_name */ -{ pCxt->pRootNode = createDropStreamStmt(pCxt, yymsp[-1].minor.yy151, &yymsp[0].minor.yy361); } + case 268: /* cmd ::= DROP STREAM exists_opt stream_name */ +{ pCxt->pRootNode = createDropStreamStmt(pCxt, yymsp[-1].minor.yy611, &yymsp[0].minor.yy231); } break; - case 264: /* into_opt ::= INTO full_table_name */ - case 404: /* from_clause_opt ::= FROM table_reference_list */ yytestcase(yyruleno==404); - case 433: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==433); - case 456: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==456); -{ yymsp[-1].minor.yy616 = yymsp[0].minor.yy616; } + case 270: /* into_opt ::= INTO full_table_name */ + case 410: /* from_clause_opt ::= FROM table_reference_list */ yytestcase(yyruleno==410); + case 439: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==439); + case 462: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==462); +{ yymsp[-1].minor.yy160 = yymsp[0].minor.yy160; } break; - case 266: /* stream_options ::= stream_options TRIGGER AT_ONCE */ -{ ((SStreamOptions*)yymsp[-2].minor.yy616)->triggerType = STREAM_TRIGGER_AT_ONCE; yylhsminor.yy616 = yymsp[-2].minor.yy616; } - yymsp[-2].minor.yy616 = yylhsminor.yy616; + case 272: /* stream_options ::= stream_options TRIGGER AT_ONCE */ +{ ((SStreamOptions*)yymsp[-2].minor.yy160)->triggerType = STREAM_TRIGGER_AT_ONCE; yylhsminor.yy160 = yymsp[-2].minor.yy160; } + yymsp[-2].minor.yy160 = yylhsminor.yy160; break; - case 267: /* stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ -{ ((SStreamOptions*)yymsp[-2].minor.yy616)->triggerType = STREAM_TRIGGER_WINDOW_CLOSE; yylhsminor.yy616 = yymsp[-2].minor.yy616; } - yymsp[-2].minor.yy616 = yylhsminor.yy616; + case 273: /* stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ +{ ((SStreamOptions*)yymsp[-2].minor.yy160)->triggerType = STREAM_TRIGGER_WINDOW_CLOSE; yylhsminor.yy160 = yymsp[-2].minor.yy160; } + yymsp[-2].minor.yy160 = yylhsminor.yy160; break; - case 268: /* stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ -{ ((SStreamOptions*)yymsp[-3].minor.yy616)->triggerType = STREAM_TRIGGER_MAX_DELAY; ((SStreamOptions*)yymsp[-3].minor.yy616)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy616); yylhsminor.yy616 = yymsp[-3].minor.yy616; } - yymsp[-3].minor.yy616 = yylhsminor.yy616; + case 274: /* stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ +{ ((SStreamOptions*)yymsp[-3].minor.yy160)->triggerType = STREAM_TRIGGER_MAX_DELAY; ((SStreamOptions*)yymsp[-3].minor.yy160)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy160); yylhsminor.yy160 = yymsp[-3].minor.yy160; } + yymsp[-3].minor.yy160 = yylhsminor.yy160; break; - case 270: /* stream_options ::= stream_options IGNORE EXPIRED */ -{ ((SStreamOptions*)yymsp[-2].minor.yy616)->ignoreExpired = true; yylhsminor.yy616 = yymsp[-2].minor.yy616; } - yymsp[-2].minor.yy616 = yylhsminor.yy616; + case 276: /* stream_options ::= stream_options IGNORE EXPIRED */ +{ ((SStreamOptions*)yymsp[-2].minor.yy160)->ignoreExpired = true; yylhsminor.yy160 = yymsp[-2].minor.yy160; } + yymsp[-2].minor.yy160 = yylhsminor.yy160; break; - case 271: /* cmd ::= KILL CONNECTION NK_INTEGER */ + case 277: /* cmd ::= KILL CONNECTION NK_INTEGER */ { pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_CONNECTION_STMT, &yymsp[0].minor.yy0); } break; - case 272: /* cmd ::= KILL QUERY NK_STRING */ + case 278: /* cmd ::= KILL QUERY NK_STRING */ { pCxt->pRootNode = createKillQueryStmt(pCxt, &yymsp[0].minor.yy0); } break; - case 273: /* cmd ::= KILL TRANSACTION NK_INTEGER */ + case 279: /* cmd ::= KILL TRANSACTION NK_INTEGER */ { pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_TRANSACTION_STMT, &yymsp[0].minor.yy0); } break; - case 274: /* cmd ::= BALANCE VGROUP */ + case 280: /* cmd ::= BALANCE VGROUP */ { pCxt->pRootNode = createBalanceVgroupStmt(pCxt); } break; - case 275: /* cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ + case 281: /* cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ { pCxt->pRootNode = createMergeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } break; - case 276: /* cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ -{ pCxt->pRootNode = createRedistributeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy356); } + case 282: /* cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ +{ pCxt->pRootNode = createRedistributeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy180); } break; - case 277: /* cmd ::= SPLIT VGROUP NK_INTEGER */ + case 283: /* cmd ::= SPLIT VGROUP NK_INTEGER */ { pCxt->pRootNode = createSplitVgroupStmt(pCxt, &yymsp[0].minor.yy0); } break; - case 278: /* dnode_list ::= DNODE NK_INTEGER */ -{ yymsp[-1].minor.yy356 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } + case 284: /* dnode_list ::= DNODE NK_INTEGER */ +{ yymsp[-1].minor.yy180 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } break; - case 280: /* cmd ::= SYNCDB db_name REPLICA */ -{ pCxt->pRootNode = createSyncdbStmt(pCxt, &yymsp[-1].minor.yy361); } + case 286: /* cmd ::= SYNCDB db_name REPLICA */ +{ pCxt->pRootNode = createSyncdbStmt(pCxt, &yymsp[-1].minor.yy231); } break; - case 281: /* cmd ::= DELETE FROM full_table_name where_clause_opt */ -{ pCxt->pRootNode = createDeleteStmt(pCxt, yymsp[-1].minor.yy616, yymsp[0].minor.yy616); } + case 287: /* cmd ::= DELETE FROM full_table_name where_clause_opt */ +{ pCxt->pRootNode = createDeleteStmt(pCxt, yymsp[-1].minor.yy160, yymsp[0].minor.yy160); } break; - case 283: /* cmd ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_expression */ -{ pCxt->pRootNode = createInsertStmt(pCxt, yymsp[-4].minor.yy616, yymsp[-2].minor.yy356, yymsp[0].minor.yy616); } + case 289: /* cmd ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_expression */ +{ pCxt->pRootNode = createInsertStmt(pCxt, yymsp[-4].minor.yy160, yymsp[-2].minor.yy180, yymsp[0].minor.yy160); } break; - case 284: /* cmd ::= INSERT INTO full_table_name query_expression */ -{ pCxt->pRootNode = createInsertStmt(pCxt, yymsp[-1].minor.yy616, NULL, yymsp[0].minor.yy616); } + case 290: /* cmd ::= INSERT INTO full_table_name query_expression */ +{ pCxt->pRootNode = createInsertStmt(pCxt, yymsp[-1].minor.yy160, NULL, yymsp[0].minor.yy160); } break; - case 285: /* literal ::= NK_INTEGER */ -{ yylhsminor.yy616 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy616 = yylhsminor.yy616; + case 291: /* literal ::= NK_INTEGER */ +{ yylhsminor.yy160 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy160 = yylhsminor.yy160; break; - case 286: /* literal ::= NK_FLOAT */ -{ yylhsminor.yy616 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy616 = yylhsminor.yy616; + case 292: /* literal ::= NK_FLOAT */ +{ yylhsminor.yy160 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy160 = yylhsminor.yy160; break; - case 287: /* literal ::= NK_STRING */ -{ yylhsminor.yy616 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy616 = yylhsminor.yy616; + case 293: /* literal ::= NK_STRING */ +{ yylhsminor.yy160 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy160 = yylhsminor.yy160; break; - case 288: /* literal ::= NK_BOOL */ -{ yylhsminor.yy616 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy616 = yylhsminor.yy616; + case 294: /* literal ::= NK_BOOL */ +{ yylhsminor.yy160 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy160 = yylhsminor.yy160; break; - case 289: /* literal ::= TIMESTAMP NK_STRING */ -{ yylhsminor.yy616 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); } - yymsp[-1].minor.yy616 = yylhsminor.yy616; + case 295: /* literal ::= TIMESTAMP NK_STRING */ +{ yylhsminor.yy160 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); } + yymsp[-1].minor.yy160 = yylhsminor.yy160; break; - case 290: /* literal ::= duration_literal */ - case 300: /* signed_literal ::= signed */ yytestcase(yyruleno==300); - case 321: /* expression ::= literal */ yytestcase(yyruleno==321); - case 322: /* expression ::= pseudo_column */ yytestcase(yyruleno==322); - case 323: /* expression ::= column_reference */ yytestcase(yyruleno==323); - case 324: /* expression ::= function_expression */ yytestcase(yyruleno==324); - case 325: /* expression ::= subquery */ yytestcase(yyruleno==325); - case 353: /* function_expression ::= literal_func */ yytestcase(yyruleno==353); - case 395: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==395); - case 399: /* boolean_primary ::= predicate */ yytestcase(yyruleno==399); - case 401: /* common_expression ::= expression */ yytestcase(yyruleno==401); - case 402: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==402); - case 405: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==405); - case 407: /* table_reference ::= table_primary */ yytestcase(yyruleno==407); - case 408: /* table_reference ::= joined_table */ yytestcase(yyruleno==408); - case 412: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==412); - case 462: /* query_expression_body ::= query_primary */ yytestcase(yyruleno==462); - case 465: /* query_primary ::= query_specification */ yytestcase(yyruleno==465); -{ yylhsminor.yy616 = yymsp[0].minor.yy616; } - yymsp[0].minor.yy616 = yylhsminor.yy616; + case 296: /* literal ::= duration_literal */ + case 306: /* signed_literal ::= signed */ yytestcase(yyruleno==306); + case 327: /* expression ::= literal */ yytestcase(yyruleno==327); + case 328: /* expression ::= pseudo_column */ yytestcase(yyruleno==328); + case 329: /* expression ::= column_reference */ yytestcase(yyruleno==329); + case 330: /* expression ::= function_expression */ yytestcase(yyruleno==330); + case 331: /* expression ::= subquery */ yytestcase(yyruleno==331); + case 359: /* function_expression ::= literal_func */ yytestcase(yyruleno==359); + case 401: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==401); + case 405: /* boolean_primary ::= predicate */ yytestcase(yyruleno==405); + case 407: /* common_expression ::= expression */ yytestcase(yyruleno==407); + case 408: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==408); + case 411: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==411); + case 413: /* table_reference ::= table_primary */ yytestcase(yyruleno==413); + case 414: /* table_reference ::= joined_table */ yytestcase(yyruleno==414); + case 418: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==418); + case 468: /* query_expression_body ::= query_primary */ yytestcase(yyruleno==468); + case 471: /* query_primary ::= query_specification */ yytestcase(yyruleno==471); +{ yylhsminor.yy160 = yymsp[0].minor.yy160; } + yymsp[0].minor.yy160 = yylhsminor.yy160; break; - case 291: /* literal ::= NULL */ -{ yylhsminor.yy616 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy616 = yylhsminor.yy616; + case 297: /* literal ::= NULL */ +{ yylhsminor.yy160 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy160 = yylhsminor.yy160; break; - case 292: /* literal ::= NK_QUESTION */ -{ yylhsminor.yy616 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy616 = yylhsminor.yy616; + case 298: /* literal ::= NK_QUESTION */ +{ yylhsminor.yy160 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy160 = yylhsminor.yy160; break; - case 293: /* duration_literal ::= NK_VARIABLE */ -{ yylhsminor.yy616 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy616 = yylhsminor.yy616; + case 299: /* duration_literal ::= NK_VARIABLE */ +{ yylhsminor.yy160 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy160 = yylhsminor.yy160; break; - case 294: /* signed ::= NK_INTEGER */ -{ yylhsminor.yy616 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy616 = yylhsminor.yy616; + case 300: /* signed ::= NK_INTEGER */ +{ yylhsminor.yy160 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy160 = yylhsminor.yy160; break; - case 295: /* signed ::= NK_PLUS NK_INTEGER */ -{ yymsp[-1].minor.yy616 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); } + case 301: /* signed ::= NK_PLUS NK_INTEGER */ +{ yymsp[-1].minor.yy160 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); } break; - case 296: /* signed ::= NK_MINUS NK_INTEGER */ + case 302: /* 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.yy616 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &t); + yylhsminor.yy160 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &t); } - yymsp[-1].minor.yy616 = yylhsminor.yy616; + yymsp[-1].minor.yy160 = yylhsminor.yy160; break; - case 297: /* signed ::= NK_FLOAT */ -{ yylhsminor.yy616 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy616 = yylhsminor.yy616; + case 303: /* signed ::= NK_FLOAT */ +{ yylhsminor.yy160 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy160 = yylhsminor.yy160; break; - case 298: /* signed ::= NK_PLUS NK_FLOAT */ -{ yymsp[-1].minor.yy616 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } + case 304: /* signed ::= NK_PLUS NK_FLOAT */ +{ yymsp[-1].minor.yy160 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } break; - case 299: /* signed ::= NK_MINUS NK_FLOAT */ + case 305: /* 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.yy616 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t); + yylhsminor.yy160 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t); } - yymsp[-1].minor.yy616 = yylhsminor.yy616; + yymsp[-1].minor.yy160 = yylhsminor.yy160; break; - case 301: /* signed_literal ::= NK_STRING */ -{ yylhsminor.yy616 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy616 = yylhsminor.yy616; + case 307: /* signed_literal ::= NK_STRING */ +{ yylhsminor.yy160 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy160 = yylhsminor.yy160; break; - case 302: /* signed_literal ::= NK_BOOL */ -{ yylhsminor.yy616 = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy616 = yylhsminor.yy616; + case 308: /* signed_literal ::= NK_BOOL */ +{ yylhsminor.yy160 = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy160 = yylhsminor.yy160; break; - case 303: /* signed_literal ::= TIMESTAMP NK_STRING */ -{ yymsp[-1].minor.yy616 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } + case 309: /* signed_literal ::= TIMESTAMP NK_STRING */ +{ yymsp[-1].minor.yy160 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } break; - case 304: /* signed_literal ::= duration_literal */ - case 306: /* signed_literal ::= literal_func */ yytestcase(yyruleno==306); - case 373: /* star_func_para ::= expression */ yytestcase(yyruleno==373); - case 428: /* select_item ::= common_expression */ yytestcase(yyruleno==428); - case 478: /* search_condition ::= common_expression */ yytestcase(yyruleno==478); -{ yylhsminor.yy616 = releaseRawExprNode(pCxt, yymsp[0].minor.yy616); } - yymsp[0].minor.yy616 = yylhsminor.yy616; + case 310: /* signed_literal ::= duration_literal */ + case 312: /* signed_literal ::= literal_func */ yytestcase(yyruleno==312); + case 379: /* star_func_para ::= expression */ yytestcase(yyruleno==379); + case 434: /* select_item ::= common_expression */ yytestcase(yyruleno==434); + case 484: /* search_condition ::= common_expression */ yytestcase(yyruleno==484); +{ yylhsminor.yy160 = releaseRawExprNode(pCxt, yymsp[0].minor.yy160); } + yymsp[0].minor.yy160 = yylhsminor.yy160; break; - case 305: /* signed_literal ::= NULL */ -{ yylhsminor.yy616 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy616 = yylhsminor.yy616; + case 311: /* signed_literal ::= NULL */ +{ yylhsminor.yy160 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy160 = yylhsminor.yy160; break; - case 307: /* signed_literal ::= NK_QUESTION */ -{ yylhsminor.yy616 = createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy616 = yylhsminor.yy616; + case 313: /* signed_literal ::= NK_QUESTION */ +{ yylhsminor.yy160 = createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy160 = yylhsminor.yy160; break; - case 326: /* expression ::= NK_LP expression NK_RP */ - case 400: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==400); -{ yylhsminor.yy616 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy616)); } - yymsp[-2].minor.yy616 = yylhsminor.yy616; + case 332: /* expression ::= NK_LP expression NK_RP */ + case 406: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==406); +{ yylhsminor.yy160 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy160)); } + yymsp[-2].minor.yy160 = yylhsminor.yy160; break; - case 327: /* expression ::= NK_PLUS expression */ + case 333: /* expression ::= NK_PLUS expression */ { - SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy616); - yylhsminor.yy616 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy616)); + SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy160); + yylhsminor.yy160 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy160)); } - yymsp[-1].minor.yy616 = yylhsminor.yy616; + yymsp[-1].minor.yy160 = yylhsminor.yy160; break; - case 328: /* expression ::= NK_MINUS expression */ + case 334: /* expression ::= NK_MINUS expression */ { - SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy616); - yylhsminor.yy616 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_MINUS, releaseRawExprNode(pCxt, yymsp[0].minor.yy616), NULL)); + SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy160); + yylhsminor.yy160 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_MINUS, releaseRawExprNode(pCxt, yymsp[0].minor.yy160), NULL)); } - yymsp[-1].minor.yy616 = yylhsminor.yy616; + yymsp[-1].minor.yy160 = yylhsminor.yy160; break; - case 329: /* expression ::= expression NK_PLUS expression */ + case 335: /* expression ::= expression NK_PLUS expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy616); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy616); - yylhsminor.yy616 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_ADD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy616), releaseRawExprNode(pCxt, yymsp[0].minor.yy616))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy160); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy160); + yylhsminor.yy160 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_ADD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy160), releaseRawExprNode(pCxt, yymsp[0].minor.yy160))); } - yymsp[-2].minor.yy616 = yylhsminor.yy616; + yymsp[-2].minor.yy160 = yylhsminor.yy160; break; - case 330: /* expression ::= expression NK_MINUS expression */ + case 336: /* expression ::= expression NK_MINUS expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy616); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy616); - yylhsminor.yy616 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[-2].minor.yy616), releaseRawExprNode(pCxt, yymsp[0].minor.yy616))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy160); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy160); + yylhsminor.yy160 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[-2].minor.yy160), releaseRawExprNode(pCxt, yymsp[0].minor.yy160))); } - yymsp[-2].minor.yy616 = yylhsminor.yy616; + yymsp[-2].minor.yy160 = yylhsminor.yy160; break; - case 331: /* expression ::= expression NK_STAR expression */ + case 337: /* expression ::= expression NK_STAR expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy616); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy616); - yylhsminor.yy616 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MULTI, releaseRawExprNode(pCxt, yymsp[-2].minor.yy616), releaseRawExprNode(pCxt, yymsp[0].minor.yy616))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy160); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy160); + yylhsminor.yy160 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MULTI, releaseRawExprNode(pCxt, yymsp[-2].minor.yy160), releaseRawExprNode(pCxt, yymsp[0].minor.yy160))); } - yymsp[-2].minor.yy616 = yylhsminor.yy616; + yymsp[-2].minor.yy160 = yylhsminor.yy160; break; - case 332: /* expression ::= expression NK_SLASH expression */ + case 338: /* expression ::= expression NK_SLASH expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy616); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy616); - yylhsminor.yy616 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_DIV, releaseRawExprNode(pCxt, yymsp[-2].minor.yy616), releaseRawExprNode(pCxt, yymsp[0].minor.yy616))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy160); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy160); + yylhsminor.yy160 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_DIV, releaseRawExprNode(pCxt, yymsp[-2].minor.yy160), releaseRawExprNode(pCxt, yymsp[0].minor.yy160))); } - yymsp[-2].minor.yy616 = yylhsminor.yy616; + yymsp[-2].minor.yy160 = yylhsminor.yy160; break; - case 333: /* expression ::= expression NK_REM expression */ + case 339: /* expression ::= expression NK_REM expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy616); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy616); - yylhsminor.yy616 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_REM, releaseRawExprNode(pCxt, yymsp[-2].minor.yy616), releaseRawExprNode(pCxt, yymsp[0].minor.yy616))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy160); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy160); + yylhsminor.yy160 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_REM, releaseRawExprNode(pCxt, yymsp[-2].minor.yy160), releaseRawExprNode(pCxt, yymsp[0].minor.yy160))); } - yymsp[-2].minor.yy616 = yylhsminor.yy616; + yymsp[-2].minor.yy160 = yylhsminor.yy160; break; - case 334: /* expression ::= column_reference NK_ARROW NK_STRING */ + case 340: /* expression ::= column_reference NK_ARROW NK_STRING */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy616); - yylhsminor.yy616 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_JSON_GET_VALUE, releaseRawExprNode(pCxt, yymsp[-2].minor.yy616), createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy160); + yylhsminor.yy160 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_JSON_GET_VALUE, releaseRawExprNode(pCxt, yymsp[-2].minor.yy160), createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0))); } - yymsp[-2].minor.yy616 = yylhsminor.yy616; + yymsp[-2].minor.yy160 = yylhsminor.yy160; break; - case 335: /* expression ::= expression NK_BITAND expression */ + case 341: /* expression ::= expression NK_BITAND expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy616); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy616); - yylhsminor.yy616 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy616), releaseRawExprNode(pCxt, yymsp[0].minor.yy616))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy160); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy160); + yylhsminor.yy160 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy160), releaseRawExprNode(pCxt, yymsp[0].minor.yy160))); } - yymsp[-2].minor.yy616 = yylhsminor.yy616; + yymsp[-2].minor.yy160 = yylhsminor.yy160; break; - case 336: /* expression ::= expression NK_BITOR expression */ + case 342: /* expression ::= expression NK_BITOR expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy616); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy616); - yylhsminor.yy616 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy616), releaseRawExprNode(pCxt, yymsp[0].minor.yy616))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy160); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy160); + yylhsminor.yy160 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy160), releaseRawExprNode(pCxt, yymsp[0].minor.yy160))); } - yymsp[-2].minor.yy616 = yylhsminor.yy616; + yymsp[-2].minor.yy160 = yylhsminor.yy160; break; - case 339: /* column_reference ::= column_name */ -{ yylhsminor.yy616 = createRawExprNode(pCxt, &yymsp[0].minor.yy361, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy361)); } - yymsp[0].minor.yy616 = yylhsminor.yy616; + case 345: /* column_reference ::= column_name */ +{ yylhsminor.yy160 = createRawExprNode(pCxt, &yymsp[0].minor.yy231, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy231)); } + yymsp[0].minor.yy160 = yylhsminor.yy160; break; - case 340: /* column_reference ::= table_name NK_DOT column_name */ -{ yylhsminor.yy616 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy361, &yymsp[0].minor.yy361, createColumnNode(pCxt, &yymsp[-2].minor.yy361, &yymsp[0].minor.yy361)); } - yymsp[-2].minor.yy616 = yylhsminor.yy616; + case 346: /* column_reference ::= table_name NK_DOT column_name */ +{ yylhsminor.yy160 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy231, &yymsp[0].minor.yy231, createColumnNode(pCxt, &yymsp[-2].minor.yy231, &yymsp[0].minor.yy231)); } + yymsp[-2].minor.yy160 = yylhsminor.yy160; break; - case 341: /* pseudo_column ::= ROWTS */ - case 342: /* pseudo_column ::= TBNAME */ yytestcase(yyruleno==342); - case 344: /* pseudo_column ::= QSTART */ yytestcase(yyruleno==344); - case 345: /* pseudo_column ::= QEND */ yytestcase(yyruleno==345); - case 346: /* pseudo_column ::= QDURATION */ yytestcase(yyruleno==346); - case 347: /* pseudo_column ::= WSTART */ yytestcase(yyruleno==347); - case 348: /* pseudo_column ::= WEND */ yytestcase(yyruleno==348); - case 349: /* pseudo_column ::= WDURATION */ yytestcase(yyruleno==349); - case 355: /* literal_func ::= NOW */ yytestcase(yyruleno==355); -{ yylhsminor.yy616 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); } - yymsp[0].minor.yy616 = yylhsminor.yy616; + case 347: /* pseudo_column ::= ROWTS */ + case 348: /* pseudo_column ::= TBNAME */ yytestcase(yyruleno==348); + case 350: /* pseudo_column ::= QSTART */ yytestcase(yyruleno==350); + case 351: /* pseudo_column ::= QEND */ yytestcase(yyruleno==351); + case 352: /* pseudo_column ::= QDURATION */ yytestcase(yyruleno==352); + case 353: /* pseudo_column ::= WSTART */ yytestcase(yyruleno==353); + case 354: /* pseudo_column ::= WEND */ yytestcase(yyruleno==354); + case 355: /* pseudo_column ::= WDURATION */ yytestcase(yyruleno==355); + case 361: /* literal_func ::= NOW */ yytestcase(yyruleno==361); +{ yylhsminor.yy160 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); } + yymsp[0].minor.yy160 = yylhsminor.yy160; break; - case 343: /* pseudo_column ::= table_name NK_DOT TBNAME */ -{ yylhsminor.yy616 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy361, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-2].minor.yy361)))); } - yymsp[-2].minor.yy616 = yylhsminor.yy616; + case 349: /* pseudo_column ::= table_name NK_DOT TBNAME */ +{ yylhsminor.yy160 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy231, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-2].minor.yy231)))); } + yymsp[-2].minor.yy160 = yylhsminor.yy160; break; - case 350: /* function_expression ::= function_name NK_LP expression_list NK_RP */ - case 351: /* function_expression ::= star_func NK_LP star_func_para_list NK_RP */ yytestcase(yyruleno==351); -{ yylhsminor.yy616 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy361, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy361, yymsp[-1].minor.yy356)); } - yymsp[-3].minor.yy616 = yylhsminor.yy616; + case 356: /* function_expression ::= function_name NK_LP expression_list NK_RP */ + case 357: /* function_expression ::= star_func NK_LP star_func_para_list NK_RP */ yytestcase(yyruleno==357); +{ yylhsminor.yy160 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy231, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy231, yymsp[-1].minor.yy180)); } + yymsp[-3].minor.yy160 = yylhsminor.yy160; break; - case 352: /* function_expression ::= CAST NK_LP expression AS type_name NK_RP */ -{ yylhsminor.yy616 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createCastFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy616), yymsp[-1].minor.yy600)); } - yymsp[-5].minor.yy616 = yylhsminor.yy616; + case 358: /* function_expression ::= CAST NK_LP expression AS type_name NK_RP */ +{ yylhsminor.yy160 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createCastFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy160), yymsp[-1].minor.yy190)); } + yymsp[-5].minor.yy160 = yylhsminor.yy160; break; - case 354: /* literal_func ::= noarg_func NK_LP NK_RP */ -{ yylhsminor.yy616 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy361, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-2].minor.yy361, NULL)); } - yymsp[-2].minor.yy616 = yylhsminor.yy616; + case 360: /* literal_func ::= noarg_func NK_LP NK_RP */ +{ yylhsminor.yy160 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy231, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-2].minor.yy231, NULL)); } + yymsp[-2].minor.yy160 = yylhsminor.yy160; break; - case 369: /* star_func_para_list ::= NK_STAR */ -{ yylhsminor.yy356 = createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy356 = yylhsminor.yy356; + case 375: /* star_func_para_list ::= NK_STAR */ +{ yylhsminor.yy180 = createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy180 = yylhsminor.yy180; break; - case 374: /* star_func_para ::= table_name NK_DOT NK_STAR */ - case 431: /* select_item ::= table_name NK_DOT NK_STAR */ yytestcase(yyruleno==431); -{ yylhsminor.yy616 = createColumnNode(pCxt, &yymsp[-2].minor.yy361, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy616 = yylhsminor.yy616; + case 380: /* star_func_para ::= table_name NK_DOT NK_STAR */ + case 437: /* select_item ::= table_name NK_DOT NK_STAR */ yytestcase(yyruleno==437); +{ yylhsminor.yy160 = createColumnNode(pCxt, &yymsp[-2].minor.yy231, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy160 = yylhsminor.yy160; break; - case 375: /* predicate ::= expression compare_op expression */ - case 380: /* predicate ::= expression in_op in_predicate_value */ yytestcase(yyruleno==380); + case 381: /* predicate ::= expression compare_op expression */ + case 386: /* predicate ::= expression in_op in_predicate_value */ yytestcase(yyruleno==386); { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy616); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy616); - yylhsminor.yy616 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, yymsp[-1].minor.yy526, releaseRawExprNode(pCxt, yymsp[-2].minor.yy616), releaseRawExprNode(pCxt, yymsp[0].minor.yy616))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy160); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy160); + yylhsminor.yy160 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, yymsp[-1].minor.yy598, releaseRawExprNode(pCxt, yymsp[-2].minor.yy160), releaseRawExprNode(pCxt, yymsp[0].minor.yy160))); } - yymsp[-2].minor.yy616 = yylhsminor.yy616; + yymsp[-2].minor.yy160 = yylhsminor.yy160; break; - case 376: /* predicate ::= expression BETWEEN expression AND expression */ + case 382: /* predicate ::= expression BETWEEN expression AND expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy616); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy616); - yylhsminor.yy616 = createRawExprNodeExt(pCxt, &s, &e, createBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-4].minor.yy616), releaseRawExprNode(pCxt, yymsp[-2].minor.yy616), releaseRawExprNode(pCxt, yymsp[0].minor.yy616))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy160); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy160); + yylhsminor.yy160 = createRawExprNodeExt(pCxt, &s, &e, createBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-4].minor.yy160), releaseRawExprNode(pCxt, yymsp[-2].minor.yy160), releaseRawExprNode(pCxt, yymsp[0].minor.yy160))); } - yymsp[-4].minor.yy616 = yylhsminor.yy616; + yymsp[-4].minor.yy160 = yylhsminor.yy160; break; - case 377: /* predicate ::= expression NOT BETWEEN expression AND expression */ + case 383: /* predicate ::= expression NOT BETWEEN expression AND expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy616); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy616); - yylhsminor.yy616 = createRawExprNodeExt(pCxt, &s, &e, createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy616), releaseRawExprNode(pCxt, yymsp[-2].minor.yy616), releaseRawExprNode(pCxt, yymsp[0].minor.yy616))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy160); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy160); + yylhsminor.yy160 = createRawExprNodeExt(pCxt, &s, &e, createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy160), releaseRawExprNode(pCxt, yymsp[-2].minor.yy160), releaseRawExprNode(pCxt, yymsp[0].minor.yy160))); } - yymsp[-5].minor.yy616 = yylhsminor.yy616; + yymsp[-5].minor.yy160 = yylhsminor.yy160; break; - case 378: /* predicate ::= expression IS NULL */ + case 384: /* predicate ::= expression IS NULL */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy616); - yylhsminor.yy616 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy616), NULL)); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy160); + yylhsminor.yy160 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy160), NULL)); } - yymsp[-2].minor.yy616 = yylhsminor.yy616; + yymsp[-2].minor.yy160 = yylhsminor.yy160; break; - case 379: /* predicate ::= expression IS NOT NULL */ + case 385: /* predicate ::= expression IS NOT NULL */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy616); - yylhsminor.yy616 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy616), NULL)); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy160); + yylhsminor.yy160 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy160), NULL)); } - yymsp[-3].minor.yy616 = yylhsminor.yy616; + yymsp[-3].minor.yy160 = yylhsminor.yy160; break; - case 381: /* compare_op ::= NK_LT */ -{ yymsp[0].minor.yy526 = OP_TYPE_LOWER_THAN; } + case 387: /* compare_op ::= NK_LT */ +{ yymsp[0].minor.yy598 = OP_TYPE_LOWER_THAN; } break; - case 382: /* compare_op ::= NK_GT */ -{ yymsp[0].minor.yy526 = OP_TYPE_GREATER_THAN; } + case 388: /* compare_op ::= NK_GT */ +{ yymsp[0].minor.yy598 = OP_TYPE_GREATER_THAN; } break; - case 383: /* compare_op ::= NK_LE */ -{ yymsp[0].minor.yy526 = OP_TYPE_LOWER_EQUAL; } + case 389: /* compare_op ::= NK_LE */ +{ yymsp[0].minor.yy598 = OP_TYPE_LOWER_EQUAL; } break; - case 384: /* compare_op ::= NK_GE */ -{ yymsp[0].minor.yy526 = OP_TYPE_GREATER_EQUAL; } + case 390: /* compare_op ::= NK_GE */ +{ yymsp[0].minor.yy598 = OP_TYPE_GREATER_EQUAL; } break; - case 385: /* compare_op ::= NK_NE */ -{ yymsp[0].minor.yy526 = OP_TYPE_NOT_EQUAL; } + case 391: /* compare_op ::= NK_NE */ +{ yymsp[0].minor.yy598 = OP_TYPE_NOT_EQUAL; } break; - case 386: /* compare_op ::= NK_EQ */ -{ yymsp[0].minor.yy526 = OP_TYPE_EQUAL; } + case 392: /* compare_op ::= NK_EQ */ +{ yymsp[0].minor.yy598 = OP_TYPE_EQUAL; } break; - case 387: /* compare_op ::= LIKE */ -{ yymsp[0].minor.yy526 = OP_TYPE_LIKE; } + case 393: /* compare_op ::= LIKE */ +{ yymsp[0].minor.yy598 = OP_TYPE_LIKE; } break; - case 388: /* compare_op ::= NOT LIKE */ -{ yymsp[-1].minor.yy526 = OP_TYPE_NOT_LIKE; } + case 394: /* compare_op ::= NOT LIKE */ +{ yymsp[-1].minor.yy598 = OP_TYPE_NOT_LIKE; } break; - case 389: /* compare_op ::= MATCH */ -{ yymsp[0].minor.yy526 = OP_TYPE_MATCH; } + case 395: /* compare_op ::= MATCH */ +{ yymsp[0].minor.yy598 = OP_TYPE_MATCH; } break; - case 390: /* compare_op ::= NMATCH */ -{ yymsp[0].minor.yy526 = OP_TYPE_NMATCH; } + case 396: /* compare_op ::= NMATCH */ +{ yymsp[0].minor.yy598 = OP_TYPE_NMATCH; } break; - case 391: /* compare_op ::= CONTAINS */ -{ yymsp[0].minor.yy526 = OP_TYPE_JSON_CONTAINS; } + case 397: /* compare_op ::= CONTAINS */ +{ yymsp[0].minor.yy598 = OP_TYPE_JSON_CONTAINS; } break; - case 392: /* in_op ::= IN */ -{ yymsp[0].minor.yy526 = OP_TYPE_IN; } + case 398: /* in_op ::= IN */ +{ yymsp[0].minor.yy598 = OP_TYPE_IN; } break; - case 393: /* in_op ::= NOT IN */ -{ yymsp[-1].minor.yy526 = OP_TYPE_NOT_IN; } + case 399: /* in_op ::= NOT IN */ +{ yymsp[-1].minor.yy598 = OP_TYPE_NOT_IN; } break; - case 394: /* in_predicate_value ::= NK_LP literal_list NK_RP */ -{ yylhsminor.yy616 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy356)); } - yymsp[-2].minor.yy616 = yylhsminor.yy616; + case 400: /* in_predicate_value ::= NK_LP literal_list NK_RP */ +{ yylhsminor.yy160 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy180)); } + yymsp[-2].minor.yy160 = yylhsminor.yy160; break; - case 396: /* boolean_value_expression ::= NOT boolean_primary */ + case 402: /* boolean_value_expression ::= NOT boolean_primary */ { - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy616); - yylhsminor.yy616 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy616), NULL)); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy160); + yylhsminor.yy160 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy160), NULL)); } - yymsp[-1].minor.yy616 = yylhsminor.yy616; + yymsp[-1].minor.yy160 = yylhsminor.yy160; break; - case 397: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ + case 403: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy616); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy616); - yylhsminor.yy616 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy616), releaseRawExprNode(pCxt, yymsp[0].minor.yy616))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy160); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy160); + yylhsminor.yy160 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy160), releaseRawExprNode(pCxt, yymsp[0].minor.yy160))); } - yymsp[-2].minor.yy616 = yylhsminor.yy616; + yymsp[-2].minor.yy160 = yylhsminor.yy160; break; - case 398: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ + case 404: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy616); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy616); - yylhsminor.yy616 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy616), releaseRawExprNode(pCxt, yymsp[0].minor.yy616))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy160); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy160); + yylhsminor.yy160 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy160), releaseRawExprNode(pCxt, yymsp[0].minor.yy160))); } - yymsp[-2].minor.yy616 = yylhsminor.yy616; + yymsp[-2].minor.yy160 = yylhsminor.yy160; break; - case 406: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */ -{ yylhsminor.yy616 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, yymsp[-2].minor.yy616, yymsp[0].minor.yy616, NULL); } - yymsp[-2].minor.yy616 = yylhsminor.yy616; + case 412: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */ +{ yylhsminor.yy160 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, yymsp[-2].minor.yy160, yymsp[0].minor.yy160, NULL); } + yymsp[-2].minor.yy160 = yylhsminor.yy160; break; - case 409: /* table_primary ::= table_name alias_opt */ -{ yylhsminor.yy616 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy361, &yymsp[0].minor.yy361); } - yymsp[-1].minor.yy616 = yylhsminor.yy616; + case 415: /* table_primary ::= table_name alias_opt */ +{ yylhsminor.yy160 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy231, &yymsp[0].minor.yy231); } + yymsp[-1].minor.yy160 = yylhsminor.yy160; break; - case 410: /* table_primary ::= db_name NK_DOT table_name alias_opt */ -{ yylhsminor.yy616 = createRealTableNode(pCxt, &yymsp[-3].minor.yy361, &yymsp[-1].minor.yy361, &yymsp[0].minor.yy361); } - yymsp[-3].minor.yy616 = yylhsminor.yy616; + case 416: /* table_primary ::= db_name NK_DOT table_name alias_opt */ +{ yylhsminor.yy160 = createRealTableNode(pCxt, &yymsp[-3].minor.yy231, &yymsp[-1].minor.yy231, &yymsp[0].minor.yy231); } + yymsp[-3].minor.yy160 = yylhsminor.yy160; break; - case 411: /* table_primary ::= subquery alias_opt */ -{ yylhsminor.yy616 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy616), &yymsp[0].minor.yy361); } - yymsp[-1].minor.yy616 = yylhsminor.yy616; + case 417: /* table_primary ::= subquery alias_opt */ +{ yylhsminor.yy160 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy160), &yymsp[0].minor.yy231); } + yymsp[-1].minor.yy160 = yylhsminor.yy160; break; - case 413: /* alias_opt ::= */ -{ yymsp[1].minor.yy361 = nil_token; } + case 419: /* alias_opt ::= */ +{ yymsp[1].minor.yy231 = nil_token; } break; - case 414: /* alias_opt ::= table_alias */ -{ yylhsminor.yy361 = yymsp[0].minor.yy361; } - yymsp[0].minor.yy361 = yylhsminor.yy361; + case 420: /* alias_opt ::= table_alias */ +{ yylhsminor.yy231 = yymsp[0].minor.yy231; } + yymsp[0].minor.yy231 = yylhsminor.yy231; break; - case 415: /* alias_opt ::= AS table_alias */ -{ yymsp[-1].minor.yy361 = yymsp[0].minor.yy361; } + case 421: /* alias_opt ::= AS table_alias */ +{ yymsp[-1].minor.yy231 = yymsp[0].minor.yy231; } break; - case 416: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */ - case 417: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==417); -{ yymsp[-2].minor.yy616 = yymsp[-1].minor.yy616; } + case 422: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */ + case 423: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==423); +{ yymsp[-2].minor.yy160 = yymsp[-1].minor.yy160; } break; - case 418: /* joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ -{ yylhsminor.yy616 = createJoinTableNode(pCxt, yymsp[-4].minor.yy504, yymsp[-5].minor.yy616, yymsp[-2].minor.yy616, yymsp[0].minor.yy616); } - yymsp[-5].minor.yy616 = yylhsminor.yy616; + case 424: /* joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ +{ yylhsminor.yy160 = createJoinTableNode(pCxt, yymsp[-4].minor.yy652, yymsp[-5].minor.yy160, yymsp[-2].minor.yy160, yymsp[0].minor.yy160); } + yymsp[-5].minor.yy160 = yylhsminor.yy160; break; - case 419: /* join_type ::= */ -{ yymsp[1].minor.yy504 = JOIN_TYPE_INNER; } + case 425: /* join_type ::= */ +{ yymsp[1].minor.yy652 = JOIN_TYPE_INNER; } break; - case 420: /* join_type ::= INNER */ -{ yymsp[0].minor.yy504 = JOIN_TYPE_INNER; } + case 426: /* join_type ::= INNER */ +{ yymsp[0].minor.yy652 = JOIN_TYPE_INNER; } break; - case 421: /* 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 427: /* 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.yy616 = createSelectStmt(pCxt, yymsp[-10].minor.yy151, yymsp[-9].minor.yy356, yymsp[-8].minor.yy616); - yymsp[-11].minor.yy616 = addWhereClause(pCxt, yymsp[-11].minor.yy616, yymsp[-7].minor.yy616); - yymsp[-11].minor.yy616 = addPartitionByClause(pCxt, yymsp[-11].minor.yy616, yymsp[-6].minor.yy356); - yymsp[-11].minor.yy616 = addWindowClauseClause(pCxt, yymsp[-11].minor.yy616, yymsp[-2].minor.yy616); - yymsp[-11].minor.yy616 = addGroupByClause(pCxt, yymsp[-11].minor.yy616, yymsp[-1].minor.yy356); - yymsp[-11].minor.yy616 = addHavingClause(pCxt, yymsp[-11].minor.yy616, yymsp[0].minor.yy616); - yymsp[-11].minor.yy616 = addRangeClause(pCxt, yymsp[-11].minor.yy616, yymsp[-5].minor.yy616); - yymsp[-11].minor.yy616 = addEveryClause(pCxt, yymsp[-11].minor.yy616, yymsp[-4].minor.yy616); - yymsp[-11].minor.yy616 = addFillClause(pCxt, yymsp[-11].minor.yy616, yymsp[-3].minor.yy616); + yymsp[-11].minor.yy160 = createSelectStmt(pCxt, yymsp[-10].minor.yy611, yymsp[-9].minor.yy180, yymsp[-8].minor.yy160); + yymsp[-11].minor.yy160 = addWhereClause(pCxt, yymsp[-11].minor.yy160, yymsp[-7].minor.yy160); + yymsp[-11].minor.yy160 = addPartitionByClause(pCxt, yymsp[-11].minor.yy160, yymsp[-6].minor.yy180); + yymsp[-11].minor.yy160 = addWindowClauseClause(pCxt, yymsp[-11].minor.yy160, yymsp[-2].minor.yy160); + yymsp[-11].minor.yy160 = addGroupByClause(pCxt, yymsp[-11].minor.yy160, yymsp[-1].minor.yy180); + yymsp[-11].minor.yy160 = addHavingClause(pCxt, yymsp[-11].minor.yy160, yymsp[0].minor.yy160); + yymsp[-11].minor.yy160 = addRangeClause(pCxt, yymsp[-11].minor.yy160, yymsp[-5].minor.yy160); + yymsp[-11].minor.yy160 = addEveryClause(pCxt, yymsp[-11].minor.yy160, yymsp[-4].minor.yy160); + yymsp[-11].minor.yy160 = addFillClause(pCxt, yymsp[-11].minor.yy160, yymsp[-3].minor.yy160); } break; - case 424: /* set_quantifier_opt ::= ALL */ -{ yymsp[0].minor.yy151 = false; } + case 430: /* set_quantifier_opt ::= ALL */ +{ yymsp[0].minor.yy611 = false; } break; - case 427: /* select_item ::= NK_STAR */ -{ yylhsminor.yy616 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy616 = yylhsminor.yy616; + case 433: /* select_item ::= NK_STAR */ +{ yylhsminor.yy160 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy160 = yylhsminor.yy160; break; - case 429: /* select_item ::= common_expression column_alias */ -{ yylhsminor.yy616 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy616), &yymsp[0].minor.yy361); } - yymsp[-1].minor.yy616 = yylhsminor.yy616; + case 435: /* select_item ::= common_expression column_alias */ +{ yylhsminor.yy160 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy160), &yymsp[0].minor.yy231); } + yymsp[-1].minor.yy160 = yylhsminor.yy160; break; - case 430: /* select_item ::= common_expression AS column_alias */ -{ yylhsminor.yy616 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy616), &yymsp[0].minor.yy361); } - yymsp[-2].minor.yy616 = yylhsminor.yy616; + case 436: /* select_item ::= common_expression AS column_alias */ +{ yylhsminor.yy160 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy160), &yymsp[0].minor.yy231); } + yymsp[-2].minor.yy160 = yylhsminor.yy160; break; - case 435: /* partition_by_clause_opt ::= PARTITION BY expression_list */ - case 452: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==452); - case 468: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==468); -{ yymsp[-2].minor.yy356 = yymsp[0].minor.yy356; } + case 441: /* partition_by_clause_opt ::= PARTITION BY expression_list */ + case 458: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==458); + case 474: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==474); +{ yymsp[-2].minor.yy180 = yymsp[0].minor.yy180; } break; - case 437: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ -{ yymsp[-5].minor.yy616 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy616), releaseRawExprNode(pCxt, yymsp[-1].minor.yy616)); } + case 443: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ +{ yymsp[-5].minor.yy160 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy160), releaseRawExprNode(pCxt, yymsp[-1].minor.yy160)); } break; - case 438: /* twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP */ -{ yymsp[-3].minor.yy616 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy616)); } + case 444: /* twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP */ +{ yymsp[-3].minor.yy160 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy160)); } break; - case 439: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ -{ yymsp[-5].minor.yy616 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy616), NULL, yymsp[-1].minor.yy616, yymsp[0].minor.yy616); } + case 445: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ +{ yymsp[-5].minor.yy160 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy160), NULL, yymsp[-1].minor.yy160, yymsp[0].minor.yy160); } break; - case 440: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ -{ yymsp[-7].minor.yy616 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy616), releaseRawExprNode(pCxt, yymsp[-3].minor.yy616), yymsp[-1].minor.yy616, yymsp[0].minor.yy616); } + case 446: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ +{ yymsp[-7].minor.yy160 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy160), releaseRawExprNode(pCxt, yymsp[-3].minor.yy160), yymsp[-1].minor.yy160, yymsp[0].minor.yy160); } break; - case 442: /* sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ - case 460: /* every_opt ::= EVERY NK_LP duration_literal NK_RP */ yytestcase(yyruleno==460); -{ yymsp[-3].minor.yy616 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy616); } + case 448: /* sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ + case 466: /* every_opt ::= EVERY NK_LP duration_literal NK_RP */ yytestcase(yyruleno==466); +{ yymsp[-3].minor.yy160 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy160); } break; - case 444: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */ -{ yymsp[-3].minor.yy616 = createFillNode(pCxt, yymsp[-1].minor.yy494, NULL); } + case 450: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */ +{ yymsp[-3].minor.yy160 = createFillNode(pCxt, yymsp[-1].minor.yy338, NULL); } break; - case 445: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ -{ yymsp[-5].minor.yy616 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy356)); } + case 451: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ +{ yymsp[-5].minor.yy160 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy180)); } break; - case 446: /* fill_mode ::= NONE */ -{ yymsp[0].minor.yy494 = FILL_MODE_NONE; } + case 452: /* fill_mode ::= NONE */ +{ yymsp[0].minor.yy338 = FILL_MODE_NONE; } break; - case 447: /* fill_mode ::= PREV */ -{ yymsp[0].minor.yy494 = FILL_MODE_PREV; } + case 453: /* fill_mode ::= PREV */ +{ yymsp[0].minor.yy338 = FILL_MODE_PREV; } break; - case 448: /* fill_mode ::= NULL */ -{ yymsp[0].minor.yy494 = FILL_MODE_NULL; } + case 454: /* fill_mode ::= NULL */ +{ yymsp[0].minor.yy338 = FILL_MODE_NULL; } break; - case 449: /* fill_mode ::= LINEAR */ -{ yymsp[0].minor.yy494 = FILL_MODE_LINEAR; } + case 455: /* fill_mode ::= LINEAR */ +{ yymsp[0].minor.yy338 = FILL_MODE_LINEAR; } break; - case 450: /* fill_mode ::= NEXT */ -{ yymsp[0].minor.yy494 = FILL_MODE_NEXT; } + case 456: /* fill_mode ::= NEXT */ +{ yymsp[0].minor.yy338 = FILL_MODE_NEXT; } break; - case 453: /* group_by_list ::= expression */ -{ yylhsminor.yy356 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy616))); } - yymsp[0].minor.yy356 = yylhsminor.yy356; + case 459: /* group_by_list ::= expression */ +{ yylhsminor.yy180 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy160))); } + yymsp[0].minor.yy180 = yylhsminor.yy180; break; - case 454: /* group_by_list ::= group_by_list NK_COMMA expression */ -{ yylhsminor.yy356 = addNodeToList(pCxt, yymsp[-2].minor.yy356, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy616))); } - yymsp[-2].minor.yy356 = yylhsminor.yy356; + case 460: /* group_by_list ::= group_by_list NK_COMMA expression */ +{ yylhsminor.yy180 = addNodeToList(pCxt, yymsp[-2].minor.yy180, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy160))); } + yymsp[-2].minor.yy180 = yylhsminor.yy180; break; - case 458: /* range_opt ::= RANGE NK_LP expression NK_COMMA expression NK_RP */ -{ yymsp[-5].minor.yy616 = createInterpTimeRange(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy616), releaseRawExprNode(pCxt, yymsp[-1].minor.yy616)); } + case 464: /* range_opt ::= RANGE NK_LP expression NK_COMMA expression NK_RP */ +{ yymsp[-5].minor.yy160 = createInterpTimeRange(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy160), releaseRawExprNode(pCxt, yymsp[-1].minor.yy160)); } break; - case 461: /* query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */ + case 467: /* query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */ { - yylhsminor.yy616 = addOrderByClause(pCxt, yymsp[-3].minor.yy616, yymsp[-2].minor.yy356); - yylhsminor.yy616 = addSlimitClause(pCxt, yylhsminor.yy616, yymsp[-1].minor.yy616); - yylhsminor.yy616 = addLimitClause(pCxt, yylhsminor.yy616, yymsp[0].minor.yy616); + yylhsminor.yy160 = addOrderByClause(pCxt, yymsp[-3].minor.yy160, yymsp[-2].minor.yy180); + yylhsminor.yy160 = addSlimitClause(pCxt, yylhsminor.yy160, yymsp[-1].minor.yy160); + yylhsminor.yy160 = addLimitClause(pCxt, yylhsminor.yy160, yymsp[0].minor.yy160); } - yymsp[-3].minor.yy616 = yylhsminor.yy616; + yymsp[-3].minor.yy160 = yylhsminor.yy160; break; - case 463: /* query_expression_body ::= query_expression_body UNION ALL query_expression_body */ -{ yylhsminor.yy616 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy616, yymsp[0].minor.yy616); } - yymsp[-3].minor.yy616 = yylhsminor.yy616; + case 469: /* query_expression_body ::= query_expression_body UNION ALL query_expression_body */ +{ yylhsminor.yy160 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy160, yymsp[0].minor.yy160); } + yymsp[-3].minor.yy160 = yylhsminor.yy160; break; - case 464: /* query_expression_body ::= query_expression_body UNION query_expression_body */ -{ yylhsminor.yy616 = createSetOperator(pCxt, SET_OP_TYPE_UNION, yymsp[-2].minor.yy616, yymsp[0].minor.yy616); } - yymsp[-2].minor.yy616 = yylhsminor.yy616; + case 470: /* query_expression_body ::= query_expression_body UNION query_expression_body */ +{ yylhsminor.yy160 = createSetOperator(pCxt, SET_OP_TYPE_UNION, yymsp[-2].minor.yy160, yymsp[0].minor.yy160); } + yymsp[-2].minor.yy160 = yylhsminor.yy160; break; - case 466: /* query_primary ::= NK_LP query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt NK_RP */ + case 472: /* query_primary ::= NK_LP query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt NK_RP */ { - yymsp[-5].minor.yy616 = addOrderByClause(pCxt, yymsp[-4].minor.yy616, yymsp[-3].minor.yy356); - yymsp[-5].minor.yy616 = addSlimitClause(pCxt, yymsp[-5].minor.yy616, yymsp[-2].minor.yy616); - yymsp[-5].minor.yy616 = addLimitClause(pCxt, yymsp[-5].minor.yy616, yymsp[-1].minor.yy616); + yymsp[-5].minor.yy160 = addOrderByClause(pCxt, yymsp[-4].minor.yy160, yymsp[-3].minor.yy180); + yymsp[-5].minor.yy160 = addSlimitClause(pCxt, yymsp[-5].minor.yy160, yymsp[-2].minor.yy160); + yymsp[-5].minor.yy160 = addLimitClause(pCxt, yymsp[-5].minor.yy160, yymsp[-1].minor.yy160); } break; - case 470: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */ - case 474: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==474); -{ yymsp[-1].minor.yy616 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); } + case 476: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */ + case 480: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==480); +{ yymsp[-1].minor.yy160 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); } break; - case 471: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ - case 475: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==475); -{ yymsp[-3].minor.yy616 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); } + case 477: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ + case 481: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==481); +{ yymsp[-3].minor.yy160 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); } break; - case 472: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - case 476: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==476); -{ yymsp[-3].minor.yy616 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); } + case 478: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + case 482: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==482); +{ yymsp[-3].minor.yy160 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); } break; - case 477: /* subquery ::= NK_LP query_expression NK_RP */ -{ yylhsminor.yy616 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy616); } - yymsp[-2].minor.yy616 = yylhsminor.yy616; + case 483: /* subquery ::= NK_LP query_expression NK_RP */ +{ yylhsminor.yy160 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy160); } + yymsp[-2].minor.yy160 = yylhsminor.yy160; break; - case 481: /* sort_specification ::= expression ordering_specification_opt null_ordering_opt */ -{ yylhsminor.yy616 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy616), yymsp[-1].minor.yy58, yymsp[0].minor.yy613); } - yymsp[-2].minor.yy616 = yylhsminor.yy616; + case 487: /* sort_specification ::= expression ordering_specification_opt null_ordering_opt */ +{ yylhsminor.yy160 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy160), yymsp[-1].minor.yy742, yymsp[0].minor.yy283); } + yymsp[-2].minor.yy160 = yylhsminor.yy160; break; - case 482: /* ordering_specification_opt ::= */ -{ yymsp[1].minor.yy58 = ORDER_ASC; } + case 488: /* ordering_specification_opt ::= */ +{ yymsp[1].minor.yy742 = ORDER_ASC; } break; - case 483: /* ordering_specification_opt ::= ASC */ -{ yymsp[0].minor.yy58 = ORDER_ASC; } + case 489: /* ordering_specification_opt ::= ASC */ +{ yymsp[0].minor.yy742 = ORDER_ASC; } break; - case 484: /* ordering_specification_opt ::= DESC */ -{ yymsp[0].minor.yy58 = ORDER_DESC; } + case 490: /* ordering_specification_opt ::= DESC */ +{ yymsp[0].minor.yy742 = ORDER_DESC; } break; - case 485: /* null_ordering_opt ::= */ -{ yymsp[1].minor.yy613 = NULL_ORDER_DEFAULT; } + case 491: /* null_ordering_opt ::= */ +{ yymsp[1].minor.yy283 = NULL_ORDER_DEFAULT; } break; - case 486: /* null_ordering_opt ::= NULLS FIRST */ -{ yymsp[-1].minor.yy613 = NULL_ORDER_FIRST; } + case 492: /* null_ordering_opt ::= NULLS FIRST */ +{ yymsp[-1].minor.yy283 = NULL_ORDER_FIRST; } break; - case 487: /* null_ordering_opt ::= NULLS LAST */ -{ yymsp[-1].minor.yy613 = NULL_ORDER_LAST; } + case 493: /* null_ordering_opt ::= NULLS LAST */ +{ yymsp[-1].minor.yy283 = NULL_ORDER_LAST; } break; default: break; diff --git a/source/libs/parser/test/parInitialCTest.cpp b/source/libs/parser/test/parInitialCTest.cpp index a2954b5798..e62beb3a35 100644 --- a/source/libs/parser/test/parInitialCTest.cpp +++ b/source/libs/parser/test/parInitialCTest.cpp @@ -77,6 +77,10 @@ TEST_F(ParserInitialCTest, createBnode) { * | WAL value * | VGROUPS value * | SINGLE_STABLE {0 | 1} + * | WAL_RETENTION_PERIOD value + * | WAL_ROLL_PERIOD value + * | WAL_RETENTION_SIZE value + * | WAL_SEGMENT_SIZE value * } */ TEST_F(ParserInitialCTest, createDatabase) { @@ -149,6 +153,10 @@ TEST_F(ParserInitialCTest, createDatabase) { ++expect.numOfRetensions; }; auto setDbSchemalessFunc = [&](int8_t schemaless) { expect.schemaless = schemaless; }; + auto setDbWalRetentionPeriod = [&](int32_t walRetentionPeriod) { expect.walRetentionPeriod = walRetentionPeriod; }; + auto setDbWalRetentionSize = [&](int32_t walRetentionSize) { expect.walRetentionSize = walRetentionSize; }; + auto setDbWalRollPeriod = [&](int32_t walRollPeriod) { expect.walRollPeriod = walRollPeriod; }; + auto setDbWalSegmentSize = [&](int32_t walSegmentSize) { expect.walSegmentSize = walSegmentSize; }; setCheckDdlFunc([&](const SQuery* pQuery, ParserStage stage) { ASSERT_EQ(nodeType(pQuery->pRoot), QUERY_NODE_CREATE_DATABASE_STMT); @@ -175,6 +183,10 @@ TEST_F(ParserInitialCTest, createDatabase) { ASSERT_EQ(req.strict, expect.strict); ASSERT_EQ(req.cacheLast, expect.cacheLast); ASSERT_EQ(req.cacheLastSize, expect.cacheLastSize); + ASSERT_EQ(req.walRetentionPeriod, expect.walRetentionPeriod); + ASSERT_EQ(req.walRetentionSize, expect.walRetentionSize); + ASSERT_EQ(req.walRollPeriod, expect.walRollPeriod); + ASSERT_EQ(req.walSegmentSize, expect.walSegmentSize); // ASSERT_EQ(req.schemaless, expect.schemaless); ASSERT_EQ(req.ignoreExist, expect.ignoreExist); ASSERT_EQ(req.numOfRetensions, expect.numOfRetensions); @@ -219,6 +231,10 @@ TEST_F(ParserInitialCTest, createDatabase) { setDbVgroupsFunc(100); setDbSingleStableFunc(1); setDbSchemalessFunc(1); + setDbWalRetentionPeriod(-1); + setDbWalRetentionSize(-1); + setDbWalRollPeriod(10); + setDbWalSegmentSize(20); run("CREATE DATABASE IF NOT EXISTS wxy_db " "BUFFER 64 " "CACHEMODEL 'last_value' " @@ -238,7 +254,11 @@ TEST_F(ParserInitialCTest, createDatabase) { "WAL 2 " "VGROUPS 100 " "SINGLE_STABLE 1 " - "SCHEMALESS 1"); + "SCHEMALESS 1 " + "WAL_RETENTION_PERIOD -1 " + "WAL_RETENTION_SIZE -1 " + "WAL_ROLL_PERIOD 10 " + "WAL_SEGMENT_SIZE 20"); clearCreateDbReq(); setCreateDbReqFunc("wxy_db", 1); From 8833a8bdfba45277df7debcc80863a39debac230 Mon Sep 17 00:00:00 2001 From: jiajingbin Date: Mon, 25 Jul 2022 21:39:12 +0800 Subject: [PATCH 37/54] fix: fix bug for TD-17801 --- source/libs/executor/src/projectoperator.c | 20 ++++++++++++++++---- source/libs/stream/src/streamExec.c | 6 ++++-- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/source/libs/executor/src/projectoperator.c b/source/libs/executor/src/projectoperator.c index 34149d7499..0ddbfbd4d7 100644 --- a/source/libs/executor/src/projectoperator.c +++ b/source/libs/executor/src/projectoperator.c @@ -68,9 +68,9 @@ SOperatorInfo* createProjectOperatorInfo(SOperatorInfo* downstream, SProjectPhys pInfo->mergeDataBlocks = pProjPhyNode->mergeDataBlock; // todo remove it soon - if (pTaskInfo->execModel == OPTR_EXEC_MODEL_STREAM) { - pInfo->mergeDataBlocks = true; - } + // if (pTaskInfo->execModel == OPTR_EXEC_MODEL_STREAM) { + // pInfo->mergeDataBlocks = true; + // } int32_t numOfRows = 4096; size_t keyBufSize = sizeof(int64_t) + sizeof(int64_t) + POINTER_BYTES; @@ -181,6 +181,16 @@ static int32_t doIngroupLimitOffset(SLimitInfo* pLimitInfo, uint64_t groupId, SS return PROJECT_RETRIEVE_DONE; } +void printDataBlock1(SSDataBlock* pBlock, const char* flag) { + if (!pBlock || pBlock->info.rows == 0) { + qDebug("===stream===printDataBlock: Block is Null or Empty"); + return; + } + char* pBuf = NULL; + qDebug("%s", dumpBlockData(pBlock, flag, &pBuf)); + taosMemoryFree(pBuf); +} + SSDataBlock* doProjectOperation(SOperatorInfo* pOperator) { SProjectOperatorInfo* pProjectInfo = pOperator->info; SOptrBasicInfo* pInfo = &pProjectInfo->binfo; @@ -229,6 +239,7 @@ SSDataBlock* doProjectOperation(SOperatorInfo* pOperator) { // for stream interval if (pBlock->info.type == STREAM_RETRIEVE) { + printDataBlock1(pBlock, "project1"); return pBlock; } @@ -302,7 +313,8 @@ SSDataBlock* doProjectOperation(SOperatorInfo* pOperator) { if (pOperator->cost.openCost == 0) { pOperator->cost.openCost = (taosGetTimestampUs() - st) / 1000.0; } - + + printDataBlock1(p, "project"); return (p->info.rows > 0) ? p : NULL; } diff --git a/source/libs/stream/src/streamExec.c b/source/libs/stream/src/streamExec.c index 52b610228e..f782de95b9 100644 --- a/source/libs/stream/src/streamExec.c +++ b/source/libs/stream/src/streamExec.c @@ -26,7 +26,7 @@ static int32_t streamTaskExecImpl(SStreamTask* pTask, void* data, SArray* pRes) } else if (pItem->type == STREAM_INPUT__DATA_SUBMIT) { ASSERT(pTask->isDataScan); SStreamDataSubmit* pSubmit = (SStreamDataSubmit*)data; - qDebug("task %d %p set submit input %p %p %d", pTask->taskId, pTask, pSubmit, pSubmit->data, *pSubmit->dataRef); + qDebug("task %d %p set submit input %p %p %d 1", pTask->taskId, pTask, pSubmit, pSubmit->data, *pSubmit->dataRef); qSetStreamInput(exec, pSubmit->data, STREAM_INPUT__DATA_SUBMIT, false); } else if (pItem->type == STREAM_INPUT__DATA_BLOCK || pItem->type == STREAM_INPUT__DATA_RETRIEVE) { SStreamDataBlock* pBlock = (SStreamDataBlock*)data; @@ -72,6 +72,8 @@ static int32_t streamTaskExecImpl(SStreamTask* pTask, void* data, SArray* pRes) continue; } + qDebug("task %d(child %d) executed and get block"); + SSDataBlock block = {0}; assignOneDataBlock(&block, output); block.info.childId = pTask->selfChildId; @@ -188,7 +190,7 @@ static SArray* streamExecForQall(SStreamTask* pTask, SArray* pRes) { if (pTask->execType == TASK_EXEC__NONE) { ASSERT(((SStreamQueueItem*)data)->type == STREAM_INPUT__DATA_BLOCK); streamTaskOutput(pTask, data); - return pRes; + continue; } qDebug("stream task %d exec begin, msg batch: %d", pTask->taskId, cnt); From 23f0feca92a4554286ef1d85845ba09766c4263e Mon Sep 17 00:00:00 2001 From: Liu Jicong Date: Mon, 25 Jul 2022 21:50:51 +0800 Subject: [PATCH 38/54] Update projectoperator.c --- source/libs/executor/src/projectoperator.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/source/libs/executor/src/projectoperator.c b/source/libs/executor/src/projectoperator.c index 4b0aa71004..1edc086551 100644 --- a/source/libs/executor/src/projectoperator.c +++ b/source/libs/executor/src/projectoperator.c @@ -190,7 +190,7 @@ void printDataBlock1(SSDataBlock* pBlock, const char* flag) { } char* pBuf = NULL; qDebug("%s", dumpBlockData(pBlock, flag, &pBuf)); - taosMemoryFree(pBuf); + taosMemoryFreeClear(pBuf); } SSDataBlock* doProjectOperation(SOperatorInfo* pOperator) { @@ -241,7 +241,7 @@ SSDataBlock* doProjectOperation(SOperatorInfo* pOperator) { // for stream interval if (pBlock->info.type == STREAM_RETRIEVE) { - printDataBlock1(pBlock, "project1"); + // printDataBlock1(pBlock, "project1"); return pBlock; } @@ -316,7 +316,7 @@ SSDataBlock* doProjectOperation(SOperatorInfo* pOperator) { pOperator->cost.openCost = (taosGetTimestampUs() - st) / 1000.0; } - printDataBlock1(p, "project"); + // printDataBlock1(p, "project"); return (p->info.rows > 0) ? p : NULL; } @@ -601,4 +601,4 @@ SSDataBlock* doGenerateSourceData(SOperatorInfo* pOperator) { } return (pRes->info.rows > 0) ? pRes : NULL; -} \ No newline at end of file +} From 9650f0b3b0d3394390317884d865ce0ce9592fd1 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Mon, 25 Jul 2022 22:14:10 +0800 Subject: [PATCH 39/54] enh: check stb conflict in trans --- source/dnode/mnode/impl/inc/mndDef.h | 4 ++-- source/dnode/mnode/impl/src/mndStb.c | 12 ++++++------ source/dnode/mnode/impl/src/mndTrans.c | 12 ++++++------ 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/source/dnode/mnode/impl/inc/mndDef.h b/source/dnode/mnode/impl/inc/mndDef.h index f6c92c3929..c9997fa3d5 100644 --- a/source/dnode/mnode/impl/inc/mndDef.h +++ b/source/dnode/mnode/impl/inc/mndDef.h @@ -164,8 +164,8 @@ typedef struct { int32_t lastErrorNo; tmsg_t lastMsgType; SEpSet lastEpset; - char dbname1[TSDB_DB_FNAME_LEN]; - char dbname2[TSDB_DB_FNAME_LEN]; + char dbname1[TSDB_TABLE_FNAME_LEN]; + char dbname2[TSDB_TABLE_FNAME_LEN]; int32_t startFunc; int32_t stopFunc; int32_t paramLen; diff --git a/source/dnode/mnode/impl/src/mndStb.c b/source/dnode/mnode/impl/src/mndStb.c index 45c59bad24..aab0c7e815 100644 --- a/source/dnode/mnode/impl/src/mndStb.c +++ b/source/dnode/mnode/impl/src/mndStb.c @@ -790,7 +790,7 @@ static int32_t mndCreateStb(SMnode *pMnode, SRpcMsg *pReq, SMCreateStbReq *pCrea SStbObj stbObj = {0}; int32_t code = -1; - STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_DB, pReq); + STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_DB_INSIDE, pReq); if (pTrans == NULL) goto _OVER; mDebug("trans:%d, used to create stb:%s", pTrans->id, pCreate->name); @@ -806,7 +806,7 @@ _OVER: } int32_t mndAddStbToTrans(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, SStbObj *pStb) { - mndTransSetDbName(pTrans, pDb->name, NULL); + mndTransSetDbName(pTrans, pDb->name, pStb->name); if (mndSetCreateStbRedoLogs(pMnode, pTrans, pDb, pStb) != 0) return -1; if (mndSetCreateStbUndoLogs(pMnode, pTrans, pDb, pStb) != 0) return -1; if (mndSetCreateStbCommitLogs(pMnode, pTrans, pDb, pStb) != 0) return -1; @@ -1609,11 +1609,11 @@ static int32_t mndBuildSMAlterStbRsp(SDbObj *pDb, SStbObj *pObj, void **pCont, i static int32_t mndAlterStbImp(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pDb, SStbObj *pStb, bool needRsp, void* alterOriData, int32_t alterOriDataLen) { int32_t code = -1; - STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_DB, pReq); + STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_DB_INSIDE, pReq); if (pTrans == NULL) goto _OVER; mDebug("trans:%d, used to alter stb:%s", pTrans->id, pStb->name); - mndTransSetDbName(pTrans, pDb->name, NULL); + mndTransSetDbName(pTrans, pDb->name, pStb->name); if (needRsp) { void *pCont = NULL; @@ -1808,11 +1808,11 @@ static int32_t mndSetDropStbRedoActions(SMnode *pMnode, STrans *pTrans, SDbObj * static int32_t mndDropStb(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pDb, SStbObj *pStb) { int32_t code = -1; - STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_DB, pReq); + STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_DB_INSIDE, pReq); if (pTrans == NULL) goto _OVER; mDebug("trans:%d, used to drop stb:%s", pTrans->id, pStb->name); - mndTransSetDbName(pTrans, pDb->name, NULL); + mndTransSetDbName(pTrans, pDb->name, pStb->name); if (mndSetDropStbRedoLogs(pMnode, pTrans, pStb) != 0) goto _OVER; if (mndSetDropStbCommitLogs(pMnode, pTrans, pStb) != 0) goto _OVER; diff --git a/source/dnode/mnode/impl/src/mndTrans.c b/source/dnode/mnode/impl/src/mndTrans.c index 2321f40a16..2d7117c11f 100644 --- a/source/dnode/mnode/impl/src/mndTrans.c +++ b/source/dnode/mnode/impl/src/mndTrans.c @@ -127,8 +127,8 @@ static SSdbRaw *mndTransActionEncode(STrans *pTrans) { SDB_SET_INT8(pRaw, dataPos, 0, _OVER) SDB_SET_INT8(pRaw, dataPos, 0, _OVER) SDB_SET_INT64(pRaw, dataPos, pTrans->createdTime, _OVER) - SDB_SET_BINARY(pRaw, dataPos, pTrans->dbname1, TSDB_DB_FNAME_LEN, _OVER) - SDB_SET_BINARY(pRaw, dataPos, pTrans->dbname2, TSDB_DB_FNAME_LEN, _OVER) + SDB_SET_BINARY(pRaw, dataPos, pTrans->dbname1, TSDB_TABLE_FNAME_LEN, _OVER) + SDB_SET_BINARY(pRaw, dataPos, pTrans->dbname2, TSDB_TABLE_FNAME_LEN, _OVER) SDB_SET_INT32(pRaw, dataPos, pTrans->redoActionPos, _OVER) int32_t redoActionNum = taosArrayGetSize(pTrans->redoActions); @@ -290,8 +290,8 @@ static SSdbRow *mndTransActionDecode(SSdbRaw *pRaw) { pTrans->exec = exec; pTrans->oper = oper; SDB_GET_INT64(pRaw, dataPos, &pTrans->createdTime, _OVER) - SDB_GET_BINARY(pRaw, dataPos, pTrans->dbname1, TSDB_DB_FNAME_LEN, _OVER) - SDB_GET_BINARY(pRaw, dataPos, pTrans->dbname2, TSDB_DB_FNAME_LEN, _OVER) + SDB_GET_BINARY(pRaw, dataPos, pTrans->dbname1, TSDB_TABLE_FNAME_LEN, _OVER) + SDB_GET_BINARY(pRaw, dataPos, pTrans->dbname2, TSDB_TABLE_FNAME_LEN, _OVER) SDB_GET_INT32(pRaw, dataPos, &pTrans->redoActionPos, _OVER) SDB_GET_INT32(pRaw, dataPos, &redoActionNum, _OVER) SDB_GET_INT32(pRaw, dataPos, &undoActionNum, _OVER) @@ -727,10 +727,10 @@ int32_t mndSetRpcInfoForDbTrans(SMnode *pMnode, SRpcMsg *pMsg, EOperType oper, c void mndTransSetDbName(STrans *pTrans, const char *dbname1, const char *dbname2) { if (dbname1 != NULL) { - memcpy(pTrans->dbname1, dbname1, TSDB_DB_FNAME_LEN); + tstrncpy(pTrans->dbname1, dbname1, TSDB_TABLE_FNAME_LEN); } if (dbname2 != NULL) { - memcpy(pTrans->dbname2, dbname2, TSDB_DB_FNAME_LEN); + tstrncpy(pTrans->dbname2, dbname2, TSDB_TABLE_FNAME_LEN); } } From b97f9bfcad479782db892f211a9776414722efde Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Tue, 26 Jul 2022 09:48:43 +0800 Subject: [PATCH 40/54] fix: fix load_table_info error --- source/client/src/clientImpl.c | 2 +- source/client/src/clientMain.c | 2 +- source/libs/executor/src/dataDeleter.c | 5 ++++- source/libs/executor/src/executor.c | 1 + source/libs/qworker/src/qworker.c | 2 ++ 5 files changed, 9 insertions(+), 3 deletions(-) diff --git a/source/client/src/clientImpl.c b/source/client/src/clientImpl.c index 03238e6747..eecb22abe5 100644 --- a/source/client/src/clientImpl.c +++ b/source/client/src/clientImpl.c @@ -2019,7 +2019,7 @@ int32_t transferTableNameList(const char* tbList, int32_t acctId, char* dbName, } if (('a' <= *(tbList + i) && 'z' >= *(tbList + i)) || ('A' <= *(tbList + i) && 'Z' >= *(tbList + i)) || - ('0' <= *(tbList + i) && '9' >= *(tbList + i))) { + ('0' <= *(tbList + i) && '9' >= *(tbList + i)) || ('_' == *(tbList + i))) { if (vLen[vIdx] > 0) { goto _return; } diff --git a/source/client/src/clientMain.c b/source/client/src/clientMain.c index 77b31011a3..416d50d987 100644 --- a/source/client/src/clientMain.c +++ b/source/client/src/clientMain.c @@ -973,7 +973,7 @@ int taos_load_table_info(TAOS *taos, const char *tableNameList) { conn.mgmtEps = getEpSet_s(&pTscObj->pAppInfo->mgmtEp); - code = catalogAsyncGetAllMeta(pCtg, &conn, &catalogReq, syncCatalogFn, NULL, NULL); + code = catalogAsyncGetAllMeta(pCtg, &conn, &catalogReq, syncCatalogFn, pRequest->body.param, NULL); if (code) { goto _return; } diff --git a/source/libs/executor/src/dataDeleter.c b/source/libs/executor/src/dataDeleter.c index 3c56abbd15..a0d4d64bff 100644 --- a/source/libs/executor/src/dataDeleter.c +++ b/source/libs/executor/src/dataDeleter.c @@ -182,7 +182,8 @@ static int32_t getDataBlock(SDataSinkHandle* pHandle, SOutputData* pOutput) { return TSDB_CODE_SUCCESS; } SDataCacheEntry* pEntry = (SDataCacheEntry*)(pDeleter->nextOutput.pData); - memcpy(pOutput->pData, pEntry->data, pEntry->dataLen); + memcpy(pOutput->pData, pEntry->data, pEntry->dataLen); + pDeleter->pParam->pUidList = NULL; pOutput->numOfRows = pEntry->numOfRows; pOutput->numOfCols = pEntry->numOfCols; pOutput->compressed = pEntry->compressed; @@ -205,6 +206,8 @@ static int32_t destroyDataSinker(SDataSinkHandle* pHandle) { SDataDeleterHandle* pDeleter = (SDataDeleterHandle*)pHandle; atomic_sub_fetch_64(&gDataSinkStat.cachedSize, pDeleter->cachedSize); taosMemoryFreeClear(pDeleter->nextOutput.pData); + taosArrayDestroy(pDeleter->pParam->pUidList); + taosMemoryFree(pDeleter->pParam); while (!taosQueueEmpty(pDeleter->pDataBlocks)) { SDataDeleterBuf* pBuf = NULL; taosReadQitem(pDeleter->pDataBlocks, (void**)&pBuf); diff --git a/source/libs/executor/src/executor.c b/source/libs/executor/src/executor.c index d8cd76d31e..f249321a76 100644 --- a/source/libs/executor/src/executor.c +++ b/source/libs/executor/src/executor.c @@ -416,6 +416,7 @@ int32_t qExecTask(qTaskInfo_t tinfo, SSDataBlock** pRes, uint64_t* useconds) { } if (isTaskKilled(pTaskInfo)) { + atomic_store_64(&pTaskInfo->owner, 0); qDebug("%s already killed, abort", GET_TASKID(pTaskInfo)); return TSDB_CODE_SUCCESS; } diff --git a/source/libs/qworker/src/qworker.c b/source/libs/qworker/src/qworker.c index d77e42388b..e09887e651 100644 --- a/source/libs/qworker/src/qworker.c +++ b/source/libs/qworker/src/qworker.c @@ -283,6 +283,8 @@ int32_t qwGetDeleteResFromSink(QW_FPARAMS_DEF, SQWTaskCtx *ctx, SDeleteRes *pRes pRes->skey = pDelRes->skey; pRes->ekey = pDelRes->ekey; pRes->affectedRows = pDelRes->affectedRows; + + taosMemoryFree(output.pData); return TSDB_CODE_SUCCESS; } From 35ddd566915beba0438c994b7f79a75b0ab987e9 Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Tue, 26 Jul 2022 09:55:21 +0800 Subject: [PATCH 41/54] feat(stream): refector some log --- source/common/src/tdatablock.c | 4 +- source/libs/executor/inc/executorimpl.h | 1 + source/libs/executor/src/timewindowoperator.c | 48 +++++++++---------- tests/script/jenkins/basic.txt | 2 +- 4 files changed, 28 insertions(+), 27 deletions(-) diff --git a/source/common/src/tdatablock.c b/source/common/src/tdatablock.c index f0b5de9838..e516bddac1 100644 --- a/source/common/src/tdatablock.c +++ b/source/common/src/tdatablock.c @@ -1763,9 +1763,9 @@ char* dumpBlockData(SSDataBlock* pDataBlock, const char* flag, char** pDataBuf) int32_t colNum = taosArrayGetSize(pDataBlock->pDataBlock); int32_t rows = pDataBlock->info.rows; int32_t len = 0; - len += snprintf(dumpBuf + len, size - len, "===stream===%s |block type %d |child id %d|group id:%" PRIu64 "| uid:%ld|\n", flag, + len += snprintf(dumpBuf + len, size - len, "===stream===%s |block type %d|child id %d|group id:%" PRIu64 "|uid:%ld|rows:%d\n", flag, (int32_t)pDataBlock->info.type, pDataBlock->info.childId, pDataBlock->info.groupId, - pDataBlock->info.uid); + pDataBlock->info.uid, pDataBlock->info.rows); if (len >= size - 1) return dumpBuf; for (int32_t j = 0; j < rows; j++) { diff --git a/source/libs/executor/inc/executorimpl.h b/source/libs/executor/inc/executorimpl.h index 0beb6f1784..ce782c7a8f 100644 --- a/source/libs/executor/inc/executorimpl.h +++ b/source/libs/executor/inc/executorimpl.h @@ -1000,6 +1000,7 @@ int32_t updateSessionWindowInfo(SResultWindowInfo* pWinInfo, TSKEY* pStartTs, bool functionNeedToExecute(SqlFunctionCtx* pCtx); bool isCloseWindow(STimeWindow* pWin, STimeWindowAggSupp* pSup); void appendOneRow(SSDataBlock* pBlock, TSKEY* pStartTs, TSKEY* pEndTs, uint64_t* pUid); +void printDataBlock(SSDataBlock* pBlock, const char* flag); int32_t finalizeResultRowIntoResultDataBlock(SDiskbasedBuf* pBuf, SResultRowPosition* resultRowPosition, SqlFunctionCtx* pCtx, SExprInfo* pExprInfo, int32_t numOfExprs, const int32_t* rowCellOffset, diff --git a/source/libs/executor/src/timewindowoperator.c b/source/libs/executor/src/timewindowoperator.c index 1e001a29a0..d69ceaf8df 100644 --- a/source/libs/executor/src/timewindowoperator.c +++ b/source/libs/executor/src/timewindowoperator.c @@ -2769,7 +2769,7 @@ static SSDataBlock* doStreamFinalIntervalAgg(SOperatorInfo* pOperator) { SExprSupp* pSup = &pOperator->exprSupp; - qDebug("interval status %d %s", pOperator->status, IS_FINAL_OP(pInfo) ? "interval Final" : "interval Semi"); + qDebug("interval status %d %s", pOperator->status, IS_FINAL_OP(pInfo) ? "interval final" : "interval semi"); if (pOperator->status == OP_EXEC_DONE) { return NULL; @@ -2778,7 +2778,7 @@ static SSDataBlock* doStreamFinalIntervalAgg(SOperatorInfo* pOperator) { if (pInfo->pPullDataRes->info.rows != 0) { // process the rest of the data ASSERT(IS_FINAL_OP(pInfo)); - printDataBlock(pInfo->pPullDataRes, IS_FINAL_OP(pInfo) ? "interval Final" : "interval Semi"); + printDataBlock(pInfo->pPullDataRes, IS_FINAL_OP(pInfo) ? "interval final" : "interval semi"); return pInfo->pPullDataRes; } @@ -2793,20 +2793,20 @@ static SSDataBlock* doStreamFinalIntervalAgg(SOperatorInfo* pOperator) { } return NULL; } - printDataBlock(pInfo->binfo.pRes, IS_FINAL_OP(pInfo) ? "interval Final" : "interval Semi"); + printDataBlock(pInfo->binfo.pRes, IS_FINAL_OP(pInfo) ? "interval final" : "interval semi"); return pInfo->binfo.pRes; } else { if (!IS_FINAL_OP(pInfo)) { doBuildResultDatablock(pOperator, &pInfo->binfo, &pInfo->groupResInfo, pInfo->aggSup.pResultBuf); if (pInfo->binfo.pRes->info.rows != 0) { - printDataBlock(pInfo->binfo.pRes, IS_FINAL_OP(pInfo) ? "interval Final" : "interval Semi"); + printDataBlock(pInfo->binfo.pRes, IS_FINAL_OP(pInfo) ? "interval final" : "interval semi"); return pInfo->binfo.pRes; } } if (pInfo->pUpdateRes->info.rows != 0 && pInfo->returnUpdate) { pInfo->returnUpdate = false; ASSERT(!IS_FINAL_OP(pInfo)); - printDataBlock(pInfo->pUpdateRes, IS_FINAL_OP(pInfo) ? "interval Final" : "interval Semi"); + printDataBlock(pInfo->pUpdateRes, IS_FINAL_OP(pInfo) ? "interval final" : "interval semi"); // process the rest of the data return pInfo->pUpdateRes; } @@ -2814,13 +2814,13 @@ static SSDataBlock* doStreamFinalIntervalAgg(SOperatorInfo* pOperator) { // if (pInfo->pPullDataRes->info.rows != 0) { // // process the rest of the data // ASSERT(IS_FINAL_OP(pInfo)); - // printDataBlock(pInfo->pPullDataRes, IS_FINAL_OP(pInfo) ? "interval Final" : "interval Semi"); + // printDataBlock(pInfo->pPullDataRes, IS_FINAL_OP(pInfo) ? "interval final" : "interval semi"); // return pInfo->pPullDataRes; // } doBuildDeleteResult(pInfo->pDelWins, &pInfo->delIndex, pInfo->pDelRes); if (pInfo->pDelRes->info.rows != 0) { // process the rest of the data - printDataBlock(pInfo->pDelRes, IS_FINAL_OP(pInfo) ? "interval Final" : "interval Semi"); + printDataBlock(pInfo->pDelRes, IS_FINAL_OP(pInfo) ? "interval final" : "interval semi"); return pInfo->pDelRes; } } @@ -2831,10 +2831,10 @@ static SSDataBlock* doStreamFinalIntervalAgg(SOperatorInfo* pOperator) { clearSpecialDataBlock(pInfo->pUpdateRes); removeDeleteResults(pUpdated, pInfo->pDelWins); pOperator->status = OP_RES_TO_RETURN; - qDebug("%s return data", IS_FINAL_OP(pInfo) ? "interval Final" : "interval Semi"); + qDebug("%s return data", IS_FINAL_OP(pInfo) ? "interval final" : "interval semi"); break; } - printDataBlock(pBlock, IS_FINAL_OP(pInfo) ? "interval Final recv" : "interval Semi recv"); + printDataBlock(pBlock, IS_FINAL_OP(pInfo) ? "interval final recv" : "interval semi recv"); maxTs = TMAX(maxTs, pBlock->info.window.ekey); if (pBlock->info.type == STREAM_NORMAL || pBlock->info.type == STREAM_PULL_DATA || @@ -2934,20 +2934,20 @@ static SSDataBlock* doStreamFinalIntervalAgg(SOperatorInfo* pOperator) { if (pInfo->pPullDataRes->info.rows != 0) { // process the rest of the data ASSERT(IS_FINAL_OP(pInfo)); - printDataBlock(pInfo->pPullDataRes, IS_FINAL_OP(pInfo) ? "interval Final" : "interval Semi"); + printDataBlock(pInfo->pPullDataRes, IS_FINAL_OP(pInfo) ? "interval final" : "interval semi"); return pInfo->pPullDataRes; } doBuildResultDatablock(pOperator, &pInfo->binfo, &pInfo->groupResInfo, pInfo->aggSup.pResultBuf); if (pInfo->binfo.pRes->info.rows != 0) { - printDataBlock(pInfo->binfo.pRes, IS_FINAL_OP(pInfo) ? "interval Final" : "interval Semi"); + printDataBlock(pInfo->binfo.pRes, IS_FINAL_OP(pInfo) ? "interval final" : "interval semi"); return pInfo->binfo.pRes; } if (pInfo->pUpdateRes->info.rows != 0 && pInfo->returnUpdate) { pInfo->returnUpdate = false; ASSERT(!IS_FINAL_OP(pInfo)); - printDataBlock(pInfo->pUpdateRes, IS_FINAL_OP(pInfo) ? "interval Final" : "interval Semi"); + printDataBlock(pInfo->pUpdateRes, IS_FINAL_OP(pInfo) ? "interval final" : "interval semi"); // process the rest of the data return pInfo->pUpdateRes; } @@ -2955,7 +2955,7 @@ static SSDataBlock* doStreamFinalIntervalAgg(SOperatorInfo* pOperator) { doBuildDeleteResult(pInfo->pDelWins, &pInfo->delIndex, pInfo->pDelRes); if (pInfo->pDelRes->info.rows != 0) { // process the rest of the data - printDataBlock(pInfo->pDelRes, IS_FINAL_OP(pInfo) ? "interval Final" : "interval Semi"); + printDataBlock(pInfo->pDelRes, IS_FINAL_OP(pInfo) ? "interval final" : "interval semi"); return pInfo->pDelRes; } // ASSERT(false); @@ -3815,14 +3815,14 @@ static SSDataBlock* doStreamSessionAgg(SOperatorInfo* pOperator) { } else if (pOperator->status == OP_RES_TO_RETURN) { doBuildDeleteDataBlock(pInfo->pStDeleted, pInfo->pDelRes, &pInfo->pDelIterator); if (pInfo->pDelRes->info.rows > 0) { - printDataBlock(pInfo->pDelRes, IS_FINAL_OP(pInfo) ? "Final Session" : "Single Session"); + printDataBlock(pInfo->pDelRes, IS_FINAL_OP(pInfo) ? "final session" : "single session"); return pInfo->pDelRes; } doBuildResultDatablock(pOperator, pBInfo, &pInfo->groupResInfo, pInfo->streamAggSup.pResultBuf); if (pBInfo->pRes->info.rows == 0 || !hasDataInGroupInfo(&pInfo->groupResInfo)) { doSetOperatorCompleted(pOperator); } - printDataBlock(pBInfo->pRes, IS_FINAL_OP(pInfo) ? "Final Session" : "Single Session"); + printDataBlock(pBInfo->pRes, IS_FINAL_OP(pInfo) ? "final session" : "single session"); return pBInfo->pRes->info.rows == 0 ? NULL : pBInfo->pRes; } @@ -3835,7 +3835,7 @@ static SSDataBlock* doStreamSessionAgg(SOperatorInfo* pOperator) { if (pBlock == NULL) { break; } - printDataBlock(pBlock, IS_FINAL_OP(pInfo) ? "Final Session Recv" : "Single Session Recv"); + printDataBlock(pBlock, IS_FINAL_OP(pInfo) ? "final session recv" : "single session recv"); if (pBlock->info.type == STREAM_CLEAR) { SArray* pWins = taosArrayInit(16, sizeof(SResultWindowInfo)); @@ -3912,11 +3912,11 @@ static SSDataBlock* doStreamSessionAgg(SOperatorInfo* pOperator) { blockDataEnsureCapacity(pInfo->binfo.pRes, pOperator->resultInfo.capacity); doBuildDeleteDataBlock(pInfo->pStDeleted, pInfo->pDelRes, &pInfo->pDelIterator); if (pInfo->pDelRes->info.rows > 0) { - printDataBlock(pInfo->pDelRes, IS_FINAL_OP(pInfo) ? "Final Session" : "Single Session"); + printDataBlock(pInfo->pDelRes, IS_FINAL_OP(pInfo) ? "final session" : "single session"); return pInfo->pDelRes; } doBuildResultDatablock(pOperator, &pInfo->binfo, &pInfo->groupResInfo, pInfo->streamAggSup.pResultBuf); - printDataBlock(pBInfo->pRes, IS_FINAL_OP(pInfo) ? "Final Session" : "Single Session"); + printDataBlock(pBInfo->pRes, IS_FINAL_OP(pInfo) ? "final session" : "single session"); return pBInfo->pRes->info.rows == 0 ? NULL : pBInfo->pRes; } @@ -3955,21 +3955,21 @@ static SSDataBlock* doStreamSessionSemiAgg(SOperatorInfo* pOperator) { } else if (pOperator->status == OP_RES_TO_RETURN) { doBuildResultDatablock(pOperator, pBInfo, &pInfo->groupResInfo, pInfo->streamAggSup.pResultBuf); if (pBInfo->pRes->info.rows > 0) { - printDataBlock(pBInfo->pRes, "Semi Session"); + printDataBlock(pBInfo->pRes, "sems session"); return pBInfo->pRes; } // doBuildDeleteDataBlock(pInfo->pStDeleted, pInfo->pDelRes, &pInfo->pDelIterator); if (pInfo->pDelRes->info.rows > 0 && !pInfo->returnDelete) { pInfo->returnDelete = true; - printDataBlock(pInfo->pDelRes, "Semi Session"); + printDataBlock(pInfo->pDelRes, "sems session"); return pInfo->pDelRes; } if (pInfo->pUpdateRes->info.rows > 0) { // process the rest of the data pOperator->status = OP_OPENED; - printDataBlock(pInfo->pUpdateRes, "Semi Session"); + printDataBlock(pInfo->pUpdateRes, "sems session"); return pInfo->pUpdateRes; } // semi interval operator clear disk buffer @@ -4033,21 +4033,21 @@ static SSDataBlock* doStreamSessionSemiAgg(SOperatorInfo* pOperator) { doBuildResultDatablock(pOperator, pBInfo, &pInfo->groupResInfo, pInfo->streamAggSup.pResultBuf); if (pBInfo->pRes->info.rows > 0) { - printDataBlock(pBInfo->pRes, "Semi Session"); + printDataBlock(pBInfo->pRes, "sems session"); return pBInfo->pRes; } // doBuildDeleteDataBlock(pInfo->pStDeleted, pInfo->pDelRes, &pInfo->pDelIterator); if (pInfo->pDelRes->info.rows > 0 && !pInfo->returnDelete) { pInfo->returnDelete = true; - printDataBlock(pInfo->pDelRes, "Semi Session"); + printDataBlock(pInfo->pDelRes, "sems session"); return pInfo->pDelRes; } if (pInfo->pUpdateRes->info.rows > 0) { // process the rest of the data pOperator->status = OP_OPENED; - printDataBlock(pInfo->pUpdateRes, "Semi Session"); + printDataBlock(pInfo->pUpdateRes, "sems session"); return pInfo->pUpdateRes; } diff --git a/tests/script/jenkins/basic.txt b/tests/script/jenkins/basic.txt index a606311f3c..0c19e4a2fe 100644 --- a/tests/script/jenkins/basic.txt +++ b/tests/script/jenkins/basic.txt @@ -224,7 +224,7 @@ # ---- stream ./test.sh -f tsim/stream/basic0.sim -#./test.sh -f tsim/stream/basic1.sim +./test.sh -f tsim/stream/basic1.sim ./test.sh -f tsim/stream/basic2.sim ./test.sh -f tsim/stream/drop_stream.sim ./test.sh -f tsim/stream/distributeInterval0.sim From ac3755661c6a199faba69633c59123b700a227ca Mon Sep 17 00:00:00 2001 From: gccgdb1234 Date: Tue, 26 Jul 2022 10:05:15 +0800 Subject: [PATCH 42/54] doc: refine get started docker page --- docs/zh/05-get-started/01-docker.md | 359 +++++++--------------------- docs/zh/05-get-started/index.md | 1 + 2 files changed, 89 insertions(+), 271 deletions(-) diff --git a/docs/zh/05-get-started/01-docker.md b/docs/zh/05-get-started/01-docker.md index 9ff67fa604..c50f187fdb 100644 --- a/docs/zh/05-get-started/01-docker.md +++ b/docs/zh/05-get-started/01-docker.md @@ -3,11 +3,31 @@ sidebar_label: Docker title: 通过 Docker 快速体验 TDengine --- -虽然并不推荐在生产环境中通过 Docker 来部署 TDengine 服务,但 Docker 工具能够很好地屏蔽底层操作系统的环境差异,很适合在开发测试或初次体验时用于安装运行 TDengine 的工具集。特别是,借助 Docker,能够比较方便地在 macOS 和 Windows 系统上尝试 TDengine,而无需安装虚拟机或额外租用 Linux 服务器。另外,从 2.0.14.0 版本开始,TDengine 提供的镜像已经可以同时支持 X86-64、X86、arm64、arm32 平台,像 NAS、树莓派、嵌入式开发板之类可以运行 docker 的非主流计算机也可以基于本文档轻松体验 TDengine。 +本节首先介绍如何通过 Docker 快速体验 TDengine,然后介绍如何在 Docker 环境下体验 TDengine 的写入和查询功能。 -下文通过 Step by Step 风格的介绍,讲解如何通过 Docker 快速建立 TDengine 的单节点运行环境,以支持开发和测试。 +## 启动 TDengine -## 下载 Docker +如果已经安装了 docker, 只需执行下面的命令。 + +```shell +docker run -d -p 6030-6049:6030-6049 -p 6030-6049:6030-6049/udp tdengine/tdengine +``` + +确定该容器已经启动并且在正常运行 + +```shell +docker ps +``` + +进入该容器并执行 bash + +```shell +docker exec -it bash +``` + +然后就可以执行相关的 Linux 命令操作和访问 TDengine + +:::info Docker 工具自身的下载请参考 [Docker 官网文档](https://docs.docker.com/get-docker/)。 @@ -18,95 +38,49 @@ $ docker -v Docker version 20.10.3, build 48d30b5 ``` -## 使用 Docker 在容器中运行 TDengine +::: -### 在 Docker 容器中运行 TDengine server +## 运行 TDengine CLI -```bash -$ docker run -d -p 6030-6049:6030-6049 -p 6030-6049:6030-6049/udp tdengine/tdengine -526aa188da767ae94b244226a2b2eec2b5f17dd8eff592893d9ec0cd0f3a1ccd -``` - -这条命令,启动一个运行了 TDengine server 的 docker 容器,并且将容器的 6030 到 6049 端口映射到宿主机的 6030 到 6049 端口上。如果宿主机已经运行了 TDengine server 并占用了相同端口,需要映射容器的端口到不同的未使用端口段。(详情参见 [TDengine 2.0 端口说明](/train-faq/faq#port)。为了支持 TDengine 客户端操作 TDengine server 服务, TCP 和 UDP 端口都需要打开。 - -- **docker run**:通过 Docker 运行一个容器 -- **-d**:让容器在后台运行 -- **-p**:指定映射端口。注意:如果不是用端口映射,依然可以进入 Docker 容器内部使用 TDengine 服务或进行应用开发,只是不能对容器外部提供服务 -- **tdengine/tdengine**:拉取的 TDengine 官方发布的应用镜像 -- **526aa188da767ae94b244226a2b2eec2b5f17dd8eff592893d9ec0cd0f3a1ccd**:这个返回的长字符是容器 ID,我们也可以通过容器 ID 来查看对应的容器 - -进一步,还可以使用 docker run 命令启动运行 TDengine server 的 docker 容器,并使用 `--name` 命令行参数将容器命名为 `tdengine`,使用 `--hostname` 指定 hostname 为 `tdengine-server`,通过 `-v` 挂载本地目录到容器,实现宿主机与容器内部的数据同步,防止容器删除后,数据丢失。 - -```bash -docker run -d --name tdengine --hostname="tdengine-server" -v ~/work/taos/log:/var/log/taos -v ~/work/taos/data:/var/lib/taos -p 6030-6049:6030-6049 -p 6030-6049:6030-6049/udp tdengine/tdengine -``` - -- **--name tdengine**:设置容器名称,我们可以通过容器名称来访问对应的容器 -- **--hostname=tdengine-server**:设置容器内 Linux 系统的 hostname,我们可以通过映射 hostname 和 IP 来解决容器 IP 可能变化的问题。 -- **-v**:设置宿主机文件目录映射到容器内目录,避免容器删除后数据丢失。 - -### 使用 docker ps 命令确认容器是否已经正确运行 - -```bash -docker ps -``` - -输出示例如下: - -``` -CONTAINER ID IMAGE COMMAND CREATED STATUS ··· -c452519b0f9b tdengine/tdengine "taosd" 14 minutes ago Up 14 minutes ··· -``` - -- **docker ps**:列出所有正在运行状态的容器信息。 -- **CONTAINER ID**:容器 ID。 -- **IMAGE**:使用的镜像。 -- **COMMAND**:启动容器时运行的命令。 -- **CREATED**:容器创建时间。 -- **STATUS**:容器状态。UP 表示运行中。 - -### 通过 docker exec 命令,进入到 docker 容器中去做开发 - -```bash -$ docker exec -it tdengine /bin/bash -root@tdengine-server:~/TDengine-server-2.4.0.4# -``` - -- **docker exec**:通过 docker exec 命令进入容器,如果退出,容器不会停止。 -- **-i**:进入交互模式。 -- **-t**:指定一个终端。 -- **tdengine**:容器名称,需要根据 docker ps 指令返回的值进行修改。 -- **/bin/bash**:载入容器后运行 bash 来进行交互。 - -进入容器后,执行 taos shell 客户端程序。 - -```bash -root@tdengine-server:~/TDengine-server-2.4.0.4# taos - -Welcome to the TDengine shell from Linux, Client Version:2.4.0.4 -Copyright (c) 2020 by TAOS Data, Inc. All rights reserved. - -taos> -``` - -TDengine 终端成功连接服务端,打印出了欢迎消息和版本信息。如果失败,会有错误信息打印出来。 - -在 TDengine 终端中,可以通过 SQL 命令来创建/删除数据库、表、超级表等,并可以进行插入和查询操作。具体可以参考 [TAOS SQL 说明文档](/taos-sql/)。 - -### 在宿主机访问 Docker 容器中的 TDengine server - -在使用了 -p 命令行参数映射了正确的端口启动了 TDengine Docker 容器后,就在宿主机使用 taos shell 命令即可访问运行在 Docker 容器中的 TDengine。 +有两种方式在 Docker 环境下使用 TDengine CLI (taos) 访问 TDengine. +- 进入容器后,执行 taos +- 在宿主机使用容器映射到主机的端口进行访问 `taos -h -P ` ``` $ taos +Welcome to the TDengine shell from Linux, Client Version:3.0.0.0 +Copyright (c) 2022 by TAOS Data, Inc. All rights reserved. -Welcome to the TDengine shell from Linux, Client Version:2.4.0.4 -Copyright (c) 2020 by TAOS Data, Inc. All rights reserved. +Server is Enterprise trial Edition, ver:3.0.0.0 and will expire at 2022-09-24 15:29:46. + +taos> -taos> ``` -也可以在宿主机使用 curl 通过 RESTful 端口访问 Docker 容器内的 TDengine server。 + +### 启动 REST 服务 + +taosAdapter 是 TDengine 中提供 REST 服务的组件。下面这条命令会在容器中同时启动 `taosd` 和 `taosadapter` 两个服务组件。 + +```bash +docker run -d --name tdengine-all -p 6030-6049:6030-6049 -p 6030-6049:6030-6049/udp tdengine/tdengine +``` + +如果想只启动 `taosadapter`: + +```bash +docker run -d --name tdengine-taosa -p 6041-6049:6041-6049 -p 6041-6049:6041-6049/udp -e TAOS_FIRST_EP=tdengine-all tdengine/tdengine:3.0.0.0 taosadapter +``` + +如果想只启动 `taosd`: + +```bash +docker run -d --name tdengine-taosd -p 6030-6042:6030-6042 -p 6030-6042:6030-6042/udp -e TAOS_DISABLE_ADAPTER=true tdengine/tdengine:3.0.0.0 +``` + +## 访问 REST 接口 + +可以在宿主机使用 curl 通过 RESTful 端口访问 Docker 容器内的 TDengine server。 ``` curl -L -u root:taosdata -d "show databases" 127.0.0.1:6041/rest/sql @@ -115,217 +89,60 @@ curl -L -u root:taosdata -d "show databases" 127.0.0.1:6041/rest/sql 输出示例如下: ``` -{"status":"succ","head":["name","created_time","ntables","vgroups","replica","quorum","days","keep0,keep1,keep(D)","cache(MB)","blocks","minrows","maxrows","wallevel","fsync","comp","cachelast","precision","update","status"],"column_meta":[["name",8,32],["created_time",9,8],["ntables",4,4],["vgroups",4,4],["replica",3,2],["quorum",3,2],["days",3,2],["keep0,keep1,keep(D)",8,24],["cache(MB)",4,4],["blocks",4,4],["minrows",4,4],["maxrows",4,4],["wallevel",2,1],["fsync",4,4],["comp",2,1],["cachelast",2,1],["precision",8,3],["update",2,1],["status",8,10]],"data":[["test","2021-08-18 06:01:11.021",10000,4,1,1,10,"3650,3650,3650",16,6,100,4096,1,3000,2,0,"ms",0,"ready"],["log","2021-08-18 05:51:51.065",4,1,1,1,10,"30,30,30",1,3,100,4096,1,3000,2,0,"us",0,"ready"]],"rows":2} +{"code":0,"column_meta":[["name","VARCHAR",64],["create_time","TIMESTAMP",8],["vgroups","SMALLINT",2],["ntables","BIGINT",8],["replica","TINYINT",1],["strict","VARCHAR",4],["duration","VARCHAR",10],["keep","VARCHAR",32],["buffer","INT",4],["pagesize","INT",4],["pages","INT",4],["minrows","INT",4],["maxrows","INT",4],["wal","TINYINT",1],["fsync","INT",4],["comp","TINYINT",1],["cacheModel","VARCHAR",11],["precision","VARCHAR",2],["single_stable","BOOL",1],["status","VARCHAR",10],["retention","VARCHAR",60]],"data":[["information_schema",null,null,14,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,"ready"],["performance_schema",null,null,3,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,"ready"]],"rows":2} ``` -这条命令,通过 REST API 访问 TDengine server,这时连接的是本机的 6041 端口,可见连接成功。 +这条命令,通过 REST API 访问 TDengine server,这时连接的是从容器映射到主机的 6041 端口。 TDengine REST API 详情请参考[官方文档](/reference/rest-api/)。 -### 使用 Docker 容器运行 TDengine server 和 taosAdapter +## 写入数据 -在 TDengine 2.4.0.0 之后版本的 Docker 容器,开始提供一个独立运行的组件 taosAdapter,代替之前版本 TDengine 中 taosd 进程中内置的 http server。taosAdapter 支持通过 RESTful 接口对 TDengine server 的数据写入和查询能力,并提供和 InfluxDB/OpenTSDB 兼容的数据摄取接口,允许 InfluxDB/OpenTSDB 应用程序无缝移植到 TDengine。在新版本 Docker 镜像中,默认启用了 taosAdapter,也可以使用 docker run 命令中设置 TAOS_DISABLE_ADAPTER=true 来禁用 taosAdapter;也可以在 docker run 命令中单独使用 taosAdapter,而不运行 taosd 。 +可以使用 TDengine 的自带工具 taosBenchmark 快速体验 TDengine 的写入。 -注意:如果容器中运行 taosAdapter,需要根据需要映射其他端口,具体端口默认配置和修改方法请参考[taosAdapter 文档](/reference/taosadapter/)。 - -使用 docker 运行 TDengine 2.4.0.4 版本镜像(taosd + taosAdapter): - -```bash -docker run -d --name tdengine-all -p 6030-6049:6030-6049 -p 6030-6049:6030-6049/udp tdengine/tdengine:2.4.0.4 -``` - -使用 docker 运行 TDengine 2.4.0.4 版本镜像(仅 taosAdapter,需要设置 firstEp 配置项 或 TAOS_FIRST_EP 环境变量): - -```bash -docker run -d --name tdengine-taosa -p 6041-6049:6041-6049 -p 6041-6049:6041-6049/udp -e TAOS_FIRST_EP=tdengine-all tdengine/tdengine:2.4.0.4 taosadapter -``` - -使用 docker 运行 TDengine 2.4.0.4 版本镜像(仅 taosd): - -```bash -docker run -d --name tdengine-taosd -p 6030-6042:6030-6042 -p 6030-6042:6030-6042/udp -e TAOS_DISABLE_ADAPTER=true tdengine/tdengine:2.4.0.4 -``` - -使用 curl 命令验证 RESTful 接口可以正常工作: - -```bash -curl -L -H "Authorization: Basic cm9vdDp0YW9zZGF0YQ==" -d "show databases;" 127.0.0.1:6041/rest/sql -``` - -输出示例如下: - -``` -{"status":"succ","head":["name","created_time","ntables","vgroups","replica","quorum","days","keep","cache(MB)","blocks","minrows","maxrows","wallevel","fsync","comp","cachelast","precision","update","status"],"column_meta":[["name",8,32],["created_time",9,8],["ntables",4,4],["vgroups",4,4],["replica",3,2],["quorum",3,2],["days",3,2],["keep",8,24],["cache(MB)",4,4],["blocks",4,4],["minrows",4,4],["maxrows",4,4],["wallevel",2,1],["fsync",4,4],["comp",2,1],["cachelast",2,1],["precision",8,3],["update",2,1],["status",8,10]],"data":[["log","2021-12-28 09:18:55.765",10,1,1,1,10,"30",1,3,100,4096,1,3000,2,0,"us",0,"ready"]],"rows":1} -``` - -### 应用示例:在宿主机使用 taosBenchmark 写入数据到 Docker 容器中的 TDengine server - -1. 在宿主机命令行界面执行 taosBenchmark (曾命名为 taosdemo)写入数据到 Docker 容器中的 TDengine server +假定启动容器时已经将容器的6030端口映射到了宿主机的6030端口,则可以直接在宿主机命令行启动 taosBenchmark,也可以进入容器后执行: ```bash $ taosBenchmark - - taosBenchmark is simulating data generated by power equipments monitoring... - - host: 127.0.0.1:6030 - user: root - password: taosdata - configDir: - resultFile: ./output.txt - thread num of insert data: 10 - thread num of create table: 10 - top insert interval: 0 - number of records per req: 30000 - max sql length: 1048576 - database count: 1 - database[0]: - database[0] name: test - drop: yes - replica: 1 - precision: ms - super table count: 1 - super table[0]: - stbName: meters - autoCreateTable: no - childTblExists: no - childTblCount: 10000 - childTblPrefix: d - dataSource: rand - iface: taosc - insertRows: 10000 - interlaceRows: 0 - disorderRange: 1000 - disorderRatio: 0 - maxSqlLen: 1048576 - timeStampStep: 1 - startTimestamp: 2017-07-14 10:40:00.000 - sampleFormat: - sampleFile: - tagsFile: - columnCount: 3 - column[0]:FLOAT column[1]:INT column[2]:FLOAT - tagCount: 2 - tag[0]:INT tag[1]:BINARY(16) - - Press enter key to continue or Ctrl-C to stop + ``` - 回车后,该命令将在数据库 test 下面自动创建一张超级表 meters,该超级表下有 1 万张表,表名为 "d0" 到 "d9999",每张表有 1 万条记录,每条记录有 (ts, current, voltage, phase) 四个字段,时间戳从 "2017-07-14 10:40:00 000" 到 "2017-07-14 10:40:09 999",每张表带有标签 location 和 groupId,groupId 被设置为 1 到 10, location 被设置为 "California.SanFrancisco" 或者 "California.SanDieo"。 + 该命令将在数据库 test 下面自动创建一张超级表 meters,该超级表下有 1 万张表,表名为 "d0" 到 "d9999",每张表有 1 万条记录,每条记录有 (ts, current, voltage, phase) 四个字段,时间戳从 "2017-07-14 10:40:00 000" 到 "2017-07-14 10:40:09 999",每张表带有标签 location 和 groupId,groupId 被设置为 1 到 10, location 被设置为 "California.SanFrancisco" 或者 "California.LosAngeles"。 - 最后共插入 1 亿条记录。 + 这条命令很快完成 1 亿条记录的插入。具体时间取决于硬件性能。 -2. 进入 TDengine 终端,查看 taosBenchmark 生成的数据。 + taosBenchmark 命令本身带有很多选项,配置表的数目、记录条数等等,您可以设置不同参数进行体验,请执行 `taosBenchmark --help` 详细列出。taosBenchmark 详细使用方法请参照 [taosBenchmark 参考手册](../reference/taosbenchmark)。 - - **进入命令行。** +## 使用 TDengine CLI 体验查询速度 - ```bash - $ root@c452519b0f9b:~/TDengine-server-2.4.0.4# taos +使用上述 taosBenchmark 插入数据后,可以在 TDengine CLI 输入查询命令,体验查询速度。可以直接在宿主机上也可以进入容器后运行。 - Welcome to the TDengine shell from Linux, Client Version:2.4.0.4 - Copyright (c) 2020 by TAOS Data, Inc. All rights reserved. +查询超级表下记录总条数: - taos> - ``` - - - **查看数据库。** - - ```bash - $ taos> show databases; - name | created_time | ntables | vgroups | ··· - test | 2021-08-18 06:01:11.021 | 10000 | 6 | ··· - log | 2021-08-18 05:51:51.065 | 4 | 1 | ··· - - ``` - - - **查看超级表。** - - ```bash - $ taos> use test; - Database changed. - - $ taos> show stables; - name | created_time | columns | tags | tables | - ============================================================================================ - meters | 2021-08-18 06:01:11.116 | 4 | 2 | 10000 | - Query OK, 1 row(s) in set (0.003259s) - - ``` - - - **查看表,限制输出十条。** - - ```bash - $ taos> select * from test.t0 limit 10; - - DB error: Table does not exist (0.002857s) - taos> select * from test.d0 limit 10; - ts | current | voltage | phase | - ====================================================================================== - 2017-07-14 10:40:00.000 | 10.12072 | 223 | 0.34167 | - 2017-07-14 10:40:00.001 | 10.16103 | 224 | 0.34445 | - 2017-07-14 10:40:00.002 | 10.00204 | 220 | 0.33334 | - 2017-07-14 10:40:00.003 | 10.00030 | 220 | 0.33333 | - 2017-07-14 10:40:00.004 | 9.84029 | 216 | 0.32222 | - 2017-07-14 10:40:00.005 | 9.88028 | 217 | 0.32500 | - 2017-07-14 10:40:00.006 | 9.88110 | 217 | 0.32500 | - 2017-07-14 10:40:00.007 | 10.08137 | 222 | 0.33889 | - 2017-07-14 10:40:00.008 | 10.12063 | 223 | 0.34167 | - 2017-07-14 10:40:00.009 | 10.16086 | 224 | 0.34445 | - Query OK, 10 row(s) in set (0.016791s) - - ``` - - - **查看 d0 表的标签值。** - - ```bash - $ taos> select groupid, location from test.d0; - groupid | location | - ================================= - 0 | California.SanDieo | - Query OK, 1 row(s) in set (0.003490s) - ``` - -### 应用示例:使用数据收集代理软件写入 TDengine - -taosAdapter 支持多个数据收集代理软件(如 Telegraf、StatsD、collectd 等),这里仅模拟 StasD 写入数据,在宿主机执行命令如下: - -``` -echo "foo:1|c" | nc -u -w0 127.0.0.1 6044 +```sql +taos> select count(*) from test.meters; ``` -然后可以使用 taos shell 查询 taosAdapter 自动创建的数据库 statsd 和 超级表 foo 中的内容: +查询 1 亿条记录的平均值、最大值、最小值等: -``` -taos> show databases; - name | created_time | ntables | vgroups | replica | quorum | days | keep | cache(MB) | blocks | minrows | maxrows | wallevel | fsync | comp | cachelast | precision | update | status | -==================================================================================================================================================================================================================================================================================== - log | 2021-12-28 09:18:55.765 | 12 | 1 | 1 | 1 | 10 | 30 | 1 | 3 | 100 | 4096 | 1 | 3000 | 2 | 0 | us | 0 | ready | - statsd | 2021-12-28 09:21:48.841 | 1 | 1 | 1 | 1 | 10 | 3650 | 16 | 6 | 100 | 4096 | 1 | 3000 | 2 | 0 | ns | 2 | ready | -Query OK, 2 row(s) in set (0.002112s) - -taos> use statsd; -Database changed. - -taos> show stables; - name | created_time | columns | tags | tables | -============================================================================================ - foo | 2021-12-28 09:21:48.894 | 2 | 1 | 1 | -Query OK, 1 row(s) in set (0.001160s) - -taos> select * from foo; - ts | value | metric_type | -======================================================================================= - 2021-12-28 09:21:48.840820836 | 1 | counter | -Query OK, 1 row(s) in set (0.001639s) - -taos> +```sql +taos> select avg(current), max(voltage), min(phase) from test.meters; ``` -可以看到模拟数据已经被写入到 TDengine 中。 +查询 location="California.SanFrancisco" 的记录总条数: -## 停止正在 Docker 中运行的 TDengine 服务 - -```bash -docker stop tdengine +```sql +taos> select count(*) from test.meters where location="California.SanFrancisco"; ``` -- **docker stop**:通过 docker stop 停止指定的正在运行中的 docker 镜像。 +查询 groupId=10 的所有记录的平均值、最大值、最小值等: + +```sql +taos> select avg(current), max(voltage), min(phase) from test.meters where groupId=10; +``` + +对表 d10 按 10s 进行平均值、最大值和最小值聚合统计: + +```sql +taos> select avg(current), max(voltage), min(phase) from test.d10 interval(10s); +``` \ No newline at end of file diff --git a/docs/zh/05-get-started/index.md b/docs/zh/05-get-started/index.md index d841c6e75d..794081b4e4 100644 --- a/docs/zh/05-get-started/index.md +++ b/docs/zh/05-get-started/index.md @@ -3,6 +3,7 @@ title: 立即开始 description: '快速设置 TDengine 环境并体验其高效写入和查询' --- +TDengine 完整的软件包包括服务端(taosd)、用于与第三方系统对接并提供 RESTful 接口的 taosAdapter、应用驱动(taosc)、命令行程序 (CLI,taos) 和一些工具软件。TDengine 除了提供多种语言的连接器之外,还通过 [taosAdapter](/reference/taosadapter) 提供 [RESTful 接口](/reference/rest-api)。 本章主要介绍如何利用 Docker 或者安装包快速设置 TDengine 环境并体验其高效写入和查询。 From a6a1f697786e6f5250431f67fde617cf491b8ee0 Mon Sep 17 00:00:00 2001 From: gccgdb1234 Date: Tue, 26 Jul 2022 10:13:28 +0800 Subject: [PATCH 43/54] doc: refine docker in get started --- docs/zh/05-get-started/01-docker.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/zh/05-get-started/01-docker.md b/docs/zh/05-get-started/01-docker.md index c50f187fdb..14db62218f 100644 --- a/docs/zh/05-get-started/01-docker.md +++ b/docs/zh/05-get-started/01-docker.md @@ -58,7 +58,7 @@ taos> ``` -### 启动 REST 服务 +## 启动 REST 服务 taosAdapter 是 TDengine 中提供 REST 服务的组件。下面这条命令会在容器中同时启动 `taosd` 和 `taosadapter` 两个服务组件。 @@ -113,7 +113,7 @@ TDengine REST API 详情请参考[官方文档](/reference/rest-api/)。 taosBenchmark 命令本身带有很多选项,配置表的数目、记录条数等等,您可以设置不同参数进行体验,请执行 `taosBenchmark --help` 详细列出。taosBenchmark 详细使用方法请参照 [taosBenchmark 参考手册](../reference/taosbenchmark)。 -## 使用 TDengine CLI 体验查询速度 +## 体验查询 使用上述 taosBenchmark 插入数据后,可以在 TDengine CLI 输入查询命令,体验查询速度。可以直接在宿主机上也可以进入容器后运行。 From b43903f3d4c6d21198daefa535e51dea710ad229 Mon Sep 17 00:00:00 2001 From: Ganlin Zhao Date: Tue, 26 Jul 2022 10:54:56 +0800 Subject: [PATCH 44/54] fix unit test --- source/libs/parser/test/parSelectTest.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/libs/parser/test/parSelectTest.cpp b/source/libs/parser/test/parSelectTest.cpp index 849ba14d11..7376cc1fa3 100644 --- a/source/libs/parser/test/parSelectTest.cpp +++ b/source/libs/parser/test/parSelectTest.cpp @@ -144,7 +144,7 @@ TEST_F(ParserSelectTest, IndefiniteRowsFunc) { TEST_F(ParserSelectTest, IndefiniteRowsFuncSemanticCheck) { useDb("root", "test"); - run("SELECT DIFF(c1), c2 FROM t1", TSDB_CODE_PAR_NOT_SINGLE_GROUP); + run("SELECT DIFF(c1), c2 FROM t1"); run("SELECT DIFF(c1), tbname FROM t1", TSDB_CODE_PAR_NOT_SINGLE_GROUP); From 43e2f8bc2bea1cf6a95741d764bcae9786ac1840 Mon Sep 17 00:00:00 2001 From: Minghao Li Date: Tue, 26 Jul 2022 10:59:56 +0800 Subject: [PATCH 45/54] refactor(sync): add pre-commit interface --- source/libs/sync/inc/syncInt.h | 1 + source/libs/sync/src/syncAppendEntries.c | 46 +++++------------------- source/libs/sync/src/syncMain.c | 33 ++--------------- 3 files changed, 12 insertions(+), 68 deletions(-) diff --git a/source/libs/sync/inc/syncInt.h b/source/libs/sync/inc/syncInt.h index 64f66e390a..b802d94bea 100644 --- a/source/libs/sync/inc/syncInt.h +++ b/source/libs/sync/inc/syncInt.h @@ -238,6 +238,7 @@ int32_t syncNodeGetPreIndexTerm(SSyncNode* pSyncNode, SyncIndex index, SyncInd bool syncNodeIsOptimizedOneReplica(SSyncNode* ths, SRpcMsg* pMsg); int32_t syncNodeCommit(SSyncNode* ths, SyncIndex beginIndex, SyncIndex endIndex, uint64_t flag); +int32_t syncNodePreCommit(SSyncNode* ths, SSyncRaftEntry* pEntry, int32_t code); int32_t syncNodeUpdateNewConfigIndex(SSyncNode* ths, SSyncCfg* pNewCfg); diff --git a/source/libs/sync/src/syncAppendEntries.c b/source/libs/sync/src/syncAppendEntries.c index 4295abeaa1..7d0f53640c 100644 --- a/source/libs/sync/src/syncAppendEntries.c +++ b/source/libs/sync/src/syncAppendEntries.c @@ -244,22 +244,7 @@ int32_t syncNodeOnAppendEntriesCb(SSyncNode* ths, SyncAppendEntries* pMsg) { ths->pLogStore->appendEntry(ths->pLogStore, pAppendEntry); // pre commit - SRpcMsg rpcMsg; - syncEntry2OriginalRpc(pAppendEntry, &rpcMsg); - if (ths->pFsm != NULL) { - // if (ths->pFsm->FpPreCommitCb != NULL && pAppendEntry->originalRpcType != TDMT_SYNC_NOOP) { - if (ths->pFsm->FpPreCommitCb != NULL && syncUtilUserPreCommit(pAppendEntry->originalRpcType)) { - SFsmCbMeta cbMeta = {0}; - cbMeta.index = pAppendEntry->index; - cbMeta.lastConfigIndex = syncNodeGetSnapshotConfigIndex(ths, cbMeta.index); - cbMeta.isWeak = pAppendEntry->isWeak; - cbMeta.code = 2; - cbMeta.state = ths->state; - cbMeta.seqNum = pAppendEntry->seqNum; - ths->pFsm->FpPreCommitCb(ths->pFsm, &rpcMsg, cbMeta); - } - } - rpcFreeCont(rpcMsg.pCont); + syncNodePreCommit(ths, pAppendEntry, 0); } // free memory @@ -280,22 +265,7 @@ int32_t syncNodeOnAppendEntriesCb(SSyncNode* ths, SyncAppendEntries* pMsg) { ths->pLogStore->appendEntry(ths->pLogStore, pAppendEntry); // pre commit - SRpcMsg rpcMsg; - syncEntry2OriginalRpc(pAppendEntry, &rpcMsg); - if (ths->pFsm != NULL) { - // if (ths->pFsm->FpPreCommitCb != NULL && pAppendEntry->originalRpcType != TDMT_SYNC_NOOP) { - if (ths->pFsm->FpPreCommitCb != NULL && syncUtilUserPreCommit(pAppendEntry->originalRpcType)) { - SFsmCbMeta cbMeta = {0}; - cbMeta.index = pAppendEntry->index; - cbMeta.lastConfigIndex = syncNodeGetSnapshotConfigIndex(ths, cbMeta.index); - cbMeta.isWeak = pAppendEntry->isWeak; - cbMeta.code = 3; - cbMeta.state = ths->state; - cbMeta.seqNum = pAppendEntry->seqNum; - ths->pFsm->FpPreCommitCb(ths->pFsm, &rpcMsg, cbMeta); - } - } - rpcFreeCont(rpcMsg.pCont); + syncNodePreCommit(ths, pAppendEntry, 0); // free memory syncEntryDestory(pAppendEntry); @@ -440,7 +410,7 @@ static int32_t syncNodeDoMakeLogSame(SSyncNode* ths, SyncIndex FromIndex) { return code; } -static int32_t syncNodePreCommit(SSyncNode* ths, SSyncRaftEntry* pEntry) { +int32_t syncNodePreCommit(SSyncNode* ths, SSyncRaftEntry* pEntry, int32_t code) { SRpcMsg rpcMsg; syncEntry2OriginalRpc(pEntry, &rpcMsg); @@ -456,7 +426,7 @@ static int32_t syncNodePreCommit(SSyncNode* ths, SSyncRaftEntry* pEntry) { cbMeta.index = pEntry->index; cbMeta.lastConfigIndex = syncNodeGetSnapshotConfigIndex(ths, cbMeta.index); cbMeta.isWeak = pEntry->isWeak; - cbMeta.code = 2; + cbMeta.code = code; cbMeta.state = ths->state; cbMeta.seqNum = pEntry->seqNum; ths->pFsm->FpPreCommitCb(ths->pFsm, &rpcMsg, cbMeta); @@ -594,7 +564,7 @@ int32_t syncNodeOnAppendEntriesSnapshot2Cb(SSyncNode* ths, SyncAppendEntriesBatc return -1; } - code = syncNodePreCommit(ths, pAppendEntry); + code = syncNodePreCommit(ths, pAppendEntry, 0); ASSERT(code == 0); // syncEntryDestory(pAppendEntry); @@ -715,7 +685,7 @@ int32_t syncNodeOnAppendEntriesSnapshot2Cb(SSyncNode* ths, SyncAppendEntriesBatc return -1; } - code = syncNodePreCommit(ths, pAppendEntry); + code = syncNodePreCommit(ths, pAppendEntry, 0); ASSERT(code == 0); // syncEntryDestory(pAppendEntry); @@ -919,7 +889,7 @@ int32_t syncNodeOnAppendEntriesSnapshotCb(SSyncNode* ths, SyncAppendEntries* pMs } // pre commit - code = syncNodePreCommit(ths, pAppendEntry); + code = syncNodePreCommit(ths, pAppendEntry, 0); ASSERT(code == 0); // update match index @@ -1032,7 +1002,7 @@ int32_t syncNodeOnAppendEntriesSnapshotCb(SSyncNode* ths, SyncAppendEntries* pMs } // pre commit - code = syncNodePreCommit(ths, pAppendEntry); + code = syncNodePreCommit(ths, pAppendEntry, 0); ASSERT(code == 0); syncEntryDestory(pAppendEntry); diff --git a/source/libs/sync/src/syncMain.c b/source/libs/sync/src/syncMain.c index a453b2572c..63a404d5f6 100644 --- a/source/libs/sync/src/syncMain.c +++ b/source/libs/sync/src/syncMain.c @@ -2504,23 +2504,11 @@ int32_t syncNodeOnClientRequestCb(SSyncNode* ths, SyncClientRequest* pMsg, SyncI } // pre commit + syncNodePreCommit(ths, pEntry, 0); + SRpcMsg rpcMsg; syncEntry2OriginalRpc(pEntry, &rpcMsg); - if (ths->pFsm != NULL) { - if (ths->pFsm->FpPreCommitCb != NULL && syncUtilUserPreCommit(pEntry->originalRpcType)) { - SFsmCbMeta cbMeta = {0}; - cbMeta.index = pEntry->index; - cbMeta.lastConfigIndex = syncNodeGetSnapshotConfigIndex(ths, cbMeta.index); - cbMeta.isWeak = pEntry->isWeak; - cbMeta.code = 0; - cbMeta.state = ths->state; - cbMeta.seqNum = pEntry->seqNum; - ths->pFsm->FpPreCommitCb(ths->pFsm, &rpcMsg, cbMeta); - } - } - rpcFreeCont(rpcMsg.pCont); - // if only myself, maybe commit right now if (ths->replicaNum == 1) { syncMaybeAdvanceCommitIndex(ths); @@ -2528,22 +2516,7 @@ int32_t syncNodeOnClientRequestCb(SSyncNode* ths, SyncClientRequest* pMsg, SyncI } else { // pre commit - SRpcMsg rpcMsg; - syncEntry2OriginalRpc(pEntry, &rpcMsg); - - if (ths->pFsm != NULL) { - if (ths->pFsm->FpPreCommitCb != NULL && syncUtilUserPreCommit(pEntry->originalRpcType)) { - SFsmCbMeta cbMeta = {0}; - cbMeta.index = pEntry->index; - cbMeta.lastConfigIndex = syncNodeGetSnapshotConfigIndex(ths, cbMeta.index); - cbMeta.isWeak = pEntry->isWeak; - cbMeta.code = 1; - cbMeta.state = ths->state; - cbMeta.seqNum = pEntry->seqNum; - ths->pFsm->FpPreCommitCb(ths->pFsm, &rpcMsg, cbMeta); - } - } - rpcFreeCont(rpcMsg.pCont); + syncNodePreCommit(ths, pEntry, 0); } if (pRetIndex != NULL) { From 678a0ff91801432432ef701a59db6512811f59fc Mon Sep 17 00:00:00 2001 From: Hui Li <52318143+plum-lihui@users.noreply.github.com> Date: Tue, 26 Jul 2022 11:05:47 +0800 Subject: [PATCH 46/54] Delete TD-17803.py --- tests/system-test/7-tmq/TD-17803.py | 198 ---------------------------- 1 file changed, 198 deletions(-) delete mode 100644 tests/system-test/7-tmq/TD-17803.py diff --git a/tests/system-test/7-tmq/TD-17803.py b/tests/system-test/7-tmq/TD-17803.py deleted file mode 100644 index 771ff83a29..0000000000 --- a/tests/system-test/7-tmq/TD-17803.py +++ /dev/null @@ -1,198 +0,0 @@ -from distutils.log import error -import taos -import sys -import time -import socket -import os -import threading -import subprocess -import platform - -from util.log import * -from util.sql import * -from util.cases import * -from util.dnodes import * -from util.common import * -sys.path.append("./7-tmq") -from tmqCommon import * - - - -class TDTestCase: - def __init__(self): - self.snapshot = 0 - self.replica = 3 - self.vgroups = 3 - self.ctbNum = 2 - self.rowsPerTbl = 2 - - def init(self, conn, logSql): - tdLog.debug(f"start to excute {__file__}") - tdSql.init(conn.cursor()) - #tdSql.init(conn.cursor(), logSql) # output sql.txt file - - def checkFileContent(self, consumerId, queryString): - buildPath = tdCom.getBuildPath() - cfgPath = tdCom.getClientCfgPath() - dstFile = '%s/../log/dstrows_%d.txt'%(cfgPath, consumerId) - cmdStr = '%s/build/bin/taos -c %s -s "%s >> %s"'%(buildPath, cfgPath, queryString, dstFile) - tdLog.info(cmdStr) - os.system(cmdStr) - - consumeRowsFile = '%s/../log/consumerid_%d.txt'%(cfgPath, consumerId) - tdLog.info("rows file: %s, %s"%(consumeRowsFile, dstFile)) - - consumeFile = open(consumeRowsFile, mode='r') - queryFile = open(dstFile, mode='r') - - # skip first line for it is schema - queryFile.readline() - - while True: - dst = queryFile.readline() - src = consumeFile.readline() - - if dst: - if dst != src: - tdLog.exit("consumerId %d consume rows is not match the rows by direct query"%consumerId) - else: - break - return - - def prepareTestEnv(self): - tdLog.printNoPrefix("======== prepare test env include database, stable, ctables, and insert data: ") - paraDict = {'dbName': 'dbt', - 'dropFlag': 1, - 'event': '', - 'vgroups': 4, - 'stbName': 'stb', - 'colPrefix': 'c', - 'tagPrefix': 't', - 'colSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1}], - 'tagSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1}], - 'ctbPrefix': 'ctb', - 'ctbStartIdx': 0, - 'ctbNum': 2, - 'rowsPerTbl': 1000, - 'batchNum': 10, - 'startTs': 1640966400000, # 2022-01-01 00:00:00.000 - 'pollDelay': 3, - 'showMsg': 1, - 'showRow': 1, - 'snapshot': 0} - - paraDict['vgroups'] = self.vgroups - paraDict['ctbNum'] = self.ctbNum - paraDict['rowsPerTbl'] = self.rowsPerTbl - - tmqCom.initConsumerTable() - tdCom.create_database(tdSql, paraDict["dbName"],paraDict["dropFlag"], vgroups=paraDict["vgroups"],replica=self.replica) - tdLog.info("create stb") - tmqCom.create_stable(tdSql, dbName=paraDict["dbName"],stbName=paraDict["stbName"]) - tdLog.info("create ctb") - tmqCom.create_ctable(tdSql, dbName=paraDict["dbName"],stbName=paraDict["stbName"],ctbPrefix=paraDict['ctbPrefix'], - ctbNum=paraDict["ctbNum"],ctbStartIdx=paraDict['ctbStartIdx']) - tdLog.info("insert data") - tmqCom.insert_data_interlaceByMultiTbl(tsql=tdSql,dbName=paraDict["dbName"],ctbPrefix=paraDict["ctbPrefix"], - ctbNum=paraDict["ctbNum"],rowsPerTbl=paraDict["rowsPerTbl"],batchNum=paraDict["batchNum"], - startTs=paraDict["startTs"],ctbStartIdx=paraDict['ctbStartIdx']) - # tmqCom.insert_data_with_autoCreateTbl(tsql=tdSql,dbName=paraDict["dbName"],stbName=paraDict["stbName"],ctbPrefix="ctbx", - # ctbNum=paraDict["ctbNum"],rowsPerTbl=paraDict["rowsPerTbl"],batchNum=paraDict["batchNum"], - # startTs=paraDict["startTs"],ctbStartIdx=paraDict['ctbStartIdx']) - # tmqCom.asyncInsertDataByInterlace(paraDict) - tdLog.printNoPrefix("11111111111111111111111") - tmqCom.create_ntable(tdSql, dbname=paraDict["dbName"], tbname_prefix="ntb", tbname_index_start_num = 1, column_elm_list=paraDict["colSchema"], colPrefix='c', tblNum=1) - tdLog.printNoPrefix("222222222222222") - tmqCom.insert_rows_into_ntbl(tdSql, dbname=paraDict["dbName"], tbname_prefix="ntb", tbname_index_start_num = 1, column_ele_list=paraDict["colSchema"], startTs=paraDict["startTs"], tblNum=1, rows=2) # tdLog.info("restart taosd to ensure that the data falls into the disk") - - tdLog.printNoPrefix("333333333333333333333") - tdSql.query("drop database %s"%paraDict["dbName"]) - tdLog.printNoPrefix("44444444444444444") - return - - def tmqCase1(self): - tdLog.printNoPrefix("======== test case 1: ") - - # create and start thread - paraDict = {'dbName': 'dbt', - 'dropFlag': 1, - 'event': '', - 'vgroups': 4, - 'stbName': 'stb', - 'colPrefix': 'c', - 'tagPrefix': 't', - 'colSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1},{'type': 'TIMESTAMP', 'count':1}], - 'tagSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1}], - 'ctbPrefix': 'ctb', - 'ctbStartIdx': 0, - 'ctbNum': 100, - 'rowsPerTbl': 1000, - 'batchNum': 100, - 'startTs': 1640966400000, # 2022-01-01 00:00:00.000 - 'pollDelay': 3, - 'showMsg': 1, - 'showRow': 1, - 'snapshot': 1} - - paraDict['vgroups'] = self.vgroups - paraDict['ctbNum'] = self.ctbNum - paraDict['rowsPerTbl'] = self.rowsPerTbl - - tdLog.info("create topics from stb1") - topicFromStb1 = 'topic_stb1' - queryString = "select ts, c1, c2 from %s.%s where t4 == 'beijing' or t4 == 'changsha' "%(paraDict['dbName'], paraDict['stbName']) - sqlString = "create topic %s as %s" %(topicFromStb1, queryString) - tdLog.info("create topic sql: %s"%sqlString) - tdSql.execute(sqlString) - - consumerId = 0 - expectrowcnt = paraDict["rowsPerTbl"] * paraDict["ctbNum"] - topicList = topicFromStb1 - ifcheckdata = 0 - ifManualCommit = 0 - keyList = 'group.id:cgrp1,\ - enable.auto.commit:false,\ - auto.commit.interval.ms:6000,\ - auto.offset.reset:earliest' - tmqCom.insertConsumerInfo(consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifManualCommit) - - tdLog.info("start consume processor") - pollDelay = 100 - showMsg = 1 - showRow = 1 - tmqCom.startTmqSimProcess(pollDelay=paraDict['pollDelay'],dbName=paraDict["dbName"],showMsg=paraDict['showMsg'], showRow=paraDict['showRow'],snapshot=paraDict['snapshot']) - - tdLog.info("start to check consume result") - expectRows = 1 - resultList = tmqCom.selectConsumeResult(expectRows) - totalConsumeRows = 0 - for i in range(expectRows): - totalConsumeRows += resultList[i] - - tdSql.query(queryString) - totalRowsInserted = tdSql.getRows() - - tdLog.info("act consume rows: %d, act insert rows: %d, expect consume rows: %d, "%(totalConsumeRows, totalRowsInserted, expectrowcnt)) - - if totalConsumeRows != expectrowcnt: - tdLog.exit("tmq consume rows error!") - - # tmqCom.checkFileContent(consumerId, queryString) - - tmqCom.waitSubscriptionExit(tdSql, topicFromStb1) - tdSql.query("drop topic %s"%topicFromStb1) - - tdLog.printNoPrefix("======== test case 1 end ...... ") - - def run(self): - self.prepareTestEnv() - # self.tmqCase1() - - def stop(self): - tdSql.close() - tdLog.success(f"{__file__} successfully executed") - -event = threading.Event() - -tdCases.addLinux(__file__, TDTestCase()) -tdCases.addWindows(__file__, TDTestCase()) From 0addf0999693fcc1fcf3c5fc54e5c94049b0b942 Mon Sep 17 00:00:00 2001 From: Minghao Li Date: Tue, 26 Jul 2022 11:24:39 +0800 Subject: [PATCH 47/54] refactor(sync): add pre-commit interface --- source/dnode/vnode/src/vnd/vnodeSync.c | 33 +++++++++++++++++++------- source/libs/sync/src/syncCommit.c | 26 +++++--------------- 2 files changed, 31 insertions(+), 28 deletions(-) diff --git a/source/dnode/vnode/src/vnd/vnodeSync.c b/source/dnode/vnode/src/vnd/vnodeSync.c index a0e2354f51..2b760efba0 100644 --- a/source/dnode/vnode/src/vnd/vnodeSync.c +++ b/source/dnode/vnode/src/vnd/vnodeSync.c @@ -206,13 +206,13 @@ static void inline vnodeProposeBatchMsg(SVnode *pVnode, SRpcMsg **pMsgArr, bool } void vnodeProposeWriteMsg(SQueueInfo *pInfo, STaosQall *qall, int32_t numOfMsgs) { - SVnode *pVnode = pInfo->ahandle; - int32_t vgId = pVnode->config.vgId; - int32_t code = 0; - SRpcMsg *pMsg = NULL; - int32_t arrayPos = 0; - SRpcMsg **pMsgArr = taosMemoryCalloc(numOfMsgs, sizeof(SRpcMsg*)); - bool *pIsWeakArr = taosMemoryCalloc(numOfMsgs, sizeof(bool)); + SVnode *pVnode = pInfo->ahandle; + int32_t vgId = pVnode->config.vgId; + int32_t code = 0; + SRpcMsg *pMsg = NULL; + int32_t arrayPos = 0; + SRpcMsg **pMsgArr = taosMemoryCalloc(numOfMsgs, sizeof(SRpcMsg *)); + bool *pIsWeakArr = taosMemoryCalloc(numOfMsgs, sizeof(bool)); vTrace("vgId:%d, get %d msgs from vnode-write queue", vgId, numOfMsgs); for (int32_t msg = 0; msg < numOfMsgs; msg++) { @@ -506,7 +506,7 @@ static void vnodeSyncCommitMsg(SSyncFSM *pFsm, const SRpcMsg *pMsg, SFsmCbMeta c syncGetVgId(pVnode->sync), pFsm, cbMeta.index, cbMeta.isWeak, cbMeta.code, cbMeta.state, syncUtilState2String(cbMeta.state), pMsg->msgType, TMSG_INFO(pMsg->msgType)); - if (cbMeta.code == 0) { + if (cbMeta.code == 0 && cbMeta.isWeak == 0) { SRpcMsg rpcMsg = {.msgType = pMsg->msgType, .contLen = pMsg->contLen}; rpcMsg.pCont = rpcMallocCont(rpcMsg.contLen); memcpy(rpcMsg.pCont, pMsg->pCont, pMsg->contLen); @@ -529,6 +529,23 @@ static void vnodeSyncPreCommitMsg(SSyncFSM *pFsm, const SRpcMsg *pMsg, SFsmCbMet vTrace("vgId:%d, pre-commit-cb is excuted, fsm:%p, index:%" PRId64 ", isWeak:%d, code:%d, state:%d %s, msgtype:%d %s", syncGetVgId(pVnode->sync), pFsm, cbMeta.index, cbMeta.isWeak, cbMeta.code, cbMeta.state, syncUtilState2String(cbMeta.state), pMsg->msgType, TMSG_INFO(pMsg->msgType)); + + if (cbMeta.code == 0 && cbMeta.isWeak == 1) { + SRpcMsg rpcMsg = {.msgType = pMsg->msgType, .contLen = pMsg->contLen}; + rpcMsg.pCont = rpcMallocCont(rpcMsg.contLen); + memcpy(rpcMsg.pCont, pMsg->pCont, pMsg->contLen); + syncGetAndDelRespRpc(pVnode->sync, cbMeta.seqNum, &rpcMsg.info); + rpcMsg.info.conn.applyIndex = cbMeta.index; + rpcMsg.info.conn.applyTerm = cbMeta.term; + tmsgPutToQueue(&pVnode->msgCb, APPLY_QUEUE, &rpcMsg); + } else { + SRpcMsg rsp = {.code = cbMeta.code, .info = pMsg->info}; + vError("vgId:%d, sync pre-commit error, msgtype:%d,%s, error:0x%X, errmsg:%s", syncGetVgId(pVnode->sync), + pMsg->msgType, TMSG_INFO(pMsg->msgType), cbMeta.code, tstrerror(cbMeta.code)); + if (rsp.info.handle != NULL) { + tmsgSendRsp(&rsp); + } + } } static void vnodeSyncRollBackMsg(SSyncFSM *pFsm, const SRpcMsg *pMsg, SFsmCbMeta cbMeta) { diff --git a/source/libs/sync/src/syncCommit.c b/source/libs/sync/src/syncCommit.c index b3cdd079a4..fd6577477f 100644 --- a/source/libs/sync/src/syncCommit.c +++ b/source/libs/sync/src/syncCommit.c @@ -67,11 +67,6 @@ void syncMaybeAdvanceCommitIndex(SSyncNode* pSyncNode) { for (SyncIndex index = syncNodeGetLastIndex(pSyncNode); index > pSyncNode->commitIndex; --index) { bool agree = syncAgree(pSyncNode, index); - if (gRaftDetailLog) { - sTrace("syncMaybeAdvanceCommitIndex syncAgree:%d, index:%" PRId64 ", pSyncNode->commitIndex:%" PRId64, agree, - index, pSyncNode->commitIndex); - } - if (agree) { // term SSyncRaftEntry* pEntry = pSyncNode->pLogStore->getEntry(pSyncNode->pLogStore, index); @@ -82,20 +77,15 @@ void syncMaybeAdvanceCommitIndex(SSyncNode* pSyncNode) { // update commit index newCommitIndex = index; - if (gRaftDetailLog) { - sTrace("syncMaybeAdvanceCommitIndex maybe to update, newCommitIndex:%" PRId64 - " commit, pSyncNode->commitIndex:%" PRId64, - newCommitIndex, pSyncNode->commitIndex); - } - syncEntryDestory(pEntry); break; } else { - if (gRaftDetailLog) { - sTrace("syncMaybeAdvanceCommitIndex can not commit due to term not equal, pEntry->term:%" PRIu64 - ", pSyncNode->pRaftStore->currentTerm:%" PRIu64, - pEntry->term, pSyncNode->pRaftStore->currentTerm); - } + do { + char logBuf[128]; + snprintf(logBuf, sizeof(logBuf), "can not commit due to term not equal, index:%ld, term:%lu", pEntry->index, + pEntry->term); + syncNodeEventLog(pSyncNode, logBuf); + } while (0); } syncEntryDestory(pEntry); @@ -107,10 +97,6 @@ void syncMaybeAdvanceCommitIndex(SSyncNode* pSyncNode) { SyncIndex beginIndex = pSyncNode->commitIndex + 1; SyncIndex endIndex = newCommitIndex; - if (gRaftDetailLog) { - sTrace("syncMaybeAdvanceCommitIndex sync commit %" PRId64, newCommitIndex); - } - // update commit index pSyncNode->commitIndex = newCommitIndex; From 342614f18f4b9cf74deac1d7da40c983a4826dc4 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Tue, 26 Jul 2022 11:25:54 +0800 Subject: [PATCH 48/54] test: valgrind case --- tests/script/tmp/data.sim | 3 + tests/script/tsim/valgrind/basic1.sim | 92 ++++++---------------- tests/script/tsim/valgrind/basic3.sim | 20 ++--- tests/script/tsim/valgrind/checkError6.sim | 35 +++++++- 4 files changed, 62 insertions(+), 88 deletions(-) diff --git a/tests/script/tmp/data.sim b/tests/script/tmp/data.sim index dcfa02e0a7..f43987ffcb 100644 --- a/tests/script/tmp/data.sim +++ b/tests/script/tmp/data.sim @@ -3,6 +3,7 @@ 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 supportVnodes -v 0 system sh/exec.sh -n dnode1 -s start system sh/exec.sh -n dnode2 -s start system sh/exec.sh -n dnode3 -s start @@ -44,6 +45,8 @@ if $data(4)[4] != ready then goto step1 endi +return + print =============== step2: create database sql create database db vgroups 1 replica 3 sql show databases diff --git a/tests/script/tsim/valgrind/basic1.sim b/tests/script/tsim/valgrind/basic1.sim index f3d418cfd1..49f0b20702 100644 --- a/tests/script/tsim/valgrind/basic1.sim +++ b/tests/script/tsim/valgrind/basic1.sim @@ -1,6 +1,5 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c debugflag -v 131 system sh/exec.sh -n dnode1 -s start -v sql connect @@ -22,78 +21,31 @@ if $data(1)[4] != ready then goto step1 endi -print =============== step2: create db -sql create database db +$tbPrefix = tb +$tbNum = 5 +$rowNum = 10 + +print =============== step2: prepare data +sql create database db vgroups 2 sql use db -sql create table db.stb (ts timestamp, c1 int, c2 binary(4)) tags(t1 int, t2 float, t3 binary(16)) comment "abd" -sql create table db.c1 using db.stb tags(101, 102, "103") +sql create table if not exists stb (ts timestamp, tbcol int, tbcol2 float, tbcol3 double) tags (tgcol int unsigned) -print =============== step3: alter stb -sql_error alter table db.stb add column ts int -sql alter table db.stb add column c3 int -sql alter table db.stb add column c4 bigint -sql alter table db.stb add column c5 binary(12) -sql alter table db.stb drop column c1 -sql alter table db.stb drop column c4 -sql alter table db.stb MODIFY column c2 binary(32) -sql alter table db.stb add tag t4 bigint -sql alter table db.stb add tag c1 int -sql alter table db.stb add tag t5 binary(12) -sql alter table db.stb drop tag c1 -sql alter table db.stb drop tag t5 -sql alter table db.stb MODIFY tag t3 binary(32) -sql alter table db.stb rename tag t1 tx -sql alter table db.stb comment 'abcde' ; -sql drop table db.stb +$i = 0 +while $i < $tbNum + $tb = $tbPrefix . $i + sql create table $tb using stb tags( $i ) + $x = 0 + while $x < $rowNum + $cc = $x * 60000 + $ms = 1601481600000 + $cc + sql insert into $tb values ($ms , $x , $x , $x ) + $x = $x + 1 + endw + $i = $i + 1 +endw -print =============== step4: alter tb -sql create table tb (ts timestamp, a int) -sql insert into tb values(now-28d, -28) -sql select count(a) from tb -sql alter table tb add column b smallint -sql insert into tb values(now-25d, -25, 0) -sql select count(b) from tb -sql alter table tb add column c tinyint -sql insert into tb values(now-22d, -22, 3, 0) -sql select count(c) from tb -sql alter table tb add column d int -sql insert into tb values(now-19d, -19, 6, 0, 0) -sql select count(d) from tb -sql alter table tb add column e bigint -sql alter table tb add column f float -sql alter table tb add column g double -sql alter table tb add column h binary(10) -sql select count(a), count(b), count(c), count(d), count(e), count(f), count(g), count(h) from tb -sql select * from tb order by ts desc - -print =============== step5: alter stb and insert data -sql create table stb (ts timestamp, c1 int, c2 binary(4)) tags(t1 int, t2 float, t3 binary(16)) comment "abd" -sql show db.stables -sql describe stb -sql_error alter table stb add column ts int - -sql create table db.ctb using db.stb tags(101, 102, "103") -sql insert into db.ctb values(now, 1, "2") -sql show db.tables -sql select * from db.stb -sql select * from tb - -sql alter table stb add column c3 int -sql describe stb -sql select * from db.stb -sql select * from tb -sql insert into db.ctb values(now+1s, 1, 2, 3) -sql select * from db.stb - -sql alter table db.stb add column c4 bigint -sql select * from db.stb -sql insert into db.ctb values(now+2s, 1, 2, 3, 4) - -sql alter table db.stb drop column c1 -sql reset query cache -sql select * from tb -sql insert into db.ctb values(now+3s, 2, 3, 4) -sql select * from db.stb +print =============== step3: tb +sql select count(1) from tb1 _OVER: system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/tsim/valgrind/basic3.sim b/tests/script/tsim/valgrind/basic3.sim index d513eee3cf..b9ed1641c8 100644 --- a/tests/script/tsim/valgrind/basic3.sim +++ b/tests/script/tsim/valgrind/basic3.sim @@ -1,5 +1,6 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 +system sh/cfg.sh -n dnode1 -c debugflag -v 131 system sh/exec.sh -n dnode1 -s start -v sql connect @@ -44,20 +45,11 @@ while $i < $tbNum $i = $i + 1 endw -print =============== step3: avg -sql select avg(tbcol) from tb1 -sql select avg(tbcol) from tb1 where ts <= 1601481840000 -sql select avg(tbcol) as b from tb1 -sql select avg(tbcol) as b from tb1 interval(1d) -sql select avg(tbcol) as b from tb1 where ts <= 1601481840000s interval(1m) -sql select avg(tbcol) as c from stb -sql select avg(tbcol) as c from stb where ts <= 1601481840000 -sql select avg(tbcol) as c from stb where tgcol < 5 and ts <= 1601481840000 -sql select avg(tbcol) as c from stb interval(1m) -sql select avg(tbcol) as c from stb interval(1d) -sql select avg(tbcol) as b from stb where ts <= 1601481840000s interval(1m) -sql select avg(tbcol) as c from stb group by tgcol -sql select avg(tbcol) as b from stb where ts <= 1601481840000s partition by tgcol interval(1m) +print =============== step3: tb +sql select count(tbcol), avg(tbcol), max(tbcol), min(tbcol), count(tbcol) from tb1 where ts <= 1601481840000 and ts >= 1601481800000 partition by tgcol interval(1m) fill(value, 0) + +print =============== step4: stb +sql select count(tbcol), avg(tbcol), max(tbcol), min(tbcol), count(tbcol) from stb where ts <= 1601481840000 and ts >= 1601481800000 partition by tgcol interval(1m) fill(value, 0) _OVER: system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/tsim/valgrind/checkError6.sim b/tests/script/tsim/valgrind/checkError6.sim index 4681345839..27fd291f64 100644 --- a/tests/script/tsim/valgrind/checkError6.sim +++ b/tests/script/tsim/valgrind/checkError6.sim @@ -42,23 +42,50 @@ while $i < $tbNum sql insert into $tb values ($ms , $x , $x , $x ) $x = $x + 1 endw + + $cc = $x * 60000 + $ms = 1601481600000 + $cc + sql insert into $tb values ($ms , NULL , NULL , NULL ) $i = $i + 1 endw -print =============== step3: avg +print =============== step3: tb sql select avg(tbcol) from tb1 sql select avg(tbcol) from tb1 where ts <= 1601481840000 sql select avg(tbcol) as b from tb1 sql select avg(tbcol) as b from tb1 interval(1d) -sql select avg(tbcol) as b from tb1 where ts <= 1601481840000s interval(1m) +sql select avg(tbcol) as b from tb1 where ts <= 1601481840000 interval(1m) +sql select bottom(tbcol, 2) from tb1 where ts <= 1601481840000 +sql select top(tbcol, 2) from tb1 where ts <= 1601481840000 +sql select percentile(tbcol, 2) from tb1 where ts <= 1601481840000 +sql select leastsquares(tbcol, 1, 1) as b from tb1 where ts <= 1601481840000 +sql show table distributed tb1 +sql select count(tbcol) as b from tb1 where ts <= 1601481840000 interval(1m) +sql select diff(tbcol) from tb1 where ts <= 1601481840000 +sql select diff(tbcol) from tb1 where tbcol > 5 and tbcol < 20 +sql select first(tbcol), last(tbcol) as b from tb1 where ts <= 1601481840000 interval(1m) +sql select count(tbcol), avg(tbcol), max(tbcol), min(tbcol), sum(tbcol), stddev(tbcol) from tb1 where ts <= 1601481840000 partition by tgcol interval(1m) +#sql select count(tbcol), avg(tbcol), max(tbcol), min(tbcol), count(tbcol) from tb1 where ts <= 1601481840000 and ts >= 1601481800000 partition by tgcol interval(1m) fill(value, 0) +sql select last_row(*) from tb1 where tbcol > 5 and tbcol < 20 + +print =============== step4: stb sql select avg(tbcol) as c from stb sql select avg(tbcol) as c from stb where ts <= 1601481840000 sql select avg(tbcol) as c from stb where tgcol < 5 and ts <= 1601481840000 sql select avg(tbcol) as c from stb interval(1m) sql select avg(tbcol) as c from stb interval(1d) -sql select avg(tbcol) as b from stb where ts <= 1601481840000s interval(1m) +sql select avg(tbcol) as b from stb where ts <= 1601481840000 interval(1m) sql select avg(tbcol) as c from stb group by tgcol -sql select avg(tbcol) as b from stb where ts <= 1601481840000s partition by tgcol interval(1m) +sql select avg(tbcol) as b from stb where ts <= 1601481840000 partition by tgcol interval(1m) +sql show table distributed stb +sql select count(tbcol) as b from stb where ts <= 1601481840000 partition by tgcol interval(1m) +sql select diff(tbcol) from stb where ts <= 1601481840000 +sql select first(tbcol), last(tbcol) as c from stb group by tgcol +sql select first(tbcol), last(tbcol) as b from stb where ts <= 1601481840000 and tbcol2 is null partition by tgcol interval(1m) +sql select first(tbcol), last(tbcol) as b from stb where ts <= 1601481840000 partition by tgcol interval(1m) +sql select count(tbcol), avg(tbcol), max(tbcol), min(tbcol), sum(tbcol), stddev(tbcol) from stb where ts <= 1601481840000 partition by tgcol interval(1m) +#sql select count(tbcol), avg(tbcol), max(tbcol), min(tbcol), count(tbcol) from stb where ts <= 1601481840000 and ts >= 1601481800000 partition by tgcol interval(1m) fill(value, 0) +sql select last_row(tbcol), stddev(tbcol) from stb where tbcol > 5 and tbcol < 20 group by tgcol _OVER: system sh/exec.sh -n dnode1 -s stop -x SIGINT From 203e54c06812dd15654db0fcae7210fba3d72648 Mon Sep 17 00:00:00 2001 From: Steven Li Date: Tue, 26 Jul 2022 09:57:40 +0530 Subject: [PATCH 49/54] Enhanced crash_gen tool to report better error for deadlocks --- tests/pytest/crash_gen/crash_gen_main.py | 52 +++++++++++++----------- tests/pytest/crash_gen/shared/db.py | 23 +++++++++++ 2 files changed, 52 insertions(+), 23 deletions(-) diff --git a/tests/pytest/crash_gen/crash_gen_main.py b/tests/pytest/crash_gen/crash_gen_main.py index d5ffc1b7c1..7ab09383bf 100755 --- a/tests/pytest/crash_gen/crash_gen_main.py +++ b/tests/pytest/crash_gen/crash_gen_main.py @@ -371,7 +371,9 @@ class ThreadCoordinator: if isinstance(err, CrashGenError): # our own transition failure Logging.info("State transition error") # TODO: saw an error here once, let's print out stack info for err? - traceback.print_stack() + traceback.print_stack() # Stack frame to here. + Logging.info("Caused by:") + traceback.print_exception(*sys.exc_info()) # Ref: https://www.geeksforgeeks.org/how-to-print-exception-stack-trace-in-python/ transitionFailed = True self._te = None # Not running any more self._execStats.registerFailure("State transition error: {}".format(err)) @@ -741,7 +743,8 @@ class AnyState: sCnt += 1 if (sCnt >= 2): raise CrashGenError( - "Unexpected more than 1 success with task: {}, in task set: {}".format( + "Unexpected more than 1 success at state: {}, with task: {}, in task set: {}".format( + self.__class__.__name__, cls.__name__, # verified just now that isinstance(task, cls) [c.__class__.__name__ for c in tasks] )) @@ -756,8 +759,11 @@ class AnyState: if task.isSuccess(): sCnt += 1 if (exists and sCnt <= 0): - raise CrashGenError("Unexpected zero success for task type: {}, from tasks: {}" - .format(cls, tasks)) + raise CrashGenError("Unexpected zero success at state: {}, with task: {}, in task set: {}".format( + self.__class__.__name__, + cls.__name__, # verified just now that isinstance(task, cls) + [c.__class__.__name__ for c in tasks] + )) def assertNoTask(self, tasks, cls): for task in tasks: @@ -809,8 +815,6 @@ class StateEmpty(AnyState): ] def verifyTasksToState(self, tasks, newState): - if Config.getConfig().ignore_errors: # if we are asked to ignore certain errors, let's not verify CreateDB success. - return if (self.hasSuccess(tasks, TaskCreateDb) ): # at EMPTY, if there's succes in creating DB if (not self.hasTask(tasks, TaskDropDb)): # and no drop_db tasks @@ -995,16 +999,17 @@ class StateMechine: dbc.execute("show dnodes") # Generic Checks, first based on the start state - if self._curState.canCreateDb(): - self._curState.assertIfExistThenSuccess(tasks, TaskCreateDb) - # self.assertAtMostOneSuccess(tasks, CreateDbTask) # not really, in - # case of multiple creation and drops + if not Config.getConfig().ignore_errors: # verify state, only if we are asked not to ignore certain errors. + if self._curState.canCreateDb(): + self._curState.assertIfExistThenSuccess(tasks, TaskCreateDb) + # self.assertAtMostOneSuccess(tasks, CreateDbTask) # not really, in + # case of multiple creation and drops - if self._curState.canDropDb(): - if gSvcMgr == None: # only if we are running as client-only - self._curState.assertIfExistThenSuccess(tasks, TaskDropDb) - # self.assertAtMostOneSuccess(tasks, DropDbTask) # not really in - # case of drop-create-drop + if self._curState.canDropDb(): + if gSvcMgr == None: # only if we are running as client-only + self._curState.assertIfExistThenSuccess(tasks, TaskDropDb) + # self.assertAtMostOneSuccess(tasks, DropDbTask) # not really in + # case of drop-create-drop # if self._state.canCreateFixedTable(): # self.assertIfExistThenSuccess(tasks, CreateFixedTableTask) # Not true, DB may be dropped @@ -1026,7 +1031,8 @@ class StateMechine: newState = self._findCurrentState(dbc) Logging.debug("[STT] New DB state determined: {}".format(newState)) # can old state move to new state through the tasks? - self._curState.verifyTasksToState(tasks, newState) + if not Config.getConfig().ignore_errors: # verify state, only if we are asked not to ignore certain errors. + self._curState.verifyTasksToState(tasks, newState) self._curState = newState def pickTaskType(self): @@ -2231,16 +2237,14 @@ class TaskAddData(StateTransitionTask): class ThreadStacks: # stack info for all threads def __init__(self): self._allStacks = {} - allFrames = sys._current_frames() # All current stack frames + allFrames = sys._current_frames() # All current stack frames, keyed with "ident" for th in threading.enumerate(): # For each thread - if th.ident is None: - continue - stack = traceback.extract_stack(allFrames[th.ident]) # Get stack for a thread - shortTid = th.ident % 10000 + stack = traceback.extract_stack(allFrames[th.ident]) #type: ignore # Get stack for a thread + shortTid = th.native_id % 10000 #type: ignore self._allStacks[shortTid] = stack # Was using th.native_id def print(self, filteredEndName = None, filterInternal = False): - for tIdent, stack in self._allStacks.items(): # for each thread, stack frames top to bottom + for shortTid, stack in self._allStacks.items(): # for each thread, stack frames top to bottom lastFrame = stack[-1] if filteredEndName: # we need to filter out stacks that match this name if lastFrame.name == filteredEndName : # end did not match @@ -2252,7 +2256,9 @@ class ThreadStacks: # stack info for all threads '__init__']: # the thread that extracted the stack continue # ignore # Now print - print("\n<----- Thread Info for LWP/ID: {} (most recent call last) <-----".format(tIdent)) + print("\n<----- Thread Info for LWP/ID: {} (most recent call last) <-----".format(shortTid)) + lastSqlForThread = DbConn.fetchSqlForThread(shortTid) + print("Last SQL statement attempted from thread {} is: {}".format(shortTid, lastSqlForThread)) stackFrame = 0 for frame in stack: # was using: reversed(stack) # print(frame) diff --git a/tests/pytest/crash_gen/shared/db.py b/tests/pytest/crash_gen/shared/db.py index 75931ace48..6da0216d95 100644 --- a/tests/pytest/crash_gen/shared/db.py +++ b/tests/pytest/crash_gen/shared/db.py @@ -27,6 +27,26 @@ class DbConn: TYPE_REST = "rest-api" TYPE_INVALID = "invalid" + # class variables + lastSqlFromThreads : dict[int, str] = {} # stored by thread id, obtained from threading.current_thread().ident%10000 + + @classmethod + def saveSqlForCurrentThread(cls, sql: str): + ''' + Let us save the last SQL statement on a per-thread basis, so that when later we + run into a dead-lock situation, we can pick out the deadlocked thread, and use + that information to find what what SQL statement is stuck. + ''' + th = threading.current_thread() + shortTid = th.native_id % 10000 #type: ignore + cls.lastSqlFromThreads[shortTid] = sql # Save this for later + + @classmethod + def fetchSqlForThread(cls, shortTid : int) -> str : + if shortTid not in cls.lastSqlFromThreads: + raise CrashGenError("No last-attempted-SQL found for thread id: {}".format(shortTid)) + return cls.lastSqlFromThreads[shortTid] + @classmethod def create(cls, connType, dbTarget): if connType == cls.TYPE_NATIVE: @@ -163,6 +183,7 @@ class DbConnRest(DbConn): def _doSql(self, sql): self._lastSql = sql # remember this, last SQL attempted + self.saveSqlForCurrentThread(sql) # Save in global structure too. #TODO: combine with above try: r = requests.post(self._url, data = sql, @@ -392,6 +413,7 @@ class DbConnNative(DbConn): "Cannot exec SQL unless db connection is open", CrashGenError.DB_CONNECTION_NOT_OPEN) Logging.debug("[SQL] Executing SQL: {}".format(sql)) self._lastSql = sql + self.saveSqlForCurrentThread(sql) # Save in global structure too. #TODO: combine with above nRows = self._tdSql.execute(sql) cls = self.__class__ cls.totalRequests += 1 @@ -407,6 +429,7 @@ class DbConnNative(DbConn): "Cannot query database until connection is open, restarting?", CrashGenError.DB_CONNECTION_NOT_OPEN) Logging.debug("[SQL] Executing SQL: {}".format(sql)) self._lastSql = sql + self.saveSqlForCurrentThread(sql) # Save in global structure too. #TODO: combine with above nRows = self._tdSql.query(sql) cls = self.__class__ cls.totalRequests += 1 From 0b7a175d136d4cb228caae19aafead1489bee848 Mon Sep 17 00:00:00 2001 From: gccgdb1234 Date: Tue, 26 Jul 2022 13:17:11 +0800 Subject: [PATCH 50/54] doc: table, stable, database in sql manual --- docs/zh/12-taos-sql/02-database.md | 170 +++++++++++++++------------- docs/zh/12-taos-sql/03-table.md | 175 ++++++++++++++++++++--------- docs/zh/12-taos-sql/04-stable.md | 116 ++++++++++++------- 3 files changed, 289 insertions(+), 172 deletions(-) diff --git a/docs/zh/12-taos-sql/02-database.md b/docs/zh/12-taos-sql/02-database.md index e3a0aa7c87..38119dfb44 100644 --- a/docs/zh/12-taos-sql/02-database.md +++ b/docs/zh/12-taos-sql/02-database.md @@ -6,53 +6,85 @@ description: "创建、删除数据库,查看、修改数据库参数" ## 创建数据库 -``` -CREATE DATABASE [IF NOT EXISTS] db_name [KEEP keep] [DAYS days] [UPDATE 1]; +```sql +CREATE DATABASE [IF NOT EXISTS] db_name [database_options] + +database_options: + database_option ... + +database_option: { + BUFFER value + | CACHEMODEL {'none' | 'last_row' | 'last_value' | 'both'} + | CACHESIZE value + | COMP {0 | 1 | 2} + | DURATION value + | FSYNC value + | MAXROWS value + | MINROWS value + | KEEP value + | PAGES value + | PAGESIZE value + | PRECISION {'ms' | 'us' | 'ns'} + | REPLICA value + | RETENTIONS ingestion_duration:keep_duration ... + | STRICT {'off' | 'on'} + | WAL {1 | 2} + | VGROUPS value + | SINGLE_STABLE {0 | 1} + | WAL_RETENTION_PERIOD value + | WAL_ROLL_PERIOD value + | WAL_RETENTION_SIZE value + | WAL_SEGMENT_SIZE value +} ``` -:::info -1. KEEP 是该数据库的数据保留多长天数,缺省是 3650 天(10 年),数据库会自动删除超过时限的数据; -2. UPDATE 标志数据库支持更新相同时间戳数据;(从 2.1.7.0 版本开始此参数支持设为 2,表示允许部分列更新,也即更新数据行时未被设置的列会保留原值。)(从 2.0.8.0 版本开始支持此参数。注意此参数不能通过 `ALTER DATABASE` 指令进行修改。) - 1. UPDATE 设为 0 时,表示不允许更新数据,后发送的相同时间戳的数据会被直接丢弃; - 2. UPDATE 设为 1 时,表示更新全部列数据,即如果更新一个数据行,其中某些列没有提供取值,那么这些列会被设为 NULL; - 3. UPDATE 设为 2 时,表示支持更新部分列数据,即如果更新一个数据行,其中某些列没有提供取值,那么这些列会保持原有数据行中的对应值; - 4. 更多关于 UPDATE 参数的用法,请参考[FAQ](/train-faq/faq)。 -3. 数据库名最大长度为 33; -4. 一条 SQL 语句的最大长度为 65480 个字符; -5. 创建数据库时可用的参数有: - - cache: [详细说明](/reference/config/#cache) - - blocks: [详细说明](/reference/config/#blocks) - - days: [详细说明](/reference/config/#days) - - keep: [详细说明](/reference/config/#keep) - - minRows: [详细说明](/reference/config/#minrows) - - maxRows: [详细说明](/reference/config/#maxrows) - - wal: [详细说明](/reference/config/#wallevel) - - fsync: [详细说明](/reference/config/#fsync) - - update: [详细说明](/reference/config/#update) - - cacheLast: [详细说明](/reference/config/#cachelast) - - replica: [详细说明](/reference/config/#replica) - - quorum: [详细说明](/reference/config/#quorum) - - comp: [详细说明](/reference/config/#comp) - - precision: [详细说明](/reference/config/#precision) -6. 请注意上面列出的所有参数都可以配置在配置文件 `taosd.cfg` 中作为创建数据库时使用的默认配置, `create database` 的参数中明确指定的会覆盖配置文件中的设置。 - -::: +### 参数说明 +- buffer: 一个 VNODE 写入内存池大小,单位为MB,默认为96,最小为3,最大为16384。 +- CACHEMODEL:表示是否在内存中缓存子表的最近数据。默认为none。 + - none:表示不缓存。 + - last_row:表示缓存子表最近一行数据。这将显著改善 LAST_ROW 函数的性能表现。 + - last_value:表示缓存子表每一列的最近的非 NULL 值。这将显著改善无特殊影响(WHERE、ORDER BY、GROUP BY、INTERVAL)下的 LAST 函数的性能表现。 + - both:表示同时打开缓存最近行和列功能。 +- CACHESIZE:表示缓存子表最近数据的内存大小。默认为 1 ,范围是[1, 65536],单位是 MB。 +- COMP:表示数据库文件压缩标志位,缺省值为 2,取值范围为 [0, 2]。 + - 0:表示不压缩。 + - 1:表示一阶段压缩。 + - 2:表示两阶段压缩。 +- DURATION:数据文件存储数据的时间跨度。可以使用加单位的表示形式,如 DURATION 100h、DURATION 10d等,支持 m(分钟)、h(小时)和 d(天)三个单位。不加时间单位时默认单位为天,如 DURATION 50 表示 50 天。 +- FSYNC:当 WAL 参数设置为2时,落盘的周期。默认为3000,单位毫秒。最小为0,表示每次写入立即落盘;最大为180000,即三分钟。 +- MAXROWS:文件块中记录的最大条数,默认为4096条。 +- MINROWS:文件块中记录的最小条数,默认为100条。 +- KEEP:表示数据文件保存的天数,缺省值为 3650,取值范围 [1, 365000],且必须大于或等于 DURATION 参数值。数据库会自动删除保存时间超过KEEP值的数据。KEEP 可以使用加单位的表示形式,如 KEEP 100h、KEEP 10d 等,支持m(分钟)、h(小时)和 d(天)三个单位。也可以不写单位,如 KEEP 50,此时默认单位为天。 +- PAGES:一个 VNODE 中元数据存储引擎的缓存页个数,默认为256,最小64。一个 VNODE 元数据存储占用 PAGESIZE * PAGES,默认情况下为1MB内存。 +- PAGESIZE:一个 VNODE 中元数据存储引擎的页大小,单位为KB,默认为4 KB。范围为1到16384,即1 KB到16 MB。 +- PRECISION:数据库的时间戳精度。ms表示毫秒,us表示微秒,ns表示纳秒,默认ms毫秒。 +- REPLICA:表示数据库副本数,取值为1或3,默认为1。在集群中使用,副本数必须小于或等于 DNODE 的数目。 +- RETENTIONS:表示数据的聚合周期和保存时长,如RETENTIONS 15s:7d,1m:21d,15m:50d表示数据原始采集周期为15秒,原始数据保存7天;按1分钟聚合的数据保存21天;按15分钟聚合的数据保存50天。目前支持且只支持三级存储周期。 +- STRICT:表示数据同步的一致性要求,默认为off。 + - on 表示强一致,即运行标准的 raft 协议,半数提交返回成功。 + - off表示弱一致,本地提交即返回成功。 +- WAL:WAL级别,默认为1。 + - 1:写WAL,但不执行fsync。 + - 2:写WAL,而且执行fsync。 +- VGROUPS:数据库中初始vgroup的数目。 +- SINGLE_STABLE:表示此数据库中是否只可以创建一个超级表,用于超级表列非常多的情况。 + - 0:表示可以创建多张超级表。 + - 1:表示只可以创建一张超级表。 +- WAL_RETENTION_PERIOD:wal文件的额外保留策略,用于数据订阅。wal的保存时长,单位为s。默认为0,即落盘后立即删除。-1表示不删除。 +- WAL_RETENTION_SIZE:wal文件的额外保留策略,用于数据订阅。wal的保存的最大上限,单位为KB。默认为0,即落盘后立即删除。-1表示不删除。 +- WAL_ROLL_PERIOD:wal文件切换时长,单位为s。当wal文件创建并写入后,经过该时间,会自动创建一个新的wal文件。默认为0,即仅在落盘时创建新文件。 +- WAL_SEGMENT_SIZE:wal单个文件大小,单位为KB。当前写入文件大小超过上限后会自动创建一个新的wal文件。默认为0,即仅在落盘时创建新文件。 ### 创建数据库示例 -创建时间精度为纳秒的数据库, 保留 1 年数据: - ```sql -CREATE DATABASE test PRECISION 'ns' KEEP 365; -``` - -## 显示系统当前参数 +create database if not exists db vgroups 10 buffer 10 -``` -SHOW VARIABLES; ``` -## 使用数据库 +以上示例创建了一个有 10 个 vgroup 名为 db 的数据库, 其中每个 vnode 分配也 10MB 的写入缓存 + +### 使用数据库 ``` USE db_name; @@ -63,61 +95,42 @@ USE db_name; ## 删除数据库 ``` -DROP DATABASE [IF EXISTS] db_name; +DROP DATABASE [IF EXISTS] db_name ``` -删除数据库。指定 Database 所包含的全部数据表将被删除,谨慎使用! +删除数据库。指定 Database 所包含的全部数据表将被删除,该数据库的所有 vgroups 也会被全部销毁,请谨慎使用! ## 修改数据库参数 -``` -ALTER DATABASE db_name COMP 2; +```sql +ALTER DATABASE db_name [alter_database_options] + +alter_database_options: + alter_database_option ... + +alter_database_option: { + CACHEMODEL {'none' | 'last_row' | 'last_value' | 'both'} + | CACHESIZE value + | FSYNC value + | KEEP value + | WAL value +} ``` -COMP 参数是指修改数据库文件压缩标志位,缺省值为 2,取值范围为 [0, 2]。0 表示不压缩,1 表示一阶段压缩,2 表示两阶段压缩。 +:::note +其它参数在3.0.0.0中暂不支持修改 -``` -ALTER DATABASE db_name REPLICA 2; -``` - -REPLICA 参数是指修改数据库副本数,取值范围 [1, 3]。在集群中使用,副本数必须小于或等于 DNODE 的数目。 - -``` -ALTER DATABASE db_name KEEP 365; -``` - -KEEP 参数是指修改数据文件保存的天数,缺省值为 3650,取值范围 [days, 365000],必须大于或等于 days 参数值。 - -``` -ALTER DATABASE db_name QUORUM 2; -``` - -QUORUM 参数是指数据写入成功所需要的确认数,取值范围 [1, 2]。对于异步复制,quorum 设为 1,具有 master 角色的虚拟节点自己确认即可。对于同步复制,quorum 设为 2。原则上,Quorum >= 1 并且 Quorum <= replica(副本数),这个参数在启动一个同步模块实例时需要提供。 - -``` -ALTER DATABASE db_name BLOCKS 100; -``` - -BLOCKS 参数是每个 VNODE (TSDB) 中有多少 cache 大小的内存块,因此一个 VNODE 的用的内存大小粗略为(cache \* blocks)。取值范围 [3, 1000]。 - -``` -ALTER DATABASE db_name CACHELAST 0; -``` - -CACHELAST 参数控制是否在内存中缓存子表的最近数据。缺省值为 0,取值范围 [0, 1, 2, 3]。其中 0 表示不缓存,1 表示缓存子表最近一行数据,2 表示缓存子表每一列的最近的非 NULL 值,3 表示同时打开缓存最近行和列功能。(从 2.0.11.0 版本开始支持参数值 [0, 1],从 2.1.2.0 版本开始支持参数值 [0, 1, 2, 3]。) -说明:缓存最近行,将显著改善 LAST_ROW 函数的性能表现;缓存每列的最近非 NULL 值,将显著改善无特殊影响(WHERE、ORDER BY、GROUP BY、INTERVAL)下的 LAST 函数的性能表现。 - -:::tip -以上所有参数修改后都可以用 show databases 来确认是否修改成功。另外,从 2.1.3.0 版本开始,修改这些参数后无需重启服务器即可生效。 ::: -## 显示系统所有数据库 +## 查看数据库 + +### 查看系统中的所有数据库 ``` SHOW DATABASES; ``` -## 显示一个数据库的创建语句 +### 显示一个数据库的创建语句 ``` SHOW CREATE DATABASE db_name; @@ -125,3 +138,4 @@ SHOW CREATE DATABASE db_name; 常用于数据库迁移。对一个已经存在的数据库,返回其创建语句;在另一个集群中执行该语句,就能得到一个设置完全相同的 Database。 +### 查看数据库参数 diff --git a/docs/zh/12-taos-sql/03-table.md b/docs/zh/12-taos-sql/03-table.md index d7235f3129..ebbaf5f10b 100644 --- a/docs/zh/12-taos-sql/03-table.md +++ b/docs/zh/12-taos-sql/03-table.md @@ -2,13 +2,45 @@ title: 表管理 --- -## 创建数据表 +## 创建表 + +`CREATE TABLE` 语句用于创建普通表和以超级表为模板创建子表。 + +```sql +CREATE TABLE [IF NOT EXISTS] [db_name.]tb_name (create_definition [, create_definitionn] ...) [table_options] + +CREATE TABLE create_subtable_clause + +CREATE TABLE [IF NOT EXISTS] [db_name.]tb_name (create_definition [, create_definitionn] ...) + [TAGS (create_definition [, create_definitionn] ...)] + [table_options] + +create_subtable_clause: { + create_subtable_clause [create_subtable_clause] ... + | [IF NOT EXISTS] [db_name.]tb_name USING [db_name.]stb_name [(tag_name [, tag_name] ...)] TAGS (tag_value [, tag_value] ...) +} + +create_definition: + col_name column_definition + +column_definition: + type_name [comment 'string_value'] + +table_options: + table_option ... + +table_option: { + COMMENT 'string_value' + | WATERMARK duration[,duration] + | MAX_DELAY duration[,duration] + | ROLLUP(func_name [, func_name] ...) + | SMA(col_name [, col_name] ...) + | TTL value +} -``` -CREATE TABLE [IF NOT EXISTS] tb_name (timestamp_field_name TIMESTAMP, field1_name data_type1 [, field2_name data_type2 ...]); ``` -:::info 说明 +**使用说明** 1. 表的第一个字段必须是 TIMESTAMP,并且系统自动将其设为主键; 2. 表名最大长度为 192; @@ -18,57 +50,56 @@ CREATE TABLE [IF NOT EXISTS] tb_name (timestamp_field_name TIMESTAMP, field1_nam 6. 为了兼容支持更多形式的表名,TDengine 引入新的转义符 "\`",可以让表名与关键词不冲突,同时不受限于上述表名称合法性约束检查。但是同样具有长度限制要求。使用转义字符以后,不再对转义字符中的内容进行大小写统一。 例如:\`aBc\` 和 \`abc\` 是不同的表名,但是 abc 和 aBc 是相同的表名。 需要注意的是转义字符中的内容必须是可打印字符。 - 上述的操作逻辑和约束要求与 MySQL 数据的操作一致。 - 从 2.3.0.0 版本开始支持这种方式。 -::: +**参数说明** +1. COMMENT:表注释。可用于超级表、子表和普通表。 +2. WATERMARK:指定窗口的关闭时间,默认值为 5 秒,最小单位毫秒,范围为0到15分钟,多个以逗号分隔。只可用于超级表,且只有当数据库使用了RETENTIONS参数时,才可以使用此表参数。 +3. MAX_DELAY:用于控制推送计算结果的最大延迟,默认值为 interval 的值(但不能超过最大值),最小单位毫秒,范围为1毫秒到15分钟,多个以逗号分隔。注:不建议 MAX_DELAY 设置太小,否则会过于频繁的推送结果,影响存储和查询性能,如无特殊需求,取默认值即可。只可用于超级表,且只有当数据库使用了RETENTIONS参数时,才可以使用此表参数。 +4. ROLLUP:Rollup 指定的聚合函数,提供基于多层级的降采样聚合结果。只可用于超级表。只有当数据库使用了RETENTIONS参数时,才可以使用此表参数。作用于超级表除TS列外的其它所有列,但是只能定义一个聚合函数。 聚合函数支持 avg, sum, min, max, last, first。 +5. SMA:Small Materialized Aggregates,提供基于数据块的自定义预计算功能。预计算类型包括MAX、MIN和SUM。可用于超级表/普通表。 +6. TTL:Time to Live,是用户用来指定表的生命周期的参数。如果在持续的TTL时间内,都没有数据写入该表,则TDengine系统会自动删除该表。这个TTL的时间只是一个大概时间,我们系统不保证到了时间一定会将其删除,而只保证存在这样一个机制。TTL单位是天,默认为0,表示不限制。用户需要注意,TTL优先级高于KEEP,即TTL时间满足删除机制时,即使当前数据的存在时间小于KEEP,此表也会被删除。只可用于子表和普通表。 -### 以超级表为模板创建数据表 +## 创建子表 -``` +### 以超级表为模板创建子表 + +```sql CREATE TABLE [IF NOT EXISTS] tb_name USING stb_name TAGS (tag_value1, ...); ``` -以指定的超级表为模板,指定 TAGS 的值来创建数据表。 +### 以超级表为模板,并指定 TAGS 的值来创建子表: -### 以超级表为模板创建数据表,并指定具体的 TAGS 列 - -``` +```sql CREATE TABLE [IF NOT EXISTS] tb_name USING stb_name (tag_name1, ...) TAGS (tag_value1, ...); ``` -以指定的超级表为模板,指定一部分 TAGS 列的值来创建数据表(没被指定的 TAGS 列会设为空值)。 -说明:从 2.0.17.0 版本开始支持这种方式。在之前的版本中,不允许指定 TAGS 列,而必须显式给出所有 TAGS 列的取值。 +以指定的超级表为模板,也可以指定一部分 TAGS 列的值来创建数据表(没被指定的 TAGS 列会设为空值)。 -### 批量创建数据表 +### 批量创建子表 -``` +```sql CREATE TABLE [IF NOT EXISTS] tb_name1 USING stb_name TAGS (tag_value1, ...) [IF NOT EXISTS] tb_name2 USING stb_name TAGS (tag_value2, ...) ...; ``` -以更快的速度批量创建大量数据表(服务器端 2.0.14 及以上版本)。 - -:::info - -1.批量建表方式要求数据表必须以超级表为模板。 2.在不超出 SQL 语句长度限制的前提下,单条语句中的建表数量建议控制在 1000 ~ 3000 之间,将会获得比较理想的建表速度。 - -::: +批量建表方式要求数据表必须以超级表为模板。 在不超出 SQL 语句长度限制的前提下,单条语句中的建表数量建议控制在 1000 ~ 3000 之间,将会获得比较理想的建表速度。 ## 删除数据表 -``` -DROP TABLE [IF EXISTS] tb_name; +可以在一条SQL语句中删除一个或多个普通表或子表。 + +```sql +DROP TABLE [IF EXISTS] [db_name.]tb_name [, [IF EXISTS] [db_name.]tb_name] ... ``` -## 显示当前数据库下的所有数据表信息 +## 显示所有表 -``` +如下SQL语句可以列出当前数据库中的所有表名。 + +```sql SHOW TABLES [LIKE tb_name_wildchar]; ``` -显示当前数据库下的所有数据表信息。 - -## 显示一个数据表的创建语句 +## 显示表创建语句 ``` SHOW CREATE TABLE tb_name; @@ -76,48 +107,88 @@ SHOW CREATE TABLE tb_name; 常用于数据库迁移。对一个已经存在的数据表,返回其创建语句;在另一个集群中执行该语句,就能得到一个结构完全相同的数据表。 -## 获取表的结构信息 +## 获取表结构信息 ``` DESCRIBE tb_name; ``` -## 修改表定义 +## 修改普通表 -### 表增加列 +```sql +ALTER TABLE [db_name.]tb_name alter_table_clause + +alter_table_clause: { + alter_table_options + | ADD COLUMN col_name column_type + | DROP COLUMN col_name + | MODIFY COLUMN col_name column_type + | RENAME COLUMN old_col_name new_col_name +} + +alter_table_options: + alter_table_option ... + +alter_table_option: { + TTL value + | COMMENT 'string_value' +} ``` + +**使用说明** +对普通表可以进行如下修改操作 +1. ADD COLUMN:添加列。 +2. DROP COLUMN:删除列。 +3. ODIFY COLUMN:修改列定义,如果数据列的类型是可变长类型,那么可以使用此指令修改其宽度,只能改大,不能改小。 +4. RENAME COLUMN:修改列名称。 + +### 增加列 + +```sql ALTER TABLE tb_name ADD COLUMN field_name data_type; ``` -:::info +### 删除列 -1. 列的最大个数为 1024,最小个数为 2;(从 2.1.7.0 版本开始,改为最多允许 4096 列) -2. 列名最大长度为 64。 - -::: - -### 表删除列 - -``` +```sql ALTER TABLE tb_name DROP COLUMN field_name; ``` -如果表是通过超级表创建,更改表结构的操作只能对超级表进行。同时针对超级表的结构更改对所有通过该结构创建的表生效。对于不是通过超级表创建的表,可以直接修改表结构。 +### 修改列宽 -### 表修改列宽 - -``` +```sql ALTER TABLE tb_name MODIFY COLUMN field_name data_type(length); ``` -如果数据列的类型是可变长格式(BINARY 或 NCHAR),那么可以使用此指令修改其宽度(只能改大,不能改小)。(2.1.3.0 版本新增) -如果表是通过超级表创建,更改表结构的操作只能对超级表进行。同时针对超级表的结构更改对所有通过该结构创建的表生效。对于不是通过超级表创建的表,可以直接修改表结构。 +### 修改列名 + +```sql +ALTER TABLE tb_name RENAME COLUMN old_col_name new_col_name +``` + +## 修改子表 + +ALTER TABLE [db_name.]tb_name alter_table_clause + +alter_table_clause: { + alter_table_options + | SET TAG tag_name = new_tag_value +} + +alter_table_options: + alter_table_option ... + +alter_table_option: { + TTL value + | COMMENT 'string_value' +} + +**使用说明** +1. 对子表的列和标签的修改,除了更改标签值以外,都要通过超级表才能进行。 ### 修改子表标签值 ``` ALTER TABLE tb_name SET TAG tag_name=new_tag_value; -``` - -如果表是通过超级表创建,可以使用此指令修改其标签值 +``` \ No newline at end of file diff --git a/docs/zh/12-taos-sql/04-stable.md b/docs/zh/12-taos-sql/04-stable.md index 3901427736..263bb53d3c 100644 --- a/docs/zh/12-taos-sql/04-stable.md +++ b/docs/zh/12-taos-sql/04-stable.md @@ -3,38 +3,29 @@ sidebar_label: 超级表管理 title: 超级表 STable 管理 --- -:::note - -在 2.0.15.0 及以后的版本中开始支持 STABLE 保留字。也即,在本节后文的指令说明中,CREATE、DROP、ALTER 三个指令在 2.0.15.0 之前的版本中 STABLE 保留字需写作 TABLE。 - -::: - ## 创建超级表 -``` -CREATE STABLE [IF NOT EXISTS] stb_name (timestamp_field_name TIMESTAMP, field1_name data_type1 [, field2_name data_type2 ...]) TAGS (tag1_name tag_type1, tag2_name tag_type2 [, tag3_name tag_type3]); +```sql +CREATE STABLE [IF NOT EXISTS] stb_name (create_definition [, create_definitionn] ...) TAGS (create_definition [, create_definition] ...) [table_options] + +create_definition: + col_name column_definition + +column_definition: + type_name [COMMENT 'string_value'] ``` -创建 STable,与创建表的 SQL 语法相似,但需要指定 TAGS 字段的名称和类型。 +**使用说明** +- 超级表中列的最大个数为 4096,需要注意,这里的 4096 是包含 TAG 列在内的,最小个数为 3,包含一个时间戳主键、一个 TAG 列和一个数据列。 +- 建表时可以给列或标签附加注释。 +- TAGS语法指定超级表的标签列,标签列需要遵循以下约定: + - TAGS 中的 TIMESTAMP 列写入数据时需要提供给定值,而暂不支持四则运算,例如 NOW + 10s 这类表达式。 + - TAGS 列名不能与其他列名相同。 + - TAGS 列名不能为预留关键字。 + - TAGS 最多允许 128 个,至少 1 个,总长度不超过 16 KB。 +- 关于表参数的详细说明,参见 CREATE TABLE 中的介绍。 -:::info - -1. TAGS 列的数据类型不能是 timestamp 类型;(从 2.1.3.0 版本开始,TAGS 列中支持使用 timestamp 类型,但需注意在 TAGS 中的 timestamp 列写入数据时需要提供给定值,而暂不支持四则运算,例如 `NOW + 10s` 这类表达式) -2. TAGS 列名不能与其他列名相同; -3. TAGS 列名不能为预留关键字(参见:[参数限制与保留关键字](/taos-sql/keywords/) 章节); -4. TAGS 最多允许 128 个,至少 1 个,总长度不超过 16 KB。 - -::: - -## 删除超级表 - -``` -DROP STABLE [IF EXISTS] stb_name; -``` - -删除 STable 会自动删除通过 STable 创建的子表。 - -## 显示当前数据库下的所有超级表信息 +### 显示当前数据库下的所有超级表信息 ``` SHOW STABLES [LIKE tb_name_wildcard]; @@ -42,7 +33,7 @@ SHOW STABLES [LIKE tb_name_wildcard]; 查看数据库内全部 STable,及其相关信息,包括 STable 的名称、创建时间、列数量、标签(TAG)数量、通过该 STable 建表的数量。 -## 显示一个超级表的创建语句 +### 显示一个超级表的创建语句 ``` SHOW CREATE STABLE stb_name; @@ -50,40 +41,81 @@ SHOW CREATE STABLE stb_name; 常用于数据库迁移。对一个已经存在的超级表,返回其创建语句;在另一个集群中执行该语句,就能得到一个结构完全相同的超级表。 -## 获取超级表的结构信息 +### 获取超级表的结构信息 ``` DESCRIBE stb_name; ``` -## 修改超级表普通列 - -### 超级表增加列 +## 删除超级表 ``` -ALTER STABLE stb_name ADD COLUMN field_name data_type; +DROP STABLE [IF EXISTS] [db_name.]stb_name ``` -### 超级表删除列 +删除 STable 会自动删除通过 STable 创建的子表以及子表中的所有数据。 + +## 修改超级表 + +```sql +ALTER STABLE [db_name.]tb_name alter_table_clause + +alter_table_clause: { + alter_table_options + | ADD COLUMN col_name column_type + | DROP COLUMN col_name + | MODIFY COLUMN col_name column_type + | ADD TAG tag_name tag_type + | DROP TAG tag_name + | MODIFY TAG tag_name tag_type + | RENAME TAG old_tag_name new_tag_name +} + +alter_table_options: + alter_table_option ... + +alter_table_option: { + COMMENT 'string_value' +} -``` -ALTER STABLE stb_name DROP COLUMN field_name; ``` -### 超级表修改列宽 +**使用说明** + +修改超级表的结构会对其下的所有子表生效。无法针对某个特定子表修改表结构。标签结构的修改需要对超级表下发,TDengine 会自动作用于此超级表的所有子表。 + +- ADD COLUMN:添加列。 +- DROP COLUMN:删除列。 +- MODIFY COLUMN:修改列定义,如果数据列的类型是可变长类型,那么可以使用此指令修改其宽度,只能改大,不能改小。 +- ADD TAG:给超级表添加一个标签。 +- DROP TAG:删除超级表的一个标签。从超级表删除某个标签后,该超级表下的所有子表也会自动删除该标签。 +- MODIFY TAG:修改超级表的一个标签的定义。如果标签的类型是可变长类型,那么可以使用此指令修改其宽度,只能改大,不能改小。 +- RENAME TAG:修改超级表的一个标签的名称。从超级表修改某个标签名后,该超级表下的所有子表也会自动更新该标签名。 + +### 增加列 ``` -ALTER STABLE stb_name MODIFY COLUMN field_name data_type(length); +ALTER STABLE stb_name ADD COLUMN col_name column_type; ``` -如果数据列的类型是可变长格式(BINARY 或 NCHAR),那么可以使用此指令修改其宽度(只能改大,不能改小)。(2.1.3.0 版本新增) +### 删除列 -## 修改超级表标签列 +``` +ALTER STABLE stb_name DROP COLUMN col_name; +``` + +### 修改列宽 + +``` +ALTER STABLE stb_name MODIFY COLUMN col_name data_type(length); +``` + +如果数据列的类型是可变长格式(BINARY 或 NCHAR),那么可以使用此指令修改其宽度(只能改大,不能改小)。 ### 添加标签 ``` -ALTER STABLE stb_name ADD TAG new_tag_name tag_type; +ALTER STABLE stb_name ADD TAG tag_name tag_type; ``` 为 STable 增加一个新的标签,并指定新标签的类型。标签总数不能超过 128 个,总长度不超过 16KB 。 @@ -99,7 +131,7 @@ ALTER STABLE stb_name DROP TAG tag_name; ### 修改标签名 ``` -ALTER STABLE stb_name CHANGE TAG old_tag_name new_tag_name; +ALTER STABLE stb_name RENAME TAG old_tag_name new_tag_name; ``` 修改超级表的标签名,从超级表修改某个标签名后,该超级表下的所有子表也会自动更新该标签名。 From 49a4e83d484c32d839ee97561a7034920c7d9b65 Mon Sep 17 00:00:00 2001 From: Minghao Li Date: Tue, 26 Jul 2022 13:23:56 +0800 Subject: [PATCH 51/54] refactor(sync): add pre-commit interface --- source/libs/sync/src/syncMain.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/source/libs/sync/src/syncMain.c b/source/libs/sync/src/syncMain.c index 63a404d5f6..935d89b99b 100644 --- a/source/libs/sync/src/syncMain.c +++ b/source/libs/sync/src/syncMain.c @@ -2506,9 +2506,6 @@ int32_t syncNodeOnClientRequestCb(SSyncNode* ths, SyncClientRequest* pMsg, SyncI // pre commit syncNodePreCommit(ths, pEntry, 0); - SRpcMsg rpcMsg; - syncEntry2OriginalRpc(pEntry, &rpcMsg); - // if only myself, maybe commit right now if (ths->replicaNum == 1) { syncMaybeAdvanceCommitIndex(ths); From e13e80db72bd1a13a16fc8a0b7bf5dc43346bbf3 Mon Sep 17 00:00:00 2001 From: gccgdb1234 Date: Tue, 26 Jul 2022 13:55:00 +0800 Subject: [PATCH 52/54] doc: refine table and stable --- docs/zh/12-taos-sql/03-table.md | 66 ++++++++++++++++---------------- docs/zh/12-taos-sql/04-stable.md | 2 + 2 files changed, 36 insertions(+), 32 deletions(-) diff --git a/docs/zh/12-taos-sql/03-table.md b/docs/zh/12-taos-sql/03-table.md index ebbaf5f10b..9f3586ce6d 100644 --- a/docs/zh/12-taos-sql/03-table.md +++ b/docs/zh/12-taos-sql/03-table.md @@ -61,13 +61,13 @@ table_option: { ## 创建子表 -### 以超级表为模板创建子表 +### 创建子表 ```sql CREATE TABLE [IF NOT EXISTS] tb_name USING stb_name TAGS (tag_value1, ...); ``` -### 以超级表为模板,并指定 TAGS 的值来创建子表: +### 创建子表并指定标签的值 ```sql CREATE TABLE [IF NOT EXISTS] tb_name USING stb_name (tag_name1, ...) TAGS (tag_value1, ...); @@ -83,36 +83,6 @@ CREATE TABLE [IF NOT EXISTS] tb_name1 USING stb_name TAGS (tag_value1, ...) [IF 批量建表方式要求数据表必须以超级表为模板。 在不超出 SQL 语句长度限制的前提下,单条语句中的建表数量建议控制在 1000 ~ 3000 之间,将会获得比较理想的建表速度。 -## 删除数据表 - -可以在一条SQL语句中删除一个或多个普通表或子表。 - -```sql -DROP TABLE [IF EXISTS] [db_name.]tb_name [, [IF EXISTS] [db_name.]tb_name] ... -``` - -## 显示所有表 - -如下SQL语句可以列出当前数据库中的所有表名。 - -```sql -SHOW TABLES [LIKE tb_name_wildchar]; -``` - -## 显示表创建语句 - -``` -SHOW CREATE TABLE tb_name; -``` - -常用于数据库迁移。对一个已经存在的数据表,返回其创建语句;在另一个集群中执行该语句,就能得到一个结构完全相同的数据表。 - -## 获取表结构信息 - -``` -DESCRIBE tb_name; -``` - ## 修改普通表 ```sql @@ -191,4 +161,36 @@ alter_table_option: { ``` ALTER TABLE tb_name SET TAG tag_name=new_tag_value; +``` + +## 删除表 + +可以在一条SQL语句中删除一个或多个普通表或子表。 + +```sql +DROP TABLE [IF EXISTS] [db_name.]tb_name [, [IF EXISTS] [db_name.]tb_name] ... +``` + +## 查看表的信息 + +### 显示所有表 + +如下SQL语句可以列出当前数据库中的所有表名。 + +```sql +SHOW TABLES [LIKE tb_name_wildchar]; +``` + +### 显示表创建语句 + +``` +SHOW CREATE TABLE tb_name; +``` + +常用于数据库迁移。对一个已经存在的数据表,返回其创建语句;在另一个集群中执行该语句,就能得到一个结构完全相同的数据表。 + +### 获取表结构信息 + +``` +DESCRIBE tb_name; ``` \ No newline at end of file diff --git a/docs/zh/12-taos-sql/04-stable.md b/docs/zh/12-taos-sql/04-stable.md index 263bb53d3c..4d0f5e4765 100644 --- a/docs/zh/12-taos-sql/04-stable.md +++ b/docs/zh/12-taos-sql/04-stable.md @@ -25,6 +25,8 @@ column_definition: - TAGS 最多允许 128 个,至少 1 个,总长度不超过 16 KB。 - 关于表参数的详细说明,参见 CREATE TABLE 中的介绍。 +## 查看超级表 + ### 显示当前数据库下的所有超级表信息 ``` From 3b719337c6166cee6843ed4bde8d56e408a0df01 Mon Sep 17 00:00:00 2001 From: Ganlin Zhao Date: Tue, 26 Jul 2022 14:14:19 +0800 Subject: [PATCH 53/54] fix ut test case --- source/libs/parser/test/parSelectTest.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/libs/parser/test/parSelectTest.cpp b/source/libs/parser/test/parSelectTest.cpp index 7376cc1fa3..951ca5e40d 100644 --- a/source/libs/parser/test/parSelectTest.cpp +++ b/source/libs/parser/test/parSelectTest.cpp @@ -146,7 +146,7 @@ TEST_F(ParserSelectTest, IndefiniteRowsFuncSemanticCheck) { run("SELECT DIFF(c1), c2 FROM t1"); - run("SELECT DIFF(c1), tbname FROM t1", TSDB_CODE_PAR_NOT_SINGLE_GROUP); + run("SELECT DIFF(c1), tbname FROM t1"); run("SELECT DIFF(c1), count(*) FROM t1", TSDB_CODE_PAR_NOT_ALLOWED_FUNC); From 285eb4ff259f7ec8f55f263c91872006df83bbd9 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Tue, 26 Jul 2022 14:41:39 +0800 Subject: [PATCH 54/54] test: valgrind case --- tests/script/tsim/valgrind/basic2.sim | 140 ++++++++++----------- tests/script/tsim/valgrind/basic4.sim | 74 +++++++++++ tests/script/tsim/valgrind/checkError3.sim | 1 + tests/script/tsim/valgrind/checkError5.sim | 33 +++++ tests/script/tsim/valgrind/checkError7.sim | 75 +++++++++++ 5 files changed, 246 insertions(+), 77 deletions(-) create mode 100644 tests/script/tsim/valgrind/basic4.sim create mode 100644 tests/script/tsim/valgrind/checkError7.sim diff --git a/tests/script/tsim/valgrind/basic2.sim b/tests/script/tsim/valgrind/basic2.sim index 45ac78daf0..7c905209ee 100644 --- a/tests/script/tsim/valgrind/basic2.sim +++ b/tests/script/tsim/valgrind/basic2.sim @@ -1,6 +1,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/exec.sh -n dnode1 -s start -v +system sh/cfg.sh -n dnode1 -c debugflag -v 131 +system sh/exec.sh -n dnode1 -s start sql connect print =============== step1: create drop show dnodes @@ -21,88 +22,73 @@ if $data(1)[4] != ready then goto step1 endi -print =============== step2: create db -sql create database db +$tbPrefix = tb +$tbNum = 5 +$rowNum = 10 + +print =============== step2: prepare data +sql create database db vgroups 2 sql use db -sql create table db.stb (ts timestamp, c1 int, c2 binary(4)) tags(t1 int, t2 float, t3 binary(16)) comment "abd" -sql create table db.c1 using db.stb tags(101, 102, "103") +sql create table if not exists stb (ts timestamp, tbcol int, tbcol2 float, tbcol3 double) tags (tgcol int unsigned) -print =============== step3: alter stb -sql_error alter table db.stb add column ts int -sql alter table db.stb add column c3 int -sql alter table db.stb add column c4 bigint -sql alter table db.stb add column c5 binary(12) -sql alter table db.stb drop column c1 -sql alter table db.stb drop column c4 -sql alter table db.stb MODIFY column c2 binary(32) -sql alter table db.stb add tag t4 bigint -sql alter table db.stb add tag c1 int -sql alter table db.stb add tag t5 binary(12) -sql alter table db.stb drop tag c1 -sql alter table db.stb drop tag t5 -sql alter table db.stb MODIFY tag t3 binary(32) -sql alter table db.stb rename tag t1 tx -sql alter table db.stb comment 'abcde' ; -sql drop table db.stb +$i = 0 +while $i < $tbNum + $tb = $tbPrefix . $i + sql create table $tb using stb tags( $i ) + $x = 0 + while $x < $rowNum + $cc = $x * 60000 + $ms = 1601481600000 + $cc + sql insert into $tb values ($ms , $x , $x , $x ) + $x = $x + 1 + endw -print =============== step4: alter tb -sql create table tb (ts timestamp, a int) -sql insert into tb values(now-28d, -28) -sql select count(a) from tb -sql alter table tb add column b smallint -sql insert into tb values(now-25d, -25, 0) -sql select count(b) from tb -sql alter table tb add column c tinyint -sql insert into tb values(now-22d, -22, 3, 0) -sql select count(c) from tb -sql alter table tb add column d int -sql insert into tb values(now-19d, -19, 6, 0, 0) -sql select count(d) from tb -sql alter table tb add column e bigint -sql alter table tb add column f float -sql alter table tb add column g double -sql alter table tb add column h binary(10) -sql select count(a), count(b), count(c), count(d), count(e), count(f), count(g), count(h) from tb -sql select * from tb order by ts desc + $cc = $x * 60000 + $ms = 1601481600000 + $cc + sql insert into $tb values ($ms , NULL , NULL , NULL ) + $i = $i + 1 +endw -print =============== step5: alter stb and insert data -sql create table stb (ts timestamp, c1 int, c2 binary(4)) tags(t1 int, t2 float, t3 binary(16)) comment "abd" -sql show db.stables -sql describe stb -sql_error alter table stb add column ts int +system sh/exec.sh -n dnode1 -s stop -x SIGINT +system sh/exec.sh -n dnode1 -s start -v -sql create table db.ctb using db.stb tags(101, 102, "103") -sql insert into db.ctb values(now, 1, "2") -sql show db.tables -sql select * from db.stb -sql select * from tb +print =============== step3: tb +sql select avg(tbcol) from tb1 +sql select avg(tbcol) from tb1 where ts <= 1601481840000 +sql select avg(tbcol) as b from tb1 +sql select avg(tbcol) as b from tb1 interval(1d) +sql select avg(tbcol) as b from tb1 where ts <= 1601481840000 interval(1m) +sql select bottom(tbcol, 2) from tb1 where ts <= 1601481840000 +sql select top(tbcol, 2) from tb1 where ts <= 1601481840000 +sql select percentile(tbcol, 2) from tb1 where ts <= 1601481840000 +sql select leastsquares(tbcol, 1, 1) as b from tb1 where ts <= 1601481840000 +sql show table distributed tb1 +sql select count(tbcol) as b from tb1 where ts <= 1601481840000 interval(1m) +sql select diff(tbcol) from tb1 where ts <= 1601481840000 +sql select diff(tbcol) from tb1 where tbcol > 5 and tbcol < 20 +sql select first(tbcol), last(tbcol) as b from tb1 where ts <= 1601481840000 interval(1m) +sql select count(tbcol), avg(tbcol), max(tbcol), min(tbcol), sum(tbcol), stddev(tbcol) from tb1 where ts <= 1601481840000 partition by tgcol interval(1m) +#sql select count(tbcol), avg(tbcol), max(tbcol), min(tbcol), count(tbcol) from tb1 where ts <= 1601481840000 and ts >= 1601481800000 partition by tgcol interval(1m) fill(value, 0) +sql select last_row(*) from tb1 where tbcol > 5 and tbcol < 20 -sql alter table stb add column c3 int -sql describe stb -sql select * from db.stb -sql select * from tb -sql insert into db.ctb values(now+1s, 1, 2, 3) -sql select * from db.stb - -sql alter table db.stb add column c4 bigint -sql select * from db.stb -sql insert into db.ctb values(now+2s, 1, 2, 3, 4) - -sql alter table db.stb drop column c1 -sql reset query cache -sql select * from tb -sql insert into db.ctb values(now+3s, 2, 3, 4) -sql select * from db.stb - -sql alter table db.stb add tag t4 bigint -sql select * from db.stb -sql select * from db.stb -sql_error create table db.ctb2 using db.stb tags(101, "102") -sql create table db.ctb2 using db.stb tags(101, 102, "103", 104) -sql insert into db.ctb2 values(now, 1, 2, 3) - -print =============== step6: query data -sql select * from db.stb where tbname = 'ctb2'; +print =============== step4: stb +sql select avg(tbcol) as c from stb +sql select avg(tbcol) as c from stb where ts <= 1601481840000 +sql select avg(tbcol) as c from stb where tgcol < 5 and ts <= 1601481840000 +sql select avg(tbcol) as c from stb interval(1m) +sql select avg(tbcol) as c from stb interval(1d) +sql select avg(tbcol) as b from stb where ts <= 1601481840000 interval(1m) +sql select avg(tbcol) as c from stb group by tgcol +sql select avg(tbcol) as b from stb where ts <= 1601481840000 partition by tgcol interval(1m) +sql show table distributed stb +sql select count(tbcol) as b from stb where ts <= 1601481840000 partition by tgcol interval(1m) +sql select diff(tbcol) from stb where ts <= 1601481840000 +sql select first(tbcol), last(tbcol) as c from stb group by tgcol +sql select first(tbcol), last(tbcol) as b from stb where ts <= 1601481840000 and tbcol2 is null partition by tgcol interval(1m) +sql select first(tbcol), last(tbcol) as b from stb where ts <= 1601481840000 partition by tgcol interval(1m) +sql select count(tbcol), avg(tbcol), max(tbcol), min(tbcol), sum(tbcol), stddev(tbcol) from stb where ts <= 1601481840000 partition by tgcol interval(1m) +#sql select count(tbcol), avg(tbcol), max(tbcol), min(tbcol), count(tbcol) from stb where ts <= 1601481840000 and ts >= 1601481800000 partition by tgcol interval(1m) fill(value, 0) +sql select last_row(tbcol), stddev(tbcol) from stb where tbcol > 5 and tbcol < 20 group by tgcol _OVER: system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/tsim/valgrind/basic4.sim b/tests/script/tsim/valgrind/basic4.sim new file mode 100644 index 0000000000..8be96f769b --- /dev/null +++ b/tests/script/tsim/valgrind/basic4.sim @@ -0,0 +1,74 @@ +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/cfg.sh -n dnode1 -c debugflag -v 131 +system sh/exec.sh -n dnode1 -s start -v +sql connect + +print =============== step1: create drop show dnodes +$x = 0 +step1: + $x = $x + 1 + sleep 1000 + if $x == 10 then + print ---> dnode not ready! + return -1 + endi +sql show dnodes +print ---> $data00 $data01 $data02 $data03 $data04 $data05 +if $rows != 1 then + return -1 +endi +if $data(1)[4] != ready then + goto step1 +endi + +print =============== step2: create db +sql create database d1 vgroups 2 buffer 3 +sql show databases +sql use d1 +sql show vgroups + +print =============== step3: create show stable +sql create table if not exists stb (ts timestamp, c1 int, c2 float, c3 double) tags (t1 int unsigned) +sql show stables +if $rows != 1 then + return -1 +endi + +print =============== step4: create show table +sql create table ct1 using stb tags(1000) +sql create table ct2 using stb tags(2000) +sql create table ct3 using stb tags(3000) +sql show tables +if $rows != 3 then + return -1 +endi + +print =============== step5: insert data (null / update) +sql insert into ct1 values(now+0s, 10, 2.0, 3.0) +sql insert into ct1 values(now+1s, 11, 2.1, NULL)(now+2s, -12, -2.2, -3.2)(now+3s, -13, -2.3, -3.3) +sql insert into ct2 values(now+0s, 10, 2.0, 3.0) +sql insert into ct2 values(now+1s, 11, 2.1, 3.1)(now+2s, -12, -2.2, -3.2)(now+3s, -13, -2.3, -3.3) +sql insert into ct3 values('2021-01-01 00:00:00.000', NULL, NULL, 3.0) +sql insert into ct3 values('2022-03-02 16:59:00.010', 3 , 4, 5), ('2022-03-02 16:59:00.010', 33 , 4, 5), ('2022-04-01 16:59:00.011', 4, 4, 5), ('2022-04-01 16:59:00.011', 6, 4, 5), ('2022-03-06 16:59:00.013', 8, 4, 5); +sql insert into ct3 values('2022-03-02 16:59:00.010', 103, 1, 2), ('2022-03-02 16:59:00.010', 303, 3, 4), ('2022-04-01 16:59:00.011', 40, 5, 6), ('2022-04-01 16:59:00.011', 60, 4, 5), ('2022-03-06 16:59:00.013', 80, 4, 5); + +print =============== step6: query data= + +sql select * from stb where t1 between 1000 and 2500 + + +_OVER: +system sh/exec.sh -n dnode1 -s stop -x SIGINT +print =============== check +$null= + +system_content sh/checkValgrind.sh -n dnode1 +print cmd return result ----> [ $system_content ] +if $system_content > 0 then + return -1 +endi + +if $system_content == $null then + return -1 +endi diff --git a/tests/script/tsim/valgrind/checkError3.sim b/tests/script/tsim/valgrind/checkError3.sim index e8b25098d6..41623896b3 100644 --- a/tests/script/tsim/valgrind/checkError3.sim +++ b/tests/script/tsim/valgrind/checkError3.sim @@ -37,6 +37,7 @@ sql show stables if $rows != 4 then return -1 endi +sql show stables like 'stb' print =============== step4: ccreate child table sql create table c1 using stb tags(true, -1, -2, -3, -4, -6.0, -7.0, 'child tbl 1', 'child tbl 1', '2022-02-25 18:00:00.000', 10, 20, 30, 40) diff --git a/tests/script/tsim/valgrind/checkError5.sim b/tests/script/tsim/valgrind/checkError5.sim index 6eef185fd3..f0786587d9 100644 --- a/tests/script/tsim/valgrind/checkError5.sim +++ b/tests/script/tsim/valgrind/checkError5.sim @@ -105,6 +105,39 @@ sql insert into db.ctb2 values(now, 1, 2, 3) print =============== step6: query data sql select * from db.stb where tbname = 'ctb2'; + +print =============== step7: normal table +sql create database d1 replica 1 duration 7 keep 50 +sql use d1 +sql create table tb (ts timestamp, a int) +sql insert into tb values(now-28d, -28) +sql alter table tb add column b smallint +sql insert into tb values(now-25d, -25, 0) +sql alter table tb add column c tinyint +sql insert into tb values(now-22d, -22, 3, 0) +sql alter table tb add column d int +sql insert into tb values(now-19d, -19, 6, 0, 0) +sql alter table tb add column e bigint +sql insert into tb values(now-16d, -16, 9, 0, 0, 0) +sql alter table tb add column f float +sql insert into tb values(now-13d, -13, 12, 0, 0, 0, 0) +sql alter table tb add column g double +sql insert into tb values(now-10d, -10, 15, 0, 0, 0, 0, 0) +sql alter table tb add column h binary(10) +sql insert into tb values(now-7d, -7, 18, 0, 0, 0, 0, 0, '0') +sql select count(a), count(b), count(c), count(d), count(e), count(f), count(g), count(h) from d1.tb; +sql alter table tb drop column a +sql insert into tb values(now-4d, 1, 1, 1, 1, 1, 1, '1') +sql alter table tb drop column b +sql insert into tb values(now-3d, 1, 1, 1, 1, 1, '1') +sql alter table tb drop column c +sql insert into tb values(now-2d, 1, 1, 1, 1, '1') +sql alter table tb drop column d +sql insert into tb values(now-1d, 1, 1, 1, '1') +sql alter table tb drop column e +sql insert into tb values(now, 1, 1, '1') +sql select count(h) from tb + _OVER: system sh/exec.sh -n dnode1 -s stop -x SIGINT print =============== check diff --git a/tests/script/tsim/valgrind/checkError7.sim b/tests/script/tsim/valgrind/checkError7.sim new file mode 100644 index 0000000000..a66ddb30df --- /dev/null +++ b/tests/script/tsim/valgrind/checkError7.sim @@ -0,0 +1,75 @@ +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/exec.sh -n dnode1 -s start -v +sql connect + +print ======================== create stable +sql create database d1 +sql use d1 + +$x = 0 +while $x < 128 + $tb = d1.s . $x + sql create table $tb (ts timestamp, i int) tags (j int) + $x = $x + 1 +endw + +print ======================== describe stables +# TODO : create stable error +$m = 0 +while $m < 128 + $tb = s . $m + $filter = ' . $tb + $filter = $filter . ' + sql show stables like $filter + print sql : show stables like $filter + if $rows != 1 then + print expect 1, actual: $rows + return -1 + endi + $m = $m + 1 +endw + + +print ======================== show stables + +sql show d1.stables + +print num of stables is $rows +if $rows != 128 then + return -1 +endi + +print ======================== create table + +$x = 0 +while $x < 424 + $tb = d1.t . $x + sql create table $tb using d1.s0 tags( $x ) + $x = $x + 1 +endw + +print ======================== show stables + +sql show d1.tables + +print num of tables is $rows +if $rows != 424 then + return -1 +endi + + +_OVER: +system sh/exec.sh -n dnode1 -s stop -x SIGINT +print =============== check +$null= + +system_content sh/checkValgrind.sh -n dnode1 +print cmd return result ----> [ $system_content ] +if $system_content > 2 then + return -1 +endi + +if $system_content == $null then + return -1 +endi