结构体buf_block_t

/** Buffer block for which an uncompressed page exists */
typedef    struct buf_block_struct        buf_block_t;

/** The buffer control block structure */

struct buf_block_struct{

    /** @name General fields */
    /* @{ */

    buf_page_t    page;        /*!< page information; this must
                    be the first field, so that
                    buf_pool->page_hash can point
                    to buf_page_t or buf_block_t */
    byte*        frame;        /*!< pointer to buffer frame which
                    is of size UNIV_PAGE_SIZE, and
                    aligned to an address divisible by
                    UNIV_PAGE_SIZE */
#ifndef UNIV_HOTBACKUP
    UT_LIST_NODE_T(buf_block_t) unzip_LRU;
                    /*!< node of the decompressed LRU list;
                    a block is in the unzip_LRU list
                    if page.state == BUF_BLOCK_FILE_PAGE
                    and page.zip.data != NULL */
#ifdef UNIV_DEBUG
    ibool        in_unzip_LRU_list;/*!< TRUE if the page is in the
                    decompressed LRU list;
                    used in debugging */
#endif /* UNIV_DEBUG */
    mutex_t        mutex;        /*!< mutex protecting this block:
                    state (also protected by the buffer
                    pool mutex), io_fix, buf_fix_count,
                    and accessed; we introduce this new
                    mutex in InnoDB-5.1 to relieve
                    contention on the buffer pool mutex */
    rw_lock_t    lock;        /*!< read-write lock of the buffer
                    frame */
    unsigned    lock_hash_val:32;/*!< hashed value of the page address
                    in the record lock hash table;
                    protected by buf_block_t::lock
                    (or buf_block_t::mutex, buf_pool->mutex
                        in buf_page_get_gen(),
                    buf_page_init_for_read()
                    and buf_page_create()) */
    ibool        check_index_page_at_flush;
                    /*!< TRUE if we know that this is
                    an index page, and want the database
                    to check its consistency before flush;
                    note that there may be pages in the
                    buffer pool which are index pages,
                    but this flag is not set because
                    we do not keep track of all pages;
                    NOT protected by any mutex */
    /* @} */
    /** @name Optimistic search field */
    /* @{ */

    ib_uint64_t    modify_clock;    /*!< this clock is incremented every
                    time a pointer to a record on the
                    page may become obsolete; this is
                    used in the optimistic cursor
                    positioning: if the modify clock has
                    not changed, we know that the pointer
                    is still valid; this field may be
                    changed if the thread (1) owns the
                    pool mutex and the page is not
                    bufferfixed, or (2) the thread has an
                    x-latch on the block */
    /* @} */
    /** @name Hash search fields (unprotected)
    NOTE that these fields are NOT protected by any semaphore! */
    /* @{ */

    ulint        n_hash_helps;    /*!< counter which controls building
                    of a new hash index for the page */
    ulint        n_fields;    /*!< recommended prefix length for hash
                    search: number of full fields */
    ulint        n_bytes;    /*!< recommended prefix: number of bytes
                    in an incomplete field */
    ibool        left_side;    /*!< TRUE or FALSE, depending on
                    whether the leftmost record of several
                    records with the same prefix should be
                    indexed in the hash index */
    /* @} */

    /** @name Hash search fields
    These 5 fields may only be modified when we have
    an x-latch on btr_search_latch AND
    - we are holding an s-latch or x-latch on buf_block_struct::lock or
    - we know that buf_block_struct::buf_fix_count == 0.

    An exception to this is when we init or create a page
    in the buffer pool in buf0buf.c.

    Another exception is that assigning block->index = NULL
    is allowed whenever holding an x-latch on btr_search_latch. */

    /* @{ */

#if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
    ulint        n_pointers;    /*!< used in debugging: the number of
                    pointers in the adaptive hash index
                    pointing to this frame */
#endif /* UNIV_AHI_DEBUG || UNIV_DEBUG */
    unsigned    curr_n_fields:10;/*!< prefix length for hash indexing:
                    number of full fields */
    unsigned    curr_n_bytes:15;/*!< number of bytes in hash
                    indexing */
    unsigned    curr_left_side:1;/*!< TRUE or FALSE in hash indexing */
    dict_index_t*    index;        /*!< Index for which the
                    adaptive hash index has been
                    created, or NULL if the page
                    does not exist in the
                    index. Note that it does not
                    guarantee that the index is
                    complete, though: there may
                    have been hash collisions,
                    record deletions, etc. */
    /* @} */
# ifdef UNIV_SYNC_DEBUG
    /** @name Debug fields */
    /* @{ */
    rw_lock_t    debug_latch;    /*!< in the debug version, each thread
                    which bufferfixes the block acquires
                    an s-latch here; so we can use the
                    debug utilities in sync0rw */
    /* @} */
# endif
#endif /* !UNIV_HOTBACKUP */
};
时间: 2024-11-05 18:41:54

