alter_option.sim 9.7 KB
Newer Older
P
plum-lihui 已提交
1 2 3 4 5 6 7 8 9 10 11 12
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/exec.sh -n dnode1 -s start
system sh/exec.sh -n dnode2 -s start
system sh/exec.sh -n dnode3 -s start

sql connect
sql create dnode $hostname port 7200
sql create dnode $hostname port 7300

S
Shengliang Guan 已提交
13 14 15 16 17
$x = 0
step1:
	$x = $x + 1
	sleep 1000
	if $x == 10 then
P
plum-lihui 已提交
18 19 20 21 22 23 24
	  print ====> dnode not ready!
		return -1
	endi
sql show dnodes
print ===> $data00 $data01 $data02 $data03 $data04 $data05
print ===> $data10 $data11 $data12 $data13 $data14 $data15
print ===> $data20 $data21 $data22 $data23 $data24 $data25
S
Shengliang Guan 已提交
25
if $rows != 3 then
P
plum-lihui 已提交
26 27
  return -1
endi
S
Shengliang Guan 已提交
28 29
if $data(1)[4] != ready then
  goto step1
P
plum-lihui 已提交
30
endi
S
Shengliang Guan 已提交
31 32
if $data(2)[4] != ready then
  goto step1
P
plum-lihui 已提交
33
endi
S
Shengliang Guan 已提交
34 35
if $data(3)[4] != ready then
  goto step1
P
plum-lihui 已提交
36 37
endi

S
Shengliang Guan 已提交
38

P
plum-lihui 已提交
39 40
print ============= create database
#database_option: {
41 42
#  | BUFFER value       [3~16384, default: 96]
#  | PAGES value        [64~16384, default: 256]
43
#  | CACHEMODEL value   ['node', 'last_row', 'last_value', 'both']
P
plum-lihui 已提交
44
#  | FSYNC value        [0 ~ 180000 ms]
45
#  | KEEP value         [duration, 365000]
P
plum-lihui 已提交
46 47 48
#  | REPLICA value      [1 | 3]
#  | WAL value          [1 | 2]

49
sql create database db CACHEMODEL 'both' COMP 0 DURATION 240 FSYNC 1000 MAXROWS 8000 MINROWS 10 KEEP 1000 PRECISION 'ns' REPLICA 3 WAL 2 VGROUPS 6 SINGLE_STABLE 1
P
plum-lihui 已提交
50 51 52 53 54
sql show databases
print rows: $rows
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09
print $data10 $data11 $data12 $data13 $data14 $data15 $data16 $data17 $data18 $data19
print ====> dataX_db
55
print $data(db)[0] $data(db)[1] $data2_db $data3_db $data4_db $data5_db $data6_db $data7_db $data8_db $data9_db $data10_db $data11_db $data12_db $data13_db $data14_db $data15_db $data16_db $data17_db
P
plum-lihui 已提交
56

57
if $rows != 3 then
P
plum-lihui 已提交
58 59 60 61 62 63 64 65 66 67 68
  return -1
endi
if $data0_db != db then # name
  return -1
endi
if $data2_db != 6 then  # vgroups
  return -1
endi
if $data3_db != 0 then  # ntables
  return -1
endi
dengyihao's avatar
dengyihao 已提交
69
if $data4_db != 3 then  # replica
P
plum-lihui 已提交
70 71
  return -1
endi
72
if $data5_db != off then  # strict
P
plum-lihui 已提交
73 74
  return -1
endi
D
dapan1121 已提交
75
if $data6_db != 345600m then  # duration
P
plum-lihui 已提交
76 77
  return -1
endi
X
Xiaoyu Wang 已提交
78
if $data7_db != 1440000m,1440000m,1440000m then # keep
P
plum-lihui 已提交
79 80
  return -1
endi
81 82 83 84 85 86 87 88 89 90
if $data8_db != 96 then  # buffer
  return -1
endi
if $data9_db != 4 then  # pagesize
  return -1
endi
if $data10_db != 256 then  # pages
  return -1
endi
if $data11_db != 10 then  # minrows
P
plum-lihui 已提交
91 92
  return -1
endi
93
if $data12_db != 8000 then  # maxrows
P
plum-lihui 已提交
94 95
  return -1
endi
96
if $data13_db != 0 then  # comp
P
plum-lihui 已提交
97 98
  return -1
endi
99
if $data14_db != ns then  # precision
P
plum-lihui 已提交
100 101
  return -1
endi
102
if $data18_db != both then  # cache_model
P
plum-lihui 已提交
103 104
  return -1
endi
105
if $data19_db != 1 then  # cash_size
P
plum-lihui 已提交
106 107
  return -1
endi
108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123
if $data20_db != 2 then  # wal level
  return -1
endi
if $data21_db != 1000 then  # wal fsyncperiod
  return -1
endi
if $data22_db != 0 then  # 
  return -1
endi
if $data23_db != 0 then  # 
  return -1
endi
if $data24_db != 0 then  # 
  return -1
