Commit a5608823 authored by marko's avatar marko

branches/zip: Minor cleanup.

log_write_up_to(): Replace if-else if-else with a switch block.

log_archive_do(): Remove an excess mutex_enter().  Replace if-else if-else
with a switch block.  (This function is not included unless UNIV_LOG_ARCHIVE
is defined.)
parent 2af559b6
...@@ -1475,12 +1475,19 @@ log_write_up_to( ...@@ -1475,12 +1475,19 @@ log_write_up_to(
do_waits: do_waits:
mutex_exit(&(log_sys->mutex)); mutex_exit(&(log_sys->mutex));
if (wait == LOG_WAIT_ONE_GROUP) { switch (wait) {
case LOG_WAIT_ONE_GROUP:
os_event_wait(log_sys->one_flushed_event); os_event_wait(log_sys->one_flushed_event);
} else if (wait == LOG_WAIT_ALL_GROUPS) { break;
case LOG_WAIT_ALL_GROUPS:
os_event_wait(log_sys->no_flush_event); os_event_wait(log_sys->no_flush_event);
} else { break;
ut_ad(wait == LOG_NO_WAIT); #ifdef UNIV_DEBUG
case LOG_NO_WAIT:
break;
default:
ut_error;
#endif /* UNIV_DEBUG */
} }
} }
...@@ -2544,22 +2551,20 @@ log_archive_do( ...@@ -2544,22 +2551,20 @@ log_archive_do(
loop: loop:
mutex_enter(&(log_sys->mutex)); mutex_enter(&(log_sys->mutex));
if (log_sys->archiving_state == LOG_ARCH_OFF) { switch (log_sys->archiving_state) {
case LOG_ARCH_OFF:
arch_none:
mutex_exit(&(log_sys->mutex)); mutex_exit(&(log_sys->mutex));
*n_bytes = 0; *n_bytes = 0;
return(TRUE); return(TRUE);
case LOG_ARCH_STOPPED:
} else if (log_sys->archiving_state == LOG_ARCH_STOPPED case LOG_ARCH_STOPPING2:
|| log_sys->archiving_state == LOG_ARCH_STOPPING2) {
mutex_exit(&(log_sys->mutex)); mutex_exit(&(log_sys->mutex));
os_event_wait(log_sys->archiving_on); os_event_wait(log_sys->archiving_on);
mutex_enter(&(log_sys->mutex));
goto loop; goto loop;
} }
...@@ -2580,11 +2585,7 @@ log_archive_do( ...@@ -2580,11 +2585,7 @@ log_archive_do(
if (log_sys->archived_lsn >= limit_lsn) { if (log_sys->archived_lsn >= limit_lsn) {
mutex_exit(&(log_sys->mutex)); goto arch_none;
*n_bytes = 0;
return(TRUE);
} }
if (log_sys->written_to_all_lsn < limit_lsn) { if (log_sys->written_to_all_lsn < limit_lsn) {
......
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