pt-archiver is not able to archive all the rows when a table has a hash partition
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Percona Toolkit moved to https://jira.percona.com/projects/PT |
Fix Released
|
High
|
Frank Cizmich |
Bug Description
Tested on pt-archiver 2.2.10
CREATE TABLE t1.test_table (
`a` int(10) unsigned NOT NULL DEFAULT '0',
`b` timestamp,
PRIMARY KEY (a,b)
) ENGINE=InnoDB DEFAULT CHARSET=utf8
/*!50100 PARTITION BY HASH (a)
PARTITIONS 10 */;
Test data attached as test-data.sql
pt-archiver command:
PTDEBUG=1 pt-archiver --source h=127.0.
Query should yield no result:
select count(*) from t1.test_table where b < now() - interval 90 day;
+----------+
| count(*) |
+----------+
| 1826 |
+----------+
1 row in set (0.01 sec)
My current workaround is to use the option --no-ascend:
PTDEBUG=1 pt-archiver --source h=127.0.
mysql> select count(*) from t1.test_table where b < now() - interval 90 day;
+----------+
| count(*) |
+----------+
| 0 |
+----------+
1 row in set (0.01 sec)
Please note that I tested this with a smaller dataset of 1000 rows and I was not able to reproduce it. The test-data.sql I provided contains 9900 rows.
Related branches
- Daniel Nichter: Approve
-
Diff: 58 lines (+15/-4)4 files modifiedbin/pt-archiver (+11/-0)
t/pt-archiver/basics.t (+1/-1)
t/pt-archiver/indexes.t (+1/-1)
t/pt-archiver/samples/issue-248.txt (+2/-2)
Changed in percona-toolkit: | |
importance: | Undecided → High |
assignee: | nobody → Frank Cizmich (frank-cizmich) |
status: | New → Triaged |
Changed in percona-toolkit: | |
status: | Triaged → In Progress |
milestone: | none → 2.2.12 |
Changed in percona-toolkit: | |
status: | In Progress → Fix Committed |
Changed in percona-toolkit: | |
status: | Fix Committed → Fix Released |
There was an problem in pt-archiver which made it depend on a consistent order of selected rows.
This is usually not a problem, but it clearly manifests itself in the case of partitioned tables.
Attached is a fix for this issue. It solves all cases where tables have primary or unique indexes.