Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Interrupted/Misconfigured MariaDB/MySQL migrations leave the database in a corrupt state #1076

Open
Cyberboss opened this issue Jul 13, 2020 · 3 comments
Labels
Database Issue Issue related to database interaction Laid to Rest We honestly don't plan to fix this issue but it still represents an active problem with the software Upstream Issue Issue with BYOND, Nuget, or .NET dependency

Comments

@Cyberboss
Copy link
Member

Cyberboss commented Jul 13, 2020

Well known limitation of the engine, nothing we can do about it. (How is Sqlite better than MySQL at this?)

https://dev.mysql.com/doc/internals/en/transactions-notes-on-ddl-and-normal-transaction.html

Best remedy is to examine which migrations have been applied (Using the __EFMigrationHistory table), figure out which one was interrupted (The one after the last inserted row), and perform surgery to finish the migration. From there, TGS can recover.

@Cyberboss Cyberboss added Bug Something's fucky Database Issue Issue related to database interaction Laid to Rest We honestly don't plan to fix this issue but it still represents an active problem with the software labels Jul 13, 2020
@Cyberboss Cyberboss self-assigned this Jul 13, 2020
@Cyberboss Cyberboss added Upstream Issue Issue with BYOND, Nuget, or .NET dependency and removed Laid to Rest We honestly don't plan to fix this issue but it still represents an active problem with the software labels Jul 13, 2020
@Cyberboss Cyberboss removed their assignment Jul 13, 2020
@Cyberboss Cyberboss changed the title Interrupted MariaDB/MySQL migrations leave the database in a corrupt state Interrupted/Misconfigured MariaDB/MySQL migrations leave the database in a corrupt state Dec 30, 2020
@Cyberboss
Copy link
Member Author

Because having Database:ServerVersion set incorrectly is the primary cause of this.

@Cyberboss
Copy link
Member Author

Diagnosis: Skill issue?

@Cyberboss
Copy link
Member Author

Link broken. Content from Wayback machine:

6.6 Additional Notes on DDL and the Normal Transaction

DDL statements and operations with nontransactional engines do not "register" in thd->transaction lists, and thus do not modify the transaction state. Besides, each DDL statement in MySQL begins with an implicit normal transaction commit (a call to end_active_trans()), and thus leaves nothing to modify. However, as noted above for CREATE TABLE .. SELECT, some DDL statements can start a *new* transaction.

Behavior of the server in this case is currently badly defined. DDL statements use a form of "semantic" logging to maintain atomicity: If CREATE TABLE t .. SELECT fails, table t is deleted. In addition, some DDL statements issue interim transaction commits: for example, ALTER TABLE issues a commit after data is copied from the original table to the internal temporary table. Other statements, for example, CREATE TABLE ... SELECT, do not always commit after themselves. And finally there is a group of DDL statements such as RENAME/DROP TABLE, which don't start new transactions and don't commit.

This diversity makes it hard to say what will happen if by chance a stored function is invoked during a DDL statement -- it's not clear whether any modifications it makes will be committed or not. Fortunately, SQL grammar allows only a few DDL statements to invoke stored functions. Perhaps, for consistency, MySQL should always commit a normal transaction after a DDL statement, just as it commits a statement transaction at the end of a statement. 

@Cyberboss Cyberboss removed the Bug Something's fucky label Jun 28, 2023
@Cyberboss Cyberboss added the Laid to Rest We honestly don't plan to fix this issue but it still represents an active problem with the software label Jul 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Database Issue Issue related to database interaction Laid to Rest We honestly don't plan to fix this issue but it still represents an active problem with the software Upstream Issue Issue with BYOND, Nuget, or .NET dependency
Projects
None yet
Development

No branches or pull requests

1 participant