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