alter_option.sim 10.6 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
	  print ====> dnode not ready!
		return -1
	endi
X
Xiaoyu Wang 已提交
21
sql select * from information_schema.ins_dnodes
P
plum-lihui 已提交
22 23 24
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: {
H
Hongze Cheng 已提交
41
#  | BUFFER value       [3~16384, default: 256]
42
#  | PAGES value        [64~16384, default: 256]
43
#  | CACHEMODEL value   ['node', 'last_row', 'last_value', 'both']
X
Xiaoyu Wang 已提交
44
#  | WAL_FSYNC_PERIOD value        [0 ~ 180000 ms]
45
#  | KEEP value         [duration, 365000]
P
plum-lihui 已提交
46
#  | REPLICA value      [1 | 3]
X
Xiaoyu Wang 已提交
47
#  | WAL_LEVEL value          [1 | 2]
P
plum-lihui 已提交
48

X
Xiaoyu Wang 已提交
49
sql create database db CACHEMODEL 'both' COMP 0 DURATION 240 WAL_FSYNC_PERIOD 1000 MAXROWS 8000 MINROWS 10 KEEP 1000 PRECISION 'ns' REPLICA 3 WAL_LEVEL 2 VGROUPS 6 SINGLE_STABLE 1
X
Xiaoyu Wang 已提交
50
sql select * from information_schema.ins_databases
P
plum-lihui 已提交
51 52 53 54
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 != on 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
H
Hongze Cheng 已提交
81
if $data8_db != 256 then  # buffer
82 83 84 85 86 87 88 89 90
  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
X
Xiaoyu Wang 已提交
102
if $data18_db != both then  # cachemodel
P
plum-lihui 已提交
103 104
  return -1
endi
105
if $data19_db != 1 then  # cash_size
P
plum-lihui 已提交
106 107
  return -1
endi
X
Xiaoyu Wang 已提交
108
if $data20_db != 2 then  # wal_level level
109 110
  return -1
endi
X
Xiaoyu Wang 已提交
111
if $data21_db != 1000 then  # wal_level fsyncperiod
112 113
  return -1
endi
114
if $data22_db != 0 then  # wal_retention_period
115 116
  return -1
endi
117
if $data23_db != 0 then  # wal_retention_size
118 119
  return -1
endi
120
if $data24_db != 0 then  # wal_roll_period
121 122
  return -1
endi
123
if $data25_db != 0 then  # wal_segment_size
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
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
X
Xiaoyu Wang 已提交
187
#sql select * from information_schema.ins_databases
P
plum-lihui 已提交
188
#print replica: $data4_db
G
Ganlin Zhao 已提交
189
#if $data4_db != 1 then
P
plum-lihui 已提交
190 191 192
#  return -1
#endi
#sql alter database db replica 3
X
Xiaoyu Wang 已提交
193
#sql select * from information_schema.ins_databases
P
plum-lihui 已提交
194
#print replica: $data4_db
G
Ganlin Zhao 已提交
195
#if $data4_db != 3 then
P
plum-lihui 已提交
196 197 198
#  return -1
#endi

S
Shengliang Guan 已提交
199 200
#print ============== modify quorum
#sql alter database db quorum 2
X
Xiaoyu Wang 已提交
201
#sql select * from information_schema.ins_databases
S
Shengliang Guan 已提交
202
#print quorum $data5_db
G
Ganlin Zhao 已提交
203
#if $data5_db != 2 then
S
Shengliang Guan 已提交
204 205 206
#  return -1
#endi
#sql alter database db quorum 1
X
Xiaoyu Wang 已提交
207
#sql select * from information_schema.ins_databases
S
Shengliang Guan 已提交
208
#print quorum $data5_db
G
Ganlin Zhao 已提交
209
#if $data5_db != 1 then
S
Shengliang Guan 已提交
210 211
#  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
X
Xiaoyu Wang 已提交
227
sql select * from information_schema.ins_databases
P
plum-lihui 已提交
228
print keep $data7_db
X
Xiaoyu Wang 已提交
229
if $data7_db != 3456000m,3456000m,3456000m then
P
plum-lihui 已提交
230 231 232 233
  return -1
endi

#sql alter database db keep 1000,2000
X
Xiaoyu Wang 已提交
234
#sql select * from information_schema.ins_databases
P
plum-lihui 已提交
235
#print keep $data7_db
G
Ganlin Zhao 已提交
236
#if $data7_db != 500,500,500 then
P
plum-lihui 已提交
237 238 239 240 241 242 243 244 245 246 247 248 249
#  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
#print ============== modify blocks
#sql alter database db blocks 3
X
Xiaoyu Wang 已提交
264
#sql select * from information_schema.ins_databases
X
Xiaoyu Wang 已提交
265
#print blocks $data9_db
G
Ganlin Zhao 已提交
266
#if $data9_db != 3 then
X
Xiaoyu Wang 已提交
267 268 269
#  return -1
#endi
#sql alter database db blocks 11
X
Xiaoyu Wang 已提交
270
#sql select * from information_schema.ins_databases
X
Xiaoyu Wang 已提交
271
#print blocks $data9_db
G
Ganlin Zhao 已提交
272
#if $data9_db != 11 then
X
Xiaoyu Wang 已提交
273 274
#  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

X
Xiaoyu Wang 已提交
299 300
print ============== step wal_level
sql alter database db wal_level 1
X
Xiaoyu Wang 已提交
301
sql select * from information_schema.ins_databases
X
Xiaoyu Wang 已提交
302
print wal_level $data20_db
G
Ganlin Zhao 已提交
303
if $data20_db != 1 then
P
plum-lihui 已提交
304 305
  return -1
endi
X
Xiaoyu Wang 已提交
306
sql alter database db wal_level 2
X
Xiaoyu Wang 已提交
307
sql select * from information_schema.ins_databases
X
Xiaoyu Wang 已提交
308
print wal_level $data20_db
G
Ganlin Zhao 已提交
309
if $data20_db != 2 then
P
plum-lihui 已提交
310 311 312
  return -1
endi

X
Xiaoyu Wang 已提交
313 314 315 316
sql_error alter database db wal_level 0     # TD-14436
sql_error alter database db wal_level 3
sql_error alter database db wal_level 100
sql_error alter database db wal_level -1
P
plum-lihui 已提交
317

X
Xiaoyu Wang 已提交
318 319
print ============== modify wal_fsync_period
sql alter database db wal_fsync_period 2000
X
Xiaoyu Wang 已提交
320
sql select * from information_schema.ins_databases
X
Xiaoyu Wang 已提交
321
print wal_fsync_period $data21_db
G
Ganlin Zhao 已提交
322
if $data21_db != 2000 then
P
plum-lihui 已提交
323 324
  return -1
endi
X
Xiaoyu Wang 已提交
325
sql alter database db wal_fsync_period 500
X
Xiaoyu Wang 已提交
326
sql select * from information_schema.ins_databases
X
Xiaoyu Wang 已提交
327
print wal_fsync_period $data21_db
G
Ganlin Zhao 已提交
328
if $data21_db != 500 then
P
plum-lihui 已提交
329 330
  return -1
endi
X
Xiaoyu Wang 已提交
331
sql alter database db wal_fsync_period 0
X
Xiaoyu Wang 已提交
332
sql select * from information_schema.ins_databases
X
Xiaoyu Wang 已提交
333
print wal_fsync_period $data21_db
G
Ganlin Zhao 已提交
334
if $data21_db != 0 then
P
plum-lihui 已提交
335 336
  return -1
endi
X
Xiaoyu Wang 已提交
337 338
sql_error alter database db wal_fsync_period 180001
sql_error alter database db wal_fsync_period -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'
X
Xiaoyu Wang 已提交
352
sql select * from information_schema.ins_databases
353
print cachelast $data18_db
G
Ganlin Zhao 已提交
354
if $data18_db != last_value then
P
plum-lihui 已提交
355 356
  return -1
endi
357
sql alter database db cachemodel 'last_row'
X
Xiaoyu Wang 已提交
358
sql select * from information_schema.ins_databases
359
print cachelast $data18_db
G
Ganlin Zhao 已提交
360
if $data18_db != last_row then
P
plum-lihui 已提交
361 362
  return -1
endi
363
sql alter database db cachemodel 'none'
X
Xiaoyu Wang 已提交
364
sql select * from information_schema.ins_databases
365
print cachelast $data18_db
G
Ganlin Zhao 已提交
366
if $data18_db != none then
P
plum-lihui 已提交
367 368
  return -1
endi
369
sql alter database db cachemodel 'last_value'
X
Xiaoyu Wang 已提交
370
sql select * from information_schema.ins_databases
371
print cachelast $data18_db
G
Ganlin Zhao 已提交
372
if $data18_db != last_value then
P
plum-lihui 已提交
373 374
  return -1
endi
375
sql alter database db cachemodel 'both'
X
Xiaoyu Wang 已提交
376
sql select * from information_schema.ins_databases
377
print cachelast $data18_db
G
Ganlin Zhao 已提交
378
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