83 lines
		
	
	
		
			1.7 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
			
		
		
	
	
			83 lines
		
	
	
		
			1.7 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
| system sh/stop_dnodes.sh
 | |
| 
 | |
| system sh/deploy.sh -n dnode1 -i 1
 | |
| system sh/cfg.sh -n dnode1 -c walLevel -v 1
 | |
| system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 5
 | |
| system sh/exec.sh -n dnode1 -s start
 | |
| sleep 100
 | |
| sql connect
 | |
| 
 | |
| $dbPrefix = sav_db
 | |
| $tbPrefix = sav_tb
 | |
| $stbPrefix = sav_stb
 | |
| $tbNum = 20
 | |
| $rowNum = 10
 | |
| $totalNum = $tbNum * $rowNum
 | |
| $ts0 = 1537146000000
 | |
| $delta = 600000
 | |
| print ========== alter.sim
 | |
| $i = 0
 | |
| $db = $dbPrefix
 | |
| $stb = $stbPrefix
 | |
| 
 | |
| sql drop database if exists $db
 | |
| sql create database $db
 | |
| sql use $db
 | |
| print ====== create tables
 | |
| 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
 | |
| while $i < $tbNum
 | |
|   $tb = $tbPrefix . $i
 | |
|   sql create table $tb using $stb tags( $i )
 | |
|  
 | |
|   $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 = '涛思 . $c
 | |
|     $nchar = $nchar . '
 | |
|     sql insert into $tb values ( $ts , $c , $c , $c , $c , $c , $c , true, $binary , $nchar ) 
 | |
|     $x = $x + 1
 | |
|   endw 
 | |
| 
 | |
|   $i = $i + 1
 | |
| endw 
 | |
| print ====== tables created
 | |
| 
 | |
| ##### select * from stb
 | |
| sql select * from $stb
 | |
| if $rows != $totalNum then
 | |
|   return -1
 | |
| endi
 | |
| 
 | |
| ##### select * from $stb with limit
 | |
| sql select * from $stb limit 1 
 | |
| if $rows != 1 then
 | |
|   return -1
 | |
| endi
 | |
| 
 | |
| $limit = $rowNum / 2
 | |
| sql select * from $stb limit $limit
 | |
| if $rows != $limit then
 | |
|   return -1
 | |
| endi
 | |
| 
 | |
| sql select last(*) from $stb where t1 >= 0 group by t1 limit 5
 | |
| if $rows != $tbNum then
 | |
|   return -1
 | |
| endi
 | |
| 
 | |
| sql drop database $db
 | |
| sql show databases
 | |
| if $rows != 0 then 
 | |
|   return -1
 | |
| endi
 | |
| 
 | |
| system sh/exec.sh -n dnode1 -s stop -x SIGINT |