GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Fix SST files not being cleaned up in the locations folder by danpi · Pull Request #4555 · apache/bookkeeper

Conversation

@danpi

@danpi danpi commented Feb 20, 2025

Copy link
Copy Markdown
Contributor

Descriptions of the changes in this PR:

Fix #4554

Motivation

Resolve issue with SST files remaining uncleared in the locations folder.

Changes

  1. Reuse the cleanup logic of GarbageCollectorThread to trigger entryLocationCompact() when a major compaction occurs.
  2. Add the entryLocationCompaction configuration option to control the above behavior, disabled by default.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
houbonan
fix entry location compaction
97a38da
@danpi

danpi commented Feb 20, 2025

Copy link
Copy Markdown
Contributor Author

I believe this issue is related to optimization #3653.

When using deleteRange to replace the one-by-one deletion method, only one action is written to RocksDB. If RocksDB is performing tiered compaction, this action is not guaranteed to be picked up, causing SST files to remain undeleted.

To resolve this issue:
Option 1: Revert to the previous logic of iteratively deleting each key.
Option 2: Use compactRange to forcefully clean up levels L0 to L6.
I chose to perform a compactRange synchronously when executing a major compaction.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

hangc0276
hangc0276 reviewed Feb 27, 2025
View reviewed changes
Comment thread bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/GarbageCollectorThread.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

@hangc0276

hangc0276 commented Feb 27, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

I believe this issue is related to optimization #3653.

When using deleteRange to replace the one-by-one deletion method, only one action is written to RocksDB. If RocksDB is performing tiered compaction, this action is not guaranteed to be picked up, causing SST files to remain undeleted.

To resolve this issue: Option 1: Revert to the previous logic of iteratively deleting each key. Option 2: Use compactRange to forcefully clean up levels L0 to L6. I chose to perform a compactRange synchronously when executing a major compaction.

@danpi Great job! I think it should be a bug in RocksDB. We can use option 2. Please check the failed CI, thanks.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

hangc0276
hangc0276 reviewed Feb 27, 2025
View reviewed changes
Comment thread bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/GarbageCollectorThread.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

@hangc0276 hangc0276 assigned danpi Feb 27, 2025
@hangc0276 hangc0276 added type/bug area/bookie release/4.16.7 release/4.17.2 labels Feb 27, 2025
@hangc0276
hangc0276 requested review from eolivelli, lhotari and zymap February 27, 2025 06:55
houbonan
replace entryLocationCompactionEnable with entryLocationCompactionInt…
9e7a640
…erval
@danpi

danpi commented Mar 6, 2025

Copy link
Copy Markdown
Contributor Author

@hangc0276 Addressed the feedback above. PTAL, thanks.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

hangc0276
hangc0276 reviewed Mar 6, 2025
View reviewed changes
Comment thread bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/GarbageCollectorThread.java Outdated
long majorCompactionMaxTimeMillis;
long lastMajorCompactionTime;

boolean enableEntryLocationCompaction = false;

