42 #define BUF_READ_AHEAD_LINEAR_AREA BUF_READ_AHEAD_AREA
47 #define BUF_READ_AHEAD_PEND_LIMIT 2
73 ib_int64_t tablespace_version,
86 mode = mode & ~OS_AIO_SIMULATED_WAKE_LATER;
90 && offset < trx_doublewrite->block1
93 && offset < trx_doublewrite->block2
97 " InnoDB: Warning: trying to read"
98 " doublewrite buffer page %lu\n",
121 tablespace_version, offset);
128 if (buf_debug_prints) {
130 "Posting read request for page %lu, sync %lu\n",
140 sync, space, zip_size, offset, 0, zip_size,
146 sync, space, 0, offset, 0, UNIV_PAGE_SIZE,
149 ut_a(*err == DB_SUCCESS);
175 ib_int64_t tablespace_version;
186 tablespace_version, offset);
188 if (err == DB_TABLESPACE_DELETED) {
191 " InnoDB: Error: trying to access"
192 " tablespace %lu page no. %lu,\n"
193 "InnoDB: but the tablespace does not exist"
194 " or is just being dropped.\n",
195 (ulong) space, (ulong) offset);
241 ib_int64_t tablespace_version;
255 const ulint buf_read_ahead_linear_area
256 = BUF_READ_AHEAD_LINEAR_AREA(buf_pool);
259 if ((srv_read_ahead & 2) ==
false) {
268 low = (offset / buf_read_ahead_linear_area)
269 * buf_read_ahead_linear_area;
270 high = (offset / buf_read_ahead_linear_area + 1)
271 * buf_read_ahead_linear_area;
273 if ((offset != low) && (offset != high - 1)) {
305 > buf_pool->
curr_size / BUF_READ_AHEAD_PEND_LIMIT) {
323 threshold =
ut_min((64 - srv_read_ahead_threshold),
328 for (i = low; i < high; i++) {
335 }
else if (pred_bpage) {
348 if (res != 0 && res != asc_or_desc) {
353 if (fail_count > threshold) {
398 if ((offset == low) && (succ_offset == offset + 1)) {
401 new_offset = pred_offset;
403 }
else if ((offset == high - 1) && (pred_offset == offset - 1)) {
406 new_offset = succ_offset;
413 low = (new_offset / buf_read_ahead_linear_area)
414 * buf_read_ahead_linear_area;
415 high = (new_offset / buf_read_ahead_linear_area + 1)
416 * buf_read_ahead_linear_area;
418 if ((new_offset != low) && (new_offset != high - 1)) {
432 ibuf_mode = inside_ibuf
444 for (i = low; i < high; i++) {
452 space, zip_size, FALSE, tablespace_version, i);
453 if (err == DB_TABLESPACE_DELETED) {
456 " InnoDB: Warning: in"
457 " linear readahead trying to access\n"
458 "InnoDB: tablespace %lu page %lu,\n"
459 "InnoDB: but the tablespace does not"
460 " exist or is just being dropped.\n",
461 (ulong) space, (ulong) i);
476 if (buf_debug_prints && (count > 0)) {
478 "LINEAR read-ahead space %lu offset %lu pages %lu\n",
479 (ulong) space, (ulong) offset, (ulong) count);
504 const ulint* space_ids,
505 const ib_int64_t* space_versions,
512 const ulint* page_nos,
521 #ifdef UNIV_IBUF_DEBUG
522 ut_a(n_stored < UNIV_PAGE_SIZE);
525 for (i = 0; i < n_stored; i++) {
533 > buf_pool->
curr_size / BUF_READ_AHEAD_PEND_LIMIT) {
537 if (UNIV_UNLIKELY(zip_size == ULINT_UNDEFINED)) {
539 goto tablespace_deleted;
544 zip_size, TRUE, space_versions[i],
547 if (UNIV_UNLIKELY(err == DB_TABLESPACE_DELETED)) {
564 if (buf_debug_prints) {
566 "Ibuf merge read-ahead space %lu pages %lu\n",
567 (ulong) space_ids[0], (ulong) n_stored);
586 const ulint* page_nos,
593 ib_int64_t tablespace_version;
600 if (UNIV_UNLIKELY(zip_size == ULINT_UNDEFINED)) {
609 for (i = 0; i < n_stored; i++) {
625 "InnoDB: Error: InnoDB has waited for"
626 " 10 seconds for pending\n"
627 "InnoDB: reads to the buffer pool to"
629 "InnoDB: Number of pending reads %lu,"
630 " pending pread calls %lu\n",
640 if ((i + 1 == n_stored) && sync) {
642 zip_size, TRUE, tablespace_version,
647 space, zip_size, TRUE,
648 tablespace_version, page_nos[i]);
658 if (buf_debug_prints) {
660 "Recovery applies read-ahead pages %lu\n",
trx_doublewrite_t * trx_doublewrite
#define buf_pool_mutex_enter(b)
UNIV_INTERN ulint fil_io(ulint type, ibool sync, ulint space_id, ulint zip_size, ulint block_offset, ulint byte_offset, ulint len, void *buf, void *message)
UNIV_INLINE ibool trx_sys_hdr_page(ulint space, ulint page_no)
UNIV_INTERN void os_aio_simulated_put_read_threads_to_sleep(void)
ulint os_file_n_pending_preads
UNIV_INTERN ulint buf_read_page_low(ulint *err, ibool sync, ulint mode, ulint space, ulint zip_size, ibool unzip, ib_int64_t tablespace_version, ulint offset)
UNIV_INTERN buf_page_t * buf_page_init_for_read(ulint *err, ulint mode, ulint space, ulint zip_size, ibool unzip, ib_int64_t tablespace_version, ulint offset)
#define BUF_READ_AHEAD_AREA(b)
#define BUF_READ_IBUF_PAGES_ONLY
UNIV_INTERN ib_int64_t fil_space_get_version(ulint id)
UNIV_INTERN ulint buf_read_ahead_linear(ulint space, ulint zip_size, ulint offset, ibool inside_ibuf)
UNIV_INLINE ibool buf_page_in_file(const buf_page_t *bpage) __attribute__((pure))
ulint recv_n_pool_free_frames
UNIV_INTERN ulint fil_space_get_zip_size(ulint id)
#define buf_LRU_stat_inc_io()
UNIV_INTERN void buf_flush_free_margin(buf_pool_t *buf_pool)
UNIV_INLINE unsigned buf_page_is_accessed(const buf_page_t *bpage) __attribute__((nonnull
#define BUF_READ_ANY_PAGE
UNIV_INTERN ulint fil_page_get_next(const byte *page)
The buffer pool structure.
UNIV_INLINE ulint ut_min(ulint n1, ulint n2)
UNIV_INTERN void ibuf_merge_or_delete_for_page(buf_block_t *block, ulint space, ulint page_no, ulint zip_size, ibool update_ibuf_bitmap)
UNIV_INTERN ibool buf_read_page(ulint space, ulint zip_size, ulint offset)
UNIV_INTERN ulint fil_page_get_prev(const byte *page)
UNIV_INTERN void buf_page_io_complete(buf_page_t *bpage)
UNIV_INTERN void os_thread_sleep(ulint tm)
UNIV_INTERN void buf_flush_free_margins(void)
UNIV_INLINE enum buf_page_state buf_page_get_state(const buf_page_t *bpage)
UNIV_INTERN ulint fil_space_get_size(ulint id)
UNIV_INLINE buf_page_t * buf_page_hash_get(buf_pool_t *buf_pool, ulint space, ulint offset)
UNIV_INTERN void buf_read_recv_pages(ibool sync, ulint space, ulint zip_size, const ulint *page_nos, ulint n_stored)
UNIV_INTERN void ut_print_timestamp(FILE *file)
UNIV_INTERN void os_aio_simulated_wake_handler_threads(void)
UNIV_INLINE int ut_ulint_cmp(ulint a, ulint b)
UNIV_INLINE buf_pool_t * buf_pool_get(ulint space, ulint offset)
#define OS_AIO_SIMULATED_WAKE_LATER
ibool srv_startup_is_before_trx_rollback_phase
#define TRX_SYS_DOUBLEWRITE_BLOCK_SIZE
#define buf_pool_mutex_exit(b)
UNIV_INLINE ibool ibuf_bitmap_page(ulint zip_size, ulint page_no)
UNIV_INTERN void buf_read_ibuf_merge_pages(ibool sync, const ulint *space_ids, const ib_int64_t *space_versions, const ulint *page_nos, ulint n_stored)