From 8904f3857b5ef44960072d9d3ec82f9f7f689b06 Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Sun, 9 Jul 2023 19:16:19 +0800 Subject: [PATCH] fix:seek failed in initilized status --- source/client/src/clientTmq.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/source/client/src/clientTmq.c b/source/client/src/clientTmq.c index 2a3ef8b129..f514bb616c 100644 --- a/source/client/src/clientTmq.c +++ b/source/client/src/clientTmq.c @@ -2780,18 +2780,18 @@ int32_t tmq_offset_seek(tmq_t* tmq, const char* pTopicName, int32_t vgId, int64_ SVgOffsetInfo* pOffsetInfo = &pVg->offsetInfo; int32_t type = pOffsetInfo->currentOffset.type; -// if (type != TMQ_OFFSET__LOG && !OFFSET_IS_RESET_OFFSET(type)) { -// tscError("consumer:0x%" PRIx64 " offset type:%d not wal version, seek not allowed", tmq->consumerId, type); -// taosWUnLockLatch(&tmq->lock); -// return TSDB_CODE_INVALID_PARA; -// } -// -// if (type == TMQ_OFFSET__LOG && (offset < pOffsetInfo->walVerBegin || offset > pOffsetInfo->walVerEnd)) { -// tscError("consumer:0x%" PRIx64 " invalid seek params, offset:%" PRId64 ", valid range:[%" PRId64 ", %" PRId64 "]", -// tmq->consumerId, offset, pOffsetInfo->walVerBegin, pOffsetInfo->walVerEnd); -// taosWUnLockLatch(&tmq->lock); -// return TSDB_CODE_INVALID_PARA; -// } + if (type != TMQ_OFFSET__LOG && !OFFSET_IS_RESET_OFFSET(type)) { + tscError("consumer:0x%" PRIx64 " offset type:%d not wal version, seek not allowed", tmq->consumerId, type); + taosWUnLockLatch(&tmq->lock); + return TSDB_CODE_INVALID_PARA; + } + + if (type == TMQ_OFFSET__LOG && (offset < pOffsetInfo->walVerBegin || offset > pOffsetInfo->walVerEnd)) { + tscError("consumer:0x%" PRIx64 " invalid seek params, offset:%" PRId64 ", valid range:[%" PRId64 ", %" PRId64 "]", + tmq->consumerId, offset, pOffsetInfo->walVerBegin, pOffsetInfo->walVerEnd); + taosWUnLockLatch(&tmq->lock); + return TSDB_CODE_INVALID_PARA; + } // update the offset, and then commit to vnode // if (pOffsetInfo->currentOffset.type == TMQ_OFFSET__LOG) { -- GitLab