~drizzle-trunk/drizzle/development

« back to all changes in this revision

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

  • Committer: Stewart Smith
  • Date: 2011-03-29 01:30:47 UTC
  • mto: (2257.1.2 build)
  • mto: This revision was merged to the branch mainline in revision 2258.
  • Revision ID: stewart@flamingspork.com-20110329013047-5ujzfx6pahmwuko2
have CachedDirectory print out a warning if we can't stat() something in a directory. We should always have access to at least stat() things in directories Drizzle is running in (otherwise there is likely a problem)

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
Created 11/5/1995 Heikki Tuuri
24
24
*******************************************************/
25
25
 
 
26
#pragma once
26
27
#ifndef buf0buf_h
27
28
#define buf0buf_h
28
29
 
69
70
#define BUF_POOL_WATCH_SIZE 1           /*!< Maximum number of concurrent
70
71
                                        buffer pool watches */
71
72
 
72
 
extern  buf_pool_t*     buf_pool_ptr[MAX_BUFFER_POOLS]; /*!< The buffer pools
 
73
extern  buf_pool_t*     buf_pool_ptr;   /*!< The buffer pools
73
74
                                        of the database */
74
75
#ifdef UNIV_DEBUG
75
76
extern ibool            buf_debug_prints;/*!< If this is set TRUE, the program
92
93
        BUF_BLOCK_ZIP_FREE = 0,         /*!< contains a free
93
94
                                        compressed page */
94
95
        BUF_BLOCK_POOL_WATCH = 0,       /*!< a sentinel for the buffer pool
95
 
                                        watch, element of buf_pool_watch[] */
 
96
                                        watch, element of buf_pool->watch[] */
96
97
        BUF_BLOCK_ZIP_PAGE,             /*!< contains a clean
97
98
                                        compressed page */
98
99
        BUF_BLOCK_ZIP_DIRTY,            /*!< contains a compressed
1030
1031
        ulint   space,  /*!< in: space id */
1031
1032
        ulint   offset) /*!< in: offset of the page within space */
1032
1033
        __attribute__((const));
 
1034
/********************************************************************//**
 
1035
Calculates the index of a buffer pool to the buf_pool[] array.
 
1036
@return the position of the buffer pool in buf_pool[] */
 
1037
UNIV_INLINE
 
1038
ulint
 
1039
buf_pool_index(
 
1040
/*===========*/
 
1041
        const buf_pool_t*       buf_pool)       /*!< in: buffer pool */
 
1042
        __attribute__((nonnull, const));
1033
1043
/******************************************************************//**
1034
1044
Returns the buffer pool instance given a page instance
1035
1045
@return buf_pool */
1061
1071
UNIV_INLINE
1062
1072
buf_pool_t*
1063
1073
buf_pool_from_array(
1064
 
/*====================*/
1065
 
        ulint   index); /*!< in: array index to get buffer pool instance from */
 
1074
/*================*/
 
1075
        ulint   index);         /*!< in: array index to get
 
1076
                                buffer pool instance from */
1066
1077
/******************************************************************//**
1067
1078
Returns the control block of a file page, NULL if not found.
1068
1079
@return block, NULL if not found */
1200
1211
        unsigned        io_fix:2;       /*!< type of pending I/O operation;
1201
1212
                                        also protected by buf_pool->mutex
1202
1213
                                        @see enum buf_io_fix */
1203
 
        unsigned        buf_fix_count:25;/*!< count of how manyfold this block
 
1214
        unsigned        buf_fix_count:19;/*!< count of how manyfold this block
1204
1215
                                        is currently bufferfixed */
 
1216
        unsigned        buf_pool_index:6;/*!< index number of the buffer pool
 
1217
                                        that this block belongs to */
 
1218
# if MAX_BUFFER_POOLS > 64
 
1219
#  error "MAX_BUFFER_POOLS > 64; redefine buf_pool_index:6"
 
1220
# endif
1205
1221
        /* @} */
1206
1222
#endif /* !UNIV_HOTBACKUP */
1207
1223
        page_zip_des_t  zip;            /*!< compressed page; zip.data
1208
1224
                                        (but not the data it points to) is
1209
 
                                        also protected by buf_pool_mutex;
 
1225
                                        also protected by buf_pool->mutex;
1210
1226
                                        state == BUF_BLOCK_ZIP_PAGE and
1211
1227
                                        zip.data == NULL means an active
1212
 
                                        buf_pool_watch */
 
1228
                                        buf_pool->watch */
1213
1229
#ifndef UNIV_HOTBACKUP
1214
1230
        buf_page_t*     hash;           /*!< node used in chaining to
1215
1231
                                        buf_pool->page_hash or
1220
1236
#endif /* UNIV_DEBUG */
1221
1237
 
1222
1238
        /** @name Page flushing fields
1223
 
        All these are protected by buf_pool_mutex. */
 
