Bug#26176 NdbObjectIdMap::expand unable to expand!! mysqld got signal 11

- try to catch as many malloc failures as possible and give error messages
(more for 5.1)
parent da1ebc7f
...@@ -819,9 +819,9 @@ public: ...@@ -819,9 +819,9 @@ public:
*/ */
void setMaxLoadFactor(int); void setMaxLoadFactor(int);
void setTablespaceName(const char * name); int setTablespaceName(const char * name);
const char * getTablespaceName() const; const char * getTablespaceName() const;
void setTablespace(const class Tablespace &); int setTablespace(const class Tablespace &);
bool getTablespace(Uint32 *id= 0, Uint32 *version= 0) const; bool getTablespace(Uint32 *id= 0, Uint32 *version= 0) const;
/** /**
...@@ -862,12 +862,12 @@ public: ...@@ -862,12 +862,12 @@ public:
* Node group identity * Node group identity
* Fragment State * Fragment State
*/ */
void setFragmentData(const void* data, Uint32 len); int setFragmentData(const void* data, Uint32 len);
/** /**
* Set/Get tablespace names per fragment * Set/Get tablespace names per fragment
*/ */
void setTablespaceNames(const void* data, Uint32 len); int setTablespaceNames(const void* data, Uint32 len);
const void *getTablespaceNames(); const void *getTablespaceNames();
Uint32 getTablespaceNamesLen() const; Uint32 getTablespaceNamesLen() const;
...@@ -875,7 +875,7 @@ public: ...@@ -875,7 +875,7 @@ public:
* Set tablespace information per fragment * Set tablespace information per fragment
* Contains a tablespace id and a tablespace version * Contains a tablespace id and a tablespace version
*/ */
void setTablespaceData(const void* data, Uint32 len); int setTablespaceData(const void* data, Uint32 len);
/** /**
* Set array of information mapping range values and list values * Set array of information mapping range values and list values
...@@ -884,7 +884,7 @@ public: ...@@ -884,7 +884,7 @@ public:
* one pair per fragment. For list partitions it could be any number * one pair per fragment. For list partitions it could be any number
* of pairs, at least as many as there are fragments. * of pairs, at least as many as there are fragments.
*/ */
void setRangeListData(const void* data, Uint32 len); int setRangeListData(const void* data, Uint32 len);
/** /**
* Set table object type * Set table object type
...@@ -1281,7 +1281,7 @@ public: ...@@ -1281,7 +1281,7 @@ public:
/** /**
* Set unique identifier for the event * Set unique identifier for the event
*/ */
void setName(const char *name); int setName(const char *name);
/** /**
* Get unique identifier for the event * Get unique identifier for the event
*/ */
...@@ -1308,7 +1308,7 @@ public: ...@@ -1308,7 +1308,7 @@ public:
* @note preferred way is using setTable(const NdbDictionary::Table&) * @note preferred way is using setTable(const NdbDictionary::Table&)
* or constructor with table object parameter * or constructor with table object parameter
*/ */
void setTable(const char *tableName); int setTable(const char *tableName);
/** /**
* Get table name for events * Get table name for events
* *
...@@ -1534,8 +1534,8 @@ public: ...@@ -1534,8 +1534,8 @@ public:
Uint64 getSize() const; Uint64 getSize() const;
Uint64 getFree() const; Uint64 getFree() const;
void setTablespace(const char * name); int setTablespace(const char * name);
void setTablespace(const class Tablespace &); int setTablespace(const class Tablespace &);
const char * getTablespace() const; const char * getTablespace() const;
void getTablespaceId(ObjectId * dst) const; void getTablespaceId(ObjectId * dst) const;
......
...@@ -116,6 +116,7 @@ Vector<T>::push_back(const T & t){ ...@@ -116,6 +116,7 @@ Vector<T>::push_back(const T & t){
} }
m_items[m_size] = t; m_items[m_size] = t;
m_size++; m_size++;
return 0;
} }
template<class T> template<class T>
......
...@@ -519,10 +519,10 @@ NdbDictionary::Table::setSingleUserMode(enum NdbDictionary::Table::SingleUserMod ...@@ -519,10 +519,10 @@ NdbDictionary::Table::setSingleUserMode(enum NdbDictionary::Table::SingleUserMod
m_impl.m_single_user_mode = (Uint8)mode; m_impl.m_single_user_mode = (Uint8)mode;
} }
void int
NdbDictionary::Table::setTablespaceNames(const void *data, Uint32 len) NdbDictionary::Table::setTablespaceNames(const void *data, Uint32 len)
{ {
m_impl.setTablespaceNames(data, len); return m_impl.setTablespaceNames(data, len);
} }
const void* const void*
...@@ -576,10 +576,10 @@ NdbDictionary::Table::getFragmentDataLen() const { ...@@ -576,10 +576,10 @@ NdbDictionary::Table::getFragmentDataLen() const {
return m_impl.getFragmentDataLen(); return m_impl.getFragmentDataLen();
} }
void int
NdbDictionary::Table::setFragmentData(const void* data, Uint32 len) NdbDictionary::Table::setFragmentData(const void* data, Uint32 len)
{ {
m_impl.setFragmentData(data, len); return m_impl.setFragmentData(data, len);
} }
const void* const void*
...@@ -592,10 +592,10 @@ NdbDictionary::Table::getTablespaceDataLen() const { ...@@ -592,10 +592,10 @@ NdbDictionary::Table::getTablespaceDataLen() const {
return m_impl.getTablespaceDataLen(); return m_impl.getTablespaceDataLen();
} }
void int
NdbDictionary::Table::setTablespaceData(const void* data, Uint32 len) NdbDictionary::Table::setTablespaceData(const void* data, Uint32 len)
{ {
m_impl.setTablespaceData(data, len); return m_impl.setTablespaceData(data, len);
} }
const void* const void*
...@@ -608,10 +608,10 @@ NdbDictionary::Table::getRangeListDataLen() const { ...@@ -608,10 +608,10 @@ NdbDictionary::Table::getRangeListDataLen() const {
return m_impl.getRangeListDataLen(); return m_impl.getRangeListDataLen();
} }
void int
NdbDictionary::Table::setRangeListData(const void* data, Uint32 len) NdbDictionary::Table::setRangeListData(const void* data, Uint32 len)
{ {
m_impl.setRangeListData(data, len); return m_impl.setRangeListData(data, len);
} }
NdbDictionary::Object::Status NdbDictionary::Object::Status
...@@ -693,18 +693,18 @@ NdbDictionary::Table::getTablespaceName() const ...@@ -693,18 +693,18 @@ NdbDictionary::Table::getTablespaceName() const
return m_impl.m_tablespace_name.c_str(); return m_impl.m_tablespace_name.c_str();
} }
void int
NdbDictionary::Table::setTablespaceName(const char * name){ NdbDictionary::Table::setTablespaceName(const char * name){
m_impl.m_tablespace_id = ~0; m_impl.m_tablespace_id = ~0;
m_impl.m_tablespace_version = ~0; m_impl.m_tablespace_version = ~0;
m_impl.m_tablespace_name.assign(name); return !m_impl.m_tablespace_name.assign(name);
} }
void int
NdbDictionary::Table::setTablespace(const NdbDictionary::Tablespace & ts){ NdbDictionary::Table::setTablespace(const NdbDictionary::Tablespace & ts){
m_impl.m_tablespace_id = NdbTablespaceImpl::getImpl(ts).m_id; m_impl.m_tablespace_id = NdbTablespaceImpl::getImpl(ts).m_id;
m_impl.m_tablespace_version = ts.getObjectVersion(); m_impl.m_tablespace_version = ts.getObjectVersion();
m_impl.m_tablespace_name.assign(ts.getName()); return !m_impl.m_tablespace_name.assign(ts.getName());
} }
void void
...@@ -936,10 +936,10 @@ NdbDictionary::Event::~Event() ...@@ -936,10 +936,10 @@ NdbDictionary::Event::~Event()
} }
} }
void int
NdbDictionary::Event::setName(const char * name) NdbDictionary::Event::setName(const char * name)
{ {
m_impl.setName(name); return m_impl.setName(name);
} }
const char * const char *
...@@ -960,10 +960,10 @@ NdbDictionary::Event::getTable() const ...@@ -960,10 +960,10 @@ NdbDictionary::Event::getTable() const
return m_impl.getTable(); return m_impl.getTable();
} }
void int
NdbDictionary::Event::setTable(const char * table) NdbDictionary::Event::setTable(const char * table)
{ {
m_impl.setTable(table); return m_impl.setTable(table);
} }
const char* const char*
...@@ -1295,18 +1295,18 @@ NdbDictionary::Datafile::getFree() const { ...@@ -1295,18 +1295,18 @@ NdbDictionary::Datafile::getFree() const {
return m_impl.m_free; return m_impl.m_free;
} }
void int
NdbDictionary::Datafile::setTablespace(const char * tablespace){ NdbDictionary::Datafile::setTablespace(const char * tablespace){
m_impl.m_filegroup_id = ~0; m_impl.m_filegroup_id = ~0;
m_impl.m_filegroup_version = ~0; m_impl.m_filegroup_version = ~0;
m_impl.m_filegroup_name.assign(tablespace); return !m_impl.m_filegroup_name.assign(tablespace);
} }
void int
NdbDictionary::Datafile::setTablespace(const NdbDictionary::Tablespace & ts){ NdbDictionary::Datafile::setTablespace(const NdbDictionary::Tablespace & ts){
m_impl.m_filegroup_id = NdbTablespaceImpl::getImpl(ts).m_id; m_impl.m_filegroup_id = NdbTablespaceImpl::getImpl(ts).m_id;
m_impl.m_filegroup_version = ts.getObjectVersion(); m_impl.m_filegroup_version = ts.getObjectVersion();
m_impl.m_filegroup_name.assign(ts.getName()); return !m_impl.m_filegroup_name.assign(ts.getName());
} }
const char * const char *
......
...@@ -881,9 +881,9 @@ NdbTableImpl::getTablespaceNamesLen() const ...@@ -881,9 +881,9 @@ NdbTableImpl::getTablespaceNamesLen() const
return m_new_ts_name.length(); return m_new_ts_name.length();
} }
void NdbTableImpl::setTablespaceNames(const void *data, Uint32 len) int NdbTableImpl::setTablespaceNames(const void *data, Uint32 len)
{ {
m_new_ts_name.assign(data, len); return !m_new_ts_name.assign(data, len);
} }
void NdbTableImpl::setFragmentCount(Uint32 count) void NdbTableImpl::setFragmentCount(Uint32 count)
...@@ -896,9 +896,9 @@ Uint32 NdbTableImpl::getFragmentCount() const ...@@ -896,9 +896,9 @@ Uint32 NdbTableImpl::getFragmentCount() const
return m_fragmentCount; return m_fragmentCount;
} }
void NdbTableImpl::setFrm(const void* data, Uint32 len) int NdbTableImpl::setFrm(const void* data, Uint32 len)
{ {
m_newFrm.assign(data, len); return m_newFrm.assign(data, len);
} }
const void * const void *
...@@ -919,9 +919,9 @@ NdbTableImpl::getFrmLength() const ...@@ -919,9 +919,9 @@ NdbTableImpl::getFrmLength() const
return m_newFrm.length(); return m_newFrm.length();
} }
void NdbTableImpl::setFragmentData(const void* data, Uint32 len) int NdbTableImpl::setFragmentData(const void* data, Uint32 len)
{ {
m_new_fd.assign(data, len); return m_new_fd.assign(data, len);
} }
const void * const void *
...@@ -942,9 +942,9 @@ NdbTableImpl::getFragmentDataLen() const ...@@ -942,9 +942,9 @@ NdbTableImpl::getFragmentDataLen() const
return m_new_fd.length(); return m_new_fd.length();
} }
void NdbTableImpl::setTablespaceData(const void* data, Uint32 len) int NdbTableImpl::setTablespaceData(const void* data, Uint32 len)
{ {
m_new_ts.assign(data, len); return !m_new_ts.assign(data, len);
} }
const void * const void *
...@@ -965,9 +965,9 @@ NdbTableImpl::getTablespaceDataLen() const ...@@ -965,9 +965,9 @@ NdbTableImpl::getTablespaceDataLen() const
return m_new_ts.length(); return m_new_ts.length();
} }
void NdbTableImpl::setRangeListData(const void* data, Uint32 len) int NdbTableImpl::setRangeListData(const void* data, Uint32 len)
{ {
m_new_range.assign(data, len); return m_new_range.assign(data, len);
} }
const void * const void *
...@@ -988,16 +988,15 @@ NdbTableImpl::getRangeListDataLen() const ...@@ -988,16 +988,15 @@ NdbTableImpl::getRangeListDataLen() const
return m_new_range.length(); return m_new_range.length();
} }
void int
NdbTableImpl::updateMysqlName() NdbTableImpl::updateMysqlName()
{ {
Vector<BaseString> v; Vector<BaseString> v;
if (m_internalName.split(v,"/") == 3) if (m_internalName.split(v,"/") == 3)
{ {
m_mysqlName.assfmt("%s/%s",v[0].c_str(),v[2].c_str()); return !m_mysqlName.assfmt("%s/%s",v[0].c_str(),v[2].c_str());
return;
} }
m_mysqlName.assign(""); return !m_mysqlName.assign("");
} }
int int
...@@ -1274,9 +1273,9 @@ NdbEventImpl::~NdbEventImpl() ...@@ -1274,9 +1273,9 @@ NdbEventImpl::~NdbEventImpl()
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
void NdbEventImpl::setName(const char * name) int NdbEventImpl::setName(const char * name)
{ {
m_name.assign(name); !m_name.assign(name);
} }
const char *NdbEventImpl::getName() const const char *NdbEventImpl::getName() const
...@@ -1284,11 +1283,11 @@ const char *NdbEventImpl::getName() const ...@@ -1284,11 +1283,11 @@ const char *NdbEventImpl::getName() const
return m_name.c_str(); return m_name.c_str();
} }
void int
NdbEventImpl::setTable(const NdbDictionary::Table& table) NdbEventImpl::setTable(const NdbDictionary::Table& table)
{ {
setTable(&NdbTableImpl::getImpl(table)); setTable(&NdbTableImpl::getImpl(table));
m_tableName.assign(m_tableImpl->getName()); return !m_tableName.assign(m_tableImpl->getName());
} }
void void
...@@ -1313,10 +1312,10 @@ NdbEventImpl::getTable() const ...@@ -1313,10 +1312,10 @@ NdbEventImpl::getTable() const
return NULL; return NULL;
} }
void int
NdbEventImpl::setTable(const char * table) NdbEventImpl::setTable(const char * table)
{ {
m_tableName.assign(table); return !m_tableName.assign(table);
} }
const char * const char *
...@@ -1467,10 +1466,11 @@ NdbDictionaryImpl::putTable(NdbTableImpl *impl) ...@@ -1467,10 +1466,11 @@ NdbDictionaryImpl::putTable(NdbTableImpl *impl)
NdbTableImpl *old; NdbTableImpl *old;
int ret = getBlobTables(*impl); int ret = getBlobTables(*impl);
int error = 0;
assert(ret == 0); assert(ret == 0);
m_globalHash->lock(); m_globalHash->lock();
if ((old= m_globalHash->get(impl->m_internalName.c_str()))) if ((old= m_globalHash->get(impl->m_internalName.c_str(), &error)))
{ {
m_globalHash->alter_table_rep(old->m_internalName.c_str(), m_globalHash->alter_table_rep(old->m_internalName.c_str(),
impl->m_id, impl->m_id,
...@@ -2334,8 +2334,13 @@ NdbDictionaryImpl::createTable(NdbTableImpl &t) ...@@ -2334,8 +2334,13 @@ NdbDictionaryImpl::createTable(NdbTableImpl &t)
// if the new name has not been set, use the copied name // if the new name has not been set, use the copied name
if (t.m_newExternalName.empty()) if (t.m_newExternalName.empty())
t.m_newExternalName.assign(t.m_externalName); {
if (!t.m_newExternalName.assign(t.m_externalName))
{
m_error.code= 4000;
DBUG_RETURN(-1);
}
}
// create table // create table
if (m_receiver.createTable(m_ndb, t) != 0) if (m_receiver.createTable(m_ndb, t) != 0)
DBUG_RETURN(-1); DBUG_RETURN(-1);
...@@ -2510,7 +2515,7 @@ NdbDictInterface::createOrAlterTable(Ndb & ndb, ...@@ -2510,7 +2515,7 @@ NdbDictInterface::createOrAlterTable(Ndb & ndb,
{ {
AlterTableReq::setNameFlag(impl.m_changeMask, true); AlterTableReq::setNameFlag(impl.m_changeMask, true);
} }
if (impl.m_externalName.assign(impl.m_newExternalName)) if (!impl.m_externalName.assign(impl.m_newExternalName))
{ {
m_error.code= 4000; m_error.code= 4000;
DBUG_RETURN(-1); DBUG_RETURN(-1);
...@@ -2524,7 +2529,11 @@ NdbDictInterface::createOrAlterTable(Ndb & ndb, ...@@ -2524,7 +2529,11 @@ NdbDictInterface::createOrAlterTable(Ndb & ndb,
{ {
AlterTableReq::setFrmFlag(impl.m_changeMask, true); AlterTableReq::setFrmFlag(impl.m_changeMask, true);
} }
impl.m_frm.assign(impl.m_newFrm.get_data(), impl.m_newFrm.length()); if (impl.m_frm.assign(impl.m_newFrm.get_data(), impl.m_newFrm.length()))
{
m_error.code= 4000;
DBUG_RETURN(-1);
}
impl.m_newFrm.clear(); impl.m_newFrm.clear();
} }
// Change FragmentData (fragment identity, state, tablespace id) // Change FragmentData (fragment identity, state, tablespace id)
...@@ -2534,7 +2543,11 @@ NdbDictInterface::createOrAlterTable(Ndb & ndb, ...@@ -2534,7 +2543,11 @@ NdbDictInterface::createOrAlterTable(Ndb & ndb,
{ {
AlterTableReq::setFragDataFlag(impl.m_changeMask, true); AlterTableReq::setFragDataFlag(impl.m_changeMask, true);
} }
impl.m_fd.assign(impl.m_new_fd.get_data(), impl.m_new_fd.length()); if (impl.m_fd.assign(impl.m_new_fd.get_data(), impl.m_new_fd.length()))
{
m_error.code= 4000;
DBUG_RETURN(-1);
}
impl.m_new_fd.clear(); impl.m_new_fd.clear();
} }
// Change Tablespace Name Data // Change Tablespace Name Data
...@@ -2544,8 +2557,12 @@ NdbDictInterface::createOrAlterTable(Ndb & ndb, ...@@ -2544,8 +2557,12 @@ NdbDictInterface::createOrAlterTable(Ndb & ndb,
{ {
AlterTableReq::setTsNameFlag(impl.m_changeMask, true); AlterTableReq::setTsNameFlag(impl.m_changeMask, true);
} }
impl.m_ts_name.assign(impl.m_new_ts_name.get_data(), if (impl.m_ts_name.assign(impl.m_new_ts_name.get_data(),
impl.m_new_ts_name.length()); impl.m_new_ts_name.length()))
{
m_error.code= 4000;
DBUG_RETURN(-1);
}
impl.m_new_ts_name.clear(); impl.m_new_ts_name.clear();
} }
// Change Range/List Data // Change Range/List Data
...@@ -2555,8 +2572,12 @@ NdbDictInterface::createOrAlterTable(Ndb & ndb, ...@@ -2555,8 +2572,12 @@ NdbDictInterface::createOrAlterTable(Ndb & ndb,
{ {
AlterTableReq::setRangeListFlag(impl.m_changeMask, true); AlterTableReq::setRangeListFlag(impl.m_changeMask, true);
} }
impl.m_range.assign(impl.m_new_range.get_data(), if (impl.m_range.assign(impl.m_new_range.get_data(),
impl.m_new_range.length()); impl.m_new_range.length()))
{
m_error.code= 4000;
DBUG_RETURN(-1);
}
impl.m_new_range.clear(); impl.m_new_range.clear();
} }
// Change Tablespace Data // Change Tablespace Data
...@@ -2566,8 +2587,12 @@ NdbDictInterface::createOrAlterTable(Ndb & ndb, ...@@ -2566,8 +2587,12 @@ NdbDictInterface::createOrAlterTable(Ndb & ndb,
{ {
AlterTableReq::setTsFlag(impl.m_changeMask, true); AlterTableReq::setTsFlag(impl.m_changeMask, true);
} }
impl.m_ts.assign(impl.m_new_ts.get_data(), if (impl.m_ts.assign(impl.m_new_ts.get_data(),
impl.m_new_ts.length()); impl.m_new_ts.length()))
{
m_error.code= 4000;
DBUG_RETURN(-1);
}
impl.m_new_ts.clear(); impl.m_new_ts.clear();
} }
...@@ -4473,7 +4498,7 @@ NdbTablespaceImpl::NdbTablespaceImpl(NdbDictionary::Tablespace & f) : ...@@ -4473,7 +4498,7 @@ NdbTablespaceImpl::NdbTablespaceImpl(NdbDictionary::Tablespace & f) :
NdbTablespaceImpl::~NdbTablespaceImpl(){ NdbTablespaceImpl::~NdbTablespaceImpl(){
} }
void int
NdbTablespaceImpl::assign(const NdbTablespaceImpl& org) NdbTablespaceImpl::assign(const NdbTablespaceImpl& org)
{ {
m_id = org.m_id; m_id = org.m_id;
...@@ -4481,14 +4506,17 @@ NdbTablespaceImpl::assign(const NdbTablespaceImpl& org) ...@@ -4481,14 +4506,17 @@ NdbTablespaceImpl::assign(const NdbTablespaceImpl& org)
m_status = org.m_status; m_status = org.m_status;
m_type = org.m_type; m_type = org.m_type;
m_name.assign(org.m_name); if (!m_name.assign(org.m_name))
return -1;
m_grow_spec = org.m_grow_spec; m_grow_spec = org.m_grow_spec;
m_extent_size = org.m_extent_size; m_extent_size = org.m_extent_size;
m_undo_free_words = org.m_undo_free_words; m_undo_free_words = org.m_undo_free_words;
m_logfile_group_id = org.m_logfile_group_id; m_logfile_group_id = org.m_logfile_group_id;
m_logfile_group_version = org.m_logfile_group_version; m_logfile_group_version = org.m_logfile_group_version;
m_logfile_group_name.assign(org.m_logfile_group_name); if (!m_logfile_group_name.assign(org.m_logfile_group_name))
return -1;
m_undo_free_words = org.m_undo_free_words; m_undo_free_words = org.m_undo_free_words;
return 0;
} }
NdbLogfileGroupImpl::NdbLogfileGroupImpl() : NdbLogfileGroupImpl::NdbLogfileGroupImpl() :
...@@ -4506,7 +4534,7 @@ NdbLogfileGroupImpl::NdbLogfileGroupImpl(NdbDictionary::LogfileGroup & f) : ...@@ -4506,7 +4534,7 @@ NdbLogfileGroupImpl::NdbLogfileGroupImpl(NdbDictionary::LogfileGroup & f) :
NdbLogfileGroupImpl::~NdbLogfileGroupImpl(){ NdbLogfileGroupImpl::~NdbLogfileGroupImpl(){
} }
void int
NdbLogfileGroupImpl::assign(const NdbLogfileGroupImpl& org) NdbLogfileGroupImpl::assign(const NdbLogfileGroupImpl& org)
{ {
m_id = org.m_id; m_id = org.m_id;
...@@ -4514,14 +4542,17 @@ NdbLogfileGroupImpl::assign(const NdbLogfileGroupImpl& org) ...@@ -4514,14 +4542,17 @@ NdbLogfileGroupImpl::assign(const NdbLogfileGroupImpl& org)
m_status = org.m_status; m_status = org.m_status;
m_type = org.m_type; m_type = org.m_type;
m_name.assign(org.m_name); if (!m_name.assign(org.m_name))
return -1;
m_grow_spec = org.m_grow_spec; m_grow_spec = org.m_grow_spec;
m_extent_size = org.m_extent_size; m_extent_size = org.m_extent_size;
m_undo_free_words = org.m_undo_free_words; m_undo_free_words = org.m_undo_free_words;
m_logfile_group_id = org.m_logfile_group_id; m_logfile_group_id = org.m_logfile_group_id;
m_logfile_group_version = org.m_logfile_group_version; m_logfile_group_version = org.m_logfile_group_version;
m_logfile_group_name.assign(org.m_logfile_group_name); if (!m_logfile_group_name.assign(org.m_logfile_group_name))
return -1;
m_undo_free_words = org.m_undo_free_words; m_undo_free_words = org.m_undo_free_words;
return 0;
} }
NdbFileImpl::NdbFileImpl(NdbDictionary::Object::Type t) NdbFileImpl::NdbFileImpl(NdbDictionary::Object::Type t)
...@@ -4548,7 +4579,7 @@ NdbDatafileImpl::NdbDatafileImpl(NdbDictionary::Datafile & f) : ...@@ -4548,7 +4579,7 @@ NdbDatafileImpl::NdbDatafileImpl(NdbDictionary::Datafile & f) :
NdbDatafileImpl::~NdbDatafileImpl(){ NdbDatafileImpl::~NdbDatafileImpl(){
} }
void int
NdbDatafileImpl::assign(const NdbDatafileImpl& org) NdbDatafileImpl::assign(const NdbDatafileImpl& org)
{ {
m_id = org.m_id; m_id = org.m_id;
...@@ -4560,8 +4591,10 @@ NdbDatafileImpl::assign(const NdbDatafileImpl& org) ...@@ -4560,8 +4591,10 @@ NdbDatafileImpl::assign(const NdbDatafileImpl& org)
m_free = org.m_free; m_free = org.m_free;
m_filegroup_id = org.m_filegroup_id; m_filegroup_id = org.m_filegroup_id;
m_filegroup_version = org.m_filegroup_version; m_filegroup_version = org.m_filegroup_version;
m_path.assign(org.m_path); if (!m_path.assign(org.m_path) ||
m_filegroup_name.assign(org.m_filegroup_name); !m_filegroup_name.assign(org.m_filegroup_name))
return -1;
return 0;
} }
NdbUndofileImpl::NdbUndofileImpl() : NdbUndofileImpl::NdbUndofileImpl() :
...@@ -4579,7 +4612,7 @@ NdbUndofileImpl::NdbUndofileImpl(NdbDictionary::Undofile & f) : ...@@ -4579,7 +4612,7 @@ NdbUndofileImpl::NdbUndofileImpl(NdbDictionary::Undofile & f) :
NdbUndofileImpl::~NdbUndofileImpl(){ NdbUndofileImpl::~NdbUndofileImpl(){
} }
void int
NdbUndofileImpl::assign(const NdbUndofileImpl& org) NdbUndofileImpl::assign(const NdbUndofileImpl& org)
{ {
m_id = org.m_id; m_id = org.m_id;
...@@ -4591,8 +4624,10 @@ NdbUndofileImpl::assign(const NdbUndofileImpl& org) ...@@ -4591,8 +4624,10 @@ NdbUndofileImpl::assign(const NdbUndofileImpl& org)
m_free = org.m_free; m_free = org.m_free;
m_filegroup_id = org.m_filegroup_id; m_filegroup_id = org.m_filegroup_id;
m_filegroup_version = org.m_filegroup_version; m_filegroup_version = org.m_filegroup_version;
m_path.assign(org.m_path); if (!m_path.assign(org.m_path) ||
m_filegroup_name.assign(org.m_filegroup_name); !m_filegroup_name.assign(org.m_filegroup_name))
return 4000;
return 0;
} }
int int
...@@ -5024,7 +5059,8 @@ NdbDictInterface::get_filegroup(NdbFilegroupImpl & dst, ...@@ -5024,7 +5059,8 @@ NdbDictInterface::get_filegroup(NdbFilegroupImpl & dst,
get_filegroup(NdbLogfileGroupImpl::getImpl(tmp), get_filegroup(NdbLogfileGroupImpl::getImpl(tmp),
NdbDictionary::Object::LogfileGroup, NdbDictionary::Object::LogfileGroup,
dst.m_logfile_group_id); dst.m_logfile_group_id);
dst.m_logfile_group_name.assign(tmp.getName()); if (!dst.m_logfile_group_name.assign(tmp.getName()))
DBUG_RETURN(m_error.code = 4000);
} }
if(dst.m_type == type) if(dst.m_type == type)
...@@ -5058,7 +5094,8 @@ NdbDictInterface::parseFilegroupInfo(NdbFilegroupImpl &dst, ...@@ -5058,7 +5094,8 @@ NdbDictInterface::parseFilegroupInfo(NdbFilegroupImpl &dst,
dst.m_type = (NdbDictionary::Object::Type)fg.FilegroupType; dst.m_type = (NdbDictionary::Object::Type)fg.FilegroupType;
dst.m_status = NdbDictionary::Object::Retrieved; dst.m_status = NdbDictionary::Object::Retrieved;
dst.m_name.assign(fg.FilegroupName); if (!dst.m_name.assign(fg.FilegroupName))
return 4000;
dst.m_extent_size = fg.TS_ExtentSize; dst.m_extent_size = fg.TS_ExtentSize;
dst.m_undo_buffer_size = fg.LF_UndoBufferSize; dst.m_undo_buffer_size = fg.LF_UndoBufferSize;
dst.m_logfile_group_id = fg.TS_LogfileGroupId; dst.m_logfile_group_id = fg.TS_LogfileGroupId;
...@@ -5177,7 +5214,8 @@ NdbDictInterface::get_file(NdbFileImpl & dst, ...@@ -5177,7 +5214,8 @@ NdbDictInterface::get_file(NdbFileImpl & dst,
get_filegroup(NdbLogfileGroupImpl::getImpl(tmp), get_filegroup(NdbLogfileGroupImpl::getImpl(tmp),
NdbDictionary::Object::LogfileGroup, NdbDictionary::Object::LogfileGroup,
dst.m_filegroup_id); dst.m_filegroup_id);
dst.m_filegroup_name.assign(tmp.getName()); if (!dst.m_filegroup_name.assign(tmp.getName()))
DBUG_RETURN(m_error.code = 4000);
} }
else if(dst.m_type == NdbDictionary::Object::Datafile) else if(dst.m_type == NdbDictionary::Object::Datafile)
{ {
...@@ -5185,7 +5223,8 @@ NdbDictInterface::get_file(NdbFileImpl & dst, ...@@ -5185,7 +5223,8 @@ NdbDictInterface::get_file(NdbFileImpl & dst,
get_filegroup(NdbTablespaceImpl::getImpl(tmp), get_filegroup(NdbTablespaceImpl::getImpl(tmp),
NdbDictionary::Object::Tablespace, NdbDictionary::Object::Tablespace,
dst.m_filegroup_id); dst.m_filegroup_id);
dst.m_filegroup_name.assign(tmp.getName()); if (!dst.m_filegroup_name.assign(tmp.getName()))
DBUG_RETURN(m_error.code = 4000);
dst.m_free *= tmp.getExtentSize(); dst.m_free *= tmp.getExtentSize();
} }
else else
...@@ -5221,7 +5260,8 @@ NdbDictInterface::parseFileInfo(NdbFileImpl &dst, ...@@ -5221,7 +5260,8 @@ NdbDictInterface::parseFileInfo(NdbFileImpl &dst,
dst.m_version = f.FileVersion; dst.m_version = f.FileVersion;
dst.m_size= ((Uint64)f.FileSizeHi << 32) | (f.FileSizeLo); dst.m_size= ((Uint64)f.FileSizeHi << 32) | (f.FileSizeLo);
dst.m_path.assign(f.FileName); if (!dst.m_path.assign(f.FileName))
return 4000;
dst.m_filegroup_id= f.FilegroupId; dst.m_filegroup_id= f.FilegroupId;
dst.m_filegroup_version= f.FilegroupVersion; dst.m_filegroup_version= f.FilegroupVersion;
......
...@@ -135,24 +135,24 @@ public: ...@@ -135,24 +135,24 @@ public:
const char * getName() const; const char * getName() const;
void setFragmentCount(Uint32 count); void setFragmentCount(Uint32 count);
Uint32 getFragmentCount() const; Uint32 getFragmentCount() const;
void setFrm(const void* data, Uint32 len); int setFrm(const void* data, Uint32 len);
const void * getFrmData() const; const void * getFrmData() const;
Uint32 getFrmLength() const; Uint32 getFrmLength() const;
void setFragmentData(const void* data, Uint32 len); int setFragmentData(const void* data, Uint32 len);
const void * getFragmentData() const; const void * getFragmentData() const;
Uint32 getFragmentDataLen() const; Uint32 getFragmentDataLen() const;
void setTablespaceNames(const void* data, Uint32 len); int setTablespaceNames(const void* data, Uint32 len);
Uint32 getTablespaceNamesLen() const; Uint32 getTablespaceNamesLen() const;
const void * getTablespaceNames() const; const void * getTablespaceNames() const;
void setTablespaceData(const void* data, Uint32 len); int setTablespaceData(const void* data, Uint32 len);
const void * getTablespaceData() const; const void * getTablespaceData() const;
Uint32 getTablespaceDataLen() const; Uint32 getTablespaceDataLen() const;
void setRangeListData(const void* data, Uint32 len); int setRangeListData(const void* data, Uint32 len);
const void * getRangeListData() const; const void * getRangeListData() const;
Uint32 getRangeListDataLen() const; Uint32 getRangeListDataLen() const;
const char * getMysqlName() const; const char * getMysqlName() const;
void updateMysqlName(); int updateMysqlName();
int aggregate(NdbError& error); int aggregate(NdbError& error);
int validate(NdbError& error); int validate(NdbError& error);
...@@ -296,11 +296,11 @@ public: ...@@ -296,11 +296,11 @@ public:
~NdbEventImpl(); ~NdbEventImpl();
void init(); void init();
void setName(const char * name); int setName(const char * name);
const char * getName() const; const char * getName() const;
void setTable(const NdbDictionary::Table& table); int setTable(const NdbDictionary::Table& table);
const NdbDictionary::Table * getTable() const; const NdbDictionary::Table * getTable() const;
void setTable(const char * table); int setTable(const char * table);
const char * getTableName() const; const char * getTableName() const;
void addTableEvent(const NdbDictionary::Event::TableEvent t); void addTableEvent(const NdbDictionary::Event::TableEvent t);
bool getTableEvent(const NdbDictionary::Event::TableEvent t) const; bool getTableEvent(const NdbDictionary::Event::TableEvent t) const;
...@@ -364,7 +364,7 @@ public: ...@@ -364,7 +364,7 @@ public:
NdbTablespaceImpl(NdbDictionary::Tablespace &); NdbTablespaceImpl(NdbDictionary::Tablespace &);
~NdbTablespaceImpl(); ~NdbTablespaceImpl();
void assign(const NdbTablespaceImpl&); int assign(const NdbTablespaceImpl&);
static NdbTablespaceImpl & getImpl(NdbDictionary::Tablespace & t); static NdbTablespaceImpl & getImpl(NdbDictionary::Tablespace & t);
static const NdbTablespaceImpl & getImpl(const NdbDictionary::Tablespace &); static const NdbTablespaceImpl & getImpl(const NdbDictionary::Tablespace &);
...@@ -378,7 +378,7 @@ public: ...@@ -378,7 +378,7 @@ public:
NdbLogfileGroupImpl(NdbDictionary::LogfileGroup &); NdbLogfileGroupImpl(NdbDictionary::LogfileGroup &);
~NdbLogfileGroupImpl(); ~NdbLogfileGroupImpl();
void assign(const NdbLogfileGroupImpl&); int assign(const NdbLogfileGroupImpl&);
static NdbLogfileGroupImpl & getImpl(NdbDictionary::LogfileGroup & t); static NdbLogfileGroupImpl & getImpl(NdbDictionary::LogfileGroup & t);
static const NdbLogfileGroupImpl& getImpl(const static const NdbLogfileGroupImpl& getImpl(const
...@@ -403,7 +403,7 @@ public: ...@@ -403,7 +403,7 @@ public:
NdbDatafileImpl(NdbDictionary::Datafile &); NdbDatafileImpl(NdbDictionary::Datafile &);
~NdbDatafileImpl(); ~NdbDatafileImpl();
void assign(const NdbDatafileImpl&); int assign(const NdbDatafileImpl&);
static NdbDatafileImpl & getImpl(NdbDictionary::Datafile & t); static NdbDatafileImpl & getImpl(NdbDictionary::Datafile & t);
static const NdbDatafileImpl & getImpl(const NdbDictionary::Datafile & t); static const NdbDatafileImpl & getImpl(const NdbDictionary::Datafile & t);
...@@ -416,7 +416,7 @@ public: ...@@ -416,7 +416,7 @@ public:
NdbUndofileImpl(NdbDictionary::Undofile &); NdbUndofileImpl(NdbDictionary::Undofile &);
~NdbUndofileImpl(); ~NdbUndofileImpl();
void assign(const NdbUndofileImpl&); int assign(const NdbUndofileImpl&);
static NdbUndofileImpl & getImpl(NdbDictionary::Undofile & t); static NdbUndofileImpl & getImpl(NdbDictionary::Undofile & t);
static const NdbUndofileImpl & getImpl(const NdbDictionary::Undofile & t); static const NdbUndofileImpl & getImpl(const NdbDictionary::Undofile & t);
...@@ -994,8 +994,9 @@ public: ...@@ -994,8 +994,9 @@ public:
if(NdbDictInterface::create_index_obj_from_table(&idx, &tab, &m_prim) == 0) if(NdbDictInterface::create_index_obj_from_table(&idx, &tab, &m_prim) == 0)
{ {
idx->m_table = &tab; idx->m_table = &tab;
idx->m_externalName.assign(m_index_name); if (!idx->m_externalName.assign(m_index_name) ||
idx->m_internalName.assign(m_name); !idx->m_internalName.assign(m_name))
DBUG_RETURN(4000);
tab.m_index = idx; tab.m_index = idx;
DBUG_RETURN(0); DBUG_RETURN(0);
} }
......
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