From b4ac841421c9063635a5584dd83e48d0eb7097ce Mon Sep 17 00:00:00 2001 From: Carlos Salguero Date: Thu, 16 Nov 2017 16:11:52 -0300 Subject: [PATCH] PT-204 Added RocksDB to the list of ignored engines --- bin/pt-table-checksum | 6 +++ sandbox/start-sandbox | 7 +++ t/pt-table-checksum/pt-204.t | 71 ++++++++++++++++++++++++++ t/pt-table-checksum/samples/pt-204.sql | 15 ++++++ 4 files changed, 99 insertions(+) create mode 100644 t/pt-table-checksum/pt-204.t create mode 100644 t/pt-table-checksum/samples/pt-204.sql diff --git a/bin/pt-table-checksum b/bin/pt-table-checksum index 87c5d7bb..373b0ac7 100755 --- a/bin/pt-table-checksum +++ b/bin/pt-table-checksum @@ -12004,6 +12004,12 @@ The tool warns when it detects this setup to remind you that it only works when used as described above. These warnings do not affect the exit status of the tool; they're only reminders to help avoid false-positive results. +=item RocksDB support + +Due to the limitations in the RocksDB engine like not suporting binlog_format=STATEMENT +or they way RocksDB handles Gap locks, pt-table-cheksum will skip tables using RocksDB engine. +More Information: (L) + =back =head1 OUTPUT diff --git a/sandbox/start-sandbox b/sandbox/start-sandbox index 7246df8f..f11702b2 100755 --- a/sandbox/start-sandbox +++ b/sandbox/start-sandbox @@ -174,6 +174,13 @@ make_sandbox() { /tmp/$port/use -e "start slave" fi + if [ -x "$PERCONA_TOOLKIT_SANDBOX/bin/ps-admin" ]; then + # try to enable RocksDB. Only available on Percona Server 5.7.19+ + if [ "$version" ">" "5.6" ]; then + $PERCONA_TOOLKIT_SANDBOX/bin/ps-admin --enable-rocksdb -u root -pmsandbox -h 127.1 -P $port + fi + fi + return 0 } diff --git a/t/pt-table-checksum/pt-204.t b/t/pt-table-checksum/pt-204.t new file mode 100644 index 00000000..b44b74ec --- /dev/null +++ b/t/pt-table-checksum/pt-204.t @@ -0,0 +1,71 @@ +#!/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 PerconaTest; +use Sandbox; +use SqlModes; +require "$trunk/bin/pt-table-checksum"; + +my $dp = new DSNParser(opts=>$dsn_opts); +my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp); +my $dbh = $sb->get_dbh_for('master'); + +if ( !$dbh ) { + plan skip_all => 'Cannot connect to sandbox master'; +} +else { + plan tests => 4; +} + +$sb->load_file('master', 't/pt-table-checksum/samples/pt-204.sql'); + +# 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. +# And --max-load "" prevents waiting for status variables. +my $master_dsn = $sb->dsn_for('master'); +my @args = ($master_dsn, "--set-vars", "innodb_lock_wait_timeout=50", + "--no-check-binlog-format"); +my $output; +my $exit_status; + +# Test #1 +$output = output( + sub { $exit_status = pt_table_checksum::main(@args) }, + stderr => 1, +); + +is( + $exit_status, + 0, + "PT-204 use single backtick in comments", +); + +unlike( + $output, + qr/test\.t1/, + "PT-204 table t1 was skipped (RocksDB)", +); + +like( + $output, + qr/test\.t2/, + "PT-204 table t2 was checksumed (InnoDB)", +); + + +# ############################################################################# +# Done. +# ############################################################################# +$sb->wipe_clean($dbh); +ok($sb->ok(), "Sandbox servers") or BAIL_OUT(__FILE__ . " broke the sandbox"); +exit; diff --git a/t/pt-table-checksum/samples/pt-204.sql b/t/pt-table-checksum/samples/pt-204.sql new file mode 100644 index 00000000..c56c70ef --- /dev/null +++ b/t/pt-table-checksum/samples/pt-204.sql @@ -0,0 +1,15 @@ +DROP DATABASE IF EXISTS test; +CREATE DATABASE test; +USE test; + +CREATE TABLE t1 ( + id INT AUTO_INCREMENT PRIMARY KEY, + f2 VARCHAR(30), + f3 TIMESTAMP +) Engine=RocksDB; + +CREATE TABLE t2 ( + id INT AUTO_INCREMENT PRIMARY KEY, + f2 VARCHAR(30), + f3 TIMESTAMP +) Engine=InnoDB;