Commit 6b9f1ef2 authored by unknown's avatar unknown

Merge poseidon.mysql.com:/home/tomas/mysql-5.0-ndb-clean

into  poseidon.mysql.com:/home/tomas/mysql-5.0

parents d6bd171f 9565e8cd
......@@ -2910,9 +2910,7 @@ Dbdict::execCREATE_TABLE_REQ(Signal* signal){
break;
}
if(getNodeState().getSingleUserMode() &&
(refToNode(signal->getSendersBlockRef()) !=
getNodeState().getSingleUserApi()))
if (checkSingleUserMode(signal->getSendersBlockRef()))
{
jam();
parseRecord.errorCode = CreateTableRef::SingleUser;
......@@ -3081,9 +3079,7 @@ Dbdict::execALTER_TABLE_REQ(Signal* signal)
return;
}
if(getNodeState().getSingleUserMode() &&
(refToNode(signal->getSendersBlockRef()) !=
getNodeState().getSingleUserApi()))
if (checkSingleUserMode(signal->getSendersBlockRef()))
{
jam();
alterTableRef(signal, req, AlterTableRef::SingleUser);
......@@ -5414,9 +5410,7 @@ Dbdict::execDROP_TABLE_REQ(Signal* signal){
return;
}
if(getNodeState().getSingleUserMode() &&
(refToNode(signal->getSendersBlockRef()) !=
getNodeState().getSingleUserApi()))
if (checkSingleUserMode(signal->getSendersBlockRef()))
{
jam();
dropTableRef(signal, req, DropTableRef::SingleUser);
......@@ -6553,9 +6547,7 @@ Dbdict::execCREATE_INDX_REQ(Signal* signal)
jam();
tmperr = CreateIndxRef::Busy;
}
else if(getNodeState().getSingleUserMode() &&
(refToNode(senderRef) !=
getNodeState().getSingleUserApi()))
else if (checkSingleUserMode(senderRef))
{
jam();
tmperr = CreateIndxRef::SingleUser;
......@@ -7130,9 +7122,7 @@ Dbdict::execDROP_INDX_REQ(Signal* signal)
jam();
tmperr = DropIndxRef::Busy;
}
else if(getNodeState().getSingleUserMode() &&
(refToNode(senderRef) !=
getNodeState().getSingleUserApi()))
else if (checkSingleUserMode(senderRef))
{
jam();
tmperr = DropIndxRef::SingleUser;
......@@ -10574,4 +10564,20 @@ Dbdict::getMetaAttribute(MetaData::Attribute& attr, const MetaData::Table& table
return 0;
}
/*
return 1 if all of the below is true
a) node in single user mode
b) senderRef is not a db node
c) senderRef nodeid is not the singleUserApi
*/
int Dbdict::checkSingleUserMode(Uint32 senderRef)
{
Uint32 nodeId = refToNode(senderRef);
return
getNodeState().getSingleUserMode() &&
(getNodeInfo(nodeId).m_type != NodeInfo::DB) &&
(nodeId != getNodeState().getSingleUserApi());
}
CArray<KeyDescriptor> g_key_descriptor_pool;
......@@ -2003,6 +2003,8 @@ private:
int getMetaTable(MetaData::Table& table, const char* tableName);
int getMetaAttribute(MetaData::Attribute& attribute, const MetaData::Table& table, Uint32 attributeId);
int getMetaAttribute(MetaData::Attribute& attribute, const MetaData::Table& table, const char* attributeName);
int checkSingleUserMode(Uint32 senderRef);
};
#endif
......@@ -192,8 +192,7 @@ NdbOut& operator<<(NdbOut& out, const NdbRecAttr &r)
if (j > 0)
out << " ";
switch(r.getType())
{
switch(r.getType()){
case NdbDictionary::Column::Bigunsigned:
out << r.u_64_value();
break;
......@@ -222,12 +221,12 @@ NdbOut& operator<<(NdbOut& out, const NdbRecAttr &r)
out << (int) r.char_value();
break;
case NdbDictionary::Column::Binary:
ndbrecattr_print_string(out,"Binary",r.aRef(),r.arraySize());
j = r.arraySize();
ndbrecattr_print_string(out,"Binary", r.aRef(), j);
break;
case NdbDictionary::Column::Char:
ndbrecattr_print_string(out,"Char",r.aRef(),r.arraySize());
j = length;
ndbrecattr_print_string(out,"Char", r.aRef(), r.arraySize());
break;
case NdbDictionary::Column::Varchar:
{
......@@ -374,8 +373,13 @@ NdbOut& operator<<(NdbOut& out, const NdbRecAttr &r)
j = length;
}
break;
case NdbDictionary::Column::Undefined:
case NdbDictionary::Column::Mediumint:
case NdbDictionary::Column::Mediumunsigned:
case NdbDictionary::Column::Longvarbinary:
unknown:
default: /* no print functions for the rest, just print type */
//default: /* no print functions for the rest, just print type */
out << (int) r.getType();
j = length;
if (j > 1)
......
......@@ -30,12 +30,14 @@ waitClusterStatus(const char* _addr, ndb_mgm_node_status _status,
unsigned int _timeout);
enum ndb_waiter_options {
OPT_WAIT_STATUS_NOT_STARTED = NDB_STD_OPTIONS_LAST
OPT_WAIT_STATUS_NOT_STARTED = NDB_STD_OPTIONS_LAST,
OPT_WAIT_STATUS_SINGLE_USER
};
NDB_STD_OPTS_VARS;
static int _no_contact = 0;
static int _not_started = 0;
static int _single_user = 0;
static int _timeout = 120;
const char *load_default_groups[]= { "mysql_cluster",0 };
......@@ -49,6 +51,10 @@ static struct my_option my_long_options[] =
{ "not-started", OPT_WAIT_STATUS_NOT_STARTED, "Wait for cluster not started",
(gptr*) &_not_started, (gptr*) &_not_started, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
{ "single-user", OPT_WAIT_STATUS_SINGLE_USER,
"Wait for cluster to enter single user mode",
(gptr*) &_single_user, (gptr*) &_single_user, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
{ "timeout", 't', "Timeout to wait",
(gptr*) &_timeout, (gptr*) &_timeout, 0,
GET_INT, REQUIRED_ARG, 120, 0, 0, 0, 0, 0 },
......@@ -90,6 +96,10 @@ int main(int argc, char** argv){
{
wait_status= NDB_MGM_NODE_STATUS_NOT_STARTED;
}
else if (_single_user)
{
wait_status= NDB_MGM_NODE_STATUS_SINGLEUSER;
}
else
{
wait_status= NDB_MGM_NODE_STATUS_STARTED;
......
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