1. 10 Oct, 2018 4 commits
  2. 09 Oct, 2018 5 commits
    • Marko Mäkelä's avatar
      Work around a test failure · 9c458f54
      Marko Mäkelä authored
      9c458f54
    • Marko Mäkelä's avatar
    • Marko Mäkelä's avatar
      Adjust a test. · 78e7a16b
      Marko Mäkelä authored
      FIXME: DB_TRX_ID,DB_ROLL_PTR are not reset for the metadata record
      78e7a16b
    • Marko Mäkelä's avatar
      Try to support ADD/DROP/reorder with virtual columns · 6e4c840b
      Marko Mäkelä authored
      FIXME: The virtual column code does not really support any reordering
      of virtual columns. The function check_v_col_in_order() should be
      removed and all the code fixed.
      
      ha_innobase::check_if_supported_inplace_alter(): For now,
      forbid ADD COLUMN of a stored column together with ADD/DROP of
      virtual columns. This works around an assertion failure in
      gcol.innodb_virtual_basic line 541.
      
      dict_table_t::instant_column(): Copy and adjust v_cols[].
      
      dict_table_t::rollback_instant(): Roll back v_cols[].
      
      innobase_build_col_map(): Skip added virtual columns.
      
      prepare_inplace_add_virtual(): Correctly compute num_to_add_vcol.
      Remove some unnecessary code. Note that the call to
      innodb_base_col_setup() should be executed later.
      
      innobase_add_virtual_try(), innobase_drop_virtual_try(): Let
      the caller invoke innodb_update_cols().
      
      ha_innobase::commit_inplace_alter_table(): Add a FIXME comment
      that we should not reload the table when virtual columns are added
      or dropped. Currently, reloading is the only way to add the base
      columns of virtual columns into the InnoDB data dictionary cache.
      
      innobase_instant_try(): If any virtual column is dropped, rewrite
      all virtual column metadata. Use a shortcut only for adding
      virtual columns. This is because innobase_drop_virtual_try()
      assumes that the dropped virtual columns still exist in the cache.
      6e4c840b
    • Marko Mäkelä's avatar
      Fix FOREIGN KEY error handling on DDL · ae73b7d8
      Marko Mäkelä authored
      dict_create_add_foreigns_to_dictionary(): Do not commit the transaction.
      We want simple rollback in case dict_load_foreigns() would fail.
      
      create_table_info_t::create_table(), row_create_index_for_mysql(),
      row_table_add_foreign_constraints(): Before invoking rollback, drop
      the table. Rollback would invoke trx_t::evict_table(), and after that
      dropping the table would be a no-op.
      
      ha_innobase::create(): Before rollback, drop the table. If the SQL
      layer invoked ha_innobase::delete_table() later, it would be a no-op
      because the rollback would have invoked trx_t::evict_table().
      
      FIXME: Introduce an undo log record so that the data file would be
      deleted on rollback. Also, avoid unnecessary access to the tablespace
      during DROP TABLE or the rollback of CREATE TABLE. If the file is going
      to be deleted anyway, we should not bother to mark the pages free.
      ae73b7d8
  3. 08 Oct, 2018 6 commits
    • Marko Mäkelä's avatar
      Fix instant ADD after instant DROP · 51bd08c8
      Marko Mäkelä authored
      row_metadata_to_tuple(), row_rec_to_index_entry_impl():
      Add the parameter "pad" to determine whether
      the tuple should be padded to the index fields (on ALTER TABLE it should),
      or whether it should remain at its original size (on rollback).
      
      trx_undo_page_report_modify(): Avoid out-of-bounds access to record fields.
      
      row_quiesce_write_index_fields(): Do not crash when the table contains
      an instantly dropped column.
      51bd08c8
    • Marko Mäkelä's avatar
    • Marko Mäkelä's avatar
    • Marko Mäkelä's avatar
      Fix a rollback bug · edcd3f08
      Marko Mäkelä authored
      row_rec_to_index_entry_impl<true, 2>(): Correctly convert a record
      from instant ALTER TABLE format into instant ADD COLUMN format.
      
      row_undo_search_clust_to_pcur(): Relax too tight debug assertions.
      edcd3f08
    • Marko Mäkelä's avatar
      3905ba7c
    • Marko Mäkelä's avatar
      Remove dict_table_t::rollback_instant(unsigned n) · a140cd1f
      Marko Mäkelä authored
      On rollback of changes to SYS_COLUMNS, we can no longer assume that
      the change was the instant addition of a column at the end of the
      column list. The function dict_table_t::rollback_instant(unsigned n)
      was inherently incompatible with instantly dropping or reordering
      columns.
      
      When a change to SYS_COLUMNS is rolled back, we must simply evict
      the affected table definition, at the end of the rollback. We cannot
      free the table object immediately, because the current transaction
      that is being rolled back may be holding locks on the table.
      
      dict_table_remove_from_cache_low(): Replaced
      by dict_table_remove_from_cache().
      
      dict_table_remove_from_cache(): Add a third parameter keep=false,
      so that the table can be freed by the caller.
      
      dict_table_t::rollback_instant(): Add the parameter old_n_fields,
      and simplify some logic.
      
      trx_lock_t::evicted_tables: List of tables on which trx_t::evict_table()
      was invoked.
      
      trx_t::evict_table(): Evict a table definition during rollback.
      
      trx_commit_in_memory(): Empty the trx->lock.evicted_tables list
      after the locks were released, by freeing the table objects.
      
      row_undo_ins_remove_clust_rec: Invoke trx_t::evict_table() on the
      affected table if a change to SYS_COLUMNS is being rolled back.
      
      row_undo_mod_clust_low(): FIXME: do the same
      a140cd1f
  4. 07 Oct, 2018 2 commits
  5. 06 Oct, 2018 4 commits
  6. 05 Oct, 2018 7 commits
  7. 04 Oct, 2018 7 commits
  8. 03 Oct, 2018 5 commits
    • Marko Mäkelä's avatar
      innobase_instant_try(): Put back the parameter ctx · b894457c
      Marko Mäkelä authored
      For partitioned tables, we must adjust each partition separately.
      b894457c
    • Marko Mäkelä's avatar
      Simplify the metadata BLOB parsing on startup · 9c49d617
      Marko Mäkelä authored
      FIXME: For dropped columns, store the nullability and the fixed_len
      in the BLOB array. Also, add a version discriminator field.
      
      btr_cur_instant_init_low(): Read and validate the metadata BLOB page
      before reconstructing the dictionary information based on it.
      
      dict_col_t::clear_instant(): Renamed from remove_instant().
      Do not assert that the column was instantly added, because we
      sometimes call this unconditionally for all columns.
      
      dict_table_t::reconstruct_columns(): Take the metadata BLOB
      and length as a parameter. Invoke dict_index_t::reconstruct_fields()
      upon successful completion.
      9c49d617
    • Marko Mäkelä's avatar
      a5c2dd5e
    • Marko Mäkelä's avatar
      Introduce btr_set_instant() and a new root page format · 80aefe16
      Marko Mäkelä authored
      For instant DROP COLUMN and ROW_FORMAT=COMPACT or ROW_FORMAT=REDUNDANT,
      we must store the n_core_null_bytes in the root page, so that the
      chain of node pointer records can be followed in order to reach the
      leftmost leaf page where the metadata record is located.
      
      If the PRIMARY KEY contains any variable-length column and some
      nullable columns were instantly dropped, the dict_index_t::n_nullable
      in the data dictionary could be smaller than it actually is in the
      non-leaf pages. Because of this, the non-leaf pages could use more
      bytes for the null flags than the data dictionary expects, and we
      could be reading the lengths of the variable-length columns from the
      wrong offset, and thus reading the child page number from wrong place.
      This is the result of two design mistakes that involve unnecessary
      storage of data: First, it is nonsense to store any data fields for
      the leftmost node pointer records, because the comparisons would be
      resolved by the MIN_REC_FLAG alone. Second, there cannot be any null
      fields in the clustered index node pointer fields, but we nevertheless
      reserve space for all the null flags.
      
      btr_set_instant(): Convert a root page into "instant ALTER TABLE"
      format. This replaces page_set_instant().
      
      btr_cur_instant_init_metadata(): Do not read any lengths from the
      metadata record header before reading the BLOB. At this point, we
      would not actually know how many nullable fields the metadata record
      contains.
      
      btr_cur_instant_init_low(): Minimize differences from the 10.3 version.
      
      btr_cur_instant_root_init(): Initialize n_core_null_bytes in one
      of two possible ways.
      
      FIXME: innobase_instant_try(): When needed, convert the root page
      from the ADD COLUMN format to the generic instant ALTER TABLE format.
      80aefe16
    • Marko Mäkelä's avatar
      MDEV-11369: Implement accurate checks for the metadata record · ae4f464f
      Marko Mäkelä authored
      Because changes of the FIL_PAGE_TYPE or PAGE_INSTANT in the root
      page are not undo-logged, it is possible that the fields suggest
      that instant ADD COLUMN is in effect, even though no metadata
      record exists. If the fields are set, proceed to fetch the
      metadata record. If the metadata record does not exist, return
      success if !index->is_instant().
      
      Also, check that the "infimum" and "supremum" records carry the
      strings in the root page. In a later format that supports instant
      DROP COLUMN, we will have to store more information in the root
      page, so that index->n_core_null_bytes can be determined accurately.
      ae4f464f