AFAIK topic compaction and tiered storage are not mutually exclusive, and a topic can be configured to have both. When topic compaction is triggered, Pulsar will iterate over the entire topic from beginning to end including ledgers that have been offloaded to tiered-storage, leaving only the most recent message associated with that key.