pulsar icon indicating copy to clipboard operation
pulsar copied to clipboard

[fix][broker] Fix cursor should use latest ledger config

Open nodece opened this issue 1 year ago • 5 comments

Motivation

When the ledger opens a cursor, the cursor uses a field to hold a managed ledger configuration. Once the managed ledger configuration is renewed(The managed ledger configuration will be renewed when the namespace/topic policies change) in the managed ledger, the cursor cannot use the latest ledger config.

This will break the ledger feature like autoSkipNonRecoverableData.

Modifications

  • Remove the config parameter in the constructor of ManagedCursorImpl and NonDurableCursorImpl
  • Use cursor.getConfig instead of cursor.config, which method always gets the managed ledger config for managed ldeger.

Documentation

  • [ ] doc
  • [ ] doc-required
  • [x] doc-not-needed
  • [ ] doc-complete

nodece avatar May 03 '24 08:05 nodece

a test needs updating:

BrokerBkEnsemblesTests.testSkipCorruptDataLedger:213 » NoSuchField config

lhotari avatar May 03 '24 19:05 lhotari

This lead to too many changes, can we just update Cursor#config when the config changed?

dao-jun avatar May 03 '24 19:05 dao-jun

This lead to too many changes, can we just update Cursor#config when the config changed?

Sounds like a good idea, but we need to add a new method to cursor interface.

nodece avatar May 04 '24 07:05 nodece

This lead to too many changes, can we just update Cursor#config when the config changed?

Sounds like a good idea, but we need to add a new method to cursor interface.

Yes, but I believe it's a better way

dao-jun avatar May 04 '24 07:05 dao-jun

@lhotari Do you have any suggestions?

nodece avatar May 04 '24 10:05 nodece

Codecov Report

Attention: Patch coverage is 87.50000% with 5 lines in your changes are missing coverage. Please review.

Project coverage is 72.68%. Comparing base (bbc6224) to head (ab02f3a). Report is 224 commits behind head on master.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##             master   #22644      +/-   ##
============================================
- Coverage     73.57%   72.68%   -0.89%     
+ Complexity    32624    32324     -300     
============================================
  Files          1877     1887      +10     
  Lines        139502   141018    +1516     
  Branches      15299    15480     +181     
============================================
- Hits         102638   102504     -134     
- Misses        28908    30648    +1740     
+ Partials       7956     7866      -90     
Flag Coverage Δ
inttests 27.32% <52.50%> (+2.74%) :arrow_up:
systests 24.58% <35.00%> (+0.25%) :arrow_up:
unittests 71.46% <87.50%> (-1.39%) :arrow_down:

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

Files Coverage Δ
...okkeeper/mledger/impl/ManagedCursorMXBeanImpl.java 93.93% <100.00%> (+0.18%) :arrow_up:
...che/bookkeeper/mledger/impl/ManagedLedgerImpl.java 80.92% <100.00%> (+0.26%) :arrow_up:
.../bookkeeper/mledger/impl/NonDurableCursorImpl.java 81.25% <100.00%> (ø)
...pache/bookkeeper/mledger/impl/RangeSetWrapper.java 94.33% <100.00%> (ø)
...he/bookkeeper/mledger/impl/ReadOnlyCursorImpl.java 95.00% <100.00%> (ø)
...rg/apache/bookkeeper/mledger/impl/OpReadEntry.java 84.31% <0.00%> (ø)
...keeper/mledger/impl/ReadOnlyManagedLedgerImpl.java 56.16% <0.00%> (+2.54%) :arrow_up:
...che/bookkeeper/mledger/impl/ManagedCursorImpl.java 80.03% <89.65%> (+0.73%) :arrow_up:

... and 342 files with indirect coverage changes

codecov-commenter avatar May 06 '24 03:05 codecov-commenter