Skip to content

Support ALTER TABLE SET auto_flush_interval #8394

Description

@discord9

What type of request is this?

Follow-up enhancement for table-level auto_flush_interval.

What subsystems are affected?

Distributed Cluster, Storage Engine, Table Engine, Frontend, Datanode

Background

PR #8357 added table-level auto_flush_interval support for the CREATE TABLE path:

CREATE TABLE t (
    ts TIMESTAMP TIME INDEX
) WITH ('auto_flush_interval' = '5m');

The PR description explicitly scoped the change to creation time and noted that ALTER TABLE support should follow later:

Scope: this PR covers setting the option at CREATE TABLE. Changing it via ALTER TABLE is a natural follow-up (a SetRegionOption::AutoFlushInterval variant + the apply path in handle_alter); happy to fold it in here if preferred.

Requested follow-up

Support changing the per-table auto flush interval on existing tables:

ALTER TABLE t SET 'auto_flush_interval' = '5m';

This is useful for old/existing tables after upgrade: users can opt in to the new per-table flush cadence without recreating the table.

Current behavior

The statement is currently rejected because the ALTER TABLE SET option plumbing does not include auto_flush_interval yet:

Error: 1004(InvalidArguments), Invalid set table option request: Invalid set region option request, key: auto_flush_interval, value: 5m

Relevant implementation areas:

  • src/store-api/src/region_request.rs: add a SetRegionOption::AutoFlushInterval variant and parse/validate positive humantime durations.
  • src/table/src/metadata.rs: persist the table option to TableOptions.extra_options.
  • src/mito2/src/worker/handle_alter.rs: apply the new interval to the current region options, similar to other fast region options.

Version

Current main / development build after PR #8357.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions