Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
When the _xxxx_gho table is queried, data may be lost. #887
Comments
|
There seems to be a corruption in the original comment. On my mobile GitHub app, I can actually see what the question is. Copy+pasting here (as is, including typos):
This situation does not happen. First, gh-ost locks the original table, then, it waits until the |
|
How to repeat :
mysql> select * from a; mysql> select * from _a_del; |
|
https://dev.mysql.com/doc/refman/8.0/en/metadata-locking.html DDL statements, LOCK TABLES, and other similar statements try to reduce the number of possible deadlocks between concurrent DDL statements by acquiring locks on explicitly named tables in name order. |
|
Sorry for accidentally closed, reopen. |
when does this statement run? In
I'm not sure what this quote means to this issue's context. Can you please clarify? |
Yes. Rename statement happened after all data sync from table In our case, there are other sessions acces to the
This is the acquiring locks order of DDL statement from MySQL manual. |
|
Thank you, I will look into it. I'm meanwhile curious: who would be reading from |
-- We met a case two days ago which cause a table lost one row after ALTER table through gh-ost. Thanks for you reply ,waiting for your review result. |
hi Shlomi-noach , is there anly update for the case please ^_^? Sorry to bother, but we look forward fix this ASAP for there is a risk of lossing data, we run gh-ost doing DDL every day。 A fix for the case above we think is just change the Thanks. |
|
Hi,
I'm not sure I will be able to provide a fix in the next few days.
I'm not sure I understand exactly what you mean. Can you please paste the code change? Better yet, if you think you have the correct solution, could you create a pull request? I'm not the owner of https://github.com/github/gh-ost and will not be able to merge any changes here. But I may merge such changes in https://github.com/openark/gh-ost |
|
I can confirm I get the same behavior as yours, but something's strange here: At first I thought this might be related to the fact your table doesn;t have a I then tries a different table structure, and I got different results, which are good. See below. Can you please clarify what is the output of your:
I'm using the following:
Here's a different table definition which works correctly:
Still looking into why it behaves different than yours, and correctly so. |
|
it's not the |
|
Sorry, I did not execute the |
The prefix of tables' name in your test is different with me ,that's the biggest difference. The reason why tables' name affect the result is metioned in the manual:
The DEL/GHO tables' name are in different order, as follow:
In database sg2 ,the table When you use Don't know if i made it clear,the table name order affect the test result. ---the variables:
|
WOW. OK, let me digest this and see how to proceed. |
|
from https://dev.mysql.com/doc/refman/5.7/en/rename-table.html:
I'll keep looking at the implications. |

Formed in 2009, the Archive Team (not to be confused with the archive.org Archive-It Team) is a rogue archivist collective dedicated to saving copies of rapidly dying or deleted websites for the sake of history and digital heritage. The group is 100% composed of volunteers and interested parties, and has expanded into a large amount of related projects for saving online and digital history.

Suppose now operating DDL on table
a, three temporary tables_a_del,_a_gho, and_a_ghcwill be generated.rename operation is: rename
ato_a_del,_a_ghotoa,lock table statement is: lock table
awrite,_a_delwriteAccording to the order of acquiring the lock:
Thank you!