@@ -72,7 +72,7 @@ def create_restore_job(self):
72
72
self .import_tablespaces_in_target_db ()
73
73
self .hold_write_lock_on_myisam_tables ()
74
74
self .perform_myisam_file_operations ()
75
- self .perform_post_restoration_checks ()
75
+ self .perform_post_restoration_validation_and_fixes ()
76
76
self .unlock_all_tables ()
77
77
78
78
@step ("Validate Backup Files" )
@@ -278,8 +278,8 @@ def hold_write_lock_on_myisam_tables(self):
278
278
def perform_myisam_file_operations (self ):
279
279
self ._perform_file_operations (engine = "myisam" )
280
280
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 ):
283
283
innodb_tables_with_fts = self .get_innodb_tables_with_fts_index ()
284
284
"""
285
285
FLUSH TABLES ... FOR EXPORT does not support FULLTEXT indexes.
@@ -294,6 +294,16 @@ def perform_post_restoration_checks(self):
294
294
if self .is_table_corrupted (table ) and not self .repair_table (table , "innodb" ):
295
295
raise Exception (f"Failed to repair table { table } " )
296
296
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
+ """
297
307
for table in self .myisam_tables :
298
308
if self .is_table_corrupted (table ) and not self .repair_table (table , "myisam" ):
299
309
raise Exception (f"Failed to repair table { table } " )
0 commit comments