List:Commits« Previous MessageNext Message »
From:Jon Olav Hauglid Date:October 3 2011 2:04pm
Subject:bzr push into mysql-trunk-wl5534 branch (jon.hauglid:3399 to 3400) WL#5534
View as plain text  
 3400 Jon Olav Hauglid	2011-10-03
      WL#5534 Online ALTER, Phase 1.
        
      Patch #28:
      - Allow duplicate key error reporting using KEY rather
        than key number.

    modified:
      sql/handler.cc
      sql/handler.h
      sql/key.cc
      sql/key.h
 3399 Jon Olav Hauglid	2011-09-28 [merge]
      Merge from mysql-trunk to mysql-trunk-wl5534
      Text conflict in sql/handler.h
      Text conflict in sql/share/errmsg-utf8.txt

    removed:
      scripts/make_binary_distribution.sh
      scripts/make_win_bin_dist
      support-files/config.huge.ini.sh
      support-files/config.medium.ini.sh
      support-files/config.small.ini.sh
      support-files/ndb-config-2-node.ini.sh
    added:
      mysql-test/r/auth_rpl.result
      mysql-test/suite/opt_trace/include/filesort_pq.inc
      mysql-test/suite/opt_trace/r/filesort_pq.result
      mysql-test/suite/opt_trace/t/filesort_pq.test
      mysql-test/suite/stress/t/wrapper.test
      mysql-test/t/auth_rpl-master.opt
      mysql-test/t/auth_rpl-slave.opt
      mysql-test/t/auth_rpl.test
    modified:
      client/mysql_plugin.c
      client/mysqltest.cc
      cmake/mysql_version.cmake
      cmake/plugin.cmake
      extra/perror.c
      include/heap.h
      include/mysql/plugin.h
      include/mysql/plugin_audit.h.pp
      include/mysql/plugin_auth.h.pp
      include/mysql/plugin_ftparser.h.pp
      include/mysql/psi/mysql_socket.h
      libmysql/authentication_win/common.cc
      libmysql/authentication_win/common.h
      libmysql/authentication_win/handshake_client.cc
      libmysql/authentication_win/log_client.cc
      libmysql/client_settings.h
      mysql-test/collections/default.experimental
      mysql-test/include/icp_tests.inc
      mysql-test/include/mtr_check.sql
      mysql-test/include/order_by.inc
      mysql-test/include/subquery_sj.inc
      mysql-test/mysql-stress-test.pl
      mysql-test/mysql-test-run.pl
      mysql-test/r/ctype_errors.result
      mysql-test/r/ctype_utf16.result
      mysql-test/r/ctype_utf32_uca.result
      mysql-test/r/derived.result
      mysql-test/r/func_str.result
      mysql-test/r/group_by.result
      mysql-test/r/heap.result
      mysql-test/r/innodb_icp.result
      mysql-test/r/innodb_icp_all.result
      mysql-test/r/innodb_icp_none.result
      mysql-test/r/innodb_mrr_all.result
      mysql-test/r/innodb_mrr_cost_all.result
      mysql-test/r/myisam_icp.result
      mysql-test/r/myisam_icp_all.result
      mysql-test/r/myisam_icp_none.result
      mysql-test/r/myisampack.result
      mysql-test/r/mysqltest.result
      mysql-test/r/order_by_all.result
      mysql-test/r/order_by_icp_mrr.result
      mysql-test/r/order_by_none.result
      mysql-test/r/plugin_auth.result
      mysql-test/r/query_cache.result
      mysql-test/r/range_all.result
      mysql-test/r/show_check.result
      mysql-test/r/sp-error.result
      mysql-test/r/sp.result
      mysql-test/r/subquery_all.result
      mysql-test/r/subquery_all_bka.result
      mysql-test/r/subquery_sj_all.result
      mysql-test/r/subquery_sj_all_bka.result
      mysql-test/r/subquery_sj_all_bka_nobnl.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_nobnl.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_nobnl.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_nobnl.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_nobnl.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_nobnl.result
      mysql-test/r/subquery_sj_none_bkaunique.result
      mysql-test/r/type_float.result
      mysql-test/r/union.result
      mysql-test/r/view_grant.result
      mysql-test/suite/federated/federated_plugin-master.opt
      mysql-test/suite/federated/federated_plugin.result
      mysql-test/suite/federated/federated_plugin.test
      mysql-test/suite/innodb/r/innodb-index.result
      mysql-test/suite/innodb/t/innodb-index.test
      mysql-test/suite/opt_trace/include/general.inc
      mysql-test/suite/opt_trace/include/general2.inc
      mysql-test/suite/opt_trace/include/range.inc
      mysql-test/suite/opt_trace/r/bugs_no_prot_all.result
      mysql-test/suite/opt_trace/r/bugs_no_prot_none.result
      mysql-test/suite/opt_trace/r/bugs_ps_prot_all.result
      mysql-test/suite/opt_trace/r/bugs_ps_prot_none.result
      mysql-test/suite/opt_trace/r/charset.result
      mysql-test/suite/opt_trace/r/general2_no_prot.result
      mysql-test/suite/opt_trace/r/general2_ps_prot.result
      mysql-test/suite/opt_trace/r/general_no_prot_all.result
      mysql-test/suite/opt_trace/r/general_no_prot_none.result
      mysql-test/suite/opt_trace/r/general_ps_prot_all.result
      mysql-test/suite/opt_trace/r/general_ps_prot_none.result
      mysql-test/suite/opt_trace/r/range_no_prot.result
      mysql-test/suite/opt_trace/r/range_ps_prot.result
      mysql-test/suite/opt_trace/r/security_no_prot.result
      mysql-test/suite/opt_trace/r/security_ps_prot.result
      mysql-test/suite/opt_trace/r/subquery_no_prot.result
      mysql-test/suite/opt_trace/r/subquery_ps_prot.result
      mysql-test/suite/perfschema/r/pfs_upgrade.result
      mysql-test/suite/perfschema/t/socket_instances_func.test
      mysql-test/suite/perfschema/t/socket_instances_func_win.test
      mysql-test/suite/perfschema/t/socket_summary_by_instance_func.test
      mysql-test/suite/perfschema/t/socket_summary_by_instance_func_win.test
      mysql-test/suite/rpl/r/rpl_parallel_start_stop.result
      mysql-test/suite/rpl/r/rpl_row_ignorable_event.result
      mysql-test/suite/rpl/r/rpl_slave_load_remove_tmpfile.result
      mysql-test/suite/rpl/t/rpl_row_ignorable_event.test
      mysql-test/suite/rpl/t/rpl_slave_load_remove_tmpfile.test
      mysql-test/t/ctype_errors.test
      mysql-test/t/ctype_utf32_uca.test
      mysql-test/t/derived.test
      mysql-test/t/func_str.test
      mysql-test/t/group_by.test
      mysql-test/t/heap.test
      mysql-test/t/myisampack.test
      mysql-test/t/mysql_plugin.test
      mysql-test/t/mysqld--defaults-file.test
      mysql-test/t/mysqltest.test
      mysql-test/t/plugin_auth.test
      mysql-test/t/query_cache.test
      mysql-test/t/show_check.test
      mysql-test/t/sp-error.test
      mysql-test/t/sp.test
      mysql-test/t/type_float.test
      mysql-test/t/union.test
      mysql-test/t/view_grant.test
      mysql-test/valgrind.supp
      plugin/audit_null/audit_null.c
      plugin/auth/auth_socket.c
      plugin/auth/dialog.c
      plugin/auth/qa_auth_interface.c
      plugin/auth/qa_auth_server.c
      plugin/auth/test_plugin.c
      plugin/daemon_example/daemon_example.cc
      plugin/fulltext/plugin_example.c
      plugin/semisync/semisync_master_plugin.cc
      plugin/semisync/semisync_slave_plugin.cc
      scripts/CMakeLists.txt
      scripts/mysql_system_tables.sql
      sql/binlog.cc
      sql/client_settings.h
      sql/filesort.cc
      sql/ha_ndbcluster.cc
      sql/ha_partition.cc
      sql/handler.cc
      sql/handler.h
      sql/item_buff.cc
      sql/item_cmpfunc.cc
      sql/item_create.cc
      sql/item_func.cc
      sql/item_strfunc.cc
      sql/item_strfunc.h
      sql/opt_explain.cc
      sql/opt_range.cc
      sql/opt_trace.cc
      sql/opt_trace.h
      sql/opt_trace2server.cc
      sql/rpl_rli_pdb.cc
      sql/rpl_slave.cc
      sql/share/errmsg-utf8.txt
      sql/sql_acl.cc
      sql/sql_base.cc
      sql/sql_cache.cc
      sql/sql_class.h
      sql/sql_error.cc
      sql/sql_lex.cc
      sql/sql_lex.h
      sql/sql_parse.cc
      sql/sql_plugin.cc
      sql/sql_prepare.cc
      sql/sql_select.cc
      sql/sql_select.h
      sql/sql_test.cc
      sql/sql_test.h
      sql/sql_union.cc
      sql/sql_update.cc
      sql/sql_yacc.yy
      sql/table.cc
      sql/table.h
      storage/archive/ha_archive.cc
      storage/blackhole/ha_blackhole.cc
      storage/csv/ha_tina.cc
      storage/example/ha_example.cc
      storage/federated/ha_federated.cc
      storage/heap/ha_heap.cc
      storage/heap/hp_create.c
      storage/heap/hp_info.c
      storage/innobase/btr/btr0pcur.c
      storage/innobase/handler/ha_innodb.cc
      storage/innobase/handler/i_s.cc
      storage/innobase/ibuf/ibuf0ibuf.c
      storage/innobase/include/btr0pcur.h
      storage/innobase/include/btr0pcur.ic
      storage/innobase/include/mtr0mtr.h
      storage/innobase/include/srv0mon.h
      storage/innobase/include/ut0mem.h
      storage/innobase/include/ut0mem.ic
      storage/innobase/log/log0log.c
      storage/innobase/mtr/mtr0mtr.c
      storage/innobase/os/os0file.c
      storage/innobase/read/read0read.c
      storage/innobase/row/row0purge.c
      storage/innobase/row/row0sel.c
      storage/innobase/sync/sync0sync.c
      storage/innobase/trx/trx0purge.c
      storage/innobase/ut/ut0mem.c
      storage/myisam/ft_boolean_search.c
      storage/myisam/ft_nlq_search.c
      storage/myisam/ha_myisam.cc
      storage/myisam/mi_check.c
      storage/myisam/mi_write.c
      storage/myisammrg/ha_myisammrg.cc
      storage/perfschema/ha_perfschema.cc
      storage/perfschema/pfs.cc
      storage/perfschema/pfs_instr.cc
      storage/perfschema/pfs_instr.h
      strings/dtoa.c
      support-files/CMakeLists.txt
      support-files/mysql.spec.sh
      tests/mysql_client_test.c
      unittest/gunit/opt_trace-t.cc
