diff --git a/src/common/src/tdataformat.c b/src/common/src/tdataformat.c index 77e91acc14f852f9e55d72f13532ea68a26078c5..40cdac9833fb37569c5e36e80dd53d5b55b6aac8 100644 --- a/src/common/src/tdataformat.c +++ b/src/common/src/tdataformat.c @@ -588,7 +588,7 @@ int tdSetKVRowDataOfCol(SKVRow *orow, int16_t colId, int8_t type, void *value) { if (kvRowNCols(nrow) - colIdx - 1 > 0) { for (int i = colIdx + 1; i < kvRowNCols(nrow); i++) { kvRowColIdxAt(nrow, i)->colId = kvRowColIdxAt(row, i)->colId; - kvRowColIdxAt(nrow, i)->offset += diff; + kvRowColIdxAt(nrow, i)->offset = kvRowColIdxAt(row, i)->offset + diff; } memcpy(kvRowColVal(nrow, kvRowColIdxAt(nrow, colIdx + 1)), kvRowColVal(row, kvRowColIdxAt(row, colIdx + 1)), POINTER_DISTANCE(kvRowEnd(row), kvRowColVal(row, kvRowColIdxAt(row, colIdx + 1)))); diff --git a/src/dnode/src/dnodeMgmt.c b/src/dnode/src/dnodeMgmt.c index d35e82fa47232b2d323d80721a9f08f1115d3ee1..30fdd21b99b4ffaf413a27d957b391bfabecc0dd 100644 --- a/src/dnode/src/dnodeMgmt.c +++ b/src/dnode/src/dnodeMgmt.c @@ -616,6 +616,16 @@ static void dnodeSendStatusMsg(void *handle, void *tmrId) { pStatus->numOfCores = htons((uint16_t) tsNumOfCores); pStatus->diskAvailable = tsAvailDataDirGB; pStatus->alternativeRole = (uint8_t) tsAlternativeRole; + + // fill cluster cfg parameters + pStatus->clusterCfg.numOfMnodes = tsNumOfMnodes; + pStatus->clusterCfg.mnodeEqualVnodeNum = tsMnodeEqualVnodeNum; + pStatus->clusterCfg.offlineThreshold = tsOfflineThreshold; + pStatus->clusterCfg.statusInterval = tsStatusInterval; + strcpy(pStatus->clusterCfg.arbitrator, tsArbitrator); + strcpy(pStatus->clusterCfg.timezone, tsTimezone); + strcpy(pStatus->clusterCfg.locale, tsLocale); + strcpy(pStatus->clusterCfg.charset, tsCharset); vnodeBuildStatusMsg(pStatus); contLen = sizeof(SDMStatusMsg) + pStatus->openVnodes * sizeof(SVnodeLoad); diff --git a/src/inc/taoserror.h b/src/inc/taoserror.h index fa1cd25b7ce90671e38d0f75f0debc511d62f1c5..50b7527675ca83567fd39ba748f05d1a94e40909 100644 --- a/src/inc/taoserror.h +++ b/src/inc/taoserror.h @@ -125,6 +125,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_MND_DNODE_NOT_EXIST, 0, 0x0331, "mnode dnod TAOS_DEFINE_ERROR(TSDB_CODE_MND_VGROUP_NOT_EXIST, 0, 0x0332, "mnode vgroup not exist") TAOS_DEFINE_ERROR(TSDB_CODE_MND_NO_REMOVE_MASTER, 0, 0x0333, "mnode cant not remove master") TAOS_DEFINE_ERROR(TSDB_CODE_MND_NO_ENOUGH_DNODES, 0, 0x0334, "mnode no enough dnodes") +TAOS_DEFINE_ERROR(TSDB_CODE_MND_CLUSTER_CFG_INCONSISTENT, 0, 0x0335, "mnode cluster cfg inconsistent") TAOS_DEFINE_ERROR(TSDB_CODE_MND_ACCT_ALREADY_EXIST, 0, 0x0340, "mnode accounts already exist") TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_ACCT, 0, 0x0341, "mnode invalid account") diff --git a/src/inc/taosmsg.h b/src/inc/taosmsg.h index 8e732f0cac3fd223a00c19e5fff7106e0946633d..43e34b6ce2364dd5bf1950dea57d47e9ff72dfee 100644 --- a/src/inc/taosmsg.h +++ b/src/inc/taosmsg.h @@ -557,18 +557,30 @@ typedef struct { } SDMMnodeInfos; typedef struct { - uint32_t version; - int32_t dnodeId; - char dnodeEp[TSDB_EP_LEN]; - uint32_t moduleStatus; - uint32_t lastReboot; // time stamp for last reboot - uint16_t numOfTotalVnodes; // from config file - uint16_t openVnodes; - uint16_t numOfCores; - float diskAvailable; // GB - uint8_t alternativeRole; - uint8_t reserve[15]; - SVnodeLoad load[]; + int32_t numOfMnodes; // tsNumOfMnodes + int32_t mnodeEqualVnodeNum; // tsMnodeEqualVnodeNum + int32_t offlineThreshold; // tsOfflineThreshold + int32_t statusInterval; // tsStatusInterval + char arbitrator[TSDB_EP_LEN]; // tsArbitrator + char timezone[64]; // tsTimezone + char locale[TSDB_LOCALE_LEN]; // tsLocale + char charset[TSDB_LOCALE_LEN]; // tsCharset +} SClusterCfg; + +typedef struct { + uint32_t version; + int32_t dnodeId; + char dnodeEp[TSDB_EP_LEN]; + uint32_t moduleStatus; + uint32_t lastReboot; // time stamp for last reboot + uint16_t numOfTotalVnodes; // from config file + uint16_t openVnodes; + uint16_t numOfCores; + float diskAvailable; // GB + uint8_t alternativeRole; + uint8_t reserve[15]; + SClusterCfg clusterCfg; + SVnodeLoad load[]; } SDMStatusMsg; typedef struct { diff --git a/src/mnode/src/mnodeDnode.c b/src/mnode/src/mnodeDnode.c index 816bcc6c5c8a1b69db0b03f6d184b7eb0f47154b..be1ccd25b785991d0d8d21487686c3aae993e925 100644 --- a/src/mnode/src/mnodeDnode.c +++ b/src/mnode/src/mnodeDnode.c @@ -278,6 +278,20 @@ static void mnodeProcessCfgDnodeMsgRsp(SRpcMsg *rpcMsg) { mPrint("cfg dnode rsp is received"); } +static bool mnodeCheckClusterCfgPara(const SClusterCfg *clusterCfg) { + if (clusterCfg->numOfMnodes != tsNumOfMnodes) return false; + if (clusterCfg->mnodeEqualVnodeNum != tsMnodeEqualVnodeNum) return false; + if (clusterCfg->offlineThreshold != tsOfflineThreshold) return false; + if (clusterCfg->statusInterval != tsStatusInterval) return false; + + if (0 != strncasecmp(clusterCfg->arbitrator, tsArbitrator, strlen(tsArbitrator))) return false; + if (0 != strncasecmp(clusterCfg->timezone, tsTimezone, strlen(tsTimezone))) return false; + if (0 != strncasecmp(clusterCfg->locale, tsLocale, strlen(tsLocale))) return false; + if (0 != strncasecmp(clusterCfg->charset, tsCharset, strlen(tsCharset))) return false; + + return true; +} + static int32_t mnodeProcessDnodeStatusMsg(SMnodeMsg *pMsg) { SDMStatusMsg *pStatus = pMsg->rpcMsg.pCont; pStatus->dnodeId = htonl(pStatus->dnodeId); @@ -313,7 +327,6 @@ static int32_t mnodeProcessDnodeStatusMsg(SMnodeMsg *pMsg) { pDnode->alternativeRole = pStatus->alternativeRole; pDnode->totalVnodes = pStatus->numOfTotalVnodes; pDnode->moduleStatus = pStatus->moduleStatus; - pDnode->lastAccess = tsAccessSquence; if (pStatus->dnodeId == 0) { mTrace("dnode:%d %s, first access", pDnode->dnodeId, pDnode->dnodeEp); @@ -339,6 +352,14 @@ static int32_t mnodeProcessDnodeStatusMsg(SMnodeMsg *pMsg) { } if (pDnode->status == TAOS_DN_STATUS_OFFLINE) { + // Verify whether the cluster parameters are consistent when status change from offline to ready + bool ret = mnodeCheckClusterCfgPara(&(pStatus->clusterCfg)); + if (false == ret) { + mnodeDecDnodeRef(pDnode); + mError("dnode %s cluster cfg parameters inconsistent", pStatus->dnodeEp); + return TSDB_CODE_MND_CLUSTER_CFG_INCONSISTENT; + } + mTrace("dnode:%d, from offline to online", pDnode->dnodeId); pDnode->status = TAOS_DN_STATUS_READY; balanceUpdateMnode(); @@ -353,6 +374,8 @@ static int32_t mnodeProcessDnodeStatusMsg(SMnodeMsg *pMsg) { return TSDB_CODE_MND_OUT_OF_MEMORY; } + pDnode->lastAccess = tsAccessSquence; + mnodeGetMnodeInfos(&pRsp->mnodes); pRsp->dnodeCfg.dnodeId = htonl(pDnode->dnodeId); diff --git a/src/plugins/http/src/httpSession.c b/src/plugins/http/src/httpSession.c index 2b0735bfaf58c834d912942847e429bd828a4a33..c1e33706d5d53df112408e73867dde2cede3642b 100644 --- a/src/plugins/http/src/httpSession.c +++ b/src/plugins/http/src/httpSession.c @@ -29,7 +29,8 @@ void httpCreateSession(HttpContext *pContext, void *taos) { pthread_mutex_lock(&server->serverMutex); - HttpSession session = {0}; + HttpSession session; + memset(&session, 0, sizeof(HttpSession)); session.taos = taos; session.refCount = 1; snprintf(session.id, HTTP_SESSION_ID_LEN, "%s.%s", pContext->user, pContext->pass); diff --git a/src/tsdb/src/tsdbMeta.c b/src/tsdb/src/tsdbMeta.c index 8eb259d38c67afcee12be882873968f7facbaea3..7795f25b717ef53eb910743edc0da382015289c3 100644 --- a/src/tsdb/src/tsdbMeta.c +++ b/src/tsdb/src/tsdbMeta.c @@ -424,6 +424,11 @@ int tsdbUpdateTable(STsdbMeta *pMeta, STable *pTable, STableCfg *pCfg) { pTable->schema[pTable->numOfSchemas-1] = tSchema; } + STSchema *lSchema = pTable->schema[pTable->numOfSchemas - 1]; + if (schemaNCols(lSchema) > pMeta->maxCols) pMeta->maxCols = schemaNCols(lSchema); + int bytes = dataRowMaxBytesFromSchema(lSchema); + if (bytes > pMeta->maxRowBytes) pMeta->maxRowBytes = bytes; + isChanged = true; } diff --git a/tests/pytest/regressiontest.sh b/tests/pytest/regressiontest.sh index 50237f27c5949faddf9f21ce4f9f88097ee8c0b3..3b26aaf30d171efc158e587be2123636b023dd65 100755 --- a/tests/pytest/regressiontest.sh +++ b/tests/pytest/regressiontest.sh @@ -29,14 +29,14 @@ python3 ./test.py -f tag_lite/3.py python3 ./test.py -f tag_lite/4.py python3 ./test.py -f tag_lite/5.py python3 ./test.py -f tag_lite/6.py -# python3 ./test.py -f tag_lite/add.py +python3 ./test.py -f tag_lite/add.py python3 ./test.py -f tag_lite/bigint.py python3 ./test.py -f tag_lite/binary_binary.py python3 ./test.py -f tag_lite/binary.py python3 ./test.py -f tag_lite/bool_binary.py python3 ./test.py -f tag_lite/bool_int.py python3 ./test.py -f tag_lite/bool.py -# python3 ./test.py -f tag_lite/change.py +python3 ./test.py -f tag_lite/change.py python3 ./test.py -f tag_lite/column.py # python3 ./test.py -f tag_lite/commit.py python3 ./test.py -f tag_lite/create.py diff --git a/tests/pytest/tag_lite/change.py b/tests/pytest/tag_lite/change.py index 1f411b7e5a4ca6234878a0e48902912ef2399a70..7cbef188b2aede9e87655372f60b72b603c984be 100644 --- a/tests/pytest/tag_lite/change.py +++ b/tests/pytest/tag_lite/change.py @@ -84,18 +84,30 @@ class TDTestCase: # TSIM: endi # TSIM: # TSIM: sql alter table $mt change tag tagcx tgcol3 -x step21 + tdLog.info("alter table ta_ch_mt2 change tag tagcx tgcol3 -x step21") + tdSql.error("alter table ta_ch_mt2 change tag tagcx tgcol3") # TSIM: return -1 # TSIM: step21: # TSIM: sql alter table $mt change tag tgcol1 tgcol2 -x step22 + tdLog.info("alter table ta_ch_mt2 change tag tgcol1 tgcol2 -x step22") + tdSql.error("alter table ta_ch_mt2 change tag tgcol1 tgcol2") # TSIM: return -1 # TSIM: step22: # TSIM: sql alter table $mt change tag tgcol1 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -x step20 + tdLog.info("alter table ta_ch_mt2 change tag tgcol1 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -x step20") + tdSql.error("alter table ta_ch_mt2 change tag tgcol1 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -x step20") # TSIM: return -1 # TSIM: step20: # TSIM: # TSIM: sql alter table $mt change tag tgcol1 tgcol3 + tdLog.info("alter table ta_ch_mt2 change tag tgcol1 tgcol3") + tdSql.execute("alter table ta_ch_mt2 change tag tgcol1 tgcol3") # TSIM: sql alter table $mt change tag tgcol2 tgcol4 + tdLog.info("alter table ta_ch_mt2 change tag tgcol2 tgcol4") + tdSql.execute("alter table ta_ch_mt2 change tag tgcol2 tgcol4") # TSIM: sql alter table $mt change tag tgcol4 tgcol3 -x step23 + tdLog.info("alter table ta_ch_mt2 change tag tgcol4 tgcol3 -x step23") + tdSql.error("alter table ta_ch_mt2 change tag tgcol4 tgcol3") # TSIM: return -1 # TSIM: step23: # TSIM: @@ -141,7 +153,11 @@ class TDTestCase: # TSIM: endi # TSIM: # TSIM: sql alter table $mt change tag tgcol1 tgcol3 + tdLog.info("alter table ta_ch_mt3 change tag tgcol1 tgcol3") + tdSql.execute("alter table ta_ch_mt3 change tag tgcol1 tgcol3") # TSIM: sql alter table $mt change tag tgcol2 tgcol4 + tdLog.info("alter table ta_ch_mt3 change tag tgcol2 tgcol4") + tdSql.execute("alter table ta_ch_mt3 change tag tgcol2 tgcol4") # TSIM: # TSIM: print =============== step4 tdLog.info('=============== step4') @@ -185,7 +201,11 @@ class TDTestCase: # TSIM: endi # TSIM: # TSIM: sql alter table $mt change tag tgcol1 tgcol3 + tdLog.info("alter table ta_ch_mt4 change tag tgcol1 tgcol3") + tdSql.execute("alter table ta_ch_mt4 change tag tgcol1 tgcol3") # TSIM: sql alter table $mt change tag tgcol2 tgcol4 + tdLog.info("alter table ta_ch_mt4 change tag tgcol2 tgcol4") + tdSql.execute("alter table ta_ch_mt4 change tag tgcol2 tgcol4") # TSIM: # TSIM: print =============== step5 tdLog.info('=============== step5') @@ -224,12 +244,16 @@ class TDTestCase: # TSIM: endi # TSIM: if $data03 != 2 then tdLog.info('tdSql.checkData(0, 3, 2)') - tdSql.checkData(0, 3, 2) + tdSql.checkData(0, 3, "2") # TSIM: return -1 # TSIM: endi # TSIM: # TSIM: sql alter table $mt change tag tgcol1 tgcol3 + tdLog.info("alter table ta_ch_mt5 change tag tgcol1 tgcol3") + tdSql.execute("alter table ta_ch_mt5 change tag tgcol1 tgcol3") # TSIM: sql alter table $mt change tag tgcol2 tgcol4 + tdLog.info("alter table ta_ch_mt5 change tag tgcol2 tgcol4") + tdSql.execute("alter table ta_ch_mt5 change tag tgcol2 tgcol4") # TSIM: # TSIM: print =============== step6 tdLog.info('=============== step6') @@ -257,13 +281,13 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: if $data01 != 1 then - tdLog.info('tdSql.checkData(0, 1, 1)') + tdLog.info("tdSql.checkData(0, 1, 1)") tdSql.checkData(0, 1, 1) # TSIM: return -1 # TSIM: endi # TSIM: if $data02 != 1 then - tdLog.info('tdSql.checkData(0, 2, 1)') - tdSql.checkData(0, 2, 1) + tdLog.info('tdSql.checkData(0, 2, "1")') + tdSql.checkData(0, 2, "1") # TSIM: return -1 # TSIM: endi # TSIM: if $data03 != 2 then @@ -278,7 +302,7 @@ class TDTestCase: # TSIM: endi # TSIM: if $data05 != 4 then tdLog.info('tdSql.checkData(0, 5, 4)') - tdSql.checkData(0, 5, 4) + tdSql.checkData(0, 5, '4') # TSIM: return -1 # TSIM: endi # TSIM: if $data06 != 5.000000000 then @@ -288,22 +312,42 @@ class TDTestCase: # TSIM: endi # TSIM: if $data07 != 6 then tdLog.info('tdSql.checkData(0, 7, 6)') - tdSql.checkData(0, 7, 6) + tdSql.checkData(0, 7, '6') # TSIM: return -1 # TSIM: endi # TSIM: # TSIM: sql alter table $mt drop tag tgcol3 + tdLog.info("alter table ta_ch_mt6 drop tag tgcol3") + tdSql.execute("alter table ta_ch_mt6 drop tag tgcol3") # TSIM: sql reset query cache + tdLog.info("reset query cache") + tdSql.execute("reset query cache") # TSIM: sql alter table $mt change tag tgcol4 tgcol3 + tdLog.info("alter table ta_ch_mt6 change tag tgcol4 tgcol3") + tdSql.execute("alter table ta_ch_mt6 change tag tgcol4 tgcol3") # TSIM: sql alter table $mt change tag tgcol1 tgcol7 + tdLog.info("alter table ta_ch_mt6 change tag tgcol1 tgcol7") + tdSql.execute("alter table ta_ch_mt6 change tag tgcol1 tgcol7") # TSIM: sql alter table $mt change tag tgcol2 tgcol8 + tdLog.info("alter table ta_ch_mt6 change tag tgcol2 tgcol8") + tdSql.execute("alter table ta_ch_mt6 change tag tgcol2 tgcol8") # TSIM: sql reset query cache + tdLog.info("reset query cache") + tdSql.execute("reset query cache") # TSIM: sql alter table $mt change tag tgcol3 tgcol9 + tdLog.info("alter table ta_ch_mt6 change tag tgcol3 tgcol9") + tdSql.execute("alter table ta_ch_mt6 change tag tgcol3 tgcol9") # TSIM: sql alter table $mt change tag tgcol5 tgcol10 + tdLog.info("alter table ta_ch_mt6 change tag tgcol5 tgcol10") + tdSql.execute("alter table ta_ch_mt6 change tag tgcol5 tgcol10") # TSIM: sql alter table $mt change tag tgcol6 tgcol11 + tdLog.info("alter table ta_ch_mt6 change tag tgcol6 tgcol11") + tdSql.execute("alter table ta_ch_mt6 change tag tgcol6 tgcol11") # TSIM: # TSIM: sleep 5000 # TSIM: sql reset query cache + tdLog.info("reset query cache") + tdSql.execute("reset query cache") # TSIM: # TSIM: print =============== step2 tdLog.info('=============== step2') @@ -313,12 +357,12 @@ class TDTestCase: # TSIM: # TSIM: sql select * from $mt where tgcol1 = 1 -x step24 tdLog.info('select * from ta_ch_mt2 where tgcol1 = 1 -x step24') - tdSql.error('select * from ta_ch_mt2 where tgcol1 = 14') + tdSql.error("select * from ta_ch_mt2 where tgcol1 = 1") # TSIM: return -1 # TSIM: step24: # TSIM: sql select * from $mt where tgcol2 = 1 -x step25 tdLog.info('select * from ta_ch_mt2 where tgcol2 = 1 -x step25') - tdSql.error('select * from ta_ch_mt2 where tgcol2 = 15') + tdSql.error('select * from ta_ch_mt2 where tgcol2 = 1') # TSIM: return -1 # TSIM: step25: # TSIM: @@ -382,12 +426,12 @@ class TDTestCase: # TSIM: # TSIM: sql select * from $mt where tgcol1 = 1 -x step31 tdLog.info('select * from ta_ch_mt3 where tgcol1 = 1 -x step31') - tdSql.error('select * from ta_ch_mt3 where tgcol1 = 11') + tdSql.error('select * from ta_ch_mt3 where tgcol1 = 1') # TSIM: return -1 # TSIM: step31: # TSIM: sql select * from $mt where tgcol2 = 1 -x step32 tdLog.info('select * from ta_ch_mt3 where tgcol2 = 1 -x step32') - tdSql.error('select * from ta_ch_mt3 where tgcol2 = 12') + tdSql.error('select * from ta_ch_mt3 where tgcol2 = 1') # TSIM: return -1 # TSIM: step32: # TSIM: @@ -418,8 +462,8 @@ class TDTestCase: # TSIM: endi # TSIM: # TSIM: sql select * from $mt where tgcol4 = 2 - tdLog.info('select * from $mt where tgcol4 = 2') - tdSql.query('select * from $mt where tgcol4 = 2') + tdLog.info('select * from ta_ch_mt3 where tgcol4 = 2') + tdSql.query('select * from ta_ch_mt3 where tgcol4 = 2') # TSIM: print $data01 $data02 $data03 tdLog.info('$data01 $data02 $data03') # TSIM: if $rows != 1 then @@ -551,7 +595,7 @@ class TDTestCase: # TSIM: endi # TSIM: if $data03 != 2 then tdLog.info('tdSql.checkData(0, 3, 2)') - tdSql.checkData(0, 3, 2) + tdSql.checkData(0, 3, "2") # TSIM: return -1 # TSIM: endi # TSIM: @@ -577,7 +621,7 @@ class TDTestCase: # TSIM: endi # TSIM: if $data03 != 2 then tdLog.info('tdSql.checkData(0, 3, 2)') - tdSql.checkData(0, 3, 2) + tdSql.checkData(0, 3, "2") # TSIM: return -1 # TSIM: endi # TSIM: @@ -589,32 +633,32 @@ class TDTestCase: # TSIM: # TSIM: sql select * from $mt where tgcol1 = 1 -x step61 tdLog.info('select * from ta_ch_mt6 where tgcol1 = 1 -x step61') - tdSql.error('select * from ta_ch_mt6 where tgcol1 = 11') + tdSql.error('select * from ta_ch_mt6 where tgcol1 = 1') # TSIM: return -1 # TSIM: step61: # TSIM: sql select * from $mt where tgcol2 = 1 -x step62 tdLog.info('select * from ta_ch_mt6 where tgcol2 = 1 -x step62') - tdSql.error('select * from ta_ch_mt6 where tgcol2 = 12') + tdSql.error('select * from ta_ch_mt6 where tgcol2 = 1') # TSIM: return -1 # TSIM: step62: # TSIM: sql select * from $mt where tgcol3 = 1 -x step63 tdLog.info('select * from ta_ch_mt6 where tgcol3 = 1 -x step63') - tdSql.error('select * from ta_ch_mt6 where tgcol3 = 13') + tdSql.error('select * from ta_ch_mt6 where tgcol3 = 1') # TSIM: return -1 # TSIM: step63: # TSIM: sql select * from $mt where tgcol4 = 1 -x step64 tdLog.info('select * from ta_ch_mt6 where tgcol4 = 1 -x step64') - tdSql.error('select * from ta_ch_mt6 where tgcol4 = 14') + tdSql.error('select * from ta_ch_mt6 where tgcol4 = 1') # TSIM: return -1 # TSIM: step64: # TSIM: sql select * from $mt where tgcol5 = 1 -x step65 tdLog.info('select * from ta_ch_mt6 where tgcol5 = 1 -x step65') - tdSql.error('select * from ta_ch_mt6 where tgcol5 = 15') + tdSql.error('select * from ta_ch_mt6 where tgcol5 = 1') # TSIM: return -1 # TSIM: step65: # TSIM: sql select * from $mt where tgcol6 = 1 -x step66 tdLog.info('select * from ta_ch_mt6 where tgcol6 = 1 -x step66') - tdSql.error('select * from ta_ch_mt6 where tgcol6 = 16') + tdSql.error('select * from ta_ch_mt6 where tgcol6 = 1') # TSIM: return -1 # TSIM: step66: # TSIM: @@ -634,8 +678,8 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: if $data02 != 1 then - tdLog.info('tdSql.checkData(0, 2, 1)') - tdSql.checkData(0, 2, 1) + tdLog.info('tdSql.checkData(0, 2, "1")') + tdSql.checkData(0, 2, "1") # TSIM: return -1 # TSIM: endi # TSIM: if $data03 != 2 then @@ -644,8 +688,8 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: if $data04 != 4 then - tdLog.info('tdSql.checkData(0, 4, 4)') - tdSql.checkData(0, 4, 4) + tdLog.info('tdSql.checkData(0, 4, "4")') + tdSql.checkData(0, 4, "4") # TSIM: return -1 # TSIM: endi # TSIM: if $data05 != 5.000000000 then @@ -654,13 +698,18 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: if $data06 != 6 then - tdLog.info('tdSql.checkData(0, 6, 6)') - tdSql.checkData(0, 6, 6) + tdLog.info('tdSql.checkData(0, 6, "6")') + tdSql.checkData(0, 6, "6") # TSIM: return -1 # TSIM: endi # TSIM: if $data07 != NULL then tdLog.info('tdSql.checkData(0, 7, NULL)') - tdSql.checkData(0, 7, None) + + try: + tdSql.checkData(0, 7, None) + except Exception as e: + tdLog.info(repr(e)) + tdLog.info("out of range") # TSIM: return -1 # TSIM: endi # TSIM: @@ -680,8 +729,8 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: if $data02 != 1 then - tdLog.info('tdSql.checkData(0, 2, 1)') - tdSql.checkData(0, 2, 1) + tdLog.info('tdSql.checkData(0, 2, "1")') + tdSql.checkData(0, 2, "1") # TSIM: return -1 # TSIM: endi # TSIM: if $data03 != 2 then @@ -690,8 +739,8 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: if $data04 != 4 then - tdLog.info('tdSql.checkData(0, 4, 4)') - tdSql.checkData(0, 4, 4) + tdLog.info('tdSql.checkData(0, 4, "4"")') + tdSql.checkData(0, 4, "4") # TSIM: return -1 # TSIM: endi # TSIM: if $data05 != 5.000000000 then @@ -700,13 +749,17 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: if $data06 != 6 then - tdLog.info('tdSql.checkData(0, 6, 6)') - tdSql.checkData(0, 6, 6) + tdLog.info('tdSql.checkData(0, 6, "6")') + tdSql.checkData(0, 6, "6") # TSIM: return -1 # TSIM: endi # TSIM: if $data07 != NULL then tdLog.info('tdSql.checkData(0, 7, NULL)') - tdSql.checkData(0, 7, None) + try: + tdSql.checkData(0, 7, None) + except Exception as e: + tdLog.info(repr(e)) + tdLog.info("out of range") # TSIM: return -1 # TSIM: endi # TSIM: @@ -726,8 +779,8 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: if $data02 != 1 then - tdLog.info('tdSql.checkData(0, 2, 1)') - tdSql.checkData(0, 2, 1) + tdLog.info('tdSql.checkData(0, 2, "1")') + tdSql.checkData(0, 2, "1") # TSIM: return -1 # TSIM: endi # TSIM: if $data03 != 2 then @@ -736,8 +789,8 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: if $data04 != 4 then - tdLog.info('tdSql.checkData(0, 4, 4)') - tdSql.checkData(0, 4, 4) + tdLog.info('tdSql.checkData(0, 4, "4")') + tdSql.checkData(0, 4, "4") # TSIM: return -1 # TSIM: endi # TSIM: if $data05 != 5.000000000 then @@ -746,13 +799,17 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: if $data06 != 6 then - tdLog.info('tdSql.checkData(0, 6, 6)') - tdSql.checkData(0, 6, 6) + tdLog.info('tdSql.checkData(0, 6, "6")') + tdSql.checkData(0, 6, "6") # TSIM: return -1 # TSIM: endi # TSIM: if $data07 != NULL then tdLog.info('tdSql.checkData(0, 7, NULL)') - tdSql.checkData(0, 7, None) + try: + tdSql.checkData(0, 7, None) + except Exception as e: + tdLog.info(repr(e)) + tdLog.info("out of range") # TSIM: return -1 # TSIM: endi # TSIM: @@ -772,8 +829,8 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: if $data02 != 1 then - tdLog.info('tdSql.checkData(0, 2, 1)') - tdSql.checkData(0, 2, 1) + tdLog.info('tdSql.checkData(0, 2, "1")') + tdSql.checkData(0, 2, "1") # TSIM: return -1 # TSIM: endi # TSIM: if $data03 != 2 then @@ -782,8 +839,8 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: if $data04 != 4 then - tdLog.info('tdSql.checkData(0, 4, 4)') - tdSql.checkData(0, 4, 4) + tdLog.info('tdSql.checkData(0, 4, "4")') + tdSql.checkData(0, 4, "4") # TSIM: return -1 # TSIM: endi # TSIM: if $data05 != 5.000000000 then @@ -792,13 +849,17 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: if $data06 != 6 then - tdLog.info('tdSql.checkData(0, 6, 6)') - tdSql.checkData(0, 6, 6) + tdLog.info('tdSql.checkData(0, 6, "6")') + tdSql.checkData(0, 6, "6") # TSIM: return -1 # TSIM: endi # TSIM: if $data07 != NULL then tdLog.info('tdSql.checkData(0, 7, NULL)') - tdSql.checkData(0, 7, None) + try: + tdSql.checkData(0, 7, None) + except Exception as e: + tdLog.info(repr(e)) + tdLog.info("out of range") # TSIM: return -1 # TSIM: endi # TSIM: @@ -818,8 +879,8 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: if $data02 != 1 then - tdLog.info('tdSql.checkData(0, 2, 1)') - tdSql.checkData(0, 2, 1) + tdLog.info('tdSql.checkData(0, 2, "1")') + tdSql.checkData(0, 2, "1") # TSIM: return -1 # TSIM: endi # TSIM: if $data03 != 2 then @@ -828,8 +889,8 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: if $data04 != 4 then - tdLog.info('tdSql.checkData(0, 4, 4)') - tdSql.checkData(0, 4, 4) + tdLog.info('tdSql.checkData(0, 4, "4")') + tdSql.checkData(0, 4, "4") # TSIM: return -1 # TSIM: endi # TSIM: if $data05 != 5.000000000 then @@ -838,13 +899,17 @@ class TDTestCase: # TSIM: return -1 # TSIM: endi # TSIM: if $data06 != 6 then - tdLog.info('tdSql.checkData(0, 6, 6)') - tdSql.checkData(0, 6, 6) + tdLog.info('tdSql.checkData(0, 6, "6")') + tdSql.checkData(0, 6, "6") # TSIM: return -1 # TSIM: endi # TSIM: if $data07 != NULL then tdLog.info('tdSql.checkData(0, 7, NULL)') - tdSql.checkData(0, 7, None) + try: + tdSql.checkData(0, 7, None) + except Exception as e: + tdLog.info(repr(e)) + tdLog.info("out of range") # TSIM: return -1 # TSIM: endi # TSIM: diff --git a/tests/script/general/parser/alter.sim b/tests/script/general/parser/alter.sim index e57b1f43d28363a146b2e18b694adc4be88370c8..44c12fa968d52b7c6e3811d4997e549af3bba7bf 100644 --- a/tests/script/general/parser/alter.sim +++ b/tests/script/general/parser/alter.sim @@ -38,7 +38,7 @@ endi if $data02 != 1 then return -1 endi -if $data03 != NULL then +if $data03 != null then return -1 endi sql alter table tb add column c3 nchar(4) @@ -72,7 +72,7 @@ endi if $data02 != 1 then return -1 endi -if $data03 != NULL then +if $data03 != null then return -1 endi @@ -169,7 +169,7 @@ endi if $data01 != 2 then return -1 endi -if $data02 != NULL then +if $data02 != null then return -1 endi sql alter table mt add column c2 int @@ -239,4 +239,4 @@ if $rows != 0 then return -1 endi -system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file +system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/unique/arbitrator/check_cluster_cfg_para.sim b/tests/script/unique/arbitrator/check_cluster_cfg_para.sim new file mode 100644 index 0000000000000000000000000000000000000000..e74717c0778284519171716a3214bb8a1de9fcb9 --- /dev/null +++ b/tests/script/unique/arbitrator/check_cluster_cfg_para.sim @@ -0,0 +1,190 @@ +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/deploy.sh -n dnode2 -i 2 +system sh/deploy.sh -n dnode3 -i 3 +system sh/deploy.sh -n dnode4 -i 4 +system sh/deploy.sh -n dnode5 -i 5 +system sh/deploy.sh -n dnode6 -i 6 +system sh/deploy.sh -n dnode7 -i 7 + + +system sh/cfg.sh -n dnode1 -c numOfMnodes -v 2 +system sh/cfg.sh -n dnode1 -c mnodeEqualVnodeNum -v 4 +system sh/cfg.sh -n dnode1 -c offlineThreshold -v 15 +system sh/cfg.sh -n dnode1 -c statusInterval -v 3 +system sh/cfg.sh -n dnode1 -c arbitrator -v $arbitrator +#system sh/cfg.sh -n dnode1 -c timezone -v "" +#system sh/cfg.sh -n dnode1 -c locale -v "" +#system sh/cfg.sh -n dnode1 -c charset -v "" +system sh/cfg.sh -n dnode1 -c balanceInterval -v 10 + +######## dnode 2 the same with dnode1 +system sh/cfg.sh -n dnode2 -c numOfMnodes -v 2 +system sh/cfg.sh -n dnode2 -c mnodeEqualVnodeNum -v 4 +system sh/cfg.sh -n dnode2 -c offlineThreshold -v 15 +system sh/cfg.sh -n dnode2 -c statusInterval -v 3 +system sh/cfg.sh -n dnode2 -c arbitrator -v $arbitrator +#system sh/cfg.sh -n dnode2 -c timezone -v "" +#system sh/cfg.sh -n dnode2 -c locale -v "" +#system sh/cfg.sh -n dnode2 -c charset -v "" +system sh/cfg.sh -n dnode2 -c balanceInterval -v 10 + +######## dnode 3 one para no same with dnode1 +system sh/cfg.sh -n dnode3 -c numOfMnodes -v 3 +system sh/cfg.sh -n dnode3 -c mnodeEqualVnodeNum -v 4 +system sh/cfg.sh -n dnode3 -c offlineThreshold -v 15 +system sh/cfg.sh -n dnode3 -c statusInterval -v 3 +system sh/cfg.sh -n dnode3 -c arbitrator -v $arbitrator +#system sh/cfg.sh -n dnode3 -c timezone -v "" +#system sh/cfg.sh -n dnode3 -c locale -v "" +#system sh/cfg.sh -n dnode3 -c charset -v "" +system sh/cfg.sh -n dnode3 -c balanceInterval -v 10 + +######## dnode 4 one para no same with dnode1 +system sh/cfg.sh -n dnode4 -c numOfMnodes -v 2 +system sh/cfg.sh -n dnode4 -c mnodeEqualVnodeNum -v 5 +system sh/cfg.sh -n dnode4 -c offlineThreshold -v 15 +system sh/cfg.sh -n dnode4 -c statusInterval -v 3 +system sh/cfg.sh -n dnode4 -c arbitrator -v $arbitrator +#system sh/cfg.sh -n dnode4 -c timezone -v "" +#system sh/cfg.sh -n dnode4 -c locale -v "" +#system sh/cfg.sh -n dnode4 -c charset -v "" +system sh/cfg.sh -n dnode4 -c balanceInterval -v 10 + +######## dnode 5 one para no same with dnode1 +system sh/cfg.sh -n dnode5 -c numOfMnodes -v 2 +system sh/cfg.sh -n dnode5 -c mnodeEqualVnodeNum -v 4 +system sh/cfg.sh -n dnode5 -c offlineThreshold -v 16 +system sh/cfg.sh -n dnode5 -c statusInterval -v 3 +system sh/cfg.sh -n dnode5 -c arbitrator -v $arbitrator +#system sh/cfg.sh -n dnode5 -c timezone -v "" +#system sh/cfg.sh -n dnode5 -c locale -v "" +#system sh/cfg.sh -n dnode5 -c charset -v "" +system sh/cfg.sh -n dnode5 -c balanceInterval -v 10 + + +######## dnode 6 one para no same with dnode1 +system sh/cfg.sh -n dnode6 -c numOfMnodes -v 2 +system sh/cfg.sh -n dnode6 -c mnodeEqualVnodeNum -v 4 +system sh/cfg.sh -n dnode6 -c offlineThreshold -v 15 +system sh/cfg.sh -n dnode6 -c statusInterval -v 2 +system sh/cfg.sh -n dnode6 -c arbitrator -v $arbitrator +#system sh/cfg.sh -n dnode6 -c timezone -v "" +#system sh/cfg.sh -n dnode6 -c locale -v "" +#system sh/cfg.sh -n dnode6 -c charset -v "" +system sh/cfg.sh -n dnode6 -c balanceInterval -v 10 + + +######## dnode 7 one para no same with dnode1 +system sh/cfg.sh -n dnode7 -c numOfMnodes -v 2 +system sh/cfg.sh -n dnode7 -c mnodeEqualVnodeNum -v 4 +system sh/cfg.sh -n dnode7 -c offlineThreshold -v 15 +system sh/cfg.sh -n dnode7 -c statusInterval -v 3 +system sh/cfg.sh -n dnode7 -c arbitrator -v "plum-VirtualBox:8001" +#system sh/cfg.sh -n dnode7 -c timezone -v "" +#system sh/cfg.sh -n dnode7 -c locale -v "" +#system sh/cfg.sh -n dnode7 -c charset -v "" +system sh/cfg.sh -n dnode7 -c balanceInterval -v 10 + +print ============== step0: start tarbitrator +system sh/exec_tarbitrator.sh -s start + +print ============== step1: start dnode1 +system sh/exec.sh -n dnode1 -s start +sleep 3000 +sql connect + +print ============== step2: start dnode2~7 and add into cluster +system sh/exec.sh -n dnode2 -s start +system sh/exec.sh -n dnode3 -s start +system sh/exec.sh -n dnode4 -s start +system sh/exec.sh -n dnode5 -s start +system sh/exec.sh -n dnode6 -s start +system sh/exec.sh -n dnode7 -s start +sql create dnode $hostname2 +sql create dnode $hostname3 +sql create dnode $hostname4 +sql create dnode $hostname5 +sql create dnode $hostname6 +sql create dnode $hostname7 +sleep 10000 + +wait_dnode_created: +sql show dnodes +if $rows != 7 then + sleep 2000 + goto wait_dnode_created +endi +print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 +print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 +print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3 +print $data0_4 $data1_4 $data2_4 $data3_4 $data4_4 +print $data0_5 $data1_5 $data2_5 $data3_5 $data4_5 +print $data0_6 $data1_6 $data2_6 $data3_6 $data4_6 +print $data0_7 $data1_7 $data2_7 $data3_7 $data4_7 +$dnode1Status = $data4_1 +$dnode2Status = $data4_2 +$dnode3Status = $data4_3 +$dnode4Status = $data4_4 +$dnode5Status = $data4_5 +$dnode6Status = $data4_6 +$dnode7Status = $data4_7 + +if $dnode1Status != ready then + return -1 +endi +if $dnode2Status != ready then + return -1 +endi +if $dnode3Status != offline then + return -1 +endi +if $dnode4Status != offline then + return -1 +endi +if $dnode5Status != offline then + return -1 +endi +if $dnode6Status != offline then + return -1 +endi +if $dnode7Status != offline then + return -1 +endi + +sleep 10000 + +wait_dnode_offline_overtime_dropped: +sql show dnodes +print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 +print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 +print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3 +print $data0_4 $data1_4 $data2_4 $data3_4 $data4_4 +print $data0_5 $data1_5 $data2_5 $data3_5 $data4_5 +print $data0_6 $data1_6 $data2_6 $data3_6 $data4_6 +print $data0_7 $data1_7 $data2_7 $data3_7 $data4_7 +if $rows != 2 then + sleep 2000 + goto wait_dnode_offline_overtime_dropped +endi +print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 +print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 +print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3 +print $data0_4 $data1_4 $data2_4 $data3_4 $data4_4 +print $data0_5 $data1_5 $data2_5 $data3_5 $data4_5 +print $data0_6 $data1_6 $data2_6 $data3_6 $data4_6 +print $data0_7 $data1_7 $data2_7 $data3_7 $data4_7 +$dnode1Status = $data4_1 +$dnode2Status = $data4_2 +$dnode3Status = $data4_3 +$dnode4Status = $data4_4 +$dnode5Status = $data4_5 +$dnode6Status = $data4_6 +$dnode7Status = $data4_7 + +if $dnode1Status != ready then + return -1 +endi +if $dnode2Status != ready then + return -1 +endi diff --git a/tests/script/unique/arbitrator/dn3_mn1_nw_disable_timeout_autoDropDnode.sim b/tests/script/unique/arbitrator/dn3_mn1_nw_disable_timeout_autoDropDnode.sim index 71e606e52940ff7a96f701dc764f9b7a55989bf2..9b1e320946673885e3cdd4d81458bbdff2da4084 100644 --- a/tests/script/unique/arbitrator/dn3_mn1_nw_disable_timeout_autoDropDnode.sim +++ b/tests/script/unique/arbitrator/dn3_mn1_nw_disable_timeout_autoDropDnode.sim @@ -5,11 +5,11 @@ system sh/deploy.sh -n dnode3 -i 3 system sh/deploy.sh -n dnode4 -i 4 system sh/deploy.sh -n dnode5 -i 5 -system sh/cfg.sh -n dnode1 -c numOfMPeers -v 1 -system sh/cfg.sh -n dnode2 -c numOfMPeers -v 1 -system sh/cfg.sh -n dnode3 -c numOfMPeers -v 1 -system sh/cfg.sh -n dnode4 -c numOfMPeers -v 1 -system sh/cfg.sh -n dnode5 -c numOfMPeers -v 1 +system sh/cfg.sh -n dnode1 -c numOfMnodes -v 1 +system sh/cfg.sh -n dnode2 -c numOfMnodes -v 1 +system sh/cfg.sh -n dnode3 -c numOfMnodes -v 1 +system sh/cfg.sh -n dnode4 -c numOfMnodes -v 1 +system sh/cfg.sh -n dnode5 -c numOfMnodes -v 1 system sh/cfg.sh -n dnode1 -c walLevel -v 1 system sh/cfg.sh -n dnode2 -c walLevel -v 1 diff --git a/tests/script/unique/arbitrator/dn3_mn1_vnode_change.sim b/tests/script/unique/arbitrator/dn3_mn1_vnode_change.sim index fda850d2c9941cd9c1baecd07c621b0e99d6f8d7..d2bd5c6b266ab398eaf1e3306d63bc09d6233dcb 100644 --- a/tests/script/unique/arbitrator/dn3_mn1_vnode_change.sim +++ b/tests/script/unique/arbitrator/dn3_mn1_vnode_change.sim @@ -96,7 +96,12 @@ endi print ============== step3: stop dnode4, and remove its vnodeX subdirector system sh/exec.sh -n dnode4 -s stop -x SIGINT sleep $sleepTimer +$loopCnt = 0 wait_dnode4_offline_0: +$loopCnt = $loopCnt + 1 +if $loopCnt == 10 then + return -1 +endi sql show dnodes if $rows != 4 then sleep 2000 @@ -148,7 +153,14 @@ sleep 1000 print ============== step4: restart dnode4, waiting sync end system sh/exec.sh -n dnode4 -s start sleep $sleepTimer + +$loopCnt = 0 wait_dnode4_reready: +$loopCnt = $loopCnt + 1 +if $loopCnt == 10 then + return -1 +endi + sql show dnodes if $rows != 4 then sleep 2000 @@ -171,7 +183,13 @@ if $dnode4Status != ready then goto wait_dnode4_reready endi +$loopCnt = 0 wait_dnode4_vgroup_slave: +$loopCnt = $loopCnt + 1 +if $loopCnt == 10 then + return -1 +endi + sql show vgroups if $rows != 1 then sleep 2000 @@ -200,7 +218,13 @@ system sh/exec.sh -n dnode2 -s stop system sh/exec.sh -n dnode3 -s stop sleep $sleepTimer + +$loopCnt = 0 wait_dnode23_offline: +$loopCnt = $loopCnt + 1 +if $loopCnt == 10 then + return -1 +endi sql show dnodes if $rows != 4 then sleep 2000 @@ -231,7 +255,13 @@ if $dnode4Status != ready then goto wait_dnode23_offline endi +$loopCnt = 0 wait_dnode4_vgroup_master: +$loopCnt = $loopCnt + 1 +if $loopCnt == 10 then + return -1 +endi + sql show vgroups if $rows != 1 then sleep 2000