replica3.sim 6.6 KB
Newer Older
S
slguan 已提交
1 2
system sh/stop_dnodes.sh

S
slguan 已提交
3 4 5 6
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/deploy.sh -n dnode4 -i 4
S
slguan 已提交
7 8 9 10 11 12 13 14 15 16 17

system sh/cfg.sh -n dnode1 -c numOfMPeers -v 1
system sh/cfg.sh -n dnode2 -c numOfMPeers -v 1
system sh/cfg.sh -n dnode3 -c numOfMPeers -v 1
system sh/cfg.sh -n dnode4 -c numOfMPeers -v 1

system sh/cfg.sh -n dnode1 -c mgmtEqualVnodeNum -v 10
system sh/cfg.sh -n dnode2 -c mgmtEqualVnodeNum -v 10
system sh/cfg.sh -n dnode3 -c mgmtEqualVnodeNum -v 10
system sh/cfg.sh -n dnode4 -c mgmtEqualVnodeNum -v 10

S
scripts  
slguan 已提交
18 19 20 21
system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 2000
system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v 2000
system sh/cfg.sh -n dnode3 -c maxtablesPerVnode -v 2000
system sh/cfg.sh -n dnode4 -c maxtablesPerVnode -v 2000
S
slguan 已提交
22 23 24 25 26 27 28

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 dnode4 -c commitlog -v 0

print ========= start dnode1
S
scripts  
slguan 已提交
29
system sh/exec_up.sh -n dnode1 -s start
S
slguan 已提交
30 31 32
sleep 5000
sql connect

S
slguan 已提交
33
sql create dnode $hostname2
S
scripts  
slguan 已提交
34
system sh/exec_up.sh -n dnode2 -s start
S
slguan 已提交
35
sql create dnode $hostname3
S
scripts  
slguan 已提交
36
system sh/exec_up.sh -n dnode3 -s start
S
slguan 已提交
37 38 39 40 41 42 43


sql create database ir3db replica 3 days 7
sql use ir3db
sql create table tb(ts timestamp, i int)

print ================= step1
guanshengliang's avatar
scripts  
guanshengliang 已提交
44
sql import into tb values(1520000010000, 10000)
S
slguan 已提交
45
sql select * from tb;
guanshengliang's avatar
scripts  
guanshengliang 已提交
46
print $rows
S
slguan 已提交
47 48 49 50 51
if $rows != 1 then 
  return -1
endi

print ================= step2
guanshengliang's avatar
scripts  
guanshengliang 已提交
52 53
sql insert into tb values(1520000008000, 8000)
print $rows
S
slguan 已提交
54
sql select * from tb;
guanshengliang's avatar
scripts  
guanshengliang 已提交
55
if $rows != 2 then 
S
slguan 已提交
56 57 58 59
  return -1
endi

print ================= step3
guanshengliang's avatar
scripts  
guanshengliang 已提交
60
sql insert into tb values(1520000020000, 20000)
S
slguan 已提交
61
sql select * from tb;
guanshengliang's avatar
scripts  
guanshengliang 已提交
62 63
print $rows
if $rows != 3 then 
S
slguan 已提交
64 65 66 67
  return -1
endi

print ================= step4
guanshengliang's avatar
scripts  
guanshengliang 已提交
68 69 70
sql import into tb values(1520000009000, 9000)
sql import into tb values(1520000015000, 15000)
sql import into tb values(1520000030000, 30000)
S
slguan 已提交
71
sql select * from tb;
guanshengliang's avatar
scripts  
guanshengliang 已提交
72 73
print $rows
if $rows != 6 then 
S
slguan 已提交
74 75 76 77
  return -1
endi

print ================= step5
guanshengliang's avatar
scripts  
guanshengliang 已提交
78 79 80 81
sql insert into tb values(1520000008000, 8000)
sql insert into tb values(1520000014000, 14000)
sql insert into tb values(1520000025000, 25000)
sql insert into tb values(1520000040000, 40000)
S
slguan 已提交
82
sql select * from tb;
guanshengliang's avatar
scripts  
guanshengliang 已提交
83 84
print $rows
if $rows != 9 then 
S
slguan 已提交
85 86 87 88
  return -1
