List:Commits« Previous MessageNext Message »
From:Jon Olav Hauglid Date:December 19 2011 1:23pm
Subject:bzr push into mysql-trunk-wl5534 branch (jon.hauglid:3453 to 3454) WL#5534
View as plain text  
 3454 Jon Olav Hauglid	2011-12-19
      WL#5534 Online ALTER, Phase 1.
      
      Patch #68:
      Don't downgrade to MDL_SHARED_UPGRADABLE under LOCK TABLES
      mode as this will allow other connections to read/write 
      the table thus breaking LOCK TABLES. It would also trigger
      an assert in MDL_ticket::downgrade_lock().

    modified:
      sql/sql_table.cc
 3453 Jon Olav Hauglid	2011-12-16 [merge]
      Merge from mysql-trunk to mysql-trunk-wl5534
      Text conflict in sql/ha_partition.cc

    added:
      sql/sql_executor.cc
      sql/sql_executor.h
      sql/sql_join_buffer.h
      sql/sql_optimizer.cc
      sql/sql_optimizer.h
      sql/sql_planner.cc
      sql/sql_planner.h
      sql/sql_resolver.cc
      sql/sql_resolver.h
      sql/sql_tmp_table.cc
      sql/sql_tmp_table.h
    renamed:
      sql/sql_join_cache.cc => sql/sql_join_buffer.cc
    modified:
      cmake/install_macros.cmake
      mysql-test/include/range.inc
      mysql-test/include/select.inc
      mysql-test/include/subquery_sj.inc
      mysql-test/r/func_in_all.result
      mysql-test/r/innodb_explain_non_select_all.result
      mysql-test/r/innodb_explain_non_select_none.result
      mysql-test/r/innodb_mrr_all.result
      mysql-test/r/innodb_mrr_cost_all.result
      mysql-test/r/myisam_mrr_all.result
      mysql-test/r/myisam_mrr_cost_all.result
      mysql-test/r/mysqld--help-win.result
      mysql-test/r/partition_hash.result
      mysql-test/r/partition_mgm.result
      mysql-test/r/range_all.result
      mysql-test/r/range_icp.result
      mysql-test/r/range_icp_mrr.result
      mysql-test/r/range_mrr.result
      mysql-test/r/range_mrr_cost.result
      mysql-test/r/range_none.result
      mysql-test/r/select_all.result
      mysql-test/r/select_icp_mrr.result
      mysql-test/r/select_icp_mrr_bka.result
      mysql-test/r/select_icp_mrr_bka_nixbnl.result
      mysql-test/r/select_none.result
      mysql-test/r/select_none_bka.result
      mysql-test/r/select_none_bka_nixbnl.result
      mysql-test/r/sp.result
      mysql-test/r/subquery_all.result
      mysql-test/r/subquery_all_bka.result
      mysql-test/r/subquery_all_bka_nixbnl.result
      mysql-test/r/subquery_sj_all.result
      mysql-test/r/subquery_sj_all_bka.result
      mysql-test/r/subquery_sj_all_bka_nixbnl.result
      mysql-test/r/subquery_sj_all_bkaunique.result
      mysql-test/r/subquery_sj_dupsweed.result
      mysql-test/r/subquery_sj_dupsweed_bka.result
      mysql-test/r/subquery_sj_dupsweed_bka_nixbnl.result
      mysql-test/r/subquery_sj_dupsweed_bkaunique.result
      mysql-test/r/subquery_sj_firstmatch.result
      mysql-test/r/subquery_sj_firstmatch_bka.result
      mysql-test/r/subquery_sj_firstmatch_bka_nixbnl.result
      mysql-test/r/subquery_sj_firstmatch_bkaunique.result
      mysql-test/r/subquery_sj_loosescan.result
      mysql-test/r/subquery_sj_loosescan_bka.result
      mysql-test/r/subquery_sj_loosescan_bka_nixbnl.result
      mysql-test/r/subquery_sj_loosescan_bkaunique.result
      mysql-test/r/subquery_sj_mat.result
      mysql-test/r/subquery_sj_mat_bka.result
      mysql-test/r/subquery_sj_mat_bka_nixbnl.result
      mysql-test/r/subquery_sj_mat_bkaunique.result
      mysql-test/r/subquery_sj_mat_nosj.result
      mysql-test/r/subquery_sj_none.result
      mysql-test/r/subquery_sj_none_bka.result
      mysql-test/r/subquery_sj_none_bka_nixbnl.result
      mysql-test/r/subquery_sj_none_bkaunique.result
      mysql-test/r/update.result
      mysql-test/suite/binlog/t/binlog_index.test
      mysql-test/suite/rpl/r/rpl_row_img_sanity.result
      mysql-test/suite/rpl/t/rpl_binlog_errors.test
      mysql-test/suite/rpl/t/rpl_empty_master_host.test
      mysql-test/suite/rpl/t/rpl_row_img_sanity.test
      mysql-test/suite/rpl/t/rpl_server_id_ignore.test
      mysql-test/t/partition_hash.test
      mysql-test/t/partition_mgm.test
      mysql-test/t/sp.test
      mysql-test/t/update.test
      scripts/mysql_system_tables.sql
      sql/CMakeLists.txt
      sql/field.cc
      sql/ha_partition.h
      sql/item.cc
      sql/item_cmpfunc.cc
      sql/item_strfunc.cc
      sql/item_subselect.cc
      sql/item_sum.cc
      sql/opt_explain.cc
      sql/opt_explain.h
      sql/opt_range.cc
      sql/opt_range.h
      sql/records.cc
      sql/records.h
      sql/rpl_utility.cc
      sql/sp_rcontext.cc
      sql/sql_base.cc
      sql/sql_class.cc
      sql/sql_class.h
      sql/sql_cursor.cc
      sql/sql_delete.cc
      sql/sql_derived.cc
      sql/sql_insert.cc
      sql/sql_lex.cc
      sql/sql_lex.h
      sql/sql_partition.cc
      sql/sql_select.cc
      sql/sql_select.h
      sql/sql_show.cc
      sql/sql_table.cc
      sql/sql_test.cc
      sql/sql_union.cc
      sql/sql_update.cc
      sql/sql_yacc.yy
      storage/innobase/dict/dict0dict.cc
      storage/innobase/dict/dict0mem.cc
      storage/innobase/dict/dict0stats.cc
      storage/innobase/fts/fts0fts.cc
      storage/innobase/include/fts0fts.h
      storage/innobase/include/sync0sync.h
      storage/innobase/row/row0mysql.cc
      sql/sql_join_buffer.cc
