You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2022/07/05 08:02:04 UTC

[GitHub] [pulsar] Technoboy- opened a new pull request, #16395: [branch-2.7][Cherry-pick] Return message ID from compacted ledger while the compaction cursor reach the end of the topic.

Technoboy- opened a new pull request, #16395:
URL: https://github.com/apache/pulsar/pull/16395

   ### Motivation
   
   The problem happens when the compaction cursor reaches the end of the topic but the tail messages
   of the topic have been removed by producer writes null value messages during the topic compaction.
   
   For example:
   
   - 5 messages in the original topic with key: 0,1,2,3,4
   - the corresponding message IDs are: 1:0, 1:1, 1:2, 1:3, 1:4
   - producer send null value messages for key 3 and 4
   - trigger the topic compaction task
   
   After the compaction task complete,
   
   - 5 messages in the original topic: 1:0, 1:1, 1:2, 1:3, 1:4
   - 3 messages in the compacted ledger: 1:0, 1:1, 1:2
   
   At this moment, if the reader tries to get the last message ID of the topic,
   we should return `1:2` not `1:4`, because the reader is not able to read the message
   with keys `3` and `4` from the compacted topic, otherwise, the `reader.readNext()` method
   will be blocked until a new message written to the topic.
   
   ### Modifications
   
   The fix is straightforward, when the broker receives a get last message ID request,
   the broker will check if the compaction cursor reaches the end of the original topic.
   If yes, respond last message ID from the compacted ledger.
   
   ### Verifying this change
   
   New test added `testHasMessageAvailableWithNullValueMessage` which ensure the `hasMessageAvailable()`
   return false no more messages from the compacted topic if the compaction cursor reaches the end of the topic.
   
   ### Does this pull request potentially affect one of the following parts:
   
   *If `yes` was chosen, please highlight the changes*
   
     - Dependencies (does it add or upgrade a dependency): (no)
     - The public API: (no)
     - The schema: (no)
     - The default values of configurations: (no)
     - The wire protocol: (no)
     - The rest endpoints: (no)
     - The admin cli options: (no)
     - Anything that affects deployment: (no)
   
   ### Documentation
   
   Check the box below and label this PR (if you have committer privilege).
   
   Need to update docs? 
   
   - [ ] `doc-required` 
     
     (If you need help on updating docs, create a doc issue)
     
   - [x] `no-need-doc` 
     
     (Please explain why)
     
   - [ ] `doc` 
     
     (If this PR contains doc changes)
   
   
   


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] Technoboy- merged pull request #16395: [Branch-2.7][Cherry-pick] Return message ID from compacted ledger while the compaction cursor reach the end of the topic.

Posted by GitBox <gi...@apache.org>.
Technoboy- merged PR #16395:
URL: https://github.com/apache/pulsar/pull/16395


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org