Commit 0a073efd authored by Vadim Tkachenko's avatar Vadim Tkachenko

sync with rev40 extensions-1.0

parent ec1ed62c
......@@ -3690,6 +3690,7 @@ btr_blob_free(
mtr_commit(mtr);
//buf_pool_mutex_enter();
mutex_enter(&LRU_list_mutex);
mutex_enter(&block->mutex);
/* Only free the block if it is still allocated to
......@@ -3700,7 +3701,7 @@ btr_blob_free(
&& buf_block_get_space(block) == space
&& buf_block_get_page_no(block) == page_no) {
if (buf_LRU_free_block(&block->page, all, NULL)
if (buf_LRU_free_block(&block->page, all, NULL, TRUE)
!= BUF_LRU_FREED
&& all && block->page.zip.data
/* Now, buf_LRU_free_block() may release mutex temporarily */
......@@ -3710,11 +3711,12 @@ btr_blob_free(
/* Attempt to deallocate the uncompressed page
if the whole block cannot be deallocted. */
buf_LRU_free_block(&block->page, FALSE, NULL);
buf_LRU_free_block(&block->page, FALSE, NULL, TRUE);
}
}
//buf_pool_mutex_exit();
mutex_exit(&LRU_list_mutex);
mutex_exit(&block->mutex);
}
......
......@@ -800,7 +800,10 @@ btr_search_guess_on_hash(
rw_lock_s_lock(&btr_search_latch);
}
#ifndef HAVE_GCC_ATOMIC_BUILTINS
/* It is used as lock word among x_lock */
ut_ad(btr_search_latch.writer != RW_LOCK_EX);
#endif
ut_ad(btr_search_latch.reader_count > 0);
rec = ha_search_and_get_data(btr_search_sys->hash_index, fold);
......
......@@ -123,7 +123,7 @@ buf_buddy_alloc_zip(
/* Valgrind would complain about accessing free memory. */
UT_LIST_VALIDATE(list, buf_page_t, buf_pool->zip_free[i]);
#endif /* UNIV_DEBUG && !UNIV_DEBUG_VALGRIND */
bpage = UT_LIST_GET_FIRST(buf_pool->zip_free[i]);
bpage = UT_LIST_GET_LAST(buf_pool->zip_free[i]);
if (bpage) {
UNIV_MEM_VALID(bpage, BUF_BUDDY_LOW << i);
......@@ -315,14 +315,18 @@ buf_buddy_alloc_low(
/* Try replacing an uncompressed page in the buffer pool. */
//buf_pool_mutex_exit();
mutex_exit(&LRU_list_mutex);
if (have_page_hash_mutex)
if (have_page_hash_mutex) {
mutex_exit(&flush_list_mutex);
mutex_exit(&page_hash_mutex);
}
block = buf_LRU_get_free_block(0);
*lru = TRUE;
//buf_pool_mutex_enter();
mutex_enter(&LRU_list_mutex);
if (have_page_hash_mutex)
if (have_page_hash_mutex) {
mutex_enter(&flush_list_mutex);
mutex_enter(&page_hash_mutex);
}
alloc_big:
buf_buddy_block_register(block);
......@@ -350,6 +354,7 @@ buf_buddy_relocate_block(
buf_page_t* b;
//ut_ad(buf_pool_mutex_own());
ut_ad(mutex_own(&flush_list_mutex));
switch (buf_page_get_state(bpage)) {
case BUF_BLOCK_ZIP_FREE:
......@@ -358,7 +363,7 @@ buf_buddy_relocate_block(
case BUF_BLOCK_FILE_PAGE:
case BUF_BLOCK_MEMORY:
case BUF_BLOCK_REMOVE_HASH:
ut_error;
/* ut_error; */ /* optimistic */
case BUF_BLOCK_ZIP_DIRTY:
/* Cannot relocate dirty pages. */
return(FALSE);
......@@ -367,30 +372,24 @@ buf_buddy_relocate_block(
break;
}
/* optimistic */
mutex_enter(&buf_pool_zip_mutex);
mutex_enter(&zip_free_mutex);
if (!buf_page_can_relocate(bpage)) {
mutex_exit(&buf_pool_zip_mutex);
mutex_exit(&zip_free_mutex);
return(FALSE);
}
mutex_enter(&LRU_list_mutex);
mutex_enter(&flush_list_mutex);
mutex_enter(&page_hash_mutex);
mutex_enter(&buf_pool_zip_mutex);
if (!buf_page_can_relocate(bpage)) {
mutex_exit(&LRU_list_mutex);
mutex_exit(&flush_list_mutex);
mutex_exit(&page_hash_mutex);
if (bpage != buf_page_hash_get(bpage->space, bpage->offset)) {
mutex_exit(&buf_pool_zip_mutex);
mutex_exit(&zip_free_mutex);
return(FALSE);
}
buf_relocate(bpage, dpage);
ut_d(bpage->state = BUF_BLOCK_ZIP_FREE);
mutex_exit(&LRU_list_mutex);
mutex_exit(&page_hash_mutex);
/* relocate buf_pool->zip_clean */
b = UT_LIST_GET_PREV(list, dpage);
UT_LIST_REMOVE(list, buf_pool->zip_clean, dpage);
......@@ -401,8 +400,8 @@ buf_buddy_relocate_block(
UT_LIST_ADD_FIRST(list, buf_pool->zip_clean, dpage);
}
mutex_exit(&flush_list_mutex);
mutex_exit(&buf_pool_zip_mutex);
mutex_exit(&zip_free_mutex);
return(TRUE);
}
......@@ -448,8 +447,11 @@ buf_buddy_relocate(
/* This is a compressed page. */
mutex_t* mutex;
if (!have_page_hash_mutex)
if (!have_page_hash_mutex) {
mutex_enter(&LRU_list_mutex);
mutex_enter(&flush_list_mutex);
mutex_enter(&page_hash_mutex);
}
/* The src block may be split into smaller blocks,
some of which may be free. Thus, the
mach_read_from_4() calls below may attempt to read
......@@ -471,8 +473,10 @@ buf_buddy_relocate(
it cannot be relocated. */
if (!have_page_hash_mutex) {
mutex_exit(&page_hash_mutex);
mutex_enter(&zip_free_mutex);
mutex_exit(&LRU_list_mutex);
mutex_exit(&flush_list_mutex);
mutex_exit(&page_hash_mutex);
}
return(FALSE);
}
......@@ -484,8 +488,10 @@ buf_buddy_relocate(
ut_ad(page_zip_get_size(&bpage->zip) < size);
if (!have_page_hash_mutex) {
mutex_exit(&page_hash_mutex);
mutex_enter(&zip_free_mutex);
mutex_exit(&LRU_list_mutex);
mutex_exit(&flush_list_mutex);
mutex_exit(&page_hash_mutex);
}
return(FALSE);
}
......@@ -501,8 +507,7 @@ buf_buddy_relocate(
mutex = buf_page_get_mutex(bpage);
mutex_enter(mutex);
if (!have_page_hash_mutex)
mutex_exit(&page_hash_mutex);
mutex_enter(&zip_free_mutex);
if (buf_page_can_relocate(bpage)) {
/* Relocate the compressed page. */
......@@ -520,29 +525,52 @@ success:
+= ut_time_us(NULL) - usec;
}
mutex_enter(&zip_free_mutex);
if (!have_page_hash_mutex) {
mutex_exit(&LRU_list_mutex);
mutex_exit(&flush_list_mutex);
mutex_exit(&page_hash_mutex);
}
return(TRUE);
}
if (!have_page_hash_mutex) {
mutex_exit(&LRU_list_mutex);
mutex_exit(&flush_list_mutex);
mutex_exit(&page_hash_mutex);
}
mutex_exit(mutex);
mutex_enter(&zip_free_mutex);
} else if (i == buf_buddy_get_slot(sizeof(buf_page_t))) {
/* This must be a buf_page_t object. */
UNIV_MEM_ASSERT_RW(src, size);
if (have_page_hash_mutex)
mutex_exit(&page_hash_mutex);
mutex_exit(&zip_free_mutex);
if (!have_page_hash_mutex) {
mutex_enter(&LRU_list_mutex);
mutex_enter(&flush_list_mutex);
mutex_enter(&page_hash_mutex);
}
if (buf_buddy_relocate_block(src, dst)) {
mutex_enter(&zip_free_mutex);
if (!have_page_hash_mutex) {
mutex_exit(&LRU_list_mutex);
mutex_exit(&flush_list_mutex);
mutex_exit(&page_hash_mutex);
}
goto success;
}
if (have_page_hash_mutex)
mutex_enter(&page_hash_mutex);
mutex_enter(&zip_free_mutex);
if (!have_page_hash_mutex) {
mutex_exit(&LRU_list_mutex);
mutex_exit(&flush_list_mutex);
mutex_exit(&page_hash_mutex);
}
}
return(FALSE);
......@@ -632,7 +660,7 @@ buddy_nonfree:
#endif /* UNIV_DEBUG_VALGRIND */
/* The buddy is not free. Is there a free block of this size? */
bpage = UT_LIST_GET_FIRST(buf_pool->zip_free[i]);
bpage = UT_LIST_GET_LAST(buf_pool->zip_free[i]);
if (bpage) {
/* Remove the block from the free list, because a successful
......
......@@ -662,10 +662,10 @@ buf_block_init(
block->page.in_zip_hash = FALSE;
block->page.in_flush_list = FALSE;
block->page.in_free_list = FALSE;
block->page.in_LRU_list = FALSE;
block->in_unzip_LRU_list = FALSE;
block->n_pointers = 0;
#endif /* UNIV_DEBUG */
block->page.in_LRU_list = FALSE;
block->in_unzip_LRU_list = FALSE;
page_zip_des_init(&block->page.zip);
mutex_create(&block->mutex, SYNC_BUF_BLOCK);
......@@ -1191,7 +1191,7 @@ shrink_again:
buf_LRU_make_block_old(&block->page);
dirty++;
} else if (buf_LRU_free_block(&block->page, TRUE, NULL)
} else if (buf_LRU_free_block(&block->page, TRUE, NULL, FALSE)
!= BUF_LRU_FREED) {
nonfree++;
}
......@@ -1662,7 +1662,7 @@ lookup:
break;
case BUF_BLOCK_FILE_PAGE:
/* Discard the uncompressed page frame if possible. */
if (buf_LRU_free_block(bpage, FALSE, NULL)
if (buf_LRU_free_block(bpage, FALSE, NULL, FALSE)
== BUF_LRU_FREED) {
mutex_exit(block_mutex);
......@@ -1953,10 +1953,16 @@ loop2:
ibool success;
case BUF_BLOCK_FILE_PAGE:
if (block_mutex == &buf_pool_zip_mutex) {
/* it is wrong mutex... */
mutex_exit(block_mutex);
goto loop;
}
break;
case BUF_BLOCK_ZIP_PAGE:
case BUF_BLOCK_ZIP_DIRTY:
ut_ad(block_mutex == &buf_pool_zip_mutex);
bpage = &block->page;
if (bpage->buf_fix_count
......@@ -1980,7 +1986,7 @@ wait_until_unfixed:
block = buf_LRU_get_free_block(0);
ut_a(block);
block_mutex = buf_page_get_mutex((buf_page_t*)block);
block_mutex = &block->mutex;
//buf_pool_mutex_enter();
mutex_enter(&LRU_list_mutex);
......@@ -2001,9 +2007,10 @@ wait_until_unfixed:
mutex_exit(block_mutex);
block = (buf_block_t*) hash_bpage;
block_mutex = buf_page_get_mutex((buf_page_t*)block);
mutex_enter(block_mutex);
if (block) {
block_mutex = buf_page_get_mutex((buf_page_t*)block);
mutex_enter(block_mutex);
}
mutex_exit(&page_hash_mutex);
mutex_exit(&LRU_list_mutex);
mutex_exit(&flush_list_mutex);
......@@ -2107,6 +2114,7 @@ wait_until_unfixed:
/* Unfix and unlatch the block. */
//buf_pool_mutex_enter();
block_mutex = &block->mutex;
mutex_enter(block_mutex);
mutex_enter(&buf_pool_mutex);
buf_pool->n_pend_unzip--;
......@@ -2119,7 +2127,7 @@ wait_until_unfixed:
if (UNIV_UNLIKELY(!success)) {
//buf_pool_mutex_exit();
mutex_exit(&block->mutex);
mutex_exit(block_mutex);
return(NULL);
}
......@@ -2692,6 +2700,9 @@ buf_page_init_for_read(
//buf_pool_mutex_enter();
mutex_enter(&LRU_list_mutex);
if(!block) {
mutex_enter(&flush_list_mutex);
}
mutex_enter(&page_hash_mutex);
if (buf_page_hash_get(space, offset)) {
......@@ -2699,14 +2710,18 @@ buf_page_init_for_read(
err_exit:
if (block) {
mutex_enter(&block->mutex);
buf_LRU_block_free_non_file_page(block, TRUE);
mutex_exit(&LRU_list_mutex);
mutex_exit(&page_hash_mutex);
buf_LRU_block_free_non_file_page(block, FALSE);
mutex_exit(&block->mutex);
}
else {
err_exit2:
//buf_pool_mutex_exit();
mutex_exit(&LRU_list_mutex);
mutex_exit(&flush_list_mutex);
mutex_exit(&page_hash_mutex);
}
if (mode == BUF_READ_IBUF_PAGES_ONLY) {
......@@ -2790,16 +2805,14 @@ err_exit2:
/* If buf_buddy_alloc() allocated storage from the LRU list,
it released and reacquired buf_pool_mutex. Thus, we must
check the page_hash again, as it may have been modified. */
/* !!! page_hash_mutex is not released yet
So always buf_page_hash_get(space, offset) == 0 !!!*/
//if (UNIV_UNLIKELY(lru)
// && UNIV_LIKELY_NULL(buf_page_hash_get(space, offset))) {
// /* The block was added by some other thread. */
// buf_buddy_free(bpage, sizeof *bpage);
// buf_buddy_free(data, zip_size);
// goto err_exit2;
//}
if (UNIV_UNLIKELY(lru)
&& UNIV_LIKELY_NULL(buf_page_hash_get(space, offset))) {
/* The block was added by some other thread. */
buf_buddy_free(bpage, sizeof *bpage, TRUE);
buf_buddy_free(data, zip_size, TRUE);
goto err_exit2;
}
page_zip_des_init(&bpage->zip);
page_zip_set_size(&bpage->zip, zip_size);
......@@ -2818,8 +2831,8 @@ err_exit2:
bpage->in_zip_hash = FALSE;
bpage->in_flush_list = FALSE;
bpage->in_free_list = FALSE;
bpage->in_LRU_list = FALSE;
#endif /* UNIV_DEBUG */
bpage->in_LRU_list = FALSE;
ut_d(bpage->in_page_hash = TRUE);
HASH_INSERT(buf_page_t, hash, buf_pool->page_hash,
......@@ -2832,6 +2845,7 @@ err_exit2:
buf_LRU_insert_zip_clean(bpage);
mutex_exit(&LRU_list_mutex);
mutex_exit(&flush_list_mutex);
buf_page_set_io_fix(bpage, BUF_IO_READ);
......@@ -3465,12 +3479,15 @@ buf_validate(void)
}
ut_a(UT_LIST_GET_LEN(buf_pool->LRU) == n_lru);
/* because of latching order, we cannot get free_list_mutex here. */
/*
if (UT_LIST_GET_LEN(buf_pool->free) != n_free) {
fprintf(stderr, "Free list len %lu, free blocks %lu\n",
(ulong) UT_LIST_GET_LEN(buf_pool->free),
(ulong) n_free);
ut_error;
}
*/
ut_a(UT_LIST_GET_LEN(buf_pool->flush_list) == n_flush);
ut_a(buf_pool->n_flush[BUF_FLUSH_SINGLE_PAGE] == n_single_flush);
......
......@@ -154,10 +154,10 @@ buf_flush_ready_for_replace(
buf_page_in_file(bpage) and in the LRU list */
{
//ut_ad(buf_pool_mutex_own());
ut_ad(mutex_own(buf_page_get_mutex(bpage)));
ut_ad(bpage->in_LRU_list);
//ut_ad(mutex_own(buf_page_get_mutex(bpage)));
//ut_ad(bpage->in_LRU_list);
if (UNIV_LIKELY(buf_page_in_file(bpage))) {
if (UNIV_LIKELY(bpage->in_LRU_list && buf_page_in_file(bpage))) {
return(bpage->oldest_modification == 0
&& buf_page_get_io_fix(bpage) == BUF_IO_NONE
......@@ -1237,8 +1237,14 @@ buf_flush_LRU_recommendation(void)
buf_page_t* bpage;
ulint n_replaceable;
ulint distance = 0;
ibool have_LRU_mutex = FALSE;
if(UT_LIST_GET_LEN(buf_pool->unzip_LRU))
have_LRU_mutex = TRUE;
//buf_pool_mutex_enter();
if (have_LRU_mutex)
mutex_enter(&LRU_list_mutex);
n_replaceable = UT_LIST_GET_LEN(buf_pool->free);
......@@ -1249,6 +1255,12 @@ buf_flush_LRU_recommendation(void)
+ BUF_FLUSH_EXTRA_MARGIN)
&& (distance < BUF_LRU_FREE_SEARCH_LEN)) {
if (!bpage->in_LRU_list) {
/* reatart. but it is very optimistic */
bpage = UT_LIST_GET_LAST(buf_pool->LRU);
continue;
}
mutex_t* block_mutex = buf_page_get_mutex(bpage);
mutex_enter(block_mutex);
......@@ -1265,6 +1277,8 @@ buf_flush_LRU_recommendation(void)
}
//buf_pool_mutex_exit();
if (have_LRU_mutex)
mutex_exit(&LRU_list_mutex);
if (n_replaceable >= BUF_FLUSH_FREE_BLOCK_MARGIN) {
......
......@@ -121,7 +121,8 @@ Determines if the unzip_LRU list should be used for evicting a victim
instead of the general LRU list. */
UNIV_INLINE
ibool
buf_LRU_evict_from_unzip_LRU(void)
buf_LRU_evict_from_unzip_LRU(
ibool have_LRU_mutex)
/*==============================*/
/* out: TRUE if should use unzip_LRU */
{
......@@ -130,10 +131,12 @@ buf_LRU_evict_from_unzip_LRU(void)
//ut_ad(buf_pool_mutex_own());
mutex_enter(&LRU_list_mutex);
if (!have_LRU_mutex)
mutex_enter(&LRU_list_mutex);
/* If the unzip_LRU list is empty, we can only use the LRU. */
if (UT_LIST_GET_LEN(buf_pool->unzip_LRU) == 0) {
mutex_exit(&LRU_list_mutex);
if (!have_LRU_mutex)
mutex_exit(&LRU_list_mutex);
return(FALSE);
}
......@@ -142,17 +145,20 @@ buf_LRU_evict_from_unzip_LRU(void)
decompressed pages in the buffer pool. */
if (UT_LIST_GET_LEN(buf_pool->unzip_LRU)
<= UT_LIST_GET_LEN(buf_pool->LRU) / 10) {
mutex_exit(&LRU_list_mutex);
if (!have_LRU_mutex)
mutex_exit(&LRU_list_mutex);
return(FALSE);
}
/* If eviction hasn't started yet, we assume by default
that a workload is disk bound. */
if (buf_pool->freed_page_clock == 0) {
mutex_exit(&LRU_list_mutex);
if (!have_LRU_mutex)
mutex_exit(&LRU_list_mutex);
return(TRUE);
}
mutex_exit(&LRU_list_mutex);
if (!have_LRU_mutex)
mutex_exit(&LRU_list_mutex);
/* Calculate the average over past intervals, and add the values
of the current interval. */
......@@ -476,7 +482,7 @@ buf_LRU_insert_zip_clean(
b = bpage;
do {
b = UT_LIST_GET_NEXT(LRU, b);
} while (b && buf_page_get_state(b) != BUF_BLOCK_ZIP_PAGE);
} while (b && (buf_page_get_state(b) != BUF_BLOCK_ZIP_PAGE || !b->in_LRU_list));
/* Insert bpage before b, i.e., after the predecessor of b. */
if (b) {
......@@ -498,11 +504,12 @@ ibool
buf_LRU_free_from_unzip_LRU_list(
/*=============================*/
/* out: TRUE if freed */
ulint n_iterations) /* in: how many times this has been called
ulint n_iterations, /* in: how many times this has been called
repeatedly without result: a high value means
that we should search farther; we will search
n_iterations / 5 of the unzip_LRU list,
or nothing if n_iterations >= 5 */
ibool have_LRU_mutex)
{
buf_block_t* block;
ulint distance;
......@@ -517,7 +524,7 @@ buf_LRU_free_from_unzip_LRU_list(
if we have done five iterations so far. */
if (UNIV_UNLIKELY(n_iterations >= 5)
|| !buf_LRU_evict_from_unzip_LRU()) {
|| !buf_LRU_evict_from_unzip_LRU(have_LRU_mutex)) {
return(FALSE);
}
......@@ -525,18 +532,23 @@ buf_LRU_free_from_unzip_LRU_list(
distance = 100 + (n_iterations
* UT_LIST_GET_LEN(buf_pool->unzip_LRU)) / 5;
restart:
for (block = UT_LIST_GET_LAST(buf_pool->unzip_LRU);
UNIV_LIKELY(block != NULL) && UNIV_LIKELY(distance > 0);
block = UT_LIST_GET_PREV(unzip_LRU, block), distance--) {
if (!block->in_unzip_LRU_list || !block->page.in_LRU_list
|| buf_block_get_state(block) != BUF_BLOCK_FILE_PAGE)
goto restart;
enum buf_lru_free_block_status freed;
ut_ad(buf_block_get_state(block) == BUF_BLOCK_FILE_PAGE);
ut_ad(block->in_unzip_LRU_list);
ut_ad(block->page.in_LRU_list);
/* optimistic */
//ut_ad(buf_block_get_state(block) == BUF_BLOCK_FILE_PAGE);
//ut_ad(block->in_unzip_LRU_list);
//ut_ad(block->page.in_LRU_list);
mutex_enter(&block->mutex);
freed = buf_LRU_free_block(&block->page, FALSE, NULL);
freed = buf_LRU_free_block(&block->page, FALSE, NULL, have_LRU_mutex);
mutex_exit(&block->mutex);
switch (freed) {
......@@ -569,12 +581,13 @@ ibool
buf_LRU_free_from_common_LRU_list(
/*==============================*/
/* out: TRUE if freed */
ulint n_iterations) /* in: how many times this has been called
ulint n_iterations, /* in: how many times this has been called
repeatedly without result: a high value means
that we should search farther; if
n_iterations < 10, then we search
n_iterations / 10 * buf_pool->curr_size
pages from the end of the LRU list */
ibool have_LRU_mutex)
{
buf_page_t* bpage;
ulint distance;
......@@ -583,19 +596,24 @@ buf_LRU_free_from_common_LRU_list(
distance = 100 + (n_iterations * buf_pool->curr_size) / 10;
restart:
for (bpage = UT_LIST_GET_LAST(buf_pool->LRU);
UNIV_LIKELY(bpage != NULL) && UNIV_LIKELY(distance > 0);
bpage = UT_LIST_GET_PREV(LRU, bpage), distance--) {
if (!bpage->in_LRU_list
|| buf_page_get_state(bpage) == BUF_BLOCK_ZIP_FREE)
goto restart;
enum buf_lru_free_block_status freed;
mutex_t* block_mutex
= buf_page_get_mutex(bpage);
ut_ad(buf_page_in_file(bpage));
ut_ad(bpage->in_LRU_list);
/* optimistic */
//ut_ad(buf_page_in_file(bpage));
//ut_ad(bpage->in_LRU_list);
mutex_enter(block_mutex);
freed = buf_LRU_free_block(bpage, TRUE, NULL);
freed = buf_LRU_free_block(bpage, TRUE, NULL, have_LRU_mutex);
mutex_exit(block_mutex);
switch (freed) {
......@@ -638,14 +656,20 @@ buf_LRU_search_and_free_block(
n_iterations / 5 of the unzip_LRU list. */
{
ibool freed = FALSE;
ibool have_LRU_mutex = FALSE;
if (UT_LIST_GET_LEN(buf_pool->unzip_LRU))
have_LRU_mutex = TRUE;
/* optimistic search... */
//buf_pool_mutex_enter();
if (have_LRU_mutex)
mutex_enter(&LRU_list_mutex);
freed = buf_LRU_free_from_unzip_LRU_list(n_iterations);
freed = buf_LRU_free_from_unzip_LRU_list(n_iterations, have_LRU_mutex);
if (!freed) {
freed = buf_LRU_free_from_common_LRU_list(n_iterations);
freed = buf_LRU_free_from_common_LRU_list(n_iterations, have_LRU_mutex);
}
mutex_enter(&buf_pool_mutex);
......@@ -657,6 +681,8 @@ buf_LRU_search_and_free_block(
mutex_exit(&buf_pool_mutex);
//buf_pool_mutex_exit();
if (have_LRU_mutex)
mutex_exit(&LRU_list_mutex);
return(freed);
}
......@@ -737,7 +763,7 @@ buf_LRU_get_free_only(void)
//ut_ad(buf_pool_mutex_own());
mutex_enter(&free_list_mutex);
block = (buf_block_t*) UT_LIST_GET_FIRST(buf_pool->free);
block = (buf_block_t*) UT_LIST_GET_LAST(buf_pool->free);
if (block) {
ut_ad(block->page.in_free_list);
......@@ -861,7 +887,9 @@ loop:
if (UNIV_UNLIKELY(zip_size)) {
ibool lru;
page_zip_set_size(&block->page.zip, zip_size);
mutex_enter(&LRU_list_mutex);
block->page.zip.data = buf_buddy_alloc(zip_size, &lru, FALSE);
mutex_exit(&LRU_list_mutex);
UNIV_MEM_DESC(block->page.zip.data, zip_size, block);
} else {
page_zip_set_size(&block->page.zip, 0);
......@@ -1067,7 +1095,7 @@ buf_unzip_LRU_remove_block_if_needed(
buf_block_t* block = (buf_block_t*) bpage;
ut_ad(block->in_unzip_LRU_list);
ut_d(block->in_unzip_LRU_list = FALSE);
block->in_unzip_LRU_list = FALSE;
UT_LIST_REMOVE(unzip_LRU, buf_pool->unzip_LRU, block);
}
......@@ -1153,7 +1181,7 @@ buf_unzip_LRU_add_block(
ut_a(buf_page_belongs_to_unzip_LRU(&block->page));
ut_ad(!block->in_unzip_LRU_list);
ut_d(block->in_unzip_LRU_list = TRUE);
block->in_unzip_LRU_list = TRUE;
if (old) {
UT_LIST_ADD_LAST(unzip_LRU, buf_pool->unzip_LRU, block);
......@@ -1349,22 +1377,24 @@ buf_LRU_free_block(
buf_page_t* bpage, /* in: block to be freed */
ibool zip, /* in: TRUE if should remove also the
compressed page of an uncompressed page */
ibool* buf_pool_mutex_released)
ibool* buf_pool_mutex_released,
/* in: pointer to a variable that will
be assigned TRUE if buf_pool_mutex
was temporarily released, or NULL */
ibool have_LRU_mutex)
{
buf_page_t* b = NULL;
mutex_t* block_mutex = buf_page_get_mutex(bpage);
//ut_ad(buf_pool_mutex_own());
ut_ad(mutex_own(block_mutex));
ut_ad(buf_page_in_file(bpage));
ut_ad(bpage->in_LRU_list);
ut_ad(!bpage->in_flush_list == !bpage->oldest_modification);
/* optimistic */
//ut_ad(mutex_own(block_mutex));
//ut_ad(buf_page_in_file(bpage));
//ut_ad(bpage->in_LRU_list);
//ut_ad(!bpage->in_flush_list == !bpage->oldest_modification);
UNIV_MEM_ASSERT_RW(bpage, sizeof *bpage);
if (!buf_page_can_relocate(bpage)) {
if (!bpage->in_LRU_list || !block_mutex || !buf_page_can_relocate(bpage)) {
/* Do not free buffer-fixed or I/O-fixed blocks. */
return(BUF_LRU_NOT_FREED);
......@@ -1392,15 +1422,15 @@ buf_LRU_free_block(
If it cannot be allocated (without freeing a block
from the LRU list), refuse to free bpage. */
alloc:
buf_pool_mutex_exit_forbid();
//buf_pool_mutex_exit_forbid();
b = buf_buddy_alloc(sizeof *b, NULL, FALSE);
buf_pool_mutex_exit_allow();
//buf_pool_mutex_exit_allow();
if (UNIV_UNLIKELY(!b)) {
return(BUF_LRU_CANNOT_RELOCATE);
}
memcpy(b, bpage, sizeof *b);
//memcpy(b, bpage, sizeof *b);
}
#ifdef UNIV_DEBUG
......@@ -1414,22 +1444,36 @@ alloc:
/* not to break latch order, must re-enter block_mutex */
mutex_exit(block_mutex);
mutex_enter(&LRU_list_mutex); /* optimistic */
if (!have_LRU_mutex)
mutex_enter(&LRU_list_mutex); /* optimistic */
mutex_enter(&flush_list_mutex);
mutex_enter(&page_hash_mutex);
mutex_enter(block_mutex);
/* recheck states of block */
if (!bpage->in_LRU_list /* <- if statisfy it, is restart of LRU scan needed ? */
|| !buf_page_can_relocate(bpage)
|| ( (zip || !bpage->zip.data) && bpage->oldest_modification )
|| ( bpage->oldest_modification
&& buf_page_get_state(bpage) != BUF_BLOCK_FILE_PAGE ) ) {
if (!bpage->in_LRU_list || block_mutex != buf_page_get_mutex(bpage)
|| !buf_page_can_relocate(bpage)) {
not_freed:
if (b) {
buf_buddy_free(b, sizeof *b, TRUE);
}
mutex_exit(&LRU_list_mutex);
if (!have_LRU_mutex)
mutex_exit(&LRU_list_mutex);
mutex_exit(&flush_list_mutex);
mutex_exit(&page_hash_mutex);
return(BUF_LRU_NOT_FREED);
} else if (zip || !bpage->zip.data) {
if (bpage->oldest_modification)
goto not_freed;
} else if (bpage->oldest_modification) {
if (buf_page_get_state(bpage) != BUF_BLOCK_FILE_PAGE) {
ut_ad(buf_page_get_state(bpage) == BUF_BLOCK_ZIP_DIRTY);
goto not_freed;
}
}
if (b) {
memcpy(b, bpage, sizeof *b);
}
if (buf_LRU_block_remove_hashed_page(bpage, zip)
......@@ -1443,6 +1487,10 @@ alloc:
ut_a(!buf_page_hash_get(bpage->space, bpage->offset));
while (prev_b && !prev_b->in_LRU_list) {
prev_b = UT_LIST_GET_PREV(LRU, prev_b);
}
b->state = b->oldest_modification
? BUF_BLOCK_ZIP_DIRTY
: BUF_BLOCK_ZIP_PAGE;
......@@ -1558,6 +1606,7 @@ alloc:
//buf_pool_mutex_exit();
mutex_exit(&LRU_list_mutex);
mutex_exit(&flush_list_mutex);
mutex_exit(&page_hash_mutex);
mutex_exit(block_mutex);
......@@ -1591,6 +1640,8 @@ alloc:
}
//buf_pool_mutex_enter();
if (have_LRU_mutex)
mutex_enter(&LRU_list_mutex);
mutex_enter(block_mutex);
if (b) {
......@@ -1602,8 +1653,14 @@ alloc:
buf_LRU_block_free_hashed_page((buf_block_t*) bpage, FALSE);
} else {
mutex_enter(block_mutex);
if (!have_LRU_mutex)
mutex_exit(&LRU_list_mutex);
mutex_exit(&flush_list_mutex);
mutex_exit(&page_hash_mutex);
/* It may be bug of 1.0.2 */
//mutex_enter(block_mutex);
}
return(BUF_LRU_FREED);
......@@ -1653,9 +1710,9 @@ buf_LRU_block_free_non_file_page(
if (data) {
block->page.zip.data = NULL;
mutex_exit(&block->mutex);
buf_pool_mutex_exit_forbid();
//buf_pool_mutex_exit_forbid();
buf_buddy_free(data, page_zip_get_size(&block->page.zip), have_page_hash_mutex);
buf_pool_mutex_exit_allow();
//buf_pool_mutex_exit_allow();
mutex_enter(&block->mutex);
page_zip_set_size(&block->page.zip, 0);
}
......@@ -1823,11 +1880,11 @@ buf_LRU_block_remove_hashed_page(
UT_LIST_REMOVE(list, buf_pool->zip_clean, bpage);
mutex_exit(&buf_pool_zip_mutex);
buf_pool_mutex_exit_forbid();
//buf_pool_mutex_exit_forbid();
buf_buddy_free(bpage->zip.data,
page_zip_get_size(&bpage->zip), TRUE);
buf_buddy_free(bpage, sizeof(*bpage), TRUE);
buf_pool_mutex_exit_allow();
//buf_pool_mutex_exit_allow();
UNIV_MEM_UNDESC(bpage);
return(BUF_BLOCK_ZIP_FREE);
......
......@@ -8842,6 +8842,10 @@ innobase_xa_prepare(
if (thd_sql_command(thd) != SQLCOM_XA_PREPARE &&
(all || !thd_test_options(thd, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)))
{
if (srv_enable_unsafe_group_commit && !THDVAR(thd, support_xa)) {
/* choose group commit rather than binlog order */
return(0);
}
/* For ibbackup to work the order of transactions in binlog
and InnoDB must be the same. Consider the situation
......@@ -9646,6 +9650,11 @@ static MYSQL_SYSVAR_ULONG(adaptive_checkpoint, srv_adaptive_checkpoint,
"Enable/Disable flushing along modified age. 0:disable 1:enable",
NULL, NULL, 0, 0, 1, 0);
static MYSQL_SYSVAR_ULONG(enable_unsafe_group_commit, srv_enable_unsafe_group_commit,
PLUGIN_VAR_RQCMDARG,
"Enable/Disable unsafe group commit when support_xa=OFF and use with binlog or other XA storage engine.",
NULL, NULL, 0, 0, 1, 0);
static MYSQL_SYSVAR_ULONG(read_io_threads, innobase_read_io_threads,
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
"Number of background read I/O threads in InnoDB.",
......@@ -9656,6 +9665,11 @@ static MYSQL_SYSVAR_ULONG(write_io_threads, innobase_write_io_threads,
"Number of background write I/O threads in InnoDB.",
NULL, NULL, 1, 1, 64, 0);
static MYSQL_SYSVAR_ULONG(extra_rsegments, srv_extra_rsegments,
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
"Number of extra user rollback segments when create new database.",
NULL, NULL, 0, 0, 127, 0);
static struct st_mysql_sys_var* innobase_system_variables[]= {
MYSQL_SYSVAR(additional_mem_pool_size),
MYSQL_SYSVAR(autoextend_increment),
......@@ -9712,8 +9726,10 @@ static struct st_mysql_sys_var* innobase_system_variables[]= {
MYSQL_SYSVAR(flush_neighbor_pages),
MYSQL_SYSVAR(read_ahead),
MYSQL_SYSVAR(adaptive_checkpoint),
MYSQL_SYSVAR(enable_unsafe_group_commit),
MYSQL_SYSVAR(read_io_threads),
MYSQL_SYSVAR(write_io_threads),
MYSQL_SYSVAR(extra_rsegments),
NULL
};
......@@ -9894,6 +9910,7 @@ mysql_declare_plugin(innobase)
innobase_system_variables, /* system variables */
NULL /* reserved */
},
i_s_innodb_rseg,
i_s_innodb_buffer_pool_pages,
i_s_innodb_buffer_pool_pages_index,
i_s_innodb_buffer_pool_pages_blob,
......
......@@ -27,6 +27,8 @@ extern "C" {
#include "srv0start.h" /* for srv_was_started */
#include "btr0btr.h" /* for btr_page_get_index_id */
#include "dict0dict.h" /* for dict_index_get_if_in_cache */
#include "trx0rseg.h" /* for trx_rseg_struct */
#include "trx0sys.h" /* for trx_sys */
/* from buf0buf.c */
struct buf_chunk_struct{
ulint mem_size; /* allocated size of the chunk */
......@@ -374,7 +376,6 @@ UNIV_INTERN struct st_mysql_plugin i_s_innodb_patches =
static ST_FIELD_INFO i_s_innodb_buffer_pool_pages_fields_info[] =
{
#define IDX_BUFFER_POOL_PAGES_PAGE_TYPE 0
{STRUCT_FLD(field_name, "page_type"),
STRUCT_FLD(field_length, 64),
STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
......@@ -383,7 +384,6 @@ static ST_FIELD_INFO i_s_innodb_buffer_pool_pages_fields_info[] =
STRUCT_FLD(old_name, ""),
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
#define IDX_BUFFER_POOL_PAGES_SPACE_ID 1
{STRUCT_FLD(field_name, "space_id"),
STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
......@@ -392,7 +392,6 @@ static ST_FIELD_INFO i_s_innodb_buffer_pool_pages_fields_info[] =
STRUCT_FLD(old_name, ""),
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
#define IDX_BUFFER_POOL_PAGES_PAGE_NO 2
{STRUCT_FLD(field_name, "page_no"),
STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
......@@ -401,7 +400,6 @@ static ST_FIELD_INFO i_s_innodb_buffer_pool_pages_fields_info[] =
STRUCT_FLD(old_name, ""),
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
#define IDX_BUFFER_POOL_PAGES_LRU_POSITION 3
{STRUCT_FLD(field_name, "lru_position"),
STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
......@@ -410,7 +408,6 @@ static ST_FIELD_INFO i_s_innodb_buffer_pool_pages_fields_info[] =
STRUCT_FLD(old_name, ""),
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
#define IDX_BUFFER_POOL_PAGES_FIX_COUNT 4
{STRUCT_FLD(field_name, "fix_count"),
STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
......@@ -419,7 +416,6 @@ static ST_FIELD_INFO i_s_innodb_buffer_pool_pages_fields_info[] =
STRUCT_FLD(old_name, ""),
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
#define IDX_BUFFER_POOL_PAGES_FLUSH_TYPE 5
{STRUCT_FLD(field_name, "flush_type"),
STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
......@@ -433,7 +429,6 @@ static ST_FIELD_INFO i_s_innodb_buffer_pool_pages_fields_info[] =
static ST_FIELD_INFO i_s_innodb_buffer_pool_pages_index_fields_info[] =
{
#define IDX_BUFFER_POOL_PAGES_INDEX_SCHEMA_NAME 0
{STRUCT_FLD(field_name, "schema_name"),
STRUCT_FLD(field_length, 64),
STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
......@@ -442,7 +437,6 @@ static ST_FIELD_INFO i_s_innodb_buffer_pool_pages_index_fields_info[] =
STRUCT_FLD(old_name, ""),
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
#define IDX_BUFFER_POOL_PAGES_INDEX_TABLE_NAME 1
{STRUCT_FLD(field_name, "table_name"),
STRUCT_FLD(field_length, 64),
STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
......@@ -451,7 +445,6 @@ static ST_FIELD_INFO i_s_innodb_buffer_pool_pages_index_fields_info[] =
STRUCT_FLD(old_name, ""),
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
#define IDX_BUFFER_POOL_PAGES_INDEX_INDEX_NAME 2
{STRUCT_FLD(field_name, "index_name"),
STRUCT_FLD(field_length, 64),
STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
......@@ -460,7 +453,6 @@ static ST_FIELD_INFO i_s_innodb_buffer_pool_pages_index_fields_info[] =
STRUCT_FLD(old_name, ""),
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
#define IDX_BUFFER_POOL_PAGES_SPACE_ID 3
{STRUCT_FLD(field_name, "space_id"),
STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
......@@ -469,7 +461,6 @@ static ST_FIELD_INFO i_s_innodb_buffer_pool_pages_index_fields_info[] =
STRUCT_FLD(old_name, ""),
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
#define IDX_BUFFER_POOL_PAGES_INDEX_PAGE_NO 4
{STRUCT_FLD(field_name, "page_no"),
STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
......@@ -478,7 +469,6 @@ static ST_FIELD_INFO i_s_innodb_buffer_pool_pages_index_fields_info[] =
STRUCT_FLD(old_name, ""),
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
#define IDX_BUFFER_POOL_PAGES_INDEX_N_RECS 5
{STRUCT_FLD(field_name, "n_recs"),
STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
......@@ -487,7 +477,6 @@ static ST_FIELD_INFO i_s_innodb_buffer_pool_pages_index_fields_info[] =
STRUCT_FLD(old_name, ""),
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
#define IDX_BUFFER_POOL_PAGES_INDEX_DATA_SIZE 6
{STRUCT_FLD(field_name, "data_size"),
STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
......@@ -496,7 +485,6 @@ static ST_FIELD_INFO i_s_innodb_buffer_pool_pages_index_fields_info[] =
STRUCT_FLD(old_name, ""),
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
#define IDX_BUFFER_POOL_PAGES_INDEX_HASHED 7
{STRUCT_FLD(field_name, "hashed"),
STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
......@@ -505,7 +493,6 @@ static ST_FIELD_INFO i_s_innodb_buffer_pool_pages_index_fields_info[] =
STRUCT_FLD(old_name, ""),
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
#define IDX_BUFFER_POOL_PAGES_INDEX_ACCESSED 8
{STRUCT_FLD(field_name, "accessed"),
STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
......@@ -514,7 +501,6 @@ static ST_FIELD_INFO i_s_innodb_buffer_pool_pages_index_fields_info[] =
STRUCT_FLD(old_name, ""),
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
#define IDX_BUFFER_POOL_PAGES_INDEX_MODIFIED 9
{STRUCT_FLD(field_name, "modified"),
STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
......@@ -523,7 +509,6 @@ static ST_FIELD_INFO i_s_innodb_buffer_pool_pages_index_fields_info[] =
STRUCT_FLD(old_name, ""),
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
#define IDX_BUFFER_POOL_PAGES_INDEX_DIRTY 10
{STRUCT_FLD(field_name, "dirty"),
STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
......@@ -532,7 +517,6 @@ static ST_FIELD_INFO i_s_innodb_buffer_pool_pages_index_fields_info[] =
STRUCT_FLD(old_name, ""),
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
#define IDX_BUFFER_POOL_PAGES_INDEX_OLD 11
{STRUCT_FLD(field_name, "old"),
STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
......@@ -541,7 +525,6 @@ static ST_FIELD_INFO i_s_innodb_buffer_pool_pages_index_fields_info[] =
STRUCT_FLD(old_name, ""),
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
#define IDX_BUFFER_POOL_PAGES_INDEX_LRU_POSITION 12
{STRUCT_FLD(field_name, "lru_position"),
STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
......@@ -550,7 +533,6 @@ static ST_FIELD_INFO i_s_innodb_buffer_pool_pages_index_fields_info[] =
STRUCT_FLD(old_name, ""),
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
#define IDX_BUFFER_POOL_PAGES_INDEX_FIX_COUNT 13
{STRUCT_FLD(field_name, "fix_count"),
STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
......@@ -559,7 +541,6 @@ static ST_FIELD_INFO i_s_innodb_buffer_pool_pages_index_fields_info[] =
STRUCT_FLD(old_name, ""),
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
#define IDX_BUFFER_POOL_PAGES_INDEX_FLUSH_TYPE 14
{STRUCT_FLD(field_name, "flush_type"),
STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
......@@ -573,7 +554,6 @@ static ST_FIELD_INFO i_s_innodb_buffer_pool_pages_index_fields_info[] =
static ST_FIELD_INFO i_s_innodb_buffer_pool_pages_blob_fields_info[] =
{
#define IDX_BUFFER_POOL_PAGES_BLOB_SPACE_ID 0
{STRUCT_FLD(field_name, "space_id"),
STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
......@@ -582,7 +562,6 @@ static ST_FIELD_INFO i_s_innodb_buffer_pool_pages_blob_fields_info[] =
STRUCT_FLD(old_name, ""),
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
#define IDX_BUFFER_POOL_PAGES_BLOB_PAGE_NO 1
{STRUCT_FLD(field_name, "page_no"),
STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
......@@ -591,7 +570,6 @@ static ST_FIELD_INFO i_s_innodb_buffer_pool_pages_blob_fields_info[] =
STRUCT_FLD(old_name, ""),
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
#define IDX_BUFFER_POOL_PAGES_BLOB_COMPRESSED 2
{STRUCT_FLD(field_name, "compressed"),
STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
......@@ -600,7 +578,6 @@ static ST_FIELD_INFO i_s_innodb_buffer_pool_pages_blob_fields_info[] =
STRUCT_FLD(old_name, ""),
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
#define IDX_BUFFER_POOL_PAGES_BLOB_PART_LEN 3
{STRUCT_FLD(field_name, "part_len"),
STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
......@@ -609,7 +586,6 @@ static ST_FIELD_INFO i_s_innodb_buffer_pool_pages_blob_fields_info[] =
STRUCT_FLD(old_name, ""),
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
#define IDX_BUFFER_POOL_PAGES_BLOB_NEXT_PAGE_NO 4
{STRUCT_FLD(field_name, "next_page_no"),
STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
......@@ -618,7 +594,6 @@ static ST_FIELD_INFO i_s_innodb_buffer_pool_pages_blob_fields_info[] =
STRUCT_FLD(old_name, ""),
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
#define IDX_BUFFER_POOL_PAGES_BLOB_LRU_POSITION 5
{STRUCT_FLD(field_name, "lru_position"),
STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
......@@ -627,7 +602,6 @@ static ST_FIELD_INFO i_s_innodb_buffer_pool_pages_blob_fields_info[] =
STRUCT_FLD(old_name, ""),
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
#define IDX_BUFFER_POOL_PAGES_BLOB_FIX_COUNT 6
{STRUCT_FLD(field_name, "fix_count"),
STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
......@@ -636,7 +610,6 @@ static ST_FIELD_INFO i_s_innodb_buffer_pool_pages_blob_fields_info[] =
STRUCT_FLD(old_name, ""),
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
#define IDX_BUFFER_POOL_PAGES_BLOB_FLUSH_TYPE 7
{STRUCT_FLD(field_name, "flush_type"),
STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
......@@ -674,6 +647,8 @@ i_s_innodb_buffer_pool_pages_fill(
DBUG_RETURN(0);
}
RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name);
buf_pool_mutex_enter();
mutex_enter(&(dict_sys->mutex));
......@@ -785,6 +760,8 @@ i_s_innodb_buffer_pool_pages_index_fill(
DBUG_RETURN(0);
}
RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name);
buf_pool_mutex_enter();
mutex_enter(&(dict_sys->mutex));
......@@ -874,6 +851,8 @@ i_s_innodb_buffer_pool_pages_blob_fill(
DBUG_RETURN(0);
}
RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name);
buf_pool_mutex_enter();
mutex_enter(&(dict_sys->mutex));
......@@ -2497,3 +2476,164 @@ i_s_common_deinit(
DBUG_RETURN(0);
}
/***********************************************************************
*/
static ST_FIELD_INFO i_s_innodb_rseg_fields_info[] =
{
{STRUCT_FLD(field_name, "rseg_id"),
STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
STRUCT_FLD(value, 0),
STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
STRUCT_FLD(old_name, ""),
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
{STRUCT_FLD(field_name, "space_id"),
STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
STRUCT_FLD(value, 0),
STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
STRUCT_FLD(old_name, ""),
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
{STRUCT_FLD(field_name, "zip_size"),
STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
STRUCT_FLD(value, 0),
STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
STRUCT_FLD(old_name, ""),
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
{STRUCT_FLD(field_name, "page_no"),
STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
STRUCT_FLD(value, 0),
STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
STRUCT_FLD(old_name, ""),
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
{STRUCT_FLD(field_name, "max_size"),
STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
STRUCT_FLD(value, 0),
STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
STRUCT_FLD(old_name, ""),
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
{STRUCT_FLD(field_name, "curr_size"),
STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
STRUCT_FLD(value, 0),
STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
STRUCT_FLD(old_name, ""),
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
END_OF_ST_FIELD_INFO
};
static
int
i_s_innodb_rseg_fill(
/*=================*/
THD* thd, /* in: thread */
TABLE_LIST* tables, /* in/out: tables to fill */
COND* cond) /* in: condition (ignored) */
{
TABLE* table = (TABLE *) tables->table;
int status = 0;
trx_rseg_t* rseg;
/* deny access to non-superusers */
if (check_global_access(thd, PROCESS_ACL)) {
DBUG_RETURN(0);
}
RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name);
rseg = UT_LIST_GET_FIRST(trx_sys->rseg_list);
while (rseg) {
table->field[0]->store(rseg->id);
table->field[1]->store(rseg->space);
table->field[2]->store(rseg->zip_size);
table->field[3]->store(rseg->page_no);
table->field[4]->store(rseg->max_size);
table->field[5]->store(rseg->curr_size);
if (schema_table_store_record(thd, table)) {
status = 1;
break;
}
rseg = UT_LIST_GET_NEXT(rseg_list, rseg);
}
DBUG_RETURN(status);
}
static
int
i_s_innodb_rseg_init(
/*=================*/
/* out: 0 on success */
void* p) /* in/out: table schema object */
{
DBUG_ENTER("i_s_innodb_rseg_init");
ST_SCHEMA_TABLE* schema = (ST_SCHEMA_TABLE*) p;
schema->fields_info = i_s_innodb_rseg_fields_info;
schema->fill_table = i_s_innodb_rseg_fill;
DBUG_RETURN(0);
}
UNIV_INTERN struct st_mysql_plugin i_s_innodb_rseg =
{
/* the plugin type (a MYSQL_XXX_PLUGIN value) */
/* int */
STRUCT_FLD(type, MYSQL_INFORMATION_SCHEMA_PLUGIN),
/* pointer to type-specific plugin descriptor */
/* void* */
STRUCT_FLD(info, &i_s_info),
/* plugin name */
/* const char* */
STRUCT_FLD(name, "INNODB_RSEG"),
/* plugin author (for SHOW PLUGINS) */
/* const char* */
STRUCT_FLD(author, plugin_author),
/* general descriptive text (for SHOW PLUGINS) */
/* const char* */
STRUCT_FLD(descr, "InnoDB rollback segment information"),
/* the plugin license (PLUGIN_LICENSE_XXX) */
/* int */
STRUCT_FLD(license, PLUGIN_LICENSE_GPL),
/* the function to invoke when plugin is loaded */
/* int (*)(void*); */
STRUCT_FLD(init, i_s_innodb_rseg_init),
/* the function to invoke when plugin is unloaded */
/* int (*)(void*); */
STRUCT_FLD(deinit, i_s_common_deinit),
/* plugin version (for SHOW PLUGINS) */
/* unsigned int */
STRUCT_FLD(version, 0x0100 /* 1.0 */),
/* struct st_mysql_show_var* */
STRUCT_FLD(status_vars, NULL),
/* struct st_mysql_sys_var** */
STRUCT_FLD(system_vars, NULL),
/* reserved for dependency checking */
/* void* */
STRUCT_FLD(__reserved1, NULL)
};
......@@ -20,5 +20,6 @@ extern struct st_mysql_plugin i_s_innodb_cmp_reset;
extern struct st_mysql_plugin i_s_innodb_cmpmem;
extern struct st_mysql_plugin i_s_innodb_cmpmem_reset;
extern struct st_mysql_plugin i_s_innodb_patches;
extern struct st_mysql_plugin i_s_innodb_rseg;
#endif /* i_s_h */
......@@ -31,5 +31,6 @@ struct innodb_enhancement {
{"innodb_buffer_pool_pages","Information of buffer pool content","","http://www.percona.com/docs/wiki/percona-xtradb:innodb_buffer_pool_pages"},
{"innodb_split_buf_pool_mutex","More fix of buffer_pool mutex","Spliting buf_pool_mutex and optimizing based on innodb_opt_lru_count","http://www.percona.com/docs/wiki/percona-xtradb:innodb_split_buf_pool_mutex"},
{"innodb_expand_undo_slots","expandable maximum number of undo slots","from 1024 (default) to about 4000","http://www.percona.com/docs/wiki/percona-xtradb:innodb_expand_undo_slots"},
{"innodb_extra_rseg","allow to create extra rollback segments","When create new db, the new parameter allows to create more rollback segments","http://www.percona.com/docs/wiki/percona-xtradb:innodb_extra_rseg"},
{NULL, NULL, NULL, NULL}
};
......@@ -107,9 +107,21 @@ buf_buddy_free(
{
//ut_ad(buf_pool_mutex_own());
if (!have_page_hash_mutex) {
mutex_enter(&LRU_list_mutex);
mutex_enter(&flush_list_mutex);
mutex_enter(&page_hash_mutex);
}
mutex_enter(&zip_free_mutex);
buf_buddy_free_low(buf, buf_buddy_get_slot(size), have_page_hash_mutex);
buf_buddy_free_low(buf, buf_buddy_get_slot(size), TRUE);
mutex_exit(&zip_free_mutex);
if (!have_page_hash_mutex) {
mutex_exit(&LRU_list_mutex);
mutex_exit(&flush_list_mutex);
mutex_exit(&page_hash_mutex);
}
}
#ifdef UNIV_MATERIALIZE
......
......@@ -1098,11 +1098,11 @@ struct buf_block_struct{
a block is in the unzip_LRU list
if page.state == BUF_BLOCK_FILE_PAGE
and page.zip.data != NULL */
#ifdef UNIV_DEBUG
//#ifdef UNIV_DEBUG
ibool in_unzip_LRU_list;/* TRUE if the page is in the
decompressed LRU list;
used in debugging */
#endif /* UNIV_DEBUG */
//#endif /* UNIV_DEBUG */
byte* frame; /* pointer to buffer frame which
is of size UNIV_PAGE_SIZE, and
aligned to an address divisible by
......
......@@ -222,7 +222,7 @@ buf_page_in_file(
case BUF_BLOCK_ZIP_FREE:
/* This is a free page in buf_pool->zip_free[].
Such pages should only be accessed by the buddy allocator. */
ut_error;
/* ut_error; */ /* optimistic */
break;
case BUF_BLOCK_ZIP_PAGE:
case BUF_BLOCK_ZIP_DIRTY:
......@@ -280,7 +280,7 @@ buf_page_get_mutex(
{
switch (buf_page_get_state(bpage)) {
case BUF_BLOCK_ZIP_FREE:
ut_error;
/* ut_error; */ /* optimistic */
return(NULL);
case BUF_BLOCK_ZIP_PAGE:
case BUF_BLOCK_ZIP_DIRTY:
......@@ -414,11 +414,12 @@ buf_page_can_relocate(
const buf_page_t* bpage) /* control block being relocated */
{
//ut_ad(buf_pool_mutex_own());
ut_ad(mutex_own(buf_page_get_mutex(bpage)));
ut_ad(buf_page_in_file(bpage));
ut_ad(bpage->in_LRU_list);
/* optimistic */
//ut_ad(mutex_own(buf_page_get_mutex(bpage)));
//ut_ad(buf_page_in_file(bpage));
//ut_ad(bpage->in_LRU_list);
return(buf_page_get_io_fix(bpage) == BUF_IO_NONE
return(bpage->in_LRU_list && bpage->io_fix == BUF_IO_NONE
&& bpage->buf_fix_count == 0);
}
......@@ -1045,12 +1046,15 @@ buf_page_release(
if (rw_latch == RW_X_LATCH && mtr->modifications) {
//buf_pool_mutex_enter();
mutex_enter(&flush_list_mutex);
mutex_enter(&block->mutex);
ut_ad(buf_block_get_state(block) == BUF_BLOCK_FILE_PAGE);
buf_flush_note_modification(block, mtr);
//buf_pool_mutex_exit();
mutex_exit(&flush_list_mutex);
}
else {
mutex_enter(&block->mutex);
}
#ifdef UNIV_SYNC_DEBUG
rw_lock_s_unlock(&(block->debug_latch));
......
......@@ -100,10 +100,11 @@ buf_LRU_free_block(
buf_page_t* bpage, /* in: block to be freed */
ibool zip, /* in: TRUE if should remove also the
compressed page of an uncompressed page */
ibool* buf_pool_mutex_released);
ibool* buf_pool_mutex_released,
/* in: pointer to a variable that will
be assigned TRUE if buf_pool_mutex
was temporarily released, or NULL */
ibool have_LRU_mutex);
/**********************************************************************
Try to free a replaceable block. */
UNIV_INTERN
......
......@@ -157,9 +157,12 @@ extern long long srv_ibuf_max_size;
extern ulint srv_ibuf_active_contract;
extern ulint srv_ibuf_accel_rate;
extern ulint srv_flush_neighbor_pages;
extern ulint srv_enable_unsafe_group_commit;
extern ulint srv_read_ahead;
extern ulint srv_adaptive_checkpoint;
extern ulint srv_extra_rsegments;
/*-------------------------------------------*/
extern ulint srv_n_rows_inserted;
......
......@@ -106,6 +106,13 @@ UNIV_INTERN
void
trx_sys_create(void);
/*================*/
/*********************************************************************
Create extra rollback segments when create_new_db */
UNIV_INTERN
void
trx_sys_create_extra_rseg(
/*======================*/
ulint num); /* in: number of extra user rollback segments */
/********************************************************************
Looks for a free slot for a rollback segment in the trx system file copy. */
UNIV_INTERN
......
......@@ -12,7 +12,7 @@ Created 1/20/1994 Heikki Tuuri
#define INNODB_VERSION_MAJOR 1
#define INNODB_VERSION_MINOR 0
#define INNODB_VERSION_BUGFIX 2
#define PERCONA_INNODB_VERSION 1
#define PERCONA_INNODB_VERSION 3
/* The following is the InnoDB version as shown in
SELECT plugin_version FROM information_schema.plugins;
......
diff mysql-test/r/information_schema.result.orig mysql-test/r/information_schema.result
--- mysql-test/r/information_schema.result.orig 2008-08-04 09:27:49.000000000 +0300
+++ mysql-test/r/information_schema.result 2008-10-07 11:21:51.000000000 +0300
@@ -64,6 +64,17 @@
@@ -64,6 +64,18 @@
TRIGGERS
USER_PRIVILEGES
VIEWS
+INNODB_CMP
+INNODB_BUFFER_POOL_PAGES
+INNODB_CMPMEM
+INNODB_BUFFER_POOL_PAGES_INDEX
+INNODB_RSEG
+INNODB_LOCKS
+INNODB_BUFFER_POOL_PAGES
+XTRADB_ENHANCEMENTS
+INNODB_TRX
+INNODB_BUFFER_POOL_PAGES_BLOB
+INNODB_LOCK_WAITS
+INNODB_CMP_RESET
+INNODB_LOCKS
+INNODB_CMP
+INNODB_CMPMEM_RESET
+INNODB_CMPMEM
columns_priv
db
event
@@ -795,6 +806,8 @@
@@ -795,6 +807,8 @@
TABLES UPDATE_TIME datetime
TABLES CHECK_TIME datetime
TRIGGERS CREATED datetime
......@@ -28,7 +29,7 @@ diff mysql-test/r/information_schema.result.orig mysql-test/r/information_schema
event execute_at datetime
event last_executed datetime
event starts datetime
@@ -843,12 +856,13 @@
@@ -843,12 +857,13 @@
TABLE_CONSTRAINTS TABLE_NAME select
TABLE_PRIVILEGES TABLE_NAME select
VIEWS TABLE_NAME select
......@@ -39,43 +40,45 @@ diff mysql-test/r/information_schema.result.orig mysql-test/r/information_schema
SELECT table_schema, count(*) FROM information_schema.TABLES where table_name<>'ndb_binlog_index' AND table_name<>'ndb_apply_status' GROUP BY TABLE_SCHEMA;
table_schema count(*)
-information_schema 28
+information_schema 39
+information_schema 40
mysql 22
create table t1 (i int, j int);
create trigger trg1 before insert on t1 for each row
@@ -1263,6 +1277,17 @@
@@ -1263,6 +1278,18 @@
TRIGGERS TRIGGER_SCHEMA
USER_PRIVILEGES GRANTEE
VIEWS TABLE_SCHEMA
+INNODB_CMP page_size
+INNODB_BUFFER_POOL_PAGES page_type
+INNODB_CMPMEM page_size
+INNODB_BUFFER_POOL_PAGES_INDEX schema_name
+INNODB_RSEG rseg_id
+INNODB_LOCKS lock_id
+INNODB_BUFFER_POOL_PAGES page_type
+XTRADB_ENHANCEMENTS name
+INNODB_TRX trx_id
+INNODB_BUFFER_POOL_PAGES_BLOB space_id
+INNODB_LOCK_WAITS requesting_trx_id
+INNODB_CMP_RESET page_size
+INNODB_LOCKS lock_id
+INNODB_CMP page_size
+INNODB_CMPMEM_RESET page_size
+INNODB_CMPMEM page_size
SELECT t.table_name, c1.column_name
FROM information_schema.tables t
INNER JOIN
@@ -1306,14 +1331,25 @@
@@ -1306,14 +1333,26 @@
TRIGGERS TRIGGER_SCHEMA
USER_PRIVILEGES GRANTEE
VIEWS TABLE_SCHEMA
+INNODB_CMP page_size
+INNODB_BUFFER_POOL_PAGES page_type
+INNODB_CMPMEM page_size
+INNODB_BUFFER_POOL_PAGES_INDEX schema_name
+INNODB_RSEG rseg_id
+INNODB_LOCKS lock_id
+INNODB_BUFFER_POOL_PAGES page_type
+XTRADB_ENHANCEMENTS name
+INNODB_TRX trx_id
+INNODB_BUFFER_POOL_PAGES_BLOB space_id
+INNODB_LOCK_WAITS requesting_trx_id
+INNODB_CMP_RESET page_size
+INNODB_LOCKS lock_id
+INNODB_CMP page_size
+INNODB_CMPMEM_RESET page_size
+INNODB_CMPMEM page_size
SELECT MAX(table_name) FROM information_schema.tables;
MAX(table_name)
-VIEWS
......@@ -89,7 +92,7 @@ diff mysql-test/r/information_schema.result.orig mysql-test/r/information_schema
DROP TABLE IF EXISTS bug23037;
DROP FUNCTION IF EXISTS get_value;
SELECT COLUMN_NAME, MD5(COLUMN_DEFAULT), LENGTH(COLUMN_DEFAULT) FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='bug23037';
@@ -1382,6 +1418,16 @@
@@ -1382,6 +1421,17 @@
FILES information_schema.FILES 1
GLOBAL_STATUS information_schema.GLOBAL_STATUS 1
GLOBAL_VARIABLES information_schema.GLOBAL_VARIABLES 1
......@@ -102,11 +105,12 @@ diff mysql-test/r/information_schema.result.orig mysql-test/r/information_schema
+INNODB_CMP_RESET information_schema.INNODB_CMP_RESET 1
+INNODB_LOCKS information_schema.INNODB_LOCKS 1
+INNODB_LOCK_WAITS information_schema.INNODB_LOCK_WAITS 1
+INNODB_RSEG information_schema.INNODB_RSEG 1
+INNODB_TRX information_schema.INNODB_TRX 1
KEY_COLUMN_USAGE information_schema.KEY_COLUMN_USAGE 1
PARTITIONS information_schema.PARTITIONS 1
PLUGINS information_schema.PLUGINS 1
@@ -1400,6 +1446,7 @@
@@ -1400,6 +1450,7 @@
TRIGGERS information_schema.TRIGGERS 1
USER_PRIVILEGES information_schema.USER_PRIVILEGES 1
VIEWS information_schema.VIEWS 1
......@@ -117,60 +121,63 @@ diff mysql-test/r/information_schema.result.orig mysql-test/r/information_schema
diff mysql-test/r/information_schema_db.result.orig mysql-test/r/information_schema_db.result
--- mysql-test/r/information_schema_db.result.orig 2008-08-04 09:27:49.000000000 +0300
+++ mysql-test/r/information_schema_db.result 2008-10-07 12:26:31.000000000 +0300
@@ -33,6 +33,17 @@
@@ -33,6 +33,18 @@
TRIGGERS
USER_PRIVILEGES
VIEWS
+INNODB_CMP
+INNODB_BUFFER_POOL_PAGES
+INNODB_CMPMEM
+INNODB_BUFFER_POOL_PAGES_INDEX
+INNODB_RSEG
+INNODB_LOCKS
+INNODB_BUFFER_POOL_PAGES
+XTRADB_ENHANCEMENTS
+INNODB_TRX
+INNODB_BUFFER_POOL_PAGES_BLOB
+INNODB_LOCK_WAITS
+INNODB_CMP_RESET
+INNODB_LOCKS
+INNODB_CMP
+INNODB_CMPMEM_RESET
+INNODB_CMPMEM
show tables from INFORMATION_SCHEMA like 'T%';
Tables_in_information_schema (T%)
TABLES
diff mysql-test/r/mysqlshow.result.orig mysql-test/r/mysqlshow.result
--- mysql-test/r/mysqlshow.result.orig 2008-08-04 09:27:51.000000000 +0300
+++ mysql-test/r/mysqlshow.result 2008-10-07 12:35:39.000000000 +0300
@@ -107,6 +107,17 @@
@@ -107,6 +107,18 @@
| TRIGGERS |
| USER_PRIVILEGES |
| VIEWS |
+| INNODB_CMP |
+| INNODB_BUFFER_POOL_PAGES |
+| INNODB_CMPMEM |
+| INNODB_BUFFER_POOL_PAGES_INDEX |
+| INNODB_RSEG |
+| INNODB_LOCKS |
+| INNODB_BUFFER_POOL_PAGES |
+| XTRADB_ENHANCEMENTS |
+| INNODB_TRX |
+| INNODB_BUFFER_POOL_PAGES_BLOB |
+| INNODB_LOCK_WAITS |
+| INNODB_CMP_RESET |
+| INNODB_LOCKS |
+| INNODB_CMP |
+| INNODB_CMPMEM_RESET |
+| INNODB_CMPMEM |
+---------------------------------------+
Database: INFORMATION_SCHEMA
+---------------------------------------+
@@ -140,6 +151,17 @@
@@ -140,6 +152,18 @@
| TRIGGERS |
| USER_PRIVILEGES |
| VIEWS |
+| INNODB_CMP |
+| INNODB_BUFFER_POOL_PAGES |
+| INNODB_CMPMEM |
+| INNODB_BUFFER_POOL_PAGES_INDEX |
+| INNODB_RSEG |
+| INNODB_LOCKS |
+| INNODB_BUFFER_POOL_PAGES |
+| XTRADB_ENHANCEMENTS |
+| INNODB_TRX |
+| INNODB_BUFFER_POOL_PAGES_BLOB |
+| INNODB_LOCK_WAITS |
+| INNODB_CMP_RESET |
+| INNODB_LOCKS |
+| INNODB_CMP |
+| INNODB_CMPMEM_RESET |
+| INNODB_CMPMEM |
+---------------------------------------+
Wildcard: inf_rmation_schema
+--------------------+
......@@ -11,3 +11,4 @@ INSTALL PLUGIN XTRADB_ENHANCEMENTS SONAME 'ha_innodb.so';
INSTALL PLUGIN INNODB_BUFFER_POOL_PAGES SONAME 'ha_innodb.so';
INSTALL PLUGIN INNODB_BUFFER_POOL_PAGES_BLOB SONAME 'ha_innodb.so';
INSTALL PLUGIN INNODB_BUFFER_POOL_PAGES_INDEX SONAME 'ha_innodb.so';
INSTALL PLUGIN innodb_rseg SONAME 'ha_innodb.so';
......@@ -333,8 +333,11 @@ UNIV_INTERN ulint srv_ibuf_accel_rate = 100;
UNIV_INTERN ulint srv_flush_neighbor_pages = 1; /* 0:disable 1:enable */
UNIV_INTERN ulint srv_enable_unsafe_group_commit = 0; /* 0:disable 1:enable */
UNIV_INTERN ulint srv_read_ahead = 3; /* 1: random 2: linear 3: Both */
UNIV_INTERN ulint srv_adaptive_checkpoint = 0; /* 0:disable 1:enable */
UNIV_INTERN ulint srv_extra_rsegments = 0; /* extra rseg for users */
/*-------------------------------------------*/
UNIV_INTERN ulong srv_n_spin_wait_rounds = 20;
UNIV_INTERN ulong srv_n_free_tickets_to_enter = 500;
......
......@@ -1438,6 +1438,8 @@ innobase_start_or_create_for_mysql(void)
dict_create();
srv_startup_is_before_trx_rollback_phase = FALSE;
if (srv_extra_rsegments)
trx_sys_create_extra_rseg(srv_extra_rsegments);
#ifdef UNIV_LOG_ARCHIVE
} else if (srv_archive_recovery) {
fprintf(stderr,
......
......@@ -226,6 +226,7 @@ rw_lock_validate(
/*=============*/
rw_lock_t* lock)
{
ulint tmp;
ut_a(lock);
#ifndef HAVE_GCC_ATOMIC_BUILTINS
......@@ -233,18 +234,25 @@ rw_lock_validate(
#endif
ut_a(lock->magic_n == RW_LOCK_MAGIC_N);
#ifndef HAVE_GCC_ATOMIC_BUILTINS
/* It is dynamic combination */
ut_a((rw_lock_get_reader_count(lock) == 0)
|| (rw_lock_get_writer(lock) != RW_LOCK_EX));
ut_a((rw_lock_get_writer(lock) == RW_LOCK_EX)
|| (rw_lock_get_writer(lock) == RW_LOCK_WAIT_EX)
|| (rw_lock_get_writer(lock) == RW_LOCK_NOT_LOCKED));
ut_a((rw_lock_get_s_waiters(lock) == 0)
|| (rw_lock_get_s_waiters(lock) == 1));
ut_a((rw_lock_get_x_waiters(lock) == 0)
|| (rw_lock_get_x_waiters(lock) == 1));
ut_a((rw_lock_get_wx_waiters(lock) == 0)
|| (rw_lock_get_wx_waiters(lock) == 1));
#endif
tmp = rw_lock_get_writer(lock);
ut_a((tmp == RW_LOCK_EX)
|| (tmp == RW_LOCK_WAIT_EX)
|| (tmp == RW_LOCK_NOT_LOCKED));
tmp = rw_lock_get_s_waiters(lock);
ut_a((tmp == 0) || (tmp == 1));
tmp = rw_lock_get_x_waiters(lock);
ut_a((tmp == 0) || (tmp == 1));
tmp = rw_lock_get_wx_waiters(lock);
ut_a((tmp == 0) || (tmp == 1));
#ifndef HAVE_GCC_ATOMIC_BUILTINS
/* It is dynamic combination */
ut_a((lock->writer != RW_LOCK_EX) || (lock->writer_count > 0));
#endif
#ifndef HAVE_GCC_ATOMIC_BUILTINS
mutex_exit(rw_lock_get_mutex(lock));
......
......@@ -1049,6 +1049,31 @@ trx_sys_create(void)
trx_sys_init_at_db_start();
}
/*********************************************************************
Create extra rollback segments when create_new_db */
UNIV_INTERN
void
trx_sys_create_extra_rseg(
/*======================*/
ulint num) /* in: number of extra user rollback segments */
{
mtr_t mtr;
ulint slot_no;
ulint i;
/* Craete extra rollback segments */
mtr_start(&mtr);
for (i = 1; i < num + 1; i++) {
if(!trx_rseg_create(TRX_SYS_SPACE, ULINT_MAX, &slot_no, &mtr)) {
fprintf(stderr,
"InnoDB: Warning: Failed to create extra rollback segments.\n");
break;
}
ut_a(slot_no == i);
}
mtr_commit(&mtr);
}
/*********************************************************************
Update the file format tag. */
static
......
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