From aff649deb783cf172c2cc083016d9be96825b38d Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Sun, 27 Nov 2022 23:00:32 +0800 Subject: [PATCH 01/27] adjust parameer --- include/util/tdef.h | 2 +- source/common/src/tglobal.c | 3 +++ source/libs/transport/src/trans.c | 3 +++ source/libs/transport/src/transSvr.c | 2 +- 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/include/util/tdef.h b/include/util/tdef.h index 48dedd3e3e..ad44daed46 100644 --- a/include/util/tdef.h +++ b/include/util/tdef.h @@ -406,7 +406,7 @@ typedef enum ELogicConditionType { #ifdef WINDOWS #define TSDB_MAX_RPC_THREADS 4 // windows pipe only support 4 connections. #else -#define TSDB_MAX_RPC_THREADS 10 +#define TSDB_MAX_RPC_THREADS 20 #endif #define TSDB_QUERY_TYPE_NON_TYPE 0x00u // none type diff --git a/source/common/src/tglobal.c b/source/common/src/tglobal.c index f2d8b9aa7c..e27793bd56 100644 --- a/source/common/src/tglobal.c +++ b/source/common/src/tglobal.c @@ -306,6 +306,9 @@ static int32_t taosAddClientCfg(SConfig *pCfg) { tsNumOfTaskQueueThreads = tsNumOfCores / 2; tsNumOfTaskQueueThreads = TMAX(tsNumOfTaskQueueThreads, 4); + if (tsNumOfTaskQueueThreads >= 10) { + tsNumOfTaskQueueThreads = 10; + } if (cfgAddInt32(pCfg, "numOfTaskQueueThreads", tsNumOfTaskQueueThreads, 4, 1024, 0) != 0) return -1; return 0; diff --git a/source/libs/transport/src/trans.c b/source/libs/transport/src/trans.c index 94bc128de9..88888f2f84 100644 --- a/source/libs/transport/src/trans.c +++ b/source/libs/transport/src/trans.c @@ -58,6 +58,9 @@ void* rpcOpen(const SRpcInit* pInit) { pRpc->destroyFp = pInit->dfp; pRpc->numOfThreads = pInit->numOfThreads > TSDB_MAX_RPC_THREADS ? TSDB_MAX_RPC_THREADS : pInit->numOfThreads; + if (pRpc->numOfThreads <= 0) { + pRpc->numOfThreads = 1; + } uint32_t ip = 0; if (pInit->connType == TAOS_CONN_SERVER) { diff --git a/source/libs/transport/src/transSvr.c b/source/libs/transport/src/transSvr.c index b7fe404a4e..d00624c4d2 100644 --- a/source/libs/transport/src/transSvr.c +++ b/source/libs/transport/src/transSvr.c @@ -846,7 +846,7 @@ static bool addHandleToAcceptloop(void* arg) { return true; } void* transWorkerThread(void* arg) { - setThreadName("trans-worker"); + setThreadName("trans-srv-work"); SWorkThrd* pThrd = (SWorkThrd*)arg; uv_run(pThrd->loop, UV_RUN_DEFAULT); From 0611ecbe313e8d56ed1343da513e98c43744e0ee Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Mon, 28 Nov 2022 10:53:27 +0800 Subject: [PATCH 02/27] change paramter --- source/client/src/clientImpl.c | 2 +- source/dnode/mgmt/node_mgmt/src/dmTransport.c | 2 +- source/libs/transport/src/transCli.c | 5 +++-- source/libs/transport/src/transComm.c | 2 +- source/libs/transport/src/transSvr.c | 2 +- 5 files changed, 7 insertions(+), 6 deletions(-) diff --git a/source/client/src/clientImpl.c b/source/client/src/clientImpl.c index c3140371c4..d8d1edc3d3 100644 --- a/source/client/src/clientImpl.c +++ b/source/client/src/clientImpl.c @@ -131,7 +131,7 @@ STscObj* taos_connect_internal(const char* ip, const char* user, const char* pas p = taosMemoryCalloc(1, sizeof(struct SAppInstInfo)); p->mgmtEp = epSet; taosThreadMutexInit(&p->qnodeMutex, NULL); - p->pTransporter = openTransporter(user, secretEncrypt, tsNumOfCores); + p->pTransporter = openTransporter(user, secretEncrypt, tsNumOfCores / 2); p->pAppHbMgr = appHbMgrInit(p, key); if (NULL == p->pAppHbMgr) { destroyAppInst(p); diff --git a/source/dnode/mgmt/node_mgmt/src/dmTransport.c b/source/dnode/mgmt/node_mgmt/src/dmTransport.c index 5546d762f4..f78fd33e47 100644 --- a/source/dnode/mgmt/node_mgmt/src/dmTransport.c +++ b/source/dnode/mgmt/node_mgmt/src/dmTransport.c @@ -250,7 +250,7 @@ int32_t dmInitClient(SDnode *pDnode) { SRpcInit rpcInit = {0}; rpcInit.label = "DND-C"; - rpcInit.numOfThreads = 4; + rpcInit.numOfThreads = tsNumOfRpcThreads; rpcInit.cfp = (RpcCfp)dmProcessRpcMsg; rpcInit.sessions = 1024; rpcInit.connType = TAOS_CONN_CLIENT; diff --git a/source/libs/transport/src/transCli.c b/source/libs/transport/src/transCli.c index 55bfb57a82..2b54ce36f5 100644 --- a/source/libs/transport/src/transCli.c +++ b/source/libs/transport/src/transCli.c @@ -653,9 +653,10 @@ static void cliRecvCb(uv_stream_t* handle, ssize_t nread, const uv_buf_t* buf) { static SCliConn* cliCreateConn(SCliThrd* pThrd) { SCliConn* conn = taosMemoryCalloc(1, sizeof(SCliConn)); // read/write stream handle - conn->stream = (uv_stream_t*)taosMemoryMalloc(sizeof(uv_tcp_t)); + conn->stream = (uv_stream_t*)taosMemoryMalloc(sizeof(uv_stream_t)); uv_tcp_init(pThrd->loop, (uv_tcp_t*)(conn->stream)); conn->stream->data = conn; + transSetConnOption((uv_tcp_t*)conn->stream); uv_timer_t* timer = taosArrayGetSize(pThrd->timerList) > 0 ? *(uv_timer_t**)taosArrayPop(pThrd->timerList) : NULL; if (timer == NULL) { @@ -1182,7 +1183,7 @@ bool cliRecvReleaseReq(SCliConn* conn, STransMsgHead* pHead) { static void* cliWorkThread(void* arg) { SCliThrd* pThrd = (SCliThrd*)arg; pThrd->pid = taosGetSelfPthreadId(); - setThreadName("trans-cli-work"); + setThreadName("trans-cli-worker"); uv_run(pThrd->loop, UV_RUN_DEFAULT); tDebug("thread quit-thread:%08" PRId64, pThrd->pid); diff --git a/source/libs/transport/src/transComm.c b/source/libs/transport/src/transComm.c index 2759fb5aeb..5a5806417e 100644 --- a/source/libs/transport/src/transComm.c +++ b/source/libs/transport/src/transComm.c @@ -202,7 +202,7 @@ bool transReadComplete(SConnBuffer* connBuf) { } int transSetConnOption(uv_tcp_t* stream) { - uv_tcp_nodelay(stream, 0); + uv_tcp_nodelay(stream, 1); int ret = uv_tcp_keepalive(stream, 5, 60); return ret; } diff --git a/source/libs/transport/src/transSvr.c b/source/libs/transport/src/transSvr.c index d00624c4d2..f93eb436a5 100644 --- a/source/libs/transport/src/transSvr.c +++ b/source/libs/transport/src/transSvr.c @@ -846,7 +846,7 @@ static bool addHandleToAcceptloop(void* arg) { return true; } void* transWorkerThread(void* arg) { - setThreadName("trans-srv-work"); + setThreadName("trans-svr-worker"); SWorkThrd* pThrd = (SWorkThrd*)arg; uv_run(pThrd->loop, UV_RUN_DEFAULT); From db529a97c9fdaf6dcbd7a568631d7a3aae3ee674 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Mon, 28 Nov 2022 13:20:28 +0800 Subject: [PATCH 03/27] test: remove unused sim files --- .../arbitrator/check_cluster_cfg_para.sim | 199 ------- .../arbitrator/dn2_mn1_cache_file_sync.sim | 222 -------- .../dn2_mn1_cache_file_sync_second.sim | 52 -- .../dn3_mn1_full_createTableFail.sim | 101 ---- .../arbitrator/dn3_mn1_full_dropDnodeFail.sim | 102 ---- .../dn3_mn1_multiCreateDropTable.sim | 310 ----------- ...3_mn1_nw_disable_timeout_autoDropDnode.sim | 160 ------ .../arbitrator/dn3_mn1_r2_vnode_delDir.sim | 358 ------------- .../arbitrator/dn3_mn1_r3_vnode_delDir.sim | 409 --------------- .../dn3_mn1_replica2_wal1_AddDelDnode.sim | 367 ------------- .../arbitrator/dn3_mn1_replica_change.sim | 358 ------------- .../dn3_mn1_replica_change_dropDnod.sim | 150 ------ .../arbitrator/dn3_mn1_stopDnode_timeout.sim | 222 -------- .../arbitrator/dn3_mn1_vnode_change.sim | 319 ------------ .../dn3_mn1_vnode_corruptFile_offline.sim | 435 ---------------- .../dn3_mn1_vnode_corruptFile_online.sim | 354 ------------- .../dn3_mn1_vnode_createErrData_online.sim | 316 ------------ .../arbitrator/dn3_mn1_vnode_delDir.sim | 458 ----------------- .../dn3_mn1_vnode_noCorruptFile_offline.sim | 434 ---------------- .../arbitrator/dn3_mn1_vnode_nomaster.sim | 299 ----------- .../backup/arbitrator/dn3_mn2_killDnode.sim | 122 ----- .../arbitrator/insert_duplicationTs.sim | 293 ----------- .../offline_replica2_alterTable_online.sim | 217 -------- .../offline_replica2_alterTag_online.sim | 247 --------- .../offline_replica2_createTable_online.sim | 233 --------- .../offline_replica2_dropDb_online.sim | 180 ------- .../offline_replica2_dropTable_online.sim | 219 -------- .../offline_replica3_alterTable_online.sim | 221 -------- .../offline_replica3_alterTag_online.sim | 247 --------- .../offline_replica3_createTable_online.sim | 234 --------- .../offline_replica3_dropDb_online.sim | 180 ------- .../offline_replica3_dropTable_online.sim | 219 -------- .../replica_changeWithArbitrator.sim | 238 --------- .../sync_replica2_alterTable_add.sim | 204 -------- .../sync_replica2_alterTable_drop.sim | 204 -------- .../arbitrator/sync_replica2_dropDb.sim | 200 -------- .../arbitrator/sync_replica2_dropTable.sim | 210 -------- .../sync_replica3_alterTable_add.sim | 198 ------- .../sync_replica3_alterTable_drop.sim | 204 -------- .../arbitrator/sync_replica3_createTable.sim | 212 -------- ...ca3_dnodeChang_DropAddAlterTableDropDb.sim | 485 ------------------ .../arbitrator/sync_replica3_dropDb.sim | 200 -------- .../arbitrator/sync_replica3_dropTable.sim | 210 -------- ...sync_replica_alterTable_background_add.sim | 28 - ...ync_replica_alterTable_background_drop.sim | 25 - ...ync_replica_createTable_background_add.sim | 32 -- .../sync_replica_dropDb_background.sim | 6 - .../sync_replica_dropTable_background.sim | 18 - 48 files changed, 10911 deletions(-) delete mode 100644 tests/script/tsim/backup/arbitrator/check_cluster_cfg_para.sim delete mode 100644 tests/script/tsim/backup/arbitrator/dn2_mn1_cache_file_sync.sim delete mode 100644 tests/script/tsim/backup/arbitrator/dn2_mn1_cache_file_sync_second.sim delete mode 100644 tests/script/tsim/backup/arbitrator/dn3_mn1_full_createTableFail.sim delete mode 100644 tests/script/tsim/backup/arbitrator/dn3_mn1_full_dropDnodeFail.sim delete mode 100644 tests/script/tsim/backup/arbitrator/dn3_mn1_multiCreateDropTable.sim delete mode 100644 tests/script/tsim/backup/arbitrator/dn3_mn1_nw_disable_timeout_autoDropDnode.sim delete mode 100644 tests/script/tsim/backup/arbitrator/dn3_mn1_r2_vnode_delDir.sim delete mode 100644 tests/script/tsim/backup/arbitrator/dn3_mn1_r3_vnode_delDir.sim delete mode 100644 tests/script/tsim/backup/arbitrator/dn3_mn1_replica2_wal1_AddDelDnode.sim delete mode 100644 tests/script/tsim/backup/arbitrator/dn3_mn1_replica_change.sim delete mode 100644 tests/script/tsim/backup/arbitrator/dn3_mn1_replica_change_dropDnod.sim delete mode 100644 tests/script/tsim/backup/arbitrator/dn3_mn1_stopDnode_timeout.sim delete mode 100644 tests/script/tsim/backup/arbitrator/dn3_mn1_vnode_change.sim delete mode 100644 tests/script/tsim/backup/arbitrator/dn3_mn1_vnode_corruptFile_offline.sim delete mode 100644 tests/script/tsim/backup/arbitrator/dn3_mn1_vnode_corruptFile_online.sim delete mode 100644 tests/script/tsim/backup/arbitrator/dn3_mn1_vnode_createErrData_online.sim delete mode 100644 tests/script/tsim/backup/arbitrator/dn3_mn1_vnode_delDir.sim delete mode 100644 tests/script/tsim/backup/arbitrator/dn3_mn1_vnode_noCorruptFile_offline.sim delete mode 100644 tests/script/tsim/backup/arbitrator/dn3_mn1_vnode_nomaster.sim delete mode 100644 tests/script/tsim/backup/arbitrator/dn3_mn2_killDnode.sim delete mode 100644 tests/script/tsim/backup/arbitrator/insert_duplicationTs.sim delete mode 100644 tests/script/tsim/backup/arbitrator/offline_replica2_alterTable_online.sim delete mode 100644 tests/script/tsim/backup/arbitrator/offline_replica2_alterTag_online.sim delete mode 100644 tests/script/tsim/backup/arbitrator/offline_replica2_createTable_online.sim delete mode 100644 tests/script/tsim/backup/arbitrator/offline_replica2_dropDb_online.sim delete mode 100644 tests/script/tsim/backup/arbitrator/offline_replica2_dropTable_online.sim delete mode 100644 tests/script/tsim/backup/arbitrator/offline_replica3_alterTable_online.sim delete mode 100644 tests/script/tsim/backup/arbitrator/offline_replica3_alterTag_online.sim delete mode 100644 tests/script/tsim/backup/arbitrator/offline_replica3_createTable_online.sim delete mode 100644 tests/script/tsim/backup/arbitrator/offline_replica3_dropDb_online.sim delete mode 100644 tests/script/tsim/backup/arbitrator/offline_replica3_dropTable_online.sim delete mode 100644 tests/script/tsim/backup/arbitrator/replica_changeWithArbitrator.sim delete mode 100644 tests/script/tsim/backup/arbitrator/sync_replica2_alterTable_add.sim delete mode 100644 tests/script/tsim/backup/arbitrator/sync_replica2_alterTable_drop.sim delete mode 100644 tests/script/tsim/backup/arbitrator/sync_replica2_dropDb.sim delete mode 100644 tests/script/tsim/backup/arbitrator/sync_replica2_dropTable.sim delete mode 100644 tests/script/tsim/backup/arbitrator/sync_replica3_alterTable_add.sim delete mode 100644 tests/script/tsim/backup/arbitrator/sync_replica3_alterTable_drop.sim delete mode 100644 tests/script/tsim/backup/arbitrator/sync_replica3_createTable.sim delete mode 100644 tests/script/tsim/backup/arbitrator/sync_replica3_dnodeChang_DropAddAlterTableDropDb.sim delete mode 100644 tests/script/tsim/backup/arbitrator/sync_replica3_dropDb.sim delete mode 100644 tests/script/tsim/backup/arbitrator/sync_replica3_dropTable.sim delete mode 100644 tests/script/tsim/backup/arbitrator/sync_replica_alterTable_background_add.sim delete mode 100644 tests/script/tsim/backup/arbitrator/sync_replica_alterTable_background_drop.sim delete mode 100644 tests/script/tsim/backup/arbitrator/sync_replica_createTable_background_add.sim delete mode 100644 tests/script/tsim/backup/arbitrator/sync_replica_dropDb_background.sim delete mode 100644 tests/script/tsim/backup/arbitrator/sync_replica_dropTable_background.sim diff --git a/tests/script/tsim/backup/arbitrator/check_cluster_cfg_para.sim b/tests/script/tsim/backup/arbitrator/check_cluster_cfg_para.sim deleted file mode 100644 index 8ac75c3995..0000000000 --- a/tests/script/tsim/backup/arbitrator/check_cluster_cfg_para.sim +++ /dev/null @@ -1,199 +0,0 @@ -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 8 -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 3 - -######## 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 8 -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 3 - -######## 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 8 -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 3 - -######## 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 8 -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 3 - -######## 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 7 -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 3 - - -######## 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 8 -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 3 - - -######## 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 8 -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 3 - -print ============== step0: start tarbitrator -system sh/exec_tarbitrator.sh -s start - -print ============== step1: start dnode1 -system sh/exec.sh -n dnode1 -s start -sleep 2000 -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 - -$loopCnt = 0 -wait_dnode_created: -$loopCnt = $loopCnt + 1 -if $loopCnt == 10 then - return -1 -endi -sql select * from information_schema.ins_dnodes -if $rows != 8 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 - -$loopCnt = 0 -wait_dnode_offline_overtime_dropped: -$loopCnt = $loopCnt + 1 -if $loopCnt == 20 then - return -1 -endi -sql select * from information_schema.ins_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 != 3 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/tsim/backup/arbitrator/dn2_mn1_cache_file_sync.sim b/tests/script/tsim/backup/arbitrator/dn2_mn1_cache_file_sync.sim deleted file mode 100644 index cc8130217a..0000000000 --- a/tests/script/tsim/backup/arbitrator/dn2_mn1_cache_file_sync.sim +++ /dev/null @@ -1,222 +0,0 @@ -# Test case describe: dnode1 is only mnode, dnode2/dnode3 are only vnode -# step 1: start dnode1 -# step 2: start dnode2 and dnode3, and all added into cluster (Suppose dnode2 is master-vnode) -# step 2: create db, table, insert data, and Falling disc into file (control only one file, e.g. 1841) -# step 3: insert old data(now-20d) and new data(now-40d), control data rows in order to save in cache, not falling disc -# step 4: stop dnode2, so date rows falling disc, generate two new files 1840, 1842 in dnode2 -# step 5: insert two data rows: now-21d, now-41d -# step 6: restart dnode2, waiting sync end -# expect: in dnode2, the files 1837 and 1839 will be removed - -system sh/stop_dnodes.sh -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -system sh/deploy.sh -n dnode3 -i 3 -system sh/deploy.sh -n dnode4 -i 4 - -system sh/cfg.sh -n dnode1 -c 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 dnode1 -c walLevel -v 2 -system sh/cfg.sh -n dnode2 -c walLevel -v 2 -system sh/cfg.sh -n dnode3 -c walLevel -v 2 -system sh/cfg.sh -n dnode4 -c walLevel -v 2 - -system sh/cfg.sh -n dnode1 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode2 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode3 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode4 -c balanceInterval -v 10 - -system sh/cfg.sh -n dnode1 -c role -v 1 -system sh/cfg.sh -n dnode2 -c role -v 2 -system sh/cfg.sh -n dnode3 -c role -v 2 -system sh/cfg.sh -n dnode4 -c role -v 2 - -system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 4 -system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v 4 -system sh/cfg.sh -n dnode3 -c maxtablesPerVnode -v 4 -system sh/cfg.sh -n dnode4 -c maxtablesPerVnode -v 4 -system sh/cfg.sh -n dnode5 -c maxtablesPerVnode -v 4 - -system sh/cfg.sh -n dnode1 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode2 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode3 -c arbitrator -v $arbitrator - -print ============== step0: start tarbitrator -system sh/exec_tarbitrator.sh -s start - -print ============== step1: start dnode1, only deploy mnode -system sh/exec.sh -n dnode1 -s start -sleep 2000 -sql connect - -print ============== step2: start dnode2/dnode3 and add into cluster , then create database with replica 2, and create table, insert data -system sh/exec.sh -n dnode2 -s start -system sh/exec.sh -n dnode3 -s start -sql create dnode $hostname2 -sql create dnode $hostname3 -sleep 2000 - -$totalTableNum = 1 -$sleepTimer = 3000 - -$db = db -sql create database $db replica 2 cache 1 -sql use $db - -# create table , insert data -$stb = stb -sql create table $stb (ts timestamp, c1 double) tags(t1 int) -$rowNum = 130000 -$tblNum = $totalTableNum -$totalRows = 0 -$tsStart = 1577808000000 # 2020-01-01 00:00:00.000 - -# insert over 2M data in order to falling disc, generate one file -$i = 0 -while $i < $tblNum - $tb = tb . $i - sql create table $tb using $stb tags( $i ) - - $x = 0 - while $x < $rowNum -# $ts = $tsStart + $x - sql insert into $tb values ( now + 0s , $x ) ( now + 1s , $x ) ( now + 2s , $x ) ( now + 3s , $x ) ( now + 4s , $x ) ( now + 5s , $x ) ( now + 6s , $x ) ( now + 7s , $x ) ( now + 8s , $x ) ( now + 9s , $x ) - $x = $x + 10 - endw - $totalRows = $totalRows + $x - print info: inserted $x rows into $tb and totalRows: $totalRows - $i = $i + 1 -endw - -sql select count(*) from $stb -print rows:$rows data00:$data00 -if $rows != 1 then - return -1 -endi - -if $data00 == 0 then - return -1 -endi - -$totalRows = $data00 - -print ============== step3: insert old data(now-15d) and new data(now+15d), control data rows in order to save in cache, not falling disc -sql insert into $tb values ( now - 20d , -20 ) -sql insert into $tb values ( now - 40d , -40 ) -$totalRows = $totalRows + 2 - -print ============== step4: stop dnode3, so date rows falling disc, generate two new files in dnode3 -system sh/exec.sh -n dnode3 -s stop -x SIGINT -sleep $sleepTimer - -$loopCnt = 0 -wait_dnode3_offline: -$loopCnt = $loopCnt + 1 -if $loopCnt == 10 then - return -1 -endi - -sql select * from information_schema.ins_dnodes -if $rows != 3 then - sleep 2000 - goto wait_dnode3_offline -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 -#$dnode1Status = $data4_1 -$dnode2Status = $data4_2 -$dnode3Status = $data4_3 -#$dnode4Status = $data4_4 -#$dnode5Status = $data4_5 - -if $dnode3Status != offline then - sleep 2000 - goto wait_dnode3_offline -endi -if $dnode2Status != ready then - sleep 2000 - goto wait_dnode3_offline -endi - -sleep $sleepTimer # waitting for move master vnode of dnode2 to dnode3 -# check using select -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - -system_content ls ../../../sim/dnode3/data/vnode/vnode2/tsdb/data/ -l |grep "^-"|wc -l | tr -d '\n' -print ---->dnode3 data files: $system_content expect: 9 -if $system_content != 9 then - return -1 -endi - -print ============== step5: insert two data rows: now-16d, now+16d, -sql insert into $tb values ( now - 21d , -21 ) -sql insert into $tb values ( now - 41d , -41 ) -$totalRows = $totalRows + 2 - -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - -system_content ls ../../../sim/dnode2/data/vnode/vnode2/tsdb/data/ -l |grep "^-"|wc -l | tr -d '\n' -print ---->dnode2 data files: $system_content expect: 3 -if $system_content != 3 then - return -1 -endi - -print ============== step7: restart dnode3, waiting sync end -system sh/exec.sh -n dnode3 -s start -sleep 2000 - -$loopCnt = 0 -wait_dnode3_ready: -$loopCnt = $loopCnt + 1 -if $loopCnt == 10 then - return -1 -endi - -sql select * from information_schema.ins_dnodes -if $rows != 3 then - sleep 2000 - goto wait_dnode3_ready -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 -$dnode1Status = $data4_1 -$dnode2Status = $data4_2 -$dnode3Status = $data4_3 - -if $dnode3Status != ready then - sleep 2000 - goto wait_dnode3_ready -endi - -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - -system_content ls ../../../sim/dnode2/data/vnode/vnode2/tsdb/data/ -l |grep "^-"|wc -l | tr -d '\n' -print ---->dnode2 data files: $system_content expect: 3 -if $system_content != 3 then - return -1 -endi -system_content ls ../../../sim/dnode3/data/vnode/vnode2/tsdb/data/ -l |grep "^-"|wc -l | tr -d '\n' -print ---->dnode3 data files: $system_content expect: 3 -if $system_content != 3 then - return -1 -endi \ No newline at end of file diff --git a/tests/script/tsim/backup/arbitrator/dn2_mn1_cache_file_sync_second.sim b/tests/script/tsim/backup/arbitrator/dn2_mn1_cache_file_sync_second.sim deleted file mode 100644 index 9395beb0ef..0000000000 --- a/tests/script/tsim/backup/arbitrator/dn2_mn1_cache_file_sync_second.sim +++ /dev/null @@ -1,52 +0,0 @@ -# Test case describe: dnode1 is only mnode, dnode2/dnode3 are only vnode -# step 1: start dnode1 -# step 2: start dnode2 and dnode3, and all added into cluster (Suppose dnode2 is master-vnode) -# step 3: create db, table, insert data, and Falling disc into file (control only one file, e.g. 1841) -# step 4: insert old data(now-20d) and new data(now-40d), control data rows in order to save in cache, not falling disc -# step 5: stop dnode2, so date rows falling disc, generate two new files 1840, 1842 in dnode2 -# step 6: insert two data rows: now-21d, now-41d -# step 7: restart dnode2, waiting sync end -# expect: in dnode2, the files 1837 and 1839 will be removed - -sql connect -sleep 2000 - -print ============== step7: restart dnode2, waiting sync end -system sh/exec.sh -n dnode2 -s start -sleep 2000 - -wait_dnode2_ready: -sql select * from information_schema.ins_dnodes -if $rows != 3 then - sleep 2000 - goto wait_dnode2_ready -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 -#$dnode1Status = $data4_1 -$dnode2Status = $data4_2 -$dnode3Status = $data4_3 -#$dnode4Status = $data4_4 -#$dnode5Status = $data4_5 - -if $dnode2Status != ready then - sleep 2000 - goto wait_dnode2_ready -endi - -sleep 1000 -# check using select -$db = db -$stb = stb -sql use $db -sql select count(*) from $stb -print data00 $data00, should equal to dn2_mn1_cache_file_sync.sim output -#if $data00 != $totalRows then -# return -1 -#endi - -print ============== step8: please check there should be 1 file in sim/dnode2/data/vnode/vnode2/tsdb/data/, and 1 file sim/dnode3/data/vnode/vnode2/tsdb/data/ diff --git a/tests/script/tsim/backup/arbitrator/dn3_mn1_full_createTableFail.sim b/tests/script/tsim/backup/arbitrator/dn3_mn1_full_createTableFail.sim deleted file mode 100644 index 057654abb4..0000000000 --- a/tests/script/tsim/backup/arbitrator/dn3_mn1_full_createTableFail.sim +++ /dev/null @@ -1,101 +0,0 @@ -system sh/stop_dnodes.sh -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -system sh/deploy.sh -n dnode3 -i 3 -system sh/deploy.sh -n dnode4 -i 4 - -system sh/cfg.sh -n dnode1 -c 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 dnode1 -c walLevel -v 2 -system sh/cfg.sh -n dnode2 -c walLevel -v 2 -system sh/cfg.sh -n dnode3 -c walLevel -v 2 -system sh/cfg.sh -n dnode4 -c walLevel -v 2 - -system sh/cfg.sh -n dnode1 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode2 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode3 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode4 -c balanceInterval -v 10 - -system sh/cfg.sh -n dnode1 -c role -v 1 -system sh/cfg.sh -n dnode2 -c role -v 2 -system sh/cfg.sh -n dnode3 -c role -v 2 -system sh/cfg.sh -n dnode4 -c role -v 2 - -system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 4 -system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v 4 -system sh/cfg.sh -n dnode3 -c maxtablesPerVnode -v 4 -system sh/cfg.sh -n dnode4 -c maxtablesPerVnode -v 4 - -system sh/cfg.sh -n dnode1 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode2 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode3 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode4 -c arbitrator -v $arbitrator - -print ============== step0: start tarbitrator -system sh/exec_tarbitrator.sh -s start - -print ============== step1: start dnode1, only deploy mnode -system sh/exec.sh -n dnode1 -s start -sleep 2000 -sql connect - -print ============== step2: start dnode2/dnode3/dnode4 and add into cluster , then create database with replica 3, and create table to max tables -system sh/exec.sh -n dnode2 -s start -system sh/exec.sh -n dnode3 -s start -system sh/exec.sh -n dnode4 -s start -sql create dnode $hostname2 -sql create dnode $hostname3 -sql create dnode $hostname4 -sleep 2000 - -$totalTableNum = 16 -$sleepTimer = 3000 - -$db = db -sql create database $db replica 3 -sql use $db - -# create table , insert data -$stb = stb -sql create table $stb (ts timestamp, c1 int) tags(t1 int) -$rowNum = 10 -$tblNum = $totalTableNum -$totalRows = 0 -$tsStart = 1420041600000 - -$i = 0 -while $i < $tblNum - $tb = tb . $i - sql create table $tb using $stb tags( $i ) - - $x = 0 - while $x < $rowNum - $ts = $tsStart + $x - sql insert into $tb values ( $ts + 0a , $x ) ( $ts + 1a , $x ) ( $ts + 2a , $x ) ( $ts + 3a , $x ) ( $ts + 4a , $x ) ( $ts + 5a , $x ) ( $ts + 6a , $x ) ( $ts + 7a , $x ) ( $ts + 8a , $x ) ( $ts + 9a , $x ) - $x = $x + 10 - endw - $totalRows = $totalRows + $x - print info: inserted $x rows into $tb and totalRows: $totalRows - $i = $i + 1 -endw - -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - - -print ============== step3: create one table, should return error for not more vnode -sql_error create table tbm using $stb tags( 10000 ) - - - - - - - - diff --git a/tests/script/tsim/backup/arbitrator/dn3_mn1_full_dropDnodeFail.sim b/tests/script/tsim/backup/arbitrator/dn3_mn1_full_dropDnodeFail.sim deleted file mode 100644 index c597c576e2..0000000000 --- a/tests/script/tsim/backup/arbitrator/dn3_mn1_full_dropDnodeFail.sim +++ /dev/null @@ -1,102 +0,0 @@ -system sh/stop_dnodes.sh -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -system sh/deploy.sh -n dnode3 -i 3 -system sh/deploy.sh -n dnode4 -i 4 - -system sh/cfg.sh -n dnode1 -c 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 dnode1 -c walLevel -v 2 -system sh/cfg.sh -n dnode2 -c walLevel -v 2 -system sh/cfg.sh -n dnode3 -c walLevel -v 2 -system sh/cfg.sh -n dnode4 -c walLevel -v 2 - -system sh/cfg.sh -n dnode1 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode2 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode3 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode4 -c balanceInterval -v 10 - -system sh/cfg.sh -n dnode1 -c role -v 1 -system sh/cfg.sh -n dnode2 -c role -v 2 -system sh/cfg.sh -n dnode3 -c role -v 2 -system sh/cfg.sh -n dnode4 -c role -v 2 - -system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 4 -system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v 4 -system sh/cfg.sh -n dnode3 -c maxtablesPerVnode -v 4 -system sh/cfg.sh -n dnode4 -c maxtablesPerVnode -v 4 -system sh/cfg.sh -n dnode5 -c maxtablesPerVnode -v 4 - -system sh/cfg.sh -n dnode1 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode2 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode3 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode4 -c arbitrator -v $arbitrator - -print ============== step0: start tarbitrator -system sh/exec_tarbitrator.sh -s start - -print ============== step1: start dnode1, only deploy mnode -system sh/exec.sh -n dnode1 -s start -sleep 2000 -sql connect - -print ============== step2: start dnode2/dnode3/dnode4 and add into cluster , then create database with replica 3, and create table to max tables -system sh/exec.sh -n dnode2 -s start -system sh/exec.sh -n dnode3 -s start -system sh/exec.sh -n dnode4 -s start -sql create dnode $hostname2 -sql create dnode $hostname3 -sql create dnode $hostname4 -sleep 2000 - -$totalTableNum = 16 -$sleepTimer = 3000 - -$db = db -sql create database $db replica 3 -sql use $db - -# create table , insert data -$stb = stb -sql create table $stb (ts timestamp, c1 int) tags(t1 int) -$rowNum = 10 -$tblNum = $totalTableNum -$totalRows = 0 -$tsStart = 1420041600000 - -$i = 0 -while $i < $tblNum - $tb = tb . $i - sql create table $tb using $stb tags( $i ) - - $x = 0 - while $x < $rowNum - $ts = $tsStart + $x - sql insert into $tb values ( $ts + 0a , $x ) ( $ts + 1a , $x ) ( $ts + 2a , $x ) ( $ts + 3a , $x ) ( $ts + 4a , $x ) ( $ts + 5a , $x ) ( $ts + 6a , $x ) ( $ts + 7a , $x ) ( $ts + 8a , $x ) ( $ts + 9a , $x ) - $x = $x + 10 - endw - $totalRows = $totalRows + $x - print info: inserted $x rows into $tb and totalRows: $totalRows - $i = $i + 1 -endw - -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - - -print ============== step3: drop dnode4, should return error for not more dnode -sql_error drop dnode $hostname4 - - - - - - - - diff --git a/tests/script/tsim/backup/arbitrator/dn3_mn1_multiCreateDropTable.sim b/tests/script/tsim/backup/arbitrator/dn3_mn1_multiCreateDropTable.sim deleted file mode 100644 index 49e1dba067..0000000000 --- a/tests/script/tsim/backup/arbitrator/dn3_mn1_multiCreateDropTable.sim +++ /dev/null @@ -1,310 +0,0 @@ -system sh/stop_dnodes.sh -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -system sh/deploy.sh -n dnode3 -i 3 -system sh/deploy.sh -n dnode4 -i 4 - -system sh/cfg.sh -n dnode1 -c 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 dnode1 -c walLevel -v 2 -system sh/cfg.sh -n dnode2 -c walLevel -v 2 -system sh/cfg.sh -n dnode3 -c walLevel -v 2 -system sh/cfg.sh -n dnode4 -c walLevel -v 2 - -system sh/cfg.sh -n dnode1 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode2 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode3 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode4 -c balanceInterval -v 10 - -system sh/cfg.sh -n dnode1 -c role -v 1 -system sh/cfg.sh -n dnode2 -c role -v 2 -system sh/cfg.sh -n dnode3 -c role -v 2 -system sh/cfg.sh -n dnode4 -c role -v 2 - -$totalTableNum = 10 -system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v $totalTableNum -system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v $totalTableNum -system sh/cfg.sh -n dnode3 -c maxtablesPerVnode -v $totalTableNum -system sh/cfg.sh -n dnode4 -c maxtablesPerVnode -v $totalTableNum - -system sh/cfg.sh -n dnode1 -c maxVgroupsPerDb -v 1 -system sh/cfg.sh -n dnode2 -c maxVgroupsPerDb -v 1 -system sh/cfg.sh -n dnode3 -c maxVgroupsPerDb -v 1 -system sh/cfg.sh -n dnode4 -c maxVgroupsPerDb -v 1 - -system sh/cfg.sh -n dnode1 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode2 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode3 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode4 -c arbitrator -v $arbitrator - -print ============== step0: start tarbitrator -system sh/exec_tarbitrator.sh -s start - -print ============== step1: start dnode1, only deploy mnode -system sh/exec.sh -n dnode1 -s start -sleep 2000 -sql connect - -print ============== step2: start dnode2/dnode3/dnode4 and add into cluster , then create database with replica 3, and create table, insert data -system sh/exec.sh -n dnode2 -s start -system sh/exec.sh -n dnode3 -s start -system sh/exec.sh -n dnode4 -s start -sql create dnode $hostname2 -sql create dnode $hostname3 -sql create dnode $hostname4 -sleep 2000 - -$sleepTimer = 3000 - -$db = db -sql create database $db replica 3 -sql use $db - -# create table , insert data -$stb = stb -sql create table $stb (ts timestamp, c1 int) tags(t1 int) -$rowNum = 10 -$tblNum = $totalTableNum -$totalRows = 0 -$tsStart = 1420041600000 - -$i = 0 -while $i < $tblNum - $tb = tb . $i - sql create table $tb using $stb tags( $i ) - - $x = 0 - while $x < $rowNum - $ts = $tsStart + $x - sql insert into $tb values ( $ts + 0a , $x ) ( $ts + 1a , $x ) ( $ts + 2a , $x ) ( $ts + 3a , $x ) ( $ts + 4a , $x ) ( $ts + 5a , $x ) ( $ts + 6a , $x ) ( $ts + 7a , $x ) ( $ts + 8a , $x ) ( $ts + 9a , $x ) - $x = $x + 10 - endw - $totalRows = $totalRows + $x - print info: inserted $x rows into $tb and totalRows: $totalRows - $i = $i + 1 -endw - -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - -print ============== step3: drop the middle table 5 -sql drop table tb5 -$totalRows = $totalRows - 10 -sleep 6000 - -print ============== step4: insert data into other tables -$tsStart = 1420041610000 -$i = 0 -$tblNum = 5 -while $i < $tblNum - $tb = tb . $i - #sql create table $tb using $stb tags( $i ) - - $x = 0 - while $x < $rowNum - $ts = $tsStart + $x - sql insert into $tb values ( $ts + 0a , $x ) ( $ts + 1a , $x ) ( $ts + 2a , $x ) ( $ts + 3a , $x ) ( $ts + 4a , $x ) ( $ts + 5a , $x ) ( $ts + 6a , $x ) ( $ts + 7a , $x ) ( $ts + 8a , $x ) ( $ts + 9a , $x ) - $x = $x + 10 - endw - $totalRows = $totalRows + $x - print info: inserted $x rows into $tb and totalRows: $totalRows - $i = $i + 1 -endw - -$i = 6 -$tblNum = 10 -while $i < $tblNum - $tb = tb . $i - #sql create table $tb using $stb tags( $i ) - - $x = 0 - while $x < $rowNum - $ts = $tsStart + $x - sql insert into $tb values ( $ts + 0a , $x ) ( $ts + 1a , $x ) ( $ts + 2a , $x ) ( $ts + 3a , $x ) ( $ts + 4a , $x ) ( $ts + 5a , $x ) ( $ts + 6a , $x ) ( $ts + 7a , $x ) ( $ts + 8a , $x ) ( $ts + 9a , $x ) - $x = $x + 10 - endw - $totalRows = $totalRows + $x - print info: inserted $x rows into $tb and totalRows: $totalRows - $i = $i + 1 -endw - -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - - -print ============== step5: create the middle table 5 and insert data -sql create table tb5 using $stb tags( 5 ) -sleep 2000 - -$tsStart = 1420041620000 -$i = 5 -$tblNum = 6 -while $i < $tblNum - $tb = tb . $i - #sql create table $tb using $stb tags( $i ) - - $x = 0 - while $x < $rowNum - $ts = $tsStart + $x - sql insert into $tb values ( $ts + 0a , $x ) ( $ts + 1a , $x ) ( $ts + 2a , $x ) ( $ts + 3a , $x ) ( $ts + 4a , $x ) ( $ts + 5a , $x ) ( $ts + 6a , $x ) ( $ts + 7a , $x ) ( $ts + 8a , $x ) ( $ts + 9a , $x ) - $x = $x + 10 - endw - $totalRows = $totalRows + $x - print info: inserted $x rows into $tb and totalRows: $totalRows - $i = $i + 1 -endw - -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - -sql select count(*) from tb5 -print data00 $data00 -if $data00 != 10 then - return -1 -endi - -print ============== step6: drop the first table 0 -sql drop table tb0 -$totalRows = $totalRows - 20 -sleep 6000 - -print ============== step7: insert data into other tables -$tsStart = 1420041630000 -$i = 1 -$tblNum = 10 -while $i < $tblNum - $tb = tb . $i - #sql create table $tb using $stb tags( $i ) - - $x = 0 - while $x < $rowNum - $ts = $tsStart + $x - sql insert into $tb values ( $ts + 0a , $x ) ( $ts + 1a , $x ) ( $ts + 2a , $x ) ( $ts + 3a , $x ) ( $ts + 4a , $x ) ( $ts + 5a , $x ) ( $ts + 6a , $x ) ( $ts + 7a , $x ) ( $ts + 8a , $x ) ( $ts + 9a , $x ) - $x = $x + 10 - endw - $totalRows = $totalRows + $x - print info: inserted $x rows into $tb and totalRows: $totalRows - $i = $i + 1 -endw - -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi -sql select count(*) from tb5 -print data00 $data00 -if $data00 != 20 then - return -1 -endi - -print ============== step8: create the first table 0 and insert data -sql create table tb0 using $stb tags( 0 ) -sleep 2000 - -$tsStart = 1420041640000 -$i = 0 -$tblNum = 10 -while $i < $tblNum - $tb = tb . $i - #sql create table $tb using $stb tags( $i ) - - $x = 0 - while $x < $rowNum - $ts = $tsStart + $x - sql insert into $tb values ( $ts + 0a , $x ) ( $ts + 1a , $x ) ( $ts + 2a , $x ) ( $ts + 3a , $x ) ( $ts + 4a , $x ) ( $ts + 5a , $x ) ( $ts + 6a , $x ) ( $ts + 7a , $x ) ( $ts + 8a , $x ) ( $ts + 9a , $x ) - $x = $x + 10 - endw - $totalRows = $totalRows + $x - print info: inserted $x rows into $tb and totalRows: $totalRows - $i = $i + 1 -endw - -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - -sql select count(*) from tb0 -print data00 $data00 -if $data00 != 10 then - return -1 -endi - -print ============== step9: drop the last table 9 -sql drop table tb9 -$totalRows = $totalRows - 40 -sleep 6000 - -print ============== step10: insert data into other tables -$tsStart = 1420041650000 -$i = 0 -$tblNum = 9 -while $i < $tblNum - $tb = tb . $i - #sql create table $tb using $stb tags( $i ) - - $x = 0 - while $x < $rowNum - $ts = $tsStart + $x - sql insert into $tb values ( $ts + 0a , $x ) ( $ts + 1a , $x ) ( $ts + 2a , $x ) ( $ts + 3a , $x ) ( $ts + 4a , $x ) ( $ts + 5a , $x ) ( $ts + 6a , $x ) ( $ts + 7a , $x ) ( $ts + 8a , $x ) ( $ts + 9a , $x ) - $x = $x + 10 - endw - $totalRows = $totalRows + $x - print info: inserted $x rows into $tb and totalRows: $totalRows - $i = $i + 1 -endw - -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - - -print ============== step11: create the last table 9 and insert data -sql create table tb9 using $stb tags( 9 ) -sleep 2000 - -$tsStart = 1420041660000 -$i = 0 -$tblNum = 10 -while $i < $tblNum - $tb = tb . $i - #sql create table $tb using $stb tags( $i ) - - $x = 0 - while $x < $rowNum - $ts = $tsStart + $x - sql insert into $tb values ( $ts + 0a , $x ) ( $ts + 1a , $x ) ( $ts + 2a , $x ) ( $ts + 3a , $x ) ( $ts + 4a , $x ) ( $ts + 5a , $x ) ( $ts + 6a , $x ) ( $ts + 7a , $x ) ( $ts + 8a , $x ) ( $ts + 9a , $x ) - $x = $x + 10 - endw - $totalRows = $totalRows + $x - print info: inserted $x rows into $tb and totalRows: $totalRows - $i = $i + 1 -endw - -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - -sql select count(*) from tb9 -print data00 $data00 -if $data00 != 10 then - return -1 -endi diff --git a/tests/script/tsim/backup/arbitrator/dn3_mn1_nw_disable_timeout_autoDropDnode.sim b/tests/script/tsim/backup/arbitrator/dn3_mn1_nw_disable_timeout_autoDropDnode.sim deleted file mode 100644 index a2c1bf9883..0000000000 --- a/tests/script/tsim/backup/arbitrator/dn3_mn1_nw_disable_timeout_autoDropDnode.sim +++ /dev/null @@ -1,160 +0,0 @@ -system sh/stop_dnodes.sh -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -system sh/deploy.sh -n dnode3 -i 3 -system sh/deploy.sh -n dnode4 -i 4 - -system sh/cfg.sh -n dnode1 -c 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 dnode1 -c walLevel -v 1 -system sh/cfg.sh -n dnode2 -c walLevel -v 1 -system sh/cfg.sh -n dnode3 -c walLevel -v 1 -system sh/cfg.sh -n dnode4 -c walLevel -v 1 - -system sh/cfg.sh -n dnode1 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode2 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode3 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode4 -c balanceInterval -v 10 - -system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 4 -system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v 4 -system sh/cfg.sh -n dnode3 -c maxtablesPerVnode -v 4 -system sh/cfg.sh -n dnode4 -c maxtablesPerVnode -v 4 - -system sh/cfg.sh -n dnode1 -c role -v 1 -system sh/cfg.sh -n dnode2 -c role -v 2 -system sh/cfg.sh -n dnode3 -c role -v 2 -system sh/cfg.sh -n dnode4 -c role -v 2 - -system sh/cfg.sh -n dnode1 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode2 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode3 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode4 -c arbitrator -v $arbitrator - -system sh/cfg.sh -n dnode1 -c offlineThreshold -v 10 -system sh/cfg.sh -n dnode2 -c offlineThreshold -v 10 -system sh/cfg.sh -n dnode3 -c offlineThreshold -v 10 -system sh/cfg.sh -n dnode4 -c offlineThreshold -v 10 - -system sh/cfg.sh -n dnode1 -c enableCoreFile -v 1 -system sh/cfg.sh -n dnode2 -c enableCoreFile -v 1 -system sh/cfg.sh -n dnode3 -c enableCoreFile -v 1 -system sh/cfg.sh -n dnode4 -c enableCoreFile -v 1 - -print ============== step0: start tarbitrator -system sh/exec_tarbitrator.sh -s start - -print ============== step1: start dnode1, only deploy mnode -system sh/exec.sh -n dnode1 -s start -sleep 2000 -sql connect - -print ============== step2: start dnode2/dnode3 and add into cluster, then create database, create table , and insert data -system sh/exec.sh -n dnode2 -s start -system sh/exec.sh -n dnode3 -s start -system sh/exec.sh -n dnode4 -s start -sql create dnode $hostname2 -sql create dnode $hostname3 -sql create dnode $hostname4 -sleep 2000 - -$rowNum = 10 -$tblNum = 16 -$totalRows = 0 -$tsStart = 1420041600000 - -$db = db -sql create database $db replica 2 -sql use $db - -# create table , insert data -$stb = stb -sql create table $stb (ts timestamp, c1 int) tags(t1 int) - - -$i = 0 -while $i < $tblNum - $tb = tb . $i - sql create table $tb using $stb tags( $i ) - - $x = 0 - while $x < $rowNum - $ts = $tsStart + $x - sql insert into $tb values ( $ts + 0a , $x ) ( $ts + 1a , $x ) ( $ts + 2a , $x ) ( $ts + 3a , $x ) ( $ts + 4a , $x ) ( $ts + 5a , $x ) ( $ts + 6a , $x ) ( $ts + 7a , $x ) ( $ts + 8a , $x ) ( $ts + 9a , $x ) - $x = $x + 10 - endw - $totalRows = $totalRows + $x - print info: inserted $x rows into $tb and totalRows: $totalRows - $i = $i + 1 -endw - -print info: select count(*) from $stb -sleep 1000 -sql reset query cache -sleep 1000 -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - -sql select * from information_schema.ins_dnodes -if $rows != 4 then - return -1 -endi - -print ============== step3: stop dnode4, after timerout dnode4 will be auto-dropped. -### The script using down port to stop the network is invalid, so temp it stops the service instead -system sh/exec.sh -n dnode4 -s stop -#system sh/port.sh -p 7400 -s down -sleep 12000 - -$loopCnt = 0 -wait_dnode4_dropped: -$loopCnt = $loopCnt + 1 -if $loopCnt == 10 then - return -1 -endi - -sql select * from information_schema.ins_dnodes -if $rows != 3 then - sleep 2000 - goto wait_dnode4_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 -#$dnode1Status = $data4_1 -$dnode2Status = $data4_2 -$dnode3Status = $data4_3 -$dnode4Status = $data4_4 -#$dnode5Status = $data4_5 - -if $dnode2Status != ready then - sleep 2000 - goto wait_dnode4_dropped -endi -if $dnode3Status != ready then - sleep 2000 - goto wait_dnode4_dropped -endi - -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - -print ============== step4: restart dnode4, but there no dnode4 in cluster -system sh/exec.sh -n dnode4 -s start -sql select * from information_schema.ins_dnodes -if $rows != 3 then - return -1 -endi - diff --git a/tests/script/tsim/backup/arbitrator/dn3_mn1_r2_vnode_delDir.sim b/tests/script/tsim/backup/arbitrator/dn3_mn1_r2_vnode_delDir.sim deleted file mode 100644 index 560aef5c17..0000000000 --- a/tests/script/tsim/backup/arbitrator/dn3_mn1_r2_vnode_delDir.sim +++ /dev/null @@ -1,358 +0,0 @@ -system sh/stop_dnodes.sh -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -system sh/deploy.sh -n dnode3 -i 3 -system sh/deploy.sh -n dnode4 -i 4 - -system sh/cfg.sh -n dnode1 -c 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 dnode1 -c walLevel -v 2 -system sh/cfg.sh -n dnode2 -c walLevel -v 2 -system sh/cfg.sh -n dnode3 -c walLevel -v 2 -system sh/cfg.sh -n dnode4 -c walLevel -v 2 - -system sh/cfg.sh -n dnode1 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode2 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode3 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode4 -c balanceInterval -v 10 - -system sh/cfg.sh -n dnode1 -c role -v 1 -system sh/cfg.sh -n dnode2 -c role -v 2 -system sh/cfg.sh -n dnode3 -c role -v 2 -system sh/cfg.sh -n dnode4 -c role -v 2 - -$totalTableNum = 10 -system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v $totalTableNum -system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v $totalTableNum -system sh/cfg.sh -n dnode3 -c maxtablesPerVnode -v $totalTableNum -system sh/cfg.sh -n dnode4 -c maxtablesPerVnode -v $totalTableNum - -system sh/cfg.sh -n dnode1 -c maxVgroupsPerDb -v 1 -system sh/cfg.sh -n dnode2 -c maxVgroupsPerDb -v 1 -system sh/cfg.sh -n dnode3 -c maxVgroupsPerDb -v 1 -system sh/cfg.sh -n dnode4 -c maxVgroupsPerDb -v 1 - -system sh/cfg.sh -n dnode1 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode2 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode3 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode4 -c arbitrator -v $arbitrator - -print ============== step0: start tarbitrator -system sh/exec_tarbitrator.sh -s start - -print ============== step1: start dnode1, only deploy mnode -system sh/exec.sh -n dnode1 -s start -sleep 2000 -sql connect - -print ============== step2: start dnode2/dnode3/dnode4 and add into cluster , then create database with replica 2, and create table, insert data -system sh/exec.sh -n dnode2 -s start -system sh/exec.sh -n dnode3 -s start -sql create dnode $hostname2 -sql create dnode $hostname3 -sleep 3000 - -$sleepTimer = 3000 - -$db = db -sql create database $db replica 2 -sql use $db - -# create table , insert data -$stb = stb -sql create table $stb (ts timestamp, c1 int) tags(t1 int) -$rowNum = 100 -$tblNum = $totalTableNum -$totalRows = 0 -$tsStart = 1420041600000 - -$i = 0 -while $i < $tblNum - $tb = tb . $i - sql create table $tb using $stb tags( $i ) - - $x = 0 - while $x < $rowNum - $ts = $tsStart + $x - sql insert into $tb values ( $ts + 0a , $x ) ( $ts + 1a , $x ) ( $ts + 2a , $x ) ( $ts + 3a , $x ) ( $ts + 4a , $x ) ( $ts + 5a , $x ) ( $ts + 6a , $x ) ( $ts + 7a , $x ) ( $ts + 8a , $x ) ( $ts + 9a , $x ) ( $ts + 10a , $x ) ( $ts + 11a , $x ) ( $ts + 12a , $x ) ( $ts + 13a , $x ) ( $ts + 14a , $x ) ( $ts + 15a , $x ) ( $ts + 16a , $x ) ( $ts + 17a , $x ) ( $ts + 18a , $x ) ( $ts + 19a , $x ) ( $ts + 20a , $x ) ( $ts + 21a , $x ) ( $ts + 22a , $x ) ( $ts + 23a , $x ) ( $ts + 24a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 35a , $x ) ( $ts + 36a , $x ) ( $ts + 37a , $x ) ( $ts + 38a , $x ) ( $ts + 39a , $x ) ( $ts + 40a , $x ) ( $ts + 41a , $x ) ( $ts + 42a , $x ) ( $ts + 43a , $x ) ( $ts + 44a , $x ) ( $ts + 45a , $x ) ( $ts + 46a , $x ) ( $ts + 47a , $x ) ( $ts + 48a , $x ) ( $ts + 49a , $x ) ( $ts + 50a , $x ) ( $ts + 51a , $x ) ( $ts + 52a , $x ) ( $ts + 53a , $x ) ( $ts + 54a , $x ) ( $ts + 55a , $x ) ( $ts + 56a , $x ) ( $ts + 57a , $x ) ( $ts + 58a , $x ) ( $ts + 59a , $x ) - $x = $x + 60 - endw - $totalRows = $totalRows + $x - print info: inserted $x rows into $tb and totalRows: $totalRows - $i = $i + 1 -endw - -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - -print ============== step3: stop dnode3, and remove its vnodeX subdirector -system sh/exec.sh -n dnode3 -s stop -x SIGINT -#sleep $sleepTimer - -$loopCnt = 0 -wait_dnode3_offline_0: -$loopCnt = $loopCnt + 1 -if $loopCnt == 10 then - return -1 -endi - -sql select * from information_schema.ins_dnodes -if $rows != 4 then - sleep 2000 - goto wait_dnode3_offline_0 -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 -$dnode1Status = $data4_1 -$dnode2Status = $data4_2 -$dnode3Status = $data4_3 -$dnode4Status = $data4_4 - -if $dnode3Status != offline then - sleep 2000 - goto wait_dnode3_offline_0 -endi - -$loopCnt = 0 -wait_dnode3_vgroup_offline: -$loopCnt = $loopCnt + 1 -if $loopCnt == 10 then - return -1 -endi - -sql show vgroups -if $rows != 1 then - sleep 2000 - goto wait_dnode3_vgroup_offline -endi -print show vgroups: -print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 $data5_1 $data6_1 $data7_1 $data8_1 $data9_1 -print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 $data5_2 $data6_2 $data7_2 $data8_2 $data9_2 -print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3 $data5_3 $data6_3 $data7_3 $data8_3 $data9_3 -$dnode3Vtatus = $data5_2 -$dnode2Vtatus = $data7_2 - -if $dnode3Vtatus != offline then - sleep 2000 - goto wait_dnode3_vgroup_offline -endi -if $dnode2Vtatus != master then - sleep 2000 - goto wait_dnode3_vgroup_offline -endi - -system rm -rf ../../../sim/dnode3/data -#system rm -rf ../../../sim/dnode3/data/vnode/* - -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - -print ============== step4: restart dnode3, waiting sync end -system sh/exec.sh -n dnode3 -s start -#sleep $sleepTimer - -$loopCnt = 0 -wait_dnode3_reready: -$loopCnt = $loopCnt + 1 -if $loopCnt == 10 then - return -1 -endi - -sql select * from information_schema.ins_dnodes -if $rows != 4 then - sleep 2000 - goto wait_dnode3_reready -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 -$dnode1Status = $data4_1 -$dnode2Status = $data4_2 -$dnode3Status = $data4_3 -$dnode4Status = $data4_4 - -if $dnode3Status != ready then - sleep 2000 - goto wait_dnode3_reready -endi - -$loopCnt = 0 -wait_dnode3_vgroup_slave: -$loopCnt = $loopCnt + 1 -if $loopCnt == 10 then - return -1 -endi - -sql show vgroups -if $rows != 1 then - sleep 2000 - goto wait_dnode3_vgroup_slave -endi -print show vgroups: -print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 $data5_1 $data6_1 $data7_1 $data8_1 $data9_1 -print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 $data5_2 $data6_2 $data7_2 $data8_2 $data9_2 -print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3 $data5_3 $data6_3 $data7_3 $data8_3 $data9_3 -$dnode3Vtatus = $data5_2 -$dnode2Vtatus = $data7_2 - -print dnode2Vtatus: $dnode3Vtatus -print dnode3Vtatus: $dnode3Vtatus -if $dnode3Vtatus != slave then - sleep 2000 - goto wait_dnode3_vgroup_slave -endi -if $dnode2Vtatus != master then - sleep 2000 - goto wait_dnode3_vgroup_slave -endi - -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - -print ============== step5: stop dnode2, and remove its vnode -sleep 3000 -system sh/exec.sh -n dnode2 -s stop -x SIGINT -sleep $sleepTimer - -$loopCnt = 0 -wait_dnode2_offline: -$loopCnt = $loopCnt + 1 -if $loopCnt == 10 then - return -1 -endi - -sql select * from information_schema.ins_dnodes -if $rows != 4 then - sleep 2000 - goto wait_dnode2_offline -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 -$dnode1Status = $data4_1 -$dnode2Status = $data4_2 -$dnode3Status = $data4_3 -$dnode4Status = $data4_4 - -if $dnode2Status != offline then - sleep 2000 - goto wait_dnode2_offline -endi -if $dnode3Status != ready then - sleep 2000 - goto wait_dnode2_offline -endi - -system rm -rf ../../../sim/dnode2/data -#system rm -rf ../../../sim/dnode2/data/vnode/* -#system rm -rf ../../../sim/dnode3/data/vnode/* - -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - - -print ============== step6: restart dnode2, and check rows -system sh/exec.sh -n dnode2 -s start -#sleep $sleepTimer - -$loopCnt = 0 -wait_dnode2_reready: -$loopCnt = $loopCnt + 1 -if $loopCnt == 10 then - return -1 -endi - -sql select * from information_schema.ins_dnodes -if $rows != 4 then - sleep 2000 - goto wait_dnode2_reready -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 -$dnode1Status = $data4_1 -$dnode2Status = $data4_2 -$dnode3Status = $data4_3 -$dnode4Status = $data4_4 - -if $dnode3Status != ready then - sleep 2000 - goto wait_dnode2_reready -endi -if $dnode2Status != ready then - sleep 2000 - goto wait_dnode2_reready -endi - -$loopCnt = 0 -wait_dnode2_vgroup_slave: -$loopCnt = $loopCnt + 1 -if $loopCnt == 10 then - return -1 -endi - -sql show vgroups -if $rows != 1 then - sleep 2000 - goto wait_dnode2_vgroup_slave -endi -print show vgroups: -print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 $data5_1 $data6_1 $data7_1 $data8_1 $data9_1 -print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 $data5_2 $data6_2 $data7_2 $data8_2 $data9_2 -print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3 $data5_3 $data6_3 $data7_3 $data8_3 $data9_3 -$dnode3Vtatus = $data5_2 -$dnode2Vtatus = $data7_2 - -print dnode4Vtatus: $dnode4Vtatus -print dnode3Vtatus: $dnode3Vtatus -if $dnode3Vtatus != master then - sleep 2000 - goto wait_dnode2_vgroup_slave -endi -if $dnode2Vtatus != slave then - sleep 2000 - goto wait_dnode2_vgroup_slave -endi - -# check using select -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - -sql insert into $tb values ( now , 20000 ) ( now + 1a, 20001 ) ( now + 2a, 20002 ) -$totalRows = $totalRows + 3 - -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - -system sh/exec.sh -n dnode3 -s stop -x SIGINT -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi \ No newline at end of file diff --git a/tests/script/tsim/backup/arbitrator/dn3_mn1_r3_vnode_delDir.sim b/tests/script/tsim/backup/arbitrator/dn3_mn1_r3_vnode_delDir.sim deleted file mode 100644 index d8a410283e..0000000000 --- a/tests/script/tsim/backup/arbitrator/dn3_mn1_r3_vnode_delDir.sim +++ /dev/null @@ -1,409 +0,0 @@ -system sh/stop_dnodes.sh -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -system sh/deploy.sh -n dnode3 -i 3 -system sh/deploy.sh -n dnode4 -i 4 - -system sh/cfg.sh -n dnode1 -c 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 dnode1 -c walLevel -v 2 -system sh/cfg.sh -n dnode2 -c walLevel -v 2 -system sh/cfg.sh -n dnode3 -c walLevel -v 2 -system sh/cfg.sh -n dnode4 -c walLevel -v 2 - -system sh/cfg.sh -n dnode1 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode2 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode3 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode4 -c balanceInterval -v 10 - -system sh/cfg.sh -n dnode1 -c role -v 1 -system sh/cfg.sh -n dnode2 -c role -v 2 -system sh/cfg.sh -n dnode3 -c role -v 2 -system sh/cfg.sh -n dnode4 -c role -v 2 - -$totalTableNum = 10 -system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v $totalTableNum -system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v $totalTableNum -system sh/cfg.sh -n dnode3 -c maxtablesPerVnode -v $totalTableNum -system sh/cfg.sh -n dnode4 -c maxtablesPerVnode -v $totalTableNum - -system sh/cfg.sh -n dnode1 -c maxVgroupsPerDb -v 1 -system sh/cfg.sh -n dnode2 -c maxVgroupsPerDb -v 1 -system sh/cfg.sh -n dnode3 -c maxVgroupsPerDb -v 1 -system sh/cfg.sh -n dnode4 -c maxVgroupsPerDb -v 1 - -system sh/cfg.sh -n dnode1 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode2 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode3 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode4 -c arbitrator -v $arbitrator - -print ============== step0: start tarbitrator -system sh/exec_tarbitrator.sh -s start - -print ============== step1: start dnode1, only deploy mnode -system sh/exec.sh -n dnode1 -s start -sleep 2000 -sql connect - -print ============== step2: start dnode2/dnode3/dnode4 and add into cluster , then create database with replica 3, and create table, insert data -system sh/exec.sh -n dnode2 -s start -system sh/exec.sh -n dnode3 -s start -system sh/exec.sh -n dnode4 -s start -sql create dnode $hostname2 -sql create dnode $hostname3 -sql create dnode $hostname4 -sleep 2000 - -$sleepTimer = 3000 - -$db = db -sql create database $db replica 3 -sql use $db - -# create table , insert data -$stb = stb -sql create table $stb (ts timestamp, c1 int) tags(t1 int) -$rowNum = 100 -$tblNum = $totalTableNum -$totalRows = 0 -$tsStart = 1420041600000 - -$i = 0 -while $i < $tblNum - $tb = tb . $i - sql create table $tb using $stb tags( $i ) - - $x = 0 - while $x < $rowNum - $ts = $tsStart + $x - sql insert into $tb values ( $ts + 0a , $x ) ( $ts + 1a , $x ) ( $ts + 2a , $x ) ( $ts + 3a , $x ) ( $ts + 4a , $x ) ( $ts + 5a , $x ) ( $ts + 6a , $x ) ( $ts + 7a , $x ) ( $ts + 8a , $x ) ( $ts + 9a , $x ) ( $ts + 10a , $x ) ( $ts + 11a , $x ) ( $ts + 12a , $x ) ( $ts + 13a , $x ) ( $ts + 14a , $x ) ( $ts + 15a , $x ) ( $ts + 16a , $x ) ( $ts + 17a , $x ) ( $ts + 18a , $x ) ( $ts + 19a , $x ) ( $ts + 20a , $x ) ( $ts + 21a , $x ) ( $ts + 22a , $x ) ( $ts + 23a , $x ) ( $ts + 24a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 35a , $x ) ( $ts + 36a , $x ) ( $ts + 37a , $x ) ( $ts + 38a , $x ) ( $ts + 39a , $x ) ( $ts + 40a , $x ) ( $ts + 41a , $x ) ( $ts + 42a , $x ) ( $ts + 43a , $x ) ( $ts + 44a , $x ) ( $ts + 45a , $x ) ( $ts + 46a , $x ) ( $ts + 47a , $x ) ( $ts + 48a , $x ) ( $ts + 49a , $x ) ( $ts + 50a , $x ) ( $ts + 51a , $x ) ( $ts + 52a , $x ) ( $ts + 53a , $x ) ( $ts + 54a , $x ) ( $ts + 55a , $x ) ( $ts + 56a , $x ) ( $ts + 57a , $x ) ( $ts + 58a , $x ) ( $ts + 59a , $x ) - $x = $x + 60 - endw - $totalRows = $totalRows + $x - print info: inserted $x rows into $tb and totalRows: $totalRows - $i = $i + 1 -endw - -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -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 select * from information_schema.ins_dnodes -if $rows != 5 then - sleep 2000 - goto wait_dnode4_offline_0 -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 -$dnode1Status = $data4_1 -$dnode2Status = $data4_2 -$dnode3Status = $data4_3 -$dnode4Status = $data4_4 - -if $dnode4Status != offline then - sleep 2000 - goto wait_dnode4_offline_0 -endi - -$loopCnt = 0 -wait_dnode4_vgroup_offline: -$loopCnt = $loopCnt + 1 -if $loopCnt == 10 then - return -1 -endi - -sql show vgroups -if $rows != 1 then - sleep 2000 - goto wait_dnode4_vgroup_offline -endi -print show vgroups: -print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 $data5_1 $data6_1 $data7_1 $data8_1 $data9_1 -print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 $data5_2 $data6_2 $data7_2 $data8_2 $data9_2 -print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3 $data5_3 $data6_3 $data7_3 $data8_3 $data9_3 -$dnode4Vtatus = $data5_2 -$dnode3Vtatus = $data7_2 - -if $dnode4Vtatus != offline then - sleep 2000 - goto wait_dnode4_vgroup_offline -endi -if $dnode3Vtatus != master then - sleep 2000 - goto wait_dnode4_vgroup_offline -endi - -system rm -rf ../../../sim/dnode4/data -#system rm -rf ../../../sim/dnode4/data/vnode/* - -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - -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 select * from information_schema.ins_dnodes -if $rows != 5 then - sleep 2000 - goto wait_dnode4_reready -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 -$dnode1Status = $data4_1 -$dnode2Status = $data4_2 -$dnode3Status = $data4_3 -$dnode4Status = $data4_4 - -if $dnode4Status != ready then - sleep 2000 - 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 - goto wait_dnode4_vgroup_slave -endi -print show vgroups: -print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 $data5_1 $data6_1 $data7_1 $data8_1 $data9_1 -print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 $data5_2 $data6_2 $data7_2 $data8_2 $data9_2 -print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3 $data5_3 $data6_3 $data7_3 $data8_3 $data9_3 -$dnode4Vtatus = $data5_2 -$dnode3Vtatus = $data7_2 - -print dnode4Vtatus: $dnode4Vtatus -print dnode3Vtatus: $dnode3Vtatus -if $dnode4Vtatus != slave then - sleep 2000 - goto wait_dnode4_vgroup_slave -endi -if $dnode3Vtatus != master then - sleep 2000 - goto wait_dnode4_vgroup_slave -endi - -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - -print ============== step5: stop dnode3/dnode2, and remove its vnode -system sh/exec.sh -n dnode2 -s stop -x SIGINT -system sh/exec.sh -n dnode3 -s stop -x SIGINT -sleep $sleepTimer - -$loopCnt = 0 -wait_dnode23_offline: -$loopCnt = $loopCnt + 1 -if $loopCnt == 10 then - return -1 -endi - -sql select * from information_schema.ins_dnodes -if $rows != 5 then - sleep 2000 - goto wait_dnode23_offline -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 -$dnode1Status = $data4_1 -$dnode2Status = $data4_2 -$dnode3Status = $data4_3 -$dnode4Status = $data4_4 - -if $dnode2Status != offline then - sleep 2000 - goto wait_dnode23_offline -endi -if $dnode3Status != offline then - sleep 2000 - goto wait_dnode23_offline -endi -if $dnode4Status != ready then - sleep 2000 - goto wait_dnode23_offline -endi - -system rm -rf ../../../sim/dnode2/data -system rm -rf ../../../sim/dnode3/data -#system rm -rf ../../../sim/dnode2/data/vnode/* -#system rm -rf ../../../sim/dnode3/data/vnode/* - -print ============== step6: restart dnode2/dnode3, and check rows -system sh/exec.sh -n dnode2 -s start -system sh/exec.sh -n dnode3 -s start -sleep $sleepTimer - -$loopCnt = 0 -wait_dnode23_reready: -$loopCnt = $loopCnt + 1 -if $loopCnt == 10 then - return -1 -endi - -sql select * from information_schema.ins_dnodes -if $rows != 5 then - sleep 2000 - goto wait_dnode23_reready -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 -$dnode1Status = $data4_1 -$dnode2Status = $data4_2 -$dnode3Status = $data4_3 -$dnode4Status = $data4_4 - -if $dnode2Status != ready then - sleep 2000 - goto wait_dnode23_reready -endi -if $dnode3Status != ready then - sleep 2000 - goto wait_dnode23_reready -endi -if $dnode4Status != ready then - sleep 2000 - goto wait_dnode23_reready -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 - goto wait_dnode4_vgroup_master -endi -print show vgroups: -print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 $data5_1 $data6_1 $data7_1 $data8_1 $data9_1 -print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 $data5_2 $data6_2 $data7_2 $data8_2 $data9_2 -print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3 $data5_3 $data6_3 $data7_3 $data8_3 $data9_3 -$dnode4Vtatus = $data5_2 -$dnode3Vtatus = $data7_2 - -print dnode4Vtatus: $dnode4Vtatus -print dnode3Vtatus: $dnode3Vtatus -if $dnode4Vtatus != master then - sleep 2000 - goto wait_dnode4_vgroup_master -endi -if $dnode3Vtatus != slave then - sleep 2000 - goto wait_dnode4_vgroup_master -endi - -# check using select -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - -sql insert into $tb values ( now , 20000 ) ( now + 1a, 20001 ) ( now + 2a, 20002 ) -$totalRows = $totalRows + 3 - -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - - -print ============== step7: stop dnode3/dnode2, and cluster unable to provide services -system sh/exec.sh -n dnode2 -s stop -x SIGINT -system sh/exec.sh -n dnode3 -s stop -x SIGINT -sleep 2000 -sql select count(*) from $stb -x s71 -s71: - -print ============== step8: restart dnode2, and cluster Still unable to provide services -system sh/exec.sh -n dnode2 -s start -sleep 2000 -sql select count(*) from $stb -x s81 -s81: - -print ============== step9: restart dnode3, and cluster Resume service delivery -system sh/exec.sh -n dnode3 -s start - -$loopCnt = 0 -wait_dnode4_vgroup_master_2: -$loopCnt = $loopCnt + 1 -if $loopCnt == 10 then - return -1 -endi - -sql show vgroups -if $rows != 1 then - sleep 2000 - goto wait_dnode4_vgroup_master_2 -endi -print show vgroups: -print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 $data5_1 $data6_1 $data7_1 $data8_1 $data9_1 -print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 $data5_2 $data6_2 $data7_2 $data8_2 $data9_2 -print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3 $data5_3 $data6_3 $data7_3 $data8_3 $data9_3 -$dnode4Vtatus = $data5_2 -$dnode3Vtatus = $data7_2 - -print dnode4Vtatus: $dnode4Vtatus -print dnode3Vtatus: $dnode3Vtatus -if $dnode4Vtatus != master then - sleep 2000 - goto wait_dnode4_vgroup_master_2 -endi -if $dnode3Vtatus != slave then - sleep 2000 - goto wait_dnode4_vgroup_master_2 -endi - -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi diff --git a/tests/script/tsim/backup/arbitrator/dn3_mn1_replica2_wal1_AddDelDnode.sim b/tests/script/tsim/backup/arbitrator/dn3_mn1_replica2_wal1_AddDelDnode.sim deleted file mode 100644 index ab144212e4..0000000000 --- a/tests/script/tsim/backup/arbitrator/dn3_mn1_replica2_wal1_AddDelDnode.sim +++ /dev/null @@ -1,367 +0,0 @@ -system sh/stop_dnodes.sh -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -system sh/deploy.sh -n dnode3 -i 3 -system sh/deploy.sh -n dnode4 -i 4 -system sh/deploy.sh -n dnode5 -i 5 - -system sh/cfg.sh -n dnode1 -c 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 -system sh/cfg.sh -n dnode3 -c walLevel -v 1 -system sh/cfg.sh -n dnode4 -c walLevel -v 1 -system sh/cfg.sh -n dnode5 -c walLevel -v 1 - -system sh/cfg.sh -n dnode1 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode2 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode3 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode4 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode5 -c balanceInterval -v 10 - -system sh/cfg.sh -n dnode1 -c maxVgroupsPerDb -v 16 -system sh/cfg.sh -n dnode2 -c maxVgroupsPerDb -v 16 -system sh/cfg.sh -n dnode3 -c maxVgroupsPerDb -v 16 -system sh/cfg.sh -n dnode4 -c maxVgroupsPerDb -v 16 -system sh/cfg.sh -n dnode5 -c maxVgroupsPerDb -v 16 - -system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 4 -system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v 4 -system sh/cfg.sh -n dnode3 -c maxtablesPerVnode -v 4 -system sh/cfg.sh -n dnode4 -c maxtablesPerVnode -v 4 -system sh/cfg.sh -n dnode5 -c maxtablesPerVnode -v 4 - -system sh/cfg.sh -n dnode1 -c mnodeEqualVnodeNum -v 200 -system sh/cfg.sh -n dnode2 -c mnodeEqualVnodeNum -v 200 -system sh/cfg.sh -n dnode3 -c mnodeEqualVnodeNum -v 200 -system sh/cfg.sh -n dnode4 -c mnodeEqualVnodeNum -v 200 -system sh/cfg.sh -n dnode5 -c mnodeEqualVnodeNum -v 200 - -system sh/cfg.sh -n dnode1 -c role -v 1 -system sh/cfg.sh -n dnode2 -c role -v 2 -system sh/cfg.sh -n dnode3 -c role -v 2 -system sh/cfg.sh -n dnode4 -c role -v 2 -system sh/cfg.sh -n dnode5 -c role -v 2 - -system sh/cfg.sh -n dnode1 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode2 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode3 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode4 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode5 -c arbitrator -v $arbitrator - -system sh/cfg.sh -n dnode1 -c offlineThreshold -v 10 -system sh/cfg.sh -n dnode2 -c offlineThreshold -v 10 -system sh/cfg.sh -n dnode3 -c offlineThreshold -v 10 -system sh/cfg.sh -n dnode4 -c offlineThreshold -v 10 -system sh/cfg.sh -n dnode5 -c offlineThreshold -v 10 - -system sh/cfg.sh -n dnode1 -c enableCoreFile -v 1 -system sh/cfg.sh -n dnode2 -c enableCoreFile -v 1 -system sh/cfg.sh -n dnode3 -c enableCoreFile -v 1 -system sh/cfg.sh -n dnode4 -c enableCoreFile -v 1 -system sh/cfg.sh -n dnode5 -c enableCoreFile -v 1 - -print ============== step0: start tarbitrator -system sh/exec_tarbitrator.sh -s start - -print ============== step1: start dnode1, only deploy mnode -system sh/exec.sh -n dnode1 -s start -sleep 2000 -sql connect - -print ============== step2: start dnode2/dnode3 and add into cluster, then create database replica 2, create table , and insert data -system sh/exec.sh -n dnode2 -s start -system sh/exec.sh -n dnode3 -s start -sql create dnode $hostname2 -sql create dnode $hostname3 -sleep 2000 - -$rowNum = 100 -$tblNum = 16 -$totalRows = 0 -$tsStart = 1420041600000 - -$db = db -sql create database $db replica 2 -sql use $db - -# create table , insert data -$stb = stb -sql create table $stb (ts timestamp, c1 int) tags(t1 int) - - -$i = 0 -while $i < $tblNum - $tb = tb . $i - sql create table $tb using $stb tags( $i ) - - $x = 0 - while $x < $rowNum - $ts = $tsStart + $x - sql insert into $tb values ( $ts + 0a , $x ) ( $ts + 1a , $x ) ( $ts + 2a , $x ) ( $ts + 3a , $x ) ( $ts + 4a , $x ) ( $ts + 5a , $x ) ( $ts + 6a , $x ) ( $ts + 7a , $x ) ( $ts + 8a , $x ) ( $ts + 9a , $x ) ( $ts + 10a , $x ) ( $ts + 11a , $x ) ( $ts + 12a , $x ) ( $ts + 13a , $x ) ( $ts + 14a , $x ) ( $ts + 15a , $x ) ( $ts + 16a , $x ) ( $ts + 17a , $x ) ( $ts + 18a , $x ) ( $ts + 19a , $x ) ( $ts + 20a , $x ) ( $ts + 21a , $x ) ( $ts + 22a , $x ) ( $ts + 23a , $x ) ( $ts + 24a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 35a , $x ) ( $ts + 36a , $x ) ( $ts + 37a , $x ) ( $ts + 38a , $x ) ( $ts + 39a , $x ) ( $ts + 40a , $x ) ( $ts + 41a , $x ) ( $ts + 42a , $x ) ( $ts + 43a , $x ) ( $ts + 44a , $x ) ( $ts + 45a , $x ) ( $ts + 46a , $x ) ( $ts + 47a , $x ) ( $ts + 48a , $x ) ( $ts + 49a , $x ) ( $ts + 50a , $x ) ( $ts + 51a , $x ) ( $ts + 52a , $x ) ( $ts + 53a , $x ) ( $ts + 54a , $x ) ( $ts + 55a , $x ) ( $ts + 56a , $x ) ( $ts + 57a , $x ) ( $ts + 58a , $x ) ( $ts + 59a , $x ) - $x = $x + 60 - endw - $totalRows = $totalRows + $x - print info: inserted $x rows into $tb and totalRows: $totalRows - $i = $i + 1 -endw - -print info: select count(*) from $stb -sleep 1000 -sql reset query cache -sleep 1000 -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - -print ============== step3: add one new dnode4 expect auto balancing -system sh/exec.sh -n dnode4 -s start -sql create dnode $hostname4 -sleep 10000 -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - - -print ============== step4: stop dnode3, after offlineThreshold, dnode3 will be dropped for cluster -system sh/exec.sh -n dnode3 -s stop -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - -#sleep 2000 -#sql select * from information_schema.ins_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 -# -#$dnode1Status = $data4_1 -#$dnode2Status = $data4_2 -#$dnode3Status = $data4_3 -#$dnode4Status = $data4_4 -# -#if $dnode1Status != ready then -# return -1 -#endi -#if $dnode2Status != ready then -# return -1 -#endi -#if $dnode3Status != offline then -# return -1 -#endi -#if $dnode4Status != ready then -# return -1 -#endi - -sleep 15000 - -$loopCnt = 0 -wait_drop: -$loopCnt = $loopCnt + 1 -if $loopCnt == 10 then - return -1 -endi - -sql select * from information_schema.ins_dnodes -if $rows != 3 then - sleep 2000 - goto wait_drop -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 -$dnode1Status = $data4_1 -$dnode2Status = $data4_2 -$dnode3Status = $data4_3 -$dnode4Status = $data4_4 - -if $dnode1Status != ready then - return -1 -endi -if $dnode2Status != ready then - return -1 -endi -if $dnode3Status != null then - return -1 -endi -if $dnode4Status != ready then - return -1 -endi - -print ============== step4-1: restart dnode3, adn add into cluster -system rm -rf ../../../sim/dnode3 -sleep 1000 - -system sh/deploy.sh -n dnode3 -i 3 -system sh/cfg.sh -n dnode3 -c numOfMnodes -v 1 -system sh/cfg.sh -n dnode3 -c walLevel -v 1 -system sh/cfg.sh -n dnode3 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode3 -c maxtablesPerVnode -v 4 -system sh/cfg.sh -n dnode3 -c mnodeEqualVnodeNum -v 200 -system sh/cfg.sh -n dnode3 -c role -v 2 -system sh/cfg.sh -n dnode3 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode3 -c offlineThreshold -v 10 -system sh/cfg.sh -n dnode3 -c enableCoreFile -v 1 -system sh/cfg.sh -n dnode3 -c maxVgroupsPerDb -v 16 - -system sh/exec.sh -n dnode3 -s start -sql create dnode $hostname3 -sleep 2000 - -$loopCnt = 0 -wait_dnode3_ready: -$loopCnt = $loopCnt + 1 -if $loopCnt == 10 then - return -1 -endi - -sql select * from information_schema.ins_dnodes -print rows: $rows -if $rows != 4 then - sleep 2000 - goto wait_dnode3_ready -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 -$dnode1Status = $data4_1 -$dnode2Status = $data4_2 -$dnode3Status = $data4_3 -$dnode4Status = $data4_4 -$dnode5Status = $data4_5 - -if $dnode1Status != ready then - goto wait_dnode3_ready -endi -if $dnode2Status != ready then - goto wait_dnode3_ready -endi -if $dnode3Status != null then - goto wait_dnode3_ready -endi -if $dnode4Status != ready then - goto wait_dnode3_ready -endi -if $dnode5Status != ready then - goto wait_dnode3_ready -endi - -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - -print ============== step5: start dnode5 and add into cluster , drop database -sql drop database $db -sleep 1000 -system sh/exec.sh -n dnode5 -s start -sql create dnode $hostname5 -sleep 2000 -$loopCnt = 0 -wait_dnode5: -$loopCnt = $loopCnt + 1 -if $loopCnt == 10 then - return -1 -endi - -sql select * from information_schema.ins_dnodes -if $rows != 5 then - sleep 2000 - goto wait_dnode5 -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 -$dnode1Status = $data4_1 -$dnode2Status = $data4_2 -$dnode4Status = $data4_4 -$dnode5Status = $data4_5 -$dnode6Status = $data4_6 - -if $dnode1Status != ready then - goto wait_dnode5 -endi -if $dnode2Status != ready then - goto wait_dnode5 -endi -if $dnode3Status != null then - goto wait_dnode5 -endi -if $dnode4Status != ready then - goto wait_dnode5 -endi -if $dnode5Status != ready then - goto wait_dnode5 -endi -if $dnode6Status != ready then - goto wait_dnode5 -endi - -print ============== step6: create database and table until not free vnodes -$rowNum = 100 -$tblNum = 32 -$totalRows = 0 -$tsStart = 1420041600000 - -$db = db1 -sql create database $db replica 2 -sql use $db -$stb = stb -sql create table $stb (ts timestamp, c1 int) tags(t1 int) - - -# create table , insert data -$stb = stb -sql create table $stb (ts timestamp, c1 int) tags(t1 int) - - -$i = 0 -while $i < $tblNum - $tb = tb . $i - sql create table $tb using $stb tags( $i ) - - $x = 0 - while $x < $rowNum - $ts = $tsStart + $x - sql insert into $tb values ( $ts + 0a , $x ) ( $ts + 1a , $x ) ( $ts + 2a , $x ) ( $ts + 3a , $x ) ( $ts + 4a , $x ) ( $ts + 5a , $x ) ( $ts + 6a , $x ) ( $ts + 7a , $x ) ( $ts + 8a , $x ) ( $ts + 9a , $x ) ( $ts + 10a , $x ) ( $ts + 11a , $x ) ( $ts + 12a , $x ) ( $ts + 13a , $x ) ( $ts + 14a , $x ) ( $ts + 15a , $x ) ( $ts + 16a , $x ) ( $ts + 17a , $x ) ( $ts + 18a , $x ) ( $ts + 19a , $x ) ( $ts + 20a , $x ) ( $ts + 21a , $x ) ( $ts + 22a , $x ) ( $ts + 23a , $x ) ( $ts + 24a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 35a , $x ) ( $ts + 36a , $x ) ( $ts + 37a , $x ) ( $ts + 38a , $x ) ( $ts + 39a , $x ) ( $ts + 40a , $x ) ( $ts + 41a , $x ) ( $ts + 42a , $x ) ( $ts + 43a , $x ) ( $ts + 44a , $x ) ( $ts + 45a , $x ) ( $ts + 46a , $x ) ( $ts + 47a , $x ) ( $ts + 48a , $x ) ( $ts + 49a , $x ) ( $ts + 50a , $x ) ( $ts + 51a , $x ) ( $ts + 52a , $x ) ( $ts + 53a , $x ) ( $ts + 54a , $x ) ( $ts + 55a , $x ) ( $ts + 56a , $x ) ( $ts + 57a , $x ) ( $ts + 58a , $x ) ( $ts + 59a , $x ) - $x = $x + 60 - endw - $totalRows = $totalRows + $x - print info: inserted $x rows into $tb and totalRows: $totalRows - $i = $i + 1 -endw - -print info: select count(*) from $stb -sleep 2000 -sql reset query cache -sleep 2000 -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - -print ============== step7: drop dnode $hostname5, system should prompt "DB error: no enough dnodes" -sql_error drop dnode $hostname5 -print error: $error -print ============== step8: create table tb_more using $stb tags( 1000 ), system should prompt 'DB error: no enough dnodes' -sql_error create table tb_more using $stb tags( 1000 ) -print error: $error diff --git a/tests/script/tsim/backup/arbitrator/dn3_mn1_replica_change.sim b/tests/script/tsim/backup/arbitrator/dn3_mn1_replica_change.sim deleted file mode 100644 index 7ebba54418..0000000000 --- a/tests/script/tsim/backup/arbitrator/dn3_mn1_replica_change.sim +++ /dev/null @@ -1,358 +0,0 @@ -system sh/stop_dnodes.sh -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -system sh/deploy.sh -n dnode3 -i 3 -system sh/deploy.sh -n dnode4 -i 4 - -system sh/cfg.sh -n dnode1 -c 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 dnode1 -c walLevel -v 2 -system sh/cfg.sh -n dnode2 -c walLevel -v 2 -system sh/cfg.sh -n dnode3 -c walLevel -v 2 -system sh/cfg.sh -n dnode4 -c walLevel -v 2 - -system sh/cfg.sh -n dnode1 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode2 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode3 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode4 -c balanceInterval -v 10 - -system sh/cfg.sh -n dnode1 -c role -v 1 -system sh/cfg.sh -n dnode2 -c role -v 2 -system sh/cfg.sh -n dnode3 -c role -v 2 -system sh/cfg.sh -n dnode4 -c role -v 2 - -$totalTableNum = 10 -system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v $totalTableNum -system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v $totalTableNum -system sh/cfg.sh -n dnode3 -c maxtablesPerVnode -v $totalTableNum -system sh/cfg.sh -n dnode4 -c maxtablesPerVnode -v $totalTableNum - -system sh/cfg.sh -n dnode1 -c maxVgroupsPerDb -v 1 -system sh/cfg.sh -n dnode2 -c maxVgroupsPerDb -v 1 -system sh/cfg.sh -n dnode3 -c maxVgroupsPerDb -v 1 -system sh/cfg.sh -n dnode4 -c maxVgroupsPerDb -v 1 - -system sh/cfg.sh -n dnode1 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode2 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode3 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode4 -c arbitrator -v $arbitrator - -print ============== step0: start tarbitrator -system sh/exec_tarbitrator.sh -s start - -print ============== step1: start dnode1, only deploy mnode -system sh/exec.sh -n dnode1 -s start -sql connect - -print ============== step2: start dnode2 and add into cluster , then create database with replica 1, and create table, insert data -system sh/exec.sh -n dnode2 -s start -sql create dnode $hostname2 - -$x = 0 -step1: - $x = $x + 1 - sleep 1000 - if $x == 40 then - return -1 - endi - -sql select * from information_schema.ins_dnodes -print dnode1 $data4_1 -print dnode2 $data4_2 - -if $data4_1 != ready then - goto step1 -endi -if $data4_2 != ready then - goto step1 -endi - -$db = db -sql create database $db replica 1 -sql use $db - -# create table , insert data -$stb = stb -sql create table $stb (ts timestamp, c1 int) tags(t1 int) -$rowNum = 100 -$tblNum = $totalTableNum -$totalRows = 0 -$tsStart = 1420041600000 - -$i = 0 -while $i < $tblNum - $tb = tb . $i - sql create table $tb using $stb tags( $i ) - - $x = 0 - while $x < $rowNum - $ts = $tsStart + $x - sql insert into $tb values ( $ts + 0a , $x ) ( $ts + 1a , $x ) ( $ts + 2a , $x ) ( $ts + 3a , $x ) ( $ts + 4a , $x ) ( $ts + 5a , $x ) ( $ts + 6a , $x ) ( $ts + 7a , $x ) ( $ts + 8a , $x ) ( $ts + 9a , $x ) ( $ts + 10a , $x ) ( $ts + 11a , $x ) ( $ts + 12a , $x ) ( $ts + 13a , $x ) ( $ts + 14a , $x ) ( $ts + 15a , $x ) ( $ts + 16a , $x ) ( $ts + 17a , $x ) ( $ts + 18a , $x ) ( $ts + 19a , $x ) ( $ts + 20a , $x ) ( $ts + 21a , $x ) ( $ts + 22a , $x ) ( $ts + 23a , $x ) ( $ts + 24a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 35a , $x ) ( $ts + 36a , $x ) ( $ts + 37a , $x ) ( $ts + 38a , $x ) ( $ts + 39a , $x ) ( $ts + 40a , $x ) ( $ts + 41a , $x ) ( $ts + 42a , $x ) ( $ts + 43a , $x ) ( $ts + 44a , $x ) ( $ts + 45a , $x ) ( $ts + 46a , $x ) ( $ts + 47a , $x ) ( $ts + 48a , $x ) ( $ts + 49a , $x ) ( $ts + 50a , $x ) ( $ts + 51a , $x ) ( $ts + 52a , $x ) ( $ts + 53a , $x ) ( $ts + 54a , $x ) ( $ts + 55a , $x ) ( $ts + 56a , $x ) ( $ts + 57a , $x ) ( $ts + 58a , $x ) ( $ts + 59a , $x ) - $x = $x + 60 - endw - $totalRows = $totalRows + $x - print info: inserted $x rows into $tb and totalRows: $totalRows - $i = $i + 1 -endw - -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - -print ============== step2-1: stop dnode2 for falling disc, then restart dnode2, and check rows -system sh/exec.sh -n dnode2 -s stop -x SIGINT -system sh/exec.sh -n dnode2 -s start - -$x = 0 -a0: - $x = $x + 1 - sleep 1000 - if $x == 40 then - return -1 - endi - -sql show vgroups -print online vnodes $data03 -if $data03 != 1 then - goto a0 -endi - -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - -print ============== step3: start dnode3 and add into cluster , then alter replica from 1 to 2, and waiting sync -system sh/exec.sh -n dnode3 -s start -sql create dnode $hostname3 - -$x = 0 -step2: - $x = $x + 1 - sleep 1000 - if $x == 40 then - return -1 - endi - -sql select * from information_schema.ins_dnodes -print dnode1 $data4_1 -print dnode2 $data4_2 -print dnode3 $data4_3 - -if $data4_3 != ready then - goto step2 -endi - -sql alter database $db replica 2 - -$x = 0 -a1: - $x = $x + 1 - sleep 1000 - if $x == 40 then - return -1 - endi - -sql show vgroups -print online vnodes $data03 -if $data03 != 2 then - goto a1 -endi - -# check using select -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - -print ============== step4: stop dnode2 for checking if sync ok -system sh/exec.sh -n dnode2 -s stop -$x = 0 -a2: - $x = $x + 1 - sleep 1000 - if $x == 40 then - return -1 - endi - -sql show vgroups -print online vnodes $data03 -if $data03 != 1 then - goto a2 -endi - -# check using select -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - -print ============== step5: restart dnode2 -system sh/exec.sh -n dnode2 -s start -$x = 0 -a3: - $x = $x + 1 - sleep 1000 - if $x == 40 then - return -1 - endi - -sql show vgroups -print online vnodes $data03 -if $data03 != 2 then - goto a3 -endi - -# check using select -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - -print ============== step6: start dnode4 and add into cluster , then alter replica from 2 to 3, and waiting sync -system sh/exec.sh -n dnode4 -s start -sql create dnode $hostname4 -$x = 0 -step6: - $x = $x + 1 - sleep 1000 - if $x == 10 then - return -1 - endi - -sql select * from information_schema.ins_dnodes -print dnode1 $data4_1 -print dnode2 $data4_2 -print dnode3 $data4_3 -print dnode4 $data4_4 - -if $data4_4 != ready then - goto step6 -endi - -sql alter database $db replica 3 -$x = 0 -a4: - $x = $x + 1 - sleep 1000 - if $x == 40 then - return -1 - endi - -sql show vgroups -print online vnodes $data03 -if $data03 != 3 then - goto a4 -endi - -# check using select -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - -print ============== step7: alter replica from 3 to 2, and waiting sync -sql alter database $db replica 2 -$x = 0 -a5: - $x = $x + 1 - sleep 1000 - if $x == 40 then - return -1 - endi - -sql show vgroups -print online vnodes $data03 -if $data03 != 2 then - goto a5 -endi - -# check using select -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - -print ============== step8: alter replica from 2 to 1, and waiting sync -sql alter database $db replica 1 -$x = 0 -a6: - $x = $x + 1 - sleep 1000 - if $x == 40 then - return -1 - endi - -sql show vgroups -print online vnodes $data03 -if $data03 != 1 then - goto a6 -endi - -# check using select -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - -print ============== step9: drop dnode2/dnode3 -sql drop dnode $hostname2 -sql drop dnode $hostname3 -sleep $sleepTimer - -$x = 0 -step9: - $x = $x + 1 - sleep 1000 - if $x == 40 then - return -1 - endi - -sql select * from information_schema.ins_dnodes -if $rows != 3 then - goto step9 -endi - -$x = 0 -a7: - $x = $x + 1 - sleep 1000 - if $x == 40 then - return -1 - endi - -sql show vgroups -print online vnodes $data03 -if $data03 != 1 then - goto a7 -endi - -sleep $sleepTimer #waiting move vnode from dnode3/dnode3 to dnode4 -# check using select -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - - -system sh/exec.sh -n dnode1 -s stop -x SIGINT -system sh/exec.sh -n dnode2 -s stop -x SIGINT -system sh/exec.sh -n dnode3 -s stop -x SIGINT -system sh/exec.sh -n dnode4 -s stop -x SIGINT -system sh/exec.sh -n dnode5 -s stop -x SIGINT -system sh/exec.sh -n dnode6 -s stop -x SIGINT -system sh/exec.sh -n dnode7 -s stop -x SIGINT -system sh/exec.sh -n dnode8 -s stop -x SIGINT diff --git a/tests/script/tsim/backup/arbitrator/dn3_mn1_replica_change_dropDnod.sim b/tests/script/tsim/backup/arbitrator/dn3_mn1_replica_change_dropDnod.sim deleted file mode 100644 index 31040ef0a1..0000000000 --- a/tests/script/tsim/backup/arbitrator/dn3_mn1_replica_change_dropDnod.sim +++ /dev/null @@ -1,150 +0,0 @@ -system sh/stop_dnodes.sh -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -system sh/deploy.sh -n dnode3 -i 3 -system sh/deploy.sh -n dnode4 -i 4 - -system sh/cfg.sh -n dnode1 -c 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 dnode1 -c walLevel -v 2 -system sh/cfg.sh -n dnode2 -c walLevel -v 2 -system sh/cfg.sh -n dnode3 -c walLevel -v 2 -system sh/cfg.sh -n dnode4 -c walLevel -v 2 - -system sh/cfg.sh -n dnode1 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode2 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode3 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode4 -c balanceInterval -v 10 - -system sh/cfg.sh -n dnode1 -c role -v 1 -system sh/cfg.sh -n dnode2 -c role -v 2 -system sh/cfg.sh -n dnode3 -c role -v 2 -system sh/cfg.sh -n dnode4 -c role -v 2 - -$totalTableNum = 10 -system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v $totalTableNum -system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v $totalTableNum -system sh/cfg.sh -n dnode3 -c maxtablesPerVnode -v $totalTableNum -system sh/cfg.sh -n dnode4 -c maxtablesPerVnode -v $totalTableNum - -system sh/cfg.sh -n dnode1 -c maxVgroupsPerDb -v 1 -system sh/cfg.sh -n dnode2 -c maxVgroupsPerDb -v 1 -system sh/cfg.sh -n dnode3 -c maxVgroupsPerDb -v 1 -system sh/cfg.sh -n dnode4 -c maxVgroupsPerDb -v 1 - -system sh/cfg.sh -n dnode1 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode2 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode3 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode4 -c arbitrator -v $arbitrator - -print ============== step0: start tarbitrator -system sh/exec_tarbitrator.sh -s start - -print ============== step1: start dnode1, only deploy mnode -system sh/exec.sh -n dnode1 -s start -sleep 2000 -sql connect - -print ============== step2: start dnode2/dnode3/dnode4 and add into cluster , then create database with replica 2, and create table, insert data -system sh/exec.sh -n dnode2 -s start -system sh/exec.sh -n dnode3 -s start -system sh/exec.sh -n dnode4 -s start -sql create dnode $hostname2 -sql create dnode $hostname3 -sql create dnode $hostname4 -sleep 2000 - -$totalTableNum = 10 -$sleepTimer = 10000 - -$db = db -sql create database $db replica 2 -sql use $db - -# create table , insert data -$stb = stb -sql create table $stb (ts timestamp, c1 int) tags(t1 int) -$rowNum = 100 -$tblNum = $totalTableNum -$totalRows = 0 -$tsStart = 1420041600000 - -$i = 0 -while $i < $tblNum - $tb = tb . $i - sql create table $tb using $stb tags( $i ) - - $x = 0 - while $x < $rowNum - $ts = $tsStart + $x - sql insert into $tb values ( $ts + 0a , $x ) ( $ts + 1a , $x ) ( $ts + 2a , $x ) ( $ts + 3a , $x ) ( $ts + 4a , $x ) ( $ts + 5a , $x ) ( $ts + 6a , $x ) ( $ts + 7a , $x ) ( $ts + 8a , $x ) ( $ts + 9a , $x ) ( $ts + 10a , $x ) ( $ts + 11a , $x ) ( $ts + 12a , $x ) ( $ts + 13a , $x ) ( $ts + 14a , $x ) ( $ts + 15a , $x ) ( $ts + 16a , $x ) ( $ts + 17a , $x ) ( $ts + 18a , $x ) ( $ts + 19a , $x ) ( $ts + 20a , $x ) ( $ts + 21a , $x ) ( $ts + 22a , $x ) ( $ts + 23a , $x ) ( $ts + 24a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 35a , $x ) ( $ts + 36a , $x ) ( $ts + 37a , $x ) ( $ts + 38a , $x ) ( $ts + 39a , $x ) ( $ts + 40a , $x ) ( $ts + 41a , $x ) ( $ts + 42a , $x ) ( $ts + 43a , $x ) ( $ts + 44a , $x ) ( $ts + 45a , $x ) ( $ts + 46a , $x ) ( $ts + 47a , $x ) ( $ts + 48a , $x ) ( $ts + 49a , $x ) ( $ts + 50a , $x ) ( $ts + 51a , $x ) ( $ts + 52a , $x ) ( $ts + 53a , $x ) ( $ts + 54a , $x ) ( $ts + 55a , $x ) ( $ts + 56a , $x ) ( $ts + 57a , $x ) ( $ts + 58a , $x ) ( $ts + 59a , $x ) - $x = $x + 60 - endw - $totalRows = $totalRows + $x - print info: inserted $x rows into $tb and totalRows: $totalRows - $i = $i + 1 -endw - -sql select count(*) from $stb -sleep 1000 -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - -print ============== step3: drop dnode4, then check rows -#system sh/exec.sh -n dnode4 -s stop -x SIGINT -sql drop dnode $hostname4 -sleep $sleepTimer -$loopCnt = 0 -wait_dnode4_dropped: -$loopCnt = $loopCnt + 1 -if $loopCnt == 10 then - return -1 -endi - -sql select * from information_schema.ins_dnodes -if $rows != 4 then - sleep 2000 - goto wait_dnode4_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 -#$dnode1Status = $data4_1 -$dnode2Status = $data4_2 -$dnode3Status = $data4_3 -$dnode4Status = $data4_4 -#$dnode5Status = $data4_5 - -if $dnode2Status != ready then - sleep 2000 - goto wait_dnode4_dropped -endi -if $dnode3Status != ready then - sleep 2000 - goto wait_dnode4_dropped -endi - -sql reset query cache -sql select count(*) from $stb -sleep 1000 -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - -system sh/exec.sh -n dnode1 -s stop -x SIGINT -system sh/exec.sh -n dnode2 -s stop -x SIGINT -system sh/exec.sh -n dnode3 -s stop -x SIGINT -system sh/exec.sh -n dnode4 -s stop -x SIGINT -system sh/exec.sh -n dnode5 -s stop -x SIGINT -system sh/exec.sh -n dnode6 -s stop -x SIGINT -system sh/exec.sh -n dnode7 -s stop -x SIGINT -system sh/exec.sh -n dnode8 -s stop -x SIGINT diff --git a/tests/script/tsim/backup/arbitrator/dn3_mn1_stopDnode_timeout.sim b/tests/script/tsim/backup/arbitrator/dn3_mn1_stopDnode_timeout.sim deleted file mode 100644 index b9e92563ff..0000000000 --- a/tests/script/tsim/backup/arbitrator/dn3_mn1_stopDnode_timeout.sim +++ /dev/null @@ -1,222 +0,0 @@ -system sh/stop_dnodes.sh -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -system sh/deploy.sh -n dnode3 -i 3 -system sh/deploy.sh -n dnode4 -i 4 - -system sh/cfg.sh -n dnode1 -c 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 dnode1 -c walLevel -v 1 -system sh/cfg.sh -n dnode2 -c walLevel -v 1 -system sh/cfg.sh -n dnode3 -c walLevel -v 1 -system sh/cfg.sh -n dnode4 -c walLevel -v 1 - -system sh/cfg.sh -n dnode1 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode2 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode3 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode4 -c balanceInterval -v 10 - - -system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 4 -system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v 4 -system sh/cfg.sh -n dnode3 -c maxtablesPerVnode -v 4 -system sh/cfg.sh -n dnode4 -c maxtablesPerVnode -v 4 - -system sh/cfg.sh -n dnode1 -c role -v 1 -system sh/cfg.sh -n dnode2 -c role -v 2 -system sh/cfg.sh -n dnode3 -c role -v 2 -system sh/cfg.sh -n dnode4 -c role -v 2 - -system sh/cfg.sh -n dnode1 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode2 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode3 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode4 -c arbitrator -v $arbitrator - -system sh/cfg.sh -n dnode1 -c offlineThreshold -v 5 -system sh/cfg.sh -n dnode2 -c offlineThreshold -v 5 -system sh/cfg.sh -n dnode3 -c offlineThreshold -v 5 -system sh/cfg.sh -n dnode4 -c offlineThreshold -v 5 - -system sh/cfg.sh -n dnode1 -c enableCoreFile -v 1 -system sh/cfg.sh -n dnode2 -c enableCoreFile -v 1 -system sh/cfg.sh -n dnode3 -c enableCoreFile -v 1 -system sh/cfg.sh -n dnode4 -c enableCoreFile -v 1 - -print ============== step0: start tarbitrator -system sh/exec_tarbitrator.sh -s start - -print ============== step1: start dnode1, only deploy mnode -system sh/exec.sh -n dnode1 -s start -sleep 2000 -sql connect - -print ============== step2: start dnode2/dnode3 and add into cluster, then create database, create table , and insert data -system sh/exec.sh -n dnode2 -s start -system sh/exec.sh -n dnode3 -s start -system sh/exec.sh -n dnode4 -s start -sql create dnode $hostname2 -sql create dnode $hostname3 -sql create dnode $hostname4 -sleep 2000 - -$rowNum = 10 -$tblNum = 16 -$totalRows = 0 -$tsStart = 1420041600000 - -$db = db -sql create database $db replica 2 -sql use $db - -# create table , insert data -$stb = stb -sql create table $stb (ts timestamp, c1 int) tags(t1 int) - - -$i = 0 -while $i < $tblNum - $tb = tb . $i - sql create table $tb using $stb tags( $i ) - - $x = 0 - while $x < $rowNum - $ts = $tsStart + $x - sql insert into $tb values ( $ts + 0a , $x ) ( $ts + 1a , $x ) ( $ts + 2a , $x ) ( $ts + 3a , $x ) ( $ts + 4a , $x ) ( $ts + 5a , $x ) ( $ts + 6a , $x ) ( $ts + 7a , $x ) ( $ts + 8a , $x ) ( $ts + 9a , $x ) - $x = $x + 10 - endw - $totalRows = $totalRows + $x - print info: inserted $x rows into $tb and totalRows: $totalRows - $i = $i + 1 -endw - -print info: select count(*) from $stb -sleep 1000 -sql reset query cache -sleep 1000 -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - -sql select * from information_schema.ins_dnodes -if $rows != 4 then - return -1 -endi - -print ============== step3: stop dnode4, after timerout dnode4 will be auto-dropped. -system sh/exec.sh -n dnode4 -s stop -sleep 12000 - -$loopCnt = 0 -wait_dnode4_dropped: -$loopCnt = $loopCnt + 1 -if $loopCnt == 10 then - return -1 -endi - -sql select * from information_schema.ins_dnodes -if $rows != 3 then - sleep 2000 - goto wait_dnode4_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 -#$dnode1Status = $data4_1 -$dnode2Status = $data4_2 -$dnode3Status = $data4_3 -$dnode4Status = $data4_4 -#$dnode5Status = $data4_5 - -if $dnode2Status != ready then - sleep 2000 - goto wait_dnode4_dropped -endi -if $dnode3Status != ready then - sleep 2000 - goto wait_dnode4_dropped -endi - -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - -print ============== step4: restart dnode4, but there are not dnode4 in cluster -system sh/exec.sh -n dnode4 -s start -sleep 2000 -sql select * from information_schema.ins_dnodes -if $rows != 3 then - return -1 -endi - -print ============== step5: recreate dnode4 into cluster, result should fail -sql create dnode $hostname4 -sleep 12000 -sql select * from information_schema.ins_dnodes -if $rows != 3 then - return -1 -endi - -print ============== step5: remove dnode4 director, then recreate dnode4 into cluster, result should ok -system sh/exec.sh -n dnode4 -s stop -system rm -rf ../../../sim/dnode4 - -system sh/deploy.sh -n dnode4 -i 4 -system sh/cfg.sh -n dnode4 -c numOfMnodes -v 1 -system sh/cfg.sh -n dnode4 -c walLevel -v 1 -system sh/cfg.sh -n dnode4 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode4 -c maxtablesPerVnode -v 4 -system sh/cfg.sh -n dnode4 -c role -v 2 -system sh/cfg.sh -n dnode4 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode4 -c offlineThreshold -v 5 -system sh/cfg.sh -n dnode4 -c enableCoreFile -v 1 - -system sh/exec.sh -n dnode4 -s start -sql create dnode $hostname4 -sleep 6000 - -$loopCnt = 0 -wait_dnode4_ready: -$loopCnt = $loopCnt + 1 -if $loopCnt == 10 then - return -1 -endi - -sql select * from information_schema.ins_dnodes -if $rows != 4 then - sleep 2000 - goto wait_dnode4_ready -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 -#$dnode1Status = $data4_1 -$dnode2Status = $data4_2 -$dnode3Status = $data4_3 -$dnode4Status = $data4_6 -#$dnode5Status = $data4_5 - -if $dnode2Status != ready then - sleep 2000 - goto wait_dnode4_ready -endi -if $dnode3Status != ready then - sleep 2000 - goto wait_dnode4_ready -endi -if $dnode4Status != ready then - sleep 2000 - goto wait_dnode4_ready -endi diff --git a/tests/script/tsim/backup/arbitrator/dn3_mn1_vnode_change.sim b/tests/script/tsim/backup/arbitrator/dn3_mn1_vnode_change.sim deleted file mode 100644 index 5477ef3580..0000000000 --- a/tests/script/tsim/backup/arbitrator/dn3_mn1_vnode_change.sim +++ /dev/null @@ -1,319 +0,0 @@ -system sh/stop_dnodes.sh -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -system sh/deploy.sh -n dnode3 -i 3 -system sh/deploy.sh -n dnode4 -i 4 - -system sh/cfg.sh -n dnode1 -c 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 dnode1 -c walLevel -v 2 -system sh/cfg.sh -n dnode2 -c walLevel -v 2 -system sh/cfg.sh -n dnode3 -c walLevel -v 2 -system sh/cfg.sh -n dnode4 -c walLevel -v 2 - -system sh/cfg.sh -n dnode1 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode2 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode3 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode4 -c balanceInterval -v 10 - -system sh/cfg.sh -n dnode1 -c role -v 1 -system sh/cfg.sh -n dnode2 -c role -v 2 -system sh/cfg.sh -n dnode3 -c role -v 2 -system sh/cfg.sh -n dnode4 -c role -v 2 - -$totalTableNum = 10 -system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v $totalTableNum -system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v $totalTableNum -system sh/cfg.sh -n dnode3 -c maxtablesPerVnode -v $totalTableNum -system sh/cfg.sh -n dnode4 -c maxtablesPerVnode -v $totalTableNum - -system sh/cfg.sh -n dnode1 -c maxVgroupsPerDb -v 1 -system sh/cfg.sh -n dnode2 -c maxVgroupsPerDb -v 1 -system sh/cfg.sh -n dnode3 -c maxVgroupsPerDb -v 1 -system sh/cfg.sh -n dnode4 -c maxVgroupsPerDb -v 1 - -system sh/cfg.sh -n dnode1 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode2 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode3 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode4 -c arbitrator -v $arbitrator - -print ============== step0: start tarbitrator -system sh/exec_tarbitrator.sh -s start - -print ============== step1: start dnode1, only deploy mnode -system sh/exec.sh -n dnode1 -s start -sleep 2000 -sql connect - -print ============== step2: start dnode2/dnode3/dnode4 and add into cluster , then create database with replica 2, and create table, insert data -system sh/exec.sh -n dnode2 -s start -system sh/exec.sh -n dnode3 -s start -system sh/exec.sh -n dnode4 -s start -sql create dnode $hostname2 -sql create dnode $hostname3 -sql create dnode $hostname4 -sleep 2000 - -$totalTableNum = 10 -$sleepTimer = 3000 - -$db = db -sql create database $db replica 2 -sql use $db - -# create table , insert data -$stb = stb -sql create table $stb (ts timestamp, c1 int) tags(t1 int) -$rowNum = 100 -$tblNum = $totalTableNum -$totalRows = 0 -$tsStart = 1420041600000 - -$i = 0 -while $i < $tblNum - $tb = tb . $i - sql create table $tb using $stb tags( $i ) - - $x = 0 - while $x < $rowNum - $ts = $tsStart + $x - sql insert into $tb values ( $ts + 0a , $x ) ( $ts + 1a , $x ) ( $ts + 2a , $x ) ( $ts + 3a , $x ) ( $ts + 4a , $x ) ( $ts + 5a , $x ) ( $ts + 6a , $x ) ( $ts + 7a , $x ) ( $ts + 8a , $x ) ( $ts + 9a , $x ) ( $ts + 10a , $x ) ( $ts + 11a , $x ) ( $ts + 12a , $x ) ( $ts + 13a , $x ) ( $ts + 14a , $x ) ( $ts + 15a , $x ) ( $ts + 16a , $x ) ( $ts + 17a , $x ) ( $ts + 18a , $x ) ( $ts + 19a , $x ) ( $ts + 20a , $x ) ( $ts + 21a , $x ) ( $ts + 22a , $x ) ( $ts + 23a , $x ) ( $ts + 24a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 35a , $x ) ( $ts + 36a , $x ) ( $ts + 37a , $x ) ( $ts + 38a , $x ) ( $ts + 39a , $x ) ( $ts + 40a , $x ) ( $ts + 41a , $x ) ( $ts + 42a , $x ) ( $ts + 43a , $x ) ( $ts + 44a , $x ) ( $ts + 45a , $x ) ( $ts + 46a , $x ) ( $ts + 47a , $x ) ( $ts + 48a , $x ) ( $ts + 49a , $x ) ( $ts + 50a , $x ) ( $ts + 51a , $x ) ( $ts + 52a , $x ) ( $ts + 53a , $x ) ( $ts + 54a , $x ) ( $ts + 55a , $x ) ( $ts + 56a , $x ) ( $ts + 57a , $x ) ( $ts + 58a , $x ) ( $ts + 59a , $x ) - $x = $x + 60 - endw - $totalRows = $totalRows + $x - print info: inserted $x rows into $tb and totalRows: $totalRows - $i = $i + 1 -endw - -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - -sql select * from information_schema.ins_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 ============== step3: stop dnode4, then destroy the contents of its data file -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 select * from information_schema.ins_dnodes -if $rows != 4 then - sleep 2000 - goto wait_dnode4_offline_0 -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 -$dnode1Status = $data4_1 -$dnode2Status = $data4_2 -$dnode3Status = $data4_3 -$dnode4Status = $data4_4 - -if $dnode4Status != offline then - sleep 2000 - goto wait_dnode4_offline_0 -endi - -wait_dnode4_vgroup_offline: -sql show vgroups -if $rows != 1 then - sleep 2000 - goto wait_dnode4_vgroup_offline -endi -print show vgroups: -print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 $data5_1 $data6_1 $data7_1 $data8_1 $data9_1 -print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 $data5_2 $data6_2 $data7_2 $data8_2 $data9_2 -print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3 $data5_3 $data6_3 $data7_3 $data8_3 $data9_3 -$dnode4Vtatus = $data5_2 -$dnode3Vtatus = $data7_2 - -if $dnode4Vtatus != offline then - sleep 2000 - goto wait_dnode4_vgroup_offline -endi -if $dnode3Vtatus != master then - sleep 2000 - goto wait_dnode4_vgroup_offline -endi - -system echo "haha, nothing......" > ../../../sim/dnode4/data/vnode/vnode2/tsdb/data/v2f1643.data -#system rm -rf ../../../sim/dnode4/data/vnode/* -sleep 1000 - -print ============== step3-1: insert new data -sql insert into $tb values ( now + 0a , $x ) ( now + 1a , $x ) ( now + 2a , $x ) -$totalRows = $totalRows + 3 - -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - -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 select * from information_schema.ins_dnodes -if $rows != 4 then - sleep 2000 - goto wait_dnode4_reready -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 -#$dnode1Status = $data4_1 -$dnode2Status = $data4_2 -$dnode3Status = $data4_3 -$dnode4Status = $data4_4 -#$dnode5Status = $data4_5 - -if $dnode4Status != ready then - sleep 2000 - 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 - goto wait_dnode4_vgroup_slave -endi -print show vgroups: -print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 $data5_1 $data6_1 $data7_1 $data8_1 $data9_1 -print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 $data5_2 $data6_2 $data7_2 $data8_2 $data9_2 -print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3 $data5_3 $data6_3 $data7_3 $data8_3 $data9_3 -$dnode4Vtatus = $data5_2 -$dnode3Vtatus = $data7_2 - -print dnode4Vtatus: $dnode4Vtatus -print dnode3Vtatus: $dnode3Vtatus -if $dnode4Vtatus != slave then - sleep 2000 - goto wait_dnode4_vgroup_slave -endi -if $dnode3Vtatus != master then - sleep 2000 - goto wait_dnode4_vgroup_slave -endi - -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - -print ============== step5: stop dnode3/dnode2, and check rows -system sh/exec.sh -n dnode2 -s stop -x SIGINT -system sh/exec.sh -n dnode3 -s stop -x SIGINT -sleep $sleepTimer - -$loopCnt = 0 -wait_dnode23_offline: -$loopCnt = $loopCnt + 1 -if $loopCnt == 10 then - return -1 -endi -sql select * from information_schema.ins_dnodes -if $rows != 4 then - sleep 2000 - goto wait_dnode23_offline -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 -$dnode1Status = $data4_1 -$dnode2Status = $data4_2 -$dnode3Status = $data4_3 -$dnode4Status = $data4_4 - -if $dnode2Status != offline then - sleep 2000 - goto wait_dnode23_offline -endi -if $dnode3Status != offline then - sleep 2000 - goto wait_dnode23_offline -endi -if $dnode4Status != ready then - sleep 2000 - 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 - goto wait_dnode4_vgroup_master -endi -print show vgroups: -print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 $data5_1 $data6_1 $data7_1 $data8_1 $data9_1 -print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 $data5_2 $data6_2 $data7_2 $data8_2 $data9_2 -print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3 $data5_3 $data6_3 $data7_3 $data8_3 $data9_3 -$dnode4Vtatus = $data5_2 -$dnode3Vtatus = $data7_2 - -print dnode4Vtatus: $dnode4Vtatus -print dnode3Vtatus: $dnode3Vtatus -if $dnode4Vtatus != master then - sleep 2000 - goto wait_dnode4_vgroup_master -endi -if $dnode3Vtatus != offline then - sleep 2000 - goto wait_dnode4_vgroup_master -endi - -# check using select -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - -sql insert into $tb values ( now , 20000 ) ( now + 1a, 20001 ) ( now + 2a, 20002 ) -$totalRows = $totalRows + 3 - -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - diff --git a/tests/script/tsim/backup/arbitrator/dn3_mn1_vnode_corruptFile_offline.sim b/tests/script/tsim/backup/arbitrator/dn3_mn1_vnode_corruptFile_offline.sim deleted file mode 100644 index 07475adad6..0000000000 --- a/tests/script/tsim/backup/arbitrator/dn3_mn1_vnode_corruptFile_offline.sim +++ /dev/null @@ -1,435 +0,0 @@ -system sh/stop_dnodes.sh -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -system sh/deploy.sh -n dnode3 -i 3 -system sh/deploy.sh -n dnode4 -i 4 - -system sh/cfg.sh -n dnode1 -c 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 dnode1 -c walLevel -v 2 -system sh/cfg.sh -n dnode2 -c walLevel -v 2 -system sh/cfg.sh -n dnode3 -c walLevel -v 2 -system sh/cfg.sh -n dnode4 -c walLevel -v 2 - -system sh/cfg.sh -n dnode1 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode2 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode3 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode4 -c balanceInterval -v 10 - -system sh/cfg.sh -n dnode1 -c role -v 1 -system sh/cfg.sh -n dnode2 -c role -v 2 -system sh/cfg.sh -n dnode3 -c role -v 2 -system sh/cfg.sh -n dnode4 -c role -v 2 - -$totalTableNum = 10 -system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v $totalTableNum -system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v $totalTableNum -system sh/cfg.sh -n dnode3 -c maxtablesPerVnode -v $totalTableNum -system sh/cfg.sh -n dnode4 -c maxtablesPerVnode -v $totalTableNum - -system sh/cfg.sh -n dnode1 -c maxVgroupsPerDb -v 1 -system sh/cfg.sh -n dnode2 -c maxVgroupsPerDb -v 1 -system sh/cfg.sh -n dnode3 -c maxVgroupsPerDb -v 1 -system sh/cfg.sh -n dnode4 -c maxVgroupsPerDb -v 1 - -system sh/cfg.sh -n dnode1 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode2 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode3 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode4 -c arbitrator -v $arbitrator - -print ============== step0: start tarbitrator -system sh/exec_tarbitrator.sh -s start - -print ============== step1: start dnode1, only deploy mnode -system sh/exec.sh -n dnode1 -s start -sleep 2000 -sql connect - -print ============== step2: start dnode2/dnode3 and add into cluster , then create database with replica 2, and create table, insert data -system sh/exec.sh -n dnode2 -s start -system sh/exec.sh -n dnode3 -s start -#system sh/exec.sh -n dnode4 -s start -sql create dnode $hostname2 -sql create dnode $hostname3 -#sql create dnode $hostname4 -sleep 2000 - -$totalTableNum = 10 -$sleepTimer = 3000 - -$db = db -sql create database $db replica 2 -sql use $db - -# create table , insert data -$stb = stb -sql create table $stb (ts timestamp, c1 int) tags(t1 int) -$rowNum = 100 -$tblNum = $totalTableNum -$totalRows = 0 -$tsStart = 1420041600000 - -$i = 0 -while $i < $tblNum - $tb = tb . $i - sql create table $tb using $stb tags( $i ) - - $x = 0 - while $x < $rowNum - $ts = $tsStart + $x - sql insert into $tb values ( $ts + 0a , $x ) ( $ts + 1a , $x ) ( $ts + 2a , $x ) ( $ts + 3a , $x ) ( $ts + 4a , $x ) ( $ts + 5a , $x ) ( $ts + 6a , $x ) ( $ts + 7a , $x ) ( $ts + 8a , $x ) ( $ts + 9a , $x ) ( $ts + 10a , $x ) ( $ts + 11a , $x ) ( $ts + 12a , $x ) ( $ts + 13a , $x ) ( $ts + 14a , $x ) ( $ts + 15a , $x ) ( $ts + 16a , $x ) ( $ts + 17a , $x ) ( $ts + 18a , $x ) ( $ts + 19a , $x ) ( $ts + 20a , $x ) ( $ts + 21a , $x ) ( $ts + 22a , $x ) ( $ts + 23a , $x ) ( $ts + 24a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 35a , $x ) ( $ts + 36a , $x ) ( $ts + 37a , $x ) ( $ts + 38a , $x ) ( $ts + 39a , $x ) ( $ts + 40a , $x ) ( $ts + 41a , $x ) ( $ts + 42a , $x ) ( $ts + 43a , $x ) ( $ts + 44a , $x ) ( $ts + 45a , $x ) ( $ts + 46a , $x ) ( $ts + 47a , $x ) ( $ts + 48a , $x ) ( $ts + 49a , $x ) ( $ts + 50a , $x ) ( $ts + 51a , $x ) ( $ts + 52a , $x ) ( $ts + 53a , $x ) ( $ts + 54a , $x ) ( $ts + 55a , $x ) ( $ts + 56a , $x ) ( $ts + 57a , $x ) ( $ts + 58a , $x ) ( $ts + 59a , $x ) - $x = $x + 60 - endw - $totalRows = $totalRows + $x - print info: inserted $x rows into $tb and totalRows: $totalRows - $i = $i + 1 -endw - -sql select count(*) from $stb -sleep 1000 -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - -print ============== step3: stop dnode3 for falling disc, then corrupt vnode data file in dnode3 -system sh/exec.sh -n dnode3 -s stop -x SIGINT -sleep $sleepTimer - -$loopCnt = 0 -wait_dnode3_offline_0: -$loopCnt = $loopCnt + 1 -if $loopCnt == 10 then - return -1 -endi - -sql select * from information_schema.ins_dnodes -if $rows != 3 then - sleep 2000 - goto wait_dnode3_offline_0 -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 -#$dnode1Status = $data4_1 -$dnode2Status = $data4_2 -$dnode3Status = $data4_3 -$dnode4Status = $data4_4 -#$dnode5Status = $data4_5 - -if $dnode3Status != offline then - sleep 2000 - goto wait_dnode3_offline_0 -endi - -$loopCnt = 0 -wait_dnode3_vgroup_offline: -$loopCnt = $loopCnt + 1 -if $loopCnt == 10 then - return -1 -endi - -sql show vgroups -if $rows != 1 then - sleep 2000 - goto wait_dnode3_vgroup_offline -endi -print show vgroups: -print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 $data5_1 $data6_1 $data7_1 $data8_1 $data9_1 -print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 $data5_2 $data6_2 $data7_2 $data8_2 $data9_2 -print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3 $data5_3 $data6_3 $data7_3 $data8_3 $data9_3 -$dnode3Vtatus = $data5_2 -$dnode2Vtatus = $data7_2 - -if $dnode3Vtatus != offline then - sleep 2000 - goto wait_dnode3_vgroup_offline -endi -if $dnode2Vtatus != master then - sleep 2000 - goto wait_dnode3_vgroup_offline -endi - -#$expectCnt = 3 . : -#print expectCnt: [ $expectCnt ] -#system_content ls ../../../sim/dnode3/data/vnode/vnode2/tsdb/data/ -l | grep "^-" | wc -l | tr '\n' ':' -#system_content ls ../../../sim/dnode3/data/vnode/vnode2/tsdb/data/ -l | grep "^-" | wc -l | tr '\n' ':' -#print --2-->dnode3 data files: [ $system_content ] - - -system_content ls ../../../sim/dnode2/data/vnode/vnode2/tsdb/data/ -l | grep "^-" | wc -l | tr -d '\n' -print ---->dnode2 data files: $system_content expect: 0 -if $system_content != 0 then - return -1 -endi - -system_content ls ../../../sim/dnode3/data/vnode/vnode2/tsdb/data/ -l | grep "^-" | wc -l | tr -d '\n' -print ---->dnode3 data files: $system_content expect: 3 -if $system_content != 3 then - return -1 -endi - -system echo "haha, nothing......" > ../../../sim/dnode3/data/vnode/vnode2/tsdb/data/v2f1643.data - -print ============== step3-1: insert some news data for let version changed -sql insert into $tb values ( now + 0a , $x ) ( now + 1a , $x ) ( now + 2a , $x ) -sql insert into $tb values ( now + 10a , $x ) ( now + 11a , $x ) ( now + 12a , $x ) -$totalRows = $totalRows + 6 -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - -print ============== step4: restart dnode3, and run query -system sh/exec.sh -n dnode3 -s start -sleep $sleepTimer -$loopCnt = 0 -wait_dnode3_reready: -$loopCnt = $loopCnt + 1 -if $loopCnt == 10 then - return -1 -endi - -sql select * from information_schema.ins_dnodes -if $rows != 3 then - sleep 2000 - goto wait_dnode3_reready -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 -#$dnode1Status = $data4_1 -$dnode2Status = $data4_2 -$dnode3Status = $data4_3 -$dnode4Status = $data4_4 -#$dnode5Status = $data4_5 - -if $dnode3Status != ready then - sleep 2000 - goto wait_dnode3_reready -endi -$loopCnt = 0 -wait_dnode3_vgroup_slave: -$loopCnt = $loopCnt + 1 -if $loopCnt == 10 then - return -1 -endi - -sql show vgroups -if $rows != 1 then - sleep 2000 - goto wait_dnode3_vgroup_slave -endi -print show vgroups: -print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 $data5_1 $data6_1 $data7_1 $data8_1 $data9_1 -print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 $data5_2 $data6_2 $data7_2 $data8_2 $data9_2 -print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3 $data5_3 $data6_3 $data7_3 $data8_3 $data9_3 -$dnode2Vtatus = $data5_2 -$dnode3Vtatus = $data7_2 - -if $dnode2Vtatus != master then - sleep 2000 - goto wait_dnode3_vgroup_slave -endi -if $dnode3Vtatus != slave then - sleep 2000 - goto wait_dnode3_vgroup_slave -endi - -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - -system_content ls ../../../sim/dnode2/data/vnode/vnode2/tsdb/data/ -l |grep "^-"|wc -l | tr -d '\n' -print ----> dnode2 data files: $system_content expect: 0 -if $system_content != 0 then - return -1 -endi - -system_content ls ../../../sim/dnode3/data/vnode/vnode2/tsdb/data/ -l |grep "^-"|wc -l | tr -d '\n' -print ----> dnode3 data files: $system_content expect: 0 -if $system_content != 0 then - print there should be no data file in dnode3 after sync - return -1 -endi - -print ============== step5: stop dnode2, and check if dnode3 sync ok -system sh/exec.sh -n dnode2 -s stop -x SIGINT -sleep $sleepTimer - -$loopCnt = 0 -wait_dnode2_offline_0: -$loopCnt = $loopCnt + 1 -if $loopCnt == 10 then - return -1 -endi -sql select * from information_schema.ins_dnodes -if $rows != 3 then - sleep 2000 - goto wait_dnode2_offline_0 -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 -#$dnode1Status = $data4_1 -$dnode2Status = $data4_2 -$dnode3Status = $data4_3 -$dnode4Status = $data4_4 -#$dnode5Status = $data4_5 - -if $dnode2Status != offline then - sleep 2000 - goto wait_dnode2_offline_0 -endi - -$loopCnt = 0 -wait_dnode3_vgroup_master: -$loopCnt = $loopCnt + 1 -if $loopCnt == 10 then - return -1 -endi - -sql show vgroups -if $rows != 1 then - sleep 2000 - goto wait_dnode3_vgroup_master -endi -print show vgroups: -print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 $data5_1 $data6_1 $data7_1 $data8_1 $data9_1 -print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 $data5_2 $data6_2 $data7_2 $data8_2 $data9_2 -print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3 $data5_3 $data6_3 $data7_3 $data8_3 $data9_3 -$dnode2Vtatus = $data7_2 -$dnode3Vtatus = $data5_2 - -if $dnode2Vtatus != offline then - sleep 2000 - goto wait_dnode3_vgroup_master -endi -if $dnode3Vtatus != master then - sleep 2000 - goto wait_dnode3_vgroup_master -endi - -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - -print ============== step6: stop dnode3 for falling disck -system sh/exec.sh -n dnode3 -s stop -x SIGINT -sleep $sleepTimer -sql select * from information_schema.ins_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 - -sql show vgroups -print show vgroups: -print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 $data5_1 $data6_1 $data7_1 $data8_1 $data9_1 -print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 $data5_2 $data6_2 $data7_2 $data8_2 $data9_2 -print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3 $data5_3 $data6_3 $data7_3 $data8_3 $data9_3 - - -print ============== step7: restart dnode3, and run query -system sh/exec.sh -n dnode2 -s start -system sh/exec.sh -n dnode3 -s start -sleep $sleepTimer -$loopCnt = 0 -wait_dnode23_reready_2: -$loopCnt = $loopCnt + 1 -if $loopCnt == 10 then - return -1 -endi -sql select * from information_schema.ins_dnodes -if $rows != 3 then - sleep 2000 - goto wait_dnode23_reready_2 -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 -$dnode1Status = $data4_1 -$dnode2Status = $data4_2 -$dnode3Status = $data4_3 - -if $dnode2Status != ready then - sleep 2000 - goto wait_dnode23_reready_2 -endi - -if $dnode3Status != ready then - sleep 2000 - goto wait_dnode23_reready_2 -endi - -$loopCnt = 0 -wait_dnode23_vgroup_ok: -$loopCnt = $loopCnt + 1 -if $loopCnt == 10 then - return -1 -endi -sql show vgroups -if $rows != 1 then - sleep 2000 - goto wait_dnode23_vgroup_ok -endi -print show vgroups: -print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 $data5_1 $data6_1 $data7_1 $data8_1 $data9_1 -print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 $data5_2 $data6_2 $data7_2 $data8_2 $data9_2 -print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3 $data5_3 $data6_3 $data7_3 $data8_3 $data9_3 -$dnode2Vtatus = $data7_2 -$dnode3Vtatus = $data5_2 - -if $dnode2Vtatus == offline then - sleep 2000 - goto wait_dnode23_vgroup_ok -endi -if $dnode3Vtatus == offline then - sleep 2000 - goto wait_dnode23_vgroup_ok -endi - -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/script/tsim/backup/arbitrator/dn3_mn1_vnode_corruptFile_online.sim b/tests/script/tsim/backup/arbitrator/dn3_mn1_vnode_corruptFile_online.sim deleted file mode 100644 index e3dfccf700..0000000000 --- a/tests/script/tsim/backup/arbitrator/dn3_mn1_vnode_corruptFile_online.sim +++ /dev/null @@ -1,354 +0,0 @@ -system sh/stop_dnodes.sh -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -system sh/deploy.sh -n dnode3 -i 3 -system sh/deploy.sh -n dnode4 -i 4 - -system sh/cfg.sh -n dnode1 -c 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 dnode1 -c walLevel -v 2 -system sh/cfg.sh -n dnode2 -c walLevel -v 2 -system sh/cfg.sh -n dnode3 -c walLevel -v 2 -system sh/cfg.sh -n dnode4 -c walLevel -v 2 - -system sh/cfg.sh -n dnode1 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode2 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode3 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode4 -c balanceInterval -v 10 - -system sh/cfg.sh -n dnode1 -c role -v 1 -system sh/cfg.sh -n dnode2 -c role -v 2 -system sh/cfg.sh -n dnode3 -c role -v 2 -system sh/cfg.sh -n dnode4 -c role -v 2 - -$totalTableNum = 10 -system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v $totalTableNum -system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v $totalTableNum -system sh/cfg.sh -n dnode3 -c maxtablesPerVnode -v $totalTableNum -system sh/cfg.sh -n dnode4 -c maxtablesPerVnode -v $totalTableNum - -system sh/cfg.sh -n dnode1 -c maxVgroupsPerDb -v 1 -system sh/cfg.sh -n dnode2 -c maxVgroupsPerDb -v 1 -system sh/cfg.sh -n dnode3 -c maxVgroupsPerDb -v 1 -system sh/cfg.sh -n dnode4 -c maxVgroupsPerDb -v 1 - -system sh/cfg.sh -n dnode1 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode2 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode3 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode4 -c arbitrator -v $arbitrator - -print ============== step0: start tarbitrator -system sh/exec_tarbitrator.sh -s start - -print ============== step1: start dnode1, only deploy mnode -system sh/exec.sh -n dnode1 -s start -sleep 2000 -sql connect - -print ============== step2: start dnode2/dnode3 and add into cluster , then create database with replica 2, and create table, insert data to can fall disc -system sh/exec.sh -n dnode2 -s start -system sh/exec.sh -n dnode3 -s start -#system sh/exec.sh -n dnode4 -s start -sql create dnode $hostname2 -sql create dnode $hostname3 -#sql create dnode $hostname4 -sleep 2000 - -$totalTableNum = 4 -$sleepTimer = 3000 - -$db = db -sql create database $db cache 1 replica 2 -sql use $db - -# create table , insert data -$stb = stb -sql create table $stb (ts timestamp, c1 int) tags(t1 int) -$rowNum = 128 * 1024 -$tblNum = 1 -$totalRows = 0 -$tsStart = 1420041600000 - -$i = 0 -while $i < $tblNum - $tb = tb . $i - sql create table $tb using $stb tags( $i ) - - $x = 0 - while $x < $rowNum - $ts = $tsStart + $x - sql insert into $tb values ( $ts + 0a , $x ) ( $ts + 1a , $x ) ( $ts + 2a , $x ) ( $ts + 3a , $x ) ( $ts + 4a , $x ) ( $ts + 5a , $x ) ( $ts + 6a , $x ) ( $ts + 7a , $x ) ( $ts + 8a , $x ) ( $ts + 9a , $x ) ( $ts + 10a , $x ) ( $ts + 11a , $x ) ( $ts + 12a , $x ) ( $ts + 13a , $x ) ( $ts + 14a , $x ) ( $ts + 15a , $x ) ( $ts + 16a , $x ) ( $ts + 17a , $x ) ( $ts + 18a , $x ) ( $ts + 19a , $x ) ( $ts + 20a , $x ) ( $ts + 21a , $x ) ( $ts + 22a , $x ) ( $ts + 23a , $x ) ( $ts + 24a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 35a , $x ) ( $ts + 36a , $x ) ( $ts + 37a , $x ) ( $ts + 38a , $x ) ( $ts + 39a , $x ) ( $ts + 40a , $x ) ( $ts + 41a , $x ) ( $ts + 42a , $x ) ( $ts + 43a , $x ) ( $ts + 44a , $x ) ( $ts + 45a , $x ) ( $ts + 46a , $x ) ( $ts + 47a , $x ) ( $ts + 48a , $x ) ( $ts + 49a , $x ) ( $ts + 50a , $x ) ( $ts + 51a , $x ) ( $ts + 52a , $x ) ( $ts + 53a , $x ) ( $ts + 54a , $x ) ( $ts + 55a , $x ) ( $ts + 56a , $x ) ( $ts + 57a , $x ) ( $ts + 58a , $x ) ( $ts + 59a , $x ) - $x = $x + 60 - $tsLast = $ts + 60 - endw - $totalRows = $totalRows + $x - print info: inserted $x rows into $tb and totalRows: $totalRows - $i = $i + 1 -endw - -sql select count(*) from $stb -sleep 1000 -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - -print ============== step3: corrupt vnode data file in dnode3, not stop dnode3 -system echo "haha, nothing......" > ../../../sim/dnode3/data/vnode/vnode2/tsdb/data/v2f1643.data -sleep 1000 - -print ============== step4: insert new data, and run query -sql insert into $tb values ( now + 0a , $x ) ( now + 1a , $x ) ( now + 2a , $x ) -$totalRows = $totalRows + 3 - -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - -print select * from information_schema.ins_dnodes -sql select * from information_schema.ins_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 show vgroups -sql show vgroups -print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 $data5_1 $data6_1 $data7_1 $data8_1 $data9_1 -print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 $data5_2 $data6_2 $data7_2 $data8_2 $data9_2 -print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3 $data5_3 $data6_3 $data7_3 $data8_3 $data9_3 - - -$tsStart = $tsLast + 1 -$i = 0 -while $i < $tblNum - $tb = tb . $i - #sql create table $tb using $stb tags( $i ) - - $x = 0 - while $x < $rowNum - $ts = $tsStart + $x - sql insert into $tb values ( $ts + 0a , $x ) ( $ts + 1a , $x ) ( $ts + 2a , $x ) ( $ts + 3a , $x ) ( $ts + 4a , $x ) ( $ts + 5a , $x ) ( $ts + 6a , $x ) ( $ts + 7a , $x ) ( $ts + 8a , $x ) ( $ts + 9a , $x ) ( $ts + 10a , $x ) ( $ts + 11a , $x ) ( $ts + 12a , $x ) ( $ts + 13a , $x ) ( $ts + 14a , $x ) ( $ts + 15a , $x ) ( $ts + 16a , $x ) ( $ts + 17a , $x ) ( $ts + 18a , $x ) ( $ts + 19a , $x ) ( $ts + 20a , $x ) ( $ts + 21a , $x ) ( $ts + 22a , $x ) ( $ts + 23a , $x ) ( $ts + 24a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 35a , $x ) ( $ts + 36a , $x ) ( $ts + 37a , $x ) ( $ts + 38a , $x ) ( $ts + 39a , $x ) ( $ts + 40a , $x ) ( $ts + 41a , $x ) ( $ts + 42a , $x ) ( $ts + 43a , $x ) ( $ts + 44a , $x ) ( $ts + 45a , $x ) ( $ts + 46a , $x ) ( $ts + 47a , $x ) ( $ts + 48a , $x ) ( $ts + 49a , $x ) ( $ts + 50a , $x ) ( $ts + 51a , $x ) ( $ts + 52a , $x ) ( $ts + 53a , $x ) ( $ts + 54a , $x ) ( $ts + 55a , $x ) ( $ts + 56a , $x ) ( $ts + 57a , $x ) ( $ts + 58a , $x ) ( $ts + 59a , $x ) - $x = $x + 60 - $tsLast = $ts + 60 - endw - $totalRows = $totalRows + $x - print info: inserted $x rows into $tb and totalRows: $totalRows - $i = $i + 1 -endw - -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - -print ============== step5: stop dnode2, and check if dnode3 sync ok -system sh/exec.sh -n dnode2 -s stop -x SIGINT -sleep $sleepTimer - -$loopCnt = 0 -wait_dnode2_offline_0: -$loopCnt = $loopCnt + 1 -if $loopCnt == 10 then - return -1 -endi - -sql select * from information_schema.ins_dnodes -if $rows != 3 then - sleep 2000 - goto wait_dnode2_offline_0 -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 -#$dnode1Status = $data4_1 -$dnode2Status = $data4_2 -$dnode3Status = $data4_3 -$dnode4Status = $data4_4 -#$dnode5Status = $data4_5 - -if $dnode2Status != offline then - sleep 2000 - goto wait_dnode2_offline_0 -endi - -$loopCnt = 0 -wait_dnode3_vgroup_master: -$loopCnt = $loopCnt + 1 -if $loopCnt == 10 then - return -1 -endi - -sql show vgroups -if $rows != 1 then - sleep 2000 - goto wait_dnode3_vgroup_master -endi -print show vgroups: -print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 $data5_1 $data6_1 $data7_1 $data8_1 $data9_1 -print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 $data5_2 $data6_2 $data7_2 $data8_2 $data9_2 -print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3 $data5_3 $data6_3 $data7_3 $data8_3 $data9_3 -$dnode2Vtatus = $data7_2 -$dnode3Vtatus = $data5_2 - -if $dnode2Vtatus != offline then - sleep 2000 - goto wait_dnode3_vgroup_master -endi -if $dnode3Vtatus != master then - sleep 2000 - goto wait_dnode3_vgroup_master -endi - -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - -print ============== step6: stop dnode3 for falling disc -system sh/exec.sh -n dnode3 -s stop -x SIGINT -sleep $sleepTimer - -$loopCnt = 0 -wait_dnode3_offline_0: -$loopCnt = $loopCnt + 1 -if $loopCnt == 10 then - return -1 -endi - -sql select * from information_schema.ins_dnodes -if $rows != 3 then - sleep 2000 - goto wait_dnode3_offline_0 -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 -#$dnode1Status = $data4_1 -$dnode2Status = $data4_2 -$dnode3Status = $data4_3 -$dnode4Status = $data4_4 -#$dnode5Status = $data4_5 - -if $dnode2Status != offline then - sleep 2000 - goto wait_dnode3_offline_0 -endi - -if $dnode3Status != offline then - sleep 2000 - goto wait_dnode3_offline_0 -endi - - -$loopCnt = 0 -wait_dnode3_vgroup_offline: -$loopCnt = $loopCnt + 1 -if $loopCnt == 10 then - return -1 -endi - -sql show vgroups -if $rows != 1 then - sleep 2000 - goto wait_dnode3_vgroup_offline -endi -print show vgroups: -print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 $data5_1 $data6_1 $data7_1 $data8_1 $data9_1 -print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 $data5_2 $data6_2 $data7_2 $data8_2 $data9_2 -print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3 $data5_3 $data6_3 $data7_3 $data8_3 $data9_3 -$dnode2Vtatus = $data7_2 -$dnode3Vtatus = $data5_2 - -if $dnode2Vtatus != offline then - sleep 2000 - goto wait_dnode3_vgroup_offline -endi -if $dnode3Vtatus != offline then - sleep 2000 - goto wait_dnode3_vgroup_offline -endi - -print ============== step7: restart dnode2/dnode3, and run query -system sh/exec.sh -n dnode2 -s start -system sh/exec.sh -n dnode3 -s start -sleep $sleepTimer -$loopCnt = 0 -wait_dnode3_reready: -$loopCnt = $loopCnt + 1 -if $loopCnt == 10 then - return -1 -endi - -sql select * from information_schema.ins_dnodes -if $rows != 3 then - sleep 2000 - goto wait_dnode3_reready -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 -$dnode1Status = $data4_1 -$dnode2Status = $data4_2 -$dnode3Status = $data4_3 - -if $dnode3Status != ready then - sleep 2000 - goto wait_dnode3_reready -endi - -$loopCnt = 0 -wait_dnode3_vgroup_master_1: -$loopCnt = $loopCnt + 1 -if $loopCnt == 10 then - return -1 -endi - -sql show vgroups -if $rows != 1 then - sleep 2000 - goto wait_dnode3_vgroup_master_1 -endi -print show vgroups: -print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 $data5_1 $data6_1 $data7_1 $data8_1 $data9_1 -print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 $data5_2 $data6_2 $data7_2 $data8_2 $data9_2 -print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3 $data5_3 $data6_3 $data7_3 $data8_3 $data9_3 -$dnode2Vtatus = $data7_2 -$dnode3Vtatus = $data5_2 - -if $dnode2Vtatus != slave then - sleep 2000 - goto wait_dnode3_vgroup_master_1 -endi -if $dnode3Vtatus != master then - sleep 2000 - goto wait_dnode3_vgroup_master_1 -endi - -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - - - - - - - - - - diff --git a/tests/script/tsim/backup/arbitrator/dn3_mn1_vnode_createErrData_online.sim b/tests/script/tsim/backup/arbitrator/dn3_mn1_vnode_createErrData_online.sim deleted file mode 100644 index 677e9bbacb..0000000000 --- a/tests/script/tsim/backup/arbitrator/dn3_mn1_vnode_createErrData_online.sim +++ /dev/null @@ -1,316 +0,0 @@ -system sh/stop_dnodes.sh -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -system sh/deploy.sh -n dnode3 -i 3 -system sh/deploy.sh -n dnode4 -i 4 - -system sh/cfg.sh -n dnode1 -c 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 dnode1 -c walLevel -v 2 -system sh/cfg.sh -n dnode2 -c walLevel -v 2 -system sh/cfg.sh -n dnode3 -c walLevel -v 2 -system sh/cfg.sh -n dnode4 -c walLevel -v 2 - -system sh/cfg.sh -n dnode1 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode2 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode3 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode4 -c balanceInterval -v 10 - -system sh/cfg.sh -n dnode1 -c role -v 1 -system sh/cfg.sh -n dnode2 -c role -v 2 -system sh/cfg.sh -n dnode3 -c role -v 2 -system sh/cfg.sh -n dnode4 -c role -v 2 - -$totalTableNum = 10 -system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v $totalTableNum -system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v $totalTableNum -system sh/cfg.sh -n dnode3 -c maxtablesPerVnode -v $totalTableNum -system sh/cfg.sh -n dnode4 -c maxtablesPerVnode -v $totalTableNum - -system sh/cfg.sh -n dnode1 -c maxVgroupsPerDb -v 1 -system sh/cfg.sh -n dnode2 -c maxVgroupsPerDb -v 1 -system sh/cfg.sh -n dnode3 -c maxVgroupsPerDb -v 1 -system sh/cfg.sh -n dnode4 -c maxVgroupsPerDb -v 1 - -system sh/cfg.sh -n dnode1 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode2 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode3 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode4 -c arbitrator -v $arbitrator - -print ============== step0: start tarbitrator -system sh/exec_tarbitrator.sh -s start - -print ============== step1: start dnode1, only deploy mnode -system sh/exec.sh -n dnode1 -s start -sleep 2000 -sql connect - -print ============== step2: start dnode2/dnode3 and add into cluster , then create database with replica 2, and create table, insert data -system sh/exec.sh -n dnode2 -s start -system sh/exec.sh -n dnode3 -s start -#system sh/exec.sh -n dnode4 -s start -sql create dnode $hostname2 -sql create dnode $hostname3 -#sql create dnode $hostname4 -sleep 2000 - -$totalTableNum = 10 -$sleepTimer = 3000 - -$db = db -sql create database $db replica 2 -sql use $db - -# create table , insert data -$stb = stb -sql create table $stb (ts timestamp, c1 int) tags(t1 int) -$rowNum = 100 -$tblNum = $totalTableNum -$totalRows = 0 -$tsStart = 1420041600000 - -$i = 0 -while $i < $tblNum - $tb = tb . $i - sql create table $tb using $stb tags( $i ) - - $x = 0 - while $x < $rowNum - $ts = $tsStart + $x - sql insert into $tb values ( $ts + 0a , $x ) ( $ts + 1a , $x ) ( $ts + 2a , $x ) ( $ts + 3a , $x ) ( $ts + 4a , $x ) ( $ts + 5a , $x ) ( $ts + 6a , $x ) ( $ts + 7a , $x ) ( $ts + 8a , $x ) ( $ts + 9a , $x ) ( $ts + 10a , $x ) ( $ts + 11a , $x ) ( $ts + 12a , $x ) ( $ts + 13a , $x ) ( $ts + 14a , $x ) ( $ts + 15a , $x ) ( $ts + 16a , $x ) ( $ts + 17a , $x ) ( $ts + 18a , $x ) ( $ts + 19a , $x ) ( $ts + 20a , $x ) ( $ts + 21a , $x ) ( $ts + 22a , $x ) ( $ts + 23a , $x ) ( $ts + 24a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 35a , $x ) ( $ts + 36a , $x ) ( $ts + 37a , $x ) ( $ts + 38a , $x ) ( $ts + 39a , $x ) ( $ts + 40a , $x ) ( $ts + 41a , $x ) ( $ts + 42a , $x ) ( $ts + 43a , $x ) ( $ts + 44a , $x ) ( $ts + 45a , $x ) ( $ts + 46a , $x ) ( $ts + 47a , $x ) ( $ts + 48a , $x ) ( $ts + 49a , $x ) ( $ts + 50a , $x ) ( $ts + 51a , $x ) ( $ts + 52a , $x ) ( $ts + 53a , $x ) ( $ts + 54a , $x ) ( $ts + 55a , $x ) ( $ts + 56a , $x ) ( $ts + 57a , $x ) ( $ts + 58a , $x ) ( $ts + 59a , $x ) - $x = $x + 60 - endw - $totalRows = $totalRows + $x - print info: inserted $x rows into $tb and totalRows: $totalRows - $i = $i + 1 -endw - -sql select count(*) from $stb -sleep 1000 -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - -print ============== step3: corrupt vnode data file in dnode3, not stop dnode3 -system echo "haha, nothing......" > ../../../sim/dnode3/data/vnode/vnode2/tsdb/data/v2f1643.data -sleep 1000 - -print ============== step4: insert new data, and run query -sql insert into $tb values ( now + 0a , $x ) ( now + 1a , $x ) ( now + 2a , $x ) -$totalRows = $totalRows + 3 - -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - -print ============== step5: stop dnode2, and check if dnode3 sync ok -system sh/exec.sh -n dnode2 -s stop -x SIGINT -sleep $sleepTimer - -$loopCnt = 0 -wait_dnode2_offline_0: -$loopCnt = $loopCnt + 1 -if $loopCnt == 10 then - return -1 -endi - -sql select * from information_schema.ins_dnodes -if $rows != 3 then - sleep 2000 - goto wait_dnode2_offline_0 -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 -#$dnode1Status = $data4_1 -$dnode2Status = $data4_2 -$dnode3Status = $data4_3 -$dnode4Status = $data4_4 -#$dnode5Status = $data4_5 - -if $dnode2Status != offline then - sleep 2000 - goto wait_dnode2_offline_0 -endi - -$loopCnt = 0 -wait_dnode3_vgroup_master: -$loopCnt = $loopCnt + 1 -if $loopCnt == 10 then - return -1 -endi - -sql show vgroups -if $rows != 1 then - sleep 2000 - goto wait_dnode3_vgroup_master -endi -print show vgroups: -print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 $data5_1 $data6_1 $data7_1 $data8_1 $data9_1 -print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 $data5_2 $data6_2 $data7_2 $data8_2 $data9_2 -print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3 $data5_3 $data6_3 $data7_3 $data8_3 $data9_3 -$dnode2Vtatus = $data7_2 -$dnode3Vtatus = $data5_2 - -if $dnode2Vtatus != offline then - sleep 2000 - goto wait_dnode3_vgroup_master -endi -if $dnode3Vtatus != master then - sleep 2000 - goto wait_dnode3_vgroup_master -endi - -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - -print ============== step6: stop dnode3 for falling disc -system sh/exec.sh -n dnode3 -s stop -x SIGINT -sleep $sleepTimer - -$loopCnt = 0 -wait_dnode3_offline_0: -$loopCnt = $loopCnt + 1 -if $loopCnt == 10 then - return -1 -endi - -sql select * from information_schema.ins_dnodes -if $rows != 3 then - sleep 2000 - goto wait_dnode3_offline_0 -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 -#$dnode1Status = $data4_1 -$dnode2Status = $data4_2 -$dnode3Status = $data4_3 -$dnode4Status = $data4_4 -#$dnode5Status = $data4_5 - -if $dnode2Status != offline then - sleep 2000 - goto wait_dnode3_offline_0 -endi - -if $dnode3Status != offline then - sleep 2000 - goto wait_dnode3_offline_0 -endi - - -$loopCnt = 0 -wait_dnode3_vgroup_offline: -$loopCnt = $loopCnt + 1 -if $loopCnt == 10 then - return -1 -endi - -sql show vgroups -if $rows != 1 then - sleep 2000 - goto wait_dnode3_vgroup_offline -endi -print show vgroups: -print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 $data5_1 $data6_1 $data7_1 $data8_1 $data9_1 -print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 $data5_2 $data6_2 $data7_2 $data8_2 $data9_2 -print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3 $data5_3 $data6_3 $data7_3 $data8_3 $data9_3 -$dnode2Vtatus = $data7_2 -$dnode3Vtatus = $data5_2 - -if $dnode2Vtatus != offline then - sleep 2000 - goto wait_dnode3_vgroup_offline -endi -if $dnode3Vtatus != offline then - sleep 2000 - goto wait_dnode3_vgroup_offline -endi - -print ============== step7: restart dnode2/dnode3, and run query -system sh/exec.sh -n dnode2 -s start -system sh/exec.sh -n dnode3 -s start -sleep $sleepTimer -$loopCnt = 0 -wait_dnode3_reready: -$loopCnt = $loopCnt + 1 -if $loopCnt == 10 then - return -1 -endi - -sql select * from information_schema.ins_dnodes -if $rows != 3 then - sleep 2000 - goto wait_dnode3_reready -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 -$dnode1Status = $data4_1 -$dnode2Status = $data4_2 -$dnode3Status = $data4_3 - -if $dnode3Status != ready then - sleep 2000 - goto wait_dnode3_reready -endi - -$loopCnt = 0 -wait_dnode3_vgroup_master_1: -$loopCnt = $loopCnt + 1 -if $loopCnt == 10 then - return -1 -endi - -sql show vgroups -if $rows != 1 then - sleep 2000 - goto wait_dnode3_vgroup_master_1 -endi -print show vgroups: -print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 $data5_1 $data6_1 $data7_1 $data8_1 $data9_1 -print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 $data5_2 $data6_2 $data7_2 $data8_2 $data9_2 -print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3 $data5_3 $data6_3 $data7_3 $data8_3 $data9_3 -$dnode2Vtatus = $data7_2 -$dnode3Vtatus = $data5_2 - -if $dnode2Vtatus != slave then - sleep 2000 - goto wait_dnode3_vgroup_master_1 -endi -if $dnode3Vtatus != master then - sleep 2000 - goto wait_dnode3_vgroup_master_1 -endi - -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - - - - - - - - - - diff --git a/tests/script/tsim/backup/arbitrator/dn3_mn1_vnode_delDir.sim b/tests/script/tsim/backup/arbitrator/dn3_mn1_vnode_delDir.sim deleted file mode 100644 index 0ac8f56d91..0000000000 --- a/tests/script/tsim/backup/arbitrator/dn3_mn1_vnode_delDir.sim +++ /dev/null @@ -1,458 +0,0 @@ -system sh/stop_dnodes.sh -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -system sh/deploy.sh -n dnode3 -i 3 -system sh/deploy.sh -n dnode4 -i 4 - -system sh/cfg.sh -n dnode1 -c 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 dnode1 -c walLevel -v 2 -system sh/cfg.sh -n dnode2 -c walLevel -v 2 -system sh/cfg.sh -n dnode3 -c walLevel -v 2 -system sh/cfg.sh -n dnode4 -c walLevel -v 2 - -system sh/cfg.sh -n dnode1 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode2 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode3 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode4 -c balanceInterval -v 10 - -system sh/cfg.sh -n dnode1 -c role -v 1 -system sh/cfg.sh -n dnode2 -c role -v 2 -system sh/cfg.sh -n dnode3 -c role -v 2 -system sh/cfg.sh -n dnode4 -c role -v 2 - -$totalTableNum = 10 -system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v $totalTableNum -system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v $totalTableNum -system sh/cfg.sh -n dnode3 -c maxtablesPerVnode -v $totalTableNum -system sh/cfg.sh -n dnode4 -c maxtablesPerVnode -v $totalTableNum - -system sh/cfg.sh -n dnode1 -c maxVgroupsPerDb -v 1 -system sh/cfg.sh -n dnode2 -c maxVgroupsPerDb -v 1 -system sh/cfg.sh -n dnode3 -c maxVgroupsPerDb -v 1 -system sh/cfg.sh -n dnode4 -c maxVgroupsPerDb -v 1 - -system sh/cfg.sh -n dnode1 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode2 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode3 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode4 -c arbitrator -v $arbitrator - -print ============== step0: start tarbitrator -system sh/exec_tarbitrator.sh -s start - -print ============== step1: start dnode1, only deploy mnode -system sh/exec.sh -n dnode1 -s start -sleep 2000 -sql connect - -print ============== step2: start dnode2/dnode3/dnode4 and add into cluster , then create database with replica 3, and create table, insert data -system sh/exec.sh -n dnode2 -s start -system sh/exec.sh -n dnode3 -s start -system sh/exec.sh -n dnode4 -s start -sql create dnode $hostname2 -sql create dnode $hostname3 -sql create dnode $hostname4 -sleep 2000 - -$sleepTimer = 3000 - -$db = db -sql create database $db replica 3 -sql use $db - -# create table , insert data -$stb = stb -sql create table $stb (ts timestamp, c1 int) tags(t1 int) -$rowNum = 100 -$tblNum = $totalTableNum -$totalRows = 0 -$tsStart = 1420041600000 - -$i = 0 -while $i < $tblNum - $tb = tb . $i - sql create table $tb using $stb tags( $i ) - - $x = 0 - while $x < $rowNum - $ts = $tsStart + $x - sql insert into $tb values ( $ts + 0a , $x ) ( $ts + 1a , $x ) ( $ts + 2a , $x ) ( $ts + 3a , $x ) ( $ts + 4a , $x ) ( $ts + 5a , $x ) ( $ts + 6a , $x ) ( $ts + 7a , $x ) ( $ts + 8a , $x ) ( $ts + 9a , $x ) ( $ts + 10a , $x ) ( $ts + 11a , $x ) ( $ts + 12a , $x ) ( $ts + 13a , $x ) ( $ts + 14a , $x ) ( $ts + 15a , $x ) ( $ts + 16a , $x ) ( $ts + 17a , $x ) ( $ts + 18a , $x ) ( $ts + 19a , $x ) ( $ts + 20a , $x ) ( $ts + 21a , $x ) ( $ts + 22a , $x ) ( $ts + 23a , $x ) ( $ts + 24a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 35a , $x ) ( $ts + 36a , $x ) ( $ts + 37a , $x ) ( $ts + 38a , $x ) ( $ts + 39a , $x ) ( $ts + 40a , $x ) ( $ts + 41a , $x ) ( $ts + 42a , $x ) ( $ts + 43a , $x ) ( $ts + 44a , $x ) ( $ts + 45a , $x ) ( $ts + 46a , $x ) ( $ts + 47a , $x ) ( $ts + 48a , $x ) ( $ts + 49a , $x ) ( $ts + 50a , $x ) ( $ts + 51a , $x ) ( $ts + 52a , $x ) ( $ts + 53a , $x ) ( $ts + 54a , $x ) ( $ts + 55a , $x ) ( $ts + 56a , $x ) ( $ts + 57a , $x ) ( $ts + 58a , $x ) ( $ts + 59a , $x ) - $x = $x + 60 - endw - $totalRows = $totalRows + $x - print info: inserted $x rows into $tb and totalRows: $totalRows - $i = $i + 1 -endw - -sql select count(*) from $stb -sleep 1000 -print data00 $data00 -if $data00 != $totalRows then - return -1 -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 select * from information_schema.ins_dnodes -if $rows != 5 then - sleep 2000 - goto wait_dnode4_offline_0 -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 -$dnode1Status = $data4_1 -$dnode2Status = $data4_2 -$dnode3Status = $data4_3 -$dnode4Status = $data4_4 - -if $dnode4Status != offline then - sleep 2000 - goto wait_dnode4_offline_0 -endi - - -$loopCnt = 0 -wait_dnode4_vgroup_offline: -$loopCnt = $loopCnt + 1 -if $loopCnt == 10 then - return -1 -endi - -sql show vgroups -if $rows != 1 then - sleep 2000 - goto wait_dnode4_vgroup_offline -endi -print show vgroups: -print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 $data5_1 $data6_1 $data7_1 $data8_1 $data9_1 -print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 $data5_2 $data6_2 $data7_2 $data8_2 $data9_2 -print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3 $data5_3 $data6_3 $data7_3 $data8_3 $data9_3 -$dnode4Vtatus = $data5_2 -$dnode3Vtatus = $data7_2 - -if $dnode4Vtatus != offline then - sleep 2000 - goto wait_dnode4_vgroup_offline -endi -if $dnode3Vtatus != master then - sleep 2000 - goto wait_dnode4_vgroup_offline -endi - -system rm -rf ../../../sim/dnode4/data/vnode/* - -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 select * from information_schema.ins_dnodes -if $rows != 5 then - sleep 2000 - goto wait_dnode4_reready -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 -$dnode1Status = $data4_1 -$dnode2Status = $data4_2 -$dnode3Status = $data4_3 -$dnode4Status = $data4_4 - -if $dnode4Status != ready then - sleep 2000 - 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 - goto wait_dnode4_vgroup_slave -endi -print show vgroups: -print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 $data5_1 $data6_1 $data7_1 $data8_1 $data9_1 -print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 $data5_2 $data6_2 $data7_2 $data8_2 $data9_2 -print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3 $data5_3 $data6_3 $data7_3 $data8_3 $data9_3 -$dnode4Vtatus = $data5_2 -$dnode3Vtatus = $data7_2 - -print dnode4Vtatus: $dnode4Vtatus -print dnode3Vtatus: $dnode3Vtatus -if $dnode4Vtatus != slave then - sleep 2000 - goto wait_dnode4_vgroup_slave -endi -if $dnode3Vtatus != master then - sleep 2000 - goto wait_dnode4_vgroup_slave -endi - -print ============== step5: stop dnode3, and remove its vnodeX subdirector -system sh/exec.sh -n dnode3 -s stop -x SIGINT -sleep $sleepTimer - -$loopCnt = 0 -wait_dnode3_offline: -$loopCnt = $loopCnt + 1 -if $loopCnt == 10 then - return -1 -endi - -sql select * from information_schema.ins_dnodes -if $rows != 5 then - sleep 2000 - goto wait_dnode3_offline -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 -$dnode1Status = $data4_1 -$dnode2Status = $data4_2 -$dnode3Status = $data4_3 -$dnode4Status = $data4_4 - -if $dnode2Status != ready then - sleep 2000 - goto wait_dnode3_offline -endi -if $dnode3Status != offline then - sleep 2000 - goto wait_dnode3_offline -endi -if $dnode4Status != ready then - sleep 2000 - goto wait_dnode3_offline -endi - -system rm -rf ../../../sim/dnode3/data/vnode/* - -print ============== step6: restart dnode3, and check rows -system sh/exec.sh -n dnode3 -s start -sleep $sleepTimer - -$loopCnt = 0 -wait_dnode3_reready: -$loopCnt = $loopCnt + 1 -if $loopCnt == 10 then - return -1 -endi - -sql select * from information_schema.ins_dnodes -if $rows != 5 then - sleep 2000 - goto wait_dnode3_reready -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 -$dnode1Status = $data4_1 -$dnode2Status = $data4_2 -$dnode3Status = $data4_3 -$dnode4Status = $data4_4 - -if $dnode3Status != ready then - sleep 2000 - goto wait_dnode3_reready -endi - -$loopCnt = 0 -wait_dnode3_vgroup_slave: -$loopCnt = $loopCnt + 1 -if $loopCnt == 10 then - return -1 -endi - -sql show vgroups -if $rows != 1 then - sleep 2000 - goto wait_dnode3_vgroup_slave -endi -print show vgroups: -print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 $data5_1 $data6_1 $data7_1 $data8_1 $data9_1 -print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 $data5_2 $data6_2 $data7_2 $data8_2 $data9_2 -print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3 $data5_3 $data6_3 $data7_3 $data8_3 $data9_3 -$dnode4Vtatus = $data5_2 -$dnode3Vtatus = $data7_2 - -print dnode4Vtatus: $dnode4Vtatus -print dnode3Vtatus: $dnode3Vtatus -if $dnode4Vtatus != master then - sleep 2000 - goto wait_dnode3_vgroup_slave -endi -if $dnode3Vtatus != slave then - sleep 2000 - goto wait_dnode3_vgroup_slave -endi - -# check using select -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - -sql insert into $tb values ( now , 20000 ) ( now + 1a, 20001 ) ( now + 2a, 20002 ) -$totalRows = $totalRows + 3 - -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - -print ============== step7: stop dnode2, and remove its vnodeX subdirector -system sh/exec.sh -n dnode2 -s stop -x SIGINT -sleep $sleepTimer - -$loopCnt = 0 -wait_dnode2_offline: -$loopCnt = $loopCnt + 1 -if $loopCnt == 10 then - return -1 -endi - -sql select * from information_schema.ins_dnodes -if $rows != 5 then - sleep 2000 - goto wait_dnode2_offline -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 -$dnode1Status = $data4_1 -$dnode2Status = $data4_2 -$dnode3Status = $data4_3 -$dnode4Status = $data4_4 - -if $dnode2Status != offline then - sleep 2000 - goto wait_dnode2_offline -endi -if $dnode3Status != ready then - sleep 2000 - goto wait_dnode2_offline -endi -if $dnode4Status != ready then - sleep 2000 - goto wait_dnode2_offline -endi - -system rm -rf ../../../sim/dnode2/data/vnode/* - -print ============== step8: restart dnode2, and check rows -system sh/exec.sh -n dnode2 -s start -sleep $sleepTimer - -$loopCnt = 0 -wait_dnode2_reready: -$loopCnt = $loopCnt + 1 -if $loopCnt == 10 then - return -1 -endi - -sql select * from information_schema.ins_dnodes -if $rows != 5 then - sleep 2000 - goto wait_dnode2_reready -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 -$dnode1Status = $data4_1 -$dnode2Status = $data4_2 -$dnode3Status = $data4_3 -$dnode4Status = $data4_4 - -if $dnode2Status != ready then - sleep 2000 - goto wait_dnode2_reready -endi - -$loopCnt = 0 -wait_dnode2_vgroup_slave: -$loopCnt = $loopCnt + 1 -if $loopCnt == 10 then - return -1 -endi - -sql show vgroups -if $rows != 1 then - sleep 2000 - goto wait_dnode2_vgroup_slave -endi -print show vgroups: -print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 $data5_1 $data6_1 $data7_1 $data8_1 $data9_1 -print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 $data5_2 $data6_2 $data7_2 $data8_2 $data9_2 -print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3 $data5_3 $data6_3 $data7_3 $data8_3 $data9_3 -$dnode4Vtatus = $data5_2 -$dnode3Vtatus = $data7_2 - -print dnode4Vtatus: $dnode4Vtatus -print dnode3Vtatus: $dnode3Vtatus -if $dnode4Vtatus != master then - sleep 2000 - goto wait_dnode2_vgroup_slave -endi -if $dnode3Vtatus != slave then - sleep 2000 - goto wait_dnode2_vgroup_slave -endi - -# check using select -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - -sql insert into $tb values ( now , 20000 ) ( now + 1a, 20001 ) ( now + 2a, 20002 ) -$totalRows = $totalRows + 3 - -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - - - - - - - - - - diff --git a/tests/script/tsim/backup/arbitrator/dn3_mn1_vnode_noCorruptFile_offline.sim b/tests/script/tsim/backup/arbitrator/dn3_mn1_vnode_noCorruptFile_offline.sim deleted file mode 100644 index 6448cc02b8..0000000000 --- a/tests/script/tsim/backup/arbitrator/dn3_mn1_vnode_noCorruptFile_offline.sim +++ /dev/null @@ -1,434 +0,0 @@ -system sh/stop_dnodes.sh -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -system sh/deploy.sh -n dnode3 -i 3 -system sh/deploy.sh -n dnode4 -i 4 - -system sh/cfg.sh -n dnode1 -c 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 dnode1 -c walLevel -v 2 -system sh/cfg.sh -n dnode2 -c walLevel -v 2 -system sh/cfg.sh -n dnode3 -c walLevel -v 2 -system sh/cfg.sh -n dnode4 -c walLevel -v 2 - -system sh/cfg.sh -n dnode1 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode2 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode3 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode4 -c balanceInterval -v 10 - -system sh/cfg.sh -n dnode1 -c role -v 1 -system sh/cfg.sh -n dnode2 -c role -v 2 -system sh/cfg.sh -n dnode3 -c role -v 2 -system sh/cfg.sh -n dnode4 -c role -v 2 - -$totalTableNum = 10 -system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v $totalTableNum -system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v $totalTableNum -system sh/cfg.sh -n dnode3 -c maxtablesPerVnode -v $totalTableNum -system sh/cfg.sh -n dnode4 -c maxtablesPerVnode -v $totalTableNum - -system sh/cfg.sh -n dnode1 -c maxVgroupsPerDb -v 1 -system sh/cfg.sh -n dnode2 -c maxVgroupsPerDb -v 1 -system sh/cfg.sh -n dnode3 -c maxVgroupsPerDb -v 1 -system sh/cfg.sh -n dnode4 -c maxVgroupsPerDb -v 1 - -system sh/cfg.sh -n dnode1 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode2 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode3 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode4 -c arbitrator -v $arbitrator - -print ============== step0: start tarbitrator -system sh/exec_tarbitrator.sh -s start - -print ============== step1: start dnode1, only deploy mnode -system sh/exec.sh -n dnode1 -s start -sleep 2000 -sql connect - -print ============== step2: start dnode2/dnode3 and add into cluster , then create database with replica 2, and create table, insert data -system sh/exec.sh -n dnode2 -s start -system sh/exec.sh -n dnode3 -s start -#system sh/exec.sh -n dnode4 -s start -sql create dnode $hostname2 -sql create dnode $hostname3 -#sql create dnode $hostname4 -sleep 2000 - -$totalTableNum = 10 -$sleepTimer = 3000 - -$db = db -sql create database $db replica 2 -sql use $db - -# create table , insert data -$stb = stb -sql create table $stb (ts timestamp, c1 int) tags(t1 int) -$rowNum = 100 -$tblNum = $totalTableNum -$totalRows = 0 -$tsStart = 1420041600000 - -$i = 0 -while $i < $tblNum - $tb = tb . $i - sql create table $tb using $stb tags( $i ) - - $x = 0 - while $x < $rowNum - $ts = $tsStart + $x - sql insert into $tb values ( $ts + 0a , $x ) ( $ts + 1a , $x ) ( $ts + 2a , $x ) ( $ts + 3a , $x ) ( $ts + 4a , $x ) ( $ts + 5a , $x ) ( $ts + 6a , $x ) ( $ts + 7a , $x ) ( $ts + 8a , $x ) ( $ts + 9a , $x ) ( $ts + 10a , $x ) ( $ts + 11a , $x ) ( $ts + 12a , $x ) ( $ts + 13a , $x ) ( $ts + 14a , $x ) ( $ts + 15a , $x ) ( $ts + 16a , $x ) ( $ts + 17a , $x ) ( $ts + 18a , $x ) ( $ts + 19a , $x ) ( $ts + 20a , $x ) ( $ts + 21a , $x ) ( $ts + 22a , $x ) ( $ts + 23a , $x ) ( $ts + 24a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 35a , $x ) ( $ts + 36a , $x ) ( $ts + 37a , $x ) ( $ts + 38a , $x ) ( $ts + 39a , $x ) ( $ts + 40a , $x ) ( $ts + 41a , $x ) ( $ts + 42a , $x ) ( $ts + 43a , $x ) ( $ts + 44a , $x ) ( $ts + 45a , $x ) ( $ts + 46a , $x ) ( $ts + 47a , $x ) ( $ts + 48a , $x ) ( $ts + 49a , $x ) ( $ts + 50a , $x ) ( $ts + 51a , $x ) ( $ts + 52a , $x ) ( $ts + 53a , $x ) ( $ts + 54a , $x ) ( $ts + 55a , $x ) ( $ts + 56a , $x ) ( $ts + 57a , $x ) ( $ts + 58a , $x ) ( $ts + 59a , $x ) - $x = $x + 60 - endw - $totalRows = $totalRows + $x - print info: inserted $x rows into $tb and totalRows: $totalRows - $i = $i + 1 -endw - -sql select count(*) from $stb -sleep 1000 -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - -print ============== step3: stop dnode3 for falling disc, then corrupt vnode data file in dnode3 -system sh/exec.sh -n dnode3 -s stop -x SIGINT -sleep $sleepTimer - -$loopCnt = 0 -wait_dnode3_offline_0: -$loopCnt = $loopCnt + 1 -if $loopCnt == 10 then - return -1 -endi - -sql select * from information_schema.ins_dnodes -if $rows != 4 then - sleep 2000 - goto wait_dnode3_offline_0 -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 -#$dnode1Status = $data4_1 -$dnode2Status = $data4_2 -$dnode3Status = $data4_3 -$dnode4Status = $data4_4 -#$dnode5Status = $data4_5 - -if $dnode3Status != offline then - sleep 2000 - goto wait_dnode3_offline_0 -endi - -$loopCnt = 0 -wait_dnode3_vgroup_offline: -$loopCnt = $loopCnt + 1 -if $loopCnt == 10 then - return -1 -endi - -sql show vgroups -if $rows != 1 then - sleep 2000 - goto wait_dnode3_vgroup_offline -endi -print show vgroups: -print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 $data5_1 $data6_1 $data7_1 $data8_1 $data9_1 -print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 $data5_2 $data6_2 $data7_2 $data8_2 $data9_2 -print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3 $data5_3 $data6_3 $data7_3 $data8_3 $data9_3 -$dnode3Vtatus = $data5_2 -$dnode2Vtatus = $data7_2 - -if $dnode3Vtatus != offline then - sleep 2000 - goto wait_dnode3_vgroup_offline -endi -if $dnode2Vtatus != master then - sleep 2000 - goto wait_dnode3_vgroup_offline -endi - -#$expectCnt = 3 . : -#print expectCnt: [ $expectCnt ] -#system_content ls ../../../sim/dnode3/data/vnode/vnode2/tsdb/data/ -l | grep "^-" | wc -l | tr '\n' ':' -#system_content ls ../../../sim/dnode3/data/vnode/vnode2/tsdb/data/ -l | grep "^-" | wc -l | tr '\n' ':' -#print --2-->dnode3 data files: [ $system_content ] - - -system_content ls ../../../sim/dnode2/data/vnode/vnode2/tsdb/data/ -l | grep "^-" | wc -l | tr -d '\n' -print ---->dnode2 data files: $system_content expect: 0 -if $system_content != 0 then - return -1 -endi - -system_content ls ../../../sim/dnode3/data/vnode/vnode2/tsdb/data/ -l | grep "^-" | wc -l | tr -d '\n' -print ---->dnode3 data files: $system_content expect: 3 -if $system_content != 3 then - return -1 -endi - -#system echo "haha, nothing......" > ../../../sim/dnode3/data/vnode/vnode2/tsdb/data/f1643.data - -print ============== step3-1: insert some news data for let version changed -sql insert into $tb values ( now + 0a , $x ) ( now + 1a , $x ) ( now + 2a , $x ) -sql insert into $tb values ( now + 10a , $x ) ( now + 11a , $x ) ( now + 12a , $x ) -$totalRows = $totalRows + 6 -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - -print ============== step4: restart dnode3, and run query -system sh/exec.sh -n dnode3 -s start -sleep $sleepTimer -$loopCnt = 0 -wait_dnode3_reready: -$loopCnt = $loopCnt + 1 -if $loopCnt == 10 then - return -1 -endi - -sql select * from information_schema.ins_dnodes -if $rows != 4 then - sleep 2000 - goto wait_dnode3_reready -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 -#$dnode1Status = $data4_1 -$dnode2Status = $data4_2 -$dnode3Status = $data4_3 -$dnode4Status = $data4_4 -#$dnode5Status = $data4_5 - -if $dnode3Status != ready then - sleep 2000 - goto wait_dnode3_reready -endi -$loopCnt = 0 -wait_dnode3_vgroup_slave: -$loopCnt = $loopCnt + 1 -if $loopCnt == 10 then - return -1 -endi - -sql show vgroups -if $rows != 1 then - sleep 2000 - goto wait_dnode3_vgroup_slave -endi -print show vgroups: -print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 $data5_1 $data6_1 $data7_1 $data8_1 $data9_1 -print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 $data5_2 $data6_2 $data7_2 $data8_2 $data9_2 -print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3 $data5_3 $data6_3 $data7_3 $data8_3 $data9_3 -$dnode2Vtatus = $data7_2 -$dnode3Vtatus = $data5_2 - -if $dnode2Vtatus != master then - sleep 2000 - goto wait_dnode3_vgroup_slave -endi -if $dnode3Vtatus != slave then - sleep 2000 - goto wait_dnode3_vgroup_slave -endi - -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - -system_content ls ../../../sim/dnode2/data/vnode/vnode2/tsdb/data/ -l |grep "^-"|wc -l | tr -d '\n' -print ----> dnode2 data files: $system_content expect: 0 -if $system_content != 0 then - return -1 -endi - -system_content ls ../../../sim/dnode3/data/vnode/vnode2/tsdb/data/ -l |grep "^-"|wc -l | tr -d '\n' -print ----> dnode3 data files: $system_content expect: 0 -if $system_content != 0 then - print there should be no data file in dnode3 after sync - return -1 -endi - -print ============== step5: stop dnode2, and check if dnode3 sync ok -system sh/exec.sh -n dnode2 -s stop -x SIGINT -sleep $sleepTimer - -$loopCnt = 0 -wait_dnode2_offline_0: -$loopCnt = $loopCnt + 1 -if $loopCnt == 10 then - return -1 -endi -sql select * from information_schema.ins_dnodes -if $rows != 4 then - sleep 2000 - goto wait_dnode2_offline_0 -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 -#$dnode1Status = $data4_1 -$dnode2Status = $data4_2 -$dnode3Status = $data4_3 -$dnode4Status = $data4_4 -#$dnode5Status = $data4_5 - -if $dnode2Status != offline then - sleep 2000 - goto wait_dnode2_offline_0 -endi - -$loopCnt = 0 -wait_dnode3_vgroup_master: -$loopCnt = $loopCnt + 1 -if $loopCnt == 10 then - return -1 -endi - -sql show vgroups -if $rows != 1 then - sleep 2000 - goto wait_dnode3_vgroup_master -endi -print show vgroups: -print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 $data5_1 $data6_1 $data7_1 $data8_1 $data9_1 -print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 $data5_2 $data6_2 $data7_2 $data8_2 $data9_2 -print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3 $data5_3 $data6_3 $data7_3 $data8_3 $data9_3 -$dnode2Vtatus = $data7_2 -$dnode3Vtatus = $data5_2 - -if $dnode2Vtatus != offline then - sleep 2000 - goto wait_dnode3_vgroup_master -endi -if $dnode3Vtatus != master then - sleep 2000 - goto wait_dnode3_vgroup_master -endi - -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - -print ============== step6: stop dnode3 for falling disck -system sh/exec.sh -n dnode3 -s stop -x SIGINT -sleep $sleepTimer -sql select * from information_schema.ins_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 - -sql show vgroups -print show vgroups: -print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 $data5_1 $data6_1 $data7_1 $data8_1 $data9_1 -print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 $data5_2 $data6_2 $data7_2 $data8_2 $data9_2 -print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3 $data5_3 $data6_3 $data7_3 $data8_3 $data9_3 - - -print ============== step7: restart dnode2/dnode3, and run query -system sh/exec.sh -n dnode2 -s start -system sh/exec.sh -n dnode3 -s start -sleep $sleepTimer -$loopCnt = 0 -wait_dnode23_reready_2: -$loopCnt = $loopCnt + 1 -if $loopCnt == 10 then - return -1 -endi -sql select * from information_schema.ins_dnodes -if $rows != 4 then - sleep 2000 - goto wait_dnode23_reready_2 -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 -$dnode1Status = $data4_1 -$dnode2Status = $data4_2 -$dnode3Status = $data4_3 - -if $dnode2Status != ready then - sleep 2000 - goto wait_dnode23_reready_2 -endi -if $dnode3Status != ready then - sleep 2000 - goto wait_dnode23_reready_2 -endi - -$loopCnt = 0 -wait_dnode23_vgroup_ok: -$loopCnt = $loopCnt + 1 -if $loopCnt == 10 then - return -1 -endi -sql show vgroups -if $rows != 1 then - sleep 2000 - goto wait_dnode23_vgroup_ok -endi -print show vgroups: -print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 $data5_1 $data6_1 $data7_1 $data8_1 $data9_1 -print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 $data5_2 $data6_2 $data7_2 $data8_2 $data9_2 -print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3 $data5_3 $data6_3 $data7_3 $data8_3 $data9_3 -$dnode2Vtatus = $data7_2 -$dnode3Vtatus = $data5_2 - -if $dnode2Vtatus == offline then - sleep 2000 - goto wait_dnode23_vgroup_ok -endi -if $dnode3Vtatus == offline then - sleep 2000 - goto wait_dnode23_vgroup_ok -endi - -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/script/tsim/backup/arbitrator/dn3_mn1_vnode_nomaster.sim b/tests/script/tsim/backup/arbitrator/dn3_mn1_vnode_nomaster.sim deleted file mode 100644 index f8ca114437..0000000000 --- a/tests/script/tsim/backup/arbitrator/dn3_mn1_vnode_nomaster.sim +++ /dev/null @@ -1,299 +0,0 @@ -system sh/stop_dnodes.sh -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -system sh/deploy.sh -n dnode3 -i 3 -system sh/deploy.sh -n dnode4 -i 4 - -system sh/cfg.sh -n dnode1 -c 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 dnode1 -c walLevel -v 2 -system sh/cfg.sh -n dnode2 -c walLevel -v 2 -system sh/cfg.sh -n dnode3 -c walLevel -v 2 -system sh/cfg.sh -n dnode4 -c walLevel -v 2 - -system sh/cfg.sh -n dnode1 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode2 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode3 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode4 -c balanceInterval -v 10 - -system sh/cfg.sh -n dnode1 -c role -v 1 -system sh/cfg.sh -n dnode2 -c role -v 2 -system sh/cfg.sh -n dnode3 -c role -v 2 -system sh/cfg.sh -n dnode4 -c role -v 2 - -system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 4 -system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v 4 -system sh/cfg.sh -n dnode3 -c maxtablesPerVnode -v 4 -system sh/cfg.sh -n dnode4 -c maxtablesPerVnode -v 4 - -$totalTableNum = 10 -system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 20 -system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v 20 -system sh/cfg.sh -n dnode3 -c maxtablesPerVnode -v 20 -system sh/cfg.sh -n dnode4 -c maxtablesPerVnode -v 20 - -system sh/cfg.sh -n dnode1 -c maxVgroupsPerDb -v 1 -system sh/cfg.sh -n dnode2 -c maxVgroupsPerDb -v 1 -system sh/cfg.sh -n dnode3 -c maxVgroupsPerDb -v 1 -system sh/cfg.sh -n dnode4 -c maxVgroupsPerDb -v 1 - -system sh/cfg.sh -n dnode1 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode2 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode3 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode4 -c arbitrator -v $arbitrator - -print ============== step0: start tarbitrator -system sh/exec_tarbitrator.sh -s start - -print ============== step1: start dnode1, only deploy mnode -system sh/exec.sh -n dnode1 -s start -sleep 2000 -sql connect - -print ============== step2: start dnode2/dnode3/dnode4 and add into cluster , then create database with replica 3, and create table, insert data -system sh/exec.sh -n dnode2 -s start -system sh/exec.sh -n dnode3 -s start -system sh/exec.sh -n dnode4 -s start -sql create dnode $hostname2 -sql create dnode $hostname3 -sql create dnode $hostname4 -sleep 2000 - -$sleepTimer = 3000 - -$db = db -sql create database $db replica 3 -sql use $db - -# create table , insert data -$stb = stb -sql create table $stb (ts timestamp, c1 int) tags(t1 int) -$rowNum = 100 -$tblNum = $totalTableNum -$totalRows = 0 -$tsStart = 1420041600000 - -$i = 0 -while $i < $tblNum - $tb = tb . $i - sql create table $tb using $stb tags( $i ) - - $x = 0 - while $x < $rowNum - $ts = $tsStart + $x - sql insert into $tb values ( $ts + 0a , $x ) ( $ts + 1a , $x ) ( $ts + 2a , $x ) ( $ts + 3a , $x ) ( $ts + 4a , $x ) ( $ts + 5a , $x ) ( $ts + 6a , $x ) ( $ts + 7a , $x ) ( $ts + 8a , $x ) ( $ts + 9a , $x ) ( $ts + 10a , $x ) ( $ts + 11a , $x ) ( $ts + 12a , $x ) ( $ts + 13a , $x ) ( $ts + 14a , $x ) ( $ts + 15a , $x ) ( $ts + 16a , $x ) ( $ts + 17a , $x ) ( $ts + 18a , $x ) ( $ts + 19a , $x ) ( $ts + 20a , $x ) ( $ts + 21a , $x ) ( $ts + 22a , $x ) ( $ts + 23a , $x ) ( $ts + 24a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 35a , $x ) ( $ts + 36a , $x ) ( $ts + 37a , $x ) ( $ts + 38a , $x ) ( $ts + 39a , $x ) ( $ts + 40a , $x ) ( $ts + 41a , $x ) ( $ts + 42a , $x ) ( $ts + 43a , $x ) ( $ts + 44a , $x ) ( $ts + 45a , $x ) ( $ts + 46a , $x ) ( $ts + 47a , $x ) ( $ts + 48a , $x ) ( $ts + 49a , $x ) ( $ts + 50a , $x ) ( $ts + 51a , $x ) ( $ts + 52a , $x ) ( $ts + 53a , $x ) ( $ts + 54a , $x ) ( $ts + 55a , $x ) ( $ts + 56a , $x ) ( $ts + 57a , $x ) ( $ts + 58a , $x ) ( $ts + 59a , $x ) - $x = $x + 60 - endw - $totalRows = $totalRows + $x - print info: inserted $x rows into $tb and totalRows: $totalRows - $i = $i + 1 -endw - -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - -print ============== step3: stop dnode4/dnode2 -system sh/exec.sh -n dnode4 -s stop -x SIGINT -system sh/exec.sh -n dnode2 -s stop -x SIGINT -sleep $sleepTimer - -$loopCnt = 0 -wait_dnode4_offline_0: -$loopCnt = $loopCnt + 1 -if $loopCnt == 10 then - return -1 -endi -sql select * from information_schema.ins_dnodes -if $rows != 5 then - sleep 2000 - goto wait_dnode4_offline_0 -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 -#$dnode1Status = $data4_1 -$dnode2Status = $data4_2 -$dnode3Status = $data4_3 -$dnode4Status = $data4_4 -#$dnode5Status = $data4_5 - -if $dnode4Status != offline then - sleep 2000 - goto wait_dnode4_offline_0 -endi -if $dnode2Status != offline then - sleep 2000 - goto wait_dnode4_offline_0 -endi - -$loopCnt = 0 -wait_dnode4_vgroup_offline: -$loopCnt = $loopCnt + 1 -if $loopCnt == 10 then - return -1 -endi - -sql show vgroups -if $rows != 1 then - sleep 2000 - goto wait_dnode4_vgroup_offline -endi -print show vgroups: -print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 $data5_1 $data6_1 $data7_1 $data8_1 $data9_1 -print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 $data5_2 $data6_2 $data7_2 $data8_2 $data9_2 -print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3 $data5_3 $data6_3 $data7_3 $data8_3 $data9_3 -$dnode4Vtatus = $data5_2 -$dnode3Vtatus = $data7_2 - -if $dnode4Vtatus != offline then - sleep 2000 - goto wait_dnode4_vgroup_offline -endi -if $dnode3Vtatus != unsynced then - sleep 2000 - goto wait_dnode4_vgroup_offline -endi - -sql select count(*) from $stb -x s31 -s31: -#sql_error insert into $tb values (now, 9988) -x s32 -#s32: - -print ============== step4: restart dnode2, then create database with replica 2, and create table, insert data -system sh/exec.sh -n dnode2 -s start -sleep 2000 - -$totalTableNum = 10 -$sleepTimer = 3000 - -$db = db1 -sql create database $db replica 2 -sql use $db - -# create table , insert data -$stb = stb -sql create table $stb (ts timestamp, c1 int) tags(t1 int) -$rowNum = 100 -$tblNum = $totalTableNum -$totalRows = 0 -$tsStart = 1420041600000 - -$i = 0 -while $i < $tblNum - $tb = tb . $i - sql create table $tb using $stb tags( $i ) - - $x = 0 - while $x < $rowNum - $ts = $tsStart + $x - sql insert into $tb values ( $ts + 0a , $x ) ( $ts + 1a , $x ) ( $ts + 2a , $x ) ( $ts + 3a , $x ) ( $ts + 4a , $x ) ( $ts + 5a , $x ) ( $ts + 6a , $x ) ( $ts + 7a , $x ) ( $ts + 8a , $x ) ( $ts + 9a , $x ) ( $ts + 10a , $x ) ( $ts + 11a , $x ) ( $ts + 12a , $x ) ( $ts + 13a , $x ) ( $ts + 14a , $x ) ( $ts + 15a , $x ) ( $ts + 16a , $x ) ( $ts + 17a , $x ) ( $ts + 18a , $x ) ( $ts + 19a , $x ) ( $ts + 20a , $x ) ( $ts + 21a , $x ) ( $ts + 22a , $x ) ( $ts + 23a , $x ) ( $ts + 24a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 35a , $x ) ( $ts + 36a , $x ) ( $ts + 37a , $x ) ( $ts + 38a , $x ) ( $ts + 39a , $x ) ( $ts + 40a , $x ) ( $ts + 41a , $x ) ( $ts + 42a , $x ) ( $ts + 43a , $x ) ( $ts + 44a , $x ) ( $ts + 45a , $x ) ( $ts + 46a , $x ) ( $ts + 47a , $x ) ( $ts + 48a , $x ) ( $ts + 49a , $x ) ( $ts + 50a , $x ) ( $ts + 51a , $x ) ( $ts + 52a , $x ) ( $ts + 53a , $x ) ( $ts + 54a , $x ) ( $ts + 55a , $x ) ( $ts + 56a , $x ) ( $ts + 57a , $x ) ( $ts + 58a , $x ) ( $ts + 59a , $x ) - $x = $x + 60 - endw - $totalRows = $totalRows + $x - print info: inserted $x rows into $tb and totalRows: $totalRows - $i = $i + 1 -endw - -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - -print ============== step5: stop dnode3 -system sh/exec.sh -n dnode3 -s stop -x SIGINT -sleep $sleepTimer -$loopCnt = 0 -wait_dnode3_offline_0: -$loopCnt = $loopCnt + 1 -if $loopCnt == 10 then - return -1 -endi -sql select * from information_schema.ins_dnodes -if $rows != 5 then - sleep 2000 - goto wait_dnode3_offline_0 -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 - -$dnode1Status = $data4_1 -$dnode2Status = $data4_2 -$dnode3Status = $data4_3 -$dnode4Status = $data4_4 -print dnode1Status $dnode1Status -print dnode2Status $dnode2Status -print dnode3Status $dnode3Status -print dnode4Status $dnode4Status - -if $dnode3Status != offline then - sleep 2000 - goto wait_dnode3_offline_0 -endi -if $dnode2Status != ready then - sleep 2000 - goto wait_dnode3_offline_0 -endi - -$loopCnt = 0 -wait_dnode2_vgroup_master: -$loopCnt = $loopCnt + 1 -if $loopCnt == 10 then - return -1 -endi -sql show vgroups -if $rows != 1 then - sleep 2000 - goto wait_dnode2_vgroup_master -endi -print show vgroups: -print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 $data5_1 $data6_1 $data7_1 $data8_1 $data9_1 -print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 $data5_2 $data6_2 $data7_2 $data8_2 $data9_2 -print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3 $data5_3 $data6_3 $data7_3 $data8_3 $data9_3 -$dnode3Vtatus = $data5_3 -$dnode2Vtatus = $data7_3 - -if $dnode3Vtatus != offline then - sleep 2000 - goto wait_dnode2_vgroup_master -endi -if $dnode2Vtatus != master then - sleep 2000 - goto wait_dnode2_vgroup_master -endi - -sql insert into $tb values (now, 9000) (now + 1s, 9001) (now + 2s, 9002) -$totalRows = $totalRows + 3 -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - - - - - - - - - - - - - - - - - diff --git a/tests/script/tsim/backup/arbitrator/dn3_mn2_killDnode.sim b/tests/script/tsim/backup/arbitrator/dn3_mn2_killDnode.sim deleted file mode 100644 index 92731c2202..0000000000 --- a/tests/script/tsim/backup/arbitrator/dn3_mn2_killDnode.sim +++ /dev/null @@ -1,122 +0,0 @@ -system sh/stop_dnodes.sh -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -system sh/deploy.sh -n dnode3 -i 3 -system sh/deploy.sh -n dnode4 -i 4 - -system sh/cfg.sh -n dnode1 -c numOfMnodes -v 2 -system sh/cfg.sh -n dnode2 -c numOfMnodes -v 2 -system sh/cfg.sh -n dnode3 -c numOfMnodes -v 2 -system sh/cfg.sh -n dnode3 -c numOfMnodes -v 2 - -system sh/cfg.sh -n dnode1 -c walLevel -v 2 -system sh/cfg.sh -n dnode2 -c walLevel -v 2 -system sh/cfg.sh -n dnode3 -c walLevel -v 2 -system sh/cfg.sh -n dnode4 -c walLevel -v 2 - -system sh/cfg.sh -n dnode1 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode2 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode3 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode4 -c balanceInterval -v 10 - -#system sh/cfg.sh -n dnode1 -c role -v 2 -#system sh/cfg.sh -n dnode2 -c role -v 2 -#system sh/cfg.sh -n dnode3 -c role -v 2 -#system sh/cfg.sh -n dnode4 -c role -v 2 - -system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 4 -system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v 4 -system sh/cfg.sh -n dnode3 -c maxtablesPerVnode -v 4 -system sh/cfg.sh -n dnode4 -c maxtablesPerVnode -v 4 - -system sh/cfg.sh -n dnode1 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode2 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode3 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode4 -c arbitrator -v $arbitrator - -print ============== step0: start tarbitrator -system sh/exec_tarbitrator.sh -s start - -print ============== step1: start dnode1, only deploy mnode -system sh/exec.sh -n dnode1 -s start -sleep 2000 -sql connect - -print ============== step2: start dnode2/dnode3 and add into cluster , then create database with replica 3, and create table to max tables -system sh/exec.sh -n dnode2 -s start -system sh/exec.sh -n dnode3 -s start -#system sh/exec.sh -n dnode4 -s start -sql create dnode $hostname2 -sleep 2000 -sql create dnode $hostname3 -#sql create dnode $hostname4 -sleep 2000 - -$totalTableNum = 4 -$sleepTimer = 3000 - -$db = db -sql create database $db replica 3 -sql use $db - -# create table , insert data -$stb = stb -sql create table $stb (ts timestamp, c1 int) tags(t1 int) -$rowNum = 10 -$tblNum = $totalTableNum -$totalRows = 0 -$tsStart = 1420041600000 - -$i = 0 -while $i < $tblNum - $tb = tb . $i - sql create table $tb using $stb tags( $i ) - - $x = 0 - while $x < $rowNum - $ts = $tsStart + $x - sql insert into $tb values ( $ts + 0a , $x ) ( $ts + 1a , $x ) ( $ts + 2a , $x ) ( $ts + 3a , $x ) ( $ts + 4a , $x ) ( $ts + 5a , $x ) ( $ts + 6a , $x ) ( $ts + 7a , $x ) ( $ts + 8a , $x ) ( $ts + 9a , $x ) - $x = $x + 10 - endw - $totalRows = $totalRows + $x - print info: inserted $x rows into $tb and totalRows: $totalRows - $i = $i + 1 -endw - -sql select count(*) from $stb -print data00:$data00 totalRows:$totalRows -if $data00 != $totalRows then - return -1 -endi - - -print ============== step3: stop dnode2 -system sh/exec.sh -n dnode2 -s stop -sleep 2000 - -sql select * from information_schema.ins_mnodes -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 -$mnode1Status = $data2_1 -$mnode2Status = $data2_2 -$mnode3Status = $data2_3 -#$mnode4Status = $data2_4 - -if $mnode1Status != master then - return -1 -endi - -if $mnode2Status != offline then - return -1 -endi - -sql reset query cache -sql select count(*) from $stb -print data00:$data00 totalRows:$totalRows -if $data00 != $totalRows then - return -1 -endi - - diff --git a/tests/script/tsim/backup/arbitrator/insert_duplicationTs.sim b/tests/script/tsim/backup/arbitrator/insert_duplicationTs.sim deleted file mode 100644 index 1e439f1605..0000000000 --- a/tests/script/tsim/backup/arbitrator/insert_duplicationTs.sim +++ /dev/null @@ -1,293 +0,0 @@ -# Test case describe: dnode1 is only mnode, dnode2/dnode3 are only vnode -# step 1: start dnode1 -# step 2: start dnode2 and dnode3, and all added into cluster (Suppose dnode2 is master-vnode) -# step 3: create db, table, insert data, and Falling disc into file (control only one file, e.g. 1841) -# step 4: insert old data(now-15d) and new data(now+15d), control data rows in order to save in cache, not falling disc -# step 5: stop dnode2, so date rows falling disc, generate two new files 1840, 1842 in dnode2 -# step 6: insert two data rows: now-16d, now+16d -# step 7: restart dnode2, waiting sync end -# expect: in dnode2, the files 1840 and 1842 will be removed - -system sh/stop_dnodes.sh -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -system sh/deploy.sh -n dnode3 -i 3 -system sh/deploy.sh -n dnode4 -i 4 - -system sh/cfg.sh -n dnode1 -c 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 dnode1 -c walLevel -v 2 -system sh/cfg.sh -n dnode2 -c walLevel -v 2 -system sh/cfg.sh -n dnode3 -c walLevel -v 2 -system sh/cfg.sh -n dnode4 -c walLevel -v 2 - -system sh/cfg.sh -n dnode1 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode2 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode3 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode4 -c balanceInterval -v 10 - -system sh/cfg.sh -n dnode1 -c role -v 1 -system sh/cfg.sh -n dnode2 -c role -v 2 -system sh/cfg.sh -n dnode3 -c role -v 2 -system sh/cfg.sh -n dnode4 -c role -v 2 - -system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 4 -system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v 4 -system sh/cfg.sh -n dnode3 -c maxtablesPerVnode -v 4 -system sh/cfg.sh -n dnode4 -c maxtablesPerVnode -v 4 - -system sh/cfg.sh -n dnode1 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode2 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode3 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode4 -c arbitrator -v $arbitrator - -print ============== step0: start tarbitrator -system sh/exec_tarbitrator.sh -s start - -print ============== step1: start dnode1, only deploy mnode -system sh/exec.sh -n dnode1 -s start -sleep 2000 -sql connect - -print ============== step2: start dnode2/dnode3 and add into cluster , then create database with replica 2, and create table, insert data -system sh/exec.sh -n dnode2 -s start -system sh/exec.sh -n dnode3 -s start -sql create dnode $hostname2 -sql create dnode $hostname3 -sleep 2000 - -$totalTableNum = 1 -$sleepTimer = 3000 - -$db = db -sql create database $db replica 2 cache 1 -sql use $db - -# create table , insert data -$stb = stb -sql create table $stb (ts timestamp, c1 double) tags(t1 int) -$rowNum = 130000 -$tblNum = $totalTableNum -$totalRows = 0 -$tsStart = 1577808000000 # 2020-01-01 00:00:00.000 - -# insert over 2M data in order to falling disc, generate one file -$i = 0 -while $i < $tblNum - $tb = tb . $i - sql create table $tb using $stb tags( $i ) - - $x = 0 - while $x < $rowNum -# $ts = $tsStart + $x - sql insert into $tb values ( now + 0s , $x ) ( now + 1s , $x ) ( now + 2s , $x ) ( now + 3s , $x ) ( now + 4s , $x ) ( now + 5s , $x ) ( now + 6s , $x ) ( now + 7s , $x ) ( now + 8s , $x ) ( now + 9s , $x ) - $x = $x + 10 - endw - $totalRows = $totalRows + $x - print info: inserted $x rows into $tb and totalRows: $totalRows - $i = $i + 1 -endw - -sql show db.vgroups; -print d1: $data04 $data05 , d2: $data06 $data07 - -sql select count(*) from $stb -print rtest1==> rows:$rows data00:$data00 -if $rows != 1 then - return -1 -endi - -if $data00 == 0 then - return -1 -endi - -$totalRows = $data00 - -sql select count(*) from $stb -print test2==> rows:$rows data00:$data00 -sql select count(*) from $stb -print test3==> rows:$rows data00:$data00 -sql select count(*) from $stb -print test4==> rows:$rows data00:$data00 -sql select count(*) from $stb -print test5==> rows:$rows data00:$data00 - -print ============== step3: insert old data(now-15d) and new data(now+15d), control data rows in order to save in cache, not falling disc -sql insert into $tb values ( now - 20d , -20 ) -sql insert into $tb values ( now - 40d , -40 ) -$totalRows = $totalRows + 2 - -print ============== step4: stop dnode2, so date rows falling disc, generate two new files in dnode2 -system sh/exec.sh -n dnode2 -s stop -x SIGINT -sleep $sleepTimer - -$loopCnt = 0 -wait_dnode2_offline: -$loopCnt = $loopCnt + 1 -if $loopCnt == 10 then - return -1 -endi - -sql select * from information_schema.ins_dnodes -if $rows != 4 then - sleep 2000 - goto wait_dnode2_offline -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 -#$dnode1Status = $data4_1 -$dnode2Status = $data4_2 -$dnode3Status = $data4_3 -#$dnode4Status = $data4_4 -#$dnode5Status = $data4_5 - -if $dnode2Status != offline then - sleep 2000 - goto wait_dnode2_offline -endi -if $dnode3Status != ready then - sleep 2000 - goto wait_dnode2_offline -endi - -sleep $sleepTimer # waitting for move master vnode of dnode2 to dnode3 -# check using select -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - -sql select count(*) from $stb -print data00 $data00 -sql select count(*) from $stb -print data00 $data00 -sql select count(*) from $stb -print data00 $data00 -sql select count(*) from $stb -print data00 $data00 - -print ============== step5: insert two data rows: now-16d, now+16d, -sql insert into $tb values ( now - 21d , -21 ) -sql insert into $tb values ( now - 41d , -41 ) -$totalRows = $totalRows + 2 - -print ============== step6: restart dnode2, waiting sync end -system sh/exec.sh -n dnode2 -s start -sleep 2000 -$loopCnt = 0 -wait_dnode2_ready: -$loopCnt = $loopCnt + 1 -if $loopCnt == 10 then - return -1 -endi - -sql select * from information_schema.ins_dnodes -if $rows != 4 then - sleep 2000 - goto wait_dnode2_ready -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 -#$dnode1Status = $data4_1 -$dnode2Status = $data4_2 -$dnode3Status = $data4_3 -#$dnode4Status = $data4_4 -#$dnode5Status = $data4_5 - -if $dnode2Status != ready then - sleep 2000 - goto wait_dnode2_ready -endi - -sleep $sleepTimer -# check using select -sleep 3000 -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi diff --git a/tests/script/tsim/backup/arbitrator/offline_replica2_alterTable_online.sim b/tests/script/tsim/backup/arbitrator/offline_replica2_alterTable_online.sim deleted file mode 100644 index f93332a21a..0000000000 --- a/tests/script/tsim/backup/arbitrator/offline_replica2_alterTable_online.sim +++ /dev/null @@ -1,217 +0,0 @@ -system sh/stop_dnodes.sh -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -system sh/deploy.sh -n dnode3 -i 3 -system sh/deploy.sh -n dnode4 -i 4 - -system sh/cfg.sh -n dnode1 -c 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 dnode1 -c walLevel -v 2 -system sh/cfg.sh -n dnode2 -c walLevel -v 2 -system sh/cfg.sh -n dnode3 -c walLevel -v 2 -system sh/cfg.sh -n dnode4 -c walLevel -v 2 - -system sh/cfg.sh -n dnode1 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode2 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode3 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode4 -c balanceInterval -v 10 - -system sh/cfg.sh -n dnode1 -c role -v 1 -system sh/cfg.sh -n dnode2 -c role -v 2 -system sh/cfg.sh -n dnode3 -c role -v 2 -system sh/cfg.sh -n dnode4 -c role -v 2 - -$totalTableNum = 10 -system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v $totalTableNum -system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v $totalTableNum -system sh/cfg.sh -n dnode3 -c maxtablesPerVnode -v $totalTableNum -system sh/cfg.sh -n dnode4 -c maxtablesPerVnode -v $totalTableNum - -system sh/cfg.sh -n dnode1 -c maxVgroupsPerDb -v 1 -system sh/cfg.sh -n dnode2 -c maxVgroupsPerDb -v 1 -system sh/cfg.sh -n dnode3 -c maxVgroupsPerDb -v 1 -system sh/cfg.sh -n dnode4 -c maxVgroupsPerDb -v 1 - -system sh/cfg.sh -n dnode1 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode2 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode3 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode4 -c arbitrator -v $arbitrator - -print ============== step0: start tarbitrator -system sh/exec_tarbitrator.sh -s start - -print ============== step1: start dnode1, only deploy mnode -system sh/exec.sh -n dnode1 -s start -sleep 2000 -sql connect - -print ============== step2: start dnode2/dnode3/dnode4 and add into cluster , then create database with replica 2, and create table, insert data -system sh/exec.sh -n dnode2 -s start -#system sh/exec.sh -n dnode3 -s start -system sh/exec.sh -n dnode4 -s start -sql create dnode $hostname2 -#sql create dnode $hostname3 -sql create dnode $hostname4 -sleep 2000 - -$totalTableNum = 10 -$sleepTimer = 3000 - -$db = db -print create database $db replica 2 -sql create database $db replica 2 -sql use $db - -# create table , insert data -$stb = stb -sql create table $stb (ts timestamp, c1 int, c2 int) tags(t1 int) -$rowNum = 500 -$tblNum = $totalTableNum -$totalRows = 0 -$tsStart = 1420041600000 -$tsEnd = 0 - -$i = 0 -while $i < $tblNum - $tb = tb . $i - sql create table $tb using $stb tags( $i ) - - $x = 0 - while $x < $rowNum - $ts = $tsStart + $x - sql insert into $tb values ( $ts + 0a , $x , $x ) ( $ts + 1a , $x , $x ) ( $ts + 2a , $x , $x ) ( $ts + 3a , $x , $x ) ( $ts + 4a , $x , $x ) ( $ts + 5a , $x , $x ) ( $ts + 6a , $x , $x ) ( $ts + 7a , $x , $x ) ( $ts + 8a , $x , $x ) ( $ts + 9a , $x , $x ) ( $ts + 10a , $x , $x ) ( $ts + 11a , $x , $x ) ( $ts + 12a , $x , $x ) ( $ts + 13a , $x , $x ) ( $ts + 14a , $x , $x ) ( $ts + 15a , $x , $x ) ( $ts + 16a , $x , $x ) ( $ts + 17a , $x , $x ) ( $ts + 18a , $x , $x ) ( $ts + 19a , $x , $x ) - $x = $x + 20 - endw - $totalRows = $totalRows + $x - print info: inserted $x rows into $tb and totalRows: $totalRows - $i = $i + 1 -endw -$tsEnd = $tsStart + $totalRows / $tblNum - -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - -print ============== step3: stop dnode4 -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 select * from information_schema.ins_dnodes -if $rows != 4 then - sleep 2000 - goto wait_dnode4_offline_0 -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 -#$dnode1Status = $data4_1 -$dnode2Status = $data4_2 -#$dnode3Status = $data4_3 -$dnode4Status = $data4_3 -#$dnode5Status = $data4_5 - -if $dnode4Status != offline then - sleep 2000 - goto wait_dnode4_offline_0 -endi - -wait_dnode4_vgroup_offline: -sql show vgroups -if $rows != 1 then - sleep 2000 - goto wait_dnode4_vgroup_offline -endi -print show vgroups: -print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 $data5_1 $data6_1 $data7_1 $data8_1 $data9_1 -print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 $data5_2 $data6_2 $data7_2 $data8_2 $data9_2 -print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3 $data5_3 $data6_3 $data7_3 $data8_3 $data9_3 -$dnode4Vtatus = $data5_2 -$dnode3Vtatus = $data7_2 - -if $dnode4Vtatus != offline then - sleep 2000 - goto wait_dnode4_vgroup_offline -endi -if $dnode3Vtatus != master then - sleep 2000 - goto wait_dnode4_vgroup_offline -endi - -print ============== step4: alter table and insert more data rows -sql alter table $stb drop column c1 -sql alter table $stb add column f1 double - -$i = 0 -while $i < $tblNum - $tb = tb . $i - sql insert into $tb values (now, 10001, 1.0001) (now + 1s, 10002, 1.0002) (now + 2s, 10003, 1.0003) (now + 3s, 10004, 1.0004) - $i = $i + 1 -endw -$addRows = 4 * $tblNum -$totalRows = $totalRows + $addRows - -print ============== step5: restart dnode4, waiting dnode4 synced -system sh/exec.sh -n dnode4 -s start - -$loopCnt = 0 -wait_dnode4_ready: -$loopCnt = $loopCnt + 1 -if $loopCnt == 10 then - return -1 -endi -sql select * from information_schema.ins_dnodes -if $rows != 4 then - sleep 2000 - goto wait_dnode4_ready -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 -#$dnode1Status = $data4_1 -#$dnode2Status = $data4_2 -#$dnode3Status = $data4_3 -$dnode4Status = $data4_3 -#$dnode5Status = $data4_5 - -if $dnode4Status != ready then - sleep 2000 - goto wait_dnode4_ready -endi - -print ============== step6: check result - -sql reset query cache - -$cnt = 0 -wait_table_dropped: -$cnt = $cnt + 1 -if $cnt == 20 then - return -1 -endi -sql select count(*) from $stb -if $data00 != $totalRows then - print data00: $data00 totalRows: $totalRows - sleep 2000 - goto wait_table_dropped -endi - - - - diff --git a/tests/script/tsim/backup/arbitrator/offline_replica2_alterTag_online.sim b/tests/script/tsim/backup/arbitrator/offline_replica2_alterTag_online.sim deleted file mode 100644 index 873005daf5..0000000000 --- a/tests/script/tsim/backup/arbitrator/offline_replica2_alterTag_online.sim +++ /dev/null @@ -1,247 +0,0 @@ -system sh/stop_dnodes.sh -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -system sh/deploy.sh -n dnode3 -i 3 -system sh/deploy.sh -n dnode4 -i 4 - -system sh/cfg.sh -n dnode1 -c 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 dnode1 -c walLevel -v 2 -system sh/cfg.sh -n dnode2 -c walLevel -v 2 -system sh/cfg.sh -n dnode3 -c walLevel -v 2 -system sh/cfg.sh -n dnode4 -c walLevel -v 2 - -system sh/cfg.sh -n dnode1 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode2 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode3 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode4 -c balanceInterval -v 10 - -#system sh/cfg.sh -n dnode1 -c role -v 1 -#system sh/cfg.sh -n dnode2 -c role -v 2 -#system sh/cfg.sh -n dnode3 -c role -v 2 -#system sh/cfg.sh -n dnode4 -c role -v 2 - -$totalTableNum = 10 -system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v $totalTableNum -system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v $totalTableNum -system sh/cfg.sh -n dnode3 -c maxtablesPerVnode -v $totalTableNum -system sh/cfg.sh -n dnode4 -c maxtablesPerVnode -v $totalTableNum - -system sh/cfg.sh -n dnode1 -c maxVgroupsPerDb -v 1 -system sh/cfg.sh -n dnode2 -c maxVgroupsPerDb -v 1 -system sh/cfg.sh -n dnode3 -c maxVgroupsPerDb -v 1 -system sh/cfg.sh -n dnode4 -c maxVgroupsPerDb -v 1 - -system sh/cfg.sh -n dnode1 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode2 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode3 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode4 -c arbitrator -v $arbitrator - -print ============== step0: start tarbitrator -system sh/exec_tarbitrator.sh -s start - -print ============== step1: start dnode1, only deploy mnode -system sh/exec.sh -n dnode1 -s start -sleep 2000 -sql connect - -print ============== step2: start dnode2/dnode3/dnode4 and add into cluster , then create database with replica 2, and create table, insert data -system sh/exec.sh -n dnode2 -s start -#system sh/exec.sh -n dnode3 -s start -system sh/exec.sh -n dnode4 -s start -sql create dnode $hostname2 -#sql create dnode $hostname3 -sql create dnode $hostname4 -sleep 2000 - -$totalTableNum = 10 -$sleepTimer = 3000 - -$db = db -print create database $db replica 2 -sql create database $db replica 2 -sql use $db - -# create table , insert data -$stb = stb -sql create table $stb (ts timestamp, c1 int, c2 int) tags(t0 int, t1 int) -$rowNum = 500 -$tblNum = $totalTableNum -$totalRows = 0 -$tsStart = 1420041600000 -$tsEnd = 0 - -$i = 0 -while $i < $tblNum - $tb = tb . $i - sql create table $tb using $stb tags( $i , $i ) - - $x = 0 - while $x < $rowNum - $ts = $tsStart + $x - sql insert into $tb values ( $ts + 0a , $x , $x ) ( $ts + 1a , $x , $x ) ( $ts + 2a , $x , $x ) ( $ts + 3a , $x , $x ) ( $ts + 4a , $x , $x ) ( $ts + 5a , $x , $x ) ( $ts + 6a , $x , $x ) ( $ts + 7a , $x , $x ) ( $ts + 8a , $x , $x ) ( $ts + 9a , $x , $x ) ( $ts + 10a , $x , $x ) ( $ts + 11a , $x , $x ) ( $ts + 12a , $x , $x ) ( $ts + 13a , $x , $x ) ( $ts + 14a , $x , $x ) ( $ts + 15a , $x , $x ) ( $ts + 16a , $x , $x ) ( $ts + 17a , $x , $x ) ( $ts + 18a , $x , $x ) ( $ts + 19a , $x , $x ) - $x = $x + 20 - endw - $totalRows = $totalRows + $x - print info: inserted $x rows into $tb and totalRows: $totalRows - $i = $i + 1 -endw -$tsEnd = $tsStart + $totalRows / $tblNum - -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - -print ============== step3: stop dnode4 -system sh/exec.sh -n dnode4 -s stop -x SIGINT -sleep $sleepTimer -$cnt = 0 -wait_dnode4_offline_0: -$cnt = $cnt + 1 -if $cnt == 20 then - return -1 -endi -sql select * from information_schema.ins_dnodes -if $rows != 4 then - sleep 2000 - goto wait_dnode4_offline_0 -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 -#$dnode1Status = $data4_1 -$dnode2Status = $data4_2 -#$dnode3Status = $data4_3 -$dnode4Status = $data4_3 -#$dnode5Status = $data4_5 - -if $dnode4Status != offline then - sleep 2000 - goto wait_dnode4_offline_0 -endi - -$cnt = 0 -wait_dnode4_vgroup_offline: -$cnt = $cnt + 1 -if $cnt == 20 then - return -1 -endi -sql show vgroups -if $rows != 1 then - sleep 2000 - goto wait_dnode4_vgroup_offline -endi -print show vgroups: -print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 $data5_1 $data6_1 $data7_1 $data8_1 $data9_1 -print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 $data5_2 $data6_2 $data7_2 $data8_2 $data9_2 -print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3 $data5_3 $data6_3 $data7_3 $data8_3 $data9_3 -$dnode4Vtatus = $data5_2 -$dnode3Vtatus = $data7_2 - -if $dnode4Vtatus != offline then - sleep 2000 - goto wait_dnode4_vgroup_offline -endi -if $dnode3Vtatus != master then - sleep 2000 - goto wait_dnode4_vgroup_offline -endi - -print ============== step4: alter table and tag, then drop all sub tables, recreate som subtable and insert more data rows -sql alter table $stb drop column c1 -sql alter table $stb add column f1 double - -sql alter table $stb add tag t2 int -sql alter table $stb add tag t3 int -sql alter table $stb drop tag t1 - -$i = 0 -while $i < $tblNum - $tb = tb . $i - sql drop table $tb - $i = $i + 1 -endw - -$totalRows = 0 -$i = 0 -while $i < $tblNum - $tb = tb . $i - sql create table $tb using $stb tags( $i , $i , $i ) - - $x = 0 - while $x < $rowNum - $ts = $tsStart + $x - sql insert into $tb values ( $ts + 0a , $x , $x ) ( $ts + 1a , $x , $x ) ( $ts + 2a , $x , $x ) ( $ts + 3a , $x , $x ) ( $ts + 4a , $x , $x ) ( $ts + 5a , $x , $x ) ( $ts + 6a , $x , $x ) ( $ts + 7a , $x , $x ) ( $ts + 8a , $x , $x ) ( $ts + 9a , $x , $x ) ( $ts + 10a , $x , $x ) ( $ts + 11a , $x , $x ) ( $ts + 12a , $x , $x ) ( $ts + 13a , $x , $x ) ( $ts + 14a , $x , $x ) ( $ts + 15a , $x , $x ) ( $ts + 16a , $x , $x ) ( $ts + 17a , $x , $x ) ( $ts + 18a , $x , $x ) ( $ts + 19a , $x , $x ) - $x = $x + 20 - endw - $totalRows = $totalRows + $x - print info: inserted $x rows into $tb and totalRows: $totalRows - $i = $i + 1 -endw -$tsEnd = $tsStart + $totalRows / $tblNum - -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - -print ============== step5: restart dnode4, waiting dnode4 synced -system sh/exec.sh -n dnode4 -s start - -$cnt = 0 -wait_dnode4_ready: -$cnt = $cnt + 1 -if $cnt == 20 then - return -1 -endi -sql select * from information_schema.ins_dnodes -if $rows != 4 then - sleep 2000 - goto wait_dnode4_ready -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 -#$dnode1Status = $data4_1 -#$dnode2Status = $data4_2 -#$dnode3Status = $data4_3 -$dnode4Status = $data4_3 -#$dnode5Status = $data4_5 - -if $dnode4Status != ready then - sleep 2000 - goto wait_dnode4_ready -endi - -print ============== step6: check result - -sql reset query cache - -$cnt = 0 -wait_table_dropped: -$cnt = $cnt + 1 -if $cnt == 20 then - return -1 -endi -sql select count(*) from $stb -if $data00 != $totalRows then - print data00: $data00 totalRows: $totalRows - sleep 2000 - goto wait_table_dropped -endi - - - - diff --git a/tests/script/tsim/backup/arbitrator/offline_replica2_createTable_online.sim b/tests/script/tsim/backup/arbitrator/offline_replica2_createTable_online.sim deleted file mode 100644 index 02625ba490..0000000000 --- a/tests/script/tsim/backup/arbitrator/offline_replica2_createTable_online.sim +++ /dev/null @@ -1,233 +0,0 @@ -system sh/stop_dnodes.sh -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -system sh/deploy.sh -n dnode3 -i 3 -system sh/deploy.sh -n dnode4 -i 4 - -system sh/cfg.sh -n dnode1 -c 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 dnode1 -c walLevel -v 2 -system sh/cfg.sh -n dnode2 -c walLevel -v 2 -system sh/cfg.sh -n dnode3 -c walLevel -v 2 -system sh/cfg.sh -n dnode4 -c walLevel -v 2 - -system sh/cfg.sh -n dnode1 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode2 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode3 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode4 -c balanceInterval -v 10 - -system sh/cfg.sh -n dnode1 -c role -v 1 -system sh/cfg.sh -n dnode2 -c role -v 2 -system sh/cfg.sh -n dnode3 -c role -v 2 -system sh/cfg.sh -n dnode4 -c role -v 2 - -$totalTableNum = 10 -system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 20 -system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v 20 -system sh/cfg.sh -n dnode3 -c maxtablesPerVnode -v 20 -system sh/cfg.sh -n dnode4 -c maxtablesPerVnode -v 20 - -system sh/cfg.sh -n dnode1 -c maxVgroupsPerDb -v 1 -system sh/cfg.sh -n dnode2 -c maxVgroupsPerDb -v 1 -system sh/cfg.sh -n dnode3 -c maxVgroupsPerDb -v 1 -system sh/cfg.sh -n dnode4 -c maxVgroupsPerDb -v 1 - -system sh/cfg.sh -n dnode1 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode2 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode3 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode4 -c arbitrator -v $arbitrator - -print ============== step0: start tarbitrator -system sh/exec_tarbitrator.sh -s start - -print ============== step1: start dnode1, only deploy mnode -system sh/exec.sh -n dnode1 -s start -sleep 2000 -sql connect - -print ============== step2: start dnode2/dnode3/dnode4 and add into cluster , then create database with replica 2, and create table, insert data -system sh/exec.sh -n dnode2 -s start -#system sh/exec.sh -n dnode3 -s start -system sh/exec.sh -n dnode4 -s start -sql create dnode $hostname2 -#sql create dnode $hostname3 -sql create dnode $hostname4 -sleep 2000 - -$totalTableNum = 10 -$sleepTimer = 3000 - -$db = db -print create database $db replica 2 -sql create database $db replica 2 -sql use $db - -# create table , insert data -$stb = stb -sql create table $stb (ts timestamp, c1 int) tags(t1 int) -$rowNum = 500 -$tblNum = $totalTableNum -$totalRows = 0 -$tsStart = 1420041600000 -$tsEnd = 0 - -$i = 0 -while $i < $tblNum - $tb = tb . $i - sql create table $tb using $stb tags( $i ) - - $x = 0 - while $x < $rowNum - $ts = $tsStart + $x - sql insert into $tb values ( $ts + 0a , $x ) ( $ts + 1a , $x ) ( $ts + 2a , $x ) ( $ts + 3a , $x ) ( $ts + 4a , $x ) ( $ts + 5a , $x ) ( $ts + 6a , $x ) ( $ts + 7a , $x ) ( $ts + 8a , $x ) ( $ts + 9a , $x ) ( $ts + 10a , $x ) ( $ts + 11a , $x ) ( $ts + 12a , $x ) ( $ts + 13a , $x ) ( $ts + 14a , $x ) ( $ts + 15a , $x ) ( $ts + 16a , $x ) ( $ts + 17a , $x ) ( $ts + 18a , $x ) ( $ts + 19a , $x ) ( $ts + 20a , $x ) ( $ts + 21a , $x ) ( $ts + 22a , $x ) ( $ts + 23a , $x ) ( $ts + 24a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 35a , $x ) ( $ts + 36a , $x ) ( $ts + 37a , $x ) ( $ts + 38a , $x ) ( $ts + 39a , $x ) ( $ts + 40a , $x ) ( $ts + 41a , $x ) ( $ts + 42a , $x ) ( $ts + 43a , $x ) ( $ts + 44a , $x ) ( $ts + 45a , $x ) ( $ts + 46a , $x ) ( $ts + 47a , $x ) ( $ts + 48a , $x ) ( $ts + 49a , $x ) ( $ts + 50a , $x ) ( $ts + 51a , $x ) ( $ts + 52a , $x ) ( $ts + 53a , $x ) ( $ts + 54a , $x ) ( $ts + 55a , $x ) ( $ts + 56a , $x ) ( $ts + 57a , $x ) ( $ts + 58a , $x ) ( $ts + 59a , $x ) - $x = $x + 60 - endw - $totalRows = $totalRows + $x - print info: inserted $x rows into $tb and totalRows: $totalRows - $i = $i + 1 -endw -$tsEnd = $tsStart + $totalRows / $tblNum - -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - -print ============== step3: stop dnode4 -system sh/exec.sh -n dnode4 -s stop -x SIGINT -sleep $sleepTimer -$cnt = 0 -wait_dnode4_offline_0: -$cnt = $cnt + 1 -if $cnt == 20 then - return -1 -endi -sql select * from information_schema.ins_dnodes -if $rows != 4 then - sleep 2000 - goto wait_dnode4_offline_0 -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 -#$dnode1Status = $data4_1 -$dnode2Status = $data4_2 -#$dnode3Status = $data4_3 -$dnode4Status = $data4_3 -#$dnode5Status = $data4_5 - -if $dnode4Status != offline then - sleep 2000 - goto wait_dnode4_offline_0 -endi - -$cnt = 0 -wait_dnode4_vgroup_offline: -$cnt = $cnt + 1 -if $cnt == 20 then - return -1 -endi -sql show vgroups -if $rows != 1 then - sleep 2000 - goto wait_dnode4_vgroup_offline -endi -print show vgroups: -print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 $data5_1 $data6_1 $data7_1 $data8_1 $data9_1 -print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 $data5_2 $data6_2 $data7_2 $data8_2 $data9_2 -print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3 $data5_3 $data6_3 $data7_3 $data8_3 $data9_3 -$dnode4Vtatus = $data5_2 -$dnode3Vtatus = $data7_2 - -if $dnode4Vtatus != offline then - sleep 2000 - goto wait_dnode4_vgroup_offline -endi -if $dnode3Vtatus != master then - sleep 2000 - goto wait_dnode4_vgroup_offline -endi - -print ============== step4: create more tables and insert data rows -$tsStart = $tsEnd + 1000 -$i = $tblNum -$tblNum = $tblNum * 2 -while $i < $tblNum - $tb = tb . $i - sql create table $tb using $stb tags( $i ) - - $x = 0 - while $x < $rowNum - $ts = $tsStart + $x - sql insert into $tb values ( $ts + 0a , $x ) ( $ts + 1a , $x ) ( $ts + 2a , $x ) ( $ts + 3a , $x ) ( $ts + 4a , $x ) ( $ts + 5a , $x ) ( $ts + 6a , $x ) ( $ts + 7a , $x ) ( $ts + 8a , $x ) ( $ts + 9a , $x ) ( $ts + 10a , $x ) ( $ts + 11a , $x ) ( $ts + 12a , $x ) ( $ts + 13a , $x ) ( $ts + 14a , $x ) ( $ts + 15a , $x ) ( $ts + 16a , $x ) ( $ts + 17a , $x ) ( $ts + 18a , $x ) ( $ts + 19a , $x ) ( $ts + 20a , $x ) ( $ts + 21a , $x ) ( $ts + 22a , $x ) ( $ts + 23a , $x ) ( $ts + 24a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 35a , $x ) ( $ts + 36a , $x ) ( $ts + 37a , $x ) ( $ts + 38a , $x ) ( $ts + 39a , $x ) ( $ts + 40a , $x ) ( $ts + 41a , $x ) ( $ts + 42a , $x ) ( $ts + 43a , $x ) ( $ts + 44a , $x ) ( $ts + 45a , $x ) ( $ts + 46a , $x ) ( $ts + 47a , $x ) ( $ts + 48a , $x ) ( $ts + 49a , $x ) ( $ts + 50a , $x ) ( $ts + 51a , $x ) ( $ts + 52a , $x ) ( $ts + 53a , $x ) ( $ts + 54a , $x ) ( $ts + 55a , $x ) ( $ts + 56a , $x ) ( $ts + 57a , $x ) ( $ts + 58a , $x ) ( $ts + 59a , $x ) - $x = $x + 60 - endw - $totalRows = $totalRows + $x - print info: inserted $x rows into $tb and totalRows: $totalRows - $i = $i + 1 -endw - -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - -print ============== step5: restart dnode4, waiting dnode4 synced -system sh/exec.sh -n dnode4 -s start - -$cnt = 0 -wait_dnode4_ready: -$cnt = $cnt + 1 -if $cnt == 20 then - return -1 -endi -sql select * from information_schema.ins_dnodes -if $rows != 4 then - sleep 2000 - goto wait_dnode4_ready -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 -#$dnode1Status = $data4_1 -#$dnode2Status = $data4_2 -#$dnode3Status = $data4_3 -$dnode4Status = $data4_3 -#$dnode5Status = $data4_5 - -if $dnode4Status != ready then - sleep 2000 - goto wait_dnode4_ready -endi - -print ============== step6: check result - -sql reset query cache - -$cnt = 0 -wait_table_altered: -$cnt = $cnt + 1 -if $cnt == 20 then - return -1 -endi -sql select count(*) from $stb -if $data00 != $totalRows then - print data00: $data00 - sleep 2000 - goto wait_table_altered -endi - - - - diff --git a/tests/script/tsim/backup/arbitrator/offline_replica2_dropDb_online.sim b/tests/script/tsim/backup/arbitrator/offline_replica2_dropDb_online.sim deleted file mode 100644 index 3b8dbeb637..0000000000 --- a/tests/script/tsim/backup/arbitrator/offline_replica2_dropDb_online.sim +++ /dev/null @@ -1,180 +0,0 @@ -system sh/stop_dnodes.sh -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -system sh/deploy.sh -n dnode3 -i 3 -system sh/deploy.sh -n dnode4 -i 4 - -system sh/cfg.sh -n dnode1 -c 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 dnode1 -c walLevel -v 2 -system sh/cfg.sh -n dnode2 -c walLevel -v 2 -system sh/cfg.sh -n dnode3 -c walLevel -v 2 -system sh/cfg.sh -n dnode4 -c walLevel -v 2 - -system sh/cfg.sh -n dnode1 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode2 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode3 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode4 -c balanceInterval -v 10 - -system sh/cfg.sh -n dnode1 -c role -v 1 -system sh/cfg.sh -n dnode2 -c role -v 2 -system sh/cfg.sh -n dnode3 -c role -v 2 -system sh/cfg.sh -n dnode4 -c role -v 2 - -$totalTableNum = 10 -system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v $totalTableNum -system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v $totalTableNum -system sh/cfg.sh -n dnode3 -c maxtablesPerVnode -v $totalTableNum -system sh/cfg.sh -n dnode4 -c maxtablesPerVnode -v $totalTableNum - -system sh/cfg.sh -n dnode1 -c maxVgroupsPerDb -v 1 -system sh/cfg.sh -n dnode2 -c maxVgroupsPerDb -v 1 -system sh/cfg.sh -n dnode3 -c maxVgroupsPerDb -v 1 -system sh/cfg.sh -n dnode4 -c maxVgroupsPerDb -v 1 - -system sh/cfg.sh -n dnode1 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode2 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode3 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode4 -c arbitrator -v $arbitrator - -print ============== step0: start tarbitrator -system sh/exec_tarbitrator.sh -s start - -print ============== step1: start dnode1, only deploy mnode -system sh/exec.sh -n dnode1 -s start -sleep 2000 -sql connect - -print ============== step2: start dnode2/dnode3/dnode4 and add into cluster , then create database with replica 2, and create table, insert data -system sh/exec.sh -n dnode2 -s start -#system sh/exec.sh -n dnode3 -s start -system sh/exec.sh -n dnode4 -s start -sql create dnode $hostname2 -#sql create dnode $hostname3 -sql create dnode $hostname4 -sleep 2000 - -$totalTableNum = 10 -$sleepTimer = 3000 - -$db = db -print create database $db replica 2 -sql create database $db replica 2 -sql use $db - -# create table , insert data -$stb = stb -sql create table $stb (ts timestamp, c1 int) tags(t1 int) -$rowNum = 500 -$tblNum = $totalTableNum -$totalRows = 0 -$tsStart = 1420041600000 -$tsEnd = 0 - -$i = 0 -while $i < $tblNum - $tb = tb . $i - sql create table $tb using $stb tags( $i ) - - $x = 0 - while $x < $rowNum - $ts = $tsStart + $x - sql insert into $tb values ( $ts + 0a , $x ) ( $ts + 1a , $x ) ( $ts + 2a , $x ) ( $ts + 3a , $x ) ( $ts + 4a , $x ) ( $ts + 5a , $x ) ( $ts + 6a , $x ) ( $ts + 7a , $x ) ( $ts + 8a , $x ) ( $ts + 9a , $x ) ( $ts + 10a , $x ) ( $ts + 11a , $x ) ( $ts + 12a , $x ) ( $ts + 13a , $x ) ( $ts + 14a , $x ) ( $ts + 15a , $x ) ( $ts + 16a , $x ) ( $ts + 17a , $x ) ( $ts + 18a , $x ) ( $ts + 19a , $x ) ( $ts + 20a , $x ) ( $ts + 21a , $x ) ( $ts + 22a , $x ) ( $ts + 23a , $x ) ( $ts + 24a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 35a , $x ) ( $ts + 36a , $x ) ( $ts + 37a , $x ) ( $ts + 38a , $x ) ( $ts + 39a , $x ) ( $ts + 40a , $x ) ( $ts + 41a , $x ) ( $ts + 42a , $x ) ( $ts + 43a , $x ) ( $ts + 44a , $x ) ( $ts + 45a , $x ) ( $ts + 46a , $x ) ( $ts + 47a , $x ) ( $ts + 48a , $x ) ( $ts + 49a , $x ) ( $ts + 50a , $x ) ( $ts + 51a , $x ) ( $ts + 52a , $x ) ( $ts + 53a , $x ) ( $ts + 54a , $x ) ( $ts + 55a , $x ) ( $ts + 56a , $x ) ( $ts + 57a , $x ) ( $ts + 58a , $x ) ( $ts + 59a , $x ) - $x = $x + 60 - endw - $totalRows = $totalRows + $x - print info: inserted $x rows into $tb and totalRows: $totalRows - $i = $i + 1 -endw -$tsEnd = $tsStart + $totalRows / $tblNum - -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - -print ============== step3: stop dnode4 -system sh/exec.sh -n dnode4 -s stop -x SIGINT -sleep $sleepTimer -$cnt = 0 -wait_dnode4_offline_0: -$cnt = $cnt + 1 -if $cnt == 20 then - return -1 -endi -sql select * from information_schema.ins_dnodes -if $rows != 4 then - sleep 2000 - goto wait_dnode4_offline_0 -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 -#$dnode1Status = $data4_1 -$dnode2Status = $data4_2 -#$dnode3Status = $data4_3 -$dnode4Status = $data4_3 -#$dnode5Status = $data4_5 - -if $dnode4Status != offline then - sleep 2000 - goto wait_dnode4_offline_0 -endi - -$cnt = 0 -wait_dnode4_vgroup_offline: -$cnt = $cnt + 1 -if $cnt == 20 then - return -1 -endi -sql show vgroups -if $rows != 1 then - sleep 2000 - goto wait_dnode4_vgroup_offline -endi -print show vgroups: -print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 $data5_1 $data6_1 $data7_1 $data8_1 $data9_1 -print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 $data5_2 $data6_2 $data7_2 $data8_2 $data9_2 -print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3 $data5_3 $data6_3 $data7_3 $data8_3 $data9_3 -$dnode4Vtatus = $data5_2 -$dnode3Vtatus = $data7_2 - -if $dnode4Vtatus != offline then - sleep 2000 - goto wait_dnode4_vgroup_offline -endi -if $dnode3Vtatus != master then - sleep 2000 - goto wait_dnode4_vgroup_offline -endi - -print ============== step4: drop db -sql drop database $db - -print ============== step5: restart dnode4 -system sh/exec.sh -n dnode4 -s start - -print ============== step6: check result -sql reset query cache -$cnt = 0 -wait_database_dropped: -$cnt = $cnt + 1 -if $cnt == 20 then - return -1 -endi -sql select * from information_schema.ins_databases -if $rows != 0 then - sleep 2000 - goto wait_database_dropped -endi - - - - diff --git a/tests/script/tsim/backup/arbitrator/offline_replica2_dropTable_online.sim b/tests/script/tsim/backup/arbitrator/offline_replica2_dropTable_online.sim deleted file mode 100644 index a6d84da45a..0000000000 --- a/tests/script/tsim/backup/arbitrator/offline_replica2_dropTable_online.sim +++ /dev/null @@ -1,219 +0,0 @@ -system sh/stop_dnodes.sh -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -system sh/deploy.sh -n dnode3 -i 3 -system sh/deploy.sh -n dnode4 -i 4 - -system sh/cfg.sh -n dnode1 -c 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 dnode1 -c walLevel -v 2 -system sh/cfg.sh -n dnode2 -c walLevel -v 2 -system sh/cfg.sh -n dnode3 -c walLevel -v 2 -system sh/cfg.sh -n dnode4 -c walLevel -v 2 - -system sh/cfg.sh -n dnode1 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode2 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode3 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode4 -c balanceInterval -v 10 - -system sh/cfg.sh -n dnode1 -c role -v 1 -system sh/cfg.sh -n dnode2 -c role -v 2 -system sh/cfg.sh -n dnode3 -c role -v 2 -system sh/cfg.sh -n dnode4 -c role -v 2 - -$totalTableNum = 10 -system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v $totalTableNum -system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v $totalTableNum -system sh/cfg.sh -n dnode3 -c maxtablesPerVnode -v $totalTableNum -system sh/cfg.sh -n dnode4 -c maxtablesPerVnode -v $totalTableNum - -system sh/cfg.sh -n dnode1 -c maxVgroupsPerDb -v 1 -system sh/cfg.sh -n dnode2 -c maxVgroupsPerDb -v 1 -system sh/cfg.sh -n dnode3 -c maxVgroupsPerDb -v 1 -system sh/cfg.sh -n dnode4 -c maxVgroupsPerDb -v 1 - -system sh/cfg.sh -n dnode1 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode2 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode3 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode4 -c arbitrator -v $arbitrator - -print ============== step0: start tarbitrator -system sh/exec_tarbitrator.sh -s start - -print ============== step1: start dnode1, only deploy mnode -system sh/exec.sh -n dnode1 -s start -sleep 2000 -sql connect - -print ============== step2: start dnode2/dnode3/dnode4 and add into cluster , then create database with replica 2, and create table, insert data -system sh/exec.sh -n dnode2 -s start -#system sh/exec.sh -n dnode3 -s start -system sh/exec.sh -n dnode4 -s start -sql create dnode $hostname2 -#sql create dnode $hostname3 -sql create dnode $hostname4 -sleep 2000 - -$totalTableNum = 10 -$sleepTimer = 3000 - -$db = db -print create database $db replica 2 -sql create database $db replica 2 -sql use $db - -# create table , insert data -$stb = stb -sql create table $stb (ts timestamp, c1 int) tags(t1 int) -$rowNum = 500 -$tblNum = $totalTableNum -$totalRows = 0 -$tsStart = 1420041600000 -$tsEnd = 0 - -$i = 0 -while $i < $tblNum - $tb = tb . $i - sql create table $tb using $stb tags( $i ) - - $x = 0 - while $x < $rowNum - $ts = $tsStart + $x - sql insert into $tb values ( $ts + 0a , $x ) ( $ts + 1a , $x ) ( $ts + 2a , $x ) ( $ts + 3a , $x ) ( $ts + 4a , $x ) ( $ts + 5a , $x ) ( $ts + 6a , $x ) ( $ts + 7a , $x ) ( $ts + 8a , $x ) ( $ts + 9a , $x ) ( $ts + 10a , $x ) ( $ts + 11a , $x ) ( $ts + 12a , $x ) ( $ts + 13a , $x ) ( $ts + 14a , $x ) ( $ts + 15a , $x ) ( $ts + 16a , $x ) ( $ts + 17a , $x ) ( $ts + 18a , $x ) ( $ts + 19a , $x ) ( $ts + 20a , $x ) ( $ts + 21a , $x ) ( $ts + 22a , $x ) ( $ts + 23a , $x ) ( $ts + 24a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 35a , $x ) ( $ts + 36a , $x ) ( $ts + 37a , $x ) ( $ts + 38a , $x ) ( $ts + 39a , $x ) ( $ts + 40a , $x ) ( $ts + 41a , $x ) ( $ts + 42a , $x ) ( $ts + 43a , $x ) ( $ts + 44a , $x ) ( $ts + 45a , $x ) ( $ts + 46a , $x ) ( $ts + 47a , $x ) ( $ts + 48a , $x ) ( $ts + 49a , $x ) ( $ts + 50a , $x ) ( $ts + 51a , $x ) ( $ts + 52a , $x ) ( $ts + 53a , $x ) ( $ts + 54a , $x ) ( $ts + 55a , $x ) ( $ts + 56a , $x ) ( $ts + 57a , $x ) ( $ts + 58a , $x ) ( $ts + 59a , $x ) - $x = $x + 60 - endw - $totalRows = $totalRows + $x - print info: inserted $x rows into $tb and totalRows: $totalRows - $i = $i + 1 -endw -$tsEnd = $tsStart + $totalRows / $tblNum - -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - -print ============== step3: stop dnode4 -system sh/exec.sh -n dnode4 -s stop -x SIGINT -sleep $sleepTimer -$cnt = 0 -wait_dnode4_offline_0: -$cnt = $cnt + 1 -if $cnt == 20 then - return -1 -endi -sql select * from information_schema.ins_dnodes -if $rows != 4 then - sleep 2000 - goto wait_dnode4_offline_0 -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 -#$dnode1Status = $data4_1 -$dnode2Status = $data4_2 -#$dnode3Status = $data4_3 -$dnode4Status = $data4_3 -#$dnode5Status = $data4_5 - -if $dnode4Status != offline then - sleep 2000 - goto wait_dnode4_offline_0 -endi - -$cnt = 0 -wait_dnode4_vgroup_offline: -$cnt = $cnt + 1 -if $cnt == 20 then - return -1 -endi -sql show vgroups -if $rows != 1 then - sleep 2000 - goto wait_dnode4_vgroup_offline -endi -print show vgroups: -print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 $data5_1 $data6_1 $data7_1 $data8_1 $data9_1 -print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 $data5_2 $data6_2 $data7_2 $data8_2 $data9_2 -print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3 $data5_3 $data6_3 $data7_3 $data8_3 $data9_3 -$dnode4Vtatus = $data5_2 -$dnode3Vtatus = $data7_2 - -if $dnode4Vtatus != offline then - sleep 2000 - goto wait_dnode4_vgroup_offline -endi -if $dnode3Vtatus != master then - sleep 2000 - goto wait_dnode4_vgroup_offline -endi - -print ============== step4: drop some tables -$i = 1 -$dropTblNum = 6 - -while $i < $dropTblNum - $tb = tb . $i - sql drop table if exists $tb - $i = $i + 1 -endw -$tblNum = $tblNum - 5 - -print ============== step5: restart dnode4, waiting dnode4 synced -system sh/exec.sh -n dnode4 -s start - -$cnt = 0 -wait_dnode4_ready: -$cnt = $cnt + 1 -if $cnt == 20 then - return -1 -endi -sql select * from information_schema.ins_dnodes -if $rows != 4 then - sleep 2000 - goto wait_dnode4_ready -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 -#$dnode1Status = $data4_1 -#$dnode2Status = $data4_2 -#$dnode3Status = $data4_3 -$dnode4Status = $data4_3 -#$dnode5Status = $data4_5 - -if $dnode4Status != ready then - sleep 2000 - goto wait_dnode4_ready -endi - -print ============== step6: check result - -sql reset query cache - -$cnt = 0 -wait_table_dropped: -$cnt = $cnt + 1 -if $cnt == 20 then - return -1 -endi -sql select count(tbname) from $stb -if $data00 != $tblNum then - print data00: $data00 tblNum: $tblNum - sleep 2000 - goto wait_table_dropped -endi - - - - diff --git a/tests/script/tsim/backup/arbitrator/offline_replica3_alterTable_online.sim b/tests/script/tsim/backup/arbitrator/offline_replica3_alterTable_online.sim deleted file mode 100644 index 42be85bf4b..0000000000 --- a/tests/script/tsim/backup/arbitrator/offline_replica3_alterTable_online.sim +++ /dev/null @@ -1,221 +0,0 @@ -system sh/stop_dnodes.sh -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -system sh/deploy.sh -n dnode3 -i 3 -system sh/deploy.sh -n dnode4 -i 4 - -system sh/cfg.sh -n dnode1 -c 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 dnode1 -c walLevel -v 2 -system sh/cfg.sh -n dnode2 -c walLevel -v 2 -system sh/cfg.sh -n dnode3 -c walLevel -v 2 -system sh/cfg.sh -n dnode4 -c walLevel -v 2 - -system sh/cfg.sh -n dnode1 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode2 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode3 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode4 -c balanceInterval -v 10 - -system sh/cfg.sh -n dnode1 -c role -v 1 -system sh/cfg.sh -n dnode2 -c role -v 2 -system sh/cfg.sh -n dnode3 -c role -v 2 -system sh/cfg.sh -n dnode4 -c role -v 2 - -$totalTableNum = 10 -system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v $totalTableNum -system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v $totalTableNum -system sh/cfg.sh -n dnode3 -c maxtablesPerVnode -v $totalTableNum -system sh/cfg.sh -n dnode4 -c maxtablesPerVnode -v $totalTableNum - -system sh/cfg.sh -n dnode1 -c maxVgroupsPerDb -v 1 -system sh/cfg.sh -n dnode2 -c maxVgroupsPerDb -v 1 -system sh/cfg.sh -n dnode3 -c maxVgroupsPerDb -v 1 -system sh/cfg.sh -n dnode4 -c maxVgroupsPerDb -v 1 - -system sh/cfg.sh -n dnode1 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode2 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode3 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode4 -c arbitrator -v $arbitrator - -print ============== step0: start tarbitrator -system sh/exec_tarbitrator.sh -s start - -print ============== step1: start dnode1, only deploy mnode -system sh/exec.sh -n dnode1 -s start -sleep 2000 -sql connect - -print ============== step2: start dnode2/dnode3/dnode4 and add into cluster , then create database with replica 3, and create table, insert data -system sh/exec.sh -n dnode2 -s start -system sh/exec.sh -n dnode3 -s start -system sh/exec.sh -n dnode4 -s start -sql create dnode $hostname2 -sql create dnode $hostname3 -sql create dnode $hostname4 -sleep 2000 - -$totalTableNum = 10 -$sleepTimer = 3000 - -$db = db -print create database $db replica 3 -sql create database $db replica 3 -sql use $db - -# create table , insert data -$stb = stb -sql create table $stb (ts timestamp, c1 int, c2 int) tags(t1 int) -$rowNum = 500 -$tblNum = $totalTableNum -$totalRows = 0 -$tsStart = 1420041600000 -$tsEnd = 0 - -$i = 0 -while $i < $tblNum - $tb = tb . $i - sql create table $tb using $stb tags( $i ) - - $x = 0 - while $x < $rowNum - $ts = $tsStart + $x - sql insert into $tb values ( $ts + 0a , $x , $x ) ( $ts + 1a , $x , $x ) ( $ts + 2a , $x , $x ) ( $ts + 3a , $x , $x ) ( $ts + 4a , $x , $x ) ( $ts + 5a , $x , $x ) ( $ts + 6a , $x , $x ) ( $ts + 7a , $x , $x ) ( $ts + 8a , $x , $x ) ( $ts + 9a , $x , $x ) ( $ts + 10a , $x , $x ) ( $ts + 11a , $x , $x ) ( $ts + 12a , $x , $x ) ( $ts + 13a , $x , $x ) ( $ts + 14a , $x , $x ) ( $ts + 15a , $x , $x ) ( $ts + 16a , $x , $x ) ( $ts + 17a , $x , $x ) ( $ts + 18a , $x , $x ) ( $ts + 19a , $x , $x ) - $x = $x + 20 - endw - $totalRows = $totalRows + $x - print info: inserted $x rows into $tb and totalRows: $totalRows - $i = $i + 1 -endw -$tsEnd = $tsStart + $totalRows / $tblNum - -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - -print ============== step3: stop dnode4 -system sh/exec.sh -n dnode4 -s stop -x SIGINT -sleep $sleepTimer -$cnt = 0 -wait_dnode4_offline_0: -$cnt = $cnt + 1 -if $cnt == 20 then - return -1 -endi -sql select * from information_schema.ins_dnodes -if $rows != 5 then - sleep 2000 - goto wait_dnode4_offline_0 -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 -#$dnode1Status = $data4_1 -$dnode2Status = $data4_2 -$dnode3Status = $data4_3 -$dnode4Status = $data4_4 -#$dnode5Status = $data4_5 - -if $dnode4Status != offline then - sleep 2000 - goto wait_dnode4_offline_0 -endi - -$cnt = 0 -wait_dnode4_vgroup_offline: -$cnt = $cnt + 1 -if $cnt == 20 then - return -1 -endi -sql show vgroups -if $rows != 1 then - sleep 2000 - goto wait_dnode4_vgroup_offline -endi -print show vgroups: -print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 $data5_1 $data6_1 $data7_1 $data8_1 $data9_1 -print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 $data5_2 $data6_2 $data7_2 $data8_2 $data9_2 -print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3 $data5_3 $data6_3 $data7_3 $data8_3 $data9_3 -$dnode4Vtatus = $data5_2 -$dnode3Vtatus = $data7_2 - -if $dnode4Vtatus != offline then - sleep 2000 - goto wait_dnode4_vgroup_offline -endi -if $dnode3Vtatus != master then - sleep 2000 - goto wait_dnode4_vgroup_offline -endi - -print ============== step4: alter table and insert more data rows -sql alter table $stb drop column c1 -sql alter table $stb add column f1 double - -$i = 0 -while $i < $tblNum - $tb = tb . $i - sql insert into $tb values (now, 10001, 1.0001) (now + 1s, 10002, 1.0002) (now + 2s, 10003, 1.0003) (now + 3s, 10004, 1.0004) - $i = $i + 1 -endw -$addRows = 4 * $tblNum -$totalRows = $totalRows + $addRows - -print ============== step5: restart dnode4, waiting dnode4 synced -system sh/exec.sh -n dnode4 -s start - -$cnt = 0 -wait_dnode4_ready: -$cnt = $cnt + 1 -if $cnt == 20 then - return -1 -endi -sql select * from information_schema.ins_dnodes -if $rows != 5 then - sleep 2000 - goto wait_dnode4_ready -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 -#$dnode1Status = $data4_1 -#$dnode2Status = $data4_2 -$dnode3Status = $data4_3 -$dnode4Status = $data4_4 -#$dnode5Status = $data4_5 - -if $dnode4Status != ready then - sleep 2000 - goto wait_dnode4_ready -endi - -print ============== step6: check result - -sql reset query cache - -$cnt = 0 -wait_table_dropped: -$cnt = $cnt + 1 -if $cnt == 20 then - return -1 -endi -sql select count(*) from $stb -if $data00 != $totalRows then - print data00: $data00 totalRows: $totalRows - sleep 2000 - goto wait_table_dropped -endi - - - - diff --git a/tests/script/tsim/backup/arbitrator/offline_replica3_alterTag_online.sim b/tests/script/tsim/backup/arbitrator/offline_replica3_alterTag_online.sim deleted file mode 100644 index 212c9130df..0000000000 --- a/tests/script/tsim/backup/arbitrator/offline_replica3_alterTag_online.sim +++ /dev/null @@ -1,247 +0,0 @@ -system sh/stop_dnodes.sh -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -system sh/deploy.sh -n dnode3 -i 3 -system sh/deploy.sh -n dnode4 -i 4 - -system sh/cfg.sh -n dnode1 -c 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 dnode1 -c walLevel -v 2 -system sh/cfg.sh -n dnode2 -c walLevel -v 2 -system sh/cfg.sh -n dnode3 -c walLevel -v 2 -system sh/cfg.sh -n dnode4 -c walLevel -v 2 - -system sh/cfg.sh -n dnode1 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode2 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode3 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode4 -c balanceInterval -v 10 - -#system sh/cfg.sh -n dnode1 -c role -v 1 -#system sh/cfg.sh -n dnode2 -c role -v 2 -#system sh/cfg.sh -n dnode3 -c role -v 2 -#system sh/cfg.sh -n dnode4 -c role -v 2 - -$totalTableNum = 10 -system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 20 -system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v 20 -system sh/cfg.sh -n dnode3 -c maxtablesPerVnode -v 20 -system sh/cfg.sh -n dnode4 -c maxtablesPerVnode -v 20 - -system sh/cfg.sh -n dnode1 -c maxVgroupsPerDb -v 1 -system sh/cfg.sh -n dnode2 -c maxVgroupsPerDb -v 1 -system sh/cfg.sh -n dnode3 -c maxVgroupsPerDb -v 1 -system sh/cfg.sh -n dnode4 -c maxVgroupsPerDb -v 1 - -system sh/cfg.sh -n dnode1 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode2 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode3 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode4 -c arbitrator -v $arbitrator - -print ============== step0: start tarbitrator -system sh/exec_tarbitrator.sh -s start - -print ============== step1: start dnode1, only deploy mnode -system sh/exec.sh -n dnode1 -s start -sleep 2000 -sql connect - -print ============== step2: start dnode2/dnode3/dnode4 and add into cluster , then create database with replica 3, and create table, insert data -system sh/exec.sh -n dnode2 -s start -system sh/exec.sh -n dnode3 -s start -system sh/exec.sh -n dnode4 -s start -sql create dnode $hostname2 -sql create dnode $hostname3 -sql create dnode $hostname4 -sleep 2000 - -$totalTableNum = 10 -$sleepTimer = 3000 - -$db = db -print create database $db replica 3 -sql create database $db replica 3 -sql use $db - -# create table , insert data -$stb = stb -sql create table $stb (ts timestamp, c1 int, c2 int) tags(t0 int, t1 int) -$rowNum = 500 -$tblNum = $totalTableNum -$totalRows = 0 -$tsStart = 1420041600000 -$tsEnd = 0 - -$i = 0 -while $i < $tblNum - $tb = tb . $i - sql create table $tb using $stb tags( $i , $i ) - - $x = 0 - while $x < $rowNum - $ts = $tsStart + $x - sql insert into $tb values ( $ts + 0a , $x , $x ) ( $ts + 1a , $x , $x ) ( $ts + 2a , $x , $x ) ( $ts + 3a , $x , $x ) ( $ts + 4a , $x , $x ) ( $ts + 5a , $x , $x ) ( $ts + 6a , $x , $x ) ( $ts + 7a , $x , $x ) ( $ts + 8a , $x , $x ) ( $ts + 9a , $x , $x ) ( $ts + 10a , $x , $x ) ( $ts + 11a , $x , $x ) ( $ts + 12a , $x , $x ) ( $ts + 13a , $x , $x ) ( $ts + 14a , $x , $x ) ( $ts + 15a , $x , $x ) ( $ts + 16a , $x , $x ) ( $ts + 17a , $x , $x ) ( $ts + 18a , $x , $x ) ( $ts + 19a , $x , $x ) - $x = $x + 20 - endw - $totalRows = $totalRows + $x - print info: inserted $x rows into $tb and totalRows: $totalRows - $i = $i + 1 -endw -$tsEnd = $tsStart + $totalRows / $tblNum - -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - -print ============== step3: stop dnode4 -system sh/exec.sh -n dnode4 -s stop -x SIGINT -sleep $sleepTimer -$cnt = 0 -wait_dnode4_offline_0: -$cnt = $cnt + 1 -if $cnt == 20 then - return -1 -endi -sql select * from information_schema.ins_dnodes -if $rows != 5 then - sleep 2000 - goto wait_dnode4_offline_0 -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 -#$dnode1Status = $data4_1 -$dnode2Status = $data4_2 -$dnode3Status = $data4_3 -$dnode4Status = $data4_4 -#$dnode5Status = $data4_5 - -if $dnode4Status != offline then - sleep 2000 - goto wait_dnode4_offline_0 -endi - -$cnt = 0 -wait_dnode4_vgroup_offline: -$cnt = $cnt + 1 -if $cnt == 20 then - return -1 -endi -sql show vgroups -if $rows != 1 then - sleep 2000 - goto wait_dnode4_vgroup_offline -endi -print show vgroups: -print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 $data5_1 $data6_1 $data7_1 $data8_1 $data9_1 -print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 $data5_2 $data6_2 $data7_2 $data8_2 $data9_2 -print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3 $data5_3 $data6_3 $data7_3 $data8_3 $data9_3 -$dnode4Vtatus = $data5_2 -$dnode3Vtatus = $data7_2 - -if $dnode4Vtatus != offline then - sleep 2000 - goto wait_dnode4_vgroup_offline -endi -if $dnode3Vtatus != master then - sleep 2000 - goto wait_dnode4_vgroup_offline -endi - -print ============== step4: alter table and tag, then drop all sub tables, recreate som subtable and insert more data rows -sql alter table $stb drop column c1 -sql alter table $stb add column f1 double - -sql alter table $stb add tag t2 int -sql alter table $stb add tag t3 int -sql alter table $stb drop tag t1 - -$i = 0 -while $i < $tblNum - $tb = tb . $i - sql drop table $tb - $i = $i + 1 -endw - -$totalRows = 0 -$i = 0 -while $i < $tblNum - $tb = tb . $i - sql create table $tb using $stb tags( $i , $i , $i ) - - $x = 0 - while $x < $rowNum - $ts = $tsStart + $x - sql insert into $tb values ( $ts + 0a , $x , $x ) ( $ts + 1a , $x , $x ) ( $ts + 2a , $x , $x ) ( $ts + 3a , $x , $x ) ( $ts + 4a , $x , $x ) ( $ts + 5a , $x , $x ) ( $ts + 6a , $x , $x ) ( $ts + 7a , $x , $x ) ( $ts + 8a , $x , $x ) ( $ts + 9a , $x , $x ) ( $ts + 10a , $x , $x ) ( $ts + 11a , $x , $x ) ( $ts + 12a , $x , $x ) ( $ts + 13a , $x , $x ) ( $ts + 14a , $x , $x ) ( $ts + 15a , $x , $x ) ( $ts + 16a , $x , $x ) ( $ts + 17a , $x , $x ) ( $ts + 18a , $x , $x ) ( $ts + 19a , $x , $x ) - $x = $x + 20 - endw - $totalRows = $totalRows + $x - print info: inserted $x rows into $tb and totalRows: $totalRows - $i = $i + 1 -endw -$tsEnd = $tsStart + $totalRows / $tblNum - -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - -print ============== step5: restart dnode4, waiting dnode4 synced -system sh/exec.sh -n dnode4 -s start - -$cnt = 0 -wait_dnode4_ready: -$cnt = $cnt + 1 -if $cnt == 20 then - return -1 -endi -sql select * from information_schema.ins_dnodes -if $rows != 5 then - sleep 2000 - goto wait_dnode4_ready -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 -#$dnode1Status = $data4_1 -#$dnode2Status = $data4_2 -$dnode3Status = $data4_3 -$dnode4Status = $data4_4 -#$dnode5Status = $data4_5 - -if $dnode4Status != ready then - sleep 2000 - goto wait_dnode4_ready -endi - -print ============== step6: check result - -sql reset query cache - -$cnt = 0 -wait_table_dropped: -$cnt = $cnt + 1 -if $cnt == 20 then - return -1 -endi -sql select count(*) from $stb -if $data00 != $totalRows then - print data00: $data00 totalRows: $totalRows - sleep 2000 - goto wait_table_dropped -endi - - - - diff --git a/tests/script/tsim/backup/arbitrator/offline_replica3_createTable_online.sim b/tests/script/tsim/backup/arbitrator/offline_replica3_createTable_online.sim deleted file mode 100644 index ae26952b6b..0000000000 --- a/tests/script/tsim/backup/arbitrator/offline_replica3_createTable_online.sim +++ /dev/null @@ -1,234 +0,0 @@ -system sh/stop_dnodes.sh -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -system sh/deploy.sh -n dnode3 -i 3 -system sh/deploy.sh -n dnode4 -i 4 - -system sh/cfg.sh -n dnode1 -c 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 dnode1 -c walLevel -v 2 -system sh/cfg.sh -n dnode2 -c walLevel -v 2 -system sh/cfg.sh -n dnode3 -c walLevel -v 2 -system sh/cfg.sh -n dnode4 -c walLevel -v 2 - -system sh/cfg.sh -n dnode1 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode2 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode3 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode4 -c balanceInterval -v 10 - -system sh/cfg.sh -n dnode1 -c role -v 1 -system sh/cfg.sh -n dnode2 -c role -v 2 -system sh/cfg.sh -n dnode3 -c role -v 2 -system sh/cfg.sh -n dnode4 -c role -v 2 - -$totalTableNum = 10 -system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 20 -system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v 20 -system sh/cfg.sh -n dnode3 -c maxtablesPerVnode -v 20 -system sh/cfg.sh -n dnode4 -c maxtablesPerVnode -v 20 - -system sh/cfg.sh -n dnode1 -c maxVgroupsPerDb -v 1 -system sh/cfg.sh -n dnode2 -c maxVgroupsPerDb -v 1 -system sh/cfg.sh -n dnode3 -c maxVgroupsPerDb -v 1 -system sh/cfg.sh -n dnode4 -c maxVgroupsPerDb -v 1 - -system sh/cfg.sh -n dnode1 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode2 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode3 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode4 -c arbitrator -v $arbitrator - -print ============== step0: start tarbitrator -system sh/exec_tarbitrator.sh -s start - -print ============== step1: start dnode1, only deploy mnode -system sh/exec.sh -n dnode1 -s start -sleep 2000 -sql connect - -print ============== step2: start dnode2/dnode3/dnode4 and add into cluster , then create database with replica 3, and create table, insert data -system sh/exec.sh -n dnode2 -s start -system sh/exec.sh -n dnode3 -s start -system sh/exec.sh -n dnode4 -s start -sql create dnode $hostname2 -sql create dnode $hostname3 -sql create dnode $hostname4 -sleep 2000 - -$totalTableNum = 10 -$sleepTimer = 3000 -$maxTables = $totalTableNum * 2 - -$db = db -print create database $db replica 3 -sql create database $db replica 3 -sql use $db - -# create table , insert data -$stb = stb -sql create table $stb (ts timestamp, c1 int) tags(t1 int) -$rowNum = 500 -$tblNum = $totalTableNum -$totalRows = 0 -$tsStart = 1420041600000 -$tsEnd = 0 - -$i = 0 -while $i < $tblNum - $tb = tb . $i - sql create table $tb using $stb tags( $i ) - - $x = 0 - while $x < $rowNum - $ts = $tsStart + $x - sql insert into $tb values ( $ts + 0a , $x ) ( $ts + 1a , $x ) ( $ts + 2a , $x ) ( $ts + 3a , $x ) ( $ts + 4a , $x ) ( $ts + 5a , $x ) ( $ts + 6a , $x ) ( $ts + 7a , $x ) ( $ts + 8a , $x ) ( $ts + 9a , $x ) ( $ts + 10a , $x ) ( $ts + 11a , $x ) ( $ts + 12a , $x ) ( $ts + 13a , $x ) ( $ts + 14a , $x ) ( $ts + 15a , $x ) ( $ts + 16a , $x ) ( $ts + 17a , $x ) ( $ts + 18a , $x ) ( $ts + 19a , $x ) ( $ts + 20a , $x ) ( $ts + 21a , $x ) ( $ts + 22a , $x ) ( $ts + 23a , $x ) ( $ts + 24a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 35a , $x ) ( $ts + 36a , $x ) ( $ts + 37a , $x ) ( $ts + 38a , $x ) ( $ts + 39a , $x ) ( $ts + 40a , $x ) ( $ts + 41a , $x ) ( $ts + 42a , $x ) ( $ts + 43a , $x ) ( $ts + 44a , $x ) ( $ts + 45a , $x ) ( $ts + 46a , $x ) ( $ts + 47a , $x ) ( $ts + 48a , $x ) ( $ts + 49a , $x ) ( $ts + 50a , $x ) ( $ts + 51a , $x ) ( $ts + 52a , $x ) ( $ts + 53a , $x ) ( $ts + 54a , $x ) ( $ts + 55a , $x ) ( $ts + 56a , $x ) ( $ts + 57a , $x ) ( $ts + 58a , $x ) ( $ts + 59a , $x ) - $x = $x + 60 - endw - $totalRows = $totalRows + $x - print info: inserted $x rows into $tb and totalRows: $totalRows - $i = $i + 1 -endw -$tsEnd = $tsStart + $totalRows / $tblNum - -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - -print ============== step3: stop dnode4 -system sh/exec.sh -n dnode4 -s stop -x SIGINT -sleep $sleepTimer -$cnt = 0 -wait_dnode4_offline_0: -$cnt = $cnt + 1 -if $cnt == 20 then - return -1 -endi -sql select * from information_schema.ins_dnodes -if $rows != 5 then - sleep 2000 - goto wait_dnode4_offline_0 -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 -#$dnode1Status = $data4_1 -$dnode2Status = $data4_2 -$dnode3Status = $data4_3 -$dnode4Status = $data4_4 -#$dnode5Status = $data4_5 - -if $dnode4Status != offline then - sleep 2000 - goto wait_dnode4_offline_0 -endi - -$cnt = 0 -wait_dnode4_vgroup_offline: -$cnt = $cnt + 1 -if $cnt == 20 then - return -1 -endi -sql show vgroups -if $rows != 1 then - sleep 2000 - goto wait_dnode4_vgroup_offline -endi -print show vgroups: -print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 $data5_1 $data6_1 $data7_1 $data8_1 $data9_1 -print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 $data5_2 $data6_2 $data7_2 $data8_2 $data9_2 -print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3 $data5_3 $data6_3 $data7_3 $data8_3 $data9_3 -$dnode4Vtatus = $data5_2 -$dnode3Vtatus = $data7_2 - -if $dnode4Vtatus != offline then - sleep 2000 - goto wait_dnode4_vgroup_offline -endi -if $dnode3Vtatus != master then - sleep 2000 - goto wait_dnode4_vgroup_offline -endi - -print ============== step4: create more tables and insert data rows -$tsStart = $tsEnd + 1000 -$i = $tblNum -$tblNum = $tblNum * 2 -while $i < $tblNum - $tb = tb . $i - sql create table $tb using $stb tags( $i ) - - $x = 0 - while $x < $rowNum - $ts = $tsStart + $x - sql insert into $tb values ( $ts + 0a , $x ) ( $ts + 1a , $x ) ( $ts + 2a , $x ) ( $ts + 3a , $x ) ( $ts + 4a , $x ) ( $ts + 5a , $x ) ( $ts + 6a , $x ) ( $ts + 7a , $x ) ( $ts + 8a , $x ) ( $ts + 9a , $x ) ( $ts + 10a , $x ) ( $ts + 11a , $x ) ( $ts + 12a , $x ) ( $ts + 13a , $x ) ( $ts + 14a , $x ) ( $ts + 15a , $x ) ( $ts + 16a , $x ) ( $ts + 17a , $x ) ( $ts + 18a , $x ) ( $ts + 19a , $x ) ( $ts + 20a , $x ) ( $ts + 21a , $x ) ( $ts + 22a , $x ) ( $ts + 23a , $x ) ( $ts + 24a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 35a , $x ) ( $ts + 36a , $x ) ( $ts + 37a , $x ) ( $ts + 38a , $x ) ( $ts + 39a , $x ) ( $ts + 40a , $x ) ( $ts + 41a , $x ) ( $ts + 42a , $x ) ( $ts + 43a , $x ) ( $ts + 44a , $x ) ( $ts + 45a , $x ) ( $ts + 46a , $x ) ( $ts + 47a , $x ) ( $ts + 48a , $x ) ( $ts + 49a , $x ) ( $ts + 50a , $x ) ( $ts + 51a , $x ) ( $ts + 52a , $x ) ( $ts + 53a , $x ) ( $ts + 54a , $x ) ( $ts + 55a , $x ) ( $ts + 56a , $x ) ( $ts + 57a , $x ) ( $ts + 58a , $x ) ( $ts + 59a , $x ) - $x = $x + 60 - endw - $totalRows = $totalRows + $x - print info: inserted $x rows into $tb and totalRows: $totalRows - $i = $i + 1 -endw - -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - -print ============== step5: restart dnode4, waiting dnode4 synced -system sh/exec.sh -n dnode4 -s start - -$cnt = 0 -wait_dnode4_ready: -$cnt = $cnt + 1 -if $cnt == 20 then - return -1 -endi -sql select * from information_schema.ins_dnodes -if $rows != 5 then - sleep 2000 - goto wait_dnode4_ready -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 -#$dnode1Status = $data4_1 -#$dnode2Status = $data4_2 -$dnode3Status = $data4_3 -$dnode4Status = $data4_4 -#$dnode5Status = $data4_5 - -if $dnode4Status != ready then - sleep 2000 - goto wait_dnode4_ready -endi - -print ============== step6: check result - -sql reset query cache - -$cnt = 0 -wait_table_altered: -$cnt = $cnt + 1 -if $cnt == 20 then - return -1 -endi -sql select count(*) from $stb -if $data00 != $totalRows then - print data00: $data00 - sleep 2000 - goto wait_table_altered -endi - - - - diff --git a/tests/script/tsim/backup/arbitrator/offline_replica3_dropDb_online.sim b/tests/script/tsim/backup/arbitrator/offline_replica3_dropDb_online.sim deleted file mode 100644 index a8143b2c75..0000000000 --- a/tests/script/tsim/backup/arbitrator/offline_replica3_dropDb_online.sim +++ /dev/null @@ -1,180 +0,0 @@ -system sh/stop_dnodes.sh -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -system sh/deploy.sh -n dnode3 -i 3 -system sh/deploy.sh -n dnode4 -i 4 - -system sh/cfg.sh -n dnode1 -c 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 dnode1 -c walLevel -v 2 -system sh/cfg.sh -n dnode2 -c walLevel -v 2 -system sh/cfg.sh -n dnode3 -c walLevel -v 2 -system sh/cfg.sh -n dnode4 -c walLevel -v 2 - -system sh/cfg.sh -n dnode1 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode2 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode3 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode4 -c balanceInterval -v 10 - -system sh/cfg.sh -n dnode1 -c role -v 1 -system sh/cfg.sh -n dnode2 -c role -v 2 -system sh/cfg.sh -n dnode3 -c role -v 2 -system sh/cfg.sh -n dnode4 -c role -v 2 - -$totalTableNum = 10 -system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v $totalTableNum -system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v $totalTableNum -system sh/cfg.sh -n dnode3 -c maxtablesPerVnode -v $totalTableNum -system sh/cfg.sh -n dnode4 -c maxtablesPerVnode -v $totalTableNum - -system sh/cfg.sh -n dnode1 -c maxVgroupsPerDb -v 1 -system sh/cfg.sh -n dnode2 -c maxVgroupsPerDb -v 1 -system sh/cfg.sh -n dnode3 -c maxVgroupsPerDb -v 1 -system sh/cfg.sh -n dnode4 -c maxVgroupsPerDb -v 1 - -system sh/cfg.sh -n dnode1 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode2 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode3 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode4 -c arbitrator -v $arbitrator - -print ============== step0: start tarbitrator -system sh/exec_tarbitrator.sh -s start - -print ============== step1: start dnode1, only deploy mnode -system sh/exec.sh -n dnode1 -s start -sleep 2000 -sql connect - -print ============== step2: start dnode2/dnode3/dnode4 and add into cluster , then create database with replica 3, and create table, insert data -system sh/exec.sh -n dnode2 -s start -system sh/exec.sh -n dnode3 -s start -system sh/exec.sh -n dnode4 -s start -sql create dnode $hostname2 -sql create dnode $hostname3 -sql create dnode $hostname4 -sleep 2000 - -$totalTableNum = 10 -$sleepTimer = 3000 - -$db = db -print create database $db replica 3 -sql create database $db replica 3 -sql use $db - -# create table , insert data -$stb = stb -sql create table $stb (ts timestamp, c1 int) tags(t1 int) -$rowNum = 500 -$tblNum = $totalTableNum -$totalRows = 0 -$tsStart = 1420041600000 -$tsEnd = 0 - -$i = 0 -while $i < $tblNum - $tb = tb . $i - sql create table $tb using $stb tags( $i ) - - $x = 0 - while $x < $rowNum - $ts = $tsStart + $x - sql insert into $tb values ( $ts + 0a , $x ) ( $ts + 1a , $x ) ( $ts + 2a , $x ) ( $ts + 3a , $x ) ( $ts + 4a , $x ) ( $ts + 5a , $x ) ( $ts + 6a , $x ) ( $ts + 7a , $x ) ( $ts + 8a , $x ) ( $ts + 9a , $x ) ( $ts + 10a , $x ) ( $ts + 11a , $x ) ( $ts + 12a , $x ) ( $ts + 13a , $x ) ( $ts + 14a , $x ) ( $ts + 15a , $x ) ( $ts + 16a , $x ) ( $ts + 17a , $x ) ( $ts + 18a , $x ) ( $ts + 19a , $x ) ( $ts + 20a , $x ) ( $ts + 21a , $x ) ( $ts + 22a , $x ) ( $ts + 23a , $x ) ( $ts + 24a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 35a , $x ) ( $ts + 36a , $x ) ( $ts + 37a , $x ) ( $ts + 38a , $x ) ( $ts + 39a , $x ) ( $ts + 40a , $x ) ( $ts + 41a , $x ) ( $ts + 42a , $x ) ( $ts + 43a , $x ) ( $ts + 44a , $x ) ( $ts + 45a , $x ) ( $ts + 46a , $x ) ( $ts + 47a , $x ) ( $ts + 48a , $x ) ( $ts + 49a , $x ) ( $ts + 50a , $x ) ( $ts + 51a , $x ) ( $ts + 52a , $x ) ( $ts + 53a , $x ) ( $ts + 54a , $x ) ( $ts + 55a , $x ) ( $ts + 56a , $x ) ( $ts + 57a , $x ) ( $ts + 58a , $x ) ( $ts + 59a , $x ) - $x = $x + 60 - endw - $totalRows = $totalRows + $x - print info: inserted $x rows into $tb and totalRows: $totalRows - $i = $i + 1 -endw -$tsEnd = $tsStart + $totalRows / $tblNum - -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - -print ============== step3: stop dnode4 -system sh/exec.sh -n dnode4 -s stop -x SIGINT -sleep $sleepTimer -$cnt = 0 -wait_dnode4_offline_0: -$cnt = $cnt + 1 -if $cnt == 20 then - return -1 -endi -sql select * from information_schema.ins_dnodes -if $rows != 5 then - sleep 2000 - goto wait_dnode4_offline_0 -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 -#$dnode1Status = $data4_1 -$dnode2Status = $data4_2 -$dnode3Status = $data4_3 -$dnode4Status = $data4_4 -#$dnode5Status = $data4_5 - -if $dnode4Status != offline then - sleep 2000 - goto wait_dnode4_offline_0 -endi - -$cnt = 0 -wait_dnode4_vgroup_offline: -$cnt = $cnt + 1 -if $cnt == 20 then - return -1 -endi -sql show vgroups -if $rows != 1 then - sleep 2000 - goto wait_dnode4_vgroup_offline -endi -print show vgroups: -print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 $data5_1 $data6_1 $data7_1 $data8_1 $data9_1 -print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 $data5_2 $data6_2 $data7_2 $data8_2 $data9_2 -print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3 $data5_3 $data6_3 $data7_3 $data8_3 $data9_3 -$dnode4Vtatus = $data5_2 -$dnode3Vtatus = $data7_2 - -if $dnode4Vtatus != offline then - sleep 2000 - goto wait_dnode4_vgroup_offline -endi -if $dnode3Vtatus != master then - sleep 2000 - goto wait_dnode4_vgroup_offline -endi - -print ============== step4: drop db -sql drop database $db - -print ============== step5: restart dnode4 -system sh/exec.sh -n dnode4 -s start - -print ============== step6: check result -sql reset query cache -$cnt = 0 -wait_database_dropped: -$cnt = $cnt + 1 -if $cnt == 20 then - return -1 -endi -sql select * from information_schema.ins_databases -if $rows != 0 then - sleep 2000 - goto wait_database_dropped -endi - - - - diff --git a/tests/script/tsim/backup/arbitrator/offline_replica3_dropTable_online.sim b/tests/script/tsim/backup/arbitrator/offline_replica3_dropTable_online.sim deleted file mode 100644 index c606d2a38f..0000000000 --- a/tests/script/tsim/backup/arbitrator/offline_replica3_dropTable_online.sim +++ /dev/null @@ -1,219 +0,0 @@ -system sh/stop_dnodes.sh -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -system sh/deploy.sh -n dnode3 -i 3 -system sh/deploy.sh -n dnode4 -i 4 - -system sh/cfg.sh -n dnode1 -c 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 dnode1 -c walLevel -v 2 -system sh/cfg.sh -n dnode2 -c walLevel -v 2 -system sh/cfg.sh -n dnode3 -c walLevel -v 2 -system sh/cfg.sh -n dnode4 -c walLevel -v 2 - -system sh/cfg.sh -n dnode1 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode2 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode3 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode4 -c balanceInterval -v 10 - -system sh/cfg.sh -n dnode1 -c role -v 1 -system sh/cfg.sh -n dnode2 -c role -v 2 -system sh/cfg.sh -n dnode3 -c role -v 2 -system sh/cfg.sh -n dnode4 -c role -v 2 - -$totalTableNum = 10 -system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v $totalTableNum -system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v $totalTableNum -system sh/cfg.sh -n dnode3 -c maxtablesPerVnode -v $totalTableNum -system sh/cfg.sh -n dnode4 -c maxtablesPerVnode -v $totalTableNum - -system sh/cfg.sh -n dnode1 -c maxVgroupsPerDb -v 1 -system sh/cfg.sh -n dnode2 -c maxVgroupsPerDb -v 1 -system sh/cfg.sh -n dnode3 -c maxVgroupsPerDb -v 1 -system sh/cfg.sh -n dnode4 -c maxVgroupsPerDb -v 1 - -system sh/cfg.sh -n dnode1 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode2 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode3 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode4 -c arbitrator -v $arbitrator - -print ============== step0: start tarbitrator -system sh/exec_tarbitrator.sh -s start - -print ============== step1: start dnode1, only deploy mnode -system sh/exec.sh -n dnode1 -s start -sleep 2000 -sql connect - -print ============== step2: start dnode2/dnode3/dnode4 and add into cluster , then create database with replica 3, and create table, insert data -system sh/exec.sh -n dnode2 -s start -system sh/exec.sh -n dnode3 -s start -system sh/exec.sh -n dnode4 -s start -sql create dnode $hostname2 -sql create dnode $hostname3 -sql create dnode $hostname4 -sleep 2000 - -$totalTableNum = 10 -$sleepTimer = 3000 - -$db = db -print create database $db replica 3 -sql create database $db replica 3 -sql use $db - -# create table , insert data -$stb = stb -sql create table $stb (ts timestamp, c1 int) tags(t1 int) -$rowNum = 500 -$tblNum = $totalTableNum -$totalRows = 0 -$tsStart = 1420041600000 -$tsEnd = 0 - -$i = 0 -while $i < $tblNum - $tb = tb . $i - sql create table $tb using $stb tags( $i ) - - $x = 0 - while $x < $rowNum - $ts = $tsStart + $x - sql insert into $tb values ( $ts + 0a , $x ) ( $ts + 1a , $x ) ( $ts + 2a , $x ) ( $ts + 3a , $x ) ( $ts + 4a , $x ) ( $ts + 5a , $x ) ( $ts + 6a , $x ) ( $ts + 7a , $x ) ( $ts + 8a , $x ) ( $ts + 9a , $x ) ( $ts + 10a , $x ) ( $ts + 11a , $x ) ( $ts + 12a , $x ) ( $ts + 13a , $x ) ( $ts + 14a , $x ) ( $ts + 15a , $x ) ( $ts + 16a , $x ) ( $ts + 17a , $x ) ( $ts + 18a , $x ) ( $ts + 19a , $x ) ( $ts + 20a , $x ) ( $ts + 21a , $x ) ( $ts + 22a , $x ) ( $ts + 23a , $x ) ( $ts + 24a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 35a , $x ) ( $ts + 36a , $x ) ( $ts + 37a , $x ) ( $ts + 38a , $x ) ( $ts + 39a , $x ) ( $ts + 40a , $x ) ( $ts + 41a , $x ) ( $ts + 42a , $x ) ( $ts + 43a , $x ) ( $ts + 44a , $x ) ( $ts + 45a , $x ) ( $ts + 46a , $x ) ( $ts + 47a , $x ) ( $ts + 48a , $x ) ( $ts + 49a , $x ) ( $ts + 50a , $x ) ( $ts + 51a , $x ) ( $ts + 52a , $x ) ( $ts + 53a , $x ) ( $ts + 54a , $x ) ( $ts + 55a , $x ) ( $ts + 56a , $x ) ( $ts + 57a , $x ) ( $ts + 58a , $x ) ( $ts + 59a , $x ) - $x = $x + 60 - endw - $totalRows = $totalRows + $x - print info: inserted $x rows into $tb and totalRows: $totalRows - $i = $i + 1 -endw -$tsEnd = $tsStart + $totalRows / $tblNum - -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - -print ============== step3: stop dnode4 -system sh/exec.sh -n dnode4 -s stop -x SIGINT -sleep $sleepTimer -$cnt = 0 -wait_dnode4_offline_0: -$cnt = $cnt + 1 -if $cnt == 20 then - return -1 -endi -sql select * from information_schema.ins_dnodes -if $rows != 5 then - sleep 2000 - goto wait_dnode4_offline_0 -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 -#$dnode1Status = $data4_1 -$dnode2Status = $data4_2 -$dnode3Status = $data4_3 -$dnode4Status = $data4_4 -#$dnode5Status = $data4_5 - -if $dnode4Status != offline then - sleep 2000 - goto wait_dnode4_offline_0 -endi - -$cnt = 0 -wait_dnode4_vgroup_offline: -$cnt = $cnt + 1 -if $cnt == 20 then - return -1 -endi -sql show vgroups -if $rows != 1 then - sleep 2000 - goto wait_dnode4_vgroup_offline -endi -print show vgroups: -print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 $data5_1 $data6_1 $data7_1 $data8_1 $data9_1 -print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 $data5_2 $data6_2 $data7_2 $data8_2 $data9_2 -print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3 $data5_3 $data6_3 $data7_3 $data8_3 $data9_3 -$dnode4Vtatus = $data5_2 -$dnode3Vtatus = $data7_2 - -if $dnode4Vtatus != offline then - sleep 2000 - goto wait_dnode4_vgroup_offline -endi -if $dnode3Vtatus != master then - sleep 2000 - goto wait_dnode4_vgroup_offline -endi - -print ============== step4: drop some tables -$i = 1 -$dropTblNum = 6 - -while $i < $dropTblNum - $tb = tb . $i - sql drop table if exists $tb - $i = $i + 1 -endw -$tblNum = $tblNum - 5 - -print ============== step5: restart dnode4, waiting dnode4 synced -system sh/exec.sh -n dnode4 -s start - -$cnt = 0 -wait_dnode4_ready: -$cnt = $cnt + 1 -if $cnt == 20 then - return -1 -endi -sql select * from information_schema.ins_dnodes -if $rows != 5 then - sleep 2000 - goto wait_dnode4_ready -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 -#$dnode1Status = $data4_1 -#$dnode2Status = $data4_2 -$dnode3Status = $data4_3 -$dnode4Status = $data4_4 -#$dnode5Status = $data4_5 - -if $dnode4Status != ready then - sleep 2000 - goto wait_dnode4_ready -endi - -print ============== step6: check result - -sql reset query cache - -$cnt = 0 -wait_table_dropped: -$cnt = $cnt + 1 -if $cnt == 20 then - return -1 -endi -sql select count(tbname) from $stb -if $data00 != $tblNum then - print data00: $data00 tblNum: $tblNum - sleep 2000 - goto wait_table_dropped -endi - - - - diff --git a/tests/script/tsim/backup/arbitrator/replica_changeWithArbitrator.sim b/tests/script/tsim/backup/arbitrator/replica_changeWithArbitrator.sim deleted file mode 100644 index b34f1c8304..0000000000 --- a/tests/script/tsim/backup/arbitrator/replica_changeWithArbitrator.sim +++ /dev/null @@ -1,238 +0,0 @@ -system sh/stop_dnodes.sh -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -system sh/deploy.sh -n dnode3 -i 3 -system sh/deploy.sh -n dnode4 -i 4 - -system sh/cfg.sh -n dnode1 -c 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 dnode1 -c walLevel -v 2 -system sh/cfg.sh -n dnode2 -c walLevel -v 2 -system sh/cfg.sh -n dnode3 -c walLevel -v 2 -system sh/cfg.sh -n dnode4 -c walLevel -v 2 - -system sh/cfg.sh -n dnode1 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode2 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode3 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode4 -c balanceInterval -v 10 - -system sh/cfg.sh -n dnode1 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode2 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode3 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode4 -c mnodeEqualVnodeNum -v 4 - -system sh/cfg.sh -n dnode1 -c role -v 0 -system sh/cfg.sh -n dnode2 -c role -v 0 -system sh/cfg.sh -n dnode3 -c role -v 0 -system sh/cfg.sh -n dnode4 -c role -v 0 - -$totalTableNum = 12 -system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v $totalTableNum -system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v $totalTableNum -system sh/cfg.sh -n dnode3 -c maxtablesPerVnode -v $totalTableNum -system sh/cfg.sh -n dnode4 -c maxtablesPerVnode -v $totalTableNum - -system sh/cfg.sh -n dnode1 -c maxVgroupsPerDb -v 1 -system sh/cfg.sh -n dnode2 -c maxVgroupsPerDb -v 1 -system sh/cfg.sh -n dnode3 -c maxVgroupsPerDb -v 1 -system sh/cfg.sh -n dnode4 -c maxVgroupsPerDb -v 1 - -system sh/cfg.sh -n dnode1 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode2 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode3 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode4 -c arbitrator -v $arbitrator - -system sh/cfg.sh -n dnode1 -c offlineThreshold -v 8 -system sh/cfg.sh -n dnode2 -c offlineThreshold -v 8 -system sh/cfg.sh -n dnode3 -c offlineThreshold -v 8 -system sh/cfg.sh -n dnode4 -c offlineThreshold -v 8 - -system sh/cfg.sh -n dnode1 -c statusInterval -v 3 -system sh/cfg.sh -n dnode2 -c statusInterval -v 3 -system sh/cfg.sh -n dnode3 -c statusInterval -v 3 -system sh/cfg.sh -n dnode4 -c statusInterval -v 3 - -print ============== step0: start tarbitrator -system sh/exec_tarbitrator.sh -s start - -print ============== step1: replica is 1, and start 1 dnode, then create tables and insert data -system sh/exec.sh -n dnode1 -s start -sleep 2000 -sql connect - -$totalTableNum = 12 - -$db = db -sql create database $db replica 1 -sql use $db - -# create table , insert data -$stb = stb -sql create table $stb (ts timestamp, c1 int) tags(t1 int) -$rowNum = 10 -$tblNum = $totalTableNum -$totalRows = $rowNum * $tblNum - -$ts0 = 1420041600000 -$ts = $ts0 -$delta = 1 - -$i = 0 -while $i < $tblNum - $tb = tb . $i - sql create table $tb using $stb tags( $i ) - - $x = 0 - while $x < $rowNum - $xs = $x * $delta - $ts = $ts0 + $xs - sql insert into $tb values ( $ts , $x ) - $x = $x + 1 - endw - $i = $i + 1 - print $tb inserted rows: $x -endw - -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - -print ============== step2: add 1 new dnode, expect balanced -system sh/exec.sh -n dnode2 -s start -sql create dnode $hostname2 -sleep 2000 - -# expect after balanced, 2 vondes in dnode1, 1 vonde in dnode2 -$cnt = 0 -wait_dnode2_ready: -$cnt = $cnt + 1 -if $cnt == 20 then - return -1 -endi -sql select * from information_schema.ins_dnodes -if $rows != 3 then - sleep 2000 - goto wait_dnode2_ready -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 -$dnode1Status = $data4_1 -$dnode2Status = $data4_2 - -if $dnode1Status != ready then - sleep 2000 - goto wait_dnode2_ready -endi -if $dnode2Status != ready then - sleep 2000 - goto wait_dnode2_ready -endi - -print ============== step3: stop dnode1/dnode2, modify cfg numOfMnodes to 2, and restart dnode1/dnode2 -system sh/exec.sh -n dnode1 -s stop -system sh/exec.sh -n dnode2 -s stop -sleep 2000 - -system sh/cfg.sh -n dnode1 -c numOfMnodes -v 2 -system sh/cfg.sh -n dnode2 -c numOfMnodes -v 2 - -system sh/cfg.sh -n dnode1 -c mnodeEqualVnodeNum -v 4 -system sh/cfg.sh -n dnode2 -c mnodeEqualVnodeNum -v 4 - -system sh/cfg.sh -n dnode1 -c role -v 1 -system sh/cfg.sh -n dnode2 -c role -v 0 - -system sh/exec.sh -n dnode1 -s start -system sh/exec.sh -n dnode2 -s start -sleep 3000 - - -print ============= step4: wait dnode ready -$cnt = 0 -wait_dnode_ready: -$cnt = $cnt + 1 -if $cnt == 10 then - return -1 -endi -sql select * from information_schema.ins_dnodes -if $rows != 3 then - sleep 2000 - goto wait_dnode_ready -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 -$dnode1Status = $data4_1 -$dnode2Status = $data4_2 -#$dnode3Status = $data4_3 -#$dnode4Status = $data4_4 -#$dnode5Status = $data4_5 - -if $dnode1Status != ready then - sleep 2000 - goto wait_dnode_ready -endi -if $dnode2Status != ready then - sleep 2000 - goto wait_dnode_ready -endi - -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - -print ============== step5: stop dnode1 -sleep 3000 -system sh/exec.sh -n dnode1 -s stop -sleep 2000 - -$cnt = 0 -wait_dnode2_master: -$cnt = $cnt + 1 -if $cnt == 10 then - return -1 -endi -sql select * from information_schema.ins_mnodes -if $rows != 2 then - sleep 2000 - goto wait_dnode2_master -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 -$dnode1Status = $data4_1 -$dnode2Status = $data4_2 -#$dnode3Status = $data4_3 -#$dnode4Status = $data4_4 -#$dnode5Status = $data4_5 - -if $data2_1 != offline then - sleep 2000 - goto wait_dnode2_master -endi -if $data2_2 != master then - sleep 2000 - goto wait_dnode2_master -endi - -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - - diff --git a/tests/script/tsim/backup/arbitrator/sync_replica2_alterTable_add.sim b/tests/script/tsim/backup/arbitrator/sync_replica2_alterTable_add.sim deleted file mode 100644 index 23d22e4f7f..0000000000 --- a/tests/script/tsim/backup/arbitrator/sync_replica2_alterTable_add.sim +++ /dev/null @@ -1,204 +0,0 @@ -system sh/stop_dnodes.sh -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -system sh/deploy.sh -n dnode3 -i 3 -system sh/deploy.sh -n dnode4 -i 4 - -system sh/cfg.sh -n dnode1 -c 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 dnode1 -c walLevel -v 2 -system sh/cfg.sh -n dnode2 -c walLevel -v 2 -system sh/cfg.sh -n dnode3 -c walLevel -v 2 -system sh/cfg.sh -n dnode4 -c walLevel -v 2 - -system sh/cfg.sh -n dnode1 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode2 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode3 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode4 -c balanceInterval -v 10 - -system sh/cfg.sh -n dnode1 -c role -v 1 -system sh/cfg.sh -n dnode2 -c role -v 2 -system sh/cfg.sh -n dnode3 -c role -v 2 -system sh/cfg.sh -n dnode4 -c role -v 2 - -$totalTableNum = 10 -system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v $totalTableNum -system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v $totalTableNum -system sh/cfg.sh -n dnode3 -c maxtablesPerVnode -v $totalTableNum -system sh/cfg.sh -n dnode4 -c maxtablesPerVnode -v $totalTableNum - -system sh/cfg.sh -n dnode1 -c maxVgroupsPerDb -v 1 -system sh/cfg.sh -n dnode2 -c maxVgroupsPerDb -v 1 -system sh/cfg.sh -n dnode3 -c maxVgroupsPerDb -v 1 -system sh/cfg.sh -n dnode4 -c maxVgroupsPerDb -v 1 - -system sh/cfg.sh -n dnode1 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode2 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode3 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode4 -c arbitrator -v $arbitrator - -print ============== step0: start tarbitrator -system sh/exec_tarbitrator.sh -s start - -print ============== step1: start dnode1, only deploy mnode -system sh/exec.sh -n dnode1 -s start -sleep 2000 -sql connect - -print ============== step2: start dnode2/dnode3/dnode4 and add into cluster , then create database with replica 2, and create table, insert data -system sh/exec.sh -n dnode2 -s start -#system sh/exec.sh -n dnode3 -s start -system sh/exec.sh -n dnode4 -s start -sql create dnode $hostname2 -#sql create dnode $hostname3 -sql create dnode $hostname4 -sleep 2000 - -$totalTableNum = 10 -$sleepTimer = 3000 - -$db = db -print create database $db replica 2 -sql create database $db replica 2 -sql use $db - -# create table , insert data -$stb = stb -sql create table $stb (ts timestamp, c1 int) tags(t1 int) -$rowNum = 500 -$tblNum = $totalTableNum -$totalRows = 0 -$tsStart = 1420041600000 -$tsEnd = 0 - -$i = 0 -while $i < $tblNum - $tb = tb . $i - sql create table $tb using $stb tags( $i ) - - $x = 0 - while $x < $rowNum - $ts = $tsStart + $x - sql insert into $tb values ( $ts + 0a , $x ) ( $ts + 1a , $x ) ( $ts + 2a , $x ) ( $ts + 3a , $x ) ( $ts + 4a , $x ) ( $ts + 5a , $x ) ( $ts + 6a , $x ) ( $ts + 7a , $x ) ( $ts + 8a , $x ) ( $ts + 9a , $x ) ( $ts + 10a , $x ) ( $ts + 11a , $x ) ( $ts + 12a , $x ) ( $ts + 13a , $x ) ( $ts + 14a , $x ) ( $ts + 15a , $x ) ( $ts + 16a , $x ) ( $ts + 17a , $x ) ( $ts + 18a , $x ) ( $ts + 19a , $x ) ( $ts + 20a , $x ) ( $ts + 21a , $x ) ( $ts + 22a , $x ) ( $ts + 23a , $x ) ( $ts + 24a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 35a , $x ) ( $ts + 36a , $x ) ( $ts + 37a , $x ) ( $ts + 38a , $x ) ( $ts + 39a , $x ) ( $ts + 40a , $x ) ( $ts + 41a , $x ) ( $ts + 42a , $x ) ( $ts + 43a , $x ) ( $ts + 44a , $x ) ( $ts + 45a , $x ) ( $ts + 46a , $x ) ( $ts + 47a , $x ) ( $ts + 48a , $x ) ( $ts + 49a , $x ) ( $ts + 50a , $x ) ( $ts + 51a , $x ) ( $ts + 52a , $x ) ( $ts + 53a , $x ) ( $ts + 54a , $x ) ( $ts + 55a , $x ) ( $ts + 56a , $x ) ( $ts + 57a , $x ) ( $ts + 58a , $x ) ( $ts + 59a , $x ) - $x = $x + 60 - endw - $totalRows = $totalRows + $x - print info: inserted $x rows into $tb and totalRows: $totalRows - $i = $i + 1 -endw -$tsEnd = $tsStart + $totalRows / $tblNum - -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - -print ============== step3: stop dnode4 -system sh/exec.sh -n dnode4 -s stop -x SIGINT -sleep $sleepTimer -$cnt = 0 -wait_dnode4_offline_0: -$cnt = $cnt + 1 -if $cnt == 10 then - return -1 -endi -sql select * from information_schema.ins_dnodes -if $rows != 4 then - sleep 2000 - goto wait_dnode4_offline_0 -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 -#$dnode1Status = $data4_1 -$dnode2Status = $data4_2 -#$dnode3Status = $data4_3 -$dnode4Status = $data4_3 -#$dnode5Status = $data4_5 - -if $dnode4Status != offline then - sleep 2000 - goto wait_dnode4_offline_0 -endi - -$cnt = 0 -wait_dnode4_vgroup_offline: -$cnt = $cnt + 1 -if $cnt == 10 then - return -1 -endi -sql show vgroups -if $rows != 1 then - sleep 2000 - goto wait_dnode4_vgroup_offline -endi -print show vgroups: -print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 $data5_1 $data6_1 $data7_1 $data8_1 $data9_1 -print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 $data5_2 $data6_2 $data7_2 $data8_2 $data9_2 -print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3 $data5_3 $data6_3 $data7_3 $data8_3 $data9_3 -$dnode4Vtatus = $data5_2 -$dnode3Vtatus = $data7_2 - -if $dnode4Vtatus != offline then - sleep 2000 - goto wait_dnode4_vgroup_offline -endi -if $dnode3Vtatus != master then - sleep 2000 - goto wait_dnode4_vgroup_offline -endi - -print ============== step4: insert more data rows -$tsStart = $tsEnd + 1000 -$i = 0 -while $i < $tblNum - $tb = tb . $i - - $x = 0 - while $x < $rowNum - $ts = $tsStart + $x - sql insert into $tb values ( $ts + 0a , $x ) ( $ts + 1a , $x ) ( $ts + 2a , $x ) ( $ts + 3a , $x ) ( $ts + 4a , $x ) ( $ts + 5a , $x ) ( $ts + 6a , $x ) ( $ts + 7a , $x ) ( $ts + 8a , $x ) ( $ts + 9a , $x ) ( $ts + 10a , $x ) ( $ts + 11a , $x ) ( $ts + 12a , $x ) ( $ts + 13a , $x ) ( $ts + 14a , $x ) ( $ts + 15a , $x ) ( $ts + 16a , $x ) ( $ts + 17a , $x ) ( $ts + 18a , $x ) ( $ts + 19a , $x ) ( $ts + 20a , $x ) ( $ts + 21a , $x ) ( $ts + 22a , $x ) ( $ts + 23a , $x ) ( $ts + 24a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 35a , $x ) ( $ts + 36a , $x ) ( $ts + 37a , $x ) ( $ts + 38a , $x ) ( $ts + 39a , $x ) ( $ts + 40a , $x ) ( $ts + 41a , $x ) ( $ts + 42a , $x ) ( $ts + 43a , $x ) ( $ts + 44a , $x ) ( $ts + 45a , $x ) ( $ts + 46a , $x ) ( $ts + 47a , $x ) ( $ts + 48a , $x ) ( $ts + 49a , $x ) ( $ts + 50a , $x ) ( $ts + 51a , $x ) ( $ts + 52a , $x ) ( $ts + 53a , $x ) ( $ts + 54a , $x ) ( $ts + 55a , $x ) ( $ts + 56a , $x ) ( $ts + 57a , $x ) ( $ts + 58a , $x ) ( $ts + 59a , $x ) - $x = $x + 60 - endw - $totalRows = $totalRows + $x - print info: inserted $x rows into $tb and totalRows: $totalRows - $i = $i + 1 -endw - -sql select count(*) from $stb -print data00:$data00 totalRows:$totalRows -if $data00 != $totalRows then - return -1 -endi - -print ============== step5: restart dnode4, while alter table and insert data in other thead when dnode4 is syncing -system sh/exec.sh -n dnode4 -s start -run_back unique/arbitrator/sync_replica_alterTable_background_add.sim - -print ============== step6: check result -#in background.sim, add one column and insert 36 rows -$totalRows = $totalRows + 36 - -$cnt = 0 -wait_table_altered: -$cnt = $cnt + 1 -if $cnt == 20 then - return -1 -endi -sql select count(*) from $stb -if $data00 != $totalRows then - print data00:$data00 totalRows:$totalRows - sleep 2000 - goto wait_table_altered -endi - - - - diff --git a/tests/script/tsim/backup/arbitrator/sync_replica2_alterTable_drop.sim b/tests/script/tsim/backup/arbitrator/sync_replica2_alterTable_drop.sim deleted file mode 100644 index 3fc28f4d81..0000000000 --- a/tests/script/tsim/backup/arbitrator/sync_replica2_alterTable_drop.sim +++ /dev/null @@ -1,204 +0,0 @@ -system sh/stop_dnodes.sh -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -system sh/deploy.sh -n dnode3 -i 3 -system sh/deploy.sh -n dnode4 -i 4 - -system sh/cfg.sh -n dnode1 -c 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 dnode1 -c walLevel -v 2 -system sh/cfg.sh -n dnode2 -c walLevel -v 2 -system sh/cfg.sh -n dnode3 -c walLevel -v 2 -system sh/cfg.sh -n dnode4 -c walLevel -v 2 - -system sh/cfg.sh -n dnode1 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode2 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode3 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode4 -c balanceInterval -v 10 - -system sh/cfg.sh -n dnode1 -c role -v 1 -system sh/cfg.sh -n dnode2 -c role -v 2 -system sh/cfg.sh -n dnode3 -c role -v 2 -system sh/cfg.sh -n dnode4 -c role -v 2 - -$totalTableNum = 10 -system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v $totalTableNum -system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v $totalTableNum -system sh/cfg.sh -n dnode3 -c maxtablesPerVnode -v $totalTableNum -system sh/cfg.sh -n dnode4 -c maxtablesPerVnode -v $totalTableNum - -system sh/cfg.sh -n dnode1 -c maxVgroupsPerDb -v 1 -system sh/cfg.sh -n dnode2 -c maxVgroupsPerDb -v 1 -system sh/cfg.sh -n dnode3 -c maxVgroupsPerDb -v 1 -system sh/cfg.sh -n dnode4 -c maxVgroupsPerDb -v 1 - -system sh/cfg.sh -n dnode1 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode2 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode3 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode4 -c arbitrator -v $arbitrator - -print ============== step0: start tarbitrator -system sh/exec_tarbitrator.sh -s start - -print ============== step1: start dnode1, only deploy mnode -system sh/exec.sh -n dnode1 -s start -sleep 2000 -sql connect - -print ============== step2: start dnode2/dnode3/dnode4 and add into cluster , then create database with replica 2, and create table, insert data -system sh/exec.sh -n dnode2 -s start -#system sh/exec.sh -n dnode3 -s start -system sh/exec.sh -n dnode4 -s start -sql create dnode $hostname2 -#sql create dnode $hostname3 -sql create dnode $hostname4 -sleep 2000 - -$totalTableNum = 10 -$sleepTimer = 3000 - -$db = db -print create database $db replica 2 -sql create database $db replica 2 -sql use $db - -# create table , insert data -$stb = stb -sql create table $stb (ts timestamp, c1 int) tags(t1 int) -$rowNum = 500 -$tblNum = $totalTableNum -$totalRows = 0 -$tsStart = 1420041600000 -$tsEnd = 0 - -$i = 0 -while $i < $tblNum - $tb = tb . $i - sql create table $tb using $stb tags( $i ) - - $x = 0 - while $x < $rowNum - $ts = $tsStart + $x - sql insert into $tb values ( $ts + 0a , $x ) ( $ts + 1a , $x ) ( $ts + 2a , $x ) ( $ts + 3a , $x ) ( $ts + 4a , $x ) ( $ts + 5a , $x ) ( $ts + 6a , $x ) ( $ts + 7a , $x ) ( $ts + 8a , $x ) ( $ts + 9a , $x ) ( $ts + 10a , $x ) ( $ts + 11a , $x ) ( $ts + 12a , $x ) ( $ts + 13a , $x ) ( $ts + 14a , $x ) ( $ts + 15a , $x ) ( $ts + 16a , $x ) ( $ts + 17a , $x ) ( $ts + 18a , $x ) ( $ts + 19a , $x ) ( $ts + 20a , $x ) ( $ts + 21a , $x ) ( $ts + 22a , $x ) ( $ts + 23a , $x ) ( $ts + 24a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 35a , $x ) ( $ts + 36a , $x ) ( $ts + 37a , $x ) ( $ts + 38a , $x ) ( $ts + 39a , $x ) ( $ts + 40a , $x ) ( $ts + 41a , $x ) ( $ts + 42a , $x ) ( $ts + 43a , $x ) ( $ts + 44a , $x ) ( $ts + 45a , $x ) ( $ts + 46a , $x ) ( $ts + 47a , $x ) ( $ts + 48a , $x ) ( $ts + 49a , $x ) ( $ts + 50a , $x ) ( $ts + 51a , $x ) ( $ts + 52a , $x ) ( $ts + 53a , $x ) ( $ts + 54a , $x ) ( $ts + 55a , $x ) ( $ts + 56a , $x ) ( $ts + 57a , $x ) ( $ts + 58a , $x ) ( $ts + 59a , $x ) - $x = $x + 60 - endw - $totalRows = $totalRows + $x - print info: inserted $x rows into $tb and totalRows: $totalRows - $i = $i + 1 -endw -$tsEnd = $tsStart + $totalRows / $tblNum - -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - -print ============== step3: stop dnode4 -system sh/exec.sh -n dnode4 -s stop -x SIGINT -sleep $sleepTimer -$cnt = 0 -wait_dnode4_offline_0: -$cnt = $cnt + 1 -if $cnt == 20 then - return -1 -endi -sql select * from information_schema.ins_dnodes -if $rows != 4 then - sleep 2000 - goto wait_dnode4_offline_0 -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 -#$dnode1Status = $data4_1 -$dnode2Status = $data4_2 -#$dnode3Status = $data4_3 -$dnode4Status = $data4_3 -#$dnode5Status = $data4_5 - -if $dnode4Status != offline then - sleep 2000 - goto wait_dnode4_offline_0 -endi - -$cnt = 0 -wait_dnode4_vgroup_offline: -$cnt = $cnt + 1 -if $cnt == 20 then - return -1 -endi -sql show vgroups -if $rows != 1 then - sleep 2000 - goto wait_dnode4_vgroup_offline -endi -print show vgroups: -print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 $data5_1 $data6_1 $data7_1 $data8_1 $data9_1 -print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 $data5_2 $data6_2 $data7_2 $data8_2 $data9_2 -print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3 $data5_3 $data6_3 $data7_3 $data8_3 $data9_3 -$dnode4Vtatus = $data5_2 -$dnode3Vtatus = $data7_2 - -if $dnode4Vtatus != offline then - sleep 2000 - goto wait_dnode4_vgroup_offline -endi -if $dnode3Vtatus != master then - sleep 2000 - goto wait_dnode4_vgroup_offline -endi - -print ============== step4: insert more data rows -$tsStart = $tsEnd + 1000 -$i = 0 -while $i < $tblNum - $tb = tb . $i - - $x = 0 - while $x < $rowNum - $ts = $tsStart + $x - sql insert into $tb values ( $ts + 0a , $x ) ( $ts + 1a , $x ) ( $ts + 2a , $x ) ( $ts + 3a , $x ) ( $ts + 4a , $x ) ( $ts + 5a , $x ) ( $ts + 6a , $x ) ( $ts + 7a , $x ) ( $ts + 8a , $x ) ( $ts + 9a , $x ) ( $ts + 10a , $x ) ( $ts + 11a , $x ) ( $ts + 12a , $x ) ( $ts + 13a , $x ) ( $ts + 14a , $x ) ( $ts + 15a , $x ) ( $ts + 16a , $x ) ( $ts + 17a , $x ) ( $ts + 18a , $x ) ( $ts + 19a , $x ) ( $ts + 20a , $x ) ( $ts + 21a , $x ) ( $ts + 22a , $x ) ( $ts + 23a , $x ) ( $ts + 24a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 35a , $x ) ( $ts + 36a , $x ) ( $ts + 37a , $x ) ( $ts + 38a , $x ) ( $ts + 39a , $x ) ( $ts + 40a , $x ) ( $ts + 41a , $x ) ( $ts + 42a , $x ) ( $ts + 43a , $x ) ( $ts + 44a , $x ) ( $ts + 45a , $x ) ( $ts + 46a , $x ) ( $ts + 47a , $x ) ( $ts + 48a , $x ) ( $ts + 49a , $x ) ( $ts + 50a , $x ) ( $ts + 51a , $x ) ( $ts + 52a , $x ) ( $ts + 53a , $x ) ( $ts + 54a , $x ) ( $ts + 55a , $x ) ( $ts + 56a , $x ) ( $ts + 57a , $x ) ( $ts + 58a , $x ) ( $ts + 59a , $x ) - $x = $x + 60 - endw - $totalRows = $totalRows + $x - print info: inserted $x rows into $tb and totalRows: $totalRows - $i = $i + 1 -endw - -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - -print ============== step5: restart dnode4, while alter table and insert data in other thead when dnode4 is syncing -system sh/exec.sh -n dnode4 -s start -run_back unique/arbitrator/sync_replica_alterTable_background_drop.sim - -print ============== step6: check result -#in background.sim, drop one column and add one new column, then insert 36 rows -$totalRows = $totalRows + 36 - -$cnt = 0 -wait_table_altered: -$cnt = $cnt + 1 -if $cnt == 20 then - return -1 -endi -sql select count(*) from $stb -if $data00 != $totalRows then - print data00: $data00 - sleep 2000 - goto wait_table_altered -endi - - - - diff --git a/tests/script/tsim/backup/arbitrator/sync_replica2_dropDb.sim b/tests/script/tsim/backup/arbitrator/sync_replica2_dropDb.sim deleted file mode 100644 index 808bc1109e..0000000000 --- a/tests/script/tsim/backup/arbitrator/sync_replica2_dropDb.sim +++ /dev/null @@ -1,200 +0,0 @@ -system sh/stop_dnodes.sh -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -system sh/deploy.sh -n dnode3 -i 3 -system sh/deploy.sh -n dnode4 -i 4 - -system sh/cfg.sh -n dnode1 -c 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 dnode1 -c walLevel -v 2 -system sh/cfg.sh -n dnode2 -c walLevel -v 2 -system sh/cfg.sh -n dnode3 -c walLevel -v 2 -system sh/cfg.sh -n dnode4 -c walLevel -v 2 - -system sh/cfg.sh -n dnode1 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode2 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode3 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode4 -c balanceInterval -v 10 - -system sh/cfg.sh -n dnode1 -c role -v 1 -system sh/cfg.sh -n dnode2 -c role -v 2 -system sh/cfg.sh -n dnode3 -c role -v 2 -system sh/cfg.sh -n dnode4 -c role -v 2 - -$totalTableNum = 10 -system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v $totalTableNum -system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v $totalTableNum -system sh/cfg.sh -n dnode3 -c maxtablesPerVnode -v $totalTableNum -system sh/cfg.sh -n dnode4 -c maxtablesPerVnode -v $totalTableNum - -system sh/cfg.sh -n dnode1 -c maxVgroupsPerDb -v 1 -system sh/cfg.sh -n dnode2 -c maxVgroupsPerDb -v 1 -system sh/cfg.sh -n dnode3 -c maxVgroupsPerDb -v 1 -system sh/cfg.sh -n dnode4 -c maxVgroupsPerDb -v 1 - -system sh/cfg.sh -n dnode1 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode2 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode3 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode4 -c arbitrator -v $arbitrator - -print ============== step0: start tarbitrator -system sh/exec_tarbitrator.sh -s start - -print ============== step1: start dnode1, only deploy mnode -system sh/exec.sh -n dnode1 -s start -sleep 2000 -sql connect - -print ============== step2: start dnode2/dnode3/dnode4 and add into cluster , then create database with replica 2, and create table, insert data -system sh/exec.sh -n dnode2 -s start -#system sh/exec.sh -n dnode3 -s start -system sh/exec.sh -n dnode4 -s start -sql create dnode $hostname2 -#sql create dnode $hostname3 -sql create dnode $hostname4 -sleep 2000 - -$totalTableNum = 10 -$sleepTimer = 3000 - -$db = db -print create database $db replica 2 -sql create database $db replica 2 -sql use $db - -# create table , insert data -$stb = stb -sql create table $stb (ts timestamp, c1 int) tags(t1 int) -$rowNum = 500 -$tblNum = $totalTableNum -$totalRows = 0 -$tsStart = 1420041600000 -$tsEnd = 0 - -$i = 0 -while $i < $tblNum - $tb = tb . $i - sql create table $tb using $stb tags( $i ) - - $x = 0 - while $x < $rowNum - $ts = $tsStart + $x - sql insert into $tb values ( $ts + 0a , $x ) ( $ts + 1a , $x ) ( $ts + 2a , $x ) ( $ts + 3a , $x ) ( $ts + 4a , $x ) ( $ts + 5a , $x ) ( $ts + 6a , $x ) ( $ts + 7a , $x ) ( $ts + 8a , $x ) ( $ts + 9a , $x ) ( $ts + 10a , $x ) ( $ts + 11a , $x ) ( $ts + 12a , $x ) ( $ts + 13a , $x ) ( $ts + 14a , $x ) ( $ts + 15a , $x ) ( $ts + 16a , $x ) ( $ts + 17a , $x ) ( $ts + 18a , $x ) ( $ts + 19a , $x ) ( $ts + 20a , $x ) ( $ts + 21a , $x ) ( $ts + 22a , $x ) ( $ts + 23a , $x ) ( $ts + 24a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 35a , $x ) ( $ts + 36a , $x ) ( $ts + 37a , $x ) ( $ts + 38a , $x ) ( $ts + 39a , $x ) ( $ts + 40a , $x ) ( $ts + 41a , $x ) ( $ts + 42a , $x ) ( $ts + 43a , $x ) ( $ts + 44a , $x ) ( $ts + 45a , $x ) ( $ts + 46a , $x ) ( $ts + 47a , $x ) ( $ts + 48a , $x ) ( $ts + 49a , $x ) ( $ts + 50a , $x ) ( $ts + 51a , $x ) ( $ts + 52a , $x ) ( $ts + 53a , $x ) ( $ts + 54a , $x ) ( $ts + 55a , $x ) ( $ts + 56a , $x ) ( $ts + 57a , $x ) ( $ts + 58a , $x ) ( $ts + 59a , $x ) - $x = $x + 60 - endw - $totalRows = $totalRows + $x - print info: inserted $x rows into $tb and totalRows: $totalRows - $i = $i + 1 -endw -$tsEnd = $tsStart + $totalRows / $tblNum - -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - -print ============== step3: stop dnode4 -system sh/exec.sh -n dnode4 -s stop -x SIGINT -sleep $sleepTimer -$cnt = 0 -wait_dnode4_offline_0: -$cnt = $cnt + 1 -if $cnt == 10 then - return -1 -endi -sql select * from information_schema.ins_dnodes -if $rows != 4 then - sleep 2000 - goto wait_dnode4_offline_0 -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 -#$dnode1Status = $data4_1 -$dnode2Status = $data4_2 -#$dnode3Status = $data4_3 -$dnode4Status = $data4_3 -#$dnode5Status = $data4_5 - -if $dnode4Status != offline then - sleep 2000 - goto wait_dnode4_offline_0 -endi - -$cnt = 0 -wait_dnode4_vgroup_offline: -$cnt = $cnt + 1 -if $cnt == 10 then - return -1 -endi -sql show vgroups -if $rows != 1 then - sleep 2000 - goto wait_dnode4_vgroup_offline -endi -print show vgroups: -print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 $data5_1 $data6_1 $data7_1 $data8_1 $data9_1 -print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 $data5_2 $data6_2 $data7_2 $data8_2 $data9_2 -print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3 $data5_3 $data6_3 $data7_3 $data8_3 $data9_3 -$dnode4Vtatus = $data5_2 -$dnode3Vtatus = $data7_2 - -if $dnode4Vtatus != offline then - sleep 2000 - goto wait_dnode4_vgroup_offline -endi -if $dnode3Vtatus != master then - sleep 2000 - goto wait_dnode4_vgroup_offline -endi - -print ============== step4: insert more data rows -$tsStart = $tsEnd + 1000 -$i = 0 -while $i < $tblNum - $tb = tb . $i - - $x = 0 - while $x < $rowNum - $ts = $tsStart + $x - sql insert into $tb values ( $ts + 0a , $x ) ( $ts + 1a , $x ) ( $ts + 2a , $x ) ( $ts + 3a , $x ) ( $ts + 4a , $x ) ( $ts + 5a , $x ) ( $ts + 6a , $x ) ( $ts + 7a , $x ) ( $ts + 8a , $x ) ( $ts + 9a , $x ) ( $ts + 10a , $x ) ( $ts + 11a , $x ) ( $ts + 12a , $x ) ( $ts + 13a , $x ) ( $ts + 14a , $x ) ( $ts + 15a , $x ) ( $ts + 16a , $x ) ( $ts + 17a , $x ) ( $ts + 18a , $x ) ( $ts + 19a , $x ) ( $ts + 20a , $x ) ( $ts + 21a , $x ) ( $ts + 22a , $x ) ( $ts + 23a , $x ) ( $ts + 24a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 35a , $x ) ( $ts + 36a , $x ) ( $ts + 37a , $x ) ( $ts + 38a , $x ) ( $ts + 39a , $x ) ( $ts + 40a , $x ) ( $ts + 41a , $x ) ( $ts + 42a , $x ) ( $ts + 43a , $x ) ( $ts + 44a , $x ) ( $ts + 45a , $x ) ( $ts + 46a , $x ) ( $ts + 47a , $x ) ( $ts + 48a , $x ) ( $ts + 49a , $x ) ( $ts + 50a , $x ) ( $ts + 51a , $x ) ( $ts + 52a , $x ) ( $ts + 53a , $x ) ( $ts + 54a , $x ) ( $ts + 55a , $x ) ( $ts + 56a , $x ) ( $ts + 57a , $x ) ( $ts + 58a , $x ) ( $ts + 59a , $x ) - $x = $x + 60 - endw - $totalRows = $totalRows + $x - print info: inserted $x rows into $tb and totalRows: $totalRows - $i = $i + 1 -endw - -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - -print ============== step5: restart dnode4, while drop database in other thead when dnode4 is syncing -system sh/exec.sh -n dnode4 -s start -run_back unique/arbitrator/sync_replica_dropDb_background.sim - -print ============== step6: check result -$cnt = 0 -wait_database_dropped: -$cnt = $cnt + 1 -if $cnt == 20 then - return -1 -endi -sql select * from information_schema.ins_databases -if $rows != 0 then - sleep 2000 - goto wait_database_dropped -endi - - - - diff --git a/tests/script/tsim/backup/arbitrator/sync_replica2_dropTable.sim b/tests/script/tsim/backup/arbitrator/sync_replica2_dropTable.sim deleted file mode 100644 index 710c72fbd3..0000000000 --- a/tests/script/tsim/backup/arbitrator/sync_replica2_dropTable.sim +++ /dev/null @@ -1,210 +0,0 @@ -system sh/stop_dnodes.sh -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -system sh/deploy.sh -n dnode3 -i 3 -system sh/deploy.sh -n dnode4 -i 4 - -system sh/cfg.sh -n dnode1 -c 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 dnode1 -c walLevel -v 2 -system sh/cfg.sh -n dnode2 -c walLevel -v 2 -system sh/cfg.sh -n dnode3 -c walLevel -v 2 -system sh/cfg.sh -n dnode4 -c walLevel -v 2 - -system sh/cfg.sh -n dnode1 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode2 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode3 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode4 -c balanceInterval -v 10 - -system sh/cfg.sh -n dnode1 -c role -v 1 -system sh/cfg.sh -n dnode2 -c role -v 2 -system sh/cfg.sh -n dnode3 -c role -v 2 -system sh/cfg.sh -n dnode4 -c role -v 2 - -$totalTableNum = 10 -system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v $totalTableNum -system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v $totalTableNum -system sh/cfg.sh -n dnode3 -c maxtablesPerVnode -v $totalTableNum -system sh/cfg.sh -n dnode4 -c maxtablesPerVnode -v $totalTableNum - -system sh/cfg.sh -n dnode1 -c maxVgroupsPerDb -v 1 -system sh/cfg.sh -n dnode2 -c maxVgroupsPerDb -v 1 -system sh/cfg.sh -n dnode3 -c maxVgroupsPerDb -v 1 -system sh/cfg.sh -n dnode4 -c maxVgroupsPerDb -v 1 - -system sh/cfg.sh -n dnode1 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode2 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode3 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode4 -c arbitrator -v $arbitrator - -print ============== step0: start tarbitrator -system sh/exec_tarbitrator.sh -s start - -print ============== step1: start dnode1, only deploy mnode -system sh/exec.sh -n dnode1 -s start -sleep 2000 -sql connect - -print ============== step2: start dnode2/dnode3/dnode4 and add into cluster , then create database with replica 2, and create table, insert data -system sh/exec.sh -n dnode2 -s start -#system sh/exec.sh -n dnode3 -s start -system sh/exec.sh -n dnode4 -s start -sql create dnode $hostname2 -#sql create dnode $hostname3 -sql create dnode $hostname4 -sleep 2000 - -$totalTableNum = 10 -$sleepTimer = 3000 - -$db = db -print create database $db replica 2 -sql create database $db replica 2 -sql use $db - -# create table , insert data -$stb = stb -sql create table $stb (ts timestamp, c1 int) tags(t1 int) -$rowNum = 500 -$tblNum = $totalTableNum -$totalRows = 0 -$tsStart = 1420041600000 -$tsEnd = 0 - -$i = 0 -while $i < $tblNum - $tb = tb . $i - sql create table $tb using $stb tags( $i ) - - $x = 0 - while $x < $rowNum - $ts = $tsStart + $x - sql insert into $tb values ( $ts + 0a , $x ) ( $ts + 1a , $x ) ( $ts + 2a , $x ) ( $ts + 3a , $x ) ( $ts + 4a , $x ) ( $ts + 5a , $x ) ( $ts + 6a , $x ) ( $ts + 7a , $x ) ( $ts + 8a , $x ) ( $ts + 9a , $x ) ( $ts + 10a , $x ) ( $ts + 11a , $x ) ( $ts + 12a , $x ) ( $ts + 13a , $x ) ( $ts + 14a , $x ) ( $ts + 15a , $x ) ( $ts + 16a , $x ) ( $ts + 17a , $x ) ( $ts + 18a , $x ) ( $ts + 19a , $x ) ( $ts + 20a , $x ) ( $ts + 21a , $x ) ( $ts + 22a , $x ) ( $ts + 23a , $x ) ( $ts + 24a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 35a , $x ) ( $ts + 36a , $x ) ( $ts + 37a , $x ) ( $ts + 38a , $x ) ( $ts + 39a , $x ) ( $ts + 40a , $x ) ( $ts + 41a , $x ) ( $ts + 42a , $x ) ( $ts + 43a , $x ) ( $ts + 44a , $x ) ( $ts + 45a , $x ) ( $ts + 46a , $x ) ( $ts + 47a , $x ) ( $ts + 48a , $x ) ( $ts + 49a , $x ) ( $ts + 50a , $x ) ( $ts + 51a , $x ) ( $ts + 52a , $x ) ( $ts + 53a , $x ) ( $ts + 54a , $x ) ( $ts + 55a , $x ) ( $ts + 56a , $x ) ( $ts + 57a , $x ) ( $ts + 58a , $x ) ( $ts + 59a , $x ) - $x = $x + 60 - endw - $totalRows = $totalRows + $x - print info: inserted $x rows into $tb and totalRows: $totalRows - $i = $i + 1 -endw -$tsEnd = $tsStart + $totalRows / $tblNum - -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - -print ============== step3: stop dnode4 -system sh/exec.sh -n dnode4 -s stop -x SIGINT -sleep $sleepTimer -$cnt = 0 -wait_dnode4_offline_0: -$cnt = $cnt + 1 -if $cnt == 10 then - return -1 -endi -sql select * from information_schema.ins_dnodes -if $rows != 4 then - sleep 2000 - goto wait_dnode4_offline_0 -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 -#$dnode1Status = $data4_1 -$dnode2Status = $data4_2 -$dnode4Status = $data4_3 -#$dnode4Status = $data4_4 -#$dnode5Status = $data4_5 - -if $dnode4Status != offline then - sleep 2000 - goto wait_dnode4_offline_0 -endi - -$cnt = 0 -wait_dnode4_vgroup_offline: -$cnt = $cnt + 1 -if $cnt == 10 then - return -1 -endi -sql show vgroups -if $rows != 1 then - sleep 2000 - goto wait_dnode4_vgroup_offline -endi -print show vgroups: -print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 $data5_1 $data6_1 $data7_1 $data8_1 $data9_1 -print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 $data5_2 $data6_2 $data7_2 $data8_2 $data9_2 -print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3 $data5_3 $data6_3 $data7_3 $data8_3 $data9_3 -$dnode4Vtatus = $data5_2 -$dnode3Vtatus = $data7_2 - -if $dnode4Vtatus != offline then - sleep 2000 - goto wait_dnode4_vgroup_offline -endi -if $dnode3Vtatus != master then - sleep 2000 - goto wait_dnode4_vgroup_offline -endi - -print ============== step4: insert more data rows -$tsStart = $tsEnd + 1000 -$i = 0 -while $i < $tblNum - $tb = tb . $i - - $x = 0 - while $x < $rowNum - $ts = $tsStart + $x - sql insert into $tb values ( $ts + 0a , $x ) ( $ts + 1a , $x ) ( $ts + 2a , $x ) ( $ts + 3a , $x ) ( $ts + 4a , $x ) ( $ts + 5a , $x ) ( $ts + 6a , $x ) ( $ts + 7a , $x ) ( $ts + 8a , $x ) ( $ts + 9a , $x ) ( $ts + 10a , $x ) ( $ts + 11a , $x ) ( $ts + 12a , $x ) ( $ts + 13a , $x ) ( $ts + 14a , $x ) ( $ts + 15a , $x ) ( $ts + 16a , $x ) ( $ts + 17a , $x ) ( $ts + 18a , $x ) ( $ts + 19a , $x ) ( $ts + 20a , $x ) ( $ts + 21a , $x ) ( $ts + 22a , $x ) ( $ts + 23a , $x ) ( $ts + 24a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 35a , $x ) ( $ts + 36a , $x ) ( $ts + 37a , $x ) ( $ts + 38a , $x ) ( $ts + 39a , $x ) ( $ts + 40a , $x ) ( $ts + 41a , $x ) ( $ts + 42a , $x ) ( $ts + 43a , $x ) ( $ts + 44a , $x ) ( $ts + 45a , $x ) ( $ts + 46a , $x ) ( $ts + 47a , $x ) ( $ts + 48a , $x ) ( $ts + 49a , $x ) ( $ts + 50a , $x ) ( $ts + 51a , $x ) ( $ts + 52a , $x ) ( $ts + 53a , $x ) ( $ts + 54a , $x ) ( $ts + 55a , $x ) ( $ts + 56a , $x ) ( $ts + 57a , $x ) ( $ts + 58a , $x ) ( $ts + 59a , $x ) - $x = $x + 60 - endw - $totalRows = $totalRows + $x - print info: inserted $x rows into $tb and totalRows: $totalRows - $i = $i + 1 -endw - -sql select count(*) from $stb -print data00:$data00 totalRows:$totalRows -if $data00 != $totalRows then - return -1 -endi - -print ============== step5: restart dnode4, while drop some tables in other thread when dnode4 is syncing -system sh/exec.sh -n dnode4 -s start -run_back unique/arbitrator/sync_replica_dropTable_background.sim - -print ============== step6: check result -#in background.sim, drop 5 tables -$totalRows = $totalRows - 5400 - -$cnt = 0 -wait_table_dropped: -$cnt = $cnt + 1 -if $cnt == 20 then - return -1 -endi -sql select count(*) from $stb -if $data00 != $totalRows then - print data00:$data00 totalRows:$totalRows - sleep 2000 - goto wait_table_dropped -endi - -$tblNum = $tblNum - 5 -sql select count(tbname) from $stb -if $data00 != $tblNum then - print data00: $data00 tblNum: $tblNum - sleep 2000 - goto wait_table_dropped -endi - - diff --git a/tests/script/tsim/backup/arbitrator/sync_replica3_alterTable_add.sim b/tests/script/tsim/backup/arbitrator/sync_replica3_alterTable_add.sim deleted file mode 100644 index 024d38da06..0000000000 --- a/tests/script/tsim/backup/arbitrator/sync_replica3_alterTable_add.sim +++ /dev/null @@ -1,198 +0,0 @@ -system sh/stop_dnodes.sh -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -system sh/deploy.sh -n dnode3 -i 3 -system sh/deploy.sh -n dnode4 -i 4 - -system sh/cfg.sh -n dnode1 -c 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 dnode1 -c walLevel -v 2 -system sh/cfg.sh -n dnode2 -c walLevel -v 2 -system sh/cfg.sh -n dnode3 -c walLevel -v 2 -system sh/cfg.sh -n dnode4 -c walLevel -v 2 - -system sh/cfg.sh -n dnode1 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode2 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode3 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode4 -c balanceInterval -v 10 - -system sh/cfg.sh -n dnode1 -c role -v 1 -system sh/cfg.sh -n dnode2 -c role -v 2 -system sh/cfg.sh -n dnode3 -c role -v 2 -system sh/cfg.sh -n dnode4 -c role -v 2 - -$totalTableNum = 10 -system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v $totalTableNum -system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v $totalTableNum -system sh/cfg.sh -n dnode3 -c maxtablesPerVnode -v $totalTableNum -system sh/cfg.sh -n dnode4 -c maxtablesPerVnode -v $totalTableNum - -system sh/cfg.sh -n dnode1 -c maxVgroupsPerDb -v 1 -system sh/cfg.sh -n dnode2 -c maxVgroupsPerDb -v 1 -system sh/cfg.sh -n dnode3 -c maxVgroupsPerDb -v 1 -system sh/cfg.sh -n dnode4 -c maxVgroupsPerDb -v 1 - -system sh/cfg.sh -n dnode1 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode2 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode3 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode4 -c arbitrator -v $arbitrator - -print ============== step0: start tarbitrator -system sh/exec_tarbitrator.sh -s start - -print ============== step1: start dnode1, only deploy mnode -system sh/exec.sh -n dnode1 -s start -sleep 2000 -sql connect - -print ============== step2: start dnode2/dnode3/dnode4 and add into cluster , then create database with replica 3, and create table, insert data -system sh/exec.sh -n dnode2 -s start -system sh/exec.sh -n dnode3 -s start -system sh/exec.sh -n dnode4 -s start -sql create dnode $hostname2 -sql create dnode $hostname3 -sql create dnode $hostname4 -sleep 2000 - -$totalTableNum = 10 -$sleepTimer = 3000 - -$db = db -print create database $db replica 3 -sql create database $db replica 3 -sql use $db - -# create table , insert data -$stb = stb -sql create table $stb (ts timestamp, c1 int) tags(t1 int) -$rowNum = 500 -$tblNum = $totalTableNum -$totalRows = 0 -$tsStart = 1420041600000 -$tsEnd = 0 - -$i = 0 -while $i < $tblNum - $tb = tb . $i - sql create table $tb using $stb tags( $i ) - - $x = 0 - while $x < $rowNum - $ts = $tsStart + $x - sql insert into $tb values ( $ts + 0a , $x ) ( $ts + 1a , $x ) ( $ts + 2a , $x ) ( $ts + 3a , $x ) ( $ts + 4a , $x ) ( $ts + 5a , $x ) ( $ts + 6a , $x ) ( $ts + 7a , $x ) ( $ts + 8a , $x ) ( $ts + 9a , $x ) ( $ts + 10a , $x ) ( $ts + 11a , $x ) ( $ts + 12a , $x ) ( $ts + 13a , $x ) ( $ts + 14a , $x ) ( $ts + 15a , $x ) ( $ts + 16a , $x ) ( $ts + 17a , $x ) ( $ts + 18a , $x ) ( $ts + 19a , $x ) ( $ts + 20a , $x ) ( $ts + 21a , $x ) ( $ts + 22a , $x ) ( $ts + 23a , $x ) ( $ts + 24a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 35a , $x ) ( $ts + 36a , $x ) ( $ts + 37a , $x ) ( $ts + 38a , $x ) ( $ts + 39a , $x ) ( $ts + 40a , $x ) ( $ts + 41a , $x ) ( $ts + 42a , $x ) ( $ts + 43a , $x ) ( $ts + 44a , $x ) ( $ts + 45a , $x ) ( $ts + 46a , $x ) ( $ts + 47a , $x ) ( $ts + 48a , $x ) ( $ts + 49a , $x ) ( $ts + 50a , $x ) ( $ts + 51a , $x ) ( $ts + 52a , $x ) ( $ts + 53a , $x ) ( $ts + 54a , $x ) ( $ts + 55a , $x ) ( $ts + 56a , $x ) ( $ts + 57a , $x ) ( $ts + 58a , $x ) ( $ts + 59a , $x ) - $x = $x + 60 - endw - $totalRows = $totalRows + $x - print info: inserted $x rows into $tb and totalRows: $totalRows - $i = $i + 1 -endw -$tsEnd = $tsStart + $totalRows / $tblNum - -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - -print ============== step3: stop dnode4 -system sh/exec.sh -n dnode4 -s stop -x SIGINT -sleep $sleepTimer -$cnt = 0 -wait_dnode4_offline_0: -$cnt = $cnt + 1 -if $cnt == 10 then - return -1 -endi -sql select * from information_schema.ins_dnodes -if $rows != 5 then - sleep 2000 - goto wait_dnode4_offline_0 -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 -#$dnode1Status = $data4_1 -$dnode2Status = $data4_2 -$dnode3Status = $data4_3 -$dnode4Status = $data4_4 -#$dnode5Status = $data4_5 - -if $dnode4Status != offline then - sleep 2000 - goto wait_dnode4_offline_0 -endi - -$cnt = 0 -wait_dnode4_vgroup_offline: -$cnt = $cnt + 1 -if $cnt == 10 then - return -1 -endi -sql show vgroups -if $rows != 1 then - sleep 2000 - goto wait_dnode4_vgroup_offline -endi -print show vgroups: -print $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 -$dnode4Vtatus = $data05 -$dnode3Vtatus = $data07 - -if $dnode4Vtatus != offline then - sleep 2000 - goto wait_dnode4_vgroup_offline -endi -if $dnode3Vtatus != master then - sleep 2000 - goto wait_dnode4_vgroup_offline -endi - -print ============== step4: insert more data rows -$tsStart = $tsEnd + 1000 -$i = 0 -while $i < $tblNum - $tb = tb . $i - - $x = 0 - while $x < $rowNum - $ts = $tsStart + $x - sql insert into $tb values ( $ts + 0a , $x ) ( $ts + 1a , $x ) ( $ts + 2a , $x ) ( $ts + 3a , $x ) ( $ts + 4a , $x ) ( $ts + 5a , $x ) ( $ts + 6a , $x ) ( $ts + 7a , $x ) ( $ts + 8a , $x ) ( $ts + 9a , $x ) ( $ts + 10a , $x ) ( $ts + 11a , $x ) ( $ts + 12a , $x ) ( $ts + 13a , $x ) ( $ts + 14a , $x ) ( $ts + 15a , $x ) ( $ts + 16a , $x ) ( $ts + 17a , $x ) ( $ts + 18a , $x ) ( $ts + 19a , $x ) ( $ts + 20a , $x ) ( $ts + 21a , $x ) ( $ts + 22a , $x ) ( $ts + 23a , $x ) ( $ts + 24a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 35a , $x ) ( $ts + 36a , $x ) ( $ts + 37a , $x ) ( $ts + 38a , $x ) ( $ts + 39a , $x ) ( $ts + 40a , $x ) ( $ts + 41a , $x ) ( $ts + 42a , $x ) ( $ts + 43a , $x ) ( $ts + 44a , $x ) ( $ts + 45a , $x ) ( $ts + 46a , $x ) ( $ts + 47a , $x ) ( $ts + 48a , $x ) ( $ts + 49a , $x ) ( $ts + 50a , $x ) ( $ts + 51a , $x ) ( $ts + 52a , $x ) ( $ts + 53a , $x ) ( $ts + 54a , $x ) ( $ts + 55a , $x ) ( $ts + 56a , $x ) ( $ts + 57a , $x ) ( $ts + 58a , $x ) ( $ts + 59a , $x ) - $x = $x + 60 - endw - $totalRows = $totalRows + $x - print info: inserted $x rows into $tb and totalRows: $totalRows - $i = $i + 1 -endw - -sql select count(*) from $stb -print data00:$data00 totalRows:$totalRows -if $data00 != $totalRows then - return -1 -endi - -print ============== step5: restart dnode4, while alter table and insert data in other thead when dnode4 is syncing -system sh/exec.sh -n dnode4 -s start -run_back unique/arbitrator/sync_replica_alterTable_background_add.sim - -print ============== step6: check result -#in background.sim, add one column and insert 36 rows -$totalRows = $totalRows + 36 - -$cnt = 0 -wait_table_altered: -$cnt = $cnt + 1 -if $cnt == 20 then - return -1 -endi -sql select count(*) from $stb -if $data00 != $totalRows then - print data00:$data00 totalRows:$totalRows - sleep 2000 - goto wait_table_altered -endi diff --git a/tests/script/tsim/backup/arbitrator/sync_replica3_alterTable_drop.sim b/tests/script/tsim/backup/arbitrator/sync_replica3_alterTable_drop.sim deleted file mode 100644 index 5dd716ce97..0000000000 --- a/tests/script/tsim/backup/arbitrator/sync_replica3_alterTable_drop.sim +++ /dev/null @@ -1,204 +0,0 @@ -system sh/stop_dnodes.sh -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -system sh/deploy.sh -n dnode3 -i 3 -system sh/deploy.sh -n dnode4 -i 4 - -system sh/cfg.sh -n dnode1 -c 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 dnode1 -c walLevel -v 2 -system sh/cfg.sh -n dnode2 -c walLevel -v 2 -system sh/cfg.sh -n dnode3 -c walLevel -v 2 -system sh/cfg.sh -n dnode4 -c walLevel -v 2 - -system sh/cfg.sh -n dnode1 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode2 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode3 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode4 -c balanceInterval -v 10 - -system sh/cfg.sh -n dnode1 -c role -v 1 -system sh/cfg.sh -n dnode2 -c role -v 2 -system sh/cfg.sh -n dnode3 -c role -v 2 -system sh/cfg.sh -n dnode4 -c role -v 2 - -$totalTableNum = 10 -system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v $totalTableNum -system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v $totalTableNum -system sh/cfg.sh -n dnode3 -c maxtablesPerVnode -v $totalTableNum -system sh/cfg.sh -n dnode4 -c maxtablesPerVnode -v $totalTableNum - -system sh/cfg.sh -n dnode1 -c maxVgroupsPerDb -v 1 -system sh/cfg.sh -n dnode2 -c maxVgroupsPerDb -v 1 -system sh/cfg.sh -n dnode3 -c maxVgroupsPerDb -v 1 -system sh/cfg.sh -n dnode4 -c maxVgroupsPerDb -v 1 - -system sh/cfg.sh -n dnode1 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode2 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode3 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode4 -c arbitrator -v $arbitrator - -print ============== step0: start tarbitrator -system sh/exec_tarbitrator.sh -s start - -print ============== step1: start dnode1, only deploy mnode -system sh/exec.sh -n dnode1 -s start -sleep 2000 -sql connect - -print ============== step2: start dnode2/dnode3/dnode4 and add into cluster , then create database with replica 3, and create table, insert data -system sh/exec.sh -n dnode2 -s start -system sh/exec.sh -n dnode3 -s start -system sh/exec.sh -n dnode4 -s start -sql create dnode $hostname2 -sql create dnode $hostname3 -sql create dnode $hostname4 -sleep 2000 - -$totalTableNum = 10 -$sleepTimer = 3000 - -$db = db -print create database $db replica 3 -sql create database $db replica 3 -sql use $db - -# create table , insert data -$stb = stb -sql create table $stb (ts timestamp, c1 int) tags(t1 int) -$rowNum = 500 -$tblNum = $totalTableNum -$totalRows = 0 -$tsStart = 1420041600000 -$tsEnd = 0 - -$i = 0 -while $i < $tblNum - $tb = tb . $i - sql create table $tb using $stb tags( $i ) - - $x = 0 - while $x < $rowNum - $ts = $tsStart + $x - sql insert into $tb values ( $ts + 0a , $x ) ( $ts + 1a , $x ) ( $ts + 2a , $x ) ( $ts + 3a , $x ) ( $ts + 4a , $x ) ( $ts + 5a , $x ) ( $ts + 6a , $x ) ( $ts + 7a , $x ) ( $ts + 8a , $x ) ( $ts + 9a , $x ) ( $ts + 10a , $x ) ( $ts + 11a , $x ) ( $ts + 12a , $x ) ( $ts + 13a , $x ) ( $ts + 14a , $x ) ( $ts + 15a , $x ) ( $ts + 16a , $x ) ( $ts + 17a , $x ) ( $ts + 18a , $x ) ( $ts + 19a , $x ) ( $ts + 20a , $x ) ( $ts + 21a , $x ) ( $ts + 22a , $x ) ( $ts + 23a , $x ) ( $ts + 24a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 35a , $x ) ( $ts + 36a , $x ) ( $ts + 37a , $x ) ( $ts + 38a , $x ) ( $ts + 39a , $x ) ( $ts + 40a , $x ) ( $ts + 41a , $x ) ( $ts + 42a , $x ) ( $ts + 43a , $x ) ( $ts + 44a , $x ) ( $ts + 45a , $x ) ( $ts + 46a , $x ) ( $ts + 47a , $x ) ( $ts + 48a , $x ) ( $ts + 49a , $x ) ( $ts + 50a , $x ) ( $ts + 51a , $x ) ( $ts + 52a , $x ) ( $ts + 53a , $x ) ( $ts + 54a , $x ) ( $ts + 55a , $x ) ( $ts + 56a , $x ) ( $ts + 57a , $x ) ( $ts + 58a , $x ) ( $ts + 59a , $x ) - $x = $x + 60 - endw - $totalRows = $totalRows + $x - print info: inserted $x rows into $tb and totalRows: $totalRows - $i = $i + 1 -endw -$tsEnd = $tsStart + $totalRows / $tblNum - -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - -print ============== step3: stop dnode4 -system sh/exec.sh -n dnode4 -s stop -x SIGINT -sleep $sleepTimer -$cnt = 0 -wait_dnode4_offline_0: -$cnt = $cnt + 1 -if $cnt == 20 then - return -1 -endi -sql select * from information_schema.ins_dnodes -if $rows != 5 then - sleep 2000 - goto wait_dnode4_offline_0 -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 -#$dnode1Status = $data4_1 -$dnode2Status = $data4_2 -$dnode3Status = $data4_3 -$dnode4Status = $data4_4 -#$dnode5Status = $data4_5 - -if $dnode4Status != offline then - sleep 2000 - goto wait_dnode4_offline_0 -endi - -$cnt = 0 -wait_dnode4_vgroup_offline: -$cnt = $cnt + 1 -if $cnt == 20 then - return -1 -endi -sql show vgroups -if $rows != 1 then - sleep 2000 - goto wait_dnode4_vgroup_offline -endi -print show vgroups: -print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 $data5_1 $data6_1 $data7_1 $data8_1 $data9_1 -print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 $data5_2 $data6_2 $data7_2 $data8_2 $data9_2 -print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3 $data5_3 $data6_3 $data7_3 $data8_3 $data9_3 -$dnode4Vtatus = $data5_2 -$dnode3Vtatus = $data7_2 - -if $dnode4Vtatus != offline then - sleep 2000 - goto wait_dnode4_vgroup_offline -endi -if $dnode3Vtatus != master then - sleep 2000 - goto wait_dnode4_vgroup_offline -endi - -print ============== step4: insert more data rows -$tsStart = $tsEnd + 1000 -$i = 0 -while $i < $tblNum - $tb = tb . $i - - $x = 0 - while $x < $rowNum - $ts = $tsStart + $x - sql insert into $tb values ( $ts + 0a , $x ) ( $ts + 1a , $x ) ( $ts + 2a , $x ) ( $ts + 3a , $x ) ( $ts + 4a , $x ) ( $ts + 5a , $x ) ( $ts + 6a , $x ) ( $ts + 7a , $x ) ( $ts + 8a , $x ) ( $ts + 9a , $x ) ( $ts + 10a , $x ) ( $ts + 11a , $x ) ( $ts + 12a , $x ) ( $ts + 13a , $x ) ( $ts + 14a , $x ) ( $ts + 15a , $x ) ( $ts + 16a , $x ) ( $ts + 17a , $x ) ( $ts + 18a , $x ) ( $ts + 19a , $x ) ( $ts + 20a , $x ) ( $ts + 21a , $x ) ( $ts + 22a , $x ) ( $ts + 23a , $x ) ( $ts + 24a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 35a , $x ) ( $ts + 36a , $x ) ( $ts + 37a , $x ) ( $ts + 38a , $x ) ( $ts + 39a , $x ) ( $ts + 40a , $x ) ( $ts + 41a , $x ) ( $ts + 42a , $x ) ( $ts + 43a , $x ) ( $ts + 44a , $x ) ( $ts + 45a , $x ) ( $ts + 46a , $x ) ( $ts + 47a , $x ) ( $ts + 48a , $x ) ( $ts + 49a , $x ) ( $ts + 50a , $x ) ( $ts + 51a , $x ) ( $ts + 52a , $x ) ( $ts + 53a , $x ) ( $ts + 54a , $x ) ( $ts + 55a , $x ) ( $ts + 56a , $x ) ( $ts + 57a , $x ) ( $ts + 58a , $x ) ( $ts + 59a , $x ) - $x = $x + 60 - endw - $totalRows = $totalRows + $x - print info: inserted $x rows into $tb and totalRows: $totalRows - $i = $i + 1 -endw - -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - -print ============== step5: restart dnode4, while alter table and insert data in other thead when dnode4 is syncing -system sh/exec.sh -n dnode4 -s start -run_back unique/arbitrator/sync_replica_alterTable_background_drop.sim - -print ============== step6: check result -#in background.sim, drop one column and add one new column, then insert 36 rows -$totalRows = $totalRows + 36 - -$cnt = 0 -wait_table_altered: -$cnt = $cnt + 1 -if $cnt == 20 then - return -1 -endi -sql select count(*) from $stb -if $data00 != $totalRows then - print data00: $data00 - sleep 2000 - goto wait_table_altered -endi - - - - diff --git a/tests/script/tsim/backup/arbitrator/sync_replica3_createTable.sim b/tests/script/tsim/backup/arbitrator/sync_replica3_createTable.sim deleted file mode 100644 index f085ab4340..0000000000 --- a/tests/script/tsim/backup/arbitrator/sync_replica3_createTable.sim +++ /dev/null @@ -1,212 +0,0 @@ -system sh/stop_dnodes.sh -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -system sh/deploy.sh -n dnode3 -i 3 -system sh/deploy.sh -n dnode4 -i 4 - -system sh/cfg.sh -n dnode1 -c 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 dnode1 -c walLevel -v 2 -system sh/cfg.sh -n dnode2 -c walLevel -v 2 -system sh/cfg.sh -n dnode3 -c walLevel -v 2 -system sh/cfg.sh -n dnode4 -c walLevel -v 2 - -system sh/cfg.sh -n dnode1 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode2 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode3 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode4 -c balanceInterval -v 10 - -system sh/cfg.sh -n dnode1 -c role -v 1 -system sh/cfg.sh -n dnode2 -c role -v 2 -system sh/cfg.sh -n dnode3 -c role -v 2 -system sh/cfg.sh -n dnode4 -c role -v 2 - -$totalTableNum = 10 -system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v $totalTableNum -system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v $totalTableNum -system sh/cfg.sh -n dnode3 -c maxtablesPerVnode -v $totalTableNum -system sh/cfg.sh -n dnode4 -c maxtablesPerVnode -v $totalTableNum - -system sh/cfg.sh -n dnode1 -c maxVgroupsPerDb -v 1 -system sh/cfg.sh -n dnode2 -c maxVgroupsPerDb -v 1 -system sh/cfg.sh -n dnode3 -c maxVgroupsPerDb -v 1 -system sh/cfg.sh -n dnode4 -c maxVgroupsPerDb -v 1 - -system sh/cfg.sh -n dnode1 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode2 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode3 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode4 -c arbitrator -v $arbitrator - -print ============== step0: start tarbitrator -system sh/exec_tarbitrator.sh -s start - -print ============== step1: start dnode1, only deploy mnode -system sh/exec.sh -n dnode1 -s start -sleep 2000 -sql connect - -print ============== step2: start dnode2/dnode3/dnode4 and add into cluster , then create database with replica 3, and create table, insert data -system sh/exec.sh -n dnode2 -s start -system sh/exec.sh -n dnode3 -s start -system sh/exec.sh -n dnode4 -s start -sql create dnode $hostname2 -sql create dnode $hostname3 -sql create dnode $hostname4 -sleep 2000 - -$totalTableNum = 20 -$sleepTimer = 3000 - -$db = db -print create database $db replica 3 -sql create database $db replica 3 -sql use $db - -# create table , insert data -$stb = stb -sql create table $stb (ts timestamp, c1 int) tags(t1 int) -$rowNum = 500 -$tblNum = 10 -$totalRows = 0 -$tsStart = 1420041600000 -$tsEnd = 0 - -$i = 0 -while $i < $tblNum - $tb = tb . $i - sql create table $tb using $stb tags( $i ) - - $x = 0 - while $x < $rowNum - $ts = $tsStart + $x - sql insert into $tb values ( $ts + 0a , $x ) ( $ts + 1a , $x ) ( $ts + 2a , $x ) ( $ts + 3a , $x ) ( $ts + 4a , $x ) ( $ts + 5a , $x ) ( $ts + 6a , $x ) ( $ts + 7a , $x ) ( $ts + 8a , $x ) ( $ts + 9a , $x ) ( $ts + 10a , $x ) ( $ts + 11a , $x ) ( $ts + 12a , $x ) ( $ts + 13a , $x ) ( $ts + 14a , $x ) ( $ts + 15a , $x ) ( $ts + 16a , $x ) ( $ts + 17a , $x ) ( $ts + 18a , $x ) ( $ts + 19a , $x ) ( $ts + 20a , $x ) ( $ts + 21a , $x ) ( $ts + 22a , $x ) ( $ts + 23a , $x ) ( $ts + 24a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 35a , $x ) ( $ts + 36a , $x ) ( $ts + 37a , $x ) ( $ts + 38a , $x ) ( $ts + 39a , $x ) ( $ts + 40a , $x ) ( $ts + 41a , $x ) ( $ts + 42a , $x ) ( $ts + 43a , $x ) ( $ts + 44a , $x ) ( $ts + 45a , $x ) ( $ts + 46a , $x ) ( $ts + 47a , $x ) ( $ts + 48a , $x ) ( $ts + 49a , $x ) ( $ts + 50a , $x ) ( $ts + 51a , $x ) ( $ts + 52a , $x ) ( $ts + 53a , $x ) ( $ts + 54a , $x ) ( $ts + 55a , $x ) ( $ts + 56a , $x ) ( $ts + 57a , $x ) ( $ts + 58a , $x ) ( $ts + 59a , $x ) - $x = $x + 60 - endw - $totalRows = $totalRows + $x - print info: inserted $x rows into $tb and totalRows: $totalRows - $i = $i + 1 -endw -$tsEnd = $tsStart + $totalRows / $tblNum - -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - -print ============== step3: stop dnode4 -system sh/exec.sh -n dnode4 -s stop -x SIGINT -sleep $sleepTimer -$cnt = 0 -wait_dnode4_offline_0: -$cnt = $cnt + 1 -if $cnt == 10 then - return -1 -endi -sql select * from information_schema.ins_dnodes -if $rows != 4 then - sleep 2000 - goto wait_dnode4_offline_0 -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 -#$dnode1Status = $data4_1 -$dnode2Status = $data4_2 -$dnode3Status = $data4_3 -$dnode4Status = $data4_4 -#$dnode5Status = $data4_5 - -if $dnode4Status != offline then - sleep 2000 - goto wait_dnode4_offline_0 -endi - -$cnt = 0 -wait_dnode4_vgroup_offline: -$cnt = $cnt + 1 -if $cnt == 10 then - return -1 -endi -sql show vgroups -if $rows != 1 then - sleep 2000 - goto wait_dnode4_vgroup_offline -endi -print show vgroups: -print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 $data5_1 $data6_1 $data7_1 $data8_1 $data9_1 -print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 $data5_2 $data6_2 $data7_2 $data8_2 $data9_2 -print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3 $data5_3 $data6_3 $data7_3 $data8_3 $data9_3 -$dnode4Vtatus = $data5_2 -$dnode3Vtatus = $data7_2 - -if $dnode4Vtatus != offline then - sleep 2000 - goto wait_dnode4_vgroup_offline -endi -if $dnode3Vtatus != master then - sleep 2000 - goto wait_dnode4_vgroup_offline -endi - -print ============== step4: insert more data rows -$tsStart = $tsEnd + 1000 -$i = 0 -while $i < $tblNum - $tb = tb . $i - - $x = 0 - while $x < $rowNum - $ts = $tsStart + $x - sql insert into $tb values ( $ts + 0a , $x ) ( $ts + 1a , $x ) ( $ts + 2a , $x ) ( $ts + 3a , $x ) ( $ts + 4a , $x ) ( $ts + 5a , $x ) ( $ts + 6a , $x ) ( $ts + 7a , $x ) ( $ts + 8a , $x ) ( $ts + 9a , $x ) ( $ts + 10a , $x ) ( $ts + 11a , $x ) ( $ts + 12a , $x ) ( $ts + 13a , $x ) ( $ts + 14a , $x ) ( $ts + 15a , $x ) ( $ts + 16a , $x ) ( $ts + 17a , $x ) ( $ts + 18a , $x ) ( $ts + 19a , $x ) ( $ts + 20a , $x ) ( $ts + 21a , $x ) ( $ts + 22a , $x ) ( $ts + 23a , $x ) ( $ts + 24a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 35a , $x ) ( $ts + 36a , $x ) ( $ts + 37a , $x ) ( $ts + 38a , $x ) ( $ts + 39a , $x ) ( $ts + 40a , $x ) ( $ts + 41a , $x ) ( $ts + 42a , $x ) ( $ts + 43a , $x ) ( $ts + 44a , $x ) ( $ts + 45a , $x ) ( $ts + 46a , $x ) ( $ts + 47a , $x ) ( $ts + 48a , $x ) ( $ts + 49a , $x ) ( $ts + 50a , $x ) ( $ts + 51a , $x ) ( $ts + 52a , $x ) ( $ts + 53a , $x ) ( $ts + 54a , $x ) ( $ts + 55a , $x ) ( $ts + 56a , $x ) ( $ts + 57a , $x ) ( $ts + 58a , $x ) ( $ts + 59a , $x ) - $x = $x + 60 - endw - $totalRows = $totalRows + $x - print info: inserted $x rows into $tb and totalRows: $totalRows - $i = $i + 1 -endw - -sql select count(*) from $stb -print data00:$data00 totalRows:$totalRows -if $data00 != $totalRows then - return -1 -endi - -print ============== step5: restart dnode4, while alter table and insert data in other thead when dnode4 is syncing -system sh/exec.sh -n dnode4 -s start -run_back unique/arbitrator/sync_replica_createTable_background_add.sim - -print ============== step6: check result -#in background.sim, add 10 tables and insert 100 rows -$totalRows = $totalRows + 100 - -$cnt = 0 -wait_table_created: -$cnt = $cnt + 1 -if $cnt == 20 then - return -1 -endi - -sql show tables -if $rows != $totalTableNum then - print rows:$rows totalTableNum:$totalTableNum - sleep 2000 - goto wait_table_created -endi - -sql select count(*) from $stb -if $data00 != $totalRows then - print data00:$data00 totalRows:$totalRows - sleep 2000 - goto wait_table_created -endi - - - - diff --git a/tests/script/tsim/backup/arbitrator/sync_replica3_dnodeChang_DropAddAlterTableDropDb.sim b/tests/script/tsim/backup/arbitrator/sync_replica3_dnodeChang_DropAddAlterTableDropDb.sim deleted file mode 100644 index ed2dc120af..0000000000 --- a/tests/script/tsim/backup/arbitrator/sync_replica3_dnodeChang_DropAddAlterTableDropDb.sim +++ /dev/null @@ -1,485 +0,0 @@ -system sh/stop_dnodes.sh -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -system sh/deploy.sh -n dnode3 -i 3 -system sh/deploy.sh -n dnode4 -i 4 - -system sh/cfg.sh -n dnode1 -c 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 dnode1 -c walLevel -v 2 -system sh/cfg.sh -n dnode2 -c walLevel -v 2 -system sh/cfg.sh -n dnode3 -c walLevel -v 2 -system sh/cfg.sh -n dnode4 -c walLevel -v 2 - -system sh/cfg.sh -n dnode1 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode2 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode3 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode4 -c balanceInterval -v 10 - -system sh/cfg.sh -n dnode1 -c role -v 1 -system sh/cfg.sh -n dnode2 -c role -v 2 -system sh/cfg.sh -n dnode3 -c role -v 2 -system sh/cfg.sh -n dnode4 -c role -v 2 - -$totalTableNum = 40 -system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v $totalTableNum -system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v $totalTableNum -system sh/cfg.sh -n dnode3 -c maxtablesPerVnode -v $totalTableNum -system sh/cfg.sh -n dnode4 -c maxtablesPerVnode -v $totalTableNum - -system sh/cfg.sh -n dnode1 -c maxVgroupsPerDb -v 1 -system sh/cfg.sh -n dnode2 -c maxVgroupsPerDb -v 1 -system sh/cfg.sh -n dnode3 -c maxVgroupsPerDb -v 1 -system sh/cfg.sh -n dnode4 -c maxVgroupsPerDb -v 1 - -system sh/cfg.sh -n dnode1 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode2 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode3 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode4 -c arbitrator -v $arbitrator - -print ============== step0: start tarbitrator -system sh/exec_tarbitrator.sh -s start - -print ============== step1: start dnode1, only deploy mnode -system sh/exec.sh -n dnode1 -s start -sleep 2000 -sql connect - -print ============== step2: start dnode2/dnode3/dnode4 and add into cluster , then create database with replica 3, and create table, insert data -system sh/exec.sh -n dnode2 -s start -system sh/exec.sh -n dnode3 -s start -system sh/exec.sh -n dnode4 -s start -sql create dnode $hostname2 -sql create dnode $hostname3 -sql create dnode $hostname4 -sleep 2000 - -$totalTableNum = 20 -$sleepTimer = 3000 - -$maxTables = $totalTableNum * 2 -$db = db -print create database $db replica 3 -sql create database $db replica 3 -sql use $db - -# create table , insert data -$stb = stb -sql create table $stb (ts timestamp, c1 int) tags(t1 int) -$rowNum = 500 -$tblNum = 10 -$totalRows = 0 -$tsStart = 1420041600000 -$tsEnd = 0 - -$i = 0 -while $i < $tblNum - $tb = tb . $i - sql create table $tb using $stb tags( $i ) - - $x = 0 - $ts = $tsStart + $x - sql insert into $tb values ( $ts + 0a , $x ) ( $ts + 1a , $x ) ( $ts + 2a , $x ) ( $ts + 3a , $x ) ( $ts + 4a , $x ) ( $ts + 5a , $x ) ( $ts + 6a , $x ) ( $ts + 7a , $x ) ( $ts + 8a , $x ) ( $ts + 9a , $x ) - $x = $x + 10 - - $totalRows = $totalRows + $x - print info: inserted $x rows into $tb and totalRows: $totalRows - $i = $i + 1 -endw -$tsEnd = $tsStart + $totalRows / $tblNum - -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - -print ============== step3: stop dnode4 -system sh/exec.sh -n dnode4 -s stop -x SIGINT -$cnt = 0 -wait_dnode4_offline_0: -$cnt = $cnt + 1 -if $cnt == 10 then - return -1 -endi -sql select * from information_schema.ins_dnodes -if $rows != 4 then - sleep 2000 - goto wait_dnode4_offline_0 -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 -$dnode1Status = $data4_1 -$dnode2Status = $data4_2 -$dnode3Status = $data4_3 -$dnode4Status = $data4_4 - -if $dnode4Status != offline then - sleep 2000 - goto wait_dnode4_offline_0 -endi - -$cnt = 0 -wait_dnode4_vgroup_offline: -$cnt = $cnt + 1 -if $cnt == 10 then - return -1 -endi -sql show vgroups -if $rows != 1 then - sleep 2000 - goto wait_dnode4_vgroup_offline -endi -print show vgroups: -print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 $data5_1 $data6_1 $data7_1 $data8_1 $data9_1 -print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 $data5_2 $data6_2 $data7_2 $data8_2 $data9_2 -print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3 $data5_3 $data6_3 $data7_3 $data8_3 $data9_3 -$dnode4Vtatus = $data5_2 -$dnode3Vtatus = $data7_2 - -if $dnode4Vtatus != offline then - sleep 2000 - goto wait_dnode4_vgroup_offline -endi -if $dnode3Vtatus != master then - sleep 2000 - goto wait_dnode4_vgroup_offline -endi - -print ============== step4: drop some tables -sql drop table tb0 -sql drop table tb9 -sql drop table tb1 -sql drop table tb8 - -$totalRows = $totalRows - 40 -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - -print ============== step5: restart dnode4, waiting sync end -system sh/exec.sh -n dnode4 -s start - -$cnt = 0 -wait_dnode4_ready: -$cnt = $cnt + 1 -if $cnt == 10 then - return -1 -endi -sql select * from information_schema.ins_dnodes -if $rows != 4 then - sleep 2000 - goto wait_dnode4_ready -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 -$dnode1Status = $data4_1 -$dnode2Status = $data4_2 -$dnode3Status = $data4_3 -$dnode4Status = $data4_4 - -if $dnode4Status != ready then - sleep 2000 - goto wait_dnode4_ready -endi - -$cnt = 0 -wait_dnode4_vgroup_slave: -$cnt = $cnt + 1 -if $cnt == 10 then - return -1 -endi -sql show vgroups -if $rows != 1 then - sleep 2000 - goto wait_dnode4_vgroup_slave -endi -print show vgroups: -print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 $data5_1 $data6_1 $data7_1 $data8_1 $data9_1 -print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 $data5_2 $data6_2 $data7_2 $data8_2 $data9_2 -print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3 $data5_3 $data6_3 $data7_3 $data8_3 $data9_3 -$dnode4Vtatus = $data5_2 -$dnode3Vtatus = $data7_2 - -if $dnode4Vtatus != slave then - sleep 2000 - goto wait_dnode4_vgroup_slave -endi - -print ============== step6: stop dnode2/dnode3 and remove their data dir, and restart dnode2/dnode3 -system sh/exec.sh -n dnode2 -s stop -x SIGINT -system sh/exec.sh -n dnode3 -s stop -x SIGINT -sleep 1000 -system rm -rf ../../../sim/dnode2/data -system rm -rf ../../../sim/dnode3/data - -system sh/exec.sh -n dnode2 -s start -system sh/exec.sh -n dnode3 -s start - -$cnt = 0 -wait_dnode4_vgroup_master: -$cnt = $cnt + 1 -if $cnt == 10 then - return -1 -endi -sql show vgroups -if $rows != 1 then - sleep 2000 - goto wait_dnode4_vgroup_master -endi -print show vgroups: -print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 $data5_1 $data6_1 $data7_1 $data8_1 $data9_1 -print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 $data5_2 $data6_2 $data7_2 $data8_2 $data9_2 -print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3 $data5_3 $data6_3 $data7_3 $data8_3 $data9_3 -$dnode4Vtatus = $data5_2 -$dnode3Vtatus = $data7_2 - -if $dnode4Vtatus != master then - sleep 2000 - goto wait_dnode4_vgroup_master -endi - -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - - -print ============== step7: stop dnode4 and create some new tables -system sh/exec.sh -n dnode4 -s stop -x SIGINT - -$ts = $tsStart -sql insert into tb10 using stb tags(10) values ( $ts + 0a , $x ) ( $ts + 1a , $x ) ( $ts + 2a , $x ) ( $ts + 3a , $x ) ( $ts + 4a , $x ) ( $ts + 5a , $x ) ( $ts + 6a , $x ) ( $ts + 7a , $x ) ( $ts + 8a , $x ) ( $ts + 9a , $x ) -sql insert into tb11 using stb tags(11) values ( $ts + 0a , $x ) ( $ts + 1a , $x ) ( $ts + 2a , $x ) ( $ts + 3a , $x ) ( $ts + 4a , $x ) ( $ts + 5a , $x ) ( $ts + 6a , $x ) ( $ts + 7a , $x ) ( $ts + 8a , $x ) ( $ts + 9a , $x ) -sql insert into tb12 using stb tags(12) values ( $ts + 0a , $x ) ( $ts + 1a , $x ) ( $ts + 2a , $x ) ( $ts + 3a , $x ) ( $ts + 4a , $x ) ( $ts + 5a , $x ) ( $ts + 6a , $x ) ( $ts + 7a , $x ) ( $ts + 8a , $x ) ( $ts + 9a , $x ) -sql insert into tb13 using stb tags(13) values ( $ts + 0a , $x ) ( $ts + 1a , $x ) ( $ts + 2a , $x ) ( $ts + 3a , $x ) ( $ts + 4a , $x ) ( $ts + 5a , $x ) ( $ts + 6a , $x ) ( $ts + 7a , $x ) ( $ts + 8a , $x ) ( $ts + 9a , $x ) - -$totalRows = $totalRows + 40 -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - -print ============== step8: restart dnode4, waiting sync end -system sh/exec.sh -n dnode4 -s start - -$cnt = 0 -wait_dnode4_ready_2: -$cnt = $cnt + 1 -if $cnt == 10 then - return -1 -endi -sql select * from information_schema.ins_dnodes -if $rows != 4 then - sleep 2000 - goto wait_dnode4_ready_2 -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 -$dnode1Status = $data4_1 -$dnode2Status = $data4_2 -$dnode3Status = $data4_3 -$dnode4Status = $data4_4 - -if $dnode4Status != ready then - sleep 2000 - goto wait_dnode4_ready_2 -endi - -$cnt = 0 -wait_dnode4_vgroup_slave_2: -$cnt = $cnt + 1 -if $cnt == 10 then - return -1 -endi -sql show vgroups -if $rows != 1 then - sleep 2000 - goto wait_dnode4_vgroup_slave_2 -endi -print show vgroups: -print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 $data5_1 $data6_1 $data7_1 $data8_1 $data9_1 -print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 $data5_2 $data6_2 $data7_2 $data8_2 $data9_2 -print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3 $data5_3 $data6_3 $data7_3 $data8_3 $data9_3 -$dnode4Vtatus = $data5_2 -$dnode3Vtatus = $data7_2 - -if $dnode4Vtatus != slave then - sleep 2000 - goto wait_dnode4_vgroup_slave_2 -endi - -print ============== step9: stop dnode2/dnode3 and remove their data dir, and restart dnode2/dnode3 -system sh/exec.sh -n dnode2 -s stop -x SIGINT -system sh/exec.sh -n dnode3 -s stop -x SIGINT -sleep 1000 -system rm -rf ../../../sim/dnode2/data -system rm -rf ../../../sim/dnode3/data - -system sh/exec.sh -n dnode2 -s start -system sh/exec.sh -n dnode3 -s start - -$cnt = 0 -wait_dnode4_vgroup_master_2: -$cnt = $cnt + 1 -if $cnt == 10 then - return -1 -endi -sql show vgroups -if $rows != 1 then - sleep 2000 - goto wait_dnode4_vgroup_master_2 -endi -print show vgroups: -print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 $data5_1 $data6_1 $data7_1 $data8_1 $data9_1 -print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 $data5_2 $data6_2 $data7_2 $data8_2 $data9_2 -print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3 $data5_3 $data6_3 $data7_3 $data8_3 $data9_3 -$dnode4Vtatus = $data5_2 -$dnode3Vtatus = $data7_2 - -if $dnode4Vtatus != master then - sleep 2000 - goto wait_dnode4_vgroup_master_2 -endi - -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - - -print ============== step10: stop dnode4 and alter table column -system sh/exec.sh -n dnode4 -s stop -x SIGINT - -sql alter table stb add column c2 int -sql alter table stb add column c3 int -sql alter table stb add column c4 int -sql alter table stb drop column c1 - -sql alter table stb add tag t2 int -sql alter table stb add tag t3 int -sql_error alter table stb drop tag t1 - -$ts = $tsEnd + 10000 -sql insert into tb2 values ( $ts + 0a , $x , $x , $x ) ( $ts + 1a , $x , $x , $x ) ( $ts + 2a , $x , $x , $x ) ( $ts + 3a , $x , $x , $x ) ( $ts + 4a , $x , $x , $x ) ( $ts + 5a , $x , $x , $x ) ( $ts + 6a , $x , $x , $x ) ( $ts + 7a , $x , $x , $x ) ( $ts + 8a , $x , $x , $x ) ( $ts + 9a , $x , $x , $x ) -sql insert into tb3 values ( $ts + 0a , $x , $x , $x ) ( $ts + 1a , $x , $x , $x ) ( $ts + 2a , $x , $x , $x ) ( $ts + 3a , $x , $x , $x ) ( $ts + 4a , $x , $x , $x ) ( $ts + 5a , $x , $x , $x ) ( $ts + 6a , $x , $x , $x ) ( $ts + 7a , $x , $x , $x ) ( $ts + 8a , $x , $x , $x ) ( $ts + 9a , $x , $x , $x ) -sql insert into tb4 values ( $ts + 0a , $x , $x , $x ) ( $ts + 1a , $x , $x , $x ) ( $ts + 2a , $x , $x , $x ) ( $ts + 3a , $x , $x , $x ) ( $ts + 4a , $x , $x , $x ) ( $ts + 5a , $x , $x , $x ) ( $ts + 6a , $x , $x , $x ) ( $ts + 7a , $x , $x , $x ) ( $ts + 8a , $x , $x , $x ) ( $ts + 9a , $x , $x , $x ) -sql insert into tb5 values ( $ts + 0a , $x , $x , $x ) ( $ts + 1a , $x , $x , $x ) ( $ts + 2a , $x , $x , $x ) ( $ts + 3a , $x , $x , $x ) ( $ts + 4a , $x , $x , $x ) ( $ts + 5a , $x , $x , $x ) ( $ts + 6a , $x , $x , $x ) ( $ts + 7a , $x , $x , $x ) ( $ts + 8a , $x , $x , $x ) ( $ts + 9a , $x , $x , $x ) - - -$ts = $tsStart -sql insert into tb14 using stb tags(14, 14, 14) values ( $ts + 0a , $x , $x , $x ) ( $ts + 1a , $x , $x , $x ) ( $ts + 2a , $x , $x , $x ) ( $ts + 3a , $x , $x , $x ) ( $ts + 4a , $x , $x , $x ) ( $ts + 5a , $x , $x , $x ) ( $ts + 6a , $x , $x , $x ) ( $ts + 7a , $x , $x , $x ) ( $ts + 8a , $x , $x , $x ) ( $ts + 9a , $x , $x , $x ) -sql insert into tb15 using stb tags(15, 15, 15) values ( $ts + 0a , $x , $x , $x ) ( $ts + 1a , $x , $x , $x ) ( $ts + 2a , $x , $x , $x ) ( $ts + 3a , $x , $x , $x ) ( $ts + 4a , $x , $x , $x ) ( $ts + 5a , $x , $x , $x ) ( $ts + 6a , $x , $x , $x ) ( $ts + 7a , $x , $x , $x ) ( $ts + 8a , $x , $x , $x ) ( $ts + 9a , $x , $x , $x ) -sql insert into tb16 using stb tags(16, 16, 16) values ( $ts + 0a , $x , $x , $x ) ( $ts + 1a , $x , $x , $x ) ( $ts + 2a , $x , $x , $x ) ( $ts + 3a , $x , $x , $x ) ( $ts + 4a , $x , $x , $x ) ( $ts + 5a , $x , $x , $x ) ( $ts + 6a , $x , $x , $x ) ( $ts + 7a , $x , $x , $x ) ( $ts + 8a , $x , $x , $x ) ( $ts + 9a , $x , $x , $x ) -sql insert into tb17 using stb tags(17, 17, 17) values ( $ts + 0a , $x , $x , $x ) ( $ts + 1a , $x , $x , $x ) ( $ts + 2a , $x , $x , $x ) ( $ts + 3a , $x , $x , $x ) ( $ts + 4a , $x , $x , $x ) ( $ts + 5a , $x , $x , $x ) ( $ts + 6a , $x , $x , $x ) ( $ts + 7a , $x , $x , $x ) ( $ts + 8a , $x , $x , $x ) ( $ts + 9a , $x , $x , $x ) - -$totalRows = $totalRows + 80 -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - -print ============== step11: restart dnode4, waiting sync end -system sh/exec.sh -n dnode4 -s start - -$cnt = 0 -wait_dnode4_ready_3: -$cnt = $cnt + 1 -if $cnt == 10 then - return -1 -endi -sql select * from information_schema.ins_dnodes -if $rows != 4 then - sleep 2000 - goto wait_dnode4_ready_3 -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 -$dnode1Status = $data4_1 -$dnode2Status = $data4_2 -$dnode3Status = $data4_3 -$dnode4Status = $data4_4 - -if $dnode4Status != ready then - sleep 2000 - goto wait_dnode4_ready_3 -endi - -$cnt = 0 -wait_dnode4_vgroup_slave_3: -$cnt = $cnt + 1 -if $cnt == 10 then - return -1 -endi -sql show vgroups -if $rows != 1 then - sleep 2000 - goto wait_dnode4_vgroup_slave_3 -endi -print show vgroups: -print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 $data5_1 $data6_1 $data7_1 $data8_1 $data9_1 -print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 $data5_2 $data6_2 $data7_2 $data8_2 $data9_2 -print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3 $data5_3 $data6_3 $data7_3 $data8_3 $data9_3 -$dnode4Vtatus = $data5_2 -$dnode3Vtatus = $data7_2 - -if $dnode4Vtatus != slave then - sleep 2000 - goto wait_dnode4_vgroup_slave_3 -endi - -print ============== step12: stop dnode2/dnode3 and remove their data dir, and restart dnode2/dnode3 -system sh/exec.sh -n dnode2 -s stop -x SIGINT -system sh/exec.sh -n dnode3 -s stop -x SIGINT -sleep 1000 -system rm -rf ../../../sim/dnode2/data -system rm -rf ../../../sim/dnode3/data - -system sh/exec.sh -n dnode2 -s start -system sh/exec.sh -n dnode3 -s start - -$cnt = 0 -wait_dnode4_vgroup_master_3: -$cnt = $cnt + 1 -if $cnt == 10 then - return -1 -endi -sql show vgroups -if $rows != 1 then - sleep 2000 - goto wait_dnode4_vgroup_master_3 -endi -print show vgroups: -print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 $data5_1 $data6_1 $data7_1 $data8_1 $data9_1 -print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 $data5_2 $data6_2 $data7_2 $data8_2 $data9_2 -print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3 $data5_3 $data6_3 $data7_3 $data8_3 $data9_3 -$dnode4Vtatus = $data5_2 -$dnode3Vtatus = $data7_2 - -if $dnode4Vtatus != master then - sleep 2000 - goto wait_dnode4_vgroup_master_3 -endi - -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi diff --git a/tests/script/tsim/backup/arbitrator/sync_replica3_dropDb.sim b/tests/script/tsim/backup/arbitrator/sync_replica3_dropDb.sim deleted file mode 100644 index a3d0d84f71..0000000000 --- a/tests/script/tsim/backup/arbitrator/sync_replica3_dropDb.sim +++ /dev/null @@ -1,200 +0,0 @@ -system sh/stop_dnodes.sh -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -system sh/deploy.sh -n dnode3 -i 3 -system sh/deploy.sh -n dnode4 -i 4 - -system sh/cfg.sh -n dnode1 -c 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 dnode1 -c walLevel -v 2 -system sh/cfg.sh -n dnode2 -c walLevel -v 2 -system sh/cfg.sh -n dnode3 -c walLevel -v 2 -system sh/cfg.sh -n dnode4 -c walLevel -v 2 - -system sh/cfg.sh -n dnode1 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode2 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode3 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode4 -c balanceInterval -v 10 - -system sh/cfg.sh -n dnode1 -c role -v 1 -system sh/cfg.sh -n dnode2 -c role -v 2 -system sh/cfg.sh -n dnode3 -c role -v 2 -system sh/cfg.sh -n dnode4 -c role -v 2 - -$totalTableNum = 10 -system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v $totalTableNum -system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v $totalTableNum -system sh/cfg.sh -n dnode3 -c maxtablesPerVnode -v $totalTableNum -system sh/cfg.sh -n dnode4 -c maxtablesPerVnode -v $totalTableNum - -system sh/cfg.sh -n dnode1 -c maxVgroupsPerDb -v 1 -system sh/cfg.sh -n dnode2 -c maxVgroupsPerDb -v 1 -system sh/cfg.sh -n dnode3 -c maxVgroupsPerDb -v 1 -system sh/cfg.sh -n dnode4 -c maxVgroupsPerDb -v 1 - -system sh/cfg.sh -n dnode1 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode2 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode3 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode4 -c arbitrator -v $arbitrator - -print ============== step0: start tarbitrator -system sh/exec_tarbitrator.sh -s start - -print ============== step1: start dnode1, only deploy mnode -system sh/exec.sh -n dnode1 -s start -sleep 2000 -sql connect - -print ============== step2: start dnode2/dnode3/dnode4 and add into cluster , then create database with replica 3, and create table, insert data -system sh/exec.sh -n dnode2 -s start -system sh/exec.sh -n dnode3 -s start -system sh/exec.sh -n dnode4 -s start -sql create dnode $hostname2 -sql create dnode $hostname3 -sql create dnode $hostname4 -sleep 2000 - -$totalTableNum = 10 -$sleepTimer = 3000 - -$db = db -print create database $db replica 3 -sql create database $db replica 3 -sql use $db - -# create table , insert data -$stb = stb -sql create table $stb (ts timestamp, c1 int) tags(t1 int) -$rowNum = 500 -$tblNum = $totalTableNum -$totalRows = 0 -$tsStart = 1420041600000 -$tsEnd = 0 - -$i = 0 -while $i < $tblNum - $tb = tb . $i - sql create table $tb using $stb tags( $i ) - - $x = 0 - while $x < $rowNum - $ts = $tsStart + $x - sql insert into $tb values ( $ts + 0a , $x ) ( $ts + 1a , $x ) ( $ts + 2a , $x ) ( $ts + 3a , $x ) ( $ts + 4a , $x ) ( $ts + 5a , $x ) ( $ts + 6a , $x ) ( $ts + 7a , $x ) ( $ts + 8a , $x ) ( $ts + 9a , $x ) ( $ts + 10a , $x ) ( $ts + 11a , $x ) ( $ts + 12a , $x ) ( $ts + 13a , $x ) ( $ts + 14a , $x ) ( $ts + 15a , $x ) ( $ts + 16a , $x ) ( $ts + 17a , $x ) ( $ts + 18a , $x ) ( $ts + 19a , $x ) ( $ts + 20a , $x ) ( $ts + 21a , $x ) ( $ts + 22a , $x ) ( $ts + 23a , $x ) ( $ts + 24a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 35a , $x ) ( $ts + 36a , $x ) ( $ts + 37a , $x ) ( $ts + 38a , $x ) ( $ts + 39a , $x ) ( $ts + 40a , $x ) ( $ts + 41a , $x ) ( $ts + 42a , $x ) ( $ts + 43a , $x ) ( $ts + 44a , $x ) ( $ts + 45a , $x ) ( $ts + 46a , $x ) ( $ts + 47a , $x ) ( $ts + 48a , $x ) ( $ts + 49a , $x ) ( $ts + 50a , $x ) ( $ts + 51a , $x ) ( $ts + 52a , $x ) ( $ts + 53a , $x ) ( $ts + 54a , $x ) ( $ts + 55a , $x ) ( $ts + 56a , $x ) ( $ts + 57a , $x ) ( $ts + 58a , $x ) ( $ts + 59a , $x ) - $x = $x + 60 - endw - $totalRows = $totalRows + $x - print info: inserted $x rows into $tb and totalRows: $totalRows - $i = $i + 1 -endw -$tsEnd = $tsStart + $totalRows / $tblNum - -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - -print ============== step3: stop dnode4 -system sh/exec.sh -n dnode4 -s stop -x SIGINT -sleep $sleepTimer -$cnt = 0 -wait_dnode4_offline_0: -$cnt = $cnt + 1 -if $cnt == 10 then - return -1 -endi -sql select * from information_schema.ins_dnodes -if $rows != 5 then - sleep 2000 - goto wait_dnode4_offline_0 -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 -#$dnode1Status = $data4_1 -$dnode2Status = $data4_2 -$dnode3Status = $data4_3 -$dnode4Status = $data4_4 -#$dnode5Status = $data4_5 - -if $dnode4Status != offline then - sleep 2000 - goto wait_dnode4_offline_0 -endi - -$cnt = 0 -wait_dnode4_vgroup_offline: -$cnt = $cnt + 1 -if $cnt == 10 then - return -1 -endi -sql show vgroups -if $rows != 1 then - sleep 2000 - goto wait_dnode4_vgroup_offline -endi -print show vgroups: -print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 $data5_1 $data6_1 $data7_1 $data8_1 $data9_1 -print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 $data5_2 $data6_2 $data7_2 $data8_2 $data9_2 -print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3 $data5_3 $data6_3 $data7_3 $data8_3 $data9_3 -$dnode4Vtatus = $data5_2 -$dnode3Vtatus = $data7_2 - -if $dnode4Vtatus != offline then - sleep 2000 - goto wait_dnode4_vgroup_offline -endi -if $dnode3Vtatus != master then - sleep 2000 - goto wait_dnode4_vgroup_offline -endi - -print ============== step4: insert more data rows -$tsStart = $tsEnd + 1000 -$i = 0 -while $i < $tblNum - $tb = tb . $i - - $x = 0 - while $x < $rowNum - $ts = $tsStart + $x - sql insert into $tb values ( $ts + 0a , $x ) ( $ts + 1a , $x ) ( $ts + 2a , $x ) ( $ts + 3a , $x ) ( $ts + 4a , $x ) ( $ts + 5a , $x ) ( $ts + 6a , $x ) ( $ts + 7a , $x ) ( $ts + 8a , $x ) ( $ts + 9a , $x ) ( $ts + 10a , $x ) ( $ts + 11a , $x ) ( $ts + 12a , $x ) ( $ts + 13a , $x ) ( $ts + 14a , $x ) ( $ts + 15a , $x ) ( $ts + 16a , $x ) ( $ts + 17a , $x ) ( $ts + 18a , $x ) ( $ts + 19a , $x ) ( $ts + 20a , $x ) ( $ts + 21a , $x ) ( $ts + 22a , $x ) ( $ts + 23a , $x ) ( $ts + 24a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 35a , $x ) ( $ts + 36a , $x ) ( $ts + 37a , $x ) ( $ts + 38a , $x ) ( $ts + 39a , $x ) ( $ts + 40a , $x ) ( $ts + 41a , $x ) ( $ts + 42a , $x ) ( $ts + 43a , $x ) ( $ts + 44a , $x ) ( $ts + 45a , $x ) ( $ts + 46a , $x ) ( $ts + 47a , $x ) ( $ts + 48a , $x ) ( $ts + 49a , $x ) ( $ts + 50a , $x ) ( $ts + 51a , $x ) ( $ts + 52a , $x ) ( $ts + 53a , $x ) ( $ts + 54a , $x ) ( $ts + 55a , $x ) ( $ts + 56a , $x ) ( $ts + 57a , $x ) ( $ts + 58a , $x ) ( $ts + 59a , $x ) - $x = $x + 60 - endw - $totalRows = $totalRows + $x - print info: inserted $x rows into $tb and totalRows: $totalRows - $i = $i + 1 -endw - -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - -print ============== step5: restart dnode4, while drop database in other thead when dnode4 is syncing -system sh/exec.sh -n dnode4 -s start -run_back unique/arbitrator/sync_replica_dropDb_background.sim - -print ============== step6: check result -$cnt = 0 -wait_database_dropped: -$cnt = $cnt + 1 -if $cnt == 20 then - return -1 -endi -sql select * from information_schema.ins_databases -if $rows != 0 then - sleep 2000 - goto wait_database_dropped -endi - - - - diff --git a/tests/script/tsim/backup/arbitrator/sync_replica3_dropTable.sim b/tests/script/tsim/backup/arbitrator/sync_replica3_dropTable.sim deleted file mode 100644 index a214fdeb22..0000000000 --- a/tests/script/tsim/backup/arbitrator/sync_replica3_dropTable.sim +++ /dev/null @@ -1,210 +0,0 @@ -system sh/stop_dnodes.sh -system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 -system sh/deploy.sh -n dnode3 -i 3 -system sh/deploy.sh -n dnode4 -i 4 - -system sh/cfg.sh -n dnode1 -c 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 dnode1 -c walLevel -v 2 -system sh/cfg.sh -n dnode2 -c walLevel -v 2 -system sh/cfg.sh -n dnode3 -c walLevel -v 2 -system sh/cfg.sh -n dnode4 -c walLevel -v 2 - -system sh/cfg.sh -n dnode1 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode2 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode3 -c balanceInterval -v 10 -system sh/cfg.sh -n dnode4 -c balanceInterval -v 10 - -system sh/cfg.sh -n dnode1 -c role -v 1 -system sh/cfg.sh -n dnode2 -c role -v 2 -system sh/cfg.sh -n dnode3 -c role -v 2 -system sh/cfg.sh -n dnode4 -c role -v 2 - -$totalTableNum = 10 -system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v $totalTableNum -system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v $totalTableNum -system sh/cfg.sh -n dnode3 -c maxtablesPerVnode -v $totalTableNum -system sh/cfg.sh -n dnode4 -c maxtablesPerVnode -v $totalTableNum - -system sh/cfg.sh -n dnode1 -c maxVgroupsPerDb -v 1 -system sh/cfg.sh -n dnode2 -c maxVgroupsPerDb -v 1 -system sh/cfg.sh -n dnode3 -c maxVgroupsPerDb -v 1 -system sh/cfg.sh -n dnode4 -c maxVgroupsPerDb -v 1 - -system sh/cfg.sh -n dnode1 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode2 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode3 -c arbitrator -v $arbitrator -system sh/cfg.sh -n dnode4 -c arbitrator -v $arbitrator - -print ============== step0: start tarbitrator -system sh/exec_tarbitrator.sh -s start - -print ============== step1: start dnode1, only deploy mnode -system sh/exec.sh -n dnode1 -s start -sleep 2000 -sql connect - -print ============== step2: start dnode2/dnode3/dnode4 and add into cluster , then create database with replica 3, and create table, insert data -system sh/exec.sh -n dnode2 -s start -system sh/exec.sh -n dnode3 -s start -system sh/exec.sh -n dnode4 -s start -sql create dnode $hostname2 -sql create dnode $hostname3 -sql create dnode $hostname4 -sleep 2000 - -$totalTableNum = 10 -$sleepTimer = 3000 - -$db = db -print create database $db replica 3 -sql create database $db replica 3 -sql use $db - -# create table , insert data -$stb = stb -sql create table $stb (ts timestamp, c1 int) tags(t1 int) -$rowNum = 500 -$tblNum = $totalTableNum -$totalRows = 0 -$tsStart = 1420041600000 -$tsEnd = 0 - -$i = 0 -while $i < $tblNum - $tb = tb . $i - sql create table $tb using $stb tags( $i ) - - $x = 0 - while $x < $rowNum - $ts = $tsStart + $x - sql insert into $tb values ( $ts + 0a , $x ) ( $ts + 1a , $x ) ( $ts + 2a , $x ) ( $ts + 3a , $x ) ( $ts + 4a , $x ) ( $ts + 5a , $x ) ( $ts + 6a , $x ) ( $ts + 7a , $x ) ( $ts + 8a , $x ) ( $ts + 9a , $x ) ( $ts + 10a , $x ) ( $ts + 11a , $x ) ( $ts + 12a , $x ) ( $ts + 13a , $x ) ( $ts + 14a , $x ) ( $ts + 15a , $x ) ( $ts + 16a , $x ) ( $ts + 17a , $x ) ( $ts + 18a , $x ) ( $ts + 19a , $x ) ( $ts + 20a , $x ) ( $ts + 21a , $x ) ( $ts + 22a , $x ) ( $ts + 23a , $x ) ( $ts + 24a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 35a , $x ) ( $ts + 36a , $x ) ( $ts + 37a , $x ) ( $ts + 38a , $x ) ( $ts + 39a , $x ) ( $ts + 40a , $x ) ( $ts + 41a , $x ) ( $ts + 42a , $x ) ( $ts + 43a , $x ) ( $ts + 44a , $x ) ( $ts + 45a , $x ) ( $ts + 46a , $x ) ( $ts + 47a , $x ) ( $ts + 48a , $x ) ( $ts + 49a , $x ) ( $ts + 50a , $x ) ( $ts + 51a , $x ) ( $ts + 52a , $x ) ( $ts + 53a , $x ) ( $ts + 54a , $x ) ( $ts + 55a , $x ) ( $ts + 56a , $x ) ( $ts + 57a , $x ) ( $ts + 58a , $x ) ( $ts + 59a , $x ) - $x = $x + 60 - endw - $totalRows = $totalRows + $x - print info: inserted $x rows into $tb and totalRows: $totalRows - $i = $i + 1 -endw -$tsEnd = $tsStart + $totalRows / $tblNum - -sql select count(*) from $stb -print data00 $data00 -if $data00 != $totalRows then - return -1 -endi - -print ============== step3: stop dnode4 -system sh/exec.sh -n dnode4 -s stop -x SIGINT -sleep $sleepTimer -$cnt = 0 -wait_dnode4_offline_0: -$cnt = $cnt + 1 -if $cnt == 10 then - return -1 -endi -sql select * from information_schema.ins_dnodes -if $rows != 5 then - sleep 2000 - goto wait_dnode4_offline_0 -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 -#$dnode1Status = $data4_1 -$dnode2Status = $data4_2 -$dnode3Status = $data4_3 -$dnode4Status = $data4_4 -#$dnode5Status = $data4_5 - -if $dnode4Status != offline then - sleep 2000 - goto wait_dnode4_offline_0 -endi - -$cnt = 0 -wait_dnode4_vgroup_offline: -$cnt = $cnt + 1 -if $cnt == 10 then - return -1 -endi -sql show vgroups -if $rows != 1 then - sleep 2000 - goto wait_dnode4_vgroup_offline -endi -print show vgroups: -print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 $data5_1 $data6_1 $data7_1 $data8_1 $data9_1 -print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 $data5_2 $data6_2 $data7_2 $data8_2 $data9_2 -print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3 $data5_3 $data6_3 $data7_3 $data8_3 $data9_3 -$dnode4Vtatus = $data5_2 -$dnode3Vtatus = $data7_2 - -if $dnode4Vtatus != offline then - sleep 2000 - goto wait_dnode4_vgroup_offline -endi -if $dnode3Vtatus != master then - sleep 2000 - goto wait_dnode4_vgroup_offline -endi - -print ============== step4: insert more data rows -$tsStart = $tsEnd + 1000 -$i = 0 -while $i < $tblNum - $tb = tb . $i - - $x = 0 - while $x < $rowNum - $ts = $tsStart + $x - sql insert into $tb values ( $ts + 0a , $x ) ( $ts + 1a , $x ) ( $ts + 2a , $x ) ( $ts + 3a , $x ) ( $ts + 4a , $x ) ( $ts + 5a , $x ) ( $ts + 6a , $x ) ( $ts + 7a , $x ) ( $ts + 8a , $x ) ( $ts + 9a , $x ) ( $ts + 10a , $x ) ( $ts + 11a , $x ) ( $ts + 12a , $x ) ( $ts + 13a , $x ) ( $ts + 14a , $x ) ( $ts + 15a , $x ) ( $ts + 16a , $x ) ( $ts + 17a , $x ) ( $ts + 18a , $x ) ( $ts + 19a , $x ) ( $ts + 20a , $x ) ( $ts + 21a , $x ) ( $ts + 22a , $x ) ( $ts + 23a , $x ) ( $ts + 24a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 35a , $x ) ( $ts + 36a , $x ) ( $ts + 37a , $x ) ( $ts + 38a , $x ) ( $ts + 39a , $x ) ( $ts + 40a , $x ) ( $ts + 41a , $x ) ( $ts + 42a , $x ) ( $ts + 43a , $x ) ( $ts + 44a , $x ) ( $ts + 45a , $x ) ( $ts + 46a , $x ) ( $ts + 47a , $x ) ( $ts + 48a , $x ) ( $ts + 49a , $x ) ( $ts + 50a , $x ) ( $ts + 51a , $x ) ( $ts + 52a , $x ) ( $ts + 53a , $x ) ( $ts + 54a , $x ) ( $ts + 55a , $x ) ( $ts + 56a , $x ) ( $ts + 57a , $x ) ( $ts + 58a , $x ) ( $ts + 59a , $x ) - $x = $x + 60 - endw - $totalRows = $totalRows + $x - print info: inserted $x rows into $tb and totalRows: $totalRows - $i = $i + 1 -endw - -sql select count(*) from $stb -print data00:$data00 totalRows:$totalRows -if $data00 != $totalRows then - return -1 -endi - -print ============== step5: restart dnode4, while drop some tables in other thread when dnode4 is syncing -system sh/exec.sh -n dnode4 -s start -run_back unique/arbitrator/sync_replica_dropTable_background.sim - -print ============== step6: check result -#in background.sim, drop 5 tables -$totalRows = $totalRows - 5400 - -$cnt = 0 -wait_table_dropped: -$cnt = $cnt + 1 -if $cnt == 20 then - return -1 -endi -sql select count(*) from $stb -if $data00 != $totalRows then - print data00:$data00 totalRows:$totalRows - sleep 2000 - goto wait_table_dropped -endi - -$tblNum = $tblNum - 5 -sql select count(tbname) from $stb -if $data00 != $tblNum then - print data00: $data00 tblNum: $tblNum - sleep 2000 - goto wait_table_dropped -endi - - diff --git a/tests/script/tsim/backup/arbitrator/sync_replica_alterTable_background_add.sim b/tests/script/tsim/backup/arbitrator/sync_replica_alterTable_background_add.sim deleted file mode 100644 index 46d5e34fcb..0000000000 --- a/tests/script/tsim/backup/arbitrator/sync_replica_alterTable_background_add.sim +++ /dev/null @@ -1,28 +0,0 @@ -sql connect - -$db = db -$stb = stb -print =============== sync_replica_alterTable_background_add.sim step0: alter table and insert data -$totalTableNum = 10 - -sql use $db - -#sql create table $stb (ts timestamp, c1 int) tags(t1 int) -print alter table $stb add column f1 float -sql alter table $stb add column f1 float - -$tblNum = $totalTableNum -$alterTblNum = 10 - -sql reset query cache -sleep 100 - -$i = 1 -while $i < $alterTblNum - $tb = tb . $i - sql insert into $tb values (now, 10001, 10001) (now + 1s, 10002, 10002) (now + 2s, 10003, 10003) (now + 3s, 10004, 10004) - $i = $i + 1 -endw - - - diff --git a/tests/script/tsim/backup/arbitrator/sync_replica_alterTable_background_drop.sim b/tests/script/tsim/backup/arbitrator/sync_replica_alterTable_background_drop.sim deleted file mode 100644 index fb8bc60972..0000000000 --- a/tests/script/tsim/backup/arbitrator/sync_replica_alterTable_background_drop.sim +++ /dev/null @@ -1,25 +0,0 @@ -sql connect - -$db = db -$stb = stb -print =============== sync_replica_alterTable_background_drop.sim step0: alter table and insert data -$totalTableNum = 100 - -sql use $db - -#sql create table $stb (ts timestamp, c1 int) tags(t1 int) -sql alter table $stb add column f1 double -sql alter table $stb drop column c1 - -$tblNum = $totalTableNum -$alterTblNum = 10 - -$i = 1 -while $i < $alterTblNum - $tb = tb . $i - sql insert into $tb values (now, 10001) (now + 1s, 10002) (now + 2s, 10003) (now + 3s, 10004) - $i = $i + 1 -endw - - - diff --git a/tests/script/tsim/backup/arbitrator/sync_replica_createTable_background_add.sim b/tests/script/tsim/backup/arbitrator/sync_replica_createTable_background_add.sim deleted file mode 100644 index 50893b58a6..0000000000 --- a/tests/script/tsim/backup/arbitrator/sync_replica_createTable_background_add.sim +++ /dev/null @@ -1,32 +0,0 @@ -sql connect - -$db = db -$stb = stb -print =============== sync_replica_createTable_background_add.sim step0: create table and insert data -$totalTableNum = 10 - -sql use $db - -#sql create table $stb (ts timestamp, c1 int) tags(t1 int) -# create table , insert data -#$rowNum = 500 -$tblNum = 20 -$totalRows = 100 -$tsStart = 1420141600000 -$tsEnd = 0 - -$i = 10 -while $i < $tblNum - $tb = tb . $i - sql create table $tb using $stb tags( $i ) - - $x = 10 - $ts = $tsStart + $x - sql insert into $tb values ( $ts + 0a , $x ) ( $ts + 1a , $x ) ( $ts + 2a , $x ) ( $ts + 3a , $x ) ( $ts + 4a , $x ) ( $ts + 5a , $x ) ( $ts + 6a , $x ) ( $ts + 7a , $x ) ( $ts + 8a , $x ) ( $ts + 9a , $x ) - - $totalRows = $totalRows + $x - print info: inserted $x rows into $tb and totalRows: $totalRows - $i = $i + 1 -endw - - diff --git a/tests/script/tsim/backup/arbitrator/sync_replica_dropDb_background.sim b/tests/script/tsim/backup/arbitrator/sync_replica_dropDb_background.sim deleted file mode 100644 index 440b525bd7..0000000000 --- a/tests/script/tsim/backup/arbitrator/sync_replica_dropDb_background.sim +++ /dev/null @@ -1,6 +0,0 @@ -sql connect - -$db = db -$stb = stb -print =============== sync_replica_dropDb_background.sim step0: drop db -sql drop database if exists $db diff --git a/tests/script/tsim/backup/arbitrator/sync_replica_dropTable_background.sim b/tests/script/tsim/backup/arbitrator/sync_replica_dropTable_background.sim deleted file mode 100644 index 485253027a..0000000000 --- a/tests/script/tsim/backup/arbitrator/sync_replica_dropTable_background.sim +++ /dev/null @@ -1,18 +0,0 @@ -sql connect - -$db = db -$stb = stb -print =============== sync_replica_dropTable_background.sim step0: drop table -$totalTableNum = 6 - -sql use $db - -$tblNum = $totalTableNum -$dropTblNum = 6 - -$i = 1 -while $i < $dropTblNum - $tb = tb . $i - sql drop table if exists $tb - $i = $i + 1 -endw From 3878af10c990148f4bf3ee1e9acc2647afeb1471 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Mon, 28 Nov 2022 16:13:18 +0800 Subject: [PATCH 04/27] refactor: do some internal refactor. --- include/util/talgo.h | 4 ++-- include/util/tarray.h | 8 +------ source/client/src/clientImpl.c | 8 +++---- source/dnode/mgmt/node_util/src/dmEps.c | 2 +- source/dnode/mnode/impl/src/mndDb.c | 2 +- source/dnode/mnode/impl/src/mndDef.c | 10 ++++----- source/dnode/mnode/impl/src/mndStb.c | 2 +- source/libs/catalog/src/ctgUtil.c | 10 ++++----- source/libs/executor/src/executorimpl.c | 4 +++- source/libs/monitor/src/monMain.c | 2 +- source/libs/parser/src/parCalcConst.c | 2 +- source/libs/parser/src/parInsertUtil.c | 2 +- source/libs/parser/src/parTranslater.c | 2 +- source/libs/parser/src/parUtil.c | 8 +++---- source/libs/scheduler/src/schJob.c | 2 +- source/util/src/tarray.c | 28 ++++++++++++------------- 16 files changed, 45 insertions(+), 51 deletions(-) diff --git a/include/util/talgo.h b/include/util/talgo.h index 2ffca029bf..f9d51c4b5b 100644 --- a/include/util/talgo.h +++ b/include/util/talgo.h @@ -27,7 +27,8 @@ extern "C" { typedef int32_t (*__compar_fn_t)(const void *, const void *); #endif -typedef void *(*FCopy)(void *); +typedef void *(*__array_item_dup_fn_t)(void *); + typedef void (*FDelete)(void *); typedef int32_t (*FEncode)(void **buf, const void *dst); typedef void *(*FDecode)(const void *buf, void *dst); @@ -41,7 +42,6 @@ typedef void *(*FDecode)(const void *buf, void *dst); #define elePtrAt(base, size, idx) (void *)((char *)(base) + (size) * (idx)) typedef int32_t (*__ext_compar_fn_t)(const void *p1, const void *p2, const void *param); -typedef void (*__ext_swap_fn_t)(void *p1, void *p2, const void *param); /** * quick sort, with the compare function requiring additional parameters support diff --git a/include/util/tarray.h b/include/util/tarray.h index 0632db3103..beebd70dea 100644 --- a/include/util/tarray.h +++ b/include/util/tarray.h @@ -205,13 +205,7 @@ SArray* taosArrayFromList(const void* src, size_t size, size_t elemSize); * clone a new array * @param pSrc */ -SArray* taosArrayDup(const SArray* pSrc); - -/** - * deep copy a new array - * @param pSrc - */ -SArray* taosArrayDeepCopy(const SArray* pSrc, FCopy deepCopy); +SArray* taosArrayDup(const SArray* pSrc, __array_item_dup_fn_t fn); /** * clear the array (remove all element) diff --git a/source/client/src/clientImpl.c b/source/client/src/clientImpl.c index c3140371c4..7054fc1731 100644 --- a/source/client/src/clientImpl.c +++ b/source/client/src/clientImpl.c @@ -373,7 +373,7 @@ int32_t updateQnodeList(SAppInstInfo* pInfo, SArray* pNodeList) { } if (pNodeList) { - pInfo->pQnodeList = taosArrayDup(pNodeList); + pInfo->pQnodeList = taosArrayDup(pNodeList, NULL); taosArraySort(pInfo->pQnodeList, compareQueryNodeLoad); tscDebug("QnodeList updated in cluster 0x%" PRIx64 ", num:%ld", pInfo->clusterId, taosArrayGetSize(pInfo->pQnodeList)); @@ -404,7 +404,7 @@ int32_t getQnodeList(SRequestObj* pRequest, SArray** pNodeList) { taosThreadMutexLock(&pInfo->qnodeMutex); if (pInfo->pQnodeList) { - *pNodeList = taosArrayDup(pInfo->pQnodeList); + *pNodeList = taosArrayDup(pInfo->pQnodeList, NULL); } taosThreadMutexUnlock(&pInfo->qnodeMutex); @@ -593,13 +593,13 @@ int32_t buildAsyncExecNodeList(SRequestObj* pRequest, SArray** pNodeList, SArray if (pRes->code) { pQnodeList = NULL; } else { - pQnodeList = taosArrayDup((SArray*)pRes->pRes); + pQnodeList = taosArrayDup((SArray*)pRes->pRes, NULL); } } else { SAppInstInfo* pInst = pRequest->pTscObj->pAppInfo; taosThreadMutexLock(&pInst->qnodeMutex); if (pInst->pQnodeList) { - pQnodeList = taosArrayDup(pInst->pQnodeList); + pQnodeList = taosArrayDup(pInst->pQnodeList, NULL); } taosThreadMutexUnlock(&pInst->qnodeMutex); } diff --git a/source/dnode/mgmt/node_util/src/dmEps.c b/source/dnode/mgmt/node_util/src/dmEps.c index 4bc2e64fad..2ced9a350d 100644 --- a/source/dnode/mgmt/node_util/src/dmEps.c +++ b/source/dnode/mgmt/node_util/src/dmEps.c @@ -248,7 +248,7 @@ void dmUpdateEps(SDnodeData *pData, SArray *eps) { static void dmResetEps(SDnodeData *pData, SArray *dnodeEps) { if (pData->dnodeEps != dnodeEps) { SArray *tmp = pData->dnodeEps; - pData->dnodeEps = taosArrayDup(dnodeEps); + pData->dnodeEps = taosArrayDup(dnodeEps, NULL); taosArrayDestroy(tmp); } diff --git a/source/dnode/mnode/impl/src/mndDb.c b/source/dnode/mnode/impl/src/mndDb.c index 78d84c9c25..23f06a88f4 100644 --- a/source/dnode/mnode/impl/src/mndDb.c +++ b/source/dnode/mnode/impl/src/mndDb.c @@ -810,7 +810,7 @@ static int32_t mndProcessAlterDbReq(SRpcMsg *pReq) { memcpy(&dbObj, pDb, sizeof(SDbObj)); if (dbObj.cfg.pRetensions != NULL) { - dbObj.cfg.pRetensions = taosArrayDup(pDb->cfg.pRetensions); + dbObj.cfg.pRetensions = taosArrayDup(pDb->cfg.pRetensions, NULL); if (dbObj.cfg.pRetensions == NULL) goto _OVER; } diff --git a/source/dnode/mnode/impl/src/mndDef.c b/source/dnode/mnode/impl/src/mndDef.c index 143131bac8..2e984212a1 100644 --- a/source/dnode/mnode/impl/src/mndDef.c +++ b/source/dnode/mnode/impl/src/mndDef.c @@ -361,7 +361,7 @@ SMqConsumerEp *tCloneSMqConsumerEp(const SMqConsumerEp *pConsumerEpOld) { SMqConsumerEp *pConsumerEpNew = taosMemoryMalloc(sizeof(SMqConsumerEp)); if (pConsumerEpNew == NULL) return NULL; pConsumerEpNew->consumerId = pConsumerEpOld->consumerId; - pConsumerEpNew->vgs = taosArrayDeepCopy(pConsumerEpOld->vgs, (FCopy)tCloneSMqVgEp); + pConsumerEpNew->vgs = taosArrayDup(pConsumerEpOld->vgs, (__array_item_dup_fn_t)tCloneSMqVgEp); return pConsumerEpNew; } @@ -440,11 +440,11 @@ SMqSubscribeObj *tCloneSubscribeObj(const SMqSubscribeObj *pSub) { pConsumerEp = (SMqConsumerEp *)pIter; SMqConsumerEp newEp = { .consumerId = pConsumerEp->consumerId, - .vgs = taosArrayDeepCopy(pConsumerEp->vgs, (FCopy)tCloneSMqVgEp), + .vgs = taosArrayDup(pConsumerEp->vgs, (__array_item_dup_fn_t)tCloneSMqVgEp), }; taosHashPut(pSubNew->consumerHash, &newEp.consumerId, sizeof(int64_t), &newEp, sizeof(SMqConsumerEp)); } - pSubNew->unassignedVgs = taosArrayDeepCopy(pSub->unassignedVgs, (FCopy)tCloneSMqVgEp); + pSubNew->unassignedVgs = taosArrayDup(pSub->unassignedVgs, (__array_item_dup_fn_t)tCloneSMqVgEp); memcpy(pSubNew->dbName, pSub->dbName, TSDB_DB_FNAME_LEN); return pSubNew; } @@ -516,7 +516,7 @@ SMqSubActionLogEntry *tCloneSMqSubActionLogEntry(SMqSubActionLogEntry *pEntry) { SMqSubActionLogEntry *pEntryNew = taosMemoryMalloc(sizeof(SMqSubActionLogEntry)); if (pEntryNew == NULL) return NULL; pEntryNew->epoch = pEntry->epoch; - pEntryNew->consumers = taosArrayDeepCopy(pEntry->consumers, (FCopy)tCloneSMqConsumerEp); + pEntryNew->consumers = taosArrayDup(pEntry->consumers, (__array_item_dup_fn_t)tCloneSMqConsumerEp); return pEntryNew; } @@ -541,7 +541,7 @@ SMqSubActionLogObj *tCloneSMqSubActionLogObj(SMqSubActionLogObj *pLog) { SMqSubActionLogObj *pLogNew = taosMemoryMalloc(sizeof(SMqSubActionLogObj)); if (pLogNew == NULL) return pLogNew; memcpy(pLogNew->key, pLog->key, TSDB_SUBSCRIBE_KEY_LEN); - pLogNew->logs = taosArrayDeepCopy(pLog->logs, (FCopy)tCloneSMqConsumerEp); + pLogNew->logs = taosArrayDup(pLog->logs, (__array_item_dup_fn_t)tCloneSMqConsumerEp); return pLogNew; } diff --git a/source/dnode/mnode/impl/src/mndStb.c b/source/dnode/mnode/impl/src/mndStb.c index 5e16397b14..6dad7d74c8 100644 --- a/source/dnode/mnode/impl/src/mndStb.c +++ b/source/dnode/mnode/impl/src/mndStb.c @@ -1684,7 +1684,7 @@ static int32_t mndBuildStbCfgImp(SDbObj *pDb, SStbObj *pStb, const char *tbName, } if (pStb->numOfFuncs > 0) { - pRsp->pFuncs = taosArrayDup(pStb->pFuncs); + pRsp->pFuncs = taosArrayDup(pStb->pFuncs, NULL); } taosRUnLockLatch(&pStb->lock); diff --git a/source/libs/catalog/src/ctgUtil.c b/source/libs/catalog/src/ctgUtil.c index 3d21bbbcd9..f795be3ac2 100644 --- a/source/libs/catalog/src/ctgUtil.c +++ b/source/libs/catalog/src/ctgUtil.c @@ -1188,7 +1188,7 @@ SName* ctgGetFetchName(SArray* pNames, SCtgFetch* pFetch) { return (SName*)taosArrayGet(pReq->pTables, pFetch->tbIdx); } -static void* ctgCloneDbVgroup(void* pSrc) { return taosArrayDup((const SArray*)pSrc); } +static void* ctgCloneDbVgroup(void* pSrc) { return taosArrayDup((const SArray*)pSrc, NULL); } static void ctgFreeDbVgroup(void* p) { taosArrayDestroy((SArray*)((SMetaRes*)p)->pRes); } @@ -1238,7 +1238,7 @@ static void* ctgCloneVgroupInfo(void* pSrc) { static void ctgFreeVgroupInfo(void* p) { taosMemoryFree(((SMetaRes*)p)->pRes); } -static void* ctgCloneTableIndices(void* pSrc) { return taosArrayDup((const SArray*)pSrc); } +static void* ctgCloneTableIndices(void* pSrc) { return taosArrayDup((const SArray*)pSrc, NULL); } static void ctgFreeTableIndices(void* p) { taosArrayDestroy((SArray*)((SMetaRes*)p)->pRes); } @@ -1275,7 +1275,7 @@ static void* ctgCloneUserAuth(void* pSrc) { static void ctgFreeUserAuth(void* p) { taosMemoryFree(((SMetaRes*)p)->pRes); } -static void* ctgCloneQnodeList(void* pSrc) { return taosArrayDup((const SArray*)pSrc); } +static void* ctgCloneQnodeList(void* pSrc) { return taosArrayDup((const SArray*)pSrc, NULL); } static void ctgFreeQnodeList(void* p) { taosArrayDestroy((SArray*)((SMetaRes*)p)->pRes); } @@ -1290,11 +1290,11 @@ static void* ctgCloneTableCfg(void* pSrc) { static void ctgFreeTableCfg(void* p) { taosMemoryFree(((SMetaRes*)p)->pRes); } -static void* ctgCloneDnodeList(void* pSrc) { return taosArrayDup((const SArray*)pSrc); } +static void* ctgCloneDnodeList(void* pSrc) { return taosArrayDup((const SArray*)pSrc, NULL); } static void ctgFreeDnodeList(void* p) { taosArrayDestroy((SArray*)((SMetaRes*)p)->pRes); } -static int32_t ctgCloneMetaDataArray(SArray* pSrc, FCopy copyFunc, SArray** pDst) { +static int32_t ctgCloneMetaDataArray(SArray* pSrc, __array_item_dup_fn_t copyFunc, SArray** pDst) { if (NULL == pSrc) { return TSDB_CODE_SUCCESS; } diff --git a/source/libs/executor/src/executorimpl.c b/source/libs/executor/src/executorimpl.c index 514236159d..300ba52934 100644 --- a/source/libs/executor/src/executorimpl.c +++ b/source/libs/executor/src/executorimpl.c @@ -2355,10 +2355,12 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo return NULL; } - for (int32_t i = 0; i < tableListGetSize(pTableListInfo); ++i) { + size_t num = taosArrayGetSize(pList); + for (int32_t i = 0; i < num; ++i) { STableKeyInfo* p = taosArrayGet(pList, i); tableListAddTableInfo(pTableListInfo, p->uid, 0); } + taosArrayDestroy(pList); } else { // Create group with only one table tableListAddTableInfo(pTableListInfo, pBlockNode->uid, 0); diff --git a/source/libs/monitor/src/monMain.c b/source/libs/monitor/src/monMain.c index 70792ee611..b3ca0fa452 100644 --- a/source/libs/monitor/src/monMain.c +++ b/source/libs/monitor/src/monMain.c @@ -36,7 +36,7 @@ void monRecordLog(int64_t ts, ELogLevel level, const char *content) { int32_t monGetLogs(SMonLogs *logs) { taosThreadMutexLock(&tsMonitor.lock); - logs->logs = taosArrayDup(tsMonitor.logs); + logs->logs = taosArrayDup(tsMonitor.logs, NULL); logs->numOfInfoLogs = tsNumOfInfoLogs; logs->numOfErrorLogs = tsNumOfErrorLogs; logs->numOfDebugLogs = tsNumOfDebugLogs; diff --git a/source/libs/parser/src/parCalcConst.c b/source/libs/parser/src/parCalcConst.c index efc9d77e67..6cee06ea0e 100644 --- a/source/libs/parser/src/parCalcConst.c +++ b/source/libs/parser/src/parCalcConst.c @@ -169,7 +169,7 @@ static int32_t calcConstStmtCondition(SCalcConstContext* pCxt, SNode** pCond, bo static int32_t calcConstProject(SNode* pProject, bool dual, SNode** pNew) { SArray* pAssociation = NULL; if (NULL != ((SExprNode*)pProject)->pAssociation) { - pAssociation = taosArrayDup(((SExprNode*)pProject)->pAssociation); + pAssociation = taosArrayDup(((SExprNode*)pProject)->pAssociation, NULL); if (NULL == pAssociation) { return TSDB_CODE_OUT_OF_MEMORY; } diff --git a/source/libs/parser/src/parInsertUtil.c b/source/libs/parser/src/parInsertUtil.c index 5f8120171f..730dc2eab9 100644 --- a/source/libs/parser/src/parInsertUtil.c +++ b/source/libs/parser/src/parInsertUtil.c @@ -857,7 +857,7 @@ void insBuildCreateTbReq(SVCreateTbReq* pTbReq, const char* tname, STag* pTag, i pTbReq->ctb.tagNum = tagNum; if (sname) pTbReq->ctb.stbName = strdup(sname); pTbReq->ctb.pTag = (uint8_t*)pTag; - pTbReq->ctb.tagName = taosArrayDup(tagName); + pTbReq->ctb.tagName = taosArrayDup(tagName, NULL); pTbReq->ttl = TSDB_DEFAULT_TABLE_TTL; pTbReq->commentLen = -1; diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index 0743b40662..9632c097b7 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -6625,7 +6625,7 @@ static void addCreateTbReqIntoVgroup(int32_t acctId, SHashObj* pVgroupHashmap, S req.ctb.tagNum = tagNum; req.ctb.stbName = strdup(sTableNmae); req.ctb.pTag = (uint8_t*)pTag; - req.ctb.tagName = taosArrayDup(tagName); + req.ctb.tagName = taosArrayDup(tagName, NULL); if (pStmt->ignoreExists) { req.flags |= TD_CREATE_IF_NOT_EXISTS; } diff --git a/source/libs/parser/src/parUtil.c b/source/libs/parser/src/parUtil.c index e8c3f2fa8d..7a56b0e0fa 100644 --- a/source/libs/parser/src/parUtil.c +++ b/source/libs/parser/src/parUtil.c @@ -844,7 +844,7 @@ int32_t getDbVgInfoFromCache(SParseMetaCache* pMetaCache, const char* pDbFName, int32_t code = getMetaDataFromHash(pDbFName, strlen(pDbFName), pMetaCache->pDbVgroup, (void**)&pVgList); // pVgList is null, which is a legal value, indicating that the user DB has not been created if (TSDB_CODE_SUCCESS == code && NULL != pVgList) { - *pVgInfo = taosArrayDup(pVgList); + *pVgInfo = taosArrayDup(pVgList, NULL); if (NULL == *pVgInfo) { code = TSDB_CODE_OUT_OF_MEMORY; } @@ -961,7 +961,7 @@ int32_t getUdfInfoFromCache(SParseMetaCache* pMetaCache, const char* pFunc, SFun static void destroySmaIndex(void* p) { taosMemoryFree(((STableIndexInfo*)p)->expr); } static SArray* smaIndexesDup(SArray* pSrc) { - SArray* pDst = taosArrayDup(pSrc); + SArray* pDst = taosArrayDup(pSrc, NULL); if (NULL == pDst) { return NULL; } @@ -1011,7 +1011,7 @@ STableCfg* tableCfgDup(STableCfg* pCfg) { memcpy(pNew->pComment, pCfg->pComment, pNew->commentLen); } if (NULL != pNew->pFuncs) { - pNew->pFuncs = taosArrayDup(pNew->pFuncs); + pNew->pFuncs = taosArrayDup(pNew->pFuncs, NULL); } if (NULL != pNew->pTags) { pNew->pTags = taosMemoryCalloc(pNew->tagsLen + 1, 1); @@ -1053,7 +1053,7 @@ int32_t getDnodeListFromCache(SParseMetaCache* pMetaCache, SArray** pDnodes) { return pRes->code; } - *pDnodes = taosArrayDup((SArray*)pRes->pRes); + *pDnodes = taosArrayDup((SArray*)pRes->pRes, NULL); if (NULL == *pDnodes) { return TSDB_CODE_OUT_OF_MEMORY; } diff --git a/source/libs/scheduler/src/schJob.c b/source/libs/scheduler/src/schJob.c index 8fcfdce2b2..0eb29a3667 100644 --- a/source/libs/scheduler/src/schJob.c +++ b/source/libs/scheduler/src/schJob.c @@ -721,7 +721,7 @@ int32_t schInitJob(int64_t *pJobId, SSchedulerReq *pReq) { if (pReq->pNodeList == NULL || taosArrayGetSize(pReq->pNodeList) <= 0) { qDebug("QID:0x%" PRIx64 " input exec nodeList is empty", pReq->pDag->queryId); } else { - pJob->nodeList = taosArrayDup(pReq->pNodeList); + pJob->nodeList = taosArrayDup(pReq->pNodeList, NULL); } pJob->taskList = taosHashInit(pReq->pDag->numOfSubplans, taosGetDefaultHashFunction(TSDB_DATA_TYPE_UBIGINT), false, diff --git a/source/util/src/tarray.c b/source/util/src/tarray.c index bcf9a77950..0c5b311ab3 100644 --- a/source/util/src/tarray.c +++ b/source/util/src/tarray.c @@ -302,7 +302,7 @@ SArray* taosArrayFromList(const void* src, size_t size, size_t elemSize) { return pDst; } -SArray* taosArrayDup(const SArray* pSrc) { +SArray* taosArrayDup(const SArray* pSrc, __array_item_dup_fn_t fn) { assert(pSrc != NULL); if (pSrc->size == 0) { // empty array list @@ -311,8 +311,19 @@ SArray* taosArrayDup(const SArray* pSrc) { SArray* dst = taosArrayInit(pSrc->size, pSrc->elemSize); - memcpy(dst->pData, pSrc->pData, pSrc->elemSize * pSrc->size); + if (fn == NULL) { + memcpy(dst->pData, pSrc->pData, pSrc->elemSize * pSrc->size); + } else { + ASSERT(pSrc->elemSize == sizeof(void*)); + + for(int32_t i = 0; i < pSrc->size; ++i) { + void* p = fn(taosArrayGetP(pSrc, i)); + memcpy(dst->pData + i * dst->elemSize, &p, dst->elemSize); + } + } + dst->size = pSrc->size; + return dst; } @@ -464,19 +475,6 @@ static void taosArrayInsertSort(SArray* pArray, __ext_compar_fn_t fn, const void return; } -SArray* taosArrayDeepCopy(const SArray* pSrc, FCopy deepCopy) { - if (NULL == pSrc) { - return NULL; - } - ASSERT(pSrc->elemSize == sizeof(void*)); - SArray* pArray = taosArrayInit(pSrc->size, sizeof(void*)); - for (int32_t i = 0; i < pSrc->size; i++) { - void* clone = deepCopy(taosArrayGetP(pSrc, i)); - taosArrayPush(pArray, &clone); - } - return pArray; -} - int32_t taosEncodeArray(void** buf, const SArray* pArray, FEncode encode) { int32_t tlen = 0; int32_t sz = pArray->size; From 90ae53211fbf1a59e06f9ed41bc3ee848c92258a Mon Sep 17 00:00:00 2001 From: chenhaoran Date: Mon, 28 Nov 2022 16:50:47 +0800 Subject: [PATCH 05/27] test:add testcase of win ci --- tests/system-test/simpletest.bat | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/system-test/simpletest.bat b/tests/system-test/simpletest.bat index cc4ae17955..0365567698 100644 --- a/tests/system-test/simpletest.bat +++ b/tests/system-test/simpletest.bat @@ -7,12 +7,12 @@ python3 .\test.py -f 0-others\taosdMonitor.py @REM python3 .\test.py -f 0-others\udfTest.py @REM python3 .\test.py -f 0-others\udf_create.py @REM python3 .\test.py -f 0-others\udf_restart_taosd.py -@REM python3 .\test.py -f 0-others\cachelast.py +python3 .\test.py -f 0-others\cachelast.py @REM python3 .\test.py -f 0-others\user_control.py @REM python3 .\test.py -f 0-others\fsync.py -@REM python3 .\test.py -f 1-insert\influxdb_line_taosc_insert.py +python3 .\test.py -f 1-insert\influxdb_line_taosc_insert.py @REM python3 .\test.py -f 1-insert\opentsdb_telnet_line_taosc_insert.py @REM python3 .\test.py -f 1-insert\opentsdb_json_taosc_insert.py @REM #python3 .\test.py -f 1-insert\test_stmt_muti_insert_query.py @@ -72,7 +72,7 @@ python3 .\test.py -f 0-others\taosdMonitor.py @REM python3 .\test.py -f 2-query\arcsin.py @REM python3 .\test.py -f 2-query\arccos.py @REM python3 .\test.py -f 2-query\arctan.py -@REM python3 .\test.py -f 2-query\query_cols_tags_and_or.py +python3 .\test.py -f 2-query\query_cols_tags_and_or.py @REM # python3 .\test.py -f 2-query\nestedQuery.py @REM # TD-15983 subquery output duplicate name column. @REM # Please Xiangyang Guo modify the following script @@ -94,7 +94,7 @@ python3 .\test.py -f 0-others\taosdMonitor.py @REM python3 .\test.py -f 7-tmq\subscribeDb.py @REM python3 .\test.py -f 7-tmq\subscribeDb0.py @REM python3 .\test.py -f 7-tmq\subscribeDb1.py -@REM python3 .\test.py -f 7-tmq\subscribeStb.py +python3 .\test.py -f 7-tmq\subscribeStb.py @REM python3 .\test.py -f 7-tmq\subscribeStb0.py @REM python3 .\test.py -f 7-tmq\subscribeStb1.py @REM python3 .\test.py -f 7-tmq\subscribeStb2.py From 232287a8b4172b8a99af12acb4ef34844734acd9 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Mon, 28 Nov 2022 17:43:22 +0800 Subject: [PATCH 06/27] refact: adjust mnode log --- source/dnode/mnode/impl/src/mndDb.c | 4 ++-- source/dnode/mnode/impl/src/mndMain.c | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/source/dnode/mnode/impl/src/mndDb.c b/source/dnode/mnode/impl/src/mndDb.c index 78d84c9c25..540ca1dc74 100644 --- a/source/dnode/mnode/impl/src/mndDb.c +++ b/source/dnode/mnode/impl/src/mndDb.c @@ -219,12 +219,12 @@ static SSdbRow *mndDbActionDecode(SSdbRaw *pRaw) { SDB_GET_RESERVE(pRaw, dataPos, DB_RESERVE_SIZE, _OVER) taosInitRWLatch(&pDb->lock); - if (pDb->cfg.tsdbPageSize <= TSDB_MIN_TSDB_PAGESIZE) { + if (pDb->cfg.tsdbPageSize != TSDB_MIN_TSDB_PAGESIZE) { mInfo("db:%s, tsdbPageSize set from %d to default %d", pDb->name, pDb->cfg.tsdbPageSize, TSDB_DEFAULT_TSDB_PAGESIZE); } - if (pDb->cfg.sstTrigger <= TSDB_MIN_STT_TRIGGER) { + if (pDb->cfg.sstTrigger != TSDB_MIN_STT_TRIGGER) { mInfo("db:%s, sstTrigger set from %d to default %d", pDb->name, pDb->cfg.sstTrigger, TSDB_DEFAULT_SST_TRIGGER); } diff --git a/source/dnode/mnode/impl/src/mndMain.c b/source/dnode/mnode/impl/src/mndMain.c index b5ddd6f279..2d888d2ff7 100644 --- a/source/dnode/mnode/impl/src/mndMain.c +++ b/source/dnode/mnode/impl/src/mndMain.c @@ -803,12 +803,12 @@ void mndSetRestored(SMnode *pMnode, bool restored) { taosThreadRwlockWrlock(&pMnode->lock); pMnode->restored = true; taosThreadRwlockUnlock(&pMnode->lock); - mTrace("mnode set restored:%d", restored); + mInfo("mnode set restored:%d", restored); } else { taosThreadRwlockWrlock(&pMnode->lock); pMnode->restored = false; taosThreadRwlockUnlock(&pMnode->lock); - mTrace("mnode set restored:%d", restored); + mInfo("mnode set restored:%d", restored); while (1) { if (pMnode->rpcRef <= 0) break; taosMsleep(3); @@ -822,7 +822,7 @@ void mndSetStop(SMnode *pMnode) { taosThreadRwlockWrlock(&pMnode->lock); pMnode->stopped = true; taosThreadRwlockUnlock(&pMnode->lock); - mTrace("mnode set stopped"); + mInfo("mnode set stopped"); } bool mndGetStop(SMnode *pMnode) { return pMnode->stopped; } From 2bb59df74be05c7987cf095b5d051623160d0fa9 Mon Sep 17 00:00:00 2001 From: gccgdb1234 Date: Mon, 28 Nov 2022 17:47:49 +0800 Subject: [PATCH 07/27] fix compile --- source/libs/transport/src/transCli.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/libs/transport/src/transCli.c b/source/libs/transport/src/transCli.c index 2b54ce36f5..fa7c375ee3 100644 --- a/source/libs/transport/src/transCli.c +++ b/source/libs/transport/src/transCli.c @@ -653,10 +653,10 @@ static void cliRecvCb(uv_stream_t* handle, ssize_t nread, const uv_buf_t* buf) { static SCliConn* cliCreateConn(SCliThrd* pThrd) { SCliConn* conn = taosMemoryCalloc(1, sizeof(SCliConn)); // read/write stream handle - conn->stream = (uv_stream_t*)taosMemoryMalloc(sizeof(uv_stream_t)); + conn->stream = (uv_stream_t*)taosMemoryMalloc(sizeof(uv_tcp_t)); uv_tcp_init(pThrd->loop, (uv_tcp_t*)(conn->stream)); conn->stream->data = conn; - transSetConnOption((uv_tcp_t*)conn->stream); + //transSetConnOption((uv_tcp_t*)conn->stream); uv_timer_t* timer = taosArrayGetSize(pThrd->timerList) > 0 ? *(uv_timer_t**)taosArrayPop(pThrd->timerList) : NULL; if (timer == NULL) { From ab87a92f640ce302abe8501f0a973b9103ce58e6 Mon Sep 17 00:00:00 2001 From: chenhaoran Date: Mon, 28 Nov 2022 17:51:12 +0800 Subject: [PATCH 08/27] test:add win testcase in ci --- tests/system-test/simpletest.bat | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/system-test/simpletest.bat b/tests/system-test/simpletest.bat index 0365567698..5ae2d3feb3 100644 --- a/tests/system-test/simpletest.bat +++ b/tests/system-test/simpletest.bat @@ -7,7 +7,7 @@ python3 .\test.py -f 0-others\taosdMonitor.py @REM python3 .\test.py -f 0-others\udfTest.py @REM python3 .\test.py -f 0-others\udf_create.py @REM python3 .\test.py -f 0-others\udf_restart_taosd.py -python3 .\test.py -f 0-others\cachelast.py +python3 .\test.py -f 0-others\cachemodel.py @REM python3 .\test.py -f 0-others\user_control.py @REM python3 .\test.py -f 0-others\fsync.py From af06f93f4ed05c18b0f2118d298057f533922fab Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Mon, 28 Nov 2022 18:00:51 +0800 Subject: [PATCH 09/27] fix: deadlock while alter db replica --- source/dnode/mnode/impl/src/mndVgroup.c | 26 +++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/source/dnode/mnode/impl/src/mndVgroup.c b/source/dnode/mnode/impl/src/mndVgroup.c index b549ed1a68..6f4351f713 100644 --- a/source/dnode/mnode/impl/src/mndVgroup.c +++ b/source/dnode/mnode/impl/src/mndVgroup.c @@ -1084,10 +1084,10 @@ int32_t mndSetMoveVgroupInfoToTrans(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, if (!force) { mInfo("vgId:%d, will add 1 vnode", pVgroup->vgId); if (mndAddVnodeToVgroup(pMnode, &newVg, pArray) != 0) return -1; - if (mndAddCreateVnodeAction(pMnode, pTrans, pDb, &newVg, &newVg.vnodeGid[newVg.replica - 1]) != 0) return -1; for (int32_t i = 0; i < newVg.replica - 1; ++i) { if (mndAddAlterVnodeReplicaAction(pMnode, pTrans, pDb, &newVg, newVg.vnodeGid[i].dnodeId) != 0) return -1; } + if (mndAddCreateVnodeAction(pMnode, pTrans, pDb, &newVg, &newVg.vnodeGid[newVg.replica - 1]) != 0) return -1; if (mndAddAlterVnodeConfirmAction(pMnode, pTrans, pDb, &newVg) != 0) return -1; mInfo("vgId:%d, will remove 1 vnode", pVgroup->vgId); @@ -1108,12 +1108,12 @@ int32_t mndSetMoveVgroupInfoToTrans(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, newVg.vnodeGid[vnIndex] = newVg.vnodeGid[newVg.replica]; memset(&newVg.vnodeGid[newVg.replica], 0, sizeof(SVnodeGid)); - if (mndAddCreateVnodeAction(pMnode, pTrans, pDb, &newVg, &newVg.vnodeGid[vnIndex]) != 0) return -1; for (int32_t i = 0; i < newVg.replica; ++i) { if (i != vnIndex) { if (mndAddAlterVnodeReplicaAction(pMnode, pTrans, pDb, &newVg, newVg.vnodeGid[i].dnodeId) != 0) return -1; } } + if (mndAddCreateVnodeAction(pMnode, pTrans, pDb, &newVg, &newVg.vnodeGid[vnIndex]) != 0) return -1; if (mndAddAlterVnodeConfirmAction(pMnode, pTrans, pDb, &newVg) != 0) return -1; if (newVg.replica == 1) { @@ -1190,10 +1190,10 @@ static int32_t mndAddIncVgroupReplicaToTrans(SMnode *pMnode, STrans *pTrans, SDb pGid->dnodeId = newDnodeId; pGid->syncState = TAOS_SYNC_STATE_ERROR; - if (mndAddCreateVnodeAction(pMnode, pTrans, pDb, pVgroup, pGid) != 0) return -1; for (int32_t i = 0; i < pVgroup->replica - 1; ++i) { if (mndAddAlterVnodeReplicaAction(pMnode, pTrans, pDb, pVgroup, pVgroup->vnodeGid[i].dnodeId) != 0) return -1; } + if (mndAddCreateVnodeAction(pMnode, pTrans, pDb, pVgroup, pGid) != 0) return -1; if (mndAddAlterVnodeConfirmAction(pMnode, pTrans, pDb, pVgroup) != 0) return -1; return 0; @@ -1589,11 +1589,16 @@ int32_t mndBuildAlterVgroupAction(SMnode *pMnode, STrans *pTrans, SDbObj *pOldDb pVgroup->vnodeGid[0].dnodeId); if (mndAddVnodeToVgroup(pMnode, &newVgroup, pArray) != 0) return -1; - if (mndAddVnodeToVgroup(pMnode, &newVgroup, pArray) != 0) return -1; - if (mndAddCreateVnodeAction(pMnode, pTrans, pNewDb, &newVgroup, &newVgroup.vnodeGid[1]) != 0) return -1; if (mndAddAlterVnodeReplicaAction(pMnode, pTrans, pNewDb, &newVgroup, newVgroup.vnodeGid[0].dnodeId) != 0) return -1; + if (mndAddCreateVnodeAction(pMnode, pTrans, pNewDb, &newVgroup, &newVgroup.vnodeGid[1]) != 0) return -1; if (mndAddAlterVnodeConfirmAction(pMnode, pTrans, pNewDb, &newVgroup) != 0) return -1; + + if (mndAddVnodeToVgroup(pMnode, &newVgroup, pArray) != 0) return -1; + if (mndAddAlterVnodeReplicaAction(pMnode, pTrans, pNewDb, &newVgroup, newVgroup.vnodeGid[0].dnodeId) != 0) + return -1; + if (mndAddAlterVnodeReplicaAction(pMnode, pTrans, pNewDb, &newVgroup, newVgroup.vnodeGid[1].dnodeId) != 0) + return -1; if (mndAddCreateVnodeAction(pMnode, pTrans, pNewDb, &newVgroup, &newVgroup.vnodeGid[2]) != 0) return -1; if (mndAddAlterVnodeConfirmAction(pMnode, pTrans, pNewDb, &newVgroup) != 0) return -1; } else if (newVgroup.replica == 3 && pNewDb->cfg.replications == 1) { @@ -1603,9 +1608,14 @@ int32_t mndBuildAlterVgroupAction(SMnode *pMnode, STrans *pTrans, SDbObj *pOldDb SVnodeGid del1 = {0}; SVnodeGid del2 = {0}; if (mndRemoveVnodeFromVgroup(pMnode, &newVgroup, pArray, &del1) != 0) return -1; - if (mndRemoveVnodeFromVgroup(pMnode, &newVgroup, pArray, &del2) != 0) return -1; if (mndAddDropVnodeAction(pMnode, pTrans, pNewDb, &newVgroup, &del1, true) != 0) return -1; + if (mndAddAlterVnodeReplicaAction(pMnode, pTrans, pNewDb, &newVgroup, newVgroup.vnodeGid[0].dnodeId) != 0) + return -1; + if (mndAddAlterVnodeReplicaAction(pMnode, pTrans, pNewDb, &newVgroup, newVgroup.vnodeGid[1].dnodeId) != 0) + return -1; if (mndAddAlterVnodeConfirmAction(pMnode, pTrans, pNewDb, &newVgroup) != 0) return -1; + + if (mndRemoveVnodeFromVgroup(pMnode, &newVgroup, pArray, &del2) != 0) return -1; if (mndAddDropVnodeAction(pMnode, pTrans, pNewDb, &newVgroup, &del2, true) != 0) return -1; if (mndAddAlterVnodeReplicaAction(pMnode, pTrans, pNewDb, &newVgroup, newVgroup.vnodeGid[0].dnodeId) != 0) return -1; @@ -1662,15 +1672,15 @@ static int32_t mndSplitVgroup(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pDb, SVgObj if (newVg1.replica == 1) { if (mndAddVnodeToVgroup(pMnode, &newVg1, pArray) != 0) goto _OVER; - if (mndAddCreateVnodeAction(pMnode, pTrans, pDb, &newVg1, &newVg1.vnodeGid[1]) != 0) goto _OVER; if (mndAddAlterVnodeReplicaAction(pMnode, pTrans, pDb, &newVg1, newVg1.vnodeGid[0].dnodeId) != 0) goto _OVER; + if (mndAddCreateVnodeAction(pMnode, pTrans, pDb, &newVg1, &newVg1.vnodeGid[1]) != 0) goto _OVER; if (mndAddAlterVnodeConfirmAction(pMnode, pTrans, pDb, &newVg1) != 0) goto _OVER; } else if (newVg1.replica == 3) { SVnodeGid del1 = {0}; if (mndRemoveVnodeFromVgroup(pMnode, &newVg1, pArray, &del1) != 0) goto _OVER; + if (mndAddDropVnodeAction(pMnode, pTrans, pDb, &newVg1, &del1, true) != 0) goto _OVER; if (mndAddAlterVnodeReplicaAction(pMnode, pTrans, pDb, &newVg1, newVg1.vnodeGid[0].dnodeId) != 0) goto _OVER; if (mndAddAlterVnodeReplicaAction(pMnode, pTrans, pDb, &newVg1, newVg1.vnodeGid[1].dnodeId) != 0) goto _OVER; - if (mndAddDropVnodeAction(pMnode, pTrans, pDb, &newVg1, &del1, true) != 0) goto _OVER; if (mndAddAlterVnodeConfirmAction(pMnode, pTrans, pDb, &newVg1) != 0) goto _OVER; } else { goto _OVER; From 25889595d8461b92a162b5310cae71bd53734d55 Mon Sep 17 00:00:00 2001 From: gccgdb1234 Date: Mon, 28 Nov 2022 18:01:15 +0800 Subject: [PATCH 10/27] fix compile --- source/libs/transport/src/transCli.c | 2 +- source/libs/transport/src/transSvr.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/source/libs/transport/src/transCli.c b/source/libs/transport/src/transCli.c index fa7c375ee3..a0619def53 100644 --- a/source/libs/transport/src/transCli.c +++ b/source/libs/transport/src/transCli.c @@ -1183,7 +1183,7 @@ bool cliRecvReleaseReq(SCliConn* conn, STransMsgHead* pHead) { static void* cliWorkThread(void* arg) { SCliThrd* pThrd = (SCliThrd*)arg; pThrd->pid = taosGetSelfPthreadId(); - setThreadName("trans-cli-worker"); + setThreadName("trans-cli-work"); uv_run(pThrd->loop, UV_RUN_DEFAULT); tDebug("thread quit-thread:%08" PRId64, pThrd->pid); diff --git a/source/libs/transport/src/transSvr.c b/source/libs/transport/src/transSvr.c index f93eb436a5..395e28d68f 100644 --- a/source/libs/transport/src/transSvr.c +++ b/source/libs/transport/src/transSvr.c @@ -846,7 +846,7 @@ static bool addHandleToAcceptloop(void* arg) { return true; } void* transWorkerThread(void* arg) { - setThreadName("trans-svr-worker"); + setThreadName("trans-svr-work"); SWorkThrd* pThrd = (SWorkThrd*)arg; uv_run(pThrd->loop, UV_RUN_DEFAULT); From 99604f8010b3fc9769421fa3a11c1fb3c003ebe4 Mon Sep 17 00:00:00 2001 From: Ganlin Zhao Date: Mon, 28 Nov 2022 18:06:34 +0800 Subject: [PATCH 11/27] fix: [ASAN] stack buffer overflow --- source/libs/function/src/builtinsimpl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/libs/function/src/builtinsimpl.c b/source/libs/function/src/builtinsimpl.c index e572ce7a40..08e1549501 100644 --- a/source/libs/function/src/builtinsimpl.c +++ b/source/libs/function/src/builtinsimpl.c @@ -1499,7 +1499,7 @@ int32_t leastSQRFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) { param12 /= param[1][1]; - char buf[64] = {0}; + char buf[512] = {0}; size_t len = snprintf(varDataVal(buf), sizeof(buf) - VARSTR_HEADER_SIZE, "{slop:%.6lf, intercept:%.6lf}", param02, param12); varDataSetLen(buf, len); From bab891eef776556445fd4ffde743186661f1598d Mon Sep 17 00:00:00 2001 From: Ganlin Zhao Date: Mon, 28 Nov 2022 18:14:47 +0800 Subject: [PATCH 12/27] fix coverity scan issue CID:402965 --- source/libs/function/src/builtinsimpl.c | 1 + 1 file changed, 1 insertion(+) diff --git a/source/libs/function/src/builtinsimpl.c b/source/libs/function/src/builtinsimpl.c index 08e1549501..8c20a2c72b 100644 --- a/source/libs/function/src/builtinsimpl.c +++ b/source/libs/function/src/builtinsimpl.c @@ -3613,6 +3613,7 @@ bool histogramFunctionSetup(SqlFunctionCtx* pCtx, SResultRowEntryInfo* pResultIn char* binDesc = strndup(varDataVal(pCtx->param[2].param.pz), varDataLen(pCtx->param[2].param.pz)); int64_t normalized = pCtx->param[3].param.i; if (normalized != 0 && normalized != 1) { + taosMemoryFree(binDesc); return false; } if (!getHistogramBinDesc(pInfo, binDesc, binType, (bool)normalized)) { From ab40b8190ffeeb55dfcefd05a10cf443b65d6173 Mon Sep 17 00:00:00 2001 From: Minghao Li Date: Mon, 28 Nov 2022 18:21:46 +0800 Subject: [PATCH 13/27] fix(sync): fix asan error, TD-20801 --- source/libs/sync/src/syncMain.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/source/libs/sync/src/syncMain.c b/source/libs/sync/src/syncMain.c index d0fe16aaaa..202ca72413 100644 --- a/source/libs/sync/src/syncMain.c +++ b/source/libs/sync/src/syncMain.c @@ -1158,7 +1158,7 @@ int32_t syncNodeStartElectTimer(SSyncNode* pSyncNode, int32_t ms) { pSyncNode->electTimerParam.pSyncNode = pSyncNode; pSyncNode->electTimerParam.pData = NULL; - taosTmrReset(pSyncNode->FpElectTimerCB, pSyncNode->electTimerMS, pSyncNode, syncEnv()->pTimerManager, + taosTmrReset(pSyncNode->FpElectTimerCB, pSyncNode->electTimerMS, (void*)(pSyncNode->rid), syncEnv()->pTimerManager, &pSyncNode->pElectTimer); } else { @@ -1916,13 +1916,21 @@ static void syncNodeEqPingTimer(void* param, void* tmrId) { static void syncNodeEqElectTimer(void* param, void* tmrId) { if (!syncIsInit()) return; - SSyncNode* pNode = (SSyncNode*)param; + int64_t rid = (int64_t)param; + SSyncNode* pNode = syncNodeAcquire(rid); if (pNode == NULL) return; - if (pNode->syncEqMsg == NULL) return; + + if (pNode->syncEqMsg == NULL) { + syncNodeRelease(pNode); + return; + } int64_t tsNow = taosGetTimestampMs(); - if (tsNow < pNode->electTimerParam.executeTime) return; + if (tsNow < pNode->electTimerParam.executeTime) { + syncNodeRelease(pNode); + return; + } SRpcMsg rpcMsg = {0}; int32_t code = @@ -1930,7 +1938,7 @@ static void syncNodeEqElectTimer(void* param, void* tmrId) { if (code != 0) { sError("failed to build elect msg"); - + syncNodeRelease(pNode); return; } @@ -1941,9 +1949,11 @@ static void syncNodeEqElectTimer(void* param, void* tmrId) { if (code != 0) { sError("failed to sync enqueue elect msg since %s", terrstr()); rpcFreeCont(rpcMsg.pCont); - + syncNodeRelease(pNode); return; } + + syncNodeRelease(pNode); } static void syncNodeEqHeartbeatTimer(void* param, void* tmrId) { From a2ac7bc2ba6f941a0aa7b990638ab53282100130 Mon Sep 17 00:00:00 2001 From: xinsheng Ren <285808407@qq.com> Date: Mon, 28 Nov 2022 18:30:06 +0800 Subject: [PATCH 14/27] fix:installer,The installation cannot be completed on the mac (#18512) Co-authored-by: facetosea <25808407@qq.com> --- packaging/tools/post.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packaging/tools/post.sh b/packaging/tools/post.sh index 37307f0543..482345dcd8 100755 --- a/packaging/tools/post.sh +++ b/packaging/tools/post.sh @@ -205,6 +205,7 @@ function set_hostname() { break else read -p "Please enter one hostname(must not be 'localhost'):" newHostname + break fi done @@ -324,7 +325,9 @@ function local_fqdn_check() { ;; *) + set_ipAsFqdn echo "Invalid input..." + break ;; esac fi From 90c1e7347f7f5ecb5fa4438279b88ae0f6469aa6 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Mon, 28 Nov 2022 18:42:39 +0800 Subject: [PATCH 15/27] refactor: do some internal refactor. --- source/libs/scalar/src/sclvector.c | 92 ++++++++++++++++++------------ 1 file changed, 57 insertions(+), 35 deletions(-) diff --git a/source/libs/scalar/src/sclvector.c b/source/libs/scalar/src/sclvector.c index 95d22044d7..040f331ba4 100644 --- a/source/libs/scalar/src/sclvector.c +++ b/source/libs/scalar/src/sclvector.c @@ -1543,51 +1543,73 @@ void vectorBitOr(SScalarParam *pLeft, SScalarParam *pRight, SScalarParam *pOut, int32_t doVectorCompareImpl(SScalarParam *pLeft, SScalarParam *pRight, SScalarParam *pOut, int32_t startIndex, int32_t numOfRows, int32_t step, __compar_fn_t fp, int32_t optr) { int32_t num = 0; + bool * pRes = (bool *)pOut->columnData; - for (int32_t i = startIndex; i < numOfRows && i >= 0; i += step) { - int32_t leftIndex = (i >= pLeft->numOfRows) ? 0 : i; - int32_t rightIndex = (i >= pRight->numOfRows) ? 0 : i; + if (GET_PARAM_TYPE(pLeft) != TSDB_DATA_TYPE_JSON && GET_PARAM_TYPE(pRight) != TSDB_DATA_TYPE_JSON) { + for (int32_t i = startIndex; i < numOfRows && i >= startIndex; i += step) { + int32_t leftIndex = (i >= pLeft->numOfRows) ? 0 : i; + int32_t rightIndex = (i >= pRight->numOfRows) ? 0 : i; - if (IS_HELPER_NULL(pLeft->columnData, leftIndex) || IS_HELPER_NULL(pRight->columnData, rightIndex)) { - bool res = false; - colDataAppendInt8(pOut->columnData, i, (int8_t *)&res); - continue; - } + if (IS_HELPER_NULL(pLeft->columnData, leftIndex) || IS_HELPER_NULL(pRight->columnData, rightIndex)) { + bool res = false; + colDataAppendInt8(pOut->columnData, i, (int8_t *)&res); + continue; + } - char *pLeftData = colDataGetData(pLeft->columnData, leftIndex); - char *pRightData = colDataGetData(pRight->columnData, rightIndex); - int64_t leftOut = 0; - int64_t rightOut = 0; - bool freeLeft = false; - bool freeRight = false; - bool isJsonnull = false; + char * pLeftData = colDataGetData(pLeft->columnData, leftIndex); + char * pRightData = colDataGetData(pRight->columnData, rightIndex); + int64_t leftOut = 0; + int64_t rightOut = 0; + bool freeLeft = false; + bool freeRight = false; + bool isJsonnull = false; - bool result = convertJsonValue(&fp, optr, GET_PARAM_TYPE(pLeft), GET_PARAM_TYPE(pRight), &pLeftData, &pRightData, - &leftOut, &rightOut, &isJsonnull, &freeLeft, &freeRight); - if (isJsonnull) { - ASSERT(0); - } + bool result = convertJsonValue(&fp, optr, GET_PARAM_TYPE(pLeft), GET_PARAM_TYPE(pRight), &pLeftData, &pRightData, + &leftOut, &rightOut, &isJsonnull, &freeLeft, &freeRight); + if (isJsonnull) { + ASSERT(0); + } - if (!pLeftData || !pRightData) { - result = false; - } + if (!pLeftData || !pRightData) { + result = false; + } - if (!result) { - colDataAppendInt8(pOut->columnData, i, (int8_t *)&result); - } else { - bool res = filterDoCompare(fp, optr, pLeftData, pRightData); - colDataAppendInt8(pOut->columnData, i, (int8_t *)&res); - if (res) { - ++num; + if (!result) { + colDataAppendInt8(pOut->columnData, i, (int8_t *)&result); + } else { + bool res = filterDoCompare(fp, optr, pLeftData, pRightData); + colDataAppendInt8(pOut->columnData, i, (int8_t *)&res); + if (res) { + ++num; + } + } + + if (freeLeft) { + taosMemoryFreeClear(pLeftData); + } + + if (freeRight) { + taosMemoryFreeClear(pRightData); } } + } else { + for (int32_t i = startIndex; i < numOfRows && i >= 0; i += step) { + int32_t leftIndex = (i >= pLeft->numOfRows) ? 0 : i; + int32_t rightIndex = (i >= pRight->numOfRows) ? 0 : i; - if (freeLeft) { - taosMemoryFreeClear(pLeftData); - } + if (colDataIsNull_f(pLeft->columnData->nullbitmap, leftIndex) || + colDataIsNull_f(pRight->columnData->nullbitmap, rightIndex)) { + pRes[i] = false; + continue; + } - if (freeRight) { - taosMemoryFreeClear(pRightData); + char *pLeftData = colDataGetData(pLeft->columnData, leftIndex); + char *pRightData = colDataGetData(pRight->columnData, rightIndex); + + pRes[i] = filterDoCompare(fp, optr, pLeftData, pRightData); + if (pRes[i]) { + ++num; + } } } From 183fed1af6dce65f71a9158bcd836a7e3a5dc9dc Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Mon, 28 Nov 2022 18:44:21 +0800 Subject: [PATCH 16/27] fix(query): fix syntax error on windows. --- source/util/src/tarray.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/util/src/tarray.c b/source/util/src/tarray.c index 0c5b311ab3..74647d5fec 100644 --- a/source/util/src/tarray.c +++ b/source/util/src/tarray.c @@ -318,7 +318,7 @@ SArray* taosArrayDup(const SArray* pSrc, __array_item_dup_fn_t fn) { for(int32_t i = 0; i < pSrc->size; ++i) { void* p = fn(taosArrayGetP(pSrc, i)); - memcpy(dst->pData + i * dst->elemSize, &p, dst->elemSize); + memcpy(((char*)dst->pData )+ i * dst->elemSize, &p, dst->elemSize); } } From 65adb259ff47f61d16efc72d43f7f5df7cd6dbee Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Mon, 28 Nov 2022 18:44:59 +0800 Subject: [PATCH 17/27] enh: support multiple groups in exchange operator --- include/libs/parser/parser.h | 2 +- source/client/src/clientImpl.c | 15 +++++----- source/client/src/clientStmt.c | 38 ++++++++++++++++++-------- source/libs/catalog/src/ctgAsync.c | 2 +- source/libs/command/src/explain.c | 19 +++++++++---- source/libs/parser/src/parAstCreater.c | 2 +- source/libs/parser/src/parInsertSql.c | 4 +-- source/util/src/tarray.c | 3 ++ source/util/src/tlog.c | 5 ++-- 9 files changed, 58 insertions(+), 32 deletions(-) diff --git a/include/libs/parser/parser.h b/include/libs/parser/parser.h index 1a7e6dc748..b72d85243b 100644 --- a/include/libs/parser/parser.h +++ b/include/libs/parser/parser.h @@ -29,7 +29,7 @@ struct SMetaData; typedef struct SStmtCallback { TAOS_STMT* pStmt; int32_t (*getTbNameFn)(TAOS_STMT*, char**); - int32_t (*setInfoFn)(TAOS_STMT*, STableMeta*, void*, char*, bool, SHashObj*, SHashObj*, const char*); + int32_t (*setInfoFn)(TAOS_STMT*, STableMeta*, void*, SName*, bool, SHashObj*, SHashObj*, const char*); int32_t (*getExecInfoFn)(TAOS_STMT*, SHashObj**, SHashObj**); } SStmtCallback; diff --git a/source/client/src/clientImpl.c b/source/client/src/clientImpl.c index c3140371c4..2fe53d505f 100644 --- a/source/client/src/clientImpl.c +++ b/source/client/src/clientImpl.c @@ -2215,11 +2215,16 @@ void syncQueryFn(void* param, void* res, int32_t code) { SSyncQueryParam* pParam = param; pParam->pRequest = res; - if (pParam->pRequest) { + if (pParam->pRequest != NULL) { + pParam->pRequest->syncQuery = true; pParam->pRequest->code = code; } tsem_post(&pParam->sem); + + if (NULL == res) { + taosMemoryFree(param); + } } void taosAsyncQueryImpl(uint64_t connId, const char* sql, __taos_async_fn_t fp, void* param, bool validateOnly) { @@ -2293,9 +2298,7 @@ TAOS_RES* taosQueryImpl(TAOS* taos, const char* sql, bool validateOnly) { taosAsyncQueryImpl(*(int64_t*)taos, sql, syncQueryFn, param, validateOnly); tsem_wait(¶m->sem); - if (param->pRequest != NULL) { - param->pRequest->syncQuery = true; - } + return param->pRequest; } @@ -2310,8 +2313,6 @@ TAOS_RES* taosQueryImplWithReqid(TAOS* taos, const char* sql, bool validateOnly, taosAsyncQueryImplWithReqid(*(int64_t*)taos, sql, syncQueryFn, param, validateOnly, reqid); tsem_wait(¶m->sem); - if (param->pRequest != NULL) { - param->pRequest->syncQuery = true; - } + return param->pRequest; } diff --git a/source/client/src/clientStmt.c b/source/client/src/clientStmt.c index 86c86d52ab..53c151feeb 100644 --- a/source/client/src/clientStmt.c +++ b/source/client/src/clientStmt.c @@ -152,9 +152,12 @@ int32_t stmtRestoreQueryFields(STscStmt* pStmt) { return TSDB_CODE_SUCCESS; } -int32_t stmtUpdateBindInfo(TAOS_STMT* stmt, STableMeta* pTableMeta, void* tags, char* tbFName, const char* sTableName, bool autoCreateTbl) { +int32_t stmtUpdateBindInfo(TAOS_STMT* stmt, STableMeta* pTableMeta, void* tags, SName* tbName, const char* sTableName, bool autoCreateTbl) { STscStmt* pStmt = (STscStmt*)stmt; + char tbFName[TSDB_TABLE_FNAME_LEN]; + tNameExtractFullName(tbName, tbFName); + memcpy(&pStmt->bInfo.sname, tbName, sizeof(*tbName)); strncpy(pStmt->bInfo.tbFName, tbFName, sizeof(pStmt->bInfo.tbFName) - 1); pStmt->bInfo.tbFName[sizeof(pStmt->bInfo.tbFName) - 1] = 0; @@ -178,11 +181,11 @@ int32_t stmtUpdateExecInfo(TAOS_STMT* stmt, SHashObj* pVgHash, SHashObj* pBlockH return TSDB_CODE_SUCCESS; } -int32_t stmtUpdateInfo(TAOS_STMT* stmt, STableMeta* pTableMeta, void* tags, char* tbFName, bool autoCreateTbl, +int32_t stmtUpdateInfo(TAOS_STMT* stmt, STableMeta* pTableMeta, void* tags, SName* tbName, bool autoCreateTbl, SHashObj* pVgHash, SHashObj* pBlockHash, const char* sTableName) { STscStmt* pStmt = (STscStmt*)stmt; - STMT_ERR_RET(stmtUpdateBindInfo(stmt, pTableMeta, tags, tbFName, sTableName, autoCreateTbl)); + STMT_ERR_RET(stmtUpdateBindInfo(stmt, pTableMeta, tags, tbName, sTableName, autoCreateTbl)); STMT_ERR_RET(stmtUpdateExecInfo(stmt, pVgHash, pBlockHash, autoCreateTbl)); pStmt->sql.autoCreateTbl = autoCreateTbl; @@ -773,7 +776,9 @@ int stmtAddBatch(TAOS_STMT* stmt) { int stmtUpdateTableUid(STscStmt* pStmt, SSubmitRsp* pRsp) { tscDebug("stmt start to update tbUid, blockNum: %d", pRsp->nBlocks); - size_t keyLen = 0; + int32_t code = 0; + int32_t finalCode = 0; + size_t keyLen = 0; STableDataBlocks** pIter = taosHashIterate(pStmt->exec.pBlockHash, NULL); while (pIter) { STableDataBlocks* pBlock = *pIter; @@ -809,10 +814,20 @@ int stmtUpdateTableUid(STscStmt* pStmt, SSubmitRsp* pRsp) { } else { tscDebug("table %s not found in submit rsp, will update from catalog", pStmt->bInfo.tbFName); if (NULL == pStmt->pCatalog) { - STMT_ERR_RET(catalogGetHandle(pStmt->taos->pAppInfo->clusterId, &pStmt->pCatalog)); + code = catalogGetHandle(pStmt->taos->pAppInfo->clusterId, &pStmt->pCatalog); + if (code) { + pIter = taosHashIterate(pStmt->exec.pBlockHash, pIter); + finalCode = code; + continue; + } } - STMT_ERR_RET(stmtCreateRequest(pStmt)); + code = stmtCreateRequest(pStmt); + if (code) { + pIter = taosHashIterate(pStmt->exec.pBlockHash, pIter); + finalCode = code; + continue; + } STableMeta* pTableMeta = NULL; SRequestConnInfo conn = {.pTrans = pStmt->taos->pAppInfo->pTransporter, @@ -823,10 +838,11 @@ int stmtUpdateTableUid(STscStmt* pStmt, SSubmitRsp* pRsp) { taos_free_result(pStmt->exec.pRequest); pStmt->exec.pRequest = NULL; - - if (TSDB_CODE_PAR_TABLE_NOT_EXIST == code) { - tscDebug("tb %s not exist", pStmt->bInfo.tbFName); - return TSDB_CODE_SUCCESS; + + if (code || NULL == pTableMeta) { + pIter = taosHashIterate(pStmt->exec.pBlockHash, pIter); + finalCode = code; + continue; } pMeta->uid = pTableMeta->uid; @@ -836,7 +852,7 @@ int stmtUpdateTableUid(STscStmt* pStmt, SSubmitRsp* pRsp) { pIter = taosHashIterate(pStmt->exec.pBlockHash, pIter); } - return TSDB_CODE_SUCCESS; + return finalCode; } int stmtExec(TAOS_STMT* stmt) { diff --git a/source/libs/catalog/src/ctgAsync.c b/source/libs/catalog/src/ctgAsync.c index 2a032de003..7138e0ce16 100644 --- a/source/libs/catalog/src/ctgAsync.c +++ b/source/libs/catalog/src/ctgAsync.c @@ -1205,7 +1205,7 @@ int32_t ctgHandleGetTbMetasRsp(SCtgTaskReq* tReq, int32_t reqType, const SDataBu stbCtx.pName = &stbName; STableMeta* stbMeta = NULL; - ctgReadTbMetaFromCache(pCtg, &stbCtx, &stbMeta); + (void)ctgReadTbMetaFromCache(pCtg, &stbCtx, &stbMeta); if (stbMeta && stbMeta->sversion >= pOut->tbMeta->sversion) { ctgDebug("use cached stb meta, tbName:%s", tNameGetTableName(pName)); exist = 1; diff --git a/source/libs/command/src/explain.c b/source/libs/command/src/explain.c index 915dc08c14..410e62a18b 100644 --- a/source/libs/command/src/explain.c +++ b/source/libs/command/src/explain.c @@ -782,13 +782,18 @@ int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SExplainCtx *ctx, i } case QUERY_NODE_PHYSICAL_PLAN_EXCHANGE: { SExchangePhysiNode *pExchNode = (SExchangePhysiNode *)pNode; - SExplainGroup *group = taosHashGet(ctx->groupHash, &pExchNode->srcStartGroupId, sizeof(pExchNode->srcStartGroupId)); - if (NULL == group) { - qError("exchange src group %d not in groupHash", pExchNode->srcStartGroupId); - QRY_ERR_RET(TSDB_CODE_QRY_APP_ERROR); + int32_t nodeNum = 0; + for (int32_t i = pExchNode->srcStartGroupId; i <= pExchNode->srcEndGroupId; ++i) { + SExplainGroup *group = taosHashGet(ctx->groupHash, &pExchNode->srcStartGroupId, sizeof(pExchNode->srcStartGroupId)); + if (NULL == group) { + qError("exchange src group %d not in groupHash", pExchNode->srcStartGroupId); + QRY_ERR_RET(TSDB_CODE_QRY_APP_ERROR); + } + + nodeNum += group->nodeNum; } - EXPLAIN_ROW_NEW(level, EXPLAIN_EXCHANGE_FORMAT, pExchNode->singleChannel ? 1 : group->nodeNum); + EXPLAIN_ROW_NEW(level, EXPLAIN_EXCHANGE_FORMAT, pExchNode->singleChannel ? 1 : nodeNum); EXPLAIN_ROW_APPEND(EXPLAIN_LEFT_PARENTHESIS_FORMAT); if (pResNode->pExecInfo) { QRY_ERR_RET(qExplainBufAppendExecInfo(pResNode->pExecInfo, tbuf, &tlen)); @@ -819,7 +824,9 @@ int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SExplainCtx *ctx, i } } - QRY_ERR_RET(qExplainAppendGroupResRows(ctx, pExchNode->srcStartGroupId, level + 1, pExchNode->singleChannel)); + for (int32_t i = pExchNode->srcStartGroupId; i <= pExchNode->srcEndGroupId; ++i) { + QRY_ERR_RET(qExplainAppendGroupResRows(ctx, i, level + 1, pExchNode->singleChannel)); + } break; } case QUERY_NODE_PHYSICAL_PLAN_SORT: { diff --git a/source/libs/parser/src/parAstCreater.c b/source/libs/parser/src/parAstCreater.c index 1db52c123c..6a8c79040d 100644 --- a/source/libs/parser/src/parAstCreater.c +++ b/source/libs/parser/src/parAstCreater.c @@ -1407,7 +1407,7 @@ SNode* createShowTableTagsStmt(SAstCreateContext* pCxt, SNode* pTbName, SNode* p SNode* createCreateUserStmt(SAstCreateContext* pCxt, SToken* pUserName, const SToken* pPassword, int8_t sysinfo) { CHECK_PARSER_STATUS(pCxt); - char password[TSDB_USET_PASSWORD_LEN] = {0}; + char password[TSDB_USET_PASSWORD_LEN + 3] = {0}; if (!checkUserName(pCxt, pUserName) || !checkPassword(pCxt, pPassword, password)) { return NULL; } diff --git a/source/libs/parser/src/parInsertSql.c b/source/libs/parser/src/parInsertSql.c index 9c39954f09..1a87f626c6 100644 --- a/source/libs/parser/src/parInsertSql.c +++ b/source/libs/parser/src/parInsertSql.c @@ -1529,9 +1529,7 @@ static int32_t setStmtInfo(SInsertParseContext* pCxt, SVnodeModifOpStmt* pStmt) memcpy(tags, &pCxt->tags, sizeof(pCxt->tags)); SStmtCallback* pStmtCb = pCxt->pComCxt->pStmtCb; - char tbFName[TSDB_TABLE_FNAME_LEN]; - tNameExtractFullName(&pStmt->targetTableName, tbFName); - int32_t code = (*pStmtCb->setInfoFn)(pStmtCb->pStmt, pStmt->pTableMeta, tags, tbFName, pStmt->usingTableProcessing, + int32_t code = (*pStmtCb->setInfoFn)(pStmtCb->pStmt, pStmt->pTableMeta, tags, &pStmt->targetTableName, pStmt->usingTableProcessing, pStmt->pVgroupsHashObj, pStmt->pTableBlockHashObj, pStmt->usingTableName.tname); memset(&pCxt->tags, 0, sizeof(pCxt->tags)); diff --git a/source/util/src/tarray.c b/source/util/src/tarray.c index 95065972a3..fa39b1004a 100644 --- a/source/util/src/tarray.c +++ b/source/util/src/tarray.c @@ -192,6 +192,9 @@ void* taosArrayPop(SArray* pArray) { } void* taosArrayGet(const SArray* pArray, size_t index) { + if (NULL == pArray) { + return NULL; + } assert(index < pArray->size); return TARRAY_GET_ELEM(pArray, index); } diff --git a/source/util/src/tlog.c b/source/util/src/tlog.c index a2ce5ac08c..fc9d90c985 100644 --- a/source/util/src/tlog.c +++ b/source/util/src/tlog.c @@ -21,7 +21,7 @@ #define LOG_MAX_LINE_SIZE (1024) #define LOG_MAX_LINE_BUFFER_SIZE (LOG_MAX_LINE_SIZE + 3) -#define LOG_MAX_LINE_DUMP_SIZE (65 * 1024) +#define LOG_MAX_LINE_DUMP_SIZE (1024 * 1024) #define LOG_MAX_LINE_DUMP_BUFFER_SIZE (LOG_MAX_LINE_DUMP_SIZE + 3) #define LOG_FILE_NAME_LEN 300 @@ -496,7 +496,7 @@ void taosPrintLongString(const char *flags, ELogLevel level, int32_t dflag, cons if (!osLogSpaceAvailable()) return; if (!(dflag & DEBUG_FILE) && !(dflag & DEBUG_SCREEN)) return; - char buffer[LOG_MAX_LINE_DUMP_BUFFER_SIZE]; + char *buffer = taosMemoryMalloc(LOG_MAX_LINE_DUMP_BUFFER_SIZE); int32_t len = taosBuildLogHead(buffer, flags); va_list argpointer; @@ -509,6 +509,7 @@ void taosPrintLongString(const char *flags, ELogLevel level, int32_t dflag, cons buffer[len] = 0; taosPrintLogImp(level, dflag, buffer, len); + taosMemoryFree(buffer); } void taosDumpData(unsigned char *msg, int32_t len) { From b2b26f0c3cea79154d9d1b3f3c48a3804cc5c38f Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Mon, 28 Nov 2022 18:52:14 +0800 Subject: [PATCH 18/27] refactor: add an revised function to do compare. --- source/libs/scalar/src/sclvector.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/libs/scalar/src/sclvector.c b/source/libs/scalar/src/sclvector.c index 040f331ba4..c376e7efb7 100644 --- a/source/libs/scalar/src/sclvector.c +++ b/source/libs/scalar/src/sclvector.c @@ -1545,7 +1545,7 @@ int32_t doVectorCompareImpl(SScalarParam *pLeft, SScalarParam *pRight, SScalarPa int32_t num = 0; bool * pRes = (bool *)pOut->columnData; - if (GET_PARAM_TYPE(pLeft) != TSDB_DATA_TYPE_JSON && GET_PARAM_TYPE(pRight) != TSDB_DATA_TYPE_JSON) { + if (GET_PARAM_TYPE(pLeft) == TSDB_DATA_TYPE_JSON || GET_PARAM_TYPE(pRight) == TSDB_DATA_TYPE_JSON) { for (int32_t i = startIndex; i < numOfRows && i >= startIndex; i += step) { int32_t leftIndex = (i >= pLeft->numOfRows) ? 0 : i; int32_t rightIndex = (i >= pRight->numOfRows) ? 0 : i; From b53957c7bbc8db5f8b13619cbe1f2841b00be798 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Mon, 28 Nov 2022 18:57:36 +0800 Subject: [PATCH 19/27] fix(query): set correct ptr. --- source/libs/scalar/src/sclvector.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/libs/scalar/src/sclvector.c b/source/libs/scalar/src/sclvector.c index c376e7efb7..a9c83886ae 100644 --- a/source/libs/scalar/src/sclvector.c +++ b/source/libs/scalar/src/sclvector.c @@ -1543,7 +1543,7 @@ void vectorBitOr(SScalarParam *pLeft, SScalarParam *pRight, SScalarParam *pOut, int32_t doVectorCompareImpl(SScalarParam *pLeft, SScalarParam *pRight, SScalarParam *pOut, int32_t startIndex, int32_t numOfRows, int32_t step, __compar_fn_t fp, int32_t optr) { int32_t num = 0; - bool * pRes = (bool *)pOut->columnData; + bool * pRes = (bool *)pOut->columnData->pData; if (GET_PARAM_TYPE(pLeft) == TSDB_DATA_TYPE_JSON || GET_PARAM_TYPE(pRight) == TSDB_DATA_TYPE_JSON) { for (int32_t i = startIndex; i < numOfRows && i >= startIndex; i += step) { From 8daa8f352593998ab32caf9e93ece587bd0cbbdc Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Mon, 28 Nov 2022 19:04:15 +0800 Subject: [PATCH 20/27] fix: fix table meta memory leak issue --- source/client/src/clientStmt.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source/client/src/clientStmt.c b/source/client/src/clientStmt.c index 53c151feeb..291e0f6ae3 100644 --- a/source/client/src/clientStmt.c +++ b/source/client/src/clientStmt.c @@ -842,11 +842,13 @@ int stmtUpdateTableUid(STscStmt* pStmt, SSubmitRsp* pRsp) { if (code || NULL == pTableMeta) { pIter = taosHashIterate(pStmt->exec.pBlockHash, pIter); finalCode = code; + taosMemoryFree(pTableMeta); continue; } pMeta->uid = pTableMeta->uid; pStmt->bInfo.tbUid = pTableMeta->uid; + taosMemoryFree(pTableMeta); } pIter = taosHashIterate(pStmt->exec.pBlockHash, pIter); From 6e7e02c3cdffcbd47c8da0f1398ba4cc78a68d6b Mon Sep 17 00:00:00 2001 From: gccgdb1234 Date: Mon, 28 Nov 2022 19:13:11 +0800 Subject: [PATCH 21/27] fix compile --- source/libs/transport/src/transCli.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/libs/transport/src/transCli.c b/source/libs/transport/src/transCli.c index a0619def53..71cc14493f 100644 --- a/source/libs/transport/src/transCli.c +++ b/source/libs/transport/src/transCli.c @@ -656,7 +656,7 @@ static SCliConn* cliCreateConn(SCliThrd* pThrd) { conn->stream = (uv_stream_t*)taosMemoryMalloc(sizeof(uv_tcp_t)); uv_tcp_init(pThrd->loop, (uv_tcp_t*)(conn->stream)); conn->stream->data = conn; - //transSetConnOption((uv_tcp_t*)conn->stream); + transSetConnOption((uv_tcp_t*)conn->stream); uv_timer_t* timer = taosArrayGetSize(pThrd->timerList) > 0 ? *(uv_timer_t**)taosArrayPop(pThrd->timerList) : NULL; if (timer == NULL) { From a33799fe26f1f96899111e37cb81c3722ba6a24f Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Mon, 28 Nov 2022 18:22:18 +0800 Subject: [PATCH 22/27] test: adjust alter replica case --- tests/script/tsim/db/alter_replica_13.sim | 94 ++++++++++++++++------- tests/script/tsim/db/alter_replica_31.sim | 81 +++++++++++++------ 2 files changed, 125 insertions(+), 50 deletions(-) diff --git a/tests/script/tsim/db/alter_replica_13.sim b/tests/script/tsim/db/alter_replica_13.sim index b3231cc24b..4eafb86198 100644 --- a/tests/script/tsim/db/alter_replica_13.sim +++ b/tests/script/tsim/db/alter_replica_13.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 @@ -34,7 +35,7 @@ if $data(2)[4] != ready then endi print =============== step2: create database -sql create database db vgroups 1 +sql create database db vgroups 4 sql select * from information_schema.ins_databases if $rows != 3 then return -1 @@ -43,14 +44,9 @@ if $data(db)[4] != 1 then return -1 endi -sql select * from information_schema.ins_dnodes -if $data(2)[2] != 1 then - return -1 -endi - # vnodes sql select * from information_schema.ins_dnodes -if $data(2)[2] != 1 then +if $data(2)[2] != 4 then return -1 endi @@ -61,13 +57,28 @@ if $data(2)[3] != 2 then endi sql_error alter database db replica 3 + sql create table db.stb (ts timestamp, c1 int, c2 binary(4)) tags(t1 int, t2 binary(16)) comment "abd" -sql create table db.ctb using db.stb tags(101, "102") -sql insert into db.ctb values(now, 1, "2") -sql select * from db.stb -if $rows != 1 then - return -1 -endi +sql create table db.ctb0 using db.stb tags(100, "100") +sql create table db.ctb1 using db.stb tags(101, "101") +sql create table db.ctb2 using db.stb tags(102, "102") +sql create table db.ctb3 using db.stb tags(103, "103") +sql create table db.ctb4 using db.stb tags(104, "104") +sql create table db.ctb5 using db.stb tags(105, "105") +sql create table db.ctb6 using db.stb tags(106, "106") +sql create table db.ctb7 using db.stb tags(107, "107") +sql create table db.ctb8 using db.stb tags(108, "108") +sql create table db.ctb9 using db.stb tags(109, "109") +sql insert into db.ctb0 values(now, 0, "0") +sql insert into db.ctb1 values(now, 1, "1") +sql insert into db.ctb2 values(now, 2, "2") +sql insert into db.ctb3 values(now, 3, "3") +sql insert into db.ctb4 values(now, 4, "4") +sql insert into db.ctb5 values(now, 5, "5") +sql insert into db.ctb6 values(now, 6, "6") +sql insert into db.ctb7 values(now, 7, "7") +sql insert into db.ctb8 values(now, 8, "8") +sql insert into db.ctb9 values(now, 9, "9") print =============== step3: create dnodes sql create dnode $hostname port 7300 @@ -106,6 +117,8 @@ endi print ============= step4: alter database sql alter database db replica 3 +$leaderIndex = 0 + $x = 0 step4: $x = $x + 1 @@ -114,46 +127,73 @@ step4: print ====> dnode not ready! return -1 endi + sql show db.vgroups print ===> rows: $rows print ===> $data00 $data01 $data02 $data03 $data04 $data05 -if $data[0][4] != leader then - goto step4 -endi -if $data[0][6] != follower then - goto step4 -endi -if $data[0][8] != follower then +if $data[0][4] == leader then + $leaderIndex = 1 +endi +if $data[0][6] == leader then + $leaderIndex = 2 +endi +if $data[0][8] == leader then + $leaderIndex = 3 +endi + +if $$leaderIndex == 0 then goto step4 endi +print leaderIndex ==> $leaderIndex + print ============= step5: result $i = 0 while $i < 10 $i = $i + 1 sleep 1000 + $leaderIndex2 = 0 sql show db.vgroups print ===> loop: $i | v0: $data03 $data04 | v1: $data05 $data06 | v2: $data07 $data08 - if $data[0][4] != leader then - return -1 + if $data[0][4] == leader then + $leaderIndex2 = 1 endi if $data[0][6] == leader then - return -1 + $leaderIndex2 = 2 endi if $data[0][8] == leader then + $leaderIndex2 = 3 + endi + + print leaderIndex2 ==> $leaderIndex2 + if $leaderIndex2 != $leaderIndex then return -1 endi + endw - -print ============= step5: stop dnode 2 -sql select * from db.stb +print ============= step5: check data +sql select * from db.ctb0 if $rows != 1 then return -1 endi -return +sql select * from db.ctb1 +if $rows != 1 then + return -1 +endi + +sql select * from db.ctb2 +if $rows != 1 then + return -1 +endi + +sql select * from db.stb +if $rows != 10 then + return -1 +endi + system sh/exec.sh -n dnode1 -s stop -x SIGINT system sh/exec.sh -n dnode2 -s stop -x SIGINT system sh/exec.sh -n dnode3 -s stop -x SIGINT diff --git a/tests/script/tsim/db/alter_replica_31.sim b/tests/script/tsim/db/alter_replica_31.sim index 4ab6783d07..47e1fda79f 100644 --- a/tests/script/tsim/db/alter_replica_31.sim +++ b/tests/script/tsim/db/alter_replica_31.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 @@ -45,7 +46,7 @@ if $data(4)[4] != ready then endi print =============== step2: create database -sql create database db vgroups 1 replica 3 +sql create database db vgroups 4 replica 3 sql select * from information_schema.ins_databases if $rows != 3 then return -1 @@ -54,26 +55,15 @@ if $data(db)[4] != 3 then return -1 endi -sql select * from information_schema.ins_dnodes -if $data(2)[2] != 1 then - return -1 -endi -if $data(3)[2] != 1 then - return -1 -endi -if $data(4)[2] != 1 then - return -1 -endi - # vnodes sql select * from information_schema.ins_dnodes -if $data(2)[2] != 1 then +if $data(2)[2] != 4 then return -1 endi -if $data(3)[2] != 1 then +if $data(3)[2] != 4 then return -1 endi -if $data(4)[2] != 1 then +if $data(4)[2] != 4 then return -1 endi @@ -112,20 +102,50 @@ if $hasleader != 1 then endi sql create table db.stb (ts timestamp, c1 int, c2 binary(4)) tags(t1 int, t2 binary(16)) comment "abd" -sql create table db.ctb using db.stb tags(101, "102") -sql insert into db.ctb values(now, 1, "2") +sql create table db.ctb0 using db.stb tags(100, "100") +sql create table db.ctb1 using db.stb tags(101, "101") +sql create table db.ctb2 using db.stb tags(102, "102") +sql create table db.ctb3 using db.stb tags(103, "103") +sql create table db.ctb4 using db.stb tags(104, "104") +sql create table db.ctb5 using db.stb tags(105, "105") +sql create table db.ctb6 using db.stb tags(106, "106") +sql create table db.ctb7 using db.stb tags(107, "107") +sql create table db.ctb8 using db.stb tags(108, "108") +sql create table db.ctb9 using db.stb tags(109, "109") +sql insert into db.ctb0 values(now, 0, "0") +sql insert into db.ctb1 values(now, 1, "1") +sql insert into db.ctb2 values(now, 2, "2") +sql insert into db.ctb3 values(now, 3, "3") +sql insert into db.ctb4 values(now, 4, "4") +sql insert into db.ctb5 values(now, 5, "5") +sql insert into db.ctb6 values(now, 6, "6") +sql insert into db.ctb7 values(now, 7, "7") +sql insert into db.ctb8 values(now, 8, "8") +sql insert into db.ctb9 values(now, 9, "9") sql show db.vgroups print ===> $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 -sleep 100 -sql select * from db.ctb -print ===> $data00 $data01 $data02 $data03 $data04 $data05 - +sql select * from db.ctb0 if $rows != 1 then return -1 endi +sql select * from db.ctb1 +if $rows != 1 then + return -1 +endi + +sql select * from db.ctb2 +if $rows != 1 then + return -1 +endi + +sql select * from db.stb +if $rows != 10 then + return -1 +endi + print ============= step3: alter database sql alter database db replica 1 $hasleader = 0 @@ -140,7 +160,7 @@ step3: endi sql show db.vgroups print ===> rows: $rows -if $rows != 1 then +if $rows != 4 then goto step3 endi if $data(2)[4] == leader then @@ -157,11 +177,26 @@ if $hasleader != 1 then endi print ============= step5: stop dnode 2 -sql select * from db.stb +sql select * from db.ctb0 if $rows != 1 then return -1 endi +sql select * from db.ctb1 +if $rows != 1 then + return -1 +endi + +sql select * from db.ctb2 +if $rows != 1 then + return -1 +endi + +sql select * from db.stb +if $rows != 10 then + return -1 +endi + system sh/exec.sh -n dnode1 -s stop -x SIGINT system sh/exec.sh -n dnode2 -s stop -x SIGINT system sh/exec.sh -n dnode3 -s stop -x SIGINT From 2bfcabda2730ee2ba81dc35517c6218aa3390c23 Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Mon, 28 Nov 2022 19:36:58 +0800 Subject: [PATCH 23/27] fix: fix client request param memory leak --- source/client/src/clientImpl.c | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/source/client/src/clientImpl.c b/source/client/src/clientImpl.c index 2fe53d505f..55080d5eeb 100644 --- a/source/client/src/clientImpl.c +++ b/source/client/src/clientImpl.c @@ -2215,16 +2215,11 @@ void syncQueryFn(void* param, void* res, int32_t code) { SSyncQueryParam* pParam = param; pParam->pRequest = res; - if (pParam->pRequest != NULL) { - pParam->pRequest->syncQuery = true; + if (pParam->pRequest) { pParam->pRequest->code = code; } tsem_post(&pParam->sem); - - if (NULL == res) { - taosMemoryFree(param); - } } void taosAsyncQueryImpl(uint64_t connId, const char* sql, __taos_async_fn_t fp, void* param, bool validateOnly) { @@ -2299,7 +2294,15 @@ TAOS_RES* taosQueryImpl(TAOS* taos, const char* sql, bool validateOnly) { taosAsyncQueryImpl(*(int64_t*)taos, sql, syncQueryFn, param, validateOnly); tsem_wait(¶m->sem); - return param->pRequest; + SRequestObj *pRequest = NULL; + if (param->pRequest != NULL) { + param->pRequest->syncQuery = true; + pRequest = param->pRequest; + } else { + taosMemoryFree(param); + } + + return pRequest; } TAOS_RES* taosQueryImplWithReqid(TAOS* taos, const char* sql, bool validateOnly, int64_t reqid) { @@ -2314,5 +2317,13 @@ TAOS_RES* taosQueryImplWithReqid(TAOS* taos, const char* sql, bool validateOnly, taosAsyncQueryImplWithReqid(*(int64_t*)taos, sql, syncQueryFn, param, validateOnly, reqid); tsem_wait(¶m->sem); - return param->pRequest; + SRequestObj *pRequest = NULL; + if (param->pRequest != NULL) { + param->pRequest->syncQuery = true; + pRequest = param->pRequest; + } else { + taosMemoryFree(param); + } + + return pRequest; } From 5a3e4dc1c8fc943b61f700fbf5d6e810f545ae1c Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Mon, 28 Nov 2022 19:48:04 +0800 Subject: [PATCH 24/27] fix(query): set correct null check function. --- source/libs/scalar/src/sclvector.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/libs/scalar/src/sclvector.c b/source/libs/scalar/src/sclvector.c index a9c83886ae..c4ff5b2b01 100644 --- a/source/libs/scalar/src/sclvector.c +++ b/source/libs/scalar/src/sclvector.c @@ -1597,8 +1597,8 @@ int32_t doVectorCompareImpl(SScalarParam *pLeft, SScalarParam *pRight, SScalarPa int32_t leftIndex = (i >= pLeft->numOfRows) ? 0 : i; int32_t rightIndex = (i >= pRight->numOfRows) ? 0 : i; - if (colDataIsNull_f(pLeft->columnData->nullbitmap, leftIndex) || - colDataIsNull_f(pRight->columnData->nullbitmap, rightIndex)) { + if (colDataIsNull_s(pLeft->columnData, leftIndex) || + colDataIsNull_s(pRight->columnData, rightIndex)) { pRes[i] = false; continue; } From 3727cedeb3318becf2e725d66964f1b42504cd69 Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Mon, 28 Nov 2022 20:43:33 +0800 Subject: [PATCH 25/27] change paramter --- source/libs/transport/src/transComm.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/source/libs/transport/src/transComm.c b/source/libs/transport/src/transComm.c index 5a5806417e..ad8d57c97a 100644 --- a/source/libs/transport/src/transComm.c +++ b/source/libs/transport/src/transComm.c @@ -202,9 +202,8 @@ bool transReadComplete(SConnBuffer* connBuf) { } int transSetConnOption(uv_tcp_t* stream) { - uv_tcp_nodelay(stream, 1); - int ret = uv_tcp_keepalive(stream, 5, 60); - return ret; + return uv_tcp_nodelay(stream, 1); + // int ret = uv_tcp_keepalive(stream, 5, 60); } SAsyncPool* transAsyncPoolCreate(uv_loop_t* loop, int sz, void* arg, AsyncCB cb) { From d266d7a2baef8ddff2d45e8eaca6d322a42883c6 Mon Sep 17 00:00:00 2001 From: xinsheng Ren <285808407@qq.com> Date: Mon, 28 Nov 2022 21:59:22 +0800 Subject: [PATCH 26/27] fix:during installation,dll file cannot overwrite. (#18526) Co-authored-by: facetosea <25808407@qq.com> --- packaging/tools/tdengine.iss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/tools/tdengine.iss b/packaging/tools/tdengine.iss index 2e9c46d06b..3a22c73774 100644 --- a/packaging/tools/tdengine.iss +++ b/packaging/tools/tdengine.iss @@ -51,7 +51,7 @@ Source: taos.bat; DestDir: "{app}\include"; Flags: igNoreversion; ;Source: taosdemo.png; DestDir: "{app}\include"; Flags: igNoreversion; ;Source: taosShell.png; DestDir: "{app}\include"; Flags: igNoreversion; Source: favicon.ico; DestDir: "{app}\include"; Flags: igNoreversion; -Source: {#MyAppSourceDir}{#MyAppDLLName}; DestDir: "{win}\System32"; Flags: 64bit;Check:IsWin64; +Source: {#MyAppSourceDir}{#MyAppDLLName}; DestDir: "{win}\System32"; Flags: igNoreversion recursesubdirs createallsubdirs 64bit;Check:IsWin64; Source: {#MyAppSourceDir}{#MyAppCfgName}; DestDir: "{app}\cfg"; Flags: igNoreversion recursesubdirs createallsubdirs onlyifdoesntexist uninsneveruninstall Source: {#MyAppSourceDir}{#MyAppDriverName}; DestDir: "{app}\driver"; Flags: igNoreversion recursesubdirs createallsubdirs ;Source: {#MyAppSourceDir}{#MyAppConnectorName}; DestDir: "{app}\connector"; Flags: igNoreversion recursesubdirs createallsubdirs From 9d6f7e978c1225be033d8311b68c75d311d4dae1 Mon Sep 17 00:00:00 2001 From: Shuduo Sang Date: Tue, 29 Nov 2022 09:20:33 +0800 Subject: [PATCH 27/27] feat: taosdump for windows (#18529) * feat: taos-tools 2333455 * feat: taosdump for windows * feat: update taos-tools dd298d1 * feat: update taostools d4e4c28 * feat: taosdump for windows d4e4c28 --- cmake/taostools_CMakeLists.txt.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/taostools_CMakeLists.txt.in b/cmake/taostools_CMakeLists.txt.in index 577166353b..e8fb125db7 100644 --- a/cmake/taostools_CMakeLists.txt.in +++ b/cmake/taostools_CMakeLists.txt.in @@ -2,7 +2,7 @@ # taos-tools ExternalProject_Add(taos-tools GIT_REPOSITORY https://github.com/taosdata/taos-tools.git - GIT_TAG 7e9ce09 + GIT_TAG 2aac500 SOURCE_DIR "${TD_SOURCE_DIR}/tools/taos-tools" BINARY_DIR "" #BUILD_IN_SOURCE TRUE