=== modified file 'sql/sql_table.cc'
--- a/sql/sql_table.cc	2011-12-16 16:40:15 +0000
+++ b/sql/sql_table.cc	2011-12-19 13:19:36 +0000
@@ -5823,6 +5823,7 @@ static bool mysql_inplace_alter_table(TH
     - The storage engine needs writes blocked for the whole duration
     - Or the storage engine needs writes blocked for just the prepare phase
     - Or this is requested by the user
+    Note that under LOCK TABLES, we will already have SHARED_NO_READ_WRITE.
   */
   if ((inplace_supported == HA_ALTER_INPLACE_SHARED_LOCK ||
        inplace_supported == HA_ALTER_INPLACE_NO_LOCK_AFTER_PREPARE ||
@@ -5852,10 +5853,15 @@ static bool mysql_inplace_alter_table(TH
     - The storage engine needed the prepare phase to have SNW lock.
     - And the user requested both concurrent reads and writes using
       LOCK_DEFAULT or LOCK_NONE (i.e. a weaker lock than SNW).
+    *Unless* we are in LOCK TABLES mode. In this case, downgrading from SNRW
+    to SU will break LOCK TABLES since it will allow reads/writes from other
+    connections.
   */
-  if (inplace_supported == HA_ALTER_INPLACE_NO_LOCK_AFTER_PREPARE &&
+  if ((inplace_supported == HA_ALTER_INPLACE_NO_LOCK_AFTER_PREPARE &&
       (alter_info->requested_lock == Alter_info::ALTER_TABLE_LOCK_DEFAULT ||
-       alter_info->requested_lock == Alter_info::ALTER_TABLE_LOCK_NONE))
+       alter_info->requested_lock == Alter_info::ALTER_TABLE_LOCK_NONE)) &&
+      thd->locked_tables_mode != LTM_LOCK_TABLES &&
+      thd->locked_tables_mode != LTM_PRELOCKED_UNDER_LOCK_TABLES)
     table->mdl_ticket->downgrade_lock(MDL_SHARED_UPGRADABLE);
 
   DEBUG_SYNC(thd, "alter_table_inplace_after_lock_downgrade");
@@ -7199,7 +7205,10 @@ bool mysql_alter_table(THD *thd,char *ne
         wait_while_table_is_used(thd, table, HA_EXTRA_FORCE_REOPEN))
       goto err_new_table_cleanup;
 
-    // Otherwise upgrade to SHARED_NO_WRITE
+    /*
+      Otherwise upgrade to SHARED_NO_WRITE.
+      Note that under LOCK TABLES, we will already have SHARED_NO_READ_WRITE.
+    */
     if (alter_info->requested_lock != Alter_info::ALTER_TABLE_LOCK_EXCLUSIVE &&
         thd->mdl_context.upgrade_shared_lock(mdl_ticket, MDL_SHARED_NO_WRITE,
                                              thd->variables.lock_wait_timeout))

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-trunk-wl5534 branch (jon.hauglid:3453 to 3454) WL#5534Jon Olav Hauglid19 Dec