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",
120 bpage = buf_page_init_for_read(err, mode, space, zip_size, unzip,
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);
154 buf_page_io_complete(bpage);
175 ib_int64_t tablespace_version;
179 tablespace_version = fil_space_get_version(space);
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);
199 buf_flush_free_margin(buf_pool);
233 buf_read_ahead_linear(
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)) {
293 tablespace_version = fil_space_get_version(space);
297 if (high > fil_space_get_size(space)) {
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) {
393 pred_offset = fil_page_get_prev(frame);
394 succ_offset = fil_page_get_next(frame);
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)) {
424 if (high > fil_space_get_size(space)) {
432 ibuf_mode = inside_ibuf
444 for (i = low; i < high; i++) {
449 count += buf_read_page_low(
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);
473 buf_flush_free_margin(buf_pool);
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);
497 buf_read_ibuf_merge_pages(
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++) {
528 ulint zip_size = fil_space_get_zip_size(space_ids[i]);
533 > buf_pool->
curr_size / BUF_READ_AHEAD_PEND_LIMIT) {
537 if (UNIV_UNLIKELY(zip_size == ULINT_UNDEFINED)) {
539 goto tablespace_deleted;
542 buf_read_page_low(&err, sync && (i + 1 == n_stored),
544 zip_size, TRUE, space_versions[i],
547 if (UNIV_UNLIKELY(err == DB_TABLESPACE_DELETED)) {
552 ibuf_merge_or_delete_for_page(NULL, space_ids[i],
561 buf_flush_free_margins();
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;
598 zip_size = fil_space_get_zip_size(space);
600 if (UNIV_UNLIKELY(zip_size == ULINT_UNDEFINED)) {
607 tablespace_version = fil_space_get_version(space);
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]);
655 buf_flush_free_margins();
658 if (buf_debug_prints) {
660 "Recovery applies read-ahead pages %lu\n",