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

pt-online-schema-change fails on UK and NULLs


    • Type: Bug
    • Status: Done
    • Priority: Low
    • Resolution: Fixed
    • Affects Version/s: 3.0.10
    • Fix Version/s: 3.0.12
    • Component/s: None
    • Labels:


      pt-osc fails with the following error, when using a table with a (nullable) unique key and a row with NULL values:

      2018-06-26T14:21:48 Error copying rows from `test`.`t1` to `test`.`_t1_new`: Use of uninitialized value in string ne at ./pt-online-schema-change line 6133.
      $ pt-online-schema-change --version
      pt-online-schema-change 3.0.10


      How to repeat:

      CREATE TABLE `t1` (
      `id` int(11) DEFAULT NULL,
      `site_name` varchar(25) DEFAULT NULL,
      `last_update` datetime DEFAULT NULL,
      UNIQUE KEY `idx_id` (`id`),
      KEY `idx_last_update` (`last_update`),
      KEY `idx_site_name` (`site_name`)
      INSERT INTO `t1` VALUES (1385108873,'Carolyn Ryan','2018-01-13 17:05:24'),(2140660022,'Patricia Garza','2018-01-13 19:07:51'),(1473481373,'Rachel George','2017-12-05 21:09:53'),(1394124308,'Mrs. Ms. Miss Janet Dixon','2017-10-28 07:07:41'),(1978918050,'Louis Gray Jr. Sr. I II I','2017-11-01 22:10:39'),(1275940242,'Lois Spencer','2018-02-22 01:01:38'),(NULL,NULL,NULL);
      pt-online-schema-change --chunk-index idx_id --chunk-size 1 --nocheck-plan --execute h=,P=5713,u=root,p=msandbox,D=test,t=t1


      Full output from the run:

      pt-online-schema-change --chunk-index idx_id --chunk-size 1 --nocheck-plan --execute h=,P=5713,u=root,p=msandbox,D=test,t=t1
      No slaves found. See --recursion-method if host bm-support01 has slaves.
      Not checking slave lag because no slaves were found and --check-slave-lag was not specified.
      Operation, tries, wait:
      analyze_table, 10, 1
      copy_rows, 10, 0.25
      create_triggers, 10, 1
      drop_triggers, 10, 1
      swap_tables, 10, 1
      update_foreign_keys, 10, 1
      Altering `test`.`t1`...
      Creating new table...
      Created new table test._t1_new OK.
      2018-06-26T14:47:06 Creating triggers...
      2018-06-26T14:47:06 Created triggers OK.
      2018-06-26T14:47:06 Copying approximately 5 rows...
      2018-06-26T14:47:06 Dropping triggers...
      2018-06-26T14:47:06 Dropped triggers OK.
      2018-06-26T14:47:06 Dropping new table...
      2018-06-26T14:47:06 Dropped new table OK.
      `test`.`t1` was not altered.
      2018-06-26T14:47:06 Error copying rows from `test`.`t1` to `test`.`_t1_new`: Use of uninitialized value in string ne at ./pt-online-schema-change line 6133.

      I'll attach debug run too, in case it's needed.

      PTDEBUG=1 pt-online-schema-change --chunk-index idx_id --chunk-size 1 --nocheck-plan --execute h=,P=5713,u=root,p=msandbox,D=test,t=t1 > pt-osc.debug.out 2>&1

      An interesting thing to note is that error message changes while doing debug outputs:

      2018-06-26T14:50:50 Error copying rows from `test`.`t1` to `test`.`_t1_new`: Use of uninitialized value in join or string at ./pt-online-schema-change line 6092.

        Smart Checklist


            Issue Links



                • Assignee:
                  carlos.salguero Carlos Salguero
                  agustin.gallego Agustín Gallego
                • Votes:
                  0 Vote for this issue
                  3 Start watching this issue


                  • Created: