~thomir-deactivatedaccount/drizzle/drizzle-fix-bug653747

« back to all changes in this revision

Viewing changes to plugin/innobase/include/buf0buf.h

  • Committer: Brian Aker
  • Date: 2010-10-10 02:07:52 UTC
  • mfrom: (1827.2.3 staging)
  • Revision ID: brian@tangent.org-20101010020752-ktv73isay5dxtvp3
Merge in switch on table_share_instance inheritance.

Show diffs side-by-side

added added

removed removed

Lines of Context:
344
344
        mtr_t*          mtr);           /*!< in: mtr */
345
345
/********************************************************************//**
346
346
Moves a page to the start of the buffer pool LRU list. This high-level
347
 
function can be used to prevent an important page from slipping out of
 
347
function can be used to prevent an important page from from slipping out of
348
348
the buffer pool. */
349
349
UNIV_INTERN
350
350
void
705
705
/*==========================*/
706
706
        const buf_page_t*       bpage)  /*!< in: pointer to control block */
707
707
        __attribute__((pure));
 
708
/*********************************************************************//**
 
709
Determine the approximate LRU list position of a block.
 
710
@return LRU list position */
 
711
UNIV_INLINE
 
712
ulint
 
713
buf_page_get_LRU_position(
 
714
/*======================*/
 
715
        const buf_page_t*       bpage)  /*!< in: control block */
 
716
        __attribute__((pure));
708
717
 
709
718
/*********************************************************************//**
710
719
Gets the mutex of a block.
805
814
        buf_page_t*     bpage,  /*!< in/out: control block */
806
815
        ibool           old);   /*!< in: old */
807
816
/*********************************************************************//**
808
 
Determine the time of first access of a block in the buffer pool.
809
 
@return ut_time_ms() at the time of first access, 0 if not accessed */
 
817
Determine if a block has been accessed in the buffer pool.
 
818
@return TRUE if accessed */
810
819
UNIV_INLINE
811
 
unsigned
 
820
ibool
812
821
buf_page_is_accessed(
813
822
/*=================*/
814
823
        const buf_page_t*       bpage)  /*!< in: control block */
815
 
        __attribute__((nonnull, pure));
 
824
        __attribute__((pure));
816
825
/*********************************************************************//**
817
826
Flag a block accessed. */
818
827
UNIV_INLINE
820
829
buf_page_set_accessed(
821
830
/*==================*/
822
831
        buf_page_t*     bpage,          /*!< in/out: control block */
823
 
        ulint           time_ms)        /*!< in: ut_time_ms() */
824
 
        __attribute__((nonnull));
 
832
        ibool           accessed);      /*!< in: accessed */
825
833
/*********************************************************************//**
826
834
Gets the buf_block_t handle of a buffered file block if an uncompressed
827
835
page frame exists, or NULL.
1007
1015
/*===============*/
1008
1016
        ulint   space,  /*!< in: space id */
1009
1017
        ulint   offset);/*!< in: offset of the page within space */
 
1018
/*******************************************************************//**
 
1019
Increments the pool clock by one and returns its new value. Remember that
 
1020
in the 32 bit version the clock wraps around at 4 billion!
 
1021
@return new clock value */
 
1022
UNIV_INLINE
 
1023
ulint
 
1024
buf_pool_clock_tic(void);
 
1025
/*====================*/
1010
1026
/*********************************************************************//**
1011
1027
Gets the current length of the free list of buffer blocks.
1012
1028
@return length of the free list */
1046
1062
                                        flushed to disk, this tells the
1047
1063
                                        flush_type.
1048
1064
                                        @see enum buf_flush */
 
1065
        unsigned        accessed:1;     /*!< TRUE if the page has been accessed
 
1066
                                        while in the buffer pool: read-ahead
 
1067
                                        may read in pages which have not been
 
1068
                                        accessed yet; a thread is allowed to
 
1069
                                        read this for heuristic purposes
 
1070
                                        without holding any mutex or latch */
1049
1071
        unsigned        io_fix:2;       /*!< type of pending I/O operation;
1050
1072
                                        also protected by buf_pool_mutex
1051
1073
                                        @see enum buf_io_fix */
