Remove outdated comments and minor indentation fixes

v2.x_refactor_cluster_mysql_servers
Javier Jaramago Fernández 3 years ago
parent 664fba97d4
commit 5f53c185d0

@ -1758,8 +1758,6 @@ bool MySQL_HostGroups_Manager::commit(
//mydb->execute("DELETE FROM mysql_servers");
//generate_mysql_servers_table();
// INSERT OR IGNORE INTO mysql_servers SELECT ... FROM mysql_servers_incoming
// proxy_debug(PROXY_DEBUG_MYSQL_CONNPOOL, 4, "INSERT OR IGNORE INTO mysql_servers(hostgroup_id, hostname, port, weight, status, compression, max_connections) SELECT hostgroup_id, hostname, port, weight, status, compression, max_connections FROM mysql_servers_incoming\n");
mydb->execute("INSERT OR IGNORE INTO mysql_servers(hostgroup_id, hostname, port, gtid_port, weight, status, compression, max_connections, max_replication_lag, use_ssl, max_latency_ms, comment) SELECT hostgroup_id, hostname, port, gtid_port, weight, status, compression, max_connections, max_replication_lag, use_ssl, max_latency_ms, comment FROM mysql_servers_incoming");
// SELECT FROM mysql_servers whatever is not identical in mysql_servers_incoming, or where mem_pointer=0 (where there is no pointer yet)
@ -1971,8 +1969,6 @@ bool MySQL_HostGroups_Manager::commit(
if (update_version)
GloVars.checksums_values.mysql_servers.version++;
//struct timespec ts;
//clock_gettime(CLOCK_REALTIME, &ts);
if (peer_runtime_mysql_server.epoch != 0 && peer_runtime_mysql_server.checksum.empty() == false &&
GloVars.checksums_values.mysql_servers.checksum == peer_runtime_mysql_server.checksum) {
GloVars.checksums_values.mysql_servers.epoch = peer_runtime_mysql_server.epoch;
@ -4901,9 +4897,6 @@ void MySQL_HostGroups_Manager::read_only_action_v2(const std::list<read_only_ser
sprintf(buf, "0x%0X%0X", d32[0], d32[1]);
pthread_mutex_lock(&GloVars.checksum_mutex);
GloVars.checksums_values.mysql_servers.set_checksum(buf);
//GloVars.checksums_values.mysql_servers.version++;
//struct timespec ts;
//clock_gettime(CLOCK_REALTIME, &ts);
time_t t = time(NULL);
GloVars.checksums_values.mysql_servers.epoch = t;

@ -919,11 +919,11 @@ void ProxySQL_Node_Entry::set_checksums(MYSQL_RES *_r) {
(own_version == 1) // we just booted
||
(v->epoch > own_epoch) // epoch is newer
) {
) {
if (v->diff_check >= diff_ms) {
proxy_debug(PROXY_DEBUG_CLUSTER, 5, "Detected peer %s:%d with mysql_servers_v2 version %llu, epoch %llu, diff_check %u. Own version: %llu, epoch: %llu. Proceeding with remote sync\n", hostname, port, v->version, v->epoch, v->diff_check, own_version, own_epoch);
proxy_info("Cluster: detected a peer %s:%d with mysql_servers_v2 version %llu, epoch %llu, diff_check %u. Own version: %llu, epoch: %llu. Proceeding with remote sync\n", hostname, port, v->version, v->epoch, v->diff_check, own_version, own_epoch);
ProxySQL_Checksum_Value_2* runtime_mysql_server_checksum = &checksums_values.mysql_servers;
const bool fetch_runtime = (mysql_server_sync_algo == mysql_servers_sync_algorithm::runtime_mysql_servers_and_mysql_servers_v2);
@ -964,9 +964,7 @@ void ProxySQL_Node_Entry::set_checksums(MYSQL_RES *_r) {
(own_version == 1) // we just booted
||
(v->epoch > own_epoch) // epoch is newer
//||
//(v->checksum != own_checksum) // as runtime mysql server is generated on node itself, epoch can be newer so we also check checksum
) {
) {
if (v->diff_check >= diff_ms) {
proxy_debug(PROXY_DEBUG_CLUSTER, 5, "Detected peer %s:%d with mysql_servers version %llu, epoch %llu, diff_check %u. Own version: %llu, epoch: %llu. Proceeding with remote sync\n", hostname, port, v->version, v->epoch, v->diff_check, own_version, own_epoch);
proxy_info("Cluster: detected a peer %s:%d with mysql_servers version %llu, epoch %llu, diff_check %u. Own version: %llu, epoch: %llu. Proceeding with remote sync\n", hostname, port, v->version, v->epoch, v->diff_check, own_version, own_epoch);
@ -1788,7 +1786,7 @@ void ProxySQL_Cluster::pull_runtime_mysql_servers_from_peer(const runtime_mysql_
string_format("Cluster: Fetching 'MySQL Servers' from peer %s:%d completed\n", fetch_servers_done, hostname, port);
std::string fetch_servers_err;
string_format("Cluster: Fetching 'MySQL Servers' from peer %s:%d failed: \n", fetch_servers_err, hostname, port);
// Create fetching query
fetch_query query = {
CLUSTER_QUERY_RUNTIME_MYSQL_SERVERS,
@ -1805,7 +1803,7 @@ void ProxySQL_Cluster::pull_runtime_mysql_servers_from_peer(const runtime_mysql_
result = nullptr;
}
}
if (result != nullptr) {
const uint64_t servers_hash = mysql_raw_checksum(result);
const string computed_checksum{ get_checksum_from_hash(servers_hash) };

Loading…
Cancel
Save