Merge branch 'servers_version' into beta7

pull/516/head
René Cannaò 10 years ago
commit c6b7f6db52

@ -105,6 +105,7 @@ class MySQL_HostGroups_Manager {
public:
struct {
unsigned int servers_table_version;
unsigned long client_connections_aborted;
unsigned long client_connections_created;
int client_connections;
@ -151,6 +152,7 @@ class MySQL_HostGroups_Manager {
void replication_lag_action(int, char*, unsigned int, int);
void read_only_action(char *hostname, int port, int read_only);
unsigned int get_servers_table_version();
};
#endif /* __CLASS_MYSQL_HOSTGROUPS_MANAGER_H */

@ -229,6 +229,7 @@ MySQL_HostGroups_Manager::MySQL_HostGroups_Manager() {
status.server_connections_connected=0;
status.server_connections_aborted=0;
status.server_connections_created=0;
status.servers_table_version=0;
status.myconnpoll_get=0;
status.myconnpoll_get_ok=0;
status.myconnpoll_get_ping=0;
@ -281,6 +282,10 @@ void MySQL_HostGroups_Manager::wrunlock() {
spin_wrunlock(&rwlock);
}
unsigned int MySQL_HostGroups_Manager::get_servers_table_version() {
return __sync_fetch_and_add(&status.servers_table_version,0);
}
// add a new row in mysql_servers_incoming
// we always assume that the calling thread has acquired a rdlock()
bool MySQL_HostGroups_Manager::server_add(unsigned int hid, char *add, uint16_t p, unsigned int _weight, enum MySerStatus status, unsigned int _comp /*, uint8_t _charset */, unsigned int _max_connections, unsigned int _max_replication_lag) {
@ -403,6 +408,7 @@ bool MySQL_HostGroups_Manager::commit() {
generate_mysql_servers_table();
generate_mysql_replication_hostgroups_table();
__sync_fetch_and_add(&status.servers_table_version,1);
wrunlock();
if (GloMTH) {
GloMTH->signal_all_threads(1);

@ -1986,6 +1986,12 @@ SQLite3_result * MySQL_Threads_Handler::SQL3_GlobalStatus() {
pta[1]=buf;
result->add_row(pta);
}
{ // Slow queries
pta[0]=(char *)"Servers_table_version";
sprintf(buf,"%u",MyHGM->get_servers_table_version());
pta[1]=buf;
result->add_row(pta);
}
free(pta);
return result;
}

Loading…
Cancel
Save