• Sergei Petrunia's avatar
    MDEV-7370: Server deadlocks on renaming a table for which persistent statistics exists · f91798dd
    Sergei Petrunia authored
    RENAME TABLE code tries to update EITS statistics. It hung, because
    it used an index on (db_name,table_name) to find the table, and attempted
    to update these values at the same time. The fix is do what SQL UPDATE
    statement does when updating index that it's used for scanning:
    - First, buffer the rowids of rows to be updated,
    - then make the second pass to actually update the rows
    
    Also fixed the call to rename_table_in_stat_tables() in sql_rename.cc
    to pass the correct new database (before, it passed old db_name so cross-
    database renames were not handled correctly).
    
    Variant #2, with review feedback addressed.
    f91798dd
stat_tables.test 8.95 KB