When a cluster node (client) connects to another cluster node, it
advertises its UUID but also exports its `admin-mysql_ifaces` .
The receiving cluster can use this information to try to guess how
to connect to the node that initialized the connection, for example
to collect metrics.
This is visible in table `stats_proxysql_servers_clients_status` .
#define ADMIN_SQLITE_TABLE_RUNTIME_PROXYSQL_SERVERS "CREATE TABLE runtime_proxysql_servers (hostname VARCHAR NOT NULL , port INT NOT NULL DEFAULT 6032 , weight INT CHECK (weight >= 0) NOT NULL DEFAULT 0 , comment VARCHAR NOT NULL DEFAULT '' , PRIMARY KEY (hostname, port) )"
#define STATS_SQLITE_TABLE_PROXYSQL_SERVERS_CLIENTS_STATUS "CREATE TABLE stats_proxysql_servers_clients_status (uuid VARCHAR NOT NULL , hostname VARCHAR NOT NULL , port INT NOT NULL , last_seen_at INT NOT NULL , PRIMARY KEY (uuid, hostname, port) )"
#define STATS_SQLITE_TABLE_PROXYSQL_SERVERS_CLIENTS_STATUS "CREATE TABLE stats_proxysql_servers_clients_status (uuid VARCHAR NOT NULL , hostname VARCHAR NOT NULL , port INT NOT NULL , admin_mysql_ifaces VARCHAR NOT NULL , last_seen_at INT NOT NULL , PRIMARY KEY (uuid, hostname, port) )"
#define STATS_SQLITE_TABLE_PROXYSQL_SERVERS_STATUS "CREATE TABLE stats_proxysql_servers_status (hostname VARCHAR NOT NULL , port INT NOT NULL DEFAULT 6032 , weight INT CHECK (weight >= 0) NOT NULL DEFAULT 0 , master VARCHAR NOT NULL , global_version INT NOT NULL , check_age_us INT NOT NULL , ping_time_us INT NOT NULL, checks_OK INT NOT NULL , checks_ERR INT NOT NULL , PRIMARY KEY (hostname, port) )"
@ -1221,28 +1221,43 @@ bool admin_handler_command_proxysql(char *query_no_space, unsigned int query_no_
sess->client_myds->shut_soft();
returnfalse;
}
if(query_no_space_length==l+36){
if(query_no_space_length>=l+36+2){
uuid_tuu;
if(uuid_parse(query_no_space+l,uu)==0){
char*A_uuid=NULL;
char*B_interface=NULL;
c_split_2(query_no_space+l,"",&A_uuid,&B_interface);// we split the value
proxy_info("Created new link with Cluster node %s:%d : %s at interface %s\n",sess->client_myds->addr.addr,sess->client_myds->addr.port,A_uuid,B_interface);
proxy_error("Cluster node %s:%d is sending a new UUID : %s . Former UUID : %s . Exiting client\n",sess->client_myds->addr.addr,sess->client_myds->addr.port,query_no_space+l,sess->proxysql_node_address->uuid);
proxy_error("Cluster node %s:%d is sending a new UUID : %s . Former UUID : %s . Exiting client\n",sess->client_myds->addr.addr,sess->client_myds->addr.port,A_uuid,sess->proxysql_node_address->uuid);
SPA->send_MySQL_ERR(&sess->client_myds->myprot,(char*)"Received PROXYSQL CLUSTER_NODE_UUID with a new UUID not matching the previous one");
sess->client_myds->shut_soft();
free(A_uuid);
free(B_interface);
returnfalse;
}else{
proxy_info("Cluster node %s:%d is sending again its UUID : %s\n",sess->client_myds->addr.addr,sess->client_myds->addr.port,query_no_space+l);
proxy_info("Cluster node %s:%d is sending again its UUID : %s\n",sess->client_myds->addr.addr,sess->client_myds->addr.port,A_uuid);