endi
if $data25_db != 0 then  # 
P
plum-lihui 已提交
124 125 126
  return -1
endi

P
plum-lihui 已提交
127
#sql show db.vgroups
128 129
#if $data[0][4] == leader then
#  if $data[0][6] != follower then
P
plum-lihui 已提交
130 131
#    return -1
#  endi
132
#  if $data[0][8] != follower then
P
plum-lihui 已提交
133 134 135
#    return -1
#  endi
#endi
136 137
#if $data[0][6] == leader then
#  if $data[0][4] != follower then
P
plum-lihui 已提交
138 139
#    return -1
#  endi
140
#  if $data[0][8] != follower then
P
plum-lihui 已提交
141 142 143
#    return -1
#  endi
#endi
144 145
#if $data[0][8] == leader then
#  if $data[0][4] != follower then
P
plum-lihui 已提交
146 147
#    return -1
#  endi
148
#  if $data[0][6] != follower then
P
plum-lihui 已提交
149 150 151 152
#    return -1
#  endi
#endi
#
153 154
#if $data[0][4] != leader then
#  if $data[0][4] != follower then
P
plum-lihui 已提交
155 156 157
#    return -1
#  endi
#endi
158 159
#if $data[0][6] != leader then
#  if $data[0][6] != follower then
P
plum-lihui 已提交
160 161 162
#    return -1
#  endi
#endi
163 164
#if $data[0][8] != leader then
#  if $data[0][8] != follower then
P
plum-lihui 已提交
165 166 167
#    return -1
#  endi
#endi
168

P
plum-lihui 已提交
169 170 171 172 173 174 175 176 177 178 179 180
print ============== not support modify options: name, create_time, vgroups, ntables
sql_error alter database db name dba
sql_error alter database db create_time "2022-03-03 15:08:13.329"
sql_error alter database db vgroups -1
sql_error alter database db vgroups 0
sql_error alter database db vgroups 2
sql_error alter database db vgroups 20
sql_error alter database db ntables -1
sql_error alter database db ntables 0
sql_error alter database db ntables 1
sql_error alter database db ntables 10

P
[fixed]  
plum-lihui 已提交
181
#print ============== modify replica        # TD-14409
P
plum-lihui 已提交
182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198
sql_error alter database db replica 2
sql_error alter database db replica 5
sql_error alter database db replica -1
sql_error alter database db replica 0
#sql alter database db replica 1
#sql show databases
#print replica: $data4_db
#if $data4_db != 1 then 
#  return -1
#endi
#sql alter database db replica 3
#sql show databases
#print replica: $data4_db
#if $data4_db != 3 then 
#  return -1
#endi

S
Shengliang Guan 已提交
199 200 201 202 203 204 205 206 207 208 209 210 211
#print ============== modify quorum
#sql alter database db quorum 2
#sql show databases
#print quorum $data5_db
#if $data5_db != 2 then 
#  return -1
#endi
#sql alter database db quorum 1
#sql show databases
#print quorum $data5_db
#if $data5_db != 1 then 
#  return -1
#endi
P
plum-lihui 已提交
212

S
Shengliang Guan 已提交
213 214 215 216 217
#sql_error alter database db quorum -1
#sql_error alter database db quorum 0
#sql_error alter database db quorum 3
#sql_error alter database db quorum 4
#sql_error alter database db quorum 5
P
plum-lihui 已提交
218

219 220 221 222 223
#print ============== modify duration
sql_error alter database db duration 480
sql_error alter database db duration 360
sql_error alter database db duration 0
sql_error alter database db duration 14400  # set over than keep
P
plum-lihui 已提交
224 225

print ============== modify keep
X
Xiaoyu Wang 已提交
226
sql alter database db keep 2400
P
plum-lihui 已提交
227 228
sql show databases
print keep $data7_db
X
Xiaoyu Wang 已提交
229
if $data7_db != 3456000m,3456000m,3456000m then
P
plum-lihui 已提交
230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249
  return -1
endi

#sql alter database db keep 1000,2000
#sql show databases
#print keep $data7_db
#if $data7_db != 500,500,500 then 
#  return -1
#endi

#sql alter database db keep 40,50
#sql alter database db keep 30,31
#sql alter database db keep 20
#sql_error alter database db keep 10.0
#sql_error alter database db keep 9
#sql_error alter database db keep 1
sql_error alter database db keep 0
sql_error alter database db keep -1
#sql_error alter database db keep 365001

X
Xiaoyu Wang 已提交
250 251 252 253 254 255 256 257 258 259 260
#print ============== modify cache
#sql_error alter database db cache 12
#sql_error alter database db cache 1
#sql_error alter database db cache 60
#sql_error alter database db cache 50
#sql_error alter database db cache 20
#sql_error alter database db cache 3
#sql_error alter database db cache 129
#sql_error alter database db cache 300
#sql_error alter database db cache 0
#sql_error alter database db cache -1
P
plum-lihui 已提交
261

X
Xiaoyu Wang 已提交
262 263 264 265 266 267 268 269 270 271 272 273 274
#print ============== modify blocks
#sql alter database db blocks 3
#sql show databases
#print blocks $data9_db
#if $data9_db != 3 then 
#  return -1
#endi
#sql alter database db blocks 11
#sql show databases
#print blocks $data9_db
#if $data9_db != 11 then 
#  return -1
#endi
P
plum-lihui 已提交
275

X
Xiaoyu Wang 已提交
276 277 278 279 280 281 282 283 284
#sql alter database db blocks 40
#sql alter database db blocks 30
#sql alter database db blocks 20
#sql alter database db blocks 10
#sql_error alter database db blocks 2
#sql_error alter database db blocks 1
#sql_error alter database db blocks 0
#sql_error alter database db blocks -1
#sql_error alter database db blocks 10001
P
plum-lihui 已提交
285

P
plum-lihui 已提交
286 287 288 289 290 291
print ============== modify minrows
sql_error alter database db minrows 8
sql_error alter database db minrows 200
sql_error alter database db minrows 11
sql_error alter database db minrows 8000
sql_error alter database db minrows 8001
P
plum-lihui 已提交
292

P
plum-lihui 已提交
293 294 295 296 297
print ============== modify maxrows
sql_error alter database db maxrows 1000
sql_error alter database db maxrows 2000
sql_error alter database db maxrows 11  # equal minrows
sql_error alter database db maxrows 10  # little than minrows
P
plum-lihui 已提交
298 299 300 301

print ============== step wal
sql alter database db wal 1
sql show databases
302 303
print wal $data20_db
if $data20_db != 1 then 
P
plum-lihui 已提交
304 305 306 307
  return -1
endi
sql alter database db wal 2
sql show databases
308 309
print wal $data20_db
if $data20_db != 2 then 
P
plum-lihui 已提交
310 311 312
  return -1
endi

P
[fixed]  
plum-lihui 已提交
313
sql_error alter database db wal 0     # TD-14436
P
plum-lihui 已提交
314 315 316 317 318 319 320
sql_error alter database db wal 3
sql_error alter database db wal 100
sql_error alter database db wal -1

print ============== modify fsync
sql alter database db fsync 2000
sql show databases
321 322
print fsync $data21_db
if $data21_db != 2000 then 
P
plum-lihui 已提交
323 324 325 326
  return -1
endi
sql alter database db fsync 500
sql show databases
327 328
print fsync $data21_db
if $data21_db != 500 then 
P
plum-lihui 已提交
329 330
  return -1
endi
P
plum-lihui 已提交
331
sql alter database db fsync 0
P
plum-lihui 已提交
332
sql show databases
333 334
print fsync $data21_db
if $data21_db != 0 then 
P
plum-lihui 已提交
335 336
  return -1
endi
P
plum-lihui 已提交
337 338
sql_error alter database db fsync 180001
sql_error alter database db fsync -1
P
plum-lihui 已提交
339

P
plum-lihui 已提交
340 341 342 343 344
print ============== modify comp
sql_error alter database db comp 1
sql_error alter database db comp 2
sql_error alter database db comp 1
sql_error alter database db comp 0
P
plum-lihui 已提交
345 346 347 348 349 350
sql_error alter database db comp 3
sql_error alter database db comp 4
sql_error alter database db comp 5
sql_error alter database db comp -1

print ============== modify cachelast [0, 1, 2, 3]
351
sql alter database db cachemodel 'last_value'
P
plum-lihui 已提交
352
sql show databases
353 354
print cachelast $data18_db
if $data18_db != last_value then 
P
plum-lihui 已提交
355 356
  return -1
endi
357
sql alter database db cachemodel 'last_row'
P
plum-lihui 已提交
358
sql show databases
359 360
print cachelast $data18_db
if $data18_db != last_row then 
P
plum-lihui 已提交
361 362
  return -1
endi
363
sql alter database db cachemodel 'none'
P
plum-lihui 已提交
364
sql show databases
365 366
print cachelast $data18_db
if $data18_db != none then 
P
plum-lihui 已提交
367 368
  return -1
endi
369
sql alter database db cachemodel 'last_value'
P
plum-lihui 已提交
370
sql show databases
371 372
print cachelast $data18_db
if $data18_db != last_value then 
P
plum-lihui 已提交
373 374
  return -1
endi
375
sql alter database db cachemodel 'both'
P
plum-lihui 已提交
376
sql show databases
377 378
print cachelast $data18_db
if $data18_db != both then 
P
plum-lihui 已提交
379 380 381
  return -1
endi

P
plum-lihui 已提交
382 383
sql_error alter database db cachelast 4
sql_error alter database db cachelast 10
384
sql_error alter database db cachelast 'other'
P
plum-lihui 已提交
385 386

print ============== modify precision
P
plum-lihui 已提交
387 388 389 390
sql_error alter database db precision 'ms'
sql_error alter database db precision 'us'
sql_error alter database db precision 'ns'
sql_error alter database db precision 'ys'
P
plum-lihui 已提交
391 392
sql_error alter database db prec 'xs'

393 394 395
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