diff options
author | Timothy Smith <timothy.smith@sun.com> | 2008-08-19 18:37:41 -0600 |
---|---|---|
committer | Timothy Smith <timothy.smith@sun.com> | 2008-08-19 18:37:41 -0600 |
commit | f35cb179498a2aa301b1207e207462dd574114b0 (patch) | |
tree | 7be1f46c9a088f318c6a760f754c3b63f712ee1e /storage/innobase | |
parent | dc2f8d9526931db733c0e2859b4a9d67a201dcc3 (diff) | |
download | mariadb-git-f35cb179498a2aa301b1207e207462dd574114b0.tar.gz |
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.
Diffstat (limited to 'storage/innobase')
-rw-r--r-- | storage/innobase/buf/buf0buf.c | 2 | ||||
-rw-r--r-- | storage/innobase/handler/ha_innodb.cc | 2 | ||||
-rw-r--r-- | storage/innobase/include/buf0buf.h | 13 | ||||
-rw-r--r-- | storage/innobase/include/mach0data.h | 4 | ||||
-rw-r--r-- | storage/innobase/include/mach0data.ic | 38 | ||||
-rw-r--r-- | storage/innobase/include/srv0srv.h | 2 | ||||
-rw-r--r-- | storage/innobase/row/row0sel.c | 33 | ||||
-rw-r--r-- | storage/innobase/srv/srv0srv.c | 2 |
8 files changed, 41 insertions, 55 deletions
diff --git a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c index 469d3ac05d7..901ce8e0fef 100644 --- a/storage/innobase/buf/buf0buf.c +++ b/storage/innobase/buf/buf0buf.c @@ -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. */ diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 23204cb68ef..31e74b97515 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -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", diff --git a/storage/innobase/include/buf0buf.h b/storage/innobase/include/buf0buf.h index 979c28f64ed..3e8972d9182 100644 --- a/storage/innobase/include/buf0buf.h +++ b/storage/innobase/include/buf0buf.h @@ -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. */ diff --git a/storage/innobase/include/mach0data.h b/storage/innobase/include/mach0data.h index 37d862cc678..25b619b3f12 100644 --- a/storage/innobase/include/mach0data.h +++ b/storage/innobase/include/mach0data.h @@ -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 */ diff --git a/storage/innobase/include/mach0data.ic b/storage/innobase/include/mach0data.ic index 64fb87f56ed..ec15c10c661 100644 --- a/storage/innobase/include/mach0data.ic +++ b/storage/innobase/include/mach0data.ic @@ -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 */ + + ullint ret; + uint i; + + if (unsigned_type || (src[0] & 0x80)) { + + ret = 0x0000000000000000ULL; + } else { - if (!unsigned_type) { - dest[0] ^= 128; + ret = 0xFFFFFFFFFFFFFF00ULL; } -#else - byte* ptr; - /* Convert integer data from Innobase to a little-endian format, - sign bit restored to normal. */ + if (unsigned_type) { + + ret |= src[0]; + } else { - for (ptr = dest + len; ptr != dest; ++src) { - --ptr; - *ptr = *src; + ret |= src[0] ^ 0x80; } - if (!unsigned_type) { - dest[len - 1] ^= 128; + for (i = 1; i < len; i++) { + ret <<= 8; + ret |= src[i]; } -#endif + + return(ret); } diff --git a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0srv.h index f0bfd3b07ce..91daa6816b2 100644 --- a/storage/innobase/include/srv0srv.h +++ b/storage/innobase/include/srv0srv.h @@ -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; diff --git a/storage/innobase/row/row0sel.c b/storage/innobase/row/row0sel.c index 9d2e08e0929..6ff135e4f5a 100644 --- a/storage/innobase/row/row0sel.c +++ b/storage/innobase/row/row0sel.c @@ -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; } diff --git a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c index 53fa5c58ded..773b5d583e0 100644 --- a/storage/innobase/srv/srv0srv.c +++ b/storage/innobase/srv/srv0srv.c @@ -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 |