Uploaded image for project: 'Percona Toolkit'
  1. Percona Toolkit
  2. PT-1616

pt-table-checksum fails to --resume on certain binary strings

Details

    • Bug
    • Status: Done
    • Medium
    • Resolution: Fixed
    • 3.0.11
    • 3.0.13
    • pt-table-checksum
    • None

    Description

      Create a table we will checksum like this -

       

       

      CREATE TABLE junk.pt_test_100 (id1 binary(16), id2 binary(16), PRIMARY KEY(id1, id2))  
      

      Now insert tons of data on it so that pt-table-checksum does not process it in one chunk. Inserted 100000 rows of random data.

       

      #!/bin/bash
      function s16() { 
        dd if=/dev/urandom bs=1 count=16 2>/dev/null|tr -d '[:space:]'|tr -d "'"; 
      }
      for i in {1..100000}; do { # will run for a while
        mysql -ve "INSERT INTO junk.pt_test_100 VALUES ('$(s16)', '$(s16)')"; 
      } done;
      

       

       

      Insert row with invalid utf8 char

       

      INSERT INTO junk.pt_test_100 (id1, id2) VALUES(unhex('F96DD7'), unhex('F96DD7')) 

      Make checksums table support binary strings

       

      ALTER TABLE percona.checksums MODIFY upper_boundary BLOB, MODIFY lower_boundary BLOB;

       

       

      Run the checksum (timeout must be adjusted according to performance of testbed such that only part of the table gets checksummed):

      timeout 1.5 pt-table-checksum --defaults-file=master/my.sandbox.cnf --recursion-method=dsn=D=percona,t=dsns --no-check-binlog-format --chunk-time=0.002 --chunk-size-limit=1 --empty-replicate-table

      Once checksum stops, insert an entry in percona.checksums table to make it resume from bad entry

       

      SELECT MAX(chunk) INTO @chunk FROM percona.checksums WHERE tbl='pt_test_100';
      INSERT INTO percona.checksums (db, tbl, chunk, chunk_index, lower_boundary, upper_boundary, this_crc, this_cnt, master_crc, master_cnt) VALUES ('junk', 'pt_test_100', @chunk, 'PRIMARY', unhex('F96DD72CF96DD7'), unhex('F96DD72CF96DD7'), 'crc', 1, 'crc', 1) 
      

       

      Then restart checksum with --resume

      PTDEBUG=1 pt-table-checksum --defaults-file=master/my.sandbox.cnf --recursion-method=dsn=D=percona,t=dsns --no-check-binlog-format --chunk-time=0.002 --chunk-size-limit=1 --resume > pt.dbg 2>&1

      Attachments

        Activity

          People

            carlos.salguero Carlos Salguero (Inactive)
            marcos.albe Marcos Albe
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 2 days
                2d

                Smart Checklist