Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix] [broker] Expire messages according to ledger close time to avoid client clock skew #21940

Merged
merged 15 commits into from
Feb 22, 2024

Conversation

315157973
Copy link
Contributor

@315157973 315157973 commented Jan 22, 2024

Main Issue: #21347

Motivation

When the client machine's clock is incorrect (eg: set to 1 year later) and the Broker does not set the AppendBrokerTimestampMetadataInterceptor, the Ledger will not be cleaned up.
Because if the Broker's timestamp is not set, the expiration check will be based on the client's publish time.

As we discuss in https://lists.apache.org/thread/0vtjt436xvlg0fr4ogchkjdvjcp56mvz

Modifications

TTL not base the on wrong client publish time

Verifying this change

  • Make sure that the change passes the CI checks.

Documentation

  • doc-not-needed

Matching PR in forked repository

PR in forked repository: 315157973#14

@315157973 315157973 self-assigned this Jan 22, 2024
@github-actions github-actions bot added the doc-not-needed Your PR changes do not impact docs label Jan 22, 2024
@codelipenghui
Copy link
Contributor

Regarding the PR title, I think we can change it to

[fix] [broker] Expire messages according to ledger close time to avoid client clock skew

@315157973 315157973 changed the title [fix] [broker] Fix TTL base on client's publish time [fix] [broker] Expire messages according to ledger close time to avoid client clock skew Jan 24, 2024
@codelipenghui
Copy link
Contributor

It looks like related to this change?

Error:    Run 2: MessageTTLTest.testMessageExpiryAfterTopicUnload:106 » ConditionTimeout Assertion condition defined as a org.apache.pulsar.broker.service.MessageTTLTest expected [5:49] but found [5:-1] within 30 seconds.

I have re-triggered the test.

@codecov-commenter
Copy link

codecov-commenter commented Jan 30, 2024

Codecov Report

Attention: 6 lines in your changes are missing coverage. Please review.

Comparison is base (17bb322) 73.59% compared to head (2a89499) 73.63%.
Report is 30 commits behind head on master.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##             master   #21940      +/-   ##
============================================
+ Coverage     73.59%   73.63%   +0.03%     
- Complexity    32417    32486      +69     
============================================
  Files          1861     1863       +2     
  Lines        138678   138839     +161     
  Branches      15188    15222      +34     
============================================
+ Hits         102060   102228     +168     
+ Misses        28715    28710       -5     
+ Partials       7903     7901       -2     
Flag Coverage Δ
inttests 24.10% <9.67%> (-0.03%) ⬇️
systests 23.93% <9.67%> (+0.25%) ⬆️
unittests 72.90% <80.64%> (+0.04%) ⬆️

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

Files Coverage Δ
...n/java/org/apache/pulsar/broker/PulsarService.java 83.27% <100.00%> (+0.96%) ⬆️
...ache/pulsar/client/admin/internal/BrokersImpl.java 87.50% <100.00%> (ø)
...g/apache/pulsar/broker/admin/impl/BrokersBase.java 72.45% <75.00%> (+1.58%) ⬆️
...ice/persistent/PersistentMessageExpiryMonitor.java 64.46% <78.26%> (-5.95%) ⬇️

... and 110 files with indirect coverage changes

@315157973
Copy link
Contributor Author

@codelipenghui @coderzc PTAL

@dao-jun
Copy link
Member

dao-jun commented Feb 20, 2024

seems there is a test keeps failing, please check

@dao-jun dao-jun merged commit 861618a into apache:master Feb 22, 2024
50 checks passed
Technoboy- pushed a commit that referenced this pull request Feb 26, 2024
@heesung-sn
Copy link
Contributor

@315157973 could you help to cherry-pick this PR to branch-3.0? I see conflicts.

gaoran10 pushed a commit to gaoran10/pulsar that referenced this pull request Mar 4, 2024
gaoran10 pushed a commit that referenced this pull request Mar 4, 2024
mukesh-ctds pushed a commit to datastax/pulsar that referenced this pull request Mar 4, 2024
…d client clock skew (apache#21940)

(cherry picked from commit 861618a)
(cherry picked from commit fee3a33)
mukesh-ctds pushed a commit to datastax/pulsar that referenced this pull request Mar 6, 2024
…d client clock skew (apache#21940)

(cherry picked from commit 861618a)
(cherry picked from commit fee3a33)
heesung-sn pushed a commit to heesung-sn/pulsar that referenced this pull request Mar 6, 2024
heesung-sn pushed a commit to heesung-sn/pulsar that referenced this pull request Mar 6, 2024
heesung-sn added a commit that referenced this pull request Mar 7, 2024
…time to avoid client clock skew (#21940) (#22211)

Co-authored-by: feynmanlin <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants