mirror of
https://github.com/MariaDB/server.git
synced 2025-01-17 12:32:27 +01:00
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.
This commit is contained in:
parent
e68520c752
commit
239ab2c46a
8 changed files with 42 additions and 56 deletions
|
@ -2328,7 +2328,6 @@ buf_print(void)
|
|||
|
||||
ut_a(buf_validate());
|
||||
}
|
||||
#endif /* UNIV_DEBUG */
|
||||
|
||||
/*************************************************************************
|
||||
Returns the number of latched pages in the buffer pool. */
|
||||
|
@ -2361,6 +2360,7 @@ buf_get_latched_pages_number(void)
|
|||
|
||||
return(fixed_pages_number);
|
||||
}
|
||||
#endif /* UNIV_DEBUG */
|
||||
|
||||
/*************************************************************************
|
||||
Returns the number of pending buf pool ios. */
|
||||
|
|
|
@ -334,8 +334,10 @@ static SHOW_VAR innodb_status_variables[]= {
|
|||
(char*) &export_vars.innodb_buffer_pool_pages_flushed, SHOW_LONG},
|
||||
{"buffer_pool_pages_free",
|
||||
(char*) &export_vars.innodb_buffer_pool_pages_free, SHOW_LONG},
|
||||
#ifdef UNIV_DEBUG
|
||||
{"buffer_pool_pages_latched",
|
||||
(char*) &export_vars.innodb_buffer_pool_pages_latched, SHOW_LONG},
|
||||
#endif /* UNIV_DEBUG */
|
||||
{"buffer_pool_pages_misc",
|
||||
(char*) &export_vars.innodb_buffer_pool_pages_misc, SHOW_LONG},
|
||||
{"buffer_pool_pages_total",
|
||||
|
|
|
@ -495,7 +495,15 @@ Prints info of the buffer pool data structure. */
|
|||
void
|
||||
buf_print(void);
|
||||
/*============*/
|
||||
|
||||
/*************************************************************************
|
||||
Returns the number of latched pages in the buffer pool. */
|
||||
|
||||
ulint
|
||||
buf_get_latched_pages_number(void);
|
||||
/*==============================*/
|
||||
#endif /* UNIV_DEBUG */
|
||||
|
||||
/************************************************************************
|
||||
Prints a page to stderr. */
|
||||
|
||||
|
@ -503,12 +511,7 @@ void
|
|||
buf_page_print(
|
||||
/*===========*/
|
||||
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. */
|
||||
|
||||
|
|
|
@ -331,10 +331,10 @@ mach_write_to_2_little_endian(
|
|||
Convert integral type from storage byte order (big endian) to
|
||||
host byte order. */
|
||||
UNIV_INLINE
|
||||
void
|
||||
ullint
|
||||
mach_read_int_type(
|
||||
/*===============*/
|
||||
byte* dest, /* out: where to write */
|
||||
/* out: integer value */
|
||||
const byte* src, /* in: where to read from */
|
||||
ulint len, /* in: length of src */
|
||||
ibool unsigned_type); /* in: signed or unsigned flag */
|
||||
|
|
|
@ -696,33 +696,39 @@ mach_write_to_2_little_endian(
|
|||
Convert integral type from storage byte order (big endian) to
|
||||
host byte order. */
|
||||
UNIV_INLINE
|
||||
void
|
||||
ullint
|
||||
mach_read_int_type(
|
||||
/*===============*/
|
||||
byte* dest, /* out: where to write */
|
||||
/* out: integer value */
|
||||
const byte* src, /* in: where to read from */
|
||||
ulint len, /* in: length of src */
|
||||
ibool unsigned_type) /* in: signed or unsigned flag */
|
||||
{
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
memcpy(dest, src, len);
|
||||
/* XXX this can be optimized on big-endian machines */
|
||||
|
||||
if (!unsigned_type) {
|
||||
dest[0] ^= 128;
|
||||
}
|
||||
#else
|
||||
byte* ptr;
|
||||
ullint ret;
|
||||
uint i;
|
||||
|
||||
/* Convert integer data from Innobase to a little-endian format,
|
||||
sign bit restored to normal. */
|
||||
if (unsigned_type || (src[0] & 0x80)) {
|
||||
|
||||
for (ptr = dest + len; ptr != dest; ++src) {
|
||||
--ptr;
|
||||
*ptr = *src;
|
||||
ret = 0x0000000000000000ULL;
|
||||
} else {
|
||||
|
||||
ret = 0xFFFFFFFFFFFFFF00ULL;
|
||||
}
|
||||
|
||||
if (!unsigned_type) {
|
||||
dest[len - 1] ^= 128;
|
||||
if (unsigned_type) {
|
||||
|
||||
ret |= src[0];
|
||||
} else {
|
||||
|
||||
ret |= src[0] ^ 0x80;
|
||||
}
|
||||
#endif
|
||||
|
||||
for (i = 1; i < len; i++) {
|
||||
ret <<= 8;
|
||||
ret |= src[i];
|
||||
}
|
||||
|
||||
return(ret);
|
||||
}
|
||||
|
|
|
@ -501,7 +501,9 @@ struct export_var_struct{
|
|||
ulint innodb_buffer_pool_pages_dirty;
|
||||
ulint innodb_buffer_pool_pages_misc;
|
||||
ulint innodb_buffer_pool_pages_free;
|
||||
#ifdef UNIV_DEBUG
|
||||
ulint innodb_buffer_pool_pages_latched;
|
||||
#endif /* UNIV_DEBUG */
|
||||
ulint innodb_buffer_pool_read_requests;
|
||||
ulint innodb_buffer_pool_reads;
|
||||
ulint innodb_buffer_pool_wait_free;
|
||||
|
|
|
@ -4563,8 +4563,6 @@ row_search_autoinc_read_column(
|
|||
const byte* data;
|
||||
ib_ulonglong value;
|
||||
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 = offsets_;
|
||||
|
||||
|
@ -4582,40 +4580,13 @@ row_search_autoinc_read_column(
|
|||
ut_a(len != UNIV_SQL_NULL);
|
||||
ut_a(len <= sizeof value);
|
||||
|
||||
mach_read_int_type(dest, 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;
|
||||
}
|
||||
value = mach_read_int_type(data, len, unsigned_type);
|
||||
|
||||
if (UNIV_LIKELY_NULL(heap)) {
|
||||
mem_heap_free(heap);
|
||||
}
|
||||
|
||||
/* We assume that the autoinc counter can't be negative. */
|
||||
if (!unsigned_type && (ib_longlong) value < 0) {
|
||||
value = 0;
|
||||
}
|
||||
|
|
|
@ -1825,8 +1825,10 @@ srv_export_innodb_status(void)
|
|||
= UT_LIST_GET_LEN(buf_pool->flush_list);
|
||||
export_vars.innodb_buffer_pool_pages_free
|
||||
= UT_LIST_GET_LEN(buf_pool->free);
|
||||
#ifdef UNIV_DEBUG
|
||||
export_vars.innodb_buffer_pool_pages_latched
|
||||
= 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_misc = buf_pool->max_size
|
||||
|
|
Loading…
Reference in a new issue