diff options
Diffstat (limited to 'dev-db/mytop/files/mytop-1.6-queries-vs-questions-mysql-5.0.76.patch')
-rw-r--r-- | dev-db/mytop/files/mytop-1.6-queries-vs-questions-mysql-5.0.76.patch | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/dev-db/mytop/files/mytop-1.6-queries-vs-questions-mysql-5.0.76.patch b/dev-db/mytop/files/mytop-1.6-queries-vs-questions-mysql-5.0.76.patch new file mode 100644 index 000000000000..85e33fccd952 --- /dev/null +++ b/dev-db/mytop/files/mytop-1.6-queries-vs-questions-mysql-5.0.76.patch @@ -0,0 +1,61 @@ +In MySQL 5.0.72 the Questions variable was changed to only contain the number +of client-initiated queries, NOT the number of overall queries. This caused +problems with the select/insert/update/delete percentages because Com_* was +still based on the overall queries. + +MySQL 5.0.76 introduced a new variable 'Queries' with the behavior of the old +Questions variable. + +Signed-off-by: Robin H. Johnson <robbat2@gentoo.org> +MySQL-Bug: 41131 +MySQL-Bug-URL: http://bugs.mysql.com/?id=41131 + +diff -Nuar mytop-1.6.orig/mytop mytop-1.6/mytop +--- mytop-1.6.orig/mytop 2009-02-13 13:59:43.882787823 -0800 ++++ mytop-1.6/mytop 2009-02-13 14:03:54.749418810 -0800 +@@ -800,8 +800,8 @@ + + ## Queries per second... + +- my $avg_queries_per_sec = sprintf("%.2f", $STATUS{Questions} / $STATUS{Uptime}); +- my $num_queries = $STATUS{Questions}; ++ my $num_queries = defined($STATUS{Queries}) ? $STATUS{Queries} : $STATUS{Questions}; ++ my $avg_queries_per_sec = sprintf("%.2f", $num_queries / $STATUS{Uptime}); + + my @t = localtime(time); + +@@ -820,25 +820,25 @@ + + + printf " Queries: %-5s qps: %4.0f Slow: %7s Se/In/Up/De(%%): %02.0f/%02.0f/%02.0f/%02.0f \n", +- make_short( $STATUS{Questions} ), # q total +- $STATUS{Questions} / $STATUS{Uptime}, # qps, average ++ make_short( $num_queries ), # q total ++ $num_queries / $STATUS{Uptime}, # qps, average + make_short( $STATUS{Slow_queries} ), # slow + + # hmm. a Qcache hit is really a select and should be counted. +- 100 * ($STATUS{Com_select} + ($STATUS{Qcache_hits}||0) ) / $STATUS{Questions}, +- 100 * ($STATUS{Com_insert} + $STATUS{Com_replace} ) / $STATUS{Questions}, +- 100 * ($STATUS{Com_update} ) / $STATUS{Questions}, +- 100 * $STATUS{Com_delete} / $STATUS{Questions}; ++ 100 * ($STATUS{Com_select} + ($STATUS{Qcache_hits}||0) ) / $num_queries, ++ 100 * ($STATUS{Com_insert} + $STATUS{Com_replace} ) / $num_queries, ++ 100 * ($STATUS{Com_update} ) / $num_queries, ++ 100 * $STATUS{Com_delete} / $num_queries; + + $lines_left--; + + if ($t_delta) + { +- my $q_diff = ( $STATUS{Questions} - $OLD_STATUS{Questions} ); +-# print("q_diff: $STATUS{Questions} - $OLD_STATUS{Questions} / $t_delta = $q_diff\n"); ++ my $q_diff = ( $num_queries - $OLD_STATUS{Questions} ); ++# print("q_diff: $num_queries - $OLD_STATUS{Questions} / $t_delta = $q_diff\n"); + + printf(" qps now: %4.0f Slow qps: %3.1f Threads: %4.0f (%4.0f/%4.0f) %02.0f/%02.0f/%02.0f/%02.0f \n", +- ( $STATUS{Questions} - $OLD_STATUS{Questions} ) / $t_delta, ++ ( $num_queries - $OLD_STATUS{Questions} ) / $t_delta, + ( # slow now (qps) + ($STATUS{Slow_queries} ) ? + ( $STATUS{Slow_queries} - $OLD_STATUS{Slow_queries} ) / $t_delta : |