mariadb/mysql-test/suite/atomic/create_view.result
Monty d494abd175 MDEV-24607 Atomic CREATE VIEW
The logic of the new code is:
- Log CREATE view to DDL log, with a marker if old view existed
- If old view exists (in case of CREATE or REPLACE view), make a copy
  of the old view as view_name.frm-
- Create the new view definition file
- Delete copy of view if it was created.

Crash recovery:
- Delete view_name.frm~ file (Temporary file for view definition)
- 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 the
    old definition)

One benefit of the new code is that CREATE OR REPLACE VIEW for an
existing view is no fully atomic: Either the view will be replaced or
the old one will be left unchanged.
2021-05-19 22:54:13 +02:00

82 lines
1.7 KiB
Text

query: CREATE VIEW t1 as select "new"
crash point: ddl_log_create_before_copy_view
t2.frm
old
old
crash point: ddl_log_create_before_create_view
t2.frm
old
old
crash point: definition_file_after_create
t2.frm
old
old
crash point: ddl_log_create_after_create_view
t2.frm
old
old
crash point: ddl_log_create_before_binlog
t2.frm
old
old
crash point: ddl_log_create_after_binlog
t1.frm
t2.frm
old
old
master-bin.000001 # Query # # use `test`; CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `t1` AS select "new"
query: CREATE OR REPLACE VIEW t1 as select "new"
crash point: ddl_log_create_before_copy_view
t2.frm
old
old
crash point: ddl_log_create_before_create_view
t2.frm
old
old
crash point: definition_file_after_create
t2.frm
old
old
crash point: ddl_log_create_after_create_view
t2.frm
old
old
crash point: ddl_log_create_before_binlog
t2.frm
old
old
crash point: ddl_log_create_after_binlog
t1.frm
t2.frm
old
old
master-bin.000001 # Query # # use `test`; CREATE OR REPLACE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `t1` AS select "new"
query: CREATE OR REPLACE VIEW t2 as select "new"
crash point: ddl_log_create_before_copy_view
t2.frm
old
old
crash point: ddl_log_create_before_create_view
t2.frm
old
old
crash point: definition_file_after_create
t2.frm
old
old
crash point: ddl_log_create_after_create_view
t2.frm
old
old
crash point: ddl_log_create_before_binlog
t2.frm
old
old
crash point: ddl_log_create_after_binlog
t2.frm
new
new
master-bin.000001 # Query # # use `test`; CREATE OR REPLACE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `t2` AS select "new"
Warnings:
Note 4092 Unknown VIEW: 'test.t1,test.t2'