Commit f1fde80a authored by unknown's avatar unknown

ndb -

  fix all valgrind warnings in t/ndb_dd (except replication related)


sql/ha_ndbcluster.cc:
  Fix memleak
storage/ndb/include/kernel/signaldata/DictTabInfo.hpp:
  Fix valgrind warning
storage/ndb/include/kernel/signaldata/DropFilegroup.hpp:
  Fix valgrind warning
storage/ndb/src/common/debugger/signaldata/DictTabInfo.cpp:
  Fix valgrind warning
storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp:
  Fix valgrind warning
storage/ndb/src/kernel/blocks/dbdict/Dbdict.hpp:
  Fix valgrind warning
storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp:
  Fix valgrind warning
storage/ndb/src/ndbapi/ndberror.c:
  Fix valgrind warning
parent d94f4a42
......@@ -5733,7 +5733,6 @@ int ndbcluster_find_all_files(THD *thd)
DBUG_ENTER("ndbcluster_find_all_files");
Ndb* ndb;
char key[FN_REFLEN];
NdbDictionary::Dictionary::List list;
if (!(ndb= check_ndb_in_thd(thd)))
DBUG_RETURN(HA_ERR_NO_CONNECTION);
......@@ -5743,6 +5742,7 @@ int ndbcluster_find_all_files(THD *thd)
int unhandled, retries= 5;
do
{
NdbDictionary::Dictionary::List list;
if (dict->listObjects(list, NdbDictionary::Object::UserTable) != 0)
ERR_RETURN(dict->getNdbError());
unhandled= 0;
......@@ -10029,14 +10029,15 @@ static int ndbcluster_fill_files_table(THD *thd, TABLE_LIST *tables, COND *cond)
}
}
dict->listObjects(dflist, NdbDictionary::Object::Undofile);
NdbDictionary::Dictionary::List uflist;
dict->listObjects(uflist, NdbDictionary::Object::Undofile);
ndberr= dict->getNdbError();
if (ndberr.classification != NdbError::NoError)
ERR_RETURN(ndberr);
for (i= 0; i < dflist.count; i++)
for (i= 0; i < uflist.count; i++)
{
NdbDictionary::Dictionary::List::Element& elt= dflist.elements[i];
NdbDictionary::Dictionary::List::Element& elt= uflist.elements[i];
Ndb_cluster_connection_node_iter iter;
unsigned id;
......
......@@ -586,7 +586,8 @@ public:
enum Unimplemented
{
ScanOptimised = 15, //Default updateOptimised
AttributeGroup = 1012 //Default 0
AttributeGroup = 1012, //Default 0
FileNo = 102
};
};
......@@ -618,13 +619,13 @@ struct DictFilegroupInfo {
*/
FileName = 100,
FileType = 101,
FileId = 102,
FileNo = 103, // Per Filegroup
FileId = 103,
FileFGroupId = 104,
FileFGroupVersion = 105,
FileSizeHi = 106,
FileSizeLo = 107,
FileFreeExtents = 108,
FileVersion = 109,
FileEnd = 199, //
/**
......@@ -696,8 +697,8 @@ struct DictFilegroupInfo {
struct File {
char FileName[PATH_MAX];
Uint32 FileType;
Uint32 FileNo;
Uint32 FileId;
Uint32 FileVersion;
Uint32 FilegroupId;
Uint32 FilegroupVersion;
Uint32 FileSizeHi;
......
......@@ -66,9 +66,10 @@ struct DropFilegroupRef {
Busy = 701,
NotMaster = 702,
NoSuchFilegroup = 767,
FilegroupInUse = 768
FilegroupInUse = 768,
InvalidSchemaObjectVersion = 774
};
Uint32 senderData;
Uint32 senderRef;
Uint32 masterNodeId;
......@@ -150,7 +151,8 @@ struct DropFileRef {
NoError = 0,
Busy = 701,
NoSuchFile = 766,
DropUndoFileNotSupported = 769
DropUndoFileNotSupported = 769,
InvalidSchemaObjectVersion = 774
};
Uint32 senderData;
......
......@@ -216,8 +216,8 @@ SimpleProperties::SP2StructMapping
DictFilegroupInfo::FileMapping[] = {
DFGIMAPS(File, FileName, FileName, 0, PATH_MAX),
DFGIMAP2(File, FileType, FileType, 0, 1),
DFGIMAP(File, FileNo, FileNo),
DFGIMAP(File, FileId, FileId),
DFGIMAP(File, FileVersion, FileVersion),
DFGIMAP(File, FileFGroupId, FilegroupId),
DFGIMAP(File, FileFGroupVersion, FilegroupVersion),
DFGIMAP(File, FileSizeHi, FileSizeHi),
......@@ -254,8 +254,8 @@ void
DictFilegroupInfo::File::init(){
memset(FileName, sizeof(FileName), 0);
FileType = ~0;
FileNo = ~0;
FileId = ~0;
FileVersion = ~0;
FilegroupId = ~0;
FilegroupVersion = ~0;
FileSizeHi = 0;
......
......@@ -631,7 +631,8 @@ Dbdict::packFileIntoPages(SimpleProperties::Writer & w,
f.FileSizeHi = (f_ptr.p->m_file_size >> 32);
f.FileSizeLo = (f_ptr.p->m_file_size & 0xFFFFFFFF);
f.FileFreeExtents= free_extents;
f.FileNo = f_ptr.p->key;
f.FileId = f_ptr.p->key;
f.FileVersion = f_ptr.p->m_version;
FilegroupPtr lfg_ptr;
ndbrequire(c_filegroup_hash.find(lfg_ptr, f.FilegroupId));
......@@ -13588,6 +13589,13 @@ Dbdict::execDROP_FILE_REQ(Signal* signal)
break;
}
if (file_ptr.p->m_version != version)
{
ref->errorCode = DropFileRef::InvalidSchemaObjectVersion;
ref->errorLine = __LINE__;
break;
}
Ptr<SchemaTransaction> trans_ptr;
if (! c_Trans.seize(trans_ptr))
{
......@@ -13662,6 +13670,13 @@ Dbdict::execDROP_FILEGROUP_REQ(Signal* signal)
ref->errorLine = __LINE__;
break;
}
if (filegroup_ptr.p->m_version != version)
{
ref->errorCode = DropFilegroupRef::InvalidSchemaObjectVersion;
ref->errorLine = __LINE__;
break;
}
Ptr<SchemaTransaction> trans_ptr;
if (! c_Trans.seize(trans_ptr))
......@@ -15095,6 +15110,7 @@ Dbdict::create_file_prepare_start(Signal* signal, SchemaOp* op){
filePtr.p->m_obj_ptr_i = obj_ptr.i;
filePtr.p->m_filegroup_id = f.FilegroupId;
filePtr.p->m_type = f.FileType;
filePtr.p->m_version = op->m_obj_version;
obj_ptr.p->m_id = op->m_obj_id;
obj_ptr.p->m_type = f.FileType;
......
......@@ -535,6 +535,7 @@ public:
Uint32 key;
Uint32 m_magic;
Uint32 m_version;
Uint32 m_obj_ptr_i;
Uint32 m_filegroup_id;
Uint32 m_type;
......
......@@ -4632,7 +4632,7 @@ NdbDictInterface::get_filegroup(NdbFilegroupImpl & dst,
m_buffer.clear();
m_buffer.append(name, strLen);
m_buffer.append(&pad, 4);
ptr[0].p = m_buffer.get_data();
ptr[0].p = (Uint32*)m_buffer.get_data();
}
#endif
......@@ -4642,6 +4642,9 @@ NdbDictInterface::get_filegroup(NdbFilegroupImpl & dst,
DICT_WAITFOR_TIMEOUT, 100);
if (r)
{
dst.m_id = -1;
dst.m_version = ~0;
DBUG_PRINT("info", ("get_filegroup failed dictSignal"));
DBUG_RETURN(-1);
}
......@@ -4785,7 +4788,7 @@ NdbDictInterface::get_file(NdbFileImpl & dst,
m_buffer.clear();
m_buffer.append(name, strLen);
m_buffer.append(&pad, 4);
ptr[0].p = m_buffer.get_data();
ptr[0].p = (Uint32*)m_buffer.get_data();
}
#endif
......@@ -4856,7 +4859,8 @@ NdbDictInterface::parseFileInfo(NdbFileImpl &dst,
}
dst.m_type= (NdbDictionary::Object::Type)f.FileType;
dst.m_id= f.FileNo;
dst.m_id= f.FileId;
dst.m_version = f.FileVersion;
dst.m_size= ((Uint64)f.FileSizeHi << 32) | (f.FileSizeLo);
dst.m_path.assign(f.FileName);
......
......@@ -386,6 +386,7 @@ ErrorBundle ErrorCodes[] = {
{ 768, DMEC, SE, "Cant drop filegroup, filegroup is used" },
{ 769, DMEC, SE, "Drop undofile not supported, drop logfile group instead" },
{ 770, DMEC, SE, "Cant drop file, file is used" },
{ 774, DMEC, SE, "Invalid schema object for drop" },
{ 241, HA_ERR_TABLE_DEF_CHANGED, SE, "Invalid schema object version" },
{ 283, HA_ERR_NO_SUCH_TABLE, SE, "Table is being dropped" },
{ 284, HA_ERR_TABLE_DEF_CHANGED, SE, "Table not defined in transaction coordinator" },
......
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