Import Percona MySQL tools

Percona Toolkit is a collection of advanced command-line tools used
to perform a variety of MySQL and system tasks that are too difficult
or complex to perform manually.

ok okan@ william@
This commit is contained in:
giovanni 2012-02-27 10:18:12 +00:00
parent 6f33cbf65b
commit 6a2b1d222c
8 changed files with 233 additions and 0 deletions

View File

@ -0,0 +1,35 @@
# $OpenBSD: Makefile,v 1.1.1.1 2012/02/27 10:18:12 giovanni Exp $
COMMENT = MySQL Percona tools
V = 2.0.3
DISTNAME = percona-toolkit-${V}
EPOCH = 0
CATEGORIES = databases perl5
HOMEPAGE = http://www.percona.com/software/percona-toolkit/
MAINTAINER = Giovanni Bechis <giovanni@openbsd.org>
# GPLv2
PERMIT_PACKAGE_CDROM = Yes
PERMIT_PACKAGE_FTP = Yes
PERMIT_DISTFILES_CDROM = Yes
PERMIT_DISTFILES_FTP = Yes
MASTER_SITES = http://www.percona.com/redir/downloads/percona-toolkit/${V}/
RUN_DEPENDS = databases/p5-DBD-mysql>=3.0 \
devel/p5-Term-ReadKey \
shells/bash \
sysutils/flock \
sysutils/lsof
CONFIGURE_STYLE = perl
pre-configure:
${SUBST_CMD} ${WRKSRC}/bin/pt-summary
@find ${WRKSRC} \( -name "*.orig" -or -name "*.beforesubst" \) \
-exec rm -f {} \;
.include <bsd.port.mk>

View File

@ -0,0 +1,5 @@
MD5 (percona-toolkit-2.0.3.tar.gz) = EPOUwQEGe2vyhCfF1IMzMA==
RMD160 (percona-toolkit-2.0.3.tar.gz) = AxjhreuDfpdZ87u6AscubnYjq08=
SHA1 (percona-toolkit-2.0.3.tar.gz) = INmLldXVb2P0hOXfDeIt+SrP+LI=
SHA256 (percona-toolkit-2.0.3.tar.gz) = IP6UrC95USQ1hEFGc1EDwkBRKhEP/AtWrY3EGOSi6N4=
SIZE (percona-toolkit-2.0.3.tar.gz) = 1069445

View File

@ -0,0 +1,26 @@
$OpenBSD: patch-bin_pt-mext,v 1.1.1.1 2012/02/27 10:18:12 giovanni Exp $
--- bin/pt-mext.orig Mon Feb 6 21:52:31 2012
+++ bin/pt-mext Thu Feb 23 15:11:19 2012
@@ -62,7 +62,7 @@ NUM=0;
REL=0;
# Command-line parsing.
-args=`getopt -u -n mext r "$@"`;
+args=`getopt pt-mext "$@"`;
if [ "$?" = "1" ]; then
usage;
fi
@@ -94,11 +94,11 @@ SPEC="%-33s %13d"
AWKS=""
NUM=`ls "$FILE"* | wc -l`;
# The last file will be empty...
-NUM=`expr $NUM - 3`;
+NUM=`expr $NUM - 2`;
# Join each file with the next file, joining on the first field. Build a printf
# spec and awk spec at the same time.
-for i in `seq 0 $NUM`; do
+for i in $(expr `jot $NUM` - 1); do
NEXTFILE=`expr $i + 1`;
# Sort each file and eliminate empty lines, so 'join' doesn't complain.

View File

