Commit f8c9cef1 authored by unknown's avatar unknown

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)


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