alternativeRole.sim 2.3 KB
Newer Older
1 2 3 4 5 6
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

S
Shengliang Guan 已提交
7 8 9
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 0
10 11 12 13 14

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

15 16 17
system sh/cfg.sh -n dnode1 -c numOfMnodes -v 3
system sh/cfg.sh -n dnode2 -c numOfMnodes -v 3
system sh/cfg.sh -n dnode3 -c numOfMnodes -v 3
18

S
TD-1486  
Shengliang Guan 已提交
19 20 21 22 23
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


24
print ========== step1
S
Shengliang Guan 已提交
25
system sh/exec.sh -n dnode1 -s start
H
Haojun Liao 已提交
26
sleep 2000
27
sql connect
R
TD-1382  
root 已提交
28

29
sql create dnode $hostname2
S
Shengliang Guan 已提交
30
system sh/exec.sh -n dnode2 -s start
31
sql create dnode $hostname3
S
Shengliang Guan 已提交
32
system sh/exec.sh -n dnode3 -s start
33 34 35 36 37 38 39 40 41
sleep 3000

$x = 0
show1: 
	$x = $x + 1
	sleep 1000
	if $x == 30 then
		return -1
	endi
42 43 44

sql show dnodes
print dnode1 $data5_1
S
Shengliang Guan 已提交
45 46
print dnode2 $data5_2
print dnode3 $data5_3
47 48

if $data5_1 != mnode then
49
  goto show1
50 51
endi
if $data5_2 != vnode then
52
  goto show1
53 54
endi
if $data5_3 != any then
55
  goto show1
56 57
endi

58 59 60 61 62 63 64
show2: 
	$x = $x + 1
	sleep 1000
	if $x == 30 then
		return -1
	endi

65 66 67 68 69
sql show mnodes
print dnode1 ==> $data2_1
print dnode2 ==> $data2_2
print dnode3 ==> $data2_3
if $data2_1 != master then
70
  goto show2
71 72
endi
if $data2_2 != null then
73
  goto show2
74 75
endi
if $data2_3 != slave then
76
  goto show2
77 78 79
endi

print ========== step2
R
scripts  
root 已提交
80
sql create database d1 
81 82 83 84 85 86 87 88 89
sql create table d1.t1 (ts timestamp, i int)
sql create table d1.t2 (ts timestamp, i int)
sql create table d1.t3 (ts timestamp, i int)
sql create table d1.t4 (ts timestamp, i int)
sql create table d1.t5 (ts timestamp, i int)
sql create table d1.t6 (ts timestamp, i int)
sql create table d1.t7 (ts timestamp, i int)
sql create table d1.t8 (ts timestamp, i int)

90 91 92 93 94 95 96
show3: 
	$x = $x + 1
	sleep 1000
	if $x == 30 then
		return -1
	endi

97 98 99 100 101 102
sql show dnodes
print dnode1 $data2_1
print dnode2 $data2_2
print dnode3 $data2_3

if $data2_1 != 0 then
103
  goto show3
104 105
endi
if $data2_2 != 1 then
106
  goto show3
107 108
endi
if $data2_3 != 1 then
109
  goto show3
110 111
endi

S
Shengliang Guan 已提交
112 113
system sh/exec.sh -n dnode1 -s stop  -x SIGINT
system sh/exec.sh -n dnode2 -s stop  -x SIGINT
114
system sh/exec.sh -n dnode3 -s stop  -x SIGINT