From 029a45cd0432553ebdc239a20e847fa4104e1eda Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Tue, 2 Jun 2020 05:31:50 +0000 Subject: [PATCH] [TD-501] When the number of rows is greater than 100, the show result is incorrect --- src/mnode/src/mnodeShow.c | 2 +- tests/script/general/stable/show.sim | 49 ++++++++++++++++++++++++++++ tests/script/jenkins/basic.txt | 1 + 3 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 tests/script/general/stable/show.sim diff --git a/src/mnode/src/mnodeShow.c b/src/mnode/src/mnodeShow.c index 20616bfbcd..dd6de9d351 100644 --- a/src/mnode/src/mnodeShow.c +++ b/src/mnode/src/mnodeShow.c @@ -211,7 +211,7 @@ static int32_t mnodeProcessRetrieveMsg(SMnodeMsg *pMsg) { pMsg->rpcRsp.rsp = pRsp; pMsg->rpcRsp.len = size; - if (rowsToRead == 0 || rowsRead == rowsToRead) { + if (rowsToRead == 0 || (rowsRead == rowsToRead && pShow->numOfRows - pShow->numOfReads == rowsToRead)) { pRsp->completed = 1; mnodeReleaseShowObj(pShow, true); } else { diff --git a/tests/script/general/stable/show.sim b/tests/script/general/stable/show.sim new file mode 100644 index 0000000000..b25418cc2a --- /dev/null +++ b/tests/script/general/stable/show.sim @@ -0,0 +1,49 @@ +system sh/stop_dnodes.sh + +system sh/deploy.sh -n dnode1 -i 1 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 +system sh/cfg.sh -n dnode1 -c numOfTotalVnodes -v 4 +system sh/exec.sh -n dnode1 -s start + +sleep 3000 +sql connect + +print ======================== create stable + +sql create database d1 + +$x = 0 +while $x < 128 + $tb = d1.s . $x + sql create table $tb (ts timestamp, i int) tags (j int) + $x = $x + 1 +endw + +print ======================== show stables + +sql show d1.stables + +print num of stables is $rows +if $rows != 128 then + return -1 +endi + +print ======================== create table + +$x = 0 +while $x < 424 + $tb = d1.t . $x + sql create table $tb using d1.s0 tags( $x ) + $x = $x + 1 +endw + +print ======================== show stables + +sql show d1.tables + +print num of tables is $rows +if $rows != 424 then + return -1 +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/jenkins/basic.txt b/tests/script/jenkins/basic.txt index c41ac43ee0..c6f3082a88 100644 --- a/tests/script/jenkins/basic.txt +++ b/tests/script/jenkins/basic.txt @@ -155,6 +155,7 @@ cd ../../../debug; make ./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/show.sim ./test.sh -f general/stable/values.sim ./test.sh -f general/stable/vnode3.sim -- GitLab