~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/innobase/buf/buf0rea.c

  • Committer: Brian Aker
  • Date: 2010-11-17 21:25:31 UTC
  • mto: (1939.1.1 quick)
  • mto: This revision was merged to the branch mainline in revision 1940.
  • Revision ID: brian@tangent.org-20101117212531-va13j4xh43zuma68
First pass though barriers.

Show diffs side-by-side

added added

removed removed

Lines of Context:
171
171
        ulint   zip_size,/*!< in: compressed page size in bytes, or 0 */
172
172
        ulint   offset) /*!< in: page number */
173
173
{
174
 
        buf_pool_t*     buf_pool = buf_pool_get(space, offset);
175
174
        ib_int64_t      tablespace_version;
176
175
        ulint           count;
177
176
        ulint           err;
196
195
        }
197
196
 
198
197
        /* Flush pages from the end of the LRU list if necessary */
199
 
        buf_flush_free_margin(buf_pool);
 
198
        buf_flush_free_margin();
200
199
 
201
200
        /* Increment number of I/O operations used for LRU policy. */
202
201
        buf_LRU_stat_inc_io();
237
236
        ulint   offset) /*!< in: page number of a page; NOTE: the current thread
238
237
                        must want access to this page (see NOTE 3 above) */
239
238
{
240
 
        buf_pool_t*     buf_pool = buf_pool_get(space, offset);
241
239
        ib_int64_t      tablespace_version;
242
240
        buf_page_t*     bpage;
243
241
        buf_frame_t*    frame;
253
251
        ulint           err;
254
252
        ulint           i;
255
253
        const ulint     buf_read_ahead_linear_area
256
 
                = BUF_READ_AHEAD_LINEAR_AREA(buf_pool);
 
254
                = BUF_READ_AHEAD_LINEAR_AREA;
257
255
        ulint           threshold;
258
256
 
259
257
        if (UNIV_UNLIKELY(srv_startup_is_before_trx_rollback_phase)) {
288
286
 
289
287
        tablespace_version = fil_space_get_version(space);
290
288
 
291
 
        buf_pool_mutex_enter(buf_pool);
 
289
        buf_pool_mutex_enter();
292
290
 
293
291
        if (high > fil_space_get_size(space)) {
294
 
                buf_pool_mutex_exit(buf_pool);
 
292
                buf_pool_mutex_exit();
295
293
                /* The area is not whole, return */
296
294
 
297
295
                return(0);
299
297
 
300
298
        if (buf_pool->n_pend_reads
301
299
            > buf_pool->curr_size / BUF_READ_AHEAD_PEND_LIMIT) {
302
 
                buf_pool_mutex_exit(buf_pool);
 
300
                buf_pool_mutex_exit();
303
301
 
304
302
                return(0);
305
303
        }
317
315
        /* How many out of order accessed pages can we ignore
318
316
        when working out the access pattern for linear readahead */
319
317
        threshold = ut_min((64 - srv_read_ahead_threshold),
320
 
                           BUF_READ_AHEAD_AREA(buf_pool));
 
318
                           BUF_READ_AHEAD_AREA);
321
319
 
322
320
        fail_count = 0;
323
321
 
324
322
        for (i = low; i < high; i++) {
325
 
                bpage = buf_page_hash_get(buf_pool, space, i);
 
323
                bpage = buf_page_hash_get(space, i);
326
324
 
327
 
                if (bpage == NULL || !buf_page_is_accessed(bpage)) {
 
325
                if ((bpage == NULL) || !buf_page_is_accessed(bpage)) {
328
326
                        /* Not accessed */
329
327
                        fail_count++;
330
328
 
348
346
 
349
347
                if (fail_count > threshold) {
350
348
                        /* Too many failures: return */
351
 
                        buf_pool_mutex_exit(buf_pool);
 
349
                        buf_pool_mutex_exit();
352
350
                        return(0);
353
351
                }
354
352
 
360
358
        /* If we got this far, we know that enough pages in the area have
361
359
        been accessed in the right order: linear read-ahead can be sensible */
362
360
 
363
 
        bpage = buf_page_hash_get(buf_pool, space, offset);
 
361
        bpage = buf_page_hash_get(space, offset);
364
362
 
365
363
        if (bpage == NULL) {
366
 
                buf_pool_mutex_exit(buf_pool);
 
364
                buf_pool_mutex_exit();
367
365
 
368
366
                return(0);
369
367
        }
389
387
        pred_offset = fil_page_get_prev(frame);
390
388
        succ_offset = fil_page_get_next(frame);
391
389
 
392
 
        buf_pool_mutex_exit(buf_pool);
 
390
        buf_pool_mutex_exit();
393
391
 
394
392
        if ((offset == low) && (succ_offset == offset + 1)) {
395
393
 
468
466
        os_aio_simulated_wake_handler_threads();
469
467
 
470
468
        /* Flush pages from the end of the LRU list if necessary */
471
 
        buf_flush_free_margin(buf_pool);
 
469
        buf_flush_free_margin();
472
470
 
473
471
#ifdef UNIV_DEBUG
474
472
        if (buf_debug_prints && (count > 0)) {
520
518
#ifdef UNIV_IBUF_DEBUG
521
519
        ut_a(n_stored < UNIV_PAGE_SIZE);
522
520
#endif
 
521
        while (buf_pool->n_pend_reads
 
522
               > buf_pool->curr_size / BUF_READ_AHEAD_PEND_LIMIT) {
 
523
                os_thread_sleep(500000);
 
524
        }
523
525
 
524
526
        for (i = 0; i < n_stored; i++) {
525
 
                ulint           err;
526
 
                buf_pool_t*     buf_pool;
527
 
                ulint           zip_size = fil_space_get_zip_size(space_ids[i]);
528
 
 
529
 
                buf_pool = buf_pool_get(space_ids[i], space_versions[i]);
530
 
 
531
 
                while (buf_pool->n_pend_reads
532
 
                       > buf_pool->curr_size / BUF_READ_AHEAD_PEND_LIMIT) {
533
 
                        os_thread_sleep(500000);
534
 
                }
 
527
                ulint   zip_size = fil_space_get_zip_size(space_ids[i]);
 
528
                ulint   err;
535
529
 
536
530
                if (UNIV_UNLIKELY(zip_size == ULINT_UNDEFINED)) {
537
531
 
556
550
 
557
551
        os_aio_simulated_wake_handler_threads();
558
552
 
559
 
        /* Flush pages from the end of all the LRU lists if necessary */
560
 
        buf_flush_free_margins();
 
553
        /* Flush pages from the end of the LRU list if necessary */
 
554
        buf_flush_free_margin();
561
555
 
562
556
#ifdef UNIV_DEBUG
563
557
        if (buf_debug_prints) {
606
600
        tablespace_version = fil_space_get_version(space);
607
601
 
608
602
        for (i = 0; i < n_stored; i++) {
609
 
                buf_pool_t*     buf_pool;
610
603
 
611
604
                count = 0;
612
605
 
613
606
                os_aio_print_debug = FALSE;
614
 
                buf_pool = buf_pool_get(space, page_nos[i]);
 
607
 
615
608
                while (buf_pool->n_pend_reads >= recv_n_pool_free_frames / 2) {
616
609
 
617
610
                        os_aio_simulated_wake_handler_threads();
650
643
 
651
644
        os_aio_simulated_wake_handler_threads();
652
645
 
653
 
        /* Flush pages from the end of all the LRU lists if necessary */
654
 
        buf_flush_free_margins();
 
646
        /* Flush pages from the end of the LRU list if necessary */
 
647
        buf_flush_free_margin();
655
648
 
656
649
#ifdef UNIV_DEBUG
657
650
        if (buf_debug_prints) {