[MDEV-24576] Atomic CREATE TABLE Created: 2021-01-12  Updated: 2022-11-01  Resolved: 2021-05-20

Status: Closed
Project: MariaDB Server
Component/s: Data Definition - Create Table
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
Relates
relates to MDEV-25292 Atomic CREATE OR REPLACE TABLE Stalled

 Description   

The purpose of this task is to ensure that CREATE TABLE is atomic.

The CREATE logic should be:

  • Log CREATE TABLE/VIEW/SEQUENCE to be created to ddl log
  • Execute statement
  • Mark CREATE done in ddl log with xid
  • Update binary log
  • Mark ddl log entry complete

During recovery, delete any incomplete objects that are not in the binary log.

All part of CREATE are now atomic, in the sense that if there is a crash, there will be no temporary tables left and all tables
will be consistent.

There is still one thing that should be fixed
CREATE OR REPLACE TABLE foo ... is, as before, implemented as:

DROP TABLE IF EXISTS foo;
CREATE TABLE foo ..

The problem is that if CREATE TABLE fails or the server crashes during the create, the old table foo will not be recovered.
MDEV-25292 will fix this.



 Comments   
Comment by Michael Widenius [ 2021-01-21 ]

Code is ready for review in bb-10.6-monty

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