2887 Chuck Bell 2009-11-04 [merge]
Local merge before push of BUG#47804.
removed:
mysql-test/include/default_client.cnf
mysql-test/r/mysql_locale_posix.result
mysql-test/t/mysql_locale_posix.test
added:
mysql-test/include/default_client.cnf
mysql-test/r/lock_sync.result
mysql-test/r/mysql_locale_posix.result
mysql-test/suite/optimizer_unfixed_bugs/r/bug36981.result
mysql-test/suite/optimizer_unfixed_bugs/r/bug40992.result
mysql-test/suite/optimizer_unfixed_bugs/r/bug41029.result
mysql-test/suite/optimizer_unfixed_bugs/r/bug41996.result
mysql-test/suite/optimizer_unfixed_bugs/r/bug42991.result
mysql-test/suite/optimizer_unfixed_bugs/r/bug43101.result
mysql-test/suite/optimizer_unfixed_bugs/r/bug43249.result
mysql-test/suite/optimizer_unfixed_bugs/r/bug43360.result
mysql-test/suite/optimizer_unfixed_bugs/r/bug43617.result
mysql-test/suite/optimizer_unfixed_bugs/r/bug43618.result
mysql-test/suite/optimizer_unfixed_bugs/r/bug45221.result
mysql-test/suite/optimizer_unfixed_bugs/t/bug36981.test
mysql-test/suite/optimizer_unfixed_bugs/t/bug40992.test
mysql-test/suite/optimizer_unfixed_bugs/t/bug41029-master.opt
mysql-test/suite/optimizer_unfixed_bugs/t/bug41029.test
mysql-test/suite/optimizer_unfixed_bugs/t/bug41996.test
mysql-test/suite/optimizer_unfixed_bugs/t/bug42991.test
mysql-test/suite/optimizer_unfixed_bugs/t/bug43101.test
mysql-test/suite/optimizer_unfixed_bugs/t/bug43249.test
mysql-test/suite/optimizer_unfixed_bugs/t/bug43360.test
mysql-test/suite/optimizer_unfixed_bugs/t/bug43617.test
mysql-test/suite/optimizer_unfixed_bugs/t/bug43618.test
mysql-test/suite/optimizer_unfixed_bugs/t/bug45221.test
mysql-test/suite/rpl/r/rpl_row_merge_engine.result
mysql-test/suite/rpl/t/rpl_row_merge_engine.test
mysql-test/t/lock_sync.test
mysql-test/t/mysql_locale_posix.test
plugin/semisync/CMakeLists.txt
renamed:
mysql-test/r/merge-sync.result => mysql-test/r/merge_sync.result
mysql-test/t/merge-sync.test => mysql-test/t/merge_sync.test
modified:
BUILD/compile-pentium-gcov
CMakeLists.txt
config/ac-macros/dtrace.m4
mysql-test/collections/default.experimental
mysql-test/include/have_semisync_plugin.inc
mysql-test/lib/mtr_cases.pm
mysql-test/mysql-test-run.pl
mysql-test/r/delayed.result
mysql-test/r/explain.result
mysql-test/r/fulltext.result
mysql-test/r/func_group.result
mysql-test/r/func_time.result
mysql-test/r/having.result
mysql-test/r/insert.result
mysql-test/r/locale.result
mysql-test/r/mdl_sync.result
mysql-test/r/merge.result
mysql-test/r/mysql_upgrade.result
mysql-test/r/ps_ddl.result
mysql-test/r/sp.result
mysql-test/r/subselect4.result
mysql-test/r/subselect_mat.result
mysql-test/r/temp_table.result
mysql-test/r/trigger.result
mysql-test/suite/ndb/t/ndb_read_multi_range.test
mysql-test/suite/rpl/r/rpl_get_master_version_and_clock.result
mysql-test/suite/rpl/r/rpl_heartbeat_basic.result
mysql-test/suite/rpl/r/rpl_semi_sync.result
mysql-test/suite/rpl/t/disabled.def
mysql-test/suite/rpl/t/rpl_get_master_version_and_clock.test
mysql-test/suite/rpl/t/rpl_heartbeat_basic.test
mysql-test/suite/rpl/t/rpl_semi_sync.test
mysql-test/t/delayed.test
mysql-test/t/disabled.def
mysql-test/t/explain.test
mysql-test/t/fulltext.test
mysql-test/t/func_group.test
mysql-test/t/func_time.test
mysql-test/t/having.test
mysql-test/t/insert.test
mysql-test/t/locale.test
mysql-test/t/mdl_sync.test
mysql-test/t/merge.test
mysql-test/t/mysql_upgrade.test
mysql-test/t/ps_ddl.test
mysql-test/t/sp.test
mysql-test/t/subselect4.test
mysql-test/t/subselect_mat.test
mysql-test/t/temp_table.test
mysql-test/t/trigger.test
mysys/thr_lock.c
plugin/semisync/Makefile.am
plugin/semisync/semisync_master.cc
plugin/semisync/semisync_master.h
plugin/semisync/semisync_master_plugin.cc
plugin/semisync/semisync_slave.cc
plugin/semisync/semisync_slave.h
scripts/mysql_system_tables_fix.sql
sql-common/client.c
sql/handler.cc
sql/item_sum.cc
sql/item_sum.h
sql/log_event.cc
sql/mdl.cc
sql/opt_sum.cc
sql/sql_class.h
sql/sql_db.cc
sql/sql_insert.cc
sql/sql_locale.cc
sql/sql_parse.cc
sql/sql_select.cc
sql/sql_table.cc
sql/sql_view.cc
sql/sql_yacc.yy
storage/innobase/handler/ha_innodb.cc
storage/innobase/handler/ha_innodb.h
storage/myisammrg/ha_myisammrg.cc
unittest/backup/Makefile.am
mysql-test/r/merge_sync.result
mysql-test/t/merge_sync.test
=== modified file 'mysql-test/suite/backup/r/backup_errors_debug_2.result'
--- a/mysql-test/suite/backup/r/backup_errors_debug_2.result 2009-09-24 14:40:08 +0000
+++ b/mysql-test/suite/backup/r/backup_errors_debug_2.result 2009-11-04 14:18:21 +0000
@@ -272,6 +272,123 @@ backup_id
# Done.
#
#
+# Add sub tests for failures in the add table name for trigger code.
+#
+#
+# Test case 28a - testing error ER_BACKUP_CATALOG_ADD_TRIGGER_1
+#
+# Set debug SESSION variable for ER_BACKUP_CATALOG_ADD_TRIGGER_1
+#
+SET SESSION debug="+d,ER_BACKUP_CATALOG_ADD_TRIGGER_1";
+#
+# Execute backup
+#
+BACKUP DATABASE backup_test TO 'backup_test_err.bak';
+ERROR HY000: Failed to add trigger `backup_test`.`trg` to the catalog
+#
+# Test case for error ER_BACKUP_CATALOG_ADD_TRIGGER_1 PASSED.
+#
+#
+# Show warning/error from progress and history log
+# if they exist.
+#
+SELECT * FROM mysql.backup_progress WHERE error_num <> 0;
+backup_id object error_num notes
+# #### Failed to add trigger `backup_test`.`trg` to the catalog
+PURGE BACKUP LOGS;
+#
+# Turn off debug SESSION.
+#
+SET SESSION debug="-d";
+#
+# Now demonstrate that the command will work without the
+# debug session tag.
+#
+# Running backup - should not fail.
+#
+BACKUP DATABASE backup_test TO 'backup_test_err.bak';
+backup_id
+#
+#
+# Done.
+#
+#
+# Test case 28b - testing error ER_BACKUP_CATALOG_ADD_TRIGGER_2
+#
+# Set debug SESSION variable for ER_BACKUP_CATALOG_ADD_TRIGGER_2
+#
+SET SESSION debug="+d,ER_BACKUP_CATALOG_ADD_TRIGGER_2";
+#
+# Execute backup
+#
+BACKUP DATABASE backup_test TO 'backup_test_err.bak';
+ERROR HY000: Failed to add trigger `backup_test`.`trg` to the catalog
+#
+# Test case for error ER_BACKUP_CATALOG_ADD_TRIGGER_2 PASSED.
+#
+#
+# Show warning/error from progress and history log
+# if they exist.
+#
+SELECT * FROM mysql.backup_progress WHERE error_num <> 0;
+backup_id object error_num notes
+# #### Failed to add trigger `backup_test`.`trg` to the catalog
+PURGE BACKUP LOGS;
+#
+# Turn off debug SESSION.
+#
+SET SESSION debug="-d";
+#
+# Now demonstrate that the command will work without the
+# debug session tag.
+#
+# Running backup - should not fail.
+#
+BACKUP DATABASE backup_test TO 'backup_test_err.bak';
+backup_id
+#
+#
+# Done.
+#
+#
+# Test case 28c - testing error ER_BACKUP_CATALOG_ADD_TRIGGER_3
+#
+# Set debug SESSION variable for ER_BACKUP_CATALOG_ADD_TRIGGER_3
+#
+SET SESSION debug="+d,ER_BACKUP_CATALOG_ADD_TRIGGER_3";
+#
+# Execute backup
+#
+BACKUP DATABASE backup_test TO 'backup_test_err.bak';
+ERROR HY000: Failed to add trigger `backup_test`.`trg` to the catalog
+#
+# Test case for error ER_BACKUP_CATALOG_ADD_TRIGGER_3 PASSED.
+#
+#
+# Show warning/error from progress and history log
+# if they exist.
+#
+SELECT * FROM mysql.backup_progress WHERE error_num <> 0;
+backup_id object error_num notes
+# #### Failed to add trigger `backup_test`.`trg` to the catalog
+PURGE BACKUP LOGS;
+#
+# Turn off debug SESSION.
+#
+SET SESSION debug="-d";
+#
+# Now demonstrate that the command will work without the
+# debug session tag.
+#
+# Running backup - should not fail.
+#
+BACKUP DATABASE backup_test TO 'backup_test_err.bak';
+backup_id
+#
+#
+# Done.
+#
+#
# Test case 29 - testing error ER_BACKUP_CATALOG_ADD_TS
#
# Set debug SESSION variable for ER_BACKUP_CATALOG_ADD_TS
=== modified file 'mysql-test/suite/backup/r/backup_logs.result'
--- a/mysql-test/suite/backup/r/backup_logs.result 2009-10-12 09:08:34 +0000
+++ b/mysql-test/suite/backup/r/backup_logs.result 2009-11-04 14:18:21 +0000
@@ -260,7 +260,7 @@ backup_state complete
operation backup
error_num 0
num_objects 11
-total_bytes 4223
+total_bytes 4226
validity_point_time #
start_time #
stop_time #
@@ -334,7 +334,7 @@ backup_state complete
operation restore
error_num 0
num_objects 11
-total_bytes 4223
+total_bytes 4226
validity_point_time #
start_time #
stop_time #
=== modified file 'mysql-test/suite/backup/t/backup_errors_debug_2.test'
--- a/mysql-test/suite/backup/t/backup_errors_debug_2.test 2009-09-24 14:40:08 +0000
+++ b/mysql-test/suite/backup/t/backup_errors_debug_2.test 2009-11-04 14:18:21 +0000
@@ -146,6 +146,31 @@ LET $errname = ER_BACKUP_CATALOG_ADD_TRI
LET $operation = BACKUP;
--source suite/backup/include/test_for_error.inc
+--echo #
+--echo # Add sub tests for failures in the add table name for trigger code.
+--echo #
+
+# Test for error ER_BACKUP_CATALOG_ADD_TRIGGER.
+LET $caseno = 28a;
+LET $errno = $ER_BACKUP_CATALOG_ADD_TRIGGER;
+LET $errname = ER_BACKUP_CATALOG_ADD_TRIGGER_1;
+LET $operation = BACKUP;
+--source suite/backup/include/test_for_error.inc
+
+# Test for error ER_BACKUP_CATALOG_ADD_TRIGGER.
+LET $caseno = 28b;
+LET $errno = $ER_BACKUP_CATALOG_ADD_TRIGGER;
+LET $errname = ER_BACKUP_CATALOG_ADD_TRIGGER_2;
+LET $operation = BACKUP;
+--source suite/backup/include/test_for_error.inc
+
+# Test for error ER_BACKUP_CATALOG_ADD_TRIGGER.
+LET $caseno = 28c;
+LET $errno = $ER_BACKUP_CATALOG_ADD_TRIGGER;
+LET $errname = ER_BACKUP_CATALOG_ADD_TRIGGER_3;
+LET $operation = BACKUP;
+--source suite/backup/include/test_for_error.inc
+
# Test for error ER_BACKUP_CATALOG_ADD_TS.
LET $caseno = 29;
LET $errno = $ER_BACKUP_CATALOG_ADD_TS;
=== modified file 'mysql-test/suite/backup/t/disabled.def'
--- a/mysql-test/suite/backup/t/disabled.def 2009-10-12 09:08:34 +0000
+++ b/mysql-test/suite/backup/t/disabled.def 2009-11-04 14:18:21 +0000
@@ -9,4 +9,6 @@
# Do not use any TAB characters for whitespace.
#
##############################################################################
-
+backup_xpfm_compat_restore_lctn0 : Need to termporarily disable to get new images from corresponding backup tests. Will reenable with a new patch.
+backup_xpfm_compat_restore_lctn1 : Need to termporarily disable to get new images from corresponding backup tests. Will reenable with a new patch.
+backup_xpfm_compat_restore_lctn2 : Need to termporarily disable to get new images from corresponding backup tests. Will reenable with a new patch.
=== modified file 'sql/backup/image_info.cc'
--- a/sql/backup/image_info.cc 2009-10-21 13:32:24 +0000
+++ b/sql/backup/image_info.cc 2009-11-04 14:18:21 +0000
@@ -260,6 +260,39 @@ Image_info::Dbobj* Image_info::add_db_ob
obj->base.pos= pos;
count_object(type);
+ /*
+ If this is a trigger, get the table for the trigger.
+ Do this only for backup.
+ */
+ THD *thd= ::current_thd;
+ if ((type == BSTREAM_IT_TRIGGER) &&
+ (thd->backup_in_progress == SQLCOM_BACKUP))
+ {
+ obs::Obj *tbl_obj= obs::find_table_for_trigger(thd, &db.name(), &name);
+ DBUG_EXECUTE_IF("ER_BACKUP_CATALOG_ADD_TRIGGER_1", return NULL;);
+ if (!tbl_obj)
+ return NULL;
+
+ Table *tbl_found;
+ Db *db_found= find_db(db.name());
+
+ DBUG_EXECUTE_IF("ER_BACKUP_CATALOG_ADD_TRIGGER_2", return NULL;);
+ if (!db_found)
+ return NULL;
+
+ tbl_found= db_found->find_table(*tbl_obj->get_name());
+
+ DBUG_EXECUTE_IF("ER_BACKUP_CATALOG_ADD_TRIGGER_3", return NULL;);
+ if (!tbl_found)
+ return NULL;
+
+ /*
+ Save table's snap and position values.
+ */
+ obj->snap_num= tbl_found->snap_num;
+ obj->pos= tbl_found->base.base.pos;
+ }
+
return obj;
}
@@ -360,7 +393,28 @@ Image_info::get_table(ushort snap_num, u
return tbl;
}
+
+/**
+ Return database stored in the catalogue.
+
+ @param[in] db_name The name of the database.
+
+ @returns Pointer to @c Image_info::Db instance storing information
+ about the database or NULL if the database is not found.
+*/
+Image_info::Db*
+Image_info::find_db(const String &db_name)
+{
+ for (uint n=0; n < db_count(); ++n)
+ {
+ Image_info::Db *db= get_db(n);
+
+ if (db && (db->name() == db_name))
+ return db;
+ }
+ return NULL;
+}
/**
Find object in the catalogue.
=== modified file 'sql/backup/image_info.h'
--- a/sql/backup/image_info.h 2009-10-21 13:32:24 +0000
+++ b/sql/backup/image_info.h 2009-11-04 14:18:21 +0000
@@ -113,6 +113,7 @@ public: // Public interface.
Ts* get_ts(uint pos) const;
Dbobj* get_db_object(uint db_num, ulong pos) const;
Table* get_table(ushort snap_num, ulong pos) const;
+ Db* find_db(const String &db_name);
// Iterators for enumerating the contents of the archive.
@@ -470,6 +471,8 @@ public:
void add_table(Table&);
/// Description of object.
const char* describe(describe_buf&) const;
+ /// Search for table in database table list.
+ Table* find_table(const String &table_name);
private:
@@ -1179,6 +1182,24 @@ const char* Image_info::Db::describe(des
return buf;
}
+/**
+ Search for a table in the database catalog by name.
+
+ @param[in] table_name The name of the table.
+
+ @returns Pointer to @c Image_info::Table instance storing information
+ about the table or NULL if the table is not found.
+*/
+inline
+Image_info::Table* Image_info::Db::find_table(const String &table_name)
+{
+ for (Table *tbl=first_table; tbl ; tbl= tbl->next_table)
+ {
+ if (tbl->name() == table_name)
+ return tbl;
+ }
+ return NULL;
+}
/// Implementation of @c Image_info::Obj virtual method.
=== modified file 'sql/backup/stream_v1.c'
--- a/sql/backup/stream_v1.c 2009-10-21 13:32:24 +0000
+++ b/sql/backup/stream_v1.c 2009-11-04 14:18:21 +0000
@@ -995,12 +995,20 @@ rd_error:
The @c flags field is reserved for future use.
@verbatim
- db_item_info:= type name
+ db_item_info: type name [snapshot_num table_pos]
@endverbatim
+ Per-database objects other than tables are described by db_item_info entries.
+ For most objects such entry contains just object type and name. For triggers,
+ additionally coordinates of the table on which the trigger fires are stored.
+
- @c type (2 bytes): Integer object type.
- @c name (variable length): String object name.
-
+ - @c snapshot_num (1 byte): Integer indicating which snapshot contains
+ table's data (0-based). Only for triggers.
+ - @c table_pos (variable length): Integer position of the table within
+ its snapshot (0-based). Only for triggers.
+
Allowable object type values are given in @ref basic_data_itype.
*/
@@ -1041,6 +1049,15 @@ int bstream_wr_db_catalogue(backup_strea
((struct st_bstream_table_info*)item)->snap_num));
CHECK_WR_RES(bstream_wr_num(s, item->base.pos));
}
+
+ /*
+ If this is a trigger, save its table reference to the stream.
+ */
+ if (item->base.type == BSTREAM_IT_TRIGGER)
+ {
+ CHECK_WR_RES(bstream_wr_byte(s, item->snap_num));
+ CHECK_WR_RES(bstream_wr_num(s, item->pos));
+ }
}
bcat_db_iterator_free(cat, db_info, iter);
@@ -1115,6 +1132,16 @@ int bstream_rd_db_catalogue(backup_strea
else
ti.base.base.pos= pos++;
+ /*
+ If this is a trigger, read the table reference information.
+ */
+ if (ti.base.base.type == BSTREAM_IT_TRIGGER)
+ {
+ /* Read table reference. */
+ CHECK_RD_RES(bstream_rd_byte(s, &ti.base.snap_num));
+ CHECK_RD_RES(bstream_rd_num(s, &ti.base.pos));
+ }
+
if (bcat_add_item(cat, &ti.base.base) != BSTREAM_OK)
return BSTREAM_ERROR;
=== modified file 'sql/backup/stream_v1.h'
--- a/sql/backup/stream_v1.h 2009-10-21 13:32:24 +0000
+++ b/sql/backup/stream_v1.h 2009-11-04 14:18:21 +0000
@@ -248,13 +248,20 @@ struct st_bstream_db_info
struct st_bstream_item_info base; /**< The base of the info class. */
};
-
-/** Describes item which sits inside a database. */
+/**
+ Describes item which sits inside a database.
+
+ @note The fields snap_num, pos are used for triggers only and are NULL
+ otherwise. The fields contain the coordinates of the table on which the
+ trigger fires.
+*/
struct st_bstream_dbitem_info
{
struct st_bstream_item_info base;/**< Data common to all items. */
struct st_bstream_db_info *db; /**< Database to which this item belongs. */
+ unsigned short int snap_num; /**< Snapshot where table data is stored. */
+ unsigned long int pos; /**< Table position within the snapshot. */
};
/**
=== modified file 'sql/si_objects.cc'
--- a/sql/si_objects.cc 2009-10-23 21:26:11 +0000
+++ b/sql/si_objects.cc 2009-11-04 14:18:21 +0000
@@ -3144,6 +3144,65 @@ Obj *find_tablespace_for_table(THD *thd,
///////////////////////////////////////////////////////////////////////////
+/**
+ Retrieve the table name for a trigger
+
+ This method returns a @c Table_obj object for the trigger.
+
+ @param[in] thd Thread context.
+ @param[in] db_name The database name for the trigger.
+ @param[in] trigger_name The trigger name.
+
+ @return Table_obj
+ @retval Table name for trigger.
+ @retval NULL if no table specified.
+*/
+Obj *find_table_for_trigger(THD *thd,
+ const String *db_name,
+ const String *trigger_name)
+{
+ Ed_connection ed_connection(thd);
+ String_stream s_stream;
+ Ed_result_set *ed_result_set;
+
+ s_stream <<
+ "SELECT event_object_table "
+ "FROM INFORMATION_SCHEMA.TRIGGERS "
+ "WHERE trigger_schema = '" << db_name << "' AND "
+ "trigger_name COLLATE utf8_bin = '" << trigger_name << "'";
+
+
+ if (run_service_interface_sql(thd, &ed_connection,
+ s_stream.lex_string(), TRUE) ||
+ ed_connection.get_warn_count())
+ {
+ /* Should be no warnings. */
+ return NULL;
+ }
+
+ ed_result_set= ed_connection.use_result_set();
+
+ /* The result must contain only one row. */
+ if (ed_result_set->size() != 1)
+ return NULL;
+
+ List_iterator_fast<Ed_row> row_it(*ed_result_set);
+ Ed_row *row= row_it++;
+
+ /* There must be 1 column. */
+ DBUG_ASSERT(row->size() == 1);
+
+ LEX_STRING db;
+ db.str= (char *)db_name->ptr();
+ db.length= db_name->length();
+
+ const LEX_STRING *table_name= row->get_column(0);
+
+ return new Table_obj(db, *table_name);
+}
+
+///////////////////////////////////////////////////////////////////////////
+
bool compare_tablespace_attributes(Obj *ts1, Obj *ts2)
{
DBUG_ENTER("obs::compare_tablespace_attributes");
=== modified file 'sql/si_objects.h'
--- a/sql/si_objects.h 2009-07-15 14:18:59 +0000
+++ b/sql/si_objects.h 2009-11-04 14:18:21 +0000
@@ -412,6 +412,13 @@ Obj *find_tablespace_for_table(THD *thd,
const String *table_name);
/**
+ This method returns the table name for a given trigger.
+*/
+Obj *find_table_for_trigger(THD *thd,
+ const String *db_name,
+ const String *trigger_name);
+
+/**
This method determines if a materialized tablespace exists on the system.
This compares the name and all saved attributes of the tablespace. A
FALSE return would mean either the tablespace does not exist or the
Attachment: [text/bzr-bundle] bzr/charles.bell@sun.com-20091104142350-ogz3z3983yq36glo.bundle
| Thread |
|---|
| • bzr push into mysql-6.0-backup branch (charles.bell:2887) Bug#47804 | Chuck Bell | 4 Nov |