Bug#44834 strxnmov is expected to behave as you'd expect

The problem: described in the bug report.
The fix:
--increase buffers where it's necessary
  (buffers which are used in stxnmov)
--decrease buffer lengths which are used


client/mysql.cc:
  --increase buffers where it's necessary
    (buffers which are used in stxnmov)
  --decrease buffer lengths which are used
    as argument for strxnmov function
sql/ha_ndbcluster.cc:
  --increase buffers where it's necessary
    (buffers which are used in stxnmov)
  --decrease buffer lengths which are used
    as argument for strxnmov function
sql/ha_ndbcluster_binlog.cc:
  --increase buffers where it's necessary
    (buffers which are used in stxnmov)
  --decrease buffer lengths which are used
    as argument for strxnmov function
sql/handler.cc:
  --increase buffers where it's necessary
    (buffers which are used in stxnmov)
  --decrease buffer lengths which are used
    as argument for strxnmov function
sql/log.cc:
  --increase buffers where it's necessary
    (buffers which are used in stxnmov)
  --decrease buffer lengths which are used
    as argument for strxnmov function
sql/mysqld.cc:
  removed unnecessary line
sql/parse_file.cc:
  --increase buffers where it's necessary
    (buffers which are used in stxnmov)
  --decrease buffer lengths which are used
    as argument for strxnmov function
sql/sql_acl.cc:
  --increase buffers where it's necessary
    (buffers which are used in stxnmov)
  --decrease buffer lengths which are used
    as argument for strxnmov function
sql/sql_base.cc:
  --increase buffers where it's necessary
    (buffers which are used in stxnmov)
  --decrease buffer lengths which are used
    as argument for strxnmov function
sql/sql_db.cc:
  --increase buffers where it's necessary
    (buffers which are used in stxnmov)
  --decrease buffer lengths which are used
    as argument for strxnmov function
sql/sql_delete.cc:
  --increase buffers where it's necessary
    (buffers which are used in stxnmov)
  --decrease buffer lengths which are used
    as argument for strxnmov function
sql/sql_partition.cc:
  --increase buffers where it's necessary
    (buffers which are used in stxnmov)
  --decrease buffer lengths which are used
    as argument for strxnmov function
sql/sql_rename.cc:
  --increase buffers where it's necessary
    (buffers which are used in stxnmov)
  --decrease buffer lengths which are used
    as argument for strxnmov function
sql/sql_show.cc:
  --increase buffers where it's necessary
    (buffers which are used in stxnmov)
  --decrease buffer lengths which are used
    as argument for strxnmov function
sql/sql_table.cc:
  --increase buffers where it's necessary
    (buffers which are used in stxnmov)
  --decrease buffer lengths which are used
    as argument for strxnmov function
sql/sql_view.cc:
  --increase buffers where it's necessary
    (buffers which are used in stxnmov)
  --decrease buffer lengths which are used
    as argument for strxnmov function
This commit is contained in:
Sergey Glukhov 2009-06-19 13:24:43 +05:00
commit 9347649c16
16 changed files with 132 additions and 127 deletions

View file

