TableNibbler choosing wrong fields for composed primary key on MariaDB

Description

When working with compound primary keys on MariaDB 10, TableNibbller library fails to choose the correct fields to build chunks boundaries.

How to reproduce:

Load some data to make pt-table-checksum able to run the queries and choose boundaries.

Run pt-table-checksum:

The output contains:

Acceptance criteria

 

 

Environment

None

Smart Checklist

Activity

Show:

Carlos Salguero July 26, 2017 at 7:17 PM

Reopening just to remove the fix version

Carlos Salguero June 15, 2017 at 3:42 PM

Here is the explanation:

I've populated the table as defined in the description with 0 < f1_key < 100 and 0 < f3_key < 100.

To be able to choose the correct boundaries for the compose key, pt-table-checksum runs a query like this: (example for the second chunk using --chunck-size=100)

using these params:

As you can see, f1_id is being used in the comparison as an individual field (`f1_id` > ?) and with f3_id (`f1_id` > ?) so f1_id appears twice.
That's the reason pt-table-checksum uses 3 fields for every chunk.

 

Carlos Salguero June 15, 2017 at 12:56 AM

Reopening to run more tests

Carlos Salguero June 14, 2017 at 8:39 PM
Edited

After analyzing how it works I found that the keys and boundaries are OK.

Since the select key is compound, it is necessary to try all combinations so in the case reported, it is correct to choose f1_id twice.

 

Won't Do

Details

Assignee

Reporter

Priority

Affects versions

Reviewer

Smart Checklist

Created June 14, 2017 at 1:59 PM
Updated December 27, 2018 at 1:48 PM
Resolved July 26, 2017 at 7:17 PM