Commit 239ab2c4 authored by Timothy Smith's avatar Timothy Smith

Cherry-pick some changes from innodb-5.1-ss2479 snapshot. Includes fixes for

Bug#36600 and Bug#36793:

Bug #36600 SHOW STATUS takes a lot of CPU in buf_get_latched_pages_number

Fix by removing the Innodb_buffer_pool_pages_latched variable from SHOW
STATUS output in non-UNIV_DEBUG compilation.

Bug #36793 rpl_innodb_bug28430 fails on Solaris

This is a back port from branches/zip. This code has been tested on a
big-endian machine too.
parent e68520c7
...@@ -2328,7 +2328,6 @@ buf_print(void) ...@@ -2328,7 +2328,6 @@ buf_print(void)
ut_a(buf_validate()); ut_a(buf_validate());
} }
#endif /* UNIV_DEBUG */
/************************************************************************* /*************************************************************************
Returns the number of latched pages in the buffer pool. */ Returns the number of latched pages in the buffer pool. */
...@@ -2361,6 +2360,7 @@ buf_get_latched_pages_number(void) ...@@ -2361,6 +2360,7 @@ buf_get_latched_pages_number(void)
return(fixed_pages_number); return(fixed_pages_number);
} }
#endif /* UNIV_DEBUG */
/************************************************************************* /*************************************************************************
Returns the number of pending buf pool ios. */ Returns the number of pending buf pool ios. */
......
...@@ -334,8 +334,10 @@ static SHOW_VAR innodb_status_variables[]= { ...@@ -334,8 +334,10 @@ static SHOW_VAR innodb_status_variables[]= {
(char*) &export_vars.innodb_buffer_pool_pages_flushed, SHOW_LONG}, (char*) &export_vars.innodb_buffer_pool_pages_flushed, SHOW_LONG},
{"buffer_pool_pages_free", {"buffer_pool_pages_free",
(char*) &export_vars.innodb_buffer_pool_pages_free, SHOW_LONG}, (char*) &export_vars.innodb_buffer_pool_pages_free, SHOW_LONG},
#ifdef UNIV_DEBUG
{"buffer_pool_pages_latched", {"buffer_pool_pages_latched",
(char*) &export_vars.innodb_buffer_pool_pages_latched, SHOW_LONG}, (char*) &export_vars.innodb_buffer_pool_pages_latched, SHOW_LONG},
#endif /* UNIV_DEBUG */
{"buffer_pool_pages_misc", {"buffer_pool_pages_misc",
(char*) &export_vars.innodb_buffer_pool_pages_misc, SHOW_LONG}, (char*) &export_vars.innodb_buffer_pool_pages_misc, SHOW_LONG},
{"buffer_pool_pages_total", {"buffer_pool_pages_total",
......
...@@ -495,7 +495,15 @@ Prints info of the buffer pool data structure. */ ...@@ -495,7 +495,15 @@ Prints info of the buffer pool data structure. */
void void
buf_print(void); buf_print(void);
/*============*/ /*============*/
/*************************************************************************
Returns the number of latched pages in the buffer pool. */
ulint
buf_get_latched_pages_number(void);
/*==============================*/
#endif /* UNIV_DEBUG */ #endif /* UNIV_DEBUG */
/************************************************************************ /************************************************************************
Prints a page to stderr. */ Prints a page to stderr. */
...@@ -503,12 +511,7 @@ void ...@@ -503,12 +511,7 @@ void
buf_page_print( buf_page_print(
/*===========*/ /*===========*/
byte* read_buf); /* in: a database page */ byte* read_buf); /* in: a database page */
/*************************************************************************
Returns the number of latched pages in the buffer pool. */
ulint
buf_get_latched_pages_number(void);
/*==============================*/
/************************************************************************* /*************************************************************************
Returns the number of pending buf pool ios. */ Returns the number of pending buf pool ios. */
......
...@@ -331,10 +331,10 @@ mach_write_to_2_little_endian( ...@@ -331,10 +331,10 @@ mach_write_to_2_little_endian(
Convert integral type from storage byte order (big endian) to Convert integral type from storage byte order (big endian) to
host byte order. */ host byte order. */
UNIV_INLINE UNIV_INLINE
void ullint
mach_read_int_type( mach_read_int_type(
/*===============*/ /*===============*/
byte* dest, /* out: where to write */ /* out: integer value */
const byte* src, /* in: where to read from */ const byte* src, /* in: where to read from */
ulint len, /* in: length of src */ ulint len, /* in: length of src */
ibool unsigned_type); /* in: signed or unsigned flag */ ibool unsigned_type); /* in: signed or unsigned flag */
......
...@@ -696,33 +696,39 @@ mach_write_to_2_little_endian( ...@@ -696,33 +696,39 @@ mach_write_to_2_little_endian(
Convert integral type from storage byte order (big endian) to Convert integral type from storage byte order (big endian) to
host byte order. */ host byte order. */
UNIV_INLINE UNIV_INLINE
void ullint
mach_read_int_type( mach_read_int_type(
/*===============*/ /*===============*/
byte* dest, /* out: where to write */ /* out: integer value */
const byte* src, /* in: where to read from */ const byte* src, /* in: where to read from */
ulint len, /* in: length of src */ ulint len, /* in: length of src */
ibool unsigned_type) /* in: signed or unsigned flag */ ibool unsigned_type) /* in: signed or unsigned flag */
{ {
#ifdef WORDS_BIGENDIAN /* XXX this can be optimized on big-endian machines */
memcpy(dest, src, len);
ullint ret;
uint i;
if (unsigned_type || (src[0] & 0x80)) {
ret = 0x0000000000000000ULL;
} else {
if (!unsigned_type) { ret = 0xFFFFFFFFFFFFFF00ULL;
dest[0] ^= 128;
} }
#else
byte* ptr;
/* Convert integer data from Innobase to a little-endian format, if (unsigned_type) {
sign bit restored to normal. */
ret |= src[0];
} else {
for (ptr = dest + len; ptr != dest; ++src) { ret |= src[0] ^ 0x80;
--ptr;
*ptr = *src;
} }
if (!unsigned_type) { for (i = 1; i < len; i++) {
dest[len - 1] ^= 128; ret <<= 8;
ret |= src[i];
} }
#endif
return(ret);
} }
...@@ -501,7 +501,9 @@ struct export_var_struct{ ...@@ -501,7 +501,9 @@ struct export_var_struct{
ulint innodb_buffer_pool_pages_dirty; ulint innodb_buffer_pool_pages_dirty;
ulint innodb_buffer_pool_pages_misc; ulint innodb_buffer_pool_pages_misc;
ulint innodb_buffer_pool_pages_free; ulint innodb_buffer_pool_pages_free;
#ifdef UNIV_DEBUG
ulint innodb_buffer_pool_pages_latched; ulint innodb_buffer_pool_pages_latched;
#endif /* UNIV_DEBUG */
ulint innodb_buffer_pool_read_requests; ulint innodb_buffer_pool_read_requests;
ulint innodb_buffer_pool_reads; ulint innodb_buffer_pool_reads;
ulint innodb_buffer_pool_wait_free; ulint innodb_buffer_pool_wait_free;
......
...@@ -4563,8 +4563,6 @@ row_search_autoinc_read_column( ...@@ -4563,8 +4563,6 @@ row_search_autoinc_read_column(
const byte* data; const byte* data;
ib_ulonglong value; ib_ulonglong value;
mem_heap_t* heap = NULL; mem_heap_t* heap = NULL;
/* Our requirement is that dest should be word aligned. */
byte dest[sizeof(value)];
ulint offsets_[REC_OFFS_NORMAL_SIZE]; ulint offsets_[REC_OFFS_NORMAL_SIZE];
ulint* offsets = offsets_; ulint* offsets = offsets_;
...@@ -4582,40 +4580,13 @@ row_search_autoinc_read_column( ...@@ -4582,40 +4580,13 @@ row_search_autoinc_read_column(
ut_a(len != UNIV_SQL_NULL); ut_a(len != UNIV_SQL_NULL);
ut_a(len <= sizeof value); ut_a(len <= sizeof value);
mach_read_int_type(dest, data, len, unsigned_type); value = mach_read_int_type(data, len, unsigned_type);
/* The assumption here is that the AUTOINC value can't be negative
and that dest is word aligned. */
switch (len) {
case 8:
value = *(ib_ulonglong*) dest;
break;
case 4:
value = *(ib_uint32_t*) dest;
break;
case 3:
value = *(ib_uint32_t*) dest;
value &= 0xFFFFFF;
break;
case 2:
value = *(uint16 *) dest;
break;
case 1:
value = *dest;
break;
default:
ut_error;
}
if (UNIV_LIKELY_NULL(heap)) { if (UNIV_LIKELY_NULL(heap)) {
mem_heap_free(heap); mem_heap_free(heap);
} }
/* We assume that the autoinc counter can't be negative. */
if (!unsigned_type && (ib_longlong) value < 0) { if (!unsigned_type && (ib_longlong) value < 0) {
value = 0; value = 0;
} }
......
...@@ -1825,8 +1825,10 @@ srv_export_innodb_status(void) ...@@ -1825,8 +1825,10 @@ srv_export_innodb_status(void)
= UT_LIST_GET_LEN(buf_pool->flush_list); = UT_LIST_GET_LEN(buf_pool->flush_list);
export_vars.innodb_buffer_pool_pages_free export_vars.innodb_buffer_pool_pages_free
= UT_LIST_GET_LEN(buf_pool->free); = UT_LIST_GET_LEN(buf_pool->free);
#ifdef UNIV_DEBUG
export_vars.innodb_buffer_pool_pages_latched export_vars.innodb_buffer_pool_pages_latched
= buf_get_latched_pages_number(); = buf_get_latched_pages_number();
#endif /* UNIV_DEBUG */
export_vars.innodb_buffer_pool_pages_total = buf_pool->curr_size; export_vars.innodb_buffer_pool_pages_total = buf_pool->curr_size;
export_vars.innodb_buffer_pool_pages_misc = buf_pool->max_size export_vars.innodb_buffer_pool_pages_misc = buf_pool->max_size
......
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