187 lines
3.1 KiB
Plaintext
187 lines
3.1 KiB
Plaintext
system sh/stop_dnodes.sh
|
|
system sh/deploy.sh -n dnode1 -i 1
|
|
system sh/deploy.sh -n dnode2 -i 2
|
|
system sh/exec.sh -n dnode1 -s start
|
|
system sh/exec.sh -n dnode2 -s start
|
|
sql connect
|
|
|
|
print =============== show dnodes
|
|
sql show dnodes;
|
|
print $data[0][0] $data[0][1] $data[0][2] $data[0][3] $data[0][4] $data[0][5] $data[0][6]
|
|
if $rows != 1 then
|
|
return -1
|
|
endi
|
|
|
|
if $data00 != 1 then
|
|
return -1
|
|
endi
|
|
|
|
|
|
sql show mnodes;
|
|
print $data[0][0] $data[0][1] $data[0][2] $data[0][3] $data[0][4] $data[0][5] $data[0][6]
|
|
if $rows != 1 then
|
|
return -1
|
|
endi
|
|
|
|
if $data00 != 1 then
|
|
return -1
|
|
endi
|
|
|
|
if $data02 != leader then
|
|
return -1
|
|
endi
|
|
|
|
print =============== create dnodes
|
|
sql create dnode $hostname port 7200
|
|
sleep 2000
|
|
|
|
sql show dnodes;
|
|
if $rows != 2 then
|
|
return -1
|
|
endi
|
|
|
|
if $data00 != 1 then
|
|
return -1
|
|
endi
|
|
|
|
if $data10 != 2 then
|
|
return -1
|
|
endi
|
|
|
|
# check 'vnodes' feild ?
|
|
#if $data02 != 0 then
|
|
# return -1
|
|
#endi
|
|
|
|
if $data12 != 0 then
|
|
return -1
|
|
endi
|
|
|
|
if $data04 != ready then
|
|
return -1
|
|
endi
|
|
|
|
if $data14 != ready then
|
|
return -1
|
|
endi
|
|
|
|
sql show mnodes;
|
|
if $rows != 1 then
|
|
return -1
|
|
endi
|
|
|
|
if $data00 != 1 then
|
|
return -1
|
|
endi
|
|
|
|
if $data02 != leader then
|
|
return -1
|
|
endi
|
|
|
|
print =============== create database
|
|
sql create database d1 vgroups 4;
|
|
sql create database d2;
|
|
|
|
sql show databases
|
|
if $rows != 4 then
|
|
return -1
|
|
endi
|
|
|
|
sql use d1
|
|
sql show vgroups;
|
|
|
|
if $rows != 4 then
|
|
return -1
|
|
endi
|
|
|
|
print =============== create table
|
|
sql use d1
|
|
|
|
sql create table st (ts timestamp, i int) tags (j int)
|
|
sql show stables
|
|
if $rows != 1 then
|
|
return -1
|
|
endi
|
|
|
|
print $data00 $data01 $data02
|
|
|
|
sql create table c1 using st tags(1)
|
|
sql create table c2 using st tags(2)
|
|
sql create table c3 using st tags(2)
|
|
sql create table c4 using st tags(2)
|
|
sql create table c5 using st tags(2)
|
|
|
|
sql show tables
|
|
print $data00 $data01 $data02
|
|
|
|
if $rows != 5 then
|
|
return -1
|
|
endi
|
|
|
|
print =============== insert data
|
|
sql insert into c1 values(now+1s, 1)
|
|
sql insert into c1 values(now+2s, 2)
|
|
sql insert into c1 values(now+3s, 3)
|
|
sql insert into c2 values(now+1s, 1)
|
|
sql insert into c2 values(now+2s, 2)
|
|
sql insert into c2 values(now+3s, 3)
|
|
sql insert into c3 values(now+1s, 1)
|
|
sql insert into c3 values(now+2s, 2)
|
|
sql insert into c3 values(now+3s, 3)
|
|
sql insert into c4 values(now+1s, 1)
|
|
sql insert into c4 values(now+2s, 2)
|
|
sql insert into c4 values(now+3s, 3)
|
|
sql insert into c5 values(now+1s, 1)
|
|
sql insert into c5 values(now+2s, 2)
|
|
sql insert into c5 values(now+3s, 3)
|
|
|
|
print =============== query data
|
|
sql select * from c1
|
|
if $rows != 3 then
|
|
return -1
|
|
endi
|
|
|
|
print $data00 $data01
|
|
print $data10 $data11
|
|
print $data20 $data11
|
|
|
|
if $data01 != 1 then
|
|
return -1
|
|
endi
|
|
|
|
if $data11 != 2 then
|
|
return -1
|
|
endi
|
|
|
|
if $data21 != 3 then
|
|
return -1
|
|
endi
|
|
|
|
sql select * from c2
|
|
if $rows != 3 then
|
|
return -1
|
|
endi
|
|
|
|
sql select * from c3
|
|
if $rows != 3 then
|
|
return -1
|
|
endi
|
|
|
|
sql select * from c4
|
|
if $rows != 3 then
|
|
return -1
|
|
endi
|
|
|
|
sql select * from c5
|
|
if $rows != 3 then
|
|
return -1
|
|
endi
|
|
|
|
sql select ts, i from st
|
|
if $rows != 15 then
|
|
return -1
|
|
endi
|
|
|
|
system sh/exec.sh -n dnode1 -s stop -x SIGINT
|
|
system sh/exec.sh -n dnode2 -s stop -x SIGINT
|