summaryrefslogtreecommitdiff
path: root/storage/maria/ma_recovery.c
diff options
context:
space:
mode:
authorGuilhem Bichot <guilhem@mysql.com>2008-07-09 11:02:27 +0200
committerGuilhem Bichot <guilhem@mysql.com>2008-07-09 11:02:27 +0200
commit60b88ce475cbc4e4ce5b9a90e2f821df5e5a10a1 (patch)
tree03c662c86c5ce6974868da0eade6e2ef0931ae23 /storage/maria/ma_recovery.c
parentf9ef13d562756c9c084ee8c5d0f741885a4bc9a1 (diff)
downloadmariadb-git-60b88ce475cbc4e4ce5b9a90e2f821df5e5a10a1.tar.gz
Fix for BUG#37876 "Importing Maria table from other server via binary copy does not work":
- after auto-zerofill (ha_maria::check_and_repair()) kepts its state's LSNs unchanged, which could be the same as the create_rename_lsn of another pre-existing table, which would break versioning as this LSN serves as unique identifier in the versioning code (in maria_open()). Even the state pieces which maria_zerofill() did change were lost (because they didn't go to disk). - after this fix, if two tables were auto-zerofilled at the same time (by _ma_mark_changed()) they could receive the same create_rename_lsn, which would break versioning again. Fix is to write a log record each time a table is imported. - Print state's LSNs (create_rename_lsn, is_of_horizon, skip_redo_lsn) and UUID in maria_chk -dvv. mysql-test/r/maria-autozerofill.result: result mysql-test/t/maria-autozerofill.test: Test for auto-zerofilling storage/maria/ha_maria.cc: The state changes done by auto-zerofilling never reached disk. storage/maria/ma_check.c: When zerofilling a table, including its pages' LSNs, new state LSNs are needed next time the table is imported into a Maria instance. storage/maria/ma_create.c: Write LOGREC_IMPORTED_TABLE when importing a table. This is informative and ensures that the table gets a unique create_rename_lsn even though multiple tables are imported by concurrent threads (it advances the log's end LSN). storage/maria/ma_key_recover.c: comment storage/maria/ma_locking.c: instead of using translog_get_horizon() for state's LSNs of imported table, use the LSN of to-be-written LOGREC_IMPORTED_TABLE. storage/maria/ma_loghandler.c: New type of log record storage/maria/ma_loghandler.h: New type of log record storage/maria/ma_loghandler_lsn.h: New name for constant as can be used not only by maria_chk but auto-zerofill now too. storage/maria/ma_open.c: instead of using translog_get_horizon() for state's LSNs of imported table, use the LSN of to-be-written LOGREC_IMPORTED_TABLE. storage/maria/ma_recovery.c: print content of LOGREC_IMPORTED_TABLE in maria_read_log. storage/maria/maria_chk.c: print info about LSNs of the table's state, and UUID, when maria_chk -dvv storage/maria/maria_pack.c: new name for constant storage/maria/unittest/ma_test_recovery.pl: Now that maria_chk -dvv shows state LSNs and UUID those need to be filtered out, as maria_read_log -a does not use the same as at original run.
Diffstat (limited to 'storage/maria/ma_recovery.c')
-rw-r--r--storage/maria/ma_recovery.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/storage/maria/ma_recovery.c b/storage/maria/ma_recovery.c
index 4eb024417a2..11c2ec0a209 100644
--- a/storage/maria/ma_recovery.c
+++ b/storage/maria/ma_recovery.c
@@ -77,6 +77,7 @@ prototype_redo_exec_hook(FILE_ID);
prototype_redo_exec_hook(INCOMPLETE_LOG);
prototype_redo_exec_hook_dummy(INCOMPLETE_GROUP);
prototype_redo_exec_hook(UNDO_BULK_INSERT);
+prototype_redo_exec_hook(IMPORTED_TABLE);
prototype_redo_exec_hook(REDO_INSERT_ROW_HEAD);
prototype_redo_exec_hook(REDO_INSERT_ROW_TAIL);
prototype_redo_exec_hook(REDO_INSERT_ROW_HEAD);
@@ -1861,6 +1862,24 @@ prototype_redo_exec_hook(UNDO_BULK_INSERT)
}
+prototype_redo_exec_hook(IMPORTED_TABLE)
+{
+ char *name;
+ enlarge_buffer(rec);
+ if (log_record_buffer.str == NULL ||
+ translog_read_record(rec->lsn, 0, rec->record_length,
+ log_record_buffer.str, NULL) !=
+ rec->record_length)
+ {
+ eprint(tracef, "Failed to read record");
+ return 1;
+ }
+ name= (char *)log_record_buffer.str;
+ tprint(tracef, "Table '%s' was imported (auto-zerofilled) in this Maria instance\n", name);
+ return 0;
+}
+
+
prototype_redo_exec_hook(COMMIT)
{
uint16 sid= rec->short_trid;
@@ -2328,6 +2347,7 @@ static int run_redo_phase(LSN lsn, enum maria_apply_log_way apply)
install_redo_exec_hook_shared(REDO_NEW_ROW_TAIL, REDO_INSERT_ROW_TAIL);
install_redo_exec_hook(UNDO_BULK_INSERT);
install_undo_exec_hook(UNDO_BULK_INSERT);
+ install_redo_exec_hook(IMPORTED_TABLE);
current_group_end_lsn= LSN_IMPOSSIBLE;
#ifndef DBUG_OFF