Skip to content

feat: allow ALTER TABLE to modify the skip_wal option dynamically#8048

Draft
JoeS51 wants to merge 6 commits intoGreptimeTeam:mainfrom
JoeS51:feat/alter-table-skip-wal
Draft

feat: allow ALTER TABLE to modify the skip_wal option dynamically#8048
JoeS51 wants to merge 6 commits intoGreptimeTeam:mainfrom
JoeS51:feat/alter-table-skip-wal

Conversation

@JoeS51
Copy link
Copy Markdown
Contributor

@JoeS51 JoeS51 commented Apr 29, 2026

I hereby agree to the terms of the GreptimeDB CLA.

Refer to a related PR or issue link (optional)

Fixes this issue

What's changed and what's your intention?

This PR now allows the ALTER TABLE command to update skip_wal at runtime instead of only at table creation time. To support this operation safely, this PR separates WAL provider configuration from the runtime “skip WAL” toggle. Previously, Greptime used WalOptions::Noop to indicate that a region should skip WAL writes. This makes re-enabling WAL unsafe because the original provider information will be be discarded. (see discussion)

This PR introduces skip_wal as a new region option and uses it as the runtime signal for whether WAL writes should be skipped, while preserving the region’s provider specific wal_options. New regions created with skip_wal=true still keep real WAL provider metadata, so WAL can later be re-enabled safely.

For backwards compatibility, legacy regions that already persist WalOptions::Noop are still supported as "skip wal" regions, but attempting to re-enable WAL for those legacy regions now fails explicitly because the original provider information is unavailable (please let me know if there is a better solution for this).

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.

@github-actions github-actions Bot added size/M docs-not-required This change does not impact docs. labels Apr 29, 2026
JoeS51 added 4 commits April 28, 2026 22:03
Signed-off-by: Johannes Sluis <joesluis51@gmail.com>
Signed-off-by: Johannes Sluis <joesluis51@gmail.com>
Signed-off-by: Johannes Sluis <joesluis51@gmail.com>
Signed-off-by: Johannes Sluis <joesluis51@gmail.com>
Copy link
Copy Markdown
Contributor

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

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 introduces a skip_wal option for regions and tables, allowing the Write-Ahead Log to be bypassed for specific operations. The changes include updates to region and table options, modifications to the write and close paths to respect the new flag, and validation to prevent enabling WAL on legacy regions created with a no-op provider. Review feedback suggests improving maintainability by refactoring the WAL-skipping check into a centralized helper method in RegionOptions and simplifying the validation logic in the alter handler for better idiomaticity.

Comment thread src/mito2/src/region/options.rs
Comment thread src/mito2/src/worker/handle_alter.rs Outdated
Comment thread src/mito2/src/worker/handle_write.rs Outdated
Comment thread src/mito2/src/worker/handle_write.rs Outdated
Comment thread src/mito2/src/worker/handle_close.rs Outdated
@JoeS51 JoeS51 changed the title Feat/alter table skip wal feat: Allow ALTER TABLE to modify the skip_wal option dynamically Apr 29, 2026
@JoeS51 JoeS51 changed the title feat: Allow ALTER TABLE to modify the skip_wal option dynamically feat: allow ALTER TABLE to modify the skip_wal option dynamically Apr 29, 2026
…d be skipped

Signed-off-by: Johannes Sluis <joesluis51@gmail.com>
@JoeS51 JoeS51 force-pushed the feat/alter-table-skip-wal branch from 7440d5f to 37a4c2b Compare April 30, 2026 03:43
Signed-off-by: Johannes Sluis <joesluis51@gmail.com>
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/M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant