3563
3563
static st_show_var_func_container
3564
3564
show_flushstatustime_cont= { &show_flushstatustime };
3566
static int show_slave_running(Session *session __attribute__((unused)),
3567
SHOW_VAR *var, char *buff)
3569
var->type= SHOW_MY_BOOL;
3570
pthread_mutex_lock(&LOCK_active_mi);
3572
*((bool *)buff)= (bool) (active_mi && active_mi->slave_running &&
3573
active_mi->rli.slave_running);
3574
pthread_mutex_unlock(&LOCK_active_mi);
3578
static st_show_var_func_container
3579
show_slave_running_cont= { &show_slave_running };
3581
static int show_slave_retried_trans(Session *session __attribute__((unused)),
3582
SHOW_VAR *var, char *buff)
3585
TODO: with multimaster, have one such counter per line in
3586
SHOW SLAVE STATUS, and have the sum over all lines here.
3588
pthread_mutex_lock(&LOCK_active_mi);
3591
var->type= SHOW_LONG;
3593
pthread_mutex_lock(&active_mi->rli.data_lock);
3594
*((long *)buff)= (long)active_mi->rli.retried_trans;
3595
pthread_mutex_unlock(&active_mi->rli.data_lock);
3598
var->type= SHOW_UNDEF;
3599
pthread_mutex_unlock(&LOCK_active_mi);
3603
static st_show_var_func_container
3604
show_slave_retried_trans_cont= { &show_slave_retried_trans };
3606
static int show_slave_received_heartbeats(Session *session __attribute__((unused)),
3607
SHOW_VAR *var, char *buff)
3609
pthread_mutex_lock(&LOCK_active_mi);
3612
var->type= SHOW_LONGLONG;
3614
pthread_mutex_lock(&active_mi->rli.data_lock);
3615
*((int64_t *)buff)= active_mi->received_heartbeats;
3616
pthread_mutex_unlock(&active_mi->rli.data_lock);
3619
var->type= SHOW_UNDEF;
3620
pthread_mutex_unlock(&LOCK_active_mi);
3624
static st_show_var_func_container
3625
show_slave_received_heartbeats_cont= { &show_slave_received_heartbeats };
3627
static int show_heartbeat_period(Session *session __attribute__((unused)),
3628
SHOW_VAR *var, char *buff)
3630
pthread_mutex_lock(&LOCK_active_mi);
3633
var->type= SHOW_CHAR;
3635
sprintf(buff, "%.3f",active_mi->heartbeat_period);
3638
var->type= SHOW_UNDEF;
3639
pthread_mutex_unlock(&LOCK_active_mi);
3643
static st_show_var_func_container
3644
show_heartbeat_period_cont= { &show_heartbeat_period};
3646
3566
static int show_open_tables(Session *session __attribute__((unused)),
3647
3567
SHOW_VAR *var, char *buff)
3673
3593
SHOW_VAR status_vars[]= {
3674
3594
{"Aborted_clients", (char*) &aborted_threads, SHOW_LONGLONG},
3675
3595
{"Aborted_connects", (char*) &aborted_connects, SHOW_LONGLONG},
3676
{"Binlog_cache_disk_use", (char*) &binlog_cache_disk_use, SHOW_LONGLONG},
3677
{"Binlog_cache_use", (char*) &binlog_cache_use, SHOW_LONGLONG},
3678
3596
{"Bytes_received", (char*) offsetof(STATUS_VAR, bytes_received), SHOW_LONGLONG_STATUS},
3679
3597
{"Bytes_sent", (char*) offsetof(STATUS_VAR, bytes_sent), SHOW_LONGLONG_STATUS},
3680
3598
{"Com", (char*) com_status_vars, SHOW_ARRAY},
3720
3638
{"Select_range", (char*) offsetof(STATUS_VAR, select_range_count), SHOW_LONG_STATUS},
3721
3639
{"Select_range_check", (char*) offsetof(STATUS_VAR, select_range_check_count), SHOW_LONG_STATUS},
3722
3640
{"Select_scan", (char*) offsetof(STATUS_VAR, select_scan_count), SHOW_LONG_STATUS},
3723
{"Slave_open_temp_tables", (char*) &slave_open_temp_tables, SHOW_LONGLONG},
3724
{"Slave_retried_transactions",(char*) &show_slave_retried_trans_cont, SHOW_FUNC},
3725
{"Slave_heartbeat_period", (char*) &show_heartbeat_period_cont, SHOW_FUNC},
3726
{"Slave_received_heartbeats",(char*) &show_slave_received_heartbeats_cont, SHOW_FUNC},
3727
{"Slave_running", (char*) &show_slave_running_cont, SHOW_FUNC},
3728
3641
{"Slow_launch_threads", (char*) &slow_launch_threads, SHOW_LONGLONG},
3729
3642
{"Slow_queries", (char*) offsetof(STATUS_VAR, long_query_count), SHOW_LONG_STATUS},
3730
3643
{"Sort_merge_passes", (char*) offsetof(STATUS_VAR, filesort_merge_passes), SHOW_LONG_STATUS},
3733
3646
{"Sort_scan", (char*) offsetof(STATUS_VAR, filesort_scan_count), SHOW_LONG_STATUS},
3734
3647
{"Table_locks_immediate", (char*) &locks_immediate, SHOW_INT},
3735
3648
{"Table_locks_waited", (char*) &locks_waited, SHOW_INT},
3737
{"Tc_log_max_pages_used", (char*) &tc_log_max_pages_used, SHOW_LONGLONG},
3738
{"Tc_log_page_size", (char*) &tc_log_page_size, SHOW_LONGLONG},
3739
{"Tc_log_page_waits", (char*) &tc_log_page_waits, SHOW_LONGLONG},
3741
3649
{"Threads_connected", (char*) &connection_count, SHOW_INT},
3742
3650
{"Threads_created", (char*) &thread_created, SHOW_LONG_NOFLUSH},
3743
3651
{"Threads_running", (char*) &thread_running, SHOW_INT},