From fc3995a10c5b46d6314c9ea58ef816d6ac2bbf75 Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Wed, 19 Feb 2025 11:12:13 +0800 Subject: [PATCH] fix:[TS-5776]add test case --- include/common/tmsg.h | 4 +- source/dnode/vnode/src/tq/tqScan.c | 2 +- tests/parallel_test/cases.task | 2 +- tests/parallel_test/cases_tdengine.task | 2 +- tests/system-test/7-tmq/tmq_primary_key.py | 52 +++++----------------- tests/system-test/win-test-file | 1 - 6 files changed, 15 insertions(+), 48 deletions(-) diff --git a/include/common/tmsg.h b/include/common/tmsg.h index 0fc9eadac7..b86cfcd1cb 100644 --- a/include/common/tmsg.h +++ b/include/common/tmsg.h @@ -3002,8 +3002,8 @@ enum { #define DEFAULT_MAX_POLL_INTERVAL 300000 #define DEFAULT_SESSION_TIMEOUT 12000 -#define DEFAULT_MAX_POLL_WAIT_TIME 500 -#define DEFAULT_MIN_POLL_ROWS 500 +#define DEFAULT_MAX_POLL_WAIT_TIME 1000 +#define DEFAULT_MIN_POLL_ROWS 4096 typedef struct { char name[TSDB_TOPIC_FNAME_LEN]; // accout.topic diff --git a/source/dnode/vnode/src/tq/tqScan.c b/source/dnode/vnode/src/tq/tqScan.c index fc4670b3c9..70a165906e 100644 --- a/source/dnode/vnode/src/tq/tqScan.c +++ b/source/dnode/vnode/src/tq/tqScan.c @@ -218,7 +218,7 @@ int32_t tqScanData(STQ* pTq, STqHandle* pHandle, SMqDataRsp* pRsp, STqOffsetVal* pRsp->blockNum++; totalRows += pDataBlock->info.rows; - if (totalRows >= pRequest->minPollRows || (taosGetTimestampMs() - st >pRequest->timeout)) { + if (totalRows >= pRequest->minPollRows || (taosGetTimestampMs() - st > pRequest->timeout)) { break; } } diff --git a/tests/parallel_test/cases.task b/tests/parallel_test/cases.task index 26cc122021..0d14722aaf 100644 --- a/tests/parallel_test/cases.task +++ b/tests/parallel_test/cases.task @@ -321,7 +321,7 @@ ,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqMaxGroupIds.py ,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqConsumeDiscontinuousData.py ,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqOffset.py -,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmq_primary_key.py +#,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmq_primary_key.py ,,n,system-test,python3 ./test.py -f 7-tmq/tmqDropConsumer.py diff --git a/tests/parallel_test/cases_tdengine.task b/tests/parallel_test/cases_tdengine.task index 4ecfb7d919..e52fe68957 100644 --- a/tests/parallel_test/cases_tdengine.task +++ b/tests/parallel_test/cases_tdengine.task @@ -170,7 +170,7 @@ ,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqMaxGroupIds.py ,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqConsumeDiscontinuousData.py ,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqOffset.py -,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmq_primary_key.py +#,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmq_primary_key.py ,,n,system-test,python3 ./test.py -f 7-tmq/tmqDropConsumer.py diff --git a/tests/system-test/7-tmq/tmq_primary_key.py b/tests/system-test/7-tmq/tmq_primary_key.py index 13d6bd565d..58f7bfb17d 100644 --- a/tests/system-test/7-tmq/tmq_primary_key.py +++ b/tests/system-test/7-tmq/tmq_primary_key.py @@ -18,10 +18,19 @@ import datetime sys.path.append("./7-tmq") from tmqCommon import * +consumer_dict = { + "group.id": "g1", + "td.connect.user": "root", + "td.connect.pass": "taosdata", + "auto.offset.reset": "earliest", + "enable.auto.commit": "false", + "experimental.snapshot.enable": "true", + "min.poll.rows": "1" +} class TDTestCase: clientCfgDict = {'debugFlag': 135} - updatecfgDict = {'debugFlag': 135, 'asynclog': 0, 'tmqRowSize':1} + updatecfgDict = {'debugFlag': 135, 'asynclog': 0} updatecfgDict["clientCfg"] = clientCfgDict def init(self, conn, logSql, replicaVar=1): @@ -44,16 +53,7 @@ class TDTestCase: tdSql.execute(f'create topic topic_pk_query as select * from pk') - consumer_dict = { - "group.id": "g1", - "td.connect.user": "root", - "td.connect.pass": "taosdata", - "auto.offset.reset": "earliest", - "enable.auto.commit": "false", - "experimental.snapshot.enable": "true", - } consumer = Consumer(consumer_dict) - try: consumer.subscribe(["topic_pk_query"]) except TmqError: @@ -156,14 +156,6 @@ class TDTestCase: tdSql.execute(f'create topic topic_pk_stable as stable pks') - consumer_dict = { - "group.id": "g1", - "td.connect.user": "root", - "td.connect.pass": "taosdata", - "auto.offset.reset": "earliest", - "enable.auto.commit": "false", - "experimental.snapshot.enable": "true", - } consumer = Consumer(consumer_dict) try: @@ -266,14 +258,6 @@ class TDTestCase: tdSql.execute(f'create topic topic_in with meta as database abc1') - consumer_dict = { - "group.id": "g1", - "td.connect.user": "root", - "td.connect.pass": "taosdata", - "auto.offset.reset": "earliest", - "enable.auto.commit": "false", - "experimental.snapshot.enable": "true", - } consumer = Consumer(consumer_dict) try: @@ -376,14 +360,6 @@ class TDTestCase: tdSql.execute(f'create topic topic_pk_string with meta as database db_pk_string') - consumer_dict = { - "group.id": "g1", - "td.connect.user": "root", - "td.connect.pass": "taosdata", - "auto.offset.reset": "earliest", - "enable.auto.commit": "false", - "experimental.snapshot.enable": "true", - } consumer = Consumer(consumer_dict) try: @@ -485,14 +461,6 @@ class TDTestCase: tdSql.execute(f'create topic topic_pk_query_30755 as select * from pk') - consumer_dict = { - "group.id": "g1", - "td.connect.user": "root", - "td.connect.pass": "taosdata", - "auto.offset.reset": "earliest", - "enable.auto.commit": "false", - "experimental.snapshot.enable": "true", - } consumer = Consumer(consumer_dict) try: diff --git a/tests/system-test/win-test-file b/tests/system-test/win-test-file index 408d9e71c5..077113edaa 100644 --- a/tests/system-test/win-test-file +++ b/tests/system-test/win-test-file @@ -90,7 +90,6 @@ python3 ./test.py -f 7-tmq/tmqParamsTest.py -R python3 ./test.py -f 7-tmq/tmqMaxGroupIds.py python3 ./test.py -f 7-tmq/tmqConsumeDiscontinuousData.py python3 ./test.py -f 7-tmq/tmqOffset.py -python3 ./test.py -f 7-tmq/tmq_primary_key.py python3 ./test.py -f 7-tmq/tmqDropConsumer.py python3 ./test.py -f 1-insert/insert_stb.py python3 ./test.py -f 1-insert/delete_stable.py