[fix][broker] Avoid compaction task stuck when the last message to compact is a marker#21718
Conversation
|
We need to cherry to 2.9 ~ 3.1 right ? |
Yes. |
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #21718 +/- ##
============================================
- Coverage 73.50% 73.33% -0.17%
+ Complexity 32818 32754 -64
============================================
Files 1893 1893
Lines 140721 140768 +47
Branches 15502 15512 +10
============================================
- Hits 103432 103228 -204
- Misses 29200 29427 +227
- Partials 8089 8113 +24
Flags with carried forward coverage won't be shown. Click here to find out more.
|
| } | ||
|
|
||
| if (msgMetadata == null || Markers.isServerOnlyMarker(msgMetadata)) { | ||
| if (msgMetadata == null || (Markers.isServerOnlyMarker(msgMetadata) && !Markers.isTxnMarker(msgMetadata))) { |
There was a problem hiding this comment.
I think we should pass all the markers and filter them at the client side when doing compaction.
| mxBean.addCompactionReadOp(reader.getTopic(), m.getHeadersAndPayload().readableBytes()); | ||
| if (RawBatchConverter.isReadableBatch(m)) { | ||
| MessageMetadata metadata = Commands.parseMessageMetadata(m.getHeadersAndPayload()); | ||
| if (Markers.isTxnMarker(metadata)) { |
There was a problem hiding this comment.
Why only check the txn marker here? Should we use Markers.isServerOnlyMarker(metadata)?
|
|
||
|
|
||
| @Test | ||
| public void testReadCommittedWithCompaction() throws Exception{ |
There was a problem hiding this comment.
Should we add a test to send a replicated subscription snapshot marker and test the compaction works?
There was a problem hiding this comment.
I add test testReplicatedSubscriptionWithCompaction, PLAT~
56ba96a to
55d929c
Compare
c4965c0 to
3ce2f31
Compare
…mpact is a marker (#21718)
…mpact is a marker (apache#21718) (cherry picked from commit 1f99568) Conflicts: pulsar-broker/src/test/java/org/apache/pulsar/broker/transaction/TransactionTest.java Fixed duplicate namespace created in transactionTest
…mpact is a marker (apache#21718) (cherry picked from commit 1f99568) Conflicts: pulsar-broker/src/test/java/org/apache/pulsar/broker/transaction/TransactionTest.java Fixed duplicate namespace created in transactionTest
…mpact is a marker (#21718)
Motivation
If the last message to compact is a marker, then the compaction task will stuck until timeout fails. The root cause is that the marker has been filtered out by the dispatcher, and the compaction reader will not read the last message.
Modifications
For
__compactioninternal cursor, we don't need to filter out marker messages and delete marker messages during compaction.Verifying this change
(Please pick either of the following options)
This change is a trivial rework / code cleanup without any test coverage.
(or)
This change is already covered by existing tests, such as (please describe tests).
(or)
This change added tests and can be verified as follows:
(example:)
Does this pull request potentially affect one of the following parts:
If the box was checked, please highlight the changes
Documentation
docdoc-requireddoc-not-neededdoc-completeMatching PR in forked repository
PR in forked repository: