Commit 10bce560 authored by unknown's avatar unknown

WL#3072 - Maria recovery

comments; remember the UNDO's LSN for storing it in pages when
executing REDO's (to imitate what the runtime code does)


storage/maria/maria_read_log.c:
  comments; remember the UNDO's LSN for storing it in pages when
  executing REDO's (to imitate what the runtime code does)
parent 1e73169a
...@@ -38,6 +38,7 @@ struct TRN_FOR_RECOVERY ...@@ -38,6 +38,7 @@ struct TRN_FOR_RECOVERY
struct TRN_FOR_RECOVERY all_active_trans[SHORT_TRID_MAX + 1]; struct TRN_FOR_RECOVERY all_active_trans[SHORT_TRID_MAX + 1];
MARIA_HA *all_tables[SHORT_TRID_MAX + 1]; MARIA_HA *all_tables[SHORT_TRID_MAX + 1];
LSN current_group_end_lsn= LSN_IMPOSSIBLE;
static void end_of_redo_phase(); static void end_of_redo_phase();
static void display_record_position(const LOG_DESC *log_desc, static void display_record_position(const LOG_DESC *log_desc,
...@@ -171,6 +172,10 @@ int main(int argc, char **argv) ...@@ -171,6 +172,10 @@ int main(int argc, char **argv)
(e.g. a set of REDOs for an operation, terminated by an UNDO for this (e.g. a set of REDOs for an operation, terminated by an UNDO for this
operation); if there is no "end mark" record the group is incomplete operation); if there is no "end mark" record the group is incomplete
and won't be executed. and won't be executed.
There are pitfalls: if a table write failed, the transaction may have
put an incomplete group in the log and then a COMMIT record, that will
make a complete group which is wrong. We say that we should mark the
table corrupted if such error happens (what if it cannot be marked?).
*/ */
if (log_desc->record_ends_group) if (log_desc->record_ends_group)
{ {
...@@ -195,6 +200,7 @@ int main(int argc, char **argv) ...@@ -195,6 +200,7 @@ int main(int argc, char **argv)
fprintf(stderr, "Scanner2 init failed\n"); fprintf(stderr, "Scanner2 init failed\n");
goto err; goto err;
} }
current_group_end_lsn= rec.lsn;
do do
{ {
if (rec2.short_trid == sid) /* it's in our group */ if (rec2.short_trid == sid) /* it's in our group */
...@@ -215,6 +221,7 @@ int main(int argc, char **argv) ...@@ -215,6 +221,7 @@ int main(int argc, char **argv)
translog_free_record_header(&rec2); translog_free_record_header(&rec2);
/* group finished */ /* group finished */
all_active_trans[sid].group_start_lsn= LSN_IMPOSSIBLE; all_active_trans[sid].group_start_lsn= LSN_IMPOSSIBLE;
current_group_end_lsn= LSN_IMPOSSIBLE; /* for debugging */
} }
if (display_and_apply_record(log_desc, &rec)) if (display_and_apply_record(log_desc, &rec))
goto err; goto err;
...@@ -639,12 +646,12 @@ prototype_exec_hook(REDO_INSERT_ROW_HEAD) ...@@ -639,12 +646,12 @@ prototype_exec_hook(REDO_INSERT_ROW_HEAD)
/* /*
If REDO's LSN is > page's LSN (read from disk), we are going to modify the If REDO's LSN is > page's LSN (read from disk), we are going to modify the
page and change its LSN. The normal runtime code stores the UNDO's LSN page and change its LSN. The normal runtime code stores the UNDO's LSN
into the page; but here storing the REDO's LSN (rec->lsn) is more into the page. Here storing the REDO's LSN (rec->lsn) would work
straightforward and should not cause any problem (we are not writing to (we are not writing to the log here, so don't have to "flush up to UNDO's
the log here, so don't have to "flush up to UNDO's LSN"). LSN"). But in a test scenario where we do updates at runtime, then remove
If the UNDO's LSN is desired, it can be found, as we saw the UNDO record tables, apply the log and check that this results in the same table as at
before deciding to execute this REDO; UNDO's LSN could simply be stored in runtime, putting the same LSN as runtime had done will decrease
all_trans[rec->short_trid].group_end_lsn for this. differences. So we use the UNDO's LSN which is current_group_end_lsn.
*/ */
DBUG_ASSERT("Monty" == "this is the place"); DBUG_ASSERT("Monty" == "this is the place");
end: end:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment