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

[feature] Support batch index ACK #938

Merged

Conversation

BewareMyPower
Copy link
Contributor

Fixes #894

Modifications

Add an EnableBatchIndexAcknowledgment to specify whether batch index ACK is enabled. Since this feature requires the conversion between a bit set and its underlying long array, which is similar to Java's BitSet, this commit introduces github.com/bits-and-blooms/bitset dependency to replace the big.Int based implementation of the bit set.

Add a BatchSize() method to MessageId to indicate the size of the ack_set field. When the batch index ACK happens, convert the []uint64 to the []int64 as the ack_set field in CommandAck. When receiving messages, convert the ack_set field in CommandMessage to filter the acknowledged single messages.

Remove the duplicated code in AckID and AckIDWithResponse.

Verifications

TestBatchIndexAck is added to cover the case whether AckWithResponse is enabled and both individual and cumulative ACK.

Fixes apache#894

### Modifications

Add an `EnableBatchIndexAcknowledgment` to specify whether batch index
ACK is enabled. Since this feature requires the conversion between a bit
set and its underlying long array, which is similar to Java's `BitSet`,
this commit introduces github.com/bits-and-blooms/bitset dependency to
replace the `big.Int` based implementation of the bit set.

Add a `BatchSize()` method to `MessageId` to indicate the size of the
`ack_set` field. When the batch index ACK happens, convert the
`[]uint64` to the `[]int64` as the `ack_set` field in `CommandAck`. When
receiving messages, convert the `ack_set` field in `CommandMessage` to
filter the acknowledged single messages.

Remove the duplicated code in `AckID` and `AckIDWithResponse`.

### Verifications

`TestBatchIndexAck` is added to cover the case whether `AckWithResponse`
is enabled and both individual and cumulative ACK.
@BewareMyPower BewareMyPower marked this pull request as ready for review January 3, 2023 13:31
Copy link
Member

@wolfstudy wolfstudy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM +1, just a little comments, please check

pulsar/impl_message.go Show resolved Hide resolved
Copy link
Member

@wolfstudy wolfstudy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM +1

@BewareMyPower BewareMyPower merged commit 3cd02b1 into apache:master Jan 11, 2023
@BewareMyPower BewareMyPower deleted the bewaremypower/batch-index-ack branch January 11, 2023 08:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

support enableBatchIndexAcknowledgment setting
2 participants