• marko's avatar
    branches/zip: Fast index creation: Remove the ROW_PREBUILT_OBSOLETE nonsense. · 71a4f691
    marko authored
    Active transactions must not switch table or index definitions on the fly,
    for several reasons, including the following:
    
     * copied indexes do not carry any history or locking information;
       that is, rollbacks, read views, and record locking would be broken
    
     * huge potential for race conditions, inconsistent reads and writes,
       loss of data, and corruption
    
    Instead of trying to track down if the table was changed during a transaction,
    acquire appropriate locks that protect the creation and dropping of indexes.
    
    innodb-index.test: Test the locking of CREATE INDEX and DROP INDEX.  Test
    that consistent reads work across dropped indexes.
    
    lock_rec_insert_check_and_lock(): Relax the lock_table_has() assertion.
    When inserting a record into an index, the table must be at least IX-locked.
    However, when an index is being created, an IS-lock on the table is
    sufficient.
    
    row_merge_lock_table(): Add the parameter enum lock_mode mode, which must
    be LOCK_X or LOCK_S.
    
    row_merge_drop_table(): Assert that n_mysql_handles_opened == 0.
    Unconditionally drop the table.
    
    ha_innobase::add_index(): Acquire an X or S lock on the table, as appropriate.
    After acquiring an X lock, assert that n_mysql_handles_opened == 1.
    Remove the comments about dropping tables in the background.
    
    ha_innobase::final_drop_index(): Acquire an X lock on the table.
    
    dict_table_t: Remove version_number, to_be_dropped, and prebuilts.
    ins_node_t: Remove table_version_number.
    
    enum lock_mode: Move the definition from lock0lock.h to lock0types.h.
    
    ROW_PREBUILT_OBSOLETE, row_update_prebuilt(), row_prebuilt_table_obsolete():
    Remove.
    
    row_prebuilt_t: Remove the declaration from row0types.h.
    
    row_drop_table_for_mysql_no_commit(): Always print a warning if a table
    was added to the background drop queue.
    71a4f691
row0mysql.c 110 KB