~drizzle-trunk/drizzle/development

« back to all changes in this revision

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

  • Committer: Brian Aker
  • Date: 2010-10-29 01:13:40 UTC
  • mto: (1890.1.1 build)
  • mto: This revision was merged to the branch mainline in revision 1891.
  • Revision ID: brian@tangent.org-20101029011340-y9ixm180v9daypqr
Remove warnings for c++

Show diffs side-by-side

added added

removed removed

Lines of Context:
11
11
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12
12
 
13
13
You should have received a copy of the GNU General Public License along with
14
 
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
15
 
Place, Suite 330, Boston, MA 02111-1307 USA
 
14
this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
 
15
St, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
17
17
*****************************************************************************/
18
18
 
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 from slipping out of
 
347
function can be used to prevent an important page 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));
717
708
 
718
709
/*********************************************************************//**
719
710
Gets the mutex of a block.
814
805
        buf_page_t*     bpage,  /*!< in/out: control block */
815
806
        ibool           old);   /*!< in: old */
816
807
/*********************************************************************//**
817
 
Determine if a block has been accessed in the buffer pool.
818
 
@return TRUE if accessed */
 
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 */
819
810
UNIV_INLINE
820
 
ibool
 
811
unsigned
821
812
buf_page_is_accessed(
822
813
/*=================*/
823
814
        const buf_page_t*       bpage)  /*!< in: control block */
824
 
        __attribute__((pure));
 
815
        __attribute__((nonnull, pure));
825
816
/*********************************************************************//**
826
817
Flag a block accessed. */
827
818
UNIV_INLINE
829
820
buf_page_set_accessed(
830
821
/*==================*/
831
822
        buf_page_t*     bpage,          /*!< in/out: control block */
832
 
        ibool           accessed);      /*!< in: accessed */
 
823
        ulint           time_ms)        /*!< in: ut_time_ms() */
 
824
        __attribute__((nonnull));
833
825
/*********************************************************************//**
834
826
Gets the buf_block_t handle of a buffered file block if an uncompressed
835
827
page frame exists, or NULL.
1015
1007
/*===============*/
1016
1008
        ulint   space,  /*!< in: space id */
1017
1009
        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
 
/*====================*/
1026
1010
/*********************************************************************//**
1027
1011
Gets the current length of the free list of buffer blocks.
1028
1012
@return length of the free list */
1062
1046
                                        flushed to disk, this tells the
1063
1047
                                        flush_type.
1064
1048
                                        @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 */
1071
1049
        unsigned        io_fix:2;       /*!< type of pending I/O operation;
1072
1050
                                        also protected by buf_pool_mutex
1073
1051
                                        @see enum buf_io_fix */
1074
 
        unsigned        buf_fix_count:24;/*!< count of how manyfold this block
 
1052
        unsigned        buf_fix_count:25;/*!< count of how manyfold this block
1075
1053
                                        is currently bufferfixed */
1076
1054
        /* @} */
1077
1055
#endif /* !UNIV_HOTBACKUP */
1101
1079
                                        - BUF_BLOCK_FILE_PAGE:  flush_list
1102
1080
                                        - BUF_BLOCK_ZIP_DIRTY:  flush_list
1103
1081
                                        - BUF_BLOCK_ZIP_PAGE:   zip_clean
1104
 
                                        - BUF_BLOCK_ZIP_FREE:   zip_free[] */
 
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
 
1105
1092
#ifdef UNIV_DEBUG
1106
1093
        ibool           in_flush_list;  /*!< TRUE if in buf_pool->flush_list;
1107
1094
                                        when buf_pool_mutex is free, the
1140
1127
                                        debugging */
1141
1128
#endif /* UNIV_DEBUG */
1142
1129
        unsigned        old:1;          /*!< TRUE if the block is in the old
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
 
1130
                                        blocks in buf_pool->LRU_old */
 
1131
        unsigned        freed_page_clock:31;/*!< the value of
1155
1132
                                        buf_pool->freed_page_clock
1156
1133
                                        when this block was the last
1157
1134
                                        time put to the head of the
1159
1136
                                        to read this for heuristic
1160
1137
                                        purposes without holding any
1161
1138
                                        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 */
1162
1142
        /* @} */
1163
1143
# ifdef UNIV_DEBUG_FILE_ACCESSES
1164
1144
        ibool           file_page_was_freed;
1303
1283
#define BUF_POOL_ZIP_FOLD_BPAGE(b) BUF_POOL_ZIP_FOLD((buf_block_t*) (b))
1304
1284
/* @} */
1305
1285
 
 
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
 
1306
1311
/** @brief The buffer pool structure.
1307
1312
 
1308
1313
NOTE! The definition appears here only for other modules of this
1327
1332
        ulint           n_pend_reads;   /*!< number of pending read operations */
1328
1333
        ulint           n_pend_unzip;   /*!< number of pending decompressions */
1329
1334
 
1330
 
        time_t          last_printout_time; /*!< when buf_print was last time
 
1335
        time_t          last_printout_time;
 
1336
                                        /*!< when buf_print_io was last time
1331
1337
                                        called */
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 */
 
1338
        buf_pool_stat_t stat;           /*!< current statistics */
 
1339
        buf_pool_stat_t old_stat;       /*!< old statistics */
 
1340
 
1350
1341
        /* @} */
 
1342
 
1351
1343
        /** @name Page flushing algorithm fields */
 
1344
 
1352
1345
        /* @{ */
1353
1346
 
1354
1347
        UT_LIST_BASE_NODE_T(buf_page_t) flush_list;
1364
1357
                                        /*!< this is in the set state
1365
1358
                                        when there is no flush batch
1366
1359
                                        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)! */
1371
1360
        ulint           freed_page_clock;/*!< a sequence number used
1372
1361
                                        to count the number of buffer
1373
1362
                                        blocks removed from the end of
1391
1380
                                        block list */
1392
1381
        UT_LIST_BASE_NODE_T(buf_page_t) LRU;
1393
1382
                                        /*!< base node of the LRU list */
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;
 
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;
1397
1388
                                        NOTE: when LRU_old != NULL, its length
1398
1389
                                        should always equal LRU_old_len */
1399
1390
        ulint           LRU_old_len;    /*!< length of the LRU list from
1400
1391
                                        the block to which LRU_old points
1401
1392
                                        onward, including that block;
1402
1393
                                        see buf0lru.c for the restrictions
1403
 
                                        on this value; not defined if
1404
 
                                        LRU_old == NULL;
 
1394
                                        on this value; 0 if LRU_old == NULL;
1405
1395
                                        NOTE: LRU_old_len must be adjusted
1406
1396
                                        whenever LRU_old shrinks or grows! */
1407
1397