summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorMichael Widenius <monty@askmonty.org>2011-07-01 15:08:30 +0300
committerMichael Widenius <monty@askmonty.org>2011-07-01 15:08:30 +0300
commit3c78bfe7f1a1530daea83f5dae091bd654ea6d37 (patch)
treeb54abedc9d4f6ac33b7aa2128454fcd37d739d78 /scripts
parent62e47b4402678abc85a689a820d201248dabbc36 (diff)
downloadmariadb-git-3c78bfe7f1a1530daea83f5dae091bd654ea6d37.tar.gz
Added progress reporting for alter table, LOAD DATA INFILE and for aria tables: check table, repair table, analyze table.
- The client gets a progress report message that triggers a callback function if requested with mysql_options(MYSQL_PROGRESS_CALLBACK, function) - Added Progress field last to 'show processlist' - Stage, Max_stage and Progress field added to information_schema.progresslist - The 'mysql' client by defaults enables progress reports when the output is a tty. - Added progress_report_time time variable to configure how often progress reports is sent to client Added read only system variable 'in_transaction' which is 1 if we have executed a BEGIN statement. client/client_priv.h: Added OPT_REPORT_PROGRESS client/mysql.cc: Added option --progress-reports (on by default if not batch mode) Progress reports is written to stdout for long running commands include/Makefile.am: Added mysql/service_progress_report.h include/myisamchk.h: Added variables to be able to do progress reporting in Aria and later in MyISAM include/mysql.h: Added new mysql_options() parameter: MYSQL_PROGRESS_CALLBACK include/mysql.h.pp: Added new mysql_options() parameter: MYSQL_PROGRESS_CALLBACK include/mysql/plugin.h: Added functions for reporting progress. include/mysql/plugin_auth.h.pp: Added functions for reporting progress. include/mysql_com.h: Added CLIENT_PROGRESS mysql_real_connect() flag. include/sql_common.h: Added callback function for reporting progress mysql-test/r/old-mode.result: Ensure that SHOW PROGRESSLIST doesn't have the Progress column in old mode. mysql-test/suite/funcs_1/datadict/datadict_priv.inc: Added new column mysql-test/suite/funcs_1/datadict/processlist_priv.inc: Test all new PROCESSLIST columns mysql-test/suite/funcs_1/r/is_columns_is.result: Updated results mysql-test/suite/funcs_1/r/is_columns_is_embedded.result: Updated results mysql-test/suite/funcs_1/r/is_columns_mysql_embedded.result: Updated results mysql-test/suite/funcs_1/r/is_tables_is_embedded.result: Updated results mysql-test/suite/funcs_1/r/processlist_priv_no_prot.result: Updated results mysql-test/suite/funcs_1/r/processlist_priv_ps.result: Updated results mysql-test/suite/funcs_1/r/processlist_val_no_prot.result: Updated results mysql-test/suite/funcs_1/r/processlist_val_ps.result: Updated results mysql-test/suite/pbxt/r/pbxt_locking.result: Updated results mysql-test/suite/pbxt/r/skip_name_resolve.result: Updated results mysql-test/t/old-mode.test: Ensure that SHOW PROGRESSLIST doesn't have the Progress column in old mode. plugin/handler_socket/handlersocket/Makefile.am: Added -lmysqlservices scripts/mytop.sh: Made 'State' field width dynamic. Added 'Progress' to process list display. sql-common/client.c: Added handling of progress messages. Removed check_license() function. sql/mysql_priv.h: Added opt_progress_report_time sql/mysqld.cc: Added progress_report_time time variable to configure how often progress reports is sent to client sql/protocol.cc: Added net_send_progress_packet() sql/protocol.h: New prototypes sql/set_var.cc: Added variables progress_report_time and in_transaction sql/sql_acl.cc: Safety fix: Made client_capabilities ulonglong sql/sql_class.cc: Added interface functions for progress reporting sql/sql_class.h: Added varibles in THD for progress reporting. Added CF_REPORT_PROGRESS sql/sql_load.cc: Added progress reporting for LOAD DATA INFILE sql/sql_parse.cc: Added CF_REPORT_PROGRESS for top level commands for which it's safe to send progress reports to client sql/sql_show.cc: Added Progress field last to 'show processlist' Stage, Max_stage and Progress field added to information_schema.progresslist sql/sql_table.cc: Added progress reporting for ALTER TABLE Added THD as argument to copy_data_between_tables() storage/maria/ha_maria.cc: Added progress reporting for check table, repair table, analyze table Fixed a bug in start_bulk_insert() that caused alter table to always run with all keys enabled. storage/maria/ma_check.c: Added progress reporting Remember old state before starting repair. This removes some warnings from optimize_table if create-with-sort fails. storage/maria/ma_check_standalone.h: Added dummy reporting function for standalone Aria programs. storage/maria/ma_sort.c: Added progress reporting storage/maria/maria_chk.c: Updated version storage/maria/maria_def.h: Added new prototypes tests/mysql_client_test.c: Added test case for progress reporting
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/mytop.sh30
1 files changed, 16 insertions, 14 deletions
diff --git a/scripts/mytop.sh b/scripts/mytop.sh
index fdb86c493cd..5c88cf580a4 100755
--- a/scripts/mytop.sh
+++ b/scripts/mytop.sh
@@ -17,6 +17,7 @@ use strict;
use DBI;
use Getopt::Long;
use Socket;
+use List::Util qw(min max);
$main::VERSION = "1.9a";
@@ -1014,7 +1015,7 @@ sub GetData()
$lines_left--;
- printf(" Key Efficiency: %2.1f%% Bps in/out: %5s/%5s ",
+ printf(" MyISAM Key Efficiency: %2.1f%% Bps in/out: %5s/%5s ",
$cache_hits_percent,
make_short($STATUS{Bytes_received} / $STATUS{Uptime} ),
make_short($STATUS{Bytes_sent} / $STATUS{Uptime}));
@@ -1075,21 +1076,22 @@ sub GetData()
## Threads
##
- #my $sz = $width - 52;
- my @sz = (9, 9, 15, 10, 10, 6, 8);
+ my @sz = (9, 8, 15, 9, 6, 5, 6, 8);
my $used = scalar(@sz) + Sum(@sz);
- my $free = $width - $used;
-
+ my $state= $width <= 80 ? 6 : int(min(6+($width-80)/3, 15));
+ my $free = $width - $used - ($state - 6);
+ my $format= "%9s %8s %15s %9s %6s %5s %6s %${state}s %-.${free}s\n";
+ my $format2= "%9d %8.8s %15.15s %9.9s %6d %5.1f %6.6s %${state}.${state}s %-${free}.${free}s\n";
print BOLD() if ($HAS_COLOR);
- printf "%9s %9s %15s %10s %10s %6s %8s %-${free}s\n",
- 'Id','User','Host/IP','DB','Time', 'Cmd', 'State', 'Query';
+ printf $format,
+ 'Id','User','Host/IP','DB','Time', '%', 'Cmd', 'State', 'Query';
print RESET() if ($HAS_COLOR);
## Id User Host DB
- printf "%9s %9s %15s %10s %10s %6s %8s %-.${free}s\n",
- '--','----','-------','--','----', '---', '-----', '----------';
+ printf $format,
+ '--','----','-------','--','----', '-', '---', '-----', '----------';
$lines_left -= 2;
@@ -1137,6 +1139,7 @@ sub GetData()
$thread->{Command} ||= '';
$thread->{Host} ||= '';
$thread->{State} ||= "";
+ $thread->{Progress} ||= 0;
## alter double hyphen comments so they don't break
## the query when newlines are removed - http://freshmeat.net/users/jerjones
@@ -1201,8 +1204,6 @@ sub GetData()
next if ($thread->{Host} !~ $config{filter_host});
next if ($thread->{State} !~ $config{filter_state});
- $thread->{State} = trim(sprintf("%8.8s",$thread->{State}));
-
# Otherwise, print.
my $smInfo;
@@ -1229,9 +1230,9 @@ sub GetData()
print MAGENTA() if $thread->{Time} > $config{long};
}
- printf "%9d %9.9s %15.15s %10.10s %10d %6.6s %8.8s %-${free}.${free}s\n",
+ printf $format2,
$thread->{Id}, $thread->{User}, $thread->{Host}, $thread->{db},
- $thread->{Time}, $thread->{Command}, $thread->{State}, $smInfo;
+ $thread->{Time}, $thread->{Progress}, $thread->{Command}, $thread->{State}, $smInfo;
print RESET() if $HAS_COLOR;
@@ -2321,8 +2322,9 @@ showing most values in short form, such as 10k rather than 10000.
=item Michael "Monty" Widenius <monty@askmonty.org>
Fixed a couple of minor bugs that gave warnings on startup.
-Added support for MariaDB (show MariaDB at top).
+Added support for MariaDB (show MariaDB at top and % done).
Cut long server version names to display width.
+Made 'State' length dynamic.
=back