Commit 34dba480 authored by unknown's avatar unknown

WL#3072 Maria recovery, small fixes to pseudocode, discussion why no...

WL#3072 Maria recovery, small fixes to pseudocode, discussion why no checkpoint at end of UNDO phase.


storage/maria/control_file.h:
  small fix
storage/maria/recovery.c:
  small fixes to the pseudocode and discussion of why no checkpoint at end of UNDO phase.
parent 06f7675b
...@@ -6,8 +6,8 @@ ...@@ -6,8 +6,8 @@
/* Here is the interface of this module */ /* Here is the interface of this module */
LSN last_checkpoint_lsn_at_startup; extern LSN last_checkpoint_lsn_at_startup;
char *last_log_name_at_startup; extern char *last_log_name_at_startup;
/* /*
Looks for the control file. If absent, it's a fresh start, create file. Looks for the control file. If absent, it's a fresh start, create file.
......
...@@ -183,7 +183,8 @@ int recovery() ...@@ -183,7 +183,8 @@ int recovery()
/* /*
Launch one or more threads to do the background rollback. Don't wait for Launch one or more threads to do the background rollback. Don't wait for
them to complete their rollback (background rollback; for debugging, we them to complete their rollback (background rollback; for debugging, we
can have an option which waits). can have an option which waits). Set a counter (total_of_rollback_threads)
to the number of threads to lauch.
Note that InnoDB's rollback-in-background works as long as InnoDB is the Note that InnoDB's rollback-in-background works as long as InnoDB is the
last engine to recover, otherwise MySQL will refuse new connections until last engine to recover, otherwise MySQL will refuse new connections until
...@@ -221,4 +222,20 @@ pthread_handler_decl rollback_background_thread() ...@@ -221,4 +222,20 @@ pthread_handler_decl rollback_background_thread()
} }
/* remove trans from list */ /* remove trans from list */
} }
lock_mutex(rollback_threads); /* or atomic counter */
if (--total_of_rollback_threads == 0)
{
/*
All rollback threads are done. Print "rollback finished" to the error
log. The UNDO phase has the reputation of being a slow operation
(slower than the REDO phase), so taking a checkpoint at the end of it is
intelligent, but as this UNDO phase generates REDOs and CLR_ENDs, if it
did a lot of work then the "automatic checkpoint when much has been
written to the log" will do it; and if the UNDO phase didn't do a lot of
work, no need for a checkpoint. If we change our mind and want to force
a checkpoint at the end of the UNDO phase, simply call it here.
*/
}
unlock_mutex(rollback_threads);
pthread_exit();
} }
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