Skip to content

Commit

Permalink
Code cleanup: Removed some unnecessary outputs from standard builds (…
Browse files Browse the repository at this point in the history
…available on

special builds UNIV_PAGECOMPRESS_DEBUG and UNIV_MTFLUSH_DEBUG).

Added a new status variable compress_pages_page_compression_error to count possible
compression errors.
  • Loading branch information
Jan Lindström committed Mar 21, 2014
1 parent 3ea72a2 commit 6a756b3
Show file tree
Hide file tree
Showing 14 changed files with 78 additions and 44 deletions.
2 changes: 1 addition & 1 deletion storage/innobase/buf/buf0flu.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2461,7 +2461,7 @@ DECLARE_THREAD(buf_flush_page_cleaner_thread)(

/* Flush pages from end of LRU if required */
n_lru = n_flushed = buf_flush_LRU_tail();
#ifdef UNIV_DEBUG
#ifdef UNIV_MTFLUSH_DEBUG
if (n_lru) {
fprintf(stderr,"n_lru:%lu ",n_lru);
}
Expand Down
14 changes: 8 additions & 6 deletions storage/innobase/buf/buf0mtflu.cc
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ buf_mtflu_flush_pool_instance(
pools based on the assumption that it will
help in the retry which will follow the
failure. */
#ifdef UNIV_DEBUG
#ifdef UNIV_MTFLUSH_DEBUG
fprintf(stderr, "InnoDB: Note: buf flush start failed there is already active flush for this buffer pool.\n");
#endif
return 0;
Expand Down Expand Up @@ -330,12 +330,12 @@ DECLARE_THREAD(mtflush_io_thread)(

while (TRUE) {

#ifdef UNIV_DEBUG
#ifdef UNIV_MTFLUSH_DEBUG
fprintf(stderr, "InnoDB: Note. Thread %lu work queue len %lu return queue len %lu\n",
os_thread_get_curr_id(),
ib_wqueue_len(mtflush_io->wq),
ib_wqueue_len(mtflush_io->wr_cq));
#endif /* UNIV_DEBUG */
#endif /* UNIV_MTFLUSH_DEBUG */

mtflush_service_io(mtflush_io, this_thread_data);

Expand Down Expand Up @@ -374,7 +374,7 @@ buf_mtflu_io_thread_exit(void)

mtflush_io->gwt_status = WTHR_KILL_IT;

fprintf(stderr, "signal mtflush_io_threads to exit [%lu]\n",
fprintf(stderr, "InnoDB: [Note]: Signal mtflush_io_threads to exit [%lu]\n",
srv_mtflush_threads);

/* Send one exit work item/thread */
Expand Down Expand Up @@ -544,6 +544,7 @@ buf_mtflu_flush_work_items(
if (done_wi != NULL) {
per_pool_pages_flushed[i] = done_wi->n_flushed;

#if UNIV_DEBUG
if((int)done_wi->id_usr == 0 &&
(done_wi->wi_status == WRK_ITEM_SET ||
done_wi->wi_status == WRK_ITEM_UNSET)) {
Expand All @@ -553,6 +554,7 @@ buf_mtflu_flush_work_items(
done_wi->wr.flush_type);
ut_a(0);
}
#endif

n_flushed+= done_wi->n_flushed;
i++;
Expand Down Expand Up @@ -621,7 +623,7 @@ buf_mtflu_flush_list(
cnt_flush[i]);
}
}
#ifdef UNIV_DEBUG
#ifdef UNIV_MTFLUSH_DEBUG
fprintf(stderr, "%s: [1] [*n_processed: (min:%lu)%lu ]\n",
__FUNCTION__, (min_n * srv_buf_pool_instances), *n_processed);
#endif
Expand Down Expand Up @@ -663,7 +665,7 @@ buf_mtflu_flush_LRU_tail(void)
}
}

#if UNIV_DEBUG
#if UNIV_MTFLUSH_DEBUG
fprintf(stderr, "[1] [*n_processed: (min:%lu)%lu ]\n", (
srv_LRU_scan_depth * srv_buf_pool_instances), total_flushed);
#endif
Expand Down
24 changes: 13 additions & 11 deletions storage/innobase/fil/fil0pagecompress.cc
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,11 @@ fil_compress_page(
level = page_zip_level;
}

#ifdef UNIV_DEBUG
#ifdef UNIV_PAGECOMPRESS_DEBUG
fprintf(stderr,
"InnoDB: Note: Preparing for compress for space %lu name %s len %lu\n",
space_id, fil_space_name(space), len);
#endif /* UNIV_DEBUG */
#endif /* UNIV_PAGECOMPRESS_DEBUG */

write_size = UNIV_PAGE_SIZE - header_len;

Expand All @@ -126,6 +126,7 @@ fil_compress_page(
"InnoDB: Warning: Compression failed for space %lu name %s len %lu rt %d write %lu\n",
space_id, fil_space_name(space), len, err, write_size);

srv_stats.pages_page_compression_error.inc();
*out_len = len;
return (buf);
}
Expand All @@ -140,6 +141,7 @@ fil_compress_page(
"InnoDB: Warning: Compression failed for space %lu name %s len %lu rt %d write %lu\n",
space_id, fil_space_name(space), len, err, write_size);

srv_stats.pages_page_compression_error.inc();
*out_len = len;
return (buf);
}
Expand Down Expand Up @@ -197,19 +199,19 @@ fil_compress_page(
ut_a((write_size % SECT_SIZE) == 0);
}

#ifdef UNIV_DEBUG
#ifdef UNIV_PAGECOMPRESS_DEBUG
fprintf(stderr,
"InnoDB: Note: Compression succeeded for space %lu name %s len %lu out_len %lu\n",
space_id, fil_space_name(space), len, write_size);
#endif
#endif /* UNIV_PAGECOMPRESS_DEBUG */


srv_stats.page_compression_saved.add((len - write_size));
if ((len - write_size) > 0) {
srv_stats.page_compression_trim_sect512.add(((len - write_size) / SECT_SIZE));
srv_stats.page_compression_trim_sect4096.add(((len - write_size) / (SECT_SIZE*8)));
}
//srv_stats.page_compressed_trim_op.inc();

srv_stats.pages_page_compressed.inc();
*out_len = write_size;

Expand Down Expand Up @@ -258,10 +260,10 @@ fil_decompress_page(

// If no buffer was given, we need to allocate temporal buffer
if (page_buf == NULL) {
#ifdef UNIV_DEBUG
#ifdef UNIV_PAGECOMPRESS_DEBUG
fprintf(stderr,
"InnoDB: Note: FIL: Compression buffer not given, allocating...\n");
#endif /* UNIV_DEBUG */
#endif /* UNIV_PAGECOMPRESS_DEBUG */
in_buf = static_cast<byte *>(ut_malloc(UNIV_PAGE_SIZE));
} else {
in_buf = page_buf;
Expand All @@ -287,11 +289,11 @@ fil_decompress_page(

if (compression_alg == FIL_PAGE_COMPRESSION_ZLIB) {

#ifdef UNIV_DEBUG
#ifdef UNIV_PAGECOMPRESS_DEBUG
fprintf(stderr,
"InnoDB: Note: Preparing for decompress for len %lu\n",
actual_size);
#endif /* UNIV_DEBUG */
#endif /* UNIV_PAGECOMPRESS_DEBUG */

err= uncompress(in_buf, &len, buf+FIL_PAGE_DATA+FIL_PAGE_COMPRESSED_SIZE, (unsigned long)actual_size);

Expand All @@ -310,11 +312,11 @@ fil_decompress_page(
ut_error;
}

#ifdef UNIV_DEBUG
#ifdef UNIV_PAGECOMPRESS_DEBUG
fprintf(stderr,
"InnoDB: Note: Decompression succeeded for len %lu \n",
len);
#endif /* UNIV_DEBUG */
#endif /* UNIV_PAGECOMPRESS_DEBUG */
#ifdef HAVE_LZ4
} else if (compression_alg == FIL_PAGE_COMPRESSION_LZ4) {
err = LZ4_decompress_fast((const char *)buf+FIL_PAGE_DATA+FIL_PAGE_COMPRESSED_SIZE, (char *)in_buf, UNIV_PAGE_SIZE);
Expand Down
1 change: 1 addition & 0 deletions storage/innobase/include/srv0mon.h
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,7 @@ enum monitor_id_t {
MONITOR_OVLD_PAGE_COMPRESSED_TRIM_OP,
MONITOR_OVLD_PAGE_COMPRESSED_TRIM_OP_SAVED,
MONITOR_OVLD_PAGES_PAGE_DECOMPRESSED,
MONITOR_OVLD_PAGES_PAGE_COMPRESSION_ERROR,

/* Index related counters */
MONITOR_MODULE_INDEX,
Expand Down
4 changes: 4 additions & 0 deletions storage/innobase/include/srv0srv.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@ struct srv_stats_t {
ulint_ctr_64_t page_compressed_trim_op_saved;
/* Number of pages decompressed with page compression */
ulint_ctr_64_t pages_page_decompressed;
/* Number of page compression errors */
ulint_ctr_64_t pages_page_compression_error;

/** Number of data read in total (in bytes) */
ulint_ctr_1_t data_read;
Expand Down Expand Up @@ -908,6 +910,8 @@ struct export_var_t{
ib_int64_t innodb_pages_page_decompressed;/*!< Number of pages
decompressed by page
compression */
ib_int64_t innodb_pages_page_compression_error;/*!< Number of page
compression errors */
};

/** Thread slot in the thread table. */
Expand Down
2 changes: 1 addition & 1 deletion storage/innobase/os/os0file.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6166,7 +6166,7 @@ os_file_trim(
*slot->write_size > 0 &&
len >= *slot->write_size)) {

#ifdef UNIV_DEBUG
#ifdef UNIV_PAGECOMPRESS_DEBUG
fprintf(stderr, "Note: TRIM: write_size %lu trim_len %lu len %lu\n",
*slot->write_size, trim_len, len);
#endif
Expand Down
8 changes: 8 additions & 0 deletions storage/innobase/srv/srv0mon.cc
Original file line number Diff line number Diff line change
Expand Up @@ -926,6 +926,11 @@ static monitor_info_t innodb_counter_info[] =
MONITOR_NONE,
MONITOR_DEFAULT_START, MONITOR_OVLD_PAGES_PAGE_DECOMPRESSED},

{"compress_pages_page_compression_error", "compression",
"Number of page compression errors",
MONITOR_NONE,
MONITOR_DEFAULT_START, MONITOR_OVLD_PAGES_PAGE_COMPRESSION_ERROR},

/* ========== Counters for Index ========== */
{"module_index", "index", "Index Manager",
MONITOR_MODULE,
Expand Down Expand Up @@ -1871,6 +1876,9 @@ srv_mon_process_existing_counter(
case MONITOR_OVLD_PAGES_PAGE_DECOMPRESSED:
value = srv_stats.pages_page_decompressed;
break;
case MONITOR_OVLD_PAGES_PAGE_COMPRESSION_ERROR:
value = srv_stats.pages_page_compression_error;
break;

default:
ut_error;
Expand Down
14 changes: 7 additions & 7 deletions storage/xtradb/buf/buf0flu.cc
Original file line number Diff line number Diff line change
Expand Up @@ -721,7 +721,7 @@ buf_flush_write_complete(

buf_pool->n_flush[flush_type]--;

#ifdef UNIV_DEBUG
#ifdef UNIV_MTFLUSH_DEBUG
fprintf(stderr, "n pending flush %lu\n",
buf_pool->n_flush[flush_type]);
#endif
Expand Down Expand Up @@ -1863,7 +1863,7 @@ buf_flush_start(

/* There is already a flush batch of the same type running */

#ifdef UNIV_DEBUG
#ifdef UNIV_PAGECOMPRESS_DEBUG
fprintf(stderr, "Error: flush_type %d n_flush %lu init_flush %lu\n",
flush_type, buf_pool->n_flush[flush_type], buf_pool->init_flush[flush_type]);
#endif
Expand Down Expand Up @@ -2732,7 +2732,7 @@ DECLARE_THREAD(buf_flush_page_cleaner_thread)(

/* Flush pages from end of LRU if required */
n_lru = n_flushed = buf_flush_LRU_tail();
#ifdef UNIV_DEBUG
#ifdef UNIV_MTFLUSH_DEBUG
if (n_lru) {
fprintf(stderr,"n_lru:%lu ",n_lru);
}
Expand All @@ -2743,7 +2743,7 @@ DECLARE_THREAD(buf_flush_page_cleaner_thread)(

/* Flush pages from flush_list if required */
n_flushed += n_pgc_flush = page_cleaner_flush_pages_if_needed();
#ifdef UNIV_DEBUG
#ifdef UNIV_MTFLUSH_DEBUG
if (n_pgc_flush) {
fprintf(stderr,"n_pgc_flush:%lu ",n_pgc_flush);
}
Expand All @@ -2760,16 +2760,16 @@ DECLARE_THREAD(buf_flush_page_cleaner_thread)(
MONITOR_FLUSH_BACKGROUND_PAGES,
n_flushed);
}
#ifdef UNIV_DEBUG
#ifdef UNIV_MTFLUSH_DEBUG
if (n_pgc_batch) {
fprintf(stderr,"n_pgc_batch:%lu ",n_pgc_batch);
}
#endif
}

#ifdef UNIV_DEBUG
#ifdef UNIV_MTFLUSH_DEBUG
if (n_lru || n_pgc_flush || n_pgc_batch) {
fprintf(stderr,"\n");
fprintf1(stderr,"\n");
n_lru = n_pgc_flush = n_pgc_batch = 0;
}
#endif
Expand Down
14 changes: 8 additions & 6 deletions storage/xtradb/buf/buf0mtflu.cc
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ buf_mtflu_flush_pool_instance(
pools based on the assumption that it will
help in the retry which will follow the
failure. */
#ifdef UNIV_DEBUG
#ifdef UNIV_MTFLUSH_DEBUG
fprintf(stderr, "InnoDB: Note: buf flush start failed there is already active flush for this buffer pool.\n");
#endif
return 0;
Expand Down Expand Up @@ -337,12 +337,12 @@ DECLARE_THREAD(mtflush_io_thread)(

while (TRUE) {

#ifdef UNIV_DEBUG
#ifdef UNIV_MTFLUSH_DEBUG
fprintf(stderr, "InnoDB: Note. Thread %lu work queue len %lu return queue len %lu\n",
os_thread_get_curr_id(),
ib_wqueue_len(mtflush_io->wq),
ib_wqueue_len(mtflush_io->wr_cq));
#endif /* UNIV_DEBUG */
#endif /* UNIV_MTFLUSH_DEBUG */

mtflush_service_io(mtflush_io, this_thread_data);

Expand Down Expand Up @@ -381,7 +381,7 @@ buf_mtflu_io_thread_exit(void)

mtflush_io->gwt_status = WTHR_KILL_IT;

fprintf(stderr, "signal mtflush_io_threads to exit [%lu]\n",
fprintf(stderr, "InnoDB: [Note]: Signal mtflush_io_threads to exit [%lu]\n",
srv_mtflush_threads);

/* Send one exit work item/thread */
Expand Down Expand Up @@ -551,6 +551,7 @@ buf_mtflu_flush_work_items(
if (done_wi != NULL) {
per_pool_pages_flushed[i] = done_wi->n_flushed;

#if UNIV_DEBUG
if((int)done_wi->id_usr == 0 &&
(done_wi->wi_status == WRK_ITEM_SET ||
done_wi->wi_status == WRK_ITEM_UNSET)) {
Expand All @@ -560,6 +561,7 @@ buf_mtflu_flush_work_items(
done_wi->wr.flush_type);
ut_a(0);
}
#endif

n_flushed+= done_wi->n_flushed;
i++;
Expand Down Expand Up @@ -631,7 +633,7 @@ buf_mtflu_flush_list(
cnt_flush[i]);
}
}
#ifdef UNIV_DEBUG
#ifdef UNIV_MTFLUSH_DEBUG
fprintf(stderr, "%s: [1] [*n_processed: (min:%lu)%lu ]\n",
__FUNCTION__, (min_n * srv_buf_pool_instances), *n_processed);
#endif
Expand Down Expand Up @@ -673,7 +675,7 @@ buf_mtflu_flush_LRU_tail(void)
}
}

#if UNIV_DEBUG
#if UNIV_MTFLUSH_DEBUG
fprintf(stderr, "[1] [*n_processed: (min:%lu)%lu ]\n", (
srv_LRU_scan_depth * srv_buf_pool_instances), total_flushed);
#endif
Expand Down
Loading

0 comments on commit 6a756b3

Please sign in to comment.