1052
 
        unsigned        buf_fix_count:25;/*!< count of how manyfold this block
 
1074
        unsigned        buf_fix_count:24;/*!< count of how manyfold this block
1053
1075
                                        is currently bufferfixed */
1054
1076
        /* @} */
1055
1077
#endif /* !UNIV_HOTBACKUP */
1079
1101
                                        - BUF_BLOCK_FILE_PAGE:  flush_list
1080
1102
                                        - BUF_BLOCK_ZIP_DIRTY:  flush_list
1081
1103
                                        - BUF_BLOCK_ZIP_PAGE:   zip_clean
1082
 
                                        - BUF_BLOCK_ZIP_FREE:   zip_free[]
1083
 
 
1084
 
                                        The contents of the list node
1085
 
                                        is undefined if !in_flush_list
1086
 
                                        && state == BUF_BLOCK_FILE_PAGE,
1087
 
                                        or if state is one of
1088
 
                                        BUF_BLOCK_MEMORY,
1089
 
                                        BUF_BLOCK_REMOVE_HASH or
1090
 
                                        BUF_BLOCK_READY_IN_USE. */
1091
 
 
 
1104
                                        - BUF_BLOCK_ZIP_FREE:   zip_free[] */
1092
1105
#ifdef UNIV_DEBUG
1093
1106
        ibool           in_flush_list;  /*!< TRUE if in buf_pool->flush_list;
1094
1107
                                        when buf_pool_mutex is free, the
1127
1140
                                        debugging */
1128
1141
#endif /* UNIV_DEBUG */
1129
1142
        unsigned        old:1;          /*!< TRUE if the block is in the old
1130
 
                                        blocks in buf_pool->LRU_old */
1131
 
        unsigned        freed_page_clock:31;/*!< the value of
 
1143
                                        blocks in the LRU list */
 
1144
        unsigned        LRU_position:31;/*!< value which monotonically
 
1145
                                        decreases (or may stay
 
1146
                                        constant if old==TRUE) toward
 
1147
                                        the end of the LRU list, if
 
1148
                                        buf_pool->ulint_clock has not
 
1149
                                        wrapped around: NOTE that this
 
1150
                                        value can only be used in
 
1151
                                        heuristic algorithms, because
 
1152
                                        of the possibility of a
 
1153
                                        wrap-around! */
 
1154
        unsigned        freed_page_clock:32;/*!< the value of
1132
1155
                                        buf_pool->freed_page_clock
1133
1156
                                        when this block was the last
1134
1157
                                        time put to the head of the
1136
1159
                                        to read this for heuristic
1137
1160
                                        purposes without holding any
1138
1161
                                        mutex or latch */
1139
 
        unsigned        access_time:32; /*!< time of first access, or
1140
 
                                        0 if the block was never accessed
1141
 
                                        in the buffer pool */
1142
1162
        /* @} */
1143
1163
# ifdef UNIV_DEBUG_FILE_ACCESSES
1144
1164
        ibool           file_page_was_freed;
1283
1303
#define BUF_POOL_ZIP_FOLD_BPAGE(b) BUF_POOL_ZIP_FOLD((buf_block_t*) (b))
1284
1304
/* @} */
1285
1305
 
1286
 
/** @brief The buffer pool statistics structure. */
1287
 
struct buf_pool_stat_struct{
1288
 
        ulint   n_page_gets;    /*!< number of page gets performed;
1289
 
                                also successful searches through
1290
 
                                the adaptive hash index are
1291
 
                                counted as page gets; this field
1292
 
                                is NOT protected by the buffer
1293
 
                                pool mutex */
1294
 
        ulint   n_pages_read;   /*!< number read operations */
1295
 
        ulint   n_pages_written;/*!< number write operations */
1296
 
        ulint   n_pages_created;/*!< number of pages created
1297
 
                                in the pool with no read */
1298
 
        ulint   n_ra_pages_read;/*!< number of pages read in
1299
 
                                as part of read ahead */
1300
 
        ulint   n_ra_pages_evicted;/*!< number of read ahead
1301
 
                                pages that are evicted without
1302
 
                                being accessed */
1303
 
        ulint   n_pages_made_young; /*!< number of pages made young, in
1304
 
                                calls to buf_LRU_make_block_young() */
1305
 