结构体buf_block_t的相关文章

关于结构体

1.结构体(struct)是由一系列具有相同类型或不同类型的数据构成的数据集合,叫做结构. typedef struct People { int a; char b; double c; }P: 其中:struct是关键词, People是标签, a b c是成员, P是此结构体声明的变量. 于是在声明变量的时候就可:P p1; 这里的P实际上就是struct People的别名.P==struct People 另外这里也可以不写People(于是也不能struct People p1;了,

Linux C中结构体初始化

    在阅读GNU/Linux内核代码时,我们会遇到一种特殊的结构初始化方式.该方式是某些C教材(如谭二版.K&R二版)中没有介绍过的.这种方式称为指定初始化(designated initializer).下面我们看一个例子,Linux-2.6.x/drivers/usb/storage/usb.c中有这样一个结构体初始化项目: static struct usb_driver usb_storage_driver = { .owner = THIS_MODULE, .name = "

在Swift结构体中如何实现写时复制?

结构体(Struct)在Swift语言中占有重要地位,在Swift标准库中,大约有90%的公开类型都是结构体,包括我们常用的Array.String.Dictionary.结构体相比类,一个最重要的特性就是它是值类型,而类似引用类型.值类型是通过复制值来赋值的,而不是引用同一个内存地址,这样就不存在数据共享的问题,能防止意外的数据改变,并且它是线程安全的. 举一个很简单的例子,在objc中,数组是类,是引用类型,在Swift中,数组是结构体,是值类型.因此下面的代码中: let array1 =

结构体的大小

系统在存储结构体变量时存在地址对齐问题,编译器在编译程序时会遵循两条原则: 一.结构体变量中成员的偏移量必须是成员大小的整数倍: 二.结构体大小必须是所有成员大小的整数倍. 1 #include<stdio.h> 2 3 struct a{ 4 int i; 5 float f; 6 char c; 7 double d; 8 long l; 9 }b; 10 11 int main(){ 12 printf("%d\n",sizeof(b.i));// 4 13 prin

关于OC中直接打印结构体,点(CGRect,CGSize,CGPoint,UIOffset)等数据类型

关于OC直接打印结构体,点(CGRect,CGSize,CGPoint,UIOffset)等数据类型,我们完全可以把其转换为OC对象来进项打印调试,而不必对结构体中的成员变量进行打印.就好比我们可以使用NSStringFromCGRect(CGRect rect)来直接打印一个结构体,其他打印可以参考以下内容 UIKIT_EXTERN NSString *NSStringFromCGPoint(CGPoint point); UIKIT_EXTERN NSString *NSStringFrom

38-oc常用结构体

常用结构体 在开发中苹果推荐我们使用CG开头的结构体, 也就是说NS开头的结构体一般不用 OC中定义一个点,用什么结构体 NSPoint; CGPoint point = NSMakePoint(10, 20); OC中保存物体尺寸的,用什么结构体 NSSize; CGSize size = NSMakeSize(100, 50); OC中保存某个物体的位置和尺寸,用什么结构体 NSRect; CGRect rect = NSMakeRect(10, 20, 100, 50); NSNumber

结构体在固件库中的应用

上次介绍了一般结构体的定义以及引用方法,那么接下来将对结构体在官方固件库是如何具体使用的做出简单说明. 结构体指针成员变量引用方法是通过“→”符号来实现,比如要访问student1结构体指针指向的结构体的成员变量name,那么方法是: stuednt1—>name; 如在STM32官方固件库中对端口使用模式结构体定义如下: typedef enum { GPIO_Mode_AIN = 0x0, //模拟输入模式 GPIO_Mode_IN_FLOATING = 0x04, //浮空输入模式 GPI

C# 定义一个学生的结构体,输入学生信息,学号,姓名,身高,按身高排序输出

class Program { //定义一个结构体 struct student//student就是我们自己造的新数据类型 { public int code;//public修饰符 public string name;//结构体的成员 public decimal height; } static void Main(string[] args) { ArrayList arr = new ArrayList(); for (int i = 0; i < 3; i++) { student

类和结构体

//类  class A {     var a = 0 } let classA = A() classA.a = 12     //虽然classA定义为常量,但是仍然可以修改A类中的变量值;结构体则不可以 //类属于引用类型,结构体属于值类型