1239
        All these are protected by buf_pool->mutex. */
1224
1240
        /* @{ */
1225
1241
 
1226
1242
        UT_LIST_NODE_T(buf_page_t) list;
1227
1243
                                        /*!< based on state, this is a
1228
1244
                                        list node, protected either by
1229
 
                                        buf_pool_mutex or by
1230
 
                                        flush_list_mutex, in one of the
1231
 
                                        following lists in buf_pool:
 
1245
                                        buf_pool->mutex or by
 
1246
                                        buf_pool->flush_list_mutex,
 
1247
                                        in one of the following lists in
 
1248
                                        buf_pool:
1232
1249
 
1233
1250
                                        - BUF_BLOCK_NOT_USED:   free
1234
1251
                                        - BUF_BLOCK_FILE_PAGE:  flush_list
1238
1255
 
1239
1256
                                        If bpage is part of flush_list
1240
1257
                                        then the node pointers are
1241
 
                                        covered by flush_list_mutex.
 
1258
                                        covered by buf_pool->flush_list_mutex.
1242
1259
                                        Otherwise these pointers are
1243
 
                                        protected by buf_pool_mutex.
 
1260
                                        protected by buf_pool->mutex.
1244
1261
 
1245
1262
                                        The contents of the list node
1246
1263
                                        is undefined if !in_flush_list
1252
1269
 
1253
1270
#ifdef UNIV_DEBUG
1254
1271
        ibool           in_flush_list;  /*!< TRUE if in buf_pool->flush_list;
1255
 
                                        when flush_list_mutex is free, the
1256
 
                                        following should hold: in_flush_list
 
1272
                                        when buf_pool->flush_list_mutex is
 
1273
                                        free, the following should hold:
 
1274
                                        in_flush_list
1257
1275
                                        == (state == BUF_BLOCK_FILE_PAGE
1258
1276
                                            || state == BUF_BLOCK_ZIP_DIRTY)
1259
1277
                                        Writes to this field must be
1260
1278
                                        covered by both block->mutex
1261
 
                                        and flush_list_mutex. Hence
 
1279
                                        and buf_pool->flush_list_mutex. Hence
1262
1280
                                        reads can happen while holding
1263
1281
                                        any one of the two mutexes */
1264
1282
        ibool           in_free_list;   /*!< TRUE if in buf_pool->free; when
1265
 
                                        buf_pool_mutex is free, the following
 
1283
                                        buf_pool->mutex is free, the following
1266
1284
                                        should hold: in_free_list
1267
1285
                                        == (state == BUF_BLOCK_NOT_USED) */
1268
1286
#endif /* UNIV_DEBUG */
1282
1300
                                        modifications are on disk.
1283
1301
                                        Writes to this field must be
1284
1302
                                        covered by both block->mutex
1285
 
                                        and flush_list_mutex. Hence
 
1303
                                        and buf_pool->flush_list_mutex. Hence
1286
1304
                                        reads can happen while holding
1287
1305
                                        any one of the two mutexes */
1288
1306
        /* @} */
1318
1336
                                        frees a page in buffer pool */
1319
1337
# endif /* UNIV_DEBUG_FILE_ACCESSES */
1320
1338
#endif /* !UNIV_HOTBACKUP */
1321
 
        buf_pool_t*     buf_pool;       /*!< buffer pool instance this
1322
 
                                        page belongs to */
1323
1339
};
1324
1340
 
1325
1341
/** The buffer control block structure */
1657
1673
        /* @} */
1658
1674
};
1659
1675
 
1660
 
/** mutex protecting the buffer pool struct and control blocks, except the
1661
 
read-write lock in them */
1662
 
extern mutex_t  buf_pool_mutex;
1663
 
/** mutex protecting the control blocks of compressed-only pages
1664
 
(of type buf_page_t, not buf_block_t) */
1665
 
extern mutex_t  buf_pool_zip_mutex;
1666
 
 
1667
 
/** @name Accessors for buf_pool_mutex.
1668
 
Use these instead of accessing buf_pool_mutex directly. */
 
1676
/** @name Accessors for buf_pool->mutex.
 
1677
Use these instead of accessing buf_pool->mutex directly. */
1669
1678
/* @{ */
1670
1679
 
1671
 
/** Test if buf_pool_mutex is owned. */
 
1680
/** Test if a buffer pool mutex is owned. */
1672
1681
#define buf_pool_mutex_own(b) mutex_own(&b->mutex)
1673
 
/** Acquire the buffer pool mutex. */
 
1682
/** Acquire a buffer pool mutex. */
1674
1683
#define buf_pool_mutex_enter(b) do {            \
1675
1684
        ut_ad(!mutex_own(&b->zip_mutex));       \
1676
1685
        mutex_enter(&b->mutex);         \