Merge lp:~percona-toolkit-dev/percona-toolkit/experimental-fix-1042036-remove-latin1-special-case into lp:percona-toolkit/2.1

Proposed by Brian Fraser
Status: Work in progress
Proposed branch: lp:~percona-toolkit-dev/percona-toolkit/experimental-fix-1042036-remove-latin1-special-case
Merge into: lp:percona-toolkit/2.1
Diff against target: 44 lines (+2/-27)
1 file modified
lib/TableChunker.pm (+2/-27)
To merge this branch: bzr merge lp:~percona-toolkit-dev/percona-toolkit/experimental-fix-1042036-remove-latin1-special-case
Reviewer Review Type Date Requested Status
Daniel Nichter Pending
Review via email: mp+130679@code.launchpad.net

This proposal supersedes a proposal from 2012-10-17.

Description of the change

Rebased the branch on top of trunk, so now we have a realistic diff.

To post a comment you must log in.
Revision history for this message
Daniel Nichter (daniel-nichter) wrote : Posted in a previous version of this proposal

Can we clean up this diff? There's a lot of conflicts that make it hard to review. Maybe we need to re-create the merge proposal? Or maybe the branch needs to pull in latest trunk.

review: Needs Resubmitting
Revision history for this message
Daniel Nichter (daniel-nichter) wrote :

Re our phone conversation this morning: this change would be best for 2.2 rather than 2.1 because it might introduce a (backwards-incompatible) change in behavior, which we can't do right in the middle of a stable version. Plus, the problem could never be reproduced on our end, nor has it been reported by anyone other than the original bug reporter. So we're going to hold off on this in 2.1, but 2.2 or perhaps 3.0 will revamp pt-table-sync chunking.

Unmerged revisions

420. By Brian Fraser <email address hidden>

Experimental fix to TableChunker: Don't use the built-in latin1 char range, let mysql calculate it

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/TableChunker.pm'
2--- lib/TableChunker.pm 2012-08-24 22:50:34 +0000
3+++ lib/TableChunker.pm 2012-10-20 17:59:23 +0000
4@@ -553,38 +553,13 @@
5 my $base;
6 my @chars;
7 PTDEBUG && _d("Table charset:", $args{tbl_struct}->{charset});
8- if ( ($args{tbl_struct}->{charset} || "") eq "latin1" ) {
9- # These are the unique, sorted latin1 character codes according to
10- # MySQL. You'll notice that many are missing. That's because MySQL
11- # treats many characters as the same, for example "e" and "é".
12- my @sorted_latin1_chars = (
13- 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45,
14- 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59,
15- 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73,
16- 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87,
17- 88, 89, 90, 91, 92, 93, 94, 95, 96, 123, 124, 125, 126, 161,
18- 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175,
19- 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189,
20- 190, 191, 215, 216, 222, 223, 247, 255);
21-
22- my ($first_char, $last_char);
23- for my $i ( 0..$#sorted_latin1_chars ) {
24- $first_char = $i and last if $sorted_latin1_chars[$i] >= $min_col_ord;
25- }
26- for my $i ( $first_char..$#sorted_latin1_chars ) {
27- $last_char = $i and last if $sorted_latin1_chars[$i] >= $max_col_ord;
28- };
29-
30- @chars = map { chr $_; } @sorted_latin1_chars[$first_char..$last_char];
31- $base = scalar @chars;
32- }
33- else {
34+ {
35 # If the table's charset isn't latin1, who knows what charset is being
36 # used, what characters it contains, and how those characters are sorted.
37 # So we create a character map and let MySQL tell us these things.
38
39 # Create a temp table with the same char col def as the original table.
40- my $tmp_tbl = '__maatkit_char_chunking_map';
41+ my $tmp_tbl = '__percona_char_chunking_map';
42 my $tmp_db_tbl = $q->quote($args{db}, $tmp_tbl);
43 $sql = "DROP TABLE IF EXISTS $tmp_db_tbl";
44 PTDEBUG && _d($dbh, $sql);

Subscribers

People subscribed via source and target branches