Skip to content

Conversation

@peterxcli
Copy link
Member

What changes were proposed in this pull request?

#8141 (comment)

In #8141 RDBStore#compactTable was introduced.

We should set options.setMaxCompactionBytes() when we open the snapshot rocksdb this could be useful so that we ensure one sub compaction doesn't take up a lot of memory. Also look into making ManagedCompactRangeOptions.setMaxSubCompactions() configurable so that we don't use a lot of CPU for this operation. It is ok if the compactions take time.

This can be achieved by adding ManagedRangeCompactionOption into AbstractRDBStore, RDBStore, RDBStoreBuilder. Also the corresponding rocksdb config keys.

What is the link to the Apache JIRA

https://issues.apache.org/jira/browse/HDDS-13114

How was this patch tested?

CI:
https://github.com/peterxcli/ozone/actions/runs/15484301525

@peterxcli peterxcli requested a review from swamirishi June 6, 2025 09:22
@peterxcli peterxcli self-assigned this Jun 6, 2025
@peterxcli peterxcli changed the title HDDS-13114 MaxCompactionBytes and MaxSubCompactions should be configureable in RDBStore#compactTable HDDS-13114. MaxCompactionBytes and MaxSubCompactions should be configureable in RDBStore#compactTable Jun 6, 2025
Copy link
Contributor

@swamirishi swamirishi left a comment

Choose a reason for hiding this comment

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

@peterxcli Thanks for working on the patch. I have left some comments inline.

}

return new RDBStore(dbFile, rocksDBOption, statistics, writeOptions, tableConfigs,
ManagedCompactRangeOptions rangeCompactionOptions = new ManagedCompactRangeOptions();
Copy link
Contributor

Choose a reason for hiding this comment

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

This shouldn't be done on the automatic background compactions. We need these compaction options only for the manual compactions done by the BackgroundCompactionService & SnapshotCache. These default options on the rocksdb options should be coming from an ini file we don't want individual ozone configuration corresponding to each and every rocksdb configuration this might get very tough to handle later.
https://issues.apache.org/jira/browse/HDDS-12484
cc: @Galsza

Copy link
Contributor

Choose a reason for hiding this comment

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

try (ManagedCompactRangeOptions options = new ManagedCompactRangeOptions()) {

try (ManagedCompactRangeOptions options = new ManagedCompactRangeOptions()) {

@peterxcli peterxcli marked this pull request as draft June 13, 2025 06:11
@peterxcli peterxcli force-pushed the codex/make-maxcompactionbytes-and-maxsubcompactions-configurable branch from 91bc8b3 to 6385e7e Compare June 13, 2025 06:26
@peterxcli peterxcli marked this pull request as ready for review June 13, 2025 08:09
@peterxcli peterxcli marked this pull request as draft June 13, 2025 09:26
@peterxcli peterxcli marked this pull request as draft June 13, 2025 09:26
@peterxcli peterxcli marked this pull request as draft June 13, 2025 09:26
@peterxcli peterxcli marked this pull request as draft June 13, 2025 09:26
defaultValue = "1",
tags = {OM},
description = "Maximum number of sub compactions to use when manual compacting. Default 1 means no limit.")
private int manualCompactionMaxSubCompactions = 1;
Copy link
Member Author

Choose a reason for hiding this comment

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

https://github.com/facebook/rocksdb/wiki/Subcompaction#options

The option max_subcompactions limits the max number of subcompactions for each compaction. By default, max_subcompactions = 1, which means it is disabled.

@peterxcli peterxcli changed the title HDDS-13114. MaxCompactionBytes and MaxSubCompactions should be configureable in RDBStore#compactTable HDDS-13114. Make MaxSubCompactions be configureable for manual compaction Jun 13, 2025
@peterxcli peterxcli changed the title HDDS-13114. Make MaxSubCompactions be configureable for manual compaction HDDS-13114. Make MaxSubCompactions configureable for manual compaction Jun 13, 2025
@github-actions
Copy link

This PR has been marked as stale due to 21 days of inactivity. Please comment or remove the stale label to keep it open. Otherwise, it will be automatically closed in 7 days.

@github-actions github-actions bot added the stale label Nov 12, 2025
@github-actions
Copy link

Thank you for your contribution. This PR is being closed due to inactivity. If needed, feel free to reopen it.

@github-actions github-actions bot closed this Nov 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants