zhaizhibo opened a new issue, #24791: URL: https://github.com/apache/pulsar/issues/24791
### Search before reporting - [x] I searched in the [issues](https://github.com/apache/pulsar/issues) and found nothing similar. ### Read release policy - [x] I understand that [unsupported versions](https://pulsar.apache.org/contribute/release-policy/#supported-versions) don't get bug fixes. I will attempt to reproduce the issue on a supported version of Pulsar client and Pulsar broker. ### User environment java pulsar 3.3.6 ### Issue Description The current topic compaction mechanism does not respect topic-level data expiration policies (Message TTL and Retention). Once a key is written to the compacted ledger, it persists forever, even if its latest message should have been expired and deleted by the configured TTL/retention rules. 1. During compaction, the latest value for each key is copied into a new, persistent `compactedLedger`. 2. This `compactedLedger` is treated as a separate entity and is not cleaned up by the standard expiration processes that act on regular ledgers. 3. As a result, a key's latest value remains in storage indefinitely after compaction, regardless of TTL or retention settings. ### Error messages ```text ``` ### Reproducing the issue 1. send k,v message to a topic(retention 5min, ttl 5min) 2. trigger compact 3. we can read the key after 5min. ### Additional information _No response_ ### Are you willing to submit a PR? - [x] I'm willing to submit a PR! -- 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]
