diff options
Diffstat (limited to 'innobase/log/log0log.c')
-rw-r--r-- | innobase/log/log0log.c | 80 |
1 files changed, 39 insertions, 41 deletions
diff --git a/innobase/log/log0log.c b/innobase/log/log0log.c index 3bc562eefb6..b058a65ce6e 100644 --- a/innobase/log/log0log.c +++ b/innobase/log/log0log.c @@ -517,7 +517,8 @@ log_group_calc_lsn_offset( ut_a(offset < (((ib_longlong) 1) << 32)); /* offset must be < 4 GB */ - /* printf("Offset is %lu gr_lsn_offset is %lu difference is %lu\n", + /* fprintf(stderr, + "Offset is %lu gr_lsn_offset is %lu difference is %lu\n", (ulint)offset,(ulint)gr_lsn_size_offset, (ulint)difference); */ @@ -934,7 +935,8 @@ log_group_check_flush_completion( 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", group->id); + fprintf(stderr, + "Log flushed first to group %lu\n", group->id); } #endif /* UNIV_LOG_DEBUG */ @@ -947,7 +949,7 @@ log_group_check_flush_completion( #ifdef UNIV_LOG_DEBUG if (log_debug_writes && (group->n_pending_writes == 0)) { - printf("Log flushed to group %lu\n", group->id); + fprintf(stderr, "Log flushed to group %lu\n", group->id); } #endif /* UNIV_LOG_DEBUG */ @@ -1096,9 +1098,9 @@ log_group_file_header_flush( #ifdef UNIV_LOG_DEBUG if (log_debug_writes) { - printf( - "Writing log file header to group %lu file %lu\n", group->id, - nth_file); + fprintf(stderr, + "Writing log file header to group %lu file %lu\n", + group->id, nth_file); } #endif /* UNIV_LOG_DEBUG */ @@ -1186,14 +1188,13 @@ loop: #ifdef UNIV_LOG_DEBUG if (log_debug_writes) { - printf( + fprintf(stderr, "Writing log file segment to group %lu offset %lu len %lu\n" - "start lsn %lu %lu\n", + "start lsn %lu %lu\n" + "First block n:o %lu last block n:o %lu\n", group->id, next_offset, write_len, ut_dulint_get_high(start_lsn), - ut_dulint_get_low(start_lsn)); - printf( - "First block n:o %lu last block n:o %lu\n", + ut_dulint_get_low(start_lsn), log_block_get_hdr_no(buf), log_block_get_hdr_no( buf + write_len - OS_FILE_LOG_BLOCK_SIZE)); @@ -1274,7 +1275,7 @@ loop: ut_ad(loop_count < 5); if (loop_count > 2) { -/* printf("Log loop count %lu\n", loop_count); */ +/* fprintf(stderr, "Log loop count %lu\n", loop_count); */ } mutex_enter(&(log_sys->mutex)); @@ -1337,7 +1338,8 @@ loop: #ifdef UNIV_LOG_DEBUG if (log_debug_writes) { - printf("Writing log from %lu %lu up to lsn %lu %lu\n", + fprintf(stderr, + "Writing log from %lu %lu up to lsn %lu %lu\n", ut_dulint_get_high(log_sys->written_to_all_lsn), ut_dulint_get_low(log_sys->written_to_all_lsn), ut_dulint_get_high(log_sys->lsn), @@ -1757,11 +1759,11 @@ log_reset_first_header_and_checkpoint( lsn = ut_dulint_add(start, LOG_BLOCK_HDR_SIZE); /* Write the label of ibbackup --restore */ - sprintf((char*) hdr_buf + LOG_FILE_WAS_CREATED_BY_HOT_BACKUP, + strcpy((char*) hdr_buf + LOG_FILE_WAS_CREATED_BY_HOT_BACKUP, "ibbackup "); ut_sprintf_timestamp( - (char*) hdr_buf + LOG_FILE_WAS_CREATED_BY_HOT_BACKUP - + strlen("ibbackup ")); + (char*) hdr_buf + (LOG_FILE_WAS_CREATED_BY_HOT_BACKUP + + (sizeof "ibbackup ") - 1)); buf = hdr_buf + LOG_CHECKPOINT_1; mach_write_to_8(buf + LOG_CHECKPOINT_NO, ut_dulint_zero); @@ -1904,7 +1906,7 @@ log_checkpoint( #ifdef UNIV_LOG_DEBUG if (log_debug_writes) { - printf("Making checkpoint no %lu at lsn %lu %lu\n", + fprintf(stderr, "Making checkpoint no %lu at lsn %lu %lu\n", ut_dulint_get_low(log_sys->next_checkpoint_no), ut_dulint_get_high(oldest_lsn), ut_dulint_get_low(oldest_lsn)); @@ -2279,19 +2281,18 @@ loop: } if (!ret) { - fprintf(stderr, - "InnoDB: Cannot create or open archive log file %s.\n", - name); - fprintf(stderr, "InnoDB: Cannot continue operation.\n" - "InnoDB: Check that the log archive directory exists,\n" - "InnoDB: you have access rights to it, and\n" - "InnoDB: there is space available.\n"); - exit(1); + fprintf(stderr, + "InnoDB: Cannot create or open archive log file %s.\n" + "InnoDB: Cannot continue operation.\n" + "InnoDB: Check that the log archive directory exists,\n" + "InnoDB: you have access rights to it, and\n" + "InnoDB: there is space available.\n", name); + exit(1); } #ifdef UNIV_LOG_DEBUG if (log_debug_writes) { - printf("Created archive file %s\n", name); + fprintf(stderr, "Created archive file %s\n", name); } #endif /* UNIV_LOG_DEBUG */ @@ -2324,7 +2325,7 @@ loop: #ifdef UNIV_LOG_DEBUG if (log_debug_writes) { - printf( + fprintf(stderr, "Archiving starting at lsn %lu %lu, len %lu to group %lu\n", ut_dulint_get_high(start_lsn), ut_dulint_get_low(start_lsn), @@ -2423,7 +2424,8 @@ log_archive_write_complete_groups(void) #ifdef UNIV_LOG_DEBUG if (log_debug_writes && trunc_files) { - printf("Complete file(s) archived to group %lu\n", + fprintf(stderr, + "Complete file(s) archived to group %lu\n", group->id); } #endif /* UNIV_LOG_DEBUG */ @@ -2451,7 +2453,7 @@ log_archive_write_complete_groups(void) #ifdef UNIV_LOG_DEBUG if (log_debug_writes) { - printf("Archiving writes completed\n"); + fputs("Archiving writes completed\n", stderr); } #endif /* UNIV_LOG_DEBUG */ } @@ -2472,7 +2474,7 @@ log_archive_check_completion_low(void) #ifdef UNIV_LOG_DEBUG if (log_debug_writes) { - printf("Archiving read completed\n"); + fputs("Archiving read completed\n", stderr); } #endif /* UNIV_LOG_DEBUG */ @@ -2620,7 +2622,8 @@ loop: #ifdef UNIV_LOG_DEBUG if (log_debug_writes) { - printf("Archiving from lsn %lu %lu to lsn %lu %lu\n", + fprintf(stderr, + "Archiving from lsn %lu %lu to lsn %lu %lu\n", ut_dulint_get_high(log_sys->archived_lsn), ut_dulint_get_low(log_sys->archived_lsn), ut_dulint_get_high(limit_lsn), @@ -2727,7 +2730,7 @@ log_archive_close_groups( #ifdef UNIV_LOG_DEBUG if (log_debug_writes) { - printf( + fprintf(stderr, "Incrementing arch file no to %lu in log group %lu\n", group->archived_file_no + 2, group->id); } @@ -3262,20 +3265,15 @@ Prints info of the log. */ void log_print( /*======*/ - char* buf, /* in/out: buffer where to print */ - char* buf_end)/* in: buffer end */ + FILE* file) /* in: file where to print */ { double time_elapsed; time_t current_time; - if (buf_end - buf < 300) { - - return; - } - mutex_enter(&(log_sys->mutex)); - buf += sprintf(buf, "Log sequence number %lu %lu\n" + fprintf(file, + "Log sequence number %lu %lu\n" "Log flushed up to %lu %lu\n" "Last checkpoint at %lu %lu\n", ut_dulint_get_high(log_sys->lsn), @@ -3289,7 +3287,7 @@ log_print( time_elapsed = 0.001 + difftime(current_time, log_sys->last_printout_time); - buf += sprintf(buf, + fprintf(file, "%lu pending log writes, %lu pending chkp writes\n" "%lu log i/o's done, %.2f log i/o's/second\n", log_sys->n_pending_writes, |