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) ...@@ -8824,8 +8824,8 @@ mysql_declare_plugin(innobase)
i_s_innodb_trx, i_s_innodb_trx,
i_s_innodb_locks, i_s_innodb_locks,
i_s_innodb_lock_waits, i_s_innodb_lock_waits,
i_s_innodb_zip, i_s_innodb_compression,
i_s_innodb_zip_reset i_s_innodb_compression_reset
mysql_declare_plugin_end; mysql_declare_plugin_end;
#ifdef UNIV_COMPILE_TEST_FUNCS #ifdef UNIV_COMPILE_TEST_FUNCS
......
...@@ -20,7 +20,6 @@ Created July 18, 2007 Vasil Dimov ...@@ -20,7 +20,6 @@ Created July 18, 2007 Vasil Dimov
extern "C" { extern "C" {
#include "trx0i_s.h" #include "trx0i_s.h"
#include "trx0trx.h" /* for TRX_QUE_STATE_STR_MAX_LEN */ #include "trx0trx.h" /* for TRX_QUE_STATE_STR_MAX_LEN */
#include "buf0buddy.h" /* for i_s_zip */
#include "buf0buf.h" /* for buf_pool and PAGE_ZIP_MIN_SIZE */ #include "buf0buf.h" /* for buf_pool and PAGE_ZIP_MIN_SIZE */
#include "ha_prototypes.h" /* for innobase_convert_name() */ #include "ha_prototypes.h" /* for innobase_convert_name() */
} }
...@@ -981,8 +980,8 @@ trx_i_s_common_fill_table( ...@@ -981,8 +980,8 @@ trx_i_s_common_fill_table(
#endif #endif
} }
/* Fields of the dynamic table information_schema.innodb_zip. */ /* Fields of the dynamic table information_schema.innodb_compression. */
static ST_FIELD_INFO i_s_zip_fields_info[] = static ST_FIELD_INFO i_s_compression_fields_info[] =
{ {
{STRUCT_FLD(field_name, "size"), {STRUCT_FLD(field_name, "size"),
STRUCT_FLD(field_length, 5), STRUCT_FLD(field_length, 5),
...@@ -992,38 +991,6 @@ static ST_FIELD_INFO i_s_zip_fields_info[] = ...@@ -992,38 +991,6 @@ static ST_FIELD_INFO i_s_zip_fields_info[] =
STRUCT_FLD(old_name, "Block Size"), STRUCT_FLD(old_name, "Block Size"),
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
{STRUCT_FLD(field_name, "used"),
STRUCT_FLD(field_length, 21),
STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
STRUCT_FLD(value, 0),
STRUCT_FLD(field_flags, 0),
STRUCT_FLD(old_name, "Currently in Use"),
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
{STRUCT_FLD(field_name, "free"),
STRUCT_FLD(field_length, 21),
STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
STRUCT_FLD(value, 0),
STRUCT_FLD(field_flags, 0),
STRUCT_FLD(old_name, "Currently Available"),
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
{STRUCT_FLD(field_name, "relocated"),
STRUCT_FLD(field_length, 21),
STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
STRUCT_FLD(value, 0),
STRUCT_FLD(field_flags, 0),
STRUCT_FLD(old_name, "Total Number of Relocations"),
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
{STRUCT_FLD(field_name, "relocated_usec"),
STRUCT_FLD(field_length, 42),
STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
STRUCT_FLD(value, 0),
STRUCT_FLD(field_flags, 0),
STRUCT_FLD(old_name, "Total Duration of Relocations"),
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
{STRUCT_FLD(field_name, "compressed"), {STRUCT_FLD(field_name, "compressed"),
STRUCT_FLD(field_length, 21), STRUCT_FLD(field_length, 21),
STRUCT_FLD(field_type, MYSQL_TYPE_LONG), STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
...@@ -1041,9 +1008,9 @@ static ST_FIELD_INFO i_s_zip_fields_info[] = ...@@ -1041,9 +1008,9 @@ static ST_FIELD_INFO i_s_zip_fields_info[] =
" Successful Compressions"), " Successful Compressions"),
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
{STRUCT_FLD(field_name, "compressed_usec"), {STRUCT_FLD(field_name, "compressed_sec"),
STRUCT_FLD(field_length, 42), STRUCT_FLD(field_length, 42),
STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG), STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
STRUCT_FLD(value, 0), STRUCT_FLD(value, 0),
STRUCT_FLD(field_flags, 0), STRUCT_FLD(field_flags, 0),
STRUCT_FLD(old_name, "Total Duration of Compressions"), STRUCT_FLD(old_name, "Total Duration of Compressions"),
...@@ -1057,9 +1024,9 @@ static ST_FIELD_INFO i_s_zip_fields_info[] = ...@@ -1057,9 +1024,9 @@ static ST_FIELD_INFO i_s_zip_fields_info[] =
STRUCT_FLD(old_name, "Total Number of Decompressions"), STRUCT_FLD(old_name, "Total Number of Decompressions"),
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
{STRUCT_FLD(field_name, "decompressed_usec"), {STRUCT_FLD(field_name, "decompressed_sec"),
STRUCT_FLD(field_length, 42), STRUCT_FLD(field_length, 42),
STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG), STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
STRUCT_FLD(value, 0), STRUCT_FLD(value, 0),
STRUCT_FLD(field_flags, 0), STRUCT_FLD(field_flags, 0),
STRUCT_FLD(old_name, "Total Duration of Decompressions"), STRUCT_FLD(old_name, "Total Duration of Decompressions"),
...@@ -1070,11 +1037,12 @@ static ST_FIELD_INFO i_s_zip_fields_info[] = ...@@ -1070,11 +1037,12 @@ static ST_FIELD_INFO i_s_zip_fields_info[] =
/*********************************************************************** /***********************************************************************
Fill the dynamic table information_schema.innodb_zip or innodb_zip_reset. */ Fill the dynamic table information_schema.innodb_compression or
innodb_compression_reset. */
static static
int int
i_s_zip_fill_low( i_s_compression_fill_low(
/*=============*/ /*=====================*/
/* out: 0 on success, 1 on failure */ /* out: 0 on success, 1 on failure */
THD* thd, /* in: thread */ THD* thd, /* in: thread */
TABLE_LIST* tables, /* in/out: tables to fill */ TABLE_LIST* tables, /* in/out: tables to fill */
...@@ -1083,9 +1051,8 @@ i_s_zip_fill_low( ...@@ -1083,9 +1051,8 @@ i_s_zip_fill_low(
{ {
TABLE* table = (TABLE *) tables->table; TABLE* table = (TABLE *) tables->table;
int status = 0; int status = 0;
uint y = 0;
DBUG_ENTER("i_s_zip_fill_low"); DBUG_ENTER("i_s_compression_fill_low");
/* deny access to non-superusers */ /* deny access to non-superusers */
if (check_global_access(thd, PROCESS_ACL)) { if (check_global_access(thd, PROCESS_ACL)) {
...@@ -1093,58 +1060,29 @@ i_s_zip_fill_low( ...@@ -1093,58 +1060,29 @@ i_s_zip_fill_low(
DBUG_RETURN(0); DBUG_RETURN(0);
} }
/* Determine log2(PAGE_ZIP_MIN_SIZE / 2 / BUF_BUDDY_LOW). */
for (uint r = PAGE_ZIP_MIN_SIZE / 2 / BUF_BUDDY_LOW; r >>= 1; y++);
buf_pool_mutex_enter(); buf_pool_mutex_enter();
for (uint x = 0; x <= BUF_BUDDY_SIZES; x++) { for (uint i = 0; i < PAGE_ZIP_NUM_SSIZE - 1; i++) {
table->field[0]->store(BUF_BUDDY_LOW << x); page_zip_stat_t* zip_stat = &page_zip_stat[i];
table->field[1]->store(buf_buddy_used[x]);
table->field[2]->store(UNIV_LIKELY(x < BUF_BUDDY_SIZES) table->field[0]->store(PAGE_ZIP_MIN_SIZE << i);
? UT_LIST_GET_LEN(buf_pool->zip_free[x])
: 0); /* The cumulated counts are not protected by any
table->field[3]->store((longlong) buf_buddy_relocated[x], mutex. Thus, some operation in page0zip.c could
true); increment a counter between the time we read it and
table->field[4]->store((longlong) clear it. We could introduce mutex protection, but it
buf_buddy_relocated_duration[x], true); could cause a measureable performance hit in
page0zip.c. */
table->field[1]->store(zip_stat->compressed);
table->field[2]->store(zip_stat->compressed_ok);
table->field[3]->store(
(ulong) (zip_stat->compressed_usec / 1000000));
table->field[4]->store(zip_stat->decompressed);
table->field[5]->store(
(ulong) (zip_stat->decompressed_usec / 1000000));
if (reset) { if (reset) {
/* This is protected by buf_pool_mutex. */ memset(zip_stat, 0, sizeof *zip_stat);
buf_buddy_relocated[x] = 0;
buf_buddy_relocated_duration[x] = 0;
}
if (x > y) {
/* The cumulated counts are not protected by
any mutex. Thus, some operation in page0zip.c
could increment a counter between the time we
read it and clear it. We could introduce
mutex protection, but it could cause a
measureable performance hit in page0zip.c. */
const uint i = x - y;
table->field[5]->store(page_zip_compress_count[i]);
table->field[6]->store(page_zip_compress_ok[i]);
table->field[7]->store((longlong)
page_zip_compress_duration[i],
true);
table->field[8]->store(page_zip_decompress_count[i]);
table->field[9]->store((longlong)
page_zip_decompress_duration[i],
true);
if (reset) {
page_zip_compress_count[i] = 0;
page_zip_compress_ok[i] = 0;
page_zip_decompress_count[i] = 0;
page_zip_compress_duration[i] = 0;
page_zip_decompress_duration[i] = 0;
}
} else {
table->field[5]->store(0);
table->field[6]->store(0);
table->field[7]->store(0);
table->field[8]->store(0);
table->field[9]->store(0);
} }
if (schema_table_store_record(thd, table)) { if (schema_table_store_record(thd, table)) {
...@@ -1158,70 +1096,70 @@ i_s_zip_fill_low( ...@@ -1158,70 +1096,70 @@ i_s_zip_fill_low(
} }
/*********************************************************************** /***********************************************************************
Fill the dynamic table information_schema.innodb_zip. */ Fill the dynamic table information_schema.innodb_compression. */
static static
int int
i_s_zip_fill( i_s_compression_fill(
/*=========*/ /*=================*/
/* out: 0 on success, 1 on failure */ /* out: 0 on success, 1 on failure */
THD* thd, /* in: thread */ THD* thd, /* in: thread */
TABLE_LIST* tables, /* in/out: tables to fill */ TABLE_LIST* tables, /* in/out: tables to fill */
COND* cond) /* in: condition (ignored) */ COND* cond) /* in: condition (ignored) */
{ {
return(i_s_zip_fill_low(thd, tables, cond, FALSE)); return(i_s_compression_fill_low(thd, tables, cond, FALSE));
} }
/*********************************************************************** /***********************************************************************
Fill the dynamic table information_schema.innodb_zip_reset. */ Fill the dynamic table information_schema.innodb_compression_reset. */
static static
int int
i_s_zip_reset_fill( i_s_compression_reset_fill(
/*===============*/ /*=======================*/
/* out: 0 on success, 1 on failure */ /* out: 0 on success, 1 on failure */
THD* thd, /* in: thread */ THD* thd, /* in: thread */
TABLE_LIST* tables, /* in/out: tables to fill */ TABLE_LIST* tables, /* in/out: tables to fill */
COND* cond) /* in: condition (ignored) */ COND* cond) /* in: condition (ignored) */
{ {
return(i_s_zip_fill_low(thd, tables, cond, TRUE)); return(i_s_compression_fill_low(thd, tables, cond, TRUE));
} }
/*********************************************************************** /***********************************************************************
Bind the dynamic table information_schema.innodb_zip. */ Bind the dynamic table information_schema.innodb_compression. */
static static
int int
i_s_zip_init( i_s_compression_init(
/*=========*/ /*=================*/
/* out: 0 on success */ /* out: 0 on success */
void* p) /* in/out: table schema object */ void* p) /* in/out: table schema object */
{ {
DBUG_ENTER("i_s_zip_init"); DBUG_ENTER("i_s_compression_init");
ST_SCHEMA_TABLE* schema = (ST_SCHEMA_TABLE*) p; ST_SCHEMA_TABLE* schema = (ST_SCHEMA_TABLE*) p;
schema->fields_info = i_s_zip_fields_info; schema->fields_info = i_s_compression_fields_info;
schema->fill_table = i_s_zip_fill; schema->fill_table = i_s_compression_fill;
DBUG_RETURN(0); DBUG_RETURN(0);
} }
/*********************************************************************** /***********************************************************************
Bind the dynamic table information_schema.innodb_zip_reset. */ Bind the dynamic table information_schema.innodb_compression_reset. */
static static
int int
i_s_zip_reset_init( i_s_compression_reset_init(
/*===============*/ /*=======================*/
/* out: 0 on success */ /* out: 0 on success */
void* p) /* in/out: table schema object */ void* p) /* in/out: table schema object */
{ {
DBUG_ENTER("i_s_zip_reset_init"); DBUG_ENTER("i_s_compression_reset_init");
ST_SCHEMA_TABLE* schema = (ST_SCHEMA_TABLE*) p; ST_SCHEMA_TABLE* schema = (ST_SCHEMA_TABLE*) p;
schema->fields_info = i_s_zip_fields_info; schema->fields_info = i_s_compression_fields_info;
schema->fill_table = i_s_zip_reset_fill; schema->fill_table = i_s_compression_reset_fill;
DBUG_RETURN(0); DBUG_RETURN(0);
} }
UNIV_INTERN struct st_mysql_plugin i_s_innodb_zip = UNIV_INTERN struct st_mysql_plugin i_s_innodb_compression =
{ {
/* the plugin type (a MYSQL_XXX_PLUGIN value) */ /* the plugin type (a MYSQL_XXX_PLUGIN value) */
/* int */ /* int */
...@@ -1233,7 +1171,7 @@ UNIV_INTERN struct st_mysql_plugin i_s_innodb_zip = ...@@ -1233,7 +1171,7 @@ UNIV_INTERN struct st_mysql_plugin i_s_innodb_zip =
/* plugin name */ /* plugin name */
/* const char* */ /* const char* */
STRUCT_FLD(name, "INNODB_ZIP"), STRUCT_FLD(name, "INNODB_COMPRESSION"),
/* plugin author (for SHOW PLUGINS) */ /* plugin author (for SHOW PLUGINS) */
/* const char* */ /* const char* */
...@@ -1249,7 +1187,7 @@ UNIV_INTERN struct st_mysql_plugin i_s_innodb_zip = ...@@ -1249,7 +1187,7 @@ UNIV_INTERN struct st_mysql_plugin i_s_innodb_zip =
/* the function to invoke when plugin is loaded */ /* the function to invoke when plugin is loaded */
/* int (*)(void*); */ /* int (*)(void*); */
STRUCT_FLD(init, i_s_zip_init), STRUCT_FLD(init, i_s_compression_init),
/* the function to invoke when plugin is unloaded */ /* the function to invoke when plugin is unloaded */
/* int (*)(void*); */ /* int (*)(void*); */
...@@ -1270,7 +1208,7 @@ UNIV_INTERN struct st_mysql_plugin i_s_innodb_zip = ...@@ -1270,7 +1208,7 @@ UNIV_INTERN struct st_mysql_plugin i_s_innodb_zip =
STRUCT_FLD(__reserved1, NULL) STRUCT_FLD(__reserved1, NULL)
}; };
UNIV_INTERN struct st_mysql_plugin i_s_innodb_zip_reset = UNIV_INTERN struct st_mysql_plugin i_s_innodb_compression_reset =
{ {
/* the plugin type (a MYSQL_XXX_PLUGIN value) */ /* the plugin type (a MYSQL_XXX_PLUGIN value) */
/* int */ /* int */
...@@ -1282,7 +1220,7 @@ UNIV_INTERN struct st_mysql_plugin i_s_innodb_zip_reset = ...@@ -1282,7 +1220,7 @@ UNIV_INTERN struct st_mysql_plugin i_s_innodb_zip_reset =
/* plugin name */ /* plugin name */
/* const char* */ /* const char* */
STRUCT_FLD(name, "INNODB_ZIP_RESET"), STRUCT_FLD(name, "INNODB_COMPRESSION_RESET"),
/* plugin author (for SHOW PLUGINS) */ /* plugin author (for SHOW PLUGINS) */
/* const char* */ /* const char* */
...@@ -1299,7 +1237,7 @@ UNIV_INTERN struct st_mysql_plugin i_s_innodb_zip_reset = ...@@ -1299,7 +1237,7 @@ UNIV_INTERN struct st_mysql_plugin i_s_innodb_zip_reset =
/* the function to invoke when plugin is loaded */ /* the function to invoke when plugin is loaded */
/* int (*)(void*); */ /* int (*)(void*); */
STRUCT_FLD(init, i_s_zip_reset_init), STRUCT_FLD(init, i_s_compression_reset_init),
/* the function to invoke when plugin is unloaded */ /* the function to invoke when plugin is unloaded */
/* int (*)(void*); */ /* int (*)(void*); */
......
...@@ -12,7 +12,7 @@ Created July 18, 2007 Vasil Dimov ...@@ -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_trx;
extern struct st_mysql_plugin i_s_innodb_locks; 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_lock_waits;
extern struct st_mysql_plugin i_s_innodb_zip; extern struct st_mysql_plugin i_s_innodb_compression;
extern struct st_mysql_plugin i_s_innodb_zip_reset; extern struct st_mysql_plugin i_s_innodb_compression_reset;
#endif /* i_s_h */ #endif /* i_s_h */
...@@ -27,6 +27,16 @@ typedef struct page_zip_des_struct page_zip_des_t; ...@@ -27,6 +27,16 @@ typedef struct page_zip_des_struct page_zip_des_t;
but we cannot include page0zip.h from rem0rec.ic, because but we cannot include page0zip.h from rem0rec.ic, because
page0*.h includes rem0rec.h and may include rem0rec.ic. */ 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 */ /* Compressed page descriptor */
struct page_zip_des_struct struct page_zip_des_struct
{ {
...@@ -41,24 +51,30 @@ struct page_zip_des_struct ...@@ -41,24 +51,30 @@ struct page_zip_des_struct
unsigned n_blobs:12; /* number of externally stored unsigned n_blobs:12; /* number of externally stored
columns on the page; the maximum columns on the page; the maximum
is 744 on a 16 KiB page */ 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 the size in bytes is
PAGE_ZIP_MIN_SIZE << (ssize - 1). */ PAGE_ZIP_MIN_SIZE << (ssize - 1). */
}; };
#define PAGE_ZIP_MIN_SIZE_SHIFT 10 /* log2 of smallest compressed size */ /** Compression statistics for a given page size */
#define PAGE_ZIP_MIN_SIZE (1 << PAGE_ZIP_MIN_SIZE_SHIFT) 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 */ /** Statistics on compression, indexed by page_zip_des_t::ssize - 1 */
extern ulint page_zip_compress_count[8]; extern page_zip_stat_t page_zip_stat[PAGE_ZIP_NUM_SSIZE - 1];
/** 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];
/************************************************************************** /**************************************************************************
Write data to the compressed page. The data must already be written to Write data to the compressed page. The data must already be written to
......
...@@ -104,7 +104,7 @@ ibool ...@@ -104,7 +104,7 @@ ibool
page_zip_decompress( page_zip_decompress(
/*================*/ /*================*/
/* out: TRUE on success, FALSE on failure */ /* 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 */ out: m_start, m_end, m_nonempty, n_blobs */
page_t* page) /* out: uncompressed page, may be trashed */ page_t* page) /* out: uncompressed page, may be trashed */
__attribute__((nonnull)); __attribute__((nonnull));
......
...@@ -188,6 +188,7 @@ page_zip_simple_validate( ...@@ -188,6 +188,7 @@ page_zip_simple_validate(
{ {
ut_ad(page_zip); ut_ad(page_zip);
ut_ad(page_zip->data); ut_ad(page_zip->data);
ut_ad(page_zip->ssize < PAGE_ZIP_NUM_SSIZE);
ut_ad(page_zip_get_size(page_zip) ut_ad(page_zip_get_size(page_zip)
> PAGE_DATA + PAGE_ZIP_DIR_SLOT_SIZE); > PAGE_DATA + PAGE_ZIP_DIR_SLOT_SIZE);
ut_ad(page_zip->m_start <= page_zip->m_end); ut_ad(page_zip->m_start <= page_zip->m_end);
......
...@@ -25,16 +25,8 @@ Created June 2005 by Marko Makela ...@@ -25,16 +25,8 @@ Created June 2005 by Marko Makela
#include "zlib.h" #include "zlib.h"
#include "buf0lru.h" #include "buf0lru.h"
/** Number of page compressions, indexed by page_zip_des_t::ssize */ /** Statistics on compression, indexed by page_zip_des_t::ssize - 1 */
UNIV_INTERN ulint page_zip_compress_count[8]; UNIV_INTERN page_zip_stat_t page_zip_stat[PAGE_ZIP_NUM_SSIZE - 1];
/** 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];
/* Please refer to ../include/page0zip.ic for a description of the /* Please refer to ../include/page0zip.ic for a description of the
compressed page format. */ compressed page format. */
...@@ -1171,7 +1163,7 @@ page_zip_compress( ...@@ -1171,7 +1163,7 @@ page_zip_compress(
} }
} }
#endif /* PAGE_ZIP_COMPRESS_DBG */ #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 if (UNIV_UNLIKELY(n_dense * PAGE_ZIP_DIR_SLOT_SIZE
>= page_zip_get_size(page_zip))) { >= page_zip_get_size(page_zip))) {
...@@ -1308,7 +1300,7 @@ err_exit: ...@@ -1308,7 +1300,7 @@ err_exit:
fclose(logfile); fclose(logfile);
} }
#endif /* PAGE_ZIP_COMPRESS_DBG */ #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; += ut_time_us(NULL) - usec;
return(FALSE); return(FALSE);
} }
...@@ -1353,8 +1345,6 @@ err_exit: ...@@ -1353,8 +1345,6 @@ err_exit:
page_zip_compress_write_log(page_zip, page, index, mtr); 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)); UNIV_MEM_ASSERT_RW(page_zip->data, page_zip_get_size(page_zip));
#ifdef PAGE_ZIP_COMPRESS_DBG #ifdef PAGE_ZIP_COMPRESS_DBG
...@@ -1367,8 +1357,13 @@ err_exit: ...@@ -1367,8 +1357,13 @@ err_exit:
fclose(logfile); fclose(logfile);
} }
#endif /* PAGE_ZIP_COMPRESS_DBG */ #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); return(TRUE);
} }
...@@ -2775,7 +2770,7 @@ ibool ...@@ -2775,7 +2770,7 @@ ibool
page_zip_decompress( page_zip_decompress(
/*================*/ /*================*/
/* out: TRUE on success, FALSE on failure */ /* 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 */ out: m_start, m_end, m_nonempty, n_blobs */
page_t* page) /* out: uncompressed page, may be trashed */ page_t* page) /* out: uncompressed page, may be trashed */
{ {
...@@ -2942,9 +2937,12 @@ err_exit: ...@@ -2942,9 +2937,12 @@ err_exit:
page_zip_fields_free(index); page_zip_fields_free(index);
mem_heap_free(heap); mem_heap_free(heap);
page_zip_decompress_count[page_zip->ssize]++; {
page_zip_decompress_duration[page_zip->ssize] page_zip_stat_t* zip_stat
+= ut_time_us(NULL) - usec; = &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. */ /* Update the stat counter for LRU policy. */
buf_LRU_stat_inc_unzip(); 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