diff --git a/src/mnode/src/mgmtDb.c b/src/mnode/src/mgmtDb.c index 4d8bce2a677a507f5cf94d0982dde1d7cb863fb2..a904f3e71a0f3a0e696f63b89adeae15a9234395 100644 --- a/src/mnode/src/mgmtDb.c +++ b/src/mnode/src/mgmtDb.c @@ -261,6 +261,13 @@ static int32_t mgmtCheckDbCfg(SDbCfg *pCfg) { return TSDB_CODE_INVALID_OPTION; } +#ifndef _SYNC + if (pCfg->replications != 1) { + mError("invalid db option replications:%d can only be 1 in this version", pCfg->replications); + return TSDB_CODE_INVALID_OPTION; + } +#endif + return TSDB_CODE_SUCCESS; } diff --git a/src/mnode/src/mgmtSdb.c b/src/mnode/src/mgmtSdb.c index 839695a6e510647f5bb4ce6fd54c3bc50b26e681..e8e805b10b2700c26574a1b795b0de57486cf40d 100644 --- a/src/mnode/src/mgmtSdb.c +++ b/src/mnode/src/mgmtSdb.c @@ -184,6 +184,7 @@ void sdbUpdateMnodeRoles() { if (pMnode != NULL) { pMnode->role = roles.role[i]; sdbPrint("mnode:%d, role:%s", pMnode->mnodeId, mgmtGetMnodeRoleStr(pMnode->role)); + if (pMnode->mnodeId == dnodeGetDnodeId()) tsSdbObj.role = pMnode->role; mgmtDecMnodeRef(pMnode); } } @@ -221,7 +222,7 @@ static int32_t sdbForwardToPeer(SWalHead *pHead) { int32_t code = syncForwardToPeer(tsSdbObj.sync, pHead, (void*)pHead->version); if (code > 0) { - sdbTrace("forward request is sent, version:%" PRIu64 ", result:%s", pHead->version, tstrerror(code)); + sdbTrace("forward request is sent, version:%" PRIu64 ", code:%d", pHead->version, code); sem_wait(&tsSdbObj.sem); return tsSdbObj.code; } @@ -288,12 +289,13 @@ void sdbUpdateSync() { syncInfo.confirmForward = sdbConfirmForward; syncInfo.notifyRole = sdbNotifyRole; tsSdbObj.cfg = syncCfg; - + if (tsSdbObj.sync) { syncReconfig(tsSdbObj.sync, &syncCfg); } else { tsSdbObj.sync = syncStart(&syncInfo); } + sdbUpdateMnodeRoles(); } int32_t sdbInit() { diff --git a/tests/script/unique/column/replica3.sim b/tests/script/unique/column/replica3.sim index db7383f74885f59c7a94d6f97f2b2e0a76af23b1..1b4884cb90ff83b509371791fd0ddaf005d6df84 100644 --- a/tests/script/unique/column/replica3.sim +++ b/tests/script/unique/column/replica3.sim @@ -1,39 +1,36 @@ 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/cfg.sh -n dnode1 -c commitLog -v 0 -system sh/cfg.sh -n dnode2 -c commitLog -v 0 -system sh/cfg.sh -n dnode3 -c commitLog -v 0 +system sh/cfg.sh -n dnode1 -c clog -v 2 +system sh/cfg.sh -n dnode2 -c clog -v 2 +system sh/cfg.sh -n dnode3 -c clog -v 2 system sh/cfg.sh -n dnode1 -c numofMpeers -v 3 system sh/cfg.sh -n dnode2 -c numofMpeers -v 3 system sh/cfg.sh -n dnode3 -c numofMpeers -v 3 -system sh/exec.sh -n dnode1 -s start +system sh/exec_up.sh -n dnode1 -s start sql connect sql create dnode $hostname2 sql create dnode $hostname3 -system sh/exec.sh -n dnode2 -s start -system sh/exec.sh -n dnode3 -s start +system sh/exec_up.sh -n dnode2 -s start +system sh/exec_up.sh -n dnode3 -s start sql create database db replica 3 sql use db -sql create table mt (ts timestamp, f1 float, f2 float, f3 float, f4 float, f5 float, f6 float, f7 float, f8 float, f9 float, f10 float) tags (t1 int, t2 int) -sql create table tb1 using mt tags(1, 2) +sql create table db.mt (ts timestamp, f1 float, f2 float, f3 float, f4 float, f5 float, f6 float, f7 float, f8 float, f9 float, f10 float) tags (t1 int, t2 int) +sql create table db.tb1 using db.mt tags(1, 2) sleep 3001 $x = 1000 -while $x < 2000 +while $x < 1010 sql insert into tb1 values (now+1s , $x , $x , $x , $x , $x , $x , $x , $x , $x , $x ) $x = $x + 1 endw - -system sh/exec.sh -n dnode1 -s stop -system sh/exec.sh -n dnode2 -s stop -system sh/exec.sh -n dnode3 -s stop +system sh/exec_up.sh -n dnode1 -s stop +system sh/exec_up.sh -n dnode2 -s stop +system sh/exec_up.sh -n dnode3 -s stop diff --git a/tests/script/unique/metrics/testSuite.sim b/tests/script/unique/metrics/testSuite.sim index 98de87aaf131d31283979972a1251d4739dc4438..dd8ab53aa1de5fd93181169a991b6d8266914a9c 100644 --- a/tests/script/unique/metrics/testSuite.sim +++ b/tests/script/unique/metrics/testSuite.sim @@ -1,4 +1,4 @@ -run unique/metrics/disk.sim -run unique/metrics/metrics.sim -run unique/metrics/values.sim -run unique/metrics/vnode3.sim \ No newline at end of file +#run unique/metrics/disk.sim +#run unique/metrics/metrics.sim +#run unique/metrics/values.sim +#run unique/metrics/vnode3.sim \ No newline at end of file diff --git a/tests/script/unique/stream/testSuite.sim b/tests/script/unique/stream/testSuite.sim index f7de872cc388a8e5f28a17cb77f6c3b80fb2448a..bbf5da3d376d9eccc02aa61b1122cadb5fc04813 100644 --- a/tests/script/unique/stream/testSuite.sim +++ b/tests/script/unique/stream/testSuite.sim @@ -1,15 +1,15 @@ -run unique/stream/table_replica1_dnode2.sim -run unique/stream/metrics_replica1_dnode2.sim -run unique/stream/table_replica2_dnode2.sim -run unique/stream/metrics_replica2_dnode2.sim -run unique/stream/table_replica2_dnode2_vnoden.sim -run unique/stream/metrics_replica2_dnode2_vnoden.sim -run unique/stream/table_replica2_dnode3.sim -run unique/stream/metrics_replica2_dnode3.sim -run unique/stream/table_replica3_dnode4.sim -run unique/stream/metrics_replica3_dnode4.sim -run unique/stream/table_vnode_stop.sim -run unique/stream/metrics_vnode_stop.sim -#run unique/stream/table_balance.sim -#run unique/stream/metrics_balance.sim -#run unique/stream/table_move.sim \ No newline at end of file +#run unique/stream/table_replica1_dnode2.sim +#run unique/stream/metrics_replica1_dnode2.sim +#run unique/stream/table_replica2_dnode2.sim +#run unique/stream/metrics_replica2_dnode2.sim +#run unique/stream/table_replica2_dnode2_vnoden.sim +#run unique/stream/metrics_replica2_dnode2_vnoden.sim +#run unique/stream/table_replica2_dnode3.sim +#run unique/stream/metrics_replica2_dnode3.sim +#run unique/stream/table_replica3_dnode4.sim +#run unique/stream/metrics_replica3_dnode4.sim +#run unique/stream/table_vnode_stop.sim +#run unique/stream/metrics_vnode_stop.sim +##run unique/stream/table_balance.sim +##run unique/stream/metrics_balance.sim +##run unique/stream/table_move.sim \ No newline at end of file diff --git a/tests/script/unique/vnode/replica2_basic.sim b/tests/script/unique/vnode/replica2_basic.sim index bf501a11dfdb8c757b3da5197a8f67c6b742d423..4f195611e6ab50d5ec845434921de8e25efb34ff 100644 --- a/tests/script/unique/vnode/replica2_basic.sim +++ b/tests/script/unique/vnode/replica2_basic.sim @@ -1,6 +1,5 @@ system sh/stop_dnodes.sh - system sh/deploy.sh -n dnode1 -i 1 system sh/deploy.sh -n dnode2 -i 2 system sh/cfg.sh -n dnode1 -c commitLog -v 0