Not able to alter the table using pt-osc

I have a Mysql percona cluster with 2 nodes and 1 arbitrator node.
I am trying to drop a column from the table using pt-online-schema-change using below command:

pt-online-schema-change u=root,p=xxx,D=database,t=table01 --alter="DROP COLUMN new_col"

But I’m getting the following error on running the command

Can't use an undefined value as an ARRAY reference at /usr/bin/pt-online-schema-change line 7684.

I’m new to pxc. I don’t know if the problem is in command or pxc configs.

Table details:

CREATE TABLE table01 (
username varchar(128) NOT NULL,
uuid varchar(64) NOT NULL,
randomString1 text NOT NULL,
randomString2 varchar(64) NOT NULL,
randomInt int NOT NULL,
status varchar(10) NOT NULL,
createdDate datetime NOT NULL,
updatedDate datetime NOT NULL,
new_col varchar(128) NOT NULL DEFAULT ‘Test’,
UNIQUE KEY uuid_UNIQUE (uuid),
KEY username_INDEX (username),
KEY random_INDEX (randomString2,randomInt)


Hi @robingaur,
This error has absolutely nothing to do with your PXC configuration. This looks like a bug in the pt-osc software. Your table and the osc command look perfectly normal so that’s why this appears to be a bug. I recommend you file a bug report at for the Percona Toolkit.

How big is this table? Would a normal alter be a workaround for now?

1 Like

Hi @robingaur,
I created your table and ran pt-osc as you have shown and it worked for me.

[root@mysql1-T1 ~]# pt-online-schema-change D=sysbench,t=table01 --alter="DROP COLUMN new_col" --execute
No slaves found.  See --recursion-method if host mysql1-T1 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 `sysbench`.`table01`...
Creating new table...
Created new table sysbench._table01_new OK.
Altering new table...
Altered `sysbench`.`_table01_new` OK.
2021-05-25T13:07:16 Creating triggers...
2021-05-25T13:07:16 Created triggers OK.
2021-05-25T13:07:16 Copying approximately 1 rows...
2021-05-25T13:07:16 Copied rows OK.
2021-05-25T13:07:16 Analyzing new table...
2021-05-25T13:07:16 Swapping tables...
2021-05-25T13:07:16 Swapped original and new tables OK.
2021-05-25T13:07:16 Dropping old table...
2021-05-25T13:07:16 Dropped old table `sysbench`.`_table01_old` OK.
2021-05-25T13:07:16 Dropping triggers...
2021-05-25T13:07:16 Dropped triggers OK.
Successfully altered `sysbench`.`table01`.

I’m using PXC 8.0.22 and Percona Toolkit 3.3.1.

1 Like

Could you try with --no-version-check and if that doesn’t work, run pt-online-schema-change again putting PTDEBUG=1 before the command to enable debug mode.


1 Like

Hello @matthewb ,

I have 2 nodes with the same configs.
On node 2, it is working fine but on node 1, it is failing with the above error. (Can't use an undefined value as an ARRAY reference at /usr/bin/pt-online-schema-change line 7684.)

Hello @carlos.salguero,
The above error is resolved after adding --no-version-check.

After enabling debug mode, I find out the exact reason

VersionCheck:7681 60202 Version check failed: Cannot open /tmp/percona-version-check: Permission denied at /usr/bin/pt-online-schema-change line 7719.

I don’t know if this is a bug or not as the same command is working in 1 node and not working in another.
PS: Both the nodes have configuration/installation (installed using AMI).