gh-ost does not work when REPLICATE_REWRITE_DB replication filters are in use
- Dominant language
- Go
- Stars
- 13.6k
- Forks
- 1.4k
- Avg merge
- 2h 31m
- Merged PRs (30d)
- 4
Description
In mysql 5.7+ it is possible to rename the source db during replication:
`CHANGE REPLICATION FILTER REPLICATE_REWRITE_DB = ((db1, db2));`
For instance, you may have three source hosts `a`, `b` and `c`, each with a db named `main`. You might want to replicate all three in multimaster replication to a single replica, into `main_a`, `main_b` and `main_c`, respectively.
In this scenario, it is not possible to perform an alter table, since `CreateGhostTable()` will issue the statement
```
create table main.tbl_xxx like main.tbl
```
On the replica, currently `gh_ost` will either create the table in the wrong db (if `main` exists on the replica), or it will fail because `main` does not exist. `CreateGhostTable()` needs to `use` the correct database first, and then issue an unqualified `create table tbl_xxx like tbl` which will work as expected on the replica, without needing to introduce any new command line arguments.
Contributor guide
Assessment
This issue has not been assessed yet.