zoukankan      html  css  js  c++  java
  • postgresql共享内存的三个结构体

    本文原创为freas_1990,转载请标明出处:http://blog.csdn.net/freas_1990/article/details/16105797

    postgresql的共享内存维护主要依靠以下三个结构体:

    HHDR:

    typedef struct hashhdr {
        long bsize;			/* Bucket/Page Size */
        long bshift;		/* Bucket shift */
        long dsize;			/* Directory Size */
        long ssize;			/* Segment Size */
        long sshift;		/* Segment shift */
        long max_bucket;		/* ID of Maximum bucket in use */
        long high_mask;		/* Mask to modulo into entire table */
        long low_mask;		/* Mask to modulo into lower half of table */
        long ffactor;		/* Fill factor */
        long nkeys;			/* Number of keys in hash table */
        long nsegs;			/* Number of allocated segments */
        long keysize;		/* hash key length in bytes */
        long datasize;		/* elem data length in bytes */
        long max_dsize;		/* 'dsize' limit if directory is fixed size */ 
        BUCKET_INDEX freeBucketIndex;
        /* index of first free bucket */
    #ifdef HASH_STATISTICS
        long accesses;
        long collisions;
    #endif
    } HHDR;

    这个结构体定义了hash结构的目录。

    HTAB:

    typedef struct htab {
        HHDR	*hctl;		/* shared control information */
        long 	(*hash)(); 	/* Hash Function */
        char 	*segbase; 	/* segment base address for 
    				 * calculating pointer values 
    				 */
        SEG_OFFSET	*dir;		/* 'directory' of segm starts */
        long 	*(*alloc)(); 	/* memory allocator 
    				 * (long * for alignment reasons)
    				 */
    
    } HTAB;


    这个结构体定义了hash table(动态、静态属性)。

    HASHCTL:

    typedef struct hashctl {
        long bsize;		/* Bucket Size */
        long ssize;		/* Segment Size */
        long dsize;		/* Dirsize Size */
        long ffactor;	/* Fill factor */
        long (*hash)();	/* Hash Function */
        long keysize;	/* hash key length in bytes */
        long datasize;	/* elem data length in bytes */
        long max_size;	/* limit to dsize if directory size is limited */
        long *segbase;	/* base for calculating bucket + seg ptrs */
        long * (*alloc)();	/* memory allocation function */
        long *dir;		/* directory if allocated already */
        long *hctl;		/* location of header information in shd mem */
    } HASHCTL;

    其中,HHDR是HTAB的一个元素。


     



     

  • 相关阅读:
    微信分享功能开发代码整理
    js 完美兼容浏览器的复制功能
    linux 搭建svn服务器
    zendStudio安装Xdebug项目断点调试
    程序员开发常用英语词汇
    简单的一个远传采集并下载远传图片存储到本地示例
    form表单中经常用到的禁用获取值问题
    记录下url拼接的多条件筛选js
    better-scroll在vue中的使用
    移动端适配,引入lib-flexible,vue开发中将px转化为rem
  • 原文地址:https://www.cnblogs.com/pangblog/p/3424105.html
Copyright © 2011-2022 走看看