vgroup.sim 3.0 KB
Newer Older
S
slguan 已提交
1 2
system sh/stop_dnodes.sh

S
slguan 已提交
3 4

system sh/deploy.sh -n dnode1 -i 1
S
slguan 已提交
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 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 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
system sh/cfg.sh -n dnode1 -c commitLog -v 0
system sh/cfg.sh -n dnode1 -c numOfTotalVnodes -v 4
system sh/exec.sh -n dnode1 -s start

sleep 3000
sql connect
print ============================ dnode1 start

$i = 0
$dbPrefix = ob_vg_db
$tbPrefix = ob_vg_tb
$db = $dbPrefix . $i
$tb = $tbPrefix . $i

print =================== step 1
sql create database $db tables 4
sql use $db
sql show vgroups
if $rows != 0 then 
  return -1
endi

sql create table table1 (ts timestamp, speed int)
sql create table table2 (ts timestamp, speed int)
sql create table table3 (ts timestamp, speed int)
sql create table table4 (ts timestamp, speed int)
sql show vgroups
if $rows != 1 then 
  return -1
endi

sql create table table5 (ts timestamp, speed int)
sql create table table6 (ts timestamp, speed int)
sql create table table7 (ts timestamp, speed int)
sql create table table8 (ts timestamp, speed int)
sql show vgroups
if $rows != 2 then 
  return -1
endi

sql create table table9 (ts timestamp, speed int)
sql create table table10 (ts timestamp, speed int)
sql create table table11 (ts timestamp, speed int)
sql create table table12 (ts timestamp, speed int)
sql show vgroups
if $rows != 3 then 
  return -1
endi

sql create table table13 (ts timestamp, speed int)
sql show vgroups
if $rows != 4 then 
  return -1
endi

sql drop table table13
sql show vgroups
if $rows != 3 then 
  return -1
endi

sql create table table13 (ts timestamp, speed int)
sql show vgroups
if $rows != 4 then 
  return -1
endi

print =================== step 2
$i = 1
$db = $dbPrefix . $i

sql create database $db 
sql use $db
sql show vgroups
if $rows != 0 then 
  return -1
endi

sql create table table1 (ts timestamp, speed int) -x error2
	return -1
error2:

$i = 0
$db = $dbPrefix . $i
sql drop database $db

$i = 1
$db = $dbPrefix . $i
sql use $db
sql create table table2 (ts timestamp, speed int)
sql show vgroups
if $rows != 1 then 
  return -1
endi

sql drop table table2
sql show vgroups
if $rows != 0 then 
  return -1
endi

sql create table table1 (ts timestamp, speed int)
sql create table table2 (ts timestamp, speed int)
sql create table table3 (ts timestamp, speed int)
sql create table table4 (ts timestamp, speed int)
sql drop table table1
sql show vgroups
if $rows != 1 then 
  return -1
endi

print =================== step 3
$i = 0
$db = $dbPrefix . $i
sql create database $db
sql use $db
sql create table table1 (ts timestamp, speed int)

$i = 2
$db = $dbPrefix . $i
sql create database $db
sql use $db
sql create table table3 (ts timestamp, speed int)

$i = 3
$db = $dbPrefix . $i
sql create database $db
sql use $db
sql create table table4 (ts timestamp, speed int)

$i = 4
$db = $dbPrefix . $i
sql create database $db
sql use $db
sql create table table5 (ts timestamp, speed int) -x error3
	return -1
error3:

sql show databases
if $rows != 5 then 
  return -1
endi

$i = 0
while $i < 5
  $db = $dbPrefix . $i  
  sql drop database $db 
  $i = $i + 1
endw
sql show databases
if $rows != 0 then 
  return -1
endi