endi

print ================= step6
guanshengliang's avatar
scripts  
guanshengliang 已提交
89 90 91 92 93
sql import into tb values(1520000007000, 7000)
sql import into tb values(1520000012000, 12000)
sql import into tb values(1520000023000, 23000)
sql import into tb values(1520000034000, 34000)
sql import into tb values(1520000050000, 50000)
S
slguan 已提交
94
sql select * from tb;
guanshengliang's avatar
scripts  
guanshengliang 已提交
95 96
print $rows
if $rows != 14 then 
S
slguan 已提交
97 98 99 100
  return -1
endi

#print ================== dnode restart
S
scripts  
slguan 已提交
101
#system sh/exec_up.sh -n dnode1 -s stop -x SIGINT
S
slguan 已提交
102
#sleep 5000
S
scripts  
slguan 已提交
103
#system sh/exec_up.sh -n dnode1 -s start
S
slguan 已提交
104 105
#sleep 5000
#sql select * from tb;
guanshengliang's avatar
scripts  
guanshengliang 已提交
106
#if $rows != 14 then 
S
slguan 已提交
107 108 109 110
#  return -1
#endi

print ================= step7
guanshengliang's avatar
scripts  
guanshengliang 已提交
111 112 113 114 115
sql import into tb values(1520000007001, 7001)
sql import into tb values(1520000012001, 12001)
sql import into tb values(1520000023001, 23001)
sql import into tb values(1520000034001, 34001)
sql import into tb values(1520000050001, 50001)
S
slguan 已提交
116
sql select * from tb;
guanshengliang's avatar
scripts  
guanshengliang 已提交
117 118
print $rows
if $rows != 19 then 
S
slguan 已提交
119 120 121 122
  return -1
endi

print ================= step8
guanshengliang's avatar
scripts  
guanshengliang 已提交
123 124 125 126
sql insert into tb values(1520000008002, 8002)
sql insert into tb values(1520000014002, 14002)
sql insert into tb values(1520000025002, 25002)
sql insert into tb values(1520000060000, 60000)
S
slguan 已提交
127
sql select * from tb;
guanshengliang's avatar
scripts  
guanshengliang 已提交
128 129
print $rows
if $rows != 24 then 
S
slguan 已提交
130 131 132 133
  return -1
endi

print ================= step9
guanshengliang's avatar
scripts  
guanshengliang 已提交
134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159
#1520000000000
#sql import into tb values(now-30d, 7003)
#sql import into tb values(now-20d, 34003)
#sql import into tb values(now-10d, 34003)
#sql import into tb values(now-5d, 34003)
#sql import into tb values(now+1d, 50001)
#sql import into tb values(now+2d, 50001)
#sql import into tb values(now+6d, 50001)
#sql import into tb values(now+8d, 50002)
#sql import into tb values(now+10d, 50003)
#sql import into tb values(now+12d, 50004)
#sql import into tb values(now+14d, 50001)
#sql import into tb values(now+16d, 500051)

sql import into tb values(1517408000000, 7003)
sql import into tb values(1518272000000, 34003)
sql import into tb values(1519136000000, 34003)
sql import into tb values(1519568000000, 34003)
sql import into tb values(1519654400000, 50001)
sql import into tb values(1519827200000, 50001)
sql import into tb values(1520345600000, 50001)
sql import into tb values(1520691200000, 50002)
sql import into tb values(1520864000000, 50003)
sql import into tb values(1521900800000, 50004)
sql import into tb values(1523110400000, 50001)
sql import into tb values(1521382400000, 500051)
S
slguan 已提交
160
sql select * from tb;
guanshengliang's avatar
scripts  
guanshengliang 已提交
161 162
print $rows
if $rows != 36 then 
S
slguan 已提交
163 164 165 166
  return -1
endi

