mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
Merge mskold@bk-internal.mysql.com:/home/bk/mysql-5.1
into mysql.com:/home/marty/MySQL/mysql-5.1
This commit is contained in:
@ -99,6 +99,7 @@ enum enum_server_command
|
|||||||
#define GET_FIXED_FIELDS_FLAG (1 << 18) /* Used to get fields in item tree */
|
#define GET_FIXED_FIELDS_FLAG (1 << 18) /* Used to get fields in item tree */
|
||||||
#define FIELD_IN_PART_FUNC_FLAG (1 << 19)/* Field part of partition func */
|
#define FIELD_IN_PART_FUNC_FLAG (1 << 19)/* Field part of partition func */
|
||||||
#define FIELD_IN_ADD_INDEX (1<< 20) /* Intern: Field used in ADD INDEX */
|
#define FIELD_IN_ADD_INDEX (1<< 20) /* Intern: Field used in ADD INDEX */
|
||||||
|
#define FIELD_IS_RENAMED (1<< 21) /* Intern: Field is being renamed */
|
||||||
|
|
||||||
#define REFRESH_GRANT 1 /* Refresh grant tables */
|
#define REFRESH_GRANT 1 /* Refresh grant tables */
|
||||||
#define REFRESH_LOG 2 /* Start on new log file */
|
#define REFRESH_LOG 2 /* Start on new log file */
|
||||||
|
@ -320,8 +320,13 @@ LOAD DATA INFILE 'tmp.dat' INTO TABLE ndb_show_tables;
|
|||||||
set @t1_id = (select id from ndb_show_tables where name like '%t1%');
|
set @t1_id = (select id from ndb_show_tables where name like '%t1%');
|
||||||
truncate ndb_show_tables;
|
truncate ndb_show_tables;
|
||||||
alter table t1 change tiny new_tiny tinyint(4) DEFAULT '0' NOT NULL;
|
alter table t1 change tiny new_tiny tinyint(4) DEFAULT '0' NOT NULL;
|
||||||
|
LOAD DATA INFILE 'tmp.dat' INTO TABLE ndb_show_tables;
|
||||||
|
select 'no_copy' from ndb_show_tables where id = @t1_id and name like '%t1%';
|
||||||
|
no_copy
|
||||||
|
set @t1_id = (select id from ndb_show_tables where name like '%t1%');
|
||||||
|
truncate ndb_show_tables;
|
||||||
create index i1 on t1(medium);
|
create index i1 on t1(medium);
|
||||||
alter table t1 add index i2(long_int);
|
alter table t1 add index i2(new_tiny);
|
||||||
drop index i1 on t1;
|
drop index i1 on t1;
|
||||||
LOAD DATA INFILE 'tmp.dat' INTO TABLE ndb_show_tables;
|
LOAD DATA INFILE 'tmp.dat' INTO TABLE ndb_show_tables;
|
||||||
select 'no_copy' from ndb_show_tables where id = @t1_id and name like '%t1%';
|
select 'no_copy' from ndb_show_tables where id = @t1_id and name like '%t1%';
|
||||||
|
@ -367,12 +367,23 @@ CREATE TEMPORARY TABLE ndb_show_tables (id INT, type VARCHAR(20), state VARCHAR(
|
|||||||
LOAD DATA INFILE 'tmp.dat' INTO TABLE ndb_show_tables;
|
LOAD DATA INFILE 'tmp.dat' INTO TABLE ndb_show_tables;
|
||||||
--enable_warnings
|
--enable_warnings
|
||||||
|
|
||||||
|
# Ndb doesn't support renaming attributes on-line
|
||||||
set @t1_id = (select id from ndb_show_tables where name like '%t1%');
|
set @t1_id = (select id from ndb_show_tables where name like '%t1%');
|
||||||
truncate ndb_show_tables;
|
truncate ndb_show_tables;
|
||||||
|
|
||||||
alter table t1 change tiny new_tiny tinyint(4) DEFAULT '0' NOT NULL;
|
alter table t1 change tiny new_tiny tinyint(4) DEFAULT '0' NOT NULL;
|
||||||
|
--disable_warnings
|
||||||
|
--exec $NDB_TOOLS_DIR/ndb_show_tables --p > $MYSQLTEST_VARDIR/master-data/test/tmp.dat
|
||||||
|
LOAD DATA INFILE 'tmp.dat' INTO TABLE ndb_show_tables;
|
||||||
|
--enable_warnings
|
||||||
|
|
||||||
|
select 'no_copy' from ndb_show_tables where id = @t1_id and name like '%t1%';
|
||||||
|
|
||||||
|
set @t1_id = (select id from ndb_show_tables where name like '%t1%');
|
||||||
|
truncate ndb_show_tables;
|
||||||
|
|
||||||
create index i1 on t1(medium);
|
create index i1 on t1(medium);
|
||||||
alter table t1 add index i2(long_int);
|
alter table t1 add index i2(new_tiny);
|
||||||
drop index i1 on t1;
|
drop index i1 on t1;
|
||||||
|
|
||||||
--disable_warnings
|
--disable_warnings
|
||||||
|
@ -9871,10 +9871,21 @@ bool ha_ndbcluster::check_if_incompatible_data(HA_CREATE_INFO *info,
|
|||||||
uint i;
|
uint i;
|
||||||
const NDBTAB *tab= (const NDBTAB *) m_table;
|
const NDBTAB *tab= (const NDBTAB *) m_table;
|
||||||
|
|
||||||
|
if (current_thd->variables.ndb_use_copying_alter_table)
|
||||||
|
{
|
||||||
|
DBUG_PRINT("info", ("On-line alter table disabled"));
|
||||||
|
DBUG_RETURN(COMPATIBLE_DATA_NO);
|
||||||
|
}
|
||||||
|
|
||||||
for (i= 0; i < table->s->fields; i++)
|
for (i= 0; i < table->s->fields; i++)
|
||||||
{
|
{
|
||||||
Field *field= table->field[i];
|
Field *field= table->field[i];
|
||||||
const NDBCOL *col= tab->getColumn(field->field_name);
|
const NDBCOL *col= tab->getColumn(i);
|
||||||
|
if (field->flags & FIELD_IS_RENAMED)
|
||||||
|
{
|
||||||
|
DBUG_PRINT("info", ("Field has been renamed, copy table"));
|
||||||
|
DBUG_RETURN(COMPATIBLE_DATA_NO);
|
||||||
|
}
|
||||||
if ((field->flags & FIELD_IN_ADD_INDEX) &&
|
if ((field->flags & FIELD_IN_ADD_INDEX) &&
|
||||||
col->getStorageType() == NdbDictionary::Column::StorageTypeDisk)
|
col->getStorageType() == NdbDictionary::Column::StorageTypeDisk)
|
||||||
{
|
{
|
||||||
|
@ -4695,6 +4695,7 @@ enum options_mysqld
|
|||||||
OPT_NDB_EXTRA_LOGGING,
|
OPT_NDB_EXTRA_LOGGING,
|
||||||
OPT_NDB_REPORT_THRESH_BINLOG_EPOCH_SLIP,
|
OPT_NDB_REPORT_THRESH_BINLOG_EPOCH_SLIP,
|
||||||
OPT_NDB_REPORT_THRESH_BINLOG_MEM_USAGE,
|
OPT_NDB_REPORT_THRESH_BINLOG_MEM_USAGE,
|
||||||
|
OPT_NDB_USE_COPYING_ALTER_TABLE,
|
||||||
OPT_SKIP_SAFEMALLOC,
|
OPT_SKIP_SAFEMALLOC,
|
||||||
OPT_TEMP_POOL, OPT_TX_ISOLATION, OPT_COMPLETION_TYPE,
|
OPT_TEMP_POOL, OPT_TX_ISOLATION, OPT_COMPLETION_TYPE,
|
||||||
OPT_SKIP_STACK_TRACE, OPT_SKIP_SYMLINKS,
|
OPT_SKIP_STACK_TRACE, OPT_SKIP_SYMLINKS,
|
||||||
@ -5430,6 +5431,12 @@ Disable with --skip-ndbcluster (will save memory).",
|
|||||||
(gptr*) &max_system_variables.ndb_index_stat_update_freq,
|
(gptr*) &max_system_variables.ndb_index_stat_update_freq,
|
||||||
0, GET_ULONG, OPT_ARG, 20, 0, ~0L, 0, 0, 0},
|
0, GET_ULONG, OPT_ARG, 20, 0, ~0L, 0, 0, 0},
|
||||||
#endif
|
#endif
|
||||||
|
{"nb-use-copying-alter-table",
|
||||||
|
OPT_NDB_USE_COPYING_ALTER_TABLE,
|
||||||
|
"Force ndbcluster to always copy tables at alter table (used for ensuring that operations such as renaming fields are propagated to ndb data dictionary).",
|
||||||
|
(gptr*) &global_system_variables.ndb_use_copying_alter_table,
|
||||||
|
(gptr*) &global_system_variables.ndb_use_copying_alter_table,
|
||||||
|
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
|
||||||
{"new", 'n', "Use very new possible 'unsafe' functions.",
|
{"new", 'n', "Use very new possible 'unsafe' functions.",
|
||||||
(gptr*) &global_system_variables.new_mode,
|
(gptr*) &global_system_variables.new_mode,
|
||||||
(gptr*) &max_system_variables.new_mode,
|
(gptr*) &max_system_variables.new_mode,
|
||||||
|
@ -548,6 +548,8 @@ sys_ndb_index_stat_update_freq("ndb_index_stat_update_freq",
|
|||||||
&SV::ndb_index_stat_update_freq);
|
&SV::ndb_index_stat_update_freq);
|
||||||
sys_var_long_ptr
|
sys_var_long_ptr
|
||||||
sys_ndb_extra_logging("ndb_extra_logging", &ndb_extra_logging);
|
sys_ndb_extra_logging("ndb_extra_logging", &ndb_extra_logging);
|
||||||
|
sys_var_thd_bool
|
||||||
|
sys_ndb_use_copying_alter_table("ndb_use_copying_alter_table", &SV::ndb_use_copying_alter_table);
|
||||||
|
|
||||||
/* Time/date/datetime formats */
|
/* Time/date/datetime formats */
|
||||||
|
|
||||||
@ -917,6 +919,8 @@ SHOW_VAR init_vars[]= {
|
|||||||
{sys_ndb_report_thresh_binlog_mem_usage.name,
|
{sys_ndb_report_thresh_binlog_mem_usage.name,
|
||||||
(char*) &sys_ndb_report_thresh_binlog_mem_usage, SHOW_SYS},
|
(char*) &sys_ndb_report_thresh_binlog_mem_usage, SHOW_SYS},
|
||||||
#endif
|
#endif
|
||||||
|
{sys_ndb_use_copying_alter_table.name,
|
||||||
|
(char*) &sys_ndb_use_copying_alter_table, SHOW_SYS},
|
||||||
{sys_ndb_use_exact_count.name,(char*) &sys_ndb_use_exact_count, SHOW_SYS},
|
{sys_ndb_use_exact_count.name,(char*) &sys_ndb_use_exact_count, SHOW_SYS},
|
||||||
{sys_ndb_use_transactions.name,(char*) &sys_ndb_use_transactions, SHOW_SYS},
|
{sys_ndb_use_transactions.name,(char*) &sys_ndb_use_transactions, SHOW_SYS},
|
||||||
{sys_net_buffer_length.name,(char*) &sys_net_buffer_length, SHOW_SYS},
|
{sys_net_buffer_length.name,(char*) &sys_net_buffer_length, SHOW_SYS},
|
||||||
|
@ -244,6 +244,7 @@ struct system_variables
|
|||||||
my_bool innodb_table_locks;
|
my_bool innodb_table_locks;
|
||||||
my_bool innodb_support_xa;
|
my_bool innodb_support_xa;
|
||||||
my_bool ndb_force_send;
|
my_bool ndb_force_send;
|
||||||
|
my_bool ndb_use_copying_alter_table;
|
||||||
my_bool ndb_use_exact_count;
|
my_bool ndb_use_exact_count;
|
||||||
my_bool ndb_use_transactions;
|
my_bool ndb_use_transactions;
|
||||||
my_bool ndb_index_stat_enable;
|
my_bool ndb_index_stat_enable;
|
||||||
|
@ -4744,6 +4744,13 @@ static uint compare_tables(TABLE *table, List<create_field> *create_list,
|
|||||||
create_info->row_type != ROW_TYPE_FIXED)
|
create_info->row_type != ROW_TYPE_FIXED)
|
||||||
create_info->table_options|= HA_OPTION_PACK_RECORD;
|
create_info->table_options|= HA_OPTION_PACK_RECORD;
|
||||||
|
|
||||||
|
/* Check if field was renamed */
|
||||||
|
field->flags&= ~FIELD_IS_RENAMED;
|
||||||
|
if (my_strcasecmp(system_charset_info,
|
||||||
|
field->field_name,
|
||||||
|
new_field->field_name))
|
||||||
|
field->flags|= FIELD_IS_RENAMED;
|
||||||
|
|
||||||
/* Evaluate changes bitmap and send to check_if_incompatible_data() */
|
/* Evaluate changes bitmap and send to check_if_incompatible_data() */
|
||||||
if (!(tmp= field->is_equal(new_field)))
|
if (!(tmp= field->is_equal(new_field)))
|
||||||
DBUG_RETURN(ALTER_TABLE_DATA_CHANGED);
|
DBUG_RETURN(ALTER_TABLE_DATA_CHANGED);
|
||||||
|
Reference in New Issue
Block a user