MXS-2273 Drop unnecessary SERVER prefix in names

MXS_MONITORED_SERVER provides enough scope.
This commit is contained in:
Johan Wikman
2019-01-28 16:13:36 +02:00
parent bc4a52acb0
commit b650dd4f67
2 changed files with 19 additions and 19 deletions

View File

@ -134,11 +134,11 @@ public:
/** /**
* Maintenance mode request constants. * Maintenance mode request constants.
*/ */
static const int SERVER_NO_CHANGE = 0; static const int NO_CHANGE = 0;
static const int SERVER_MAINT_OFF = 1; static const int MAINT_OFF = 1;
static const int SERVER_MAINT_ON = 2; static const int MAINT_ON = 2;
static const int SERVER_BEING_DRAINED_OFF = 3; static const int BEING_DRAINED_OFF = 3;
static const int SERVER_BEING_DRAINED_ON = 4; static const int BEING_DRAINED_ON = 4;
SERVER* server = nullptr; /**< The server being monitored */ SERVER* server = nullptr; /**< The server being monitored */
MYSQL* con = nullptr; /**< The MySQL connection */ MYSQL* con = nullptr; /**< The MySQL connection */
@ -147,7 +147,7 @@ public:
uint64_t mon_prev_status = -1; /**< Status before starting the current monitor loop */ uint64_t mon_prev_status = -1; /**< Status before starting the current monitor loop */
uint64_t pending_status = 0; /**< Status during current monitor loop */ uint64_t pending_status = 0; /**< Status during current monitor loop */
int64_t disk_space_checked = 0; /**< When was the disk space checked the last time */ int64_t disk_space_checked = 0; /**< When was the disk space checked the last time */
int status_request = SERVER_NO_CHANGE; /**< Is admin requesting Maintenance=ON/OFF on the int status_request = NO_CHANGE; /**< Is admin requesting Maintenance=ON/OFF on the
* server? */ * server? */
}; };

View File

@ -1595,28 +1595,28 @@ void monitor_check_maintenance_requests(Monitor* monitor)
{ {
// The only server status bit the admin may change is the [Maintenance] bit. // The only server status bit the admin may change is the [Maintenance] bit.
int admin_msg = atomic_exchange_int(&ptr->status_request, int admin_msg = atomic_exchange_int(&ptr->status_request,
MXS_MONITORED_SERVER::SERVER_NO_CHANGE); MXS_MONITORED_SERVER::NO_CHANGE);
switch (admin_msg) switch (admin_msg)
{ {
case MXS_MONITORED_SERVER::SERVER_MAINT_ON: case MXS_MONITORED_SERVER::MAINT_ON:
// TODO: Change to writing MONITORED_SERVER->pending status instead once cleanup done. // TODO: Change to writing MONITORED_SERVER->pending status instead once cleanup done.
ptr->server->set_status(SERVER_MAINT); ptr->server->set_status(SERVER_MAINT);
break; break;
case MXS_MONITORED_SERVER::SERVER_MAINT_OFF: case MXS_MONITORED_SERVER::MAINT_OFF:
ptr->server->clear_status(SERVER_MAINT); ptr->server->clear_status(SERVER_MAINT);
break; break;
case MXS_MONITORED_SERVER::SERVER_BEING_DRAINED_ON: case MXS_MONITORED_SERVER::BEING_DRAINED_ON:
ptr->server->set_status(SERVER_BEING_DRAINED); ptr->server->set_status(SERVER_BEING_DRAINED);
break; break;
case MXS_MONITORED_SERVER::SERVER_BEING_DRAINED_OFF: case MXS_MONITORED_SERVER::BEING_DRAINED_OFF:
ptr->server->clear_status(SERVER_BEING_DRAINED); ptr->server->clear_status(SERVER_BEING_DRAINED);
break; break;
case MXS_MONITORED_SERVER::SERVER_NO_CHANGE: case MXS_MONITORED_SERVER::NO_CHANGE:
break; break;
default: default:
@ -2407,18 +2407,18 @@ bool Monitor::set_server_status(SERVER* srv, int bit, string* errmsg_out)
int request; int request;
if (bit & SERVER_MAINT) if (bit & SERVER_MAINT)
{ {
request = MXS_MONITORED_SERVER::SERVER_MAINT_ON; request = MXS_MONITORED_SERVER::MAINT_ON;
} }
else else
{ {
mxb_assert(bit & SERVER_BEING_DRAINED); mxb_assert(bit & SERVER_BEING_DRAINED);
request = MXS_MONITORED_SERVER::SERVER_BEING_DRAINED_ON; request = MXS_MONITORED_SERVER::BEING_DRAINED_ON;
} }
int previous_request = atomic_exchange_int(&msrv->status_request, request); int previous_request = atomic_exchange_int(&msrv->status_request, request);
written = true; written = true;
// Warn if the previous request hasn't been read. // Warn if the previous request hasn't been read.
if (previous_request != MXS_MONITORED_SERVER::SERVER_NO_CHANGE) if (previous_request != MXS_MONITORED_SERVER::NO_CHANGE)
{ {
MXS_WARNING(WRN_REQUEST_OVERWRITTEN); MXS_WARNING(WRN_REQUEST_OVERWRITTEN);
} }
@ -2465,18 +2465,18 @@ bool Monitor::clear_server_status(SERVER* srv, int bit, string* errmsg_out)
int request; int request;
if (bit & SERVER_MAINT) if (bit & SERVER_MAINT)
{ {
request = MXS_MONITORED_SERVER::SERVER_MAINT_OFF; request = MXS_MONITORED_SERVER::MAINT_OFF;
} }
else else
{ {
mxb_assert(bit & SERVER_BEING_DRAINED); mxb_assert(bit & SERVER_BEING_DRAINED);
request = MXS_MONITORED_SERVER::SERVER_BEING_DRAINED_OFF; request = MXS_MONITORED_SERVER::BEING_DRAINED_OFF;
} }
int previous_request = atomic_exchange_int(&msrv->status_request, request); int previous_request = atomic_exchange_int(&msrv->status_request, request);
written = true; written = true;
// Warn if the previous request hasn't been read. // Warn if the previous request hasn't been read.
if (previous_request != MXS_MONITORED_SERVER::SERVER_NO_CHANGE) if (previous_request != MXS_MONITORED_SERVER::NO_CHANGE)
{ {
MXS_WARNING(WRN_REQUEST_OVERWRITTEN); MXS_WARNING(WRN_REQUEST_OVERWRITTEN);
} }