mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Bug #56680 wrong InnoDB results from a case-insensitive covering index
row_search_for_mysql(): When a secondary index record might not be visible in the current transaction's read view and we consult the clustered index and optionally some undo log records, return the relevant columns of the clustered index record to MySQL instead of the secondary index record. ibuf_insert_to_index_page_low(): New function, refactored from ibuf_insert_to_index_page(). ibuf_insert_to_index_page(): When we are inserting a record in place of a delete-marked record and some fields of the record differ, update that record just like row_ins_sec_index_entry_by_modify() would do. btr_cur_update_alloc_zip(): Make the function public. mysql_row_templ_t: Add clust_rec_field_no. row_sel_store_mysql_rec(), row_sel_push_cache_row_for_mysql(): Add the flag rec_clust, for returning data at clust_rec_field_no instead of rec_field_no. Resurrect the debug assertion that the record not be marked for deletion. (Bug #55626) [UNIV_DEBUG || UNIV_IBUF_DEBUG] ibuf_debug, buf_page_get_gen(), buf_flush_page_try(): Implement innodb_change_buffering_debug=1 for evicting pages from the buffer pool, so that change buffering will be attempted more frequently.
This commit is contained in:
@ -1039,6 +1039,82 @@ buf_flush_write_block_low(
|
||||
}
|
||||
}
|
||||
|
||||
# if defined UNIV_DEBUG || defined UNIV_IBUF_DEBUG
|
||||
/********************************************************************//**
|
||||
Writes a flushable page asynchronously from the buffer pool to a file.
|
||||
NOTE: buf_pool_mutex and block->mutex must be held upon entering this
|
||||
function, and they will be released by this function after flushing.
|
||||
This is loosely based on buf_flush_batch() and buf_flush_page().
|
||||
@return TRUE if the page was flushed and the mutexes released */
|
||||
UNIV_INTERN
|
||||
ibool
|
||||
buf_flush_page_try(
|
||||
/*===============*/
|
||||
buf_block_t* block) /*!< in/out: buffer control block */
|
||||
{
|
||||
ut_ad(buf_pool_mutex_own());
|
||||
ut_ad(buf_block_get_state(block) == BUF_BLOCK_FILE_PAGE);
|
||||
ut_ad(mutex_own(&block->mutex));
|
||||
|
||||
if (!buf_flush_ready_for_flush(&block->page, BUF_FLUSH_LRU)) {
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
if (buf_pool->n_flush[BUF_FLUSH_LRU] > 0
|
||||
|| buf_pool->init_flush[BUF_FLUSH_LRU]) {
|
||||
/* There is already a flush batch of the same type running */
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
buf_pool->init_flush[BUF_FLUSH_LRU] = TRUE;
|
||||
|
||||
buf_page_set_io_fix(&block->page, BUF_IO_WRITE);
|
||||
|
||||
buf_page_set_flush_type(&block->page, BUF_FLUSH_LRU);
|
||||
|
||||
if (buf_pool->n_flush[BUF_FLUSH_LRU]++ == 0) {
|
||||
|
||||
os_event_reset(buf_pool->no_flush[BUF_FLUSH_LRU]);
|
||||
}
|
||||
|
||||
/* VERY IMPORTANT:
|
||||
Because any thread may call the LRU flush, even when owning
|
||||
locks on pages, to avoid deadlocks, we must make sure that the
|
||||
s-lock is acquired on the page without waiting: this is
|
||||
accomplished because buf_flush_ready_for_flush() must hold,
|
||||
and that requires the page not to be bufferfixed. */
|
||||
|
||||
rw_lock_s_lock_gen(&block->lock, BUF_IO_WRITE);
|
||||
|
||||
/* Note that the s-latch is acquired before releasing the
|
||||
buf_pool mutex: this ensures that the latch is acquired
|
||||
immediately. */
|
||||
|
||||
mutex_exit(&block->mutex);
|
||||
buf_pool_mutex_exit();
|
||||
|
||||
/* Even though block is not protected by any mutex at this
|
||||
point, it is safe to access block, because it is io_fixed and
|
||||
oldest_modification != 0. Thus, it cannot be relocated in the
|
||||
buffer pool or removed from flush_list or LRU_list. */
|
||||
|
||||
buf_flush_write_block_low(&block->page);
|
||||
|
||||
buf_pool_mutex_enter();
|
||||
buf_pool->init_flush[BUF_FLUSH_LRU] = FALSE;
|
||||
|
||||
if (buf_pool->n_flush[BUF_FLUSH_LRU] == 0) {
|
||||
/* The running flush batch has ended */
|
||||
os_event_set(buf_pool->no_flush[BUF_FLUSH_LRU]);
|
||||
}
|
||||
|
||||
buf_pool_mutex_exit();
|
||||
buf_flush_buffered_writes();
|
||||
|
||||
return(TRUE);
|
||||
}
|
||||
# endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */
|
||||
|
||||
/********************************************************************//**
|
||||
Writes a flushable page asynchronously from the buffer pool to a file.
|
||||
NOTE: in simulated aio we must call
|
||||
|
Reference in New Issue
Block a user