提交 9284333f 编写于 作者: S Shuduo Sang

Merge branch 'develop' into feature/add-testcase-to-test-boundary

...@@ -115,251 +115,6 @@ TDengine provides abundant developing tools for users to develop on TDengine. Fo ...@@ -115,251 +115,6 @@ TDengine provides abundant developing tools for users to develop on TDengine. Fo
- [RESTful API](https://www.taosdata.com/en/documentation/connector/#RESTful-Connector) - [RESTful API](https://www.taosdata.com/en/documentation/connector/#RESTful-Connector)
- [Node.js](https://www.taosdata.com/en/documentation/connector/#Node.js-Connector) - [Node.js](https://www.taosdata.com/en/documentation/connector/#Node.js-Connector)
# How to run the test cases and how to add a new test case?
### Prepare development environment
1. sudo apt install
build-essential cmake net-tools python-pip python-setuptools python3-pip
python3-setuptools valgrind psmisc curl
2. git clone <https://github.com/taosdata/TDengine>; cd TDengine
3. mkdir debug; cd debug; cmake ..; make ; sudo make install
4. pip install src/connector/python/linux/python2 ; pip3 install
src/connector/python/linux/python3
### How to run TSIM test suite
1. cd \<TDengine\>/tests/script
2. sudo ./test.sh
### How to run Python test suite
1. cd \<TDengine\>/tests/pytest
2. ./smoketest.sh \# for smoke test
3. ./smoketest.sh -g \# for memory leak detection test with valgrind
4. ./fulltest.sh \# for full test
> Note1: TDengine daemon's configuration and data files are stored in
> \<TDengine\>/sim directory. As a historical design, it's same place with
> TSIM script. So after the TSIM script ran with sudo privilege, the directory
> has been used by TSIM then the python script cannot write it by a normal
> user. You need to remove the directory completely first before running the
> Python test case. We should consider using two different locations to store
> for TSIM and Python script.
> Note2: if you need to debug crash problem with a core dump, you need
> manually edit smoketest.sh or fulltest.sh to add "ulimit -c unlimited"
> before the script line. Then you can look for the core file in
> \<TDengine\>/tests/pytest after the program crash.
### How to add a new test case
**1. add a new TSIM test cases:**
TSIM test cases are now included in the new development branch and can be
added to the TDengine/tests/script/test.sh script based on the manual test
methods necessary to add test cases as described above.
**2. add a new Python test cases:**
**2.1 Please refer to \<TDengine\>/tests/pytest/insert/basic.py to add a new
test case.** The new test case must implement 3 functions, where self.init()
and self.stop() simply copy the contents of insert/basic.py and the test
logic is implemented in self.run(). You can refer to the code in the util
directory for more information.
**2.2 Edit smoketest.sh to add the path and filename of the new test case**
Note: The Python test framework may continue to be improved in the future,
hopefully, to provide more functionality and ease of writing test cases. The
method of writing the test case above does not exclude that it will also be
affected.
**2.3 What test.py does in detail:**
test.py is the entry program for test case execution and monitoring.
test.py has the following functions.
\-f --file, Specifies the test case file name to be executed
-p --path, Specifies deployment path
\-m --master, Specifies the master server IP for cluster deployment
-c--cluster, test cluster function
-s--stop, terminates all running nodes
\-g--valgrind, load valgrind for memory leak detection test
\-h--help, display help
**2.4 What util/log.py does in detail:**
log.py is quite simple, the main thing is that you can print the output in
different colors as needed. The success() should be called for successful
test case execution and the success() will print green text. The exit() will
print red text and exit the program, exit() should be called for test
failure.
**util/log.py**
...
    def info(self, info):
        printf("%s %s" % (datetime.datetime.now(), info))
 
    def sleep(self, sec):
        printf("%s sleep %d seconds" % (datetime.datetime.now(), sec))
        time.sleep(sec)
 
    def debug(self, err):
        printf("\\033[1;36m%s %s\\033[0m" % (datetime.datetime.now(), err))
 
    def success(self, info):
        printf("\\033[1;32m%s %s\\033[0m" % (datetime.datetime.now(), info))
 
    def notice(self, err):
        printf("\\033[1;33m%s %s\\033[0m" % (datetime.datetime.now(), err))
 
    def exit(self, err):
        printf("\\033[1;31m%s %s\\033[0m" % (datetime.datetime.now(), err))
        sys.exit(1)
 
    def printNoPrefix(self, info):
        printf("\\033[1;36m%s\\033[0m" % (info)
...
**2.5 What util/sql.py does in detail:**
SQL.py is mainly used to execute SQL statements to manipulate the database,
and the code is extracted and commented as follows:
**util/sql.py**
\# prepare() is mainly used to set up the environment for testing table and
data, and to set up the database db for testing. do not call prepare() if you
need to test the database operation command.
def prepare(self):
tdLog.info("prepare database:db")
self.cursor.execute('reset query cache')
self.cursor.execute('drop database if exists db')
self.cursor.execute('create database db')
self.cursor.execute('use db')
...
\# query() is mainly used to execute select statements for normal syntax input
def query(self, sql):
...
\# error() is mainly used to execute the select statement with the wrong syntax
input, the error will be caught as a reasonable behavior, if not caught it will
prove that the test failed
def error()
...
\# checkRows() is used to check the number of returned lines after calling
query(select ...) after calling the query(select ...) to check the number of
rows of returned results.
def checkRows(self, expectRows):
...
\# checkData() is used to check the returned result data after calling
query(select ...) after the query(select ...) is called, failure to meet
expectation is
def checkData(self, row, col, data):
...
\# getData() returns the result data after calling query(select ...) to return
the resulting data after calling query(select ...)
def getData(self, row, col):
...
\# execute() used to execute sql and return the number of affected rows
def execute(self, sql):
...
\# executeTimes() Multiple executions of the same sql statement
def executeTimes(self, sql, times):
...
\# CheckAffectedRows() Check if the number of affected rows is as expected
def checkAffectedRows(self, expectAffectedRows):
...
> Note: Both Python2 and Python3 are currently supported by the Python test
> case. Since Python2 is no longer officially supported by January 1, 2020, it
> is recommended that subsequent test case development be guaranteed to run
> correctly on Python3. For Python2, please consider being compatible if
> appropriate without additional
> burden. <https://nakedsecurity.sophos.com/2020/01/03/python-is-dead-long-live-python/> 
### CI Covenant submission adoption principle.
- Every commit / PR compilation must pass. Currently, the warning is treated
as an error, so the warning must also be resolved.
- Test cases that already exist must pass.
- Because CI is very important to support build and automatically test
procedure, it is necessary to manually test the test case before adding it
and do as many iterations as possible to ensure that the test case provides
stable and reliable test results when added.
> Note: In the future, according to the requirements and test development
> progress will add stress testing, performance testing, code style,
> and other features based on functional testing.
### Third Party Connectors ### Third Party Connectors
The TDengine community has also kindly built some of their own connectors! Follow the links below to find the source code for them. The TDengine community has also kindly built some of their own connectors! Follow the links below to find the source code for them.
...@@ -367,6 +122,10 @@ The TDengine community has also kindly built some of their own connectors! Follo ...@@ -367,6 +122,10 @@ The TDengine community has also kindly built some of their own connectors! Follo
- [Rust Connector](https://github.com/taosdata/TDengine/tree/master/tests/examples/rust) - [Rust Connector](https://github.com/taosdata/TDengine/tree/master/tests/examples/rust)
- [.Net Core Connector](https://github.com/maikebing/Maikebing.EntityFrameworkCore.Taos) - [.Net Core Connector](https://github.com/maikebing/Maikebing.EntityFrameworkCore.Taos)
# How to run the test cases and how to add a new test case?
TDengine's test framework and all test cases are fully open source.
Please refer to [this document](tests/How-To-Run-Test-And-How-To-Add-New-Test-Case.md) for how to run test and develop new test case.
# TDengine Roadmap # TDengine Roadmap
- Support event-driven stream computing - Support event-driven stream computing
- Support user defined functions - Support user defined functions
......
### Prepare development environment
1. sudo apt install
build-essential cmake net-tools python-pip python-setuptools python3-pip
python3-setuptools valgrind psmisc curl
2. git clone <https://github.com/taosdata/TDengine>; cd TDengine
3. mkdir debug; cd debug; cmake ..; make ; sudo make install
4. pip install src/connector/python/linux/python2 ; pip3 install
src/connector/python/linux/python3
### How to run Python test suite
1. cd \<TDengine\>/tests/pytest
2. ./smoketest.sh \# for smoke test
3. ./smoketest.sh -g \# for memory leak detection test with valgrind
4. ./fulltest.sh \# for full test
> Note1: TDengine daemon's configuration and data files are stored in
> \<TDengine\>/sim directory. As a historical design, it's same place with
> TSIM script. So after the TSIM script ran with sudo privilege, the directory
> has been used by TSIM then the python script cannot write it by a normal
> user. You need to remove the directory completely first before running the
> Python test case. We should consider using two different locations to store
> for TSIM and Python script.
> Note2: if you need to debug crash problem with a core dump, you need
> manually edit smoketest.sh or fulltest.sh to add "ulimit -c unlimited"
> before the script line. Then you can look for the core file in
> \<TDengine\>/tests/pytest after the program crash.
### How to add a new test case
**1. TSIM test cases:**
TSIM was the testing framework has been used internally. Now it still be used to run the test cases we develop in the past as a legacy system. We are turning to use Python to develop new test case and are abandoning TSIM gradually.
**2. Python test cases:**
**2.1 Please refer to \<TDengine\>/tests/pytest/insert/basic.py to add a new
test case.** The new test case must implement 3 functions, where self.init()
and self.stop() simply copy the contents of insert/basic.py and the test
logic is implemented in self.run(). You can refer to the code in the util
directory for more information.
**2.2 Edit smoketest.sh to add the path and filename of the new test case**
Note: The Python test framework may continue to be improved in the future,
hopefully, to provide more functionality and ease of writing test cases. The
method of writing the test case above does not exclude that it will also be
affected.
**2.3 What test.py does in detail:**
test.py is the entry program for test case execution and monitoring.
test.py has the following functions.
\-f --file, Specifies the test case file name to be executed
-p --path, Specifies deployment path
\-m --master, Specifies the master server IP for cluster deployment
-c--cluster, test cluster function
-s--stop, terminates all running nodes
\-g--valgrind, load valgrind for memory leak detection test
\-h--help, display help
**2.4 What util/log.py does in detail:**
log.py is quite simple, the main thing is that you can print the output in
different colors as needed. The success() should be called for successful
test case execution and the success() will print green text. The exit() will
print red text and exit the program, exit() should be called for test
failure.
**util/log.py**
...
    def info(self, info):
        printf("%s %s" % (datetime.datetime.now(), info))
 
    def sleep(self, sec):
        printf("%s sleep %d seconds" % (datetime.datetime.now(), sec))
        time.sleep(sec)
 
    def debug(self, err):
        printf("\\033[1;36m%s %s\\033[0m" % (datetime.datetime.now(), err))
 
    def success(self, info):
        printf("\\033[1;32m%s %s\\033[0m" % (datetime.datetime.now(), info))
 
    def notice(self, err):
        printf("\\033[1;33m%s %s\\033[0m" % (datetime.datetime.now(), err))
 
    def exit(self, err):
        printf("\\033[1;31m%s %s\\033[0m" % (datetime.datetime.now(), err))
        sys.exit(1)
 
    def printNoPrefix(self, info):
        printf("\\033[1;36m%s\\033[0m" % (info)
...
**2.5 What util/sql.py does in detail:**
SQL.py is mainly used to execute SQL statements to manipulate the database,
and the code is extracted and commented as follows:
**util/sql.py**
\# prepare() is mainly used to set up the environment for testing table and
data, and to set up the database db for testing. do not call prepare() if you
need to test the database operation command.
def prepare(self):
tdLog.info("prepare database:db")
self.cursor.execute('reset query cache')
self.cursor.execute('drop database if exists db')
self.cursor.execute('create database db')
self.cursor.execute('use db')
...
\# query() is mainly used to execute select statements for normal syntax input
def query(self, sql):
...
\# error() is mainly used to execute the select statement with the wrong syntax
input, the error will be caught as a reasonable behavior, if not caught it will
prove that the test failed
def error()
...
\# checkRows() is used to check the number of returned lines after calling
query(select ...) after calling the query(select ...) to check the number of
rows of returned results.
def checkRows(self, expectRows):
...
\# checkData() is used to check the returned result data after calling
query(select ...) after the query(select ...) is called, failure to meet
expectation is
def checkData(self, row, col, data):
...
\# getData() returns the result data after calling query(select ...) to return
the resulting data after calling query(select ...)
def getData(self, row, col):
...
\# execute() used to execute sql and return the number of affected rows
def execute(self, sql):
...
\# executeTimes() Multiple executions of the same sql statement
def executeTimes(self, sql, times):
...
\# CheckAffectedRows() Check if the number of affected rows is as expected
def checkAffectedRows(self, expectAffectedRows):
...
> Note: Both Python2 and Python3 are currently supported by the Python test
> case. Since Python2 is no longer officially supported by January 1, 2020, it
> is recommended that subsequent test case development be guaranteed to run
> correctly on Python3. For Python2, please consider being compatible if
> appropriate without additional
> burden. <https://nakedsecurity.sophos.com/2020/01/03/python-is-dead-long-live-python/> 
### CI submission adoption principle.
- Every commit / PR compilation must pass. Currently, the warning is treated
as an error, so the warning must also be resolved.
- Test cases that already exist must pass.
- Because CI is very important to support build and automatically test
procedure, it is necessary to manually test the test case before adding it
and do as many iterations as possible to ensure that the test case provides
stable and reliable test results when added.
> Note: In the future, according to the requirements and test development
> progress will add stress testing, performance testing, code style,
> and other features based on functional testing.
system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1
system sh/deploy.sh -n dnode2 -i 2
system sh/deploy.sh -n dnode3 -i 3
system sh/deploy.sh -n dnode4 -i 4
system sh/cfg.sh -n dnode1 -c walLevel -v 0
system sh/cfg.sh -n dnode2 -c walLevel -v 0
system sh/cfg.sh -n dnode3 -c walLevel -v 0
system sh/cfg.sh -n dnode4 -c walLevel -v 0
system sh/cfg.sh -n dnode1 -c numOfTotalVnodes -v 4
system sh/cfg.sh -n dnode2 -c numOfTotalVnodes -v 4
system sh/cfg.sh -n dnode3 -c numOfTotalVnodes -v 4
system sh/cfg.sh -n dnode4 -c numOfTotalVnodes -v 4
system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 4
system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v 4
system sh/cfg.sh -n dnode3 -c maxtablesPerVnode -v 4
system sh/cfg.sh -n dnode4 -c maxtablesPerVnode -v 4
system sh/exec.sh -n dnode1 -s start
sql connect
sql create dnode $hostname2
sql create dnode $hostname3
sql create dnode $hostname4
system sh/exec.sh -n dnode2 -s start
system sh/exec.sh -n dnode3 -s start
system sh/exec.sh -n dnode4 -s start
$x = 0
createDnode:
$x = $x + 1
sleep 1000
if $x == 20 then
return -1
endi
sql show dnodes;
if $data4_2 == offline then
goto createDnode
endi
if $data4_3 == offline then
goto createDnode
endi
if $data4_4 == offline then
goto createDnode
endi
print ======================== dnode1 start
$dbPrefix = r3v3_db
$tbPrefix = r3v3_tb
$mtPrefix = r3v3_mt
$tbNum = 10
$rowNum = 20
$totalNum = 200
print =============== step1
$i = 0
$db = $dbPrefix . $i
$mt = $mtPrefix . $i
sql create database $db maxTables 4
sql use $db
sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol int)
$i = 0
while $i < $tbNum
$tb = $tbPrefix . $i
sql create table $tb using $mt tags( $i )
$x = 0
while $x < $rowNum
$val = $x * 60000
$ms = 1519833600000 + $val
sql insert into $tb values ($ms , $x )
$x = $x + 1
endw
$i = $i + 1
endw
sql show vgroups
print vgroups ==> $rows
if $rows != 3 then
return -1
endi
sleep 100
print =============== step2
$i = 1
$tb = $tbPrefix . $i
sql select count(*) from $tb
print ===> $data00
if $data00 != $rowNum then
return -1
endi
sql select count(tbcol) from $tb
print ===> $data00
if $data00 != $rowNum then
return -1
endi
print =============== step3
sql select count(tbcol) from $tb where ts <= 1519833840000
print ===> $data00
if $data00 != 5 then
return -1
endi
print =============== step4
sql select count(tbcol) as b from $tb
print ===> $data00
if $data00 != $rowNum then
return -1
endi
print =============== step5
sql select count(tbcol) as b from $tb interval(1m)
print ===> $data01
if $data01 != 1 then
return -1
endi
sql select count(tbcol) as b from $tb interval(1d)
print ===> $data01
if $data01 != $rowNum then
return -1
endi
print =============== step6
sql select count(tbcol) as b from $tb where ts <= 1519833840000 interval(1m)
print ===> $data01
if $data01 != 1 then
return -1
endi
if $rows != 5 then
return -1
endi
print =============== step7
print select count(*) from $mt
sql select count(*) from $mt
print ===> $data00
if $data00 != $totalNum then
return -1
endi
sql select count(tbcol) from $mt
print ===> $data00
if $data00 != $totalNum then
return -1
endi
print =============== step8
sql select count(tbcol) as c from $mt where ts <= 1519833840000
print ===> $data00
if $data00 != 50 then
return -1
endi
sql select count(tbcol) as c from $mt where tgcol < 5
print ===> $data00
if $data00 != 100 then
return -1
endi
sql select count(tbcol) as c from $mt where tgcol < 5 and ts <= 1519833840000
print ===> $data00
if $data00 != 25 then
return -1
endi
print =============== step9
sql select count(tbcol) as b from $mt interval(1m)
print ===> $data01
if $data01 != 10 then
return -1
endi
sql select count(tbcol) as b from $mt interval(1d)
print ===> $data01
if $data01 != 200 then
return -1
endi
print =============== step10
sql select count(tbcol) as b from $mt group by tgcol
print ===> $data00
if $data00 != $rowNum then
return -1
endi
if $rows != $tbNum then
return -1
endi
print =============== step11
sql select count(tbcol) as b from $mt where ts <= 1519833840000 interval(1m) group by tgcol
print ===> $data01
if $data01 != 1 then
return -1
endi
if $rows != 50 then
return -1
endi
print =============== clear
sql drop database $db
sql show databases
if $rows != 0 then
return -1
endi
system sh/exec.sh -n dnode1 -s stop -x SIGINT
system sh/exec.sh -n dnode2 -s stop -x SIGINT
system sh/exec.sh -n dnode3 -s stop -x SIGINT
system sh/exec.sh -n dnode4 -s stop -x SIGINT
system sh/exec.sh -n dnode5 -s stop -x SIGINT
system sh/exec.sh -n dnode6 -s stop -x SIGINT
system sh/exec.sh -n dnode7 -s stop -x SIGINT
system sh/exec.sh -n dnode8 -s stop -x SIGINT
\ No newline at end of file
run general/stable/disk.sim run general/stable/disk.sim
run general/stable/dnode3.sim
run general/stable/metrics.sim run general/stable/metrics.sim
run general/stable/values.sim run general/stable/values.sim
run general/stable/vnode3.sim run general/stable/vnode3.sim
...@@ -85,10 +85,10 @@ cd ../../../debug; make ...@@ -85,10 +85,10 @@ cd ../../../debug; make
./test.sh -f general/import/basic.sim ./test.sh -f general/import/basic.sim
./test.sh -f general/import/commit.sim ./test.sh -f general/import/commit.sim
./test.sh -f general/import/large.sim ./test.sh -f general/import/large.sim
#hongze ./test.sh -f general/import/replica1.sim #liao ./test.sh -f general/import/replica1.sim
./test.sh -f general/insert/basic.sim ./test.sh -f general/insert/basic.sim
#hongze ./test.sh -f general/insert/insert_drop.sim #liao ./test.sh -f general/insert/insert_drop.sim
./test.sh -f general/insert/query_block1_memory.sim ./test.sh -f general/insert/query_block1_memory.sim
./test.sh -f general/insert/query_block2_memory.sim ./test.sh -f general/insert/query_block2_memory.sim
./test.sh -f general/insert/query_block1_file.sim ./test.sh -f general/insert/query_block1_file.sim
...@@ -150,6 +150,7 @@ cd ../../../debug; make ...@@ -150,6 +150,7 @@ cd ../../../debug; make
#./test.sh -f general/parser/bug.sim #./test.sh -f general/parser/bug.sim
./test.sh -f general/stable/disk.sim ./test.sh -f general/stable/disk.sim
#./test.sh -f general/stable/dnode3.sim
./test.sh -f general/stable/metrics.sim ./test.sh -f general/stable/metrics.sim
./test.sh -f general/stable/values.sim ./test.sh -f general/stable/values.sim
./test.sh -f general/stable/vnode3.sim ./test.sh -f general/stable/vnode3.sim
...@@ -251,16 +252,16 @@ cd ../../../debug; make ...@@ -251,16 +252,16 @@ cd ../../../debug; make
./test.sh -u -f unique/column/replica3.sim ./test.sh -u -f unique/column/replica3.sim
#hongze ./test.sh -u -f unique/db/commit.sim #hongze crash ./test.sh -u -f unique/db/commit.sim
./test.sh -u -f unique/db/delete.sim ./test.sh -u -f unique/db/delete.sim
#./test.sh -u -f unique/db/delete_part.sim ./test.sh -u -f unique/db/delete_part.sim
##./test.sh -u -f unique/db/replica_add12.sim ./test.sh -u -f unique/db/replica_add12.sim
##./test.sh -u -f unique/db/replica_add13.sim #hongze crash ./test.sh -u -f unique/db/replica_add13.sim
##./test.sh -u -f unique/db/replica_add23.sim #hongze crash ./test.sh -u -f unique/db/replica_add23.sim
##./test.sh -u -f unique/db/replica_reduce21.sim #hongze crash ./test.sh -u -f unique/db/replica_reduce21.sim
##./test.sh -u -f unique/db/replica_reduce32.sim ./test.sh -u -f unique/db/replica_reduce32.sim
##./test.sh -u -f unique/db/replica_reduce31.sim #hongze crash /test.sh -u -f unique/db/replica_reduce31.sim
##./test.sh -u -f unique/db/replica_part.sim ./test.sh -u -f unique/db/replica_part.sim
##./test.sh -u -f unique/dnode/balance1.sim ##./test.sh -u -f unique/dnode/balance1.sim
##./test.sh -u -f unique/dnode/balance2.sim ##./test.sh -u -f unique/dnode/balance2.sim
...@@ -278,14 +279,14 @@ cd ../../../debug; make ...@@ -278,14 +279,14 @@ cd ../../../debug; make
#./test.sh -u -f unique/import/replica2.sim #./test.sh -u -f unique/import/replica2.sim
#./test.sh -u -f unique/import/replica3.sim #./test.sh -u -f unique/import/replica3.sim
#./test.sh -u -f unique/metrics/balance_replica1.sim #./test.sh -u -f unique/stable/balance_replica1.sim
#./test.sh -u -f unique/metrics/dnode2_stop.sim #./test.sh -u -f unique/stable/dnode2_stop.sim
#./test.sh -u -f unique/metrics/dnode2.sim #./test.sh -u -f unique/stable/dnode2.sim
#./test.sh -u -f unique/metrics/dnode3.sim #./test.sh -u -f unique/stable/dnode3.sim
#./test.sh -u -f unique/metrics/replica2_dnode4.sim #./test.sh -u -f unique/stable/replica2_dnode4.sim
#./test.sh -u -f unique/metrics/replica2_vnode3.sim #./test.sh -u -f unique/stable/replica2_vnode3.sim
#./test.sh -u -f unique/metrics/replica3_dnode6.sim #./test.sh -u -f unique/stable/replica3_dnode6.sim
#./test.sh -u -f unique/metrics/replica3_vnode3.sim #./test.sh -u -f unique/stable/replica3_vnode3.sim
./test.sh -u -f unique/mnode/mgmt22.sim ./test.sh -u -f unique/mnode/mgmt22.sim
./test.sh -u -f unique/mnode/mgmt23.sim ./test.sh -u -f unique/mnode/mgmt23.sim
...@@ -296,13 +297,9 @@ cd ../../../debug; make ...@@ -296,13 +297,9 @@ cd ../../../debug; make
./test.sh -u -f unique/mnode/mgmt34.sim ./test.sh -u -f unique/mnode/mgmt34.sim
./test.sh -u -f unique/mnode/mgmtr2.sim ./test.sh -u -f unique/mnode/mgmtr2.sim
##./test.sh -u -f unique/table/delete_part.sim ./test.sh -u -f unique/vnode/many.sim
#./test.sh -u -f unique/vnode/commit.sim
#./test.sh -u -f unique/vnode/many.sim
#./test.sh -u -f unique/vnode/replica2_basic.sim
./test.sh -u -f unique/vnode/replica2_basic2.sim ./test.sh -u -f unique/vnode/replica2_basic2.sim
#./test.sh -u -f unique/vnode/replica2_repeat.sim ./test.sh -u -f unique/vnode/replica2_repeat.sim
#hongze ./test.sh -u -f unique/vnode/replica3_basic.sim ./test.sh -u -f unique/vnode/replica3_basic.sim
#./test.sh -u -f unique/vnode/replica3_repeat.sim ./test.sh -u -f unique/vnode/replica3_repeat.sim
#./test.sh -u -f unique/vnode/replica3_vgroup.sim ./test.sh -u -f unique/vnode/replica3_vgroup.sim
...@@ -34,13 +34,14 @@ while $i < 2000 ...@@ -34,13 +34,14 @@ while $i < 2000
$i = $i + 1 $i = $i + 1
endw endw
sleep 2500
sql show db.vgroups sql show db.vgroups
if $rows != 2 then if $rows != 2 then
return -1 return -1
endi endi
print ======== step2 print ======== step2
sleep 1000
sql drop database db sql drop database db
sql show databases sql show databases
if $rows != 0 then if $rows != 0 then
......
...@@ -45,27 +45,126 @@ begin: ...@@ -45,27 +45,126 @@ begin:
sql create database $db sql create database $db
sql use $db sql use $db
$x = 0 sql create table t11 (ts timestamp, i int)
while $x < 32 sql insert into t11 values(now, 1 )
$tb = tb . $x sql create table t12 (ts timestamp, i int)
sql create table $tb (ts timestamp, i int) sql insert into t12 values(now, 1 )
sql insert into $tb values(now, $x ) sql create table t13 (ts timestamp, i int)
$x = $x + 1 sql insert into t13 values(now, 1 )
endw sql create table t14 (ts timestamp, i int)
sql insert into t14 values(now, 1 )
sleep 1200
sql create table t21 (ts timestamp, i int)
sql insert into t21 values(now, 1 )
sql create table t22 (ts timestamp, i int)
sql insert into t22 values(now, 1 )
sql create table t23 (ts timestamp, i int)
sql insert into t23 values(now, 1 )
sql create table t24 (ts timestamp, i int)
sql insert into t24 values(now, 1 )
sleep 1200
sql create table t31 (ts timestamp, i int)
sql insert into t31 values(now, 1 )
sql create table t32 (ts timestamp, i int)
sql insert into t32 values(now, 1 )
sql create table t33 (ts timestamp, i int)
sql insert into t33 values(now, 1 )
sql create table t34 (ts timestamp, i int)
sql insert into t34 values(now, 1 )
sleep 1200
sql create table t41 (ts timestamp, i int)
sql insert into t41 values(now, 1 )
sql create table t42 (ts timestamp, i int)
sql insert into t42 values(now, 1 )
sql create table t43 (ts timestamp, i int)
sql insert into t43 values(now, 1 )
sql create table t44 (ts timestamp, i int)
sql insert into t44 values(now, 1 )
sleep 1200
sql create table t51 (ts timestamp, i int)
sql insert into t51 values(now, 1 )
sql create table t52 (ts timestamp, i int)
sql insert into t52 values(now, 1 )
sql create table t53 (ts timestamp, i int)
sql insert into t53 values(now, 1 )
sql create table t54 (ts timestamp, i int)
sql insert into t54 values(now, 1 )
sleep 1200
sql create table t61 (ts timestamp, i int)
sql insert into t61 values(now, 1 )
sql create table t62 (ts timestamp, i int)
sql insert into t62 values(now, 1 )
sql create table t63 (ts timestamp, i int)
sql insert into t63 values(now, 1 )
sql create table t64 (ts timestamp, i int)
sql insert into t64 values(now, 1 )
sleep 1200
sql create table t71 (ts timestamp, i int)
sql insert into t71 values(now, 1 )
sql create table t72 (ts timestamp, i int)
sql insert into t72 values(now, 1 )
sql create table t73 (ts timestamp, i int)
sql insert into t73 values(now, 1 )
sql create table t74 (ts timestamp, i int)
sql insert into t74 values(now, 1 )
sleep 1200
sql create table t81 (ts timestamp, i int)
sql insert into t81 values(now, 1 )
sql create table t82 (ts timestamp, i int)
sql insert into t82 values(now, 1 )
sql create table t83 (ts timestamp, i int)
sql insert into t83 values(now, 1 )
sql create table t84 (ts timestamp, i int)
sql insert into t84 values(now, 1 )
sleep 1200
sql show dnodes
print dnode1 openVnodes $data2_1
print dnode2 openVnodes $data2_2
if $data2_1 != 4 then
return -1
endi
if $data2_2 != 4 then
return -1
endi
print ======== step2 $loop print ======== step2 $loop
system sh/exec_up.sh -n dnode2 -s stop system sh/exec_up.sh -n dnode2 -s stop
sleep 1000 sleep 1000
print ==> drop database $db
sql drop database $db sql drop database $db
print ======== step3 $loop print ======== step3 $loop
sleep 3000 sleep 2000
system sh/exec_up.sh -n dnode2 -s start system sh/exec_up.sh -n dnode2 -s start
sleep 5000 sleep 15000
sql show dnodes
print dnode1 openVnodes $data2_1 $data4_1
print dnode2 openVnodes $data2_2 $data4_2
if $data2_1 != 0 then
return -1
endi
if $data2_2 != 0 then
return -1
endi
if $data4_1 != ready then
return -1
endi
if $data4_2 != ready then
return -1
endi
print ===> test times : $loop print ===> test times : $loop
if $loop > 5 then if $loop > 3 then
return 0 return 0
endi endi
......
...@@ -7,9 +7,9 @@ system sh/deploy.sh -n dnode3 -i 3 ...@@ -7,9 +7,9 @@ system sh/deploy.sh -n dnode3 -i 3
system sh/cfg.sh -n dnode1 -c wallevel -v 2 system sh/cfg.sh -n dnode1 -c wallevel -v 2
system sh/cfg.sh -n dnode2 -c wallevel -v 2 system sh/cfg.sh -n dnode2 -c wallevel -v 2
system sh/cfg.sh -n dnode3 -c wallevel -v 2 system sh/cfg.sh -n dnode3 -c wallevel -v 2
system sh/cfg.sh -n dnode1 -c numOfMPeers -v 2 system sh/cfg.sh -n dnode1 -c numOfMPeers -v 1
system sh/cfg.sh -n dnode2 -c numOfMPeers -v 2 system sh/cfg.sh -n dnode2 -c numOfMPeers -v 1
system sh/cfg.sh -n dnode3 -c numOfMPeers -v 2 system sh/cfg.sh -n dnode3 -c numOfMPeers -v 1
system sh/cfg.sh -n dnode1 -c mgmtEqualVnodeNum -v 4 system sh/cfg.sh -n dnode1 -c mgmtEqualVnodeNum -v 4
system sh/cfg.sh -n dnode2 -c mgmtEqualVnodeNum -v 4 system sh/cfg.sh -n dnode2 -c mgmtEqualVnodeNum -v 4
system sh/cfg.sh -n dnode3 -c mgmtEqualVnodeNum -v 4 system sh/cfg.sh -n dnode3 -c mgmtEqualVnodeNum -v 4
......
...@@ -204,7 +204,7 @@ system_content curl -u root:taosdata -d '[{"metric": "sys_mem","timestamp": 134 ...@@ -204,7 +204,7 @@ system_content curl -u root:taosdata -d '[{"metric": "sys_mem","timestamp": 134
print $system_content print $system_content
if $system_content != @{"failed":1,"success":1}@ then if $system_content != @{"failed":0,"success":2}@ then
return -1 return -1
endi endi
......
system sh/stop_dnodes.sh system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1 system sh/deploy.sh -n dnode1 -i 1
system sh/deploy.sh -n dnode2 -i 2 system sh/deploy.sh -n dnode2 -i 2
system sh/cfg.sh -n dnode1 -c numOfTotalVnodes -v 4 system sh/cfg.sh -n dnode1 -c numOfTotalVnodes -v 4
...@@ -26,7 +23,7 @@ $totalNum = 200 ...@@ -26,7 +23,7 @@ $totalNum = 200
print ============== step1 print ============== step1
print ========= start dnode1 print ========= start dnode1
system sh/exec.sh -n dnode1 -s start system sh/exec_up.sh -n dnode1 -s start
sql connect sql connect
$i = 0 $i = 0
...@@ -81,7 +78,7 @@ if $dnode2Vnodes != NULL then ...@@ -81,7 +78,7 @@ if $dnode2Vnodes != NULL then
endi endi
print =============== step3 start dnode2 print =============== step3 start dnode2
sql create dnode $hostname2 sql create dnode $hostname2
system sh/exec.sh -n dnode2 -s start system sh/exec_up.sh -n dnode2 -s start
sleep 8000 sleep 8000
$x = 0 $x = 0
......
system sh/stop_dnodes.sh system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1 system sh/deploy.sh -n dnode1 -i 1
system sh/deploy.sh -n dnode2 -i 2 system sh/deploy.sh -n dnode2 -i 2
system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/cfg.sh -n dnode1 -c walLevel -v 0
...@@ -10,12 +7,12 @@ system sh/cfg.sh -n dnode1 -c numOfTotalVnodes -v 4 ...@@ -10,12 +7,12 @@ system sh/cfg.sh -n dnode1 -c numOfTotalVnodes -v 4
system sh/cfg.sh -n dnode2 -c numOfTotalVnodes -v 4 system sh/cfg.sh -n dnode2 -c numOfTotalVnodes -v 4
system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 4 system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 4
system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v 4 system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v 4
system sh/exec.sh -n dnode1 -s start system sh/exec_up.sh -n dnode1 -s start
sql connect sql connect
sql create dnode $hostname2 sql create dnode $hostname2
system sh/exec.sh -n dnode2 -s start system sh/exec_up.sh -n dnode2 -s start
$x = 0 $x = 0
createDnode: createDnode:
...@@ -25,7 +22,7 @@ createDnode: ...@@ -25,7 +22,7 @@ createDnode:
return -1 return -1
endi endi
sql show dnodes; sql show dnodes;
if $data4_192.168.0.2 == offline then if $data4_2 == offline then
goto createDnode goto createDnode
endi endi
......
system sh/stop_dnodes.sh system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1 system sh/deploy.sh -n dnode1 -i 1
system sh/deploy.sh -n dnode2 -i 2 system sh/deploy.sh -n dnode2 -i 2
system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/cfg.sh -n dnode1 -c walLevel -v 0
...@@ -10,11 +7,11 @@ system sh/cfg.sh -n dnode1 -c numOfTotalVnodes -v 4 ...@@ -10,11 +7,11 @@ system sh/cfg.sh -n dnode1 -c numOfTotalVnodes -v 4
system sh/cfg.sh -n dnode2 -c numOfTotalVnodes -v 4 system sh/cfg.sh -n dnode2 -c numOfTotalVnodes -v 4
system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 4 system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 4
system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v 4 system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v 4
system sh/exec.sh -n dnode1 -s start system sh/exec_up.sh -n dnode1 -s start
sql connect sql connect
sql create dnode $hostname2 sql create dnode $hostname2
system sh/exec.sh -n dnode2 -s start system sh/exec_up.sh -n dnode2 -s start
$x = 0 $x = 0
createDnode: createDnode:
...@@ -24,7 +21,7 @@ createDnode: ...@@ -24,7 +21,7 @@ createDnode:
return -1 return -1
endi endi
sql show dnodes; sql show dnodes;
if $data4_192.168.0.2 == offline then if $data4_2 == offline then
goto createDnode goto createDnode
endi endi
...@@ -76,7 +73,7 @@ endi ...@@ -76,7 +73,7 @@ endi
sleep 100 sleep 100
system sh/exec.sh -n dnode2 -s stop -x SIGINT system sh/exec_up.sh -n dnode2 -s stop -x SIGINT
print =============== step2 print =============== step2
sql select count(*) from $mt -x step2 sql select count(*) from $mt -x step2
...@@ -87,7 +84,7 @@ sql select count(tbcol) from $mt -x step21 ...@@ -87,7 +84,7 @@ sql select count(tbcol) from $mt -x step21
return -1 return -1
step21: step21:
system sh/exec.sh -n dnode2 -s start system sh/exec_up.sh -n dnode2 -s start
sleep 10000 sleep 10000
print =============== step3 print =============== step3
......
system sh/stop_dnodes.sh system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1 system sh/deploy.sh -n dnode1 -i 1
system sh/deploy.sh -n dnode2 -i 2 system sh/deploy.sh -n dnode2 -i 2
system sh/deploy.sh -n dnode3 -i 3 system sh/deploy.sh -n dnode3 -i 3
...@@ -15,14 +11,14 @@ system sh/cfg.sh -n dnode3 -c numOfTotalVnodes -v 4 ...@@ -15,14 +11,14 @@ system sh/cfg.sh -n dnode3 -c numOfTotalVnodes -v 4
system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 4 system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 4
system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v 4 system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v 4
system sh/cfg.sh -n dnode3 -c maxtablesPerVnode -v 4 system sh/cfg.sh -n dnode3 -c maxtablesPerVnode -v 4
system sh/exec.sh -n dnode1 -s start system sh/exec_up.sh -n dnode1 -s start
sql connect sql connect
sql create dnode $hostname2 sql create dnode $hostname2
system sh/exec.sh -n dnode2 -s start system sh/exec_up.sh -n dnode2 -s start
sql create dnode $hostname3 sql create dnode $hostname3
system sh/exec.sh -n dnode3 -s start system sh/exec_up.sh -n dnode3 -s start
$x = 0 $x = 0
createDnode: createDnode:
...@@ -32,10 +28,10 @@ createDnode: ...@@ -32,10 +28,10 @@ createDnode:
return -1 return -1
endi endi
sql show dnodes; sql show dnodes;
if $data4_192.168.0.2 == offline then if $data4_2 == offline then
goto createDnode goto createDnode
endi endi
if $data4_192.168.0.3 == offline then if $data4_3 == offline then
goto createDnode goto createDnode
endi endi
......
system sh/stop_dnodes.sh system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1 system sh/deploy.sh -n dnode1 -i 1
system sh/deploy.sh -n dnode2 -i 2 system sh/deploy.sh -n dnode2 -i 2
system sh/deploy.sh -n dnode3 -i 3 system sh/deploy.sh -n dnode3 -i 3
...@@ -20,16 +15,16 @@ system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 4 ...@@ -20,16 +15,16 @@ system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 4
system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v 4 system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v 4
system sh/cfg.sh -n dnode3 -c maxtablesPerVnode -v 4 system sh/cfg.sh -n dnode3 -c maxtablesPerVnode -v 4
system sh/cfg.sh -n dnode4 -c maxtablesPerVnode -v 4 system sh/cfg.sh -n dnode4 -c maxtablesPerVnode -v 4
system sh/exec.sh -n dnode1 -s start system sh/exec_up.sh -n dnode1 -s start
sql connect sql connect
sql create dnode $hostname2 sql create dnode $hostname2
sql create dnode $hostname3 sql create dnode $hostname3
sql create dnode $hostname4 sql create dnode $hostname4
system sh/exec.sh -n dnode2 -s start system sh/exec_up.sh -n dnode2 -s start
system sh/exec.sh -n dnode3 -s start system sh/exec_up.sh -n dnode3 -s start
system sh/exec.sh -n dnode4 -s start system sh/exec_up.sh -n dnode4 -s start
$x = 0 $x = 0
createDnode: createDnode:
...@@ -39,13 +34,13 @@ createDnode: ...@@ -39,13 +34,13 @@ createDnode:
return -1 return -1
endi endi
sql show dnodes; sql show dnodes;
if $data4_192.168.0.2 == offline then if $data4_2 == offline then
goto createDnode goto createDnode
endi endi
if $data4_192.168.0.3 == offline then if $data4_3 == offline then
goto createDnode goto createDnode
endi endi
if $data4_192.168.0.4 == offline then if $data4_4 == offline then
goto createDnode goto createDnode
endi endi
......
system sh/stop_dnodes.sh system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1 system sh/deploy.sh -n dnode1 -i 1
system sh/deploy.sh -n dnode2 -i 2 system sh/deploy.sh -n dnode2 -i 2
system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/cfg.sh -n dnode1 -c walLevel -v 0
...@@ -10,11 +7,11 @@ system sh/cfg.sh -n dnode1 -c numOfTotalVnodes -v 4 ...@@ -10,11 +7,11 @@ system sh/cfg.sh -n dnode1 -c numOfTotalVnodes -v 4
system sh/cfg.sh -n dnode2 -c numOfTotalVnodes -v 4 system sh/cfg.sh -n dnode2 -c numOfTotalVnodes -v 4
system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 4 system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 4
system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v 4 system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v 4
system sh/exec.sh -n dnode1 -s start system sh/exec_up.sh -n dnode1 -s start
sql connect sql connect
sql create dnode $hostname2 sql create dnode $hostname2
system sh/exec.sh -n dnode2 -s start system sh/exec_up.sh -n dnode2 -s start
$x = 0 $x = 0
createDnode: createDnode:
...@@ -24,7 +21,7 @@ createDnode: ...@@ -24,7 +21,7 @@ createDnode:
return -1 return -1
endi endi
sql show dnodes; sql show dnodes;
if $data4_192.168.0.2 == offline then if $data4_2 == offline then
goto createDnode goto createDnode
endi endi
......
system sh/stop_dnodes.sh system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1 system sh/deploy.sh -n dnode1 -i 1
system sh/deploy.sh -n dnode2 -i 2 system sh/deploy.sh -n dnode2 -i 2
system sh/deploy.sh -n dnode3 -i 3 system sh/deploy.sh -n dnode3 -i 3
...@@ -35,7 +27,7 @@ system sh/cfg.sh -n dnode4 -c maxtablesPerVnode -v 4 ...@@ -35,7 +27,7 @@ system sh/cfg.sh -n dnode4 -c maxtablesPerVnode -v 4
system sh/cfg.sh -n dnode5 -c maxtablesPerVnode -v 4 system sh/cfg.sh -n dnode5 -c maxtablesPerVnode -v 4
system sh/cfg.sh -n dnode6 -c maxtablesPerVnode -v 4 system sh/cfg.sh -n dnode6 -c maxtablesPerVnode -v 4
system sh/exec.sh -n dnode1 -s start system sh/exec_up.sh -n dnode1 -s start
sql connect sql connect
sql create dnode $hostname2 sql create dnode $hostname2
...@@ -43,11 +35,11 @@ sql create dnode $hostname3 ...@@ -43,11 +35,11 @@ sql create dnode $hostname3
sql create dnode $hostname4 sql create dnode $hostname4
sql create dnode $hostname5 sql create dnode $hostname5
sql create dnode $hostname6 sql create dnode $hostname6
system sh/exec.sh -n dnode2 -s start system sh/exec_up.sh -n dnode2 -s start
system sh/exec.sh -n dnode3 -s start system sh/exec_up.sh -n dnode3 -s start
system sh/exec.sh -n dnode4 -s start system sh/exec_up.sh -n dnode4 -s start
system sh/exec.sh -n dnode5 -s start system sh/exec_up.sh -n dnode5 -s start
system sh/exec.sh -n dnode6 -s start system sh/exec_up.sh -n dnode6 -s start
$x = 0 $x = 0
createDnode: createDnode:
...@@ -57,19 +49,19 @@ createDnode: ...@@ -57,19 +49,19 @@ createDnode:
return -1 return -1
endi endi
sql show dnodes; sql show dnodes;
if $data4_192.168.0.2 == offline then if $data4_2 == offline then
goto createDnode goto createDnode
endi endi
if $data4_192.168.0.3 == offline then if $data4_3 == offline then
goto createDnode goto createDnode
endi endi
if $data4_192.168.0.4 == offline then if $data4_4 == offline then
goto createDnode goto createDnode
endi endi
if $data4_192.168.0.5 == offline then if $data4_5 == offline then
goto createDnode goto createDnode
endi endi
if $data4_192.168.0.6 == offline then if $data4_6 == offline then
goto createDnode goto createDnode
endi endi
......
system sh/stop_dnodes.sh system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1 system sh/deploy.sh -n dnode1 -i 1
system sh/deploy.sh -n dnode2 -i 2 system sh/deploy.sh -n dnode2 -i 2
system sh/deploy.sh -n dnode3 -i 3 system sh/deploy.sh -n dnode3 -i 3
...@@ -20,16 +16,16 @@ system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 4 ...@@ -20,16 +16,16 @@ system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 4
system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v 4 system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v 4
system sh/cfg.sh -n dnode3 -c maxtablesPerVnode -v 4 system sh/cfg.sh -n dnode3 -c maxtablesPerVnode -v 4
system sh/cfg.sh -n dnode4 -c maxtablesPerVnode -v 4 system sh/cfg.sh -n dnode4 -c maxtablesPerVnode -v 4
system sh/exec.sh -n dnode1 -s start system sh/exec_up.sh -n dnode1 -s start
sql connect sql connect
sql create dnode $hostname2 sql create dnode $hostname2
sql create dnode $hostname3 sql create dnode $hostname3
sql create dnode $hostname4 sql create dnode $hostname4
system sh/exec.sh -n dnode2 -s start system sh/exec_up.sh -n dnode2 -s start
system sh/exec.sh -n dnode3 -s start system sh/exec_up.sh -n dnode3 -s start
system sh/exec.sh -n dnode4 -s start system sh/exec_up.sh -n dnode4 -s start
$x = 0 $x = 0
createDnode: createDnode:
$x = $x + 1 $x = $x + 1
...@@ -38,13 +34,13 @@ createDnode: ...@@ -38,13 +34,13 @@ createDnode:
return -1 return -1
endi endi
sql show dnodes; sql show dnodes;
if $data4_192.168.0.2 == offline then if $data4_2 == offline then
goto createDnode goto createDnode
endi endi
if $data4_192.168.0.3 == offline then if $data4_3 == offline then
goto createDnode goto createDnode
endi endi
if $data4_192.168.0.4 == offline then if $data4_4 == offline then
goto createDnode goto createDnode
endi endi
...@@ -144,6 +140,7 @@ if $rows != 5 then ...@@ -144,6 +140,7 @@ if $rows != 5 then
endi endi
print =============== step7 print =============== step7
print select count(*) from $mt
sql select count(*) from $mt sql select count(*) from $mt
print ===> $data00 print ===> $data00
if $data00 != $totalNum then if $data00 != $totalNum then
...@@ -208,7 +205,7 @@ endi ...@@ -208,7 +205,7 @@ endi
if $rows != 50 then if $rows != 50 then
return -1 return -1
endi endi
return
print =============== clear print =============== clear
sql drop database $db sql drop database $db
sql show databases sql show databases
......
sql connect
$x = 1
begin:
sql insert into db.tb values(now, $x ) -x begin
#print ===> insert successed $x
$x = $x + 1
goto begin
\ No newline at end of file
system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1
system sh/deploy.sh -n dnode2 -i 2
system sh/deploy.sh -n dnode3 -i 3
system sh/deploy.sh -n dnode4 -i 4
system sh/cfg.sh -n dnode1 -c walLevel -v 0
system sh/cfg.sh -n dnode2 -c walLevel -v 0
system sh/cfg.sh -n dnode3 -c walLevel -v 0
system sh/cfg.sh -n dnode4 -c walLevel -v 0
system sh/cfg.sh -n dnode1 -c numOfMPeers -v 1
system sh/cfg.sh -n dnode2 -c numOfMPeers -v 1
system sh/cfg.sh -n dnode3 -c numOfMPeers -v 1
system sh/cfg.sh -n dnode4 -c numOfMPeers -v 1
system sh/cfg.sh -n dnode1 -c mgmtEqualVnodeNum -v 4
system sh/cfg.sh -n dnode2 -c mgmtEqualVnodeNum -v 4
system sh/cfg.sh -n dnode3 -c mgmtEqualVnodeNum -v 4
system sh/cfg.sh -n dnode4 -c mgmtEqualVnodeNum -v 4
system sh/cfg.sh -n dnode1 -c numOfTotalVnodes -v 4
system sh/cfg.sh -n dnode2 -c numOfTotalVnodes -v 4
system sh/cfg.sh -n dnode3 -c numOfTotalVnodes -v 4
system sh/cfg.sh -n dnode4 -c numOfTotalVnodes -v 4
system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 4
system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v 4
system sh/cfg.sh -n dnode3 -c maxtablesPerVnode -v 4
system sh/cfg.sh -n dnode4 -c maxtablesPerVnode -v 4
print ========= start dnodes
system sh/exec.sh -n dnode1 -s start
sql connect
sql create dnode $hostname2
system sh/exec.sh -n dnode2 -s start
sleep 3000
sql create database dpdb
sql use dpdb
$loop = 0
begin:
print ======== step1
$x = 0
while $x < 16
$tb = tb . $x
sql create table $tb (ts timestamp, i int)
sql insert into $tb values(now, $x )
$x = $x + 1
endw
print ======== step2
system sh/exec.sh -n dnode2 -s stop
$x = 0
while $x < 16
$tb = tb . $x
sql drop table $tb
$x = $x + 1
endw
print ======== step3
sleep 2000
system sh/exec.sh -n dnode2 -s start
sleep 3000
print ===> test times : $loop
if $loop > 20 then
return 0
endi
$loop = $loop + 1
goto begin
system sh/exec_up.sh -n dnode1 -s stop -x SIGINT
system sh/exec_up.sh -n dnode2 -s stop -x SIGINT
system sh/exec_up.sh -n dnode3 -s stop -x SIGINT
system sh/exec_up.sh -n dnode4 -s stop -x SIGINT
system sh/exec_up.sh -n dnode5 -s stop -x SIGINT
system sh/exec_up.sh -n dnode6 -s stop -x SIGINT
system sh/exec_up.sh -n dnode7 -s stop -x SIGINT
system sh/exec_up.sh -n dnode8 -s stop -x SIGINT
\ No newline at end of file
#################################
run unique/mnode/testSuite.sim
##################################
system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1
system sh/deploy.sh -n dnode2 -i 2
system sh/cfg.sh -n dnode1 -c wallevel -v 2
system sh/cfg.sh -n dnode2 -c wallevel -v 2
system sh/cfg.sh -n dnode1 -c numofMpeers -v 3
system sh/cfg.sh -n dnode2 -c numofMpeers -v 3
system sh/exec_up.sh -n dnode1 -s start
sql connect
sql create dnode $hostname2
system sh/exec_up.sh -n dnode2 -s start
sleep 3000
print =================== step 1 create db
sql create database c2db replica 2 days 10 keep 50
sql use c2db
sql create table tb (ts timestamp, speed int)
sql insert into tb values(now, 0)
print =================== step2 sleep 2000 and kill dnode2(SIGINT)
sleep 2000
system sh/exec_up.sh -n dnode2 -s stop -x SIGINT
sleep 1000
print =================== step3 insert into dnode1
$x = 1
while $x < 100
$time = $x . m
sql insert into tb values (now + $time , $x )
$x = $x + 1
endw
$x = 240
while $x < 400
$time = $x . m
sql insert into tb values (now + $time , $x )
$x = $x + 1
endw
$x = 480
while $x < 700
$time = $x . m
sql insert into tb values (now + $time , $x )
$x = $x + 1
endw
$x = 720
while $x < 809
$time = $x . m
sql insert into tb values (now + $time , $x )
$x = $x + 1
endw
$x = 960
while $x < 1043
$time = $x . m
sql insert into tb values (now + $time , $x )
$x = $x + 1
endw
$x = 1200
while $x < 1244
$time = $x . m
sql insert into tb values (now + $time , $x )
$x = $x + 1
endw
$x = 1440
while $x < 1677
$time = $x . m
sql insert into tb values (now + $time , $x )
$x = $x + 1
endw
$x = 1680
while $x < 1683
$time = $x . m
sql insert into tb values (now + $time , $x )
$x = $x + 1
endw
print =================== step4
sql select count(*) from tb
print select count(*) from tb ==> $data00 (expect 936)
if $data00 != 936 then
return -1
endi
sql select * from tb order by ts desc
print select * from tb ==> $data00 $data01 $rows
if $data01 != 1682 then
return -1
endi
if $rows != 936 then
return -1
endi
print =================== step5 sleep kill dnode1(SIGINT) then start dnode1
system sh/exec_up.sh -n dnode1 -s stop -x SIGINT
sleep 5000
system sh/exec_up.sh -n dnode1 -s start
sleep 3000
print =================== step6 start dnode2 and sleep 10000 (wait sync complete)
system sh/exec_up.sh -n dnode2 -s start
sleep 12000
print =================== step7
sql_error insert into tb values(now + 1000h, 100)
sql select count(*) from tb order by ts desc
print select count(*) from tb ==> $data00 (expect <= 936)
if $data00 != 936 then
return -1
endi
$remainRows = $data00
sql select * from tb order by ts desc
print select * from tb ==> $data00 $data01 $data10 $data11 $rows
if $data11 != 1681 then
return -1
endi
if $rows != $remainRows then
return -1
endi
print =================== step8 kill dnode1(SIGINT) and query
system sh/exec_up.sh -n dnode1 -s stop -x SIGINT
sleep 2000
print =================== step9
sql select count(*) from tb order by ts desc
print select count(*) from tb ==> $data00 (expect == $remainRows )
if $data00 > $remainRows then
return -1
endi
if $data00 <= 0 then
return -1
endi
$remainRows = $data00
sql select * from tb order by ts desc
print select * from tb ==> $data00 $data01 $rows
if $rows != $remainRows then
return -1
endi
system sh/exec_up.sh -n dnode1 -s stop -x SIGINT
system sh/exec_up.sh -n dnode2 -s stop -x SIGINT
system sh/exec_up.sh -n dnode3 -s stop -x SIGINT
system sh/exec_up.sh -n dnode4 -s stop -x SIGINT
system sh/exec_up.sh -n dnode5 -s stop -x SIGINT
system sh/exec_up.sh -n dnode6 -s stop -x SIGINT
system sh/exec_up.sh -n dnode7 -s stop -x SIGINT
system sh/exec_up.sh -n dnode8 -s stop -x SIGINT
...@@ -53,27 +53,27 @@ sql select count(*) from db4.tb4 ...@@ -53,27 +53,27 @@ sql select count(*) from db4.tb4
$lastRows4 = $rows $lastRows4 = $rows
print ======== step2 print ======== step2
run_back cluster/vnode/back_insert_many.sim run_back unique/vnode/back_insert_many.sim
sleep 5000 sleep 5000
print ======== step3 print ======== step3
system sh/exec_up.sh -n dnode2 -s stop system sh/exec_up.sh -n dnode2 -s stop
sleep 10000 sleep 5000
$x = 0 $x = 0
loop: loop:
print ======== step4 print ======== step4
system sh/exec_up.sh -n dnode2 -s start system sh/exec_up.sh -n dnode2 -s start
sleep 10000 sleep 5000
system sh/exec_up.sh -n dnode3 -s stop system sh/exec_up.sh -n dnode3 -s stop
sleep 10000 sleep 5000
print ======== step5 print ======== step5
system sh/exec_up.sh -n dnode3 -s start system sh/exec_up.sh -n dnode3 -s start
sleep 10000 sleep 5000
system sh/exec_up.sh -n dnode2 -s stop system sh/exec_up.sh -n dnode2 -s stop
sleep 10000 sleep 5000
print ======== step6 print ======== step6
sql select count(*) from db1.tb1 sql select count(*) from db1.tb1
...@@ -108,7 +108,7 @@ print ======== step7 ...@@ -108,7 +108,7 @@ print ======== step7
print ======== loop Times $x print ======== loop Times $x
if $x < 5 then if $x < 2 then
$x = $x + 1 $x = $x + 1
goto loop goto loop
endi endi
......
system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1
system sh/deploy.sh -n dnode2 -i 2
system sh/cfg.sh -n dnode1 -c wallevel -v 2
system sh/cfg.sh -n dnode2 -c wallevel -v 2
system sh/cfg.sh -n dnode1 -c numofMpeers -v 3
system sh/cfg.sh -n dnode2 -c numofMpeers -v 3
system sh/exec_up.sh -n dnode1 -s start
sql connect
sql create dnode $hostname2
system sh/exec_up.sh -n dnode2 -s start
sleep 3000
$N = 10
$db = d1
$table = table_r2
print =================== step 1
sql create database $db replica 3
sql use $db
sql create table $table (ts timestamp, speed int) -x error_create
return -1
error_create:
sql drop database $db
print =================== step 2
sql create database $db replica 2
sql use $db
sql create table $table (ts timestamp, speed int)
sleep 1000
print =================== step 3
$x = 1
$y = $x + $N
$expect = $N
while $x < $y
$ms = $x . m
sql insert into $table values (now + $ms , $x )
$x = $x + 1
endw
sql select * from $table
print sql select * from $table -> $rows points
if $rows != $expect then
return -1
endi
print =================== step 4
system sh/exec_up.sh -n dnode2 -s stop
sleep 2000
$y = $x + $N
$expect = $N * 2
while $x < $y
$ms = $x . m
sql insert into $table values (now + $ms , $x )
$x = $x + 1
endw
sql select * from $table
print sql select * from $table -> $rows points
if $rows != $expect then
return -1
endi
print =================== step 5
system sh/exec_up.sh -n dnode2 -s start
sleep 2000
$y = $x + $N
$expect = $N * 3
while $x < $y
$ms = $x . m
sql insert into $table values (now + $ms , $x )
$x = $x + 1
endw
sql select * from $table
print sql select * from $table -> $rows points
if $rows != $expect then
return -1
endi
print =================== step 6
system sh/exec_up.sh -n dnode1 -s stop
sleep 2000
$y = $x + $N
$expect = $N * 4
while $x < $y
$ms = $x . m
sql insert into $table values (now + $ms , $x )
$x = $x + 1
endw
sql select * from $table
print sql select * from $table -> $rows points
if $rows != $expect then
return -1
endi
print =================== step 7
system sh/exec_up.sh -n dnode1 -s start
sleep 2000
$y = $x + $N
$expect = $N * 5
while $x < $y
$ms = $x . m
sql insert into $table values (now + $ms , $x )
$x = $x + 1
endw
sql select * from $table
print sql select * from $table -> $rows points
if $rows != $expect then
return -1
endi
print =================== step 8
system sh/ip.sh -i 1 -s down
sleep 2000
$y = $x + $N
$expect = $N * 6
while $x < $y
$ms = $x . m
sql insert into $table values (now + $ms , $x )
$x = $x + 1
endw
sql select * from $table
print sql select * from $table -> $rows points
if $rows != $expect then
return -1
endi
print =================== step 9
sleep 2000
$y = $x + $N
$expect = $N * 7
while $x < $y
$ms = $x . m
sql insert into $table values (now + $ms , $x )
$x = $x + 1
endw
sql select * from $table
print sql select * from $table -> $rows points
if $rows != $expect then
return -1
endi
print =================== step 10
system sh/ip.sh -i 2 -s down
sleep 2000
$y = $x + $N
$expect = $N * 8
while $x < $y
$ms = $x . m
sql insert into $table values (now + $ms , $x )
$x = $x + 1
endw
sql select * from $table
print sql select * from $table -> $rows points
if $rows != $expect then
return -1
endi
print =================== step 11
sleep 2000
$y = $x + $N
$expect = $N * 9
while $x < $y
$ms = $x . m
sql insert into $table values (now + $ms , $x )
$x = $x + 1
endw
sql select * from $table
print sql select * from $table -> $rows points
if $rows != $expect then
return -1
endi
print =================== step 12
system sh/exec_up.sh -n dnode1 -s stop -x SIGINT
system sh/exec_up.sh -n dnode2 -s stop -x SIGINT
system sh/exec_up.sh -n dnode3 -s stop -x SIGINT
system sh/exec_up.sh -n dnode4 -s stop -x SIGINT
system sh/exec_up.sh -n dnode5 -s stop -x SIGINT
system sh/exec_up.sh -n dnode6 -s stop -x SIGINT
system sh/exec_up.sh -n dnode7 -s stop -x SIGINT
system sh/exec_up.sh -n dnode8 -s stop -x SIGINT
\ No newline at end of file
...@@ -33,7 +33,7 @@ sql select count(*) from db.tb ...@@ -33,7 +33,7 @@ sql select count(*) from db.tb
$lastRows = $rows $lastRows = $rows
print ======== step2 print ======== step2
run_back cluster/vnode/back_insert.sim run_back unique/vnode/back_insert.sim
sleep 3000 sleep 3000
print ======== step3 print ======== step3
...@@ -66,7 +66,7 @@ print ======== step7 ...@@ -66,7 +66,7 @@ print ======== step7
$lastRows = $data00 $lastRows = $data00
print ======== loop Times $x print ======== loop Times $x
if $x < 5 then if $x < 2 then
$x = $x + 1 $x = $x + 1
goto loop goto loop
endi endi
......
...@@ -36,7 +36,7 @@ sql select count(*) from db.tb ...@@ -36,7 +36,7 @@ sql select count(*) from db.tb
$lastRows = $rows $lastRows = $rows
print ======== step2 print ======== step2
run_back cluster/vnode/back_insert.sim run_back unique/vnode/back_insert.sim
sleep 3000 sleep 3000
print ======== step3 print ======== step3
...@@ -75,7 +75,7 @@ print ======== step8 ...@@ -75,7 +75,7 @@ print ======== step8
$lastRows = $data00 $lastRows = $data00
print ======== loop Times $x print ======== loop Times $x
if $x < 5 then if $x < 2 then
$x = $x + 1 $x = $x + 1
goto loop goto loop
endi endi
......
...@@ -33,7 +33,7 @@ sleep 3001 ...@@ -33,7 +33,7 @@ sleep 3001
$tbPre = m $tbPre = m
$N = 280 $N = 300
$x = 0 $x = 0
$y = $x + $N $y = $x + $N
while $x < $y while $x < $y
...@@ -46,20 +46,20 @@ endw ...@@ -46,20 +46,20 @@ endw
#print =================== step 2 #print =================== step 2
#$x = 1 $x = -500
#$y = $x + $N $y = $x + $N
#$expect = $N while $x < $y
#while $x < $y $ms = $x . m
# $ms = $x . m sql insert into $table values (now $ms , $x )
# sql insert into $table values (now + $ms , $x ) $x = $x + 1
# $x = $x + 1 endw
#endw
#sql select * from $table $expect = $N + 1
#print sql select * from $table -> $rows points sql select * from $table
#if $rows != $expect then print sql select * from $table -> $rows points expect $expect
# return -1 if $rows != $expect then
#endi return -1
endi
system sh/exec_up.sh -n dnode1 -s stop -x SIGINT system sh/exec_up.sh -n dnode1 -s stop -x SIGINT
system sh/exec_up.sh -n dnode2 -s stop -x SIGINT system sh/exec_up.sh -n dnode2 -s stop -x SIGINT
......
run unique/vnode/commit.sim
run unique/vnode/many.sim run unique/vnode/many.sim
run unique/vnode/replica2_basic.sim
run unique/vnode/replica2_basic2.sim run unique/vnode/replica2_basic2.sim
run unique/vnode/replica2_repeat.sim run unique/vnode/replica2_repeat.sim
run unique/vnode/replica3_basic.sim run unique/vnode/replica3_basic.sim
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册