Commit 2fc642de authored by unknown's avatar unknown

Merge tulin@bk-internal.mysql.com:/home/bk/mysql-5.1-new

into  poseidon.ndb.mysql.com:/home/tomas/mysql-5.1-new

parents f4dd9c11 b9d41f5d
...@@ -12537,4 +12537,59 @@ SELECT c FROM t5 WHERE a IN (32, 23, 5); ...@@ -12537,4 +12537,59 @@ SELECT c FROM t5 WHERE a IN (32, 23, 5);
c c
NULL NULL
posterity 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; drop table t1, t2, t4, t5;
...@@ -5017,3 +5017,58 @@ insert t1 values (1),(2),(3),(4),(5); ...@@ -5017,3 +5017,58 @@ insert t1 values (1),(2),(3),(4),(5);
truncate table t1; truncate table t1;
affected rows: 0 affected rows: 0
drop table t1; 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;
...@@ -1456,6 +1456,34 @@ SELECT c FROM t5; ...@@ -1456,6 +1456,34 @@ SELECT c FROM t5;
SELECT c FROM t5 WHERE a =3; SELECT c FROM t5 WHERE a =3;
SELECT c FROM t5 WHERE a IN (32, 23, 5); 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 # Cleanup, test is over
# #
......
...@@ -1418,3 +1418,29 @@ truncate table t1; -- truncate ...@@ -1418,3 +1418,29 @@ truncate table t1; -- truncate
--disable_info --disable_info
drop table t1; 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;
...@@ -177,7 +177,9 @@ handlerton archive_hton = { ...@@ -177,7 +177,9 @@ handlerton archive_hton = {
NULL, /* Partition flags */ NULL, /* Partition flags */
NULL, /* Alter table flags */ NULL, /* Alter table flags */
NULL, /* Alter interface */ NULL, /* Alter interface */
HTON_NO_FLAGS HTON_NO_FLAGS,
NULL, /* binlog_func */
NULL /* binlog_log_query */
}; };
static handler *archive_create_handler(TABLE_SHARE *table) static handler *archive_create_handler(TABLE_SHARE *table)
......
...@@ -4005,7 +4005,7 @@ int fill_schema_events(THD *thd, TABLE_LIST *tables, COND *cond) ...@@ -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); store(thd->lex->select_lex.db, strlen(thd->lex->select_lex.db), scs);
key_len+= event_table->key_info->key_part[1].store_length; 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; ret= 1;
goto err; goto err;
......
...@@ -92,7 +92,9 @@ handlerton tina_hton= { ...@@ -92,7 +92,9 @@ handlerton tina_hton= {
NULL, /* Alter table flags */ NULL, /* Alter table flags */
NULL, /* Alter Tablespace */ NULL, /* Alter Tablespace */
NULL, /* Fill FILES Table */ 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, ...@@ -1018,6 +1020,12 @@ int ha_tina::create(const char *name, TABLE *table_arg,
DBUG_RETURN(0); 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_declare_plugin
{ {
MYSQL_STORAGE_ENGINE_PLUGIN, MYSQL_STORAGE_ENGINE_PLUGIN,
......
...@@ -122,6 +122,8 @@ class ha_tina: public handler ...@@ -122,6 +122,8 @@ class ha_tina: public handler
int extra(enum ha_extra_function operation); int extra(enum ha_extra_function operation);
int delete_all_rows(void); int delete_all_rows(void);
int create(const char *name, TABLE *form, HA_CREATE_INFO *create_info); 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, THR_LOCK_DATA **store_lock(THD *thd, THR_LOCK_DATA **to,
enum thr_lock_type lock_type); enum thr_lock_type lock_type);
......
...@@ -32,4 +32,4 @@ ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio 7" OR CMAKE_GENERATOR MATCHES "Visu ...@@ -32,4 +32,4 @@ ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio 7" OR CMAKE_GENERATOR MATCHES "Visu
ADD_DEFINITIONS("-D_WINDOWS -D__WIN__") ADD_DEFINITIONS("-D_WINDOWS -D__WIN__")
SUBDIRS(vio dbug strings regex mysys extra zlib storage/innobase storage/heap storage/myisam storage/myisammrg 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)
...@@ -16,4 +16,4 @@ copy heap ..\..\storage\heap\cmakelists.txt ...@@ -16,4 +16,4 @@ copy heap ..\..\storage\heap\cmakelists.txt
copy innobase ..\..\storage\innobase\cmakelists.txt copy innobase ..\..\storage\innobase\cmakelists.txt
copy myisam ..\..\storage\myisam\cmakelists.txt copy myisam ..\..\storage\myisam\cmakelists.txt
copy myisammrg ..\..\storage\myisammrg\cmakelists.txt copy myisammrg ..\..\storage\myisammrg\cmakelists.txt
copy im ..\..\server-tools\instance-manager\cmakelists.txt
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)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment