summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomas Mozes <hydrapolic@gmail.com>2018-05-25 21:24:37 +0200
committerThomas Deutschmann <whissi@gentoo.org>2018-05-25 21:25:21 +0200
commitb3301af468cabe9bc4113d635328d85c851b01df (patch)
tree36661494b3043c9f1ce5aa9ba07547d6cd6db5af /dev-db/percona-toolkit
parentdev-qt/qtwebengine: fix dependencies (diff)
downloadgentoo-b3301af468cabe9bc4113d635328d85c851b01df.tar.gz
gentoo-b3301af468cabe9bc4113d635328d85c851b01df.tar.bz2
gentoo-b3301af468cabe9bc4113d635328d85c851b01df.zip
dev-db/percona-toolkit: correctly compute slave lag for pt-slave-delay
Closes: https://github.com/gentoo/gentoo/pull/8580 Bug: https://jira.percona.com/browse/PT-1060 Package-Manager: Portage-2.3.38, Repoman-2.3.9
Diffstat (limited to 'dev-db/percona-toolkit')
-rw-r--r--dev-db/percona-toolkit/files/percona-toolkit-3.0.10-slave-delay-fix.patch44
-rw-r--r--dev-db/percona-toolkit/percona-toolkit-3.0.10-r1.ebuild51
2 files changed, 95 insertions, 0 deletions
diff --git a/dev-db/percona-toolkit/files/percona-toolkit-3.0.10-slave-delay-fix.patch b/dev-db/percona-toolkit/files/percona-toolkit-3.0.10-slave-delay-fix.patch
new file mode 100644
index 000000000000..8b8e17d7bfd7
--- /dev/null
+++ b/dev-db/percona-toolkit/files/percona-toolkit-3.0.10-slave-delay-fix.patch
@@ -0,0 +1,44 @@
+https://bugs.launchpad.net/percona-toolkit/+bug/962330
+https://bugs.launchpad.net/percona-toolkit/+bug/1095476
+
+diff --git a/bin/pt-slave-delay b/bin/pt-slave-delay
+index 750b733..fca04e4 100755
+--- a/bin/pt-slave-delay
++++ b/bin/pt-slave-delay
+@@ -4244,6 +4244,7 @@ sub main {
+ my ( $TS, $FILE, $POS ) = ( 0, 1, 2 );
+ my @positions;
+ my $next_start = 0;
++ my $initial_delay = 0;
+ $now = time();
+ my $end = $now + ( $o->get('run-time') || 0 ); # When we should exit
+
+@@ -4258,6 +4259,10 @@ sub main {
+ die "Slave SQL thread is not running";
+ }
+
++ if (defined $status->{seconds_behind_master} and $status->{seconds_behind_master} > 0) {
++ $initial_delay = $status->{seconds_behind_master};
++ }
++
+ my $master_dbh;
+ if ( $master_dsn ) {
+ PTDEBUG && _d('Connecting to master via DSN from cmd-line');
+@@ -4383,7 +4388,7 @@ sub main {
+ || $pos->[$POS] != $res->{position} )
+ {
+ push @positions,
+- [ $now, $res->{file}, $res->{position} ];
++ [ $now - ( $initial_delay || 0 ), $res->{file}, $res->{position} ];
+ }
+ }
+ else {
+@@ -4403,7 +4408,7 @@ sub main {
+ # That happened because for an already lagged slave, $now
+ # isn't the correct time, but is actually
+ # $now - $seconds_lagged.
+- $now - ( $status->{seconds_behind_master} || 0 ),
++ $now - ( $initial_delay || 0 ),
+ $status->{master_log_file},
+ $status->{read_master_log_pos}
+ ];
diff --git a/dev-db/percona-toolkit/percona-toolkit-3.0.10-r1.ebuild b/dev-db/percona-toolkit/percona-toolkit-3.0.10-r1.ebuild
new file mode 100644
index 000000000000..cef323f12f47
--- /dev/null
+++ b/dev-db/percona-toolkit/percona-toolkit-3.0.10-r1.ebuild
@@ -0,0 +1,51 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI="6"
+
+inherit perl-module
+
+DESCRIPTION="Advanced command-line tools to perform a variety of MySQL and system tasks"
+HOMEPAGE="https://www.percona.com/software/mysql-tools/percona-toolkit"
+SRC_URI="https://www.percona.com/downloads/${PN}/${PV}/source/tarball/${P}.tar.gz"
+
+LICENSE="|| ( GPL-2 Artistic )"
+SLOT="0"
+KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
+# Package warrants IUSE doc
+IUSE=""
+
+COMMON_DEPEND="dev-perl/DBI
+ dev-perl/DBD-mysql
+ virtual/perl-Time-HiRes"
+RDEPEND="${COMMON_DEPEND}
+ dev-perl/JSON
+ dev-perl/libwww-perl
+ dev-perl/Role-Tiny
+ virtual/perl-File-Path
+ virtual/perl-Getopt-Long
+ virtual/perl-Time-Local
+ virtual/perl-Digest-MD5
+ virtual/perl-IO-Compress
+ virtual/perl-File-Temp
+ virtual/perl-File-Spec
+ virtual/perl-Scalar-List-Utils
+ dev-perl/TermReadKey"
+DEPEND="${COMMON_DEPEND}
+ virtual/perl-ExtUtils-MakeMaker"
+
+# Bug #501904 - CVE-2014-2029
+# sed -i -e '/^=item --\[no\]version-check/,/^default: yes/{/^default: yes/d}' bin/*
+# ^ is *-no-versioncheck.patch
+PATCHES=(
+ "${FILESDIR}"/${PN}-3.0.7-no-versioncheck.patch
+ "${FILESDIR}"/${PN}-3.0.10-slave-delay-fix.patch
+)
+
+src_prepare() {
+ default
+
+ sed -i \
+ -e "s/=> 'percona-toolkit',/=> 'Percona::Toolkit',/g" \
+ Makefile.PL || die
+}