提交 69dbb70a 编写于 作者: S slguan

[TD-150] Let mnode changes be processed in a status message

上级 099ffbd0
...@@ -261,6 +261,13 @@ static int32_t mgmtCheckDbCfg(SDbCfg *pCfg) { ...@@ -261,6 +261,13 @@ static int32_t mgmtCheckDbCfg(SDbCfg *pCfg) {
return TSDB_CODE_INVALID_OPTION; 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; return TSDB_CODE_SUCCESS;
} }
......
...@@ -184,6 +184,7 @@ void sdbUpdateMnodeRoles() { ...@@ -184,6 +184,7 @@ void sdbUpdateMnodeRoles() {
if (pMnode != NULL) { if (pMnode != NULL) {
pMnode->role = roles.role[i]; pMnode->role = roles.role[i];
sdbPrint("mnode:%d, role:%s", pMnode->mnodeId, mgmtGetMnodeRoleStr(pMnode->role)); sdbPrint("mnode:%d, role:%s", pMnode->mnodeId, mgmtGetMnodeRoleStr(pMnode->role));
if (pMnode->mnodeId == dnodeGetDnodeId()) tsSdbObj.role = pMnode->role;
mgmtDecMnodeRef(pMnode); mgmtDecMnodeRef(pMnode);
} }
} }
...@@ -221,7 +222,7 @@ static int32_t sdbForwardToPeer(SWalHead *pHead) { ...@@ -221,7 +222,7 @@ static int32_t sdbForwardToPeer(SWalHead *pHead) {
int32_t code = syncForwardToPeer(tsSdbObj.sync, pHead, (void*)pHead->version); int32_t code = syncForwardToPeer(tsSdbObj.sync, pHead, (void*)pHead->version);
if (code > 0) { 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); sem_wait(&tsSdbObj.sem);
return tsSdbObj.code; return tsSdbObj.code;
} }
...@@ -288,12 +289,13 @@ void sdbUpdateSync() { ...@@ -288,12 +289,13 @@ void sdbUpdateSync() {
syncInfo.confirmForward = sdbConfirmForward; syncInfo.confirmForward = sdbConfirmForward;
syncInfo.notifyRole = sdbNotifyRole; syncInfo.notifyRole = sdbNotifyRole;
tsSdbObj.cfg = syncCfg; tsSdbObj.cfg = syncCfg;
if (tsSdbObj.sync) { if (tsSdbObj.sync) {
syncReconfig(tsSdbObj.sync, &syncCfg); syncReconfig(tsSdbObj.sync, &syncCfg);
} else { } else {
tsSdbObj.sync = syncStart(&syncInfo); tsSdbObj.sync = syncStart(&syncInfo);
} }
sdbUpdateMnodeRoles();
} }
int32_t sdbInit() { int32_t sdbInit() {
......
system sh/stop_dnodes.sh system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1 system sh/deploy.sh -n dnode1 -i 1
system sh/deploy.sh -n dnode2 -i 2 system sh/deploy.sh -n dnode2 -i 2
system sh/deploy.sh -n dnode3 -i 3 system sh/deploy.sh -n dnode3 -i 3
system sh/cfg.sh -n dnode1 -c commitLog -v 0 system sh/cfg.sh -n dnode1 -c clog -v 2
system sh/cfg.sh -n dnode2 -c commitLog -v 0 system sh/cfg.sh -n dnode2 -c clog -v 2
system sh/cfg.sh -n dnode3 -c commitLog -v 0 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 dnode1 -c numofMpeers -v 3
system sh/cfg.sh -n dnode2 -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/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 connect
sql create dnode $hostname2 sql create dnode $hostname2
sql create dnode $hostname3 sql create dnode $hostname3
system sh/exec.sh -n dnode2 -s start system sh/exec_up.sh -n dnode2 -s start
system sh/exec.sh -n dnode3 -s start system sh/exec_up.sh -n dnode3 -s start
sql create database db replica 3 sql create database db replica 3
sql use db 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 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 tb1 using mt tags(1, 2) sql create table db.tb1 using db.mt tags(1, 2)
sleep 3001 sleep 3001
$x = 1000 $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 ) sql insert into tb1 values (now+1s , $x , $x , $x , $x , $x , $x , $x , $x , $x , $x )
$x = $x + 1 $x = $x + 1
endw endw
system sh/exec_up.sh -n dnode1 -s stop
system sh/exec.sh -n dnode1 -s stop system sh/exec_up.sh -n dnode2 -s stop
system sh/exec.sh -n dnode2 -s stop system sh/exec_up.sh -n dnode3 -s stop
system sh/exec.sh -n dnode3 -s stop
run unique/metrics/disk.sim #run unique/metrics/disk.sim
run unique/metrics/metrics.sim #run unique/metrics/metrics.sim
run unique/metrics/values.sim #run unique/metrics/values.sim
run unique/metrics/vnode3.sim #run unique/metrics/vnode3.sim
\ No newline at end of file \ No newline at end of file
run unique/stream/table_replica1_dnode2.sim #run unique/stream/table_replica1_dnode2.sim
run unique/stream/metrics_replica1_dnode2.sim #run unique/stream/metrics_replica1_dnode2.sim
run unique/stream/table_replica2_dnode2.sim #run unique/stream/table_replica2_dnode2.sim
run unique/stream/metrics_replica2_dnode2.sim #run unique/stream/metrics_replica2_dnode2.sim
run unique/stream/table_replica2_dnode2_vnoden.sim #run unique/stream/table_replica2_dnode2_vnoden.sim
run unique/stream/metrics_replica2_dnode2_vnoden.sim #run unique/stream/metrics_replica2_dnode2_vnoden.sim
run unique/stream/table_replica2_dnode3.sim #run unique/stream/table_replica2_dnode3.sim
run unique/stream/metrics_replica2_dnode3.sim #run unique/stream/metrics_replica2_dnode3.sim
run unique/stream/table_replica3_dnode4.sim #run unique/stream/table_replica3_dnode4.sim
run unique/stream/metrics_replica3_dnode4.sim #run unique/stream/metrics_replica3_dnode4.sim
run unique/stream/table_vnode_stop.sim #run unique/stream/table_vnode_stop.sim
run unique/stream/metrics_vnode_stop.sim #run unique/stream/metrics_vnode_stop.sim
#run unique/stream/table_balance.sim ##run unique/stream/table_balance.sim
#run unique/stream/metrics_balance.sim ##run unique/stream/metrics_balance.sim
#run unique/stream/table_move.sim ##run unique/stream/table_move.sim
\ No newline at end of file \ No newline at end of file
system sh/stop_dnodes.sh system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1 system sh/deploy.sh -n dnode1 -i 1
system sh/deploy.sh -n dnode2 -i 2 system sh/deploy.sh -n dnode2 -i 2
system sh/cfg.sh -n dnode1 -c commitLog -v 0 system sh/cfg.sh -n dnode1 -c commitLog -v 0
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册