MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:antony Date:May 12 2006 3:50pm
Subject:bk commit into 5.1 tree (acurtis:1.2389) BUG#10952
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of antony. When antony does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet
  1.2389 06/05/12 08:50:31 acurtis@stripped +8 -0
  manual merge bug#10952

  storage/blackhole/ha_blackhole.cc
    1.33 06/05/12 08:50:27 acurtis@stripped +1 -2
    manual merge bug#10952

  sql/handler.h
    1.209 06/05/12 08:50:27 acurtis@stripped +1 -1
    manual merge bug#10952

  sql/ha_myisammrg.cc
    1.87 06/05/12 08:50:27 acurtis@stripped +1 -2
    manual merge bug#10952

  mysql-test/r/binlog_stm_blackhole.result
    1.10 06/05/12 08:50:27 acurtis@stripped +8 -8
    manual merge bug#10952

  mysql-test/extra/binlog_tests/blackhole.test
    1.10 06/05/12 08:50:27 acurtis@stripped +12 -12
    manual merge bug#10952

  sql/sql_table.cc
    1.332 06/05/12 08:42:51 acurtis@stripped +0 -0
    Auto merged

  storage/blackhole/ha_blackhole.cc
    1.21.1.2 06/05/12 08:42:50 acurtis@stripped +0 -0
    Merge rename: sql/ha_blackhole.cc -> storage/blackhole/ha_blackhole.cc

  mysql-test/t/merge.test
    1.41 06/05/12 08:42:50 acurtis@stripped +0 -0
    Auto merged

  mysql-test/r/merge.result
    1.51 06/05/12 08:42:50 acurtis@stripped +0 -0
    Auto merged

  mysql-test/r/binlog_stm_blackhole.result
    1.5.2.2 06/05/12 08:42:50 acurtis@stripped +0 -0
    Merge rename: mysql-test/r/blackhole.result -> mysql-test/r/binlog_stm_blackhole.result

  mysql-test/extra/binlog_tests/blackhole.test
    1.4.3.2 06/05/12 08:42:50 acurtis@stripped +0 -0
    Merge rename: mysql-test/t/blackhole.test -> mysql-test/extra/binlog_tests/blackhole.test

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	acurtis
# Host:	localhost.(none)
# Root:	/home/antony/work2/mysql-5.1-merge/RESYNC

