Buy Percona ServicesBuy Now!

Table is locked during pt-osc and errors copying rows

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Table is locked during pt-osc and errors copying rows

    I try to modify data type of a MySQL table using pt-osc:
    "pt-online-schema-change h=host_name,D=database_name,t=one_time_tokens,u=us er_name,p=password --alter "MODIFY COLUMN price_per_download decimal(10,2)" --execute"

    1) During the alter process, I run this command in mysql many times:
    "show open tables where in_use > 0"
    The results intermittently shows locked tables:
    Database Table In_use Name_locked
    Database_name one_time_tokens 1 0
    Database_name _one_time_tokens_new 1 0
    (sometimes it shows this table, sometimes it shows empty set)
    Does it mean that my table is still locked during table alter?

    2) The operation fails to copy rows from old table to new table. Here is the log:

    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 `database_name`.`one_time_tokens`...
    Creating new table...
    Created new table database_name._one_time_tokens_new OK.
    Altering new table...
    Altered `database_name`.`_one_time_tokens_new` OK.
    2018-12-06T13:52:31 Creating triggers...
    2018-12-06T13:52:31 Created triggers OK.
    2018-12-06T13:52:32 Copying approximately 8977540 rows...
    2018-12-06T13:53:02 Dropping triggers...
    2018-12-06T13:53:02 Dropped triggers OK.
    2018-12-06T13:53:02 Dropping new table...
    2018-12-06T13:53:03 Dropped new table OK.
    `database_name`.`one_time_tokens` was not altered.
    2018-12-06T13:53:02 Error copying rows from `database_name`.`one_time_tokens` to `database_name`.`_one_time_tokens_new`: Redundant argument in printf at /usr/bin/pt-online-schema-change line 3595 of

    Here is what is see in the line 3595 of /usr/bin/pt-online-schema-change

    printf STDERR "$name: %3d%% %s remain\n",
    $fraction * 100,
    Transformers::secs_to_time($remaining),
    Transformers::ts($eta);

    Is it an error in percona-toolkit's source code ? Or what else can be the root cause of this failure to copy?

  • #2
    Hi,

    It's seems like you are using a modified version of pt-online-schema-change.
    At lines https://github.com/percona/percona-t...ge#L3674-L3676, the code is:

    Code:
             printf STDERR "$name: %3d%% %s remain\n",
                $fraction * 100,
                Transformers::secs_to_time($remaining);
    and you have an extra parameter there.

    Regards

    Comment

    Working...
    X