fix:semaphore always wait in tmq commit logic

This commit is contained in:
wangmm0220 2023-07-27 10:03:18 +08:00
parent 11e690cb67
commit 68eb1cfc1e
1 changed files with 25 additions and 23 deletions

View File

@ -586,7 +586,10 @@ static int32_t asyncCommitOffset(tmq_t* tmq, char* pTopicName, int32_t vgId, STq
if(code != 0){ if(code != 0){
goto end; goto end;
} }
if (offsetVal->type > 0 && !tOffsetEqual(offsetVal, &pVg->offsetInfo.committedOffset)) { if (offsetVal->type <= 0 || tOffsetEqual(offsetVal, &pVg->offsetInfo.committedOffset)) {
code = TSDB_CODE_TMQ_INVALID_MSG;
goto end;
}
char offsetBuf[TSDB_OFFSET_LEN] = {0}; char offsetBuf[TSDB_OFFSET_LEN] = {0};
tFormatOffset(offsetBuf, tListLen(offsetBuf), offsetVal); tFormatOffset(offsetBuf, tListLen(offsetBuf), offsetVal);
@ -609,7 +612,6 @@ static int32_t asyncCommitOffset(tmq_t* tmq, char* pTopicName, int32_t vgId, STq
tscInfo("consumer:0x%" PRIx64 " topic:%s on vgId:%d send commit msg success, send offset:%s committed:%s", tscInfo("consumer:0x%" PRIx64 " topic:%s on vgId:%d send commit msg success, send offset:%s committed:%s",
tmq->consumerId, pTopicName, pVg->vgId, offsetBuf, commitBuf); tmq->consumerId, pTopicName, pVg->vgId, offsetBuf, commitBuf);
pVg->offsetInfo.committedOffset = *offsetVal; pVg->offsetInfo.committedOffset = *offsetVal;
}
end: end:
taosRUnLockLatch(&tmq->lock); taosRUnLockLatch(&tmq->lock);