--- 1.86/sql/ha_myisammrg.cc	2006-05-04 09:39:42 -07:00
+++ 1.87/sql/ha_myisammrg.cc	2006-05-12 08:50:27 -07:00
@@ -74,7 +74,7 @@ handlerton myisammrg_hton= {
   NULL,    /* Alter table flags */
   NULL,    /* Alter Tablespace */
   NULL,    /* Fill Files Table */
-  HTON_CAN_RECREATE,
+  HTON_CAN_RECREATE | HTON_ALTER_CANNOT_CREATE,
   NULL,    /* binlog_func */
   NULL,    /* binlog_log_query */
   NULL	   /* release_temporary_latches */

--- 1.208/sql/handler.h	2006-05-04 05:58:26 -07:00
+++ 1.209/sql/handler.h	2006-05-12 08:50:27 -07:00
@@ -603,6 +603,7 @@ struct show_table_alias_st {
 #define HTON_FLUSH_AFTER_RENAME      (1 << 4)
 #define HTON_NOT_USER_SELECTABLE     (1 << 5)
 #define HTON_TEMPORARY_NOT_SUPPORTED (1 << 6) //Having temporary tables not supported
+#define HTON_ALTER_CANNOT_CREATE     (1 << 7) //Cannot use alter to create
 
 typedef struct st_thd_trans
 {

--- 1.331/sql/sql_table.cc	2006-05-05 10:08:37 -07:00
+++ 1.332/sql/sql_table.cc	2006-05-12 08:42:51 -07:00
@@ -5098,7 +5098,9 @@ bool mysql_alter_table(THD *thd,char *ne
              ha_resolve_storage_engine_name(old_db_type),
              ha_resolve_storage_engine_name(new_db_type)));
   if (ha_check_storage_engine_flag(old_db_type, HTON_ALTER_NOT_SUPPORTED) ||
-      ha_check_storage_engine_flag(new_db_type, HTON_ALTER_NOT_SUPPORTED))
+      ha_check_storage_engine_flag(new_db_type, HTON_ALTER_NOT_SUPPORTED) ||
+      (old_db_type != new_db_type &&
+       ha_check_storage_engine_flag(new_db_type, HTON_ALTER_CANNOT_CREATE)))
   {
     DBUG_PRINT("info", ("doesn't support alter"));
     my_error(ER_ILLEGAL_HA, MYF(0), table_name);

--- 1.5.2.1/mysql-test/r/blackhole.result	2006-05-09 13:31:42 -07:00
+++ 1.10/mysql-test/r/binlog_stm_blackhole.result	2006-05-12 08:50:27 -07:00
@@ -110,19 +110,45 @@ master-bin.000001	#	Format_desc	1	#	Serv
 master-bin.000001	#	Query	1	#	use `test`; drop table t1,t2
 master-bin.000001	#	Query	1	#	use `test`; create table t1 (a int) engine=blackhole
 master-bin.000001	#	Query	1	#	use `test`; delete from t1 where a=10
+master-bin.000001	#	Query	1	#	use `test`; COMMIT
 master-bin.000001	#	Query	1	#	use `test`; update t1 set a=11 where a=15
+master-bin.000001	#	Query	1	#	use `test`; COMMIT
 master-bin.000001	#	Query	1	#	use `test`; insert into t1 values(1)
+master-bin.000001	#	Query	1	#	use `test`; COMMIT
 master-bin.000001	#	Query	1	#	use `test`; insert ignore into t1 values(1)
+master-bin.000001	#	Query	1	#	use `test`; COMMIT
 master-bin.000001	#	Query	1	#	use `test`; replace into t1 values(100)
+master-bin.000001	#	Query	1	#	use `test`; COMMIT
 master-bin.000001	#	Query	1	#	use `test`; create table t2 (a varchar(200)) engine=blackhole
 master-bin.000001	#	Begin_load_query	1	#	;file_id=1;block_len=581
+master-bin.000001	#	Query	1	#	use `test`; COMMIT
 master-bin.000001	#	Execute_load_query	1	#	use `test`; load data infile '../std_data_ln/words.dat' into table t2 ;file_id=1
+master-bin.000001	#	Query	1	#	use `test`; COMMIT
 master-bin.000001	#	Query	1	#	use `test`; alter table t1 add b int
 master-bin.000001	#	Query	1	#	use `test`; alter table t1 drop b
 master-bin.000001	#	Query	1	#	use `test`; create table t3 like t1
 master-bin.000001	#	Query	1	#	use `test`; insert into t1 select * from t3
+master-bin.000001	#	Query	1	#	use `test`; COMMIT
 master-bin.000001	#	Query	1	#	use `test`; replace into t1 select * from t3
+master-bin.000001	#	Query	1	#	use `test`; COMMIT
 drop table t1,t2,t3;
+reset master;
+create table t1 (a int) engine=blackhole;
+set autocommit=0;
+start transaction;
+insert into t1 values(1);
+commit;
+start transaction;
+insert into t1 values(2);
+rollback;
+set autocommit=1;
+show binlog events;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Format_desc	1	#	Server ver: VERSION, Binlog ver: 4
+master-bin.000001	#	Query	1	#	use `test`; create table t1 (a int) engine=blackhole
+master-bin.000001	#	Query	1	#	use `test`; BEGIN
+master-bin.000001	#	Query	1	#	use `test`; insert into t1 values(1)
+master-bin.000001	#	Query	1	#	use `test`; COMMIT
 drop table if exists t1;
 Warnings:
 Note	1051	Unknown table 't1'

--- 1.4.3.1/mysql-test/t/blackhole.test	2006-05-09 13:31:42 -07:00
+++ 1.10/mysql-test/extra/binlog_tests/blackhole.test	2006-05-12 08:50:27 -07:00
@@ -123,11 +123,30 @@ select * from t3;
 let $VERSION=`select version()`;
 --replace_result $VERSION VERSION
 --replace_column 2 # 5 #
+--replace_regex /table_id: [0-9]+/table_id: #/
 show binlog events;
 
 drop table t1,t2,t3;
 
 # End of 4.1 tests
+
+# Test that a transaction which is rolled back does not go into binlog
+# and that a transaction which is committed does
+
+reset master;
+create table t1 (a int) engine=blackhole;
+set autocommit=0;
+start transaction;
+insert into t1 values(1);
+commit;
+start transaction;
+insert into t1 values(2);
+rollback;
+set autocommit=1;
+--replace_result $VERSION VERSION
+--replace_column 2 # 5 #
+--replace_regex /table_id: [0-9]+/table_id: #/
+show binlog events;
 
 #
 # BUG#10952 - alter table ... lost data without errors and warnings

--- 1.21.1.1/sql/ha_blackhole.cc	2006-05-09 13:31:42 -07:00
+++ 1.33/storage/blackhole/ha_blackhole.cc	2006-05-12 08:50:27 -07:00
@@ -20,16 +20,26 @@
 #endif
 
 #include "mysql_priv.h"
-#ifdef HAVE_BLACKHOLE_DB
 #include "ha_blackhole.h"
 
+#include <mysql/plugin.h>
+
+/* Static declarations for handlerton */
+
+static handler *blackhole_create_handler(TABLE_SHARE *table);
+
+
+static const char blackhole_hton_name[]= "BLACKHOLE";
+static const char blackhole_hton_comment[]=
+  "/dev/null storage engine (anything you write to it disappears)";
 
 /* Blackhole storage engine handlerton */
 
 handlerton blackhole_hton= {
-  "BLACKHOLE",
+  MYSQL_HANDLERTON_INTERFACE_VERSION,
+  blackhole_hton_name,
   SHOW_OPTION_YES,
-  "/dev/null storage engine (anything you write to it disappears)",
+  blackhole_hton_comment,
   DB_TYPE_BLACKHOLE_DB,
   NULL,
   0,       /* slot */
@@ -47,14 +57,34 @@ handlerton blackhole_hton= {
   NULL,    /* create_cursor_read_view */
   NULL,    /* set_cursor_read_view */
   NULL,    /* close_cursor_read_view */
-  HTON_CAN_RECREATE | HTON_ALTER_CANNOT_CREATE
+  blackhole_create_handler,    /* Create a new handler */
+  NULL,    /* Drop a database */
+  NULL,    /* Panic call */
+  NULL,    /* Start Consistent Snapshot */
+  NULL,    /* Flush logs */
+  NULL,    /* Show status */
+  NULL,    /* Partition flags */
+  NULL,    /* Alter table flags */
+  NULL,    /* Alter Tablespace */
+  NULL,    /* Fill FILES table */
+  HTON_CAN_RECREATE | HTON_ALTER_CANNOT_CREATE,
+  NULL,    /* binlog_func */
+  NULL,    /* binlog_log_query */
+  NULL	   /* release_temporary_latches */
 };
 
+
+static handler *blackhole_create_handler(TABLE_SHARE *table)
+{
+  return new ha_blackhole(table);
+}
+
+
 /*****************************************************************************
 ** BLACKHOLE tables
 *****************************************************************************/
 
-ha_blackhole::ha_blackhole(TABLE *table_arg)
+ha_blackhole::ha_blackhole(TABLE_SHARE *table_arg)
   :handler(&blackhole_hton, table_arg)
 {}
 
@@ -93,13 +123,12 @@ int ha_blackhole::create(const char *nam
 const char *ha_blackhole::index_type(uint key_number)
 {
   DBUG_ENTER("ha_blackhole::index_type");
-  DBUG_RETURN((table->key_info[key_number].flags & HA_FULLTEXT) ? 
+  DBUG_RETURN((table_share->key_info[key_number].flags & HA_FULLTEXT) ? 
               "FULLTEXT" :
-              (table->key_info[key_number].flags & HA_SPATIAL) ?
+              (table_share->key_info[key_number].flags & HA_SPATIAL) ?
               "SPATIAL" :
-              (table->key_info[key_number].algorithm == HA_KEY_ALG_RTREE) ?
-              "RTREE" :
-              "BTREE");
+              (table_share->key_info[key_number].algorithm ==
+               HA_KEY_ALG_RTREE) ? "RTREE" : "BTREE");
 }
 
 int ha_blackhole::write_row(byte * buf)
@@ -227,4 +256,15 @@ int ha_blackhole::index_last(byte * buf)
   DBUG_RETURN(HA_ERR_END_OF_FILE);
 }
 
-#endif /* HAVE_BLACKHOLE_DB */
+mysql_declare_plugin(blackhole)
+{
+  MYSQL_STORAGE_ENGINE_PLUGIN,
+  &blackhole_hton,
+  blackhole_hton_name,
+  "MySQL AB",
+  blackhole_hton_comment,
+  NULL, /* Plugin Init */
+  NULL, /* Plugin Deinit */
+  0x0100 /* 1.0 */,
+}
+mysql_declare_plugin_end;

--- 1.50/mysql-test/r/merge.result	2006-03-06 02:35:33 -08:00
+++ 1.51/mysql-test/r/merge.result	2006-05-12 08:42:50 -07:00
@@ -771,3 +771,11 @@ Table	Op	Msg_type	Msg_text
 test.t1	check	status	OK
 test.t2	check	status	OK
 drop table t1, t2, t3;
+drop table if exists t1;
+Warnings:
+Note	1051	Unknown table 't1'
+create table t1 (c char(20)) engine=MyISAM;
+insert into t1 values ("Monty"),("WAX"),("Walrus");
+alter table t1 engine=MERGE;
+ERROR HY000: Table storage engine for 't1' doesn't have this option
+drop table t1;

--- 1.40/mysql-test/t/merge.test	2005-12-26 01:50:35 -08:00
+++ 1.41/mysql-test/t/merge.test	2006-05-12 08:42:50 -07:00
@@ -382,3 +382,15 @@ check table t1, t2;
 drop table t1, t2, t3;
 
 # End of 4.1 tests
+
+#
+# BUG#10952 - alter table ... lost data without errors and warnings
+#
+drop table if exists t1;
+create table t1 (c char(20)) engine=MyISAM;
+insert into t1 values ("Monty"),("WAX"),("Walrus");
+--error 1031
+alter table t1 engine=MERGE;
+drop table t1;
+
+# End of 5.0 tests
Thread
bk commit into 5.1 tree (acurtis:1.2389) BUG#10952antony12 May