@ -45,6 +45,7 @@ static PgSQL_Session* sess_stopat;
extern PgSQL_Query_Processor * GloPgQPro ;
extern PgSQL_Threads_Handler * GloPTH ;
extern MySQL_Monitor * GloMyMon ;
extern PgSQL_Monitor * GloPgMon ;
extern PgSQL_Logger * GloPgSQL_Logger ;
typedef struct mythr_st_vars {
@ -314,6 +315,7 @@ static char* pgsql_thread_variables_names[] = {
( char * ) " monitor_ping_interval " ,
( char * ) " monitor_ping_max_failures " ,
( char * ) " monitor_ping_timeout " ,
/*
( char * ) " monitor_aws_rds_topology_discovery_interval " ,
( char * ) " monitor_read_only_interval " ,
( char * ) " monitor_read_only_timeout " ,
@ -330,12 +332,17 @@ static char* pgsql_thread_variables_names[] = {
( char * ) " monitor_galera_healthcheck_interval " ,
( char * ) " monitor_galera_healthcheck_timeout " ,
( char * ) " monitor_galera_healthcheck_max_timeout_count " ,
*/
( char * ) " monitor_username " ,
( char * ) " monitor_password " ,
/*
( char * ) " monitor_replication_lag_use_percona_heartbeat " ,
( char * ) " monitor_query_interval " ,
( char * ) " monitor_query_timeout " ,
( char * ) " monitor_slave_lag_when_null " ,
*/
( char * ) " monitor_threads " ,
/*
( char * ) " monitor_threads_min " ,
( char * ) " monitor_threads_max " ,
( char * ) " monitor_threads_queue_maxsize " ,
@ -344,6 +351,7 @@ static char* pgsql_thread_variables_names[] = {
( char * ) " monitor_local_dns_resolver_queue_maxsize " ,
( char * ) " monitor_wait_timeout " ,
( char * ) " monitor_writer_is_also_reader " ,
*/
( char * ) " max_allowed_packet " ,
( char * ) " tcp_keepalive_time " ,
( char * ) " use_tcp_keepalive " ,
@ -936,6 +944,7 @@ PgSQL_Threads_Handler::PgSQL_Threads_Handler() {
variables . monitor_replication_lag_interval = 10000 ;
variables . monitor_replication_lag_timeout = 1000 ;
variables . monitor_replication_lag_count = 1 ;
/* TODO: Remove
variables . monitor_groupreplication_healthcheck_interval = 5000 ;
variables . monitor_groupreplication_healthcheck_timeout = 800 ;
variables . monitor_groupreplication_healthcheck_max_timeout_count = 3 ;
@ -950,12 +959,16 @@ PgSQL_Threads_Handler::PgSQL_Threads_Handler() {
variables . monitor_threads_min = 8 ;
variables . monitor_threads_max = 128 ;
variables . monitor_threads_queue_maxsize = 128 ;
*/
variables . monitor_threads = 2 ;
variables . monitor_local_dns_cache_ttl = 300000 ;
variables . monitor_local_dns_cache_refresh_interval = 60000 ;
variables . monitor_local_dns_resolver_queue_maxsize = 128 ;
variables . monitor_username = strdup ( ( char * ) " monitor " ) ;
variables . monitor_password = strdup ( ( char * ) " monitor " ) ;
/* TODO: Remove
variables . monitor_replication_lag_use_percona_heartbeat = strdup ( ( char * ) " " ) ;
*/
variables . monitor_wait_timeout = true ;
variables . monitor_writer_is_also_reader = true ;
variables . max_allowed_packet = 64 * 1024 * 1024 ;
@ -1168,7 +1181,9 @@ char* PgSQL_Threads_Handler::get_variable_string(char* name) {
if ( ! strncmp ( name , " monitor_ " , 8 ) ) {
if ( ! strcmp ( name , " monitor_username " ) ) return strdup ( variables . monitor_username ) ;
if ( ! strcmp ( name , " monitor_password " ) ) return strdup ( variables . monitor_password ) ;
/*
if ( ! strcmp ( name , " monitor_replication_lag_use_percona_heartbeat " ) ) return strdup ( variables . monitor_replication_lag_use_percona_heartbeat ) ;
*/
}
if ( ! strncmp ( name , " ssl_ " , 4 ) ) {
if ( ! strcmp ( name , " ssl_p2s_ca " ) ) {
@ -1489,7 +1504,9 @@ char* PgSQL_Threads_Handler::get_variable(char* name) { // this is the public fu
if ( ! strncasecmp ( name , " monitor_ " , 8 ) ) {
if ( ! strcasecmp ( name , " monitor_username " ) ) return strdup ( variables . monitor_username ) ;
if ( ! strcasecmp ( name , " monitor_password " ) ) return strdup ( variables . monitor_password ) ;
/*
if ( ! strcasecmp ( name , " monitor_replication_lag_use_percona_heartbeat " ) ) return strdup ( variables . monitor_replication_lag_use_percona_heartbeat ) ;
*/
}
if ( ! strcasecmp ( name , " threads " ) ) {
sprintf ( intbuf , " %d " , ( num_threads ? num_threads : DEFAULT_NUM_THREADS ) ) ;
@ -2068,11 +2085,13 @@ char** PgSQL_Threads_Handler::get_variables_list() {
VariablesPointers_int [ " monitor_ping_timeout " ] = make_tuple ( & variables . monitor_ping_timeout , 100 , 600 * 1000 , false ) ;
VariablesPointers_int [ " monitor_ping_max_failures " ] = make_tuple ( & variables . monitor_ping_max_failures , 1 , 1000 * 1000 , false ) ;
/*
VariablesPointers_int [ " monitor_aws_rds_topology_discovery_interval " ] = make_tuple ( & variables . monitor_aws_rds_topology_discovery_interval , 1 , 100000 , false ) ;
*/
VariablesPointers_int [ " monitor_read_only_interval " ] = make_tuple ( & variables . monitor_read_only_interval , 100 , 7 * 24 * 3600 * 1000 , false ) ;
VariablesPointers_int [ " monitor_read_only_timeout " ] = make_tuple ( & variables . monitor_read_only_timeout , 100 , 600 * 1000 , false ) ;
VariablesPointers_int [ " monitor_read_only_max_timeout_count " ] = make_tuple ( & variables . monitor_read_only_max_timeout_count , 1 , 1000 * 1000 , false ) ;
/*
VariablesPointers_int [ " monitor_replication_lag_interval " ] = make_tuple ( & variables . monitor_replication_lag_interval , 100 , 7 * 24 * 3600 * 1000 , false ) ;
VariablesPointers_int [ " monitor_replication_lag_timeout " ] = make_tuple ( & variables . monitor_replication_lag_timeout , 100 , 600 * 1000 , false ) ;
VariablesPointers_int [ " monitor_replication_lag_count " ] = make_tuple ( & variables . monitor_replication_lag_count , 1 , 10 , false ) ;
@ -2089,13 +2108,17 @@ char** PgSQL_Threads_Handler::get_variables_list() {
VariablesPointers_int [ " monitor_query_interval " ] = make_tuple ( & variables . monitor_query_interval , 100 , 7 * 24 * 3600 * 1000 , false ) ;
VariablesPointers_int [ " monitor_query_timeout " ] = make_tuple ( & variables . monitor_query_timeout , 100 , 600 * 1000 , false ) ;
*/
VariablesPointers_int [ " monitor_threads " ] = make_tuple ( & variables . monitor_threads , 2 , 256 , false ) ;
/*
VariablesPointers_int [ " monitor_threads_min " ] = make_tuple ( & variables . monitor_threads_min , 2 , 256 , false ) ;
VariablesPointers_int [ " monitor_threads_max " ] = make_tuple ( & variables . monitor_threads_max , 4 , 1024 , false ) ;
VariablesPointers_int [ " monitor_slave_lag_when_null " ] = make_tuple ( & variables . monitor_slave_lag_when_null , 0 , 604800 , false ) ;
VariablesPointers_int [ " monitor_threads_queue_maxsize " ] = make_tuple ( & variables . monitor_threads_queue_maxsize , 16 , 1024 , false ) ;
VariablesPointers_int [ " monitor_threads_queue_maxsize " ] = make_tuple ( & variables . monitor_threads_queue_maxsize , 16 , 1024 , false ) ;
*/
VariablesPointers_int [ " monitor_local_dns_cache_ttl " ] = make_tuple ( & variables . monitor_local_dns_cache_ttl , 0 , 7 * 24 * 3600 * 1000 , false ) ;
VariablesPointers_int [ " monitor_local_dns_cache_refresh_interval " ] = make_tuple ( & variables . monitor_local_dns_cache_refresh_interval , 0 , 7 * 24 * 3600 * 1000 , false ) ;
VariablesPointers_int [ " monitor_local_dns_resolver_queue_maxsize " ] = make_tuple ( & variables . monitor_local_dns_resolver_queue_maxsize , 16 , 1024 , false ) ;
@ -3783,16 +3806,25 @@ void PgSQL_Thread::refresh_variables() {
mysql_thread___monitor_wait_timeout = ( bool ) GloPTH - > get_variable_int ( ( char * ) " monitor_wait_timeout " ) ;
mysql_thread___monitor_writer_is_also_reader = ( bool ) GloPTH - > get_variable_int ( ( char * ) " monitor_writer_is_also_reader " ) ;
mysql_thread___monitor_enabled = ( bool ) GloPTH - > get_variable_int ( ( char * ) " monitor_enabled " ) ;
mysql_thread___monitor_history = GloPTH - > get_variable_int ( ( char * ) " monitor_history " ) ;
mysql_thread___monitor_connect_interval = GloPTH - > get_variable_int ( ( char * ) " monitor_connect_interval " ) ;
mysql_thread___monitor_connect_timeout = GloPTH - > get_variable_int ( ( char * ) " monitor_connect_timeout " ) ;
mysql_thread___monitor_ping_interval = GloPTH - > get_variable_int ( ( char * ) " monitor_ping_interval " ) ;
mysql_thread___monitor_ping_max_failures = GloPTH - > get_variable_int ( ( char * ) " monitor_ping_max_failures " ) ;
mysql_thread___monitor_ping_timeout = GloPTH - > get_variable_int ( ( char * ) " monitor_ping_timeout " ) ;
*/
pgsql_thread___monitor_enabled = ( bool ) GloPTH - > get_variable_int ( ( char * ) " monitor_enabled " ) ;
pgsql_thread___monitor_history = GloPTH - > get_variable_int ( ( char * ) " monitor_history " ) ;
pgsql_thread___monitor_connect_interval = GloPTH - > get_variable_int ( ( char * ) " monitor_connect_interval " ) ;
pgsql_thread___monitor_connect_timeout = GloPTH - > get_variable_int ( ( char * ) " monitor_connect_timeout " ) ;
pgsql_thread___monitor_ping_interval = GloPTH - > get_variable_int ( ( char * ) " monitor_ping_interval " ) ;
pgsql_thread___monitor_ping_max_failures = GloPTH - > get_variable_int ( ( char * ) " monitor_ping_max_failures " ) ;
pgsql_thread___monitor_ping_timeout = GloPTH - > get_variable_int ( ( char * ) " monitor_ping_timeout " ) ;
pgsql_thread___monitor_read_only_interval = GloPTH - > get_variable_int ( ( char * ) " monitor_read_only_interval " ) ;
pgsql_thread___monitor_read_only_timeout = GloPTH - > get_variable_int ( ( char * ) " monitor_read_only_timeout " ) ;
pgsql_thread___monitor_threads = GloPTH - > get_variable_int ( ( char * ) " monitor_threads " ) ;
if ( pgsql_thread___monitor_username ) free ( pgsql_thread___monitor_username ) ;
pgsql_thread___monitor_username = GloPTH - > get_variable_string ( ( char * ) " monitor_username " ) ;
if ( pgsql_thread___monitor_password ) free ( pgsql_thread___monitor_password ) ;
pgsql_thread___monitor_password = GloPTH - > get_variable_string ( ( char * ) " monitor_password " ) ;
/*
mysql_thread___monitor_aws_rds_topology_discovery_interval = GloPTH - > get_variable_int ( ( char * ) " monitor_aws_rds_topology_discovery_interval " ) ;
mysql_thread___monitor_read_only_interval = GloPTH - > get_variable_int ( ( char * ) " monitor_read_only_interval " ) ;
mysql_thread___monitor_read_only_timeout = GloPTH - > get_variable_int ( ( char * ) " monitor_read_only_timeout " ) ;
mysql_thread___monitor_read_only_max_timeout_count = GloPTH - > get_variable_int ( ( char * ) " monitor_read_only_max_timeout_count " ) ;
mysql_thread___monitor_replication_lag_group_by_host = ( bool ) GloPTH - > get_variable_int ( ( char * ) " monitor_replication_lag_group_by_host " ) ;
mysql_thread___monitor_replication_lag_interval = GloPTH - > get_variable_int ( ( char * ) " monitor_replication_lag_interval " ) ;
@ -4377,30 +4409,32 @@ SQLite3_result* PgSQL_Threads_Handler::SQL3_GlobalStatus(bool _memory) {
pta [ 1 ] = buf ;
result - > add_row ( pta ) ;
}
*/
{
pta [ 0 ] = ( char * ) " My SQL_Monitor_connect_check_OK" ;
sprintf ( buf , " %l lu" , GloMy Mon- > connect_check_OK ) ;
pta [ 0 ] = ( char * ) " Pg SQL_Monitor_connect_check_OK" ;
sprintf ( buf , " %l u" , GloPg Mon- > connect_check_OK ) ;
pta [ 1 ] = buf ;
result - > add_row ( pta ) ;
}
{
pta [ 0 ] = ( char * ) " My SQL_Monitor_connect_check_ERR" ;
sprintf ( buf , " %l lu" , GloMy Mon- > connect_check_ERR ) ;
pta [ 0 ] = ( char * ) " Pg SQL_Monitor_connect_check_ERR" ;
sprintf ( buf , " %l u" , GloPg Mon- > connect_check_ERR ) ;
pta [ 1 ] = buf ;
result - > add_row ( pta ) ;
}
{
pta [ 0 ] = ( char * ) " My SQL_Monitor_ping_check_OK" ;
sprintf ( buf , " %l lu" , GloMy Mon- > ping_check_OK ) ;
pta [ 0 ] = ( char * ) " Pg SQL_Monitor_ping_check_OK" ;
sprintf ( buf , " %l u" , GloPg Mon- > ping_check_OK ) ;
pta [ 1 ] = buf ;
result - > add_row ( pta ) ;
}
{
pta [ 0 ] = ( char * ) " My SQL_Monitor_ping_check_ERR" ;
sprintf ( buf , " %l lu" , GloMy Mon- > ping_check_ERR ) ;
pta [ 0 ] = ( char * ) " Pg SQL_Monitor_ping_check_ERR" ;
sprintf ( buf , " %l u" , GloPg Mon- > ping_check_ERR ) ;
pta [ 1 ] = buf ;
result - > add_row ( pta ) ;
}
/*
{
pta [ 0 ] = ( char * ) " MySQL_Monitor_read_only_check_OK " ;
sprintf ( buf , " %llu " , GloMyMon - > read_only_check_OK ) ;