Below is the list of changes that have just been committed into a local
5.0 repository of eric. When eric 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.2002 05/09/30 16:26:48 eric@stripped +13 -0
Move handler specific options into handlerton flag check
BUG#13108
sql/sql_table.cc
1.275 05/09/30 16:26:21 eric@stripped +10 -0
added check for handlerton check for alter support
sql/sql_delete.cc
1.164 05/09/30 16:26:21 eric@stripped +3 -2
replaced ha_supports_generate with handlerton flag check
sql/handler.h
1.156 05/09/30 16:26:20 eric@stripped +5 -8
added additional handlerton flags
created a function to test flags
replace ha_supports_generate macro with call to flag check
sql/handler.cc
1.195 05/09/30 16:26:20 eric@stripped +17 -0
implemented flag check function
sql/ha_myisammrg.cc
1.73 05/09/30 16:26:20 eric@stripped +1 -1
supports table re-creation
sql/ha_myisam.cc
1.161 05/09/30 16:26:20 eric@stripped +1 -1
supports table recreation
sql/ha_heap.cc
1.73 05/09/30 16:26:20 eric@stripped +1 -1
supports table recreation
sql/ha_federated.cc
1.47 05/09/30 16:26:20 eric@stripped +1 -1
added flag for not supporting alter
sql/ha_blackhole.cc
1.20 05/09/30 16:26:19 eric@stripped +1 -1
supports table re-creation
sql/examples/ha_tina.cc
1.18 05/09/30 16:26:19 eric@stripped +1 -1
supports table re-creation
sql/examples/ha_example.cc
1.18 05/09/30 16:26:19 eric@stripped +1 -1
supports table re-creation
mysql-test/t/federated.test
1.14 05/09/30 16:26:18 eric@stripped +43 -1
added test for federated alter table
mysql-test/r/federated.result
1.17 05/09/30 16:26:18 eric@stripped +26 -0
added test results for federated alter table
# 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: eric
# Host: sleek.local
# Root: /Users/eric/dev/hton-mysql-5.0
--- 1.72/sql/ha_heap.cc 2005-09-19 12:06:18 -07:00
+++ 1.73/sql/ha_heap.cc 2005-09-30 16:26:20 -07:00
@@ -40,7 +40,7 @@
NULL, /* create_cursor_read_view */
NULL, /* set_cursor_read_view */
NULL, /* close_cursor_read_view */
- HTON_NO_FLAGS
+ HTON_CAN_RECREATE
};
/*****************************************************************************
--- 1.160/sql/ha_myisam.cc 2005-09-27 11:10:55 -07:00
+++ 1.161/sql/ha_myisam.cc 2005-09-30 16:26:20 -07:00
@@ -73,7 +73,7 @@
MyISAM doesn't support transactions and doesn't have
transaction-dependent context: cursors can survive a commit.
*/
- HTON_NO_FLAGS
+ HTON_CAN_RECREATE
};
// collect errors printed by mi_check routines
--- 1.72/sql/ha_myisammrg.cc 2005-09-19 12:06:18 -07:00
+++ 1.73/sql/ha_myisammrg.cc 2005-09-30 16:26:20 -07:00
@@ -51,7 +51,7 @@
NULL, /* create_cursor_read_view */
NULL, /* set_cursor_read_view */
NULL, /* close_cursor_read_view */
- HTON_NO_FLAGS
+ HTON_CAN_RECREATE
};
--- 1.194/sql/handler.cc 2005-09-28 19:04:46 -07:00
+++ 1.195/sql/handler.cc 2005-09-30 16:26:20 -07:00
@@ -183,6 +183,23 @@
return "none";
}
+bool ha_check_storage_engine_flag(enum db_type db_type, uint32 flag)
+{
+ show_table_type_st *types;
+ for (types= sys_table_types; types->type; types++)
+ {
+ if (db_type == types->db_type)
+ {
+ if (types->ht->flags & flag)
+ return TRUE;
+ else
+ return FALSE;
+ }
+ }
+
+ return FALSE;
+}
+
my_bool ha_storage_engine_is_enabled(enum db_type database_type)
{
--- 1.155/sql/handler.h 2005-09-30 03:20:11 -07:00
+++ 1.156/sql/handler.h 2005-09-30 16:26:20 -07:00
@@ -377,8 +377,10 @@
};
/* Possible flags of a handlerton */
-#define HTON_NO_FLAGS 0
-#define HTON_CLOSE_CURSORS_AT_COMMIT 1
+#define HTON_NO_FLAGS 0
+#define HTON_CLOSE_CURSORS_AT_COMMIT (1 << 0)
+#define HTON_ALTER_NOT_SUPPORTED (1 << 1)
+#define HTON_CAN_RECREATE (1 << 2)
typedef struct st_thd_trans
{
@@ -848,18 +850,13 @@
#define ha_commit(thd) (ha_commit_trans((thd), TRUE))
#define ha_rollback(thd) (ha_rollback_trans((thd), TRUE))
-#define ha_supports_generate(T) (T != DB_TYPE_INNODB && \
- T != DB_TYPE_BERKELEY_DB && \
- T != DB_TYPE_ARCHIVE_DB && \
- T != DB_TYPE_FEDERATED_DB && \
- T != DB_TYPE_NDBCLUSTER)
-
/* lookups */
enum db_type ha_resolve_by_name(const char *name, uint namelen);
const char *ha_get_storage_engine(enum db_type db_type);
handler *get_new_handler(TABLE *table, enum db_type db_type);
enum db_type ha_checktype(THD *thd, enum db_type database_type,
bool no_substitute, bool report_error);
+bool ha_check_storage_engine_flag(enum db_type db_type, uint32 flag);
/* basic stuff */
int ha_init(void);
--- 1.163/sql/sql_delete.cc 2005-09-28 02:34:49 -07:00
+++ 1.164/sql/sql_delete.cc 2005-09-30 16:26:21 -07:00
@@ -787,7 +787,7 @@
TABLE *table= *table_ptr;
table->file->info(HA_STATUS_AUTO | HA_STATUS_NO_LOCK);
db_type table_type= table->s->db_type;
- if (!ha_supports_generate(table_type))
+ if (!ha_check_storage_engine_flag(table_type, HTON_CAN_RECREATE))
goto trunc_by_del;
strmov(path, table->s->path);
*table_ptr= table->next; // Unlink table from list
@@ -818,7 +818,8 @@
table_list->db, table_list->table_name);
DBUG_RETURN(TRUE);
}
- if (!ha_supports_generate(table_type) || thd->lex->sphead)
+ if (!ha_check_storage_engine_flag(table_type, HTON_CAN_RECREATE)
+ || thd->lex->sphead)
goto trunc_by_del;
if (lock_and_wait_for_table_name(thd, table_list))
DBUG_RETURN(TRUE);
--- 1.274/sql/sql_table.cc 2005-09-27 11:10:56 -07:00
+++ 1.275/sql/sql_table.cc 2005-09-30 16:26:21 -07:00
@@ -3156,6 +3156,16 @@
if (create_info->row_type == ROW_TYPE_NOT_USED)
create_info->row_type= table->s->row_type;
+ DBUG_PRINT("info", ("old type: %d new type: %d", old_db_type, 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))
+ {
+ DBUG_PRINT("info", ("doesn't support alter"));
+ my_error(ER_ILLEGAL_HA, MYF(0), table_name);
+ DBUG_RETURN(TRUE);
+ }
+ DBUG_PRINT("info", ("supports alter"));
+
thd->proc_info="setup";
if (!(alter_info->flags & ~(ALTER_RENAME | ALTER_KEYS_ONOFF)) &&
!table->s->tmp_table) // no need to touch frm
--- 1.17/sql/examples/ha_tina.cc 2005-09-22 07:04:45 -07:00
+++ 1.18/sql/examples/ha_tina.cc 2005-09-30 16:26:19 -07:00
@@ -71,7 +71,7 @@
NULL, /* create_cursor_read_view */
NULL, /* set_cursor_read_view */
NULL, /* close_cursor_read_view */
- HTON_NO_FLAGS
+ HTON_CAN_RECREATE
};
/*****************************************************************************
--- 1.17/sql/examples/ha_example.cc 2005-09-19 12:06:18 -07:00
+++ 1.18/sql/examples/ha_example.cc 2005-09-30 16:26:19 -07:00
@@ -90,7 +90,7 @@
NULL, /* create_cursor_read_view */
NULL, /* set_cursor_read_view */
NULL, /* close_cursor_read_view */
- HTON_NO_FLAGS
+ HTON_CAN_RECREATE
};
/* Variables for example share methods */
--- 1.19/sql/ha_blackhole.cc 2005-09-19 12:06:18 -07:00
+++ 1.20/sql/ha_blackhole.cc 2005-09-30 16:26:19 -07:00
@@ -43,7 +43,7 @@
NULL, /* create_cursor_read_view */
NULL, /* set_cursor_read_view */
NULL, /* close_cursor_read_view */
- HTON_NO_FLAGS
+ HTON_CAN_RECREATE
};
/*****************************************************************************
--- 1.16/mysql-test/r/federated.result 2005-09-13 11:59:15 -07:00
+++ 1.17/mysql-test/r/federated.result 2005-09-30 16:26:18 -07:00
@@ -1457,6 +1457,32 @@
REPAIR TABLE federated.t1 USE_FRM;
Table Op Msg_type Msg_text
federated.t1 repair status OK
+DROP TABLE IF EXISTS federated.normal_table;
+CREATE TABLE federated.normal_table (
+`id` int(4) NOT NULL,
+`name` varchar(10) default NULL
+) DEFAULT CHARSET=latin1;
+DROP TABLE IF EXISTS federated.alter_me;
+CREATE TABLE federated.alter_me (
+`id` int(4) NOT NULL,
+`name` varchar(10) default NULL,
+PRIMARY KEY (`id`)
+) ENGINE="FEDERATED" DEFAULT CHARSET=latin1
+CONNECTION='mysql://root@stripped:SLAVE_PORT/federated/normal_table';
+INSERT INTO federated.alter_me (id, name) VALUES (1, 'Monty');
+INSERT INTO federated.alter_me (id, name) VALUES (2, 'David');
+SELECT * FROM federated.alter_me;
+id name
+1 Monty
+2 David
+ALTER TABLE federated.alter_me MODIFY COLUMN id int(16) NOT NULL;
+ERROR HY000: Table storage engine for 'alter_me' doesn't have this option
+SELECT * FROM federated.alter_me;
+id name
+1 Monty
+2 David
+DROP TABLE federated.alter_me;
+DROP TABLE federated.normal_table;
DROP TABLE IF EXISTS federated.t1;
DROP DATABASE IF EXISTS federated;
DROP TABLE IF EXISTS federated.t1;
--- 1.13/mysql-test/t/federated.test 2005-09-12 18:02:12 -07:00
+++ 1.14/mysql-test/t/federated.test 2005-09-30 16:26:18 -07:00
@@ -1137,11 +1137,53 @@
DROP TABLE federated.countries;
-# optimize and repair tests
+#BEGIN optimize and repair tests
OPTIMIZE TABLE federated.t1;
REPAIR TABLE federated.t1;
REPAIR TABLE federated.t1 QUICK;
REPAIR TABLE federated.t1 EXTENDED;
REPAIR TABLE federated.t1 USE_FRM;
+#END optimize and repair tests
+
+
+# BEGIN ALTER TEST
+connection slave;
+--disable_warnings
+DROP TABLE IF EXISTS federated.normal_table;
+--enable_warnings
+
+CREATE TABLE federated.normal_table (
+ `id` int(4) NOT NULL,
+ `name` varchar(10) default NULL
+ ) DEFAULT CHARSET=latin1;
+
+connection master;
+--disable_warnings
+DROP TABLE IF EXISTS federated.alter_me;
+--enable_warnings
+
+--replace_result $SLAVE_MYPORT SLAVE_PORT
+eval CREATE TABLE federated.alter_me (
+ `id` int(4) NOT NULL,
+ `name` varchar(10) default NULL,
+ PRIMARY KEY (`id`)
+ ) ENGINE="FEDERATED" DEFAULT CHARSET=latin1
+ CONNECTION='mysql://root@stripped:$SLAVE_MYPORT/federated/normal_table';
+
+INSERT INTO federated.alter_me (id, name) VALUES (1, 'Monty');
+INSERT INTO federated.alter_me (id, name) VALUES (2, 'David');
+
+SELECT * FROM federated.alter_me;
+
+--error 1031
+ALTER TABLE federated.alter_me MODIFY COLUMN id int(16) NOT NULL;
+
+SELECT * FROM federated.alter_me;
+
+DROP TABLE federated.alter_me;
+connection slave;
+DROP TABLE federated.normal_table;
+# END ALTER TEST
+
source include/federated_cleanup.inc;
--- 1.46/sql/ha_federated.cc 2005-09-22 13:46:49 -07:00
+++ 1.47/sql/ha_federated.cc 2005-09-30 16:26:20 -07:00
@@ -713,7 +713,7 @@
NULL, /* create_cursor_read_view */
NULL, /* set_cursor_read_view */
NULL, /* close_cursor_read_view */
- HTON_NO_FLAGS
+ HTON_ALTER_NOT_SUPPORTED
};
| Thread |
|---|
| • bk commit into 5.0 tree (eric:1.2002) BUG#13108 | Eric Herman | 1 Oct |