=== modified file 'sql/handler.cc'
--- a/sql/handler.cc	2011-09-28 10:01:37 +0000
+++ b/sql/handler.cc	2011-10-03 14:04:05 +0000
@@ -2924,7 +2924,7 @@ void handler::print_keydup_error(uint ke
   else
   {
     /* Table is opened and defined at this point */
-    key_unpack(&str,table,(uint) key_nr);
+    key_unpack(&str,table, &table->key_info[key_nr]);
     uint max_length=MYSQL_ERRMSG_SIZE-(uint) strlen(msg);
     if (str.length() >= max_length)
     {
@@ -2937,6 +2937,35 @@ void handler::print_keydup_error(uint ke
 }
 
 
+void handler::print_keydup_error(KEY *key)
+{
+  /* Write the duplicated key in the error message */
+  char key_buff[MAX_KEY_LENGTH];
+  String str(key_buff,sizeof(key_buff),system_charset_info);
+  const char *msg= ER(ER_DUP_ENTRY_WITH_KEY_NAME);
+
+  if (key == NULL)
+  {
+    /* Key is unknown */
+    str.copy("", 0, system_charset_info);
+    my_printf_error(ER_DUP_ENTRY, msg, MYF(0), str.c_ptr(), "*UNKNOWN*");
+  }
+  else
+  {
+    /* Table is opened and defined at this point */
+    key_unpack(&str,table, key);
+    uint max_length=MYSQL_ERRMSG_SIZE-(uint) strlen(msg);
+    if (str.length() >= max_length)
+    {
+      str.length(max_length-4);
+      str.append(STRING_WITH_LEN("..."));
+    }
+    my_printf_error(ER_DUP_ENTRY, msg,
+		    MYF(0), str.c_ptr_safe(), key->name);
+  }
+}
+
+
 /**
   Print error that we got from handler function.
 
@@ -2992,7 +3021,7 @@ void handler::print_error(int error, myf
       char key[MAX_KEY_LENGTH];
       String str(key,sizeof(key),system_charset_info);
       /* Table is opened and defined at this point */
-      key_unpack(&str,table,(uint) key_nr);
+      key_unpack(&str,table, &table->key_info[key_nr]);
       max_length= (MYSQL_ERRMSG_SIZE-
                    (uint) strlen(ER(ER_FOREIGN_DUPLICATE_KEY)));
       if (str.length() >= max_length)

=== modified file 'sql/handler.h'
--- a/sql/handler.h	2011-09-28 10:01:37 +0000
+++ b/sql/handler.h	2011-10-03 14:04:05 +0000
@@ -1660,6 +1660,7 @@ public:
   void adjust_next_insert_id_after_explicit_value(ulonglong nr);
   int update_auto_increment();
   void print_keydup_error(uint key_nr, const char *msg);
+  void print_keydup_error(KEY *key);
   virtual void print_error(int error, myf errflag);
   virtual bool get_error_message(int error, String *buf);
   uint get_dup_key(int error);

=== modified file 'sql/key.cc'
--- a/sql/key.cc	2011-06-30 15:50:45 +0000
+++ b/sql/key.cc	2011-10-03 14:04:05 +0000
@@ -346,10 +346,10 @@ bool key_cmp_if_same(TABLE *table,const
   @param
      table	Table to use
   @param
-     idx	Key number
+     key	Key
 */
 
-void key_unpack(String *to,TABLE *table,uint idx)
+void key_unpack(String *to, TABLE *table, KEY *key)
 {
   KEY_PART_INFO *key_part,*key_part_end;
   Field *field;
@@ -358,8 +358,7 @@ void key_unpack(String *to,TABLE *table,
   DBUG_ENTER("key_unpack");
 
   to->length(0);
-  for (key_part=table->key_info[idx].key_part,key_part_end=key_part+
-	 table->key_info[idx].key_parts ;
+  for (key_part=key->key_part,key_part_end=key_part+key->key_parts ;
        key_part < key_part_end;
        key_part++)
   {

=== modified file 'sql/key.h'
--- a/sql/key.h	2011-07-21 12:54:54 +0000
+++ b/sql/key.h	2011-10-03 14:04:05 +0000
@@ -31,7 +31,7 @@ void key_copy(uchar *to_key, uchar *from
 void key_restore(uchar *to_record, uchar *from_key, KEY *key_info,
                  uint key_length);
 bool key_cmp_if_same(TABLE *form,const uchar *key,uint index,uint key_length);
-void key_unpack(String *to,TABLE *form,uint index);
+void key_unpack(String *to, TABLE *table, KEY *key);
 bool is_key_used(TABLE *table, uint idx, const MY_BITMAP *fields);
 int key_cmp(KEY_PART_INFO *key_part, const uchar *key, uint key_length);
 extern "C" int key_rec_cmp(void *key_info, uchar *a, uchar *b);

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-trunk-wl5534 branch (jon.hauglid:3399 to 3400) WL#5534Jon Olav Hauglid5 Oct