github / github/gh-ost

port check on @@global.port prevents execution on 1st generation GCP instances.

Open
#632 4 comments 1 reaction 0 assignees View on GitHub
Dominant language
Go
Stars
13.6k
Forks
1.4k
Avg merge
2h 31m
Merged PRs (30d)
4

Description

When executing against a gcp 1st generation sql instance gh-ost fails with the following error:

```
[root@centos1 gh-ost]# ./bin/gh-ost --user="testuser" --ask-pass --table="test_table" --database="test" --host="x.x.x.x" --alter="engine=innodb" --port="3306" --allow-on-master --execute --initially-drop-old-table --initially-drop-ghost-table --verbose --ok-to-drop-table
Password:
2018-08-29 08:55:39 INFO starting gh-ost d2726c77f86cb65e25bce5c0ac5fe3fa0c997488
2018-08-29 08:55:39 INFO Migrating `test`.`test_table`
2018-08-29 08:55:46 INFO Tearing down inspector
2018-08-29 08:55:46 FATAL Unexpected database port reported: 0
```
The value of @@global.port is checked at two points in the code:
```
[root@centos1 go]# grep -rn @@global.port *
base/utils.go:81: portQuery := `select @@global.port`
mysql/utils.go:177: err = db.QueryRow(`select @@global.hostname, @@global.port`).Scan(&instanceKey.Hostname, &instanceKey.Port)
```
the following command demonstrates the port value internal to mysql:
```
mysql> select @@global.port;
+---------------+
| @@global.port |
+---------------+
| 0 |
+---------------+
1 row in set (0.08 sec)
```
To ignore this value and use the one supplied or default to 3306 which is already being done for other cloud providers I supplied a vendor agnostic command line parameter -skip-port-check in my branch:
https://github.com/jlorberblatt/gh-ost/commit/1f7b4087f4a7c1136939427e10c93f2876809970
which I have tested and works.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.