Skip to content

[feat](compaction) Support ADMIN COMPACT TABLE type='FULL' and enable it in cloud mode#62596

Open
Yukang-Lian wants to merge 2 commits intoapache:masterfrom
Yukang-Lian:feat-admin-compact-full-cloud
Open

[feat](compaction) Support ADMIN COMPACT TABLE type='FULL' and enable it in cloud mode#62596
Yukang-Lian wants to merge 2 commits intoapache:masterfrom
Yukang-Lian:feat-admin-compact-full-cloud

Conversation

@Yukang-Lian
Copy link
Copy Markdown
Collaborator

Summary

Unify the ADMIN COMPACT TABLE ... WHERE type = '...' SQL entry so that BASE, CUMULATIVE and FULL all work on both the local and cloud (storage-compute split) engines. Before this change, FULL was rejected in FE and cloud mode was blocked outright, forcing users to curl each BE's HTTP API to run manual compaction.

What changes

FE

  • AdminCompactTableCommand: add FULL to CompactionType, relax analyzeWhere, map FULL -> \"full\" in getCompactionType, and drop the cloud-mode gate so the command dispatches via the normal Agent RPC path.
  • CloudEnv.compactTable: override Env.compactTable to walk partitions/indices/tablets, resolve the primary BE via Replica.getBackendId(), skip tablets whose compute group has no available BE, and raise DdlException if nothing was dispatched.

BE

  • submit_table_compaction_callback: strictly match base/cumulative/full instead of silently downgrading any non-\"base\" value to CUMULATIVE_COMPACTION. FULL goes through submit_compaction_task(force=false, eager=true, trigger_method=MANUAL) after setting last_full_compaction_schedule_time, matching the HTTP API default.
  • cloud_submit_table_compaction_callback: new callback mirroring the local one but calling CloudStorageEngine::submit_compaction_task; honors the cloud HTTP convention that base/cumu need sync_delete_bitmap while full does not.
  • agent_server::cloud_start_workers: register the previously stubbed-out SUBMIT_TABLE_COMPACTION worker (drops the // TODO(plat1ko) comment).

Thrift / wire compatibility

TCompactionReq.type remains optional string, so no IDL change. A new FE against an old BE would see \"full\" silently downgraded (local) or dropped (cloud), so the release order is all BEs upgraded first, then FE. FE rollback can lead BE since the FE simply stops sending \"full\".

Test plan

  • mvn -pl fe-core -am compile passes.
  • New regression suite regression-test/suites/compaction/test_admin_compact_table.groovy covers base / cumulative / full end-to-end on the local engine, plus negative cases (unknown type, missing WHERE).
  • New regression suite regression-test/suites/cloud_p0/compaction/test_cloud_admin_compact_table.groovy covers the same matrix on the cloud engine.
  • Design document and code reviewed independently by Codex (two rounds).

… it in cloud mode

ADMIN COMPACT TABLE previously only accepted BASE and CUMULATIVE in local
mode and threw Unsupported operation in cloud mode, forcing users to curl
each BE's HTTP API to run manual compaction. This change unifies the FE SQL
entry so that base/cumulative/full all work on both local and cloud.

FE
- AdminCompactTableCommand: add FULL to CompactionType, relax analyzeWhere,
  map FULL->"full" in getCompactionType, drop the cloud-mode gate so the
  command dispatches via the normal path.
- CloudEnv.compactTable: override Env.compactTable to walk partitions/
  indices/tablets, resolve the primary BE via Replica.getBackendId, and
  raise a DdlException if nothing was dispatched (e.g. the current compute
  group has no available BE).

BE
- submit_table_compaction_callback: strictly match base/cumulative/full and
  reject unknown types instead of silently downgrading non-"base" to
  cumulative. Full goes through submit_compaction_task(force=false,
  eager=true, trigger_method=MANUAL) after setting
  last_full_compaction_schedule_time, matching the HTTP API default.
- cloud_submit_table_compaction_callback: new callback mirroring the local
  one but calling CloudStorageEngine::submit_compaction_task; honors the
  cloud HTTP convention that base/cumu need sync_delete_bitmap while full
  does not.
- agent_server::cloud_start_workers: register the previously stubbed-out
  SUBMIT_TABLE_COMPACTION worker (drops the plat1ko TODO).

Thrift is untouched: TCompactionReq.type is already optional string, so the
existing "base"/"cumulative"/"full" wire format remains compatible. This
implies a release order of "all BEs upgraded first, then FE" - a new FE
against an old BE would see "full" silently downgraded (local) or dropped
(cloud).

Tests
- regression-test/suites/compaction/test_admin_compact_table.groovy:
  end-to-end coverage for base/cumulative/full under the local engine plus
  negative cases (unknown type, missing WHERE).
- regression-test/suites/cloud_p0/compaction/test_cloud_admin_compact_table.groovy:
  same matrix under the cloud engine, with a SELECT before each poll to
  force BE to sync rowsets from Meta Service.
@hello-stephen
Copy link
Copy Markdown
Contributor

Thank you for your contribution to Apache Doris.
Don't know what should be done next? See How to process your PR.

Please clearly describe your PR:

  1. What problem was fixed (it's best to include specific error reporting information). How it was fixed.
  2. Which behaviors were modified. What was the previous behavior, what is it now, why was it modified, and what possible impacts might there be.
  3. What features were added. Why was this function added?
  4. Which code was refactored and why was this part of the code refactored?
  5. Which functions were optimized and what is the difference before and after the optimization?

…ack changes

Reflow the new submit_compaction_task calls and the cloud callback's log
messages to satisfy clang-format.
@Yukang-Lian
Copy link
Copy Markdown
Collaborator Author

run buildall

@hello-stephen
Copy link
Copy Markdown
Contributor

FE UT Coverage Report

Increment line coverage 0.00% (0/42) 🎉
Increment coverage report
Complete coverage report

@hello-stephen
Copy link
Copy Markdown
Contributor

BE UT Coverage Report

Increment line coverage 0.00% (0/81) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 53.27% (20297/38101)
Line Coverage 36.76% (191187/520029)
Region Coverage 33.06% (148618/449528)
Branch Coverage 34.14% (64920/190136)

@hello-stephen
Copy link
Copy Markdown
Contributor

BE Regression && UT Coverage Report

Increment line coverage 45.24% (38/84) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 73.74% (27512/37311)
Line Coverage 57.47% (297933/518417)
Region Coverage 54.81% (248648/453640)
Branch Coverage 56.32% (107402/190706)

@hello-stephen
Copy link
Copy Markdown
Contributor

FE Regression Coverage Report

Increment line coverage 73.81% (31/42) 🎉
Increment coverage report
Complete coverage report

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants