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( ...@@ -3690,6 +3690,7 @@ btr_blob_free(
mtr_commit(mtr); mtr_commit(mtr);
//buf_pool_mutex_enter(); //buf_pool_mutex_enter();
mutex_enter(&LRU_list_mutex);
mutex_enter(&block->mutex); mutex_enter(&block->mutex);
/* Only free the block if it is still allocated to /* Only free the block if it is still allocated to
...@@ -3700,7 +3701,7 @@ btr_blob_free( ...@@ -3700,7 +3701,7 @@ btr_blob_free(
&& buf_block_get_space(block) == space && buf_block_get_space(block) == space
&& buf_block_get_page_no(block) == page_no) { && 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 != BUF_LRU_FREED
&& all && block->page.zip.data && all && block->page.zip.data
/* Now, buf_LRU_free_block() may release mutex temporarily */ /* Now, buf_LRU_free_block() may release mutex temporarily */
...@@ -3710,11 +3711,12 @@ btr_blob_free( ...@@ -3710,11 +3711,12 @@ btr_blob_free(
/* Attempt to deallocate the uncompressed page /* Attempt to deallocate the uncompressed page
if the whole block cannot be deallocted. */ 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(); //buf_pool_mutex_exit();
mutex_exit(&LRU_list_mutex);
mutex_exit(&block->mutex); mutex_exit(&block->mutex);
} }
......
...@@ -800,7 +800,10 @@ btr_search_guess_on_hash( ...@@ -800,7 +800,10 @@ btr_search_guess_on_hash(
rw_lock_s_lock(&btr_search_latch); 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); ut_ad(btr_search_latch.writer != RW_LOCK_EX);
#endif
ut_ad(btr_search_latch.reader_count > 0); ut_ad(btr_search_latch.reader_count > 0);
rec = ha_search_and_get_data(btr_search_sys->hash_index, fold); rec = ha_search_and_get_data(btr_search_sys->hash_index, fold);
......
...@@ -123,7 +123,7 @@ buf_buddy_alloc_zip( ...@@ -123,7 +123,7 @@ buf_buddy_alloc_zip(
/* Valgrind would complain about accessing free memory. */ /* Valgrind would complain about accessing free memory. */
UT_LIST_VALIDATE(list, buf_page_t, buf_pool->zip_free[i]); UT_LIST_VALIDATE(list, buf_page_t, buf_pool->zip_free[i]);
#endif /* UNIV_DEBUG && !UNIV_DEBUG_VALGRIND */ #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) { if (bpage) {
UNIV_MEM_VALID(bpage, BUF_BUDDY_LOW << i); UNIV_MEM_VALID(bpage, BUF_BUDDY_LOW << i);
...@@ -315,14 +315,18 @@ buf_buddy_alloc_low( ...@@ -315,14 +315,18 @@ buf_buddy_alloc_low(
/* Try replacing an uncompressed page in the buffer pool. */ /* Try replacing an uncompressed page in the buffer pool. */
//buf_pool_mutex_exit(); //buf_pool_mutex_exit();
mutex_exit(&LRU_list_mutex); 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); mutex_exit(&page_hash_mutex);
}
block = buf_LRU_get_free_block(0); block = buf_LRU_get_free_block(0);
*lru = TRUE; *lru = TRUE;
//buf_pool_mutex_enter(); //buf_pool_mutex_enter();
mutex_enter(&LRU_list_mutex); 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); mutex_enter(&page_hash_mutex);
}
alloc_big: alloc_big:
buf_buddy_block_register(block); buf_buddy_block_register(block);
...@@ -350,6 +354,7 @@ buf_buddy_relocate_block( ...@@ -350,6 +354,7 @@ buf_buddy_relocate_block(
buf_page_t* b; buf_page_t* b;
//ut_ad(buf_pool_mutex_own()); //ut_ad(buf_pool_mutex_own());
ut_ad(mutex_own(&flush_list_mutex));
switch (buf_page_get_state(bpage)) { switch (buf_page_get_state(bpage)) {
case BUF_BLOCK_ZIP_FREE: case BUF_BLOCK_ZIP_FREE:
...@@ -358,7 +363,7 @@ buf_buddy_relocate_block( ...@@ -358,7 +363,7 @@ buf_buddy_relocate_block(
case BUF_BLOCK_FILE_PAGE: case BUF_BLOCK_FILE_PAGE:
case BUF_BLOCK_MEMORY: case BUF_BLOCK_MEMORY:
case BUF_BLOCK_REMOVE_HASH: case BUF_BLOCK_REMOVE_HASH:
ut_error; /* ut_error; */ /* optimistic */
case BUF_BLOCK_ZIP_DIRTY: case BUF_BLOCK_ZIP_DIRTY:
/* Cannot relocate dirty pages. */ /* Cannot relocate dirty pages. */
return(FALSE); return(FALSE);
...@@ -367,30 +372,24 @@ buf_buddy_relocate_block( ...@@ -367,30 +372,24 @@ buf_buddy_relocate_block(
break; break;
} }
/* optimistic */ mutex_enter(&buf_pool_zip_mutex);
mutex_enter(&zip_free_mutex);
if (!buf_page_can_relocate(bpage)) { if (!buf_page_can_relocate(bpage)) {
mutex_exit(&buf_pool_zip_mutex);
mutex_exit(&zip_free_mutex);
return(FALSE); return(FALSE);
} }
mutex_enter(&LRU_list_mutex); if (bpage != buf_page_hash_get(bpage->space, bpage->offset)) {
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);
mutex_exit(&buf_pool_zip_mutex); mutex_exit(&buf_pool_zip_mutex);
mutex_exit(&zip_free_mutex);
return(FALSE); return(FALSE);
} }
buf_relocate(bpage, dpage); buf_relocate(bpage, dpage);
ut_d(bpage->state = BUF_BLOCK_ZIP_FREE); ut_d(bpage->state = BUF_BLOCK_ZIP_FREE);
mutex_exit(&LRU_list_mutex);
mutex_exit(&page_hash_mutex);
/* relocate buf_pool->zip_clean */ /* relocate buf_pool->zip_clean */
b = UT_LIST_GET_PREV(list, dpage); b = UT_LIST_GET_PREV(list, dpage);
UT_LIST_REMOVE(list, buf_pool->zip_clean, dpage); UT_LIST_REMOVE(list, buf_pool->zip_clean, dpage);
...@@ -401,8 +400,8 @@ buf_buddy_relocate_block( ...@@ -401,8 +400,8 @@ buf_buddy_relocate_block(
UT_LIST_ADD_FIRST(list, buf_pool->zip_clean, dpage); UT_LIST_ADD_FIRST(list, buf_pool->zip_clean, dpage);
} }
mutex_exit(&flush_list_mutex);
mutex_exit(&buf_pool_zip_mutex); mutex_exit(&buf_pool_zip_mutex);
mutex_exit(&zip_free_mutex);
return(TRUE); return(TRUE);
} }
...@@ -448,8 +447,11 @@ buf_buddy_relocate( ...@@ -448,8 +447,11 @@ buf_buddy_relocate(
/* This is a compressed page. */ /* This is a compressed page. */
mutex_t* mutex; 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); mutex_enter(&page_hash_mutex);
}
/* The src block may be split into smaller blocks, /* The src block may be split into smaller blocks,
some of which may be free. Thus, the some of which may be free. Thus, the
mach_read_from_4() calls below may attempt to read mach_read_from_4() calls below may attempt to read
...@@ -471,8 +473,10 @@ buf_buddy_relocate( ...@@ -471,8 +473,10 @@ buf_buddy_relocate(
it cannot be relocated. */ it cannot be relocated. */
if (!have_page_hash_mutex) { if (!have_page_hash_mutex) {
mutex_exit(&page_hash_mutex);
mutex_enter(&zip_free_mutex); mutex_enter(&zip_free_mutex);
mutex_exit(&LRU_list_mutex);
mutex_exit(&flush_list_mutex);
mutex_exit(&page_hash_mutex);
} }
return(FALSE); return(FALSE);
} }
...@@ -484,8 +488,10 @@ buf_buddy_relocate( ...@@ -484,8 +488,10 @@ buf_buddy_relocate(
ut_ad(page_zip_get_size(&bpage->zip) < size); ut_ad(page_zip_get_size(&bpage->zip) < size);
if (!have_page_hash_mutex) { if (!have_page_hash_mutex) {
mutex_exit(&page_hash_mutex);
mutex_enter(&zip_free_mutex); mutex_enter(&zip_free_mutex);
mutex_exit(&LRU_list_mutex);
mutex_exit(&flush_list_mutex);
mutex_exit(&page_hash_mutex);
} }
return(FALSE); return(FALSE);
} }
...@@ -501,8 +507,7 @@ buf_buddy_relocate( ...@@ -501,8 +507,7 @@ buf_buddy_relocate(
mutex = buf_page_get_mutex(bpage); mutex = buf_page_get_mutex(bpage);
mutex_enter(mutex); mutex_enter(mutex);
if (!have_page_hash_mutex) mutex_enter(&zip_free_mutex);
mutex_exit(&page_hash_mutex);
if (buf_page_can_relocate(bpage)) { if (buf_page_can_relocate(bpage)) {
/* Relocate the compressed page. */ /* Relocate the compressed page. */
...@@ -520,29 +525,52 @@ buf_buddy_relocate( ...@@ -520,29 +525,52 @@ buf_buddy_relocate(
+= ut_time_us(NULL) - usec; += 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); 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_exit(mutex);
mutex_enter(&zip_free_mutex);
} else if (i == buf_buddy_get_slot(sizeof(buf_page_t))) { } else if (i == buf_buddy_get_slot(sizeof(buf_page_t))) {
/* This must be a buf_page_t object. */ /* This must be a buf_page_t object. */
UNIV_MEM_ASSERT_RW(src, size); UNIV_MEM_ASSERT_RW(src, size);
if (have_page_hash_mutex)
mutex_exit(&page_hash_mutex);
mutex_exit(&zip_free_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)) { if (buf_buddy_relocate_block(src, dst)) {
mutex_enter(&zip_free_mutex);
goto success; if (!have_page_hash_mutex) {
mutex_exit(&LRU_list_mutex);
mutex_exit(&flush_list_mutex);
mutex_exit(&page_hash_mutex);
} }
if (have_page_hash_mutex) goto success;
mutex_enter(&page_hash_mutex); }
mutex_enter(&zip_free_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); return(FALSE);
...@@ -632,7 +660,7 @@ buf_buddy_free_low( ...@@ -632,7 +660,7 @@ buf_buddy_free_low(
#endif /* UNIV_DEBUG_VALGRIND */ #endif /* UNIV_DEBUG_VALGRIND */
/* The buddy is not free. Is there a free block of this size? */ /* 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) { if (bpage) {
/* Remove the block from the free list, because a successful /* Remove the block from the free list, because a successful
......
...@@ -662,10 +662,10 @@ buf_block_init( ...@@ -662,10 +662,10 @@ buf_block_init(
block->page.in_zip_hash = FALSE; block->page.in_zip_hash = FALSE;
block->page.in_flush_list = FALSE; block->page.in_flush_list = FALSE;
block->page.in_free_list = FALSE; block->page.in_free_list = FALSE;
block->page.in_LRU_list = FALSE;
block->in_unzip_LRU_list = FALSE;
block->n_pointers = 0; block->n_pointers = 0;
#endif /* UNIV_DEBUG */ #endif /* UNIV_DEBUG */
block->page.in_LRU_list = FALSE;
block->in_unzip_LRU_list = FALSE;
page_zip_des_init(&block->page.zip); page_zip_des_init(&block->page.zip);
mutex_create(&block->mutex, SYNC_BUF_BLOCK); mutex_create(&block->mutex, SYNC_BUF_BLOCK);
...@@ -1191,7 +1191,7 @@ buf_pool_shrink( ...@@ -1191,7 +1191,7 @@ buf_pool_shrink(
buf_LRU_make_block_old(&block->page); buf_LRU_make_block_old(&block->page);
dirty++; 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) { != BUF_LRU_FREED) {
nonfree++; nonfree++;
} }
...@@ -1662,7 +1662,7 @@ buf_page_get_zip( ...@@ -1662,7 +1662,7 @@ buf_page_get_zip(
break; break;
case BUF_BLOCK_FILE_PAGE: case BUF_BLOCK_FILE_PAGE:
/* Discard the uncompressed page frame if possible. */ /* 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) { == BUF_LRU_FREED) {
mutex_exit(block_mutex); mutex_exit(block_mutex);
...@@ -1953,10 +1953,16 @@ buf_page_get_gen( ...@@ -1953,10 +1953,16 @@ buf_page_get_gen(
ibool success; ibool success;
case BUF_BLOCK_FILE_PAGE: case BUF_BLOCK_FILE_PAGE:
if (block_mutex == &buf_pool_zip_mutex) {
/* it is wrong mutex... */
mutex_exit(block_mutex);
goto loop;
}
break; break;
case BUF_BLOCK_ZIP_PAGE: case BUF_BLOCK_ZIP_PAGE:
case BUF_BLOCK_ZIP_DIRTY: case BUF_BLOCK_ZIP_DIRTY:
ut_ad(block_mutex == &buf_pool_zip_mutex);
bpage = &block->page; bpage = &block->page;
if (bpage->buf_fix_count if (bpage->buf_fix_count
...@@ -1980,7 +1986,7 @@ buf_page_get_gen( ...@@ -1980,7 +1986,7 @@ buf_page_get_gen(
block = buf_LRU_get_free_block(0); block = buf_LRU_get_free_block(0);
ut_a(block); ut_a(block);
block_mutex = buf_page_get_mutex((buf_page_t*)block); block_mutex = &block->mutex;
//buf_pool_mutex_enter(); //buf_pool_mutex_enter();
mutex_enter(&LRU_list_mutex); mutex_enter(&LRU_list_mutex);
...@@ -2001,9 +2007,10 @@ buf_page_get_gen( ...@@ -2001,9 +2007,10 @@ buf_page_get_gen(
mutex_exit(block_mutex); mutex_exit(block_mutex);
block = (buf_block_t*) hash_bpage; block = (buf_block_t*) hash_bpage;
if (block) {
block_mutex = buf_page_get_mutex((buf_page_t*)block); block_mutex = buf_page_get_mutex((buf_page_t*)block);
mutex_enter(block_mutex); mutex_enter(block_mutex);
}
mutex_exit(&page_hash_mutex); mutex_exit(&page_hash_mutex);
mutex_exit(&LRU_list_mutex); mutex_exit(&LRU_list_mutex);
mutex_exit(&flush_list_mutex); mutex_exit(&flush_list_mutex);
...@@ -2107,6 +2114,7 @@ buf_page_get_gen( ...@@ -2107,6 +2114,7 @@ buf_page_get_gen(
/* Unfix and unlatch the block. */ /* Unfix and unlatch the block. */
//buf_pool_mutex_enter(); //buf_pool_mutex_enter();
block_mutex = &block->mutex;
mutex_enter(block_mutex); mutex_enter(block_mutex);
mutex_enter(&buf_pool_mutex); mutex_enter(&buf_pool_mutex);
buf_pool->n_pend_unzip--; buf_pool->n_pend_unzip--;
...@@ -2119,7 +2127,7 @@ buf_page_get_gen( ...@@ -2119,7 +2127,7 @@ buf_page_get_gen(
if (UNIV_UNLIKELY(!success)) { if (UNIV_UNLIKELY(!success)) {
//buf_pool_mutex_exit(); //buf_pool_mutex_exit();
mutex_exit(&block->mutex); mutex_exit(block_mutex);
return(NULL); return(NULL);
} }
...@@ -2692,6 +2700,9 @@ buf_page_init_for_read( ...@@ -2692,6 +2700,9 @@ buf_page_init_for_read(
//buf_pool_mutex_enter(); //buf_pool_mutex_enter();
mutex_enter(&LRU_list_mutex); mutex_enter(&LRU_list_mutex);
if(!block) {
mutex_enter(&flush_list_mutex);
}
mutex_enter(&page_hash_mutex); mutex_enter(&page_hash_mutex);
if (buf_page_hash_get(space, offset)) { if (buf_page_hash_get(space, offset)) {
...@@ -2699,14 +2710,18 @@ buf_page_init_for_read( ...@@ -2699,14 +2710,18 @@ buf_page_init_for_read(
err_exit: err_exit:
if (block) { if (block) {
mutex_enter(&block->mutex); 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); mutex_exit(&block->mutex);
} }
else {
err_exit2: err_exit2:
//buf_pool_mutex_exit(); //buf_pool_mutex_exit();
mutex_exit(&LRU_list_mutex); mutex_exit(&LRU_list_mutex);
mutex_exit(&flush_list_mutex);
mutex_exit(&page_hash_mutex); mutex_exit(&page_hash_mutex);
}
if (mode == BUF_READ_IBUF_PAGES_ONLY) { if (mode == BUF_READ_IBUF_PAGES_ONLY) {
...@@ -2790,16 +2805,14 @@ buf_page_init_for_read( ...@@ -2790,16 +2805,14 @@ buf_page_init_for_read(
/* If buf_buddy_alloc() allocated storage from the LRU list, /* If buf_buddy_alloc() allocated storage from the LRU list,
it released and reacquired buf_pool_mutex. Thus, we must it released and reacquired buf_pool_mutex. Thus, we must
check the page_hash again, as it may have been modified. */ check the page_hash again, as it may have been modified. */
/* !!! page_hash_mutex is not released yet if (UNIV_UNLIKELY(lru)
So always buf_page_hash_get(space, offset) == 0 !!!*/ && UNIV_LIKELY_NULL(buf_page_hash_get(space, offset))) {
//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);
// /* The block was added by some other thread. */ buf_buddy_free(data, zip_size, TRUE);
// buf_buddy_free(bpage, sizeof *bpage); goto err_exit2;
// buf_buddy_free(data, zip_size); }
// goto err_exit2;
//}
page_zip_des_init(&bpage->zip); page_zip_des_init(&bpage->zip);
page_zip_set_size(&bpage->zip, zip_size); page_zip_set_size(&bpage->zip, zip_size);
...@@ -2818,8 +2831,8 @@ buf_page_init_for_read( ...@@ -2818,8 +2831,8 @@ buf_page_init_for_read(
bpage->in_zip_hash = FALSE; bpage->in_zip_hash = FALSE;
bpage->in_flush_list = FALSE; bpage->in_flush_list = FALSE;
bpage->in_free_list = FALSE; bpage->in_free_list = FALSE;
bpage->in_LRU_list = FALSE;
#endif /* UNIV_DEBUG */ #endif /* UNIV_DEBUG */
bpage->in_LRU_list = FALSE;
ut_d(bpage->in_page_hash = TRUE); ut_d(bpage->in_page_hash = TRUE);
HASH_INSERT(buf_page_t, hash, buf_pool->page_hash, HASH_INSERT(buf_page_t, hash, buf_pool->page_hash,
...@@ -2832,6 +2845,7 @@ buf_page_init_for_read( ...@@ -2832,6 +2845,7 @@ buf_page_init_for_read(
buf_LRU_insert_zip_clean(bpage); buf_LRU_insert_zip_clean(bpage);
mutex_exit(&LRU_list_mutex); mutex_exit(&LRU_list_mutex);
mutex_exit(&flush_list_mutex);
buf_page_set_io_fix(bpage, BUF_IO_READ); buf_page_set_io_fix(bpage, BUF_IO_READ);
...@@ -3465,12 +3479,15 @@ buf_validate(void) ...@@ -3465,12 +3479,15 @@ buf_validate(void)
} }
ut_a(UT_LIST_GET_LEN(buf_pool->LRU) == n_lru); 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) { if (UT_LIST_GET_LEN(buf_pool->free) != n_free) {
fprintf(stderr, "Free list len %lu, free blocks %lu\n", fprintf(stderr, "Free list len %lu, free blocks %lu\n",
(ulong) UT_LIST_GET_LEN(buf_pool->free), (ulong) UT_LIST_GET_LEN(buf_pool->free),
(ulong) n_free); (ulong) n_free);
ut_error; ut_error;
} }
*/
ut_a(UT_LIST_GET_LEN(buf_pool->flush_list) == n_flush); 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); ut_a(buf_pool->n_flush[BUF_FLUSH_SINGLE_PAGE] == n_single_flush);
......
...@@ -154,10 +154,10 @@ buf_flush_ready_for_replace( ...@@ -154,10 +154,10 @@ buf_flush_ready_for_replace(
buf_page_in_file(bpage) and in the LRU list */ buf_page_in_file(bpage) and in the LRU list */
{ {
//ut_ad(buf_pool_mutex_own()); //ut_ad(buf_pool_mutex_own());
ut_ad(mutex_own(buf_page_get_mutex(bpage))); //ut_ad(mutex_own(buf_page_get_mutex(bpage)));
ut_ad(bpage->in_LRU_list); //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 return(bpage->oldest_modification == 0
&& buf_page_get_io_fix(bpage) == BUF_IO_NONE && buf_page_get_io_fix(bpage) == BUF_IO_NONE
...@@ -1237,8 +1237,14 @@ buf_flush_LRU_recommendation(void) ...@@ -1237,8 +1237,14 @@ buf_flush_LRU_recommendation(void)
buf_page_t* bpage; buf_page_t* bpage;
ulint n_replaceable; ulint n_replaceable;
ulint distance = 0; 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(); //buf_pool_mutex_enter();
if (have_LRU_mutex)
mutex_enter(&LRU_list_mutex);
n_replaceable = UT_LIST_GET_LEN(buf_pool->free); n_replaceable = UT_LIST_GET_LEN(buf_pool->free);
...@@ -1249,6 +1255,12 @@ buf_flush_LRU_recommendation(void) ...@@ -1249,6 +1255,12 @@ buf_flush_LRU_recommendation(void)
+ BUF_FLUSH_EXTRA_MARGIN) + BUF_FLUSH_EXTRA_MARGIN)
&& (distance < BUF_LRU_FREE_SEARCH_LEN)) { && (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_t* block_mutex = buf_page_get_mutex(bpage);
mutex_enter(block_mutex); mutex_enter(block_mutex);
...@@ -1265,6 +1277,8 @@ buf_flush_LRU_recommendation(void) ...@@ -1265,6 +1277,8 @@ buf_flush_LRU_recommendation(void)
} }
//buf_pool_mutex_exit(); //buf_pool_mutex_exit();
if (have_LRU_mutex)
mutex_exit(&LRU_list_mutex);
if (n_replaceable >= BUF_FLUSH_FREE_BLOCK_MARGIN) { if (n_replaceable >= BUF_FLUSH_FREE_BLOCK_MARGIN) {
......
This diff is collapsed.
...@@ -8842,6 +8842,10 @@ innobase_xa_prepare( ...@@ -8842,6 +8842,10 @@ innobase_xa_prepare(
if (thd_sql_command(thd) != SQLCOM_XA_PREPARE && if (thd_sql_command(thd) != SQLCOM_XA_PREPARE &&
(all || !thd_test_options(thd, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN))) (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 /* For ibbackup to work the order of transactions in binlog
and InnoDB must be the same. Consider the situation and InnoDB must be the same. Consider the situation
...@@ -9646,6 +9650,11 @@ static MYSQL_SYSVAR_ULONG(adaptive_checkpoint, srv_adaptive_checkpoint, ...@@ -9646,6 +9650,11 @@ static MYSQL_SYSVAR_ULONG(adaptive_checkpoint, srv_adaptive_checkpoint,
"Enable/Disable flushing along modified age. 0:disable 1:enable", "Enable/Disable flushing along modified age. 0:disable 1:enable",
NULL, NULL, 0, 0, 1, 0); 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, static MYSQL_SYSVAR_ULONG(read_io_threads, innobase_read_io_threads,
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY, PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
"Number of background read I/O threads in InnoDB.", "Number of background read I/O threads in InnoDB.",
...@@ -9656,6 +9665,11 @@ static MYSQL_SYSVAR_ULONG(write_io_threads, innobase_write_io_threads, ...@@ -9656,6 +9665,11 @@ static MYSQL_SYSVAR_ULONG(write_io_threads, innobase_write_io_threads,
"Number of background write I/O threads in InnoDB.", "Number of background write I/O threads in InnoDB.",
NULL, NULL, 1, 1, 64, 0); 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[]= { static struct st_mysql_sys_var* innobase_system_variables[]= {
MYSQL_SYSVAR(additional_mem_pool_size), MYSQL_SYSVAR(additional_mem_pool_size),
MYSQL_SYSVAR(autoextend_increment), MYSQL_SYSVAR(autoextend_increment),
...@@ -9712,8 +9726,10 @@ static struct st_mysql_sys_var* innobase_system_variables[]= { ...@@ -9712,8 +9726,10 @@ static struct st_mysql_sys_var* innobase_system_variables[]= {
MYSQL_SYSVAR(flush_neighbor_pages), MYSQL_SYSVAR(flush_neighbor_pages),
MYSQL_SYSVAR(read_ahead), MYSQL_SYSVAR(read_ahead),
MYSQL_SYSVAR(adaptive_checkpoint), MYSQL_SYSVAR(adaptive_checkpoint),
MYSQL_SYSVAR(enable_unsafe_group_commit),
MYSQL_SYSVAR(read_io_threads), MYSQL_SYSVAR(read_io_threads),
MYSQL_SYSVAR(write_io_threads), MYSQL_SYSVAR(write_io_threads),
MYSQL_SYSVAR(extra_rsegments),
NULL NULL
}; };
...@@ -9894,6 +9910,7 @@ mysql_declare_plugin(innobase) ...@@ -9894,6 +9910,7 @@ mysql_declare_plugin(innobase)
innobase_system_variables, /* system variables */ innobase_system_variables, /* system variables */
NULL /* reserved */ NULL /* reserved */
}, },
i_s_innodb_rseg,
i_s_innodb_buffer_pool_pages, i_s_innodb_buffer_pool_pages,
i_s_innodb_buffer_pool_pages_index, i_s_innodb_buffer_pool_pages_index,
i_s_innodb_buffer_pool_pages_blob, i_s_innodb_buffer_pool_pages_blob,
......
This diff is collapsed.
...@@ -20,5 +20,6 @@ extern struct st_mysql_plugin i_s_innodb_cmp_reset; ...@@ -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;
extern struct st_mysql_plugin i_s_innodb_cmpmem_reset; 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_patches;
extern struct st_mysql_plugin i_s_innodb_rseg;
#endif /* i_s_h */ #endif /* i_s_h */
...@@ -31,5 +31,6 @@ struct innodb_enhancement { ...@@ -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_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_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_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} {NULL, NULL, NULL, NULL}
}; };
...@@ -107,9 +107,21 @@ buf_buddy_free( ...@@ -107,9 +107,21 @@ buf_buddy_free(
{ {
//ut_ad(buf_pool_mutex_own()); //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); 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); 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 #ifdef UNIV_MATERIALIZE
......
...@@ -1098,11 +1098,11 @@ struct buf_block_struct{ ...@@ -1098,11 +1098,11 @@ struct buf_block_struct{
a block is in the unzip_LRU list a block is in the unzip_LRU list
if page.state == BUF_BLOCK_FILE_PAGE if page.state == BUF_BLOCK_FILE_PAGE
and page.zip.data != NULL */ and page.zip.data != NULL */
#ifdef UNIV_DEBUG //#ifdef UNIV_DEBUG
ibool in_unzip_LRU_list;/* TRUE if the page is in the ibool in_unzip_LRU_list;/* TRUE if the page is in the
decompressed LRU list; decompressed LRU list;
used in debugging */ used in debugging */
#endif /* UNIV_DEBUG */ //#endif /* UNIV_DEBUG */
byte* frame; /* pointer to buffer frame which byte* frame; /* pointer to buffer frame which
is of size UNIV_PAGE_SIZE, and is of size UNIV_PAGE_SIZE, and
aligned to an address divisible by aligned to an address divisible by
......
...@@ -222,7 +222,7 @@ buf_page_in_file( ...@@ -222,7 +222,7 @@ buf_page_in_file(
case BUF_BLOCK_ZIP_FREE: case BUF_BLOCK_ZIP_FREE:
/* This is a free page in buf_pool->zip_free[]. /* This is a free page in buf_pool->zip_free[].
Such pages should only be accessed by the buddy allocator. */ Such pages should only be accessed by the buddy allocator. */
ut_error; /* ut_error; */ /* optimistic */
break; break;
case BUF_BLOCK_ZIP_PAGE: case BUF_BLOCK_ZIP_PAGE:
case BUF_BLOCK_ZIP_DIRTY: case BUF_BLOCK_ZIP_DIRTY:
...@@ -280,7 +280,7 @@ buf_page_get_mutex( ...@@ -280,7 +280,7 @@ buf_page_get_mutex(
{ {
switch (buf_page_get_state(bpage)) { switch (buf_page_get_state(bpage)) {
case BUF_BLOCK_ZIP_FREE: case BUF_BLOCK_ZIP_FREE:
ut_error; /* ut_error; */ /* optimistic */
return(NULL); return(NULL);
case BUF_BLOCK_ZIP_PAGE: case BUF_BLOCK_ZIP_PAGE:
case BUF_BLOCK_ZIP_DIRTY: case BUF_BLOCK_ZIP_DIRTY:
...@@ -414,11 +414,12 @@ buf_page_can_relocate( ...@@ -414,11 +414,12 @@ buf_page_can_relocate(
const buf_page_t* bpage) /* control block being relocated */ const buf_page_t* bpage) /* control block being relocated */
{ {
//ut_ad(buf_pool_mutex_own()); //ut_ad(buf_pool_mutex_own());
ut_ad(mutex_own(buf_page_get_mutex(bpage))); /* optimistic */
ut_ad(buf_page_in_file(bpage)); //ut_ad(mutex_own(buf_page_get_mutex(bpage)));
ut_ad(bpage->in_LRU_list); //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); && bpage->buf_fix_count == 0);
} }
...@@ -1045,12 +1046,15 @@ buf_page_release( ...@@ -1045,12 +1046,15 @@ buf_page_release(
if (rw_latch == RW_X_LATCH && mtr->modifications) { if (rw_latch == RW_X_LATCH && mtr->modifications) {
//buf_pool_mutex_enter(); //buf_pool_mutex_enter();
mutex_enter(&flush_list_mutex); 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_flush_note_modification(block, mtr);
//buf_pool_mutex_exit(); //buf_pool_mutex_exit();
mutex_exit(&flush_list_mutex); mutex_exit(&flush_list_mutex);
} }
else {
mutex_enter(&block->mutex); mutex_enter(&block->mutex);
}
#ifdef UNIV_SYNC_DEBUG #ifdef UNIV_SYNC_DEBUG
rw_lock_s_unlock(&(block->debug_latch)); rw_lock_s_unlock(&(block->debug_latch));
......
...@@ -100,10 +100,11 @@ buf_LRU_free_block( ...@@ -100,10 +100,11 @@ buf_LRU_free_block(
buf_page_t* bpage, /* in: block to be freed */ buf_page_t* bpage, /* in: block to be freed */
ibool zip, /* in: TRUE if should remove also the ibool zip, /* in: TRUE if should remove also the
compressed page of an uncompressed page */ compressed page of an uncompressed page */
ibool* buf_pool_mutex_released); ibool* buf_pool_mutex_released,
/* in: pointer to a variable that will /* in: pointer to a variable that will
be assigned TRUE if buf_pool_mutex be assigned TRUE if buf_pool_mutex
was temporarily released, or NULL */ was temporarily released, or NULL */
ibool have_LRU_mutex);
/********************************************************************** /**********************************************************************
Try to free a replaceable block. */ Try to free a replaceable block. */
UNIV_INTERN UNIV_INTERN
......
...@@ -157,9 +157,12 @@ extern long long srv_ibuf_max_size; ...@@ -157,9 +157,12 @@ extern long long srv_ibuf_max_size;
extern ulint srv_ibuf_active_contract; extern ulint srv_ibuf_active_contract;
extern ulint srv_ibuf_accel_rate; extern ulint srv_ibuf_accel_rate;
extern ulint srv_flush_neighbor_pages; extern ulint srv_flush_neighbor_pages;
extern ulint srv_enable_unsafe_group_commit;
extern ulint srv_read_ahead; extern ulint srv_read_ahead;
extern ulint srv_adaptive_checkpoint; extern ulint srv_adaptive_checkpoint;
extern ulint srv_extra_rsegments;
/*-------------------------------------------*/ /*-------------------------------------------*/
extern ulint srv_n_rows_inserted; extern ulint srv_n_rows_inserted;
......
...@@ -106,6 +106,13 @@ UNIV_INTERN ...@@ -106,6 +106,13 @@ UNIV_INTERN
void void
trx_sys_create(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. */ Looks for a free slot for a rollback segment in the trx system file copy. */
UNIV_INTERN UNIV_INTERN
......
...@@ -12,7 +12,7 @@ Created 1/20/1994 Heikki Tuuri ...@@ -12,7 +12,7 @@ Created 1/20/1994 Heikki Tuuri
#define INNODB_VERSION_MAJOR 1 #define INNODB_VERSION_MAJOR 1
#define INNODB_VERSION_MINOR 0 #define INNODB_VERSION_MINOR 0
#define INNODB_VERSION_BUGFIX 2 #define INNODB_VERSION_BUGFIX 2
#define PERCONA_INNODB_VERSION 1 #define PERCONA_INNODB_VERSION 3
/* The following is the InnoDB version as shown in /* The following is the InnoDB version as shown in
SELECT plugin_version FROM information_schema.plugins; SELECT plugin_version FROM information_schema.plugins;
......
diff mysql-test/r/information_schema.result.orig mysql-test/r/information_schema.result 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.orig 2008-08-04 09:27:49.000000000 +0300
+++ mysql-test/r/information_schema.result 2008-10-07 11:21:51.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 TRIGGERS
USER_PRIVILEGES USER_PRIVILEGES
VIEWS VIEWS
+INNODB_CMP
+INNODB_BUFFER_POOL_PAGES
+INNODB_CMPMEM
+INNODB_BUFFER_POOL_PAGES_INDEX +INNODB_BUFFER_POOL_PAGES_INDEX
+INNODB_RSEG
+INNODB_LOCKS
+INNODB_BUFFER_POOL_PAGES
+XTRADB_ENHANCEMENTS +XTRADB_ENHANCEMENTS
+INNODB_TRX +INNODB_TRX
+INNODB_BUFFER_POOL_PAGES_BLOB +INNODB_BUFFER_POOL_PAGES_BLOB
+INNODB_LOCK_WAITS +INNODB_LOCK_WAITS
+INNODB_CMP_RESET +INNODB_CMP_RESET
+INNODB_LOCKS +INNODB_CMP
+INNODB_CMPMEM_RESET +INNODB_CMPMEM_RESET
+INNODB_CMPMEM
columns_priv columns_priv
db db
event event
@@ -795,6 +806,8 @@ @@ -795,6 +807,8 @@
TABLES UPDATE_TIME datetime TABLES UPDATE_TIME datetime
TABLES CHECK_TIME datetime TABLES CHECK_TIME datetime
TRIGGERS CREATED datetime TRIGGERS CREATED datetime
...@@ -28,7 +29,7 @@ diff mysql-test/r/information_schema.result.orig mysql-test/r/information_schema ...@@ -28,7 +29,7 @@ diff mysql-test/r/information_schema.result.orig mysql-test/r/information_schema
event execute_at datetime event execute_at datetime
event last_executed datetime event last_executed datetime
event starts datetime event starts datetime
@@ -843,12 +856,13 @@ @@ -843,12 +857,13 @@
TABLE_CONSTRAINTS TABLE_NAME select TABLE_CONSTRAINTS TABLE_NAME select
TABLE_PRIVILEGES TABLE_NAME select TABLE_PRIVILEGES TABLE_NAME select
VIEWS TABLE_NAME select VIEWS TABLE_NAME select
...@@ -39,43 +40,45 @@ diff mysql-test/r/information_schema.result.orig mysql-test/r/information_schema ...@@ -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; 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(*) table_schema count(*)
-information_schema 28 -information_schema 28
+information_schema 39 +information_schema 40
mysql 22 mysql 22
create table t1 (i int, j int); create table t1 (i int, j int);
create trigger trg1 before insert on t1 for each row create trigger trg1 before insert on t1 for each row
@@ -1263,6 +1277,17 @@ @@ -1263,6 +1278,18 @@
TRIGGERS TRIGGER_SCHEMA TRIGGERS TRIGGER_SCHEMA
USER_PRIVILEGES GRANTEE USER_PRIVILEGES GRANTEE
VIEWS TABLE_SCHEMA 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_BUFFER_POOL_PAGES_INDEX schema_name
+INNODB_RSEG rseg_id
+INNODB_LOCKS lock_id
+INNODB_BUFFER_POOL_PAGES page_type
+XTRADB_ENHANCEMENTS name +XTRADB_ENHANCEMENTS name
+INNODB_TRX trx_id +INNODB_TRX trx_id
+INNODB_BUFFER_POOL_PAGES_BLOB space_id +INNODB_BUFFER_POOL_PAGES_BLOB space_id
+INNODB_LOCK_WAITS requesting_trx_id +INNODB_LOCK_WAITS requesting_trx_id
+INNODB_CMP_RESET page_size +INNODB_CMP_RESET page_size
+INNODB_LOCKS lock_id +INNODB_CMP page_size
+INNODB_CMPMEM_RESET page_size +INNODB_CMPMEM_RESET page_size
+INNODB_CMPMEM page_size
SELECT t.table_name, c1.column_name SELECT t.table_name, c1.column_name
FROM information_schema.tables t FROM information_schema.tables t
INNER JOIN INNER JOIN
@@ -1306,14 +1331,25 @@ @@ -1306,14 +1333,26 @@
TRIGGERS TRIGGER_SCHEMA TRIGGERS TRIGGER_SCHEMA
USER_PRIVILEGES GRANTEE USER_PRIVILEGES GRANTEE
VIEWS TABLE_SCHEMA 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_BUFFER_POOL_PAGES_INDEX schema_name
+INNODB_RSEG rseg_id
+INNODB_LOCKS lock_id
+INNODB_BUFFER_POOL_PAGES page_type
+XTRADB_ENHANCEMENTS name +XTRADB_ENHANCEMENTS name
+INNODB_TRX trx_id +INNODB_TRX trx_id
+INNODB_BUFFER_POOL_PAGES_BLOB space_id +INNODB_BUFFER_POOL_PAGES_BLOB space_id
+INNODB_LOCK_WAITS requesting_trx_id +INNODB_LOCK_WAITS requesting_trx_id
+INNODB_CMP_RESET page_size +INNODB_CMP_RESET page_size
+INNODB_LOCKS lock_id +INNODB_CMP page_size
+INNODB_CMPMEM_RESET page_size +INNODB_CMPMEM_RESET page_size
+INNODB_CMPMEM page_size
SELECT MAX(table_name) FROM information_schema.tables; SELECT MAX(table_name) FROM information_schema.tables;
MAX(table_name) MAX(table_name)
-VIEWS -VIEWS
...@@ -89,7 +92,7 @@ diff mysql-test/r/information_schema.result.orig mysql-test/r/information_schema ...@@ -89,7 +92,7 @@ diff mysql-test/r/information_schema.result.orig mysql-test/r/information_schema
DROP TABLE IF EXISTS bug23037; DROP TABLE IF EXISTS bug23037;
DROP FUNCTION IF EXISTS get_value; DROP FUNCTION IF EXISTS get_value;
SELECT COLUMN_NAME, MD5(COLUMN_DEFAULT), LENGTH(COLUMN_DEFAULT) FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='bug23037'; 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 FILES information_schema.FILES 1
GLOBAL_STATUS information_schema.GLOBAL_STATUS 1 GLOBAL_STATUS information_schema.GLOBAL_STATUS 1
GLOBAL_VARIABLES information_schema.GLOBAL_VARIABLES 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 ...@@ -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_CMP_RESET information_schema.INNODB_CMP_RESET 1
+INNODB_LOCKS information_schema.INNODB_LOCKS 1 +INNODB_LOCKS information_schema.INNODB_LOCKS 1
+INNODB_LOCK_WAITS information_schema.INNODB_LOCK_WAITS 1 +INNODB_LOCK_WAITS information_schema.INNODB_LOCK_WAITS 1
+INNODB_RSEG information_schema.INNODB_RSEG 1
+INNODB_TRX information_schema.INNODB_TRX 1 +INNODB_TRX information_schema.INNODB_TRX 1
KEY_COLUMN_USAGE information_schema.KEY_COLUMN_USAGE 1 KEY_COLUMN_USAGE information_schema.KEY_COLUMN_USAGE 1
PARTITIONS information_schema.PARTITIONS 1 PARTITIONS information_schema.PARTITIONS 1
PLUGINS information_schema.PLUGINS 1 PLUGINS information_schema.PLUGINS 1
@@ -1400,6 +1446,7 @@ @@ -1400,6 +1450,7 @@
TRIGGERS information_schema.TRIGGERS 1 TRIGGERS information_schema.TRIGGERS 1
USER_PRIVILEGES information_schema.USER_PRIVILEGES 1 USER_PRIVILEGES information_schema.USER_PRIVILEGES 1
VIEWS information_schema.VIEWS 1 VIEWS information_schema.VIEWS 1
...@@ -117,60 +121,63 @@ diff mysql-test/r/information_schema.result.orig mysql-test/r/information_schema ...@@ -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 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.orig 2008-08-04 09:27:49.000000000 +0300
+++ mysql-test/r/information_schema_db.result 2008-10-07 12:26:31.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 TRIGGERS
USER_PRIVILEGES USER_PRIVILEGES
VIEWS VIEWS
+INNODB_CMP
+INNODB_BUFFER_POOL_PAGES
+INNODB_CMPMEM
+INNODB_BUFFER_POOL_PAGES_INDEX +INNODB_BUFFER_POOL_PAGES_INDEX
+INNODB_RSEG
+INNODB_LOCKS
+INNODB_BUFFER_POOL_PAGES
+XTRADB_ENHANCEMENTS +XTRADB_ENHANCEMENTS
+INNODB_TRX +INNODB_TRX
+INNODB_BUFFER_POOL_PAGES_BLOB +INNODB_BUFFER_POOL_PAGES_BLOB
+INNODB_LOCK_WAITS +INNODB_LOCK_WAITS
+INNODB_CMP_RESET +INNODB_CMP_RESET
+INNODB_LOCKS +INNODB_CMP
+INNODB_CMPMEM_RESET +INNODB_CMPMEM_RESET
+INNODB_CMPMEM
show tables from INFORMATION_SCHEMA like 'T%'; show tables from INFORMATION_SCHEMA like 'T%';
Tables_in_information_schema (T%) Tables_in_information_schema (T%)
TABLES TABLES
diff mysql-test/r/mysqlshow.result.orig mysql-test/r/mysqlshow.result 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.orig 2008-08-04 09:27:51.000000000 +0300
+++ mysql-test/r/mysqlshow.result 2008-10-07 12:35:39.000000000 +0300 +++ mysql-test/r/mysqlshow.result 2008-10-07 12:35:39.000000000 +0300
@@ -107,6 +107,17 @@ @@ -107,6 +107,18 @@
| TRIGGERS | | TRIGGERS |
| USER_PRIVILEGES | | USER_PRIVILEGES |
| VIEWS | | VIEWS |
+| INNODB_CMP |
+| INNODB_BUFFER_POOL_PAGES |
+| INNODB_CMPMEM |
+| INNODB_BUFFER_POOL_PAGES_INDEX | +| INNODB_BUFFER_POOL_PAGES_INDEX |
+| INNODB_RSEG |
+| INNODB_LOCKS |
+| INNODB_BUFFER_POOL_PAGES |
+| XTRADB_ENHANCEMENTS | +| XTRADB_ENHANCEMENTS |
+| INNODB_TRX | +| INNODB_TRX |
+| INNODB_BUFFER_POOL_PAGES_BLOB | +| INNODB_BUFFER_POOL_PAGES_BLOB |
+| INNODB_LOCK_WAITS | +| INNODB_LOCK_WAITS |
+| INNODB_CMP_RESET | +| INNODB_CMP_RESET |
+| INNODB_LOCKS | +| INNODB_CMP |
+| INNODB_CMPMEM_RESET | +| INNODB_CMPMEM_RESET |
+| INNODB_CMPMEM |
+---------------------------------------+ +---------------------------------------+
Database: INFORMATION_SCHEMA Database: INFORMATION_SCHEMA
+---------------------------------------+ +---------------------------------------+
@@ -140,6 +151,17 @@ @@ -140,6 +152,18 @@
| TRIGGERS | | TRIGGERS |
| USER_PRIVILEGES | | USER_PRIVILEGES |
| VIEWS | | VIEWS |
+| INNODB_CMP |
+| INNODB_BUFFER_POOL_PAGES |
+| INNODB_CMPMEM |
+| INNODB_BUFFER_POOL_PAGES_INDEX | +| INNODB_BUFFER_POOL_PAGES_INDEX |
+| INNODB_RSEG |
+| INNODB_LOCKS |
+| INNODB_BUFFER_POOL_PAGES |
+| XTRADB_ENHANCEMENTS | +| XTRADB_ENHANCEMENTS |
+| INNODB_TRX | +| INNODB_TRX |
+| INNODB_BUFFER_POOL_PAGES_BLOB | +| INNODB_BUFFER_POOL_PAGES_BLOB |
+| INNODB_LOCK_WAITS | +| INNODB_LOCK_WAITS |
+| INNODB_CMP_RESET | +| INNODB_CMP_RESET |
+| INNODB_LOCKS | +| INNODB_CMP |
+| INNODB_CMPMEM_RESET | +| INNODB_CMPMEM_RESET |
+| INNODB_CMPMEM |
+---------------------------------------+ +---------------------------------------+
Wildcard: inf_rmation_schema Wildcard: inf_rmation_schema
+--------------------+ +--------------------+
...@@ -11,3 +11,4 @@ INSTALL PLUGIN XTRADB_ENHANCEMENTS SONAME 'ha_innodb.so'; ...@@ -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 SONAME 'ha_innodb.so';
INSTALL PLUGIN INNODB_BUFFER_POOL_PAGES_BLOB 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_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; ...@@ -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_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_read_ahead = 3; /* 1: random 2: linear 3: Both */
UNIV_INTERN ulint srv_adaptive_checkpoint = 0; /* 0:disable 1:enable */ 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_spin_wait_rounds = 20;
UNIV_INTERN ulong srv_n_free_tickets_to_enter = 500; UNIV_INTERN ulong srv_n_free_tickets_to_enter = 500;
......
...@@ -1438,6 +1438,8 @@ innobase_start_or_create_for_mysql(void) ...@@ -1438,6 +1438,8 @@ innobase_start_or_create_for_mysql(void)
dict_create(); dict_create();
srv_startup_is_before_trx_rollback_phase = FALSE; srv_startup_is_before_trx_rollback_phase = FALSE;
if (srv_extra_rsegments)
trx_sys_create_extra_rseg(srv_extra_rsegments);
#ifdef UNIV_LOG_ARCHIVE #ifdef UNIV_LOG_ARCHIVE
} else if (srv_archive_recovery) { } else if (srv_archive_recovery) {
fprintf(stderr, fprintf(stderr,
......
...@@ -226,6 +226,7 @@ rw_lock_validate( ...@@ -226,6 +226,7 @@ rw_lock_validate(
/*=============*/ /*=============*/
rw_lock_t* lock) rw_lock_t* lock)
{ {
ulint tmp;
ut_a(lock); ut_a(lock);
#ifndef HAVE_GCC_ATOMIC_BUILTINS #ifndef HAVE_GCC_ATOMIC_BUILTINS
...@@ -233,18 +234,25 @@ rw_lock_validate( ...@@ -233,18 +234,25 @@ rw_lock_validate(
#endif #endif
ut_a(lock->magic_n == RW_LOCK_MAGIC_N); 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) ut_a((rw_lock_get_reader_count(lock) == 0)
|| (rw_lock_get_writer(lock) != RW_LOCK_EX)); || (rw_lock_get_writer(lock) != RW_LOCK_EX));
ut_a((rw_lock_get_writer(lock) == RW_LOCK_EX) #endif
|| (rw_lock_get_writer(lock) == RW_LOCK_WAIT_EX) tmp = rw_lock_get_writer(lock);
|| (rw_lock_get_writer(lock) == RW_LOCK_NOT_LOCKED)); ut_a((tmp == RW_LOCK_EX)
ut_a((rw_lock_get_s_waiters(lock) == 0) || (tmp == RW_LOCK_WAIT_EX)
|| (rw_lock_get_s_waiters(lock) == 1)); || (tmp == RW_LOCK_NOT_LOCKED));
ut_a((rw_lock_get_x_waiters(lock) == 0) tmp = rw_lock_get_s_waiters(lock);
|| (rw_lock_get_x_waiters(lock) == 1)); ut_a((tmp == 0) || (tmp == 1));
ut_a((rw_lock_get_wx_waiters(lock) == 0) tmp = rw_lock_get_x_waiters(lock);
|| (rw_lock_get_wx_waiters(lock) == 1)); 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)); ut_a((lock->writer != RW_LOCK_EX) || (lock->writer_count > 0));
#endif
#ifndef HAVE_GCC_ATOMIC_BUILTINS #ifndef HAVE_GCC_ATOMIC_BUILTINS
mutex_exit(rw_lock_get_mutex(lock)); mutex_exit(rw_lock_get_mutex(lock));
......
...@@ -1049,6 +1049,31 @@ trx_sys_create(void) ...@@ -1049,6 +1049,31 @@ trx_sys_create(void)
trx_sys_init_at_db_start(); 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. */ Update the file format tag. */
static 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