fuyou001 commented on PR #10659:
URL: https://github.com/apache/rocketmq/pull/10659#issuecomment-5111511886
**[P1] Preserve the suspend flag in the backoff record**
When a synchronous or asynchronous revive failure is converted to `false`,
the backoff record is created with the eight-argument `PopConsumerRecord`
constructor, which defaults `suspend` to `false`.
This changes the semantics of records created by
`changeInvisibilityDuration(..., suspend=true)`. After the original record is
replaced by this backoff record, a later successful `reviveRetry` sees
`suspend=false` and increments `reconsumeTimes` unexpectedly. For example, a
suspended message with `reconsumeTimes=2` can become `3` merely because its
first revive attempt encountered a transient read or write failure.
Please preserve the original value when constructing the retry record:
```java
PopConsumerRecord retryRecord = new PopConsumerRecord(
System.currentTimeMillis(),
record.getGroupId(),
record.getTopicId(),
record.getQueueId(),
record.getRetryFlag(),
nextInvisibleTime,
record.getOffset(),
record.getAttemptId(),
record.isSuspend());
```
Please cover both synchronous and asynchronous failure paths with
`suspend=true`. Reload the generated retry record from the store and assert
that `suspend` remains true, `attemptTimes` is incremented exactly once, the
original record is deleted only after the retry record is persisted, and a
later successful `reviveRetry` does not increment `reconsumeTimes`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]