TD-1257 mnode module startup check condition is wrong
This commit is contained in:
parent
58408892da
commit
90367ca788
|
@ -21,6 +21,7 @@
|
||||||
#include "tgrant.h"
|
#include "tgrant.h"
|
||||||
#include "ttimer.h"
|
#include "ttimer.h"
|
||||||
#include "tglobal.h"
|
#include "tglobal.h"
|
||||||
|
#include "mnode.h"
|
||||||
#include "dnode.h"
|
#include "dnode.h"
|
||||||
#include "mnodeDef.h"
|
#include "mnodeDef.h"
|
||||||
#include "mnodeInt.h"
|
#include "mnodeInt.h"
|
||||||
|
@ -107,14 +108,19 @@ int32_t mnodeStartSystem() {
|
||||||
tsMgmtIsRunning = true;
|
tsMgmtIsRunning = true;
|
||||||
|
|
||||||
mInfo("mnode is initialized successfully");
|
mInfo("mnode is initialized successfully");
|
||||||
|
|
||||||
|
sdbUpdateSync();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t mnodeInitSystem() {
|
int32_t mnodeInitSystem() {
|
||||||
mnodeInitTimer();
|
mnodeInitTimer();
|
||||||
if (!mnodeNeedStart()) return 0;
|
if (mnodeNeedStart()) {
|
||||||
return mnodeStartSystem();
|
return mnodeStartSystem();
|
||||||
}
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
void mnodeCleanupSystem() {
|
void mnodeCleanupSystem() {
|
||||||
mInfo("starting to clean up mnode");
|
mInfo("starting to clean up mnode");
|
||||||
|
@ -159,15 +165,20 @@ static void mnodeCleanupTimer() {
|
||||||
|
|
||||||
static bool mnodeNeedStart() {
|
static bool mnodeNeedStart() {
|
||||||
struct stat dirstat;
|
struct stat dirstat;
|
||||||
bool fileExist = (stat(tsMnodeDir, &dirstat) == 0);
|
char mnodeFileName[TSDB_FILENAME_LEN * 2] = {0};
|
||||||
|
sprintf(mnodeFileName, "%s/wal0", tsMnodeDir);
|
||||||
|
|
||||||
|
bool fileExist = (stat(mnodeFileName, &dirstat) == 0);
|
||||||
bool asMaster = (strcmp(tsFirst, tsLocalEp) == 0);
|
bool asMaster = (strcmp(tsFirst, tsLocalEp) == 0);
|
||||||
|
|
||||||
if (asMaster || fileExist) {
|
if (asMaster || fileExist) {
|
||||||
|
mDebug("mnode module start, asMaster:%d fileExist:%d", asMaster, fileExist);
|
||||||
return true;
|
return true;
|
||||||
}
|
} else {
|
||||||
|
mDebug("mnode module won't start, asMaster:%d fileExist:%d", asMaster, fileExist);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool mnodeIsRunning() {
|
bool mnodeIsRunning() {
|
||||||
return tsMgmtIsRunning;
|
return tsMgmtIsRunning;
|
||||||
|
|
|
@ -291,6 +291,11 @@ static void sdbConfirmForward(void *ahandle, void *param, int32_t code) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void sdbUpdateSync() {
|
void sdbUpdateSync() {
|
||||||
|
if (!mnodeIsRunning()) {
|
||||||
|
mDebug("mnode not start yet, update sync info later");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
SSyncCfg syncCfg = {0};
|
SSyncCfg syncCfg = {0};
|
||||||
int32_t index = 0;
|
int32_t index = 0;
|
||||||
|
|
||||||
|
|
|
@ -294,6 +294,7 @@ cd ../../../debug; make
|
||||||
./test.sh -f unique/stable/replica3_dnode6.sim
|
./test.sh -f unique/stable/replica3_dnode6.sim
|
||||||
./test.sh -f unique/stable/replica3_vnode3.sim
|
./test.sh -f unique/stable/replica3_vnode3.sim
|
||||||
|
|
||||||
|
./test.sh -f unique/mnode/mgmt21.sim
|
||||||
./test.sh -f unique/mnode/mgmt22.sim
|
./test.sh -f unique/mnode/mgmt22.sim
|
||||||
./test.sh -f unique/mnode/mgmt23.sim
|
./test.sh -f unique/mnode/mgmt23.sim
|
||||||
./test.sh -f unique/mnode/mgmt24.sim
|
./test.sh -f unique/mnode/mgmt24.sim
|
||||||
|
|
|
@ -1,22 +1,11 @@
|
||||||
cd ../../../debug; cmake ..
|
cd ../../../debug; cmake ..
|
||||||
cd ../../../debug; make
|
cd ../../../debug; make
|
||||||
|
|
||||||
./test.sh -f unique/account/account_create.sim
|
|
||||||
./test.sh -f unique/account/account_delete.sim
|
|
||||||
./test.sh -f unique/account/account_len.sim
|
|
||||||
./test.sh -f unique/account/authority.sim
|
|
||||||
./test.sh -f unique/account/basic.sim
|
|
||||||
./test.sh -f unique/account/paras.sim
|
|
||||||
./test.sh -f unique/account/pass_alter.sim
|
|
||||||
./test.sh -f unique/account/pass_len.sim
|
|
||||||
./test.sh -f unique/account/usage.sim
|
|
||||||
./test.sh -f unique/account/user_create.sim
|
|
||||||
./test.sh -f unique/account/user_len.sim
|
|
||||||
|
|
||||||
./test.sh -f unique/big/balance.sim
|
./test.sh -f unique/big/balance.sim
|
||||||
./test.sh -f unique/big/maxvnodes.sim
|
./test.sh -f unique/big/maxvnodes.sim
|
||||||
./test.sh -f unique/big/tcp.sim
|
./test.sh -f unique/big/tcp.sim
|
||||||
|
|
||||||
|
./test.sh -f unique/cluster/alter.sim
|
||||||
./test.sh -f unique/cluster/balance1.sim
|
./test.sh -f unique/cluster/balance1.sim
|
||||||
./test.sh -f unique/cluster/balance2.sim
|
./test.sh -f unique/cluster/balance2.sim
|
||||||
./test.sh -f unique/cluster/balance3.sim
|
./test.sh -f unique/cluster/balance3.sim
|
||||||
|
@ -61,6 +50,7 @@ cd ../../../debug; make
|
||||||
./test.sh -f unique/stable/replica3_dnode6.sim
|
./test.sh -f unique/stable/replica3_dnode6.sim
|
||||||
./test.sh -f unique/stable/replica3_vnode3.sim
|
./test.sh -f unique/stable/replica3_vnode3.sim
|
||||||
|
|
||||||
|
./test.sh -f unique/mnode/mgmt21.sim
|
||||||
./test.sh -f unique/mnode/mgmt22.sim
|
./test.sh -f unique/mnode/mgmt22.sim
|
||||||
./test.sh -f unique/mnode/mgmt23.sim
|
./test.sh -f unique/mnode/mgmt23.sim
|
||||||
./test.sh -f unique/mnode/mgmt24.sim
|
./test.sh -f unique/mnode/mgmt24.sim
|
||||||
|
@ -77,31 +67,16 @@ cd ../../../debug; make
|
||||||
./test.sh -f unique/vnode/replica3_repeat.sim
|
./test.sh -f unique/vnode/replica3_repeat.sim
|
||||||
./test.sh -f unique/vnode/replica3_vgroup.sim
|
./test.sh -f unique/vnode/replica3_vgroup.sim
|
||||||
|
|
||||||
./test.sh -f general/stream/metrics_1.sim
|
|
||||||
./test.sh -f general/stream/metrics_del.sim
|
|
||||||
./test.sh -f general/stream/metrics_n.sim
|
|
||||||
./test.sh -f general/stream/metrics_replica1_vnoden.sim
|
|
||||||
#./test.sh -f general/stream/new_stream.sim
|
|
||||||
./test.sh -f general/stream/restart_stream.sim
|
|
||||||
./test.sh -f general/stream/stream_1.sim
|
|
||||||
./test.sh -f general/stream/stream_2.sim
|
|
||||||
./test.sh -f general/stream/stream_3.sim
|
|
||||||
./test.sh -f general/stream/stream_restart.sim
|
|
||||||
./test.sh -f general/stream/table_1.sim
|
|
||||||
./test.sh -f general/stream/table_del.sim
|
|
||||||
./test.sh -f general/stream/table_n.sim
|
|
||||||
./test.sh -f general/stream/table_replica1_vnoden.sim
|
|
||||||
|
|
||||||
./test.sh -f unique/arbitrator/check_cluster_cfg_para.sim
|
./test.sh -f unique/arbitrator/check_cluster_cfg_para.sim
|
||||||
./test.sh -f unique/arbitrator/dn2_mn1_cache_file_sync.sim
|
#./test.sh -f unique/arbitrator/dn2_mn1_cache_file_sync.sim
|
||||||
./test.sh -f unique/arbitrator/dn3_mn1_full_createTableFail.sim
|
./test.sh -f unique/arbitrator/dn3_mn1_full_createTableFail.sim
|
||||||
./test.sh -f unique/arbitrator/dn3_mn1_full_dropDnodeFail.sim
|
|
||||||
./test.sh -f unique/arbitrator/dn3_mn1_multiCreateDropTable.sim
|
./test.sh -f unique/arbitrator/dn3_mn1_multiCreateDropTable.sim
|
||||||
./test.sh -f unique/arbitrator/dn3_mn1_nw_disable_timeout_autoDropDnode.sim
|
#./test.sh -f unique/arbitrator/dn3_mn1_nw_disable_timeout_autoDropDnode.sim
|
||||||
./test.sh -f unique/arbitrator/dn3_mn1_replica2_wal1_AddDelDnode.sim
|
#./test.sh -f unique/arbitrator/dn3_mn1_replica2_wal1_AddDelDnode.sim
|
||||||
./test.sh -f unique/arbitrator/dn3_mn1_replica_change_dropDnod.sim
|
./test.sh -f unique/arbitrator/dn3_mn1_replica_change_dropDnod.sim
|
||||||
./test.sh -f unique/arbitrator/dn3_mn1_replica_change.sim
|
./test.sh -f unique/arbitrator/dn3_mn1_replica_change.sim
|
||||||
./test.sh -f unique/arbitrator/dn3_mn1_stopDnode_timeout.sim
|
#./test.sh -f unique/arbitrator/dn3_mn1_stopDnode_timeout.sim
|
||||||
|
# lower the priority while file corruption
|
||||||
#./test.sh -f unique/arbitrator/dn3_mn1_vnode_change.sim
|
#./test.sh -f unique/arbitrator/dn3_mn1_vnode_change.sim
|
||||||
#./test.sh -f unique/arbitrator/dn3_mn1_vnode_corruptFile_offline.sim
|
#./test.sh -f unique/arbitrator/dn3_mn1_vnode_corruptFile_offline.sim
|
||||||
#./test.sh -f unique/arbitrator/dn3_mn1_vnode_corruptFile_online.sim
|
#./test.sh -f unique/arbitrator/dn3_mn1_vnode_corruptFile_online.sim
|
||||||
|
@ -126,6 +101,7 @@ cd ../../../debug; make
|
||||||
./test.sh -f unique/arbitrator/replica_changeWithArbitrator.sim
|
./test.sh -f unique/arbitrator/replica_changeWithArbitrator.sim
|
||||||
./test.sh -f unique/arbitrator/sync_replica2_alterTable_add.sim
|
./test.sh -f unique/arbitrator/sync_replica2_alterTable_add.sim
|
||||||
./test.sh -f unique/arbitrator/sync_replica2_alterTable_drop.sim
|
./test.sh -f unique/arbitrator/sync_replica2_alterTable_drop.sim
|
||||||
|
|
||||||
./test.sh -f unique/arbitrator/sync_replica2_dropDb.sim
|
./test.sh -f unique/arbitrator/sync_replica2_dropDb.sim
|
||||||
./test.sh -f unique/arbitrator/sync_replica2_dropTable.sim
|
./test.sh -f unique/arbitrator/sync_replica2_dropTable.sim
|
||||||
./test.sh -f unique/arbitrator/sync_replica3_alterTable_add.sim
|
./test.sh -f unique/arbitrator/sync_replica3_alterTable_add.sim
|
||||||
|
|
|
@ -0,0 +1,44 @@
|
||||||
|
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 numOfMnodes -v 2
|
||||||
|
system sh/cfg.sh -n dnode2 -c numOfMnodes -v 2
|
||||||
|
|
||||||
|
print ============== step1
|
||||||
|
system sh/exec.sh -n dnode2 -s start
|
||||||
|
sleep 10000
|
||||||
|
|
||||||
|
system sh/exec.sh -n dnode1 -s start
|
||||||
|
sql connect
|
||||||
|
|
||||||
|
sql show mnodes
|
||||||
|
print dnode1 ==> $data2_1
|
||||||
|
print dnode2 ==> $data2_2
|
||||||
|
if $data2_1 != master then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
print ============== step2
|
||||||
|
sql create dnode $hostname2
|
||||||
|
|
||||||
|
$x = 0
|
||||||
|
show2:
|
||||||
|
$x = $x + 1
|
||||||
|
sleep 2000
|
||||||
|
if $x == 10 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
sql show mnodes
|
||||||
|
print dnode1 ==> $data2_1
|
||||||
|
print dnode2 ==> $data2_2
|
||||||
|
if $data2_1 != master then
|
||||||
|
goto show2
|
||||||
|
endi
|
||||||
|
if $data2_2 != slave then
|
||||||
|
goto show2
|
||||||
|
endi
|
||||||
|
|
||||||
|
system sh/exec.sh -n dnode1 -s stop -x SIGINT
|
||||||
|
system sh/exec.sh -n dnode2 -s stop -x SIGINT
|
Loading…
Reference in New Issue