From ce2a3e4be2a9113d4daf55bb5ba22089578b5270 Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Fri, 26 Jan 2024 15:35:29 +0800 Subject: [PATCH] fix:test case error --- source/common/src/tgrant.c | 2 +- source/dnode/mnode/impl/src/mndStream.c | 21 +++++++++---------- .../0-others/subscribe_stream_privilege.py | 8 +++++-- 3 files changed, 17 insertions(+), 14 deletions(-) diff --git a/source/common/src/tgrant.c b/source/common/src/tgrant.c index eb0e677b37..6251131005 100644 --- a/source/common/src/tgrant.c +++ b/source/common/src/tgrant.c @@ -19,7 +19,7 @@ #ifndef _GRANT int32_t grantCheck(EGrantType grant) { - if(taosGetTimestampMs() < 1706252996000) { + if(taosGetTimestampMs() < 1706254434000) { uError("receivee no expired"); return 0; } else{ diff --git a/source/dnode/mnode/impl/src/mndStream.c b/source/dnode/mnode/impl/src/mndStream.c index 79e39df581..4b753fb5a6 100644 --- a/source/dnode/mnode/impl/src/mndStream.c +++ b/source/dnode/mnode/impl/src/mndStream.c @@ -3050,24 +3050,23 @@ int32_t suspendAllStreams(SMnode *pMnode, SRpcHandleInfo* info){ if (pIter == NULL) break; if(pStream->status != STREAM_STATUS__PAUSE){ - SMPauseStreamReq *reqPause = rpcMallocCont(sizeof(SMPauseStreamReq)); - if (reqPause == NULL) { - terrno = TSDB_CODE_OUT_OF_MEMORY; - sdbRelease(pSdb, pStream); - return -1; - } - strcpy(reqPause->name, pStream->name); - reqPause->igNotExists = 1; + SMPauseStreamReq reqPause = {0}; + strcpy(reqPause.name, pStream->name); + reqPause.igNotExists = 1; + + int32_t contLen = tSerializeSMPauseStreamReq(NULL, 0, &reqPause); + void * pHead = rpcMallocCont(contLen); + tSerializeSMPauseStreamReq(pHead, contLen, &reqPause); SRpcMsg rpcMsg = { .msgType = TDMT_MND_PAUSE_STREAM, - .pCont = reqPause, - .contLen = sizeof(SMPauseStreamReq), + .pCont = pHead, + .contLen = contLen, .info = *info, }; tmsgPutToQueue(&pMnode->msgCb, WRITE_QUEUE, &rpcMsg); - mInfo("receivee pause stream:%s, %s, %p, because grant expired", pStream->name, reqPause->name, reqPause->name); + mInfo("receivee pause stream:%s, %s, %p, because grant expired", pStream->name, reqPause.name, reqPause.name); } sdbRelease(pSdb, pStream); diff --git a/tests/system-test/0-others/subscribe_stream_privilege.py b/tests/system-test/0-others/subscribe_stream_privilege.py index 44778d39d8..9656d0e5e8 100644 --- a/tests/system-test/0-others/subscribe_stream_privilege.py +++ b/tests/system-test/0-others/subscribe_stream_privilege.py @@ -92,7 +92,7 @@ class TDTestCase: print(time.time()) while 1: t = time.time() - if t > 1706252996 : + if t > 1706254434 : break else: print("time:%d" %(t)) @@ -100,12 +100,16 @@ class TDTestCase: tdSql.error("create stream s11 trigger at_once fill_history 1 into so1 as select ts,abs(col2) from stb partition by tbname") + + time.sleep(10) tdSql.query("select * from information_schema.ins_stream_tasks") - tdSql.checkData(0, 5, 'pause') + tdSql.checkData(0, 5, 'paused') tdSql.execute("insert into stb_0(ts,col2) values(now, 3232)") tdSql.query("select * from so1") tdSql.checkRows(5) + tdSql.error("resume stream s1") + def consumeTest(self): consumer_dict = { "group.id": "g1",