This is an automated email from the ASF dual-hosted git repository. zhaocong pushed a commit to branch compaction_null_key in repository https://gitbox.apache.org/repos/asf/pulsar-site.git
commit cfb9ea11f08b2e2f7c15460d2a1b72dc66d4e781 Author: coderzc <[email protected]> AuthorDate: Fri Jan 12 13:22:11 2024 +0800 Explain retain policy messages without keys for compaction --- docs/cookbooks-compaction.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/docs/cookbooks-compaction.md b/docs/cookbooks-compaction.md index 73e464d8b685..8de0929a08ed 100644 --- a/docs/cookbooks-compaction.md +++ b/docs/cookbooks-compaction.md @@ -13,8 +13,14 @@ To use compaction: * Compaction can be configured to run [automatically](#configure-compaction-to-run-automatically), or you can manually [trigger](#trigger-compaction-manually) compaction using the Pulsar administrative API. * Your consumers must be [configured](#configure-consumers) to read from compacted topics (Java consumers, for example, have a `readCompacted` setting that must be set to `true`). If this configuration is not set, consumers will still be able to read from the non-compacted topic. +:::tip + +Compaction only works on messages that have keys (as in the stock ticker example the stock symbol serves as the key for each message). Keys can thus be thought of as the axis along which compaction is applied. Messages that don't have keys are simply ignored by compaction. -> Compaction only works on messages that have keys (as in the stock ticker example the stock symbol serves as the key for each message). Keys can thus be thought of as the axis along which compaction is applied. Messages that don't have keys are simply ignored by compaction. +PIP-318 introduced the `topicCompactionRetainNullKey` configuration on broker side, which allows you to configure whether to retain messages without keys during compaction. And since 3.2.0+ version, the default don't retain null-key message during topic compaction. +For more information, see [PIP-318](https://github.com/apache/pulsar/blob/master/pip/pip-318.md). + +::: ## When should I use compacted topics?
