@@ -5933,7 +5933,7 @@ sub mariadb_xtradb {
59335933 infoprint " XtraDB is enabled." ;
59345934 infoprint " Note that MariaDB 10.2 makes use of InnoDB, not XtraDB."
59355935
5936- # Not implemented
5936+ # Not implemented
59375937}
59385938
59395939# Recommendations for RocksDB
@@ -6261,7 +6261,12 @@ sub mariadb_galera {
62616261 goodprint " InnoDB flush log at each commit is disabled for Galera." ;
62626262 }
62636263
6264- infoprint " Read consistency mode :" . $myvar {' wsrep_causal_reads' };
6264+ if ( defined $myvar {' wsrep_causal_reads' } and $myvar {' wsrep_causal_reads' } ne ' ' ) {
6265+ infoprint " Read consistency mode :" . $myvar {' wsrep_causal_reads' };
6266+ }
6267+ elsif ( defined $myvar {' wsrep_sync_wait' } ) {
6268+ infoprint " Sync Wait mode : " . $myvar {' wsrep_sync_wait' };
6269+ }
62656270
62666271 if ( defined ( $myvar {' wsrep_cluster_name' } )
62676272 and $myvar {' wsrep_on' } eq " ON" )
@@ -6757,6 +6762,15 @@ sub mysql_innodb {
67576762 # InnoDB Buffer Pool Size > 64Go
67586763 my $max_innodb_buffer_pool_instances =
67596764 int ( $myvar {' innodb_buffer_pool_size' } / ( 1024 * 1024 * 1024 ) );
6765+
6766+ my $nb_cpus = cpu_cores();
6767+ if ( $nb_cpus > 0 && $max_innodb_buffer_pool_instances > $nb_cpus )
6768+ {
6769+ infoprint
6770+ " Recommendation for innodb_buffer_pool_instances is capped by the number of CPU cores ($nb_cpus )." ;
6771+ $max_innodb_buffer_pool_instances = $nb_cpus ;
6772+ }
6773+
67606774 $max_innodb_buffer_pool_instances = 64
67616775 if ( $max_innodb_buffer_pool_instances > 64 );
67626776
@@ -6798,7 +6812,7 @@ sub mysql_innodb {
67986812 infoprint
67996813" innodb_buffer_pool_chunk_size is set to 'autosize' (0) in MariaDB >= 10.8. Skipping chunk size checks." ;
68006814 }
6801- elsif (!defined ( $myvar {' innodb_buffer_pool_chunk_size' } )
6815+ elsif ( !defined ( $myvar {' innodb_buffer_pool_chunk_size' } )
68026816 || $myvar {' innodb_buffer_pool_chunk_size' } == 0
68036817 || !defined ( $myvar {' innodb_buffer_pool_size' } )
68046818 || $myvar {' innodb_buffer_pool_size' } == 0
@@ -6954,6 +6968,39 @@ sub mysql_innodb {
69546968 $result {' Calculations' } = {%mycalc };
69556969}
69566970
6971+ sub mariadb_query_cache_info {
6972+ subheaderprint " Query Cache Information" ;
6973+
6974+ unless ( $myvar {' version' } =~ / MariaDB/i ) {
6975+ infoprint " Not a MariaDB server. Skipping Query Cache Info plugin check." ;
6976+ return ;
6977+ }
6978+
6979+ my $plugin_status = select_one(" SELECT PLUGIN_STATUS FROM information_schema.PLUGINS WHERE PLUGIN_NAME = 'QUERY_CACHE_INFO'" );
6980+
6981+ if ( defined $plugin_status and $plugin_status eq ' ACTIVE' ) {
6982+ goodprint " QUERY_CACHE_INFO plugin is installed and active." ;
6983+
6984+ my $query = " SELECT CONCAT_WS(';;', statement_schema, LEFT(statement_text, 80), result_blocks_count, result_blocks_size) FROM information_schema.query_cache_info" ;
6985+ my @query_cache_data = select_array($query );
6986+
6987+ if (@query_cache_data ) {
6988+ infoprint sprintf (" %-20s | %-82s | %-10s | %-10s" , " Schema" , " Query (truncated)" , " Blocks" , " Size" );
6989+ infoprint " -" x 130 ;
6990+ foreach my $line (@query_cache_data ) {
6991+ my ($schema , $text , $blocks , $size ) = split (/ ;;/ , $line );
6992+ infoprint sprintf (" %-20s | %-82s | %-10s | %-10s" , $schema , $text , $blocks , hr_bytes($size ));
6993+ }
6994+ } else {
6995+ infoprint " No queries found in the query cache." ;
6996+ }
6997+ }
6998+ else {
6999+ infoprint " QUERY_CACHE_INFO plugin is not active or not installed." ;
7000+ return ;
7001+ }
7002+ }
7003+
69577004sub check_metadata_perf {
69587005 subheaderprint " Analysis Performance Metrics" ;
69597006 if ( defined $myvar {' innodb_stats_on_metadata' } ) {
@@ -7630,15 +7677,17 @@ sub dump_result {
76307677 }
76317678
76327679 my $json = JSON-> new-> allow_nonref;
7633- print $json -> utf8(1)-> pretty( ( $opt {' prettyjson' } ? 1 : 0 ) )
7680+ print $json -> utf8(1)
7681+ -> pretty( ( $opt {' prettyjson' } ? 1 : 0 ) )
76347682 -> encode( \%result );
76357683
76367684 if ( $opt {' outputfile' } ne 0 ) {
76377685 unlink $opt {' outputfile' } if ( -e $opt {' outputfile' } );
76387686 open my $fh , q( >) , $opt {' outputfile' }
76397687 or die
76407688" Unable to open $opt {'outputfile'} in write mode. please check permissions for this file or directory" ;
7641- print $fh $json -> utf8(1)-> pretty( ( $opt {' prettyjson' } ? 1 : 0 ) )
7689+ print $fh $json -> utf8(1)
7690+ -> pretty( ( $opt {' prettyjson' } ? 1 : 0 ) )
76427691 -> encode( \%result );
76437692 close $fh ;
76447693 }
@@ -7715,6 +7764,7 @@ sub which {
77157764mariadb_threadpool; # Print MariaDB ThreadPool stats
77167765mysql_myisam; # Print MyISAM stats
77177766mysql_innodb; # Print InnoDB stats
7767+ mariadb_query_cache_info; # Print Query Cache Info stats
77187768mariadb_aria; # Print MariaDB Aria stats
77197769mariadb_tokudb; # Print MariaDB Tokudb stats
77207770mariadb_xtradb; # Print MariaDB XtraDB stats
0 commit comments