Rename Being Drained to Draining
With this, the words are unique and can be searched for more easily. This does not fix the test failure of mxs2273_being_drained.
This commit is contained in:
parent
02bdc5ef4d
commit
858327acf7
@ -38,7 +38,7 @@ Status | Description
|
||||
Running | The server is running.
|
||||
Master | The server is the master.
|
||||
Slave | The server is a slave.
|
||||
Being Drained | The server is being drained. Existing connections can continue to be used, but no new connections will be created to the server. Typically this status bit is turned on manually using _maxctrl_, but a monitor may also turn it on.
|
||||
Draining | The server is being drained. Existing connections can continue to be used, but no new connections will be created to the server. Typically this status bit is turned on manually using _maxctrl_, but a monitor may also turn it on.
|
||||
Drained | The server has been drained. The server was being drained and now the number of connections to the server has dropped to 0.
|
||||
Maintenance | The server is under maintenance. Typically this status bit is turned on manually using _maxctrl_, but it will also be turned on for a server that for some reason is blocking connections from MaxScale. When a server is in maintenace mode, no connections will be created to it and existing connections will be closed.
|
||||
Slave of External Master | The server is a slave of a master that is not being monitored.
|
||||
|
@ -121,7 +121,7 @@ be softfailed like
|
||||
$ maxctrl call command clustrixmon softfail TheClustrixMonitor @@TheClustrixMonitor:node-1
|
||||
```
|
||||
If a node is successfully softfailed, then the status of the corresponding
|
||||
MaxScale server object will be set to `Being Drained`, which will prevent
|
||||
MaxScale server object will be set to `Draining`, which will prevent
|
||||
new connections from being created to the node.
|
||||
|
||||
### `unsoftfail`
|
||||
@ -136,7 +136,7 @@ like:
|
||||
```
|
||||
$ maxctrl call command clustrixmon unsoftfail TheClustrixMonitor @@TheClustrixMonitor:node-1
|
||||
```
|
||||
If a node is successfully softfailed, then a `Being Drained` status of
|
||||
If a node is successfully softfailed, then a `Draining` status of
|
||||
the corresponding MaxScale server object will be cleared.
|
||||
|
||||
## SOFTFAILed nodes
|
||||
@ -144,13 +144,13 @@ the corresponding MaxScale server object will be cleared.
|
||||
During the cluster check, which is performed once per
|
||||
`cluster_monitor_interval`, the monitor will also check whether any
|
||||
nodes are being softfailed. The status of the corresponding server
|
||||
object of a node being softfailed will be set to `Being Drained`,
|
||||
object of a node being softfailed will be set to `Draining`,
|
||||
which will prevent new connections from being created to that node.
|
||||
|
||||
If a node that was softfailed is UNSOFTFAILed then the `Being Drained`
|
||||
If a node that was softfailed is UNSOFTFAILed then the `Draining`
|
||||
status will be cleared.
|
||||
|
||||
If the softfailing and unsoftfailing is initiated using the `softfail`
|
||||
and `unsoftfail` commands of the Clustrix monitor, then there will be
|
||||
no delay between the softfailing or unsoftfailing being initated and the
|
||||
`Being Drained` status being turned on/off.
|
||||
`Draining` status being turned on/off.
|
||||
|
@ -30,26 +30,26 @@ connections to the server can continue to be used but new connections
|
||||
are no longer created to the server.
|
||||
|
||||
In the output of `maxctrl`, the fact that a server is being drained
|
||||
is visible in the `State` column as the value `Being Drained`.
|
||||
is visible in the `State` column as the value `Draining`.
|
||||
```
|
||||
┌─────────┬─────────────────┬──────┬─────────────┬───────────────────────────────┬───────┐
|
||||
│ Server │ Address │ Port │ Connections │ State │ GTID │
|
||||
├─────────┼─────────────────┼──────┼─────────────┼───────────────────────────────┼───────┤
|
||||
│ Server1 │ 192.168.121.159 │ 3306 │ 2 │ Master, Running │ 0-1-6 │
|
||||
├─────────┼─────────────────┼──────┼─────────────┼───────────────────────────────┼───────┤
|
||||
│ Server2 │ 192.168.121.80 │ 3306 │ 1 │ Being Drained, Slave, Running │ 0-1-6 │
|
||||
│ Server2 │ 192.168.121.80 │ 3306 │ 1 │ Draining, Slave, Running │ 0-1-6 │
|
||||
├─────────┼─────────────────┼──────┼─────────────┼───────────────────────────────┼───────┤
|
||||
│ Server3 │ 192.168.121.122 │ 3306 │ 2 │ Slave, Running │ 0-1-6 │
|
||||
├─────────┼─────────────────┼──────┼─────────────┼───────────────────────────────┼───────┤
|
||||
│ Server4 │ 192.168.121.144 │ 3306 │ 2 │ Slave, Running │ 0-1-6 │
|
||||
└─────────┴─────────────────┴──────┴─────────────┴───────────────────────────────┴───────┘
|
||||
```
|
||||
A server is set in the _being drained_ state the same way as it is
|
||||
set in the _maintenance_ state:
|
||||
A server is set in the _Draining_ state the same way as it is
|
||||
set in the _Maintenance_ state:
|
||||
```
|
||||
$ maxctrl set server Server2 drain
|
||||
```
|
||||
Note that although the state is displayed as `Being Drained`, when setting
|
||||
Note that although the state is displayed as `Draining`, when setting
|
||||
and clearing the state, the word `drain` is used.
|
||||
|
||||
Note that the full implication of draining a server depends upon
|
||||
|
@ -47,7 +47,7 @@ extern const char* DEFAULT_RANK;
|
||||
#define SERVER_AUTH_ERROR (1 << 2) /**<< Authentication error from monitor */
|
||||
#define SERVER_MASTER (1 << 3) /**<< The server is a master, i.e. can handle writes */
|
||||
#define SERVER_SLAVE (1 << 4) /**<< The server is a slave, i.e. can handle reads */
|
||||
#define SERVER_BEING_DRAINED (1 << 5) /**<< The server is being drained, i.e. no new connection should be created. */
|
||||
#define SERVER_DRAINING (1 << 5) /**<< The server is being drained, i.e. no new connection should be created. */
|
||||
#define SERVER_DISK_SPACE_EXHAUSTED (1 << 6) /**<< The disk space of the server is exhausted */
|
||||
// Bits used by MariaDB Monitor (mostly)
|
||||
#define SERVER_SLAVE_OF_EXT_MASTER (1 << 16) /**<< Server is slave of a non-monitored master */
|
||||
@ -60,7 +60,7 @@ extern const char* DEFAULT_RANK;
|
||||
|
||||
inline bool status_is_connectable(uint64_t status)
|
||||
{
|
||||
return (status & (SERVER_RUNNING | SERVER_MAINT | SERVER_BEING_DRAINED)) == SERVER_RUNNING;
|
||||
return (status & (SERVER_RUNNING | SERVER_MAINT | SERVER_DRAINING)) == SERVER_RUNNING;
|
||||
}
|
||||
|
||||
inline bool status_is_usable(uint64_t status)
|
||||
@ -83,9 +83,9 @@ inline bool status_is_in_maint(uint64_t status)
|
||||
return status & SERVER_MAINT;
|
||||
}
|
||||
|
||||
inline bool status_is_being_drained(uint64_t status)
|
||||
inline bool status_is_draining(uint64_t status)
|
||||
{
|
||||
return status & SERVER_BEING_DRAINED;
|
||||
return status & SERVER_DRAINING;
|
||||
}
|
||||
|
||||
inline bool status_is_master(uint64_t status)
|
||||
@ -384,9 +384,9 @@ public:
|
||||
*
|
||||
* @return True if server is being drained.
|
||||
*/
|
||||
bool is_being_drained() const
|
||||
bool is_draining() const
|
||||
{
|
||||
return status_is_being_drained(status);
|
||||
return status_is_draining(status);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -485,9 +485,9 @@ public:
|
||||
*
|
||||
* @param flags Status flags
|
||||
* @param nConnections Number of current connections. Only affects the output
|
||||
* if the @c SERVER_BEING_DRAINED bit is on. In that case, if
|
||||
* if the @c SERVER_DRAINING bit is on. In that case, if
|
||||
* the number of connections is 0 the state will be reported
|
||||
* as 'Drained', otherwise as 'Being Drained'.
|
||||
* as 'Drained', otherwise as 'Draining'.
|
||||
*
|
||||
* @return A string representation of the status flags
|
||||
*/
|
||||
|
@ -12,7 +12,7 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* MXS-2273: Introduce server state BEING_DRAINED
|
||||
* MXS-2273: Introduce server state DRAINING
|
||||
* https://jira.mariadb.org/browse/MXS-2273
|
||||
*/
|
||||
|
||||
@ -71,24 +71,24 @@ void check_state(TestConnections& test,
|
||||
|
||||
void set_drain(TestConnections& test, const string& server)
|
||||
{
|
||||
test.tprintf("%s: Setting 'Being Drained' state.\n", server.c_str());
|
||||
test.tprintf("%s: Setting 'Draining' state.\n", server.c_str());
|
||||
string command = "set server " + server + " drain";
|
||||
|
||||
test.check_maxctrl(command);
|
||||
test.maxscales->wait_for_monitor();
|
||||
|
||||
check_state(test, server, Expectation::INCLUDES, "Being Drained");
|
||||
check_state(test, server, Expectation::INCLUDES, "Draining");
|
||||
}
|
||||
|
||||
void clear_drain(TestConnections& test, const string& server)
|
||||
{
|
||||
test.tprintf("%s: Clearing 'Being Drained' state.\n", server.c_str());
|
||||
test.tprintf("%s: Clearing 'Draining' state.\n", server.c_str());
|
||||
string command = "clear server " + server + " drain";
|
||||
|
||||
test.check_maxctrl(command);
|
||||
test.maxscales->wait_for_monitor();
|
||||
|
||||
check_state(test, server, Expectation::EXCLUDES, "Being Drained");
|
||||
check_state(test, server, Expectation::EXCLUDES, "Draining");
|
||||
}
|
||||
|
||||
void check_connections(TestConnections& test, const string& server, int nExpected)
|
||||
@ -260,10 +260,10 @@ int main(int argc, char* argv[])
|
||||
|
||||
#ifdef SS_DEBUG
|
||||
// During development, check that the tests do not leave the servers
|
||||
// in 'Being Drained' state.
|
||||
check_state(test, server1, Expectation::EXCLUDES, "Being Drained");
|
||||
check_state(test, server2, Expectation::EXCLUDES, "Being Drained");
|
||||
check_state(test, server3, Expectation::EXCLUDES, "Being Drained");
|
||||
// in 'Draining' state.
|
||||
check_state(test, server1, Expectation::EXCLUDES, "Draining");
|
||||
check_state(test, server2, Expectation::EXCLUDES, "Draining");
|
||||
check_state(test, server3, Expectation::EXCLUDES, "Draining");
|
||||
#endif
|
||||
|
||||
return test.global_result;
|
||||
|
@ -1780,11 +1780,11 @@ void Monitor::check_maintenance_requests()
|
||||
break;
|
||||
|
||||
case MonitorServer::BEING_DRAINED_ON:
|
||||
ptr->server->set_status(SERVER_BEING_DRAINED);
|
||||
ptr->server->set_status(SERVER_DRAINING);
|
||||
break;
|
||||
|
||||
case MonitorServer::BEING_DRAINED_OFF:
|
||||
ptr->server->clear_status(SERVER_BEING_DRAINED);
|
||||
ptr->server->clear_status(SERVER_DRAINING);
|
||||
break;
|
||||
|
||||
case MonitorServer::NO_CHANGE:
|
||||
@ -2174,7 +2174,7 @@ bool Monitor::set_server_status(SERVER* srv, int bit, string* errmsg_out)
|
||||
{
|
||||
/* This server is monitored, in which case modifying any other status bit than Maintenance is
|
||||
* disallowed. */
|
||||
if (bit & ~(SERVER_MAINT | SERVER_BEING_DRAINED))
|
||||
if (bit & ~(SERVER_MAINT | SERVER_DRAINING))
|
||||
{
|
||||
MXS_ERROR(ERR_CANNOT_MODIFY);
|
||||
if (errmsg_out)
|
||||
@ -2194,7 +2194,7 @@ bool Monitor::set_server_status(SERVER* srv, int bit, string* errmsg_out)
|
||||
}
|
||||
else
|
||||
{
|
||||
mxb_assert(bit & SERVER_BEING_DRAINED);
|
||||
mxb_assert(bit & SERVER_DRAINING);
|
||||
request = MonitorServer::BEING_DRAINED_ON;
|
||||
}
|
||||
|
||||
@ -2235,7 +2235,7 @@ bool Monitor::clear_server_status(SERVER* srv, int bit, string* errmsg_out)
|
||||
|
||||
if (state() == MONITOR_STATE_RUNNING)
|
||||
{
|
||||
if (bit & ~(SERVER_MAINT | SERVER_BEING_DRAINED))
|
||||
if (bit & ~(SERVER_MAINT | SERVER_DRAINING))
|
||||
{
|
||||
MXS_ERROR(ERR_CANNOT_MODIFY);
|
||||
if (errmsg_out)
|
||||
@ -2252,7 +2252,7 @@ bool Monitor::clear_server_status(SERVER* srv, int bit, string* errmsg_out)
|
||||
}
|
||||
else
|
||||
{
|
||||
mxb_assert(bit & SERVER_BEING_DRAINED);
|
||||
mxb_assert(bit & SERVER_DRAINING);
|
||||
request = MonitorServer::BEING_DRAINED_OFF;
|
||||
}
|
||||
|
||||
|
@ -634,7 +634,7 @@ string SERVER::status_to_string(uint64_t flags, int nConnections)
|
||||
// Also, system tests compare to these strings so the output must stay constant for now.
|
||||
const string maintenance = "Maintenance";
|
||||
const string drained = "Drained";
|
||||
const string being_drained = "Being Drained";
|
||||
const string draining = "Draining";
|
||||
const string master = "Master";
|
||||
const string relay = "Relay Master";
|
||||
const string slave = "Slave";
|
||||
@ -646,14 +646,14 @@ string SERVER::status_to_string(uint64_t flags, int nConnections)
|
||||
const string running = "Running";
|
||||
const string down = "Down";
|
||||
|
||||
// Maintenance/Being Drained is usually set by user so is printed first.
|
||||
// Being Drained in the presence of Maintenance has no effect, so we only
|
||||
// Maintenance/Draining is usually set by user so is printed first.
|
||||
// Draining in the presence of Maintenance has no effect, so we only
|
||||
// print either one of those, with Maintenance taking precedence.
|
||||
if (status_is_in_maint(flags))
|
||||
{
|
||||
concatenate_if(true, maintenance);
|
||||
}
|
||||
else if (status_is_being_drained(flags))
|
||||
else if (status_is_draining(flags))
|
||||
{
|
||||
if (nConnections == 0)
|
||||
{
|
||||
@ -661,7 +661,7 @@ string SERVER::status_to_string(uint64_t flags, int nConnections)
|
||||
}
|
||||
else
|
||||
{
|
||||
concatenate_if(true, being_drained);
|
||||
concatenate_if(true, draining);
|
||||
}
|
||||
}
|
||||
|
||||
@ -851,7 +851,7 @@ uint64_t SERVER::status_from_string(const char* str)
|
||||
{"maintenance", SERVER_MAINT },
|
||||
{"maint", SERVER_MAINT },
|
||||
{"stale", SERVER_WAS_MASTER },
|
||||
{"drain", SERVER_BEING_DRAINED},
|
||||
{"drain", SERVER_DRAINING },
|
||||
{NULL, 0 }
|
||||
};
|
||||
|
||||
|
@ -320,23 +320,23 @@ void ClustrixMonitor::refresh_nodes()
|
||||
node.set_health_port(health_port);
|
||||
}
|
||||
|
||||
bool is_being_drained = node.server()->is_being_drained();
|
||||
bool is_draining = node.server()->is_draining();
|
||||
|
||||
if (softfailed && !is_being_drained)
|
||||
if (softfailed && !is_draining)
|
||||
{
|
||||
MXS_NOTICE("%s: Node %d (%s) has been SOFTFAILed. "
|
||||
"Turning ON 'Being Drained'.",
|
||||
m_name, node.id(), node.server()->address);
|
||||
|
||||
node.server()->set_status(SERVER_BEING_DRAINED);
|
||||
node.server()->set_status(SERVER_DRAINING);
|
||||
}
|
||||
else if (!softfailed && is_being_drained)
|
||||
else if (!softfailed && is_draining)
|
||||
{
|
||||
MXS_NOTICE("%s: Node %d (%s) is no longer being SOFTFAILed. "
|
||||
"Turning OFF 'Being Drained'.",
|
||||
m_name, node.id(), node.server()->address);
|
||||
|
||||
node.server()->clear_status(SERVER_BEING_DRAINED);
|
||||
node.server()->clear_status(SERVER_DRAINING);
|
||||
}
|
||||
|
||||
nids.erase(id);
|
||||
@ -358,7 +358,7 @@ void ClustrixMonitor::refresh_nodes()
|
||||
|
||||
if (softfailed)
|
||||
{
|
||||
pServer->set_status(SERVER_BEING_DRAINED);
|
||||
pServer->set_status(SERVER_DRAINING);
|
||||
}
|
||||
|
||||
const ClustrixMembership& membership = mit->second;
|
||||
@ -746,7 +746,7 @@ bool ClustrixMonitor::perform_operation(Operation operation,
|
||||
{
|
||||
MXS_NOTICE("%s: Turning on 'Being Drained' on server %s.",
|
||||
m_name, pServer->address);
|
||||
pServer->set_status(SERVER_BEING_DRAINED);
|
||||
pServer->set_status(SERVER_DRAINING);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -754,7 +754,7 @@ bool ClustrixMonitor::perform_operation(Operation operation,
|
||||
|
||||
MXS_NOTICE("%s: Turning off 'Being Drained' on server %s.",
|
||||
m_name, pServer->address);
|
||||
pServer->clear_status(SERVER_BEING_DRAINED);
|
||||
pServer->clear_status(SERVER_DRAINING);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
Loading…
x
Reference in New Issue
Block a user