From 8343f6b1f7dd9eb09fb6019d6052e32d4680b99d Mon Sep 17 00:00:00 2001 From: Daniel Nichter Date: Fri, 30 Nov 2012 18:34:14 +0000 Subject: [PATCH] Conditionalize dest.t for PXC. --- t/pt-archiver/dest.t | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/t/pt-archiver/dest.t b/t/pt-archiver/dest.t index 31e24a58..9de5693c 100644 --- a/t/pt-archiver/dest.t +++ b/t/pt-archiver/dest.t @@ -54,14 +54,33 @@ ok(scalar @$rows == 0, 'Purged all rows ok'); # This test has been changed. I manually examined the tables before # and after the archive operation and I am convinced that the original # expected output was incorrect. -$rows = $dbh->selectall_arrayref("select * from test.table_2", { Slice => {}}); -is_deeply( - $rows, - [ { a => '1', b => '2', c => '3', d => undef }, +my ($sql, $expect_rows); +if ( $sb->is_cluster_node('master') ) { + # PXC nodes have auto-inc offsets, so rather than see what they are + # and account for them, we just don't select the auto-inc col, a. + # This test is really about b, c, and d anyway. + $sql = "SELECT b, c, d FROM test.table_2 ORDER BY a"; + $expect_rows = [ + { b => '2', c => '3', d => undef }, + { b => undef, c => '3', d => undef }, + { b => '2', c => '3', d => undef }, + { b => '2', c => '3', d => undef }, + ]; +} +else { + # The original, non-PXC values. + $sql = "SELECT * FROM test.table_2 ORDER BY a"; + $expect_rows = [ + { a => '1', b => '2', c => '3', d => undef }, { a => '2', b => undef, c => '3', d => undef }, { a => '3', b => '2', c => '3', d => undef }, { a => '4', b => '2', c => '3', d => undef }, - ], + ]; +} +$rows = $dbh->selectall_arrayref($sql, { Slice => {}}); +is_deeply( + $rows, + $expect_rows, 'Found rows in new table OK when archiving only some columns to another table') or diag(Dumper($rows)); # Archive to another table with autocommit