Skip to content

[fix][client] Copy orderingKey to retry letter topic and DLQ messages and fix bug in copying - #23182

Merged
liangyepianzhou merged 3 commits into
apache:masterfrom
lhotari:lh-copy-ordering-key
Aug 16, 2024
Merged

liangyepianzhou merged 3 commits into
apache:masterfrom
lhotari:lh-copy-ordering-key

Conversation

@lhotari

@lhotari lhotari commented Aug 15, 2024

Copy link
Copy Markdown
Member

Fixes #23173
Fixes #23181

Motivation

See #23173 and #23181

Modifications

  • copy ordering key to messages sent to retry letter topic and DLQ topic

Documentation

  • doc
  • doc-required
  • doc-not-needed
  • doc-complete

@dao-jun dao-jun left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@liangyepianzhou

Copy link
Copy Markdown
Contributor

/pulsarbot rerun-failure-checks

@codecov-commenter

codecov-commenter commented Aug 16, 2024 •

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 74.58%. Comparing base (bbc6224) to head (aede451).
Report is 532 commits behind head on master.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##             master   #23182      +/-   ##
============================================
+ Coverage     73.57%   74.58%   +1.01%     
- Complexity    32624    33670    +1046     
============================================
  Files          1877     1921      +44     
  Lines        139502   144486    +4984     
  Branches      15299    15809     +510     
============================================
+ Hits         102638   107766    +5128     
+ Misses        28908    28473     -435     
- Partials       7956     8247     +291     
Flag Coverage Δ
inttests 27.58% <40.00%> (+2.99%) ⬆️
systests 24.70% <0.00%> (+0.37%) ⬆️
unittests 73.94% <100.00%> (+1.10%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
...va/org/apache/pulsar/client/impl/ConsumerImpl.java 79.25% <100.00%> (+1.67%) ⬆️

... and 500 files with indirect coverage changes

@liangyepianzhou
liangyepianzhou merged commit 67fc5b9 into apache:master Aug 16, 2024
lhotari added a commit that referenced this pull request Aug 16, 2024
… and fix bug in copying (#23182)

Fixes #23173
Fixes #23181

See #23173 and #23181

- copy ordering key to messages sent to retry letter topic and DLQ topic

(cherry picked from commit 67fc5b9)
lhotari added a commit that referenced this pull request Aug 16, 2024
… and fix bug in copying (#23182)

Fixes #23173
Fixes #23181

### Motivation

See #23173 and #23181

### Modifications

- copy ordering key to messages sent to retry letter topic and DLQ topic

(cherry picked from commit 67fc5b9)
lhotari added a commit that referenced this pull request Aug 16, 2024
… and fix bug in copying (#23182)

Fixes #23173
Fixes #23181

See #23173 and #23181

- copy ordering key to messages sent to retry letter topic and DLQ topic

(cherry picked from commit 67fc5b9)
lhotari added a commit that referenced this pull request Aug 16, 2024
… and fix bug in copying (#23182)

Fixes #23173
Fixes #23181

### Motivation

See #23173 and #23181

### Modifications

- copy ordering key to messages sent to retry letter topic and DLQ topic

(cherry picked from commit 67fc5b9)
nikhil-ctds pushed a commit to datastax/pulsar that referenced this pull request Aug 16, 2024
… and fix bug in copying (apache#23182)

Fixes apache#23173
Fixes apache#23181

See apache#23173 and apache#23181

- copy ordering key to messages sent to retry letter topic and DLQ topic

(cherry picked from commit 67fc5b9)
(cherry picked from commit c83428f)
nikhil-ctds pushed a commit to datastax/pulsar that referenced this pull request Aug 16, 2024
… and fix bug in copying (apache#23182)

Fixes apache#23173
Fixes apache#23181

See apache#23173 and apache#23181

- copy ordering key to messages sent to retry letter topic and DLQ topic

(cherry picked from commit 67fc5b9)
(cherry picked from commit c83428f)
srinath-ctds pushed a commit to datastax/pulsar that referenced this pull request Aug 20, 2024
… and fix bug in copying (apache#23182)

Fixes apache#23173
Fixes apache#23181

See apache#23173 and apache#23181

- copy ordering key to messages sent to retry letter topic and DLQ topic

(cherry picked from commit 67fc5b9)
(cherry picked from commit c83428f)
grssam pushed a commit to grssam/pulsar that referenced this pull request Sep 4, 2024
… and fix bug in copying (apache#23182)

Fixes apache#23173
Fixes apache#23181


### Motivation

See apache#23173 and apache#23181

### Modifications

- copy ordering key to messages sent to retry letter topic and DLQ topic
hanmz pushed a commit to hanmz/pulsar that referenced this pull request Feb 12, 2025
… and fix bug in copying (apache#23182)

Fixes apache#23173
Fixes apache#23181


### Motivation

See apache#23173 and apache#23181

### Modifications

- copy ordering key to messages sent to retry letter topic and DLQ topic
RobertIndie pushed a commit to apache/pulsar-client-go that referenced this pull request Aug 7, 2025
…meLater() (#1392)

Fixes #1388
Master Issue: #907, apache/pulsar#23182

### Motivation
Since pulsar sdk does not support `AckTimeout()` method, we can only use `Nack()` or `ReconsumeLater()` to trigger dlq policy and send messages to dlq. We can find system properties(e.g. `REAL_TOPIC` and `ORIGIN_MESSAGE_ID`) in these dlq messages.

Refer to issue #1388, before pr #907 `dlq_router#run()` will directly copy properties to create a new dlq message when receiving a message from `dlq.Chan()`. But we only define message properties in ReconsumeLater's `ReconsumeLaterWithCustomProperties()` and not in Nack's `dispatcher()` before send to this `dlq.Chan()`, which lead to only dlq messages created by `ReconsumeLater()` can have these properties.

The above pr replaced this behavior with just adding system properties as soon as creating dlq messages in `dlq_router#run()`, which use `message.topic` as `REAL_TOPIC` property value. But messages sent from `ReconsumeLater() ReconsumeLaterWithCustomProperties()` do not contain related `message.topic` fields, in case it will override defined `REAL_TOPIC` to empty string.

### Modifications
- Add `REAL_TOPIC`, `ORIGIN_MESSAGE_IDY_TIME`, `ORIGIN_MESSAGE_ID` system properties both in ReconsumeLater's `ReconsumeLaterWithCustomProperties()` and Nack's `dispatcher()` functions.
- Add `Key`, `OrderingKey`, `EventTime` message fields both in `ReconsumeLater() ReconsumeLaterWithCustomProperties()` and `dlq_router run()` functions to keep consistent with [Java realization](apache/pulsar#23182), so that dlq messages can preserve source message info.
- Remove adding system properties strategy in `dlq_router#run()`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

4 participants