From c0f152c4ce13ba101b9ca94593d98ef4fb5adc0e Mon Sep 17 00:00:00 2001 From: xywang Date: Wed, 13 Oct 2021 14:24:59 +0800 Subject: [PATCH] [TD-6662]: fixed bug in subscription to normal table with ts limitation --- src/client/src/tscSub.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/client/src/tscSub.c b/src/client/src/tscSub.c index 0c5eac66e2..5e70c81413 100644 --- a/src/client/src/tscSub.c +++ b/src/client/src/tscSub.c @@ -266,12 +266,14 @@ static int tscUpdateSubscription(STscObj* pObj, SSub* pSub) { SSqlCmd* pCmd = &pSql->cmd; - TSDB_QUERY_CLEAR_TYPE(tscGetQueryInfo(pCmd)->type, TSDB_QUERY_TYPE_MULTITABLE_QUERY); + SQueryInfo* pQueryInfo = tscGetQueryInfo(pCmd); + + TSDB_QUERY_CLEAR_TYPE(pQueryInfo->type, TSDB_QUERY_TYPE_MULTITABLE_QUERY); STableMetaInfo *pTableMetaInfo = tscGetTableMetaInfoFromCmd(pCmd, 0); if (UTIL_TABLE_IS_NORMAL_TABLE(pTableMetaInfo)) { STableMeta * pTableMeta = pTableMetaInfo->pTableMeta; - SSubscriptionProgress target = {.uid = pTableMeta->id.uid, .key = 0}; + SSubscriptionProgress target = {.uid = pTableMeta->id.uid, .key = pQueryInfo->window.skey}; SSubscriptionProgress* p = taosArraySearch(pSub->progress, &target, tscCompareSubscriptionProgress, TD_EQ); if (p == NULL) { taosArrayClear(pSub->progress); @@ -289,7 +291,6 @@ static int tscUpdateSubscription(STscObj* pObj, SSub* pSub) { } size_t numOfTables = taosArrayGetSize(tables); - SQueryInfo* pQueryInfo = tscGetQueryInfo(pCmd); SArray* progress = taosArrayInit(numOfTables, sizeof(SSubscriptionProgress)); for( size_t i = 0; i < numOfTables; i++ ) { STidTags* tt = taosArrayGet( tables, i ); -- GitLab