Uploaded image for project: 'Percona Server'
  1. Percona Server
  2. PS-4280

alter table comment rebuild whole table

    Details

    • Type: Bug
    • Status: Done
    • Priority: High
    • Resolution: Fixed
    • Affects Version/s: 5.7.21-20, 5.6.39-83.1
    • Fix Version/s: 5.7.21-21, 5.6.40-84.0
    • Component/s: TokuDB
    • Labels:
      None

      Description

      alter table comment cause tokudb to rebuild the whole table, which is not needed, only FRM metadata should be changed.

      create table t1(id int) engine=TokuDB;
      insert into t1 values (1), (2), (3);
      alter table t1 comment='test table';

      gdb which the alter statement, we can see that `HA_ALTER_INPLACE_NOT_SUPPORTED` is returned from `ha_tokudb::check_if_supported_inplace_alter` checking and table copy is used as:

      ```
      #0 toku_ft_root_put_msg (ft=0x7fa79d296600, msg=..., gc_info=0x7fa842650400) at percona-server/storage/tokudb/PerconaFT/ft/ft-ops.cc:1917
      #1 0x00000000017bdddb in toku_ft_send_insert (ft_handle=0x7fa799e120c0, key=0x7fa8426506b0, val=0x7fa8426506d0, xids=0x7fa79d216030, type=FT_INSERT, gc_info=0x7fa842650400) at percona-server/storage/tokudb/PerconaFT/ft/ft-ops.cc:2557
      #2 0x00000000017bcf25 in toku_ft_maybe_insert (ft_h=0x7fa799e120c0, key=0x7fa8426506b0, val=0x7fa8426506d0, txn=0x7fa79d296000, oplsn_valid=false, oplsn=..., do_logging=true, type=FT_INSERT) at percona-server/storage/tokudb/PerconaFT/ft/ft-ops.cc:2442
      #3 0x00000000016d6c9a in db_put (db=0x7fa79d29cfc0, txn=0x7fa79d295000, key=0x7fa8426506b0, val=0x7fa8426506d0, flags=0, do_log=true) at percona-server/storage/tokudb/PerconaFT/src/ydb_write.cc:221
      #4 0x00000000016d6fe3 in toku_db_put (db=0x7fa79d29cfc0, txn=0x7fa79d295000, key=0x7fa8426506b0, val=0x7fa8426506d0, flags=0, holds_mo_lock=false) at percona-server/storage/tokudb/PerconaFT/src/ydb_write.cc:248
      #5 0x00000000016dbbdc in autotxn_db_put (db=0x7fa79d29cfc0, txn=0x7fa79d295000, key=0x7fa8426506b0, data=0x7fa8426506d0, flags=0) at percona-server/storage/tokudb/PerconaFT/src/ydb_write.cc:1078
      #6 0x000000000164fa94 in ha_tokudb::insert_row_to_main_dictionary (this=0x7fa79d258810, record=0x7fa79d24d010 "\375\001", pk_key=0x7fa8426506b0, pk_val=0x7fa8426506d0, txn=0x7fa79d295000) at percona-server/storage/tokudb/ha_tokudb.cc:3882
      #7 0x0000000001650d6e in ha_tokudb::write_row (this=0x7fa79d258810, record=0x7fa79d24d010 "\375\001") at percona-server/storage/tokudb/ha_tokudb.cc:4093
      #8 0x00000000006e8a57 in handler::ha_write_row (this=0x7fa79d258810, buf=0x7fa79d24d010 "\375\001") at percona-server/sql/handler.cc:7921
      #9 0x0000000000af2061 in copy_data_between_tables (from=0x7fa79d264000, to=0x7fa79d2df000, create=..., ignore=false, order_num=0, order=0x0, copied=0x7fa8426527d8, deleted=0x7fa8426527d0, keys_onoff=Alter_info::LEAVE_AS_IS, alter_ctx=0x7fa842651d00) at percona-server/sql/sql_table.cc:9652
      #10 0x0000000000aef105 in mysql_alter_table (thd=0x7fa83744b700, new_db=0x7fa79d224668 "test", new_name=0x0, create_info=0x7fa842652bc0, table_list=0x7fa79d224108, alter_info=0x7fa842652b00, order_num=0, order=0x0, ignore=false) at percona-server/sql/sql_table.cc:9180
      #11 0x0000000000d625c3 in Sql_cmd_alter_table::execute (this=0x7fa79d224680, thd=0x7fa83744b700) at percona-server/sql/sql_alter.cc:335
      #12 0x0000000000a0675c in mysql_execute_command (thd=0x7fa83744b700) at percona-server/sql/sql_parse.cc:5588
      #13 0x0000000000a0dd37 in mysql_parse (thd=0x7fa83744b700, rawbuf=0x7fa79d224010 "alter table t1 comment='test table'", length=35, parser_state=0x7fa8426544c0) at percona-server/sql/sql_parse.cc:7080
      #14 0x00000000009ef398 in dispatch_command (command=COM_QUERY, thd=0x7fa83744b700, packet=0x7fa837455081 "alter table t1 comment='test table'", packet_length=35) at percona-server/sql/sql_parse.cc:1487
      #15 0x00000000009ecda7 in do_command (thd=0x7fa83744b700) at percona-server/sql/sql_parse.cc:1062
      #16 0x00000000009814d8 in do_handle_one_connection (thd_arg=0x7fa83744b700) at percona-server/sql/sql_connect.cc:1590
      #17 0x0000000000980e9b in handle_one_connection (arg=0x7fa83744b700) at percona-server/sql/sql_connect.cc:1494
      #18 0x000000000103d8fd in pfs_spawn_thread (arg=0x7fa83c3ee260) at percona-server/storage/perfschema/pfs.cc:1861
      #19 0x00007fa842249aa1 in start_thread () from /lib64/libpthread.so.0
      #20 0x00007fa840fb293d in clone () from /lib64/libc.so.6
      ```

        Smart Checklist

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  george.lorch George Lorch
                  Reporter:
                  fungo Fungo Wang
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  2 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:

                    Time Tracking

                    Estimated:
                    Original Estimate - Not Specified
                    Not Specified
                    Remaining:
                    Remaining Estimate - 0 minutes
                    0m
                    Logged:
                    Time Spent - 5 hours, 20 minutes
                    5h 20m