        ulint   n_pages_not_made_young; /*!< number of pages not made
1306
 
                                young because the first access
1307
 
                                was not long enough ago, in
1308
 
                                buf_page_peek_if_too_old() */
1309
 
};
1310
 
 
1311
1306
/** @brief The buffer pool structure.
1312
1307
 
1313
1308
NOTE! The definition appears here only for other modules of this
1332
1327
        ulint           n_pend_reads;   /*!< number of pending read operations */
1333
1328
        ulint           n_pend_unzip;   /*!< number of pending decompressions */
1334
1329
 
1335
 
        time_t          last_printout_time;
1336
 
                                        /*!< when buf_print_io was last time
 
1330
        time_t          last_printout_time; /*!< when buf_print was last time
1337
1331
                                        called */
1338
 
        buf_pool_stat_t stat;           /*!< current statistics */
1339
 
        buf_pool_stat_t old_stat;       /*!< old statistics */
1340
 
 
 
1332
        ulint           n_pages_read;   /*!< number read operations */
 
1333
        ulint           n_pages_written;/*!< number write operations */
 
1334
        ulint           n_pages_created;/*!< number of pages created
 
1335
                                        in the pool with no read */
 
1336
        ulint           n_page_gets;    /*!< number of page gets performed;
 
1337
                                        also successful searches through
 
1338
                                        the adaptive hash index are
 
1339
                                        counted as page gets; this field
 
1340
                                        is NOT protected by the buffer
 
1341
                                        pool mutex */
 
1342
        ulint           n_page_gets_old;/*!< n_page_gets when buf_print was
 
1343
                                        last time called: used to calculate
 
1344
                                        hit rate */
 
1345
        ulint           n_pages_read_old;/*!< n_pages_read when buf_print was
 
1346
                                        last time called */
 
1347
        ulint           n_pages_written_old;/*!< number write operations */
 
1348
        ulint           n_pages_created_old;/*!< number of pages created in
 
1349
                                        the pool with no read */
1341
1350
        /* @} */
1342
 
 
1343
1351
        /** @name Page flushing algorithm fields */
1344
 
 
1345
1352
        /* @{ */
1346
1353
 
1347
1354
        UT_LIST_BASE_NODE_T(buf_page_t) flush_list;
1357
1364
                                        /*!< this is in the set state
1358
1365
                                        when there is no flush batch
1359
1366
                                        of the given type running */
 
1367
        ulint           ulint_clock;    /*!< a sequence number used to count
 
1368
                                        time. NOTE! This counter wraps
 
1369
                                        around at 4 billion (if ulint ==
 
1370
                                        32 bits)! */
1360
1371
        ulint           freed_page_clock;/*!< a sequence number used
1361
1372
                                        to count the number of buffer
1362
1373
                                        blocks removed from the end of
1380
1391
                                        block list */
1381
1392
        UT_LIST_BASE_NODE_T(buf_page_t) LRU;
1382
1393
                                        /*!< base node of the LRU list */
1383
 
        buf_page_t*     LRU_old;        /*!< pointer to the about
1384
 
                                        buf_LRU_old_ratio/BUF_LRU_OLD_RATIO_DIV
1385
 
                                        oldest blocks in the LRU list;
1386
 
                                        NULL if LRU length less than
1387
 
                                        BUF_LRU_OLD_MIN_LEN;
 
1394
        buf_page_t*     LRU_old;        /*!< pointer to the about 3/8 oldest
 
1395
                                        blocks in the LRU list; NULL if LRU
 
1396
                                        length less than BUF_LRU_OLD_MIN_LEN;
1388
1397
                                        NOTE: when LRU_old != NULL, its length
1389
1398
                                        should always equal LRU_old_len */
1390
1399
        ulint           LRU_old_len;    /*!< length of the LRU list from
1391
1400
                                        the block to which LRU_old points
1392
1401
                                        onward, including that block;
1393
1402
                                        see buf0lru.c for the restrictions
1394
 
                                        on this value; 0 if LRU_old == NULL;
 
1403
                                        on this value; not defined if
 
1404
                                        LRU_old == NULL;
1395
1405
                                        NOTE: LRU_old_len must be adjusted
1396
1406
                                        whenever LRU_old shrinks or grows! */
1397
1407