You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by "poorbarcode (via GitHub)" <gi...@apache.org> on 2025/06/24 09:20:40 UTC
[PR] [fix][broker] replication does not work due to the mixed and repetitive sending of user messages and replication markers [pulsar]
poorbarcode opened a new pull request, #24453:
URL: https://github.com/apache/pulsar/pull/24453
### Motivation
**Background of deduplication**: Always regard `markers` as non-repetitive
**Background of replicated subscription**: The internal producer of the replicator will send markers to replicate the subscription ack state to the remote side.
**Reproduce steps of the issue**
0. Replicator replicate a user message(`user-msg-1`) to the remote cluster
0. Replicator sends a replication marker(`marker-1`) to the remote cluster
0. Replicator replicate a user message(`user-msg-2`) to the remote cluster
0. The messages `[marker, user-msg-2]` have not received the send receipt yet.
0. A disconnection of the internal producer occurs.
0. Resend the `2` messages: `[user-msg-1, marker, user-msg-1]`.
0. The remote broker is handling the write of `marker-1`, because it regards all markers as non-repetitive.
a. Has not replied to the response to the source cluster yet.
0. Received the send receipt of `user-msg-1`, the producer gets a message ID whose value is `-1:-1` because it is repeated. It is faster than the message `marker-1` because it does not write BK.
a. Attempts to remove the first pending send. But fails because the first pending send has not received a send receipt yet.
b. Reconnects.
c. Loop to `Step-4`
The send receipt of `marker-2` will never be received due to infinite reconnection.
### Scenarios affected
**Background**: There are 2` types of Maker: TXN and Replicated Subscription
- TXN internal component only sends markers, never sends user messages
- Replicator sends both markers and user messages, which may encounter the issue.
### Solutions
1. Let all receipts of sent in order:
a. It can hardly be implemented, because the broker should maintain all pending sends for all producers
b. It will break the behavior defined in the previous version.
c. It only works for a few scenarios that are used by Replication.
2. Let the replicator handle the receipts who have out of order(what the current PR does)
### Modifications
Fix the issue with solution 2
### Documentation
<!-- DO NOT REMOVE THIS SECTION. CHECK THE PROPER BOX ONLY. -->
- [ ] `doc` <!-- Your PR contains doc changes. -->
- [ ] `doc-required` <!-- Your PR changes impact docs and you will update later -->
- [x] `doc-not-needed` <!-- Your PR changes do not impact docs -->
- [ ] `doc-complete` <!-- Docs have been already added -->
### Matching PR in forked repository
PR in forked repository: x
--
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
Re: [PR] [fix][broker] replication does not work due to the mixed and repetitive sending of user messages and replication markers [pulsar]
Posted by "gaoran10 (via GitHub)" <gi...@apache.org>.
gaoran10 commented on code in PR #24453:
URL: https://github.com/apache/pulsar/pull/24453#discussion_r2188905151
##########
pulsar-client/src/main/java/org/apache/pulsar/client/impl/GeoReplicationProducerImpl.java:
##########
@@ -159,9 +160,27 @@ private void ackReceivedReplicatedMsg(ClientCnx cnx, OpSendMsg op, long sourceLI
return;
}
- // Case-4: Unexpected
- // 4-1: got null source cluster's entry position, which is unexpected.
- // 4-2: unknown error, which is unexpected.
+ // Case-4: Received an out-of-order msg send receipt, and the first item in pending queue is a marker.
+ if (op.msg.getMessageBuilder().hasMarkerType()
+ && Markers.isReplicationMarker(op.msg.getMessageBuilder().getMarkerType())) {
+ log.warn("[{}] [{}] Received an out-of-order msg send receipt because enabled replicated subscription,"
Review Comment:
Could we add a description and shorten the log?
--
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
Re: [PR] [fix][broker] replication does not work due to the mixed and repetitive sending of user messages and replication markers [pulsar]
Posted by "poorbarcode (via GitHub)" <gi...@apache.org>.
poorbarcode commented on code in PR #24453:
URL: https://github.com/apache/pulsar/pull/24453#discussion_r2188925433
##########
pulsar-client/src/main/java/org/apache/pulsar/client/impl/GeoReplicationProducerImpl.java:
##########
@@ -159,9 +160,27 @@ private void ackReceivedReplicatedMsg(ClientCnx cnx, OpSendMsg op, long sourceLI
return;
}
- // Case-4: Unexpected
- // 4-1: got null source cluster's entry position, which is unexpected.
- // 4-2: unknown error, which is unexpected.
+ // Case-4: Received an out-of-order msg send receipt, and the first item in pending queue is a marker.
+ if (op.msg.getMessageBuilder().hasMarkerType()
+ && Markers.isReplicationMarker(op.msg.getMessageBuilder().getMarkerType())) {
+ log.warn("[{}] [{}] Received an out-of-order msg send receipt because enabled replicated subscription,"
Review Comment:
> BTW, is the warning log used for future investigation?
Yes, since the issue related to Geo Replication is hard to investigate, a long log is better.
--
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
Re: [PR] [fix][broker] replication does not work due to the mixed and repetitive sending of user messages and replication markers [pulsar]
Posted by "gaoran10 (via GitHub)" <gi...@apache.org>.
gaoran10 commented on code in PR #24453:
URL: https://github.com/apache/pulsar/pull/24453#discussion_r2188905151
##########
pulsar-client/src/main/java/org/apache/pulsar/client/impl/GeoReplicationProducerImpl.java:
##########
@@ -159,9 +160,27 @@ private void ackReceivedReplicatedMsg(ClientCnx cnx, OpSendMsg op, long sourceLI
return;
}
- // Case-4: Unexpected
- // 4-1: got null source cluster's entry position, which is unexpected.
- // 4-2: unknown error, which is unexpected.
+ // Case-4: Received an out-of-order msg send receipt, and the first item in pending queue is a marker.
+ if (op.msg.getMessageBuilder().hasMarkerType()
+ && Markers.isReplicationMarker(op.msg.getMessageBuilder().getMarkerType())) {
+ log.warn("[{}] [{}] Received an out-of-order msg send receipt because enabled replicated subscription,"
Review Comment:
Could we add a description and shorten the log? BTW, is the warning log used for future investigation?
--
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
Re: [PR] [fix][broker] replication does not work due to the mixed and repetitive sending of user messages and replication markers [pulsar]
Posted by "poorbarcode (via GitHub)" <gi...@apache.org>.
poorbarcode merged PR #24453:
URL: https://github.com/apache/pulsar/pull/24453
--
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
Re: [PR] [fix][broker] replication does not work due to the mixed and repetitive sending of user messages and replication markers [pulsar]
Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #24453:
URL: https://github.com/apache/pulsar/pull/24453#issuecomment-3001083234
## [Codecov](https://app.codecov.io/gh/apache/pulsar/pull/24453?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
Attention: Patch coverage is `77.77778%` with `2 lines` in your changes missing coverage. Please review.
> Project coverage is 74.27%. Comparing base [(`bbc6224`)](https://app.codecov.io/gh/apache/pulsar/commit/bbc62245c5ddba1de4b1e7cee4ab49334bc36277?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) to head [(`874caba`)](https://app.codecov.io/gh/apache/pulsar/commit/874cabaaa44bdf59f9ad0776ec86ea773974caa9?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
> Report is 1163 commits behind head on master.
| [Files with missing lines](https://app.codecov.io/gh/apache/pulsar/pull/24453?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Patch % | Lines |
|---|---|---|
| [...pulsar/client/impl/GeoReplicationProducerImpl.java](https://app.codecov.io/gh/apache/pulsar/pull/24453?src=pr&el=tree&filepath=pulsar-client%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fpulsar%2Fclient%2Fimpl%2FGeoReplicationProducerImpl.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-cHVsc2FyLWNsaWVudC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcHVsc2FyL2NsaWVudC9pbXBsL0dlb1JlcGxpY2F0aW9uUHJvZHVjZXJJbXBsLmphdmE=) | 77.77% | [0 Missing and 2 partials :warning: ](https://app.codecov.io/gh/apache/pulsar/pull/24453?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
<details><summary>Additional details and impacted files</summary>
[](https://app.codecov.io/gh/apache/pulsar/pull/24453?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
```diff
@@ Coverage Diff @@
## master #24453 +/- ##
============================================
+ Coverage 73.57% 74.27% +0.70%
+ Complexity 32624 2342 -30282
============================================
Files 1877 1868 -9
Lines 139502 145511 +6009
Branches 15299 16645 +1346
============================================
+ Hits 102638 108085 +5447
+ Misses 28908 28879 -29
- Partials 7956 8547 +591
```
| [Flag](https://app.codecov.io/gh/apache/pulsar/pull/24453/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
|---|---|---|
| [inttests](https://app.codecov.io/gh/apache/pulsar/pull/24453/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `26.66% <0.00%> (+2.08%)` | :arrow_up: |
| [systests](https://app.codecov.io/gh/apache/pulsar/pull/24453/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `23.34% <0.00%> (-0.98%)` | :arrow_down: |
| [unittests](https://app.codecov.io/gh/apache/pulsar/pull/24453/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `73.77% <77.77%> (+0.92%)` | :arrow_up: |
Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.
| [Files with missing lines](https://app.codecov.io/gh/apache/pulsar/pull/24453?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
|---|---|---|
| [...pulsar/client/impl/GeoReplicationProducerImpl.java](https://app.codecov.io/gh/apache/pulsar/pull/24453?src=pr&el=tree&filepath=pulsar-client%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fpulsar%2Fclient%2Fimpl%2FGeoReplicationProducerImpl.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-cHVsc2FyLWNsaWVudC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcHVsc2FyL2NsaWVudC9pbXBsL0dlb1JlcGxpY2F0aW9uUHJvZHVjZXJJbXBsLmphdmE=) | `51.63% <77.77%> (ø)` | |
... and [1088 files with indirect coverage changes](https://app.codecov.io/gh/apache/pulsar/pull/24453/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
</details>
<details><summary> :rocket: New features to boost your workflow: </summary>
- :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
- :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
</details>
--
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