Skip to content

Conversation

v0y4g3r
Copy link
Contributor

@v0y4g3r v0y4g3r commented Oct 14, 2025

I hereby agree to the terms of the GreptimeDB CLA.

Refer to a related PR or issue link (optional)

What's changed and what's your intention?

Add Parallelism Support to Compaction Requests

Support specifying parallelism when manually trigger compaction, now the syntax looks like:

  • admin compact_table("table"): regular compaction, default parallelism(1)
  • admin compact_table("table", "regular", "parallelism=2"): regular compaction, parallelism=2
  • admin compact_table("table", "swcs"): swcs compaction, default parallelism(1), default time window
  • admin compact_table("table", "swcs", "window=1800"): swcs compaction, time window=1800s
  • admin compact_table("table", "swcs", "parallelism=2"): swcs compaction, default time window, parallelism=2
  • admin compact_table("table", "swcs", "window=1800,parallelism=2"): swcs compaction, time window=1800s, parallelism=2

Details

  • Cargo.lock & Cargo.toml: Updated greptime-proto dependency to a new revision.
  • flush_compact_table.rs: Enhanced parse_compact_params to support a new parallelism parameter, allowing users to specify the level of parallelism for table compaction.
  • handle_compaction.rs: Integrated parallelism into the compaction scheduling process, defaulting to 1 if not specified.
  • request.rs & region_request.rs: Modified CompactRequest to include parallelism, with logic to handle unspecifie values.
  • requests.rs: Updated CompactTableRequest structure to include an optional parallelism field.

PR Checklist

Please convert it to a draft if some of the following conditions are not met.

  • I have written the necessary rustdoc comments.
  • I have added the necessary unit tests and integration tests.
  • This PR requires documentation updates.
  • API changes are backward compatible.
  • Schema or data changes are backward compatible.

@v0y4g3r v0y4g3r requested review from a team, evenyag and waynexia as code owners October 14, 2025 02:59
@github-actions github-actions bot added size/S docs-not-required This change does not impact docs. labels Oct 14, 2025
@github-actions github-actions bot added size/M and removed size/S labels Oct 14, 2025
@v0y4g3r v0y4g3r requested a review from fengjiachun October 14, 2025 08:44
@github-actions github-actions bot added docs-required This change requires docs update. and removed docs-not-required This change does not impact docs. labels Oct 14, 2025
Copy link
Collaborator

@fengjiachun fengjiachun left a comment

Choose a reason for hiding this comment

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

LGTM

 ### Add Parallelism Support to Compaction Requests

 - **`Cargo.lock` & `Cargo.toml`**: Updated `greptime-proto` dependency to a new revision.
 - **`flush_compact_table.rs`**: Enhanced `parse_compact_params` to support a new `parallelism` parameter, allowing users to
 specify the level of parallelism for table compaction.
 - **`handle_compaction.rs`**: Integrated `parallelism` into the compaction scheduling process, defaulting to 1 if not
 specified.
 - **`request.rs` & `region_request.rs`**: Modified `CompactRequest` to include `parallelism`, with logic to handle unspecifie
 values.
 - **`requests.rs`**: Updated `CompactTableRequest` structure to include an optional `parallelism` field.

Signed-off-by: Lei, HUANG <[email protected]>
 ### Commit Message

 Enhance Compaction Request Handling

 - **`flush_compact_table.rs`**:
   - Renamed `parse_compact_params` to `parse_compact_request`.
   - Introduced `DEFAULT_COMPACTION_PARALLELISM` constant.
   - Updated parsing logic to handle keyword arguments for `strict_window` and `regular` compaction types, including `parallelism` and `window`.
   - Modified tests to reflect changes in parsing logic and default parallelism handling.

 - **`request.rs`**:
   - Updated `parallelism` handling in `RegionRequestBody::Compact` to use the new default value.

 - **`requests.rs`**:
   - Changed `CompactTableRequest` to use a non-optional `parallelism` field with a default value of 1.

Signed-off-by: Lei, HUANG <[email protected]>
 ### Update `flush_compact_table.rs` Parameter Validation

 - Modified parameter validation in `flush_compact_table.rs` to restrict the maximum number of parameters from 4 to 3 in the `parse_compact_request` function.

Signed-off-by: Lei, HUANG <[email protected]>
 Update `greptime-proto` dependency

 - Updated the `greptime-proto` dependency to a new revision in both `Cargo.lock` and `Cargo.toml`.

Signed-off-by: Lei, HUANG <[email protected]>
@v0y4g3r v0y4g3r force-pushed the feat/manual-compaction-parallelism branch from 6b8e136 to dfb4ae8 Compare October 16, 2025 03:10
@v0y4g3r v0y4g3r added this pull request to the merge queue Oct 16, 2025
Merged via the queue into GreptimeTeam:main with commit 552c502 Oct 16, 2025
42 checks passed
@v0y4g3r v0y4g3r deleted the feat/manual-compaction-parallelism branch October 16, 2025 04:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs-required This change requires docs update. size/M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants