~ubuntu-branches/ubuntu/oneiric/pgpool2/oneiric

« back to all changes in this revision

Viewing changes to pool.h

  • Committer: Bazaar Package Importer
  • Author(s): Christoph Berg
  • Date: 2011-06-10 10:18:29 UTC
  • mfrom: (1.1.6 upstream) (4.2.2 sid)
  • Revision ID: james.westby@ubuntu.com-20110610101829-m1aig6u0p74qpif3
Tags: 3.0.4-1
* New upstream release
* Use format 3.0 (quilt).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* -*-pgsql-c-*- */
2
2
/*
3
3
 *
4
 
 * $Header: /cvsroot/pgpool/pgpool-II/pool.h,v 1.56 2010/02/03 08:11:42 t-ishii Exp $
 
4
 * $Header: /cvsroot/pgpool/pgpool-II/pool.h,v 1.84.2.1 2010/11/04 10:04:52 kitagawa Exp $
5
5
 *
6
6
 * pgpool: a language independent connection pool server for PostgreSQL 
7
7
 * written by Tatsuo Ishii
29
29
#include "config.h"
30
30
#include "pool_type.h"
31
31
#include "pool_signal.h"
 
32
#include "parser/nodes.h"
 
33
 
32
34
#include "libpq-fe.h"
33
35
#include <stdio.h>
34
36
#include <time.h>
56
58
#define HBA_CONF_FILE_NAME "pool_hba.conf"
57
59
 
58
60
/* pid file directory */
59
 
#define DEFAULT_LOGDIR "/tmp"
 
61
#define DEFAULT_LOGDIR "/var/log/postgresql"
60
62
 
61
63
/* Unix domain socket directory */
62
 
#define DEFAULT_SOCKET_DIR "/tmp"
 
64
#define DEFAULT_SOCKET_DIR "/var/run/postgresql"
63
65
 
64
66
/* pid file name */
65
67
#define DEFAULT_PID_FILE_NAME "/var/run/pgpool/pgpool.pid"
76
78
        POOL_DEADLOCK
77
79
} POOL_STATUS;
78
80
 
79
 
 
80
 
typedef enum {
81
 
        INIT_CONFIG = 1,   /* 0x01 */
82
 
        RELOAD_CONFIG = 2  /* 0x02 */
83
 
} POOL_CONFIG_CONTEXT;
84
 
 
85
 
 
86
81
/* protocol major version numbers */
87
82
#define PROTO_MAJOR_V2  2
88
83
#define PROTO_MAJOR_V3  3
127
122
        int                     key;    /* cancel key */
128
123
} CancelPacket;
129
124
 
130
 
/*
131
 
 * configuration paramters
132
 
 */
133
 
typedef struct {
134
 
        char *listen_addresses; /* hostnames/IP addresses to listen on */
135
 
    int port;   /* port # to bind */
136
 
        int pcp_port;                           /* PCP port # to bind */
137
 
        char *socket_dir;               /* pgpool socket directory */
138
 
        char *pcp_socket_dir;           /* PCP socket directory */
139
 
        int pcp_timeout;                        /* PCP timeout for an idle client */
140
 
    int num_init_children;      /* # of children initially pre-forked */
141
 
    int child_life_time;        /* if idle for this seconds, child exits */
142
 
    int connection_life_time;   /* if idle for this seconds, connection closes */
143
 
    int child_max_connections;  /* if max_connections received, child exits */
144
 
        int client_idle_limit;          /* If client_idle_limit is n (n > 0), the client is forced to be
145
 
                                                                   disconnected after n seconds idle */
146
 
        int authentication_timeout; /* maximum time in seconds to complete client authentication */
147
 
    int max_pool;       /* max # of connection pool per child */
148
 
    char *logdir;               /* logging directory */
149
 
    char *pid_file_name;                /* pid file name */
150
 
    char *backend_socket_dir;   /* Unix domain socket directory for the PostgreSQL server */
151
 
        int replication_mode;           /* replication mode */
152
 
 
153
 
        int log_connections;            /* 0:false, 1:true - logs incoming connections */
154
 
        int log_hostname;               /* 0:false, 1:true - resolve hostname */
155
 
        int enable_pool_hba;            /* 0:false, 1:true - enables pool_hba.conf file authentication */
156
 
 
157
 
        int load_balance_mode;          /* load balance mode */
158
 
 
159
 
        int replication_stop_on_mismatch;               /* if there's a data mismatch between master and secondary
160
 
                                                                                         * start degenration to stop replication mode
161
 
                                                                                         */
162
 
        int replicate_select; /* if non 0, replicate SELECT statement when load balancing is disabled. */
163
 
        char **reset_query_list;                /* comma separated list of quries to be issued at the end of session */
164
 
 
165
 
        int print_timestamp;            /* if non 0, print time stamp to each log line */
166
 
        int master_slave_mode;          /* if non 0, operate in master/slave mode */
167
 
        int connection_cache;           /* if non 0, cache connection pool */
168
 
        int health_check_timeout;       /* health check timeout */
169
 
        int health_check_period;        /* health check period */
170
 
        char *health_check_user;                /* PostgreSQL user name for health check */
171
 
        char *failover_command;     /* execute command when failover happens */
172
 
        char *failback_command;     /* execute command when failback happens */
173
 
 
174
 
        /*
175
 
         * If true, trigger fail over when writing to the backend
176
 
         * communication socket fails. This is the same behavior of
177
 
         * pgpool-II 2.2.x or earlier. If set to false, pgpool will report
178
 
         * an error and disconnect the session.
179
 
         */
180
 
        int     fail_over_on_backend_error;
181
 
 
182
 
        char *recovery_user;            /* PostgreSQL user name for online recovery */
183
 
        char *recovery_password;                /* PostgreSQL user password for online recovery */
184
 
        char *recovery_1st_stage_command;   /* Online recovery command in 1st stage */
185
 
        char *recovery_2nd_stage_command;   /* Online recovery command in 2nd stage */
186
 
        int recovery_timeout;                           /* maximum time in seconds to wait for remote start-up */
187
 
        int client_idle_limit_in_recovery;              /* If > 0, the client is forced to be
188
 
                                                                                         *  disconnected after n seconds idle
189
 
                                                                                         *  This parameter is only valid while in recovery 2nd statge */
190
 
        int insert_lock;        /* if non 0, automatically lock table with INSERT to keep SERIAL
191
 
                                                   data consistency */
192
 
        int ignore_leading_white_space;         /* ignore leading white spaces of each query */
193
 
        int log_statement; /* 0:false, 1: true - logs all SQL statements */
194
 
        int log_per_node_statement; /* 0:false, 1: true - logs per node detailed SQL statements */
195
 
 
196
 
        int parallel_mode;      /* if non 0, run in parallel query mode */
197
 
 
198
 
        int enable_query_cache;         /* if non 0, use query cache. 0 by default */
199
 
 
200
 
        char *pgpool2_hostname;         /* pgpool2 hostname */
201
 
        char *system_db_hostname;       /* system DB hostname */
202
 
        int system_db_port;                     /* system DB port number */
203
 
        char *system_db_dbname;         /* system DB name */
204
 
        char *system_db_schema;         /* system DB schema name */
205
 
        char *system_db_user;           /* user name to access system DB */
206
 
        char *system_db_password;       /* password to access system DB */
207
 
 
208
 
        char *lobj_lock_table;          /* table name to lock for rewriting lo_creat */
209
 
 
210
 
        BackendDesc *backend_desc;      /* PostgreSQL Server description. Placed on shared memory */
211
 
 
212
 
        LOAD_BALANCE_STATUS     load_balance_status[MAX_NUM_BACKENDS];  /* to remember which DB node is selected for load balancing */
213
 
 
214
 
        /* followings do not exist in the configuration file */
215
 
    int current_slot;   /* current backend slot # */
216
 
        int replication_enabled;                /* replication mode enabled */
217
 
        int master_slave_enabled;               /* master/slave mode enabled */
218
 
        int num_reset_queries;          /* number of queries in reset_query_list */
219
 
 
220
 
        /* ssl configuration */
221
 
        int ssl;        /* if non 0, activate ssl support (frontend+backend) */
222
 
        char *ssl_cert; /* path to ssl certificate (frontend only) */
223
 
        char *ssl_key;  /* path to ssl key (frontend only) */
224
 
        char *ssl_ca_cert;      /* path to root (CA) certificate */
225
 
        char *ssl_ca_cert_dir;  /* path to directory containing CA certificates */
226
 
} POOL_CONFIG;
227
 
 
228
125
#define MAX_PASSWORD_SIZE               1024
229
126
 
230
127
typedef struct {
263
160
        int isbackend;          /* this connection is for backend if non 0 */
264
161
        int db_node_id;         /* DB node id for this connection */
265
162
 
266
 
        char tstate;            /* transaction state (V3 only) */
 
163
        char tstate;            /* Transaction state (V3 only) 'I' if idle
 
164
                                                 * (not in a transaction block); 'T' if in a
 
165
                                                 * transaction block; or 'E' if in a failed
 
166
                                                 * transaction block
 
167
                                                 */
 
168
 
 
169
        /* True if an internal transaction has already started */
 
170
        bool is_internal_transaction_started;
267
171
 
268
172
        /*
269
173
         * following are used to remember when re-use the authenticated connection
343
247
        UNIT unit;
344
248
} Interval;
345
249
 
346
 
/*
347
 
 * Relation cache structure
348
 
 */
349
 
#define MAX_ITEM_LENGTH 1024
350
 
 
351
 
/* Relation lookup cache structure */
352
 
 
353
 
typedef void *(*func_ptr) ();
354
 
 
355
 
typedef struct {
356
 
        char dbname[MAX_ITEM_LENGTH];   /* database name */
357
 
        char relname[MAX_ITEM_LENGTH];  /* table name */
358
 
        void *data;     /* user data */
359
 
        int refcnt;             /* reference count */
360
 
        int session_id;         /* LocalSessionId */
361
 
} PoolRelCache;
362
 
 
363
 
typedef struct {
364
 
        int num;                /* number of cache items */
365
 
        char sql[MAX_ITEM_LENGTH];      /* Query to relation */
366
 
        /*
367
 
         * User defined function to be called at data register.
368
 
         * Argument is POOL_SELECT_RESULT *.
369
 
         * This function must return a pointer to be
370
 
         * saved in cache->data.
371
 
         */
372
 
        func_ptr        register_func;
373
 
        /*
374
 
         * User defined function to be called at data unregister.
375
 
         * Argument cache->data.
376
 
         */
377
 
        func_ptr        unregister_func;
378
 
        bool cache_is_session_local;            /* True if cache life time is session local */
379
 
        PoolRelCache *cache;    /* cache data */
380
 
} POOL_RELCACHE;
381
 
 
382
 
 
383
 
#ifdef NOT_USED
384
 
#define NUM_BACKENDS (in_load_balance? (selected_slot+1) : \
385
 
                                          (((!REPLICATION && !PARALLEL_MODE)||master_slave_dml)? Req_info->master_node_id+1: \
386
 
                                           pool_config->backend_desc->num_backends))
387
 
#endif
388
 
/* NUM_BACKENDS now always returns actual number of backends if not in_load_balance */
389
 
#define NUM_BACKENDS (in_load_balance ? (selected_slot+1) : pool_config->backend_desc->num_backends)
 
250
 
 
251
/* NUM_BACKENDS now always returns actual number of backends */
 
252
#define NUM_BACKENDS (pool_config->backend_desc->num_backends)
390
253
#define BACKEND_INFO(backend_id) (pool_config->backend_desc->backend_info[(backend_id)])
391
254
#define LOAD_BALANCE_STATUS(backend_id) (pool_config->load_balance_status[(backend_id)])
392
 
/* if RAW_MODE, VALID_BACKEND returns the selected node only */
 
255
 
 
256
/*
 
257
 * This macro returns true if:
 
258
 *   current query is in progress and the DB node is healthy OR
 
259
 *   no query is in progress and the DB node is healthy
 
260
 */
 
261
extern bool pool_is_node_to_be_sent_in_current_query(int node_id);
 
262
extern int pool_virtual_master_db_node_id(void);
 
263
 
393
264
#define VALID_BACKEND(backend_id) \
394
 
        (RAW_MODE ? (backend_id) == MASTER_NODE_ID : \
395
 
        (in_load_balance ? LOAD_BALANCE_STATUS(backend_id) == LOAD_SELECTED : \
396
 
    ((BACKEND_INFO(backend_id).backend_status == CON_UP) || \
397
 
         (BACKEND_INFO(backend_id).backend_status == CON_CONNECT_WAIT))))
 
265
        ((RAW_MODE && (backend_id) == REAL_MASTER_NODE_ID) || \
 
266
         (pool_is_node_to_be_sent_in_current_query((backend_id)) && \
 
267
          ((BACKEND_INFO((backend_id)).backend_status == CON_UP) || \
 
268
           (BACKEND_INFO((backend_id)).backend_status == CON_CONNECT_WAIT))))
 
269
 
398
270
#define CONNECTION_SLOT(p, slot) ((p)->slots[(slot)])
399
271
#define CONNECTION(p, slot) (CONNECTION_SLOT(p, slot)->con)
 
272
 
 
273
/*
 
274
 * The first DB ndoe id appears in pgpool.conf or the first "live" DB
 
275
 * node otherwise.
 
276
 */
 
277
#define REAL_MASTER_NODE_ID (Req_info->master_node_id)
 
278
 
 
279
/*
 
280
 * The primary node id in streaming replication mode. If not in the
 
281
 * mode or there's no primary node, this macro returns
 
282
 * REAL_MASTER_NODE_ID.
 
283
 */
 
284
#define PRIMARY_NODE_ID (Req_info->primary_node_id >=0?\
 
285
                                                 Req_info->primary_node_id:REAL_MASTER_NODE_ID)
 
286
 
 
287
/*
 
288
 * Real primary node id. If not in the mode or there's no primary
 
289
 * node, this macro returns -1.
 
290
 */
 
291
#define REAL_PRIMARY_NODE_ID (Req_info->primary_node_id)
 
292
 
 
293
/*
 
294
 * "Virtual" master node id. It's same as REAL_MASTER_NODE_ID if not
 
295
 * in load balance mode. If in load balance, it's the first load
 
296
 * balance node.
 
297
 */
 
298
#define MASTER_NODE_ID (pool_virtual_master_db_node_id())
 
299
#define IS_MASTER_NODE_ID(node_id) (MASTER_NODE_ID == (node_id))
400
300
#define MASTER_CONNECTION(p) ((p)->slots[MASTER_NODE_ID])
401
 
#define MASTER_NODE_ID (in_load_balance? selected_slot : Req_info->master_node_id)
402
 
#define IS_MASTER_NODE_ID(node_id) (MASTER_NODE_ID == (node_id))
403
 
//#define SECONDARY_CONNECTION(p) ((p)->slots[1])
404
 
#define REPLICATION (pool_config->replication_enabled)
405
 
#define MASTER_SLAVE (pool_config->master_slave_enabled)
 
301
#define MASTER(p) MASTER_CONNECTION(p)->con
 
302
 
 
303
#define REPLICATION (pool_config->replication_mode)
 
304
#define MASTER_SLAVE (pool_config->master_slave_mode)
406
305
#define DUAL_MODE (REPLICATION || MASTER_SLAVE)
407
306
#define PARALLEL_MODE (pool_config->parallel_mode)
408
307
#define RAW_MODE (!REPLICATION && !PARALLEL_MODE && !MASTER_SLAVE)
409
 
#define MASTER(p) MASTER_CONNECTION(p)->con
410
 
//#define SECONDARY(p) SECONDARY_CONNECTION(p)->con
411
308
#define MAJOR(p) MASTER_CONNECTION(p)->sp->major
412
 
#define TSTATE(p) MASTER(p)->tstate
 
309
#define TSTATE(p, i) (CONNECTION(p, i)->tstate)
 
310
#define INTERNAL_TRANSACTION_STARTED(p, i) (CONNECTION(p, i)->is_internal_transaction_started)
413
311
#define SYSDB_INFO (system_db_info->info)
414
312
#define SYSDB_CONNECTION (system_db_info->connection)
415
313
#define SYSDB_STATUS (*system_db_info->system_db_status)
428
326
#define CONN_COUNTER_SEM 0
429
327
#define REQUEST_INFO_SEM 1
430
328
 
431
 
#define MY_PROCESS_INFO (pids[my_proc_id])
432
 
 
433
329
/*
434
330
 * number specified when semaphore is locked/unlocked
435
331
 */
454
350
        POOL_REQUEST_KIND       kind;   /* request kind */
455
351
        int node_id[MAX_NUM_BACKENDS];          /* request node id */
456
352
        int master_node_id;     /* the youngest node id which is not in down status */
 
353
        int primary_node_id;    /* the primary node id in streaming replication mode */
457
354
        int conn_counter;
458
355
} POOL_REQUEST_INFO;
459
356
 
483
380
 * global variables
484
381
 */
485
382
extern pid_t mypid; /* parent pid */
486
 
extern POOL_CONFIG *pool_config;        /* configuration values */
 
383
extern bool run_as_pcp_child;
 
384
 
487
385
extern POOL_CONNECTION_POOL *pool_connection_pool;      /* connection pool */
488
386
extern volatile sig_atomic_t backend_timer_expired; /* flag for connection closed timer is expired */
489
387
extern long int weight_master;  /* normalized weight of master (0-RAND_MAX range) */
490
388
extern int my_proc_id;  /* process table id (!= UNIX's PID) */
491
389
extern POOL_SYSTEMDB_CONNECTION_POOL *system_db_info; /* systemdb */
492
 
extern ProcessInfo *pids; /* shmem process information table */
 
390
extern ProcessInfo *process_info; /* shmem process information table */
493
391
extern ConnectionInfo *con_info; /* shmem connection info table */
494
 
extern int in_load_balance;             /* non 0 if in load balance mode */
495
 
extern int selected_slot;               /* selected DB node for load balance */
496
 
extern int master_slave_dml;    /* non 0 if master/slave mode is specified in config file */
497
392
extern POOL_REQUEST_INFO *Req_info;
498
393
extern volatile sig_atomic_t *InRecovery;
499
394
extern char remote_ps_data[];           /* used for set_ps_display */
500
395
extern volatile sig_atomic_t got_sighup;
 
396
extern volatile sig_atomic_t exit_request;
501
397
 
502
398
#define QUERY_STRING_BUFFER_LEN 1024
503
399
extern char query_string_buffer[];              /* last query string sent to simpleQuery() */
504
400
 
505
 
extern int LocalSessionId;      /* Local session id. incremented when new frontend connected */
506
 
 
507
401
/*
508
402
 * public functions
509
403
 */
521
415
extern void pool_debug(const char *fmt,...);
522
416
extern void pool_log(const char *fmt,...);
523
417
#endif
524
 
extern int pool_init_config(void);
525
 
extern int pool_get_config(char *confpath, POOL_CONFIG_CONTEXT context);
526
418
extern void do_child(int unix_fd, int inet_fd);
527
419
extern void pcp_do_child(int unix_fd, int inet_fd, char *pcp_conf_file);
528
420
extern int select_load_balancing_node(void);
531
423
                                                                          POOL_CONNECTION_POOL *backend,
532
424
                                                                          int reset_request);
533
425
 
534
 
extern POOL_CONNECTION *pool_open(int fd);
535
 
extern void pool_close(POOL_CONNECTION *cp);
536
 
extern int pool_read(POOL_CONNECTION *cp, void *buf, int len);
537
 
extern char *pool_read2(POOL_CONNECTION *cp, int len);
538
 
extern int pool_write(POOL_CONNECTION *cp, void *buf, int len);
539
 
extern int pool_flush(POOL_CONNECTION *cp);
540
 
extern int pool_flush_it(POOL_CONNECTION *cp);
541
 
extern int pool_write_and_flush(POOL_CONNECTION *cp, void *buf, int len);
542
 
extern char *pool_read_string(POOL_CONNECTION *cp, int *len, int line);
543
 
extern int pool_unread(POOL_CONNECTION *cp, void *data, int len);
544
 
 
545
426
extern int pool_do_auth(POOL_CONNECTION *frontend, POOL_CONNECTION_POOL *backend);
546
427
extern int pool_do_reauth(POOL_CONNECTION *frontend, POOL_CONNECTION_POOL *cp);
547
428
 
548
 
extern int pool_init_cp(void);
549
 
extern POOL_CONNECTION_POOL *pool_create_cp(void);
550
 
extern POOL_CONNECTION_POOL *pool_get_cp(char *user, char *database, int protoMajor, int check_socket);
551
 
extern void pool_discard_cp(char *user, char *database, int protoMajor);
552
 
extern void pool_backend_timer(void);
553
 
 
554
429
/* SSL functionality */
555
430
extern void pool_ssl_negotiate_serverclient(POOL_CONNECTION *cp);
556
431
extern void pool_ssl_negotiate_clientserver(POOL_CONNECTION *cp);
557
432
extern void pool_ssl_close(POOL_CONNECTION *cp);
558
433
extern int pool_ssl_read(POOL_CONNECTION *cp, void *buf, int size);
559
434
extern int pool_ssl_write(POOL_CONNECTION *cp, const void *buf, int size);
 
435
extern bool pool_ssl_pending(POOL_CONNECTION *cp);
560
436
 
561
437
extern POOL_STATUS ErrorResponse(POOL_CONNECTION *frontend, 
562
438
                                                                  POOL_CONNECTION_POOL *backend);
568
444
extern void degenerate_backend_set(int *node_id_set, int count);
569
445
extern void send_failback_request(int node_id);
570
446
 
571
 
extern void pool_connection_pool_timer(POOL_CONNECTION_POOL *backend);
572
 
extern RETSIGTYPE pool_backend_timer_handler(int sig);
573
 
 
574
 
extern int connect_inet_domain_socket(int secondary_backend);
575
 
extern int connect_unix_domain_socket(int secondary_backend);
576
 
extern int connect_inet_domain_socket_by_port(char *host, int port);
577
 
extern int connect_unix_domain_socket_by_port(int port, char *socket_dir);
578
447
 
579
448
extern void pool_set_timeout(int timeoutval);
580
449
extern int pool_check_fd(POOL_CONNECTION *cp);
587
456
extern int pool_read_int(POOL_CONNECTION_POOL *cp);
588
457
 
589
458
extern POOL_STATUS SimpleForwardToFrontend(char kind, POOL_CONNECTION *frontend, POOL_CONNECTION_POOL *backend);
590
 
extern POOL_STATUS SimpleForwardToBackend(char kind, POOL_CONNECTION *frontend, POOL_CONNECTION_POOL *backend);
 
459
extern POOL_STATUS SimpleForwardToBackend(char kind, POOL_CONNECTION *frontend, POOL_CONNECTION_POOL *backend, int len, char *contents);
591
460
extern POOL_STATUS ParameterStatus(POOL_CONNECTION *frontend, POOL_CONNECTION_POOL *backend);
592
461
 
593
462
extern int pool_init_params(ParamStatus *params);
643
512
extern SystemDBInfo *pool_get_system_db_info(void);
644
513
extern POOL_STATUS OneNode_do_command(POOL_CONNECTION *frontend, POOL_CONNECTION *backend, char *query, char *database);
645
514
 
 
515
/* child.c */
646
516
extern POOL_CONNECTION_POOL_SLOT *make_persistent_db_connection(
647
517
        char *hostname, int port, char *dbname, char *user, char *password);
 
518
extern void discard_persistent_db_connection(POOL_CONNECTION_POOL_SLOT *cp);
648
519
 
