commit.sim 2.5 KB
Newer Older
S
slguan 已提交
1
system sh/stop_dnodes.sh
S
slguan 已提交
2 3

system sh/deploy.sh -n dnode1 -i 1
4
system sh/cfg.sh -n dnode1 -c walLevel -v 1
H
Haojun Liao 已提交
5
system sh/cfg.sh -n dnode1 -c maxTablesperVnode -v 100
S
slguan 已提交
6
system sh/exec.sh -n dnode1 -s start
H
Haojun Liao 已提交
7
sleep 100
S
slguan 已提交
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
sql connect

$dbPrefix = sc_db
$tbPrefix = sc_tb
$stbPrefix = sc_stb
$tbNum = 10
$rowNum = 10000
$totalNum = $tbNum * $rowNum
$loops = 5 
$log = 1
$ts0 = 1537146000000
$delta = 600000
print ========== commit.sim
$i = 0
$db = $dbPrefix . $i
$stb = $stbPrefix . $i

sql drop database $db -x step1
step1:
H
Haojun Liao 已提交
27
sql create database $db maxrows 255 ctime 3600
S
slguan 已提交
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
print ====== create tables
sql use $db
sql create table $stb (ts timestamp, c1 int, c2 bigint, c3 float, c4 double, c5 smallint, c6 tinyint, c7 bool, c8 binary(10), c9 nchar(10)) tags(t1 int)

$i = 0
$ts = $ts0
$halfNum = $tbNum / 2
while $i < $halfNum
  $tbId = $i + $halfNum
  $tb = $tbPrefix . $i
  $tb1 = $tbPrefix . $tbId
  sql create table $tb using $stb tags( $i )
  sql create table $tb1 using $stb tags( $tbId )
 
  $x = 0
  while $x < $rowNum
    $xs = $x * $delta
    $ts = $ts0 + $xs
    $c = $x / 10
    $c = $c * 10
    $c = $x - $c
    $binary = 'binary . $c
    $binary = $binary . '
    $nchar = 'nchar . $c
    $nchar = $nchar . '
H
Haojun Liao 已提交
53
    sql insert into $tb values ( $ts , $c , $c , $c , $c , $c , $c , true, $binary , $nchar )  $tb1 values ( $ts , $c , NULL , $c , NULL , $c , $c , true, $binary , $nchar )
S
slguan 已提交
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
    $x = $x + 1
  endw 

  $i = $i + 1
endw 
print ====== tables created

sql use $db
##### select from table
print ====== select from table and check num of rows returned
$loop = 1
$i = 0
while $loop <= $loops
  print repeat = $loop
  while $i < 10
    sql select count(*) from $stb where t1 = $i 
    if $data00 != $rowNum then
71
      print expect $rowNum, actual: $data00
S
slguan 已提交
72 73 74 75 76 77 78 79 80 81 82 83 84
      return -1
    endi
    $i = $i + 1
  endw
  sql select count(*) from $stb
  if $data00 != $totalNum then
    return -1
  endi
  $loop = $loop + 1
endw

print ================== restart server to commit data into disk
system sh/exec.sh -n dnode1 -s stop -x SIGINT
H
Haojun Liao 已提交
85
sleep 500
S
slguan 已提交
86
system sh/exec.sh -n dnode1 -s start
H
Haojun Liao 已提交
87
sleep 100
S
slguan 已提交
88 89
print ================== server restart completed
sql connect
H
Haojun Liao 已提交
90
sleep 100
S
slguan 已提交
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110

print ====== select from table and check num of rows returned
sql use $db
$loop = 1
$i = 0
while $loop <= $loops
  print repeat = $loop
  while $i < 10
    sql select count(*) from $stb where t1 = $i 
    if $data00 != $rowNum then
      return -1
    endi
    $i = $i + 1
  endw
  sql select count(*) from $stb
  if $data00 != $totalNum then
    return -1
  endi
  $loop = $loop + 1
endw
S
scripts  
Shengliang Guan 已提交
111 112

system sh/exec.sh -n dnode1 -s stop -x SIGINT