Commit 55559673 authored by unknown's avatar unknown
Browse files

Fixed incorrect handling of renamed fields, forcing copy of table if needed...

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


parent def8e0ce
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -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)
    {
+7 −0
Original line number Diff line number Diff line
@@ -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,
+4 −0
Original line number Diff line number Diff line
@@ -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},
+1 −0
Original line number Diff line number Diff line
@@ -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;