Gentoo Archives: gentoo-commits

From: Brian Evans <grknight@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-db/mytop/, dev-db/mytop/files/
Date: Fri, 27 Jan 2017 15:04:40
Message-Id: 1485529463.b7c7934163c9348fe712a913328dcb5593bc8ac8.grknight@gentoo
1 commit: b7c7934163c9348fe712a913328dcb5593bc8ac8
2 Author: Brian Evans <grknight <AT> gentoo <DOT> org>
3 AuthorDate: Fri Jan 27 15:04:23 2017 +0000
4 Commit: Brian Evans <grknight <AT> gentoo <DOT> org>
5 CommitDate: Fri Jan 27 15:04:23 2017 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b7c79341
7
8 dev-db/mytop: Version bump
9
10 Package-Manager: Portage-2.3.3, Repoman-2.3.1
11
12 dev-db/mytop/Manifest | 1 +
13 dev-db/mytop/files/mytop-1.9.1-global-status.patch | 94 ++++++++++++++++++++++
14 ...p-1.9.1-queries-vs-questions-mysql-5.0.76.patch | 73 +++++++++++++++++
15 dev-db/mytop/mytop-1.9.1.ebuild | 36 +++++++++
16 4 files changed, 204 insertions(+)
17
18 diff --git a/dev-db/mytop/Manifest b/dev-db/mytop/Manifest
19 index 411147e..19af9cf 100644
20 --- a/dev-db/mytop/Manifest
21 +++ b/dev-db/mytop/Manifest
22 @@ -1 +1,2 @@
23 DIST mytop-1.6.tar.gz 19720 SHA256 b17c702598b10bb0ce2695f609122637c799eaaaec1afaa73246b048f07be9bd SHA512 672209d828c70fd740a791f2e4dfac1e4c594adff197b8bc43322249f03f6c7b18a750da0892c1519fe29e24b661e41d40cdad3a29b546dec4b3a747155566e2 WHIRLPOOL 4fd03d2e871db6b56db2fa7f39046f415a668c3732f47c0668f73ab7109048a8872cfdc01704ba4152d92500f2ab5c5c66b8d2e948748e43ab56e508980c3b08
24 +DIST mytop-1.9.1.tar.gz 22095 SHA256 179d79459d0013ab9cea2040a41c49a79822162d6e64a7a85f84cdc44828145e SHA512 e6d38812dd69f5e330e5fe9206abe7e00c9e08dd61ba52a9dbd18a823bb09715832d27fb8db6fe1146d78eb56845cc0a7e2a72989ee56267d6482238fee84bc5 WHIRLPOOL 8d47b1067639f1d5464e63abb0ec10df2e98c17112f4ba6321849cea3a0a932e58e04edef83e358ae1cea01f9338509c40bf1e21ef8d46f4820c9f6b89f25b2e
25
26 diff --git a/dev-db/mytop/files/mytop-1.9.1-global-status.patch b/dev-db/mytop/files/mytop-1.9.1-global-status.patch
27 new file mode 100644
28 index 00000000..ae0163c
29 --- /dev/null
30 +++ b/dev-db/mytop/files/mytop-1.9.1-global-status.patch
31 @@ -0,0 +1,94 @@
32 +Use GLOBAL STATUS instead of implicit session status.
33 +
34 +As of MySQL-5.0.72, many of the status variables split for session and global
35 +variants. Importantly, the Com_* and Questions ones did, and this broke the
36 +statistics at the top of mytop.
37 +
38 +Signed-off-by: Robin H. Johnson <robbat2@g.o>
39 +MySQL-Bug: 41131
40 +MySQL-Bug-URL: http://bugs.mysql.com/bug.php?id=41131
41 +
42 +diff -Nuar --exclude '*~' mytop-1.6.orig/mytop mytop-1.6/mytop
43 +--- mytop-1.6.orig/mytop 2007-02-16 20:57:46.000000000 -0800
44 ++++ mytop-1.6/mytop 2008-11-30 15:18:05.818845253 -0800
45 +@@ -98,7 +98,7 @@
46 + my %qcache = (); ## The query cache--used for full query info support.
47 + my %ucache = (); ## The user cache--used for full killing by user
48 + my %dbcache = (); ## The db cache. This should be merged at some point.
49 +-my %statcache = (); ## The show status cache for GetShowStatus()
50 ++my %statcache = (); ## The show global status cache for GetShowStatus()
51 +
52 + my (%STATUS, %OLD_STATUS); # header stuff.
53 +
54 +@@ -755,7 +755,7 @@
55 +
56 + ## Query Cache info
57 + ##
58 +- ## mysql> show status like 'qcache%';
59 ++ ## mysql> show global status like 'qcache%';
60 + ## +-------------------------+----------+
61 + ## | Variable_name | Value |
62 + ## +-------------------------+----------+
63 +@@ -1064,7 +1064,7 @@
64 +
65 + sub GetQPS()
66 + {
67 +- my($data) = Hashes('SHOW STATUS LIKE "Questions"');
68 ++ my($data) = Hashes('SHOW GLOBAL STATUS LIKE "Questions"');
69 + my $num = $data->{Value};
70 +
71 + if (not defined $questions) ## first time?
72 +@@ -1126,7 +1126,7 @@
73 + }
74 +
75 + # Variable_name and Value pairs come back...
76 +- my @data = Hashes("SHOW STATUS LIKE 'Com_%'");
77 ++ my @data = Hashes("SHOW GLOBAL STATUS LIKE 'Com_%'");
78 + my %cmd_data;
79 + my %cmd_delta;
80 + my %cmd_pct;
81 +@@ -1216,7 +1216,7 @@
82 + sub GetShowStatus()
83 + {
84 + Clear() unless $config{batchmode};
85 +- my @rows = Hashes("SHOW STATUS");
86 ++ my @rows = Hashes("SHOW GLOBAL STATUS");
87 +
88 + printf "%32s %10s %10s\n", 'Counter', 'Total', 'Change';
89 + printf "%32s %10s %10s\n", '-------', '-----', '------';
90 +@@ -1543,7 +1543,7 @@
91 +
92 + And you obviously need access to a MySQL server (version 3.22.x or
93 + 3.23.x) with the necessary security to run the I<SHOW PROCESSLIST> and
94 +-I<SHOW STATUS> commands.
95 ++I<SHOW GLOBAL STATUS> commands.
96 +
97 + If you are a Windows user, using ActiveState's Perl, you can use PPM
98 + (the Perl Package Manager) to install the MySQL and Term::ReadKey
99 +@@ -1599,7 +1599,7 @@
100 + notice features from each of them here.
101 +
102 + B<mytop> will connect to a MySQL server and periodically run the
103 +-I<SHOW PROCESSLIST> and I<SHOW STATUS> commands and attempt to
104 ++I<SHOW PROCESSLIST> and I<SHOW GLOBAL STATUS> commands and attempt to
105 + summarize the information from them in a useful format.
106 +
107 + =head2 The Display
108 +@@ -1817,7 +1817,7 @@
109 +
110 + =item B<c>
111 +
112 +-Show "command counters" based on the Com_* values in SHOW STATUS.
113 ++Show "command counters" based on the Com_* values in SHOW GLOBAL STATUS.
114 + This is a new feature. Feedback welcome.
115 +
116 + =item B<d>
117 +@@ -1904,7 +1904,7 @@
118 +
119 + Some performance information is not available when talking to a
120 + version 3.22.x MySQL server. Additional information (about threads
121 +-mostly) was added to the output of I<SHOW STATUS> in MySQL 3.23.x and
122 ++mostly) was added to the output of I<SHOW GLOBAL STATUS> in MySQL 3.23.x and
123 + B<mytop> makes use of it. If the information is not available, you
124 + will simply see zeros where the real numbers should be.
125 +
126
127 diff --git a/dev-db/mytop/files/mytop-1.9.1-queries-vs-questions-mysql-5.0.76.patch b/dev-db/mytop/files/mytop-1.9.1-queries-vs-questions-mysql-5.0.76.patch
128 new file mode 100644
129 index 00000000..0314c8a
130 --- /dev/null
131 +++ b/dev-db/mytop/files/mytop-1.9.1-queries-vs-questions-mysql-5.0.76.patch
132 @@ -0,0 +1,73 @@
133 +In MySQL 5.0.72 the Questions variable was changed to only contain the number
134 +of client-initiated queries, NOT the number of overall queries. This caused
135 +problems with the select/insert/update/delete percentages because Com_* was
136 +still based on the overall queries.
137 +
138 +MySQL 5.0.76 introduced a new variable 'Queries' with the behavior of the old
139 +Questions variable.
140 +
141 +Signed-off-by: Robin H. Johnson <robbat2@g.o>
142 +MySQL-Bug: 41131
143 +MySQL-Bug-URL: http://bugs.mysql.com/?id=41131
144 +
145 +====
146 +Revision 2:
147 +The first revision missed changing the instances of $OLD_STATUS{Questions}.
148 +
149 +diff -Nuar mytop-1.6.orig/mytop mytop-1.6/mytop
150 +--- mytop-1.6.orig/mytop 2009-02-14 17:28:38.696187159 -0800
151 ++++ mytop-1.6/mytop 2009-02-14 17:36:31.192890507 -0800
152 +@@ -800,8 +800,15 @@
153 +
154 + ## Queries per second...
155 +
156 +- my $avg_queries_per_sec = sprintf("%.2f", $STATUS{Questions} / $STATUS{Uptime});
157 +- my $num_queries = $STATUS{Questions};
158 ++ my ($num_queries, $old_num_queries);
159 ++ if(defined($STATUS{Queries})) {
160 ++ $num_queries = $STATUS{Queries};
161 ++ $old_num_queries = $OLD_STATUS{Queries};
162 ++ } else {
163 ++ $num_queries = $STATUS{Questions};
164 ++ $old_num_queries = $OLD_STATUS{Questions};
165 ++ }
166 ++ my $avg_queries_per_sec = sprintf("%.2f", $num_queries / $STATUS{Uptime});
167 +
168 + my @t = localtime(time);
169 +
170 +@@ -924,26 +924,26 @@
171 +
172 +
173 + printf " Queries: %-6s qps: %4.0f Slow: %7s Se/In/Up/De(%%): %02.0f/%02.0f/%02.0f/%02.0f \n",
174 +- make_short( $STATUS{Questions} ), # q total
175 +- $STATUS{Questions} / $STATUS{Uptime}, # qps, average
176 ++ make_short( $num_queries ), # q total
177 ++ $num_queries / $STATUS{Uptime}, # qps, average
178 + make_short( $STATUS{Slow_queries} ), # slow
179 +
180 + # hmm. a Qcache hit is really a select and should be counted.
181 +- 100 * ($STATUS{Com_select} + ($STATUS{Qcache_hits}||0) ) / $STATUS{Questions},
182 +- 100 * ($STATUS{Com_insert} + $STATUS{Com_replace} ) / $STATUS{Questions},
183 +- 100 * ($STATUS{Com_update} ) / $STATUS{Questions},
184 +- 100 * $STATUS{Com_delete} / $STATUS{Questions};
185 ++ 100 * ($STATUS{Com_select} + ($STATUS{Qcache_hits}||0) ) / $num_queries,
186 ++ 100 * ($STATUS{Com_insert} + $STATUS{Com_replace} ) / $num_queries,
187 ++ 100 * ($STATUS{Com_update} ) / $num_queries,
188 ++ 100 * $STATUS{Com_delete} / $num_queries;
189 +
190 + $lines_left--;
191 +
192 + if ($t_delta)
193 + {
194 +- my $q_diff = ( $STATUS{Questions} - $OLD_STATUS{Questions} );
195 +-# print("q_diff: $STATUS{Questions} - $OLD_STATUS{Questions} / $t_delta = $q_diff\n");
196 ++ my $q_diff = ( $num_queries - $old_num_queries );
197 ++# print("q_diff: $num_queries - $old_num_queries / $t_delta = $q_diff\n");
198 +
199 + printf(" Sorts: %5.0f qps now: %4.0f Slow qps: %3.1f Threads: %4.0f (%4.0f/%4.0f) %02.0f/%02.0f/%02.0f/%02.0f \n",
200 + ( $STATUS{Sort_rows} - $OLD_STATUS{Sort_rows} ) / $t_delta,
201 +- ( $STATUS{Questions} - $OLD_STATUS{Questions} ) / $t_delta,
202 ++ ( $num_queries - $old_num_queries ) / $t_delta,
203 + ( # slow now (qps)
204 + ($STATUS{Slow_queries} ) ?
205 + ( $STATUS{Slow_queries} - $OLD_STATUS{Slow_queries} ) / $t_delta :
206
207 diff --git a/dev-db/mytop/mytop-1.9.1.ebuild b/dev-db/mytop/mytop-1.9.1.ebuild
208 new file mode 100644
209 index 00000000..5294bbf
210 --- /dev/null
211 +++ b/dev-db/mytop/mytop-1.9.1.ebuild
212 @@ -0,0 +1,36 @@
213 +# Copyright 1999-2017 Gentoo Foundation
214 +# Distributed under the terms of the GNU General Public License v2
215 +# $Id$
216 +
217 +EAPI=6
218 +
219 +inherit perl-module
220 +
221 +DESCRIPTION="mytop - a top clone for mysql"
222 +HOMEPAGE="http://www.mysqlfanboy.com/mytop-3/"
223 +SRC_URI="http://www.mysqlfanboy.com/mytop-3/${P}.tar.gz"
224 +
225 +LICENSE="GPL-2"
226 +KEYWORDS="~alpha ~amd64 ~ppc ~sparc ~x86"
227 +SLOT="0"
228 +IUSE=""
229 +
230 +RDEPEND="dev-perl/DBD-mysql
231 + virtual/perl-Getopt-Long
232 + dev-perl/TermReadKey
233 + virtual/perl-Term-ANSIColor
234 + virtual/perl-Time-HiRes"
235 +DEPEND="${RDEPEND}
236 + >=sys-apps/sed-4"
237 +
238 +PATCHES=( "${FILESDIR}/${PN}-1.9.1-global-status.patch"
239 + "${FILESDIR}/${PN}-1.9.1-queries-vs-questions-mysql-5.0.76.patch"
240 + )
241 +SRC_TEST="do"
242 +
243 +src_install() {
244 + perl-module_src_install
245 + sed -i -r\
246 + -e "s|socket( +)=> '',|socket\1=> '/var/run/mysqld/mysqld.sock',|g" \
247 + "${D}"/usr/bin/mytop
248 +}