# Not able to alter the table using pt-osc

**URL:** <https://forums.percona.com/t/not-able-to-alter-the-table-using-pt-osc/10589>\
**Category:** Percona Server for MySQL 8.0\
**Created:** [May 25, 2021, 8:55am UTC](https://forums.percona.com/t/not-able-to-alter-the-table-using-pt-osc/10589 "2021-05-25T08:55:55Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![robingaur](https://avatars.discourse-cdn.com/v4/letter/r/e56c9b/32.png) [@robingaur](https://forums.percona.com/u/robingaur)\
**Post date:** [May 25, 2021, 8:55am UTC](https://forums.percona.com/t/not-able-to-alter-the-table-using-pt-osc/10589/1 "2021-05-25T08:55:55Z")

</div>

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` (  
> `id` bigint NOT NULL AUTO\_INCREMENT,  
> `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’,  
> PRIMARY KEY (`id`),  
> UNIQUE KEY `uuid_UNIQUE` (`uuid`),  
> KEY `username_INDEX` (`username`),  
> KEY `random_INDEX` (`randomString2`,`randomInt`)  
> ) ENGINE=InnoDB AUTO\_INCREMENT=12 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4\_0900\_ai\_ci

---

<div class="post-metadata">

**Author:** ![matthewb](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/matthewb/32/34_2.png) [@matthewb](https://forums.percona.com/u/matthewb)\
**Post date:** [May 25, 2021, 1:05pm UTC](https://forums.percona.com/t/not-able-to-alter-the-table-using-pt-osc/10589/2 "2021-05-25T13:05:01Z")

</div>

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 [https://jira.percona.com/](https://jira.percona.com/) for the Percona Toolkit.

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

---

<div class="post-metadata">

**Author:** ![matthewb](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/matthewb/32/34_2.png) [@matthewb](https://forums.percona.com/u/matthewb)\
**Post date:** [May 25, 2021, 1:08pm UTC](https://forums.percona.com/t/not-able-to-alter-the-table-using-pt-osc/10589/3 "2021-05-25T13:08:40Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![carlos.salguero](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/carlos.salguero/32/20_2.png) [@carlos.salguero](https://forums.percona.com/u/carlos.salguero)\
**Post date:** [May 25, 2021, 1:24pm UTC](https://forums.percona.com/t/not-able-to-alter-the-table-using-pt-osc/10589/4 "2021-05-25T13:24:07Z")

</div>

Hello.  
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.

Thanks

---

<div class="post-metadata">

**Author:** ![robingaur](https://avatars.discourse-cdn.com/v4/letter/r/e56c9b/32.png) [@robingaur](https://forums.percona.com/u/robingaur)\
**Post date:** [May 26, 2021, 10:37am UTC](https://forums.percona.com/t/not-able-to-alter-the-table-using-pt-osc/10589/5 "2021-05-26T10:37:27Z")

</div>

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).
