• Monty's avatar
    MDEV-24607 Atomic CREATE VIEW · d494abd1
    Monty authored
    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.
    d494abd1
ddl_log.cc 80.4 KB