client-01.sim 2.3 KB
Newer Older
H
Hui Li 已提交
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 61 62 63 64 65 66 67 68 69
# create database db1
# create table tb ()
# loop insert seq data
###############################################################
################ set script parameters ################
$tblStart = 0
$tblEnd   = 10000
$tsStart  = 1325347200000  # 2012-01-01 00:00:00.000
$preBinary = ' . client-01-
###############################################################

sql connect

print ================ create db
$db = db
sql create database if not exists $db replica 2
sql use $db

print ================ create table $tb (ts timestamp, c1 int, c2 binary(16))

$i = $tblStart
while $i < $tblEnd
  $tb = tb . $i
#  print create table if not exists $tb ( ts timestamp , c1 int , c2 binary(16) )
  sql create table if not exists $tb ( ts timestamp , c1 int , c2 binary(16) )
  $i = $i + 1
endw 

$totalRows   = 0
$rowsPerTbl  = 0
$ts          = $tsStart
$rowsPerLoop = 160

$loop_cnt = 0
loop_run:
print ================ client-01 start loop insert data ( loop_cnt: $loop_cnt )
$i  = $tblStart
while $i < $tblEnd
  $tb = tb . $i
  
  $c2Binary = $preBinary . $i
  $c2Binary = $c2Binary . '

  $x = 0
  while $x < $rowsPerLoop
    sql insert into $tb values ( $ts + 0a , $x , $c2Binary ) ( $ts + 2a , $x , $c2Binary ) ( $ts + 4a , $x , $c2Binary ) ( $ts + 6a , $x , $c2Binary ) ( $ts + 8a , $x , $c2Binary ) ( $ts + 10a , $x , $c2Binary ) ( $ts + 12a , $x , $c2Binary ) ( $ts + 14a , $x , $c2Binary ) ( $ts + 16a , $x , $c2Binary ) ( $ts + 18a , $x , $c2Binary ) ( $ts + 20a , $x , $c2Binary ) ( $ts + 22a , $x , $c2Binary ) ( $ts + 24a , $x , $c2Binary ) ( $ts + 26a , $x , $c2Binary ) ( $ts + 28a , $x , $c2Binary ) ( $ts + 30a , $x , $c2Binary ) ( $ts + 32a , $x , $c2Binary ) ( $ts + 34a , $x , $c2Binary ) ( $ts + 36a , $x , $c2Binary ) ( $ts + 38a , $x , $c2Binary )
    $x = $x + 20
    $ts = $ts + 40a
  endw 
  if $i == $tblStart then
    $rowsPerTbl = $rowsPerTbl + $x   
  endi

  $totalRows = $totalRows + $x
  $i = $i + 1
  
endw 

sql select count(*) from $tb
if $data00 != $rowsPerTbl then
  print data00 $data00 rowsPerTbl $rowsPerTbl
  print ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  print ************ client-01 insert data error ***** *****
  print ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  return -1
endi

$loop_cnt = $loop_cnt + 1
goto loop_run