diff --git a/mysql-test/r/archive.result b/mysql-test/r/archive.result index 201383b06be1f461dffeddfc7e754b92757501cf..26d95a4dc8dab46b6313048a6d947df89dcdf56f 100644 --- a/mysql-test/r/archive.result +++ b/mysql-test/r/archive.result @@ -12537,4 +12537,59 @@ SELECT c FROM t5 WHERE a IN (32, 23, 5); c NULL posterity +drop table t1; +create table t1 (v varchar(32)); +insert into t1 values ('def'),('abc'),('hij'),('3r4f'); +select * from t1; +v +def +abc +hij +3r4f +alter table t1 change v v2 varchar(32); +select * from t1; +v2 +def +abc +hij +3r4f +alter table t1 change v2 v varchar(64); +select * from t1; +v +def +abc +hij +3r4f +update t1 set v = 'lmn' where v = 'hij'; +select * from t1; +v +def +abc +lmn +3r4f +alter table t1 add i int auto_increment not null primary key first; +select * from t1; +i v +1 def +2 abc +3 lmn +4 3r4f +update t1 set i=5 where i=3; +select * from t1; +i v +1 def +2 abc +5 lmn +4 3r4f +alter table t1 change i i bigint; +select * from t1; +i v +1 def +2 abc +5 lmn +4 3r4f +alter table t1 add unique key (i, v); +select * from t1 where i between 2 and 4 and v in ('def','3r4f','lmn'); +i v +4 3r4f drop table t1, t2, t4, t5; diff --git a/mysql-test/r/csv.result b/mysql-test/r/csv.result index 6f58fdfe54af53c936d29641a8eecf90d6c21608..9e63b82c29d38c69cb7dcc283c9db65912414144 100644 --- a/mysql-test/r/csv.result +++ b/mysql-test/r/csv.result @@ -5017,3 +5017,58 @@ insert t1 values (1),(2),(3),(4),(5); truncate table t1; affected rows: 0 drop table t1; +create table t1 (v varchar(32)); +insert into t1 values ('def'),('abc'),('hij'),('3r4f'); +select * from t1; +v +def +abc +hij +3r4f +alter table t1 change v v2 varchar(32); +select * from t1; +v2 +def +abc +hij +3r4f +alter table t1 change v2 v varchar(64); +select * from t1; +v +def +abc +hij +3r4f +update t1 set v = 'lmn' where v = 'hij'; +select * from t1; +v +def +abc +lmn +3r4f +alter table t1 add i int auto_increment not null primary key first; +select * from t1; +i v +1 def +2 abc +3 lmn +4 3r4f +update t1 set i=5 where i=3; +select * from t1; +i v +1 def +2 abc +5 lmn +4 3r4f +alter table t1 change i i bigint; +select * from t1; +i v +1 def +2 abc +5 lmn +4 3r4f +alter table t1 add unique key (i, v); +select * from t1 where i between 2 and 4 and v in ('def','3r4f','lmn'); +i v +4 3r4f +drop table t1; diff --git a/mysql-test/t/archive.test b/mysql-test/t/archive.test index 185210b8c54a949a4a614af24bcf81fe5c36326d..68e3192e8a434863777f02cfe186fe495b3e330b 100644 --- a/mysql-test/t/archive.test +++ b/mysql-test/t/archive.test @@ -1456,6 +1456,34 @@ SELECT c FROM t5; SELECT c FROM t5 WHERE a =3; SELECT c FROM t5 WHERE a IN (32, 23, 5); +# Adding this in case someone tries to add fast alter table and doesn't tes +# it. +# Some additional tests for new, faster alter table. Note that most of the +# whole alter table code is being tested all around the test suite already. +# + +drop table t1; +create table t1 (v varchar(32)); +insert into t1 values ('def'),('abc'),('hij'),('3r4f'); +select * from t1; +# Fast alter, no copy performed +alter table t1 change v v2 varchar(32); +select * from t1; +# Fast alter, no copy performed +alter table t1 change v2 v varchar(64); +select * from t1; +update t1 set v = 'lmn' where v = 'hij'; +select * from t1; +# Regular alter table +alter table t1 add i int auto_increment not null primary key first; +select * from t1; +update t1 set i=5 where i=3; +select * from t1; +alter table t1 change i i bigint; +select * from t1; +alter table t1 add unique key (i, v); +select * from t1 where i between 2 and 4 and v in ('def','3r4f','lmn'); + # # Cleanup, test is over # diff --git a/mysql-test/t/csv.test b/mysql-test/t/csv.test index 6f0f42f109c3bf8f7148f662e6975821c8d972ef..916a2132deb4b8efd457e90a52c54d2825d26eae 100644 --- a/mysql-test/t/csv.test +++ b/mysql-test/t/csv.test @@ -1418,3 +1418,29 @@ truncate table t1; -- truncate --disable_info drop table t1; +# +# Some additional tests for new, faster alter table. Note that most of the +# whole alter table code is being tested all around the test suite already. +# + +create table t1 (v varchar(32)); +insert into t1 values ('def'),('abc'),('hij'),('3r4f'); +select * from t1; +# Fast alter, no copy performed +alter table t1 change v v2 varchar(32); +select * from t1; +# Fast alter, no copy performed +alter table t1 change v2 v varchar(64); +select * from t1; +update t1 set v = 'lmn' where v = 'hij'; +select * from t1; +# Regular alter table +alter table t1 add i int auto_increment not null primary key first; +select * from t1; +update t1 set i=5 where i=3; +select * from t1; +alter table t1 change i i bigint; +select * from t1; +alter table t1 add unique key (i, v); +select * from t1 where i between 2 and 4 and v in ('def','3r4f','lmn'); +drop table t1; diff --git a/sql/ha_archive.cc b/sql/ha_archive.cc index 366ae08462baa519d3a92022e1735d74892807aa..9239f67fced8e8cd628ef91f409b23c8ff9ea23f 100644 --- a/sql/ha_archive.cc +++ b/sql/ha_archive.cc @@ -177,7 +177,9 @@ handlerton archive_hton = { NULL, /* Partition flags */ NULL, /* Alter table flags */ NULL, /* Alter interface */ - HTON_NO_FLAGS + HTON_NO_FLAGS, + NULL, /* binlog_func */ + NULL /* binlog_log_query */ }; static handler *archive_create_handler(TABLE_SHARE *table) diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 2289ad219a2d6430a94a95a774a74849d12ed7eb..7a1d843dd4543e46c187f5f39e5bb7d1138d7375 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -4005,7 +4005,7 @@ int fill_schema_events(THD *thd, TABLE_LIST *tables, COND *cond) store(thd->lex->select_lex.db, strlen(thd->lex->select_lex.db), scs); key_len+= event_table->key_info->key_part[1].store_length; } - if (!(key_buf= alloc_root(thd->mem_root, key_len))) + if (!(key_buf= (byte *)alloc_root(thd->mem_root, key_len))) { ret= 1; goto err; diff --git a/storage/csv/ha_tina.cc b/storage/csv/ha_tina.cc index 17c842f43e05dd5ceeb8232abe83f7a0bf1a86ea..bc228d5c7671c04590359693f9ae6b74f743e05b 100644 --- a/storage/csv/ha_tina.cc +++ b/storage/csv/ha_tina.cc @@ -92,7 +92,9 @@ handlerton tina_hton= { NULL, /* Alter table flags */ NULL, /* Alter Tablespace */ NULL, /* Fill FILES Table */ - HTON_CAN_RECREATE + HTON_CAN_RECREATE, + NULL, /* binlog_func */ + NULL /* binlog_log_query */ }; /***************************************************************************** @@ -1018,6 +1020,12 @@ int ha_tina::create(const char *name, TABLE *table_arg, DBUG_RETURN(0); } +bool ha_tina::check_if_incompatible_data(HA_CREATE_INFO *info, + uint table_changes) +{ + return COMPATIBLE_DATA_YES; +} + mysql_declare_plugin { MYSQL_STORAGE_ENGINE_PLUGIN, diff --git a/storage/csv/ha_tina.h b/storage/csv/ha_tina.h index a11d428138987f3b043bdb15091c352164463b91..572d05cb77957d3d3cd9bddfad6e805fd39e5dbd 100644 --- a/storage/csv/ha_tina.h +++ b/storage/csv/ha_tina.h @@ -122,6 +122,8 @@ class ha_tina: public handler int extra(enum ha_extra_function operation); int delete_all_rows(void); int create(const char *name, TABLE *form, HA_CREATE_INFO *create_info); + bool check_if_incompatible_data(HA_CREATE_INFO *info, + uint table_changes); THR_LOCK_DATA **store_lock(THD *thd, THR_LOCK_DATA **to, enum thr_lock_type lock_type); diff --git a/win/cmakefiles/base b/win/cmakefiles/base index f8ac9969a26458aeebf7815f3a5cfea0f0da3020..4430ac0ec466d58f2a0a8170d4e10cf0b13905e1 100644 --- a/win/cmakefiles/base +++ b/win/cmakefiles/base @@ -32,4 +32,4 @@ ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio 7" OR CMAKE_GENERATOR MATCHES "Visu ADD_DEFINITIONS("-D_WINDOWS -D__WIN__") SUBDIRS(vio dbug strings regex mysys extra zlib storage/innobase storage/heap storage/myisam storage/myisammrg - extra/yassl extra/yassl/taocrypt client sql) + extra/yassl extra/yassl/taocrypt client sql server-tools/instance-manager) diff --git a/win/cmakefiles/deploy.bat b/win/cmakefiles/deploy.bat index 52a921a718843fabfeab16a920bb16d0d17d3bbc..cb55b8cdb12ff1175010366cd28f8130ed0d60a1 100644 --- a/win/cmakefiles/deploy.bat +++ b/win/cmakefiles/deploy.bat @@ -16,4 +16,4 @@ copy heap ..\..\storage\heap\cmakelists.txt copy innobase ..\..\storage\innobase\cmakelists.txt copy myisam ..\..\storage\myisam\cmakelists.txt copy myisammrg ..\..\storage\myisammrg\cmakelists.txt - +copy im ..\..\server-tools\instance-manager\cmakelists.txt diff --git a/win/cmakefiles/im b/win/cmakefiles/im new file mode 100644 index 0000000000000000000000000000000000000000..32f243b43d98c83def901ed760c535a572a240a8 --- /dev/null +++ b/win/cmakefiles/im @@ -0,0 +1,16 @@ +SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX") +SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX") + +ADD_DEFINITIONS(-DMYSQL_SERVER -DMYSQL_INSTANCE_MANAGER) +INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/include ${PROJECT_SOURCE_DIR}/sql) + +ADD_EXECUTABLE(mysqlmanager buffer.cc command.cc commands.cc guardian.cc instance.cc instance_map.cc + instance_options.cc listener.cc log.cc manager.cc messages.cc mysql_connection.cc + mysqlmanager.cc options.cc parse.cc parse_output.cc priv.cc protocol.cc + thread_registry.cc user_map.cc imservice.cpp windowsservice.cpp + ../../sql/net_serv.cc ../../sql-common/pack.c ../../sql/password.c + ../../sql/sql_state.c ../../sql-common/client.c ../../libmysql/get_password.c + ../../libmysql/errmsg.c) + +ADD_DEPENDENCIES(mysqlmanager GenError) +TARGET_LINK_LIBRARIES(mysqlmanager dbug mysys strings taocrypt vio yassl zlib wsock32)