Commit bd8d5d3e authored by marko's avatar marko

branches/zip: Rename the INFORMATION_SCHEMA tables

INNODB_ZIP and INNODB_ZIP_RESET to
INNODB_COMPRESSION and INNODB_COMPRESSION_RESET,
and remove the statistics of the buddy system.

This change was discussed with Ken.  It makes the tables shorter
and easier to understand.  The removed data will be represented in
the tables INNODB_COMPRESSION_BUDDY and INNODB_COMPRESSION_BUDDY_RESET
that will be added later.

i_s_innodb_zip, i_s_innodb_zip_reset, i_s_zip_fields_info[],
i_s_zip_fill_low(), i_s_zip_fill(), i_s_zip_reset_fill(),
i_s_zip_init(), i_s_zip_reset_init(): Replace "zip" with "compression".

i_s_compression_fields_info[]: Remove "used", "free",
"relocated", "relocated_usec".  In "compressed_usec" and "decompressed_usec",
replace microseconds with seconds ("usec" with "sec").

page_zip_decompress(): Correct a typo in the function comment.

PAGE_ZIP_SSIZE_BITS, PAGE_ZIP_NUM_SSIZE: New constants.

page_zip_stat_t, page_zip_stat: Statistics of the compression, grouped
by page size.

page_zip_simple_validate(): Assert that page_zip->ssize is reasonable.
parent f8eba2fa
......@@ -8824,8 +8824,8 @@ mysql_declare_plugin(innobase)
i_s_innodb_trx,
i_s_innodb_locks,
i_s_innodb_lock_waits,
i_s_innodb_zip,
i_s_innodb_zip_reset
i_s_innodb_compression,
i_s_innodb_compression_reset
mysql_declare_plugin_end;
#ifdef UNIV_COMPILE_TEST_FUNCS
......
This diff is collapsed.
......@@ -12,7 +12,7 @@ Created July 18, 2007 Vasil Dimov
extern struct st_mysql_plugin i_s_innodb_trx;
extern struct st_mysql_plugin i_s_innodb_locks;
extern struct st_mysql_plugin i_s_innodb_lock_waits;
extern struct st_mysql_plugin i_s_innodb_zip;
extern struct st_mysql_plugin i_s_innodb_zip_reset;
extern struct st_mysql_plugin i_s_innodb_compression;
extern struct st_mysql_plugin i_s_innodb_compression_reset;
#endif /* i_s_h */
......@@ -27,6 +27,16 @@ typedef struct page_zip_des_struct page_zip_des_t;
but we cannot include page0zip.h from rem0rec.ic, because
page0*.h includes rem0rec.h and may include rem0rec.ic. */
#define PAGE_ZIP_SSIZE_BITS 3
#define PAGE_ZIP_MIN_SIZE_SHIFT 10 /* log2 of smallest compressed size */
#define PAGE_ZIP_MIN_SIZE (1 << PAGE_ZIP_MIN_SIZE_SHIFT)
#define PAGE_ZIP_NUM_SSIZE (UNIV_PAGE_SIZE_SHIFT - PAGE_ZIP_MIN_SIZE_SHIFT + 2)
#if PAGE_ZIP_NUM_SSIZE > (1 << PAGE_ZIP_SSIZE_BITS)
# error "PAGE_ZIP_NUM_SSIZE > (1 << PAGE_ZIP_SSIZE_BITS)"
#endif
/* Compressed page descriptor */
struct page_zip_des_struct
{
......@@ -41,24 +51,30 @@ struct page_zip_des_struct
unsigned n_blobs:12; /* number of externally stored
columns on the page; the maximum
is 744 on a 16 KiB page */
unsigned ssize:3; /* 0 or compressed page size;
unsigned ssize:PAGE_ZIP_SSIZE_BITS;
/* 0 or compressed page size;
the size in bytes is
PAGE_ZIP_MIN_SIZE << (ssize - 1). */
};
#define PAGE_ZIP_MIN_SIZE_SHIFT 10 /* log2 of smallest compressed size */
#define PAGE_ZIP_MIN_SIZE (1 << PAGE_ZIP_MIN_SIZE_SHIFT)
/** Compression statistics for a given page size */
struct page_zip_stat_struct {
/** Number of page compressions */
ulint compressed;
/** Number of successful page compressions */
ulint compressed_ok;
/** Number of page decompressions */
ulint decompressed;
/** Duration of page compressions in microseconds */
ib_uint64_t compressed_usec;
/** Duration of page decompressions in microseconds */
ib_uint64_t decompressed_usec;
};
typedef struct page_zip_stat_struct page_zip_stat_t;
/** Number of page compressions, indexed by page_zip_des_t::ssize */
extern ulint page_zip_compress_count[8];
/** Number of successful page compressions, indexed by page_zip_des_t::ssize */
extern ulint page_zip_compress_ok[8];
/** Number of page decompressions, indexed by page_zip_des_t::ssize */
extern ulint page_zip_decompress_count[8];
/** Duration of page compressions, indexed by page_zip_des_t::ssize */
extern ullint page_zip_compress_duration[8];
/** Duration of page decompressions, indexed by page_zip_des_t::ssize */
extern ullint page_zip_decompress_duration[8];
/** Statistics on compression, indexed by page_zip_des_t::ssize - 1 */
extern page_zip_stat_t page_zip_stat[PAGE_ZIP_NUM_SSIZE - 1];
/**************************************************************************
Write data to the compressed page. The data must already be written to
......
......@@ -104,7 +104,7 @@ ibool
page_zip_decompress(
/*================*/
/* out: TRUE on success, FALSE on failure */
page_zip_des_t* page_zip,/* in: data, size;
page_zip_des_t* page_zip,/* in: data, ssize;
out: m_start, m_end, m_nonempty, n_blobs */
page_t* page) /* out: uncompressed page, may be trashed */
__attribute__((nonnull));
......
......@@ -188,6 +188,7 @@ page_zip_simple_validate(
{
ut_ad(page_zip);
ut_ad(page_zip->data);
ut_ad(page_zip->ssize < PAGE_ZIP_NUM_SSIZE);
ut_ad(page_zip_get_size(page_zip)
> PAGE_DATA + PAGE_ZIP_DIR_SLOT_SIZE);
ut_ad(page_zip->m_start <= page_zip->m_end);
......
......@@ -25,16 +25,8 @@ Created June 2005 by Marko Makela
#include "zlib.h"
#include "buf0lru.h"
/** Number of page compressions, indexed by page_zip_des_t::ssize */
UNIV_INTERN ulint page_zip_compress_count[8];
/** Number of successful page compressions, indexed by page_zip_des_t::ssize */
UNIV_INTERN ulint page_zip_compress_ok[8];
/** Number of page decompressions, indexed by page_zip_des_t::ssize */
UNIV_INTERN ulint page_zip_decompress_count[8];
/** Duration of page compressions, indexed by page_zip_des_t::ssize */
UNIV_INTERN ullint page_zip_compress_duration[8];
/** Duration of page decompressions, indexed by page_zip_des_t::ssize */
UNIV_INTERN ullint page_zip_decompress_duration[8];
/** Statistics on compression, indexed by page_zip_des_t::ssize - 1 */
UNIV_INTERN page_zip_stat_t page_zip_stat[PAGE_ZIP_NUM_SSIZE - 1];
/* Please refer to ../include/page0zip.ic for a description of the
compressed page format. */
......@@ -1171,7 +1163,7 @@ page_zip_compress(
}
}
#endif /* PAGE_ZIP_COMPRESS_DBG */
page_zip_compress_count[page_zip->ssize]++;
page_zip_stat[page_zip->ssize - 1].compressed++;
if (UNIV_UNLIKELY(n_dense * PAGE_ZIP_DIR_SLOT_SIZE
>= page_zip_get_size(page_zip))) {
......@@ -1308,7 +1300,7 @@ err_exit:
fclose(logfile);
}
#endif /* PAGE_ZIP_COMPRESS_DBG */
page_zip_compress_duration[page_zip->ssize]
page_zip_stat[page_zip->ssize - 1].compressed_usec
+= ut_time_us(NULL) - usec;
return(FALSE);
}
......@@ -1353,8 +1345,6 @@ err_exit:
page_zip_compress_write_log(page_zip, page, index, mtr);
}
page_zip_compress_ok[page_zip->ssize]++;
UNIV_MEM_ASSERT_RW(page_zip->data, page_zip_get_size(page_zip));
#ifdef PAGE_ZIP_COMPRESS_DBG
......@@ -1367,8 +1357,13 @@ err_exit:
fclose(logfile);
}
#endif /* PAGE_ZIP_COMPRESS_DBG */
page_zip_compress_duration[page_zip->ssize]
+= ut_time_us(NULL) - usec;
{
page_zip_stat_t* zip_stat
= &page_zip_stat[page_zip->ssize - 1];
zip_stat->compressed_ok++;
zip_stat->compressed_usec += ut_time_us(NULL) - usec;
}
return(TRUE);
}
......@@ -2775,7 +2770,7 @@ ibool
page_zip_decompress(
/*================*/
/* out: TRUE on success, FALSE on failure */
page_zip_des_t* page_zip,/* in: data, size;
page_zip_des_t* page_zip,/* in: data, ssize;
out: m_start, m_end, m_nonempty, n_blobs */
page_t* page) /* out: uncompressed page, may be trashed */
{
......@@ -2942,9 +2937,12 @@ err_exit:
page_zip_fields_free(index);
mem_heap_free(heap);
page_zip_decompress_count[page_zip->ssize]++;
page_zip_decompress_duration[page_zip->ssize]
+= ut_time_us(NULL) - usec;
{
page_zip_stat_t* zip_stat
= &page_zip_stat[page_zip->ssize - 1];
zip_stat->decompressed++;
zip_stat->decompressed_usec += ut_time_us(NULL) - usec;
}
/* Update the stat counter for LRU policy. */
buf_LRU_stat_inc_unzip();
......
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