Hit enter and do nothing
This error occurs in one instance of our environment, but not in the rest. This error occurs when pressing Enter does nothing and returns no error. There is no temporary table created (_xxx_gho, _xxx_ghc), I printed the log with the debug option, see the log below.
2020-08-21 16:02:51 ERROR Maximal timeout is 10sec. Timeout remains at 3
2020-08-21 16:02:51 INFO starting gh-ost 1.0.49
2020-08-21 16:02:51 INFO Migrating `aaaa`.`user_segment`
2020-08-21 16:02:51 INFO connection validated on 10.10.1.10:2321
2020-08-21 16:02:51 INFO User has SUPER, REPLICATION SLAVE privileges, and has ALL privileges on `aaaa`.*
2020-08-21 16:02:51 INFO binary logs validated on 10.10.1.10:2321
2020-08-21 16:02:51 INFO Restarting replication on 10.10.1.10:2321 to make sure binlog settings apply to replication thread
2020-08-21 16:02:51 INFO Inspector initiated on db546.add.bjyt.qihoo.net:2321, version 5.6.19-log
2020-08-21 16:02:51 INFO Table found. Engine=InnoDB
2020-08-21 16:02:51 DEBUG Estimated number of rows via STATUS: 0
There are no other logs
version 1.0.48 and 1.0.49
I experienced the exact same problem.
The line DEBUG Estimated number of rows via STATUS: 0 comes from here: https://github.com/github/gh-ost/blob/8ae02ef69c0ec886e12e4361d136f1e5a88d7552/go/logic/inspect.go#L418-L420
So we know we exited the function validateTable() with a return value of nil.
There is only 1 call-site for this function which is here: https://github.com/github/gh-ost/blob/8ae02ef69c0ec886e12e4361d136f1e5a88d7552/go/logic/inspect.go#L76
So we move onto the next statement: https://github.com/github/gh-ost/blob/8ae02ef69c0ec886e12e4361d136f1e5a88d7552/go/logic/inspect.go#L79
validateTableForeignKeys executes the following query:
SELECT
SUM(REFERENCED_TABLE_NAME IS NOT NULL AND TABLE_SCHEMA=? AND TABLE_NAME=?) as num_child_side_fk,
SUM(REFERENCED_TABLE_NAME IS NOT NULL AND REFERENCED_TABLE_SCHEMA=? AND REFERENCED_TABLE_NAME=?) as num_parent_side_fk
FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE
WHERE
REFERENCED_TABLE_NAME IS NOT NULL
AND ((TABLE_SCHEMA=? AND TABLE_NAME=?) OR (REFERENCED_TABLE_SCHEMA=? AND REFERENCED_TABLE_NAME=?))
I verified that for our database, this query takes hours to complete 😱
Luckily, we don't use foreign keys anywhere so we were able to skip this expensive query by using --skip-foreign-key-checks
After this, gh-ost just worked as expected for us. I hope this helps you debug your issue 🙇