• Mattias Jonsson's avatar
    Bug#14589559: ASSERTION `FILE_ENTRY_BUF[2] == 0' · 5f4dc753
    Mattias Jonsson authored
    FAILED IN DEACTIVATE_DDL_LOG_ENTRY
    
    deallocate_ddl_log_entry() can be called without having
    locked LOCK_gdl. It uses a global buffer for reading and
    writing entries in the ddl_log, and since it is not protected
    by any mutex, two concurrent threads can overwrite the
    content in the global buffer, so it can be different from
    what was read.
    Thread a reads from entry 1 into global
    buffer, thread b reads from entry 2 into global buffer,
    thread a writes from global buffer into entry 1
    -> entry 1 is not the content of entry 2.
    
    This is especially bad for replace entries, which uses
    two phases, and does not deactivate the whole entry
    after the first phase, but increases the phase instead.
    
    Fixed by using thread local storage (stack) instead of global
    storage (global buffer).
    
    Also added buffer and size arguments to
    read/write_ddl_log_file_entry.
    
    Also only read/write first bytes in entries in
    deactivate_ddl_log_entry.
    
    Also fixed the scenario where it will try to recover from a server
    compiled with a different value of IO_SIZE (very uncommon!)
    
    updated patch with set_ddl_log_entry_from_buf
    and removed read_ddl_log_entry.
    
    Manually tested, no test case included.
    5f4dc753
sql_table.cc 257 KB