Skip to content

feat: support create region requirements#8281

Open
WenyXu wants to merge 2 commits into
GreptimeTeam:mainfrom
WenyXu:feat/create-region-requirement
Open

feat: support create region requirements#8281
WenyXu wants to merge 2 commits into
GreptimeTeam:mainfrom
WenyXu:feat/create-region-requirement

Conversation

@WenyXu

@WenyXu WenyXu commented Jun 11, 2026

Copy link
Copy Markdown
Member

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.

  • 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.

Copilot AI review requested due to automatic review settings June 11, 2026 13:07
@github-actions github-actions Bot added the docs-not-required This change does not impact docs. label Jun 11, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 RegionRequirements through create-region proto parsing into RegionCreateRequest.
  • Enforce RegionRequirements during region creation in mito2 and file-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_requirements is now used by both create and open paths, but the UnsupportedSnafu.operation string 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.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

@WenyXu WenyXu force-pushed the feat/create-region-requirement branch from 0cadc2e to fa2cffb Compare June 12, 2026 03:21
@WenyXu

WenyXu commented Jun 12, 2026

Copy link
Copy Markdown
Member Author

wait for GreptimeTeam/greptime-proto#324

WenyXu added 2 commits June 12, 2026 03:24
Signed-off-by: WenyXu <wenymedia@gmail.com>
Signed-off-by: WenyXu <wenymedia@gmail.com>
@WenyXu WenyXu force-pushed the feat/create-region-requirement branch from fa2cffb to 559420e Compare June 12, 2026 03:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs-not-required This change does not impact docs. size/S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants