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][Tiered Storage] Eagerly Delete Offloaded Segments On Topic Deletion #17915

Merged
merged 2 commits into from
Oct 21, 2022

Conversation

dlg99
Copy link
Contributor

@dlg99 dlg99 commented Oct 4, 2022

Fixes #9962

Motivation

Offloaded ledgers can be orphaned on topic deletion.

This is a redo of #15914 which conflicted with concurrently merged #17736 thus resulting in #17889 .

#17736 made a decision to not allow managed ledger trimming for the fenced mledgers because in many case fencing indicates a problems that should stop all operations on mledger. At the same time fencing is used before deletion starts, so trimming added to the deletion process cannot proceed.
After discussion with @eolivelli I introduced new state, FencedForDeletion, which acts as Fenced state except for the trimming/deletion purposes.

Modifications

Topic to be truncated before deletion to delete offloaded ledgers properly and fail if truncation fails.

Verifying this change

local fork tests: dlg99#1

  • Make sure that the change passes the CI checks.

This change added integration tests

Does this pull request potentially affect one of the following parts:

If yes was chosen, please highlight the changes

Nothing changed in the options but admin CLI will implicitly run truncate before topic delete.

  • Dependencies (does it add or upgrade a dependency): (yes / no)
  • The public API: (yes / no)
  • The schema: (yes / no / don't know)
  • The default values of configurations: (yes / no)
  • The wire protocol: (yes / no)
  • The rest endpoints: (yes / no)
  • The admin cli options: (yes / no)
  • Anything that affects deployment: (yes / no / don't know)

Documentation

Check the box below or label this PR directly.

Need to update docs?

  • doc-required
    (Your PR needs to update docs and you will update later)

  • doc-not-needed
    (Please explain why)

  • doc
    (Your PR contains doc changes)

  • doc-complete
    (Docs have been already added)

@github-actions github-actions bot added the doc-not-needed Your PR changes do not impact docs label Oct 4, 2022
Copy link
Contributor

@eolivelli eolivelli left a comment

Choose a reason for hiding this comment

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

LGTM

Awesome work!

@eolivelli
Copy link
Contributor

@Jason918 you already reviewed the first version of the patch at #15914
can you please take a look here as well ?

dlg99 and others added 2 commits October 20, 2022 23:58
…tion (apache#15914)

* Truncate topic before deletion to avoid orphaned offloaded ledgers

* CR feedback

(cherry picked from commit 9026d19)
@codecov-commenter
Copy link

codecov-commenter commented Oct 21, 2022

Codecov Report

Merging #17915 (ba76543) into master (6c65ca0) will increase coverage by 15.07%.
The diff coverage is 33.93%.

Impacted file tree graph

@@              Coverage Diff              @@
##             master   #17915       +/-   ##
=============================================
+ Coverage     34.91%   49.99%   +15.07%     
- Complexity     5707     7031     +1324     
=============================================
  Files           607      393      -214     
  Lines         53396    43489     -9907     
  Branches       5712     4470     -1242     
=============================================
+ Hits          18644    21741     +3097     
+ Misses        32119    19338    -12781     
+ Partials       2633     2410      -223     
Flag Coverage Δ
unittests 49.99% <33.93%> (+15.07%) ⬆️

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

Impacted Files Coverage Δ
.../main/java/org/apache/pulsar/PulsarStandalone.java 0.00% <0.00%> (ø)
.../apache/pulsar/broker/admin/impl/ClustersBase.java 76.66% <0.00%> (+67.62%) ⬆️
...pache/pulsar/broker/admin/impl/NamespacesBase.java 63.25% <ø> (+48.72%) ⬆️
.../pulsar/broker/service/AbstractBaseDispatcher.java 52.14% <0.00%> (+6.28%) ⬆️
...che/pulsar/broker/service/BacklogQuotaManager.java 12.39% <0.00%> (+2.91%) ⬆️
.../pulsar/broker/service/BrokerServiceException.java 42.59% <0.00%> (+17.59%) ⬆️
...ava/org/apache/pulsar/broker/service/Consumer.java 71.45% <0.00%> (+9.44%) ⬆️
...ava/org/apache/pulsar/broker/service/Producer.java 62.72% <0.00%> (+3.08%) ⬆️
...pulsar/broker/service/PulsarCommandSenderImpl.java 74.35% <0.00%> (+7.69%) ⬆️
...va/org/apache/pulsar/broker/service/ServerCnx.java 48.71% <0.00%> (+3.37%) ⬆️
... and 386 more

@eolivelli eolivelli merged commit 0854032 into apache:master Oct 21, 2022
dlg99 added a commit to dlg99/pulsar that referenced this pull request Oct 25, 2022
dlg99 added a commit to datastax/pulsar that referenced this pull request Oct 31, 2022
…tion (apache#17915) (#152)

(cherry picked from commit 0854032)

Fixes apache#9962 

### Motivation

Offloaded ledgers can be orphaned on topic deletion. 

This is a redo of apache#15914 which conflicted with concurrently merged apache#17736 thus resulting in apache#17889 .

apache#17736 made a decision to not allow managed ledger trimming for the fenced mledgers because in many case fencing indicates a problems that should stop all operations on mledger. At the same time fencing is used before deletion starts, so trimming added to the deletion process cannot proceed.
After discussion with @eolivelli I introduced new state, FencedForDeletion, which acts as Fenced state except for the trimming/deletion purposes.

### Modifications

Topic to be truncated before deletion to delete offloaded ledgers properly and fail if truncation fails.

### Verifying this change

local fork tests: dlg99#1

- [ ] Make sure that the change passes the CI checks.

This change added integration tests

### Does this pull request potentially affect one of the following parts:

*If `yes` was chosen, please highlight the changes*

Nothing changed in the options but admin CLI will implicitly run truncate before topic delete. 

  - Dependencies (does it add or upgrade a dependency): (yes / no)
  - The public API: (yes / no)
  - The schema: (yes / no / don't know)
  - The default values of configurations: (yes / no)
  - The wire protocol: (yes / no)
  - The rest endpoints: (yes / no)
  - The admin cli options: (yes / no)
  - Anything that affects deployment: (yes / no / don't know)

### Documentation

Check the box below or label this PR directly.

Need to update docs? 

- [ ] `doc-required` 
(Your PR needs to update docs and you will update later)
  
- [x] `doc-not-needed` 
(Please explain why)
  
- [ ] `doc` 
(Your PR contains doc changes)

- [ ] `doc-complete`
(Docs have been already added)
@dlg99 dlg99 deleted the topic-deletion-take2 branch November 28, 2022 05:21
@coderzc
Copy link
Member

coderzc commented Feb 28, 2023

@dlg99 @eolivelli This PR can cherry-pick into 2.9? Whether to introduce break change?

@eolivelli
Copy link
Contributor

We cannot cherry pick this anywhere.
This is a change in the behaviour, even if it is a new good behaviour

zymap added a commit to zymap/pulsar that referenced this pull request Dec 7, 2023
…xception

---

### Motivation

apache#17915 changes the fix apache#17512 which lead the offload data
is deleted when metadata store exception happened. Then the
ledger can not be read.

The logs shows
```
Failed to update offloaded metadata for the ledgerId 6197907, the offloaded data will not be cleaned up
```
But the ledger deleted. Then managed ledger failed to open it
```
Error opening ledger for reading at position 6197907:0
```
zymap added a commit to zymap/pulsar that referenced this pull request Dec 7, 2023
…xception

---

### Motivation

apache#17915 changes the fix apache#17512 which lead the offload data
is deleted when metadata store exception happened. Then the
ledger can not be read.

The logs shows
```
Failed to update offloaded metadata for the ledgerId 6197907, the offloaded data will not be cleaned up
```
But the ledger deleted. Then managed ledger failed to open it
```
Error opening ledger for reading at position 6197907:0
```
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.

[Tiered Storage] Eagerly Delete Offloaded Segments On Topic Deletion
4 participants