Sort server relationships
As server relationships are unordered, sorting them guarantees a certain order. This fixes the MaxCtrl cluster diff test failure. Also formatted monitor.cc sources: the indentation seems to be off.
This commit is contained in:
@ -89,7 +89,6 @@ private:
|
|||||||
ThisUnit this_unit;
|
ThisUnit this_unit;
|
||||||
|
|
||||||
const char RECONFIG_FAILED[] = "Monitor reconfiguration failed when %s. Check log for more details.";
|
const char RECONFIG_FAILED[] = "Monitor reconfiguration failed when %s. Check log for more details.";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Monitor* MonitorManager::create_monitor(const string& name, const string& module,
|
Monitor* MonitorManager::create_monitor(const string& name, const string& module,
|
||||||
@ -140,12 +139,14 @@ void MonitorManager::debug_wait_one_tick()
|
|||||||
if (mon->is_running())
|
if (mon->is_running())
|
||||||
{
|
{
|
||||||
auto start = steady_clock::now();
|
auto start = steady_clock::now();
|
||||||
// A monitor may have been added in between the two foreach-calls (not if config changes are
|
// A monitor may have been added in between the two foreach-calls (not
|
||||||
|
// if config changes are
|
||||||
// serialized). Check if entry exists.
|
// serialized). Check if entry exists.
|
||||||
if (ticks.count(mon) > 0)
|
if (ticks.count(mon) > 0)
|
||||||
{
|
{
|
||||||
auto tick = ticks[mon];
|
auto tick = ticks[mon];
|
||||||
while (mon->ticks() == tick && (steady_clock::now() - start < seconds(60)))
|
while (mon->ticks() == tick
|
||||||
|
&& (steady_clock::now() - start < seconds(60)))
|
||||||
{
|
{
|
||||||
std::this_thread::sleep_for(milliseconds(100));
|
std::this_thread::sleep_for(milliseconds(100));
|
||||||
}
|
}
|
||||||
@ -479,7 +480,8 @@ json_t* MonitorManager::monitor_relations_to_server(const SERVER* server, const
|
|||||||
mxb_assert(Monitor::is_admin_thread());
|
mxb_assert(Monitor::is_admin_thread());
|
||||||
std::vector<std::string> names;
|
std::vector<std::string> names;
|
||||||
this_unit.foreach_monitor([&names, server](Monitor* mon) {
|
this_unit.foreach_monitor([&names, server](Monitor* mon) {
|
||||||
// The serverlist of an individual monitor should not change while a monitor is running.
|
// The serverlist of an individual monitor should not change while a
|
||||||
|
// monitor is running.
|
||||||
for (MonitorServer* db : mon->servers())
|
for (MonitorServer* db : mon->servers())
|
||||||
{
|
{
|
||||||
if (db->server == server)
|
if (db->server == server)
|
||||||
@ -491,6 +493,8 @@ json_t* MonitorManager::monitor_relations_to_server(const SERVER* server, const
|
|||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
std::sort(names.begin(), names.end());
|
||||||
|
|
||||||
json_t* rel = NULL;
|
json_t* rel = NULL;
|
||||||
if (!names.empty())
|
if (!names.empty())
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1801,6 +1801,8 @@ json_t* service_relations_to_server(const SERVER* server, const char* host)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::sort(names.begin(), names.end());
|
||||||
|
|
||||||
json_t* rel = NULL;
|
json_t* rel = NULL;
|
||||||
|
|
||||||
if (!names.empty())
|
if (!names.empty())
|
||||||
|
|||||||
Reference in New Issue
Block a user