Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Issue 1233] Fix the issue where the AckIDCumulativ cannot return error. #1235

Merged
merged 1 commit into from
Jul 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pulsar/consumer_partition.go
Original file line number Diff line number Diff line change
Expand Up @@ -730,7 +730,7 @@ func (pc *partitionConsumer) internalAckIDCumulative(msgID MessageID, withRespon

var ackReq *ackRequest
if withResponse {
ackReq := pc.sendCumulativeAck(msgIDToAck)
ackReq = pc.sendCumulativeAck(msgIDToAck)
<-ackReq.doneCh
} else {
pc.ackGroupingTracker.addCumulative(msgIDToAck)
Expand Down
12 changes: 8 additions & 4 deletions pulsar/consumer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1010,11 +1010,13 @@ func TestConsumerBatchCumulativeAck(t *testing.T) {

if i == N-1 {
// cumulative ack the first half of messages
c1.AckCumulative(msg)
err := c1.AckCumulative(msg)
assert.Nil(t, err)
} else if i == N {
// the N+1 msg is in the second batch
// cumulative ack it to test if the first batch can be acked
c2.AckCumulative(msg)
err := c2.AckCumulative(msg)
assert.Nil(t, err)
}
}

Expand Down Expand Up @@ -3950,7 +3952,8 @@ func runBatchIndexAckTest(t *testing.T, ackWithResponse bool, cumulative bool, o
// Acknowledge half of the messages
if cumulative {
msgID := msgIds[BatchingMaxSize/2-1]
consumer.AckIDCumulative(msgID)
err := consumer.AckIDCumulative(msgID)
assert.Nil(t, err)
log.Printf("Acknowledge %v:%d cumulatively\n", msgID, msgID.BatchIdx())
} else {
for i := 0; i < BatchingMaxSize; i++ {
Expand Down Expand Up @@ -3985,7 +3988,8 @@ func runBatchIndexAckTest(t *testing.T, ackWithResponse bool, cumulative bool, o
}
if cumulative {
msgID := msgIds[BatchingMaxSize-1]
consumer.AckIDCumulative(msgID)
err := consumer.AckIDCumulative(msgID)
assert.Nil(t, err)
log.Printf("Acknowledge %v:%d cumulatively\n", msgID, msgID.BatchIdx())
}
consumer.Close()
Expand Down
Loading