alter_option.sim 9.8 KB
Newer Older
P
plum-lihui 已提交
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 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
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

$loop_cnt = 0
check_dnode_ready:
	$loop_cnt = $loop_cnt + 1
	sleep 200
	if $loop_cnt == 10 then
	  print ====> dnode not ready!
		return -1
	endi
sql show dnodes
print ===> $rows $data00 $data01 $data02 $data03 $data04 $data05
if $data00 != 1 then
  return -1
endi
if $data04 != ready then
  goto check_dnode_ready
endi

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

$loop_cnt = 0
check_dnode_ready_1:
	$loop_cnt = $loop_cnt + 1
	sleep 200
	if $loop_cnt == 10 then
	  print ====> dnode not ready!
		return -1
	endi
sql show dnodes
print ===> rows: $rows 
print ===> $data00 $data01 $data02 $data03 $data04 $data05
print ===> $data10 $data11 $data12 $data13 $data14 $data15
print ===> $data20 $data21 $data22 $data23 $data24 $data25
if $data00 != 1 then
  return -1
endi
if $data01 != localhost:7100 then
  return -1
endi
if $data04 != ready then
  goto check_dnode_ready_1
endi
if $data14 != ready then
  goto check_dnode_ready_1
endi
if $data24 != ready then
  goto check_dnode_ready_1
endi

print ============= create database
#database_option: {
61 62
#  | BUFFER value       [3~16384, default: 96]
#  | PAGES value        [64~16384, default: 256]
P
plum-lihui 已提交
63 64 65 66 67 68
#  | CACHELAST value    [0, 1, 2, 3]
#  | FSYNC value        [0 ~ 180000 ms]
#  | KEEP value         [days, 365000]
#  | REPLICA value      [1 | 3]
#  | WAL value          [1 | 2]

X
Xiaoyu Wang 已提交
69
sql create database db CACHELAST 3 COMP 0 DAYS 345600 FSYNC 1000 MAXROWS 8000 MINROWS 10 KEEP 1440000 PRECISION 'ns' REPLICA 1 WAL 2 VGROUPS 6 SINGLE_STABLE 1
P
plum-lihui 已提交
70 71 72 73 74
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
75
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 已提交
76

77
if $rows != 3 then
P
plum-lihui 已提交
78 79 80 81 82 83 84 85 86 87 88
  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
P
plum-lihui 已提交
89
if $data4_db != 1 then  # replica
P
plum-lihui 已提交
90 91
  return -1
endi
S
Shengliang Guan 已提交
92
if $data5_db != nostrict then  # strict
P
plum-lihui 已提交
93 94
  return -1
endi
X
Xiaoyu Wang 已提交
95
if $data6_db != 345600 then  # days
P
plum-lihui 已提交
96 97
  return -1
endi
X
Xiaoyu Wang 已提交
98
if $data7_db != 1440000,1440000,1440000 then # keep
P
plum-lihui 已提交
99 100
  return -1
endi
101 102 103 104 105 106 107 108 109 110
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 已提交
111 112
  return -1
endi
113
if $data12_db != 8000 then  # maxrows
P
plum-lihui 已提交
114 115
  return -1
endi
116
if $data13_db != 2 then  # wal
P
plum-lihui 已提交
117 118
  return -1
endi
119
if $data14_db != 1000 then  # fsync
P
plum-lihui 已提交
120 121
  return -1
endi
122
if $data15_db != 0 then  # comp
P
plum-lihui 已提交
123 124
  return -1
endi
125
if $data16_db != 3 then  # cachelast
P
plum-lihui 已提交
126 127
  return -1
endi
128
if $data17_db != ns then  # precision
P
plum-lihui 已提交
129 130 131
  return -1
endi

132
sleep 3000
P
plum-lihui 已提交
133 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 160 161 162 163 164 165 166 167 168 169 170 171 172 173
#sql show db.vgroups
#if $data[0][4] == LEADER then
#  if $data[0][6] != FOLLOWER then
#    return -1
#  endi
#  if $data[0][8] != FOLLOWER then
#    return -1
#  endi
#endi
#if $data[0][6] == LEADER then
#  if $data[0][4] != FOLLOWER then
#    return -1
#  endi
#  if $data[0][8] != FOLLOWER then
#    return -1
#  endi
#endi
#if $data[0][8] == LEADER then
#  if $data[0][4] != FOLLOWER then
#    return -1
#  endi
#  if $data[0][6] != FOLLOWER then
#    return -1
#  endi
#endi
#
#if $data[0][4] != LEADER then
#  if $data[0][4] != FOLLOWER then
#    return -1
#  endi
#endi
#if $data[0][6] != LEADER then
#  if $data[0][6] != FOLLOWER then
#    return -1
#  endi
#endi
#if $data[0][8] != LEADER then
#  if $data[0][8] != FOLLOWER then
#    return -1
#  endi
#endi
174

