summaryrefslogtreecommitdiff
path: root/innobase/log/log0log.c
diff options
context:
space:
mode:
Diffstat (limited to 'innobase/log/log0log.c')
-rw-r--r--innobase/log/log0log.c54
1 files changed, 41 insertions, 13 deletions
diff --git a/innobase/log/log0log.c b/innobase/log/log0log.c
index cd6e6e803a7..e99ea269920 100644
--- a/innobase/log/log0log.c
+++ b/innobase/log/log0log.c
@@ -32,7 +32,9 @@ ulint log_fsp_current_free_limit = 0;
log_t* log_sys = NULL;
ibool log_do_write = TRUE;
+#ifdef UNIV_LOG_DEBUG
ibool log_debug_writes = FALSE;
+#endif /* UNIV_LOG_DEBUG */
/* These control how often we print warnings if the last checkpoint is too
old */
@@ -86,9 +88,8 @@ the previous */
Completes a checkpoint write i/o to a log file. */
static
void
-log_io_complete_checkpoint(
-/*=======================*/
- log_group_t* group); /* in: log group */
+log_io_complete_checkpoint(void);
+/*============================*/
/**********************************************************
Completes an archiving i/o. */
static
@@ -928,11 +929,12 @@ log_group_check_flush_completion(
#endif /* UNIV_SYNC_DEBUG */
if (!log_sys->one_flushed && group->n_pending_writes == 0) {
-
+#ifdef UNIV_LOG_DEBUG
if (log_debug_writes) {
printf("Log flushed first to group %lu\n",
(ulong) group->id);
}
+#endif /* UNIV_LOG_DEBUG */
log_sys->written_to_some_lsn = log_sys->write_lsn;
log_sys->one_flushed = TRUE;
@@ -940,10 +942,12 @@ log_group_check_flush_completion(
return(LOG_UNLOCK_NONE_FLUSHED_LOCK);
}
+#ifdef UNIV_LOG_DEBUG
if (log_debug_writes && (group->n_pending_writes == 0)) {
printf("Log flushed to group %lu\n", (ulong) group->id);
}
+#endif /* UNIV_LOG_DEBUG */
return(0);
}
@@ -1019,7 +1023,15 @@ log_io_complete(
fil_flush(group->space_id);
}
- log_io_complete_checkpoint(group);
+#ifdef UNIV_LOG_DEBUG
+ if (log_debug_writes) {
+ fprintf(stderr,
+ "Checkpoint info written to group %lu\n",
+ group->id);
+ }
+#endif /* UNIV_LOG_DEBUG */
+
+ log_io_complete_checkpoint();
return;
}
@@ -1084,11 +1096,13 @@ log_group_file_header_flush(
dest_offset = nth_file * group->file_size;
+#ifdef UNIV_LOG_DEBUG
if (log_debug_writes) {
printf(
"Writing log file header to group %lu file %lu\n",
(ulong) group->id, (ulong) nth_file);
}
+#endif /* UNIV_LOG_DEBUG */
if (log_do_write) {
log_sys->n_log_ios++;
@@ -1173,6 +1187,7 @@ loop:
write_len = len;
}
+#ifdef UNIV_LOG_DEBUG
if (log_debug_writes) {
printf(
@@ -1197,6 +1212,7 @@ loop:
+ i * OS_FILE_LOG_BLOCK_SIZE));
}
}
+#endif /* UNIV_LOG_DEBUG */
/* Calculate the checksums for each log block and write them to
the trailer fields of the log blocks */
@@ -1324,6 +1340,7 @@ loop:
return;
}
+#ifdef UNIV_LOG_DEBUG
if (log_debug_writes) {
printf("Writing log from %lu %lu up to lsn %lu %lu\n",
(ulong) ut_dulint_get_high(log_sys->written_to_all_lsn),
@@ -1331,6 +1348,7 @@ loop:
(ulong) ut_dulint_get_high(log_sys->lsn),
(ulong) ut_dulint_get_low(log_sys->lsn));
}
+#endif /* UNIV_LOG_DEBUG */
log_sys->n_pending_writes++;
@@ -1556,9 +1574,8 @@ log_complete_checkpoint(void)
Completes an asynchronous checkpoint info write i/o to a log file. */
static
void
-log_io_complete_checkpoint(
-/*=======================*/
- log_group_t* group) /* in: log group */
+log_io_complete_checkpoint(void)
+/*============================*/
{
mutex_enter(&(log_sys->mutex));
@@ -1566,11 +1583,6 @@ log_io_complete_checkpoint(
log_sys->n_pending_checkpoint_writes--;
- if (log_debug_writes) {
- printf("Checkpoint info written to group %lu\n",
- (ulong) group->id);
- }
-
if (log_sys->n_pending_checkpoint_writes == 0) {
log_complete_checkpoint();
}
@@ -1895,12 +1907,14 @@ log_checkpoint(
log_sys->next_checkpoint_lsn = oldest_lsn;
+#ifdef UNIV_LOG_DEBUG
if (log_debug_writes) {
printf("Making checkpoint no %lu at lsn %lu %lu\n",
(ulong) ut_dulint_get_low(log_sys->next_checkpoint_no),
(ulong) ut_dulint_get_high(oldest_lsn),
(ulong) ut_dulint_get_low(oldest_lsn));
}
+#endif /* UNIV_LOG_DEBUG */
log_groups_write_checkpoint_info();
@@ -2287,9 +2301,11 @@ loop:
exit(1);
}
+#ifdef UNIV_LOG_DEBUG
if (log_debug_writes) {
printf("Created archive file %s\n", name);
}
+#endif /* UNIV_LOG_DEBUG */
ret = os_file_close(file_handle);
@@ -2316,6 +2332,7 @@ loop:
len = group->file_size - (next_offset % group->file_size);
}
+#ifdef UNIV_LOG_DEBUG
if (log_debug_writes) {
printf(
"Archiving starting at lsn %lu %lu, len %lu to group %lu\n",
@@ -2323,6 +2340,7 @@ loop:
(ulong) ut_dulint_get_low(start_lsn),
(ulong) len, (ulong) group->id);
}
+#endif /* UNIV_LOG_DEBUG */
log_sys->n_pending_archive_ios++;
@@ -2417,10 +2435,12 @@ log_archive_write_complete_groups(void)
trunc_files = n_files - 1;
}
+#ifdef UNIV_LOG_DEBUG
if (log_debug_writes && trunc_files) {
printf("Complete file(s) archived to group %lu\n",
(ulong) group->id);
}
+#endif /* UNIV_LOG_DEBUG */
/* Calculate the archive file space start lsn */
start_lsn = ut_dulint_subtract(log_sys->next_archived_lsn,
@@ -2443,9 +2463,11 @@ log_archive_write_complete_groups(void)
fil_space_truncate_start(group->archive_space_id,
trunc_files * group->file_size);
+#ifdef UNIV_LOG_DEBUG
if (log_debug_writes) {
printf("Archiving writes completed\n");
}
+#endif /* UNIV_LOG_DEBUG */
}
/**********************************************************
@@ -2464,9 +2486,11 @@ log_archive_check_completion_low(void)
if (log_sys->n_pending_archive_ios == 0
&& log_sys->archiving_phase == LOG_ARCHIVE_READ) {
+#ifdef UNIV_LOG_DEBUG
if (log_debug_writes) {
printf("Archiving read completed\n");
}
+#endif /* UNIV_LOG_DEBUG */
/* Archive buffer has now been read in: start archive writes */
@@ -2729,12 +2753,14 @@ log_archive_close_groups(
group->archived_file_no += 2;
}
+#ifdef UNIV_LOG_DEBUG
if (log_debug_writes) {
printf(
"Incrementing arch file no to %lu in log group %lu\n",
(ulong) group->archived_file_no + 2,
(ulong) group->id);
}
+#endif /* UNIV_LOG_DEBUG */
}
}
@@ -3204,6 +3230,7 @@ loop:
ut_a(0 == ut_dulint_cmp(lsn, log_sys->lsn));
}
+#ifdef UNIV_LOG_DEBUG
/**********************************************************
Checks by parsing that the catenated log segment for a single mtr is
consistent. */
@@ -3256,6 +3283,7 @@ log_check_log_recs(
return(TRUE);
}
+#endif /* UNIV_LOG_DEBUG */
/**********************************************************
Peeks the current lsn. */