Skip to content

Commit ebf1c0c

Browse files
committed
refactor(physical-restore): Added inline docs
1 parent a313296 commit ebf1c0c

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

agent/database_physical_restore.py

+13-3
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ def create_restore_job(self):
7272
self.import_tablespaces_in_target_db()
7373
self.hold_write_lock_on_myisam_tables()
7474
self.perform_myisam_file_operations()
75-
self.perform_post_restoration_checks()
75+
self.perform_post_restoration_validation_and_fixes()
7676
self.unlock_all_tables()
7777

7878
@step("Validate Backup Files")
@@ -278,8 +278,8 @@ def hold_write_lock_on_myisam_tables(self):
278278
def perform_myisam_file_operations(self):
279279
self._perform_file_operations(engine="myisam")
280280

281-
@step("Post Restoration Checks")
282-
def perform_post_restoration_checks(self):
281+
@step("Validate And Fix Tables")
282+
def perform_post_restoration_validation_and_fixes(self):
283283
innodb_tables_with_fts = self.get_innodb_tables_with_fts_index()
284284
"""
285285
FLUSH TABLES ... FOR EXPORT does not support FULLTEXT indexes.
@@ -294,6 +294,16 @@ def perform_post_restoration_checks(self):
294294
if self.is_table_corrupted(table) and not self.repair_table(table, "innodb"):
295295
raise Exception(f"Failed to repair table {table}")
296296

297+
"""
298+
MyISAM table corruption can generally happen due to mismatch of no of records in MYD file.
299+
300+
myisamchk can't find and fix this issue.
301+
Because this out of sync happen after creating a blank MyISAM table and just copying MYF & MYI files.
302+
303+
Usually, DB Restart will fix this issue. But we can't do in live database.
304+
So running `REPAIR TABLE ... USE_FRM` can fix the issue.
305+
https://dev.mysql.com/doc/refman/8.4/en/myisam-repair.html
306+
"""
297307
for table in self.myisam_tables:
298308
if self.is_table_corrupted(table) and not self.repair_table(table, "myisam"):
299309
raise Exception(f"Failed to repair table {table}")

0 commit comments

Comments
 (0)