提交 9d4aabfe 编写于 作者: P plum-lihui

test: modfiy test cases of tmq

上级 12285212
#### test scenario, please refer to https://jira.taosdata.com:18090/pages/viewpage.action?pageId=135120406 #### test scenario, please refer to https://jira.taosdata.com:18090/pages/viewpage.action?pageId=135120406
#basic1.sim: vgroups=1, one topic for one consumer, firstly insert data, then start consume. Include six topics #basic1.sim: vgroups=1, one topic for one consumer, firstly insert data, then start consume. Include six topics
#basic2.sim: vgroups=1, multi topics for one consumer, firstly insert data, then start consume. Include six topics #basic2.sim: vgroups=1, multi topics for one consumer, firstly insert data, then start consume. Include six topics
#basic3.sim: vgroups=4, one topic for one consumer, firstly insert data, then start consume. Include six topics #basic3.sim: vgroups=4, one topic for one consumer, firstly insert data, then start consume. Include six topics
#basic4.sim: vgroups=4, multi topics for one consumer, firstly insert data, then start consume. Include six topics #basic4.sim: vgroups=4, multi topics for one consumer, firstly insert data, then start consume. Include six topics
# notes1: Scalar function: ABS/ACOS/ASIN/ATAN/CEIL/COS/FLOOR/LOG/POW/ROUND/SIN/SQRT/TAN # notes1: Scalar function: ABS/ACOS/ASIN/ATAN/CEIL/COS/FLOOR/LOG/POW/ROUND/SIN/SQRT/TAN
# The above use cases are combined with where filter conditions, such as: where ts > "2017-08-12 18:25:58.128Z" and sin(a) > 0.5; # The above use cases are combined with where filter conditions, such as: where ts > "2017-08-12 18:25:58.128Z" and sin(a) > 0.5;
# #
# notes2: not support aggregate functions(such as sum/count/min/max) and time-windows(interval). # notes2: not support aggregate functions(such as sum/count/min/max) and time-windows(interval).
# #
run tsim/tmq/prepareBasicEnv-1vgrp.sim run tsim/tmq/prepareBasicEnv-1vgrp.sim
#---- global parameters start ----# #---- global parameters start ----#
$dbName = db $dbName = db
$vgroups = 1 $vgroups = 1
$stbPrefix = stb $stbPrefix = stb
$ctbPrefix = ctb $ctbPrefix = ctb
$ntbPrefix = ntb $ntbPrefix = ntb
$stbNum = 1 $stbNum = 1
$ctbNum = 10 $ctbNum = 10
$ntbNum = 10 $ntbNum = 10
$rowsPerCtb = 10 $rowsPerCtb = 10
$tstart = 1640966400000 # 2022-01-01 00:00:00.000 $tstart = 1640966400000 # 2022-01-01 00:00:00.000
#---- global parameters end ----# #---- global parameters end ----#
$pullDelay = 3 $pullDelay = 3
$ifcheckdata = 1 $ifcheckdata = 1
$showMsg = 1 $ifmanualcommit = 1
$showRow = 0 $showMsg = 1
$showRow = 0
sql connect
sql use $dbName sql connect
sql use $dbName
print == create topics from super table
sql create topic topic_stb_column as select ts, c3 from stb print == create topics from super table
sql create topic topic_stb_all as select ts, c1, c2, c3 from stb sql create topic topic_stb_column as select ts, c3 from stb
sql create topic topic_stb_function as select ts, abs(c1), sin(c2) from stb sql create topic topic_stb_all as select ts, c1, c2, c3 from stb
sql create topic topic_stb_function as select ts, abs(c1), sin(c2) from stb
print == create topics from child table
sql create topic topic_ctb_column as select ts, c3 from ctb0 print == create topics from child table
sql create topic topic_ctb_all as select * from ctb0 sql create topic topic_ctb_column as select ts, c3 from ctb0
sql create topic topic_ctb_function as select ts, abs(c1), sin(c2) from ctb0 sql create topic topic_ctb_all as select * from ctb0
sql create topic topic_ctb_function as select ts, abs(c1), sin(c2) from ctb0
print == create topics from normal table
sql create topic topic_ntb_column as select ts, c3 from ntb0 print == create topics from normal table
sql create topic topic_ntb_all as select * from ntb0 sql create topic topic_ntb_column as select ts, c3 from ntb0
sql create topic topic_ntb_function as select ts, abs(c1), sin(c2) from ntb0 sql create topic topic_ntb_all as select * from ntb0
sql create topic topic_ntb_function as select ts, abs(c1), sin(c2) from ntb0
#sql show topics
#if $rows != 9 then #sql show topics
# return -1 #if $rows != 9 then
#endi # return -1
#endi
$keyList = ' . group.id:cgrp1
$keyList = $keyList . ' #'group.id:cgrp1,enable.auto.commit:false,auto.commit.interval.ms:6000,auto.offset.reset:earliest'
$keyList = ' . group.id:cgrp1
$cdb_index = 0 $keyList = $keyList . ,
#=============================== start consume =============================# $keyList = $keyList . enable.auto.commit:false
#$keyList = $keyList . ,
print ================ test consume from stb #$keyList = $keyList . auto.commit.interval.ms:6000
$loop_cnt = 0 #$keyList = $keyList . ,
loop_consume_diff_topic_from_stb: #$keyList = $keyList . auto.offset.reset:earliest
$keyList = $keyList . '
####################################################################################### print ========== key list: $keyList
# clear consume info and consume result
#run tsim/tmq/clearConsume.sim
# because drop table function no stable, so by create new db for consume info and result. Modify it later $cdb_index = 0
$cdb_index = $cdb_index + 1 #=============================== start consume =============================#
$cdbName = cdb . $cdb_index
sql create database $cdbName vgroups 1 print ================ test consume from stb
sleep 500 $loop_cnt = 0
sql use $cdbName loop_consume_diff_topic_from_stb:
print == create consume info table and consume result table #######################################################################################
sql create table consumeinfo (ts timestamp, consumerid int, topiclist binary(1024), keylist binary(1024), expectmsgcnt bigint, ifcheckdata int) # clear consume info and consume result
sql create table consumeresult (ts timestamp, consumerid int, consummsgcnt bigint, consumrowcnt bigint, checkresult int) #run tsim/tmq/clearConsume.sim
# because drop table function no stable, so by create new db for consume info and result. Modify it later
sql show tables $cdb_index = $cdb_index + 1
if $rows != 2 then $cdbName = cdb . $cdb_index
return -1 sql create database $cdbName vgroups 1
endi sleep 500
####################################################################################### sql use $cdbName
if $loop_cnt == 0 then print == create consume info table and consume result table
print == scenario 1: topic_stb_column sql create table consumeinfo (ts timestamp, consumerid int, topiclist binary(1024), keylist binary(1024), expectmsgcnt bigint, ifcheckdata int, ifmanualcommit int)
$topicList = ' . topic_stb_column sql create table consumeresult (ts timestamp, consumerid int, consummsgcnt bigint, consumrowcnt bigint, checkresult int)
$topicList = $topicList . '
elif $loop_cnt == 1 then sql show tables
print == scenario 2: topic_stb_all if $rows != 2 then
$topicList = ' . topic_stb_all return -1
$topicList = $topicList . ' endi
elif $loop_cnt == 2 then #######################################################################################
print == scenario 3: topic_stb_function
$topicList = ' . topic_stb_function if $loop_cnt == 0 then
$topicList = $topicList . ' print == scenario 1: topic_stb_column
else $topicList = ' . topic_stb_column
goto loop_consume_diff_topic_from_stb_end $topicList = $topicList . '
endi elif $loop_cnt == 1 then
print == scenario 2: topic_stb_all
$consumerId = 0 $topicList = ' . topic_stb_all
$totalMsgOfStb = $ctbNum * $rowsPerCtb $topicList = $topicList . '
$expectmsgcnt = $totalMsgOfStb elif $loop_cnt == 2 then
sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata ) print == scenario 3: topic_stb_function
$topicList = ' . topic_stb_function
print == start consumer to pull msgs from stb $topicList = $topicList . '
print == tsim/tmq/consume.sh -d $dbName -y $pullDelay -g $showMsg -r $showRow -w $cdbName -s start else
system tsim/tmq/consume.sh -d $dbName -y $pullDelay -g $showMsg -r $showRow -w $cdbName -s start goto loop_consume_diff_topic_from_stb_end
endi
print == check consume result
wait_consumer_end_from_stb: $consumerId = 0
sql select * from consumeresult $totalMsgOfStb = $ctbNum * $rowsPerCtb
print ==> rows: $rows $expectmsgcnt = $totalMsgOfStb
print ==> rows[0]: $data[0][0] $data[0][1] $data[0][2] $data[0][3] $data[0][4] $data[0][5] $data[0][6] sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata , $ifmanualcommit )
if $rows != 1 then
sleep 1000 print == start consumer to pull msgs from stb
goto wait_consumer_end_from_stb print == tsim/tmq/consume.sh -d $dbName -y $pullDelay -g $showMsg -r $showRow -w $cdbName -s start
endi system tsim/tmq/consume.sh -d $dbName -y $pullDelay -g $showMsg -r $showRow -w $cdbName -s start
if $data[0][1] != $consumerId then
return -1 print == check consume result
endi wait_consumer_end_from_stb:
if $data[0][2] != $expectmsgcnt then sql select * from consumeresult
return -1 print ==> rows: $rows
endi print ==> rows[0]: $data[0][0] $data[0][1] $data[0][2] $data[0][3] $data[0][4] $data[0][5] $data[0][6]
if $data[0][3] != $expectmsgcnt then if $rows != 1 then
return -1 sleep 1000
endi goto wait_consumer_end_from_stb
$loop_cnt = $loop_cnt + 1 endi
goto loop_consume_diff_topic_from_stb if $data[0][1] != $consumerId then
loop_consume_diff_topic_from_stb_end: return -1
endi
print ================ test consume from ctb if $data[0][2] != $expectmsgcnt then
$loop_cnt = 0 return -1
loop_consume_diff_topic_from_ctb: endi
if $data[0][3] != $expectmsgcnt then
####################################################################################### return -1
# clear consume info and consume result endi
#run tsim/tmq/clearConsume.sim $loop_cnt = $loop_cnt + 1
# because drop table function no stable, so by create new db for consume info and result. Modify it later goto loop_consume_diff_topic_from_stb
$cdb_index = $cdb_index + 1 loop_consume_diff_topic_from_stb_end:
$cdbName = cdb . $cdb_index
sql create database $cdbName vgroups 1 print ================ test consume from ctb
sleep 500 $loop_cnt = 0
sql use $cdbName loop_consume_diff_topic_from_ctb:
print == create consume info table and consume result table #######################################################################################
sql create table consumeinfo (ts timestamp, consumerid int, topiclist binary(1024), keylist binary(1024), expectmsgcnt bigint, ifcheckdata int) # clear consume info and consume result
sql create table consumeresult (ts timestamp, consumerid int, consummsgcnt bigint, consumrowcnt bigint, checkresult int) #run tsim/tmq/clearConsume.sim
# because drop table function no stable, so by create new db for consume info and result. Modify it later
sql show tables $cdb_index = $cdb_index + 1
if $rows != 2 then $cdbName = cdb . $cdb_index
return -1 sql create database $cdbName vgroups 1
endi sleep 500
####################################################################################### sql use $cdbName
if $loop_cnt == 0 then print == create consume info table and consume result table
print == scenario 1: topic_ctb_column sql create table consumeinfo (ts timestamp, consumerid int, topiclist binary(1024), keylist binary(1024), expectmsgcnt bigint, ifcheckdata int, ifmanualcommit int)
$topicList = ' . topic_ctb_column sql create table consumeresult (ts timestamp, consumerid int, consummsgcnt bigint, consumrowcnt bigint, checkresult int)
$topicList = $topicList . '
elif $loop_cnt == 1 then sql show tables
print == scenario 2: topic_ctb_all if $rows != 2 then
$topicList = ' . topic_ctb_all return -1
$topicList = $topicList . ' endi
elif $loop_cnt == 2 then #######################################################################################
print == scenario 3: topic_ctb_function
$topicList = ' . topic_ctb_function if $loop_cnt == 0 then
$topicList = $topicList . ' print == scenario 1: topic_ctb_column
else $topicList = ' . topic_ctb_column
goto loop_consume_diff_topic_from_ctb_end $topicList = $topicList . '
endi elif $loop_cnt == 1 then
print == scenario 2: topic_ctb_all
$consumerId = 0 $topicList = ' . topic_ctb_all
$totalMsgOfCtb = $rowsPerCtb $topicList = $topicList . '
$expectmsgcnt = $totalMsgOfCtb elif $loop_cnt == 2 then
sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata ) print == scenario 3: topic_ctb_function
$topicList = ' . topic_ctb_function
print == start consumer to pull msgs from ctb $topicList = $topicList . '
print == tsim/tmq/consume.sh -d $dbName -y $pullDelay -g $showMsg -r $showRow -s start else
system tsim/tmq/consume.sh -d $dbName -y $pullDelay -g $showMsg -r $showRow -w $cdbName -s start goto loop_consume_diff_topic_from_ctb_end
endi
print == check consume result
wait_consumer_end_from_ctb: $consumerId = 0
sql select * from consumeresult $totalMsgOfCtb = $rowsPerCtb
print ==> rows: $rows $expectmsgcnt = $totalMsgOfCtb
print ==> rows[0]: $data[0][0] $data[0][1] $data[0][2] $data[0][3] $data[0][4] $data[0][5] $data[0][6] sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata , $ifmanualcommit )
if $rows != 1 then
sleep 1000 print == start consumer to pull msgs from ctb
goto wait_consumer_end_from_ctb print == tsim/tmq/consume.sh -d $dbName -y $pullDelay -g $showMsg -r $showRow -s start
endi system tsim/tmq/consume.sh -d $dbName -y $pullDelay -g $showMsg -r $showRow -w $cdbName -s start
if $data[0][1] != $consumerId then
return -1 print == check consume result
endi wait_consumer_end_from_ctb:
if $data[0][2] != $totalMsgOfCtb then sql select * from consumeresult
return -1 print ==> rows: $rows
endi print ==> rows[0]: $data[0][0] $data[0][1] $data[0][2] $data[0][3] $data[0][4] $data[0][5] $data[0][6]
if $data[0][3] != $totalMsgOfCtb then if $rows != 1 then
return -1 sleep 1000
endi goto wait_consumer_end_from_ctb
$loop_cnt = $loop_cnt + 1 endi
goto loop_consume_diff_topic_from_ctb if $data[0][1] != $consumerId then
loop_consume_diff_topic_from_ctb_end: return -1
endi
print ================ test consume from ntb if $data[0][2] != $totalMsgOfCtb then
$loop_cnt = 0 return -1
loop_consume_diff_topic_from_ntb: endi
if $data[0][3] != $totalMsgOfCtb then
####################################################################################### return -1
# clear consume info and consume result endi
#run tsim/tmq/clearConsume.sim $loop_cnt = $loop_cnt + 1
# because drop table function no stable, so by create new db for consume info and result. Modify it later goto loop_consume_diff_topic_from_ctb
$cdb_index = $cdb_index + 1 loop_consume_diff_topic_from_ctb_end:
$cdbName = cdb . $cdb_index
sql create database $cdbName vgroups 1 print ================ test consume from ntb
sleep 500 $loop_cnt = 0
sql use $cdbName loop_consume_diff_topic_from_ntb:
print == create consume info table and consume result table #######################################################################################
sql create table consumeinfo (ts timestamp, consumerid int, topiclist binary(1024), keylist binary(1024), expectmsgcnt bigint, ifcheckdata int) # clear consume info and consume result
sql create table consumeresult (ts timestamp, consumerid int, consummsgcnt bigint, consumrowcnt bigint, checkresult int) #run tsim/tmq/clearConsume.sim
# because drop table function no stable, so by create new db for consume info and result. Modify it later
sql show tables $cdb_index = $cdb_index + 1
if $rows != 2 then $cdbName = cdb . $cdb_index
return -1 sql create database $cdbName vgroups 1
endi sleep 500
####################################################################################### sql use $cdbName
if $loop_cnt == 0 then print == create consume info table and consume result table
print == scenario 1: topic_ntb_column sql create table consumeinfo (ts timestamp, consumerid int, topiclist binary(1024), keylist binary(1024), expectmsgcnt bigint, ifcheckdata int, ifmanualcommit int)
$topicList = ' . topic_ntb_column sql create table consumeresult (ts timestamp, consumerid int, consummsgcnt bigint, consumrowcnt bigint, checkresult int)
$topicList = $topicList . '
elif $loop_cnt == 1 then sql show tables
print == scenario 2: topic_ntb_all if $rows != 2 then
$topicList = ' . topic_ntb_all return -1
$topicList = $topicList . ' endi
elif $loop_cnt == 2 then #######################################################################################
print == scenario 3: topic_ntb_function
$topicList = ' . topic_ntb_function if $loop_cnt == 0 then
$topicList = $topicList . ' print == scenario 1: topic_ntb_column
else $topicList = ' . topic_ntb_column
goto loop_consume_diff_topic_from_ntb_end $topicList = $topicList . '
endi elif $loop_cnt == 1 then
print == scenario 2: topic_ntb_all
$consumerId = 0 $topicList = ' . topic_ntb_all
$totalMsgOfNtb = $rowsPerCtb $topicList = $topicList . '
$expectmsgcnt = $totalMsgOfNtb elif $loop_cnt == 2 then
sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata ) print == scenario 3: topic_ntb_function
$topicList = ' . topic_ntb_function
print == start consumer to pull msgs from ntb $topicList = $topicList . '
print == tsim/tmq/consume.sh -d $dbName -y $pullDelay -g $showMsg -r $showRow -s start else
system tsim/tmq/consume.sh -d $dbName -y $pullDelay -g $showMsg -r $showRow -w $cdbName -s start goto loop_consume_diff_topic_from_ntb_end
endi
print == check consume result from ntb
wait_consumer_end_from_ntb: $consumerId = 0
sql select * from consumeresult $totalMsgOfNtb = $rowsPerCtb
print ==> rows: $rows $expectmsgcnt = $totalMsgOfNtb
print ==> rows[0]: $data[0][0] $data[0][1] $data[0][2] $data[0][3] $data[0][4] $data[0][5] $data[0][6] sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata , $ifmanualcommit )
if $rows != 1 then
sleep 1000 print == start consumer to pull msgs from ntb
goto wait_consumer_end_from_ntb print == tsim/tmq/consume.sh -d $dbName -y $pullDelay -g $showMsg -r $showRow -s start
endi system tsim/tmq/consume.sh -d $dbName -y $pullDelay -g $showMsg -r $showRow -w $cdbName -s start
if $data[0][1] != $consumerId then
return -1 print == check consume result from ntb
endi wait_consumer_end_from_ntb:
if $data[0][2] != $totalMsgOfNtb then sql select * from consumeresult
return -1 print ==> rows: $rows
endi print ==> rows[0]: $data[0][0] $data[0][1] $data[0][2] $data[0][3] $data[0][4] $data[0][5] $data[0][6]
if $data[0][3] != $totalMsgOfNtb then if $rows != 1 then
return -1 sleep 1000
endi goto wait_consumer_end_from_ntb
$loop_cnt = $loop_cnt + 1 endi
goto loop_consume_diff_topic_from_ntb if $data[0][1] != $consumerId then
loop_consume_diff_topic_from_ntb_end: return -1
endi
#------ not need stop consumer, because it exit after pull msg overthan expect msg if $data[0][2] != $totalMsgOfNtb then
#system tsim/tmq/consume.sh -s stop -x SIGINT return -1
endi
system sh/exec.sh -n dnode1 -s stop -x SIGINT if $data[0][3] != $totalMsgOfNtb then
return -1
endi
$loop_cnt = $loop_cnt + 1
goto loop_consume_diff_topic_from_ntb
loop_consume_diff_topic_from_ntb_end:
#------ not need stop consumer, because it exit after pull msg overthan expect msg
#system tsim/tmq/consume.sh -s stop -x SIGINT
system sh/exec.sh -n dnode1 -s stop -x SIGINT
#### test scenario, please refer to https://jira.taosdata.com:18090/pages/viewpage.action?pageId=135120406 #### test scenario, please refer to https://jira.taosdata.com:18090/pages/viewpage.action?pageId=135120406
#basic1.sim: vgroups=1, one topic for one consumer, firstly insert data, then start consume. Include six topics #basic1.sim: vgroups=1, one topic for one consumer, firstly insert data, then start consume. Include six topics
#basic2.sim: vgroups=1, multi topics for one consumer, firstly insert data, then start consume. Include six topics #basic2.sim: vgroups=1, multi topics for one consumer, firstly insert data, then start consume. Include six topics
#basic3.sim: vgroups=4, one topic for one consumer, firstly insert data, then start consume. Include six topics #basic3.sim: vgroups=4, one topic for one consumer, firstly insert data, then start consume. Include six topics
#basic4.sim: vgroups=4, multi topics for one consumer, firstly insert data, then start consume. Include six topics #basic4.sim: vgroups=4, multi topics for one consumer, firstly insert data, then start consume. Include six topics
# notes1: Scalar function: ABS/ACOS/ASIN/ATAN/CEIL/COS/FLOOR/LOG/POW/ROUND/SIN/SQRT/TAN # notes1: Scalar function: ABS/ACOS/ASIN/ATAN/CEIL/COS/FLOOR/LOG/POW/ROUND/SIN/SQRT/TAN
# The above use cases are combined with where filter conditions, such as: where ts > "2017-08-12 18:25:58.128Z" and sin(a) > 0.5; # The above use cases are combined with where filter conditions, such as: where ts > "2017-08-12 18:25:58.128Z" and sin(a) > 0.5;
# #
# notes2: not support aggregate functions(such as sum/count/min/max) and time-windows(interval). # notes2: not support aggregate functions(such as sum/count/min/max) and time-windows(interval).
# #
run tsim/tmq/prepareBasicEnv-1vgrp.sim run tsim/tmq/prepareBasicEnv-1vgrp.sim
#---- global parameters start ----# #---- global parameters start ----#
$dbName = db $dbName = db
$vgroups = 1 $vgroups = 1
$stbPrefix = stb $stbPrefix = stb
$ctbPrefix = ctb $ctbPrefix = ctb
$ntbPrefix = ntb $ntbPrefix = ntb
$stbNum = 1 $stbNum = 1
$ctbNum = 10 $ctbNum = 10
$ntbNum = 10 $ntbNum = 10
$rowsPerCtb = 10 $rowsPerCtb = 10
$tstart = 1640966400000 # 2022-01-01 00:00:00.000 $tstart = 1640966400000 # 2022-01-01 00:00:00.000
#---- global parameters end ----# #---- global parameters end ----#
$pullDelay = 3 $pullDelay = 3
$ifcheckdata = 1 $ifcheckdata = 1
$showMsg = 1 $ifmanualcommit = 1
$showRow = 0 $showMsg = 1
$showRow = 0
sql connect
sql use $dbName sql connect
sql use $dbName
print == create topics from super table
sql create topic topic_stb_column as select ts, c3 from stb print == create topics from super table
sql create topic topic_stb_all as select ts, c1, c2, c3 from stb sql create topic topic_stb_column as select ts, c3 from stb
sql create topic topic_stb_function as select ts, abs(c1), sin(c2) from stb sql create topic topic_stb_all as select ts, c1, c2, c3 from stb
sql create topic topic_stb_function as select ts, abs(c1), sin(c2) from stb
print == create topics from child table
sql create topic topic_ctb_column as select ts, c3 from ctb0 print == create topics from child table
sql create topic topic_ctb_all as select * from ctb0 sql create topic topic_ctb_column as select ts, c3 from ctb0
sql create topic topic_ctb_function as select ts, abs(c1), sin(c2) from ctb0 sql create topic topic_ctb_all as select * from ctb0
sql create topic topic_ctb_function as select ts, abs(c1), sin(c2) from ctb0
print == create topics from normal table
sql create topic topic_ntb_column as select ts, c3 from ntb0 print == create topics from normal table
sql create topic topic_ntb_all as select * from ntb0 sql create topic topic_ntb_column as select ts, c3 from ntb0
sql create topic topic_ntb_function as select ts, abs(c1), sin(c2) from ntb0 sql create topic topic_ntb_all as select * from ntb0
sql create topic topic_ntb_function as select ts, abs(c1), sin(c2) from ntb0
#sql show topics
#if $rows != 9 then #sql show topics
# return -1 #if $rows != 9 then
#endi # return -1
#endi
$keyList = ' . group.id:cgrp1
$keyList = $keyList . ' #'group.id:cgrp1,enable.auto.commit:false,auto.commit.interval.ms:6000,auto.offset.reset:earliest'
$keyList = ' . group.id:cgrp1
$topicNum = 3 $keyList = $keyList . ,
$keyList = $keyList . enable.auto.commit:false
#=============================== start consume =============================# #$keyList = $keyList . ,
#$keyList = $keyList . auto.commit.interval.ms:6000
#$keyList = $keyList . ,
print ================ test consume from stb #$keyList = $keyList . auto.offset.reset:earliest
print == multi toipcs: topic_stb_column + topic_stb_all + topic_stb_function $keyList = $keyList . '
$topicList = ' . topic_stb_column print ========== key list: $keyList
$topicList = $topicList . ,
$topicList = $topicList . topic_stb_all
$topicList = $topicList . , $topicNum = 3
$topicList = $topicList . topic_stb_function
$topicList = $topicList . ' #=============================== start consume =============================#
$consumerId = 0
$totalMsgOfStb = $ctbNum * $rowsPerCtb print ================ test consume from stb
$totalMsgOfStb = $totalMsgOfStb * $topicNum print == multi toipcs: topic_stb_column + topic_stb_all + topic_stb_function
$expectmsgcnt = $totalMsgOfStb $topicList = ' . topic_stb_column
sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata ) $topicList = $topicList . ,
$topicList = $topicList . topic_stb_all
print == start consumer to pull msgs from stb $topicList = $topicList . ,
print == tsim/tmq/consume.sh -d $dbName -y $pullDelay -g $showMsg -r $showRow -w $dbName -s start $topicList = $topicList . topic_stb_function
system tsim/tmq/consume.sh -d $dbName -y $pullDelay -g $showMsg -r $showRow -w $dbName -s start $topicList = $topicList . '
print == check consume result $consumerId = 0
wait_consumer_end_from_stb: $totalMsgOfStb = $ctbNum * $rowsPerCtb
sql select * from consumeresult $totalMsgOfStb = $totalMsgOfStb * $topicNum
print ==> rows: $rows $expectmsgcnt = $totalMsgOfStb
print ==> rows[0]: $data[0][0] $data[0][1] $data[0][2] $data[0][3] $data[0][4] $data[0][5] $data[0][6] sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata , $ifmanualcommit )
if $rows != 1 then
sleep 1000 print == start consumer to pull msgs from stb
goto wait_consumer_end_from_stb print == tsim/tmq/consume.sh -d $dbName -y $pullDelay -g $showMsg -r $showRow -w $dbName -s start
endi system tsim/tmq/consume.sh -d $dbName -y $pullDelay -g $showMsg -r $showRow -w $dbName -s start
if $data[0][1] != $consumerId then
return -1 print == check consume result
endi wait_consumer_end_from_stb:
if $data[0][2] != $expectmsgcnt then sql select * from consumeresult
return -1 print ==> rows: $rows
endi print ==> rows[0]: $data[0][0] $data[0][1] $data[0][2] $data[0][3] $data[0][4] $data[0][5] $data[0][6]
if $data[0][3] != $expectmsgcnt then if $rows != 1 then
return -1 sleep 1000
endi goto wait_consumer_end_from_stb
endi
####################################################################################### if $data[0][1] != $consumerId then
# clear consume info and consume result return -1
#run tsim/tmq/clearConsume.sim endi
# because drop table function no stable, so by create new db for consume info and result. Modify it later if $data[0][2] != $expectmsgcnt then
$cdbName = cdb1 return -1
sql create database $cdbName vgroups 1 endi
sleep 500 if $data[0][3] != $expectmsgcnt then
sql use $cdbName return -1
endi
print == create consume info table and consume result table
sql create table consumeinfo (ts timestamp, consumerid int, topiclist binary(1024), keylist binary(1024), expectmsgcnt bigint, ifcheckdata int) #######################################################################################
sql create table consumeresult (ts timestamp, consumerid int, consummsgcnt bigint, consumrowcnt bigint, checkresult int) # clear consume info and consume result
#run tsim/tmq/clearConsume.sim
sql show tables # because drop table function no stable, so by create new db for consume info and result. Modify it later
if $rows != 2 then $cdbName = cdb1
return -1 sql create database $cdbName vgroups 1
endi sleep 500
####################################################################################### sql use $cdbName
print == create consume info table and consume result table
print ================ test consume from ctb sql create table consumeinfo (ts timestamp, consumerid int, topiclist binary(1024), keylist binary(1024), expectmsgcnt bigint, ifcheckdata int, ifmanualcommit int)
print == multi toipcs: topic_ctb_column + topic_ctb_all + topic_ctb_function sql create table consumeresult (ts timestamp, consumerid int, consummsgcnt bigint, consumrowcnt bigint, checkresult int)
$topicList = ' . topic_ctb_column
$topicList = $topicList . , sql show tables
$topicList = $topicList . topic_ctb_all if $rows != 2 then
$topicList = $topicList . , return -1
$topicList = $topicList . topic_ctb_function endi
$topicList = $topicList . ' #######################################################################################
$consumerId = 0
$totalMsgOfCtb = $rowsPerCtb * $topicNum print ================ test consume from ctb
$expectmsgcnt = $totalMsgOfCtb print == multi toipcs: topic_ctb_column + topic_ctb_all + topic_ctb_function
sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata ) $topicList = ' . topic_ctb_column
$topicList = $topicList . ,
print == start consumer to pull msgs from ctb $topicList = $topicList . topic_ctb_all
print == tsim/tmq/consume.sh -d $dbName -y $pullDelay -g $showMsg -r $showRow -s start $topicList = $topicList . ,
system tsim/tmq/consume.sh -d $dbName -y $pullDelay -g $showMsg -r $showRow -w $cdbName -s start $topicList = $topicList . topic_ctb_function
$topicList = $topicList . '
print == check consume result
wait_consumer_end_from_ctb: $consumerId = 0
sql select * from consumeresult $totalMsgOfCtb = $rowsPerCtb * $topicNum
print ==> rows: $rows $expectmsgcnt = $totalMsgOfCtb
print ==> rows[0]: $data[0][0] $data[0][1] $data[0][2] $data[0][3] $data[0][4] $data[0][5] $data[0][6] sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata , $ifmanualcommit )
if $rows != 1 then
sleep 1000 print == start consumer to pull msgs from ctb
goto wait_consumer_end_from_ctb print == tsim/tmq/consume.sh -d $dbName -y $pullDelay -g $showMsg -r $showRow -s start
endi system tsim/tmq/consume.sh -d $dbName -y $pullDelay -g $showMsg -r $showRow -w $cdbName -s start
if $data[0][1] != $consumerId then
return -1 print == check consume result
endi wait_consumer_end_from_ctb:
if $data[0][2] != $totalMsgOfCtb then sql select * from consumeresult
return -1 print ==> rows: $rows
endi print ==> rows[0]: $data[0][0] $data[0][1] $data[0][2] $data[0][3] $data[0][4] $data[0][5] $data[0][6]
if $data[0][3] != $totalMsgOfCtb then if $rows != 1 then
return -1 sleep 1000
endi goto wait_consumer_end_from_ctb
endi
####################################################################################### if $data[0][1] != $consumerId then
# clear consume info and consume result return -1
#run tsim/tmq/clearConsume.sim endi
# because drop table function no stable, so by create new db for consume info and result. Modify it later if $data[0][2] != $totalMsgOfCtb then
$cdbName = cdb2 return -1
sql create database $cdbName vgroups 1 endi
sleep 500 if $data[0][3] != $totalMsgOfCtb then
sql use $cdbName return -1
endi
print == create consume info table and consume result table
sql create table consumeinfo (ts timestamp, consumerid int, topiclist binary(1024), keylist binary(1024), expectmsgcnt bigint, ifcheckdata int) #######################################################################################
sql create table consumeresult (ts timestamp, consumerid int, consummsgcnt bigint, consumrowcnt bigint, checkresult int) # clear consume info and consume result
#run tsim/tmq/clearConsume.sim
sql show tables # because drop table function no stable, so by create new db for consume info and result. Modify it later
if $rows != 2 then $cdbName = cdb2
return -1 sql create database $cdbName vgroups 1
endi sleep 500
####################################################################################### sql use $cdbName
print == create consume info table and consume result table
print ================ test consume from ntb sql create table consumeinfo (ts timestamp, consumerid int, topiclist binary(1024), keylist binary(1024), expectmsgcnt bigint, ifcheckdata int, ifmanualcommit int)
print == multi toipcs: topic_ntb_column + topic_ntb_all + topic_ntb_function sql create table consumeresult (ts timestamp, consumerid int, consummsgcnt bigint, consumrowcnt bigint, checkresult int)
$topicList = ' . topic_ntb_column
$topicList = $topicList . , sql show tables
$topicList = $topicList . topic_ntb_all if $rows != 2 then
$topicList = $topicList . , return -1
$topicList = $topicList . topic_ntb_function endi
$topicList = $topicList . ' #######################################################################################
$consumerId = 0
$totalMsgOfNtb = $rowsPerCtb * $topicNum print ================ test consume from ntb
$expectmsgcnt = $totalMsgOfNtb print == multi toipcs: topic_ntb_column + topic_ntb_all + topic_ntb_function
sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata ) $topicList = ' . topic_ntb_column
$topicList = $topicList . ,
print == start consumer to pull msgs from ntb $topicList = $topicList . topic_ntb_all
print == tsim/tmq/consume.sh -d $dbName -y $pullDelay -g $showMsg -r $showRow -s start $topicList = $topicList . ,
system tsim/tmq/consume.sh -d $dbName -y $pullDelay -g $showMsg -r $showRow -w $cdbName -s start $topicList = $topicList . topic_ntb_function
$topicList = $topicList . '
print == check consume result from ntb
wait_consumer_end_from_ntb: $consumerId = 0
sql select * from consumeresult $totalMsgOfNtb = $rowsPerCtb * $topicNum
print ==> rows: $rows $expectmsgcnt = $totalMsgOfNtb
print ==> rows[0]: $data[0][0] $data[0][1] $data[0][2] $data[0][3] $data[0][4] $data[0][5] $data[0][6] sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata , $ifmanualcommit )
if $rows != 1 then
sleep 1000 print == start consumer to pull msgs from ntb
goto wait_consumer_end_from_ntb print == tsim/tmq/consume.sh -d $dbName -y $pullDelay -g $showMsg -r $showRow -s start
endi system tsim/tmq/consume.sh -d $dbName -y $pullDelay -g $showMsg -r $showRow -w $cdbName -s start
if $data[0][1] != $consumerId then
return -1 print == check consume result from ntb
endi wait_consumer_end_from_ntb:
if $data[0][2] != $totalMsgOfNtb then sql select * from consumeresult
return -1 print ==> rows: $rows
endi print ==> rows[0]: $data[0][0] $data[0][1] $data[0][2] $data[0][3] $data[0][4] $data[0][5] $data[0][6]
if $data[0][3] != $totalMsgOfNtb then if $rows != 1 then
return -1 sleep 1000
endi goto wait_consumer_end_from_ntb
endi
#------ not need stop consumer, because it exit after pull msg overthan expect msg if $data[0][1] != $consumerId then
#system tsim/tmq/consume.sh -s stop -x SIGINT return -1
endi
system sh/exec.sh -n dnode1 -s stop -x SIGINT if $data[0][2] != $totalMsgOfNtb then
return -1
endi
if $data[0][3] != $totalMsgOfNtb then
return -1
endi
#------ not need stop consumer, because it exit after pull msg overthan expect msg
#system tsim/tmq/consume.sh -s stop -x SIGINT
system sh/exec.sh -n dnode1 -s stop -x SIGINT
...@@ -27,6 +27,7 @@ $tstart = 1640966400000 # 2022-01-01 00:00:00.000 ...@@ -27,6 +27,7 @@ $tstart = 1640966400000 # 2022-01-01 00:00:00.000
$pullDelay = 5 $pullDelay = 5
$ifcheckdata = 1 $ifcheckdata = 1
$ifmanualcommit = 1
$showMsg = 1 $showMsg = 1
$showRow = 0 $showRow = 0
...@@ -53,8 +54,16 @@ sql create topic topic_ntb_function as select ts, abs(c1), sin(c2) from ntb0 ...@@ -53,8 +54,16 @@ sql create topic topic_ntb_function as select ts, abs(c1), sin(c2) from ntb0
# return -1 # return -1
#endi #endi
#'group.id:cgrp1,enable.auto.commit:false,auto.commit.interval.ms:6000,auto.offset.reset:earliest'
$keyList = ' . group.id:cgrp1 $keyList = ' . group.id:cgrp1
$keyList = $keyList . ,
$keyList = $keyList . enable.auto.commit:false
#$keyList = $keyList . ,
#$keyList = $keyList . auto.commit.interval.ms:6000
#$keyList = $keyList . ,
#$keyList = $keyList . auto.offset.reset:earliest
$keyList = $keyList . ' $keyList = $keyList . '
print ========== key list: $keyList
$topicNum = 2 $topicNum = 2
...@@ -72,7 +81,7 @@ $consumerId = 0 ...@@ -72,7 +81,7 @@ $consumerId = 0
$totalMsgOfOneTopic = $ctbNum * $rowsPerCtb $totalMsgOfOneTopic = $ctbNum * $rowsPerCtb
$totalMsgOfStb = $totalMsgOfOneTopic * $topicNum $totalMsgOfStb = $totalMsgOfOneTopic * $topicNum
$expectmsgcnt = $totalMsgOfStb $expectmsgcnt = $totalMsgOfStb
sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata ) sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata , $ifmanualcommit )
$topicList = ' . topic_stb_all $topicList = ' . topic_stb_all
...@@ -80,7 +89,7 @@ $topicList = $topicList . , ...@@ -80,7 +89,7 @@ $topicList = $topicList . ,
$topicList = $topicList . topic_stb_function $topicList = $topicList . topic_stb_function
$topicList = $topicList . ' $topicList = $topicList . '
$consumerId = 1 $consumerId = 1
sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata ) sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata , $ifmanualcommit )
print == start consumer to pull msgs from stb print == start consumer to pull msgs from stb
print == tsim/tmq/consume.sh -d $dbName -y $pullDelay -g $showMsg -r $showRow -w $dbName -s start print == tsim/tmq/consume.sh -d $dbName -y $pullDelay -g $showMsg -r $showRow -w $dbName -s start
...@@ -158,7 +167,7 @@ sleep 500 ...@@ -158,7 +167,7 @@ sleep 500
sql use $cdbName sql use $cdbName
print == create consume info table and consume result table for ctb print == create consume info table and consume result table for ctb
sql create table consumeinfo (ts timestamp, consumerid int, topiclist binary(1024), keylist binary(1024), expectmsgcnt bigint, ifcheckdata int) sql create table consumeinfo (ts timestamp, consumerid int, topiclist binary(1024), keylist binary(1024), expectmsgcnt bigint, ifcheckdata int, ifmanualcommit int)
sql create table consumeresult (ts timestamp, consumerid int, consummsgcnt bigint, consumrowcnt bigint, checkresult int) sql create table consumeresult (ts timestamp, consumerid int, consummsgcnt bigint, consumrowcnt bigint, checkresult int)
sql show tables sql show tables
...@@ -179,14 +188,14 @@ $consumerId = 0 ...@@ -179,14 +188,14 @@ $consumerId = 0
$totalMsgOfOneTopic = $rowsPerCtb $totalMsgOfOneTopic = $rowsPerCtb
$totalMsgOfCtb = $totalMsgOfOneTopic * $topicNum $totalMsgOfCtb = $totalMsgOfOneTopic * $topicNum
$expectmsgcnt = $totalMsgOfCtb $expectmsgcnt = $totalMsgOfCtb
sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata ) sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata , $ifmanualcommit )
$topicList = ' . topic_ctb_function $topicList = ' . topic_ctb_function
$topicList = $topicList . , $topicList = $topicList . ,
$topicList = $topicList . topic_ctb_all $topicList = $topicList . topic_ctb_all
$topicList = $topicList . ' $topicList = $topicList . '
$consumerId = 1 $consumerId = 1
sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata ) sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata , $ifmanualcommit )
print == start consumer to pull msgs from ctb print == start consumer to pull msgs from ctb
print == tsim/tmq/consume.sh -d $dbName -y $pullDelay -g $showMsg -r $showRow -w $cdbName -s start print == tsim/tmq/consume.sh -d $dbName -y $pullDelay -g $showMsg -r $showRow -w $cdbName -s start
...@@ -249,7 +258,7 @@ sleep 500 ...@@ -249,7 +258,7 @@ sleep 500
sql use $cdbName sql use $cdbName
print == create consume info table and consume result table for ntb print == create consume info table and consume result table for ntb
sql create table consumeinfo (ts timestamp, consumerid int, topiclist binary(1024), keylist binary(1024), expectmsgcnt bigint, ifcheckdata int) sql create table consumeinfo (ts timestamp, consumerid int, topiclist binary(1024), keylist binary(1024), expectmsgcnt bigint, ifcheckdata int, ifmanualcommit int)
sql create table consumeresult (ts timestamp, consumerid int, consummsgcnt bigint, consumrowcnt bigint, checkresult int) sql create table consumeresult (ts timestamp, consumerid int, consummsgcnt bigint, consumrowcnt bigint, checkresult int)
sql show tables sql show tables
...@@ -270,7 +279,7 @@ $consumerId = 0 ...@@ -270,7 +279,7 @@ $consumerId = 0
$totalMsgOfOneTopic = $rowsPerCtb $totalMsgOfOneTopic = $rowsPerCtb
$totalMsgOfNtb = $totalMsgOfOneTopic * $topicNum $totalMsgOfNtb = $totalMsgOfOneTopic * $topicNum
$expectmsgcnt = $totalMsgOfNtb $expectmsgcnt = $totalMsgOfNtb
sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata ) sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata , $ifmanualcommit )
$topicList = ' . topic_ntb_function $topicList = ' . topic_ntb_function
...@@ -278,7 +287,7 @@ $topicList = $topicList . , ...@@ -278,7 +287,7 @@ $topicList = $topicList . ,
$topicList = $topicList . topic_ntb_all $topicList = $topicList . topic_ntb_all
$topicList = $topicList . ' $topicList = $topicList . '
$consumerId = 1 $consumerId = 1
sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata ) sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata , $ifmanualcommit )
print == start consumer to pull msgs from ntb print == start consumer to pull msgs from ntb
print == tsim/tmq/consume.sh -d $dbName -y $pullDelay -g $showMsg -r $showRow -s start print == tsim/tmq/consume.sh -d $dbName -y $pullDelay -g $showMsg -r $showRow -s start
......
#### test scenario, please refer to https://jira.taosdata.com:18090/pages/viewpage.action?pageId=135120406 #### test scenario, please refer to https://jira.taosdata.com:18090/pages/viewpage.action?pageId=135120406
#basic1.sim: vgroups=1, one topic for one consumer, firstly insert data, then start consume. Include six topics #basic1.sim: vgroups=1, one topic for one consumer, firstly insert data, then start consume. Include six topics
#basic2.sim: vgroups=1, multi topics for one consumer, firstly insert data, then start consume. Include six topics #basic2.sim: vgroups=1, multi topics for one consumer, firstly insert data, then start consume. Include six topics
#basic3.sim: vgroups=4, one topic for one consumer, firstly insert data, then start consume. Include six topics #basic3.sim: vgroups=4, one topic for one consumer, firstly insert data, then start consume. Include six topics
#basic4.sim: vgroups=4, multi topics for one consumer, firstly insert data, then start consume. Include six topics #basic4.sim: vgroups=4, multi topics for one consumer, firstly insert data, then start consume. Include six topics
# notes1: Scalar function: ABS/ACOS/ASIN/ATAN/CEIL/COS/FLOOR/LOG/POW/ROUND/SIN/SQRT/TAN # notes1: Scalar function: ABS/ACOS/ASIN/ATAN/CEIL/COS/FLOOR/LOG/POW/ROUND/SIN/SQRT/TAN
# The above use cases are combined with where filter conditions, such as: where ts > "2017-08-12 18:25:58.128Z" and sin(a) > 0.5; # The above use cases are combined with where filter conditions, such as: where ts > "2017-08-12 18:25:58.128Z" and sin(a) > 0.5;
# #
# notes2: not support aggregate functions(such as sum/count/min/max) and time-windows(interval). # notes2: not support aggregate functions(such as sum/count/min/max) and time-windows(interval).
# #
run tsim/tmq/prepareBasicEnv-4vgrp.sim run tsim/tmq/prepareBasicEnv-4vgrp.sim
#---- global parameters start ----# #---- global parameters start ----#
$dbName = db $dbName = db
$vgroups = 4 $vgroups = 4
$stbPrefix = stb $stbPrefix = stb
$ctbPrefix = ctb $ctbPrefix = ctb
$ntbPrefix = ntb $ntbPrefix = ntb
$stbNum = 1 $stbNum = 1
$ctbNum = 10 $ctbNum = 10
$ntbNum = 10 $ntbNum = 10
$rowsPerCtb = 10 $rowsPerCtb = 10
$tstart = 1640966400000 # 2022-01-01 00:00:00.000 $tstart = 1640966400000 # 2022-01-01 00:00:00.000
#---- global parameters end ----# #---- global parameters end ----#
$pullDelay = 3 $pullDelay = 3
$ifcheckdata = 1 $ifcheckdata = 1
$showMsg = 1 $ifmanualcommit = 1
$showRow = 0 $showMsg = 1
$showRow = 0
sql connect
sql use $dbName sql connect
sql use $dbName
print == create topics from super table
sql create topic topic_stb_column as select ts, c3 from stb print == create topics from super table
sql create topic topic_stb_all as select ts, c1, c2, c3 from stb sql create topic topic_stb_column as select ts, c3 from stb
sql create topic topic_stb_function as select ts, abs(c1), sin(c2) from stb sql create topic topic_stb_all as select ts, c1, c2, c3 from stb
sql create topic topic_stb_function as select ts, abs(c1), sin(c2) from stb
print == create topics from child table
sql create topic topic_ctb_column as select ts, c3 from ctb0 print == create topics from child table
sql create topic topic_ctb_all as select * from ctb0 sql create topic topic_ctb_column as select ts, c3 from ctb0
sql create topic topic_ctb_function as select ts, abs(c1), sin(c2) from ctb0 sql create topic topic_ctb_all as select * from ctb0
sql create topic topic_ctb_function as select ts, abs(c1), sin(c2) from ctb0
print == create topics from normal table
sql create topic topic_ntb_column as select ts, c3 from ntb0 print == create topics from normal table
sql create topic topic_ntb_all as select * from ntb0 sql create topic topic_ntb_column as select ts, c3 from ntb0
sql create topic topic_ntb_function as select ts, abs(c1), sin(c2) from ntb0 sql create topic topic_ntb_all as select * from ntb0
sql create topic topic_ntb_function as select ts, abs(c1), sin(c2) from ntb0
#sql show topics
#if $rows != 9 then #sql show topics
# return -1 #if $rows != 9 then
#endi # return -1
#endi
$keyList = ' . group.id:cgrp1
$keyList = $keyList . ' #'group.id:cgrp1,enable.auto.commit:false,auto.commit.interval.ms:6000,auto.offset.reset:earliest'
$keyList = ' . group.id:cgrp1
$cdb_index = 0 $keyList = $keyList . ,
#=============================== start consume =============================# $keyList = $keyList . enable.auto.commit:false
#$keyList = $keyList . ,
print ================ test consume from stb #$keyList = $keyList . auto.commit.interval.ms:6000
$loop_cnt = 0 #$keyList = $keyList . ,
loop_consume_diff_topic_from_stb: #$keyList = $keyList . auto.offset.reset:earliest
$keyList = $keyList . '
####################################################################################### print ========== key list: $keyList
# clear consume info and consume result
#run tsim/tmq/clearConsume.sim
# because drop table function no stable, so by create new db for consume info and result. Modify it later $cdb_index = 0
$cdb_index = $cdb_index + 1 #=============================== start consume =============================#
$cdbName = cdb . $cdb_index
sql create database $cdbName vgroups 1 print ================ test consume from stb
sleep 500 $loop_cnt = 0
sql use $cdbName loop_consume_diff_topic_from_stb:
print == create consume info table and consume result table #######################################################################################
sql create table consumeinfo (ts timestamp, consumerid int, topiclist binary(1024), keylist binary(1024), expectmsgcnt bigint, ifcheckdata int) # clear consume info and consume result
sql create table consumeresult (ts timestamp, consumerid int, consummsgcnt bigint, consumrowcnt bigint, checkresult int) #run tsim/tmq/clearConsume.sim
# because drop table function no stable, so by create new db for consume info and result. Modify it later
sql show tables $cdb_index = $cdb_index + 1
if $rows != 2 then $cdbName = cdb . $cdb_index
return -1 sql create database $cdbName vgroups 1
endi sleep 500
####################################################################################### sql use $cdbName
if $loop_cnt == 0 then print == create consume info table and consume result table
print == scenario 1: topic_stb_column sql create table consumeinfo (ts timestamp, consumerid int, topiclist binary(1024), keylist binary(1024), expectmsgcnt bigint, ifcheckdata int, ifmanualcommit int)
$topicList = ' . topic_stb_column sql create table consumeresult (ts timestamp, consumerid int, consummsgcnt bigint, consumrowcnt bigint, checkresult int)
$topicList = $topicList . '
elif $loop_cnt == 1 then sql show tables
print == scenario 2: topic_stb_all if $rows != 2 then
$topicList = ' . topic_stb_all return -1
$topicList = $topicList . ' endi
elif $loop_cnt == 2 then #######################################################################################
print == scenario 3: topic_stb_function
$topicList = ' . topic_stb_function if $loop_cnt == 0 then
$topicList = $topicList . ' print == scenario 1: topic_stb_column
else $topicList = ' . topic_stb_column
goto loop_consume_diff_topic_from_stb_end $topicList = $topicList . '
endi elif $loop_cnt == 1 then
print == scenario 2: topic_stb_all
$consumerId = 0 $topicList = ' . topic_stb_all
$totalMsgOfStb = $ctbNum * $rowsPerCtb $topicList = $topicList . '
$expectmsgcnt = $totalMsgOfStb elif $loop_cnt == 2 then
sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata ) print == scenario 3: topic_stb_function
$topicList = ' . topic_stb_function
print == start consumer to pull msgs from stb $topicList = $topicList . '
print == tsim/tmq/consume.sh -d $dbName -y $pullDelay -g $showMsg -r $showRow -w $cdbName -s start else
system tsim/tmq/consume.sh -d $dbName -y $pullDelay -g $showMsg -r $showRow -w $cdbName -s start goto loop_consume_diff_topic_from_stb_end
endi
print == check consume result
wait_consumer_end_from_stb: $consumerId = 0
sql select * from consumeresult $totalMsgOfStb = $ctbNum * $rowsPerCtb
print ==> rows: $rows $expectmsgcnt = $totalMsgOfStb
print ==> rows[0]: $data[0][0] $data[0][1] $data[0][2] $data[0][3] $data[0][4] $data[0][5] $data[0][6] sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata , $ifmanualcommit )
if $rows != 1 then
sleep 1000 print == start consumer to pull msgs from stb
goto wait_consumer_end_from_stb print == tsim/tmq/consume.sh -d $dbName -y $pullDelay -g $showMsg -r $showRow -w $cdbName -s start
endi system tsim/tmq/consume.sh -d $dbName -y $pullDelay -g $showMsg -r $showRow -w $cdbName -s start
if $data[0][1] != $consumerId then
return -1 print == check consume result
endi wait_consumer_end_from_stb:
if $data[0][2] != $expectmsgcnt then sql select * from consumeresult
return -1 print ==> rows: $rows
endi print ==> rows[0]: $data[0][0] $data[0][1] $data[0][2] $data[0][3] $data[0][4] $data[0][5] $data[0][6]
if $data[0][3] != $expectmsgcnt then if $rows != 1 then
return -1 sleep 1000
endi goto wait_consumer_end_from_stb
$loop_cnt = $loop_cnt + 1 endi
goto loop_consume_diff_topic_from_stb if $data[0][1] != $consumerId then
loop_consume_diff_topic_from_stb_end: return -1
endi
print ================ test consume from ctb if $data[0][2] != $expectmsgcnt then
$loop_cnt = 0 return -1
loop_consume_diff_topic_from_ctb: endi
if $data[0][3] != $expectmsgcnt then
####################################################################################### return -1
# clear consume info and consume result endi
#run tsim/tmq/clearConsume.sim $loop_cnt = $loop_cnt + 1
# because drop table function no stable, so by create new db for consume info and result. Modify it later goto loop_consume_diff_topic_from_stb
$cdb_index = $cdb_index + 1 loop_consume_diff_topic_from_stb_end:
$cdbName = cdb . $cdb_index
sql create database $cdbName vgroups 1 print ================ test consume from ctb
sleep 500 $loop_cnt = 0
sql use $cdbName loop_consume_diff_topic_from_ctb:
print == create consume info table and consume result table #######################################################################################
sql create table consumeinfo (ts timestamp, consumerid int, topiclist binary(1024), keylist binary(1024), expectmsgcnt bigint, ifcheckdata int) # clear consume info and consume result
sql create table consumeresult (ts timestamp, consumerid int, consummsgcnt bigint, consumrowcnt bigint, checkresult int) #run tsim/tmq/clearConsume.sim
# because drop table function no stable, so by create new db for consume info and result. Modify it later
sql show tables $cdb_index = $cdb_index + 1
if $rows != 2 then $cdbName = cdb . $cdb_index
return -1 sql create database $cdbName vgroups 1
endi sleep 500
####################################################################################### sql use $cdbName
if $loop_cnt == 0 then print == create consume info table and consume result table
print == scenario 1: topic_ctb_column sql create table consumeinfo (ts timestamp, consumerid int, topiclist binary(1024), keylist binary(1024), expectmsgcnt bigint, ifcheckdata int, ifmanualcommit int)
$topicList = ' . topic_ctb_column sql create table consumeresult (ts timestamp, consumerid int, consummsgcnt bigint, consumrowcnt bigint, checkresult int)
$topicList = $topicList . '
elif $loop_cnt == 1 then sql show tables
print == scenario 2: topic_ctb_all if $rows != 2 then
$topicList = ' . topic_ctb_all return -1
$topicList = $topicList . ' endi
elif $loop_cnt == 2 then #######################################################################################
print == scenario 3: topic_ctb_function
$topicList = ' . topic_ctb_function if $loop_cnt == 0 then
$topicList = $topicList . ' print == scenario 1: topic_ctb_column
else $topicList = ' . topic_ctb_column
goto loop_consume_diff_topic_from_ctb_end $topicList = $topicList . '
endi elif $loop_cnt == 1 then
print == scenario 2: topic_ctb_all
$consumerId = 0 $topicList = ' . topic_ctb_all
$totalMsgOfCtb = $rowsPerCtb $topicList = $topicList . '
$expectmsgcnt = $totalMsgOfCtb elif $loop_cnt == 2 then
sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata ) print == scenario 3: topic_ctb_function
$topicList = ' . topic_ctb_function
print == start consumer to pull msgs from ctb $topicList = $topicList . '
print == tsim/tmq/consume.sh -d $dbName -y $pullDelay -g $showMsg -r $showRow -s start else
system tsim/tmq/consume.sh -d $dbName -y $pullDelay -g $showMsg -r $showRow -w $cdbName -s start goto loop_consume_diff_topic_from_ctb_end
endi
print == check consume result
wait_consumer_end_from_ctb: $consumerId = 0
sql select * from consumeresult $totalMsgOfCtb = $rowsPerCtb
print ==> rows: $rows $expectmsgcnt = $totalMsgOfCtb
print ==> rows[0]: $data[0][0] $data[0][1] $data[0][2] $data[0][3] $data[0][4] $data[0][5] $data[0][6] sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata , $ifmanualcommit )
if $rows != 1 then
sleep 1000 print == start consumer to pull msgs from ctb
goto wait_consumer_end_from_ctb print == tsim/tmq/consume.sh -d $dbName -y $pullDelay -g $showMsg -r $showRow -s start
endi system tsim/tmq/consume.sh -d $dbName -y $pullDelay -g $showMsg -r $showRow -w $cdbName -s start
if $data[0][1] != $consumerId then
return -1 print == check consume result
endi wait_consumer_end_from_ctb:
if $data[0][2] != $totalMsgOfCtb then sql select * from consumeresult
return -1 print ==> rows: $rows
endi print ==> rows[0]: $data[0][0] $data[0][1] $data[0][2] $data[0][3] $data[0][4] $data[0][5] $data[0][6]
if $data[0][3] != $totalMsgOfCtb then if $rows != 1 then
return -1 sleep 1000
endi goto wait_consumer_end_from_ctb
$loop_cnt = $loop_cnt + 1 endi
goto loop_consume_diff_topic_from_ctb if $data[0][1] != $consumerId then
loop_consume_diff_topic_from_ctb_end: return -1
endi
print ================ test consume from ntb if $data[0][2] != $totalMsgOfCtb then
$loop_cnt = 0 return -1
loop_consume_diff_topic_from_ntb: endi
if $data[0][3] != $totalMsgOfCtb then
####################################################################################### return -1
# clear consume info and consume result endi
#run tsim/tmq/clearConsume.sim $loop_cnt = $loop_cnt + 1
# because drop table function no stable, so by create new db for consume info and result. Modify it later goto loop_consume_diff_topic_from_ctb
$cdb_index = $cdb_index + 1 loop_consume_diff_topic_from_ctb_end:
$cdbName = cdb . $cdb_index
sql create database $cdbName vgroups 1 print ================ test consume from ntb
sleep 500 $loop_cnt = 0
sql use $cdbName loop_consume_diff_topic_from_ntb:
print == create consume info table and consume result table #######################################################################################
sql create table consumeinfo (ts timestamp, consumerid int, topiclist binary(1024), keylist binary(1024), expectmsgcnt bigint, ifcheckdata int) # clear consume info and consume result
sql create table consumeresult (ts timestamp, consumerid int, consummsgcnt bigint, consumrowcnt bigint, checkresult int) #run tsim/tmq/clearConsume.sim
# because drop table function no stable, so by create new db for consume info and result. Modify it later
sql show tables $cdb_index = $cdb_index + 1
if $rows != 2 then $cdbName = cdb . $cdb_index
return -1 sql create database $cdbName vgroups 1
endi sleep 500
####################################################################################### sql use $cdbName
if $loop_cnt == 0 then print == create consume info table and consume result table
print == scenario 1: topic_ntb_column sql create table consumeinfo (ts timestamp, consumerid int, topiclist binary(1024), keylist binary(1024), expectmsgcnt bigint, ifcheckdata int, ifmanualcommit int)
$topicList = ' . topic_ntb_column sql create table consumeresult (ts timestamp, consumerid int, consummsgcnt bigint, consumrowcnt bigint, checkresult int)
$topicList = $topicList . '
elif $loop_cnt == 1 then sql show tables
print == scenario 2: topic_ntb_all if $rows != 2 then
$topicList = ' . topic_ntb_all return -1
$topicList = $topicList . ' endi
elif $loop_cnt == 2 then #######################################################################################
print == scenario 3: topic_ntb_function
$topicList = ' . topic_ntb_function if $loop_cnt == 0 then
$topicList = $topicList . ' print == scenario 1: topic_ntb_column
else $topicList = ' . topic_ntb_column
goto loop_consume_diff_topic_from_ntb_end $topicList = $topicList . '
endi elif $loop_cnt == 1 then
print == scenario 2: topic_ntb_all
$consumerId = 0 $topicList = ' . topic_ntb_all
$totalMsgOfNtb = $rowsPerCtb $topicList = $topicList . '
$expectmsgcnt = $totalMsgOfNtb elif $loop_cnt == 2 then
sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata ) print == scenario 3: topic_ntb_function
$topicList = ' . topic_ntb_function
print == start consumer to pull msgs from ntb $topicList = $topicList . '
print == tsim/tmq/consume.sh -d $dbName -y $pullDelay -g $showMsg -r $showRow -s start else
system tsim/tmq/consume.sh -d $dbName -y $pullDelay -g $showMsg -r $showRow -w $cdbName -s start goto loop_consume_diff_topic_from_ntb_end
endi
print == check consume result from ntb
wait_consumer_end_from_ntb: $consumerId = 0
sql select * from consumeresult $totalMsgOfNtb = $rowsPerCtb
print ==> rows: $rows $expectmsgcnt = $totalMsgOfNtb
print ==> rows[0]: $data[0][0] $data[0][1] $data[0][2] $data[0][3] $data[0][4] $data[0][5] $data[0][6] sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata , $ifmanualcommit )
if $rows != 1 then
sleep 1000 print == start consumer to pull msgs from ntb
goto wait_consumer_end_from_ntb print == tsim/tmq/consume.sh -d $dbName -y $pullDelay -g $showMsg -r $showRow -s start
endi system tsim/tmq/consume.sh -d $dbName -y $pullDelay -g $showMsg -r $showRow -w $cdbName -s start
if $data[0][1] != $consumerId then
return -1 print == check consume result from ntb
endi wait_consumer_end_from_ntb:
if $data[0][2] != $totalMsgOfNtb then sql select * from consumeresult
return -1 print ==> rows: $rows
endi print ==> rows[0]: $data[0][0] $data[0][1] $data[0][2] $data[0][3] $data[0][4] $data[0][5] $data[0][6]
if $data[0][3] != $totalMsgOfNtb then if $rows != 1 then
return -1 sleep 1000
endi goto wait_consumer_end_from_ntb
$loop_cnt = $loop_cnt + 1 endi
goto loop_consume_diff_topic_from_ntb if $data[0][1] != $consumerId then
loop_consume_diff_topic_from_ntb_end: return -1
endi
#------ not need stop consumer, because it exit after pull msg overthan expect msg if $data[0][2] != $totalMsgOfNtb then
#system tsim/tmq/consume.sh -s stop -x SIGINT return -1
endi
system sh/exec.sh -n dnode1 -s stop -x SIGINT if $data[0][3] != $totalMsgOfNtb then
return -1
endi
$loop_cnt = $loop_cnt + 1
goto loop_consume_diff_topic_from_ntb
loop_consume_diff_topic_from_ntb_end:
#------ not need stop consumer, because it exit after pull msg overthan expect msg
#system tsim/tmq/consume.sh -s stop -x SIGINT
system sh/exec.sh -n dnode1 -s stop -x SIGINT
#### test scenario, please refer to https://jira.taosdata.com:18090/pages/viewpage.action?pageId=135120406 #### test scenario, please refer to https://jira.taosdata.com:18090/pages/viewpage.action?pageId=135120406
#basic1.sim: vgroups=1, one topic for one consumer, firstly insert data, then start consume. Include six topics #basic1.sim: vgroups=1, one topic for one consumer, firstly insert data, then start consume. Include six topics
#basic2.sim: vgroups=1, multi topics for one consumer, firstly insert data, then start consume. Include six topics #basic2.sim: vgroups=1, multi topics for one consumer, firstly insert data, then start consume. Include six topics
#basic3.sim: vgroups=4, one topic for one consumer, firstly insert data, then start consume. Include six topics #basic3.sim: vgroups=4, one topic for one consumer, firstly insert data, then start consume. Include six topics
#basic4.sim: vgroups=4, multi topics for one consumer, firstly insert data, then start consume. Include six topics #basic4.sim: vgroups=4, multi topics for one consumer, firstly insert data, then start consume. Include six topics
# notes1: Scalar function: ABS/ACOS/ASIN/ATAN/CEIL/COS/FLOOR/LOG/POW/ROUND/SIN/SQRT/TAN # notes1: Scalar function: ABS/ACOS/ASIN/ATAN/CEIL/COS/FLOOR/LOG/POW/ROUND/SIN/SQRT/TAN
# The above use cases are combined with where filter conditions, such as: where ts > "2017-08-12 18:25:58.128Z" and sin(a) > 0.5; # The above use cases are combined with where filter conditions, such as: where ts > "2017-08-12 18:25:58.128Z" and sin(a) > 0.5;
# #
# notes2: not support aggregate functions(such as sum/count/min/max) and time-windows(interval). # notes2: not support aggregate functions(such as sum/count/min/max) and time-windows(interval).
# #
run tsim/tmq/prepareBasicEnv-4vgrp.sim run tsim/tmq/prepareBasicEnv-4vgrp.sim
#---- global parameters start ----# #---- global parameters start ----#
$dbName = db $dbName = db
$vgroups = 4 $vgroups = 4
$stbPrefix = stb $stbPrefix = stb
$ctbPrefix = ctb $ctbPrefix = ctb
$ntbPrefix = ntb $ntbPrefix = ntb
$stbNum = 1 $stbNum = 1
$ctbNum = 10 $ctbNum = 10
$ntbNum = 10 $ntbNum = 10
$rowsPerCtb = 10 $rowsPerCtb = 10
$tstart = 1640966400000 # 2022-01-01 00:00:00.000 $tstart = 1640966400000 # 2022-01-01 00:00:00.000
#---- global parameters end ----# #---- global parameters end ----#
$pullDelay = 3 $pullDelay = 3
$ifcheckdata = 1 $ifcheckdata = 1
$showMsg = 1 $ifmanualcommit = 1
$showRow = 0 $showMsg = 1
$showRow = 0
sql connect
sql use $dbName sql connect
sql use $dbName
print == create topics from super table
sql create topic topic_stb_column as select ts, c3 from stb print == create topics from super table
sql create topic topic_stb_all as select ts, c1, c2, c3 from stb sql create topic topic_stb_column as select ts, c3 from stb
sql create topic topic_stb_function as select ts, abs(c1), sin(c2) from stb sql create topic topic_stb_all as select ts, c1, c2, c3 from stb
sql create topic topic_stb_function as select ts, abs(c1), sin(c2) from stb
print == create topics from child table
sql create topic topic_ctb_column as select ts, c3 from ctb0 print == create topics from child table
sql create topic topic_ctb_all as select * from ctb0 sql create topic topic_ctb_column as select ts, c3 from ctb0
sql create topic topic_ctb_function as select ts, abs(c1), sin(c2) from ctb0 sql create topic topic_ctb_all as select * from ctb0
sql create topic topic_ctb_function as select ts, abs(c1), sin(c2) from ctb0
print == create topics from normal table
sql create topic topic_ntb_column as select ts, c3 from ntb0 print == create topics from normal table
sql create topic topic_ntb_all as select * from ntb0 sql create topic topic_ntb_column as select ts, c3 from ntb0
sql create topic topic_ntb_function as select ts, abs(c1), sin(c2) from ntb0 sql create topic topic_ntb_all as select * from ntb0
sql create topic topic_ntb_function as select ts, abs(c1), sin(c2) from ntb0
#sql show topics
#if $rows != 9 then #sql show topics
# return -1 #if $rows != 9 then
#endi # return -1
#endi
$keyList = ' . group.id:cgrp1
$keyList = $keyList . ' #'group.id:cgrp1,enable.auto.commit:false,auto.commit.interval.ms:6000,auto.offset.reset:earliest'
$keyList = ' . group.id:cgrp1
$topicNum = 3 $keyList = $keyList . ,
$keyList = $keyList . enable.auto.commit:false
print ================ test consume from stb #$keyList = $keyList . ,
print == multi toipcs: topic_stb_column + topic_stb_all + topic_stb_function #$keyList = $keyList . auto.commit.interval.ms:6000
$topicList = ' . topic_stb_column #$keyList = $keyList . ,
$topicList = $topicList . , #$keyList = $keyList . auto.offset.reset:earliest
$topicList = $topicList . topic_stb_all $keyList = $keyList . '
$topicList = $topicList . , print ========== key list: $keyList
$topicList = $topicList . topic_stb_function
$topicList = $topicList . '
$topicNum = 3
$consumerId = 0
$totalMsgOfStb = $ctbNum * $rowsPerCtb print ================ test consume from stb
$totalMsgOfStb = $totalMsgOfStb * $topicNum print == multi toipcs: topic_stb_column + topic_stb_all + topic_stb_function
$expectmsgcnt = $totalMsgOfStb $topicList = ' . topic_stb_column
sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata ) $topicList = $topicList . ,
$topicList = $topicList . topic_stb_all
print == start consumer to pull msgs from stb $topicList = $topicList . ,
print == tsim/tmq/consume.sh -d $dbName -y $pullDelay -g $showMsg -r $showRow -w $dbName -s start $topicList = $topicList . topic_stb_function
system tsim/tmq/consume.sh -d $dbName -y $pullDelay -g $showMsg -r $showRow -w $dbName -s start $topicList = $topicList . '
print == check consume result $consumerId = 0
wait_consumer_end_from_stb: $totalMsgOfStb = $ctbNum * $rowsPerCtb
sql select * from consumeresult $totalMsgOfStb = $totalMsgOfStb * $topicNum
print ==> rows: $rows $expectmsgcnt = $totalMsgOfStb
print ==> rows[0]: $data[0][0] $data[0][1] $data[0][2] $data[0][3] $data[0][4] $data[0][5] $data[0][6] sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata , $ifmanualcommit )
if $rows != 1 then
sleep 1000 print == start consumer to pull msgs from stb
goto wait_consumer_end_from_stb print == tsim/tmq/consume.sh -d $dbName -y $pullDelay -g $showMsg -r $showRow -w $dbName -s start
endi system tsim/tmq/consume.sh -d $dbName -y $pullDelay -g $showMsg -r $showRow -w $dbName -s start
if $data[0][1] != $consumerId then
return -1 print == check consume result
endi wait_consumer_end_from_stb:
if $data[0][2] != $expectmsgcnt then sql select * from consumeresult
return -1 print ==> rows: $rows
endi print ==> rows[0]: $data[0][0] $data[0][1] $data[0][2] $data[0][3] $data[0][4] $data[0][5] $data[0][6]
if $data[0][3] != $expectmsgcnt then if $rows != 1 then
return -1 sleep 1000
endi goto wait_consumer_end_from_stb
endi
####################################################################################### if $data[0][1] != $consumerId then
# clear consume info and consume result return -1
#run tsim/tmq/clearConsume.sim endi
# because drop table function no stable, so by create new db for consume info and result. Modify it later if $data[0][2] != $expectmsgcnt then
$cdbName = cdb1 return -1
sql create database $cdbName vgroups 1 endi
sleep 500 if $data[0][3] != $expectmsgcnt then
sql use $cdbName return -1
endi
print == create consume info table and consume result table
sql create table consumeinfo (ts timestamp, consumerid int, topiclist binary(1024), keylist binary(1024), expectmsgcnt bigint, ifcheckdata int) #######################################################################################
sql create table consumeresult (ts timestamp, consumerid int, consummsgcnt bigint, consumrowcnt bigint, checkresult int) # clear consume info and consume result
#run tsim/tmq/clearConsume.sim
sql show tables # because drop table function no stable, so by create new db for consume info and result. Modify it later
if $rows != 2 then $cdbName = cdb1
return -1 sql create database $cdbName vgroups 1
endi sleep 500
####################################################################################### sql use $cdbName
print == create consume info table and consume result table
print ================ test consume from ctb sql create table consumeinfo (ts timestamp, consumerid int, topiclist binary(1024), keylist binary(1024), expectmsgcnt bigint, ifcheckdata int, ifmanualcommit int)
print == multi toipcs: topic_ctb_column + topic_ctb_all + topic_ctb_function sql create table consumeresult (ts timestamp, consumerid int, consummsgcnt bigint, consumrowcnt bigint, checkresult int)
$topicList = ' . topic_ctb_column
$topicList = $topicList . , sql show tables
$topicList = $topicList . topic_ctb_all if $rows != 2 then
$topicList = $topicList . , return -1
$topicList = $topicList . topic_ctb_function endi
$topicList = $topicList . ' #######################################################################################
$consumerId = 0
$totalMsgOfCtb = $rowsPerCtb * $topicNum print ================ test consume from ctb
$expectmsgcnt = $totalMsgOfCtb print == multi toipcs: topic_ctb_column + topic_ctb_all + topic_ctb_function
sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata ) $topicList = ' . topic_ctb_column
$topicList = $topicList . ,
print == start consumer to pull msgs from ctb $topicList = $topicList . topic_ctb_all
print == tsim/tmq/consume.sh -d $dbName -y $pullDelay -g $showMsg -r $showRow -s start $topicList = $topicList . ,
system tsim/tmq/consume.sh -d $dbName -y $pullDelay -g $showMsg -r $showRow -w $cdbName -s start $topicList = $topicList . topic_ctb_function
$topicList = $topicList . '
print == check consume result
wait_consumer_end_from_ctb: $consumerId = 0
sql select * from consumeresult $totalMsgOfCtb = $rowsPerCtb * $topicNum
print ==> rows: $rows $expectmsgcnt = $totalMsgOfCtb
print ==> rows[0]: $data[0][0] $data[0][1] $data[0][2] $data[0][3] $data[0][4] $data[0][5] $data[0][6] sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata , $ifmanualcommit )
if $rows != 1 then
sleep 1000 print == start consumer to pull msgs from ctb
goto wait_consumer_end_from_ctb print == tsim/tmq/consume.sh -d $dbName -y $pullDelay -g $showMsg -r $showRow -s start
endi system tsim/tmq/consume.sh -d $dbName -y $pullDelay -g $showMsg -r $showRow -w $cdbName -s start
if $data[0][1] != $consumerId then
return -1 print == check consume result
endi wait_consumer_end_from_ctb:
if $data[0][2] != $totalMsgOfCtb then sql select * from consumeresult
return -1 print ==> rows: $rows
endi print ==> rows[0]: $data[0][0] $data[0][1] $data[0][2] $data[0][3] $data[0][4] $data[0][5] $data[0][6]
if $data[0][3] != $totalMsgOfCtb then if $rows != 1 then
return -1 sleep 1000
endi goto wait_consumer_end_from_ctb
endi
####################################################################################### if $data[0][1] != $consumerId then
# clear consume info and consume result return -1
#run tsim/tmq/clearConsume.sim endi
# because drop table function no stable, so by create new db for consume info and result. Modify it later if $data[0][2] != $totalMsgOfCtb then
$cdbName = cdb2 return -1
sql create database $cdbName vgroups 1 endi
sleep 500 if $data[0][3] != $totalMsgOfCtb then
sql use $cdbName return -1
endi
print == create consume info table and consume result table
sql create table consumeinfo (ts timestamp, consumerid int, topiclist binary(1024), keylist binary(1024), expectmsgcnt bigint, ifcheckdata int) #######################################################################################
sql create table consumeresult (ts timestamp, consumerid int, consummsgcnt bigint, consumrowcnt bigint, checkresult int) # clear consume info and consume result
#run tsim/tmq/clearConsume.sim
sql show tables # because drop table function no stable, so by create new db for consume info and result. Modify it later
if $rows != 2 then $cdbName = cdb2
return -1 sql create database $cdbName vgroups 1
endi sleep 500
####################################################################################### sql use $cdbName
print == create consume info table and consume result table
print ================ test consume from ntb sql create table consumeinfo (ts timestamp, consumerid int, topiclist binary(1024), keylist binary(1024), expectmsgcnt bigint, ifcheckdata int, ifmanualcommit int)
print == multi toipcs: topic_ntb_column + topic_ntb_all + topic_ntb_function sql create table consumeresult (ts timestamp, consumerid int, consummsgcnt bigint, consumrowcnt bigint, checkresult int)
$topicList = ' . topic_ntb_column
$topicList = $topicList . , sql show tables
$topicList = $topicList . topic_ntb_all if $rows != 2 then
$topicList = $topicList . , return -1
$topicList = $topicList . topic_ntb_function endi
$topicList = $topicList . ' #######################################################################################
$consumerId = 0
$totalMsgOfNtb = $rowsPerCtb * $topicNum print ================ test consume from ntb
$expectmsgcnt = $totalMsgOfNtb print == multi toipcs: topic_ntb_column + topic_ntb_all + topic_ntb_function
sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata ) $topicList = ' . topic_ntb_column
$topicList = $topicList . ,
print == start consumer to pull msgs from ntb $topicList = $topicList . topic_ntb_all
print == tsim/tmq/consume.sh -d $dbName -y $pullDelay -g $showMsg -r $showRow -s start $topicList = $topicList . ,
system tsim/tmq/consume.sh -d $dbName -y $pullDelay -g $showMsg -r $showRow -w $cdbName -s start $topicList = $topicList . topic_ntb_function
$topicList = $topicList . '
print == check consume result from ntb
wait_consumer_end_from_ntb: $consumerId = 0
sql select * from consumeresult $totalMsgOfNtb = $rowsPerCtb * $topicNum
print ==> rows: $rows $expectmsgcnt = $totalMsgOfNtb
print ==> rows[0]: $data[0][0] $data[0][1] $data[0][2] $data[0][3] $data[0][4] $data[0][5] $data[0][6] sql insert into consumeinfo values (now , $consumerId , $topicList , $keyList , $expectmsgcnt , $ifcheckdata , $ifmanualcommit )
if $rows != 1 then
sleep 1000 print == start consumer to pull msgs from ntb
goto wait_consumer_end_from_ntb print == tsim/tmq/consume.sh -d $dbName -y $pullDelay -g $showMsg -r $showRow -s start
endi system tsim/tmq/consume.sh -d $dbName -y $pullDelay -g $showMsg -r $showRow -w $cdbName -s start
if $data[0][1] != $consumerId then
return -1 print == check consume result from ntb
endi wait_consumer_end_from_ntb:
if $data[0][2] != $totalMsgOfNtb then sql select * from consumeresult
return -1 print ==> rows: $rows
endi print ==> rows[0]: $data[0][0] $data[0][1] $data[0][2] $data[0][3] $data[0][4] $data[0][5] $data[0][6]
if $data[0][3] != $totalMsgOfNtb then if $rows != 1 then
return -1 sleep 1000
endi goto wait_consumer_end_from_ntb
endi
#------ not need stop consumer, because it exit after pull msg overthan expect msg if $data[0][1] != $consumerId then
#system tsim/tmq/consume.sh -s stop -x SIGINT return -1
endi
system sh/exec.sh -n dnode1 -s stop -x SIGINT if $data[0][2] != $totalMsgOfNtb then
return -1
endi
if $data[0][3] != $totalMsgOfNtb then
return -1
endi
#------ not need stop consumer, because it exit after pull msg overthan expect msg
#system tsim/tmq/consume.sh -s stop -x SIGINT
system sh/exec.sh -n dnode1 -s stop -x SIGINT
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册