forked from gentoo/gentoo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mytop-1.6-queries-vs-questions-mysql-5.0.76.patch
72 lines (58 loc) · 3.29 KB
/
mytop-1.6-queries-vs-questions-mysql-5.0.76.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
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 <[email protected]>
MySQL-Bug: 41131
MySQL-Bug-URL: http://bugs.mysql.com/?id=41131
====
Revision 2:
The first revision missed changing the instances of $OLD_STATUS{Questions}.
diff -Nuar mytop-1.6.orig/mytop mytop-1.6/mytop
--- mytop-1.6.orig/mytop 2009-02-14 17:28:38.696187159 -0800
+++ mytop-1.6/mytop 2009-02-14 17:36:31.192890507 -0800
@@ -800,8 +800,15 @@
## Queries per second...
- my $avg_queries_per_sec = sprintf("%.2f", $STATUS{Questions} / $STATUS{Uptime});
- my $num_queries = $STATUS{Questions};
+ my ($num_queries, $old_num_queries);
+ if(defined($STATUS{Queries})) {
+ $num_queries = $STATUS{Queries};
+ $old_num_queries = $OLD_STATUS{Queries};
+ } else {
+ $num_queries = $STATUS{Questions};
+ $old_num_queries = $OLD_STATUS{Questions};
+ }
+ my $avg_queries_per_sec = sprintf("%.2f", $num_queries / $STATUS{Uptime});
my @t = localtime(time);
@@ -820,25 +827,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_num_queries );
+# print("q_diff: $num_queries - $old_num_queries / $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_num_queries ) / $t_delta,
( # slow now (qps)
($STATUS{Slow_queries} ) ?
( $STATUS{Slow_queries} - $OLD_STATUS{Slow_queries} ) / $t_delta :