void-ptr974 opened a new pull request, #26030:
URL: https://github.com/apache/pulsar/pull/26030
### Motivation
Part of #26027.
`PendingAcksMap` stores per-entry pending ack metadata as an `IntIntPair`
containing the remaining unacked count and sticky key hash. That keeps one
value object per pending ack entry. The main consumer ack paths only need the
remaining unacked count after lookup or removal, so returning an `IntIntPair`
there also creates short-lived objects that are not needed by the caller.
### Modifications
- Store the pending ack value as a packed `long` inside the existing
`TreeMap<Long, TreeMap<Long, ...>>` structure.
- high 32 bits: remaining unacked count
- low 32 bits: sticky key hash
- Keep the existing ledger and entry ordering unchanged. This patch does not
replace the inner map implementation.
- Add primitive accessors for the consumer hot paths:
- `getRemainingUnacked`
- `removeAndGetRemainingUnacked`
- Update `Consumer` to use the primitive accessors for ack owner lookup,
full ack completion, and redelivery removal.
- Keep the existing `get` and `removeAndGet` methods that return
`IntIntPair` for compatibility with existing callers.
- Add coverage for zero remaining count, signed sticky key hashes, integer
boundaries, value-based removal, `updateRemainingUnacked`, and `removeAllUpTo`
callbacks.
### Verifying this change
- `./gradlew :pulsar-broker:test --tests
org.apache.pulsar.broker.service.PendingAcksMapTest --max-workers=1
-PtestRetryCount=0`
- `./gradlew :pulsar-broker:checkstyleMain :pulsar-broker:checkstyleTest
--max-workers=1`
--
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]