@ -0,0 +1,12 @@
$OpenBSD: patch-bin_pt-mysql-summary,v 1.1.1.1 2012/02/27 10:18:12 giovanni Exp $
--- bin/pt-mysql-summary.orig Mon Feb 6 21:52:31 2012
+++ bin/pt-mysql-summary Thu Feb 9 16:49:50 2012
@@ -155,7 +155,7 @@ shorten() {
# docs and tests.
# ##############################################################################
group_concat () {
- sed -e '{H; $!d}' -e 'x' -e 's/\n[[:space:]]*\([[:digit:]]*\)[[:space:]]*/, \1x/g' -e 's/[[:space:]][[:space:]]*/ /g' -e 's/, //' ${1}
+ sed -e 'H; $!d' -e 'x' -e 's/\n[[:space:]]*\([[:digit:]]*\)[[:space:]]*/, \1x/g' -e 's/[[:space:]][[:space:]]*/ /g' -e 's/, //' ${1}
}
# Accepts a number of seconds, and outputs a d+h:m:s formatted string

View File

@ -0,0 +1,15 @@
$OpenBSD: patch-bin_pt-sift,v 1.1.1.1 2012/02/27 10:18:12 giovanni Exp $
--- bin/pt-sift.orig Mon Feb 6 21:52:31 2012
+++ bin/pt-sift Thu Feb 9 16:49:50 2012
@@ -103,11 +103,6 @@ main() {
eval "PR_$prog_base"="./$prog"
elif [ -f "${BASEDIR}/$prog" -a -x "${BASEDIR}/$prog" ]; then
eval "PR_$prog_base"="${BASEDIR}/$prog"
- elif which "curl" >/dev/null 2>&1; then
- echo "Fetching $prog" >&2
- curl "http://www.percona.com/get/$prog" > "$prog" && chmod +x "$prog"
- eval "PR_$prog_base"="./$prog"
- else
echo "Cannot find or fetch required program: $prog" >&2
exit 1
fi

View File

@ -0,0 +1,64 @@
$OpenBSD: patch-bin_pt-summary,v 1.1.1.1 2012/02/27 10:18:12 giovanni Exp $
--- bin/pt-summary.orig Mon Feb 6 21:52:31 2012
+++ bin/pt-summary Fri Feb 24 09:22:49 2012
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!${LOCALBASE}/bin/bash
# This program is part of Percona Toolkit: http://www.percona.com/software/
# See "COPYRIGHT, LICENSE, AND WARRANTY" at the end of this file for legal
@@ -219,6 +219,15 @@ parse_sysctl_cpu_freebsd() {
}
# ##############################################################################
+# Detect cpu info on OpenBSD, and format it as CPU info
+# ##############################################################################
+parse_sysctl_cpu_openbsd() {
+ name_val "Processors" "$(sysctl -n hw.ncpu)"
+ name_val "Speeds" "$(sysctl -n hw.cpuspeed)"
+ name_val "Models" "$(sysctl -n hw.model)"
+}
+
+# ##############################################################################
# Parse CPU info from psrinfo -v
# ##############################################################################
parse_psrinfo_cpus() {
@@ -274,6 +283,17 @@ parse_memory_sysctl_freebsd() {
}
# ##############################################################################
+# Parse OpenBSD memory info from sysctl output.
+# ##############################################################################
+parse_memory_sysctl_openbsd() {
+ swap_mem=$(swapctl -s | awk '{print $2;}')
+ swap_mem=$(bc -e $swap_mem*512 -e quit)
+ name_val Total $(shorten $(sysctl -n hw.physmem) 1)
+ name_val User $(shorten $(sysctl -n hw.usermem) 1)
+ name_val Swap $(shorten ${swap_mem} 1)
+}
+
+# ##############################################################################
# Parse memory devices from the output of 'dmidecode'.
# ##############################################################################
parse_dmidecode_mem_devices () {
@@ -929,6 +949,9 @@ main () {
elif [ "${platform}" = "FreeBSD" ]; then
release="$(uname -r)"
kernel="$(sysctl -n kern.osrevision)"
+ elif [ "${platform}" = "OpenBSD" ]; then
+ release="$(uname -r)"
+ kernel="$(sysctl -n kern.version | awk '{print $2;}')"
elif [ "${platform}" = "SunOS" ]; then
release="$(head -n1 /etc/release)"
if [ -z "${release}" ]; then
@@ -947,6 +970,10 @@ main () {
fi
elif [ "${platform}" = "FreeBSD" ]; then
if sysctl hw.machine_arch | grep -v 'i[36]86' >/dev/null; then
+ CPU_ARCH='64-bit'
+ fi
+ elif [ "${platform}" = "OpenBSD" ]; then
+ if arch -s | grep '64' >/dev/null; then
CPU_ARCH='64-bit'
fi
elif [ "${platform}" = "SunOS" ]; then

View File

@ -0,0 +1,3 @@
Percona Toolkit is a collection of advanced command-line tools used
to perform a variety of MySQL and system tasks that are too difficult
or complex to perform manually.

View File

@ -0,0 +1,73 @@
@comment $OpenBSD: PLIST,v 1.1.1.1 2012/02/27 10:18:12 giovanni Exp $
@pkgpath databases/maatkit
bin/pt-align
bin/pt-archiver
@comment bin/pt-collect
bin/pt-config-diff
bin/pt-deadlock-logger
@comment bin/pt-diskstats
bin/pt-duplicate-key-checker
bin/pt-fifo-split
bin/pt-find
bin/pt-fk-error-logger
bin/pt-heartbeat
bin/pt-index-usage
@comment bin/pt-ioprofile
bin/pt-kill
bin/pt-log-player
bin/pt-mext
bin/pt-mysql-summary
bin/pt-online-schema-change
@comment bin/pt-pmp
bin/pt-query-advisor
bin/pt-query-digest
bin/pt-show-grants
bin/pt-sift
bin/pt-slave-delay
bin/pt-slave-find
bin/pt-slave-restart
@comment bin/pt-stalk
bin/pt-summary
bin/pt-table-checksum
bin/pt-table-sync
bin/pt-tcp-model
bin/pt-trend
bin/pt-upgrade
bin/pt-variable-advisor
bin/pt-visual-explain
@man man/man1/percona-toolkit.1
@man man/man1/pt-align.1
@man man/man1/pt-archiver.1
@comment @man man/man1/pt-collect.1
@man man/man1/pt-config-diff.1
@man man/man1/pt-deadlock-logger.1
@comment @man man/man1/pt-diskstats.1
@man man/man1/pt-duplicate-key-checker.1
@man man/man1/pt-fifo-split.1
@man man/man1/pt-find.1
@man man/man1/pt-fk-error-logger.1
@man man/man1/pt-heartbeat.1
@man man/man1/pt-index-usage.1
@comment @man man/man1/pt-ioprofile.1
@man man/man1/pt-kill.1
@man man/man1/pt-log-player.1
@man man/man1/pt-mext.1
@man man/man1/pt-mysql-summary.1
@man man/man1/pt-online-schema-change.1
@comment @man man/man1/pt-pmp.1
@man man/man1/pt-query-advisor.1
@man man/man1/pt-query-digest.1
@man man/man1/pt-show-grants.1
@man man/man1/pt-sift.1
@man man/man1/pt-slave-delay.1
@man man/man1/pt-slave-find.1
@man man/man1/pt-slave-restart.1
@comment @man man/man1/pt-stalk.1
@man man/man1/pt-summary.1
@man man/man1/pt-table-checksum.1
@man man/man1/pt-table-sync.1
@man man/man1/pt-tcp-model.1
@man man/man1/pt-trend.1
@man man/man1/pt-upgrade.1
@man man/man1/pt-variable-advisor.1
@man man/man1/pt-visual-explain.1