• Venkatesh Duggirala's avatar
    Bug#11752707-SLAVE CRASHES IF RBR HAS AS DESTINATION A VIEW · bc21e8cd
    Venkatesh Duggirala authored
    RATHER THAN A TABLE
    
    Problem: In RBR, If a table is converted into a view at slave,
    (i.e., "drop table 'object1'" & "create view 'object1'"), then any
    DML operations on the table at master are causing crash at slave.
    
    Analysis: Slave prepares tables to be opened for DML list when it
    receives Table_map_log_event(s). And the same list will be sent to
    open_table function. Open_table logic assumes that if the list
    contains a view object, it also contains "select_lex" object of
    that view. In the above special case, the table object does not
    contain 'select_lex' as it is base table at master. Since it
    is a view at slave, open_table logic goes to 'mysql_make_view()'
    function which assumes that 'select_lex' exists for the object.
    
    Fix: While preparing 'tables to be opened' list, we should make 
    sure that table required type is 'base table'. If it is not 
    base table while opening the object, mysql_make_view will throw an 
    error similar to 'object is not a base table' 
    
    sql/log_event.cc:
      Restrict that all table_map_log_event's objects should be 
      base tables @ slave also.
    bc21e8cd
log_event.cc 320 KB