# Pt-online-schema-change Missing "Create Table" Retry Option

**URL:** https://forums.percona.com/t/pt-online-schema-change-missing-create-table-retry-option/26696
**Category:** Percona Toolkit
**Tags:** percona
**Created:** [November 21, 2023, 5:57pm UTC](https://forums.percona.com/t/pt-online-schema-change-missing-create-table-retry-option/26696 "2023-11-21T17:57:49Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![brianestrada658](https://avatars.discourse-cdn.com/v4/letter/b/839c29/32.png) [@brianestrada658](https://forums.percona.com/u/brianestrada658)
#### Post date: [November 21, 2023, 5:57pm UTC](https://forums.percona.com/t/pt-online-schema-change-missing-create-table-retry-option/26696/1 "2023-11-21T17:57:50Z")

</div>

When running pt-osc on version 3.5.1 on MySQL 8.0.28, I usually encounter a metadata lock like this:

```auto
CREATE TABLE `test`.`_test_new` ( ...

```

And I get an error like this:

```auto
	(in cleanup) DBD::mysql::db do failed: Lock wait timeout exceeded; try restarting transaction [for Statement "CREATE TABLE `test`.`_test_new` (

```

This is the pt-osc that I run:

```auto
pt-online-schema-change \
       --user=root \
       --password=XXX \
       --alter "..." \
       --alter-foreign-keys-method=auto \
       --max-load Threads_running=50 \
       --critical-load Threads_running=200 \
       --nocheck-unique-key-change \
       --nocheck-foreign-keys \
       --print \
       --progress=time,10 \
       --set-vars lock_wait_timeout=5 \
       --tries=create_triggers:200:1,drop_triggers:200:1,swap_tables:200:1,update_foreign_keys:200:1,analyze_table:200:1 \
       D=test,t=test,h=127.0.0.1 \
       --execute

```

Note this table has a foreign key.

In [pt-online-schema-change — Percona Toolkit Documentation](https://docs.percona.com/percona-toolkit/pt-online-schema-change.html) version 3.5.1, the --tries option only allows the following operations:

```auto
OPERATION TRIES WAIT
=================== ===== ====
create_triggers 10 1
drop_triggers 10 1
copy_rows 10 0.25
swap_tables 10 1
update_foreign_keys 10 1
analyze_table 10 1

```

I use the `--tries` option to get around the metadata lock but I noticed that it does not have an option to try if it fails to create the new table. Am I missing something?

If there is no option to retry the creation of the new table, what do you recommend so that pt-osc can just wait if the transaction that causes the metadata lock is done?

---

<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: [November 21, 2023, 6:59pm UTC](https://forums.percona.com/t/pt-online-schema-change-missing-create-table-retry-option/26696/2 "2023-11-21T18:59:20Z")

</div>

You can increase the lock\_wait\_timeout, but that might also affect other transactions.

---

<div class="post-metadata">

### Author: ![brianestrada658](https://avatars.discourse-cdn.com/v4/letter/b/839c29/32.png) [@brianestrada658](https://forums.percona.com/u/brianestrada658)
#### Post date: [November 21, 2023, 9:02pm UTC](https://forums.percona.com/t/pt-online-schema-change-missing-create-table-retry-option/26696/3 "2023-11-21T21:02:28Z")

</div>

So I am actually lowering this value so that I can use this in conjunction with `--tries` option. What I want is if the create table statement fails, just retry it…
