Skip to content

Roll back failed OPTIMIZE TABLE and REPAIR TABLE rebuilds - #567

Draft
JanJakes wants to merge 1 commit into
trunkfrom
rollback-failed-table-rebuilds
Draft

JanJakes wants to merge 1 commit into
trunkfrom
rollback-failed-table-rebuilds

Conversation

@JanJakes

Copy link
Copy Markdown
Member

OPTIMIZE TABLE and REPAIR TABLE report rebuild errors as result rows. The surrounding transaction then commits the work completed before the error, leaving hidden tables or a partly rebuilt table.

This change makes each table administration operation atomic with an internal savepoint. A failed rebuild restores the original schema and data, while successful rebuilds of other tables are preserved. Existing user transactions and savepoints remain active.

Regression tests cover failures while copying rows, dropping the old table, and recreating indexes, including temporary tables, repeated failures, mixed results, and user transactions.

Fixes #549.

Wrap each table administration operation in a savepoint before converting errors into result rows. Preserve successful table rebuilds and surrounding user transactions when another table fails.

Fixes #549
@coderabbitai

coderabbitai Bot commented Oct 23, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

This branch has not been deployed

No deployments
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.

OPTIMIZE TABLE and REPAIR TABLE commit partial changes when a rebuild fails

1 participant