649
520
/* define pool_system.c */
650
521
extern POOL_CONNECTION_POOL_SLOT *pool_system_db_connection(void);
660
531
extern int pool_query_cache_register(char kind, POOL_CONNECTION *frontend, char *database, char *data, int data_len, char *query);
661
532
extern int pool_query_cache_table_exists(void);
662
533
extern int pool_clear_cache_by_time(Interval *interval, int size);
 
534
extern POOL_STATUS pool_execute_query_cache_lookup(POOL_CONNECTION *frontend, POOL_CONNECTION_POOL *backend, Node *node);
663
535
 
664
536
/* pool_hba.c */
665
537
extern void load_hba(char *hbapath);
682
554
/* recovery.c */
683
555
extern int start_recovery(int recovery_node);
684
556
extern void finish_recovery(void);
 
557
extern int wait_connection_closed(void);
685
558
 
686
559
/* child.c */
687
 
extern void pool_set_nonblock(int fd);
688
 
extern void pool_unset_nonblock(int fd);
689
560
extern void cancel_request(CancelPacket *sp);
690
561
extern void check_stop_request(void);
691
562
 
699
570
                                           char *query, int protoMajor, int pid, int key, int no_ready_for_query);
700
571
extern POOL_STATUS do_query(POOL_CONNECTION *backend, char *query, POOL_SELECT_RESULT **result, int major);
701
572
extern void free_select_result(POOL_SELECT_RESULT *result);
702
 
 
703
 
/* pool_relcache.c */
704
 
extern POOL_RELCACHE *pool_create_relcache(int cachesize, char *sql,
705
 
                                                                        func_ptr register_func, func_ptr unregister_func,
706
 
                                                                        bool issessionlocal);
707
 
extern void pool_discard_relcache(POOL_RELCACHE *relcache);
708
 
extern void *pool_search_relcache(POOL_RELCACHE *relcache, POOL_CONNECTION_POOL *backend, char *table);
709
 
extern void *int_register_func(POOL_SELECT_RESULT *res);
710
 
extern void *int_unregister_func(void *data);
711
 
 
712
 
/* pool_lobj.c */
713
 
extern char *pool_rewrite_lo_creat(char kind, char *packet, int packet_len, POOL_CONNECTION *frontend, POOL_CONNECTION_POOL *backend, int* len);
 
573
extern int compare(const void *p1, const void *p2);
 
574
extern POOL_STATUS do_error_execute_command(POOL_CONNECTION_POOL *backend, int node_id, int major);
 
575
extern POOL_STATUS pool_discard_packet_contents(POOL_CONNECTION_POOL *cp);
 
576
 
 
577
/* pool_auth.c */
 
578
extern void pool_random_salt(char *md5Salt);
 
579
 
 
580
/* main.c */
 
581
extern void pool_sleep(unsigned int second);
 
582
 
 
583
/* pool_worker_child.c */
 
584
extern void do_worker_child(void);
 
585
 
 
586
/* md5.c */
 
587
extern bool pg_md5_encrypt(const char *passwd, const char *salt, size_t salt_len, char *buf);
 
588
 
 
589
/* pool_connection_pool.c */
 
590
extern int pool_init_cp(void);
 
591
extern POOL_CONNECTION_POOL *pool_create_cp(void);
 
592
extern POOL_CONNECTION_POOL *pool_get_cp(char *user, char *database, int protoMajor, int check_socket);
 
593
extern void pool_discard_cp(char *user, char *database, int protoMajor);
 
594
extern void pool_backend_timer(void);
 
595
extern void pool_connection_pool_timer(POOL_CONNECTION_POOL *backend);
 
596
extern RETSIGTYPE pool_backend_timer_handler(int sig);
 
597
extern int connect_inet_domain_socket(int slot, bool retry);
 
598
extern int connect_unix_domain_socket(int slot, bool retry);
 
599
extern int connect_inet_domain_socket_by_port(char *host, int port, bool retry);
 
600
extern int connect_unix_domain_socket_by_port(int port, char *socket_dir, bool retry);
 
601
extern int pool_pool_index(void);
714
602
 
715
603
#endif /* POOL_H */