github / gh-ost

GitHub's Online Schema-migration Tool for MySQL
MIT License
12.26k stars 1.25k forks source link

ERROR Error 1146: Table '<db>._temp_no_ghc' doesn't exist #1432

Open rnkhouse opened 2 months ago

rnkhouse commented 2 months ago

I am using this command:

./gh-ost --azure=true --host="host" --database="db-name" --user="user" --password="password" --ssl-ca=DigiCertGlobalRootG2.crt.pem --ssl=true --ssl-allow-insecure=true --assume-rbr --allow-on-master=true --alter="ALTER TABLE temp_no ADD COLUMN tempID int NULL DEFAULT NULL"

Error:

[2024/07/09 17:19:44] [info] binlogsyncer.go:374 begin to sync binlog from position (mysql-bin.000112, 77638393)
[2024/07/09 17:19:44] [info] binlogsyncer.go:791 rotate to (mysql-bin.000112, 77638393)
# Migrating `<db>`.`temp_no`; Ghost table is `<db>`.`_temp_no_gho`
# Migration started at Tue Jul 09 17:19:43 -0400 2024
# chunk-size: 1000; max-lag-millis: 1500ms; dml-batch-size: 10; max-load: ; critical-load: ; nice-ratio: 0.000000
# throttle-additional-flag-file: /tmp/gh-ost.throttle 
# Serving on unix socket: /tmp/gh-ost.<db>.temp_no.sock
Copy: 0/0 100.0%; Applied: 0; Backlog: 0/1000; Time: 1s(total), 0s(copy); streamer: mysql-bin.000112:77643330; Lag: 0.12s, HeartbeatLag: 0.02s, State: migrating; ETA: due
Copy: 0/150 0.0%; Applied: 0; Backlog: 0/1000; Time: 1s(total), 0s(copy); streamer: mysql-bin.000112:77643330; Lag: 0.12s, HeartbeatLag: 0.02s, State: migrating; ETA: N/A
CREATE TABLE `_temp_no_gho` (
  `id` int NOT NULL AUTO_INCREMENT,
  `no` varchar(10) DEFAULT NULL,
  `status` varchar(25) NOT NULL,
  `tempID` int DEFAULT NULL,
  PRIMARY KEY (`id`)
) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB AUTO_INCREMENT=230 DEFAULT CHARSET=utf8mb3
[2024/07/09 17:19:45] [info] binlogsyncer.go:180 syncer is closing...
[2024/07/09 17:19:45] [info] binlogsyncer.go:864 kill last connection id 2090439
[2024/07/09 17:19:45] [info] binlogsyncer.go:210 syncer is closed
2024-07-09 17:19:45 ERROR Error 1146: Table '<db>._temp_no_ghc' doesn't exist
# Done
yunusuyanik commented 1 month ago

I also hit the same issue, the problem is checking wrong table name. It's creating <db>._temp_no_gho table but looking for this one '<db>._temp_no_ghc' there is a difference in last letter.

Ah, I found it, you need to specify --execute option which allow you to do real migration process, but even without it, the tool shoudn't give an error about it.

SiddiqueAhmad commented 1 month ago

we were about to leave gh-ost as we tried all ways to run the script at production but we were missing the --execute param. Thanks to pointing it out. @yunusuyanik