@ -1247,7 +1247,7 @@ int ha_ndbcluster::add_index_handle(THD *thd, NDBDICT *dict, KEY *key_info,
}
if (idx_type == UNIQUE_ORDERED_INDEX || idx_type == UNIQUE_INDEX)
{
char unique_index_name[FN_LEN];
char unique_index_name[FN_LEN + 1];
static const char* unique_suffix= "$unique";
m_has_unique_index= TRUE;
strxnmov(unique_index_name, FN_LEN, index_name, unique_suffix, NullS);
@ -5150,7 +5150,7 @@ int ha_ndbcluster::create(const char *name,
uchar *data= NULL, *pack_data= NULL;
bool create_from_engine= (create_info->table_options & HA_OPTION_CREATE_FROM_ENGINE);
bool is_truncate= (thd->lex->sql_command == SQLCOM_TRUNCATE);
char tablespace[FN_LEN];
char tablespace[FN_LEN + 1];
NdbDictionary::Table::SingleUserMode single_user_mode= NdbDictionary::Table::SingleUserModeLocked;
DBUG_ENTER("ha_ndbcluster::create");
@ -5613,7 +5613,7 @@ int ha_ndbcluster::create_index(const char *name, KEY *key_info,
NDB_INDEX_TYPE idx_type, uint idx_no)
{
int error= 0;
char unique_name[FN_LEN];
char unique_name[FN_LEN + 1];
static const char* unique_suffix= "$unique";
DBUG_ENTER("ha_ndbcluster::create_ordered_index");
DBUG_PRINT("info", ("Creating index %u: %s", idx_no, name));
@ -6661,7 +6661,7 @@ int ndbcluster_discover(handlerton *hton, THD* thd, const char *db,
size_t len;
uchar* data= NULL;
Ndb* ndb;
char key[FN_REFLEN];
char key[FN_REFLEN + 1];
DBUG_ENTER("ndbcluster_discover");
DBUG_PRINT("enter", ("db: %s, name: %s", db, name));
@ -6672,7 +6672,7 @@ int ndbcluster_discover(handlerton *hton, THD* thd, const char *db,
ERR_RETURN(ndb->getNdbError());
}
NDBDICT* dict= ndb->getDictionary();
build_table_filename(key, sizeof(key), db, name, "", 0);
build_table_filename(key, sizeof(key) - 1, db, name, "", 0);
/* ndb_share reference temporary */
NDB_SHARE *share= get_share(key, 0, FALSE);
if (share)
@ -6837,9 +6837,9 @@ int ndbcluster_drop_database_impl(const char *path)
drop_list.push_back(thd->strdup(elmt.name));
}
// Drop any tables belonging to database
char full_path[FN_REFLEN];
char full_path[FN_REFLEN + 1];
char *tmp= full_path +
build_table_filename(full_path, sizeof(full_path), dbname, "", "", 0);
build_table_filename(full_path, sizeof(full_path) - 1, dbname, "", "", 0);
if (ndb->setDatabaseName(dbname))
{
ERR_RETURN(ndb->getNdbError());
@ -6908,7 +6908,7 @@ int ndb_create_table_from_engine(THD *thd, const char *db,
int ndbcluster_find_all_files(THD *thd)
{
Ndb* ndb;
char key[FN_REFLEN];
char key[FN_REFLEN + 1];
NDBDICT *dict;
int unhandled, retries= 5, skipped;
DBUG_ENTER("ndbcluster_find_all_files");
@ -6966,7 +6966,7 @@ int ndbcluster_find_all_files(THD *thd)
/* check if database exists */
char *end= key +
build_table_filename(key, sizeof(key), elmt.database, "", "", 0);
build_table_filename(key, sizeof(key) - 1, elmt.database, "", "", 0);
if (my_access(key, F_OK))
{
/* no such database defined, skip table */
@ -7047,7 +7047,7 @@ int ndbcluster_find_files(handlerton *hton, THD *thd,
{ // extra bracket to avoid gcc 2.95.3 warning
uint i;
Ndb* ndb;
char name[FN_REFLEN];
char name[FN_REFLEN + 1];
HASH ndb_tables, ok_tables;
NDBDICT::List list;
@ -7117,7 +7117,8 @@ int ndbcluster_find_files(handlerton *hton, THD *thd,
DBUG_PRINT("info", ("%s", file_name->str));
if (hash_search(&ndb_tables, (uchar*) file_name->str, file_name->length))
{
build_table_filename(name, sizeof(name), db, file_name->str, reg_ext, 0);
build_table_filename(name, sizeof(name) - 1, db,
file_name->str, reg_ext, 0);
if (my_access(name, F_OK))
{
pthread_mutex_lock(&LOCK_open);
@ -7139,7 +7140,8 @@ int ndbcluster_find_files(handlerton *hton, THD *thd,
}
// Check for .ndb file with this name
build_table_filename(name, sizeof(name), db, file_name->str, ha_ndb_ext, 0);
build_table_filename(name, sizeof(name) - 1, db,
file_name->str, ha_ndb_ext, 0);
DBUG_PRINT("info", ("Check access for %s", name));
if (my_access(name, F_OK))
{
@ -7182,7 +7184,7 @@ int ndbcluster_find_files(handlerton *hton, THD *thd,
/* setup logging to binlog for all discovered tables */
{
char *end, *end1= name +
build_table_filename(name, sizeof(name), db, "", "", 0);
build_table_filename(name, sizeof(name) - 1, db, "", "", 0);
for (i= 0; i < ok_tables.records; i++)
{
file_name_str= (char*)hash_element(&ok_tables, i);
@ -7204,7 +7206,8 @@ int ndbcluster_find_files(handlerton *hton, THD *thd,
file_name_str= (char*) hash_element(&ndb_tables, i);
if (!hash_search(&ok_tables, (uchar*) file_name_str, strlen(file_name_str)))
{
build_table_filename(name, sizeof(name), db, file_name_str, reg_ext, 0);
build_table_filename(name, sizeof(name) - 1,
db, file_name_str, reg_ext, 0);
if (my_access(name, F_OK))
{
DBUG_PRINT("info", ("%s must be discovered", file_name_str));
@ -7584,7 +7587,7 @@ void ndbcluster_print_error(int error, const NdbOperation *error_op)
void ha_ndbcluster::set_dbname(const char *path_name, char *dbname)
{
char *end, *ptr, *tmp_name;
char tmp_buff[FN_REFLEN];
char tmp_buff[FN_REFLEN + 1];
tmp_name= tmp_buff;
/* Scan name from the end */
@ -7610,7 +7613,7 @@ void ha_ndbcluster::set_dbname(const char *path_name, char *dbname)
ptr++;
}
#endif
filename_to_tablename(tmp_name, dbname, FN_REFLEN);
filename_to_tablename(tmp_name, dbname, sizeof(tmp_buff) - 1);
}
/**
@ -7630,7 +7633,7 @@ void
ha_ndbcluster::set_tabname(const char *path_name, char * tabname)
{
char *end, *ptr, *tmp_name;
char tmp_buff[FN_REFLEN];
char tmp_buff[FN_REFLEN + 1];
tmp_name= tmp_buff;
/* Scan name from the end */
@ -7651,7 +7654,7 @@ ha_ndbcluster::set_tabname(const char *path_name, char * tabname)
ptr++;
}
#endif
filename_to_tablename(tmp_name, tabname, FN_REFLEN);
filename_to_tablename(tmp_name, tabname, sizeof(tmp_buff) - 1);
}
/**
@ -7837,11 +7840,12 @@ uint8 ha_ndbcluster::table_cache_type()
uint ndb_get_commitcount(THD *thd, char *dbname, char *tabname,
Uint64 *commit_count)
{
char name[FN_REFLEN];
char name[FN_REFLEN + 1];
NDB_SHARE *share;
DBUG_ENTER("ndb_get_commitcount");
build_table_filename(name, sizeof(name), dbname, tabname, "", 0);
build_table_filename(name, sizeof(name) - 1,
dbname, tabname, "", 0);
DBUG_PRINT("enter", ("name: %s", name));
pthread_mutex_lock(&ndbcluster_mutex);
if (!(share=(NDB_SHARE*) hash_search(&ndbcluster_open_tables,
@ -9945,7 +9949,7 @@ bool ha_ndbcluster::check_if_incompatible_data(HA_CREATE_INFO *create_info,
ai=1;
}
char tablespace_name[FN_LEN];
char tablespace_name[FN_LEN + 1];
if (get_tablespace_name(current_thd, tablespace_name, FN_LEN))
{
if (create_info->tablespace)