[MDEV-24607] ATOMIC CREATE VIEW Created: 2021-01-17  Updated: 2022-11-01  Resolved: 2021-05-20

Status: Closed
Project: MariaDB Server
Component/s: Data Definition - Create Table, Views
Fix Version/s: 10.6.1

Type: Task Priority: Critical
Reporter: Michael Widenius Assignee: Michael Widenius
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
PartOf
is part of MDEV-17567 Atomic DDL Closed

 Description   

The purpose of this task is to ensure that CREATE VIEW is atomic

When a view is created, the definition is first written to a view_name.frm~ and then renamed to
view_name.frm

The logic should be

  • Log CREATE view to DDL log, with a marker if old view existsted
  • If old view exists (in case of CREATE or REPLACE view) make a copy of old view
  • Create view
  • Delete view copy if it was created.

Crash recovery:

  • Delete view_name.frm~ file.
  • If query was logged to binary log
  • delete copy of view if it exists
    -else
    rename the copy of the view over the .frm file (restoring old definition)

One benefit of the new code is that create or replace view is no totally atomic even if there existed an old view: Either the view will be replaced or the old one will be untouched.


Generated at Thu Feb 08 09:31:16 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.