mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-10 04:39:35 +00:00
Compare commits
71 Commits
RM-505-pt-
...
PT-1867
Author | SHA1 | Date | |
---|---|---|---|
![]() |
c07d9e9f9e | ||
![]() |
9fbb1c0352 | ||
![]() |
e2dab351c6 | ||
![]() |
20bacb32f4 | ||
![]() |
e0ae594493 | ||
![]() |
7fb4cfaa6c | ||
![]() |
5379899d8c | ||
![]() |
7c07edbd13 | ||
![]() |
c635b3eff7 | ||
![]() |
e5df960bf4 | ||
![]() |
15f400bd52 | ||
![]() |
2a9f4e4cda | ||
![]() |
6803ed064e | ||
![]() |
e475428acf | ||
![]() |
e6dc63c68b | ||
![]() |
7016982726 | ||
![]() |
de27179da8 | ||
![]() |
8ff3451362 | ||
![]() |
9f2b72e0df | ||
![]() |
2e62d07ba0 | ||
![]() |
c6b4bd747e | ||
![]() |
89440c1ad1 | ||
![]() |
ec7c62b289 | ||
![]() |
dd921fd657 | ||
![]() |
1dc85c3160 | ||
![]() |
14698e6045 | ||
![]() |
3530c7bccd | ||
![]() |
7002246cd3 | ||
![]() |
1da2cc944b | ||
![]() |
1f62be3279 | ||
![]() |
a91a8decac | ||
![]() |
c9836d5962 | ||
![]() |
b230a9da96 | ||
![]() |
4101d45484 | ||
![]() |
596b62c23b | ||
![]() |
feb79c37c8 | ||
![]() |
1f33cb97e6 | ||
![]() |
40f28d977a | ||
![]() |
b97436f0d5 | ||
![]() |
5efb3bd6f1 | ||
![]() |
55502267d6 | ||
![]() |
8e7113d457 | ||
![]() |
2c866898ee | ||
![]() |
51b2d610a2 | ||
![]() |
9d3485e79f | ||
![]() |
3943cc5767 | ||
![]() |
cebb1a68db | ||
![]() |
9dc874a57d | ||
![]() |
bb1a14658c | ||
![]() |
cc3ace2b6d | ||
![]() |
25b912114d | ||
![]() |
d232a96354 | ||
![]() |
64d6b61132 | ||
![]() |
6fe2e0a586 | ||
![]() |
6e010cc211 | ||
![]() |
92a4a83ad4 | ||
![]() |
c1e6096336 | ||
![]() |
4c8fc31ba2 | ||
![]() |
71630d9a6d | ||
![]() |
96ed8dba0b | ||
![]() |
3fb8002d94 | ||
![]() |
7d6ae54279 | ||
![]() |
8990a967c5 | ||
![]() |
4c5447bf42 | ||
![]() |
4fda9caaf8 | ||
![]() |
7d22b46e54 | ||
![]() |
6dbf807dfa | ||
![]() |
1038816275 | ||
![]() |
4ba96ad7f1 | ||
![]() |
208fb86586 | ||
![]() |
54f90e4bdf |
11
.travis.yml
11
.travis.yml
@@ -36,6 +36,9 @@ env:
|
||||
- MINIO_ENDPOINT: http://localhost:9000/
|
||||
- MINIO_ACCESS_KEY_ID: example00000
|
||||
- MINIO_SECRET_ACCESS_KEY: secret00000
|
||||
# REVIEWDOG_GITHUB_API_TOKEN
|
||||
- secure: "px8XYeNEAFTSTb1hYZuEOxqOXUxvp3EoU+KCtPck/KNozkoS95eBd9klgr3Os4wPKloLdMhrr0VE98lukogUxA/NmnYnos01kegjWgwwM6fkob8JxaN5KK4oUFF1wmirBlrjGlw8vUErPwINmrK4BywKpDbw6Yip6FzxdlWESHI="
|
||||
|
||||
matrix:
|
||||
- MONGODB_IMAGE=mongo:3.0
|
||||
- MONGODB_IMAGE=mongo:3.2
|
||||
@@ -58,8 +61,14 @@ before_install:
|
||||
|
||||
install:
|
||||
- go get -u github.com/golang/dep/cmd/dep
|
||||
# install reviewdog and golangci-lin
|
||||
- curl https://raw.githubusercontent.com/reviewdog/reviewdog/master/install.sh| sh -s
|
||||
- curl https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s latest
|
||||
|
||||
before_script:
|
||||
# static analyze
|
||||
- bin/golangci-lint run -c=.golangci-required.yml --out-format=line-number | bin/reviewdog -f=golangci-lint -level=error -reporter=github-pr-check
|
||||
- bin/golangci-lint run -c=.golangci.yml --out-format=line-number | bin/reviewdog -f=golangci-lint -level=error -reporter=github-pr-review
|
||||
# log versions
|
||||
- docker --version
|
||||
- docker-compose --version
|
||||
@@ -69,7 +78,7 @@ before_script:
|
||||
- dep ensure
|
||||
|
||||
script:
|
||||
- docker ps
|
||||
- docker ps
|
||||
- go test -timeout 20m ./src/go/...
|
||||
|
||||
allow_failures:
|
||||
|
13
Changelog
13
Changelog
@@ -1,7 +1,18 @@
|
||||
Changelog for Percona Toolkit
|
||||
|
||||
* Fixed bug PT-1759: pt-stalk not collecting processlist and variables
|
||||
* Fixed bug PT-1824: Name of a constraint can exceed 64 chars (Thanks Iwo Panowicz)
|
||||
* Fixed bug PT-1793: Protocol parser cannot handle year 2020 (Thanks Kei Tsuchiya)
|
||||
* Fixed bug PT-1782: pt-online-schema-change: FK keys warning, but there are no foreign keys
|
||||
* Fixed bug PT-1773: pt-online-schema-change: Restrict the FK check if needed
|
||||
* Fixed bug PT-1766: pt-table-checksum: DIFF_ROWS is not computed correctly
|
||||
* Improvement PT-1765: Documentation for pt-table-checksum's DIFF_ROWS
|
||||
* Fixed bug PT-1760: pt-online-schema-change: regression on slave with replication channels
|
||||
* Fixed bug PT-1759: pt-stalk not collecting processlist and variables
|
||||
* Improvement PT-1757: pt-table-checksum: Improvement on handling Small Tables
|
||||
* Improvement PT-1707: IPv6 support
|
||||
* Fixed bug PT-1576: pt-stalk mysql-only not working as expected
|
||||
* Fixed bug PT-1502: pt-online-schema-change not working with multi-source replication
|
||||
* Fixed bug PT-297 : pt-online-schema-change can break replication
|
||||
|
||||
v3.1.0 release 2019-09-12
|
||||
|
||||
|
6
Gopkg.lock
generated
6
Gopkg.lock
generated
@@ -188,12 +188,12 @@
|
||||
revision = "197f4ad8db8d1b04ff408042119176907c971f0a"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:1d7e1867c49a6dd9856598ef7c3123604ea3daabf5b83f303ff457bcbc410b1d"
|
||||
digest = "1:c45802472e0c06928cd997661f2af610accd85217023b1d5f6331bebce0671d3"
|
||||
name = "github.com/pkg/errors"
|
||||
packages = ["."]
|
||||
pruneopts = ""
|
||||
revision = "ba968bfe8b2f7e042a574c888954fccecfa385b4"
|
||||
version = "v0.8.1"
|
||||
revision = "614d223910a179a466c1767a985424175c39b465"
|
||||
version = "v0.9.1"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:55dcddb2ba6ab25098ee6b96f176f39305f1fde7ea3d138e7e10bb64a5bf45be"
|
||||
|
@@ -2,7 +2,7 @@ use ExtUtils::MakeMaker;
|
||||
|
||||
WriteMakefile(
|
||||
NAME => 'percona-toolkit',
|
||||
VERSION => '3.1.0',
|
||||
VERSION => '3.2.0',
|
||||
EXE_FILES => [ <bin/*> ],
|
||||
MAN1PODS => {
|
||||
'docs/percona-toolkit.pod' => 'blib/man1/percona-toolkit.1p',
|
||||
|
@@ -1359,6 +1359,6 @@ Place, Suite 330, Boston, MA 02111-1307 USA.
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
pt-align 3.1.0
|
||||
pt-align 3.2.0
|
||||
|
||||
=cut
|
||||
|
@@ -45,7 +45,7 @@ BEGIN {
|
||||
{
|
||||
package Percona::Toolkit;
|
||||
|
||||
our $VERSION = '3.0.14-dev';
|
||||
our $VERSION = '3.2.0';
|
||||
|
||||
use strict;
|
||||
use warnings FATAL => 'all';
|
||||
@@ -7696,8 +7696,8 @@ Example:
|
||||
|
||||
The file's contents are in the same format used by SELECT INTO OUTFILE, as
|
||||
documented in the MySQL manual: rows terminated by newlines, columns
|
||||
terminated by tabs, NULL characters are represented by \N, and special
|
||||
characters are escaped by \. This lets you reload a file with LOAD DATA
|
||||
terminated by tabs, NULL characters are represented by C<\N>, and special
|
||||
characters are escaped by C<\>. This lets you reload a file with LOAD DATA
|
||||
INFILE's default settings.
|
||||
|
||||
If you want a column header at the top of the file, see L<"--header">. The file
|
||||
@@ -7856,8 +7856,10 @@ type: string
|
||||
Used with L<"--file"> to specify the output format.
|
||||
|
||||
Valid formats are:
|
||||
dump: MySQL dump format using tabs as field separator (default)
|
||||
csv : Dump rows using ',' as separator and optionally enclosing fields by '"'.
|
||||
|
||||
- dump: MySQL dump format using tabs as field separator (default)
|
||||
|
||||
- csv : Dump rows using ',' as separator and optionally enclosing fields by '"'.
|
||||
This format is equivalent to FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'.
|
||||
|
||||
=item --password
|
||||
@@ -7887,10 +7889,10 @@ Specify the Perl module name of a general-purpose plugin. It is currently used
|
||||
only for statistics (see L<"--statistics">) and must have C<new()> and a
|
||||
C<statistics()> method.
|
||||
|
||||
The C<new( src => $src, dst => $dst, opts => $o )> method gets the source
|
||||
The C<new( src =E<gt> $src, dst =E<gt> $dst, opts =E<gt> $o )> method gets the source
|
||||
and destination DSNs, and their database connections, just like the
|
||||
connection-specific plugins do. It also gets an OptionParser object (C<$o>) for
|
||||
accessing command-line options (example: C<$o->get('purge');>).
|
||||
accessing command-line options (example: C<$o-E<gt>get('purge');>).
|
||||
|
||||
The C<statistics(\%stats, $time)> method gets a hashref of the statistics
|
||||
collected by the archiving job, and the time the whole job started.
|
||||
@@ -8230,7 +8232,7 @@ Percona Toolkit. Second, it checks for and warns about versions with known
|
||||
problems. For example, MySQL 5.5.25 had a critical bug and was re-released
|
||||
as 5.5.25a.
|
||||
|
||||
A secure connection to Percona’s Version Check database server is done to
|
||||
A secure connection to Percona's Version Check database server is done to
|
||||
perform these checks. Each request is logged by the server, including software
|
||||
version numbers and unique ID of the checked system. The ID is generated by the
|
||||
Percona Toolkit installation script or when the Version Check database call is
|
||||
@@ -8652,6 +8654,6 @@ Place, Suite 330, Boston, MA 02111-1307 USA.
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
pt-archiver 3.1.0
|
||||
pt-archiver 3.2.0
|
||||
|
||||
=cut
|
||||
|
@@ -43,7 +43,7 @@ BEGIN {
|
||||
{
|
||||
package Percona::Toolkit;
|
||||
|
||||
our $VERSION = '3.0.14-dev';
|
||||
our $VERSION = '3.2.0';
|
||||
|
||||
use strict;
|
||||
use warnings FATAL => 'all';
|
||||
@@ -5747,7 +5747,7 @@ Percona Toolkit. Second, it checks for and warns about versions with known
|
||||
problems. For example, MySQL 5.5.25 had a critical bug and was re-released
|
||||
as 5.5.25a.
|
||||
|
||||
A secure connection to Percona’s Version Check database server is done to
|
||||
A secure connection to Percona's Version Check database server is done to
|
||||
perform these checks. Each request is logged by the server, including software
|
||||
version numbers and unique ID of the checked system. The ID is generated by the
|
||||
Percona Toolkit installation script or when the Version Check database call is
|
||||
@@ -5912,6 +5912,6 @@ Place, Suite 330, Boston, MA 02111-1307 USA.
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
pt-config-diff 3.1.0
|
||||
pt-config-diff 3.2.0
|
||||
|
||||
=cut
|
||||
|
@@ -42,7 +42,7 @@ BEGIN {
|
||||
{
|
||||
package Percona::Toolkit;
|
||||
|
||||
our $VERSION = '3.0.14-dev';
|
||||
our $VERSION = '3.2.0';
|
||||
|
||||
use strict;
|
||||
use warnings FATAL => 'all';
|
||||
@@ -5532,7 +5532,7 @@ Percona Toolkit. Second, it checks for and warns about versions with known
|
||||
problems. For example, MySQL 5.5.25 had a critical bug and was re-released
|
||||
as 5.5.25a.
|
||||
|
||||
A secure connection to Percona’s Version Check database server is done to
|
||||
A secure connection to Percona's Version Check database server is done to
|
||||
perform these checks. Each request is logged by the server, including software
|
||||
version numbers and unique ID of the checked system. The ID is generated by the
|
||||
Percona Toolkit installation script or when the Version Check database call is
|
||||
@@ -5702,6 +5702,6 @@ Place, Suite 330, Boston, MA 02111-1307 USA.
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
pt-deadlock-logger 3.1.0
|
||||
pt-deadlock-logger 3.2.0
|
||||
|
||||
=cut
|
||||
|
@@ -38,7 +38,7 @@ BEGIN {
|
||||
{
|
||||
package Percona::Toolkit;
|
||||
|
||||
our $VERSION = '3.0.14-dev';
|
||||
our $VERSION = '3.2.0';
|
||||
|
||||
use strict;
|
||||
use warnings FATAL => 'all';
|
||||
@@ -5677,6 +5677,6 @@ Place, Suite 330, Boston, MA 02111-1307 USA.
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
pt-diskstats 3.1.0
|
||||
pt-diskstats 3.2.0
|
||||
|
||||
=cut
|
||||
|
@@ -39,7 +39,7 @@ BEGIN {
|
||||
{
|
||||
package Percona::Toolkit;
|
||||
|
||||
our $VERSION = '3.0.14-dev';
|
||||
our $VERSION = '3.2.0';
|
||||
|
||||
use strict;
|
||||
use warnings FATAL => 'all';
|
||||
@@ -5765,6 +5765,6 @@ Place, Suite 330, Boston, MA 02111-1307 USA.
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
pt-duplicate-key-checker 3.1.0
|
||||
pt-duplicate-key-checker 3.2.0
|
||||
|
||||
=cut
|
||||
|
@@ -1648,6 +1648,6 @@ Place, Suite 330, Boston, MA 02111-1307 USA.
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
pt-fifo-split 3.1.0
|
||||
pt-fifo-split 3.2.0
|
||||
|
||||
=cut
|
||||
|
@@ -35,7 +35,7 @@ BEGIN {
|
||||
{
|
||||
package Percona::Toolkit;
|
||||
|
||||
our $VERSION = '3.0.14-dev';
|
||||
our $VERSION = '3.2.0';
|
||||
|
||||
use strict;
|
||||
use warnings FATAL => 'all';
|
||||
@@ -5126,6 +5126,6 @@ Place, Suite 330, Boston, MA 02111-1307 USA.
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
pt-find 3.1.0
|
||||
pt-find 3.2.0
|
||||
|
||||
=cut
|
||||
|
@@ -2239,6 +2239,6 @@ Place, Suite 330, Boston, MA 02111-1307 USA.
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
pt-fingerprint 3.1.0
|
||||
pt-fingerprint 3.2.0
|
||||
|
||||
=cut
|
||||
|
@@ -37,7 +37,7 @@ BEGIN {
|
||||
{
|
||||
package Percona::Toolkit;
|
||||
|
||||
our $VERSION = '3.0.14-dev';
|
||||
our $VERSION = '3.2.0';
|
||||
|
||||
use strict;
|
||||
use warnings FATAL => 'all';
|
||||
@@ -4688,6 +4688,6 @@ Place, Suite 330, Boston, MA 02111-1307 USA.
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
pt-fk-error-logger 3.1.0
|
||||
pt-fk-error-logger 3.2.0
|
||||
|
||||
=cut
|
||||
|
@@ -44,7 +44,7 @@ BEGIN {
|
||||
{
|
||||
package Percona::Toolkit;
|
||||
|
||||
our $VERSION = '3.0.14-dev';
|
||||
our $VERSION = '3.2.0';
|
||||
|
||||
use strict;
|
||||
use warnings FATAL => 'all';
|
||||
@@ -6386,19 +6386,6 @@ sub main {
|
||||
sleep $next_interval - $time;
|
||||
PTDEBUG && _d('Woke up at', ts(time));
|
||||
|
||||
if ( $o->get('check-read-only') && $o->get('update') ) {
|
||||
my $read_only_interval = $o->get('read-only-interval') || $interval;
|
||||
while (server_is_readonly($dbh)) {
|
||||
PTDEBUG && _d("Server is read only. Sleeping for $read_only_interval seconds...");
|
||||
sleep($read_only_interval);
|
||||
if (
|
||||
-f $sentinel
|
||||
) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Connect or reconnect if necessary.
|
||||
if ( !$dbh->ping() ) {
|
||||
$dbh = $dp->get_dbh($dp->get_cxn_params($dsn), { AutoCommit => 1 });
|
||||
@@ -6409,6 +6396,17 @@ sub main {
|
||||
$heartbeat_sth = undef;
|
||||
}
|
||||
|
||||
if ( $o->get('check-read-only') && $o->get('update') ) {
|
||||
my $read_only_interval = $o->get('read-only-interval') || $interval;
|
||||
while (server_is_readonly($dbh)) {
|
||||
PTDEBUG && _d("Server is read only. Sleeping for $read_only_interval seconds...");
|
||||
sleep($read_only_interval);
|
||||
if (-f $sentinel) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( $o->get('monitor') ) {
|
||||
$heartbeat_sth ||= $dbh->prepare($heartbeat_sql);
|
||||
my ($delay) = $get_delay->($heartbeat_sth);
|
||||
@@ -7386,6 +7384,6 @@ Place, Suite 330, Boston, MA 02111-1307 USA.
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
pt-heartbeat 3.1.0
|
||||
pt-heartbeat 3.2.0
|
||||
|
||||
=cut
|
||||
|
@@ -45,7 +45,7 @@ BEGIN {
|
||||
{
|
||||
package Percona::Toolkit;
|
||||
|
||||
our $VERSION = '3.0.14-dev';
|
||||
our $VERSION = '3.2.0';
|
||||
|
||||
use strict;
|
||||
use warnings FATAL => 'all';
|
||||
@@ -7695,6 +7695,6 @@ Place, Suite 330, Boston, MA 02111-1307 USA.
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
pt-index-usage 3.1.0
|
||||
pt-index-usage 3.2.0
|
||||
|
||||
=cut
|
||||
|
@@ -1127,7 +1127,7 @@ Place, Suite 330, Boston, MA 02111-1307 USA.
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
pt-ioprofile 3.1.0
|
||||
pt-ioprofile 3.2.0
|
||||
|
||||
=cut
|
||||
|
||||
|
@@ -47,7 +47,7 @@ BEGIN {
|
||||
{
|
||||
package Percona::Toolkit;
|
||||
|
||||
our $VERSION = '3.0.14-dev';
|
||||
our $VERSION = '3.2.0';
|
||||
|
||||
use strict;
|
||||
use warnings FATAL => 'all';
|
||||
@@ -8323,9 +8323,9 @@ Print information to STDOUT about what is being done.
|
||||
|
||||
These actions are taken for every matching query from all classes.
|
||||
The actions are taken in this order: L<"--print">, L<"--execute-command">,
|
||||
L<"--kill">/L<"--kill-query">. This order allows L<"--execute-command">
|
||||
L<"--kill"> / L<"--kill-query">. This order allows L<"--execute-command">
|
||||
to see the output of L<"--print"> and the query before
|
||||
L<"--kill">/L<"--kill-query">. This may be helpful because pt-kill does
|
||||
L<"--kill"> / L<"--kill-query">. This may be helpful because pt-kill does
|
||||
not pass any information to L<"--execute-command">.
|
||||
|
||||
See also L<"GROUP, MATCH AND KILL">.
|
||||
@@ -8554,6 +8554,6 @@ Place, Suite 330, Boston, MA 02111-1307 USA.
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
pt-kill 3.1.0
|
||||
pt-kill 3.2.0
|
||||
|
||||
=cut
|
||||
|
@@ -804,7 +804,7 @@ Place, Suite 330, Boston, MA 02111-1307 USA.
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
pt-mext 3.1.0
|
||||
pt-mext 3.2.0
|
||||
|
||||
=cut
|
||||
|
||||
|
@@ -3289,7 +3289,7 @@ Place, Suite 330, Boston, MA 02111-1307 USA.
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
pt-mysql-summary 3.1.0
|
||||
pt-mysql-summary 3.2.0
|
||||
|
||||
=cut
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -896,7 +896,7 @@ Place, Suite 330, Boston, MA 02111-1307 USA.
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
pt-pmp 3.1.0
|
||||
pt-pmp 3.2.0
|
||||
|
||||
=cut
|
||||
|
||||
|
@@ -64,7 +64,7 @@ BEGIN {
|
||||
{
|
||||
package Percona::Toolkit;
|
||||
|
||||
our $VERSION = '3.0.14-dev';
|
||||
our $VERSION = '3.2.0';
|
||||
|
||||
use strict;
|
||||
use warnings FATAL => 'all';
|
||||
@@ -16957,6 +16957,6 @@ Place, Suite 330, Boston, MA 02111-1307 USA.
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
pt-query-digest 3.1.0
|
||||
pt-query-digest 3.2.0
|
||||
|
||||
=cut
|
||||
|
@@ -2613,6 +2613,6 @@ Place, Suite 330, Boston, MA 02111-1307 USA.
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
pt-show-grants 3.1.0
|
||||
pt-show-grants 3.2.0
|
||||
|
||||
=cut
|
||||
|
@@ -1245,7 +1245,7 @@ Place, Suite 330, Boston, MA 02111-1307 USA.
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
pt-sift 3.1.0
|
||||
pt-sift 3.2.0
|
||||
|
||||
=cut
|
||||
|
||||
|
@@ -40,7 +40,7 @@ BEGIN {
|
||||
{
|
||||
package Percona::Toolkit;
|
||||
|
||||
our $VERSION = '3.0.14-dev';
|
||||
our $VERSION = '3.2.0';
|
||||
|
||||
use strict;
|
||||
use warnings FATAL => 'all';
|
||||
@@ -4602,7 +4602,7 @@ server. Before using this tool, please:
|
||||
C<pt-slave-delay> watches a slave and starts and stops its replication SQL
|
||||
thread as necessary to hold it at least as far behind the master as you
|
||||
request. In practice, it will typically cause the slave to lag between
|
||||
L<"--delay"> and L<"--delay">+L<"--interval"> behind the master.
|
||||
L<"--delay"> and L<"--delay"> + L<"--interval"> behind the master.
|
||||
|
||||
It bases the delay on binlog positions in the slave's relay logs by default,
|
||||
so there is no need to connect to the master. This works well if the IO
|
||||
@@ -4988,6 +4988,6 @@ Place, Suite 330, Boston, MA 02111-1307 USA.
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
pt-slave-delay 3.1.0
|
||||
pt-slave-delay 3.2.0
|
||||
|
||||
=cut
|
||||
|
@@ -4523,6 +4523,6 @@ Place, Suite 330, Boston, MA 02111-1307 USA.
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
pt-slave-find 3.1.0
|
||||
pt-slave-find 3.2.0
|
||||
|
||||
=cut
|
||||
|
@@ -41,7 +41,7 @@ BEGIN {
|
||||
{
|
||||
package Percona::Toolkit;
|
||||
|
||||
our $VERSION = '3.0.14-dev';
|
||||
our $VERSION = '3.2.0';
|
||||
|
||||
use strict;
|
||||
use warnings FATAL => 'all';
|
||||
@@ -6159,6 +6159,6 @@ Place, Suite 330, Boston, MA 02111-1307 USA.
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
pt-slave-restart 3.1.0
|
||||
pt-slave-restart 3.2.0
|
||||
|
||||
=cut
|
||||
|
@@ -1993,7 +1993,7 @@ then compared to L<"--threshold"> as usual. The C<$EXT_ARGV> variable
|
||||
contains the MySQL options mentioned in the L<"SYNOPSIS"> above.
|
||||
|
||||
The file should not alter the tool's existing global variables. Prefix any
|
||||
file-specific global variables with "PLUGIN_" or make them local.
|
||||
file-specific global variables with C<PLUGIN_> or make them local.
|
||||
|
||||
=item --help
|
||||
|
||||
@@ -2419,7 +2419,7 @@ Place, Suite 330, Boston, MA 02111-1307 USA.
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
pt-stalk 3.1.0
|
||||
pt-stalk 3.2.0
|
||||
|
||||
=cut
|
||||
|
||||
|
@@ -2723,7 +2723,7 @@ Place, Suite 330, Boston, MA 02111-1307 USA.
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
pt-summary 3.1.0
|
||||
pt-summary 3.2.0
|
||||
|
||||
=cut
|
||||
|
||||
|
@@ -58,7 +58,7 @@ BEGIN {
|
||||
{
|
||||
package Percona::Toolkit;
|
||||
|
||||
our $VERSION = '3.0.14-dev';
|
||||
our $VERSION = '3.2.0';
|
||||
|
||||
use strict;
|
||||
use warnings FATAL => 'all';
|
||||
@@ -13324,7 +13324,8 @@ first option on the command line.
|
||||
|
||||
See the L<"--help"> output for a list of default config files.
|
||||
|
||||
=item --[no]create-replicate-table
|
||||
=item --create-replicate-table
|
||||
=item --no-create-replicate-table
|
||||
|
||||
default: yes
|
||||
|
||||
@@ -13687,7 +13688,7 @@ structure (MAGIC_create_replicate):
|
||||
|
||||
Note: lower_boundary and upper_boundary data type can be BLOB. See L<"--binary-index">.
|
||||
|
||||
By default, L<"--[no]create-replicate-table"> is true, so the database and
|
||||
By default, L<"--create-replicate-table"> is true, so the database and
|
||||
the table specified by this option are created automatically if they do not
|
||||
exist.
|
||||
|
||||
@@ -14178,6 +14179,6 @@ Place, Suite 330, Boston, MA 02111-1307 USA.
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
pt-table-checksum 3.1.0
|
||||
pt-table-checksum 3.2.0
|
||||
|
||||
=cut
|
||||
|
@@ -55,7 +55,7 @@ BEGIN {
|
||||
{
|
||||
package Percona::Toolkit;
|
||||
|
||||
our $VERSION = '3.0.14-dev';
|
||||
our $VERSION = '3.2.0';
|
||||
|
||||
use strict;
|
||||
use warnings FATAL => 'all';
|
||||
@@ -13080,6 +13080,6 @@ Place, Suite 330, Boston, MA 02111-1307 USA.
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
pt-table-sync 3.1.0
|
||||
pt-table-sync 3.2.0
|
||||
|
||||
=cut
|
||||
|
@@ -8509,6 +8509,6 @@ Place, Suite 330, Boston, MA 02111-1307 USA.
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
pt-table-usage 3.1.0
|
||||
pt-table-usage 3.2.0
|
||||
|
||||
=cut
|
||||
|
@@ -61,7 +61,7 @@ BEGIN {
|
||||
{
|
||||
package Percona::Toolkit;
|
||||
|
||||
our $VERSION = '3.0.14-dev';
|
||||
our $VERSION = '3.2.0';
|
||||
|
||||
use strict;
|
||||
use warnings FATAL => 'all';
|
||||
@@ -11444,6 +11444,6 @@ Place, Suite 330, Boston, MA 02111-1307 USA.
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
pt-upgrade 3.1.0
|
||||
pt-upgrade 3.2.0
|
||||
|
||||
=cut
|
||||
|
@@ -44,7 +44,7 @@ BEGIN {
|
||||
{
|
||||
package Percona::Toolkit;
|
||||
|
||||
our $VERSION = '3.0.14-dev';
|
||||
our $VERSION = '3.2.0';
|
||||
|
||||
use strict;
|
||||
use warnings FATAL => 'all';
|
||||
@@ -6257,6 +6257,6 @@ Place, Suite 330, Boston, MA 02111-1307 USA.
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
pt-variable-advisor 3.1.0
|
||||
pt-variable-advisor 3.2.0
|
||||
|
||||
=cut
|
||||
|
@@ -3303,6 +3303,6 @@ Place, Suite 330, Boston, MA 02111-1307 USA.
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
pt-visual-explain 3.1.0
|
||||
pt-visual-explain 3.2.0
|
||||
|
||||
=cut
|
||||
|
@@ -41,16 +41,16 @@ master_doc = 'index'
|
||||
|
||||
# General information about the project.
|
||||
project = u'Percona Toolkit'
|
||||
copyright = u'2017, Percona LLC and/or its affiliates'
|
||||
copyright = u'2020, Percona LLC and/or its affiliates'
|
||||
|
||||
# The version info for the project you're documenting, acts as replacement for
|
||||
# |version| and |release|, also used in various other places throughout the
|
||||
# built documents.
|
||||
#
|
||||
# The short X.Y version.
|
||||
version = '3.1'
|
||||
version = '3.2'
|
||||
# The full version, including alpha/beta/rc tags.
|
||||
release = '3.1.0'
|
||||
release = '3.2.0'
|
||||
|
||||
# The language for content autogenerated by Sphinx. Refer to documentation
|
||||
# for a list of supported languages.
|
||||
@@ -180,7 +180,7 @@ htmlhelp_basename = 'PerconaToolkitdoc'
|
||||
# (source start file, target name, title, author, documentclass [howto/manual]).
|
||||
latex_documents = [
|
||||
('index', 'PerconaToolkit.tex', u'Percona Toolkit Documentation',
|
||||
u'2017, Percona LLC and/or its affiliates', 'manual'),
|
||||
u'2020, Percona LLC and/or its affiliates', 'manual'),
|
||||
]
|
||||
|
||||
# The name of an image file (relative to this directory) to place at the top of
|
||||
@@ -214,5 +214,5 @@ latex_toplevel_sectioning = 'part'
|
||||
# (source start file, name, description, authors, manual section).
|
||||
man_pages = [
|
||||
('index', 'perconatoolkit', u'Percona Toolkit Documentation',
|
||||
[u'2017, Percona LLC and/or its affiliates'], 1)
|
||||
[u'2020, Percona LLC and/or its affiliates'], 1)
|
||||
]
|
||||
|
@@ -4,7 +4,7 @@
|
||||
===============================
|
||||
|
||||
Percona Toolkit is a collection of advanced command-line tools
|
||||
used by `Percona <http://www.percona.com/>`_) support staff
|
||||
used by `Percona <http://www.percona.com/>`_ support staff
|
||||
to perform a variety of MySQL, MongoDB, and system tasks
|
||||
that are too difficult or complex to perform manually.
|
||||
|
||||
@@ -59,6 +59,8 @@ Miscellaneous
|
||||
:maxdepth: 2
|
||||
|
||||
bugs
|
||||
ipv6_support
|
||||
special_option_types
|
||||
authors
|
||||
copyright_license_and_warranty
|
||||
version
|
||||
|
@@ -39,7 +39,7 @@ It is recommended to install Percona software from official repositories:
|
||||
|
||||
During the installating process, the percona-toolkit installer records a unique
|
||||
identifier specific to the given percona-toolkit instance. This ID is a the
|
||||
product UUID stored in |product-uud|. The installer copies the product_uuid to
|
||||
product UUID stored in |product-uuid|. The installer copies the product_uuid to
|
||||
|toolkit-uuid|.
|
||||
|
||||
This unique identifier is used when collecting statistics about the usage of
|
||||
|
@@ -548,7 +548,7 @@ Many people have contributed code over the years. See each tool's
|
||||
|
||||
=head1 COPYRIGHT, LICENSE, AND WARRANTY
|
||||
|
||||
Percona Toolkit is copyright 2011-2018 Percona LLC and/or its affiliates, et al.
|
||||
Percona Toolkit is copyright 2011-2020 Percona LLC and/or its affiliates, et al.
|
||||
See each program's documentation for complete copyright notices.
|
||||
|
||||
THIS PROGRAM IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
|
||||
@@ -567,6 +567,6 @@ Place, Suite 330, Boston, MA 02111-1307 USA.
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
Percona Toolkit v3.1.0 released 2019-09-07
|
||||
Percona Toolkit v3.2.0 released 2020-04-23
|
||||
|
||||
=cut
|
||||
|
473
docs/pt-pg-summary.rst
Normal file
473
docs/pt-pg-summary.rst
Normal file
@@ -0,0 +1,473 @@
|
||||
pt-pg-summary
|
||||
=============
|
||||
**pt-pg-summary** collects information about a PostgreSQL cluster.
|
||||
|
||||
Usage
|
||||
-----
|
||||
|
||||
``pt-pg-summary [options] [host:[port]]``
|
||||
|
||||
Binaries
|
||||
--------
|
||||
Please check the `releases <https://github.com/percona/toolkit-go/releases>`_ tab to download the binaries.
|
||||
|
||||
Parameters
|
||||
^^^^^^^^^^
|
||||
|
||||
+--------+---------------------------------+---------+----------------------------------------------------------------------------+
|
||||
| Short | Long | Default | Description |
|
||||
+========+=================================+=========+============================================================================+
|
||||
| | ``--help`` | | Show context-sensitive help (also try ``--help-long`` and ``--help-man``). |
|
||||
+--------+---------------------------------+---------+----------------------------------------------------------------------------+
|
||||
| | ``--version`` | | Show application version. |
|
||||
+--------+---------------------------------+---------+----------------------------------------------------------------------------+
|
||||
| | ``--databases=DATABASES`` | | Summarize this comma-separated list of databases. All if not specified. |
|
||||
+--------+---------------------------------+---------+----------------------------------------------------------------------------+
|
||||
| ``-h`` | ``--host=HOST`` | | Host to connect to. |
|
||||
+--------+---------------------------------+---------+----------------------------------------------------------------------------+
|
||||
| ``-W`` | ``--password=PASSWORD`` | | Password to use when connecting. |
|
||||
+--------+---------------------------------+---------+----------------------------------------------------------------------------+
|
||||
| ``-p`` | ``--port=PORT`` | | Port number to use for connection. |
|
||||
+--------+---------------------------------+---------+----------------------------------------------------------------------------+
|
||||
| | ``--sleep=SLEEP`` | 10 | Seconds to sleep when gathering status counters. |
|
||||
+--------+---------------------------------+---------+----------------------------------------------------------------------------+
|
||||
| ``-U`` | ``--username=USERNAME`` | | User for login if not current user. |
|
||||
+--------+---------------------------------+---------+----------------------------------------------------------------------------+
|
||||
| | ``--disable-ssl`` | true | Disable SSL for the connection. |
|
||||
+--------+---------------------------------+---------+----------------------------------------------------------------------------+
|
||||
| | ``--verbose`` | false | Show verbose log. |
|
||||
+--------+---------------------------------+---------+----------------------------------------------------------------------------+
|
||||
| | ``--debug`` | false | Show debug information in the logs. |
|
||||
+--------+---------------------------------+---------+----------------------------------------------------------------------------+
|
||||
|
||||
|
||||
.. Currently hidden
|
||||
.. --list-encrypted-tables Include a list of the encrypted tables in all databases
|
||||
.. --ask-pass Prompt for a password when connecting to PostgreSQL
|
||||
.. --config Config file
|
||||
.. --defaults-file Only read PostgreSQL options from the given file
|
||||
.. --read-samples Create a report from the files found in this directory
|
||||
.. --save-samples Save the data files used to generate the summary in this directory
|
||||
|
||||
|
||||
Output
|
||||
^^^^^^
|
||||
|
||||
The output is grouped into these categories:
|
||||
|
||||
AllDatabases
|
||||
Selects ``datname`` from ``pg_database`` where ``datistemplate`` is false.
|
||||
|
||||
ClusterInfo
|
||||
Selects cluster information from ``pg_stat_activity``.
|
||||
|
||||
ConnectedClients
|
||||
Counts the connected clients by selecting from ``pg_stat_activity``.
|
||||
|
||||
Connections
|
||||
Selects ``state`` from ``pg_stat_activity`` and counts them.
|
||||
|
||||
Counters
|
||||
Selects various counter values from ``pg_stat_database``.
|
||||
|
||||
DatabaseWaitEvents
|
||||
Shows database wait events from ``pg_locks``, ``pg_stat_database``, ``pg_class``, and ``pg_stat_activity``.
|
||||
|
||||
Databases
|
||||
Shows the name and size of databases from ``pg_stat_database``.
|
||||
|
||||
GlobalWaitEvents
|
||||
Shows global wait evens from ``pg_stat_activity``.
|
||||
|
||||
IndexCacheHitRatio
|
||||
Shows index hit ratios from ``pg_statio_user_indexes``.
|
||||
|
||||
PortAndDatadir
|
||||
Shows port and data directory name from ``pg_settings``.
|
||||
|
||||
ServerVersion
|
||||
Shows the value of ``server_version_num``.
|
||||
|
||||
Setting
|
||||
Selects ``name`` and ``setting`` from ``pg_settings``.
|
||||
|
||||
SlaveHosts10
|
||||
Selects information for PostgreSQL version 10.
|
||||
|
||||
SlaveHosts96
|
||||
Selects information for PostgreSQL version 9.6.
|
||||
|
||||
TableAccess
|
||||
Shows table access information by selecting from ``pg_locks``, ``pg_stat_database`` and ``pg_class``.
|
||||
|
||||
TableCacheHitRatio
|
||||
Shows table cache hit ratio information from ``pg_statio_user_tables``.
|
||||
|
||||
Tablespaces
|
||||
Show owner and location from ``pg_catalog.pg_tablespace``.
|
||||
|
||||
|
||||
Output example
|
||||
""""""""""""""
|
||||
|
||||
.. code-block:: html
|
||||
|
||||
##### --- Database Port and Data_Directory --- ####
|
||||
+----------------------+----------------------------------------------------+
|
||||
| Name | Setting |
|
||||
+----------------------+----------------------------------------------------+
|
||||
| data_directory | /var/lib/postgresql/data |
|
||||
+----------------------+----------------------------------------------------+
|
||||
|
||||
##### --- List of Tablespaces ---- ######
|
||||
+----------------------+----------------------+----------------------------------------------------+
|
||||
| Name | Owner | Location |
|
||||
+----------------------+----------------------+----------------------------------------------------+
|
||||
| pg_default | postgres | |
|
||||
| pg_global | postgres | |
|
||||
+----------------------+----------------------+----------------------------------------------------+
|
||||
|
||||
|
||||
##### --- Cluster Information --- ####
|
||||
+------------------------------------------------------------------------------------------------------+
|
||||
Usename : postgres
|
||||
Time : 2020-04-21 13:38:22.770077 +0000 UTC
|
||||
Client Address : 172.19.0.1
|
||||
Client Hostname:
|
||||
Version : PostgreSQL 9.6.17 on x86_64-pc-linux-gnu (Debian 9.6.17-2.pgdg90+1), compiled by
|
||||
Started : 2020-04-21 13:36:59.909175 +0000 UTC
|
||||
Is Slave : false
|
||||
+------------------------------------------------------------------------------------------------------+
|
||||
|
||||
##### --- Databases --- ####
|
||||
+----------------------+------------+
|
||||
| Dat Name | Size |
|
||||
+----------------------+------------+
|
||||
| postgres | 7071 kB |
|
||||
| template1 | 6961 kB |
|
||||
| template0 | 6961 kB |
|
||||
+----------------------+------------+
|
||||
|
||||
##### --- Index Cache Hit Ratios --- ####
|
||||
|
||||
Database: postgres
|
||||
+----------------------+------------+
|
||||
| Index Name | Ratio |
|
||||
+----------------------+------------+
|
||||
| index hit rate | 0.00 |
|
||||
+----------------------+------------+
|
||||
|
||||
##### --- Table Cache Hit Ratios --- ####
|
||||
Database: postgres
|
||||
+----------------------+------------+
|
||||
| Index Name | Ratio |
|
||||
+----------------------+------------+
|
||||
| cache hit rate | 0.00 |
|
||||
+----------------------+------------+
|
||||
|
||||
##### --- List of Wait_events for the entire Cluster - all-databases --- ####
|
||||
No stats available
|
||||
|
||||
##### --- List of users and client_addr or client_hostname connected to --all-databases --- ####
|
||||
+----------------------+------------+---------+----------------------+---------+
|
||||
| Wait Event Type | Client | State | Count |
|
||||
+----------------------+------------+---------+----------------------+---------+
|
||||
| postgres | 172.19.0.1/32 | active | 1 |
|
||||
+----------------------+------------+---------+----------------------+---------+
|
||||
|
||||
##### --- Counters diff after 10 seconds --- ####
|
||||
|
||||
+----------------------+-------------+------------+--------------+-------------+------------+-------------+------------+-------------+------------+------------+-----------+-----------+-----------+------------+
|
||||
| Database | Numbackends | XactCommit | XactRollback | BlksRead | BlksHit | TupReturned | TupFetched | TupInserted | TupUpdated | TupDeleted | Conflicts | TempFiles | TempBytes | Deadlocks |
|
||||
+----------------------+-------------+------------+--------------+-------------+------------+-------------+------------+-------------+------------+------------+-----------+-----------+-----------+------------+
|
||||
| postgres | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
|
||||
| template0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
|
||||
| template1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
|
||||
+----------------------+-------------+------------+--------------+-------------+------------+-------------+------------+-------------+------------+------------+-----------+-----------+-----------+------------+
|
||||
|
||||
##### --- Table access per database --- ####
|
||||
Database: postgres
|
||||
+----------------------------------------------------+------+--------------------------------+---------+
|
||||
| Relname | Kind | Datname | Count |
|
||||
+----------------------------------------------------+------+--------------------------------+---------+
|
||||
| pg_class | r | postgres | 1 |
|
||||
| pg_stat_database | v | postgres | 1 |
|
||||
| pg_locks | v | postgres | 1 |
|
||||
| pg_class_tblspc_relfilenode_index | i | postgres | 1 |
|
||||
| pg_class_relname_nsp_index | i | postgres | 1 |
|
||||
| pg_class_oid_index | i | postgres | 1 |
|
||||
+----------------------------------------------------+------+--------------------------------+---------+
|
||||
|
||||
##### --- Instance settings --- ####
|
||||
Setting Value
|
||||
allow_system_table_mods : off
|
||||
application_name :
|
||||
archive_command : (disabled)
|
||||
archive_mode : off
|
||||
archive_timeout : 0
|
||||
array_nulls : on
|
||||
authentication_timeout : 60
|
||||
autovacuum : on
|
||||
autovacuum_analyze_scale_factor : 0.1
|
||||
autovacuum_analyze_threshold : 50
|
||||
autovacuum_freeze_max_age : 200000000
|
||||
autovacuum_max_workers : 3
|
||||
autovacuum_multixact_freeze_max_age : 400000000
|
||||
autovacuum_naptime : 60
|
||||
autovacuum_vacuum_cost_delay : 20
|
||||
autovacuum_vacuum_cost_limit : -1
|
||||
autovacuum_vacuum_scale_factor : 0.2
|
||||
autovacuum_vacuum_threshold : 50
|
||||
autovacuum_work_mem : -1
|
||||
backend_flush_after : 0
|
||||
backslash_quote : safe_encoding
|
||||
bgwriter_delay : 200
|
||||
bgwriter_flush_after : 64
|
||||
bgwriter_lru_maxpages : 100
|
||||
bgwriter_lru_multiplier : 2
|
||||
block_size : 8192
|
||||
bonjour : off
|
||||
bonjour_name :
|
||||
bytea_output : hex
|
||||
check_function_bodies : on
|
||||
checkpoint_completion_target : 0.5
|
||||
checkpoint_flush_after : 32
|
||||
checkpoint_timeout : 300
|
||||
checkpoint_warning : 30
|
||||
client_encoding : UTF8
|
||||
client_min_messages : notice
|
||||
cluster_name :
|
||||
commit_delay : 0
|
||||
commit_siblings : 5
|
||||
config_file : /var/lib/postgresql/data/postgresql.conf
|
||||
constraint_exclusion : partition
|
||||
cpu_index_tuple_cost : 0.005
|
||||
cpu_operator_cost : 0.0025
|
||||
cpu_tuple_cost : 0.01
|
||||
cursor_tuple_fraction : 0.1
|
||||
data_checksums : off
|
||||
data_directory : /var/lib/postgresql/data
|
||||
data_sync_retry : off
|
||||
DateStyle : ISO, MDY
|
||||
db_user_namespace : off
|
||||
deadlock_timeout : 1000
|
||||
debug_assertions : off
|
||||
debug_pretty_print : on
|
||||
debug_print_parse : off
|
||||
debug_print_plan : off
|
||||
debug_print_rewritten : off
|
||||
default_statistics_target : 100
|
||||
default_tablespace :
|
||||
default_text_search_config : pg_catalog.english
|
||||
default_transaction_deferrable : off
|
||||
default_transaction_isolation : read committed
|
||||
default_transaction_read_only : off
|
||||
default_with_oids : off
|
||||
dynamic_library_path : $libdir
|
||||
dynamic_shared_memory_type : posix
|
||||
effective_cache_size : 524288
|
||||
effective_io_concurrency : 1
|
||||
enable_bitmapscan : on
|
||||
enable_hashagg : on
|
||||
enable_hashjoin : on
|
||||
enable_indexonlyscan : on
|
||||
enable_indexscan : on
|
||||
enable_material : on
|
||||
enable_mergejoin : on
|
||||
enable_nestloop : on
|
||||
enable_seqscan : on
|
||||
enable_sort : on
|
||||
enable_tidscan : on
|
||||
escape_string_warning : on
|
||||
event_source : PostgreSQL
|
||||
exit_on_error : off
|
||||
external_pid_file :
|
||||
extra_float_digits : 2
|
||||
force_parallel_mode : off
|
||||
from_collapse_limit : 8
|
||||
fsync : on
|
||||
full_page_writes : on
|
||||
geqo : on
|
||||
geqo_effort : 5
|
||||
geqo_generations : 0
|
||||
geqo_pool_size : 0
|
||||
geqo_seed : 0
|
||||
geqo_selection_bias : 2
|
||||
geqo_threshold : 12
|
||||
gin_fuzzy_search_limit : 0
|
||||
gin_pending_list_limit : 4096
|
||||
hba_file : /var/lib/postgresql/data/pg_hba.conf
|
||||
hot_standby : off
|
||||
hot_standby_feedback : off
|
||||
huge_pages : try
|
||||
ident_file : /var/lib/postgresql/data/pg_ident.conf
|
||||
idle_in_transaction_session_timeout : 0
|
||||
ignore_checksum_failure : off
|
||||
ignore_system_indexes : off
|
||||
integer_datetimes : on
|
||||
IntervalStyle : postgres
|
||||
join_collapse_limit : 8
|
||||
krb_caseins_users : off
|
||||
krb_server_keyfile : FILE:/etc/postgresql-common/krb5.keytab
|
||||
lc_collate : en_US.utf8
|
||||
lc_ctype : en_US.utf8
|
||||
lc_messages : en_US.utf8
|
||||
lc_monetary : en_US.utf8
|
||||
lc_numeric : en_US.utf8
|
||||
lc_time : en_US.utf8
|
||||
listen_addresses : *
|
||||
lo_compat_privileges : off
|
||||
local_preload_libraries :
|
||||
lock_timeout : 0
|
||||
log_autovacuum_min_duration : -1
|
||||
log_checkpoints : off
|
||||
log_connections : off
|
||||
log_destination : stderr
|
||||
log_directory : pg_log
|
||||
log_disconnections : off
|
||||
log_duration : off
|
||||
log_error_verbosity : default
|
||||
log_executor_stats : off
|
||||
log_file_mode : 0600
|
||||
log_filename : postgresql-%Y-%m-%d_%H%M%S.log
|
||||
log_hostname : off
|
||||
log_line_prefix :
|
||||
log_lock_waits : off
|
||||
log_min_duration_statement : -1
|
||||
log_min_error_statement : error
|
||||
log_min_messages : warning
|
||||
log_parser_stats : off
|
||||
log_planner_stats : off
|
||||
log_replication_commands : off
|
||||
log_rotation_age : 1440
|
||||
log_rotation_size : 10240
|
||||
log_statement : none
|
||||
log_statement_stats : off
|
||||
log_temp_files : -1
|
||||
log_timezone : Etc/UTC
|
||||
log_truncate_on_rotation : off
|
||||
logging_collector : off
|
||||
maintenance_work_mem : 65536
|
||||
max_connections : 100
|
||||
max_files_per_process : 1000
|
||||
max_function_args : 100
|
||||
max_identifier_length : 63
|
||||
max_index_keys : 32
|
||||
max_locks_per_transaction : 64
|
||||
max_parallel_workers_per_gather : 0
|
||||
max_pred_locks_per_transaction : 64
|
||||
max_prepared_transactions : 0
|
||||
max_replication_slots : 0
|
||||
max_stack_depth : 2048
|
||||
max_standby_archive_delay : 30000
|
||||
max_standby_streaming_delay : 30000
|
||||
max_wal_senders : 0
|
||||
max_wal_size : 64
|
||||
max_worker_processes : 8
|
||||
min_parallel_relation_size : 1024
|
||||
min_wal_size : 5
|
||||
old_snapshot_threshold : -1
|
||||
operator_precedence_warning : off
|
||||
parallel_setup_cost : 1000
|
||||
parallel_tuple_cost : 0.1
|
||||
password_encryption : on
|
||||
port : 5432
|
||||
post_auth_delay : 0
|
||||
pre_auth_delay : 0
|
||||
quote_all_identifiers : off
|
||||
random_page_cost : 4
|
||||
replacement_sort_tuples : 150000
|
||||
restart_after_crash : on
|
||||
row_security : on
|
||||
search_path : "$user", public
|
||||
segment_size : 131072
|
||||
seq_page_cost : 1
|
||||
server_encoding : UTF8
|
||||
server_version : 9.6.17
|
||||
server_version_num : 90617
|
||||
session_preload_libraries :
|
||||
session_replication_role : origin
|
||||
shared_buffers : 16384
|
||||
shared_preload_libraries :
|
||||
sql_inheritance : on
|
||||
ssl : off
|
||||
ssl_ca_file :
|
||||
ssl_cert_file : server.crt
|
||||
ssl_ciphers : HIGH:MEDIUM:+3DES:!aNULL
|
||||
ssl_crl_file :
|
||||
ssl_ecdh_curve : prime256v1
|
||||
ssl_key_file : server.key
|
||||
ssl_prefer_server_ciphers : on
|
||||
standard_conforming_strings : on
|
||||
statement_timeout : 0
|
||||
stats_temp_directory : pg_stat_tmp
|
||||
superuser_reserved_connections : 3
|
||||
synchronize_seqscans : on
|
||||
synchronous_commit : on
|
||||
synchronous_standby_names :
|
||||
syslog_facility : local0
|
||||
syslog_ident : postgres
|
||||
syslog_sequence_numbers : on
|
||||
syslog_split_messages : on
|
||||
tcp_keepalives_count : 9
|
||||
tcp_keepalives_idle : 7200
|
||||
tcp_keepalives_interval : 75
|
||||
temp_buffers : 1024
|
||||
temp_file_limit : -1
|
||||
temp_tablespaces :
|
||||
TimeZone : Etc/UTC
|
||||
timezone_abbreviations : Default
|
||||
trace_notify : off
|
||||
trace_recovery_messages : log
|
||||
trace_sort : off
|
||||
track_activities : on
|
||||
track_activity_query_size : 1024
|
||||
track_commit_timestamp : off
|
||||
track_counts : on
|
||||
track_functions : none
|
||||
track_io_timing : off
|
||||
transaction_deferrable : off
|
||||
transaction_isolation : read committed
|
||||
transaction_read_only : off
|
||||
transform_null_equals : off
|
||||
unix_socket_directories : /var/run/postgresql
|
||||
unix_socket_group :
|
||||
unix_socket_permissions : 0777
|
||||
update_process_title : on
|
||||
vacuum_cost_delay : 0
|
||||
vacuum_cost_limit : 200
|
||||
vacuum_cost_page_dirty : 20
|
||||
vacuum_cost_page_hit : 1
|
||||
vacuum_cost_page_miss : 10
|
||||
vacuum_defer_cleanup_age : 0
|
||||
vacuum_freeze_min_age : 50000000
|
||||
vacuum_freeze_table_age : 150000000
|
||||
vacuum_multixact_freeze_min_age : 5000000
|
||||
vacuum_multixact_freeze_table_age : 150000000
|
||||
wal_block_size : 8192
|
||||
wal_buffers : 512
|
||||
wal_compression : off
|
||||
wal_keep_segments : 0
|
||||
wal_level : minimal
|
||||
wal_log_hints : off
|
||||
wal_receiver_status_interval : 10
|
||||
wal_receiver_timeout : 60000
|
||||
wal_retrieve_retry_interval : 5000
|
||||
wal_segment_size : 2048
|
||||
wal_sender_timeout : 60000
|
||||
wal_sync_method : fdatasync
|
||||
wal_writer_delay : 200
|
||||
wal_writer_flush_after : 128
|
||||
work_mem : 4096
|
||||
xmlbinary : base64
|
||||
xmloption : content
|
||||
zero_damaged_pages : off
|
||||
|
||||
##### --- Processes start up command --- ####
|
||||
No postgres process found
|
||||
|
||||
Minimum auth role
|
||||
^^^^^^^^^^^^^^^^^
|
||||
|
||||
This program needs to run some commands like ``getShardMap`` and to be able to run those commands
|
||||
it needs to run under a user with the ``clusterAdmin`` or ``root`` built-in roles.
|
@@ -1,29 +1,65 @@
|
||||
Percona Toolkit
|
||||
***************
|
||||
|
||||
v3.2.0 released 2019-04-20
|
||||
v3.2.0 released 2020-04-23
|
||||
==========================
|
||||
|
||||
Improvements:
|
||||
|
||||
* :jirabug:`PT-1765`: Added documentation for ``DIFF_ROWS`` in ``pt-table-checksum``.
|
||||
* :jirabug:`PT-1757`: ``pt-table-checksum``: Improved handling of Small Tables.
|
||||
* :jirabug:`PT-1707`: Added support for IPv6 addresses.
|
||||
* :jirabug:`PT-1773`: Don't make the foreign key check in ``pt-online-schema-change`` if not needed.
|
||||
* :jirabug:`PT-1757`: ``pt-table-checksum`` can now handle small tables as a single chunk.
|
||||
* :jirabug:`PT-1813`: MariaDB 10.4 is now supported.
|
||||
|
||||
Bug fixes:
|
||||
|
||||
* :jirabug:`PT-1824`: Added 64-character constraint name limit. (Thank you Iwo Panowicz).
|
||||
* :jirabug:`PT-1793`: Protocol parser now handles the year 2020. (Thank you Kei Tsuchiya).
|
||||
* :jirabug:`PT-1782`: ``pt-online-schema-change``: No longer FK warning if no foreign keys.
|
||||
* :jirabug:`PT-1773`: ``pt-online-schema-change``: FK check restricted if needed.
|
||||
* :jirabug:`PT-1766`: ``pt-table-checksum``: ``DIFF_ROWS`` now computed correctly.
|
||||
* :jirabug:`PT-1760`: ``pt-online-schema-change`` no longer stalls for stopped replica when slave is active.
|
||||
* :jirabug:`PT-1759`: ``pt-stalk`` now collecting ``processlist`` and variables.
|
||||
* :jirabug:`PT-1576`: ``pt-stalk mysql-only`` now working as expected.
|
||||
* :jirabug:`PT-1502`: ``pt-online-schema-change`` now working with multi-source replication.
|
||||
* :jirabug:`PT-297` : ``pt-online-schema-change`` doesn't break replication.
|
||||
* :jirabug:`PT-1782`: ``pt-online-schema-change`` declined to handle tables because of foreign keys even when there were no foreign keys with some MariaDB 10.2 and MySQL 8 versions.
|
||||
* :jirabug:`PT-1759`: ``pt-stalk`` with ``--mysql-only`` option didn't collect MySQL Status variables.
|
||||
* :jirabug:`PT-1802`: ``pt-online-schema-change`` didn't handle self-referencing foreign keys properly which caused an unnecessarily high resource consumption.
|
||||
* :jirabug:`PT-1766`: ``pt-table-checksum`` ``DIFF_ROWS`` was not computed correctly.
|
||||
* :jirabug:`PT-1760`: ``pt-online-schema-change`` regression caused it to hang for a stopped replica when using replication channels on the slave.
|
||||
* :jirabug:`PT-1707`: A number of the Percona Toolkit tools failed to operate in the IPv6 environment if the host address specified as a parameter was not enclosed in square brackets.
|
||||
* :jirabug:`PT-1502`: ``pt-online-schema-change`` was not recognizing the slave with multi-source replication active.
|
||||
* :jirabug:`PT-1824`: ``pt-online-schema-change`` allowed the name of a constraint to exceed 64 characters when ``--alter-foreign-keys-method=rebuild_constraints`` was used. (Thank you, Iwo Panowicz.)
|
||||
* :jirabug:`PT-1765`: Documentation for ``DIFF_ROWS`` doesn't exist.
|
||||
* :jirabug:`PT-297`: ``pt-online-schema-change`` could break replication.
|
||||
* :jirabug:`PT-1768`: Source code for ``src/go/pt-mongodb-query-digest/pt-mongodb-query-digest`` was missing in the official source tar ball.
|
||||
* :jirabug:`PT-1576`: ``pt-stalk` with ``--mysql-only`` option was not adding MySQL ``processlist`` information to the output file.
|
||||
* :jirabug:`PT-1793`: ``pt-query-digest`` was unable to handle the year 2020 because of wrong ``tcpdump`` parsing. (Thank you, Kei Tsuchiya.)
|
||||
|
||||
|
||||
v3.1.0 released 2019-09-12
|
||||
==========================
|
||||
|
||||
New Features:
|
||||
|
||||
* :jirabug:`PT-1663`: Implement retention by bytes for pt-stalk
|
||||
|
||||
Improvements:
|
||||
|
||||
* :jirabug:`PT-1705`: Make pt-online-schema-change exit with different codes depending on the status
|
||||
* :jirabug:`PT-1761`: Prevent pt-osc to run under MySQL 8.0.14+ & 8.0.17
|
||||
* :jirabug:`PT-1746`: diskstats not working for kernel 4.18+
|
||||
|
||||
Bugs Fixed:
|
||||
|
||||
* :jirabug:`PT-1736`: pt-kill ignores --busy-time and --kill-busy-commands=Query when there is a process with Command=Execute
|
||||
* :jirabug:`PT-1575`: pt-mysql-summary does not print PXC section for PXC 5.6 and 5.7
|
||||
* :jirabug:`PT-1728`: Pt-table-checksum failing to scan small tables that get wiped out often
|
||||
* :jirabug:`PT-1720`: pt-pmp parses configuration files that lead to errors
|
||||
* :jirabug:`PT-1114`: LP #1182180: pt-table-checksum fails when table is empty
|
||||
* :jirabug:`PT-1715`: pt-upgrade documentation doesn't have the type tcpdump
|
||||
* :jirabug:`PT-1344`: LP #1580428: pt-online-schema-change: Use of uninitialized value $host in string
|
||||
* :jirabug:`PT-1492`: pt-kill in version 3.0.7 seems not to respect busy-time any longer
|
||||
* :jirabug:`PT-1798`: CLONE - yum repos do not contain 3.1.1 of percona toolkit
|
||||
* :jirabug:`PT-1797`: yum repos do not contain 3.1.1 of percona toolkit
|
||||
* :jirabug:`PT-1633`: pt-config-diff doesn't handle innodb_temp_data_file_path correctly
|
||||
* :jirabug:`PT-1630`: pt-table-checksum not working with galera cluster anymore since 3.0.11
|
||||
* :jirabug:`PT-1734`: Tailing log_error in pt-stalk doesn't work
|
||||
* :jirabug:`PT-1732`: Typo in link on percona.com
|
||||
|
||||
|
||||
|
||||
|
||||
v3.0.13 released 2019-01-03
|
||||
===========================
|
||||
|
||||
@@ -74,8 +110,7 @@ New features
|
||||
|
||||
* :jirabug:`PT-1571`: Improved hostname recognition in ``pt-secure-collect``
|
||||
* :jirabug:`PT-1569`: Disabled ``--alter-foreign-keys-method=drop_swap`` in ``pt-online-schema-change``
|
||||
* :jirabug:`PT-242`: (``pt-stalk``) Include ``SHOW SLAVE STATUS`` on MySQL 5.7 (Thanks `Marcelo Altmann <https://www.p
|
||||
ercona.com/blog/author/marcelo-altmann/>`_)
|
||||
* :jirabug:`PT-242`: (``pt-stalk``) Include ``SHOW SLAVE STATUS`` on MySQL 5.7 (Thanks `Marcelo Altmann <https://www.percona.com/blog/author/marcelo-altmann/>`_)
|
||||
|
||||
Fixed bugs
|
||||
|
||||
@@ -564,7 +599,7 @@ Bug Fixes:
|
||||
|
||||
* Bug 1336734: ``pt-online-schema-change`` has implemented new ``--null-to-non-null`` flag which can be used to convert ``NULL`` columns to ``NOT NULL``.
|
||||
|
||||
* Bug 1362942: ``pt-slave-restart`` would fail to run on |MariaDB| 10.0.13 due to a different implementation of ``GTID``.
|
||||
* Bug 1362942: ``pt-slave-restart`` would fail to run on MariaDB 10.0.13 due to a different implementation of ``GTID``.
|
||||
|
||||
* Bug 1389041: ``pt-table-checksum`` had a high likelihood to skip a table when row count was around ``chunk-size`` * ``chunk-size-limit``. To address this issue a new ``--slave-skip-tolerance`` option has been implemented.
|
||||
|
||||
@@ -1102,17 +1137,17 @@ pt-query-digest --output json includes query examples as of v2.2.3. Some people
|
||||
When using drop swap with pt-online-schema-change there is some production impact. This impact can be measured because tool outputs the current timestamp on lines for operations that may take awhile.
|
||||
|
||||
* Fixed bug #1163735: pt-table-checksum fails if explicit_defaults_for_timestamp is enabled in 5.6
|
||||
pt-table-checksum would fail if variable explicit_defaults_for_timestamp was enabled in MySQL 5.6.
|
||||
pt-table-checksum would fail if variable explicit_defaults_for_timestamp was enabled in MySQL 5.6.
|
||||
|
||||
* Fixed bug #1182856: Zero values causes "Invalid --set-vars value: var=0"
|
||||
Trying to assign 0 to any variable by using --set-vars option would cause “Invalid --set-vars value” message.
|
||||
Trying to assign 0 to any variable by using --set-vars option would cause “Invalid --set-vars value” message.
|
||||
|
||||
* Fixed bug #1188264: pt-online-schema-change error copying rows: Undefined subroutine &pt_online_schema_change::get
|
||||
|
||||
* Fixed the typo in the pt-online-schema-change code that could lead to a tool crash when copying the rows.
|
||||
|
||||
* Fixed bug #1199591: pt-table-checksum doesn't use non-unique index with highest cardinality
|
||||
pt-table-checksum was using the first non-unique index instead of the one with the highest cardinality due to a sorting bug.
|
||||
pt-table-checksum was using the first non-unique index instead of the one with the highest cardinality due to a sorting bug.
|
||||
|
||||
Percona Toolkit packages can be downloaded from
|
||||
http://www.percona.com/downloads/percona-toolkit/ or the Percona Software
|
||||
|
44
docs/rn.3-1-0.txt
Normal file
44
docs/rn.3-1-0.txt
Normal file
@@ -0,0 +1,44 @@
|
||||
.. _PT-3.1.0:
|
||||
|
||||
================================================================================
|
||||
*Percona Toolkit* 3.1.0
|
||||
================================================================================
|
||||
|
||||
:Date: September 12, 2019
|
||||
:Installation: `Installing Percona Toolkit <https://www.percona.com/doc/percona-toolkit/LATEST/installation.html>`_
|
||||
|
||||
New Features
|
||||
================================================================================
|
||||
|
||||
* :jirabug:`PT-1663`: Implement retention by bytes for pt-stalk
|
||||
|
||||
|
||||
|
||||
Improvements
|
||||
================================================================================
|
||||
|
||||
* :jirabug:`PT-1705`: Make pt-online-schema-change exit with different codes depending on the status
|
||||
* :jirabug:`PT-1761`: Prevent pt-osc to run under MySQL 8.0.14+ & 8.0.17
|
||||
* :jirabug:`PT-1746`: diskstats not working for kernel 4.18+
|
||||
|
||||
|
||||
|
||||
Bugs Fixed
|
||||
================================================================================
|
||||
|
||||
* :jirabug:`PT-1736`: pt-kill ignores --busy-time and --kill-busy-commands=Query when there is a process with Command=Execute
|
||||
* :jirabug:`PT-1575`: pt-mysql-summary does not print PXC section for PXC 5.6 and 5.7
|
||||
* :jirabug:`PT-1728`: Pt-table-checksum failing to scan small tables that get wiped out often
|
||||
* :jirabug:`PT-1720`: pt-pmp parses configuration files that lead to errors
|
||||
* :jirabug:`PT-1114`: LP #1182180: pt-table-checksum fails when table is empty
|
||||
* :jirabug:`PT-1715`: pt-upgrade documentation doesn't have the type tcpdump
|
||||
* :jirabug:`PT-1344`: LP #1580428: pt-online-schema-change: Use of uninitialized value $host in string
|
||||
* :jirabug:`PT-1492`: pt-kill in version 3.0.7 seems not to respect busy-time any longer
|
||||
* :jirabug:`PT-1798`: CLONE - yum repos do not contain 3.1.1 of percona toolkit
|
||||
* :jirabug:`PT-1797`: yum repos do not contain 3.1.1 of percona toolkit
|
||||
* :jirabug:`PT-1633`: pt-config-diff doesn't handle innodb_temp_data_file_path correctly
|
||||
* :jirabug:`PT-1630`: pt-table-checksum not working with galera cluster anymore since 3.0.11
|
||||
* :jirabug:`PT-1734`: Tailing log_error in pt-stalk doesn't work
|
||||
* :jirabug:`PT-1732`: Typo in link on percona.com
|
||||
|
||||
|
37
docs/rn.3-2-0.txt
Normal file
37
docs/rn.3-2-0.txt
Normal file
@@ -0,0 +1,37 @@
|
||||
.. _PT-3.2.0:
|
||||
|
||||
================================================================================
|
||||
*Percona Toolkit* 3.2.0
|
||||
================================================================================
|
||||
|
||||
:Date: April 23, 2020
|
||||
|
||||
:Installation: `Installing Percona Toolkit <https://www.percona.com/doc/percona-toolkit/3.0/installation.html>`_
|
||||
|
||||
Improvements
|
||||
================================================================================
|
||||
|
||||
* :jirabug:`PT-1773`: Don't make the foreign key check in ``pt-online-schema-change`` if not needed.
|
||||
* :jirabug:`PT-1757`: ``pt-table-checksum`` can now handle small tables as a single chunk.
|
||||
* :jirabug:`PT-1813`: MariaDB 10.4 is now supported.
|
||||
|
||||
|
||||
|
||||
Bugs Fixed
|
||||
================================================================================
|
||||
|
||||
* :jirabug:`PT-1782`: ``pt-online-schema-change`` declined to handle tables because of foreign keys even when there were no foreign keys with some MariaDB 10.2 and MySQL 8 versions.
|
||||
* :jirabug:`PT-1759`: ``pt-stalk`` with ``--mysql-only`` option didn't collect MySQL Status variables.
|
||||
* :jirabug:`PT-1802`: ``pt-online-schema-change`` didn't handle self-referencing foreign keys properly which caused an unnecessarily high resource consumption.
|
||||
* :jirabug:`PT-1766`: ``pt-table-checksum`` ``DIFF_ROWS`` was not computed correctly.
|
||||
* :jirabug:`PT-1760`: ``pt-online-schema-change`` regression caused it to hang for a stopped replica when using replication channels on the slave.
|
||||
* :jirabug:`PT-1707`: A number of the Percona Toolkit tools failed to operate in the IPv6 environment if the host address specified as a parameter was not enclosed in square brackets.
|
||||
* :jirabug:`PT-1502`: ``pt-online-schema-change`` was not recognizing the slave with multi-source replication active.
|
||||
* :jirabug:`PT-1824`: ``pt-online-schema-change`` allowed the name of a constraint to exceed 64 characters when ``--alter-foreign-keys-method=rebuild_constraints`` was used. (Thank you, Iwo Panowicz.)
|
||||
* :jirabug:`PT-1765`: Documentation for ``DIFF_ROWS`` doesn't exist.
|
||||
* :jirabug:`PT-297`: ``pt-online-schema-change`` could break replication.
|
||||
* :jirabug:`PT-1768`: Source code for ``src/go/pt-mongodb-query-digest/pt-mongodb-query-digest`` was missing in the official source tar ball.
|
||||
* :jirabug:`PT-1576`: ``pt-stalk` with ``--mysql-only`` option was not adding MySQL ``processlist`` information to the output file.
|
||||
* :jirabug:`PT-1793`: ``pt-query-digest`` was unable to handle the year 2020 because of wrong ``tcpdump`` parsing. (Thank you, Kei Tsuchiya.)
|
||||
|
||||
|
@@ -99,7 +99,7 @@ of environments running Percona Software and it is good choice for majority of
|
||||
the users.
|
||||
|
||||
Why not rely on Operating System's built in functionality for software updates?
|
||||
-----------------------------------------------------------------------------
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
In many environments the Operating Systems repositories may not carry the
|
||||
latest version of software and newer versions of software often installed
|
||||
|
@@ -18,7 +18,7 @@
|
||||
# ###########################################################################
|
||||
package Percona::Toolkit;
|
||||
|
||||
our $VERSION = '3.0.14-dev';
|
||||
our $VERSION = '3.2.0';
|
||||
|
||||
use strict;
|
||||
use warnings FATAL => 'all';
|
||||
|
@@ -18,7 +18,7 @@ BIN_DIR=$(shell git rev-parse --show-toplevel)/bin
|
||||
SRC_DIR=$(shell git rev-parse --show-toplevel)/src/go
|
||||
LDFLAGS="-X main.Version=${VERSION} -X main.Build=${BUILD} -X main.GoVersion=${GOVERSION} -X main.Commit=${COMMIT} -s -w"
|
||||
|
||||
TEST_PSMDB_VERSION?=3.6
|
||||
TEST_PSMDB_VERSION?=4.0
|
||||
TEST_MONGODB_FLAVOR?=percona/percona-server-mongodb
|
||||
TEST_MONGODB_ADMIN_USERNAME?=admin
|
||||
TEST_MONGODB_ADMIN_PASSWORD?=admin123456
|
||||
|
@@ -4,13 +4,10 @@ services:
|
||||
standalone:
|
||||
network_mode: host
|
||||
image: ${TEST_MONGODB_FLAVOR}:${TEST_PSMDB_VERSION}
|
||||
environment:
|
||||
MONGO_INITDB_ROOT_USERNAME: ${TEST_MONGODB_ADMIN_USERNAME}
|
||||
MONGO_INITDB_ROOT_PASSWORD: ${TEST_MONGODB_ADMIN_PASSWORD}
|
||||
command: --port=27017
|
||||
volumes:
|
||||
- ./docker/test/entrypoint-mongod.sh:/entrypoint.sh:ro
|
||||
- ./docker/test/entrypoint-mongod.sh:/usr/local/bin/docker-entrypoint.sh:ro
|
||||
- ./docker/test/mongod.key:/mongod.key:ro
|
||||
- ./docker/test/ssl/rootCA.crt:/rootCA.crt:ro
|
||||
- ./docker/test/ssl/mongodb.pem:/mongod.pem:ro
|
||||
s1-mongo1:
|
||||
network_mode: host
|
||||
image: ${TEST_MONGODB_FLAVOR}:${TEST_PSMDB_VERSION}
|
||||
|
@@ -30,6 +30,8 @@ const (
|
||||
envMongoDBConfigsvr3Port = "TEST_MONGODB_CONFIGSVR3_PORT"
|
||||
//
|
||||
envMongoDBMongosPort = "TEST_MONGODB_MONGOS_PORT"
|
||||
|
||||
envMongoDBStandalonePort = "TEST_MONGODB_STANDALONE_PORT"
|
||||
//
|
||||
envMongoDBUser = "TEST_MONGODB_ADMIN_USERNAME"
|
||||
envMongoDBPassword = "TEST_MONGODB_ADMIN_PASSWORD"
|
||||
@@ -39,6 +41,9 @@ var (
|
||||
// MongoDBHost is the hostname. Since it runs locally, it is localhost
|
||||
MongoDBHost = "127.0.0.1"
|
||||
|
||||
// Port for standalone instance
|
||||
MongoDBStandalonePort = os.Getenv(envMongoDBStandalonePort)
|
||||
|
||||
// MongoDBShard1ReplsetName Replicaset name for shard 1
|
||||
MongoDBShard1ReplsetName = os.Getenv(envMongoDBShard1ReplsetName)
|
||||
// MongoDBShard1PrimaryPort is the port for the primary instance of shard 1
|
||||
|
@@ -2,7 +2,6 @@ package util
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
@@ -13,8 +12,13 @@ import (
|
||||
"go.mongodb.org/mongo-driver/mongo/options"
|
||||
)
|
||||
|
||||
const (
|
||||
shardingNotEnabledErrorCode = 203
|
||||
)
|
||||
|
||||
var (
|
||||
CANNOT_GET_QUERY_ERROR = errors.New("cannot get query field from the profile document (it is not a map)")
|
||||
CannotGetQueryError = errors.New("cannot get query field from the profile document (it is not a map)")
|
||||
ShardingNotEnabledError = errors.New("sharding not enabled")
|
||||
)
|
||||
|
||||
func GetReplicasetMembers(ctx context.Context, clientOptions *options.ClientOptions) ([]proto.Members, error) {
|
||||
@@ -92,7 +96,7 @@ func GetReplicasetMembers(ctx context.Context, clientOptions *options.ClientOpti
|
||||
membersMap[m.Name] = m
|
||||
}
|
||||
|
||||
client.Disconnect(ctx)
|
||||
client.Disconnect(ctx) //nolint
|
||||
}
|
||||
|
||||
for _, member := range membersMap {
|
||||
@@ -119,6 +123,9 @@ func GetHostnames(ctx context.Context, client *mongo.Client) ([]string, error) {
|
||||
var shardsMap proto.ShardsMap
|
||||
smRes := client.Database("admin").RunCommand(ctx, primitive.M{"getShardMap": 1})
|
||||
if smRes.Err() != nil {
|
||||
if e, ok := smRes.Err().(mongo.CommandError); ok && e.Code == shardingNotEnabledErrorCode {
|
||||
return nil, ShardingNotEnabledError // standalone instance
|
||||
}
|
||||
return nil, errors.Wrap(smRes.Err(), "cannot getShardMap for GetHostnames")
|
||||
}
|
||||
if err := smRes.Decode(&shardsMap); err != nil {
|
||||
@@ -134,7 +141,8 @@ func GetHostnames(ctx context.Context, client *mongo.Client) ([]string, error) {
|
||||
}
|
||||
}
|
||||
|
||||
return nil, fmt.Errorf("cannot get shards map")
|
||||
// Some MongoDB servers won't return ShardingNotEnabledError for stand alone instances.
|
||||
return nil, nil // standalone instance
|
||||
}
|
||||
|
||||
func buildHostsListFromReplStatus(replStatus proto.ReplicaSetStatus) []string {
|
||||
@@ -265,7 +273,7 @@ func GetQueryField(doc proto.SystemProfile) (primitive.M, error) {
|
||||
if ssquery, ok := squery.(primitive.M); ok {
|
||||
return ssquery, nil
|
||||
}
|
||||
return nil, CANNOT_GET_QUERY_ERROR
|
||||
return nil, CannotGetQueryError
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -301,7 +309,7 @@ func GetQueryField(doc proto.SystemProfile) (primitive.M, error) {
|
||||
if ssquery, ok := squery.(primitive.M); ok {
|
||||
return ssquery, nil
|
||||
}
|
||||
return nil, CANNOT_GET_QUERY_ERROR
|
||||
return nil, CannotGetQueryError
|
||||
}
|
||||
|
||||
// "query" in MongoDB 3.2+ is better structured and always has a "filter" subkey:
|
||||
@@ -309,7 +317,7 @@ func GetQueryField(doc proto.SystemProfile) (primitive.M, error) {
|
||||
if ssquery, ok := squery.(primitive.M); ok {
|
||||
return ssquery, nil
|
||||
}
|
||||
return nil, CANNOT_GET_QUERY_ERROR
|
||||
return nil, CannotGetQueryError
|
||||
}
|
||||
|
||||
// {"ns":"test.system.js","op":"query","query":{"find":"system.js"}}
|
||||
|
@@ -14,24 +14,34 @@ import (
|
||||
|
||||
func TestGetHostnames(t *testing.T) {
|
||||
testCases := []struct {
|
||||
name string
|
||||
uri string
|
||||
want []string
|
||||
name string
|
||||
uri string
|
||||
want []string
|
||||
wantError bool
|
||||
}{
|
||||
{
|
||||
name: "from_mongos",
|
||||
uri: fmt.Sprintf("mongodb://%s:%s@%s:%s", tu.MongoDBUser, tu.MongoDBPassword, tu.MongoDBHost, tu.MongoDBMongosPort),
|
||||
want: []string{"127.0.0.1:17001", "127.0.0.1:17002", "127.0.0.1:17004", "127.0.0.1:17005", "127.0.0.1:17007"},
|
||||
name: "from_mongos",
|
||||
uri: fmt.Sprintf("mongodb://%s:%s@%s:%s", tu.MongoDBUser, tu.MongoDBPassword, tu.MongoDBHost, tu.MongoDBMongosPort),
|
||||
want: []string{"127.0.0.1:17001", "127.0.0.1:17002", "127.0.0.1:17004", "127.0.0.1:17005", "127.0.0.1:17007"},
|
||||
wantError: false,
|
||||
},
|
||||
{
|
||||
name: "from_mongod",
|
||||
uri: fmt.Sprintf("mongodb://%s:%s@%s:%s", tu.MongoDBUser, tu.MongoDBPassword, tu.MongoDBHost, tu.MongoDBShard1PrimaryPort),
|
||||
want: []string{"127.0.0.1:17001", "127.0.0.1:17002", "127.0.0.1:17003"},
|
||||
name: "from_mongod",
|
||||
uri: fmt.Sprintf("mongodb://%s:%s@%s:%s", tu.MongoDBUser, tu.MongoDBPassword, tu.MongoDBHost, tu.MongoDBShard1PrimaryPort),
|
||||
want: []string{"127.0.0.1:17001", "127.0.0.1:17002", "127.0.0.1:17003"},
|
||||
wantError: false,
|
||||
},
|
||||
{
|
||||
name: "from_non_sharded",
|
||||
uri: fmt.Sprintf("mongodb://%s:%s@%s:%s", tu.MongoDBUser, tu.MongoDBPassword, tu.MongoDBHost, tu.MongoDBShard3PrimaryPort),
|
||||
want: []string{"127.0.0.1:17021", "127.0.0.1:17022", "127.0.0.1:17023"},
|
||||
name: "from_non_sharded",
|
||||
uri: fmt.Sprintf("mongodb://%s:%s@%s:%s", tu.MongoDBUser, tu.MongoDBPassword, tu.MongoDBHost, tu.MongoDBShard3PrimaryPort),
|
||||
want: []string{"127.0.0.1:17021", "127.0.0.1:17022", "127.0.0.1:17023"},
|
||||
wantError: false,
|
||||
},
|
||||
{
|
||||
name: "from_standalone",
|
||||
uri: fmt.Sprintf("mongodb://%s:%s@%s:%s", tu.MongoDBUser, tu.MongoDBPassword, tu.MongoDBHost, tu.MongoDBStandalonePort),
|
||||
want: nil,
|
||||
wantError: true,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -49,12 +59,12 @@ func TestGetHostnames(t *testing.T) {
|
||||
}
|
||||
|
||||
hostnames, err := GetHostnames(ctx, client)
|
||||
if err != nil {
|
||||
t.Errorf("getHostnames: %v", err)
|
||||
if err != nil && !test.wantError {
|
||||
t.Errorf("Expecting error=nil, got: %v", err)
|
||||
}
|
||||
|
||||
if !reflect.DeepEqual(hostnames, test.want) {
|
||||
t.Errorf("Invalid hostnames from mongos. Got: %+v, want %+v", hostnames, test.want)
|
||||
t.Errorf("Invalid hostnames. Got: %+v, want %+v", hostnames, test.want)
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -81,24 +91,34 @@ func TestGetServerStatus(t *testing.T) {
|
||||
|
||||
func TestGetReplicasetMembers(t *testing.T) {
|
||||
testCases := []struct {
|
||||
name string
|
||||
uri string
|
||||
want int
|
||||
name string
|
||||
uri string
|
||||
want int
|
||||
wantErr bool
|
||||
}{
|
||||
{
|
||||
name: "from_mongos",
|
||||
uri: fmt.Sprintf("mongodb://%s:%s@%s:%s", tu.MongoDBUser, tu.MongoDBPassword, tu.MongoDBHost, tu.MongoDBMongosPort),
|
||||
want: 7,
|
||||
name: "from_mongos",
|
||||
uri: fmt.Sprintf("mongodb://%s:%s@%s:%s", tu.MongoDBUser, tu.MongoDBPassword, tu.MongoDBHost, tu.MongoDBMongosPort),
|
||||
want: 7,
|
||||
wantErr: false,
|
||||
},
|
||||
{
|
||||
name: "from_mongod",
|
||||
uri: fmt.Sprintf("mongodb://%s:%s@%s:%s", tu.MongoDBUser, tu.MongoDBPassword, tu.MongoDBHost, tu.MongoDBShard1PrimaryPort),
|
||||
want: 3,
|
||||
name: "from_mongod",
|
||||
uri: fmt.Sprintf("mongodb://%s:%s@%s:%s", tu.MongoDBUser, tu.MongoDBPassword, tu.MongoDBHost, tu.MongoDBShard1PrimaryPort),
|
||||
want: 3,
|
||||
wantErr: false,
|
||||
},
|
||||
{
|
||||
name: "from_non_sharded",
|
||||
uri: fmt.Sprintf("mongodb://%s:%s@%s:%s", tu.MongoDBUser, tu.MongoDBPassword, tu.MongoDBHost, tu.MongoDBShard3PrimaryPort),
|
||||
want: 3,
|
||||
name: "from_non_sharded",
|
||||
uri: fmt.Sprintf("mongodb://%s:%s@%s:%s", tu.MongoDBUser, tu.MongoDBPassword, tu.MongoDBHost, tu.MongoDBShard3PrimaryPort),
|
||||
want: 3,
|
||||
wantErr: false,
|
||||
},
|
||||
{
|
||||
name: "from_standalone",
|
||||
uri: fmt.Sprintf("mongodb://%s:%s@%s:%s", tu.MongoDBUser, tu.MongoDBPassword, tu.MongoDBHost, tu.MongoDBStandalonePort),
|
||||
want: 0,
|
||||
wantErr: true,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -109,7 +129,7 @@ func TestGetReplicasetMembers(t *testing.T) {
|
||||
defer cancel()
|
||||
|
||||
rsm, err := GetReplicasetMembers(ctx, clientOptions)
|
||||
if err != nil {
|
||||
if err != nil && !test.wantErr {
|
||||
t.Errorf("Got an error while getting replicaset members: %s", err)
|
||||
}
|
||||
if len(rsm) != test.want {
|
||||
@@ -146,7 +166,7 @@ func TestGetShardedHosts(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
for _, test := range testCases {
|
||||
for i, test := range testCases {
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
clientOptions := options.Client().ApplyURI(test.uri)
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 20*time.Second)
|
||||
@@ -156,6 +176,10 @@ func TestGetShardedHosts(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Errorf("Cannot get a new client for host %s: %s", test.uri, err)
|
||||
}
|
||||
if client == nil {
|
||||
t.Fatalf("mongodb client is nil i: %d, uri: %s\n", i, test.uri)
|
||||
}
|
||||
|
||||
if err := client.Connect(ctx); err != nil {
|
||||
t.Errorf("Cannot connect to host %s: %s", test.uri, err)
|
||||
}
|
27
src/go/pt-k8s-pxc-recovery/kubectl/kubectl.go
Normal file
27
src/go/pt-k8s-pxc-recovery/kubectl/kubectl.go
Normal file
@@ -0,0 +1,27 @@
|
||||
package kubectl
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"os/exec"
|
||||
"runtime"
|
||||
)
|
||||
|
||||
func getKubectl() string {
|
||||
switch runtime.GOOS {
|
||||
case "windows":
|
||||
return "kubectl.exe"
|
||||
default:
|
||||
return "kubectl"
|
||||
}
|
||||
}
|
||||
|
||||
func RunCmd(namespace string, args ...string) (string, error) {
|
||||
args = append([]string{"-v=0", "--namespace", namespace}, args...)
|
||||
cmd := exec.Command(getKubectl(), args...)
|
||||
stdouterr, err := cmd.CombinedOutput()
|
||||
if err != nil {
|
||||
return "", errors.New(string(stdouterr))
|
||||
}
|
||||
output := string(stdouterr)
|
||||
return output, nil
|
||||
}
|
92
src/go/pt-k8s-pxc-recovery/main.go
Normal file
92
src/go/pt-k8s-pxc-recovery/main.go
Normal file
@@ -0,0 +1,92 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"log"
|
||||
"time"
|
||||
|
||||
"github.com/percona/percona-toolkit/src/go/pt-k8s-pxc-recovery/recover"
|
||||
)
|
||||
|
||||
func stepOrError(err error) {
|
||||
if err != nil {
|
||||
log.Fatal("Error:", err)
|
||||
}
|
||||
}
|
||||
|
||||
func main() {
|
||||
namespace, clusterName, debugImage := "", "", ""
|
||||
flag.StringVar(&namespace, "namespace", "default", "Select the namespace in which the cluster is deployed in")
|
||||
flag.StringVar(&clusterName, "cluster", "test-cluster", "Select the cluster to recover")
|
||||
flag.StringVar(&debugImage, "debug-image", "percona/percona-xtradb-cluster:8.0.19-10.1-debug", "Name and version of the debug image to use")
|
||||
flag.Parse()
|
||||
c := recover.Cluster{Namespace: namespace, Name: clusterName}
|
||||
log.SetPrefix("\n" + log.Prefix())
|
||||
|
||||
log.Printf("Starting recovery process")
|
||||
go func() {
|
||||
for {
|
||||
time.Sleep(300 * time.Millisecond)
|
||||
fmt.Print(".")
|
||||
}
|
||||
}()
|
||||
|
||||
log.Printf("Getting cluster size")
|
||||
stepOrError(c.SetClusterSize())
|
||||
|
||||
log.Printf("Getting cluster image")
|
||||
clusterImage, err := c.GetClusterImage()
|
||||
stepOrError(err)
|
||||
|
||||
log.Printf("Confirming crashed status")
|
||||
stepOrError(c.ConfirmCrashedStatus())
|
||||
|
||||
log.Printf("Patching cluster image")
|
||||
stepOrError(c.PatchClusterImage(debugImage))
|
||||
|
||||
log.Printf("Restarting pods")
|
||||
stepOrError(c.RestartPods())
|
||||
|
||||
log.Printf("Make sure pod zero is ready")
|
||||
stepOrError(c.PodZeroReady())
|
||||
|
||||
log.Printf("Make sure all pods are running")
|
||||
stepOrError(c.AllPodsRunning())
|
||||
|
||||
log.Print("Set SST in progress")
|
||||
stepOrError(c.SetSSTInProgress())
|
||||
|
||||
log.Print("Waiting for all pods to be ready")
|
||||
stepOrError(c.AllPodsReady())
|
||||
|
||||
log.Printf("Finding the most recent pod")
|
||||
stepOrError(c.FindMostRecentPod())
|
||||
|
||||
log.Printf("Recovering most recent pod")
|
||||
go func() {
|
||||
err := c.RecoverMostRecentPod()
|
||||
if err != nil {
|
||||
log.Printf("Recovering most recent pod still in progress")
|
||||
}
|
||||
}()
|
||||
|
||||
time.Sleep(10 * time.Second)
|
||||
|
||||
log.Printf("Patching cluster image")
|
||||
stepOrError(c.PatchClusterImage(clusterImage))
|
||||
|
||||
log.Printf("Restart all pods execpt most recent pod")
|
||||
stepOrError(c.RestartAllPodsExceptMostRecent())
|
||||
|
||||
log.Printf("Make sure all pods are running")
|
||||
stepOrError(c.AllPodsRunning())
|
||||
|
||||
log.Printf("Restart Most Recent Pod")
|
||||
stepOrError(c.RestartMostRecentPod())
|
||||
|
||||
log.Print("Waiting for all pods to be ready")
|
||||
stepOrError(c.AllPodsReady())
|
||||
|
||||
log.Printf("Completed the restore process")
|
||||
}
|
326
src/go/pt-k8s-pxc-recovery/recover/recover.go
Normal file
326
src/go/pt-k8s-pxc-recovery/recover/recover.go
Normal file
@@ -0,0 +1,326 @@
|
||||
package recover
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"regexp"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/percona/percona-toolkit/src/go/pt-k8s-pxc-recovery/kubectl"
|
||||
)
|
||||
|
||||
type Cluster struct {
|
||||
Name string
|
||||
Size int
|
||||
MostRecentPod string
|
||||
Namespace string
|
||||
}
|
||||
|
||||
func (c *Cluster) SetClusterSize() error {
|
||||
args := []string{
|
||||
"get",
|
||||
"pxc",
|
||||
c.Name,
|
||||
"-o",
|
||||
"jsonpath='{.spec.pxc.size}'",
|
||||
}
|
||||
strSize, err := kubectl.RunCmd(c.Namespace, args...)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
strSize = strings.Trim(strSize, "'")
|
||||
c.Size, err = strconv.Atoi(strSize)
|
||||
if err != nil {
|
||||
return fmt.Errorf("error getting cluster size, %s", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Cluster) GetClusterImage() (string, error) {
|
||||
args := []string{
|
||||
"get",
|
||||
"pod",
|
||||
c.Name + "-pxc-0",
|
||||
"-o",
|
||||
"jsonpath='{.spec.containers[0].image}'",
|
||||
}
|
||||
clusterImage, err := kubectl.RunCmd(c.Namespace, args...)
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("Error getting cluster image %s", err)
|
||||
}
|
||||
clusterImage = strings.Trim(clusterImage, "'")
|
||||
return clusterImage, nil
|
||||
}
|
||||
|
||||
func (c *Cluster) getPods() ([]string, error) {
|
||||
args := []string{
|
||||
"get",
|
||||
"pods",
|
||||
"--no-headers",
|
||||
"-o",
|
||||
"custom-columns=:metadata.name",
|
||||
}
|
||||
out, err := kubectl.RunCmd(c.Namespace, args...)
|
||||
if err != nil {
|
||||
return []string{}, err
|
||||
}
|
||||
formatedOutput := strings.Split(out, "\n")
|
||||
podNames := []string{}
|
||||
for _, podName := range formatedOutput {
|
||||
if strings.Contains(podName, c.Name) && strings.Contains(podName, "pxc") {
|
||||
podNames = append(podNames, podName)
|
||||
}
|
||||
}
|
||||
return podNames, nil
|
||||
}
|
||||
|
||||
func (c *Cluster) ConfirmCrashedStatus() error {
|
||||
podNames, err := c.getPods()
|
||||
if err != nil {
|
||||
return fmt.Errorf("Error getting pods : %s", err)
|
||||
}
|
||||
for _, pod := range podNames {
|
||||
logs, err := kubectl.RunCmd(c.Namespace, "logs", pod)
|
||||
if err != nil {
|
||||
return fmt.Errorf("error confirming crashed cluster status %s", err)
|
||||
}
|
||||
if !strings.Contains(logs, "grastate.dat") && !strings.Contains(logs, "safe_to_bootstrap") &&
|
||||
!strings.Contains(logs, "It may not be safe to bootstrap the cluster from this node") {
|
||||
return fmt.Errorf("found one or more pods in healthy state, can't use recovery tool, please restart failed pods manually")
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Cluster) PatchClusterImage(image string) error {
|
||||
args := []string{
|
||||
"patch",
|
||||
"pxc",
|
||||
c.Name,
|
||||
"--type=merge",
|
||||
`--patch={"spec":{"pxc":{"image":"` + image + `"}}}`,
|
||||
}
|
||||
_, err := kubectl.RunCmd(c.Namespace, args...)
|
||||
return fmt.Errorf("error patching cluster image: %s", err)
|
||||
}
|
||||
|
||||
func (c *Cluster) RestartPods() error {
|
||||
podNames, err := c.getPods()
|
||||
if err != nil {
|
||||
return fmt.Errorf("error getting pods to restart pods: %s", err)
|
||||
}
|
||||
for _, podName := range podNames {
|
||||
args := []string{
|
||||
"delete",
|
||||
"pod",
|
||||
podName,
|
||||
"--force",
|
||||
"--grace-period=0",
|
||||
}
|
||||
_, err := kubectl.RunCmd(c.Namespace, args...)
|
||||
if err != nil && !strings.Contains(err.Error(), "pods") && !strings.Contains(err.Error(), "not found") {
|
||||
return fmt.Errorf("error restarting pods: %s", err)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Cluster) CheckPodReady(podName string) (bool, error) {
|
||||
args := []string{
|
||||
"get",
|
||||
"pod",
|
||||
podName,
|
||||
"-o",
|
||||
"jsonpath='{.status.containerStatuses[0].ready}'",
|
||||
}
|
||||
output, err := kubectl.RunCmd(c.Namespace, args...)
|
||||
if err != nil {
|
||||
return false, fmt.Errorf("error checking pod ready: %s", err)
|
||||
}
|
||||
return strings.Trim(output, "'") == "true", nil
|
||||
}
|
||||
|
||||
func (c *Cluster) PodZeroReady() error {
|
||||
podNames, err := c.getPods()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
podZeroStatus := false
|
||||
for !podZeroStatus {
|
||||
time.Sleep(time.Second * 10)
|
||||
podZeroStatus, err = c.CheckPodReady(podNames[0])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Cluster) CheckPodPhase(podName string, phase string) (bool, error) {
|
||||
args := []string{
|
||||
"get",
|
||||
"pod",
|
||||
podName,
|
||||
"-o",
|
||||
"jsonpath='{.status.phase}'",
|
||||
}
|
||||
output, err := kubectl.RunCmd(c.Namespace, args...)
|
||||
if err != nil {
|
||||
return false, fmt.Errorf("error checking pod phase: %s", err)
|
||||
}
|
||||
return strings.Trim(output, "'") == phase, nil
|
||||
}
|
||||
|
||||
func (c *Cluster) AllPodsRunning() error {
|
||||
podNames, err := c.getPods()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
for _, podName := range podNames {
|
||||
running := false
|
||||
var err error
|
||||
for !running {
|
||||
time.Sleep(time.Second * 10)
|
||||
running, err = c.CheckPodPhase(podName, "Running")
|
||||
if err != nil && !strings.Contains(err.Error(), "NotFound") {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Cluster) RunCommandInPod(podName string, cmd ...string) (string, error) {
|
||||
args := []string{
|
||||
"exec",
|
||||
podName,
|
||||
"--",
|
||||
}
|
||||
args = append(args, cmd...)
|
||||
output, err := kubectl.RunCmd(c.Namespace, args...)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return output, nil
|
||||
}
|
||||
|
||||
func (c *Cluster) SetSSTInProgress() error {
|
||||
podNames, err := c.getPods()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
for _, podName := range podNames {
|
||||
_, err := c.RunCommandInPod(podName, "touch", "/var/lib/mysql/sst_in_progress")
|
||||
if err != nil {
|
||||
return fmt.Errorf("error setting sst in progress", err)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Cluster) AllPodsReady() error {
|
||||
podNames, err := c.getPods()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
for _, podName := range podNames {
|
||||
podReadyStatus := false
|
||||
for !podReadyStatus {
|
||||
time.Sleep(time.Second * 10)
|
||||
podReadyStatus, err = c.CheckPodReady(podName)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Cluster) FindMostRecentPod() error {
|
||||
podNames, err := c.getPods()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
var recentPodName string
|
||||
seqNo := 0
|
||||
re := regexp.MustCompile(`(?m)seqno:\s*(\d*)`)
|
||||
for _, podName := range podNames {
|
||||
output, err := c.RunCommandInPod(podName, "cat", "/var/lib/mysql/grastate.dat")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
match := re.FindStringSubmatch(output)
|
||||
if len(match) < 2 {
|
||||
return fmt.Errorf("error finding the most recent pod : unable to get seqno")
|
||||
}
|
||||
currentSeqNo, err := strconv.Atoi(string(match[1]))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if currentSeqNo > seqNo {
|
||||
seqNo = currentSeqNo
|
||||
recentPodName = podName
|
||||
}
|
||||
}
|
||||
c.MostRecentPod = recentPodName
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Cluster) RecoverMostRecentPod() error {
|
||||
_, err := c.RunCommandInPod(c.MostRecentPod, "mysqld", "--wsrep_recover")
|
||||
if err != nil {
|
||||
return fmt.Errorf("error recovering most recent pod: %s", err)
|
||||
}
|
||||
_, err = c.RunCommandInPod(c.MostRecentPod, "bash", "-c", "sed -i 's/safe_to_bootstrap: 0/safe_to_bootstrap: 1/g' /var/lib/mysql/grastate.dat")
|
||||
if err != nil {
|
||||
return fmt.Errorf("error recovering most recent pod: %s", err)
|
||||
}
|
||||
_, err = c.RunCommandInPod(c.MostRecentPod, "bash", "-c", "sed -i 's/wsrep_cluster_address=.*/wsrep_cluster_address=gcomm:\\/\\//g' /etc/mysql/node.cnf")
|
||||
if err != nil {
|
||||
return fmt.Errorf("error recovering most recent pod: %s", err)
|
||||
}
|
||||
_, err = c.RunCommandInPod(c.MostRecentPod, "mysqld")
|
||||
if err != nil {
|
||||
return fmt.Errorf("error recovering most recent pod: %s", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Cluster) RestartAllPodsExceptMostRecent() error {
|
||||
podNames, err := c.getPods()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
for _, podName := range podNames {
|
||||
if podName != c.MostRecentPod {
|
||||
args := []string{
|
||||
"delete",
|
||||
"pod",
|
||||
podName,
|
||||
"--force",
|
||||
"--grace-period=0",
|
||||
}
|
||||
_, err := kubectl.RunCmd(c.Namespace, args...)
|
||||
if err != nil {
|
||||
return fmt.Errorf("error restarting pods : %s", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Cluster) RestartMostRecentPod() error {
|
||||
args := []string{
|
||||
"delete",
|
||||
"pod",
|
||||
c.MostRecentPod,
|
||||
"--force",
|
||||
"--grace-period=0",
|
||||
}
|
||||
_, err := kubectl.RunCmd(c.Namespace, args...)
|
||||
if err != nil {
|
||||
return fmt.Errorf("error restarting most recent pod : %s", err)
|
||||
}
|
||||
return nil
|
||||
}
|
@@ -38,9 +38,9 @@ const (
|
||||
)
|
||||
|
||||
var (
|
||||
Build string = "01-01-1980" //nolint
|
||||
GoVersion string = "1.8" //nolint
|
||||
Version string = "3.0.1" //nolint
|
||||
Build string = "2020-04-23" //nolint
|
||||
GoVersion string = "1.14.1" //nolint
|
||||
Version string = "3.2.0" //nolint
|
||||
Commit string //nolint
|
||||
)
|
||||
|
||||
|
@@ -38,13 +38,19 @@ const (
|
||||
DefaultRunningOpsSamples = 5
|
||||
DefaultOutputFormat = "text"
|
||||
typeMongos = "mongos"
|
||||
|
||||
// Exit Codes
|
||||
cannotFormatResults = 1
|
||||
cannotParseCommandLineParameters = 2
|
||||
cannotGetHostInfo = 3
|
||||
cannotGetReplicasetMembers = 4
|
||||
)
|
||||
|
||||
var (
|
||||
Build string = "01-01-1980" // nolint
|
||||
GoVersion string = "1.8" // nolint
|
||||
Version string = "3.0.1" // nolint
|
||||
Commit string // nolint
|
||||
Build string = "2020-04-23" // nolint
|
||||
GoVersion string = "1.14.1" // nolint
|
||||
Version string = "3.2.0"
|
||||
Commit string
|
||||
)
|
||||
|
||||
type TimedStats struct {
|
||||
@@ -158,7 +164,7 @@ func main() {
|
||||
opts, err := parseFlags()
|
||||
if err != nil {
|
||||
log.Errorf("cannot get parameters: %s", err.Error())
|
||||
os.Exit(2)
|
||||
os.Exit(cannotParseCommandLineParameters)
|
||||
}
|
||||
if opts == nil && err == nil {
|
||||
return
|
||||
@@ -206,7 +212,7 @@ func main() {
|
||||
defer client.Disconnect(ctx) // nolint
|
||||
|
||||
hostnames, err := util.GetHostnames(ctx, client)
|
||||
if err != nil {
|
||||
if err != nil && errors.Is(err, util.ShardingNotEnabledError) {
|
||||
log.Errorf("Cannot get hostnames: %s", err)
|
||||
}
|
||||
log.Debugf("hostnames: %v", hostnames)
|
||||
@@ -217,12 +223,11 @@ func main() {
|
||||
if err != nil {
|
||||
message := fmt.Sprintf("Cannot get host info for %q: %s", opts.Host, err.Error())
|
||||
log.Errorf(message)
|
||||
os.Exit(2)
|
||||
os.Exit(cannotGetHostInfo)
|
||||
}
|
||||
|
||||
if ci.ReplicaMembers, err = util.GetReplicasetMembers(ctx, clientOptions); err != nil {
|
||||
log.Warnf("[Error] cannot get replicaset members: %v\n", err)
|
||||
os.Exit(2)
|
||||
}
|
||||
log.Debugf("replicaMembers:\n%+v\n", ci.ReplicaMembers)
|
||||
|
||||
@@ -270,10 +275,9 @@ func main() {
|
||||
out, err := formatResults(ci, opts.OutputFormat)
|
||||
if err != nil {
|
||||
log.Errorf("Cannot format the results: %s", err.Error())
|
||||
os.Exit(1)
|
||||
os.Exit(cannotFormatResults)
|
||||
}
|
||||
fmt.Println(string(out))
|
||||
|
||||
}
|
||||
|
||||
func formatResults(ci *collectedInfo, format string) ([]byte, error) {
|
||||
|
473
src/go/pt-pg-summary/README.rst
Normal file
473
src/go/pt-pg-summary/README.rst
Normal file
@@ -0,0 +1,473 @@
|
||||
pt-pg-summary
|
||||
=============
|
||||
**pt-pg-summary** collects information about a PostgreSQL cluster.
|
||||
|
||||
Usage
|
||||
-----
|
||||
|
||||
``pt-pg-summary [options] [host:[port]]``
|
||||
|
||||
Binaries
|
||||
--------
|
||||
Please check the `releases <https://github.com/percona/toolkit-go/releases>`_ tab to download the binaries.
|
||||
|
||||
Parameters
|
||||
^^^^^^^^^^
|
||||
|
||||
+--------+---------------------------------+---------+----------------------------------------------------------------------------+
|
||||
| Short | Long | Default | Description |
|
||||
+========+=================================+=========+============================================================================+
|
||||
| | ``--help`` | | Show context-sensitive help (also try ``--help-long`` and ``--help-man``). |
|
||||
+--------+---------------------------------+---------+----------------------------------------------------------------------------+
|
||||
| | ``--version`` | | Show application version. |
|
||||
+--------+---------------------------------+---------+----------------------------------------------------------------------------+
|
||||
| | ``--databases=DATABASES`` | | Summarize this comma-separated list of databases. All if not specified. |
|
||||
+--------+---------------------------------+---------+----------------------------------------------------------------------------+
|
||||
| ``-h`` | ``--host=HOST`` | | Host to connect to. |
|
||||
+--------+---------------------------------+---------+----------------------------------------------------------------------------+
|
||||
| ``-W`` | ``--password=PASSWORD`` | | Password to use when connecting. |
|
||||
+--------+---------------------------------+---------+----------------------------------------------------------------------------+
|
||||
| ``-p`` | ``--port=PORT`` | | Port number to use for connection. |
|
||||
+--------+---------------------------------+---------+----------------------------------------------------------------------------+
|
||||
| | ``--sleep=SLEEP`` | 10 | Seconds to sleep when gathering status counters. |
|
||||
+--------+---------------------------------+---------+----------------------------------------------------------------------------+
|
||||
| ``-U`` | ``--username=USERNAME`` | | User for login if not current user. |
|
||||
+--------+---------------------------------+---------+----------------------------------------------------------------------------+
|
||||
| | ``--disable-ssl`` | true | Disable SSL for the connection. |
|
||||
+--------+---------------------------------+---------+----------------------------------------------------------------------------+
|
||||
| | ``--verbose`` | false | Show verbose log. |
|
||||
+--------+---------------------------------+---------+----------------------------------------------------------------------------+
|
||||
| | ``--debug`` | false | Show debug information in the logs. |
|
||||
+--------+---------------------------------+---------+----------------------------------------------------------------------------+
|
||||
|
||||
|
||||
.. Currently hidden
|
||||
.. --list-encrypted-tables Include a list of the encrypted tables in all databases
|
||||
.. --ask-pass Prompt for a password when connecting to PostgreSQL
|
||||
.. --config Config file
|
||||
.. --defaults-file Only read PostgreSQL options from the given file
|
||||
.. --read-samples Create a report from the files found in this directory
|
||||
.. --save-samples Save the data files used to generate the summary in this directory
|
||||
|
||||
|
||||
Output
|
||||
^^^^^^
|
||||
|
||||
The output is grouped into these categories:
|
||||
|
||||
AllDatabases
|
||||
Selects ``datname`` from ``pg_database`` where ``datistemplate`` is false.
|
||||
|
||||
ClusterInfo
|
||||
Selects cluster information from ``pg_stat_activity``.
|
||||
|
||||
ConnectedClients
|
||||
Counts the connected clients by selecting from ``pg_stat_activity``.
|
||||
|
||||
Connections
|
||||
Selects ``state`` from ``pg_stat_activity`` and counts them.
|
||||
|
||||
Counters
|
||||
Selects various counter values from ``pg_stat_database``.
|
||||
|
||||
DatabaseWaitEvents
|
||||
Shows database wait events from ``pg_locks``, ``pg_stat_database``, ``pg_class``, and ``pg_stat_activity``.
|
||||
|
||||
Databases
|
||||
Shows the name and size of databases from ``pg_stat_database``.
|
||||
|
||||
GlobalWaitEvents
|
||||
Shows global wait evens from ``pg_stat_activity``.
|
||||
|
||||
IndexCacheHitRatio
|
||||
Shows index hit ratios from ``pg_statio_user_indexes``.
|
||||
|
||||
PortAndDatadir
|
||||
Shows port and data directory name from ``pg_settings``.
|
||||
|
||||
ServerVersion
|
||||
Shows the value of ``server_version_num``.
|
||||
|
||||
Setting
|
||||
Selects ``name`` and ``setting`` from ``pg_settings``.
|
||||
|
||||
SlaveHosts10
|
||||
Selects information for PostgreSQL version 10.
|
||||
|
||||
SlaveHosts96
|
||||
Selects information for PostgreSQL version 9.6.
|
||||
|
||||
TableAccess
|
||||
Shows table access information by selecting from ``pg_locks``, ``pg_stat_database`` and ``pg_class``.
|
||||
|
||||
TableCacheHitRatio
|
||||
Shows table cache hit ratio information from ``pg_statio_user_tables``.
|
||||
|
||||
Tablespaces
|
||||
Show owner and location from ``pg_catalog.pg_tablespace``.
|
||||
|
||||
|
||||
Output example
|
||||
""""""""""""""
|
||||
|
||||
.. code-block:: html
|
||||
|
||||
##### --- Database Port and Data_Directory --- ####
|
||||
+----------------------+----------------------------------------------------+
|
||||
| Name | Setting |
|
||||
+----------------------+----------------------------------------------------+
|
||||
| data_directory | /var/lib/postgresql/data |
|
||||
+----------------------+----------------------------------------------------+
|
||||
|
||||
##### --- List of Tablespaces ---- ######
|
||||
+----------------------+----------------------+----------------------------------------------------+
|
||||
| Name | Owner | Location |
|
||||
+----------------------+----------------------+----------------------------------------------------+
|
||||
| pg_default | postgres | |
|
||||
| pg_global | postgres | |
|
||||
+----------------------+----------------------+----------------------------------------------------+
|
||||
|
||||
|
||||
##### --- Cluster Information --- ####
|
||||
+------------------------------------------------------------------------------------------------------+
|
||||
Usename : postgres
|
||||
Time : 2020-04-21 13:38:22.770077 +0000 UTC
|
||||
Client Address : 172.19.0.1
|
||||
Client Hostname:
|
||||
Version : PostgreSQL 9.6.17 on x86_64-pc-linux-gnu (Debian 9.6.17-2.pgdg90+1), compiled by
|
||||
Started : 2020-04-21 13:36:59.909175 +0000 UTC
|
||||
Is Slave : false
|
||||
+------------------------------------------------------------------------------------------------------+
|
||||
|
||||
##### --- Databases --- ####
|
||||
+----------------------+------------+
|
||||
| Dat Name | Size |
|
||||
+----------------------+------------+
|
||||
| postgres | 7071 kB |
|
||||
| template1 | 6961 kB |
|
||||
| template0 | 6961 kB |
|
||||
+----------------------+------------+
|
||||
|
||||
##### --- Index Cache Hit Ratios --- ####
|
||||
|
||||
Database: postgres
|
||||
+----------------------+------------+
|
||||
| Index Name | Ratio |
|
||||
+----------------------+------------+
|
||||
| index hit rate | 0.00 |
|
||||
+----------------------+------------+
|
||||
|
||||
##### --- Table Cache Hit Ratios --- ####
|
||||
Database: postgres
|
||||
+----------------------+------------+
|
||||
| Index Name | Ratio |
|
||||
+----------------------+------------+
|
||||
| cache hit rate | 0.00 |
|
||||
+----------------------+------------+
|
||||
|
||||
##### --- List of Wait_events for the entire Cluster - all-databases --- ####
|
||||
No stats available
|
||||
|
||||
##### --- List of users and client_addr or client_hostname connected to --all-databases --- ####
|
||||
+----------------------+------------+---------+----------------------+---------+
|
||||
| Wait Event Type | Client | State | Count |
|
||||
+----------------------+------------+---------+----------------------+---------+
|
||||
| postgres | 172.19.0.1/32 | active | 1 |
|
||||
+----------------------+------------+---------+----------------------+---------+
|
||||
|
||||
##### --- Counters diff after 10 seconds --- ####
|
||||
|
||||
+----------------------+-------------+------------+--------------+-------------+------------+-------------+------------+-------------+------------+------------+-----------+-----------+-----------+------------+
|
||||
| Database | Numbackends | XactCommit | XactRollback | BlksRead | BlksHit | TupReturned | TupFetched | TupInserted | TupUpdated | TupDeleted | Conflicts | TempFiles | TempBytes | Deadlocks |
|
||||
+----------------------+-------------+------------+--------------+-------------+------------+-------------+------------+-------------+------------+------------+-----------+-----------+-----------+------------+
|
||||
| postgres | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
|
||||
| template0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
|
||||
| template1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
|
||||
+----------------------+-------------+------------+--------------+-------------+------------+-------------+------------+-------------+------------+------------+-----------+-----------+-----------+------------+
|
||||
|
||||
##### --- Table access per database --- ####
|
||||
Database: postgres
|
||||
+----------------------------------------------------+------+--------------------------------+---------+
|
||||
| Relname | Kind | Datname | Count |
|
||||
+----------------------------------------------------+------+--------------------------------+---------+
|
||||
| pg_class | r | postgres | 1 |
|
||||
| pg_stat_database | v | postgres | 1 |
|
||||
| pg_locks | v | postgres | 1 |
|
||||
| pg_class_tblspc_relfilenode_index | i | postgres | 1 |
|
||||
| pg_class_relname_nsp_index | i | postgres | 1 |
|
||||
| pg_class_oid_index | i | postgres | 1 |
|
||||
+----------------------------------------------------+------+--------------------------------+---------+
|
||||
|
||||
##### --- Instance settings --- ####
|
||||
Setting Value
|
||||
allow_system_table_mods : off
|
||||
application_name :
|
||||
archive_command : (disabled)
|
||||
archive_mode : off
|
||||
archive_timeout : 0
|
||||
array_nulls : on
|
||||
authentication_timeout : 60
|
||||
autovacuum : on
|
||||
autovacuum_analyze_scale_factor : 0.1
|
||||
autovacuum_analyze_threshold : 50
|
||||
autovacuum_freeze_max_age : 200000000
|
||||
autovacuum_max_workers : 3
|
||||
autovacuum_multixact_freeze_max_age : 400000000
|
||||
autovacuum_naptime : 60
|
||||
autovacuum_vacuum_cost_delay : 20
|
||||
autovacuum_vacuum_cost_limit : -1
|
||||
autovacuum_vacuum_scale_factor : 0.2
|
||||
autovacuum_vacuum_threshold : 50
|
||||
autovacuum_work_mem : -1
|
||||
backend_flush_after : 0
|
||||
backslash_quote : safe_encoding
|
||||
bgwriter_delay : 200
|
||||
bgwriter_flush_after : 64
|
||||
bgwriter_lru_maxpages : 100
|
||||
bgwriter_lru_multiplier : 2
|
||||
block_size : 8192
|
||||
bonjour : off
|
||||
bonjour_name :
|
||||
bytea_output : hex
|
||||
check_function_bodies : on
|
||||
checkpoint_completion_target : 0.5
|
||||
checkpoint_flush_after : 32
|
||||
checkpoint_timeout : 300
|
||||
checkpoint_warning : 30
|
||||
client_encoding : UTF8
|
||||
client_min_messages : notice
|
||||
cluster_name :
|
||||
commit_delay : 0
|
||||
commit_siblings : 5
|
||||
config_file : /var/lib/postgresql/data/postgresql.conf
|
||||
constraint_exclusion : partition
|
||||
cpu_index_tuple_cost : 0.005
|
||||
cpu_operator_cost : 0.0025
|
||||
cpu_tuple_cost : 0.01
|
||||
cursor_tuple_fraction : 0.1
|
||||
data_checksums : off
|
||||
data_directory : /var/lib/postgresql/data
|
||||
data_sync_retry : off
|
||||
DateStyle : ISO, MDY
|
||||
db_user_namespace : off
|
||||
deadlock_timeout : 1000
|
||||
debug_assertions : off
|
||||
debug_pretty_print : on
|
||||
debug_print_parse : off
|
||||
debug_print_plan : off
|
||||
debug_print_rewritten : off
|
||||
default_statistics_target : 100
|
||||
default_tablespace :
|
||||
default_text_search_config : pg_catalog.english
|
||||
default_transaction_deferrable : off
|
||||
default_transaction_isolation : read committed
|
||||
default_transaction_read_only : off
|
||||
default_with_oids : off
|
||||
dynamic_library_path : $libdir
|
||||
dynamic_shared_memory_type : posix
|
||||
effective_cache_size : 524288
|
||||
effective_io_concurrency : 1
|
||||
enable_bitmapscan : on
|
||||
enable_hashagg : on
|
||||
enable_hashjoin : on
|
||||
enable_indexonlyscan : on
|
||||
enable_indexscan : on
|
||||
enable_material : on
|
||||
enable_mergejoin : on
|
||||
enable_nestloop : on
|
||||
enable_seqscan : on
|
||||
enable_sort : on
|
||||
enable_tidscan : on
|
||||
escape_string_warning : on
|
||||
event_source : PostgreSQL
|
||||
exit_on_error : off
|
||||
external_pid_file :
|
||||
extra_float_digits : 2
|
||||
force_parallel_mode : off
|
||||
from_collapse_limit : 8
|
||||
fsync : on
|
||||
full_page_writes : on
|
||||
geqo : on
|
||||
geqo_effort : 5
|
||||
geqo_generations : 0
|
||||
geqo_pool_size : 0
|
||||
geqo_seed : 0
|
||||
geqo_selection_bias : 2
|
||||
geqo_threshold : 12
|
||||
gin_fuzzy_search_limit : 0
|
||||
gin_pending_list_limit : 4096
|
||||
hba_file : /var/lib/postgresql/data/pg_hba.conf
|
||||
hot_standby : off
|
||||
hot_standby_feedback : off
|
||||
huge_pages : try
|
||||
ident_file : /var/lib/postgresql/data/pg_ident.conf
|
||||
idle_in_transaction_session_timeout : 0
|
||||
ignore_checksum_failure : off
|
||||
ignore_system_indexes : off
|
||||
integer_datetimes : on
|
||||
IntervalStyle : postgres
|
||||
join_collapse_limit : 8
|
||||
krb_caseins_users : off
|
||||
krb_server_keyfile : FILE:/etc/postgresql-common/krb5.keytab
|
||||
lc_collate : en_US.utf8
|
||||
lc_ctype : en_US.utf8
|
||||
lc_messages : en_US.utf8
|
||||
lc_monetary : en_US.utf8
|
||||
lc_numeric : en_US.utf8
|
||||
lc_time : en_US.utf8
|
||||
listen_addresses : *
|
||||
lo_compat_privileges : off
|
||||
local_preload_libraries :
|
||||
lock_timeout : 0
|
||||
log_autovacuum_min_duration : -1
|
||||
log_checkpoints : off
|
||||
log_connections : off
|
||||
log_destination : stderr
|
||||
log_directory : pg_log
|
||||
log_disconnections : off
|
||||
log_duration : off
|
||||
log_error_verbosity : default
|
||||
log_executor_stats : off
|
||||
log_file_mode : 0600
|
||||
log_filename : postgresql-%Y-%m-%d_%H%M%S.log
|
||||
log_hostname : off
|
||||
log_line_prefix :
|
||||
log_lock_waits : off
|
||||
log_min_duration_statement : -1
|
||||
log_min_error_statement : error
|
||||
log_min_messages : warning
|
||||
log_parser_stats : off
|
||||
log_planner_stats : off
|
||||
log_replication_commands : off
|
||||
log_rotation_age : 1440
|
||||
log_rotation_size : 10240
|
||||
log_statement : none
|
||||
log_statement_stats : off
|
||||
log_temp_files : -1
|
||||
log_timezone : Etc/UTC
|
||||
log_truncate_on_rotation : off
|
||||
logging_collector : off
|
||||
maintenance_work_mem : 65536
|
||||
max_connections : 100
|
||||
max_files_per_process : 1000
|
||||
max_function_args : 100
|
||||
max_identifier_length : 63
|
||||
max_index_keys : 32
|
||||
max_locks_per_transaction : 64
|
||||
max_parallel_workers_per_gather : 0
|
||||
max_pred_locks_per_transaction : 64
|
||||
max_prepared_transactions : 0
|
||||
max_replication_slots : 0
|
||||
max_stack_depth : 2048
|
||||
max_standby_archive_delay : 30000
|
||||
max_standby_streaming_delay : 30000
|
||||
max_wal_senders : 0
|
||||
max_wal_size : 64
|
||||
max_worker_processes : 8
|
||||
min_parallel_relation_size : 1024
|
||||
min_wal_size : 5
|
||||
old_snapshot_threshold : -1
|
||||
operator_precedence_warning : off
|
||||
parallel_setup_cost : 1000
|
||||
parallel_tuple_cost : 0.1
|
||||
password_encryption : on
|
||||
port : 5432
|
||||
post_auth_delay : 0
|
||||
pre_auth_delay : 0
|
||||
quote_all_identifiers : off
|
||||
random_page_cost : 4
|
||||
replacement_sort_tuples : 150000
|
||||
restart_after_crash : on
|
||||
row_security : on
|
||||
search_path : "$user", public
|
||||
segment_size : 131072
|
||||
seq_page_cost : 1
|
||||
server_encoding : UTF8
|
||||
server_version : 9.6.17
|
||||
server_version_num : 90617
|
||||
session_preload_libraries :
|
||||
session_replication_role : origin
|
||||
shared_buffers : 16384
|
||||
shared_preload_libraries :
|
||||
sql_inheritance : on
|
||||
ssl : off
|
||||
ssl_ca_file :
|
||||
ssl_cert_file : server.crt
|
||||
ssl_ciphers : HIGH:MEDIUM:+3DES:!aNULL
|
||||
ssl_crl_file :
|
||||
ssl_ecdh_curve : prime256v1
|
||||
ssl_key_file : server.key
|
||||
ssl_prefer_server_ciphers : on
|
||||
standard_conforming_strings : on
|
||||
statement_timeout : 0
|
||||
stats_temp_directory : pg_stat_tmp
|
||||
superuser_reserved_connections : 3
|
||||
synchronize_seqscans : on
|
||||
synchronous_commit : on
|
||||
synchronous_standby_names :
|
||||
syslog_facility : local0
|
||||
syslog_ident : postgres
|
||||
syslog_sequence_numbers : on
|
||||
syslog_split_messages : on
|
||||
tcp_keepalives_count : 9
|
||||
tcp_keepalives_idle : 7200
|
||||
tcp_keepalives_interval : 75
|
||||
temp_buffers : 1024
|
||||
temp_file_limit : -1
|
||||
temp_tablespaces :
|
||||
TimeZone : Etc/UTC
|
||||
timezone_abbreviations : Default
|
||||
trace_notify : off
|
||||
trace_recovery_messages : log
|
||||
trace_sort : off
|
||||
track_activities : on
|
||||
track_activity_query_size : 1024
|
||||
track_commit_timestamp : off
|
||||
track_counts : on
|
||||
track_functions : none
|
||||
track_io_timing : off
|
||||
transaction_deferrable : off
|
||||
transaction_isolation : read committed
|
||||
transaction_read_only : off
|
||||
transform_null_equals : off
|
||||
unix_socket_directories : /var/run/postgresql
|
||||
unix_socket_group :
|
||||
unix_socket_permissions : 0777
|
||||
update_process_title : on
|
||||
vacuum_cost_delay : 0
|
||||
vacuum_cost_limit : 200
|
||||
vacuum_cost_page_dirty : 20
|
||||
vacuum_cost_page_hit : 1
|
||||
vacuum_cost_page_miss : 10
|
||||
vacuum_defer_cleanup_age : 0
|
||||
vacuum_freeze_min_age : 50000000
|
||||
vacuum_freeze_table_age : 150000000
|
||||
vacuum_multixact_freeze_min_age : 5000000
|
||||
vacuum_multixact_freeze_table_age : 150000000
|
||||
wal_block_size : 8192
|
||||
wal_buffers : 512
|
||||
wal_compression : off
|
||||
wal_keep_segments : 0
|
||||
wal_level : minimal
|
||||
wal_log_hints : off
|
||||
wal_receiver_status_interval : 10
|
||||
wal_receiver_timeout : 60000
|
||||
wal_retrieve_retry_interval : 5000
|
||||
wal_segment_size : 2048
|
||||
wal_sender_timeout : 60000
|
||||
wal_sync_method : fdatasync
|
||||
wal_writer_delay : 200
|
||||
wal_writer_flush_after : 128
|
||||
work_mem : 4096
|
||||
xmlbinary : base64
|
||||
xmloption : content
|
||||
zero_damaged_pages : off
|
||||
|
||||
##### --- Processes start up command --- ####
|
||||
No postgres process found
|
||||
|
||||
Minimum auth role
|
||||
^^^^^^^^^^^^^^^^^
|
||||
|
||||
This program needs to run some commands like ``getShardMap`` and to be able to run those commands
|
||||
it needs to run under a user with the ``clusterAdmin`` or ``root`` built-in roles.
|
@@ -18,10 +18,10 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
Build string = "01-01-1980" //nolint
|
||||
Build string = "2020-04-23" //nolint
|
||||
Commit string //nolint
|
||||
GoVersion string = "1.8" //nolint
|
||||
Version string = "3.0.1" //nolint
|
||||
GoVersion string = "1.14.1" //nolint
|
||||
Version string = "3.2.0" //nolint
|
||||
)
|
||||
|
||||
type connOpts struct {
|
||||
|
@@ -84,9 +84,9 @@ var (
|
||||
"pt-mysql-summary --host=$mysql-host --port=$mysql-port --user=$mysql-user --password=$mysql-pass",
|
||||
}
|
||||
|
||||
Build string = "01-01-1980" //nolint
|
||||
GoVersion string = "1.8" //nolint
|
||||
Version string = "3.0.1" //nolint
|
||||
Build string = "2020-04-23" //nolint
|
||||
GoVersion string = "1.14.1" //nolint
|
||||
Version string = "3.2.0" //nolint
|
||||
Commit string //nolint
|
||||
)
|
||||
|
||||
|
@@ -51,6 +51,7 @@ ok(
|
||||
);
|
||||
|
||||
SKIP: {
|
||||
skip "Skipping in MySQL 8.0.4-rc since there is an error in the server itself. See https://bugs.mysql.com/bug.php?id=89441", 9 if ($sandbox_version ge '8.0');
|
||||
($output, $exit_status) = full_output(
|
||||
sub { pt_online_schema_change::main(@args,
|
||||
"$master_dsn,D=issue26211,t=process_model_inst",
|
||||
|
80
t/pt-online-schema-change/pt-1853.t
Normal file
80
t/pt-online-schema-change/pt-1853.t
Normal file
@@ -0,0 +1,80 @@
|
||||
#!/usr/bin/env perl
|
||||
|
||||
BEGIN {
|
||||
die "The PERCONA_TOOLKIT_BRANCH environment variable is not set.\n"
|
||||
unless $ENV{PERCONA_TOOLKIT_BRANCH} && -d $ENV{PERCONA_TOOLKIT_BRANCH};
|
||||
unshift @INC, "$ENV{PERCONA_TOOLKIT_BRANCH}/lib";
|
||||
};
|
||||
|
||||
use strict;
|
||||
use warnings FATAL => 'all';
|
||||
use threads;
|
||||
use threads::shared;
|
||||
use Thread::Semaphore;
|
||||
|
||||
use English qw(-no_match_vars);
|
||||
use Test::More;
|
||||
|
||||
use Data::Dumper;
|
||||
use PerconaTest;
|
||||
use Sandbox;
|
||||
use SqlModes;
|
||||
use File::Temp qw/ tempdir /;
|
||||
|
||||
require "$trunk/bin/pt-online-schema-change";
|
||||
|
||||
plan tests => 3;
|
||||
|
||||
my $dp = new DSNParser(opts=>$dsn_opts);
|
||||
my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp);
|
||||
my $master_dbh = $sb->get_dbh_for("master");
|
||||
my $master_dsn = $sb->dsn_for("master");
|
||||
|
||||
# The sandbox servers run with lock_wait_timeout=3 and it's not dynamic
|
||||
# so we need to specify --set-vars innodb_lock_wait_timeout=3 else the
|
||||
# tool will die.
|
||||
my @args = (qw(--set-vars innodb_lock_wait_timeout=3));
|
||||
my $output;
|
||||
my $exit_status;
|
||||
|
||||
$sb->load_file('master', "t/pt-online-schema-change/samples/pt-1853.sql");
|
||||
|
||||
($output, $exit_status) = full_output(
|
||||
sub { pt_online_schema_change::main(@args, "$master_dsn,D=test,t=jointit",
|
||||
'--execute',
|
||||
'--alter', "engine=innodb",
|
||||
'--alter-foreign-keys-method', 'rebuild_constraints'
|
||||
),
|
||||
},
|
||||
stderr => 1,
|
||||
);
|
||||
|
||||
isnt(
|
||||
$exit_status,
|
||||
0,
|
||||
"PT-1853, there are self-referencing FKs -> exit status != 0",
|
||||
);
|
||||
|
||||
($output, $exit_status) = full_output(
|
||||
sub { pt_online_schema_change::main(@args, "$master_dsn,D=test,t=jointit",
|
||||
'--execute',
|
||||
'--alter', "engine=innodb",
|
||||
'--alter-foreign-keys-method', 'rebuild_constraints',
|
||||
'--no-check-foreign-keys'
|
||||
),
|
||||
},
|
||||
stderr => 1,
|
||||
);
|
||||
|
||||
isnt(
|
||||
$exit_status,
|
||||
0,
|
||||
"PT-1853, there are self-referencing FKs but --no-check-foreign-keys was specified -> exit status = 0",
|
||||
);
|
||||
|
||||
# #############################################################################
|
||||
# Done.
|
||||
# #############################################################################
|
||||
$sb->wipe_clean($master_dbh);
|
||||
ok($sb->ok(), "Sandbox servers") or BAIL_OUT(__FILE__ . " broke the sandbox");
|
||||
done_testing;
|
@@ -23,6 +23,10 @@ my $master_dbh = $sb->get_dbh_for('master');
|
||||
|
||||
my $vp = VersionParser->new($master_dbh);
|
||||
|
||||
if ($vp->cmp('8.0.14') > -1 && $vp->flavor() !~ m/maria/i) {
|
||||
plan skip_all => 'Cannot run this test under the current MySQL version';
|
||||
}
|
||||
|
||||
if ( !$master_dbh ) {
|
||||
plan skip_all => 'Cannot connect to sandbox master';
|
||||
}
|
||||
|
@@ -32,7 +32,6 @@ my $master_dsn = 'h=127.1,P=12345,u=msandbox,p=msandbox';
|
||||
my @args = (qw(--set-vars innodb_lock_wait_timeout=3 --alter-foreign-keys-method rebuild_constraints));
|
||||
my $output;
|
||||
my $exit_status;
|
||||
my $sample = "t/pt-online-schema-change/samples/";
|
||||
|
||||
# ############################################################################
|
||||
# https://bugs.launchpad.net/percona-toolkit/+bug/1632522
|
||||
@@ -40,7 +39,7 @@ my $sample = "t/pt-online-schema-change/samples/";
|
||||
# ############################################################################
|
||||
|
||||
diag("Before loading sql");
|
||||
$sb->load_file('master', "$sample/bug-1632522.sql");
|
||||
$sb->load_file('master', "t/pt-online-schema-change/samples/bug-1632522.sql");
|
||||
diag("after loading sql");
|
||||
|
||||
# run once: we expect the constraint name to be appended with one underscore
|
||||
@@ -52,12 +51,20 @@ diag("after loading sql");
|
||||
qw(--execute)) },
|
||||
);
|
||||
|
||||
my $constraints = $master_dbh->selectall_arrayref("SELECT TABLE_NAME, CONSTRAINT_NAME FROM information_schema.KEY_COLUMN_USAGE WHERE table_schema='bug1632522' and (TABLE_NAME='test_table' OR TABLE_NAME='person') and CONSTRAINT_NAME LIKE '%fk_%' ORDER BY TABLE_NAME, CONSTRAINT_NAME");
|
||||
my $query = <<"END";
|
||||
SELECT TABLE_NAME, CONSTRAINT_NAME
|
||||
FROM information_schema.KEY_COLUMN_USAGE
|
||||
WHERE table_schema='bug1632522'
|
||||
AND (TABLE_NAME='test_table' OR TABLE_NAME='person')
|
||||
AND CONSTRAINT_NAME LIKE '%fk_%'
|
||||
ORDER BY TABLE_NAME, CONSTRAINT_NAME
|
||||
END
|
||||
my $constraints = $master_dbh->selectall_arrayref($query);
|
||||
|
||||
is_deeply(
|
||||
$constraints,
|
||||
[
|
||||
['person', '_fk_testId'],
|
||||
['person', 'fk_testId'],
|
||||
['test_table', 'fk_person'],
|
||||
['test_table', 'fk_refId'],
|
||||
],
|
||||
@@ -73,13 +80,21 @@ is_deeply(
|
||||
qw(--execute)) },
|
||||
);
|
||||
|
||||
$constraints = $master_dbh->selectall_arrayref("SELECT TABLE_NAME, CONSTRAINT_NAME FROM information_schema.KEY_COLUMN_USAGE WHERE table_schema='bug1632522' and (TABLE_NAME='test_table' OR TABLE_NAME='person') and CONSTRAINT_NAME LIKE '%fk_%' ORDER BY TABLE_NAME, CONSTRAINT_NAME");
|
||||
$query = <<"END";
|
||||
SELECT TABLE_NAME, CONSTRAINT_NAME
|
||||
FROM information_schema.KEY_COLUMN_USAGE
|
||||
WHERE table_schema='bug1632522'
|
||||
AND (TABLE_NAME='test_table' OR TABLE_NAME='person')
|
||||
AND CONSTRAINT_NAME LIKE '%fk_%'
|
||||
ORDER BY TABLE_NAME, CONSTRAINT_NAME
|
||||
END
|
||||
$constraints = $master_dbh->selectall_arrayref($query);
|
||||
|
||||
|
||||
is_deeply(
|
||||
$constraints,
|
||||
[
|
||||
['person', '_fk_testId'],
|
||||
['person', 'fk_testId'],
|
||||
['test_table', 'fk_person'],
|
||||
['test_table', 'fk_refId'],
|
||||
],
|
||||
@@ -94,13 +109,21 @@ is_deeply(
|
||||
qw(--execute)) },
|
||||
);
|
||||
|
||||
$constraints = $master_dbh->selectall_arrayref("SELECT TABLE_NAME, CONSTRAINT_NAME FROM information_schema.KEY_COLUMN_USAGE WHERE table_schema='bug1632522' and (TABLE_NAME='test_table' OR TABLE_NAME='person') and CONSTRAINT_NAME LIKE '%fk_%' ORDER BY TABLE_NAME, CONSTRAINT_NAME");
|
||||
$query = <<"END";
|
||||
SELECT TABLE_NAME, CONSTRAINT_NAME
|
||||
FROM information_schema.KEY_COLUMN_USAGE
|
||||
WHERE table_schema='bug1632522'
|
||||
and (TABLE_NAME='test_table' OR TABLE_NAME='person')
|
||||
and CONSTRAINT_NAME LIKE '%fk_%'
|
||||
ORDER BY TABLE_NAME, CONSTRAINT_NAME
|
||||
END
|
||||
$constraints = $master_dbh->selectall_arrayref($query);
|
||||
|
||||
|
||||
is_deeply(
|
||||
$constraints,
|
||||
[
|
||||
['person', '_fk_testId'],
|
||||
['person', 'fk_testId'],
|
||||
['test_table', 'fk_person'],
|
||||
['test_table', 'fk_refId'],
|
||||
],
|
||||
|
@@ -0,0 +1,140 @@
|
||||
#!/usr/bin/env perl
|
||||
|
||||
BEGIN {
|
||||
die "The PERCONA_TOOLKIT_BRANCH environment variable is not set.\n"
|
||||
unless $ENV{PERCONA_TOOLKIT_BRANCH} && -d $ENV{PERCONA_TOOLKIT_BRANCH};
|
||||
unshift @INC, "$ENV{PERCONA_TOOLKIT_BRANCH}/lib";
|
||||
};
|
||||
|
||||
use strict;
|
||||
use warnings FATAL => 'all';
|
||||
use English qw(-no_match_vars);
|
||||
use Test::More;
|
||||
|
||||
use Data::Dumper;
|
||||
use PerconaTest;
|
||||
use Sandbox;
|
||||
|
||||
require "$trunk/bin/pt-online-schema-change";
|
||||
|
||||
my $dp = new DSNParser(opts=>$dsn_opts);
|
||||
my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp);
|
||||
my $master_dbh = $sb->get_dbh_for('master');
|
||||
|
||||
if ( !$master_dbh ) {
|
||||
plan skip_all => 'Cannot connect to sandbox master';
|
||||
}
|
||||
|
||||
# The sandbox servers run with lock_wait_timeout=3 and it's not dynamic
|
||||
# so we need to specify --set-vars innodb_lock_wait_timeout-3 else the
|
||||
# tool will die.
|
||||
my $master_dsn = 'h=127.1,P=12345,u=msandbox,p=msandbox';
|
||||
my @args = (qw(--set-vars innodb_lock_wait_timeout=3 --alter-foreign-keys-method rebuild_constraints));
|
||||
my $output;
|
||||
my $exit_status;
|
||||
|
||||
# ############################################################################
|
||||
# https://bugs.launchpad.net/percona-toolkit/+bug/1632522
|
||||
# pt-online-schema-change fails with duplicate key in table for self-referencing FK
|
||||
# ############################################################################
|
||||
|
||||
diag("Before loading sql");
|
||||
$sb->load_file('master', "t/pt-online-schema-change/samples/bug-1632522.sql");
|
||||
diag("after loading sql");
|
||||
|
||||
# run once: we expect the constraint name to be appended with one underscore
|
||||
# but the self-referencing constraint will have 2 underscore
|
||||
($output, $exit_status) = full_output(
|
||||
sub { pt_online_schema_change::main(@args,
|
||||
"$master_dsn,D=bug1632522,t=test_table",
|
||||
"--alter", "ENGINE=InnoDB",
|
||||
qw(--execute)) },
|
||||
);
|
||||
|
||||
my $query = <<"END";
|
||||
SELECT TABLE_NAME, CONSTRAINT_NAME
|
||||
FROM information_schema.KEY_COLUMN_USAGE
|
||||
WHERE table_schema='bug1632522'
|
||||
AND (TABLE_NAME='test_table' OR TABLE_NAME='person')
|
||||
AND CONSTRAINT_NAME LIKE '%fk_%'
|
||||
ORDER BY TABLE_NAME, CONSTRAINT_NAME
|
||||
END
|
||||
my $constraints = $master_dbh->selectall_arrayref($query);
|
||||
my @constraints = sort { @$a[0].@$a[1] cmp @$b[0].@$b[1] } @$constraints;
|
||||
|
||||
is_deeply(
|
||||
$constraints,
|
||||
[
|
||||
['person', 'fk_testId'],
|
||||
['test_table', 'fk_person'],
|
||||
['test_table', 'fk_refId'],
|
||||
],
|
||||
"First run adds or removes underscore from constraint names, accordingly"
|
||||
);
|
||||
|
||||
# run second time: we expect constraint names to be prefixed with one underscore
|
||||
# if they havre't one, and to remove 2 if they have 2
|
||||
($output, $exit_status) = full_output(
|
||||
sub { pt_online_schema_change::main(@args,
|
||||
"$master_dsn,D=bug1632522,t=test_table",
|
||||
"--alter", "ENGINE=InnoDB",
|
||||
qw(--execute)) },
|
||||
);
|
||||
|
||||
$query = <<"END";
|
||||
SELECT TABLE_NAME, CONSTRAINT_NAME
|
||||
FROM information_schema.KEY_COLUMN_USAGE
|
||||
WHERE table_schema='bug1632522'
|
||||
AND (TABLE_NAME='test_table' OR TABLE_NAME='person')
|
||||
AND CONSTRAINT_NAME LIKE '%fk_%'
|
||||
ORDER BY TABLE_NAME, CONSTRAINT_NAME
|
||||
END
|
||||
$constraints = $master_dbh->selectall_arrayref($query);
|
||||
|
||||
@constraints = sort { @$a[0].@$a[1] cmp @$b[0].@$b[1] } @$constraints;
|
||||
|
||||
is_deeply(
|
||||
\@constraints,
|
||||
[
|
||||
['person', 'fk_testId'],
|
||||
['test_table', 'fk_person'],
|
||||
['test_table', 'fk_refId'],
|
||||
],
|
||||
"Second run self-referencing will be one due to rebuild_constraints"
|
||||
);
|
||||
|
||||
# run third time: we expect constraints to be the same as we started (toggled back)
|
||||
($output, $exit_status) = full_output(
|
||||
sub { pt_online_schema_change::main(@args,
|
||||
"$master_dsn,D=bug1632522,t=test_table",
|
||||
"--alter", "ENGINE=InnoDB",
|
||||
qw(--execute)) },
|
||||
);
|
||||
|
||||
$query = <<"END";
|
||||
SELECT TABLE_NAME, CONSTRAINT_NAME
|
||||
FROM information_schema.KEY_COLUMN_USAGE
|
||||
WHERE table_schema='bug1632522'
|
||||
and (TABLE_NAME='test_table' OR TABLE_NAME='person')
|
||||
and CONSTRAINT_NAME LIKE '%fk_%'
|
||||
ORDER BY TABLE_NAME, CONSTRAINT_NAME
|
||||
END
|
||||
$constraints = $master_dbh->selectall_arrayref($query);
|
||||
|
||||
|
||||
is_deeply(
|
||||
$constraints,
|
||||
[
|
||||
['person', 'fk_testId'],
|
||||
['test_table', 'fk_person'],
|
||||
['test_table', 'fk_refId'],
|
||||
],
|
||||
"Third run toggles constraint names back to how they were"
|
||||
);
|
||||
|
||||
# #############################################################################
|
||||
# Done.
|
||||
# #############################################################################
|
||||
$sb->wipe_clean($master_dbh);
|
||||
ok($sb->ok(), "Sandbox servers") or BAIL_OUT(__FILE__ . " broke the sandbox");
|
||||
done_testing;
|
9
t/pt-online-schema-change/samples/pt-1802.sql
Normal file
9
t/pt-online-schema-change/samples/pt-1802.sql
Normal file
@@ -0,0 +1,9 @@
|
||||
CREATE TABLE `joinit` (
|
||||
`i` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`s` varchar(64) DEFAULT NULL,
|
||||
`t` time NOT NULL,
|
||||
`g` int(11) NOT NULL,
|
||||
`j` int(11) NOT NULL DEFAULT 1,
|
||||
PRIMARY KEY (`i`))
|
||||
ENGINE=InnoDB;
|
||||
ALTER TABLE joinit ADD FOREIGN KEY i_fk (j) REFERENCES joinit (i) ON UPDATE cascade ON DELETE restrict;
|
19
t/pt-online-schema-change/samples/pt-1853.sql
Normal file
19
t/pt-online-schema-change/samples/pt-1853.sql
Normal file
@@ -0,0 +1,19 @@
|
||||
DROP DATABASE IF EXISTS test;
|
||||
CREATE DATABASE test;
|
||||
|
||||
USE test;
|
||||
|
||||
CREATE TABLE t1 (
|
||||
id int,
|
||||
f1 int
|
||||
);
|
||||
|
||||
CREATE TABLE `joinit` (
|
||||
`i` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`s` varchar(64) DEFAULT NULL,
|
||||
`t` time NOT NULL,
|
||||
`g` int(11) NOT NULL,
|
||||
`j` int(11) NOT NULL DEFAULT 1,
|
||||
PRIMARY KEY (`i`))
|
||||
ENGINE=InnoDB;
|
||||
ALTER TABLE joinit ADD FOREIGN KEY i_fk (j) REFERENCES joinit (i) ON UPDATE cascade ON DELETE restrict;
|
Reference in New Issue
Block a user