client1_0.sim 2.2 KB
Newer Older
H
Hui Li 已提交
1 2 3 4 5 6 7 8 9 10 11
#system sh/stop_dnodes.sh
#system sh/deploy.sh -n dnode1 -i 1
#system sh/cfg.sh -n dnode5 -c maxtablesPerVnode -v 10000
#system sh/exec.sh -n dnode1 -s start
#sql connect
#$db = db1
#sql create database $db
#sql use $db
#$stb = stb1
#sql create table $stb (ts timestamp, c1 int) tags(t1 int, t2 binary(8))

H
Hui Li 已提交
12
$tblStart = 0
H
Hui Li 已提交
13
$tblEnd = 1000
H
Hui Li 已提交
14 15 16
$tsStart = 1325347200000  # 2012-01-01 00:00:00.000
###############################################################

H
Hui Li 已提交
17 18 19 20 21 22 23
sql connect

$db = db1
$stb = stb1

sql use $db

H
Hui Li 已提交
24 25 26 27 28 29 30 31
######sql create table $stb (ts timestamp, c1 int) tags(t1 int, t2 binary(8))
$tagPrex = ' . tag

$i = $tblStart
while $i < $tblEnd
  $tb = tb . $i
  $tagBinary = $tagPrex . $i
  $tagBinary = $tagBinary . '
H
Hui Li 已提交
32 33
#  print create table if not exists $tb using $stb tags ( $i , $tagBinary )
  sql create table if not exists $tb using $stb tags ( $i , $tagBinary )
H
Hui Li 已提交
34 35 36 37
  $i = $i + 1
endw 

print ====================== client1_0 create table end, start insert data ............
H
Hui Li 已提交
38 39 40
sql select count(tbname) from $stb
print select count(tbname) from $stb
print data00 $data00
H
Hui Li 已提交
41 42 43 44 45 46

$rowsPerLoop = 100
$ts = $tsStart

$i = $tblStart
while $i < $tblEnd
H
Hui Li 已提交
47
  $tb = tb . $i
H
Hui Li 已提交
48 49 50 51 52 53 54 55
  $x = 0
  while $x < $rowsPerLoop
    sql insert into $tb values ( $ts + 0a , $x ) ( $ts + 2a , $x ) ( $ts + 4a , $x ) ( $ts + 6a , $x ) ( $ts + 8a , $x ) ( $ts + 10a , $x ) ( $ts + 12a , $x ) ( $ts + 14a , $x ) ( $ts + 16a , $x ) ( $ts + 18a , $x ) ( $ts + 20a , $x ) ( $ts + 22a , $x ) ( $ts + 24a , $x ) ( $ts + 26a , $x ) ( $ts + 28a , $x ) ( $ts + 30a , $x ) ( $ts + 32a , $x ) ( $ts + 34a , $x ) ( $ts + 36a , $x ) ( $ts + 38a , $x )
    $x = $x + 20
    $ts = $ts + 40a
  endw 

  $totalRows = $totalRows + $x
H
Hui Li 已提交
56
  $i = $i + 1
H
Hui Li 已提交
57 58 59 60 61 62 63 64 65 66 67 68
  
  if $i == $tblEnd then
    $i = $tblStart
    
    sql select count(*) from $stb -x continue_loop
    print data00 $data00 totalRows $totalRows
    if $data00 < $totalRows then
	    print **********************  select error **********************
    endi
    continue_loop:
    print ====================== client1_0  insert data complete once ............
  endi
H
Hui Li 已提交
69
endw 
H
Hui Li 已提交
70
print ====================== client1_0  success and auto end =====================