[pgpool-committers: 2386] pgpool: First cut of overhauling PCP library and utilities.

Muhammad Usama m.usama at gmail.com
Thu Jan 1 06:36:56 JST 2015

First cut of overhauling PCP library and utilities.

Some major changes in PCP library structure are as follow

-- This commit Introduces a new PCPConnInfo structure which holds the
PCP_CONNECTION and all related information. This structure is returned to the
caller of pcp_connect() function and all subsequent calls to PCP library functions
will require that PCPConnInfo*. The approach is somewhat similar to the design of
PostgreSQL's libpq and will eliminate the need of static PCP_CONNECTION from the library.

-- pcp_connect function now take one extra FILE* type parameter which when given
is used to output debug information, So with this change the static debug boolean
is also remved from library and now each connection object has the its own
information for enabling and disabling the debug output.

-- A new PCPResultInfo structure is introduced that will contains result data and
status of command. This result structure also contains the function pointer to
clean the data if some data in result requires deep cleaning.

-- All the responsibility of allocating and freeing the memory of PCPConnInfo
and PCPResultInfo lies with the PCP library.

-- PCP library is also taught about the ERROR and NOTICE message format of
PostgreSQL protocol version 3. So now delivering an error or notice message to
PCPlibrary and eventually to pcp_* utility is as simple as calling an ereport()
from pcp_child. This not only make the error reporting simple, but also make it
consistent with the rest of pgpool-II. The amount of messages delivered to
pcp client is controlled by client_min_messags configuration parameter of pgpool-II.

-- A new function and protocol message is added to pcp to set the configuration
parameter value of pgpool-II. This can be used to change client_min_messags
value directly from pcp client.

--  New function pcp_get_last_error(PCPConnInfo*) is added which returns the
error string from connection or command failures.



Modified Files
src/include/pcp/libpcp_ext.h      |   97 +-
src/include/pool.h                |    6 +-
src/libs/pcp/pcp.c                | 2229 +++++++++++++++++++------------------
src/main/pgpool_main.c            |    8 +-
src/pcp_con/pcp_child.c           |  449 ++++----
src/pcp_con/recovery.c            |    2 +-
src/tools/pcp/pcp_attach_node.c   |   92 +-
src/tools/pcp/pcp_detach_node.c   |   99 +-
src/tools/pcp/pcp_node_count.c    |   96 +-
src/tools/pcp/pcp_node_info.c     |  117 +-
src/tools/pcp/pcp_pool_status.c   |  105 +-
src/tools/pcp/pcp_proc_count.c    |  106 +-
src/tools/pcp/pcp_proc_info.c     |  149 ++-
src/tools/pcp/pcp_promote_node.c  |   92 +-
src/tools/pcp/pcp_recovery_node.c |   86 +-
src/tools/pcp/pcp_stop_pgpool.c   |  102 +-
src/tools/pcp/pcp_systemdb_info.c |  136 +--
src/tools/pcp/pcp_watchdog_info.c |  115 +-
src/utils/error/elog.c            |   72 +-
src/watchdog/wd_child.c           |    2 +-
20 files changed, 2039 insertions(+), 2121 deletions(-)

More information about the pgpool-committers mailing list