mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-27 07:54:58 +00:00
fixed pt-archiver row skipping on partitioned tables - 1376561
This commit is contained in:
@@ -5811,7 +5811,18 @@ sub main {
|
|||||||
$next_sql .= " AND $sel_stmt->{where}";
|
$next_sql .= " AND $sel_stmt->{where}";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Obtain index cols so we can order them when ascending
|
||||||
|
# this ensures returned sets are disjoint when ran on partitioned tables
|
||||||
|
# issue 1376561
|
||||||
|
my $index_cols;
|
||||||
|
if ( $sel_stmt->{index}
|
||||||
|
&& $src->{info}->{keys}->{$sel_stmt->{index}}->{cols}
|
||||||
|
) {
|
||||||
|
$index_cols = $src->{info}->{keys}->{$sel_stmt->{index}}->{colnames};
|
||||||
|
}
|
||||||
|
|
||||||
foreach my $thing ( $first_sql, $next_sql ) {
|
foreach my $thing ( $first_sql, $next_sql ) {
|
||||||
|
$thing .= " ORDER BY $index_cols " if $index_cols;
|
||||||
$thing .= " LIMIT $limit";
|
$thing .= " LIMIT $limit";
|
||||||
if ( $o->get('for-update') ) {
|
if ( $o->get('for-update') ) {
|
||||||
$thing .= ' FOR UPDATE';
|
$thing .= ' FOR UPDATE';
|
||||||
|
@@ -161,7 +161,7 @@ $output = output(
|
|||||||
my $t = time - $t0;
|
my $t = time - $t0;
|
||||||
|
|
||||||
ok(
|
ok(
|
||||||
$t >= 2 && $t <= 3.5,
|
$t >= 2 && $t <= ($ENV{PERCONA_SLOW_BOX} ? 5 : 3),
|
||||||
"--sleep between SELECT (bug 979092)"
|
"--sleep between SELECT (bug 979092)"
|
||||||
) or diag($output, "t=", $t);
|
) or diag($output, "t=", $t);
|
||||||
|
|
||||||
|
@@ -97,7 +97,7 @@ is($output, '', "No output when --no-ascend");
|
|||||||
|
|
||||||
# Check ascending only first column
|
# Check ascending only first column
|
||||||
$output = `$cmd --where 1=1 --dry-run --ascend-first --source D=test,t=table_5,F=$cnf --purge --limit 50 2>&1`;
|
$output = `$cmd --where 1=1 --dry-run --ascend-first --source D=test,t=table_5,F=$cnf --purge --limit 50 2>&1`;
|
||||||
like ( $output, qr/WHERE \(1=1\) AND \(\(`a` >= \?\)\) LIMIT/, 'Can ascend just first column');
|
like ( $output, qr/WHERE \(1=1\) AND \(\(`a` >= \?\)\) ORDER BY `a`,`b`,`c`,`d` LIMIT/, 'Can ascend just first column');
|
||||||
|
|
||||||
# #############################################################################
|
# #############################################################################
|
||||||
# Done.
|
# Done.
|
||||||
|
@@ -1,3 +1,3 @@
|
|||||||
SELECT /*!40001 SQL_NO_CACHE */ `film_id`,`title`,`description`,`release_year`,`language_id`,`original_language_id`,`rental_duration`,`rental_rate`,`length`,`replacement_cost`,`rating`,`special_features`,`last_update` FROM `sakila`.`film` FORCE INDEX(`PRIMARY`) WHERE (film_id < 100) AND (`film_id` < '1000') LIMIT 1
|
SELECT /*!40001 SQL_NO_CACHE */ `film_id`,`title`,`description`,`release_year`,`language_id`,`original_language_id`,`rental_duration`,`rental_rate`,`length`,`replacement_cost`,`rating`,`special_features`,`last_update` FROM `sakila`.`film` FORCE INDEX(`PRIMARY`) WHERE (film_id < 100) AND (`film_id` < '1000') ORDER BY `film_id` LIMIT 1
|
||||||
SELECT /*!40001 SQL_NO_CACHE */ `film_id`,`title`,`description`,`release_year`,`language_id`,`original_language_id`,`rental_duration`,`rental_rate`,`length`,`replacement_cost`,`rating`,`special_features`,`last_update` FROM `sakila`.`film` FORCE INDEX(`PRIMARY`) WHERE (film_id < 100) AND (`film_id` < '1000') AND ((`film_id` >= ?)) LIMIT 1
|
SELECT /*!40001 SQL_NO_CACHE */ `film_id`,`title`,`description`,`release_year`,`language_id`,`original_language_id`,`rental_duration`,`rental_rate`,`length`,`replacement_cost`,`rating`,`special_features`,`last_update` FROM `sakila`.`film` FORCE INDEX(`PRIMARY`) WHERE (film_id < 100) AND (`film_id` < '1000') AND ((`film_id` >= ?)) ORDER BY `film_id` LIMIT 1
|
||||||
DELETE FROM `sakila`.`film` WHERE (`film_id` = ?)
|
DELETE FROM `sakila`.`film` WHERE (`film_id` = ?)
|
||||||
|
Reference in New Issue
Block a user