print ================= step10
S
scripts  
slguan 已提交
167
system sh/exec_up.sh -n dnode1 -s stop -x SIGINT
S
slguan 已提交
168
sleep 5000
S
scripts  
slguan 已提交
169
system sh/exec_up.sh -n dnode1 -s start
S
slguan 已提交
170 171
sleep 5000
sql select * from tb;
guanshengliang's avatar
scripts  
guanshengliang 已提交
172 173
print $rows
if $rows != 36 then 
S
slguan 已提交
174 175 176 177
  return -1
endi

print ================= step11
guanshengliang's avatar
scripts  
guanshengliang 已提交
178 179 180

#sql import into tb values(now-50d, 7003) (now-48d, 7003) (now-46d, 7003) (now-44d, 7003) (now-42d, 7003)
sql import into tb values(1515680000000, 7003) (1515852800000, 7003) (1516025600000, 7003) (1516198400000, 7003) (1516371200000, 7003)
S
slguan 已提交
181
sql select * from tb;
guanshengliang's avatar
scripts  
guanshengliang 已提交
182
if $rows != 41 then 
S
slguan 已提交
183 184 185 186
  return -1
endi

print ================= step12
guanshengliang's avatar
scripts  
guanshengliang 已提交
187 188 189
#1520000000000
#sql import into tb values(now-19d, 7003) (now-18d, 7003) (now-17d, 7003) (now-16d, 7003) (now-15d, 7003) (now-14d, 7003) (now-13d, 7003) (now-12d, 7003) (now-11d, 7003)
sql import into tb values(1518358400000, 7003) (1518444800000, 7003) (1518531200000, 7003) (1518617600000, 7003) (1518704000000, 7003) (1518790400000, 7003) (1518876800000, 7003) (1518963200000, 7003) (1519049600000, 7003)
S
slguan 已提交
190
sql select * from tb;
guanshengliang's avatar
scripts  
guanshengliang 已提交
191 192
print $rows
if $rows != 50 then 
S
slguan 已提交
193 194 195 196
  return -1
endi

print ================= step13
S
scripts  
slguan 已提交
197
system sh/exec_up.sh -n dnode2 -s stop 
S
slguan 已提交
198 199 200
sleep 5000

print ================= step14
guanshengliang's avatar
scripts  
guanshengliang 已提交
201 202 203 204 205 206 207 208 209
#1520000000000
#sql import into tb values(now-48d, 34003)
#sql import into tb values(now-38d, 50001)
#sql import into tb values(now-28d, 50001)

sql import into tb values(1515852800001, 34003)
sql import into tb values(1516716800000, 50001)
sql import into tb values(1517580800000, 50001)

S
slguan 已提交
210
sql select * from tb;
guanshengliang's avatar
scripts  
guanshengliang 已提交
211
if $rows != 50 then 
S
slguan 已提交
212 213 214 215
  return -1
endi

print ================= step15
S
scripts  
slguan 已提交
216
system sh/exec_up.sh -n dnode2 -s start
S
slguan 已提交
217
sleep 8000
S
scripts  
slguan 已提交
218
system sh/exec_up.sh -n dnode3 -s stop
S
slguan 已提交
219 220
sleep 3000

guanshengliang's avatar
scripts  
guanshengliang 已提交
221
if $rows != 50 then 
S
slguan 已提交
222 223
  return -1
endi
guanshengliang's avatar
scripts  
guanshengliang 已提交
224 225 226 227 228 229 230 231 232

system sh/exec_up.sh -n dnode1 -s stop  -x SIGINT
system sh/exec_up.sh -n dnode2 -s stop  -x SIGINT
system sh/exec_up.sh -n dnode3 -s stop  -x SIGINT
system sh/exec_up.sh -n dnode4 -s stop  -x SIGINT
system sh/exec_up.sh -n dnode5 -s stop  -x SIGINT
system sh/exec_up.sh -n dnode6 -s stop  -x SIGINT
system sh/exec_up.sh -n dnode7 -s stop  -x SIGINT
system sh/exec_up.sh -n dnode8 -s stop  -x SIGINT