Commit ae4e628e authored by unknown's avatar unknown

Merge dev3-221.dev.cn.tlan:/home/ngb/mysql/mysql-5.1/mysql-5.1-new-ndb-bj

into  dev3-221.dev.cn.tlan:/home/ngb/mysql/mysql-5.1/mysql-5.1-new-ndb


mysql-test/t/disabled.def:
  Auto merged
sql/field.cc:
  Auto merged
sql/field.h:
  Auto merged
sql/ha_ndbcluster.cc:
  Auto merged
sql/ha_ndbcluster.h:
  Auto merged
sql/handler.cc:
  Auto merged
sql/mysqld.cc:
  Auto merged
sql/set_var.cc:
  Auto merged
sql/sql_plugin.cc:
  Auto merged
sql/sql_table.cc:
  Auto merged
storage/ndb/src/mgmsrv/ConfigInfo.cpp:
  Auto merged
storage/ndb/src/mgmsrv/MgmtSrvr.cpp:
  Auto merged
storage/ndb/src/ndbapi/ndberror.c:
  Auto merged
storage/ndb/tools/restore/consumer_restore.cpp:
  Auto merged
storage/ndb/tools/restore/restore_main.cpp:
  Auto merged
parents 1ea37dd5 deca8bd3
...@@ -197,7 +197,6 @@ AC_DEFUN([MYSQL_SETUP_NDBCLUSTER], [ ...@@ -197,7 +197,6 @@ AC_DEFUN([MYSQL_SETUP_NDBCLUSTER], [
MAKE_BINARY_DISTRIBUTION_OPTIONS="$MAKE_BINARY_DISTRIBUTION_OPTIONS --with-ndbcluster" MAKE_BINARY_DISTRIBUTION_OPTIONS="$MAKE_BINARY_DISTRIBUTION_OPTIONS --with-ndbcluster"
CXXFLAGS="$CXXFLAGS \$(NDB_CXXFLAGS)"
if test "$have_ndb_debug" = "default" if test "$have_ndb_debug" = "default"
then then
have_ndb_debug=$with_debug have_ndb_debug=$with_debug
......
...@@ -382,7 +382,7 @@ create table t1 (a int primary key) engine=ndb; ...@@ -382,7 +382,7 @@ create table t1 (a int primary key) engine=ndb;
select * from t1; select * from t1;
a a
select * from t1; select * from t1;
ERROR HY000: Can't lock file (errno: 4009) ERROR HY000: Can't lock file (errno: 157)
use test; use test;
drop database test_only_ndb_tables; drop database test_only_ndb_tables;
CREATE TABLE t9 ( CREATE TABLE t9 (
......
...@@ -6570,9 +6570,9 @@ int ndbcluster_table_exists_in_engine(handlerton *hton, THD* thd, ...@@ -6570,9 +6570,9 @@ int ndbcluster_table_exists_in_engine(handlerton *hton, THD* thd,
if (my_strcasecmp(system_charset_info, elmt.name, name)) if (my_strcasecmp(system_charset_info, elmt.name, name))
continue; continue;
DBUG_PRINT("info", ("Found table")); DBUG_PRINT("info", ("Found table"));
DBUG_RETURN(1); DBUG_RETURN(HA_ERR_TABLE_EXIST);
} }
DBUG_RETURN(0); DBUG_RETURN(HA_ERR_NO_SUCH_TABLE);
} }
...@@ -6936,7 +6936,7 @@ int ndbcluster_find_files(handlerton *hton, THD *thd, ...@@ -6936,7 +6936,7 @@ int ndbcluster_find_files(handlerton *hton, THD *thd,
DBUG_PRINT("info", ("%s existed on disk", name)); DBUG_PRINT("info", ("%s existed on disk", name));
// The .ndb file exists on disk, but it's not in list of tables in ndb // The .ndb file exists on disk, but it's not in list of tables in ndb
// Verify that handler agrees table is gone. // Verify that handler agrees table is gone.
if (ndbcluster_table_exists_in_engine(hton, thd, db, file_name) == 0) if (ndbcluster_table_exists_in_engine(hton, thd, db, file_name) == HA_ERR_NO_SUCH_TABLE)
{ {
DBUG_PRINT("info", ("NDB says %s does not exists", file_name)); DBUG_PRINT("info", ("NDB says %s does not exists", file_name));
it.remove(); it.remove();
......
...@@ -2858,20 +2858,21 @@ ha_find_files(THD *thd,const char *db,const char *path, ...@@ -2858,20 +2858,21 @@ ha_find_files(THD *thd,const char *db,const char *path,
DBUG_RETURN(error); DBUG_RETURN(error);
} }
/*
/** @brief
Ask handler if the table exists in engine Ask handler if the table exists in engine
RETURN RETURN
0 Table does not exist HA_ERR_NO_SUCH_TABLE Table does not exist
1 Table exists HA_ERR_TABLE_EXIST Table exists
# Error code # Error code
*/ */
struct st_table_exists_in_engine_args struct st_table_exists_in_engine_args
{ {
const char *db; const char *db;
const char *name; const char *name;
int err;
}; };
static my_bool table_exists_in_engine_handlerton(THD *thd, st_plugin_int *plugin, static my_bool table_exists_in_engine_handlerton(THD *thd, st_plugin_int *plugin,
...@@ -2880,8 +2881,13 @@ static my_bool table_exists_in_engine_handlerton(THD *thd, st_plugin_int *plugin ...@@ -2880,8 +2881,13 @@ static my_bool table_exists_in_engine_handlerton(THD *thd, st_plugin_int *plugin
st_table_exists_in_engine_args *vargs= (st_table_exists_in_engine_args *)arg; st_table_exists_in_engine_args *vargs= (st_table_exists_in_engine_args *)arg;
handlerton *hton= (handlerton *)plugin->data; handlerton *hton= (handlerton *)plugin->data;
int err= HA_ERR_NO_SUCH_TABLE;
if (hton->state == SHOW_OPTION_YES && hton->table_exists_in_engine) if (hton->state == SHOW_OPTION_YES && hton->table_exists_in_engine)
if ((hton->table_exists_in_engine(hton, thd, vargs->db, vargs->name)) == 1) err = hton->table_exists_in_engine(hton, thd, vargs->db, vargs->name);
vargs->err = err;
if (vargs->err == HA_ERR_TABLE_EXIST)
return TRUE; return TRUE;
return FALSE; return FALSE;
...@@ -2889,14 +2895,13 @@ static my_bool table_exists_in_engine_handlerton(THD *thd, st_plugin_int *plugin ...@@ -2889,14 +2895,13 @@ static my_bool table_exists_in_engine_handlerton(THD *thd, st_plugin_int *plugin
int ha_table_exists_in_engine(THD* thd, const char* db, const char* name) int ha_table_exists_in_engine(THD* thd, const char* db, const char* name)
{ {
int error= 0;
DBUG_ENTER("ha_table_exists_in_engine"); DBUG_ENTER("ha_table_exists_in_engine");
DBUG_PRINT("enter", ("db: %s, name: %s", db, name)); DBUG_PRINT("enter", ("db: %s, name: %s", db, name));
st_table_exists_in_engine_args args= {db, name}; st_table_exists_in_engine_args args= {db, name, HA_ERR_NO_SUCH_TABLE};
error= plugin_foreach(thd, table_exists_in_engine_handlerton, plugin_foreach(thd, table_exists_in_engine_handlerton,
MYSQL_STORAGE_ENGINE_PLUGIN, &args); MYSQL_STORAGE_ENGINE_PLUGIN, &args);
DBUG_PRINT("exit", ("error: %d", error)); DBUG_PRINT("exit", ("error: %d", args.err));
DBUG_RETURN(error); DBUG_RETURN(args.err);
} }
#ifdef HAVE_NDB_BINLOG #ifdef HAVE_NDB_BINLOG
......
...@@ -418,7 +418,7 @@ extern ulong srv_flush_log_at_trx_commit; ...@@ -418,7 +418,7 @@ extern ulong srv_flush_log_at_trx_commit;
#ifdef WITH_NDBCLUSTER_STORAGE_ENGINE #ifdef WITH_NDBCLUSTER_STORAGE_ENGINE
const char *opt_ndbcluster_connectstring= 0; const char *opt_ndbcluster_connectstring= 0;
const char *opt_ndb_connectstring= 0; const char *opt_ndb_connectstring= 0;
char opt_ndb_constrbuf[1024]; char opt_ndb_constrbuf[1024]= {0};
unsigned opt_ndb_constrbuf_len= 0; unsigned opt_ndb_constrbuf_len= 0;
my_bool opt_ndb_shm, opt_ndb_optimized_node_selection; my_bool opt_ndb_shm, opt_ndb_optimized_node_selection;
ulong opt_ndb_cache_check_time; ulong opt_ndb_cache_check_time;
...@@ -8407,11 +8407,6 @@ ulong srv_commit_concurrency; ...@@ -8407,11 +8407,6 @@ ulong srv_commit_concurrency;
#endif #endif
#ifndef WITH_NDBCLUSTER_STORAGE_ENGINE
ulong ndb_cache_check_time;
ulong ndb_extra_logging;
#endif
/***************************************************************************** /*****************************************************************************
Instantiate templates Instantiate templates
*****************************************************************************/ *****************************************************************************/
......
...@@ -95,8 +95,12 @@ extern ulong srv_flush_log_at_trx_commit; ...@@ -95,8 +95,12 @@ extern ulong srv_flush_log_at_trx_commit;
} }
/* WITH_NDBCLUSTER_STORAGE_ENGINE */ /* WITH_NDBCLUSTER_STORAGE_ENGINE */
#ifdef WITH_NDBCLUSTER_STORAGE_ENGINE
extern ulong ndb_cache_check_time; extern ulong ndb_cache_check_time;
extern char opt_ndb_constrbuf[];
extern ulong ndb_extra_logging; extern ulong ndb_extra_logging;
#endif
#ifdef HAVE_NDB_BINLOG #ifdef HAVE_NDB_BINLOG
extern ulong ndb_report_thresh_binlog_epoch_slip; extern ulong ndb_report_thresh_binlog_epoch_slip;
extern ulong ndb_report_thresh_binlog_mem_usage; extern ulong ndb_report_thresh_binlog_mem_usage;
...@@ -528,6 +532,7 @@ sys_var_thd_bool ...@@ -528,6 +532,7 @@ sys_var_thd_bool
sys_engine_condition_pushdown("engine_condition_pushdown", sys_engine_condition_pushdown("engine_condition_pushdown",
&SV::engine_condition_pushdown); &SV::engine_condition_pushdown);
#ifdef WITH_NDBCLUSTER_STORAGE_ENGINE
/* ndb thread specific variable settings */ /* ndb thread specific variable settings */
sys_var_thd_ulong sys_var_thd_ulong
sys_ndb_autoincrement_prefetch_sz("ndb_autoincrement_prefetch_sz", sys_ndb_autoincrement_prefetch_sz("ndb_autoincrement_prefetch_sz",
...@@ -548,6 +553,8 @@ sys_var_thd_bool ...@@ -548,6 +553,8 @@ sys_var_thd_bool
sys_ndb_use_transactions("ndb_use_transactions", &SV::ndb_use_transactions); sys_ndb_use_transactions("ndb_use_transactions", &SV::ndb_use_transactions);
sys_var_long_ptr sys_var_long_ptr
sys_ndb_cache_check_time("ndb_cache_check_time", &ndb_cache_check_time); sys_ndb_cache_check_time("ndb_cache_check_time", &ndb_cache_check_time);
sys_var_const_str
sys_ndb_connectstring("ndb_connectstring", opt_ndb_constrbuf);
sys_var_thd_bool sys_var_thd_bool
sys_ndb_index_stat_enable("ndb_index_stat_enable", sys_ndb_index_stat_enable("ndb_index_stat_enable",
&SV::ndb_index_stat_enable); &SV::ndb_index_stat_enable);
...@@ -561,6 +568,7 @@ sys_var_long_ptr ...@@ -561,6 +568,7 @@ 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_var_thd_bool
sys_ndb_use_copying_alter_table("ndb_use_copying_alter_table", &SV::ndb_use_copying_alter_table); sys_ndb_use_copying_alter_table("ndb_use_copying_alter_table", &SV::ndb_use_copying_alter_table);
#endif //WITH_NDBCLUSTER_STORAGE_ENGINE
/* Time/date/datetime formats */ /* Time/date/datetime formats */
...@@ -922,9 +930,11 @@ SHOW_VAR init_vars[]= { ...@@ -922,9 +930,11 @@ SHOW_VAR init_vars[]= {
#ifdef __NT__ #ifdef __NT__
{"named_pipe", (char*) &opt_enable_named_pipe, SHOW_MY_BOOL}, {"named_pipe", (char*) &opt_enable_named_pipe, SHOW_MY_BOOL},
#endif #endif
#ifdef WITH_NDBCLUSTER_STORAGE_ENGINE
{sys_ndb_autoincrement_prefetch_sz.name, {sys_ndb_autoincrement_prefetch_sz.name,
(char*) &sys_ndb_autoincrement_prefetch_sz, SHOW_SYS}, (char*) &sys_ndb_autoincrement_prefetch_sz, SHOW_SYS},
{sys_ndb_cache_check_time.name,(char*) &sys_ndb_cache_check_time, SHOW_SYS}, {sys_ndb_cache_check_time.name,(char*) &sys_ndb_cache_check_time, SHOW_SYS},
{sys_ndb_connectstring.name,(char*) &sys_ndb_connectstring, SHOW_SYS},
{sys_ndb_extra_logging.name,(char*) &sys_ndb_extra_logging, SHOW_SYS}, {sys_ndb_extra_logging.name,(char*) &sys_ndb_extra_logging, SHOW_SYS},
{sys_ndb_force_send.name, (char*) &sys_ndb_force_send, SHOW_SYS}, {sys_ndb_force_send.name, (char*) &sys_ndb_force_send, SHOW_SYS},
{sys_ndb_index_stat_cache_entries.name, (char*) &sys_ndb_index_stat_cache_entries, SHOW_SYS}, {sys_ndb_index_stat_cache_entries.name, (char*) &sys_ndb_index_stat_cache_entries, SHOW_SYS},
...@@ -940,6 +950,7 @@ SHOW_VAR init_vars[]= { ...@@ -940,6 +950,7 @@ SHOW_VAR init_vars[]= {
(char*) &sys_ndb_use_copying_alter_table, SHOW_SYS}, (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},
#endif //WITH_NDBCLUSTER_STORAGE_ENGINE
{sys_net_buffer_length.name,(char*) &sys_net_buffer_length, SHOW_SYS}, {sys_net_buffer_length.name,(char*) &sys_net_buffer_length, SHOW_SYS},
{sys_net_read_timeout.name, (char*) &sys_net_read_timeout, SHOW_SYS}, {sys_net_read_timeout.name, (char*) &sys_net_read_timeout, SHOW_SYS},
{sys_net_retry_count.name, (char*) &sys_net_retry_count, SHOW_SYS}, {sys_net_retry_count.name, (char*) &sys_net_retry_count, SHOW_SYS},
......
...@@ -1010,6 +1010,7 @@ my_bool plugin_foreach_with_mask(THD *thd, plugin_foreach_func *func, ...@@ -1010,6 +1010,7 @@ my_bool plugin_foreach_with_mask(THD *thd, plugin_foreach_func *func,
rw_unlock(&THR_LOCK_plugin); rw_unlock(&THR_LOCK_plugin);
} }
plugin= plugins[idx]; plugin= plugins[idx];
/* It will stop iterating on first engine error when "func" returns TRUE */
if (plugin && func(thd, plugin, arg)) if (plugin && func(thd, plugin, arg))
goto err; goto err;
} }
......
...@@ -3514,15 +3514,25 @@ bool mysql_create_table_internal(THD *thd, ...@@ -3514,15 +3514,25 @@ bool mysql_create_table_internal(THD *thd,
{ {
bool create_if_not_exists = bool create_if_not_exists =
create_info->options & HA_LEX_CREATE_IF_NOT_EXISTS; create_info->options & HA_LEX_CREATE_IF_NOT_EXISTS;
int retcode = ha_table_exists_in_engine(thd, db, table_name);
if (ha_table_exists_in_engine(thd, db, table_name)) DBUG_PRINT("info", ("exists_in_engine: %u",retcode));
switch (retcode)
{ {
DBUG_PRINT("info", ("Table with same name already existed in handler")); case HA_ERR_NO_SUCH_TABLE:
/* Normal case, no table exists. we can go and create it */
break;
case HA_ERR_TABLE_EXIST:
DBUG_PRINT("info", ("Table existed in handler"));
if (create_if_not_exists) if (create_if_not_exists)
goto warn; goto warn;
my_error(ER_TABLE_EXISTS_ERROR,MYF(0),table_name); my_error(ER_TABLE_EXISTS_ERROR,MYF(0),table_name);
goto unlock_and_end; goto unlock_and_end;
break;
default:
DBUG_PRINT("info", ("error: %u from storage engine", retcode));
my_error(retcode, MYF(0),table_name);
goto unlock_and_end;
} }
} }
......
...@@ -25,3 +25,5 @@ INCLUDES = $(INCLUDES_LOC) ...@@ -25,3 +25,5 @@ INCLUDES = $(INCLUDES_LOC)
LDADD = $(LDADD_LOC) LDADD = $(LDADD_LOC)
DEFS = @DEFS@ @NDB_DEFS@ $(DEFS_LOC) $(NDB_EXTRA_FLAGS) DEFS = @DEFS@ @NDB_DEFS@ $(DEFS_LOC) $(NDB_EXTRA_FLAGS)
NDB_CXXFLAGS=@ndb_cxxflags_fix@ $(NDB_CXXFLAGS_LOC) NDB_CXXFLAGS=@ndb_cxxflags_fix@ $(NDB_CXXFLAGS_LOC)
NDB_AM_CXXFLAGS:= $(AM_CXXFLAGS)
AM_CXXFLAGS=$(NDB_AM_CXXFLAGS) $(NDB_CXXFLAGS)
...@@ -2897,7 +2897,13 @@ static bool fixNodeId(InitConfigFileParser::Context & ctx, const char * data) ...@@ -2897,7 +2897,13 @@ static bool fixNodeId(InitConfigFileParser::Context & ctx, const char * data)
char buf[] = "NodeIdX"; buf[6] = data[sizeof("NodeI")]; char buf[] = "NodeIdX"; buf[6] = data[sizeof("NodeI")];
char sysbuf[] = "SystemX"; sysbuf[6] = data[sizeof("NodeI")]; char sysbuf[] = "SystemX"; sysbuf[6] = data[sizeof("NodeI")];
const char* nodeId; const char* nodeId;
require(ctx.m_currentSection->get(buf, &nodeId)); if(!ctx.m_currentSection->get(buf, &nodeId))
{
ctx.reportError("Mandatory parameter %s missing from section"
"[%s] starting at line: %d",
buf, ctx.fname, ctx.m_sectionLineno);
return false;
}
char tmpLine[MAX_LINE_LENGTH]; char tmpLine[MAX_LINE_LENGTH];
strncpy(tmpLine, nodeId, MAX_LINE_LENGTH); strncpy(tmpLine, nodeId, MAX_LINE_LENGTH);
...@@ -2905,17 +2911,36 @@ static bool fixNodeId(InitConfigFileParser::Context & ctx, const char * data) ...@@ -2905,17 +2911,36 @@ static bool fixNodeId(InitConfigFileParser::Context & ctx, const char * data)
char* token2 = strtok(NULL, "."); char* token2 = strtok(NULL, ".");
Uint32 id; Uint32 id;
if(!token1)
{
ctx.reportError("Value for mandatory parameter %s missing from section "
"[%s] starting at line: %d",
buf, ctx.fname, ctx.m_sectionLineno);
return false;
}
if (token2 == NULL) { // Only a number given if (token2 == NULL) { // Only a number given
errno = 0; errno = 0;
char* p; char* p;
id = strtol(token1, &p, 10); id = strtol(token1, &p, 10);
if (errno != 0) warning("STRTOK1", nodeId); if (errno != 0 || id <= 0x0 || id > MAX_NODES)
{
ctx.reportError("Illegal value for mandatory parameter %s from section "
"[%s] starting at line: %d",
buf, ctx.fname, ctx.m_sectionLineno);
return false;
}
require(ctx.m_currentSection->put(buf, id, true)); require(ctx.m_currentSection->put(buf, id, true));
} else { // A pair given (e.g. "uppsala.32") } else { // A pair given (e.g. "uppsala.32")
errno = 0; errno = 0;
char* p; char* p;
id = strtol(token2, &p, 10); id = strtol(token2, &p, 10);
if (errno != 0) warning("STRTOK2", nodeId); if (errno != 0 || id <= 0x0 || id > MAX_NODES)
{
ctx.reportError("Illegal value for mandatory parameter %s from section "
"[%s] starting at line: %d",
buf, ctx.fname, ctx.m_sectionLineno);
return false;
}
require(ctx.m_currentSection->put(buf, id, true)); require(ctx.m_currentSection->put(buf, id, true));
require(ctx.m_currentSection->put(sysbuf, token1)); require(ctx.m_currentSection->put(sysbuf, token1));
} }
......
...@@ -151,7 +151,7 @@ ErrorBundle ErrorCodes[] = { ...@@ -151,7 +151,7 @@ ErrorBundle ErrorCodes[] = {
*/ */
{ 4007, DMEC, UR, "Send to ndbd node failed" }, { 4007, DMEC, UR, "Send to ndbd node failed" },
{ 4008, DMEC, UR, "Receive from NDB failed" }, { 4008, DMEC, UR, "Receive from NDB failed" },
{ 4009, DMEC, UR, "Cluster Failure" }, { 4009, HA_ERR_NO_CONNECTION, UR, "Cluster Failure" },
{ 4012, DMEC, UR, { 4012, DMEC, UR,
"Request ndbd time-out, maybe due to high load or communication problems"}, "Request ndbd time-out, maybe due to high load or communication problems"},
{ 4013, DMEC, UR, "Request timed out in waiting for node failure"}, { 4013, DMEC, UR, "Request timed out in waiting for node failure"},
......
...@@ -895,6 +895,21 @@ BackupRestore::table(const TableS & table){ ...@@ -895,6 +895,21 @@ BackupRestore::table(const TableS & table){
copy.setMaxRows(table.getNoOfRecords()); copy.setMaxRows(table.getNoOfRecords());
} }
NdbTableImpl &tableImpl = NdbTableImpl::getImpl(copy);
if (table.getBackupVersion() < MAKE_VERSION(5,1,0) && !m_no_upgrade){
for(int i= 0; i < copy.getNoOfColumns(); i++)
{
NdbDictionary::Column::Type t = copy.getColumn(i)->getType();
if (t == NdbDictionary::Column::Varchar ||
t == NdbDictionary::Column::Varbinary)
tableImpl.getColumn(i)->setArrayType(NdbDictionary::Column::ArrayTypeShortVar);
if (t == NdbDictionary::Column::Longvarchar ||
t == NdbDictionary::Column::Longvarbinary)
tableImpl.getColumn(i)->setArrayType(NdbDictionary::Column::ArrayTypeMediumVar);
}
}
if (dict->createTable(copy) == -1) if (dict->createTable(copy) == -1)
{ {
err << "Create table `" << table.getTableName() << "` failed: " err << "Create table `" << table.getTableName() << "` failed: "
...@@ -1141,8 +1156,22 @@ void BackupRestore::tuple_a(restore_callback_t *cb) ...@@ -1141,8 +1156,22 @@ void BackupRestore::tuple_a(restore_callback_t *cb)
int size = attr_desc->size; int size = attr_desc->size;
int arraySize = attr_desc->arraySize; int arraySize = attr_desc->arraySize;
char * dataPtr = attr_data->string_value; char * dataPtr = attr_data->string_value;
Uint32 length = attr_data->size; Uint32 length = 0;
const unsigned char * src = (const unsigned char *)dataPtr;
switch(attr_desc->m_column->getType()){
case NdbDictionary::Column::Varchar:
case NdbDictionary::Column::Varbinary:
length = src[0] + 1;
break;
case NdbDictionary::Column::Longvarchar:
case NdbDictionary::Column::Longvarbinary:
length = src[0] + (src[1] << 8) + 2;
break;
default:
length = attr_data->size;
break;
}
if (j == 0 && tup.getTable()->have_auto_inc(i)) if (j == 0 && tup.getTable()->have_auto_inc(i))
tup.getTable()->update_max_auto_val(dataPtr,size*arraySize); tup.getTable()->update_max_auto_val(dataPtr,size*arraySize);
...@@ -1162,7 +1191,7 @@ void BackupRestore::tuple_a(restore_callback_t *cb) ...@@ -1162,7 +1191,7 @@ void BackupRestore::tuple_a(restore_callback_t *cb)
if (ret < 0) { if (ret < 0) {
ndbout_c("Column: %d type %d %d %d %d",i, ndbout_c("Column: %d type %d %d %d %d",i,
attr_desc->m_column->getType(), attr_desc->m_column->getType(),
size, arraySize, attr_data->size); size, arraySize, length);
break; break;
} }
} }
......
...@@ -51,6 +51,7 @@ public: ...@@ -51,6 +51,7 @@ public:
m_callback = 0; m_callback = 0;
m_free_callback = 0; m_free_callback = 0;
m_temp_error = false; m_temp_error = false;
m_no_upgrade = false;
m_transactions = 0; m_transactions = 0;
m_cache.m_old_table = 0; m_cache.m_old_table = 0;
} }
...@@ -91,6 +92,7 @@ public: ...@@ -91,6 +92,7 @@ public:
bool m_restore_meta; bool m_restore_meta;
bool m_no_restore_disk; bool m_no_restore_disk;
bool m_restore_epoch; bool m_restore_epoch;
bool m_no_upgrade; // for upgrade ArrayType from 5.0 backup file.
Uint32 m_logCount; Uint32 m_logCount;
Uint32 m_dataCount; Uint32 m_dataCount;
......
...@@ -34,6 +34,7 @@ static int ga_nodeId = 0; ...@@ -34,6 +34,7 @@ static int ga_nodeId = 0;
static int ga_nParallelism = 128; static int ga_nParallelism = 128;
static int ga_backupId = 0; static int ga_backupId = 0;
static bool ga_dont_ignore_systab_0 = false; static bool ga_dont_ignore_systab_0 = false;
static bool ga_no_upgrade = false;
static Vector<class BackupConsumer *> g_consumers; static Vector<class BackupConsumer *> g_consumers;
static BackupPrinter* g_printer = NULL; static BackupPrinter* g_printer = NULL;
...@@ -115,6 +116,10 @@ static struct my_option my_long_options[] = ...@@ -115,6 +116,10 @@ static struct my_option my_long_options[] =
"Restore meta data into NDB Cluster using NDBAPI", "Restore meta data into NDB Cluster using NDBAPI",
(gptr*) &_restore_meta, (gptr*) &_restore_meta, 0, (gptr*) &_restore_meta, (gptr*) &_restore_meta, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
{ "no-upgrade", 'u',
"Don't upgrade array type for var attributes, which don't resize VAR data and don't change column attributes",
(gptr*) &ga_no_upgrade, (gptr*) &ga_no_upgrade, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
{ "no-restore-disk-objects", 'd', { "no-restore-disk-objects", 'd',
"Dont restore disk objects (tablespace/logfilegroups etc)", "Dont restore disk objects (tablespace/logfilegroups etc)",
(gptr*) &_no_restore_disk, (gptr*) &_no_restore_disk, 0, (gptr*) &_no_restore_disk, (gptr*) &_no_restore_disk, 0,
...@@ -460,6 +465,11 @@ o verify nodegroup mapping ...@@ -460,6 +465,11 @@ o verify nodegroup mapping
restore->m_no_restore_disk = true; restore->m_no_restore_disk = true;
} }
if (ga_no_upgrade)
{
restore->m_no_upgrade = true;
}
if (ga_restore_epoch) if (ga_restore_epoch)
{ {
restore->m_restore_epoch = true; restore->m_restore_epoch = true;
...@@ -644,6 +654,8 @@ main(int argc, char** argv) ...@@ -644,6 +654,8 @@ main(int argc, char** argv)
g_options.appfmt(" -n %d", ga_nodeId); g_options.appfmt(" -n %d", ga_nodeId);
if (_restore_meta) if (_restore_meta)
g_options.appfmt(" -m"); g_options.appfmt(" -m");
if (ga_no_upgrade)
g_options.appfmt(" -u");
if (ga_skip_table_check) if (ga_skip_table_check)
g_options.appfmt(" -s"); g_options.appfmt(" -s");
if (_restore_data) if (_restore_data)
...@@ -655,7 +667,6 @@ main(int argc, char** argv) ...@@ -655,7 +667,6 @@ main(int argc, char** argv)
g_options.appfmt(" -p %d", ga_nParallelism); g_options.appfmt(" -p %d", ga_nParallelism);
g_connect_string = opt_connect_str; g_connect_string = opt_connect_str;
/** /**
* we must always load meta data, even if we will only print it to stdout * we must always load meta data, even if we will only print it to stdout
*/ */
......
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