feat: support create region requirements#8281
Conversation
There was a problem hiding this comment.
Pull request overview
This PR extends the existing RegionRequirements capability semantics to the create-region flow, so create requests can express (and engines can enforce) requirements like “must be backed by object storage”, matching the safety checks already used when opening regions.
Changes:
- Plumb
RegionRequirementsthrough create-region proto parsing intoRegionCreateRequest. - Enforce
RegionRequirementsduring region creation inmito2andfile-engine(and rename the shared check helper to be open/create-agnostic). - Update meta/template builders and tests to carry/default the new requirements field.
Reviewed changes
Copilot reviewed 15 out of 16 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/store-api/src/region_request.rs | Parse/create defaulting for create-region requirements; add proto conversions; add tests. |
| src/mito2/src/worker/handle_open.rs | Switch open-path requirement check call to the renamed helper. |
| src/mito2/src/worker/handle_create.rs | Add requirement enforcement before creating/opening the region. |
| src/mito2/src/test_util.rs | Initialize new requirements field in test builders. |
| src/mito2/src/region/opener.rs | Rename requirement check API and update error variant used. |
| src/mito2/src/error.rs | Rename/generalize requirement error variant/message for open/create usage. |
| src/mito2/src/engine/basic_test.rs | Add/adjust tests to include create requirements field. |
| src/metric-engine/src/test_util.rs | Initialize new requirements field in test requests. |
| src/metric-engine/src/engine/create/extract_new_columns.rs | Update test fixtures for new create-request field. |
| src/metric-engine/src/engine/create.rs | Propagate requirements into engine-generated region create requests; update tests. |
| src/meta-srv/src/procedure/tests.rs | Update expected create request template to include new proto field. |
| src/file-engine/src/region.rs | Update tests to include new create-request field. |
| src/file-engine/src/engine.rs | Enforce requirements on create as well as open; rename helper; update tests. |
| src/common/meta/src/ddl/create_table/template.rs | Add builder support to set create-region requirements on generated create requests. |
| Cargo.toml | Bump greptime-proto git revision to include the new requirements field. |
| Cargo.lock | Lockfile update for the bumped greptime-proto revision. |
Comments suppressed due to low confidence (1)
src/file-engine/src/engine.rs:193
ensure_region_requirementsis now used by both create and open paths, but theUnsupportedSnafu.operationstring still says "open region ...". This makes create failures misleading (you'll see an "open" message for a create request). Consider generalizing the message so it matches all callers.
fn ensure_region_requirements(
requirements: RegionRequirements,
object_store: &ObjectStore,
) -> EngineResult<()> {
if !requirements.object_storage {
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Code Review
This pull request updates the greptime-proto dependency and integrates RegionRequirements into the region creation workflow across various engines (file, metric, and mito2). It renames ensure_open_requirements to ensure_region_requirements to generalize the requirement checks for both opening and creating regions, and updates corresponding error definitions, tests, and builders. There are no review comments to address, and I have no additional feedback to provide.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
0cadc2e to
fa2cffb
Compare
|
wait for GreptimeTeam/greptime-proto#324 |
Signed-off-by: WenyXu <wenymedia@gmail.com>
Signed-off-by: WenyXu <wenymedia@gmail.com>
fa2cffb to
559420e
Compare
I hereby agree to the terms of the GreptimeDB CLA.
Refer to a related PR or issue link (optional)
#8171
What's changed and what's your intention?
This PR adds create-region support for
RegionRequirements.The intention is to make create-region requests carry the same capability requirement semantics that are already used by open-region flows, especially the object-storage requirement used to ensure region data can be accessed safely across datanodes.
PR Checklist
Please convert it to a draft if some of the following conditions are not met.