vgroup100.sim 3.1 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
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 numOfMnodes -v 3
system sh/cfg.sh -n dnode2 -c numOfMnodes -v 3
system sh/cfg.sh -n dnode3 -c numOfMnodes -v 3

system sh/cfg.sh -n dnode1 -c maxTables -v 4
system sh/cfg.sh -n dnode2 -c maxTables -v 4
system sh/cfg.sh -n dnode3 -c maxTables -v 4

system sh/cfg.sh -n dnode1 -c mnodeEqualVnodeNum -v 0
system sh/cfg.sh -n dnode2 -c mnodeEqualVnodeNum -v 0
system sh/cfg.sh -n dnode3 -c mnodeEqualVnodeNum -v 0

print ============================== step1
system sh/exec.sh -n dnode1 -s start
sleep 2000
sql connect

print ============================== step2
print ========= start dnode2
sql create dnode $hostname2
system sh/exec.sh -n dnode2 -s start
sql create dnode $hostname3
system sh/exec.sh -n dnode3 -s start

S
TD-1671  
Shengliang Guan 已提交
30 31 32 33 34 35 36 37 38 39
sleep 3000

$x = 0
show2: 
	$x = $x + 1
	sleep 2000
	if $x == 10 then
		return -1
	endi
	
40 41 42 43 44 45 46 47 48
sql show mnodes
$dnode1Role = $data2_1
$dnode2Role = $data2_2
$dnode3Role = $data2_3

print $dnode1Role
print $dnode2Role 
print $dnode3Role 

S
TD-1671  
Shengliang Guan 已提交
49 50 51 52 53 54 55 56 57 58
if $dnode1Role != master then
	goto show2
endi
if $dnode2Role != slave then
	goto show2
endi
if $dnode3Role != slave then
	goto show2
endi

59 60 61 62 63
print ============================== step3
$count = 2
while $count < 102
  $db = d . $count
  $tb = $db . .t
S
TD-1520  
Shengliang Guan 已提交
64
  $tb2 = $db . .t2
65 66 67
  sql create database $db replica 3 cache 1 blocks 3
  sql create table $tb (ts timestamp, i int)
  sql insert into $tb values(now, 1)
S
TD-1520  
Shengliang Guan 已提交
68
  sql create table $tb2 as select count(*) from $tb interval(10s)
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97
  $count = $count + 1
  print insert into $tb values(now, 1) ==> finished
endw

print ============================== step4

$count = 2
while $count < 102
  $db = d . $count
  $tb = $db . .t
  sql select * from $tb
  if $rows != 1 then
    print select * from $tb
    return -1
  endi
  $count = $count + 1
  print select * from $tb ==> rows: $rows 
endw

print ============================== step5
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
sleep 5000

print ============================== step6
system sh/exec.sh -n dnode1 -s start
system sh/exec.sh -n dnode2 -s start
system sh/exec.sh -n dnode3 -s start
S
TD-1520  
Shengliang Guan 已提交
98
sleep 10000
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148

print ============================== step7

$x = 0
show7: 
	$x = $x + 1
	sleep 2000
	if $x == 50 then
		return -1
	endi
	
sql show mnodes -x show7
$dnode1Role = $data2_1
$dnode2Role = $data2_2
$dnode3Role = $data2_3
if $dnode1Role != master then
	goto show7
endi
if $dnode2Role != slave then
	goto show7
endi
if $dnode2Role != slave then
	goto show7
endi

print ============================== step8
$x = 0
show8: 
	$x = $x + 1
	sleep 2000
	if $x == 20 then
		return -1
	endi

$count = 2
while $count < 102
  $db = d . $count
  $tb = $db . .t
  sql select * from $tb
  if $rows != 1 then
    print select * from $tb
    goto show8
  endi
  $count = $count + 1
  print select * from $tb ==> rows: $rows 
endw

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