P
plum-lihui 已提交
175 176 177 178 179 180 181 182 183 184 185 186
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 已提交
187
#print ============== modify replica        # TD-14409
P
plum-lihui 已提交
188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204
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 已提交
205 206 207 208 209 210 211 212 213 214 215 216 217
#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 已提交
218

S
Shengliang Guan 已提交
219 220 221 222 223
#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 已提交
224 225

#print ============== modify days
P
plum-lihui 已提交
226 227
sql_error alter database db days 480
sql_error alter database db days 360
P
plum-lihui 已提交
228
sql_error alter database db days 0
P
plum-lihui 已提交
229
sql_error alter database db days 14400  # set over than keep
P
plum-lihui 已提交
230 231

print ============== modify keep
X
Xiaoyu Wang 已提交
232
sql alter database db keep 3456000
P
plum-lihui 已提交
233 234
sql show databases
print keep $data7_db
X
Xiaoyu Wang 已提交
235
if $data7_db != 3456000,3456000,3456000 then
P
plum-lihui 已提交
236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255
  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 已提交
256 257 258 259 260 261 262 263 264 265 266
#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 已提交
267

X
Xiaoyu Wang 已提交
268 269 270 271 272 273 274 275 276 277 278 279 280
#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 已提交
281

X
Xiaoyu Wang 已提交
282 283 284 285 286 287 288 289 290
#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 已提交
291

P
plum-lihui 已提交
292 293 294 295 296 297
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 已提交
298

P
plum-lihui 已提交
299 300 301 302 303
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 已提交
304 305 306 307

print ============== step wal
sql alter database db wal 1
sql show databases
308 309
print wal $data13_db
if $data13_db != 1 then 
P
plum-lihui 已提交
310 311 312 313
  return -1
endi
sql alter database db wal 2
sql show databases
314 315
print wal $data13_db
if $data13_db != 2 then 
P
plum-lihui 已提交
316 317 318
  return -1
endi

P
[fixed]  
plum-lihui 已提交
319
sql_error alter database db wal 0     # TD-14436
P
plum-lihui 已提交
320 321 322 323 324 325 326
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
327 328
print fsync $data14_db
if $data14_db != 2000 then 
P
plum-lihui 已提交
329 330 331 332
  return -1
endi
sql alter database db fsync 500
sql show databases
333 334
print fsync $data14_db
if $data14_db != 500 then 
P
plum-lihui 已提交
335 336
  return -1
endi
P
plum-lihui 已提交
337
sql alter database db fsync 0
P
plum-lihui 已提交
338
sql show databases
339 340
print fsync $data14_db
if $data14_db != 0 then 
P
plum-lihui 已提交
341 342
  return -1
endi
P
plum-lihui 已提交
343 344
sql_error alter database db fsync 180001
sql_error alter database db fsync -1
P
plum-lihui 已提交
345

P
plum-lihui 已提交
346 347 348 349 350
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 已提交
351 352 353 354 355 356 357 358
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]
sql alter database db cachelast 2
sql show databases
359 360
print cachelast $data16_db
if $data16_db != 2 then 
P
plum-lihui 已提交
361 362 363 364
  return -1
endi
sql alter database db cachelast 1
sql show databases
365 366
print cachelast $data16_db
if $data16_db != 1 then 
P
plum-lihui 已提交
367 368 369 370
  return -1
endi
sql alter database db cachelast 0
sql show databases
371 372
print cachelast $data16_db
if $data16_db != 0 then 
P
plum-lihui 已提交
373 374 375 376
  return -1
endi
sql alter database db cachelast 2
sql show databases
377 378
print cachelast $data16_db
if $data16_db != 2 then 
P
plum-lihui 已提交
379 380 381 382
  return -1
endi
sql alter database db cachelast 3
sql show databases
383 384
print cachelast $data16_db
if $data16_db != 3 then 
P
plum-lihui 已提交
385 386 387
  return -1
endi

P
plum-lihui 已提交
388 389 390
sql_error alter database db cachelast 4
sql_error alter database db cachelast 10
sql_error alter database db cachelast -1
P
plum-lihui 已提交
391 392

print ============== modify precision
P
plum-lihui 已提交
393 394 395 396
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 已提交
397 398
sql_error alter database db prec 'xs'

399 400 401
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