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=user_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:
    [TABLE=“border: 1, cellpadding: 1, width: 500”]
    [TR]
    [TD]Database[/TD]
    [TD]Table[/TD]
    [TD]In_use[/TD]
    [TD]Name_locked[/TD]
    [/TR]
    [TR]
    [TD]Database_name[/TD]
    [TD]one_time_tokens[/TD]
    [TD]1[/TD]
    [TD]0[/TD]
    [/TR]
    [TR]
    [TD]Database_name[/TD]
    [TD]_one_time_tokens_new[/TD]
    [TD]1[/TD]
    [TD]0[/TD]
    [/TR]
    [/TABLE]

(sometimes it shows this table, sometimes it shows empty set)
Does it mean that my table is still locked during table alter?

  1. 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?

Hi,

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

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

and you have an extra parameter there.

Regards