@hangc0276 hangc0276 Mar 6, 2025

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Remove this one and use entryLocationCompactionInterval > 0 instead?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/GarbageCollectorThread.java Outdated
minorCompacting.set(false);
}
}
if (enableEntryLocationCompaction && (curTime - lastEntryLocationCompactionTime

@hangc0276 hangc0276 Mar 6, 2025

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

We'd better introduce a random factor for it. If we roll restart the BookKeeper cluster, and all the bookies start time are the same, which will make all the bookies triggered RocksDB compaction at the same time and impact the read latency.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@hangc0276 hangc0276 Mar 6, 2025

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

The random factor can be any time in [0, entryLocationCompactionInterval]

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@hangc0276

hangc0276 commented Mar 6, 2025

Copy link
Copy Markdown
Contributor

@hangc0276 Addressed the feedback above. PTAL, thanks.

@danpi Thanks for your contribution. I left more comments; please take a look. Thanks.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

houbonan
Add randomCompactionDelay to avoid all the bookies triggering compact…
ea8f55e
…ion simultaneously
@danpi

danpi commented Mar 10, 2025

Copy link
Copy Markdown
Contributor Author

@hangc0276 Addressed the feedback above. PTAL, thanks.

@danpi Thanks for your contribution. I left more comments; please take a look. Thanks.

@hangc0276 Add randomCompactionDelay to avoid all the bookies triggering compaction simultaneously. PTAL, thanks.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

hangc0276
hangc0276 approved these changes Mar 19, 2025
View reviewed changes
@hangc0276

hangc0276 commented Mar 20, 2025

Copy link
Copy Markdown
Contributor

@danpi Would you please fix the check style issue?

Error:  /home/runner/work/bookkeeper/bookkeeper/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/GarbageCollectorThread.java:220:30: '=' is not preceded with whitespace. [WhitespaceAround]
Error:  /home/runner/work/bookkeeper/bookkeeper/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/GarbageCollectorThread.java:301: Line is longer than 120 characters (found 121). [LineLength]
Error:  /home/runner/work/bookkeeper/bookkeeper/bookkeeper-server/src/main/java/org/apache/bookkeeper/conf/ServerConfiguration.java:3243: Line is longer than 120 characters (found 122). [LineLength]
Audit done.
[INFO] There are 3 errors reported by Checkstyle 9.3 with buildtools/src/main/resources/bookkeeper/checkstyle.xml ruleset.
Error:  src/main/java/org/apache/bookkeeper/bookie/GarbageCollectorThread.java:[220,30] (whitespace) WhitespaceAround: '=' is not preceded with whitespace.
Error:  src/main/java/org/apache/bookkeeper/bookie/GarbageCollectorThread.java:[301] (sizes) LineLength: Line is longer than 120 characters (found 121).
Error:  src/main/java/org/apache/bookkeeper/conf/ServerConfiguration.java:[3243] (sizes) LineLength: Line is longer than 120 characters (found 122).
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@hangc0276 hangc0276 mentioned this pull request Mar 20, 2025
fix: fallback to normal delete when deleting a small ranges oxia-db/oxia#644
Merged
zymap added 2 commits March 24, 2025 14:45
@zymap
Fix the style issue
99877f9
@zymap
Fix the style issue
a01c508
@horizonzy

horizonzy commented Mar 26, 2025

Copy link
Copy Markdown
Member

@danpi Could you help to fix the checkstyle.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@zymap
Fix test
b09b633
dlg99
dlg99 approved these changes Mar 31, 2025
View reviewed changes
@zymap
zymap merged commit ede1ba9 into apache:master Apr 1, 2025
@zymap zymap added this to the 4.18.0 milestone Apr 2, 2025
zymap added a commit that referenced this pull request Apr 7, 2025
@danpi houbonan @zymap
Fix SST files not being cleaned up in the locations folder (#4555)
138849a
* fix entry location compaction

* replace entryLocationCompactionEnable with entryLocationCompactionInterval

* Add randomCompactionDelay to avoid all the bookies triggering compaction simultaneously

* Fix the style issue

* Fix the style issue

* Fix test

---------

Co-authored-by: houbonan <[email protected]>
Co-authored-by: zymap <[email protected]>
(cherry picked from commit ede1ba9)
@zymap zymap added the cherry-picked/branch-4.17 label Apr 7, 2025
zymap added a commit that referenced this pull request Apr 7, 2025
@danpi houbonan @zymap
Fix SST files not being cleaned up in the locations folder (#4555)
fbd33b5
* fix entry location compaction

* replace entryLocationCompactionEnable with entryLocationCompactionInterval

* Add randomCompactionDelay to avoid all the bookies triggering compaction simultaneously

* Fix the style issue

* Fix the style issue

* Fix test

---------

Co-authored-by: houbonan <[email protected]>
Co-authored-by: zymap <[email protected]>
(cherry picked from commit ede1ba9)
@lhotari lhotari added the cherry-picked/branch-4.16 label Apr 16, 2025
priyanshu-ctds pushed a commit to datastax-archive/datastax--bookkeeper that referenced this pull request Jul 11, 2025
@danpi houbonan
@zymap @priyanshu-ctds
Fix SST files not being cleaned up in the locations folder (apache#4555)
39da363
* fix entry location compaction

* replace entryLocationCompactionEnable with entryLocationCompactionInterval

* Add randomCompactionDelay to avoid all the bookies triggering compaction simultaneously

* Fix the style issue

* Fix the style issue

* Fix test

---------

Co-authored-by: houbonan <[email protected]>
Co-authored-by: zymap <[email protected]>
(cherry picked from commit ede1ba9)
(cherry picked from commit 138849a)
sandeep-ctds pushed a commit to datastax-archive/datastax--bookkeeper that referenced this pull request Jul 22, 2025
@danpi houbonan
@zymap @sandeep-ctds
Fix SST files not being cleaned up in the locations folder (apache#4555)
9a42316
* fix entry location compaction

* replace entryLocationCompactionEnable with entryLocationCompactionInterval

* Add randomCompactionDelay to avoid all the bookies triggering compaction simultaneously

* Fix the style issue

* Fix the style issue

* Fix test

---------

Co-authored-by: houbonan <[email protected]>
Co-authored-by: zymap <[email protected]>
(cherry picked from commit ede1ba9)
(cherry picked from commit 138849a)
@lhotari lhotari mentioned this pull request Sep 22, 2025
Configure automatic compaction of the Bookie entry location index RocksDB database apache/pulsar-helm-chart#633
Merged
@lhotari lhotari mentioned this pull request Dec 12, 2025
[Bug] The bookie is occupying a large amount of disk space without releasing it. apache/pulsar#25065
Closed
2 of 3 tasks
manas-ctds pushed a commit to datastax-archive/datastax--bookkeeper that referenced this pull request Feb 27, 2026
@danpi houbonan
@zymap @manas-ctds
Fix SST files not being cleaned up in the locations folder (apache#4555)
978d496
* fix entry location compaction

* replace entryLocationCompactionEnable with entryLocationCompactionInterval

* Add randomCompactionDelay to avoid all the bookies triggering compaction simultaneously

* Fix the style issue

* Fix the style issue

* Fix test

---------

Co-authored-by: houbonan <[email protected]>
Co-authored-by: zymap <[email protected]>
(cherry picked from commit ede1ba9)
(cherry picked from commit fbd33b5)
dlg99 pushed a commit to datastax-archive/datastax--bookkeeper that referenced this pull request Feb 27, 2026
@danpi houbonan
@zymap @dlg99
Fix SST files not being cleaned up in the locations folder (apache#4555)
4b9a45e
* fix entry location compaction

* replace entryLocationCompactionEnable with entryLocationCompactionInterval

* Add randomCompactionDelay to avoid all the bookies triggering compaction simultaneously

* Fix the style issue

* Fix the style issue

* Fix test

---------

Co-authored-by: houbonan <[email protected]>
Co-authored-by: zymap <[email protected]>
(cherry picked from commit ede1ba9)
(cherry picked from commit fbd33b5)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@hangc0276 hangc0276 hangc0276 approved these changes
@dlg99 dlg99 dlg99 approved these changes
@lhotari lhotari Awaiting requested review from lhotari
@eolivelli eolivelli Awaiting requested review from eolivelli
@zymap zymap Awaiting requested review from zymap

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@danpi danpi

Labels

area/bookie cherry-picked/branch-4.16 cherry-picked/branch-4.17 release/4.16.7 release/4.17.2 type/bug

Projects

None yet

Milestone

4.18.0

Development

Successfully merging this pull request may close these issues.

[BUG]Large number of SST files in locations not being cleared after upgrade

Uh oh!

There was an error while loading. Please reload this page.

6 participants

@danpi @hangc0276 @horizonzy @dlg99 @lhotari @zymap
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.