1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

Fixed incorrect handling of renamed fields, forcing copy of table if needed and added optional system variable ndb_use_copying_alter_table

This commit is contained in:
mskold@mysql.com
2006-06-13 16:44:30 +02:00
parent ae70201afb
commit 95d61f64d8
4 changed files with 23 additions and 0 deletions

View File

@ -9824,10 +9824,21 @@ bool ha_ndbcluster::check_if_incompatible_data(HA_CREATE_INFO *info,
uint i;
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++)
{
Field *field= table->field[i];
const NDBCOL *col= tab->getColumn(field->field_name);
if (!col)
{
DBUG_PRINT("info", ("Field has been renamed, copy table"));
DBUG_RETURN(COMPATIBLE_DATA_NO);
}
if ((field->flags & FIELD_IN_ADD_INDEX) &&
col->getStorageType() == NdbDictionary::Column::StorageTypeDisk)
{

View File

@ -4695,6 +4695,7 @@ enum options_mysqld
OPT_NDB_EXTRA_LOGGING,
OPT_NDB_REPORT_THRESH_BINLOG_EPOCH_SLIP,
OPT_NDB_REPORT_THRESH_BINLOG_MEM_USAGE,
OPT_NDB_USE_COPYING_ALTER_TABLE,
OPT_SKIP_SAFEMALLOC,
OPT_TEMP_POOL, OPT_TX_ISOLATION, OPT_COMPLETION_TYPE,
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,
0, GET_ULONG, OPT_ARG, 20, 0, ~0L, 0, 0, 0},
#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.",
(gptr*) &global_system_variables.new_mode,
(gptr*) &max_system_variables.new_mode,

View File

@ -548,6 +548,8 @@ sys_ndb_index_stat_update_freq("ndb_index_stat_update_freq",
&SV::ndb_index_stat_update_freq);
sys_var_long_ptr
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 */
@ -917,6 +919,8 @@ SHOW_VAR init_vars[]= {
{sys_ndb_report_thresh_binlog_mem_usage.name,
(char*) &sys_ndb_report_thresh_binlog_mem_usage, SHOW_SYS},
#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_transactions.name,(char*) &sys_ndb_use_transactions, SHOW_SYS},
{sys_net_buffer_length.name,(char*) &sys_net_buffer_length, SHOW_SYS},

View File

@ -244,6 +244,7 @@ struct system_variables
my_bool innodb_table_locks;
my_bool innodb_support_xa;
my_bool ndb_force_send;
my_bool ndb_use_copying_alter_table;
my_bool ndb_use_exact_count;
my_bool ndb_use_transactions;
my_bool ndb_index_stat_enable;