Commit 6f8760fa authored by unknown's avatar unknown

Merge joreland@bk-internal.mysql.com:/home/bk/mysql-5.1-new-ndb

into  perch.ndb.mysql.com:/home/jonas/src/mysql-5.1-new-ndb


sql/ha_ndbcluster.cc:
  Auto merged
parents ae445b86 514a5a7f
...@@ -5789,7 +5789,6 @@ int ndbcluster_find_all_files(THD *thd) ...@@ -5789,7 +5789,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);
...@@ -5799,6 +5798,7 @@ int ndbcluster_find_all_files(THD *thd) ...@@ -5799,6 +5798,7 @@ int ndbcluster_find_all_files(THD *thd)
int unhandled, retries= 5, skipped; int unhandled, retries= 5, skipped;
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;
...@@ -10082,14 +10082,15 @@ static int ndbcluster_fill_files_table(THD *thd, TABLE_LIST *tables, COND *cond) ...@@ -10082,14 +10082,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;
......
...@@ -143,12 +143,13 @@ Backup::execREAD_CONFIG_REQ(Signal* signal) ...@@ -143,12 +143,13 @@ Backup::execREAD_CONFIG_REQ(Signal* signal)
m_ctx.m_config.getOwnConfigIterator(); m_ctx.m_config.getOwnConfigIterator();
ndbrequire(p != 0); ndbrequire(p != 0);
Uint32 noBackups = 0, noTables = 0, noAttribs = 0; Uint32 noBackups = 0, noTables = 0, noAttribs = 0, noFrags = 0;
ndbrequire(!ndb_mgm_get_int_parameter(p, CFG_DB_DISCLESS, &m_diskless)); ndbrequire(!ndb_mgm_get_int_parameter(p, CFG_DB_DISCLESS, &m_diskless));
ndb_mgm_get_int_parameter(p, CFG_DB_PARALLEL_BACKUPS, &noBackups); ndb_mgm_get_int_parameter(p, CFG_DB_PARALLEL_BACKUPS, &noBackups);
// ndbrequire(!ndb_mgm_get_int_parameter(p, CFG_DB_NO_TABLES, &noTables)); // ndbrequire(!ndb_mgm_get_int_parameter(p, CFG_DB_NO_TABLES, &noTables));
ndbrequire(!ndb_mgm_get_int_parameter(p, CFG_DICT_TABLE, &noTables)); ndbrequire(!ndb_mgm_get_int_parameter(p, CFG_DICT_TABLE, &noTables));
ndbrequire(!ndb_mgm_get_int_parameter(p, CFG_DB_NO_ATTRIBUTES, &noAttribs)); ndbrequire(!ndb_mgm_get_int_parameter(p, CFG_DB_NO_ATTRIBUTES, &noAttribs));
ndbrequire(!ndb_mgm_get_int_parameter(p, CFG_DIH_FRAG_CONNECT, &noFrags));
noAttribs++; //RT 527 bug fix noAttribs++; //RT 527 bug fix
...@@ -158,9 +159,7 @@ Backup::execREAD_CONFIG_REQ(Signal* signal) ...@@ -158,9 +159,7 @@ Backup::execREAD_CONFIG_REQ(Signal* signal)
c_tablePool.setSize(noBackups * noTables + 1); c_tablePool.setSize(noBackups * noTables + 1);
c_attributePool.setSize(noBackups * noAttribs + MAX_ATTRIBUTES_IN_TABLE); c_attributePool.setSize(noBackups * noAttribs + MAX_ATTRIBUTES_IN_TABLE);
c_triggerPool.setSize(noBackups * 3 * noTables); c_triggerPool.setSize(noBackups * 3 * noTables);
c_fragmentPool.setSize(noBackups * noFrags + 1);
// 2 = no of replicas
c_fragmentPool.setSize(noBackups * NO_OF_FRAG_PER_NODE * noTables + 1);
Uint32 szDataBuf = (2 * 1024 * 1024); Uint32 szDataBuf = (2 * 1024 * 1024);
Uint32 szLogBuf = (2 * 1024 * 1024); Uint32 szLogBuf = (2 * 1024 * 1024);
......
...@@ -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;
......
...@@ -4624,13 +4624,27 @@ NdbDictInterface::get_filegroup(NdbFilegroupImpl & dst, ...@@ -4624,13 +4624,27 @@ NdbDictInterface::get_filegroup(NdbFilegroupImpl & dst,
LinearSectionPtr ptr[1]; LinearSectionPtr ptr[1];
ptr[0].p = (Uint32*)name; ptr[0].p = (Uint32*)name;
ptr[0].sz = (strLen + 3)/4; ptr[0].sz = (strLen + 3)/4;
#ifndef IGNORE_VALGRIND_WARNINGS
if (strLen & 3)
{
Uint32 pad = 0;
m_buffer.clear();
m_buffer.append(name, strLen);
m_buffer.append(&pad, 4);
ptr[0].p = (Uint32*)m_buffer.get_data();
}
#endif
int r = dictSignal(&tSignal, ptr, 1, int r = dictSignal(&tSignal, ptr, 1,
-1, // any node -1, // any node
WAIT_GET_TAB_INFO_REQ, WAIT_GET_TAB_INFO_REQ,
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);
} }
...@@ -4766,7 +4780,18 @@ NdbDictInterface::get_file(NdbFileImpl & dst, ...@@ -4766,7 +4780,18 @@ NdbDictInterface::get_file(NdbFileImpl & dst,
LinearSectionPtr ptr[1]; LinearSectionPtr ptr[1];
ptr[0].p = (Uint32*)name; ptr[0].p = (Uint32*)name;
ptr[0].sz = (strLen + 3)/4; ptr[0].sz = (strLen + 3)/4;
#ifndef IGNORE_VALGRIND_WARNINGS
if (strLen & 3)
{
Uint32 pad = 0;
m_buffer.clear();
m_buffer.append(name, strLen);
m_buffer.append(&pad, 4);
ptr[0].p = (Uint32*)m_buffer.get_data();
}
#endif
int r = dictSignal(&tSignal, ptr, 1, int r = dictSignal(&tSignal, ptr, 1,
node, node,
WAIT_GET_TAB_INFO_REQ, WAIT_GET_TAB_INFO_REQ,
...@@ -4834,7 +4859,8 @@ NdbDictInterface::parseFileInfo(NdbFileImpl &dst, ...@@ -4834,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