summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <tomas@poseidon.mysql.com>2007-03-09 15:37:10 +0700
committerunknown <tomas@poseidon.mysql.com>2007-03-09 15:37:10 +0700
commit582221604e8e567e154ce499bd09e0204b965e39 (patch)
tree1cd5643aded0f2f47cab07acb5add813a589c370
parenta58b9b050a4ca36bc6c7617476811bb7f23fc7c7 (diff)
downloadmariadb-git-582221604e8e567e154ce499bd09e0204b965e39.tar.gz
Bug #25275 SINGLE USER MODE prevents ALTER on non-ndb tables for other mysqld nodes
- correction of part 1 add ndb_waiter option to wait for single user mode ndb/src/kernel/blocks/dbdict/Dbdict.cpp: Bug #25275 SINGLE USER MODE prevents ALTER on non-ndb tables for other mysqld nodes - correction of part 1 ndb/src/kernel/blocks/dbdict/Dbdict.hpp: Bug #25275 SINGLE USER MODE prevents ALTER on non-ndb tables for other mysqld nodes - correction of part 1 ndb/tools/waiter.cpp: add ndb_waiter option to wait for single user mode
-rw-r--r--ndb/src/kernel/blocks/dbdict/Dbdict.cpp36
-rw-r--r--ndb/src/kernel/blocks/dbdict/Dbdict.hpp2
-rw-r--r--ndb/tools/waiter.cpp12
3 files changed, 34 insertions, 16 deletions
diff --git a/ndb/src/kernel/blocks/dbdict/Dbdict.cpp b/ndb/src/kernel/blocks/dbdict/Dbdict.cpp
index 16964ec443f..b125f8d988d 100644
--- a/ndb/src/kernel/blocks/dbdict/Dbdict.cpp
+++ b/ndb/src/kernel/blocks/dbdict/Dbdict.cpp
@@ -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);
@@ -5419,9 +5415,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);
@@ -6558,9 +6552,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;
@@ -7135,9 +7127,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;
@@ -10579,4 +10569,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;
diff --git a/ndb/src/kernel/blocks/dbdict/Dbdict.hpp b/ndb/src/kernel/blocks/dbdict/Dbdict.hpp
index 49b85affdcd..6fda440f753 100644
--- a/ndb/src/kernel/blocks/dbdict/Dbdict.hpp
+++ b/ndb/src/kernel/blocks/dbdict/Dbdict.hpp
@@ -1997,6 +1997,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
diff --git a/ndb/tools/waiter.cpp b/ndb/tools/waiter.cpp
index a3a986b2929..e221a26182e 100644
--- a/ndb/tools/waiter.cpp
+++ b/ndb/tools/waiter.cpp
@@ -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;