zoukankan      html  css  js  c++  java
  • pgpoolII的conn_info 指针的结构

    main.c 中,有如下说明:

    /*                                    
     * shmem connection info table                                    
     * this is a three dimension array. i.e.:                                    
     * con_info[pool_config->num_init_children][pool_config->max_pool][MAX_NUM_BACKENDS]                                    
     */                                    
    ConnectionInfo *con_info;

    从 pool_process_context 的代码中也可以看到这一点:

    /*                                    
     * Return pointer to i th child, j th connection pool and k th backend                                    
     * of connection info on shmem.                                    
     */                                    
    ConnectionInfo *pool_coninfo(int child, int connection_pool, int backend){ 
                                        
        pool_log("Gao001…..child in pool_coninfo is: %d", child);
        if (child < 0 || child >= pool_config->num_init_children){
            pool_error("pool_coninfo: invalid child number: %d", child); 
            return NULL;                            
        }                                
                                        
        if (connection_pool < 0 || connection_pool >= pool_config->max_pool){ 
            pool_error("pool_coninfo: invalid connection_pool number: %d", 
    connection_pool);
    return NULL; } if (backend < 0 || backend >= MAX_NUM_BACKENDS){ pool_error("pool_coninfo: invalid backend number: %d", backend); return NULL; } return &con_info [ child*pool_config->max_pool*MAX_NUM_BACKENDS+ connection_pool*MAX_NUM_BACKENDS+ backend]; }

    我们可以把con_info的pool想象成这个样子:

    child--0                
        connection--pool--0            
                backend--0    
                backend--1    
        connection--pool--1            
                backend--0    
                backend--1    
        connection--pool--2            
                backend--0    
                backend--1    
        connection--pool--3            
                backend--0    
                backend--1    
                    
    child--1                
        connection--pool--0            
                backend--0    
                backend--1    
        connection--pool--1            
                backend--0    
                backend--1    
        connection--pool--2            
                backend--0    
                backend--1    
        connection--pool--3            
                backend--0    
                backend--1    
     ……                
                    
    child--127                
        connection--pool--0            
                backend--0    
                backend--1    
        connection--pool--1            
                backend--0    
                backend--1    
        connection--pool--2            
                backend--0    
                backend--1    
        connection--pool--3            
                backend--0    
                backend--1    

    从这个意义上说,pgpool-II并不是一个真正的connection pool,它只是一个child 对应几个连接(比如4个),各个child之间是不会混用某个 connection 的。

  • 相关阅读:
    Codeforces Round #632 (Div. 2)
    Educational Codeforces Round 83 E. Array Shrinking
    Codeforces Round #626 D. Present
    I
    java学习-get和post请求
    java学习-MD5消息摘要算法
    分销系统数据库设计
    java获得当前日期是今年的第几周,以及这周的开始日期的方法
    分销系统的用户关系,用户与推广链接的数据库设计。设计思路
    git工具,conflict冲突解决方法
  • 原文地址:https://www.cnblogs.com/gaojian/p/2631945.html
Copyright © 2011-2022 走看看