MXS-2271 Refactor disk space checking
The functions are now in MonitorServer. Disk space can only be checked during specific ticks. If a server misses a tick (e.g. is down) it will be checked after disk_space_check_interval has passed.
This commit is contained in:
		| @ -334,7 +334,7 @@ json_t* MariaDBMonitor::to_json() const | ||||
|  * | ||||
|  * @param server The server to update | ||||
|  */ | ||||
| void MariaDBMonitor::update_server(MariaDBServer* server) | ||||
| void MariaDBMonitor::update_server(MariaDBServer* server, bool time_to_update_disk_space) | ||||
| { | ||||
|     MonitorServer* mon_srv = server->m_server_base; | ||||
|     mxs_connect_result_t conn_status = mon_srv->ping_or_connect(m_settings.conn_settings); | ||||
| @ -361,9 +361,9 @@ void MariaDBMonitor::update_server(MariaDBServer* server) | ||||
|             // If permissions are ok, continue. | ||||
|             if (!server->has_status(SERVER_AUTH_ERROR)) | ||||
|             { | ||||
|                 if (should_update_disk_space_status(mon_srv)) | ||||
|                 if (time_to_update_disk_space && mon_srv->can_update_disk_space_status()) | ||||
|                 { | ||||
|                     update_disk_space_status(mon_srv); | ||||
|                     mon_srv->update_disk_space_status(); | ||||
|                 } | ||||
|  | ||||
|                 // Query MariaDBServer specific data | ||||
| @ -433,10 +433,12 @@ void MariaDBMonitor::tick() | ||||
|         mon_srv->mon_prev_status = status; | ||||
|     } | ||||
|  | ||||
|     bool should_update_disk_space = check_disk_space_this_tick(); | ||||
|  | ||||
|     // Query all servers for their status. | ||||
|     for (MariaDBServer* server : m_servers) | ||||
|     { | ||||
|         update_server(server); | ||||
|         update_server(server, should_update_disk_space); | ||||
|         if (server->m_topology_changed) | ||||
|         { | ||||
|             m_cluster_topology_changed = true; | ||||
|  | ||||
| @ -255,7 +255,7 @@ private: | ||||
|     MariaDBServer* get_server(SERVER* server); | ||||
|  | ||||
|     // Cluster discovery and status assignment methods, top levels | ||||
|     void update_server(MariaDBServer* server); | ||||
|     void update_server(MariaDBServer* server, bool time_to_update_disk_space); | ||||
|     void update_topology(); | ||||
|     void build_replication_graph(); | ||||
|     void assign_new_master(MariaDBServer* new_master); | ||||
|  | ||||
| @ -159,7 +159,7 @@ void MariaDBMonitor::Test::init_servers(int count) | ||||
|     { | ||||
|         // Server contents mostly undefined | ||||
|         auto base_server = Server::create_test_server(); | ||||
|         MonitorServer* mon_server = new MonitorServer(base_server); | ||||
|         MonitorServer* mon_server = new MonitorServer(base_server, m_monitor->m_settings.disk_space_limits); | ||||
|         MariaDBServer* mariadb_server = new MariaDBServer(mon_server, i - 1, m_use_hostnames, true); | ||||
|  | ||||
|         if (m_use_hostnames) | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 Esa Korhonen
					Esa Korhonen